RESOLVED FIXED Bug 60783
Switch addFocusRingRects to use IntPoint
https://bugs.webkit.org/show_bug.cgi?id=60783
Summary Switch addFocusRingRects to use IntPoint
Levi Weintraub
Reported 2011-05-13 11:52:05 PDT
This is a low-level function taking tx/ty offsets that can be switched to IntPoint without forcing too many other areas to follow suit.
Attachments
Patch (21.20 KB, patch)
2011-05-13 14:32 PDT, Levi Weintraub
no flags
Patch (22.22 KB, patch)
2011-05-23 20:53 PDT, Levi Weintraub
no flags
Patch (22.09 KB, patch)
2011-05-24 10:08 PDT, Levi Weintraub
no flags
Patch (34.98 KB, patch)
2011-05-24 12:27 PDT, Levi Weintraub
no flags
Patch (22.34 KB, patch)
2011-05-24 17:12 PDT, Levi Weintraub
no flags
Levi Weintraub
Comment 1 2011-05-13 11:54:32 PDT
Erm, I mean IntSize!
Levi Weintraub
Comment 2 2011-05-13 12:29:14 PDT
This isn't explicitly a paint call, though it's called from paint functions and ultimately results in coordinates for the paint system, so I'm not sure paintOffset is quite right here. Perhaps offsetForPainting?
Levi Weintraub
Comment 3 2011-05-13 14:32:53 PDT
Eric Seidel (no email)
Comment 4 2011-05-13 14:42:55 PDT
Comment on attachment 93511 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=93511&action=review > Source/WebCore/rendering/RenderBlock.cpp:5852 > +void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, const IntSize& offset) Seems like this is an IntPoint? originInParent? Or maybe we should compute originInParent from offset? In any case, "offset" needs a better name. offset to what? offset in what? what is "offset"?
Levi Weintraub
Comment 5 2011-05-13 14:45:58 PDT
I brought this up in IRC too and got nowhere. There will be a similar issue with hit testing. Perhaps this is where we typedef something like RootOffset to IntSize and include a comment about what it is and how it's used? Otherwise naming this is thoroughly non-trivial :-/
Darin Adler
Comment 6 2011-05-13 17:18:22 PDT
Certainly if tx,ty,width,height is an IntRect, we want tx,ty to be an IntPoint, not an IntSize.
Levi Weintraub
Comment 7 2011-05-23 20:53:28 PDT
Eric Seidel (no email)
Comment 8 2011-05-23 21:11:14 PDT
Comment on attachment 94554 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=94554&action=review > Source/WebCore/rendering/RenderBlock.h:332 > + virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&); I think the IntPoint may need a name here. I'm not sure "paintOffset" is descriptive enough though. originInContainer? > Source/WebCore/rendering/RenderInline.cpp:1351 > + FloatPoint pos(paintOffset); Why do we use a FloatPoint here if we just floor it later?
Levi Weintraub
Comment 9 2011-05-23 21:49:22 PDT
(In reply to comment #8) > (From update of attachment 94554 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=94554&action=review > > > Source/WebCore/rendering/RenderBlock.h:332 > > + virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&); > > I think the IntPoint may need a name here. I'm not sure "paintOffset" is descriptive enough though. originInContainer? > Again, this is the real rub... I'm happy to call it that if we're convinced that isn't misleading in some cases. Container is kind of an overloaded term. Simon's kind of my go-to guy for naming this, but last run through in IRC only yielded "offset." > > Source/WebCore/rendering/RenderInline.cpp:1351 > > + FloatPoint pos(paintOffset); > > Why do we use a FloatPoint here if we just floor it later? Sheesh, good question. Sorry I missed that!
Eric Seidel (no email)
Comment 10 2011-05-23 21:52:54 PDT
Comment on attachment 94554 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=94554&action=review >>> Source/WebCore/rendering/RenderBlock.h:332 >>> + virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&); >> >> I think the IntPoint may need a name here. I'm not sure "paintOffset" is descriptive enough though. originInContainer? > > Again, this is the real rub... I'm happy to call it that if we're convinced that isn't misleading in some cases. Container is kind of an overloaded term. Simon's kind of my go-to guy for naming this, but last run through in IRC only yielded "offset." My understanding is that tx,ty mean differnet things in differnet plaes. We need to enumerate those places and come up with consistent naming for each. It seems here it's used as the origin of the RenderObject for which focus rings are being painted? I assume that a normal focus ring is something like -5, -5, width + 10, height + 10? and tx, ty are then the x, y (in the containing block?) of the render object? >>> Source/WebCore/rendering/RenderInline.cpp:1351 >>> + FloatPoint pos(paintOffset); >> >> Why do we use a FloatPoint here if we just floor it later? > > Sheesh, good question. Sorry I missed that! I mean, it's possible we're using intermediate float values (adding floats, etc), I didn't look at the code closely enough.
Simon Fraser (smfr)
Comment 11 2011-05-24 08:29:09 PDT
Comment on attachment 94554 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=94554&action=review >>>> Source/WebCore/rendering/RenderBlock.h:332 >>>> + virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&); >>> >>> I think the IntPoint may need a name here. I'm not sure "paintOffset" is descriptive enough though. originInContainer? >> >> Again, this is the real rub... I'm happy to call it that if we're convinced that isn't misleading in some cases. Container is kind of an overloaded term. Simon's kind of my go-to guy for naming this, but last run through in IRC only yielded "offset." > > My understanding is that tx,ty mean differnet things in differnet plaes. We need to enumerate those places and come up with consistent naming for each. It seems here it's used as the origin of the RenderObject for which focus rings are being painted? I assume that a normal focus ring is something like -5, -5, width + 10, height + 10? and tx, ty are then the x, y (in the containing block?) of the render object? IIRC addFocusRingRects() is called at times other than painting (you can ask for a renderer's focus ring rects at any time), so paintOffset doesn't work so well. I'm OK with 'offset', since we still don't have a good term for all the things that tx,ty can mean.
Eric Seidel (no email)
Comment 12 2011-05-24 08:37:26 PDT
I feel like "offset" is as meaningless as "size" or "o" would be. What's it an offset from?
Darin Adler
Comment 13 2011-05-24 09:15:04 PDT
(In reply to comment #12) > I feel like "offset" is as meaningless as "size" or "o" would be. What's it an offset from? That’s not a meaningful question for this function. The function adds rectangles to a vector and also adds an offset to each rectangle while doing so. The meaning of the offset is known to the caller but not to this function. As far as this function is concerned, it is just an offset to add to the rectangles while adding them to the vector. Another design would be to remove the offset and apply the offset to the rectangles separately after constructing the vector.
Levi Weintraub
Comment 14 2011-05-24 09:57:56 PDT
(In reply to comment #13) > Another design would be to remove the offset and apply the offset to the rectangles separately after constructing the vector. I think we're better off keeping the offset since some overloaded versions of this function adjust this offset differently, and I believe it makes the most sense to keep that logic in its respective class.
Darin Adler
Comment 15 2011-05-24 10:00:46 PDT
(In reply to comment #14) > I think we're better off keeping the offset since some overloaded versions of this function adjust this offset differently, and I believe it makes the most sense to keep that logic in its respective class. I’m not sure that’s right. Adjusting the offset is simply applying another offset. That could be done inside the overloaded functions regardless of whether an offset is passed in to the function. But my main point is that giving a meaningful name explaining what the offset is “relative to” would not be correct for this function.
Levi Weintraub
Comment 16 2011-05-24 10:08:54 PDT
Darin Adler
Comment 17 2011-05-24 11:33:11 PDT
Perhaps “additionalOffset” would be a good name.
Levi Weintraub
Comment 18 2011-05-24 11:34:18 PDT
(In reply to comment #17) > Perhaps “additionalOffset” would be a good name. Sounds reasonable.
Levi Weintraub
Comment 19 2011-05-24 12:27:40 PDT
Levi Weintraub
Comment 20 2011-05-24 17:12:37 PDT
Created attachment 94719 [details] Patch Re-uploading without unintentional xcodeproj change.
Eric Seidel (no email)
Comment 21 2011-05-24 18:52:48 PDT
Comment on attachment 94719 [details] Patch OK. Darin convinced me of the "offset" case. Thanks for all your work on this.
Levi Weintraub
Comment 22 2011-05-25 10:04:51 PDT
Comment on attachment 94719 [details] Patch Clearing flags on attachment: 94719 Committed r87302: <http://trac.webkit.org/changeset/87302>
Levi Weintraub
Comment 23 2011-05-25 10:04:57 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.