Backout bug 508725 (d267bb4b58b5, 50f71edffeb9, 6aec8e22fe60, e62e1f33958a, 0f146c435249, eb959b9f4862, 2b0ee42f3aa0, 02db01cd6796, 2ef0e517d43d, b650588e05c9 and a3c916829d56) for build failure on a CLOSED TREE.

This commit is contained in:
Cameron McCormack 2013-01-08 19:36:21 +11:00
Родитель 4e23c55881
Коммит c067646b00
142 изменённых файлов: 244 добавлений и 2020 удалений

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

@ -873,29 +873,6 @@ public:
*/ */
nsIEditor* GetEditorInternal(); nsIEditor* GetEditorInternal();
/**
* Helper method for NS_IMPL_BOOL_ATTR macro.
* Gets value of boolean attribute. Only works for attributes in null
* namespace.
*
* @param aAttr name of attribute.
* @param aValue Boolean value of attribute.
*/
NS_HIDDEN_(bool) GetBoolAttr(nsIAtom* aAttr) const
{
return HasAttr(kNameSpaceID_None, aAttr);
}
/**
* Helper method for NS_IMPL_BOOL_ATTR macro.
* Sets value of boolean attribute by removing attribute or setting it to
* the empty string. Only works for attributes in null namespace.
*
* @param aAttr name of attribute.
* @param aValue Boolean value of attribute.
*/
NS_HIDDEN_(nsresult) SetBoolAttr(nsIAtom* aAttr, bool aValue);
protected: protected:
/* /*
* Named-bools for use with SetAttrAndNotify to make call sites easier to * Named-bools for use with SetAttrAndNotify to make call sites easier to
@ -1238,24 +1215,6 @@ _elementName::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const \
return SetAttr(kNameSpaceID_None, nsGkAtoms::_atom, nullptr, aValue, true); \ return SetAttr(kNameSpaceID_None, nsGkAtoms::_atom, nullptr, aValue, true); \
} }
/**
* A macro to implement the getter and setter for a given boolean
* valued content property. The method uses the GetBoolAttr and
* SetBoolAttr methods.
*/
#define NS_IMPL_BOOL_ATTR(_class, _method, _atom) \
NS_IMETHODIMP \
_class::Get##_method(bool* aValue) \
{ \
*aValue = GetBoolAttr(nsGkAtoms::_atom); \
return NS_OK; \
} \
NS_IMETHODIMP \
_class::Set##_method(bool aValue) \
{ \
return SetBoolAttr(nsGkAtoms::_atom, aValue); \
}
#define NS_FORWARD_NSIDOMELEMENT_TO_GENERIC \ #define NS_FORWARD_NSIDOMELEMENT_TO_GENERIC \
typedef mozilla::dom::Element Element; \ typedef mozilla::dom::Element Element; \
NS_IMETHOD GetTagName(nsAString& aTagName) MOZ_FINAL \ NS_IMETHOD GetTagName(nsAString& aTagName) MOZ_FINAL \

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

@ -1319,11 +1319,6 @@ private:
NodeHasDirAuto, NodeHasDirAuto,
// Set if a node in the node's parent chain has dir=auto. // Set if a node in the node's parent chain has dir=auto.
NodeAncestorHasDirAuto, NodeAncestorHasDirAuto,
// Set if the element is in the scope of a scoped style sheet; this flag is
// only accurate for elements bounds to a document
ElementIsInStyleScope,
// Set if the element is a scoped style sheet root
ElementIsScopedStyleRoot,
// Guard value // Guard value
BooleanFlagCount BooleanFlagCount
}; };
@ -1440,24 +1435,6 @@ public:
bool NodeOrAncestorHasDirAuto() const bool NodeOrAncestorHasDirAuto() const
{ return HasDirAuto() || AncestorHasDirAuto(); } { return HasDirAuto() || AncestorHasDirAuto(); }
void SetIsElementInStyleScope(bool aValue) {
MOZ_ASSERT(IsElement(), "SetIsInStyleScope on a non-Element node");
SetBoolFlag(ElementIsInStyleScope, aValue);
}
void SetIsElementInStyleScope() {
MOZ_ASSERT(IsElement(), "SetIsInStyleScope on a non-Element node");
SetBoolFlag(ElementIsInStyleScope);
}
void ClearIsElementInStyleScope() {
MOZ_ASSERT(IsElement(), "ClearIsInStyleScope on a non-Element node");
ClearBoolFlag(ElementIsInStyleScope);
}
bool IsElementInStyleScope() const { return GetBoolFlag(ElementIsInStyleScope); }
void SetIsScopedStyleRoot() { SetBoolFlag(ElementIsScopedStyleRoot); }
void ClearIsScopedStyleRoot() { ClearBoolFlag(ElementIsScopedStyleRoot); }
bool IsScopedStyleRoot() { return GetBoolFlag(ElementIsScopedStyleRoot); }
protected: protected:
void SetParentIsContent(bool aValue) { SetBoolFlag(ParentIsContent, aValue); } void SetParentIsContent(bool aValue) { SetBoolFlag(ParentIsContent, aValue); }
void SetInDocument() { SetBoolFlag(IsInDocument); } void SetInDocument() { SetBoolFlag(IsInDocument); }
@ -1478,7 +1455,7 @@ protected:
bool HasLockedStyleStates() const bool HasLockedStyleStates() const
{ return GetBoolFlag(ElementHasLockedStyleStates); } { return GetBoolFlag(ElementHasLockedStyleStates); }
void SetSubtreeRootPointer(nsINode* aSubtreeRoot) void SetSubtreeRootPointer(nsINode* aSubtreeRoot)
{ {
NS_ASSERTION(aSubtreeRoot, "aSubtreeRoot can never be null!"); NS_ASSERTION(aSubtreeRoot, "aSubtreeRoot can never be null!");
NS_ASSERTION(!(IsNodeOfType(eCONTENT) && IsInDoc()), "Shouldn't be here!"); NS_ASSERTION(!(IsNodeOfType(eCONTENT) && IsInDoc()), "Shouldn't be here!");

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

@ -1155,9 +1155,6 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
NODE_NEEDS_FRAME | NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME | NODE_DESCENDANTS_NEED_FRAMES |
// And the restyle bits // And the restyle bits
ELEMENT_ALL_RESTYLE_FLAGS); ELEMENT_ALL_RESTYLE_FLAGS);
// Propagate scoped style sheet tracking bit.
SetIsElementInStyleScope(mParent->IsElementInStyleScope());
} else { } else {
// If we're not in the doc, update our subtree pointer. // If we're not in the doc, update our subtree pointer.
SetSubtreeRootPointer(aParent->SubtreeRoot()); SetSubtreeRootPointer(aParent->SubtreeRoot());
@ -3598,13 +3595,3 @@ Element::GetEditorInternal()
nsCOMPtr<nsITextControlElement> textCtrl = do_QueryInterface(this); nsCOMPtr<nsITextControlElement> textCtrl = do_QueryInterface(this);
return textCtrl ? textCtrl->GetTextEditor() : nullptr; return textCtrl ? textCtrl->GetTextEditor() : nullptr;
} }
nsresult
Element::SetBoolAttr(nsIAtom* aAttr, bool aValue)
{
if (aValue) {
return SetAttr(kNameSpaceID_None, aAttr, EmptyString(), true);
}
return UnsetAttr(kNameSpaceID_None, aAttr, true);
}

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

