Commit f8f77765 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Add <textarea> coverage of '::seelction'-releated tests in LayoutTextControlTest

This CL has no behavior changes.

Bug: 1040826
Change-Id: I47587f710cb55ef59c4f4e2e42bb53390b52001b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2483950
Auto-Submit: Kent Tamura <tkent@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818389}
parent 3189784f
...@@ -45,7 +45,7 @@ class LayoutTextControlTest : public RenderingTest { ...@@ -45,7 +45,7 @@ class LayoutTextControlTest : public RenderingTest {
}; };
TEST_F(LayoutTextControlTest, TEST_F(LayoutTextControlTest,
ChangingPseudoSelectionStyleShouldInvalidateSelection) { ChangingPseudoSelectionStyleShouldInvalidateSelectionSingle) {
SetBodyInnerHTML(R"HTML( SetBodyInnerHTML(R"HTML(
<style> <style>
input::selection { background-color: blue; } input::selection { background-color: blue; }
...@@ -62,7 +62,24 @@ TEST_F(LayoutTextControlTest, ...@@ -62,7 +62,24 @@ TEST_F(LayoutTextControlTest,
} }
TEST_F(LayoutTextControlTest, TEST_F(LayoutTextControlTest,
AddingPseudoSelectionStyleShouldInvalidateSelection) { ChangingPseudoSelectionStyleShouldInvalidateSelectionMulti) {
SetBodyInnerHTML(R"HTML(
<style>
textarea::selection { background-color: blue; }
.pseudoSelection::selection { background-color: green; }
</style>
<textarea id="textarea">AAAAAAAAAAAA</textarea>
)HTML");
auto* text_control = GetTextControlElementById("textarea");
auto* selected_text = SetupLayoutTextWithCleanSelection(text_control);
text_control->setAttribute(html_names::kClassAttr, "pseudoSelection");
CheckSelectionInvalidationChanges(*selected_text);
}
TEST_F(LayoutTextControlTest,
AddingPseudoSelectionStyleShouldInvalidateSelectionSingle) {
SetBodyInnerHTML(R"HTML( SetBodyInnerHTML(R"HTML(
<style> <style>
.pseudoSelection::selection { background-color: green; } .pseudoSelection::selection { background-color: green; }
...@@ -78,7 +95,23 @@ TEST_F(LayoutTextControlTest, ...@@ -78,7 +95,23 @@ TEST_F(LayoutTextControlTest,
} }
TEST_F(LayoutTextControlTest, TEST_F(LayoutTextControlTest,
RemovingPseudoSelectionStyleShouldInvalidateSelection) { AddingPseudoSelectionStyleShouldInvalidateSelectionMulti) {
SetBodyInnerHTML(R"HTML(
<style>
.pseudoSelection::selection { background-color: green; }
</style>
<textarea id="textarea" >AAAAAAAAAAAA</textarea>
)HTML");
auto* text_control = GetTextControlElementById("textarea");
auto* selected_text = SetupLayoutTextWithCleanSelection(text_control);
text_control->setAttribute(html_names::kClassAttr, "pseudoSelection");
CheckSelectionInvalidationChanges(*selected_text);
}
TEST_F(LayoutTextControlTest,
RemovingPseudoSelectionStyleShouldInvalidateSelectionSingle) {
SetBodyInnerHTML(R"HTML( SetBodyInnerHTML(R"HTML(
<style> <style>
.pseudoSelection::selection { background-color: green; } .pseudoSelection::selection { background-color: green; }
...@@ -93,6 +126,22 @@ TEST_F(LayoutTextControlTest, ...@@ -93,6 +126,22 @@ TEST_F(LayoutTextControlTest,
CheckSelectionInvalidationChanges(*selected_text); CheckSelectionInvalidationChanges(*selected_text);
} }
TEST_F(LayoutTextControlTest,
RemovingPseudoSelectionStyleShouldInvalidateSelectionMulti) {
SetBodyInnerHTML(R"HTML(
<style>
.pseudoSelection::selection { background-color: green; }
</style>
<textarea id="textarea" class="pseudoSelection">AAAAAAAAAAAA</textarea>
)HTML");
auto* text_control = GetTextControlElementById("textarea");
auto* selected_text = SetupLayoutTextWithCleanSelection(text_control);
text_control->removeAttribute(html_names::kClassAttr);
CheckSelectionInvalidationChanges(*selected_text);
}
TEST_F(LayoutTextControlTest, HitTestSearchInput) { TEST_F(LayoutTextControlTest, HitTestSearchInput) {
SetBodyInnerHTML(R"HTML( SetBodyInnerHTML(R"HTML(
<input id="input" type="search" <input id="input" type="search"
......
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