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

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

Issue 2136323002: Properly calculate the localBounds for elements with overflow clipped (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review nit Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
diff --git a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
index a916ee53c465371f43ae62025c966efd3bf25d47..d16bbed3575f12d768200941106ed21011b8e089 100644
--- a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
+++ b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
@@ -79,14 +79,16 @@ static LayoutRect relativeBounds(const LayoutObject* layoutObject, const Scrolla
LayoutRect localBounds;
if (layoutObject->isBox()) {
localBounds = toLayoutBox(layoutObject)->borderBoxRect();
- // borderBoxRect doesn't include overflow content and floats.
- LayoutUnit maxHeight = std::max(localBounds.height(), toLayoutBox(layoutObject)->layoutOverflowRect().height());
- if (layoutObject->isLayoutBlockFlow() && toLayoutBlockFlow(layoutObject)->containsFloats()) {
- // Note that lowestFloatLogicalBottom doesn't include floating
- // grandchildren.
- maxHeight = std::max(maxHeight, toLayoutBlockFlow(layoutObject)->lowestFloatLogicalBottom());
+ if (!layoutObject->hasOverflowClip()) {
+ // borderBoxRect doesn't include overflow content and floats.
+ LayoutUnit maxHeight = std::max(localBounds.height(), toLayoutBox(layoutObject)->layoutOverflowRect().height());
+ if (layoutObject->isLayoutBlockFlow() && toLayoutBlockFlow(layoutObject)->containsFloats()) {
+ // Note that lowestFloatLogicalBottom doesn't include floating
+ // grandchildren.
+ maxHeight = std::max(maxHeight, toLayoutBlockFlow(layoutObject)->lowestFloatLogicalBottom());
+ }
+ localBounds.setHeight(maxHeight);
}
- localBounds.setHeight(maxHeight);
} else if (layoutObject->isText()) {
// TODO(skobes): Use first and last InlineTextBox only?
for (InlineTextBox* box = toLayoutText(layoutObject)->firstTextBox(); box; box = box->nextTextBox())
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698