@ -2027,25 +2027,6 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
} }
} }
void
nsDocument::RemoveDocStyleSheetsFromStyleSets()
{
// The stylesheets should forget us
int32_t indx = mStyleSheets.Count();
while (--indx >= 0) {
nsIStyleSheet* sheet = mStyleSheets[indx];
sheet->SetOwningDocument(nullptr);
if (sheet->IsApplicable()) {
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
shell->StyleSet()->RemoveDocStyleSheet(sheet);
}
}
// XXX Tell observers?
}
}
void void
nsDocument::RemoveStyleSheetsFromStyleSets(nsCOMArray<nsIStyleSheet>& aSheets, nsStyleSet::sheetType aType) nsDocument::RemoveStyleSheetsFromStyleSets(nsCOMArray<nsIStyleSheet>& aSheets, nsStyleSet::sheetType aType)
{ {
@ -2073,7 +2054,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
NS_PRECONDITION(aURI, "Null URI passed to ResetStylesheetsToURI"); NS_PRECONDITION(aURI, "Null URI passed to ResetStylesheetsToURI");
mozAutoDocUpdate upd(this, UPDATE_STYLE, true); mozAutoDocUpdate upd(this, UPDATE_STYLE, true);
RemoveDocStyleSheetsFromStyleSets(); RemoveStyleSheetsFromStyleSets(mStyleSheets, nsStyleSet::eDocSheet);
RemoveStyleSheetsFromStyleSets(mCatalogSheets, nsStyleSet::eAgentSheet); RemoveStyleSheetsFromStyleSets(mCatalogSheets, nsStyleSet::eAgentSheet);
RemoveStyleSheetsFromStyleSets(mAdditionalSheets[eAgentSheet], nsStyleSet::eAgentSheet); RemoveStyleSheetsFromStyleSets(mAdditionalSheets[eAgentSheet], nsStyleSet::eAgentSheet);
RemoveStyleSheetsFromStyleSets(mAdditionalSheets[eUserSheet], nsStyleSet::eUserSheet); RemoveStyleSheetsFromStyleSets(mAdditionalSheets[eUserSheet], nsStyleSet::eUserSheet);
@ -3522,7 +3503,7 @@ nsDocument::RemoveStyleSheetFromStyleSets(nsIStyleSheet* aSheet)
{ {
nsCOMPtr<nsIPresShell> shell = GetShell(); nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) { if (shell) {
shell->StyleSet()->RemoveDocStyleSheet(aSheet); shell->StyleSet()->RemoveStyleSheet(nsStyleSet::eDocSheet, aSheet);
} }
} }

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

@ -1080,7 +1080,6 @@ protected:
nsCompatibility aCompatMode, nsCompatibility aCompatMode,
nsIPresShell** aInstancePtrResult); nsIPresShell** aInstancePtrResult);
void RemoveDocStyleSheetsFromStyleSets();
void RemoveStyleSheetsFromStyleSets(nsCOMArray<nsIStyleSheet>& aSheets, void RemoveStyleSheetsFromStyleSets(nsCOMArray<nsIStyleSheet>& aSheets,
nsStyleSet::sheetType aType); nsStyleSet::sheetType aType);
nsresult ResetStylesheetsToURI(nsIURI* aURI); nsresult ResetStylesheetsToURI(nsIURI* aURI);

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

@ -12,10 +12,9 @@
#include "nsStyleLinkElement.h" #include "nsStyleLinkElement.h"
#include "mozilla/css/Loader.h"
#include "mozilla/dom/Element.h"
#include "nsCSSStyleSheet.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "mozilla/css/Loader.h"
#include "nsCSSStyleSheet.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDOMComment.h" #include "nsIDOMComment.h"
#include "nsIDOMNode.h" #include "nsIDOMNode.h"
@ -27,9 +26,6 @@
#include "nsUnicharInputStream.h" #include "nsUnicharInputStream.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
nsStyleLinkElement::nsStyleLinkElement() nsStyleLinkElement::nsStyleLinkElement()
: mDontLoadStyle(false) : mDontLoadStyle(false)
, mUpdatesEnabled(true) , mUpdatesEnabled(true)
@ -207,87 +203,6 @@ nsStyleLinkElement::UpdateStyleSheetInternal(nsIDocument *aOldDocument,
aForceUpdate); aForceUpdate);
} }
static bool
IsScopedStyleElement(nsIContent* aContent)
{
// This is quicker than, say, QIing aContent to nsStyleLinkElement
// and then calling its virtual GetStyleSheetInfo method to find out
// if it is scoped.
return aContent->IsHTML(nsGkAtoms::style) &&
aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::scoped);
}
static void
SetIsElementInStyleScopeFlagOnSubtree(Element* aElement)
{
if (aElement->IsElementInStyleScope()) {
return;
}
aElement->SetIsElementInStyleScope();
nsIContent* n = aElement->GetNextNode(aElement);
while (n) {
if (n->IsElementInStyleScope()) {
n = n->GetNextNonChildNode(aElement);
} else {
if (n->IsElement()) {
n->SetIsElementInStyleScope();
}
n = n->GetNextNode(aElement);
}
}
}
static bool
HasScopedStyleSheetChild(nsIContent* aContent)
{
for (nsIContent* n = aContent->GetFirstChild(); n; n = n->GetNextSibling()) {
if (IsScopedStyleElement(n)) {
return true;
}
}
return false;
}
// Called when aElement has had a <style scoped> child removed.
static void
UpdateIsElementInStyleScopeFlagOnSubtree(Element* aElement)
{
NS_ASSERTION(aElement->IsElementInStyleScope(),
"only call UpdateIsElementInStyleScopeFlagOnSubtree on a "
"subtree that has IsElementInStyleScope boolean flag set");
if (HasScopedStyleSheetChild(aElement)) {
return;
}
aElement->ClearIsElementInStyleScope();
nsIContent* n = aElement->GetNextNode(aElement);
while (n) {
if (HasScopedStyleSheetChild(n)) {
n = n->GetNextNonChildNode(aElement);
} else {
if (n->IsElement()) {
n->ClearIsElementInStyleScope();
}
n = n->GetNextNode(aElement);
}
}
}
static Element*
GetScopeElement(nsIStyleSheet* aSheet)
{
nsRefPtr<nsCSSStyleSheet> cssStyleSheet = do_QueryObject(aSheet);
if (!cssStyleSheet) {
return nullptr;
}
return cssStyleSheet->GetScopeElement();
}
nsresult nsresult
nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument, nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
nsICSSLoaderObserver* aObserver, nsICSSLoaderObserver* aObserver,
@ -297,11 +212,6 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
{ {
*aWillNotify = false; *aWillNotify = false;
nsCOMPtr<nsIContent> thisContent;
CallQueryInterface(this, getter_AddRefs(thisContent));
Element* oldScopeElement = GetScopeElement(mStyleSheet);
if (mStyleSheet && aOldDocument) { if (mStyleSheet && aOldDocument) {
// We're removing the link element from the document, unload the // We're removing the link element from the document, unload the
// stylesheet. We want to do this even if updates are disabled, since // stylesheet. We want to do this even if updates are disabled, since
@ -311,15 +221,15 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
aOldDocument->RemoveStyleSheet(mStyleSheet); aOldDocument->RemoveStyleSheet(mStyleSheet);
aOldDocument->EndUpdate(UPDATE_STYLE); aOldDocument->EndUpdate(UPDATE_STYLE);
nsStyleLinkElement::SetStyleSheet(nullptr); nsStyleLinkElement::SetStyleSheet(nullptr);
if (oldScopeElement) {
UpdateIsElementInStyleScopeFlagOnSubtree(oldScopeElement);
}
} }
if (mDontLoadStyle || !mUpdatesEnabled) { if (mDontLoadStyle || !mUpdatesEnabled) {
return NS_OK; return NS_OK;
} }
nsCOMPtr<nsIContent> thisContent;
QueryInterface(NS_GET_IID(nsIContent), getter_AddRefs(thisContent));
NS_ENSURE_TRUE(thisContent, NS_ERROR_FAILURE); NS_ENSURE_TRUE(thisContent, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> doc = thisContent->GetDocument(); nsCOMPtr<nsIDocument> doc = thisContent->GetDocument();
@ -354,21 +264,14 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
} }
nsAutoString title, type, media; nsAutoString title, type, media;
bool isScoped;
bool isAlternate; bool isAlternate;
GetStyleSheetInfo(title, type, media, &isScoped, &isAlternate); GetStyleSheetInfo(title, type, media, &isAlternate);
if (!type.LowerCaseEqualsLiteral("text/css")) { if (!type.LowerCaseEqualsLiteral("text/css")) {
return NS_OK; return NS_OK;
} }
Element* scopeElement = isScoped ? thisContent->GetParentElement() : nullptr;
if (scopeElement) {
NS_ASSERTION(isInline, "non-inline style must not have scope element");
SetIsElementInStyleScopeFlagOnSubtree(scopeElement);
}
bool doneLoading = false; bool doneLoading = false;
nsresult rv = NS_OK; nsresult rv = NS_OK;
if (isInline) { if (isInline) {
@ -378,7 +281,7 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
// Parse the style sheet. // Parse the style sheet.
rv = doc->CSSLoader()-> rv = doc->CSSLoader()->
LoadInlineStyle(thisContent, text, mLineNumber, title, media, LoadInlineStyle(thisContent, text, mLineNumber, title, media,
scopeElement, aObserver, &doneLoading, &isAlternate); aObserver, &doneLoading, &isAlternate);
} }
else { else {
// XXXbz clone the URI here to work around content policies modifying URIs. // XXXbz clone the URI here to work around content policies modifying URIs.
@ -405,44 +308,3 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
return NS_OK; return NS_OK;
} }
void
nsStyleLinkElement::UpdateStyleSheetScopedness(bool aIsNowScoped)
{
if (!mStyleSheet) {
return;
}
nsRefPtr<nsCSSStyleSheet> cssStyleSheet = do_QueryObject(mStyleSheet);
NS_ASSERTION(cssStyleSheet, "should only call UpdateStyleSheetScope for "
"an nsCSSStyleSheet");
nsCOMPtr<nsIContent> thisContent;
CallQueryInterface(this, getter_AddRefs(thisContent));
Element* oldScopeElement = cssStyleSheet->GetScopeElement();
Element* newScopeElement = aIsNowScoped ?
thisContent->GetParentElement() :
nullptr;
if (oldScopeElement == newScopeElement) {
return;
}
nsIDocument* document = thisContent->GetOwnerDocument();
document->BeginUpdate(UPDATE_STYLE);
document->RemoveStyleSheet(mStyleSheet);
cssStyleSheet->SetScopeElement(newScopeElement);
document->AddStyleSheet(mStyleSheet);
document->EndUpdate(UPDATE_STYLE);
if (oldScopeElement) {
UpdateIsElementInStyleScopeFlagOnSubtree(oldScopeElement);
}
if (newScopeElement) {
SetIsElementInStyleScopeFlagOnSubtree(newScopeElement);
}
}

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

@ -69,13 +69,10 @@ protected:
nsresult UpdateStyleSheetInternal(nsIDocument *aOldDocument, nsresult UpdateStyleSheetInternal(nsIDocument *aOldDocument,
bool aForceUpdate = false); bool aForceUpdate = false);
void UpdateStyleSheetScopedness(bool aIsNowScoped);
virtual already_AddRefed<nsIURI> GetStyleSheetURL(bool* aIsInline) = 0; virtual already_AddRefed<nsIURI> GetStyleSheetURL(bool* aIsInline) = 0;
virtual void GetStyleSheetInfo(nsAString& aTitle, virtual void GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType, nsAString& aType,
nsAString& aMedia, nsAString& aMedia,
bool* aIsScoped,
bool* aIsAlternate) = 0; bool* aIsAlternate) = 0;
nsIStyleSheet* GetStyleSheet() { return mStyleSheet; } nsIStyleSheet* GetStyleSheet() { return mStyleSheet; }

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

@ -1870,6 +1870,16 @@ nsGenericHTMLElement::SetAttrHelper(nsIAtom* aAttr, const nsAString& aValue)
return SetAttr(kNameSpaceID_None, aAttr, aValue, true); return SetAttr(kNameSpaceID_None, aAttr, aValue, true);
} }
nsresult
nsGenericHTMLElement::SetBoolAttr(nsIAtom* aAttr, bool aValue)
{
if (aValue) {
return SetAttr(kNameSpaceID_None, aAttr, EmptyString(), true);
}
return UnsetAttr(kNameSpaceID_None, aAttr, true);
}
int32_t int32_t
nsGenericHTMLElement::GetIntAttr(nsIAtom* aAttr, int32_t aDefault) const nsGenericHTMLElement::GetIntAttr(nsIAtom* aAttr, int32_t aDefault) const
{ {

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

@ -849,6 +849,29 @@ protected:
*/ */
NS_HIDDEN_(nsresult) SetAttrHelper(nsIAtom* aAttr, const nsAString& aValue); NS_HIDDEN_(nsresult) SetAttrHelper(nsIAtom* aAttr, const nsAString& aValue);
/**
* Helper method for NS_IMPL_BOOL_ATTR macro.
* Gets value of boolean attribute. Only works for attributes in null
* namespace.
*
* @param aAttr name of attribute.
* @param aValue Boolean value of attribute.
*/
NS_HIDDEN_(bool) GetBoolAttr(nsIAtom* aAttr) const
{
return HasAttr(kNameSpaceID_None, aAttr);
}
/**
* Helper method for NS_IMPL_BOOL_ATTR macro.
* Sets value of boolean attribute by removing attribute or setting it to
* the empty string. Only works for attributes in null namespace.
*
* @param aAttr name of attribute.
* @param aValue Boolean value of attribute.
*/
NS_HIDDEN_(nsresult) SetBoolAttr(nsIAtom* aAttr, bool aValue);
/** /**
* Helper method for NS_IMPL_INT_ATTR macro. * Helper method for NS_IMPL_INT_ATTR macro.
* Gets the integer-value of an attribute, returns specified default value * Gets the integer-value of an attribute, returns specified default value
@ -1211,6 +1234,24 @@ protected:
return SetAttrHelper(nsGkAtoms::_atom, aValue); \ return SetAttrHelper(nsGkAtoms::_atom, aValue); \
} }
/**
* A macro to implement the getter and setter for a given boolean
* valued content property. The method uses the generic GetAttr and
* SetAttr methods.
*/
#define NS_IMPL_BOOL_ATTR(_class, _method, _atom) \
NS_IMETHODIMP \
_class::Get##_method(bool* aValue) \
{ \
*aValue = GetBoolAttr(nsGkAtoms::_atom); \
return NS_OK; \
} \
NS_IMETHODIMP \
_class::Set##_method(bool aValue) \
{ \
return SetBoolAttr(nsGkAtoms::_atom, aValue); \
}
/** /**
* A macro to implement the getter and setter for a given integer * A macro to implement the getter and setter for a given integer
* valued content property. The method uses the generic GetAttr and * valued content property. The method uses the generic GetAttr and

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

@ -103,7 +103,6 @@ protected:
virtual void GetStyleSheetInfo(nsAString& aTitle, virtual void GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType, nsAString& aType,
nsAString& aMedia, nsAString& aMedia,
bool* aIsScoped,
bool* aIsAlternate); bool* aIsAlternate);
virtual CORSMode GetCORSMode() const; virtual CORSMode GetCORSMode() const;
protected: protected:
@ -432,13 +431,11 @@ void
nsHTMLLinkElement::GetStyleSheetInfo(nsAString& aTitle, nsHTMLLinkElement::GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType, nsAString& aType,
nsAString& aMedia, nsAString& aMedia,
bool* aIsScoped,
bool* aIsAlternate) bool* aIsAlternate)
{ {
aTitle.Truncate(); aTitle.Truncate();
aType.Truncate(); aType.Truncate();
aMedia.Truncate(); aMedia.Truncate();
*aIsScoped = false;
*aIsAlternate = false; *aIsAlternate = false;
nsAutoString rel; nsAutoString rel;

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

@ -86,7 +86,6 @@ protected:
void GetStyleSheetInfo(nsAString& aTitle, void GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType, nsAString& aType,
nsAString& aMedia, nsAString& aMedia,
bool* aIsScoped,
bool* aIsAlternate); bool* aIsAlternate);
/** /**
* Common method to call from the various mutation observer methods. * Common method to call from the various mutation observer methods.
@ -165,7 +164,6 @@ nsHTMLStyleElement::SetDisabled(bool aDisabled)
} }
NS_IMPL_STRING_ATTR(nsHTMLStyleElement, Media, media) NS_IMPL_STRING_ATTR(nsHTMLStyleElement, Media, media)
NS_IMPL_BOOL_ATTR(nsHTMLStyleElement, Scoped, scoped)
NS_IMPL_STRING_ATTR(nsHTMLStyleElement, Type, type) NS_IMPL_STRING_ATTR(nsHTMLStyleElement, Type, type)
void void
@ -244,14 +242,11 @@ nsHTMLStyleElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
{ {
nsresult rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix, nsresult rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix,
aValue, aNotify); aValue, aNotify);
if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None) { if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None &&
if (aName == nsGkAtoms::title || (aName == nsGkAtoms::title ||
aName == nsGkAtoms::media || aName == nsGkAtoms::media ||
aName == nsGkAtoms::type) { aName == nsGkAtoms::type)) {
UpdateStyleSheetInternal(nullptr, true); UpdateStyleSheetInternal(nullptr, true);
} else if (aName == nsGkAtoms::scoped) {
UpdateStyleSheetScopedness(true);
}
} }
return rv; return rv;
@ -263,14 +258,11 @@ nsHTMLStyleElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
{ {
nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute, nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute,
aNotify); aNotify);
if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None) { if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None &&
if (aAttribute == nsGkAtoms::title || (aAttribute == nsGkAtoms::title ||
aAttribute == nsGkAtoms::media || aAttribute == nsGkAtoms::media ||
aAttribute == nsGkAtoms::type) { aAttribute == nsGkAtoms::type)) {
UpdateStyleSheetInternal(nullptr, true); UpdateStyleSheetInternal(nullptr, true);
} else if (aAttribute == nsGkAtoms::scoped) {
UpdateStyleSheetScopedness(false);
}
} }
return rv; return rv;
@ -306,7 +298,6 @@ void
nsHTMLStyleElement::GetStyleSheetInfo(nsAString& aTitle, nsHTMLStyleElement::GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType, nsAString& aType,
nsAString& aMedia, nsAString& aMedia,
bool* aIsScoped,
bool* aIsAlternate) bool* aIsAlternate)
{ {
aTitle.Truncate(); aTitle.Truncate();
@ -326,8 +317,6 @@ nsHTMLStyleElement::GetStyleSheetInfo(nsAString& aTitle,
GetAttr(kNameSpaceID_None, nsGkAtoms::type, aType); GetAttr(kNameSpaceID_None, nsGkAtoms::type, aType);
*aIsScoped = HasAttr(kNameSpaceID_None, nsGkAtoms::scoped);
nsAutoString mimeType; nsAutoString mimeType;
nsAutoString notUsed; nsAutoString notUsed;
nsContentUtils::SplitMimeType(aType, mimeType, notUsed); nsContentUtils::SplitMimeType(aType, mimeType, notUsed);

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

@ -337,7 +337,6 @@ MOCHITEST_FILES = \
test_formelements.html \ test_formelements.html \
test_rowscollection.html \ test_rowscollection.html \
test_mozaudiochannel.html \ test_mozaudiochannel.html \
test_style_attributes_reflection.html \
$(NULL) $(NULL)

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

@ -1,41 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Test for HTMLStyleElement attributes reflection</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="reflect.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for HTMLStyleElement attributes reflection **/
var e = document.createElement("style");
// .media
reflectString({
element: e,
attribute: "media"
});
// .type
reflectString({
element: e,
attribute: "type"
});
// .scoped
reflectBoolean({
element: e,
attribute: "scoped"
});
</script>
</pre>
</body>
</html>

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

@ -3,7 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/Element.h"
#include "mozilla/dom/SVGStyleElement.h" #include "mozilla/dom/SVGStyleElement.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsStubMutationObserver.h" #include "nsStubMutationObserver.h"
@ -99,14 +98,12 @@ SVGStyleElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
{ {
nsresult rv = SVGStyleElementBase::SetAttr(aNameSpaceID, aName, aPrefix, nsresult rv = SVGStyleElementBase::SetAttr(aNameSpaceID, aName, aPrefix,
aValue, aNotify); aValue, aNotify);
if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None) { if (NS_SUCCEEDED(rv)) {
if (aName == nsGkAtoms::title || UpdateStyleSheetInternal(nullptr,
aName == nsGkAtoms::media || aNameSpaceID == kNameSpaceID_None &&
aName == nsGkAtoms::type) { (aName == nsGkAtoms::title ||
UpdateStyleSheetInternal(nullptr, true); aName == nsGkAtoms::media ||
} else if (aName == nsGkAtoms::scoped) { aName == nsGkAtoms::type));
UpdateStyleSheetScopedness(true);
}
} }
return rv; return rv;
@ -118,14 +115,12 @@ SVGStyleElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
{ {
nsresult rv = SVGStyleElementBase::UnsetAttr(aNameSpaceID, aAttribute, nsresult rv = SVGStyleElementBase::UnsetAttr(aNameSpaceID, aAttribute,
aNotify); aNotify);
if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None) { if (NS_SUCCEEDED(rv)) {
if (aAttribute == nsGkAtoms::title || UpdateStyleSheetInternal(nullptr,
aAttribute == nsGkAtoms::media || aNameSpaceID == kNameSpaceID_None &&
aAttribute == nsGkAtoms::type) { (aAttribute == nsGkAtoms::title ||
UpdateStyleSheetInternal(nullptr, true); aAttribute == nsGkAtoms::media ||
} else if (aAttribute == nsGkAtoms::scoped) { aAttribute == nsGkAtoms::type));
UpdateStyleSheetScopedness(false);
}
} }
return rv; return rv;
@ -214,10 +209,56 @@ SVGStyleElement::SetXmlspace(const nsAString & aXmlspace, ErrorResult& rv)
rv = SetAttr(kNameSpaceID_XML, nsGkAtoms::space, aXmlspace, true); rv = SetAttr(kNameSpaceID_XML, nsGkAtoms::space, aXmlspace, true);
} }
NS_IMPL_STRING_ATTR(SVGStyleElement, Media, media) /* attribute DOMString type; */
NS_IMPL_BOOL_ATTR(SVGStyleElement, Scoped, scoped) NS_IMETHODIMP SVGStyleElement::GetType(nsAString & aType)
NS_IMPL_STRING_ATTR(SVGStyleElement, Title, title) {
NS_IMPL_STRING_ATTR(SVGStyleElement, Type, type) GetAttr(kNameSpaceID_None, nsGkAtoms::type, aType);
return NS_OK;
}
NS_IMETHODIMP SVGStyleElement::SetType(const nsAString & aType)
{
return SetAttr(kNameSpaceID_None, nsGkAtoms::type, aType, true);
}
void
SVGStyleElement::SetType(const nsAString & aType, ErrorResult& rv)
{
rv = SetAttr(kNameSpaceID_None, nsGkAtoms::type, aType, true);
}
/* attribute DOMString media; */
NS_IMETHODIMP SVGStyleElement::GetMedia(nsAString & aMedia)
{
GetAttr(kNameSpaceID_None, nsGkAtoms::media, aMedia);
return NS_OK;
}
NS_IMETHODIMP SVGStyleElement::SetMedia(const nsAString & aMedia)
{
return SetAttr(kNameSpaceID_None, nsGkAtoms::media, aMedia, true);
}
void
SVGStyleElement::SetMedia(const nsAString & aMedia, ErrorResult& rv)
{
rv = SetAttr(kNameSpaceID_None, nsGkAtoms::media, aMedia, true);
}
/* attribute DOMString title; */
NS_IMETHODIMP SVGStyleElement::GetTitle(nsAString & aTitle)
{
GetAttr(kNameSpaceID_None, nsGkAtoms::title, aTitle);
return NS_OK;
}
NS_IMETHODIMP SVGStyleElement::SetTitle(const nsAString & aTitle)
{
return SetAttr(kNameSpaceID_None, nsGkAtoms::title, aTitle, true);
}
void
SVGStyleElement::SetTitle(const nsAString & aTitle, ErrorResult& rv)
{
rv = SetAttr(kNameSpaceID_None, nsGkAtoms::title, aTitle, true);
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// nsStyleLinkElement methods // nsStyleLinkElement methods
@ -233,7 +274,6 @@ void
SVGStyleElement::GetStyleSheetInfo(nsAString& aTitle, SVGStyleElement::GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType, nsAString& aType,
nsAString& aMedia, nsAString& aMedia,
bool* aIsScoped,
bool* aIsAlternate) bool* aIsAlternate)
{ {
*aIsAlternate = false; *aIsAlternate = false;
@ -253,8 +293,6 @@ SVGStyleElement::GetStyleSheetInfo(nsAString& aTitle,
aType.AssignLiteral("text/css"); aType.AssignLiteral("text/css");
} }
*aIsScoped = HasAttr(kNameSpaceID_None, nsGkAtoms::scoped);
return; return;
} }

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

@ -97,7 +97,6 @@ protected:
void GetStyleSheetInfo(nsAString& aTitle, void GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType, nsAString& aType,
nsAString& aMedia, nsAString& aMedia,
bool* aIsScoped,
bool* aIsAlternate); bool* aIsAlternate);
virtual CORSMode GetCORSMode() const; virtual CORSMode GetCORSMode() const;

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

