Bug 1475305 - Remove document.width and document.height from XULDocument;r=bz

MozReview-Commit-ID: 8jWcMUYA25R

--HG--
extra : rebase_source : c23a2e647922882fc1ca3d7153ec95c5d8a2aa9d
This commit is contained in:
Brian Grinstead 2018-07-12 11:35:11 -07:00
Родитель 16e4b0c0f5
Коммит eafdeadedf
5 изменённых файлов: 5 добавлений и 54 удалений

Просмотреть файл

@ -112,8 +112,9 @@ class ToolboxTabsOrderManager {
} }
onMouseOut(e) { onMouseOut(e) {
if (e.pageX <= 0 || this.dragTarget.ownerDocument.width <= e.pageX || const documentElement = this.dragTarget.ownerDocument.documentElement;
e.pageY <= 0 || this.dragTarget.ownerDocument.height <= e.pageY) { if (e.pageX <= 0 || documentElement.clientWidth <= e.pageX ||
e.pageY <= 0 || documentElement.clientHeight <= e.pageY) {
this.onMouseUp(); this.onMouseUp();
} }
} }

Просмотреть файл

@ -26,11 +26,6 @@ interface XULDocument : Document {
readonly attribute XULCommandDispatcher? commandDispatcher; readonly attribute XULCommandDispatcher? commandDispatcher;
[Throws]
readonly attribute long width;
[Throws]
readonly attribute long height;
NodeList getElementsByAttribute(DOMString name, NodeList getElementsByAttribute(DOMString name,
[TreatNullAs=EmptyString] DOMString value); [TreatNullAs=EmptyString] DOMString value);
[Throws] [Throws]

Просмотреть файл

@ -1100,47 +1100,6 @@ XULDocument::Persist(Element* aElement, int32_t aNameSpaceID,
return mLocalStore->SetValue(uri, id, attrstr, valuestr); return mLocalStore->SetValue(uri, id, attrstr, valuestr);
} }
nsresult
XULDocument::GetViewportSize(int32_t* aWidth,
int32_t* aHeight)
{
*aWidth = *aHeight = 0;
FlushPendingNotifications(FlushType::Layout);
nsIPresShell *shell = GetShell();
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
nsIFrame* frame = shell->GetRootFrame();
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
nsSize size = frame->GetSize();
*aWidth = nsPresContext::AppUnitsToIntCSSPixels(size.width);
*aHeight = nsPresContext::AppUnitsToIntCSSPixels(size.height);
return NS_OK;
}
int32_t
XULDocument::GetWidth(ErrorResult& aRv)
{
int32_t width = 0;
int32_t height = 0;
aRv = GetViewportSize(&width, &height);
return width;
}
int32_t
XULDocument::GetHeight(ErrorResult& aRv)
{
int32_t width = 0;
int32_t height = 0;
aRv = GetViewportSize(&width, &height);
return height;
}
static JSObject* static JSObject*
GetScopeObjectOfNode(nsINode* node) GetScopeObjectOfNode(nsINode* node)
{ {

Просмотреть файл

@ -153,8 +153,6 @@ public:
{ {
return mCommandDispatcher; return mCommandDispatcher;
} }
int32_t GetWidth(ErrorResult& aRv);
int32_t GetHeight(ErrorResult& aRv);
already_AddRefed<nsINodeList> already_AddRefed<nsINodeList>
GetElementsByAttribute(const nsAString& aAttribute, GetElementsByAttribute(const nsAString& aAttribute,
const nsAString& aValue); const nsAString& aValue);
@ -181,8 +179,6 @@ protected:
nsresult Init(void) override; nsresult Init(void) override;
nsresult StartLayout(void); nsresult StartLayout(void);
nsresult GetViewportSize(int32_t* aWidth, int32_t* aHeight);
nsresult PrepareToLoad(nsISupports* aContainer, nsresult PrepareToLoad(nsISupports* aContainer,
const char* aCommand, const char* aCommand,
nsIChannel* aChannel, nsIChannel* aChannel,

Просмотреть файл

@ -52,8 +52,8 @@
// Windows resizes children to 0x0. Code in nsWindow filters these changes out. Without // Windows resizes children to 0x0. Code in nsWindow filters these changes out. Without
// this all sorts of screwy things can happen in child widgets. // this all sorts of screwy things can happen in child widgets.
ok(document.height > 0, "document height should not be zero for a minimized window!"); ok(document.documentElement.clientHeight > 0, "document height should not be zero for a minimized window!");
ok(document.width > 0, "document width should not be zero for a minimized window!"); ok(document.documentElement.clientWidth > 0, "document width should not be zero for a minimized window!");
// Make sure size mode changes are reflected in the widget. // Make sure size mode changes are reflected in the widget.
win.restore(); win.restore();