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

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: Less indentation is more 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..cfa386cb43423ef25601e1e7d568448f44c0128c 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
@@ -378,11 +384,20 @@ static void deriveBorderBoxFromContainerContext(const LayoutObject& object, Pain
case RelativePosition:
context.paintOffset += boxModelObject.offsetForInFlowPosition();
break;
- case AbsolutePosition:
+ case AbsolutePosition: {
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()) {
+ DCHECK(object.isBox());
+ context.paintOffset += toLayoutInline(container)->offsetForInFlowPositionedInline(toLayoutBox(object));
+ }
+
context.currentClip = context.clipForAbsolutePosition;
break;
+ }
case StickyPosition:
context.paintOffset += boxModelObject.offsetForInFlowPosition();
break;
« 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