Commit 9a9656e8 authored by rniwa@webkit.org's avatar rniwa@webkit.org

Remove the remaining uses of CSSStyleDeclaration in Editor

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
parent b1a3886a
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
......@@ -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
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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() { }
......
......@@ -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;
}
......
......@@ -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;
......
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
......
......@@ -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;
......
......@@ -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();
......
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
......@@ -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;
}
......
......@@ -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();
......
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).
......
......@@ -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;
......
......@@ -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*);
......
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.
......
......@@ -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;
......
......@@ -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*);
......
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.
......
......@@ -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;
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
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
......
......@@ -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;
}
......
......@@ -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*);