merge the last green changeset on m-c to fx-team

This commit is contained in:
Tim Taubert 2011-10-03 21:12:02 +02:00
Родитель e2343925d1 a730c3543c
Коммит 15cf836cdb
142 изменённых файлов: 2185 добавлений и 2514 удалений

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

@ -387,15 +387,10 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
NS_ASSERTION(targetDocument, "No document while accessible is in document?!");
nsINode* targetNode = accessible->GetNode();
nsIContent* targetContent = targetNode->IsElement() ?
targetNode->AsElement() : nsnull;
nsIContent* origTargetContent = origTargetNode->IsElement() ?
origTargetNode->AsElement() : nsnull;
#ifdef MOZ_XUL
bool isTree = targetContent ?
targetContent->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL) :
PR_FALSE;
bool isTree = targetNode->IsElement() &&
targetNode->AsElement()->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL);
if (isTree) {
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(accessible);

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

@ -56,19 +56,20 @@
<implementation>
<constructor><![CDATA[
Cu.import("resource://services-sync/ext/Observers.js");
Cu.import("resource://services-sync/notifications.js");
let temp = {};
Cu.import("resource://services-sync/ext/Observers.js", temp);
temp.Observers.add("weave:notification:added", this.onNotificationAdded, this);
temp.Observers.add("weave:notification:removed", this.onNotificationRemoved, this);
Observers.add("weave:notification:added", this.onNotificationAdded, this);
Observers.add("weave:notification:removed", this.onNotificationRemoved, this);
for each (var notification in Notifications.notifications)
for each (var notification in Weave.Notifications.notifications)
this._appendNotification(notification);
]]></constructor>
<destructor><![CDATA[
Observers.remove("weave:notification:added", this.onNotificationAdded, this);
Observers.remove("weave:notification:removed", this.onNotificationRemoved, this);
let temp = {};
Cu.import("resource://services-sync/ext/Observers.js", temp);
temp.Observers.remove("weave:notification:added", this.onNotificationAdded, this);
temp.Observers.remove("weave:notification:removed", this.onNotificationRemoved, this);
]]></destructor>
<method name="onNotificationAdded">
@ -140,7 +141,7 @@
onset="this._notification = val; return val;"/>
<method name="close">
<body><![CDATA[
Notifications.remove(this.notification);
Weave.Notifications.remove(this.notification);
// We should be able to call the base class's close method here
// to remove the notification element from the notification box,

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

@ -41,7 +41,7 @@
@media all and (-moz-windows-default-theme) {
#navigator-toolbox > toolbar:not(:-moz-lwtheme),
#addon-bar:not(:-moz-lwtheme) {
#browser-bottombox:not(:-moz-lwtheme) {
background-color: @customToolbarColor@;
}
@ -168,6 +168,7 @@
#main-window[sizemode=normal] #browser-bottombox {
border: 1px solid @toolbarShadowColor@;
border-top-style: none;
background-clip: padding-box;
}
#main-window[sizemode=normal][tabsontop=false] #PersonalToolbar:not(:-moz-lwtheme) {
@ -235,23 +236,6 @@
background-color: -moz-dialog;
}
#browser-bottombox:not(:-moz-lwtheme) {
background-color: -moz-dialog;
background-clip: padding-box;
}
#main-window[sizemode=normal] #browser-bottombox:not(:-moz-lwtheme),
#main-window[sizemode=normal] #addon-bar:not(:-moz-lwtheme) {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}
#addon-bar:not(:-moz-lwtheme) {
-moz-appearance: none;
border-bottom-style: none;
background-image: -moz-linear-gradient(@toolbarHighlight@, rgba(255,255,255,0));
}
#main-menubar:not(:-moz-lwtheme):not(:-moz-window-inactive) {
background-color: rgba(255,255,255,.5);
border-radius: 4px;

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

@ -141,6 +141,10 @@
-moz-appearance: toolbox;
}
#browser-bottombox:not(:-moz-lwtheme) {
background-color: -moz-dialog;
}
/* ::::: app menu button ::::: */
#appmenu-button {
@ -2467,12 +2471,14 @@ panel[dimmed="true"] {
/* Add-on bar */
#addon-bar {
-moz-appearance: none;
min-height: 20px;
border-top: 1px solid ThreeDShadow !important;
}
#addon-bar:not(:-moz-lwtheme) {
-moz-appearance: statusbar;
border-top-style: none;
border-bottom-style: none;
padding-top: 1px;
background-image: -moz-linear-gradient(rgba(0,0,0,.15) 1px, rgba(255,255,255,.15) 1px);
background-size: 100% 2px;
background-repeat: no-repeat;
}
#status-bar {

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

@ -71,10 +71,10 @@ DEPRECATED_OPERATION(IsSupported)
DEPRECATED_OPERATION(IsEqualNode)
DEPRECATED_OPERATION(TextContent)
DEPRECATED_OPERATION(EnablePrivilege)
DEPRECATED_OPERATION(Position)
DEPRECATED_OPERATION(TotalSize)
DEPRECATED_OPERATION(IsSameNode)
DEPRECATED_OPERATION(ReplaceWholeText)
DEPRECATED_OPERATION(GlobalStorage)
DEPRECATED_OPERATION(XmlEncoding)
DEPRECATED_OPERATION(XmlVersion)
DEPRECATED_OPERATION(InputEncoding)
DEPRECATED_OPERATION(XmlStandalone)

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

@ -64,24 +64,26 @@ interface nsIFrameMessageListener : nsISupports
void receiveMessage();
};
[scriptable, uuid(6b736edb-863d-40bd-bca2-62f44da803c0)]
[scriptable, uuid(a27d8fcd-8de9-4a51-87f4-2b83bba901d5)]
interface nsIFrameMessageManager : nsISupports
{
void addMessageListener(in AString aMessage, in nsIFrameMessageListener aListener);
void removeMessageListener(in AString aMessage, in nsIFrameMessageListener aListener);
void sendAsyncMessage(/*in messageName, in JSON*/);
[implicit_jscontext,optional_argc]
void sendAsyncMessage([optional] in AString messageName, [optional] in jsval obj);
};
[scriptable, uuid(cdb1a40b-9862-426c-ae8a-f5ab84e20e32)]
[scriptable, uuid(21e5d940-d457-4c0f-bb5e-35c159ed19e3)]
interface nsISyncMessageSender : nsIFrameMessageManager
{
/**
* Returns an array of JSON objects.
*/
void sendSyncMessage(/*in messageName, in JSON*/);
[implicit_jscontext,optional_argc]
jsval sendSyncMessage([optional] in AString messageName, [optional] in jsval obj);
};
[scriptable, uuid(6f23339f-2b5c-4f22-a03f-bb7ec101f83d)]
[scriptable, uuid(78a1d024-60e3-4b7b-98cd-4c6b84b4f060)]
interface nsIContentFrameMessageManager : nsISyncMessageSender
{
/**
@ -112,20 +114,20 @@ interface nsIContentFrameMessageManager : nsISyncMessageSender
DOMString btoa(in DOMString aBase64Data);
};
[uuid(9c48d557-92fe-4edb-95fc-bfe97e77bdc3)]
[uuid(1f7af930-a232-4a84-a049-73eaa45f2db5)]
interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
{
[notxpcom] nsIContent getOwnerContent();
};
[scriptable, uuid(6331bbca-2c9f-4766-b3c7-ae75554bf1ec)]
[scriptable, uuid(e91b0939-a74a-4c4f-8cfd-17dd42e8642a)]
interface nsITreeItemFrameMessageManager : nsIFrameMessageManager
{
readonly attribute unsigned long childCount;
nsITreeItemFrameMessageManager getChildAt(in unsigned long aIndex);
};
[scriptable, uuid(9e5c0526-aa4c-49f0-afbb-57f489cd9b59)]
[scriptable, uuid(14e1f147-793d-4788-bbbb-ae806ecdddbb)]
interface nsIChromeFrameMessageManager : nsITreeItemFrameMessageManager
{
/**

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

@ -1356,70 +1356,70 @@ nsAttrValue::StringToInteger(const nsAString& aValue, bool* aStrict,
bool aCanBePercent,
bool* aIsPercent) const
{
*aStrict = PR_FALSE;
*aStrict = true;
*aErrorCode = NS_ERROR_ILLEGAL_VALUE;
if (aCanBePercent) {
*aIsPercent = PR_FALSE;
*aIsPercent = false;
}
nsAString::const_iterator iter, end;
aValue.BeginReading(iter);
aValue.EndReading(end);
while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) {
*aStrict = false;
++iter;
}
if (iter == end) {
return 0;
}
bool negate = false;
if (*iter == PRUnichar('-')) {
negate = true;
++iter;
} else if (*iter == PRUnichar('+')) {
*aStrict = false;
++iter;
}
PRInt32 value = 0;
if (iter != end) {
if (*iter == PRUnichar('-')) {
negate = PR_TRUE;
PRInt32 pValue = 0; // Previous value, used to check integer overflow
while (iter != end) {
if (*iter >= PRUnichar('0') && *iter <= PRUnichar('9')) {
value = (value * 10) + (*iter - PRUnichar('0'));
++iter;
}
if (iter != end) {
if ((*iter >= PRUnichar('1') || (*iter == PRUnichar('0') && !negate)) &&
*iter <= PRUnichar('9')) {
value = *iter - PRUnichar('0');
++iter;
*aStrict = (value != 0 || iter == end ||
(aCanBePercent && *iter == PRUnichar('%')));
while (iter != end && *aStrict) {
if (*iter >= PRUnichar('0') && *iter <= PRUnichar('9')) {
value = (value * 10) + (*iter - PRUnichar('0'));
++iter;
if (iter != end && value > ((PR_INT32_MAX / 10) - 9)) {
*aStrict = PR_FALSE;
}
} else if (aCanBePercent && *iter == PRUnichar('%')) {
++iter;
if (iter == end) {
*aIsPercent = PR_TRUE;
} else {
*aStrict = PR_FALSE;
}
} else {
*aStrict = PR_FALSE;
}
}
if (*aStrict) {
if (negate) {
value = -value;
}
if (!aCanBePercent || !*aIsPercent) {
*aErrorCode = NS_OK;
#ifdef DEBUG
nsAutoString stringValue;
stringValue.AppendInt(value);
if (aCanBePercent && *aIsPercent) {
stringValue.AppendLiteral("%");
}
NS_ASSERTION(stringValue.Equals(aValue), "Wrong conversion!");
#endif
return value;
}
}
// Checking for integer overflow.
if (pValue > value) {
*aStrict = false;
*aErrorCode = NS_ERROR_ILLEGAL_VALUE;
break;
} else {
pValue = value;
*aErrorCode = NS_OK;
}
} else if (aCanBePercent && *iter == PRUnichar('%')) {
++iter;
*aIsPercent = true;
if (iter != end) {
*aStrict = false;
break;
}
} else {
*aStrict = false;
break;
}
}
if (negate) {
value = -value;
// Checking the special case of -0.
if (!value) {
*aStrict = false;
}
}
nsAutoString tmp(aValue);
return tmp.ToInteger(aErrorCode);
return value;
}
PRInt64

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

@ -38,8 +38,7 @@
* ***** END LICENSE BLOCK ***** */
/*
* Implementations of nsIDOMDOMStringList and nsIDOMNameList, used by various
* DOM3 stuff and some interfaces specified by WHATWG.
* Implementation of nsIDOMDOMStringList, used by various DOM stuff.
*/
#include "nsDOMLists.h"
@ -95,92 +94,3 @@ nsDOMStringList::Contains(const nsAString& aString, bool *aResult)
return NS_OK;
}
nsNameList::nsNameList()
{
}
nsNameList::~nsNameList()
{
}
DOMCI_DATA(NameList, nsNameList)
NS_IMPL_ADDREF(nsNameList)
NS_IMPL_RELEASE(nsNameList)
NS_INTERFACE_TABLE_HEAD(nsNameList)
NS_OFFSET_AND_INTERFACE_TABLE_BEGIN(nsNameList)
NS_INTERFACE_TABLE_ENTRY(nsNameList, nsIDOMNameList)
NS_OFFSET_AND_INTERFACE_TABLE_END
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(NameList)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
nsNameList::GetName(PRUint32 aIndex, nsAString& aResult)
{
if (aIndex >= mNames.Length()) {
SetDOMStringToNull(aResult);
} else {
aResult = mNames[aIndex];
}
return NS_OK;
}
NS_IMETHODIMP
nsNameList::GetNamespaceURI(PRUint32 aIndex, nsAString& aResult)
{
if (aIndex >= mNames.Length()) {
SetDOMStringToNull(aResult);
} else {
aResult = mNamespaceURIs[aIndex];
}
return NS_OK;
}
NS_IMETHODIMP
nsNameList::GetLength(PRUint32 *aLength)
{
*aLength = mNames.Length();
return NS_OK;
}
bool
nsNameList::Add(const nsAString& aNamespaceURI, const nsAString& aName)
{
PRUint32 count = mNamespaceURIs.Length();
if (mNamespaceURIs.InsertElementAt(count, aNamespaceURI)) {
if (mNames.InsertElementAt(count, aName)) {
return PR_TRUE;
}
mNamespaceURIs.RemoveElementAt(count);
}
return PR_FALSE;
}
NS_IMETHODIMP
nsNameList::Contains(const nsAString& aName, bool *aResult)
{
*aResult = mNames.Contains(aName);
return NS_OK;
}
NS_IMETHODIMP
nsNameList::ContainsNS(const nsAString& aNamespaceURI, const nsAString& aName,
bool *aResult)
{
PRUint32 index = mNames.IndexOf(aName);
if (index != mNames.NoIndex) {
*aResult = mNamespaceURIs[index].Equals(aNamespaceURI);
}
else {
*aResult = PR_FALSE;
}
return NS_OK;
}

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

@ -38,15 +38,13 @@
* ***** END LICENSE BLOCK ***** */
/*
* Implementations of nsIDOMDOMStringList and nsIDOMNameList, used by various
* DOM3 stuff and some interfaces specified by WHATWG.
* Implementation of nsIDOMDOMStringList, used by various DOM stuff.
*/
#ifndef nsDOMLists_h___
#define nsDOMLists_h___
#include "nsIDOMDOMStringList.h"
#include "nsIDOMNameList.h"
#include "nsTArray.h"
#include "nsString.h"
@ -68,20 +66,4 @@ private:
nsTArray<nsString> mNames;
};
class nsNameList : public nsIDOMNameList
{
public:
nsNameList();
virtual ~nsNameList();
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMNAMELIST
bool Add(const nsAString& aNamespaceURI, const nsAString& aName);
private:
nsTArray<nsString> mNamespaceURIs;
nsTArray<nsString> mNames;
};
#endif /* nsDOMLists_h___ */

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

@ -4493,11 +4493,6 @@ nsDocument::CreateProcessingInstruction(const nsAString& aTarget,
{
*aReturn = nsnull;
// There are no PIs for HTML
if (IsHTML()) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
nsresult rv = nsContentUtils::CheckQName(aTarget, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
@ -5893,23 +5888,6 @@ nsDocument::GetInputEncoding(nsAString& aInputEncoding)
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetXmlEncoding(nsAString& aXmlEncoding)
{
WarnOnceAbout(eXmlEncoding);
if (!IsHTML() &&
mXMLDeclarationBits & XML_DECLARATION_BITS_DECLARATION_EXISTS &&
mXMLDeclarationBits & XML_DECLARATION_BITS_ENCODING_EXISTS) {
// XXX We don't store the encoding given in the xml declaration.
// For now, just output the inputEncoding which we do store.
GetInputEncoding(aXmlEncoding);
} else {
SetDOMStringToNull(aXmlEncoding);
}
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetXmlStandalone(bool *aXmlStandalone)
{

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

@ -113,17 +113,17 @@
#include "ContentParent.h"
#include "TabParent.h"
#include "mozilla/layout/RenderFrameParent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
#include "jsapi.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace mozilla::layout;
typedef FrameMetrics::ViewID ViewID;
#include "jsapi.h"
class nsAsyncDocShellDestroyer : public nsRunnable
{
public:
@ -315,7 +315,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFrameLoader)
NS_INTERFACE_MAP_END
nsFrameLoader::nsFrameLoader(nsIContent *aOwner, bool aNetworkCreated)
nsFrameLoader::nsFrameLoader(Element* aOwner, bool aNetworkCreated)
: mOwnerContent(aOwner)
, mDepthTooGreat(PR_FALSE)
, mIsTopLevelContent(PR_FALSE)
@ -336,7 +336,7 @@ nsFrameLoader::nsFrameLoader(nsIContent *aOwner, bool aNetworkCreated)
}
nsFrameLoader*
nsFrameLoader::Create(nsIContent* aOwner, bool aNetworkCreated)
nsFrameLoader::Create(Element* aOwner, bool aNetworkCreated)
{
NS_ENSURE_TRUE(aOwner, nsnull);
nsIDocument* doc = aOwner->GetOwnerDoc();
@ -962,8 +962,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
"Swapping some sort of random loaders?");
NS_ENSURE_STATE(!mInShow && !aOther->mInShow);
nsIContent* ourContent = mOwnerContent;
nsIContent* otherContent = aOther->mOwnerContent;
Element* ourContent = mOwnerContent;
Element* otherContent = aOther->mOwnerContent;
if (!ourContent || !otherContent) {
// Can't handle this
@ -1337,7 +1337,7 @@ nsFrameLoader::GetDepthTooGreat(bool* aDepthTooGreat)
}
void
nsFrameLoader::SetOwnerContent(nsIContent* aContent)
nsFrameLoader::SetOwnerContent(Element* aContent)
{
mOwnerContent = aContent;
if (RenderFrameParent* rfp = GetCurrentRemoteFrame()) {

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

@ -53,7 +53,7 @@
#include "nsAutoPtr.h"
#include "nsFrameMessageManager.h"
#include "Layers.h"
#include "nsIContent.h"
#include "mozilla/dom/Element.h"
class nsIURI;
class nsSubDocumentFrame;
@ -170,7 +170,7 @@ class nsFrameLoader : public nsIFrameLoader,
typedef mozilla::layout::RenderFrameParent RenderFrameParent;
protected:
nsFrameLoader(nsIContent *aOwner, bool aNetworkCreated);
nsFrameLoader(mozilla::dom::Element* aOwner, bool aNetworkCreated);
public:
~nsFrameLoader() {
@ -186,7 +186,8 @@ public:
return !!(mRenderMode & RENDER_MODE_ASYNC_SCROLL);
}
static nsFrameLoader* Create(nsIContent* aOwner, bool aNetworkCreated);
static nsFrameLoader* Create(mozilla::dom::Element* aOwner,
bool aNetworkCreated);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
@ -279,8 +280,8 @@ public:
}
nsFrameMessageManager* GetFrameMessageManager() { return mMessageManager; }
nsIContent* GetOwnerContent() { return mOwnerContent; }
void SetOwnerContent(nsIContent* aContent);
mozilla::dom::Element* GetOwnerContent() { return mOwnerContent; }
void SetOwnerContent(mozilla::dom::Element* aContent);
private:
@ -313,7 +314,7 @@ private:
nsCOMPtr<nsIDocShell> mDocShell;
nsCOMPtr<nsIURI> mURIToLoad;
nsIContent *mOwnerContent; // WEAK
mozilla::dom::Element* mOwnerContent; // WEAK
public:
// public because a callback needs these.
nsRefPtr<nsFrameMessageManager> mMessageManager;

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

@ -1,4 +1,4 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* -*- 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
*
@ -15,11 +15,12 @@
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ms2ger <ms2ger@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -188,91 +189,60 @@ static JSBool
JSONCreator(const jschar* aBuf, uint32 aLen, void* aData)
{
nsAString* result = static_cast<nsAString*>(aData);
result->Append((PRUnichar*)aBuf, (PRUint32)aLen);
return JS_TRUE;
result->Append(static_cast<const PRUnichar*>(aBuf),
static_cast<PRUint32>(aLen));
return true;
}
nsresult
nsFrameMessageManager::GetParamsForMessage(nsAString& aMessageName,
void
nsFrameMessageManager::GetParamsForMessage(const jsval& aObject,
JSContext* aCx,
nsAString& aJSON)
{
aMessageName.Truncate();
aJSON.Truncate();
nsAXPCNativeCallContext* ncc = nsnull;
nsresult rv = nsContentUtils::XPConnect()->GetCurrentNativeCallContext(&ncc);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_STATE(ncc);
JSContext* ctx = nsnull;
rv = ncc->GetJSContext(&ctx);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 argc;
jsval* argv = nsnull;
ncc->GetArgc(&argc);
ncc->GetArgvPtr(&argv);
JSAutoRequest ar(ctx);
JSString* str;
if (argc && (str = JS_ValueToString(ctx, argv[0])) && str) {
nsDependentJSString depStr;
if (!depStr.init(ctx, str)) {
return NS_ERROR_OUT_OF_MEMORY;
}
aMessageName.Assign(depStr);
}
if (argc >= 2) {
jsval v = argv[1];
JS_Stringify(ctx, &v, nsnull, JSVAL_NULL, JSONCreator, &aJSON);
}
return NS_OK;
JSAutoRequest ar(aCx);
jsval v = aObject;
JS_Stringify(aCx, &v, nsnull, JSVAL_NULL, JSONCreator, &aJSON);
}
NS_IMETHODIMP
nsFrameMessageManager::SendSyncMessage()
nsFrameMessageManager::SendSyncMessage(const nsAString& aMessageName,
const jsval& aObject,
JSContext* aCx,
PRUint8 aArgc,
jsval* aRetval)
{
NS_ASSERTION(!IsGlobal(), "Should not call SendSyncMessage in chrome");
NS_ASSERTION(!IsWindowLevel(), "Should not call SendSyncMessage in chrome");
NS_ASSERTION(!mParentManager, "Should not have parent manager in content!");
*aRetval = JSVAL_VOID;
if (mSyncCallback) {
NS_ENSURE_TRUE(mCallbackData, NS_ERROR_NOT_INITIALIZED);
nsString messageName;
nsString json;
nsresult rv = GetParamsForMessage(messageName, json);
NS_ENSURE_SUCCESS(rv, rv);
if (aArgc >= 2) {
GetParamsForMessage(aObject, aCx, json);
}
InfallibleTArray<nsString> retval;
if (mSyncCallback(mCallbackData, messageName, json, &retval)) {
nsAXPCNativeCallContext* ncc = nsnull;
rv = nsContentUtils::XPConnect()->GetCurrentNativeCallContext(&ncc);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_STATE(ncc);
JSContext* ctx = nsnull;
rv = ncc->GetJSContext(&ctx);
NS_ENSURE_SUCCESS(rv, rv);
JSAutoRequest ar(ctx);
if (mSyncCallback(mCallbackData, aMessageName, json, &retval)) {
JSAutoRequest ar(aCx);
PRUint32 len = retval.Length();
JSObject* dataArray = JS_NewArrayObject(ctx, len, NULL);
JSObject* dataArray = JS_NewArrayObject(aCx, len, NULL);
NS_ENSURE_TRUE(dataArray, NS_ERROR_OUT_OF_MEMORY);
for (PRUint32 i = 0; i < len; ++i) {
if (retval[i].IsEmpty())
if (retval[i].IsEmpty()) {
continue;
}
jsval ret = JSVAL_VOID;
if (!JS_ParseJSON(ctx, (jschar*)retval[i].get(),
(uint32)retval[i].Length(), &ret)) {
if (!JS_ParseJSON(aCx, static_cast<const jschar*>(retval[i].get()),
retval[i].Length(), &ret)) {
return NS_ERROR_UNEXPECTED;
}
NS_ENSURE_TRUE(JS_SetElement(ctx, dataArray, i, &ret), NS_ERROR_OUT_OF_MEMORY);
NS_ENSURE_TRUE(JS_SetElement(aCx, dataArray, i, &ret), NS_ERROR_OUT_OF_MEMORY);
}
jsval* retvalPtr;
ncc->GetRetValPtr(&retvalPtr);
*retvalPtr = OBJECT_TO_JSVAL(dataArray);
ncc->SetReturnValueWasSet(PR_TRUE);
*aRetval = OBJECT_TO_JSVAL(dataArray);
}
}
return NS_OK;
@ -295,13 +265,16 @@ nsFrameMessageManager::SendAsyncMessageInternal(const nsAString& aMessage,
}
NS_IMETHODIMP
nsFrameMessageManager::SendAsyncMessage()
nsFrameMessageManager::SendAsyncMessage(const nsAString& aMessageName,
const jsval& aObject,
JSContext* aCx,
PRUint8 aArgc)
{
nsString messageName;
nsString json;
nsresult rv = GetParamsForMessage(messageName, json);
NS_ENSURE_SUCCESS(rv, rv);
return SendAsyncMessageInternal(messageName, json);
if (aArgc >= 2) {
GetParamsForMessage(aObject, aCx, json);
}
return SendAsyncMessageInternal(aMessageName, json);
}
NS_IMETHODIMP
@ -428,14 +401,14 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
jsval json = JSVAL_NULL;
if (!aJSON.IsEmpty()) {
if (!JS_ParseJSON(ctx, (jschar*)nsString(aJSON).get(),
(uint32)aJSON.Length(), &json)) {
if (!JS_ParseJSON(ctx, static_cast<const jschar*>(PromiseFlatString(aJSON).get()),
aJSON.Length(), &json)) {
json = JSVAL_NULL;
}
}
JSString* jsMessage =
JS_NewUCStringCopyN(ctx,
reinterpret_cast<const jschar *>(nsString(aMessage).get()),
static_cast<const jschar*>(PromiseFlatString(aMessage).get()),
aMessage.Length());
NS_ENSURE_TRUE(jsMessage, NS_ERROR_OUT_OF_MEMORY);
JS_DefineProperty(ctx, param, "target", targetv, NULL, NULL, JSPROP_ENUMERATE);

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

@ -150,7 +150,9 @@ public:
void Disconnect(bool aRemoveFromParent = true);
void SetCallbackData(void* aData, bool aLoadScripts = true);
nsresult GetParamsForMessage(nsAString& aMessageName, nsAString& aJSON);
void GetParamsForMessage(const jsval& aObject,
JSContext* aCx,
nsAString& aJSON);
nsresult SendAsyncMessageInternal(const nsAString& aMessage,
const nsAString& aJSON);
JSContext* GetJSContext() { return mContext; }

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

@ -840,81 +840,6 @@ nsGenericDOMDataNode::GetWholeText(nsAString& aWholeText)
return NS_OK;
}
nsresult
nsGenericDOMDataNode::ReplaceWholeText(const nsAString& aContent,
nsIDOMText **aResult)
{
*aResult = nsnull;
GetOwnerDoc()->WarnOnceAbout(nsIDocument::eReplaceWholeText);
// Handle parent-less nodes
nsCOMPtr<nsIContent> parent = GetParent();
if (!parent) {
if (aContent.IsEmpty()) {
return NS_OK;
}
SetNodeValue(aContent);
return CallQueryInterface(this, aResult);
}
// We're relying on mozAutoSubtreeModified to keep the doc alive here.
nsIDocument* doc = GetOwnerDoc();
// Batch possible DOMSubtreeModified events.
mozAutoSubtreeModified subtree(doc, nsnull);
PRInt32 index = parent->IndexOf(this);
if (index < 0) {
NS_WARNING("Trying to use .replaceWholeText with an anonymous text node "
"child of a binding parent?");
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
// We don't support entity references or read-only nodes, so remove the
// logically adjacent text nodes (which therefore must all be siblings of
// this) and set this one to the provided text, if that text isn't empty.
PRInt32 first =
FirstLogicallyAdjacentTextNode(parent, index);
PRInt32 last =
LastLogicallyAdjacentTextNode(parent, index, parent->GetChildCount());
// Fire mutation events. Optimize the common case of there being no
// listeners
if (nsContentUtils::
HasMutationListeners(doc, NS_EVENT_BITS_MUTATION_NODEREMOVED)) {
for (PRInt32 i = first; i <= last; ++i) {
nsCOMPtr<nsIContent> child = parent->GetChildAt((PRUint32)i);
if (child &&
(i != index || aContent.IsEmpty())) {
nsContentUtils::MaybeFireNodeRemoved(child, parent, doc);
}
}
}
// Remove the needed nodes
// Don't want to use 'doc' here since it might no longer be the correct
// document.
mozAutoDocUpdate updateBatch(parent->GetCurrentDoc(), UPDATE_CONTENT_MODEL,
PR_TRUE);
do {
if (last == index && !aContent.IsEmpty())
continue;
parent->RemoveChildAt(last, PR_TRUE);
} while (last-- > first);
// Empty string means we removed this node too.
if (aContent.IsEmpty()) {
return NS_OK;
}
SetText(aContent.BeginReading(), aContent.Length(), PR_TRUE);
return CallQueryInterface(this, aResult);
}
//----------------------------------------------------------------------
// Implementation of the nsIContent interface text functions

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

@ -330,8 +330,6 @@ protected:
nsresult GetWholeText(nsAString& aWholeText);
nsresult ReplaceWholeText(const nsAString& aContent, nsIDOMText **aReturn);
nsresult GetIsElementContentWhitespace(bool *aReturn)
{
GetOwnerDoc()->WarnOnceAbout(nsIDocument::eIsElementContentWhitespace);

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

@ -66,10 +66,15 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsInProcessTabChildGlobal,
nsDOMEventTargetHelper)
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager)
NS_IMETHOD SendSyncMessage()
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
const jsval& aObject,
JSContext* aCx,
PRUint8 aArgc,
jsval* aRetval)
{
return mMessageManager ? mMessageManager->SendSyncMessage()
: NS_ERROR_NULL_POINTER;
return mMessageManager
? mMessageManager->SendSyncMessage(aMessageName, aObject, aCx, aArgc, aRetval)
: NS_ERROR_NULL_POINTER;
}
NS_IMETHOD GetContent(nsIDOMWindow** aContent);
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell);

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

@ -638,7 +638,8 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
break;
case eType_Document: {
if (!mFrameLoader) {
mFrameLoader = nsFrameLoader::Create(thisContent, mNetworkCreated);
mFrameLoader = nsFrameLoader::Create(thisContent->AsElement(),
mNetworkCreated);
if (!mFrameLoader) {
Fallback(PR_FALSE);
return NS_ERROR_UNEXPECTED;
@ -1277,7 +1278,8 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
// Must have a frameloader before creating a frame, or the frame will
// create its own.
if (!mFrameLoader && newType == eType_Document) {
mFrameLoader = nsFrameLoader::Create(thisContent, mNetworkCreated);
mFrameLoader = nsFrameLoader::Create(thisContent->AsElement(),
mNetworkCreated);
if (!mFrameLoader) {
mURI = nsnull;
return NS_OK;
@ -1979,8 +1981,8 @@ nsObjectLoadingContent::CreateStaticClone(nsObjectLoadingContent* aDest) const
if (mFrameLoader) {
nsCOMPtr<nsIContent> content =
do_QueryInterface(static_cast<nsIImageLoadingContent*>((aDest)));
nsFrameLoader* fl = nsFrameLoader::Create(content, PR_FALSE);
do_QueryInterface(static_cast<nsIImageLoadingContent*>(aDest));
nsFrameLoader* fl = nsFrameLoader::Create(content->AsElement(), PR_FALSE);
if (fl) {
aDest->mFrameLoader = fl;
mFrameLoader->CreateStaticClone(fl);

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

@ -1401,10 +1401,7 @@ nsXMLHttpRequest::DispatchProgressEvent(nsDOMEventTargetHelper* aTarget,
if (aUseLSEventWrapper) {
nsCOMPtr<nsIDOMProgressEvent> xhrprogressEvent =
new nsXMLHttpProgressEvent(progress, aPosition, aTotalSize);
if (!xhrprogressEvent) {
return;
}
new nsXMLHttpProgressEvent(progress, aPosition, aTotalSize, mOwner);
event = xhrprogressEvent;
}
aTarget->DispatchDOMEvent(nsnull, event, nsnull, nsnull);
@ -3240,7 +3237,9 @@ nsHeaderVisitor::VisitHeader(const nsACString &header, const nsACString &value)
// DOM event class to handle progress notifications
nsXMLHttpProgressEvent::nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner,
PRUint64 aCurrentProgress,
PRUint64 aMaxProgress)
PRUint64 aMaxProgress,
nsPIDOMWindow* aWindow)
: mWindow(aWindow)
{
mInner = static_cast<nsDOMProgressEvent*>(aInner);
mCurProgress = aCurrentProgress;
@ -3270,11 +3269,13 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXMLHttpProgressEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXMLHttpProgressEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mInner);
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mWindow);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXMLHttpProgressEvent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mInner,
nsIDOMProgressEvent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mWindow);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMETHODIMP nsXMLHttpProgressEvent::GetInput(nsIDOMLSInput * *aInput)
@ -3283,8 +3284,23 @@ NS_IMETHODIMP nsXMLHttpProgressEvent::GetInput(nsIDOMLSInput * *aInput)
return NS_ERROR_NOT_IMPLEMENTED;
}
void
nsXMLHttpProgressEvent::WarnAboutLSProgressEvent(nsIDocument::DeprecatedOperations aOperation)
{
if (!mWindow) {
return;
}
nsCOMPtr<nsIDocument> document =
do_QueryInterface(mWindow->GetExtantDocument());
if (!document) {
return;
}
document->WarnOnceAbout(aOperation);
}
NS_IMETHODIMP nsXMLHttpProgressEvent::GetPosition(PRUint32 *aPosition)
{
WarnAboutLSProgressEvent(nsIDocument::ePosition);
// XXX can we change the iface?
LL_L2UI(*aPosition, mCurProgress);
return NS_OK;
@ -3292,8 +3308,8 @@ NS_IMETHODIMP nsXMLHttpProgressEvent::GetPosition(PRUint32 *aPosition)
NS_IMETHODIMP nsXMLHttpProgressEvent::GetTotalSize(PRUint32 *aTotalSize)
{
WarnAboutLSProgressEvent(nsIDocument::eTotalSize);
// XXX can we change the iface?
LL_L2UI(*aTotalSize, mMaxProgress);
return NS_OK;
}

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

@ -380,7 +380,8 @@ class nsXMLHttpProgressEvent : public nsIDOMProgressEvent,
public:
nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner,
PRUint64 aCurrentProgress,
PRUint64 aMaxProgress);
PRUint64 aMaxProgress,
nsPIDOMWindow* aWindow);
virtual ~nsXMLHttpProgressEvent();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -421,9 +422,12 @@ public:
}
protected:
void WarnAboutLSProgressEvent(nsIDocument::DeprecatedOperations);
// Use nsDOMProgressEvent so that we can forward
// most of the method calls easily.
nsRefPtr<nsDOMProgressEvent> mInner;
nsCOMPtr<nsPIDOMWindow> mWindow;
PRUint64 mCurProgress;
PRUint64 mMaxProgress;
};

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

@ -231,7 +231,6 @@ _TEST_FILES1 = \
test_bug438519.html \
test_bug444722.html \
test_bug451376.html \
test_text_replaceWholeText.html \
test_text_wholeText.html \
test_bug433533.html \
wholeTexty-helper.xml \

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

@ -87,10 +87,32 @@ function testPI(aTarget, aData, aShouldSucceed, aReason)
{
try {
var pi = document.createProcessingInstruction(aTarget, aData);
ok(0, "Invalid processing instruction creation",
"Shouldn't create processing instructions in HTML");
var types = [ ProcessingInstruction, Node ];
checkTypes(pi, "processing instruction", types);
var interfaces = [ "nsIDOMProcessingInstruction", "nsIDOMNode",
"nsIDOMEventTarget" ];
checkInterfaces(pi, "processing instruction", interfaces);
is(pi.target, aTarget, "Check target");
is(pi.data, aData, "Check data");
is(pi.nodeName, aTarget, "Check nodeName");
is(pi.nodeValue, aData, "Check nodeValue");
is(pi.localName, null, "Check localName")
is(pi.namespaceURI, null, "Check namespaceURI");
is(pi.nodeType, Node.PROCESSING_INSTRUCTION_NODE, "Check nodeType");
if (!aShouldSucceed) {
ok(false, "Invalid processing instruction creation", aReason);
}
} catch (e) {
is(e.code, DOMException.NOT_SUPPORTED_ERR, "Check exception code");
if (aShouldSucceed) {
ok(false, "Correct functioning of processing instruction stuff",
"something broke: " + e);
} else {
is(e.code, DOMException.INVALID_CHARACTER_ERR, "Check exception code");
}
}
}

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

@ -59,32 +59,31 @@ function xhrDoc(idx) {
}
// Each row has the document getter function, then the characterSet,
// inputEncoding, xmlEncoding expected for that document.
// inputEncoding expected for that document.
var tests = [
[ frameDoc("one"), "ISO-8859-1", "ISO-8859-1", null ],
[ frameDoc("two"), "UTF-8", "UTF-8", null ],
[ frameDoc("three"), "ISO-8859-1", "ISO-8859-1", null ],
[ frameDoc("four"), "UTF-8", "UTF-8", null ],
[ frameDoc("five"), "UTF-8", "UTF-8", null ],
[ frameDoc("six"), "UTF-8", "UTF-8", "UTF-8"],
[ frameDoc("seven"), "ISO-8859-1", "ISO-8859-1", "ISO-8859-1" ],
[ createDoc, "UTF-8", null, null ],
[ xhrDoc(4), "UTF-8", "UTF-8", null ],
[ xhrDoc(5), "UTF-8", "UTF-8", "UTF-8" ],
[ xhrDoc(6), "ISO-8859-1", "ISO-8859-1", "ISO-8859-1" ],
[ frameDoc("one"), "ISO-8859-1", "ISO-8859-1" ],
[ frameDoc("two"), "UTF-8", "UTF-8" ],
[ frameDoc("three"), "ISO-8859-1", "ISO-8859-1" ],
[ frameDoc("four"), "UTF-8", "UTF-8" ],
[ frameDoc("five"), "UTF-8", "UTF-8" ],
[ frameDoc("six"), "UTF-8", "UTF-8" ],
[ frameDoc("seven"), "ISO-8859-1", "ISO-8859-1" ],
[ createDoc, "UTF-8", null ],
[ xhrDoc(4), "UTF-8", "UTF-8" ],
[ xhrDoc(5), "UTF-8", "UTF-8" ],
[ xhrDoc(6), "ISO-8859-1", "ISO-8859-1" ],
];
function doTest(idx) {
var [docGetter, expectedCharacterSet,
expectedInputEncoding, expectedXMLEncoding] = tests[idx];
expectedInputEncoding] = tests[idx];
var doc = docGetter();
// Have to be careful here to catch null vs ""
is(doc.characterSet, expectedCharacterSet, "Test " + idx + " characterSet");
is(doc.inputEncoding, expectedInputEncoding,
"Test " + idx + " inputEncoding");
is(doc.xmlEncoding, expectedXMLEncoding, "Test " + idx + " xmlEncoding");
}
addLoadEvent(function() {

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

@ -35,15 +35,6 @@ function doTest() {
}
ok(hadException,
"Should have got an exception when using .wholeText with a text node child of the binding parent");
hadException = false;
try {
anonTextNode.replaceWholeText("foobar");
} catch(e) {
hadException = true;
}
ok(hadException,
"Should have got an exception when using .replaceWholeText with a text node child of the binding parent");
SimpleTest.finish();
}

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

@ -1,256 +0,0 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=421765
-->
<head>
<title>Text.replaceWholeText tests</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=421765">Mozilla Bug 421765</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<iframe id="xmlDocument" src="wholeTexty-helper.xml"></iframe>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 421765 **/
SimpleTest.waitForExplicitFinish();
var xmlDoc;
function text(t) { return document.createTextNode(t); }
function element() { return document.createElement("div"); }
function cdata(t)
{
xmlDoc = $("xmlDocument").contentDocument;
// document.createCDATASection isn't implemented; clone for the win
var node = xmlDoc.documentElement.firstChild.cloneNode(false);
is(node.nodeType, Node.CDATA_SECTION_NODE,
"er, why isn't this a CDATA section node?");
node.data = t;
return node;
}
function startTests()
{
var outer = element();
var first = text("first");
var second = element();
second.appendChild(text("element contents"));
outer.appendChild(first);
outer.appendChild(second);
is(first.wholeText, "first", "wrong initial wholeText");
is(first.replaceWholeText("start"), first,
"should have gotten first back");
is(first.data, "start", "should have modified first's data");
is(first.wholeText, "start", "should have gotten new wholeText");
var cdataNode = cdata("-cdata");
outer.insertBefore(cdataNode, second);
is(first.wholeText, "start-cdata",
"should have gotten first+cdataNode as wholeText");
var outer2 = outer.cloneNode(true); // save
is(first.replaceWholeText("first"), first,
"replaceWholeText on first returned wrong object");
is(first.nodeType, Node.TEXT_NODE, "node changed type?");
is(first.data, "first", "wrong data in first");
is(first.previousSibling, null, "wrong previousSibling for first");
is(first.nextSibling, second, "wrong nextSibling for first");
is(cdataNode.previousSibling, null, "wrong previousSibling for cdataNode");
is(cdataNode.nextSibling, null, "wrong nextSibling for cdataNode");
ok(first.replaceWholeText("") === null,
"empty string should cause a return of null");
is(first.data, "first", "wrong data after replacing with empty string");
is(outer.firstChild, second, "replaceWholeText('') removes the node");
// switcheroo, with sanity tests
outer = outer2;
is(outer.nodeType, Node.ELEMENT_NODE, "outer not element?");
first = outer.firstChild;
is(first.nodeType, Node.TEXT_NODE, "first not text?");
cdataNode = first.nextSibling;
is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "cdataNode not cdata?");
second = outer.lastChild;
is(second.nodeType, Node.ELEMENT_NODE, "second not element?");
is(cdataNode.replaceWholeText("cdata"), cdataNode,
"replaceWholeText on cdataNode returned wrong object");
is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "node changed type?");
is(cdataNode.nodeValue, "cdata", "wrong node value?");
is(cdataNode.previousSibling, null, "wrong previousSibling");
is(cdataNode.nextSibling, second, "wrong nextSibling");
ok(cdataNode.replaceWholeText("") === null,
"empty string should cause a return of null");
is(cdataNode.data, "cdata", "wrong data after replacing with empty string");
is(outer.firstChild, second, "should be no more text at start");
}
function middleTests()
{
var outer = element();
var first = element();
var middle = text("middle");
var last = element();
first.appendChild(text("first element contents"));
last.appendChild(text("last element contents"));
outer.appendChild(first);
outer.appendChild(middle);
outer.appendChild(last);
is(middle.wholeText, "middle", "wrong initial wholeText");
is(middle.replaceWholeText("center"), middle,
"should have gotten middle back");
is(middle.data, "center", "should have modified middle's data");
is(middle.wholeText, "center", "should have gotten new wholeText");
var cdataNode = cdata("-cdata");
outer.insertBefore(cdataNode, last);
is(middle.wholeText, "center-cdata",
"should have gotten middle+cdataNode as wholeText");
var outer2 = outer.cloneNode(true); // save
is(middle.replaceWholeText("middle"), middle,
"replaceWholeText on middle returned wrong object");
is(middle.nodeType, Node.TEXT_NODE, "node changed type?");
is(middle.data, "middle", "wrong data in middle");
is(middle.previousSibling, first, "wrong previousSibling");
is(middle.nextSibling, last, "wrong nextSibling");
ok(middle.replaceWholeText("") === null,
"empty string should cause a return of null");
is(middle.data, "middle", "wrong data after replacing with empty string");
// switcheroo, with sanity tests
outer = outer2;
is(outer.nodeType, Node.ELEMENT_NODE, "outer not element?");
first = outer.firstChild;
is(first.nodeType, Node.ELEMENT_NODE, "first not element?");
middle = first.nextSibling;
is(middle.nodeType, Node.TEXT_NODE, "middle not text?");
cdataNode = middle.nextSibling;
is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "cdataNode not cdata?");
last = outer.lastChild;
is(last.nodeType, Node.ELEMENT_NODE, "last not element?");
is(cdataNode.replaceWholeText("cdata"), cdataNode,
"replaceWholeText on cdataNode returned wrong object");
is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "node changed type?");
is(cdataNode.nodeValue, "cdata", "wrong node value?");
is(cdataNode.previousSibling, first, "wrong previousSibling");
is(cdataNode.nextSibling, last, "wrong nextSibling");
ok(cdataNode.replaceWholeText("") === null,
"empty string should cause a return of null");
is(cdataNode.data, "cdata", "wrong data after replacing with empty string");
is(middle.wholeText, "center", "wrong wholeText after removal");
is(first.nextSibling, last, "wrong nextSibling");
is(last.previousSibling, first, "wrong previousSibling");
}
function endTests()
{
var outer = element();
var first = element();
var second = text("second");
first.appendChild(text("element contents"));
outer.appendChild(first);
outer.appendChild(second);
is(second.wholeText, "second", "wrong initial wholeText");
is(second.replaceWholeText("end"), second,
"should have gotten second back");
is(second.data, "end", "should have modified second's data");
is(second.wholeText, "end", "should have gotten new wholeText");
var cdataNode = cdata("cdata-");
outer.insertBefore(cdataNode, second);
is(second.wholeText, "cdata-end",
"should have gotten cdataNode+second as wholeText");
is(cdataNode.wholeText, "cdata-end",
"should have gotten cdataNode+second as wholeText");
var outer2 = outer.cloneNode(true); // save
is(second.replaceWholeText("second"), second,
"replaceWholeText on second returned wrong object");
is(second.nodeType, Node.TEXT_NODE, "node changed type?");
is(second.data, "second", "wrong data in second");
is(second.previousSibling, first, "wrong previousSibling for second");
is(second.nextSibling, null, "wrong nextSibling for second");
is(cdataNode.previousSibling, null, "wrong previousSibling for cdataNode");
is(cdataNode.nextSibling, null, "wrong nextSibling for cdataNode");
ok(second.replaceWholeText("") === null,
"empty string should cause a return of null");
is(second.data, "second", "wrong data after replacing with empty string");
is(outer.lastChild, first, "replaceWholeText('') removes the node");
// switcheroo, with sanity tests
outer = outer2;
is(outer.nodeType, Node.ELEMENT_NODE, "outer not element?");
first = outer.firstChild;
is(first.nodeType, Node.ELEMENT_NODE, "first not element?");
cdataNode = first.nextSibling;
is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "cdataNode not cdata?");
second = outer.lastChild;
is(second.nodeType, Node.TEXT_NODE, "middle not text?");
is(cdataNode.replaceWholeText("cdata"), cdataNode,
"replaceWholeText on cdataNode returned wrong object");
is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "node changed type?");
is(cdataNode.nodeValue, "cdata", "wrong node value?");
is(cdataNode.previousSibling, first, "wrong previousSibling for cdataNode");
is(cdataNode.nextSibling, null, "wrong nextSibling for cdataNode");
is(second.previousSibling, null, "wrong previousSibling for second");
is(second.nextSibling, null, "wrong nextSibling for second");
ok(cdataNode.replaceWholeText("") === null,
"empty string should cause a return of null");
is(cdataNode.data, "cdata", "wrong data after replacing with empty string");
is(outer.lastChild, first, "should be no more text at end");
}
function test()
{
try
{
startTests();
middleTests();
endTests();
}
catch (e)
{
ok(false, "exception thrown: " + e);
}
finally
{
SimpleTest.finish();
}
}
window.addEventListener("load", test, false);
</script>
</pre>
</body>
</html>

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

@ -20190,7 +20190,7 @@ function test_size_attributes_parse_badsuffix() {
var canvas = document.getElementById('c637');
var ctx = canvas.getContext('2d');
todo(canvas.width == 100, "canvas.width == 100");
is(canvas.width, 100, "canvas.width == 100");
}
@ -20400,7 +20400,7 @@ var canvas = document.getElementById('c648');
var ctx = canvas.getContext('2d');
canvas.setAttribute('width', '100foo');
todo(canvas.width == 100, "canvas.width == 100");
is(canvas.width, 100, "canvas.width == 100");
}

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

@ -209,22 +209,6 @@ check();
is(children.length, 0, "should have received DOMNodeRemoved for all frag children when appending");
is(frag.childNodes.length, 0, "fragment should be empty when appending");
testName = "prepare replaceWholeText";
var textNode;
root.appendChild(document.createTextNode("hello"));
root.appendChild(document.createTextNode(""));
root.appendChild(textNode = document.createTextNode("world"));
root.appendChild(document.createTextNode("fahrvergnugen"));
root.appendChild(document.createTextNode(""));
root.appendChild(document.createElement("div"));
root.appendChild(document.createTextNode("smorgasbord"));
root.appendChild(document.createTextNode(""));
check();
testName = "run replaceWholeText";
textNode.replaceWholeText("supercalifragilisticexpialidocious");
check();
</script>
</body>
</html>

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

@ -68,8 +68,6 @@ public:
TableRowsCollection(nsHTMLTableElement *aParent);
virtual ~TableRowsCollection();
nsresult Init();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIDOMHTMLCOLLECTION
@ -83,13 +81,18 @@ public:
protected:
// Those rows that are not in table sections
nsHTMLTableElement* mParent;
nsRefPtr<nsContentList> mOrphanRows;
nsHTMLTableElement * mParent;
};
TableRowsCollection::TableRowsCollection(nsHTMLTableElement *aParent)
: mParent(aParent)
, mOrphanRows(new nsContentList(mParent,
mParent->NodeInfo()->NamespaceID(),
nsGkAtoms::tr,
nsGkAtoms::tr,
PR_FALSE))
{
}
@ -118,17 +121,6 @@ NS_INTERFACE_TABLE_HEAD(TableRowsCollection)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HTMLCollection)
NS_INTERFACE_MAP_END
nsresult
TableRowsCollection::Init()
{
mOrphanRows = new nsContentList(mParent,
mParent->NodeInfo()->NamespaceID(),
nsGkAtoms::tr,
nsGkAtoms::tr,
PR_FALSE);
return NS_OK;
}
// Macro that can be used to avoid copy/pasting code to iterate over the
// rowgroups. _code should be the code to execute for each rowgroup. The
// rowgroup's rows will be in the nsIDOMHTMLCollection* named "rows". Note
@ -499,15 +491,7 @@ NS_IMETHODIMP
nsHTMLTableElement::GetRows(nsIDOMHTMLCollection** aValue)
{
if (!mRows) {
// XXX why was this here NS_ADDREF(nsGkAtoms::tr);
mRows = new TableRowsCollection(this);
NS_ENSURE_TRUE(mRows, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = mRows->Init();
if (NS_FAILED(rv)) {
mRows = nsnull;
return rv;
}
}
*aValue = mRows;

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

@ -462,11 +462,6 @@ function reflectBoolean(aParameters)
*/
function reflectInt(aParameters)
{
//TBD: Bug 673820: .setAttribute(exponential) -> incorrect reflection for element[attr]
function testExponential(value) {
return !!/^[ \t\n\f\r]*[\+\-]?[0-9]+e[0-9]+/.exec(value);
}
// Expected value returned by .getAttribute() when |value| has been previously passed to .setAttribute().
function expectedGetAttributeResult(value) {
return (value !== null) ? String(value) : "";
@ -556,34 +551,10 @@ function reflectInt(aParameters)
//TBD: Bug 586761: .setAttribute(attr, -2147483648) --> element[attr] == defaultValue instead of -2147483648
todo_is(element[attr], intValue, "Bug 586761: " + element.localName +
".setAttribute(value, " + v + "), " + element.localName + "[" + attr + "] ");
} else if (testExponential(v)) {
//TBD: Bug 673820: .setAttribute(exponential) -> incorrect reflection for element[attr]
todo_is(element[attr], intValue, "Bug 673820: " + element.localName +
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
} else if (v == "why 567 what") {
//TBD: Bug 679672: .setAttribute() is somehow able to parse "why 567 what" into "567"
todo_is(element[attr], intValue, "Bug 679672: " + element.localName +
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
} else if (v === "-0" && nonNegative) {
} else if ((v === "-0" || v == "-0xABCDEF") && nonNegative) {
//TBD: Bug 688093: Non-negative integers should return defaultValue when attempting to reflect "-0"
todo_is(element[attr], intValue, "Bug 688093: " + element.localName +
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
} else if (v == "+42foo") {
//TBD: Bug: Unable to correctly parse "+" character in front of string
todo_is(element[attr], intValue, "Bug: " + element.localName +
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
} else if (v == "0x10FFFF" && defaultValue != 0) {
//TBD: Bug: Integer attributes should parse "0x10FFFF" as 0, but instead incorrectly return defaultValue
todo_is(element[attr], intValue, "Bug: " + element.localName +
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
} else if (v == "-0xABCDEF" && !nonNegative && defaultValue != 0) {
//TBD: Bug: Signed integer attributes should parse "-0xABCDEF" as -0, but instead incorrectly return defaultValue
todo_is(element[attr], intValue, "Bug: " + element.localName +
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
} else if ((v == "++2" || v == "+-2" || v == "--2" || v == "-+2") && element[attr] != defaultValue) {
//TBD: Bug: Should not be able to parse strings with multiple sign characters, should return defaultValue
todo_is(element[attr], intValue, "Bug: " + element.localName +
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
} else {
is(element[attr], intValue, element.localName +
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");

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

@ -139,7 +139,6 @@
#include "nsIDOMDOMStringList.h"
#include "nsIDOMDOMTokenList.h"
#include "nsIDOMDOMSettableTokenList.h"
#include "nsIDOMNameList.h"
#include "nsIDOMNSElement.h"
#include "nsDOMStringMap.h"
@ -1000,9 +999,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(DOMStringList, nsStringListSH,
ARRAY_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(NameList, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
#ifdef MOZ_XUL
NS_DEFINE_CLASSINFO_DATA(TreeColumn, nsDOMGenericSH,
DEFAULT_SCRIPTABLE_FLAGS)
@ -2996,10 +2992,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMStringList)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(NameList, nsIDOMNameList)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNameList)
DOM_CLASSINFO_MAP_END
#ifdef MOZ_XUL
DOM_CLASSINFO_MAP_BEGIN(TreeColumn, nsITreeColumn)
DOM_CLASSINFO_MAP_ENTRY(nsITreeColumn)

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

@ -220,9 +220,6 @@ DOMCI_CLASS(XULTreeBuilder)
// DOMStringList object
DOMCI_CLASS(DOMStringList)
// NameList object used by the DOM
DOMCI_CLASS(NameList)
#ifdef MOZ_XUL
DOMCI_CLASS(TreeColumn)
DOMCI_CLASS(TreeColumns)

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

@ -60,7 +60,6 @@ interface nsIDOMProcessingInstruction;
interface nsIDOMText;
interface nsIDOMDOMStringList;
interface nsIDOMDOMTokenList;
interface nsIDOMNameList;
interface nsIDOMClientRect;
interface nsIDOMClientRectList;

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

@ -66,7 +66,6 @@ SDK_XPIDLSRCS = \
$(NULL)
XPIDLSRCS = \
nsIDOMDOMStringList.idl \
nsIDOMNameList.idl \
nsIDOMXMLDocument.idl \
nsIDOMUserDataHandler.idl \
nsIDOMNSEditableElement.idl \

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

@ -67,7 +67,7 @@ interface nsIDOMCaretPosition;
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
*/
[scriptable, uuid(C54536AF-C238-4D8B-A339-54E2A0649FF5)]
[scriptable, uuid(489faaa9-c54e-466c-8164-9a5fcc3a7052)]
interface nsIDOMDocument : nsIDOMNode
{
readonly attribute nsIDOMDocumentType doctype;
@ -106,8 +106,6 @@ interface nsIDOMDocument : nsIDOMNode
nsIDOMElement getElementById(in DOMString elementId);
// Introduced in DOM Level 3:
readonly attribute DOMString inputEncoding;
// Introduced in DOM Level 3:
readonly attribute DOMString xmlEncoding;
// Introduced in DOM Level 3:
attribute boolean xmlStandalone;
// raises(DOMException) on setting

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

@ -1,57 +0,0 @@
/* -*- 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) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Peter Van der Beken <peterv@netscape.com>
*
*
* Alternatively, the contents of this file may be used under the terms of
* either 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 ***** */
/**
* Corresponds to http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407
*/
#include "domstubs.idl"
[scriptable, uuid(faaf1b80-1ddd-11d9-8c46-000a95dc234c)]
interface nsIDOMNameList : nsISupports
{
DOMString getName(in unsigned long index)
raises(DOMException);
DOMString getNamespaceURI(in unsigned long index)
raises(DOMException);
readonly attribute unsigned long length;
boolean contains(in DOMString str);
boolean containsNS(in DOMString namespaceURI,
in DOMString name);
};

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

@ -47,7 +47,7 @@
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
*/
[scriptable, uuid(92b0df87-78a1-4e3b-a23c-d0c5bb2b83f9)]
[scriptable, uuid(8a876308-7891-468c-8f7a-9f2b81160c3c)]
interface nsIDOMText : nsIDOMCharacterData
{
nsIDOMText splitText(in unsigned long offset)
@ -68,12 +68,4 @@ interface nsIDOMText : nsIDOMCharacterData
* passing an element, comment, or processing-instruction boundary.
*/
readonly attribute DOMString wholeText;
/**
* If content is empty, removes all logically adjacent text nodes (including
* this node) from the DOM tree, returning null; otherwise, replaces the
* contents of this node with aContent and removes all other logically
* adjacent text nodes from the DOM tree, returning this node.
*/
nsIDOMText replaceWholeText(in DOMString content) raises(DOMException);
};

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

@ -38,7 +38,7 @@
#include "nsIDOMDocument.idl"
[scriptable, uuid(0457526E-1FA5-476C-9314-0F704617B9F4)]
[scriptable, uuid(8168733e-9cf6-4552-9f03-57de11b87f3f)]
interface nsIDOMXMLDocument : nsIDOMDocument
{
// DOM Level 3 Load & Save, DocumentLS

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

@ -47,7 +47,7 @@
*/
interface nsISelection;
[scriptable, uuid(DA6A8183-3C50-4F4A-9EFC-0E050B9A856A)]
[scriptable, uuid(9a23fb3c-1d25-462e-8e85-c78c9dc61755)]
interface nsIDOMHTMLDocument : nsIDOMDocument
{
readonly attribute DOMString URL;

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

@ -39,7 +39,7 @@
interface nsIDOMSVGSVGElement;
[scriptable, uuid(E055EF40-D6BA-443A-B4DB-C1CCFAA6EB31)]
[scriptable, uuid(1767ad4f-bb2b-474b-b208-9910ed152605)]
interface nsIDOMSVGDocument : nsIDOMDocument
{
readonly attribute DOMString domain;

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

@ -1,4 +1,4 @@
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*- */
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 2; -*- */
/* vim: set sw=4 ts=8 et tw=80 : */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
@ -98,10 +98,15 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetHelper)
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager)
NS_IMETHOD SendSyncMessage()
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
const jsval& aObject,
JSContext* aCx,
PRUint8 aArgc,
jsval* aRetval)
{
return mMessageManager ? mMessageManager->SendSyncMessage()
: NS_ERROR_NULL_POINTER;
return mMessageManager
? mMessageManager->SendSyncMessage(aMessageName, aObject, aCx, aArgc, aRetval)
: NS_ERROR_NULL_POINTER;
}
NS_IMETHOD GetContent(nsIDOMWindow** aContent);
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell);

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

@ -108,12 +108,12 @@ IsSupportedWarning=Use of attributes' isSupported() is deprecated.
IsEqualNodeWarning=Use of attributes' isEqualNode() is deprecated.
TextContentWarning=Use of attributes' textContent attribute is deprecated. Use value instead.
EnablePrivilegeWarning=Use of enablePrivilege is deprecated. Please use code that runs with the system principal (e.g. an extension) instead.
PositionWarning=Use of XMLHttpRequest's progress events' position attribute is deprecated.
TotalSizeWarning=Use of XMLHttpRequest's progress events' totalSize attribute is deprecated.
nsIJSONDecodeDeprecatedWarning=nsIJSON.decode is deprecated. Please use JSON.parse instead.
nsIJSONEncodeDeprecatedWarning=nsIJSON.encode is deprecated. Please use JSON.stringify instead.
nsIDOMWindowInternalWarning=Use of nsIDOMWindowInternal is deprecated. Use nsIDOMWindow instead.
IsSameNodeWarning=Use of isSameNode is deprecated. Please use A == B to test for equality instead.
ReplaceWholeTextWarning=Use of replaceWholeText is deprecated. Please call normalize() on the parent and set the data attribute, or use textContent instead.
XmlEncodingWarning=Use of xmlEncoding is deprecated.
XmlVersionWarning=Use of xmlVersion is deprecated.
InputEncodingWarning=Use of inputEncoding is deprecated.
XmlStandaloneWarning=Use of xmlStandalone is deprecated.

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

@ -39,9 +39,6 @@ function runTest() {
// doc.xmlStandalone
ok(doc.xmlStandalone == clonefalse.xmlStandalone, "xmlStandalone not preserved correctly; " + iframes[i].id);
// doc.xmlEncoding
ok(doc.xmlEncoding == clonefalse.xmlEncoding, "xmlEncoding not preserved correctly; " + iframes[i].id);
// doc.characterSet
ok(doc.characterSet == clonefalse.characterSet, "charset not preserved correctly; " + iframes[i].id);

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

@ -88,7 +88,8 @@ var modTests = ["hc_elementwrongdocumenterr", "hc_namednodemapwrongdocumenterr",
var createEntityRef = ["documentinvalidcharacterexceptioncreateentref",
"documentinvalidcharacterexceptioncreateentref1",
"hc_attrgetvalue2", "hc_nodevalue03"];
var createProcessingInstructionHTML = ["documentinvalidcharacterexceptioncreatepi",
"documentinvalidcharacterexceptioncreatepi1"];
var todoTests = {};
function concat(lst/*...*/) {
@ -101,5 +102,5 @@ function concat(lst/*...*/) {
}
return f;
}
var exclusions = concat(dtdTests, indexErrTests, attributeModTests, modTests, createEntityRef);
var exclusions = concat(dtdTests, indexErrTests, attributeModTests, modTests, createEntityRef, createProcessingInstructionHTML);
for (var excludedTestName in exclusions) { todoTests[exclusions[excludedTestName]] = true; }

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

@ -225,19 +225,12 @@ gfxASurface::Wrap (cairo_surface_t *csurf)
void
gfxASurface::Init(cairo_surface_t* surface, bool existingSurface)
{
if (cairo_surface_status(surface)) {
// the surface has an error on it
mSurfaceValid = PR_FALSE;
cairo_surface_destroy(surface);
return;
}
SetSurfaceWrapper(surface, this);
mSurface = surface;
mSurfaceValid = PR_TRUE;
mSurfaceValid = surface && !cairo_surface_status(surface);
if (existingSurface) {
if (existingSurface || !mSurfaceValid) {
mFloatingRefs = 0;
} else {
mFloatingRefs = 1;

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

@ -69,6 +69,14 @@ gfxImageSurface::gfxImageSurface(unsigned char *aData, const gfxIntSize& aSize,
InitWithData(aData, aSize, aStride, aFormat);
}
void
gfxImageSurface::MakeInvalid()
{
mSize = gfxIntSize(-1, -1);
mData = NULL;
mStride = 0;
}
void
gfxImageSurface::InitWithData(unsigned char *aData, const gfxIntSize& aSize,
long aStride, gfxImageFormat aFormat)
@ -80,7 +88,7 @@ gfxImageSurface::InitWithData(unsigned char *aData, const gfxIntSize& aSize,
mStride = aStride;
if (!CheckSurfaceSize(aSize))
return;
MakeInvalid();
cairo_surface_t *surface =
cairo_image_surface_create_for_data((unsigned char*)mData,
@ -121,7 +129,7 @@ gfxImageSurface::gfxImageSurface(const gfxIntSize& size, gfxImageFormat format)
mStride = ComputeStride();
if (!CheckSurfaceSize(size))
return;
MakeInvalid();
// if we have a zero-sized surface, just leave mData nsnull
if (mSize.height * mStride > 0) {

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

@ -122,6 +122,8 @@ protected:
static long ComputeStride(const gfxIntSize&, gfxImageFormat);
void MakeInvalid();
gfxIntSize mSize;
bool mOwnsData;
unsigned char *mData;

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

@ -42,7 +42,7 @@
gfxQuartzImageSurface::gfxQuartzImageSurface(gfxImageSurface *imageSurface)
{
if (imageSurface->CairoStatus() || imageSurface->CairoSurface() == NULL)
if (imageSurface->CairoSurface() == NULL)
return;
cairo_surface_t *surf = cairo_quartz_image_surface_create (imageSurface->CairoSurface());

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

@ -40,15 +40,23 @@
#include "cairo-quartz.h"
gfxQuartzSurface::gfxQuartzSurface(const gfxSize& size, gfxImageFormat format,
bool aForPrinting)
: mCGContext(NULL), mSize(size), mForPrinting(aForPrinting)
void
gfxQuartzSurface::MakeInvalid()
{
unsigned int width = (unsigned int) floor(size.width);
unsigned int height = (unsigned int) floor(size.height);
mSize = gfxIntSize(-1, -1);
}
if (!CheckSurfaceSize(gfxIntSize(width, height)))
return;
gfxQuartzSurface::gfxQuartzSurface(const gfxSize& desiredSize, gfxImageFormat format,
bool aForPrinting)
: mCGContext(NULL), mSize(desiredSize), mForPrinting(aForPrinting)
{
gfxIntSize size((unsigned int) floor(desiredSize.width),
(unsigned int) floor(desiredSize.height));
if (!CheckSurfaceSize(size))
MakeInvalid();
unsigned int width = static_cast<unsigned int>(mSize.width);
unsigned int height = static_cast<unsigned int>(mSize.height);
cairo_surface_t *surf = cairo_quartz_surface_create
((cairo_format_t) format, width, height);
@ -61,12 +69,17 @@ gfxQuartzSurface::gfxQuartzSurface(const gfxSize& size, gfxImageFormat format,
}
gfxQuartzSurface::gfxQuartzSurface(CGContextRef context,
const gfxSize& size,
const gfxSize& desiredSize,
bool aForPrinting)
: mCGContext(context), mSize(size), mForPrinting(aForPrinting)
: mCGContext(context), mSize(desiredSize), mForPrinting(aForPrinting)
{
unsigned int width = (unsigned int) floor(size.width);
unsigned int height = (unsigned int) floor(size.height);
gfxIntSize size((unsigned int) floor(desiredSize.width),
(unsigned int) floor(desiredSize.height));
if (!CheckSurfaceSize(size))
MakeInvalid();
unsigned int width = static_cast<unsigned int>(mSize.width);
unsigned int height = static_cast<unsigned int>(mSize.height);
cairo_surface_t *surf =
cairo_quartz_surface_create_for_cg_context(context,
@ -88,17 +101,19 @@ gfxQuartzSurface::gfxQuartzSurface(cairo_surface_t *csurf,
}
gfxQuartzSurface::gfxQuartzSurface(unsigned char *data,
const gfxSize& size,
const gfxSize& desiredSize,
long stride,
gfxImageFormat format,
bool aForPrinting)
: mCGContext(nsnull), mSize(size), mForPrinting(aForPrinting)
: mCGContext(nsnull), mSize(desiredSize), mForPrinting(aForPrinting)
{
unsigned int width = (unsigned int) floor(size.width);
unsigned int height = (unsigned int) floor(size.height);
gfxIntSize size((unsigned int) floor(desiredSize.width),
(unsigned int) floor(desiredSize.height));
if (!CheckSurfaceSize(size))
MakeInvalid();
if (!CheckSurfaceSize(gfxIntSize(width, height)))
return;
unsigned int width = static_cast<unsigned int>(mSize.width);
unsigned int height = static_cast<unsigned int>(mSize.height);
cairo_surface_t *surf = cairo_quartz_surface_create_for_data
(data, (cairo_format_t) format, width, height, stride);

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

@ -75,6 +75,8 @@ public:
}
protected:
void MakeInvalid();
CGContextRef mCGContext;
gfxSize mSize;
bool mForPrinting;

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

@ -66,11 +66,18 @@ gfxWindowsSurface::gfxWindowsSurface(HDC dc, PRUint32 flags) :
InitWithDC(flags);
}
gfxWindowsSurface::gfxWindowsSurface(const gfxIntSize& size, gfxImageFormat imageFormat) :
void
gfxWindowsSurface::MakeInvalid(gfxIntSize& size)
{
size = gfxIntSize(-1, -1);
}
gfxWindowsSurface::gfxWindowsSurface(const gfxIntSize& realSize, gfxImageFormat imageFormat) :
mOwnsDC(PR_FALSE), mForPrinting(PR_FALSE), mWnd(nsnull)
{
gfxIntSize size(realSize);
if (!CheckSurfaceSize(size))
return;
MakeInvalid(size);
cairo_surface_t *surf = cairo_win32_surface_create_with_dib((cairo_format_t)imageFormat,
size.width, size.height);
@ -85,11 +92,12 @@ gfxWindowsSurface::gfxWindowsSurface(const gfxIntSize& size, gfxImageFormat imag
mDC = nsnull;
}
gfxWindowsSurface::gfxWindowsSurface(HDC dc, const gfxIntSize& size, gfxImageFormat imageFormat) :
gfxWindowsSurface::gfxWindowsSurface(HDC dc, const gfxIntSize& realSize, gfxImageFormat imageFormat) :
mOwnsDC(PR_FALSE), mForPrinting(PR_FALSE), mWnd(nsnull)
{
gfxIntSize size(realSize);
if (!CheckSurfaceSize(size))
return;
MakeInvalid(size);
cairo_surface_t *surf = cairo_win32_surface_create_with_ddb(dc, (cairo_format_t)imageFormat,
size.width, size.height);

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

@ -103,6 +103,8 @@ public:
virtual gfxASurface::MemoryLocation GetMemoryLocation() const;
private:
void MakeInvalid(gfxIntSize& size);
bool mOwnsDC;
bool mForPrinting;

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

@ -147,7 +147,7 @@ script 15.9.5.5.js
script 15.9.5.6.js
script 15.9.5.7.js
fails-if(Android) script 15.9.5.8.js
script 15.9.5.9.js
skip-if(Android) script 15.9.5.9.js # bug 686143, skip temporarily to see what happens to the frequency and location of Android timeouts
script 15.9.5.js
slow script dst-offset-caching-1-of-8.js
slow script dst-offset-caching-2-of-8.js

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

@ -148,11 +148,6 @@ members = [
'nsIDOMDOMStringList.*',
'nsIDOMDOMTokenList.*',
'nsIDOMDOMSettableTokenList.*',
'nsIDOMNameList.getName',
'nsIDOMNameList.contains',
'nsIDOMNameList.containsNS',
'nsIDOMNameList.length',
'nsIDOMNameList.getNamespaceURI',
'nsIDOMXULDocument.getBoxObjectFor',
'nsIDOMNSElement.*',

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

@ -2451,13 +2451,6 @@ nsDisplayTransform::GetResultingTransformMatrix(const nsIFrame* aFrame,
*aOutAncestor = nsLayoutUtils::GetCrossDocParentFrame(aFrame);
}
/* Preserve-3d can cause frames without a transform to get an nsDisplayTransform created, we should
* use our parent's transform here.
*/
if (!aFrame->GetStyleDisplay()->HasTransform()) {
return GetResultingTransformMatrix(aFrame->GetParent(), aOrigin - aFrame->GetPosition(), aFactor, nsnull, aOutAncestor);
}
/* Account for the -moz-transform-origin property by translating the
* coordinate space to the new origin.
*/

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

@ -2079,16 +2079,16 @@ public:
* ferries the underlying frame to the nsDisplayItem constructor.
*/
nsDisplayTransform(nsDisplayListBuilder* aBuilder, nsIFrame *aFrame,
nsDisplayList *aList) :
nsDisplayItem(aBuilder, aFrame), mStoredList(aBuilder, aFrame, aList)
nsDisplayList *aList, PRUint32 aIndex = 0) :
nsDisplayItem(aBuilder, aFrame), mStoredList(aBuilder, aFrame, aList), mIndex(aIndex)
{
MOZ_COUNT_CTOR(nsDisplayTransform);
NS_ABORT_IF_FALSE(aFrame, "Must have a frame!");
}
nsDisplayTransform(nsDisplayListBuilder* aBuilder, nsIFrame *aFrame,
nsDisplayItem *aItem) :
nsDisplayItem(aBuilder, aFrame), mStoredList(aBuilder, aFrame, aItem)
nsDisplayItem *aItem, PRUint32 aIndex = 0) :
nsDisplayItem(aBuilder, aFrame), mStoredList(aBuilder, aFrame, aItem), mIndex(aIndex)
{
MOZ_COUNT_CTOR(nsDisplayTransform);
NS_ABORT_IF_FALSE(aFrame, "Must have a frame!");
@ -2128,6 +2128,12 @@ public:
const nsRect& aAllowVisibleRegionExpansion);
virtual bool TryMerge(nsDisplayListBuilder *aBuilder, nsDisplayItem *aItem);
virtual PRUint32 GetPerFrameKey() { return (mIndex << nsDisplayItem::TYPE_BITS) | nsDisplayItem::GetPerFrameKey(); }
enum {
INDEX_MAX = PR_UINT32_MAX >> nsDisplayItem::TYPE_BITS
};
const gfx3DMatrix& GetTransform(float aFactor);
/**
@ -2205,6 +2211,7 @@ private:
nsDisplayWrapList mStoredList;
gfx3DMatrix mTransform;
float mCachedFactor;
PRUint32 mIndex;
};
/**

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

@ -675,14 +675,12 @@ public:
bool GetBackgroundImageDraw() const { return mDrawImageBackground; }
void SetBackgroundImageDraw(bool aCanDraw)
{
NS_ASSERTION(!(aCanDraw & ~1), "Value must be true or false");
mDrawImageBackground = aCanDraw;
}
bool GetBackgroundColorDraw() const { return mDrawColorBackground; }
void SetBackgroundColorDraw(bool aCanDraw)
{
NS_ASSERTION(!(aCanDraw & ~1), "Value must be true or false");
mDrawColorBackground = aCanDraw;
}
@ -725,7 +723,6 @@ public:
*/
void SetVisualMode(bool aIsVisual)
{
NS_ASSERTION(!(aIsVisual & ~1), "Value must be true or false");
mIsVisual = aIsVisual;
}
@ -757,7 +754,6 @@ public:
*/
void SetIsRenderingOnlySelection(bool aResult)
{
NS_ASSERTION(!(aResult & ~1), "Value must be true or false");
mIsRenderingOnlySelection = aResult;
}

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

@ -3146,12 +3146,11 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll)
}
}
} else {
rv = NS_ERROR_FAILURE; //changed to NS_OK in quirks mode if ScrollTo is called
// Scroll to the top/left if the anchor can not be
// found and it is labelled top (quirks mode only). @see bug 80784
if ((NS_LossyConvertUTF16toASCII(aAnchorName).LowerCaseEqualsLiteral("top")) &&
(mPresContext->CompatibilityMode() == eCompatibility_NavQuirks)) {
rv = NS_ERROR_FAILURE;
NS_NAMED_LITERAL_STRING(top, "top");
if (nsContentUtils::EqualsIgnoreASCIICase(aAnchorName, top)) {
// Scroll to the top/left if aAnchorName is "top" and there is no element
// with such a name or id.
rv = NS_OK;
nsIScrollableFrame* sf = GetRootScrollFrameAsScrollable();
// Check |aScroll| after setting |rv| so we set |rv| to the same

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

@ -68,6 +68,12 @@ _TEST_FILES = \
test_after_paint_pref.html \
test_border_radius_hit_testing.html \
test_bug66619.html \
test_bug93077-1.html \
test_bug93077-2.html \
test_bug93077-3.html \
test_bug93077-4.html \
test_bug93077-5.html \
test_bug93077-6.html \
test_bug114649.html \
$(warning test_bug369950.html disabled due to random orange; see bug 492575) \
test_bug386575.xhtml \

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

@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#top", "#TOP", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,32 @@
<!-- Testing quirks mode. -->
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#top", "#TOP", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<p id=top>Top</p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#TOP", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
location.hash = "#top"
isnot(window.scrollY, 0)
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,35 @@
<!-- Testing quirks mode. -->
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<p><a name=top>Top</a></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#TOP", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
location.hash = "#top"
isnot(window.scrollY, 0)
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<p id=TOP>Top</p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#top", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
location.hash = "#TOP"
isnot(window.scrollY, 0)
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,35 @@
<!-- Testing quirks mode. -->
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=93077
-->
<head>
<title>Test for Bug 93077</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#filler { height: 200cm; background: papayawhip; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
<p id="display"></p>
<div id=filler>...</div>
<p id=below></p>
<p><a name=TOP>Top</a></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 93077 **/
["#top", "#Top"].forEach(function(fragid) {
document.getElementById("below").scrollIntoView()
isnot(window.scrollY, 0)
location.hash = fragid
is(window.scrollY, 0)
})
location.hash = "#TOP"
isnot(window.scrollY, 0)
</script>
</pre>
</body>
</html>

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

@ -1518,47 +1518,78 @@ DisplayDebugBorders(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
#endif
static nsresult
WrapPreserve3DList(nsIFrame *aFrame, nsDisplayListBuilder *aBuilder, nsDisplayList *aList)
WrapPreserve3DListInternal(nsIFrame* aFrame, nsDisplayListBuilder *aBuilder, nsDisplayList *aList, PRUint32& aIndex)
{
if (aIndex > nsDisplayTransform::INDEX_MAX) {
return NS_OK;
}
nsresult rv = NS_OK;
nsDisplayList newList;
nsDisplayList temp;
while (nsDisplayItem *item = aList->RemoveBottom()) {
nsIFrame *childFrame = item->GetUnderlyingFrame();
NS_ASSERTION(childFrame, "All display items to be wrapped must have a frame!");
// We accumulate sequential items that aren't transforms into the 'temp' list
// and then flush this list into newList by wrapping the whole lot with a single
// nsDisplayTransform.
if (childFrame->GetParent()->Preserves3DChildren()) {
switch (item->GetType()) {
case nsDisplayItem::TYPE_TRANSFORM: {
if (!temp.IsEmpty()) {
newList.AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder, aFrame, &temp, aIndex++));
}
newList.AppendToTop(item);
break;
}
case nsDisplayItem::TYPE_WRAP_LIST: {
if (!temp.IsEmpty()) {
newList.AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder, aFrame, &temp, aIndex++));
}
nsDisplayWrapList *list = static_cast<nsDisplayWrapList*>(item);
rv = WrapPreserve3DList(aFrame, aBuilder, list->GetList());
rv = WrapPreserve3DListInternal(aFrame, aBuilder, list->GetList(), aIndex);
newList.AppendToTop(item);
break;
}
case nsDisplayItem::TYPE_OPACITY: {
if (!temp.IsEmpty()) {
newList.AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder, aFrame, &temp, aIndex++));
}
nsDisplayOpacity *opacity = static_cast<nsDisplayOpacity*>(item);
rv = WrapPreserve3DList(aFrame, aBuilder, opacity->GetList());
rv = WrapPreserve3DListInternal(aFrame, aBuilder, opacity->GetList(), aIndex);
newList.AppendToTop(item);
break;
}
default: {
item = new (aBuilder) nsDisplayTransform(aBuilder, childFrame, item);
temp.AppendToTop(item);
break;
}
}
} else {
item = new (aBuilder) nsDisplayTransform(aBuilder, childFrame, item);
temp.AppendToTop(item);
}
if (NS_FAILED(rv) || !item)
if (NS_FAILED(rv) || !item || aIndex > nsDisplayTransform::INDEX_MAX)
return rv;
}
newList.AppendToTop(item);
if (!temp.IsEmpty()) {
newList.AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder, aFrame, &temp, aIndex++));
}
aList->AppendToTop(&newList);
return NS_OK;
}
static nsresult
WrapPreserve3DList(nsIFrame* aFrame, nsDisplayListBuilder* aBuilder, nsDisplayList *aList)
{
PRUint32 index = 0;
return WrapPreserve3DListInternal(aFrame, aBuilder, aList, index);
}
nsresult
nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,

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

@ -275,9 +275,9 @@ protected:
if (aSequenceNumber > mLastSequenceNumber && mFrame &&
mFrame->mInstanceOwner) {
mLastSequenceNumber = aSequenceNumber;
return PR_TRUE;
return true;
}
return PR_FALSE;
return false;
}
PRUint64 mLastSequenceNumber;
@ -286,7 +286,7 @@ protected:
nsObjectFrame::nsObjectFrame(nsStyleContext* aContext)
: nsObjectFrameSuper(aContext)
, mReflowCallbackPosted(PR_FALSE)
, mReflowCallbackPosted(false)
{
PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG,
("Created new nsObjectFrame %p\n", this));
@ -350,7 +350,7 @@ nsObjectFrame::DestroyFrom(nsIFrame* aDestructRoot)
// we need to finish with the plugin before native window is destroyed
// doing this in the destructor is too late.
StopPluginInternal(PR_TRUE);
StopPluginInternal(true);
// StopPluginInternal might have disowned the widget; if it has,
// mWidget will be null.
@ -450,7 +450,7 @@ nsObjectFrame::CreateWidget(nscoord aWidth,
NS_ERROR("Could not create inner view");
return NS_ERROR_OUT_OF_MEMORY;
}
viewMan->InsertChild(view, mInnerView, nsnull, PR_TRUE);
viewMan->InsertChild(view, mInnerView, nsnull, true);
nsresult rv;
mWidget = do_CreateInstance(kWidgetCID, &rv);
@ -459,9 +459,9 @@ nsObjectFrame::CreateWidget(nscoord aWidth,
nsWidgetInitData initData;
initData.mWindowType = eWindowType_plugin;
initData.mUnicode = PR_FALSE;
initData.clipChildren = PR_TRUE;
initData.clipSiblings = PR_TRUE;
initData.mUnicode = false;
initData.clipChildren = true;
initData.clipSiblings = true;
// We want mWidget to be able to deliver events to us, especially on
// Mac where events to the plugin are routed through Gecko. So we
// allow the view to attach its event handler to mWidget even though
@ -475,7 +475,7 @@ nsObjectFrame::CreateWidget(nscoord aWidth,
return rv;
}
mWidget->EnableDragDrop(PR_TRUE);
mWidget->EnableDragDrop(true);
// If this frame has an ancestor with a widget which is not
// the root prescontext's widget, then this plugin should not be
@ -483,7 +483,7 @@ nsObjectFrame::CreateWidget(nscoord aWidth,
// plugin may appear in the main window. In Web content this would
// only happen with a plugin in a XUL popup.
if (parentWidget == GetNearestWidget()) {
mWidget->Show(PR_TRUE);
mWidget->Show(true);
#ifdef XP_MACOSX
// On Mac, we need to invalidate ourselves since even windowed
// plugins are painted through Thebes and we need to ensure
@ -545,7 +545,7 @@ nsObjectFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
{
nscoord result = 0;
if (!IsHidden(PR_FALSE)) {
if (!IsHidden(false)) {
nsIAtom *atom = mContent->Tag();
if (atom == nsGkAtoms::applet || atom == nsGkAtoms::embed) {
result = nsPresContext::CSSPixelsToAppUnits(EMBED_DEF_WIDTH);
@ -571,7 +571,7 @@ nsObjectFrame::GetDesiredSize(nsPresContext* aPresContext,
aMetrics.width = 0;
aMetrics.height = 0;
if (IsHidden(PR_FALSE)) {
if (IsHidden(false)) {
return;
}
@ -662,12 +662,12 @@ nsObjectFrame::Reflow(nsPresContext* aPresContext,
if (mInnerView) {
nsIViewManager* vm = mInnerView->GetViewManager();
vm->MoveViewTo(mInnerView, r.x, r.y);
vm->ResizeView(mInnerView, nsRect(nsPoint(0, 0), r.Size()), PR_TRUE);
vm->ResizeView(mInnerView, nsRect(nsPoint(0, 0), r.Size()), true);
}
FixupWindow(r.Size());
if (!mReflowCallbackPosted) {
mReflowCallbackPosted = PR_TRUE;
mReflowCallbackPosted = true;
aPresContext->PresShell()->PostReflowCallback(this);
}
@ -682,15 +682,15 @@ nsObjectFrame::Reflow(nsPresContext* aPresContext,
bool
nsObjectFrame::ReflowFinished()
{
mReflowCallbackPosted = PR_FALSE;
mReflowCallbackPosted = false;
CallSetWindow();
return PR_TRUE;
return true;
}
void
nsObjectFrame::ReflowCallbackCanceled()
{
mReflowCallbackPosted = PR_FALSE;
mReflowCallbackPosted = false;
}
nsresult
@ -773,7 +773,7 @@ nsObjectFrame::FixupWindow(const nsSize& aSize)
window->clipRect.bottom = 0;
window->clipRect.right = 0;
#else
mInstanceOwner->UpdateWindowPositionAndClipRect(PR_FALSE);
mInstanceOwner->UpdateWindowPositionAndClipRect(false);
#endif
NotifyPluginReflowObservers();
@ -845,7 +845,7 @@ nsObjectFrame::IsHidden(bool aCheckVisibilityStyle) const
{
if (aCheckVisibilityStyle) {
if (!GetStyleVisibility()->IsVisibleOrCollapsed())
return PR_TRUE;
return true;
}
// only <embed> tags support the HIDDEN attribute
@ -863,11 +863,11 @@ nsObjectFrame::IsHidden(bool aCheckVisibilityStyle) const
(!hidden.LowerCaseEqualsLiteral("false") &&
!hidden.LowerCaseEqualsLiteral("no") &&
!hidden.LowerCaseEqualsLiteral("off")))) {
return PR_TRUE;
return true;
}
}
return PR_FALSE;
return false;
}
nsIntPoint nsObjectFrame::GetWindowOriginInPixels(bool aWindowless)
@ -985,7 +985,7 @@ nsDisplayPluginReadback::ComputeVisibility(nsDisplayListBuilder* aBuilder,
{
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion,
aAllowVisibleRegionExpansion))
return PR_FALSE;
return false;
nsRect expand;
expand.IntersectRect(aAllowVisibleRegionExpansion, GetBounds(aBuilder));
@ -993,7 +993,7 @@ nsDisplayPluginReadback::ComputeVisibility(nsDisplayListBuilder* aBuilder,
// likely to be made visible, so we can use it for a background! This is
// a bit crazy since we normally only subtract from the visible region.
aVisibleRegion->Or(*aVisibleRegion, expand);
return PR_TRUE;
return true;
}
nsRect
@ -1025,7 +1025,7 @@ nsDisplayPlugin::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
bool* aForceTransparentSurface)
{
if (aForceTransparentSurface) {
*aForceTransparentSurface = PR_FALSE;
*aForceTransparentSurface = false;
}
nsRegion result;
nsObjectFrame* f = static_cast<nsObjectFrame*>(mFrame);
@ -1142,7 +1142,7 @@ nsObjectFrame::IsOpaque() const
{
#if defined(XP_MACOSX)
// ???
return PR_FALSE;
return false;
#else
return !IsTransparentMode();
#endif
@ -1153,21 +1153,21 @@ nsObjectFrame::IsTransparentMode() const
{
#if defined(XP_MACOSX)
// ???
return PR_FALSE;
return false;
#else
if (!mInstanceOwner)
return PR_FALSE;
return false;
NPWindow *window;
mInstanceOwner->GetWindow(window);
if (window->type != NPWindowTypeDrawable)
return PR_FALSE;
return false;
nsresult rv;
nsRefPtr<nsNPAPIPluginInstance> pi;
rv = mInstanceOwner->GetInstance(getter_AddRefs(pi));
if (NS_FAILED(rv) || !pi)
return PR_FALSE;
return false;
bool transparent = false;
pi->IsTransparent(&transparent);
@ -1210,7 +1210,7 @@ nsObjectFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
bool isVisible = window && window->width > 0 && window->height > 0;
if (isVisible && aBuilder->ShouldSyncDecodeImages()) {
#ifndef XP_MACOSX
mInstanceOwner->UpdateWindowVisibility(PR_TRUE);
mInstanceOwner->UpdateWindowVisibility(true);
#endif
}
@ -1788,7 +1788,7 @@ nsObjectFrame::PaintPlugin(nsDisplayListBuilder* aBuilder,
windowContext->context != cgContext) {
windowContext->context = cgContext;
cgPluginPortCopy->context = cgContext;
mInstanceOwner->SetPluginPortChanged(PR_TRUE);
mInstanceOwner->SetPluginPortChanged(true);
}
#endif
@ -1839,7 +1839,7 @@ nsObjectFrame::PaintPlugin(nsDisplayListBuilder* aBuilder,
gfxContext *ctx = aRenderingContext.ThebesContext();
gfxMatrix currentMatrix = ctx->CurrentMatrix();
if (ctx->UserToDevicePixelSnapped(frameGfxRect, PR_FALSE)) {
if (ctx->UserToDevicePixelSnapped(frameGfxRect, false)) {
dirtyGfxRect = ctx->UserToDevice(dirtyGfxRect);
ctx->IdentityMatrix();
}
@ -1901,7 +1901,7 @@ nsObjectFrame::PaintPlugin(nsDisplayListBuilder* aBuilder,
// on information here for clipping their drawing, and we can safely use this message
// to tell the plugin exactly where it is in all cases.
nsIntPoint origin = GetWindowOriginInPixels(PR_TRUE);
nsIntPoint origin = GetWindowOriginInPixels(true);
nsIntRect winlessRect = nsIntRect(origin, nsIntSize(window->width, window->height));
if (!mWindowlessRect.IsEqualEdges(winlessRect)) {
@ -1992,7 +1992,7 @@ nsObjectFrame::PaintPlugin(nsDisplayListBuilder* aBuilder,
HPS hps = (HPS)GetPSFromRC(aRenderingContext);
if (reinterpret_cast<HPS>(window->window) != hps) {
window->window = reinterpret_cast<void*>(hps);
doupdatewindow = PR_TRUE;
doupdatewindow = true;
}
LONG lPSid = GpiSavePS(hps);
RECTL rclViewport;
@ -2009,7 +2009,7 @@ nsObjectFrame::PaintPlugin(nsDisplayListBuilder* aBuilder,
if ((window->x != origin.x) || (window->y != origin.y)) {
window->x = origin.x;
window->y = origin.y;
doupdatewindow = PR_TRUE;
doupdatewindow = true;
}
// if our location or visible area has changed, we need to tell the plugin
@ -2113,7 +2113,7 @@ nsObjectFrame::PrepareInstanceOwner()
nsWeakFrame weakFrame(this);
// First, have to stop any possibly running plugins.
StopPluginInternal(PR_FALSE);
StopPluginInternal(false);
if (!weakFrame.IsAlive()) {
return NS_ERROR_NOT_AVAILABLE;
@ -2160,7 +2160,7 @@ nsObjectFrame::Instantiate(nsIChannel* aChannel, nsIStreamListener** aStreamList
nsWeakFrame weakFrame(this);
NS_ASSERTION(!mPreventInstantiation, "Say what?");
mPreventInstantiation = PR_TRUE;
mPreventInstantiation = true;
rv = pluginHost->InstantiatePluginForChannel(aChannel, mInstanceOwner, aStreamListener);
if (!weakFrame.IsAlive()) {
@ -2169,7 +2169,7 @@ nsObjectFrame::Instantiate(nsIChannel* aChannel, nsIStreamListener** aStreamList
NS_ASSERTION(mPreventInstantiation,
"Instantiation should still be prevented!");
mPreventInstantiation = PR_FALSE;
mPreventInstantiation = false;
#ifdef ACCESSIBILITY
nsAccessibilityService* accService = nsIPresShell::AccService();
@ -2218,7 +2218,7 @@ nsObjectFrame::Instantiate(const char* aMimeType, nsIURI* aURI)
mInstanceOwner->SetPluginHost(pluginHost);
NS_ASSERTION(!mPreventInstantiation, "Say what?");
mPreventInstantiation = PR_TRUE;
mPreventInstantiation = true;
rv = InstantiatePlugin(static_cast<nsPluginHost*>(pluginHost.get()), aMimeType, aURI);
@ -2247,7 +2247,7 @@ nsObjectFrame::Instantiate(const char* aMimeType, nsIURI* aURI)
}
#endif
mPreventInstantiation = PR_FALSE;
mPreventInstantiation = false;
return rv;
}
@ -2309,7 +2309,7 @@ DoDelayedStop(nsPluginInstanceOwner *aInstanceOwner, bool aDelayedStop)
#if (MOZ_PLATFORM_MAEMO==5)
// Don't delay stop on Maemo/Hildon (bug 530739).
if (aDelayedStop && aInstanceOwner->MatchPluginName("Shockwave Flash"))
return PR_FALSE;
return false;
#endif
// Don't delay stopping QuickTime (bug 425157), Flip4Mac (bug 426524),
@ -2324,9 +2324,9 @@ DoDelayedStop(nsPluginInstanceOwner *aInstanceOwner, bool aDelayedStop)
) {
nsCOMPtr<nsIRunnable> evt = new nsStopPluginRunnable(aInstanceOwner);
NS_DispatchToCurrentThread(evt);
return PR_TRUE;
return true;
}
return PR_FALSE;
return false;
}
static void
@ -2399,7 +2399,7 @@ nsStopPluginRunnable::Run()
mTimer = nsnull;
DoStopPlugin(mInstanceOwner, PR_FALSE);
DoStopPlugin(mInstanceOwner, false);
return NS_OK;
}
@ -2465,7 +2465,7 @@ nsObjectFrame::StopPluginInternal(bool aDelayedStop)
mWindowlessRect.SetEmpty();
bool oldVal = mPreventInstantiation;
mPreventInstantiation = PR_TRUE;
mPreventInstantiation = true;
nsWeakFrame weakFrame(this);

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

@ -6,7 +6,7 @@
<th>0</th>
<td><table cellpadding="4" border="0"><tr><td>border="0"</td></tr></table></td>
<td><table cellpadding="4" border="0"><tr><td>border="0px"</td></tr></table></td>
<td><table cellpadding="4" border="1"><tr><td>border="0em"</td></tr></table></td>
<td><table cellpadding="4" border="0"><tr><td>border="0em"</td></tr></table></td>
</tr>
<tr>
<th>1</th>
@ -18,19 +18,19 @@
<th>2</th>
<td><table cellpadding="4" border="2"><tr><td>border="2"</td></tr></table></td>
<td><table cellpadding="4" border="2"><tr><td>border="2px"</td></tr></table></td>
<td><table cellpadding="4" border="1"><tr><td>border="2em"</td></tr></table></td>
<td><table cellpadding="4" border="2"><tr><td>border="2em"</td></tr></table></td>
</tr>
<tr>
<th>3</th>
<td><table cellpadding="4" border="3"><tr><td>border="3"</td></tr></table></td>
<td><table cellpadding="4" border="3"><tr><td>border="3px"</td></tr></table></td>
<td><table cellpadding="4" border="1"><tr><td>border="3em"</td></tr></table></td>
<td><table cellpadding="4" border="3"><tr><td>border="3em"</td></tr></table></td>
</tr>
<tr>
<th>10</th>
<td><table cellpadding="4" border="10"><tr><td>border="10"</td></tr></table></td>
<td><table cellpadding="4" border="10"><tr><td>border="10px"</td></tr></table></td>
<td><table cellpadding="4" border="1"><tr><td>border="10em"</td></tr></table></td>
<td><table cellpadding="4" border="10"><tr><td>border="10em"</td></tr></table></td>
</tr>
</table>

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

@ -584,12 +584,14 @@ const PRInt32 nsCSSProps::kAppearanceKTable[] = {
const PRInt32 nsCSSProps::kBackfaceVisibilityKTable[] = {
eCSSKeyword_visible, NS_STYLE_BACKFACE_VISIBILITY_VISIBLE,
eCSSKeyword_hidden, NS_STYLE_BACKFACE_VISIBILITY_HIDDEN
eCSSKeyword_hidden, NS_STYLE_BACKFACE_VISIBILITY_HIDDEN,
eCSSKeyword_UNKNOWN,-1
};
const PRInt32 nsCSSProps::kTransformStyleKTable[] = {
eCSSKeyword_flat, NS_STYLE_TRANSFORM_STYLE_FLAT,
eCSSKeyword_preserve_3d, NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D
eCSSKeyword_preserve_3d, NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D,
eCSSKeyword_UNKNOWN,-1
};
const PRInt32 nsCSSProps::kBackgroundAttachmentKTable[] = {

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

@ -882,14 +882,13 @@ function Focus()
return false;
}
// FIXME/bug 623625: determine if the window is focused and/or try
// to acquire focus if it's not.
//
// NB: we can't add anything here that would return false on
// tinderbox, otherwise we could lose testing coverage due to
// problems on the test machines. We might want a require-focus
// mode, defaulting to false for developers, but that's true on
// tinderbox.
var fm = CC["@mozilla.org/focus-manager;1"].getService(CI.nsIFocusManager);
fm.activeWindow = window;
try {
var dock = CC["@mozilla.org/widget/macdocksupport;1"].getService(CI.nsIMacDockSupport);
dock.activateApplication(true);
} catch(ex) {
}
return true;
}

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

@ -712,6 +712,7 @@ dialog {
-moz-border-end: @border_width_tiny@ solid @color_button_border@;
-moz-border-right-colors: transparent @color_button_border@;
-moz-margin-end: -moz-calc(-3 * @border_width_tiny@);
padding: @padding_xxxnormal@ 0;
}
.prompt-button:last-of-type {

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

@ -44,7 +44,7 @@
#include <stdlib.h>
#include "Endian.h"
#include "EndianMacros.h"
#include "nsBMPDecoder.h"
#include "nsIInputStream.h"

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

@ -44,7 +44,7 @@
#include <stdlib.h>
#include "Endian.h"
#include "EndianMacros.h"
#include "nsICODecoder.h"
#include "nsIInputStream.h"

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

@ -36,7 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsCRT.h"
#include "Endian.h"
#include "EndianMacros.h"
#include "nsBMPEncoder.h"
#include "prmem.h"
#include "prprf.h"

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

@ -36,7 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsCRT.h"
#include "Endian.h"
#include "EndianMacros.h"
#include "nsBMPEncoder.h"
#include "nsPNGEncoder.h"
#include "nsICOEncoder.h"

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

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

@ -397,23 +397,13 @@ nsProgressNotificationProxy::GetInterface(const nsIID& iid,
return NS_NOINTERFACE;
}
static bool NewRequestAndEntry(bool forcePrincipalCheckForCacheEntry,
imgRequest **request, imgCacheEntry **entry)
static void NewRequestAndEntry(bool aForcePrincipalCheckForCacheEntry,
imgRequest **aRequest, imgCacheEntry **aEntry)
{
*request = new imgRequest();
if (!*request)
return PR_FALSE;
*entry = new imgCacheEntry(*request, forcePrincipalCheckForCacheEntry);
if (!*entry) {
delete *request;
return PR_FALSE;
}
NS_ADDREF(*request);
NS_ADDREF(*entry);
return PR_TRUE;
nsRefPtr<imgRequest> request = new imgRequest();
nsRefPtr<imgCacheEntry> entry = new imgCacheEntry(request, aForcePrincipalCheckForCacheEntry);
request.forget(aRequest);
entry.forget(aEntry);
}
static bool ShouldRevalidateEntry(imgCacheEntry *aEntry,
@ -1697,9 +1687,8 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
if (!NewRequestAndEntry(forcePrincipalCheck, getter_AddRefs(request),
getter_AddRefs(entry)))
return NS_ERROR_OUT_OF_MEMORY;
NewRequestAndEntry(forcePrincipalCheck, getter_AddRefs(request),
getter_AddRefs(entry));
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgLoader::LoadImage -- Created new imgRequest [request=%p]\n", this, request.get()));
@ -1902,9 +1891,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb
// Default to doing a principal check because we don't know who
// started that load and whether their principal ended up being
// inherited on the channel.
if (!NewRequestAndEntry(PR_TRUE, getter_AddRefs(request),
getter_AddRefs(entry)))
return NS_ERROR_OUT_OF_MEMORY;
NewRequestAndEntry(PR_TRUE, getter_AddRefs(request), getter_AddRefs(entry));
// We use originalURI here to fulfil the imgIRequest contract on GetURI.
nsCOMPtr<nsIURI> originalURI;

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

@ -8,7 +8,7 @@ load invalid-size.gif
load invalid-size-second-frame.gif
# Animated gifs with a very large canvas, but tiny actual content.
asserts(2) load delaytest.html?523528-1.gif # Bug 564231
load delaytest.html?523528-1.gif
load delaytest.html?523528-2.gif
# this would have exposed the leak discovered in bug 642902

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

@ -213,10 +213,8 @@
<method name="onResize">
<body>
<![CDATA[
// XXX the <notificationbox/>; to be made app-agnostic later
let container = this.parentNode.parentNode;
let availWidth = container.clientWidth;
let availHeight = container.clientHeight;
let availWidth = this.clientWidth;
let availHeight = this.clientHeight;
if (availWidth == this.availWidth && availHeight == this.availHeight)
return;
this.availWidth = availWidth;

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

@ -186,6 +186,7 @@ HISTOGRAM(NETWORK_DISK_CACHE_DELETEDIR, 1, 10000, 10, EXPONENTIAL, "Time spent d
*/
#ifdef MOZ_URL_CLASSIFIER
HISTOGRAM(URLCLASSIFIER_PS_FILELOAD_TIME, 1, 1000, 10, EXPONENTIAL, "Time spent loading PrefixSet from file (ms)")
HISTOGRAM(URLCLASSIFIER_PS_FALLOCATE_TIME, 1, 1000, 10, EXPONENTIAL, "Time spent fallocating PrefixSet (ms)")
HISTOGRAM(URLCLASSIFIER_PS_CONSTRUCT_TIME, 1, 5000, 15, EXPONENTIAL, "Time spent constructing PrefixSet from DB (ms)")
HISTOGRAM(URLCLASSIFIER_PS_LOOKUP_TIME, 1, 500, 10, EXPONENTIAL, "Time spent per PrefixSet lookup (ms)")
#endif

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

@ -51,6 +51,7 @@
#include "nsTArray.h"
#include "nsThreadUtils.h"
#include "mozilla/Mutex.h"
#include "mozilla/Telemetry.h"
#include "mozilla/FileUtils.h"
#include "prlog.h"
@ -378,7 +379,7 @@ nsUrlClassifierPrefixSet::LoadFromFile(nsIFile * aFile)
NS_ENSURE_SUCCESS(rv, rv);
AutoFDClose fileFd;
rv = file->OpenNSPRFileDesc(PR_RDONLY, 0, &fileFd);
rv = file->OpenNSPRFileDesc(PR_RDONLY | nsILocalFile::OS_READAHEAD, 0, &fileFd);
NS_ENSURE_SUCCESS(rv, rv);
return LoadFromFd(fileFd);
@ -387,6 +388,15 @@ nsUrlClassifierPrefixSet::LoadFromFile(nsIFile * aFile)
nsresult
nsUrlClassifierPrefixSet::StoreToFd(AutoFDClose & fileFd)
{
{
Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_PS_FALLOCATE_TIME> timer;
PRInt64 size = 4 * sizeof(PRUint32);
size += 2 * mIndexStarts.Length() * sizeof(PRUint32);
size += mDeltas.Length() * sizeof(PRUint16);
mozilla::fallocate(fileFd, size);
}
PRInt32 written;
PRUint32 magic = PREFIXSET_VERSION_MAGIC;
written = PR_Write(fileFd, &magic, sizeof(PRUint32));

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

@ -1192,5 +1192,6 @@ filefield {
/*********** tabmodalprompt ************/
tabmodalprompt {
-moz-binding: url("chrome://global/content/tabprompts.xml#tabmodalprompt");
overflow: hidden;
text-shadow: none;
}

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

@ -17,9 +17,10 @@
}
findbar {
border-top: 2px solid;
-moz-border-top-colors: ThreeDShadow ThreeDHighlight;
padding-bottom: 1px;
padding-top: 1px;
background-image: -moz-linear-gradient(rgba(0,0,0,.15) 1px, rgba(255,255,255,.15) 1px);
background-size: 100% 2px;
background-repeat: no-repeat;
min-width: 1px;
}

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

@ -93,7 +93,7 @@ nsBidiKeyboard::IsLangRTL(bool *aIsRTL)
nsresult
nsBidiKeyboard::SetHaveBidiKeyboards()
{
mHaveBidiKeyboards = PR_FALSE;
mHaveBidiKeyboards = false;
if (!gtklib || !GdkKeymapHaveBidiLayouts)
return NS_ERROR_FAILURE;

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

@ -61,7 +61,7 @@ nsCUPSShim::Init()
{
mCupsLib = PR_LoadLibrary("libcups.so.2");
if (!mCupsLib)
return PR_FALSE;
return false;
// List of symbol pointers. Must match gSymName[] defined above.
void **symAddr[] = {
@ -83,8 +83,8 @@ nsCUPSShim::Init()
#endif
PR_UnloadLibrary(mCupsLib);
mCupsLib = nsnull;
return PR_FALSE;
return false;
}
}
return PR_TRUE;
return true;
}

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

@ -88,15 +88,15 @@ class nsCUPSShim {
* Initialize this object. Attempt to load the CUPS shared
* library and find function pointers for the supported
* functions (see below).
* @return PR_FALSE if the shared library could not be loaded, or if
* @return false if the shared library could not be loaded, or if
* any of the functions could not be found.
* PR_TRUE for successful initialization.
* true for successful initialization.
*/
bool Init();
/**
* @return PR_TRUE if the object was initialized successfully.
* PR_FALSE otherwise.
* @return true if the object was initialized successfully.
* false otherwise.
*/
bool IsInitialized() { return nsnull != mCupsLib; }

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

@ -103,8 +103,8 @@ struct retrieval_context
void *data;
retrieval_context()
: completed(PR_FALSE),
timed_out(PR_FALSE),
: completed(false),
timed_out(false),
data(nsnull)
{ }
};
@ -147,7 +147,7 @@ nsClipboard::Init(void)
if (!os)
return NS_ERROR_FAILURE;
os->AddObserver(this, "quit-application", PR_FALSE);
os->AddObserver(this, "quit-application", false);
return NS_OK;
}
@ -239,7 +239,7 @@ nsClipboard::SetData(nsITransferable *aTransferable,
if (!imagesAdded) {
// accept any writable image type
gtk_target_list_add_image_targets(list, 0, TRUE);
imagesAdded = PR_TRUE;
imagesAdded = true;
}
continue;
}
@ -329,7 +329,7 @@ nsClipboard::GetData(nsITransferable *aTransferable, PRInt32 aWhichClipboard)
data = (guchar *)ToNewUnicode(ucs2string);
length = ucs2string.Length() * 2;
g_free(new_text);
foundData = PR_TRUE;
foundData = true;
foundFlavor = kUnicodeMime;
break;
}
@ -385,7 +385,7 @@ nsClipboard::GetData(nsITransferable *aTransferable, PRInt32 aWhichClipboard)
break;
memcpy(data, selectionData->data, length);
}
foundData = PR_TRUE;
foundData = true;
foundFlavor = flavorStr;
break;
}
@ -435,7 +435,7 @@ nsClipboard::HasDataMatchingFlavors(const char** aFlavorList, PRUint32 aLength,
if (!aFlavorList || !_retval)
return NS_ERROR_NULL_POINTER;
*_retval = PR_FALSE;
*_retval = false;
GtkSelectionData *selection_data =
GetTargets(GetSelectionAtom(aWhichClipboard));
@ -456,7 +456,7 @@ nsClipboard::HasDataMatchingFlavors(const char** aFlavorList, PRUint32 aLength,
// We special case text/unicode here.
if (!strcmp(aFlavorList[i], kUnicodeMime) &&
gtk_selection_data_targets_include_text(selection_data)) {
*_retval = PR_TRUE;
*_retval = true;
break;
}
@ -466,11 +466,11 @@ nsClipboard::HasDataMatchingFlavors(const char** aFlavorList, PRUint32 aLength,
continue;
if (!strcmp(atom_name, aFlavorList[i]))
*_retval = PR_TRUE;
*_retval = true;
// X clipboard wants image/jpeg, not image/jpg
if (!strcmp(aFlavorList[i], kJPEGImageMime) && !strcmp(atom_name, "image/jpeg"))
*_retval = PR_TRUE;
*_retval = true;
g_free(atom_name);
@ -487,7 +487,7 @@ nsClipboard::HasDataMatchingFlavors(const char** aFlavorList, PRUint32 aLength,
NS_IMETHODIMP
nsClipboard::SupportsSelectionClipboard(bool *_retval)
{
*_retval = PR_TRUE; // yeah, unix supports the selection clipboard
*_retval = true; // yeah, unix supports the selection clipboard
return NS_OK;
}
@ -897,7 +897,7 @@ static bool
wait_for_retrieval(GtkClipboard *clipboard, retrieval_context *r_context)
{
if (r_context->completed) // the request completed synchronously
return PR_TRUE;
return true;
Display *xDisplay = GDK_DISPLAY();
checkEventContext context;
@ -930,7 +930,7 @@ wait_for_retrieval(GtkClipboard *clipboard, retrieval_context *r_context)
DispatchPropertyNotifyEvent(context.cbWidget, &xevent);
if (r_context->completed)
return PR_TRUE;
return true;
}
tv.tv_sec = 0;
@ -942,8 +942,8 @@ wait_for_retrieval(GtkClipboard *clipboard, retrieval_context *r_context)
#ifdef DEBUG_CLIPBOARD
printf("exceeded clipboard timeout\n");
#endif
r_context->timed_out = PR_TRUE;
return PR_FALSE;
r_context->timed_out = true;
return false;
}
static void
@ -957,7 +957,7 @@ clipboard_contents_received(GtkClipboard *clipboard,
return;
}
context->completed = PR_TRUE;
context->completed = true;
if (selection_data->length >= 0)
context->data = gtk_selection_data_copy(selection_data);
@ -994,7 +994,7 @@ clipboard_text_received(GtkClipboard *clipboard,
return;
}
context->completed = PR_TRUE;
context->completed = true;
context->data = g_strdup(text);
}

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

@ -77,9 +77,6 @@
using namespace mozilla;
/* Ensure that the result is always equal to either PR_TRUE or PR_FALSE */
#define MAKE_PR_BOOL(val) ((val)?(PR_TRUE):(PR_FALSE))
#ifdef PR_LOGGING
static PRLogModuleInfo *DeviceContextSpecGTKLM = PR_NewLogModule("DeviceContextSpecGTK");
#endif /* PR_LOGGING */
@ -223,7 +220,7 @@ nsPrinterFeatures::nsPrinterFeatures( const char *printername )
DO_PR_DEBUG_LOG(("nsPrinterFeatures::nsPrinterFeatures('%s')\n", printername));
mPrinterName.Assign(printername);
SetBoolValue("has_special_printerfeatures", PR_TRUE);
SetBoolValue("has_special_printerfeatures", true);
}
void nsPrinterFeatures::SetCanChangePaperSize( bool aCanSetPaperSize )
@ -440,7 +437,7 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::GetSurfaceForPrinter(gfxASurface **aSurfac
return NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE;
close(fd);
rv = NS_NewNativeLocalFile(nsDependentCString(buf), PR_FALSE,
rv = NS_NewNativeLocalFile(nsDependentCString(buf), false,
getter_AddRefs(mSpoolFile));
if (NS_FAILED(rv)) {
unlink(buf);
@ -588,7 +585,7 @@ nsresult nsDeviceContextSpecGTK::GetPrintMethod(const char *aPrinter, PrintMetho
static void
print_callback(GtkPrintJob *aJob, gpointer aData, GError *aError) {
g_object_unref(aJob);
((nsILocalFile*) aData)->Remove(PR_FALSE);
((nsILocalFile*) aData)->Remove(false);
}
static void
@ -629,7 +626,7 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::EndDocument()
mPrintSettings->GetToFileName(getter_Copies(targetPath));
nsresult rv = NS_NewNativeLocalFile(NS_ConvertUTF16toUTF8(targetPath),
PR_FALSE, getter_AddRefs(destFile));
false, getter_AddRefs(destFile));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString destLeafName;
@ -796,7 +793,7 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
nsPrintfCString prefName(256,
PRINTERFEATURES_PREF ".%s.has_special_printerfeatures",
fullPrinterName.get());
Preferences::SetBool(prefName.get(), PR_FALSE);
Preferences::SetBool(prefName.get(), false);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
@ -816,7 +813,7 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
DO_PR_DEBUG_LOG(("Setting default filename to '%s'\n", filename.get()));
aPrintSettings->SetToFileName(NS_ConvertUTF8toUTF16(filename).get());
aPrintSettings->SetIsInitializedFromPrinter(PR_TRUE);
aPrintSettings->SetIsInitializedFromPrinter(true);
if (type == pmPostScript) {
DO_PR_DEBUG_LOG(("InitPrintSettingsFromPrinter() for PostScript printer\n"));
@ -824,15 +821,15 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
nsPrinterFeatures printerFeatures(fullPrinterName);
printerFeatures.SetSupportsPaperSizeChange(PR_TRUE);
printerFeatures.SetSupportsOrientationChange(PR_TRUE);
printerFeatures.SetSupportsPlexChange(PR_FALSE);
printerFeatures.SetSupportsResolutionNameChange(PR_FALSE);
printerFeatures.SetSupportsColorspaceChange(PR_FALSE);
printerFeatures.SetSupportsPaperSizeChange(true);
printerFeatures.SetSupportsOrientationChange(true);
printerFeatures.SetSupportsPlexChange(false);
printerFeatures.SetSupportsResolutionNameChange(false);
printerFeatures.SetSupportsColorspaceChange(false);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
printerFeatures.SetCanChangeOrientation(PR_TRUE);
printerFeatures.SetCanChangeOrientation(true);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
nsCAutoString orientation;
@ -859,7 +856,7 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
/* PostScript module does not support changing the plex mode... */
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
printerFeatures.SetCanChangePlex(PR_FALSE);
printerFeatures.SetCanChangePlex(false);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
DO_PR_DEBUG_LOG(("setting default plex to '%s'\n", "default"));
aPrintSettings->SetPlexName(NS_LITERAL_STRING("default").get());
@ -870,7 +867,7 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
/* PostScript module does not support changing the resolution mode... */
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
printerFeatures.SetCanChangeResolutionName(PR_FALSE);
printerFeatures.SetCanChangeResolutionName(false);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
DO_PR_DEBUG_LOG(("setting default resolution to '%s'\n", "default"));
aPrintSettings->SetResolutionName(NS_LITERAL_STRING("default").get());
@ -881,7 +878,7 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
/* PostScript module does not support changing the colorspace... */
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
printerFeatures.SetCanChangeColorspace(PR_FALSE);
printerFeatures.SetCanChangeColorspace(false);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
DO_PR_DEBUG_LOG(("setting default colorspace to '%s'\n", "default"));
aPrintSettings->SetColorspace(NS_LITERAL_STRING("default").get());
@ -891,7 +888,7 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
printerFeatures.SetCanChangePaperSize(PR_TRUE);
printerFeatures.SetCanChangePaperSize(true);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
nsCAutoString papername;
if (NS_SUCCEEDED(CopyPrinterCharPref("postscript", printerName,
@ -929,15 +926,15 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
printerFeatures.SetCanChangeSpoolerCommand(hasSpoolerCmd);
/* Postscript module does not pass the job title to lpr */
printerFeatures.SetSupportsJobTitleChange(PR_FALSE);
printerFeatures.SetCanChangeJobTitle(PR_FALSE);
printerFeatures.SetSupportsJobTitleChange(false);
printerFeatures.SetCanChangeJobTitle(false);
/* Postscript module has no control over builtin fonts yet */
printerFeatures.SetSupportsDownloadFontsChange(PR_FALSE);
printerFeatures.SetCanChangeDownloadFonts(PR_FALSE);
printerFeatures.SetSupportsDownloadFontsChange(false);
printerFeatures.SetCanChangeDownloadFonts(false);
/* Postscript module does not support multiple colorspaces
* so it has to use the old way */
printerFeatures.SetSupportsPrintInColorChange(PR_TRUE);
printerFeatures.SetCanChangePrintInColor(PR_TRUE);
printerFeatures.SetSupportsPrintInColorChange(true);
printerFeatures.SetCanChangePrintInColor(true);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
if (hasSpoolerCmd) {
@ -951,7 +948,7 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
}
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
printerFeatures.SetCanChangeNumCopies(PR_TRUE);
printerFeatures.SetCanChangeNumCopies(true);
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
return NS_OK;

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

@ -84,7 +84,7 @@ protected:
nsCOMPtr<nsIPrintSettings> mPrintSettings;
bool mToPrinter : 1; /* If true, print to printer */
bool mIsPPreview : 1; /* If true, is print preview */
char mPath[PATH_MAX]; /* If toPrinter = PR_FALSE, dest file */
char mPath[PATH_MAX]; /* If toPrinter = false, dest file */
char mPrinter[256]; /* Printer name */
GtkPrintJob* mPrintJob;
GtkPrinter* mGtkPrinter;

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

@ -132,7 +132,7 @@ nsDragService::nsDragService()
// running.
nsCOMPtr<nsIObserverService> obsServ =
mozilla::services::GetObserverService();
obsServ->AddObserver(this, "quit-application", PR_FALSE);
obsServ->AddObserver(this, "quit-application", false);
// our hidden source widget
mHiddenWidget = gtk_invisible_new();
@ -165,8 +165,8 @@ nsDragService::nsDragService()
mTargetWidget = 0;
mTargetDragContext = 0;
mTargetTime = 0;
mCanDrop = PR_FALSE;
mTargetDragDataReceived = PR_FALSE;
mCanDrop = false;
mTargetDragDataReceived = false;
mTargetDragData = 0;
mTargetDragDataLen = 0;
}
@ -378,16 +378,16 @@ nsDragService::SetAlphaPixmap(gfxASurface *aSurface,
// Transparent drag icons need, like a lot of transparency-related things,
// a compositing X window manager
if (!gdk_screen_is_composited(screen))
return PR_FALSE;
return false;
GdkColormap* alphaColormap = gdk_screen_get_rgba_colormap(screen);
if (!alphaColormap)
return PR_FALSE;
return false;
GdkPixmap* pixmap = gdk_pixmap_new(NULL, dragRect.width, dragRect.height,
gdk_colormap_get_visual(alphaColormap)->depth);
if (!pixmap)
return PR_FALSE;
return false;
gdk_drawable_set_colormap(GDK_DRAWABLE(pixmap), alphaColormap);
@ -396,7 +396,7 @@ nsDragService::SetAlphaPixmap(gfxASurface *aSurface,
nsWindow::GetSurfaceForGdkDrawable(GDK_DRAWABLE(pixmap),
dragRect.Size());
if (!xPixmapSurface)
return PR_FALSE;
return false;
nsRefPtr<gfxContext> xPixmapCtx = new gfxContext(xPixmapSurface);
@ -413,7 +413,7 @@ nsDragService::SetAlphaPixmap(gfxASurface *aSurface,
gtk_drag_set_icon_pixmap(aContext, alphaColormap, pixmap, NULL,
aXOffset, aYOffset);
g_object_unref(pixmap);
return PR_TRUE;
return true;
}
NS_IMETHODIMP
@ -652,11 +652,11 @@ nsDragService::GetData(nsITransferable * aTransferable,
GetTargetDragData(gdkFlavor);
}
if (mTargetDragData) {
PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound = PR_TRUE\n"));
dataFound = PR_TRUE;
PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound = true\n"));
dataFound = true;
}
else {
PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound = PR_FALSE\n"));
PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound = false\n"));
// Dragging and dropping from the file manager would cause us
// to parse the source text as a nsILocalFile URL.
@ -725,7 +725,7 @@ nsDragService::GetData(nsITransferable * aTransferable,
g_free(mTargetDragData);
mTargetDragData = convertedText;
mTargetDragDataLen = ucs2string.Length() * 2;
dataFound = PR_TRUE;
dataFound = true;
} // if plain text data on clipboard
} else {
PR_LOG(sDragLm, PR_LOG_DEBUG,
@ -750,7 +750,7 @@ nsDragService::GetData(nsITransferable * aTransferable,
g_free(mTargetDragData);
mTargetDragData = convertedText;
mTargetDragDataLen = convertedTextLen * 2;
dataFound = PR_TRUE;
dataFound = true;
} // if plain text data on clipboard
} // if plain text flavor present
} // if plain text charset=utf-8 flavor present
@ -784,7 +784,7 @@ nsDragService::GetData(nsITransferable * aTransferable,
g_free(mTargetDragData);
mTargetDragData = convertedText;
mTargetDragDataLen = convertedTextLen * 2;
dataFound = PR_TRUE;
dataFound = true;
}
}
else {
@ -814,7 +814,7 @@ nsDragService::GetData(nsITransferable * aTransferable,
g_free(mTargetDragData);
mTargetDragData = convertedText;
mTargetDragDataLen = convertedTextLen * 2;
dataFound = PR_TRUE;
dataFound = true;
}
}
else {
@ -863,7 +863,7 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor,
return NS_ERROR_INVALID_ARG;
// set this to no by default
*_retval = PR_FALSE;
*_retval = false;
// check to make sure that we have a drag object set, here
if (!mTargetDragContext) {
@ -914,7 +914,7 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor,
if (strcmp(flavorStr, aDataFlavor) == 0) {
PR_LOG(sDragLm, PR_LOG_DEBUG,
("boioioioiooioioioing!\n"));
*_retval = PR_TRUE;
*_retval = true;
}
}
}
@ -935,7 +935,7 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor,
("checking %s against %s\n", name, aDataFlavor));
if (name && (strcmp(name, aDataFlavor) == 0)) {
PR_LOG(sDragLm, PR_LOG_DEBUG, ("good!\n"));
*_retval = PR_TRUE;
*_retval = true;
}
// check for automatic text/uri-list -> text/x-moz-url mapping
if (!*_retval &&
@ -945,7 +945,7 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor,
PR_LOG(sDragLm, PR_LOG_DEBUG,
("good! ( it's text/uri-list and \
we're checking against text/x-moz-url )\n"));
*_retval = PR_TRUE;
*_retval = true;
}
// check for automatic _NETSCAPE_URL -> text/x-moz-url mapping
if (!*_retval &&
@ -955,7 +955,7 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor,
PR_LOG(sDragLm, PR_LOG_DEBUG,
("good! ( it's _NETSCAPE_URL and \
we're checking against text/x-moz-url )\n"));
*_retval = PR_TRUE;
*_retval = true;
}
// check for auto text/plain -> text/unicode mapping
if (!*_retval &&
@ -966,7 +966,7 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor,
PR_LOG(sDragLm, PR_LOG_DEBUG,
("good! ( it's text plain and we're checking \
against text/unicode or application/x-moz-file)\n"));
*_retval = PR_TRUE;
*_retval = true;
}
g_free(name);
}
@ -991,7 +991,7 @@ NS_IMETHODIMP
nsDragService::TargetStartDragMotion(void)
{
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::TargetStartDragMotion"));
mCanDrop = PR_FALSE;
mCanDrop = false;
return NS_OK;
}
@ -1037,7 +1037,7 @@ nsDragService::TargetDataReceived(GtkWidget *aWidget,
{
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::TargetDataReceived"));
TargetResetData();
mTargetDragDataReceived = PR_TRUE;
mTargetDragDataReceived = true;
if (aSelectionData->length > 0) {
mTargetDragDataLen = aSelectionData->length;
mTargetDragData = g_malloc(mTargetDragDataLen);
@ -1084,7 +1084,7 @@ nsDragService::IsTargetContextList(void)
gchar *name = NULL;
name = gdk_atom_name(atom);
if (name && strcmp(name, gMimeListType) == 0)
retval = PR_TRUE;
retval = true;
g_free(name);
if (retval)
break;
@ -1120,7 +1120,7 @@ nsDragService::GetTargetDragData(GdkAtom aFlavor)
void
nsDragService::TargetResetData(void)
{
mTargetDragDataReceived = PR_FALSE;
mTargetDragDataReceived = false;
// make sure to free old data if we have to
g_free(mTargetDragData);
mTargetDragData = 0;
@ -1370,7 +1370,7 @@ nsDragService::SourceEndDragSession(GdkDragContext *aContext,
dropEffect = DRAGDROP_ACTION_NONE;
if (aResult != MOZ_GTK_DRAG_RESULT_NO_TARGET) {
mUserCancelled = PR_TRUE;
mUserCancelled = true;
}
}
@ -1382,7 +1382,7 @@ nsDragService::SourceEndDragSession(GdkDragContext *aContext,
}
// Inform the drag session that we're ending the drag.
EndDragSession(PR_TRUE);
EndDragSession(true);
}
static void
@ -1489,19 +1489,19 @@ nsDragService::SourceDataGet(GtkWidget *aWidget,
if (strcmp(mimeFlavor, kTextMime) == 0 ||
strcmp(mimeFlavor, gTextPlainUTF8Type) == 0) {
actualFlavor = kUnicodeMime;
needToDoConversionToPlainText = PR_TRUE;
needToDoConversionToPlainText = true;
}
// if someone was asking for _NETSCAPE_URL we need to convert to
// plain text but we also need to look for x-moz-url
else if (strcmp(mimeFlavor, gMozUrlType) == 0) {
actualFlavor = kURLMime;
needToDoConversionToPlainText = PR_TRUE;
needToDoConversionToPlainText = true;
}
// if someone was asking for text/uri-list we need to convert to
// plain text.
else if (strcmp(mimeFlavor, gTextUriListType) == 0) {
actualFlavor = gTextUriListType;
needToDoConversionToPlainText = PR_TRUE;
needToDoConversionToPlainText = true;
}
else
actualFlavor = mimeFlavor;

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

@ -205,7 +205,7 @@ NS_IMPL_ISUPPORTS1(nsFilePicker, nsIFilePicker)
nsFilePicker::nsFilePicker()
: mMode(nsIFilePicker::modeOpen),
mSelectedType(0),
mAllowURLs(PR_FALSE)
mAllowURLs(false)
{
}
@ -218,7 +218,7 @@ ReadMultipleFiles(gpointer filename, gpointer array)
{
nsCOMPtr<nsILocalFile> localfile;
nsresult rv = NS_NewNativeLocalFile(nsDependentCString(static_cast<char*>(filename)),
PR_FALSE,
false,
getter_AddRefs(localfile));
if (NS_SUCCEEDED(rv)) {
nsCOMArray<nsILocalFile>& files = *static_cast<nsCOMArray<nsILocalFile>*>(array);
@ -394,7 +394,7 @@ confirm_overwrite_file(GtkWidget *parent, nsILocalFile* file)
nsresult rv = sbs->CreateBundle("chrome://global/locale/filepicker.properties",
getter_AddRefs(bundle));
if (NS_FAILED(rv)) {
return PR_FALSE;
return false;
}
nsAutoString leafName;
@ -548,7 +548,7 @@ nsFilePicker::Show(PRInt16 *aReturn)
}
}
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(file_chooser), PR_TRUE);
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(file_chooser), TRUE);
gint response = gtk_dialog_run(GTK_DIALOG(file_chooser));
switch (response) {

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

@ -113,8 +113,8 @@ nsGtkIMModule::nsGtkIMModule(nsWindow* aOwnerWindow) :
#endif
mDummyContext(nsnull),
mCompositionStart(PR_UINT32_MAX), mProcessingKeyEvent(nsnull),
mIsComposing(PR_FALSE), mIsIMFocused(PR_FALSE),
mIgnoreNativeCompositionEvent(PR_FALSE)
mIsComposing(false), mIsIMFocused(false),
mIgnoreNativeCompositionEvent(false)
{
#ifdef PR_LOGGING
if (!gGtkIMLog) {
@ -372,7 +372,7 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent,
NS_PRECONDITION(aEvent, "aEvent must be non-null");
if (!IsEditable() || NS_UNLIKELY(IsDestroyed())) {
return PR_FALSE;
return false;
}
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
@ -389,18 +389,18 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent,
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
(" FAILED, the caller isn't focused window, mLastFocusedWindow=%p",
mLastFocusedWindow));
return PR_FALSE;
return false;
}
GtkIMContext* im = GetContext();
if (NS_UNLIKELY(!im)) {
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
(" FAILED, there are no context"));
return PR_FALSE;
return false;
}
mKeyDownEventWasSent = aKeyDownEventWasSent;
mFilterKeyEvent = PR_TRUE;
mFilterKeyEvent = true;
mProcessingKeyEvent = aEvent;
gboolean isFiltered = gtk_im_context_filter_keypress(im, aEvent);
mProcessingKeyEvent = nsnull;
@ -417,7 +417,7 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent,
if (!mDispatchedCompositionString.IsEmpty()) {
// If there is composition string, we shouldn't dispatch
// any keydown events during composition.
filterThisEvent = PR_TRUE;
filterThisEvent = true;
} else {
// A Hangul input engine for SCIM doesn't emit preedit_end
// signal even when composition string becomes empty. On the
@ -427,12 +427,12 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent,
// compositionend event, however, we don't need to reset IM
// actually.
CommitCompositionBy(EmptyString());
filterThisEvent = PR_FALSE;
filterThisEvent = false;
}
} else {
// Key release event may not be consumed by IM, however, we
// shouldn't dispatch any keyup event during composition.
filterThisEvent = PR_TRUE;
filterThisEvent = true;
}
}
@ -455,7 +455,7 @@ nsGtkIMModule::OnFocusChangeInGecko(bool aFocus)
if (aFocus) {
// If we failed to commit forcedely in previous focused editor,
// we should reopen the gate for native signals in new focused editor.
mIgnoreNativeCompositionEvent = PR_FALSE;
mIgnoreNativeCompositionEvent = false;
}
}
@ -473,7 +473,7 @@ nsGtkIMModule::ResetIME()
return;
}
mIgnoreNativeCompositionEvent = PR_TRUE;
mIgnoreNativeCompositionEvent = true;
gtk_im_context_reset(im);
}
@ -626,10 +626,10 @@ nsGtkIMModule::SetInputMode(nsWindow* aCaller, const IMEContext* aContext)
g_object_set(im, "hildon-input-mode",
(HildonGtkInputMode)mode, NULL);
gIsVirtualKeyboardOpened = PR_TRUE;
gIsVirtualKeyboardOpened = true;
hildon_gtk_im_context_show(im);
} else {
gIsVirtualKeyboardOpened = PR_FALSE;
gIsVirtualKeyboardOpened = false;
hildon_gtk_im_context_hide(im);
}
}
@ -673,7 +673,7 @@ nsGtkIMModule::IsVirtualKeyboardOpened()
#ifdef MOZ_PLATFORM_MAEMO
return gIsVirtualKeyboardOpened;
#else
return PR_FALSE;
return false;
#endif
}
@ -738,7 +738,7 @@ nsGtkIMModule::Focus()
sLastFocusedModule = this;
gtk_im_context_focus_in(im);
mIsIMFocused = PR_TRUE;
mIsIMFocused = true;
if (!IsEnabled()) {
// We should release IME focus for uim and scim.
@ -766,7 +766,7 @@ nsGtkIMModule::Blur()
}
gtk_im_context_focus_out(im);
mIsIMFocused = PR_FALSE;
mIsIMFocused = false;
}
/* static */
@ -827,7 +827,7 @@ nsGtkIMModule::OnEndCompositionNative(GtkIMContext *aContext)
// because DispatchCompositionEnd() is called ourselves when we need to
// commit the composition string *before* the focus moves completely.
// Note that the native commit can be fired *after* ResetIME().
mIgnoreNativeCompositionEvent = PR_FALSE;
mIgnoreNativeCompositionEvent = false;
if (!mIsComposing || shouldIgnoreThisEvent) {
// If we already handled the commit event, we should do nothing here.
@ -873,7 +873,7 @@ nsGtkIMModule::OnChangeCompositionNative(GtkIMContext *aContext)
}
// Be aware, widget can be gone
DispatchTextEvent(compositionString, PR_TRUE);
DispatchTextEvent(compositionString, true);
}
/* static */
@ -1012,7 +1012,7 @@ nsGtkIMModule::OnCommitCompositionNative(GtkIMContext *aContext,
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
("GtkIMModule(%p): OnCommitCompositionNative, we'll send normal key event",
this));
mFilterKeyEvent = PR_FALSE;
mFilterKeyEvent = false;
return;
}
}
@ -1030,8 +1030,8 @@ nsGtkIMModule::CommitCompositionBy(const nsAString& aString)
this, NS_ConvertUTF16toUTF8(aString).get(),
NS_ConvertUTF16toUTF8(mDispatchedCompositionString).get()));
if (!DispatchTextEvent(aString, PR_FALSE)) {
return PR_FALSE;
if (!DispatchTextEvent(aString, false)) {
return false;
}
// We should dispatch the compositionend event here because some IMEs
// might not fire "preedit_end" native event.
@ -1069,17 +1069,17 @@ nsGtkIMModule::DispatchCompositionStart()
if (mIsComposing) {
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
(" WARNING, we're already in composition"));
return PR_TRUE;
return true;
}
if (!mLastFocusedWindow) {
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
(" FAILED, there are no focused window in this module"));
return PR_FALSE;
return false;
}
nsEventStatus status;
nsQueryContentEvent selection(PR_TRUE, NS_QUERY_SELECTED_TEXT,
nsQueryContentEvent selection(true, NS_QUERY_SELECTED_TEXT,
mLastFocusedWindow);
InitEvent(selection);
mLastFocusedWindow->DispatchEvent(&selection, status);
@ -1087,7 +1087,7 @@ nsGtkIMModule::DispatchCompositionStart()
if (!selection.mSucceeded || selection.mReply.mOffset == PR_UINT32_MAX) {
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
(" FAILED, cannot query the selection offset"));
return PR_FALSE;
return false;
}
mCompositionStart = selection.mReply.mOffset;
@ -1107,20 +1107,20 @@ nsGtkIMModule::DispatchCompositionStart()
kungFuDeathGrip != mLastFocusedWindow) {
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
(" NOTE, the focused widget was destroyed/changed by keydown event"));
return PR_FALSE;
return false;
}
}
if (mIgnoreNativeCompositionEvent) {
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
(" WARNING, mIgnoreNativeCompositionEvent is already TRUE, but we forcedly reset"));
mIgnoreNativeCompositionEvent = PR_FALSE;
mIgnoreNativeCompositionEvent = false;
}
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
(" mCompositionStart=%u", mCompositionStart));
mIsComposing = PR_TRUE;
nsCompositionEvent compEvent(PR_TRUE, NS_COMPOSITION_START,
mIsComposing = true;
nsCompositionEvent compEvent(true, NS_COMPOSITION_START,
mLastFocusedWindow);
InitEvent(compEvent);
nsCOMPtr<nsIWidget> kungFuDeathGrip = mLastFocusedWindow;
@ -1129,10 +1129,10 @@ nsGtkIMModule::DispatchCompositionStart()
kungFuDeathGrip != mLastFocusedWindow) {
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
(" NOTE, the focused widget was destroyed/changed by compositionstart event"));
return PR_FALSE;
return false;
}
return PR_TRUE;
return true;
}
bool
@ -1146,34 +1146,34 @@ nsGtkIMModule::DispatchCompositionEnd()
if (!mIsComposing) {
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
(" WARNING, we have alrady finished the composition"));
return PR_FALSE;
return false;
}
if (!mLastFocusedWindow) {
mDispatchedCompositionString.Truncate();
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
(" FAILED, there are no focused window in this module"));
return PR_FALSE;
return false;
}
nsCompositionEvent compEvent(PR_TRUE, NS_COMPOSITION_END,
nsCompositionEvent compEvent(true, NS_COMPOSITION_END,
mLastFocusedWindow);
InitEvent(compEvent);
compEvent.data = mDispatchedCompositionString;
nsEventStatus status;
nsCOMPtr<nsIWidget> kungFuDeathGrip = mLastFocusedWindow;
mLastFocusedWindow->DispatchEvent(&compEvent, status);
mIsComposing = PR_FALSE;
mIsComposing = false;
mCompositionStart = PR_UINT32_MAX;
mDispatchedCompositionString.Truncate();
if (static_cast<nsWindow*>(kungFuDeathGrip.get())->IsDestroyed() ||
kungFuDeathGrip != mLastFocusedWindow) {
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
(" NOTE, the focused widget was destroyed/changed by compositionend event"));
return PR_FALSE;
return false;
}
return PR_TRUE;
return true;
}
bool
@ -1187,7 +1187,7 @@ nsGtkIMModule::DispatchTextEvent(const nsAString &aCompositionString,
if (!mLastFocusedWindow) {
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
(" FAILED, there are no focused window in this module"));
return PR_FALSE;
return false;
}
if (!mIsComposing) {
@ -1195,7 +1195,7 @@ nsGtkIMModule::DispatchTextEvent(const nsAString &aCompositionString,
(" The composition wasn't started, force starting..."));
nsCOMPtr<nsIWidget> kungFuDeathGrip = mLastFocusedWindow;
if (!DispatchCompositionStart()) {
return PR_FALSE;
return false;
}
}
@ -1203,7 +1203,7 @@ nsGtkIMModule::DispatchTextEvent(const nsAString &aCompositionString,
nsRefPtr<nsWindow> lastFocusedWindow = mLastFocusedWindow;
if (aCompositionString != mDispatchedCompositionString) {
nsCompositionEvent compositionUpdate(PR_TRUE, NS_COMPOSITION_UPDATE,
nsCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
mLastFocusedWindow);
InitEvent(compositionUpdate);
compositionUpdate.data = aCompositionString;
@ -1213,11 +1213,11 @@ nsGtkIMModule::DispatchTextEvent(const nsAString &aCompositionString,
lastFocusedWindow != mLastFocusedWindow) {
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
(" NOTE, the focused widget was destroyed/changed by compositionupdate"));
return PR_FALSE;
return false;
}
}
nsTextEvent textEvent(PR_TRUE, NS_TEXT_TEXT, mLastFocusedWindow);
nsTextEvent textEvent(true, NS_TEXT_TEXT, mLastFocusedWindow);
InitEvent(textEvent);
PRUint32 targetOffset = mCompositionStart;
@ -1246,12 +1246,12 @@ nsGtkIMModule::DispatchTextEvent(const nsAString &aCompositionString,
lastFocusedWindow != mLastFocusedWindow) {
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
(" NOTE, the focused widget was destroyed/changed by text event"));
return PR_FALSE;
return false;
}
SetCursorPosition(targetOffset);
return PR_TRUE;
return true;
}
void
@ -1404,7 +1404,7 @@ nsGtkIMModule::SetCursorPosition(PRUint32 aTargetOffset)
return;
}
nsQueryContentEvent charRect(PR_TRUE, NS_QUERY_TEXT_RECT,
nsQueryContentEvent charRect(true, NS_QUERY_TEXT_RECT,
mLastFocusedWindow);
charRect.InitForQueryTextRect(aTargetOffset, 1);
InitEvent(charRect);
@ -1451,7 +1451,7 @@ nsGtkIMModule::GetCurrentParagraph(nsAString& aText, PRUint32& aCursorPos)
nsEventStatus status;
// Query cursor position & selection
nsQueryContentEvent querySelectedTextEvent(PR_TRUE,
nsQueryContentEvent querySelectedTextEvent(true,
NS_QUERY_SELECTED_TEXT,
mLastFocusedWindow);
mLastFocusedWindow->DispatchEvent(&querySelectedTextEvent, status);
@ -1474,7 +1474,7 @@ nsGtkIMModule::GetCurrentParagraph(nsAString& aText, PRUint32& aCursorPos)
}
// Get all text contents of the focused editor
nsQueryContentEvent queryTextContentEvent(PR_TRUE,
nsQueryContentEvent queryTextContentEvent(true,
NS_QUERY_TEXT_CONTENT,
mLastFocusedWindow);
queryTextContentEvent.InitForQueryTextContent(0, PR_UINT32_MAX);
@ -1493,8 +1493,8 @@ nsGtkIMModule::GetCurrentParagraph(nsAString& aText, PRUint32& aCursorPos)
// Get only the focused paragraph, by looking for newlines
PRInt32 parStart = (selOffset == 0) ? 0 :
textContent.RFind("\n", PR_FALSE, selOffset - 1, -1) + 1;
PRInt32 parEnd = textContent.Find("\n", PR_FALSE, selOffset + selLength, -1);
textContent.RFind("\n", false, selOffset - 1, -1) + 1;
PRInt32 parEnd = textContent.Find("\n", false, selOffset + selLength, -1);
if (parEnd < 0) {
parEnd = textContent.Length();
}
@ -1523,24 +1523,24 @@ nsGtkIMModule::DeleteText(const PRInt32 aOffset, const PRUint32 aNChars)
nsEventStatus status;
// Query cursor position & selection
nsQueryContentEvent querySelectedTextEvent(PR_TRUE,
nsQueryContentEvent querySelectedTextEvent(true,
NS_QUERY_SELECTED_TEXT,
mLastFocusedWindow);
mLastFocusedWindow->DispatchEvent(&querySelectedTextEvent, status);
NS_ENSURE_TRUE(querySelectedTextEvent.mSucceeded, NS_ERROR_FAILURE);
// Set selection to delete
nsSelectionEvent selectionEvent(PR_TRUE, NS_SELECTION_SET,
nsSelectionEvent selectionEvent(true, NS_SELECTION_SET,
mLastFocusedWindow);
selectionEvent.mOffset = querySelectedTextEvent.mReply.mOffset + aOffset;
selectionEvent.mLength = aNChars;
selectionEvent.mReversed = PR_FALSE;
selectionEvent.mExpandToClusterBoundary = PR_FALSE;
selectionEvent.mReversed = false;
selectionEvent.mExpandToClusterBoundary = false;
mLastFocusedWindow->DispatchEvent(&selectionEvent, status);
NS_ENSURE_TRUE(selectionEvent.mSucceeded, NS_ERROR_FAILURE);
// Delete the selection
nsContentCommandEvent contentCommandEvent(PR_TRUE,
nsContentCommandEvent contentCommandEvent(true,
NS_CONTENT_COMMAND_DELETE,
mLastFocusedWindow);
mLastFocusedWindow->DispatchEvent(&contentCommandEvent, status);
@ -1564,7 +1564,7 @@ nsGtkIMModule::ShouldIgnoreNativeCompositionEvent()
mIgnoreNativeCompositionEvent ? "YES" : "NO"));
if (!mLastFocusedWindow) {
return PR_TRUE; // cannot continue
return true; // cannot continue
}
return mIgnoreNativeCompositionEvent;

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

@ -91,7 +91,7 @@ static void Initialize()
PR_LOG(sIdleLog, PR_LOG_WARNING, ("Failed to get XSSQueryInfo!\n"));
#endif
sInitialized = PR_TRUE;
sInitialized = true;
}
nsIdleServiceGTK::nsIdleServiceGTK()

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

@ -91,7 +91,7 @@ nsImageToPixbuf::ImageToPixbuf(imgIContainer* aImage)
GdkPixbuf*
nsImageToPixbuf::ImgSurfaceToPixbuf(gfxImageSurface* aImgSurface, PRInt32 aWidth, PRInt32 aHeight)
{
GdkPixbuf* pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, PR_TRUE, 8,
GdkPixbuf* pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8,
aWidth, aHeight);
if (!pixbuf)
return nsnull;

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

@ -86,7 +86,7 @@ nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
static bool sInitialized = false;
if (!sInitialized) {
sInitialized = PR_TRUE;
sInitialized = true;
InitLookAndFeel();
}
}
@ -367,7 +367,7 @@ static void darken_gdk_color(GdkColor *src, GdkColor *dest)
}
static PRInt32 CheckWidgetStyle(GtkWidget* aWidget, const char* aStyle, PRInt32 aResult) {
gboolean value = PR_FALSE;
gboolean value = FALSE;
gtk_widget_style_get(aWidget, aStyle, &value, NULL);
return value ? aResult : 0;
}
@ -813,8 +813,8 @@ nsLookAndFeel::RefreshImpl()
bool
nsLookAndFeel::GetEchoPasswordImpl() {
#ifdef MOZ_PLATFORM_MAEMO
return PR_TRUE;
return true;
#else
return PR_FALSE;
return false;
#endif
}

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

@ -56,7 +56,7 @@ copy_clipboard_cb(GtkWidget *w, gpointer user_data)
{
gCurrentCallback("cmd_copy", gCurrentCallbackData);
g_signal_stop_emission_by_name(w, "copy_clipboard");
gHandled = PR_TRUE;
gHandled = true;
}
static void
@ -64,7 +64,7 @@ cut_clipboard_cb(GtkWidget *w, gpointer user_data)
{
gCurrentCallback("cmd_cut", gCurrentCallbackData);
g_signal_stop_emission_by_name(w, "cut_clipboard");
gHandled = PR_TRUE;
gHandled = true;
}
// GTK distinguishes between display lines (wrapped, as they appear on the
@ -92,7 +92,7 @@ delete_from_cursor_cb(GtkWidget *w, GtkDeleteType del_type,
gint count, gpointer user_data)
{
g_signal_stop_emission_by_name(w, "delete_from_cursor");
gHandled = PR_TRUE;
gHandled = true;
bool forward = count > 0;
if (PRUint32(del_type) >= NS_ARRAY_LENGTH(sDeleteCommands)) {
@ -184,7 +184,7 @@ move_cursor_cb(GtkWidget *w, GtkMovementStep step, gint count,
gboolean extend_selection, gpointer user_data)
{
g_signal_stop_emission_by_name(w, "move_cursor");
gHandled = PR_TRUE;
gHandled = true;
bool forward = count > 0;
if (PRUint32(step) >= NS_ARRAY_LENGTH(sMoveCommands)) {
// unsupported movement type
@ -207,7 +207,7 @@ paste_clipboard_cb(GtkWidget *w, gpointer user_data)
{
gCurrentCallback("cmd_paste", gCurrentCallbackData);
g_signal_stop_emission_by_name(w, "paste_clipboard");
gHandled = PR_TRUE;
gHandled = true;
}
// GtkTextView-only signals
@ -216,7 +216,7 @@ select_all_cb(GtkWidget *w, gboolean select, gpointer user_data)
{
gCurrentCallback("cmd_selectAll", gCurrentCallbackData);
g_signal_stop_emission_by_name(w, "select_all");
gHandled = PR_TRUE;
gHandled = true;
}
void
@ -266,7 +266,7 @@ bool
nsNativeKeyBindings::KeyDown(const nsNativeKeyEvent& aEvent,
DoCommandCallback aCallback, void *aCallbackData)
{
return PR_FALSE;
return false;
}
bool
@ -281,12 +281,12 @@ nsNativeKeyBindings::KeyPress(const nsNativeKeyEvent& aEvent,
keyCode = DOMKeyCodeToGdkKeyCode(aEvent.keyCode);
if (KeyPressInternal(aEvent, aCallback, aCallbackData, keyCode))
return PR_TRUE;
return true;
nsKeyEvent *nativeKeyEvent = static_cast<nsKeyEvent*>(aEvent.nativeEvent);
if (!nativeKeyEvent || nativeKeyEvent->eventStructType != NS_KEY_EVENT &&
nativeKeyEvent->message != NS_KEY_PRESS)
return PR_FALSE;
return false;
for (PRUint32 i = 0; i < nativeKeyEvent->alternativeCharCodes.Length(); ++i) {
PRUint32 ch = nativeKeyEvent->isShift ?
@ -295,7 +295,7 @@ nsNativeKeyBindings::KeyPress(const nsNativeKeyEvent& aEvent,
if (ch && ch != aEvent.charCode) {
keyCode = gdk_unicode_to_keyval(ch);
if (KeyPressInternal(aEvent, aCallback, aCallbackData, keyCode))
return PR_TRUE;
return true;
}
}
@ -312,7 +312,7 @@ See bugs 411005 406407
static_cast<GdkEventKey*>(guiEvent->pluginEvent));
*/
return PR_FALSE;
return false;
}
bool
@ -333,7 +333,7 @@ nsNativeKeyBindings::KeyPressInternal(const nsNativeKeyEvent& aEvent,
gCurrentCallback = aCallback;
gCurrentCallbackData = aCallbackData;
gHandled = PR_FALSE;
gHandled = false;
gtk_bindings_activate(GTK_OBJECT(mNativeTarget),
aKeyCode, GdkModifierType(modifiers));
@ -348,5 +348,5 @@ bool
nsNativeKeyBindings::KeyUp(const nsNativeKeyEvent& aEvent,
DoCommandCallback aCallback, void *aCallbackData)
{
return PR_FALSE;
return false;
}

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

@ -82,7 +82,7 @@ nsNativeThemeGTK::nsNativeThemeGTK()
// We have to call moz_gtk_shutdown before the event loop stops running.
nsCOMPtr<nsIObserverService> obsServ =
mozilla::services::GetObserverService();
obsServ->AddObserver(this, "xpcom-shutdown", PR_FALSE);
obsServ->AddObserver(this, "xpcom-shutdown", false);
memset(mDisabledWidgetTypes, 0, sizeof(mDisabledWidgetTypes));
memset(mSafeWidgetStates, 0, sizeof(mSafeWidgetStates));
@ -304,14 +304,14 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
(curpos == maxpos &&
(aWidgetType == NS_THEME_SCROLLBAR_BUTTON_DOWN ||
aWidgetType == NS_THEME_SCROLLBAR_BUTTON_RIGHT)))
aState->disabled = PR_TRUE;
aState->disabled = true;
// In order to simulate native GTK scrollbar click behavior,
// we set the active attribute on the element to true if it's
// pressed with any mouse button.
// This allows us to show that it's active without setting :active
else if (CheckBooleanAttr(aFrame, nsWidgetAtoms::active))
aState->active = PR_TRUE;
aState->active = true;
if (aWidgetFlags) {
*aWidgetFlags = GetScrollbarButtonType(aFrame);
@ -466,9 +466,9 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
if (aWidgetFlags) {
// In this case, the flag denotes whether the header is the sorted one or not
if (GetTreeSortDirection(aFrame) == eTreeSortDirection_Natural)
*aWidgetFlags = PR_FALSE;
*aWidgetFlags = false;
else
*aWidgetFlags = PR_TRUE;
*aWidgetFlags = true;
}
aGtkWidgetType = MOZ_GTK_TREE_HEADER_CELL;
break;
@ -490,7 +490,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
#if GTK_CHECK_VERSION(2,10,0)
*aWidgetFlags = GTK_ARROW_NONE;
#else
return PR_FALSE; // Don't draw when we shouldn't
return false; // Don't draw when we shouldn't
#endif // GTK_CHECK_VERSION(2,10,0)
break;
}
@ -513,7 +513,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
*aWidgetFlags = IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XHTML);
break;
case NS_THEME_DROPDOWN_TEXT:
return PR_FALSE; // nothing to do, but prevents the bg from being drawn
return false; // nothing to do, but prevents the bg from being drawn
case NS_THEME_DROPDOWN_TEXTFIELD:
aGtkWidgetType = MOZ_GTK_DROPDOWN_ENTRY;
break;
@ -642,10 +642,10 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
aGtkWidgetType = MOZ_GTK_WINDOW;
break;
default:
return PR_FALSE;
return false;
}
return PR_TRUE;
return true;
}
class ThemeRenderer : public gfxGdkNativeRenderer {
@ -703,10 +703,10 @@ nsNativeThemeGTK::GetExtraSizeForWidget(nsIFrame* aFrame, PRUint8 aWidgetType,
switch (aWidgetType) {
case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
aExtra->top = aExtra->bottom = 1;
return PR_TRUE;
return true;
case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
aExtra->left = aExtra->right = 1;
return PR_TRUE;
return true;
// Include the indicator spacing (the padding around the control).
case NS_THEME_CHECKBOX:
@ -724,7 +724,7 @@ nsNativeThemeGTK::GetExtraSizeForWidget(nsIFrame* aFrame, PRUint8 aWidgetType,
aExtra->right = indicator_spacing;
aExtra->bottom = indicator_spacing;
aExtra->left = indicator_spacing;
return PR_TRUE;
return true;
}
case NS_THEME_BUTTON :
{
@ -737,19 +737,19 @@ nsNativeThemeGTK::GetExtraSizeForWidget(nsIFrame* aFrame, PRUint8 aWidgetType,
aExtra->right = right;
aExtra->bottom = bottom;
aExtra->left = left;
return PR_TRUE;
return true;
}
}
case NS_THEME_TAB :
{
if (!IsSelectedTab(aFrame))
return PR_FALSE;
return false;
gint gap_height = moz_gtk_get_tab_thickness();
PRInt32 extra = gap_height - GetTabMarginPixels(aFrame);
if (extra <= 0)
return PR_FALSE;
return false;
if (IsBottomTab(aFrame)) {
aExtra->top = extra;
@ -758,7 +758,7 @@ nsNativeThemeGTK::GetExtraSizeForWidget(nsIFrame* aFrame, PRUint8 aWidgetType,
}
}
default:
return PR_FALSE;
return false;
}
}
@ -975,14 +975,14 @@ nsNativeThemeGTK::GetWidgetPadding(nsDeviceContext* aContext,
case NS_THEME_CHECKBOX:
case NS_THEME_RADIO:
aResult->SizeTo(0, 0, 0, 0);
return PR_TRUE;
return true;
case NS_THEME_MENUITEM:
case NS_THEME_CHECKMENUITEM:
case NS_THEME_RADIOMENUITEM:
{
// Menubar and menulist have their padding specified in CSS.
if (!IsRegularMenuItem(aFrame))
return PR_FALSE;
return false;
aResult->SizeTo(0, 0, 0, 0);
GtkThemeWidgetType gtkWidgetType;
@ -1003,11 +1003,11 @@ nsNativeThemeGTK::GetWidgetPadding(nsDeviceContext* aContext,
aResult->left += horizontal_padding;
aResult->right += horizontal_padding;
return PR_TRUE;
return true;
}
}
return PR_FALSE;
return false;
}
bool
@ -1019,7 +1019,7 @@ nsNativeThemeGTK::GetWidgetOverflow(nsDeviceContext* aContext,
PRInt32 p2a;
nsIntMargin extraSize;
if (!GetExtraSizeForWidget(aFrame, aWidgetType, &extraSize))
return PR_FALSE;
return false;
p2a = aContext->AppUnitsPerDevPixel();
m = nsMargin(NSIntPixelsToAppUnits(extraSize.left, p2a),
@ -1028,7 +1028,7 @@ nsNativeThemeGTK::GetWidgetOverflow(nsDeviceContext* aContext,
NSIntPixelsToAppUnits(extraSize.bottom, p2a));
aOverflowRect->Inflate(m);
return PR_TRUE;
return true;
}
NS_IMETHODIMP
@ -1037,7 +1037,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
nsIntSize* aResult, bool* aIsOverridable)
{
aResult->width = aResult->height = 0;
*aIsOverridable = PR_TRUE;
*aIsOverridable = true;
switch (aWidgetType) {
case NS_THEME_SCROLLBAR_BUTTON_UP:
@ -1048,7 +1048,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
aResult->width = metrics.slider_width;
aResult->height = metrics.stepper_size;
*aIsOverridable = PR_FALSE;
*aIsOverridable = false;
}
break;
case NS_THEME_SCROLLBAR_BUTTON_LEFT:
@ -1059,7 +1059,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
aResult->width = metrics.stepper_size;
aResult->height = metrics.slider_width;
*aIsOverridable = PR_FALSE;
*aIsOverridable = false;
}
break;
case NS_THEME_SPLITTER:
@ -1074,7 +1074,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
aResult->width = 0;
aResult->height = metrics;
}
*aIsOverridable = PR_FALSE;
*aIsOverridable = false;
}
break;
case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
@ -1093,7 +1093,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
else
aResult->height = metrics.slider_width;
*aIsOverridable = PR_FALSE;
*aIsOverridable = false;
}
break;
case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
@ -1109,7 +1109,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
/* Get the available space, if that is smaller then the minimum size,
* adjust the mininum size to fit into it.
* Setting aIsOverridable to PR_TRUE has no effect for thumbs. */
* Setting aIsOverridable to true has no effect for thumbs. */
aFrame->GetMargin(margin);
rect.Deflate(margin);
aFrame->GetParent()->GetBorderAndPadding(margin);
@ -1125,7 +1125,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
metrics.min_slider_size);
}
*aIsOverridable = PR_FALSE;
*aIsOverridable = false;
}
break;
case NS_THEME_SCALE_THUMB_HORIZONTAL:
@ -1143,21 +1143,21 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
aResult->height = thumb_height;
}
*aIsOverridable = PR_FALSE;
*aIsOverridable = false;
}
break;
case NS_THEME_TAB_SCROLLARROW_BACK:
case NS_THEME_TAB_SCROLLARROW_FORWARD:
{
moz_gtk_get_tab_scroll_arrow_size(&aResult->width, &aResult->height);
*aIsOverridable = PR_FALSE;
*aIsOverridable = false;
}
break;
case NS_THEME_DROPDOWN_BUTTON:
{
moz_gtk_get_combo_box_entry_button_size(&aResult->width,
&aResult->height);
*aIsOverridable = PR_FALSE;
*aIsOverridable = false;
}
break;
case NS_THEME_MENUSEPARATOR:
@ -1167,7 +1167,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
moz_gtk_get_menu_separator_height(&separator_height);
aResult->height = separator_height;
*aIsOverridable = PR_FALSE;
*aIsOverridable = false;
}
break;
case NS_THEME_CHECKBOX:
@ -1184,7 +1184,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
// Include space for the indicator and the padding around it.
aResult->width = indicator_size;
aResult->height = indicator_size;
*aIsOverridable = PR_FALSE;
*aIsOverridable = false;
}
break;
case NS_THEME_TOOLBAR_BUTTON_DROPDOWN:
@ -1194,7 +1194,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
case NS_THEME_BUTTON_ARROW_PREVIOUS:
{
moz_gtk_get_arrow_size(&aResult->width, &aResult->height);
*aIsOverridable = PR_FALSE;
*aIsOverridable = false;
}
break;
case NS_THEME_CHECKBOX_CONTAINER:
@ -1238,7 +1238,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
case NS_THEME_RESIZER:
// same as Windows to make our lives easier
aResult->width = aResult->height = 15;
*aIsOverridable = PR_FALSE;
*aIsOverridable = false;
break;
case NS_THEME_TREEVIEW_TWISTY:
case NS_THEME_TREEVIEW_TWISTY_OPEN:
@ -1247,7 +1247,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
moz_gtk_get_treeview_expander_size(&expander_size);
aResult->width = aResult->height = expander_size;
*aIsOverridable = PR_FALSE;
*aIsOverridable = false;
}
break;
}
@ -1274,7 +1274,7 @@ nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
aWidgetType == NS_THEME_MENUSEPARATOR ||
aWidgetType == NS_THEME_WINDOW ||
aWidgetType == NS_THEME_DIALOG) {
*aShouldRepaint = PR_FALSE;
*aShouldRepaint = false;
return NS_OK;
}
@ -1284,7 +1284,7 @@ nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
aWidgetType == NS_THEME_SCROLLBAR_BUTTON_RIGHT) &&
(aAttribute == nsWidgetAtoms::curpos ||
aAttribute == nsWidgetAtoms::maxpos)) {
*aShouldRepaint = PR_TRUE;
*aShouldRepaint = true;
return NS_OK;
}
@ -1293,12 +1293,12 @@ nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
// For example, a toolbar doesn't care about any states.
if (!aAttribute) {
// Hover/focus/active changed. Always repaint.
*aShouldRepaint = PR_TRUE;
*aShouldRepaint = true;
}
else {
// Check the attribute to see if it's relevant.
// disabled, checked, dlgtype, default, etc.
*aShouldRepaint = PR_FALSE;
*aShouldRepaint = false;
if (aAttribute == nsWidgetAtoms::disabled ||
aAttribute == nsWidgetAtoms::checked ||
aAttribute == nsWidgetAtoms::selected ||
@ -1308,7 +1308,7 @@ nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
aAttribute == nsWidgetAtoms::mozmenuactive ||
aAttribute == nsWidgetAtoms::open ||
aAttribute == nsWidgetAtoms::parentfocused)
*aShouldRepaint = PR_TRUE;
*aShouldRepaint = true;
}
return NS_OK;
@ -1329,7 +1329,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
PRUint8 aWidgetType)
{
if (IsWidgetTypeDisabled(mDisabledWidgetTypes, aWidgetType))
return PR_FALSE;
return false;
switch (aWidgetType) {
case NS_THEME_BUTTON:
@ -1422,7 +1422,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
}
return PR_FALSE;
return false;
}
NS_IMETHODIMP_(bool)
@ -1438,8 +1438,8 @@ nsNativeThemeGTK::WidgetIsContainer(PRUint8 aWidgetType)
aWidgetType == NS_THEME_BUTTON_ARROW_DOWN ||
aWidgetType == NS_THEME_BUTTON_ARROW_NEXT ||
aWidgetType == NS_THEME_BUTTON_ARROW_PREVIOUS)
return PR_FALSE;
return PR_TRUE;
return false;
return true;
}
bool
@ -1448,15 +1448,15 @@ nsNativeThemeGTK::ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame
if (aWidgetType == NS_THEME_DROPDOWN ||
aWidgetType == NS_THEME_BUTTON ||
aWidgetType == NS_THEME_TREEVIEW_HEADER_CELL)
return PR_TRUE;
return true;
return PR_FALSE;
return false;
}
bool
nsNativeThemeGTK::ThemeNeedsComboboxDropmarker()
{
return PR_FALSE;
return false;
}
nsITheme::Transparency

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

@ -74,7 +74,7 @@ nsPSPrinterList::Enabled()
{
const char *val = PR_GetEnv("MOZILLA_POSTSCRIPT_ENABLED");
if (val && (val[0] == '0' || !PL_strcasecmp(val, "false")))
return PR_FALSE;
return false;
// is the PS module enabled?
return Preferences::GetBool("print.postscript.enabled", true);

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

@ -51,8 +51,8 @@ class nsPSPrinterList {
/**
* Is the PostScript module enabled or disabled?
* @return PR_TRUE if enabled,
* PR_FALSE if not.
* @return true if enabled,
* false if not.
*/
bool Enabled();

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

@ -47,13 +47,13 @@ const nsPaperSizePS_ nsPaperSizePS::mList[] =
{
#define SIZE_MM(x) (x)
#define SIZE_INCH(x) ((x) * MM_PER_INCH_FLOAT)
{ "A5", SIZE_MM(148), SIZE_MM(210), PR_TRUE },
{ "A4", SIZE_MM(210), SIZE_MM(297), PR_TRUE },
{ "A3", SIZE_MM(297), SIZE_MM(420), PR_TRUE },
{ "Letter", SIZE_INCH(8.5), SIZE_INCH(11), PR_FALSE },
{ "Legal", SIZE_INCH(8.5), SIZE_INCH(14), PR_FALSE },
{ "Tabloid", SIZE_INCH(11), SIZE_INCH(17), PR_FALSE },
{ "Executive", SIZE_INCH(7.5), SIZE_INCH(10), PR_FALSE },
{ "A5", SIZE_MM(148), SIZE_MM(210), true },
{ "A4", SIZE_MM(210), SIZE_MM(297), true },
{ "A3", SIZE_MM(297), SIZE_MM(420), true },
{ "Letter", SIZE_INCH(8.5), SIZE_INCH(11), false },
{ "Legal", SIZE_INCH(8.5), SIZE_INCH(14), false },
{ "Tabloid", SIZE_INCH(11), SIZE_INCH(17), false },
{ "Executive", SIZE_INCH(7.5), SIZE_INCH(10), false },
#undef SIZE_INCH
#undef SIZE_MM
};
@ -66,8 +66,8 @@ nsPaperSizePS::Find(const char *aName)
for (int i = mCount; i--; ) {
if (!PL_strcasecmp(aName, mList[i].name)) {
mCurrent = i;
return PR_TRUE;
return true;
}
}
return PR_FALSE;
return false;
}

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

@ -58,7 +58,7 @@ class nsPaperSizePS {
nsPaperSizePS() { mCurrent = 0; }
/** ---------------------------------------------------
* @return PR_TRUE if the cursor points past the last item.
* @return true if the cursor points past the last item.
*/
bool AtEnd() { return mCurrent >= mCount; }
@ -79,7 +79,7 @@ class nsPaperSizePS {
/** ---------------------------------------------------
* Point the cursor to the entry with the given paper name.
* @return PR_TRUE if pointing to a valid entry.
* @return true if pointing to a valid entry.
*/
bool Find(const char *aName);
@ -108,7 +108,7 @@ class nsPaperSizePS {
}
/** ---------------------------------------------------
* @return PR_TRUE if the paper should be presented to
* @return true if the paper should be presented to
* the user in metric units.
*/
bool IsMetric() {

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше