Skip to content

Commit

Permalink
Revert of Turn off autofill highlight when changing option in an auto…
Browse files Browse the repository at this point in the history
…filled <select> element (patchset #3 id:40001 of https://codereview.chromium.org/553983012/)

Reason for revert:
This makes the FormAutofillTest.ClearFormWithNodeContainingSelectOne browser_test fail.

http://test-results.appspot.com/dashboards/flakiness_dashboard.html#tests=FormAutofillTest.ClearFormWithNodeContainingSelectOne&testType=browser_tests

Original issue's description:
> Turn off autofill highlight when changing option in an autofilled <select> element
> 
> [email protected], [email protected]
> BUG=412311
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=182528

[email protected],[email protected],[email protected]
NOTREECHECKS=true
NOTRY=true
BUG=412311

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

git-svn-id: svn://svn.chromium.org/blink/trunk@182569 bbb929c8-8fbe-4397-9dbb-9b2b20218538
  • Loading branch information
madsager committed Sep 24, 2014
1 parent ebb1894 commit 2dfcbe8
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 32 deletions.
6 changes: 1 addition & 5 deletions LayoutTests/fast/forms/autofilled-expected.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This tests that foreground and background colors properly change for autofilled inputs or select options. It can only be run using the test harness.

PASS successfullyParsed is true

TEST COMPLETE
Expand All @@ -18,8 +18,6 @@ PASS foregroundOf(select1) is not originalForeground
PASS backgroundOf(select1) is not originalBackground
PASS foregroundOf(select2) is not originalForeground
PASS backgroundOf(select2) is not originalBackground
PASS foregroundOf(select3) is not originalForeground
PASS backgroundOf(select3) is not originalBackground
PASS select2.options.length is 3
PASS select2.options.length is 2
PASS foregroundOf(select2) is autofilledSelectForeground
Expand All @@ -37,6 +35,4 @@ PASS foregroundOf(select1) is originalForeground
PASS backgroundOf(select1) is originalBackground
PASS foregroundOf(select2) is originalForeground
PASS backgroundOf(select2) is originalBackground
PASS foregroundOf(select3) is originalForeground
PASS backgroundOf(select3) is originalBackground

16 changes: 1 addition & 15 deletions LayoutTests/fast/forms/autofilled.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
textarea2.value = 'autofilled is true';
var select1 = document.getElementById('select1');
select2 = document.getElementById('select2');
var select3 = document.getElementById('select3');

shouldBe('foregroundOf(textarea1)', 'originalForeground');
shouldBe('backgroundOf(textarea1)', 'originalBackground');
Expand All @@ -41,7 +40,6 @@
window.internals.setAutofilled(textarea2, true);
window.internals.setAutofilled(select1, true);
window.internals.setAutofilled(select2, true);
window.internals.setAutofilled(select3, true);

shouldBeEqualToString('search.value', 'Search value');

Expand All @@ -58,8 +56,6 @@
shouldNotBe('backgroundOf(select1)', 'originalBackground');
shouldNotBe('foregroundOf(select2)', 'originalForeground');
shouldNotBe('backgroundOf(select2)', 'originalBackground');
shouldNotBe('foregroundOf(select3)', 'originalForeground');
shouldNotBe('backgroundOf(select3)', 'originalBackground');

// Remove an unselected option from <select> element. This should not affect the background color for the autofilled <select> element.
shouldBe('select2.options.length', '3');
Expand Down Expand Up @@ -92,9 +88,6 @@
// Remove selected option for select2 element
select2.removeChild(select2[select2.selectedIndex]);

// Change selected option for select3 element
select3.selectedIndex = 2;

// Colors should be restored.
shouldBe('foregroundOf(field)', 'originalForeground');
shouldBe('backgroundOf(field)', 'originalBackground');
Expand All @@ -108,13 +101,11 @@
shouldBe('backgroundOf(select1)', 'originalBackground');
shouldBe('foregroundOf(select2)', 'originalForeground');
shouldBe('backgroundOf(select2)', 'originalBackground');
shouldBe('foregroundOf(select3)', 'originalForeground');
shouldBe('backgroundOf(select3)', 'originalBackground');
}
</script>

<style>
#field, #search, #textarea1, #textarea2, #select1, #select2, #select3 {
#field, #search, #textarea1, #textarea2, #select1, #select2 {
color: #FFFFFF;
background-color: #FFFFFF;
}
Expand All @@ -133,11 +124,6 @@
<option >2</option>
<option>3</option>
</select>
<select id="select3">
<option selected>1</option>
<option >2</option>
<option>3</option>
</select>
</form>
<div id="console"></div>
</body>
4 changes: 0 additions & 4 deletions LayoutTests/platform/mac/fast/forms/autofilled-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ PASS foregroundOf(select1) is not originalForeground
PASS backgroundOf(select1) is not originalBackground
PASS foregroundOf(select2) is not originalForeground
PASS backgroundOf(select2) is not originalBackground
PASS foregroundOf(select3) is not originalForeground
PASS backgroundOf(select3) is not originalBackground
PASS select2.options.length is 3
PASS select2.options.length is 2
PASS foregroundOf(select2) is autofilledSelectForeground
Expand All @@ -37,6 +35,4 @@ PASS foregroundOf(select1) is originalForeground
PASS backgroundOf(select1) is originalBackground
PASS foregroundOf(select2) is originalForeground
PASS backgroundOf(select2) is originalBackground
PASS foregroundOf(select3) is originalForeground
PASS backgroundOf(select3) is originalBackground

7 changes: 0 additions & 7 deletions Source/core/html/HTMLSelectElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ HTMLSelectElement::HTMLSelectElement(Document& document, HTMLFormElement* form)
, m_activeSelectionState(false)
, m_shouldRecalcListItems(false)
, m_suggestedIndex(-1)
, m_isAutofilledByPreview(false)
{
}

Expand Down Expand Up @@ -270,8 +269,6 @@ void HTMLSelectElement::setValue(const String &value, bool sendEvents)

int previousSelectedIndex = selectedIndex();
setSuggestedIndex(-1);
if (m_isAutofilledByPreview)
setAutofilled(false);
setSelectedIndex(optionIndex);

if (sendEvents && previousSelectedIndex != selectedIndex()) {
Expand Down Expand Up @@ -307,7 +304,6 @@ void HTMLSelectElement::setSuggestedValue(const String& value)
if (isHTMLOptionElement(items[i])) {
if (toHTMLOptionElement(items[i])->value() == value) {
setSuggestedIndex(optionIndex);
m_isAutofilledByPreview = true;
return;
}
optionIndex++;
Expand Down Expand Up @@ -928,9 +924,6 @@ void HTMLSelectElement::selectOption(int optionIndex, SelectOptionFlags flags)
const WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >& items = listItems();
int listIndex = optionToListIndex(optionIndex);

if (selectedIndex() != optionIndex && this->isAutofilled())
setAutofilled(false);

HTMLElement* element = 0;
if (listIndex >= 0) {
element = items[listIndex];
Expand Down
1 change: 0 additions & 1 deletion Source/core/html/HTMLSelectElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ class HTMLSelectElement FINAL : public HTMLFormControlElementWithState, public T
bool m_activeSelectionState;
mutable bool m_shouldRecalcListItems;
int m_suggestedIndex;
bool m_isAutofilledByPreview;
};

} // namespace blink
Expand Down

0 comments on commit 2dfcbe8

Please sign in to comment.