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?!"); NS_ASSERTION(targetDocument, "No document while accessible is in document?!");
nsINode* targetNode = accessible->GetNode(); nsINode* targetNode = accessible->GetNode();
nsIContent* targetContent = targetNode->IsElement() ?
targetNode->AsElement() : nsnull;
nsIContent* origTargetContent = origTargetNode->IsElement() ?
origTargetNode->AsElement() : nsnull;
#ifdef MOZ_XUL #ifdef MOZ_XUL
bool isTree = targetContent ? bool isTree = targetNode->IsElement() &&
targetContent->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL) : targetNode->AsElement()->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL);
PR_FALSE;
if (isTree) { if (isTree) {
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(accessible); nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(accessible);

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

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

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

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

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

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

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

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

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

@ -64,24 +64,26 @@ interface nsIFrameMessageListener : nsISupports
void receiveMessage(); void receiveMessage();
}; };
[scriptable, uuid(6b736edb-863d-40bd-bca2-62f44da803c0)] [scriptable, uuid(a27d8fcd-8de9-4a51-87f4-2b83bba901d5)]
interface nsIFrameMessageManager : nsISupports interface nsIFrameMessageManager : nsISupports
{ {
void addMessageListener(in AString aMessage, in nsIFrameMessageListener aListener); void addMessageListener(in AString aMessage, in nsIFrameMessageListener aListener);
void removeMessageListener(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 interface nsISyncMessageSender : nsIFrameMessageManager
{ {
/** /**
* Returns an array of JSON objects. * 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 interface nsIContentFrameMessageManager : nsISyncMessageSender
{ {
/** /**
@ -112,20 +114,20 @@ interface nsIContentFrameMessageManager : nsISyncMessageSender
DOMString btoa(in DOMString aBase64Data); DOMString btoa(in DOMString aBase64Data);
}; };
[uuid(9c48d557-92fe-4edb-95fc-bfe97e77bdc3)] [uuid(1f7af930-a232-4a84-a049-73eaa45f2db5)]
interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
{ {
[notxpcom] nsIContent getOwnerContent(); [notxpcom] nsIContent getOwnerContent();
}; };
[scriptable, uuid(6331bbca-2c9f-4766-b3c7-ae75554bf1ec)] [scriptable, uuid(e91b0939-a74a-4c4f-8cfd-17dd42e8642a)]
interface nsITreeItemFrameMessageManager : nsIFrameMessageManager interface nsITreeItemFrameMessageManager : nsIFrameMessageManager
{ {
readonly attribute unsigned long childCount; readonly attribute unsigned long childCount;
nsITreeItemFrameMessageManager getChildAt(in unsigned long aIndex); nsITreeItemFrameMessageManager getChildAt(in unsigned long aIndex);
}; };
[scriptable, uuid(9e5c0526-aa4c-49f0-afbb-57f489cd9b59)] [scriptable, uuid(14e1f147-793d-4788-bbbb-ae806ecdddbb)]
interface nsIChromeFrameMessageManager : nsITreeItemFrameMessageManager interface nsIChromeFrameMessageManager : nsITreeItemFrameMessageManager
{ {
/** /**

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

@ -1356,70 +1356,70 @@ nsAttrValue::StringToInteger(const nsAString& aValue, bool* aStrict,
bool aCanBePercent, bool aCanBePercent,
bool* aIsPercent) const bool* aIsPercent) const
{ {
*aStrict = PR_FALSE; *aStrict = true;
*aErrorCode = NS_ERROR_ILLEGAL_VALUE; *aErrorCode = NS_ERROR_ILLEGAL_VALUE;
if (aCanBePercent) { if (aCanBePercent) {
*aIsPercent = PR_FALSE; *aIsPercent = false;
} }
nsAString::const_iterator iter, end; nsAString::const_iterator iter, end;
aValue.BeginReading(iter); aValue.BeginReading(iter);
aValue.EndReading(end); aValue.EndReading(end);
while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) {
*aStrict = false;
++iter;
}
if (iter == end) {
return 0;
}
bool negate = false; bool negate = false;
if (*iter == PRUnichar('-')) {
negate = true;
++iter;
} else if (*iter == PRUnichar('+')) {
*aStrict = false;
++iter;
}
PRInt32 value = 0; PRInt32 value = 0;
if (iter != end) { PRInt32 pValue = 0; // Previous value, used to check integer overflow
if (*iter == PRUnichar('-')) { while (iter != end) {
negate = PR_TRUE; if (*iter >= PRUnichar('0') && *iter <= PRUnichar('9')) {
value = (value * 10) + (*iter - PRUnichar('0'));
++iter; ++iter;
} // Checking for integer overflow.
if (iter != end) { if (pValue > value) {
if ((*iter >= PRUnichar('1') || (*iter == PRUnichar('0') && !negate)) && *aStrict = false;
*iter <= PRUnichar('9')) { *aErrorCode = NS_ERROR_ILLEGAL_VALUE;
value = *iter - PRUnichar('0'); break;
++iter; } else {
*aStrict = (value != 0 || iter == end || pValue = value;
(aCanBePercent && *iter == PRUnichar('%'))); *aErrorCode = NS_OK;
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;
}
}
} }
} 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 value;
return tmp.ToInteger(aErrorCode);
} }
PRInt64 PRInt64

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

@ -38,8 +38,7 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
/* /*
* Implementations of nsIDOMDOMStringList and nsIDOMNameList, used by various * Implementation of nsIDOMDOMStringList, used by various DOM stuff.
* DOM3 stuff and some interfaces specified by WHATWG.
*/ */
#include "nsDOMLists.h" #include "nsDOMLists.h"
@ -95,92 +94,3 @@ nsDOMStringList::Contains(const nsAString& aString, bool *aResult)
return NS_OK; 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 ***** */ * ***** END LICENSE BLOCK ***** */
/* /*
* Implementations of nsIDOMDOMStringList and nsIDOMNameList, used by various * Implementation of nsIDOMDOMStringList, used by various DOM stuff.
* DOM3 stuff and some interfaces specified by WHATWG.
*/ */
#ifndef nsDOMLists_h___ #ifndef nsDOMLists_h___
#define nsDOMLists_h___ #define nsDOMLists_h___
#include "nsIDOMDOMStringList.h" #include "nsIDOMDOMStringList.h"
#include "nsIDOMNameList.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsString.h" #include "nsString.h"
@ -68,20 +66,4 @@ private:
nsTArray<nsString> mNames; 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___ */ #endif /* nsDOMLists_h___ */

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

@ -4493,11 +4493,6 @@ nsDocument::CreateProcessingInstruction(const nsAString& aTarget,
{ {
*aReturn = nsnull; *aReturn = nsnull;
// There are no PIs for HTML
if (IsHTML()) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
nsresult rv = nsContentUtils::CheckQName(aTarget, PR_FALSE); nsresult rv = nsContentUtils::CheckQName(aTarget, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
@ -5893,23 +5888,6 @@ nsDocument::GetInputEncoding(nsAString& aInputEncoding)
return NS_OK; 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 NS_IMETHODIMP
nsDocument::GetXmlStandalone(bool *aXmlStandalone) nsDocument::GetXmlStandalone(bool *aXmlStandalone)
{ {
@ -8467,114 +8445,114 @@ nsIDocument::SizeOf() const
return size; return size;
} }
// Returns the root document in a document hierarchy. // Returns the root document in a document hierarchy.
static nsIDocument* static nsIDocument*
GetRootDocument(nsIDocument* aDoc) GetRootDocument(nsIDocument* aDoc)
{ {
if (!aDoc) { if (!aDoc) {
return nsnull; return nsnull;
} }
nsCOMPtr<nsIPresShell> shell = aDoc->GetShell(); nsCOMPtr<nsIPresShell> shell = aDoc->GetShell();
if (!shell) { if (!shell) {
return nsnull; return nsnull;
} }
nsPresContext* ctx = shell->GetPresContext(); nsPresContext* ctx = shell->GetPresContext();
if (!ctx) { if (!ctx) {
return nsnull; return nsnull;
} }
nsRootPresContext* rpc = ctx->GetRootPresContext(); nsRootPresContext* rpc = ctx->GetRootPresContext();
if (!rpc) { if (!rpc) {
return nsnull; return nsnull;
} }
return rpc->Document(); return rpc->Document();
} }
class nsDispatchFullScreenChange : public nsRunnable class nsDispatchFullScreenChange : public nsRunnable
{ {
public: public:
nsDispatchFullScreenChange(nsIDocument *aDoc) nsDispatchFullScreenChange(nsIDocument *aDoc)
: mDoc(aDoc) : mDoc(aDoc)
{ {
mTarget = aDoc->GetFullScreenElement(); mTarget = aDoc->GetFullScreenElement();
if (!mTarget) { if (!mTarget) {
mTarget = aDoc; mTarget = aDoc;
} }
} }
NS_IMETHOD Run() NS_IMETHOD Run()
{ {
nsContentUtils::DispatchTrustedEvent(mDoc, nsContentUtils::DispatchTrustedEvent(mDoc,
mTarget, mTarget,
NS_LITERAL_STRING("mozfullscreenchange"), NS_LITERAL_STRING("mozfullscreenchange"),
PR_TRUE, PR_TRUE,
PR_FALSE); PR_FALSE);
return NS_OK; return NS_OK;
} }
nsCOMPtr<nsIDocument> mDoc; nsCOMPtr<nsIDocument> mDoc;
nsCOMPtr<nsISupports> mTarget; nsCOMPtr<nsISupports> mTarget;
}; };
void void
nsDocument::UpdateFullScreenStatus(bool aIsFullScreen) nsDocument::UpdateFullScreenStatus(bool aIsFullScreen)
{ {
if (mIsFullScreen != aIsFullScreen) { if (mIsFullScreen != aIsFullScreen) {
nsCOMPtr<nsIRunnable> event(new nsDispatchFullScreenChange(this)); nsCOMPtr<nsIRunnable> event(new nsDispatchFullScreenChange(this));
NS_DispatchToCurrentThread(event); NS_DispatchToCurrentThread(event);
} }
mIsFullScreen = aIsFullScreen; mIsFullScreen = aIsFullScreen;
if (!mIsFullScreen) { if (!mIsFullScreen) {
// Full-screen is being turned off. Reset the full-screen element, to // Full-screen is being turned off. Reset the full-screen element, to
// save us from having to traverse the document hierarchy again in // save us from having to traverse the document hierarchy again in
// MozCancelFullScreen(). // MozCancelFullScreen().
ResetFullScreenElement(); ResetFullScreenElement();
} }
} }
static bool static bool
UpdateFullScreenStatus(nsIDocument* aDocument, void* aData) UpdateFullScreenStatus(nsIDocument* aDocument, void* aData)
{ {
aDocument->UpdateFullScreenStatus(*static_cast<bool*>(aData)); aDocument->UpdateFullScreenStatus(*static_cast<bool*>(aData));
aDocument->EnumerateSubDocuments(UpdateFullScreenStatus, aData); aDocument->EnumerateSubDocuments(UpdateFullScreenStatus, aData);
return PR_TRUE; return PR_TRUE;
} }
static void static void
UpdateFullScreenStatusInDocTree(nsIDocument* aDoc, bool aIsFullScreen) UpdateFullScreenStatusInDocTree(nsIDocument* aDoc, bool aIsFullScreen)
{ {
nsIDocument* root = GetRootDocument(aDoc); nsIDocument* root = GetRootDocument(aDoc);
if (root) { if (root) {
UpdateFullScreenStatus(root, static_cast<void*>(&aIsFullScreen)); UpdateFullScreenStatus(root, static_cast<void*>(&aIsFullScreen));
} }
} }
void void
nsDocument::ResetFullScreenElement() nsDocument::ResetFullScreenElement()
{ {
if (mFullScreenElement) { if (mFullScreenElement) {
nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_FALSE); nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_FALSE);
} }
mFullScreenElement = nsnull; mFullScreenElement = nsnull;
} }
static bool static bool
ResetFullScreenElement(nsIDocument* aDocument, void* aData) ResetFullScreenElement(nsIDocument* aDocument, void* aData)
{ {
aDocument->ResetFullScreenElement(); aDocument->ResetFullScreenElement();
aDocument->EnumerateSubDocuments(ResetFullScreenElement, aData); aDocument->EnumerateSubDocuments(ResetFullScreenElement, aData);
return PR_TRUE; return PR_TRUE;
} }
static void static void
ResetFullScreenElementInDocTree(nsIDocument* aDoc) ResetFullScreenElementInDocTree(nsIDocument* aDoc)
{ {
nsIDocument* root = GetRootDocument(aDoc); nsIDocument* root = GetRootDocument(aDoc);
if (root) { if (root) {
ResetFullScreenElement(root, nsnull); ResetFullScreenElement(root, nsnull);
} }
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDocument::MozCancelFullScreen() nsDocument::MozCancelFullScreen()
{ {
if (!nsContentUtils::IsRequestFullScreenAllowed()) { if (!nsContentUtils::IsRequestFullScreenAllowed()) {
@ -8582,104 +8560,104 @@ nsDocument::MozCancelFullScreen()
} }
CancelFullScreen(); CancelFullScreen();
return NS_OK; return NS_OK;
} }
void void
nsDocument::CancelFullScreen() nsDocument::CancelFullScreen()
{ {
if (!nsContentUtils::IsFullScreenApiEnabled() || if (!nsContentUtils::IsFullScreenApiEnabled() ||
!IsFullScreenDoc() || !IsFullScreenDoc() ||
!GetWindow()) { !GetWindow()) {
return; return;
} }
// Disable full-screen mode in all documents in this hierarchy. // Disable full-screen mode in all documents in this hierarchy.
UpdateFullScreenStatusInDocTree(this, PR_FALSE); UpdateFullScreenStatusInDocTree(this, PR_FALSE);
// Move the window out of full-screen mode. // Move the window out of full-screen mode.
GetWindow()->SetFullScreen(PR_FALSE); GetWindow()->SetFullScreen(PR_FALSE);
return; return;
} }
bool bool
nsDocument::IsFullScreenDoc() nsDocument::IsFullScreenDoc()
{ {
return nsContentUtils::IsFullScreenApiEnabled() && mIsFullScreen; return nsContentUtils::IsFullScreenApiEnabled() && mIsFullScreen;
} }
void void
nsDocument::RequestFullScreen(Element* aElement) nsDocument::RequestFullScreen(Element* aElement)
{ {
if (!aElement || !nsContentUtils::IsFullScreenApiEnabled() || !GetWindow()) { if (!aElement || !nsContentUtils::IsFullScreenApiEnabled() || !GetWindow()) {
return; return;
} }
// Reset the full-screen elements of every document in this document // Reset the full-screen elements of every document in this document
// hierarchy. // hierarchy.
ResetFullScreenElementInDocTree(this); ResetFullScreenElementInDocTree(this);
if (aElement->IsInDoc()) { if (aElement->IsInDoc()) {
// Propagate up the document hierarchy, setting the full-screen element as // Propagate up the document hierarchy, setting the full-screen element as
// the element's container in ancestor documents. Note we don't propagate // the element's container in ancestor documents. Note we don't propagate
// down the document hierarchy, the full-screen element (or its container) // down the document hierarchy, the full-screen element (or its container)
// is not visible there. // is not visible there.
mFullScreenElement = aElement; mFullScreenElement = aElement;
// Set the full-screen state on the element, so the css-pseudo class // Set the full-screen state on the element, so the css-pseudo class
// applies to the element. // applies to the element.
nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_TRUE); nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_TRUE);
nsIDocument* child = this; nsIDocument* child = this;
nsIDocument* parent; nsIDocument* parent;
while (parent = child->GetParentDocument()) { while (parent = child->GetParentDocument()) {
nsIContent* content = parent->FindContentForSubDocument(child); nsIContent* content = parent->FindContentForSubDocument(child);
nsCOMPtr<Element> element(do_QueryInterface(content)); nsCOMPtr<Element> element(do_QueryInterface(content));
// Containing frames also need the css-pseudo class applied. // Containing frames also need the css-pseudo class applied.
nsEventStateManager::SetFullScreenState(element, PR_TRUE); nsEventStateManager::SetFullScreenState(element, PR_TRUE);
static_cast<nsDocument*>(parent)->mFullScreenElement = element; static_cast<nsDocument*>(parent)->mFullScreenElement = element;
child = parent; child = parent;
} }
} }
// Set all documents in hierarchy to full-screen mode. // Set all documents in hierarchy to full-screen mode.
UpdateFullScreenStatusInDocTree(this, PR_TRUE); UpdateFullScreenStatusInDocTree(this, PR_TRUE);
// Make the window full-screen. Note we must make the state changes above // Make the window full-screen. Note we must make the state changes above
// before making the window full-screen, as then the document reports as // before making the window full-screen, as then the document reports as
// being in full-screen mode when the Chrome "fullscreen" event fires, // being in full-screen mode when the Chrome "fullscreen" event fires,
// enabling browser.js to distinguish between browser and dom full-screen // enabling browser.js to distinguish between browser and dom full-screen
// modes. // modes.
GetWindow()->SetFullScreen(PR_TRUE); GetWindow()->SetFullScreen(PR_TRUE);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDocument::GetMozFullScreenElement(nsIDOMHTMLElement **aFullScreenElement) nsDocument::GetMozFullScreenElement(nsIDOMHTMLElement **aFullScreenElement)
{ {
NS_ENSURE_ARG_POINTER(aFullScreenElement); NS_ENSURE_ARG_POINTER(aFullScreenElement);
if (!nsContentUtils::IsFullScreenApiEnabled() || !IsFullScreenDoc()) { if (!nsContentUtils::IsFullScreenApiEnabled() || !IsFullScreenDoc()) {
*aFullScreenElement = nsnull; *aFullScreenElement = nsnull;
return NS_OK; return NS_OK;
} }
nsCOMPtr<nsIDOMHTMLElement> e(do_QueryInterface(GetFullScreenElement())); nsCOMPtr<nsIDOMHTMLElement> e(do_QueryInterface(GetFullScreenElement()));
NS_IF_ADDREF(*aFullScreenElement = e); NS_IF_ADDREF(*aFullScreenElement = e);
return NS_OK; return NS_OK;
} }
Element* Element*
nsDocument::GetFullScreenElement() nsDocument::GetFullScreenElement()
{ {
if (!nsContentUtils::IsFullScreenApiEnabled() || if (!nsContentUtils::IsFullScreenApiEnabled() ||
(mFullScreenElement && !mFullScreenElement->IsInDoc())) { (mFullScreenElement && !mFullScreenElement->IsInDoc())) {
return nsnull; return nsnull;
} }
return mFullScreenElement; return mFullScreenElement;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDocument::GetMozFullScreen(bool *aFullScreen) nsDocument::GetMozFullScreen(bool *aFullScreen)
{ {
NS_ENSURE_ARG_POINTER(aFullScreen); NS_ENSURE_ARG_POINTER(aFullScreen);
*aFullScreen = nsContentUtils::IsFullScreenApiEnabled() && IsFullScreenDoc(); *aFullScreen = nsContentUtils::IsFullScreenApiEnabled() && IsFullScreenDoc();
return NS_OK; return NS_OK;
} }
PRInt64 PRInt64

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

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

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

@ -53,7 +53,7 @@
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "nsFrameMessageManager.h" #include "nsFrameMessageManager.h"
#include "Layers.h" #include "Layers.h"
#include "nsIContent.h" #include "mozilla/dom/Element.h"
class nsIURI; class nsIURI;
class nsSubDocumentFrame; class nsSubDocumentFrame;
@ -170,7 +170,7 @@ class nsFrameLoader : public nsIFrameLoader,
typedef mozilla::layout::RenderFrameParent RenderFrameParent; typedef mozilla::layout::RenderFrameParent RenderFrameParent;
protected: protected:
nsFrameLoader(nsIContent *aOwner, bool aNetworkCreated); nsFrameLoader(mozilla::dom::Element* aOwner, bool aNetworkCreated);
public: public:
~nsFrameLoader() { ~nsFrameLoader() {
@ -186,7 +186,8 @@ public:
return !!(mRenderMode & RENDER_MODE_ASYNC_SCROLL); 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_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader) NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
@ -279,8 +280,8 @@ public:
} }
nsFrameMessageManager* GetFrameMessageManager() { return mMessageManager; } nsFrameMessageManager* GetFrameMessageManager() { return mMessageManager; }
nsIContent* GetOwnerContent() { return mOwnerContent; } mozilla::dom::Element* GetOwnerContent() { return mOwnerContent; }
void SetOwnerContent(nsIContent* aContent); void SetOwnerContent(mozilla::dom::Element* aContent);
private: private:
@ -313,7 +314,7 @@ private:
nsCOMPtr<nsIDocShell> mDocShell; nsCOMPtr<nsIDocShell> mDocShell;
nsCOMPtr<nsIURI> mURIToLoad; nsCOMPtr<nsIURI> mURIToLoad;
nsIContent *mOwnerContent; // WEAK mozilla::dom::Element* mOwnerContent; // WEAK
public: public:
// public because a callback needs these. // public because a callback needs these.
nsRefPtr<nsFrameMessageManager> mMessageManager; 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 ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
@ -15,11 +15,12 @@
* The Original Code is mozilla.org code. * The Original Code is mozilla.org code.
* *
* The Initial Developer of the Original Code is * The Initial Developer of the Original Code is
* Mozilla Corporation * the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010 * Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved. * the Initial Developer. All Rights Reserved.
* *
* Contributor(s): * Contributor(s):
* Ms2ger <ms2ger@gmail.com>
* *
* Alternatively, the contents of this file may be used under the terms of * 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 * 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) JSONCreator(const jschar* aBuf, uint32 aLen, void* aData)
{ {
nsAString* result = static_cast<nsAString*>(aData); nsAString* result = static_cast<nsAString*>(aData);
result->Append((PRUnichar*)aBuf, (PRUint32)aLen); result->Append(static_cast<const PRUnichar*>(aBuf),
return JS_TRUE; static_cast<PRUint32>(aLen));
return true;
} }
nsresult void
nsFrameMessageManager::GetParamsForMessage(nsAString& aMessageName, nsFrameMessageManager::GetParamsForMessage(const jsval& aObject,
JSContext* aCx,
nsAString& aJSON) nsAString& aJSON)
{ {
aMessageName.Truncate();
aJSON.Truncate(); aJSON.Truncate();
nsAXPCNativeCallContext* ncc = nsnull; JSAutoRequest ar(aCx);
nsresult rv = nsContentUtils::XPConnect()->GetCurrentNativeCallContext(&ncc); jsval v = aObject;
NS_ENSURE_SUCCESS(rv, rv); JS_Stringify(aCx, &v, nsnull, JSVAL_NULL, JSONCreator, &aJSON);
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;
} }
NS_IMETHODIMP 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(!IsGlobal(), "Should not call SendSyncMessage in chrome");
NS_ASSERTION(!IsWindowLevel(), "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!"); NS_ASSERTION(!mParentManager, "Should not have parent manager in content!");
*aRetval = JSVAL_VOID;
if (mSyncCallback) { if (mSyncCallback) {
NS_ENSURE_TRUE(mCallbackData, NS_ERROR_NOT_INITIALIZED); NS_ENSURE_TRUE(mCallbackData, NS_ERROR_NOT_INITIALIZED);
nsString messageName;
nsString json; nsString json;
nsresult rv = GetParamsForMessage(messageName, json); if (aArgc >= 2) {
NS_ENSURE_SUCCESS(rv, rv); GetParamsForMessage(aObject, aCx, json);
}
InfallibleTArray<nsString> retval; InfallibleTArray<nsString> retval;
if (mSyncCallback(mCallbackData, messageName, json, &retval)) { if (mSyncCallback(mCallbackData, aMessageName, json, &retval)) {
nsAXPCNativeCallContext* ncc = nsnull; JSAutoRequest ar(aCx);
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);
PRUint32 len = retval.Length(); 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); NS_ENSURE_TRUE(dataArray, NS_ERROR_OUT_OF_MEMORY);
for (PRUint32 i = 0; i < len; ++i) { for (PRUint32 i = 0; i < len; ++i) {
if (retval[i].IsEmpty()) if (retval[i].IsEmpty()) {
continue; continue;
}
jsval ret = JSVAL_VOID; jsval ret = JSVAL_VOID;
if (!JS_ParseJSON(ctx, (jschar*)retval[i].get(), if (!JS_ParseJSON(aCx, static_cast<const jschar*>(retval[i].get()),
(uint32)retval[i].Length(), &ret)) { retval[i].Length(), &ret)) {
return NS_ERROR_UNEXPECTED; 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; *aRetval = OBJECT_TO_JSVAL(dataArray);
ncc->GetRetValPtr(&retvalPtr);
*retvalPtr = OBJECT_TO_JSVAL(dataArray);
ncc->SetReturnValueWasSet(PR_TRUE);
} }
} }
return NS_OK; return NS_OK;
@ -295,13 +265,16 @@ nsFrameMessageManager::SendAsyncMessageInternal(const nsAString& aMessage,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsFrameMessageManager::SendAsyncMessage() nsFrameMessageManager::SendAsyncMessage(const nsAString& aMessageName,
const jsval& aObject,
JSContext* aCx,
PRUint8 aArgc)
{ {
nsString messageName;
nsString json; nsString json;
nsresult rv = GetParamsForMessage(messageName, json); if (aArgc >= 2) {
NS_ENSURE_SUCCESS(rv, rv); GetParamsForMessage(aObject, aCx, json);
return SendAsyncMessageInternal(messageName, json); }
return SendAsyncMessageInternal(aMessageName, json);
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -428,14 +401,14 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
jsval json = JSVAL_NULL; jsval json = JSVAL_NULL;
if (!aJSON.IsEmpty()) { if (!aJSON.IsEmpty()) {
if (!JS_ParseJSON(ctx, (jschar*)nsString(aJSON).get(), if (!JS_ParseJSON(ctx, static_cast<const jschar*>(PromiseFlatString(aJSON).get()),
(uint32)aJSON.Length(), &json)) { aJSON.Length(), &json)) {
json = JSVAL_NULL; json = JSVAL_NULL;
} }
} }
JSString* jsMessage = JSString* jsMessage =
JS_NewUCStringCopyN(ctx, JS_NewUCStringCopyN(ctx,
reinterpret_cast<const jschar *>(nsString(aMessage).get()), static_cast<const jschar*>(PromiseFlatString(aMessage).get()),
aMessage.Length()); aMessage.Length());
NS_ENSURE_TRUE(jsMessage, NS_ERROR_OUT_OF_MEMORY); NS_ENSURE_TRUE(jsMessage, NS_ERROR_OUT_OF_MEMORY);
JS_DefineProperty(ctx, param, "target", targetv, NULL, NULL, JSPROP_ENUMERATE); JS_DefineProperty(ctx, param, "target", targetv, NULL, NULL, JSPROP_ENUMERATE);

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

@ -150,7 +150,9 @@ public:
void Disconnect(bool aRemoveFromParent = true); void Disconnect(bool aRemoveFromParent = true);
void SetCallbackData(void* aData, bool aLoadScripts = 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, nsresult SendAsyncMessageInternal(const nsAString& aMessage,
const nsAString& aJSON); const nsAString& aJSON);
JSContext* GetJSContext() { return mContext; } JSContext* GetJSContext() { return mContext; }

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

@ -840,81 +840,6 @@ nsGenericDOMDataNode::GetWholeText(nsAString& aWholeText)
return NS_OK; 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 // Implementation of the nsIContent interface text functions

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

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

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

@ -66,10 +66,15 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsInProcessTabChildGlobal, NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsInProcessTabChildGlobal,
nsDOMEventTargetHelper) nsDOMEventTargetHelper)
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager) 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() return mMessageManager
: NS_ERROR_NULL_POINTER; ? mMessageManager->SendSyncMessage(aMessageName, aObject, aCx, aArgc, aRetval)
: NS_ERROR_NULL_POINTER;
} }
NS_IMETHOD GetContent(nsIDOMWindow** aContent); NS_IMETHOD GetContent(nsIDOMWindow** aContent);
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell); NS_IMETHOD GetDocShell(nsIDocShell** aDocShell);

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

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

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

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

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

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

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

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

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

@ -87,10 +87,32 @@ function testPI(aTarget, aData, aShouldSucceed, aReason)
{ {
try { try {
var pi = document.createProcessingInstruction(aTarget, aData); var pi = document.createProcessingInstruction(aTarget, aData);
ok(0, "Invalid processing instruction creation", var types = [ ProcessingInstruction, Node ];
"Shouldn't create processing instructions in HTML"); 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) { } 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, // Each row has the document getter function, then the characterSet,
// inputEncoding, xmlEncoding expected for that document. // inputEncoding expected for that document.
var tests = [ var tests = [
[ frameDoc("one"), "ISO-8859-1", "ISO-8859-1", null ], [ frameDoc("one"), "ISO-8859-1", "ISO-8859-1" ],
[ frameDoc("two"), "UTF-8", "UTF-8", null ], [ frameDoc("two"), "UTF-8", "UTF-8" ],
[ frameDoc("three"), "ISO-8859-1", "ISO-8859-1", null ], [ frameDoc("three"), "ISO-8859-1", "ISO-8859-1" ],
[ frameDoc("four"), "UTF-8", "UTF-8", null ], [ frameDoc("four"), "UTF-8", "UTF-8" ],
[ frameDoc("five"), "UTF-8", "UTF-8", null ], [ frameDoc("five"), "UTF-8", "UTF-8" ],
[ frameDoc("six"), "UTF-8", "UTF-8", "UTF-8"], [ frameDoc("six"), "UTF-8", "UTF-8" ],
[ frameDoc("seven"), "ISO-8859-1", "ISO-8859-1", "ISO-8859-1" ], [ frameDoc("seven"), "ISO-8859-1", "ISO-8859-1" ],
[ createDoc, "UTF-8", null, null ], [ createDoc, "UTF-8", null ],
[ xhrDoc(4), "UTF-8", "UTF-8", null ], [ xhrDoc(4), "UTF-8", "UTF-8" ],
[ xhrDoc(5), "UTF-8", "UTF-8", "UTF-8" ], [ xhrDoc(5), "UTF-8", "UTF-8" ],
[ xhrDoc(6), "ISO-8859-1", "ISO-8859-1", "ISO-8859-1" ], [ xhrDoc(6), "ISO-8859-1", "ISO-8859-1" ],
]; ];
function doTest(idx) { function doTest(idx) {
var [docGetter, expectedCharacterSet, var [docGetter, expectedCharacterSet,
expectedInputEncoding, expectedXMLEncoding] = tests[idx]; expectedInputEncoding] = tests[idx];
var doc = docGetter(); var doc = docGetter();
// Have to be careful here to catch null vs "" // Have to be careful here to catch null vs ""
is(doc.characterSet, expectedCharacterSet, "Test " + idx + " characterSet"); is(doc.characterSet, expectedCharacterSet, "Test " + idx + " characterSet");
is(doc.inputEncoding, expectedInputEncoding, is(doc.inputEncoding, expectedInputEncoding,
"Test " + idx + " inputEncoding"); "Test " + idx + " inputEncoding");
is(doc.xmlEncoding, expectedXMLEncoding, "Test " + idx + " xmlEncoding");
} }
addLoadEvent(function() { addLoadEvent(function() {

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

@ -35,15 +35,6 @@ function doTest() {
} }
ok(hadException, ok(hadException,
"Should have got an exception when using .wholeText with a text node child of the binding parent"); "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(); 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 canvas = document.getElementById('c637');
var ctx = canvas.getContext('2d'); 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'); var ctx = canvas.getContext('2d');
canvas.setAttribute('width', '100foo'); 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(children.length, 0, "should have received DOMNodeRemoved for all frag children when appending");
is(frag.childNodes.length, 0, "fragment should be empty 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> </script>
</body> </body>
</html> </html>

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

@ -68,8 +68,6 @@ public:
TableRowsCollection(nsHTMLTableElement *aParent); TableRowsCollection(nsHTMLTableElement *aParent);
virtual ~TableRowsCollection(); virtual ~TableRowsCollection();
nsresult Init();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIDOMHTMLCOLLECTION NS_DECL_NSIDOMHTMLCOLLECTION
@ -83,13 +81,18 @@ public:
protected: protected:
// Those rows that are not in table sections // Those rows that are not in table sections
nsHTMLTableElement* mParent;
nsRefPtr<nsContentList> mOrphanRows; nsRefPtr<nsContentList> mOrphanRows;
nsHTMLTableElement * mParent;
}; };
TableRowsCollection::TableRowsCollection(nsHTMLTableElement *aParent) TableRowsCollection::TableRowsCollection(nsHTMLTableElement *aParent)
: mParent(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_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HTMLCollection)
NS_INTERFACE_MAP_END 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 // 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 // rowgroups. _code should be the code to execute for each rowgroup. The
// rowgroup's rows will be in the nsIDOMHTMLCollection* named "rows". Note // rowgroup's rows will be in the nsIDOMHTMLCollection* named "rows". Note
@ -499,15 +491,7 @@ NS_IMETHODIMP
nsHTMLTableElement::GetRows(nsIDOMHTMLCollection** aValue) nsHTMLTableElement::GetRows(nsIDOMHTMLCollection** aValue)
{ {
if (!mRows) { if (!mRows) {
// XXX why was this here NS_ADDREF(nsGkAtoms::tr);
mRows = new TableRowsCollection(this); 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; *aValue = mRows;

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

@ -462,11 +462,6 @@ function reflectBoolean(aParameters)
*/ */
function reflectInt(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(). // Expected value returned by .getAttribute() when |value| has been previously passed to .setAttribute().
function expectedGetAttributeResult(value) { function expectedGetAttributeResult(value) {
return (value !== null) ? String(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 //TBD: Bug 586761: .setAttribute(attr, -2147483648) --> element[attr] == defaultValue instead of -2147483648
todo_is(element[attr], intValue, "Bug 586761: " + element.localName + todo_is(element[attr], intValue, "Bug 586761: " + element.localName +
".setAttribute(value, " + v + "), " + element.localName + "[" + attr + "] "); ".setAttribute(value, " + v + "), " + element.localName + "[" + attr + "] ");
} else if (testExponential(v)) { } else if ((v === "-0" || v == "-0xABCDEF") && nonNegative) {
//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) {
//TBD: Bug 688093: Non-negative integers should return defaultValue when attempting to reflect "-0" //TBD: Bug 688093: Non-negative integers should return defaultValue when attempting to reflect "-0"
todo_is(element[attr], intValue, "Bug 688093: " + element.localName + todo_is(element[attr], intValue, "Bug 688093: " + element.localName +
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] "); ".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 { } else {
is(element[attr], intValue, element.localName + is(element[attr], intValue, element.localName +
".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] "); ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");

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

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

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

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

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

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

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

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

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

@ -67,7 +67,7 @@ interface nsIDOMCaretPosition;
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html * 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 interface nsIDOMDocument : nsIDOMNode
{ {
readonly attribute nsIDOMDocumentType doctype; readonly attribute nsIDOMDocumentType doctype;
@ -106,8 +106,6 @@ interface nsIDOMDocument : nsIDOMNode
nsIDOMElement getElementById(in DOMString elementId); nsIDOMElement getElementById(in DOMString elementId);
// Introduced in DOM Level 3: // Introduced in DOM Level 3:
readonly attribute DOMString inputEncoding; readonly attribute DOMString inputEncoding;
// Introduced in DOM Level 3:
readonly attribute DOMString xmlEncoding;
// Introduced in DOM Level 3: // Introduced in DOM Level 3:
attribute boolean xmlStandalone; attribute boolean xmlStandalone;
// raises(DOMException) on setting // 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 * 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 interface nsIDOMText : nsIDOMCharacterData
{ {
nsIDOMText splitText(in unsigned long offset) nsIDOMText splitText(in unsigned long offset)
@ -68,12 +68,4 @@ interface nsIDOMText : nsIDOMCharacterData
* passing an element, comment, or processing-instruction boundary. * passing an element, comment, or processing-instruction boundary.
*/ */
readonly attribute DOMString wholeText; 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" #include "nsIDOMDocument.idl"
[scriptable, uuid(0457526E-1FA5-476C-9314-0F704617B9F4)] [scriptable, uuid(8168733e-9cf6-4552-9f03-57de11b87f3f)]
interface nsIDOMXMLDocument : nsIDOMDocument interface nsIDOMXMLDocument : nsIDOMDocument
{ {
// DOM Level 3 Load & Save, DocumentLS // DOM Level 3 Load & Save, DocumentLS

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

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

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

@ -39,7 +39,7 @@
interface nsIDOMSVGSVGElement; interface nsIDOMSVGSVGElement;
[scriptable, uuid(E055EF40-D6BA-443A-B4DB-C1CCFAA6EB31)] [scriptable, uuid(1767ad4f-bb2b-474b-b208-9910ed152605)]
interface nsIDOMSVGDocument : nsIDOMDocument interface nsIDOMSVGDocument : nsIDOMDocument
{ {
readonly attribute DOMString domain; 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 : */ /* vim: set sw=4 ts=8 et tw=80 : */
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
@ -98,10 +98,15 @@ public:
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetHelper) NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetHelper)
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager) 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() return mMessageManager
: NS_ERROR_NULL_POINTER; ? mMessageManager->SendSyncMessage(aMessageName, aObject, aCx, aArgc, aRetval)
: NS_ERROR_NULL_POINTER;
} }
NS_IMETHOD GetContent(nsIDOMWindow** aContent); NS_IMETHOD GetContent(nsIDOMWindow** aContent);
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell); NS_IMETHOD GetDocShell(nsIDocShell** aDocShell);

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

@ -108,12 +108,12 @@ IsSupportedWarning=Use of attributes' isSupported() is deprecated.
IsEqualNodeWarning=Use of attributes' isEqualNode() is deprecated. IsEqualNodeWarning=Use of attributes' isEqualNode() is deprecated.
TextContentWarning=Use of attributes' textContent attribute is deprecated. Use value instead. 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. 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. nsIJSONDecodeDeprecatedWarning=nsIJSON.decode is deprecated. Please use JSON.parse instead.
nsIJSONEncodeDeprecatedWarning=nsIJSON.encode is deprecated. Please use JSON.stringify instead. nsIJSONEncodeDeprecatedWarning=nsIJSON.encode is deprecated. Please use JSON.stringify instead.
nsIDOMWindowInternalWarning=Use of nsIDOMWindowInternal is deprecated. Use nsIDOMWindow 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. 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. XmlVersionWarning=Use of xmlVersion is deprecated.
InputEncodingWarning=Use of inputEncoding is deprecated. InputEncodingWarning=Use of inputEncoding is deprecated.
XmlStandaloneWarning=Use of xmlStandalone is deprecated. XmlStandaloneWarning=Use of xmlStandalone is deprecated.

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

@ -39,9 +39,6 @@ function runTest() {
// doc.xmlStandalone // doc.xmlStandalone
ok(doc.xmlStandalone == clonefalse.xmlStandalone, "xmlStandalone not preserved correctly; " + iframes[i].id); 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 // doc.characterSet
ok(doc.characterSet == clonefalse.characterSet, "charset not preserved correctly; " + iframes[i].id); 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", var createEntityRef = ["documentinvalidcharacterexceptioncreateentref",
"documentinvalidcharacterexceptioncreateentref1", "documentinvalidcharacterexceptioncreateentref1",
"hc_attrgetvalue2", "hc_nodevalue03"]; "hc_attrgetvalue2", "hc_nodevalue03"];
var createProcessingInstructionHTML = ["documentinvalidcharacterexceptioncreatepi",
"documentinvalidcharacterexceptioncreatepi1"];
var todoTests = {}; var todoTests = {};
function concat(lst/*...*/) { function concat(lst/*...*/) {
@ -101,5 +102,5 @@ function concat(lst/*...*/) {
} }
return f; 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; } for (var excludedTestName in exclusions) { todoTests[exclusions[excludedTestName]] = true; }

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

@ -225,19 +225,12 @@ gfxASurface::Wrap (cairo_surface_t *csurf)
void void
gfxASurface::Init(cairo_surface_t* surface, bool existingSurface) 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); SetSurfaceWrapper(surface, this);
mSurface = surface; mSurface = surface;
mSurfaceValid = PR_TRUE; mSurfaceValid = surface && !cairo_surface_status(surface);
if (existingSurface) { if (existingSurface || !mSurfaceValid) {
mFloatingRefs = 0; mFloatingRefs = 0;
} else { } else {
mFloatingRefs = 1; mFloatingRefs = 1;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -147,7 +147,7 @@ script 15.9.5.5.js
script 15.9.5.6.js script 15.9.5.6.js
script 15.9.5.7.js script 15.9.5.7.js
fails-if(Android) script 15.9.5.8.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 script 15.9.5.js
slow script dst-offset-caching-1-of-8.js slow script dst-offset-caching-1-of-8.js
slow script dst-offset-caching-2-of-8.js slow script dst-offset-caching-2-of-8.js

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

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

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

@ -2451,13 +2451,6 @@ nsDisplayTransform::GetResultingTransformMatrix(const nsIFrame* aFrame,
*aOutAncestor = nsLayoutUtils::GetCrossDocParentFrame(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 /* Account for the -moz-transform-origin property by translating the
* coordinate space to the new origin. * coordinate space to the new origin.
*/ */

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

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

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

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

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

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

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

@ -68,6 +68,12 @@ _TEST_FILES = \
test_after_paint_pref.html \ test_after_paint_pref.html \
test_border_radius_hit_testing.html \ test_border_radius_hit_testing.html \
test_bug66619.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 \ test_bug114649.html \
$(warning test_bug369950.html disabled due to random orange; see bug 492575) \ $(warning test_bug369950.html disabled due to random orange; see bug 492575) \
test_bug386575.xhtml \ 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 #endif
static nsresult 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; nsresult rv = NS_OK;
nsDisplayList newList; nsDisplayList newList;
nsDisplayList temp;
while (nsDisplayItem *item = aList->RemoveBottom()) { while (nsDisplayItem *item = aList->RemoveBottom()) {
nsIFrame *childFrame = item->GetUnderlyingFrame(); nsIFrame *childFrame = item->GetUnderlyingFrame();
NS_ASSERTION(childFrame, "All display items to be wrapped must have a frame!"); 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()) { if (childFrame->GetParent()->Preserves3DChildren()) {
switch (item->GetType()) { switch (item->GetType()) {
case nsDisplayItem::TYPE_TRANSFORM: { case nsDisplayItem::TYPE_TRANSFORM: {
if (!temp.IsEmpty()) {
newList.AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder, aFrame, &temp, aIndex++));
}
newList.AppendToTop(item);
break; break;
} }
case nsDisplayItem::TYPE_WRAP_LIST: { case nsDisplayItem::TYPE_WRAP_LIST: {
if (!temp.IsEmpty()) {
newList.AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder, aFrame, &temp, aIndex++));
}
nsDisplayWrapList *list = static_cast<nsDisplayWrapList*>(item); nsDisplayWrapList *list = static_cast<nsDisplayWrapList*>(item);
rv = WrapPreserve3DList(aFrame, aBuilder, list->GetList()); rv = WrapPreserve3DListInternal(aFrame, aBuilder, list->GetList(), aIndex);
newList.AppendToTop(item);
break; break;
} }
case nsDisplayItem::TYPE_OPACITY: { case nsDisplayItem::TYPE_OPACITY: {
if (!temp.IsEmpty()) {
newList.AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder, aFrame, &temp, aIndex++));
}
nsDisplayOpacity *opacity = static_cast<nsDisplayOpacity*>(item); nsDisplayOpacity *opacity = static_cast<nsDisplayOpacity*>(item);
rv = WrapPreserve3DList(aFrame, aBuilder, opacity->GetList()); rv = WrapPreserve3DListInternal(aFrame, aBuilder, opacity->GetList(), aIndex);
newList.AppendToTop(item);
break; break;
} }
default: { default: {
item = new (aBuilder) nsDisplayTransform(aBuilder, childFrame, item); temp.AppendToTop(item);
break; break;
} }
} }
} else { } 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; return rv;
}
newList.AppendToTop(item);
if (!temp.IsEmpty()) {
newList.AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder, aFrame, &temp, aIndex++));
} }
aList->AppendToTop(&newList); aList->AppendToTop(&newList);
return NS_OK; return NS_OK;
} }
static nsresult
WrapPreserve3DList(nsIFrame* aFrame, nsDisplayListBuilder* aBuilder, nsDisplayList *aList)
{
PRUint32 index = 0;
return WrapPreserve3DListInternal(aFrame, aBuilder, aList, index);
}
nsresult nsresult
nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,

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

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

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

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

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

@ -584,12 +584,14 @@ const PRInt32 nsCSSProps::kAppearanceKTable[] = {
const PRInt32 nsCSSProps::kBackfaceVisibilityKTable[] = { const PRInt32 nsCSSProps::kBackfaceVisibilityKTable[] = {
eCSSKeyword_visible, NS_STYLE_BACKFACE_VISIBILITY_VISIBLE, 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[] = { const PRInt32 nsCSSProps::kTransformStyleKTable[] = {
eCSSKeyword_flat, NS_STYLE_TRANSFORM_STYLE_FLAT, 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[] = { const PRInt32 nsCSSProps::kBackgroundAttachmentKTable[] = {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -8,7 +8,7 @@ load invalid-size.gif
load invalid-size-second-frame.gif load invalid-size-second-frame.gif
# Animated gifs with a very large canvas, but tiny actual content. # 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 load delaytest.html?523528-2.gif
# this would have exposed the leak discovered in bug 642902 # this would have exposed the leak discovered in bug 642902

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

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

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

@ -186,6 +186,7 @@ HISTOGRAM(NETWORK_DISK_CACHE_DELETEDIR, 1, 10000, 10, EXPONENTIAL, "Time spent d
*/ */
#ifdef MOZ_URL_CLASSIFIER #ifdef MOZ_URL_CLASSIFIER
HISTOGRAM(URLCLASSIFIER_PS_FILELOAD_TIME, 1, 1000, 10, EXPONENTIAL, "Time spent loading PrefixSet from file (ms)") 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_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)") HISTOGRAM(URLCLASSIFIER_PS_LOOKUP_TIME, 1, 500, 10, EXPONENTIAL, "Time spent per PrefixSet lookup (ms)")
#endif #endif

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

@ -51,6 +51,7 @@
#include "nsTArray.h" #include "nsTArray.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "mozilla/Mutex.h" #include "mozilla/Mutex.h"
#include "mozilla/Telemetry.h"
#include "mozilla/FileUtils.h" #include "mozilla/FileUtils.h"
#include "prlog.h" #include "prlog.h"
@ -378,7 +379,7 @@ nsUrlClassifierPrefixSet::LoadFromFile(nsIFile * aFile)
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
AutoFDClose fileFd; AutoFDClose fileFd;
rv = file->OpenNSPRFileDesc(PR_RDONLY, 0, &fileFd); rv = file->OpenNSPRFileDesc(PR_RDONLY | nsILocalFile::OS_READAHEAD, 0, &fileFd);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
return LoadFromFd(fileFd); return LoadFromFd(fileFd);
@ -387,6 +388,15 @@ nsUrlClassifierPrefixSet::LoadFromFile(nsIFile * aFile)
nsresult nsresult
nsUrlClassifierPrefixSet::StoreToFd(AutoFDClose & fileFd) 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; PRInt32 written;
PRUint32 magic = PREFIXSET_VERSION_MAGIC; PRUint32 magic = PREFIXSET_VERSION_MAGIC;
written = PR_Write(fileFd, &magic, sizeof(PRUint32)); written = PR_Write(fileFd, &magic, sizeof(PRUint32));

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

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

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

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

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

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

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

@ -61,7 +61,7 @@ nsCUPSShim::Init()
{ {
mCupsLib = PR_LoadLibrary("libcups.so.2"); mCupsLib = PR_LoadLibrary("libcups.so.2");
if (!mCupsLib) if (!mCupsLib)
return PR_FALSE; return false;
// List of symbol pointers. Must match gSymName[] defined above. // List of symbol pointers. Must match gSymName[] defined above.
void **symAddr[] = { void **symAddr[] = {
@ -83,8 +83,8 @@ nsCUPSShim::Init()
#endif #endif
PR_UnloadLibrary(mCupsLib); PR_UnloadLibrary(mCupsLib);
mCupsLib = nsnull; 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 * Initialize this object. Attempt to load the CUPS shared
* library and find function pointers for the supported * library and find function pointers for the supported
* functions (see below). * 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. * any of the functions could not be found.
* PR_TRUE for successful initialization. * true for successful initialization.
*/ */
bool Init(); bool Init();
/** /**
* @return PR_TRUE if the object was initialized successfully. * @return true if the object was initialized successfully.
* PR_FALSE otherwise. * false otherwise.
*/ */
bool IsInitialized() { return nsnull != mCupsLib; } bool IsInitialized() { return nsnull != mCupsLib; }

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

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

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

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

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

@ -84,7 +84,7 @@ protected:
nsCOMPtr<nsIPrintSettings> mPrintSettings; nsCOMPtr<nsIPrintSettings> mPrintSettings;
bool mToPrinter : 1; /* If true, print to printer */ bool mToPrinter : 1; /* If true, print to printer */
bool mIsPPreview : 1; /* If true, is print preview */ 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 */ char mPrinter[256]; /* Printer name */
GtkPrintJob* mPrintJob; GtkPrintJob* mPrintJob;
GtkPrinter* mGtkPrinter; GtkPrinter* mGtkPrinter;

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

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

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

@ -205,7 +205,7 @@ NS_IMPL_ISUPPORTS1(nsFilePicker, nsIFilePicker)
nsFilePicker::nsFilePicker() nsFilePicker::nsFilePicker()
: mMode(nsIFilePicker::modeOpen), : mMode(nsIFilePicker::modeOpen),
mSelectedType(0), mSelectedType(0),
mAllowURLs(PR_FALSE) mAllowURLs(false)
{ {
} }
@ -218,7 +218,7 @@ ReadMultipleFiles(gpointer filename, gpointer array)
{ {
nsCOMPtr<nsILocalFile> localfile; nsCOMPtr<nsILocalFile> localfile;
nsresult rv = NS_NewNativeLocalFile(nsDependentCString(static_cast<char*>(filename)), nsresult rv = NS_NewNativeLocalFile(nsDependentCString(static_cast<char*>(filename)),
PR_FALSE, false,
getter_AddRefs(localfile)); getter_AddRefs(localfile));
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
nsCOMArray<nsILocalFile>& files = *static_cast<nsCOMArray<nsILocalFile>*>(array); 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", nsresult rv = sbs->CreateBundle("chrome://global/locale/filepicker.properties",
getter_AddRefs(bundle)); getter_AddRefs(bundle));
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return PR_FALSE; return false;
} }
nsAutoString leafName; 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)); gint response = gtk_dialog_run(GTK_DIALOG(file_chooser));
switch (response) { switch (response) {

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

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

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

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

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

@ -91,7 +91,7 @@ nsImageToPixbuf::ImageToPixbuf(imgIContainer* aImage)
GdkPixbuf* GdkPixbuf*
nsImageToPixbuf::ImgSurfaceToPixbuf(gfxImageSurface* aImgSurface, PRInt32 aWidth, PRInt32 aHeight) 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); aWidth, aHeight);
if (!pixbuf) if (!pixbuf)
return nsnull; return nsnull;

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

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

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

@ -56,7 +56,7 @@ copy_clipboard_cb(GtkWidget *w, gpointer user_data)
{ {
gCurrentCallback("cmd_copy", gCurrentCallbackData); gCurrentCallback("cmd_copy", gCurrentCallbackData);
g_signal_stop_emission_by_name(w, "copy_clipboard"); g_signal_stop_emission_by_name(w, "copy_clipboard");
gHandled = PR_TRUE; gHandled = true;
} }
static void static void
@ -64,7 +64,7 @@ cut_clipboard_cb(GtkWidget *w, gpointer user_data)
{ {
gCurrentCallback("cmd_cut", gCurrentCallbackData); gCurrentCallback("cmd_cut", gCurrentCallbackData);
g_signal_stop_emission_by_name(w, "cut_clipboard"); 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 // 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) gint count, gpointer user_data)
{ {
g_signal_stop_emission_by_name(w, "delete_from_cursor"); g_signal_stop_emission_by_name(w, "delete_from_cursor");
gHandled = PR_TRUE; gHandled = true;
bool forward = count > 0; bool forward = count > 0;
if (PRUint32(del_type) >= NS_ARRAY_LENGTH(sDeleteCommands)) { 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) gboolean extend_selection, gpointer user_data)
{ {
g_signal_stop_emission_by_name(w, "move_cursor"); g_signal_stop_emission_by_name(w, "move_cursor");
gHandled = PR_TRUE; gHandled = true;
bool forward = count > 0; bool forward = count > 0;
if (PRUint32(step) >= NS_ARRAY_LENGTH(sMoveCommands)) { if (PRUint32(step) >= NS_ARRAY_LENGTH(sMoveCommands)) {
// unsupported movement type // unsupported movement type
@ -207,7 +207,7 @@ paste_clipboard_cb(GtkWidget *w, gpointer user_data)
{ {
gCurrentCallback("cmd_paste", gCurrentCallbackData); gCurrentCallback("cmd_paste", gCurrentCallbackData);
g_signal_stop_emission_by_name(w, "paste_clipboard"); g_signal_stop_emission_by_name(w, "paste_clipboard");
gHandled = PR_TRUE; gHandled = true;
} }
// GtkTextView-only signals // GtkTextView-only signals
@ -216,7 +216,7 @@ select_all_cb(GtkWidget *w, gboolean select, gpointer user_data)
{ {
gCurrentCallback("cmd_selectAll", gCurrentCallbackData); gCurrentCallback("cmd_selectAll", gCurrentCallbackData);
g_signal_stop_emission_by_name(w, "select_all"); g_signal_stop_emission_by_name(w, "select_all");
gHandled = PR_TRUE; gHandled = true;
} }
void void
@ -266,7 +266,7 @@ bool
nsNativeKeyBindings::KeyDown(const nsNativeKeyEvent& aEvent, nsNativeKeyBindings::KeyDown(const nsNativeKeyEvent& aEvent,
DoCommandCallback aCallback, void *aCallbackData) DoCommandCallback aCallback, void *aCallbackData)
{ {
return PR_FALSE; return false;
} }
bool bool
@ -281,12 +281,12 @@ nsNativeKeyBindings::KeyPress(const nsNativeKeyEvent& aEvent,
keyCode = DOMKeyCodeToGdkKeyCode(aEvent.keyCode); keyCode = DOMKeyCodeToGdkKeyCode(aEvent.keyCode);
if (KeyPressInternal(aEvent, aCallback, aCallbackData, keyCode)) if (KeyPressInternal(aEvent, aCallback, aCallbackData, keyCode))
return PR_TRUE; return true;
nsKeyEvent *nativeKeyEvent = static_cast<nsKeyEvent*>(aEvent.nativeEvent); nsKeyEvent *nativeKeyEvent = static_cast<nsKeyEvent*>(aEvent.nativeEvent);
if (!nativeKeyEvent || nativeKeyEvent->eventStructType != NS_KEY_EVENT && if (!nativeKeyEvent || nativeKeyEvent->eventStructType != NS_KEY_EVENT &&
nativeKeyEvent->message != NS_KEY_PRESS) nativeKeyEvent->message != NS_KEY_PRESS)
return PR_FALSE; return false;
for (PRUint32 i = 0; i < nativeKeyEvent->alternativeCharCodes.Length(); ++i) { for (PRUint32 i = 0; i < nativeKeyEvent->alternativeCharCodes.Length(); ++i) {
PRUint32 ch = nativeKeyEvent->isShift ? PRUint32 ch = nativeKeyEvent->isShift ?
@ -295,7 +295,7 @@ nsNativeKeyBindings::KeyPress(const nsNativeKeyEvent& aEvent,
if (ch && ch != aEvent.charCode) { if (ch && ch != aEvent.charCode) {
keyCode = gdk_unicode_to_keyval(ch); keyCode = gdk_unicode_to_keyval(ch);
if (KeyPressInternal(aEvent, aCallback, aCallbackData, keyCode)) if (KeyPressInternal(aEvent, aCallback, aCallbackData, keyCode))
return PR_TRUE; return true;
} }
} }
@ -312,7 +312,7 @@ See bugs 411005 406407
static_cast<GdkEventKey*>(guiEvent->pluginEvent)); static_cast<GdkEventKey*>(guiEvent->pluginEvent));
*/ */
return PR_FALSE; return false;
} }
bool bool
@ -333,7 +333,7 @@ nsNativeKeyBindings::KeyPressInternal(const nsNativeKeyEvent& aEvent,
gCurrentCallback = aCallback; gCurrentCallback = aCallback;
gCurrentCallbackData = aCallbackData; gCurrentCallbackData = aCallbackData;
gHandled = PR_FALSE; gHandled = false;
gtk_bindings_activate(GTK_OBJECT(mNativeTarget), gtk_bindings_activate(GTK_OBJECT(mNativeTarget),
aKeyCode, GdkModifierType(modifiers)); aKeyCode, GdkModifierType(modifiers));
@ -348,5 +348,5 @@ bool
nsNativeKeyBindings::KeyUp(const nsNativeKeyEvent& aEvent, nsNativeKeyBindings::KeyUp(const nsNativeKeyEvent& aEvent,
DoCommandCallback aCallback, void *aCallbackData) 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. // We have to call moz_gtk_shutdown before the event loop stops running.
nsCOMPtr<nsIObserverService> obsServ = nsCOMPtr<nsIObserverService> obsServ =
mozilla::services::GetObserverService(); mozilla::services::GetObserverService();
obsServ->AddObserver(this, "xpcom-shutdown", PR_FALSE); obsServ->AddObserver(this, "xpcom-shutdown", false);
memset(mDisabledWidgetTypes, 0, sizeof(mDisabledWidgetTypes)); memset(mDisabledWidgetTypes, 0, sizeof(mDisabledWidgetTypes));
memset(mSafeWidgetStates, 0, sizeof(mSafeWidgetStates)); memset(mSafeWidgetStates, 0, sizeof(mSafeWidgetStates));
@ -304,14 +304,14 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
(curpos == maxpos && (curpos == maxpos &&
(aWidgetType == NS_THEME_SCROLLBAR_BUTTON_DOWN || (aWidgetType == NS_THEME_SCROLLBAR_BUTTON_DOWN ||
aWidgetType == NS_THEME_SCROLLBAR_BUTTON_RIGHT))) aWidgetType == NS_THEME_SCROLLBAR_BUTTON_RIGHT)))
aState->disabled = PR_TRUE; aState->disabled = true;
// In order to simulate native GTK scrollbar click behavior, // In order to simulate native GTK scrollbar click behavior,
// we set the active attribute on the element to true if it's // we set the active attribute on the element to true if it's
// pressed with any mouse button. // pressed with any mouse button.
// This allows us to show that it's active without setting :active // This allows us to show that it's active without setting :active
else if (CheckBooleanAttr(aFrame, nsWidgetAtoms::active)) else if (CheckBooleanAttr(aFrame, nsWidgetAtoms::active))
aState->active = PR_TRUE; aState->active = true;
if (aWidgetFlags) { if (aWidgetFlags) {
*aWidgetFlags = GetScrollbarButtonType(aFrame); *aWidgetFlags = GetScrollbarButtonType(aFrame);
@ -466,9 +466,9 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
if (aWidgetFlags) { if (aWidgetFlags) {
// In this case, the flag denotes whether the header is the sorted one or not // In this case, the flag denotes whether the header is the sorted one or not
if (GetTreeSortDirection(aFrame) == eTreeSortDirection_Natural) if (GetTreeSortDirection(aFrame) == eTreeSortDirection_Natural)
*aWidgetFlags = PR_FALSE; *aWidgetFlags = false;
else else
*aWidgetFlags = PR_TRUE; *aWidgetFlags = true;
} }
aGtkWidgetType = MOZ_GTK_TREE_HEADER_CELL; aGtkWidgetType = MOZ_GTK_TREE_HEADER_CELL;
break; break;
@ -490,7 +490,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
#if GTK_CHECK_VERSION(2,10,0) #if GTK_CHECK_VERSION(2,10,0)
*aWidgetFlags = GTK_ARROW_NONE; *aWidgetFlags = GTK_ARROW_NONE;
#else #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) #endif // GTK_CHECK_VERSION(2,10,0)
break; break;
} }
@ -513,7 +513,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
*aWidgetFlags = IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XHTML); *aWidgetFlags = IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XHTML);
break; break;
case NS_THEME_DROPDOWN_TEXT: 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: case NS_THEME_DROPDOWN_TEXTFIELD:
aGtkWidgetType = MOZ_GTK_DROPDOWN_ENTRY; aGtkWidgetType = MOZ_GTK_DROPDOWN_ENTRY;
break; break;
@ -642,10 +642,10 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
aGtkWidgetType = MOZ_GTK_WINDOW; aGtkWidgetType = MOZ_GTK_WINDOW;
break; break;
default: default:
return PR_FALSE; return false;
} }
return PR_TRUE; return true;
} }
class ThemeRenderer : public gfxGdkNativeRenderer { class ThemeRenderer : public gfxGdkNativeRenderer {
@ -703,10 +703,10 @@ nsNativeThemeGTK::GetExtraSizeForWidget(nsIFrame* aFrame, PRUint8 aWidgetType,
switch (aWidgetType) { switch (aWidgetType) {
case NS_THEME_SCROLLBAR_THUMB_VERTICAL: case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
aExtra->top = aExtra->bottom = 1; aExtra->top = aExtra->bottom = 1;
return PR_TRUE; return true;
case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL: case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
aExtra->left = aExtra->right = 1; aExtra->left = aExtra->right = 1;
return PR_TRUE; return true;
// Include the indicator spacing (the padding around the control). // Include the indicator spacing (the padding around the control).
case NS_THEME_CHECKBOX: case NS_THEME_CHECKBOX:
@ -724,7 +724,7 @@ nsNativeThemeGTK::GetExtraSizeForWidget(nsIFrame* aFrame, PRUint8 aWidgetType,
aExtra->right = indicator_spacing; aExtra->right = indicator_spacing;
aExtra->bottom = indicator_spacing; aExtra->bottom = indicator_spacing;
aExtra->left = indicator_spacing; aExtra->left = indicator_spacing;
return PR_TRUE; return true;
} }
case NS_THEME_BUTTON : case NS_THEME_BUTTON :
{ {
@ -737,19 +737,19 @@ nsNativeThemeGTK::GetExtraSizeForWidget(nsIFrame* aFrame, PRUint8 aWidgetType,
aExtra->right = right; aExtra->right = right;
aExtra->bottom = bottom; aExtra->bottom = bottom;
aExtra->left = left; aExtra->left = left;
return PR_TRUE; return true;
} }
} }
case NS_THEME_TAB : case NS_THEME_TAB :
{ {
if (!IsSelectedTab(aFrame)) if (!IsSelectedTab(aFrame))
return PR_FALSE; return false;
gint gap_height = moz_gtk_get_tab_thickness(); gint gap_height = moz_gtk_get_tab_thickness();
PRInt32 extra = gap_height - GetTabMarginPixels(aFrame); PRInt32 extra = gap_height - GetTabMarginPixels(aFrame);
if (extra <= 0) if (extra <= 0)
return PR_FALSE; return false;
if (IsBottomTab(aFrame)) { if (IsBottomTab(aFrame)) {
aExtra->top = extra; aExtra->top = extra;
@ -758,7 +758,7 @@ nsNativeThemeGTK::GetExtraSizeForWidget(nsIFrame* aFrame, PRUint8 aWidgetType,
} }
} }
default: default:
return PR_FALSE; return false;
} }
} }
@ -975,14 +975,14 @@ nsNativeThemeGTK::GetWidgetPadding(nsDeviceContext* aContext,
case NS_THEME_CHECKBOX: case NS_THEME_CHECKBOX:
case NS_THEME_RADIO: case NS_THEME_RADIO:
aResult->SizeTo(0, 0, 0, 0); aResult->SizeTo(0, 0, 0, 0);
return PR_TRUE; return true;
case NS_THEME_MENUITEM: case NS_THEME_MENUITEM:
case NS_THEME_CHECKMENUITEM: case NS_THEME_CHECKMENUITEM:
case NS_THEME_RADIOMENUITEM: case NS_THEME_RADIOMENUITEM:
{ {
// Menubar and menulist have their padding specified in CSS. // Menubar and menulist have their padding specified in CSS.
if (!IsRegularMenuItem(aFrame)) if (!IsRegularMenuItem(aFrame))
return PR_FALSE; return false;
aResult->SizeTo(0, 0, 0, 0); aResult->SizeTo(0, 0, 0, 0);
GtkThemeWidgetType gtkWidgetType; GtkThemeWidgetType gtkWidgetType;
@ -1003,11 +1003,11 @@ nsNativeThemeGTK::GetWidgetPadding(nsDeviceContext* aContext,
aResult->left += horizontal_padding; aResult->left += horizontal_padding;
aResult->right += horizontal_padding; aResult->right += horizontal_padding;
return PR_TRUE; return true;
} }
} }
return PR_FALSE; return false;
} }
bool bool
@ -1019,7 +1019,7 @@ nsNativeThemeGTK::GetWidgetOverflow(nsDeviceContext* aContext,
PRInt32 p2a; PRInt32 p2a;
nsIntMargin extraSize; nsIntMargin extraSize;
if (!GetExtraSizeForWidget(aFrame, aWidgetType, &extraSize)) if (!GetExtraSizeForWidget(aFrame, aWidgetType, &extraSize))
return PR_FALSE; return false;
p2a = aContext->AppUnitsPerDevPixel(); p2a = aContext->AppUnitsPerDevPixel();
m = nsMargin(NSIntPixelsToAppUnits(extraSize.left, p2a), m = nsMargin(NSIntPixelsToAppUnits(extraSize.left, p2a),
@ -1028,7 +1028,7 @@ nsNativeThemeGTK::GetWidgetOverflow(nsDeviceContext* aContext,
NSIntPixelsToAppUnits(extraSize.bottom, p2a)); NSIntPixelsToAppUnits(extraSize.bottom, p2a));
aOverflowRect->Inflate(m); aOverflowRect->Inflate(m);
return PR_TRUE; return true;
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -1037,7 +1037,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
nsIntSize* aResult, bool* aIsOverridable) nsIntSize* aResult, bool* aIsOverridable)
{ {
aResult->width = aResult->height = 0; aResult->width = aResult->height = 0;
*aIsOverridable = PR_TRUE; *aIsOverridable = true;
switch (aWidgetType) { switch (aWidgetType) {
case NS_THEME_SCROLLBAR_BUTTON_UP: case NS_THEME_SCROLLBAR_BUTTON_UP:
@ -1048,7 +1048,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
aResult->width = metrics.slider_width; aResult->width = metrics.slider_width;
aResult->height = metrics.stepper_size; aResult->height = metrics.stepper_size;
*aIsOverridable = PR_FALSE; *aIsOverridable = false;
} }
break; break;
case NS_THEME_SCROLLBAR_BUTTON_LEFT: case NS_THEME_SCROLLBAR_BUTTON_LEFT:
@ -1059,7 +1059,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
aResult->width = metrics.stepper_size; aResult->width = metrics.stepper_size;
aResult->height = metrics.slider_width; aResult->height = metrics.slider_width;
*aIsOverridable = PR_FALSE; *aIsOverridable = false;
} }
break; break;
case NS_THEME_SPLITTER: case NS_THEME_SPLITTER:
@ -1074,7 +1074,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
aResult->width = 0; aResult->width = 0;
aResult->height = metrics; aResult->height = metrics;
} }
*aIsOverridable = PR_FALSE; *aIsOverridable = false;
} }
break; break;
case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL: case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
@ -1093,7 +1093,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
else else
aResult->height = metrics.slider_width; aResult->height = metrics.slider_width;
*aIsOverridable = PR_FALSE; *aIsOverridable = false;
} }
break; break;
case NS_THEME_SCROLLBAR_THUMB_VERTICAL: 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, /* Get the available space, if that is smaller then the minimum size,
* adjust the mininum size to fit into it. * 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); aFrame->GetMargin(margin);
rect.Deflate(margin); rect.Deflate(margin);
aFrame->GetParent()->GetBorderAndPadding(margin); aFrame->GetParent()->GetBorderAndPadding(margin);
@ -1125,7 +1125,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
metrics.min_slider_size); metrics.min_slider_size);
} }
*aIsOverridable = PR_FALSE; *aIsOverridable = false;
} }
break; break;
case NS_THEME_SCALE_THUMB_HORIZONTAL: case NS_THEME_SCALE_THUMB_HORIZONTAL:
@ -1143,21 +1143,21 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
aResult->height = thumb_height; aResult->height = thumb_height;
} }
*aIsOverridable = PR_FALSE; *aIsOverridable = false;
} }
break; break;
case NS_THEME_TAB_SCROLLARROW_BACK: case NS_THEME_TAB_SCROLLARROW_BACK:
case NS_THEME_TAB_SCROLLARROW_FORWARD: case NS_THEME_TAB_SCROLLARROW_FORWARD:
{ {
moz_gtk_get_tab_scroll_arrow_size(&aResult->width, &aResult->height); moz_gtk_get_tab_scroll_arrow_size(&aResult->width, &aResult->height);
*aIsOverridable = PR_FALSE; *aIsOverridable = false;
} }
break; break;
case NS_THEME_DROPDOWN_BUTTON: case NS_THEME_DROPDOWN_BUTTON:
{ {
moz_gtk_get_combo_box_entry_button_size(&aResult->width, moz_gtk_get_combo_box_entry_button_size(&aResult->width,
&aResult->height); &aResult->height);
*aIsOverridable = PR_FALSE; *aIsOverridable = false;
} }
break; break;
case NS_THEME_MENUSEPARATOR: case NS_THEME_MENUSEPARATOR:
@ -1167,7 +1167,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
moz_gtk_get_menu_separator_height(&separator_height); moz_gtk_get_menu_separator_height(&separator_height);
aResult->height = separator_height; aResult->height = separator_height;
*aIsOverridable = PR_FALSE; *aIsOverridable = false;
} }
break; break;
case NS_THEME_CHECKBOX: case NS_THEME_CHECKBOX:
@ -1184,7 +1184,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
// Include space for the indicator and the padding around it. // Include space for the indicator and the padding around it.
aResult->width = indicator_size; aResult->width = indicator_size;
aResult->height = indicator_size; aResult->height = indicator_size;
*aIsOverridable = PR_FALSE; *aIsOverridable = false;
} }
break; break;
case NS_THEME_TOOLBAR_BUTTON_DROPDOWN: case NS_THEME_TOOLBAR_BUTTON_DROPDOWN:
@ -1194,7 +1194,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
case NS_THEME_BUTTON_ARROW_PREVIOUS: case NS_THEME_BUTTON_ARROW_PREVIOUS:
{ {
moz_gtk_get_arrow_size(&aResult->width, &aResult->height); moz_gtk_get_arrow_size(&aResult->width, &aResult->height);
*aIsOverridable = PR_FALSE; *aIsOverridable = false;
} }
break; break;
case NS_THEME_CHECKBOX_CONTAINER: case NS_THEME_CHECKBOX_CONTAINER:
@ -1238,7 +1238,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
case NS_THEME_RESIZER: case NS_THEME_RESIZER:
// same as Windows to make our lives easier // same as Windows to make our lives easier
aResult->width = aResult->height = 15; aResult->width = aResult->height = 15;
*aIsOverridable = PR_FALSE; *aIsOverridable = false;
break; break;
case NS_THEME_TREEVIEW_TWISTY: case NS_THEME_TREEVIEW_TWISTY:
case NS_THEME_TREEVIEW_TWISTY_OPEN: case NS_THEME_TREEVIEW_TWISTY_OPEN:
@ -1247,7 +1247,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
moz_gtk_get_treeview_expander_size(&expander_size); moz_gtk_get_treeview_expander_size(&expander_size);
aResult->width = aResult->height = expander_size; aResult->width = aResult->height = expander_size;
*aIsOverridable = PR_FALSE; *aIsOverridable = false;
} }
break; break;
} }
@ -1274,7 +1274,7 @@ nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
aWidgetType == NS_THEME_MENUSEPARATOR || aWidgetType == NS_THEME_MENUSEPARATOR ||
aWidgetType == NS_THEME_WINDOW || aWidgetType == NS_THEME_WINDOW ||
aWidgetType == NS_THEME_DIALOG) { aWidgetType == NS_THEME_DIALOG) {
*aShouldRepaint = PR_FALSE; *aShouldRepaint = false;
return NS_OK; return NS_OK;
} }
@ -1284,7 +1284,7 @@ nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
aWidgetType == NS_THEME_SCROLLBAR_BUTTON_RIGHT) && aWidgetType == NS_THEME_SCROLLBAR_BUTTON_RIGHT) &&
(aAttribute == nsWidgetAtoms::curpos || (aAttribute == nsWidgetAtoms::curpos ||
aAttribute == nsWidgetAtoms::maxpos)) { aAttribute == nsWidgetAtoms::maxpos)) {
*aShouldRepaint = PR_TRUE; *aShouldRepaint = true;
return NS_OK; return NS_OK;
} }
@ -1293,12 +1293,12 @@ nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
// For example, a toolbar doesn't care about any states. // For example, a toolbar doesn't care about any states.
if (!aAttribute) { if (!aAttribute) {
// Hover/focus/active changed. Always repaint. // Hover/focus/active changed. Always repaint.
*aShouldRepaint = PR_TRUE; *aShouldRepaint = true;
} }
else { else {
// Check the attribute to see if it's relevant. // Check the attribute to see if it's relevant.
// disabled, checked, dlgtype, default, etc. // disabled, checked, dlgtype, default, etc.
*aShouldRepaint = PR_FALSE; *aShouldRepaint = false;
if (aAttribute == nsWidgetAtoms::disabled || if (aAttribute == nsWidgetAtoms::disabled ||
aAttribute == nsWidgetAtoms::checked || aAttribute == nsWidgetAtoms::checked ||
aAttribute == nsWidgetAtoms::selected || aAttribute == nsWidgetAtoms::selected ||
@ -1308,7 +1308,7 @@ nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
aAttribute == nsWidgetAtoms::mozmenuactive || aAttribute == nsWidgetAtoms::mozmenuactive ||
aAttribute == nsWidgetAtoms::open || aAttribute == nsWidgetAtoms::open ||
aAttribute == nsWidgetAtoms::parentfocused) aAttribute == nsWidgetAtoms::parentfocused)
*aShouldRepaint = PR_TRUE; *aShouldRepaint = true;
} }
return NS_OK; return NS_OK;
@ -1329,7 +1329,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
PRUint8 aWidgetType) PRUint8 aWidgetType)
{ {
if (IsWidgetTypeDisabled(mDisabledWidgetTypes, aWidgetType)) if (IsWidgetTypeDisabled(mDisabledWidgetTypes, aWidgetType))
return PR_FALSE; return false;
switch (aWidgetType) { switch (aWidgetType) {
case NS_THEME_BUTTON: case NS_THEME_BUTTON:
@ -1422,7 +1422,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
} }
return PR_FALSE; return false;
} }
NS_IMETHODIMP_(bool) NS_IMETHODIMP_(bool)
@ -1438,8 +1438,8 @@ nsNativeThemeGTK::WidgetIsContainer(PRUint8 aWidgetType)
aWidgetType == NS_THEME_BUTTON_ARROW_DOWN || aWidgetType == NS_THEME_BUTTON_ARROW_DOWN ||
aWidgetType == NS_THEME_BUTTON_ARROW_NEXT || aWidgetType == NS_THEME_BUTTON_ARROW_NEXT ||
aWidgetType == NS_THEME_BUTTON_ARROW_PREVIOUS) aWidgetType == NS_THEME_BUTTON_ARROW_PREVIOUS)
return PR_FALSE; return false;
return PR_TRUE; return true;
} }
bool bool
@ -1448,15 +1448,15 @@ nsNativeThemeGTK::ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame
if (aWidgetType == NS_THEME_DROPDOWN || if (aWidgetType == NS_THEME_DROPDOWN ||
aWidgetType == NS_THEME_BUTTON || aWidgetType == NS_THEME_BUTTON ||
aWidgetType == NS_THEME_TREEVIEW_HEADER_CELL) aWidgetType == NS_THEME_TREEVIEW_HEADER_CELL)
return PR_TRUE; return true;
return PR_FALSE; return false;
} }
bool bool
nsNativeThemeGTK::ThemeNeedsComboboxDropmarker() nsNativeThemeGTK::ThemeNeedsComboboxDropmarker()
{ {
return PR_FALSE; return false;
} }
nsITheme::Transparency nsITheme::Transparency

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

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

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

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

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

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

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

@ -58,7 +58,7 @@ class nsPaperSizePS {
nsPaperSizePS() { mCurrent = 0; } 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; } bool AtEnd() { return mCurrent >= mCount; }
@ -79,7 +79,7 @@ class nsPaperSizePS {
/** --------------------------------------------------- /** ---------------------------------------------------
* Point the cursor to the entry with the given paper name. * 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); 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. * the user in metric units.
*/ */
bool IsMetric() { bool IsMetric() {

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