Remove the remaining uses of CSSStyleDeclaration in Editor
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Feb 2012 09:14:53 +0000 (09:14 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Feb 2012 09:14:53 +0000 (09:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78939

Reviewed by Enrica Casucci.

Source/WebCore:

Changed the argument types of shouldApplyStyle, applyParagraphStyle, applyStyleToSelection,
applyParagraphStyleToSelection, and computeAndSetTypingStyle in Editor from CSSStyleDeclaration
to StylePropertySet.

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* editing/Editor.cpp:
(WebCore::Editor::applyStyle):
(WebCore::Editor::shouldApplyStyle):
(WebCore::Editor::applyParagraphStyle):
(WebCore::Editor::applyStyleToSelection):
(WebCore::Editor::applyParagraphStyleToSelection):
(WebCore::Editor::setBaseWritingDirection):
(WebCore::Editor::computeAndSetTypingStyle):
* editing/Editor.h:
(WebCore):
(Editor):
* editing/EditorCommand.cpp:
(WebCore::applyCommandToFrame):
(WebCore::executeApplyParagraphStyle):
(WebCore::executeMakeTextWritingDirectionLeftToRight):
(WebCore::executeMakeTextWritingDirectionNatural):
(WebCore::executeMakeTextWritingDirectionRightToLeft):
* loader/EmptyClients.h:
(WebCore::EmptyEditorClient::shouldApplyStyle):
* page/DragController.cpp:
(WebCore::DragController::concludeEditDrag):
* page/EditorClient.h:
(WebCore):
(EditorClient):

Source/WebKit/blackberry:

* WebCoreSupport/EditorClientBlackBerry.cpp:
(WebCore::EditorClientBlackBerry::shouldApplyStyle):
* WebCoreSupport/EditorClientBlackBerry.h:
(EditorClientBlackBerry):

Source/WebKit/chromium:

* src/EditorClientImpl.cpp:
(WebKit::EditorClientImpl::shouldApplyStyle):
* src/EditorClientImpl.h:
(EditorClientImpl):

Source/WebKit/efl:

* WebCoreSupport/EditorClientEfl.cpp:
(WebCore::EditorClientEfl::shouldApplyStyle):
* WebCoreSupport/EditorClientEfl.h:
(EditorClientEfl):

Source/WebKit/gtk:

* WebCoreSupport/EditorClientGtk.cpp:
(WebKit::EditorClient::shouldApplyStyle):
* WebCoreSupport/EditorClientGtk.h:
(EditorClient):

Source/WebKit/mac:

* WebCoreSupport/WebEditorClient.h:
(WebEditorClient):
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::shouldApplyStyle):
* WebView/WebFrame.mm:
(-[WebFrame _setTypingStyle:withUndoAction:]):
* WebView/WebHTMLView.mm:
(-[WebHTMLView _applyStyleToSelection:withUndoAction:]):
(-[WebHTMLView _changeCSSColorUsingSelector:inRange:]):
* WebView/WebView.mm:
(-[WebView applyStyle:]):

Source/WebKit/qt:

* WebCoreSupport/EditorClientQt.cpp:
(WebCore::EditorClientQt::shouldApplyStyle):
* WebCoreSupport/EditorClientQt.h:
(EditorClientQt):

Source/WebKit/win:

* WebCoreSupport/WebEditorClient.cpp:
(WebEditorClient::shouldApplyStyle):
* WebCoreSupport/WebEditorClient.h:
(WebEditorClient):

Source/WebKit/wince:

* WebCoreSupport/EditorClientWinCE.cpp:
(WebKit::EditorClientWinCE::shouldApplyStyle):

Source/WebKit/wx:

* WebKitSupport/EditorClientWx.cpp:
(WebCore::EditorClientWx::shouldApplyStyle):
* WebKitSupport/EditorClientWx.h:
(EditorClientWx):

Source/WebKit2:

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

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108462 268f45cc-cd09-0410-ab3c-d52691b4dbfc

40 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/Editor.h
Source/WebCore/editing/EditorCommand.cpp
Source/WebCore/loader/EmptyClients.h
Source/WebCore/page/DragController.cpp
Source/WebCore/page/EditorClient.h
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp
Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/EditorClientImpl.cpp
Source/WebKit/chromium/src/EditorClientImpl.h
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp
Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebEditorClient.h
Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
Source/WebKit/mac/WebView/WebFrame.mm
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
Source/WebKit/qt/WebCoreSupport/EditorClientQt.h
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp
Source/WebKit/win/WebCoreSupport/WebEditorClient.h
Source/WebKit/wince/ChangeLog
Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.cpp
Source/WebKit/wx/ChangeLog
Source/WebKit/wx/WebKitSupport/EditorClientWx.cpp
Source/WebKit/wx/WebKitSupport/EditorClientWx.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h

index f82c872..c119254 100644 (file)
@@ -1,3 +1,41 @@
+2012-02-22  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Remove the remaining uses of CSSStyleDeclaration in Editor
+        https://bugs.webkit.org/show_bug.cgi?id=78939
+
+        Reviewed by Enrica Casucci.
+
+        Changed the argument types of shouldApplyStyle, applyParagraphStyle, applyStyleToSelection,
+        applyParagraphStyleToSelection, and computeAndSetTypingStyle in Editor from CSSStyleDeclaration
+        to StylePropertySet.
+
+        * WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj:
+        * editing/Editor.cpp:
+        (WebCore::Editor::applyStyle):
+        (WebCore::Editor::shouldApplyStyle):
+        (WebCore::Editor::applyParagraphStyle):
+        (WebCore::Editor::applyStyleToSelection):
+        (WebCore::Editor::applyParagraphStyleToSelection):
+        (WebCore::Editor::setBaseWritingDirection):
+        (WebCore::Editor::computeAndSetTypingStyle):
+        * editing/Editor.h:
+        (WebCore):
+        (Editor):
+        * editing/EditorCommand.cpp:
+        (WebCore::applyCommandToFrame):
+        (WebCore::executeApplyParagraphStyle):
+        (WebCore::executeMakeTextWritingDirectionLeftToRight):
+        (WebCore::executeMakeTextWritingDirectionNatural):
+        (WebCore::executeMakeTextWritingDirectionRightToLeft):
+        * loader/EmptyClients.h:
+        (WebCore::EmptyEditorClient::shouldApplyStyle):
+        * page/DragController.cpp:
+        (WebCore::DragController::concludeEditDrag):
+        * page/EditorClient.h:
+        (WebCore):
+        (EditorClient):
+
 2012-02-22  Dana Jansens  <danakj@chromium.org>
 
         [chromium] Cull quads outside of the scissoring damage rect
index accc44c..0d28771 100644 (file)
@@ -842,7 +842,7 @@ __ZN7WebCore6Cursor8fromTypeENS0_4TypeE
 __ZN7WebCore6CursorC1EPNS_5ImageERKNS_8IntPointE
 __ZN7WebCore6CursorD1Ev
 __ZN7WebCore6CursoraSERKS0_
-__ZN7WebCore6Editor10applyStyleEPNS_19CSSStyleDeclarationENS_10EditActionE
+__ZN7WebCore6Editor10applyStyleEPNS_16StylePropertySetENS_10EditActionE
 __ZN7WebCore6Editor10findStringERKN3WTF6StringEj
 __ZN7WebCore6Editor10insertTextERKN3WTF6StringEPNS_5EventE
 __ZN7WebCore6Editor13canDHTMLPasteEv
@@ -859,11 +859,11 @@ __ZN7WebCore6Editor18confirmCompositionEv
 __ZN7WebCore6Editor19countMatchesForTextERKN3WTF6StringEPNS_5RangeEjjb
 __ZN7WebCore6Editor19deleteWithDirectionENS_18SelectionDirectionENS_15TextGranularityEbb
 __ZN7WebCore6Editor19insertUnorderedListEv
-__ZN7WebCore6Editor21applyStyleToSelectionEPNS_19CSSStyleDeclarationENS_10EditActionE
+__ZN7WebCore6Editor21applyStyleToSelectionEPNS_16StylePropertySetENS_10EditActionE
 __ZN7WebCore6Editor21isSelectionMisspelledEv
 __ZN7WebCore6Editor23setBaseWritingDirectionE16WritingDirection
 __ZN7WebCore6Editor24advanceToNextMisspellingEb
-__ZN7WebCore6Editor24computeAndSetTypingStyleEPNS_19CSSStyleDeclarationENS_10EditActionE
+__ZN7WebCore6Editor24computeAndSetTypingStyleEPNS_16StylePropertySetENS_10EditActionE
 __ZN7WebCore6Editor24isSelectionUngrammaticalEv
 __ZN7WebCore6Editor24replaceSelectionWithTextERKN3WTF6StringEbb
 __ZN7WebCore6Editor26decreaseSelectionListLevelEv
@@ -874,7 +874,6 @@ __ZN7WebCore6Editor27readSelectionFromPasteboardERKN3WTF6StringE
 __ZN7WebCore6Editor28replaceSelectionWithFragmentEN3WTF10PassRefPtrINS_16DocumentFragmentEEEbbb
 __ZN7WebCore6Editor29canDecreaseSelectionListLevelEv
 __ZN7WebCore6Editor29canIncreaseSelectionListLevelEv
-__ZN7WebCore6Editor30applyParagraphStyleToSelectionEPNS_19CSSStyleDeclarationENS_10EditActionE
 __ZN7WebCore6Editor30deleteSelectionWithSmartDeleteEb
 __ZN7WebCore6Editor30pasteAsPlainTextBypassingDHTMLEv
 __ZN7WebCore6Editor32guessesForUngrammaticalSelectionEv
index 65ec6c3..13bb7e7 100644 (file)
@@ -678,7 +678,7 @@ Node* Editor::findEventTargetFromSelection() const
     return findEventTargetFrom(m_frame->selection()->selection());
 }
 
-void Editor::applyStyle(CSSStyleDeclaration* style, EditAction editingAction)
+void Editor::applyStyle(StylePropertySet* style, EditAction editingAction)
 {
     switch (m_frame->selection()->selectionType()) {
     case VisibleSelection::NoSelection:
@@ -694,12 +694,12 @@ void Editor::applyStyle(CSSStyleDeclaration* style, EditAction editingAction)
     }
 }
     
-bool Editor::shouldApplyStyle(CSSStyleDeclaration* style, Range* range)
+bool Editor::shouldApplyStyle(StylePropertySet* style, Range* range)
 {   
     return client()->shouldApplyStyle(style, range);
 }
     
-void Editor::applyParagraphStyle(CSSStyleDeclaration* style, EditAction editingAction)
+void Editor::applyParagraphStyle(StylePropertySet* style, EditAction editingAction)
 {
     switch (m_frame->selection()->selectionType()) {
     case VisibleSelection::NoSelection:
@@ -713,18 +713,18 @@ void Editor::applyParagraphStyle(CSSStyleDeclaration* style, EditAction editingA
     }
 }
 
-void Editor::applyStyleToSelection(CSSStyleDeclaration* style, EditAction editingAction)
+void Editor::applyStyleToSelection(StylePropertySet* style, EditAction editingAction)
 {
-    if (!style || !style->length() || !canEditRichly())
+    if (!style || style->isEmpty() || !canEditRichly())
         return;
 
     if (client() && client()->shouldApplyStyle(style, m_frame->selection()->toNormalizedRange().get()))
         applyStyle(style, editingAction);
 }
 
-void Editor::applyParagraphStyleToSelection(CSSStyleDeclaration* style, EditAction editingAction)
+void Editor::applyParagraphStyleToSelection(StylePropertySet* style, EditAction editingAction)
 {
-    if (!style || !style->length() || !canEditRichly())
+    if (!style || style->isEmpty() || !canEditRichly())
         return;
     
     if (client() && client()->shouldApplyStyle(style, m_frame->selection()->toNormalizedRange().get()))
@@ -1262,7 +1262,7 @@ void Editor::setBaseWritingDirection(WritingDirection direction)
 
     RefPtr<StylePropertySet> style = StylePropertySet::create();
     style->setProperty(CSSPropertyDirection, direction == LeftToRightWritingDirection ? "ltr" : direction == RightToLeftWritingDirection ? "rtl" : "inherit", false);
-    applyParagraphStyleToSelection(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection);
+    applyParagraphStyleToSelection(style.get(), EditActionSetWritingDirection);
 }
 
 void Editor::selectComposition()
@@ -2579,9 +2579,9 @@ bool Editor::shouldChangeSelection(const VisibleSelection& oldSelection, const V
     return client() && client()->shouldChangeSelectedRange(oldSelection.toNormalizedRange().get(), newSelection.toNormalizedRange().get(), affinity, stillSelecting);
 }
 
-void Editor::computeAndSetTypingStyle(CSSStyleDeclaration* style, EditAction editingAction)
+void Editor::computeAndSetTypingStyle(StylePropertySet* style, EditAction editingAction)
 {
-    if (!style || !style->length()) {
+    if (!style || style->isEmpty()) {
         m_frame->selection()->clearTypingStyle();
         return;
     }
@@ -2590,7 +2590,7 @@ void Editor::computeAndSetTypingStyle(CSSStyleDeclaration* style, EditAction edi
     RefPtr<EditingStyle> typingStyle;
     if (m_frame->selection()->typingStyle()) {
         typingStyle = m_frame->selection()->typingStyle()->copy();
-        typingStyle->overrideWithStyle(style->makeMutable().get());
+        typingStyle->overrideWithStyle(style);
     } else
         typingStyle = EditingStyle::create(style);
 
index 2ba0706..e398bbf 100644 (file)
@@ -46,7 +46,6 @@ typedef int NSWritingDirection;
 
 namespace WebCore {
 
-class CSSStyleDeclaration;
 class Clipboard;
 class CompositeEditCommand;
 class DeleteButtonController;
@@ -63,6 +62,7 @@ class SimpleFontData;
 class SpellChecker;
 class SpellCheckRequest;
 class SpellingCorrectionController;
+class StylePropertySet;
 class Text;
 class TextCheckerClient;
 class TextEvent;
@@ -130,7 +130,7 @@ public:
     bool shouldInsertText(const String&, Range*, EditorInsertAction) const;
     bool shouldShowDeleteInterface(HTMLElement*) const;
     bool shouldDeleteRange(Range*) const;
-    bool shouldApplyStyle(CSSStyleDeclaration*, Range*);
+    bool shouldApplyStyle(StylePropertySet*, Range*);
     
     void respondToChangedSelection(const VisibleSelection& oldSelection);
     void respondToChangedContents(const VisibleSelection& endingSelection);
@@ -161,10 +161,10 @@ public:
     Node* removedAnchor() const { return m_removedAnchor.get(); }
     void setRemovedAnchor(PassRefPtr<Node> n) { m_removedAnchor = n; }
 
-    void applyStyle(CSSStyleDeclaration*, EditAction = EditActionUnspecified);
-    void applyParagraphStyle(CSSStyleDeclaration*, EditAction = EditActionUnspecified);
-    void applyStyleToSelection(CSSStyleDeclaration*, EditAction);
-    void applyParagraphStyleToSelection(CSSStyleDeclaration*, EditAction);
+    void applyStyle(StylePropertySet*, EditAction = EditActionUnspecified);
+    void applyParagraphStyle(StylePropertySet*, EditAction = EditActionUnspecified);
+    void applyStyleToSelection(StylePropertySet*, EditAction);
+    void applyParagraphStyleToSelection(StylePropertySet*, EditAction);
 
     void appliedEditing(PassRefPtr<CompositeEditCommand>);
     void unappliedEditing(PassRefPtr<EditCommandComposition>);
@@ -345,7 +345,7 @@ public:
     const VisibleSelection& mark() const; // Mark, to be used as emacs uses it.
     void setMark(const VisibleSelection&);
 
-    void computeAndSetTypingStyle(CSSStyleDeclaration* , EditAction = EditActionUnspecified);
+    void computeAndSetTypingStyle(StylePropertySet* , EditAction = EditActionUnspecified);
     void applyEditingStyleToBodyElement() const;
     void applyEditingStyleToElement(Element*) const;
 
index 7ab0a1a..a413742 100644 (file)
@@ -103,11 +103,11 @@ static bool applyCommandToFrame(Frame* frame, EditorCommandSource source, EditAc
     // FIXME: We don't call shouldApplyStyle when the source is DOM; is there a good reason for that?
     switch (source) {
     case CommandFromMenuOrKeyBinding:
-        frame->editor()->applyStyleToSelection(style->ensureCSSStyleDeclaration(), action);
+        frame->editor()->applyStyleToSelection(style, action);
         return true;
     case CommandFromDOM:
     case CommandFromDOMWithUserInterface:
-        frame->editor()->applyStyle(style->ensureCSSStyleDeclaration());
+        frame->editor()->applyStyle(style);
         return true;
     }
     ASSERT_NOT_REACHED();
@@ -179,11 +179,11 @@ static bool executeApplyParagraphStyle(Frame* frame, EditorCommandSource source,
     // FIXME: We don't call shouldApplyStyle when the source is DOM; is there a good reason for that?
     switch (source) {
     case CommandFromMenuOrKeyBinding:
-        frame->editor()->applyParagraphStyleToSelection(style->ensureCSSStyleDeclaration(), action);
+        frame->editor()->applyParagraphStyleToSelection(style.get(), action);
         return true;
     case CommandFromDOM:
     case CommandFromDOMWithUserInterface:
-        frame->editor()->applyParagraphStyle(style->ensureCSSStyleDeclaration());
+        frame->editor()->applyParagraphStyle(style.get());
         return true;
     }
     ASSERT_NOT_REACHED();
@@ -585,7 +585,7 @@ static bool executeMakeTextWritingDirectionLeftToRight(Frame* frame, Event*, Edi
     RefPtr<StylePropertySet> style = StylePropertySet::create();
     style->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed);
     style->setProperty(CSSPropertyDirection, CSSValueLtr);
-    frame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection);
+    frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);
     return true;
 }
 
@@ -593,7 +593,7 @@ static bool executeMakeTextWritingDirectionNatural(Frame* frame, Event*, EditorC
 {
     RefPtr<StylePropertySet> style = StylePropertySet::create();
     style->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal);
-    frame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection);
+    frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);
     return true;
 }
 
@@ -602,7 +602,7 @@ static bool executeMakeTextWritingDirectionRightToLeft(Frame* frame, Event*, Edi
     RefPtr<StylePropertySet> style = StylePropertySet::create();
     style->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed);
     style->setProperty(CSSPropertyDirection, CSSValueRtl);
-    frame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection);
+    frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection);
     return true;
 }
 
index a2641f7..2352c28 100644 (file)
@@ -461,7 +461,7 @@ public:
     virtual bool shouldInsertText(const String&, Range*, EditorInsertAction) { return false; }
     virtual bool shouldChangeSelectedRange(Range*, Range*, EAffinity, bool) { return false; }
 
-    virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*) { return false; }
+    virtual bool shouldApplyStyle(StylePropertySet*, Range*) { return false; }
     virtual bool shouldMoveRangeAfterDelete(Range*, Range*) { return false; }
 
     virtual void didBeginEditing() { }
index 7919d76..4891aad 100644 (file)
@@ -449,10 +449,10 @@ bool DragController::concludeEditDrag(DragData* dragData)
         RefPtr<Range> innerRange = innerFrame->selection()->toNormalizedRange();
         RefPtr<StylePropertySet> style = StylePropertySet::create();
         style->setProperty(CSSPropertyColor, color.serialized(), false);
-        if (!innerFrame->editor()->shouldApplyStyle(style->ensureCSSStyleDeclaration(), innerRange.get()))
+        if (!innerFrame->editor()->shouldApplyStyle(style.get(), innerRange.get()))
             return false;
         m_client->willPerformDragDestinationAction(DragDestinationActionEdit, dragData);
-        innerFrame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetColor);
+        innerFrame->editor()->applyStyle(style.get(), EditActionSetColor);
         return true;
     }
 
