Bug 59183

Summary: Overlay scroller hard to see on pages with dark background
Product: WebKit Reporter: Jon Lee <jonlee>
Component: Layout and RenderingAssignee: Jon Lee <jonlee>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, commit-queue, jonlee, simon.fraser, webkit.review.bot
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Bug Depends on: 59290    
Bug Blocks:    
Attachments:
Description Flags
Patch
sam: review-
Patch
none
Patch
bdakin: review+, bdakin: commit-queue-
Patch
simon.fraser: review-
Patch none

Description Jon Lee 2011-04-22 02:09:17 PDT
<rdar://problem/8975367>
Comment 1 Jon Lee 2011-04-22 02:30:09 PDT
Created attachment 90683 [details]
Patch
Comment 2 Sam Weinig 2011-04-22 09:44:22 PDT
Comment on attachment 90683 [details]
Patch

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

> Source/WebCore/platform/mac/ScrollbarThemeMac.mm:214
> +    if (!scrollbar->parent()->isFrameView())
> +        return ScrollbarOverlayStyleDefault;
> +    
> +    FrameView* frameView = static_cast<FrameView*>(scrollbar->parent());
> +    Document* document = frameView->frame()->document();
> +    Element* rootElementToUse = document->body();
> +    if (!rootElementToUse)
> +        rootElementToUse = document->documentElement();
> +    if (!rootElementToUse)
> +        return ScrollbarOverlayStyleDefault;
> +    
> +    RenderObject* renderer = rootElementToUse->renderer();
> +    if (!renderer)
> +        return ScrollbarOverlayStyleDefault;
> +    Color color = renderer->style()->visitedDependentColor(CSSPropertyBackgroundColor);
> +    if (!color.isValid())
> +        return ScrollbarOverlayStyleDefault;
> +    
> +    // reduce the background color from RGB to a lightness value
> +    // and determine which scrollbar style to use based on a magic
> +    // lightness heuristic
> +    double h, s, l;
> +    color.getHSL(h, s, l);
> +    if (l < .5)
> +        return ScrollbarOverlayStyleLight;

This is a layering violation, since classes in WebCore/platform are not supposed to know about rendering, the DOM, or the frame tree.  Instead, I think you should add a virtual method to ScrollableArea which FrameView can implement to return the background color.  This will also make this possible to implement for overflow areas in the future.
Comment 3 Jon Lee 2011-04-22 14:01:44 PDT
Created attachment 90756 [details]
Patch
Comment 4 WebKit Review Bot 2011-04-22 14:04:46 PDT
Attachment 90756 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebCore/page/FrameView.cpp:332:  l is incorrectly named. Don't use the single letter 'l' as an identifier name.  [readability/naming] [4]
Total errors found: 1 in 14 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Jon Lee 2011-04-22 14:09:23 PDT
Created attachment 90758 [details]
Patch
Comment 6 Beth Dakin 2011-04-22 14:15:25 PDT
Comment on attachment 90758 [details]
Patch

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

> Source/WebCore/platform/ScrollableArea.cpp:201
> +ScrollbarOverlayStyle ScrollableArea::recommendedScrollbarOverlayStyle()

Since this is a one-line function, it would be nice to have it implemented in the header.

> Source/WebCore/platform/mac/ScrollbarThemeMac.mm:39
> +

Unnecessary whitespace. You should remove this.

> Source/WebCore/platform/mac/ScrollbarThemeMac.mm:-449
> -

Arguably this whitespace was valuable. But I'll leave that up to you. :-)

> Source/WebCore/platform/mac/WebCoreSystemInterface.h:230
> +    

Unnecessary tab-whitespace. Should remove.
Comment 7 Beth Dakin 2011-04-22 14:17:21 PDT
Comment on attachment 90758 [details]
Patch

Oops, meant to r+ and cq- so that Jon can upload a new version with improved whitespace.
Comment 8 Jon Lee 2011-04-22 15:34:55 PDT
Created attachment 90784 [details]
Patch
Comment 9 WebKit Commit Bot 2011-04-22 23:20:45 PDT
The commit-queue encountered the following flaky tests while processing attachment 90784 [details]:

http/tests/xmlhttprequest/re-login.html bug 51987 (author: ap@webkit.org)
The commit-queue is continuing to process your patch.
Comment 10 WebKit Commit Bot 2011-04-22 23:23:14 PDT
Comment on attachment 90784 [details]
Patch

Clearing flags on attachment: 90784

Committed r84740: <http://trac.webkit.org/changeset/84740>
Comment 11 WebKit Commit Bot 2011-04-22 23:23:18 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 WebKit Commit Bot 2011-04-23 00:48:06 PDT
The commit-queue encountered the following flaky tests while processing attachment 90784 [details]:

http/tests/xmlhttprequest/basic-auth.html bug 51613 (author: ap@webkit.org)
http/tests/appcache/update-cache.html bug 52483 (author: ap@webkit.org)
The commit-queue is continuing to process your patch.
Comment 13 Simon Fraser (smfr) 2011-04-23 20:58:20 PDT
I rolled this out via 59290, since it breaks internal builds and does not take into account feedback that I gave via email.
Comment 14 Jon Lee 2011-04-24 20:16:58 PDT
Created attachment 90897 [details]
Patch
Comment 15 Maciej Stachowiak 2011-04-24 20:20:48 PDT
Comment on attachment 90897 [details]
Patch

r=me

(previously reviewed by Simon and revised per his suggestions)
Comment 16 WebKit Commit Bot 2011-04-25 01:26:43 PDT
Comment on attachment 90897 [details]
Patch

Clearing flags on attachment: 90897

Committed r84769: <http://trac.webkit.org/changeset/84769>
Comment 17 WebKit Commit Bot 2011-04-25 01:26:48 PDT
All reviewed patches have been landed.  Closing bug.