| Differences between
and this patch
- a/Source/WebCore/ChangeLog +17 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2011-04-27  Jon Lee  <jonlee@apple.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        REGRESSION: white overlay scrollbars on apple.com/startpage
6
        https://bugs.webkit.org/show_bug.cgi?id=59540
7
        <rdar://problem/9338653>
8
9
        Now we look at the document background in addition to the <body> element,
10
        and blend those colors in with the base background of the frame view to
11
        arrive at our aggregate color. This provides a better result to determine
12
        overlay scrollbar style.
13
14
        * page/Frame.cpp:
15
        (WebCore::Frame::getDocumentBackgroundColor): look up the colors on the html and body element, and properly composite them.
16
        * platform/graphics/Color.h: a short comment to note that blend() uses the Porter-Duff source-over equation
17
1
2011-04-27  Pavel Feldman  <pfeldman@google.com>
18
2011-04-27  Pavel Feldman  <pfeldman@google.com>
2
19
3
        Reviewed by Yury Semikhatsky.
20
        Reviewed by Yury Semikhatsky.
- a/Source/WebCore/page/Frame.cpp -15 / +30 lines
Lines 503-529 String Frame::matchLabelsAgainstElement(const Vector<String>& labels, Element* e a/Source/WebCore/page/Frame.cpp_sec1
503
    
503
    
504
Color Frame::getDocumentBackgroundColor() const
504
Color Frame::getDocumentBackgroundColor() const
505
{
505
{
506
    // FIXME: This is a basic implementation adopted originally from WebFrame,
506
    // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background color of
507
    // but ultimately is wrong. Body painting propagates up to the document (see
507
    // the document and the body against the base background color of the frame view.
508
    // RenderBox::paintRootBoxDecorations()), so code from that method should be
508
    // Background images are unfortunately impractical to include.
509
    // adopted here to get the style used to paint the root background.
510
509
511
    // Return invalid Color objects if we are not able to obtain the color
510
    // Return invalid Color objects whenever there is insufficient information.
512
    // for whatever reason.
513
    if (!m_doc)
511
    if (!m_doc)
514
        return Color();
512
        return Color();
513
514
    Element* htmlElement = m_doc->documentElement();
515
    Element* bodyElement = m_doc->body();
516
517
    // start as invalid colors
518
    Color htmlBackgroundColor;
519
    Color bodyBackgroundColor;
520
    if (htmlElement && htmlElement->renderer())
521
        htmlBackgroundColor = htmlElement->renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor);
522
    if (bodyElement && bodyElement->renderer())
523
        bodyBackgroundColor = bodyElement->renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor);
515
    
524
    
516
    Element* rootElementToUse = m_doc->body();
525
    if (!bodyBackgroundColor.isValid()) {
517
    if (!rootElementToUse)
526
        if (!htmlBackgroundColor.isValid())
518
        rootElementToUse = m_doc->documentElement();
527
            return Color();
519
    if (!rootElementToUse)
528
        return view()->baseBackgroundColor().blend(htmlBackgroundColor);
520
        return Color();
529
    }
521
    
530
    
522
    RenderObject* renderer = rootElementToUse->renderer();
531
    if (!htmlBackgroundColor.isValid())
523
    if (!renderer)
532
        return view()->baseBackgroundColor().blend(bodyBackgroundColor);
524
        return Color();
525
    
533
    
526
    return renderer->style()->visitedDependentColor(CSSPropertyBackgroundColor);
534
    // We take the aggregate of the base background color
535
    // the <html> background color, and the <body>
536
    // background color to find the document color. The
537
    // addition of the base background color is not
538
    // technically part of the document background, but it
539
    // otherwise poses problems when the aggregate is not
540
    // fully opaque.
541
    return view()->baseBackgroundColor().blend(htmlBackgroundColor).blend(bodyBackgroundColor);
527
}
542
}
528
543
529
void Frame::setPrinting(bool printing, const FloatSize& pageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustViewSize)
544
void Frame::setPrinting(bool printing, const FloatSize& pageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustViewSize)
- a/Source/WebCore/platform/graphics/Color.h -1 / +1 lines
Lines 121-126 public: a/Source/WebCore/platform/graphics/Color.h_sec1
121
    Color light() const;
121
    Color light() const;
122
    Color dark() const;
122
    Color dark() const;
123
123
124
    // This is an implementation of Porter-Duff's "source-over" equation
124
    Color blend(const Color&) const;
125
    Color blend(const Color&) const;
125
    Color blendWithWhite() const;
126
    Color blendWithWhite() const;
126
127
127
- 

Return to Bug 59540