Title: [150954] trunk/Source/WebCore
Revision
150954
Author
[email protected]
Date
2013-05-30 03:42:06 -0700 (Thu, 30 May 2013)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (150953 => 150954)


--- trunk/Source/WebCore/ChangeLog	2013-05-30 08:14:28 UTC (rev 150953)
+++ trunk/Source/WebCore/ChangeLog	2013-05-30 10:42:06 UTC (rev 150954)
@@ -1,3 +1,21 @@
+2013-05-30  Ryosuke Niwa  <[email protected]>
+
+        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  <[email protected]>
 
         Remove obsolete forward declaration from InspectorFrontendHost.h

Modified: trunk/Source/WebCore/dom/Position.cpp (150953 => 150954)


--- trunk/Source/WebCore/dom/Position.cpp	2013-05-30 08:14:28 UTC (rev 150953)
+++ trunk/Source/WebCore/dom/Position.cpp	2013-05-30 10:42:06 UTC (rev 150954)
@@ -303,14 +303,6 @@
     return toElement(n);
 }
 
-PassRefPtr<CSSComputedStyleDeclaration> Position::computedStyle() const
-{
-    Element* elem = element();
-    if (!elem)
-        return 0;
-    return CSSComputedStyleDeclaration::create(elem);
-}
-
 Position Position::previous(PositionMoveType moveType) const
 {
     Node* n = deprecatedNode();

Modified: trunk/Source/WebCore/dom/Position.h (150953 => 150954)


--- trunk/Source/WebCore/dom/Position.h	2013-05-30 08:14:28 UTC (rev 150953)
+++ trunk/Source/WebCore/dom/Position.h	2013-05-30 10:42:06 UTC (rev 150954)
@@ -144,7 +144,6 @@
     bool isOrphan() const { return m_anchorNode && !m_anchorNode->inDocument(); }
 
     Element* element() const;
-    PassRefPtr<CSSComputedStyleDeclaration> 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

Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.cpp (150953 => 150954)


--- trunk/Source/WebCore/editing/ApplyStyleCommand.cpp	2013-05-30 08:14:28 UTC (rev 150953)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.cpp	2013-05-30 10:42:06 UTC (rev 150954)
@@ -1409,11 +1409,10 @@
 Position ApplyStyleCommand::positionToComputeInlineStyleChange(PassRefPtr<Node> startNode, RefPtr<Node>& 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());

Modified: trunk/Source/WebCore/editing/EditingStyle.cpp (150953 => 150954)


--- trunk/Source/WebCore/editing/EditingStyle.cpp	2013-05-30 08:14:28 UTC (rev 150953)
+++ trunk/Source/WebCore/editing/EditingStyle.cpp	2013-05-30 10:42:06 UTC (rev 150954)
@@ -1338,7 +1338,12 @@
     if (!style || !style->style() || !document || !document->frame())
         return;
 
-    RefPtr<CSSComputedStyleDeclaration> computedStyle = position.computedStyle();
+    Node* node = position.containerNode();
+    if (!node)
+        return;
+
+    RefPtr<CSSComputedStyleDeclaration> computedStyle = CSSComputedStyleDeclaration::create(node);
+
     // FIXME: take care of background-color in effect
     RefPtr<MutableStylePropertySet> mutableStyle = getPropertiesNotIn(style->style(), computedStyle.get());
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to