Title: [92310] branches/safari-534.51-branch/Source

Diff

Modified: branches/safari-534.51-branch/Source/WebCore/ChangeLog (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebCore/ChangeLog	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebCore/ChangeLog	2011-08-03 21:04:14 UTC (rev 92310)
@@ -1,5 +1,53 @@
 2011-08-03  Lucas Forschler  <[email protected]>
 
+    Merged 91435.
+
+    2011-07-20  Tim Horton  <[email protected]>
+
+        Scrollbar color heuristic needs to be hooked up in WebKit1
+        https://bugs.webkit.org/show_bug.cgi?id=64220
+        <rdar://problem/9589140>
+
+        Reviewed by Darin Adler.
+
+        Store the scroller style on ScrollableArea, and recompute it whenever
+        the document or body element background color changes or the base background
+        color of the scrollview changes. Also, make sure to repaint the scrollbars
+        whenever the style changes.
+
+        No new tests, since this code is only enabled on future versions of Mac OS X.
+
+        * WebCore.exp.in:
+        * page/Frame.cpp:
+        (WebCore::Frame::getDocumentBackgroundColor):
+        * page/Frame.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::recalculateScrollbarOverlayStyle):
+        (WebCore::FrameView::setBaseBackgroundColor):
+        (WebCore::FrameView::documentBackgroundColor): Renamed.
+        * page/FrameView.h:
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::setScrollbarOverlayStyle):
+        * platform/ScrollView.h:
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::setScrollbarOverlayStyle):
+        * platform/ScrollableArea.h:
+        (WebCore::ScrollableArea::scrollbarOverlayStyle):
+        * platform/ScrollbarTheme.h:
+        (WebCore::ScrollbarTheme::updateScrollbarOverlayStyle):
+        * platform/mac/ScrollViewMac.mm:
+        (WebCore::toNSScrollerKnobStyle):
+        (WebCore::ScrollView::platformSetScrollbarOverlayStyle):
+        * platform/mac/ScrollbarThemeMac.h:
+        * platform/mac/ScrollbarThemeMac.mm:
+        (WebCore::toScrollbarPainterKnobStyle):
+        (WebCore::ScrollbarThemeMac::updateScrollbarOverlayStyle):
+        (WebCore::ScrollbarThemeMac::paint):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::styleDidChange):
+
+2011-08-03  Lucas Forschler  <[email protected]>
+
     Merged 90705.
 
     2011-07-10  Anders Carlsson  <[email protected]>

Modified: branches/safari-534.51-branch/Source/WebCore/WebCore.exp.in (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebCore/WebCore.exp.in	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebCore/WebCore.exp.in	2011-08-03 21:04:14 UTC (rev 92310)
@@ -1022,7 +1022,6 @@
 __ZN7WebCore9toElementEN3JSC7JSValueE
 __ZNK3JSC8Bindings10RootObject12globalObjectEv
 __ZNK3WTF6String14createCFStringEv
-__ZNK7WebCore5Frame26getDocumentBackgroundColorEv
 __ZNK7WebCore10Credential11hasPasswordEv
 __ZNK7WebCore10Credential11persistenceEv
 __ZNK7WebCore10Credential4userEv
@@ -1311,6 +1310,7 @@
 __ZNK7WebCore9FrameView13paintBehaviorEv
 __ZNK7WebCore9FrameView20isSoftwareRenderableEv
 __ZNK7WebCore9FrameView22windowClipRectForLayerEPKNS_11RenderLayerEb
+__ZNK7WebCore9FrameView23documentBackgroundColorEv
 __ZNK7WebCore9FrameView28isEnclosedInCompositingLayerEv
 __ZNK7WebCore9PageCache10frameCountEv
 __ZNK7WebCore9PageCache21autoreleasedPageCountEv

Modified: branches/safari-534.51-branch/Source/WebCore/page/Frame.cpp (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebCore/page/Frame.cpp	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebCore/page/Frame.cpp	2011-08-03 21:04:14 UTC (rev 92310)
@@ -504,47 +504,7 @@
     
     return matchLabelsAgainstString(labels, element->getAttribute(idAttr));
 }
-    
-Color Frame::getDocumentBackgroundColor() const
-{
-    // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background color of
-    // the document and the body against the base background color of the frame view.
-    // Background images are unfortunately impractical to include.
 
-    // Return invalid Color objects whenever there is insufficient information.
-    if (!m_doc)
-        return Color();
-
-    Element* htmlElement = m_doc->documentElement();
-    Element* bodyElement = m_doc->body();
-
-    // start as invalid colors
-    Color htmlBackgroundColor;
-    Color bodyBackgroundColor;
-    if (htmlElement && htmlElement->renderer())
-        htmlBackgroundColor = htmlElement->renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor);
-    if (bodyElement && bodyElement->renderer())
-        bodyBackgroundColor = bodyElement->renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor);
-    
-    if (!bodyBackgroundColor.isValid()) {
-        if (!htmlBackgroundColor.isValid())
-            return Color();
-        return view()->baseBackgroundColor().blend(htmlBackgroundColor);
-    }
-    
-    if (!htmlBackgroundColor.isValid())
-        return view()->baseBackgroundColor().blend(bodyBackgroundColor);
-    
-    // We take the aggregate of the base background color
-    // the <html> background color, and the <body>
-    // background color to find the document color. The
-    // addition of the base background color is not
-    // technically part of the document background, but it
-    // otherwise poses problems when the aggregate is not
-    // fully opaque.
-    return view()->baseBackgroundColor().blend(htmlBackgroundColor).blend(bodyBackgroundColor);
-}
-
 void Frame::setPrinting(bool printing, const FloatSize& pageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustViewSize)
 {
     // In setting printing, we should not validate resources already cached for the document.

Modified: branches/safari-534.51-branch/Source/WebCore/page/Frame.h (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebCore/page/Frame.h	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebCore/page/Frame.h	2011-08-03 21:04:14 UTC (rev 92310)
@@ -191,8 +191,6 @@
         String searchForLabelsAboveCell(RegularExpression*, HTMLTableCellElement*, size_t* resultDistanceFromStartOfCell);
         String searchForLabelsBeforeElement(const Vector<String>& labels, Element*, size_t* resultDistance, bool* resultIsInCellAbove);
         String matchLabelsAgainstElement(const Vector<String>& labels, Element*);
-
-        Color getDocumentBackgroundColor() const;
         
 #if PLATFORM(MAC)
         NSString* searchForLabelsBeforeElement(NSArray* labels, Element*, size_t* resultDistance, bool* resultIsInCellAbove);

Modified: branches/safari-534.51-branch/Source/WebCore/page/FrameView.cpp (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebCore/page/FrameView.cpp	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebCore/page/FrameView.cpp	2011-08-03 21:04:14 UTC (rev 92310)
@@ -324,21 +324,24 @@
         m_frame->document()->didRemoveWheelEventHandler();
 }
 
-ScrollbarOverlayStyle FrameView::recommendedScrollbarOverlayStyle() const
+void FrameView::recalculateScrollbarOverlayStyle()
 {
-    Color bgColor = m_frame->getDocumentBackgroundColor();
-    if (!bgColor.isValid())
-        return ScrollbarOverlayStyleDefault;
-    
-    // Reduce the background color from RGB to a lightness value
-    // and determine which scrollbar style to use based on a lightness
-    // heuristic.
-    double hue, saturation, lightness;
-    bgColor.getHSL(hue, saturation, lightness);
-    if (lightness > .5)
-        return ScrollbarOverlayStyleDefault;
-    
-    return ScrollbarOverlayStyleLight;
+    ScrollbarOverlayStyle oldOverlayStyle = scrollbarOverlayStyle();
+    ScrollbarOverlayStyle overlayStyle = ScrollbarOverlayStyleDefault;
+
+    Color backgroundColor = documentBackgroundColor();
+    if (backgroundColor.isValid()) {
+        // Reduce the background color from RGB to a lightness value
+        // and determine which scrollbar style to use based on a lightness
+        // heuristic.
+        double hue, saturation, lightness;
+        backgroundColor.getHSL(hue, saturation, lightness);
+        if (lightness <= .5)
+            overlayStyle = ScrollbarOverlayStyleLight;
+    }
+
+    if (oldOverlayStyle != overlayStyle)
+        setScrollbarOverlayStyle(overlayStyle);
 }
 
 void FrameView::clear()
@@ -1886,6 +1889,8 @@
         m_baseBackgroundColor = Color::white;
     else
         m_baseBackgroundColor = backgroundColor;
+
+    recalculateScrollbarOverlayStyle();
 }
 
 void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool transparent)
