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

Unified Diff: Source/core/paint/InlinePainter.cpp

Issue 1220583004: Refactor DrawingRecorders to check for cached drawings earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 5 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 | « Source/core/paint/InlineFlowBoxPainter.cpp ('k') | Source/core/paint/InlineTextBoxPainter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/InlinePainter.cpp
diff --git a/Source/core/paint/InlinePainter.cpp b/Source/core/paint/InlinePainter.cpp
index 3fd2a23950103acd6e260ed7c168edd433971a16..73a8e1f763bf26c436b818c7ec032e81ba2c2900 100644
--- a/Source/core/paint/InlinePainter.cpp
+++ b/Source/core/paint/InlinePainter.cpp
@@ -51,23 +51,27 @@ void InlinePainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint&
return;
if (styleToUse.outlineStyleIsAuto()) {
- if (LayoutTheme::theme().shouldDrawDefaultFocusRing(&m_layoutInline)) {
- Vector<LayoutRect> focusRingRects;
- m_layoutInline.addFocusRingRects(focusRingRects, paintOffset);
+ if (!LayoutTheme::theme().shouldDrawDefaultFocusRing(&m_layoutInline))
+ return;
+ if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_layoutInline, paintInfo.phase))
+ return;
- LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutInline, paintInfo.phase, outlinePaintRect(focusRingRects, LayoutPoint()));
- if (recorder.canUseCachedDrawing())
- return;
+ Vector<LayoutRect> focusRingRects;
+ m_layoutInline.addFocusRingRects(focusRingRects, paintOffset);
- // Only paint the focus ring by hand if the theme isn't able to draw the focus ring.
- ObjectPainter(m_layoutInline).paintFocusRing(paintInfo, styleToUse, focusRingRects);
- }
+ LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutInline, paintInfo.phase, outlinePaintRect(focusRingRects, LayoutPoint()));
+ // Only paint the focus ring by hand if the theme isn't able to draw the focus ring.
+ ObjectPainter(m_layoutInline).paintFocusRing(paintInfo, styleToUse, focusRingRects);
return;
}
if (styleToUse.outlineStyle() == BNONE)
return;
+ GraphicsContext* graphicsContext = paintInfo.context;
+ if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*graphicsContext, m_layoutInline, paintInfo.phase))
+ return;
+
Vector<LayoutRect> rects;
rects.append(LayoutRect());
@@ -82,11 +86,7 @@ void InlinePainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint&
Color outlineColor = m_layoutInline.resolveColor(styleToUse, CSSPropertyOutlineColor);
bool useTransparencyLayer = outlineColor.hasAlpha();
- LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutInline, paintInfo.phase, outlinePaintRect(rects, paintOffset));
- if (recorder.canUseCachedDrawing())
- return;
-
- GraphicsContext* graphicsContext = paintInfo.context;
+ LayoutObjectDrawingRecorder recorder(*graphicsContext, m_layoutInline, paintInfo.phase, outlinePaintRect(rects, paintOffset));
if (useTransparencyLayer) {
graphicsContext->beginLayer(static_cast<float>(outlineColor.alpha()) / 255);
outlineColor = Color(outlineColor.red(), outlineColor.green(), outlineColor.blue());
« no previous file with comments | « Source/core/paint/InlineFlowBoxPainter.cpp ('k') | Source/core/paint/InlineTextBoxPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698