Title: [153391] branches/safari-537-branch

Diff

Modified: branches/safari-537-branch/Source/WebCore/ChangeLog (153390 => 153391)


--- branches/safari-537-branch/Source/WebCore/ChangeLog	2013-07-26 23:46:00 UTC (rev 153390)
+++ branches/safari-537-branch/Source/WebCore/ChangeLog	2013-07-26 23:48:41 UTC (rev 153391)
@@ -1,5 +1,24 @@
 2013-07-26  Lucas Forschler  <[email protected]>
 
+        Merge r153344
+
+    2013-07-25  Sam Weinig  <[email protected]>
+
+            -[WebHTMLView attributedSubstringForProposedRange:actualRange:] does not include strikethrough attribute in the returned attributed string
+            https://bugs.webkit.org/show_bug.cgi?id=119099
+            <rdar://problem/13439291>
+
+            Reviewed by Enrica Casucci.
+
+            Tests:
+                API Test: AttributedStringTest_Strikethrough
+
+            * platform/mac/HTMLConverter.mm:
+            (+[WebHTMLConverter editingAttributedStringFromRange:]):
+            Set the NSStrikethroughStyleAttributeName attribute when text-decoration: line-through is seen.
+
+2013-07-26  Lucas Forschler  <[email protected]>
+
         Merge r153102
 
     2013-07-24  Ryosuke Niwa  <[email protected]>

Modified: branches/safari-537-branch/Source/WebCore/platform/mac/HTMLConverter.mm (153390 => 153391)


--- branches/safari-537-branch/Source/WebCore/platform/mac/HTMLConverter.mm	2013-07-26 23:46:00 UTC (rev 153390)
+++ branches/safari-537-branch/Source/WebCore/platform/mac/HTMLConverter.mm	2013-07-26 23:48:41 UTC (rev 153391)
@@ -1694,6 +1694,8 @@
         RenderStyle* style = renderer->style();
         if (style->textDecorationsInEffect() & TextDecorationUnderline)
             [attrs.get() setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName];
+        if (style->textDecorationsInEffect() & TextDecorationLineThrough)
+            [attrs.get() setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName];
         if (NSFont *font = style->font().primaryFont()->getNSFont())
             [attrs.get() setObject:font forKey:NSFontAttributeName];
         else

Modified: branches/safari-537-branch/Tools/ChangeLog (153390 => 153391)


--- branches/safari-537-branch/Tools/ChangeLog	2013-07-26 23:46:00 UTC (rev 153390)
+++ branches/safari-537-branch/Tools/ChangeLog	2013-07-26 23:48:41 UTC (rev 153391)
@@ -1,5 +1,31 @@
 2013-07-26  Lucas Forschler  <[email protected]>
 
+        Merge r153344
+
+    2013-07-25  Sam Weinig  <[email protected]>
+
+            -[WebHTMLView attributedSubstringForProposedRange:actualRange:] does not include strikethrough attribute in the returned attributed string
+            https://bugs.webkit.org/show_bug.cgi?id=119099
+            <rdar://problem/13439291>
+
+            Reviewed by Enrica Casucci.
+
+            * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+            * TestWebKitAPI/Tests/mac/AttributedString.mm:
+            (TestWebKitAPI::attributedString):
+            (TestWebKitAPI::AttributedStringTest_CustomFont::didLoadURL):
+            (TestWebKitAPI::AttributedStringTest_CustomFont::url):
+            (TestWebKitAPI::AttributedStringTest_CustomFont::runTest):
+            (TestWebKitAPI::TEST_F):
+            (TestWebKitAPI::AttributedStringTest_Strikethrough::didLoadURL):
+            (TestWebKitAPI::AttributedStringTest_Strikethrough::url):
+            (TestWebKitAPI::AttributedStringTest_Strikethrough::runTest):
+            * TestWebKitAPI/Tests/mac/attributedStringStrikethrough.html: Added.
+            Add tests for attributed strings with strikethrough.  Refactor the attributed string tests
+            to make adding more easier in the future.
+
+2013-07-26  Lucas Forschler  <[email protected]>
+
         Merge r153107
 
     2013-07-24  Anders Carlsson  <[email protected]>

Modified: branches/safari-537-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (153390 => 153391)


--- branches/safari-537-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2013-07-26 23:46:00 UTC (rev 153390)
+++ branches/safari-537-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2013-07-26 23:48:41 UTC (rev 153391)
@@ -101,6 +101,7 @@
 		76E182DD1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */; };
 		76E182DF154767E600F1FADD /* auto-submitting-form.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 76E182DE15475A8300F1FADD /* auto-submitting-form.html */; };
 		7C8DDAAB1735DEEE00EA5AC0 /* CloseThenTerminate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8DDAA91735DE1D00EA5AC0 /* CloseThenTerminate.cpp */; };
+		7C9ED98B17A19F4B00E4DC33 /* attributedStringStrikethrough.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 7C9ED98A17A19D0600E4DC33 /* attributedStringStrikethrough.html */; };
 		7CFBCADF1743234F00B2BFCF /* WillLoad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CFBCADD1743234F00B2BFCF /* WillLoad.cpp */; };
 		7CFBCAE51743238F00B2BFCF /* WillLoad_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CFBCAE31743238E00B2BFCF /* WillLoad_Bundle.cpp */; };
 		81B50193140F232300D9EB58 /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81B50192140F232300D9EB58 /* StringBuilder.cpp */; };
@@ -266,6 +267,7 @@
 				379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */,
 				B55F11BE15191A0600915916 /* Ahem.ttf in Copy Resources */,
 				B55F11B71517D03300915916 /* attributedStringCustomFont.html in Copy Resources */,
+				7C9ED98B17A19F4B00E4DC33 /* attributedStringStrikethrough.html in Copy Resources */,
 				76E182DF154767E600F1FADD /* auto-submitting-form.html in Copy Resources */,
 				26DF5A6315A2A27E003689C2 /* CancelLoadFromResourceLoadDelegate.html in Copy Resources */,
 				5142B2731517C8C800C32B19 /* ContextMenuCanCopyURL.html in Copy Resources */,
@@ -402,6 +404,7 @@
 		76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillSendSubmitEvent_Bundle.cpp; sourceTree = "<group>"; };
 		76E182DE15475A8300F1FADD /* auto-submitting-form.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "auto-submitting-form.html"; sourceTree = "<group>"; };
 		7C8DDAA91735DE1D00EA5AC0 /* CloseThenTerminate.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CloseThenTerminate.cpp; sourceTree = "<group>"; };
+		7C9ED98A17A19D0600E4DC33 /* attributedStringStrikethrough.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = attributedStringStrikethrough.html; sourceTree = "<group>"; };
 		7CFBCADD1743234F00B2BFCF /* WillLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillLoad.cpp; sourceTree = "<group>"; };
 		7CFBCAE31743238E00B2BFCF /* WillLoad_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillLoad_Bundle.cpp; sourceTree = "<group>"; };
 		81B50192140F232300D9EB58 /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringBuilder.cpp; path = WTF/StringBuilder.cpp; sourceTree = "<group>"; };
@@ -922,6 +925,7 @@
 		C07E6CB013FD737C0038B22B /* Resources */ = {
 			isa = PBXGroup;
 			children = (
+				7C9ED98A17A19D0600E4DC33 /* attributedStringStrikethrough.html */,
 				C2CF975816CEC69E0054E99D /* JSContextBackForwardCache1.html */,
 				C2CF975916CEC69E0054E99D /* JSContextBackForwardCache2.html */,
 				379028B814FABE49007E6B43 /* acceptsFirstMouse.html */,

Modified: branches/safari-537-branch/Tools/TestWebKitAPI/Tests/mac/AttributedString.mm (153390 => 153391)


--- branches/safari-537-branch/Tools/TestWebKitAPI/Tests/mac/AttributedString.mm	2013-07-26 23:46:00 UTC (rev 153390)
+++ branches/safari-537-branch/Tools/TestWebKitAPI/Tests/mac/AttributedString.mm	2013-07-26 23:48:41 UTC (rev 153391)
@@ -23,71 +23,88 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
-#include "PlatformUtilities.h"
-#include "PlatformWebView.h"
-#include <wtf/RetainPtr.h>
+#import "config.h"
+#import "Test.h"
 
+#import "PlatformUtilities.h"
+#import "PlatformWebView.h"
+#import "WebKitAgnosticTest.h"
+#import <wtf/RetainPtr.h>
 
-@interface AttributedStringTest : NSObject {
+namespace TestWebKitAPI {
+
+static NSAttributedString *attributedString(WebView *webView, NSRange range)
+{
+    return [(NSView <NSTextInput> *)[[[webView mainFrame] frameView] documentView] attributedSubstringFromRange:range];
 }
-@end
 
-static bool didFinishLoad;
+static NSAttributedString *attributedString(WKView *wkView, NSRange range)
+{
+    NSRange actualRange;
+    return [wkView attributedSubstringForProposedRange:range actualRange:&actualRange];
+}
 
-@implementation AttributedStringTest
 
-- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
+class AttributedStringTest_CustomFont : public WebKitAgnosticTest {
+public:
+    template <typename View> void runTest(View);
+
+    // WebKitAgnosticTest
+    virtual void didLoadURL(WebView *webView) { runTest(webView); }
+    virtual void didLoadURL(WKView *wkView) { runTest(wkView); }
+
+    virtual NSURL *url() const { return [[NSBundle mainBundle] URLForResource:@"attributedStringCustomFont" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; }
+};
+
+template <typename View>
+void AttributedStringTest_CustomFont::runTest(View view)
 {
-    didFinishLoad = true;
+    NSAttributedString *attrString = attributedString(view, NSMakeRange(0, 5));
+    EXPECT_WK_STREQ("Lorem", [attrString string]);
 }
-@end
 
-namespace TestWebKitAPI {
+TEST_F(AttributedStringTest_CustomFont, WebKit)
+{
+    runWebKit1Test();
+}
 
-static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*)
+TEST_F(AttributedStringTest_CustomFont, WebKit2)
 {
-    didFinishLoad = true;
+    runWebKit2Test();
 }
 
-TEST(WebKit1, AttributedStringTest)
+class AttributedStringTest_Strikethrough : public WebKitAgnosticTest {
+public:
+    template <typename View> void runTest(View);
+
+    // WebKitAgnosticTest
+    virtual void didLoadURL(WebView *webView) { runTest(webView); }
+    virtual void didLoadURL(WKView *wkView) { runTest(wkView); }
+
+    virtual NSURL *url() const { return [[NSBundle mainBundle] URLForResource:@"attributedStringStrikethrough" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; }
+};
+
+template <typename View>
+void AttributedStringTest_Strikethrough::runTest(View view)
 {
-    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<AttributedStringTest> testController = adoptNS([AttributedStringTest new]);
-    
-    webView.get().frameLoadDelegate = testController.get();
-    [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"attributedStringCustomFont" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
-    
-    Util::run(&didFinishLoad);
-    didFinishLoad = false;
-        
-    NSAttributedString *attrString = [(NSView <NSTextInput> *)[[[webView.get() mainFrame] frameView] documentView] attributedSubstringFromRange:NSMakeRange(0, 5)];
+    NSAttributedString *attrString = attributedString(view, NSMakeRange(0, 5));
 
     EXPECT_WK_STREQ("Lorem", [attrString string]);
+    
+    NSDictionary *attributes = [attrString attributesAtIndex:0 effectiveRange:0];
+    ASSERT_NOT_NULL([attributes objectForKey:NSStrikethroughStyleAttributeName]);
+    ASSERT_TRUE([[attributes objectForKey:NSStrikethroughStyleAttributeName] isKindOfClass:[NSNumber class]]);
+    ASSERT_EQ(NSUnderlineStyleSingle, [(NSNumber *)[attributes objectForKey:NSStrikethroughStyleAttributeName] intValue]);
 }
 
-TEST(WebKit2, AttributedStringTest)
+TEST_F(AttributedStringTest_Strikethrough, WebKit)
 {
-    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
-    PlatformWebView webView(context.get());
-    
-    WKPageLoaderClient loaderClient;
-    memset(&loaderClient, 0, sizeof(loaderClient));
-    loaderClient.version = 0;
-    loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
-    WKPageSetPageLoaderClient(webView.page(), &loaderClient);
-    
-    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("attributedStringCustomFont", "html")).get());
+    runWebKit1Test();
+}
 
-    Util::run(&didFinishLoad);
-    didFinishLoad = false;
-    
-    NSRange range = NSMakeRange(0, 5);
-    NSRange actualRange;
-    NSAttributedString *attrString = [webView.platformView() attributedSubstringForProposedRange:range actualRange:&actualRange];
-
-    EXPECT_WK_STREQ("Lorem", [attrString string]);
+TEST_F(AttributedStringTest_Strikethrough, WebKit2)
+{
+    runWebKit2Test();
 }
 
-    
 } // namespace TestWebKitAPI

Copied: branches/safari-537-branch/Tools/TestWebKitAPI/Tests/mac/attributedStringStrikethrough.html (from rev 153344, trunk/Tools/TestWebKitAPI/Tests/mac/attributedStringStrikethrough.html) (0 => 153391)


--- branches/safari-537-branch/Tools/TestWebKitAPI/Tests/mac/attributedStringStrikethrough.html	                        (rev 0)
+++ branches/safari-537-branch/Tools/TestWebKitAPI/Tests/mac/attributedStringStrikethrough.html	2013-07-26 23:48:41 UTC (rev 153391)
@@ -0,0 +1,11 @@
+<html>
+    <head>
+        <style>
+        </style>
+    </head>
+    <body contenteditable style="text-decoration: line-through;">Lorem Ipsum
+        <script>
+            document.body.focus();
+        </script>
+    </body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to