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

Unified Diff: Source/core/rendering/RenderLayer.cpp

Issue 103213002: position:sticky should stick for the enclosing overflow ancestor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase patch + updated by review comments. Created 6 years, 11 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: Source/core/rendering/RenderLayer.cpp
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index 8edbc8630eeedec3d09686cf47ae61af9c468d31..268fef6f465308a591392182aba40dffa5c6aeea 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -609,6 +609,18 @@ TransformationMatrix RenderLayer::renderableTransform(PaintBehavior paintBehavio
return *m_transform;
}
+RenderLayer* RenderLayer::enclosingOverflowClipLayer(bool includeSelf) const
+{
+ const RenderLayer* layer = includeSelf ? this : parent();
+ while (layer) {
+ if (layer->renderer()->hasOverflowClip())
+ return const_cast<RenderLayer*>(layer);
+
+ layer = layer->parent();
+ }
+ return 0;
+}
+
static bool checkContainingBlockChainForPagination(RenderLayerModelObject* renderer, RenderBox* ancestorColumnsRenderer)
{
RenderView* view = renderer->view();
@@ -1113,9 +1125,9 @@ static inline const RenderLayer* compositingContainer(const RenderLayer* layer)
// the includeSelf option. It is very likely that we don't even want either of these functions; A layer
// should be told explicitly which GraphicsLayer is the repaintContainer for a RenderLayer, and
// any other use cases should probably have an API between the non-compositing and compositing sides of code.
-RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const
+RenderLayer* RenderLayer::enclosingCompositingLayer(IncludeSelfOrNot includeSelf) const
{
- if (includeSelf && compositingState() != NotComposited && compositingState() != PaintsIntoGroupedBacking)
+ if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && compositingState() != PaintsIntoGroupedBacking)
return const_cast<RenderLayer*>(this);
for (const RenderLayer* curr = compositingContainer(this); curr; curr = compositingContainer(curr)) {
@@ -1126,9 +1138,9 @@ RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const
return 0;
}
-RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf) const
+RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(IncludeSelfOrNot includeSelf) const
{
- if (includeSelf && (compositingState() == PaintsIntoOwnBacking || compositingState() == PaintsIntoGroupedBacking))
+ if ((includeSelf == IncludeSelf) && (compositingState() == PaintsIntoOwnBacking || compositingState() == PaintsIntoGroupedBacking))
return const_cast<RenderLayer*>(this);
for (const RenderLayer* curr = compositingContainer(this); curr; curr = compositingContainer(curr)) {
@@ -1170,9 +1182,9 @@ RenderLayer* RenderLayer::ancestorScrollingLayer() const
return 0;
}
-RenderLayer* RenderLayer::enclosingFilterLayer(bool includeSelf) const
+RenderLayer* RenderLayer::enclosingFilterLayer(IncludeSelfOrNot includeSelf) const
{
- const RenderLayer* curr = includeSelf ? this : parent();
+ const RenderLayer* curr = (includeSelf == IncludeSelf) ? this : parent();
for (; curr; curr = curr->parent()) {
if (curr->requiresFullLayerImageForFilters())
return const_cast<RenderLayer*>(curr);
@@ -1719,7 +1731,7 @@ RenderLayer* RenderLayer::clipParent() const
RenderLayer* clipParent = 0;
if ((compositingReasons() & CompositingReasonOutOfFlowClipping) && !needsAncestorClip) {
if (RenderObject* containingBlock = renderer()->containingBlock())
- clipParent = containingBlock->enclosingLayer()->enclosingCompositingLayer(true);
+ clipParent = containingBlock->enclosingLayer()->enclosingCompositingLayer();
}
return clipParent;
@@ -3513,7 +3525,7 @@ LayoutRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, c
// prior to updating its bounds. The requires-own-backing-store-for-ancestor-reasons
// could be stale. Refresh them now.
if (node->layer()->hasCompositedLayerMapping()) {
- RenderLayer* enclosingCompositingLayer = node->layer()->enclosingCompositingLayer(false);
+ RenderLayer* enclosingCompositingLayer = node->layer()->enclosingCompositingLayer(ExcludeSelf);
node->layer()->compositedLayerMapping()->updateRequiresOwnBackingStoreForAncestorReasons(enclosingCompositingLayer);
}

Powered by Google App Engine
This is Rietveld 408576698