Commit 2f3625cd authored by barraclough@apple.com's avatar barraclough@apple.com

Source/WebCore: [iOS] Tapping any link crashes in WebCore::EventHandler::mouseMoved()

(also crashes when scrolling certain sites)
https://bugs.webkit.org/show_bug.cgi?id=126401
<rdar://problem/15739334>

Patch by Daniel Bates <dabates@apple.com> on 2014-01-02
Reviewed by Tim Horton.

* page/ios/EventHandlerIOS.mm:
(WebCore::currentEventSlot): Make the shared variable have static-storage duration.

Source/WebKit/mac: Remove WindowIsVisible
https://bugs.webkit.org/show_bug.cgi?id=126270

Reviewed by Tim Horton.

We currently track visibility in two ways - ViewState::IsVisible and ViewState::WindowIsVisible.
The latter detects that the content is hidden in fewer cases than the former, and as such, the
former is always preferable.

This affects the hidden state provided to FocusController::contentAreaDidShowOrHide and to
Plugin::windowVisibilityChanged.

* WebView/WebView.mm:
(-[WebView _windowWillOrderOnScreen:]):
(-[WebView _windowWillOrderOffScreen:]):
    - rename ContainingWindowIsVisible -> ContentIsVisible.

Source/WebKit2: Remove WindowIsVisible
https://bugs.webkit.org/show_bug.cgi?id=126270

Reviewed by Tim Horton.

We currently track visibility in two ways - ViewState::IsVisible and ViewState::WindowIsVisible.
The latter detects that the content is hidden in fewer cases than the former, and as such, the
former is always preferable.

This affects the hidden state provided to FocusController::contentAreaDidShowOrHide and to
Plugin::windowVisibilityChanged.

* Shared/ViewState.h:
    - remove WindowIsVisible.
* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
    - remove isWindowVisible.
* UIProcess/API/mac/WKView.mm:
(-[WKView viewDidMoveToWindow]):
(-[WKView _windowDidMiniaturize:]):
(-[WKView _windowDidDeminiaturize:]):
(-[WKView _windowDidOrderOffScreen:]):
(-[WKView _windowDidOrderOnScreen:]):
    - remove ViewState::WindowIsVisible.
* UIProcess/PageClient.h:
    - remove isWindowVisible.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateViewState):
    - remove handling of ViewState::WindowIsVisible.
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::setIsVisible):
(WebKit::PluginView::didInitializePlugin):
* WebProcess/Plugins/PluginView.h:
    - setWindowIsVisible -> setIsVisible.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::setViewIsVisible):
(WebKit::WebPage::setViewState):
(WebKit::WebPage::windowAndWebPageAreFocused):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::isVisible):
    - remove m_windowIsVisible, setWindowIsVisible (implementation moved to setViewIsVisible).



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161228 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3168e38f
......@@ -10,6 +10,27 @@
* page/ios/EventHandlerIOS.mm:
(WebCore::currentEventSlot): Make the shared variable have static-storage duration.
2014-01-02 Gavin Barraclough <barraclough@apple.com>
Remove WindowIsVisible
https://bugs.webkit.org/show_bug.cgi?id=126270
Reviewed by Tim Horton.
We currently track visibility in two ways - ViewState::IsVisible and ViewState::WindowIsVisible.
The latter detects that the content is hidden in fewer cases than the former, and as such, the
former is always preferable.
This affects the hidden state provided to FocusController::contentAreaDidShowOrHide and to
Plugin::windowVisibilityChanged.
* WebCore.exp.in:
* page/FocusController.cpp:
(WebCore::FocusController::FocusController):
(WebCore::FocusController::setContentIsVisible):
* page/FocusController.h:
- rename ContainingWindowIsVisible -> ContentIsVisible.
2014-01-02 Gavin Barraclough <barraclough@apple.com>
Merge didMoveOnscreen / page visibility to isVisible
......@@ -482,7 +482,7 @@ __ZN7WebCore15FocusController10setFocusedEb
__ZN7WebCore15FocusController15setFocusedFrameEN3WTF10PassRefPtrINS_5FrameEEE
__ZN7WebCore15FocusController15setInitialFocusENS_14FocusDirectionEPNS_13KeyboardEventE
__ZN7WebCore15FocusController17setFocusedElementEPNS_7ElementEN3WTF10PassRefPtrINS_5FrameEEENS_14FocusDirectionE
__ZN7WebCore15FocusController28setContainingWindowIsVisibleEb
__ZN7WebCore15FocusController19setContentIsVisibleEb
__ZN7WebCore15FocusController9setActiveEb
__ZN7WebCore15GraphicsContext10strokeRectERKNS_9FloatRectEf
__ZN7WebCore15GraphicsContext11clearShadowEv
......
......@@ -163,7 +163,7 @@ FocusController::FocusController(Page& page)
, m_isActive(false)
, m_isFocused(false)
, m_isChangingFocusedFrame(false)
, m_containingWindowIsVisible(false)
, m_contentIsVisible(false)
{
}
......@@ -663,18 +663,18 @@ static void contentAreaDidShowOrHide(ScrollableArea* scrollableArea, bool didSho
scrollableArea->contentAreaDidHide();
}
void FocusController::setContainingWindowIsVisible(bool containingWindowIsVisible)
void FocusController::setContentIsVisible(bool contentIsVisible)
{
if (m_containingWindowIsVisible == containingWindowIsVisible)
if (m_contentIsVisible == contentIsVisible)
return;
m_containingWindowIsVisible = containingWindowIsVisible;
m_contentIsVisible = contentIsVisible;
FrameView* view = m_page.mainFrame().view();
if (!view)
return;
contentAreaDidShowOrHide(view, containingWindowIsVisible);
contentAreaDidShowOrHide(view, contentIsVisible);
for (Frame* frame = &m_page.mainFrame(); frame; frame = frame->tree().traverseNext()) {
FrameView* frameView = frame->view();
......@@ -689,7 +689,7 @@ void FocusController::setContainingWindowIsVisible(bool containingWindowIsVisibl
ScrollableArea* scrollableArea = *it;
ASSERT(scrollableArea->scrollbarsCanBeActive() || m_page.shouldSuppressScrollbarAnimations());
contentAreaDidShowOrHide(scrollableArea, containingWindowIsVisible);
contentAreaDidShowOrHide(scrollableArea, contentIsVisible);
}
}
}
......
......@@ -79,8 +79,7 @@ public:
void setFocused(bool);
bool isFocused() const { return m_isFocused; }
void setContainingWindowIsVisible(bool);
bool containingWindowIsVisible() const { return m_containingWindowIsVisible; }
void setContentIsVisible(bool);
// These methods are used in WebCore/bindings/objc/DOM.mm.
Element* nextFocusableElement(FocusNavigationScope, Node* start, KeyboardEvent*);
......@@ -115,7 +114,7 @@ private:
bool m_isActive;
bool m_isFocused;
bool m_isChangingFocusedFrame;
bool m_containingWindowIsVisible;
bool m_contentIsVisible;
};
......
2014-01-02 Gavin Barraclough <barraclough@apple.com>
Remove WindowIsVisible
https://bugs.webkit.org/show_bug.cgi?id=126270
Reviewed by Tim Horton.
We currently track visibility in two ways - ViewState::IsVisible and ViewState::WindowIsVisible.
The latter detects that the content is hidden in fewer cases than the former, and as such, the
former is always preferable.
This affects the hidden state provided to FocusController::contentAreaDidShowOrHide and to
Plugin::windowVisibilityChanged.
* WebView/WebView.mm:
(-[WebView _windowWillOrderOnScreen:]):
(-[WebView _windowWillOrderOffScreen:]):
- rename ContainingWindowIsVisible -> ContentIsVisible.
2014-01-02 Gavin Barraclough <barraclough@apple.com>
Merge didMoveOnscreen / page visibility to isVisible
......
......@@ -5337,7 +5337,7 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
if (_private && _private->page) {
_private->page->resumeScriptedAnimations();
_private->page->focusController().setContainingWindowIsVisible(true);
_private->page->focusController().setContentIsVisible(true);
}
}
......@@ -5350,7 +5350,7 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
{
if (_private && _private->page) {
_private->page->suspendScriptedAnimations();
_private->page->focusController().setContainingWindowIsVisible(false);
_private->page->focusController().setContentIsVisible(false);
}
}
......
2014-01-02 Gavin Barraclough <barraclough@apple.com>
Remove WindowIsVisible
https://bugs.webkit.org/show_bug.cgi?id=126270
Reviewed by Tim Horton.
We currently track visibility in two ways - ViewState::IsVisible and ViewState::WindowIsVisible.
The latter detects that the content is hidden in fewer cases than the former, and as such, the
former is always preferable.
This affects the hidden state provided to FocusController::contentAreaDidShowOrHide and to
Plugin::windowVisibilityChanged.
* Shared/ViewState.h:
- remove WindowIsVisible.
* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
- remove isWindowVisible.
* UIProcess/API/mac/WKView.mm:
(-[WKView viewDidMoveToWindow]):
(-[WKView _windowDidMiniaturize:]):
(-[WKView _windowDidDeminiaturize:]):
(-[WKView _windowDidOrderOffScreen:]):
(-[WKView _windowDidOrderOnScreen:]):
- remove ViewState::WindowIsVisible.
* UIProcess/PageClient.h:
- remove isWindowVisible.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateViewState):
- remove handling of ViewState::WindowIsVisible.
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::setIsVisible):
(WebKit::PluginView::didInitializePlugin):
* WebProcess/Plugins/PluginView.h:
- setWindowIsVisible -> setIsVisible.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::setViewIsVisible):
(WebKit::WebPage::setViewState):
(WebKit::WebPage::windowAndWebPageAreFocused):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::isVisible):
- remove m_windowIsVisible, setWindowIsVisible (implementation moved to setViewIsVisible).
2014-01-02 Gavin Barraclough <barraclough@apple.com>
Refactor ViewState handling for drawing area / plugins
......
......@@ -34,14 +34,13 @@ struct ViewState {
IsFocused = 1 << 1,
IsVisible = 1 << 2,
IsInWindow = 1 << 3,
WindowIsVisible = 1 << 4,
IsLayerWindowServerHosted = 1 << 5
IsLayerWindowServerHosted = 1 << 4
};
typedef unsigned Flags;
static const Flags NoFlags = 0;
static const Flags AllFlags = WindowIsActive | IsFocused | IsVisible | IsInWindow | WindowIsVisible | IsLayerWindowServerHosted;
static const Flags AllFlags = WindowIsActive | IsFocused | IsVisible | IsInWindow | IsLayerWindowServerHosted;
};
} // namespace WebKit
......
......@@ -279,11 +279,6 @@ void PageClientImpl::handleDownloadRequest(DownloadProxy* download)
webkitWebViewBaseHandleDownloadRequest(WEBKIT_WEB_VIEW_BASE(m_viewWidget), download);
}
bool PageClientImpl::isWindowVisible()
{
return webkitWebViewBaseIsWindowVisible(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
}
void PageClientImpl::didCommitLoadForMainFrame()
{
webkitWebViewBaseResetClickCounter(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
......
......@@ -96,7 +96,6 @@ private:
virtual void getEditorCommandsForKeyEvent(const NativeWebKeyboardEvent&, const AtomicString&, Vector<WTF::String>&) OVERRIDE;
virtual void updateTextInputState() OVERRIDE;
virtual void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage) OVERRIDE;
virtual bool isWindowVisible() OVERRIDE;
#if USE(ACCELERATED_COMPOSITING)
virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) OVERRIDE;
......
......@@ -196,7 +196,7 @@ static gboolean toplevelWindowVisibilityEvent(GtkWidget*, GdkEventVisibility* vi
bool isWindowVisible = visibilityEvent->state != GDK_VISIBILITY_FULLY_OBSCURED;
if (priv->isWindowVisible != isWindowVisible) {
priv->isWindowVisible = isWindowVisible;
priv->pageProxy->viewStateDidChange(ViewState::WindowIsVisible);
priv->pageProxy->viewStateDidChange(ViewState::IsVisible);
}
return FALSE;
......
......@@ -54,7 +54,6 @@ private:
virtual bool isViewWindowActive() OVERRIDE;
virtual bool isViewFocused() OVERRIDE;
virtual bool isViewVisible() OVERRIDE;
virtual bool isWindowVisible() OVERRIDE;
virtual bool isViewInWindow() OVERRIDE;
virtual void processDidCrash() OVERRIDE;
virtual void didRelaunchProcess() OVERRIDE;
......
......@@ -103,12 +103,6 @@ bool PageClientImpl::isViewVisible()
return true;
}
bool PageClientImpl::isWindowVisible()
{
notImplemented();
return true;
}
bool PageClientImpl::isViewInWindow()
{
return [m_view window];
......
......@@ -64,7 +64,6 @@ private:
virtual bool isViewWindowActive();
virtual bool isViewFocused();
virtual bool isViewVisible();
virtual bool isWindowVisible();
virtual bool isViewInWindow();
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
virtual bool isLayerWindowServerHosted();
......
......@@ -209,11 +209,6 @@ bool PageClientImpl::isViewVisible()
return true;
}
bool PageClientImpl::isWindowVisible()
{
return [[m_wkView window] isVisible];
}
bool PageClientImpl::isViewInWindow()
{
return [m_wkView window];
......
......@@ -1882,7 +1882,7 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
_data->_windowHasValidBackingStore = NO;
[self doWindowDidChangeScreen];
ViewState::Flags viewStateChanges = ViewState::WindowIsVisible | ViewState::WindowIsActive | ViewState::IsVisible;
ViewState::Flags viewStateChanges = ViewState::WindowIsActive | ViewState::IsVisible;
if ([self isDeferringViewInWindowChanges])
_data->_viewInWindowChangeWasDeferred = YES;
else
......@@ -1900,7 +1900,7 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
[self _accessibilityRegisterUIProcessTokens];
} else {
ViewState::Flags viewStateChanges = ViewState::WindowIsVisible | ViewState::WindowIsActive | ViewState::IsVisible;
ViewState::Flags viewStateChanges = ViewState::WindowIsActive | ViewState::IsVisible;
if ([self isDeferringViewInWindowChanges])
_data->_viewInWindowChangeWasDeferred = YES;
else
......@@ -1947,12 +1947,12 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
- (void)_windowDidMiniaturize:(NSNotification *)notification
{
_data->_windowHasValidBackingStore = NO;
_data->_page->viewStateDidChange(ViewState::WindowIsVisible);
_data->_page->viewStateDidChange(ViewState::IsVisible);
}
- (void)_windowDidDeminiaturize:(NSNotification *)notification
{
_data->_page->viewStateDidChange(ViewState::WindowIsVisible);
_data->_page->viewStateDidChange(ViewState::IsVisible);
}
- (void)_windowDidMove:(NSNotification *)notification
......@@ -1969,12 +1969,12 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
- (void)_windowDidOrderOffScreen:(NSNotification *)notification
{
_data->_page->viewStateDidChange(ViewState::WindowIsVisible | ViewState::IsVisible | ViewState::WindowIsActive);
_data->_page->viewStateDidChange(ViewState::IsVisible | ViewState::WindowIsActive);
}
- (void)_windowDidOrderOnScreen:(NSNotification *)notification
{
_data->_page->viewStateDidChange(ViewState::WindowIsVisible | ViewState::IsVisible | ViewState::WindowIsActive);
_data->_page->viewStateDidChange(ViewState::IsVisible | ViewState::WindowIsActive);
}
- (void)_windowDidChangeBackingProperties:(NSNotification *)notification
......
......@@ -340,12 +340,6 @@ bool WebView::isViewVisible()
return isVisible();
}
bool WebView::isWindowVisible()
{
notImplemented();
return true;
}
bool WebView::isViewInWindow()
{
notImplemented();
......
......@@ -140,7 +140,6 @@ protected:
virtual bool isViewWindowActive() OVERRIDE;
virtual bool isViewFocused() OVERRIDE;
virtual bool isViewVisible() OVERRIDE;
virtual bool isWindowVisible() OVERRIDE;
virtual bool isViewInWindow() OVERRIDE;
virtual void processDidCrash() OVERRIDE;
......
......@@ -105,9 +105,6 @@ public:
// Return whether the view is visible.
virtual bool isViewVisible() = 0;
// Return whether the window is visible.
virtual bool isWindowVisible() = 0;
// Return whether the view is in a window.
virtual bool isViewInWindow() = 0;
......
......@@ -921,8 +921,6 @@ void WebPageProxy::scrollView(const IntRect& scrollRect, const IntSize& scrollOf
void WebPageProxy::updateViewState(ViewState::Flags flagsToUpdate)
{
m_viewState &= ~flagsToUpdate;
if (flagsToUpdate & ViewState::WindowIsVisible && m_pageClient.isWindowVisible())
m_viewState |= ViewState::WindowIsVisible;
if (flagsToUpdate & ViewState::IsFocused && m_pageClient.isViewFocused())
m_viewState |= ViewState::IsFocused;
if (flagsToUpdate & ViewState::WindowIsActive && m_pageClient.isViewWindowActive())
......
......@@ -501,8 +501,8 @@ void PluginView::platformViewStateDidChange(ViewState::Flags changed)
return;
}
if (changed & ViewState::WindowIsVisible)
m_plugin->windowVisibilityChanged(m_webPage->windowIsVisible());
if (changed & ViewState::IsVisible)
m_plugin->windowVisibilityChanged(m_webPage->isVisible());
if (changed & ViewState::WindowIsActive)
m_plugin->windowFocusChanged(m_webPage->windowIsFocused());
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
......@@ -624,7 +624,7 @@ void PluginView::didInitializePlugin()
m_pluginElement->dispatchPendingMouseClick();
}
m_plugin->windowVisibilityChanged(m_webPage->windowIsVisible());
m_plugin->windowVisibilityChanged(m_webPage->isVisible());
m_plugin->windowFocusChanged(m_webPage->windowIsFocused());
#endif
......
......@@ -235,7 +235,6 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
, m_artificialPluginInitializationDelayEnabled(false)
, m_scrollingPerformanceLoggingEnabled(false)
, m_mainFrameIsScrollable(true)
, m_windowIsVisible(false)
#if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
, m_readyToFindPrimarySnapshottedPlugin(false)
, m_didFindPrimarySnapshottedPlugin(false)
......@@ -1916,6 +1915,8 @@ void WebPage::setActive(bool isActive)
void WebPage::setViewIsVisible(bool isVisible)
{
corePage()->focusController().setContentIsVisible(isVisible);
m_page->setIsVisible(m_viewState & ViewState::IsVisible, false);
}
......@@ -2069,8 +2070,6 @@ void WebPage::setViewState(ViewState::Flags viewState, bool wantsDidUpdateViewSt
// 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).
if (changed & ViewState::WindowIsVisible)
setWindowIsVisible(viewState & ViewState::WindowIsVisible);
if (changed & ViewState::IsFocused)
setFocused(viewState & ViewState::IsFocused);
if (changed & ViewState::WindowIsActive && !(m_viewState & ViewState::IsVisible))
......@@ -3037,13 +3036,6 @@ void WebPage::sendSetWindowFrame(const FloatRect& windowFrame)
send(Messages::WebPageProxy::SetWindowFrame(windowFrame));
}
void WebPage::setWindowIsVisible(bool windowIsVisible)
{
m_windowIsVisible = windowIsVisible;
corePage()->focusController().setContainingWindowIsVisible(windowIsVisible);
}
#if PLATFORM(MAC)
void WebPage::windowAndViewFramesChanged(const FloatRect& windowFrameInScreenCoordinates, const FloatRect& windowFrameInUnflippedScreenCoordinates, const FloatRect& viewFrameInWindowCoordinates, const FloatPoint& accessibilityViewCoordinates)
{
......@@ -3084,7 +3076,7 @@ bool WebPage::windowIsFocused() const
bool WebPage::windowAndWebPageAreFocused() const
{
if (!m_windowIsVisible)
if (!isVisible())
return false;
return m_page->focusController().isFocused() && m_page->focusController().isActive();
......
......@@ -346,7 +346,6 @@ public:
void addPluginView(PluginView*);
void removePluginView(PluginView*);
bool windowIsVisible() const { return m_windowIsVisible; }
bool isVisible() const { return m_viewState & ViewState::IsVisible; }
#if PLATFORM(MAC)
......@@ -729,7 +728,6 @@ private:
void setActive(bool);
void setFocused(bool);
void setViewIsVisible(bool);
void setWindowIsVisible(bool);
void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
void setWindowResizerSize(const WebCore::IntSize&);
void setIsInWindow(bool);
......@@ -904,9 +902,6 @@ private:
bool m_mainFrameIsScrollable;
// Whether the containing window is visible or not.
bool m_windowIsVisible;
#if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
bool m_readyToFindPrimarySnapshottedPlugin;
bool m_didFindPrimarySnapshottedPlugin;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment