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

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

Issue 1584903002: Improvement handling of background and outline paint phases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PaintPhaseRename
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/ObjectPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/ObjectPainter.cpp b/third_party/WebKit/Source/core/paint/ObjectPainter.cpp
index 7f066d4b82ef53a33ef9c250d53873d174e9e8ea..97a574bf943f6040042ad0ef58408c4418b47723 100644
--- a/third_party/WebKit/Source/core/paint/ObjectPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/ObjectPainter.cpp
@@ -188,7 +188,7 @@ void paintComplexOutline(GraphicsContext& graphicsContext, const Vector<IntRect>
void ObjectPainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- ASSERT(paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline);
+ ASSERT(shouldPaintSelfOutline(paintInfo.phase));
const ComputedStyle& styleToUse = m_layoutObject.styleRef();
if (!styleToUse.hasOutline() || styleToUse.visibility() != VISIBLE)
@@ -241,14 +241,12 @@ void ObjectPainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint&
void ObjectPainter::paintInlineChildrenOutlines(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- ASSERT(paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseDescendantOutlines);
-
- PaintInfo childPaintInfo(paintInfo);
- childPaintInfo.phase = paintInfo.phase == PaintPhaseDescendantOutlines ? PaintPhaseOutline : paintInfo.phase;
+ ASSERT(shouldPaintDescendantOutlines(paintInfo.phase));
+ PaintInfo paintInfoForDescendants = paintInfo.forDescendants();
for (LayoutObject* child = m_layoutObject.slowFirstChild(); child; child = child->nextSibling()) {
if (child->isLayoutInline() && !toLayoutInline(child)->hasSelfPaintingLayer())
- child->paint(childPaintInfo, paintOffset);
+ child->paint(paintInfoForDescendants, paintOffset);
}
}
@@ -536,23 +534,25 @@ void ObjectPainter::drawSolidBoxSide(GraphicsContext& graphicsContext, int x1, i
void ObjectPainter::paintAsPseudoStackingContext(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- bool preservePhase = paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip;
- if (!preservePhase && paintInfo.phase != PaintPhaseForeground)
+ // Pass PaintPhaseSelection and PaintPhaseTextClip to the descendants so that they will paint
+ // for selection and text clip respectively. We don't need complete painting for these phases.
+ if (paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip) {
+ m_layoutObject.paint(paintInfo, paintOffset);
+ return;
+ }
+
+ if (paintInfo.phase != PaintPhaseForeground)
return;
PaintInfo info(paintInfo);
- info.phase = preservePhase ? paintInfo.phase : PaintPhaseSelfBlockBackground;
+ info.phase = PaintPhaseBlockBackground;
+ m_layoutObject.paint(info, paintOffset);
+ info.phase = PaintPhaseFloat;
+ m_layoutObject.paint(info, paintOffset);
+ info.phase = PaintPhaseForeground;
+ m_layoutObject.paint(info, paintOffset);
+ info.phase = PaintPhaseOutline;
m_layoutObject.paint(info, paintOffset);
- if (!preservePhase) {
- info.phase = PaintPhaseDescendantBlockBackgrounds;
- m_layoutObject.paint(info, paintOffset);
- info.phase = PaintPhaseFloat;
- m_layoutObject.paint(info, paintOffset);
- info.phase = PaintPhaseForeground;
- m_layoutObject.paint(info, paintOffset);
- info.phase = PaintPhaseOutline;
- m_layoutObject.paint(info, paintOffset);
- }
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/paint/LineBoxListPainter.cpp ('k') | third_party/WebKit/Source/core/paint/PaintInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698