index 4d33e9f..2bb4f51 100644 (file)
@@ -45,7 +45,6 @@ OBJC_CLASS NSURL;
 namespace WebCore {
 
 class ArchiveResource;
-class CSSStyleDeclaration;
 class DocumentFragment;
 class Editor;
 class Element;
@@ -55,6 +54,7 @@ class KeyboardEvent;
 class Node;
 class Range;
 class SpellChecker;
+class StylePropertySet;
 class TextCheckerClient;
 class VisibleSelection;
 class VisiblePosition;
@@ -82,7 +82,7 @@ public:
     virtual bool shouldInsertText(const String&, Range*, EditorInsertAction) = 0;
     virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting) = 0;
     
-    virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*) = 0;
+    virtual bool shouldApplyStyle(StylePropertySet*, Range*) = 0;
     virtual bool shouldMoveRangeAfterDelete(Range*, Range*) = 0;
 
     virtual void didBeginEditing() = 0;
index 9d6b63f..f45c203 100644 (file)
@@ -1,3 +1,15 @@
+2012-02-22  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Remove the remaining uses of CSSStyleDeclaration in Editor
+        https://bugs.webkit.org/show_bug.cgi?id=78939
+
+        Reviewed by Enrica Casucci.
+
+        * WebCoreSupport/EditorClientBlackBerry.cpp:
+        (WebCore::EditorClientBlackBerry::shouldApplyStyle):
+        * WebCoreSupport/EditorClientBlackBerry.h:
+        (EditorClientBlackBerry):
+
 2012-02-18  Antonio Gomes  <agomes@rim.com>
 
         Fat fingers - cache the first rect-based hit test so we do not need to do it again
index 7c0404b..d3c37ee 100644 (file)
@@ -203,7 +203,7 @@ bool EditorClientBlackBerry::shouldChangeSelectedRange(Range* fromRange, Range*
     return true;
 }
 
-bool EditorClientBlackBerry::shouldApplyStyle(CSSStyleDeclaration*, Range*)
+bool EditorClientBlackBerry::shouldApplyStyle(StylePropertySet*, Range*)
 {
     notImplemented();
     return true;
index 9466d0c..bffa881 100644 (file)
@@ -51,7 +51,7 @@ public:
     virtual bool shouldInsertNode(Node*, Range*, EditorInsertAction);
     virtual bool shouldInsertText(const String&, Range*, EditorInsertAction);
     virtual bool shouldChangeSelectedRange(Range*, Range*, EAffinity, bool);
-    virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*);
+    virtual bool shouldApplyStyle(StylePropertySet*, Range*);
     virtual bool shouldMoveRangeAfterDelete(Range*, Range*);
     virtual void didBeginEditing();
     virtual void respondToChangedContents();
index c248d8c..4082666 100644 (file)
@@ -1,3 +1,15 @@
+2012-02-22  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Remove the remaining uses of CSSStyleDeclaration in Editor
+        https://bugs.webkit.org/show_bug.cgi?id=78939
+
+        Reviewed by Enrica Casucci.
+
+        * src/EditorClientImpl.cpp:
+        (WebKit::EditorClientImpl::shouldApplyStyle):
+        * src/EditorClientImpl.h:
+        (EditorClientImpl):
+
 2012-02-22  Dana Jansens  <danakj@chromium.org>
 
         [chromium] Cull quads outside of the scissoring damage rect
index 04aa719..033d46d 100644 (file)
@@ -238,13 +238,11 @@ bool EditorClientImpl::shouldChangeSelectedRange(Range* fromRange,
     return true;
 }
 
-bool EditorClientImpl::shouldApplyStyle(CSSStyleDeclaration* style,
-                                        Range* range)
+bool EditorClientImpl::shouldApplyStyle(StylePropertySet* style, Range* range)
 {
     if (m_webView->client()) {
         // FIXME: Pass a reference to the CSSStyleDeclaration somehow.
-        return m_webView->client()->shouldApplyStyle(WebString(),
-                                                     WebRange(range));
+        return m_webView->client()->shouldApplyStyle(WebString(), WebRange(range));
     }
     return true;
 }
index 2b57710..999860a 100644 (file)
@@ -67,7 +67,7 @@ public:
     virtual bool shouldDeleteRange(WebCore::Range*);
     virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange,
         WebCore::EAffinity, bool stillSelecting);
-    virtual bool shouldApplyStyle(WebCore::CSSStyleDeclaration*, WebCore::Range*);
+    virtual bool shouldApplyStyle(WebCore::StylePropertySet*, WebCore::Range*);
     virtual bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range*);
     virtual void didBeginEditing();
     virtual void respondToChangedContents();
index 861c2cf..f32e2fa 100644 (file)
@@ -1,3 +1,15 @@
+2012-02-22  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Remove the remaining uses of CSSStyleDeclaration in Editor
+        https://bugs.webkit.org/show_bug.cgi?id=78939
+
+        Reviewed by Enrica Casucci.
+
+        * WebCoreSupport/EditorClientEfl.cpp:
+        (WebCore::EditorClientEfl::shouldApplyStyle):
+        * WebCoreSupport/EditorClientEfl.h:
+        (EditorClientEfl):
+
 2012-02-20  Kihong Kwon  <kihong.kwon@samsung.com>
 
         Add a new API for the Vibration API(W3C).
index 78563ec..8224155 100644 (file)
@@ -103,7 +103,7 @@ bool EditorClientEfl::shouldChangeSelectedRange(Range*, Range*, EAffinity, bool)
     return true;
 }
 
-bool EditorClientEfl::shouldApplyStyle(CSSStyleDeclaration*, Range*)
+bool EditorClientEfl::shouldApplyStyle(StylePropertySet*, Range*)
 {
     notImplemented();
     return true;
index 7ff1813..42189e1 100644 (file)
@@ -73,7 +73,7 @@ public:
     virtual bool shouldInsertText(const String&, Range*, EditorInsertAction);
     virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting);
 
-    virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*);
+    virtual bool shouldApplyStyle(StylePropertySet*, Range*);
 
     virtual bool shouldMoveRangeAfterDelete(Range*, Range*);
 
index 3e2a2ea..6ae98e6 100644 (file)
@@ -1,3 +1,15 @@
+2012-02-22  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Remove the remaining uses of CSSStyleDeclaration in Editor
+        https://bugs.webkit.org/show_bug.cgi?id=78939
+
+        Reviewed by Enrica Casucci.
+
+        * WebCoreSupport/EditorClientGtk.cpp:
+        (WebKit::EditorClient::shouldApplyStyle):
+        * WebCoreSupport/EditorClientGtk.h:
+        (EditorClient):
+
 2012-02-22  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed, rolling out r107351.
index 913b0df..b8e160e 100644 (file)
@@ -235,10 +235,10 @@ bool EditorClient::shouldChangeSelectedRange(Range* fromRange, Range* toRange, E
     return accept;
 }
 
-bool EditorClient::shouldApplyStyle(WebCore::CSSStyleDeclaration* declaration, WebCore::Range* range)
+bool EditorClient::shouldApplyStyle(WebCore::StylePropertySet* set, WebCore::Range* range)
 {
     gboolean accept = TRUE;
-    GRefPtr<WebKitDOMCSSStyleDeclaration> kitDeclaration(kit(declaration));
+    GRefPtr<WebKitDOMCSSStyleDeclaration> kitDeclaration(kit(set->ensureCSSStyleDeclaration()));
     GRefPtr<WebKitDOMRange> kitRange(adoptGRef(kit(range)));
     g_signal_emit_by_name(m_webView, "should-apply-style", kitDeclaration.get(), kitRange.get(), &accept);
     return accept;
index 2533c16..ef159c6 100644 (file)
@@ -94,7 +94,7 @@ class EditorClient : public WebCore::EditorClient {
         virtual bool shouldInsertText(const WTF::String&, WebCore::Range*, WebCore::EditorInsertAction);
         virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting);
 
-        virtual bool shouldApplyStyle(WebCore::CSSStyleDeclaration*, WebCore::Range*);
+        virtual bool shouldApplyStyle(WebCore::StylePropertySet*, WebCore::Range*);
 
         virtual bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range*);
 
index 0e43b9f..4b186da 100644 (file)
@@ -1,3 +1,22 @@
+2012-02-22  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Remove the remaining uses of CSSStyleDeclaration in Editor
+        https://bugs.webkit.org/show_bug.cgi?id=78939
+
+        Reviewed by Enrica Casucci.
+
+        * WebCoreSupport/WebEditorClient.h:
+        (WebEditorClient):
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::shouldApplyStyle):
+        * WebView/WebFrame.mm:
+        (-[WebFrame _setTypingStyle:withUndoAction:]):
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _applyStyleToSelection:withUndoAction:]):
+        (-[WebHTMLView _changeCSSColorUsingSelector:inRange:]):
+        * WebView/WebView.mm:
+        (-[WebView applyStyle:]):
+
 2012-02-22  Jon Lee  <jonlee@apple.com>
 
         Part of r108409 was incorrect, and incorporated an older version of a sub-patch.
index c70d608..5a9b917 100644 (file)
@@ -61,7 +61,7 @@ public:
     virtual bool shouldInsertText(const WTF::String&, WebCore::Range*, WebCore::EditorInsertAction) OVERRIDE;
     virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting) OVERRIDE;
 
-    virtual bool shouldApplyStyle(WebCore::CSSStyleDeclaration*, WebCore::Range*) OVERRIDE;
+    virtual bool shouldApplyStyle(WebCore::StylePropertySet*, WebCore::Range*) OVERRIDE;
     
     virtual bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range* rangeToBeReplaced) OVERRIDE;
 
index fabdf6c..f1c5510 100644 (file)
@@ -241,10 +241,10 @@ bool WebEditorClient::isSelectTrailingWhitespaceEnabled()
     return [m_webView isSelectTrailingWhitespaceEnabled];
 }
 
-bool WebEditorClient::shouldApplyStyle(CSSStyleDeclaration* style, Range* range)
+bool WebEditorClient::shouldApplyStyle(StylePropertySet* style, Range* range)
 {
     return [[m_webView _editingDelegateForwarder] webView:m_webView
-        shouldApplyStyle:kit(style) toElementsInDOMRange:kit(range)];
+        shouldApplyStyle:kit(style->ensureCSSStyleDeclaration()) toElementsInDOMRange:kit(range)];
 }
 
 bool WebEditorClient::shouldMoveRangeAfterDelete(Range* range, Range* rangeToBeReplaced)
index af7f3cc..24bb8f3 100644 (file)
@@ -799,7 +799,8 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
 {
     if (!_private->coreFrame)
         return;
-    _private->coreFrame->editor()->computeAndSetTypingStyle(core(style), undoAction);
+    // FIXME: We shouldn't have to create a copy here.
+    _private->coreFrame->editor()->computeAndSetTypingStyle(core(style)->copy().get(), undoAction);
 }
 
 - (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation
index 66f7b3a..7052fca 100644 (file)
@@ -4352,14 +4352,10 @@ static PassRefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame)
 
 - (void)_applyStyleToSelection:(DOMCSSStyleDeclaration *)style withUndoAction:(EditAction)undoAction
 {
-    if (Frame* coreFrame = core([self _frame]))
-        coreFrame->editor()->applyStyleToSelection(core(style), undoAction);
-}
-
-- (void)_applyParagraphStyleToSelection:(DOMCSSStyleDeclaration *)style withUndoAction:(EditAction)undoAction
-{
-    if (Frame* coreFrame = core([self _frame]))
-        coreFrame->editor()->applyParagraphStyleToSelection(core(style), undoAction);
+    if (Frame* coreFrame = core([self _frame])) {
+        // FIXME: We shouldn't have to make a copy here. We want callers of this function to work directly with StylePropertySet eventually.
+        coreFrame->editor()->applyStyleToSelection(core(style)->copy().get(), undoAction);
+    }
 }
 
 - (BOOL)_handleStyleKeyEquivalent:(NSEvent *)event
