Commit e1a9668d authored by rune@opera.com's avatar rune@opera.com

No need for subtree recalc for :-internal-spatial-navigation-focus.

Make the pseudo class a skippable component. This selector is for internal
use only, and currently there are no selectors in UA stylesheets that will
cause style invalidation with that pseudo class. Still, there is no need to
have it in the list of selectors requiring subtree recalc.

We do not support testing internal properties in layout tests since there
is no api for injecting UA style, but I have added a test that relies on a
current bug (see prose in the test itself).

R=chrishtr@chromium.org,esprehn@chromium.org
BUG=432440

Review URL: https://codereview.chromium.org/705693005

git-svn-id: svn://svn.chromium.org/blink/trunk@185284 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3cb004ec
Use descendant invalidation set in the presence of an :-internal-spatial-navigation-focus pseudo class.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
This test relies on the bug (crbug.com/432436) that internal pseudo classes are being
exposed to the extent that they are not dropped, but in the case of :-internal-spatial-navigation-focus,
never matched. If the mentioned bug is fixed this test will start failing. When that happens,
we need to either add the possibility to use internal css features in author style for tests,
support injecting UA style for tests, or drop this test.
PASS getComputedStyle(b).backgroundColor is transparent
PASS internals.updateStyleAndReturnAffectedElementCount() is 2
PASS getComputedStyle(b).backgroundColor is green
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<style>
.a .b:not(:-internal-spatial-navigation-focus) { background-color: green }
</style>
<div id="a">
<select id="sel" multiple>
<option id="b" class="b">1</option>
<option>2</option>
</select>
<div></div>
<div></div>
</div>
<div>
<div></div>
<div></div>
</div>
<script>
description("Use descendant invalidation set in the presence of an :-internal-spatial-navigation-focus pseudo class.");
debug("This test relies on the bug (crbug.com/432436) that internal pseudo classes are being\n\
exposed to the extent that they are not dropped, but in the case of :-internal-spatial-navigation-focus,\n\
never matched. If the mentioned bug is fixed this test will start failing. When that happens,\n\
we need to either add the possibility to use internal css features in author style for tests,\n\
support injecting UA style for tests, or drop this test.\n");
var transparent = "rgba(0, 0, 0, 0)";
var green = "rgb(0, 128, 0)";
if (window.internals)
internals.settings.setSpatialNavigationEnabled(true);
sel.focus();
shouldBe("getComputedStyle(b).backgroundColor", "transparent");
a.offsetTop; // Force recalc.
a.className = "a";
if (window.internals)
shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");
shouldBe("getComputedStyle(b).backgroundColor", "green");
</script>
...@@ -145,6 +145,7 @@ static bool supportsInvalidation(CSSSelector::PseudoType type) ...@@ -145,6 +145,7 @@ static bool supportsInvalidation(CSSSelector::PseudoType type)
case CSSSelector::PseudoContent: case CSSSelector::PseudoContent:
case CSSSelector::PseudoHost: case CSSSelector::PseudoHost:
case CSSSelector::PseudoShadow: case CSSSelector::PseudoShadow:
case CSSSelector::PseudoSpatialNavigationFocus:
case CSSSelector::PseudoListBox: case CSSSelector::PseudoListBox:
return true; return true;
case CSSSelector::PseudoNotParsed: case CSSSelector::PseudoNotParsed:
...@@ -174,7 +175,6 @@ static bool requiresSubtreeInvalidation(const CSSSelector& selector) ...@@ -174,7 +175,6 @@ static bool requiresSubtreeInvalidation(const CSSSelector& selector)
switch (selector.pseudoType()) { switch (selector.pseudoType()) {
case CSSSelector::PseudoFirstLine: case CSSSelector::PseudoFirstLine:
case CSSSelector::PseudoFirstLetter: case CSSSelector::PseudoFirstLetter:
case CSSSelector::PseudoSpatialNavigationFocus:
// FIXME: Most pseudo classes/elements above can be supported and moved // FIXME: Most pseudo classes/elements above can be supported and moved
// to assertSupportedPseudo(). Move on a case-by-case basis. If they // to assertSupportedPseudo(). Move on a case-by-case basis. If they
// require subtree invalidation, document why. // require subtree invalidation, document why.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment