mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 05:45:37 +00:00
Bug 917755. Part 5.5: Implement getBoxQuads DOM API. r=jst
This commit is contained in:
parent
06a94c462c
commit
05e0309b2b
@ -66,6 +66,8 @@ inline bool IsSpaceCharacter(char aChar) {
|
||||
aChar == '\f';
|
||||
}
|
||||
class Element;
|
||||
struct BoxQuadOptions;
|
||||
class DOMQuad;
|
||||
class EventHandlerNonNull;
|
||||
class OnErrorEventHandlerNonNull;
|
||||
template<typename T> class Optional;
|
||||
@ -279,6 +281,10 @@ private:
|
||||
class nsINode : public mozilla::dom::EventTarget
|
||||
{
|
||||
public:
|
||||
typedef mozilla::dom::BoxQuadOptions BoxQuadOptions;
|
||||
typedef mozilla::dom::DOMQuad DOMQuad;
|
||||
typedef mozilla::ErrorResult ErrorResult;
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_INODE_IID)
|
||||
|
||||
// Among the sub-classes that inherit (directly or indirectly) from nsINode,
|
||||
@ -1610,6 +1616,10 @@ public:
|
||||
mozilla::dom::Element* GetFirstElementChild() const;
|
||||
mozilla::dom::Element* GetLastElementChild() const;
|
||||
|
||||
void GetBoxQuads(const BoxQuadOptions& aOptions,
|
||||
nsTArray<nsRefPtr<DOMQuad> >& aResult,
|
||||
mozilla::ErrorResult& aRv);
|
||||
|
||||
protected:
|
||||
|
||||
// Override this function to create a custom slots class.
|
||||
|
@ -103,6 +103,7 @@
|
||||
#include <algorithm>
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsDOMMutationObserver.h"
|
||||
#include "GeometryUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -1140,6 +1141,14 @@ nsINode::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void
|
||||
nsINode::GetBoxQuads(const BoxQuadOptions& aOptions,
|
||||
nsTArray<nsRefPtr<DOMQuad> >& aResult,
|
||||
mozilla::ErrorResult& aRv)
|
||||
{
|
||||
mozilla::GetBoxQuads(this, aOptions, aResult, aRv);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsINode::DispatchEvent(nsIDOMEvent *aEvent, bool* aRetVal)
|
||||
{
|
||||
|
38
dom/webidl/GeometryUtils.webidl
Normal file
38
dom/webidl/GeometryUtils.webidl
Normal file
@ -0,0 +1,38 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://dev.w3.org/csswg/cssom-view/
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
enum CSSBoxType { "margin", "border", "padding", "content" };
|
||||
dictionary BoxQuadOptions {
|
||||
CSSBoxType box = "border";
|
||||
GeometryNode relativeTo;
|
||||
};
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
Text implements GeometryUtils;
|
||||
Element implements GeometryUtils;
|
||||
// PseudoElement implements GeometryUtils;
|
||||
Document implements GeometryUtils;
|
||||
|
||||
typedef (Text or Element /* or PseudoElement */ or Document) GeometryNode;
|
@ -115,6 +115,7 @@ WEBIDL_FILES = [
|
||||
'Function.webidl',
|
||||
'GainNode.webidl',
|
||||
'Geolocation.webidl',
|
||||
'GeometryUtils.webidl',
|
||||
'GetUserMediaRequest.webidl',
|
||||
'History.webidl',
|
||||
'HTMLAnchorElement.webidl',
|
||||
|
@ -1816,6 +1816,13 @@ pref("layout.css.DOMPoint.enabled", true);
|
||||
// Is support for DOMQuad enabled?
|
||||
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 CSS "text-align: true X" enabled?
|
||||
pref("layout.css.text-align-true-value.enabled", false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user