[BlackBerry] Notify client if the selection is in a subframe when started.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2013 15:57:01 +0000 (15:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2013 15:57:01 +0000 (15:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=112065

Patch by Genevieve Mak <gmak@rim.com> on 2013-03-12
Reviewed by Rob Buis.

PR #278490
Internally Reviewed by Mike Fenton.

* Api/InRegionScroller.cpp:
(BlackBerry::WebKit::InRegionScrollerPrivate::updateSelectionScrollView):
(WebKit):
* Api/InRegionScroller_p.h:
(InRegionScrollerPrivate):
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::updateSelectionScrollView):
(WebKit):
* Api/WebPageClient.h:
* Api/WebPage_p.h:
(WebPagePrivate):
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::cancelSelection):
(BlackBerry::WebKit::SelectionHandler::setSelection):

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

Source/WebKit/blackberry/Api/InRegionScroller.cpp
Source/WebKit/blackberry/Api/InRegionScroller_p.h
Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/Api/WebPageClient.h
Source/WebKit/blackberry/Api/WebPage_p.h
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp

index 329556c..d39ecbd 100644 (file)
@@ -295,6 +295,13 @@ void InRegionScrollerPrivate::calculateInRegionScrollableAreasForPoint(const Web
     }
 }
 
+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.
+    m_webPage->m_client->notifySelectionScrollView(firstScrollableInRegionForNode(node));
+}
+
 Platform::ScrollViewBase* InRegionScrollerPrivate::firstScrollableInRegionForNode(const Node* node)
 {
     if (!node || !node->renderer())
index 404a19f..73aa610 100644 (file)
@@ -53,7 +53,7 @@ public:
 
     void calculateInRegionScrollableAreasForPoint(const WebCore::IntPoint&);
     const std::vector<Platform::ScrollViewBase*>& activeInRegionScrollableAreas() const;
-    Platform::ScrollViewBase* firstScrollableInRegionForNode(const WebCore::Node*);
+    void updateSelectionScrollView(const WebCore::Node*);
 
     void clearDocumentData(const WebCore::Document*);
 
@@ -63,6 +63,7 @@ public:
     bool m_needsActiveScrollableAreaCalculation;
 
 private:
+    Platform::ScrollViewBase* firstScrollableInRegionForNode(const WebCore::Node*);
     bool setLayerScrollPosition(WebCore::RenderLayer*, const WebCore::IntPoint& scrollPosition);
 
     void calculateActiveAndShrinkCachedScrollableAreas(WebCore::RenderLayer*);
index 964de8a..30e961f 100644 (file)
@@ -3311,6 +3311,11 @@ void WebPagePrivate::selectionChanged(Frame* frame)
     m_page->focusController()->setFocusedFrame(frame);
 }
 
+void WebPagePrivate::updateSelectionScrollView(const Node* node)
+{
+    m_inRegionScroller->d->updateSelectionScrollView(node);
+}
+
 void WebPagePrivate::updateDelegatedOverlays(bool dispatched)
 {
     // Track a dispatched message, we don't want to flood the webkit thread.
index f553a76..1633937 100644 (file)
@@ -159,6 +159,7 @@ public:
     virtual void cancelSelectionVisuals() = 0;
     virtual void notifySelectionHandlesReversed() = 0;
     virtual void notifyCaretChanged(const Platform::IntRect& documentCaretRect, bool userTouchTriggered, bool isSingleLineInput = false, const Platform::IntRect& singleLineDocumentBoundingBox = Platform::IntRect(), bool textFieldIsEmpty = false) = 0;
+    virtual void notifySelectionScrollView(Platform::ScrollViewBase*) = 0;
 
     virtual void cursorChanged(Platform::CursorType, const char* url, const Platform::IntPoint& hotSpotInImage) = 0;
 
index 3c49955..3082946 100644 (file)
@@ -322,6 +322,7 @@ public:
 
     void selectionChanged(WebCore::Frame*);
     void setOverlayExpansionPixelHeight(int);
+    void updateSelectionScrollView(const WebCore::Node*);
 
     void updateDelegatedOverlays(bool dispatched = false);
 
index 72e0054..e6c3e53 100644 (file)
@@ -1,3 +1,28 @@
+2013-03-12  Genevieve Mak  <gmak@rim.com>
+
+        [BlackBerry] Notify client if the selection is in a subframe when started.
+        https://bugs.webkit.org/show_bug.cgi?id=112065
+
+        Reviewed by Rob Buis.
+
+        PR #278490
+        Internally Reviewed by Mike Fenton.
+
+        * Api/InRegionScroller.cpp:
+        (BlackBerry::WebKit::InRegionScrollerPrivate::updateSelectionScrollView):
+        (WebKit):
+        * Api/InRegionScroller_p.h:
+        (InRegionScrollerPrivate):
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::updateSelectionScrollView):
+        (WebKit):
+        * Api/WebPageClient.h:
+        * Api/WebPage_p.h:
+        (WebPagePrivate):
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::cancelSelection):
+        (BlackBerry::WebKit::SelectionHandler::setSelection):
+
 2013-03-12  Alberto Garcia  <agarcia@igalia.com>
 
         [BlackBerry] SelectionHandler: fix truncated line
index 40d3bf5..0b732db 100644 (file)
@@ -91,6 +91,8 @@ void SelectionHandler::cancelSelection()
     // rendering happened prior to processing on webkit thread
     m_webPage->m_client->notifySelectionDetailsChanged(SelectionDetails());
 
+    m_webPage->updateSelectionScrollView(0);
+
     SelectionLog(Platform::LogLevelInfo, "SelectionHandler::cancelSelection");
 
     if (m_webPage->m_inputHandler->isInputMode())
@@ -536,6 +538,9 @@ void SelectionHandler::setSelection(const WebCore::IntPoint& start, const WebCor
         }
     }
 
+    if (!controller->selection().isRange())
+        m_webPage->updateSelectionScrollView(newSelection.visibleEnd().deepEquivalent().anchorNode());
+
     newSelection.setIsDirectional(true);
 
     if (m_webPage->m_inputHandler->isInputMode()) {
@@ -848,6 +853,9 @@ bool SelectionHandler::expandSelectionToGranularity(Frame* frame, VisibleSelecti
     if (granularity == ParagraphGranularity)
         findNextAnimationOverlayRegion();
 
+    if (granularity == WordGranularity)
+        m_webPage->updateSelectionScrollView(selection.visibleEnd().deepEquivalent().anchorNode());
+
     return true;
 }
 
@@ -915,6 +923,7 @@ void SelectionHandler::selectObject(Node* node)
     VisibleSelection selection = VisibleSelection::selectionFromContentsOfNode(node);
     drawAnimationOverlay(regionForSelectionQuads(selection), false /* isExpandingOverlayAtConstantRate */, true /* isStartOfSelection */);
     focusedFrame->selection()->setSelection(selection);
+    m_webPage->updateSelectionScrollView(node);
 }
 
 static TextDirection directionOfEnclosingBlock(FrameSelection* selection)