summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/CSSBasicShapes.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
commit32761a6cee1d0dee366b885b7b9c777e67885688 (patch)
treed6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/css/CSSBasicShapes.cpp
parenta4e969f4965059196ca948db781e52f7cfebf19e (diff)
downloadWebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/css/CSSBasicShapes.cpp')
-rw-r--r--Source/WebCore/css/CSSBasicShapes.cpp442
1 files changed, 269 insertions, 173 deletions
diff --git a/Source/WebCore/css/CSSBasicShapes.cpp b/Source/WebCore/css/CSSBasicShapes.cpp
index 0f38723a3..c36f43e96 100644
--- a/Source/WebCore/css/CSSBasicShapes.cpp
+++ b/Source/WebCore/css/CSSBasicShapes.cpp
@@ -31,68 +31,79 @@
#include "CSSBasicShapes.h"
-#include "CSSParser.h"
#include "CSSPrimitiveValueMappings.h"
-#include "CSSValuePool.h"
#include "Pair.h"
-#include "SVGPathByteStream.h"
-#include "SVGPathUtilities.h"
#include <wtf/text/StringBuilder.h>
using namespace WTF;
namespace WebCore {
-static String serializePositionOffset(const Pair& offset, const Pair& other)
+static String buildRectangleString(const String& x, const String& y, const String& width, const String& height, const String& radiusX, const String& radiusY, const String& box)
{
- if ((offset.first()->getValueID() == CSSValueLeft && other.first()->getValueID() == CSSValueTop)
- || (offset.first()->getValueID() == CSSValueTop && other.first()->getValueID() == CSSValueLeft))
- return offset.second()->cssText();
- return offset.cssText();
+ char opening[] = "rectangle(";
+ char separator[] = ", ";
+ StringBuilder result;
+ // Compute the required capacity in advance to reduce allocations.
+ result.reserveCapacity((sizeof(opening) - 1) + (5 * (sizeof(separator) - 1)) + 1 + x.length() + y.length() + width.length() + height.length() + radiusX.length() + radiusY.length() + (box.length() ? box.length() + 1 : 0));
+ result.appendLiteral(opening);
+ result.append(x);
+ result.appendLiteral(separator);
+ result.append(y);
+ result.appendLiteral(separator);
+ result.append(width);
+ result.appendLiteral(separator);
+ result.append(height);
+ if (!radiusX.isNull()) {
+ result.appendLiteral(separator);
+ result.append(radiusX);
+ if (!radiusY.isNull()) {
+ result.appendLiteral(separator);
+ result.append(radiusY);
+ }
+ }
+ result.append(')');
+ if (box.length()) {
+ result.append(' ');
+ result.append(box);
+ }
+ return result.toString();
}
-static Ref<CSSPrimitiveValue> buildSerializablePositionOffset(PassRefPtr<CSSPrimitiveValue> offset, CSSValueID defaultSide)
+String CSSBasicShapeRectangle::cssText() const
{
- CSSValueID side = defaultSide;
- RefPtr<CSSPrimitiveValue> amount;
-
- if (!offset)
- side = CSSValueCenter;
- else if (offset->isValueID())
- side = offset->getValueID();
- else if (Pair* pair = offset->getPairValue()) {
- side = pair->first()->getValueID();
- amount = pair->second();
- } else
- amount = offset;
-
- auto& cssValuePool = CSSValuePool::singleton();
- if (side == CSSValueCenter) {
- side = defaultSide;
- amount = cssValuePool.createValue(Length(50, Percent));
- } else if ((side == CSSValueRight || side == CSSValueBottom)
- && amount->isPercentage()) {
- side = defaultSide;
- amount = cssValuePool.createValue(Length(100 - amount->getFloatValue(), Percent));
- } else if (amount->isLength() && !amount->getFloatValue()) {
- if (side == CSSValueRight || side == CSSValueBottom)
- amount = cssValuePool.createValue(Length(100, Percent));
- else
- amount = cssValuePool.createValue(Length(0, Percent));
- side = defaultSide;
- }
+ return buildRectangleString(m_x->cssText(),
+ m_y->cssText(),
+ m_width->cssText(),
+ m_height->cssText(),
+ m_radiusX.get() ? m_radiusX->cssText() : String(),
+ m_radiusY.get() ? m_radiusY->cssText() : String(),
+ m_layoutBox ? m_layoutBox->cssText() : String());
+}
- return cssValuePool.createValue(Pair::create(cssValuePool.createValue(side), amount.release()));
+bool CSSBasicShapeRectangle::equals(const CSSBasicShape& shape) const
+{
+ if (shape.type() != CSSBasicShapeRectangleType)
+ return false;
+
+ const CSSBasicShapeRectangle& other = static_cast<const CSSBasicShapeRectangle&>(shape);
+ return compareCSSValuePtr(m_x, other.m_x)
+ && compareCSSValuePtr(m_y, other.m_y)
+ && compareCSSValuePtr(m_width, other.m_width)
+ && compareCSSValuePtr(m_height, other.m_height)
+ && compareCSSValuePtr(m_radiusX, other.m_radiusX)
+ && compareCSSValuePtr(m_radiusY, other.m_radiusY)
+ && compareCSSValuePtr(m_layoutBox, other.m_layoutBox);
}
-static String buildCircleString(const String& radius, const String& centerX, const String& centerY)
+static String buildCircleString(const String& radius, const String& centerX, const String& centerY, const String& box)
{
char opening[] = "circle(";
char at[] = "at";
char separator[] = " ";
StringBuilder result;
result.appendLiteral(opening);
- if (!radius.isNull())
+ if (!radius.isNull())
result.append(radius);
if (!centerX.isNull() || !centerY.isNull()) {
@@ -105,35 +116,70 @@ static String buildCircleString(const String& radius, const String& centerX, con
result.append(centerY);
}
result.appendLiteral(")");
+ if (box.length()) {
+ result.appendLiteral(separator);
+ result.append(box);
+ }
return result.toString();
}
String CSSBasicShapeCircle::cssText() const
{
- Ref<CSSPrimitiveValue> normalizedCX = buildSerializablePositionOffset(m_centerX, CSSValueLeft);
- Ref<CSSPrimitiveValue> normalizedCY = buildSerializablePositionOffset(m_centerY, CSSValueTop);
+ return buildCircleString(m_radius ? m_radius->cssText() : String(),
+ m_centerX ? m_centerX->cssText() : String(),
+ m_centerY ? m_centerY->cssText() : String(),
+ m_layoutBox ? m_layoutBox->cssText() : String());
+}
- String radius;
- if (m_radius && m_radius->getValueID() != CSSValueClosestSide)
- radius = m_radius->cssText();
+bool CSSBasicShapeCircle::equals(const CSSBasicShape& shape) const
+{
+ if (shape.type() != CSSBasicShapeCircleType)
+ return false;
- return buildCircleString(radius,
- serializePositionOffset(*normalizedCX->getPairValue(), *normalizedCY->getPairValue()),
- serializePositionOffset(*normalizedCY->getPairValue(), *normalizedCX->getPairValue()));
+ const CSSBasicShapeCircle& other = static_cast<const CSSBasicShapeCircle&>(shape);
+ return compareCSSValuePtr(m_centerX, other.m_centerX)
+ && compareCSSValuePtr(m_centerY, other.m_centerY)
+ && compareCSSValuePtr(m_radius, other.m_radius)
+ && compareCSSValuePtr(m_layoutBox, other.m_layoutBox);
}
-bool CSSBasicShapeCircle::equals(const CSSBasicShape& shape) const
+static String buildDeprecatedCircleString(const String& x, const String& y, const String& radius, const String& box)
{
- if (!is<CSSBasicShapeCircle>(shape))
+ StringBuilder result;
+ char opening[] = "circle(";
+ char separator[] = ", ";
+ result.appendLiteral(opening);
+ result.append(x);
+ result.appendLiteral(separator);
+ result.append(y);
+ result.appendLiteral(separator);
+ result.append(radius);
+ result.append(')');
+ if (box.length()) {
+ result.append(' ');
+ result.append(box);
+ }
+ return result.toString();
+}
+
+String CSSDeprecatedBasicShapeCircle::cssText() const
+{
+ return buildDeprecatedCircleString(m_centerX->cssText(), m_centerY->cssText(), m_radius->cssText(), m_layoutBox ? m_layoutBox->cssText() : String());
+}
+
+bool CSSDeprecatedBasicShapeCircle::equals(const CSSBasicShape& shape) const
+{
+ if (shape.type() != CSSDeprecatedBasicShapeCircleType)
return false;
- const CSSBasicShapeCircle& other = downcast<CSSBasicShapeCircle>(shape);
+ const CSSDeprecatedBasicShapeCircle& other = static_cast<const CSSDeprecatedBasicShapeCircle&>(shape);
return compareCSSValuePtr(m_centerX, other.m_centerX)
&& compareCSSValuePtr(m_centerY, other.m_centerY)
- && compareCSSValuePtr(m_radius, other.m_radius);
+ && compareCSSValuePtr(m_radius, other.m_radius)
+ && compareCSSValuePtr(m_layoutBox, other.m_layoutBox);
}
-static String buildEllipseString(const String& radiusX, const String& radiusY, const String& centerX, const String& centerY)
+static String buildEllipseString(const String& radiusX, const String& radiusY, const String& centerX, const String& centerY, const String& box)
{
char opening[] = "ellipse(";
char at[] = "at";
@@ -162,96 +208,84 @@ static String buildEllipseString(const String& radiusX, const String& radiusY, c
result.append(centerY);
}
result.appendLiteral(")");
+ if (box.length()) {
+ result.appendLiteral(separator);
+ result.append(box);
+ }
return result.toString();
}
String CSSBasicShapeEllipse::cssText() const
{
- Ref<CSSPrimitiveValue> normalizedCX = buildSerializablePositionOffset(m_centerX, CSSValueLeft);
- Ref<CSSPrimitiveValue> normalizedCY = buildSerializablePositionOffset(m_centerY, CSSValueTop);
-
- String radiusX;
- String radiusY;
- if (m_radiusX) {
- bool shouldSerializeRadiusXValue = m_radiusX->getValueID() != CSSValueClosestSide;
- bool shouldSerializeRadiusYValue = false;
-
- if (m_radiusY) {
- shouldSerializeRadiusYValue = m_radiusY->getValueID() != CSSValueClosestSide;
- if (shouldSerializeRadiusYValue)
- radiusY = m_radiusY->cssText();
- }
- if (shouldSerializeRadiusXValue || (!shouldSerializeRadiusXValue && shouldSerializeRadiusYValue))
- radiusX = m_radiusX->cssText();
- }
- return buildEllipseString(radiusX, radiusY,
- serializePositionOffset(*normalizedCX->getPairValue(), *normalizedCY->getPairValue()),
- serializePositionOffset(*normalizedCY->getPairValue(), *normalizedCX->getPairValue()));
+ return buildEllipseString(m_radiusX ? m_radiusX->cssText() : String(),
+ m_radiusY ? m_radiusY->cssText() : String(),
+ m_centerX ? m_centerX->cssText() : String(),
+ m_centerY ? m_centerY->cssText() : String(),
+ m_layoutBox ? m_layoutBox->cssText() : String());
}
bool CSSBasicShapeEllipse::equals(const CSSBasicShape& shape) const
{
- if (!is<CSSBasicShapeEllipse>(shape))
+ if (shape.type() != CSSBasicShapeEllipseType)
return false;
- const CSSBasicShapeEllipse& other = downcast<CSSBasicShapeEllipse>(shape);
+ const CSSBasicShapeEllipse& other = static_cast<const CSSBasicShapeEllipse&>(shape);
return compareCSSValuePtr(m_centerX, other.m_centerX)
&& compareCSSValuePtr(m_centerY, other.m_centerY)
&& compareCSSValuePtr(m_radiusX, other.m_radiusX)
- && compareCSSValuePtr(m_radiusY, other.m_radiusY);
-}
-
-CSSBasicShapePath::CSSBasicShapePath(std::unique_ptr<SVGPathByteStream>&& pathData)
- : m_byteStream(WTFMove(pathData))
-{
+ && compareCSSValuePtr(m_radiusY, other.m_radiusY)
+ && compareCSSValuePtr(m_layoutBox, other.m_layoutBox);
}
-static String buildPathString(const WindRule& windRule, const String& path, const String& box)
+static String buildDeprecatedEllipseString(const String& x, const String& y, const String& radiusX, const String& radiusY, const String& box)
{
StringBuilder result;
- if (windRule == RULE_EVENODD)
- result.appendLiteral("path(evenodd, ");
- else
- result.appendLiteral("path(");
-
- result.append(quoteCSSString(path));
+ char opening[] = "ellipse(";
+ char separator[] = ", ";
+ result.appendLiteral(opening);
+ result.append(x);
+ result.appendLiteral(separator);
+ result.append(y);
+ result.appendLiteral(separator);
+ result.append(radiusX);
+ result.appendLiteral(separator);
+ result.append(radiusY);
result.append(')');
-
if (box.length()) {
result.append(' ');
result.append(box);
}
-
return result.toString();
}
-String CSSBasicShapePath::cssText() const
+String CSSDeprecatedBasicShapeEllipse::cssText() const
{
- String pathString;
- buildStringFromByteStream(*m_byteStream, pathString, UnalteredParsing);
-
- return buildPathString(m_windRule, pathString, m_referenceBox ? m_referenceBox->cssText() : String());
+ return buildDeprecatedEllipseString(m_centerX->cssText(), m_centerY->cssText(), m_radiusX->cssText(), m_radiusY->cssText(), m_layoutBox ? m_layoutBox->cssText() : String());
}
-bool CSSBasicShapePath::equals(const CSSBasicShape& otherShape) const
+bool CSSDeprecatedBasicShapeEllipse::equals(const CSSBasicShape& shape) const
{
- if (!is<CSSBasicShapePath>(otherShape))
+ if (shape.type() != CSSDeprecatedBasicShapeEllipseType)
return false;
- auto& otherShapePath = downcast<CSSBasicShapePath>(otherShape);
- return windRule() == otherShapePath.windRule() && pathData() == otherShapePath.pathData();
+ const CSSDeprecatedBasicShapeEllipse& other = static_cast<const CSSDeprecatedBasicShapeEllipse&>(shape);
+ return compareCSSValuePtr(m_centerX, other.m_centerX)
+ && compareCSSValuePtr(m_centerY, other.m_centerY)
+ && compareCSSValuePtr(m_radiusX, other.m_radiusX)
+ && compareCSSValuePtr(m_radiusY, other.m_radiusY)
+ && compareCSSValuePtr(m_layoutBox, other.m_layoutBox);
}
-static String buildPolygonString(const WindRule& windRule, const Vector<String>& points)
+static String buildPolygonString(const WindRule& windRule, const Vector<String>& points, const String& box)
{
ASSERT(!(points.size() % 2));
StringBuilder result;
char evenOddOpening[] = "polygon(evenodd, ";
- char nonZeroOpening[] = "polygon(";
+ char nonZeroOpening[] = "polygon(nonzero, ";
char commaSeparator[] = ", ";
- COMPILE_ASSERT(sizeof(evenOddOpening) >= sizeof(nonZeroOpening), polygon_evenodd_is_longest_string_opening);
-
+ COMPILE_ASSERT(sizeof(evenOddOpening) == sizeof(nonZeroOpening), polygon_string_openings_have_same_length);
+
// Compute the required capacity in advance to reduce allocations.
size_t length = sizeof(evenOddOpening) - 1;
for (size_t i = 0; i < points.size(); i += 2) {
@@ -261,6 +295,9 @@ static String buildPolygonString(const WindRule& windRule, const Vector<String>&
length += points[i].length() + 1 + points[i + 1].length();
}
+ if (box.length())
+ length += box.length() + 1;
+
result.reserveCapacity(length);
if (windRule == RULE_EVENODD)
@@ -278,6 +315,11 @@ static String buildPolygonString(const WindRule& windRule, const Vector<String>&
result.append(')');
+ if (box.length()) {
+ result.append(' ');
+ result.append(box);
+ }
+
return result.toString();
}
@@ -289,40 +331,82 @@ String CSSBasicShapePolygon::cssText() const
for (size_t i = 0; i < m_values.size(); ++i)
points.append(m_values.at(i)->cssText());
- return buildPolygonString(m_windRule, points);
+ return buildPolygonString(m_windRule, points, m_layoutBox ? m_layoutBox->cssText() : String());
}
bool CSSBasicShapePolygon::equals(const CSSBasicShape& shape) const
{
- if (!is<CSSBasicShapePolygon>(shape))
+ if (shape.type() != CSSBasicShapePolygonType)
return false;
- const CSSBasicShapePolygon& rhs = downcast<CSSBasicShapePolygon>(shape);
- return compareCSSValueVector<CSSPrimitiveValue>(m_values, rhs.m_values);
+ const CSSBasicShapePolygon& rhs = static_cast<const CSSBasicShapePolygon&>(shape);
+ return compareCSSValuePtr(m_layoutBox, rhs.m_layoutBox)
+ && compareCSSValueVector<CSSPrimitiveValue>(m_values, rhs.m_values);
}
-static bool buildInsetRadii(Vector<String>& radii, const String& topLeftRadius, const String& topRightRadius, const String& bottomRightRadius, const String& bottomLeftRadius)
+static String buildInsetRectangleString(const String& top, const String& right, const String& bottom, const String& left, const String& radiusX, const String& radiusY, const String& box)
{
- bool showBottomLeft = topRightRadius != bottomLeftRadius;
- bool showBottomRight = showBottomLeft || (bottomRightRadius != topLeftRadius);
- bool showTopRight = showBottomRight || (topRightRadius != topLeftRadius);
-
- radii.append(topLeftRadius);
- if (showTopRight)
- radii.append(topRightRadius);
- if (showBottomRight)
- radii.append(bottomRightRadius);
- if (showBottomLeft)
- radii.append(bottomLeftRadius);
-
- return radii.size() == 1 && radii[0] == "0px";
+ char opening[] = "inset-rectangle(";
+ char separator[] = ", ";
+ StringBuilder result;
+ // Compute the required capacity in advance to reduce allocations.
+ result.reserveCapacity((sizeof(opening) - 1) + (5 * (sizeof(separator) - 1)) + 1 + top.length() + right.length() + bottom.length() + left.length() + radiusX.length() + radiusY.length() + (box.length() ? box.length() + 1 : 0));
+ result.appendLiteral(opening);
+ result.append(top);
+ result.appendLiteral(separator);
+ result.append(right);
+ result.appendLiteral(separator);
+ result.append(bottom);
+ result.appendLiteral(separator);
+ result.append(left);
+ if (!radiusX.isNull()) {
+ result.appendLiteral(separator);
+ result.append(radiusX);
+ if (!radiusY.isNull()) {
+ result.appendLiteral(separator);
+ result.append(radiusY);
+ }
+ }
+ result.append(')');
+ if (box.length()) {
+ result.append(' ');
+ result.append(box);
+ }
+ return result.toString();
+}
+
+String CSSBasicShapeInsetRectangle::cssText() const
+{
+ return buildInsetRectangleString(m_top->cssText(),
+ m_right->cssText(),
+ m_bottom->cssText(),
+ m_left->cssText(),
+ m_radiusX.get() ? m_radiusX->cssText() : String(),
+ m_radiusY.get() ? m_radiusY->cssText() : String(),
+ m_layoutBox ? m_layoutBox->cssText() : String());
+}
+
+bool CSSBasicShapeInsetRectangle::equals(const CSSBasicShape& shape) const
+{
+ if (shape.type() != CSSBasicShapeInsetRectangleType)
+ return false;
+
+ const CSSBasicShapeInsetRectangle& other = static_cast<const CSSBasicShapeInsetRectangle&>(shape);
+ return compareCSSValuePtr(m_top, other.m_top)
+ && compareCSSValuePtr(m_right, other.m_right)
+ && compareCSSValuePtr(m_bottom, other.m_bottom)
+ && compareCSSValuePtr(m_left, other.m_left)
+ && compareCSSValuePtr(m_radiusX, other.m_radiusX)
+ && compareCSSValuePtr(m_radiusY, other.m_radiusY)
+ && compareCSSValuePtr(m_layoutBox, other.m_layoutBox);
}
static String buildInsetString(const String& top, const String& right, const String& bottom, const String& left,
const String& topLeftRadiusWidth, const String& topLeftRadiusHeight,
const String& topRightRadiusWidth, const String& topRightRadiusHeight,
const String& bottomRightRadiusWidth, const String& bottomRightRadiusHeight,
- const String& bottomLeftRadiusWidth, const String& bottomLeftRadiusHeight)
+ const String& bottomLeftRadiusWidth, const String& bottomLeftRadiusHeight,
+ const String& box)
{
char opening[] = "inset(";
char separator[] = " ";
@@ -330,81 +414,92 @@ static String buildInsetString(const String& top, const String& right, const Str
StringBuilder result;
result.appendLiteral(opening);
result.append(top);
-
- bool showLeftArg = !left.isNull() && left != right;
- bool showBottomArg = !bottom.isNull() && (bottom != top || showLeftArg);
- bool showRightArg = !right.isNull() && (right != top || showBottomArg);
- if (showRightArg) {
+ if (!right.isNull()) {
result.appendLiteral(separator);
result.append(right);
}
- if (showBottomArg) {
+ if (!bottom.isNull()) {
result.appendLiteral(separator);
result.append(bottom);
}
- if (showLeftArg) {
+ if (!left.isNull()) {
result.appendLiteral(separator);
result.append(left);
}
if (!topLeftRadiusWidth.isNull() && !topLeftRadiusHeight.isNull()) {
- Vector<String> horizontalRadii;
- bool areDefaultCornerRadii = buildInsetRadii(horizontalRadii, topLeftRadiusWidth, topRightRadiusWidth, bottomRightRadiusWidth, bottomLeftRadiusWidth);
+ result.appendLiteral(separator);
+ result.appendLiteral(cornersSeparator);
+ result.appendLiteral(separator);
- Vector<String> verticalRadii;
- areDefaultCornerRadii &= buildInsetRadii(verticalRadii, topLeftRadiusHeight, topRightRadiusHeight, bottomRightRadiusHeight, bottomLeftRadiusHeight);
+ result.append(topLeftRadiusWidth);
+ result.appendLiteral(separator);
+ result.append(topRightRadiusWidth);
+ result.appendLiteral(separator);
+ result.append(bottomRightRadiusWidth);
+ result.appendLiteral(separator);
+ result.append(bottomLeftRadiusWidth);
- if (!areDefaultCornerRadii) {
- result.appendLiteral(separator);
- result.appendLiteral(cornersSeparator);
-
- for (size_t i = 0; i < horizontalRadii.size(); ++i) {
- result.appendLiteral(separator);
- result.append(horizontalRadii[i]);
- }
-
- if (verticalRadii.size() != horizontalRadii.size()
- || !VectorComparer<false, String>::compare(verticalRadii.data(), horizontalRadii.data(), verticalRadii.size())) {
- result.appendLiteral(separator);
- result.appendLiteral("/");
-
- for (size_t i = 0; i < verticalRadii.size(); ++i) {
- result.appendLiteral(separator);
- result.append(verticalRadii[i]);
- }
- }
- }
+ result.appendLiteral(separator);
+ result.append('/');
+ result.appendLiteral(separator);
+
+ result.append(topLeftRadiusHeight);
+ result.appendLiteral(separator);
+ result.append(topRightRadiusHeight);
+ result.appendLiteral(separator);
+ result.append(bottomRightRadiusHeight);
+ result.appendLiteral(separator);
+ result.append(bottomLeftRadiusHeight);
}
result.append(')');
+ if (box.length()) {
+ result.append(' ');
+ result.append(box);
+ }
return result.toString();
}
-static inline void updateCornerRadiusWidthAndHeight(CSSPrimitiveValue* corner, String& width, String& height)
-{
- if (!corner)
- return;
-
- Pair* radius = corner->getPairValue();
- width = radius->first() ? radius->first()->cssText() : String("0");
- if (radius->second())
- height = radius->second()->cssText();
-}
-
String CSSBasicShapeInset::cssText() const
{
String topLeftRadiusWidth;
String topLeftRadiusHeight;
+ if (topLeftRadius()) {
+ Pair* topLeftRadius = m_topLeftRadius->getPairValue();
+ topLeftRadiusWidth = topLeftRadius->first() ? topLeftRadius->first()->cssText() : String("0");
+ if (topLeftRadius->second())
+ topLeftRadiusHeight = topLeftRadius->second()->cssText();
+ }
+
String topRightRadiusWidth;
String topRightRadiusHeight;
+ if (topRightRadius()) {
+ Pair* topRightRadius = m_topRightRadius->getPairValue();
+ if (topRightRadius->first())
+ topRightRadiusWidth = topRightRadius->first()->cssText();
+ if (topRightRadius->second())
+ topRightRadiusHeight = topRightRadius->second()->cssText();
+ }
+
String bottomRightRadiusWidth;
String bottomRightRadiusHeight;
+ if (bottomRightRadius()) {
+ Pair* bottomRightRadius = m_bottomRightRadius->getPairValue();
+ if (bottomRightRadius->first())
+ bottomRightRadiusWidth = bottomRightRadius->first()->cssText();
+ if (bottomRightRadius->second())
+ bottomRightRadiusHeight = bottomRightRadius->second()->cssText();
+ }
+
String bottomLeftRadiusWidth;
String bottomLeftRadiusHeight;
-
- updateCornerRadiusWidthAndHeight(topLeftRadius(), topLeftRadiusWidth, topLeftRadiusHeight);
- updateCornerRadiusWidthAndHeight(topRightRadius(), topRightRadiusWidth, topRightRadiusHeight);
- updateCornerRadiusWidthAndHeight(bottomRightRadius(), bottomRightRadiusWidth, bottomRightRadiusHeight);
- updateCornerRadiusWidthAndHeight(bottomLeftRadius(), bottomLeftRadiusWidth, bottomLeftRadiusHeight);
+ if (bottomLeftRadius()) {
+ Pair* bottomLeftRadius = m_bottomLeftRadius->getPairValue();
+ if (bottomLeftRadius->first())
+ bottomLeftRadiusWidth = bottomLeftRadius->first()->cssText();
+ if (bottomLeftRadius->second())
+ bottomLeftRadiusHeight = bottomLeftRadius->second()->cssText();
+ }
return buildInsetString(m_top ? m_top->cssText() : String(),
m_right ? m_right->cssText() : String(),
@@ -417,15 +512,16 @@ String CSSBasicShapeInset::cssText() const
bottomRightRadiusWidth,
bottomRightRadiusHeight,
bottomLeftRadiusWidth,
- bottomLeftRadiusHeight);
+ bottomLeftRadiusHeight,
+ m_layoutBox ? m_layoutBox->cssText() : String());
}
bool CSSBasicShapeInset::equals(const CSSBasicShape& shape) const
{
- if (!is<CSSBasicShapeInset>(shape))
+ if (shape.type() != CSSBasicShapeInsetType)
return false;
- const CSSBasicShapeInset& other = downcast<CSSBasicShapeInset>(shape);
+ const CSSBasicShapeInset& other = static_cast<const CSSBasicShapeInset&>(shape);
return compareCSSValuePtr(m_top, other.m_top)
&& compareCSSValuePtr(m_right, other.m_right)
&& compareCSSValuePtr(m_bottom, other.m_bottom)