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

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

Issue 930503003: [S.P.] Add drawing recorder for FrameSetPainter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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/PaintInfo.h" 9 #include "core/layout/PaintInfo.h"
10 #include "core/paint/GraphicsContextAnnotator.h" 10 #include "core/paint/GraphicsContextAnnotator.h"
11 #include "core/paint/RenderDrawingRecorder.h"
11 #include "core/rendering/RenderFrameSet.h" 12 #include "core/rendering/RenderFrameSet.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 static Color borderStartEdgeColor() 16 static Color borderStartEdgeColor()
16 { 17 {
17 return Color(170, 170, 170); 18 return Color(170, 170, 170);
18 } 19 }
19 20
20 static Color borderEndEdgeColor() 21 static Color borderEndEdgeColor()
21 { 22 {
22 return Color::black; 23 return Color::black;
23 } 24 }
24 25
25 static Color borderFillColor() 26 static Color borderFillColor()
26 { 27 {
27 return Color(208, 208, 208); 28 return Color(208, 208, 208);
28 } 29 }
29 30
30 void FrameSetPainter::paintColumnBorder(const PaintInfo& paintInfo, const IntRec t& borderRect) 31 void FrameSetPainter::paintColumnBorder(const PaintInfo& paintInfo, const IntRec t& borderRect)
31 { 32 {
32 if (!paintInfo.rect.intersects(borderRect)) 33 if (!paintInfo.rect.intersects(borderRect))
33 return; 34 return;
34 35
35 // FIXME: We should do something clever when borders from distinct framesets meet at a join. 36 // FIXME: We should do something clever when borders from distinct framesets meet at a join.
36 37
38 RenderDrawingRecorder renderDrawingRecorder(paintInfo.context, m_renderFrame Set, paintInfo.phase, borderRect);
jbroman 2015/02/26 00:22:35 For future reference, this will produce lots of di
39 if (renderDrawingRecorder.canUseCachedDrawing())
40 return;
41
37 // Fill first. 42 // Fill first.
38 GraphicsContext* context = paintInfo.context; 43 GraphicsContext* context = paintInfo.context;
39 context->fillRect(borderRect, m_renderFrameSet.frameSet()->hasBorderColor() ? m_renderFrameSet.resolveColor(CSSPropertyBorderLeftColor) : borderFillColor()) ; 44 context->fillRect(borderRect, m_renderFrameSet.frameSet()->hasBorderColor() ? m_renderFrameSet.resolveColor(CSSPropertyBorderLeftColor) : borderFillColor()) ;
40 45
41 // Now stroke the edges but only if we have enough room to paint both edges with a little 46 // 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. 47 // bit of the fill color showing through.
43 if (borderRect.width() >= 3) { 48 if (borderRect.width() >= 3) {
44 context->fillRect(IntRect(borderRect.location(), IntSize(1, m_renderFram eSet.size().height())), borderStartEdgeColor()); 49 context->fillRect(IntRect(borderRect.location(), IntSize(1, m_renderFram eSet.size().height())), borderStartEdgeColor());
45 context->fillRect(IntRect(IntPoint(borderRect.maxX() - 1, borderRect.y() ), IntSize(1, m_renderFrameSet.size().height())), borderEndEdgeColor()); 50 context->fillRect(IntRect(IntPoint(borderRect.maxX() - 1, borderRect.y() ), IntSize(1, m_renderFrameSet.size().height())), borderEndEdgeColor());
46 } 51 }
47 } 52 }
48 53
49 void FrameSetPainter::paintRowBorder(const PaintInfo& paintInfo, const IntRect& borderRect) 54 void FrameSetPainter::paintRowBorder(const PaintInfo& paintInfo, const IntRect& borderRect)
50 { 55 {
51 if (!paintInfo.rect.intersects(borderRect)) 56 if (!paintInfo.rect.intersects(borderRect))
52 return; 57 return;
53 58
54 // FIXME: We should do something clever when borders from distinct framesets meet at a join. 59 // FIXME: We should do something clever when borders from distinct framesets meet at a join.
55 60
61 RenderDrawingRecorder renderDrawingRecorder(paintInfo.context, m_renderFrame Set, paintInfo.phase, borderRect);
62 if (renderDrawingRecorder.canUseCachedDrawing())
63 return;
64
56 // Fill first. 65 // Fill first.
57 GraphicsContext* context = paintInfo.context; 66 GraphicsContext* context = paintInfo.context;
58 context->fillRect(borderRect, m_renderFrameSet.frameSet()->hasBorderColor() ? m_renderFrameSet.resolveColor(CSSPropertyBorderLeftColor) : borderFillColor()) ; 67 context->fillRect(borderRect, m_renderFrameSet.frameSet()->hasBorderColor() ? m_renderFrameSet.resolveColor(CSSPropertyBorderLeftColor) : borderFillColor()) ;
59 68
60 // Now stroke the edges but only if we have enough room to paint both edges with a little 69 // Now stroke the edges but only if we have enough room to paint both edges with a little
61 // bit of the fill color showing through. 70 // bit of the fill color showing through.
62 if (borderRect.height() >= 3) { 71 if (borderRect.height() >= 3) {
63 context->fillRect(IntRect(borderRect.location(), IntSize(m_renderFrameSe t.size().width(), 1)), borderStartEdgeColor()); 72 context->fillRect(IntRect(borderRect.location(), IntSize(m_renderFrameSe t.size().width(), 1)), borderStartEdgeColor());
64 context->fillRect(IntRect(IntPoint(borderRect.x(), borderRect.maxY() - 1 ), IntSize(m_renderFrameSet.size().width(), 1)), borderEndEdgeColor()); 73 context->fillRect(IntRect(IntPoint(borderRect.x(), borderRect.maxY() - 1 ), IntSize(m_renderFrameSet.size().width(), 1)), borderEndEdgeColor());
65 } 74 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 yPos += m_renderFrameSet.rows().m_sizes[r]; 109 yPos += m_renderFrameSet.rows().m_sizes[r];
101 if (borderThickness && m_renderFrameSet.rows().m_allowBorder[r + 1]) { 110 if (borderThickness && m_renderFrameSet.rows().m_allowBorder[r + 1]) {
102 paintRowBorder(paintInfo, pixelSnappedIntRect( 111 paintRowBorder(paintInfo, pixelSnappedIntRect(
103 LayoutRect(adjustedPaintOffset.x(), adjustedPaintOffset.y() + yP os, m_renderFrameSet.size().width(), borderThickness))); 112 LayoutRect(adjustedPaintOffset.x(), adjustedPaintOffset.y() + yP os, m_renderFrameSet.size().width(), borderThickness)));
104 yPos += borderThickness; 113 yPos += borderThickness;
105 } 114 }
106 } 115 }
107 } 116 }
108 117
109 } // namespace blink 118 } // namespace blink
OLDNEW
« LayoutTests/TestExpectations ('K') | « LayoutTests/virtual/slimmingpaint/fast/frames/README.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698