[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

weinig at apple.com weinig at apple.com
Wed Dec 22 13:53:03 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 60eae21f1299137979fbb4d16910a6474a884bef
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 28 20:31:00 2010 +0000

    Vertical scroll bar on apple.com is too short with WebKit2
    <rdar://problem/8379230>
    https://bugs.webkit.org/show_bug.cgi?id=46739
    
    Reviewed by Darin Adler and Dave Hyatt.
    
    WebCore:
    
    Adds a function to recalculate the scrollbars to take advantage of
    a changed window re-sizer rect.
    
    * WebCore.exp.in:
    * platform/ScrollView.cpp:
    (WebCore::ScrollView::windowResizerRectChanged):
    * platform/ScrollView.h:
    
    WebKit2:
    
    This gets us most of the way to having correct scroll corner behavior. We should
    follow this up by moving to painting the window re-sizer in WebCore.
    
    * UIProcess/API/mac/WKView.mm:
    (-[WKView _ownsWindowGrowBox]):
    (-[WKView _updateGrowBoxForWindowFrameChange]): Calculate whether we should
    be taking the scroll corner into account when laying out scrollbars.
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::setWindowResizerSize):
    * UIProcess/WebPageProxy.h:
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::setWindowResizerSize):
    (WebKit::WebPage::windowResizerRect): This now returns IntRect() for
    non-mac platforms (or any platform that never sends a setWindowResizerSize
    message).
    * WebProcess/WebPage/WebPage.h:
    * WebProcess/WebPage/WebPage.messages.in:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68557 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3876395..e87ba53 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-09-28  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Darin Adler and Dave Hyatt.
+
+        Vertical scroll bar on apple.com is too short with WebKit2
+        <rdar://problem/8379230>
+        https://bugs.webkit.org/show_bug.cgi?id=46739
+
+        Adds a function to recalculate the scrollbars to take advantage of
+        a changed window re-sizer rect.
+
+        * WebCore.exp.in:
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::windowResizerRectChanged):
+        * platform/ScrollView.h:
+
 2010-09-28  David Hyatt  <hyatt at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index 5357958..5d789dc 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -139,6 +139,7 @@ __ZN3WTF6StringC1EP8NSString
 __ZN3WTF6StringC1EPK10__CFString
 __ZN7WebCore10MouseEventC1ERKN3WTF12AtomicStringEbbNS1_10PassRefPtrINS_9DOMWindowEEEiiiiibbbbtNS5_INS_11EventTargetEEENS5_INS_9ClipboardEEEb
 __ZN7WebCore10ScrollView20setCanHaveScrollbarsEb
+__ZN7WebCore10ScrollView24windowResizerRectChangedEv
 __ZN7WebCore10deleteFileERKN3WTF6StringE
 __ZN7WebCore10handCursorEv
 __ZN7WebCore10setCookiesEPNS_8DocumentERKNS_4KURLERKN3WTF6StringE
diff --git a/WebCore/platform/ScrollView.cpp b/WebCore/platform/ScrollView.cpp
index 61271ac..50a1f5b 100644
--- a/WebCore/platform/ScrollView.cpp
+++ b/WebCore/platform/ScrollView.cpp
@@ -353,6 +353,14 @@ bool ScrollView::scroll(ScrollDirection direction, ScrollGranularity granularity
     return false;
 }
 
+void ScrollView::windowResizerRectChanged()
+{
+    if (platformWidget())
+        return;
+
+    updateScrollbars(scrollOffset());
+}
+
 static const unsigned cMaxUpdateScrollbarsPass = 2;
 
 void ScrollView::updateScrollbars(const IntSize& desiredOffset)
diff --git a/WebCore/platform/ScrollView.h b/WebCore/platform/ScrollView.h
index 925e581..23f48ca 100644
--- a/WebCore/platform/ScrollView.h
+++ b/WebCore/platform/ScrollView.h
@@ -188,6 +188,8 @@ public:
     virtual IntRect windowResizerRect() const { return IntRect(); }
     bool containsScrollbarsAvoidingResizer() const;
     void adjustScrollbarsAvoidingResizerCount(int overlapDelta);
