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

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

Issue 1512803004: Use refs for GraphicsContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarTheme
Patch Set: Created 5 years 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 17 matching lines...) Expand all
28 } 28 }
29 29
30 void FrameSetPainter::paintColumnBorder(const PaintInfo& paintInfo, const IntRec t& borderRect) 30 void FrameSetPainter::paintColumnBorder(const PaintInfo& paintInfo, const IntRec t& borderRect)
31 { 31 {
32 if (!paintInfo.cullRect().intersectsCullRect(borderRect)) 32 if (!paintInfo.cullRect().intersectsCullRect(borderRect))
33 return; 33 return;
34 34
35 // FIXME: We should do something clever when borders from distinct framesets meet at a join. 35 // FIXME: We should do something clever when borders from distinct framesets meet at a join.
36 36
37 // Fill first. 37 // Fill first.
38 GraphicsContext* context = paintInfo.context; 38 GraphicsContext& context = paintInfo.context;
39 context->fillRect(borderRect, m_layoutFrameSet.frameSet()->hasBorderColor() ? m_layoutFrameSet.resolveColor(CSSPropertyBorderLeftColor) : borderFillColor()) ; 39 context.fillRect(borderRect, m_layoutFrameSet.frameSet()->hasBorderColor() ? m_layoutFrameSet.resolveColor(CSSPropertyBorderLeftColor) : borderFillColor());
40 40
41 // Now stroke the edges but only if we have enough room to paint both edges with a little 41 // Now stroke the edges but only if we have enough room to paint both edges with a little
42 // bit of the fill color showing through. 42 // bit of the fill color showing through.
43 if (borderRect.width() >= 3) { 43 if (borderRect.width() >= 3) {
44 context->fillRect(IntRect(borderRect.location(), IntSize(1, borderRect.h eight())), borderStartEdgeColor()); 44 context.fillRect(IntRect(borderRect.location(), IntSize(1, borderRect.he ight())), borderStartEdgeColor());
45 context->fillRect(IntRect(IntPoint(borderRect.maxX() - 1, borderRect.y() ), IntSize(1, borderRect.height())), borderEndEdgeColor()); 45 context.fillRect(IntRect(IntPoint(borderRect.maxX() - 1, borderRect.y()) , IntSize(1, borderRect.height())), borderEndEdgeColor());
46 } 46 }
47 } 47 }
48 48
49 void FrameSetPainter::paintRowBorder(const PaintInfo& paintInfo, const IntRect& borderRect) 49 void FrameSetPainter::paintRowBorder(const PaintInfo& paintInfo, const IntRect& borderRect)
50 { 50 {
51 // FIXME: We should do something clever when borders from distinct framesets meet at a join. 51 // FIXME: We should do something clever when borders from distinct framesets meet at a join.
52 52
53 // Fill first. 53 // Fill first.
54 GraphicsContext* context = paintInfo.context; 54 GraphicsContext& context = paintInfo.context;
55 context->fillRect(borderRect, m_layoutFrameSet.frameSet()->hasBorderColor() ? m_layoutFrameSet.resolveColor(CSSPropertyBorderLeftColor) : borderFillColor()) ; 55 context.fillRect(borderRect, m_layoutFrameSet.frameSet()->hasBorderColor() ? m_layoutFrameSet.resolveColor(CSSPropertyBorderLeftColor) : borderFillColor());
56 56
57 // Now stroke the edges but only if we have enough room to paint both edges with a little 57 // Now stroke the edges but only if we have enough room to paint both edges with a little
58 // bit of the fill color showing through. 58 // bit of the fill color showing through.
59 if (borderRect.height() >= 3) { 59 if (borderRect.height() >= 3) {
60 context->fillRect(IntRect(borderRect.location(), IntSize(borderRect.widt h(), 1)), borderStartEdgeColor()); 60 context.fillRect(IntRect(borderRect.location(), IntSize(borderRect.width (), 1)), borderStartEdgeColor());
61 context->fillRect(IntRect(IntPoint(borderRect.x(), borderRect.maxY() - 1 ), IntSize(borderRect.width(), 1)), borderEndEdgeColor()); 61 context.fillRect(IntRect(IntPoint(borderRect.x(), borderRect.maxY() - 1) , IntSize(borderRect.width(), 1)), borderEndEdgeColor());
62 } 62 }
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, adjustedPaintOffset)) 73 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutFrameSet, paintInfo.phase, adjustedPaintOffset))
74 return; 74 return;
75 75
76 LayoutRect adjustedFrameRect(adjustedPaintOffset, m_layoutFrameSet.size()); 76 LayoutRect adjustedFrameRect(adjustedPaintOffset, m_layoutFrameSet.size());
77 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutFrameSet, p aintInfo.phase, adjustedFrameRect, adjustedPaintOffset); 77 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFrameSet, pa intInfo.phase, adjustedFrameRect, adjustedPaintOffset);
78 78
79 LayoutUnit borderThickness = m_layoutFrameSet.frameSet()->border(); 79 LayoutUnit borderThickness = m_layoutFrameSet.frameSet()->border();
80 if (!borderThickness) 80 if (!borderThickness)
81 return; 81 return;
82 82
83 LayoutObject* child = m_layoutFrameSet.firstChild(); 83 LayoutObject* child = m_layoutFrameSet.firstChild();
84 size_t rows = m_layoutFrameSet.rows().m_sizes.size(); 84 size_t rows = m_layoutFrameSet.rows().m_sizes.size();
85 size_t cols = m_layoutFrameSet.columns().m_sizes.size(); 85 size_t cols = m_layoutFrameSet.columns().m_sizes.size();
86 LayoutUnit yPos = 0; 86 LayoutUnit yPos = 0;
87 for (size_t r = 0; r < rows; r++) { 87 for (size_t r = 0; r < rows; r++) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 LayoutObject* child = m_layoutFrameSet.firstChild(); 134 LayoutObject* child = m_layoutFrameSet.firstChild();
135 if (!child) 135 if (!child)
136 return; 136 return;
137 137
138 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutFrameSet.location(); 138 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutFrameSet.location();
139 paintChildren(paintInfo, adjustedPaintOffset); 139 paintChildren(paintInfo, adjustedPaintOffset);
140 paintBorders(paintInfo, adjustedPaintOffset); 140 paintBorders(paintInfo, adjustedPaintOffset);
141 } 141 }
142 142
143 } // namespace blink 143 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/FramePainter.cpp ('k') | third_party/WebKit/Source/core/paint/HTMLCanvasPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698