Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 1957673002: Less duplicated code between nodeAtPoint() in LayoutBox and LayoutBlock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutBlock.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index d6f52fd0b0c271ec706d1afb9f2cfae2aa32b1f1..c1ca7b349a786a4a06a70ee3040e14aee94a76b5 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -1502,24 +1502,12 @@ Node* LayoutBlock::nodeForHitTest() const
return isAnonymousBlockContinuation() ? continuation()->node() : node();
}
-// TODO(pdr): This is too similar to LayoutBox::nodeAtPoint and should share
-// more code, or merge into LayoutBox::nodeAtPoint entirely.
bool LayoutBlock::nodeAtPoint(HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
{
LayoutPoint adjustedLocation(accumulatedOffset + location());
LayoutSize localOffset = toLayoutSize(adjustedLocation);
- if (!isLayoutView()) {
- // Check if we need to do anything at all.
- // If we have clipping, then we can't have any spillout.
- LayoutRect overflowBox = hasOverflowClip() ? borderBoxRect() : visualOverflowRect();
- flipForWritingMode(overflowBox);
- overflowBox.moveBy(adjustedLocation);
- if (!locationInContainer.intersects(overflowBox))
- return false;
- }
-
- if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground)
+ if (isInSelfHitTestingPhase(hitTestAction)
&& visibleToHitTestRequest(result.hitTestRequest())
&& isPointInOverflowControl(result, locationInContainer.point(), adjustedLocation)) {
updateHitTestResult(result, locationInContainer.point() - localOffset);
@@ -1527,27 +1515,7 @@ bool LayoutBlock::nodeAtPoint(HitTestResult& result, const HitTestLocation& loca
if (result.addNodeToListBasedTestResult(nodeForHitTest(), locationInContainer) == StopHitTesting)
return true;
}
-
- // TODO(pdr): We should also include checks for hit testing border radius at
- // the layer level (see: crbug.com/568904).
-
- if (hitTestChildren(result, locationInContainer, adjustedLocation, hitTestAction))
- return true;
-
- if (hitTestClippedOutByRoundedBorder(locationInContainer, adjustedLocation))
- return false;
-
- // Now hit test our background
- if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground) {
- LayoutRect boundsRect(adjustedLocation, size());
- if (visibleToHitTestRequest(result.hitTestRequest()) && locationInContainer.intersects(boundsRect)) {
- updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - localOffset));
- if (result.addNodeToListBasedTestResult(nodeForHitTest(), locationInContainer, boundsRect) == StopHitTesting)
- return true;
- }
- }
-
- return false;
+ return LayoutBox::nodeAtPoint(result, locationInContainer, accumulatedOffset, hitTestAction);
}
bool LayoutBlock::hitTestChildren(HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | third_party/WebKit/Source/core/layout/LayoutBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698