From c85fb1f23b6cea7191d0a1ae77884ce92b37c0ef Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Wed, 17 Mar 2010 20:03:53 +0100 Subject: [PATCH] Backed out changeset e17c076aceea, bug 508482 (:-moz-window-inactive pseudoclass) because of test_righttoleft.xul test failures. --- accessible/src/base/nsDocAccessible.cpp | 5 -- content/base/public/nsIDocument.h | 23 +---- content/base/public/nsIDocumentObserver.h | 17 ---- content/base/src/nsDocument.cpp | 30 ------- content/base/src/nsDocument.h | 6 -- content/xul/document/src/nsXULDocument.cpp | 13 ++- dom/base/nsGlobalWindow.cpp | 87 +++++++++---------- dom/base/nsGlobalWindow.h | 1 - dom/base/nsPIDOMWindow.h | 21 +---- dom/tests/mochitest/chrome/Makefile.in | 2 - .../mochitest/chrome/test_activation.xul | 44 ---------- .../mochitest/chrome/window_activation.xul | 36 -------- layout/base/nsPresContext.cpp | 14 --- layout/base/nsPresContext.h | 2 - layout/base/nsPresShell.cpp | 19 ---- layout/style/nsCSSPseudoClassList.h | 3 - layout/style/nsCSSRuleProcessor.cpp | 50 ++--------- layout/style/nsCSSRuleProcessor.h | 2 - layout/style/nsHTMLCSSStyleSheet.cpp | 6 -- layout/style/nsHTMLCSSStyleSheet.h | 1 - layout/style/nsHTMLStyleSheet.cpp | 6 -- layout/style/nsHTMLStyleSheet.h | 1 - layout/style/nsIStyleRuleProcessor.h | 8 -- layout/style/nsRuleProcessorData.h | 1 - layout/style/nsStyleSet.cpp | 27 +----- layout/style/nsStyleSet.h | 5 -- layout/style/nsTransitionManager.cpp | 6 -- layout/style/nsTransitionManager.h | 1 - layout/style/test/test_selectors.html | 3 - 29 files changed, 66 insertions(+), 374 deletions(-) delete mode 100644 dom/tests/mochitest/chrome/test_activation.xul delete mode 100644 dom/tests/mochitest/chrome/window_activation.xul diff --git a/accessible/src/base/nsDocAccessible.cpp b/accessible/src/base/nsDocAccessible.cpp index ea937e33f1b..4257749cd7e 100644 --- a/accessible/src/base/nsDocAccessible.cpp +++ b/accessible/src/base/nsDocAccessible.cpp @@ -1335,11 +1335,6 @@ void nsDocAccessible::ContentStatesChanged(nsIDocument* aDocument, nsHTMLSelectOptionAccessible::SelectionChangedIfOption(aContent2); } -void nsDocAccessible::DocumentStatesChanged(nsIDocument* aDocument, - PRInt32 aStateMask) -{ -} - void nsDocAccessible::CharacterDataWillChange(nsIDocument *aDocument, nsIContent* aContent, CharacterDataChangeInfo* aInfo) diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 8d4cca61b9b..6f597b17207 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -115,19 +115,12 @@ class Link; } // namespace mozilla #define NS_IDOCUMENT_IID \ -{ 0x94fb5716, 0xff00, 0x4b97, \ - { 0x90, 0x01, 0x91, 0x65, 0x1a, 0x5f, 0xbe, 0x64 } } +{ 0x36f0a42c, 0x089b, 0x4909, \ + { 0xb3, 0xee, 0xc5, 0xa4, 0x00, 0x90, 0x30, 0x02 } } // Flag for AddStyleSheet(). #define NS_STYLESHEET_FROM_CATALOG (1 << 0) -// Document states - -// RTL locale: specific to the XUL localedir attribute -#define NS_DOCUMENT_STATE_RTL_LOCALE (1 << 0) -// Window activation status -#define NS_DOCUMENT_STATE_WINDOW_INACTIVE (1 << 1) - //---------------------------------------------------------------------- // Document interface. This is implemented by all document objects in @@ -684,11 +677,6 @@ public: nsIContent* aContent2, PRInt32 aStateMask) = 0; - // Notify that a document state has changed. - // This should only be called by callers whose state is also reflected in the - // implementation of nsDocument::GetDocumentState. - virtual void DocumentStatesChanged(PRInt32 aStateMask) = 0; - // Observation hooks for style data to propagate notifications // to document observers virtual void StyleRuleChanged(nsIStyleSheet* aStyleSheet, @@ -1294,13 +1282,6 @@ public: */ virtual int GetDocumentLWTheme() { return Doc_Theme_None; } - /** - * Returns the document state. - * Document state bits have the form NS_DOCUMENT_STATE_* and are declared in - * nsIDocument.h. - */ - virtual PRInt32 GetDocumentState() = 0; - /** * Gets the document's cached pointer to the first element in this * document which has an href attribute. If the document doesn't contain any diff --git a/content/base/public/nsIDocumentObserver.h b/content/base/public/nsIDocumentObserver.h index 5cea4fa9f6d..049201ebcde 100644 --- a/content/base/public/nsIDocumentObserver.h +++ b/content/base/public/nsIDocumentObserver.h @@ -118,15 +118,6 @@ public: nsIContent* aContent2, PRInt32 aStateMask) = 0; - /** - * Notification that the state of the document has changed. - * - * @param aDocument The document being observed - * @param aStateMask the state that changed - */ - virtual void DocumentStatesChanged(nsIDocument* aDocument, - PRInt32 aStateMask) = 0; - /** * A StyleSheet has just been added to the document. This method is * called automatically when a StyleSheet gets added to the @@ -243,8 +234,6 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID) nsIContent* aContent1, \ nsIContent* aContent2, \ PRInt32 aStateMask); \ - virtual void DocumentStatesChanged(nsIDocument* aDocument, \ - PRInt32 aStateMask); \ virtual void StyleSheetAdded(nsIDocument* aDocument, \ nsIStyleSheet* aStyleSheet, \ PRBool aDocumentSheet); \ @@ -295,12 +284,6 @@ _class::ContentStatesChanged(nsIDocument* aDocument, \ nsIContent* aContent2, \ PRInt32 aStateMask) \ { \ -} \ - \ -void \ -_class::DocumentStatesChanged(nsIDocument* aDocument, \ - PRInt32 aStateMask) \ -{ \ } #define NS_IMPL_NSIDOCUMENTOBSERVER_CONTENT(_class) \ diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index a374cd17277..a7703eddbca 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -4055,16 +4055,6 @@ nsDocument::ContentStatesChanged(nsIContent* aContent1, nsIContent* aContent2, (this, aContent1, aContent2, aStateMask)); } -void -nsDocument::DocumentStatesChanged(PRInt32 aStateMask) -{ - // Invalidate our cached state. - mGotDocumentState &= ~aStateMask; - mDocumentState &= ~aStateMask; - - NS_DOCUMENT_NOTIFY_OBSERVERS(DocumentStatesChanged, (this, aStateMask)); -} - void nsDocument::StyleRuleChanged(nsIStyleSheet* aStyleSheet, nsIStyleRule* aOldStyleRule, @@ -7625,26 +7615,6 @@ nsDocument::MaybePreLoadImage(nsIURI* uri) } } -PRInt32 -nsDocument::GetDocumentState() -{ - if (!(mGotDocumentState & NS_DOCUMENT_STATE_RTL_LOCALE)) { - if (IsDocumentRightToLeft()) { - mDocumentState |= NS_DOCUMENT_STATE_RTL_LOCALE; - } - mGotDocumentState |= NS_DOCUMENT_STATE_RTL_LOCALE; - } - if (!(mGotDocumentState & NS_DOCUMENT_STATE_WINDOW_INACTIVE)) { - nsIPresShell* shell = GetPrimaryShell(); - if (shell && shell->GetPresContext() && - shell->GetPresContext()->IsTopLevelWindowInactive()) { - mDocumentState |= NS_DOCUMENT_STATE_WINDOW_INACTIVE; - } - mGotDocumentState |= NS_DOCUMENT_STATE_WINDOW_INACTIVE; - } - return mDocumentState; -} - namespace { /** diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index 27834efa0c5..5136dc6b4fb 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -693,7 +693,6 @@ public: virtual void ContentStatesChanged(nsIContent* aContent1, nsIContent* aContent2, PRInt32 aStateMask); - virtual void DocumentStatesChanged(PRInt32 aStateMask); virtual void StyleRuleChanged(nsIStyleSheet* aStyleSheet, nsIStyleRule* aOldStyleRule, @@ -940,8 +939,6 @@ public: virtual nsISupports* GetCurrentContentSink(); - virtual PRInt32 GetDocumentState(); - virtual void RegisterFileDataUri(nsACString& aUri); protected: @@ -1137,9 +1134,6 @@ protected: nsCOMPtr mFirstBaseNodeWithHref; - PRInt32 mDocumentState; - PRInt32 mGotDocumentState; - private: friend class nsUnblockOnloadEvent; diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index 071981f9590..0e020612c94 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -126,6 +126,7 @@ #include "nsXULPopupManager.h" #include "nsCCUncollectableMarker.h" #include "nsURILoader.h" +#include "nsCSSFrameConstructor.h" //---------------------------------------------------------------------- // @@ -4664,11 +4665,17 @@ nsXULDocument::IsDocumentRightToLeft() int nsXULDocument::DirectionChanged(const char* aPrefName, void* aData) { - // Reset the direction and restyle the document if necessary. + // reset the direction and reflow the document. This will happen if + // the direction isn't actually being used, but that doesn't really + // matter too much nsXULDocument* doc = (nsXULDocument *)aData; - if (doc) { + if (doc) doc->ResetDocumentDirection(); - doc->DocumentStatesChanged(NS_DOCUMENT_STATE_RTL_LOCALE); + + nsIPresShell *shell = doc->GetPrimaryShell(); + if (shell) { + shell->FrameConstructor()-> + PostRestyleEvent(doc->GetRootContent(), eReStyle_Self, NS_STYLE_HINT_NONE); } return 0; diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index cb3e115194c..203af2b916f 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -6833,53 +6833,52 @@ nsGlobalWindow::GetLocation(nsIDOMLocation ** aLocation) void nsGlobalWindow::ActivateOrDeactivate(PRBool aActivate) { - // Set / unset mIsActive on the top level window, which is used for the - // :-moz-window-inactive pseudoclass. + // Set / unset the "active" attribute on the documentElement + // of the top level window nsCOMPtr mainWidget = GetMainWidget(); - if (!mainWidget) - return; + if (mainWidget) { + // Get the top level widget (if the main widget is a sheet, this will + // be the sheet's top (non-sheet) parent). + nsCOMPtr topLevelWidget = mainWidget->GetSheetWindowParent(); + if (!topLevelWidget) + topLevelWidget = mainWidget; - // Get the top level widget (if the main widget is a sheet, this will - // be the sheet's top (non-sheet) parent). - nsCOMPtr topLevelWidget = mainWidget->GetSheetWindowParent(); - if (!topLevelWidget) { - topLevelWidget = mainWidget; + // Get the top level widget's nsGlobalWindow + nsCOMPtr topLevelWindow; + if (topLevelWidget == mainWidget) { + topLevelWindow = static_cast(this); + } else { + // This is a workaround for the following problem: + // When a window with an open sheet loses focus, only the sheet window + // receives the NS_DEACTIVATE event. However, it's not the sheet that + // should lose the "active" attribute, but the containing top level window. + void* clientData; + topLevelWidget->GetClientData(clientData); // clientData is nsXULWindow + nsISupports* data = static_cast(clientData); + nsCOMPtr req(do_QueryInterface(data)); + topLevelWindow = do_GetInterface(req); + } + + if (topLevelWindow) { + // Only set the attribute if the document is a XUL document and the + // window is a chrome window + nsCOMPtr domDoc; + topLevelWindow->GetDocument(getter_AddRefs(domDoc)); + nsCOMPtr doc(do_QueryInterface(domDoc)); + nsCOMPtr xulDoc(do_QueryInterface(doc)); + nsCOMPtr chromeWin = do_QueryInterface(topLevelWindow); + if (xulDoc && chromeWin) { + nsCOMPtr rootElem = doc->GetRootContent(); + if (rootElem) { + if (aActivate) + rootElem->SetAttr(kNameSpaceID_None, nsGkAtoms::active, + NS_LITERAL_STRING("true"), PR_TRUE); + else + rootElem->UnsetAttr(kNameSpaceID_None, nsGkAtoms::active, PR_TRUE); + } + } + } } - - // Get the top level widget's nsGlobalWindow - nsCOMPtr topLevelWindow; - if (topLevelWidget == mainWidget) { - topLevelWindow = static_cast(this); - } else { - // This is a workaround for the following problem: - // When a window with an open sheet loses focus, only the sheet window - // receives the NS_DEACTIVATE event. However, it's not the sheet that - // should lose the active styling, but the containing top level window. - void* clientData; - topLevelWidget->GetClientData(clientData); // clientData is nsXULWindow - nsISupports* data = static_cast(clientData); - nsCOMPtr req(do_QueryInterface(data)); - topLevelWindow = do_GetInterface(req); - } - if (topLevelWindow) { - nsCOMPtr piWin(do_QueryInterface(topLevelWindow)); - piWin->SetActive(aActivate); - } -} - -static PRBool -NotifyDocumentTree(nsIDocument* aDocument, void* aData) -{ - aDocument->EnumerateSubDocuments(NotifyDocumentTree, nsnull); - aDocument->DocumentStatesChanged(NS_DOCUMENT_STATE_WINDOW_INACTIVE); - return PR_TRUE; -} - -void -nsGlobalWindow::SetActive(PRBool aActive) -{ - nsPIDOMWindow::SetActive(aActive); - NotifyDocumentTree(mDoc, nsnull); } void diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 2de40541487..4898627a3bc 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -288,7 +288,6 @@ public: // nsPIDOMWindow virtual NS_HIDDEN_(nsPIDOMWindow*) GetPrivateRoot(); virtual NS_HIDDEN_(void) ActivateOrDeactivate(PRBool aActivate); - virtual NS_HIDDEN_(void) SetActive(PRBool aActive); virtual NS_HIDDEN_(void) SetChromeEventHandler(nsPIDOMEventTarget* aChromeEventHandler); virtual NS_HIDDEN_(void) SetOpenerScriptPrincipal(nsIPrincipal* aPrincipal); diff --git a/dom/base/nsPIDOMWindow.h b/dom/base/nsPIDOMWindow.h index 72e40281fd3..faa28ee7fd5 100644 --- a/dom/base/nsPIDOMWindow.h +++ b/dom/base/nsPIDOMWindow.h @@ -78,8 +78,8 @@ class nsIArray; class nsPIWindowRoot; #define NS_PIDOMWINDOW_IID \ -{ 0xC5CB154D, 0x17C0, 0x49E9, \ - { 0x9C, 0x83, 0xFF, 0xC7, 0x2C, 0x93, 0xAF, 0x24 } } +{ 0x81cdf500, 0x2183, 0x4af6, \ + { 0xa4, 0x56, 0x35, 0x1f, 0x4a, 0x0d, 0x1a, 0x0b } } class nsPIDOMWindow : public nsIDOMWindowInternal { @@ -93,16 +93,6 @@ public: // this is called GetTopWindowRoot to avoid conflicts with nsIDOMWindow2::GetWindowRoot virtual already_AddRefed GetTopWindowRoot() = 0; - virtual void SetActive(PRBool aActive) - { - mIsActive = aActive; - } - - PRBool IsActive() - { - return mIsActive; - } - nsPIDOMEventTarget* GetChromeEventHandler() const { return mChromeEventHandler; @@ -500,8 +490,8 @@ protected: mRunningTimeout(nsnull), mMutationBits(0), mIsDocumentLoaded(PR_FALSE), mIsHandlingResizeEvent(PR_FALSE), mIsInnerWindow(aOuterWindow != nsnull), mMayHavePaintEventListener(PR_FALSE), - mIsModalContentWindow(PR_FALSE), mIsActive(PR_FALSE), - mInnerWindow(nsnull), mOuterWindow(aOuterWindow) + mIsModalContentWindow(PR_FALSE), mInnerWindow(nsnull), + mOuterWindow(aOuterWindow) { } @@ -535,9 +525,6 @@ protected: // should match). PRPackedBool mIsModalContentWindow; - // Tracks activation state that's used for :-moz-window-inactive - PRPackedBool mIsActive; - // And these are the references between inner and outer windows. nsPIDOMWindow *mInnerWindow; nsPIDOMWindow *mOuterWindow; diff --git a/dom/tests/mochitest/chrome/Makefile.in b/dom/tests/mochitest/chrome/Makefile.in index ea73a80d62d..b10d77a4794 100644 --- a/dom/tests/mochitest/chrome/Makefile.in +++ b/dom/tests/mochitest/chrome/Makefile.in @@ -60,8 +60,6 @@ _TEST_FILES = \ window_focus.xul \ test_focused_link_scroll.xul \ test_geolocation.xul \ - test_activation.xul \ - window_activation.xul \ $(NULL) libs:: $(_TEST_FILES) diff --git a/dom/tests/mochitest/chrome/test_activation.xul b/dom/tests/mochitest/chrome/test_activation.xul deleted file mode 100644 index f68eb840ebb..00000000000 --- a/dom/tests/mochitest/chrome/test_activation.xul +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/dom/tests/mochitest/chrome/window_activation.xul b/dom/tests/mochitest/chrome/window_activation.xul deleted file mode 100644 index 9a7567eac8a..00000000000 --- a/dom/tests/mochitest/chrome/window_activation.xul +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 48e4d9d195c..a719606f886 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -1435,20 +1435,6 @@ nsPresContext::GetBidi() const } #endif //IBMBIDI -PRBool -nsPresContext::IsTopLevelWindowInactive() -{ - nsCOMPtr treeItem(do_QueryReferent(mContainer)); - if (!treeItem) - return PR_FALSE; - - nsCOMPtr rootItem; - treeItem->GetRootTreeItem(getter_AddRefs(rootItem)); - nsCOMPtr domWindow(do_GetInterface(rootItem)); - - return domWindow && !domWindow->IsActive(); -} - nsITheme* nsPresContext::GetTheme() { diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 306a157e549..184e5e335ca 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -757,8 +757,6 @@ public: PRBool IsRenderingOnlySelection() const { return mIsRenderingOnlySelection; } - NS_HIDDEN_(PRBool) IsTopLevelWindowInactive(); - /* * Obtain a native them for rendering our widgets (both form controls and html) */ diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 32e542d8958..6f3d5f3cb30 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -856,8 +856,6 @@ public: nsIContent* aContent1, nsIContent* aContent2, PRInt32 aStateMask); - virtual void DocumentStatesChanged(nsIDocument* aDocument, - PRInt32 aStateMask); virtual void StyleSheetAdded(nsIDocument* aDocument, nsIStyleSheet* aStyleSheet, PRBool aDocumentSheet); @@ -4913,23 +4911,6 @@ PresShell::ContentStatesChanged(nsIDocument* aDocument, } } -void -PresShell::DocumentStatesChanged(nsIDocument* aDocument, - PRInt32 aStateMask) -{ - NS_PRECONDITION(!mIsDocumentGone, "Unexpected DocumentStatesChanged"); - NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument"); - - if (mDidInitialReflow && - mStyleSet->HasDocumentStateDependentStyle(mPresContext, - mDocument->GetRootContent(), - aStateMask)) { - mFrameConstructor->PostRestyleEvent(mDocument->GetRootContent(), - eReStyle_Self, NS_STYLE_HINT_NONE); - VERIFY_STYLE_TREE; - } -} - void PresShell::AttributeWillChange(nsIDocument* aDocument, nsIContent* aContent, diff --git a/layout/style/nsCSSPseudoClassList.h b/layout/style/nsCSSPseudoClassList.h index 149d1c51ce7..854d4520794 100644 --- a/layout/style/nsCSSPseudoClassList.h +++ b/layout/style/nsCSSPseudoClassList.h @@ -141,9 +141,6 @@ CSS_PSEUDO_CLASS(mozLWThemeBrightText, ":-moz-lwtheme-brighttext") // -moz-lwtheme-darktext matches a document that has a bright lightweight theme CSS_PSEUDO_CLASS(mozLWThemeDarkText, ":-moz-lwtheme-darktext") -// Matches anything when the containing window is inactive -CSS_PSEUDO_CLASS(mozWindowInactive, ":-moz-window-inactive") - #ifdef MOZ_MATHML CSS_STATE_PSEUDO_CLASS(mozMathIncrementScriptLevel, ":-moz-math-increment-script-level", diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index 52028c069fb..dd11ea26de0 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -707,7 +707,6 @@ static const PLDHashTableOps AttributeSelectorOps = { struct RuleCascadeData { RuleCascadeData(nsIAtom *aMedium, PRBool aQuirksMode) : mRuleHash(aQuirksMode), - mSelectorDocumentStates(0), mStateSelectors(), mCacheKey(aMedium), mNext(nsnull), @@ -737,7 +736,6 @@ struct RuleCascadeData { RuleHash* mPseudoElementRuleHashes[nsCSSPseudoElements::ePseudo_PseudoElementCount]; nsTArray mStateSelectors; - PRUint32 mSelectorDocumentStates; nsTArray mClassSelectors; nsTArray mIDSelectors; PLDHashTable mAttributeSelectors; @@ -1125,12 +1123,6 @@ RuleProcessorData::ContentState() return mContentState; } -PRUint32 -RuleProcessorData::DocumentState() -{ - return mContent->GetOwnerDoc()->GetDocumentState(); -} - PRBool RuleProcessorData::IsLink() { @@ -1712,8 +1704,13 @@ mozLocaleDirMatches(RuleProcessorData& data, PRBool setNodeFlags, { NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::mozLocaleDir, "Unexpected atom"); + nsIDocument* doc = data.mContent->GetDocument(); - PRBool docIsRTL = (data.DocumentState() & NS_DOCUMENT_STATE_RTL_LOCALE) != 0; + if (!doc) { + return PR_FALSE; + } + + PRBool docIsRTL = doc && doc->IsDocumentRightToLeft(); nsDependentString dirString(pseudoClass->u.mString); NS_ASSERTION(dirString.EqualsLiteral("ltr") || dirString.EqualsLiteral("rtl"), @@ -1754,16 +1751,6 @@ mozLWThemeDarkTextMatches(RuleProcessorData& data, PRBool setNodeFlags, return doc && doc->GetDocumentLWTheme() == nsIDocument::Doc_Theme_Dark; } -static PRBool NS_FASTCALL -mozWindowInactiveMatches(RuleProcessorData& data, PRBool setNodeFlags, - nsPseudoClassList* pseudoClass) -{ - NS_PRECONDITION(pseudoClass->mAtom == - nsCSSPseudoClasses::mozWindowInactive, - "Unexpected atom"); - return (data.DocumentState() & NS_DOCUMENT_STATE_WINDOW_INACTIVE) != 0; -} - static PRBool NS_FASTCALL notPseudoMatches(RuleProcessorData& data, PRBool setNodeFlags, nsPseudoClassList* pseudoClass) @@ -2305,14 +2292,6 @@ nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData) return hint; } -PRBool -nsCSSRuleProcessor::HasDocumentStateDependentStyle(StateRuleProcessorData* aData) -{ - RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext); - - return cascade && (cascade->mSelectorDocumentStates & aData->mStateMask) != 0; -} - struct AttributeEnumData { AttributeEnumData(AttributeRuleProcessorData *aData) : data(aData), change(nsReStyleHint(0)) {} @@ -2477,20 +2456,6 @@ PRBool IsStateSelector(nsCSSSelector& aSelector) return PR_FALSE; } -inline -void AddSelectorDocumentStates(nsCSSSelector& aSelector, PRUint32* aStateMask) -{ - for (nsPseudoClassList* pseudoClass = aSelector.mPseudoClassList; - pseudoClass; pseudoClass = pseudoClass->mNext) { - if (pseudoClass->mAtom == nsCSSPseudoClasses::mozLocaleDir) { - *aStateMask |= NS_DOCUMENT_STATE_RTL_LOCALE; - } - else if (pseudoClass->mAtom == nsCSSPseudoClasses::mozWindowInactive) { - *aStateMask |= NS_DOCUMENT_STATE_WINDOW_INACTIVE; - } - } -} - static PRBool AddRule(RuleValue* aRuleInfo, RuleCascadeData* aCascade) { @@ -2568,9 +2533,6 @@ AddRule(RuleValue* aRuleInfo, RuleCascadeData* aCascade) // in the future if :not() is extended. for (nsCSSSelector* negation = selector; negation; negation = negation->mNegations) { - // Track the selectors that depend on document states. - AddSelectorDocumentStates(*negation, &cascade->mSelectorDocumentStates); - // Build mStateSelectors. if (IsStateSelector(*negation)) stateArray->AppendElement(selector); diff --git a/layout/style/nsCSSRuleProcessor.h b/layout/style/nsCSSRuleProcessor.h index ff785d62e02..ae98fcba05a 100644 --- a/layout/style/nsCSSRuleProcessor.h +++ b/layout/style/nsCSSRuleProcessor.h @@ -104,8 +104,6 @@ public: virtual nsReStyleHint HasStateDependentStyle(StateRuleProcessorData* aData); - virtual PRBool HasDocumentStateDependentStyle(StateRuleProcessorData* aData); - virtual nsReStyleHint HasAttributeDependentStyle(AttributeRuleProcessorData* aData); diff --git a/layout/style/nsHTMLCSSStyleSheet.cpp b/layout/style/nsHTMLCSSStyleSheet.cpp index fe8cf4213d6..1a4ad6ef76f 100644 --- a/layout/style/nsHTMLCSSStyleSheet.cpp +++ b/layout/style/nsHTMLCSSStyleSheet.cpp @@ -148,12 +148,6 @@ nsHTMLCSSStyleSheet::HasStateDependentStyle(StateRuleProcessorData* aData) return nsReStyleHint(0); } -PRBool -nsHTMLCSSStyleSheet::HasDocumentStateDependentStyle(StateRuleProcessorData* aData) -{ - return PR_FALSE; -} - // Test if style is dependent on attribute nsReStyleHint nsHTMLCSSStyleSheet::HasAttributeDependentStyle(AttributeRuleProcessorData* aData) diff --git a/layout/style/nsHTMLCSSStyleSheet.h b/layout/style/nsHTMLCSSStyleSheet.h index 603b61253ca..dc232e02209 100644 --- a/layout/style/nsHTMLCSSStyleSheet.h +++ b/layout/style/nsHTMLCSSStyleSheet.h @@ -80,7 +80,6 @@ public: NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData); #endif virtual nsReStyleHint HasStateDependentStyle(StateRuleProcessorData* aData); - virtual PRBool HasDocumentStateDependentStyle(StateRuleProcessorData* aData); virtual nsReStyleHint HasAttributeDependentStyle(AttributeRuleProcessorData* aData); NS_IMETHOD MediumFeaturesChanged(nsPresContext* aPresContext, diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index 76f2914d123..77490689a12 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -301,12 +301,6 @@ nsHTMLStyleSheet::HasStateDependentStyle(StateRuleProcessorData* aData) return nsReStyleHint(0); } -PRBool -nsHTMLStyleSheet::HasDocumentStateDependentStyle(StateRuleProcessorData* aData) -{ - return PR_FALSE; -} - nsReStyleHint nsHTMLStyleSheet::HasAttributeDependentStyle(AttributeRuleProcessorData* aData) { diff --git a/layout/style/nsHTMLStyleSheet.h b/layout/style/nsHTMLStyleSheet.h index 46f7fe2d761..5eb69ff4c81 100644 --- a/layout/style/nsHTMLStyleSheet.h +++ b/layout/style/nsHTMLStyleSheet.h @@ -85,7 +85,6 @@ public: NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData); #endif virtual nsReStyleHint HasStateDependentStyle(StateRuleProcessorData* aData); - virtual PRBool HasDocumentStateDependentStyle(StateRuleProcessorData* aData); virtual nsReStyleHint HasAttributeDependentStyle(AttributeRuleProcessorData* aData); NS_IMETHOD MediumFeaturesChanged(nsPresContext* aPresContext, diff --git a/layout/style/nsIStyleRuleProcessor.h b/layout/style/nsIStyleRuleProcessor.h index b9b206bb925..9fc8c84e9a4 100644 --- a/layout/style/nsIStyleRuleProcessor.h +++ b/layout/style/nsIStyleRuleProcessor.h @@ -109,14 +109,6 @@ public: NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData) = 0; #endif - /** - * Return whether style can depend on a change of the given document state. - * - * Document states are defined in nsIDocument.h. - */ - virtual PRBool - HasDocumentStateDependentStyle(StateRuleProcessorData* aData) = 0; - /** * Return how (as described by nsReStyleHint) style can depend on a * change of the given content state on the given content node. This diff --git a/layout/style/nsRuleProcessorData.h b/layout/style/nsRuleProcessorData.h index f2bf8bc7804..25caa745f8c 100644 --- a/layout/style/nsRuleProcessorData.h +++ b/layout/style/nsRuleProcessorData.h @@ -108,7 +108,6 @@ private: public: const nsString* GetLang(); PRUint32 ContentState(); - PRUint32 DocumentState(); PRBool IsLink(); // Returns a 1-based index of the child in its parent. If the child diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp index d44202b0dcc..f60cb1d1424 100644 --- a/layout/style/nsStyleSet.cpp +++ b/layout/style/nsStyleSet.cpp @@ -1070,32 +1070,7 @@ struct StatefulData : public StateRuleProcessorData { mHint(nsReStyleHint(0)) {} nsReStyleHint mHint; -}; - -static PRBool SheetHasDocumentStateStyle(nsIStyleRuleProcessor* aProcessor, - void *aData) -{ - StatefulData* data = (StatefulData*)aData; - if (aProcessor->HasDocumentStateDependentStyle(data)) { - data->mHint = eReStyle_Self; - return PR_FALSE; // don't continue - } - return PR_TRUE; // continue -} - -// Test if style is dependent on a document state. -PRBool -nsStyleSet::HasDocumentStateDependentStyle(nsPresContext* aPresContext, - nsIContent* aContent, - PRInt32 aStateMask) -{ - if (!aContent || !aContent->IsNodeOfType(nsINode::eELEMENT)) - return PR_FALSE; - - StatefulData data(aPresContext, aContent, aStateMask); - WalkRuleProcessors(SheetHasDocumentStateStyle, &data); - return data.mHint != 0; -} +}; static PRBool SheetHasStatefulStyle(nsIStyleRuleProcessor* aProcessor, void *aData) diff --git a/layout/style/nsStyleSet.h b/layout/style/nsStyleSet.h index bd266d9f98d..c57e28c1f54 100644 --- a/layout/style/nsStyleSet.h +++ b/layout/style/nsStyleSet.h @@ -177,11 +177,6 @@ class nsStyleSet nsStyleContext* aStyleContext, nsStyleContext* aNewParentContext); - // Test if style is dependent on a document state. - PRBool HasDocumentStateDependentStyle(nsPresContext* aPresContext, - nsIContent* aContent, - PRInt32 aStateMask); - // Test if style is dependent on content state nsReStyleHint HasStateDependentStyle(nsPresContext* aPresContext, nsIContent* aContent, diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index 36a99f17062..59494033622 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -892,12 +892,6 @@ nsTransitionManager::HasStateDependentStyle(StateRuleProcessorData* aData) return nsReStyleHint(0); } -PRBool -nsTransitionManager::HasDocumentStateDependentStyle(StateRuleProcessorData* aData) -{ - return PR_FALSE; -} - nsReStyleHint nsTransitionManager::HasAttributeDependentStyle(AttributeRuleProcessorData* aData) { diff --git a/layout/style/nsTransitionManager.h b/layout/style/nsTransitionManager.h index 373e88655fa..f9761c38152 100644 --- a/layout/style/nsTransitionManager.h +++ b/layout/style/nsTransitionManager.h @@ -93,7 +93,6 @@ public: NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData); #endif virtual nsReStyleHint HasStateDependentStyle(StateRuleProcessorData* aData); - virtual PRBool HasDocumentStateDependentStyle(StateRuleProcessorData* aData); virtual nsReStyleHint HasAttributeDependentStyle(AttributeRuleProcessorData* aData); NS_IMETHOD MediumFeaturesChanged(nsPresContext* aPresContext, diff --git a/layout/style/test/test_selectors.html b/layout/style/test/test_selectors.html index d642a9a13b3..7e92d1ae458 100644 --- a/layout/style/test/test_selectors.html +++ b/layout/style/test/test_selectors.html @@ -704,9 +704,6 @@ function run() { test_balanced_unparseable(":-moz-tree-twisty(open())"); test_balanced_unparseable("::-moz-tree-twisty(hover ())"); - test_parseable(":-moz-window-inactive"); - test_parseable("div p:-moz-window-inactive:hover span"); - // Plugin pseudoclasses test_parseable(":-moz-type-unsupported"); test_parseable(":-moz-handler-disabled");