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

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

Issue 2251443002: Correct offsetLeft and offsetTop calculation for column-span:all. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Need to keep the nullptr check, thanks to inline continuations. Created 4 years, 4 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 | « third_party/WebKit/LayoutTests/fast/multicol/span/offset-properties.html ('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/LayoutBoxModelObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
index 560fe89a6c92497460dba1fa88457f0acc0c4f74..a6f845941eaaee947c68515fe29fc3273ab92a03 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -777,7 +777,6 @@ LayoutPoint LayoutBoxModelObject::adjustedPositionRelativeTo(const LayoutPoint&
return LayoutPoint();
LayoutPoint referencePoint = startPoint;
- referencePoint.move(parent()->columnOffset(referencePoint));
// If the base element is null, return the distance between the canvas origin and
// the left border edge of the element and stop this algorithm.
@@ -785,25 +784,27 @@ LayoutPoint LayoutBoxModelObject::adjustedPositionRelativeTo(const LayoutPoint&
return referencePoint;
if (const LayoutBoxModelObject* offsetParent = element->layoutBoxModelObject()) {
- if (offsetParent->isBox() && !offsetParent->isBody())
- referencePoint.move(-toLayoutBox(offsetParent)->borderLeft(), -toLayoutBox(offsetParent)->borderTop());
- if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) {
+ if (!isOutOfFlowPositioned()) {
if (isInFlowPositioned())
referencePoint.move(offsetForInFlowPosition());
- LayoutObject* current;
- for (current = parent(); current != offsetParent && current->parent(); current = current->parent()) {
+ // Note that we may fail to find |offsetParent| while walking the container chain, if
+ // |offsetParent| is an inline split into continuations.
+ // <body style="display:inline;" id="offsetParent"><div></div><span id="this">
+ // This is why we have to do a nullptr check here.
+ // offset(Left|Top) is generally broken when offsetParent is inline.
+ for (const LayoutObject* current = container(); current && current != offsetParent; current = current->container()) {
// FIXME: What are we supposed to do inside SVG content?
- if (!isOutOfFlowPositioned()) {
- if (current->isBox() && !current->isTableRow())
- referencePoint.moveBy(toLayoutBox(current)->topLeftLocation());
- referencePoint.move(current->parent()->columnOffset(referencePoint));
- }
+ referencePoint.move(current->columnOffset(referencePoint));
+ if (current->isBox() && !current->isTableRow())
+ referencePoint.moveBy(toLayoutBox(current)->topLeftLocation());
}
if (offsetParent->isBox() && offsetParent->isBody() && !offsetParent->isPositioned())
referencePoint.moveBy(toLayoutBox(offsetParent)->topLeftLocation());
}
+ if (offsetParent->isBox() && !offsetParent->isBody())
+ referencePoint.move(-toLayoutBox(offsetParent)->borderLeft(), -toLayoutBox(offsetParent)->borderTop());
}
return referencePoint;
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/multicol/span/offset-properties.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698