<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[194184] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/194184">194184</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2015-12-16 15:41:05 -0800 (Wed, 16 Dec 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Simplify isOverlayScrollbar() logic
https://bugs.webkit.org/show_bug.cgi?id=152357
Reviewed by Beth Dakin.
Replace code that checks for isOverlayScrollbar() explicitly with calls to new
occupiedWidth()/occupiedHeight() functions on Scrollbar, which do the overlay
scrollbar check internally.
Add ScrollableArea::scrollbarIntrusion() which returns an IntSize with the occupiedWidth
and occupiedHeight of any scrollbars, and use it in a few places.
Source/WebCore:
* page/FrameView.cpp:
(WebCore::FrameView::autoSizeIfEnabled):
* platform/ScrollView.cpp:
(WebCore::ScrollView::unscaledVisibleContentSizeIncludingObscuredArea):
(WebCore::ScrollView::calculateOverhangAreasForPainting):
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::scrollbarIntrusion):
(WebCore::ScrollableArea::visibleContentRectInternal):
* platform/ScrollableArea.h:
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::occupiedWidth):
(WebCore::Scrollbar::occupiedHeight):
* platform/Scrollbar.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::visibleContentRectInternal):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::verticalScrollbarWidth):
Source/WebKit2:
* WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
(WebKit::PDFPlugin::updateScrollbars):
(WebKit::PDFPlugin::maximumScrollPosition):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollViewcpp">trunk/Source/WebCore/platform/ScrollView.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollableAreacpp">trunk/Source/WebCore/platform/ScrollableArea.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollableAreah">trunk/Source/WebCore/platform/ScrollableArea.h</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollbarcpp">trunk/Source/WebCore/platform/Scrollbar.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollbarh">trunk/Source/WebCore/platform/Scrollbar.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderListBoxcpp">trunk/Source/WebCore/rendering/RenderListBox.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessPluginsPDFDeprecatedPDFPluginmm">trunk/Source/WebKit2/WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (194183 => 194184)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-12-16 23:36:49 UTC (rev 194183)
+++ trunk/Source/WebCore/ChangeLog        2015-12-16 23:41:05 UTC (rev 194184)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2015-12-16 Simon Fraser <simon.fraser@apple.com>
+
+ Simplify isOverlayScrollbar() logic
+ https://bugs.webkit.org/show_bug.cgi?id=152357
+
+ Reviewed by Beth Dakin.
+
+ Replace code that checks for isOverlayScrollbar() explicitly with calls to new
+ occupiedWidth()/occupiedHeight() functions on Scrollbar, which do the overlay
+ scrollbar check internally.
+
+ Add ScrollableArea::scrollbarIntrusion() which returns an IntSize with the occupiedWidth
+ and occupiedHeight of any scrollbars, and use it in a few places.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::autoSizeIfEnabled):
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::unscaledVisibleContentSizeIncludingObscuredArea):
+ (WebCore::ScrollView::calculateOverhangAreasForPainting):
+ * platform/ScrollableArea.cpp:
+ (WebCore::ScrollableArea::scrollbarIntrusion):
+ (WebCore::ScrollableArea::visibleContentRectInternal):
+ * platform/ScrollableArea.h:
+ * platform/Scrollbar.cpp:
+ (WebCore::Scrollbar::occupiedWidth):
+ (WebCore::Scrollbar::occupiedHeight):
+ * platform/Scrollbar.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::visibleContentRectInternal):
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::verticalScrollbarWidth):
+
</ins><span class="cx"> 2015-12-16 Alex Christensen <achristensen@webkit.org>
</span><span class="cx">
</span><span class="cx"> Fix internal Windows build
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (194183 => 194184)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2015-12-16 23:36:49 UTC (rev 194183)
+++ trunk/Source/WebCore/page/FrameView.cpp        2015-12-16 23:41:05 UTC (rev 194184)
</span><span class="lines">@@ -3262,8 +3262,7 @@
</span><span class="cx"> RefPtr<Scrollbar> localHorizontalScrollbar = horizontalScrollbar();
</span><span class="cx"> if (!localHorizontalScrollbar)
</span><span class="cx"> localHorizontalScrollbar = createScrollbar(HorizontalScrollbar);
</span><del>- if (!localHorizontalScrollbar->isOverlayScrollbar())
- newSize.setHeight(newSize.height() + localHorizontalScrollbar->height());
</del><ins>+ newSize.expand(0, localHorizontalScrollbar->occupiedHeight());
</ins><span class="cx">
</span><span class="cx"> // Don't bother checking for a vertical scrollbar because the width is at
</span><span class="cx"> // already greater the maximum.
</span><span class="lines">@@ -3271,8 +3270,7 @@
</span><span class="cx"> RefPtr<Scrollbar> localVerticalScrollbar = verticalScrollbar();
</span><span class="cx"> if (!localVerticalScrollbar)
</span><span class="cx"> localVerticalScrollbar = createScrollbar(VerticalScrollbar);
</span><del>- if (!localVerticalScrollbar->isOverlayScrollbar())
- newSize.setWidth(newSize.width() + localVerticalScrollbar->width());
</del><ins>+ newSize.expand(localVerticalScrollbar->occupiedWidth(), 0);
</ins><span class="cx">
</span><span class="cx"> // Don't bother checking for a horizontal scrollbar because the height is
</span><span class="cx"> // already greater the maximum.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollView.cpp (194183 => 194184)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollView.cpp        2015-12-16 23:36:49 UTC (rev 194183)
+++ trunk/Source/WebCore/platform/ScrollView.cpp        2015-12-16 23:41:05 UTC (rev 194184)
</span><span class="lines">@@ -275,17 +275,11 @@
</span><span class="cx"> return m_fixedVisibleContentRect.size();
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- int verticalScrollbarWidth = 0;
- int horizontalScrollbarHeight = 0;
</del><ins>+ IntSize scrollbarSpace;
+ if (scrollbarInclusion == ExcludeScrollbars)
+ scrollbarSpace = scrollbarIntrusion();
</ins><span class="cx">
</span><del>- if (scrollbarInclusion == ExcludeScrollbars) {
- if (Scrollbar* verticalBar = verticalScrollbar())
- verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBar->width() : 0;
- if (Scrollbar* horizontalBar = horizontalScrollbar())
- horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horizontalBar->height() : 0;
- }
-
- return IntSize(width() - verticalScrollbarWidth, height() - horizontalScrollbarHeight).expandedTo(IntSize());
</del><ins>+ return IntSize(width() - scrollbarSpace.width(), height() - scrollbarSpace.height()).expandedTo(IntSize());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> IntSize ScrollView::unscaledUnobscuredVisibleContentSize(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
</span><span class="lines">@@ -1249,28 +1243,25 @@
</span><span class="cx">
</span><span class="cx"> void ScrollView::calculateOverhangAreasForPainting(IntRect& horizontalOverhangRect, IntRect& verticalOverhangRect)
</span><span class="cx"> {
</span><del>- int verticalScrollbarWidth = (verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar())
- ? verticalScrollbar()->width() : 0;
- int horizontalScrollbarHeight = (horizontalScrollbar() && !horizontalScrollbar()->isOverlayScrollbar())
- ? horizontalScrollbar()->height() : 0;
</del><ins>+ IntSize scrollbarSpace = scrollbarIntrusion();
</ins><span class="cx">
</span><span class="cx"> int physicalScrollY = scrollPosition().y() + scrollOrigin().y();
</span><span class="cx"> if (physicalScrollY < 0) {
</span><span class="cx"> horizontalOverhangRect = frameRect();
</span><span class="cx"> horizontalOverhangRect.setHeight(-physicalScrollY);
</span><del>- horizontalOverhangRect.setWidth(horizontalOverhangRect.width() - verticalScrollbarWidth);
</del><ins>+ horizontalOverhangRect.setWidth(horizontalOverhangRect.width() - scrollbarSpace.width());
</ins><span class="cx"> } else if (totalContentsSize().height() && physicalScrollY > totalContentsSize().height() - visibleHeight()) {
</span><span class="cx"> int height = physicalScrollY - (totalContentsSize().height() - visibleHeight());
</span><span class="cx"> horizontalOverhangRect = frameRect();
</span><del>- horizontalOverhangRect.setY(frameRect().maxY() - height - horizontalScrollbarHeight);
</del><ins>+ horizontalOverhangRect.setY(frameRect().maxY() - height - scrollbarSpace.height());
</ins><span class="cx"> horizontalOverhangRect.setHeight(height);
</span><del>- horizontalOverhangRect.setWidth(horizontalOverhangRect.width() - verticalScrollbarWidth);
</del><ins>+ horizontalOverhangRect.setWidth(horizontalOverhangRect.width() - scrollbarSpace.width());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> int physicalScrollX = scrollPosition().x() + scrollOrigin().x();
</span><span class="cx"> if (physicalScrollX < 0) {
</span><span class="cx"> verticalOverhangRect.setWidth(-physicalScrollX);
</span><del>- verticalOverhangRect.setHeight(frameRect().height() - horizontalOverhangRect.height() - horizontalScrollbarHeight);
</del><ins>+ verticalOverhangRect.setHeight(frameRect().height() - horizontalOverhangRect.height() - scrollbarSpace.height());
</ins><span class="cx"> verticalOverhangRect.setX(frameRect().x());
</span><span class="cx"> if (horizontalOverhangRect.y() == frameRect().y())
</span><span class="cx"> verticalOverhangRect.setY(frameRect().y() + horizontalOverhangRect.height());
</span><span class="lines">@@ -1279,8 +1270,8 @@
</span><span class="cx"> } else if (contentsWidth() && physicalScrollX > contentsWidth() - visibleWidth()) {
</span><span class="cx"> int width = physicalScrollX - (contentsWidth() - visibleWidth());
</span><span class="cx"> verticalOverhangRect.setWidth(width);
</span><del>- verticalOverhangRect.setHeight(frameRect().height() - horizontalOverhangRect.height() - horizontalScrollbarHeight);
- verticalOverhangRect.setX(frameRect().maxX() - width - verticalScrollbarWidth);
</del><ins>+ verticalOverhangRect.setHeight(frameRect().height() - horizontalOverhangRect.height() - scrollbarSpace.height());
+ verticalOverhangRect.setX(frameRect().maxX() - width - scrollbarSpace.width());
</ins><span class="cx"> if (horizontalOverhangRect.y() == frameRect().y())
</span><span class="cx"> verticalOverhangRect.setY(frameRect().y() + horizontalOverhangRect.height());
</span><span class="cx"> else
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollableAreacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (194183 => 194184)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollableArea.cpp        2015-12-16 23:36:49 UTC (rev 194183)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp        2015-12-16 23:41:05 UTC (rev 194184)
</span><span class="lines">@@ -516,6 +516,13 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx">
</span><ins>+IntSize ScrollableArea::scrollbarIntrusion() const
+{
+ return IntSize(
+ verticalScrollbar() ? verticalScrollbar()->occupiedWidth() : 0,
+ horizontalScrollbar() ? horizontalScrollbar()->occupiedHeight() : 0);
+}
+
</ins><span class="cx"> IntPoint ScrollableArea::scrollPosition() const
</span><span class="cx"> {
</span><span class="cx"> int x = horizontalScrollbar() ? horizontalScrollbar()->value() : 0;
</span><span class="lines">@@ -582,9 +589,9 @@
</span><span class="cx">
</span><span class="cx"> if (scrollbarInclusion == IncludeScrollbars) {
</span><span class="cx"> if (Scrollbar* verticalBar = verticalScrollbar())
</span><del>- verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBar->width() : 0;
</del><ins>+ verticalScrollbarWidth = verticalBar->occupiedWidth();
</ins><span class="cx"> if (Scrollbar* horizontalBar = horizontalScrollbar())
</span><del>- horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horizontalBar->height() : 0;
</del><ins>+ horizontalScrollbarHeight = horizontalBar->occupiedHeight();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return IntRect(scrollPosition().x(),
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollableAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollableArea.h (194183 => 194184)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollableArea.h        2015-12-16 23:36:49 UTC (rev 194183)
+++ trunk/Source/WebCore/platform/ScrollableArea.h        2015-12-16 23:41:05 UTC (rev 194184)
</span><span class="lines">@@ -173,6 +173,8 @@
</span><span class="cx"> {
</span><span class="cx"> return scrollbar->Widget::convertFromContainingView(parentPoint);
</span><span class="cx"> }
</span><ins>+
+ WEBCORE_EXPORT IntSize scrollbarIntrusion() const;
</ins><span class="cx">
</span><span class="cx"> virtual Scrollbar* horizontalScrollbar() const { return 0; }
</span><span class="cx"> virtual Scrollbar* verticalScrollbar() const { return 0; }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollbarcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/Scrollbar.cpp (194183 => 194184)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/Scrollbar.cpp        2015-12-16 23:36:49 UTC (rev 194183)
+++ trunk/Source/WebCore/platform/Scrollbar.cpp        2015-12-16 23:41:05 UTC (rev 194184)
</span><span class="lines">@@ -97,6 +97,16 @@
</span><span class="cx"> theme().unregisterScrollbar(*this);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+int Scrollbar::occupiedWidth() const
+{
+ return isOverlayScrollbar() ? 0 : width();
+}
+
+int Scrollbar::occupiedHeight() const
+{
+ return isOverlayScrollbar() ? 0 : height();
+}
+
</ins><span class="cx"> void Scrollbar::offsetDidChange()
</span><span class="cx"> {
</span><span class="cx"> float position = static_cast<float>(m_scrollableArea.scrollPosition(this));
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollbarh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/Scrollbar.h (194183 => 194184)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/Scrollbar.h        2015-12-16 23:36:49 UTC (rev 194183)
+++ trunk/Source/WebCore/platform/Scrollbar.h        2015-12-16 23:41:05 UTC (rev 194184)
</span><span class="lines">@@ -69,6 +69,9 @@
</span><span class="cx"> int totalSize() const { return m_totalSize; }
</span><span class="cx"> int maximum() const { return m_totalSize - m_visibleSize; }
</span><span class="cx"> ScrollbarControlSize controlSize() const { return m_controlSize; }
</span><ins>+
+ int occupiedWidth() const;
+ int occupiedHeight() const;
</ins><span class="cx">
</span><span class="cx"> int lineStep() const { return m_lineStep; }
</span><span class="cx"> int pageStep() const { return m_pageStep; }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (194183 => 194184)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2015-12-16 23:36:49 UTC (rev 194183)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2015-12-16 23:41:05 UTC (rev 194184)
</span><span class="lines">@@ -2747,14 +2747,11 @@
</span><span class="cx">
</span><span class="cx"> IntRect RenderLayer::visibleContentRectInternal(VisibleContentRectIncludesScrollbars scrollbarInclusion, VisibleContentRectBehavior) const
</span><span class="cx"> {
</span><del>- int verticalScrollbarWidth = 0;
- int horizontalScrollbarHeight = 0;
- if (showsOverflowControls() && scrollbarInclusion == IncludeScrollbars) {
- verticalScrollbarWidth = (verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar()) ? verticalScrollbar()->width() : 0;
- horizontalScrollbarHeight = (horizontalScrollbar() && !horizontalScrollbar()->isOverlayScrollbar()) ? horizontalScrollbar()->height() : 0;
- }
</del><ins>+ IntSize scrollbarSpace;
+ if (showsOverflowControls() && scrollbarInclusion == IncludeScrollbars)
+ scrollbarSpace = scrollbarIntrusion();
</ins><span class="cx">
</span><del>- return IntRect(scrollPosition(), IntSize(std::max(0, m_layerSize.width() - verticalScrollbarWidth), std::max(0, m_layerSize.height() - horizontalScrollbarHeight)));
</del><ins>+ return IntRect(scrollPosition(), IntSize(std::max(0, m_layerSize.width() - scrollbarSpace.width()), std::max(0, m_layerSize.height() - scrollbarSpace.height())));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> IntSize RenderLayer::overhangAmount() const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderListBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (194183 => 194184)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderListBox.cpp        2015-12-16 23:36:49 UTC (rev 194183)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp        2015-12-16 23:41:05 UTC (rev 194184)
</span><span class="lines">@@ -630,7 +630,7 @@
</span><span class="cx">
</span><span class="cx"> int RenderListBox::verticalScrollbarWidth() const
</span><span class="cx"> {
</span><del>- return m_vBar && !m_vBar->isOverlayScrollbar() ? m_vBar->width() : 0;
</del><ins>+ return m_vBar ? m_vBar->occupiedWidth() : 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // FIXME: We ignore padding in the vertical direction as far as these values are concerned, since that's
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (194183 => 194184)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-12-16 23:36:49 UTC (rev 194183)
+++ trunk/Source/WebKit2/ChangeLog        2015-12-16 23:41:05 UTC (rev 194184)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-12-16 Simon Fraser <simon.fraser@apple.com>
+
+ Simplify isOverlayScrollbar() logic
+ https://bugs.webkit.org/show_bug.cgi?id=152357
+
+ Reviewed by Beth Dakin.
+
+ Replace code that checks for isOverlayScrollbar() explicitly with calls to new
+ occupiedWidth()/occupiedHeight() functions on Scrollbar, which do the overlay
+ scrollbar check internally.
+
+ Add ScrollableArea::scrollbarIntrusion() which returns an IntSize with the occupiedWidth
+ and occupiedHeight of any scrollbars, and use it in a few places.
+
+ * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
+ (WebKit::PDFPlugin::updateScrollbars):
+ (WebKit::PDFPlugin::maximumScrollPosition):
+
</ins><span class="cx"> 2015-12-16 Alex Christensen <achristensen@webkit.org>
</span><span class="cx">
</span><span class="cx"> Build fix when using NETWORK_SESSION after r193972.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessPluginsPDFDeprecatedPDFPluginmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm (194183 => 194184)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm        2015-12-16 23:36:49 UTC (rev 194183)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm        2015-12-16 23:41:05 UTC (rev 194184)
</span><span class="lines">@@ -587,14 +587,13 @@
</span><span class="cx"> } else if (m_size.height() < m_pdfDocumentSize.height())
</span><span class="cx"> m_verticalScrollbar = createScrollbar(VerticalScrollbar);
</span><span class="cx">
</span><del>- int horizontalScrollbarHeight = (m_horizontalScrollbar && !m_horizontalScrollbar->isOverlayScrollbar()) ? m_horizontalScrollbar->height() : 0;
- int verticalScrollbarWidth = (m_verticalScrollbar && !m_verticalScrollbar->isOverlayScrollbar()) ? m_verticalScrollbar->width() : 0;
</del><ins>+ IntSize scrollbarSpace = scrollbarIntrusion();
</ins><span class="cx">
</span><span class="cx"> int pageStep = m_pageBoxes.isEmpty() ? 0 : m_pageBoxes[0].height();
</span><span class="cx">
</span><span class="cx"> if (m_horizontalScrollbar) {
</span><span class="cx"> m_horizontalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
</span><del>- m_horizontalScrollbar->setProportion(m_size.width() - verticalScrollbarWidth, m_pdfDocumentSize.width());
</del><ins>+ m_horizontalScrollbar->setProportion(m_size.width() - scrollbarSpace.width(), m_pdfDocumentSize.width());
</ins><span class="cx"> IntRect scrollbarRect(pluginView()->x(), pluginView()->y() + m_size.height() - m_horizontalScrollbar->height(), m_size.width(), m_horizontalScrollbar->height());
</span><span class="cx"> if (m_verticalScrollbar)
</span><span class="cx"> scrollbarRect.contract(m_verticalScrollbar->width(), 0);
</span><span class="lines">@@ -602,7 +601,7 @@
</span><span class="cx"> }
</span><span class="cx"> if (m_verticalScrollbar) {
</span><span class="cx"> m_verticalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
</span><del>- m_verticalScrollbar->setProportion(m_size.height() - horizontalScrollbarHeight, m_pdfDocumentSize.height());
</del><ins>+ m_verticalScrollbar->setProportion(m_size.height() - scrollbarSpace.height(), m_pdfDocumentSize.height());
</ins><span class="cx"> IntRect scrollbarRect(IntRect(pluginView()->x() + m_size.width() - m_verticalScrollbar->width(), pluginView()->y(), m_verticalScrollbar->width(), m_size.height()));
</span><span class="cx"> if (m_horizontalScrollbar)
</span><span class="cx"> scrollbarRect.contract(0, m_horizontalScrollbar->height());
</span><span class="lines">@@ -796,10 +795,9 @@
</span><span class="cx">
</span><span class="cx"> IntPoint PDFPlugin::maximumScrollPosition() const
</span><span class="cx"> {
</span><del>- int horizontalScrollbarHeight = (m_horizontalScrollbar && !m_horizontalScrollbar->isOverlayScrollbar()) ? m_horizontalScrollbar->height() : 0;
- int verticalScrollbarWidth = (m_verticalScrollbar && !m_verticalScrollbar->isOverlayScrollbar()) ? m_verticalScrollbar->width() : 0;
</del><ins>+ IntSize scrollbarSpace = scrollbarIntrusion();
</ins><span class="cx">
</span><del>- IntPoint maximumOffset(m_pdfDocumentSize.width() - m_size.width() + verticalScrollbarWidth, m_pdfDocumentSize.height() - m_size.height() + horizontalScrollbarHeight);
</del><ins>+ IntPoint maximumOffset(m_pdfDocumentSize.width() - m_size.width() + scrollbarSpace.width(), m_pdfDocumentSize.height() - m_size.height() + scrollbarSpace.height());
</ins><span class="cx"> maximumOffset.clampNegativeToZero();
</span><span class="cx"> return maximumOffset;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>