diff --git a/browser/base/content/sanitize.js b/browser/base/content/sanitize.js index ca53832913f..0e8f3b73c2f 100644 --- a/browser/base/content/sanitize.js +++ b/browser/base/content/sanitize.js @@ -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); diff --git a/browser/base/content/test/browser_clearplugindata.js b/browser/base/content/test/browser_clearplugindata.js index 66deab5501a..a5a246d4848 100644 --- a/browser/base/content/test/browser_clearplugindata.js +++ b/browser/base/content/test/browser_clearplugindata.js @@ -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); diff --git a/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js b/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js index c16fef92a93..42fdf81d190 100644 --- a/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js +++ b/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js @@ -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); diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_clearplugindata.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_clearplugindata.js index 2cb2a85d8a8..46a5561cbf5 100644 --- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_clearplugindata.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_clearplugindata.js @@ -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); diff --git a/content/base/public/nsIContentUtils.h b/content/base/public/nsIContentUtils.h index 0fb8c865313..df0552bd909 100644 --- a/content/base/public/nsIContentUtils.h +++ b/content/base/public/nsIContentUtils.h @@ -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__ */ diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 796481b2eca..9314e1db64e 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -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 diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index f7c5811e33f..bdb4ccb06ec 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -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; } } diff --git a/content/base/test/test_CrossSiteXHR.html b/content/base/test/test_CrossSiteXHR.html index fd8ea554819..df5abb8c325 100644 --- a/content/base/test/test_CrossSiteXHR.html +++ b/content/base/test/test_CrossSiteXHR.html @@ -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"); diff --git a/content/base/test/test_bug482935.html b/content/base/test/test_bug482935.html index 3bf3d1fdad4..4c678ff3adf 100644 --- a/content/base/test/test_bug482935.html +++ b/content/base/test/test_bug482935.html @@ -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); diff --git a/content/html/content/public/nsIRadioVisitor.h b/content/html/content/public/nsIRadioVisitor.h index be212a5d1ae..07216730f8d 100644 --- a/content/html/content/public/nsIRadioVisitor.h +++ b/content/html/content/public/nsIRadioVisitor.h @@ -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___ diff --git a/content/html/content/src/Makefile.in b/content/html/content/src/Makefile.in index e4a3d3e19c4..e72e5b27eea 100644 --- a/content/html/content/src/Makefile.in +++ b/content/html/content/src/Makefile.in @@ -110,6 +110,7 @@ CPPSRCS = \ nsHTMLUnknownElement.cpp \ nsDOMValidityState.cpp \ nsIConstraintValidation.cpp \ + nsRadioVisitor.cpp \ $(NULL) ifdef MOZ_MEDIA diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index 4adc9cfde2a..357c12b2ed7 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -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 formControl(do_QueryInterface(item)); if (formControl) { if (formControl->GetType() == NS_FORM_INPUT_RADIO) { - aVisitor->Visit(formControl, &stopIterating); + aVisitor->Visit(formControl); } } else { nsCOMPtr nodeList(do_QueryInterface(item)); @@ -2107,8 +2104,7 @@ nsHTMLFormElement::WalkRadioGroup(const nsAString& aName, nsCOMPtr formControl(do_QueryInterface(node)); if (formControl) { if (formControl->GetType() == NS_FORM_INPUT_RADIO) { - aVisitor->Visit(formControl, &stopIterating); - if (stopIterating) { + if (!aVisitor->Visit(formControl)) { break; } } diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index 8a3b8c0235d..ae34a8572f8 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -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 visitor; - NS_GetRadioSetCheckedChangedVisitor(aCheckedChanged, - getter_AddRefs(visitor)); + nsCOMPtr 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 visitor; - nsresult rv = NS_GetRadioGetCheckedChangedVisitor(&checkedChanged, this, - getter_AddRefs(visitor)); - if (NS_FAILED(rv)) { return; } - + bool checkedChanged = GET_BOOLBIT(mBitField, BF_CHECKED_CHANGED); + + nsCOMPtr 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 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 radio = - static_cast(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 radio = - static_cast(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(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 { diff --git a/content/html/content/src/nsHTMLInputElement.h b/content/html/content/src/nsHTMLInputElement.h index b200f141d02..dde9ae485d1 100644 --- a/content/html/content/src/nsHTMLInputElement.h +++ b/content/html/content/src/nsHTMLInputElement.h @@ -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, diff --git a/content/html/content/src/nsRadioVisitor.cpp b/content/html/content/src/nsRadioVisitor.cpp new file mode 100644 index 00000000000..d931fdd13bf --- /dev/null +++ b/content/html/content/src/nsRadioVisitor.cpp @@ -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 (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 radio = + static_cast(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 radio = + static_cast(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(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; +} + diff --git a/content/html/content/src/nsRadioVisitor.h b/content/html/content/src/nsRadioVisitor.h new file mode 100644 index 00000000000..9d5fcf54bf3 --- /dev/null +++ b/content/html/content/src/nsRadioVisitor.h @@ -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 (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__ + diff --git a/content/html/content/src/nsTextEditorState.cpp b/content/html/content/src/nsTextEditorState.cpp index 45448458b78..a0be3a92fda 100644 --- a/content/html/content/src/nsTextEditorState.cpp +++ b/content/html/content/src/nsTextEditorState.cpp @@ -897,10 +897,8 @@ nsTextInputListener::EditAction() } // Fire input event - nsCOMPtr 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 diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in index 8e9f031aca6..e03863e859d 100644 --- a/content/html/content/test/Makefile.in +++ b/content/html/content/test/Makefile.in @@ -260,6 +260,7 @@ _TEST_FILES = \ test_bug610212.html \ test_bug633058.html \ test_bug641219.html \ + test_bug643051.html \ $(NULL) libs:: $(_TEST_FILES) diff --git a/content/html/content/test/test_bug643051.html b/content/html/content/test/test_bug643051.html new file mode 100644 index 00000000000..08f8cea3266 --- /dev/null +++ b/content/html/content/test/test_bug643051.html @@ -0,0 +1,43 @@ + + + + + Test for Bug 643051 + + + + + +Mozilla Bug 643051 +

+ +
+
+
+ + diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 02739dc5583..362163fd76e 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -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) { diff --git a/dom/plugins/PluginInstanceParent.cpp b/dom/plugins/PluginInstanceParent.cpp index d145b5e9890..0567c27e946 100644 --- a/dom/plugins/PluginInstanceParent.cpp +++ b/dom/plugins/PluginInstanceParent.cpp @@ -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) { diff --git a/dom/plugins/PluginInstanceParent.h b/dom/plugins/PluginInstanceParent.h index 6cdcd259aa0..77c486876a0 100644 --- a/dom/plugins/PluginInstanceParent.h +++ b/dom/plugins/PluginInstanceParent.h @@ -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 diff --git a/dom/plugins/PluginLibrary.h b/dom/plugins/PluginLibrary.h index 987eb9f3142..a1feb628f7e 100644 --- a/dom/plugins/PluginLibrary.h +++ b/dom/plugins/PluginLibrary.h @@ -99,7 +99,6 @@ public: virtual nsresult NPP_GetSitesWithData(InfallibleTArray& 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; diff --git a/dom/plugins/PluginModuleParent.cpp b/dom/plugins/PluginModuleParent.cpp index ed1cba838e8..eca761a9402 100644 --- a/dom/plugins/PluginModuleParent.cpp +++ b/dom/plugins/PluginModuleParent.cpp @@ -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, diff --git a/dom/plugins/PluginModuleParent.h b/dom/plugins/PluginModuleParent.h index f32beee135c..8cdb2ba47b0 100644 --- a/dom/plugins/PluginModuleParent.h +++ b/dom/plugins/PluginModuleParent.h @@ -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; } diff --git a/editor/idl/nsIEditor.idl b/editor/idl/nsIEditor.idl index 98fc009c9d4..1e9fa92102d 100644 --- a/editor/idl/nsIEditor.idl +++ b/editor/idl/nsIEditor.idl @@ -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 diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index dedb118ecbc..118357ca0eb 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -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) diff --git a/editor/libeditor/base/nsEditor.h b/editor/libeditor/base/nsEditor.h index 1163b9ab10f..33a3cac70ac 100644 --- a/editor/libeditor/base/nsEditor.h +++ b/editor/libeditor/base/nsEditor.h @@ -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: diff --git a/embedding/android/GeckoAppShell.java b/embedding/android/GeckoAppShell.java index d0968e0ec2a..228116a75ea 100644 --- a/embedding/android/GeckoAppShell.java +++ b/embedding/android/GeckoAppShell.java @@ -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(); } diff --git a/embedding/android/GeckoSurfaceView.java b/embedding/android/GeckoSurfaceView.java index 365b9c9a7d1..2f8eca13fe3 100644 --- a/embedding/android/GeckoSurfaceView.java +++ b/embedding/android/GeckoSurfaceView.java @@ -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; diff --git a/gfx/cairo/cairo/src/cairo-d2d-surface.cpp b/gfx/cairo/cairo/src/cairo-d2d-surface.cpp index e3320525e81..b460a7d29f9 100644 --- a/gfx/cairo/cairo/src/cairo-d2d-surface.cpp +++ b/gfx/cairo/cairo/src/cairo-d2d-surface.cpp @@ -3160,6 +3160,8 @@ _cairo_d2d_mask(void *surface, cairo_d2d_surface_t *d2dsurf = static_cast(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(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, diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index ef01d4950f5..09d1dddb0ef 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -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; } diff --git a/layout/base/FrameLayerBuilder.h b/layout/base/FrameLayerBuilder.h index 0256195827e..898c1cd2746 100644 --- a/layout/base/FrameLayerBuilder.h +++ b/layout/base/FrameLayerBuilder.h @@ -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 }; /** diff --git a/layout/base/nsDisplayItemTypes.h b/layout/base/nsDisplayItemTypes.h index ee1406b2d53..1acdb21e134 100644 --- a/layout/base/nsDisplayItemTypes.h +++ b/layout/base/nsDisplayItemTypes.h @@ -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, diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 1559870c6fb..ee439287d0c 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -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) diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index cf8a72c1cc4..82b8cb85420 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -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 diff --git a/layout/build/nsLayoutCID.h b/layout/build/nsLayoutCID.h index a58fdfa1678..2b6e28445f9 100644 --- a/layout/build/nsLayoutCID.h +++ b/layout/build/nsLayoutCID.h @@ -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 } } diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 94ed5f64a00..07e40583c71 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -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 }, diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 120cac4e34b..fa4dd392d6b 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -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); } diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index e3305b82430..bff15238523 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -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 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 - GetInstance() - { - nsCOMPtr 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 inst = do_QueryInterface(mInstance); - if (inst) { + if (mInstance) { nsRefPtr 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 inst = GetInstance(); - if (inst) { - inst->SetBackgroundUnknown(); + if (mInstance) { + mInstance->SetBackgroundUnknown(); } } @@ -2040,10 +2025,9 @@ already_AddRefed nsPluginInstanceOwner::BeginUpdateBackground(const nsIntRect& aRect) { nsIntRect rect = aRect; - nsCOMPtr inst = GetInstance(); nsRefPtr 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 inst = GetInstance(); - if (inst) { - inst->EndUpdateBackground(aContext, &rect); + if (mInstance) { + mInstance->EndUpdateBackground(aContext, &rect); } } nsIntSize nsPluginInstanceOwner::GetCurrentImageSize() { - nsCOMPtr 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 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; diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index 8054ab29eb0..3586aa7d231 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -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(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(aLayer); const FrameMetrics metrics = container->GetFrameMetrics(); const ViewID scrollId = metrics.mScrollId; diff --git a/mobile/app/mobile.js b/mobile/app/mobile.js index e43a28f92ce..4e9c0a5a857 100644 --- a/mobile/app/mobile.js +++ b/mobile/app/mobile.js @@ -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); diff --git a/mobile/chrome/content/BookmarkHelper.js b/mobile/chrome/content/BookmarkHelper.js index 6b96d8ef98a..ec9209ccc8e 100644 --- a/mobile/chrome/content/BookmarkHelper.js +++ b/mobile/chrome/content/BookmarkHelper.js @@ -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); diff --git a/mobile/chrome/content/MenuListHelperUI.js b/mobile/chrome/content/MenuListHelperUI.js index b8d033bde92..840aafab04a 100644 --- a/mobile/chrome/content/MenuListHelperUI.js +++ b/mobile/chrome/content/MenuListHelperUI.js @@ -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 || ""); diff --git a/mobile/chrome/content/SelectHelperUI.js b/mobile/chrome/content/SelectHelperUI.js index 063800fe959..3e23f72db66 100644 --- a/mobile/chrome/content/SelectHelperUI.js +++ b/mobile/chrome/content/SelectHelperUI.js @@ -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"); diff --git a/mobile/chrome/content/SharingUI.js b/mobile/chrome/content/SharingUI.js index 3675f910167..17e234abd0d 100644 --- a/mobile/chrome/content/SharingUI.js +++ b/mobile/chrome/content/SharingUI.js @@ -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(); diff --git a/mobile/chrome/content/bindings.xml b/mobile/chrome/content/bindings.xml index 5f8eaaeff70..5935d8c3d88 100644 --- a/mobile/chrome/content/bindings.xml +++ b/mobile/chrome/content/bindings.xml @@ -873,9 +873,9 @@ - - - + + + diff --git a/mobile/chrome/content/browser.xul b/mobile/chrome/content/browser.xul index e11a2c42ddd..57c82eb042a 100644 --- a/mobile/chrome/content/browser.xul +++ b/mobile/chrome/content/browser.xul @@ -359,18 +359,18 @@ - + + #endif