>> - Replace direct accesses to the 'width' and 'height' fields >> throughout the codebase with calls to getter and setter methods. (There >> aren't that many - on the order of a few dozen, last I checked.) > > I think you must have made a mistake, width/height and *Size things > are used in a gazillion places in layout code.
Hmm, you're right. Not sure why I remember there being a few dozen, a search on DXR now reveals over a thousand. So it would have to be a longer transition process, probably with one directory converted at a time. Note that only *direct* accesses to width and height need to be changed - accesses to methods like Width() or Size() can remain as they are, since those can be computed based on the new representation. > Most of those are > probably accessing the logical versions though (ISize/BSize) so that > might explain why it doesn't look like it's used much. I suspect that > this usage is much more common than the operations you mentioned. As far as I can tell, ISize and BSize are methods on mozilla::LogicalRect, which does not derive from BaseRect, and as such would not be affected. > Is your proposal that all access to width/height/isize/bsize now becomes > something like "std:max(0, x2 - x1)" ? There would be accessors Width() and Height() (in fact, they already exist). I was imagining their implementation would simply be e.g. "x2 - x1", because we'll disallow x2 < x1 to begin with. I'm not sure yet where we would enforce x2 >= x1. If there's reason to allow x2 < x1, then taking the max() in Width() would be reasonable. >> The Graphics team, which owns this code > > Sounds odd to me. This code was written by and is mostly maintained by > the Layout team and is used mostly in Layout code. The only reason > it's in gfx/ is so that it may be used also in Graphics code. My bad, I was basing this on the fact that the BaseRect class is defined in gfx/2d. Consider this an official request for comment from Layout peers (and anyone else who may be interested) :) Cheers, Botond _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform