mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 23:27:30 +09:00
Issue #2135 - Bug 1438129: Remove ShadowRoot.applyAuthorStyles.
This commit is contained in:
parent
1185cfe3f0
commit
3350af82c2
4 changed files with 2 additions and 31 deletions
|
|
@ -488,25 +488,6 @@ ShadowRoot::Host()
|
||||||
return host->AsElement();
|
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
|
void
|
||||||
ShadowRoot::AttributeChanged(nsIDocument* aDocument,
|
ShadowRoot::AttributeChanged(nsIDocument* aDocument,
|
||||||
Element* aElement,
|
Element* aElement,
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,6 @@ public:
|
||||||
// [deprecated] Shadow DOM v0
|
// [deprecated] Shadow DOM v0
|
||||||
void InsertSheet(StyleSheet* aSheet, nsIContent* aLinkingContent);
|
void InsertSheet(StyleSheet* aSheet, nsIContent* aLinkingContent);
|
||||||
void RemoveSheet(StyleSheet* aSheet);
|
void RemoveSheet(StyleSheet* aSheet);
|
||||||
bool ApplyAuthorStyles();
|
|
||||||
void SetApplyAuthorStyles(bool aApplyAuthorStyles);
|
|
||||||
StyleSheetList* StyleSheets()
|
StyleSheetList* StyleSheets()
|
||||||
{
|
{
|
||||||
return &DocumentOrShadowRoot::EnsureDOMStyleSheets();
|
return &DocumentOrShadowRoot::EnsureDOMStyleSheets();
|
||||||
|
|
|
||||||
|
|
@ -48,19 +48,12 @@ isnot(getComputedStyle(document.getElementById("bodydiv"), null).getPropertyValu
|
||||||
// Make sure that elements in the ShadowRoot are styled according to the ShadowRoot style.
|
// Make sure that elements in the ShadowRoot are styled according to the ShadowRoot style.
|
||||||
is(getComputedStyle(divToStyle, null).getPropertyValue("height"), "100px", "ShadowRoot style sheets should apply to elements in ShadowRoot.");
|
is(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 = document.createElement("style");
|
var authorStyle = document.createElement("style");
|
||||||
authorStyle.innerHTML = ".fat { padding-right: 20px; padding-left: 30px; }";
|
authorStyle.innerHTML = ".fat { padding-right: 20px; padding-left: 30px; }";
|
||||||
document.body.appendChild(authorStyle);
|
document.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.");
|
||||||
isnot(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(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(getComputedStyle(divToStyle, null).getPropertyValue("padding-right"), "20px", "Author styles should not apply to ShadowRoot when ShadowRoot.applyAuthorStyles is false.");
|
|
||||||
|
|
||||||
// Test dynamic changes to style in ShadowRoot.
|
// Test dynamic changes to style in ShadowRoot.
|
||||||
root.innerHTML = '<div id="divtostyle" class="dummy"></div>';
|
root.innerHTML = '<div id="divtostyle" class="dummy"></div>';
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,5 @@ interface ShadowRoot : DocumentFragment
|
||||||
HTMLCollection getElementsByClassName(DOMString classNames);
|
HTMLCollection getElementsByClassName(DOMString classNames);
|
||||||
[CEReactions, SetterThrows, TreatNullAs=EmptyString]
|
[CEReactions, SetterThrows, TreatNullAs=EmptyString]
|
||||||
attribute DOMString innerHTML;
|
attribute DOMString innerHTML;
|
||||||
attribute boolean applyAuthorStyles;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue