Clean up the boolean argument to visibleContentRect
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Feb 2013 06:35:27 +0000 (06:35 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Feb 2013 06:35:27 +0000 (06:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=110167

Source/WebCore:

Reviewed by Simon Fraser.

Replace the boolean argument to visibleContentRect() with
an enum.

No behavior change.

* WebCore.exp.in:
* dom/Document.cpp:
(WebCore::Document::viewportSize):
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::update):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::innerHeight):
(WebCore::DOMWindow::innerWidth):
* page/FrameView.cpp:
(WebCore::FrameView::calculateScrollbarModesForLayout):
(WebCore::FrameView::layout):
(WebCore::FrameView::performPostLayoutTasks):
(WebCore::FrameView::windowClipRect):
* page/SpatialNavigation.cpp:
(WebCore::canScrollInDirection):
* platform/ScrollView.cpp:
(WebCore::ScrollView::unscaledVisibleContentSize):
(WebCore::ScrollView::visibleContentRect):
(WebCore::ScrollView::layoutSize):
(WebCore::ScrollView::updateScrollbars):
(WebCore::ScrollView::paint):
* platform/ScrollView.h:
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::visibleContentRect):
* platform/ScrollableArea.h:
* rendering/RenderDialog.cpp:
(WebCore::RenderDialog::layout):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::maximumScrollPosition):
(WebCore::RenderLayer::visibleContentRect):
* rendering/RenderLayer.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::frameViewDidChangeSize):
(WebCore::RenderLayerCompositor::updateRootLayerPosition):

Source/WebKit/blackberry:

Reviewed by Simon Fraser.

Replace the boolean argument to visibleContentRect() with
an enum.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::getRecursiveVisibleWindowRect):
* WebKitSupport/InRegionScrollableArea.cpp:
(BlackBerry::WebKit::InRegionScrollableArea::InRegionScrollableArea):

Source/WebKit/chromium:

Reviewed by Simon Fraser.

Replace the boolean argument to visibleContentRect() with
an enum.

* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::popupOpened):

Source/WebKit/efl:

Reviewed by Simon Fraser.

Replace the boolean argument to visibleContentRect() with
an enum.

* ewk/ewk_frame.cpp:
(ewk_frame_visible_content_geometry_get):

Source/WebKit/win:

Reviewed by Simon Fraser.

Replace the boolean argument to visibleContentRect() with
an enum.

* WebFrame.cpp:
(WebFrame::visibleContentRect):
(WebFrame::frameBounds):

Source/WebKit2:

Reviewed by Simon Fraser.

Replace the boolean argument to visibleContentRect() with
an enum.

* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::visibleContentBounds):
(WebKit::WebFrame::visibleContentBoundsExcludingScrollbars):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143295 268f45cc-cd09-0410-ab3c-d52691b4dbfc

30 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/dom/Document.cpp
Source/WebCore/inspector/InspectorOverlay.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/SpatialNavigation.cpp
Source/WebCore/platform/ScrollView.cpp
Source/WebCore/platform/ScrollView.h
Source/WebCore/platform/ScrollableArea.cpp
Source/WebCore/platform/ScrollableArea.h
Source/WebCore/platform/chromium/FramelessScrollView.cpp
Source/WebCore/platform/gtk/ScrollViewGtk.cpp
Source/WebCore/rendering/RenderDialog.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/TextAutosizer.cpp
Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/ChromeClientImpl.cpp
Source/WebKit/chromium/tests/WebFrameTest.cpp
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/ewk/ewk_frame.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebFrame.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/WebFrame.cpp

index 6106f03..61d20c7 100644 (file)
@@ -1,3 +1,50 @@
+2013-02-18  Simon Fraser  <simon.fraser@apple.com>
+
+        Clean up the boolean argument to visibleContentRect
+        https://bugs.webkit.org/show_bug.cgi?id=110167
+
+        Reviewed by Simon Fraser.
+
+        Replace the boolean argument to visibleContentRect() with
+        an enum.
+
+        No behavior change.
+
+        * WebCore.exp.in:
+        * dom/Document.cpp:
+        (WebCore::Document::viewportSize):
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::update):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::innerHeight):
+        (WebCore::DOMWindow::innerWidth):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::calculateScrollbarModesForLayout):
+        (WebCore::FrameView::layout):
+        (WebCore::FrameView::performPostLayoutTasks):
+        (WebCore::FrameView::windowClipRect):
+        * page/SpatialNavigation.cpp:
+        (WebCore::canScrollInDirection):
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::unscaledVisibleContentSize):
+        (WebCore::ScrollView::visibleContentRect):
+        (WebCore::ScrollView::layoutSize):
+        (WebCore::ScrollView::updateScrollbars):
+        (WebCore::ScrollView::paint):
+        * platform/ScrollView.h:
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::visibleContentRect):
+        * platform/ScrollableArea.h:
+        * rendering/RenderDialog.cpp:
+        (WebCore::RenderDialog::layout):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::maximumScrollPosition):
+        (WebCore::RenderLayer::visibleContentRect):
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
+        (WebCore::RenderLayerCompositor::updateRootLayerPosition):
+
 2013-02-18  Ryosuke Niwa  <rniwa@webkit.org>
 
         That didn't work either. Just make it public. This is why I hate nested classes. They just don't work.
index 9402f70..684384d 100644 (file)
@@ -1179,7 +1179,6 @@ __ZNK7WebCore10ScrollView16windowToContentsERKNS_7IntRectE
 __ZNK7WebCore10ScrollView16windowToContentsERKNS_8IntPointE
 __ZNK7WebCore10ScrollView18contentsToRootViewERKNS_7IntRectE
 __ZNK7WebCore10ScrollView18contentsToRootViewERKNS_8IntPointE
-__ZNK7WebCore10ScrollView18visibleContentRectEb
 __ZNK7WebCore11FrameLoader10isCompleteEv
 __ZNK7WebCore11FrameLoader14cancelledErrorERKNS_15ResourceRequestE
 __ZNK7WebCore11FrameLoader14frameHasLoadedEv
@@ -1789,7 +1788,7 @@ __ZN7WebCore8IntPointC1ERK8_NSPoint
 __ZN7WebCore8IntPointC1ERK7CGPoint
 __ZN7WebCore9FloatRectC1ERK7_NSRect
 __ZNK7WebCore10FloatPointcv8_NSPointEv
-__ZNK7WebCore14ScrollableArea18visibleContentRectEb
+__ZNK7WebCore14ScrollableArea18visibleContentRectENS0_36VisibleContentRectIncludesScrollbarsE
 __ZNK7WebCore6Cursor14platformCursorEv
 __ZNK7WebCore7IntRectcv7_NSRectEv
 __ZNK7WebCore7IntSizecv6CGSizeEv
index f63e5d7..55b4c98 100644 (file)
@@ -5701,7 +5701,7 @@ IntSize Document::viewportSize() const
 {
     if (!view())
         return IntSize();
-    return view()->visibleContentRect(/* includeScrollbars */ true).size();
+    return view()->visibleContentRect(ScrollableArea::IncludeScrollbars).size();
 }
 
 #if ENABLE(CSS_DEVICE_ADAPTATION)
index ce07268..3048962 100644 (file)
@@ -283,7 +283,7 @@ void InspectorOverlay::update()
 
     FrameView* overlayView = overlayPage()->mainFrame()->view();
     IntSize viewportSize = enclosingIntRect(view->visibleContentRect()).size();
-    IntSize frameViewFullSize = enclosingIntRect(view->visibleContentRect(true)).size();
+    IntSize frameViewFullSize = enclosingIntRect(view->visibleContentRect(ScrollableArea::IncludeScrollbars)).size();
     IntSize size = m_size.isEmpty() ? frameViewFullSize : m_size;
     overlayPage()->setPageScaleFactor(m_page->pageScaleFactor(), IntPoint());
     size.scale(m_page->pageScaleFactor());
index a9527e1..a405520 100644 (file)
@@ -1142,7 +1142,7 @@ int DOMWindow::innerHeight() const
 
     // If the device height is overridden, do not include the horizontal scrollbar into the innerHeight (since it is absent on the real device).
     bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenHeightOverride(m_frame);
-    return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRect(includeScrollbars).height()));
+    return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRect(includeScrollbars ? ScrollableArea::IncludeScrollbars : ScrollableArea::ExcludeScrollbars).height()));
 }
 
 int DOMWindow::innerWidth() const
@@ -1156,7 +1156,7 @@ int DOMWindow::innerWidth() const
 
     // If the device width is overridden, do not include the vertical scrollbar into the innerWidth (since it is absent on the real device).
     bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenWidthOverride(m_frame);
