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

Side by Side Diff: Source/core/rendering/RenderFieldset.cpp

Issue 564973002: Move a bunch more painting code out of RenderBoxModelObject and into BoxPainter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove unnecessary include. Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 paintRect.setHeight(paintRect.height() - yOff); 156 paintRect.setHeight(paintRect.height() - yOff);
157 paintRect.setY(paintRect.y() + yOff); 157 paintRect.setY(paintRect.y() + yOff);
158 } else { 158 } else {
159 LayoutUnit xOff = (legend->x() > 0) ? LayoutUnit() : (legend->width() - borderLeft()) / 2; 159 LayoutUnit xOff = (legend->x() > 0) ? LayoutUnit() : (legend->width() - borderLeft()) / 2;
160 paintRect.setWidth(paintRect.width() - xOff); 160 paintRect.setWidth(paintRect.width() - xOff);
161 paintRect.setX(paintRect.x() + xOff); 161 paintRect.setX(paintRect.x() + xOff);
162 } 162 }
163 163
164 BoxDecorationData boxDecorationData(*style(), canRenderBorderImage(), backgr oundHasOpaqueTopLayer(), paintInfo.context); 164 BoxDecorationData boxDecorationData(*style(), canRenderBorderImage(), backgr oundHasOpaqueTopLayer(), paintInfo.context);
165 165
166 BoxPainter boxPainter(*this);
166 if (boxDecorationData.bleedAvoidance() == BackgroundBleedNone) 167 if (boxDecorationData.bleedAvoidance() == BackgroundBleedNone)
167 paintBoxShadow(paintInfo, paintRect, style(), Normal); 168 boxPainter.paintBoxShadow(paintInfo, paintRect, style(), Normal);
168 BoxPainter(*this).paintFillLayers(paintInfo, boxDecorationData.backgroundCol or, style()->backgroundLayers(), paintRect); 169 boxPainter.paintFillLayers(paintInfo, boxDecorationData.backgroundColor, sty le()->backgroundLayers(), paintRect);
169 paintBoxShadow(paintInfo, paintRect, style(), Inset); 170 boxPainter.paintBoxShadow(paintInfo, paintRect, style(), Inset);
170 171
171 if (!boxDecorationData.hasBorder) 172 if (!boxDecorationData.hasBorder)
172 return; 173 return;
173 174
174 // Create a clipping region around the legend and paint the border as normal 175 // Create a clipping region around the legend and paint the border as normal
175 GraphicsContext* graphicsContext = paintInfo.context; 176 GraphicsContext* graphicsContext = paintInfo.context;
176 GraphicsContextStateSaver stateSaver(*graphicsContext); 177 GraphicsContextStateSaver stateSaver(*graphicsContext);
177 178
178 // FIXME: We need to work with "rl" and "bt" block flow directions. In thos e 179 // FIXME: We need to work with "rl" and "bt" block flow directions. In thos e
179 // cases the legend is embedded in the right and bottom borders respectively . 180 // cases the legend is embedded in the right and bottom borders respectively .
180 // https://bugs.webkit.org/show_bug.cgi?id=47236 181 // https://bugs.webkit.org/show_bug.cgi?id=47236
181 if (style()->isHorizontalWritingMode()) { 182 if (style()->isHorizontalWritingMode()) {
182 LayoutUnit clipTop = paintRect.y(); 183 LayoutUnit clipTop = paintRect.y();
183 LayoutUnit clipHeight = max(static_cast<LayoutUnit>(style()->borderTopWi dth()), legend->height() - ((legend->height() - borderTop()) / 2)); 184 LayoutUnit clipHeight = max(static_cast<LayoutUnit>(style()->borderTopWi dth()), legend->height() - ((legend->height() - borderTop()) / 2));
184 graphicsContext->clipOut(pixelSnappedIntRect(paintRect.x() + legend->x() , clipTop, legend->width(), clipHeight)); 185 graphicsContext->clipOut(pixelSnappedIntRect(paintRect.x() + legend->x() , clipTop, legend->width(), clipHeight));
185 } else { 186 } else {
186 LayoutUnit clipLeft = paintRect.x(); 187 LayoutUnit clipLeft = paintRect.x();
187 LayoutUnit clipWidth = max(static_cast<LayoutUnit>(style()->borderLeftWi dth()), legend->width()); 188 LayoutUnit clipWidth = max(static_cast<LayoutUnit>(style()->borderLeftWi dth()), legend->width());
188 graphicsContext->clipOut(pixelSnappedIntRect(clipLeft, paintRect.y() + l egend->y(), clipWidth, legend->height())); 189 graphicsContext->clipOut(pixelSnappedIntRect(clipLeft, paintRect.y() + l egend->y(), clipWidth, legend->height()));
189 } 190 }
190 191
191 paintBorder(paintInfo, paintRect, style()); 192 BoxPainter(*this).paintBorder(paintInfo, paintRect, style());
pdr. 2014/09/11 21:00:39 Can you use the boxPainter local from above?
chrishtr 2014/09/11 21:26:35 Done.
192 } 193 }
193 194
194 void RenderFieldset::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOff set) 195 void RenderFieldset::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOff set)
195 { 196 {
196 if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask) 197 if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
197 return; 198 return;
198 199
199 LayoutRect paintRect = LayoutRect(paintOffset, size()); 200 LayoutRect paintRect = LayoutRect(paintOffset, size());
200 RenderBox* legend = findLegend(); 201 RenderBox* legend = findLegend();
201 if (!legend) 202 if (!legend)
202 return RenderBlockFlow::paintMask(paintInfo, paintOffset); 203 return RenderBlockFlow::paintMask(paintInfo, paintOffset);
203 204
204 // FIXME: We need to work with "rl" and "bt" block flow directions. In thos e 205 // FIXME: We need to work with "rl" and "bt" block flow directions. In thos e
205 // cases the legend is embedded in the right and bottom borders respectively . 206 // cases the legend is embedded in the right and bottom borders respectively .
206 // https://bugs.webkit.org/show_bug.cgi?id=47236 207 // https://bugs.webkit.org/show_bug.cgi?id=47236
207 if (style()->isHorizontalWritingMode()) { 208 if (style()->isHorizontalWritingMode()) {
208 LayoutUnit yOff = (legend->y() > 0) ? LayoutUnit() : (legend->height() - borderTop()) / 2; 209 LayoutUnit yOff = (legend->y() > 0) ? LayoutUnit() : (legend->height() - borderTop()) / 2;
209 paintRect.expand(0, -yOff); 210 paintRect.expand(0, -yOff);
210 paintRect.move(0, yOff); 211 paintRect.move(0, yOff);
211 } else { 212 } else {
212 LayoutUnit xOff = (legend->x() > 0) ? LayoutUnit() : (legend->width() - borderLeft()) / 2; 213 LayoutUnit xOff = (legend->x() > 0) ? LayoutUnit() : (legend->width() - borderLeft()) / 2;
213 paintRect.expand(-xOff, 0); 214 paintRect.expand(-xOff, 0);
214 paintRect.move(xOff, 0); 215 paintRect.move(xOff, 0);
215 } 216 }
216 217
217 BoxPainter(*this).paintMaskImages(paintInfo, paintRect); 218 BoxPainter(*this).paintMaskImages(paintInfo, paintRect);
218 } 219 }
219 220
220 } // namespace blink 221 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698