iOS build fix after http://trac.webkit.org/changeset/170167.

Reviewed by Geoff Garen.

* bindings/js/JSDeviceMotionEventCustom.cpp:
* bindings/js/JSDeviceOrientationEventCustom.cpp:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170193 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make WebKit2 more accessible in MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=134099

Reviewed by Anders Carlsson.

* MiniBrowser/mac/AppDelegate.h:
* MiniBrowser/mac/AppDelegate.m:
(-[BrowserAppDelegate newWindow:]):
(-[BrowserAppDelegate applicationDidFinishLaunching:]):
(-[BrowserAppDelegate toggleUseWebKit2ByDefault:]):
(-[BrowserAppDelegate _useWebKit2ByDefault]):
(-[BrowserAppDelegate _updateNewWindowKeyEquivalents]):
(-[BrowserAppDelegate validateMenuItem:]):
* MiniBrowser/mac/MainMenu.xib:
Add a "Use WebKit2 By Default" menu item to the top of the Debug menu.
When switched on, Cmd-N will make WebKit2 windows (and the default window will be WebKit2).
Make the non-default new-window menu item always show up, because people often don't find it
when you have to press option to have it show up.

* MiniBrowser/mac/BrowserWindowController.h:
* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController initWithWindow:]):

* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController validateMenuItem:]):
* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController validateMenuItem:]):
Use the cached [menuItem action] like the earlier cases do.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170194 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Cocoa] No way to get the MIME type of the main frame
https://bugs.webkit.org/show_bug.cgi?id=134111

Reviewed by Anders Carlsson.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _MIMEType]): Added. Returns the MIME type of the main frame, or nil.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make ScrollingTreeNodes refounted, for easier tree reconfiguration
https://bugs.webkit.org/show_bug.cgi?id=134075

Reviewed by Tim Horton.

Make ScrollingTreeNode be ref-counted.

Source/WebCore:
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::handleWheelEvent):
(WebCore::ScrollingTree::updateTreeFromStateNode):
* page/scrolling/ScrollingTree.h:
(WebCore::ScrollingTree::rootNode):
* page/scrolling/ScrollingTreeNode.cpp:
(WebCore::ScrollingTreeNode::appendChild):
* page/scrolling/ScrollingTreeNode.h:
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::createNode):
* page/scrolling/ThreadedScrollingTree.h:
* page/scrolling/ios/ScrollingCoordinatorIOS.h:
* page/scrolling/ios/ScrollingCoordinatorIOS.mm:
(WebCore::ScrollingCoordinatorIOS::createScrollingTreeNode):
* page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
* page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
(WebCore::ScrollingTreeFrameScrollingNodeIOS::create):
* page/scrolling/ios/ScrollingTreeIOS.cpp:
(WebCore::ScrollingTreeIOS::createNode):
* page/scrolling/ios/ScrollingTreeIOS.h:
* page/scrolling/mac/ScrollingCoordinatorMac.h:
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::createScrollingTreeNode):
* page/scrolling/mac/ScrollingTreeFixedNode.h:
* page/scrolling/mac/ScrollingTreeFixedNode.mm:
(WebCore::ScrollingTreeFixedNode::create):
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::create):
* page/scrolling/mac/ScrollingTreeStickyNode.h:
* page/scrolling/mac/ScrollingTreeStickyNode.mm:
(WebCore::ScrollingTreeStickyNode::create):

Source/WebKit2:
* UIProcess/Scrolling/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::createNode):
* UIProcess/Scrolling/RemoteScrollingTree.h:
* UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
* UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::create):
* WebProcess/Scrolling/RemoteScrollingCoordinator.h:
* WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
(WebKit::RemoteScrollingCoordinator::createScrollingTreeNode):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Handle scrolling tree modifications which remove intermediate nodes
https://bugs.webkit.org/show_bug.cgi?id=134082

Reviewed by Tim Horton.

When updating the scrolling tree from the state tree, we failed to maintain
the children arrays correctly. Fix by removing all children on scrolling nodes,
and allowing the calls on children to add them back. A temporary hash map
keeps the nodes alive.

The state tree's m_nodesRemovedSinceLastCommit was also made into a HashSet,
to make it easier to handle removal followed by re-insertion.

Source/WebCore:
* WebCore.exp.in:
* page/scrolling/ScrollingStateTree.cpp:
(WebCore::ScrollingStateTree::attachNode): If a node is (possibly re-)added,
remove it from m_nodesRemovedSinceLastCommit.remove.
(WebCore::ScrollingStateTree::willRemoveNode):
(WebCore::ScrollingStateTree::setRemovedNodes):
* page/scrolling/ScrollingStateTree.h:
(WebCore::ScrollingStateTree::removedNodes):
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::commitNewTreeState):
(WebCore::ScrollingTree::updateTreeFromStateNode): Clean up to have only one call
to updateBeforeChildren(), and remove all children from the scrolling node
before visiting state children.
(WebCore::ScrollingTree::removeDestroyedNodes): It was very wrong to assume
that all non-root nodes were parented in the root! Now we don't need to
remove from the parent anyway.
* page/scrolling/ScrollingTree.h:
* page/scrolling/ScrollingTreeNode.h:
(WebCore::ScrollingTreeNode::children):

Source/WebKit2:
* Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
(WebKit::RemoteScrollingCoordinatorTransaction::decode):
(WebKit::RemoteScrollingTreeTextStream::dump):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170197 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS WebKit2] Make -webkit-overflow-scrolling:touch work in iframes (breaks MSWord previews)
https://bugs.webkit.org/show_bug.cgi?id=134085

Source/WebCore:
<rdar://problem/16440586>

Reviewed by Tim Horton.

When nodes were detached from the scrolling tree, we would previously throw away
all descendant nodes, expecting that they would be re-attached as we walk the compositing
layer tree in RenderLayerCompositor.

However, this doesn't work across frame boundaries; the subframe may never update
its compositing layers again, so would lose all its scrolling nodes.

Fix by having ScrollingStateTree::detachNode() by default set aside subframe nodes
into a hash map. On reattach, we'll look in the hash map and pull out an existing node
(with its children intact) if possible.

Tests: platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-gain-scrolling-ancestor.html
       platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-lose-scrolling-ancestor.html
       platform/mac-wk2/tiled-drawing/scrolling/frames/remove-coordinated-frame.html

* page/scrolling/ScrollingStateNode.cpp:
(WebCore::ScrollingStateNode::ScrollingStateNode):
* page/scrolling/ScrollingStateTree.cpp:
(WebCore::ScrollingStateTree::attachNode):
(WebCore::ScrollingStateTree::detachNode):
(WebCore::ScrollingStateTree::clear):
(WebCore::ScrollingStateTree::removeNodeAndAllDescendants):
(WebCore::ScrollingStateTree::recursiveNodeWillBeRemoved):
* page/scrolling/ScrollingStateTree.h:
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::commitNewTreeState): Go back to removing the deleted
nodes from m_nodeMap first.
(WebCore::ScrollingTree::removeDestroyedNodes): There is no need for this to
actually make use of ScrollingTreeNode* any more; the ASSERT(!node->parent())
is bogus because it can fire when whole subtrees are removed, and to clear the
latched node we just need the ID.

Source/WebKit2:
<rdar://problem/16440586>

Reviewed by Tim Horton.

Add some debug-only assertions that check that the number of nodes we encoded is
the expected number.

* Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
(WebKit::encodeNodeAndDescendants):
(WebKit::RemoteScrollingCoordinatorTransaction::encode):

LayoutTests:

Reviewed by Tim Horton.

Tests that add and remove a fixed container of a scroll-coordinated iframe.

* platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-expected.txt:
* platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-gain-scrolling-ancestor-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-gain-scrolling-ancestor.html: Added.
* platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed-expected.txt:
* platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-lose-scrolling-ancestor-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-lose-scrolling-ancestor.html: Added.
* platform/mac-wk2/tiled-drawing/scrolling/frames/remove-coordinated-frame-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/scrolling/frames/remove-coordinated-frame.html: Added.
* platform/mac-wk2/tiled-drawing/scrolling/frames/resources/doc-with-sticky.html:

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