-    return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRect(includeScrollbars).width()));
+    return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRect(includeScrollbars ? ScrollableArea::IncludeScrollbars : ScrollableArea::ExcludeScrollbars).width()));
 }
 
 int DOMWindow::screenX() const
index daca088..06f2889 100644 (file)
@@ -688,7 +688,7 @@ void FrameView::calculateScrollbarModesForLayout(ScrollbarMode& hMode, Scrollbar
         hMode = ScrollbarAuto;
         // Seamless documents begin with heights of 0; we special case that here
         // to correctly render documents that don't need scrollbars.
-        IntSize fullVisibleSize = visibleContentRect(true /*includeScrollbars*/).size();
+        IntSize fullVisibleSize = visibleContentRect(IncludeScrollbars).size();
         bool isSeamlessDocument = frame() && frame()->document() && frame()->document()->shouldDisplaySeamlesslyWithParent();
         vMode = (isSeamlessDocument && !fullVisibleSize.height()) ? ScrollbarAlwaysOff : ScrollbarAuto;
     } else {
@@ -1161,7 +1161,7 @@ void FrameView::layout(bool allowSubtree)
                     if (useFixedLayout() && !fixedLayoutSize().isEmpty() && delegatesScrolling())
                         m_lastViewportSize = fixedLayoutSize();
                     else
-                        m_lastViewportSize = visibleContentRect(true /*includeScrollbars*/).size();
+                        m_lastViewportSize = visibleContentRect(IncludeScrollbars).size();
                     m_lastZoomFactor = root->style()->zoom();
 
                     // Set the initial vMode to AlwaysOn if we're auto.
@@ -2602,7 +2602,7 @@ void FrameView::performPostLayoutTasks()
         if (useFixedLayout() && !fixedLayoutSize().isEmpty() && delegatesScrolling())
             currentSize = fixedLayoutSize();
         else
-            currentSize = visibleContentRect(true /*includeScrollbars*/).size();
+            currentSize = visibleContentRect(IncludeScrollbars).size();
         float currentZoomFactor = renderView->style()->zoom();
         bool resized = !m_firstLayout && (currentSize != m_lastViewportSize || currentZoomFactor != m_lastZoomFactor);
         m_lastViewportSize = currentSize;
@@ -2784,7 +2784,7 @@ IntRect FrameView::windowClipRect(bool clipToContents) const
         return IntRect(IntPoint(), contentsSize());
 
     // Set our clip rect to be our contents.
-    IntRect clipRect = contentsToWindow(visibleContentRect(!clipToContents));
+    IntRect clipRect = contentsToWindow(visibleContentRect(clipToContents ? ExcludeScrollbars : IncludeScrollbars));
     if (!m_frame || !m_frame->ownerElement())
         return clipRect;
 
index 62a3986..338c389 100644 (file)
@@ -485,7 +485,7 @@ bool canScrollInDirection(const Frame* frame, FocusDirection direction)
         return false;
     LayoutSize size = frame->view()->contentsSize();
     LayoutSize offset = frame->view()->scrollOffset();
-    LayoutRect rect = frame->view()->visibleContentRect(true);
+    LayoutRect rect = frame->view()->visibleContentRect(ScrollableArea::IncludeScrollbars);
 
     switch (direction) {
     case FocusDirectionLeft:
index 1f8bdb3..27038d3 100644 (file)
@@ -225,10 +225,10 @@ void ScrollView::setDelegatesScrolling(bool delegatesScrolling)
     delegatesScrollingDidChange();
 }
 
-IntSize ScrollView::unscaledVisibleContentSize(bool includeScrollbars) const
+IntSize ScrollView::unscaledVisibleContentSize(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
 {
     if (platformWidget())
-        return platformVisibleContentRect(includeScrollbars).size();
+        return platformVisibleContentRect(scrollbarInclusion == IncludeScrollbars).size();
 
     if (!m_fixedVisibleContentRect.isEmpty())
         return m_fixedVisibleContentRect.size();
@@ -236,7 +236,7 @@ IntSize ScrollView::unscaledVisibleContentSize(bool includeScrollbars) const
     int verticalScrollbarWidth = 0;
     int horizontalScrollbarHeight = 0;
 
-    if (!includeScrollbars) {
+    if (scrollbarInclusion == ExcludeScrollbars) {
         if (Scrollbar* verticalBar = verticalScrollbar())
             verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBar->width() : 0;
         if (Scrollbar* horizontalBar = horizontalScrollbar())
@@ -248,15 +248,15 @@ IntSize ScrollView::unscaledVisibleContentSize(bool includeScrollbars) const
 }
 
 #if !PLATFORM(GTK)
-IntRect ScrollView::visibleContentRect(bool includeScrollbars) const
+IntRect ScrollView::visibleContentRect(VisibleContentRectIncludesScrollbars scollbarInclusion) const
 {
     if (platformWidget())
-        return platformVisibleContentRect(includeScrollbars);
+        return platformVisibleContentRect(scollbarInclusion == IncludeScrollbars);
 
     if (!m_fixedVisibleContentRect.isEmpty())
         return m_fixedVisibleContentRect;
 
-    FloatSize visibleContentSize = unscaledVisibleContentSize(includeScrollbars);
+    FloatSize visibleContentSize = unscaledVisibleContentSize(scollbarInclusion);
     visibleContentSize.scale(1 / visibleContentScaleFactor());
     return IntRect(IntPoint(m_scrollOffset), expandedIntSize(visibleContentSize));
 }
@@ -264,7 +264,7 @@ IntRect ScrollView::visibleContentRect(bool includeScrollbars) const
 
 IntSize ScrollView::layoutSize() const
 {
-    return m_fixedLayoutSize.isEmpty() || !m_useFixedLayout ? unscaledVisibleContentSize(false) : m_fixedLayoutSize;
+    return m_fixedLayoutSize.isEmpty() || !m_useFixedLayout ? unscaledVisibleContentSize(ExcludeScrollbars) : m_fixedLayoutSize;
 }
 
 IntSize ScrollView::fixedLayoutSize() const
@@ -504,7 +504,7 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
         bool sendContentResizedNotification = false;
         
         IntSize docSize = contentsSize();
-        IntSize fullVisibleSize = visibleContentRect(true /*includeScrollbars*/).size();
+        IntSize fullVisibleSize = visibleContentRect(IncludeScrollbars).size();
 
         if (hScroll == ScrollbarAuto) {
             newHasHorizontalScrollbar = docSize.width() > visibleWidth();
@@ -1053,7 +1053,7 @@ void ScrollView::paint(GraphicsContext* context, const IntRect& rect)
 
     IntRect documentDirtyRect = rect;
     if (!paintsEntireContents()) {
-        IntRect visibleAreaWithoutScrollbars(location(), visibleContentRect(false).size());
+        IntRect visibleAreaWithoutScrollbars(location(), visibleContentRect().size());
         documentDirtyRect.intersect(visibleAreaWithoutScrollbars);
     }
 
@@ -1084,7 +1084,7 @@ void ScrollView::paint(GraphicsContext* context, const IntRect& rect)
     if (!m_scrollbarsSuppressed && (m_horizontalScrollbar || m_verticalScrollbar)) {
         GraphicsContextStateSaver stateSaver(*context);
         IntRect scrollViewDirtyRect = rect;
-        IntRect visibleAreaWithScrollbars(location(), visibleContentRect(true).size());
+        IntRect visibleAreaWithScrollbars(location(), visibleContentRect(IncludeScrollbars).size());
         scrollViewDirtyRect.intersect(visibleAreaWithScrollbars);
         context->translate(x(), y());
         scrollViewDirtyRect.moveBy(-location());
index fe7b010..a31645d 100644 (file)
@@ -144,7 +144,7 @@ public:
     // In the situation the client is responsible for the scrolling (ie. with a tiled backing store) it is possible to use
     // the setFixedVisibleContentRect instead for the mainframe, though this must be updated manually, e.g just before resuming the page
     // which usually will happen when panning, pinching and rotation ends, or when scale or position are changed manually.
-    virtual IntRect visibleContentRect(bool includeScrollbars = false) const OVERRIDE;
+    virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const OVERRIDE;
     virtual void setFixedVisibleContentRect(const IntRect& visibleContentRect) { m_fixedVisibleContentRect = visibleContentRect; }
     IntRect fixedVisibleContentRect() const { return m_fixedVisibleContentRect; }
     IntSize visibleSize() const { return visibleContentRect().size(); }
@@ -155,7 +155,7 @@ public:
     // visibleContentScaleFactor is usually 1, except when the setting applyPageScaleFactorInCompositor is true and the
     // ScrollView is the main frame; in that case, visibleContentScaleFactor is equal to the page's pageScaleFactor.
     // Ports that don't use pageScaleFactor can treat unscaledVisibleContentSize and visibleContentRect().size() as equivalent.
-    IntSize unscaledVisibleContentSize(bool includeScrollbars) const;
+    IntSize unscaledVisibleContentSize(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
     virtual float visibleContentScaleFactor() const { return 1; }
 
     // Functions for getting/setting the size webkit should use to layout the contents. By default this is the same as the visible
index 35daac4..f69be03 100644 (file)
@@ -403,12 +403,12 @@ IntPoint ScrollableArea::maximumScrollPosition() const
     return IntPoint(contentsSize().width() - visibleWidth(), contentsSize().height() - visibleHeight());
 }
 
-IntRect ScrollableArea::visibleContentRect(bool includeScrollbars) const
+IntRect ScrollableArea::visibleContentRect(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
 {
     int verticalScrollbarWidth = 0;
     int horizontalScrollbarHeight = 0;
 
-    if (includeScrollbars) {
+    if (scrollbarInclusion == IncludeScrollbars) {
         if (Scrollbar* verticalBar = verticalScrollbar())
             verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBar->width() : 0;
         if (Scrollbar* horizontalBar = horizontalScrollbar())
index 5fa6e27..358bd8f 100644 (file)
@@ -138,7 +138,9 @@ public:
     virtual IntPoint scrollPosition() const;
     virtual IntPoint minimumScrollPosition() const;
     virtual IntPoint maximumScrollPosition() const;
-    virtual IntRect visibleContentRect(bool /*includeScrollbars*/ = false) const;
+
+    enum VisibleContentRectIncludesScrollbars { ExcludeScrollbars, IncludeScrollbars };
+    virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
     virtual int visibleHeight() const = 0;
     virtual int visibleWidth() const = 0;
     virtual IntSize contentsSize() const = 0;
index b9f8b3a..7a37891 100644 (file)
@@ -86,7 +86,7 @@ HostWindow* FramelessScrollView::hostWindow() const
 
 IntRect FramelessScrollView::windowClipRect(bool clipToContents) const
 {
-    return contentsToWindow(visibleContentRect(!clipToContents));
+    return contentsToWindow(visibleContentRect(clipToContents ? ExcludeScrollbars : IncludeScrollbars));
 }
 
 void FramelessScrollView::paintContents(GraphicsContext*, const IntRect&)
index f983583..0b05a57 100644 (file)
@@ -63,8 +63,10 @@ PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientati
     return Scrollbar::createNativeScrollbar(this, orientation, RegularScrollbar);
 }
 
-IntRect ScrollView::visibleContentRect(bool includeScrollbars) const
+IntRect ScrollView::visibleContentRect(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
 {
+    bool includeScrollbars = scrollbarInclusion == IncludeScrollbars;
+
     // If we are an interior frame scrollbar or are in some sort of transition
     // state, just calculate our size based on what the GTK+ theme says the
     // scrollbar width should be.
index b2498ae..b8f3d19 100644 (file)
@@ -53,7 +53,7 @@ void RenderDialog::layout()
     FrameView* frameView = document()->view();
     int scrollTop = frameView->scrollOffset().height();
     FloatPoint absolutePoint(0, scrollTop);
-    int visibleHeight = frameView->visibleContentRect(true).height();
+    int visibleHeight = frameView->visibleContentRect(ScrollableArea::IncludeScrollbars).height();
     if (height() < visibleHeight)
         absolutePoint.move(0, (visibleHeight - height()) / 2);
     FloatPoint localPoint = containingBlock()->absoluteToLocal(absolutePoint);
index 4d0dc2a..98bc1b8 100644 (file)
@@ -2445,14 +2445,14 @@ IntPoint RenderLayer::minimumScrollPosition() const
 IntPoint RenderLayer::maximumScrollPosition() const
 {
     // FIXME: m_scrollSize may not be up-to-date if m_scrollDimensionsDirty is true.
-    return scrollOrigin() + roundedIntSize(m_scrollSize) - visibleContentRect(true).size();
+    return scrollOrigin() + roundedIntSize(m_scrollSize) - visibleContentRect(IncludeScrollbars).size();
 }
 
-IntRect RenderLayer::visibleContentRect(bool includeScrollbars) const
+IntRect RenderLayer::visibleContentRect(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
 {
     int verticalScrollbarWidth = 0;
     int horizontalScrollbarHeight = 0;
-    if (includeScrollbars) {
+    if (scrollbarInclusion == IncludeScrollbars) {
         verticalScrollbarWidth = (verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar()) ? verticalScrollbar()->width() : 0;
         horizontalScrollbarHeight = (horizontalScrollbar() && !horizontalScrollbar()->isOverlayScrollbar()) ? horizontalScrollbar()->height() : 0;
     }
index 1cfc908..2961f8c 100644 (file)
@@ -934,7 +934,7 @@ private:
     virtual IntPoint scrollPosition() const;
     virtual IntPoint minimumScrollPosition() const;
     virtual IntPoint maximumScrollPosition() const;
-    virtual IntRect visibleContentRect(bool includeScrollbars) const;
+    virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars) const;
     virtual int visibleHeight() const;
     virtual int visibleWidth() const;
     virtual IntSize contentsSize() const;
index 0437330..a6db8fd 100644 (file)
@@ -1179,7 +1179,7 @@ void RenderLayerCompositor::frameViewDidChangeSize()
 {
     if (m_clipLayer) {
         FrameView* frameView = m_renderView->frameView();
-        m_clipLayer->setSize(frameView->unscaledVisibleContentSize(false /* exclude scrollbars */));
+        m_clipLayer->setSize(frameView->unscaledVisibleContentSize());
 
         frameViewDidScroll();
         updateOverflowControlsLayers();
@@ -1553,7 +1553,7 @@ void RenderLayerCompositor::updateRootLayerPosition()
     }
     if (m_clipLayer) {
         FrameView* frameView = m_renderView->frameView();
-        m_clipLayer->setSize(frameView->unscaledVisibleContentSize(false /* exclude scrollbars */));
+        m_clipLayer->setSize(frameView->unscaledVisibleContentSize());
     }
 
 #if ENABLE(RUBBER_BANDING)
index 342637a..da6bd41 100644 (file)
@@ -106,7 +106,7 @@ bool TextAutosizer::processSubtree(RenderObject* layoutRoot)
     windowInfo.windowSize = m_document->settings()->textAutosizingWindowSizeOverride();
     if (windowInfo.windowSize.isEmpty()) {
         bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenWidthOverride(mainFrame);
-        windowInfo.windowSize = mainFrame->view()->unscaledVisibleContentSize(includeScrollbars);
+        windowInfo.windowSize = mainFrame->view()->unscaledVisibleContentSize(includeScrollbars ? ScrollableArea::IncludeScrollbars : ScrollableArea::ExcludeScrollbars);
         if (!m_document->settings()->applyDeviceScaleFactorInCompositor())
             windowInfo.windowSize.scale(1 / m_document->page()->deviceScaleFactor());
     }
index 218975d..4ab9cd2 100644 (file)
@@ -2595,7 +2595,7 @@ IntRect WebPagePrivate::getRecursiveVisibleWindowRect(ScrollView* view, bool noC
         return IntRect(IntPoint::zero(), view->contentsSize());
     }
 
-    IntRect visibleWindowRect(view->contentsToWindow(view->visibleContentRect(false)));
+    IntRect visibleWindowRect(view->contentsToWindow(view->visibleContentRect()));
     if (view->parent() && !(noClipOfMainFrame && view->parent() == m_mainFrame->view())) {
         // Intersect with parent visible rect.
         visibleWindowRect.intersect(getRecursiveVisibleWindowRect(view->parent(), noClipOfMainFrame));
index d537ff1..8d7948b 100644 (file)
@@ -1,3 +1,18 @@
+2013-02-18  Simon Fraser  <simon.fraser@apple.com>
+
+        Clean up the boolean argument to visibleContentRect
+        https://bugs.webkit.org/show_bug.cgi?id=110167
+
+        Reviewed by Simon Fraser.
+
+        Replace the boolean argument to visibleContentRect() with
+        an enum.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::getRecursiveVisibleWindowRect):
+        * WebKitSupport/InRegionScrollableArea.cpp:
+        (BlackBerry::WebKit::InRegionScrollableArea::InRegionScrollableArea):
+
 2013-02-15  Keishi Hattori  <keishi@webkit.org>
 
         Add setValue and closePopup methods to PagePopupController
index decc65c..9d61336 100644 (file)
@@ -81,7 +81,7 @@ InRegionScrollableArea::InRegionScrollableArea(WebPagePrivate* webPage, RenderLa
 
         m_scrollPosition = m_webPage->mapToTransformed(view->scrollPosition());
         m_contentsSize = m_webPage->mapToTransformed(view->contentsSize());
-        m_viewportSize = m_webPage->mapToTransformed(view->visibleContentRect(false /*includeScrollbars*/)).size();
+        m_viewportSize = m_webPage->mapToTransformed(view->visibleContentRect()).size();
 
         m_scrollsHorizontally = view->contentsWidth() > view->visibleWidth();
         m_scrollsVertically = view->contentsHeight() > view->visibleHeight();
@@ -104,7 +104,7 @@ InRegionScrollableArea::InRegionScrollableArea(WebPagePrivate* webPage, RenderLa
         ScrollableArea* scrollableArea = static_cast<ScrollableArea*>(m_layer);
         m_scrollPosition = m_webPage->mapToTransformed(scrollableArea->scrollPosition());
         m_contentsSize = m_webPage->mapToTransformed(scrollableArea->contentsSize());
-        m_viewportSize = m_webPage->mapToTransformed(scrollableArea->visibleContentRect(false /*includeScrollbars*/)).size();
+        m_viewportSize = m_webPage->mapToTransformed(scrollableArea->visibleContentRect()).size();
 
         m_scrollsHorizontally = box->scrollWidth() != box->clientWidth();
         m_scrollsVertically = box->scrollHeight() != box->clientHeight();
index f409ff0..27eeb57 100644 (file)
@@ -1,3 +1,16 @@
+2013-02-18  Simon Fraser  <simon.fraser@apple.com>
+
+        Clean up the boolean argument to visibleContentRect
+        https://bugs.webkit.org/show_bug.cgi?id=110167
+
+        Reviewed by Simon Fraser.
+
+        Replace the boolean argument to visibleContentRect() with
+        an enum.
+
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::popupOpened):
+
 2013-02-18  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed.  Rolled Chromium DEPS to r183105.  Requested by
index 24b0623..e5276ff 100644 (file)
@@ -799,7 +799,7 @@ void ChromeClientImpl::popupOpened(PopupContainer* popupContainer,
     // to interact via the keyboard with an invisible popup.
     if (popupContainer->popupType() == PopupContainer::Suggestion) {
         FrameView* view = m_webView->page()->mainFrame()->view();
-        IntRect visibleRect = view->visibleContentRect(true /* include scrollbars */);
+        IntRect visibleRect = view->visibleContentRect(ScrollableArea::IncludeScrollbars);
         // |bounds| is in screen coordinates, so make sure to convert it to
         // content coordinates prior to comparing to |visibleRect|.
         IntRect screenRect = bounds;
index 38ed483..fd1292c 100644 (file)
@@ -482,11 +482,11 @@ TEST_F(WebFrameTest, pageScaleFactorShrinksViewport)
 
     m_webView->setPageScaleFactor(2, WebPoint());
 
-    WebCore::IntSize unscaledSize = view->unscaledVisibleContentSize(true);
+    WebCore::IntSize unscaledSize = view->unscaledVisibleContentSize(WebCore::ScrollableArea::IncludeScrollbars);
     EXPECT_EQ(viewportWidth, unscaledSize.width());
     EXPECT_EQ(viewportHeight, unscaledSize.height());
 
-    WebCore::IntSize unscaledSizeMinusScrollbar = view->unscaledVisibleContentSize(false);
+    WebCore::IntSize unscaledSizeMinusScrollbar = view->unscaledVisibleContentSize(WebCore::ScrollableArea::ExcludeScrollbars);
     EXPECT_EQ(viewportWidthMinusScrollbar, unscaledSizeMinusScrollbar.width());
     EXPECT_EQ(viewportHeightMinusScrollbar, unscaledSizeMinusScrollbar.height());
 
index e55eb8d..14152ce 100644 (file)
@@ -1,3 +1,16 @@
+2013-02-18  Simon Fraser  <simon.fraser@apple.com>
+
+        Clean up the boolean argument to visibleContentRect
+        https://bugs.webkit.org/show_bug.cgi?id=110167
+
+        Reviewed by Simon Fraser.
+
+        Replace the boolean argument to visibleContentRect() with
+        an enum.
+
+        * ewk/ewk_frame.cpp:
+        (ewk_frame_visible_content_geometry_get):
+
 2013-02-18  Michał Pakuła vel Rutka  <m.pakula@samsung.com>
 
         [EFL] Fix build when CONTEXT_MENUS flag is turned off
index c28dd05..1237346 100644 (file)
@@ -820,7 +820,7 @@ Eina_Bool ewk_frame_visible_content_geometry_get(const Evas_Object* ewkFrame, Ei
     EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false);
     EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false);
     EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame->view(), false);
-    WebCore::IntRect rect = smartData->frame->view()->visibleContentRect(includeScrollbars);
+    WebCore::IntRect rect = smartData->frame->view()->visibleContentRect(includeScrollbars ? WebCore::ScrollableArea::IncludeScrollbars : WebCore::ScrollableArea::ExcludeScrollbars);
     if (x)
         *x = rect.x();
     if (y)
index f2ef0a8..d5e2b5d 100644 (file)
@@ -1,3 +1,17 @@
+2013-02-18  Simon Fraser  <simon.fraser@apple.com>
+
+        Clean up the boolean argument to visibleContentRect
+        https://bugs.webkit.org/show_bug.cgi?id=110167
+
+        Reviewed by Simon Fraser.
+
+        Replace the boolean argument to visibleContentRect() with
+        an enum.
+
+        * WebFrame.cpp:
+        (WebFrame::visibleContentRect):
+        (WebFrame::frameBounds):
+
 2013-02-18  Zan Dobersek  <zdobersek@igalia.com>
 
         Stop placing std::isfinite and std::signbit inside the global scope
index 846ffc3..ef72b4a 100644 (file)
@@ -1264,7 +1264,7 @@ HRESULT WebFrame::visibleContentRect(RECT* rect)
     if (!view)
         return E_FAIL;
 
-    *rect = view->visibleContentRect(false);
+    *rect = view->visibleContentRect();
     return S_OK;
 }
 
@@ -2471,7 +2471,7 @@ HRESULT STDMETHODCALLTYPE WebFrame::frameBounds(
     if (!view)
         return E_FAIL;
 
-    FloatRect bounds = view->visibleContentRect(true);
+    FloatRect bounds = view->visibleContentRect(ScrollableArea::IncludeScrollbars);
     result->bottom = (LONG) bounds.height();
     result->right = (LONG) bounds.width();
     return S_OK;
index 4b97fc3..ed9c03a 100644 (file)
@@ -1,3 +1,17 @@
+2013-02-18  Simon Fraser  <simon.fraser@apple.com>
+
+        Clean up the boolean argument to visibleContentRect
+        https://bugs.webkit.org/show_bug.cgi?id=110167
+
+        Reviewed by Simon Fraser.
+        
+        Replace the boolean argument to visibleContentRect() with
+        an enum.
+
+        * WebProcess/WebPage/WebFrame.cpp:
+        (WebKit::WebFrame::visibleContentBounds):
+        (WebKit::WebFrame::visibleContentBoundsExcludingScrollbars):
+
 2013-02-18  Anders Carlsson  <andersca@apple.com>
 
         Add a DefaultHash for RefPtr<SecurityOrigin>
index e4e9641..24e08d3 100644 (file)
@@ -482,7 +482,7 @@ IntRect WebFrame::visibleContentBounds() const
     if (!view)
         return IntRect();
     
-    IntRect contentRect = view->visibleContentRect(true);
+    IntRect contentRect = view->visibleContentRect(ScrollableArea::IncludeScrollbars);
     return IntRect(0, 0, contentRect.width(), contentRect.height());
 }
 
@@ -495,7 +495,7 @@ IntRect WebFrame::visibleContentBoundsExcludingScrollbars() const
     if (!view)
         return IntRect();
     
-    IntRect contentRect = view->visibleContentRect(false);
+    IntRect contentRect = view->visibleContentRect();
     return IntRect(0, 0, contentRect.width(), contentRect.height());
 }