| OLD | NEW |
| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, VisibleBoundsInVisualViewport) | 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_NE(select, nullptr); |
| 142 IntRect bounds = select->visibleBoundsInVisualViewport(); | 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_NE(select, nullptr); |
| 152 EXPECT_FALSE(select->popupIsVisible()); | 152 EXPECT_FALSE(select->popupIsVisible()); |
| 153 select->showPopup(); | 153 select->showPopup(); |
| 154 EXPECT_TRUE(select->popupIsVisible()); | 154 EXPECT_TRUE(select->popupIsVisible()); |
| 155 document().detachLayoutTree(); | 155 document().detachLayoutTree(); |
| 156 EXPECT_FALSE(select->popupIsVisible()); | 156 EXPECT_FALSE(select->popupIsVisible()); |
| 157 } | 157 } |
| 158 | 158 |
| 159 TEST_F(HTMLSelectElementTest, FirstSelectableOption) | 159 TEST_F(HTMLSelectElementTest, FirstSelectableOption) |
| 160 { | 160 { |
| 161 { | 161 { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |