Title: [151241] trunk/Source/WebKit/blackberry
Revision
151241
Author
[email protected]
Date
2013-06-05 14:42:30 -0700 (Wed, 05 Jun 2013)

Log Message

[BlackBerry] Deleting the pendingSelectionCandidate on the wrong thread causes an assert.
https://bugs.webkit.org/show_bug.cgi?id=117276

Patch by Genevieve Mak <[email protected]> on 2013-06-05
Reviewed by Rob Buis.

Reviewed Internally by Nima Ghanavatian.
PR #342399
Store and delete the selectionScrollView in webkit which is what we already do for
scrolling subframes.

* Api/InRegionScroller.cpp:
(BlackBerry::WebKit::InRegionScrollerPrivate::InRegionScrollerPrivate):
(BlackBerry::WebKit::InRegionScrollerPrivate::resetSelectionScrollView):
(WebKit):
(BlackBerry::WebKit::InRegionScrollerPrivate::clearDocumentData):
(BlackBerry::WebKit::InRegionScrollerPrivate::calculateInRegionScrollableAreasForPoint):
(BlackBerry::WebKit::InRegionScrollerPrivate::updateSelectionScrollView):
(BlackBerry::WebKit::InRegionScrollerPrivate::firstScrollableInRegionForNode):
* Api/InRegionScroller_p.h:
(InRegionScrollerPrivate):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/InRegionScroller.cpp (151240 => 151241)


--- trunk/Source/WebKit/blackberry/Api/InRegionScroller.cpp	2013-06-05 21:40:19 UTC (rev 151240)
+++ trunk/Source/WebKit/blackberry/Api/InRegionScroller.cpp	2013-06-05 21:42:30 UTC (rev 151241)
@@ -79,6 +79,7 @@
 InRegionScrollerPrivate::InRegionScrollerPrivate(WebPagePrivate* webPagePrivate)
     : m_webPage(webPagePrivate)
     , m_needsActiveScrollableAreaCalculation(false)
+    , m_selectionScrollView(0)
 {
 }
 
@@ -94,6 +95,16 @@
     m_activeInRegionScrollableAreas.clear();
 }
 
+void InRegionScrollerPrivate::resetSelectionScrollView()
+{
+    m_webPage->m_client->notifySelectionScrollView(0);
+    m_webPage->m_selectionHandler->setSelectionSubframeViewportRect(WebCore::IntRect());
+    if (m_selectionScrollView) {
+        delete m_selectionScrollView;
+        m_selectionScrollView = 0;
+    }
+}
+
 bool InRegionScrollerPrivate::isActive() const
 {
     return m_activeInRegionScrollableAreas.size() > 0;
@@ -101,12 +112,17 @@
 
 void InRegionScrollerPrivate::clearDocumentData(const Document* documentGoingAway)
 {
+    InRegionScrollableArea* scrollableArea = static_cast<InRegionScrollableArea*>(m_selectionScrollView);
+    ASSERT(scrollableArea);
+    if (scrollableArea->document() == documentGoingAway)
+        resetSelectionScrollView();
+
     if (m_needsActiveScrollableAreaCalculation) {
         reset();
         return;
     }
 
-    InRegionScrollableArea* scrollableArea = static_cast<InRegionScrollableArea*>(m_activeInRegionScrollableAreas[0]);
+    scrollableArea = static_cast<InRegionScrollableArea*>(m_activeInRegionScrollableAreas[0]);
     ASSERT(scrollableArea);
     if (scrollableArea->document() == documentGoingAway)
         reset();
@@ -240,7 +256,6 @@
 {
     ASSERT(m_activeInRegionScrollableAreas.empty());
     m_needsActiveScrollableAreaCalculation = false;
-
     const HitTestResult& result = m_webPage->hitTestResult(documentPoint);
     Node* node = result.innerNonSharedNode();
     if (!node || !node->renderer())
@@ -303,11 +318,10 @@
 void InRegionScrollerPrivate::updateSelectionScrollView(const Node* node)
 {
     // TODO: don't notify the client if the node didn't change.
-    // Deleting the scrollview is handled by the client.
-    Platform::ScrollViewBase* selectionScrollView = firstScrollableInRegionForNode(node);
-    m_webPage->m_client->notifySelectionScrollView(selectionScrollView);
+    m_selectionScrollView = firstScrollableInRegionForNode(node);
+    m_webPage->m_client->notifySelectionScrollView(m_selectionScrollView);
     // If there's no subframe set an empty rect so that we default to the main frame.
-    m_webPage->m_selectionHandler->setSelectionSubframeViewportRect(selectionScrollView ? WebCore::IntRect(selectionScrollView->documentViewportRect()) : WebCore::IntRect());
+    m_webPage->m_selectionHandler->setSelectionSubframeViewportRect(m_selectionScrollView ? WebCore::IntRect(m_selectionScrollView->documentViewportRect()) : WebCore::IntRect());
 }
 
 Platform::ScrollViewBase* InRegionScrollerPrivate::firstScrollableInRegionForNode(const Node* node)
@@ -325,7 +339,7 @@
             if (RenderView* renderView = toRenderView(renderer)) {
                 FrameView* view = renderView->frameView();
                 if (!view) {
-                    reset();
+                    resetSelectionScrollView();
                     return 0;
                 }
 

Modified: trunk/Source/WebKit/blackberry/Api/InRegionScroller_p.h (151240 => 151241)


--- trunk/Source/WebKit/blackberry/Api/InRegionScroller_p.h	2013-06-05 21:40:19 UTC (rev 151240)
+++ trunk/Source/WebKit/blackberry/Api/InRegionScroller_p.h	2013-06-05 21:42:30 UTC (rev 151241)
@@ -45,6 +45,7 @@
     InRegionScrollerPrivate(WebPagePrivate*);
 
     void reset();
+    void resetSelectionScrollView();
     bool isActive() const;
 
     bool setScrollPositionCompositingThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition);
@@ -77,6 +78,7 @@
     bool isValidScrollableNode(WebCore::Node*) const;
     WebCore::IntRect clipToRect(const WebCore::IntRect&, InRegionScrollableArea*);
     std::vector<Platform::ScrollViewBase*> m_activeInRegionScrollableAreas;
+    Platform::ScrollViewBase* m_selectionScrollView;
 };
 
 }

Modified: trunk/Source/WebKit/blackberry/ChangeLog (151240 => 151241)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-06-05 21:40:19 UTC (rev 151240)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-06-05 21:42:30 UTC (rev 151241)
@@ -1,3 +1,26 @@
+2013-06-05  Genevieve Mak  <[email protected]>
+
+        [BlackBerry] Deleting the pendingSelectionCandidate on the wrong thread causes an assert.
+        https://bugs.webkit.org/show_bug.cgi?id=117276
+
+        Reviewed by Rob Buis.
+
+        Reviewed Internally by Nima Ghanavatian.
+        PR #342399
+        Store and delete the selectionScrollView in webkit which is what we already do for
+        scrolling subframes.
+
+        * Api/InRegionScroller.cpp:
+        (BlackBerry::WebKit::InRegionScrollerPrivate::InRegionScrollerPrivate):
+        (BlackBerry::WebKit::InRegionScrollerPrivate::resetSelectionScrollView):
+        (WebKit):
+        (BlackBerry::WebKit::InRegionScrollerPrivate::clearDocumentData):
+        (BlackBerry::WebKit::InRegionScrollerPrivate::calculateInRegionScrollableAreasForPoint):
+        (BlackBerry::WebKit::InRegionScrollerPrivate::updateSelectionScrollView):
+        (BlackBerry::WebKit::InRegionScrollerPrivate::firstScrollableInRegionForNode):
+        * Api/InRegionScroller_p.h:
+        (InRegionScrollerPrivate):
+
 2013-06-05  Tiancheng Jiang  <[email protected]>
 
         [BlackBerry] Make image clickable when it has anchor as parent node.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to