Clarify the naming of the radius-related functions on BorderData
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Oct 2019 16:23:25 +0000 (16:23 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Oct 2019 16:23:25 +0000 (16:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=202888

Reviewed by Alex Christensen.

BorderData had some confusingly named data members and functions ("topLeft"'"). Renamed
to include the term "radius".

* platform/graphics/PathUtilities.cpp:
(WebCore::PathUtilities::pathWithShrinkWrappedRectsForOutline):
* rendering/style/BorderData.h:
(WebCore::BorderData::BorderData):
(WebCore::BorderData::hasBorderRadius const):
(WebCore::BorderData::operator== const):
(WebCore::BorderData::topLeftRadius const):
(WebCore::BorderData::topRightRadius const):
(WebCore::BorderData::bottomLeftRadius const):
(WebCore::BorderData::bottomRightRadius const):
(WebCore::BorderData::topLeft const): Deleted.
(WebCore::BorderData::topRight const): Deleted.
(WebCore::BorderData::bottomLeft const): Deleted.
(WebCore::BorderData::bottomRight const): Deleted.
* rendering/style/RenderStyle.cpp:
(WebCore::calcRadiiFor):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::borderTopLeftRadius const):
(WebCore::RenderStyle::borderTopRightRadius const):
(WebCore::RenderStyle::borderBottomLeftRadius const):
(WebCore::RenderStyle::borderBottomRightRadius const):
(WebCore::RenderStyle::resetBorderTopLeftRadius):
(WebCore::RenderStyle::resetBorderTopRightRadius):
(WebCore::RenderStyle::resetBorderBottomLeftRadius):
(WebCore::RenderStyle::resetBorderBottomRightRadius):
(WebCore::RenderStyle::setBorderTopLeftRadius):
(WebCore::RenderStyle::setBorderTopRightRadius):
(WebCore::RenderStyle::setBorderBottomLeftRadius):
(WebCore::RenderStyle::setBorderBottomRightRadius):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251059 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/PathUtilities.cpp
Source/WebCore/rendering/style/BorderData.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h

index 6ec6c58..c5f9251 100644 (file)
@@ -1,5 +1,45 @@
 2019-10-13  Simon Fraser  <simon.fraser@apple.com>
 
+        Clarify the naming of the radius-related functions on BorderData
+        https://bugs.webkit.org/show_bug.cgi?id=202888
+
+        Reviewed by Alex Christensen.
+
+        BorderData had some confusingly named data members and functions ("topLeft"'"). Renamed
+        to include the term "radius".
+
+        * platform/graphics/PathUtilities.cpp:
+        (WebCore::PathUtilities::pathWithShrinkWrappedRectsForOutline):
+        * rendering/style/BorderData.h:
+        (WebCore::BorderData::BorderData):
+        (WebCore::BorderData::hasBorderRadius const):
+        (WebCore::BorderData::operator== const):
+        (WebCore::BorderData::topLeftRadius const):
+        (WebCore::BorderData::topRightRadius const):
+        (WebCore::BorderData::bottomLeftRadius const):
+        (WebCore::BorderData::bottomRightRadius const):
+        (WebCore::BorderData::topLeft const): Deleted.
+        (WebCore::BorderData::topRight const): Deleted.
+        (WebCore::BorderData::bottomLeft const): Deleted.
+        (WebCore::BorderData::bottomRight const): Deleted.
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::calcRadiiFor):
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::borderTopLeftRadius const):
+        (WebCore::RenderStyle::borderTopRightRadius const):
+        (WebCore::RenderStyle::borderBottomLeftRadius const):
+        (WebCore::RenderStyle::borderBottomRightRadius const):
+        (WebCore::RenderStyle::resetBorderTopLeftRadius):
+        (WebCore::RenderStyle::resetBorderTopRightRadius):
+        (WebCore::RenderStyle::resetBorderBottomLeftRadius):
+        (WebCore::RenderStyle::resetBorderBottomRightRadius):
+        (WebCore::RenderStyle::setBorderTopLeftRadius):
+        (WebCore::RenderStyle::setBorderTopRightRadius):
+        (WebCore::RenderStyle::setBorderBottomLeftRadius):
+        (WebCore::RenderStyle::setBorderBottomRightRadius):
+
+2019-10-13  Simon Fraser  <simon.fraser@apple.com>
+
         Convert LineBoxContain to use an OptionSet<>
         https://bugs.webkit.org/show_bug.cgi?id=202890
 
index 5ad9334..e4a3b13 100644 (file)
@@ -493,10 +493,10 @@ Path PathUtilities::pathWithShrinkWrappedRectsForOutline(const Vector<FloatRect>
 {
     ASSERT(borderData.hasBorderRadius());
 
-    FloatSize topLeftRadius { borderData.topLeft().width.value(), borderData.topLeft().height.value() };
-    FloatSize topRightRadius { borderData.topRight().width.value(), borderData.topRight().height.value() };
-    FloatSize bottomRightRadius { borderData.bottomRight().width.value(), borderData.bottomRight().height.value() };
-    FloatSize bottomLeftRadius { borderData.bottomLeft().width.value(), borderData.bottomLeft().height.value() };
+    FloatSize topLeftRadius { borderData.topLeftRadius().width.value(), borderData.topLeftRadius().height.value() };
+    FloatSize topRightRadius { borderData.topRightRadius().width.value(), borderData.topRightRadius().height.value() };
+    FloatSize bottomRightRadius { borderData.bottomRightRadius().width.value(), borderData.bottomRightRadius().height.value() };
+    FloatSize bottomLeftRadius { borderData.bottomLeftRadius().width.value(), borderData.bottomLeftRadius().height.value() };
 
     auto roundedRect = [topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius, outlineOffset, deviceScaleFactor] (const FloatRect& rect)
     {
index 393e489..5ccc1c4 100644 (file)
@@ -34,12 +34,13 @@ class BorderData {
 friend class RenderStyle;
 public:
     BorderData()
-        : m_topLeft { { 0, Fixed }, { 0, Fixed } }
-        , m_topRight { { 0, Fixed }, { 0, Fixed } }
-        , m_bottomLeft { { 0, Fixed }, { 0, Fixed } }
-        , m_bottomRight { { 0, Fixed }, { 0, Fixed } }
+        : m_topLeftRadius { { 0, Fixed }, { 0, Fixed } }
+        , m_topRightRadius { { 0, Fixed }, { 0, Fixed } }
+        , m_bottomLeftRadius { { 0, Fixed }, { 0, Fixed } }
+        , m_bottomRightRadius { { 0, Fixed }, { 0, Fixed } }
     {
     }
+
     bool hasBorder() const
     {
         bool haveImage = m_image.hasImage();
@@ -59,10 +60,10 @@ public:
     
     bool hasBorderRadius() const
     {
-        return !m_topLeft.width.isZero()
-            || !m_topRight.width.isZero()
-            || !m_bottomLeft.width.isZero()
-            || !m_bottomRight.width.isZero();
+        return !m_topLeftRadius.width.isZero()
+            || !m_topRightRadius.width.isZero()
+            || !m_bottomLeftRadius.width.isZero()
+            || !m_bottomRightRadius.width.isZero();
     }
     
     float borderLeftWidth() const
@@ -101,7 +102,7 @@ public:
     bool operator==(const BorderData& o) const
     {
         return m_left == o.m_left && m_right == o.m_right && m_top == o.m_top && m_bottom == o.m_bottom && m_image == o.m_image
-               && m_topLeft == o.m_topLeft && m_topRight == o.m_topRight && m_bottomLeft == o.m_bottomLeft && m_bottomRight == o.m_bottomRight;
+            && m_topLeftRadius == o.m_topLeftRadius && m_topRightRadius == o.m_topRightRadius && m_bottomLeftRadius == o.m_bottomLeftRadius && m_bottomRightRadius == o.m_bottomRightRadius;
     }
     
     bool operator!=(const BorderData& o) const
@@ -116,10 +117,10 @@ public:
     
     const NinePieceImage& image() const { return m_image; }
     
-    const LengthSize& topLeft() const { return m_topLeft; }
-    const LengthSize& topRight() const { return m_topRight; }
-    const LengthSize& bottomLeft() const { return m_bottomLeft; }
-    const LengthSize& bottomRight() const { return m_bottomRight; }
+    const LengthSize& topLeftRadius() const { return m_topLeftRadius; }
+    const LengthSize& topRightRadius() const { return m_topRightRadius; }
+    const LengthSize& bottomLeftRadius() const { return m_bottomLeftRadius; }
+    const LengthSize& bottomRightRadius() const { return m_bottomRightRadius; }
 
 private:
     BorderValue m_left;
@@ -129,10 +130,10 @@ private:
 
     NinePieceImage m_image;
 
-    LengthSize m_topLeft;
-    LengthSize m_topRight;
-    LengthSize m_bottomLeft;
-    LengthSize m_bottomRight;
+    LengthSize m_topLeftRadius;
+    LengthSize m_topRightRadius;
+    LengthSize m_bottomLeftRadius;
+    LengthSize m_bottomRightRadius;
 };
 
 } // namespace WebCore
index ccef75a..eeebb58 100644 (file)
@@ -1435,10 +1435,10 @@ void RenderStyle::setBoxShadow(std::unique_ptr<ShadowData> shadowData, bool add)
 static RoundedRect::Radii calcRadiiFor(const BorderData& border, const LayoutSize& size)
 {
     return {
-        sizeForLengthSize(border.topLeft(), size),
-        sizeForLengthSize(border.topRight(), size),
-        sizeForLengthSize(border.bottomLeft(), size),
-        sizeForLengthSize(border.bottomRight(), size)
+        sizeForLengthSize(border.topLeftRadius(), size),
+        sizeForLengthSize(border.topRightRadius(), size),
+        sizeForLengthSize(border.bottomLeftRadius(), size),
+        sizeForLengthSize(border.bottomRightRadius(), size)
     };
 }
 
index c915fdb..45c832b 100644 (file)
@@ -299,10 +299,10 @@ public:
     const LengthBox& borderImageWidth() const { return m_surroundData->border.image().borderSlices(); }
     const LengthBox& borderImageOutset() const { return m_surroundData->border.image().outset(); }
 
-    const LengthSize& borderTopLeftRadius() const { return m_surroundData->border.topLeft(); }
-    const LengthSize& borderTopRightRadius() const { return m_surroundData->border.topRight(); }
-    const LengthSize& borderBottomLeftRadius() const { return m_surroundData->border.bottomLeft(); }
-    const LengthSize& borderBottomRightRadius() const { return m_surroundData->border.bottomRight(); }
+    const LengthSize& borderTopLeftRadius() const { return m_surroundData->border.topLeftRadius(); }
+    const LengthSize& borderTopRightRadius() const { return m_surroundData->border.topRightRadius(); }
+    const LengthSize& borderBottomLeftRadius() const { return m_surroundData->border.bottomLeftRadius(); }
+    const LengthSize& borderBottomRightRadius() const { return m_surroundData->border.bottomRightRadius(); }
     bool hasBorderRadius() const { return m_surroundData->border.hasBorderRadius(); }
 
     float borderLeftWidth() const { return m_surroundData->border.borderLeftWidth(); }
@@ -838,10 +838,10 @@ public:
     void resetBorderLeft() { SET_VAR(m_surroundData, border.m_left, BorderValue()); }
     void resetBorderImage() { SET_VAR(m_surroundData, border.m_image, NinePieceImage()); }
     void resetBorderRadius() { resetBorderTopLeftRadius(); resetBorderTopRightRadius(); resetBorderBottomLeftRadius(); resetBorderBottomRightRadius(); }
-    void resetBorderTopLeftRadius() { SET_VAR(m_surroundData, border.m_topLeft, initialBorderRadius()); }
-    void resetBorderTopRightRadius() { SET_VAR(m_surroundData, border.m_topRight, initialBorderRadius()); }
-    void resetBorderBottomLeftRadius() { SET_VAR(m_surroundData, border.m_bottomLeft, initialBorderRadius()); }
-    void resetBorderBottomRightRadius() { SET_VAR(m_surroundData, border.m_bottomRight, initialBorderRadius()); }
+    void resetBorderTopLeftRadius() { SET_VAR(m_surroundData, border.m_topLeftRadius, initialBorderRadius()); }
+    void resetBorderTopRightRadius() { SET_VAR(m_surroundData, border.m_topRightRadius, initialBorderRadius()); }
+    void resetBorderBottomLeftRadius() { SET_VAR(m_surroundData, border.m_bottomLeftRadius, initialBorderRadius()); }
+    void resetBorderBottomRightRadius() { SET_VAR(m_surroundData, border.m_bottomRightRadius, initialBorderRadius()); }
 
     void setBackgroundColor(const Color& v) { SET_VAR(m_backgroundData, color, v); }
 
@@ -856,10 +856,10 @@ public:
     void setBorderImageWidth(LengthBox&&);
     void setBorderImageOutset(LengthBox&&);
 
-    void setBorderTopLeftRadius(LengthSize&& size) { SET_VAR(m_surroundData, border.m_topLeft, WTFMove(size)); }
-    void setBorderTopRightRadius(LengthSize&& size) { SET_VAR(m_surroundData, border.m_topRight, WTFMove(size)); }
-    void setBorderBottomLeftRadius(LengthSize&& size) { SET_VAR(m_surroundData, border.m_bottomLeft, WTFMove(size)); }
-    void setBorderBottomRightRadius(LengthSize&& size) { SET_VAR(m_surroundData, border.m_bottomRight, WTFMove(size)); }
+    void setBorderTopLeftRadius(LengthSize&& size) { SET_VAR(m_surroundData, border.m_topLeftRadius, WTFMove(size)); }
+    void setBorderTopRightRadius(LengthSize&& size) { SET_VAR(m_surroundData, border.m_topRightRadius, WTFMove(size)); }
+    void setBorderBottomLeftRadius(LengthSize&& size) { SET_VAR(m_surroundData, border.m_bottomLeftRadius, WTFMove(size)); }
+    void setBorderBottomRightRadius(LengthSize&& size) { SET_VAR(m_surroundData, border.m_bottomRightRadius, WTFMove(size)); }
 
     void setBorderRadius(LengthSize&&);
     void setBorderRadius(const IntSize&);