Commit 8423730b authored by rune@opera.com's avatar rune@opera.com

Use style invalidation sets for :-webkit-autofill.

Add invalidation features to a set for :-webkit-autofill and move
CSSSelector::PseudoAutofill away from the list of pseudo classes requiring
subtree style recalc.

The pseudo type cases in invalidationSetForSelector were re-ordered to
match the enum order.

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

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

git-svn-id: svn://svn.chromium.org/blink/trunk@183955 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent f4a6c227
Use descendant invalidation set for :-webkit-autofill pseudo class.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS [object Internals] is defined.
PASS getComputedStyle(text, '').textDecorationLine is 'none'
PASS internals.updateStyleAndReturnAffectedElementCount() is 1
PASS getComputedStyle(text, '').textDecorationLine is 'underline'
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<style>
:-webkit-autofill { text-decoration: underline }
input + div { color: pink }
</style>
<input id="text" type="text"></input>
<div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<script>
description("Use descendant invalidation set for :-webkit-autofill pseudo class.")
shouldBeDefined(window.internals);
shouldBe("getComputedStyle(text, '').textDecorationLine", "'none'");
text.offsetTop; // Force recalc.
internals.setAutofilled(text, true);
shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
shouldBe("getComputedStyle(text, '').textDecorationLine", "'underline'");
</script>
......@@ -87,6 +87,7 @@ static bool supportsInvalidation(CSSSelector::PseudoType type)
case CSSSelector::PseudoVisited:
case CSSSelector::PseudoAny:
case CSSSelector::PseudoAnyLink:
case CSSSelector::PseudoAutofill:
case CSSSelector::PseudoHover:
case CSSSelector::PseudoDrag:
case CSSSelector::PseudoFocus:
......@@ -151,7 +152,6 @@ static bool requiresSubtreeInvalidation(const CSSSelector& selector)
switch (selector.pseudoType()) {
case CSSSelector::PseudoFirstLine:
case CSSSelector::PseudoFirstLetter:
case CSSSelector::PseudoAutofill:
case CSSSelector::PseudoFullPageMedia:
case CSSSelector::PseudoResizer:
case CSSSelector::PseudoWindowInactive:
......@@ -295,16 +295,17 @@ DescendantInvalidationSet* RuleFeatureSet::invalidationSetForSelector(const CSSS
if (selector.match() == CSSSelector::PseudoClass) {
switch (selector.pseudoType()) {
case CSSSelector::PseudoEmpty:
case CSSSelector::PseudoLink:
case CSSSelector::PseudoVisited:
case CSSSelector::PseudoAutofill:
case CSSSelector::PseudoHover:
case CSSSelector::PseudoActive:
case CSSSelector::PseudoFocus:
case CSSSelector::PseudoActive:
case CSSSelector::PseudoChecked:
case CSSSelector::PseudoEnabled:
case CSSSelector::PseudoDisabled:
case CSSSelector::PseudoIndeterminate:
case CSSSelector::PseudoLink:
case CSSSelector::PseudoTarget:
case CSSSelector::PseudoVisited:
return &ensurePseudoInvalidationSet(selector.pseudoType());
default:
break;
......
......@@ -206,7 +206,7 @@ void HTMLFormControlElement::setAutofilled(bool autofilled)
return;
m_isAutofilled = autofilled;
setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::ControlValue));
pseudoStateChanged(CSSSelector::PseudoAutofill);
}
static bool shouldAutofocusOnAttach(const HTMLFormControlElement* element)
......
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