Diff
Modified: trunk/Source/WebCore/ChangeLog (118706 => 118707)
--- trunk/Source/WebCore/ChangeLog 2012-05-28 21:20:33 UTC (rev 118706)
+++ trunk/Source/WebCore/ChangeLog 2012-05-28 21:55:20 UTC (rev 118707)
@@ -1,3 +1,27 @@
+2012-05-28 Rob Flack <fla...@chromium.org>
+
+ [chromium] Only increase size of Combo Box Options when displayed on touch screen
+ https://bugs.webkit.org/show_bug.cgi?id=85921
+
+ Reviewed by Adam Barth.
+
+ 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.
+
+ No new tests as this is a flag change and covered by existing tests: WebKit/chromium/tests/PopupMenuTest.cpp
+
+ * page/Settings.cpp:
+ (WebCore::Settings::Settings):
+ * page/Settings.h:
+ (WebCore::Settings::setDeviceSupportsTouch):
+ (WebCore::Settings::deviceSupportsTouch):
+ (Settings):
+ * platform/chromium/PopupListBox.cpp:
+ (WebCore::PopupListBox::getRowHeight):
+ * platform/chromium/PopupListBox.h:
+ (PopupContainerSettings):
+ * platform/chromium/PopupMenuChromium.cpp:
+ (WebCore::PopupMenuChromium::show):
+
2012-05-28 Arvid Nilsson <anils...@rim.com>
[BlackBerry] Make custom compositing thread layers more flexible
Modified: trunk/Source/WebCore/page/Settings.cpp (118706 => 118707)
--- trunk/Source/WebCore/page/Settings.cpp 2012-05-28 21:20:33 UTC (rev 118706)
+++ trunk/Source/WebCore/page/Settings.cpp 2012-05-28 21:55:20 UTC (rev 118707)
@@ -270,6 +270,7 @@
, m_shouldRespectImageOrientation(false)
, m_wantsBalancedSetDefersLoadingBehavior(false)
, m_requestAnimationFrameEnabled(true)
+ , m_deviceSupportsTouch(false)
, m_needsDidFinishLoadOrderQuirk(false)
, m_fixedPositionCreatesStackingContext(false)
, m_syncXHRInDocumentsEnabled(true)
Modified: trunk/Source/WebCore/page/Settings.h (118706 => 118707)
--- trunk/Source/WebCore/page/Settings.h 2012-05-28 21:20:33 UTC (rev 118706)
+++ trunk/Source/WebCore/page/Settings.h 2012-05-28 21:55:20 UTC (rev 118707)
@@ -575,6 +575,9 @@
void setRequestAnimationFrameEnabled(bool enabled) { m_requestAnimationFrameEnabled = enabled; }
bool requestAnimationFrameEnabled() const { return m_requestAnimationFrameEnabled; }
+ void setDeviceSupportsTouch(bool enabled) { m_deviceSupportsTouch = enabled; }
+ bool deviceSupportsTouch() const { return m_deviceSupportsTouch; }
+
void setNeedsDidFinishLoadOrderQuirk(bool needsQuirk) { m_needsDidFinishLoadOrderQuirk = needsQuirk; }
bool needsDidFinishLoadOrderQuirk() const { return m_needsDidFinishLoadOrderQuirk; }
@@ -753,6 +756,7 @@
bool m_shouldRespectImageOrientation : 1;
bool m_wantsBalancedSetDefersLoadingBehavior : 1;
bool m_requestAnimationFrameEnabled : 1;
+ bool m_deviceSupportsTouch : 1;
bool m_needsDidFinishLoadOrderQuirk : 1;
bool m_fixedPositionCreatesStackingContext : 1;
Modified: trunk/Source/WebCore/platform/chromium/PopupListBox.cpp (118706 => 118707)
--- trunk/Source/WebCore/platform/chromium/PopupListBox.cpp 2012-05-28 21:20:33 UTC (rev 118706)
+++ trunk/Source/WebCore/platform/chromium/PopupListBox.cpp 2012-05-28 21:55:20 UTC (rev 118707)
@@ -632,7 +632,7 @@
{
int scale = m_settings.defaultDeviceScaleFactor;
int paddingForTouch = 0;
- if (RuntimeEnabledFeatures::touchEnabled())
+ if (m_settings.deviceSupportsTouch)
paddingForTouch = PopupMenuChromium::optionPaddingForTouch();
if (index < 0 || m_popupClient->itemStyle(index).isDisplayNone())
return PopupMenuChromium::minimumRowHeight() * scale;
Modified: trunk/Source/WebCore/platform/chromium/PopupListBox.h (118706 => 118707)
--- trunk/Source/WebCore/platform/chromium/PopupListBox.h 2012-05-28 21:20:33 UTC (rev 118706)
+++ trunk/Source/WebCore/platform/chromium/PopupListBox.h 2012-05-28 21:55:20 UTC (rev 118707)
@@ -80,7 +80,13 @@
// Autocomplete popups are restricted, combo-boxes (select tags) aren't.
bool restrictWidthOfListBox;
+ // The default device scale factor of the screen used to draw the menu
+ // at this scale suitable for the device DPI.
int defaultDeviceScaleFactor;
+
+ // If the device is a touch screen we increase the height of menu items
+ // to make it easier to unambiguously touch them.
+ bool deviceSupportsTouch;
};
// A container for the data for each menu item (e.g. represented by <option>
Modified: trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp (118706 => 118707)
--- trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp 2012-05-28 21:20:33 UTC (rev 118706)
+++ trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp 2012-05-28 21:55:20 UTC (rev 118707)
@@ -66,17 +66,18 @@
hide();
}
-void PopupMenuChromium::show(const IntRect& r, FrameView* v, int index)
+void PopupMenuChromium::show(const IntRect& rect, FrameView* frameView, int index)
{
if (!p.popup) {
+ Settings* settings = frameView->frame()->page()->settings();
PopupContainerSettings popupSettings = dropDownSettings;
- popupSettings.defaultDeviceScaleFactor =
- v->frame()->page()->settings()->defaultDeviceScaleFactor();
+ popupSettings.defaultDeviceScaleFactor = settings->defaultDeviceScaleFactor();
if (!popupSettings.defaultDeviceScaleFactor)
popupSettings.defaultDeviceScaleFactor = 1;
+ popupSettings.deviceSupportsTouch = settings->deviceSupportsTouch();
p.popup = PopupContainer::create(client(), PopupContainer::Select, popupSettings);
}
- p.popup->showInRect(r, v, index);
+ p.popup->showInRect(rect, frameView, index);
}
void PopupMenuChromium::hide()
Modified: trunk/Source/WebKit/chromium/ChangeLog (118706 => 118707)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-05-28 21:20:33 UTC (rev 118706)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-05-28 21:55:20 UTC (rev 118707)
@@ -1,3 +1,28 @@
+2012-05-28 Rob Flack <fla...@chromium.org>
+
+ [chromium] Only increase size of Combo Box Options when displayed on touch screen
+ https://bugs.webkit.org/show_bug.cgi?id=85921
+
+ Reviewed by Adam Barth.
+
+ 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.
+
+ * public/WebSettings.h:
+ * src/WebSettingsImpl.cpp:
+ (WebKit::WebSettingsImpl::defaultDeviceScaleFactor):
+ (WebKit):
+ (WebKit::WebSettingsImpl::setDeviceSupportsTouch):
+ (WebKit::WebSettingsImpl::deviceSupportsTouch):
+ * src/WebSettingsImpl.h:
+ (WebSettingsImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::applyAutofillSuggestions):
+ * tests/PopupMenuTest.cpp:
+ (WebKit::SelectPopupMenuTest::SetUp):
+ (WebKit::SelectPopupMenuTest::TearDown):
+ (SelectPopupMenuTest):
+ (WebKit::TEST_F):
+
2012-05-25 Jesus Sanchez-Palencia <jesus.palen...@openbossa.org>
WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled
Modified: trunk/Source/WebKit/chromium/public/WebSettings.h (118706 => 118707)
--- trunk/Source/WebKit/chromium/public/WebSettings.h 2012-05-28 21:20:33 UTC (rev 118706)
+++ trunk/Source/WebKit/chromium/public/WebSettings.h 2012-05-28 21:55:20 UTC (rev 118707)
@@ -67,6 +67,7 @@
virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool) = 0;
virtual void setFontBoostingEnabled(bool) = 0;
virtual void setDefaultTextEncodingName(const WebString&) = 0;
+ virtual void setDeviceSupportsTouch(bool) = 0;
virtual void setJavaScriptEnabled(bool) = 0;
virtual void setWebSecurityEnabled(bool) = 0;
virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0;
Modified: trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp (118706 => 118707)
--- trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp 2012-05-28 21:20:33 UTC (rev 118706)
+++ trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp 2012-05-28 21:55:20 UTC (rev 118707)
@@ -118,6 +118,21 @@
m_settings->setDefaultDeviceScaleFactor(defaultDeviceScaleFactor);
}
+int WebSettingsImpl::defaultDeviceScaleFactor()
+{
+ return m_settings->defaultDeviceScaleFactor();
+}
+
+void WebSettingsImpl::setDeviceSupportsTouch(bool deviceSupportsTouch)
+{
+ m_settings->setDeviceSupportsTouch(deviceSupportsTouch);
+}
+
+bool WebSettingsImpl::deviceSupportsTouch()
+{
+ return m_settings->deviceSupportsTouch();
+}
+
void WebSettingsImpl::setApplyDefaultDeviceScaleFactorInCompositor(bool applyDefaultDeviceScaleFactorInCompositor)
{
m_applyDefaultDeviceScaleFactorInCompositor = applyDefaultDeviceScaleFactorInCompositor;
Modified: trunk/Source/WebKit/chromium/src/WebSettingsImpl.h (118706 => 118707)
--- trunk/Source/WebKit/chromium/src/WebSettingsImpl.h 2012-05-28 21:20:33 UTC (rev 118706)
+++ trunk/Source/WebKit/chromium/src/WebSettingsImpl.h 2012-05-28 21:55:20 UTC (rev 118707)
@@ -55,9 +55,12 @@
virtual void setMinimumFontSize(int);
virtual void setMinimumLogicalFontSize(int);
virtual void setDefaultDeviceScaleFactor(int);
+ virtual int defaultDeviceScaleFactor();
virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool);
virtual void setFontBoostingEnabled(bool);
virtual void setDefaultTextEncodingName(const WebString&);
+ virtual void setDeviceSupportsTouch(bool);
+ virtual bool deviceSupportsTouch();
virtual void setJavaScriptEnabled(bool);
virtual void setWebSecurityEnabled(bool);
virtual void setJavaScriptCanOpenWindowsAutomatically(bool);
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (118706 => 118707)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-05-28 21:20:33 UTC (rev 118706)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-05-28 21:55:20 UTC (rev 118707)
@@ -2955,10 +2955,10 @@
if (!m_autofillPopup) {
PopupContainerSettings popupSettings = autofillPopupSettings;
- popupSettings.defaultDeviceScaleFactor =
- m_page->settings()->defaultDeviceScaleFactor();
+ popupSettings.defaultDeviceScaleFactor = settingsImpl()->defaultDeviceScaleFactor();
if (!popupSettings.defaultDeviceScaleFactor)
popupSettings.defaultDeviceScaleFactor = 1;
+ popupSettings.deviceSupportsTouch = settingsImpl()->deviceSupportsTouch();
m_autofillPopup = PopupContainer::create(m_autofillPopupClient.get(),
PopupContainer::Suggestion,
popupSettings);
Modified: trunk/Source/WebKit/chromium/tests/PopupMenuTest.cpp (118706 => 118707)
--- trunk/Source/WebKit/chromium/tests/PopupMenuTest.cpp 2012-05-28 21:20:33 UTC (rev 118706)
+++ trunk/Source/WebKit/chromium/tests/PopupMenuTest.cpp 2012-05-28 21:55:20 UTC (rev 118707)
@@ -182,10 +182,6 @@
protected:
virtual void SetUp()
{
- // When touch is enabled, padding is added to option elements
- // In these tests, we'll assume touch is disabled.
- m_touchWasEnabled = RuntimeEnabledFeatures::touchEnabled();
- RuntimeEnabledFeatures::setTouchEnabled(false);
m_webView = static_cast<WebViewImpl*>(WebView::create(&m_webviewClient));
m_webView->initializeMainFrame(&m_webFrameClient);
m_popupMenu = adoptRef(new PopupMenuChromium(&m_popupMenuClient));
@@ -196,7 +192,6 @@
m_popupMenu = 0;
m_webView->close();
webkit_support::UnregisterAllMockedURLs();
- RuntimeEnabledFeatures::setTouchEnabled(m_touchWasEnabled);
}
// Returns true if there currently is a select popup in the WebView.
@@ -284,7 +279,6 @@
TestWebFrameClient m_webFrameClient;
TestPopupMenuClient m_popupMenuClient;
RefPtr<PopupMenu> m_popupMenu;
- bool m_touchWasEnabled;
std::string baseURL;
};
@@ -360,8 +354,9 @@
{
showPopup();
- // Y of 18 to be on the item at index 1 (12 font plus border and more to be safe).
- IntPoint row1Point(2, 18);
+ int menuItemHeight = m_webView->selectPopup()->menuItemHeight();
+ // menuItemHeight * 1.5 means the Y position on the item at index 1.
+ IntPoint row1Point(2, menuItemHeight * 1.5);
// Simulate a click down/up on the first item.
simulateLeftMouseDownEvent(row1Point);
simulateLeftMouseUpEvent(row1Point);
@@ -377,8 +372,9 @@
{
showPopup();
- // Y of 18 to be on the item at index 1 (12 font plus border and more to be safe).
- IntPoint row1Point(2, 18);
+ int menuItemHeight = m_webView->selectPopup()->menuItemHeight();
+ // menuItemHeight * 1.5 means the Y position on the item at index 1.
+ IntPoint row1Point(2, menuItemHeight * 1.5);
// Simulate the mouse moving over the first item.
PlatformMouseEvent mouseEvent(row1Point, row1Point, NoButton, PlatformEvent::MouseMoved,
1, false, false, false, false, 0);
@@ -421,9 +417,9 @@
showPopup();
- int menuHeight = m_webView->selectPopup()->menuItemHeight();
- // menuHeight * 0.5 means the Y position on the item at index 0.
- IntPoint row1Point(2, menuHeight * 0.5);
+ int menuItemHeight = m_webView->selectPopup()->menuItemHeight();
+ // menuItemHeight * 0.5 means the Y position on the item at index 0.
+ IntPoint row1Point(2, menuItemHeight * 0.5);
simulateLeftMouseDownEvent(row1Point);
simulateLeftMouseUpEvent(row1Point);
@@ -437,8 +433,8 @@
m_popupMenuClient.setDisabledIndex(1);
showPopup();
- // menuHeight * 1.5 means the Y position on the item at index 1.
- row1Point.setY(menuHeight * 1.5);
+ // menuItemHeight * 1.5 means the Y position on the item at index 1.
+ row1Point.setY(menuItemHeight * 1.5);
simulateLeftMouseDownEvent(row1Point);
simulateLeftMouseUpEvent(row1Point);
@@ -446,8 +442,8 @@
EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str());
showPopup();
- // menuHeight * 2.5 means the Y position on the item at index 2.
- row1Point.setY(menuHeight * 2.5);
+ // menuItemHeight * 2.5 means the Y position on the item at index 2.
+ row1Point.setY(menuItemHeight * 2.5);
simulateLeftMouseDownEvent(row1Point);
simulateLeftMouseUpEvent(row1Point);
@@ -488,9 +484,9 @@
showPopup();
- int menuHeight = m_webView->selectPopup()->menuItemHeight();
- // menuHeight * 1.5 means the Y position on the item at index 1.
- IntPoint row1Point(2, menuHeight * 1.5);
+ int menuItemHeight = m_webView->selectPopup()->menuItemHeight();
+ // menuItemHeight * 1.5 means the Y position on the item at index 1.
+ IntPoint row1Point(2, menuItemHeight * 1.5);
simulateLeftMouseDownEvent(row1Point);
simulateLeftMouseUpEvent(row1Point);
@@ -510,9 +506,9 @@
showPopup();
- int menuHeight = m_webView->selectPopup()->menuItemHeight();
- // menuHeight * 1.5 means the Y position on the item at index 1.
- IntPoint row1Point(2, menuHeight * 1.5);
+ int menuItemHeight = m_webView->selectPopup()->menuItemHeight();
+ // menuItemHeight * 1.5 means the Y position on the item at index 1.
+ IntPoint row1Point(2, menuItemHeight * 1.5);
simulateLeftMouseDownEvent(row1Point);
simulateLeftMouseUpEvent(row1Point);