Merge cedar into mozilla-central

This commit is contained in:
Ehsan Akhgari 2011-04-11 20:24:12 -04:00
Родитель da35795d61 b00b8bd005
Коммит 8008ee47f9
85 изменённых файлов: 1125 добавлений и 1103 удалений

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

@ -157,7 +157,7 @@ Sanitizer.prototype = {
// Clear plugin data.
let ph = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
const phInterface = Ci.nsIPluginHost_MOZILLA_2_0_BRANCH;
const phInterface = Ci.nsIPluginHost;
const FLAG_CLEAR_ALL = phInterface.FLAG_CLEAR_ALL;
ph.QueryInterface(phInterface);

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

@ -10,7 +10,7 @@ const testURL2 = "http://mochi.test:8888/browser/browser/base/content/test/brows
Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
.loadSubScript("chrome://browser/content/sanitize.js");
const pluginHostIface = Ci.nsIPluginHost_MOZILLA_2_0_BRANCH;
const pluginHostIface = Ci.nsIPluginHost;
var pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
pluginHost.QueryInterface(pluginHostIface);

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

@ -618,7 +618,7 @@ PrivateBrowsingService.prototype = {
// Plugin data
let (ph = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost)) {
const phInterface = Ci.nsIPluginHost_MOZILLA_2_0_BRANCH;
const phInterface = Ci.nsIPluginHost;
const FLAG_CLEAR_ALL = phInterface.FLAG_CLEAR_ALL;
ph.QueryInterface(phInterface);

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

@ -6,7 +6,7 @@
// Test clearing plugin data by domain using nsPrivateBrowsingService.
const testURL = "http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_clearplugindata.html";
const pluginHostIface = Ci.nsIPluginHost_MOZILLA_2_0_BRANCH;
const pluginHostIface = Ci.nsIPluginHost;
var pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
pluginHost.QueryInterface(pluginHostIface);

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

@ -91,30 +91,4 @@ public:
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentUtils2, NS_ICONTENTUTILS2_IID)
#ifndef MOZ_ENABLE_LIBXUL
// nsIContentUtils_MOZILLA_2_0_BRANCH is a non-libxul only interface to enable
// us keep those builds working.
#define NS_ICONTENTUTILS_MOZILLA_2_0_BRANCH_IID \
{ 0x0fe8099c, 0x622a, 0x4c79, \
{ 0xb0, 0x02, 0x55, 0xf0, 0x44, 0x34, 0x00, 0x30 } }
class nsIContentUtils_MOZILLA_2_0_BRANCH : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTURILS_MOZILLA_2_0_BRANCH_IID)
NS_DECL_ISUPPORTS
virtual nsresult DispatchTrustedEvent(nsIDocument* aDoc,
nsISupports* aTarget,
const nsAString& aEventName,
PRBool aCanBubble,
PRBool aCancelable,
PRBool *aDefaultAction = nsnull);
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentUtils_MOZILLA_2_0_BRANCH, NS_ICONTENTUTILS_MOZILLA_2_0_BRANCH_IID)
#endif
#endif /* nsIContentUtils_h__ */

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

@ -6514,21 +6514,3 @@ nsIContentUtils2::CheckSameOrigin(nsIChannel *aOldChannel, nsIChannel *aNewChann
{
return nsContentUtils::CheckSameOrigin(aOldChannel, aNewChannel);
}
#ifndef MOZ_ENABLE_LIBXUL
NS_IMPL_ISUPPORTS1(nsIContentUtils_MOZILLA_2_0_BRANCH, nsIContentUtils_MOZILLA_2_0_BRANCH)
nsresult
nsIContentUtils_MOZILLA_2_0_BRANCH::DispatchTrustedEvent(nsIDocument* aDoc,
nsISupports* aTarget,
const nsAString& aEventName,
PRBool aCanBubble,
PRBool aCancelable,
PRBool *aDefaultAction)
{
return nsContentUtils::DispatchTrustedEvent(aDoc, aTarget, aEventName,
aCanBubble, aCancelable, aDefaultAction);
}
#endif

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

@ -6750,10 +6750,8 @@ nsDocument::WalkRadioGroup(const nsAString& aName,
return NS_OK;
}
PRBool stop = PR_FALSE;
for (int i = 0; i < radioGroup->mRadioButtons.Count(); i++) {
aVisitor->Visit(radioGroup->mRadioButtons[i], &stop);
if (stop) {
if (!aVisitor->Visit(radioGroup->mRadioButtons[i])) {
return NS_OK;
}
}

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

@ -842,6 +842,11 @@ function runTest() {
}
}
// Make sure to clear cookies to avoid affecting other tests
document.cookie = "a=; path=/; expires=Thu, 01-Jan-1970 00:00:01 GMT"
is(document.cookie, "", "No cookies should be left over");
// Test redirects
is(loader.src, "http://example.org/tests/content/base/test/file_CrossSiteXHR_inner.html");
is(origin, "http://example.org");

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

@ -30,7 +30,7 @@ function testCancelInPhase4() {
xhr.addEventListener("readystatechange", function(e) {
if (xhr.readyState >= 4) {
xhr.abort();
setTimeout(function() {
SimpleTest.executeSoon(function() {
// This request was cancelled, so the responseText should be empty string
is(xhr.responseText, "", "Expected empty response to cancelled request");
@ -47,7 +47,7 @@ function testCancelInPhase4() {
is(xhr2.responseText, "0", "Received fresh value for second request");
testCancelBeforePhase4();
}, 100);
});
}
}, false);
@ -70,7 +70,7 @@ function testCancelBeforePhase4() {
xhr.addEventListener("readystatechange", function(e) {
if (xhr.readyState == 3) {
xhr.abort();
setTimeout(function() {
SimpleTest.executeSoon(function() {
// This request was cancelled, so the responseText should be empty string
is(xhr.responseText, "", "Expected empty response to cancelled request");
@ -87,7 +87,7 @@ function testCancelBeforePhase4() {
is(xhr2.responseText, "1", "Received cached value for second request");
SimpleTest.finish();
}, 100);
});
}
}, false);

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

@ -41,12 +41,11 @@
#include "nsISupports.h"
class nsIFormControl;
class nsIDocument;
// IID for the nsIRadioControl interface
#define NS_IRADIOVISITOR_IID \
{ 0xd3494bd2, 0x1dd1, 0x11b2, \
{ 0xbe, 0x86, 0xb5, 0x08, 0xc8, 0x71, 0xd7, 0xc5 } }
{ 0xc6bed232, 0x1181, 0x4ab2, \
{ 0xa1, 0xda, 0x55, 0xc2, 0x13, 0x6d, 0xea, 0x3d } }
/**
* This interface is used for the text control frame to store its value away
@ -62,54 +61,15 @@ public:
* group, sequentially. (Each radio group implementor may define
* sequentially in their own way, it just has to be the same every time.)
* Currently all radio groups are ordered in the order they appear in the
* document. Radio group implementors should honor the aStop parameter and
* stop iterating over form controls when Visit() returns true there.
* document. Radio group implementors should honor the return value of the
* method and stop iterating if the return value is false.
*
* @param aRadio the radio button in question (must be nsnull and QI'able to
* nsIRadioControlElement)
* @param aStop whether or not to stop iterating (out-param)
*/
NS_IMETHOD Visit(nsIFormControl* aRadio, PRBool* aStop) = 0;
virtual PRBool Visit(nsIFormControl* aRadio) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIRadioVisitor, NS_IRADIOVISITOR_IID)
/**
* This visitor sets CheckedChanged on all elements it finds.
*
* @param aVisitor the visitor (out param)
* @param aCheckedChanged the value of CheckedChanged to set on all elements
*/
nsresult
NS_GetRadioSetCheckedChangedVisitor(PRBool aCheckedChanged,
nsIRadioVisitor** aVisitor);
/**
* This visitor will take the boolean you're pointing at and put
* aCheckedChanged into it. If the visitor is never called, aCheckedChanged
* will of course not change.
*
* @param aVisitor the visitor (out param)
* @param aCheckedChanged the boolean to put CheckedChanged into
* @param aExcludeElement the element
*/
nsresult
NS_GetRadioGetCheckedChangedVisitor(PRBool* aCheckedChanged,
nsIFormControl* aExcludeElement,
nsIRadioVisitor** aVisitor);
/**
* This visitor will update the validity states of all radio in the group and
* call ContentStatesChanged if needed.
*
* @param aExcludeElement an element to exclude (for optimization purpose), can be null
* @param aDocument the document owning the group
* @param aNotify whether we should call ContentStatesChanged
* @return the visitor
*/
nsIRadioVisitor*
NS_SetRadioValueMissingState(nsIFormControl* aExcludeElement,
nsIDocument* aDocument,
bool aValidity, bool aNotify);
#endif // nsIRadioVisitor_h___

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

@ -110,6 +110,7 @@ CPPSRCS = \
nsHTMLUnknownElement.cpp \
nsDOMValidityState.cpp \
nsIConstraintValidation.cpp \
nsRadioVisitor.cpp \
$(NULL)
ifdef MOZ_MEDIA

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

@ -2055,8 +2055,6 @@ nsHTMLFormElement::WalkRadioGroup(const nsAString& aName,
{
nsresult rv = NS_OK;
PRBool stopIterating = PR_FALSE;
if (aName.IsEmpty()) {
//
// XXX If the name is empty, it's not stored in the control list. There
@ -2071,8 +2069,7 @@ nsHTMLFormElement::WalkRadioGroup(const nsAString& aName,
if (controlContent) {
if (controlContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
EmptyString(), eCaseMatters)) {
aVisitor->Visit(control, &stopIterating);
if (stopIterating) {
if (!aVisitor->Visit(control)) {
break;
}
}
@ -2094,7 +2091,7 @@ nsHTMLFormElement::WalkRadioGroup(const nsAString& aName,
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(item));
if (formControl) {
if (formControl->GetType() == NS_FORM_INPUT_RADIO) {
aVisitor->Visit(formControl, &stopIterating);
aVisitor->Visit(formControl);
}
} else {
nsCOMPtr<nsIDOMNodeList> nodeList(do_QueryInterface(item));
@ -2107,8 +2104,7 @@ nsHTMLFormElement::WalkRadioGroup(const nsAString& aName,
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(node));
if (formControl) {
if (formControl->GetType() == NS_FORM_INPUT_RADIO) {
aVisitor->Visit(formControl, &stopIterating);
if (stopIterating) {
if (!aVisitor->Visit(formControl)) {
break;
}
}

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

@ -97,7 +97,6 @@
#include "nsIRadioGroupContainer.h"
// input type=file
#include "nsIFile.h"
#include "nsILocalFile.h"
#include "nsNetUtil.h"
#include "nsDOMFile.h"
@ -118,6 +117,7 @@
#include "nsContentCreatorFunctions.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsContentUtils.h"
#include "nsRadioVisitor.h"
#include "nsTextEditRules.h"
@ -1509,9 +1509,8 @@ nsHTMLInputElement::DoSetCheckedChanged(PRBool aCheckedChanged,
{
if (mType == NS_FORM_INPUT_RADIO) {
if (GET_BOOLBIT(mBitField, BF_CHECKED_CHANGED) != aCheckedChanged) {
nsCOMPtr<nsIRadioVisitor> visitor;
NS_GetRadioSetCheckedChangedVisitor(aCheckedChanged,
getter_AddRefs(visitor));
nsCOMPtr<nsIRadioVisitor> visitor =
new nsRadioSetCheckedChangedVisitor(aCheckedChanged);
VisitGroup(visitor, aNotify);
}
} else {
@ -3417,15 +3416,14 @@ nsHTMLInputElement::AddedToRadioGroup()
// For integrity purposes, we have to ensure that "checkedChanged" is
// the same for this new element as for all the others in the group
//
PRBool checkedChanged = GET_BOOLBIT(mBitField, BF_CHECKED_CHANGED);
nsCOMPtr<nsIRadioVisitor> visitor;
nsresult rv = NS_GetRadioGetCheckedChangedVisitor(&checkedChanged, this,
getter_AddRefs(visitor));
if (NS_FAILED(rv)) { return; }
bool checkedChanged = GET_BOOLBIT(mBitField, BF_CHECKED_CHANGED);
nsCOMPtr<nsIRadioVisitor> visitor =
new nsRadioGetCheckedChangedVisitor(&checkedChanged, this);
VisitGroup(visitor, notify);
SetCheckedChangedInternal(checkedChanged);
//
// Add the radio to the radio group container.
//
@ -3581,12 +3579,10 @@ nsHTMLInputElement::VisitGroup(nsIRadioVisitor* aVisitor, PRBool aFlushContent)
if (GetNameIfExists(name)) {
rv = container->WalkRadioGroup(name, aVisitor, aFlushContent);
} else {
PRBool stop;
aVisitor->Visit(this, &stop);
aVisitor->Visit(this);
}
} else {
PRBool stop;
aVisitor->Visit(this, &stop);
aVisitor->Visit(this);
}
return rv;
}
@ -3890,8 +3886,7 @@ nsHTMLInputElement::UpdateValueMissingValidityStateForRadio(bool aIgnoreSelf)
SetValidityState(VALIDITY_STATE_VALUE_MISSING, valueMissing);
nsCOMPtr<nsIRadioVisitor> visitor =
NS_SetRadioValueMissingState(this, GetCurrentDoc(), valueMissing,
notify);
new nsRadioSetValueMissingState(this, valueMissing, notify);
VisitGroup(visitor, notify);
}
} else {
@ -4158,212 +4153,6 @@ nsHTMLInputElement::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
return res == JS_FALSE || rval != JSVAL_NULL;
}
//
// Visitor classes
//
//
// CLASS nsRadioVisitor
//
// (this is the superclass of the others)
//
class nsRadioVisitor : public nsIRadioVisitor {
public:
nsRadioVisitor() { }
virtual ~nsRadioVisitor() { }
NS_DECL_ISUPPORTS
NS_IMETHOD Visit(nsIFormControl* aRadio, PRBool* aStop) = 0;
};
NS_IMPL_ISUPPORTS1(nsRadioVisitor, nsIRadioVisitor)
//
// CLASS nsRadioSetCheckedChangedVisitor
//
class nsRadioSetCheckedChangedVisitor : public nsRadioVisitor {
public:
nsRadioSetCheckedChangedVisitor(PRBool aCheckedChanged) :
nsRadioVisitor(), mCheckedChanged(aCheckedChanged)
{ }
virtual ~nsRadioSetCheckedChangedVisitor() { }
NS_IMETHOD Visit(nsIFormControl* aRadio, PRBool* aStop)
{
nsRefPtr<nsHTMLInputElement> radio =
static_cast<nsHTMLInputElement*>(aRadio);
NS_ASSERTION(radio, "Visit() passed a null button!");
radio->SetCheckedChangedInternal(mCheckedChanged);
return NS_OK;
}
protected:
PRPackedBool mCheckedChanged;
};
//
// CLASS nsRadioGetCheckedChangedVisitor
//
class nsRadioGetCheckedChangedVisitor : public nsRadioVisitor {
public:
nsRadioGetCheckedChangedVisitor(PRBool* aCheckedChanged,
nsIFormControl* aExcludeElement) :
nsRadioVisitor(),
mCheckedChanged(aCheckedChanged),
mExcludeElement(aExcludeElement)
{ }
virtual ~nsRadioGetCheckedChangedVisitor() { }
NS_IMETHOD Visit(nsIFormControl* aRadio, PRBool* aStop)
{
if (aRadio == mExcludeElement) {
return NS_OK;
}
nsRefPtr<nsHTMLInputElement> radio =
static_cast<nsHTMLInputElement*>(aRadio);
NS_ASSERTION(radio, "Visit() passed a null button!");
*mCheckedChanged = radio->GetCheckedChanged();
*aStop = PR_TRUE;
return NS_OK;
}
protected:
PRBool* mCheckedChanged;
nsIFormControl* mExcludeElement;
};
class nsRadioSetValueMissingState : public nsRadioVisitor {
public:
nsRadioSetValueMissingState(nsIFormControl* aExcludeElement,
nsIDocument* aDocument, bool aValidity,
bool aNotify)
: mExcludeElement(aExcludeElement)
, mDocument(aDocument)
, mValidity(aValidity)
, mNotify(aNotify)
{ }
NS_IMETHOD Visit(nsIFormControl* aRadio, PRBool* aStop)
{
if (aRadio == mExcludeElement) {
return NS_OK;
}
nsHTMLInputElement* input = static_cast<nsHTMLInputElement*>(aRadio);
input->SetValidityState(nsIConstraintValidation::VALIDITY_STATE_VALUE_MISSING,
mValidity);
if (mNotify && mDocument) {
mDocument->ContentStateChanged(input,
NS_EVENT_STATE_VALID |
NS_EVENT_STATE_INVALID |
NS_EVENT_STATE_MOZ_UI_VALID |
NS_EVENT_STATE_MOZ_UI_INVALID);
}
return NS_OK;
}
protected:
nsIFormControl* mExcludeElement;
nsIDocument* mDocument;
bool mValidity;
bool mNotify;
};
nsresult
NS_GetRadioSetCheckedChangedVisitor(PRBool aCheckedChanged,
nsIRadioVisitor** aVisitor)
{
//
// These are static so that we don't have to keep creating new visitors for
// such an ordinary process all the time. There are only two possibilities
// for this visitor: set to true, and set to false.
//
static nsIRadioVisitor* sVisitorTrue = nsnull;
static nsIRadioVisitor* sVisitorFalse = nsnull;
//
// Get the visitor that sets them to true
//
if (aCheckedChanged) {
if (!sVisitorTrue) {
sVisitorTrue = new nsRadioSetCheckedChangedVisitor(PR_TRUE);
if (!sVisitorTrue) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(sVisitorTrue);
nsresult rv =
nsContentUtils::ReleasePtrOnShutdown((nsISupports**)&sVisitorTrue);
if (NS_FAILED(rv)) {
NS_RELEASE(sVisitorTrue);
return rv;
}
}
*aVisitor = sVisitorTrue;
}
//
// Get the visitor that sets them to false
//
else {
if (!sVisitorFalse) {
sVisitorFalse = new nsRadioSetCheckedChangedVisitor(PR_FALSE);
if (!sVisitorFalse) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(sVisitorFalse);
nsresult rv =
nsContentUtils::ReleasePtrOnShutdown((nsISupports**)&sVisitorFalse);
if (NS_FAILED(rv)) {
NS_RELEASE(sVisitorFalse);
return rv;
}
}
*aVisitor = sVisitorFalse;
}
NS_ADDREF(*aVisitor);
return NS_OK;
}
nsresult
NS_GetRadioGetCheckedChangedVisitor(PRBool* aCheckedChanged,
nsIFormControl* aExcludeElement,
nsIRadioVisitor** aVisitor)
{
*aVisitor = new nsRadioGetCheckedChangedVisitor(aCheckedChanged,
aExcludeElement);
if (!*aVisitor) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(*aVisitor);
return NS_OK;
}
/*
* These methods are factores: they let callers to create an instance of
* a radio group visitor without the class declaration and definition.
*
* TODO:
* Do we really need factories for radio visitors? Or at least, we should move
* that somewhere else because it feels like it's here only because the radio
* visitor classes are defined after most of nsHTMLInputElement code.
* See bug 586298
*/
nsIRadioVisitor*
NS_SetRadioValueMissingState(nsIFormControl* aExcludeElement,
nsIDocument* aDocument,
bool aValidity, bool aNotify)
{
return new nsRadioSetValueMissingState(aExcludeElement, aDocument, aValidity,
aNotify);
}
NS_IMETHODIMP_(PRBool)
nsHTMLInputElement::IsSingleLineTextControl() const
{

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

@ -50,6 +50,7 @@
#include "nsIConstraintValidation.h"
#include "nsDOMFile.h"
#include "nsHTMLFormElement.h" // for ShouldShowInvalidUI()
#include "nsIFile.h"
//
// Accessors for mBitField
@ -109,8 +110,6 @@ private:
PRBool mInPrivateBrowsing;
};
class nsIRadioVisitor;
class nsHTMLInputElement : public nsGenericHTMLFormElement,
public nsImageLoadingContent,
public nsIDOMHTMLInputElement,

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

@ -0,0 +1,96 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 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 code.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mounir Lamouri <mounir.lamouri@mozilla.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsRadioVisitor.h"
#include "nsAutoPtr.h"
#include "nsHTMLInputElement.h"
#include "nsIEventStateManager.h"
#include "nsIDocument.h"
#include "nsIConstraintValidation.h"
NS_IMPL_ISUPPORTS1(nsRadioVisitor, nsIRadioVisitor)
PRBool
nsRadioSetCheckedChangedVisitor::Visit(nsIFormControl* aRadio)
{
nsRefPtr<nsHTMLInputElement> radio =
static_cast<nsHTMLInputElement*>(aRadio);
NS_ASSERTION(radio, "Visit() passed a null button!");
radio->SetCheckedChangedInternal(mCheckedChanged);
return PR_TRUE;
}
PRBool
nsRadioGetCheckedChangedVisitor::Visit(nsIFormControl* aRadio)
{
if (aRadio == mExcludeElement) {
return PR_TRUE;
}
nsRefPtr<nsHTMLInputElement> radio =
static_cast<nsHTMLInputElement*>(aRadio);
NS_ASSERTION(radio, "Visit() passed a null button!");
*mCheckedChanged = radio->GetCheckedChanged();
return PR_FALSE;
}
PRBool
nsRadioSetValueMissingState::Visit(nsIFormControl* aRadio)
{
if (aRadio == mExcludeElement) {
return PR_TRUE;
}
nsHTMLInputElement* input = static_cast<nsHTMLInputElement*>(aRadio);
input->SetValidityState(nsIConstraintValidation::VALIDITY_STATE_VALUE_MISSING,
mValidity);
nsIDocument* doc = input->GetCurrentDoc();
if (mNotify && doc) {
doc->ContentStateChanged(input, NS_EVENT_STATE_VALID |
NS_EVENT_STATE_INVALID |
NS_EVENT_STATE_MOZ_UI_VALID |
NS_EVENT_STATE_MOZ_UI_INVALID);
}
return PR_TRUE;
}

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

@ -0,0 +1,128 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 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 code.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mounir Lamouri <mounir.lamouri@mozilla.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsRadioVisitor_h__
#define _nsRadioVisitor_h__
#include "nsIRadioVisitor.h"
class nsIFormControl;
class nsIDocument;
/**
* nsRadioVisitor is the base class implementing nsIRadioVisitor and inherited
* by all radio visitors.
*/
class nsRadioVisitor : public nsIRadioVisitor
{
public:
nsRadioVisitor() { }
virtual ~nsRadioVisitor() { }
NS_DECL_ISUPPORTS
virtual PRBool Visit(nsIFormControl* aRadio) = 0;
};
/**
* The following declarations are radio visitors inheriting from nsRadioVisitor.
*/
/**
* nsRadioSetCheckedChangedVisitor is calling SetCheckedChanged with the given
* parameter to all radio elements in the group.
*/
class nsRadioSetCheckedChangedVisitor : public nsRadioVisitor
{
public:
nsRadioSetCheckedChangedVisitor(bool aCheckedChanged)
: mCheckedChanged(aCheckedChanged)
{ }
virtual PRBool Visit(nsIFormControl* aRadio);
protected:
bool mCheckedChanged;
};
/**
* nsRadioGetCheckedChangedVisitor is getting the current checked changed value.
* Getting it from one radio element is the group is enough given that all
* elements should have the same value.
*/
class nsRadioGetCheckedChangedVisitor : public nsRadioVisitor
{
public:
nsRadioGetCheckedChangedVisitor(bool* aCheckedChanged,
nsIFormControl* aExcludeElement)
: mCheckedChanged(aCheckedChanged)
, mExcludeElement(aExcludeElement)
{ }
virtual PRBool Visit(nsIFormControl* aRadio);
protected:
bool* mCheckedChanged;
nsIFormControl* mExcludeElement;
};
/**
* nsRadioSetValueMissingState is calling SetValueMissingState with the given
* parameter to all radio elements in the group.
* It is also calling ContentStatesChanged if needed.
*/
class nsRadioSetValueMissingState : public nsRadioVisitor
{
public:
nsRadioSetValueMissingState(nsIFormControl* aExcludeElement,
bool aValidity, bool aNotify)
: mExcludeElement(aExcludeElement)
, mValidity(aValidity)
, mNotify(aNotify)
{ }
virtual PRBool Visit(nsIFormControl* aRadio);
protected:
nsIFormControl* mExcludeElement;
bool mValidity;
bool mNotify;
};
#endif // _nsRadioVisitor_h__

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

@ -897,10 +897,8 @@ nsTextInputListener::EditAction()
}
// Fire input event
nsCOMPtr<nsIEditor_MOZILLA_2_0_BRANCH> editor20 = do_QueryInterface(editor);
NS_ASSERTION(editor20, "Something is very wrong!");
PRBool trusted = PR_FALSE;
editor20->GetLastKeypressEventTrusted(&trusted);
editor->GetLastKeypressEventTrusted(&trusted);
frame->FireOnInput(trusted);
// mFrame may be dead after this, but we don't need to check for it, because

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

@ -260,6 +260,7 @@ _TEST_FILES = \
test_bug610212.html \
test_bug633058.html \
test_bug641219.html \
test_bug643051.html \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -0,0 +1,43 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=643051
-->
<head>
<title>Test for Bug 643051</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"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=643051">Mozilla Bug 643051</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 643051 **/
document.cookie = "a=; expires=Thu, 01-Jan-1970 00:00:01 GMT"; // clear cookie
document.cookie = "a2=; expires=Thu, 01-Jan-1970 00:00:01 GMT"; // clear cookie
document.cookie = "a3=; expires=Thu, 01-Jan-1970 00:00:01 GMT"; // clear cookie
// single cookie, should work
document.cookie = "a=bar";
is(document.cookie, "a=bar", "Can't read stored cookie!");
document.cookie = "a2=bar\na3=bar";
is(document.cookie, "a=bar; a2=bar", "Wrong cookie value");
document.cookie = "a2=baz; a3=bar";
is(document.cookie, "a=bar; a2=baz", "Wrong cookie value");
// clear cookies again to avoid affecting other tests
document.cookie = "a=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
document.cookie = "a2=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
document.cookie = "a3=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
</script>
</pre>
</body>
</html>

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

@ -516,6 +516,12 @@ nsDummyJavaPluginOwner::GetWindow(NPWindow *&aWindow)
return NS_OK;
}
NS_IMETHODIMP
nsDummyJavaPluginOwner::SetWindow()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDummyJavaPluginOwner::GetMode(PRInt32 *aMode)
{

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

@ -596,16 +596,6 @@ PluginInstanceParent::AsyncSetWindow(NPWindow* aWindow)
return NS_OK;
}
nsresult
PluginInstanceParent::GetSurface(gfxASurface** aSurface)
{
if (mFrontSurface) {
NS_ADDREF(*aSurface = mFrontSurface);
return NS_OK;
}
return NS_ERROR_NOT_AVAILABLE;
}
nsresult
PluginInstanceParent::GetImage(ImageContainer* aContainer, Image** aImage)
{

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

@ -280,7 +280,6 @@ public:
#endif // definied(OS_MACOSX)
nsresult AsyncSetWindow(NPWindow* window);
nsresult GetSurface(gfxASurface** aSurface);
nsresult GetImage(mozilla::layers::ImageContainer* aContainer, mozilla::layers::Image** aImage);
nsresult GetImageSize(nsIntSize* aSize);
#ifdef XP_MACOSX

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

@ -99,7 +99,6 @@ public:
virtual nsresult NPP_GetSitesWithData(InfallibleTArray<nsCString>& aResult) = 0;
virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window) = 0;
virtual nsresult GetSurface(NPP instance, gfxASurface** aSurface) = 0;
virtual nsresult GetImage(NPP instance, ImageContainer* aContainer, Image** aImage) = 0;
virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize) = 0;
virtual bool UseAsyncPainting() = 0;

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

@ -672,16 +672,6 @@ PluginModuleParent::AsyncSetWindow(NPP instance, NPWindow* window)
return i->AsyncSetWindow(window);
}
nsresult
PluginModuleParent::GetSurface(NPP instance, gfxASurface** aSurface)
{
PluginInstanceParent* i = InstCast(instance);
if (!i)
return NS_ERROR_FAILURE;
return i->GetSurface(aSurface);
}
nsresult
PluginModuleParent::GetImage(NPP instance,
mozilla::layers::ImageContainer* aContainer,

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

@ -231,7 +231,6 @@ private:
virtual bool HasRequiredFunctions();
virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window);
virtual nsresult GetSurface(NPP instance, gfxASurface** aSurface);
virtual nsresult GetImage(NPP instance, mozilla::layers::ImageContainer* aContainer, mozilla::layers::Image** aImage);
virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize);
NS_OVERRIDE virtual bool UseAsyncPainting() { return true; }

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

@ -55,7 +55,7 @@ interface nsIEditActionListener;
interface nsIInlineSpellChecker;
interface nsITransferable;
[scriptable, uuid(78b0bde0-ab69-428b-ab30-fcc09eead499)]
[scriptable, uuid(bd5d93f0-6451-11e0-ae3e-0800200c9a66)]
interface nsIEditor : nsISupports
{
@ -572,11 +572,7 @@ interface nsIEditor : nsISupports
/* checks if a node is read-only or not */
[notxpcom] boolean isModifiableNode(in nsIDOMNode aNode);
};
[uuid(54c0bc08-6c0e-4967-bb0d-ec991d78a8b3)]
interface nsIEditor_MOZILLA_2_0_BRANCH : nsISupports
{
/**
* Will be set to true if the last keypress event that the editor has handled
* has been trusted. The value will only be valid when the edit action listeners

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

@ -205,7 +205,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsEditor)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsEditor)
NS_INTERFACE_MAP_ENTRY(nsIEditor_MOZILLA_2_0_BRANCH)
NS_INTERFACE_MAP_ENTRY(nsIPhonetic)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsIEditorIMESupport)

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

@ -100,8 +100,7 @@ class nsIDOMNSEvent;
class nsEditor : public nsIEditor,
public nsIEditorIMESupport,
public nsSupportsWeakReference,
public nsIPhonetic,
public nsIEditor_MOZILLA_2_0_BRANCH
public nsIPhonetic
{
public:
@ -157,9 +156,6 @@ public:
// nsIPhonetic
NS_DECL_NSIPHONETIC
// nsIEditor_MOZILLA_2_0_BRANCH
NS_DECL_NSIEDITOR_MOZILLA_2_0_BRANCH
public:

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

@ -522,7 +522,8 @@ public class GeckoAppShell
}
public static void notifyIMEEnabled(int state, String typeHint,
String actionHint) {
String actionHint, boolean landscapeFS)
{
if (GeckoApp.surfaceView == null)
return;
@ -531,6 +532,7 @@ public class GeckoAppShell
GeckoApp.surfaceView.mIMEState = state;
GeckoApp.surfaceView.mIMETypeHint = typeHint;
GeckoApp.surfaceView.mIMEActionHint = actionHint;
GeckoApp.surfaceView.mIMELandscapeFS = landscapeFS;
IMEStateUpdater.enableIME();
}

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

@ -383,7 +383,10 @@ class GeckoSurfaceView
outAttrs.imeOptions = EditorInfo.IME_ACTION_SEND;
else if (mIMEActionHint != null && mIMEActionHint.length() != 0)
outAttrs.actionLabel = mIMEActionHint;
if (mIMELandscapeFS == false)
outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_EXTRACT_UI;
inputConnection.reset();
return inputConnection;
}
@ -624,6 +627,7 @@ class GeckoSurfaceView
int mIMEState;
String mIMETypeHint;
String mIMEActionHint;
boolean mIMELandscapeFS;
// Software rendering
ByteBuffer mSoftwareBuffer;

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

@ -3160,6 +3160,8 @@ _cairo_d2d_mask(void *surface,
cairo_d2d_surface_t *d2dsurf = static_cast<cairo_d2d_surface_t*>(surface);
cairo_rectangle_int_t extents;
cairo_clip_t *actual_clip = clip;
cairo_int_status_t status;
status = (cairo_int_status_t)_cairo_surface_mask_extents (&d2dsurf->base,
@ -3169,17 +3171,6 @@ _cairo_d2d_mask(void *surface,
if (unlikely (status))
return status;
D2D1_RECT_F rect = D2D1::RectF(0,
0,
(FLOAT)d2dsurf->rt->GetPixelSize().width,
(FLOAT)d2dsurf->rt->GetPixelSize().height);
rect.left = (FLOAT)extents.x;
rect.right = (FLOAT)(extents.x + extents.width);
rect.top = (FLOAT)extents.y;
rect.bottom = (FLOAT)(extents.y + extents.height);
bool isSolidAlphaMask = false;
float solidAlphaValue = 1.0f;
@ -3192,12 +3183,47 @@ _cairo_d2d_mask(void *surface,
}
}
cairo_box_t box;
_cairo_box_from_rectangle(&box, &extents);
if (clip) {
// We do some work here to try and avoid pushing and popping clips for rectangular areas,
// if we do this fill rects will occur without rectangular clips being pushed and popped.
// This is faster for non-axis aligned clips in general and allows more efficient batching
// of the pop-clip calls.
int num_boxes = 1;
cairo_box_t box_stack;
cairo_box_t *boxes;
boxes = &box_stack;
// This function assumes atleast a single box resides at 'boxes' and the
// amount of boxes that reside there are passed in under num_boxes.
status = _cairo_clip_get_boxes(clip, &boxes, &num_boxes);
if (!status && num_boxes == 1) {
box.p1.x = MAX(box.p1.x, boxes->p1.x);
box.p2.x = MIN(box.p2.x, boxes->p2.x);
box.p1.y = MAX(box.p1.y, boxes->p1.y);
box.p2.y = MIN(box.p2.y, boxes->p2.y);
if (clip->path != d2dsurf->clip.path) {
// Only reset the clip if we don't have the right clip set. Otherwise
// just leave the clip as it is. If we have the right clip set we
// should not do a needless pop of the clip.
actual_clip = NULL;
}
}
if (boxes != &box_stack) {
// If the function changed the boxes pointer, we need to free it.
free(boxes);
}
}
if (isSolidAlphaMask) {
if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
const cairo_surface_pattern_t *surf_pattern =
reinterpret_cast<const cairo_surface_pattern_t*>(source);
cairo_box_t box;
_cairo_box_from_rectangle(&box, &extents);
cairo_int_status_t rv = _cairo_d2d_try_fastblit(d2dsurf,
surf_pattern->surface,
&box,
@ -3228,13 +3254,18 @@ _cairo_d2d_mask(void *surface,
#ifndef ALWAYS_MANUAL_COMPOSITE
} else {
_begin_draw_state(d2dsurf);
status = (cairo_int_status_t)_cairo_d2d_set_clip (d2dsurf, clip);
status = (cairo_int_status_t)_cairo_d2d_set_clip (d2dsurf, actual_clip);
if (unlikely(status))
return status;
}
#endif
D2D1_RECT_F rect = D2D1::RectF(_cairo_fixed_to_float(box.p1.x),
_cairo_fixed_to_float(box.p1.y),
_cairo_fixed_to_float(box.p2.x),
_cairo_fixed_to_float(box.p2.y));
if (isSolidAlphaMask) {
brush->SetOpacity(solidAlphaValue);
target_rt->FillRectangle(rect,

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

@ -762,6 +762,12 @@ public:
*/
virtual ThebesLayer* AsThebesLayer() { return nsnull; }
/**
* Dynamic cast to a ContainerLayer. Returns null if this is not
* a ContainerLayer.
*/
virtual ContainerLayer* AsContainerLayer() { return nsnull; }
/**
* Dynamic cast to a ShadowLayer. Return null if this is not a
* ShadowLayer. Can be used anytime.
@ -1029,6 +1035,8 @@ public:
// These getters can be used anytime.
virtual ContainerLayer* AsContainerLayer() { return this; }
virtual Layer* GetFirstChild() { return mFirstChild; }
virtual Layer* GetLastChild() { return mLastChild; }
const FrameMetrics& GetFrameMetrics() { return mFrameMetrics; }

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

@ -59,7 +59,9 @@ enum LayerState {
LAYER_ACTIVE,
// Force an active layer even if it causes incorrect rendering, e.g.
// when the layer has rounded rect clips.
LAYER_ACTIVE_FORCE
LAYER_ACTIVE_FORCE,
// Special layer that is metadata only.
LAYER_ACTIVE_EMPTY
};
/**

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

@ -84,6 +84,7 @@ enum Type {
TYPE_REMOTE,
TYPE_REMOTE_SHADOW,
TYPE_SCROLL_LAYER,
TYPE_SCROLL_INFO_LAYER,
TYPE_SELECTION_OVERLAY,
TYPE_SOLID_COLOR,
TYPE_TABLE_CELL_BACKGROUND,

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

@ -1836,6 +1836,25 @@ nsDisplayScrollLayer::~nsDisplayScrollLayer()
}
#endif
nsDisplayScrollInfoLayer::nsDisplayScrollInfoLayer(
nsDisplayListBuilder* aBuilder,
nsDisplayList* aList,
nsIFrame* aForFrame,
nsIFrame* aViewportFrame)
: nsDisplayScrollLayer(aBuilder, aList, aForFrame, aViewportFrame)
{
#ifdef NS_BUILD_REFCNT_LOGGING
MOZ_COUNT_CTOR(nsDisplayScrollInfoLayer);
#endif
}
#ifdef NS_BUILD_REFCNT_LOGGING
nsDisplayScrollInfoLayer::~nsDisplayScrollInfoLayer()
{
MOZ_COUNT_DTOR(nsDisplayScrollInfoLayer);
}
#endif
nsDisplayClip::nsDisplayClip(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsDisplayItem* aItem,
const nsRect& aRect)

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

@ -1836,6 +1836,30 @@ private:
nsIFrame* mViewportFrame;
};
/**
* Like nsDisplayScrollLayer, but only has metadata on the scroll frame. This
* creates a layer that has no Thebes child layer, but still allows the
* compositor process to know of the scroll frame's existence.
*/
class nsDisplayScrollInfoLayer : public nsDisplayScrollLayer
{
public:
nsDisplayScrollInfoLayer(nsDisplayListBuilder* aBuilder, nsDisplayList* aList,
nsIFrame* aForFrame, nsIFrame* aViewportFrame);
NS_DISPLAY_DECL_NAME("ScrollInfoLayer", TYPE_SCROLL_INFO_LAYER)
#ifdef NS_BUILD_REFCNT_LOGGING
virtual ~nsDisplayScrollInfoLayer();
#endif
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager)
{
return mozilla::LAYER_ACTIVE_EMPTY;
}
};
/**
* nsDisplayClip can clip a list of items, but we take a single item
* initially and then later merge other items into it when we merge

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

@ -246,12 +246,6 @@
#define NS_ICONTENTUTILS2_CID \
{ 0x1802442d, 0xa59b, 0x43b8, { 0xb8, 0xfd, 0x07, 0x0d, 0xa5, 0x54, 0x95, 0x93 } }
#ifndef MOZ_ENABLE_LIBXUL
// {4c14b440-307f-11e0-91fa-0800200c9a66}
#define NS_ICONTENTUTILS_MOZILLA_2_0_BRANCH_CID \
{ 0x4c14b440, 0x307f, 0x11e9, { 0x91, 0xfa, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 } }
#endif
// {1A26A7B7-D06E-4F45-8B45-D7AD60F7A9AB}
#define INDEXEDDB_MANAGER_CID \
{ 0x1a26a7b7, 0xd06e, 0x4f45, { 0x8b, 0x45, 0xd7, 0xad, 0x60, 0xf7, 0xa9, 0xab } }

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

@ -582,9 +582,6 @@ MAKE_CTOR(CreateFocusManager, nsIFocusManager, NS_NewFocusManag
NS_GENERIC_FACTORY_CONSTRUCTOR(nsIContentUtils)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsIContentUtils2)
#ifndef MOZ_ENABLE_LIBXUL
NS_GENERIC_FACTORY_CONSTRUCTOR(nsIContentUtils_MOZILLA_2_0_BRANCH)
#endif
MAKE_CTOR(CreateCanvasRenderingContext2D, nsIDOMCanvasRenderingContext2D, NS_NewCanvasRenderingContext2D)
MAKE_CTOR(CreateCanvasRenderingContextWebGL, nsIDOMWebGLRenderingContext, NS_NewCanvasRenderingContextWebGL)
@ -873,9 +870,6 @@ NS_DEFINE_NAMED_CID(NS_GEOLOCATION_CID);
NS_DEFINE_NAMED_CID(NS_FOCUSMANAGER_CID);
NS_DEFINE_NAMED_CID(NS_ICONTENTUTILS_CID);
NS_DEFINE_NAMED_CID(NS_ICONTENTUTILS2_CID);
#ifndef MOZ_ENABLE_LIBXUL
NS_DEFINE_NAMED_CID(NS_ICONTENTUTILS_MOZILLA_2_0_BRANCH_CID);
#endif
NS_DEFINE_NAMED_CID(CSPSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_EVENTLISTENERSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_GLOBALMESSAGEMANAGER_CID);
@ -1027,9 +1021,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kNS_FOCUSMANAGER_CID, false, NULL, CreateFocusManager },
{ &kNS_ICONTENTUTILS_CID, false, NULL, nsIContentUtilsConstructor },
{ &kNS_ICONTENTUTILS2_CID, false, NULL, nsIContentUtils2Constructor },
#ifndef MOZ_ENABLE_LIBXUL
{ &kNS_ICONTENTUTILS_MOZILLA_2_0_BRANCH_CID, false, NULL, nsIContentUtils_MOZILLA_2_0_BRANCHConstructor },
#endif
{ &kCSPSERVICE_CID, false, NULL, CSPServiceConstructor },
{ &kNS_EVENTLISTENERSERVICE_CID, false, NULL, CreateEventListenerService },
{ &kNS_GLOBALMESSAGEMANAGER_CID, false, NULL, CreateGlobalMessageManager },
@ -1175,9 +1166,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
{ "@mozilla.org/focus-manager;1", &kNS_FOCUSMANAGER_CID },
{ "@mozilla.org/content/contentutils;1", &kNS_ICONTENTUTILS_CID },
{ "@mozilla.org/content/contentutils2;1", &kNS_ICONTENTUTILS2_CID },
#ifndef MOZ_ENABLE_LIBXUL
{ "@mozilla.org/content/contentutils-moz2.0;1", &kNS_ICONTENTUTILS_MOZILLA_2_0_BRANCH_CID },
#endif
{ CSPSERVICE_CONTRACTID, &kCSPSERVICE_CID },
{ NS_EVENTLISTENERSERVICE_CONTRACTID, &kNS_EVENTLISTENERSERVICE_CID },
{ NS_GLOBALMESSAGEMANAGER_CONTRACTID, &kNS_GLOBALMESSAGEMANAGER_CID },

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

@ -1961,7 +1961,8 @@ nsGfxScrollFrameInner::BuildDisplayList(nsDisplayListBuilder* aBuilder,
dirtyRect.IntersectRect(aDirtyRect, mScrollPort);
// Override the dirty rectangle if the displayport has been set.
nsLayoutUtils::GetDisplayPort(mOuter->GetContent(), &dirtyRect);
PRBool usingDisplayport =
nsLayoutUtils::GetDisplayPort(mOuter->GetContent(), &dirtyRect);
nsDisplayListCollection set;
@ -1976,30 +1977,42 @@ nsGfxScrollFrameInner::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// range of 20 pixels to eliminate many gfx scroll frames from becoming a
// layer.
//
PRInt32 appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
nsRect scrollRange = GetScrollRange();
ScrollbarStyles styles = GetScrollbarStylesFromFrame();
mShouldBuildLayer =
(XRE_GetProcessType() == GeckoProcessType_Content &&
(styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN ||
styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN) &&
(scrollRange.width >= NSIntPixelsToAppUnits(20, appUnitsPerDevPixel) ||
scrollRange.height >= NSIntPixelsToAppUnits(20, appUnitsPerDevPixel))) &&
(!mIsRoot || !mOuter->PresContext()->IsRootContentDocument());
(!mIsRoot || !mOuter->PresContext()->IsRootContentDocument()));
if (ShouldBuildLayer()) {
// Note that using StackingContext breaks z order, so the resulting
// rendering can be incorrect for weird edge cases!
nsDisplayList list;
rv = mScrolledFrame->BuildDisplayListForStackingContext(
aBuilder, dirtyRect + mOuter->GetOffsetTo(mScrolledFrame), &list);
if (usingDisplayport) {
// Once a displayport is set, assume that scrolling needs to be fast
// so create a layer with all the content inside. The compositor
// process will be able to scroll the content asynchronously.
//
// Note that using StackingContext breaks z order, so the resulting
// rendering can be incorrect for weird edge cases!
nsDisplayScrollLayer* layerItem = new (aBuilder) nsDisplayScrollLayer(
aBuilder, &list, mScrolledFrame, mOuter);
set.Content()->AppendNewToTop(layerItem);
} else
{
rv = mScrolledFrame->BuildDisplayListForStackingContext(
aBuilder, dirtyRect + mOuter->GetOffsetTo(mScrolledFrame), &list);
nsDisplayScrollLayer* layerItem = new (aBuilder) nsDisplayScrollLayer(
aBuilder, &list, mScrolledFrame, mOuter);
set.Content()->AppendNewToTop(layerItem);
} else {
// If there is no displayport set, there is no reason here to force a
// layer that needs a memory-expensive allocation, but the compositor
// process would still like to know that it exists.
nsDisplayScrollLayer* layerItem = new (aBuilder) nsDisplayScrollInfoLayer(
aBuilder, &list, mScrolledFrame, mOuter);
set.Content()->AppendNewToTop(layerItem);
rv = mOuter->BuildDisplayListForChild(aBuilder, mScrolledFrame, dirtyRect, set);
}
} else {
rv = mOuter->BuildDisplayListForChild(aBuilder, mScrolledFrame, dirtyRect, set);
}

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

@ -270,7 +270,6 @@ public:
class nsPluginInstanceOwner : public nsIPluginInstanceOwner,
public nsIPluginInstanceOwner_MOZILLA_2_0_BRANCH,
public nsIPluginTagInfo,
public nsIDOMMouseListener,
public nsIDOMMouseMotionListener,
@ -286,7 +285,6 @@ public:
//nsIPluginInstanceOwner interface
NS_DECL_NSIPLUGININSTANCEOWNER
NS_DECL_NSIPLUGININSTANCEOWNER_MOZILLA_2_0_BRANCH
NS_IMETHOD GetURL(const char *aURL, const char *aTarget,
nsIInputStream *aPostStream,
@ -500,22 +498,11 @@ private:
// return FALSE if LayerSurface dirty (newly created and don't have valid plugin content yet)
PRBool IsUpToDate()
{
nsCOMPtr<nsIPluginInstance_MOZILLA_2_0_BRANCH> inst = do_QueryInterface(mInstance);
if (!inst)
return PR_FALSE;
nsIntSize size;
return NS_SUCCEEDED(inst->GetImageSize(&size)) &&
return NS_SUCCEEDED(mInstance->GetImageSize(&size)) &&
size == nsIntSize(mPluginWindow->width, mPluginWindow->height);
}
already_AddRefed<nsIPluginInstance_MOZILLA_2_0_BRANCH>
GetInstance()
{
nsCOMPtr<nsIPluginInstance_MOZILLA_2_0_BRANCH> inst = do_QueryInterface(mInstance);
return inst.forget();
}
void FixUpURLS(const nsString &name, nsAString &value);
nsPluginNativeWindow *mPluginWindow;
@ -2004,12 +1991,11 @@ nsObjectFrame::UpdateImageLayer(ImageContainer* aContainer, const gfxRect& aRect
PRBool
nsPluginInstanceOwner::SetCurrentImage(ImageContainer* aContainer)
{
nsCOMPtr<nsIPluginInstance_MOZILLA_2_0_BRANCH> inst = do_QueryInterface(mInstance);
if (inst) {
if (mInstance) {
nsRefPtr<Image> image;
// Every call to nsIPluginInstance_MOZILLA_2_0_BRANCH::GetImage() creates
// Every call to nsIPluginInstance::GetImage() creates
// a new image. See nsIPluginInstance.idl.
inst->GetImage(aContainer, getter_AddRefs(image));
mInstance->GetImage(aContainer, getter_AddRefs(image));
if (image) {
#ifdef XP_MACOSX
if (image->GetFormat() == Image::MAC_IO_SURFACE && mObjectFrame) {
@ -2030,9 +2016,8 @@ nsPluginInstanceOwner::SetCurrentImage(ImageContainer* aContainer)
void
nsPluginInstanceOwner::SetBackgroundUnknown()
{
nsCOMPtr<nsIPluginInstance_MOZILLA_2_0_BRANCH> inst = GetInstance();
if (inst) {
inst->SetBackgroundUnknown();
if (mInstance) {
mInstance->SetBackgroundUnknown();
}
}
@ -2040,10 +2025,9 @@ already_AddRefed<gfxContext>
nsPluginInstanceOwner::BeginUpdateBackground(const nsIntRect& aRect)
{
nsIntRect rect = aRect;
nsCOMPtr<nsIPluginInstance_MOZILLA_2_0_BRANCH> inst = GetInstance();
nsRefPtr<gfxContext> ctx;
if (inst &&
NS_SUCCEEDED(inst->BeginUpdateBackground(&rect, getter_AddRefs(ctx)))) {
if (mInstance &&
NS_SUCCEEDED(mInstance->BeginUpdateBackground(&rect, getter_AddRefs(ctx)))) {
return ctx.forget();
}
return nsnull;
@ -2054,19 +2038,17 @@ nsPluginInstanceOwner::EndUpdateBackground(gfxContext* aContext,
const nsIntRect& aRect)
{
nsIntRect rect = aRect;
nsCOMPtr<nsIPluginInstance_MOZILLA_2_0_BRANCH> inst = GetInstance();
if (inst) {
inst->EndUpdateBackground(aContext, &rect);
if (mInstance) {
mInstance->EndUpdateBackground(aContext, &rect);
}
}
nsIntSize
nsPluginInstanceOwner::GetCurrentImageSize()
{
nsCOMPtr<nsIPluginInstance_MOZILLA_2_0_BRANCH> inst = GetInstance();
nsIntSize size(0,0);
if (inst) {
inst->GetImageSize(&size);
if (mInstance) {
mInstance->GetImageSize(&size);
}
return size;
}
@ -3308,7 +3290,6 @@ NS_IMPL_RELEASE(nsPluginInstanceOwner)
NS_INTERFACE_MAP_BEGIN(nsPluginInstanceOwner)
NS_INTERFACE_MAP_ENTRY(nsIPluginInstanceOwner)
NS_INTERFACE_MAP_ENTRY(nsIPluginInstanceOwner_MOZILLA_2_0_BRANCH)
NS_INTERFACE_MAP_ENTRY(nsIPluginTagInfo)
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseListener)
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseMotionListener)
@ -4299,12 +4280,11 @@ NPDrawingModel nsPluginInstanceOwner::GetDrawingModel()
PRBool nsPluginInstanceOwner::IsRemoteDrawingCoreAnimation()
{
nsCOMPtr<nsIPluginInstance_MOZILLA_2_0_BRANCH> inst = do_QueryInterface(mInstance);
if (!inst)
if (mInstance)
return PR_FALSE;
PRBool coreAnimation;
if (!NS_SUCCEEDED(inst->IsRemoteDrawingCoreAnimation(&coreAnimation)))
if (!NS_SUCCEEDED(mInstance->IsRemoteDrawingCoreAnimation(&coreAnimation)))
return PR_FALSE;
return coreAnimation;

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

@ -139,13 +139,8 @@ FindViewForId(const ViewMap& aMap, ViewID aId)
static const FrameMetrics*
GetFrameMetrics(Layer* aLayer)
{
// Children are not container layers, so they don't have frame metrics. Give
// them a blank metric.
if (!aLayer->GetFirstChild())
return NULL;
ContainerLayer* container = static_cast<ContainerLayer*>(aLayer);
return &container->GetFrameMetrics();
ContainerLayer* container = aLayer->AsContainerLayer();
return container ? &container->GetFrameMetrics() : NULL;
}
static nsIntPoint
@ -346,10 +341,9 @@ BuildViewMap(ViewMap& oldContentViews, ViewMap& newContentViews,
nsFrameLoader* aFrameLoader, Layer* aLayer,
float aXScale = 1, float aYScale = 1)
{
if (!aLayer->GetFirstChild())
ContainerLayer* container = aLayer->AsContainerLayer();
if (!container)
return;
ContainerLayer* container = static_cast<ContainerLayer*>(aLayer);
const FrameMetrics metrics = container->GetFrameMetrics();
const ViewID scrollId = metrics.mScrollId;

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

@ -395,9 +395,9 @@ pref("dom.max_script_run_time", 20);
pref("devtools.errorconsole.enabled", false);
// kinetic tweakables
pref("browser.ui.kinetic.updateInterval", 30);
pref("browser.ui.kinetic.decelerationRate", 20);
pref("browser.ui.kinetic.speedSensitivity", 80);
pref("browser.ui.kinetic.updateInterval", 16);
pref("browser.ui.kinetic.exponentialC", 1400);
pref("browser.ui.kinetic.polynomialC", 100);
pref("browser.ui.kinetic.swipeLength", 160);
// zooming
@ -585,6 +585,12 @@ pref("indexedDB.feature.enabled", false);
pref("media.preload.default", 1); // default to preload none
pref("media.preload.auto", 2); // preload metadata if preload=auto
// 0: don't show fullscreen keyboard
// 1: always show fullscreen keyboard
// -1: show fullscreen keyboard based on threshold pref
pref("widget.ime.android.landscape_fullscreen", 0);
pref("widget.ime.android.fullscreen_threshold", 300); // in hundreths of inches
// optimize images memory usage
pref("image.mem.decodeondraw", true);
pref("content.image.allow_locking", false);

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

@ -16,7 +16,7 @@ var BookmarkHelper = {
return;
// When opening the bookmark helper dialog be sure there is not others
// popup opened like the bookmakr popup
// popup opened like the bookmark popup
BookmarkPopup.hide();
let title = PlacesUtils.bookmarks.getItemTitle(itemId);

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

@ -45,7 +45,7 @@ var MenuListHelperUI = {
// Add selected as a class name instead of an attribute to not being overidden
// by the richlistbox behavior (it sets the "current" and "selected" attribute
item.setAttribute("class", "option-command prompt-button" + (child.selected ? " selected" : ""));
item.setAttribute("class", "option-command action-button" + (child.selected ? " selected" : ""));
let image = document.createElement("image");
image.setAttribute("src", child.image || "");

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

@ -43,7 +43,7 @@ var SelectHelperUI = {
let choice = choices[i];
let item = document.createElement("listitem");
item.setAttribute("class", "option-command listitem-iconic prompt-button");
item.setAttribute("class", "option-command listitem-iconic action-button");
item.setAttribute("image", "");
item.setAttribute("flex", "1");
item.setAttribute("crop", "center");

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

@ -23,7 +23,7 @@ var SharingUI = {
let bbox = document.getElementById("share-buttons-box");
this._handlers.forEach(function(handler) {
let button = document.createElement("button");
button.className = "prompt-button";
button.className = "action-button";
button.setAttribute("label", handler.name);
button.addEventListener("command", function() {
SharingUI.hide();

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

@ -873,9 +873,9 @@
<xul:image xbl:inherits="src"/>
<xul:vbox flex="1">
<xul:vbox flex="1">
<xul:textbox anonid="name" xbl:inherits="value=title"/>
<xul:textbox anonid="uri" xbl:inherits="value=uri"/>
<xul:textbox anonid="tags" xbl:inherits="value=tags" emptytext="&editBookmarkTags.label;"/>
<xul:textbox anonid="name" xbl:inherits="value=title" class="prompt-edit" flex="1"/>
<xul:textbox anonid="uri" xbl:inherits="value=uri" class="prompt-edit" flex="1"/>
<xul:textbox anonid="tags" xbl:inherits="value=tags" emptytext="&editBookmarkTags.label;" class="prompt-edit" flex="1"/>
</xul:vbox>
<xul:hbox class="bookmark-controls" align="center">

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

@ -359,18 +359,18 @@
</vbox>
</arrowbox>
<vbox id="bookmark-container" hidden="true" class="panel-dark window-width window-height">
<vbox id="bookmark-dialog" class="panel-dark">
<hbox id="bookmark-form-title">
<box id="bookmark-container" class="perm-modal-block window-width window-height" hidden="true">
<dialog id="bookmark-dialog" flex="1">
<hbox id="bookmark-form-title" class="prompt-title">
<description>&editBookmarkDialog.title;</description>
</hbox>
<separator id="bookmark-form-line"/>
<scrollbox id="bookmark-form" align="start"/>
<hbox id="bookmark-form-buttons" pack="center">
<button label="&editBookmarkDone.label;" oncommand="BookmarkHelper.save();"/>
<separator id="bookmark-form-line" class="prompt-line"/>
<scrollbox id="bookmark-form" align="start" class="prompt-message" flex="1"/>
<hbox id="bookmark-form-buttons" pack="center" class="prompt-buttons">
<button label="&editBookmarkDone.label;" class="prompt-button" oncommand="BookmarkHelper.save();"/>
</hbox>
</vbox>
</vbox>
</dialog>
</box>
<vbox id="panel-container" class="panel-dark window-width window-height" style="-moz-stack-sizing: ignore" left="10000" hidden="true">
<hbox id="panel-controls" class="panel-row-header" oncommand="BrowserUI.switchPane(event.target.getAttribute('linkedpanel'));">
@ -461,6 +461,7 @@
<settings id="prefs-privacy" label="&privacy.title;">
<setting pref="network.cookie.cookieBehavior" title="&allowCookies.title;" type="boolint" on="0" off="2"/>
<setting pref="signon.rememberSignons" title="&rememberPasswords.title;" type="bool"/>
<setting pref="privacy.donottrackheader.enabled" title="&doNotTrack.title;" type="bool"/>
<setting title="&clearPrivateData2.title;" type="control">
<button id="prefs-clear-data" label="&clearPrivateData.button;" command="cmd_sanitize"/>
</setting>
@ -521,14 +522,14 @@
</vbox>
#ifdef MOZ_SERVICES_SYNC
<vbox id="syncsetup-container" class="window-width window-height" hidden="true">
<vbox id="syncsetup-dialog" class="panel-dark" flex="1">
<hbox class="syncsetup-title">
<box id="syncsetup-container" class="perm-modal-block window-width window-height" hidden="true">
<dialog id="syncsetup-dialog" flex="1">
<hbox class="prompt-title">
<description>&sync.setup.title;</description>
</hbox>
<separator class="syncsetup-line"/>
<separator class="prompt-line"/>
<vbox id="syncsetup-simple" class="syncsetup-page" flex="1">
<scrollbox class="syncsetup-scrollbox" orient="vertical" flex="1">
<scrollbox class="prompt-message" orient="vertical" flex="1">
<description class="syncsetup-desc syncsetup-center" flex="1">&sync.setup.jpake;</description>
<description class="syncsetup-center syncsetup-link" flex="1" onclick="WeaveGlue.openTutorial();">&sync.setup.tutorial;</description>
<separator/>
@ -541,37 +542,37 @@
<description class="syncsetup-center syncsetup-link" flex="1" onclick="WeaveGlue.openManual();">&sync.fallback;</description>
<separator flex="1"/>
</scrollbox>
<hbox class="syncsetup-buttons" pack="center">
<hbox class="prompt-buttons" pack="center">
<button oncommand="WeaveGlue.close();">&sync.setup.cancel;</button>
</hbox>
</vbox>
<vbox id="syncsetup-fallback" class="syncsetup-page" flex="1" hidden="true">
<scrollbox class="syncsetup-scrollbox" orient="vertical" flex="1">
<scrollbox class="prompt-message" orient="vertical" flex="1">
<description class="syncsetup-desc syncsetup-center" flex="1">&sync.setup.manual;</description>
<separator/>
<textbox id="syncsetup-account" class="syncsetup-edit" placeholder="&sync.account;" oninput="WeaveGlue.canConnect();"/>
<textbox id="syncsetup-password" class="syncsetup-edit" placeholder="&sync.password;" type="password" oninput="WeaveGlue.canConnect();"/>
<textbox id="syncsetup-synckey" class="syncsetup-edit" placeholder="&sync.syncKey;" oninput="WeaveGlue.canConnect();"/>
<textbox id="syncsetup-account" class="prompt-edit" placeholder="&sync.account;" oninput="WeaveGlue.canConnect();"/>
<textbox id="syncsetup-password" class="prompt-edit" placeholder="&sync.password;" type="password" oninput="WeaveGlue.canConnect();"/>
<textbox id="syncsetup-synckey" class="prompt-edit" placeholder="&sync.syncKey;" oninput="WeaveGlue.canConnect();"/>
<separator class="thin"/>
<button id="syncsetup-usecustomserver" type="checkbox" class="button-checkbox" pack="start" oncommand="WeaveGlue.toggleCustomServer();">
<image class="button-image-icon"/>
<description class="syncsetup-label" flex="1">&sync.customServer;</description>
<description class="syncsetup-label prompt-checkbox-label" flex="1">&sync.customServer;</description>
</button>
<textbox id="syncsetup-customserver" placeholder="&sync.serverURL;"/>
<textbox id="syncsetup-customserver" class="prompt-edit" placeholder="&sync.serverURL;"/>
<separator flex="1"/>
</scrollbox>
<hbox class="syncsetup-buttons" pack="center">
<hbox class="prompt-buttons" pack="center">
<button oncommand="WeaveGlue.close();">&sync.setup.cancel;</button>
<separator/>
<button id="syncsetup-button-connect" oncommand="WeaveGlue.close(); WeaveGlue.connect();">&sync.setup.connect;</button>
</hbox>
</vbox>
</vbox>
</vbox>
</dialog>
</box>
#endif
<arrowbox id="search-engines-popup" hidden="true" offset="18" flex="1">
<hbox id="search-engines-list" class="prompt-buttons" flex="1"/>
<hbox id="search-engines-list" class="action-buttons" flex="1"/>
</arrowbox>
<arrowbox id="newtab-popup" class="arrowbox-dark" hidden="true" onclick="NewTabPopup.selectTab()" align="center" start="0">
@ -660,7 +661,7 @@
<hbox id="menulist-container" class="window-width window-height context-block" top="0" left="0" hidden="true" flex="1">
<vbox id="menulist-popup" class="dialog-dark">
<label id="menulist-title" class="options-title" crop="center" flex="1"/>
<richlistbox id="menulist-commands" class="prompt-buttons" onclick="if (event.target != this) MenuListHelperUI.selectByIndex(this.selectedIndex);" flex="1"/>
<richlistbox id="menulist-commands" class="action-buttons" onclick="if (event.target != this) MenuListHelperUI.selectByIndex(this.selectedIndex);" flex="1"/>
</vbox>
</hbox>

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

@ -30,7 +30,7 @@ var BrowserSearch = {
this.engines.forEach(function(aEngine) {
let button = document.createElement("button");
button.className = "prompt-button";
button.className = "action-button";
button.setAttribute("label", aEngine.name);
button.setAttribute("crop", "end");
button.setAttribute("pack", "start");

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

@ -60,6 +60,13 @@ const kAxisLockRevertThreshold = 0.8;
// Same as NS_EVENT_STATE_ACTIVE from nsIEventStateManager.h
const kStateActive = 0x00000001;
// After a drag begins, kinetic panning is stopped if the drag doesn't become
// a pan in 300 milliseconds.
const kStopKineticPanOnDragTimeout = 300;
// Max velocity of a pan. This is in pixels/millisecond.
const kMaxVelocity = 6;
/**
* MouseModule
*
@ -205,19 +212,21 @@ MouseModule.prototype = {
this._targetScrollInterface = targetScrollInterface;
// Do tap
let event = document.createEvent("Events");
event.initEvent("TapDown", true, true);
event.clientX = aEvent.clientX;
event.clientY = aEvent.clientY;
let success = aEvent.target.dispatchEvent(event);
if (success) {
this._recordEvent(aEvent);
this._target = aEvent.target;
this._mouseOverTimeout.once(kOverTapWait);
this._longClickTimeout.once(kLongTapWait);
} else {
// cancel all pending content clicks
this._cleanClickBuffer();
if (!this._kinetic.isActive()) {
let event = document.createEvent("Events");
event.initEvent("TapDown", true, true);
event.clientX = aEvent.clientX;
event.clientY = aEvent.clientY;
let success = aEvent.target.dispatchEvent(event);
if (success) {
this._recordEvent(aEvent);
this._target = aEvent.target;
this._mouseOverTimeout.once(kOverTapWait);
this._longClickTimeout.once(kLongTapWait);
} else {
// cancel all pending content clicks
this._cleanClickBuffer();
}
}
// Do pan
@ -328,11 +337,8 @@ MouseModule.prototype = {
if (dragData.isPan()) {
// Only pan when mouse event isn't part of a click. Prevent jittering on tap.
this._kinetic.addData(sX - dragData.prevPanX, sY - dragData.prevPanY);
if (!this._waitingForPaint) {
this._dragBy(this.dX, this.dY);
this.dX = 0;
this.dY = 0;
}
this._dragBy(this.dX, this.dY);
// dragBy will reset dX and dY values to 0.
// Let everyone know when mousemove begins a pan
if (!oldIsPan && dragData.isPan()) {
@ -361,6 +367,7 @@ MouseModule.prototype = {
let dragData = this._dragData;
dragData.setDragStart(aEvent.screenX, aEvent.screenY, aDraggable);
this._kinetic.addData(0, 0);
this._dragStartTime = Date.now();
if (!this._kinetic.isActive())
this._dragger.dragStart(aEvent.clientX, aEvent.clientY, aEvent.target, this._targetScrollInterface);
},
@ -377,13 +384,15 @@ MouseModule.prototype = {
// mousedown/mouseup event previous to this one. In this case, we
// want the kinetic panner to tell our drag interface to stop.
if (!dragData.isPan() && !this._kinetic.isActive()) {
// There was no pan and no kinetic scrolling, so just stop dragger.
this._dragger.dragStop(0, 0, this._targetScrollInterface);
this._dragger = null;
} else if (dragData.isPan()) {
if (dragData.isPan()) {
if (Date.now() - this._dragStartTime > kStopKineticPanOnDragTimeout)
this._kinetic._velocity.set(0, 0);
// Start kinetic pan.
this._kinetic.start();
} else {
this._kinetic.end();
this._dragger.dragStop(0, 0, this._targetScrollInterface);
this._dragger = null;
}
},
@ -394,12 +403,21 @@ MouseModule.prototype = {
* the dragger of dragMove()s.
*/
_dragBy: function _dragBy(dX, dY, aIsKinetic) {
let dragged = true;
let dragData = this._dragData;
let dragged = this._dragger.dragMove(dX, dY, this._targetScrollInterface, aIsKinetic);
if (dragged && !this._waitingForPaint) {
this._waitingForPaint = true;
mozRequestAnimationFrame(this);
if (!this._waitingForPaint || aIsKinetic) {
let dragData = this._dragData;
dragged = this._dragger.dragMove(dX, dY, this._targetScrollInterface, aIsKinetic);
if (dragged && !this._waitingForPaint) {
this._waitingForPaint = true;
mozRequestAnimationFrame(this);
}
this.dX = 0;
this.dY = 0;
}
if (!dragData.isPan())
this._kinetic.pause();
return dragged;
},
@ -816,10 +834,9 @@ function KineticController(aPanBy, aEndCallback) {
// How often do we change the position of the scroll pane? Too often and panning may jerk near
// the end. Too little and panning will be choppy. In milliseconds.
this._updateInterval = Services.prefs.getIntPref("browser.ui.kinetic.updateInterval");
// "Friction" of the scroll pane. The lower, the less friction and the further distance traveled.
this._decelerationRate = Services.prefs.getIntPref("browser.ui.kinetic.decelerationRate") / 10000;
// A multiplier for the initial velocity of the movement.
this._speedSensitivity = Services.prefs.getIntPref("browser.ui.kinetic.speedSensitivity") / 100;
// Constants that affect the "friction" of the scroll pane.
this._exponentialC = Services.prefs.getIntPref("browser.ui.kinetic.exponentialC");
this._polynomialC = Services.prefs.getIntPref("browser.ui.kinetic.polynomialC") / 1000000;
// Number of milliseconds that can contain a swipe. Movements earlier than this are disregarded.
this._swipeLength = Services.prefs.getIntPref("browser.ui.kinetic.swipeLength");
@ -829,6 +846,7 @@ function KineticController(aPanBy, aEndCallback) {
KineticController.prototype = {
_reset: function _reset() {
this._active = false;
this._paused = false;
this.momentumBuffer = [];
this._velocity.set(0, 0);
},
@ -838,82 +856,84 @@ KineticController.prototype = {
},
_startTimer: function _startTimer() {
// Use closed form of a parabola to calculate each position for panning.
// x(t) = v0*t + .5*t^2*a
// where: v0 is initial velocity
// a is acceleration
// t is time elapsed
//
// x(t)
// ^
// | |
// |
// | |
// | ....^^^^....
// | ...^^ | ^^...
// | ...^ ^...
// |.. | ..
// -----------------------------------> t
// t0 tf=-v0/a
//
// Using this formula, distance moved is independent of the time between each frame, unlike time
// step approaches. Once the time is up, set the position to x(tf) and stop the timer.
let self = this;
let lastx = this._position; // track last position vector because pan takes differences
let lastp = this._position; // track last position vector because pan takes deltas
let v0 = this._velocity; // initial velocity
let a = this._acceleration; // acceleration
let c = this._exponentialC;
let p = new Point(0, 0);
let dx, dy, t, realt;
// Temporary "bins" so that we don't create new objects during pan.
let aBin = new Point(0, 0);
let v0Bin = new Point(0, 0);
let self = this;
function calcP(v0, a, t) {
// Important traits for this function:
// p(t=0) is 0
// p'(t=0) is v0
//
// We use exponential to get a smoother stop, but by itself exponential
// is too smooth at the end. Adding a polynomial with the appropriate
// weight helps to balance
return v0 * Math.exp(-t / c) * -c + a * t * t + v0 * c;
}
this._calcV = function(v0, a, t) {
return v0 * Math.exp(-t / c) + 2 * a * t;
}
let callback = {
onBeforePaint: function kineticHandleEvent(timeStamp) {
if (!self.isActive()) // someone called end() on us between timer intervals
// Someone called end() on us between timer intervals
// or we are paused.
if (!self.isActive() || self._paused)
return;
// To make animation end fast enough but to keep smoothness, average the ideal
// time frame (smooth animation) with the actual time lapse (end fast enough).
// Animation will never take longer than 2 times the ideal length of time.
let realt = timeStamp - self._initialTime;
realt = timeStamp - self._initialTime;
self._time += self._updateInterval;
let t = (self._time + realt) / 2;
t = (self._time + realt) / 2;
// Calculate new position using x(t) formula.
let x = v0Bin.set(v0).scale(t).add(aBin.set(a).scale(0.5 * t * t));
let dx = x.x - lastx.x;
let dy = x.y - lastx.y;
lastx.set(x);
// Calculate new position.
p.x = calcP(v0.x, a.x, t);
p.y = calcP(v0.y, a.y, t);
dx = Math.round(p.x - lastp.x);
dy = Math.round(p.y - lastp.y);
// Test to see if movement is finished for each component. As seen in graph, we want the
// final position to be at tf.
if (t >= -v0.x / a.x) {
// Plug in t=-v0/a into x(t) to get final position.
dx = -v0.x * v0.x / 2 / a.x - lastx.x;
// Reset components. Next frame: a's component will be 0 and t >= NaN will be false.
lastx.x = 0;
// Test to see if movement is finished for each component.
if (dx * a.x > 0) {
dx = 0;
lastp.x = 0;
v0.x = 0;
a.x = 0;
}
// Symmetric to above case.
if (t >= -v0.y / a.y) {
dy = -v0.y * v0.y / 2 / a.y - lastx.y;
lastx.y = 0;
if (dy * a.y > 0) {
dy = 0;
lastp.y = 0;
v0.y = 0;
a.y = 0;
}
let panned = false;
try { panned = self._panBy(Math.round(-dx), Math.round(-dy), true); } catch (e) {}
if (!panned)
if (v0.x == 0 && v0.y == 0) {
self.end();
else
mozRequestAnimationFrame(this);
} else {
let panStop = false;
if (dx != 0 || dy != 0) {
try { panStop = !self._panBy(-dx, -dy, true); } catch (e) {}
lastp.add(dx, dy);
}
if (panStop)
self.end();
else
mozRequestAnimationFrame(this);
}
}
};
this._active = true;
this._paused = false;
mozRequestAnimationFrame(callback);
},
@ -922,6 +942,12 @@ KineticController.prototype = {
return x ? ((x > 0) ? 1 : -1) : 0;
}
function clampFromZero(x, closerToZero, furtherFromZero) {
if (x >= 0)
return Math.max(closerToZero, Math.min(furtherFromZero, x));
return Math.min(-closerToZero, Math.max(-furtherFromZero, x));
}
let mb = this.momentumBuffer;
let mblen = this.momentumBuffer.length;
@ -940,24 +966,43 @@ KineticController.prototype = {
}
}
// Only allow kinetic scrolling to speed up if kinetic scrolling is active.
this._velocity.x = (distanceX < 0 ? Math.min : Math.max)((distanceX / swipeLength) * this._speedSensitivity, this._velocity.x);
this._velocity.y = (distanceY < 0 ? Math.min : Math.max)((distanceY / swipeLength) * this._speedSensitivity, this._velocity.y);
let currentVelocityX = 0;
let currentVelocityY = 0;
if (this.isActive()) {
// If active, then we expect this._calcV to be defined.
let currentTime = Date.now() - this._initialTime;
currentVelocityX = Util.clamp(this._calcV(this._velocity.x, this._acceleration.x, currentTime), -kMaxVelocity, kMaxVelocity);
currentVelocityY = Util.clamp(this._calcV(this._velocity.y, this._acceleration.y, currentTime), -kMaxVelocity, kMaxVelocity);
}
if (currentVelocityX * this._velocity.x <= 0)
currentVelocityX = 0;
if (currentVelocityY * this._velocity.y <= 0)
currentVelocityY = 0;
let swipeTime = Math.min(swipeLength, lastTime - mb[0].t);
this._velocity.x = clampFromZero((distanceX / swipeTime) + currentVelocityX, Math.abs(currentVelocityX), 6);
this._velocity.y = clampFromZero((distanceY / swipeTime) + currentVelocityY, Math.abs(currentVelocityY), 6);
// Set acceleration vector to opposite signs of velocity
this._acceleration.set(this._velocity.clone().map(sign).scale(-this._decelerationRate));
this._acceleration.set(this._velocity.clone().map(sign).scale(-this._polynomialC));
this._position.set(0, 0);
this._initialTime = mozAnimationStartTime;
this._time = 0;
this.momentumBuffer = [];
if (!this.isActive())
if (!this.isActive() || this._paused)
this._startTimer();
return true;
},
pause: function pause() {
this._paused = true;
},
end: function end() {
if (this.isActive()) {
if (this._beforeEnd)

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

@ -19,7 +19,8 @@
</commandset>
<vbox class="prompt-header" flex="1">
<label id="prompt-alert-title" class="prompt-title" crop="center" flex="1"/>
<description id="prompt-alert-title" class="prompt-title" crop="center" flex="1"/>
<separator id="prompt-alert-separator" class="prompt-line"/>
<scrollbox orient="vertical" class="prompt-message" flex="1">
<description id="prompt-alert-message"/>

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

@ -19,7 +19,8 @@
</commandset>
<vbox class="prompt-header" flex="1">
<label id="prompt-confirm-title" class="prompt-title" crop="center" flex="1"/>
<description id="prompt-confirm-title" class="prompt-title" crop="center" flex="1"/>
<separator id="prompt-confirm-separator" class="prompt-line"/>
<scrollbox orient="vertical" class="prompt-message" flex="1">
<description id="prompt-confirm-message"/>

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

@ -19,13 +19,14 @@
</commandset>
<vbox class="prompt-header" flex="1">
<label id="prompt-prompt-title" class="prompt-title" crop="center" flex="1"/>
<description id="prompt-prompt-title" class="prompt-title" crop="center" flex="1"/>
<separator class="prompt-line"/>
<scrollbox orient="vertical" class="prompt-message" flex="1">
<description id="prompt-prompt-message"/>
</scrollbox>
<textbox id="prompt-prompt-textbox"/>
<textbox id="prompt-prompt-textbox" class="prompt-edit"/>
<button id="prompt-prompt-checkbox" type="checkbox" class="button-checkbox" collapsed="true" pack="start" flex="1">
<image class="button-image-icon"/>

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

@ -24,13 +24,14 @@
</commandset>
<vbox class="prompt-header" flex="1">
<label id="prompt-password-title" class="prompt-title" crop="center" flex="1"/>
<description id="prompt-password-title" class="prompt-title" crop="center" flex="1"/>
<separator class="prompt-line"/>
<scrollbox orient="vertical" class="prompt-message" flex="1">
<description id="prompt-password-message"/>
</scrollbox>
<grid>
<grid class="prompt-message">
<columns>
<column flex="1"/>
<column flex="1"/>
@ -38,11 +39,11 @@
<rows>
<row align="center">
<label value="&editfield0.label;"/>
<textbox id="prompt-password-user"/>
<textbox id="prompt-password-user" class="prompt-edit"/>
</row>
<row align="center">
<label value="&editfield1.label;"/>
<textbox type="password" id="prompt-password-password"/>
<textbox type="password" id="prompt-password-password" class="prompt-edit"/>
</row>
</rows>
</grid>

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

@ -19,7 +19,8 @@
</commandset>
<vbox class="prompt-header" flex="1">
<label id="prompt-select-title" class="prompt-title" crop="center" flex="1"/>
<description id="prompt-select-title" class="prompt-title" crop="center" flex="1"/>
<separator class="prompt-line"/>
<scrollbox orient="vertical" class="prompt-message" flex="1">
<description id="prompt-select-message"/>

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

@ -155,7 +155,6 @@ function isRestartShown(aShown, isUpdate, aCallback) {
}
function checkInstallAlert(aShown, aCallback) {
info("checkInstallAlert " + aShown + "\n");
checkAlert(null, "xpinstall", null, aShown, function(aNotifyBox, aNotification) {
if (aShown) {
let button = aNotification.childNodes[0];
@ -170,13 +169,11 @@ function checkInstallAlert(aShown, aCallback) {
}
function checkDownloadNotification(aCallback) {
dump("checkDownloadNotification\n");
let msg = /download/i;
checkNotification(/Add-ons/, msg, ADDON_IMG, aCallback);
}
function checkInstallNotification(aRestart, aCallback) {
dump("checkInstallNotification " + aRestart + "\n");
let msg = null;
if (aRestart)
msg = /restart/i;
@ -184,7 +181,6 @@ function checkInstallNotification(aRestart, aCallback) {
}
function checkNotification(aTitle, aMessage, aIcon, aCallback) {
dump("checkNotification " + aTitle + " " + aMessage + " " + aIcon + "\n");
let doTest = function() {
ok(document.getElementById("alerts-container").classList.contains("showing"), "Alert shown");
let title = document.getElementById("alerts-title").value;
@ -209,7 +205,6 @@ function checkNotification(aTitle, aMessage, aIcon, aCallback) {
}
function checkAlert(aId, aName, aLabel, aShown, aCallback) {
info("checkAlert " + aId + " " + aName + " " + aLabel + " " + aShown + "\n");
let msg = null;
if (aId)
msg = document.getElementById(aId);
@ -307,7 +302,9 @@ function loadUrl(aURL, aCallback, aNewTab) {
}
function checkInstallPopup(aName, aCallback) {
testPrompt("Installing Add-on", aName, [ {label: "Install", click: true}, {label: "Cancel", click: false}], aCallback);
testPrompt("Installing Add-on", aName, [ {label: "Install", click: true},
{label: "Cancel", click: false}],
aCallback);
}
function testPrompt(aTitle, aMessage, aButtons, aCallback) {
@ -318,12 +315,12 @@ function testPrompt(aTitle, aMessage, aButtons, aCallback) {
if (prompt) {
let title = document.getElementById("prompt-confirm-title");
let message = document.getElementById("prompt-confirm-message");
is(aTitle, title.value, "Correct title shown");
is(aTitle, title.textContent, "Correct title shown");
is(aMessage, message.textContent, "Correct message shown");
let buttons = document.getElementsByClassName("prompt-button");
let buttons = document.querySelectorAll("#prompt-confirm-buttons-box .prompt-button");
let clickButton = null;
ok(buttons.length == aButtons.length, "Prompt has correct number of buttons");
is(buttons.length, aButtons.length, "Prompt has correct number of buttons");
if (buttons.length == aButtons.length) {
for (let i = 0; i < buttons.length; i++) {
is(buttons[i].label, aButtons[i].label, "Button has correct label");
@ -351,23 +348,15 @@ function testPrompt(aTitle, aMessage, aButtons, aCallback) {
// Installs an addon via the urlbar.
function installFromURLBar(aAddon) {
info("installFromURLBar " + aAddon + "\n");
return function() {
loadUrl(gTestURL, function() {
info("loadUrl: " + gTestURL + "\n");
loadUrl(aAddon.sourceURL, null, false);
info("loadUrl: " + aAddon.sourceURL + "(2)\n");
checkInstallAlert(true, function() {
dump("info: checkInstallAlert callback\n");
checkDownloadNotification(function() {
dump("info: checkDownloadNotification callback\n");
checkInstallPopup(aAddon.name, function() {
dump("info: checkInstallPopup callback\n");
checkInstallNotification(!aAddon.bootstrapped, function() {
dump("info: checkInstallNotification callback\n");
open_manager(true, function() {
isRestartShown(!aAddon.bootstrapped, false, function() {
dump("info: isRestartShown callback\n");
let elt = get_addon_element(aAddon.id);
if (aAddon.bootstrapped) {
checkAddonListing(aAddon, elt, "local");
@ -443,41 +432,26 @@ function installListener(aSettings) {
installListener.prototype = {
onNewInstall : function(install) { },
onDownloadStarted : function(install) {
info("download started");
},
onDownloadProgress : function(install) {
info("download progress");
},
onDownloadEnded : function(install) {
info("download ended");
},
onDownloadCancelled : function(install) {
info("download cancelled");
},
onDownloadStarted : function(install) { },
onDownloadProgress : function(install) { },
onDownloadEnded : function(install) { },
onDownloadCancelled : function(install) { },
onDownloadFailed : function(install) {
if(this.addon.willFail)
ok(false, "Install failed");
info("download failed");
},
onInstallStarted : function(install) {
info("Install started");
},
onInstallStarted : function(install) { },
onInstallEnded : function(install, addon) {
info("Install ended");
let self = this;
isRestartShown(!this.addon.bootstrapped, false, function() {
if(self.onComplete)
self.onComplete();
});
},
onInstallCancelled : function(install) {
info("Install cancelled");
},
onInstallCancelled : function(install) { },
onInstallFailed : function(install) {
if(this.willFail)
ok(false, "Install failed");
info("install failed");
},
onExternalInstall : function(install, existing, needsRestart) { },
};

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

@ -16,6 +16,10 @@ function runNextTest() {
else {
// Close the awesome panel just in case
BrowserUI.activePanel = null;
for (let iTab=0; iTab<newTabs.length; iTab++)
Browser.closeTab(newTabs[iTab], { forceClose: true });
finish();
}
}

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

@ -239,6 +239,17 @@ Prompt.prototype = {
return browser.importDialog(this._domWin, aSrc, aParams);
},
_setupPrompt: function setupPrompt(aDoc, aType, aTitle, aText, aCheck) {
aDoc.getElementById("prompt-" + aType + "-title").appendChild(aDoc.createTextNode(aTitle));
aDoc.getElementById("prompt-" + aType + "-message").appendChild(aDoc.createTextNode(aText));
if (aCheck && aCheck.msg) {
aDoc.getElementById("prompt-" + aType + "-checkbox").checked = aCheck.value;
this.setLabelForNode(aDoc.getElementById("prompt-" + aType + "-checkbox-label"), aCheck.msg);
aDoc.getElementById("prompt-" + aType + "-checkbox").removeAttribute("collapsed");
}
},
commonPrompt: function commonPrompt(aTitle, aText, aValue, aCheckMsg, aCheckState, isPassword) {
var params = new Object();
params.result = false;
@ -247,15 +258,8 @@ Prompt.prototype = {
let dialog = this.openDialog("chrome://browser/content/prompt/prompt.xul", params);
let doc = this._doc;
doc.getElementById("prompt-prompt-title").value = aTitle;
doc.getElementById("prompt-prompt-message").appendChild(doc.createTextNode(aText));
doc.getElementById("prompt-prompt-checkbox").checked = aCheckState.value;
this.setLabelForNode(doc.getElementById("prompt-prompt-checkbox-label"), aCheckMsg);
this._setupPrompt(doc, "prompt", aTitle, aText, {value: aCheckState.value, msg: aCheckMsg});
doc.getElementById("prompt-prompt-textbox").value = aValue.value;
if (aCheckMsg)
doc.getElementById("prompt-prompt-checkbox").removeAttribute("collapsed");
if (isPassword)
doc.getElementById("prompt-prompt-textbox").type = "password";
@ -348,8 +352,7 @@ Prompt.prototype = {
alert: function alert(aTitle, aText) {
let dialog = this.openDialog("chrome://browser/content/prompt/alert.xul", null);
let doc = this._doc;
doc.getElementById("prompt-alert-title").value = aTitle;
doc.getElementById("prompt-alert-message").appendChild(doc.createTextNode(aText));
this._setupPrompt(doc, "alert", aTitle, aText);
dialog.waitForClose();
},
@ -357,13 +360,7 @@ Prompt.prototype = {
alertCheck: function alertCheck(aTitle, aText, aCheckMsg, aCheckState) {
let dialog = this.openDialog("chrome://browser/content/prompt/alert.xul", aCheckState);
let doc = this._doc;
doc.getElementById("prompt-alert-title").value = aTitle;
doc.getElementById("prompt-alert-message").appendChild(doc.createTextNode(aText));
doc.getElementById("prompt-alert-checkbox").checked = aCheckState.value;
this.setLabelForNode(doc.getElementById("prompt-alert-checkbox-label"), aCheckMsg);
doc.getElementById("prompt-alert-checkbox").removeAttribute("collapsed");
this._setupPrompt(doc, "alert", aTitle, aText, {value: aCheckState.value, msg: aCheckMsg});
dialog.waitForClose();
},
@ -373,8 +370,7 @@ Prompt.prototype = {
let dialog = this.openDialog("chrome://browser/content/prompt/confirm.xul", params);
let doc = this._doc;
doc.getElementById("prompt-confirm-title").value = aTitle;
doc.getElementById("prompt-confirm-message").appendChild(doc.createTextNode(aText));
this._setupPrompt(doc, "confirm", aTitle, aText);
dialog.waitForClose();
return params.result;
@ -387,12 +383,7 @@ Prompt.prototype = {
let dialog = this.openDialog("chrome://browser/content/prompt/confirm.xul", params);
let doc = this._doc;
doc.getElementById("prompt-confirm-title").value = aTitle;
doc.getElementById("prompt-confirm-message").appendChild(doc.createTextNode(aText));
doc.getElementById("prompt-confirm-checkbox").checked = aCheckState.value;
this.setLabelForNode(doc.getElementById("prompt-confirm-checkbox-label"), aCheckMsg);
doc.getElementById("prompt-confirm-checkbox").removeAttribute("collapsed");
this._setupPrompt(doc, "prompt", aTitle, aText, {value: aCheckState.value, msg: aCheckMsg});
dialog.waitForClose();
return params.result;
@ -418,14 +409,7 @@ Prompt.prototype = {
let dialog = this.openDialog("chrome://browser/content/prompt/confirm.xul", params);
let doc = this._doc;
doc.getElementById("prompt-confirm-title").value = aTitle;
doc.getElementById("prompt-confirm-message").appendChild(doc.createTextNode(aText));
doc.getElementById("prompt-confirm-checkbox").checked = aCheckState.value;
this.setLabelForNode(doc.getElementById("prompt-confirm-checkbox-label"), aCheckMsg);
if (aCheckMsg)
doc.getElementById("prompt-confirm-checkbox").removeAttribute("collapsed");
this._setupPrompt(doc, "confirm", aTitle, aText, {value: aCheckState.value, msg: aCheckMsg});
let bbox = doc.getElementById("prompt-confirm-buttons-box");
while (bbox.lastChild)
@ -500,16 +484,10 @@ Prompt.prototype = {
let dialog = this.openDialog("chrome://browser/content/prompt/promptPassword.xul", params);
let doc = this._doc;
doc.getElementById("prompt-password-title").value = aTitle;
doc.getElementById("prompt-password-message").appendChild(doc.createTextNode(aText));
doc.getElementById("prompt-password-checkbox").checked = aCheckState.value;
this._setupPrompt(doc, "password", aTitle, aText, {value: aCheckState.value, msg: aCheckMsg});
doc.getElementById("prompt-password-user").value = aUsername.value;
doc.getElementById("prompt-password-password").value = aPassword.value;
if (aCheckMsg) {
doc.getElementById("prompt-password-checkbox").removeAttribute("collapsed");
this.setLabelForNode(doc.getElementById("prompt-password-checkbox-label"), aCheckMsg);
}
dialog.waitForClose();
return params.result;
@ -522,8 +500,7 @@ Prompt.prototype = {
let dialog = this.openDialog("chrome://browser/content/prompt/select.xul", params);
let doc = this._doc;
doc.getElementById("prompt-select-title").value = aTitle;
doc.getElementById("prompt-select-message").appendChild(doc.createTextNode(aText));
this._setupPrompt(doc, "select", aTitle, aText);
let list = doc.getElementById("prompt-select-list");
for (let i = 0; i < aCount; i++)

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

@ -8,6 +8,7 @@
<!ENTITY enablePlugins.title "Enable Plugins">
<!ENTITY privacy.title "Privacy &amp; Security">
<!ENTITY allowCookies.title "Allow cookies">
<!ENTITY doNotTrack.title "Tell sites not to track me">
<!ENTITY clearPrivateData2.title "Clear private data">
<!ENTITY clearPrivateData.button "Clear">
<!ENTITY rememberPasswords.title "Remember passwords">

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

@ -982,45 +982,10 @@ documenttab[reload="true"] > stack > .documenttab-reload {
}
/* bookmark editor ------------------------------------------------------- */
#bookmark-container {
-moz-box-align: center;
-moz-box-pack: center;
background-color: rgba(0,0,0,.6);
padding: 0;
}
#bookmark-dialog {
margin: @margin_xxxnormal@ !important;
border: @border_width_small@ solid white;
border-radius: @border_radius_normal@;
box-shadow: black 0 @shadow_width_small@ @shadow_width_small@;
}
#bookmark-form {
padding: @padding_xxxnormal@;
}
#bookmark-form-title {
font-size: @font_xnormal@;
padding-top: @padding_large@;
-moz-box-align: center;
-moz-box-pack: center;
}
#bookmark-form-line {
border-bottom: @border_width_small@ solid white;
margin: @margin_small@ 3em 0 3em;
height: @padding_normal@ !important;
}
#bookmark-form .bookmark-controls {
display: none;
}
#bookmark-form-buttons {
background-color: lightgray;
}
/* Identity popup -------------------------------------------------------- */
#identity-popup-container {
padding: @padding_normal@; /* core spacing */
@ -1082,7 +1047,7 @@ documenttab[reload="true"] > stack > .documenttab-reload {
}
/* Page Actions, Prompt, and Context Menu popups --------------------------- */
.prompt-buttons,
.action-buttons,
#context-commands,
#pageactions-container {
background: transparent;
@ -1092,7 +1057,7 @@ documenttab[reload="true"] > stack > .documenttab-reload {
display: inline-block;
}
.prompt-button,
.action-button,
.context-command,
pageaction {
-moz-border-top-colors: white;
@ -1112,24 +1077,24 @@ pageaction {
width: 100%;
}
.prompt-button,
.action-button,
.context-command {
-moz-box-align: center;
}
.prompt-button[disabled="true"],
.action-button[disabled="true"],
.context-command[disabled="true"] {
pointer-events: none;
color: #aaa !important;
}
.prompt-button[selected="true"],
.action-button[selected="true"],
.context-command[selected="true"] {
background: transparent;
}
/* Override button styles */
.prompt-button {
.action-button {
margin: 0;
-moz-border-image: none !important;
border-radius: 0;
@ -1137,27 +1102,27 @@ pageaction {
background: transparent;
}
.prompt-button > .button-box {
.action-button > .button-box {
padding: 0 @padding_small@ @padding_tiny@ @padding_xsmall@ !important;
}
.prompt-button > .button-box > .button-icon {
.action-button > .button-box > .button-icon {
-moz-margin-end: @margin_normal@;
}
@media (min-width: 500px) {
.prompt-button,
.action-button,
pageaction {
width: 50%;
}
.prompt-button:last-child:nth-child(odd),
.action-button:last-child:nth-child(odd),
pageaction.odd-last-child {
width: 100%;
}
}
.prompt-button:not([disabled]):hover:active,
.action-button:not([disabled]):hover:active,
.context-command:not([disabled]):hover:active,
pageaction:not([disabled]):hover:active {
background: url("chrome://browser/skin/images/popup-selected-item-hdpi.png") repeat-x !important;
@ -1177,7 +1142,7 @@ pageaction:not([image]) > hbox >.pageaction-image {
width: 0;
}
.prompt-button,
.action-button,
.context-command,
.pageaction-title {
font-size: @font_normal@ !important;
@ -1203,12 +1168,12 @@ pageaction:not([image]) > hbox >.pageaction-image {
visibility: collapse;
}
#search-engines-list > .prompt-button > .button-box > .button-text {
#search-engines-list > .action-button > .button-box > .button-text {
text-align: start;
-moz-box-flex: 1; /* Needed for the crop attribute to have an effect */
}
#search-engines-list > .prompt-button > .button-box > .button-icon {
#search-engines-list > .action-button > .button-box > .button-icon {
width: 32px;
height: 32px;
}
@ -1404,47 +1369,10 @@ richlistitem.appmenu-downloads-button > image,
}
/* Sync setup ------------------------------------------------------------- */
#syncsetup-container {
background-color: rgba(0,0,0,.6);
padding: 0;
}
#syncsetup-dialog {
margin: @margin_xxxnormal@ !important;
border: @border_width_large@ solid white;
border-radius: @border_radius_normal@;
box-shadow: black 0 @shadow_width_small@ @shadow_width_small@;
}
.syncsetup-scrollbox {
padding: @padding_xxxnormal@;
}
.syncsetup-center {
text-align: center;
}
.syncsetup-title {
font-size: @font_xnormal@;
padding-top: @padding_large@;
-moz-box-align: center;
-moz-box-pack: center;
}
.syncsetup-line {
border-bottom: @border_width_small@ solid white;
margin: @margin_small@ 3em 0 3em;
height: @padding_normal@ !important;
}
.syncsetup-desc {
font-size: @font_snormal@;
}
.syncsetup-buttons {
background-color: lightgray;
}
.syncsetup-code {
color: #000;
background-color: #fff;
@ -1465,10 +1393,6 @@ richlistitem.appmenu-downloads-button > image,
color: #fff;
}
.syncsetup-edit {
margin-bottom: @margin_xnormal@;
}
#syncsetup-customserver {
-moz-margin-start: @margin_xnormal@;
}

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

@ -80,6 +80,8 @@
%define autocompleteresult_padding 0.53mozmm
%define dialog_width 76.2mozmm
%define appmenu_portrait_height 21.17mozmm
%define appmenu_button_height 10.48mozmm
%else
@ -162,6 +164,8 @@
%define autocompleteresult_padding 5px
%define dialog_width 500px
%define appmenu_portrait_height 200px
%define appmenu_button_height 99px
%endif

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

@ -105,14 +105,17 @@ textbox[disabled="true"] {
/* prompt dialogs ---------------------------------------------------------- */
.context-block,
.modal-block {
.modal-block,
.perm-modal-block {
-moz-box-align: center;
-moz-box-pack: center;
background-color: rgba(0,0,0,.6);
}
.context-block {
padding: @touch_normal@;
}
dialog,
.dialog-dark,
.panel-arrowcontent {
background: url("chrome://browser/skin/images/popup-bg-hdpi.png") left bottom repeat-x;
@ -122,29 +125,13 @@ dialog,
padding: @padding_normal@ 0; /* core spacing on top/bottom */
}
dialog > .prompt-header {
padding: @padding_normal@;
font-size: @font_small@ !important;
}
dialog > .prompt-header > .prompt-title {
font-size: @font_normal@ !important;
}
@media (max-width: 499px) {
.context-block,
.modal-block {
.context-block {
padding: @padding_xlarge@;
}
dialog > .prompt-header,
dialog > .prompt-header > .prompt-title {
font-size: @font_small@ !important;
}
}
dialog > .prompt-header > .prompt-message {
margin-top: @margin_normal@;
white-space: pre-wrap;
}
@ -287,6 +274,14 @@ toolbarbutton[open="true"] {
background: none !important;
border: none !important;
-moz-border-image: none !important;
color: white;
-moz-box-align: center;
font-size: @font_small@;
-moz-box-align: center;
}
.prompt-checkbox-label {
text-align: left;
}
.button-checkbox > .button-image-icon {
@ -560,18 +555,65 @@ arrowbox {
border: none;
}
dialog,
.arrowbox-dark .panel-arrowcontent,
.panel-dark {
color: white;
background: rgb(94,97,102);
}
dialog,
.arrowbox-dark .panel-arrowcontent {
border: @border_width_large@ solid white;
border-radius: @border_radius_normal@;
box-shadow: black 0 @shadow_width_small@ @shadow_width_small@;
}
dialog {
margin: @margin_xxxnormal@ !important;
max-width: @dialog_width@;
}
.prompt-message {
text-align: center;
-moz-box-pack: center;
font-size: @font_snormal@;
margin: @padding_normal@;
}
.prompt-title {
text-align: center;
font-size: @font_xnormal@;
-moz-box-align: center;
-moz-box-pack: center;
padding-top: @padding_xnormal@;
}
/* Authentication dialogs do not have a title */
.prompt-title:empty,
.prompt-title:empty + .prompt-line {
display: none;
}
.prompt-line {
border-bottom: @border_width_small@ solid white;
margin: @margin_small@ 3em 0 3em;
height: @padding_normal@ !important;
}
.prompt-buttons {
font-size: @font_snormal@;
background-color: lightgray;
display: inline-block;
text-align: center;
}
.prompt-edit {
margin: @margin_xnormal@;
font-size: @font_normal@;
text-align: start;
}
.panel-arrow[side="top"] {
list-style-image: url("chrome://browser/skin/images/arrowbox-up.png");
margin-bottom: -@margin_normal@;

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

@ -700,11 +700,8 @@ pref("network.http.proxy.keep-alive", true);
// the packet is lost or delayed on the route.
pref("network.http.keep-alive.timeout", 115);
// Limit the absolute number of http connections.
// Note: the socket transport service will clamp the number below 256 if the OS
// cannot allocate that many FDs, and it also always tries to reserve up to 250
// file descriptors for things other than sockets.
pref("network.http.max-connections", 256);
// limit the absolute number of http connections.
pref("network.http.max-connections", 30);
// limit the absolute number of http connections that can be established per
// host. if a http proxy server is enabled, then the "server" is the proxy

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

@ -141,16 +141,13 @@ interface nsIPluginHost : nsISupports
* specify PR_FALSE)
* @result - NS_OK if this operation was successful
*/
%{C++
NS_IMETHOD
GetURL(nsISupports* pluginInst,
const char* url,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE) = 0;
%}
[noscript] void getURL(in nsISupports pluginInt,
in string url,
in string target,
in nsIPluginStreamListener streamListener,
in string altHost,
in string referrer,
in boolean forceJSEnabled);
/**
* Posts to a URL with post data and/or post headers.
@ -183,21 +180,18 @@ interface nsIPluginHost : nsISupports
* post headers
* @result - NS_OK if this operation was successful
*/
%{C++
NS_IMETHOD
PostURL(nsISupports* pluginInst,
const char* url,
PRUint32 postDataLen,
const char* postData,
PRBool isFile = PR_FALSE,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE,
PRUint32 postHeadersLength = 0,
const char* postHeaders = NULL) = 0;
%}
[noscript] void postURL(in nsISupports pluginInst,
in string url,
in PRUint32 postDataLen,
in string postData,
in boolean isFile,
in string target,
in nsIPluginStreamListener streamListener,
in string altHost,
in string referrer,
in boolean forceJSEnabled,
in PRUint32 postHeadersLength,
in string postHeaders);
/**
* Returns the proxy info for a given URL. The caller is required to
@ -284,19 +278,9 @@ interface nsIPluginHost : nsISupports
*/
[noscript] nsIPluginTag getPluginTagForInstance(in nsIPluginInstance aInstance);
%{C++
virtual void AddIdleTimeTarget(nsIPluginInstanceOwner* objectFrame, PRBool isVisible) = 0;
virtual void RemoveIdleTimeTarget(nsIPluginInstanceOwner* objectFrame) = 0;
%}
};
[noscript, notxpcom] void addIdleTimeTarget(in nsIPluginInstanceOwner objectFrame, in boolean isVisible);
[noscript, notxpcom] void removeIdleTimeTarget(in nsIPluginInstanceOwner objectFrame);
/*
* Methods for clearing plugin private data. These should be moved onto
* nsIPluginHost proper post-Gecko 2.0.
*/
[scriptable, uuid(0b0a2fb8-dc2b-4df2-b721-4b7a4008df6c)]
interface nsIPluginHost_MOZILLA_2_0_BRANCH : nsISupports
{
/*
* Flags for use with clearSiteData.
*

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

@ -253,24 +253,13 @@ interface nsIPluginInstance : nsISupports
*/
void notifyPainted();
/**
* This should return a valid gfxASurface pointer, or null if there is nothing to render yet.
* NO LONGER USED. Do not call.
*/
void getSurface(out gfxASurfacePtr aSurface);
/**
* @return true if plugin module supports async rendering
*/
PRBool useAsyncPainting();
};
// XXX kill me after branching
[noscript, uuid(24235105-ac5f-483b-86ec-7c9446ddcb8a)]
interface nsIPluginInstance_MOZILLA_2_0_BRANCH : nsIPluginInstance
{
PRBool isRemoteDrawingCoreAnimation();
/**
* Returns a new Image object which draws an asynchronously-rendered
* plugin. The Image is created using aContainer.
@ -278,6 +267,7 @@ interface nsIPluginInstance_MOZILLA_2_0_BRANCH : nsIPluginInstance
* been received, or if the plugin is not using async rendering.
*/
void getImage(in ImageContainerPtr aContainer, out ImagePtr aImage);
/**
* Returns the size of the Image object that would be created if we called
* getImage.
@ -285,6 +275,7 @@ interface nsIPluginInstance_MOZILLA_2_0_BRANCH : nsIPluginInstance
* been received, or if the plugin is not using async rendering.
*/
void getImageSize(in nsIntSizePtr aSize);
/**
* This is the second leg in the trip to PluginInstanceParent. It
* approximately follows the ReadbackSink API.

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

@ -148,14 +148,7 @@ interface nsIPluginInstanceOwner : nsISupports
%{C++
virtual void SendIdleEvent() = 0;
%}
};
/**
* This interface extends nsIPluginInstanceOwner for the 2.0 branch
*/
[uuid(20504739-4519-45f3-a8f7-fc8afba7ea87)]
interface nsIPluginInstanceOwner_MOZILLA_2_0_BRANCH : nsISupports
{
/**
* Call NPP_SetWindow on the plugin.
*/

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

@ -246,12 +246,6 @@ PluginPRLibrary::AsyncSetWindow(NPP instance, NPWindow* window)
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
PluginPRLibrary::GetSurface(NPP instance, gfxASurface** aSurface)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
PluginPRLibrary::GetImage(NPP instance, ImageContainer* aContainer, Image** aImage)
{

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

@ -140,7 +140,6 @@ public:
virtual nsresult NPP_GetSitesWithData(InfallibleTArray<nsCString>& result);
virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window);
virtual nsresult GetSurface(NPP instance, gfxASurface** aSurface);
virtual nsresult GetImage(NPP instance, ImageContainer* aContainer, Image** aImage);
virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize);
NS_OVERRIDE virtual bool UseAsyncPainting() { return false; }

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

@ -619,13 +619,14 @@ MakeNewNPAPIStreamInternal(NPP npp, const char *relativeURL, const char *target,
switch (type) {
case eNPPStreamTypeInternal_Get:
{
if (NS_FAILED(pluginHost->GetURL(inst, relativeURL, target, listener)))
if (NS_FAILED(pluginHost->GetURL(inst, relativeURL, target, listener,
NULL, NULL, false)))
return NPERR_GENERIC_ERROR;
break;
}
case eNPPStreamTypeInternal_Post:
{
if (NS_FAILED(pluginHost->PostURL(inst, relativeURL, len, buf, file, target, listener)))
if (NS_FAILED(pluginHost->PostURL(inst, relativeURL, len, buf, file, target, listener, NULL, NULL, false, 0, NULL)))
return NPERR_GENERIC_ERROR;
break;
}

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

@ -50,7 +50,6 @@
#include "nsPluginLogging.h"
#include "nsIPrivateBrowsingService.h"
#include "nsContentUtils.h"
#include "nsIContentUtils.h"
#include "nsIDocument.h"
#include "nsIScriptGlobalObject.h"
@ -65,7 +64,7 @@ using namespace mozilla::plugins::parent;
static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID);
static NS_DEFINE_IID(kIPluginStreamListenerIID, NS_IPLUGINSTREAMLISTENER_IID);
NS_IMPL_ISUPPORTS2(nsNPAPIPluginInstance, nsIPluginInstance, nsIPluginInstance_MOZILLA_2_0_BRANCH)
NS_IMPL_ISUPPORTS1(nsNPAPIPluginInstance, nsIPluginInstance)
nsNPAPIPluginInstance::nsNPAPIPluginInstance(nsNPAPIPlugin* plugin)
:
@ -878,19 +877,6 @@ nsNPAPIPluginInstance::AsyncSetWindow(NPWindow* window)
return library->AsyncSetWindow(&mNPP, window);
}
NS_IMETHODIMP
nsNPAPIPluginInstance::GetSurface(gfxASurface** aSurface)
{
if (RUNNING != mRunning)
return NS_OK;
AutoPluginLibraryCall library(this);
if (!library)
return NS_ERROR_FAILURE;
return library->GetSurface(&mNPP, aSurface);
}
NS_IMETHODIMP
nsNPAPIPluginInstance::GetImage(ImageContainer* aContainer, Image** aImage)
{
@ -1375,17 +1361,8 @@ NS_IMETHODIMP
CarbonEventModelFailureEvent::Run()
{
nsString type = NS_LITERAL_STRING("npapi-carbon-event-model-failure");
#ifdef MOZ_ENABLE_LIBXUL
nsContentUtils::DispatchTrustedEvent(mContent->GetDocument(), mContent,
type, PR_TRUE, PR_TRUE);
#else
nsCOMPtr<nsIContentUtils_MOZILLA_2_0_BRANCH> cu =
do_GetService("@mozilla.org/content/contentutils-moz2.0;1");
if (cu) {
cu->DispatchTrustedEvent(mContent->GetDocument(), mContent,
type, PR_TRUE, PR_TRUE);
}
#endif
return NS_OK;
}

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

@ -67,7 +67,7 @@ public:
void (*callback)(NPP npp, uint32_t timerID);
};
class nsNPAPIPluginInstance : public nsIPluginInstance_MOZILLA_2_0_BRANCH
class nsNPAPIPluginInstance : public nsIPluginInstance
{
private:
typedef mozilla::PluginLibrary PluginLibrary;
@ -75,7 +75,6 @@ private:
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPLUGININSTANCE
NS_DECL_NSIPLUGININSTANCE_MOZILLA_2_0_BRANCH
nsNPAPIPlugin* GetPlugin();

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

@ -431,9 +431,8 @@ nsPluginHost::~nsPluginHost()
sInst = nsnull;
}
NS_IMPL_ISUPPORTS5(nsPluginHost,
NS_IMPL_ISUPPORTS4(nsPluginHost,
nsIPluginHost,
nsIPluginHost_MOZILLA_2_0_BRANCH,
nsIObserver,
nsITimerCallback,
nsISupportsWeakReference)
@ -1108,9 +1107,7 @@ nsPluginHost::DoInstantiateEmbeddedPlugin(const char *aMimeType, nsIURI* aURL,
aOwner->CreateWidget();
// If we've got a native window, the let the plugin know about it.
nsCOMPtr<nsIPluginInstanceOwner_MOZILLA_2_0_BRANCH> owner = do_QueryInterface(aOwner);
if (owner)
owner->SetWindow();
aOwner->SetWindow();
// create an initial stream with data
// don't make the stream if it's a java applet or we don't have SRC or DATA attribute
@ -1185,15 +1182,12 @@ NS_IMETHODIMP nsPluginHost::InstantiateFullPagePlugin(const char *aMimeType,
aOwner->CreateWidget();
// If we've got a native window, the let the plugin know about it.
nsCOMPtr<nsIPluginInstanceOwner_MOZILLA_2_0_BRANCH> owner = do_QueryInterface(aOwner);
if (owner)
owner->SetWindow();
aOwner->SetWindow();
rv = NewFullPagePluginStream(aURI, instance, aStreamListener);
// If we've got a native window, the let the plugin know about it.
if (owner)
owner->SetWindow();
aOwner->SetWindow();
}
}
@ -1248,9 +1242,7 @@ nsresult nsPluginHost::FindStoppedPluginForURL(nsIURI* aURL,
aOwner->CreateWidget();
// If we've got a native window, the let the plugin know about it.
nsCOMPtr<nsIPluginInstanceOwner_MOZILLA_2_0_BRANCH> owner = do_QueryInterface(aOwner);
if (owner)
owner->SetWindow();
aOwner->SetWindow();
return NS_OK;
}

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

@ -90,7 +90,6 @@ public:
};
class nsPluginHost : public nsIPluginHost,
public nsIPluginHost_MOZILLA_2_0_BRANCH,
public nsIObserver,
public nsITimerCallback,
public nsSupportsWeakReference
@ -105,33 +104,9 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPLUGINHOST
NS_DECL_NSIPLUGINHOST_MOZILLA_2_0_BRANCH
NS_DECL_NSIOBSERVER
NS_DECL_NSITIMERCALLBACK
NS_IMETHOD
GetURL(nsISupports* pluginInst,
const char* url,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE);
NS_IMETHOD
PostURL(nsISupports* pluginInst,
const char* url,
PRUint32 postDataLen,
const char* postData,
PRBool isFile = PR_FALSE,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE,
PRUint32 postHeadersLength = 0,
const char* postHeaders = NULL);
nsresult
NewPluginURLStream(const nsString& aURL,
nsNPAPIPluginInstance *aInstance,
@ -173,9 +148,6 @@ public:
static nsresult PostPluginUnloadEvent(PRLibrary* aLibrary);
void AddIdleTimeTarget(nsIPluginInstanceOwner* objectFrame, PRBool isVisible);
void RemoveIdleTimeTarget(nsIPluginInstanceOwner* objectFrame);
void PluginCrashed(nsNPAPIPlugin* plugin,
const nsAString& pluginDumpID,
const nsAString& browserDumpID);

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

@ -672,9 +672,7 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request,
mPluginInstance->Start();
mOwner->CreateWidget();
// If we've got a native window, the let the plugin know about it.
nsCOMPtr<nsIPluginInstanceOwner_MOZILLA_2_0_BRANCH> owner = do_QueryInterface(mOwner);
if (owner)
owner->SetWindow();
mOwner->SetWindow();
}
}
}
@ -876,9 +874,7 @@ nsresult nsPluginStreamListenerPeer::ServeStreamAsFile(nsIRequest *request,
window->window = widget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
}
#endif
nsCOMPtr<nsIPluginInstanceOwner_MOZILLA_2_0_BRANCH> owner = do_QueryInterface(mOwner);
if (owner)
owner->SetWindow();
mOwner->SetWindow();
}
mSeekable = PR_FALSE;

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

@ -12,7 +12,7 @@
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
SimpleTest.waitForExplicitFinish();
const pluginHostIface = Components.interfaces.nsIPluginHost_MOZILLA_2_0_BRANCH;
const pluginHostIface = Components.interfaces.nsIPluginHost;
var pluginHost = Components.classes["@mozilla.org/plugin/host;1"].
getService(pluginHostIface);
const FLAG_CLEAR_ALL = pluginHostIface.FLAG_CLEAR_ALL;

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

@ -64,7 +64,6 @@ nsSocketTransportService *gSocketTransportService = nsnull;
PRThread *gSocketThread = nsnull;
#define SEND_BUFFER_PREF "network.tcp.sendbuffer"
#define SOCKET_LIMIT_TARGET 550
//-----------------------------------------------------------------------------
// ctor/dtor (called on the main/UI thread by the service manager)
@ -76,8 +75,6 @@ nsSocketTransportService::nsSocketTransportService()
, mLock("nsSocketTransportService::mLock")
, mInitialized(PR_FALSE)
, mShuttingDown(PR_FALSE)
, mActiveListSize(50)
, mIdleListSize(50)
, mActiveCount(0)
, mIdleCount(0)
, mSendBufferSize(0)
@ -88,14 +85,6 @@ nsSocketTransportService::nsSocketTransportService()
NS_ASSERTION(NS_IsMainThread(), "wrong thread");
DetermineMaxCount(); /* init mMaxCount */
mActiveList = (SocketContext *)
moz_xmalloc(sizeof(SocketContext) * mActiveListSize);
mIdleList = (SocketContext *)
moz_xmalloc(sizeof(SocketContext) * mIdleListSize);
mPollList = (PRPollDesc *)
moz_xmalloc(sizeof(PRPollDesc) * (mActiveListSize + 1));
NS_ASSERTION(!gSocketTransportService, "must not instantiate twice");
gSocketTransportService = this;
}
@ -108,9 +97,6 @@ nsSocketTransportService::~nsSocketTransportService()
if (mThreadEvent)
PR_DestroyPollableEvent(mThreadEvent);
moz_free(mActiveList);
moz_free(mIdleList);
moz_free(mPollList);
gSocketTransportService = nsnull;
}
@ -191,11 +177,9 @@ nsSocketTransportService::AttachSocket(PRFileDesc *fd, nsASocketHandler *handler
}
nsresult
nsSocketTransportService::DetachSocket(SocketContext *listHead, SocketContext *sock)
nsSocketTransportService::DetachSocket(SocketContext *sock)
{
SOCKET_LOG(("nsSocketTransportService::DetachSocket [handler=%x]\n", sock->mHandler));
NS_ABORT_IF_FALSE((listHead == mActiveList) || (listHead == mIdleList),
"DetachSocket invalid head");
// inform the handler that this socket is going away
sock->mHandler->OnSocketDetached(sock->mFD);
@ -204,7 +188,9 @@ nsSocketTransportService::DetachSocket(SocketContext *listHead, SocketContext *s
sock->mFD = nsnull;
NS_RELEASE(sock->mHandler);
if (listHead == mActiveList)
// find out what list this is on.
PRUint32 index = sock - mActiveList;
if (index < NS_SOCKET_MAX_COUNT)
RemoveFromPollList(sock);
else
RemoveFromIdleList(sock);
@ -225,18 +211,13 @@ nsSocketTransportService::DetachSocket(SocketContext *listHead, SocketContext *s
nsresult
nsSocketTransportService::AddToPollList(SocketContext *sock)
{
NS_ABORT_IF_FALSE(!(((PRUint32)(sock - mActiveList)) < mActiveListSize),
"AddToPollList Socket Already Active");
SOCKET_LOG(("nsSocketTransportService::AddToPollList [handler=%x]\n", sock->mHandler));
if (mActiveCount == mActiveListSize) {
SOCKET_LOG((" Active List size of %d met\n", mActiveCount));
if (!GrowActiveList()) {
NS_ERROR("too many active sockets");
return NS_ERROR_OUT_OF_MEMORY;
}
if (mActiveCount == NS_SOCKET_MAX_COUNT) {
NS_ERROR("too many active sockets");
return NS_ERROR_UNEXPECTED;
}
mActiveList[mActiveCount] = *sock;
mActiveCount++;
@ -254,7 +235,7 @@ nsSocketTransportService::RemoveFromPollList(SocketContext *sock)
SOCKET_LOG(("nsSocketTransportService::RemoveFromPollList [handler=%x]\n", sock->mHandler));
PRUint32 index = sock - mActiveList;
NS_ABORT_IF_FALSE(index < mActiveListSize, "invalid index");
NS_ASSERTION(index < NS_SOCKET_MAX_COUNT, "invalid index");
SOCKET_LOG((" index=%u mActiveCount=%u\n", index, mActiveCount));
@ -270,16 +251,11 @@ nsSocketTransportService::RemoveFromPollList(SocketContext *sock)
nsresult
nsSocketTransportService::AddToIdleList(SocketContext *sock)
{
NS_ABORT_IF_FALSE(!(((PRUint32)(sock - mIdleList)) < mIdleListSize),
"AddToIdlelList Socket Already Idle");
SOCKET_LOG(("nsSocketTransportService::AddToIdleList [handler=%x]\n", sock->mHandler));
if (mIdleCount == mIdleListSize) {
SOCKET_LOG((" Idle List size of %d met\n", mIdleCount));
if (!GrowIdleList()) {
NS_ERROR("too many idle sockets");
return NS_ERROR_OUT_OF_MEMORY;
}
if (mIdleCount == NS_SOCKET_MAX_COUNT) {
NS_ERROR("too many idle sockets");
return NS_ERROR_UNEXPECTED;
}
mIdleList[mIdleCount] = *sock;
@ -294,8 +270,8 @@ nsSocketTransportService::RemoveFromIdleList(SocketContext *sock)
{
SOCKET_LOG(("nsSocketTransportService::RemoveFromIdleList [handler=%x]\n", sock->mHandler));
PRUint32 index = sock - mIdleList;
NS_ASSERTION(index < mIdleListSize, "invalid index in idle list");
PRUint32 index = sock - &mIdleList[0];
NS_ASSERTION(index < NS_SOCKET_MAX_COUNT, "invalid index");
if (index != mIdleCount-1)
mIdleList[index] = mIdleList[mIdleCount-1];
@ -309,7 +285,7 @@ nsSocketTransportService::MoveToIdleList(SocketContext *sock)
{
nsresult rv = AddToIdleList(sock);
if (NS_FAILED(rv))
DetachSocket(mActiveList, sock);
DetachSocket(sock);
else
RemoveFromPollList(sock);
}
@ -319,43 +295,11 @@ nsSocketTransportService::MoveToPollList(SocketContext *sock)
{
nsresult rv = AddToPollList(sock);
if (NS_FAILED(rv))
DetachSocket(mIdleList, sock);
DetachSocket(sock);
else
RemoveFromIdleList(sock);
}
PRBool
nsSocketTransportService::GrowActiveList()
{
PRInt32 toAdd = MaxCount() - mActiveListSize;
if (toAdd > 100)
toAdd = 100;
if (toAdd < 1)
return PR_FALSE;
mActiveListSize += toAdd;
mActiveList = (SocketContext *)
moz_xrealloc(mActiveList, sizeof(SocketContext) * mActiveListSize);
mPollList = (PRPollDesc *)
moz_xrealloc(mPollList, sizeof(PRPollDesc) * (mActiveListSize + 1));
return PR_TRUE;
}
PRBool
nsSocketTransportService::GrowIdleList()
{
PRInt32 toAdd = MaxCount() - mIdleListSize;
if (toAdd > 100)
toAdd = 100;
if (toAdd < 1)
return PR_FALSE;
mIdleListSize += toAdd;
mIdleList = (SocketContext *)
moz_xrealloc(mIdleList, sizeof(SocketContext) * mIdleListSize);
return PR_TRUE;
}
PRIntervalTime
nsSocketTransportService::PollTimeout()
{
@ -650,9 +594,9 @@ nsSocketTransportService::Run()
// detach any sockets
PRInt32 i;
for (i=mActiveCount-1; i>=0; --i)
DetachSocket(mActiveList, &mActiveList[i]);
DetachSocket(&mActiveList[i]);
for (i=mIdleCount-1; i>=0; --i)
DetachSocket(mIdleList, &mIdleList[i]);
DetachSocket(&mIdleList[i]);
// Final pass over the event queue. This makes sure that events posted by
// socket detach handlers get processed.
@ -691,7 +635,7 @@ nsSocketTransportService::DoPollIteration(PRBool wait)
mActiveList[i].mHandler->mPollFlags));
//---
if (NS_FAILED(mActiveList[i].mHandler->mCondition))
DetachSocket(mActiveList, &mActiveList[i]);
DetachSocket(&mActiveList[i]);
else {
PRUint16 in_flags = mActiveList[i].mHandler->mPollFlags;
if (in_flags == 0)
@ -711,7 +655,7 @@ nsSocketTransportService::DoPollIteration(PRBool wait)
mIdleList[i].mHandler->mPollFlags));
//---
if (NS_FAILED(mIdleList[i].mHandler->mCondition))
DetachSocket(mIdleList, &mIdleList[i]);
DetachSocket(&mIdleList[i]);
else if (mIdleList[i].mHandler->mPollFlags != 0)
MoveToPollList(&mIdleList[i]);
}
@ -758,7 +702,7 @@ nsSocketTransportService::DoPollIteration(PRBool wait)
//
for (i=mActiveCount-1; i>=0; --i) {
if (NS_FAILED(mActiveList[i].mHandler->mCondition))
DetachSocket(mActiveList, &mActiveList[i]);
DetachSocket(&mActiveList[i]);
}
if (n != 0 && mPollList[0].out_flags == PR_POLL_READ) {
@ -827,67 +771,3 @@ nsSocketTransportService::GetSendBufferSize(PRInt32 *value)
}
/// ugly OS specific includes are placed at the bottom of the src for clarity
#if defined(XP_WIN)
#include <windows.h>
#elif defined(XP_UNIX) && !defined(AIX) && !defined(NEXTSTEP) && !defined(QNX)
#include <sys/resource.h>
#endif
void
nsSocketTransportService::DetermineMaxCount()
{
mMaxCount = 50; /* historic default */
#if defined(XP_UNIX) && !defined(AIX) && !defined(NEXTSTEP) && !defined(QNX)
// on unix and os x network sockets and file
// descriptors are the same. OS X comes defaulted at 256,
// most linux at 1000. We can reliably use [sg]rlimit to
// query that and raise it. We will try to raise it 250 past
// our target number of SOCKET_LIMIT_TARGET so that some descriptors
// are still available for other things.
struct rlimit rlimitData;
if (getrlimit(RLIMIT_NOFILE, &rlimitData) == -1)
return;
if (rlimitData.rlim_cur >= SOCKET_LIMIT_TARGET + 250) {
mMaxCount = SOCKET_LIMIT_TARGET;
return;
}
PRInt32 maxallowed = rlimitData.rlim_max;
if (maxallowed == -1) /* no limit */
maxallowed = SOCKET_LIMIT_TARGET + 250;
else if (maxallowed < 50 + 250)
return;
else if (maxallowed > SOCKET_LIMIT_TARGET + 250)
maxallowed = SOCKET_LIMIT_TARGET + 250;
rlimitData.rlim_cur = maxallowed;
setrlimit(RLIMIT_NOFILE, &rlimitData);
if (getrlimit(RLIMIT_NOFILE, &rlimitData) == -1)
return;
if (rlimitData.rlim_cur > 50 + 250)
mMaxCount = rlimitData.rlim_cur - 250;
return;
#elif defined(XP_WIN) && !defined(WIN_CE)
// win 95, 98, etc had a limit of 100 - so we will just
// use the historical 50 in every case older than XP (0x501).
// >= XP is confirmed to have at least 1000
OSVERSIONINFO osInfo = { sizeof(OSVERSIONINFO) };
if (GetVersionEx(&osInfo)) {
PRInt32 version =
(osInfo.dwMajorVersion & 0xff) << 8 |
(osInfo.dwMinorVersion & 0xff);
if (version >= 0x501) { /* xp or later */
mMaxCount = SOCKET_LIMIT_TARGET;
}
}
return;
#else
// other platforms are harder to test - so leave at safe legacy value
#endif
}

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

@ -65,6 +65,7 @@ extern PRLogModuleInfo *gSocketTransportLog;
//-----------------------------------------------------------------------------
#define NS_SOCKET_MAX_COUNT 50
#define NS_SOCKET_POLL_TIMEOUT PR_INTERVAL_NO_TIMEOUT
//-----------------------------------------------------------------------------
@ -96,11 +97,9 @@ public:
// call CanAttachSocket and check the result before creating a socket.
//
PRBool CanAttachSocket() {
return mActiveCount + mIdleCount < mMaxCount;
return mActiveCount + mIdleCount < NS_SOCKET_MAX_COUNT;
}
PRUint32 MaxCount() { return mMaxCount; }
protected:
virtual ~nsSocketTransportService();
@ -154,27 +153,20 @@ private:
PRUint16 mElapsedTime; // time elapsed w/o activity
};
SocketContext *mActiveList; /* mListSize entries */
SocketContext *mIdleList; /* mListSize entries */
SocketContext mActiveList [ NS_SOCKET_MAX_COUNT ];
SocketContext mIdleList [ NS_SOCKET_MAX_COUNT ];
PRUint32 mActiveListSize;
PRUint32 mIdleListSize;
PRUint32 mActiveCount;
PRUint32 mIdleCount;
PRUint32 mMaxCount;
nsresult DetachSocket(SocketContext *, SocketContext *);
nsresult DetachSocket(SocketContext *);
nsresult AddToIdleList(SocketContext *);
nsresult AddToPollList(SocketContext *);
void RemoveFromIdleList(SocketContext *);
void RemoveFromPollList(SocketContext *);
void MoveToIdleList(SocketContext *sock);
void MoveToPollList(SocketContext *sock);
PRBool GrowActiveList();
PRBool GrowIdleList();
void DetermineMaxCount();
//-------------------------------------------------------------------------
// poll list (socket thread only)
//
@ -182,7 +174,7 @@ private:
// event cannot be created).
//-------------------------------------------------------------------------
PRPollDesc *mPollList; /* mListSize + 1 entries */
PRPollDesc mPollList[ NS_SOCKET_MAX_COUNT + 1 ];
PRIntervalTime PollTimeout(); // computes ideal poll timeout
nsresult DoPollIteration(PRBool wait);

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

@ -1550,7 +1550,11 @@ nsCookieService::SetCookieStringInternal(nsIURI *aHostURI,
// process each cookie in the header
nsDependentCString cookieHeader(aCookieHeader);
while (SetCookieInternal(aHostURI, baseDomain, requireHostMatch,
cookieStatus, cookieHeader, serverTime, aFromHttp));
cookieStatus, cookieHeader, serverTime, aFromHttp)) {
// document.cookie can only set one cookie at a time
if (!aFromHttp)
break;
}
}
// notify observers that a cookie was rejected due to the users' prefs.

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

@ -0,0 +1,25 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
Components.utils.import("resource://gre/modules/NetUtil.jsm");
function run_test() {
let cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
let uri = NetUtil.newURI("http://example.org/");
let set = "foo=bar\nbaz=foo";
let expected = "foo=bar; baz=foo";
cs.setCookieStringFromHttp(uri, null, null, set, null, null);
let actual = cs.getCookieStringFromHttp(uri, null, null);
do_check_eq(actual, expected);
uri = NetUtil.newURI("http://example.com/");
cs.setCookieString(uri, null, set, null);
expected = "foo=bar";
actual = cs.getCookieString(uri, null, null);
do_check_eq(actual, expected);
}

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

@ -844,8 +844,7 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
if (PREF_CHANGED(HTTP_PREF("max-connections"))) {
rv = prefs->GetIntPref(HTTP_PREF("max-connections"), &val);
if (NS_SUCCEEDED(rv)) {
mMaxConnections = (PRUint16) NS_CLAMP(
val, 1, gSocketTransportService->MaxCount());
mMaxConnections = (PRUint16) NS_CLAMP(val, 1, NS_SOCKET_MAX_COUNT);
if (mConnMgr)
mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_CONNECTIONS,
mMaxConnections);

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

@ -36,6 +36,17 @@
*
* ***** END LICENSE BLOCK ***** */
/**
* To add additional errors to Storage, please append entries to the bottom of
* the list in the following format:
* '#define NS_ERROR_STORAGE_YOUR_ERR \
* NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_STORAGE, n)'
* where n is the next unique positive integer. You must also add an entry to
* js/src/xpconnect/src/xpc.msg under the code block beginning with the comment
* 'storage related codes (from mozStorage.h)', in the following format:
* 'XPC_MSG_DEF(NS_ERROR_STORAGE_YOUR_ERR, "brief description of your error")'
*/
#ifndef MOZSTORAGE_H
#define MOZSTORAGE_H

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

@ -194,13 +194,15 @@ const STATUS = {
// Represents actions on which a query will run.
const ACTION = {
TIMED: 1 << 0,
CLEAR_HISTORY: 1 << 1,
SHUTDOWN: 1 << 2,
CLEAN_SHUTDOWN: 1 << 3,
IDLE: 1 << 4,
DEBUG: 1 << 5,
TIMED_OVERLIMIT: 1 << 6,
TIMED: 1 << 0, // happens every this._interval
CLEAR_HISTORY: 1 << 1, // happens when history is cleared
SHUTDOWN: 1 << 2, // happens at shutdown when the db has a DIRTY state
CLEAN_SHUTDOWN: 1 << 3, // happens at shutdown when the db has a CLEAN or
// UNKNOWN state
IDLE: 1 << 4, // happens once on idle
DEBUG: 1 << 5, // happens whenever TOPIC_DEBUG_START_EXPIRATION is dispatched
TIMED_OVERLIMIT: 1 << 6, // just like TIMED, but also when we have too much
// history
};
// The queries we use to expire.
@ -400,7 +402,31 @@ const EXPIRATION_QUERIES = {
sql: "DELETE FROM expiration_notify",
actions: ACTION.TIMED | ACTION.TIMED_OVERLIMIT | ACTION.SHUTDOWN |
ACTION.IDLE | ACTION.DEBUG
}
},
// The following queries are used to adjust the sqlite_stat1 table to help the
// query planner create better queries. These should always be run LAST, and
// are therefore at the end of the object.
QUERY_ANALYZE_MOZ_PLACES: {
sql: "ANALYZE moz_places",
actions: ACTION.TIMED_OVERLIMIT | ACTION.CLEAR_HISTORY | ACTION.IDLE |
ACTION.DEBUG
},
QUERY_ANALYZE_MOZ_BOOKMARKS: {
sql: "ANALYZE moz_bookmarks",
actions: ACTION.IDLE | ACTION.DEBUG
},
QUERY_ANALYZE_MOZ_HISTORYVISITS: {
sql: "ANALYZE moz_historyvisits",
actions: ACTION.TIMED_OVERLIMIT | ACTION.CLEAR_HISTORY | ACTION.IDLE |
ACTION.DEBUG
},
QUERY_ANALYZE_MOZ_INPUTHISTORY: {
sql: "ANALYZE moz_inputhistory",
actions: ACTION.TIMED | ACTION.TIMED_OVERLIMIT | ACTION.CLEAR_HISTORY |
ACTION.IDLE | ACTION.DEBUG
},
};
////////////////////////////////////////////////////////////////////////////////
@ -735,8 +761,11 @@ nsPlacesExpiration.prototype = {
/**
* Execute async statements to expire with the specified queries.
*
* @param aQueryNames
* The names of the queries to use for this expiration step.
* @param aAction
* The ACTION we are expiring for. See the ACTION const for values.
* @param aLimit
* Whether to use small, large or no limits when expiring. See the
* LIMIT const for values.
*/
_expireWithActionAndLimit:
function PEX__expireWithActionAndLimit(aAction, aLimit)
@ -865,9 +894,9 @@ nsPlacesExpiration.prototype = {
},
/**
* Creates a new timer based on this._syncInterval.
* Creates a new timer based on this._interval.
*
* @return a REPEATING_SLACK nsITimer that runs every this._syncInterval.
* @return a REPEATING_SLACK nsITimer that runs every this._interval.
*/
_newTimer: function PEX__newTimer()
{

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

@ -0,0 +1,170 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
////////////////////////////////////////////////////////////////////////////////
//// Constants
const TOPIC_AUTOCOMPLETE_FEEDBACK_INCOMING = "autocomplete-will-enter-text";
////////////////////////////////////////////////////////////////////////////////
//// Helpers
/**
* Ensures that we have no data in the tables created by ANALYZE.
*/
function clearAnalyzeData()
{
let db = DBConn();
if (!db.tableExists("sqlite_stat1")) {
return;
}
db.executeSimpleSQL("DELETE FROM sqlite_stat1");
}
/**
* Checks that we ran ANALYZE on the specified table.
*
* @param aTableName
* The table to check if ANALYZE was ran.
* @param aRan
* True if it was expected to run, false otherwise
*/
function do_check_analyze_ran(aTableName, aRan)
{
let db = DBConn();
do_check_true(db.tableExists("sqlite_stat1"));
let stmt = db.createStatement("SELECT idx FROM sqlite_stat1 WHERE tbl = :table");
stmt.params.table = aTableName;
try {
if (aRan) {
do_check_true(stmt.executeStep());
do_check_neq(stmt.row.idx, null);
}
else {
do_check_false(stmt.executeStep());
}
}
finally {
stmt.finalize();
}
}
////////////////////////////////////////////////////////////////////////////////
//// Tests
function test_timed()
{
clearAnalyzeData();
let observer = function(aSubject, aTopic, aData) {
Services.obs.removeObserver(observer,
PlacesUtils.TOPIC_EXPIRATION_FINISHED);
setInterval(3600);
do_check_analyze_ran("moz_places", false);
do_check_analyze_ran("moz_bookmarks", false);
do_check_analyze_ran("moz_historyvisits", false);
do_check_analyze_ran("moz_inputhistory", true);
run_next_test();
};
Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED,
false);
// Set a low interval and wait for the timed expiration to start.
setInterval(3);
}
function test_debug()
{
clearAnalyzeData();
let observer = function(aSubject, aTopic, aData) {
Services.obs.removeObserver(observer,
PlacesUtils.TOPIC_EXPIRATION_FINISHED);
do_check_analyze_ran("moz_places", true);
do_check_analyze_ran("moz_bookmarks", true);
do_check_analyze_ran("moz_historyvisits", true);
do_check_analyze_ran("moz_inputhistory", true);
run_next_test();
};
Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED,
false);
force_expiration_step(1);
}
function test_clear_history()
{
clearAnalyzeData();
let observer = function(aSubject, aTopic, aData) {
Services.obs.removeObserver(observer,
PlacesUtils.TOPIC_EXPIRATION_FINISHED);
do_check_analyze_ran("moz_places", true);
do_check_analyze_ran("moz_bookmarks", false);
do_check_analyze_ran("moz_historyvisits", true);
do_check_analyze_ran("moz_inputhistory", true);
run_next_test();
};
Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED,
false);
let listener = Cc["@mozilla.org/places/expiration;1"].
getService(Ci.nsINavHistoryObserver);
listener.onClearHistory();
}
function test_shutdown()
{
clearAnalyzeData();
let observer = function(aSubject, aTopic, aData) {
Services.obs.removeObserver(observer,
PlacesUtils.TOPIC_EXPIRATION_FINISHED);
do_check_analyze_ran("moz_places", false);
do_check_analyze_ran("moz_bookmarks", false);
do_check_analyze_ran("moz_historyvisits", false);
do_check_analyze_ran("moz_inputhistory", false);
run_next_test();
};
Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED,
false);
shutdownExpiration();
}
////////////////////////////////////////////////////////////////////////////////
//// Test Harness
let gTests = [
test_timed,
test_debug,
test_clear_history,
test_shutdown,
];
function run_test()
{
const TEST_URI = NetUtil.newURI("http://mozilla.org/");
const TEST_TITLE = "This is a test";
let bs = PlacesUtils.bookmarks;
bs.insertBookmark(PlacesUtils.unfiledBookmarksFolderId, TEST_URI,
bs.DEFAULT_INDEX, TEST_TITLE);
let hs = PlacesUtils.history;
hs.addVisit(TEST_URI, Date.now() * 1000, null, hs.TRANSITION_TYPED, false, 0);
let thing = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompleteInput,
Ci.nsIAutoCompletePopup,
Ci.nsIAutoCompleteController]),
get popup() { return thing; },
get controller() { return thing; },
popupOpen: true,
selectedIndex: 0,
getValueAt: function() { return TEST_URI.spec; },
searchString: TEST_TITLE,
};
Services.obs.notifyObservers(thing, TOPIC_AUTOCOMPLETE_FEEDBACK_INCOMING,
null);
run_next_test();
}

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

@ -45,6 +45,8 @@
#include "AndroidBridge.h"
#include "nsAppShell.h"
#include "nsOSHelperAppService.h"
#include "nsIPrefService.h"
#include "nsWindow.h"
#ifdef DEBUG
#define ALOG_BRIDGE(args...) ALOG(args)
@ -52,6 +54,9 @@
#define ALOG_BRIDGE(args...)
#endif
#define IME_FULLSCREEN_PREF "widget.ime.android.landscape_fullscreen"
#define IME_FULLSCREEN_THRESHOLD_PREF "widget.ime.android.fullscreen_threshold"
using namespace mozilla;
static PRUintn sJavaEnvThreadIndex = 0;
@ -103,7 +108,7 @@ AndroidBridge::Init(JNIEnv *jEnv,
mGeckoAppShellClass = (jclass) jEnv->NewGlobalRef(jGeckoAppShellClass);
jNotifyIME = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIME", "(II)V");
jNotifyIMEEnabled = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEEnabled", "(ILjava/lang/String;Ljava/lang/String;)V");
jNotifyIMEEnabled = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEEnabled", "(ILjava/lang/String;Ljava/lang/String;Z)V");
jNotifyIMEChange = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEChange", "(Ljava/lang/String;III)V");
jAcknowledgeEventSync = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "acknowledgeEventSync", "()V");
@ -237,11 +242,35 @@ AndroidBridge::NotifyIMEEnabled(int aState, const nsAString& aTypeHint,
nsPromiseFlatString typeHint(aTypeHint);
nsPromiseFlatString actionHint(aActionHint);
jvalue args[3];
jvalue args[4];
AutoLocalJNIFrame jniFrame(1);
args[0].i = aState;
args[1].l = JNI()->NewString(typeHint.get(), typeHint.Length());
args[2].l = JNI()->NewString(actionHint.get(), actionHint.Length());
args[3].z = false;
nsCOMPtr<nsIPrefBranch> prefs =
do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
PRInt32 landscapeFS;
nsresult rv = prefs->GetIntPref(IME_FULLSCREEN_PREF, &landscapeFS);
if (NS_SUCCEEDED(rv)) {
if (landscapeFS == 1) {
args[3].z = true;
} else if (landscapeFS == -1){
rv = prefs->GetIntPref(IME_FULLSCREEN_THRESHOLD_PREF,
&landscapeFS);
if (NS_SUCCEEDED(rv)) {
// the threshold is hundreths of inches, so convert the
// threshold to pixels and multiply the height by 100
if (nsWindow::GetAndroidScreenBounds().height * 100 <
landscapeFS * Bridge()->GetDPI())
args[3].z = true;
}
}
}
}
JNI()->CallStaticVoidMethodA(sBridge->mGeckoAppShellClass,
sBridge->jNotifyIMEEnabled, args);
}

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

@ -2906,7 +2906,8 @@ nsWindow::MakeFullScreen(PRBool aFullScreen)
UpdateNonClientMargins();
PRBool visible = mIsVisible;
Show(PR_FALSE);
if (mOldSizeMode == nsSizeMode_Normal)
Show(PR_FALSE);
// Will call hide chrome, reposition window. Note this will
// also cache dimensions for restoration, so it should only