Closed
Bug 852620
Opened 11 years ago
Closed 11 years ago
Convert SVGRect to WebIDL
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla22
People
(Reporter: baku, Assigned: baku)
References
(Blocks 1 open bug)
Details
Attachments
(2 files, 8 obsolete files)
10.09 KB,
patch
|
Ms2ger
:
review+
|
Details | Diff | Splinter Review |
39.68 KB,
patch
|
Ms2ger
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #726834 -
Flags: review?(Ms2ger)
Assignee | ||
Comment 2•11 years ago
|
||
Attachment #726835 -
Flags: review?(Ms2ger)
Comment 3•11 years ago
|
||
Comment on attachment 726834 [details] [diff] [review] part 1 - renaming Review of attachment 726834 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/svg/content/src/Makefile.in @@ +50,5 @@ > nsSVGPathDataParser.cpp \ > nsSVGPathGeometryElement.cpp \ > nsSVGPolyElement.cpp \ > nsSVGString.cpp \ > + SVGRect.cpp \ Put this below, in the sorted section of SVG*.cpp
Attachment #726834 -
Flags: review?(Ms2ger) → review+
Comment 4•11 years ago
|
||
Comment on attachment 726835 [details] [diff] [review] part 2 - webidl Review of attachment 726835 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/svg/content/src/SVGRect.h @@ +40,5 @@ > + > + void SetX(float aX, ErrorResult& aRv) > + { > + if (!NS_finite(aX)) { > + aRv.Throw(NS_ERROR_ILLEGAL_VALUE); These aren't unrestricted floats, so this can never happen.
Comment 5•11 years ago
|
||
You haven't converted nsSVGViewBox::DOMBaseVal and nsSVGViewBox::DOMAnimVal. You're probably going to want to make a base class, like nsISVGPoint.
Comment 6•11 years ago
|
||
Comment on attachment 726835 [details] [diff] [review] part 2 - webidl Review of attachment 726835 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/svg/content/src/SVGRect.h @@ +50,5 @@ > + > + float Y() const > + { > + return mY; > + } Just inline these? ::: content/svg/content/src/SVGSVGElement.cpp @@ +416,4 @@ > NS_NewSVGRect(getter_AddRefs(rect)); > return rect.forget(); > } > It may be worth changing the signature of NS_NewSVGRect to not use the outparam.
Assignee | ||
Comment 7•11 years ago
|
||
This check was in the XPCOM implementation. I prefer to keep it.
> > + void SetX(float aX, ErrorResult& aRv)
> > + {
> > + if (!NS_finite(aX)) {
> > + aRv.Throw(NS_ERROR_ILLEGAL_VALUE);
>
> These aren't unrestricted floats, so this can never happen.
Assignee | ||
Comment 8•11 years ago
|
||
I didn't use a base class, but can you review this patch?
Attachment #726835 -
Attachment is obsolete: true
Attachment #726835 -
Flags: review?(Ms2ger)
Attachment #726950 -
Flags: review?(dzbarsky)
Comment 9•11 years ago
|
||
Comment on attachment 726950 [details] [diff] [review] part 2 - webidl Review of attachment 726950 [details] [diff] [review]: ----------------------------------------------------------------- File a followup for removing nsIDOMSVGRect and classinof? ::: content/svg/content/src/SVGRect.h @@ +41,5 @@ > + if (!NS_finite(aX)) { > + aRv.Throw(NS_ERROR_ILLEGAL_VALUE); > + return; > + } > + Don't need the Ns_finite check. @@ +88,3 @@ > protected: > float mX, mY, mWidth, mHeight; > }; So subclasses have access to mX, mY, mWidth, and mHeight even though they don't use it? That seems a little unfortunate, which is why I suggested the base class. ::: content/svg/content/src/nsSVGViewBox.h @@ +105,4 @@ > NS_IMETHOD GetX(float *aX) > + { *aX = X(); return NS_OK; } > + float Y() const > + { return mVal->GetBaseValue().y; } Please mark all of these as MOZ_OVERRIDE, just in case the signature changes.
Attachment #726950 -
Flags: review?(dzbarsky) → review+
Comment 10•11 years ago
|
||
(In reply to Andrea Marchesini (:baku) from comment #7) > This check was in the XPCOM implementation. I prefer to keep it. > > > > + void SetX(float aX, ErrorResult& aRv) > > > + { > > > + if (!NS_finite(aX)) { > > > + aRv.Throw(NS_ERROR_ILLEGAL_VALUE); > > > > These aren't unrestricted floats, so this can never happen. Move them to the XPCOM method. the generated bindings code already performs these checks.
Comment 11•11 years ago
|
||
Comment on attachment 726950 [details] [diff] [review] part 2 - webidl Review of attachment 726950 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/svg/content/src/SVGRect.h @@ +33,5 @@ > + // WebIDL > + virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope); > + > + virtual float X() const > + { return mX; } Fix the style here, should be { return mX; } Same for the others. ::: content/svg/content/src/nsSVGViewBox.h @@ +148,4 @@ > } > + > + NS_IMETHOD GetX(float *aX) > + { *aX = X(); return NS_OK; } You should remove all the XPCOM implementations here, and declare them as MOZ_OVERRIDE MOZ_FINAL in dom::SVGRect.
Assignee | ||
Comment 12•11 years ago
|
||
SVGIRect base class
Attachment #726950 -
Attachment is obsolete: true
Attachment #727161 -
Flags: review?(Ms2ger)
Comment 13•11 years ago
|
||
Comment on attachment 727161 [details] [diff] [review] part 2 - webidl Review of attachment 727161 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/svg/content/src/SVGRect.cpp @@ +38,1 @@ > NS_IMETHODIMP SVGRect::SetX(float aX) These setters need to die too. ::: content/svg/content/src/SVGRect.h @@ +18,5 @@ > > namespace mozilla { > namespace dom { > > +class SVGIRect : public nsIDOMSVGRect Call it mozilla::dom::ISVGRect, then. Also move it into its own file. @@ +30,5 @@ > + *aX = X(); > + return NS_OK; > + } > + > + NS_IMETHOD SetX(float aX) This should test for finiteness, and they should all be MOZ_OVERRIDE MOZ_FINAL. @@ +106,5 @@ > + { > + return mX; > + } > + > + virtual void SetX(float aX, ErrorResult& aRv) MOZ_OVERRIDE All of these should assert finiteness. @@ +143,5 @@ > + } > + > + virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope) > + { > + return SVGRectBinding::Wrap(aCx, aScope, this); Move this out of line, as usual. ::: dom/bindings/Bindings.conf @@ +833,5 @@ > 'headerFile': 'mozilla/dom/SVGGradientElement.h', > }, > > +'SVGRect': { > + 'wrapperCache': False This should now have a nativeType that gives the name of the subclass.
Attachment #727161 -
Flags: review?(Ms2ger) → review-
Comment 14•11 years ago
|
||
And it's probably a good idea to create the new superclass in a separate patch.
Assignee | ||
Comment 15•11 years ago
|
||
ok. So let's land the previous patch + comments.
Assignee | ||
Comment 16•11 years ago
|
||
Another quick review?
Attachment #727161 -
Attachment is obsolete: true
Attachment #727609 -
Flags: review?(Ms2ger)
Comment 17•11 years ago
|
||
Comment on attachment 727609 [details] [diff] [review] part 2 - webidl Review of attachment 727609 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/svg/content/src/SVGRect.cpp @@ +40,1 @@ > NS_IMETHODIMP SVGRect::SetX(float aX) These should be gone
Attachment #727609 -
Flags: review?(Ms2ger) → review-
Assignee | ||
Comment 18•11 years ago
|
||
Attachment #727609 -
Attachment is obsolete: true
Attachment #728172 -
Flags: review?(Ms2ger)
Assignee | ||
Comment 19•11 years ago
|
||
SVGIRect was missing in the previous patch.
Attachment #728172 -
Attachment is obsolete: true
Attachment #728172 -
Flags: review?(Ms2ger)
Attachment #728183 -
Flags: review?(Ms2ger)
Comment 20•11 years ago
|
||
Comment on attachment 728183 [details] [diff] [review] part 2 - webidl Review of attachment 728183 [details] [diff] [review]: ----------------------------------------------------------------- One issue, still. The bindings should use SVGIRect, not SVGRect. ::: content/svg/content/src/SVGIRect.h @@ +9,5 @@ > +#include "nsIDOMSVGRect.h" > +#include "mozilla/Attributes.h" > +#include "mozilla/ErrorResult.h" > +#include "nsCycleCollectionParticipant.h" > +#include "nsContentUtils.h" Nit: sort these ::: content/svg/content/src/SVGRect.h @@ +6,5 @@ > #ifndef mozilla_dom_SVGRect_h > #define mozilla_dom_SVGRect_h > > #include "gfxRect.h" > +#include "SVGIRect.h" Include as "mozilla/dom/SVGRect.h" @@ +7,5 @@ > #define mozilla_dom_SVGRect_h > > #include "gfxRect.h" > +#include "SVGIRect.h" > +#include "nsWrapperCache.h" Remove this include @@ +24,5 @@ > // nsISupports interface: > NS_DECL_ISUPPORTS > > + // WebIDL > + virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope); This should be on SVGIRect, and should be non-virtual. ::: dom/bindings/Bindings.conf @@ +833,5 @@ > 'headerFile': 'mozilla/dom/SVGGradientElement.h', > }, > > +'SVGRect': { > + 'wrapperCache': False This should have 'nativeType': 'mozilla::dom::SVGIRect'
Attachment #728183 -
Flags: review?(Ms2ger) → review-
Assignee | ||
Comment 21•11 years ago
|
||
Attachment #728183 -
Attachment is obsolete: true
Attachment #728251 -
Flags: review?(Ms2ger)
Comment 22•11 years ago
|
||
Comment on attachment 728251 [details] [diff] [review] part 2 - webidl Review of attachment 728251 [details] [diff] [review]: ----------------------------------------------------------------- r=me. Phew :) ::: content/svg/content/src/SVGIRect.h @@ +13,5 @@ > +#include "mozilla/Attributes.h" > +#include "mozilla/ErrorResult.h" > + > +//////////////////////////////////////////////////////////////////////// > +// SVGIRect class (I don't think this comment is useful.) ::: content/svg/content/src/SVGRect.h @@ +71,5 @@ > } // namespace dom > } // namespace mozilla > > +nsresult > +NS_NewSVGRect(mozilla::dom::SVGRect** result, Could you file a followup to make this not use an outparam?
Attachment #728251 -
Flags: review?(Ms2ger) → review+
Assignee | ||
Comment 23•11 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=454be8191ba7
Attachment #728251 -
Attachment is obsolete: true
Attachment #728291 -
Flags: review+
Assignee | ||
Comment 24•11 years ago
|
||
Added using SVGRect::SetX & C. https://tbpl.mozilla.org/?tree=Try&rev=ea87f57d2a85
Attachment #728291 -
Attachment is obsolete: true
Attachment #728655 -
Flags: review?(Ms2ger)
Comment 25•11 years ago
|
||
Comment on attachment 728655 [details] [diff] [review] part 2 - webidl Interdiff looks good. Ship it!
Attachment #728655 -
Flags: review?(Ms2ger) → review+
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 26•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/b81c844b0e5f https://hg.mozilla.org/integration/mozilla-inbound/rev/086a80ce6c78
Keywords: checkin-needed
Comment 27•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/b81c844b0e5f https://hg.mozilla.org/mozilla-central/rev/086a80ce6c78
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
Comment 28•11 years ago
|
||
(In reply to :Ms2ger from comment #22) > Comment on attachment 728251 [details] [diff] [review] > ::: content/svg/content/src/SVGRect.h > @@ +71,5 @@ > > } // namespace dom > > } // namespace mozilla > > > > +nsresult > > +NS_NewSVGRect(mozilla::dom::SVGRect** result, > > Could you file a followup to make this not use an outparam? Got around to this already? :)
No longer blocks: 826738
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•