Closed Bug 349879 Opened 18 years ago Closed 18 years ago

nsSVGGlyphFrame.cpp needs code consolidation

Categories

(Core :: SVG, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: tor, Assigned: longsonr)

Details

Attachments

(2 files, 2 obsolete files)

Assignee: general → longsonr
Attached patch patch (obsolete) (deleted) — Splinter Review
Here's my take on the consolidation. Should improve performance a little too by passing in the text to GetCharacterPosition, reducing the number of calls to GetCharacterData.
Attachment #235407 - Flags: review?(tor)
Comment on attachment 235407 [details] [diff] [review] patch > nsSVGGlyphFrame::GetCharacterData(nsAString & aCharacterData) >+ } else { >+ nsAString::iterator start, end; >+ characterData.BeginWriting(start); >+ characterData.EndWriting(end); >+ while (start != end) { >+ if (NS_IsAsciiWhitespace(*start)) >+ *start = ' '; >+ ++start; >+ } Unrelated whitespace handling change - please remove from this patch. >Index: renderer/src/cairo/nsSVGCairoGlyphGeometry.h >Index: renderer/src/cairo/nsSVGRendererCairo.cpp Whoops, forgot those two files in my patch, didn't I? Move these changes to a different bug/patch.
Attached patch address review comments (obsolete) (deleted) — Splinter Review
(In reply to comment #2) > (From update of attachment 235407 [details] [diff] [review] [edit]) > > nsSVGGlyphFrame::GetCharacterData(nsAString & aCharacterData) > >+ } else { > >+ nsAString::iterator start, end; > >+ characterData.BeginWriting(start); > >+ characterData.EndWriting(end); > >+ while (start != end) { > >+ if (NS_IsAsciiWhitespace(*start)) > >+ *start = ' '; > >+ ++start; > >+ } > > Unrelated whitespace handling change - please remove from this patch. Done. > > >Index: renderer/src/cairo/nsSVGCairoGlyphGeometry.h > >Index: renderer/src/cairo/nsSVGRendererCairo.cpp > > Whoops, forgot those two files in my patch, didn't I? Move these changes to a > different bug/patch. > Submitted as bug 350581
Attachment #235407 - Attachment is obsolete: true
Attachment #235907 - Flags: review?(tor)
Attachment #235407 - Flags: review?(tor)
Comment on attachment 235907 [details] [diff] [review] address review comments > nsresult > nsSVGGlyphFrame::GetCharacterPosition(cairo_t *ctx, >+ nsAString &aText, > nsSVGCharacterPosition **aCharacterPosition) > { > *aCharacterPosition = nsnull; >+ >+ PRUint32 strLength = aText.Length(); >+ if (strLength == 0) >+ return NS_OK; Use IsEmpty(). > class nsSVGGlyphFrame : public nsSVGGlyphFrameBase, > public nsISVGGlyphFragmentLeaf, // : nsISVGGlyphFragmentNode > public nsISVGChildFrame > { > protected: > friend nsIFrame* > NS_NewSVGGlyphFrame(nsIPresShell* aPresShell, nsIContent* aContent, > nsIFrame* parentFrame, nsStyleContext* aContext); > nsSVGGlyphFrame(nsStyleContext* aContext); > >+ friend class nsSVGAutoGlyphHelperContext; Instead of making it a friend, you could make it a nested class.
(In reply to comment #4) > (From update of attachment 235907 [details] [diff] [review] [edit]) > > nsresult > > nsSVGGlyphFrame::GetCharacterPosition(cairo_t *ctx, > >+ nsAString &aText, > > nsSVGCharacterPosition **aCharacterPosition) > > { > > *aCharacterPosition = nsnull; > >+ > >+ PRUint32 strLength = aText.Length(); > >+ if (strLength == 0) > >+ return NS_OK; > > Use IsEmpty(). That would mean an additional virtual call. As this is a belt and braces test I've changed it to an NS_ASSERTION using IsEmpty. > > > class nsSVGGlyphFrame : public nsSVGGlyphFrameBase, > > public nsISVGGlyphFragmentLeaf, // : nsISVGGlyphFragmentNode > > public nsISVGChildFrame > > { > > protected: > > friend nsIFrame* > > NS_NewSVGGlyphFrame(nsIPresShell* aPresShell, nsIContent* aContent, > > nsIFrame* parentFrame, nsStyleContext* aContext); > > nsSVGGlyphFrame(nsStyleContext* aContext); > > > >+ friend class nsSVGAutoGlyphHelperContext; > > Instead of making it a friend, you could make it a nested class. > Done. I've also made the arguments of some functions const where possible.
Attachment #235907 - Attachment is obsolete: true
Attachment #236385 - Flags: review?(tor)
Attachment #235907 - Flags: review?(tor)
Attachment #236385 - Flags: review?(tor) → review+
Attachment #236385 - Flags: superreview?(roc)
Comment on attachment 236385 [details] [diff] [review] address additional review comments great!
Attachment #236385 - Flags: superreview?(roc) → superreview+
checked in
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Creature does not seem to like this for some reason. See http://tinderbox.mozilla.org/SeaMonkey/
patch backed out, it turned creature red.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attached patch attempt to fix VC6 issues (deleted) — Splinter Review
I'm sorry I caused such problems. This patch differs from the previous one only in that it makes the nsSVGAutoGlyphHelperContext a friend of nsSVGGlyphFrame as per http://www.mozilla.org/hacking/portable-cpp.html#inner_classes
Attachment #237722 - Flags: superreview?(roc)
Attachment #237722 - Flags: review?(tor)
Attachment #237722 - Flags: review?(tor) → review+
Attachment #237722 - Flags: superreview?(roc) → superreview+
vc6 version checked in
Status: REOPENED → RESOLVED
Closed: 18 years ago18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: