Title: [170924] trunk/Source
Revision
170924
Author
enr...@apple.com
Date
2014-07-09 12:11:47 -0700 (Wed, 09 Jul 2014)

Log Message

Implement Editor::fontAttributesForSelectionStart() or iOS.
https://bugs.webkit.org/show_bug.cgi?id=134771
<rdar://problem/16167838>

Reviewed by Ryosuke Niwa.


Source/WebCore: 
Implement for iOS the equivalent function we have for OS X.

* editing/ios/EditorIOS.mm:
(WebCore::Editor::fontAttributesForSelectionStart):

Source/WebKit/mac: 
* WebView/WebViewPrivate.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (170923 => 170924)


--- trunk/Source/WebCore/ChangeLog	2014-07-09 19:10:21 UTC (rev 170923)
+++ trunk/Source/WebCore/ChangeLog	2014-07-09 19:11:47 UTC (rev 170924)
@@ -1,3 +1,16 @@
+2014-07-09  Enrica Casucci  <enr...@apple.com>
+
+        Implement Editor::fontAttributesForSelectionStart() or iOS.
+        https://bugs.webkit.org/show_bug.cgi?id=134771
+        <rdar://problem/16167838>
+
+        Reviewed by Ryosuke Niwa.
+
+        Implement for iOS the equivalent function we have for OS X.
+
+        * editing/ios/EditorIOS.mm:
+        (WebCore::Editor::fontAttributesForSelectionStart):
+
 2014-07-09  Brent Fulgham  <bfulg...@apple.com>
 
         [Win] Remove use of 'grep' in build steps

Modified: trunk/Source/WebCore/editing/ios/EditorIOS.mm (170923 => 170924)


--- trunk/Source/WebCore/editing/ios/EditorIOS.mm	2014-07-09 19:10:21 UTC (rev 170923)
+++ trunk/Source/WebCore/editing/ios/EditorIOS.mm	2014-07-09 19:11:47 UTC (rev 170924)
@@ -80,6 +80,12 @@
 #define kUTTagClassFilenameExtension getkUTTagClassFilenameExtension()
 #define kUTTagClassMIMEType getkUTTagClassMIMEType()
 
+SOFT_LINK_PRIVATE_FRAMEWORK(UIFoundation)
+SOFT_LINK_CONSTANT(UIFoundation, NSFontAttributeName, NSString *)
+#define NSFontAttributeName getNSFontAttributeName()
+SOFT_LINK_CONSTANT(UIFoundation, NSUnderlineStyleAttributeName, NSString *)
+#define NSUnderlineStyleAttributeName getNSUnderlineStyleAttributeName()
+
 @interface NSAttributedString (NSAttributedStringKitAdditions)
 - (id)initWithRTF:(NSData *)data documentAttributes:(NSDictionary **)dict;
 - (id)initWithRTFD:(NSData *)data documentAttributes:(NSDictionary **)dict;
@@ -88,6 +94,21 @@
 - (BOOL)containsAttachments;
 @end
 
+typedef NS_ENUM(NSInteger, NSUnderlineStyle) {
+    NSUnderlineStyleNone                                = 0x00,
+    NSUnderlineStyleSingle                              = 0x01,
+    NSUnderlineStyleThick NS_ENUM_AVAILABLE_IOS(7_0)    = 0x02,
+    NSUnderlineStyleDouble NS_ENUM_AVAILABLE_IOS(7_0)   = 0x09,
+    
+    NSUnderlinePatternSolid NS_ENUM_AVAILABLE_IOS(7_0)      = 0x0000,
+    NSUnderlinePatternDot NS_ENUM_AVAILABLE_IOS(7_0)        = 0x0100,
+    NSUnderlinePatternDash NS_ENUM_AVAILABLE_IOS(7_0)       = 0x0200,
+    NSUnderlinePatternDashDot NS_ENUM_AVAILABLE_IOS(7_0)    = 0x0300,
+    NSUnderlinePatternDashDotDot NS_ENUM_AVAILABLE_IOS(7_0) = 0x0400,
+    
+    NSUnderlineByWord NS_ENUM_AVAILABLE_IOS(7_0) = 0x8000
+};
+
 namespace WebCore {
 
 using namespace HTMLNames;
@@ -238,6 +259,17 @@
         return nil;
 
     NSMutableDictionary* result = [NSMutableDictionary dictionary];
+    
+    CTFontRef font = style->font().primaryFont()->getCTFont();
+    if (font)
+        [result setObject:(id)font forKey:NSFontAttributeName];
+    
+    if (style->textDecorationsInEffect() & TextDecorationUnderline)
+        [result setObject:[NSNumber numberWithInt:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName];
+    
+    if (nodeToRemove)
+        nodeToRemove->remove(ASSERT_NO_EXCEPTION);
+    
     return result;
 }
 

Modified: trunk/Source/WebKit/mac/ChangeLog (170923 => 170924)


--- trunk/Source/WebKit/mac/ChangeLog	2014-07-09 19:10:21 UTC (rev 170923)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-07-09 19:11:47 UTC (rev 170924)
@@ -1,3 +1,13 @@
+2014-07-09  Enrica Casucci  <enr...@apple.com>
+
+        Implement Editor::fontAttributesForSelectionStart() or iOS.
+        https://bugs.webkit.org/show_bug.cgi?id=134771
+        <rdar://problem/16167838>
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebView/WebViewPrivate.h:
+
 2014-07-08  Tim Horton  <timothy_hor...@apple.com>
 
         [WK2] Expose a few drawing/compositing settings on WKPreferences(Private)

Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (170923 => 170924)


--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h	2014-07-09 19:10:21 UTC (rev 170923)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h	2014-07-09 19:11:47 UTC (rev 170924)
@@ -184,6 +184,7 @@
 @interface WebView (WebViewEditingActionsPendingPublic)
 
 - (void)outdent:(id)sender;
+- (NSDictionary *)typingAttributes;
 
 @end
 
@@ -972,6 +973,7 @@
 - (void)initializationAllowedWebView:(WebView *)webView;
 - (void)initializationDeniedWebView:(WebView *)webView;
 @end
+
 #endif
 
 @interface WebView (WebViewUserMedia)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to