Bug 1295662 - Document layout of nsStyleCorners and inset StyleBasicShape; r?heycam
MozReview-Commit-ID: DYwaSnLvWJK
--- a/layout/style/nsStyleCoord.h
+++ b/layout/style/nsStyleCoord.h
@@ -333,17 +333,17 @@ public:
}
protected:
nsStyleUnit mUnits[4];
nsStyleUnion mValues[4];
};
/**
- * Class that represents a set of top-left/top-right/bottom-left/bottom-right
+ * Class that represents a set of top-left/top-right/bottom-right/bottom-left
* nsStyleCoord pairs. This is used to hold the dimensions of the
* corners of a box (for, e.g., border-radius and outline-radius).
*/
/** <div rustbindgen private accessor="unsafe"></div> */
class nsStyleCorners {
public:
nsStyleCorners();
nsStyleCorners(const nsStyleCorners&);
@@ -362,16 +362,21 @@ public:
// Sets each corner to null and releases any refcounted objects. Only use
// this if the object is initialized (i.e. don't use it in nsStyleCorners
// constructors).
void Reset();
inline void Set(uint8_t aHalfCorner, const nsStyleCoord& aCoord);
protected:
+ // Stored as:
+ // top-left.x, top-left.y,
+ // top-right.x, top-right.y,
+ // bottom-right.x, bottom-right.y,
+ // bottom-left.x, bottom-left.y
nsStyleUnit mUnits[8];
nsStyleUnion mValues[8];
};
// -------------------------
// nsStyleCoord inlines
//
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -2606,18 +2606,21 @@ public:
private:
~StyleBasicShape() {}
StyleBasicShapeType mType;
int32_t mFillRule;
// mCoordinates has coordinates for polygon or radii for
// ellipse and circle.
+ // (top, right, bottom, left) for inset
nsTArray<nsStyleCoord> mCoordinates;
+ // position of center for ellipse or circle
Position mPosition;
+ // corner radii for inset (0 if not set)
nsStyleCorners mRadius;
};
template<typename ReferenceBox>
struct StyleShapeSource
{
StyleShapeSource()
: mURL(nullptr)