Simplify process suppression state calculation
https://bugs.webkit.org/show_bug.cgi?id=126473

Reviewed by Geoffrey Garen & Sam Weinig.

Don't check the application occlusion state (this is covered by the pages already),
and let the page check visually idle. Remove layers of functions.

* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didFinishLaunching):
    - Let the network process nap if all processes in its context are napping.*
      (* Except not really. We currently leak a boost onto the process anyway.)
* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::didFinishLaunching):
    - Let the plugin process nap if all processes in all contexts are napping.
* UIProcess/WebContext.h:
    - Remove canEnableProcessSuppressionForNetworkProcess & canEnableProcessSuppressionForWebProcess
    - canEnableProcessSuppressionForGlobalChildProcesses -> processSuppressionIsEnabledForAllContexts
    - combine updateProcessSuppressionStateOfChildProcesses & updateProcessSuppressionStateOfGlobalChildProcesses
        -> updateProcessSuppressionState
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::isProcessSuppressible):
    - WebProcess is supressible if IsVisuallyIdle.
(WebKit::WebPageProxy::viewStateDidChange):
    - WebProcessProxy should updateProcessSuppressionState when IsVisuallyIdle changes.
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::createWebPage):
(WebKit::WebProcessProxy::addExistingWebPage):
(WebKit::WebProcessProxy::pageSuppressibilityChanged):
(WebKit::WebProcessProxy::pagePreferencesChanged):
    - pageIsProcessSuppressible -> isProcessSuppressible
* UIProcess/WebProcessProxy.h:
* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::updateProcessSuppressionState):
    - Update supression state of network & plugin processes.
(WebKit::WebContext::processSuppressionIsEnabledForAllContexts):
    - Changed iterator style, made a static member of WebContext.
* UIProcess/mac/WebProcessProxyMac.mm:
(WebKit::WebProcessProxy::updateProcessSuppressionState):
    - Ask the WebContext to update supression state.
* UIProcess/mac/WindowServerConnection.h:
* UIProcess/mac/WindowServerConnection.mm:
(WebKit::WindowServerConnection::windowServerConnectionStateChanged):
(WebKit::WindowServerConnection::WindowServerConnection):
    - Remove application occlusion state.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161301 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed build fix on non-Mac port

* Shared/API/c/WKDeprecatedFunctions.cpp: Add ENABLE(MAC) guard for "WKContextPrivateMac.h".

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161302 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Simplify ScrollingStateNode references to various layer types
https://bugs.webkit.org/show_bug.cgi?id=126477

Reviewed by Tim Horton.

ScrollingStateNodes referenced both GraphicsLayer and PlatformLayers, in
confusing ways. In the main thread they have a GraphicsLayer*, but need
to check to see if the underlying PlatformLayer changed. Then, when
cloned to commit to the scrolling thread, they drop the GraphicsLayer
and store a PlatformLayer.

Hide the complexity (and prepare for the future) by adding LayerRepresentation,
which wraps various different flavors of layers, and knows how to check whether
the PlatformLayer underlying a GraphicsLayer changed.

ScrollingStateNode layer setters then just take and compare LayerRepresentations.
Copy constructors convert to a PlatformLayer representation (though not really
in the right place currently), and ScrollingTreeNodes get PlatformLayers.

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::updateScrollingNode):
(WebCore::AsyncScrollingCoordinator::setScrollLayerForNode):
* page/scrolling/ScrollingStateFixedNode.cpp:
(WebCore::ScrollingStateFixedNode::syncLayerPositionForViewportRect):
* page/scrolling/ScrollingStateNode.cpp:
(WebCore::ScrollingStateNode::ScrollingStateNode):
(WebCore::ScrollingStateNode::setLayer):
* page/scrolling/ScrollingStateNode.h:
(WebCore::LayerRepresentation::LayerRepresentation):
(WebCore::LayerRepresentation::operator GraphicsLayer*):
(WebCore::LayerRepresentation::operator PlatformLayer*):
(WebCore::LayerRepresentation::operator GraphicsLayer::PlatformLayerID):
(WebCore::LayerRepresentation::operator ==):
(WebCore::LayerRepresentation::toPlatformLayer):
(WebCore::LayerRepresentation::representsGraphicsLayer):
(WebCore::LayerRepresentation::representsPlatformLayer):
(WebCore::LayerRepresentation::representsPlatformLayerID):
(WebCore::ScrollingStateNode::layer):
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
(WebCore::ScrollingStateScrollingNode::setCounterScrollingLayer):
(WebCore::ScrollingStateScrollingNode::setHeaderLayer):
(WebCore::ScrollingStateScrollingNode::setFooterLayer):
* page/scrolling/ScrollingStateScrollingNode.h:
* page/scrolling/ScrollingStateStickyNode.cpp:
(WebCore::ScrollingStateStickyNode::syncLayerPositionForViewportRect):
* page/scrolling/mac/ScrollingStateNodeMac.mm:
* page/scrolling/mac/ScrollingStateScrollingNodeMac.mm:
* page/scrolling/mac/ScrollingTreeFixedNode.mm:
(WebCore::ScrollingTreeFixedNode::updateBeforeChildren):
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
(WebCore::ScrollingTreeScrollingNodeMac::updateBeforeChildren):
* page/scrolling/mac/ScrollingTreeStickyNode.mm:
(WebCore::ScrollingTreeStickyNode::updateBeforeChildren):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161303 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[super dealloc] missing in Source/JavaScriptCore/API/tests/testapi.mm, fails to build with -Werror,-Wobjc-missing-super-calls
https://bugs.webkit.org/show_bug.cgi?id=126454

