зеркало из https://github.com/mozilla/pjs.git
Backed out changeset e17c076aceea, bug 508482 (:-moz-window-inactive pseudoclass) because of test_righttoleft.xul test failures.
This commit is contained in:
Родитель
51f979aa23
Коммит
c85fb1f23b
|
@ -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)
|
||||
|
|
|
@ -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 <base> element in this
|
||||
* document which has an href attribute. If the document doesn't contain any
|
||||
|
|
|
@ -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) \
|
||||
|
|
|
@ -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 {
|
||||
|
||||
/**
|
||||
|
|
|
@ -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<nsIContent> mFirstBaseNodeWithHref;
|
||||
|
||||
PRInt32 mDocumentState;
|
||||
PRInt32 mGotDocumentState;
|
||||
|
||||
private:
|
||||
friend class nsUnblockOnloadEvent;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<nsIWidget> 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<nsIWidget> 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<nsIWidget> topLevelWidget = mainWidget->GetSheetWindowParent();
|
||||
if (!topLevelWidget) {
|
||||
topLevelWidget = mainWidget;
|
||||
// Get the top level widget's nsGlobalWindow
|
||||
nsCOMPtr<nsIDOMWindowInternal> topLevelWindow;
|
||||
if (topLevelWidget == mainWidget) {
|
||||
topLevelWindow = static_cast<nsIDOMWindowInternal *>(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<nsISupports*>(clientData);
|
||||
nsCOMPtr<nsIInterfaceRequestor> 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<nsIDOMDocument> domDoc;
|
||||
topLevelWindow->GetDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDoc(do_QueryInterface(doc));
|
||||
nsCOMPtr<nsIDOMChromeWindow> chromeWin = do_QueryInterface(topLevelWindow);
|
||||
if (xulDoc && chromeWin) {
|
||||
nsCOMPtr<nsIContent> 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<nsIDOMWindowInternal> topLevelWindow;
|
||||
if (topLevelWidget == mainWidget) {
|
||||
topLevelWindow = static_cast<nsIDOMWindowInternal*>(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<nsISupports*>(clientData);
|
||||
nsCOMPtr<nsIInterfaceRequestor> req(do_QueryInterface(data));
|
||||
topLevelWindow = do_GetInterface(req);
|
||||
}
|
||||
if (topLevelWindow) {
|
||||
nsCOMPtr<nsPIDOMWindow> 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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<nsPIWindowRoot> 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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
<?xml-stylesheet href="data:text/css,
|
||||
|
||||
#box {
|
||||
background: blue;
|
||||
}
|
||||
|
||||
#box:-moz-window-inactive {
|
||||
background: cyan;
|
||||
}
|
||||
|
||||
" type="text/css"?>
|
||||
<!--
|
||||
Test for the :-moz-window-inactive pseudoclass
|
||||
-->
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
sizemode="fullscreen">
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<box id="box" height="100"/>
|
||||
|
||||
<script>
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
newwindow = window.open("window_activation.xul", "_blank","chrome,width=300,height=200");
|
||||
|
||||
function complete()
|
||||
{
|
||||
newwindow.close();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
</window>
|
|
@ -1,36 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="data:text/css,
|
||||
|
||||
#box {
|
||||
background: blue;
|
||||
}
|
||||
|
||||
#box:-moz-window-inactive {
|
||||
background: cyan;
|
||||
}
|
||||
|
||||
" type="text/css"?>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<box id="box" height="100"/>
|
||||
|
||||
<script type="application/javascript"><![CDATA[
|
||||
|
||||
var ok = window.opener.wrappedJSObject.ok;
|
||||
var complete = window.opener.wrappedJSObject.complete;
|
||||
var openerDoc = window.opener.wrappedJSObject.document;
|
||||
|
||||
window.onfocus = function () {
|
||||
ok(getComputedStyle(document.getElementById("box"), "").backgroundColor, "rgb(0, 0, 255)");
|
||||
ok(getComputedStyle(openerDoc.getElementById("box"), "").backgroundColor, "rgb(0, 255, 255)");
|
||||
window.opener.focus();
|
||||
ok(getComputedStyle(document.getElementById("box"), "").backgroundColor, "rgb(0, 255, 255)");
|
||||
ok(getComputedStyle(openerDoc.getElementById("box"), "").backgroundColor, "rgb(0, 0, 255)");
|
||||
complete();
|
||||
}
|
||||
|
||||
]]></script>
|
||||
|
||||
</window>
|
|
@ -1435,20 +1435,6 @@ nsPresContext::GetBidi() const
|
|||
}
|
||||
#endif //IBMBIDI
|
||||
|
||||
PRBool
|
||||
nsPresContext::IsTopLevelWindowInactive()
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryReferent(mContainer));
|
||||
if (!treeItem)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootItem;
|
||||
treeItem->GetRootTreeItem(getter_AddRefs(rootItem));
|
||||
nsCOMPtr<nsPIDOMWindow> domWindow(do_GetInterface(rootItem));
|
||||
|
||||
return domWindow && !domWindow->IsActive();
|
||||
}
|
||||
|
||||
nsITheme*
|
||||
nsPresContext::GetTheme()
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
*/
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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<nsCSSSelector*> mStateSelectors;
|
||||
PRUint32 mSelectorDocumentStates;
|
||||
nsTArray<nsCSSSelector*> mClassSelectors;
|
||||
nsTArray<nsCSSSelector*> 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);
|
||||
|
|
|
@ -104,8 +104,6 @@ public:
|
|||
|
||||
virtual nsReStyleHint HasStateDependentStyle(StateRuleProcessorData* aData);
|
||||
|
||||
virtual PRBool HasDocumentStateDependentStyle(StateRuleProcessorData* aData);
|
||||
|
||||
virtual nsReStyleHint
|
||||
HasAttributeDependentStyle(AttributeRuleProcessorData* aData);
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -301,12 +301,6 @@ nsHTMLStyleSheet::HasStateDependentStyle(StateRuleProcessorData* aData)
|
|||
return nsReStyleHint(0);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLStyleSheet::HasDocumentStateDependentStyle(StateRuleProcessorData* aData)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsReStyleHint
|
||||
nsHTMLStyleSheet::HasAttributeDependentStyle(AttributeRuleProcessorData* aData)
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -892,12 +892,6 @@ nsTransitionManager::HasStateDependentStyle(StateRuleProcessorData* aData)
|
|||
return nsReStyleHint(0);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsTransitionManager::HasDocumentStateDependentStyle(StateRuleProcessorData* aData)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsReStyleHint
|
||||
nsTransitionManager::HasAttributeDependentStyle(AttributeRuleProcessorData* aData)
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
|
|
Загрузка…
Ссылка в новой задаче