Roll out r165076.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Dec 2014 00:47:51 +0000 (00:47 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Dec 2014 00:47:51 +0000 (00:47 +0000)
<rdar://problem/18490587>

This change broke selection when editing Confluence wiki pages.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::nodeOrItsAncestorNeedsStyleRecalc):
(WebCore::ComputedStyleExtractor::propertyValue):
* dom/Document.cpp:
(WebCore::nodeOrItsAncestorNeedsStyleRecalc): Deleted.
(WebCore::Document::updateStyleIfNeededForNode): Deleted.
* dom/Document.h:
* editing/htmlediting.cpp:
(WebCore::isEditablePosition):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::forwardEvent):

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

Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/editing/htmlediting.cpp
Source/WebCore/html/TextFieldInputType.cpp

index e2df8af..7d395b2 100644 (file)
@@ -1,3 +1,22 @@
+2014-12-09  Andreas Kling  <akling@apple.com>
+
+        Roll out r165076.
+        <rdar://problem/18490587>
+
+        This change broke selection when editing Confluence wiki pages.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::nodeOrItsAncestorNeedsStyleRecalc):
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        * dom/Document.cpp:
+        (WebCore::nodeOrItsAncestorNeedsStyleRecalc): Deleted.
+        (WebCore::Document::updateStyleIfNeededForNode): Deleted.
+        * dom/Document.h:
+        * editing/htmlediting.cpp:
+        (WebCore::isEditablePosition):
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::forwardEvent):
+
 2014-12-09  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Fix iOS build after r177035.
index 1ad341a..091b23f 100644 (file)
@@ -1671,6 +1671,17 @@ PassRef<MutableStyleProperties> CSSComputedStyleDeclaration::copyProperties() co
     return ComputedStyleExtractor(m_node, m_allowVisitedStyle, m_pseudoElementSpecifier).copyProperties();
 }
 
+static inline bool nodeOrItsAncestorNeedsStyleRecalc(Node* styledNode)
+{
+    if (styledNode->document().hasPendingForcedStyleRecalc())
+        return true;
+    for (Node* n = styledNode; n; n = n->parentNode()) {// FIXME: parentOrShadowHostNode() instead
+        if (n->needsStyleRecalc())
+            return true;
+    }
+    return false;
+}
+
 static inline PassRefPtr<RenderStyle> computeRenderStyleForProperty(Node* styledNode, PseudoId pseudoElementSpecifier, CSSPropertyID propertyID)
 {
     RenderObject* renderer = styledNode->renderer();
@@ -1725,7 +1736,8 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
     if (updateLayout) {
         Document& document = styledNode->document();
 
-        if (document.updateStyleIfNeededForNode(*styledNode)) {
+        if (nodeOrItsAncestorNeedsStyleRecalc(styledNode)) {
+            document.updateStyleIfNeeded();
             // The style recalc could have caused the styled node to be discarded or replaced
             // if it was a PseudoElement so we need to update it.
             styledNode = this->styledNode();
index 1c9ff5d..29e0cd5 100644 (file)
@@ -6282,34 +6282,6 @@ bool Document::unwrapCryptoKey(const Vector<uint8_t>& wrappedKey, Vector<uint8_t
 }
 #endif // ENABLE(SUBTLE_CRYPTO)
 
-static inline bool nodeOrItsAncestorNeedsStyleRecalc(const Node& node)
-{
-    if (node.needsStyleRecalc())
-        return true;
-
-    const Node* currentNode = &node;
-    const Element* ancestor = currentNode->parentOrShadowHostElement();
-    while (ancestor) {
-        if (ancestor->needsStyleRecalc())
-            return true;
-
-        if (ancestor->directChildNeedsStyleRecalc() && currentNode->styleIsAffectedByPreviousSibling())
-            return true;
-
-        currentNode = ancestor;
-        ancestor = currentNode->parentOrShadowHostElement();
-    }
-    return false;
-}
-
-bool Document::updateStyleIfNeededForNode(const Node& node)
-{
-    if (!hasPendingForcedStyleRecalc() && !(childNeedsStyleRecalc() && nodeOrItsAncestorNeedsStyleRecalc(node)))
-        return false;
-    updateStyleIfNeeded();
-    return true;
-}
-
 Element* Document::activeElement()
 {
     if (Element* element = treeScope().focusedElement())
index 8f3b22c..94a4386 100644 (file)
@@ -593,7 +593,6 @@ public:
 
     void recalcStyle(Style::Change = Style::NoChange);
     WEBCORE_EXPORT void updateStyleIfNeeded();
-    bool updateStyleIfNeededForNode(const Node&);
 
     WEBCORE_EXPORT void updateLayout();
     
index c7eded8..2145789 100644 (file)
@@ -147,7 +147,7 @@ bool isEditablePosition(const Position& p, EditableType editableType, EUpdateSty
     if (!node)
         return false;
     if (updateStyle == UpdateStyle)
-        node->document().updateStyleIfNeededForNode(*node);
+        node->document().updateStyleIfNeeded();
     else
         ASSERT(updateStyle == DoNotUpdateStyle);
 
index 3e9ea67..1bbad62 100644 (file)
@@ -190,7 +190,7 @@ void TextFieldInputType::forwardEvent(Event* event)
         || event->type() == eventNames().blurEvent
         || event->type() == eventNames().focusEvent)
     {
-        element().document().updateStyleIfNeededForNode(element());
+        element().document().updateStyleIfNeeded();
 
         if (element().renderer()) {
             RenderTextControlSingleLine& renderTextControl = downcast<RenderTextControlSingleLine>(*element().renderer());