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

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

Issue 1391753005: (WIP) Invalidation during painting (for synchronized painting) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 "core/paint/FieldsetPainter.h" 5 #include "core/paint/FieldsetPainter.h"
6 6
7 #include "core/layout/LayoutFieldset.h" 7 #include "core/layout/LayoutFieldset.h"
8 #include "core/paint/BoxDecorationData.h" 8 #include "core/paint/BoxDecorationData.h"
9 #include "core/paint/BoxPainter.h" 9 #include "core/paint/BoxPainter.h"
10 #include "core/paint/LayoutObjectDrawingRecorder.h" 10 #include "core/paint/LayoutObjectDrawingRecorder.h"
11 #include "core/paint/PaintInfo.h" 11 #include "core/paint/PaintInfo.h"
12 #include "platform/graphics/GraphicsContextStateSaver.h" 12 #include "platform/graphics/GraphicsContextStateSaver.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 void FieldsetPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, c onst LayoutPoint& paintOffset) 16 void FieldsetPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, c onst LayoutPoint& paintOffset)
17 { 17 {
18 LayoutRect paintRect(paintOffset, m_layoutFieldset.size()); 18 LayoutRect paintRect(paintOffset, m_layoutFieldset.size());
19 LayoutBox* legend = m_layoutFieldset.findInFlowLegend(); 19 LayoutBox* legend = m_layoutFieldset.findInFlowLegend();
20 if (!legend) 20 if (!legend)
21 return BoxPainter(m_layoutFieldset).paintBoxDecorationBackground(paintIn fo, paintOffset); 21 return BoxPainter(m_layoutFieldset).paintBoxDecorationBackground(paintIn fo, paintOffset);
22 22
23 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutFieldset, paintInfo.phase, paintOffset)) 23 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutFieldset, paintInfo.phase))
24 return; 24 return;
25 25
26 // FIXME: We need to work with "rl" and "bt" block flow directions. In thos e 26 // FIXME: We need to work with "rl" and "bt" block flow directions. In thos e
27 // cases the legend is embedded in the right and bottom borders respectively . 27 // cases the legend is embedded in the right and bottom borders respectively .
28 // https://bugs.webkit.org/show_bug.cgi?id=47236 28 // https://bugs.webkit.org/show_bug.cgi?id=47236
29 if (m_layoutFieldset.style()->isHorizontalWritingMode()) { 29 if (m_layoutFieldset.style()->isHorizontalWritingMode()) {
30 LayoutUnit yOff = (legend->location().y() > 0) ? LayoutUnit() : (legend- >size().height() - m_layoutFieldset.borderTop()) / 2; 30 LayoutUnit yOff = (legend->location().y() > 0) ? LayoutUnit() : (legend- >size().height() - m_layoutFieldset.borderTop()) / 2;
31 paintRect.setHeight(paintRect.height() - yOff); 31 paintRect.setHeight(paintRect.height() - yOff);
32 paintRect.setY(paintRect.y() + yOff); 32 paintRect.setY(paintRect.y() + yOff);
33 } else { 33 } else {
34 LayoutUnit xOff = (legend->location().x() > 0) ? LayoutUnit() : (legend- >size().width() - m_layoutFieldset.borderLeft()) / 2; 34 LayoutUnit xOff = (legend->location().x() > 0) ? LayoutUnit() : (legend- >size().width() - m_layoutFieldset.borderLeft()) / 2;
35 paintRect.setWidth(paintRect.width() - xOff); 35 paintRect.setWidth(paintRect.width() - xOff);
36 paintRect.setX(paintRect.x() + xOff); 36 paintRect.setX(paintRect.x() + xOff);
37 } 37 }
38 38
39 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset, pa intInfo.phase, paintRect, paintOffset); 39 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset, pa intInfo.phase, paintRect);
40 BoxDecorationData boxDecorationData(m_layoutFieldset); 40 BoxDecorationData boxDecorationData(m_layoutFieldset);
41 41
42 if (boxDecorationData.bleedAvoidance == BackgroundBleedNone) 42 if (boxDecorationData.bleedAvoidance == BackgroundBleedNone)
43 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutFieldset.styleR ef(), Normal); 43 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutFieldset.styleR ef(), Normal);
44 BoxPainter(m_layoutFieldset).paintFillLayers(paintInfo, boxDecorationData.ba ckgroundColor, m_layoutFieldset.style()->backgroundLayers(), paintRect); 44 BoxPainter(m_layoutFieldset).paintFillLayers(paintInfo, boxDecorationData.ba ckgroundColor, m_layoutFieldset.style()->backgroundLayers(), paintRect);
45 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutFieldset.styleRef() , Inset); 45 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutFieldset.styleRef() , Inset);
46 46
47 if (!boxDecorationData.hasBorderDecoration) 47 if (!boxDecorationData.hasBorderDecoration)
48 return; 48 return;
49 49
(...skipping 20 matching lines...) Expand all
70 void FieldsetPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoint& p aintOffset) 70 void FieldsetPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoint& p aintOffset)
71 { 71 {
72 if (m_layoutFieldset.style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask) 72 if (m_layoutFieldset.style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
73 return; 73 return;
74 74
75 LayoutRect paintRect = LayoutRect(paintOffset, m_layoutFieldset.size()); 75 LayoutRect paintRect = LayoutRect(paintOffset, m_layoutFieldset.size());
76 LayoutBox* legend = m_layoutFieldset.findInFlowLegend(); 76 LayoutBox* legend = m_layoutFieldset.findInFlowLegend();
77 if (!legend) 77 if (!legend)
78 return BoxPainter(m_layoutFieldset).paintMask(paintInfo, paintOffset); 78 return BoxPainter(m_layoutFieldset).paintMask(paintInfo, paintOffset);
79 79
80 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutFieldset, paintInfo.phase, paintOffset)) 80 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutFieldset, paintInfo.phase))
81 return; 81 return;
82 82
83 // FIXME: We need to work with "rl" and "bt" block flow directions. In thos e 83 // FIXME: We need to work with "rl" and "bt" block flow directions. In thos e
84 // cases the legend is embedded in the right and bottom borders respectively . 84 // cases the legend is embedded in the right and bottom borders respectively .
85 // https://bugs.webkit.org/show_bug.cgi?id=47236 85 // https://bugs.webkit.org/show_bug.cgi?id=47236
86 if (m_layoutFieldset.style()->isHorizontalWritingMode()) { 86 if (m_layoutFieldset.style()->isHorizontalWritingMode()) {
87 LayoutUnit yOff = (legend->location().y() > LayoutUnit()) ? LayoutUnit() : (legend->size().height() - m_layoutFieldset.borderTop()) / 2; 87 LayoutUnit yOff = (legend->location().y() > LayoutUnit()) ? LayoutUnit() : (legend->size().height() - m_layoutFieldset.borderTop()) / 2;
88 paintRect.expand(LayoutUnit(), -yOff); 88 paintRect.expand(LayoutUnit(), -yOff);
89 paintRect.move(LayoutUnit(), yOff); 89 paintRect.move(LayoutUnit(), yOff);
90 } else { 90 } else {
91 LayoutUnit xOff = (legend->location().x() > LayoutUnit()) ? LayoutUnit() : (legend->size().width() - m_layoutFieldset.borderLeft()) / 2; 91 LayoutUnit xOff = (legend->location().x() > LayoutUnit()) ? LayoutUnit() : (legend->size().width() - m_layoutFieldset.borderLeft()) / 2;
92 paintRect.expand(-xOff, LayoutUnit()); 92 paintRect.expand(-xOff, LayoutUnit());
93 paintRect.move(xOff, LayoutUnit()); 93 paintRect.move(xOff, LayoutUnit());
94 } 94 }
95 95
96 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset, pa intInfo.phase, paintRect, paintOffset); 96 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset, pa intInfo.phase, paintRect);
97 BoxPainter(m_layoutFieldset).paintMaskImages(paintInfo, paintRect); 97 BoxPainter(m_layoutFieldset).paintMaskImages(paintInfo, paintRect);
98 } 98 }
99 99
100 } // namespace blink 100 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698