This commit is contained in:
Rob Campbell 2011-04-26 09:37:34 -03:00
Родитель fa5fe2558f 2b874a847f
Коммит 984616986e
95 изменённых файлов: 1021 добавлений и 302 удалений

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

@ -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"

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

@ -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<nsIDocShellTreeItem> rootTreeItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
nsCOMPtr<nsIDOMDocument> domDoc = do_GetInterface(rootTreeItem);
if (!domDoc)
nsCOMPtr<nsIDOMDocumentView> docView(do_QueryInterface(domDoc));
if (!docView)
return coords;
nsCOMPtr<nsIDOMWindow> window;
domDoc->GetDefaultView(getter_AddRefs(window));
nsCOMPtr<nsIDOMWindowInternal> windowInter(do_QueryInterface(window));
nsCOMPtr<nsIDOMAbstractView> abstractView;
docView->GetDefaultView(getter_AddRefs(abstractView));
nsCOMPtr<nsIDOMWindowInternal> windowInter(do_QueryInterface(abstractView));
if (!windowInter)
return coords;
@ -593,14 +597,14 @@ nsCoreUtils::GetComputedStyleDeclaration(const nsAString& aPseudoElt,
if (!document)
return nsnull;
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(document->GetWindow());
if (!window)
nsCOMPtr<nsIDOMViewCSS> viewCSS(do_QueryInterface(document->GetWindow()));
if (!viewCSS)
return nsnull;
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
nsIDOMCSSStyleDeclaration* cssDecl = nsnull;
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(content));
window->GetComputedStyle(domElement, aPseudoElt, getter_AddRefs(cssDecl));
return cssDecl.forget();
viewCSS->GetComputedStyle(domElement, aPseudoElt, &cssDecl);
return cssDecl;
}
already_AddRefed<nsIBoxObject>

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

@ -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"

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

@ -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"

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

@ -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;

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

@ -41,6 +41,7 @@
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/aboutDialog.css" type="text/css"?>
<?xml-stylesheet href="chrome://branding/content/aboutDialog.css" type="text/css"?>
<!DOCTYPE window [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >

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

@ -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);
}

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

@ -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)

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

@ -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);
}

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

@ -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)

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

@ -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;
}

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

@ -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)

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

@ -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);
}

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

@ -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)

0
build/os2/test_os2.cmd Executable file → Normal file
Просмотреть файл

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

@ -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"

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

@ -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<nsIDOMXULCommandEvent> xulCommand = do_QueryInterface(event);
nsCOMPtr<nsIPrivateDOMEvent> pEvent = do_QueryInterface(xulCommand);
NS_ENSURE_STATE(pEvent);
nsCOMPtr<nsIDOMAbstractView> 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);

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

@ -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);
}
*aDefaultView = nsnull;
return NS_OK;
}
NS_IMETHODIMP

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

@ -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) \

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

@ -92,6 +92,7 @@
#include "nsBindingManager.h"
#include "nsXBLBinding.h"
#include "nsIDOMViewCSS.h"
#include "nsIXBLService.h"
#include "nsPIDOMWindow.h"
#include "nsIBoxObject.h"

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

@ -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);
}

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

@ -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);
}

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

@ -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);
}

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

@ -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);
}

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

@ -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);
}

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

@ -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);
}

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

@ -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,

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

@ -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);
}

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

@ -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<nsIDOMWindow> mView;
nsCOMPtr<nsIDOMAbstractView> 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__

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

@ -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);
}

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

@ -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"

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

@ -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);

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

@ -1388,12 +1388,6 @@ nsHTMLDocument::NormalizeDocument()
return nsDocument::NormalizeDocument();
}
NS_IMETHODIMP
nsHTMLDocument::GetDefaultView(nsIDOMWindow** aWindow)
{
return nsDocument::GetDefaultView(aWindow);
}
//
// nsIDOMHTMLDocument interface implementation
//

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

@ -1061,7 +1061,7 @@ nsresult nsOggReader::GetSeekRanges(nsTArray<SeekRange>& 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;

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

@ -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*/,

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

@ -58,7 +58,7 @@ public:
NS_FORWARD_TO_NSDOMEVENT
private:
nsCOMPtr<nsIDOMWindow> mView;
nsCOMPtr<nsIDOMAbstractView> mView;
PRInt32 mDetail;
};

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

@ -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"

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

@ -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,11 +95,14 @@ nsXMLPrettyPrinter::PrettyPrint(nsIDocument* aDocument,
nsCOMPtr<nsIDOMCSSStyleDeclaration> computedStyle;
nsCOMPtr<nsIDOMDocument> frameOwnerDoc;
frameElem->GetOwnerDocument(getter_AddRefs(frameOwnerDoc));
if (frameOwnerDoc) {
nsCOMPtr<nsIDOMWindow> window;
frameOwnerDoc->GetDefaultView(getter_AddRefs(window));
if (window) {
window->GetComputedStyle(frameElem,
nsCOMPtr<nsIDOMDocumentView> docView = do_QueryInterface(frameOwnerDoc);
if (docView) {
nsCOMPtr<nsIDOMAbstractView> defaultView;
docView->GetDefaultView(getter_AddRefs(defaultView));
nsCOMPtr<nsIDOMViewCSS> defaultCSSView =
do_QueryInterface(defaultView);
if (defaultCSSView) {
defaultCSSView->GetComputedStyle(frameElem,
EmptyString(),
getter_AddRefs(computedStyle));
}

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

@ -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"

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

@ -50,6 +50,7 @@ DIRS = \
interfaces/html \
interfaces/events \
interfaces/stylesheets \
interfaces/views \
interfaces/sidebar \
interfaces/css \
interfaces/traversal \

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

@ -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)

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

@ -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
//*****************************************************************************

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

@ -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

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

@ -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;

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

@ -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 <http://www.whatwg.org/html/#window>
* 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 <http://dev.w3.org/csswg/cssom/#dom-window-getcomputedstyle>
*/
nsIDOMCSSStyleDeclaration getComputedStyle(in nsIDOMElement elt,
[optional] in DOMString pseudoElt);
};

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

@ -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
{
/**

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

@ -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;

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

@ -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;
};

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

@ -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

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

@ -71,6 +71,7 @@ XPIDLSRCS = \
nsIDOMDocumentCSS.idl \
nsIDOMRGBColor.idl \
nsIDOMRect.idl \
nsIDOMViewCSS.idl \
nsIDOMNSRGBAColor.idl \
$(NULL)

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

@ -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 <jst@netscape.com> (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 <http://dev.w3.org/csswg/cssom/#dom-window-getcomputedstyle>
*/
nsIDOMCSSStyleDeclaration getComputedStyle(in nsIDOMElement elt,
[optional] in DOMString pseudoElt);
};

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

@ -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,

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

@ -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,

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

@ -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,

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

@ -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,

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

@ -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,

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

@ -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,

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

@ -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,

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

@ -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,

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

@ -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);
};

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

@ -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;

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

@ -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);
};

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

@ -39,7 +39,7 @@
interface nsIDOMSVGSVGElement;
[scriptable, uuid(907f1ada-5ace-4789-8c25-0c79f251044d)]
[scriptable, uuid(dcac0765-b258-4e0b-9862-6470eb9876ba)]
interface nsIDOMSVGDocument : nsIDOMDocument
/* , nsIDOMDocumentEvent */
{

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

@ -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;

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

@ -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

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

@ -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 <jst@netscape.com> (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;
};

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

@ -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 <jst@netscape.com> (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;
};

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

@ -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,

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

@ -690,14 +690,13 @@ nsHTMLEditor::CheckPositionedElementBGandFG(nsIDOMElement * aElement,
bgColorStr);
NS_ENSURE_SUCCESS(res, res);
if (bgColorStr.EqualsLiteral("transparent")) {
nsCOMPtr<nsIDOMWindow> window;
res = mHTMLCSSUtils->GetDefaultViewCSS(aElement, getter_AddRefs(window));
NS_ENSURE_SUCCESS(res, res);
nsCOMPtr<nsIDOMViewCSS> viewCSS;
res = mHTMLCSSUtils->GetDefaultViewCSS(aElement, getter_AddRefs(viewCSS));
NS_ENSURE_SUCCESS(res, res);
nsCOMPtr<nsIDOMCSSStyleDeclaration> 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<nsIDOMCSSValue> colorCssValue;
res = cssDecl->GetPropertyCSSValue(NS_LITERAL_STRING("color"), getter_AddRefs(colorCssValue));

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

@ -430,13 +430,13 @@ nsHTMLEditor::GetPositionAndDimensions(nsIDOMElement * aElement,
// Yes, it is absolutely positioned
mResizedObjectIsAbsolutelyPositioned = PR_TRUE;
nsCOMPtr<nsIDOMWindow> window;
res = mHTMLCSSUtils->GetDefaultViewCSS(aElement, getter_AddRefs(window));
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMViewCSS> viewCSS;
res = mHTMLCSSUtils->GetDefaultViewCSS(aElement, getter_AddRefs(viewCSS));
NS_ENSURE_TRUE(viewCSS, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMCSSStyleDeclaration> 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"));

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

@ -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<nsIDOMWindow> window;
nsresult res = GetDefaultViewCSS(aNode, getter_AddRefs(window));
nsCOMPtr<nsIDOMViewCSS> 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,
nsAString &aValue,
nsIDOMViewCSS *aViewCSS,
PRUint8 aStyleType)
{
aValue.Truncate();
NS_ENSURE_TRUE(aProperty, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsIDOMElement> element;
nsCOMPtr<nsIDOMElement>element;
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<nsIDOMCSSStyleDeclaration> 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<nsIDOMElement> element;
nsCOMPtr<nsIDOMElement>element;
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<nsIDOMDocument> doc;
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(element);
res = node->GetOwnerDocument(getter_AddRefs(doc));
NS_ENSURE_SUCCESS(res, res);
if (!doc) {
if (doc) {
nsCOMPtr<nsIDOMDocumentView> documentView = do_QueryInterface(doc);
nsCOMPtr<nsIDOMAbstractView> 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;
}
nsCOMPtr<nsIDOMWindow> 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<nsIDOMWindow> window;
nsCOMPtr<nsIDOMViewCSS> 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<nsIAtom*> 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(' '));

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

@ -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:
@ -388,13 +387,13 @@ private:
* @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 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
COMPUTED_STYLE_TYPE to query the computed style values
*/
nsresult GetCSSInlinePropertyBase(nsIDOMNode * aNode, nsIAtom * aProperty,
nsAString & aValue,
nsIDOMWindow* aWindow,
nsIDOMViewCSS * aViewCSS,
PRUint8 aStyleType);

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

@ -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<nsIDOMDocument> document;
domNode->GetOwnerDocument(getter_AddRefs(document));
NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMDocumentView> docView(do_QueryInterface(document));
NS_ENSURE_TRUE(docView, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMWindow> window;
document->GetDefaultView(getter_AddRefs(window));
nsCOMPtr<nsIDOMAbstractView> defaultView;
docView->GetDefaultView(getter_AddRefs(defaultView));
nsCOMPtr<nsIDOMViewCSS> defaultCSSView(do_QueryInterface(defaultView));
NS_ENSURE_TRUE(defaultCSSView, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMCSSPrimitiveValue> primitiveValue;
nsAutoString bgStringValue;
@ -321,7 +327,7 @@ nsContextMenuInfo::GetBackgroundImageRequestInternal(nsIDOMNode *aDOMNode, imgIR
break;
nsCOMPtr<nsIDOMCSSStyleDeclaration> computedStyle;
window->GetComputedStyle(domElement, EmptyString(),
defaultCSSView->GetComputedStyle(domElement, EmptyString(),
getter_AddRefs(computedStyle));
if (computedStyle) {
nsCOMPtr<nsIDOMCSSValue> cssValue;

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

@ -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<nsIDOMWindow> window;
rv = domDoc->GetDefaultView(getter_AddRefs(window));
nsCOMPtr<nsIDOMDocumentView> docView = do_QueryInterface(domDoc, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMAbstractView> 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<nsIDOMElement> element = do_QueryInterface(aNode);
if (!element)
@ -533,7 +537,7 @@ IsBreakElement(nsIDOMWindow* aDocView, nsIDOMNode* aNode)
}
struct CheckLeavingBreakElementClosure {
nsIDOMWindow* mDocView;
nsIDOMViewCSS* mDocView;
PRPackedBool mLeftBreakElement;
};

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

@ -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<nsIDOMDocumentRange> mDOMDocumentRange;
nsCOMPtr<nsIDocument> mDocument;
nsCOMPtr<nsIDOMWindow> mCSSView;
nsCOMPtr<nsIDOMViewCSS> mCSSView;
nsCOMPtr<nsIUGenCategory> mCategories;
// range to check, see SetRange

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

@ -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,16 +428,22 @@ nsWidgetUtils::IsXULNode(nsIDOMNode *aNode, PRUint32 *aType)
}
nsresult
nsWidgetUtils::GetDOMWindowByNode(nsIDOMNode* aNode, nsIDOMWindow** aDOMWindow)
nsWidgetUtils::GetDOMWindowByNode(nsIDOMNode *aNode, nsIDOMWindow * *aDOMWindow)
{
nsresult rv;
nsCOMPtr<nsIDOMDocument> nodeDoc;
nsresult rv = aNode->GetOwnerDocument(getter_AddRefs(nodeDoc));
rv = aNode->GetOwnerDocument(getter_AddRefs(nodeDoc));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMWindow> window;
rv = nodeDoc->GetDefaultView(getter_AddRefs(window));
nsCOMPtr<nsIDOMDocumentView> docView = do_QueryInterface(nodeDoc, &rv);
NS_ENSURE_SUCCESS(rv, rv);
window.forget(aDOMWindow);
nsCOMPtr<nsIDOMAbstractView> absView;
NS_ENSURE_SUCCESS(rv, rv);
rv = docView->GetDefaultView(getter_AddRefs(absView));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(absView, &rv);
NS_ENSURE_SUCCESS(rv, rv);
*aDOMWindow = window;
NS_IF_ADDREF(*aDOMWindow);
return rv;
}

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

@ -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

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

@ -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<nsIDOMWindow> window;
aDoc->GetDefaultView(getter_AddRefs(window));
if (!window) {
return nsnull;
}
nsCOMPtr<nsIDOMDocumentView> doc = do_QueryInterface(aDoc);
if (!doc) return nsnull;
nsCOMPtr<nsIDOMWindowInternal> windowInternal = do_QueryInterface(window);
return windowInternal;
nsCOMPtr<nsIDOMAbstractView> view;
doc->GetDefaultView(getter_AddRefs(view));
if (!view) return nsnull;
nsCOMPtr<nsIDOMWindowInternal> window = do_QueryInterface(view);
return window;
}
nsIPresShell*

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

@ -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.

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

@ -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 });

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

@ -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 {
@ -279,6 +293,8 @@ 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");

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

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html class="reftest-wait">
<html class="reftest-expect-process-crash reftest-wait">
<head>
<title>Plugin Problem UI directionality test</title>
</head>
@ -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);
}
}

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

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html class="reftest-wait">
<html class="reftest-expect-process-crash reftest-wait">
<head>
<title>Plugin Problem UI directionality test</title>
</head>
@ -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);
}
}

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

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html class="reftest-wait">
<html class="reftest-expect-process-crash reftest-wait">
<head>
<title>Plugin Problem UI directionality test</title>
</head>
@ -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);
}
}

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

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html class="reftest-wait">
<html class="reftest-expect-process-crash reftest-wait">
<head>
<title>Plugin Problem UI directionality test</title>
</head>
@ -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);
}
}

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

@ -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();
}
@ -121,14 +119,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();
}

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

@ -128,6 +128,8 @@ let TestObserver = {
}
}
else {
ok(false, aSubject.sourceName + ':' + aSubject.lineNumber + '; ' +
aSubject.errorMessage);
executeSoon(finish);
}
}

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

@ -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

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

@ -0,0 +1,23 @@
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>bootstrap1@tests.mozilla.org</em:id>
<em:version>4.0</em:version>
<!-- Front End MetaData -->
<em:name>Test Bootstrap 1</em:name>
<em:description>Test Description</em:description>
<em:targetApplication>
<Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>1</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>

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

@ -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();
});
});
});
}

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

@ -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();

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

@ -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

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

@ -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<nsIDOMDocument> domDocument =
nsCOMPtr<nsIDOMDocumentView> domDocumentView =
do_QueryInterface(mContent->GetDocument());
if (!domDocument)
return NS_ERROR_FAILURE;
if (!domDocumentView) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMWindow> window;
rv = domDocument->GetDefaultView(getter_AddRefs(window));
if (NS_FAILED(rv))
return rv;
if (!window)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMAbstractView> domAbstractView;
rv = domDocumentView->GetDefaultView(getter_AddRefs(domAbstractView));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDOMViewCSS> domViewCSS = do_QueryInterface(domAbstractView);
if (!domViewCSS) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(mContent);
if (!domElement)
return NS_ERROR_FAILURE;
if (!domElement) return NS_ERROR_FAILURE;
rv = window->GetComputedStyle(domElement, EmptyString(),
rv = domViewCSS->GetComputedStyle(domElement, EmptyString(),
getter_AddRefs(cssStyleDecl));
if (NS_FAILED(rv))
return rv;
if (NS_FAILED(rv)) return rv;
NS_NAMED_LITERAL_STRING(listStyleImage, "list-style-image");
rv = cssStyleDecl->GetPropertyCSSValue(listStyleImage,

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

@ -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<nsIDOMXULCommandEvent> command = do_QueryInterface(event);
nsCOMPtr<nsIPrivateDOMEvent> pEvent = do_QueryInterface(command);
nsCOMPtr<nsIDOMAbstractView> 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);

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

@ -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"