Changeset 149471 in webkit


Ignore:
Timestamp:
May 1, 2013 6:09:18 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] Upstream smart selection
https://bugs.webkit.org/show_bug.cgi?id=111226

Patch by Iris Wu <shuwu@blackberry.com> 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):

Location:
trunk/Source/WebKit/blackberry
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/blackberry/Api/InRegionScroller.cpp

    r147744 r149471  
    307307    Platform::ScrollViewBase* selectionScrollView = firstScrollableInRegionForNode(node);
    308308    m_webPage->m_client->notifySelectionScrollView(selectionScrollView);
    309     // if there's no subframe set an empty rect so that we default to the main frame.
    310     m_webPage->m_selectionHandler->setSelectionViewportRect(selectionScrollView ? WebCore::IntRect(selectionScrollView->documentViewportRect()) : WebCore::IntRect());
     309    // If there's no subframe set an empty rect so that we default to the main frame.
     310    m_webPage->m_selectionHandler->setSelectionSubframeViewportRect(selectionScrollView ? WebCore::IntRect(selectionScrollView->documentViewportRect()) : WebCore::IntRect());
    311311}
    312312
  • trunk/Source/WebKit/blackberry/Api/WebPage.cpp

    r149193 r149471  
    44334433}
    44344434
     4435void WebPage::setSelectionDocumentViewportSize(const Platform::IntSize& selectionDocumentViewportSize)
     4436{
     4437    d->m_selectionHandler->setSelectionViewportSize(selectionDocumentViewportSize);
     4438}
     4439
    44354440BackingStore* WebPage::backingStore() const
    44364441{
  • trunk/Source/WebKit/blackberry/Api/WebPage.h

    r149180 r149471  
    265265    void setOverlayExpansionPixelHeight(int);
    266266    void setParagraphExpansionPixelScrollMargin(const Platform::IntSize&);
     267    void setSelectionDocumentViewportSize(const Platform::IntSize&);
    267268    void selectionCancelled();
    268269    bool selectionContainsDocumentPoint(const Platform::IntPoint&);
  • trunk/Source/WebKit/blackberry/ChangeLog

    r149412 r149471  
     12013-05-01  Iris Wu  <shuwu@blackberry.com>
     2
     3         [BlackBerry] Upstream smart selection
     4         https://bugs.webkit.org/show_bug.cgi?id=111226
     5
     6        Reviewed by Rob Buis.
     7
     8        Calling userInterfaceViewportAccessor()->documentViewportRect() on WK thread
     9        caused crash.
     10        But viewport from webkitThreadViewportAccessor uses unadjusted size which is
     11        wrong for email.
     12        The solution here is to get actual viewport size on UI thread and then pass it
     13        to WebKit::SelectionHandler.
     14
     15        PR 333763
     16        Reviewed Internally By Jakob Petsovits.
     17
     18        * Api/InRegionScroller.cpp:
     19        (BlackBerry::WebKit::InRegionScrollerPrivate::updateSelectionScrollView):
     20        * Api/WebPage.cpp:
     21        (BlackBerry::WebKit::WebPage::setSelectionDocumentViewportSize):
     22        (WebKit):
     23        * Api/WebPage.h:
     24        * WebKitSupport/SelectionHandler.cpp:
     25        (BlackBerry::WebKit::SelectionHandler::selectAtPoint):
     26        (BlackBerry::WebKit::SelectionHandler::ensureSelectedTextVisible):
     27        (BlackBerry::WebKit::SelectionHandler::selectionViewportRect):
     28        * WebKitSupport/SelectionHandler.h:
     29        (BlackBerry::WebKit::SelectionHandler::setSelectionViewportSize):
     30        (BlackBerry::WebKit::SelectionHandler::setSelectionSubframeViewportRect):
     31        (SelectionHandler):
     32
    1332013-04-30  Genevieve Mak  <gmak@rim.com>
    234
  • trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp

    r148302 r149471  
    657657        m_currentAnimationOverlayRegion = IntRectRegion();
    658658        m_nextAnimationOverlayRegion = IntRectRegion();
    659         m_selectionViewportRect = WebCore::IntRect();
     659        m_selectionSubframeViewportRect = WebCore::IntRect();
    660660    }
    661661
     
    797797
    798798    // Scroll position adjustment here is based on main frame. If selecting in a subframe, don't do animation.
    799     if (!m_selectionViewportRect.isEmpty())
     799    if (!m_selectionSubframeViewportRect.isEmpty())
    800800        return false;
    801801
     
    830830WebCore::IntRect SelectionHandler::selectionViewportRect() const
    831831{
    832     if (m_selectionViewportRect.isEmpty()) {
    833         WebCore::IntPoint scrollPosition = m_webPage->scrollPosition();
    834         WebCore::IntSize actualVisibleSize = m_webPage->client()->userInterfaceViewportAccessor()->documentViewportRect().size(); // viewport size for both Cascades and browser
    835         return WebCore::IntRect(scrollPosition, actualVisibleSize);
    836     }
    837     return m_selectionViewportRect;
     832    if (m_selectionSubframeViewportRect.isEmpty())
     833        return WebCore::IntRect(m_webPage->scrollPosition(), m_selectionViewportSize);
     834    return m_selectionSubframeViewportRect;
    838835}
    839836
  • trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h

    r148302 r149471  
    8181    void setOverlayExpansionHeight(int dy) { m_overlayExpansionHeight = dy; }
    8282    void setParagraphExpansionScrollMargin(const WebCore::IntSize&);
    83     void setSelectionViewportRect(const WebCore::IntRect& selectionViewportRect) { m_selectionViewportRect = selectionViewportRect; }
     83    void setSelectionViewportSize(const WebCore::IntSize& selectionViewportSize) { m_selectionViewportSize = selectionViewportSize; }
     84    void setSelectionSubframeViewportRect(const WebCore::IntRect& selectionSubframeViewportRect) { m_selectionSubframeViewportRect = selectionSubframeViewportRect; }
    8485    WebCore::IntRect selectionViewportRect() const;
    8586
     
    127128
    128129    WebCore::IntSize m_scrollMargin;
    129     WebCore::IntRect m_selectionViewportRect;
     130    WebCore::IntSize m_selectionViewportSize;
     131    WebCore::IntRect m_selectionSubframeViewportRect;
    130132    WebCore::VisibleSelection m_lastSelection;
    131133};
Note: See TracChangeset for help on using the changeset viewer.