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
getCSSStyleRules-1.css
getCSSStyleRules-2.css
[test_getCSSStyleRules_pseudo.html]
[test_getCSSPseudoElementNames.html]
[test_getRelativeRuleLine.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,28 +576,24 @@ nsComputedDOMStyle::DoGetComputedStyleNoFlush(Element* aElement,
if (inDocWithShell &&
aStyleType == eAll &&
!aElement->IsHTMLElement(nsGkAtoms::area)) {
Element* element = nullptr;
nsIFrame* frame = nullptr;
if (aPseudo == nsCSSPseudoElements::before()) {
element = nsLayoutUtils::GetBeforePseudo(aElement);
frame = nsLayoutUtils::GetBeforeFrame(aElement);
} else if (aPseudo == nsCSSPseudoElements::after()) {
element = nsLayoutUtils::GetAfterPseudo(aElement);
frame = nsLayoutUtils::GetAfterFrame(aElement);
} else if (!aPseudo) {
element = aElement;
frame = nsLayoutUtils::GetStyleFrame(aElement);
}
if (element) {
nsIFrame* primaryFrame = element->GetPrimaryFrame();
if (nsIFrame* styleFrame = nsLayoutUtils::GetStyleFrame(element)) {
ComputedStyle* result = styleFrame->Style();
// Don't use the style if it was influenced by pseudo-elements,
// since then it's not the primary style for this element / pseudo.
if (frame) {
ComputedStyle* result = frame->Style();
// Don't use the style if it was influenced by pseudo-elements, since then
// it's not the primary style for this element / pseudo.
if (!MustReresolveStyle(result)) {
RefPtr<ComputedStyle> ret = result;
return ret.forget();
}
}
}
}
// No frame has been created, or we have a pseudo, or we're looking
// for the default style, so resolve the style ourselves.