OLD | NEW |
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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( | 25 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( |
26 paintInfo.context, m_layoutFieldset, paintInfo.phase)) | 26 paintInfo.context, m_layoutFieldset, paintInfo.phase)) |
27 return; | 27 return; |
28 | 28 |
29 // FIXME: We need to work with "rl" and "bt" block flow directions. In those | 29 // FIXME: We need to work with "rl" and "bt" block flow directions. In those |
30 // cases the legend is embedded in the right and bottom borders respectively. | 30 // cases the legend is embedded in the right and bottom borders respectively. |
31 // https://bugs.webkit.org/show_bug.cgi?id=47236 | 31 // https://bugs.webkit.org/show_bug.cgi?id=47236 |
32 if (m_layoutFieldset.style()->isHorizontalWritingMode()) { | 32 if (m_layoutFieldset.style()->isHorizontalWritingMode()) { |
33 LayoutUnit yOff = | 33 LayoutUnit yOff = |
34 (legend->location().y() > 0) | 34 (legend->location().y() + |
35 ? LayoutUnit() | 35 (legend->size().height() - m_layoutFieldset.borderTop()) / 2) |
36 : (legend->size().height() - m_layoutFieldset.borderTop()) / 2; | 36 .clampNegativeToZero(); |
| 37 |
37 paintRect.setHeight(paintRect.height() - yOff); | 38 paintRect.setHeight(paintRect.height() - yOff); |
38 paintRect.setY(paintRect.y() + yOff); | 39 paintRect.setY(paintRect.y() + yOff); |
39 } else { | 40 } else { |
40 LayoutUnit xOff = | 41 LayoutUnit xOff = |
41 (legend->location().x() > 0) | 42 (legend->location().x() + |
42 ? LayoutUnit() | 43 (legend->size().width() - m_layoutFieldset.borderLeft()) / 2) |
43 : (legend->size().width() - m_layoutFieldset.borderLeft()) / 2; | 44 .clampNegativeToZero(); |
| 45 |
44 paintRect.setWidth(paintRect.width() - xOff); | 46 paintRect.setWidth(paintRect.width() - xOff); |
45 paintRect.setX(paintRect.x() + xOff); | 47 paintRect.setX(paintRect.x() + xOff); |
46 } | 48 } |
47 | 49 |
48 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset, | 50 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset, |
49 paintInfo.phase, paintRect); | 51 paintInfo.phase, paintRect); |
50 BoxDecorationData boxDecorationData(m_layoutFieldset); | 52 BoxDecorationData boxDecorationData(m_layoutFieldset); |
51 | 53 |
52 if (boxDecorationData.bleedAvoidance == BackgroundBleedNone) | 54 if (boxDecorationData.bleedAvoidance == BackgroundBleedNone) |
53 BoxPainter::paintBoxShadow(paintInfo, paintRect, | 55 BoxPainter::paintBoxShadow(paintInfo, paintRect, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 106 |
105 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( | 107 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( |
106 paintInfo.context, m_layoutFieldset, paintInfo.phase)) | 108 paintInfo.context, m_layoutFieldset, paintInfo.phase)) |
107 return; | 109 return; |
108 | 110 |
109 // FIXME: We need to work with "rl" and "bt" block flow directions. In those | 111 // FIXME: We need to work with "rl" and "bt" block flow directions. In those |
110 // cases the legend is embedded in the right and bottom borders respectively. | 112 // cases the legend is embedded in the right and bottom borders respectively. |
111 // https://bugs.webkit.org/show_bug.cgi?id=47236 | 113 // https://bugs.webkit.org/show_bug.cgi?id=47236 |
112 if (m_layoutFieldset.style()->isHorizontalWritingMode()) { | 114 if (m_layoutFieldset.style()->isHorizontalWritingMode()) { |
113 LayoutUnit yOff = | 115 LayoutUnit yOff = |
114 (legend->location().y() > LayoutUnit()) | 116 (legend->location().y() + |
115 ? LayoutUnit() | 117 (legend->size().height() - m_layoutFieldset.borderTop()) / 2) |
116 : (legend->size().height() - m_layoutFieldset.borderTop()) / 2; | 118 .clampNegativeToZero(); |
| 119 |
117 paintRect.expand(LayoutUnit(), -yOff); | 120 paintRect.expand(LayoutUnit(), -yOff); |
118 paintRect.move(LayoutUnit(), yOff); | 121 paintRect.move(LayoutUnit(), yOff); |
119 } else { | 122 } else { |
120 LayoutUnit xOff = | 123 LayoutUnit xOff = |
121 (legend->location().x() > LayoutUnit()) | 124 (legend->location().x() + |
122 ? LayoutUnit() | 125 (legend->size().width() - m_layoutFieldset.borderLeft()) / 2) |
123 : (legend->size().width() - m_layoutFieldset.borderLeft()) / 2; | 126 .clampNegativeToZero(); |
| 127 |
124 paintRect.expand(-xOff, LayoutUnit()); | 128 paintRect.expand(-xOff, LayoutUnit()); |
125 paintRect.move(xOff, LayoutUnit()); | 129 paintRect.move(xOff, LayoutUnit()); |
126 } | 130 } |
127 | 131 |
128 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset, | 132 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset, |
129 paintInfo.phase, paintRect); | 133 paintInfo.phase, paintRect); |
130 BoxPainter(m_layoutFieldset).paintMaskImages(paintInfo, paintRect); | 134 BoxPainter(m_layoutFieldset).paintMaskImages(paintInfo, paintRect); |
131 } | 135 } |
132 | 136 |
133 } // namespace blink | 137 } // namespace blink |
OLD | NEW |