| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 if (fillLayer.next()) | 1062 if (fillLayer.next()) |
| 1063 paintFillLayers(paintInfo, c, *fillLayer.next(), rect, op); | 1063 paintFillLayers(paintInfo, c, *fillLayer.next(), rect, op); |
| 1064 paintFillLayer(paintInfo, c, fillLayer, rect, op); | 1064 paintFillLayer(paintInfo, c, fillLayer, rect, op); |
| 1065 } | 1065 } |
| 1066 | 1066 |
| 1067 bool InlineFlowBox::boxShadowCanBeAppliedToBackground(const FillLayer& lastBackg
roundLayer) const | 1067 bool InlineFlowBox::boxShadowCanBeAppliedToBackground(const FillLayer& lastBackg
roundLayer) const |
| 1068 { | 1068 { |
| 1069 // The checks here match how paintFillLayer() decides whether to clip (if it
does, the shadow | 1069 // The checks here match how paintFillLayer() decides whether to clip (if it
does, the shadow |
| 1070 // would be clipped out, so it has to be drawn separately). | 1070 // would be clipped out, so it has to be drawn separately). |
| 1071 StyleImage* image = lastBackgroundLayer.image(); | 1071 StyleImage* image = lastBackgroundLayer.image(); |
| 1072 bool hasFillImage = image && image->canRender(renderer(), renderer().style()
->effectiveZoom()); | 1072 bool hasFillImage = image && image->canRender(renderer()); |
| 1073 return (!hasFillImage && !renderer().style()->hasBorderRadius()) || (!prevLi
neBox() && !nextLineBox()) || !parent(); | 1073 return (!hasFillImage && !renderer().style()->hasBorderRadius()) || (!prevLi
neBox() && !nextLineBox()) || !parent(); |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 void InlineFlowBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, c
onst FillLayer& fillLayer, const LayoutRect& rect, CompositeOperator op) | 1076 void InlineFlowBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, c
onst FillLayer& fillLayer, const LayoutRect& rect, CompositeOperator op) |
| 1077 { | 1077 { |
| 1078 StyleImage* img = fillLayer.image(); | 1078 StyleImage* img = fillLayer.image(); |
| 1079 bool hasFillImage = img && img->canRender(renderer(), renderer().style()->ef
fectiveZoom()); | 1079 bool hasFillImage = img && img->canRender(renderer()); |
| 1080 if ((!hasFillImage && !renderer().style()->hasBorderRadius()) || (!prevLineB
ox() && !nextLineBox()) || !parent()) { | 1080 if ((!hasFillImage && !renderer().style()->hasBorderRadius()) || (!prevLineB
ox() && !nextLineBox()) || !parent()) { |
| 1081 boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, rect,
BackgroundBleedNone, this, rect.size(), op); | 1081 boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, rect,
BackgroundBleedNone, this, rect.size(), op); |
| 1082 } else if (renderer().style()->boxDecorationBreak() == DCLONE) { | 1082 } else if (renderer().style()->boxDecorationBreak() == DCLONE) { |
| 1083 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1083 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
| 1084 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), width(), height()
)); | 1084 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), width(), height()
)); |
| 1085 boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, rect,
BackgroundBleedNone, this, rect.size(), op); | 1085 boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, rect,
BackgroundBleedNone, this, rect.size(), op); |
| 1086 } else { | 1086 } else { |
| 1087 // We have a fill image that spans multiple lines. | 1087 // We have a fill image that spans multiple lines. |
| 1088 // We need to adjust tx and ty by the width of all previous lines. | 1088 // We need to adjust tx and ty by the width of all previous lines. |
| 1089 // Think of background painting on inlines as though you had one long li
ne, a single continuous | 1089 // Think of background painting on inlines as though you had one long li
ne, a single continuous |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 | 1176 |
| 1177 Color backgroundColor = renderer().resolveColor(styleToUse, CSSPropertyBackg
roundColor); | 1177 Color backgroundColor = renderer().resolveColor(styleToUse, CSSPropertyBackg
roundColor); |
| 1178 paintFillLayers(paintInfo, backgroundColor, styleToUse->backgroundLayers(),
paintRect); | 1178 paintFillLayers(paintInfo, backgroundColor, styleToUse->backgroundLayers(),
paintRect); |
| 1179 paintBoxShadow(paintInfo, styleToUse, Inset, paintRect); | 1179 paintBoxShadow(paintInfo, styleToUse, Inset, paintRect); |
| 1180 | 1180 |
| 1181 // :first-line cannot be used to put borders on a line. Always paint borders
with our | 1181 // :first-line cannot be used to put borders on a line. Always paint borders
with our |
| 1182 // non-first-line style. | 1182 // non-first-line style. |
| 1183 if (parent() && renderer().style()->hasBorder()) { | 1183 if (parent() && renderer().style()->hasBorder()) { |
| 1184 const NinePieceImage& borderImage = renderer().style()->borderImage(); | 1184 const NinePieceImage& borderImage = renderer().style()->borderImage(); |
| 1185 StyleImage* borderImageSource = borderImage.image(); | 1185 StyleImage* borderImageSource = borderImage.image(); |
| 1186 bool hasBorderImage = borderImageSource && borderImageSource->canRender(
renderer(), styleToUse->effectiveZoom()); | 1186 bool hasBorderImage = borderImageSource && borderImageSource->canRender(
renderer()); |
| 1187 if (hasBorderImage && !borderImageSource->isLoaded()) | 1187 if (hasBorderImage && !borderImageSource->isLoaded()) |
| 1188 return; // Don't paint anything while we wait for the image to load. | 1188 return; // Don't paint anything while we wait for the image to load. |
| 1189 | 1189 |
| 1190 // The simple case is where we either have no border image or we are the
only box for this object. | 1190 // The simple case is where we either have no border image or we are the
only box for this object. |
| 1191 // In those cases only a single call to draw is required. | 1191 // In those cases only a single call to draw is required. |
| 1192 if (!hasBorderImage || (!prevLineBox() && !nextLineBox())) { | 1192 if (!hasBorderImage || (!prevLineBox() && !nextLineBox())) { |
| 1193 boxModelObject()->paintBorder(paintInfo, paintRect, renderer().style
(isFirstLineStyle()), BackgroundBleedNone, includeLogicalLeftEdge(), includeLogi
calRightEdge()); | 1193 boxModelObject()->paintBorder(paintInfo, paintRect, renderer().style
(isFirstLineStyle()), BackgroundBleedNone, includeLogicalLeftEdge(), includeLogi
calRightEdge()); |
| 1194 } else { | 1194 } else { |
| 1195 // We have a border image that spans multiple lines. | 1195 // We have a border image that spans multiple lines. |
| 1196 // We need to adjust tx and ty by the width of all previous lines. | 1196 // We need to adjust tx and ty by the width of all previous lines. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1247 if (pushTransparencyLayer) { | 1247 if (pushTransparencyLayer) { |
| 1248 paintInfo.context->setCompositeOperation(CompositeDestinationIn); | 1248 paintInfo.context->setCompositeOperation(CompositeDestinationIn); |
| 1249 paintInfo.context->beginTransparencyLayer(1.0f); | 1249 paintInfo.context->beginTransparencyLayer(1.0f); |
| 1250 compositeOp = CompositeSourceOver; | 1250 compositeOp = CompositeSourceOver; |
| 1251 } | 1251 } |
| 1252 } | 1252 } |
| 1253 | 1253 |
| 1254 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, frameRect.size()); | 1254 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, frameRect.size()); |
| 1255 paintFillLayers(paintInfo, Color::transparent, renderer().style()->maskLayer
s(), paintRect, compositeOp); | 1255 paintFillLayers(paintInfo, Color::transparent, renderer().style()->maskLayer
s(), paintRect, compositeOp); |
| 1256 | 1256 |
| 1257 bool hasBoxImage = maskBoxImage && maskBoxImage->canRender(renderer(), rende
rer().style()->effectiveZoom()); | 1257 bool hasBoxImage = maskBoxImage && maskBoxImage->canRender(renderer()); |
| 1258 if (!hasBoxImage || !maskBoxImage->isLoaded()) { | 1258 if (!hasBoxImage || !maskBoxImage->isLoaded()) { |
| 1259 if (pushTransparencyLayer) | 1259 if (pushTransparencyLayer) |
| 1260 paintInfo.context->endLayer(); | 1260 paintInfo.context->endLayer(); |
| 1261 return; // Don't paint anything while we wait for the image to load. | 1261 return; // Don't paint anything while we wait for the image to load. |
| 1262 } | 1262 } |
| 1263 | 1263 |
| 1264 // The simple case is where we are the only box for this object. In those | 1264 // The simple case is where we are the only box for this object. In those |
| 1265 // cases only a single call to draw is required. | 1265 // cases only a single call to draw is required. |
| 1266 if (!prevLineBox() && !nextLineBox()) { | 1266 if (!prevLineBox() && !nextLineBox()) { |
| 1267 boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(adju
stedPaintOffset, frameRect.size()), renderer().style(), maskNinePieceImage, comp
ositeOp); | 1267 boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(adju
stedPaintOffset, frameRect.size()), renderer().style(), maskNinePieceImage, comp
ositeOp); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1478 ASSERT(child->prevOnLine() == prev); | 1478 ASSERT(child->prevOnLine() == prev); |
| 1479 prev = child; | 1479 prev = child; |
| 1480 } | 1480 } |
| 1481 ASSERT(prev == m_lastChild); | 1481 ASSERT(prev == m_lastChild); |
| 1482 #endif | 1482 #endif |
| 1483 } | 1483 } |
| 1484 | 1484 |
| 1485 #endif | 1485 #endif |
| 1486 | 1486 |
| 1487 } // namespace blink | 1487 } // namespace blink |
| OLD | NEW |