Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rename offsetTopLeft in RenderBoxModelObject to something better
https://bugs.webkit.org/show_bug.cgi?id=85915

Patch by Shezan Baig <shezbaig.wk@gmail.com> on 2012-05-30
Reviewed by Darin Adler.

Renamed offsetTopLeft in RenderBoxModelObject to
adjustedPositionRelativeToOffsetParent, because it returns the given
startPoint after adjusting it to be relative to the top-left corner of
the offsetParent.  The definition of offsetParent itself is non-trivial
and is documented within the body of RenderObject::offsetParent,
therefore I decided to reuse this term, as-is, in the name of this
function.

No new tests; no functional or visible changes.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::offsetLeft):
(WebCore::RenderBox::offsetTop):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent):
(WebCore::RenderBoxModelObject::offsetLeft):
(WebCore::RenderBoxModelObject::offsetTop):
* rendering/RenderBoxModelObject.h:
(RenderBoxModelObject):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::offsetLeft):
(WebCore::RenderInline::offsetTop):

Canonical link: https://commits.webkit.org/105685@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@118961 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
bulldy80 authored and webkit-commit-queue committed May 30, 2012
1 parent 6ee4ab4 commit f24bab7
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 10 deletions.
30 changes: 30 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,33 @@
2012-05-30 Shezan Baig <shezbaig.wk@gmail.com>

Rename offsetTopLeft in RenderBoxModelObject to something better
https://bugs.webkit.org/show_bug.cgi?id=85915

Reviewed by Darin Adler.

Renamed offsetTopLeft in RenderBoxModelObject to
adjustedPositionRelativeToOffsetParent, because it returns the given
startPoint after adjusting it to be relative to the top-left corner of
the offsetParent. The definition of offsetParent itself is non-trivial
and is documented within the body of RenderObject::offsetParent,
therefore I decided to reuse this term, as-is, in the name of this
function.

No new tests; no functional or visible changes.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::offsetLeft):
(WebCore::RenderBox::offsetTop):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent):
(WebCore::RenderBoxModelObject::offsetLeft):
(WebCore::RenderBoxModelObject::offsetTop):
* rendering/RenderBoxModelObject.h:
(RenderBoxModelObject):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::offsetLeft):
(WebCore::RenderInline::offsetTop):

2012-05-29 Adrienne Walker <enne@google.com>

Transformed fixed position layers have an incorrect overlap map entry
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/RenderBox.cpp
Expand Up @@ -3835,12 +3835,12 @@ LayoutRect RenderBox::layoutOverflowRectForPropagation(RenderStyle* parentStyle)

LayoutUnit RenderBox::offsetLeft() const
{
return offsetTopLeft(topLeftLocation()).x();
return adjustedPositionRelativeToOffsetParent(topLeftLocation()).x();
}

LayoutUnit RenderBox::offsetTop() const
{
return offsetTopLeft(topLeftLocation()).y();
return adjustedPositionRelativeToOffsetParent(topLeftLocation()).y();
}

LayoutPoint RenderBox::flipForWritingModeForChild(const RenderBox* child, const LayoutPoint& point) const
Expand Down
10 changes: 5 additions & 5 deletions Source/WebCore/rendering/RenderBoxModelObject.cpp
Expand Up @@ -515,7 +515,7 @@ LayoutSize RenderBoxModelObject::relativePositionOffset() const
return offset;
}

LayoutPoint RenderBoxModelObject::offsetTopLeft(const LayoutPoint& startPoint) const
LayoutPoint RenderBoxModelObject::adjustedPositionRelativeToOffsetParent(const LayoutPoint& startPoint) const
{
// If the element is the HTML body element or does not have an associated box
// return 0 and stop this algorithm.
Expand Down Expand Up @@ -553,15 +553,15 @@ LayoutPoint RenderBoxModelObject::offsetTopLeft(const LayoutPoint& startPoint) c
LayoutUnit RenderBoxModelObject::offsetLeft() const
{
// Note that RenderInline and RenderBox override this to pass a different
// startPoint to offsetTopLeft.
return offsetTopLeft(LayoutPoint()).x();
// startPoint to adjustedPositionRelativeToOffsetParent.
return adjustedPositionRelativeToOffsetParent(LayoutPoint()).x();
}

LayoutUnit RenderBoxModelObject::offsetTop() const
{
// Note that RenderInline and RenderBox override this to pass a different
// startPoint to offsetTopLeft.
return offsetTopLeft(LayoutPoint()).y();
// startPoint to adjustedPositionRelativeToOffsetParent.
return adjustedPositionRelativeToOffsetParent(LayoutPoint()).y();
}

int RenderBoxModelObject::pixelSnappedOffsetWidth() const
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/RenderBoxModelObject.h
Expand Up @@ -225,7 +225,7 @@ class RenderBoxModelObject : public RenderObject {
IntSize m_tileSize;
};

LayoutPoint offsetTopLeft(const LayoutPoint&) const;
LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const;

void calculateBackgroundImageGeometry(const FillLayer*, const LayoutRect& paintRect, BackgroundImageGeometry&);
void getBorderEdgeInfo(class BorderEdge[], const RenderStyle*, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/RenderInline.cpp
Expand Up @@ -653,15 +653,15 @@ LayoutUnit RenderInline::offsetLeft() const
LayoutPoint topLeft;
if (InlineBox* firstBox = firstLineBoxIncludingCulling())
topLeft = flooredLayoutPoint(firstBox->topLeft());
return offsetTopLeft(topLeft).x();
return adjustedPositionRelativeToOffsetParent(topLeft).x();
}

LayoutUnit RenderInline::offsetTop() const
{
LayoutPoint topLeft;
if (InlineBox* firstBox = firstLineBoxIncludingCulling())
topLeft = flooredLayoutPoint(firstBox->topLeft());
return offsetTopLeft(topLeft).y();
return adjustedPositionRelativeToOffsetParent(topLeft).y();
}

static LayoutUnit computeMargin(const RenderInline* renderer, const Length& margin)
Expand Down

0 comments on commit f24bab7

Please sign in to comment.