Bug 102323 - Add Settings to disable custom scrollbars on main frame
Summary: Add Settings to disable custom scrollbars on main frame
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-14 20:21 PST by Tien-Ren Chen
Modified: 2012-11-15 19:11 PST (History)
7 users (show)

See Also:


Attachments
Patch (5.09 KB, patch)
2012-11-14 20:25 PST, Tien-Ren Chen
no flags Details | Formatted Diff | Diff
Patch (6.66 KB, patch)
2012-11-15 15:42 PST, Tien-Ren Chen
no flags Details | Formatted Diff | Diff
Patch (5.19 KB, patch)
2012-11-15 17:58 PST, Tien-Ren Chen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tien-Ren Chen 2012-11-14 20:21:43 PST
Add Settings to disable custom scrollbars on main frame
Comment 1 Tien-Ren Chen 2012-11-14 20:25:08 PST
Created attachment 174332 [details]
Patch
Comment 2 Alexandre Elias 2012-11-14 20:31:10 PST
Comment on attachment 174332 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=174332&action=review

> Source/WebKit/chromium/src/WebSettingsImpl.cpp:65
> +#if OS(ANDROID)

The normal approach is to have a separate patch in the Chromium tree doing this, since we try to avoid having #if OS() in WebKit.
Comment 3 WebKit Review Bot 2012-11-14 21:13:54 PST
Comment on attachment 174332 [details]
Patch

Attachment 174332 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/14843421

New failing tests:
inspector-protocol/debugger-terminate-dedicated-worker-while-paused.html
Comment 4 Adam Barth 2012-11-15 10:18:23 PST
Comment on attachment 174332 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=174332&action=review

How do other mobile ports of WebKit solve this problem?

> Source/WebCore/page/FrameView.cpp:512
> +    if (m_frame && m_frame->page() && m_frame->settings()) {

The line below this one implies that m_frame can never be 0 here.

Rather than testing m_frame-page() for 0, we'd usually write this test as:

if (Settings* settings = m_frame->settings()) {
   ...
}

> Source/WebCore/page/Settings.h:657
> +        void setMainFrameCustomScrollbarDisabled(bool disabled) { m_mainFrameCustomScrollbarDisabled = disabled; }
> +        bool mainFrameCustomScrollbarDisabled() const { return m_mainFrameCustomScrollbarDisabled; }

We generally write settings in terms of "enabled" rather than "disabled".

>> Source/WebKit/chromium/src/WebSettingsImpl.cpp:65
>> +#if OS(ANDROID)
> 
> The normal approach is to have a separate patch in the Chromium tree doing this, since we try to avoid having #if OS() in WebKit.

Yeah, we shouldn't have OS(ANDROID) ifdefs in this code.  The reason to have Settings is so they can be configured by the embedder.
Comment 5 Tien-Ren Chen 2012-11-15 15:42:41 PST
Created attachment 174537 [details]
Patch
Comment 6 Tien-Ren Chen 2012-11-15 15:48:42 PST
(In reply to comment #4)
> (From update of attachment 174332 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=174332&action=review
> 
> How do other mobile ports of WebKit solve this problem?

I'm not really sure. As far as I know, iOS Safari doesn't create custom scrollbars on any frames including iframes, but I don't know where does the hack kicks in.

It is debatable whether we should disable custom scrollbar completely or just on frames or just on the main frame. My opinion is that we should divert from standard webkit behavior as little as possible.

> > Source/WebCore/page/FrameView.cpp:512
> > +    if (m_frame && m_frame->page() && m_frame->settings()) {
> 
> The line below this one implies that m_frame can never be 0 here.
> 
> Rather than testing m_frame-page() for 0, we'd usually write this test as:
> 
> if (Settings* settings = m_frame->settings()) {
>    ...
> }

Done

> > Source/WebCore/page/Settings.h:657
> > +        void setMainFrameCustomScrollbarDisabled(bool disabled) { m_mainFrameCustomScrollbarDisabled = disabled; }
> > +        bool mainFrameCustomScrollbarDisabled() const { return m_mainFrameCustomScrollbarDisabled; }
> 
> We generally write settings in terms of "enabled" rather than "disabled".

Let's make it allowCustomScrollbarInMainFrame

> >> Source/WebKit/chromium/src/WebSettingsImpl.cpp:65
> >> +#if OS(ANDROID)
> > 
> > The normal approach is to have a separate patch in the Chromium tree doing this, since we try to avoid having #if OS() in WebKit.
> 
> Yeah, we shouldn't have OS(ANDROID) ifdefs in this code.  The reason to have Settings is so they can be configured by the embedder.

Done
Comment 7 Adam Barth 2012-11-15 17:26:50 PST
Comment on attachment 174537 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=174537&action=review

> Source/WebCore/page/FrameView.cpp:513
> +        if (!settings->allowCustomScrollbarInMainFrame() && m_frame->page() && m_frame->page()->mainFrame() == m_frame)

The test for m_frame->page() isn't actually needed because the only way |settings| can be non-0 is if m_frame->page() is non-0, but it's fine to leave the test here as a security blanket.

> Source/WebCore/page/Settings.h:850
> +        bool m_allowCustomScrollbarInMainFrame : 1;

You should add this to Settings.in now that we have fancy-pants auto generation of this file.  :)
Comment 8 Tien-Ren Chen 2012-11-15 17:58:40 PST
Created attachment 174578 [details]
Patch
Comment 9 WebKit Review Bot 2012-11-15 18:05:10 PST
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 10 WebKit Review Bot 2012-11-15 19:11:03 PST
Comment on attachment 174578 [details]
Patch

Clearing flags on attachment: 174578

Committed r134878: <http://trac.webkit.org/changeset/134878>
Comment 11 WebKit Review Bot 2012-11-15 19:11:07 PST
All reviewed patches have been landed.  Closing bug.