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

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

Issue 2051703002: Implement closed shadow adjustment for Element.offsetParent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-revert the previous and check position:fixed in layout code. Created 4 years, 6 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/LayoutBoxModelObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
index b79d4d6bbb6958acc35faf9942a375174d0ed3c5..d21deb7083ce948b52ed4c1c716110006c4f8910 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -747,7 +747,7 @@ LayoutSize LayoutBoxModelObject::stickyPositionOffset() const
return LayoutSize(scrollableArea->stickyConstraintsMap().get(layer()).computeStickyOffset(constrainingRect));
}
-LayoutPoint LayoutBoxModelObject::adjustedPositionRelativeToOffsetParent(const LayoutPoint& startPoint) const
+LayoutPoint LayoutBoxModelObject::adjustedPositionRelativeTo(const LayoutPoint& startPoint, const Element* element) const
{
// If the element is the HTML body element or doesn't have a parent
// return 0 and stop this algorithm.
@@ -757,10 +757,8 @@ LayoutPoint LayoutBoxModelObject::adjustedPositionRelativeToOffsetParent(const L
LayoutPoint referencePoint = startPoint;
referencePoint.move(parent()->columnOffset(referencePoint));
- // If the offsetParent of the element is null, or is the HTML body element,
- // return the distance between the canvas origin and the left border edge
- // of the element and stop this algorithm.
- Element* element = offsetParent();
+ // 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.
if (!element)
return referencePoint;
@@ -800,28 +798,28 @@ LayoutSize LayoutBoxModelObject::offsetForInFlowPosition() const
return LayoutSize();
}
-LayoutUnit LayoutBoxModelObject::offsetLeft() const
+LayoutUnit LayoutBoxModelObject::offsetLeft(const Element* parent) const
{
// Note that LayoutInline and LayoutBox override this to pass a different
- // startPoint to adjustedPositionRelativeToOffsetParent.
- return adjustedPositionRelativeToOffsetParent(LayoutPoint()).x();
+ // startPoint to adjustedPositionRelativeTo.
+ return adjustedPositionRelativeTo(LayoutPoint(), parent).x();
}
-LayoutUnit LayoutBoxModelObject::offsetTop() const
+LayoutUnit LayoutBoxModelObject::offsetTop(const Element* parent) const
{
// Note that LayoutInline and LayoutBox override this to pass a different
- // startPoint to adjustedPositionRelativeToOffsetParent.
- return adjustedPositionRelativeToOffsetParent(LayoutPoint()).y();
+ // startPoint to adjustedPositionRelativeTo.
+ return adjustedPositionRelativeTo(LayoutPoint(), parent).y();
}
-int LayoutBoxModelObject::pixelSnappedOffsetWidth() const
+int LayoutBoxModelObject::pixelSnappedOffsetWidth(const Element* parent) const
{
- return snapSizeToPixel(offsetWidth(), offsetLeft());
+ return snapSizeToPixel(offsetWidth(), offsetLeft(parent));
}
-int LayoutBoxModelObject::pixelSnappedOffsetHeight() const
+int LayoutBoxModelObject::pixelSnappedOffsetHeight(const Element* parent) const
{
- return snapSizeToPixel(offsetHeight(), offsetTop());
+ return snapSizeToPixel(offsetHeight(), offsetTop(parent));
}
LayoutUnit LayoutBoxModelObject::computedCSSPadding(const Length& padding) const

Powered by Google App Engine
This is Rietveld 408576698