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

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: Merged, made more things static. 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (boxDecorationData.bleedAvoidance() == BackgroundBleedNone) 166 if (boxDecorationData.bleedAvoidance() == BackgroundBleedNone)
167 paintBoxShadow(paintInfo, paintRect, style(), Normal); 167 BoxPainter::paintBoxShadow(paintInfo, paintRect, style(), Normal);
168 BoxPainter(*this).paintFillLayers(paintInfo, boxDecorationData.backgroundCol or, style()->backgroundLayers(), paintRect); 168 BoxPainter(*this).paintFillLayers(paintInfo, boxDecorationData.backgroundCol or, style()->backgroundLayers(), paintRect);
169 paintBoxShadow(paintInfo, paintRect, style(), Inset); 169 BoxPainter::paintBoxShadow(paintInfo, paintRect, style(), Inset);
170 170
171 if (!boxDecorationData.hasBorder) 171 if (!boxDecorationData.hasBorder)
172 return; 172 return;
173 173
174 // Create a clipping region around the legend and paint the border as normal 174 // Create a clipping region around the legend and paint the border as normal
175 GraphicsContext* graphicsContext = paintInfo.context; 175 GraphicsContext* graphicsContext = paintInfo.context;
176 GraphicsContextStateSaver stateSaver(*graphicsContext); 176 GraphicsContextStateSaver stateSaver(*graphicsContext);
177 177
178 // FIXME: We need to work with "rl" and "bt" block flow directions. In thos e 178 // 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 . 179 // cases the legend is embedded in the right and bottom borders respectively .
180 // https://bugs.webkit.org/show_bug.cgi?id=47236 180 // https://bugs.webkit.org/show_bug.cgi?id=47236
181 if (style()->isHorizontalWritingMode()) { 181 if (style()->isHorizontalWritingMode()) {
182 LayoutUnit clipTop = paintRect.y(); 182 LayoutUnit clipTop = paintRect.y();
183 LayoutUnit clipHeight = max(static_cast<LayoutUnit>(style()->borderTopWi dth()), legend->height() - ((legend->height() - borderTop()) / 2)); 183 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)); 184 graphicsContext->clipOut(pixelSnappedIntRect(paintRect.x() + legend->x() , clipTop, legend->width(), clipHeight));
185 } else { 185 } else {
186 LayoutUnit clipLeft = paintRect.x(); 186 LayoutUnit clipLeft = paintRect.x();
187 LayoutUnit clipWidth = max(static_cast<LayoutUnit>(style()->borderLeftWi dth()), legend->width()); 187 LayoutUnit clipWidth = max(static_cast<LayoutUnit>(style()->borderLeftWi dth()), legend->width());
188 graphicsContext->clipOut(pixelSnappedIntRect(clipLeft, paintRect.y() + l egend->y(), clipWidth, legend->height())); 188 graphicsContext->clipOut(pixelSnappedIntRect(clipLeft, paintRect.y() + l egend->y(), clipWidth, legend->height()));
189 } 189 }
190 190
191 paintBorder(paintInfo, paintRect, style()); 191 BoxPainter::paintBorder(*this, paintInfo, paintRect, style());
192 } 192 }
193 193
194 void RenderFieldset::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOff set) 194 void RenderFieldset::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOff set)
195 { 195 {
196 if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask) 196 if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
197 return; 197 return;
198 198
199 LayoutRect paintRect = LayoutRect(paintOffset, size()); 199 LayoutRect paintRect = LayoutRect(paintOffset, size());
200 RenderBox* legend = findLegend(); 200 RenderBox* legend = findLegend();
201 if (!legend) 201 if (!legend)
202 return RenderBlockFlow::paintMask(paintInfo, paintOffset); 202 return RenderBlockFlow::paintMask(paintInfo, paintOffset);
203 203
204 // FIXME: We need to work with "rl" and "bt" block flow directions. In thos e 204 // 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 . 205 // cases the legend is embedded in the right and bottom borders respectively .
206 // https://bugs.webkit.org/show_bug.cgi?id=47236 206 // https://bugs.webkit.org/show_bug.cgi?id=47236
207 if (style()->isHorizontalWritingMode()) { 207 if (style()->isHorizontalWritingMode()) {
208 LayoutUnit yOff = (legend->y() > 0) ? LayoutUnit() : (legend->height() - borderTop()) / 2; 208 LayoutUnit yOff = (legend->y() > 0) ? LayoutUnit() : (legend->height() - borderTop()) / 2;
209 paintRect.expand(0, -yOff); 209 paintRect.expand(0, -yOff);
210 paintRect.move(0, yOff); 210 paintRect.move(0, yOff);
211 } else { 211 } else {
212 LayoutUnit xOff = (legend->x() > 0) ? LayoutUnit() : (legend->width() - borderLeft()) / 2; 212 LayoutUnit xOff = (legend->x() > 0) ? LayoutUnit() : (legend->width() - borderLeft()) / 2;
213 paintRect.expand(-xOff, 0); 213 paintRect.expand(-xOff, 0);
214 paintRect.move(xOff, 0); 214 paintRect.move(xOff, 0);
215 } 215 }
216 216
217 BoxPainter(*this).paintMaskImages(paintInfo, paintRect); 217 BoxPainter(*this).paintMaskImages(paintInfo, paintRect);
218 } 218 }
219 219
220 } // namespace blink 220 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698