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

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

Issue 1569293003: Revert of ObjectPainter::paintAsStackingContext() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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: third_party/WebKit/Source/core/paint/BlockPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/BlockPainter.cpp b/third_party/WebKit/Source/core/paint/BlockPainter.cpp
index ff8865d4606314cb41c830a20a1497b46c4207d6..be32974edac3edfc798fc3d83168dcca42f59ae0 100644
--- a/third_party/WebKit/Source/core/paint/BlockPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/BlockPainter.cpp
@@ -99,14 +99,14 @@
void BlockPainter::paintChildrenOfFlexibleBox(const LayoutFlexibleBox& layoutFlexibleBox, const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
for (const LayoutBox* child = layoutFlexibleBox.orderIterator().first(); child; child = layoutFlexibleBox.orderIterator().next())
- BlockPainter(layoutFlexibleBox).paintChildAsPseudoStackingContext(*child, paintInfo, paintOffset);
-}
-
-void BlockPainter::paintChildAsPseudoStackingContext(const LayoutBox& child, const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+ BlockPainter(layoutFlexibleBox).paintChildAsInlineBlock(*child, paintInfo, paintOffset);
+}
+
+void BlockPainter::paintChildAsInlineBlock(const LayoutBox& child, const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
LayoutPoint childPoint = m_layoutBlock.flipForWritingModeForChild(&child, paintOffset);
if (!child.hasSelfPaintingLayer() && !child.isFloating())
- ObjectPainter(child).paintAsPseudoStackingContext(paintInfo, childPoint);
+ paintAsInlineBlock(child, paintInfo, childPoint);
}
void BlockPainter::paintInlineBox(const InlineBox& inlineBox, const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
@@ -118,7 +118,32 @@
if (inlineBox.parent()->lineLayoutItem().style()->isFlippedBlocksWritingMode()) // Faster than calling containingBlock().
childPoint = inlineBox.layoutObject().containingBlock()->flipForWritingModeForChild(&toLayoutBox(inlineBox.layoutObject()), childPoint);
- ObjectPainter(inlineBox.layoutObject()).paintAsPseudoStackingContext(paintInfo, childPoint);
+ paintAsInlineBlock(inlineBox.layoutObject(), paintInfo, childPoint);
+}
+
+void BlockPainter::paintAsInlineBlock(const LayoutObject& layoutObject, const PaintInfo& paintInfo, const LayoutPoint& childPoint)
+{
+ if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)
+ return;
+
+ // Paint all phases atomically, as though the element established its own
+ // stacking context. (See Appendix E.2, section 7.2.1.4 on
+ // inline block/table/replaced elements in the CSS2.1 specification.)
+ // This is also used by other elements (e.g. flex items and grid items).
+ bool preservePhase = paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip;
+ PaintInfo info(paintInfo);
+ info.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
+ layoutObject.paint(info, childPoint);
+ if (!preservePhase) {
+ info.phase = PaintPhaseChildBlockBackgrounds;
+ layoutObject.paint(info, childPoint);
+ info.phase = PaintPhaseFloat;
+ layoutObject.paint(info, childPoint);
+ info.phase = PaintPhaseForeground;
+ layoutObject.paint(info, childPoint);
+ info.phase = PaintPhaseOutline;
+ layoutObject.paint(info, childPoint);
+ }
}
void BlockPainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
@@ -183,7 +208,7 @@
m_layoutBlock.paintSelection(contentsPaintInfo, paintOffset); // Fill in gaps in selection on lines and between blocks.
if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip)
- m_layoutBlock.paintFloats(contentsPaintInfo, paintOffset);
+ m_layoutBlock.paintFloats(contentsPaintInfo, paintOffset, paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip);
}
if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && m_layoutBlock.style()->hasOutline() && m_layoutBlock.style()->visibility() == VISIBLE)
« no previous file with comments | « third_party/WebKit/Source/core/paint/BlockPainter.h ('k') | third_party/WebKit/Source/core/paint/GridPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698