RESOLVED FIXED 11217
Cleanup svg coding style
https://bugs.webkit.org/show_bug.cgi?id=11217
Summary Cleanup svg coding style
Rob Buis
Reported 2006-10-08 08:16:02 PDT
Svg code has the following style problems: - use of if(, for(, while(, switch( - unsorted inludes - usage of * on the right, for instance Foo *foo instead of Foo* foo, same for & - using namespace Webcore; instead of wrapping the implementation code in namespace WebCore { ... } - unneeded includes, { not on the same line as if, incorrect use of whitespace
Attachments
Cleanup for svg filter code (63.25 KB, patch)
2006-10-08 08:38 PDT, Rob Buis
darin: review+
Cleanup for svg SVGPath* code (70.13 KB, patch)
2006-10-08 09:15 PDT, Rob Buis
oliver: review+
Cleanup for svg code in shape classes (28.25 KB, patch)
2006-10-08 12:23 PDT, Rob Buis
aroben: review+
Cleaning up of anim* classes (14.93 KB, patch)
2006-10-09 07:32 PDT, Rob Buis
mitz: review-
Improved patch (19.15 KB, patch)
2006-10-09 12:25 PDT, Rob Buis
mitz: review-
New anim patch (19.58 KB, patch)
2006-10-10 01:11 PDT, Rob Buis
mitz: review+
Cleanup for svg text code (21.16 KB, patch)
2006-10-10 13:52 PDT, Rob Buis
no flags
Improved patch (21.20 KB, patch)
2006-10-11 12:51 PDT, Rob Buis
mitz: review-
Improved patch (21.17 KB, patch)
2006-10-12 01:07 PDT, Rob Buis
mitz: review+
First attempt (41.33 KB, patch)
2006-10-12 13:09 PDT, Rob Buis
mitz: review-
Improved patch (43.42 KB, patch)
2006-10-13 03:23 PDT, Rob Buis
mitz: review-
Improved patch (43.96 KB, patch)
2006-10-13 04:44 PDT, Rob Buis
mitz: review+
First attempt (37.68 KB, patch)
2006-10-13 12:11 PDT, Rob Buis
mitz: review-
Improved patch (39.41 KB, patch)
2006-10-13 13:22 PDT, Rob Buis
mitz: review+
First attempt (43.46 KB, patch)
2006-10-14 13:57 PDT, Rob Buis
mitz: review-
Improved patch (44.10 KB, patch)
2006-10-15 00:16 PDT, Rob Buis
mitz: review+
First attempt (19.73 KB, patch)
2006-10-16 12:31 PDT, Rob Buis
mitz: review-
Improved patch (19.81 KB, patch)
2006-10-20 00:49 PDT, Rob Buis
no flags
Even better patch (19.65 KB, patch)
2006-10-20 01:24 PDT, Rob Buis
mitz: review+
Rob Buis
Comment 1 2006-10-08 08:38:56 PDT
Created attachment 10979 [details] Cleanup for svg filter code Should be clear what this about looking at the description :) Cheers, Rob.
Rob Buis
Comment 2 2006-10-08 09:15:18 PDT
Created attachment 10980 [details] Cleanup for svg SVGPath* code This one is pretty straightforward. Cheers, Rob.
Rob Buis
Comment 3 2006-10-08 12:23:42 PDT
Created attachment 10986 [details] Cleanup for svg code in shape classes This time a cleanup for shape classes. Cheers, Rob.
Adam Roben (:aroben)
Comment 4 2006-10-08 13:08:46 PDT
Comment on attachment 10986 [details] Cleanup for svg code in shape classes r=me
Oliver Hunt
Comment 5 2006-10-08 13:30:10 PDT
Comment on attachment 10980 [details] Cleanup for svg SVGPath* code remove - filterStyle->deref(view()->renderArena()); + filterStyle->deref(document()->renderArena()); and associated bits before landing, as we discussed.
Darin Adler
Comment 6 2006-10-08 13:31:50 PDT
Comment on attachment 10979 [details] Cleanup for svg filter code Looks good.
Oliver Hunt
Comment 7 2006-10-08 13:48:42 PDT
Comment on attachment 10980 [details] Cleanup for svg SVGPath* code looks sane to me
Rob Buis
Comment 8 2006-10-09 07:32:46 PDT
Created attachment 10992 [details] Cleaning up of anim* classes Small patch this time, anim* classes... Cheers, Rob.
mitz
Comment 9 2006-10-09 10:23:44 PDT
Comment on attachment 10992 [details] Cleaning up of anim* classes Node *target = parentNode(); - while(target != 0) { + while (target != 0) { Forgot to move the star there. Also, per the style guidelines, the second line should say just + while (target) {
mitz
Comment 10 2006-10-09 12:07:57 PDT
Comment on attachment 10992 [details] Cleaning up of anim* classes Rob is going to post an updated patch
Rob Buis
Comment 11 2006-10-09 12:25:09 PDT
Created attachment 10995 [details] Improved patch This one solves some issues with the previous, now obsoleted anim patch. Cheers, Rob.
mitz
Comment 12 2006-10-09 13:58:45 PDT
Comment on attachment 10995 [details] Improved patch I asked Rob to make a few more changes: change NULLs to 0s, keep the #include "SVGColor.h" in SVGAnimateColorElement.cpp, and move the open braces in switch statements to the same line.
Rob Buis
Comment 13 2006-10-10 01:11:04 PDT
Created attachment 11010 [details] New anim patch Addreessing Mitz' issues this time I hope :) Cheers, Rob.
mitz
Comment 14 2006-10-10 01:39:36 PDT
Comment on attachment 11010 [details] New anim patch r=me
Rob Buis
Comment 15 2006-10-10 13:52:32 PDT
Created attachment 11023 [details] Cleanup for svg text code This time a cleanup for text related classes. Cheers, Rob.
Rob Buis
Comment 16 2006-10-11 12:51:53 PDT
Created attachment 11035 [details] Improved patch New patch after olliej' text changes. Cheers, Rob.
mitz
Comment 17 2006-10-11 13:53:14 PDT
Comment on attachment 11035 [details] Improved patch There are several declarations (repeating in several headers) where you could drop the parameter names: + virtual void parseMappedAttribute(MappedAttribute* attr); + virtual RenderObject* createRenderer(RenderArena* arena, RenderStyle* style); + bool childShouldCreateRenderer(Node* child) const; + virtual void updateLocalTransform(SVGTransformList* localTransforms); The second line here should be indented: +SVGTSpanElement::SVGTSpanElement(const QualifiedName& tagName, Document* doc) : SVGTextPositioningElement(tagName, doc)
Rob Buis
Comment 18 2006-10-12 01:07:54 PDT
Created attachment 11042 [details] Improved patch Fixing the headers... Cheers, Rob.
mitz
Comment 19 2006-10-12 06:41:21 PDT
Comment on attachment 11042 [details] Improved patch r=me
Rob Buis
Comment 20 2006-10-12 13:09:54 PDT
Created attachment 11052 [details] First attempt Various style fixes for svg structure classes. Cheers, Rob.
mitz
Comment 21 2006-10-13 00:56:33 PDT
Comment on attachment 11052 [details] First attempt Unnecessary parameter names in + SVGDocument(DOMImplementation* i, FrameView* view); These should be two lines each: + if (SVGLangSpace::parseMappedAttribute(attr)) return; + if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) return; + if (SVGFitToViewBox::parseMappedAttribute(attr)) return; I also discussed with Rob the commented-out code in SVGSVGElement.cpp. Those comments should be deleted and replaced with FIXMEs, preferably referring to bugs about the missing functionality.
Rob Buis
Comment 22 2006-10-13 03:23:43 PDT
Created attachment 11062 [details] Improved patch Now includes FIXMEs in SVGSVGElement referencing to bug numbers. Cheers, Rob.
mitz
Comment 23 2006-10-13 03:39:22 PDT
Comment on attachment 11062 [details] Improved patch Looks great! + //FIXME: implement me (see bug 11273) 1) There should be a space between // and FIXME. 2) You should use sentence capitalization for the part after "FIXME:", e.g. "// FIXME: Implement me (see bug 11273)". (This applies also to comments that you added that have the space after the //).
Rob Buis
Comment 24 2006-10-13 04:44:36 PDT
Created attachment 11065 [details] Improved patch Fixing remaining issues. Cheers, Rob.
mitz
Comment 25 2006-10-13 05:04:25 PDT
Comment on attachment 11065 [details] Improved patch Two stars remaining to be moved here: virtual bool rendererIsNeeded(RenderStyle *style) { return StyledElement::rendererIsNeeded(style); } - virtual RenderObject *createRenderer(RenderArena *arena, RenderStyle *style); + virtual RenderObject *createRenderer(RenderArena*, RenderStyle*); You can fix this when landing. r=me
Rob Buis
Comment 26 2006-10-13 12:11:06 PDT
Created attachment 11073 [details] First attempt Cleaning up the house, err paint servers ;-> Cheers, Rob.
mitz
Comment 27 2006-10-13 12:53:17 PDT
Comment on attachment 11073 [details] First attempt Redundant parameter names (some of these show up multiple times): - virtual void buildGradient(KRenderingPaintServerGradient *grad) const = 0; + virtual void buildGradient(KRenderingPaintServerGradient* grad) const = 0; - const SVGStyledElement *pushAttributeContext(const SVGStyledElement *context); + const SVGStyledElement* pushAttributeContext(const SVGStyledElement* context); - virtual void buildGradient(KRenderingPaintServerGradient *grad) const; + virtual void buildGradient(KRenderingPaintServerGradient* grad) const; Don't need the "!= 0" here: + for (Node* n = target->firstChild(); n != 0; n = n->nextSibling()) { Don't need the space before the > here (some of these show up multiple times): SVGStyledElement* e = static_cast<SVGStyledElement* >(elem); SVGStyledElement* styled = (current ? static_cast<SVGStyledElement* >(current->element()) : 0); m_paintServer->setListener(const_cast<SVGPatternElement* >(this)); - KRenderingPaintServerRadialGradient *grad = static_cast<KRenderingPaintServerRadialGradient *>(_grad); + KRenderingPaintServerRadialGradient* grad = static_cast<KRenderingPaintServerRadialGradient* >(_grad); - KRenderingPaintServerGradient *gradient = static_cast<KRenderingPaintServerGradient *>(pserver); + KRenderingPaintServerGradient* gradient = static_cast<KRenderingPaintServerGradient* >(pserver); + KRenderingPaintServerRadialGradient* radial = static_cast<KRenderingPaintServerRadialGradient* >(pserver);
Rob Buis
Comment 28 2006-10-13 13:22:31 PDT
Created attachment 11077 [details] Improved patch This should address Mitz' issues. Cheers, Rob.
mitz
Comment 29 2006-10-13 13:50:40 PDT
Comment on attachment 11077 [details] Improved patch r=me
Rob Buis
Comment 30 2006-10-14 13:57:05 PDT
Created attachment 11089 [details] First attempt This time cleaning up basic datastructures. Cheers, Rob.
mitz
Comment 31 2006-10-14 14:32:26 PDT
Comment on attachment 11089 [details] First attempt My only comments are about lines that the patch doesn't touch: The opening brace should go on the same line as the case: case SVG_LENGTHTYPE_EXS: { This needs spaces after the semicolons: for (unsigned long i = 0;i < list->numberOfItems();i++) { The way this is split into lines doesn't make sense. I think two lines with 4 parameters in each will suffice, but otherwise, it should be 2 parameters on each line: + SVGMatrix* getCTM(float logicX, float logicY, float logicWidth, float logicHeight, float physX, float physY, float physWidth, float physHeight);
Rob Buis
Comment 32 2006-10-15 00:16:35 PDT
Created attachment 11092 [details] Improved patch This one should address Mitz' issues. Cheers, Rob.
mitz
Comment 33 2006-10-15 00:42:21 PDT
Comment on attachment 11092 [details] Improved patch r=me
Rob Buis
Comment 34 2006-10-16 12:31:02 PDT
Created attachment 11114 [details] First attempt This one should be easy to review :-) Cheers, Rob.
mitz
Comment 35 2006-10-20 00:18:29 PDT
Comment on attachment 11114 [details] First attempt Don't need "!= 0" here: + for (Node* n = firstChild(); n != 0; n = n->nextSibling()) { Don't need the "angle" and "attr" parameter names: + void setOrientToAngle(SVGAngle* angle); virtual void attributeChanged(Attribute* attr, bool preserveDecls);
Rob Buis
Comment 36 2006-10-20 00:49:59 PDT
Created attachment 11163 [details] Improved patch This patch should fix the remaining issues. Cheers, Rob.
Rob Buis
Comment 37 2006-10-20 01:24:36 PDT
Created attachment 11165 [details] Even better patch Mitz noted some problems with my previous patch, so I invalidated that one, this one should be better. Cheers, Rob.
mitz
Comment 38 2006-10-20 01:44:17 PDT
Comment on attachment 11165 [details] Even better patch r=me
Mark Rowe (bdash)
Comment 39 2006-10-24 04:35:55 PDT
Do any of these patches remain to be landed? It's still showing up in the pending commit queue, but it's not at all obvious which of these patches have been landed.
Rob Buis
Comment 40 2006-10-24 06:06:11 PDT
Hi, (In reply to comment #39) > Do any of these patches remain to be landed? It's still showing up in the > pending commit queue, but it's not at all obvious which of these patches have > been landed. All patches that have been appended are reviewed and okayed (sometimes not on the first try). I expect there is still one big patch and one or two small patches left before all of the svg code has been cleaned up, I plan to do the big one soon. Once these are done, the whole bug can be closed. I hope that clears things up a bit. Cheers, Rob.
Sam Weinig
Comment 41 2006-10-24 07:04:25 PDT
(In reply to comment #40) Rob, It would be helpful if you checked the "obsolete" check-mark for the patches that have been applied (or rejected) so that we can figure out what, if anything, is left to commit. If it's possible, it would also be nice if you (or the commiter) noted what revision the patches were landed in.
Rob Buis
Comment 42 2006-10-24 07:31:25 PDT
Hi Sam, (In reply to comment #41) > (In reply to comment #40) > > Rob, > It would be helpful if you checked the "obsolete" check-mark for the patches > that have been applied (or rejected) so that we can figure out what, if > anything, is left to commit. If it's possible, it would also be nice if you > (or the commiter) noted what revision the patches were landed in. I tried to obsolete some but I get an error after checking the obsolete flag. Cheers, Rob.
mitz
Comment 43 2006-10-31 11:09:50 PST
Comment on attachment 10986 [details] Cleanup for svg code in shape classes Landed in r16918
mitz
Comment 44 2006-10-31 11:11:26 PST
Comment on attachment 10980 [details] Cleanup for svg SVGPath* code Landed in r16920
mitz
Comment 45 2006-10-31 11:13:04 PST
Comment on attachment 11010 [details] New anim patch Landed in r16963
mitz
Comment 46 2006-10-31 11:14:41 PST
Comment on attachment 11042 [details] Improved patch Landed in r17008
mitz
Comment 47 2006-10-31 11:15:41 PST
Comment on attachment 11065 [details] Improved patch Landed in r17027
mitz
Comment 48 2006-10-31 11:16:42 PST
Comment on attachment 11077 [details] Improved patch Landed in r17041
mitz
Comment 49 2006-10-31 11:17:51 PST
Comment on attachment 11092 [details] Improved patch Landed in r17062
mitz
Comment 50 2006-10-31 11:18:19 PST
Comment on attachment 11165 [details] Even better patch Landed in r17158
mitz
Comment 51 2006-10-31 11:21:05 PST
I guess we're done here :-)
Note You need to log in before you can comment on or make changes to this bug.