Changeset 127421 in webkit
- Timestamp:
- Sep 3, 2012 7:41:42 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r127418 r127421 1 2012-09-03 Allan Sandfeld Jensen <allan.jensen@nokia.com> 2 3 Move AllowShadowContent flag to HitTestRequest 4 https://bugs.webkit.org/show_bug.cgi?id=95685 5 6 Reviewed by Antonio Gomes. 7 8 Moves the flag and updates the interface for HitTestResult::addNodeToRectBasedTestResult so that 9 it can read the flag from HitTestRequest instead of from HitTestResult. 10 11 No change in functionality. No new tests. 12 13 * dom/Document.cpp: 14 (WebCore::Document::nodesFromRect): 15 * page/EventHandler.cpp: 16 (WebCore::EventHandler::hitTestResultAtPoint): 17 * rendering/HitTestRequest.h: 18 * rendering/HitTestResult.cpp: 19 (WebCore::HitTestLocation::HitTestLocation): 20 (WebCore::HitTestResult::HitTestResult): 21 (WebCore::HitTestResult::operator=): 22 (WebCore::HitTestResult::addNodeToRectBasedTestResult): 23 * rendering/HitTestResult.h: 24 (HitTestLocation): 25 (HitTestResult): 26 * rendering/InlineFlowBox.cpp: 27 (WebCore::InlineFlowBox::nodeAtPoint): 28 * rendering/InlineTextBox.cpp: 29 (WebCore::InlineTextBox::nodeAtPoint): 30 * rendering/RenderBlock.cpp: 31 (WebCore::RenderBlock::nodeAtPoint): 32 * rendering/RenderBox.cpp: 33 (WebCore::RenderBox::nodeAtPoint): 34 * rendering/RenderImage.cpp: 35 (WebCore::RenderImage::nodeAtPoint): 36 * rendering/RenderLayer.cpp: 37 (WebCore::RenderLayer::hitTestLayer): 38 (WebCore::RenderLayer::hitTestList): 39 * rendering/RenderMultiColumnSet.cpp: 40 (WebCore::RenderMultiColumnSet::nodeAtPoint): 41 * rendering/RenderRegion.cpp: 42 (WebCore::RenderRegion::nodeAtPoint): 43 * rendering/RenderTable.cpp: 44 (WebCore::RenderTable::nodeAtPoint): 45 * rendering/svg/RenderSVGRoot.cpp: 46 (WebCore::RenderSVGRoot::nodeAtPoint): 47 * rendering/svg/SVGInlineTextBox.cpp: 48 (WebCore::SVGInlineTextBox::nodeAtPoint): 49 1 50 2012-09-03 Alexander Pavlov <apavlov@chromium.org> 2 51 -
trunk/Source/WebCore/dom/Document.cpp
r127228 r127421 1407 1407 else if (!frameView->visibleContentRect().intersects(HitTestResult::rectForPoint(point, topPadding, rightPadding, bottomPadding, leftPadding))) 1408 1408 return 0; 1409 if (allowShadowContent) 1410 type |= HitTestRequest::AllowShadowContent; 1409 1411 1410 1412 HitTestRequest request(type); … … 1417 1419 } 1418 1420 1419 enum ShadowContentFilterPolicy shadowContentFilterPolicy = allowShadowContent ? AllowShadowContent : DoNotAllowShadowContent; 1420 HitTestResult result(point, topPadding, rightPadding, bottomPadding, leftPadding, shadowContentFilterPolicy); 1421 HitTestResult result(point, topPadding, rightPadding, bottomPadding, leftPadding); 1421 1422 renderView()->hitTest(request, result); 1422 1423 -
trunk/Source/WebCore/page/EventHandler.cpp
r126926 r127421 1042 1042 HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, HitTestRequest::HitTestRequestType hitType, const LayoutSize& padding) 1043 1043 { 1044 enum ShadowContentFilterPolicy shadowContentFilterPolicy = allowShadowContent ? AllowShadowContent : DoNotAllowShadowContent; 1045 HitTestResult result(point, padding.height(), padding.width(), padding.height(), padding.width(), shadowContentFilterPolicy); 1044 HitTestResult result(point, padding.height(), padding.width(), padding.height(), padding.width()); 1046 1045 1047 1046 if (!m_frame->contentRenderer()) … … 1049 1048 if (ignoreClipping) 1050 1049 hitType |= HitTestRequest::IgnoreClipping; 1050 if (allowShadowContent) 1051 hitType |= HitTestRequest::AllowShadowContent; 1051 1052 m_frame->contentRenderer()->hitTest(HitTestRequest(hitType), result); 1052 1053 … … 1065 1066 LayoutPoint widgetPoint(result.localPoint().x() + view->scrollX() - renderWidget->borderLeft() - renderWidget->paddingLeft(), 1066 1067 result.localPoint().y() + view->scrollY() - renderWidget->borderTop() - renderWidget->paddingTop()); 1067 HitTestResult widgetHitTestResult(widgetPoint, padding.height(), padding.width(), padding.height(), padding.width() , shadowContentFilterPolicy);1068 HitTestResult widgetHitTestResult(widgetPoint, padding.height(), padding.width(), padding.height(), padding.width()); 1068 1069 frame->contentRenderer()->hitTest(HitTestRequest(hitType), widgetHitTestResult); 1069 1070 result = widgetHitTestResult; -
trunk/Source/WebCore/rendering/HitTestRequest.h
r106554 r127421 35 35 IgnoreClipping = 1 << 5, 36 36 SVGClipContent = 1 << 6, 37 TouchEvent = 1 << 7 37 TouchEvent = 1 << 7, 38 AllowShadowContent = 1 << 8 38 39 }; 39 40 … … 53 54 bool touchEvent() const { return m_requestType & TouchEvent; } 54 55 bool mouseEvent() const { return !touchEvent(); } 56 bool allowsShadowContent() const { return m_requestType & AllowShadowContent; } 55 57 56 58 // Convenience functions -
trunk/Source/WebCore/rendering/HitTestResult.cpp
r126859 r127421 105 105 , m_transformedPoint(other.m_transformedPoint) 106 106 , m_transformedRect(other.m_transformedRect) 107 , m_region(region)108 107 , m_isRectBased(other.m_isRectBased) 109 108 , m_isRectilinear(other.m_isRectilinear) … … 195 194 HitTestResult::HitTestResult() : HitTestLocation() 196 195 , m_isOverWidget(false) 197 , m_shadowContentFilterPolicy(DoNotAllowShadowContent)198 196 { 199 197 } … … 201 199 HitTestResult::HitTestResult(const LayoutPoint& point) : HitTestLocation(point) 202 200 , m_isOverWidget(false) 203 , m_shadowContentFilterPolicy(DoNotAllowShadowContent) 204 { 205 } 206 207 HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, ShadowContentFilterPolicy allowShadowContent) 201 { 202 } 203 204 HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding) 208 205 : HitTestLocation(centerPoint, topPadding, rightPadding, bottomPadding, leftPadding) 209 206 , m_isOverWidget(false) 210 , m_shadowContentFilterPolicy(allowShadowContent) 211 { 212 } 213 214 HitTestResult::HitTestResult(const HitTestLocation& other, ShadowContentFilterPolicy allowShadowContent) 207 { 208 } 209 210 HitTestResult::HitTestResult(const HitTestLocation& other) 215 211 : HitTestLocation(other) 216 212 , m_isOverWidget(false) 217 , m_shadowContentFilterPolicy(allowShadowContent)218 213 { 219 214 } … … 227 222 , m_scrollbar(other.scrollbar()) 228 223 , m_isOverWidget(other.isOverWidget()) 229 , m_shadowContentFilterPolicy(other.shadowContentFilterPolicy())230 224 { 231 225 // Only copy the NodeSet in case of rect hit test. … … 249 243 // Only copy the NodeSet in case of rect hit test. 250 244 m_rectBasedTestResult = adoptPtr(other.m_rectBasedTestResult ? new NodeSet(*other.m_rectBasedTestResult) : 0); 251 m_shadowContentFilterPolicy = other.shadowContentFilterPolicy();252 245 253 246 return *this; … … 675 668 } 676 669 677 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const HitTest Location& locationInContainer, const LayoutRect& rect)670 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const HitTestRequest& request, const HitTestLocation& locationInContainer, const LayoutRect& rect) 678 671 { 679 672 // If it is not a rect-based hit test, this method has to be no-op. … … 686 679 return true; 687 680 688 if ( m_shadowContentFilterPolicy == DoNotAllowShadowContent)681 if (!request.allowsShadowContent()) 689 682 node = node->shadowAncestorNode(); 690 683 … … 710 703 } 711 704 712 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const HitTest Location& locationInContainer, const FloatRect& rect)705 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const HitTestRequest& request, const HitTestLocation& locationInContainer, const FloatRect& rect) 713 706 { 714 707 // If it is not a rect-based hit test, this method has to be no-op. … … 721 714 return true; 722 715 723 if ( m_shadowContentFilterPolicy == DoNotAllowShadowContent)716 if (!request.allowsShadowContent()) 724 717 node = node->shadowAncestorNode(); 725 718 -
trunk/Source/WebCore/rendering/HitTestResult.h
r126859 r127421 45 45 class RenderRegion; 46 46 class Scrollbar; 47 48 enum ShadowContentFilterPolicy { DoNotAllowShadowContent, AllowShadowContent };49 47 50 48 class HitTestLocation { … … 110 108 HitTestResult(const LayoutPoint&); 111 109 // Pass non-negative padding values to perform a rect-based hit test. 112 HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding , ShadowContentFilterPolicy);113 HitTestResult(const HitTestLocation& , ShadowContentFilterPolicy);110 HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding); 111 HitTestResult(const HitTestLocation&); 114 112 HitTestResult(const HitTestResult&); 115 113 ~HitTestResult(); … … 126 124 127 125 const HitTestLocation& hitTestLocation() const { return *this; } 128 ShadowContentFilterPolicy shadowContentFilterPolicy() const { return m_shadowContentFilterPolicy; }129 126 130 127 void setInnerNode(Node*); … … 167 164 // Returns true if it is rect-based hit test and needs to continue until the rect is fully 168 165 // enclosed by the boundaries of a node. 169 bool addNodeToRectBasedTestResult(Node*, const HitTest Location& locationInContainer, const LayoutRect& = LayoutRect());170 bool addNodeToRectBasedTestResult(Node*, const HitTest Location& locationInContainer, const FloatRect&);166 bool addNodeToRectBasedTestResult(Node*, const HitTestRequest&, const HitTestLocation& pointInContainer, const LayoutRect& = LayoutRect()); 167 bool addNodeToRectBasedTestResult(Node*, const HitTestRequest&, const HitTestLocation& pointInContainer, const FloatRect&); 171 168 void append(const HitTestResult&); 172 169 … … 195 192 bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a RenderWidget for example). 196 193 197 ShadowContentFilterPolicy m_shadowContentFilterPolicy;198 199 194 mutable OwnPtr<NodeSet> m_rectBasedTestResult; 200 195 }; -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r127300 r127421 1014 1014 if (visibleToHitTesting() && locationInContainer.intersects(rect)) { 1015 1015 renderer()->updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(accumulatedOffset))); // Don't add in m_x or m_y here, we want coords in the containing block's space. 1016 if (!result.addNodeToRectBasedTestResult(renderer()->node(), locationInContainer, rect))1016 if (!result.addNodeToRectBasedTestResult(renderer()->node(), request, locationInContainer, rect)) 1017 1017 return true; 1018 1018 } -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r126859 r127421 350 350 } 351 351 352 bool InlineTextBox::nodeAtPoint(const HitTestRequest& , HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)352 bool InlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/) 353 353 { 354 354 if (isLineBreak()) … … 360 360 if (m_truncation != cFullTruncation && visibleToHitTesting() && locationInContainer.intersects(rect)) { 361 361 renderer()->updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(accumulatedOffset))); 362 if (!result.addNodeToRectBasedTestResult(renderer()->node(), locationInContainer, rect))362 if (!result.addNodeToRectBasedTestResult(renderer()->node(), request, locationInContainer, rect)) 363 363 return true; 364 364 } -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r127346 r127421 4705 4705 updateHitTestResult(result, locationInContainer.point() - localOffset); 4706 4706 // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet. 4707 if (!result.addNodeToRectBasedTestResult(node(), locationInContainer))4707 if (!result.addNodeToRectBasedTestResult(node(), request, locationInContainer)) 4708 4708 return true; 4709 4709 } … … 4738 4738 if (visibleToHitTesting() && locationInContainer.intersects(boundsRect)) { 4739 4739 updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - localOffset)); 4740 if (!result.addNodeToRectBasedTestResult(node(), locationInContainer, boundsRect))4740 if (!result.addNodeToRectBasedTestResult(node(), request, locationInContainer, boundsRect)) 4741 4741 return true; 4742 4742 } -
trunk/Source/WebCore/rendering/RenderBox.cpp
r127346 r127421 757 757 if (visibleToHitTesting() && action == HitTestForeground && locationInContainer.intersects(boundsRect)) { 758 758 updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation)); 759 if (!result.addNodeToRectBasedTestResult(node(), locationInContainer, boundsRect))759 if (!result.addNodeToRectBasedTestResult(node(), request, locationInContainer, boundsRect)) 760 760 return true; 761 761 } -
trunk/Source/WebCore/rendering/RenderImage.cpp
r126859 r127421 502 502 bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) 503 503 { 504 HitTestResult tempResult(result.hitTestLocation() , result.shadowContentFilterPolicy());504 HitTestResult tempResult(result.hitTestLocation()); 505 505 bool inside = RenderReplaced::nodeAtPoint(request, tempResult, locationInContainer, accumulatedOffset, hitTestAction); 506 506 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r127162 r127421 3698 3698 if (fgRect.intersects(hitTestLocation) && isSelfPaintingLayer()) { 3699 3699 // Hit test with a temporary HitTestResult, because we only want to commit to 'result' if we know we're frontmost. 3700 HitTestResult tempResult(result.hitTestLocation() , result.shadowContentFilterPolicy());3700 HitTestResult tempResult(result.hitTestLocation()); 3701 3701 if (hitTestContents(request, tempResult, layerBounds, hitTestLocation, HitTestDescendants) 3702 3702 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) { … … 3727 3727 3728 3728 if (bgRect.intersects(hitTestLocation) && isSelfPaintingLayer()) { 3729 HitTestResult tempResult(result.hitTestLocation() , result.shadowContentFilterPolicy());3729 HitTestResult tempResult(result.hitTestLocation()); 3730 3730 if (hitTestContents(request, tempResult, layerBounds, hitTestLocation, HitTestSelf) 3731 3731 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) { … … 3784 3784 RenderLayer* childLayer = list->at(i); 3785 3785 RenderLayer* hitLayer = 0; 3786 HitTestResult tempResult(result.hitTestLocation() , result.shadowContentFilterPolicy());3786 HitTestResult tempResult(result.hitTestLocation()); 3787 3787 if (childLayer->isPaginated()) 3788 3788 hitLayer = hitTestPaginatedChildLayer(childLayer, rootLayer, request, tempResult, hitTestRect, hitTestLocation, transformState, zOffsetForDescendants); -
trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp
r127297 r127421 319 319 320 320 updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation)); 321 return !result.addNodeToRectBasedTestResult(node(), locationInContainer, boundsRect);321 return !result.addNodeToRectBasedTestResult(node(), request, locationInContainer, boundsRect); 322 322 } 323 323 -
trunk/Source/WebCore/rendering/RenderRegion.cpp
r127280 r127421 151 151 return true; 152 152 updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation)); 153 if (!result.addNodeToRectBasedTestResult(generatingNode(), locationInContainer, boundsRect))153 if (!result.addNodeToRectBasedTestResult(generatingNode(), request, locationInContainer, boundsRect)) 154 154 return true; 155 155 } -
trunk/Source/WebCore/rendering/RenderTable.cpp
r127157 r127421 1293 1293 if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && locationInContainer.intersects(boundsRect)) { 1294 1294 updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(adjustedLocation))); 1295 if (!result.addNodeToRectBasedTestResult(node(), locationInContainer, boundsRect))1295 if (!result.addNodeToRectBasedTestResult(node(), request, locationInContainer, boundsRect)) 1296 1296 return true; 1297 1297 } -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp
r126859 r127421 430 430 if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) { 431 431 updateHitTestResult(result, pointInBorderBox); 432 if (!result.addNodeToRectBasedTestResult(child->node(), locationInContainer))432 if (!result.addNodeToRectBasedTestResult(child->node(), request, locationInContainer)) 433 433 return true; 434 434 } … … 445 445 if (locationInContainer.intersects(boundsRect)) { 446 446 updateHitTestResult(result, pointInBorderBox); 447 if (!result.addNodeToRectBasedTestResult(node(), locationInContainer, boundsRect))447 if (!result.addNodeToRectBasedTestResult(node(), request, locationInContainer, boundsRect)) 448 448 return true; 449 449 } -
trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
r126859 r127421 717 717 if (locationInContainer.intersects(rect)) { 718 718 renderer()->updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset)); 719 if (!result.addNodeToRectBasedTestResult(renderer()->node(), locationInContainer, rect))719 if (!result.addNodeToRectBasedTestResult(renderer()->node(), request, locationInContainer, rect)) 720 720 return true; 721 721 }
Note: See TracChangeset
for help on using the changeset viewer.