@@ -4657,9 +4653,13 @@ static PassRefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame)
 {
     DOMCSSStyleDeclaration *style = [self _styleFromColorPanelWithSelector:selector];
     WebView *webView = [self _webView];
-    if ([[webView _editingDelegateForwarder] webView:webView shouldApplyStyle:style toElementsInDOMRange:range])
-        if (Frame* coreFrame = core([self _frame]))
-            coreFrame->editor()->applyStyle(core(style), [self _undoActionFromColorPanelWithSelector:selector]);
+    if ([[webView _editingDelegateForwarder] webView:webView shouldApplyStyle:style toElementsInDOMRange:range]) {
+        if (Frame* coreFrame = core([self _frame])) {
+            // FIXME: We shouldn't have to make a copy here.
+            coreFrame->editor()->applyStyle(core(style)->copy().get(), [self _undoActionFromColorPanelWithSelector:selector]);
+        }
+    }
+
 }
 
 - (void)changeDocumentBackgroundColor:(id)sender
index d9c4fdc..1611a6d 100644 (file)
@@ -5526,8 +5526,9 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu
     // change the API to allow this.
     WebFrame *webFrame = [self _selectedOrMainFrame];
     Frame* coreFrame = core(webFrame);
+    // FIXME: We shouldn't have to make a copy here.
     if (coreFrame)
-        coreFrame->editor()->applyStyle(core(style));
+        coreFrame->editor()->applyStyle(core(style)->copy().get());
 }
 
 @end
index 8dc7a61..132e975 100644 (file)
@@ -1,3 +1,15 @@
+2012-02-22  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Remove the remaining uses of CSSStyleDeclaration in Editor
+        https://bugs.webkit.org/show_bug.cgi?id=78939
+
+        Reviewed by Enrica Casucci.
+
+        * WebCoreSupport/EditorClientQt.cpp:
+        (WebCore::EditorClientQt::shouldApplyStyle):
+        * WebCoreSupport/EditorClientQt.h:
+        (EditorClientQt):
+
 2012-02-21  Csaba Osztrogonác  <ossy@webkit.org>
 
         [Qt] tst_QWebPage::infiniteLoopJS() timeouts with DFG JIT
index 1d80803..166e006 100644 (file)
@@ -31,7 +31,6 @@
 #include "config.h"
 #include "EditorClientQt.h"
 
-#include "CSSStyleDeclaration.h"
 #include "Document.h"
 #include "UndoStepQt.h"
 #include "Editor.h"
@@ -48,6 +47,7 @@
 #include "Range.h"
 #include "Settings.h"
 #include "SpatialNavigation.h"
+#include "StylePropertySet.h"
 #include "WindowsKeyboardCodes.h"
 #include "qwebpage.h"
 #include "qwebpage_p.h"
@@ -170,12 +170,12 @@ bool EditorClientQt::shouldChangeSelectedRange(Range* currentRange, Range* propo
     return acceptsEditing;
 }
 
-bool EditorClientQt::shouldApplyStyle(WebCore::CSSStyleDeclaration* style,
+bool EditorClientQt::shouldApplyStyle(WebCore::StylePropertySet* style,
                                       WebCore::Range* range)
 {
     if (dumpEditingCallbacks)
         printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n",
-               QString(style->cssText()).toUtf8().constData(), dumpRange(range).toUtf8().constData());
+               QString(style->asText()).toUtf8().constData(), dumpRange(range).toUtf8().constData());
     return acceptsEditing;
 }
 
index c20f975..2830989 100644 (file)
@@ -63,7 +63,7 @@ public:
     virtual bool shouldInsertText(const String&, Range*, EditorInsertAction);
     virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting);
 
-    virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*);
+    virtual bool shouldApplyStyle(StylePropertySet*, Range*);
 
     virtual bool shouldMoveRangeAfterDelete(Range*, Range*);
 
index 04194ff..3e82ded 100644 (file)
@@ -1,3 +1,15 @@
+2012-02-22  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Remove the remaining uses of CSSStyleDeclaration in Editor
+        https://bugs.webkit.org/show_bug.cgi?id=78939
+
+        Reviewed by Enrica Casucci.
+
+        * WebCoreSupport/WebEditorClient.cpp:
+        (WebEditorClient::shouldApplyStyle):
+        * WebCoreSupport/WebEditorClient.h:
+        (WebEditorClient):
+
 2012-02-17  Kalev Lember  <kalevlember@gmail.com>
 
         Remove unused parameters from WTF threading API
index 0b26530..6a4ee84 100644 (file)
@@ -276,13 +276,13 @@ bool WebEditorClient::shouldInsertText(const String& /*str*/, Range* /* replacin
 //bool WebEditorClient::shouldChangeSelectedRange(Range *currentRange, Range *toProposedRange, SelectionAffinity selectionAffinity, bool stillSelecting)
 //{ notImplemented(); return false; }
 
-bool WebEditorClient::shouldApplyStyle(CSSStyleDeclaration* /*style*/, Range* /*toElementsInDOMRange*/)
+bool WebEditorClient::shouldApplyStyle(StylePropertySet* /*style*/, Range* /*toElementsInDOMRange*/)
 { notImplemented(); return true; }
 
 bool WebEditorClient::shouldMoveRangeAfterDelete(Range* /*range*/, Range* /*rangeToBeReplaced*/)
 { notImplemented(); return true; }
 
-bool WebEditorClient::shouldChangeTypingStyle(CSSStyleDeclaration* /*currentStyle*/, CSSStyleDeclaration* /*toProposedStyle*/)
+bool WebEditorClient::shouldChangeTypingStyle(StylePropertySet* /*currentStyle*/, StylePropertySet* /*toProposedStyle*/)
 { notImplemented(); return false; }
 
 void WebEditorClient::webViewDidChangeTypingStyle(WebNotification* /*notification*/)
index a40586c..28a9105 100644 (file)
@@ -64,9 +64,9 @@ public:
     bool shouldDeleteRange(WebCore::Range*);
 
     bool shouldInsertNode(WebCore::Node*, WebCore::Range* replacingRange, WebCore::EditorInsertAction);
-    bool shouldApplyStyle(WebCore::CSSStyleDeclaration*, WebCore::Range*);
+    bool shouldApplyStyle(WebCore::StylePropertySet*, WebCore::Range*);
     bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range*);
-    bool shouldChangeTypingStyle(WebCore::CSSStyleDeclaration* currentStyle, WebCore::CSSStyleDeclaration* toProposedStyle);
+    bool shouldChangeTypingStyle(WebCore::StylePropertySet* currentStyle, WebCore::StylePropertySet* toProposedStyle);
 
     void webViewDidChangeTypingStyle(WebNotification*);
     void webViewDidChangeSelection(WebNotification*);
index c2b0a2d..aa92d88 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-22  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Remove the remaining uses of CSSStyleDeclaration in Editor
+        https://bugs.webkit.org/show_bug.cgi?id=78939
+
+        Reviewed by Enrica Casucci.
+
+        * WebCoreSupport/EditorClientWinCE.cpp:
+        (WebKit::EditorClientWinCE::shouldApplyStyle):
+
 2012-02-20  Benjamin Poulain  <benjamin@webkit.org>
 
         Get rid of the LocalizationStrategy
index 4cd3aac..10c2373 100644 (file)
@@ -102,7 +102,7 @@ bool EditorClientWinCE::shouldChangeSelectedRange(Range*, Range*, EAffinity, boo
     return true;
 }
 
-bool EditorClientWinCE::shouldApplyStyle(WebCore::CSSStyleDeclaration*, WebCore::Range*)
+bool EditorClientWinCE::shouldApplyStyle(WebCore::StylePropertySet*, WebCore::Range*)
 {
     notImplemented();
     return true;
index 05be84b..095940c 100644 (file)
@@ -1,3 +1,15 @@
+2012-02-22  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Remove the remaining uses of CSSStyleDeclaration in Editor
+        https://bugs.webkit.org/show_bug.cgi?id=78939
+
+        Reviewed by Enrica Casucci.
+
+        * WebKitSupport/EditorClientWx.cpp:
+        (WebCore::EditorClientWx::shouldApplyStyle):
+        * WebKitSupport/EditorClientWx.h:
+        (EditorClientWx):
+
 2012-02-15  Sadrul Habib Chowdhury  <sadrul@chromium.org>
 
         Notify ChromeClient when touch-event handlers are installed/removed.
index 81d54f8..f2f9ca7 100644 (file)
@@ -223,7 +223,7 @@ bool EditorClientWx::shouldInsertText(const String&, Range*,
     return true;
 }
 
-bool EditorClientWx::shouldApplyStyle(CSSStyleDeclaration*,
+bool EditorClientWx::shouldApplyStyle(StylePropertySet*,
                                        Range*)
 {
     notImplemented();
index d1403d1..d0bfd2a 100644 (file)
@@ -64,7 +64,7 @@ public:
                                   EditorInsertAction);
     virtual bool shouldInsertText(const String&, Range*,
                                   EditorInsertAction);
-    virtual bool shouldApplyStyle(CSSStyleDeclaration*,
+    virtual bool shouldApplyStyle(StylePropertySet*,
                                   Range*);
     virtual bool shouldMoveRangeAfterDelete(Range*, Range*);
     virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, 
index 75d317e..95a7634 100644 (file)
@@ -1,3 +1,15 @@
+2012-02-22  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Remove the remaining uses of CSSStyleDeclaration in Editor
+        https://bugs.webkit.org/show_bug.cgi?id=78939
+
+        Reviewed by Enrica Casucci.
+
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::shouldApplyStyle):
+        * WebProcess/WebCoreSupport/WebEditorClient.h:
+        (WebEditorClient):
+
 2012-02-21  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Null ResourceErrors are encoded/decoded as empty ResourceErrors
index f22b260..19ef7dc 100644 (file)
@@ -148,9 +148,9 @@ bool WebEditorClient::shouldChangeSelectedRange(Range* fromRange, Range* toRange
     return result;
 }
     
-bool WebEditorClient::shouldApplyStyle(CSSStyleDeclaration* style, Range* range)
+bool WebEditorClient::shouldApplyStyle(StylePropertySet* style, Range* range)
 {
-    bool result = m_page->injectedBundleEditorClient().shouldApplyStyle(m_page, style, range);
+    bool result = m_page->injectedBundleEditorClient().shouldApplyStyle(m_page, style->ensureCSSStyleDeclaration(), range);
     notImplemented();
     return result;
 }
index 8f26220..260020f 100644 (file)
@@ -59,7 +59,7 @@ private:
     virtual bool shouldInsertText(const String&, WebCore::Range*, WebCore::EditorInsertAction) OVERRIDE;
     virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting) OVERRIDE;
     
-    virtual bool shouldApplyStyle(WebCore::CSSStyleDeclaration*, WebCore::Range*) OVERRIDE;
+    virtual bool shouldApplyStyle(WebCore::StylePropertySet*, WebCore::Range*) OVERRIDE;
     virtual bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range*) OVERRIDE;
 
     virtual void didBeginEditing() OVERRIDE;