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

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

Issue 1220583004: Refactor DrawingRecorders to check for cached drawings earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix some !'s and &&'s. De Morgan would be proud. Created 5 years, 5 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 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/FrameSetPainter.h" 6 #include "core/paint/FrameSetPainter.h"
7 7
8 #include "core/html/HTMLFrameSetElement.h" 8 #include "core/html/HTMLFrameSetElement.h"
9 #include "core/layout/LayoutFrameSet.h" 9 #include "core/layout/LayoutFrameSet.h"
10 #include "core/paint/LayoutObjectDrawingRecorder.h" 10 #include "core/paint/LayoutObjectDrawingRecorder.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 static bool shouldPaintBorderAfter(const LayoutFrameSet::GridAxis& axis, size_t index) 65 static bool shouldPaintBorderAfter(const LayoutFrameSet::GridAxis& axis, size_t index)
66 { 66 {
67 // Should not paint a border after the last frame along the axis. 67 // Should not paint a border after the last frame along the axis.
68 return index + 1 < axis.m_sizes.size() && axis.m_allowBorder[index + 1]; 68 return index + 1 < axis.m_sizes.size() && axis.m_allowBorder[index + 1];
69 } 69 }
70 70
71 void FrameSetPainter::paintBorders(const PaintInfo& paintInfo, const LayoutPoint & adjustedPaintOffset) 71 void FrameSetPainter::paintBorders(const PaintInfo& paintInfo, const LayoutPoint & adjustedPaintOffset)
72 { 72 {
73 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.conte xt, m_layoutFrameSet, paintInfo.phase))
74 return;
75
73 LayoutRect adjustedFrameRect(adjustedPaintOffset, m_layoutFrameSet.size()); 76 LayoutRect adjustedFrameRect(adjustedPaintOffset, m_layoutFrameSet.size());
74 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutFrameSet, p aintInfo.phase, adjustedFrameRect); 77 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutFrameSet, p aintInfo.phase, adjustedFrameRect);
75 if (recorder.canUseCachedDrawing())
76 return;
77 78
78 LayoutUnit borderThickness = m_layoutFrameSet.frameSet()->border(); 79 LayoutUnit borderThickness = m_layoutFrameSet.frameSet()->border();
79 if (!borderThickness) 80 if (!borderThickness)
80 return; 81 return;
81 82
82 LayoutObject* child = m_layoutFrameSet.firstChild(); 83 LayoutObject* child = m_layoutFrameSet.firstChild();
83 size_t rows = m_layoutFrameSet.rows().m_sizes.size(); 84 size_t rows = m_layoutFrameSet.rows().m_sizes.size();
84 size_t cols = m_layoutFrameSet.columns().m_sizes.size(); 85 size_t cols = m_layoutFrameSet.columns().m_sizes.size();
85 LayoutUnit yPos = 0; 86 LayoutUnit yPos = 0;
86 for (size_t r = 0; r < rows; r++) { 87 for (size_t r = 0; r < rows; r++) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 LayoutObject* child = m_layoutFrameSet.firstChild(); 135 LayoutObject* child = m_layoutFrameSet.firstChild();
135 if (!child) 136 if (!child)
136 return; 137 return;
137 138
138 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutFrameSet.location(); 139 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutFrameSet.location();
139 paintChildren(paintInfo, adjustedPaintOffset); 140 paintChildren(paintInfo, adjustedPaintOffset);
140 paintBorders(paintInfo, adjustedPaintOffset); 141 paintBorders(paintInfo, adjustedPaintOffset);
141 } 142 }
142 143
143 } // namespace blink 144 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698