Changeset 92993 in webkit
- Timestamp:
- Aug 12, 2011 2:02:19 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r92990 r92993 1 2011-08-12 David Hyatt <hyatt@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=66133 4 5 Make hit testing work on RenderRegions. Pass off the hit testing to the RenderFlowThread 6 layer tree (just as we did with painting). 7 8 Reviewed by Sam Weinig. 9 10 Added hit-test-float.html to demonstrate basic hit testing of content flowed into regions. 11 12 * fast/regions/hit-test-float-expected.txt: Added. 13 * fast/regions/hit-test-float.html: Added. 14 1 15 2011-08-12 Ryosuke Niwa <rniwa@webkit.org> 2 16 -
trunk/Source/WebCore/ChangeLog
r92992 r92993 1 2011-08-12 David Hyatt <hyatt@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=66133 4 5 Make hit testing work on RenderRegions. Pass off the hit testing to the RenderFlowThread 6 layer tree (just as we did with painting). 7 8 Reviewed by Sam Weinig. 9 10 Added hit-test-float.html to demonstrate basic hit testing of content flowed into regions. 11 12 * rendering/HitTestRequest.h: 13 (WebCore::HitTestRequest::type): 14 * rendering/RenderFlowThread.cpp: 15 (WebCore::RenderFlowThread::hitTestRegion): 16 * rendering/RenderFlowThread.h: 17 * rendering/RenderRegion.cpp: 18 (WebCore::RenderRegion::paintReplaced): 19 (WebCore::RenderRegion::nodeAtPoint): 20 * rendering/RenderRegion.h: 21 1 22 2011-08-12 Levi Weintraub <leviw@chromium.org> 2 23 -
trunk/Source/WebCore/rendering/HitTestRequest.h
r63888 r92993 50 50 bool svgClipContent() const { return m_requestType & SVGClipContent; } 51 51 52 HitTestRequestType type() const { return m_requestType; } 53 52 54 private: 53 55 HitTestRequestType m_requestType; -
trunk/Source/WebCore/rendering/RenderFlowThread.cpp
r92981 r92993 31 31 32 32 #include "RenderFlowThread.h" 33 #include "HitTestRequest.h" 34 #include "HitTestResult.h" 33 35 #include "Node.h" 34 36 #include "PaintInfo.h" … … 264 266 } 265 267 268 bool RenderFlowThread::hitTestRegion(const LayoutRect& regionRect, const HitTestRequest& request, HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset) 269 { 270 LayoutRect regionClippingRect(accumulatedOffset, regionRect.size()); 271 if (!regionClippingRect.contains(pointInContainer)) 272 return false; 273 274 LayoutPoint renderFlowThreadOffset; 275 if (style()->isFlippedBlocksWritingMode()) { 276 LayoutRect flippedRegionRect(regionRect); 277 flipForWritingMode(flippedRegionRect); 278 renderFlowThreadOffset = LayoutPoint(regionClippingRect.location() - flippedRegionRect.location()); 279 } else 280 renderFlowThreadOffset = LayoutPoint(regionClippingRect.location() - regionRect.location()); 281 282 LayoutPoint transformedPoint(pointInContainer.x() - renderFlowThreadOffset.x(), pointInContainer.y() - renderFlowThreadOffset.y()); 283 284 // Always ignore clipping, since the RenderFlowThread has nothing to do with the bounds of the FrameView. 285 HitTestRequest newRequest(request.type() & HitTestRequest::IgnoreClipping); 286 287 LayoutPoint oldPoint = result.point(); 288 result.setPoint(transformedPoint); 289 bool isPointInsideFlowThread = layer()->hitTest(newRequest, result); 290 result.setPoint(oldPoint); 291 292 // FIXME: Should we set result.m_localPoint back to the RenderRegion's coordinate space or leave it in the RenderFlowThread's coordinate 293 // space? Right now it's staying in the RenderFlowThread's coordinate space, which may end up being ok. We will know more when we get around to 294 // patching positionForPoint. 295 return isPointInsideFlowThread; 296 } 297 266 298 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderFlowThread.h
r92969 r92993 78 78 void computeLogicalHeight(); 79 79 80 void paintIntoRegion(PaintInfo&, const LayoutRect&, const LayoutPoint&); 80 void paintIntoRegion(PaintInfo&, const LayoutRect& regionRect, const LayoutPoint& paintOffset); 81 bool hitTestRegion(const LayoutRect& regionRect, const HitTestRequest&, HitTestResult&, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset); 81 82 82 83 bool hasRegions() const { return m_regionList.size(); } -
trunk/Source/WebCore/rendering/RenderRegion.cpp
r92981 r92993 32 32 33 33 #include "GraphicsContext.h" 34 #include "HitTestResult.h" 34 35 #include "IntRect.h" 35 36 #include "PaintInfo.h" … … 55 56 { 56 57 // Delegate painting of content in region to RenderFlowThread. 58 if (!m_flowThread) 59 return; 57 60 m_flowThread->paintIntoRegion(paintInfo, regionRect(), LayoutPoint(paintOffset.x() + borderLeft() + paddingLeft(), paintOffset.y() + borderTop() + paddingTop())); 61 } 62 63 // Hit Testing 64 bool RenderRegion::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action) 65 { 66 LayoutPoint adjustedLocation = accumulatedOffset + location(); 67 68 // Check our bounds next. For this purpose always assume that we can only be hit in the 69 // foreground phase (which is true for replaced elements like images). 70 LayoutRect boundsRect(adjustedLocation, size()); 71 if (visibleToHitTesting() && action == HitTestForeground && boundsRect.intersects(result.rectForPoint(pointInContainer))) { 72 // Check the contents of the RenderFlowThread. 73 if (m_flowThread && m_flowThread->hitTestRegion(regionRect(), request, result, pointInContainer, LayoutPoint(adjustedLocation.x() + borderLeft() + paddingLeft(), adjustedLocation.y() + borderTop() + paddingTop()))) 74 return true; 75 updateHitTestResult(result, pointInContainer - toLayoutSize(adjustedLocation)); 76 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, boundsRect)) 77 return true; 78 } 79 80 return false; 58 81 } 59 82 -
trunk/Source/WebCore/rendering/RenderRegion.h
r92981 r92993 45 45 46 46 virtual void paintReplaced(PaintInfo&, const LayoutPoint&); 47 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction); 47 48 48 49 void setRegionRect(const IntRect& rect) { m_regionRect = rect; }
Note: See TracChangeset
for help on using the changeset viewer.