@ -101,8 +101,7 @@ nsXBLPrototypeResources::FlushSkinSheets()
mStyleSheetList.AppendElement(newSheet); mStyleSheetList.AppendElement(newSheet);
} }
mRuleProcessor = new nsCSSRuleProcessor(mStyleSheetList, mRuleProcessor = new nsCSSRuleProcessor(mStyleSheetList,
nsStyleSet::eDocSheet, nsStyleSet::eDocSheet);
nullptr);
return NS_OK; return NS_OK;
} }

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

@ -167,8 +167,7 @@ nsXBLResourceLoader::StyleSheetLoaded(nsCSSStyleSheet* aSheet,
// All stylesheets are loaded. // All stylesheets are loaded.
mResources->mRuleProcessor = mResources->mRuleProcessor =
new nsCSSRuleProcessor(mResources->mStyleSheetList, new nsCSSRuleProcessor(mResources->mStyleSheetList,
nsStyleSet::eDocSheet, nsStyleSet::eDocSheet);
nullptr);
// XXX Check for mPendingScripts when scripts also come online. // XXX Check for mPendingScripts when scripts also come online.
if (!mInLoadResourcesFunc) if (!mInLoadResourcesFunc)

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

@ -3,7 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/Element.h"
#include "nsIDOMLinkStyle.h" #include "nsIDOMLinkStyle.h"
#include "nsIDOMStyleSheet.h" #include "nsIDOMStyleSheet.h"
#include "nsIDocument.h" #include "nsIDocument.h"
@ -18,7 +17,6 @@
#include "nsContentUtils.h" #include "nsContentUtils.h"
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom;
class nsXMLStylesheetPI : public nsXMLProcessingInstruction, class nsXMLStylesheetPI : public nsXMLProcessingInstruction,
public nsStyleLinkElement public nsStyleLinkElement
@ -59,7 +57,6 @@ protected:
void GetStyleSheetInfo(nsAString& aTitle, void GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType, nsAString& aType,
nsAString& aMedia, nsAString& aMedia,
bool* aIsScoped,
bool* aIsAlternate); bool* aIsAlternate);
virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo, virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo,
bool aCloneText) const; bool aCloneText) const;
@ -180,13 +177,11 @@ void
nsXMLStylesheetPI::GetStyleSheetInfo(nsAString& aTitle, nsXMLStylesheetPI::GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType, nsAString& aType,
nsAString& aMedia, nsAString& aMedia,
bool* aIsScoped,
bool* aIsAlternate) bool* aIsAlternate)
{ {
aTitle.Truncate(); aTitle.Truncate();
aType.Truncate(); aType.Truncate();
aMedia.Truncate(); aMedia.Truncate();
*aIsScoped = false;
*aIsAlternate = false; *aIsAlternate = false;
// xml-stylesheet PI is special only in prolog // xml-stylesheet PI is special only in prolog

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

@ -16,11 +16,10 @@
* http://www.whatwg.org/specs/web-apps/current-work/ * http://www.whatwg.org/specs/web-apps/current-work/
*/ */
[scriptable, uuid(f9db1001-faae-46e1-b85f-0a0afb80c5b2)] [scriptable, uuid(830D9170-F8EB-4749-B721-16D60D6B0F1B)]
interface nsIDOMHTMLStyleElement : nsIDOMHTMLElement interface nsIDOMHTMLStyleElement : nsIDOMHTMLElement
{ {
attribute boolean disabled; attribute boolean disabled;
attribute DOMString media; attribute DOMString media;
attribute DOMString type; attribute DOMString type;
attribute boolean scoped;
}; };

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

@ -5,7 +5,7 @@
#include "nsIDOMSVGElement.idl" #include "nsIDOMSVGElement.idl"
[scriptable, uuid(2fecabb2-4671-4553-9e99-1b8167e3c131)] [scriptable, uuid(53DA8F96-E2F0-45AC-B8AE-3CACC5981383)]
interface nsIDOMSVGStyleElement interface nsIDOMSVGStyleElement
: nsIDOMSVGElement : nsIDOMSVGElement
{ {
@ -17,5 +17,4 @@ interface nsIDOMSVGStyleElement
// raises DOMException on setting // raises DOMException on setting
attribute DOMString title; attribute DOMString title;
// raises DOMException on setting // raises DOMException on setting
attribute boolean scoped;
}; };

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

@ -13,9 +13,11 @@
interface SVGStyleElement : SVGElement { interface SVGStyleElement : SVGElement {
[SetterThrows] [SetterThrows]
attribute DOMString xmlspace; // Spec claims this should be on SVGElement attribute DOMString xmlspace; // Spec claims this should be on SVGElement
[SetterThrows]
attribute DOMString type; attribute DOMString type;
[SetterThrows]
attribute DOMString media; attribute DOMString media;
[SetterThrows]
attribute DOMString title; attribute DOMString title;
attribute bool scoped;
}; };

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

@ -2294,7 +2294,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
nullptr, aFrameState); nullptr, aFrameState);
// Initialize the ancestor filter with null for now; we'll push // Initialize the ancestor filter with null for now; we'll push
// aDocElement once we finish resolving style for it. // aDocElement once we finish resolving style for it.
state.mTreeMatchContext.InitAncestors(nullptr); state.mTreeMatchContext.mAncestorFilter.Init(nullptr);
// XXXbz why, exactly? // XXXbz why, exactly?
if (!mTempFrameTreeState) if (!mTempFrameTreeState)
@ -2361,8 +2361,8 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
return NS_OK; return NS_OK;
} }
TreeMatchContext::AutoAncestorPusher AncestorFilter::AutoAncestorPusher
ancestorPusher(true, state.mTreeMatchContext, aDocElement); ancestorPusher(true, state.mTreeMatchContext.mAncestorFilter, aDocElement);
// Make sure to start any background image loads for the root element now. // Make sure to start any background image loads for the root element now.
styleContext->StartBackgroundImageLoads(); styleContext->StartBackgroundImageLoads();
@ -3571,9 +3571,9 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
// frames constructed), this is the best place to bottleneck the // frames constructed), this is the best place to bottleneck the
// pushing of the content instead of having to do it in multiple // pushing of the content instead of having to do it in multiple
// places. // places.
TreeMatchContext::AutoAncestorPusher AncestorFilter::AutoAncestorPusher
ancestorPusher(aState.mTreeMatchContext.mAncestorFilter.HasFilter(), ancestorPusher(aState.mTreeMatchContext.mAncestorFilter.HasFilter(),
aState.mTreeMatchContext, aState.mTreeMatchContext.mAncestorFilter,
content->IsElement() ? content->AsElement() : nullptr); content->IsElement() ? content->AsElement() : nullptr);
nsIFrame* newFrame; nsIFrame* newFrame;
@ -3807,9 +3807,9 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsFrameConstructorState& aState,
nsFrameConstructorState::PendingBindingAutoPusher pusher(aState, nsFrameConstructorState::PendingBindingAutoPusher pusher(aState,
aPendingBinding); aPendingBinding);
TreeMatchContext::AutoAncestorPusher AncestorFilter::AutoAncestorPusher
ancestorPusher(aState.mTreeMatchContext.mAncestorFilter.HasFilter(), ancestorPusher(aState.mTreeMatchContext.mAncestorFilter.HasFilter(),
aState.mTreeMatchContext, aState.mTreeMatchContext.mAncestorFilter,
aParent->AsElement()); aParent->AsElement());
nsIAnonymousContentCreator* creator = do_QueryFrame(aParentFrame); nsIAnonymousContentCreator* creator = do_QueryFrame(aParentFrame);
@ -6608,7 +6608,7 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
nsFrameConstructorState state(mPresShell, mFixedContainingBlock, nsFrameConstructorState state(mPresShell, mFixedContainingBlock,
GetAbsoluteContainingBlock(parentFrame), GetAbsoluteContainingBlock(parentFrame),
GetFloatContainingBlock(parentFrame)); GetFloatContainingBlock(parentFrame));
state.mTreeMatchContext.InitAncestors(aContainer->AsElement()); state.mTreeMatchContext.mAncestorFilter.Init(aContainer->AsElement());
// See if the containing block has :first-letter style applied. // See if the containing block has :first-letter style applied.
bool haveFirstLetterStyle = false, haveFirstLineStyle = false; bool haveFirstLetterStyle = false, haveFirstLineStyle = false;
@ -7044,9 +7044,9 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
GetAbsoluteContainingBlock(parentFrame), GetAbsoluteContainingBlock(parentFrame),
GetFloatContainingBlock(parentFrame), GetFloatContainingBlock(parentFrame),
aFrameState); aFrameState);
state.mTreeMatchContext.InitAncestors(aContainer ? state.mTreeMatchContext.mAncestorFilter.Init(aContainer ?
aContainer->AsElement() : aContainer->AsElement() :
nullptr); nullptr);
// Recover state for the containing block - we need to know if // Recover state for the containing block - we need to know if
// it has :first-letter or :first-line style applied to it. The // it has :first-letter or :first-line style applied to it. The
@ -11281,9 +11281,9 @@ nsCSSFrameConstructor::BuildInlineChildItems(nsFrameConstructorState& aState,
nsStyleContext* const parentStyleContext = aParentItem.mStyleContext; nsStyleContext* const parentStyleContext = aParentItem.mStyleContext;
nsIContent* const parentContent = aParentItem.mContent; nsIContent* const parentContent = aParentItem.mContent;
TreeMatchContext::AutoAncestorPusher AncestorFilter::AutoAncestorPusher
ancestorPusher(aState.mTreeMatchContext.mAncestorFilter.HasFilter(), ancestorPusher(aState.mTreeMatchContext.mAncestorFilter.HasFilter(),
aState.mTreeMatchContext, aState.mTreeMatchContext.mAncestorFilter,
parentContent->AsElement()); parentContent->AsElement());
CreateGeneratedContentItem(aState, nullptr, parentContent, parentStyleContext, CreateGeneratedContentItem(aState, nullptr, parentContent, parentStyleContext,

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

@ -1379,8 +1379,8 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
if (checkUndisplayed && mUndisplayedMap) { if (checkUndisplayed && mUndisplayedMap) {
UndisplayedNode* undisplayed = UndisplayedNode* undisplayed =
mUndisplayedMap->GetFirstNode(undisplayedParent); mUndisplayedMap->GetFirstNode(undisplayedParent);
for (TreeMatchContext::AutoAncestorPusher for (AncestorFilter::AutoAncestorPusher
pushAncestor(undisplayed, aTreeMatchContext, pushAncestor(undisplayed, aTreeMatchContext.mAncestorFilter,
undisplayedParent ? undisplayedParent->AsElement() undisplayedParent ? undisplayedParent->AsElement()
: nullptr); : nullptr);
undisplayed; undisplayed = undisplayed->mNext) { undisplayed; undisplayed = undisplayed->mNext) {
@ -1536,9 +1536,9 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
// now do children // now do children
nsIFrame::ChildListIterator lists(aFrame); nsIFrame::ChildListIterator lists(aFrame);
for (TreeMatchContext::AutoAncestorPusher for (AncestorFilter::AutoAncestorPusher
pushAncestor(!lists.IsDone(), pushAncestor(!lists.IsDone(),
aTreeMatchContext, aTreeMatchContext.mAncestorFilter,
content && content->IsElement() ? content->AsElement() content && content->IsElement() ? content->AsElement()
: nullptr); : nullptr);
!lists.IsDone(); lists.Next()) { !lists.IsDone(); lists.Next()) {
@ -1680,7 +1680,7 @@ nsFrameManager::ComputeStyleChangeFor(nsIFrame *aFrame,
nsIContent *parent = content ? content->GetParent() : nullptr; nsIContent *parent = content ? content->GetParent() : nullptr;
Element *parentElement = Element *parentElement =
parent && parent->IsElement() ? parent->AsElement() : nullptr; parent && parent->IsElement() ? parent->AsElement() : nullptr;
treeMatchContext.InitAncestors(parentElement); treeMatchContext.mAncestorFilter.Init(parentElement);
nsTArray<nsIContent*> visibleKidsOfHiddenElement; nsTArray<nsIContent*> visibleKidsOfHiddenElement;
do { do {
// Outer loop over special siblings // Outer loop over special siblings

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

@ -1424,9 +1424,6 @@ protected:
// re-use old pixels. // re-use old pixels.
RenderFlags mRenderFlags; RenderFlags mRenderFlags;
// Indicates that the whole document must be restyled. Changes to scoped
// style sheets are recorded in mChangedScopeStyleRoots rather than here
// in mStylesHaveChanged.
bool mStylesHaveChanged : 1; bool mStylesHaveChanged : 1;
bool mDidInitialize : 1; bool mDidInitialize : 1;
bool mIsDestroying : 1; bool mIsDestroying : 1;
@ -1450,15 +1447,6 @@ protected:
bool mSuppressInterruptibleReflows : 1; bool mSuppressInterruptibleReflows : 1;
bool mScrollPositionClampingScrollPortSizeSet : 1; bool mScrollPositionClampingScrollPortSizeSet : 1;
// List of subtrees rooted at style scope roots that need to be restyled.
// When a change to a scoped style sheet is made, we add the style scope
// root to this array rather than setting mStylesHaveChanged = true, since
// we know we don't need to restyle the whole document. However, if in the
// same update block we have already had other changes that require
// the whole document to be restyled (i.e., mStylesHaveChanged is already
// true), then we don't bother adding the scope root here.
nsAutoTArray<nsRefPtr<mozilla::dom::Element>,1> mChangedScopeStyleRoots;
static nsIContent* gKeyDownTarget; static nsIContent* gKeyDownTarget;
// Cached font inflation values. This is done to prevent changing of font // Cached font inflation values. This is done to prevent changing of font

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

@ -33,7 +33,7 @@
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDOMXULDocument.h" #include "nsIDOMXULDocument.h"
#include "nsCSSStyleSheet.h" #include "nsCSSStyleSheet.h" // XXX for UA sheet loading hack, can this go away please?
#include "nsIDOMCSSStyleSheet.h" // for Pref-related rule management (bugs 22963,20760,31816) #include "nsIDOMCSSStyleSheet.h" // for Pref-related rule management (bugs 22963,20760,31816)
#include "nsAnimationManager.h" #include "nsAnimationManager.h"
#include "nsINameSpaceManager.h" // for Pref-related rule management (bugs 22963,20760,31816) #include "nsINameSpaceManager.h" // for Pref-related rule management (bugs 22963,20760,31816)
@ -2419,7 +2419,7 @@ PresShell::EndUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
if (aUpdateType & UPDATE_STYLE) { if (aUpdateType & UPDATE_STYLE) {
mStyleSet->EndUpdate(); mStyleSet->EndUpdate();
if (mStylesHaveChanged || !mChangedScopeStyleRoots.IsEmpty()) if (mStylesHaveChanged)
ReconstructStyleData(); ReconstructStyleData();
} }
@ -4170,15 +4170,6 @@ PresShell::ReconstructFrames(void)
void void
nsIPresShell::ReconstructStyleDataInternal() nsIPresShell::ReconstructStyleDataInternal()
{ {
nsAutoTArray<nsRefPtr<mozilla::dom::Element>,1> scopeRoots;
mChangedScopeStyleRoots.SwapElements(scopeRoots);
if (mStylesHaveChanged) {
// If we need to restyle everything, no need to restyle individual
// scoped style roots.
scopeRoots.Clear();
}
mStylesHaveChanged = false; mStylesHaveChanged = false;
if (mIsDestroying) { if (mIsDestroying) {
@ -4202,19 +4193,7 @@ nsIPresShell::ReconstructStyleDataInternal()
return; return;
} }
if (scopeRoots.IsEmpty()) { mFrameConstructor->PostRestyleEvent(root, eRestyle_Subtree, NS_STYLE_HINT_NONE);
// If scopeRoots is empty, we know that mStylesHaveChanged was true at
// the beginning of this function, and that we need to restyle the whole
// document.
mFrameConstructor->PostRestyleEvent(root, eRestyle_Subtree,
NS_STYLE_HINT_NONE);
} else {
for (uint32_t i = 0; i < scopeRoots.Length(); i++) {
Element* scopeRoot = scopeRoots[i];
mFrameConstructor->PostRestyleEvent(scopeRoot, eRestyle_Subtree,
NS_STYLE_HINT_NONE);
}
}
} }
void void
@ -4223,24 +4202,6 @@ nsIPresShell::ReconstructStyleDataExternal()
ReconstructStyleDataInternal(); ReconstructStyleDataInternal();
} }
void
PresShell::RecordStyleSheetChange(nsIStyleSheet* aStyleSheet)
{
if (mStylesHaveChanged)
return;
nsRefPtr<nsCSSStyleSheet> cssStyleSheet = do_QueryObject(aStyleSheet);
if (cssStyleSheet) {
Element* scopeElement = cssStyleSheet->GetScopeElement();
if (scopeElement) {
mChangedScopeStyleRoots.AppendElement(scopeElement);
return;
}
}
mStylesHaveChanged = true;
}
void void
PresShell::StyleSheetAdded(nsIDocument *aDocument, PresShell::StyleSheetAdded(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet, nsIStyleSheet* aStyleSheet,
@ -4250,7 +4211,7 @@ PresShell::StyleSheetAdded(nsIDocument *aDocument,
NS_PRECONDITION(aStyleSheet, "Must have a style sheet!"); NS_PRECONDITION(aStyleSheet, "Must have a style sheet!");
if (aStyleSheet->IsApplicable() && aStyleSheet->HasRules()) { if (aStyleSheet->IsApplicable() && aStyleSheet->HasRules()) {
RecordStyleSheetChange(aStyleSheet); mStylesHaveChanged = true;
} }
} }
@ -4263,7 +4224,7 @@ PresShell::StyleSheetRemoved(nsIDocument *aDocument,
NS_PRECONDITION(aStyleSheet, "Must have a style sheet!"); NS_PRECONDITION(aStyleSheet, "Must have a style sheet!");
if (aStyleSheet->IsApplicable() && aStyleSheet->HasRules()) { if (aStyleSheet->IsApplicable() && aStyleSheet->HasRules()) {
RecordStyleSheetChange(aStyleSheet); mStylesHaveChanged = true;
} }
} }
@ -4273,7 +4234,7 @@ PresShell::StyleSheetApplicableStateChanged(nsIDocument *aDocument,
bool aApplicable) bool aApplicable)
{ {
if (aStyleSheet->HasRules()) { if (aStyleSheet->HasRules()) {
RecordStyleSheetChange(aStyleSheet); mStylesHaveChanged = true;
} }
} }
@ -4283,7 +4244,7 @@ PresShell::StyleRuleChanged(nsIDocument *aDocument,
nsIStyleRule* aOldStyleRule, nsIStyleRule* aOldStyleRule,
nsIStyleRule* aNewStyleRule) nsIStyleRule* aNewStyleRule)
{ {
RecordStyleSheetChange(aStyleSheet); mStylesHaveChanged = true;
} }
void void
@ -4291,7 +4252,7 @@ PresShell::StyleRuleAdded(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet, nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule) nsIStyleRule* aStyleRule)
{ {
RecordStyleSheetChange(aStyleSheet); mStylesHaveChanged = true;
} }
void void
@ -4299,7 +4260,7 @@ PresShell::StyleRuleRemoved(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet, nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule) nsIStyleRule* aStyleRule)
{ {
RecordStyleSheetChange(aStyleSheet); mStylesHaveChanged = true;
} }
nsIFrame* nsIFrame*

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

@ -440,8 +440,6 @@ protected:
void ShowEventTargetDebug(); void ShowEventTargetDebug();
#endif #endif
void RecordStyleSheetChange(nsIStyleSheet* aStyleSheet);
/** /**
* methods that manage rules that are used to implement the associated preferences * methods that manage rules that are used to implement the associated preferences
* - initially created for bugs 31816, 20760, 22963 * - initially created for bugs 31816, 20760, 22963

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

@ -238,9 +238,6 @@ include position-dynamic-changes/reftest.list
include printing/reftest.list include printing/reftest.list
include pagination/reftest.list include pagination/reftest.list
# <style scoped>
include scoped-style/reftest.list
# scrolling # scrolling
include scrolling/reftest.list include scrolling/reftest.list

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

@ -1,51 +0,0 @@
== scoped-style-001.html scoped-style-001-ref.html
== scoped-style-002.html scoped-style-002-ref.html
== scoped-style-003.html scoped-style-003-ref.html
== scoped-style-004.html scoped-style-004-ref.html
== scoped-style-005.html scoped-style-005-ref.html
== scoped-style-006.html scoped-style-006-ref.html
== scoped-style-007.html scoped-style-007-ref.html
== scoped-style-008.html scoped-style-008-ref.html
== scoped-style-009.html scoped-style-009-ref.html
== scoped-style-010.html scoped-style-010-ref.html
== scoped-style-011.html scoped-style-011-ref.html
== scoped-style-012.html scoped-style-012-ref.html
== scoped-style-013.html scoped-style-013-ref.html
== scoped-style-014.html scoped-style-014-ref.html
== scoped-style-015.html scoped-style-015-ref.html
== scoped-style-016.html scoped-style-016-ref.html
== scoped-style-017.html scoped-style-017-ref.html
== scoped-style-018.html scoped-style-018-ref.html
== scoped-style-019.svg scoped-style-019-ref.svg
== scoped-style-020.html scoped-style-020-ref.html
== scoped-style-021.html scoped-style-021-ref.html
== scoped-style-important-001.html scoped-style-important-001-ref.html
== scoped-style-important-002.html scoped-style-important-002-ref.html
== scoped-style-important-003.html scoped-style-important-003-ref.html
== scoped-style-important-004.html scoped-style-important-004-ref.html
== scoped-style-important-005.html scoped-style-important-005-ref.html
== scoped-style-important-006.html scoped-style-important-006-ref.html
== scoped-style-important-007.html scoped-style-important-007-ref.html
== scoped-style-dynamic-001.html scoped-style-dynamic-001-ref.html
== scoped-style-dynamic-002.html scoped-style-dynamic-002-ref.html
== scoped-style-dynamic-003.html scoped-style-dynamic-003-ref.html
== scoped-style-dynamic-004.html scoped-style-dynamic-004-ref.html
== scoped-style-dynamic-005.html scoped-style-dynamic-005-ref.html
== scoped-style-dynamic-006.html scoped-style-dynamic-006-ref.html
== scoped-style-dynamic-007.html scoped-style-dynamic-007-ref.html
== scoped-style-dynamic-008.html scoped-style-dynamic-008-ref.html
== scoped-style-dynamic-009.html scoped-style-dynamic-009-ref.html
== scoped-style-dynamic-010.html scoped-style-dynamic-010-ref.html
== scoped-style-dynamic-011.html scoped-style-dynamic-011-ref.html
== scoped-style-dynamic-012.svg scoped-style-dynamic-012-ref.svg
== scoped-style-dynamic-013.svg scoped-style-dynamic-013-ref.svg
== scoped-style-dynamic-014.svg scoped-style-dynamic-014-ref.svg
== scoped-style-dynamic-015.svg scoped-style-dynamic-015-ref.svg
== scoped-style-import.html scoped-style-import-ref.html
== scoped-style-media.html scoped-style-media-ref.html
== scoped-style-namespace.html scoped-style-namespace-ref.html
== scoped-style-charset.html scoped-style-charset-ref.html
== scoped-style-document.html scoped-style-document-ref.html
HTTP(..) == scoped-style-font-face.html scoped-style-font-face-ref.html
== scoped-style-keyframes.html scoped-style-keyframes-ref.html
pref(layout.css.supports-rule.enabled,true) == scoped-style-supports.html scoped-style-supports-ref.html

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p style="color: green">Second</p>
<p>Third</p>
</body>

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

@ -1,11 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p>
<style scoped>
p { color: green }
</style>
Second
</p>
<p>Third</p>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p style="color: blue">First</p>
<p style="color: green">Second</p>
<p style="color: blue">Third</p>
</body>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<body>
<style>
p { color: blue }
</style>
<p>First</p>
<p>
<style scoped>
p { color: green }
</style>
Second
</p>
<p>Third</p>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p style="color: blue">First</p>
<p style="color: green">Second</p>
<p style="color: blue">Third</p>
</body>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p>
<style scoped>
p { color: green }
</style>
Second
</p>
<p>Third</p>
<style>
p { color: blue }
</style>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p style="color: blue">First</p>
<p style="color: green">Second</p>
<p style="color: blue">Third</p>
</body>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<body>
<style>
body p { color: blue }
</style>
<p>First</p>
<p>
<style scoped>
p { color: green }
</style>
Second
</p>
<p>Third</p>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p style="color: blue">First</p>
<p style="color: green">Second</p>
<p style="color: blue">Third</p>
</body>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p>
<style scoped>
p { color: green }
</style>
Second
</p>
<p>Third</p>
<style>
body p { color: blue }
</style>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p style="color: blue">First</p>
<p style="color: green">Second</p>
<p style="color: blue">Third</p>
</body>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<body>
<style>
p { color: blue }
</style>
<p>First</p>
<p id=a>
<style scoped>
#a { color: green }
</style>
Second
</p>
<p>Third</p>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p style="color: blue">First</p>
<p style="color: green">Second</p>
<p style="color: blue">Third</p>
</body>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p id=a>
<style scoped>
#a { color: green }
</style>
Second
</p>
<p>Third</p>
<style>
p { color: blue }
</style>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p>Second</p>
<p>Third</p>
</body>

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

@ -1,11 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p>
<style scoped>
body p { color: green }
</style>
Second
</p>
<p>Third</p>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p>Second</p>
<p>Third</p>
</body>

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

@ -1,11 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p>
<style scoped>
p + p { color: red }
</style>
Second
</p>
<p>Third</p>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p style="color: green; text-decoration: underline">Second</p>
<p>Third</p>
</body>

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

@ -1,17 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p>
<style scoped>
p { color: red }
</style>
<style scoped>
p { text-decoration: underline }
</style>
Second
<style scoped>
p { color: green }
</style>
</p>
<p>Third</p>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p><div style="color: green">Second</div></p>
<p>Third</p>
</body>

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

@ -1,13 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<div>
<style scoped>
p { color: green }
</style>
<p>
Second
</p>
</div>
<p>Third</p>
</body>

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

@ -1,8 +0,0 @@
<!DOCTYPE html>
<body>
<div>First</div>
<div style="color: green">
Second
<div style="text-decoration: underline">Third</div>
</div>
</body>

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

@ -1,16 +0,0 @@
<!DOCTYPE html>
<body>
<div>First</div>
<div>
<style scoped>
div { color: green }
</style>
Second
<div>
<style scoped>
div { text-decoration: underline }
</style>
Third
</div>
</div>
</body>

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

@ -1,9 +0,0 @@
<!DOCTYPE html>
<body>
<div>
<p>First</p>
</div>
<div>
<p style="color: green">Second</p>
</div>
</body>

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

@ -1,12 +0,0 @@
<!DOCTYPE html>
<body>
<div>
<p>First</p>
</div>
<div>
<style scoped>
div p { color: green }
</style>
<p>Second</p>
</div>
</body>

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

@ -1,15 +0,0 @@
<!DOCTYPE html>
<body>
<div>
<p>First</p>
</div>
<blockquote>
<div>
<div>
<div>
<p style="color: green">Second</p>
</div>
</div>
</div>
</blockquote>
</body>

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

@ -1,18 +0,0 @@
<!DOCTYPE html>
<body>
<div>
<p>First</p>
</div>
<blockquote>
<style scoped>
blockquote p { color: green }
</style>
<div>
<div>
<div>
<p>Second</p>
</div>
</div>
</div>
</blockquote>
</body>

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

@ -1,8 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<div>
<p style="color: green">Second</p>
</div>
<p>Third</p>
</body>

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

@ -1,11 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<div>
<style scoped>
p { color: red }
</style>
<p style="color: green">Second</p>
</div>
<p>Third</p>
</body>

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

@ -1,8 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<div>
<p>Second</p>
<p style="color: green">Third</p>
</div>
</body>

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

@ -1,11 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<div>
<style scoped>
p + p { color: green }
</style>
<p>Second</p>
<p>Third</p>
</div>
</body>

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

@ -1,8 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<div style="text-decoration: underline">
<p>Second</p>
<p>Third</p>
</div>
</body>

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

@ -1,16 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<div>
<style scoped>
div { text-decoration: underline }
</style>
<p>
<style scoped>
div { color: red }
</style>
Second
</p>
<p>Third</p>
</div>
</body>

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

@ -1,8 +0,0 @@
<!DOCTYPE html>
<body>
<div>
<div>
<p style="color: green">This should be green.</p>
</div>
</div>
</body>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<body>
<div>
<div>
<p>This should be green.</p>
<style scoped>
p { color: green }
</style>
</div>
<style scoped>
p { color: red }
</style>
</div>
</body>

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

@ -1,7 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg">
<rect width="50" height="50"/>
<g>
<rect x="60" width="50" height="50" fill="blue"/>
</g>
<rect x="120" width="50" height="50"/>
</svg>

До

Ширина:  |  Высота:  |  Размер: 189 B

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

@ -1,10 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg">
<rect width="50" height="50"/>
<g>
<style scoped="">
rect { fill: blue }
</style>
<rect x="60" width="50" height="50"/>
</g>
<rect x="120" width="50" height="50"/>
</svg>

До

Ширина:  |  Высота:  |  Размер: 238 B

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

@ -1,4 +0,0 @@
<!DOCTYPE html>
<body>
<p style="color: green">Hello</p>
</body>

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

@ -1,9 +0,0 @@
<!DOCTYPE html>
<body>
<p style="color: green">
<style scoped>
p { color: red }
</style>
Hello
</p>
</body>

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

@ -1,4 +0,0 @@
<!DOCTYPE html>
<body>
<p style="color: green">Hello</p>
</body>

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

@ -1,7 +0,0 @@
<!DOCTYPE html>
<body>
<style scoped>
p { color: red }
</style>
<p style="color: green">Hello</p>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p style="color: blue">Second</p>
<p>Third</p>
</body>

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

@ -1,12 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p>
<style scoped>
@charset "UTF-16";
p { color: blue }
</style>
Second
</p>
<p>Third</p>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p style="color: blue">Second</p>
<p>Third</p>
</body>

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

@ -1,13 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p>
<style scoped>
@-moz-document regexp("^.*scoped-style-document\\.html$") {
p { color: blue }
}
</style>
Second
</p>
<p>Third</p>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p style="color: green">Second</p>
<p>Third</p>
</body>

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

@ -1,15 +0,0 @@
<!DOCTYPE html>
<body onload="f()">
<p>First</p>
<p>Second</p>
<p>Third</p>
<script>
function f() {
var p = document.getElementsByTagName("p")[1];
var style = document.createElement("style");
style.setAttribute("scoped", "");
style.textContent = "p { color: green }";
p.appendChild(style);
}
</script>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p style="color: green; text-decoration: underline">Second</p>
<p>Third</p>
</body>

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

@ -1,20 +0,0 @@
<!DOCTYPE html>
<body onload="f()">
<p>First</p>
<p>
<style scoped>
p { text-decoration: underline }
</style>
Second
</p>
<p>Third</p>
<script>
function f() {
var p = document.getElementsByTagName("p")[1];
var style = document.createElement("style");
style.setAttribute("scoped", "");
style.textContent = "p { color: green }";
p.appendChild(style);
}
</script>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p style="color: green">Second</p>
<p>Third</p>
</body>

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

@ -1,20 +0,0 @@
<!DOCTYPE html>
<body onload="f()">
<p>First</p>
<p>
<style scoped>
p { color: green }
</style>
<style scoped>
p { text-decoration: underline }
</style>
Second
</p>
<p>Third</p>
<script>
function f() {
var style = document.getElementsByTagName("style")[1];
style.parentNode.removeChild(style);
}
</script>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p style="color: green; background-color: yellow">Second</p>
<p>Third</p>
</body>

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

@ -1,20 +0,0 @@
<!DOCTYPE html>
<body onload="f()">
<p>First</p>
<p>
<style scoped>
p { color: green }
</style>
<style scoped>
p { text-decoration: underline }
</style>
Second
</p>
<p>Third</p>
<script>
function f() {
var style = document.getElementsByTagName("style")[1];
style.textContent = "p { background-color: yellow }";
}
</script>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p style="color: green">First</p>
<p style="color: green">Second</p>
<p style="color: green">Third</p>
</body>

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

@ -1,17 +0,0 @@
<!DOCTYPE html>
<body onload="f()">
<p>First</p>
<p>
<style scoped>
p { color: green }
</style>
Second
</p>
<p>Third</p>
<script>
function f() {
var style = document.getElementsByTagName("style")[0];
style.removeAttribute("scoped");
}
</script>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p style="color: green">Second</p>
<p>Third</p>
</body>

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

@ -1,17 +0,0 @@
<!DOCTYPE html>
<body onload="f()">
<p>First</p>
<p>
<style>
p { color: green }
</style>
Second
</p>
<p>Third</p>
<script>
function f() {
var style = document.getElementsByTagName("style")[0];
style.setAttribute("scoped", "");
}
</script>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<div></div>
<p>Second</p>
</body>

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

@ -1,16 +0,0 @@
<!DOCTYPE html>
<body onload="f()">
<p>First</p>
<div>
<style scoped>
p { color: green }
</style>
<p>Second</p>
</div>
<script>
function f() {
var p = document.getElementsByTagName("p")[1];
document.body.appendChild(p);
}
</script>
</body>

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

@ -1,7 +0,0 @@
<!DOCTYPE html>
<body>
<div>
<p style="color: green">First</p>
</div>
<p>Second</p>
</body>

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

@ -1,17 +0,0 @@
<!DOCTYPE html>
<body onload="f()">
<p>First</p>
<div>
<style scoped>
p { color: green }
</style>
</div>
<p>Second</p>
<script>
function f() {
var p = document.getElementsByTagName("p")[0];
var div = document.getElementsByTagName("div")[0];
div.appendChild(p);
}
</script>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p style="color: green">Second</p>
<p>Third</p>
</body>

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

@ -1,17 +0,0 @@
<!DOCTYPE html>
<body onload="f()">
<p>First</p>
<p>
<style>
p { color: green }
</style>
Second
</p>
<p>Third</p>
<script>
function f() {
var style = document.getElementsByTagName("style")[0];
style.scoped = true;
}
</script>
</body>

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<p style="color: green">First</p>
<p style="color: green">Second</p>
<p style="color: green">Third</p>
</body>

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

@ -1,17 +0,0 @@
<!DOCTYPE html>
<body onload="f()">
<p>First</p>
<p>
<style scoped>
p { color: green }
</style>
Second
</p>
<p>Third</p>
<script>
function f() {
var style = document.getElementsByTagName("style")[0];
style.scoped = false;
}
</script>
</body>

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

@ -1,5 +0,0 @@
<!DOCTYPE html>
<body>
<p>First</p>
<p style="color: green">Second</p>
</body>

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

@ -1,17 +0,0 @@
<!DOCTYPE html>
<body onload="f()">
<p>
<style scoped>
p { color: green }
</style>
First
</p>
<p>Second</p>
<script>
function f() {
var style = document.getElementsByTagName("style")[0];
var p = document.getElementsByTagName("p")[1];
p.appendChild(style);
}
</script>
</body>

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

@ -1,7 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg">
<rect width="50" height="50" fill="blue"/>
<g>
<rect x="60" width="50" height="50" fill="blue"/>
</g>
<rect x="120" width="50" height="50" fill="blue"/>
</svg>

До

Ширина:  |  Высота:  |  Размер: 213 B

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

@ -1,15 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" onload="f()">
<rect width="50" height="50"/>
<g>
<style scoped="">
rect { fill: blue }
</style>
<rect x="60" width="50" height="50"/>
</g>
<rect x="120" width="50" height="50"/>
<script>
function f() {
document.getElementsByTagName("style")[0].removeAttribute("scoped");
}
</script>
</svg>

До

Ширина:  |  Высота:  |  Размер: 374 B

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

@ -1,7 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg">
<rect width="50" height="50"/>
<g>
<rect x="60" width="50" height="50" fill="blue"/>
</g>
<rect x="120" width="50" height="50"/>
</svg>

До

Ширина:  |  Высота:  |  Размер: 189 B

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

@ -1,15 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" onload="f()">
<rect width="50" height="50"/>
<g>
<style>
rect { fill: blue }
</style>
<rect x="60" width="50" height="50"/>
</g>
<rect x="120" width="50" height="50"/>
<script>
function f() {
document.getElementsByTagName("style")[0].setAttribute("scoped", "");
}
</script>
</svg>

До

Ширина:  |  Высота:  |  Размер: 365 B

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