Title: [186086] trunk/Source
Revision
186086
Author
[email protected]
Date
2015-06-29 14:38:31 -0700 (Mon, 29 Jun 2015)

Log Message

Font panel doesn't get updated when bolding text via cmd+b in Mail on OS X
https://bugs.webkit.org/show_bug.cgi?id=146379

Reviewed by Darin Adler.

Source/WebCore:

The bug was caused by WebKit not updating the font panel when the typing style changes.
There was also a bug that WebKit never updated font attributes on OS X.

Fixed the bugs by always updating the font panel after applying style instead of only
when the selection changes and setting the font attributes.

I tried really had to write a WebKit API test but I couldn't get it to work so there are
no new tests :(

* WebCore.xcodeproj/project.pbxproj:
* editing/Editor.cpp:
(WebCore::Editor::applyStyle):
(WebCore::Editor::shouldApplyStyle):
(WebCore::Editor::applyParagraphStyle):
(WebCore::Editor::applyStyleToSelection):
(WebCore::Editor::applyParagraphStyleToSelection):
(WebCore::Editor::selectionStartHasStyle):
(WebCore::Editor::document):
(WebCore::Editor::styleForSelectionStart): Deleted.
* editing/Editor.h:
* editing/cocoa/EditorCocoa.h: Added. Shares the declaration for NSUnderlineStyle in iOS.
* editing/cocoa/EditorCocoa.mm: Added.
(WebCore::Editor::styleForSelectionStart): Moved from Editor.cpp
(WebCore::Editor::getTextDecorationAttributesRespectingTypingStyle): Extracted from iOS's
fontAttributesForSelectionStart implementation.
* editing/cocoa/HTMLConverter.mm:
* editing/ios/EditorIOS.mm:
(WebCore::Editor::fontAttributesForSelectionStart):
* editing/mac/EditorMac.mm:
(WebCore::Editor::fontAttributesForSelectionStart):
* loader/EmptyClients.h:
* page/EditorClient.h:

Source/WebKit/mac:

Update the font panel when newly added EditorClient::didApplyStyle is called. Also set the font attributes
in _updateFontPanel so that underline and strike through states will be reflected.

* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::shouldApplyStyle):
(updateFontPanelIfNeeded): Extracted from respondToChangedContents.
(WebEditorClient::didApplyStyle): Added.
(WebEditorClient::respondToChangedContents):
* WebView/WebHTMLView.mm:
(-[WebHTMLView _updateFontPanel]): Sets font attributes as well as font.

Source/WebKit/win:

* WebCoreSupport/WebEditorClient.cpp:
(WebEditorClient::didApplyStyle): Added.
* WebCoreSupport/WebEditorClient.h:

Source/WebKit2:

Since font panel doesn't open in WebKit2 at the moment, just add an empty implementation of didApplyStyle

* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::didApplyStyle):
* WebProcess/WebCoreSupport/WebEditorClient.h:
* WebProcess/WebPage/WebPage.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (186085 => 186086)


