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

Side by Side Diff: Source/core/paint/ReplacedPainter.cpp

Issue 930833003: Move and rename RenderReplaced and RenderHTMLCanvas to Layout{Replaced,HTMLCanvas}. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: No need to declare renderName() at all. Created 5 years, 10 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
« no previous file with comments | « Source/core/paint/ReplacedPainter.h ('k') | Source/core/rendering/RenderEmbeddedObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "core/paint/ReplacedPainter.h" 6 #include "core/paint/ReplacedPainter.h"
7 7
8 #include "core/layout/Layer.h" 8 #include "core/layout/Layer.h"
9 #include "core/layout/LayoutReplaced.h"
9 #include "core/layout/PaintInfo.h" 10 #include "core/layout/PaintInfo.h"
10 #include "core/paint/BoxPainter.h" 11 #include "core/paint/BoxPainter.h"
11 #include "core/paint/GraphicsContextAnnotator.h" 12 #include "core/paint/GraphicsContextAnnotator.h"
12 #include "core/paint/ObjectPainter.h" 13 #include "core/paint/ObjectPainter.h"
13 #include "core/paint/RenderDrawingRecorder.h" 14 #include "core/paint/RenderDrawingRecorder.h"
14 #include "core/paint/RoundedInnerRectClipper.h" 15 #include "core/paint/RoundedInnerRectClipper.h"
15 #include "core/rendering/RenderReplaced.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 void ReplacedPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paint Offset) 19 void ReplacedPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paint Offset)
20 { 20 {
21 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderReplaced); 21 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_layoutReplaced);
22 22
23 if (!m_renderReplaced.shouldPaint(paintInfo, paintOffset)) 23 if (!m_layoutReplaced.shouldPaint(paintInfo, paintOffset))
24 return; 24 return;
25 25
26 LayoutPoint adjustedPaintOffset = paintOffset + m_renderReplaced.location(); 26 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutReplaced.location();
27 LayoutRect paintRect(adjustedPaintOffset, m_renderReplaced.size()); 27 LayoutRect paintRect(adjustedPaintOffset, m_layoutReplaced.size());
28 28
29 if (m_renderReplaced.hasBoxDecorationBackground() && (paintInfo.phase == Pai ntPhaseForeground || paintInfo.phase == PaintPhaseSelection)) 29 if (m_layoutReplaced.hasBoxDecorationBackground() && (paintInfo.phase == Pai ntPhaseForeground || paintInfo.phase == PaintPhaseSelection))
30 m_renderReplaced.paintBoxDecorationBackground(paintInfo, adjustedPaintOf fset); 30 m_layoutReplaced.paintBoxDecorationBackground(paintInfo, adjustedPaintOf fset);
31 31
32 if (paintInfo.phase == PaintPhaseMask) { 32 if (paintInfo.phase == PaintPhaseMask) {
33 RenderDrawingRecorder renderDrawingRecorder(paintInfo.context, m_renderR eplaced, paintInfo.phase, paintRect); 33 RenderDrawingRecorder renderDrawingRecorder(paintInfo.context, m_layoutR eplaced, paintInfo.phase, paintRect);
34 m_renderReplaced.paintMask(paintInfo, adjustedPaintOffset); 34 m_layoutReplaced.paintMask(paintInfo, adjustedPaintOffset);
35 return; 35 return;
36 } 36 }
37 37
38 if (paintInfo.phase == PaintPhaseClippingMask && (!m_renderReplaced.hasLayer () || !m_renderReplaced.layer()->hasCompositedClippingMask())) 38 if (paintInfo.phase == PaintPhaseClippingMask && (!m_layoutReplaced.hasLayer () || !m_layoutReplaced.layer()->hasCompositedClippingMask()))
39 return; 39 return;
40 40
41 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSe lfOutline) && m_renderReplaced.style()->outlineWidth()) 41 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSe lfOutline) && m_layoutReplaced.style()->outlineWidth())
42 ObjectPainter(m_renderReplaced).paintOutline(paintInfo, paintRect); 42 ObjectPainter(m_layoutReplaced).paintOutline(paintInfo, paintRect);
43 43
44 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection && !m_renderReplaced.canHaveChildren() && paintInfo.phase != PaintPhas eClippingMask) 44 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection && !m_layoutReplaced.canHaveChildren() && paintInfo.phase != PaintPhas eClippingMask)
45 return; 45 return;
46 46
47 if (!paintInfo.shouldPaintWithinRoot(&m_renderReplaced)) 47 if (!paintInfo.shouldPaintWithinRoot(&m_layoutReplaced))
48 return; 48 return;
49 49
50 bool drawSelectionTint = m_renderReplaced.selectionState() != LayoutObject:: SelectionNone && !m_renderReplaced.document().printing(); 50 bool drawSelectionTint = m_layoutReplaced.selectionState() != LayoutObject:: SelectionNone && !m_layoutReplaced.document().printing();
51 if (paintInfo.phase == PaintPhaseSelection) { 51 if (paintInfo.phase == PaintPhaseSelection) {
52 if (m_renderReplaced.selectionState() == LayoutObject::SelectionNone) 52 if (m_layoutReplaced.selectionState() == LayoutObject::SelectionNone)
53 return; 53 return;
54 drawSelectionTint = false; 54 drawSelectionTint = false;
55 } 55 }
56 56
57 // FIXME(crbug.com/444591): Refactor this to not create a drawing recorder f or renderers with children. 57 // FIXME(crbug.com/444591): Refactor this to not create a drawing recorder f or renderers with children.
58 OwnPtr<RenderDrawingRecorder> renderDrawingRecorder; 58 OwnPtr<RenderDrawingRecorder> renderDrawingRecorder;
59 if (!m_renderReplaced.isSVGRoot()) 59 if (!m_layoutReplaced.isSVGRoot())
60 renderDrawingRecorder = adoptPtr(new RenderDrawingRecorder(paintInfo.con text, m_renderReplaced, paintInfo.phase, paintRect)); 60 renderDrawingRecorder = adoptPtr(new RenderDrawingRecorder(paintInfo.con text, m_layoutReplaced, paintInfo.phase, paintRect));
61 if (renderDrawingRecorder && renderDrawingRecorder->canUseCachedDrawing()) 61 if (renderDrawingRecorder && renderDrawingRecorder->canUseCachedDrawing())
62 return; 62 return;
63 63
64 { 64 {
65 OwnPtr<RoundedInnerRectClipper> clipper; 65 OwnPtr<RoundedInnerRectClipper> clipper;
66 bool completelyClippedOut = false; 66 bool completelyClippedOut = false;
67 if (m_renderReplaced.style()->hasBorderRadius()) { 67 if (m_layoutReplaced.style()->hasBorderRadius()) {
68 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, m_renderRepl aced.size()); 68 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, m_layoutRepl aced.size());
69 69
70 if (borderRect.isEmpty()) { 70 if (borderRect.isEmpty()) {
71 completelyClippedOut = true; 71 completelyClippedOut = true;
72 } else { 72 } else {
73 // Push a clip if we have a border radius, since we want to roun d the foreground content that gets painted. 73 // Push a clip if we have a border radius, since we want to roun d the foreground content that gets painted.
74 FloatRoundedRect roundedInnerRect = m_renderReplaced.style()->ge tRoundedInnerBorderFor(paintRect, 74 FloatRoundedRect roundedInnerRect = m_layoutReplaced.style()->ge tRoundedInnerBorderFor(paintRect,
75 m_renderReplaced.paddingTop() + m_renderReplaced.borderTop() , m_renderReplaced.paddingBottom() + m_renderReplaced.borderBottom(), m_renderRe placed.paddingLeft() + m_renderReplaced.borderLeft(), m_renderReplaced.paddingRi ght() + m_renderReplaced.borderRight(), true, true); 75 m_layoutReplaced.paddingTop() + m_layoutReplaced.borderTop() , m_layoutReplaced.paddingBottom() + m_layoutReplaced.borderBottom(), m_layoutRe placed.paddingLeft() + m_layoutReplaced.borderLeft(), m_layoutReplaced.paddingRi ght() + m_layoutReplaced.borderRight(), true, true);
76 76
77 clipper = adoptPtr(new RoundedInnerRectClipper(m_renderReplaced, paintInfo, paintRect, roundedInnerRect, ApplyToContext)); 77 clipper = adoptPtr(new RoundedInnerRectClipper(m_layoutReplaced, paintInfo, paintRect, roundedInnerRect, ApplyToContext));
78 } 78 }
79 } 79 }
80 80
81 if (!completelyClippedOut) { 81 if (!completelyClippedOut) {
82 if (paintInfo.phase == PaintPhaseClippingMask) { 82 if (paintInfo.phase == PaintPhaseClippingMask) {
83 m_renderReplaced.paintClippingMask(paintInfo, adjustedPaintOffse t); 83 m_layoutReplaced.paintClippingMask(paintInfo, adjustedPaintOffse t);
84 } else { 84 } else {
85 m_renderReplaced.paintReplaced(paintInfo, adjustedPaintOffset); 85 m_layoutReplaced.paintReplaced(paintInfo, adjustedPaintOffset);
86 } 86 }
87 } 87 }
88 } 88 }
89 89
90 // The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of 90 // The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of
91 // surrounding content. 91 // surrounding content.
92 if (drawSelectionTint) { 92 if (drawSelectionTint) {
93 LayoutRect selectionPaintingRect = m_renderReplaced.localSelectionRect() ; 93 LayoutRect selectionPaintingRect = m_layoutReplaced.localSelectionRect() ;
94 selectionPaintingRect.moveBy(adjustedPaintOffset); 94 selectionPaintingRect.moveBy(adjustedPaintOffset);
95 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), m_renderReplaced.selectionBackgroundColor()); 95 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), m_layoutReplaced.selectionBackgroundColor());
96 } 96 }
97 } 97 }
98 98
99 } // namespace blink 99 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/ReplacedPainter.h ('k') | Source/core/rendering/RenderEmbeddedObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698