+    void windowResizerRectChanged();
+
     virtual void setParent(ScrollView*); // Overridden to update the overlapping scrollbar count.
 
     // Called when our frame rect changes (or the rect/scroll position of an ancestor changes).
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index f30d49d..f52d192 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,29 @@
+2010-09-28  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Darin Adler and Dave Hyatt.
+
+        Vertical scroll bar on apple.com is too short with WebKit2
+        <rdar://problem/8379230>
+        https://bugs.webkit.org/show_bug.cgi?id=46739
+
+        This gets us most of the way to having correct scroll corner behavior. We should
+        follow this up by moving to painting the window re-sizer in WebCore.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _ownsWindowGrowBox]):
+        (-[WKView _updateGrowBoxForWindowFrameChange]): Calculate whether we should
+        be taking the scroll corner into account when laying out scrollbars.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setWindowResizerSize):
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setWindowResizerSize):
+        (WebKit::WebPage::windowResizerRect): This now returns IntRect() for
+        non-mac platforms (or any platform that never sends a setWindowResizerSize
+        message).
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2010-09-28  Adam Roben  <aroben at apple.com>
 
         Tell the UI client when a key event is not handled
diff --git a/WebKit2/UIProcess/API/mac/WKView.mm b/WebKit2/UIProcess/API/mac/WKView.mm
index a89059f..7ba928e 100644
--- a/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/WebKit2/UIProcess/API/mac/WKView.mm
@@ -56,6 +56,11 @@ struct EditCommandState {
     int m_state;
 };
 
+ at interface NSWindow (Details)
+- (NSRect)_growBoxRect;
+- (BOOL)_updateGrowBoxForWindowFrameChange;
+ at end
+
 @interface WKViewData : NSObject {
 @public
     OwnPtr<PageClientImpl> _pageClient;
@@ -296,6 +301,48 @@ EVENT_HANDLER(scrollWheel, Wheel)
     _data->_page->setWindowIsVisible(![[self window] isMiniaturized]);
 }
 
