[CSSRegions] Improve hit testing for empty regions https://bugs.webkit.org/show_bug.cgi?id=115534 Reviewed by David Hyatt. As a better follow up after WebKit bug https://bugs.webkit.org/show_bug.cgi?id=107752, we can improve the code by not doing hit testing on the render flow thread object when we are trying to hit test the render flow thread background. In this case, we should just bail out. No new tests, covered by existing regions tests. * rendering/RenderFlowThread.cpp: (WebCore::RenderFlowThread::nodeAtPoint): (WebCore): (WebCore::RenderFlowThread::hitTestFlowThreadPortionInRegion): * rendering/RenderFlowThread.h: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150078 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index f1fa5b5..9eb2664 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,21 @@ +2013-05-14 Mihnea Ovidenie <mihnea@adobe.com> + + [CSSRegions] Improve hit testing for empty regions + https://bugs.webkit.org/show_bug.cgi?id=115534 + + Reviewed by David Hyatt. + + As a better follow up after WebKit bug https://bugs.webkit.org/show_bug.cgi?id=107752, + we can improve the code by not doing hit testing on the render flow thread object when + we are trying to hit test the render flow thread background. In this case, we should just bail out. + No new tests, covered by existing regions tests. + + * rendering/RenderFlowThread.cpp: + (WebCore::RenderFlowThread::nodeAtPoint): + (WebCore): + (WebCore::RenderFlowThread::hitTestFlowThreadPortionInRegion): + * rendering/RenderFlowThread.h: + 2013-05-14 Carlos Garcia Campos <cgarcia@igalia.com> [BlackBerry] Handle network errors when starting a new job
diff --git a/Source/WebCore/rendering/RenderFlowThread.cpp b/Source/WebCore/rendering/RenderFlowThread.cpp index b7abd01..c6c067b 100644 --- a/Source/WebCore/rendering/RenderFlowThread.cpp +++ b/Source/WebCore/rendering/RenderFlowThread.cpp
@@ -308,6 +308,13 @@ } } +bool RenderFlowThread::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) +{ + if (hitTestAction == HitTestBlockBackground) + return false; + return RenderBlock::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, hitTestAction); +} + bool RenderFlowThread::hitTestFlowThreadPortionInRegion(RenderRegion* region, LayoutRect flowThreadPortionRect, LayoutRect flowThreadPortionOverflowRect, const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset) const { LayoutRect regionClippingRect = computeRegionClippingRect(accumulatedOffset, flowThreadPortionRect, flowThreadPortionOverflowRect); @@ -324,17 +331,11 @@ // Always ignore clipping, since the RenderFlowThread has nothing to do with the bounds of the FrameView. HitTestRequest newRequest(request.type() | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent); - HitTestResult tempResult(result); // Make a new temporary HitTestLocation in the new region. HitTestLocation newHitTestLocation(locationInContainer, -renderFlowThreadOffset, region); - bool isPointInsideFlowThread = layer()->hitTest(newRequest, newHitTestLocation, tempResult); - - // We want to make sure we hit a node from the content inside the flow thread. - isPointInsideFlowThread = isPointInsideFlowThread && !tempResult.innerNode()->isDocumentNode(); - if (isPointInsideFlowThread) - result = tempResult; + bool isPointInsideFlowThread = layer()->hitTest(newRequest, newHitTestLocation, result); // FIXME: Should we set result.m_localPoint back to the RenderRegion's coordinate space or leave it in the RenderFlowThread's coordinate // 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
diff --git a/Source/WebCore/rendering/RenderFlowThread.h b/Source/WebCore/rendering/RenderFlowThread.h index be9474f..8de87d6 100644 --- a/Source/WebCore/rendering/RenderFlowThread.h +++ b/Source/WebCore/rendering/RenderFlowThread.h
@@ -79,6 +79,7 @@ void paintFlowThreadPortionInRegion(PaintInfo&, RenderRegion*, LayoutRect flowThreadPortionRect, LayoutRect flowThreadPortionOverflowRect, const LayoutPoint&) const; bool hitTestFlowThreadPortionInRegion(RenderRegion*, LayoutRect flowThreadPortionRect, LayoutRect flowThreadPortionOverflowRect, const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset) const; + virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE; bool hasRegions() const { return m_regionList.size(); } // Check if the content is flown into at least a region with region styling rules.