@@ -2348,6 +2353,46 @@
     ScrollView::paintScrollCorner(context, cornerRect);
 }
 
+Color FrameView::documentBackgroundColor() const
+{
+    // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background color of
+    // the document and the body against the base background color of the frame view.
+    // Background images are unfortunately impractical to include.
+
+    // Return invalid Color objects whenever there is insufficient information.
+    if (!frame()->document())
+        return Color();
+
+    Element* htmlElement = frame()->document()->documentElement();
+    Element* bodyElement = frame()->document()->body();
+
+    // Start with invalid colors.
+    Color htmlBackgroundColor;
+    Color bodyBackgroundColor;
+    if (htmlElement && htmlElement->renderer())
+        htmlBackgroundColor = htmlElement->renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor);
+    if (bodyElement && bodyElement->renderer())
+        bodyBackgroundColor = bodyElement->renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor);
+
+    if (!bodyBackgroundColor.isValid()) {
+        if (!htmlBackgroundColor.isValid())
+            return Color();
+        return baseBackgroundColor().blend(htmlBackgroundColor);
+    }
+
+    if (!htmlBackgroundColor.isValid())
+        return baseBackgroundColor().blend(bodyBackgroundColor);
+
+    // We take the aggregate of the base background color
+    // the <html> background color, and the <body>
+    // background color to find the document color. The
+    // addition of the base background color is not
+    // technically part of the document background, but it
+    // otherwise poses problems when the aggregate is not
+    // fully opaque.
+    return baseBackgroundColor().blend(htmlBackgroundColor).blend(bodyBackgroundColor);
+}
+
 bool FrameView::hasCustomScrollbars() const
 {
     const HashSet<RefPtr<Widget> >* viewChildren = children();

Modified: branches/safari-534.51-branch/Source/WebCore/page/FrameView.h (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebCore/page/FrameView.h	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebCore/page/FrameView.h	2011-08-03 21:04:14 UTC (rev 92310)
@@ -137,7 +137,7 @@
     void resetScrollbars();
     void resetScrollbarsAndClearContentsSize();
     void detachCustomScrollbars();
-    virtual ScrollbarOverlayStyle recommendedScrollbarOverlayStyle() const;
+    virtual void recalculateScrollbarOverlayStyle();
 
     void clear();
 
@@ -219,6 +219,8 @@
     virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect);
     virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect);
 
+    Color documentBackgroundColor() const;
+
     static double currentPaintTimeStamp() { return sCurrentPaintTimeStamp; } // returns 0 if not painting
     
     void updateLayoutAndStyleIfNeededRecursive();

Modified: branches/safari-534.51-branch/Source/WebCore/platform/ScrollView.cpp (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebCore/platform/ScrollView.cpp	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebCore/platform/ScrollView.cpp	2011-08-03 21:04:14 UTC (rev 92310)
@@ -787,6 +787,12 @@
     return 0;
 }
 