+- (BOOL)_ownsWindowGrowBox
+{
+    NSWindow* window = [self window];
+    if (!window)
+        return NO;
+
+    NSView *superview = [self superview];
+    if (!superview)
+        return NO;
+
+    NSRect growBoxRect = [window _growBoxRect];
+    if (NSIsEmptyRect(growBoxRect))
+        return NO;
+
+    NSRect visibleRect = [self visibleRect];
+    if (NSIsEmptyRect(visibleRect))
+        return NO;
+
+    NSRect visibleRectInWindowCoords = [self convertRect:visibleRect toView:nil];
+    if (!NSIntersectsRect(growBoxRect, visibleRectInWindowCoords))
+        return NO;
+
+    return YES;
+}
+
+- (BOOL)_updateGrowBoxForWindowFrameChange
+{
+    // Temporarily enable the resize indicator to make a the _ownsWindowGrowBox calculation work.
+    BOOL wasShowingIndicator = [[self window] showsResizeIndicator];
+    [[self window] setShowsResizeIndicator:YES];
+
+    BOOL ownsGrowBox = [self _ownsWindowGrowBox];
+    _data->_page->setWindowResizerSize(ownsGrowBox ? enclosingIntRect([[self window] _growBoxRect]).size() : IntSize());
+    
+    // Once WebCore can draw the window resizer, this should read:
+    // if (wasShowingIndicator)
+    //     [[self window] setShowsResizeIndicator:!ownsGrowBox];
+    [[self window] setShowsResizeIndicator:wasShowingIndicator];
+
+    return ownsGrowBox;
+}
+
 - (void)addWindowObserversForWindow:(NSWindow *)window
 {
     if (window) {
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 71066e6..b6fe5a6 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -334,6 +334,13 @@ void WebPageProxy::setActive(bool active)
     process()->send(Messages::WebPage::SetActive(active), m_pageID);
 }
 
+void WebPageProxy::setWindowResizerSize(const IntSize& windowResizerSize)
+{
+    if (!isValid())
+        return;
+    process()->send(Messages::WebPage::SetWindowResizerSize(windowResizerSize), m_pageID);
+}
+
 void WebPageProxy::validateMenuItem(const String& commandName)
 {
     if (!isValid())
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 1a98235..a13eca0 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -133,6 +133,7 @@ public:
     void setFocused(bool isFocused);
     void setActive(bool active);
     void setIsInWindow(bool isInWindow);
+    void setWindowResizerSize(const WebCore::IntSize&);
 
     void executeEditCommand(const String& commandName);
     void validateMenuItem(const String& commandName);
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index d264eb5..e9d5520 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -574,6 +574,20 @@ void WebPage::setFocused(bool isFocused)
     m_page->focusController()->setFocused(isFocused);
 }
 
+void WebPage::setWindowResizerSize(const IntSize& windowResizerSize)
+{
+    if (m_windowResizerSize == windowResizerSize)
+        return;
+
+    m_windowResizerSize = windowResizerSize;
+
+    for (Frame* coreFrame = m_mainFrame->coreFrame(); coreFrame; coreFrame = coreFrame->tree()->traverseNext()) {
+        FrameView* view = coreFrame->view();
+        if (view)
+            view->windowResizerRectChanged();
+    }
+}
+
 void WebPage::setIsInWindow(bool isInWindow)
 {
     if (!isInWindow) {
@@ -614,12 +628,8 @@ String WebPage::userAgent() const
 
 IntRect WebPage::windowResizerRect() const
 {
-    // FIXME: This function should conditionally return a null IntRect for circumstances when
-    // you don't always want to show a resizer rect (i.e. you never want to show one on windows
-    // and you don't want to show one in Safari when the status bar is visible).
-
-    // FIXME: This should be either platform specific or based off the width of the scrollbar. 
-    static const int windowResizerSize = 15;
+    if (m_windowResizerSize.isEmpty())
+        return IntRect();
 
     IntSize frameViewSize;
     if (Frame* coreFrame = m_mainFrame->coreFrame()) {
@@ -627,8 +637,8 @@ IntRect WebPage::windowResizerRect() const
             frameViewSize = view->size();
     }
 
-    return IntRect(frameViewSize.width() - windowResizerSize, frameViewSize.height() - windowResizerSize, 
-                   windowResizerSize, windowResizerSize);
+    return IntRect(frameViewSize.width() - m_windowResizerSize.width(), frameViewSize.height() - m_windowResizerSize.height(), 
+                   m_windowResizerSize.width(), m_windowResizerSize.height());
 }
 
 void WebPage::runJavaScriptInMainFrame(const String& script, uint64_t callbackID)
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 6f41720..ce9abed 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -186,6 +186,7 @@ private:
     void goToBackForwardItem(uint64_t);
     void setActive(bool);
     void setFocused(bool);
+    void setWindowResizerSize(const WebCore::IntSize&);
     void setIsInWindow(bool);
     void mouseEvent(const WebMouseEvent&);
     void wheelEvent(const WebWheelEvent&);
@@ -238,6 +239,8 @@ private:
     
     HashMap<uint64_t, RefPtr<WebEditCommand> > m_editCommandMap;
 
+    WebCore::IntSize m_windowResizerSize;
+
     InjectedBundlePageEditorClient m_editorClient;
     InjectedBundlePageFormClient m_formClient;
     InjectedBundlePageLoaderClient m_loaderClient;
diff --git a/WebKit2/WebProcess/WebPage/WebPage.messages.in b/WebKit2/WebProcess/WebPage/WebPage.messages.in
index a4918f8..cec9a04 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -27,10 +27,10 @@ messages -> WebPage {
 
     KeyEvent(WebKit::WebKeyboardEvent event)
     MouseEvent(WebKit::WebMouseEvent event)
+    WheelEvent(WebKit::WebWheelEvent event)
 #if ENABLE(TOUCH_EVENTS)
     TouchEvent(WebKit::WebTouchEvent event)
 #endif
-    WheelEvent(WebKit::WebWheelEvent event)
 
     GoBack(uint64_t backForwardItemID)
     GoForward(uint64_t backForwardItemID)
@@ -68,6 +68,8 @@ messages -> WebPage {
     SetPageZoomFactor(double zoomFactor)
     SetTextZoomFactor(double zoomFactor)
 
+    SetWindowResizerSize(WebCore::IntSize intersectsView)
+
 #if PLATFORM(MAC)
     SetWindowIsVisible(bool windowIsVisible)
     SetWindowFrame(WebCore::IntRect windowFrame)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list