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

Unified Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp

Issue 2000423009: Correctly position abspos content inside relpos inlines [spv2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/TestExpectations ('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/paint/PaintPropertyTreeBuilder.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
index 122d51da837519544bd8f1ec9b499d41e5c6477b..5456808e938a3a40725aadc938927836fca49aa4 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -6,6 +6,7 @@
#include "core/frame/FrameView.h"
#include "core/frame/Settings.h"
+#include "core/layout/LayoutInline.h"
#include "core/layout/LayoutPart.h"
#include "core/paint/ObjectPaintProperties.h"
#include "core/paint/PaintLayer.h"
@@ -333,6 +334,20 @@ void PaintPropertyTreeBuilder::updateOutOfFlowContext(LayoutObject& object, Pain
context.transformForAbsolutePosition = context.currentTransform;
context.paintOffsetForAbsolutePosition = context.paintOffset;
context.clipForAbsolutePosition = context.currentClip;
+
+ // Absolutely positioned content in an inline should be positioned relative to the first
+ // inline box. See: LayoutInline::offsetForInFlowPositionedInline.
+ // FIXME(pdr): There is a special case when the descendant has static position where this
+ // offset should be removed and an offset based on the inline position should be used instead.
+ if (object.isInline() && object.isLayoutInline()) {
+ const LayoutInline& layoutInline = toLayoutInline(object);
+ if (layoutInline.firstLineBox()) {
+ LayoutPoint inlineOffset = layoutInline.firstLineBox()->topLeft();
+ if (!object.styleRef().isHorizontalWritingMode())
+ inlineOffset = inlineOffset.transposedPoint();
+ context.paintOffsetForAbsolutePosition += inlineOffset;
+ }
+ }
Xianzhu 2016/05/26 18:02:27 It's better to use the same algorithm as in PaintI
}
// TODO(pdr): Remove the !object.isLayoutView() condition when removing FrameView
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698