Changeset 140282 in webkit
- Timestamp:
- Jan 20, 2013 2:55:50 PM (11 years ago)
- Location:
- trunk/Source/WebKit/blackberry
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/blackberry/ChangeLog
r140191 r140282 1 2013-01-20 Tiancheng Jiang <tijiang@rim.com> 2 3 [BlackBerry] Improve Fatfinger phase. 4 https://bugs.webkit.org/show_bug.cgi?id=107403 5 6 Reviewed by Rob Buis. 7 8 RIM PR 219489 9 Internally reviewd by Mike Fenton & Gen Mak. 10 11 Treat ClickableByDefault and MadeClickableByTheWebpage elements as 12 same category. Avoid unnecessary nodes check step. 13 14 * WebKitSupport/FatFingers.cpp: 15 (BlackBerry::WebKit::FatFingers::isElementClickable): 16 (BlackBerry::WebKit::FatFingers::FatFingers): 17 (BlackBerry::WebKit::FatFingers::findBestPoint): 18 (BlackBerry::WebKit::FatFingers::getNodesFromRect): 19 * WebKitSupport/FatFingers.h: 20 1 21 2013-01-18 Andrew Lo <anlo@rim.com> 2 3 22 [BlackBerry] When acquiring/releasing backing store memory, allow web page client control suspend/resuming of backing store 4 23 https://bugs.webkit.org/show_bug.cgi?id=107307 -
trunk/Source/WebKit/blackberry/WebKitSupport/FatFingers.cpp
r137991 r140282 83 83 { 84 84 ASSERT(element); 85 ASSERT(m_matchingApproach != Done);86 85 ASSERT(m_targetType == ClickableElement); 87 86 88 switch (m_matchingApproach) { 89 case ClickableByDefault: { 90 ExceptionCode ec = 0; 91 return element->webkitMatchesSelector("a[href],*:link,*:visited,*[role=button],button,input,select,label[for],area[href],textarea,embed,object", ec) 92 || element->isMediaControlElement() 93 || element->isContentEditable(); 94 95 } 96 case MadeClickableByTheWebpage: 97 98 // Elements within a shadow DOM can not be 'made clickable by the webpage', since 99 // they are not accessible. 100 if (element->isInShadowTree()) 101 return false; 102 103 // FIXME: We fall back to checking for the presence of CSS style "cursor: pointer" to indicate whether the element A 104 // can be clicked when A neither registers mouse events handlers nor is a hyperlink or form control. This workaround 105 // ensures that we don't break various Google web apps, including <http://maps.google.com>. Ideally, we should walk 106 // up the DOM hierarchy to determine the first parent element that accepts mouse events. 107 // Consider the HTML snippet: <div id="A" onclick="..."><div id="B">Example</div></div> 108 // Notice, B is not a hyperlink, or form control, and does not register any mouse event handler. Then B cannot 109 // be clicked. Suppose B specified the CSS property "cursor: pointer". Then, B will be considered as clickable. 110 return hasMousePressListener(element) 111 || CSSComputedStyleDeclaration::create(element)->getPropertyValue(cssPropertyID("cursor")) == "pointer"; 112 default: 113 ASSERT_NOT_REACHED(); 114 } 115 116 return false; 87 ExceptionCode ec = 0; 88 89 if (element->webkitMatchesSelector("a[href],*:link,*:visited,*[role=button],button,input,select,label[for],area[href],textarea,embed,object", ec) 90 || element->isMediaControlElement() 91 || element->isContentEditable()) 92 return true; 93 94 if (element->isInShadowTree()) 95 return false; 96 97 return hasMousePressListener(element) 98 || CSSComputedStyleDeclaration::create(element)->getPropertyValue(cssPropertyID("cursor")) == "pointer"; 117 99 } 118 100 … … 151 133 , m_contentPos(contentPos) 152 134 , m_targetType(targetType) 153 , m_matchingApproach(Done)154 135 { 155 136 ASSERT(webPage); … … 174 155 175 156 FatFingersResult result(m_contentPos); 176 m_matchingApproach = ClickableByDefault;177 157 178 158 // Lets set nodeUnderFatFinger to the result of a point based hit test here. If something … … 209 189 210 190 bool foundOne = findIntersectingRegions(m_webPage->m_mainFrame->document(), intersectingRegions, remainingFingerRegion); 211 if (!foundOne) { 212 m_matchingApproach = MadeClickableByTheWebpage; 213 remainingFingerRegion = IntRectRegion(fingerRectForPoint(m_contentPos)); 214 foundOne = findIntersectingRegions(m_webPage->m_mainFrame->document(), intersectingRegions, remainingFingerRegion); 215 } 216 217 m_matchingApproach = Done; 191 218 192 m_cachedRectHitTestResults.clear(); 219 193 … … 465 439 } 466 440 467 FatFingers::CachedResultsStrategy FatFingers::cachingStrategy() const468 {469 switch (m_matchingApproach) {470 case ClickableByDefault:471 return GetFromRenderTree;472 case MadeClickableByTheWebpage:473 return GetFromCache;474 case Done:475 default:476 ASSERT_NOT_REACHED();477 return GetFromRenderTree;478 }479 }480 481 441 void FatFingers::getNodesFromRect(Document* document, const IntPoint& contentPos, ListHashSet<RefPtr<Node> >& intersectedNodes) 482 442 { 483 FatFingers::CachedResultsStrategy cacheResolvingStrategy = cachingStrategy();484 485 if (cacheResolvingStrategy == GetFromCache) {486 ASSERT(m_cachedRectHitTestResults.contains(document));487 intersectedNodes = m_cachedRectHitTestResults.get(document);488 return;489 }490 491 ASSERT(cacheResolvingStrategy == GetFromRenderTree);492 493 443 unsigned topPadding, rightPadding, bottomPadding, leftPadding; 494 444 getPaddings(topPadding, rightPadding, bottomPadding, leftPadding); -
trunk/Source/WebKit/blackberry/WebKitSupport/FatFingers.h
r133902 r140282 74 74 75 75 enum CachedResultsStrategy { GetFromRenderTree = 0, GetFromCache }; 76 CachedResultsStrategy cachingStrategy() const;77 76 typedef HashMap<RefPtr<WebCore::Document>, ListHashSet<RefPtr<WebCore::Node> > > CachedRectHitTestResults; 78 77 … … 110 109 WebCore::IntPoint m_contentPos; 111 110 TargetType m_targetType; 112 MatchingApproachForClickable m_matchingApproach;113 111 CachedRectHitTestResults m_cachedRectHitTestResults; 114 112 };
Note: See TracChangeset
for help on using the changeset viewer.