Changeset 147687 in webkit


Ignore:
Timestamp:
Apr 4, 2013 5:26:29 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] Adjust fatfinger result priority
https://bugs.webkit.org/show_bug.cgi?id=113957

Patch by Tiancheng Jiang <tijiang@rim.com> on 2013-04-04
Reviewed by Rob Buis.

RIM PR 224781
Internally Reviewed by Genevieve Mak.

Change fatfigner algorithm, return the clickable element rather than
its parent anchor. Modify taphighlight and context menu node selection
accordingly.

  • Api/WebPage.cpp:

(BlackBerry::WebKit::WebPagePrivate::webContext):

  • WebKitSupport/FatFingers.cpp:

(BlackBerry::WebKit::FatFingers::findBestPoint):

  • WebKitSupport/FatFingers.h:
  • WebKitSupport/TouchEventHandler.cpp:

(BlackBerry::WebKit::elementForTapHighlight):

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

Legend:

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

    r147552 r147687  
    22852285
    22862286    bool nodeAllowSelectionOverride = false;
    2287     if (Node* linkNode = node->enclosingLinkEventParentOrSelf()) {
     2287    Node* linkNode = node->enclosingLinkEventParentOrSelf();
     2288    if (node->isLink() || (node->isTextNode() && linkNode)) {
    22882289        KURL href;
    22892290        if (linkNode->isLink() && linkNode->hasAttributes()) {
  • trunk/Source/WebKit/blackberry/ChangeLog

    r147552 r147687  
     12013-04-04  Tiancheng Jiang  <tijiang@rim.com>
     2
     3        [BlackBerry] Adjust fatfinger result priority
     4        https://bugs.webkit.org/show_bug.cgi?id=113957
     5
     6        Reviewed by Rob Buis.
     7
     8        RIM PR 224781
     9        Internally Reviewed by Genevieve Mak.
     10
     11        Change fatfigner algorithm, return the clickable element rather than
     12        its parent anchor. Modify taphighlight and context menu node selection
     13        accordingly.
     14
     15        * Api/WebPage.cpp:
     16        (BlackBerry::WebKit::WebPagePrivate::webContext):
     17        * WebKitSupport/FatFingers.cpp:
     18        (BlackBerry::WebKit::FatFingers::findBestPoint):
     19        * WebKitSupport/FatFingers.h:
     20        * WebKitSupport/TouchEventHandler.cpp:
     21        (BlackBerry::WebKit::elementForTapHighlight):
     22
    1232013-04-03  Arvid Nilsson  <anilsson@rim.com>
    224
  • trunk/Source/WebKit/blackberry/WebKitSupport/FatFingers.cpp

    r146961 r147687  
    164164    // Lets set nodeUnderFatFinger to the result of a point based hit test here. If something
    165165    // targable is actually found by ::findIntersectingRegions, then we might replace what we just set below later on.
    166     Element* elementUnderPoint;
    167     Element* clickableElementUnderPoint;
    168     getRelevantInfoFromCachedHitTest(elementUnderPoint, clickableElementUnderPoint);
     166    const HitTestResult& hitResult = m_webPage->hitTestResult(m_contentPos);
     167    Node* node = hitResult.innerNode();
     168    while (node && !node->isElementNode())
     169        node = node->parentNode();
     170
     171    Element* elementUnderPoint = static_cast<Element*>(node);
    169172
    170173    if (elementUnderPoint) {
     
    173176        // If we are looking for a Clickable Element and we found one, we can quit early.
    174177        if (m_targetType == ClickableElement) {
    175             if (clickableElementUnderPoint) {
    176                 setSuccessfulFatFingersResult(result, clickableElementUnderPoint, m_contentPos /*adjustedPosition*/);
     178            if (isElementClickable(elementUnderPoint)) {
     179                setSuccessfulFatFingersResult(result, elementUnderPoint, m_contentPos /*adjustedPosition*/);
    177180                return result;
    178181            }
    179 
    180             if (isElementClickable(elementUnderPoint)) {
    181                 setSuccessfulFatFingersResult(result, elementUnderPoint, m_contentPos /*adjustedPosition*/);
     182            if (hitResult.URLElement()) {
     183                setSuccessfulFatFingersResult(result, hitResult.URLElement(), m_contentPos /*adjustedPosition*/);
    182184                return result;
    183185            }
     
    475477}
    476478
    477 void FatFingers::getRelevantInfoFromCachedHitTest(Element*& elementUnderPoint, Element*& clickableElementUnderPoint) const
    478 {
    479     elementUnderPoint = 0;
    480     clickableElementUnderPoint = 0;
    481 
    482     const HitTestResult& result = m_webPage->hitTestResult(m_contentPos);
    483     Node* node = result.innerNode();
    484     while (node && !node->isElementNode())
    485         node = node->parentNode();
    486 
    487     elementUnderPoint = toElement(node);
    488     clickableElementUnderPoint = result.URLElement();
    489 }
    490 
    491479void FatFingers::setSuccessfulFatFingersResult(FatFingersResult& result, Node* bestNode, const WebCore::IntPoint& adjustedPoint)
    492480{
  • trunk/Source/WebKit/blackberry/WebKitSupport/FatFingers.h

    r143783 r147687  
    9898    void getNodesFromRect(WebCore::Document*, const WebCore::IntPoint&, ListHashSet<RefPtr<WebCore::Node> >&);
    9999
    100     // It mimics Document::elementFromPoint, but recursively hit-tests in case an inner frame is found.
    101     void getRelevantInfoFromCachedHitTest(WebCore::Element*& elementUnderPoint, WebCore::Element*& clickableElementUnderPoint) const;
    102 
    103100    bool isElementClickable(WebCore::Element*) const;
    104101
  • trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp

    r145818 r147687  
    196196
    197197    bool isArea = elementUnderFatFinger->hasTagName(HTMLNames::areaTag);
    198     Node* linkNode = elementUnderFatFinger->enclosingLinkEventParentOrSelf();
     198    Node* linkNode = elementUnderFatFinger->isLink() ? elementUnderFatFinger : 0;
    199199    if (!linkNode || !linkNode->isHTMLElement() || (!linkNode->renderer() && !isArea))
    200200        return 0;
Note: See TracChangeset for help on using the changeset viewer.