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

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: Use offsetForInFlowPositionedInline 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/virtual/spv2/fast/css/README.txt ('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..05cc83742eb423a4e06dcdd2fd7a2c795d444895 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"
@@ -24,6 +25,7 @@ struct PaintPropertyTreeBuilderContext {
: currentTransform(nullptr)
, currentClip(nullptr)
, transformForAbsolutePosition(nullptr)
+ , containerForAbsolutePosition(nullptr)
, clipForAbsolutePosition(nullptr)
, transformForFixedPosition(nullptr)
, clipForFixedPosition(nullptr)
@@ -50,6 +52,7 @@ struct PaintPropertyTreeBuilderContext {
// are included in the additional context too.
TransformPaintPropertyNode* transformForAbsolutePosition;
LayoutPoint paintOffsetForAbsolutePosition;
+ LayoutObject* containerForAbsolutePosition;
ClipPaintPropertyNode* clipForAbsolutePosition;
TransformPaintPropertyNode* transformForFixedPosition;
@@ -112,7 +115,9 @@ void PaintPropertyTreeBuilder::walk(FrameView& frameView, const PaintPropertyTre
frameScroll.translate(-scrollOffset.width(), -scrollOffset.height());
RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = TransformPaintPropertyNode::create(frameScroll, FloatPoint3D(), newTransformNodeForPreTranslation);
localContext.currentTransform = localContext.transformForAbsolutePosition = newTransformNodeForScrollTranslation.get();
- localContext.paintOffset = localContext.paintOffsetForAbsolutePosition = LayoutPoint();
+ localContext.paintOffset = LayoutPoint();
+ localContext.paintOffsetForAbsolutePosition = LayoutPoint();
+ localContext.containerForAbsolutePosition = nullptr;
frameView.setPreTranslation(newTransformNodeForPreTranslation.release());
frameView.setScrollTranslation(newTransformNodeForScrollTranslation.release());
@@ -333,6 +338,7 @@ void PaintPropertyTreeBuilder::updateOutOfFlowContext(LayoutObject& object, Pain
context.transformForAbsolutePosition = context.currentTransform;
context.paintOffsetForAbsolutePosition = context.paintOffset;
context.clipForAbsolutePosition = context.currentClip;
+ context.containerForAbsolutePosition = &object;
}
// TODO(pdr): Remove the !object.isLayoutView() condition when removing FrameView
@@ -379,9 +385,17 @@ static void deriveBorderBoxFromContainerContext(const LayoutObject& object, Pain
context.paintOffset += boxModelObject.offsetForInFlowPosition();
break;
case AbsolutePosition:
- context.currentTransform = context.transformForAbsolutePosition;
- context.paintOffset = context.paintOffsetForAbsolutePosition;
- context.currentClip = context.clipForAbsolutePosition;
+ {
Xianzhu 2016/05/26 21:40:55 Nit: by putting '{' at the end of the previous lin
+ context.currentTransform = context.transformForAbsolutePosition;
+ context.paintOffset = context.paintOffsetForAbsolutePosition;
+
+ // Absolutely positioned content in an inline should be positioned relative to the inline.
+ LayoutObject* container = context.containerForAbsolutePosition;
+ if (container && container->isInFlowPositioned() && container->isLayoutInline())
+ context.paintOffset += toLayoutInline(container)->offsetForInFlowPositionedInline(toLayoutBox(object));
+
+ context.currentClip = context.clipForAbsolutePosition;
+ }
break;
case StickyPosition:
context.paintOffset += boxModelObject.offsetForInFlowPosition();
« no previous file with comments | « third_party/WebKit/LayoutTests/virtual/spv2/fast/css/README.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698