[webkit-dev] Int/FloatPoint and Int/FloatSize

Steve Block steveblock at chromium.org
Wed Jan 2 23:21:40 PST 2013


Hi webkit,

I was hoping that somebody could clarify the policy regarding the
correct use of Int/FloatPoint vs Int/FloatSize.

It seems that xxxPoint is consistently used to represent a position,
which makes sense. However, when representing the position of one
point relative to another, both xxxPoint and xxxSize are used, which
seems inconsistent. I'd expect that xxxPoint should be used for this
case of a relative position, since its x(), y() and length() methods
make more sense than the width() and height() methods of xxxSize.
However, the operators [1] for subtracting one xxxPoint from another
encourage the use of xxxSize. I recognize that in some situations, you
need really do want to represent the difference between two points as
an area or size, but this seems the less common case, and it might be
better to make it more explicit [2].

My questions are ...
- What (if any) is the correct policy?
- Would people welcome changes to encourage that policy?

Thanks,
Steve

[1] eg 'inline FloatSize operator-(const FloatPoint&, const FloatPoint&)'
[2] Perhaps something like 'static FloatSize
FloatSize::fromCornerPoints(const FloatPoint&, const FloatPoint&)'.


More information about the webkit-dev mailing list