Title: [149471] trunk/Source/WebKit/blackberry
- Revision
- 149471
- Author
- [email protected]
- Date
- 2013-05-01 18:09:18 -0700 (Wed, 01 May 2013)
Log Message
[BlackBerry] Upstream smart selection
https://bugs.webkit.org/show_bug.cgi?id=111226
Patch by Iris Wu <[email protected]> on 2013-05-01
Reviewed by Rob Buis.
Calling userInterfaceViewportAccessor()->documentViewportRect() on WK thread
caused crash.
But viewport from webkitThreadViewportAccessor uses unadjusted size which is
wrong for email.
The solution here is to get actual viewport size on UI thread and then pass it
to WebKit::SelectionHandler.
PR 333763
Reviewed Internally By Jakob Petsovits.
* Api/InRegionScroller.cpp:
(BlackBerry::WebKit::InRegionScrollerPrivate::updateSelectionScrollView):
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPage::setSelectionDocumentViewportSize):
(WebKit):
* Api/WebPage.h:
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::selectAtPoint):
(BlackBerry::WebKit::SelectionHandler::ensureSelectedTextVisible):
(BlackBerry::WebKit::SelectionHandler::selectionViewportRect):
* WebKitSupport/SelectionHandler.h:
(BlackBerry::WebKit::SelectionHandler::setSelectionViewportSize):
(BlackBerry::WebKit::SelectionHandler::setSelectionSubframeViewportRect):
(SelectionHandler):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/Api/InRegionScroller.cpp (149470 => 149471)
--- trunk/Source/WebKit/blackberry/Api/InRegionScroller.cpp 2013-05-02 01:07:03 UTC (rev 149470)
+++ trunk/Source/WebKit/blackberry/Api/InRegionScroller.cpp 2013-05-02 01:09:18 UTC (rev 149471)
@@ -306,8 +306,8 @@
// Deleting the scrollview is handled by the client.
Platform::ScrollViewBase* selectionScrollView = firstScrollableInRegionForNode(node);
m_webPage->m_client->notifySelectionScrollView(selectionScrollView);
- // if there's no subframe set an empty rect so that we default to the main frame.
- m_webPage->m_selectionHandler->setSelectionViewportRect(selectionScrollView ? WebCore::IntRect(selectionScrollView->documentViewportRect()) : WebCore::IntRect());
+ // 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());
}
Platform::ScrollViewBase* InRegionScrollerPrivate::firstScrollableInRegionForNode(const Node* node)
Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (149470 => 149471)
--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2013-05-02 01:07:03 UTC (rev 149470)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2013-05-02 01:09:18 UTC (rev 149471)
@@ -4432,6 +4432,11 @@
d->m_selectionHandler->setParagraphExpansionScrollMargin(documentScrollMargin);
}
+void WebPage::setSelectionDocumentViewportSize(const Platform::IntSize& selectionDocumentViewportSize)
+{
+ d->m_selectionHandler->setSelectionViewportSize(selectionDocumentViewportSize);
+}
+
BackingStore* WebPage::backingStore() const
{
return d->m_backingStore;
Modified: trunk/Source/WebKit/blackberry/Api/WebPage.h (149470 => 149471)
--- trunk/Source/WebKit/blackberry/Api/WebPage.h 2013-05-02 01:07:03 UTC (rev 149470)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.h 2013-05-02 01:09:18 UTC (rev 149471)
@@ -264,6 +264,7 @@
void expandSelection(bool isScrollStarted);
void setOverlayExpansionPixelHeight(int);
void setParagraphExpansionPixelScrollMargin(const Platform::IntSize&);
+ void setSelectionDocumentViewportSize(const Platform::IntSize&);
void selectionCancelled();
bool selectionContainsDocumentPoint(const Platform::IntPoint&);
Modified: trunk/Source/WebKit/blackberry/ChangeLog (149470 => 149471)
--- trunk/Source/WebKit/blackberry/ChangeLog 2013-05-02 01:07:03 UTC (rev 149470)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2013-05-02 01:09:18 UTC (rev 149471)
@@ -1,3 +1,35 @@
+2013-05-01 Iris Wu <[email protected]>
+
+ [BlackBerry] Upstream smart selection
+ https://bugs.webkit.org/show_bug.cgi?id=111226
+
+ Reviewed by Rob Buis.
+
+ Calling userInterfaceViewportAccessor()->documentViewportRect() on WK thread
+ caused crash.
+ But viewport from webkitThreadViewportAccessor uses unadjusted size which is
+ wrong for email.
+ The solution here is to get actual viewport size on UI thread and then pass it
+ to WebKit::SelectionHandler.
+
+ PR 333763
+ Reviewed Internally By Jakob Petsovits.
+
+ * Api/InRegionScroller.cpp:
+ (BlackBerry::WebKit::InRegionScrollerPrivate::updateSelectionScrollView):
+ * Api/WebPage.cpp:
+ (BlackBerry::WebKit::WebPage::setSelectionDocumentViewportSize):
+ (WebKit):
+ * Api/WebPage.h:
+ * WebKitSupport/SelectionHandler.cpp:
+ (BlackBerry::WebKit::SelectionHandler::selectAtPoint):
+ (BlackBerry::WebKit::SelectionHandler::ensureSelectedTextVisible):
+ (BlackBerry::WebKit::SelectionHandler::selectionViewportRect):
+ * WebKitSupport/SelectionHandler.h:
+ (BlackBerry::WebKit::SelectionHandler::setSelectionViewportSize):
+ (BlackBerry::WebKit::SelectionHandler::setSelectionSubframeViewportRect):
+ (SelectionHandler):
+
2013-04-30 Genevieve Mak <[email protected]>
[BlackBerry] Cannot touch scroll readonly text input.
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (149470 => 149471)
--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp 2013-05-02 01:07:03 UTC (rev 149470)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp 2013-05-02 01:09:18 UTC (rev 149471)
@@ -656,7 +656,7 @@
m_animationOverlayEndPos = VisiblePosition();
m_currentAnimationOverlayRegion = IntRectRegion();
m_nextAnimationOverlayRegion = IntRectRegion();
- m_selectionViewportRect = WebCore::IntRect();
+ m_selectionSubframeViewportRect = WebCore::IntRect();
}
// If point is invalid trigger selection based expansion.
@@ -796,7 +796,7 @@
return viewportRect.maxY() >= m_webPage->contentsSize().height() ? viewportRect.maxY() >= point.y() : viewportRect.maxY() >= point.y() + m_scrollMargin.height();
// Scroll position adjustment here is based on main frame. If selecting in a subframe, don't do animation.
- if (!m_selectionViewportRect.isEmpty())
+ if (!m_selectionSubframeViewportRect.isEmpty())
return false;
WebCore::IntRect endLocation = m_animationOverlayEndPos.absoluteCaretBounds();
@@ -829,12 +829,9 @@
WebCore::IntRect SelectionHandler::selectionViewportRect() const
{
- if (m_selectionViewportRect.isEmpty()) {
- WebCore::IntPoint scrollPosition = m_webPage->scrollPosition();
- WebCore::IntSize actualVisibleSize = m_webPage->client()->userInterfaceViewportAccessor()->documentViewportRect().size(); // viewport size for both Cascades and browser
- return WebCore::IntRect(scrollPosition, actualVisibleSize);
- }
- return m_selectionViewportRect;
+ if (m_selectionSubframeViewportRect.isEmpty())
+ return WebCore::IntRect(m_webPage->scrollPosition(), m_selectionViewportSize);
+ return m_selectionSubframeViewportRect;
}
void SelectionHandler::setParagraphExpansionScrollMargin(const WebCore::IntSize& scrollMargin)
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h (149470 => 149471)
--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h 2013-05-02 01:07:03 UTC (rev 149470)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h 2013-05-02 01:09:18 UTC (rev 149471)
@@ -80,7 +80,8 @@
void expandSelection(bool isScrollStarted);
void setOverlayExpansionHeight(int dy) { m_overlayExpansionHeight = dy; }
void setParagraphExpansionScrollMargin(const WebCore::IntSize&);
- void setSelectionViewportRect(const WebCore::IntRect& selectionViewportRect) { m_selectionViewportRect = selectionViewportRect; }
+ void setSelectionViewportSize(const WebCore::IntSize& selectionViewportSize) { m_selectionViewportSize = selectionViewportSize; }
+ void setSelectionSubframeViewportRect(const WebCore::IntRect& selectionSubframeViewportRect) { m_selectionSubframeViewportRect = selectionSubframeViewportRect; }
WebCore::IntRect selectionViewportRect() const;
private:
@@ -126,7 +127,8 @@
BlackBerry::Platform::StopWatch m_timer;
WebCore::IntSize m_scrollMargin;
- WebCore::IntRect m_selectionViewportRect;
+ WebCore::IntSize m_selectionViewportSize;
+ WebCore::IntRect m_selectionSubframeViewportRect;
WebCore::VisibleSelection m_lastSelection;
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes