Mozilla Home
Privacy
Cookies
Legal
Bugzilla
Browse
Advanced Search
New Bug
Reports
Documentation
Log In
Log In with GitHub
or
Remember me
Browse
Advanced Search
New Bug
Reports
Documentation
Attachment 8389634 Details for
Bug 918189
[patch]
Part 1.5: Implement GeometryUtils.convertPointFromNode, convertRectFromNode, and convertQuadFromNode
918189-implement (text/plain), 10.76 KB, created by
Robert O'Callahan (:roc) (email my personal email if necessary)
(
hide
)
Description:
Part 1.5: Implement GeometryUtils.convertPointFromNode, convertRectFromNode, and convertQuadFromNode
Filename:
MIME Type:
Creator:
Robert O'Callahan (:roc) (email my personal email if necessary)
Size:
10.76 KB
patch
obsolete
># HG changeset patch ># User Robert O'Callahan <robert@ocallahan.org> ># Date 1394586699 -28800 ># Wed Mar 12 09:11:39 2014 +0800 ># Node ID 4c92f5d5a08f316630e03d63c8dcd2ba3373b5c8 ># Parent 68f04b4cc7deab8b749fcd55816d236787c5897c >Bug 918189. Part 1.5: Implement GeometryUtils.convertPointFromNode, convertRectFromNode, and convertQuadFromNode. r=jst > >diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h >--- a/content/base/public/nsINode.h >+++ b/content/base/public/nsINode.h >@@ -58,22 +58,27 @@ namespace dom { > inline bool IsSpaceCharacter(char16_t aChar) { > return aChar == ' ' || aChar == '\t' || aChar == '\n' || aChar == '\r' || > aChar == '\f'; > } > inline bool IsSpaceCharacter(char aChar) { > return aChar == ' ' || aChar == '\t' || aChar == '\n' || aChar == '\r' || > aChar == '\f'; > } >+struct BoxQuadOptions; >+struct ConvertCoordinateOptions; >+class DOMPoint; >+class DOMQuad; >+class DOMRectReadOnly; > class Element; >-struct BoxQuadOptions; >-class DOMQuad; > class EventHandlerNonNull; > class OnErrorEventHandlerNonNull; > template<typename T> class Optional; >+class TextOrElementOrDocument; >+struct DOMPointInit; > } // namespace dom > } // namespace mozilla > > #define NODE_FLAG_BIT(n_) (1U << (WRAPPER_CACHE_FLAGS_BITS_USED + (n_))) > > enum { > // This bit will be set if the node has a listener manager. > NODE_HAS_LISTENERMANAGER = NODE_FLAG_BIT(0), >@@ -275,17 +280,22 @@ private: > * An internal interface that abstracts some DOMNode-related parts that both > * nsIContent and nsIDocument share. An instance of this interface has a list > * of nsIContent children and provides access to them. > */ > class nsINode : public mozilla::dom::EventTarget > { > public: > typedef mozilla::dom::BoxQuadOptions BoxQuadOptions; >+ typedef mozilla::dom::ConvertCoordinateOptions ConvertCoordinateOptions; >+ typedef mozilla::dom::DOMPoint DOMPoint; >+ typedef mozilla::dom::DOMPointInit DOMPointInit; > typedef mozilla::dom::DOMQuad DOMQuad; >+ typedef mozilla::dom::DOMRectReadOnly DOMRectReadOnly; >+ typedef mozilla::dom::TextOrElementOrDocument TextOrElementOrDocument; > typedef mozilla::ErrorResult ErrorResult; > > NS_DECLARE_STATIC_IID_ACCESSOR(NS_INODE_IID) > > // Among the sub-classes that inherit (directly or indirectly) from nsINode, > // measurement of the following members may be added later if DMD finds it is > // worthwhile: > // - nsGenericHTMLElement: mForm, mFieldSet >@@ -1613,16 +1623,29 @@ public: > // ParentNode methods > mozilla::dom::Element* GetFirstElementChild() const; > mozilla::dom::Element* GetLastElementChild() const; > > void GetBoxQuads(const BoxQuadOptions& aOptions, > nsTArray<nsRefPtr<DOMQuad> >& aResult, > mozilla::ErrorResult& aRv); > >+ already_AddRefed<DOMQuad> ConvertQuadFromNode(DOMQuad& aQuad, >+ const TextOrElementOrDocument& aFrom, >+ const ConvertCoordinateOptions& aOptions, >+ ErrorResult& aRv); >+ already_AddRefed<DOMQuad> ConvertRectFromNode(DOMRectReadOnly& aRect, >+ const TextOrElementOrDocument& aFrom, >+ const ConvertCoordinateOptions& aOptions, >+ ErrorResult& aRv); >+ already_AddRefed<DOMPoint> ConvertPointFromNode(const DOMPointInit& aPoint, >+ const TextOrElementOrDocument& aFrom, >+ const ConvertCoordinateOptions& aOptions, >+ ErrorResult& aRv); >+ > protected: > > // Override this function to create a custom slots class. > // Must not return null. > virtual nsINode::nsSlots* CreateSlots(); > > bool HasSlots() const > { >diff --git a/content/base/src/nsINode.cpp b/content/base/src/nsINode.cpp >--- a/content/base/src/nsINode.cpp >+++ b/content/base/src/nsINode.cpp >@@ -1144,16 +1144,43 @@ nsINode::PreHandleEvent(nsEventChainPreV > void > nsINode::GetBoxQuads(const BoxQuadOptions& aOptions, > nsTArray<nsRefPtr<DOMQuad> >& aResult, > mozilla::ErrorResult& aRv) > { > mozilla::GetBoxQuads(this, aOptions, aResult, aRv); > } > >+already_AddRefed<DOMQuad> >+nsINode::ConvertQuadFromNode(DOMQuad& aQuad, >+ const GeometryNode& aFrom, >+ const ConvertCoordinateOptions& aOptions, >+ ErrorResult& aRv) >+{ >+ return mozilla::ConvertQuadFromNode(this, aQuad, aFrom, aOptions, aRv); >+} >+ >+already_AddRefed<DOMQuad> >+nsINode::ConvertRectFromNode(DOMRectReadOnly& aRect, >+ const GeometryNode& aFrom, >+ const ConvertCoordinateOptions& aOptions, >+ ErrorResult& aRv) >+{ >+ return mozilla::ConvertRectFromNode(this, aRect, aFrom, aOptions, aRv); >+} >+ >+already_AddRefed<DOMPoint> >+nsINode::ConvertPointFromNode(const DOMPointInit& aPoint, >+ const GeometryNode& aFrom, >+ const ConvertCoordinateOptions& aOptions, >+ ErrorResult& aRv) >+{ >+ return mozilla::ConvertPointFromNode(this, aPoint, aFrom, aOptions, aRv); >+} >+ > nsresult > nsINode::DispatchEvent(nsIDOMEvent *aEvent, bool* aRetVal) > { > // XXX sXBL/XBL2 issue -- do we really want the owner here? What > // if that's the XBL document? Would we want its presshell? Or what? > nsCOMPtr<nsIDocument> document = OwnerDoc(); > > // Do nothing if the element does not belong to a document >diff --git a/dom/webidl/GeometryUtils.webidl b/dom/webidl/GeometryUtils.webidl >--- a/dom/webidl/GeometryUtils.webidl >+++ b/dom/webidl/GeometryUtils.webidl >@@ -20,19 +20,22 @@ dictionary ConvertCoordinateOptions { > CSSBoxType fromBox = "border"; > CSSBoxType toBox = "border"; > }; > > [NoInterfaceObject] > interface GeometryUtils { > [Throws, Pref="layout.css.getBoxQuads.enabled"] > sequence<DOMQuad> getBoxQuads(optional BoxQuadOptions options); >-// DOMQuad convertQuadFromNode(DOMQuad quad, GeometryNode from, optional ConvertCoordinateOptions options); >-// DOMQuad convertRectFromNode(DOMRectReadOnly rect, GeometryNode from, optional ConvertCoordinateOptions options); >-// DOMPoint convertPointFromNode(DOMPointInit point, GeometryNode from, optional ConvertCoordinateOptions options); >+ [Throws, Pref="layout.css.convertFromNode.enabled"] >+ DOMQuad convertQuadFromNode(DOMQuad quad, GeometryNode from, optional ConvertCoordinateOptions options); >+ [Throws, Pref="layout.css.convertFromNode.enabled"] >+ DOMQuad convertRectFromNode(DOMRectReadOnly rect, GeometryNode from, optional ConvertCoordinateOptions options); >+ [Throws, Pref="layout.css.convertFromNode.enabled"] >+ DOMPoint convertPointFromNode(DOMPointInit point, GeometryNode from, optional ConvertCoordinateOptions options); > }; > > Text implements GeometryUtils; > Element implements GeometryUtils; > // PseudoElement implements GeometryUtils; > Document implements GeometryUtils; > > typedef (Text or Element /* or PseudoElement */ or Document) GeometryNode; >\ No newline at end of file >diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp >--- a/editor/libeditor/html/nsHTMLEditRules.cpp >+++ b/editor/libeditor/html/nsHTMLEditRules.cpp >@@ -2927,17 +2927,17 @@ nsHTMLEditRules::JoinBlocks(nsIDOMNode * > * int32_t aRightOffset offset in aRightBlock to move content from > */ > nsresult > nsHTMLEditRules::MoveBlock(nsIDOMNode *aLeftBlock, nsIDOMNode *aRightBlock, int32_t aLeftOffset, int32_t aRightOffset) > { > nsCOMArray<nsIDOMNode> arrayOfNodes; > nsCOMPtr<nsISupports> isupports; > // GetNodesFromPoint is the workhorse that figures out what we wnat to move. >- nsresult res = GetNodesFromPoint(DOMPoint(aRightBlock,aRightOffset), >+ nsresult res = GetNodesFromPoint(::DOMPoint(aRightBlock,aRightOffset), > EditAction::makeList, arrayOfNodes, true); > NS_ENSURE_SUCCESS(res, res); > int32_t listCount = arrayOfNodes.Count(); > int32_t i; > for (i=0; i<listCount; i++) > { > // get the node to act on > nsIDOMNode* curNode = arrayOfNodes[i]; >@@ -6454,17 +6454,17 @@ nsHTMLEditRules::GetHighestInlineParent( > } > > > /////////////////////////////////////////////////////////////////////////// > // GetNodesFromPoint: given a particular operation, construct a list > // of nodes from a point that will be operated on. > // > nsresult >-nsHTMLEditRules::GetNodesFromPoint(DOMPoint point, >+nsHTMLEditRules::GetNodesFromPoint(::DOMPoint point, > EditAction operation, > nsCOMArray<nsIDOMNode> &arrayOfNodes, > bool dontTouchContent) > { > nsresult res; > > // get our point > nsCOMPtr<nsIDOMNode> node; >diff --git a/layout/base/tests/test_getBoxQuads_convertPointRectQuad.html b/layout/base/tests/test_getBoxQuads_convertPointRectQuad.html >--- a/layout/base/tests/test_getBoxQuads_convertPointRectQuad.html >+++ b/layout/base/tests/test_getBoxQuads_convertPointRectQuad.html >@@ -211,17 +211,18 @@ TextTextTextTextTextTextTextTextTextText > <script> > SimpleTest.waitForExplicitFinish(); > > window.scrollTo(0,0); > > function startTest() { > SpecialPowers.pushPrefEnv({"set": [["layout.css.DOMPoint.enabled", true], > ["layout.css.DOMQuad.enabled", true], >- ["layout.css.getBoxQuads.enabled", true]]}, runTest); >+ ["layout.css.getBoxQuads.enabled", true], >+ ["layout.css.convertFromNode.enabled", true]]}, runTest); > } > > function runTest() { > // Setup globals > f1d = f1.contentWindow.f1d; > text = textContainer.firstChild; > suppressedText = suppressedTextContainer.firstChild; > >diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js >--- a/modules/libpref/src/init/all.js >+++ b/modules/libpref/src/init/all.js >@@ -1801,16 +1801,23 @@ pref("layout.css.DOMQuad.enabled", true) > > // Is support for GeometryUtils.getBoxQuads enabled? > #ifdef RELEASE_BUILD > pref("layout.css.getBoxQuads.enabled", false); > #else > pref("layout.css.getBoxQuads.enabled", true); > #endif > >+// Is support for GeometryUtils.getBoxQuads enabled? >+#ifdef RELEASE_BUILD >+pref("layout.css.convertFromNode.enabled", false); >+#else >+pref("layout.css.convertFromNode.enabled", true); >+#endif >+ > // Is support for CSS "text-align: true X" enabled? > pref("layout.css.text-align-true-value.enabled", false); > > // Is support for the CSS4 image-orientation property enabled? > pref("layout.css.image-orientation.enabled", true); > > // Is support for CSS3 Fonts features enabled? > // (includes font-variant-*, font-kerning, font-synthesis
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Flags:
jst
: review+
Actions:
View
|
Diff
|
Review
Attachments on
bug 918189
:
807614
|
807615
|
807616
|
807617
|
8356417
|
8356418
|
8388511
|
8388513
| 8389634