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

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

Issue 2414683002: Make offsetTop/Left handle a relative positioned inline offsetParent correctly. (Closed)
Patch Set: Changes according to review. Created 4 years, 2 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/LayoutInline.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutInline.cpp b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
index b8a5ed449df5133bab6be3ce2edbed67f2478998..373ed32e4db061ffb6a52a1cf57aa739b68cb4ed 100644
--- a/third_party/WebKit/Source/core/layout/LayoutInline.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
@@ -782,20 +782,18 @@ void LayoutInline::absoluteQuadsForSelf(Vector<FloatQuad>& quads) const {
context(FloatRect());
}
+LayoutPoint LayoutInline::firstLineBoxTopLeft() const {
+ if (InlineBox* firstBox = firstLineBoxIncludingCulling())
+ return firstBox->topLeft();
+ return LayoutPoint();
+}
+
LayoutUnit LayoutInline::offsetLeft(const Element* parent) const {
- LayoutPoint topLeft;
- if (InlineBox* firstBox = firstLineBoxIncludingCulling()) {
- topLeft = firstBox->topLeft();
- }
- return adjustedPositionRelativeTo(topLeft, parent).x();
+ return adjustedPositionRelativeTo(firstLineBoxTopLeft(), parent).x();
}
LayoutUnit LayoutInline::offsetTop(const Element* parent) const {
- LayoutPoint topLeft;
- if (InlineBox* firstBox = firstLineBoxIncludingCulling()) {
- topLeft = firstBox->topLeft();
- }
- return adjustedPositionRelativeTo(topLeft, parent).y();
+ return adjustedPositionRelativeTo(firstLineBoxTopLeft(), parent).y();
}
static LayoutUnit computeMargin(const LayoutInline* layoutObject,

Powered by Google App Engine
This is Rietveld 408576698