Reviewed by Geoffrey Garen.

* API/tests/testapi.mm:
(-[TextXYZ dealloc]):
add [super dealloc]
(-[EvilAllocationObject dealloc]):
add [super dealloc]


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161304 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Try to fix CoordinatedGraphics build after r161303. Remove implementations
which are now in the cross-platform file.

* page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
(WebCore::ScrollingCoordinatorCoordinatedGraphics::detachFromStateTree):
(WebCore::ScrollingCoordinatorCoordinatedGraphics::updateViewportConstrainedNode):
* page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp:
* page/scrolling/coordinatedgraphics/ScrollingStateScrollingNodeCoordinatedGraphics.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Clean up the means of committing the scrolling state tree
https://bugs.webkit.org/show_bug.cgi?id=126482

Reviewed by Tim Horton.

ScrollingStateNodes would manually call scrollingStateTree().setHasChangedProperties()
after setPropertyChanged() in lots of places, which was repetitive, and
AsyncScrollingCoordinator manually called scheduleTreeStateCommit() in many places.

Clean up both of these with a clearer trigger for state tree commits.
ScrollingStateNodes::setPropertyChanged() calls ScrollingStateTree::setHasChangedProperties(),
which turns around and tells the ScrollingCoordinator that the state tree became dirty.

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::AsyncScrollingCoordinator):
(WebCore::AsyncScrollingCoordinator::scrollingStateTreePropertiesChanged):
(WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
(WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
(WebCore::AsyncScrollingCoordinator::updateScrollingNode):
(WebCore::AsyncScrollingCoordinator::updateViewportConstrainedNode):
(WebCore::AsyncScrollingCoordinator::setScrollLayerForNode):
(WebCore::AsyncScrollingCoordinator::setCounterScrollingLayerForNode):
(WebCore::AsyncScrollingCoordinator::setHeaderLayerForNode):
(WebCore::AsyncScrollingCoordinator::setFooterLayerForNode):
(WebCore::AsyncScrollingCoordinator::setNonFastScrollableRegionForNode):
(WebCore::AsyncScrollingCoordinator::setWheelEventHandlerCountForNode):
(WebCore::AsyncScrollingCoordinator::setScrollBehaviorForFixedElementsForNode):
(WebCore::AsyncScrollingCoordinator::setScrollbarPaintersFromScrollbarsForNode):
(WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingStateFixedNode.cpp:
(WebCore::ScrollingStateFixedNode::updateConstraints):
* page/scrolling/ScrollingStateNode.cpp:
(WebCore::ScrollingStateNode::setPropertyChanged):
(WebCore::ScrollingStateNode::setLayer):
* page/scrolling/ScrollingStateNode.h:
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::setViewportRect):
(WebCore::ScrollingStateScrollingNode::setTotalContentsSize):
(WebCore::ScrollingStateScrollingNode::setScrollOrigin):
(WebCore::ScrollingStateScrollingNode::setScrollableAreaParameters):
(WebCore::ScrollingStateScrollingNode::setFrameScaleFactor):
(WebCore::ScrollingStateScrollingNode::setNonFastScrollableRegion):
(WebCore::ScrollingStateScrollingNode::setWheelEventHandlerCount):
(WebCore::ScrollingStateScrollingNode::setSynchronousScrollingReasons):
(WebCore::ScrollingStateScrollingNode::setScrollBehaviorForFixedElements):
(WebCore::ScrollingStateScrollingNode::setRequestedScrollPosition):
(WebCore::ScrollingStateScrollingNode::setHeaderHeight):
(WebCore::ScrollingStateScrollingNode::setFooterHeight):
(WebCore::ScrollingStateScrollingNode::setCounterScrollingLayer):
(WebCore::ScrollingStateScrollingNode::setHeaderLayer):
(WebCore::ScrollingStateScrollingNode::setFooterLayer):
* page/scrolling/ScrollingStateStickyNode.cpp:
(WebCore::ScrollingStateStickyNode::updateConstraints):
* page/scrolling/ScrollingStateTree.cpp:
(WebCore::ScrollingStateTree::create):
(WebCore::ScrollingStateTree::ScrollingStateTree):
(WebCore::ScrollingStateTree::setHasChangedProperties):
(WebCore::ScrollingStateTree::didRemoveNode):
* page/scrolling/ScrollingStateTree.h:
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit):
* page/scrolling/mac/ScrollingStateScrollingNodeMac.mm:
(WebCore::ScrollingStateScrollingNode::setScrollbarPaintersFromScrollbars):

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