From 3b6d085c575fbb32b4d5431acc86ab54fda8ee52 Mon Sep 17 00:00:00 2001 From: "rniwa@webkit.org" Date: Thu, 30 May 2013 10:42:06 +0000 Subject: [PATCH] Get rid of Position::computedStyle https://bugs.webkit.org/show_bug.cgi?id=117024 Reviewed by Andreas Kling. Removed the function. * dom/Position.cpp: * dom/Position.h: * editing/ApplyStyleCommand.cpp: (WebCore::ApplyStyleCommand::positionToComputeInlineStyleChange): We need a position inside the dummy element since we'll get the containing element's style instead if we had the position before the dummy element. * editing/EditingStyle.cpp: (WebCore::StyleChange::StyleChange): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@150954 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 18 ++++++++++++++++++ Source/WebCore/dom/Position.cpp | 8 -------- Source/WebCore/dom/Position.h | 1 - Source/WebCore/editing/ApplyStyleCommand.cpp | 3 +-- Source/WebCore/editing/EditingStyle.cpp | 7 ++++++- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 808d458ff9f3..5ec545d48835 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,21 @@ +2013-05-30 Ryosuke Niwa + + Get rid of Position::computedStyle + https://bugs.webkit.org/show_bug.cgi?id=117024 + + Reviewed by Andreas Kling. + + Removed the function. + + * dom/Position.cpp: + * dom/Position.h: + * editing/ApplyStyleCommand.cpp: + (WebCore::ApplyStyleCommand::positionToComputeInlineStyleChange): We need a position + inside the dummy element since we'll get the containing element's style instead + if we had the position before the dummy element. + * editing/EditingStyle.cpp: + (WebCore::StyleChange::StyleChange): + 2013-05-30 Seokju Kwon Remove obsolete forward declaration from InspectorFrontendHost.h diff --git a/Source/WebCore/dom/Position.cpp b/Source/WebCore/dom/Position.cpp index 91326404a9c4..84bf042540af 100644 --- a/Source/WebCore/dom/Position.cpp +++ b/Source/WebCore/dom/Position.cpp @@ -303,14 +303,6 @@ Element* Position::element() const return toElement(n); } -PassRefPtr Position::computedStyle() const -{ - Element* elem = element(); - if (!elem) - return 0; - return CSSComputedStyleDeclaration::create(elem); -} - Position Position::previous(PositionMoveType moveType) const { Node* n = deprecatedNode(); diff --git a/Source/WebCore/dom/Position.h b/Source/WebCore/dom/Position.h index fa2aba721e6d..d8ecd985699a 100644 --- a/Source/WebCore/dom/Position.h +++ b/Source/WebCore/dom/Position.h @@ -144,7 +144,6 @@ public: bool isOrphan() const { return m_anchorNode && !m_anchorNode->inDocument(); } Element* element() const; - PassRefPtr computedStyle() const; // Move up or down the DOM by one position. // Offsets are computed using render text for nodes that have renderers - but note that even when diff --git a/Source/WebCore/editing/ApplyStyleCommand.cpp b/Source/WebCore/editing/ApplyStyleCommand.cpp index 75b7cd57f329..5cec38a7fd51 100644 --- a/Source/WebCore/editing/ApplyStyleCommand.cpp +++ b/Source/WebCore/editing/ApplyStyleCommand.cpp @@ -1409,11 +1409,10 @@ void ApplyStyleCommand::addInlineStyleIfNeeded(EditingStyle* style, PassRefPtr startNode, RefPtr& dummyElement) { // It's okay to obtain the style at the startNode because we've removed all relevant styles from the current run. - Position positionForStyleComparison; if (!startNode->isElementNode()) { dummyElement = createStyleSpanElement(document()); insertNodeAt(dummyElement, positionBeforeNode(startNode.get())); - return positionBeforeNode(dummyElement.get()); + return firstPositionInOrBeforeNode(dummyElement.get()); } return firstPositionInOrBeforeNode(startNode.get()); diff --git a/Source/WebCore/editing/EditingStyle.cpp b/Source/WebCore/editing/EditingStyle.cpp index 3ffdd812f4d6..9747446e09a5 100644 --- a/Source/WebCore/editing/EditingStyle.cpp +++ b/Source/WebCore/editing/EditingStyle.cpp @@ -1338,7 +1338,12 @@ StyleChange::StyleChange(EditingStyle* style, const Position& position) if (!style || !style->style() || !document || !document->frame()) return; - RefPtr computedStyle = position.computedStyle(); + Node* node = position.containerNode(); + if (!node) + return; + + RefPtr computedStyle = CSSComputedStyleDeclaration::create(node); + // FIXME: take care of background-color in effect RefPtr mutableStyle = getPropertiesNotIn(style->style(), computedStyle.get()); -- 2.36.0