- Revision
- 253673
- Author
- simon.fra...@apple.com
- Date
- 2019-12-17 23:00:28 -0800 (Tue, 17 Dec 2019)
Log Message
Remove iOS #ifdefs around unobscuredContentSize
https://bugs.webkit.org/show_bug.cgi?id=205372
Reviewed by Tim Horton.
Long-term, all of the ScrollView geometry data related to delegated scrolling
will move to Optional<DelegatedScrollingGeometry> m_delegatedScrollingGeometry
and not be wrapped in platform #ifdefs.
Take the first step of moving unobscuredContentSize into that struct.
I added platformUnobscuredContentRect() to handle the iOS WK1 case, called
when there is a platform widget.
m_fixedVisibleContentRect is only used by coördinated graphics.
* page/FrameView.cpp:
(WebCore::FrameView::unobscuredContentSizeChanged):
* page/FrameView.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::unobscuredContentSize const):
(WebCore::ScrollView::setUnobscuredContentSize):
(WebCore::ScrollView::unobscuredContentRect const):
(WebCore::ScrollView::platformVisibleContentRect const):
(WebCore::ScrollView::platformVisibleContentSize const):
(WebCore::ScrollView::platformVisibleContentRectIncludingObscuredArea const):
(WebCore::ScrollView::platformVisibleContentSizeIncludingObscuredArea const):
(WebCore::ScrollView::platformUnobscuredContentRect const):
* platform/ScrollView.h:
(WebCore::ScrollView::unobscuredContentSize const): Deleted.
* platform/ios/ScrollViewIOS.mm:
(WebCore::ScrollView::platformUnobscuredContentRect const):
(WebCore::ScrollView::unobscuredContentRect const): Deleted.
(WebCore::ScrollView::setUnobscuredContentSize): Deleted.
* platform/mac/ScrollViewMac.mm:
(WebCore::ScrollView::platformUnobscuredContentRect const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (253672 => 253673)
--- trunk/Source/WebCore/ChangeLog 2019-12-18 05:42:21 UTC (rev 253672)
+++ trunk/Source/WebCore/ChangeLog 2019-12-18 07:00:28 UTC (rev 253673)
@@ -1,3 +1,42 @@
+2019-12-17 Simon Fraser <simon.fra...@apple.com>
+
+ Remove iOS #ifdefs around unobscuredContentSize
+ https://bugs.webkit.org/show_bug.cgi?id=205372
+
+ Reviewed by Tim Horton.
+
+ Long-term, all of the ScrollView geometry data related to delegated scrolling
+ will move to Optional<DelegatedScrollingGeometry> m_delegatedScrollingGeometry
+ and not be wrapped in platform #ifdefs.
+
+ Take the first step of moving unobscuredContentSize into that struct.
+
+ I added platformUnobscuredContentRect() to handle the iOS WK1 case, called
+ when there is a platform widget.
+
+ m_fixedVisibleContentRect is only used by coördinated graphics.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::unobscuredContentSizeChanged):
+ * page/FrameView.h:
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::unobscuredContentSize const):
+ (WebCore::ScrollView::setUnobscuredContentSize):
+ (WebCore::ScrollView::unobscuredContentRect const):
+ (WebCore::ScrollView::platformVisibleContentRect const):
+ (WebCore::ScrollView::platformVisibleContentSize const):
+ (WebCore::ScrollView::platformVisibleContentRectIncludingObscuredArea const):
+ (WebCore::ScrollView::platformVisibleContentSizeIncludingObscuredArea const):
+ (WebCore::ScrollView::platformUnobscuredContentRect const):
+ * platform/ScrollView.h:
+ (WebCore::ScrollView::unobscuredContentSize const): Deleted.
+ * platform/ios/ScrollViewIOS.mm:
+ (WebCore::ScrollView::platformUnobscuredContentRect const):
+ (WebCore::ScrollView::unobscuredContentRect const): Deleted.
+ (WebCore::ScrollView::setUnobscuredContentSize): Deleted.
+ * platform/mac/ScrollViewMac.mm:
+ (WebCore::ScrollView::platformUnobscuredContentRect const):
+
2019-12-17 Chris Dumez <cdu...@apple.com>
Port service worker code to the HTML5 event loop
Modified: trunk/Source/WebCore/page/FrameView.cpp (253672 => 253673)
--- trunk/Source/WebCore/page/FrameView.cpp 2019-12-18 05:42:21 UTC (rev 253672)
+++ trunk/Source/WebCore/page/FrameView.cpp 2019-12-18 07:00:28 UTC (rev 253673)
@@ -2807,15 +2807,13 @@
}
}
-#if PLATFORM(IOS_FAMILY)
-
void FrameView::unobscuredContentSizeChanged()
{
+#if PLATFORM(IOS_FAMILY)
updateTiledBackingAdaptiveSizing();
+#endif
}
-#endif
-
static LayerFlushThrottleState::Flags determineLayerFlushThrottleState(Page& page)
{
// We only throttle when constantly receiving new data during the inital page load.
Modified: trunk/Source/WebCore/page/FrameView.h (253672 => 253673)
--- trunk/Source/WebCore/page/FrameView.h 2019-12-18 05:42:21 UTC (rev 253672)
+++ trunk/Source/WebCore/page/FrameView.h 2019-12-18 07:00:28 UTC (rev 253673)
@@ -722,6 +722,8 @@
void delegatesScrollingDidChange() final;
+ void unobscuredContentSizeChanged() final;
+
// ScrollableArea interface
void invalidateScrollbarRect(Scrollbar&, const IntRect&) final;
void scrollTo(const ScrollPosition&) final;
@@ -735,10 +737,6 @@
#endif
void contentsResized() final;
-#if PLATFORM(IOS_FAMILY)
- void unobscuredContentSizeChanged() final;
-#endif
-
#if ENABLE(DARK_MODE_CSS)
RenderObject* rendererForColorScheme() const;
#endif
Modified: trunk/Source/WebCore/platform/ScrollView.cpp (253672 => 253673)
--- trunk/Source/WebCore/platform/ScrollView.cpp 2019-12-18 05:42:21 UTC (rev 253672)
+++ trunk/Source/WebCore/platform/ScrollView.cpp 2019-12-18 07:00:28 UTC (rev 253673)
@@ -220,12 +220,37 @@
setScrollPosition(position);
}
-#if !PLATFORM(IOS_FAMILY)
+FloatSize ScrollView::unobscuredContentSize() const
+{
+ ASSERT(m_delegatedScrollingGeometry);
+ if (m_delegatedScrollingGeometry)
+ return m_delegatedScrollingGeometry->unobscuredContentSize;
+ return { };
+}
+
+void ScrollView::setUnobscuredContentSize(const FloatSize& size)
+{
+ ASSERT(!platformWidget());
+ if (m_delegatedScrollingGeometry && size == m_delegatedScrollingGeometry->unobscuredContentSize)
+ return;
+
+ if (!m_delegatedScrollingGeometry)
+ m_delegatedScrollingGeometry = DelegatedScrollingGeometry();
+
+ m_delegatedScrollingGeometry->unobscuredContentSize = size;
+ unobscuredContentSizeChanged();
+}
+
IntRect ScrollView::unobscuredContentRect(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
{
+ if (platformWidget())
+ return platformUnobscuredContentRect(scrollbarInclusion);
+
+ if (m_delegatedScrollingGeometry)
+ return IntRect(m_scrollPosition, roundedIntSize(m_delegatedScrollingGeometry->unobscuredContentSize));
+
return unobscuredContentRectInternal(scrollbarInclusion);
}
-#endif
IntRect ScrollView::unobscuredContentRectInternal(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
{
@@ -1533,7 +1558,7 @@
IntRect ScrollView::platformVisibleContentRect(bool) const
{
- return IntRect();
+ return { };
}
float ScrollView::platformTopContentInset() const
@@ -1547,19 +1572,24 @@
IntSize ScrollView::platformVisibleContentSize(bool) const
{
- return IntSize();
+ return { };
}
IntRect ScrollView::platformVisibleContentRectIncludingObscuredArea(bool) const
{
- return IntRect();
+ return { };
}
IntSize ScrollView::platformVisibleContentSizeIncludingObscuredArea(bool) const
{
- return IntSize();
+ return { };
}
+IntRect ScrollView::platformUnobscuredContentRect(VisibleContentRectIncludesScrollbars) const
+{
+ return { };
+}
+
void ScrollView::platformSetContentsSize()
{
}
Modified: trunk/Source/WebCore/platform/ScrollView.h (253672 => 253673)
--- trunk/Source/WebCore/platform/ScrollView.h 2019-12-18 05:42:21 UTC (rev 253672)
+++ trunk/Source/WebCore/platform/ScrollView.h 2019-12-18 07:00:28 UTC (rev 253673)
@@ -179,6 +179,7 @@
// contribute to painting but not to the scrollable area.
// The unobscuredContentRect is the area that is not covered by UI elements.
WEBCORE_EXPORT IntRect unobscuredContentRect(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
+
#if PLATFORM(IOS_FAMILY)
IntRect unobscuredContentRectIncludingScrollbars() const { return unobscuredContentRect(IncludeScrollbars); }
#else
@@ -185,15 +186,16 @@
IntRect unobscuredContentRectIncludingScrollbars() const { return visibleContentRectIncludingScrollbars(); }
#endif
-#if PLATFORM(IOS_FAMILY)
// This is the area that is partially or fully exposed, and may extend under overlapping UI elements.
WEBCORE_EXPORT FloatRect exposedContentRect() const;
// The given rects are only used if there is no platform widget.
WEBCORE_EXPORT void setExposedContentRect(const FloatRect&);
- const FloatSize& unobscuredContentSize() const { return m_unobscuredContentSize; }
+
+ WEBCORE_EXPORT FloatSize unobscuredContentSize() const;
WEBCORE_EXPORT void setUnobscuredContentSize(const FloatSize&);
+#if PLATFORM(IOS_FAMILY)
void setActualScrollPosition(const IntPoint&);
LegacyTileCache* legacyTileCache();
#endif
@@ -428,9 +430,7 @@
virtual void scrollOffsetChangedViaPlatformWidgetImpl(const ScrollOffset&, const ScrollOffset&) = 0;
-#if PLATFORM(IOS_FAMILY)
virtual void unobscuredContentSizeChanged() = 0;
-#endif
#if PLATFORM(COCOA) && defined __OBJC__
public:
@@ -468,13 +468,19 @@
void platformScrollbarModes(ScrollbarMode& horizontal, ScrollbarMode& vertical) const;
void platformSetCanBlitOnScroll(bool);
bool platformCanBlitOnScroll() const;
+
IntRect platformVisibleContentRect(bool includeScrollbars) const;
IntSize platformVisibleContentSize(bool includeScrollbars) const;
IntRect platformVisibleContentRectIncludingObscuredArea(bool includeScrollbars) const;
IntSize platformVisibleContentSizeIncludingObscuredArea(bool includeScrollbars) const;
+
+ IntRect platformUnobscuredContentRect(VisibleContentRectIncludesScrollbars) const;
+
void platformSetContentsSize();
+
IntRect platformContentsToScreen(const IntRect&) const;
IntPoint platformScreenToContents(const IntPoint&) const;
+
void platformSetScrollPosition(const IntPoint&);
bool platformScroll(ScrollDirection, ScrollGranularity);
void platformSetScrollbarsSuppressed(bool repaintOnUnsuppress);
@@ -493,13 +499,17 @@
ScrollbarMode m_horizontalScrollbarMode { ScrollbarAuto };
ScrollbarMode m_verticalScrollbarMode { ScrollbarAuto };
-#if PLATFORM(IOS_FAMILY)
+ FloatRect m_exposedContentRect;
+
+ // FIXME: More things will move into here.
+ struct DelegatedScrollingGeometry {
+ FloatSize unobscuredContentSize;
+ };
+ Optional<DelegatedScrollingGeometry> m_delegatedScrollingGeometry;
+
+#if USE(COORDINATED_GRAPHICS)
// FIXME: exposedContentRect is a very similar concept to fixedVisibleContentRect except it does not differentiate
// between exposed and unobscured areas. The two attributes should eventually be merged.
- FloatRect m_exposedContentRect;
- FloatSize m_unobscuredContentSize;
- // This is only used for history scroll position restoration.
-#else
IntRect m_fixedVisibleContentRect;
#endif
ScrollPosition m_scrollPosition;
Modified: trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm (253672 => 253673)
--- trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm 2019-12-18 05:42:21 UTC (rev 253672)
+++ trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm 2019-12-18 07:00:28 UTC (rev 253673)
@@ -102,32 +102,17 @@
ALLOW_DEPRECATED_DECLARATIONS_END
}
-IntRect ScrollView::unobscuredContentRect(VisibleContentRectIncludesScrollbars) const
+IntRect ScrollView::platformUnobscuredContentRect(VisibleContentRectIncludesScrollbars) const
{
- if (WAKScrollView *view = static_cast<WAKScrollView *>(platformWidget())) {
- CGRect r = CGRectZero;
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- r = [view unobscuredContentRect];
- END_BLOCK_OBJC_EXCEPTIONS;
- return enclosingIntRect(r);
- }
-
- if (!m_unobscuredContentSize.isEmpty())
- return IntRect(m_scrollPosition, roundedIntSize(m_unobscuredContentSize));
-
- return unobscuredContentRectInternal();
+ ASSERT(platformWidget());
+ WAKScrollView *view = static_cast<WAKScrollView *>(platformWidget());
+ CGRect r = CGRectZero;
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ r = [view unobscuredContentRect];
+ END_BLOCK_OBJC_EXCEPTIONS;
+ return enclosingIntRect(r);
}
-void ScrollView::setUnobscuredContentSize(const FloatSize& size)
-{
- ASSERT(!platformWidget());
- if (size == m_unobscuredContentSize)
- return;
-
- m_unobscuredContentSize = size;
- unobscuredContentSizeChanged();
-}
-
FloatRect ScrollView::exposedContentRect() const
{
if (NSScrollView *view = static_cast<NSScrollView *>(platformWidget())) {
Modified: trunk/Source/WebCore/platform/mac/ScrollViewMac.mm (253672 => 253673)
--- trunk/Source/WebCore/platform/mac/ScrollViewMac.mm 2019-12-18 05:42:21 UTC (rev 253672)
+++ trunk/Source/WebCore/platform/mac/ScrollViewMac.mm 2019-12-18 07:00:28 UTC (rev 253673)
@@ -177,6 +177,11 @@
return platformVisibleContentRectIncludingObscuredArea(includeScrollbars).size();
}
+IntRect ScrollView::platformUnobscuredContentRect(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
+{
+ return unobscuredContentRectInternal(scrollbarInclusion);
+}
+
void ScrollView::platformSetContentsSize()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;