| 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 if (forceBackgroundToWhite) { | 566 if (forceBackgroundToWhite) { |
| 567 // Note that we can't reuse this variable below because the bgColor migh
t be changed | 567 // Note that we can't reuse this variable below because the bgColor migh
t be changed |
| 568 bool shouldPaintBackgroundColor = !bgLayer->next() && bgColor.isValid()
&& bgColor.alpha(); | 568 bool shouldPaintBackgroundColor = !bgLayer->next() && bgColor.isValid()
&& bgColor.alpha(); |
| 569 if (shouldPaintBackgroundImage || shouldPaintBackgroundColor) { | 569 if (shouldPaintBackgroundImage || shouldPaintBackgroundColor) { |
| 570 bgColor = Color::white; | 570 bgColor = Color::white; |
| 571 shouldPaintBackgroundImage = false; | 571 shouldPaintBackgroundImage = false; |
| 572 } | 572 } |
| 573 } | 573 } |
| 574 | 574 |
| 575 bool colorVisible = bgColor.isValid() && bgColor.alpha(); | 575 bool colorVisible = bgColor.isValid() && bgColor.alpha(); |
| 576 | 576 |
| 577 // Fast path for drawing simple color backgrounds. | 577 // Fast path for drawing simple color backgrounds. |
| 578 if (!isRoot && !clippedWithLocalScrolling && !shouldPaintBackgroundImage &&
isBorderFill && !bgLayer->next()) { | 578 if (!isRoot && !clippedWithLocalScrolling && !shouldPaintBackgroundImage &&
isBorderFill && !bgLayer->next()) { |
| 579 if (!colorVisible) | 579 if (!colorVisible) |
| 580 return; | 580 return; |
| 581 | 581 |
| 582 bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppli
edToBackground(bleedAvoidance, box); | 582 bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppli
edToBackground(bleedAvoidance, box); |
| 583 GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShouldBeAp
pliedToBackground); | 583 GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShouldBeAp
pliedToBackground); |
| 584 if (boxShadowShouldBeAppliedToBackground) | 584 if (boxShadowShouldBeAppliedToBackground) |
| 585 applyBoxShadowForBackground(context, style()); | 585 applyBoxShadowForBackground(context, style()); |
| 586 | 586 |
| 587 if (hasRoundedBorder && bleedAvoidance != BackgroundBleedUseTransparency
Layer) { | 587 if (hasRoundedBorder && bleedAvoidance != BackgroundBleedUseTransparency
Layer) { |
| 588 RoundedRect border = backgroundRoundedRectAdjustedForBleedAvoidance(
context, rect, bleedAvoidance, box, boxSize, includeLeftEdge, includeRightEdge); | 588 RoundedRect border = backgroundRoundedRectAdjustedForBleedAvoidance(
context, rect, bleedAvoidance, box, boxSize, includeLeftEdge, includeRightEdge); |
| 589 if (border.isRenderable()) | 589 if (border.isRenderable()) |
| 590 context->fillRoundedRect(border, bgColor, style()->colorSpace())
; | 590 context->fillRoundedRect(border, bgColor); |
| 591 else { | 591 else { |
| 592 context->save(); | 592 context->save(); |
| 593 clipRoundedInnerRect(context, rect, border); | 593 clipRoundedInnerRect(context, rect, border); |
| 594 context->fillRect(border.rect(), bgColor, style()->colorSpace())
; | 594 context->fillRect(border.rect(), bgColor); |
| 595 context->restore(); | 595 context->restore(); |
| 596 } | 596 } |
| 597 } else | 597 } else { |
| 598 context->fillRect(pixelSnappedIntRect(rect), bgColor, style()->color
Space()); | 598 context->fillRect(pixelSnappedIntRect(rect), bgColor); |
| 599 | 599 } |
| 600 |
| 600 return; | 601 return; |
| 601 } | 602 } |
| 602 | 603 |
| 603 // BorderFillBox radius clipping is taken care of by BackgroundBleedUseTrans
parencyLayer | 604 // BorderFillBox radius clipping is taken care of by BackgroundBleedUseTrans
parencyLayer |
| 604 bool clipToBorderRadius = hasRoundedBorder && !(isBorderFill && bleedAvoidan
ce == BackgroundBleedUseTransparencyLayer); | 605 bool clipToBorderRadius = hasRoundedBorder && !(isBorderFill && bleedAvoidan
ce == BackgroundBleedUseTransparencyLayer); |
| 605 GraphicsContextStateSaver clipToBorderStateSaver(*context, clipToBorderRadiu
s); | 606 GraphicsContextStateSaver clipToBorderStateSaver(*context, clipToBorderRadiu
s); |
| 606 if (clipToBorderRadius) { | 607 if (clipToBorderRadius) { |
| 607 RoundedRect border = isBorderFill ? backgroundRoundedRectAdjustedForBlee
dAvoidance(context, rect, bleedAvoidance, box, boxSize, includeLeftEdge, include
RightEdge) : getBackgroundRoundedRect(rect, box, boxSize.width(), boxSize.height
(), includeLeftEdge, includeRightEdge); | 608 RoundedRect border = isBorderFill ? backgroundRoundedRectAdjustedForBlee
dAvoidance(context, rect, bleedAvoidance, box, boxSize, includeLeftEdge, include
RightEdge) : getBackgroundRoundedRect(rect, box, boxSize.width(), boxSize.height
(), includeLeftEdge, includeRightEdge); |
| 608 | 609 |
| 609 // Clip to the padding or content boxes as necessary. | 610 // Clip to the padding or content boxes as necessary. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 } | 725 } |
| 725 | 726 |
| 726 GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShould
BeAppliedToBackground); | 727 GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShould
BeAppliedToBackground); |
| 727 if (boxShadowShouldBeAppliedToBackground) | 728 if (boxShadowShouldBeAppliedToBackground) |
| 728 applyBoxShadowForBackground(context, style()); | 729 applyBoxShadowForBackground(context, style()); |
| 729 | 730 |
| 730 if (baseColor.alpha()) { | 731 if (baseColor.alpha()) { |
| 731 if (bgColor.alpha()) | 732 if (bgColor.alpha()) |
| 732 baseColor = baseColor.blend(bgColor); | 733 baseColor = baseColor.blend(bgColor); |
| 733 | 734 |
| 734 context->fillRect(backgroundRect, baseColor, style()->colorSpace
(), CompositeCopy); | 735 context->fillRect(backgroundRect, baseColor, CompositeCopy); |
| 735 } else if (bgColor.alpha()) { | 736 } else if (bgColor.alpha()) { |
| 736 CompositeOperator operation = shouldClearBackground ? CompositeC
opy : context->compositeOperation(); | 737 CompositeOperator operation = shouldClearBackground ? CompositeC
opy : context->compositeOperation(); |
| 737 context->fillRect(backgroundRect, bgColor, style()->colorSpace()
, operation); | 738 context->fillRect(backgroundRect, bgColor, operation); |
| 738 } else if (shouldClearBackground) | 739 } else if (shouldClearBackground) |
| 739 context->clearRect(backgroundRect); | 740 context->clearRect(backgroundRect); |
| 740 } | 741 } |
| 741 } | 742 } |
| 742 | 743 |
| 743 // no progressive loading of the background image | 744 // no progressive loading of the background image |
| 744 if (shouldPaintBackgroundImage) { | 745 if (shouldPaintBackgroundImage) { |
| 745 BackgroundImageGeometry geometry; | 746 BackgroundImageGeometry geometry; |
| 746 calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, geometry, b
ackgroundObject); | 747 calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, geometry, b
ackgroundObject); |
| 747 geometry.clip(paintInfo.rect); | 748 geometry.clip(paintInfo.rect); |
| 748 if (!geometry.destRect().isEmpty()) { | 749 if (!geometry.destRect().isEmpty()) { |
| 749 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer-
>composite() : op; | 750 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer-
>composite() : op; |
| 750 RenderObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : this; | 751 RenderObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : this; |
| 751 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome
try.tileSize()); | 752 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome
try.tileSize()); |
| 752 bool useLowQualityScaling = shouldPaintAtLowQuality(context, image.g
et(), bgLayer, geometry.tileSize()); | 753 bool useLowQualityScaling = shouldPaintAtLowQuality(context, image.g
et(), bgLayer, geometry.tileSize()); |
| 753 context->drawTiledImage(image.get(), style()->colorSpace(), geometry
.destRect(), geometry.relativePhase(), geometry.tileSize(), | 754 context->drawTiledImage(image.get(), geometry.destRect(), geometry.r
elativePhase(), geometry.tileSize(), |
| 754 compositeOp, useLowQualityScaling, bgLayer->blendMode()); | 755 compositeOp, useLowQualityScaling, bgLayer->blendMode()); |
| 755 } | 756 } |
| 756 } | 757 } |
| 757 | 758 |
| 758 if (bgLayer->clip() == TextFillBox) { | 759 if (bgLayer->clip() == TextFillBox) { |
| 759 // Create the text mask layer. | 760 // Create the text mask layer. |
| 760 context->setCompositeOperation(CompositeDestinationIn); | 761 context->setCompositeOperation(CompositeDestinationIn); |
| 761 context->beginTransparencyLayer(1); | 762 context->beginTransparencyLayer(1); |
| 762 | 763 |
| 763 // FIXME: Workaround for https://code.google.com/p/skia/issues/detail?id
=1291. | 764 // FIXME: Workaround for https://code.google.com/p/skia/issues/detail?id
=1291. |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 int bottomSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageS
lices().bottom(), imageHeight, renderView)) * imageScaleFactor; | 1134 int bottomSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageS
lices().bottom(), imageHeight, renderView)) * imageScaleFactor; |
| 1134 int leftSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlic
es().left(), imageWidth, renderView)) * imageScaleFactor; | 1135 int leftSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlic
es().left(), imageWidth, renderView)) * imageScaleFactor; |
| 1135 | 1136 |
| 1136 ENinePieceImageRule hRule = ninePieceImage.horizontalRule(); | 1137 ENinePieceImageRule hRule = ninePieceImage.horizontalRule(); |
| 1137 ENinePieceImageRule vRule = ninePieceImage.verticalRule(); | 1138 ENinePieceImageRule vRule = ninePieceImage.verticalRule(); |
| 1138 | 1139 |
| 1139 int topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), s
tyle->borderTopWidth(), topSlice, borderImageRect.height(), renderView); | 1140 int topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), s
tyle->borderTopWidth(), topSlice, borderImageRect.height(), renderView); |
| 1140 int rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(
), style->borderRightWidth(), rightSlice, borderImageRect.width(), renderView); | 1141 int rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(
), style->borderRightWidth(), rightSlice, borderImageRect.width(), renderView); |
| 1141 int bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().botto
m(), style->borderBottomWidth(), bottomSlice, borderImageRect.height(), renderVi
ew); | 1142 int bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().botto
m(), style->borderBottomWidth(), bottomSlice, borderImageRect.height(), renderVi
ew); |
| 1142 int leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(),
style->borderLeftWidth(), leftSlice, borderImageRect.width(), renderView); | 1143 int leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(),
style->borderLeftWidth(), leftSlice, borderImageRect.width(), renderView); |
| 1143 | 1144 |
| 1144 // Reduce the widths if they're too large. | 1145 // Reduce the widths if they're too large. |
| 1145 // The spec says: Given Lwidth as the width of the border image area, Lheigh
t as its height, and Wside as the border image width | 1146 // The spec says: Given Lwidth as the width of the border image area, Lheigh
t as its height, and Wside as the border image width |
| 1146 // offset for the side, let f = min(Lwidth/(Wleft+Wright), Lheight/(Wtop+Wbo
ttom)). If f < 1, then all W are reduced by | 1147 // offset for the side, let f = min(Lwidth/(Wleft+Wright), Lheight/(Wtop+Wbo
ttom)). If f < 1, then all W are reduced by |
| 1147 // multiplying them by f. | 1148 // multiplying them by f. |
| 1148 int borderSideWidth = max(1, leftWidth + rightWidth); | 1149 int borderSideWidth = max(1, leftWidth + rightWidth); |
| 1149 int borderSideHeight = max(1, topWidth + bottomWidth); | 1150 int borderSideHeight = max(1, topWidth + bottomWidth); |
| 1150 float borderSideScaleFactor = min((float)borderImageRect.width() / borderSid
eWidth, (float)borderImageRect.height() / borderSideHeight); | 1151 float borderSideScaleFactor = min((float)borderImageRect.width() / borderSid
eWidth, (float)borderImageRect.height() / borderSideHeight); |
| 1151 if (borderSideScaleFactor < 1) { | 1152 if (borderSideScaleFactor < 1) { |
| 1152 topWidth *= borderSideScaleFactor; | 1153 topWidth *= borderSideScaleFactor; |
| 1153 rightWidth *= borderSideScaleFactor; | 1154 rightWidth *= borderSideScaleFactor; |
| 1154 bottomWidth *= borderSideScaleFactor; | 1155 bottomWidth *= borderSideScaleFactor; |
| 1155 leftWidth *= borderSideScaleFactor; | 1156 leftWidth *= borderSideScaleFactor; |
| 1156 } | 1157 } |
| 1157 | 1158 |
| 1158 bool drawLeft = leftSlice > 0 && leftWidth > 0; | 1159 bool drawLeft = leftSlice > 0 && leftWidth > 0; |
| 1159 bool drawTop = topSlice > 0 && topWidth > 0; | 1160 bool drawTop = topSlice > 0 && topWidth > 0; |
| 1160 bool drawRight = rightSlice > 0 && rightWidth > 0; | 1161 bool drawRight = rightSlice > 0 && rightWidth > 0; |
| 1161 bool drawBottom = bottomSlice > 0 && bottomWidth > 0; | 1162 bool drawBottom = bottomSlice > 0 && bottomWidth > 0; |
| 1162 bool drawMiddle = ninePieceImage.fill() && (imageWidth - leftSlice - rightSl
ice) > 0 && (borderImageRect.width() - leftWidth - rightWidth) > 0 | 1163 bool drawMiddle = ninePieceImage.fill() && (imageWidth - leftSlice - rightSl
ice) > 0 && (borderImageRect.width() - leftWidth - rightWidth) > 0 |
| 1163 && (imageHeight - topSlice - bottomSlice) > 0 && (borderIm
ageRect.height() - topWidth - bottomWidth) > 0; | 1164 && (imageHeight - topSlice - bottomSlice) > 0 && (borderIm
ageRect.height() - topWidth - bottomWidth) > 0; |
| 1164 | 1165 |
| 1165 RefPtr<Image> image = styleImage->image(this, imageSize); | 1166 RefPtr<Image> image = styleImage->image(this, imageSize); |
| 1166 ColorSpace colorSpace = style->colorSpace(); | 1167 |
| 1167 | |
| 1168 float destinationWidth = borderImageRect.width() - leftWidth - rightWidth; | 1168 float destinationWidth = borderImageRect.width() - leftWidth - rightWidth; |
| 1169 float destinationHeight = borderImageRect.height() - topWidth - bottomWidth; | 1169 float destinationHeight = borderImageRect.height() - topWidth - bottomWidth; |
| 1170 | 1170 |
| 1171 float sourceWidth = imageWidth - leftSlice - rightSlice; | 1171 float sourceWidth = imageWidth - leftSlice - rightSlice; |
| 1172 float sourceHeight = imageHeight - topSlice - bottomSlice; | 1172 float sourceHeight = imageHeight - topSlice - bottomSlice; |
| 1173 | 1173 |
| 1174 float leftSideScale = drawLeft ? (float)leftWidth / leftSlice : 1; | 1174 float leftSideScale = drawLeft ? (float)leftWidth / leftSlice : 1; |
| 1175 float rightSideScale = drawRight ? (float)rightWidth / rightSlice : 1; | 1175 float rightSideScale = drawRight ? (float)rightWidth / rightSlice : 1; |
| 1176 float topSideScale = drawTop ? (float)topWidth / topSlice : 1; | 1176 float topSideScale = drawTop ? (float)topWidth / topSlice : 1; |
| 1177 float bottomSideScale = drawBottom ? (float)bottomWidth / bottomSlice : 1; | 1177 float bottomSideScale = drawBottom ? (float)bottomWidth / bottomSlice : 1; |
| 1178 | 1178 |
| 1179 if (drawLeft) { | 1179 if (drawLeft) { |
| 1180 // Paint the top and bottom left corners. | 1180 // Paint the top and bottom left corners. |
| 1181 | 1181 |
| 1182 // The top left corner rect is (tx, ty, leftWidth, topWidth) | 1182 // The top left corner rect is (tx, ty, leftWidth, topWidth) |
| 1183 // The rect to use from within the image is obtained from our slice, and
is (0, 0, leftSlice, topSlice) | 1183 // The rect to use from within the image is obtained from our slice, and
is (0, 0, leftSlice, topSlice) |
| 1184 if (drawTop) | 1184 if (drawTop) |
| 1185 graphicsContext->drawImage(image.get(), colorSpace, IntRect(borderIm
ageRect.location(), IntSize(leftWidth, topWidth)), | 1185 graphicsContext->drawImage(image.get(), IntRect(borderImageRect.loca
tion(), IntSize(leftWidth, topWidth)), |
| 1186 LayoutRect(0, 0, leftSlice, topSlice), op
); | 1186 LayoutRect(0, 0, leftSlice, topSlice), op
); |
| 1187 | 1187 |
| 1188 // The bottom left corner rect is (tx, ty + h - bottomWidth, leftWidth,
bottomWidth) | 1188 // The bottom left corner rect is (tx, ty + h - bottomWidth, leftWidth,
bottomWidth) |
| 1189 // The rect to use from within the image is (0, imageHeight - bottomSlic
e, leftSlice, botomSlice) | 1189 // The rect to use from within the image is (0, imageHeight - bottomSlic
e, leftSlice, botomSlice) |
| 1190 if (drawBottom) | 1190 if (drawBottom) |
| 1191 graphicsContext->drawImage(image.get(), colorSpace, IntRect(borderIm
ageRect.x(), borderImageRect.maxY() - bottomWidth, leftWidth, bottomWidth), | 1191 graphicsContext->drawImage(image.get(), IntRect(borderImageRect.x(),
borderImageRect.maxY() - bottomWidth, leftWidth, bottomWidth), |
| 1192 LayoutRect(0, imageHeight - bottomSlice,
leftSlice, bottomSlice), op); | 1192 LayoutRect(0, imageHeight - bottomSlice,
leftSlice, bottomSlice), op); |
| 1193 | 1193 |
| 1194 // Paint the left edge. | 1194 // Paint the left edge. |
| 1195 // Have to scale and tile into the border rect. | 1195 // Have to scale and tile into the border rect. |
| 1196 if (sourceHeight > 0) | 1196 if (sourceHeight > 0) |
| 1197 graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(bor
derImageRect.x(), borderImageRect.y() + topWidth, leftWidth, | 1197 graphicsContext->drawTiledImage(image.get(), IntRect(borderImageRect
.x(), borderImageRect.y() + topWidth, leftWidth, destinationHeight), |
| 1198 destinationHeight), | |
| 1199 IntRect(0, topSlice, leftSlice, sour
ceHeight), | 1198 IntRect(0, topSlice, leftSlice, sour
ceHeight), |
| 1200 FloatSize(leftSideScale, leftSideSca
le), Image::StretchTile, (Image::TileRule)vRule, op); | 1199 FloatSize(leftSideScale, leftSideSca
le), Image::StretchTile, (Image::TileRule)vRule, op); |
| 1201 } | 1200 } |
| 1202 | 1201 |
| 1203 if (drawRight) { | 1202 if (drawRight) { |
| 1204 // Paint the top and bottom right corners | 1203 // Paint the top and bottom right corners |
| 1205 // The top right corner rect is (tx + w - rightWidth, ty, rightWidth, to
pWidth) | 1204 // The top right corner rect is (tx + w - rightWidth, ty, rightWidth, to
pWidth) |
| 1206 // The rect to use from within the image is obtained from our slice, and
is (imageWidth - rightSlice, 0, rightSlice, topSlice) | 1205 // The rect to use from within the image is obtained from our slice, and
is (imageWidth - rightSlice, 0, rightSlice, topSlice) |
| 1207 if (drawTop) | 1206 if (drawTop) |
| 1208 graphicsContext->drawImage(image.get(), colorSpace, IntRect(borderIm
ageRect.maxX() - rightWidth, borderImageRect.y(), rightWidth, topWidth), | 1207 graphicsContext->drawImage(image.get(), IntRect(borderImageRect.maxX
() - rightWidth, borderImageRect.y(), rightWidth, topWidth), |
| 1209 LayoutRect(imageWidth - rightSlice, 0, ri
ghtSlice, topSlice), op); | 1208 LayoutRect(imageWidth - rightSlice, 0, ri
ghtSlice, topSlice), op); |
| 1210 | 1209 |
| 1211 // The bottom right corner rect is (tx + w - rightWidth, ty + h - bottom
Width, rightWidth, bottomWidth) | 1210 // The bottom right corner rect is (tx + w - rightWidth, ty + h - bottom
Width, rightWidth, bottomWidth) |
| 1212 // The rect to use from within the image is (imageWidth - rightSlice, im
ageHeight - bottomSlice, rightSlice, bottomSlice) | 1211 // The rect to use from within the image is (imageWidth - rightSlice, im
ageHeight - bottomSlice, rightSlice, bottomSlice) |
| 1213 if (drawBottom) | 1212 if (drawBottom) |
| 1214 graphicsContext->drawImage(image.get(), colorSpace, IntRect(borderIm
ageRect.maxX() - rightWidth, borderImageRect.maxY() - bottomWidth, rightWidth, b
ottomWidth), | 1213 graphicsContext->drawImage(image.get(), IntRect(borderImageRect.maxX
() - rightWidth, borderImageRect.maxY() - bottomWidth, rightWidth, bottomWidth), |
| 1215 LayoutRect(imageWidth - rightSlice, image
Height - bottomSlice, rightSlice, bottomSlice), op); | 1214 LayoutRect(imageWidth - rightSlice, image
Height - bottomSlice, rightSlice, bottomSlice), op); |
| 1216 | 1215 |
| 1217 // Paint the right edge. | 1216 // Paint the right edge. |
| 1218 if (sourceHeight > 0) | 1217 if (sourceHeight > 0) |
| 1219 graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(bor
derImageRect.maxX() - rightWidth, borderImageRect.y() + topWidth, rightWidth, | 1218 graphicsContext->drawTiledImage(image.get(), IntRect(borderImageRect
.maxX() - rightWidth, borderImageRect.y() + topWidth, rightWidth, |
| 1220 destinationHeight), | 1219 destinationHeight), |
| 1221 IntRect(imageWidth - rightSlice, top
Slice, rightSlice, sourceHeight), | 1220 IntRect(imageWidth - rightSlice, top
Slice, rightSlice, sourceHeight), |
| 1222 FloatSize(rightSideScale, rightSideS
cale), | 1221 FloatSize(rightSideScale, rightSideS
cale), |
| 1223 Image::StretchTile, (Image::TileRule
)vRule, op); | 1222 Image::StretchTile, (Image::TileRule
)vRule, op); |
| 1224 } | 1223 } |
| 1225 | 1224 |
| 1226 // Paint the top edge. | 1225 // Paint the top edge. |
| 1227 if (drawTop && sourceWidth > 0) | 1226 if (drawTop && sourceWidth > 0) |
| 1228 graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(borderI
mageRect.x() + leftWidth, borderImageRect.y(), destinationWidth, topWidth), | 1227 graphicsContext->drawTiledImage(image.get(), IntRect(borderImageRect.x()
+ leftWidth, borderImageRect.y(), destinationWidth, topWidth), |
| 1229 IntRect(leftSlice, 0, sourceWidth, topSl
ice), | 1228 IntRect(leftSlice, 0, sourceWidth, topSl
ice), |
| 1230 FloatSize(topSideScale, topSideScale), (
Image::TileRule)hRule, Image::StretchTile, op); | 1229 FloatSize(topSideScale, topSideScale), (
Image::TileRule)hRule, Image::StretchTile, op); |
| 1231 | 1230 |
| 1232 // Paint the bottom edge. | 1231 // Paint the bottom edge. |
| 1233 if (drawBottom && sourceWidth > 0) | 1232 if (drawBottom && sourceWidth > 0) |
| 1234 graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(borderI
mageRect.x() + leftWidth, borderImageRect.maxY() - bottomWidth, | 1233 graphicsContext->drawTiledImage(image.get(), IntRect(borderImageRect.x()
+ leftWidth, borderImageRect.maxY() - bottomWidth, |
| 1235 destinationWidth, bottomWidth), | 1234 destinationWidth, bottomWidth), |
| 1236 IntRect(leftSlice, imageHeight - bottomS
lice, sourceWidth, bottomSlice), | 1235 IntRect(leftSlice, imageHeight - bottomS
lice, sourceWidth, bottomSlice), |
| 1237 FloatSize(bottomSideScale, bottomSideSca
le), | 1236 FloatSize(bottomSideScale, bottomSideSca
le), |
| 1238 (Image::TileRule)hRule, Image::StretchTi
le, op); | 1237 (Image::TileRule)hRule, Image::StretchTi
le, op); |
| 1239 | 1238 |
| 1240 // Paint the middle. | 1239 // Paint the middle. |
| 1241 if (drawMiddle) { | 1240 if (drawMiddle) { |
| 1242 FloatSize middleScaleFactor(1, 1); | 1241 FloatSize middleScaleFactor(1, 1); |
| 1243 if (drawTop) | 1242 if (drawTop) |
| 1244 middleScaleFactor.setWidth(topSideScale); | 1243 middleScaleFactor.setWidth(topSideScale); |
| 1245 else if (drawBottom) | 1244 else if (drawBottom) |
| 1246 middleScaleFactor.setWidth(bottomSideScale); | 1245 middleScaleFactor.setWidth(bottomSideScale); |
| 1247 if (drawLeft) | 1246 if (drawLeft) |
| 1248 middleScaleFactor.setHeight(leftSideScale); | 1247 middleScaleFactor.setHeight(leftSideScale); |
| 1249 else if (drawRight) | 1248 else if (drawRight) |
| 1250 middleScaleFactor.setHeight(rightSideScale); | 1249 middleScaleFactor.setHeight(rightSideScale); |
| 1251 | 1250 |
| 1252 // For "stretch" rules, just override the scale factor and replace. We o
nly had to do this for the | 1251 // For "stretch" rules, just override the scale factor and replace. We o
nly had to do this for the |
| 1253 // center tile, since sides don't even use the scale factor unless they
have a rule other than "stretch". | 1252 // center tile, since sides don't even use the scale factor unless they
have a rule other than "stretch". |
| 1254 // The middle however can have "stretch" specified in one axis but not t
he other, so we have to | 1253 // The middle however can have "stretch" specified in one axis but not t
he other, so we have to |
| 1255 // correct the scale here. | 1254 // correct the scale here. |
| 1256 if (hRule == StretchImageRule) | 1255 if (hRule == StretchImageRule) |
| 1257 middleScaleFactor.setWidth(destinationWidth / sourceWidth); | 1256 middleScaleFactor.setWidth(destinationWidth / sourceWidth); |
| 1258 | 1257 |
| 1259 if (vRule == StretchImageRule) | 1258 if (vRule == StretchImageRule) |
| 1260 middleScaleFactor.setHeight(destinationHeight / sourceHeight); | 1259 middleScaleFactor.setHeight(destinationHeight / sourceHeight); |
| 1261 | 1260 |
| 1262 graphicsContext->drawTiledImage(image.get(), colorSpace, | 1261 graphicsContext->drawTiledImage(image.get(), |
| 1263 IntRect(borderImageRect.x() + leftWidth, borderImageRect.y() + topWi
dth, destinationWidth, destinationHeight), | 1262 IntRect(borderImageRect.x() + leftWidth, borderImageRect.y() + topWi
dth, destinationWidth, destinationHeight), |
| 1264 IntRect(leftSlice, topSlice, sourceWidth, sourceHeight), | 1263 IntRect(leftSlice, topSlice, sourceWidth, sourceHeight), |
| 1265 middleScaleFactor, (Image::TileRule)hRule, (Image::TileRule)vRule, o
p); | 1264 middleScaleFactor, (Image::TileRule)hRule, (Image::TileRule)vRule, o
p); |
| 1266 } | 1265 } |
| 1267 | 1266 |
| 1268 return true; | 1267 return true; |
| 1269 } | 1268 } |
| 1270 | 1269 |
| 1271 class BorderEdge { | 1270 class BorderEdge { |
| 1272 public: | 1271 public: |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1789 else | 1788 else |
| 1790 path.addRect(innerThird.rect()); | 1789 path.addRect(innerThird.rect()); |
| 1791 } | 1790 } |
| 1792 | 1791 |
| 1793 if (innerBorder.isRounded()) | 1792 if (innerBorder.isRounded()) |
| 1794 path.addRoundedRect(innerBorder); | 1793 path.addRoundedRect(innerBorder); |
| 1795 else | 1794 else |
| 1796 path.addRect(innerBorder.rect()); | 1795 path.addRect(innerBorder.rect()); |
| 1797 | 1796 |
| 1798 graphicsContext->setFillRule(RULE_EVENODD); | 1797 graphicsContext->setFillRule(RULE_EVENODD); |
| 1799 graphicsContext->setFillColor(edges[firstVisibleEdge].color, style->
colorSpace()); | 1798 graphicsContext->setFillColor(edges[firstVisibleEdge].color); |
| 1800 graphicsContext->fillPath(path); | 1799 graphicsContext->fillPath(path); |
| 1801 return; | 1800 return; |
| 1802 } | 1801 } |
| 1803 // Avoid creating transparent layers | 1802 // Avoid creating transparent layers |
| 1804 if (haveAllSolidEdges && numEdgesVisible != 4 && !outerBorder.isRounded(
) && haveAlphaColor) { | 1803 if (haveAllSolidEdges && numEdgesVisible != 4 && !outerBorder.isRounded(
) && haveAlphaColor) { |
| 1805 Path path; | 1804 Path path; |
| 1806 | 1805 |
| 1807 for (int i = BSTop; i <= BSLeft; ++i) { | 1806 for (int i = BSTop; i <= BSLeft; ++i) { |
| 1808 const BorderEdge& currEdge = edges[i]; | 1807 const BorderEdge& currEdge = edges[i]; |
| 1809 if (currEdge.shouldRender()) { | 1808 if (currEdge.shouldRender()) { |
| 1810 IntRect sideRect = calculateSideRect(outerBorder, edges, i); | 1809 IntRect sideRect = calculateSideRect(outerBorder, edges, i); |
| 1811 path.addRect(sideRect); | 1810 path.addRect(sideRect); |
| 1812 } | 1811 } |
| 1813 } | 1812 } |
| 1814 | 1813 |
| 1815 graphicsContext->setFillRule(RULE_NONZERO); | 1814 graphicsContext->setFillRule(RULE_NONZERO); |
| 1816 graphicsContext->setFillColor(edges[firstVisibleEdge].color, style->
colorSpace()); | 1815 graphicsContext->setFillColor(edges[firstVisibleEdge].color); |
| 1817 graphicsContext->fillPath(path); | 1816 graphicsContext->fillPath(path); |
| 1818 return; | 1817 return; |
| 1819 } | 1818 } |
| 1820 } | 1819 } |
| 1821 | 1820 |
| 1822 bool clipToOuterBorder = outerBorder.isRounded(); | 1821 bool clipToOuterBorder = outerBorder.isRounded(); |
| 1823 GraphicsContextStateSaver stateSaver(*graphicsContext, clipToOuterBorder); | 1822 GraphicsContextStateSaver stateSaver(*graphicsContext, clipToOuterBorder); |
| 1824 if (clipToOuterBorder) { | 1823 if (clipToOuterBorder) { |
| 1825 // Clip to the inner and outer radii rects. | 1824 // Clip to the inner and outer radii rects. |
| 1826 if (bleedAvoidance != BackgroundBleedUseTransparencyLayer) | 1825 if (bleedAvoidance != BackgroundBleedUseTransparencyLayer) |
| 1827 graphicsContext->clipRoundedRect(outerBorder); | 1826 graphicsContext->clipRoundedRect(outerBorder); |
| 1828 // isRenderable() check avoids issue described in https://bugs.webkit.or
g/show_bug.cgi?id=38787 | 1827 // isRenderable() check avoids issue described in https://bugs.webkit.or
g/show_bug.cgi?id=38787 |
| 1829 // The inside will be clipped out later (in clipBorderSideForComplexInne
rPath) | 1828 // The inside will be clipped out later (in clipBorderSideForComplexInne
rPath) |
| 1830 if (innerBorder.isRenderable()) | 1829 if (innerBorder.isRenderable()) |
| 1831 graphicsContext->clipOutRoundedRect(innerBorder); | 1830 graphicsContext->clipOutRoundedRect(innerBorder); |
| 1832 } | 1831 } |
| 1833 | 1832 |
| 1834 // If only one edge visible antialiasing doesn't create seams | 1833 // If only one edge visible antialiasing doesn't create seams |
| 1835 bool antialias = shouldAntialiasLines(graphicsContext) || numEdgesVisible ==
1; | 1834 bool antialias = shouldAntialiasLines(graphicsContext) || numEdgesVisible ==
1; |
| 1836 RoundedRect unadjustedInnerBorder = (bleedAvoidance == BackgroundBleedBackgr
oundOverBorder) ? style->getRoundedInnerBorderFor(rect, includeLogicalLeftEdge,
includeLogicalRightEdge) : innerBorder; | 1835 RoundedRect unadjustedInnerBorder = (bleedAvoidance == BackgroundBleedBackgr
oundOverBorder) ? style->getRoundedInnerBorderFor(rect, includeLogicalLeftEdge,
includeLogicalRightEdge) : innerBorder; |
| 1837 IntPoint innerBorderAdjustment(innerBorder.rect().x() - unadjustedInnerBorde
r.rect().x(), innerBorder.rect().y() - unadjustedInnerBorder.rect().y()); | 1836 IntPoint innerBorderAdjustment(innerBorder.rect().x() - unadjustedInnerBorde
r.rect().x(), innerBorder.rect().y() - unadjustedInnerBorder.rect().y()); |
| 1838 if (haveAlphaColor) | 1837 if (haveAlphaColor) |
| 1839 paintTranslucentBorderSides(graphicsContext, style, outerBorder, unadjus
tedInnerBorder, innerBorderAdjustment, edges, edgesToDraw, bleedAvoidance, inclu
deLogicalLeftEdge, includeLogicalRightEdge, antialias); | 1838 paintTranslucentBorderSides(graphicsContext, style, outerBorder, unadjus
tedInnerBorder, innerBorderAdjustment, edges, edgesToDraw, bleedAvoidance, inclu
deLogicalLeftEdge, includeLogicalRightEdge, antialias); |
| 1840 else | 1839 else |
| 1841 paintBorderSides(graphicsContext, style, outerBorder, unadjustedInnerBor
der, innerBorderAdjustment, edges, edgesToDraw, bleedAvoidance, includeLogicalLe
ftEdge, includeLogicalRightEdge, antialias); | 1840 paintBorderSides(graphicsContext, style, outerBorder, unadjustedInnerBor
der, innerBorderAdjustment, edges, edgesToDraw, bleedAvoidance, includeLogicalLe
ftEdge, includeLogicalRightEdge, antialias); |
| 1842 } | 1841 } |
| 1843 | 1842 |
| 1844 void RenderBoxModelObject::drawBoxSideFromPath(GraphicsContext* graphicsContext,
const LayoutRect& borderRect, const Path& borderPath, const BorderEdge edges[], | 1843 void RenderBoxModelObject::drawBoxSideFromPath(GraphicsContext* graphicsContext,
const LayoutRect& borderRect, const Path& borderPath, const BorderEdge edges[], |
| 1845 float thickness, float drawThickness, BoxSid
e side, const RenderStyle* style, | 1844 float thickness, float drawThickness, BoxSide side, const RenderStyle* style
, Color color, EBorderStyle borderStyle, BackgroundBleedAvoidance bleedAvoidance
, |
| 1846 Color color, EBorderStyle borderStyle, Backg
roundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLog
icalRightEdge) | 1845 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) |
| 1847 { | 1846 { |
| 1848 if (thickness <= 0) | 1847 if (thickness <= 0) |
| 1849 return; | 1848 return; |
| 1850 | 1849 |
| 1851 if (borderStyle == DOUBLE && thickness < 3) | 1850 if (borderStyle == DOUBLE && thickness < 3) |
| 1852 borderStyle = SOLID; | 1851 borderStyle = SOLID; |
| 1853 | 1852 |
| 1854 switch (borderStyle) { | 1853 switch (borderStyle) { |
| 1855 case BNONE: | 1854 case BNONE: |
| 1856 case BHIDDEN: | 1855 case BHIDDEN: |
| 1857 return; | 1856 return; |
| 1858 case DOTTED: | 1857 case DOTTED: |
| 1859 case DASHED: { | 1858 case DASHED: { |
| 1860 graphicsContext->setStrokeColor(color, style->colorSpace()); | 1859 graphicsContext->setStrokeColor(color); |
| 1861 | 1860 |
| 1862 // The stroke is doubled here because the provided path is the | 1861 // The stroke is doubled here because the provided path is the |
| 1863 // outside edge of the border so half the stroke is clipped off. | 1862 // outside edge of the border so half the stroke is clipped off. |
| 1864 // The extra multiplier is so that the clipping mask can antialias | 1863 // The extra multiplier is so that the clipping mask can antialias |
| 1865 // the edges to prevent jaggies. | 1864 // the edges to prevent jaggies. |
| 1866 graphicsContext->setStrokeThickness(drawThickness * 2 * 1.1f); | 1865 graphicsContext->setStrokeThickness(drawThickness * 2 * 1.1f); |
| 1867 graphicsContext->setStrokeStyle(borderStyle == DASHED ? DashedStroke : D
ottedStroke); | 1866 graphicsContext->setStrokeStyle(borderStyle == DASHED ? DashedStroke : D
ottedStroke); |
| 1868 | 1867 |
| 1869 // If the number of dashes that fit in the path is odd and non-integral
then we | 1868 // If the number of dashes that fit in the path is odd and non-integral
then we |
| 1870 // will have an awkwardly-sized dash at the end of the path. To try to a
void that | 1869 // will have an awkwardly-sized dash at the end of the path. To try to a
void that |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1982 break; | 1981 break; |
| 1983 case OUTSET: | 1982 case OUTSET: |
| 1984 if (side == BSBottom || side == BSRight) | 1983 if (side == BSBottom || side == BSRight) |
| 1985 color = color.dark(); | 1984 color = color.dark(); |
| 1986 break; | 1985 break; |
| 1987 default: | 1986 default: |
| 1988 break; | 1987 break; |
| 1989 } | 1988 } |
| 1990 | 1989 |
| 1991 graphicsContext->setStrokeStyle(NoStroke); | 1990 graphicsContext->setStrokeStyle(NoStroke); |
| 1992 graphicsContext->setFillColor(color, style->colorSpace()); | 1991 graphicsContext->setFillColor(color); |
| 1993 graphicsContext->drawRect(pixelSnappedIntRect(borderRect)); | 1992 graphicsContext->drawRect(pixelSnappedIntRect(borderRect)); |
| 1994 } | 1993 } |
| 1995 | 1994 |
| 1996 static void findInnerVertex(const FloatPoint& outerCorner, const FloatPoint& inn
erCorner, const FloatPoint& centerPoint, FloatPoint& result) | 1995 static void findInnerVertex(const FloatPoint& outerCorner, const FloatPoint& inn
erCorner, const FloatPoint& centerPoint, FloatPoint& result) |
| 1997 { | 1996 { |
| 1998 // If the line between outer and inner corner is towards the horizontal, int
ersect with a vertical line through the center, | 1997 // If the line between outer and inner corner is towards the horizontal, int
ersect with a vertical line through the center, |
| 1999 // otherwise with a horizontal line through the center. The points that form
this line are arbitrary (we use 0, 100). | 1998 // otherwise with a horizontal line through the center. The points that form
this line are arbitrary (we use 0, 100). |
| 2000 // Note that if findIntersection fails, it will leave result untouched. | 1999 // Note that if findIntersection fails, it will leave result untouched. |
| 2001 float diffInnerOuterX = fabs(innerCorner.x() - outerCorner.x()); | 2000 float diffInnerOuterX = fabs(innerCorner.x() - outerCorner.x()); |
| 2002 float diffInnerOuterY = fabs(innerCorner.y() - outerCorner.y()); | 2001 float diffInnerOuterY = fabs(innerCorner.y() - outerCorner.y()); |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2407 if (hasOpaqueBackground) { | 2406 if (hasOpaqueBackground) { |
| 2408 rectToClipOut.inflateWithRadii(-1); | 2407 rectToClipOut.inflateWithRadii(-1); |
| 2409 } | 2408 } |
| 2410 | 2409 |
| 2411 if (!rectToClipOut.isEmpty()) | 2410 if (!rectToClipOut.isEmpty()) |
| 2412 context->clipOutRoundedRect(rectToClipOut); | 2411 context->clipOutRoundedRect(rectToClipOut); |
| 2413 | 2412 |
| 2414 RoundedRect influenceRect(shadowRect, border.radii()); | 2413 RoundedRect influenceRect(shadowRect, border.radii()); |
| 2415 influenceRect.expandRadii(2 * shadowBlur + shadowSpread); | 2414 influenceRect.expandRadii(2 * shadowBlur + shadowSpread); |
| 2416 if (allCornersClippedOut(influenceRect, info.rect)) | 2415 if (allCornersClippedOut(influenceRect, info.rect)) |
| 2417 context->fillRect(fillRect.rect(), Color::black, s->colorSpa
ce()); | 2416 context->fillRect(fillRect.rect(), Color::black); |
| 2418 else { | 2417 else { |
| 2419 fillRect.expandRadii(shadowSpread); | 2418 fillRect.expandRadii(shadowSpread); |
| 2420 if (!fillRect.isRenderable()) | 2419 if (!fillRect.isRenderable()) |
| 2421 fillRect.adjustRadii(); | 2420 fillRect.adjustRadii(); |
| 2422 context->fillRoundedRect(fillRect, Color::black, s->colorSpa
ce()); | 2421 context->fillRoundedRect(fillRect, Color::black); |
| 2423 } | 2422 } |
| 2424 } else { | 2423 } else { |
| 2425 IntRect rectToClipOut = border.rect(); | 2424 IntRect rectToClipOut = border.rect(); |
| 2426 | 2425 |
| 2427 // If the box is opaque, it is unnecessary to clip it out. Howev
er, doing so saves time | 2426 // If the box is opaque, it is unnecessary to clip it out. Howev
er, doing so saves time |
| 2428 // when painting the shadow. On the other hand, it introduces su
bpixel gaps along the | 2427 // when painting the shadow. On the other hand, it introduces su
bpixel gaps along the |
| 2429 // edges if they are not pixel-aligned. Those are avoided by ins
etting the clipping path | 2428 // edges if they are not pixel-aligned. Those are avoided by ins
etting the clipping path |
| 2430 // by one pixel. | 2429 // by one pixel. |
| 2431 if (hasOpaqueBackground) { | 2430 if (hasOpaqueBackground) { |
| 2432 // FIXME: The function to decide on the policy based on the
transform should be a named function. | 2431 // FIXME: The function to decide on the policy based on the
transform should be a named function. |
| 2433 // FIXME: It's not clear if this check is right. What about
integral scale factors? | 2432 // FIXME: It's not clear if this check is right. What about
integral scale factors? |
| 2434 AffineTransform transform = context->getCTM(); | 2433 AffineTransform transform = context->getCTM(); |
| 2435 if (transform.a() != 1 || (transform.d() != 1 && transform.d
() != -1) || transform.b() || transform.c()) | 2434 if (transform.a() != 1 || (transform.d() != 1 && transform.d
() != -1) || transform.b() || transform.c()) |
| 2436 rectToClipOut.inflate(-1); | 2435 rectToClipOut.inflate(-1); |
| 2437 } | 2436 } |
| 2438 | 2437 |
| 2439 if (!rectToClipOut.isEmpty()) | 2438 if (!rectToClipOut.isEmpty()) |
| 2440 context->clipOut(rectToClipOut); | 2439 context->clipOut(rectToClipOut); |
| 2441 context->fillRect(fillRect.rect(), Color::black, s->colorSpace()
); | 2440 context->fillRect(fillRect.rect(), Color::black); |
| 2442 } | 2441 } |
| 2443 } else { | 2442 } else { |
| 2444 // Inset shadow. | 2443 // Inset shadow. |
| 2445 IntRect holeRect(border.rect()); | 2444 IntRect holeRect(border.rect()); |
| 2446 holeRect.inflate(-shadowSpread); | 2445 holeRect.inflate(-shadowSpread); |
| 2447 | 2446 |
| 2448 if (holeRect.isEmpty()) { | 2447 if (holeRect.isEmpty()) { |
| 2449 if (hasBorderRadius) | 2448 if (hasBorderRadius) |
| 2450 context->fillRoundedRect(border, shadowColor, s->colorSpace(
)); | 2449 context->fillRoundedRect(border, shadowColor); |
| 2451 else | 2450 else |
| 2452 context->fillRect(border.rect(), shadowColor, s->colorSpace(
)); | 2451 context->fillRect(border.rect(), shadowColor); |
| 2453 continue; | 2452 continue; |
| 2454 } | 2453 } |
| 2455 | 2454 |
| 2456 if (!includeLogicalLeftEdge) { | 2455 if (!includeLogicalLeftEdge) { |
| 2457 if (isHorizontal) { | 2456 if (isHorizontal) { |
| 2458 holeRect.move(-max(shadowOffset.width(), 0) - shadowBlur, 0)
; | 2457 holeRect.move(-max(shadowOffset.width(), 0) - shadowBlur, 0)
; |
| 2459 holeRect.setWidth(holeRect.width() + max(shadowOffset.width(
), 0) + shadowBlur); | 2458 holeRect.setWidth(holeRect.width() + max(shadowOffset.width(
), 0) + shadowBlur); |
| 2460 } else { | 2459 } else { |
| 2461 holeRect.move(0, -max(shadowOffset.height(), 0) - shadowBlur
); | 2460 holeRect.move(0, -max(shadowOffset.height(), 0) - shadowBlur
); |
| 2462 holeRect.setHeight(holeRect.height() + max(shadowOffset.heig
ht(), 0) + shadowBlur); | 2461 holeRect.setHeight(holeRect.height() + max(shadowOffset.heig
ht(), 0) + shadowBlur); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2480 path.addRoundedRect(border); | 2479 path.addRoundedRect(border); |
| 2481 context->clipPath(path); | 2480 context->clipPath(path); |
| 2482 roundedHole.shrinkRadii(shadowSpread); | 2481 roundedHole.shrinkRadii(shadowSpread); |
| 2483 } else | 2482 } else |
| 2484 context->clip(border.rect()); | 2483 context->clip(border.rect()); |
| 2485 | 2484 |
| 2486 DrawLooper drawLooper; | 2485 DrawLooper drawLooper; |
| 2487 drawLooper.addShadow(shadowOffset, shadowBlur, shadowColor, | 2486 drawLooper.addShadow(shadowOffset, shadowBlur, shadowColor, |
| 2488 DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresA
lpha); | 2487 DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresA
lpha); |
| 2489 context->setDrawLooper(drawLooper); | 2488 context->setDrawLooper(drawLooper); |
| 2490 context->fillRectWithRoundedHole(outerRect, roundedHole, fillColor,
s->colorSpace()); | 2489 context->fillRectWithRoundedHole(outerRect, roundedHole, fillColor); |
| 2491 } | 2490 } |
| 2492 } | 2491 } |
| 2493 } | 2492 } |
| 2494 | 2493 |
| 2495 LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const | 2494 LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const |
| 2496 { | 2495 { |
| 2497 return containingBlock()->availableLogicalWidth(); | 2496 return containingBlock()->availableLogicalWidth(); |
| 2498 } | 2497 } |
| 2499 | 2498 |
| 2500 RenderBoxModelObject* RenderBoxModelObject::continuation() const | 2499 RenderBoxModelObject* RenderBoxModelObject::continuation() const |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2665 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2664 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
| 2666 for (RenderObject* child = startChild; child && child != endChild; ) { | 2665 for (RenderObject* child = startChild; child && child != endChild; ) { |
| 2667 // Save our next sibling as moveChildTo will clear it. | 2666 // Save our next sibling as moveChildTo will clear it. |
| 2668 RenderObject* nextSibling = child->nextSibling(); | 2667 RenderObject* nextSibling = child->nextSibling(); |
| 2669 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2668 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
| 2670 child = nextSibling; | 2669 child = nextSibling; |
| 2671 } | 2670 } |
| 2672 } | 2671 } |
| 2673 | 2672 |
| 2674 } // namespace WebCore | 2673 } // namespace WebCore |
| OLD | NEW |