Node::isContentEditable should only update styles, not layout
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Feb 2012 03:35:32 +0000 (03:35 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Feb 2012 03:35:32 +0000 (03:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78637

Patch by James Robinson <jamesr@chromium.org> on 2012-02-21
Reviewed by Ryosuke Niwa.

isContentEditable depends on knowing the node's current computed style, so it has to update styles if they are
out of date.  It does not depend on knowing any layout-derived properties, however, so updating layout is just a
waste of time.

Behavior is covered by existing layout tests, primarily in editing/

* dom/Node.cpp:
(WebCore::Node::isContentEditable):
(WebCore::Node::isContentRichlyEditable):

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

Source/WebCore/ChangeLog
Source/WebCore/dom/Node.cpp
Source/WebCore/page/EventHandler.cpp

index 6c18dd2..c4229d4 100644 (file)
@@ -1,5 +1,22 @@
 2012-02-21  James Robinson  <jamesr@chromium.org>
 
+        Node::isContentEditable should only update styles, not layout
+        https://bugs.webkit.org/show_bug.cgi?id=78637
+
+        Reviewed by Ryosuke Niwa.
+
+        isContentEditable depends on knowing the node's current computed style, so it has to update styles if they are
+        out of date.  It does not depend on knowing any layout-derived properties, however, so updating layout is just a
+        waste of time.
+
+        Behavior is covered by existing layout tests, primarily in editing/
+
+        * dom/Node.cpp:
+        (WebCore::Node::isContentEditable):
+        (WebCore::Node::isContentRichlyEditable):
+
+2012-02-21  James Robinson  <jamesr@chromium.org>
+
         Partially revert r108418 - move allowEventDispatch() call back to where it used to be.
 
         Rubber-stamped by Ryosuke Niwa.
index 09b9155..91f151f 100644 (file)
@@ -695,13 +695,13 @@ const AtomicString& Node::virtualNamespaceURI() const
 
 bool Node::isContentEditable()
 {
-    document()->updateLayoutIgnorePendingStylesheets();
+    document()->updateStyleIfNeeded();
     return rendererIsEditable(Editable);
 }
 
 bool Node::isContentRichlyEditable()
 {
-    document()->updateLayoutIgnorePendingStylesheets();
+    document()->updateStyleIfNeeded();
     return rendererIsEditable(RichlyEditable);
 }
 
index 8520fc6..4f0ddee 100644 (file)
@@ -531,6 +531,8 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve
 
     cancelFakeMouseMoveEvent();
 
+    m_frame->document()->updateLayoutIgnorePendingStylesheets();
+
     if (ScrollView* scrollView = m_frame->view()) {
         if (scrollView->isPointInScrollbarCorner(event.event().position()))
             return false;