- Revision
- 131217
- Author
- [email protected]
- Date
- 2012-10-12 13:30:38 -0700 (Fri, 12 Oct 2012)
Log Message
Add WKPage API to get whether the main frame is pinned to the top or bottom edge
https://bugs.webkit.org/show_bug.cgi?id=99110
Reviewed by NOBODY (OOPS!).
This is very similar to r79025 where we add support to do this for the left and right sides.
* UIProcess/API/C/WKPage.cpp:
(WKPageIsPinnedToTopSide):
(WKPageIsPinnedToBottomSide):
* UIProcess/API/C/WKPage.h:
Add new API calls.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::processDidCrash):
(WebKit::WebPageProxy::didChangeScrollOffsetPinningForMainFrame):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::isPinnedToTopSide):
(WebKit::WebPageProxy::isPinnedToBottomSide):
Declare new data members for keeping track of the pinned states for
top and bottom sides. Initialize, reset, and update these states
at appropriate times. Implement getters for these states.
* UIProcess/WebPageProxy.messages.in:
Change the DidChangeScrollOffsetPinningForMainFrame message to take
the pinned states for top and bottom sides.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::didChangeScrollOffsetForMainFrame):
* WebProcess/WebPage/WebPage.h:
Cache the pinned states for top and bottom sides. Only notify the
UI process if the states have changed.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (131216 => 131217)
--- trunk/Source/WebKit2/ChangeLog 2012-10-12 20:15:06 UTC (rev 131216)
+++ trunk/Source/WebKit2/ChangeLog 2012-10-12 20:30:38 UTC (rev 131217)
@@ -1,3 +1,42 @@
+2012-10-12 Ada Chan <[email protected]>
+
+ Add WKPage API to get whether the main frame is pinned to the top or bottom edge
+ https://bugs.webkit.org/show_bug.cgi?id=99110
+
+ Reviewed by Beth Dakin.
+
+ This is very similar to r79025 where we add support to do this for the left and right sides.
+
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageIsPinnedToTopSide):
+ (WKPageIsPinnedToBottomSide):
+ * UIProcess/API/C/WKPage.h:
+ Add new API calls.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy):
+ (WebKit::WebPageProxy::close):
+ (WebKit::WebPageProxy::didCommitLoadForFrame):
+ (WebKit::WebPageProxy::processDidCrash):
+ (WebKit::WebPageProxy::didChangeScrollOffsetPinningForMainFrame):
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::isPinnedToTopSide):
+ (WebKit::WebPageProxy::isPinnedToBottomSide):
+ Declare new data members for keeping track of the pinned states for
+ top and bottom sides. Initialize, reset, and update these states
+ at appropriate times. Implement getters for these states.
+
+ * UIProcess/WebPageProxy.messages.in:
+ Change the DidChangeScrollOffsetPinningForMainFrame message to take
+ the pinned states for top and bottom sides.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+ (WebKit::WebPage::didChangeScrollOffsetForMainFrame):
+ * WebProcess/WebPage/WebPage.h:
+ Cache the pinned states for top and bottom sides. Only notify the
+ UI process if the states have changed.
+
2012-10-12 Anders Carlsson <[email protected]>
Stop using deprecatedSend inside ConnectionMac.cpp
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (131216 => 131217)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2012-10-12 20:15:06 UTC (rev 131216)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2012-10-12 20:30:38 UTC (rev 131217)
@@ -365,6 +365,16 @@
return toImpl(pageRef)->isPinnedToRightSide();
}
+bool WKPageIsPinnedToTopSide(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->isPinnedToTopSide();
+}
+
+bool WKPageIsPinnedToBottomSide(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->isPinnedToBottomSide();
+}
+
void WKPageSetPaginationMode(WKPageRef pageRef, WKPaginationMode paginationMode)
{
Pagination::Mode mode;
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.h (131216 => 131217)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.h 2012-10-12 20:15:06 UTC (rev 131216)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.h 2012-10-12 20:30:38 UTC (rev 131217)
@@ -439,6 +439,8 @@
WK_EXPORT bool WKPageIsPinnedToLeftSide(WKPageRef page);
WK_EXPORT bool WKPageIsPinnedToRightSide(WKPageRef page);
+WK_EXPORT bool WKPageIsPinnedToTopSide(WKPageRef page);
+WK_EXPORT bool WKPageIsPinnedToBottomSide(WKPageRef page);
WK_EXPORT bool WKPageCanDelete(WKPageRef page);
WK_EXPORT bool WKPageHasSelectedRange(WKPageRef page);
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (131216 => 131217)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2012-10-12 20:15:06 UTC (rev 131216)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2012-10-12 20:30:38 UTC (rev 131217)
@@ -223,6 +223,8 @@
, m_canShortCircuitHorizontalWheelEvents(true)
, m_mainFrameIsPinnedToLeftSide(false)
, m_mainFrameIsPinnedToRightSide(false)
+ , m_mainFrameIsPinnedToTopSide(false)
+ , m_mainFrameIsPinnedToBottomSide(false)
, m_pageCount(0)
, m_renderTreeSize(0)
, m_shouldSendEventsSynchronously(false)
@@ -475,6 +477,8 @@
m_mainFrameIsPinnedToLeftSide = false;
m_mainFrameIsPinnedToRightSide = false;
+ m_mainFrameIsPinnedToTopSide = false;
+ m_mainFrameIsPinnedToBottomSide = false;
m_visibleScrollerThumbRect = IntRect();
@@ -2097,6 +2101,8 @@
// any wheel events and dispatch them to the WKView when necessary.
m_mainFrameIsPinnedToLeftSide = true;
m_mainFrameIsPinnedToRightSide = true;
+ m_mainFrameIsPinnedToTopSide = true;
+ m_mainFrameIsPinnedToBottomSide = true;
}
m_pageClient->didCommitLoadForMainFrame(frameHasCustomRepresentation);
}
@@ -3616,6 +3622,8 @@
m_mainFrameIsPinnedToLeftSide = false;
m_mainFrameIsPinnedToRightSide = false;
+ m_mainFrameIsPinnedToTopSide = false;
+ m_mainFrameIsPinnedToBottomSide = false;
m_visibleScrollerThumbRect = IntRect();
@@ -3864,10 +3872,12 @@
m_pageClient->didChangeScrollbarsForMainFrame();
}
-void WebPageProxy::didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide)
+void WebPageProxy::didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide, bool pinnedToTopSide, bool pinnedToBottomSide)
{
m_mainFrameIsPinnedToLeftSide = pinnedToLeftSide;
m_mainFrameIsPinnedToRightSide = pinnedToRightSide;
+ m_mainFrameIsPinnedToTopSide = pinnedToTopSide;
+ m_mainFrameIsPinnedToBottomSide = pinnedToBottomSide;
}
void WebPageProxy::didChangePageCount(unsigned pageCount)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (131216 => 131217)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2012-10-12 20:15:06 UTC (rev 131216)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2012-10-12 20:30:38 UTC (rev 131217)
@@ -496,6 +496,8 @@
bool isPinnedToLeftSide() const { return m_mainFrameIsPinnedToLeftSide; }
bool isPinnedToRightSide() const { return m_mainFrameIsPinnedToRightSide; }
+ bool isPinnedToTopSide() const { return m_mainFrameIsPinnedToTopSide; }
+ bool isPinnedToBottomSide() const { return m_mainFrameIsPinnedToBottomSide; }
void setPaginationMode(WebCore::Pagination::Mode);
WebCore::Pagination::Mode paginationMode() const { return m_paginationMode; }
@@ -836,7 +838,7 @@
void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&);
void recommendedScrollbarStyleDidChange(int32_t newStyle);
void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar);
- void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide);
+ void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide, bool pinnedToTopSide, bool pinnedToBottomSide);
void didChangePageCount(unsigned);
void didFailToInitializePlugin(const String& mimeType);
void didBlockInsecurePluginVersion(const String& mimeType, const String& urlString);
@@ -1196,6 +1198,8 @@
bool m_mainFrameIsPinnedToLeftSide;
bool m_mainFrameIsPinnedToRightSide;
+ bool m_mainFrameIsPinnedToTopSide;
+ bool m_mainFrameIsPinnedToBottomSide;
unsigned m_pageCount;
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (131216 => 131217)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2012-10-12 20:15:06 UTC (rev 131216)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2012-10-12 20:30:38 UTC (rev 131217)
@@ -63,7 +63,7 @@
NotifyScrollerThumbIsVisibleInRect(WebCore::IntRect scrollerThumb)
RecommendedScrollbarStyleDidChange(int32_t newStyle)
DidChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
- DidChangeScrollOffsetPinningForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
+ DidChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide, bool pinnedToTopSide, bool pinnedToBottomSide)
DidChangePageCount(unsigned pageCount);
DidFailToInitializePlugin(WTF::String mimeType)
DidBlockInsecurePluginVersion(WTF::String mimeType, WTF::String urlString)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (131216 => 131217)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-10-12 20:15:06 UTC (rev 131216)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-10-12 20:30:38 UTC (rev 131217)
@@ -247,6 +247,8 @@
, m_isRunningModal(false)
, m_cachedMainFrameIsPinnedToLeftSide(false)
, m_cachedMainFrameIsPinnedToRightSide(false)
+ , m_cachedMainFrameIsPinnedToTopSide(false)
+ , m_cachedMainFrameIsPinnedToBottomSide(false)
, m_canShortCircuitHorizontalWheelEvents(false)
, m_numWheelEventHandlers(0)
, m_cachedPageCount(0)
@@ -2640,12 +2642,16 @@
bool isPinnedToLeftSide = (scrollPosition.x() <= minimumScrollPosition.x());
bool isPinnedToRightSide = (scrollPosition.x() >= maximumScrollPosition.x());
+ bool isPinnedToTopSide = (scrollPosition.y() <= minimumScrollPosition.y());
+ bool isPinnedToBottomSide = (scrollPosition.y() >= maximumScrollPosition.y());
- if (isPinnedToLeftSide != m_cachedMainFrameIsPinnedToLeftSide || isPinnedToRightSide != m_cachedMainFrameIsPinnedToRightSide) {
- send(Messages::WebPageProxy::DidChangeScrollOffsetPinningForMainFrame(isPinnedToLeftSide, isPinnedToRightSide));
+ if (isPinnedToLeftSide != m_cachedMainFrameIsPinnedToLeftSide || isPinnedToRightSide != m_cachedMainFrameIsPinnedToRightSide || isPinnedToTopSide != m_cachedMainFrameIsPinnedToTopSide || isPinnedToBottomSide != m_cachedMainFrameIsPinnedToBottomSide) {
+ send(Messages::WebPageProxy::DidChangeScrollOffsetPinningForMainFrame(isPinnedToLeftSide, isPinnedToRightSide, isPinnedToTopSide, isPinnedToBottomSide));
m_cachedMainFrameIsPinnedToLeftSide = isPinnedToLeftSide;
m_cachedMainFrameIsPinnedToRightSide = isPinnedToRightSide;
+ m_cachedMainFrameIsPinnedToTopSide = isPinnedToTopSide;
+ m_cachedMainFrameIsPinnedToBottomSide = isPinnedToBottomSide;
}
}
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (131216 => 131217)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2012-10-12 20:15:06 UTC (rev 131216)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2012-10-12 20:30:38 UTC (rev 131217)
@@ -902,6 +902,8 @@
bool m_cachedMainFrameIsPinnedToLeftSide;
bool m_cachedMainFrameIsPinnedToRightSide;
+ bool m_cachedMainFrameIsPinnedToTopSide;
+ bool m_cachedMainFrameIsPinnedToBottomSide;
bool m_canShortCircuitHorizontalWheelEvents;
unsigned m_numWheelEventHandlers;