Changeset 118707 in webkit
- Timestamp:
- May 28, 2012 2:55:20 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r118706 r118707 1 2012-05-28 Rob Flack <flackr@chromium.org> 2 3 [chromium] Only increase size of Combo Box Options when displayed on touch screen 4 https://bugs.webkit.org/show_bug.cgi?id=85921 5 6 Reviewed by Adam Barth. 7 8 Adds a flag to set whether the current device is a touch screen, independent of whether touch events are supported and use this for the combo box sizing. 9 10 No new tests as this is a flag change and covered by existing tests: WebKit/chromium/tests/PopupMenuTest.cpp 11 12 * page/Settings.cpp: 13 (WebCore::Settings::Settings): 14 * page/Settings.h: 15 (WebCore::Settings::setDeviceSupportsTouch): 16 (WebCore::Settings::deviceSupportsTouch): 17 (Settings): 18 * platform/chromium/PopupListBox.cpp: 19 (WebCore::PopupListBox::getRowHeight): 20 * platform/chromium/PopupListBox.h: 21 (PopupContainerSettings): 22 * platform/chromium/PopupMenuChromium.cpp: 23 (WebCore::PopupMenuChromium::show): 24 1 25 2012-05-28 Arvid Nilsson <anilsson@rim.com> 2 26 -
trunk/Source/WebCore/page/Settings.cpp
r118599 r118707 271 271 , m_wantsBalancedSetDefersLoadingBehavior(false) 272 272 , m_requestAnimationFrameEnabled(true) 273 , m_deviceSupportsTouch(false) 273 274 , m_needsDidFinishLoadOrderQuirk(false) 274 275 , m_fixedPositionCreatesStackingContext(false) -
trunk/Source/WebCore/page/Settings.h
r118599 r118707 575 575 void setRequestAnimationFrameEnabled(bool enabled) { m_requestAnimationFrameEnabled = enabled; } 576 576 bool requestAnimationFrameEnabled() const { return m_requestAnimationFrameEnabled; } 577 578 void setDeviceSupportsTouch(bool enabled) { m_deviceSupportsTouch = enabled; } 579 bool deviceSupportsTouch() const { return m_deviceSupportsTouch; } 577 580 578 581 void setNeedsDidFinishLoadOrderQuirk(bool needsQuirk) { m_needsDidFinishLoadOrderQuirk = needsQuirk; } … … 754 757 bool m_wantsBalancedSetDefersLoadingBehavior : 1; 755 758 bool m_requestAnimationFrameEnabled : 1; 759 bool m_deviceSupportsTouch : 1; 756 760 bool m_needsDidFinishLoadOrderQuirk : 1; 757 761 -
trunk/Source/WebCore/platform/chromium/PopupListBox.cpp
r116723 r118707 633 633 int scale = m_settings.defaultDeviceScaleFactor; 634 634 int paddingForTouch = 0; 635 if ( RuntimeEnabledFeatures::touchEnabled())635 if (m_settings.deviceSupportsTouch) 636 636 paddingForTouch = PopupMenuChromium::optionPaddingForTouch(); 637 637 if (index < 0 || m_popupClient->itemStyle(index).isDisplayNone()) -
trunk/Source/WebCore/platform/chromium/PopupListBox.h
r111539 r118707 81 81 bool restrictWidthOfListBox; 82 82 83 // The default device scale factor of the screen used to draw the menu 84 // at this scale suitable for the device DPI. 83 85 int defaultDeviceScaleFactor; 86 87 // If the device is a touch screen we increase the height of menu items 88 // to make it easier to unambiguously touch them. 89 bool deviceSupportsTouch; 84 90 }; 85 91 -
trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp
r111539 r118707 67 67 } 68 68 69 void PopupMenuChromium::show(const IntRect& r , FrameView* v, int index)69 void PopupMenuChromium::show(const IntRect& rect, FrameView* frameView, int index) 70 70 { 71 71 if (!p.popup) { 72 Settings* settings = frameView->frame()->page()->settings(); 72 73 PopupContainerSettings popupSettings = dropDownSettings; 73 popupSettings.defaultDeviceScaleFactor = 74 v->frame()->page()->settings()->defaultDeviceScaleFactor(); 74 popupSettings.defaultDeviceScaleFactor = settings->defaultDeviceScaleFactor(); 75 75 if (!popupSettings.defaultDeviceScaleFactor) 76 76 popupSettings.defaultDeviceScaleFactor = 1; 77 popupSettings.deviceSupportsTouch = settings->deviceSupportsTouch(); 77 78 p.popup = PopupContainer::create(client(), PopupContainer::Select, popupSettings); 78 79 } 79 p.popup->showInRect(r , v, index);80 p.popup->showInRect(rect, frameView, index); 80 81 } 81 82 -
trunk/Source/WebKit/chromium/ChangeLog
r118705 r118707 1 2012-05-28 Rob Flack <flackr@chromium.org> 2 3 [chromium] Only increase size of Combo Box Options when displayed on touch screen 4 https://bugs.webkit.org/show_bug.cgi?id=85921 5 6 Reviewed by Adam Barth. 7 8 Adds a flag to set whether the current device is a touch screen, independent of whether touch events are supported and use this for the combo box sizing. 9 10 * public/WebSettings.h: 11 * src/WebSettingsImpl.cpp: 12 (WebKit::WebSettingsImpl::defaultDeviceScaleFactor): 13 (WebKit): 14 (WebKit::WebSettingsImpl::setDeviceSupportsTouch): 15 (WebKit::WebSettingsImpl::deviceSupportsTouch): 16 * src/WebSettingsImpl.h: 17 (WebSettingsImpl): 18 * src/WebViewImpl.cpp: 19 (WebKit::WebViewImpl::applyAutofillSuggestions): 20 * tests/PopupMenuTest.cpp: 21 (WebKit::SelectPopupMenuTest::SetUp): 22 (WebKit::SelectPopupMenuTest::TearDown): 23 (SelectPopupMenuTest): 24 (WebKit::TEST_F): 25 1 26 2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> 2 27 -
trunk/Source/WebKit/chromium/public/WebSettings.h
r118599 r118707 68 68 virtual void setFontBoostingEnabled(bool) = 0; 69 69 virtual void setDefaultTextEncodingName(const WebString&) = 0; 70 virtual void setDeviceSupportsTouch(bool) = 0; 70 71 virtual void setJavaScriptEnabled(bool) = 0; 71 72 virtual void setWebSecurityEnabled(bool) = 0; -
trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp
r118599 r118707 119 119 } 120 120 121 int WebSettingsImpl::defaultDeviceScaleFactor() 122 { 123 return m_settings->defaultDeviceScaleFactor(); 124 } 125 126 void WebSettingsImpl::setDeviceSupportsTouch(bool deviceSupportsTouch) 127 { 128 m_settings->setDeviceSupportsTouch(deviceSupportsTouch); 129 } 130 131 bool WebSettingsImpl::deviceSupportsTouch() 132 { 133 return m_settings->deviceSupportsTouch(); 134 } 135 121 136 void WebSettingsImpl::setApplyDefaultDeviceScaleFactorInCompositor(bool applyDefaultDeviceScaleFactorInCompositor) 122 137 { -
trunk/Source/WebKit/chromium/src/WebSettingsImpl.h
r118599 r118707 56 56 virtual void setMinimumLogicalFontSize(int); 57 57 virtual void setDefaultDeviceScaleFactor(int); 58 virtual int defaultDeviceScaleFactor(); 58 59 virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool); 59 60 virtual void setFontBoostingEnabled(bool); 60 61 virtual void setDefaultTextEncodingName(const WebString&); 62 virtual void setDeviceSupportsTouch(bool); 63 virtual bool deviceSupportsTouch(); 61 64 virtual void setJavaScriptEnabled(bool); 62 65 virtual void setWebSecurityEnabled(bool); -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r118513 r118707 2956 2956 if (!m_autofillPopup) { 2957 2957 PopupContainerSettings popupSettings = autofillPopupSettings; 2958 popupSettings.defaultDeviceScaleFactor = 2959 m_page->settings()->defaultDeviceScaleFactor(); 2958 popupSettings.defaultDeviceScaleFactor = settingsImpl()->defaultDeviceScaleFactor(); 2960 2959 if (!popupSettings.defaultDeviceScaleFactor) 2961 2960 popupSettings.defaultDeviceScaleFactor = 1; 2961 popupSettings.deviceSupportsTouch = settingsImpl()->deviceSupportsTouch(); 2962 2962 m_autofillPopup = PopupContainer::create(m_autofillPopupClient.get(), 2963 2963 PopupContainer::Suggestion, -
trunk/Source/WebKit/chromium/tests/PopupMenuTest.cpp
r115441 r118707 183 183 virtual void SetUp() 184 184 { 185 // When touch is enabled, padding is added to option elements186 // In these tests, we'll assume touch is disabled.187 m_touchWasEnabled = RuntimeEnabledFeatures::touchEnabled();188 RuntimeEnabledFeatures::setTouchEnabled(false);189 185 m_webView = static_cast<WebViewImpl*>(WebView::create(&m_webviewClient)); 190 186 m_webView->initializeMainFrame(&m_webFrameClient); … … 197 193 m_webView->close(); 198 194 webkit_support::UnregisterAllMockedURLs(); 199 RuntimeEnabledFeatures::setTouchEnabled(m_touchWasEnabled);200 195 } 201 196 … … 285 280 TestPopupMenuClient m_popupMenuClient; 286 281 RefPtr<PopupMenu> m_popupMenu; 287 bool m_touchWasEnabled;288 282 std::string baseURL; 289 283 }; … … 361 355 showPopup(); 362 356 363 // Y of 18 to be on the item at index 1 (12 font plus border and more to be safe). 364 IntPoint row1Point(2, 18); 357 int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); 358 // menuItemHeight * 1.5 means the Y position on the item at index 1. 359 IntPoint row1Point(2, menuItemHeight * 1.5); 365 360 // Simulate a click down/up on the first item. 366 361 simulateLeftMouseDownEvent(row1Point); … … 378 373 showPopup(); 379 374 380 // Y of 18 to be on the item at index 1 (12 font plus border and more to be safe). 381 IntPoint row1Point(2, 18); 375 int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); 376 // menuItemHeight * 1.5 means the Y position on the item at index 1. 377 IntPoint row1Point(2, menuItemHeight * 1.5); 382 378 // Simulate the mouse moving over the first item. 383 379 PlatformMouseEvent mouseEvent(row1Point, row1Point, NoButton, PlatformEvent::MouseMoved, … … 422 418 showPopup(); 423 419 424 int menu Height = m_webView->selectPopup()->menuItemHeight();425 // menu Height * 0.5 means the Y position on the item at index 0.426 IntPoint row1Point(2, menu Height * 0.5);420 int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); 421 // menuItemHeight * 0.5 means the Y position on the item at index 0. 422 IntPoint row1Point(2, menuItemHeight * 0.5); 427 423 simulateLeftMouseDownEvent(row1Point); 428 424 simulateLeftMouseUpEvent(row1Point); … … 438 434 439 435 showPopup(); 440 // menu Height * 1.5 means the Y position on the item at index 1.441 row1Point.setY(menu Height * 1.5);436 // menuItemHeight * 1.5 means the Y position on the item at index 1. 437 row1Point.setY(menuItemHeight * 1.5); 442 438 simulateLeftMouseDownEvent(row1Point); 443 439 simulateLeftMouseUpEvent(row1Point); … … 447 443 448 444 showPopup(); 449 // menu Height * 2.5 means the Y position on the item at index 2.450 row1Point.setY(menu Height * 2.5);445 // menuItemHeight * 2.5 means the Y position on the item at index 2. 446 row1Point.setY(menuItemHeight * 2.5); 451 447 simulateLeftMouseDownEvent(row1Point); 452 448 simulateLeftMouseUpEvent(row1Point); … … 489 485 showPopup(); 490 486 491 int menu Height = m_webView->selectPopup()->menuItemHeight();492 // menu Height * 1.5 means the Y position on the item at index 1.493 IntPoint row1Point(2, menu Height * 1.5);487 int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); 488 // menuItemHeight * 1.5 means the Y position on the item at index 1. 489 IntPoint row1Point(2, menuItemHeight * 1.5); 494 490 simulateLeftMouseDownEvent(row1Point); 495 491 simulateLeftMouseUpEvent(row1Point); … … 511 507 showPopup(); 512 508 513 int menu Height = m_webView->selectPopup()->menuItemHeight();514 // menu Height * 1.5 means the Y position on the item at index 1.515 IntPoint row1Point(2, menu Height * 1.5);509 int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); 510 // menuItemHeight * 1.5 means the Y position on the item at index 1. 511 IntPoint row1Point(2, menuItemHeight * 1.5); 516 512 simulateLeftMouseDownEvent(row1Point); 517 513 simulateLeftMouseUpEvent(row1Point);
Note: See TracChangeset
for help on using the changeset viewer.