| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
| 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 void RenderStyle::setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horiz
ontal_border_spacing, v); } | 779 void RenderStyle::setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horiz
ontal_border_spacing, v); } |
| 780 void RenderStyle::setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertica
l_border_spacing, v); } | 780 void RenderStyle::setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertica
l_border_spacing, v); } |
| 781 | 781 |
| 782 RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, bool
includeLogicalLeftEdge, bool includeLogicalRightEdge) const | 782 RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, bool
includeLogicalLeftEdge, bool includeLogicalRightEdge) const |
| 783 { | 783 { |
| 784 IntRect snappedBorderRect(pixelSnappedIntRect(borderRect)); | 784 IntRect snappedBorderRect(pixelSnappedIntRect(borderRect)); |
| 785 RoundedRect roundedRect(snappedBorderRect); | 785 RoundedRect roundedRect(snappedBorderRect); |
| 786 if (hasBorderRadius()) { | 786 if (hasBorderRadius()) { |
| 787 RoundedRect::Radii radii = calcRadiiFor(surround->border, snappedBorderR
ect.size()); | 787 RoundedRect::Radii radii = calcRadiiFor(surround->border, snappedBorderR
ect.size()); |
| 788 radii.scale(calcBorderRadiiConstraintScaleFor(borderRect, radii)); | 788 radii.scale(calcBorderRadiiConstraintScaleFor(borderRect, radii)); |
| 789 roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includ
eLogicalLeftEdge, includeLogicalRightEdge); | 789 roundedRect.includeLogicalEdges(radii, includeLogicalLeftEdge, includeLo
gicalRightEdge); |
| 790 } | 790 } |
| 791 return roundedRect; | 791 return roundedRect; |
| 792 } | 792 } |
| 793 | 793 |
| 794 RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect,
bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const | 794 RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect,
bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const |
| 795 { | 795 { |
| 796 bool horizontal = isHorizontalWritingMode(); | 796 int leftWidth = (includeLogicalLeftEdge) ? borderLeftWidth() : 0; |
| 797 | 797 int rightWidth = (includeLogicalRightEdge) ? borderRightWidth() : 0; |
| 798 int leftWidth = (!horizontal || includeLogicalLeftEdge) ? borderLeftWidth()
: 0; | 798 int topWidth = borderTopWidth(); |
| 799 int rightWidth = (!horizontal || includeLogicalRightEdge) ? borderRightWidth
() : 0; | 799 int bottomWidth = borderBottomWidth(); |
| 800 int topWidth = (horizontal || includeLogicalLeftEdge) ? borderTopWidth() : 0
; | |
| 801 int bottomWidth = (horizontal || includeLogicalRightEdge) ? borderBottomWidt
h() : 0; | |
| 802 | 800 |
| 803 return getRoundedInnerBorderFor(borderRect, topWidth, bottomWidth, leftWidth
, rightWidth, includeLogicalLeftEdge, includeLogicalRightEdge); | 801 return getRoundedInnerBorderFor(borderRect, topWidth, bottomWidth, leftWidth
, rightWidth, includeLogicalLeftEdge, includeLogicalRightEdge); |
| 804 } | 802 } |
| 805 | 803 |
| 806 RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect, | 804 RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect, |
| 807 int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLo
gicalLeftEdge, bool includeLogicalRightEdge) const | 805 int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLo
gicalLeftEdge, bool includeLogicalRightEdge) const |
| 808 { | 806 { |
| 809 LayoutRect innerRect(borderRect.x() + leftWidth, | 807 LayoutRect innerRect(borderRect.x() + leftWidth, |
| 810 borderRect.y() + topWidth, | 808 borderRect.y() + topWidth, |
| 811 borderRect.width() - leftWidth - rightWidth, | 809 borderRect.width() - leftWidth - rightWidth, |
| 812 borderRect.height() - topWidth - bottomWidth); | 810 borderRect.height() - topWidth - bottomWidth); |
| 813 | 811 |
| 814 RoundedRect roundedRect(pixelSnappedIntRect(innerRect)); | 812 RoundedRect roundedRect(pixelSnappedIntRect(innerRect)); |
| 815 | 813 |
| 816 if (hasBorderRadius()) { | 814 if (hasBorderRadius()) { |
| 817 RoundedRect::Radii radii = getRoundedBorderFor(borderRect).radii(); | 815 RoundedRect::Radii radii = getRoundedBorderFor(borderRect).radii(); |
| 818 radii.shrink(topWidth, bottomWidth, leftWidth, rightWidth); | 816 radii.shrink(topWidth, bottomWidth, leftWidth, rightWidth); |
| 819 roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includ
eLogicalLeftEdge, includeLogicalRightEdge); | 817 roundedRect.includeLogicalEdges(radii, includeLogicalLeftEdge, includeLo
gicalRightEdge); |
| 820 } | 818 } |
| 821 return roundedRect; | 819 return roundedRect; |
| 822 } | 820 } |
| 823 | 821 |
| 824 static bool allLayersAreFixed(const FillLayer& layer) | 822 static bool allLayersAreFixed(const FillLayer& layer) |
| 825 { | 823 { |
| 826 for (const FillLayer* currLayer = &layer; currLayer; currLayer = currLayer->
next()) { | 824 for (const FillLayer* currLayer = &layer; currLayer; currLayer = currLayer->
next()) { |
| 827 if (!currLayer->image() || currLayer->attachment() != FixedBackgroundAtt
achment) | 825 if (!currLayer->image() || currLayer->attachment() != FixedBackgroundAtt
achment) |
| 828 return false; | 826 return false; |
| 829 } | 827 } |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 } | 1260 } |
| 1263 | 1261 |
| 1264 const BorderValue& RenderStyle::borderAfter() const | 1262 const BorderValue& RenderStyle::borderAfter() const |
| 1265 { | 1263 { |
| 1266 // FIXME(sky): Remove | 1264 // FIXME(sky): Remove |
| 1267 return borderBottom(); | 1265 return borderBottom(); |
| 1268 } | 1266 } |
| 1269 | 1267 |
| 1270 const BorderValue& RenderStyle::borderStart() const | 1268 const BorderValue& RenderStyle::borderStart() const |
| 1271 { | 1269 { |
| 1272 if (isHorizontalWritingMode()) | 1270 return isLeftToRightDirection() ? borderLeft() : borderRight(); |
| 1273 return isLeftToRightDirection() ? borderLeft() : borderRight(); | |
| 1274 return isLeftToRightDirection() ? borderTop() : borderBottom(); | |
| 1275 } | 1271 } |
| 1276 | 1272 |
| 1277 const BorderValue& RenderStyle::borderEnd() const | 1273 const BorderValue& RenderStyle::borderEnd() const |
| 1278 { | 1274 { |
| 1279 if (isHorizontalWritingMode()) | 1275 return isLeftToRightDirection() ? borderRight() : borderLeft(); |
| 1280 return isLeftToRightDirection() ? borderRight() : borderLeft(); | |
| 1281 return isLeftToRightDirection() ? borderBottom() : borderTop(); | |
| 1282 } | 1276 } |
| 1283 | 1277 |
| 1284 unsigned short RenderStyle::borderBeforeWidth() const | 1278 unsigned short RenderStyle::borderBeforeWidth() const |
| 1285 { | 1279 { |
| 1286 // FIXME(sky): Remove | 1280 // FIXME(sky): Remove |
| 1287 return borderTopWidth(); | 1281 return borderTopWidth(); |
| 1288 } | 1282 } |
| 1289 | 1283 |
| 1290 unsigned short RenderStyle::borderAfterWidth() const | 1284 unsigned short RenderStyle::borderAfterWidth() const |
| 1291 { | 1285 { |
| 1292 // FIXME(sky): Remove | 1286 // FIXME(sky): Remove |
| 1293 return borderBottomWidth(); | 1287 return borderBottomWidth(); |
| 1294 } | 1288 } |
| 1295 | 1289 |
| 1296 unsigned short RenderStyle::borderStartWidth() const | 1290 unsigned short RenderStyle::borderStartWidth() const |
| 1297 { | 1291 { |
| 1298 if (isHorizontalWritingMode()) | 1292 return isLeftToRightDirection() ? borderLeftWidth() : borderRightWidth(); |
| 1299 return isLeftToRightDirection() ? borderLeftWidth() : borderRightWidth()
; | |
| 1300 return isLeftToRightDirection() ? borderTopWidth() : borderBottomWidth(); | |
| 1301 } | 1293 } |
| 1302 | 1294 |
| 1303 unsigned short RenderStyle::borderEndWidth() const | 1295 unsigned short RenderStyle::borderEndWidth() const |
| 1304 { | 1296 { |
| 1305 if (isHorizontalWritingMode()) | 1297 return isLeftToRightDirection() ? borderRightWidth() : borderLeftWidth(); |
| 1306 return isLeftToRightDirection() ? borderRightWidth() : borderLeftWidth()
; | |
| 1307 return isLeftToRightDirection() ? borderBottomWidth() : borderTopWidth(); | |
| 1308 } | 1298 } |
| 1309 | 1299 |
| 1310 void RenderStyle::setMarginStart(const Length& margin) | 1300 void RenderStyle::setMarginStart(const Length& margin) |
| 1311 { | 1301 { |
| 1312 if (isHorizontalWritingMode()) { | 1302 if (isLeftToRightDirection()) |
| 1313 if (isLeftToRightDirection()) | 1303 setMarginLeft(margin); |
| 1314 setMarginLeft(margin); | 1304 else |
| 1315 else | 1305 setMarginRight(margin); |
| 1316 setMarginRight(margin); | |
| 1317 } else { | |
| 1318 if (isLeftToRightDirection()) | |
| 1319 setMarginTop(margin); | |
| 1320 else | |
| 1321 setMarginBottom(margin); | |
| 1322 } | |
| 1323 } | 1306 } |
| 1324 | 1307 |
| 1325 void RenderStyle::setMarginEnd(const Length& margin) | 1308 void RenderStyle::setMarginEnd(const Length& margin) |
| 1326 { | 1309 { |
| 1327 if (isHorizontalWritingMode()) { | 1310 if (isLeftToRightDirection()) |
| 1328 if (isLeftToRightDirection()) | 1311 setMarginRight(margin); |
| 1329 setMarginRight(margin); | 1312 else |
| 1330 else | 1313 setMarginLeft(margin); |
| 1331 setMarginLeft(margin); | |
| 1332 } else { | |
| 1333 if (isLeftToRightDirection()) | |
| 1334 setMarginBottom(margin); | |
| 1335 else | |
| 1336 setMarginTop(margin); | |
| 1337 } | |
| 1338 } | 1314 } |
| 1339 | 1315 |
| 1340 TextEmphasisMark RenderStyle::textEmphasisMark() const | 1316 TextEmphasisMark RenderStyle::textEmphasisMark() const |
| 1341 { | 1317 { |
| 1342 TextEmphasisMark mark = static_cast<TextEmphasisMark>(rareInheritedData->tex
tEmphasisMark); | 1318 TextEmphasisMark mark = static_cast<TextEmphasisMark>(rareInheritedData->tex
tEmphasisMark); |
| 1343 if (mark != TextEmphasisMarkAuto) | 1319 if (mark != TextEmphasisMarkAuto) |
| 1344 return mark; | 1320 return mark; |
| 1345 | 1321 return TextEmphasisMarkDot; |
| 1346 if (isHorizontalWritingMode()) | |
| 1347 return TextEmphasisMarkDot; | |
| 1348 | |
| 1349 return TextEmphasisMarkSesame; | |
| 1350 } | 1322 } |
| 1351 | 1323 |
| 1352 Color RenderStyle::initialTapHighlightColor() | 1324 Color RenderStyle::initialTapHighlightColor() |
| 1353 { | 1325 { |
| 1354 return RenderTheme::tapHighlightColor(); | 1326 return RenderTheme::tapHighlightColor(); |
| 1355 } | 1327 } |
| 1356 | 1328 |
| 1357 LayoutBoxExtent RenderStyle::imageOutsets(const NinePieceImage& image) const | 1329 LayoutBoxExtent RenderStyle::imageOutsets(const NinePieceImage& image) const |
| 1358 { | 1330 { |
| 1359 return LayoutBoxExtent(NinePieceImage::computeOutset(image.outset().top(), b
orderTopWidth()), | 1331 return LayoutBoxExtent(NinePieceImage::computeOutset(image.outset().top(), b
orderTopWidth()), |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 // right | 1388 // right |
| 1417 radiiSum = radii.topRight().height() + radii.bottomRight().height(); | 1389 radiiSum = radii.topRight().height() + radii.bottomRight().height(); |
| 1418 if (radiiSum > rect.height()) | 1390 if (radiiSum > rect.height()) |
| 1419 factor = std::min(rect.height() / radiiSum, factor); | 1391 factor = std::min(rect.height() / radiiSum, factor); |
| 1420 | 1392 |
| 1421 ASSERT(factor <= 1); | 1393 ASSERT(factor <= 1); |
| 1422 return factor; | 1394 return factor; |
| 1423 } | 1395 } |
| 1424 | 1396 |
| 1425 } // namespace blink | 1397 } // namespace blink |
| OLD | NEW |