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
parent 34b7e169fc
commit 26873544a3
142 changed files with 244 additions and 2020 deletions

View File

@ -873,29 +873,6 @@ public:
*/
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:
/*
* 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); \
}
/**
* 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 \
typedef mozilla::dom::Element Element; \
NS_IMETHOD GetTagName(nsAString& aTagName) MOZ_FINAL \

View File

@ -1319,11 +1319,6 @@ private:
NodeHasDirAuto,
// Set if a node in the node's parent chain has dir=auto.
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
BooleanFlagCount
};
@ -1440,24 +1435,6 @@ public:
bool NodeOrAncestorHasDirAuto() const
{ 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:
void SetParentIsContent(bool aValue) { SetBoolFlag(ParentIsContent, aValue); }
void SetInDocument() { SetBoolFlag(IsInDocument); }
@ -1478,7 +1455,7 @@ protected:
bool HasLockedStyleStates() const
{ return GetBoolFlag(ElementHasLockedStyleStates); }
void SetSubtreeRootPointer(nsINode* aSubtreeRoot)
void SetSubtreeRootPointer(nsINode* aSubtreeRoot)
{
NS_ASSERTION(aSubtreeRoot, "aSubtreeRoot can never be null!");
NS_ASSERTION(!(IsNodeOfType(eCONTENT) && IsInDoc()), "Shouldn't be here!");

View File

@ -1155,9 +1155,6 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
NODE_NEEDS_FRAME | NODE_DESCENDANTS_NEED_FRAMES |
// And the restyle bits
ELEMENT_ALL_RESTYLE_FLAGS);
// Propagate scoped style sheet tracking bit.
SetIsElementInStyleScope(mParent->IsElementInStyleScope());
} else {
// If we're not in the doc, update our subtree pointer.
SetSubtreeRootPointer(aParent->SubtreeRoot());
@ -3598,13 +3595,3 @@ Element::GetEditorInternal()
nsCOMPtr<nsITextControlElement> textCtrl = do_QueryInterface(this);
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);
}

View File

@ -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
nsDocument::RemoveStyleSheetsFromStyleSets(nsCOMArray<nsIStyleSheet>& aSheets, nsStyleSet::sheetType aType)
{
@ -2073,7 +2054,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
NS_PRECONDITION(aURI, "Null URI passed to ResetStylesheetsToURI");
mozAutoDocUpdate upd(this, UPDATE_STYLE, true);
RemoveDocStyleSheetsFromStyleSets();
RemoveStyleSheetsFromStyleSets(mStyleSheets, nsStyleSet::eDocSheet);
RemoveStyleSheetsFromStyleSets(mCatalogSheets, nsStyleSet::eAgentSheet);
RemoveStyleSheetsFromStyleSets(mAdditionalSheets[eAgentSheet], nsStyleSet::eAgentSheet);
RemoveStyleSheetsFromStyleSets(mAdditionalSheets[eUserSheet], nsStyleSet::eUserSheet);
@ -3522,7 +3503,7 @@ nsDocument::RemoveStyleSheetFromStyleSets(nsIStyleSheet* aSheet)
{
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
shell->StyleSet()->RemoveDocStyleSheet(aSheet);
shell->StyleSet()->RemoveStyleSheet(nsStyleSet::eDocSheet, aSheet);
}
}

View File

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

View File

@ -12,10 +12,9 @@
#include "nsStyleLinkElement.h"
#include "mozilla/css/Loader.h"
#include "mozilla/dom/Element.h"
#include "nsCSSStyleSheet.h"
#include "nsIContent.h"
#include "mozilla/css/Loader.h"
#include "nsCSSStyleSheet.h"
#include "nsIDocument.h"
#include "nsIDOMComment.h"
#include "nsIDOMNode.h"
@ -27,9 +26,6 @@
#include "nsUnicharInputStream.h"
#include "nsContentUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
nsStyleLinkElement::nsStyleLinkElement()
: mDontLoadStyle(false)
, mUpdatesEnabled(true)
@ -207,87 +203,6 @@ nsStyleLinkElement::UpdateStyleSheetInternal(nsIDocument *aOldDocument,
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
nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
nsICSSLoaderObserver* aObserver,
@ -297,11 +212,6 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
{
*aWillNotify = false;
nsCOMPtr<nsIContent> thisContent;
CallQueryInterface(this, getter_AddRefs(thisContent));
Element* oldScopeElement = GetScopeElement(mStyleSheet);
if (mStyleSheet && aOldDocument) {
// We're removing the link element from the document, unload the
// stylesheet. We want to do this even if updates are disabled, since
@ -311,15 +221,15 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
aOldDocument->RemoveStyleSheet(mStyleSheet);
aOldDocument->EndUpdate(UPDATE_STYLE);
nsStyleLinkElement::SetStyleSheet(nullptr);
if (oldScopeElement) {
UpdateIsElementInStyleScopeFlagOnSubtree(oldScopeElement);
}
}
if (mDontLoadStyle || !mUpdatesEnabled) {
return NS_OK;
}
nsCOMPtr<nsIContent> thisContent;
QueryInterface(NS_GET_IID(nsIContent), getter_AddRefs(thisContent));
NS_ENSURE_TRUE(thisContent, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> doc = thisContent->GetDocument();
@ -354,21 +264,14 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
}
nsAutoString title, type, media;
bool isScoped;
bool isAlternate;
GetStyleSheetInfo(title, type, media, &isScoped, &isAlternate);
GetStyleSheetInfo(title, type, media, &isAlternate);
if (!type.LowerCaseEqualsLiteral("text/css")) {
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;
nsresult rv = NS_OK;
if (isInline) {
@ -378,7 +281,7 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
// Parse the style sheet.
rv = doc->CSSLoader()->
LoadInlineStyle(thisContent, text, mLineNumber, title, media,
scopeElement, aObserver, &doneLoading, &isAlternate);
aObserver, &doneLoading, &isAlternate);
}
else {
// XXXbz clone the URI here to work around content policies modifying URIs.
@ -405,44 +308,3 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
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);
}
}

View File

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

View File

@ -1870,6 +1870,16 @@ nsGenericHTMLElement::SetAttrHelper(nsIAtom* aAttr, const nsAString& aValue)
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
nsGenericHTMLElement::GetIntAttr(nsIAtom* aAttr, int32_t aDefault) const
{

View File

@ -849,6 +849,29 @@ protected:
*/
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.
* Gets the integer-value of an attribute, returns specified default value
@ -1211,6 +1234,24 @@ protected:
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
* valued content property. The method uses the generic GetAttr and

