Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp

Issue 2215333002: Fix element visibility check for validation bubbles and SELECT popups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename to visibleBoundsInVisualViewport(), etc. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/html/HTMLSelectElement.h" 5 #include "core/html/HTMLSelectElement.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/html/HTMLFormElement.h" 9 #include "core/html/HTMLFormElement.h"
10 #include "core/html/forms/FormController.h" 10 #include "core/html/forms/FormController.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 select->reset(); 126 select->reset();
127 ASSERT_FALSE(opt2->selected()); 127 ASSERT_FALSE(opt2->selected());
128 element->removeChild(opt2); 128 element->removeChild(opt2);
129 129
130 // Restore 130 // Restore
131 select->restoreFormControlState(selectState); 131 select->restoreFormControlState(selectState);
132 EXPECT_EQ(-1, toHTMLSelectElement(element)->selectedIndex()); 132 EXPECT_EQ(-1, toHTMLSelectElement(element)->selectedIndex());
133 EXPECT_EQ(nullptr, toHTMLSelectElement(element)->optionToBeShown()); 133 EXPECT_EQ(nullptr, toHTMLSelectElement(element)->optionToBeShown());
134 } 134 }
135 135
136 TEST_F(HTMLSelectElementTest, ElementRectRelativeToViewport) 136 TEST_F(HTMLSelectElementTest, VisibleBoundsInVisualViewport)
137 { 137 {
138 document().documentElement()->setInnerHTML("<select style='position:fixed; t op:12.3px; height:24px; -webkit-appearance:none;'><option>o1</select>", ASSERT_N O_EXCEPTION); 138 document().documentElement()->setInnerHTML("<select style='position:fixed; t op:12.3px; height:24px; -webkit-appearance:none;'><option>o1</select>", ASSERT_N O_EXCEPTION);
139 document().view()->updateAllLifecyclePhases(); 139 document().view()->updateAllLifecyclePhases();
140 HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChil d()); 140 HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChil d());
141 ASSERT(select); 141 ASSERT(select);
142 IntRect bounds = select->elementRectRelativeToViewport(); 142 IntRect bounds = select->visibleBoundsInVisualViewport();
143 EXPECT_EQ(24, bounds.height()); 143 EXPECT_EQ(24, bounds.height());
144 } 144 }
145 145
146 TEST_F(HTMLSelectElementTest, PopupIsVisible) 146 TEST_F(HTMLSelectElementTest, PopupIsVisible)
147 { 147 {
148 document().documentElement()->setInnerHTML("<select><option>o1</option></sel ect>", ASSERT_NO_EXCEPTION); 148 document().documentElement()->setInnerHTML("<select><option>o1</option></sel ect>", ASSERT_NO_EXCEPTION);
149 document().view()->updateAllLifecyclePhases(); 149 document().view()->updateAllLifecyclePhases();
150 HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChil d()); 150 HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChil d());
151 ASSERT(select); 151 ASSERT(select);
152 EXPECT_FALSE(select->popupIsVisible()); 152 EXPECT_FALSE(select->popupIsVisible());
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 TEST_F(HTMLSelectElementTest, SetRecalcListItemsByOptgroupRemoval) 375 TEST_F(HTMLSelectElementTest, SetRecalcListItemsByOptgroupRemoval)
376 { 376 {
377 document().documentElement()->setInnerHTML("<select><optgroup><option>sub1</ option><option>sub2</option></optgroup></select>", ASSERT_NO_EXCEPTION); 377 document().documentElement()->setInnerHTML("<select><optgroup><option>sub1</ option><option>sub2</option></optgroup></select>", ASSERT_NO_EXCEPTION);
378 document().view()->updateAllLifecyclePhases(); 378 document().view()->updateAllLifecyclePhases();
379 HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChil d()); 379 HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChil d());
380 select->setInnerHTML("", ASSERT_NO_EXCEPTION); 380 select->setInnerHTML("", ASSERT_NO_EXCEPTION);
381 // PASS if setInnerHTML didn't have a check failure. 381 // PASS if setInnerHTML didn't have a check failure.
382 } 382 }
383 383
384 } // namespace blink 384 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLSelectElement.cpp ('k') | third_party/WebKit/Source/web/PopupMenuImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698