| OLD | NEW |
| 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. |
| 11 * | 11 * |
| 12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
| 16 * | 16 * |
| 17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
| 18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
| 21 * | 21 * |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #include "config.h" | 24 #include "config.h" |
| 25 #include "core/rendering/RenderFieldset.h" | 25 #include "core/rendering/RenderFieldset.h" |
| 26 | 26 |
| 27 #include "core/CSSPropertyNames.h" | 27 #include "core/CSSPropertyNames.h" |
| 28 #include "core/HTMLNames.h" | 28 #include "core/HTMLNames.h" |
| 29 #include "core/html/HTMLLegendElement.h" | 29 #include "core/html/HTMLLegendElement.h" |
| 30 #include "core/paint/BoxDecorationData.h" |
| 31 #include "core/paint/BoxPainter.h" |
| 30 #include "core/rendering/PaintInfo.h" | 32 #include "core/rendering/PaintInfo.h" |
| 31 #include "platform/graphics/GraphicsContextStateSaver.h" | 33 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 32 | 34 |
| 33 using std::min; | 35 using std::min; |
| 34 using std::max; | 36 using std::max; |
| 35 | 37 |
| 36 namespace blink { | 38 namespace blink { |
| 37 | 39 |
| 38 using namespace HTMLNames; | 40 using namespace HTMLNames; |
| 39 | 41 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 if (style()->isHorizontalWritingMode()) { | 154 if (style()->isHorizontalWritingMode()) { |
| 153 LayoutUnit yOff = (legend->y() > 0) ? LayoutUnit() : (legend->height() -
borderTop()) / 2; | 155 LayoutUnit yOff = (legend->y() > 0) ? LayoutUnit() : (legend->height() -
borderTop()) / 2; |
| 154 paintRect.setHeight(paintRect.height() - yOff); | 156 paintRect.setHeight(paintRect.height() - yOff); |
| 155 paintRect.setY(paintRect.y() + yOff); | 157 paintRect.setY(paintRect.y() + yOff); |
| 156 } else { | 158 } else { |
| 157 LayoutUnit xOff = (legend->x() > 0) ? LayoutUnit() : (legend->width() -
borderLeft()) / 2; | 159 LayoutUnit xOff = (legend->x() > 0) ? LayoutUnit() : (legend->width() -
borderLeft()) / 2; |
| 158 paintRect.setWidth(paintRect.width() - xOff); | 160 paintRect.setWidth(paintRect.width() - xOff); |
| 159 paintRect.setX(paintRect.x() + xOff); | 161 paintRect.setX(paintRect.x() + xOff); |
| 160 } | 162 } |
| 161 | 163 |
| 162 BoxDecorationData boxDecorationData(*style()); | 164 BoxDecorationData boxDecorationData(*style(), canRenderBorderImage(), backgr
oundHasOpaqueTopLayer(), paintInfo.context); |
| 163 | 165 |
| 164 if (!boxShadowShouldBeAppliedToBackground(determineBackgroundBleedAvoidance(
paintInfo.context, boxDecorationData))) | 166 if (boxDecorationData.bleedAvoidance() == BackgroundBleedNone) |
| 165 paintBoxShadow(paintInfo, paintRect, style(), Normal); | 167 paintBoxShadow(paintInfo, paintRect, style(), Normal); |
| 166 paintFillLayers(paintInfo, boxDecorationData.backgroundColor, style()->backg
roundLayers(), paintRect); | 168 BoxPainter(*this).paintFillLayers(paintInfo, boxDecorationData.backgroundCol
or, style()->backgroundLayers(), paintRect); |
| 167 paintBoxShadow(paintInfo, paintRect, style(), Inset); | 169 paintBoxShadow(paintInfo, paintRect, style(), Inset); |
| 168 | 170 |
| 169 if (!boxDecorationData.hasBorder) | 171 if (!boxDecorationData.hasBorder) |
| 170 return; | 172 return; |
| 171 | 173 |
| 172 // 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 |
| 173 GraphicsContext* graphicsContext = paintInfo.context; | 175 GraphicsContext* graphicsContext = paintInfo.context; |
| 174 GraphicsContextStateSaver stateSaver(*graphicsContext); | 176 GraphicsContextStateSaver stateSaver(*graphicsContext); |
| 175 | 177 |
| 176 // 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 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 205 if (style()->isHorizontalWritingMode()) { | 207 if (style()->isHorizontalWritingMode()) { |
| 206 LayoutUnit yOff = (legend->y() > 0) ? LayoutUnit() : (legend->height() -
borderTop()) / 2; | 208 LayoutUnit yOff = (legend->y() > 0) ? LayoutUnit() : (legend->height() -
borderTop()) / 2; |
| 207 paintRect.expand(0, -yOff); | 209 paintRect.expand(0, -yOff); |
| 208 paintRect.move(0, yOff); | 210 paintRect.move(0, yOff); |
| 209 } else { | 211 } else { |
| 210 LayoutUnit xOff = (legend->x() > 0) ? LayoutUnit() : (legend->width() -
borderLeft()) / 2; | 212 LayoutUnit xOff = (legend->x() > 0) ? LayoutUnit() : (legend->width() -
borderLeft()) / 2; |
| 211 paintRect.expand(-xOff, 0); | 213 paintRect.expand(-xOff, 0); |
| 212 paintRect.move(xOff, 0); | 214 paintRect.move(xOff, 0); |
| 213 } | 215 } |
| 214 | 216 |
| 215 paintMaskImages(paintInfo, paintRect); | 217 BoxPainter(*this).paintMaskImages(paintInfo, paintRect); |
| 216 } | 218 } |
| 217 | 219 |
| 218 } // namespace blink | 220 } // namespace blink |
| OLD | NEW |