Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Backed out changeset 43b490ef9dab (bug 585877), a=beltzner

--HG--
branch : GECKO20b4_20100817_RELBRANCH
extra : transplant_source : %EEI%11%BBlU%C5QA%DFY%BA%18%14a%8B%9FZ%07%F9
  • Loading branch information...
commit 764b3ac0c5d36114e369919bc7dc2c04a019a8c8 1 parent 2d4eb81
@gavinsharp gavinsharp authored
View
46 content/html/document/src/nsHTMLDocument.cpp
@@ -2324,6 +2324,52 @@ nsHTMLDocument::GetNumFormsSynchronous()
return mNumForms;
}
+nsresult
+nsHTMLDocument::GetBodySize(PRInt32* aWidth,
+ PRInt32* aHeight)
+{
+ *aWidth = *aHeight = 0;
+
+ FlushPendingNotifications(Flush_Layout);
+
+ // Find the <body> element: this is what we'll want to use for the
+ // document's width and height values.
+ Element* body = GetBodyElement();
+ if (!body) {
+ return NS_OK;
+ }
+
+ // Now grab its frame
+ nsIFrame* frame = body->GetPrimaryFrame();
+ if (!frame)
+ return NS_OK;
+
+ nsSize size = frame->GetSize();
+
+ *aWidth = nsPresContext::AppUnitsToIntCSSPixels(size.width);
+ *aHeight = nsPresContext::AppUnitsToIntCSSPixels(size.height);
+
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsHTMLDocument::GetWidth(PRInt32* aWidth)
+{
+ NS_ENSURE_ARG_POINTER(aWidth);
+
+ PRInt32 height;
+ return GetBodySize(aWidth, &height);
+}
+
+NS_IMETHODIMP
+nsHTMLDocument::GetHeight(PRInt32* aHeight)
+{
+ NS_ENSURE_ARG_POINTER(aHeight);
+
+ PRInt32 width;
+ return GetBodySize(&width, aHeight);
+}
+
NS_IMETHODIMP
nsHTMLDocument::GetAlinkColor(nsAString& aAlinkColor)
{
View
4 dom/interfaces/html/nsIDOMNSHTMLDocument.idl
@@ -39,9 +39,11 @@
#include "domstubs.idl"
-[scriptable, uuid(386e9eee-1f06-40a6-a1a7-ed986646b793)]
+[scriptable, uuid(95cd5ad4-ae8a-4f0e-b168-35e03d5e0b9a)]
interface nsIDOMNSHTMLDocument : nsISupports
{
+ readonly attribute long width;
+ readonly attribute long height;
attribute DOMString alinkColor;
attribute DOMString linkColor;
attribute DOMString vlinkColor;
View
2  js/src/xpconnect/src/dom_quickstubs.qsconf
@@ -330,6 +330,8 @@ members = [
'nsIDOMHTMLCanvasElement.height',
'nsIDOMHTMLCanvasElement.getContext',
'nsIDOMHTMLCanvasElement.toDataURL',
+ 'nsIDOMNSHTMLDocument.width',
+ 'nsIDOMNSHTMLDocument.height',
'nsIDOMNSHTMLDocument.domain',
'nsIDOMNSHTMLDocument.getSelection',
'nsIDOMNSHTMLDocument.designMode',
Please sign in to comment.
Something went wrong with that request. Please try again.