Assertion hit in WebPage::didChangeSelection()
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 May 2015 21:51:22 +0000 (21:51 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 May 2015 21:51:22 +0000 (21:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145413
<rdar://problem/21001129>

Reviewed by Ryosuke Niwa.

We sometimes hit the "ASSERT(layoutCount == view->layoutCount())"
assertion in WebPage::didChangeSelection(). We manage to prevent
synchronous layouts in most cases when calling editorState(). However,
it seems it can still happen in some cases. Crashing in this case seems
overkill and can be annoying to other developers, especially
considering the implications are only on performance.

This patch drops the assertion.

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

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

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 84306d2..240a025 100644 (file)
@@ -1,3 +1,23 @@
+2015-05-27  Chris Dumez  <cdumez@apple.com>
+
+        Assertion hit in WebPage::didChangeSelection()
+        https://bugs.webkit.org/show_bug.cgi?id=145413
+        <rdar://problem/21001129>
+
+        Reviewed by Ryosuke Niwa.
+
+        We sometimes hit the "ASSERT(layoutCount == view->layoutCount())"
+        assertion in WebPage::didChangeSelection(). We manage to prevent
+        synchronous layouts in most cases when calling editorState(). However,
+        it seems it can still happen in some cases. Crashing in this case seems
+        overkill and can be annoying to other developers, especially
+        considering the implications are only on performance.
+
+        This patch drops the assertion.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didChangeSelection): Deleted.
+
 2015-05-27  Anders Carlsson  <andersca@apple.com>
 
         Address a follow-up review comment from Darin.
index 89459bd..eb501ac 100644 (file)
@@ -4430,18 +4430,11 @@ void WebPage::didChangeSelection()
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     FrameView* view = frame.view();
-#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(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;
 
 #if PLATFORM(MAC) && USE(ASYNC_NSTEXTINPUTCLIENT)