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

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

Issue 2558683002: Revert of Support margin-top for legend in fieldset. (Closed)
Patch Set: rebaseline Created 4 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutFieldset.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 13 matching lines...) Expand all
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() + 34 (legend->location().y() > 0)
35 (legend->size().height() - m_layoutFieldset.borderTop()) / 2) 35 ? LayoutUnit()
36 .clampNegativeToZero(); 36 : (legend->size().height() - m_layoutFieldset.borderTop()) / 2;
37
38 paintRect.setHeight(paintRect.height() - yOff); 37 paintRect.setHeight(paintRect.height() - yOff);
39 paintRect.setY(paintRect.y() + yOff); 38 paintRect.setY(paintRect.y() + yOff);
40 } else { 39 } else {
41 LayoutUnit xOff = 40 LayoutUnit xOff =
42 (legend->location().x() + 41 (legend->location().x() > 0)
43 (legend->size().width() - m_layoutFieldset.borderLeft()) / 2) 42 ? LayoutUnit()
44 .clampNegativeToZero(); 43 : (legend->size().width() - m_layoutFieldset.borderLeft()) / 2;
45
46 paintRect.setWidth(paintRect.width() - xOff); 44 paintRect.setWidth(paintRect.width() - xOff);
47 paintRect.setX(paintRect.x() + xOff); 45 paintRect.setX(paintRect.x() + xOff);
48 } 46 }
49 47
50 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset, 48 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset,
51 paintInfo.phase, paintRect); 49 paintInfo.phase, paintRect);
52 BoxDecorationData boxDecorationData(m_layoutFieldset); 50 BoxDecorationData boxDecorationData(m_layoutFieldset);
53 51
54 if (boxDecorationData.bleedAvoidance == BackgroundBleedNone) 52 if (boxDecorationData.bleedAvoidance == BackgroundBleedNone)
55 BoxPainter::paintBoxShadow(paintInfo, paintRect, 53 BoxPainter::paintBoxShadow(paintInfo, paintRect,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 104
107 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( 105 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(
108 paintInfo.context, m_layoutFieldset, paintInfo.phase)) 106 paintInfo.context, m_layoutFieldset, paintInfo.phase))
109 return; 107 return;
110 108
111 // FIXME: We need to work with "rl" and "bt" block flow directions. In those 109 // FIXME: We need to work with "rl" and "bt" block flow directions. In those
112 // cases the legend is embedded in the right and bottom borders respectively. 110 // cases the legend is embedded in the right and bottom borders respectively.
113 // https://bugs.webkit.org/show_bug.cgi?id=47236 111 // https://bugs.webkit.org/show_bug.cgi?id=47236
114 if (m_layoutFieldset.style()->isHorizontalWritingMode()) { 112 if (m_layoutFieldset.style()->isHorizontalWritingMode()) {
115 LayoutUnit yOff = 113 LayoutUnit yOff =
116 (legend->location().y() + 114 (legend->location().y() > LayoutUnit())
117 (legend->size().height() - m_layoutFieldset.borderTop()) / 2) 115 ? LayoutUnit()
118 .clampNegativeToZero(); 116 : (legend->size().height() - m_layoutFieldset.borderTop()) / 2;
119
120 paintRect.expand(LayoutUnit(), -yOff); 117 paintRect.expand(LayoutUnit(), -yOff);
121 paintRect.move(LayoutUnit(), yOff); 118 paintRect.move(LayoutUnit(), yOff);
122 } else { 119 } else {
123 LayoutUnit xOff = 120 LayoutUnit xOff =
124 (legend->location().x() + 121 (legend->location().x() > LayoutUnit())
125 (legend->size().width() - m_layoutFieldset.borderLeft()) / 2) 122 ? LayoutUnit()
126 .clampNegativeToZero(); 123 : (legend->size().width() - m_layoutFieldset.borderLeft()) / 2;
127
128 paintRect.expand(-xOff, LayoutUnit()); 124 paintRect.expand(-xOff, LayoutUnit());
129 paintRect.move(xOff, LayoutUnit()); 125 paintRect.move(xOff, LayoutUnit());
130 } 126 }
131 127
132 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset, 128 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset,
133 paintInfo.phase, paintRect); 129 paintInfo.phase, paintRect);
134 BoxPainter(m_layoutFieldset).paintMaskImages(paintInfo, paintRect); 130 BoxPainter(m_layoutFieldset).paintMaskImages(paintInfo, paintRect);
135 } 131 }
136 132
137 } // namespace blink 133 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutFieldset.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698