Title: [183969] trunk/Source/WebKit2
Revision
183969
Author
[email protected]
Date
2015-05-07 18:23:49 -0700 (Thu, 07 May 2015)

Log Message

ASSERTION when pasting text into the WebInspector console
https://bugs.webkit.org/show_bug.cgi?id=144774

Reviewed by Ryosuke Niwa.

Fix assertion in didChangeSelection() meant to check that calling
editorState() does not cause a synchronous layout. The assertion
was not correct as it was relying on FrameView::needsLayout() and
we would hit it if calling editorState() would schedule a layout.
Instead, the new assertion relies on FrameView::layoutCount(),
which is more accurate.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didChangeSelection):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (183968 => 183969)


--- trunk/Source/WebKit2/ChangeLog	2015-05-08 01:08:54 UTC (rev 183968)
+++ trunk/Source/WebKit2/ChangeLog	2015-05-08 01:23:49 UTC (rev 183969)
@@ -1,3 +1,20 @@
+2015-05-07  Chris Dumez  <[email protected]>
+
+        ASSERTION when pasting text into the WebInspector console
+        https://bugs.webkit.org/show_bug.cgi?id=144774
+
+        Reviewed by Ryosuke Niwa.
+
+        Fix assertion in didChangeSelection() meant to check that calling
+        editorState() does not cause a synchronous layout. The assertion
+        was not correct as it was relying on FrameView::needsLayout() and
+        we would hit it if calling editorState() would schedule a layout.
+        Instead, the new assertion relies on FrameView::layoutCount(),
+        which is more accurate.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didChangeSelection):
+
 2015-05-07  Andreas Kling  <[email protected]>
 
         Optimize serialization of quoted JSON strings.

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (183968 => 183969)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-05-08 01:08:54 UTC (rev 183968)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-05-08 01:23:49 UTC (rev 183969)
@@ -4418,14 +4418,17 @@
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     FrameView* view = frame.view();
-    bool needsLayout = view && view->needsLayout();
+#if PLATFORM(COCOA) && !defined(NDEBUG)
+    int layoutCount = view ? view->layoutCount() : 0;
+#endif
 
     // If there is a layout pending, we should avoid populating EditorState that require layout to be done or it will
     // trigger a synchronous layout every time the selection changes. sendPostLayoutEditorStateIfNeeded() will be called
     // to send the full editor state after layout is done if we send a partial editor state here.
-    auto editorState = this->editorState(needsLayout ? IncludePostLayoutDataHint::No : IncludePostLayoutDataHint::Yes);
-#if PLATFORM(COCOA)
-    ASSERT_WITH_MESSAGE(needsLayout == (view && view->needsLayout()), "Calling editorState() should not cause a synchronous layout.");
+    auto editorState = this->editorState(view && view->needsLayout() ? IncludePostLayoutDataHint::No : IncludePostLayoutDataHint::Yes);
+#if PLATFORM(COCOA) && !defined(NDEBUG)
+    if (view)
+        ASSERT_WITH_MESSAGE(layoutCount == view->layoutCount(), "Calling editorState() should not cause a synchronous layout.");
 #endif
     m_isEditorStateMissingPostLayoutData = editorState.isMissingPostLayoutData;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to