| 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 29 matching lines...) Expand all Loading... |
| 40 #include "core/rendering/RenderView.h" | 40 #include "core/rendering/RenderView.h" |
| 41 #include "core/rendering/compositing/CompositedLayerMapping.h" | 41 #include "core/rendering/compositing/CompositedLayerMapping.h" |
| 42 #include "core/rendering/compositing/RenderLayerCompositor.h" | 42 #include "core/rendering/compositing/RenderLayerCompositor.h" |
| 43 #include "core/rendering/style/ShadowList.h" | 43 #include "core/rendering/style/ShadowList.h" |
| 44 #include "platform/geometry/TransformState.h" | 44 #include "platform/geometry/TransformState.h" |
| 45 #include "platform/graphics/DrawLooperBuilder.h" | 45 #include "platform/graphics/DrawLooperBuilder.h" |
| 46 #include "platform/graphics/GraphicsContextStateSaver.h" | 46 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 47 #include "platform/graphics/Path.h" | 47 #include "platform/graphics/Path.h" |
| 48 #include "wtf/CurrentTime.h" | 48 #include "wtf/CurrentTime.h" |
| 49 | 49 |
| 50 using namespace std; | |
| 51 | |
| 52 namespace WebCore { | 50 namespace WebCore { |
| 53 | 51 |
| 54 using namespace HTMLNames; | 52 using namespace HTMLNames; |
| 55 | 53 |
| 56 // The HashMap for storing continuation pointers. | 54 // The HashMap for storing continuation pointers. |
| 57 // An inline can be split with blocks occuring in between the inline content. | 55 // An inline can be split with blocks occuring in between the inline content. |
| 58 // When this occurs we need a pointer to the next object. We can basically be | 56 // When this occurs we need a pointer to the next object. We can basically be |
| 59 // split into a sequence of inlines and blocks. The continuation will either be | 57 // split into a sequence of inlines and blocks. The continuation will either be |
| 60 // an anonymous block (that houses other blocks) or it will be an inline flow. | 58 // an anonymous block (that houses other blocks) or it will be an inline flow. |
| 61 // <b><i><p>Hello</p></i></b>. In this example the <i> will have a block as | 59 // <b><i><p>Hello</p></i></b>. In this example the <i> will have a block as |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 | 917 |
| 920 // If the image has neither an intrinsic width nor an intrinsic heig
ht, its size is determined as for ‘contain’. | 918 // If the image has neither an intrinsic width nor an intrinsic heig
ht, its size is determined as for ‘contain’. |
| 921 type = Contain; | 919 type = Contain; |
| 922 } | 920 } |
| 923 case Contain: | 921 case Contain: |
| 924 case Cover: { | 922 case Cover: { |
| 925 float horizontalScaleFactor = imageIntrinsicSize.width() | 923 float horizontalScaleFactor = imageIntrinsicSize.width() |
| 926 ? static_cast<float>(positioningAreaSize.width()) / imageIntrins
icSize.width() : 1; | 924 ? static_cast<float>(positioningAreaSize.width()) / imageIntrins
icSize.width() : 1; |
| 927 float verticalScaleFactor = imageIntrinsicSize.height() | 925 float verticalScaleFactor = imageIntrinsicSize.height() |
| 928 ? static_cast<float>(positioningAreaSize.height()) / imageIntrin
sicSize.height() : 1; | 926 ? static_cast<float>(positioningAreaSize.height()) / imageIntrin
sicSize.height() : 1; |
| 929 float scaleFactor = type == Contain ? min(horizontalScaleFactor, ver
ticalScaleFactor) : max(horizontalScaleFactor, verticalScaleFactor); | 927 float scaleFactor = type == Contain ? std::min(horizontalScaleFactor
, verticalScaleFactor) : std::max(horizontalScaleFactor, verticalScaleFactor); |
| 930 return IntSize(max(1l, lround(imageIntrinsicSize.width() * scaleFact
or)), max(1l, lround(imageIntrinsicSize.height() * scaleFactor))); | 928 return IntSize(std::max(1l, lround(imageIntrinsicSize.width() * scal
eFactor)), std::max(1l, lround(imageIntrinsicSize.height() * scaleFactor))); |
| 931 } | 929 } |
| 932 } | 930 } |
| 933 | 931 |
| 934 ASSERT_NOT_REACHED(); | 932 ASSERT_NOT_REACHED(); |
| 935 return IntSize(); | 933 return IntSize(); |
| 936 } | 934 } |
| 937 | 935 |
| 938 void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatX(int xOffset) | 936 void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatX(int xOffset) |
| 939 { | 937 { |
| 940 m_destRect.move(max(xOffset, 0), 0); | 938 m_destRect.move(std::max(xOffset, 0), 0); |
| 941 m_phase.setX(-min(xOffset, 0)); | 939 m_phase.setX(-std::min(xOffset, 0)); |
| 942 m_destRect.setWidth(m_tileSize.width() + min(xOffset, 0)); | 940 m_destRect.setWidth(m_tileSize.width() + std::min(xOffset, 0)); |
| 943 } | 941 } |
| 944 void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatY(int yOffset) | 942 void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatY(int yOffset) |
| 945 { | 943 { |
| 946 m_destRect.move(0, max(yOffset, 0)); | 944 m_destRect.move(0, std::max(yOffset, 0)); |
| 947 m_phase.setY(-min(yOffset, 0)); | 945 m_phase.setY(-std::min(yOffset, 0)); |
| 948 m_destRect.setHeight(m_tileSize.height() + min(yOffset, 0)); | 946 m_destRect.setHeight(m_tileSize.height() + std::min(yOffset, 0)); |
| 949 } | 947 } |
| 950 | 948 |
| 951 void RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment(const Int
Point& attachmentPoint) | 949 void RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment(const Int
Point& attachmentPoint) |
| 952 { | 950 { |
| 953 IntPoint alignedPoint = attachmentPoint; | 951 IntPoint alignedPoint = attachmentPoint; |
| 954 m_phase.move(max(alignedPoint.x() - m_destRect.x(), 0), max(alignedPoint.y()
- m_destRect.y(), 0)); | 952 m_phase.move(std::max(alignedPoint.x() - m_destRect.x(), 0), std::max(aligne
dPoint.y() - m_destRect.y(), 0)); |
| 955 } | 953 } |
| 956 | 954 |
| 957 void RenderBoxModelObject::BackgroundImageGeometry::clip(const IntRect& clipRect
) | 955 void RenderBoxModelObject::BackgroundImageGeometry::clip(const IntRect& clipRect
) |
| 958 { | 956 { |
| 959 m_destRect.intersect(clipRect); | 957 m_destRect.intersect(clipRect); |
| 960 } | 958 } |
| 961 | 959 |
| 962 IntPoint RenderBoxModelObject::BackgroundImageGeometry::relativePhase() const | 960 IntPoint RenderBoxModelObject::BackgroundImageGeometry::relativePhase() const |
| 963 { | 961 { |
| 964 IntPoint phase = m_phase; | 962 IntPoint phase = m_phase; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 fillLayer->image()->setContainerSizeForRenderer(clientForBackgroundImage, fi
llTileSize, style()->effectiveZoom()); | 1064 fillLayer->image()->setContainerSizeForRenderer(clientForBackgroundImage, fi
llTileSize, style()->effectiveZoom()); |
| 1067 geometry.setTileSize(fillTileSize); | 1065 geometry.setTileSize(fillTileSize); |
| 1068 | 1066 |
| 1069 EFillRepeat backgroundRepeatX = fillLayer->repeatX(); | 1067 EFillRepeat backgroundRepeatX = fillLayer->repeatX(); |
| 1070 EFillRepeat backgroundRepeatY = fillLayer->repeatY(); | 1068 EFillRepeat backgroundRepeatY = fillLayer->repeatY(); |
| 1071 int availableWidth = positioningAreaSize.width() - geometry.tileSize().width
(); | 1069 int availableWidth = positioningAreaSize.width() - geometry.tileSize().width
(); |
| 1072 int availableHeight = positioningAreaSize.height() - geometry.tileSize().hei
ght(); | 1070 int availableHeight = positioningAreaSize.height() - geometry.tileSize().hei
ght(); |
| 1073 | 1071 |
| 1074 LayoutUnit computedXPosition = roundedMinimumValueForLength(fillLayer->xPosi
tion(), availableWidth); | 1072 LayoutUnit computedXPosition = roundedMinimumValueForLength(fillLayer->xPosi
tion(), availableWidth); |
| 1075 if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > 0 && fil
lTileSize.width() > 0) { | 1073 if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > 0 && fil
lTileSize.width() > 0) { |
| 1076 long nrTiles = max(1l, lroundf((float)positioningAreaSize.width() / fill
TileSize.width())); | 1074 long nrTiles = std::max(1l, lroundf((float)positioningAreaSize.width() /
fillTileSize.width())); |
| 1077 | 1075 |
| 1078 if (fillLayer->size().size.height().isAuto() && backgroundRepeatY != Rou
ndFill) { | 1076 if (fillLayer->size().size.height().isAuto() && backgroundRepeatY != Rou
ndFill) { |
| 1079 fillTileSize.setHeight(fillTileSize.height() * positioningAreaSize.w
idth() / (nrTiles * fillTileSize.width())); | 1077 fillTileSize.setHeight(fillTileSize.height() * positioningAreaSize.w
idth() / (nrTiles * fillTileSize.width())); |
| 1080 } | 1078 } |
| 1081 | 1079 |
| 1082 fillTileSize.setWidth(positioningAreaSize.width() / nrTiles); | 1080 fillTileSize.setWidth(positioningAreaSize.width() / nrTiles); |
| 1083 geometry.setTileSize(fillTileSize); | 1081 geometry.setTileSize(fillTileSize); |
| 1084 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().wid
th() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0); | 1082 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().wid
th() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0); |
| 1085 geometry.setSpaceSize(IntSize()); | 1083 geometry.setSpaceSize(IntSize()); |
| 1086 } | 1084 } |
| 1087 | 1085 |
| 1088 LayoutUnit computedYPosition = roundedMinimumValueForLength(fillLayer->yPosi
tion(), availableHeight); | 1086 LayoutUnit computedYPosition = roundedMinimumValueForLength(fillLayer->yPosi
tion(), availableHeight); |
| 1089 if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > 0 && fi
llTileSize.height() > 0) { | 1087 if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > 0 && fi
llTileSize.height() > 0) { |
| 1090 long nrTiles = max(1l, lroundf((float)positioningAreaSize.height() / fil
lTileSize.height())); | 1088 long nrTiles = std::max(1l, lroundf((float)positioningAreaSize.height()
/ fillTileSize.height())); |
| 1091 | 1089 |
| 1092 if (fillLayer->size().size.width().isAuto() && backgroundRepeatX != Roun
dFill) { | 1090 if (fillLayer->size().size.width().isAuto() && backgroundRepeatX != Roun
dFill) { |
| 1093 fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.hei
ght() / (nrTiles * fillTileSize.height())); | 1091 fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.hei
ght() / (nrTiles * fillTileSize.height())); |
| 1094 } | 1092 } |
| 1095 | 1093 |
| 1096 fillTileSize.setHeight(positioningAreaSize.height() / nrTiles); | 1094 fillTileSize.setHeight(positioningAreaSize.height() / nrTiles); |
| 1097 geometry.setTileSize(fillTileSize); | 1095 geometry.setTileSize(fillTileSize); |
| 1098 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he
ight() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0)
; | 1096 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he
ight() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0)
; |
| 1099 geometry.setSpaceSize(IntSize()); | 1097 geometry.setSpaceSize(IntSize()); |
| 1100 } | 1098 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 | 1176 |
| 1179 IntSize imageSize = calculateImageIntrinsicDimensions(styleImage, borderImag
eRect.size(), DoNotScaleByEffectiveZoom); | 1177 IntSize imageSize = calculateImageIntrinsicDimensions(styleImage, borderImag
eRect.size(), DoNotScaleByEffectiveZoom); |
| 1180 | 1178 |
| 1181 // If both values are ‘auto’ then the intrinsic width and/or height of the i
mage should be used, if any. | 1179 // If both values are ‘auto’ then the intrinsic width and/or height of the i
mage should be used, if any. |
| 1182 styleImage->setContainerSizeForRenderer(this, imageSize, style->effectiveZoo
m()); | 1180 styleImage->setContainerSizeForRenderer(this, imageSize, style->effectiveZoo
m()); |
| 1183 | 1181 |
| 1184 int imageWidth = imageSize.width(); | 1182 int imageWidth = imageSize.width(); |
| 1185 int imageHeight = imageSize.height(); | 1183 int imageHeight = imageSize.height(); |
| 1186 | 1184 |
| 1187 float imageScaleFactor = styleImage->imageScaleFactor(); | 1185 float imageScaleFactor = styleImage->imageScaleFactor(); |
| 1188 int topSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlic
es().top(), imageHeight)) * imageScaleFactor; | 1186 int topSlice = std::min<int>(imageHeight, valueForLength(ninePieceImage.imag
eSlices().top(), imageHeight)) * imageScaleFactor; |
| 1189 int rightSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSli
ces().right(), imageWidth)) * imageScaleFactor; | 1187 int rightSlice = std::min<int>(imageWidth, valueForLength(ninePieceImage.ima
geSlices().right(), imageWidth)) * imageScaleFactor; |
| 1190 int bottomSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageS
lices().bottom(), imageHeight)) * imageScaleFactor; | 1188 int bottomSlice = std::min<int>(imageHeight, valueForLength(ninePieceImage.i
mageSlices().bottom(), imageHeight)) * imageScaleFactor; |
| 1191 int leftSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlic
es().left(), imageWidth)) * imageScaleFactor; | 1189 int leftSlice = std::min<int>(imageWidth, valueForLength(ninePieceImage.imag
eSlices().left(), imageWidth)) * imageScaleFactor; |
| 1192 | 1190 |
| 1193 ENinePieceImageRule hRule = ninePieceImage.horizontalRule(); | 1191 ENinePieceImageRule hRule = ninePieceImage.horizontalRule(); |
| 1194 ENinePieceImageRule vRule = ninePieceImage.verticalRule(); | 1192 ENinePieceImageRule vRule = ninePieceImage.verticalRule(); |
| 1195 | 1193 |
| 1196 int topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), s
tyle->borderTopWidth(), topSlice, borderImageRect.height()); | 1194 int topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), s
tyle->borderTopWidth(), topSlice, borderImageRect.height()); |
| 1197 int rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(
), style->borderRightWidth(), rightSlice, borderImageRect.width()); | 1195 int rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(
), style->borderRightWidth(), rightSlice, borderImageRect.width()); |
| 1198 int bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().botto
m(), style->borderBottomWidth(), bottomSlice, borderImageRect.height()); | 1196 int bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().botto
m(), style->borderBottomWidth(), bottomSlice, borderImageRect.height()); |
| 1199 int leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(),
style->borderLeftWidth(), leftSlice, borderImageRect.width()); | 1197 int leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(),
style->borderLeftWidth(), leftSlice, borderImageRect.width()); |
| 1200 | 1198 |
| 1201 // Reduce the widths if they're too large. | 1199 // Reduce the widths if they're too large. |
| 1202 // 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 | 1200 // 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 |
| 1203 // offset for the side, let f = min(Lwidth/(Wleft+Wright), Lheight/(Wtop+Wbo
ttom)). If f < 1, then all W are reduced by | 1201 // offset for the side, let f = min(Lwidth/(Wleft+Wright), Lheight/(Wtop+Wbo
ttom)). If f < 1, then all W are reduced by |
| 1204 // multiplying them by f. | 1202 // multiplying them by f. |
| 1205 int borderSideWidth = max(1, leftWidth + rightWidth); | 1203 int borderSideWidth = std::max(1, leftWidth + rightWidth); |
| 1206 int borderSideHeight = max(1, topWidth + bottomWidth); | 1204 int borderSideHeight = std::max(1, topWidth + bottomWidth); |
| 1207 float borderSideScaleFactor = min((float)borderImageRect.width() / borderSid
eWidth, (float)borderImageRect.height() / borderSideHeight); | 1205 float borderSideScaleFactor = std::min((float)borderImageRect.width() / bord
erSideWidth, (float)borderImageRect.height() / borderSideHeight); |
| 1208 if (borderSideScaleFactor < 1) { | 1206 if (borderSideScaleFactor < 1) { |
| 1209 topWidth *= borderSideScaleFactor; | 1207 topWidth *= borderSideScaleFactor; |
| 1210 rightWidth *= borderSideScaleFactor; | 1208 rightWidth *= borderSideScaleFactor; |
| 1211 bottomWidth *= borderSideScaleFactor; | 1209 bottomWidth *= borderSideScaleFactor; |
| 1212 leftWidth *= borderSideScaleFactor; | 1210 leftWidth *= borderSideScaleFactor; |
| 1213 } | 1211 } |
| 1214 | 1212 |
| 1215 bool drawLeft = leftSlice > 0 && leftWidth > 0; | 1213 bool drawLeft = leftSlice > 0 && leftWidth > 0; |
| 1216 bool drawTop = topSlice > 0 && topWidth > 0; | 1214 bool drawTop = topSlice > 0 && topWidth > 0; |
| 1217 bool drawRight = rightSlice > 0 && rightWidth > 0; | 1215 bool drawRight = rightSlice > 0 && rightWidth > 0; |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 bool adjacentSide2StylesMatch = colorsMatchAtCorner(side, adjacentSide2, edg
es); | 1592 bool adjacentSide2StylesMatch = colorsMatchAtCorner(side, adjacentSide2, edg
es); |
| 1595 | 1593 |
| 1596 const Color& colorToPaint = overrideColor ? *overrideColor : edgeToRender.co
lor; | 1594 const Color& colorToPaint = overrideColor ? *overrideColor : edgeToRender.co
lor; |
| 1597 | 1595 |
| 1598 if (path) { | 1596 if (path) { |
| 1599 GraphicsContextStateSaver stateSaver(*graphicsContext); | 1597 GraphicsContextStateSaver stateSaver(*graphicsContext); |
| 1600 if (innerBorder.isRenderable()) | 1598 if (innerBorder.isRenderable()) |
| 1601 clipBorderSidePolygon(graphicsContext, outerBorder, innerBorder, sid
e, adjacentSide1StylesMatch, adjacentSide2StylesMatch); | 1599 clipBorderSidePolygon(graphicsContext, outerBorder, innerBorder, sid
e, adjacentSide1StylesMatch, adjacentSide2StylesMatch); |
| 1602 else | 1600 else |
| 1603 clipBorderSideForComplexInnerPath(graphicsContext, outerBorder, inne
rBorder, side, edges); | 1601 clipBorderSideForComplexInnerPath(graphicsContext, outerBorder, inne
rBorder, side, edges); |
| 1604 float thickness = max(max(edgeToRender.width, adjacentEdge1.width), adja
centEdge2.width); | 1602 float thickness = std::max(std::max(edgeToRender.width, adjacentEdge1.wi
dth), adjacentEdge2.width); |
| 1605 drawBoxSideFromPath(graphicsContext, outerBorder.rect(), *path, edges, e
dgeToRender.width, thickness, side, style, | 1603 drawBoxSideFromPath(graphicsContext, outerBorder.rect(), *path, edges, e
dgeToRender.width, thickness, side, style, |
| 1606 colorToPaint, edgeToRender.style, bleedAvoidance, includeLogicalLeft
Edge, includeLogicalRightEdge); | 1604 colorToPaint, edgeToRender.style, bleedAvoidance, includeLogicalLeft
Edge, includeLogicalRightEdge); |
| 1607 } else { | 1605 } else { |
| 1608 bool clipForStyle = styleRequiresClipPolygon(edgeToRender.style) && (mit
reAdjacentSide1 || mitreAdjacentSide2); | 1606 bool clipForStyle = styleRequiresClipPolygon(edgeToRender.style) && (mit
reAdjacentSide1 || mitreAdjacentSide2); |
| 1609 bool clipAdjacentSide1 = colorNeedsAntiAliasAtCorner(side, adjacentSide1
, edges) && mitreAdjacentSide1; | 1607 bool clipAdjacentSide1 = colorNeedsAntiAliasAtCorner(side, adjacentSide1
, edges) && mitreAdjacentSide1; |
| 1610 bool clipAdjacentSide2 = colorNeedsAntiAliasAtCorner(side, adjacentSide2
, edges) && mitreAdjacentSide2; | 1608 bool clipAdjacentSide2 = colorNeedsAntiAliasAtCorner(side, adjacentSide2
, edges) && mitreAdjacentSide2; |
| 1611 bool shouldClip = clipForStyle || clipAdjacentSide1 || clipAdjacentSide2
; | 1609 bool shouldClip = clipForStyle || clipAdjacentSide1 || clipAdjacentSide2
; |
| 1612 | 1610 |
| 1613 GraphicsContextStateSaver clipStateSaver(*graphicsContext, shouldClip); | 1611 GraphicsContextStateSaver clipStateSaver(*graphicsContext, shouldClip); |
| 1614 if (shouldClip) { | 1612 if (shouldClip) { |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2294 case BSTop: | 2292 case BSTop: |
| 2295 overshoot = newRadii.topLeft().width() + newRadii.topRight().width() - n
ewRect.width(); | 2293 overshoot = newRadii.topLeft().width() + newRadii.topRight().width() - n
ewRect.width(); |
| 2296 if (overshoot > 0) { | 2294 if (overshoot > 0) { |
| 2297 ASSERT(!(newRadii.topLeft().width() && newRadii.topRight().width()))
; | 2295 ASSERT(!(newRadii.topLeft().width() && newRadii.topRight().width()))
; |
| 2298 newRect.setWidth(newRect.width() + overshoot); | 2296 newRect.setWidth(newRect.width() + overshoot); |
| 2299 if (!newRadii.topLeft().width()) | 2297 if (!newRadii.topLeft().width()) |
| 2300 newRect.move(-overshoot, 0); | 2298 newRect.move(-overshoot, 0); |
| 2301 } | 2299 } |
| 2302 newRadii.setBottomLeft(IntSize(0, 0)); | 2300 newRadii.setBottomLeft(IntSize(0, 0)); |
| 2303 newRadii.setBottomRight(IntSize(0, 0)); | 2301 newRadii.setBottomRight(IntSize(0, 0)); |
| 2304 maxRadii = max(newRadii.topLeft().height(), newRadii.topRight().height()
); | 2302 maxRadii = std::max(newRadii.topLeft().height(), newRadii.topRight().hei
ght()); |
| 2305 if (maxRadii > newRect.height()) | 2303 if (maxRadii > newRect.height()) |
| 2306 newRect.setHeight(maxRadii); | 2304 newRect.setHeight(maxRadii); |
| 2307 break; | 2305 break; |
| 2308 | 2306 |
| 2309 case BSBottom: | 2307 case BSBottom: |
| 2310 overshoot = newRadii.bottomLeft().width() + newRadii.bottomRight().width
() - newRect.width(); | 2308 overshoot = newRadii.bottomLeft().width() + newRadii.bottomRight().width
() - newRect.width(); |
| 2311 if (overshoot > 0) { | 2309 if (overshoot > 0) { |
| 2312 ASSERT(!(newRadii.bottomLeft().width() && newRadii.bottomRight().wid
th())); | 2310 ASSERT(!(newRadii.bottomLeft().width() && newRadii.bottomRight().wid
th())); |
| 2313 newRect.setWidth(newRect.width() + overshoot); | 2311 newRect.setWidth(newRect.width() + overshoot); |
| 2314 if (!newRadii.bottomLeft().width()) | 2312 if (!newRadii.bottomLeft().width()) |
| 2315 newRect.move(-overshoot, 0); | 2313 newRect.move(-overshoot, 0); |
| 2316 } | 2314 } |
| 2317 newRadii.setTopLeft(IntSize(0, 0)); | 2315 newRadii.setTopLeft(IntSize(0, 0)); |
| 2318 newRadii.setTopRight(IntSize(0, 0)); | 2316 newRadii.setTopRight(IntSize(0, 0)); |
| 2319 maxRadii = max(newRadii.bottomLeft().height(), newRadii.bottomRight().he
ight()); | 2317 maxRadii = std::max(newRadii.bottomLeft().height(), newRadii.bottomRight
().height()); |
| 2320 if (maxRadii > newRect.height()) { | 2318 if (maxRadii > newRect.height()) { |
| 2321 newRect.move(0, newRect.height() - maxRadii); | 2319 newRect.move(0, newRect.height() - maxRadii); |
| 2322 newRect.setHeight(maxRadii); | 2320 newRect.setHeight(maxRadii); |
| 2323 } | 2321 } |
| 2324 break; | 2322 break; |
| 2325 | 2323 |
| 2326 case BSLeft: | 2324 case BSLeft: |
| 2327 overshoot = newRadii.topLeft().height() + newRadii.bottomLeft().height()
- newRect.height(); | 2325 overshoot = newRadii.topLeft().height() + newRadii.bottomLeft().height()
- newRect.height(); |
| 2328 if (overshoot > 0) { | 2326 if (overshoot > 0) { |
| 2329 ASSERT(!(newRadii.topLeft().height() && newRadii.bottomLeft().height
())); | 2327 ASSERT(!(newRadii.topLeft().height() && newRadii.bottomLeft().height
())); |
| 2330 newRect.setHeight(newRect.height() + overshoot); | 2328 newRect.setHeight(newRect.height() + overshoot); |
| 2331 if (!newRadii.topLeft().height()) | 2329 if (!newRadii.topLeft().height()) |
| 2332 newRect.move(0, -overshoot); | 2330 newRect.move(0, -overshoot); |
| 2333 } | 2331 } |
| 2334 newRadii.setTopRight(IntSize(0, 0)); | 2332 newRadii.setTopRight(IntSize(0, 0)); |
| 2335 newRadii.setBottomRight(IntSize(0, 0)); | 2333 newRadii.setBottomRight(IntSize(0, 0)); |
| 2336 maxRadii = max(newRadii.topLeft().width(), newRadii.bottomLeft().width()
); | 2334 maxRadii = std::max(newRadii.topLeft().width(), newRadii.bottomLeft().wi
dth()); |
| 2337 if (maxRadii > newRect.width()) | 2335 if (maxRadii > newRect.width()) |
| 2338 newRect.setWidth(maxRadii); | 2336 newRect.setWidth(maxRadii); |
| 2339 break; | 2337 break; |
| 2340 | 2338 |
| 2341 case BSRight: | 2339 case BSRight: |
| 2342 overshoot = newRadii.topRight().height() + newRadii.bottomRight().height
() - newRect.height(); | 2340 overshoot = newRadii.topRight().height() + newRadii.bottomRight().height
() - newRect.height(); |
| 2343 if (overshoot > 0) { | 2341 if (overshoot > 0) { |
| 2344 ASSERT(!(newRadii.topRight().height() && newRadii.bottomRight().heig
ht())); | 2342 ASSERT(!(newRadii.topRight().height() && newRadii.bottomRight().heig
ht())); |
| 2345 newRect.setHeight(newRect.height() + overshoot); | 2343 newRect.setHeight(newRect.height() + overshoot); |
| 2346 if (!newRadii.topRight().height()) | 2344 if (!newRadii.topRight().height()) |
| 2347 newRect.move(0, -overshoot); | 2345 newRect.move(0, -overshoot); |
| 2348 } | 2346 } |
| 2349 newRadii.setTopLeft(IntSize(0, 0)); | 2347 newRadii.setTopLeft(IntSize(0, 0)); |
| 2350 newRadii.setBottomLeft(IntSize(0, 0)); | 2348 newRadii.setBottomLeft(IntSize(0, 0)); |
| 2351 maxRadii = max(newRadii.topRight().width(), newRadii.bottomRight().width
()); | 2349 maxRadii = std::max(newRadii.topRight().width(), newRadii.bottomRight().
width()); |
| 2352 if (maxRadii > newRect.width()) { | 2350 if (maxRadii > newRect.width()) { |
| 2353 newRect.move(newRect.width() - maxRadii, 0); | 2351 newRect.move(newRect.width() - maxRadii, 0); |
| 2354 newRect.setWidth(maxRadii); | 2352 newRect.setWidth(maxRadii); |
| 2355 } | 2353 } |
| 2356 break; | 2354 break; |
| 2357 } | 2355 } |
| 2358 | 2356 |
| 2359 return RoundedRect(newRect, newRadii); | 2357 return RoundedRect(newRect, newRadii); |
| 2360 } | 2358 } |
| 2361 | 2359 |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2719 x += textIndentOffset / 2; | 2717 x += textIndentOffset / 2; |
| 2720 else | 2718 else |
| 2721 x -= textIndentOffset / 2; | 2719 x -= textIndentOffset / 2; |
| 2722 break; | 2720 break; |
| 2723 case alignRight: | 2721 case alignRight: |
| 2724 x = maxX - caretWidth; | 2722 x = maxX - caretWidth; |
| 2725 if (!currentStyle->isLeftToRightDirection()) | 2723 if (!currentStyle->isLeftToRightDirection()) |
| 2726 x -= textIndentOffset; | 2724 x -= textIndentOffset; |
| 2727 break; | 2725 break; |
| 2728 } | 2726 } |
| 2729 x = min(x, max<LayoutUnit>(maxX - caretWidth, 0)); | 2727 x = std::min(x, std::max<LayoutUnit>(maxX - caretWidth, 0)); |
| 2730 | 2728 |
| 2731 LayoutUnit y = paddingTop() + borderTop(); | 2729 LayoutUnit y = paddingTop() + borderTop(); |
| 2732 | 2730 |
| 2733 return currentStyle->isHorizontalWritingMode() ? LayoutRect(x, y, caretWidth
, height) : LayoutRect(y, x, height, caretWidth); | 2731 return currentStyle->isHorizontalWritingMode() ? LayoutRect(x, y, caretWidth
, height) : LayoutRect(y, x, height, caretWidth); |
| 2734 } | 2732 } |
| 2735 | 2733 |
| 2736 bool RenderBoxModelObject::shouldAntialiasLines(GraphicsContext* context) | 2734 bool RenderBoxModelObject::shouldAntialiasLines(GraphicsContext* context) |
| 2737 { | 2735 { |
| 2738 // FIXME: We may want to not antialias when scaled by an integral value, | 2736 // FIXME: We may want to not antialias when scaled by an integral value, |
| 2739 // and we may want to antialias when translated by a non-integral value. | 2737 // and we may want to antialias when translated by a non-integral value. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2842 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2840 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
| 2843 for (RenderObject* child = startChild; child && child != endChild; ) { | 2841 for (RenderObject* child = startChild; child && child != endChild; ) { |
| 2844 // Save our next sibling as moveChildTo will clear it. | 2842 // Save our next sibling as moveChildTo will clear it. |
| 2845 RenderObject* nextSibling = child->nextSibling(); | 2843 RenderObject* nextSibling = child->nextSibling(); |
| 2846 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2844 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
| 2847 child = nextSibling; | 2845 child = nextSibling; |
| 2848 } | 2846 } |
| 2849 } | 2847 } |
| 2850 | 2848 |
| 2851 } // namespace WebCore | 2849 } // namespace WebCore |
| OLD | NEW |