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

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

Issue 1513663002: Include inner border radius in block hit testing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Create hittesting directory for tests Created 5 years 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
« no previous file with comments | « third_party/WebKit/LayoutTests/hittesting/inner-border-radius-hittest-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a8549bb3aa19b506cf30c52c6aaba2d973ba4521..a1e1e396a0a688ec1b942d21d6eff193c8a2119e 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -1677,21 +1677,24 @@ bool LayoutBlock::nodeAtPoint(HitTestResult& result, const HitTestLocation& loca
}
}
- // If we have clipping, then we can't have any spillout.
- bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer();
- bool useClip = (hasControlClip() || useOverflowClip);
- bool checkChildren = !useClip;
- if (!checkChildren) {
- if (hasControlClip()) {
- checkChildren = locationInContainer.intersects(controlClipRect(adjustedLocation));
+ bool checkChildren = true;
+
+ // Self painting layers will handle overflow clip in most cases, but without one we need to
+ // check if overflip clip will affect child hit testing.
+ if (hasOverflowClip() && !hasSelfPaintingLayer()) {
+ if (style()->hasBorderRadius()) {
+ LayoutRect borderRect = borderBoxRect();
+ borderRect.moveBy(adjustedLocation);
+ checkChildren = locationInContainer.intersects(style()->getRoundedInnerBorderFor(borderRect));
} else {
- LayoutRect clipRect = overflowClipRect(adjustedLocation, IncludeOverlayScrollbarSize);
- if (style()->hasBorderRadius())
- checkChildren = locationInContainer.intersects(style()->getRoundedBorderFor(clipRect));
- else
- checkChildren = locationInContainer.intersects(clipRect);
+ checkChildren = locationInContainer.intersects(overflowClipRect(adjustedLocation, IncludeOverlayScrollbarSize));
}
}
+
+ // A control clip can also clip out child hit testing.
+ if (checkChildren && hasControlClip())
+ checkChildren = locationInContainer.intersects(controlClipRect(adjustedLocation));
+
if (checkChildren) {
// Hit test descendants first.
LayoutSize scrolledOffset(localOffset);
@@ -1711,8 +1714,7 @@ bool LayoutBlock::nodeAtPoint(HitTestResult& result, const HitTestLocation& loca
if (style()->hasBorderRadius()) {
LayoutRect borderRect = borderBoxRect();
borderRect.moveBy(adjustedLocation);
- FloatRoundedRect border = style()->getRoundedBorderFor(borderRect);
- if (!locationInContainer.intersects(border))
+ if (!locationInContainer.intersects(style()->getRoundedBorderFor(borderRect)))
return false;
}
« no previous file with comments | « third_party/WebKit/LayoutTests/hittesting/inner-border-radius-hittest-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698