Closed
Bug 1349462
Opened 7 years ago
Closed 7 years ago
Rename nsIFrame::IsSVGText() to nsSVGUtils::IsInSVGTextSubtree()
Categories
(Core :: SVG, enhancement)
Core
SVG
Tracking
()
RESOLVED
FIXED
mozilla55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: u459114, Assigned: u459114)
Details
Attachments
(2 files)
nsIFrame::IsSVGText() return true if this object is an SVG text object or a descendant of an SVG test object. Function name is kind of misleading.
Comment 1•7 years ago
|
||
Seems fine as is is to me FWIW, have you checked with cam?
(In reply to Robert Longson from comment #1) > Seems fine as is is to me FWIW, have you checked with cam? Yes, I discussed with him several weeks ago.
Comment 3•7 years ago
|
||
I think the current name does kind of sound like "is this an SVGTextFrame", rather than "is this a frame that implements SVG text", which would include the descendant nsBlockFrames/nsInlineFrames. Since the SVGTextFrame itself also has this bit set, I don't think "IsDescendantOfSVGText" is quite right. (If anything, it would need to be "IsSVGTextOrDescendant".) Maybe "IsInSVGTextSubtree" (to mirror things like IsInNativeAnonymousSubtree)?
Comment 4•7 years ago
|
||
An alternative would be just to document the IsSVGText method in nsIFrame.h. (Also it looks like the comment above the NS_FRAME_IS_SVG_TEXT definition in nsFrameStateBits.h is wrong, since it also says "descendant" when it should include the SVGTextFrame itself, too.)
How about we move this util function to nsSVGUtil? Define an SVG specific function in nsIFrame is a little bit weird. For example: bool nsSVGUtil::IsInSVGTextSubtree(nsIFrame* aFrame) { return aFrame->GetStateBits() & NS_FRAME_IS_SVG_TEXT; } bool nsSVGUtil::HasSVGLayout(nsIFrame* aFrame) { return aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT; }
Comment 6•7 years ago
|
||
(In reply to Cameron McCormack (:heycam) from comment #3) > Maybe "IsInSVGTextSubtree" Gets my vote. I'd also have a slight preference for putting these on nsSVGUtils.
Comment 7•7 years ago
|
||
FWIW there are other access methods on nsIFrame that just check state bits (e.g. IsGeneratedContentFrame, IsXULHorizontal, IsAbsoluteContainer), so it seems fine to me to stay there. But I don't mind if it's on nsSVGUtils either.
IsGeneratedContentFrame and IsAbsoluteContainer is ok for me. If we have nsXULUtil, I would like to move IsXULHorizontal there.
Comment hidden (mozreview-request) |
Attachment #8850409 -
Flags: review?(mstange)
Attachment #8850409 -
Flags: review?(mstange) → review?(cam)
Comment 10•7 years ago
|
||
mozreview-review |
Comment on attachment 8850409 [details] Bug 1349462 - Part 1. Rename IsSVGText as IsInSVGTextSubtree. https://reviewboard.mozilla.org/r/123006/#review125270 ::: layout/svg/nsSVGUtils.h:613 (Diff revision 1) > + static bool > + IsInSVGTextSubtree(const nsIFrame* aFrame) { > + return aFrame->GetStateBits() & NS_FRAME_IS_SVG_TEXT; > + } Nit: one line for |static bool IsInSVGTextSubtree(...) {|. (The few functions above here have the wrong style, for declarations inside a class.) Also, please add a comment describing what this does (i.e., returns true if the frame is an SVGTextFrame or one of its descendants).
Attachment #8850409 -
Flags: review?(cam) → review+
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Attachment #8850445 -
Flags: review?(cku)
Assignee | ||
Comment 13•7 years ago
|
||
mozreview-review |
Comment on attachment 8850445 [details] Bug 1349462 - Part 2. one line for static function. https://reviewboard.mozilla.org/r/123038/#review125298
Attachment #8850445 -
Flags: review?(cku) → review+
Comment 14•7 years ago
|
||
mozreview-review |
Comment on attachment 8850445 [details] Bug 1349462 - Part 2. one line for static function. https://reviewboard.mozilla.org/r/123038/#review125294 ::: layout/svg/nsSVGUtils.h:367 (Diff revision 1) > - GetClipRectForFrame(nsIFrame *aFrame, > - float aX, float aY, float aWidth, float aHeight); > + float aX, float aY, float aWidth, > + float aHeight); Since you're having to wrap aHeight here, I'd put aWidth on the same line, but maybe that's just me. ;)
Attachment #8850445 -
Flags: review+
Updated•7 years ago
|
Summary: Rename nsIFrame::IsSVGText() to IsDescendantOfSVGText() → Rename nsIFrame::IsSVGText() to nsSVGUtils::IsInSVGTextSubtree()
Attachment #8850445 -
Flags: review?(cam)
Attachment #8850445 -
Flags: review?(cam)
Comment 15•7 years ago
|
||
Pushed by cku@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f9222bab527d Part 1. Rename IsSVGText as IsInSVGTextSubtree. r=heycam https://hg.mozilla.org/integration/autoland/rev/821005b8d9fa Part 2. one line for static function. r=jwatt
Comment 16•7 years ago
|
||
(In reply to Pulsebot from comment #15) > https://hg.mozilla.org/integration/autoland/rev/821005b8d9fa > Part 2. one line for static function. r=jwatt Hmm, I forgot to review the commit message. It's useful to think of commit messages from the point of view of someone looking at *all* commits landing in the tree and asking yourself if this message is useful for them. Something like "Reformat nsSVGUtils' methods to conform to the style guidelines" would have been much more useful I think. :) Sorry for not catching that.
Comment 17•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/f9222bab527d https://hg.mozilla.org/mozilla-central/rev/821005b8d9fa
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in
before you can comment on or make changes to this bug.
Description
•