[mac] No API for getting the page visibility state of a WebView
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Jul 2013 22:33:11 +0000 (22:33 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Jul 2013 22:33:11 +0000 (22:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=118578

Reviewed by Simon Fraser.

Source/WebCore:

* WebCore.exp.in: Export WebCore::Page::visibilityState().

Source/WebKit/mac:

* WebView/WebView.mm:
(kit): Added. Converts from WebCore::PageVisibilityState to WebPageVisibilityState.
(-[WebView _visibilityState]): Added.
* WebView/WebViewPrivate.h: Declared -_visibilityState.

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

Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/mac/WebView/WebViewPrivate.h

index 28f25e1..2efce3d 100644 (file)
@@ -1,3 +1,12 @@
+2013-07-11  Dan Bernstein  <mitz@apple.com>
+
+        [mac] No API for getting the page visibility state of a WebView
+        https://bugs.webkit.org/show_bug.cgi?id=118578
+
+        Reviewed by Simon Fraser.
+
+        * WebCore.exp.in: Export WebCore::Page::visibilityState().
+
 2013-07-11  Mario Sanchez Prada  <mario.prada@samsung.com>
 
         [GTK] Layout Test accessibility/deleting-iframe-destroys-axcache.html, platform/gtk/accessibility/replaced-objects-in-anonymous-blocks.html are failing
index 5f94ec5..939ce44 100644 (file)
@@ -1565,6 +1565,7 @@ __ZNK7WebCore4Node9textRectsERN3WTF6VectorINS_7IntRectELm0ENS1_15CrashOnOverflow
 __ZNK7WebCore4Page10pluginDataEv
 __ZNK7WebCore4Page14renderTreeSizeEv
 __ZNK7WebCore4Page15backForwardListEv
+__ZNK7WebCore4Page15visibilityStateEv
 __ZNK7WebCore4Page16hasSeenAnyPluginEv
 __ZNK7WebCore4Page17viewportArgumentsEv
 __ZNK7WebCore4Page34inLowQualityImageInterpolationModeEv
index eb5980b..0f33572 100644 (file)
@@ -1,3 +1,15 @@
+2013-07-11  Dan Bernstein  <mitz@apple.com>
+
+        [mac] No API for getting the page visibility state of a WebView
+        https://bugs.webkit.org/show_bug.cgi?id=118578
+
+        Reviewed by Simon Fraser.
+
+        * WebView/WebView.mm:
+        (kit): Added. Converts from WebCore::PageVisibilityState to WebPageVisibilityState.
+        (-[WebView _visibilityState]): Added.
+        * WebView/WebViewPrivate.h: Declared -_visibilityState.
+
 2013-07-11  Timothy Hatcher  <timothy@apple.com>
 
         Revert r152267 and soft link WebInspectorUI.framework again.
index 759670b..3e62adb 100644 (file)
@@ -430,6 +430,23 @@ static PageVisibilityState core(WebPageVisibilityState visibilityState)
     return PageVisibilityStateVisible;
 }
 
+static WebPageVisibilityState kit(PageVisibilityState visibilityState)
+{
+    switch (visibilityState) {
+    case PageVisibilityStateVisible:
+        return WebPageVisibilityStateVisible;
+    case PageVisibilityStateHidden:
+        return WebPageVisibilityStateHidden;
+    case PageVisibilityStatePrerender:
+        return WebPageVisibilityStatePrerender;
+    case PageVisibilityStateUnloaded:
+        return WebPageVisibilityStateUnloaded;
+    }
+
+    ASSERT_NOT_REACHED();
+    return WebPageVisibilityStateVisible;
+}
+
 @interface WebView (WebFileInternal)
 - (float)_deviceScaleFactor;
 - (BOOL)_isLoading;
@@ -2951,6 +2968,15 @@ static Vector<String> toStringVector(NSArray* patterns)
     return kitLayoutMilestones(page->requestedLayoutMilestones());
 }
 
+- (WebPageVisibilityState)_visibilityState
+{
+#if ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
+    if (_private->page)
+        return kit(_private->page->visibilityState());
+#endif
+    return WebPageVisibilityStateVisible;
+}
+
 - (void)_setVisibilityState:(WebPageVisibilityState)visibilityState isInitialState:(BOOL)isInitialState
 {
 #if ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
index a3d8e06..4d71b16 100644 (file)
@@ -584,6 +584,7 @@ Could be worth adding to the API.
 - (void)_listenForLayoutMilestones:(WebLayoutMilestones)layoutMilestones;
 - (WebLayoutMilestones)_layoutMilestones;
 
+- (WebPageVisibilityState)_visibilityState;
 - (void)_setVisibilityState:(WebPageVisibilityState)visibilityState isInitialState:(BOOL)isInitialState;
 
 // Whether the column-break-{before,after} properties are respected instead of the