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

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

Issue 2194793006: Do not commit: Revert of r404081 and r402757 for perf testing purposes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 a1dcdcd8fffcd632b494b647bf4e8eb9477420cc..70a2bc553edd783dc572a7af7e93e5d0743fc4ec 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -768,7 +768,7 @@ LayoutSize LayoutBoxModelObject::stickyPositionOffset() const
return LayoutSize(scrollableArea->stickyConstraintsMap().get(layer()).computeStickyOffset(constrainingRect));
}
-LayoutPoint LayoutBoxModelObject::adjustedPositionRelativeTo(const LayoutPoint& startPoint, const Element* element) const
+LayoutPoint LayoutBoxModelObject::adjustedPositionRelativeToOffsetParent(const LayoutPoint& startPoint) const
{
// If the element is the HTML body element or doesn't have a parent
// return 0 and stop this algorithm.
@@ -778,8 +778,10 @@ LayoutPoint LayoutBoxModelObject::adjustedPositionRelativeTo(const 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.
+ // 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 (!element)
return referencePoint;
@@ -819,28 +821,28 @@ LayoutSize LayoutBoxModelObject::offsetForInFlowPosition() const
return LayoutSize();
}
-LayoutUnit LayoutBoxModelObject::offsetLeft(const Element* parent) const
+LayoutUnit LayoutBoxModelObject::offsetLeft() const
{
// Note that LayoutInline and LayoutBox override this to pass a different
- // startPoint to adjustedPositionRelativeTo.
- return adjustedPositionRelativeTo(LayoutPoint(), parent).x();
+ // startPoint to adjustedPositionRelativeToOffsetParent.
+ return adjustedPositionRelativeToOffsetParent(LayoutPoint()).x();
}
-LayoutUnit LayoutBoxModelObject::offsetTop(const Element* parent) const
+LayoutUnit LayoutBoxModelObject::offsetTop() const
{
// Note that LayoutInline and LayoutBox override this to pass a different
- // startPoint to adjustedPositionRelativeTo.
- return adjustedPositionRelativeTo(LayoutPoint(), parent).y();
+ // startPoint to adjustedPositionRelativeToOffsetParent.
+ return adjustedPositionRelativeToOffsetParent(LayoutPoint()).y();
}
-int LayoutBoxModelObject::pixelSnappedOffsetWidth(const Element* parent) const
+int LayoutBoxModelObject::pixelSnappedOffsetWidth() const
{
- return snapSizeToPixel(offsetWidth(), offsetLeft(parent));
+ return snapSizeToPixel(offsetWidth(), offsetLeft());
}
-int LayoutBoxModelObject::pixelSnappedOffsetHeight(const Element* parent) const
+int LayoutBoxModelObject::pixelSnappedOffsetHeight() const
{
- return snapSizeToPixel(offsetHeight(), offsetTop(parent));
+ return snapSizeToPixel(offsetHeight(), offsetTop());
}
LayoutUnit LayoutBoxModelObject::computedCSSPadding(const Length& padding) const
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutInline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698