зеркало из https://github.com/mozilla/gecko-dev.git
Bug 918189. Part 1.5: Implement GeometryUtils.convertPointFromNode, convertRectFromNode, and convertQuadFromNode. r=jst
This commit is contained in:
Родитель
f89a6a8e48
Коммит
a619f60776
|
@ -65,12 +65,17 @@ inline bool IsSpaceCharacter(char aChar) {
|
|||
return aChar == ' ' || aChar == '\t' || aChar == '\n' || aChar == '\r' ||
|
||||
aChar == '\f';
|
||||
}
|
||||
class Element;
|
||||
struct BoxQuadOptions;
|
||||
struct ConvertCoordinateOptions;
|
||||
class DOMPoint;
|
||||
class DOMQuad;
|
||||
class DOMRectReadOnly;
|
||||
class Element;
|
||||
class EventHandlerNonNull;
|
||||
class OnErrorEventHandlerNonNull;
|
||||
template<typename T> class Optional;
|
||||
class TextOrElementOrDocument;
|
||||
struct DOMPointInit;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -282,7 +287,12 @@ 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)
|
||||
|
@ -1620,6 +1630,19 @@ public:
|
|||
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.
|
||||
|
|
|
@ -1149,6 +1149,33 @@ nsINode::GetBoxQuads(const BoxQuadOptions& aOptions,
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -25,9 +25,12 @@ dictionary ConvertCoordinateOptions {
|
|||
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;
|
||||
|
|
|
@ -2932,7 +2932,7 @@ nsHTMLEditRules::MoveBlock(nsIDOMNode *aLeftBlock, nsIDOMNode *aRightBlock, int3
|
|||
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();
|
||||
|
@ -6459,7 +6459,7 @@ nsHTMLEditRules::GetHighestInlineParent(nsIDOMNode* aNode)
|
|||
// 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)
|
||||
|
|
|
@ -216,7 +216,8 @@ 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() {
|
||||
|
|
|
@ -1823,6 +1823,13 @@ pref("layout.css.getBoxQuads.enabled", false);
|
|||
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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче