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

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

Issue 2767133003: Fix position of layer with floating ancestor within inline parent layer (Closed)
Patch Set: - Created 3 years, 9 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 | « no previous file | third_party/WebKit/Source/core/paint/PaintLayerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PaintLayer.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
index d1f22d16775b05973b33e562f0f1507c2e91f5d6..5ddf00a2fbfc26816d105b04695ced26d92cb0f8 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -1421,18 +1421,29 @@ static inline const PaintLayer* accumulateOffsetTowardsAncestor(
}
PaintLayer* parentLayer = nullptr;
- if (position == AbsolutePosition || position == FixedPosition ||
- (layoutObject->isFloating() && layoutObject->parent() &&
- !layoutObject->parent()->isLayoutBlockFlow())) {
+ bool isOutOfFlowPositioned =
+ position == AbsolutePosition || position == FixedPosition;
+ if (isOutOfFlowPositioned ||
+ // If the parent layer is not a block, there might be floating objects
+ // between this layer (included) and parent layer which need to escape the
+ // inline parent to find the actual containing layer through the
+ // containing block chain.
+ (layer->parent() && !layer->parent()->layoutObject()->isLayoutBlock())) {
bool foundAncestorFirst = false;
- if (layoutObject->isFloating()) {
+ if (!isOutOfFlowPositioned) {
Optional<LayoutObject::AncestorSkipInfo> skipInfo;
if (ancestorLayer)
skipInfo.emplace(ancestorLayer->layoutObject());
- if (auto* containingBlock = layoutObject->containingBlock(
- ancestorLayer ? &*skipInfo : nullptr)) {
- parentLayer = containingBlock->enclosingLayer();
- foundAncestorFirst = ancestorLayer && skipInfo->ancestorSkipped();
+
+ const LayoutObject* object = layoutObject;
+ while (auto* container =
+ object->container(ancestorLayer ? &*skipInfo : nullptr)) {
+ foundAncestorFirst |= ancestorLayer && skipInfo->ancestorSkipped();
+ if (container->hasLayer()) {
+ parentLayer = toLayoutBoxModelObject(container)->layer();
+ break;
+ }
+ object = container;
}
} else {
parentLayer = layer->containingLayerForOutOfFlowPositioned(
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintLayerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698