[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

darin at apple.com darin at apple.com
Thu Apr 8 00:46:17 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit ea483ee51a4e7691f18ecf30a6b41c0baece1b00
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 22 19:26:29 2009 +0000

    Reentrancy problem with selection in some edge cases.
    https://bugs.webkit.org/show_bug.cgi?id=32842
    rdar://problem/7449974
    
    Reviewed by Sam Weinig.
    
    WebCore:
    
    Test: fast/forms/selection-layout-reentry-strange-case.html
    
    Move the selection display update process done in the
    selectionLayoutChanged function into the layout timer
    instead of doing it immediately when selection changes occur.
    
    * editing/SelectionController.cpp:
    (WebCore::SelectionController::SelectionController):
    Initialize m_needsDisplayUpdate to false.
    (WebCore::SelectionController::setSelection): Call
    the new setNeedsDisplayUpdate function instead of the old
    badly named Frame::selectionLayoutChanged function.
    (WebCore::SelectionController::setNeedsDisplayUpdate):
    Set m_needsDisplayUpdate. If it is just becoming true, then
    call FrameView::scheduleRelayout.
    
    * editing/SelectionController.h: Added setNeedsDisplayUpdate,
    needsDisplayUpdate, and m_needsDisplayUpdate.
    
    * page/Frame.cpp:
    (WebCore::Frame::setCaretVisible): Call setNeedsDisplayUpdate.
    (WebCore::Frame::selectionLayoutChanged): Call
    setNeedsDisplayUpdate to set it to false, since this is the
    function that performs "selection display update". Later I want
    to rename this function.
    
    * page/FrameView.cpp:
    (WebCore::FrameView::needsLayout): Add a new clause, since
    we need a call to layout if needsDisplayUpdate is true.
    
    LayoutTests:
    
    * fast/forms/selection-layout-reentry-strange-case-expected.txt: Added.
    * fast/forms/selection-layout-reentry-strange-case.html: Added.
    
    * platform/mac/accessibility/frame-with-title-expected.txt: Updated since
    the number of layouts is now different.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52494 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 507cb7d..6795b49 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2009-12-21  Darin Adler  <darin at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Reentrancy problem with selection in some edge cases.
+        https://bugs.webkit.org/show_bug.cgi?id=32842
+        rdar://problem/7449974
+
+        * fast/forms/selection-layout-reentry-strange-case-expected.txt: Added.
+        * fast/forms/selection-layout-reentry-strange-case.html: Added.
+
+        * platform/mac/accessibility/frame-with-title-expected.txt: Updated since
+        the number of layouts is now different.
+
 2009-12-21  Csaba Osztrogonác  <ossy at webkit.org>
 
         [Qt] Skip layoutTestController.notifyDone() related test until fix.
diff --git a/LayoutTests/fast/forms/selection-layout-reentry-strange-case-expected.txt b/LayoutTests/fast/forms/selection-layout-reentry-strange-case-expected.txt
new file mode 100644
index 0000000..811b710
--- /dev/null
+++ b/LayoutTests/fast/forms/selection-layout-reentry-strange-case-expected.txt
@@ -0,0 +1,2 @@
+t down
+Yes, this is a strange test case. If you can see this and it did not crash, then all is well.
diff --git a/LayoutTests/fast/forms/selection-layout-reentry-strange-case.html b/LayoutTests/fast/forms/selection-layout-reentry-strange-case.html
new file mode 100644
index 0000000..72b96c6
--- /dev/null
+++ b/LayoutTests/fast/forms/selection-layout-reentry-strange-case.html
@@ -0,0 +1,19 @@
+<textarea id="container">si
+<DIV abcdefgh_POSIT></DIV>
+</textarea>t down
+
+<script>
+    document.execCommand("FindString", true, "sit");
+    document.execCommand("FindString", true, "down");
+</script>
+
+<style></style>
+
+<script type="text/javascript">
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+    document.getElementById('container').innerHTML="";
+</script>
+
+<p>Yes, this is a strange test case. If you can see this and it
+did not crash, then all is well.</p>
diff --git a/LayoutTests/platform/mac/accessibility/frame-with-title-expected.txt b/LayoutTests/platform/mac/accessibility/frame-with-title-expected.txt
index 0cad128..538cfd8 100644
--- a/LayoutTests/platform/mac/accessibility/frame-with-title-expected.txt
+++ b/LayoutTests/platform/mac/accessibility/frame-with-title-expected.txt
@@ -21,7 +21,7 @@ AXBlockQuoteLevel: 0
 AXTopLevelUIElement: <AXWebArea>
 AXLinkUIElements: <array of size 0>
 AXLoaded: 1
-AXLayoutCount: 3
+AXLayoutCount: 4
 AXURL: about:blank
 
 
@@ -48,7 +48,7 @@ AXBlockQuoteLevel: 0
 AXTopLevelUIElement: <AXWebArea>
 AXLinkUIElements: <array of size 0>
 AXLoaded: 1
-AXLayoutCount: 4
+AXLayoutCount: 5
 AXURL: about:blank
 
 
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6c8f7d2..4aa43fc 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,41 @@
+2009-12-21  Darin Adler  <darin at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Reentrancy problem with selection in some edge cases.
+        https://bugs.webkit.org/show_bug.cgi?id=32842
+        rdar://problem/7449974
+
+        Test: fast/forms/selection-layout-reentry-strange-case.html
+
+        Move the selection display update process done in the
+        selectionLayoutChanged function into the layout timer
+        instead of doing it immediately when selection changes occur.
+
+        * editing/SelectionController.cpp:
+        (WebCore::SelectionController::SelectionController):
+        Initialize m_needsDisplayUpdate to false.
+        (WebCore::SelectionController::setSelection): Call
+        the new setNeedsDisplayUpdate function instead of the old
+        badly named Frame::selectionLayoutChanged function.
+        (WebCore::SelectionController::setNeedsDisplayUpdate):
+        Set m_needsDisplayUpdate. If it is just becoming true, then
+        call FrameView::scheduleRelayout.
+
+        * editing/SelectionController.h: Added setNeedsDisplayUpdate,
+        needsDisplayUpdate, and m_needsDisplayUpdate.
+
+        * page/Frame.cpp:
+        (WebCore::Frame::setCaretVisible): Call setNeedsDisplayUpdate.
+        (WebCore::Frame::selectionLayoutChanged): Call
+        setNeedsDisplayUpdate to set it to false, since this is the
+        function that performs "selection display update". Later I want
+        to rename this function.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::needsLayout): Add a new clause, since
+        we need a call to layout if needsDisplayUpdate is true.
+
 2009-12-22  Kwang Yul Seo  <skyul at company100.net>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/editing/SelectionController.cpp b/WebCore/editing/SelectionController.cpp
index 518df45..bf24aba 100644
--- a/WebCore/editing/SelectionController.cpp
+++ b/WebCore/editing/SelectionController.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2008, 2009 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -70,6 +70,7 @@ SelectionController::SelectionController(Frame* frame, bool isDragCaretControlle
     , m_isDragCaretController(isDragCaretController)
     , m_isCaretBlinkingSuspended(false)
     , m_focused(frame && frame->page() && frame->page()->focusController()->focusedFrame() == frame)
+    , m_needsDisplayUpdate(false)
 {
 }
 
@@ -145,7 +146,8 @@ void SelectionController::setSelection(const VisibleSelection& s, bool closeTypi
     if (!s.isNone())
         m_frame->setFocusedNodeIfNeeded();
     
-    m_frame->selectionLayoutChanged();
+    setNeedsDisplayUpdate();
+
     // Always clear the x position used for vertical arrow navigation.
     // It will be restored by the vertical arrow navigation code if necessary.
     m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation;
@@ -1301,6 +1303,20 @@ bool SelectionController::isFocusedAndActive() const
     return m_focused && m_frame->page() && m_frame->page()->focusController()->isActive();
 }
 
+void SelectionController::setNeedsDisplayUpdate(bool needsUpdate)
+{
+    if (m_needsDisplayUpdate == needsUpdate)
+        return;
+    m_needsDisplayUpdate = needsUpdate;
+
+    if (!m_needsDisplayUpdate)
+        return;
+    FrameView* view = m_frame->view();
+    if (!view)
+        return;
+    view->scheduleRelayout();
+}
+
 #ifndef NDEBUG
 
 void SelectionController::formatForDebugger(char* buffer, unsigned length) const
diff --git a/WebCore/editing/SelectionController.h b/WebCore/editing/SelectionController.h
index d03df52..532f4d9 100644
--- a/WebCore/editing/SelectionController.h
+++ b/WebCore/editing/SelectionController.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2004, 2009 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -124,6 +124,10 @@ public:
     bool isFocusedAndActive() const;
     void pageActivationChanged();
 
+    // Selection display machinery
+    void setNeedsDisplayUpdate(bool = true);
+    bool needsDisplayUpdate() const { return m_needsDisplayUpdate; }
+
 #ifndef NDEBUG
     void formatForDebugger(char* buffer, unsigned length) const;
     void showTreeForThis() const;
@@ -174,7 +178,7 @@ private:
     bool m_isDragCaretController : 1;
     bool m_isCaretBlinkingSuspended : 1;
     bool m_focused : 1;
-
+    bool m_needsDisplayUpdate : 1;
 };
 
 inline bool operator==(const SelectionController& a, const SelectionController& b)
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index bc1b1ca..5206372 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -563,7 +563,7 @@ void Frame::setCaretVisible(bool flag)
         return;
     clearCaretRectIfNeeded();
     m_caretVisible = flag;
-    selectionLayoutChanged();
+    selection()->setNeedsDisplayUpdate();
 }
 
 void Frame::clearCaretRectIfNeeded()
@@ -630,6 +630,8 @@ void Frame::setFocusedNodeIfNeeded()
 
 void Frame::selectionLayoutChanged()
 {
+    selection()->setNeedsDisplayUpdate(false);
+
     bool caretRectChanged = selection()->recomputeCaretRect();
 
 #if ENABLE(TEXT_CARET)
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 483a220..e2f6382 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -1198,7 +1198,8 @@ bool FrameView::needsLayout() const
         || m_layoutRoot
         || (document && document->childNeedsStyleRecalc()) // can occur when using WebKit ObjC interface
         || m_frame->needsReapplyStyles()
-        || (m_deferSetNeedsLayouts && m_setNeedsLayoutWasDeferred);
+        || (m_deferSetNeedsLayouts && m_setNeedsLayoutWasDeferred)
+        || m_frame->selection()->needsDisplayUpdate();
 }
 
 void FrameView::setNeedsLayout()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list