| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
| 9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
| 10 * disclaimer. | 10 * disclaimer. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 { | 108 { |
| 109 return m_x->hasVariableReference() | 109 return m_x->hasVariableReference() |
| 110 || m_y->hasVariableReference() | 110 || m_y->hasVariableReference() |
| 111 || m_width->hasVariableReference() | 111 || m_width->hasVariableReference() |
| 112 || m_height->hasVariableReference() | 112 || m_height->hasVariableReference() |
| 113 || (m_radiusX.get() && m_radiusX->hasVariableReference()) | 113 || (m_radiusX.get() && m_radiusX->hasVariableReference()) |
| 114 || (m_radiusY.get() && m_radiusY->hasVariableReference()) | 114 || (m_radiusY.get() && m_radiusY->hasVariableReference()) |
| 115 || (m_layoutBox && m_layoutBox->hasVariableReference()); | 115 || (m_layoutBox && m_layoutBox->hasVariableReference()); |
| 116 } | 116 } |
| 117 | 117 |
| 118 static String buildCircleString(const String& x, const String& y, const String&
radius, const String& layoutBox) | 118 static String buildCircleString(const String& radius, const String& centerX, con
st String& centerY, const String& layoutBox) |
| 119 { | 119 { |
| 120 char at[] = "at"; |
| 121 char separator[] = " "; |
| 120 StringBuilder result; | 122 StringBuilder result; |
| 121 const char separator[] = ", "; | |
| 122 result.appendLiteral("circle("); | 123 result.appendLiteral("circle("); |
| 123 result.append(x); | 124 if (!radius.isNull()) |
| 124 result.appendLiteral(separator); | 125 result.append(radius); |
| 125 result.append(y); | 126 |
| 126 result.appendLiteral(separator); | 127 if (!centerX.isNull() || !centerY.isNull()) { |
| 127 result.append(radius); | 128 if (!radius.isNull()) |
| 128 result.append(')'); | 129 result.appendLiteral(separator); |
| 129 if (!layoutBox.isEmpty()) { | 130 result.append(at); |
| 130 result.append(' '); | 131 result.appendLiteral(separator); |
| 132 result.append(centerX); |
| 133 result.appendLiteral(separator); |
| 134 result.append(centerY); |
| 135 } |
| 136 result.append(")"); |
| 137 if (layoutBox.length()) { |
| 138 result.appendLiteral(separator); |
| 131 result.append(layoutBox); | 139 result.append(layoutBox); |
| 132 } | 140 } |
| 133 return result.toString(); | 141 return result.toString(); |
| 134 } | 142 } |
| 135 | 143 |
| 136 String CSSBasicShapeCircle::cssText() const | 144 String CSSBasicShapeCircle::cssText() const |
| 137 { | 145 { |
| 138 return buildCircleString(m_centerX->cssText(), | 146 return buildCircleString(m_radius ? m_radius->cssText() : String(), |
| 139 m_centerY->cssText(), m_radius->cssText(), | 147 m_centerX ? m_centerX->cssText() : String(), |
| 148 m_centerY ? m_centerY->cssText() : String(), |
| 140 m_layoutBox ? m_layoutBox->cssText() : String()); | 149 m_layoutBox ? m_layoutBox->cssText() : String()); |
| 141 } | 150 } |
| 142 | 151 |
| 143 bool CSSBasicShapeCircle::equals(const CSSBasicShape& shape) const | 152 bool CSSBasicShapeCircle::equals(const CSSBasicShape& shape) const |
| 144 { | 153 { |
| 145 if (shape.type() != CSSBasicShapeCircleType) | 154 if (shape.type() != CSSBasicShapeCircleType) |
| 146 return false; | 155 return false; |
| 147 | 156 |
| 148 const CSSBasicShapeCircle& other = static_cast<const CSSBasicShapeCircle&>(s
hape); | 157 const CSSBasicShapeCircle& other = static_cast<const CSSBasicShapeCircle&>(s
hape); |
| 149 return compareCSSValuePtr(m_centerX, other.m_centerX) | 158 return compareCSSValuePtr(m_centerX, other.m_centerX) |
| 150 && compareCSSValuePtr(m_centerY, other.m_centerY) | 159 && compareCSSValuePtr(m_centerY, other.m_centerY) |
| 151 && compareCSSValuePtr(m_radius, other.m_radius) | 160 && compareCSSValuePtr(m_radius, other.m_radius) |
| 152 && compareCSSValuePtr(m_layoutBox, other.m_layoutBox); | 161 && compareCSSValuePtr(m_layoutBox, other.m_layoutBox); |
| 153 } | 162 } |
| 154 | 163 |
| 155 String CSSBasicShapeCircle::serializeResolvingVariables(const HashMap<AtomicStri
ng, String>& variables) const | 164 String CSSBasicShapeCircle::serializeResolvingVariables(const HashMap<AtomicStri
ng, String>& variables) const |
| 156 { | 165 { |
| 157 return buildCircleString(m_centerX->serializeResolvingVariables(variables), | 166 return buildCircleString(m_radius.get() ? m_radius->serializeResolvingVariab
les(variables) : String(), |
| 158 m_centerY->serializeResolvingVariables(variables), | 167 m_centerX.get() ? m_centerX->serializeResolvingVariables(variables) : St
ring(), |
| 159 m_radius->serializeResolvingVariables(variables), | 168 m_centerY.get() ? m_centerY->serializeResolvingVariables(variables) : St
ring(), |
| 160 m_layoutBox ? m_layoutBox->serializeResolvingVariables(variables) : Stri
ng()); | 169 m_layoutBox.get() ? m_layoutBox->serializeResolvingVariables(variables)
: String()); |
| 161 } | 170 } |
| 162 | 171 |
| 163 bool CSSBasicShapeCircle::hasVariableReference() const | 172 bool CSSBasicShapeCircle::hasVariableReference() const |
| 164 { | 173 { |
| 174 return (m_centerX && m_centerX->hasVariableReference()) |
| 175 || (m_centerY && m_centerY->hasVariableReference()) |
| 176 || (m_radius && m_radius->hasVariableReference()); |
| 177 } |
| 178 |
| 179 static String buildDeprecatedCircleString(const String& x, const String& y, cons
t String& radius) |
| 180 { |
| 181 return "circle(" + x + ", " + y + ", " + radius + ')'; |
| 182 } |
| 183 |
| 184 String CSSDeprecatedBasicShapeCircle::cssText() const |
| 185 { |
| 186 return buildDeprecatedCircleString(m_centerX->cssText(), m_centerY->cssText(
), m_radius->cssText()); |
| 187 } |
| 188 |
| 189 bool CSSDeprecatedBasicShapeCircle::equals(const CSSBasicShape& shape) const |
| 190 { |
| 191 if (shape.type() != CSSDeprecatedBasicShapeCircleType) |
| 192 return false; |
| 193 |
| 194 const CSSDeprecatedBasicShapeCircle& other = static_cast<const CSSDeprecated
BasicShapeCircle&>(shape); |
| 195 return compareCSSValuePtr(m_centerX, other.m_centerX) |
| 196 && compareCSSValuePtr(m_centerY, other.m_centerY) |
| 197 && compareCSSValuePtr(m_radius, other.m_radius); |
| 198 } |
| 199 |
| 200 String CSSDeprecatedBasicShapeCircle::serializeResolvingVariables(const HashMap<
AtomicString, String>& variables) const |
| 201 { |
| 202 return buildDeprecatedCircleString(m_centerX->serializeResolvingVariables(va
riables), |
| 203 m_centerY->serializeResolvingVariables(variables), |
| 204 m_radius->serializeResolvingVariables(variables)); |
| 205 } |
| 206 |
| 207 bool CSSDeprecatedBasicShapeCircle::hasVariableReference() const |
| 208 { |
| 165 return m_centerX->hasVariableReference() | 209 return m_centerX->hasVariableReference() |
| 166 || m_centerY->hasVariableReference() | 210 || m_centerY->hasVariableReference() |
| 167 || m_radius->hasVariableReference() | 211 || m_radius->hasVariableReference() |
| 168 || (m_layoutBox && m_layoutBox->hasVariableReference()); | 212 || (m_layoutBox && m_layoutBox->hasVariableReference()); |
| 169 } | 213 } |
| 170 | 214 |
| 171 static String buildEllipseString(const String& x, const String& y, const String&
radiusX, const String& radiusY, const String& layoutBox) | 215 static String buildEllipseString(const String& x, const String& y, const String&
radiusX, const String& radiusY, const String& layoutBox) |
| 172 { | 216 { |
| 173 StringBuilder result; | 217 StringBuilder result; |
| 174 const char separator[] = ", "; | 218 const char separator[] = ", "; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 || m_right->hasVariableReference() | 439 || m_right->hasVariableReference() |
| 396 || m_bottom->hasVariableReference() | 440 || m_bottom->hasVariableReference() |
| 397 || m_left->hasVariableReference() | 441 || m_left->hasVariableReference() |
| 398 || (m_radiusX.get() && m_radiusX->hasVariableReference()) | 442 || (m_radiusX.get() && m_radiusX->hasVariableReference()) |
| 399 || (m_radiusY.get() && m_radiusY->hasVariableReference()) | 443 || (m_radiusY.get() && m_radiusY->hasVariableReference()) |
| 400 || (m_layoutBox && m_layoutBox->hasVariableReference()); | 444 || (m_layoutBox && m_layoutBox->hasVariableReference()); |
| 401 } | 445 } |
| 402 | 446 |
| 403 } // namespace WebCore | 447 } // namespace WebCore |
| 404 | 448 |
| OLD | NEW |