| Differences between
and this patch
- Source/WebCore/ChangeLog +24 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
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 NOBODY (OOPS!).
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
2012-05-25  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
25
2012-05-25  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
2
26
3
        WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled
27
        WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled
- Source/WebCore/page/Settings.cpp +1 lines
Lines 270-275 Settings::Settings(Page* page) Source/WebCore/page/Settings.cpp_sec1
270
    , m_shouldRespectImageOrientation(false)
270
    , m_shouldRespectImageOrientation(false)
271
    , m_wantsBalancedSetDefersLoadingBehavior(false)
271
    , m_wantsBalancedSetDefersLoadingBehavior(false)
272
    , m_requestAnimationFrameEnabled(true)
272
    , m_requestAnimationFrameEnabled(true)
273
    , m_deviceSupportsTouch(false)
273
    , m_needsDidFinishLoadOrderQuirk(false)
274
    , m_needsDidFinishLoadOrderQuirk(false)
274
    , m_fixedPositionCreatesStackingContext(false)
275
    , m_fixedPositionCreatesStackingContext(false)
275
    , m_syncXHRInDocumentsEnabled(true)
276
    , m_syncXHRInDocumentsEnabled(true)
- Source/WebCore/page/Settings.h +4 lines
Lines 575-580 namespace WebCore { Source/WebCore/page/Settings.h_sec1
575
        void setRequestAnimationFrameEnabled(bool enabled) { m_requestAnimationFrameEnabled = enabled; }
575
        void setRequestAnimationFrameEnabled(bool enabled) { m_requestAnimationFrameEnabled = enabled; }
576
        bool requestAnimationFrameEnabled() const { return m_requestAnimationFrameEnabled; }
576
        bool requestAnimationFrameEnabled() const { return m_requestAnimationFrameEnabled; }
577
577
578
        void setDeviceSupportsTouch(bool enabled) { m_deviceSupportsTouch = enabled; }
579
        bool deviceSupportsTouch() const { return m_deviceSupportsTouch; }
580
578
        void setNeedsDidFinishLoadOrderQuirk(bool needsQuirk) { m_needsDidFinishLoadOrderQuirk = needsQuirk; }
581
        void setNeedsDidFinishLoadOrderQuirk(bool needsQuirk) { m_needsDidFinishLoadOrderQuirk = needsQuirk; }
579
        bool needsDidFinishLoadOrderQuirk() const { return m_needsDidFinishLoadOrderQuirk; }
582
        bool needsDidFinishLoadOrderQuirk() const { return m_needsDidFinishLoadOrderQuirk; }
580
583
Lines 753-758 namespace WebCore { Source/WebCore/page/Settings.h_sec2
753
        bool m_shouldRespectImageOrientation : 1;
756
        bool m_shouldRespectImageOrientation : 1;
754
        bool m_wantsBalancedSetDefersLoadingBehavior : 1;
757
        bool m_wantsBalancedSetDefersLoadingBehavior : 1;
755
        bool m_requestAnimationFrameEnabled : 1;
758
        bool m_requestAnimationFrameEnabled : 1;
759
        bool m_deviceSupportsTouch : 1;
756
        bool m_needsDidFinishLoadOrderQuirk : 1;
760
        bool m_needsDidFinishLoadOrderQuirk : 1;
757
761
758
        bool m_fixedPositionCreatesStackingContext : 1;
762
        bool m_fixedPositionCreatesStackingContext : 1;
- Source/WebCore/platform/chromium/PopupListBox.cpp -1 / +1 lines
Lines 632-638 int PopupListBox::getRowHeight(int index Source/WebCore/platform/chromium/PopupListBox.cpp_sec1
632
{
632
{
633
    int scale = m_settings.defaultDeviceScaleFactor;
633
    int scale = m_settings.defaultDeviceScaleFactor;
634
    int paddingForTouch = 0;
634
    int paddingForTouch = 0;
635
    if (RuntimeEnabledFeatures::touchEnabled())
635
    if (m_settings.deviceSupportsTouch)
636
        paddingForTouch = PopupMenuChromium::optionPaddingForTouch();
636
        paddingForTouch = PopupMenuChromium::optionPaddingForTouch();
637
    if (index < 0 || m_popupClient->itemStyle(index).isDisplayNone())
637
    if (index < 0 || m_popupClient->itemStyle(index).isDisplayNone())
638
        return PopupMenuChromium::minimumRowHeight() * scale;
638
        return PopupMenuChromium::minimumRowHeight() * scale;
- Source/WebCore/platform/chromium/PopupListBox.h +6 lines
Lines 80-86 struct PopupContainerSettings { Source/WebCore/platform/chromium/PopupListBox.h_sec1
80
    // Autocomplete popups are restricted, combo-boxes (select tags) aren't.
80
    // Autocomplete popups are restricted, combo-boxes (select tags) aren't.
81
    bool restrictWidthOfListBox;
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
    int defaultDeviceScaleFactor;
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
86
// A container for the data for each menu item (e.g. represented by <option>
92
// A container for the data for each menu item (e.g. represented by <option>
- Source/WebCore/platform/chromium/PopupMenuChromium.cpp -4 / +5 lines
Lines 66-82 PopupMenuChromium::~PopupMenuChromium() Source/WebCore/platform/chromium/PopupMenuChromium.cpp_sec1
66
    hide();
66
    hide();
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
    if (!p.popup) {
71
    if (!p.popup) {
72
        Settings* settings = frameView->frame()->page()->settings();
72
        PopupContainerSettings popupSettings = dropDownSettings;
73
        PopupContainerSettings popupSettings = dropDownSettings;
73
        popupSettings.defaultDeviceScaleFactor =
74
        popupSettings.defaultDeviceScaleFactor = settings->defaultDeviceScaleFactor();
74
            v->frame()->page()->settings()->defaultDeviceScaleFactor();
75
        if (!popupSettings.defaultDeviceScaleFactor)
75
        if (!popupSettings.defaultDeviceScaleFactor)
76
            popupSettings.defaultDeviceScaleFactor = 1;
76
            popupSettings.defaultDeviceScaleFactor = 1;
77
        popupSettings.deviceSupportsTouch = settings->deviceSupportsTouch();
77
        p.popup = PopupContainer::create(client(), PopupContainer::Select, popupSettings);
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
82
void PopupMenuChromium::hide()
83
void PopupMenuChromium::hide()
- Source/WebKit/chromium/ChangeLog +25 lines
Lines 1-3 Source/WebKit/chromium/ChangeLog_sec1
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 NOBODY (OOPS!).
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
2012-05-25  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
26
2012-05-25  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
2
27
3
        WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled
28
        WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled
- Source/WebKit/chromium/public/WebSettings.h +1 lines
Lines 67-72 public: Source/WebKit/chromium/public/WebSettings.h_sec1
67
    virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool) = 0;
67
    virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool) = 0;
68
    virtual void setFontBoostingEnabled(bool) = 0;
68
    virtual void setFontBoostingEnabled(bool) = 0;
69
    virtual void setDefaultTextEncodingName(const WebString&) = 0;
69
    virtual void setDefaultTextEncodingName(const WebString&) = 0;
70
    virtual void setDeviceSupportsTouch(bool) = 0;
70
    virtual void setJavaScriptEnabled(bool) = 0;
71
    virtual void setJavaScriptEnabled(bool) = 0;
71
    virtual void setWebSecurityEnabled(bool) = 0;
72
    virtual void setWebSecurityEnabled(bool) = 0;
72
    virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0;
73
    virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0;
- Source/WebKit/chromium/src/WebSettingsImpl.cpp +15 lines
Lines 118-123 void WebSettingsImpl::setDefaultDeviceSc Source/WebKit/chromium/src/WebSettingsImpl.cpp_sec1
118
    m_settings->setDefaultDeviceScaleFactor(defaultDeviceScaleFactor);
118
    m_settings->setDefaultDeviceScaleFactor(defaultDeviceScaleFactor);
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
void WebSettingsImpl::setApplyDefaultDeviceScaleFactorInCompositor(bool applyDefaultDeviceScaleFactorInCompositor)
136
void WebSettingsImpl::setApplyDefaultDeviceScaleFactorInCompositor(bool applyDefaultDeviceScaleFactorInCompositor)
122
{
137
{
123
    m_applyDefaultDeviceScaleFactorInCompositor = applyDefaultDeviceScaleFactorInCompositor;
138
    m_applyDefaultDeviceScaleFactorInCompositor = applyDefaultDeviceScaleFactorInCompositor;
- Source/WebKit/chromium/src/WebSettingsImpl.h +3 lines
Lines 55-63 public: Source/WebKit/chromium/src/WebSettingsImpl.h_sec1
55
    virtual void setMinimumFontSize(int);
55
    virtual void setMinimumFontSize(int);
56
    virtual void setMinimumLogicalFontSize(int);
56
    virtual void setMinimumLogicalFontSize(int);
57
    virtual void setDefaultDeviceScaleFactor(int);
57
    virtual void setDefaultDeviceScaleFactor(int);
58
    virtual int defaultDeviceScaleFactor();
58
    virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool);
59
    virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool);
59
    virtual void setFontBoostingEnabled(bool);
60
    virtual void setFontBoostingEnabled(bool);
60
    virtual void setDefaultTextEncodingName(const WebString&);
61
    virtual void setDefaultTextEncodingName(const WebString&);
62
    virtual void setDeviceSupportsTouch(bool);
63
    virtual bool deviceSupportsTouch();
61
    virtual void setJavaScriptEnabled(bool);
64
    virtual void setJavaScriptEnabled(bool);
62
    virtual void setWebSecurityEnabled(bool);
65
    virtual void setWebSecurityEnabled(bool);
63
    virtual void setJavaScriptCanOpenWindowsAutomatically(bool);
66
    virtual void setJavaScriptCanOpenWindowsAutomatically(bool);
- Source/WebKit/chromium/src/WebViewImpl.cpp -2 / +2 lines
Lines 2955-2964 void WebViewImpl::applyAutofillSuggestio Source/WebKit/chromium/src/WebViewImpl.cpp_sec1
2955
2955
2956
    if (!m_autofillPopup) {
2956
    if (!m_autofillPopup) {
2957
        PopupContainerSettings popupSettings = autofillPopupSettings;
2957
        PopupContainerSettings popupSettings = autofillPopupSettings;
2958
        popupSettings.defaultDeviceScaleFactor =
2958
        popupSettings.defaultDeviceScaleFactor = settingsImpl()->defaultDeviceScaleFactor();
2959
            m_page->settings()->defaultDeviceScaleFactor();
2960
        if (!popupSettings.defaultDeviceScaleFactor)
2959
        if (!popupSettings.defaultDeviceScaleFactor)
2961
            popupSettings.defaultDeviceScaleFactor = 1;
2960
            popupSettings.defaultDeviceScaleFactor = 1;
2961
        popupSettings.deviceSupportsTouch = settingsImpl()->deviceSupportsTouch();
2962
        m_autofillPopup = PopupContainer::create(m_autofillPopupClient.get(),
2962
        m_autofillPopup = PopupContainer::create(m_autofillPopupClient.get(),
2963
                                                 PopupContainer::Suggestion,
2963
                                                 PopupContainer::Suggestion,
2964
                                                 popupSettings);
2964
                                                 popupSettings);
- Source/WebKit/chromium/tests/PopupMenuTest.cpp -23 / +19 lines
Lines 182-191 public: Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec1
182
protected:
182
protected:
183
    virtual void SetUp()
183
    virtual void SetUp()
184
    {
184
    {
185
        // When touch is enabled, padding is added to option elements
186
        // In these tests, we'll assume touch is disabled.
187
        m_touchWasEnabled = RuntimeEnabledFeatures::touchEnabled();
188
        RuntimeEnabledFeatures::setTouchEnabled(false);
189
        m_webView = static_cast<WebViewImpl*>(WebView::create(&m_webviewClient));
185
        m_webView = static_cast<WebViewImpl*>(WebView::create(&m_webviewClient));
190
        m_webView->initializeMainFrame(&m_webFrameClient);
186
        m_webView->initializeMainFrame(&m_webFrameClient);
191
        m_popupMenu = adoptRef(new PopupMenuChromium(&m_popupMenuClient));
187
        m_popupMenu = adoptRef(new PopupMenuChromium(&m_popupMenuClient));
Lines 196-202 protected: Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec2
196
        m_popupMenu = 0;
192
        m_popupMenu = 0;
197
        m_webView->close();
193
        m_webView->close();
198
        webkit_support::UnregisterAllMockedURLs();
194
        webkit_support::UnregisterAllMockedURLs();
199
        RuntimeEnabledFeatures::setTouchEnabled(m_touchWasEnabled);
200
    }
195
    }
201
196
202
    // Returns true if there currently is a select popup in the WebView.
197
    // Returns true if there currently is a select popup in the WebView.
Lines 284-290 protected: Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec3
284
    TestWebFrameClient m_webFrameClient;
279
    TestWebFrameClient m_webFrameClient;
285
    TestPopupMenuClient m_popupMenuClient;
280
    TestPopupMenuClient m_popupMenuClient;
286
    RefPtr<PopupMenu> m_popupMenu;
281
    RefPtr<PopupMenu> m_popupMenu;
287
    bool m_touchWasEnabled;
288
    std::string baseURL;
282
    std::string baseURL;
289
};
283
};
290
284
Lines 360-367 TEST_F(SelectPopupMenuTest, ClickItem) Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec4
360
{
354
{
361
    showPopup();
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).
357
    int menuItemHeight = m_webView->selectPopup()->menuItemHeight();
364
    IntPoint row1Point(2, 18);
358
    // menuItemHeight * 1.5 means the Y position on the item at index 1.
359
    IntPoint row1Point(2, menuItemHeight * 1.5);
365
    // Simulate a click down/up on the first item.
360
    // Simulate a click down/up on the first item.
366
    simulateLeftMouseDownEvent(row1Point);
361
    simulateLeftMouseDownEvent(row1Point);
367
    simulateLeftMouseUpEvent(row1Point);
362
    simulateLeftMouseUpEvent(row1Point);
Lines 377-384 TEST_F(SelectPopupMenuTest, MouseOverIte Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec5
377
{
372
{
378
    showPopup();
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).
375
    int menuItemHeight = m_webView->selectPopup()->menuItemHeight();
381
    IntPoint row1Point(2, 18);
376
    // menuItemHeight * 1.5 means the Y position on the item at index 1.
377
    IntPoint row1Point(2, menuItemHeight * 1.5);
382
    // Simulate the mouse moving over the first item.
378
    // Simulate the mouse moving over the first item.
383
    PlatformMouseEvent mouseEvent(row1Point, row1Point, NoButton, PlatformEvent::MouseMoved,
379
    PlatformMouseEvent mouseEvent(row1Point, row1Point, NoButton, PlatformEvent::MouseMoved,
384
                                  1, false, false, false, false, 0);
380
                                  1, false, false, false, false, 0);
Lines 421-429 TEST_F(SelectPopupMenuTest, DISABLED_Sel Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec6
421
417
422
    showPopup();
418
    showPopup();
423
419
424
    int menuHeight = m_webView->selectPopup()->menuItemHeight();
420
    int menuItemHeight = m_webView->selectPopup()->menuItemHeight();
425
    // menuHeight * 0.5 means the Y position on the item at index 0.
421
    // menuItemHeight * 0.5 means the Y position on the item at index 0.
426
    IntPoint row1Point(2, menuHeight * 0.5);
422
    IntPoint row1Point(2, menuItemHeight * 0.5);
427
    simulateLeftMouseDownEvent(row1Point);
423
    simulateLeftMouseDownEvent(row1Point);
428
    simulateLeftMouseUpEvent(row1Point);
424
    simulateLeftMouseUpEvent(row1Point);
429
425
Lines 437-444 TEST_F(SelectPopupMenuTest, DISABLED_Sel Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec7
437
    m_popupMenuClient.setDisabledIndex(1);
433
    m_popupMenuClient.setDisabledIndex(1);
438
434
439
    showPopup();
435
    showPopup();
440
    // menuHeight * 1.5 means the Y position on the item at index 1.
436
    // menuItemHeight * 1.5 means the Y position on the item at index 1.
441
    row1Point.setY(menuHeight * 1.5);
437
    row1Point.setY(menuItemHeight * 1.5);
442
    simulateLeftMouseDownEvent(row1Point);
438
    simulateLeftMouseDownEvent(row1Point);
443
    simulateLeftMouseUpEvent(row1Point);
439
    simulateLeftMouseUpEvent(row1Point);
444
440
Lines 446-453 TEST_F(SelectPopupMenuTest, DISABLED_Sel Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec8
446
    EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str());
442
    EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str());
447
443
448
    showPopup();
444
    showPopup();
449
    // menuHeight * 2.5 means the Y position on the item at index 2.
445
    // menuItemHeight * 2.5 means the Y position on the item at index 2.
450
    row1Point.setY(menuHeight * 2.5);
446
    row1Point.setY(menuItemHeight * 2.5);
451
    simulateLeftMouseDownEvent(row1Point);
447
    simulateLeftMouseDownEvent(row1Point);
452
    simulateLeftMouseUpEvent(row1Point);
448
    simulateLeftMouseUpEvent(row1Point);
453
449
Lines 488-496 TEST_F(SelectPopupMenuTest, SelectItemRe Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec9
488
484
489
    showPopup();
485
    showPopup();
490
486
491
    int menuHeight = m_webView->selectPopup()->menuItemHeight();
487
    int menuItemHeight = m_webView->selectPopup()->menuItemHeight();
492
    // menuHeight * 1.5 means the Y position on the item at index 1.
488
    // menuItemHeight * 1.5 means the Y position on the item at index 1.
493
    IntPoint row1Point(2, menuHeight * 1.5);
489
    IntPoint row1Point(2, menuItemHeight * 1.5);
494
    simulateLeftMouseDownEvent(row1Point);
490
    simulateLeftMouseDownEvent(row1Point);
495
    simulateLeftMouseUpEvent(row1Point);
491
    simulateLeftMouseUpEvent(row1Point);
496
492
Lines 510-518 TEST_F(SelectPopupMenuTest, SelectItemRe Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec10
510
506
511
    showPopup();
507
    showPopup();
512
508
513
    int menuHeight = m_webView->selectPopup()->menuItemHeight();
509
    int menuItemHeight = m_webView->selectPopup()->menuItemHeight();
514
    // menuHeight * 1.5 means the Y position on the item at index 1.
510
    // menuItemHeight * 1.5 means the Y position on the item at index 1.
515
    IntPoint row1Point(2, menuHeight * 1.5);
511
    IntPoint row1Point(2, menuItemHeight * 1.5);
516
    simulateLeftMouseDownEvent(row1Point);
512
    simulateLeftMouseDownEvent(row1Point);
517
    simulateLeftMouseUpEvent(row1Point);
513
    simulateLeftMouseUpEvent(row1Point);
518
514

Return to Bug 85921