Title: [163452] trunk/Source/WebCore
- Revision
- 163452
- Author
- zol...@webkit.org
- Date
- 2014-02-05 09:36:03 -0800 (Wed, 05 Feb 2014)
Log Message
[CSS Shapes] Simplify CSSBasicShapeInset::cssText
https://bugs.webkit.org/show_bug.cgi?id=127841
Reviewed by David Hyatt.
I introduced the updateCornerRadiusWidthAndHeight helper function, which makes the code of cssText method clearer.
No new tests, no behavior change.
* css/CSSBasicShapes.cpp:
(WebCore::updateCornerRadiusWidthAndHeight): Add helper function.
(WebCore::CSSBasicShapeInset::cssText):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (163451 => 163452)
--- trunk/Source/WebCore/ChangeLog 2014-02-05 17:34:59 UTC (rev 163451)
+++ trunk/Source/WebCore/ChangeLog 2014-02-05 17:36:03 UTC (rev 163452)
@@ -1,5 +1,20 @@
2014-02-05 Zoltan Horvath <zol...@webkit.org>
+ [CSS Shapes] Simplify CSSBasicShapeInset::cssText
+ https://bugs.webkit.org/show_bug.cgi?id=127841
+
+ Reviewed by David Hyatt.
+
+ I introduced the updateCornerRadiusWidthAndHeight helper function, which makes the code of cssText method clearer.
+
+ No new tests, no behavior change.
+
+ * css/CSSBasicShapes.cpp:
+ (WebCore::updateCornerRadiusWidthAndHeight): Add helper function.
+ (WebCore::CSSBasicShapeInset::cssText):
+
+2014-02-05 Zoltan Horvath <zol...@webkit.org>
+
[CSS Shapes] Simplify BasicShapeInset::path
https://bugs.webkit.org/show_bug.cgi?id=127920
Modified: trunk/Source/WebCore/css/CSSBasicShapes.cpp (163451 => 163452)
--- trunk/Source/WebCore/css/CSSBasicShapes.cpp 2014-02-05 17:34:59 UTC (rev 163451)
+++ trunk/Source/WebCore/css/CSSBasicShapes.cpp 2014-02-05 17:36:03 UTC (rev 163452)
@@ -460,47 +460,33 @@
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;
- if (bottomLeftRadius()) {
- Pair* bottomLeftRadius = m_bottomLeftRadius->getPairValue();
- if (bottomLeftRadius->first())
- bottomLeftRadiusWidth = bottomLeftRadius->first()->cssText();
- if (bottomLeftRadius->second())
- bottomLeftRadiusHeight = bottomLeftRadius->second()->cssText();
- }
+ updateCornerRadiusWidthAndHeight(topLeftRadius(), topLeftRadiusWidth, topLeftRadiusHeight);
+ updateCornerRadiusWidthAndHeight(topRightRadius(), topRightRadiusWidth, topRightRadiusHeight);
+ updateCornerRadiusWidthAndHeight(bottomRightRadius(), bottomRightRadiusWidth, bottomRightRadiusHeight);
+ updateCornerRadiusWidthAndHeight(bottomLeftRadius(), bottomLeftRadiusWidth, bottomLeftRadiusHeight);
+
return buildInsetString(m_top ? m_top->cssText() : String(),
m_right ? m_right->cssText() : String(),
m_bottom ? m_bottom->cssText() : String(),
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes