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

Side by Side Diff: third_party/WebKit/Source/core/paint/EmbeddedObjectPainter.cpp

Issue 1391753005: (WIP) Invalidation during painting (for synchronized painting) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/EmbeddedObjectPainter.h" 5 #include "core/paint/EmbeddedObjectPainter.h"
6 6
7 #include "core/frame/Settings.h" 7 #include "core/frame/Settings.h"
8 #include "core/layout/LayoutEmbeddedObject.h" 8 #include "core/layout/LayoutEmbeddedObject.h"
9 #include "core/layout/LayoutTheme.h" 9 #include "core/layout/LayoutTheme.h"
10 #include "core/paint/LayoutObjectDrawingRecorder.h" 10 #include "core/paint/LayoutObjectDrawingRecorder.h"
(...skipping 25 matching lines...) Expand all
36 36
37 void EmbeddedObjectPainter::paintReplaced(const PaintInfo& paintInfo, const Layo utPoint& paintOffset) 37 void EmbeddedObjectPainter::paintReplaced(const PaintInfo& paintInfo, const Layo utPoint& paintOffset)
38 { 38 {
39 if (!m_layoutEmbeddedObject.showsUnavailablePluginIndicator()) 39 if (!m_layoutEmbeddedObject.showsUnavailablePluginIndicator())
40 return; 40 return;
41 41
42 if (paintInfo.phase == PaintPhaseSelection) 42 if (paintInfo.phase == PaintPhaseSelection)
43 return; 43 return;
44 44
45 GraphicsContext& context = paintInfo.context; 45 GraphicsContext& context = paintInfo.context;
46 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, m_layou tEmbeddedObject, paintInfo.phase, paintOffset)) 46 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, m_layou tEmbeddedObject, paintInfo.phase))
47 return; 47 return;
48 48
49 LayoutRect contentRect(m_layoutEmbeddedObject.contentBoxRect()); 49 LayoutRect contentRect(m_layoutEmbeddedObject.contentBoxRect());
50 contentRect.moveBy(paintOffset); 50 contentRect.moveBy(paintOffset);
51 LayoutObjectDrawingRecorder drawingRecorder(context, m_layoutEmbeddedObject, paintInfo.phase, contentRect, paintOffset); 51 LayoutObjectDrawingRecorder drawingRecorder(context, m_layoutEmbeddedObject, paintInfo.phase, contentRect);
52 GraphicsContextStateSaver stateSaver(context); 52 GraphicsContextStateSaver stateSaver(context);
53 context.clip(pixelSnappedIntRect(contentRect)); 53 context.clip(pixelSnappedIntRect(contentRect));
54 54
55 Font font = replacementTextFont(); 55 Font font = replacementTextFont();
56 // TODO(trchen): Speculative fix for crbug.com/481880 56 // TODO(trchen): Speculative fix for crbug.com/481880
57 // With last resort font, how could this ever be null? 57 // With last resort font, how could this ever be null?
58 ASSERT(font.primaryFont()); 58 ASSERT(font.primaryFont());
59 if (!font.primaryFont()) 59 if (!font.primaryFont())
60 return; 60 return;
61 TextRun textRun(m_layoutEmbeddedObject.unavailablePluginReplacementText()); 61 TextRun textRun(m_layoutEmbeddedObject.unavailablePluginReplacementText());
(...skipping 10 matching lines...) Expand all
72 72
73 FloatRect textRect(FloatPoint(), textGeometry); 73 FloatRect textRect(FloatPoint(), textGeometry);
74 textRect.move(FloatPoint(contentRect.center()) - textRect.center()); 74 textRect.move(FloatPoint(contentRect.center()) - textRect.center());
75 TextRunPaintInfo runInfo(textRun); 75 TextRunPaintInfo runInfo(textRun);
76 runInfo.bounds = floatBackgroundRect; 76 runInfo.bounds = floatBackgroundRect;
77 context.setFillColor(scaleAlpha(Color::black, replacementTextTextOpacity)); 77 context.setFillColor(scaleAlpha(Color::black, replacementTextTextOpacity));
78 context.drawBidiText(font, runInfo, textRect.location() + FloatSize(0, font. fontMetrics().ascent())); 78 context.drawBidiText(font, runInfo, textRect.location() + FloatSize(0, font. fontMetrics().ascent()));
79 } 79 }
80 80
81 } // namespace blink 81 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698