--- trunk/Source/WebCore/ChangeLog	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebCore/ChangeLog	2015-06-29 21:38:31 UTC (rev 186086)
@@ -1,3 +1,43 @@
+2015-06-27  Ryosuke Niwa  <[email protected]>
+
+        Font panel doesn't get updated when bolding text via cmd+b in Mail on OS X
+        https://bugs.webkit.org/show_bug.cgi?id=146379
+
+        Reviewed by Darin Adler.
+
+        The bug was caused by WebKit not updating the font panel when the typing style changes.
+        There was also a bug that WebKit never updated font attributes on OS X.
+
+        Fixed the bugs by always updating the font panel after applying style instead of only
+        when the selection changes and setting the font attributes.
+
+        I tried really had to write a WebKit API test but I couldn't get it to work so there are
+        no new tests :(
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * editing/Editor.cpp:
+        (WebCore::Editor::applyStyle):
+        (WebCore::Editor::shouldApplyStyle):
+        (WebCore::Editor::applyParagraphStyle):
+        (WebCore::Editor::applyStyleToSelection):
+        (WebCore::Editor::applyParagraphStyleToSelection):
+        (WebCore::Editor::selectionStartHasStyle):
+        (WebCore::Editor::document):
+        (WebCore::Editor::styleForSelectionStart): Deleted.
+        * editing/Editor.h:
+        * editing/cocoa/EditorCocoa.h: Added. Shares the declaration for NSUnderlineStyle in iOS.
+        * editing/cocoa/EditorCocoa.mm: Added.
+        (WebCore::Editor::styleForSelectionStart): Moved from Editor.cpp
+        (WebCore::Editor::getTextDecorationAttributesRespectingTypingStyle): Extracted from iOS's
+        fontAttributesForSelectionStart implementation.
+        * editing/cocoa/HTMLConverter.mm:
+        * editing/ios/EditorIOS.mm:
+        (WebCore::Editor::fontAttributesForSelectionStart):
+        * editing/mac/EditorMac.mm:
+        (WebCore::Editor::fontAttributesForSelectionStart):
+        * loader/EmptyClients.h:
+        * page/EditorClient.h:
+
 2015-06-29  Matt Rajca  <[email protected]>
 
         MediaSession: use a HashSet for the collection of participating elements

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (186085 => 186086)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-06-29 21:38:31 UTC (rev 186086)
@@ -3788,11 +3788,13 @@
 		9B417064125662B3006B28FC /* ApplyBlockElementCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B417062125662B3006B28FC /* ApplyBlockElementCommand.h */; };
 		9B417065125662B3006B28FC /* ApplyBlockElementCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B417063125662B3006B28FC /* ApplyBlockElementCommand.cpp */; };
 		9B50B1DE17CD4C0F0087F63C /* FormNamedItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B50B1DC17CD4C0F0087F63C /* FormNamedItem.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		9B55EEE91B3E8898005342BC /* EditorCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9B55EEE81B3E8898005342BC /* EditorCocoa.mm */; };
 		9B6C41531344949000085B62 /* StringWithDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B6C41521344949000085B62 /* StringWithDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		9BA273F4172206BB0097CE47 /* LogicalSelectionOffsetCaches.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BA273F3172206BB0097CE47 /* LogicalSelectionOffsetCaches.h */; };
 		9BAB6C6C12550631001626D4 /* EditingStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BAB6C6A12550631001626D4 /* EditingStyle.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		9BAB6C6D12550631001626D4 /* EditingStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BAB6C6B12550631001626D4 /* EditingStyle.cpp */; };
 		9BAF3B2412C1A39800014BF1 /* WritingDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BAF3B2312C1A39800014BF1 /* WritingDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		9BB737651B41C03500AE13EB /* NSAttributedStringSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BB737641B41C03500AE13EB /* NSAttributedStringSPI.h */; };
 		9BC6C21B13CCC97B008E0337 /* HTMLTextFormControlElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BC6C21913CCC97B008E0337 /* HTMLTextFormControlElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		9BC6C21C13CCC97B008E0337 /* HTMLTextFormControlElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BC6C21A13CCC97B008E0337 /* HTMLTextFormControlElement.cpp */; };
 		9BD0BF9312A42BF50072FD43 /* ScopedEventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BD0BF9112A42BF50072FD43 /* ScopedEventQueue.h */; };
@@ -11115,11 +11117,14 @@
 		9B417062125662B3006B28FC /* ApplyBlockElementCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplyBlockElementCommand.h; sourceTree = "<group>"; };
 		9B417063125662B3006B28FC /* ApplyBlockElementCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ApplyBlockElementCommand.cpp; sourceTree = "<group>"; };
 		9B50B1DC17CD4C0F0087F63C /* FormNamedItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormNamedItem.h; sourceTree = "<group>"; };
+		9B55EEE81B3E8898005342BC /* EditorCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EditorCocoa.mm; sourceTree = "<group>"; };
+		9B55EEEA1B3F3FEF005342BC /* EditorCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EditorCocoa.h; sourceTree = "<group>"; };
 		9B6C41521344949000085B62 /* StringWithDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringWithDirection.h; sourceTree = "<group>"; };
 		9BA273F3172206BB0097CE47 /* LogicalSelectionOffsetCaches.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LogicalSelectionOffsetCaches.h; sourceTree = "<group>"; };
 		9BAB6C6A12550631001626D4 /* EditingStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingStyle.h; sourceTree = "<group>"; };
 		9BAB6C6B12550631001626D4 /* EditingStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EditingStyle.cpp; sourceTree = "<group>"; };
 		9BAF3B2312C1A39800014BF1 /* WritingDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WritingDirection.h; sourceTree = "<group>"; };
+		9BB737641B41C03500AE13EB /* NSAttributedStringSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSAttributedStringSPI.h; sourceTree = "<group>"; };
 		9BC6C21913CCC97B008E0337 /* HTMLTextFormControlElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLTextFormControlElement.h; sourceTree = "<group>"; };
 		9BC6C21A13CCC97B008E0337 /* HTMLTextFormControlElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLTextFormControlElement.cpp; sourceTree = "<group>"; };
 		9BD0BF9112A42BF50072FD43 /* ScopedEventQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScopedEventQueue.h; sourceTree = "<group>"; };
@@ -16636,6 +16641,7 @@
 				44EFF6421A6FF92700D45EEC /* IOTypesSPI.h */,
 				CE12524E1A1A78D200864480 /* MachVMSPI.h */,
 				A19D93441A9FEC7200B46C24 /* NEFilterSourceSPI.h */,
+				9BB737641B41C03500AE13EB /* NSAttributedStringSPI.h */,
 				CE1252501A1BEBD800864480 /* NSCalendarDateSPI.h */,
 				31DF63561AF187DD0078FD91 /* NSColorSPI.h */,
 				2DDB97F319F9AECA002025D8 /* NSExtensionSPI.h */,
@@ -17169,6 +17175,8 @@
 		7C3E510718DF8F1200C112F7 /* cocoa */ = {
 			isa = PBXGroup;
 			children = (
+				9B55EEEA1B3F3FEF005342BC /* EditorCocoa.h */,
+				9B55EEE81B3E8898005342BC /* EditorCocoa.mm */,
 				7C3E510818DF8F3500C112F7 /* HTMLConverter.h */,
 				7C3E510918DF8F3500C112F7 /* HTMLConverter.mm */,
 			);
@@ -24687,6 +24695,7 @@
 				31C0FF4E0E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h in Headers */,
 				85C7F5E70AAFBAFB004014DD /* DOMWheelEvent.h in Headers */,
 				85989DD10ACC8BBD00A0BC51 /* DOMWheelEventInternal.h in Headers */,
+				9BB737651B41C03500AE13EB /* NSAttributedStringSPI.h in Headers */,
 				1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */,
 				FC9A0F75164094CF003D6B8D /* DOMWindowCSS.h in Headers */,
 				51FA2D78152132B300C1BA0B /* DOMWindowExtension.h in Headers */,
@@ -29623,6 +29632,7 @@
 				FE9E89FB16E2DC0500A908F8 /* OriginLock.cpp in Sources */,
 				FD581FAE1520F91F003A7A75 /* OscillatorNode.cpp in Sources */,
 				1A0D57360A5C77FE007EDD4C /* OverflowEvent.cpp in Sources */,
+				9B55EEE91B3E8898005342BC /* EditorCocoa.mm in Sources */,
 				65FEA86909833ADE00BED4AB /* Page.cpp in Sources */,
 				1477E7760BF4134A00152872 /* PageCache.cpp in Sources */,
 				CD5E5B611A15F156000C609E /* PageConfiguration.cpp in Sources */,

Modified: trunk/Source/WebCore/editing/Editor.cpp (186085 => 186086)


--- trunk/Source/WebCore/editing/Editor.cpp	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebCore/editing/Editor.cpp	2015-06-29 21:38:31 UTC (rev 186086)
@@ -884,8 +884,7 @@
 {
     switch (m_frame.selection().selection().selectionType()) {
     case VisibleSelection::NoSelection:
-        // do nothing
-        break;
+        return;
     case VisibleSelection::CaretSelection:
         computeAndSetTypingStyle(EditingStyle::create(style), editingAction);
         break;
@@ -894,14 +893,14 @@
             applyCommand(ApplyStyleCommand::create(document(), EditingStyle::create(style).ptr(), editingAction));
         break;
     }
+    client()->didApplyStyle();
 }
 
 void Editor::applyStyle(RefPtr<EditingStyle>&& style, EditAction editingAction)
 {
     switch (m_frame.selection().selection().selectionType()) {
     case VisibleSelection::NoSelection:
-        // do nothing
-        break;
+        return;
     case VisibleSelection::CaretSelection:
         computeAndSetTypingStyle(*style, editingAction);
         break;
@@ -910,6 +909,7 @@
             applyCommand(ApplyStyleCommand::create(document(), style.get(), editingAction));
         break;
     }
+    client()->didApplyStyle();
 }
     
 bool Editor::shouldApplyStyle(StyleProperties* style, Range* range)
@@ -921,14 +921,14 @@
 {
     switch (m_frame.selection().selection().selectionType()) {
     case VisibleSelection::NoSelection:
-        // do nothing
-        break;
+        return;
     case VisibleSelection::CaretSelection:
     case VisibleSelection::RangeSelection:
         if (style)
             applyCommand(ApplyStyleCommand::create(document(), EditingStyle::create(style).ptr(), editingAction, ApplyStyleCommand::ForceBlockProperties));
         break;
     }
+    client()->didApplyStyle();
 }
 
 void Editor::applyStyleToSelection(StyleProperties* style, EditAction editingAction)
@@ -3568,37 +3568,4 @@
     return *m_frame.document();
 }
 
-#if PLATFORM(COCOA)
-// FIXME: This figures out the current style by inserting a <span>!
-RenderStyle* Editor::styleForSelectionStart(Frame* frame, Node *&nodeToRemove)
-{
-    nodeToRemove = nullptr;
-
-    if (frame->selection().isNone())
-        return nullptr;
-
-    Position position = frame->selection().selection().visibleStart().deepEquivalent();
-    if (!position.isCandidate() || position.isNull())
-        return nullptr;
-
-    RefPtr<EditingStyle> typingStyle = frame->selection().typingStyle();
-    if (!typingStyle || !typingStyle->style())
-        return &position.deprecatedNode()->renderer()->style();
-
-    RefPtr<Element> styleElement = frame->document()->createElement(spanTag, false);
-
-    String styleText = typingStyle->style()->asText() + " display: inline";
-    styleElement->setAttribute(styleAttr, styleText);
-
-    styleElement->appendChild(frame->document()->createEditingTextNode(""), ASSERT_NO_EXCEPTION);
-
-    position.deprecatedNode()->parentNode()->appendChild(styleElement, ASSERT_NO_EXCEPTION);
-
-    nodeToRemove = styleElement.get();
-
-    frame->document()->updateStyleIfNeeded();
-    return styleElement->renderer() ? &styleElement->renderer()->style() : nullptr;
-}
-#endif
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/editing/Editor.h (186085 => 186086)


--- trunk/Source/WebCore/editing/Editor.h	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebCore/editing/Editor.h	2015-06-29 21:38:31 UTC (rev 186086)
@@ -45,6 +45,7 @@
 #if PLATFORM(COCOA)
 OBJC_CLASS NSAttributedString;
 OBJC_CLASS NSDictionary;
+OBJC_CLASS NSMutableDictionary;
 #endif
 
 namespace WebCore {
@@ -424,6 +425,7 @@
 
 #if PLATFORM(COCOA)
     WEBCORE_EXPORT static RenderStyle* styleForSelectionStart(Frame* , Node *&nodeToRemove);
+    void getTextDecorationAttributesRespectingTypingStyle(RenderStyle&, NSMutableDictionary*) const;
     WEBCORE_EXPORT bool insertParagraphSeparatorInQuotedContent();
     WEBCORE_EXPORT const Font* fontForSelection(bool&) const;
     WEBCORE_EXPORT NSDictionary *fontAttributesForSelectionStart() const;

Added: trunk/Source/WebCore/editing/cocoa/EditorCocoa.h (0 => 186086)


--- trunk/Source/WebCore/editing/cocoa/EditorCocoa.h	                        (rev 0)
+++ trunk/Source/WebCore/editing/cocoa/EditorCocoa.h	2015-06-29 21:38:31 UTC (rev 186086)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2013, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EditorCocoa_h
+#define EditorCocoa_h
+
+#include "Editor.h"
+
+#if PLATFORM(IOS)
+
+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
+};
+
+#endif
+
+#endif

Added: trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm (0 => 186086)


--- trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm	                        (rev 0)
+++ trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm	2015-06-29 21:38:31 UTC (rev 186086)
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2013, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "Editor.h"
+
+#import "CSSValueList.h"
+#import "CSSValuePool.h"
+#import "EditingStyle.h"
+#import "Frame.h"
+#import "FrameSelection.h"
+#import "NSAttributedStringSPI.h"
+#import "RenderElement.h"
+#import "RenderStyle.h"
+#import "SoftLinking.h"
+#import "Text.h"
+
+namespace WebCore {
+
+// FIXME: This figures out the current style by inserting a <span>!
+RenderStyle* Editor::styleForSelectionStart(Frame* frame, Node *&nodeToRemove)
+{
+    nodeToRemove = nullptr;
+    
+    if (frame->selection().isNone())
+        return nullptr;
+
+    Position position = frame->selection().selection().visibleStart().deepEquivalent();
+    if (!position.isCandidate() || position.isNull())
+        return nullptr;
+
+    RefPtr<EditingStyle> typingStyle = frame->selection().typingStyle();
+    if (!typingStyle || !typingStyle->style())
+        return &position.deprecatedNode()->renderer()->style();
+
+    RefPtr<Element> styleElement = frame->document()->createElement(HTMLNames::spanTag, false);
+
+    String styleText = typingStyle->style()->asText() + " display: inline";
+    styleElement->setAttribute(HTMLNames::styleAttr, styleText);
+
+    styleElement->appendChild(frame->document()->createEditingTextNode(""), ASSERT_NO_EXCEPTION);
+
+    position.deprecatedNode()->parentNode()->appendChild(styleElement, ASSERT_NO_EXCEPTION);
+
+    nodeToRemove = styleElement.get();
+
+    frame->document()->updateStyleIfNeeded();
+    return styleElement->renderer() ? &styleElement->renderer()->style() : nullptr;
+}
+
+void Editor::getTextDecorationAttributesRespectingTypingStyle(RenderStyle& style, NSMutableDictionary* result) const
+{
+    RefPtr<EditingStyle> typingStyle = m_frame.selection().typingStyle();
+    if (typingStyle && typingStyle->style()) {
+        RefPtr<CSSValue> value = typingStyle->style()->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect);
+        if (value && value->isValueList()) {
+            CSSValueList& valueList = downcast<CSSValueList>(*value);
+            if (valueList.hasValue(cssValuePool().createIdentifierValue(CSSValueLineThrough).ptr()))
+                [result setObject:[NSNumber numberWithInt:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName];
+            if (valueList.hasValue(cssValuePool().createIdentifierValue(CSSValueUnderline).ptr()))
+                [result setObject:[NSNumber numberWithInt:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName];
+        }
+    } else {
+        int decoration = style.textDecorationsInEffect();
+        if (decoration & TextDecorationLineThrough)
+            [result setObject:[NSNumber numberWithInt:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName];
+        if (decoration & TextDecorationUnderline)
+            [result setObject:[NSNumber numberWithInt:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName];
+    }
+}
+
+}

Modified: trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm (186085 => 186086)


--- trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm	2015-06-29 21:38:31 UTC (rev 186086)
@@ -53,6 +53,7 @@
 #import "HTMLTableCellElement.h"
 #import "HTMLTextAreaElement.h"
 #import "LoaderNSURLExtras.h"
+#import "NSAttributedStringSPI.h"
 #import "RGBColor.h"
 #import "RenderImage.h"
 #import "SoftLinking.h"
@@ -194,21 +195,6 @@
     UIFontTraitUltraLight  = (1 << 4)
 } UIFontTrait;
 
-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
-};
-
 enum {
     NSTextBlockAbsoluteValueType    = 0,    // Absolute value in points
     NSTextBlockPercentageValueType  = 1     // Percentage value (out of 100)

Modified: trunk/Source/WebCore/editing/ios/EditorIOS.mm (186085 => 186086)


--- trunk/Source/WebCore/editing/ios/EditorIOS.mm	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebCore/editing/ios/EditorIOS.mm	2015-06-29 21:38:31 UTC (rev 186086)
@@ -44,6 +44,7 @@
 #include "HTMLParserIdioms.h"
 #include "HTMLTextAreaElement.h"
 #include "LegacyWebArchive.h"
+#include "NSAttributedStringSPI.h"
 #include "NodeTraversal.h"
 #include "Page.h"
 #include "Pasteboard.h"
@@ -77,12 +78,6 @@
 #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;
@@ -91,21 +86,6 @@
 - (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;
@@ -261,15 +241,8 @@
     if (font)
         [result setObject:(id)font forKey:NSFontAttributeName];
 
-    RefPtr<EditingStyle> typingStyle = m_frame.selection().typingStyle();
-    if (typingStyle && typingStyle->style()) {
-        String value = typingStyle->style()->getPropertyValue(CSSPropertyWebkitTextDecorationsInEffect);
-        if (value.contains("underline"))
-            [result setObject:[NSNumber numberWithInt:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName];
-    } else {
-        if (style->textDecorationsInEffect() & TextDecorationUnderline)
-            [result setObject:[NSNumber numberWithInt:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName];
-    }
+    getTextDecorationAttributesRespectingTypingStyle(*style, result);
+
     if (nodeToRemove)
         nodeToRemove->remove(ASSERT_NO_EXCEPTION);
     

Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (186085 => 186086)


--- trunk/Source/WebCore/editing/mac/EditorMac.mm	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm	2015-06-29 21:38:31 UTC (rev 186086)
@@ -179,10 +179,6 @@
         [result setObject:s.get() forKey:NSShadowAttributeName];
     }
 
-    int decoration = style->textDecorationsInEffect();
-    if (decoration & TextDecorationLineThrough)
-        [result setObject:[NSNumber numberWithInt:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName];
-
     int superscriptInt = 0;
     switch (style->verticalAlign()) {
         case BASELINE:
@@ -204,8 +200,7 @@
     if (superscriptInt)
         [result setObject:[NSNumber numberWithInt:superscriptInt] forKey:NSSuperscriptAttributeName];
 
-    if (decoration & TextDecorationUnderline)
-        [result setObject:[NSNumber numberWithInt:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName];
+    getTextDecorationAttributesRespectingTypingStyle(*style, result);
 
     if (nodeToRemove)
         nodeToRemove->remove(ASSERT_NO_EXCEPTION);

Modified: trunk/Source/WebCore/loader/EmptyClients.h (186085 => 186086)


--- trunk/Source/WebCore/loader/EmptyClients.h	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2015-06-29 21:38:31 UTC (rev 186086)
@@ -442,6 +442,7 @@
     virtual bool shouldChangeSelectedRange(Range*, Range*, EAffinity, bool) override { return false; }
 
     virtual bool shouldApplyStyle(StyleProperties*, Range*) override { return false; }
+    virtual void didApplyStyle() override { }
     virtual bool shouldMoveRangeAfterDelete(Range*, Range*) override { return false; }
 
     virtual void didBeginEditing() override { }

Modified: trunk/Source/WebCore/page/EditorClient.h (186085 => 186086)


--- trunk/Source/WebCore/page/EditorClient.h	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebCore/page/EditorClient.h	2015-06-29 21:38:31 UTC (rev 186086)
@@ -88,6 +88,7 @@
     virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting) = 0;
     
     virtual bool shouldApplyStyle(StyleProperties*, Range*) = 0;
+    virtual void didApplyStyle() = 0;
     virtual bool shouldMoveRangeAfterDelete(Range*, Range*) = 0;
 
     virtual void didBeginEditing() = 0;

Added: trunk/Source/WebCore/platform/spi/cocoa/NSAttributedStringSPI.h (0 => 186086)


--- trunk/Source/WebCore/platform/spi/cocoa/NSAttributedStringSPI.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/spi/cocoa/NSAttributedStringSPI.h	2015-06-29 21:38:31 UTC (rev 186086)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NSAttributedStringSPI_h
+#define NSAttributedStringSPI_h
+
+#import "SoftLinking.h"
+
+#if PLATFORM(IOS)
+
+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
+};
+
+SOFT_LINK_PRIVATE_FRAMEWORK(UIFoundation)
+
+SOFT_LINK_CONSTANT(UIFoundation, NSUnderlineStyleAttributeName, NSString *)
+#define NSUnderlineStyleAttributeName getNSUnderlineStyleAttributeName()
+SOFT_LINK_CONSTANT(UIFoundation, NSStrikethroughStyleAttributeName, NSString *)
+#define NSStrikethroughStyleAttributeName getNSStrikethroughStyleAttributeName()
+
+#endif
+
+#endif

Modified: trunk/Source/WebKit/mac/ChangeLog (186085 => 186086)


--- trunk/Source/WebKit/mac/ChangeLog	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-06-29 21:38:31 UTC (rev 186086)
@@ -1,3 +1,22 @@
+2015-06-27  Ryosuke Niwa  <[email protected]>
+
+        Font panel doesn't get updated when bolding text via cmd+b in Mail on OS X
+        https://bugs.webkit.org/show_bug.cgi?id=146379
+
+        Reviewed by Darin Adler.
+
+        Update the font panel when newly added EditorClient::didApplyStyle is called. Also set the font attributes
+        in _updateFontPanel so that underline and strike through states will be reflected.
+
+        * WebCoreSupport/WebEditorClient.h:
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::shouldApplyStyle):
+        (updateFontPanelIfNeeded): Extracted from respondToChangedContents.
+        (WebEditorClient::didApplyStyle): Added.
+        (WebEditorClient::respondToChangedContents):
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _updateFontPanel]): Sets font attributes as well as font.
+
 2015-06-29  Dean Jackson  <[email protected]>
 
         Setting to enable/disable media controls sizing on page zoom

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h (186085 => 186086)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h	2015-06-29 21:38:31 UTC (rev 186086)
@@ -69,7 +69,8 @@
     virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting) override;
 
     virtual bool shouldApplyStyle(WebCore::StyleProperties*, WebCore::Range*) override;
-    
+    virtual void didApplyStyle() override;
+
     virtual bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range* rangeToBeReplaced) override;
 
     virtual void didBeginEditing() override;

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm (186085 => 186086)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm	2015-06-29 21:38:31 UTC (rev 186086)
@@ -258,6 +258,22 @@
         shouldApplyStyle:kit(mutableStyle->ensureCSSStyleDeclaration()) toElementsInDOMRange:kit(range)];
 }
 
+static void updateFontPanel(WebView *webView)
+{
+#if !PLATFORM(IOS)
+    NSView <WebDocumentView> *view = [[[webView selectedFrame] frameView] documentView];
+    if ([view isKindOfClass:[WebHTMLView class]])
+        [(WebHTMLView *)view _updateFontPanel];
+#else
+    UNUSED_PARAM(webView);
+#endif
+}
+
+void WebEditorClient::didApplyStyle()
+{
+    updateFontPanel(m_webView);
+}
+
 bool WebEditorClient::shouldMoveRangeAfterDelete(Range* range, Range* rangeToBeReplaced)
 {
     return [[m_webView _editingDelegateForwarder] webView:m_webView
@@ -317,10 +333,8 @@
 
 void WebEditorClient::respondToChangedContents()
 {
+    updateFontPanel(m_webView);
 #if !PLATFORM(IOS)
-    NSView <WebDocumentView> *view = [[[m_webView selectedFrame] frameView] documentView];
-    if ([view isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView *)view _updateFontPanel];
     [[NSNotificationCenter defaultCenter] postNotificationName:WebViewDidChangeNotification object:m_webView];    
 #else
     if (m_delayingContentChangeNotifications) {

Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (186085 => 186086)


--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2015-06-29 21:38:31 UTC (rev 186086)
@@ -5482,9 +5482,11 @@
 
     bool multipleFonts = false;
     NSFont *font = nil;
+    NSDictionary *attributes = nil;
     if (Frame* coreFrame = core([self _frame])) {
         if (const Font* fd = coreFrame->editor().fontForSelection(multipleFonts))
             font = fd->getNSFont();
+        attributes = coreFrame->editor().fontAttributesForSelectionStart();
     }
 
     // FIXME: for now, return a bogus font that distinguishes the empty selection from the non-empty
@@ -5493,7 +5495,9 @@
         font = [self _hasSelection] ? [NSFont menuFontOfSize:23] : [NSFont toolTipsFontOfSize:17];
     ASSERT(font != nil);
 
-    [[NSFontManager sharedFontManager] setSelectedFont:font isMultiple:multipleFonts];
+    NSFontManager *fontManager = [NSFontManager sharedFontManager];
+    [fontManager setSelectedFont:font isMultiple:multipleFonts];
+    [fontManager setSelectedAttributes:(attributes ? attributes : @{ }) isMultiple:multipleFonts];
 }
 #endif
 

Modified: trunk/Source/WebKit/win/ChangeLog (186085 => 186086)


--- trunk/Source/WebKit/win/ChangeLog	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebKit/win/ChangeLog	2015-06-29 21:38:31 UTC (rev 186086)
@@ -1,3 +1,14 @@
+2015-06-27  Ryosuke Niwa  <[email protected]>
+
+        Font panel doesn't get updated when bolding text via cmd+b in Mail on OS X
+        https://bugs.webkit.org/show_bug.cgi?id=146379
+
+        Reviewed by Darin Adler.
+
+        * WebCoreSupport/WebEditorClient.cpp:
+        (WebEditorClient::didApplyStyle): Added.
+        * WebCoreSupport/WebEditorClient.h:
+
 2015-06-26  Per Arne Vollan  <[email protected]>
 
         WinLauncher fails to download files.

Modified: trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp (186085 => 186086)


--- trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp	2015-06-29 21:38:31 UTC (rev 186086)
@@ -339,15 +339,29 @@
     return shouldChange;
 }
 
-bool WebEditorClient::shouldApplyStyle(StyleProperties* /*style*/, Range* /*toElementsInDOMRange*/)
-{ notImplemented(); return true; }
+bool WebEditorClient::shouldApplyStyle(StyleProperties*, Range*)
+{
+    notImplemented();
+    return true;
+}
 
-bool WebEditorClient::shouldMoveRangeAfterDelete(Range* /*range*/, Range* /*rangeToBeReplaced*/)
-{ notImplemented(); return true; }
+void WebEditorClient::didApplyStyle(StyleProperties*, Range*)
+{
+    notImplemented();
+}
 
-bool WebEditorClient::shouldChangeTypingStyle(StyleProperties* /*currentStyle*/, StyleProperties* /*toProposedStyle*/)
-{ notImplemented(); return false; }
+bool WebEditorClient::shouldMoveRangeAfterDelete(Range*, Range*)
+{
+    notImplemented();
+    return true;
+}
 
+bool WebEditorClient::shouldChangeTypingStyle(StyleProperties*, StyleProperties*)
+{
+    notImplemented();
+    return false;
+}
+
 void WebEditorClient::webViewDidChangeTypingStyle(WebNotification* /*notification*/)
 {
     notImplemented();

Modified: trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.h (186085 => 186086)


--- trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.h	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.h	2015-06-29 21:38:31 UTC (rev 186086)
@@ -66,6 +66,7 @@
 
     bool shouldInsertNode(WebCore::Node*, WebCore::Range* replacingRange, WebCore::EditorInsertAction);
     bool shouldApplyStyle(WebCore::StyleProperties*, WebCore::Range*);
+    void didApplyStyle(WebCore::StyleProperties*, WebCore::Range*);
     bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range*);
     bool shouldChangeTypingStyle(WebCore::StyleProperties* currentStyle, WebCore::StyleProperties* toProposedStyle);
 

Modified: trunk/Source/WebKit2/ChangeLog (186085 => 186086)


--- trunk/Source/WebKit2/ChangeLog	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebKit2/ChangeLog	2015-06-29 21:38:31 UTC (rev 186086)
@@ -1,3 +1,17 @@
+2015-06-27  Ryosuke Niwa  <[email protected]>
+
+        Font panel doesn't get updated when bolding text via cmd+b in Mail on OS X
+        https://bugs.webkit.org/show_bug.cgi?id=146379
+
+        Reviewed by Darin Adler.
+
+        Since font panel doesn't open in WebKit2 at the moment, just add an empty implementation of didApplyStyle
+
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::didApplyStyle):
+        * WebProcess/WebCoreSupport/WebEditorClient.h:
+        * WebProcess/WebPage/WebPage.h:
+
 2015-06-29  Dean Jackson  <[email protected]>
 
         Setting to enable/disable media controls sizing on page zoom

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp (186085 => 186086)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp	2015-06-29 21:38:31 UTC (rev 186086)
@@ -155,6 +155,11 @@
     return result;
 }
 
+void WebEditorClient::didApplyStyle()
+{
+    notImplemented();
+}
+
 bool WebEditorClient::shouldMoveRangeAfterDelete(Range*, Range*)
 {
     notImplemented();

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h (186085 => 186086)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h	2015-06-29 21:38:31 UTC (rev 186086)
@@ -59,6 +59,7 @@
     virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting) override;
     
     virtual bool shouldApplyStyle(WebCore::StyleProperties*, WebCore::Range*) override;
+    virtual void didApplyStyle() override;
     virtual bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range*) override;
 
     virtual void didBeginEditing() override;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (186085 => 186086)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-06-29 21:11:55 UTC (rev 186085)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-06-29 21:38:31 UTC (rev 186086)
@@ -615,6 +615,7 @@
     void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, WebCore::IntPoint& result);
 #endif
 
+    void didApplyStyle();
     void didChangeSelection();
     void discardedComposition();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to