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

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

Issue 21430003: Implement interfaces in PaintInfo and make it a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@getterPaintInfo01
Patch Set: Fixed Linux compilation (hopefuly Windows too), addressing some reviewer's suggestions. Created 7 years, 4 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 /* 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 if (style()->isHorizontalWritingMode()) { 151 if (style()->isHorizontalWritingMode()) {
152 LayoutUnit yOff = (legend->y() > 0) ? LayoutUnit() : (legend->height() - borderTop()) / 2; 152 LayoutUnit yOff = (legend->y() > 0) ? LayoutUnit() : (legend->height() - borderTop()) / 2;
153 paintRect.setHeight(paintRect.height() - yOff); 153 paintRect.setHeight(paintRect.height() - yOff);
154 paintRect.setY(paintRect.y() + yOff); 154 paintRect.setY(paintRect.y() + yOff);
155 } else { 155 } else {
156 LayoutUnit xOff = (legend->x() > 0) ? LayoutUnit() : (legend->width() - borderLeft()) / 2; 156 LayoutUnit xOff = (legend->x() > 0) ? LayoutUnit() : (legend->width() - borderLeft()) / 2;
157 paintRect.setWidth(paintRect.width() - xOff); 157 paintRect.setWidth(paintRect.width() - xOff);
158 paintRect.setX(paintRect.x() + xOff); 158 paintRect.setX(paintRect.x() + xOff);
159 } 159 }
160 160
161 if (!boxShadowShouldBeAppliedToBackground(determineBackgroundBleedAvoidance( paintInfo.context))) 161 if (!boxShadowShouldBeAppliedToBackground(determineBackgroundBleedAvoidance( paintInfo.getContext())))
162 paintBoxShadow(paintInfo, paintRect, style(), Normal); 162 paintBoxShadow(paintInfo, paintRect, style(), Normal);
163 paintFillLayers(paintInfo, resolveColor(CSSPropertyBackgroundColor), style() ->backgroundLayers(), paintRect); 163 paintFillLayers(paintInfo, resolveColor(CSSPropertyBackgroundColor), style() ->backgroundLayers(), paintRect);
164 paintBoxShadow(paintInfo, paintRect, style(), Inset); 164 paintBoxShadow(paintInfo, paintRect, style(), Inset);
165 165
166 if (!style()->hasBorder()) 166 if (!style()->hasBorder())
167 return; 167 return;
168 168
169 // Create a clipping region around the legend and paint the border as normal 169 // Create a clipping region around the legend and paint the border as normal
170 GraphicsContext* graphicsContext = paintInfo.context; 170 GraphicsContext* graphicsContext = paintInfo.getContext();
171 GraphicsContextStateSaver stateSaver(*graphicsContext); 171 GraphicsContextStateSaver stateSaver(*graphicsContext);
172 172
173 // FIXME: We need to work with "rl" and "bt" block flow directions. In thos e 173 // FIXME: We need to work with "rl" and "bt" block flow directions. In thos e
174 // cases the legend is embedded in the right and bottom borders respectively . 174 // cases the legend is embedded in the right and bottom borders respectively .
175 // https://bugs.webkit.org/show_bug.cgi?id=47236 175 // https://bugs.webkit.org/show_bug.cgi?id=47236
176 if (style()->isHorizontalWritingMode()) { 176 if (style()->isHorizontalWritingMode()) {
177 LayoutUnit clipTop = paintRect.y(); 177 LayoutUnit clipTop = paintRect.y();
178 LayoutUnit clipHeight = max(static_cast<LayoutUnit>(style()->borderTopWi dth()), legend->height() - ((legend->height() - borderTop()) / 2)); 178 LayoutUnit clipHeight = max(static_cast<LayoutUnit>(style()->borderTopWi dth()), legend->height() - ((legend->height() - borderTop()) / 2));
179 graphicsContext->clipOut(pixelSnappedIntRect(paintRect.x() + legend->x() , clipTop, legend->width(), clipHeight)); 179 graphicsContext->clipOut(pixelSnappedIntRect(paintRect.x() + legend->x() , clipTop, legend->width(), clipHeight));
180 } else { 180 } else {
181 LayoutUnit clipLeft = paintRect.x(); 181 LayoutUnit clipLeft = paintRect.x();
182 LayoutUnit clipWidth = max(static_cast<LayoutUnit>(style()->borderLeftWi dth()), legend->width()); 182 LayoutUnit clipWidth = max(static_cast<LayoutUnit>(style()->borderLeftWi dth()), legend->width());
183 graphicsContext->clipOut(pixelSnappedIntRect(clipLeft, paintRect.y() + l egend->y(), clipWidth, legend->height())); 183 graphicsContext->clipOut(pixelSnappedIntRect(clipLeft, paintRect.y() + l egend->y(), clipWidth, legend->height()));
184 } 184 }
185 185
186 paintBorder(paintInfo, paintRect, style()); 186 paintBorder(paintInfo, paintRect, style());
187 } 187 }
188 188
189 void RenderFieldset::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOff set) 189 void RenderFieldset::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOff set)
190 { 190 {
191 if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask) 191 if (style()->visibility() != VISIBLE || paintInfo.getPhase() != PaintPhaseMa sk)
192 return; 192 return;
193 193
194 LayoutRect paintRect = LayoutRect(paintOffset, size()); 194 LayoutRect paintRect = LayoutRect(paintOffset, size());
195 RenderBox* legend = findLegend(); 195 RenderBox* legend = findLegend();
196 if (!legend) 196 if (!legend)
197 return RenderBlock::paintMask(paintInfo, paintOffset); 197 return RenderBlock::paintMask(paintInfo, paintOffset);
198 198
199 // FIXME: We need to work with "rl" and "bt" block flow directions. In thos e 199 // FIXME: We need to work with "rl" and "bt" block flow directions. In thos e
200 // cases the legend is embedded in the right and bottom borders respectively . 200 // cases the legend is embedded in the right and bottom borders respectively .
201 // https://bugs.webkit.org/show_bug.cgi?id=47236 201 // https://bugs.webkit.org/show_bug.cgi?id=47236
202 if (style()->isHorizontalWritingMode()) { 202 if (style()->isHorizontalWritingMode()) {
203 LayoutUnit yOff = (legend->y() > 0) ? LayoutUnit() : (legend->height() - borderTop()) / 2; 203 LayoutUnit yOff = (legend->y() > 0) ? LayoutUnit() : (legend->height() - borderTop()) / 2;
204 paintRect.expand(0, -yOff); 204 paintRect.expand(0, -yOff);
205 paintRect.move(0, yOff); 205 paintRect.move(0, yOff);
206 } else { 206 } else {
207 LayoutUnit xOff = (legend->x() > 0) ? LayoutUnit() : (legend->width() - borderLeft()) / 2; 207 LayoutUnit xOff = (legend->x() > 0) ? LayoutUnit() : (legend->width() - borderLeft()) / 2;
208 paintRect.expand(-xOff, 0); 208 paintRect.expand(-xOff, 0);
209 paintRect.move(xOff, 0); 209 paintRect.move(xOff, 0);
210 } 210 }
211 211
212 paintMaskImages(paintInfo, paintRect); 212 paintMaskImages(paintInfo, paintRect);
213 } 213 }
214 214
215 } // namespace WebCore 215 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698