+void ScrollView::setScrollbarOverlayStyle(ScrollbarOverlayStyle overlayStyle)
+{
+    ScrollableArea::setScrollbarOverlayStyle(overlayStyle);
+    platformSetScrollbarOverlayStyle(overlayStyle);
+}
+
 void ScrollView::wheelEvent(PlatformWheelEvent& e)
 {
     // We don't allow mouse wheeling to happen in a ScrollView that has had its scrollbars explicitly disabled.
@@ -1282,6 +1288,10 @@
 {
 }
 
+void ScrollView::platformSetScrollbarOverlayStyle(ScrollbarOverlayStyle)
+{
+}
+
 #endif
 
 #if !PLATFORM(MAC) && !PLATFORM(WX)

Modified: branches/safari-534.51-branch/Source/WebCore/platform/ScrollView.h (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebCore/platform/ScrollView.h	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebCore/platform/ScrollView.h	2011-08-03 21:04:14 UTC (rev 92310)
@@ -107,6 +107,8 @@
 
     virtual bool avoidScrollbarCreation() const { return false; }
 
+    virtual void setScrollbarOverlayStyle(ScrollbarOverlayStyle);
+
     // By default you only receive paint events for the area that is visible. In the case of using a
     // tiled backing store, this function can be set, so that the view paints the entire contents.
     bool paintsEntireContents() const { return m_paintsEntireContents; }
@@ -386,6 +388,7 @@
     void platformSetScrollbarsSuppressed(bool repaintOnUnsuppress);
     void platformRepaintContentRectangle(const IntRect&, bool now);
     bool platformIsOffscreen() const;
+    void platformSetScrollbarOverlayStyle(ScrollbarOverlayStyle);
    
     void platformSetScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool updatePositionSynchronously);
 

Modified: branches/safari-534.51-branch/Source/WebCore/platform/ScrollableArea.cpp (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebCore/platform/ScrollableArea.cpp	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebCore/platform/ScrollableArea.cpp	2011-08-03 21:04:14 UTC (rev 92310)
@@ -182,6 +182,9 @@
 void ScrollableArea::didAddVerticalScrollbar(Scrollbar* scrollbar)
 {
     scrollAnimator()->didAddVerticalScrollbar(scrollbar);
+
+    // <rdar://problem/9797253> AppKit resets the scrollbar's style when you attach a scrollbar
+    setScrollbarOverlayStyle(scrollbarOverlayStyle());
 }
 
 void ScrollableArea::willRemoveVerticalScrollbar(Scrollbar* scrollbar)
@@ -192,6 +195,9 @@
 void ScrollableArea::didAddHorizontalScrollbar(Scrollbar* scrollbar)
 {
     scrollAnimator()->didAddHorizontalScrollbar(scrollbar);
+
+    // <rdar://problem/9797253> AppKit resets the scrollbar's style when you attach a scrollbar
+    setScrollbarOverlayStyle(scrollbarOverlayStyle());
 }
 
 void ScrollableArea::willRemoveHorizontalScrollbar(Scrollbar* scrollbar)
@@ -205,6 +211,21 @@
         || (horizontalScrollbar() && horizontalScrollbar()->isOverlayScrollbar());
 }
 
+void ScrollableArea::setScrollbarOverlayStyle(ScrollbarOverlayStyle overlayStyle)
+{
+    m_scrollbarOverlayStyle = overlayStyle;
+
+    if (horizontalScrollbar()) {
+        ScrollbarTheme::nativeTheme()->updateScrollbarOverlayStyle(horizontalScrollbar());
+        horizontalScrollbar()->invalidate();
+    }
+    
+    if (verticalScrollbar()) {
+        ScrollbarTheme::nativeTheme()->updateScrollbarOverlayStyle(verticalScrollbar());
+        verticalScrollbar()->invalidate();
+    }
+}
+
 void ScrollableArea::invalidateScrollbar(Scrollbar* scrollbar, const IntRect& rect)
 {
 #if USE(ACCELERATED_COMPOSITING)

Modified: branches/safari-534.51-branch/Source/WebCore/platform/ScrollableArea.h (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebCore/platform/ScrollableArea.h	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebCore/platform/ScrollableArea.h	2011-08-03 21:04:14 UTC (rev 92310)
@@ -77,7 +77,8 @@
     virtual void willRemoveHorizontalScrollbar(Scrollbar*);
 
     bool hasOverlayScrollbars() const;
-    virtual ScrollbarOverlayStyle recommendedScrollbarOverlayStyle() const { return ScrollbarOverlayStyleDefault; }
+    virtual void setScrollbarOverlayStyle(ScrollbarOverlayStyle);
+    ScrollbarOverlayStyle scrollbarOverlayStyle() const { return m_scrollbarOverlayStyle; }
 
     ScrollAnimator* scrollAnimator() const;
     const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
@@ -159,6 +160,8 @@
     ScrollElasticity m_verticalScrollElasticity;
     ScrollElasticity m_horizontalScrollElasticity;
 
+    ScrollbarOverlayStyle m_scrollbarOverlayStyle;
+
 protected:
     virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) = 0;
     virtual void invalidateScrollCornerRect(const IntRect&) = 0;

Modified: branches/safari-534.51-branch/Source/WebCore/platform/ScrollbarTheme.h (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebCore/platform/ScrollbarTheme.h	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebCore/platform/ScrollbarTheme.h	2011-08-03 21:04:14 UTC (rev 92310)
@@ -53,6 +53,7 @@
 
     virtual bool supportsControlTints() const { return false; }
     virtual bool usesOverlayScrollbars() const { return false; }
+    virtual void updateScrollbarOverlayStyle(Scrollbar*) { }
 
     virtual void themeChanged() {}
     

Modified: branches/safari-534.51-branch/Source/WebCore/platform/mac/ScrollViewMac.mm (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebCore/platform/mac/ScrollViewMac.mm	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebCore/platform/mac/ScrollViewMac.mm	2011-08-03 21:04:14 UTC (rev 92310)
@@ -203,6 +203,23 @@
     return ![platformWidget() window] || ![[platformWidget() window] isVisible];
 }
 
+static inline NSScrollerKnobStyle toNSScrollerKnobStyle(ScrollbarOverlayStyle style)
+{
+    switch (style) {
+    case ScrollbarOverlayStyleDark:
+        return NSScrollerKnobStyleDark;
+    case ScrollbarOverlayStyleLight:
+        return NSScrollerKnobStyleLight;
+    default:
+        return NSScrollerKnobStyleDefault;
+    }
+}
+
+void ScrollView::platformSetScrollbarOverlayStyle(ScrollbarOverlayStyle overlayStyle)
+{
+    [scrollView() setScrollerKnobStyle:toNSScrollerKnobStyle(overlayStyle)];
+}
+
 void ScrollView::platformSetScrollOrigin(const IntPoint& origin, bool updatePositionAtAll, bool updatePositionSynchronously)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;

Modified: branches/safari-534.51-branch/Source/WebCore/platform/mac/ScrollbarThemeMac.h (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebCore/platform/mac/ScrollbarThemeMac.h	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebCore/platform/mac/ScrollbarThemeMac.h	2011-08-03 21:04:14 UTC (rev 92310)
@@ -47,6 +47,7 @@
     
     virtual bool supportsControlTints() const { return true; }
     virtual bool usesOverlayScrollbars() const;
+    virtual void updateScrollbarOverlayStyle(Scrollbar*);
 
     virtual double initialAutoscrollTimerDelay();
     virtual double autoscrollTimerDelay();

Modified: branches/safari-534.51-branch/Source/WebCore/platform/mac/ScrollbarThemeMac.mm (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebCore/platform/mac/ScrollbarThemeMac.mm	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebCore/platform/mac/ScrollbarThemeMac.mm	2011-08-03 21:04:14 UTC (rev 92310)
@@ -161,6 +161,7 @@
     WKScrollbarPainterRef scrollbarPainter = wkMakeScrollbarPainter(scrollbar->controlSize(), isHorizontal);
     scrollbarMap()->add(scrollbar, scrollbarPainter);
     updateEnabledState(scrollbar);
+    updateScrollbarOverlayStyle(scrollbar);
 #else
     scrollbarMap()->add(scrollbar);
 #endif
@@ -176,6 +177,7 @@
 {
     scrollbarMap()->set(scrollbar, newPainter);
     updateEnabledState(scrollbar);
+    updateScrollbarOverlayStyle(scrollbar);
 }
 
 WKScrollbarPainterRef ScrollbarThemeMac::painterForScrollbar(Scrollbar* scrollbar)
@@ -226,6 +228,29 @@
 #endif
 }
 
+#if USE(WK_SCROLLBAR_PAINTER)
+static inline wkScrollerKnobStyle toScrollbarPainterKnobStyle(ScrollbarOverlayStyle style)
+{
+    switch (style) {
+    case ScrollbarOverlayStyleDark:
+        return wkScrollerKnobStyleDark;
+    case ScrollbarOverlayStyleLight:
+        return wkScrollerKnobStyleLight;
+    default:
+        return wkScrollerKnobStyleDefault;
+    }
+}
+#endif
+
+void ScrollbarThemeMac::updateScrollbarOverlayStyle(Scrollbar* scrollbar)
+{
+#if USE(WK_SCROLLBAR_PAINTER)
+    wkSetScrollbarPainterKnobStyle(painterForScrollbar(scrollbar), toScrollbarPainterKnobStyle(scrollbar->scrollableArea()->scrollbarOverlayStyle()));
+#else
+    UNUSED_PARAM(scrollbar);
+#endif
+}
+
 double ScrollbarThemeMac::initialAutoscrollTimerDelay()
 {
     return gInitialButtonDelay;
@@ -432,20 +457,6 @@
     }
 }
 
-#if USE(WK_SCROLLBAR_PAINTER)
-static inline wkScrollerKnobStyle toScrollbarPainterKnobStyle(ScrollbarOverlayStyle style)
-{
-    switch (style) {
-    case ScrollbarOverlayStyleDark:
-        return wkScrollerKnobStyleDark;
-    case ScrollbarOverlayStyleLight:
-        return wkScrollerKnobStyleLight;
-    default:
-        return wkScrollerKnobStyleDefault;
-    }
-}
-#endif
-
 void ScrollbarThemeMac::updateEnabledState(Scrollbar* scrollbar)
 {
 #if USE(WK_SCROLLBAR_PAINTER)
@@ -480,10 +491,6 @@
     
     ScrollAnimatorMac* scrollAnimator = static_cast<ScrollAnimatorMac*>(scrollbar->scrollableArea()->scrollAnimator());
     scrollAnimator->setIsDrawingIntoLayer(context->isCALayerContext());
-
-#if USE(WK_SCROLLBAR_PAINTER)
-    wkSetScrollbarPainterKnobStyle(painterForScrollbar(scrollbar), toScrollbarPainterKnobStyle(scrollbar->scrollableArea()->recommendedScrollbarOverlayStyle()));
-#endif
     
     GraphicsContextStateSaver stateSaver(*context);
     context->clip(damageRect);

Modified: branches/safari-534.51-branch/Source/WebCore/rendering/RenderBox.cpp (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebCore/rendering/RenderBox.cpp	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebCore/rendering/RenderBox.cpp	2011-08-03 21:04:14 UTC (rev 92310)
@@ -336,6 +336,8 @@
             }
             setNeedsLayoutAndPrefWidthsRecalc();
         }
+
+        frame()->view()->recalculateScrollbarOverlayStyle();
     }
 }
 

Modified: branches/safari-534.51-branch/Source/WebKit2/ChangeLog (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebKit2/ChangeLog	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebKit2/ChangeLog	2011-08-03 21:04:14 UTC (rev 92310)
@@ -1,5 +1,25 @@
 2011-08-03  Lucas Forschler  <[email protected]>
 
+    Merged 91435.
+
+    2011-07-20  Tim Horton  <[email protected]>
+
+        Scrollbar color heuristic needs to be hooked up in WebKit1
+        https://bugs.webkit.org/show_bug.cgi?id=64220
+        <rdar://problem/9589140>
+
+        Reviewed by Darin Adler.
+
+        Store the scroller style on ScrollableArea, and recompute it whenever
+        the document or body element background color changes or the base background
+        color of the scrollview changes. Also, make sure to repaint the scrollbars
+        whenever the style changes.
+
+        * WebProcess/WebPage/WebFrame.cpp:
+        (WebKit::WebFrame::getDocumentBackgroundColor):
+
+2011-08-03  Lucas Forschler  <[email protected]>
+
     Merged 90705.
 
     2011-07-10  Anders Carlsson  <[email protected]>

Modified: branches/safari-534.51-branch/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp (92309 => 92310)


--- branches/safari-534.51-branch/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp	2011-08-03 20:52:32 UTC (rev 92309)
+++ branches/safari-534.51-branch/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp	2011-08-03 21:04:14 UTC (rev 92310)
@@ -542,7 +542,12 @@
 {
     if (!m_coreFrame)
         return false;
-    Color bgColor = m_coreFrame->getDocumentBackgroundColor();
+
+    FrameView* view = m_coreFrame->view();
+    if (!view)
+        return false;
+
+    Color bgColor = view->documentBackgroundColor();
     if (!bgColor.isValid())
         return false;
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to