View File

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

View File

@ -86,7 +86,6 @@ protected:
void GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType,
nsAString& aMedia,
bool* aIsScoped,
bool* aIsAlternate);
/**
* 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_BOOL_ATTR(nsHTMLStyleElement, Scoped, scoped)
NS_IMPL_STRING_ATTR(nsHTMLStyleElement, Type, type)
void
@ -244,14 +242,11 @@ nsHTMLStyleElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
{
nsresult rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix,
aValue, aNotify);
if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::title ||
aName == nsGkAtoms::media ||
aName == nsGkAtoms::type) {
UpdateStyleSheetInternal(nullptr, true);
} else if (aName == nsGkAtoms::scoped) {
UpdateStyleSheetScopedness(true);
}
if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None &&
(aName == nsGkAtoms::title ||
aName == nsGkAtoms::media ||
aName == nsGkAtoms::type)) {
UpdateStyleSheetInternal(nullptr, true);
}
return rv;
@ -263,14 +258,11 @@ nsHTMLStyleElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
{
nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute,
aNotify);
if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::title ||
aAttribute == nsGkAtoms::media ||
aAttribute == nsGkAtoms::type) {
UpdateStyleSheetInternal(nullptr, true);
} else if (aAttribute == nsGkAtoms::scoped) {
UpdateStyleSheetScopedness(false);
}
if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::title ||
aAttribute == nsGkAtoms::media ||
aAttribute == nsGkAtoms::type)) {
UpdateStyleSheetInternal(nullptr, true);
}
return rv;
@ -306,7 +298,6 @@ void
nsHTMLStyleElement::GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType,
nsAString& aMedia,
bool* aIsScoped,
bool* aIsAlternate)
{
aTitle.Truncate();
@ -326,8 +317,6 @@ nsHTMLStyleElement::GetStyleSheetInfo(nsAString& aTitle,
GetAttr(kNameSpaceID_None, nsGkAtoms::type, aType);
*aIsScoped = HasAttr(kNameSpaceID_None, nsGkAtoms::scoped);
nsAutoString mimeType;
nsAutoString notUsed;
nsContentUtils::SplitMimeType(aType, mimeType, notUsed);

View File

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

View File

@ -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>

View File

@ -3,7 +3,6 @@
* 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/. */
#include "mozilla/dom/Element.h"
#include "mozilla/dom/SVGStyleElement.h"
#include "nsContentUtils.h"
#include "nsStubMutationObserver.h"
@ -99,14 +98,12 @@ SVGStyleElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
{
nsresult rv = SVGStyleElementBase::SetAttr(aNameSpaceID, aName, aPrefix,
aValue, aNotify);
if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::title ||
aName == nsGkAtoms::media ||
aName == nsGkAtoms::type) {
UpdateStyleSheetInternal(nullptr, true);
} else if (aName == nsGkAtoms::scoped) {
UpdateStyleSheetScopedness(true);
}
if (NS_SUCCEEDED(rv)) {
UpdateStyleSheetInternal(nullptr,
aNameSpaceID == kNameSpaceID_None &&
(aName == nsGkAtoms::title ||
aName == nsGkAtoms::media ||
aName == nsGkAtoms::type));
}
return rv;
@ -118,14 +115,12 @@ SVGStyleElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
{
nsresult rv = SVGStyleElementBase::UnsetAttr(aNameSpaceID, aAttribute,
aNotify);
if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::title ||
aAttribute == nsGkAtoms::media ||
aAttribute == nsGkAtoms::type) {
UpdateStyleSheetInternal(nullptr, true);
} else if (aAttribute == nsGkAtoms::scoped) {
UpdateStyleSheetScopedness(false);
}
if (NS_SUCCEEDED(rv)) {
UpdateStyleSheetInternal(nullptr,
aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::title ||
aAttribute == nsGkAtoms::media ||
aAttribute == nsGkAtoms::type));
}
return rv;
@ -214,10 +209,56 @@ SVGStyleElement::SetXmlspace(const nsAString & aXmlspace, ErrorResult& rv)
rv = SetAttr(kNameSpaceID_XML, nsGkAtoms::space, aXmlspace, true);
}
NS_IMPL_STRING_ATTR(SVGStyleElement, Media, media)
NS_IMPL_BOOL_ATTR(SVGStyleElement, Scoped, scoped)
NS_IMPL_STRING_ATTR(SVGStyleElement, Title, title)
NS_IMPL_STRING_ATTR(SVGStyleElement, Type, type)
/* attribute DOMString type; */
NS_IMETHODIMP SVGStyleElement::GetType(nsAString & aType)
{
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
@ -233,7 +274,6 @@ void
SVGStyleElement::GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType,
nsAString& aMedia,
bool* aIsScoped,
bool* aIsAlternate)
{
*aIsAlternate = false;
@ -253,8 +293,6 @@ SVGStyleElement::GetStyleSheetInfo(nsAString& aTitle,
aType.AssignLiteral("text/css");
}
*aIsScoped = HasAttr(kNameSpaceID_None, nsGkAtoms::scoped);
return;
}

View File

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

View File

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

View File

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

View File

@ -3,7 +3,6 @@
* 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/. */
#include "mozilla/dom/Element.h"
#include "nsIDOMLinkStyle.h"
#include "nsIDOMStyleSheet.h"
#include "nsIDocument.h"
@ -18,7 +17,6 @@
#include "nsContentUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
class nsXMLStylesheetPI : public nsXMLProcessingInstruction,
public nsStyleLinkElement
@ -59,7 +57,6 @@ protected:
void GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType,
nsAString& aMedia,
bool* aIsScoped,
bool* aIsAlternate);
virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo,
bool aCloneText) const;
@ -180,13 +177,11 @@ void
nsXMLStylesheetPI::GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType,
nsAString& aMedia,
bool* aIsScoped,
bool* aIsAlternate)
{
aTitle.Truncate();
aType.Truncate();
aMedia.Truncate();
*aIsScoped = false;
*aIsAlternate = false;
// xml-stylesheet PI is special only in prolog

View File

@ -16,11 +16,10 @@
* 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
{
attribute boolean disabled;
attribute DOMString media;
attribute DOMString type;
attribute boolean scoped;
};

View File

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

View File

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

View File

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

View File

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

View File

@ -1424,9 +1424,6 @@ protected:
// re-use old pixels.
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 mDidInitialize : 1;
bool mIsDestroying : 1;
@ -1450,15 +1447,6 @@ protected:
bool mSuppressInterruptibleReflows : 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;
// Cached font inflation values. This is done to prevent changing of font

View File

@ -33,7 +33,7 @@
#include "mozilla/dom/Element.h"
#include "nsIDocument.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 "nsAnimationManager.h"
#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) {
mStyleSet->EndUpdate();
if (mStylesHaveChanged || !mChangedScopeStyleRoots.IsEmpty())
if (mStylesHaveChanged)
ReconstructStyleData();
}
@ -4170,15 +4170,6 @@ PresShell::ReconstructFrames(void)
void
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;
if (mIsDestroying) {
@ -4202,19 +4193,7 @@ nsIPresShell::ReconstructStyleDataInternal()
return;
}
if (scopeRoots.IsEmpty()) {
// 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);
}
}
mFrameConstructor->PostRestyleEvent(root, eRestyle_Subtree, NS_STYLE_HINT_NONE);
}
void
@ -4223,24 +4202,6 @@ nsIPresShell::ReconstructStyleDataExternal()
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
PresShell::StyleSheetAdded(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet,
@ -4250,7 +4211,7 @@ PresShell::StyleSheetAdded(nsIDocument *aDocument,
NS_PRECONDITION(aStyleSheet, "Must have a style sheet!");
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!");
if (aStyleSheet->IsApplicable() && aStyleSheet->HasRules()) {
RecordStyleSheetChange(aStyleSheet);
mStylesHaveChanged = true;
}
}
@ -4273,7 +4234,7 @@ PresShell::StyleSheetApplicableStateChanged(nsIDocument *aDocument,
bool aApplicable)
{
if (aStyleSheet->HasRules()) {
RecordStyleSheetChange(aStyleSheet);
mStylesHaveChanged = true;
}
}
@ -4283,7 +4244,7 @@ PresShell::StyleRuleChanged(nsIDocument *aDocument,
nsIStyleRule* aOldStyleRule,
nsIStyleRule* aNewStyleRule)
{
RecordStyleSheetChange(aStyleSheet);
mStylesHaveChanged = true;
}
void
@ -4291,7 +4252,7 @@ PresShell::StyleRuleAdded(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule)
{
RecordStyleSheetChange(aStyleSheet);
mStylesHaveChanged = true;
}
void
@ -4299,7 +4260,7 @@ PresShell::StyleRuleRemoved(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule)
{
RecordStyleSheetChange(aStyleSheet);
mStylesHaveChanged = true;
}
nsIFrame*

View File

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

View File

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

View File

@ -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

View File

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

View File

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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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>

View File

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

View File

@ -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>

View File

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

View File

@ -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>

View File

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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

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

View File

@ -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>

View File

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

View File

@ -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>

View File

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

View File

@ -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>

View File

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

View File

@ -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>

View File

@ -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>

Before

Width:  |  Height:  |  Size: 189 B

View File

@ -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>

Before

Width:  |  Height:  |  Size: 238 B

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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>

View File

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

View File

@ -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>

View File

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

View File

@ -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>

View File

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

View File

@ -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>

View File

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

View File

@ -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>

View File

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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

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

View File

@ -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>

View File

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

View File

@ -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>

View File

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

View File

@ -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>

View File

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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

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

View File

@ -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>

View File

@ -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>

Before

Width:  |  Height:  |  Size: 213 B

View File

@ -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>

Before

Width:  |  Height:  |  Size: 374 B

View File

@ -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>

Before

Width:  |  Height:  |  Size: 189 B

View File

@ -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>

Before

Width:  |  Height:  |  Size: 365 B

Some files were not shown because too many files have changed in this diff Show More