diff --git a/accessible/src/atk/nsMaiInterfaceComponent.cpp b/accessible/src/atk/nsMaiInterfaceComponent.cpp index 588e3441a454..863026e66e3b 100644 --- a/accessible/src/atk/nsMaiInterfaceComponent.cpp +++ b/accessible/src/atk/nsMaiInterfaceComponent.cpp @@ -45,6 +45,8 @@ #include "nsCoreUtils.h" #include "nsIDOMDocument.h" +#include "nsIDOMDocumentView.h" +#include "nsIDOMAbstractView.h" #include "nsIDOMWindowInternal.h" #include "nsIDocShellTreeItem.h" #include "nsIInterfaceRequestorUtils.h" diff --git a/accessible/src/base/nsCoreUtils.cpp b/accessible/src/base/nsCoreUtils.cpp index 081888febad0..f7d660f6c849 100644 --- a/accessible/src/base/nsCoreUtils.cpp +++ b/accessible/src/base/nsCoreUtils.cpp @@ -43,12 +43,15 @@ #include "nsAccessNode.h" #include "nsIDocument.h" +#include "nsIDOMAbstractView.h" #include "nsIDOM3Node.h" #include "nsIDOMDocument.h" +#include "nsIDOMDocumentView.h" #include "nsIDOMHTMLDocument.h" #include "nsIDOMHTMLElement.h" #include "nsIDOMNodeList.h" #include "nsIDOMRange.h" +#include "nsIDOMViewCSS.h" #include "nsIDOMWindowInternal.h" #include "nsIDOMXULElement.h" #include "nsIDocShell.h" @@ -422,12 +425,13 @@ nsCoreUtils::GetScreenCoordsForWindow(nsINode *aNode) nsCOMPtr rootTreeItem; treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem)); nsCOMPtr domDoc = do_GetInterface(rootTreeItem); - if (!domDoc) + nsCOMPtr docView(do_QueryInterface(domDoc)); + if (!docView) return coords; - nsCOMPtr window; - domDoc->GetDefaultView(getter_AddRefs(window)); - nsCOMPtr windowInter(do_QueryInterface(window)); + nsCOMPtr abstractView; + docView->GetDefaultView(getter_AddRefs(abstractView)); + nsCOMPtr windowInter(do_QueryInterface(abstractView)); if (!windowInter) return coords; @@ -593,14 +597,14 @@ nsCoreUtils::GetComputedStyleDeclaration(const nsAString& aPseudoElt, if (!document) return nsnull; - nsCOMPtr window = do_QueryInterface(document->GetWindow()); - if (!window) + nsCOMPtr viewCSS(do_QueryInterface(document->GetWindow())); + if (!viewCSS) return nsnull; - nsCOMPtr cssDecl; + nsIDOMCSSStyleDeclaration* cssDecl = nsnull; nsCOMPtr domElement(do_QueryInterface(content)); - window->GetComputedStyle(domElement, aPseudoElt, getter_AddRefs(cssDecl)); - return cssDecl.forget(); + viewCSS->GetComputedStyle(domElement, aPseudoElt, &cssDecl); + return cssDecl; } already_AddRefed diff --git a/accessible/src/html/nsHyperTextAccessible.cpp b/accessible/src/html/nsHyperTextAccessible.cpp index ae826053be8b..912641c32301 100644 --- a/accessible/src/html/nsHyperTextAccessible.cpp +++ b/accessible/src/html/nsHyperTextAccessible.cpp @@ -47,9 +47,11 @@ #include "nsIClipboard.h" #include "nsContentCID.h" +#include "nsIDOMAbstractView.h" #include "nsIDOMCharacterData.h" #include "nsIDOMDocument.h" #include "nsPIDOMWindow.h" +#include "nsIDOMDocumentView.h" #include "nsIDOMRange.h" #include "nsIDOMNSRange.h" #include "nsIDOMWindowInternal.h" diff --git a/accessible/src/msaa/nsAccessNodeWrap.cpp b/accessible/src/msaa/nsAccessNodeWrap.cpp index 9c8dc89f21f5..3129dec2d2fa 100644 --- a/accessible/src/msaa/nsAccessNodeWrap.cpp +++ b/accessible/src/msaa/nsAccessNodeWrap.cpp @@ -52,6 +52,7 @@ #include "nsIDocument.h" #include "nsIDOMNodeList.h" #include "nsIDOMNSHTMLElement.h" +#include "nsIDOMViewCSS.h" #include "nsIFrame.h" #include "nsINameSpaceManager.h" #include "nsIPrefService.h" diff --git a/browser/base/content/aboutDialog.css b/browser/base/content/aboutDialog.css index 703e54527c15..ccad14fd36cf 100644 --- a/browser/base/content/aboutDialog.css +++ b/browser/base/content/aboutDialog.css @@ -2,52 +2,12 @@ width: 620px; } -/* Official branding has Firefox logo on the left side of the window. - Nightly/aurora branding has background image applied to entire window. */ -%ifdef MOZ_OFFICIAL_BRANDING -#clientBox { - background-color: #F7F7F7; - color: #222222; -} -%else -#aboutDialogContainer { - background-image: url("chrome://branding/content/about-background.png"); - background-repeat: no-repeat; - background-color: #000; - color: #fff; -} - -.text-link { - color: #fff !important; -} -%endif - -%ifdef MOZ_OFFICIAL_BRANDING -#leftBox { - background-image: url("chrome://branding/content/about-logo.png"); - background-repeat: no-repeat; - /* min-width and min-height create room for the logo */ - min-width: 210px; - min-height: 210px; - margin-top:20px; - -moz-margin-start: 30px; -} -%endif - #rightBox { background-image: url("chrome://branding/content/about-wordmark.png"); background-repeat: no-repeat; /* padding-top creates room for the wordmark */ padding-top: 38px; margin-top:20px; -%ifdef MOZ_OFFICIAL_BRANDING - margin-left: 30px; - margin-right: 30px; -%else - /* this margin prevents text from overlapping the planet image */ - margin-left: 280px; - margin-right: 20px; -%endif } #rightBox:-moz-locale-dir(rtl) { @@ -56,9 +16,6 @@ #bottomBox { padding: 15px 10px 0; -%ifndef MOZ_OFFICIAL_BRANDING - background-color: rgba(0,0,0,.7); -%endif } #version { @@ -87,9 +44,6 @@ } #updateDeck > hbox > label:not([class="text-link"]) { -%ifdef MOZ_OFFICIAL_BRANDING - color: #909090; -%endif font-style:italic; } @@ -113,17 +67,6 @@ margin: 0 40px; } -/* we assume trademark text only appears in offical builds */ -%ifdef MOZ_OFFICIAL_BRANDING -#trademark { - font-size: xx-small; - text-align: center; - color: #999999; - margin-top: 10px; - margin-bottom: 10px; -} -%endif - #currentChannel { margin: 0; padding: 0; diff --git a/browser/base/content/aboutDialog.xul b/browser/base/content/aboutDialog.xul index 848e25e3d806..96d5d1dc4126 100644 --- a/browser/base/content/aboutDialog.xul +++ b/browser/base/content/aboutDialog.xul @@ -41,6 +41,7 @@ + diff --git a/browser/branding/aurora/content/aboutDialog.css b/browser/branding/aurora/content/aboutDialog.css new file mode 100644 index 000000000000..f74c55cbef6c --- /dev/null +++ b/browser/branding/aurora/content/aboutDialog.css @@ -0,0 +1,20 @@ +#aboutDialogContainer { + background-image: url("chrome://branding/content/about-background.png"); + background-repeat: no-repeat; + background-color: #000; + color: #fff; +} + +.text-link { + color: #fff !important; +} + +#rightBox { + /* this margin prevents text from overlapping the planet image */ + margin-left: 280px; + margin-right: 20px; +} + +#bottomBox { + background-color: rgba(0,0,0,.7); +} diff --git a/browser/branding/aurora/content/jar.mn b/browser/branding/aurora/content/jar.mn index e8d0d5b7d365..2413eb64a285 100644 --- a/browser/branding/aurora/content/jar.mn +++ b/browser/branding/aurora/content/jar.mn @@ -8,3 +8,4 @@ browser.jar: content/branding/icon64.png (icon64.png) content/branding/icon128.png (../mozicon128.png) content/branding/icon16.png (../default16.png) + content/branding/aboutDialog.css (aboutDialog.css) diff --git a/browser/branding/nightly/content/aboutDialog.css b/browser/branding/nightly/content/aboutDialog.css new file mode 100644 index 000000000000..f74c55cbef6c --- /dev/null +++ b/browser/branding/nightly/content/aboutDialog.css @@ -0,0 +1,20 @@ +#aboutDialogContainer { + background-image: url("chrome://branding/content/about-background.png"); + background-repeat: no-repeat; + background-color: #000; + color: #fff; +} + +.text-link { + color: #fff !important; +} + +#rightBox { + /* this margin prevents text from overlapping the planet image */ + margin-left: 280px; + margin-right: 20px; +} + +#bottomBox { + background-color: rgba(0,0,0,.7); +} diff --git a/browser/branding/nightly/content/jar.mn b/browser/branding/nightly/content/jar.mn index e8d0d5b7d365..2413eb64a285 100644 --- a/browser/branding/nightly/content/jar.mn +++ b/browser/branding/nightly/content/jar.mn @@ -8,3 +8,4 @@ browser.jar: content/branding/icon64.png (icon64.png) content/branding/icon128.png (../mozicon128.png) content/branding/icon16.png (../default16.png) + content/branding/aboutDialog.css (aboutDialog.css) diff --git a/browser/branding/official/content/aboutDialog.css b/browser/branding/official/content/aboutDialog.css new file mode 100644 index 000000000000..c83aec095e17 --- /dev/null +++ b/browser/branding/official/content/aboutDialog.css @@ -0,0 +1,31 @@ +#clientBox { + background-color: #F7F7F7; + color: #222222; +} + +#leftBox { + background-image: url("chrome://branding/content/about-logo.png"); + background-repeat: no-repeat; + /* min-width and min-height create room for the logo */ + min-width: 210px; + min-height: 210px; + margin-top:20px; + -moz-margin-start: 30px; +} + +#rightBox { + margin-left: 30px; + margin-right: 30px; +} + +#updateDeck > hbox > label:not([class="text-link"]) { + color: #909090; +} + +#trademark { + font-size: xx-small; + text-align: center; + color: #999999; + margin-top: 10px; + margin-bottom: 10px; +} diff --git a/browser/branding/official/content/jar.mn b/browser/branding/official/content/jar.mn index 1706a95d373f..c0629c3db2ec 100644 --- a/browser/branding/official/content/jar.mn +++ b/browser/branding/official/content/jar.mn @@ -7,3 +7,4 @@ browser.jar: content/branding/icon64.png (icon64.png) content/branding/icon128.png (../mozicon128.png) content/branding/icon16.png (../default16.png) + content/branding/aboutDialog.css (aboutDialog.css) diff --git a/browser/branding/unofficial/content/aboutDialog.css b/browser/branding/unofficial/content/aboutDialog.css new file mode 100644 index 000000000000..f74c55cbef6c --- /dev/null +++ b/browser/branding/unofficial/content/aboutDialog.css @@ -0,0 +1,20 @@ +#aboutDialogContainer { + background-image: url("chrome://branding/content/about-background.png"); + background-repeat: no-repeat; + background-color: #000; + color: #fff; +} + +.text-link { + color: #fff !important; +} + +#rightBox { + /* this margin prevents text from overlapping the planet image */ + margin-left: 280px; + margin-right: 20px; +} + +#bottomBox { + background-color: rgba(0,0,0,.7); +} diff --git a/browser/branding/unofficial/content/jar.mn b/browser/branding/unofficial/content/jar.mn index e8d0d5b7d365..2413eb64a285 100644 --- a/browser/branding/unofficial/content/jar.mn +++ b/browser/branding/unofficial/content/jar.mn @@ -8,3 +8,4 @@ browser.jar: content/branding/icon64.png (icon64.png) content/branding/icon128.png (../mozicon128.png) content/branding/icon16.png (../default16.png) + content/branding/aboutDialog.css (aboutDialog.css) diff --git a/build/os2/test_os2.cmd b/build/os2/test_os2.cmd old mode 100755 new mode 100644 diff --git a/content/base/src/nsContentAreaDragDrop.cpp b/content/base/src/nsContentAreaDragDrop.cpp index 675bbdb68d49..6d52bb5915da 100644 --- a/content/base/src/nsContentAreaDragDrop.cpp +++ b/content/base/src/nsContentAreaDragDrop.cpp @@ -54,6 +54,7 @@ #include "nsIDOMEvent.h" #include "nsIDOMNSEvent.h" #include "nsIDOMDragEvent.h" +#include "nsIDOMAbstractView.h" #include "nsPIDOMWindow.h" #include "nsIDOMDocument.h" #include "nsIDOMDocumentRange.h" diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index e6876383fa44..cae96e74ac5c 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -168,6 +168,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID); #include "nsIChromeRegistry.h" #include "nsIMIMEHeaderParam.h" #include "nsIDOMXULCommandEvent.h" +#include "nsIDOMAbstractView.h" #include "nsIDOMDragEvent.h" #include "nsDOMDataTransfer.h" #include "nsHtml5Module.h" @@ -5500,8 +5501,9 @@ nsContentUtils::DispatchXULCommand(nsIContent* aTarget, nsCOMPtr xulCommand = do_QueryInterface(event); nsCOMPtr pEvent = do_QueryInterface(xulCommand); NS_ENSURE_STATE(pEvent); + nsCOMPtr view = do_QueryInterface(doc->GetWindow()); nsresult rv = xulCommand->InitCommandEvent(NS_LITERAL_STRING("command"), - PR_TRUE, PR_TRUE, doc->GetWindow(), + PR_TRUE, PR_TRUE, view, 0, aCtrl, aAlt, aShift, aMeta, aSourceEvent); NS_ENSURE_SUCCESS(rv, rv); diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index e8a86425e8d1..5700367d00e9 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -75,6 +75,8 @@ #include "nsDOMAttribute.h" #include "nsIDOMDOMStringList.h" #include "nsIDOMDOMImplementation.h" +#include "nsIDOMDocumentView.h" +#include "nsIDOMAbstractView.h" #include "nsIDOMDocumentXBL.h" #include "mozilla/FunctionTimer.h" #include "nsGenericElement.h" @@ -5067,14 +5069,16 @@ nsDocument::CreateTreeWalker(nsIDOMNode *aRoot, NS_IMETHODIMP -nsDocument::GetDefaultView(nsIDOMWindow** aDefaultView) +nsDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView) { - *aDefaultView = nsnull; nsPIDOMWindow* win = GetWindow(); - if (!win) { - return NS_OK; + if (win) { + return CallQueryInterface(win, aDefaultView); } - return CallQueryInterface(win, aDefaultView); + + *aDefaultView = nsnull; + + return NS_OK; } NS_IMETHODIMP diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index 541c78512844..4863e417bd3f 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -52,6 +52,7 @@ #include "nsTArray.h" #include "nsHashSets.h" #include "nsIDOMXMLDocument.h" +#include "nsIDOMDocumentView.h" #include "nsIDOMDocumentXBL.h" #include "nsIDOMNSDocument.h" #include "nsIDOMNSDocumentStyle.h" @@ -497,6 +498,7 @@ class nsDocument : public nsIDocument, public nsIDOMDocumentEvent, public nsIDOM3DocumentEvent, public nsIDOMNSDocumentStyle, + public nsIDOMDocumentView, public nsIDOMDocumentRange, public nsIDOMDocumentTraversal, public nsIDOMDocumentXBL, @@ -812,6 +814,9 @@ public: // nsIDOMNSDocumentStyle NS_DECL_NSIDOMNSDOCUMENTSTYLE + // nsIDOMDocumentView + NS_DECL_NSIDOMDOCUMENTVIEW + // nsIDOMDocumentRange NS_DECL_NSIDOMDOCUMENTRANGE @@ -1258,6 +1263,7 @@ protected: NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMDocument, nsDocument) \ NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMNSDocument, nsDocument) \ NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMDocumentEvent, nsDocument) \ + NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMDocumentView, nsDocument) \ NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMDocumentTraversal, \ nsDocument) \ NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMEventTarget, nsDocument) \ diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index 2e31ff32a52b..8388ece9e828 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -92,6 +92,7 @@ #include "nsBindingManager.h" #include "nsXBLBinding.h" +#include "nsIDOMViewCSS.h" #include "nsIXBLService.h" #include "nsPIDOMWindow.h" #include "nsIBoxObject.h" diff --git a/content/events/src/nsDOMDragEvent.cpp b/content/events/src/nsDOMDragEvent.cpp index abb29ba8e28e..3622ed48cbab 100644 --- a/content/events/src/nsDOMDragEvent.cpp +++ b/content/events/src/nsDOMDragEvent.cpp @@ -80,7 +80,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent) NS_IMETHODIMP nsDOMDragEvent::InitDragEvent(const nsAString & aType, PRBool aCanBubble, PRBool aCancelable, - nsIDOMWindow* aView, PRInt32 aDetail, + nsIDOMAbstractView* aView, PRInt32 aDetail, PRInt32 aScreenX, PRInt32 aScreenY, PRInt32 aClientX, PRInt32 aClientY, PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey, @@ -132,5 +132,7 @@ nsresult NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult, nsDragEvent *aEvent) { nsDOMDragEvent* event = new nsDOMDragEvent(aPresContext, aEvent); + NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY); + return CallQueryInterface(event, aInstancePtrResult); } diff --git a/content/events/src/nsDOMKeyboardEvent.cpp b/content/events/src/nsDOMKeyboardEvent.cpp index e69a875183a8..33cc4ed450ba 100644 --- a/content/events/src/nsDOMKeyboardEvent.cpp +++ b/content/events/src/nsDOMKeyboardEvent.cpp @@ -175,7 +175,7 @@ nsDOMKeyboardEvent::GetWhich(PRUint32* aWhich) NS_IMETHODIMP nsDOMKeyboardEvent::InitKeyEvent(const nsAString& aType, PRBool aCanBubble, PRBool aCancelable, - nsIDOMWindow* aView, PRBool aCtrlKey, PRBool aAltKey, + nsIDOMAbstractView* aView, PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey, PRBool aMetaKey, PRUint32 aKeyCode, PRUint32 aCharCode) { @@ -198,5 +198,9 @@ nsresult NS_NewDOMKeyboardEvent(nsIDOMEvent** aInstancePtrResult, nsKeyEvent *aEvent) { nsDOMKeyboardEvent* it = new nsDOMKeyboardEvent(aPresContext, aEvent); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return CallQueryInterface(it, aInstancePtrResult); } diff --git a/content/events/src/nsDOMMouseEvent.cpp b/content/events/src/nsDOMMouseEvent.cpp index 322fc60b9994..dbedcde48bea 100644 --- a/content/events/src/nsDOMMouseEvent.cpp +++ b/content/events/src/nsDOMMouseEvent.cpp @@ -104,7 +104,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent) NS_IMETHODIMP nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBool aCancelable, - nsIDOMWindow* aView, PRInt32 aDetail, PRInt32 aScreenX, + nsIDOMAbstractView *aView, PRInt32 aDetail, PRInt32 aScreenX, PRInt32 aScreenY, PRInt32 aClientX, PRInt32 aClientY, PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey, PRBool aMetaKey, PRUint16 aButton, nsIDOMEventTarget *aRelatedTarget) @@ -147,7 +147,7 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBo NS_IMETHODIMP nsDOMMouseEvent::InitNSMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBool aCancelable, - nsIDOMWindow *aView, PRInt32 aDetail, PRInt32 aScreenX, + nsIDOMAbstractView *aView, PRInt32 aDetail, PRInt32 aScreenX, PRInt32 aScreenY, PRInt32 aClientX, PRInt32 aClientY, PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey, PRBool aMetaKey, PRUint16 aButton, nsIDOMEventTarget *aRelatedTarget, @@ -313,5 +313,9 @@ nsresult NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult, nsInputEvent *aEvent) { nsDOMMouseEvent* it = new nsDOMMouseEvent(aPresContext, aEvent); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return CallQueryInterface(it, aInstancePtrResult); } diff --git a/content/events/src/nsDOMMouseScrollEvent.cpp b/content/events/src/nsDOMMouseScrollEvent.cpp index ac61c741286d..34bda3a5ddea 100644 --- a/content/events/src/nsDOMMouseScrollEvent.cpp +++ b/content/events/src/nsDOMMouseScrollEvent.cpp @@ -88,7 +88,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent) NS_IMETHODIMP nsDOMMouseScrollEvent::InitMouseScrollEvent(const nsAString & aType, PRBool aCanBubble, PRBool aCancelable, - nsIDOMWindow *aView, PRInt32 aDetail, PRInt32 aScreenX, + nsIDOMAbstractView *aView, PRInt32 aDetail, PRInt32 aScreenX, PRInt32 aScreenY, PRInt32 aClientX, PRInt32 aClientY, PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey, PRBool aMetaKey, PRUint16 aButton, nsIDOMEventTarget *aRelatedTarget, @@ -129,5 +129,9 @@ nsresult NS_NewDOMMouseScrollEvent(nsIDOMEvent** aInstancePtrResult, nsInputEvent *aEvent) { nsDOMMouseScrollEvent* it = new nsDOMMouseScrollEvent(aPresContext, aEvent); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return CallQueryInterface(it, aInstancePtrResult); } diff --git a/content/events/src/nsDOMMozTouchEvent.cpp b/content/events/src/nsDOMMozTouchEvent.cpp index 0c517e9dd06e..03faf82f72f9 100644 --- a/content/events/src/nsDOMMozTouchEvent.cpp +++ b/content/events/src/nsDOMMozTouchEvent.cpp @@ -85,7 +85,7 @@ NS_IMETHODIMP nsDOMMozTouchEvent::InitMozTouchEvent(const nsAString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, - nsIDOMWindow* aViewArg, + nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg, PRInt32 aScreenX, PRInt32 aScreenY, @@ -127,5 +127,8 @@ nsresult NS_NewDOMMozTouchEvent(nsIDOMEvent** aInstancePtrResult, nsMozTouchEvent *aEvent) { nsDOMMozTouchEvent *it = new nsDOMMozTouchEvent(aPresContext, aEvent); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } return CallQueryInterface(it, aInstancePtrResult); } diff --git a/content/events/src/nsDOMScrollAreaEvent.cpp b/content/events/src/nsDOMScrollAreaEvent.cpp index 44c373b0febc..5712179653b4 100644 --- a/content/events/src/nsDOMScrollAreaEvent.cpp +++ b/content/events/src/nsDOMScrollAreaEvent.cpp @@ -101,7 +101,7 @@ NS_IMETHODIMP nsDOMScrollAreaEvent::InitScrollAreaEvent(const nsAString &aEventType, PRBool aCanBubble, PRBool aCancelable, - nsIDOMWindow *aView, + nsIDOMAbstractView *aView, PRInt32 aDetail, float aX, float aY, float aWidth, float aHeight) @@ -155,6 +155,11 @@ NS_NewDOMScrollAreaEvent(nsIDOMEvent **aInstancePtrResult, nsPresContext *aPresContext, nsScrollAreaEvent *aEvent) { - nsDOMScrollAreaEvent* it = new nsDOMScrollAreaEvent(aPresContext, aEvent); - return CallQueryInterface(it, aInstancePtrResult); + nsDOMScrollAreaEvent *ev = new nsDOMScrollAreaEvent(aPresContext, aEvent); + + if (!ev) { + return NS_ERROR_OUT_OF_MEMORY; + } + + return CallQueryInterface(ev, aInstancePtrResult); } diff --git a/content/events/src/nsDOMSimpleGestureEvent.cpp b/content/events/src/nsDOMSimpleGestureEvent.cpp index c3d3b59f1c44..61374c488fa8 100644 --- a/content/events/src/nsDOMSimpleGestureEvent.cpp +++ b/content/events/src/nsDOMSimpleGestureEvent.cpp @@ -95,7 +95,7 @@ NS_IMETHODIMP nsDOMSimpleGestureEvent::InitSimpleGestureEvent(const nsAString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, - nsIDOMWindow* aViewArg, + nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg, PRInt32 aScreenX, PRInt32 aScreenY, diff --git a/content/events/src/nsDOMUIEvent.cpp b/content/events/src/nsDOMUIEvent.cpp index c25f1cbfcb87..07bcba00a9d3 100644 --- a/content/events/src/nsDOMUIEvent.cpp +++ b/content/events/src/nsDOMUIEvent.cpp @@ -176,7 +176,7 @@ nsDOMUIEvent::GetClientPoint() } NS_IMETHODIMP -nsDOMUIEvent::GetView(nsIDOMWindow** aView) +nsDOMUIEvent::GetView(nsIDOMAbstractView** aView) { *aView = mView; NS_IF_ADDREF(*aView); @@ -191,11 +191,7 @@ nsDOMUIEvent::GetDetail(PRInt32* aDetail) } NS_IMETHODIMP -nsDOMUIEvent::InitUIEvent(const nsAString& typeArg, - PRBool canBubbleArg, - PRBool cancelableArg, - nsIDOMWindow* viewArg, - PRInt32 detailArg) +nsDOMUIEvent::InitUIEvent(const nsAString & typeArg, PRBool canBubbleArg, PRBool cancelableArg, nsIDOMAbstractView *viewArg, PRInt32 detailArg) { nsresult rv = nsDOMEvent::InitEvent(typeArg, canBubbleArg, cancelableArg); NS_ENSURE_SUCCESS(rv, rv); @@ -422,5 +418,9 @@ nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult, nsGUIEvent *aEvent) { nsDOMUIEvent* it = new nsDOMUIEvent(aPresContext, aEvent); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return CallQueryInterface(it, aInstancePtrResult); } diff --git a/content/events/src/nsDOMUIEvent.h b/content/events/src/nsDOMUIEvent.h index 22cee7ade555..a242af36f5be 100644 --- a/content/events/src/nsDOMUIEvent.h +++ b/content/events/src/nsDOMUIEvent.h @@ -36,11 +36,12 @@ * * ***** END LICENSE BLOCK ***** */ -#ifndef nsDOMUIEvent_h -#define nsDOMUIEvent_h +#ifndef nsDOMUIEvent_h__ +#define nsDOMUIEvent_h__ #include "nsIDOMUIEvent.h" #include "nsIDOMNSUIEvent.h" +#include "nsIDOMAbstractView.h" #include "nsDOMEvent.h" class nsDOMUIEvent : public nsDOMEvent, @@ -77,7 +78,7 @@ protected: nsIntPoint GetPagePoint(); protected: - nsCOMPtr mView; + nsCOMPtr mView; PRInt32 mDetail; nsIntPoint mClientPoint; // Screenpoint is mEvent->refPoint. @@ -89,4 +90,4 @@ protected: NS_FORWARD_NSIDOMUIEVENT(nsDOMUIEvent::) \ NS_FORWARD_TO_NSDOMEVENT -#endif // nsDOMUIEvent_h +#endif // nsDOMUIEvent_h__ diff --git a/content/events/src/nsDOMXULCommandEvent.cpp b/content/events/src/nsDOMXULCommandEvent.cpp index 30611e651112..1090d318f62b 100644 --- a/content/events/src/nsDOMXULCommandEvent.cpp +++ b/content/events/src/nsDOMXULCommandEvent.cpp @@ -118,7 +118,7 @@ nsDOMXULCommandEvent::GetSourceEvent(nsIDOMEvent** aSourceEvent) NS_IMETHODIMP nsDOMXULCommandEvent::InitCommandEvent(const nsAString& aType, PRBool aCanBubble, PRBool aCancelable, - nsIDOMWindow* aView, + nsIDOMAbstractView *aView, PRInt32 aDetail, PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey, PRBool aMetaKey, @@ -144,5 +144,9 @@ nsresult NS_NewDOMXULCommandEvent(nsIDOMEvent** aInstancePtrResult, nsInputEvent *aEvent) { nsDOMXULCommandEvent* it = new nsDOMXULCommandEvent(aPresContext, aEvent); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return CallQueryInterface(it, aInstancePtrResult); } diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 2f95f42e5662..b87f2f04ad39 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -118,6 +118,7 @@ #include "nsIDOMMouseScrollEvent.h" #include "nsIDOMDragEvent.h" #include "nsIDOMEventTarget.h" +#include "nsIDOMDocumentView.h" #include "nsIDOMNSUIEvent.h" #include "nsDOMDragEvent.h" #include "nsIDOMNSEditableElement.h" diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index ea90386c6a5b..b181096da0ad 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -2300,12 +2300,11 @@ nsFormControlList::GetLength(PRUint32* aLength) NS_IMETHODIMP nsFormControlList::Item(PRUint32 aIndex, nsIDOMNode** aReturn) { - nsresult rv; nsISupports* item = GetNodeAt(aIndex); if (!item) { *aReturn = nsnull; - return rv; + return NS_OK; } return CallQueryInterface(item, aReturn); diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index df3c7088a718..98e17655f5ce 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -1388,12 +1388,6 @@ nsHTMLDocument::NormalizeDocument() return nsDocument::NormalizeDocument(); } -NS_IMETHODIMP -nsHTMLDocument::GetDefaultView(nsIDOMWindow** aWindow) -{ - return nsDocument::GetDefaultView(aWindow); -} - // // nsIDOMHTMLDocument interface implementation // diff --git a/content/media/ogg/nsOggReader.cpp b/content/media/ogg/nsOggReader.cpp index 922654d7c7b2..9f5b3f1e5147 100644 --- a/content/media/ogg/nsOggReader.cpp +++ b/content/media/ogg/nsOggReader.cpp @@ -1061,7 +1061,7 @@ nsresult nsOggReader::GetSeekRanges(nsTArray& aRanges) nsresult res = mDecoder->GetCurrentStream()->GetCachedRanges(cached); NS_ENSURE_SUCCESS(res, res); - for (PRUint32 index = 0; index < aRanges.Length(); index++) { + for (PRUint32 index = 0; index < cached.Length(); index++) { nsByteRange& range = cached[index]; PRInt64 startTime = -1; PRInt64 endTime = -1; diff --git a/content/smil/nsDOMTimeEvent.cpp b/content/smil/nsDOMTimeEvent.cpp index d37dc033c37b..100a385b31c3 100644 --- a/content/smil/nsDOMTimeEvent.cpp +++ b/content/smil/nsDOMTimeEvent.cpp @@ -39,6 +39,7 @@ #include "nsGUIEvent.h" #include "nsPresContext.h" #include "nsIInterfaceRequestorUtils.h" +#include "nsIDOMAbstractView.h" nsDOMTimeEvent::nsDOMTimeEvent(nsPresContext* aPresContext, nsEvent* aEvent) : nsDOMEvent(aPresContext, aEvent ? aEvent : new nsUIEvent(PR_FALSE, 0, 0)), @@ -91,7 +92,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMTimeEvent) NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent) NS_IMETHODIMP -nsDOMTimeEvent::GetView(nsIDOMWindow** aView) +nsDOMTimeEvent::GetView(nsIDOMAbstractView** aView) { *aView = mView; NS_IF_ADDREF(*aView); @@ -107,7 +108,7 @@ nsDOMTimeEvent::GetDetail(PRInt32* aDetail) NS_IMETHODIMP nsDOMTimeEvent::InitTimeEvent(const nsAString& aTypeArg, - nsIDOMWindow* aViewArg, + nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg) { nsresult rv = nsDOMEvent::InitEvent(aTypeArg, PR_FALSE /*doesn't bubble*/, diff --git a/content/smil/nsDOMTimeEvent.h b/content/smil/nsDOMTimeEvent.h index 9ff25f5e37ca..632b8ddc19a9 100644 --- a/content/smil/nsDOMTimeEvent.h +++ b/content/smil/nsDOMTimeEvent.h @@ -58,8 +58,8 @@ public: NS_FORWARD_TO_NSDOMEVENT private: - nsCOMPtr mView; - PRInt32 mDetail; + nsCOMPtr mView; + PRInt32 mDetail; }; #endif // NS_DOMTIMEEVENT_H_ diff --git a/content/svg/content/src/nsSVGElement.cpp b/content/svg/content/src/nsSVGElement.cpp index e885ef81906c..6818d4f9a215 100644 --- a/content/svg/content/src/nsSVGElement.cpp +++ b/content/svg/content/src/nsSVGElement.cpp @@ -51,6 +51,8 @@ #include "nsStyleConsts.h" #include "nsDOMError.h" #include "nsIPresShell.h" +#include "nsIDOMViewCSS.h" +#include "nsIDOMCSSStyleDeclaration.h" #include "nsIServiceManager.h" #include "nsIXBLService.h" #include "nsGkAtoms.h" diff --git a/content/xml/document/src/nsXMLPrettyPrinter.cpp b/content/xml/document/src/nsXMLPrettyPrinter.cpp index 504db4af51db..e6b963561bc8 100644 --- a/content/xml/document/src/nsXMLPrettyPrinter.cpp +++ b/content/xml/document/src/nsXMLPrettyPrinter.cpp @@ -38,7 +38,10 @@ #include "nsXMLPrettyPrinter.h" #include "nsContentUtils.h" +#include "nsIDOMDocumentView.h" +#include "nsIDOMAbstractView.h" #include "nsIDOMCSSStyleDeclaration.h" +#include "nsIDOMViewCSS.h" #include "nsIDOMDocumentXBL.h" #include "nsIObserver.h" #include "nsIXSLTProcessor.h" @@ -92,13 +95,16 @@ nsXMLPrettyPrinter::PrettyPrint(nsIDocument* aDocument, nsCOMPtr computedStyle; nsCOMPtr frameOwnerDoc; frameElem->GetOwnerDocument(getter_AddRefs(frameOwnerDoc)); - if (frameOwnerDoc) { - nsCOMPtr window; - frameOwnerDoc->GetDefaultView(getter_AddRefs(window)); - if (window) { - window->GetComputedStyle(frameElem, - EmptyString(), - getter_AddRefs(computedStyle)); + nsCOMPtr docView = do_QueryInterface(frameOwnerDoc); + if (docView) { + nsCOMPtr defaultView; + docView->GetDefaultView(getter_AddRefs(defaultView)); + nsCOMPtr defaultCSSView = + do_QueryInterface(defaultView); + if (defaultCSSView) { + defaultCSSView->GetComputedStyle(frameElem, + EmptyString(), + getter_AddRefs(computedStyle)); } } diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 23279f0f2116..a91eab34d349 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -1,5 +1,6 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version @@ -118,6 +119,7 @@ #include "nsXULDocument.h" #include "nsXULPopupListener.h" #include "nsRuleWalker.h" +#include "nsIDOMViewCSS.h" #include "nsIDOMCSSStyleDeclaration.h" #include "nsCSSParser.h" #include "nsIListBoxObject.h" diff --git a/dom/Makefile.in b/dom/Makefile.in index e2d79ad032ab..cb57d182cb44 100644 --- a/dom/Makefile.in +++ b/dom/Makefile.in @@ -50,6 +50,7 @@ DIRS = \ interfaces/html \ interfaces/events \ interfaces/stylesheets \ + interfaces/views \ interfaces/sidebar \ interfaces/css \ interfaces/traversal \ diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index d8a32e3c172c..6cd2e5f57a1c 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -192,6 +192,7 @@ #include "nsBindingManager.h" #include "nsIFrame.h" #include "nsIPresShell.h" +#include "nsIDOMViewCSS.h" #include "nsIDOMElement.h" #include "nsIDOMCSSStyleDeclaration.h" #include "nsStyleSet.h" @@ -252,6 +253,7 @@ #include "nsIDOMDocumentRange.h" #include "nsIDOMDocumentTraversal.h" #include "nsIDOMDocumentXBL.h" +#include "nsIDOMDocumentView.h" #include "nsIDOMElementCSSInlineStyle.h" #include "nsIDOMLinkStyle.h" #include "nsIDOMHTMLDocument.h" @@ -2271,6 +2273,7 @@ nsDOMClassInfo::RegisterExternalClasses() DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentStyle) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocumentStyle) \ + DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentView) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentRange) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentTraversal) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL) \ @@ -2347,6 +2350,8 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB) DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH) @@ -2358,6 +2363,8 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH) DOM_CLASSINFO_MAP_END @@ -3064,6 +3071,8 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(RangeException, nsIDOMRangeException) @@ -3946,6 +3955,8 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB) DOM_CLASSINFO_MAP_ENTRY(nsIDOMModalContentWindow) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 6c0547a84185..c16f4f62471b 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -111,6 +111,7 @@ #endif #include "nsIDOMDocument.h" #include "nsIDOMNSDocument.h" +#include "nsIDOMDocumentView.h" #include "nsIDOMElement.h" #include "nsIDOMDocumentEvent.h" #include "nsIDOMEvent.h" @@ -1333,6 +1334,8 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindow) NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget) NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget) NS_INTERFACE_MAP_ENTRY(nsPIDOMWindow) + NS_INTERFACE_MAP_ENTRY(nsIDOMViewCSS) + NS_INTERFACE_MAP_ENTRY(nsIDOMAbstractView) NS_INTERFACE_MAP_ENTRY(nsIDOMStorageWindow) NS_INTERFACE_MAP_ENTRY(nsIDOMStorageIndexedDB) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) @@ -7936,6 +7939,10 @@ nsGlobalWindow::UpdateCanvasFocus(PRBool aFocusChanged, nsIContent* aNewContent) } } +//***************************************************************************** +// nsGlobalWindow::nsIDOMViewCSS +//***************************************************************************** + NS_IMETHODIMP nsGlobalWindow::GetComputedStyle(nsIDOMElement* aElt, const nsAString& aPseudoElt, @@ -7972,6 +7979,27 @@ nsGlobalWindow::GetComputedStyle(nsIDOMElement* aElt, return NS_OK; } +//***************************************************************************** +// nsGlobalWindow::nsIDOMAbstractView +//***************************************************************************** + +NS_IMETHODIMP +nsGlobalWindow::GetDocument(nsIDOMDocumentView ** aDocumentView) +{ + NS_ENSURE_ARG_POINTER(aDocumentView); + + nsresult rv = NS_OK; + + if (mDocument) { + rv = CallQueryInterface(mDocument, aDocumentView); + } + else { + *aDocumentView = nsnull; + } + + return rv; +} + //***************************************************************************** // nsGlobalWindow::nsIDOMStorageWindow //***************************************************************************** diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 4c533df74503..dac3c390d91a 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -62,6 +62,7 @@ #include "nsIDocShellTreeOwner.h" #include "nsIDocShellTreeItem.h" #include "nsIDOMClientInformation.h" +#include "nsIDOMViewCSS.h" #include "nsIDOMEventTarget.h" #include "nsIDOM3EventTarget.h" #include "nsIDOMNSEventTarget.h" @@ -279,6 +280,7 @@ class nsGlobalWindow : public nsPIDOMWindow, public nsPIDOMEventTarget, public nsIDOM3EventTarget, public nsIDOMNSEventTarget, + public nsIDOMViewCSS, public nsIDOMStorageWindow, public nsIDOMStorageIndexedDB, public nsSupportsWeakReference, @@ -417,6 +419,12 @@ public: virtual NS_HIDDEN_(void) MaybeUpdateTouchState(); virtual NS_HIDDEN_(void) UpdateTouchState(); + // nsIDOMViewCSS + NS_DECL_NSIDOMVIEWCSS + + // nsIDOMAbstractView + NS_DECL_NSIDOMABSTRACTVIEW + // nsIDOMStorageWindow NS_DECL_NSIDOMSTORAGEWINDOW diff --git a/dom/interfaces/base/domstubs.idl b/dom/interfaces/base/domstubs.idl index 1a4496dddad8..3dd14bb44d75 100644 --- a/dom/interfaces/base/domstubs.idl +++ b/dom/interfaces/base/domstubs.idl @@ -77,6 +77,10 @@ interface nsIDOMLinkStyle; interface nsIDOMStyleSheet; interface nsIDOMMediaList; +// Views +interface nsIDOMAbstractView; +interface nsIDOMDocumentView; + // Base interface nsIDOMWindow; interface nsIDOMWindowInternal; @@ -126,3 +130,4 @@ interface nsIDOMRange; interface nsIDOMCRMFObject; interface nsIDOMCrypto; interface nsIDOMPkcs11; + diff --git a/dom/interfaces/base/nsIDOMWindow.idl b/dom/interfaces/base/nsIDOMWindow.idl index ec0414e05708..fdc98011b44c 100644 --- a/dom/interfaces/base/nsIDOMWindow.idl +++ b/dom/interfaces/base/nsIDOMWindow.idl @@ -47,10 +47,11 @@ interface nsISelection; * contain child windows if the document in the window contains a * HTML frameset document or if the document contains iframe elements. * - * @see + * This interface is not officially defined by any standard bodies, it + * originates from the defacto DOM Level 0 standard. */ -[scriptable, uuid(ff7d278f-93db-4078-b89a-058c8e1270b4)] +[scriptable, uuid(a6cf906b-15b3-11d2-932e-00805f8add32)] interface nsIDOMWindow : nsISupports { /** @@ -149,10 +150,4 @@ interface nsIDOMWindow : nsISupports * Method for sizing this window to the content in the window. */ void sizeToContent(); - - /** - * @see - */ - nsIDOMCSSStyleDeclaration getComputedStyle(in nsIDOMElement elt, - [optional] in DOMString pseudoElt); }; diff --git a/dom/interfaces/base/nsIDOMWindow2.idl b/dom/interfaces/base/nsIDOMWindow2.idl index a69d0ae88162..510e3178f081 100644 --- a/dom/interfaces/base/nsIDOMWindow2.idl +++ b/dom/interfaces/base/nsIDOMWindow2.idl @@ -40,7 +40,7 @@ interface nsIDOMOfflineResourceList; interface nsIDOMBlob; -[scriptable, uuid(e2796e00-14de-4ce0-acfe-0374bc0e715d)] +[scriptable, uuid(efff0d88-3b94-4375-bdeb-676a847ecd7d)] interface nsIDOMWindow2 : nsIDOMWindow { /** diff --git a/dom/interfaces/base/nsIDOMWindowInternal.idl b/dom/interfaces/base/nsIDOMWindowInternal.idl index 27e2d3167aba..114b39d40926 100644 --- a/dom/interfaces/base/nsIDOMWindowInternal.idl +++ b/dom/interfaces/base/nsIDOMWindowInternal.idl @@ -46,7 +46,7 @@ interface nsIVariant; interface nsIAnimationFrameListener; interface nsIDOMMediaQueryList; -[scriptable, uuid(4d95736f-8130-43cb-a276-5bc554eca80a)] +[scriptable, uuid(04eafa93-efbe-4254-9d65-91c344fa7ff2)] interface nsIDOMWindowInternal : nsIDOMWindow2 { readonly attribute nsIDOMWindowInternal window; diff --git a/dom/interfaces/core/nsIDOMDocument.idl b/dom/interfaces/core/nsIDOMDocument.idl index 68956bbe4d18..e9587254012b 100644 --- a/dom/interfaces/core/nsIDOMDocument.idl +++ b/dom/interfaces/core/nsIDOMDocument.idl @@ -52,7 +52,7 @@ * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html */ -[scriptable, uuid(d12f0ecf-434a-4b5c-81ad-354e3b9037b9)] +[scriptable, uuid(2d305b95-a030-4d24-a12c-7fabf61a8c3c)] interface nsIDOMDocument : nsIDOMNode { readonly attribute nsIDOMDocumentType doctype; @@ -108,11 +108,4 @@ interface nsIDOMDocument : nsIDOMNode raises(DOMException); // Introduced in DOM Level 3: void normalizeDocument(); - - /** - * The window associated with this document. - * - * @see http://www.whatwg.org/html/#dom-document-defaultview - */ - readonly attribute nsIDOMWindow defaultView; }; diff --git a/dom/interfaces/core/nsIDOMXMLDocument.idl b/dom/interfaces/core/nsIDOMXMLDocument.idl index 3069153065ac..224ba547c50e 100644 --- a/dom/interfaces/core/nsIDOMXMLDocument.idl +++ b/dom/interfaces/core/nsIDOMXMLDocument.idl @@ -38,7 +38,7 @@ #include "nsIDOMDocument.idl" -[scriptable, uuid(68e4448c-eb64-48ea-801a-0c83008d2607)] +[scriptable, uuid(f493687c-ea80-471b-965b-11467ebea24b)] interface nsIDOMXMLDocument : nsIDOMDocument { // DOM Level 3 Load & Save, DocumentLS diff --git a/dom/interfaces/css/Makefile.in b/dom/interfaces/css/Makefile.in index b432a249adbf..a0b4c64838c8 100644 --- a/dom/interfaces/css/Makefile.in +++ b/dom/interfaces/css/Makefile.in @@ -71,6 +71,7 @@ XPIDLSRCS = \ nsIDOMDocumentCSS.idl \ nsIDOMRGBColor.idl \ nsIDOMRect.idl \ + nsIDOMViewCSS.idl \ nsIDOMNSRGBAColor.idl \ $(NULL) diff --git a/dom/interfaces/css/nsIDOMViewCSS.idl b/dom/interfaces/css/nsIDOMViewCSS.idl new file mode 100644 index 000000000000..2eb66fc9e9f9 --- /dev/null +++ b/dom/interfaces/css/nsIDOMViewCSS.idl @@ -0,0 +1,49 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Johnny Stenback (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIDOMAbstractView.idl" + +[scriptable, uuid(0b9341f3-95d4-4fa4-adcd-e119e0db2889)] +interface nsIDOMViewCSS : nsIDOMAbstractView +{ + /** + * @see + */ + nsIDOMCSSStyleDeclaration getComputedStyle(in nsIDOMElement elt, + [optional] in DOMString pseudoElt); +}; diff --git a/dom/interfaces/events/nsIDOMDragEvent.idl b/dom/interfaces/events/nsIDOMDragEvent.idl index 13e25628e296..a443f7d5e3ec 100644 --- a/dom/interfaces/events/nsIDOMDragEvent.idl +++ b/dom/interfaces/events/nsIDOMDragEvent.idl @@ -38,9 +38,10 @@ #include "domstubs.idl" #include "nsIDOMMouseEvent.idl" +interface nsIDOMAbstractView; interface nsIDOMDataTransfer; -[scriptable, uuid(0f4fef03-c0e9-406c-a754-c01148e431ae)] +[scriptable, uuid(98351627-62d7-4b07-bbf3-78009b20764b)] interface nsIDOMDragEvent : nsIDOMMouseEvent { readonly attribute nsIDOMDataTransfer dataTransfer; @@ -48,7 +49,7 @@ interface nsIDOMDragEvent : nsIDOMMouseEvent void initDragEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, - in nsIDOMWindow aView, + in nsIDOMAbstractView aView, in long aDetail, in long aScreenX, in long aScreenY, diff --git a/dom/interfaces/events/nsIDOMKeyEvent.idl b/dom/interfaces/events/nsIDOMKeyEvent.idl index 18e770dd603c..c0ed1dfc59aa 100644 --- a/dom/interfaces/events/nsIDOMKeyEvent.idl +++ b/dom/interfaces/events/nsIDOMKeyEvent.idl @@ -39,7 +39,7 @@ #include "nsIDOMUIEvent.idl" -[scriptable, uuid(e44d7977-20f2-442e-bc13-0f2f52992a4c)] +[scriptable, uuid(028e0e6e-8b01-11d3-aae7-0010838a3123)] interface nsIDOMKeyEvent : nsIDOMUIEvent { const unsigned long DOM_VK_CANCEL = 0x03; @@ -193,7 +193,7 @@ interface nsIDOMKeyEvent : nsIDOMUIEvent void initKeyEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, - in nsIDOMWindow viewArg, + in nsIDOMAbstractView viewArg, in boolean ctrlKeyArg, in boolean altKeyArg, in boolean shiftKeyArg, diff --git a/dom/interfaces/events/nsIDOMMouseEvent.idl b/dom/interfaces/events/nsIDOMMouseEvent.idl index 7f0d763b9edb..f21e93d8b614 100644 --- a/dom/interfaces/events/nsIDOMMouseEvent.idl +++ b/dom/interfaces/events/nsIDOMMouseEvent.idl @@ -47,7 +47,7 @@ * http://www.w3.org/TR/DOM-Level-2-Events/ */ -[scriptable, uuid(73558605-f479-493e-86d1-9794cd117fef)] +[scriptable, uuid(ff751edc-8b02-aae7-0010-8301838a3123)] interface nsIDOMMouseEvent : nsIDOMUIEvent { readonly attribute long screenX; @@ -67,7 +67,7 @@ interface nsIDOMMouseEvent : nsIDOMUIEvent void initMouseEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, - in nsIDOMWindow viewArg, + in nsIDOMAbstractView viewArg, in long detailArg, in long screenXArg, in long screenYArg, diff --git a/dom/interfaces/events/nsIDOMMouseScrollEvent.idl b/dom/interfaces/events/nsIDOMMouseScrollEvent.idl index fafce7cb327f..269061fab605 100644 --- a/dom/interfaces/events/nsIDOMMouseScrollEvent.idl +++ b/dom/interfaces/events/nsIDOMMouseScrollEvent.idl @@ -38,7 +38,7 @@ #include "nsIDOMMouseEvent.idl" -[scriptable, uuid(af08bce0-6821-4bac-8964-0fcee4be549a)] +[scriptable, uuid(ba8d1a7e-b475-4542-8d32-01e7ea7b8091)] interface nsIDOMMouseScrollEvent : nsIDOMMouseEvent { const long HORIZONTAL_AXIS = 1; @@ -49,7 +49,7 @@ interface nsIDOMMouseScrollEvent : nsIDOMMouseEvent void initMouseScrollEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, - in nsIDOMWindow viewArg, + in nsIDOMAbstractView viewArg, in long detailArg, in long screenXArg, in long screenYArg, diff --git a/dom/interfaces/events/nsIDOMMozTouchEvent.idl b/dom/interfaces/events/nsIDOMMozTouchEvent.idl index d9f73c5bc8e8..b9439dfa06fc 100644 --- a/dom/interfaces/events/nsIDOMMozTouchEvent.idl +++ b/dom/interfaces/events/nsIDOMMozTouchEvent.idl @@ -40,7 +40,7 @@ #include "nsIDOMMouseEvent.idl" -[scriptable, uuid(e9ed248b-1995-482f-8407-33ae7744bb9c)] +[scriptable, uuid(9b454391-0190-4313-a070-1e26e9bf6f31)] interface nsIDOMMozTouchEvent : nsIDOMMouseEvent { readonly attribute unsigned long streamId; @@ -48,7 +48,7 @@ interface nsIDOMMozTouchEvent : nsIDOMMouseEvent void initMozTouchEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, - in nsIDOMWindow viewArg, + in nsIDOMAbstractView viewArg, in long detailArg, in long screenXArg, in long screenYArg, diff --git a/dom/interfaces/events/nsIDOMNSMouseEvent.idl b/dom/interfaces/events/nsIDOMNSMouseEvent.idl index abf10c770905..a9b54780d177 100644 --- a/dom/interfaces/events/nsIDOMNSMouseEvent.idl +++ b/dom/interfaces/events/nsIDOMNSMouseEvent.idl @@ -43,7 +43,7 @@ * by providing various information related to the mouse event. */ -[scriptable, uuid(8418a402-3c9b-431a-80a7-a59b23ed57a0)] +[scriptable, uuid(f5dd5fbb-f4ff-4277-819c-f31aa1dafc32)] interface nsIDOMNSMouseEvent : nsIDOMMouseEvent { // Finger or touch pressure event value @@ -63,7 +63,7 @@ interface nsIDOMNSMouseEvent : nsIDOMMouseEvent void initNSMouseEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, - in nsIDOMWindow viewArg, + in nsIDOMAbstractView viewArg, in long detailArg, in long screenXArg, in long screenYArg, diff --git a/dom/interfaces/events/nsIDOMScrollAreaEvent.idl b/dom/interfaces/events/nsIDOMScrollAreaEvent.idl index b4ad5b9fd174..0cbc870b8425 100644 --- a/dom/interfaces/events/nsIDOMScrollAreaEvent.idl +++ b/dom/interfaces/events/nsIDOMScrollAreaEvent.idl @@ -37,7 +37,7 @@ #include "nsIDOMUIEvent.idl" -[scriptable, uuid(911c3352-6690-421c-9bbe-6bd34f1600dc)] +[scriptable, uuid(b2f49035-4a2f-4e62-8fb0-deb68b0de4d9)] interface nsIDOMScrollAreaEvent : nsIDOMUIEvent { // Scroll area client rect @@ -49,7 +49,7 @@ interface nsIDOMScrollAreaEvent : nsIDOMUIEvent void initScrollAreaEvent(in DOMString aEventType, in boolean aCanBubble, in boolean aCancelable, - in nsIDOMWindow aView, + in nsIDOMAbstractView aView, in long aDetail, in float x, in float y, diff --git a/dom/interfaces/events/nsIDOMSimpleGestureEvent.idl b/dom/interfaces/events/nsIDOMSimpleGestureEvent.idl index 625acd43b056..91d1ac23d461 100644 --- a/dom/interfaces/events/nsIDOMSimpleGestureEvent.idl +++ b/dom/interfaces/events/nsIDOMSimpleGestureEvent.idl @@ -97,7 +97,7 @@ * consuming events. */ -[scriptable, uuid(fe6b7df3-be7c-4a0b-99a2-da84e956e2f5)] +[scriptable, uuid(cb68e879-f710-415d-a871-9a550860df01)] interface nsIDOMSimpleGestureEvent : nsIDOMMouseEvent { /* Swipe direction constants */ @@ -148,7 +148,7 @@ interface nsIDOMSimpleGestureEvent : nsIDOMMouseEvent void initSimpleGestureEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, - in nsIDOMWindow viewArg, + in nsIDOMAbstractView viewArg, in long detailArg, in long screenXArg, in long screenYArg, diff --git a/dom/interfaces/events/nsIDOMUIEvent.idl b/dom/interfaces/events/nsIDOMUIEvent.idl index 155858d1964c..cbd86bfe10dd 100644 --- a/dom/interfaces/events/nsIDOMUIEvent.idl +++ b/dom/interfaces/events/nsIDOMUIEvent.idl @@ -47,14 +47,14 @@ * http://www.w3.org/TR/DOM-Level-2-Events/ */ -[scriptable, uuid(25f28689-3f78-47e8-8d76-15b936faf8c1)] +[scriptable, uuid(a6cf90c3-15b3-11d2-932e-00805f8add32)] interface nsIDOMUIEvent : nsIDOMEvent { - readonly attribute nsIDOMWindow view; + readonly attribute nsIDOMAbstractView view; readonly attribute long detail; void initUIEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, - in nsIDOMWindow viewArg, + in nsIDOMAbstractView viewArg, in long detailArg); }; diff --git a/dom/interfaces/html/nsIDOMHTMLDocument.idl b/dom/interfaces/html/nsIDOMHTMLDocument.idl index bc957bec92d6..53972ff95ae9 100644 --- a/dom/interfaces/html/nsIDOMHTMLDocument.idl +++ b/dom/interfaces/html/nsIDOMHTMLDocument.idl @@ -50,7 +50,7 @@ * http://www.whatwg.org/specs/web-apps/current-work/ */ -[scriptable, uuid(42bb545e-be46-4f4f-8c0a-6c948ea0c1d4)] +[scriptable, uuid(2d7a0f2e-6b1c-4e93-bbea-122eb0a8a513)] interface nsIDOMHTMLDocument : nsIDOMDocument { attribute DOMString title; diff --git a/dom/interfaces/smil/nsIDOMTimeEvent.idl b/dom/interfaces/smil/nsIDOMTimeEvent.idl index 086b7aebe23f..af1e5bc5ea09 100644 --- a/dom/interfaces/smil/nsIDOMTimeEvent.idl +++ b/dom/interfaces/smil/nsIDOMTimeEvent.idl @@ -45,13 +45,13 @@ * http://www.w3.org/TR/SVG/animate.html#InterfaceTimeEvent */ -[scriptable, uuid(873785cc-d8be-48af-8b30-5c566e3f4e6e)] +[scriptable, uuid(0d309c26-ddbb-44cb-9af1-3008972349e3)] interface nsIDOMTimeEvent : nsIDOMEvent { readonly attribute long detail; - readonly attribute nsIDOMWindow view; + readonly attribute nsIDOMAbstractView view; void initTimeEvent(in DOMString typeArg, - in nsIDOMWindow viewArg, + in nsIDOMAbstractView viewArg, in long detailArg); }; diff --git a/dom/interfaces/svg/nsIDOMSVGDocument.idl b/dom/interfaces/svg/nsIDOMSVGDocument.idl index 78faa0f9b0db..89aff8b4048f 100644 --- a/dom/interfaces/svg/nsIDOMSVGDocument.idl +++ b/dom/interfaces/svg/nsIDOMSVGDocument.idl @@ -39,7 +39,7 @@ interface nsIDOMSVGSVGElement; -[scriptable, uuid(907f1ada-5ace-4789-8c25-0c79f251044d)] +[scriptable, uuid(dcac0765-b258-4e0b-9862-6470eb9876ba)] interface nsIDOMSVGDocument : nsIDOMDocument /* , nsIDOMDocumentEvent */ { diff --git a/dom/interfaces/svg/nsIDOMSVGZoomEvent.idl b/dom/interfaces/svg/nsIDOMSVGZoomEvent.idl index 839845422287..edf22923df90 100644 --- a/dom/interfaces/svg/nsIDOMSVGZoomEvent.idl +++ b/dom/interfaces/svg/nsIDOMSVGZoomEvent.idl @@ -45,7 +45,7 @@ interface nsIDOMSVGRect; interface nsIDOMSVGPoint; -[scriptable, uuid(7298880d-127d-470d-a8ac-e5a8e5969270)] +[scriptable, uuid(339a8c7a-552e-4cbc-8d96-8370a3939358)] interface nsIDOMSVGZoomEvent : nsIDOMUIEvent { readonly attribute nsIDOMSVGRect zoomRectScreen; diff --git a/dom/interfaces/views/Makefile.in b/dom/interfaces/views/Makefile.in new file mode 100644 index 000000000000..6137d4a5c4fc --- /dev/null +++ b/dom/interfaces/views/Makefile.in @@ -0,0 +1,54 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = dom +XPIDL_MODULE = dom_views +GRE_MODULE = 1 + +SDK_XPIDLSRCS = \ + nsIDOMDocumentView.idl \ + nsIDOMAbstractView.idl \ + $(NULL) + +include $(topsrcdir)/config/rules.mk diff --git a/dom/interfaces/views/nsIDOMAbstractView.idl b/dom/interfaces/views/nsIDOMAbstractView.idl new file mode 100644 index 000000000000..eedc3e05384d --- /dev/null +++ b/dom/interfaces/views/nsIDOMAbstractView.idl @@ -0,0 +1,53 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Johnny Stenback (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "domstubs.idl" + +/** + * The nsIDOMAbstractView interface is a datatype for a view in the + * Document Object Model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Views + */ + +[scriptable, uuid(F51EBADE-8B1A-11D3-AAE7-0010830123B4)] +interface nsIDOMAbstractView : nsISupports +{ + readonly attribute nsIDOMDocumentView document; +}; diff --git a/dom/interfaces/views/nsIDOMDocumentView.idl b/dom/interfaces/views/nsIDOMDocumentView.idl new file mode 100644 index 000000000000..a78ef779be65 --- /dev/null +++ b/dom/interfaces/views/nsIDOMDocumentView.idl @@ -0,0 +1,54 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Johnny Stenback (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "domstubs.idl" + +/** + * The nsIDOMDocumentView interface is a datatype for a document that + * supports views in the Document Object Model. + * + * For more information on this interface please see + * http://www.w3.org/TR/DOM-Level-2-Views + */ + +[scriptable, uuid(1ACDB2BA-1DD2-11B2-95BC-9542495D2569)] +interface nsIDOMDocumentView : nsISupports +{ + readonly attribute nsIDOMAbstractView defaultView; +}; + diff --git a/dom/interfaces/xul/nsIDOMXULCommandEvent.idl b/dom/interfaces/xul/nsIDOMXULCommandEvent.idl index 803857f05fb3..0f8263a3344a 100644 --- a/dom/interfaces/xul/nsIDOMXULCommandEvent.idl +++ b/dom/interfaces/xul/nsIDOMXULCommandEvent.idl @@ -43,7 +43,7 @@ #include "nsIDOMUIEvent.idl" -[scriptable, uuid(1d78da1e-2177-4b8f-9b11-41e78d1e60f7)] +[scriptable, uuid(f9fa8205-a988-4828-9228-f3332d5475ac)] interface nsIDOMXULCommandEvent : nsIDOMUIEvent { /** @@ -68,7 +68,7 @@ interface nsIDOMXULCommandEvent : nsIDOMUIEvent void initCommandEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, - in nsIDOMWindow viewArg, + in nsIDOMAbstractView viewArg, in long detailArg, in boolean ctrlKeyArg, in boolean altKeyArg, diff --git a/editor/libeditor/html/nsHTMLAbsPosition.cpp b/editor/libeditor/html/nsHTMLAbsPosition.cpp index 5c685dc5cc11..c3b72590d251 100644 --- a/editor/libeditor/html/nsHTMLAbsPosition.cpp +++ b/editor/libeditor/html/nsHTMLAbsPosition.cpp @@ -690,14 +690,13 @@ nsHTMLEditor::CheckPositionedElementBGandFG(nsIDOMElement * aElement, bgColorStr); NS_ENSURE_SUCCESS(res, res); if (bgColorStr.EqualsLiteral("transparent")) { - nsCOMPtr window; - res = mHTMLCSSUtils->GetDefaultViewCSS(aElement, getter_AddRefs(window)); - NS_ENSURE_SUCCESS(res, res); + nsCOMPtr viewCSS; + res = mHTMLCSSUtils->GetDefaultViewCSS(aElement, getter_AddRefs(viewCSS)); + NS_ENSURE_SUCCESS(res, res); nsCOMPtr cssDecl; - res = window->GetComputedStyle(aElement, EmptyString(), getter_AddRefs(cssDecl)); + res = viewCSS->GetComputedStyle(aElement, EmptyString(), getter_AddRefs(cssDecl)); NS_ENSURE_SUCCESS(res, res); - // from these declarations, get the one we want and that one only nsCOMPtr colorCssValue; res = cssDecl->GetPropertyCSSValue(NS_LITERAL_STRING("color"), getter_AddRefs(colorCssValue)); diff --git a/editor/libeditor/html/nsHTMLAnonymousUtils.cpp b/editor/libeditor/html/nsHTMLAnonymousUtils.cpp index b7aea69a67d4..79a0f6924281 100644 --- a/editor/libeditor/html/nsHTMLAnonymousUtils.cpp +++ b/editor/libeditor/html/nsHTMLAnonymousUtils.cpp @@ -430,13 +430,13 @@ nsHTMLEditor::GetPositionAndDimensions(nsIDOMElement * aElement, // Yes, it is absolutely positioned mResizedObjectIsAbsolutelyPositioned = PR_TRUE; - nsCOMPtr window; - res = mHTMLCSSUtils->GetDefaultViewCSS(aElement, getter_AddRefs(window)); - NS_ENSURE_TRUE(window, NS_ERROR_FAILURE); + nsCOMPtr viewCSS; + res = mHTMLCSSUtils->GetDefaultViewCSS(aElement, getter_AddRefs(viewCSS)); + NS_ENSURE_TRUE(viewCSS, NS_ERROR_FAILURE); nsCOMPtr cssDecl; // Get the all the computed css styles attached to the element node - res = window->GetComputedStyle(aElement, EmptyString(), getter_AddRefs(cssDecl)); + res = viewCSS->GetComputedStyle(aElement, EmptyString(), getter_AddRefs(cssDecl)); NS_ENSURE_SUCCESS(res, res); aBorderLeft = GetCSSFloatValue(cssDecl, NS_LITERAL_STRING("border-left-width")); diff --git a/editor/libeditor/html/nsHTMLCSSUtils.cpp b/editor/libeditor/html/nsHTMLCSSUtils.cpp index 19e46b5e3a32..884a00d46909 100644 --- a/editor/libeditor/html/nsHTMLCSSUtils.cpp +++ b/editor/libeditor/html/nsHTMLCSSUtils.cpp @@ -47,6 +47,7 @@ #include "nsIDOMElement.h" #include "nsIDOMElementCSSInlineStyle.h" #include "nsIDOMDocument.h" +#include "nsIDOMDocumentView.h" #include "nsIContent.h" #include "nsIAtom.h" #include "nsTextEditUtils.h" @@ -537,36 +538,35 @@ nsresult nsHTMLCSSUtils::GetComputedProperty(nsIDOMNode *aNode, nsIAtom *aProperty, nsAString & aValue) { - nsCOMPtr window; - nsresult res = GetDefaultViewCSS(aNode, getter_AddRefs(window)); + nsCOMPtr viewCSS = nsnull; + nsresult res = GetDefaultViewCSS(aNode, getter_AddRefs(viewCSS)); NS_ENSURE_SUCCESS(res, res); - return GetCSSInlinePropertyBase(aNode, aProperty, aValue, window, COMPUTED_STYLE_TYPE); + return GetCSSInlinePropertyBase(aNode, aProperty, aValue, viewCSS, COMPUTED_STYLE_TYPE); } nsresult nsHTMLCSSUtils::GetCSSInlinePropertyBase(nsIDOMNode *aNode, nsIAtom *aProperty, - nsAString& aValue, - nsIDOMWindow* aWindow, - PRUint8 aStyleType) + nsAString &aValue, + nsIDOMViewCSS *aViewCSS, + PRUint8 aStyleType) { aValue.Truncate(); NS_ENSURE_TRUE(aProperty, NS_ERROR_NULL_POINTER); - nsCOMPtr element; + nsCOMPtrelement; nsresult res = GetElementContainerOrSelf(aNode, getter_AddRefs(element)); NS_ENSURE_SUCCESS(res, res); switch (aStyleType) { case COMPUTED_STYLE_TYPE: - if (element && aWindow) { + if (element && aViewCSS) { nsAutoString value, propString; nsCOMPtr cssDecl; aProperty->ToString(propString); // Get the all the computed css styles attached to the element node - res = aWindow->GetComputedStyle(element, EmptyString(), getter_AddRefs(cssDecl)); - if (NS_FAILED(res) || !cssDecl) - return res; + res = aViewCSS->GetComputedStyle(element, EmptyString(), getter_AddRefs(cssDecl)); + if (NS_FAILED(res) || !cssDecl) return res; // from these declarations, get the one we want and that one only res = cssDecl->GetPropertyValue(propString, value); NS_ENSURE_SUCCESS(res, res); @@ -591,28 +591,33 @@ nsHTMLCSSUtils::GetCSSInlinePropertyBase(nsIDOMNode *aNode, nsIAtom *aProperty, } nsresult -nsHTMLCSSUtils::GetDefaultViewCSS(nsIDOMNode *aNode, nsIDOMWindow **aViewCSS) +nsHTMLCSSUtils::GetDefaultViewCSS(nsIDOMNode *aNode, nsIDOMViewCSS **aViewCSS) { - *aViewCSS = nsnull; - nsCOMPtr element; + nsCOMPtrelement; nsresult res = GetElementContainerOrSelf(aNode, getter_AddRefs(element)); NS_ENSURE_SUCCESS(res, res); - if (!element) { - return NS_OK; + // if we have an element node + if (element) { + // find the owner document + nsCOMPtr doc; + nsCOMPtr node = do_QueryInterface(element); + res = node->GetOwnerDocument(getter_AddRefs(doc)); + NS_ENSURE_SUCCESS(res, res); + if (doc) { + nsCOMPtr documentView = do_QueryInterface(doc); + nsCOMPtr abstractView; + // from the document, get the abtractView + res = documentView->GetDefaultView(getter_AddRefs(abstractView)); + NS_ENSURE_SUCCESS(res, res); + if (abstractView) { + // from the abstractView, get the CSS view + CallQueryInterface(abstractView, aViewCSS); + return NS_OK; + } + } } - // find the owner document - nsCOMPtr doc; - nsCOMPtr node = do_QueryInterface(element); - res = node->GetOwnerDocument(getter_AddRefs(doc)); - NS_ENSURE_SUCCESS(res, res); - if (!doc) { - return NS_OK; - } - nsCOMPtr window; - res = doc->GetDefaultView(getter_AddRefs(window)); - NS_ENSURE_SUCCESS(res, res); - window.forget(aViewCSS); + *aViewCSS = nsnull; return NS_OK; } @@ -1082,9 +1087,9 @@ nsHTMLCSSUtils::GetCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode * aNode, if (theElement && IsCSSEditableProperty(theElement, aHTMLProperty, aAttribute)) { // Yes, the requested HTML style has a CSS equivalence in this implementation // Retrieve the default ViewCSS if we are asked for computed styles - nsCOMPtr window; + nsCOMPtr viewCSS = nsnull; if (COMPUTED_STYLE_TYPE == aStyleType) { - res = GetDefaultViewCSS(theElement, getter_AddRefs(window)); + res = GetDefaultViewCSS(theElement, getter_AddRefs(viewCSS)); NS_ENSURE_SUCCESS(res, res); } nsTArray cssPropertyArray; @@ -1099,7 +1104,7 @@ nsHTMLCSSUtils::GetCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode * aNode, nsAutoString valueString; // retrieve the specified/computed value of the property res = GetCSSInlinePropertyBase(theElement, cssPropertyArray[index], - valueString, window, aStyleType); + valueString, viewCSS, aStyleType); NS_ENSURE_SUCCESS(res, res); // append the value to aValueString (possibly with a leading whitespace) if (index) aValueString.Append(PRUnichar(' ')); diff --git a/editor/libeditor/html/nsHTMLCSSUtils.h b/editor/libeditor/html/nsHTMLCSSUtils.h index 54ddf2ea7994..f310aecf544a 100644 --- a/editor/libeditor/html/nsHTMLCSSUtils.h +++ b/editor/libeditor/html/nsHTMLCSSUtils.h @@ -42,6 +42,7 @@ #include "nsCOMPtr.h" #include "nsString.h" #include "nsTArray.h" +#include "nsIDOMViewCSS.h" #include "nsIDOMNode.h" #include "nsIDOMElement.h" #include "nsIHTMLEditor.h" @@ -53,7 +54,6 @@ #define COMPUTED_STYLE_TYPE 2 class nsHTMLEditor; -class nsIDOMWindow; typedef void (*nsProcessValueFunc)(const nsAString * aInputString, nsAString & aOutputString, const char * aDefaultValueString, @@ -312,13 +312,12 @@ public: */ nsresult GetElementContainerOrSelf(nsIDOMNode * aNode, nsIDOMElement ** aElement); - /** - * Gets the default Window for a given node. + /** Gets the default DOMView for a given node * - * @param aNode the node we want the default Window for - * @param aWindow [OUT] the default Window + * @param aNode the node we want the default DOMView for + * @param aViewCSS [OUT] the default DOMViewCSS */ - nsresult GetDefaultViewCSS(nsIDOMNode* aNode, nsIDOMWindow** aWindow); + nsresult GetDefaultViewCSS(nsIDOMNode * aNode, nsIDOMViewCSS ** aViewCSS); private: @@ -384,17 +383,17 @@ private: PRBool aRemoveProperty); /** back-end for GetSpecifiedProperty and GetComputedProperty - * - * @param aNode [IN] a DOM node - * @param aProperty [IN] a CSS property - * @param aValue [OUT] the retrieved value for this property - * @param aWindow [IN] the window we need in case we query computed styles - * @param aStyleType [IN] SPECIFIED_STYLE_TYPE to query the specified style values - * COMPUTED_STYLE_TYPE to query the computed style values - */ + * + * @param aNode [IN] a DOM node + * @param aProperty [IN] a CSS property + * @param aValue [OUT] the retrieved value for this property + * @param aViewCSS [IN] the ViewCSS we need in case we query computed styles + * @param aStyleType [IN] SPECIFIED_STYLE_TYPE to query the specified style values + COMPUTED_STYLE_TYPE to query the computed style values + */ nsresult GetCSSInlinePropertyBase(nsIDOMNode * aNode, nsIAtom * aProperty, nsAString & aValue, - nsIDOMWindow* aWindow, + nsIDOMViewCSS * aViewCSS, PRUint8 aStyleType); diff --git a/embedding/browser/webBrowser/nsContextMenuInfo.cpp b/embedding/browser/webBrowser/nsContextMenuInfo.cpp index e0b6c68fe1f2..f3fb991e7aff 100644 --- a/embedding/browser/webBrowser/nsContextMenuInfo.cpp +++ b/embedding/browser/webBrowser/nsContextMenuInfo.cpp @@ -1,5 +1,6 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version @@ -50,7 +51,9 @@ #include "nsIDOMHTMLImageElement.h" #include "nsIDOMHTMLAreaElement.h" #include "nsIDOMHTMLLinkElement.h" -#include "nsIDOMWindow.h" +#include "nsIDOMDocumentView.h" +#include "nsIDOMAbstractView.h" +#include "nsIDOMViewCSS.h" #include "nsIDOMCSSStyleDeclaration.h" #include "nsIDOMCSSValue.h" #include "nsIDOMCSSPrimitiveValue.h" @@ -290,10 +293,13 @@ nsContextMenuInfo::GetBackgroundImageRequestInternal(nsIDOMNode *aDOMNode, imgIR nsCOMPtr document; domNode->GetOwnerDocument(getter_AddRefs(document)); - NS_ENSURE_TRUE(document, NS_ERROR_FAILURE); + nsCOMPtr docView(do_QueryInterface(document)); + NS_ENSURE_TRUE(docView, NS_ERROR_FAILURE); - nsCOMPtr window; - document->GetDefaultView(getter_AddRefs(window)); + nsCOMPtr defaultView; + docView->GetDefaultView(getter_AddRefs(defaultView)); + nsCOMPtr defaultCSSView(do_QueryInterface(defaultView)); + NS_ENSURE_TRUE(defaultCSSView, NS_ERROR_FAILURE); nsCOMPtr primitiveValue; nsAutoString bgStringValue; @@ -321,8 +327,8 @@ nsContextMenuInfo::GetBackgroundImageRequestInternal(nsIDOMNode *aDOMNode, imgIR break; nsCOMPtr computedStyle; - window->GetComputedStyle(domElement, EmptyString(), - getter_AddRefs(computedStyle)); + defaultCSSView->GetComputedStyle(domElement, EmptyString(), + getter_AddRefs(computedStyle)); if (computedStyle) { nsCOMPtr cssValue; computedStyle->GetPropertyCSSValue(NS_LITERAL_STRING("background-image"), diff --git a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp index 5e7644b1438b..2ca15167ecff 100644 --- a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp +++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp @@ -41,6 +41,7 @@ #include "nsIAtom.h" #include "nsComponentManagerUtils.h" #include "nsIDOMCSSStyleDeclaration.h" +#include "nsIDOMDocumentView.h" #include "nsIDOMElement.h" #include "nsIDOMNSRange.h" #include "nsIDOMRange.h" @@ -102,10 +103,13 @@ mozInlineSpellWordUtil::Init(nsWeakPtr aWeakEditor) NS_ENSURE_SUCCESS(rv, rv); // view - nsCOMPtr window; - rv = domDoc->GetDefaultView(getter_AddRefs(window)); + nsCOMPtr docView = do_QueryInterface(domDoc, &rv); + NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr abstractView; + rv = docView->GetDefaultView(getter_AddRefs(abstractView)); + NS_ENSURE_SUCCESS(rv, rv); + mCSSView = do_QueryInterface(abstractView, &rv); NS_ENSURE_SUCCESS(rv, rv); - mCSSView = window; // Find the root node for the editor. For contenteditable we'll need something // cleverer here. @@ -494,7 +498,7 @@ ContainsDOMWordSeparator(nsIDOMNode* aNode, PRInt32 aBeforeOffset, } static PRBool -IsBreakElement(nsIDOMWindow* aDocView, nsIDOMNode* aNode) +IsBreakElement(nsIDOMViewCSS* aDocView, nsIDOMNode* aNode) { nsCOMPtr element = do_QueryInterface(aNode); if (!element) @@ -533,8 +537,8 @@ IsBreakElement(nsIDOMWindow* aDocView, nsIDOMNode* aNode) } struct CheckLeavingBreakElementClosure { - nsIDOMWindow* mDocView; - PRPackedBool mLeftBreakElement; + nsIDOMViewCSS* mDocView; + PRPackedBool mLeftBreakElement; }; static void diff --git a/extensions/spellcheck/src/mozInlineSpellWordUtil.h b/extensions/spellcheck/src/mozInlineSpellWordUtil.h index 8cedaecc7732..9591f8f530ea 100644 --- a/extensions/spellcheck/src/mozInlineSpellWordUtil.h +++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.h @@ -38,6 +38,7 @@ #include "nsCOMPtr.h" #include "nsIDOMDocument.h" #include "nsIDOMDocumentRange.h" +#include "nsIDOMViewCSS.h" #include "nsIDocument.h" #include "nsString.h" #include "nsTArray.h" @@ -125,7 +126,7 @@ private: // cached stuff for the editor, set by Init nsCOMPtr mDOMDocumentRange; nsCOMPtr mDocument; - nsCOMPtr mCSSView; + nsCOMPtr mCSSView; nsCOMPtr mCategories; // range to check, see SetRange diff --git a/extensions/widgetutils/src/nsWidgetUtils.cpp b/extensions/widgetutils/src/nsWidgetUtils.cpp index 1e17808025cb..57cf60749829 100644 --- a/extensions/widgetutils/src/nsWidgetUtils.cpp +++ b/extensions/widgetutils/src/nsWidgetUtils.cpp @@ -39,7 +39,9 @@ #include "nsCURILoader.h" #include "nsICategoryManager.h" +#include "nsIDOMAbstractView.h" #include "nsIDOMDocument.h" +#include "nsIDOMDocumentView.h" #include "nsIDOMHTMLElement.h" #include "nsIDOMHTMLIFrameElement.h" #include "nsIDOMNSDocument.h" @@ -66,6 +68,7 @@ #include "nsIDOMEventTarget.h" #include "nsPIDOMWindow.h" #include "nsIDOMWindow.h" +//#include ".h" #include "nsIDOM3EventTarget.h" #include "nsIDOMKeyListener.h" #include "nsIDOMCompositionListener.h" @@ -425,22 +428,28 @@ nsWidgetUtils::IsXULNode(nsIDOMNode *aNode, PRUint32 *aType) } nsresult -nsWidgetUtils::GetDOMWindowByNode(nsIDOMNode* aNode, nsIDOMWindow** aDOMWindow) +nsWidgetUtils::GetDOMWindowByNode(nsIDOMNode *aNode, nsIDOMWindow * *aDOMWindow) { + nsresult rv; nsCOMPtr nodeDoc; - nsresult rv = aNode->GetOwnerDocument(getter_AddRefs(nodeDoc)); + rv = aNode->GetOwnerDocument(getter_AddRefs(nodeDoc)); NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr window; - rv = nodeDoc->GetDefaultView(getter_AddRefs(window)); + nsCOMPtr docView = do_QueryInterface(nodeDoc, &rv); NS_ENSURE_SUCCESS(rv, rv); - window.forget(aDOMWindow); + nsCOMPtr absView; + NS_ENSURE_SUCCESS(rv, rv); + rv = docView->GetDefaultView(getter_AddRefs(absView)); + NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr window = do_QueryInterface(absView, &rv); + NS_ENSURE_SUCCESS(rv, rv); + *aDOMWindow = window; + NS_IF_ADDREF(*aDOMWindow); return rv; } void nsWidgetUtils::GetChromeEventHandler(nsIDOMWindow *aDOMWin, - nsIDOMEventTarget **aChromeTarget) + nsIDOMEventTarget **aChromeTarget) { nsCOMPtr privateDOMWindow(do_QueryInterface(aDOMWin)); nsPIDOMEventTarget* chromeEventHandler = nsnull; diff --git a/js/src/xpconnect/src/dom_quickstubs.qsconf b/js/src/xpconnect/src/dom_quickstubs.qsconf index 9c88d14a3c2a..469d1b4625bc 100644 --- a/js/src/xpconnect/src/dom_quickstubs.qsconf +++ b/js/src/xpconnect/src/dom_quickstubs.qsconf @@ -71,7 +71,6 @@ members = [ #'nsIDOMWindow.document', 'nsIDOMWindow.getSelection', 'nsIDOMWindow.scrollByLines', - 'nsIDOMWindow.getComputedStyle', 'nsIDOMJSWindow.dump', 'nsIDOMScreen.top', 'nsIDOMScreen.height', @@ -109,7 +108,6 @@ members = [ 'nsIDOMDocument.createTextNode', 'nsIDOMDocument.documentURI', 'nsIDOMDocument.adoptNode', - 'nsIDOMDocument.defaultView', 'nsIDOMElement.removeAttributeNS', 'nsIDOMElement.removeAttribute', 'nsIDOMElement.getAttribute', @@ -175,6 +173,7 @@ members = [ 'nsIDOMElementCSSInlineStyle.*', 'nsIDOMCSS2Properties.*', 'nsIDOMRect.*', + 'nsIDOMViewCSS.getComputedStyle', 'nsIDOMCSSStyleDeclaration.*', # dom/interfaces/events @@ -387,6 +386,9 @@ members = [ 'nsIDOMDocumentTraversal.createNodeIterator', 'nsIDOMNodeIterator.nextNode', + # dom/interfaces/views + 'nsIDOMDocumentView.defaultView', + # dom/interfaces/xbl - None. # dom/interfaces/xpath diff --git a/layout/inspector/src/inLayoutUtils.cpp b/layout/inspector/src/inLayoutUtils.cpp index 7fc4b345af28..111b2bf4febd 100644 --- a/layout/inspector/src/inLayoutUtils.cpp +++ b/layout/inspector/src/inLayoutUtils.cpp @@ -37,6 +37,8 @@ #include "inLayoutUtils.h" +#include "nsIDOMDocumentView.h" +#include "nsIDOMAbstractView.h" #include "nsIDocument.h" #include "nsIContent.h" #include "nsIContentViewer.h" @@ -58,14 +60,15 @@ inLayoutUtils::GetWindowFor(nsIDOMNode* aNode) nsIDOMWindowInternal* inLayoutUtils::GetWindowFor(nsIDOMDocument* aDoc) { - nsCOMPtr window; - aDoc->GetDefaultView(getter_AddRefs(window)); - if (!window) { - return nsnull; - } + nsCOMPtr doc = do_QueryInterface(aDoc); + if (!doc) return nsnull; - nsCOMPtr windowInternal = do_QueryInterface(window); - return windowInternal; + nsCOMPtr view; + doc->GetDefaultView(getter_AddRefs(view)); + if (!view) return nsnull; + + nsCOMPtr window = do_QueryInterface(view); + return window; } nsIPresShell* diff --git a/layout/tools/reftest/README.txt b/layout/tools/reftest/README.txt index b8f846554aea..91c487209b69 100644 --- a/layout/tools/reftest/README.txt +++ b/layout/tools/reftest/README.txt @@ -396,6 +396,7 @@ so 60/zoom is an integer. Printing Tests ============== + Now that the patch for bug 374050 has landed (https://bugzilla.mozilla.org/show_bug.cgi?id=374050), it is possible to create reftests that run in a paginated context. @@ -421,3 +422,22 @@ doesn't use exactly the same codepath as real print preview/print. In particular, scripting and frames are likely to cause problems; it is untested, though. That said, it should be sufficient for testing layout issues related to pagination. + +Plugin and IPC Process Crash Tests +================================== + +If you are running a test that causes an out-of-process plugin or IPC process +under Electrolysis to crash as part of a reftest, this will cause process +crash minidump files to be left in the profile directory. The test +infrastructure that runs the reftests will notice these minidump files and +dump out information from them, and these additional error messages in the logs +can end up erroneously being associated with other errors from the reftest run. +They are also confusing, since the appearance of "PROCESS-CRASH" messages in +the test run output can seem like a real problem, when in fact it is the +expected behavior. + +To indicate to the reftest framework that a test is expecting a plugin or +IPC process crash, have the test include "reftest-expect-process-crash" as +one of the root element's classes by the time the test has finished. This will +cause any minidump files that are generated while running the test to be removed +and they won't cause any error messages in the test run output. diff --git a/layout/tools/reftest/reftest-content.js b/layout/tools/reftest/reftest-content.js index 7e05016ccb79..ffcd1c92c55f 100644 --- a/layout/tools/reftest/reftest-content.js +++ b/layout/tools/reftest/reftest-content.js @@ -464,6 +464,7 @@ function WaitForTestEnd(contentRootElement, inPrintMode) { state = STATE_COMPLETED; gFailureReason = "timed out while taking snapshot (bug in harness?)"; RemoveListeners(); + CheckForProcessCrashExpectation(); setTimeout(RecordResult, 0); return; } @@ -527,6 +528,7 @@ function OnDocumentLoad(event) // Go into reftest-wait mode belatedly. WaitForTestEnd(contentRootElement, inPrintMode); } else { + CheckForProcessCrashExpectation(); RecordResult(); } } @@ -555,6 +557,17 @@ function OnDocumentLoad(event) } } +function CheckForProcessCrashExpectation() +{ + var contentRootElement = content.document.documentElement; + if (contentRootElement && + contentRootElement.hasAttribute('class') && + contentRootElement.getAttribute('class').split(/\s+/) + .indexOf("reftest-expect-process-crash") != -1) { + SendExpectProcessCrash(); + } +} + function RecordResult() { LogInfo("RecordResult fired"); @@ -764,11 +777,16 @@ function SendInitCanvasWithSnapshot() } function SendScriptResults(runtimeMs, error, results) - { +{ sendAsyncMessage("reftest:ScriptResults", { runtimeMs: runtimeMs, error: error, results: results }); } +function SendExpectProcessCrash(runtimeMs) +{ + sendAsyncMessage("reftest:ExpectProcessCrash"); +} + function SendTestDone(runtimeMs) { sendAsyncMessage("reftest:TestDone", { runtimeMs: runtimeMs }); diff --git a/layout/tools/reftest/reftest.js b/layout/tools/reftest/reftest.js index fbb9fd75bd3f..1fd53728ef23 100644 --- a/layout/tools/reftest/reftest.js +++ b/layout/tools/reftest/reftest.js @@ -57,6 +57,10 @@ const NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX = "@mozilla.org/network/protocol;1?name="; const NS_XREAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1"; +const NS_DIRECTORY_SERVICE_CONTRACTID = + "@mozilla.org/file/directory_service;1"; +const NS_OBSERVER_SERVICE_CONTRACTID = + "@mozilla.org/observer-service;1"; var gLoadTimeout = 0; var gTimeoutHook = null; @@ -115,6 +119,11 @@ var gSlowestTestURL; var gDrawWindowFlags; +var gExpectingProcessCrash = false; +var gExpectedCrashDumpFiles = []; +var gUnexpectedCrashDumpFiles = { }; +var gCrashDumpDir; + const TYPE_REFTEST_EQUAL = '=='; const TYPE_REFTEST_NOTEQUAL = '!='; const TYPE_LOAD = 'load'; // test without a reference (just test that it does @@ -205,6 +214,11 @@ function IDForEventTarget(event) function OnRefTestLoad() { + gCrashDumpDir = CC[NS_DIRECTORY_SERVICE_CONTRACTID] + .getService(CI.nsIProperties) + .get("ProfD", CI.nsIFile); + gCrashDumpDir.append("minidumps"); + var prefs = Components.classes["@mozilla.org/preferences-service;1"]. getService(Components.interfaces.nsIPrefBranch2); try { @@ -278,7 +292,9 @@ function InitAndStartRefTests() gIOService = CC[IO_SERVICE_CONTRACTID].getService(CI.nsIIOService); gDebug = CC[DEBUG_CONTRACTID].getService(CI.nsIDebug2); - + + RegisterProcessCrashObservers(); + if (gRemote) { gServer = null; } else { @@ -1141,6 +1157,7 @@ function RecordResult(testRunTime, errorMsg, scriptResults) // First document has been loaded. // Proceed to load the second document. + CleanUpCrashDumpFiles(); StartCurrentURI(2); break; case 2: @@ -1201,6 +1218,7 @@ function RecordResult(testRunTime, errorMsg, scriptResults) UpdateCanvasCache(gURLs[0].url1, gCanvas1); UpdateCanvasCache(gURLs[0].url2, gCanvas2); + CleanUpCrashDumpFiles(); FinishTestItem(); break; default: @@ -1217,6 +1235,55 @@ function LoadFailed(why) FinishTestItem(); } +function RemoveExpectedCrashDumpFiles() +{ + if (gExpectingProcessCrash) { + for each (let crashFilename in gExpectedCrashDumpFiles) { + let file = gCrashDumpDir.clone(); + file.append(crashFilename); + if (file.exists()) { + file.remove(false); + } + } + } + gExpectedCrashDumpFiles.length = 0; +} + +function FindUnexpectedCrashDumpFiles() +{ + if (!gCrashDumpDir.exists()) { + return; + } + + let entries = gCrashDumpDir.directoryEntries; + if (!entries) { + return; + } + + let foundCrashDumpFile = false; + while (entries.hasMoreElements()) { + let file = entries.getNext().QueryInterface(CI.nsIFile); + let path = String(file.path); + if (path.match(/\.(dmp|extra)$/) && !gUnexpectedCrashDumpFiles[path]) { + if (!foundCrashDumpFile) { + foundCrashDumpFile = true; + gDumpLog("REFTEST TEST-UNEXPECTED-FAIL | " + gCurrentURL + + " | This test left crash dumps behind, but we weren't expecting it to!\n"); + } + gDumpLog("REFTEST INFO | Found unexpected crash dump file" + path + + ".\n"); + gUnexpectedCrashDumpFiles[path] = true; + } + } +} + +function CleanUpCrashDumpFiles() +{ + RemoveExpectedCrashDumpFiles(); + FindUnexpectedCrashDumpFiles(); + gExpectingProcessCrash = false; +} + function FinishTestItem() { // Replace document with BLANK_URL_FOR_CLEARING in case there are @@ -1316,6 +1383,10 @@ function RegisterMessageListenersAndLoadContentScript() "reftest:UpdateCanvasForInvalidation", function (m) { RecvUpdateCanvasForInvalidation(m.json.rects); } ); + gBrowserMessageManager.addMessageListener( + "reftest:ExpectProcessCrash", + function (m) { RecvExpectProcessCrash(); } + ); gBrowserMessageManager.loadFrameScript("chrome://reftest/content/reftest-content.js", true); } @@ -1376,6 +1447,34 @@ function RecvUpdateCanvasForInvalidation(rects) UpdateCurrentCanvasForInvalidation(rects); } +function OnProcessCrashed(subject, topic, data) +{ + var id; + subject = subject.QueryInterface(CI.nsIPropertyBag2); + if (topic == "plugin-crashed") { + id = subject.getPropertyAsAString("pluginDumpID"); + } else if (topic == "ipc:content-shutdown") { + id = subject.getPropertyAsAString("dumpID"); + } + if (id) { + gExpectedCrashDumpFiles.push(id + ".dmp"); + gExpectedCrashDumpFiles.push(id + ".extra"); + } +} + +function RegisterProcessCrashObservers() +{ + var os = CC[NS_OBSERVER_SERVICE_CONTRACTID] + .getService(CI.nsIObserverService); + os.addObserver(OnProcessCrashed, "plugin-crashed", false); + os.addObserver(OnProcessCrashed, "ipc:content-shutdown", false); +} + +function RecvExpectProcessCrash() +{ + gExpectingProcessCrash = true; +} + function SendClear() { gBrowserMessageManager.sendAsyncMessage("reftest:Clear"); diff --git a/modules/plugin/test/reftest/pluginproblemui-direction-1-ref.html b/modules/plugin/test/reftest/pluginproblemui-direction-1-ref.html index f9983ee6347f..fafec34f4315 100644 --- a/modules/plugin/test/reftest/pluginproblemui-direction-1-ref.html +++ b/modules/plugin/test/reftest/pluginproblemui-direction-1-ref.html @@ -1,5 +1,5 @@ - + Plugin Problem UI directionality test @@ -9,7 +9,7 @@ var plugin = document.getElementById("crashme"); function checkForCrashUI() { if (getComputedStyle(plugin, null).MozBinding != "none") { - document.documentElement.removeAttribute("class"); + document.documentElement.classList.remove("reftest-wait"); clearInterval(interval); } } diff --git a/modules/plugin/test/reftest/pluginproblemui-direction-1.html b/modules/plugin/test/reftest/pluginproblemui-direction-1.html index b01f7df68f5e..9888850dc98b 100644 --- a/modules/plugin/test/reftest/pluginproblemui-direction-1.html +++ b/modules/plugin/test/reftest/pluginproblemui-direction-1.html @@ -1,5 +1,5 @@ - + Plugin Problem UI directionality test @@ -9,7 +9,7 @@ var plugin = document.getElementById("crashme"); function checkForCrashUI() { if (getComputedStyle(plugin, null).MozBinding != "none") { - document.documentElement.removeAttribute("class"); + document.documentElement.classList.remove("reftest-wait"); clearInterval(interval); } } diff --git a/modules/plugin/test/reftest/pluginproblemui-direction-2-ref.html b/modules/plugin/test/reftest/pluginproblemui-direction-2-ref.html index fdfd9b694218..e807b86b5bf8 100644 --- a/modules/plugin/test/reftest/pluginproblemui-direction-2-ref.html +++ b/modules/plugin/test/reftest/pluginproblemui-direction-2-ref.html @@ -1,5 +1,5 @@ - + Plugin Problem UI directionality test @@ -13,7 +13,7 @@ var plugin = document.getElementById("crashme"); function checkForCrashUI() { if (getComputedStyle(plugin, null).MozBinding != "none") { - document.documentElement.removeAttribute("class"); + document.documentElement.classList.remove("reftest-wait"); clearInterval(interval); } } diff --git a/modules/plugin/test/reftest/pluginproblemui-direction-2.html b/modules/plugin/test/reftest/pluginproblemui-direction-2.html index 84c3f308898a..95b358e3721a 100644 --- a/modules/plugin/test/reftest/pluginproblemui-direction-2.html +++ b/modules/plugin/test/reftest/pluginproblemui-direction-2.html @@ -1,5 +1,5 @@ - + Plugin Problem UI directionality test @@ -13,7 +13,7 @@ var plugin = document.getElementById("crashme"); function checkForCrashUI() { if (getComputedStyle(plugin, null).MozBinding != "none") { - document.documentElement.removeAttribute("class"); + document.documentElement.classList.remove("reftest-wait"); clearInterval(interval); } } diff --git a/security/manager/ssl/tests/mochitest/bugs/test_bug413909.html b/security/manager/ssl/tests/mochitest/bugs/test_bug413909.html index 52e9553761a0..13bd33bde671 100644 --- a/security/manager/ssl/tests/mochitest/bugs/test_bug413909.html +++ b/security/manager/ssl/tests/mochitest/bugs/test_bug413909.html @@ -14,7 +14,6 @@ var certOverrideService = Components.classes["@mozilla.org/security/certoverride .getService(Components.interfaces.nsICertOverrideService); var cert = null; var certListener = null; -var frameLoadTimeout = null; SimpleTest.waitForExplicitFinish(); @@ -101,7 +100,6 @@ function onFrameLoad() "bug413909.xn--hxajbheg2az3al.xn--jxalpdlp", -1); apiTest(false); - clearTimeout(frameLoadTimeout); SimpleTest.finish(); } @@ -120,14 +118,6 @@ function onWindowLoad() { // ignore } - - // There is no error event indicating frame load error, - // simulate using timeout. - frameLoadTimeout = setTimeout(function() - { - ok(false, "Secure page did not load, adding exception failed?"); - SimpleTest.finish(); - }, 5000); window.frame1.location.reload(); } diff --git a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_595934_message_categories.js b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_595934_message_categories.js index 32b0d4742e42..6efc53441e1c 100644 --- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_595934_message_categories.js +++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_595934_message_categories.js @@ -128,6 +128,8 @@ let TestObserver = { } } else { + ok(false, aSubject.sourceName + ':' + aSubject.lineNumber + '; ' + + aSubject.errorMessage); executeSoon(finish); } } diff --git a/toolkit/mozapps/extensions/XPIProvider.jsm b/toolkit/mozapps/extensions/XPIProvider.jsm index 5f6ce478265f..efc27a94f9cd 100644 --- a/toolkit/mozapps/extensions/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/XPIProvider.jsm @@ -1723,8 +1723,7 @@ var XPIProvider = { addon = loadManifestFromZipFile(stagedXPI); } catch (e) { - ERROR("Unable to read add-on manifest for " + stagedXPI.leafName + - " in XPI stage of " + aLocation.name, e); + ERROR("Unable to read add-on manifest from " + stagedXPI.path, e); continue; } @@ -1822,7 +1821,7 @@ var XPIProvider = { } aManifests[aLocation.name][id] = null; - let existingAddonID = null; + let existingAddonID = id; // Check for a cached AddonInternal for this add-on, it may contain // updated compatibility information @@ -1839,18 +1838,55 @@ var XPIProvider = { fis.init(jsonfile, -1, 0, 0); aManifests[aLocation.name][id] = json.decodeFromStream(fis, jsonfile.fileSize); - existingAddonID = aManifests[aLocation.name][id].existingAddonID; + existingAddonID = aManifests[aLocation.name][id].existingAddonID || id; } catch (e) { - ERROR("Unable to read add-on manifest for " + id + " in " + - aLocation.name, e); + ERROR("Unable to read add-on manifest from " + jsonfile.path, e); } finally { fis.close(); } } + // If there was no cached AddonInternal then load it directly + if (!aManifests[aLocation.name][id]) { + try { + aManifests[aLocation.name][id] = loadManifestFromFile(stageDirEntry); + existingAddonID = aManifests[aLocation.name][id].existingAddonID || id; + } + catch (e) { + // This add-on can't be installed so just remove it now + stageDirEntry.remove(true); + ERROR("Unable to read add-on manifest from " + stageDirEntry.path, e); + } + } + + var oldBootstrap = null; LOG("Processing install of " + id + " in " + aLocation.name); + if (existingAddonID in this.bootstrappedAddons) { + try { + var existingAddon = aLocation.getLocationForID(existingAddonID); + if (this.bootstrappedAddons[existingAddonID].descriptor == + existingAddon.persistentDescriptor) { + oldBootstrap = this.bootstrappedAddons[existingAddonID]; + + // We'll be replacing a currently active bootstrapped add-on so + // call its uninstall method + let oldVersion = aManifests[aLocation.name][id].version; + let newVersion = oldBootstrap.version; + let uninstallReason = Services.vc.compare(newVersion, oldVersion) < 0 ? + BOOTSTRAP_REASONS.ADDON_UPGRADE : + BOOTSTRAP_REASONS.ADDON_DOWNGRADE; + + this.callBootstrapMethod(existingAddonID, oldBootstrap.version, + existingAddon, "uninstall", uninstallReason); + this.unloadBootstrapScope(existingAddonID); + } + } + catch (e) { + } + } + try { var addonInstallLocation = aLocation.installAddon(id, stageDirEntry, existingAddonID); @@ -1861,6 +1897,13 @@ var XPIProvider = { ERROR("Failed to install staged add-on " + id + " in " + aLocation.name, e); delete aManifests[aLocation.name][id]; + + if (oldBootstrap) { + // Re-install the old add-on + this.callBootstrapMethod(existingAddonID, oldBootstrap.version, + existingAddon, "install", + BOOTSTRAP_REASONS.ADDON_INSTALL); + } continue; } } @@ -1873,7 +1916,7 @@ var XPIProvider = { // Non-critical, just saves some perf on startup if we clean this up. LOG("Error removing staging dir " + stagingDir.path, e); } - }); + }, this); return changed; }, @@ -2523,6 +2566,11 @@ var XPIProvider = { // needs to be updated let updateDatabase = aAppChanged; + // Load the list of bootstrapped add-ons first so processFileChanges can + // modify it + this.bootstrappedAddons = JSON.parse(Prefs.getCharPref(PREF_BOOTSTRAP_ADDONS, + "{}")); + // First install any new add-ons into the locations, if there are any // changes then we must update the database with the information in the // install locations @@ -2542,11 +2590,6 @@ var XPIProvider = { Prefs.getBoolPref(PREF_INSTALL_DISTRO_ADDONS, true)) updateDatabase = this.installDistributionAddons(manifests) | updateDatabase; - // Load the list of bootstrapped add-ons first so processFileChanges can - // modify it - this.bootstrappedAddons = JSON.parse(Prefs.getCharPref(PREF_BOOTSTRAP_ADDONS, - "{}")); - let state = this.getInstallLocationStates(); // If the database exists then the previous file cache can be trusted diff --git a/toolkit/mozapps/extensions/test/addons/test_bootstrap1_4/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bootstrap1_4/install.rdf new file mode 100644 index 000000000000..2b88e0ad0bfb --- /dev/null +++ b/toolkit/mozapps/extensions/test/addons/test_bootstrap1_4/install.rdf @@ -0,0 +1,23 @@ + + + + + + bootstrap1@tests.mozilla.org + 4.0 + + + Test Bootstrap 1 + Test Description + + + + xpcshell@tests.mozilla.org + 1 + 1 + + + + + diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap.js b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap.js index 12df42510d75..4ae57a969997 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap.js @@ -1073,7 +1073,7 @@ function run_test_23() { do_check_eq(install.addon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_INSTALL, 0); do_check_not_in_crash_annotation("bootstrap1@tests.mozilla.org", "1.0"); - + let addon = install.addon; prepare_test({ "bootstrap1@tests.mozilla.org": [ @@ -1166,6 +1166,152 @@ function run_test_24() { do_check_eq(getInstalledVersion2(), -1); do_check_eq(getActiveVersion2(), 1); - do_test_finished(); + run_test_25(); + }); +} + +// Tests that updating from a bootstrappable add-on to a normal add-on calls +// the uninstall method +function run_test_25() { + installAllFiles([do_get_addon("test_bootstrap1_1")], function() { + do_check_eq(getInstalledVersion(), 1); + do_check_eq(getActiveVersion(), 1); + + installAllFiles([do_get_addon("test_bootstrap1_4")], function() { + // Needs a restart to complete this so the old version stays running + do_check_eq(getInstalledVersion(), 1); + do_check_eq(getActiveVersion(), 1); + + AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) { + do_check_neq(b1, null); + do_check_eq(b1.version, "1.0"); + do_check_true(b1.isActive); + do_check_true(hasFlag(b1.pendingOperations, AddonManager.PENDING_UPGRADE)); + + restartManager(); + + do_check_eq(getInstalledVersion(), 0); + do_check_eq(getUninstallReason(), ADDON_UPGRADE); + do_check_eq(getActiveVersion(), 0); + + AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) { + do_check_neq(b1, null); + do_check_eq(b1.version, "4.0"); + do_check_true(b1.isActive); + do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE); + + run_test_26(); + }); + }); + }); + }); +} + +// Tests that updating from a normal add-on to a bootstrappable add-on calls +// the install method +function run_test_26() { + installAllFiles([do_get_addon("test_bootstrap1_1")], function() { + // Needs a restart to complete this + do_check_eq(getInstalledVersion(), 0); + do_check_eq(getActiveVersion(), 0); + + AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) { + do_check_neq(b1, null); + do_check_eq(b1.version, "4.0"); + do_check_true(b1.isActive); + do_check_true(hasFlag(b1.pendingOperations, AddonManager.PENDING_UPGRADE)); + + restartManager(); + + do_check_eq(getInstalledVersion(), 1); + do_check_eq(getInstallReason(), ADDON_DOWNGRADE); + do_check_eq(getActiveVersion(), 1); + + AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) { + do_check_neq(b1, null); + do_check_eq(b1.version, "1.0"); + do_check_true(b1.isActive); + do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE); + + run_test_27(); + }); + }); + }); +} + +// Tests that updating from a bootstrappable add-on to a normal add-on while +// disabled calls the uninstall method +function run_test_27() { + AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) { + do_check_neq(b1, null); + b1.userDisabled = true; + do_check_eq(b1.version, "1.0"); + do_check_false(b1.isActive); + do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE); + do_check_eq(getInstalledVersion(), 1); + do_check_eq(getActiveVersion(), 0); + + installAllFiles([do_get_addon("test_bootstrap1_4")], function() { + // Updating disabled things happens immediately + do_check_eq(getInstalledVersion(), 0); + do_check_eq(getUninstallReason(), ADDON_UPGRADE); + do_check_eq(getActiveVersion(), 0); + + AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) { + do_check_neq(b1, null); + do_check_eq(b1.version, "4.0"); + do_check_false(b1.isActive); + do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE); + + restartManager(); + + do_check_eq(getInstalledVersion(), 0); + do_check_eq(getActiveVersion(), 0); + + AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) { + do_check_neq(b1, null); + do_check_eq(b1.version, "4.0"); + do_check_false(b1.isActive); + do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE); + + run_test_28(); + }); + }); + }); + }); +} + +// Tests that updating from a normal add-on to a bootstrappable add-on when +// disabled calls the install method +function run_test_28() { + installAllFiles([do_get_addon("test_bootstrap1_1")], function() { + // Doesn't need a restart to complete this + do_check_eq(getInstalledVersion(), 1); + do_check_eq(getInstallReason(), ADDON_DOWNGRADE); + do_check_eq(getActiveVersion(), 0); + + AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) { + do_check_neq(b1, null); + do_check_eq(b1.version, "1.0"); + do_check_false(b1.isActive); + do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE); + + restartManager(); + + do_check_eq(getInstalledVersion(), 1); + do_check_eq(getActiveVersion(), 0); + + AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) { + do_check_neq(b1, null); + b1.userDisabled = false; + do_check_eq(b1.version, "1.0"); + do_check_true(b1.isActive); + do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE); + do_check_eq(getInstalledVersion(), 1); + do_check_eq(getActiveVersion(), 1); + + do_test_finished(); + }); + }); }); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_updateid.js b/toolkit/mozapps/extensions/test/xpcshell/test_updateid.js index 640fbfacf07e..295665616503 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_updateid.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_updateid.js @@ -387,8 +387,7 @@ function check_test_6() { do_check_eq(a4, null); do_check_neq(a2, null); - // TODO bug 613294, uninstall methods aren't called in this case at the moment - do_check_eq(getInstalledVersion(), 4); + do_check_eq(getInstalledVersion(), 0); do_check_eq(getActiveVersion(), 0); end_test(); diff --git a/toolkit/toolkit-makefiles.sh b/toolkit/toolkit-makefiles.sh index 1f040fdff122..5e058bd5722a 100644 --- a/toolkit/toolkit-makefiles.sh +++ b/toolkit/toolkit-makefiles.sh @@ -70,6 +70,7 @@ MAKEFILES_dom=" dom/interfaces/stylesheets/Makefile dom/interfaces/threads/Makefile dom/interfaces/traversal/Makefile + dom/interfaces/views/Makefile dom/interfaces/xbl/Makefile dom/interfaces/xpath/Makefile dom/interfaces/xul/Makefile diff --git a/widget/src/cocoa/nsMenuItemIconX.mm b/widget/src/cocoa/nsMenuItemIconX.mm index 3605a8c89d23..343d5b551ffd 100644 --- a/widget/src/cocoa/nsMenuItemIconX.mm +++ b/widget/src/cocoa/nsMenuItemIconX.mm @@ -49,6 +49,8 @@ #include "nsIDocument.h" #include "nsINameSpaceManager.h" #include "nsWidgetAtoms.h" +#include "nsIDOMDocumentView.h" +#include "nsIDOMViewCSS.h" #include "nsIDOMElement.h" #include "nsIDOMCSSStyleDeclaration.h" #include "nsIDOMCSSValue.h" @@ -199,27 +201,24 @@ nsMenuItemIconX::GetIconURI(nsIURI** aIconURI) if (!hasImageAttr) { // If the content node has no "image" attribute, get the // "list-style-image" property from CSS. - nsCOMPtr domDocument = - do_QueryInterface(mContent->GetDocument()); - if (!domDocument) - return NS_ERROR_FAILURE; + nsCOMPtr domDocumentView = + do_QueryInterface(mContent->GetDocument()); + if (!domDocumentView) return NS_ERROR_FAILURE; - nsCOMPtr window; - rv = domDocument->GetDefaultView(getter_AddRefs(window)); - if (NS_FAILED(rv)) - return rv; - if (!window) - return NS_ERROR_FAILURE; + nsCOMPtr domAbstractView; + rv = domDocumentView->GetDefaultView(getter_AddRefs(domAbstractView)); + if (NS_FAILED(rv)) return rv; + + nsCOMPtr domViewCSS = do_QueryInterface(domAbstractView); + if (!domViewCSS) return NS_ERROR_FAILURE; nsCOMPtr domElement = do_QueryInterface(mContent); - if (!domElement) - return NS_ERROR_FAILURE; + if (!domElement) return NS_ERROR_FAILURE; - rv = window->GetComputedStyle(domElement, EmptyString(), - getter_AddRefs(cssStyleDecl)); - if (NS_FAILED(rv)) - return rv; + rv = domViewCSS->GetComputedStyle(domElement, EmptyString(), + getter_AddRefs(cssStyleDecl)); + if (NS_FAILED(rv)) return rv; NS_NAMED_LITERAL_STRING(listStyleImage, "list-style-image"); rv = cssStyleDecl->GetPropertyCSSValue(listStyleImage, diff --git a/widget/src/cocoa/nsMenuUtilsX.mm b/widget/src/cocoa/nsMenuUtilsX.mm index eecef2c4f284..f05a50914343 100644 --- a/widget/src/cocoa/nsMenuUtilsX.mm +++ b/widget/src/cocoa/nsMenuUtilsX.mm @@ -51,6 +51,7 @@ #include "nsIDOMXULCommandEvent.h" #include "nsIPrivateDOMEvent.h" #include "nsPIDOMWindow.h" +#include "nsIDOMAbstractView.h" void nsMenuUtilsX::DispatchCommandTo(nsIContent* aTargetContent) { @@ -65,13 +66,13 @@ void nsMenuUtilsX::DispatchCommandTo(nsIContent* aTargetContent) getter_AddRefs(event)); nsCOMPtr command = do_QueryInterface(event); nsCOMPtr pEvent = do_QueryInterface(command); + nsCOMPtr view = do_QueryInterface(doc->GetWindow()); // FIXME: Should probably figure out how to init this with the actual // pressed keys, but this is a big old edge case anyway. -dwh if (pEvent && NS_SUCCEEDED(command->InitCommandEvent(NS_LITERAL_STRING("command"), - PR_TRUE, PR_TRUE, - doc->GetWindow(), 0, + PR_TRUE, PR_TRUE, view, 0, PR_FALSE, PR_FALSE, PR_FALSE, PR_FALSE, nsnull))) { pEvent->SetTrusted(PR_TRUE); diff --git a/xpfe/appshell/src/nsXULWindow.cpp b/xpfe/appshell/src/nsXULWindow.cpp index 59262b0cfe50..9d5f889aa67c 100644 --- a/xpfe/appshell/src/nsXULWindow.cpp +++ b/xpfe/appshell/src/nsXULWindow.cpp @@ -1,6 +1,7 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim:set ts=2 sw=2 sts=2 ci et: */ -/* ***** BEGIN LICENSE BLOCK ***** +/* + * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version @@ -83,6 +84,8 @@ #include "nsIScriptSecurityManager.h" #include "nsIWindowWatcher.h" #include "nsIURI.h" +#include "nsIDOMDocumentView.h" +#include "nsIDOMViewCSS.h" #include "nsIDOMCSSStyleDeclaration.h" #include "nsITimelineService.h" #include "nsAppShellCID.h"