Removing an HTML element spends a lot of time in adjustDirectionalityIfNeededAfterChi...
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Jan 2015 03:45:01 +0000 (03:45 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Jan 2015 03:45:01 +0000 (03:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140523
<rdar://problem/19464329>

Reviewed by Chris Dumez.

The bug was caused by adjustDirectionalityIfNeededAfterChildrenChanged always traversing children to
unset selfOrAncestorHasDirAutoAttribute flag while removing a child element.

Fixed the bug by removing this code. This code was no-op prior to being refactored in r154957 since
we only entered a for loop with the invariant "counter < childCountDelta" when "childCountDelta < 0".

See http://trac.webkit.org/changeset/154957/trunk/Source/WebCore/html/HTMLElement.cpp.

* html/HTMLElement.cpp:
(WebCore::HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged):

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

Source/WebCore/ChangeLog
Source/WebCore/html/HTMLElement.cpp

index e10f3814af790dea0d4f8c6c12ba0a62f34ff7b3..e3c7a8cce3485baa2b3ed23309bfc8ef6190d569 100644 (file)
@@ -1,3 +1,22 @@
+2015-01-15  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Removing an HTML element spends a lot of time in adjustDirectionalityIfNeededAfterChildrenChanged
+        https://bugs.webkit.org/show_bug.cgi?id=140523
+        <rdar://problem/19464329>
+
+        Reviewed by Chris Dumez.
+
+        The bug was caused by adjustDirectionalityIfNeededAfterChildrenChanged always traversing children to
+        unset selfOrAncestorHasDirAutoAttribute flag while removing a child element.
+
+        Fixed the bug by removing this code. This code was no-op prior to being refactored in r154957 since
+        we only entered a for loop with the invariant "counter < childCountDelta" when "childCountDelta < 0".
+
+        See http://trac.webkit.org/changeset/154957/trunk/Source/WebCore/html/HTMLElement.cpp.
+
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged):
+
 2015-01-15  Brent Fulgham  <bfulgham@apple.com>
 
         RenderLayerCompositor: Strange comparison of opacity (float) to boolean.
 2015-01-15  Brent Fulgham  <bfulgham@apple.com>
 
         RenderLayerCompositor: Strange comparison of opacity (float) to boolean.
index b67d5554eb58c6bb1b938bae3d3f57f368427ec6..4d4820de0ff82ca29a5b9927a4134a295e6e2aa2 100644 (file)
@@ -944,15 +944,6 @@ void HTMLElement::calculateAndAdjustDirectionality()
 void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(Element* beforeChange, ChildChangeType changeType)
 {
     // FIXME: This function looks suspicious.
 void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(Element* beforeChange, ChildChangeType changeType)
 {
     // FIXME: This function looks suspicious.
-    if (document().renderView() && (changeType == ElementRemoved || changeType == TextRemoved)) {
-        Node* node = beforeChange ? beforeChange->nextSibling() : nullptr;
-        for (; node; node = node->nextSibling()) {
-            if (elementAffectsDirectionality(*node))
-                continue;
-
-            setHasDirAutoFlagRecursively(node, false);
-        }
-    }
 
     if (!selfOrAncestorHasDirAutoAttribute())
         return;
 
     if (!selfOrAncestorHasDirAutoAttribute())
         return;