Bug 1438129: Remove ShadowRoot.applyAuthorStyles. r=smaug

MozReview-Commit-ID: E7xk2V78ssq

--HG--
extra : rebase_source : a5be8d3b9cb5543c47f03f91798315f03939c994
This commit is contained in:
Emilio Cobos Álvarez 2018-02-14 11:41:40 +01:00
parent 8a23ea3661
commit bdc288daf0
4 changed files with 2 additions and 32 deletions

View File

@ -481,25 +481,6 @@ ShadowRoot::Host()
return host->AsElement();
}
bool
ShadowRoot::ApplyAuthorStyles()
{
return mProtoBinding->InheritsStyle();
}
void
ShadowRoot::SetApplyAuthorStyles(bool aApplyAuthorStyles)
{
mProtoBinding->SetInheritsStyle(aApplyAuthorStyles);
nsIPresShell* shell = OwnerDoc()->GetShell();
if (shell) {
OwnerDoc()->BeginUpdate(UPDATE_STYLE);
shell->RecordShadowStyleChange(this);
OwnerDoc()->EndUpdate(UPDATE_STYLE);
}
}
void
ShadowRoot::AttributeChanged(nsIDocument* aDocument,
Element* aElement,

View File

@ -78,8 +78,6 @@ public:
// [deprecated] Shadow DOM v0
void InsertSheet(StyleSheet* aSheet, nsIContent* aLinkingContent);
void RemoveSheet(StyleSheet* aSheet);
bool ApplyAuthorStyles();
void SetApplyAuthorStyles(bool aApplyAuthorStyles);
StyleSheetList* StyleSheets()
{
return &DocumentOrShadowRoot::EnsureDOMStyleSheets();

View File

@ -60,19 +60,11 @@ setShadowDOMPrefAndCreateIframe(content)
// Make sure that elements in the ShadowRoot are styled according to the ShadowRoot style.
is(iframeWin.getComputedStyle(divToStyle, null).getPropertyValue("height"), "100px", "ShadowRoot style sheets should apply to elements in ShadowRoot.");
// Tests for applyAuthorStyles.
// Tests for author styles not applying in a ShadowRoot.
var authorStyle = aDocument.createElement("style");
authorStyle.innerHTML = ".fat { padding-right: 20px; padding-left: 30px; }";
aDocument.body.appendChild(authorStyle);
is(root.applyAuthorStyles, false, "applyAuthorStyles defaults to false.");
isnot(iframeWin.getComputedStyle(divToStyle, null).getPropertyValue("padding-right"), "20px", "Author styles should not apply to ShadowRoot when ShadowRoot.applyAuthorStyles is false.");
root.applyAuthorStyles = true;
is(root.applyAuthorStyles, true, "applyAuthorStyles was set to true.");
is(iframeWin.getComputedStyle(divToStyle, null).getPropertyValue("padding-right"), "20px", "Author styles should apply to ShadowRoot when ShadowRoot.applyAuthorStyles is true.");
root.applyAuthorStyles = false;
is(root.applyAuthorStyles, false, "applyAuthorStyles was set to false.");
isnot(iframeWin.getComputedStyle(divToStyle, null).getPropertyValue("padding-right"), "20px", "Author styles should not apply to ShadowRoot when ShadowRoot.applyAuthorStyles is false.");
isnot(iframeWin.getComputedStyle(divToStyle, null).getPropertyValue("padding-right"), "20px", "Author styles should not apply to ShadowRoot.");
// Test dynamic changes to style in ShadowRoot.
root.innerHTML = '<div id="divtostyle" class="dummy"></div>';

View File

@ -31,7 +31,6 @@ interface ShadowRoot : DocumentFragment
HTMLCollection getElementsByClassName(DOMString classNames);
[CEReactions, SetterThrows, TreatNullAs=EmptyString]
attribute DOMString innerHTML;
attribute boolean applyAuthorStyles;
};
ShadowRoot implements DocumentOrShadowRoot;