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

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

Issue 1321613002: Refactor ObjectPainter::paintOutline to take a paintOffset (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove ObjectPainter::outlineRectForSVG Created 5 years, 3 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/layout/svg/LayoutSVGModelObject.cpp ('k') | Source/core/paint/ObjectPainter.h » ('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/BlockPainter.h" 6 #include "core/paint/BlockPainter.h"
7 7
8 #include "core/editing/DragCaretController.h" 8 #include "core/editing/DragCaretController.h"
9 #include "core/editing/FrameSelection.h" 9 #include "core/editing/FrameSelection.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 layoutObject.paint(info, childPoint); 155 layoutObject.paint(info, childPoint);
156 info.phase = PaintPhaseFloat; 156 info.phase = PaintPhaseFloat;
157 layoutObject.paint(info, childPoint); 157 layoutObject.paint(info, childPoint);
158 info.phase = PaintPhaseForeground; 158 info.phase = PaintPhaseForeground;
159 layoutObject.paint(info, childPoint); 159 layoutObject.paint(info, childPoint);
160 info.phase = PaintPhaseOutline; 160 info.phase = PaintPhaseOutline;
161 layoutObject.paint(info, childPoint); 161 layoutObject.paint(info, childPoint);
162 } 162 }
163 } 163 }
164 164
165 static inline LayoutRect visualOverflowRectWithPaintOffset(const LayoutBlock& la youtBox, const LayoutPoint& paintOffset)
166 {
167 if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
168 return LayoutRect();
169 LayoutRect bounds = layoutBox.visualOverflowRect();
170 bounds.moveBy(paintOffset);
171 return bounds;
172 }
173
174 void BlockPainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) 165 void BlockPainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset)
175 { 166 {
176 const PaintPhase paintPhase = paintInfo.phase; 167 const PaintPhase paintPhase = paintInfo.phase;
177 168
178 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil dBlockBackground) 169 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil dBlockBackground)
179 && m_layoutBlock.style()->visibility() == VISIBLE 170 && m_layoutBlock.style()->visibility() == VISIBLE
180 && m_layoutBlock.hasBoxDecorationBackground()) 171 && m_layoutBlock.hasBoxDecorationBackground())
181 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset); 172 m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset);
182 173
183 if (paintPhase == PaintPhaseMask && m_layoutBlock.style()->visibility() == V ISIBLE) { 174 if (paintPhase == PaintPhaseMask && m_layoutBlock.style()->visibility() == V ISIBLE) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 m_layoutBlock.paintSelection(contentsPaintInfo, paintOffset); // Fil l in gaps in selection on lines and between blocks. 211 m_layoutBlock.paintSelection(contentsPaintInfo, paintOffset); // Fil l in gaps in selection on lines and between blocks.
221 212
222 if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection | | paintPhase == PaintPhaseTextClip) 213 if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection | | paintPhase == PaintPhaseTextClip)
223 m_layoutBlock.paintFloats(contentsPaintInfo, paintOffset, paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip); 214 m_layoutBlock.paintFloats(contentsPaintInfo, paintOffset, paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip);
224 } 215 }
225 216
226 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && m_layoutBlock.style()->hasOutline() && m_layoutBlock.style()->visibility() = = VISIBLE) { 217 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && m_layoutBlock.style()->hasOutline() && m_layoutBlock.style()->visibility() = = VISIBLE) {
227 // Don't paint focus ring for anonymous block continuation because the 218 // Don't paint focus ring for anonymous block continuation because the
228 // inline element having outline-style:auto paints the whole focus ring. 219 // inline element having outline-style:auto paints the whole focus ring.
229 if (!m_layoutBlock.style()->outlineStyleIsAuto() || !m_layoutBlock.isAno nymousBlockContinuation()) 220 if (!m_layoutBlock.style()->outlineStyleIsAuto() || !m_layoutBlock.isAno nymousBlockContinuation())
230 ObjectPainter(m_layoutBlock).paintOutline(paintInfo, LayoutRect(pain tOffset, m_layoutBlock.size()), visualOverflowRectWithPaintOffset(m_layoutBlock, paintOffset)); 221 ObjectPainter(m_layoutBlock).paintOutline(paintInfo, m_layoutBlock.v isualOverflowRect(), m_layoutBlock.size(), paintOffset);
231 } 222 }
232 223
233 if (paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseChildOutlines ) 224 if (paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseChildOutlines )
234 paintContinuationOutlines(paintInfo, paintOffset); 225 paintContinuationOutlines(paintInfo, paintOffset);
235 226
236 // If the caret's node's layout object's containing block is this block, and the paint action is PaintPhaseForeground, 227 // If the caret's node's layout object's containing block is this block, and the paint action is PaintPhaseForeground,
237 // then paint the caret. 228 // then paint the caret.
238 if (paintPhase == PaintPhaseForeground && hasCaret() && !LayoutObjectDrawing Recorder::useCachedDrawingIfPossible(*paintInfo.context, m_layoutBlock, DisplayI tem::Caret)) { 229 if (paintPhase == PaintPhaseForeground && hasCaret() && !LayoutObjectDrawing Recorder::useCachedDrawingIfPossible(*paintInfo.context, m_layoutBlock, DisplayI tem::Caret)) {
239 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutBlock, DisplayItem::Caret, visualOverflowRectWithPaintOffset(m_layoutBlock, paintOffset )); 230 LayoutRect bounds = m_layoutBlock.visualOverflowRect();
231 bounds.moveBy(paintOffset);
232 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutBlock, DisplayItem::Caret, bounds);
240 paintCarets(paintInfo, paintOffset); 233 paintCarets(paintInfo, paintOffset);
241 } 234 }
242 } 235 }
243 236
244 static inline bool caretBrowsingEnabled(const LocalFrame* frame) 237 static inline bool caretBrowsingEnabled(const LocalFrame* frame)
245 { 238 {
246 Settings* settings = frame->settings(); 239 Settings* settings = frame->settings();
247 return settings && settings->caretBrowsingEnabled(); 240 return settings && settings->caretBrowsingEnabled();
248 } 241 }
249 242
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 LayoutBlock* block = flow->containingBlock(); 347 LayoutBlock* block = flow->containingBlock();
355 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ()) 348 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ())
356 accumulatedPaintOffset.moveBy(block->location()); 349 accumulatedPaintOffset.moveBy(block->location());
357 ASSERT(block); 350 ASSERT(block);
358 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); 351 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset);
359 } 352 }
360 } 353 }
361 354
362 355
363 } // namespace blink 356 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/svg/LayoutSVGModelObject.cpp ('k') | Source/core/paint/ObjectPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698