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

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

Issue 1129793005: Replace OwnPtr with WTF::Optional for optional recorders. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: merge with master Created 5 years, 6 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 | « no previous file | Source/core/paint/BoxPainter.cpp » ('j') | Source/wtf/Optional.h » ('J')
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/FrameSelection.h" 8 #include "core/editing/FrameSelection.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/layout/LayoutFlexibleBox.h" 10 #include "core/layout/LayoutFlexibleBox.h"
11 #include "core/layout/LayoutInline.h" 11 #include "core/layout/LayoutInline.h"
12 #include "core/page/Page.h" 12 #include "core/page/Page.h"
13 #include "core/paint/BoxClipper.h" 13 #include "core/paint/BoxClipper.h"
14 #include "core/paint/BoxPainter.h" 14 #include "core/paint/BoxPainter.h"
15 #include "core/paint/DeprecatedPaintLayer.h" 15 #include "core/paint/DeprecatedPaintLayer.h"
16 #include "core/paint/InlinePainter.h" 16 #include "core/paint/InlinePainter.h"
17 #include "core/paint/LayoutObjectDrawingRecorder.h" 17 #include "core/paint/LayoutObjectDrawingRecorder.h"
18 #include "core/paint/LineBoxListPainter.h" 18 #include "core/paint/LineBoxListPainter.h"
19 #include "core/paint/PaintInfo.h" 19 #include "core/paint/PaintInfo.h"
20 #include "core/paint/ScopeRecorder.h" 20 #include "core/paint/ScopeRecorder.h"
21 #include "core/paint/ScrollRecorder.h" 21 #include "core/paint/ScrollRecorder.h"
22 #include "core/paint/ScrollableAreaPainter.h" 22 #include "core/paint/ScrollableAreaPainter.h"
23 #include "platform/graphics/paint/ClipRecorder.h" 23 #include "platform/graphics/paint/ClipRecorder.h"
24 #include "wtf/Optional.h"
24 25
25 namespace blink { 26 namespace blink {
26 27
27 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff set) 28 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff set)
28 { 29 {
29 PaintInfo localPaintInfo(paintInfo); 30 PaintInfo localPaintInfo(paintInfo);
30 31
31 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location(); 32 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location();
32 33
33 PaintPhase originalPhase = localPaintInfo.phase; 34 PaintPhase originalPhase = localPaintInfo.phase;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return; 180 return;
180 } 181 }
181 182
182 if (paintPhase == PaintPhaseClippingMask && m_layoutBlock.style()->visibilit y() == VISIBLE) { 183 if (paintPhase == PaintPhaseClippingMask && m_layoutBlock.style()->visibilit y() == VISIBLE) {
183 BoxPainter(m_layoutBlock).paintClippingMask(paintInfo, paintOffset); 184 BoxPainter(m_layoutBlock).paintClippingMask(paintInfo, paintOffset);
184 return; 185 return;
185 } 186 }
186 187
187 { 188 {
188 PaintInfo scrolledPaintInfo(paintInfo); 189 PaintInfo scrolledPaintInfo(paintInfo);
189 OwnPtr<ScrollRecorder> scrollRecorder; 190 Optional<ScrollRecorder> scrollRecorder;
190 if (m_layoutBlock.hasOverflowClip()) { 191 if (m_layoutBlock.hasOverflowClip()) {
191 IntSize scrollOffset = m_layoutBlock.scrolledContentOffset(); 192 IntSize scrollOffset = m_layoutBlock.scrolledContentOffset();
192 if (m_layoutBlock.layer()->scrollsOverflow() || !scrollOffset.isZero ()) { 193 if (m_layoutBlock.layer()->scrollsOverflow() || !scrollOffset.isZero ()) {
193 scrollRecorder = adoptPtr(new ScrollRecorder(*paintInfo.context, m_layoutBlock, paintPhase, scrollOffset)); 194 scrollRecorder.emplace(*paintInfo.context, m_layoutBlock, paintP hase, scrollOffset);
194 scrolledPaintInfo.rect.move(scrollOffset); 195 scrolledPaintInfo.rect.move(scrollOffset);
195 } 196 }
196 } 197 }
197 198
198 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhase ChildBlockBackground) 199 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhase ChildBlockBackground)
199 && m_layoutBlock.style()->visibility() == VISIBLE 200 && m_layoutBlock.style()->visibility() == VISIBLE
200 && m_layoutBlock.hasColumns() 201 && m_layoutBlock.hasColumns()
201 && !paintInfo.paintRootBackgroundOnly()) { 202 && !paintInfo.paintRootBackgroundOnly()) {
202 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutBlo ck, DisplayItem::ColumnRules, bounds); 203 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutBlo ck, DisplayItem::ColumnRules, bounds);
203 if (!recorder.canUseCachedDrawing()) 204 if (!recorder.canUseCachedDrawing())
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 LayoutBlock* block = flow->containingBlock(); 505 LayoutBlock* block = flow->containingBlock();
505 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ()) 506 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ())
506 accumulatedPaintOffset.moveBy(block->location()); 507 accumulatedPaintOffset.moveBy(block->location());
507 ASSERT(block); 508 ASSERT(block);
508 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); 509 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset);
509 } 510 }
510 } 511 }
511 512
512 513
513 } // namespace blink 514 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/paint/BoxPainter.cpp » ('j') | Source/wtf/Optional.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698