Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Unified Diff: Source/core/css/CSSBasicShapes.cpp

Issue 300843011: [CSS Shapes] serialization of the computed value should omit the default radii (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/shapes/parsing/parsing-test-utils.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSBasicShapes.cpp
diff --git a/Source/core/css/CSSBasicShapes.cpp b/Source/core/css/CSSBasicShapes.cpp
index e0c9340215be90f7b8f10cb263f58a8f10c4f1c3..2f326c9e0f24e0be482e6b4af9a226bd6937c8bc 100644
--- a/Source/core/css/CSSBasicShapes.cpp
+++ b/Source/core/css/CSSBasicShapes.cpp
@@ -114,7 +114,11 @@ String CSSBasicShapeCircle::cssText() const
RefPtrWillBeRawPtr<CSSPrimitiveValue> normalizedCX = buildSerializablePositionOffset(m_centerX, CSSValueLeft);
RefPtrWillBeRawPtr<CSSPrimitiveValue> normalizedCY = buildSerializablePositionOffset(m_centerY, CSSValueTop);
- return buildCircleString(m_radius ? m_radius->cssText() : String(),
+ String radius;
+ if (m_radius && m_radius->getValueID() != CSSValueClosestSide)
eseidel 2014/05/28 22:08:10 This smells odd. Why is CSSValueClosestSide speci
+ radius = m_radius->cssText();
+
+ return buildCircleString(radius,
serializePositionOffset(*normalizedCX->getPairValue(), *normalizedCY->getPairValue()),
serializePositionOffset(*normalizedCY->getPairValue(), *normalizedCX->getPairValue()),
m_referenceBox ? m_referenceBox->cssText() : String());
@@ -180,8 +184,22 @@ String CSSBasicShapeEllipse::cssText() const
RefPtrWillBeRawPtr<CSSPrimitiveValue> normalizedCX = buildSerializablePositionOffset(m_centerX, CSSValueLeft);
RefPtrWillBeRawPtr<CSSPrimitiveValue> normalizedCY = buildSerializablePositionOffset(m_centerY, CSSValueTop);
- return buildEllipseString(m_radiusX ? m_radiusX->cssText() : String(),
- m_radiusY ? m_radiusY->cssText() : String(),
+ String radiusX;
+ String radiusY;
+ if (m_radiusX) {
+ bool shouldSerializeRadiusXValue = m_radiusX->getValueID() != CSSValueClosestSide;
eseidel 2014/05/28 22:08:10 Here again. Magic constants = confused reader.
+ 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()),
m_referenceBox ? m_referenceBox->cssText() : String());
« no previous file with comments | « LayoutTests/fast/shapes/parsing/parsing-test-utils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698