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

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

Issue 1261653002: Move SelectionState out of LayoutObject and into Line Layout API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2 legit 5ever Created 5 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/ListMarkerPainter.cpp ('k') | Source/core/paint/SVGInlineTextBoxPainter.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/LayoutReplaced.h" 8 #include "core/layout/LayoutReplaced.h"
9 #include "core/layout/api/SelectionState.h"
9 #include "core/paint/BoxPainter.h" 10 #include "core/paint/BoxPainter.h"
10 #include "core/paint/DeprecatedPaintLayer.h" 11 #include "core/paint/DeprecatedPaintLayer.h"
11 #include "core/paint/LayoutObjectDrawingRecorder.h" 12 #include "core/paint/LayoutObjectDrawingRecorder.h"
12 #include "core/paint/ObjectPainter.h" 13 #include "core/paint/ObjectPainter.h"
13 #include "core/paint/PaintInfo.h" 14 #include "core/paint/PaintInfo.h"
14 #include "core/paint/RoundedInnerRectClipper.h" 15 #include "core/paint/RoundedInnerRectClipper.h"
15 #include "wtf/Optional.h" 16 #include "wtf/Optional.h"
16 17
17 namespace blink { 18 namespace blink {
18 19
(...skipping 25 matching lines...) Expand all
44 return; 45 return;
45 } 46 }
46 47
47 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection && !m_layoutReplaced.canHaveChildren() && paintInfo.phase != PaintPhas eClippingMask) 48 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection && !m_layoutReplaced.canHaveChildren() && paintInfo.phase != PaintPhas eClippingMask)
48 return; 49 return;
49 50
50 if (!paintInfo.shouldPaintWithinRoot(&m_layoutReplaced)) 51 if (!paintInfo.shouldPaintWithinRoot(&m_layoutReplaced))
51 return; 52 return;
52 53
53 if (paintInfo.phase == PaintPhaseSelection) 54 if (paintInfo.phase == PaintPhaseSelection)
54 if (m_layoutReplaced.selectionState() == LayoutObject::SelectionNone) 55 if (m_layoutReplaced.selectionState() == SelectionNone)
55 return; 56 return;
56 57
57 { 58 {
58 Optional<RoundedInnerRectClipper> clipper; 59 Optional<RoundedInnerRectClipper> clipper;
59 bool completelyClippedOut = false; 60 bool completelyClippedOut = false;
60 if (m_layoutReplaced.style()->hasBorderRadius()) { 61 if (m_layoutReplaced.style()->hasBorderRadius()) {
61 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, m_layoutRepl aced.size()); 62 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, m_layoutRepl aced.size());
62 63
63 if (borderRect.isEmpty()) { 64 if (borderRect.isEmpty()) {
64 completelyClippedOut = true; 65 completelyClippedOut = true;
(...skipping 15 matching lines...) Expand all
80 if (paintInfo.phase == PaintPhaseClippingMask) { 81 if (paintInfo.phase == PaintPhaseClippingMask) {
81 BoxPainter(m_layoutReplaced).paintClippingMask(paintInfo, adjust edPaintOffset); 82 BoxPainter(m_layoutReplaced).paintClippingMask(paintInfo, adjust edPaintOffset);
82 } else { 83 } else {
83 m_layoutReplaced.paintReplaced(paintInfo, adjustedPaintOffset); 84 m_layoutReplaced.paintReplaced(paintInfo, adjustedPaintOffset);
84 } 85 }
85 } 86 }
86 } 87 }
87 88
88 // The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of 89 // The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of
89 // surrounding content. 90 // surrounding content.
90 bool drawSelectionTint = paintInfo.phase == PaintPhaseForeground && m_layout Replaced.selectionState() != LayoutObject::SelectionNone && !paintInfo.isPrintin g(); 91 bool drawSelectionTint = paintInfo.phase == PaintPhaseForeground && m_layout Replaced.selectionState() != SelectionNone && !paintInfo.isPrinting();
91 if (drawSelectionTint && !LayoutObjectDrawingRecorder::useCachedDrawingIfPos sible(*paintInfo.context, m_layoutReplaced, DisplayItem::SelectionTint)) { 92 if (drawSelectionTint && !LayoutObjectDrawingRecorder::useCachedDrawingIfPos sible(*paintInfo.context, m_layoutReplaced, DisplayItem::SelectionTint)) {
92 LayoutRect selectionPaintingRect = m_layoutReplaced.localSelectionRect() ; 93 LayoutRect selectionPaintingRect = m_layoutReplaced.localSelectionRect() ;
93 selectionPaintingRect.moveBy(adjustedPaintOffset); 94 selectionPaintingRect.moveBy(adjustedPaintOffset);
94 IntRect selectionPaintingIntRect = pixelSnappedIntRect(selectionPainting Rect); 95 IntRect selectionPaintingIntRect = pixelSnappedIntRect(selectionPainting Rect);
95 96
96 LayoutObjectDrawingRecorder drawingRecorder(*paintInfo.context, m_layout Replaced, DisplayItem::SelectionTint, selectionPaintingIntRect); 97 LayoutObjectDrawingRecorder drawingRecorder(*paintInfo.context, m_layout Replaced, DisplayItem::SelectionTint, selectionPaintingIntRect);
97 paintInfo.context->fillRect(selectionPaintingIntRect, m_layoutReplaced.s electionBackgroundColor()); 98 paintInfo.context->fillRect(selectionPaintingIntRect, m_layoutReplaced.s electionBackgroundColor());
98 } 99 }
99 } 100 }
100 101
101 } // namespace blink 102 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/ListMarkerPainter.cpp ('k') | Source/core/paint/SVGInlineTextBoxPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698