Diff
Modified: trunk/Source/WebKit2/ChangeLog (158025 => 158026)
--- trunk/Source/WebKit2/ChangeLog 2013-10-25 18:06:31 UTC (rev 158025)
+++ trunk/Source/WebKit2/ChangeLog 2013-10-25 18:20:25 UTC (rev 158026)
@@ -1,3 +1,38 @@
+2013-10-24 Gavin Barraclough <[email protected]>
+
+ Move ViewStateFlags out of WebPageProxy
+ https://bugs.webkit.org/show_bug.cgi?id=123323
+
+ Reviewed by Sam Weinig.
+
+ WebPageProxy contains an enum and typedef that provide a bitfield
+ of flags describing the visibility of the view containing the page.
+ We're going to want to use this bitfield in a message to the
+ WebProcess, so moving out from the UIProcess to shared code.
+ Creating struct 'ViewState' to scope the enum and typedef.
+ Renamed ViewStateFlags to ViewState::Flags, and removed redundant
+ 'View' from enum entries.
+
+ * Shared/ViewState.h: Added.
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView becomeFirstResponder]):
+ (-[WKView resignFirstResponder]):
+ (-[WKView viewDidMoveToWindow]):
+ (-[WKView _windowDidBecomeKey:]):
+ (-[WKView _windowDidResignKey:]):
+ (-[WKView _windowDidMiniaturize:]):
+ (-[WKView _windowDidDeminiaturize:]):
+ (-[WKView _windowDidOrderOffScreen:]):
+ (-[WKView _windowDidOrderOnScreen:]):
+ (-[WKView _windowDidChangeOcclusionState:]):
+ (-[WKView viewDidHide]):
+ (-[WKView viewDidUnhide]):
+ (-[WKView _activeSpaceDidChange:]):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::viewStateDidChange):
+ * UIProcess/WebPageProxy.h:
+ * WebKit2.xcodeproj/project.pbxproj:
+
2013-10-25 Sergio Villar Senin <[email protected]>
[GTK][WK2] Build break after r157967 and r157972
Added: trunk/Source/WebKit2/Shared/ViewState.h (0 => 158026)
--- trunk/Source/WebKit2/Shared/ViewState.h (rev 0)
+++ trunk/Source/WebKit2/Shared/ViewState.h 2013-10-25 18:20:25 UTC (rev 158026)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ViewState_h
+#define ViewState_h
+
+namespace WebKit {
+
+struct ViewState {
+ enum {
+ WindowIsActive = 1 << 0,
+ IsFocused = 1 << 1,
+ IsVisible = 1 << 2,
+ IsInWindow = 1 << 3,
+ WindowIsVisible = 1 << 4
+ };
+ typedef unsigned Flags;
+};
+
+} // namespace WebKit
+
+#endif // ViewState_h
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (158025 => 158026)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2013-10-25 18:06:31 UTC (rev 158025)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2013-10-25 18:20:25 UTC (rev 158026)
@@ -330,7 +330,7 @@
_data->_inBecomeFirstResponder = true;
[self _updateSecureInputState];
- _data->_page->viewStateDidChange(WebPageProxy::ViewIsFocused);
+ _data->_page->viewStateDidChange(ViewState::IsFocused);
_data->_inBecomeFirstResponder = false;
@@ -358,7 +358,7 @@
if (!_data->_page->maintainsInactiveSelection())
_data->_page->clearSelection();
- _data->_page->viewStateDidChange(WebPageProxy::ViewIsFocused);
+ _data->_page->viewStateDidChange(ViewState::IsFocused);
_data->_inResignFirstResponder = false;
@@ -1927,11 +1927,11 @@
_data->_windowHasValidBackingStore = NO;
[self doWindowDidChangeScreen];
- WebPageProxy::ViewStateFlags viewStateChanges = WebPageProxy::WindowIsVisible | WebPageProxy::ViewWindowIsActive | WebPageProxy::ViewIsVisible;
+ ViewState::Flags viewStateChanges = ViewState::WindowIsVisible | ViewState::WindowIsActive | ViewState::IsVisible;
if ([self isDeferringViewInWindowChanges])
_data->_viewInWindowChangeWasDeferred = YES;
else
- viewStateChanges |= WebPageProxy::ViewIsInWindow;
+ viewStateChanges |= ViewState::IsInWindow;
_data->_page->viewStateDidChange(viewStateChanges);
[self _updateWindowAndViewFrames];
@@ -1945,11 +1945,11 @@
[self _accessibilityRegisterUIProcessTokens];
} else {
- WebPageProxy::ViewStateFlags viewStateChanges = WebPageProxy::WindowIsVisible | WebPageProxy::ViewWindowIsActive | WebPageProxy::ViewIsVisible;
+ ViewState::Flags viewStateChanges = ViewState::WindowIsVisible | ViewState::WindowIsActive | ViewState::IsVisible;
if ([self isDeferringViewInWindowChanges])
_data->_viewInWindowChangeWasDeferred = YES;
else
- viewStateChanges |= WebPageProxy::ViewIsInWindow;
+ viewStateChanges |= ViewState::IsInWindow;
_data->_page->viewStateDidChange(viewStateChanges);
[NSEvent removeMonitor:_data->_flagsChangedEventMonitor];
@@ -1971,7 +1971,7 @@
NSWindow *keyWindow = [notification object];
if (keyWindow == [self window] || keyWindow == [[self window] attachedSheet]) {
[self _updateSecureInputState];
- _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive);
+ _data->_page->viewStateDidChange(ViewState::WindowIsActive);
}
}
@@ -1985,19 +1985,19 @@
NSWindow *formerKeyWindow = [notification object];
if (formerKeyWindow == [self window] || formerKeyWindow == [[self window] attachedSheet]) {
[self _updateSecureInputState];
- _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive);
+ _data->_page->viewStateDidChange(ViewState::WindowIsActive);
}
}
- (void)_windowDidMiniaturize:(NSNotification *)notification
{
_data->_windowHasValidBackingStore = NO;
- _data->_page->viewStateDidChange(WebPageProxy::WindowIsVisible);
+ _data->_page->viewStateDidChange(ViewState::WindowIsVisible);
}
- (void)_windowDidDeminiaturize:(NSNotification *)notification
{
- _data->_page->viewStateDidChange(WebPageProxy::WindowIsVisible);
+ _data->_page->viewStateDidChange(ViewState::WindowIsVisible);
}
- (void)_windowDidMove:(NSNotification *)notification
@@ -2014,12 +2014,12 @@
- (void)_windowDidOrderOffScreen:(NSNotification *)notification
{
- _data->_page->viewStateDidChange(WebPageProxy::WindowIsVisible | WebPageProxy::ViewIsVisible | WebPageProxy::ViewWindowIsActive);
+ _data->_page->viewStateDidChange(ViewState::WindowIsVisible | ViewState::IsVisible | ViewState::WindowIsActive);
}
- (void)_windowDidOrderOnScreen:(NSNotification *)notification
{
- _data->_page->viewStateDidChange(WebPageProxy::WindowIsVisible | WebPageProxy::ViewIsVisible | WebPageProxy::ViewWindowIsActive);
+ _data->_page->viewStateDidChange(ViewState::WindowIsVisible | ViewState::IsVisible | ViewState::WindowIsActive);
}
- (void)_windowDidChangeBackingProperties:(NSNotification *)notification
@@ -2036,7 +2036,7 @@
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
- (void)_windowDidChangeOcclusionState:(NSNotification *)notification
{
- _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
+ _data->_page->viewStateDidChange(ViewState::IsVisible);
}
#endif
@@ -2060,12 +2060,12 @@
- (void)viewDidHide
{
- _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
+ _data->_page->viewStateDidChange(ViewState::IsVisible);
}
- (void)viewDidUnhide
{
- _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
+ _data->_page->viewStateDidChange(ViewState::IsVisible);
}
- (void)viewDidChangeBackingProperties
@@ -2081,7 +2081,7 @@
- (void)_activeSpaceDidChange:(NSNotification *)notification
{
- _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
+ _data->_page->viewStateDidChange(ViewState::IsVisible);
}
- (void)_accessibilityRegisterUIProcessTokens
@@ -3157,7 +3157,7 @@
_data->_shouldDeferViewInWindowChanges = NO;
if (_data->_viewInWindowChangeWasDeferred) {
- _data->_page->viewInWindowStateDidChange();
+ _data->_page->viewStateDidChange(ViewState::IsInWindow);
_data->_viewInWindowChangeWasDeferred = NO;
}
}
@@ -3175,7 +3175,7 @@
_data->_shouldDeferViewInWindowChanges = NO;
if (_data->_viewInWindowChangeWasDeferred) {
- _data->_page->viewInWindowStateDidChange(hasPendingViewInWindowChange ? WebPageProxy::WantsReplyOrNot::DoesWantReply : WebPageProxy::WantsReplyOrNot::DoesNotWantReply);
+ _data->_page->viewStateDidChange(ViewState::IsInWindow, hasPendingViewInWindowChange ? WebPageProxy::WantsReplyOrNot::DoesWantReply : WebPageProxy::WantsReplyOrNot::DoesNotWantReply);
_data->_viewInWindowChangeWasDeferred = NO;
}
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (158025 => 158026)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-10-25 18:06:31 UTC (rev 158025)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-10-25 18:20:25 UTC (rev 158026)
@@ -964,52 +964,25 @@
m_pageClient->scrollView(scrollRect, scrollOffset);
}
-void WebPageProxy::viewInWindowStateDidChange(WantsReplyOrNot wantsReply)
+void WebPageProxy::viewStateDidChange(ViewState::Flags flags, WantsReplyOrNot wantsReply)
{
if (!isValid())
return;
- bool isInWindow = m_pageClient->isViewInWindow();
- if (m_isInWindow != isInWindow) {
- m_isInWindow = isInWindow;
- m_process->send(Messages::WebPage::SetIsInWindow(isInWindow, wantsReply == WantsReplyOrNot::DoesWantReply), m_pageID);
- }
-
- if (isInWindow) {
- LayerHostingMode layerHostingMode = m_pageClient->viewLayerHostingMode();
- if (m_layerHostingMode != layerHostingMode) {
- m_layerHostingMode = layerHostingMode;
- m_drawingArea->layerHostingModeDidChange();
- }
- }
-#if ENABLE(INPUT_TYPE_COLOR_POPOVER)
- else {
- // When leaving the current page, close the popover color well.
- if (m_colorPicker)
- endColorPicker();
- }
-#endif
-}
-
-void WebPageProxy::viewStateDidChange(ViewStateFlags flags)
-{
- if (!isValid())
- return;
-
- if (flags & WindowIsVisible)
+ if (flags & ViewState::WindowIsVisible)
process()->send(Messages::WebPage::SetWindowIsVisible(m_pageClient->isWindowVisible()), m_pageID);
- if (flags & ViewIsFocused)
+ if (flags & ViewState::IsFocused)
m_process->send(Messages::WebPage::SetFocused(m_pageClient->isViewFocused()), m_pageID);
// We want to make sure to update the active state while hidden, so if the view is hidden then update the active state
// early (in case it becomes visible), and if the view was visible then update active state later (in case it hides).
bool viewWasVisible = m_isVisible;
- if (flags & ViewWindowIsActive && !viewWasVisible)
+ if (flags & ViewState::WindowIsActive && !viewWasVisible)
m_process->send(Messages::WebPage::SetActive(m_pageClient->isViewWindowActive()), m_pageID);
- if (flags & ViewIsVisible) {
+ if (flags & ViewState::IsVisible) {
bool isVisible = m_pageClient->isViewVisible();
if (isVisible != m_isVisible) {
m_isVisible = isVisible;
@@ -1030,12 +1003,32 @@
}
}
- if (flags & ViewWindowIsActive && viewWasVisible)
+ if (flags & ViewState::WindowIsActive && viewWasVisible)
m_process->send(Messages::WebPage::SetActive(m_pageClient->isViewWindowActive()), m_pageID);
- if (flags & ViewIsInWindow)
- viewInWindowStateDidChange();
+ if (flags & ViewState::IsInWindow) {
+ bool isInWindow = m_pageClient->isViewInWindow();
+ if (m_isInWindow != isInWindow) {
+ m_isInWindow = isInWindow;
+ m_process->send(Messages::WebPage::SetIsInWindow(isInWindow, wantsReply == WantsReplyOrNot::DoesWantReply), m_pageID);
+ }
+ if (isInWindow) {
+ LayerHostingMode layerHostingMode = m_pageClient->viewLayerHostingMode();
+ if (m_layerHostingMode != layerHostingMode) {
+ m_layerHostingMode = layerHostingMode;
+ m_drawingArea->layerHostingModeDidChange();
+ }
+ }
+#if ENABLE(INPUT_TYPE_COLOR_POPOVER)
+ else {
+ // When leaving the current page, close the popover color well.
+ if (m_colorPicker)
+ endColorPicker();
+ }
+#endif
+ }
+
#if ENABLE(PAGE_VISIBILITY_API)
PageVisibilityState visibilityState = PageVisibilityStateHidden;
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (158025 => 158026)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2013-10-25 18:06:31 UTC (rev 158025)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2013-10-25 18:20:25 UTC (rev 158026)
@@ -37,6 +37,7 @@
#include "PlatformProcessIdentifier.h"
#include "SandboxExtension.h"
#include "ShareableBitmap.h"
+#include "ViewState.h"
#include "WKBase.h"
#include "WKPagePrivate.h"
#include "WebColorPicker.h"
@@ -323,17 +324,8 @@
bool canScrollView();
void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
- enum {
- ViewWindowIsActive = 1 << 0,
- ViewIsFocused = 1 << 1,
- ViewIsVisible = 1 << 2,
- ViewIsInWindow = 1 << 3,
- WindowIsVisible = 1 << 4
- };
- typedef unsigned ViewStateFlags;
- void viewStateDidChange(ViewStateFlags flags);
enum class WantsReplyOrNot { DoesNotWantReply, DoesWantReply };
- void viewInWindowStateDidChange(WantsReplyOrNot = WantsReplyOrNot::DoesNotWantReply);
+ void viewStateDidChange(ViewState::Flags, WantsReplyOrNot = WantsReplyOrNot::DoesNotWantReply);
bool isInWindow() const { return m_isInWindow; }
void waitForDidUpdateInWindowState();
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (158025 => 158026)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2013-10-25 18:06:31 UTC (rev 158025)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2013-10-25 18:20:25 UTC (rev 158026)
@@ -656,6 +656,7 @@
7CF47FFE17276AE3008ACB91 /* WKBundlePageBannerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CF47FFC17276AE3008ACB91 /* WKBundlePageBannerMac.mm */; };
7CF47FFF17276AE3008ACB91 /* WKBundlePageBannerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CF47FFD17276AE3008ACB91 /* WKBundlePageBannerMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
84477853176FCC0800CDC7BB /* InjectedBundleHitTestResultMediaType.h in Headers */ = {isa = PBXBuildFile; fileRef = 84477851176FCAC100CDC7BB /* InjectedBundleHitTestResultMediaType.h */; };
+ 865E0485181A094A001F72F2 /* ViewState.h in Headers */ = {isa = PBXBuildFile; fileRef = 865E0484181A090D001F72F2 /* ViewState.h */; };
8CFECE941490F140002AAA32 /* EditorState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8CFECE931490F140002AAA32 /* EditorState.cpp */; };
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
909854EC12BC4E17000AD080 /* WebMemorySampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 905620E812BC248B000799B6 /* WebMemorySampler.cpp */; };
@@ -2157,6 +2158,7 @@
7CF47FFC17276AE3008ACB91 /* WKBundlePageBannerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKBundlePageBannerMac.mm; sourceTree = "<group>"; };
7CF47FFD17276AE3008ACB91 /* WKBundlePageBannerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundlePageBannerMac.h; sourceTree = "<group>"; };
84477851176FCAC100CDC7BB /* InjectedBundleHitTestResultMediaType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleHitTestResultMediaType.h; sourceTree = "<group>"; };
+ 865E0484181A090D001F72F2 /* ViewState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewState.h; sourceTree = "<group>"; };
8CFECE931490F140002AAA32 /* EditorState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EditorState.cpp; sourceTree = "<group>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* WebKit2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WebKit2.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -3330,6 +3332,7 @@
1A64245D12DE29A100CAAE2C /* UpdateInfo.cpp */,
1A64245C12DE29A100CAAE2C /* UpdateInfo.h */,
BCB0B0DF12305AB100B1341E /* UserMessageCoders.h */,
+ 865E0484181A090D001F72F2 /* ViewState.h */,
1A0F29C9120B37160053D1B9 /* VisitedLinkTable.cpp */,
1A0F29CA120B37160053D1B9 /* VisitedLinkTable.h */,
BC329D9916ACCE9900316DE2 /* WebArchive.cpp */,
@@ -5396,6 +5399,7 @@
CDC3830C17212282008A2FC3 /* CookieStorageShimLibrary.h in Headers */,
B878B615133428DC006888E9 /* CorrectionPanel.h in Headers */,
2989A414167D184B004F96D2 /* CustomProtocolManager.h in Headers */,
+ 865E0485181A094A001F72F2 /* ViewState.h in Headers */,
2984F589164BA095004BC0C6 /* CustomProtocolManagerMessages.h in Headers */,
29AD3093164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h in Headers */,
2984F57D164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h in Headers */,