Backed out 2 changesets (bug 1481192) for build bustages in workspace/build/src/layout/style/nsComputedDOMStyle CLOSED TREE

Backed out changeset 7697665841ca (bug 1481192)
Backed out changeset 2f0c8d5a75d6 (bug 1481192)
This commit is contained in:
Noemi Erli 2018-09-28 22:33:47 +03:00
Родитель 6d006bbd02
Коммит 00927ac95e
3 изменённых файлов: 11 добавлений и 92 удалений

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

@ -23,7 +23,6 @@ support-files =
file_getCSSStyleRules-alternate.html file_getCSSStyleRules-alternate.html
getCSSStyleRules-1.css getCSSStyleRules-1.css
getCSSStyleRules-2.css getCSSStyleRules-2.css
[test_getCSSStyleRules_pseudo.html]
[test_getCSSPseudoElementNames.html] [test_getCSSPseudoElementNames.html]
[test_getRelativeRuleLine.html] [test_getRelativeRuleLine.html]
[test_get_all_style_sheets.html] [test_get_all_style_sheets.html]

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

@ -1,76 +0,0 @@
<!DOCTYPE html>
<title>Test getCSSStyleRules for pseudo elements</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<style>
#block:before {
display: block;
content: ":before";
}
#block:after {
display: block;
content: ":after";
}
#table:before {
display: table;
content: ":before";
}
#table:after {
display: table;
content: ":after";
}
#flex:before {
display: flex;
content: ":before";
}
#flex:after {
display: flex;
content: ":after";
}
#grid:before {
display: grid;
content: ":before";
}
#grid:after {
display: grid;
content: ":after";
}
</style>
<div id="block">block pseudos</div>
<div id="table">table pseudos</div>
<div id="flex">flex pseudos</div>
<div id="grid">grid pseudos</div>
<script>
const InspectorUtils = SpecialPowers.InspectorUtils;
function checkPseudoStyleForId(id) {
let element = document.getElementById(id);
let beforeRules = InspectorUtils.getCSSStyleRules(element, ":before");
is (beforeRules.length, 1, "Element " + id + ":before has expected number of rules.");
let beforeDecl = beforeRules[0].style;
is (beforeDecl.content, '":before"', "Element " + id + ":before has expected style content.");
let afterRules = InspectorUtils.getCSSStyleRules(element, ":after");
is (afterRules.length, 1, "Element " + id + ":after has expected number of rules.");
let afterDecl = afterRules[0].style;
is (afterDecl.content, '":after"', "Element " + id + ":after has expected style content.");
}
let idsToCheck = [
"block",
"table",
"flex",
"grid",
];
for (let id of idsToCheck) {
checkPseudoStyleForId(id);
}
</script>

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

@ -576,25 +576,21 @@ nsComputedDOMStyle::DoGetComputedStyleNoFlush(Element* aElement,
if (inDocWithShell && if (inDocWithShell &&
aStyleType == eAll && aStyleType == eAll &&
!aElement->IsHTMLElement(nsGkAtoms::area)) { !aElement->IsHTMLElement(nsGkAtoms::area)) {
Element* element = nullptr; nsIFrame* frame = nullptr;
if (aPseudo == nsCSSPseudoElements::before()) { if (aPseudo == nsCSSPseudoElements::before()) {
element = nsLayoutUtils::GetBeforePseudo(aElement); frame = nsLayoutUtils::GetBeforeFrame(aElement);
} else if (aPseudo == nsCSSPseudoElements::after()) { } else if (aPseudo == nsCSSPseudoElements::after()) {
element = nsLayoutUtils::GetAfterPseudo(aElement); frame = nsLayoutUtils::GetAfterFrame(aElement);
} else if (!aPseudo) { } else if (!aPseudo) {
element = aElement; frame = nsLayoutUtils::GetStyleFrame(aElement);
} }
if (frame) {
if (element) { ComputedStyle* result = frame->Style();
nsIFrame* primaryFrame = element->GetPrimaryFrame(); // Don't use the style if it was influenced by pseudo-elements, since then
if (nsIFrame* styleFrame = nsLayoutUtils::GetStyleFrame(element)) { // it's not the primary style for this element / pseudo.
ComputedStyle* result = styleFrame->Style(); if (!MustReresolveStyle(result)) {
// Don't use the style if it was influenced by pseudo-elements, RefPtr<ComputedStyle> ret = result;
// since then it's not the primary style for this element / pseudo. return ret.forget();
if (!MustReresolveStyle(result)) {
RefPtr<ComputedStyle> ret = result;
return ret.forget();
}
} }
} }
} }