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
Unreviewed. Adding myself to committers.

* Scripts/webkitpy/common/config/contributors.json:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170199 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove redundant RenderLayer::computeOffsetFromRoot() function.
https://bugs.webkit.org/show_bug.cgi?id=134088

Reviewed by Benjamin Poulain.

No change in functionality.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects):
(WebCore::RenderLayer::computeOffsetFromRoot): Deleted.
* rendering/RenderLayer.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170200 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Cocoa] Release freed up blocks from the JS heap after simulated memory pressure.
<https://webkit.org/b/134112>

Reviewed by Mark Hahnenberg.

Source/JavaScriptCore:
* heap/BlockAllocator.h:

Source/WebCore:
* platform/cocoa/MemoryPressureHandlerCocoa.mm:
(WebCore::MemoryPressureHandler::install):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170201 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add copy/move constructors and assignment operators to WTF::Optional
https://bugs.webkit.org/show_bug.cgi?id=134119

Reviewed by Andreas Kling.

* wtf/Optional.h:
(WTF::Optional::Optional):
(WTF::Optional::operator=):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r169972): fix issue when removing masks from compositing layers
https://bugs.webkit.org/show_bug.cgi?id=134118
<rdar://problem/17366654>

Reviewed by Dean Jackson.

Source/WebCore:
After r169972 when removing the mask, we could destroy the mask
layer before the call into m_graphicsLayer->setMaskLayer(), which would
try to call functions on the old mask. Fix by clearing the mask layer
on the GraphicsLayer before the mask layer gets destroyed.

Test: compositing/masks/toggle-mask.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):
(WebCore::RenderLayerBacking::updateMaskLayer):
* rendering/RenderLayerBacking.h:

LayoutTests:
Test that toggles the mask on a composited element.

* compositing/masks/toggle-mask-expected.txt: Added.
* compositing/masks/toggle-mask.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Always commit the scrolling tree when we flush layers
https://bugs.webkit.org/show_bug.cgi?id=134115

Reviewed by Beth Dakin.

The scrolling state tree contains bare pointers to GraphicsLayers, which get
converted to CALayers at commit time. To avoid a window of time where those
GraphicsLayer pointers go stale, commit the scrolling tree whenever we flush the
compositing layer tree.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::flushLayers):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170204 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Give NPAPI post requests a default content type
https://bugs.webkit.org/show_bug.cgi?id=134120

Reviewed by Andreas Kling.

Source/WebCore:
* WebCore.exp.in:

Source/WebKit2:
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::loadURL):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170205 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Adding myself to committers.

* Scripts/webkitpy/common/config/contributors.json:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170206 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS] Support Khmer and Lao fallback fonts
https://bugs.webkit.org/show_bug.cgi?id=134114

Reviewed by Enrica Casucci.

Source/WebCore:
iOS has fonts which have glyphs for the Khmer and Lao languages.

This patch also does a little refactoring of the language-specific fallback
font path to increase readability.

Test: fast/text/khmer-lao-font.html

* platform/graphics/ios/FontCacheIOS.mm:
(WebCore::languageSpecificFallbackFont):
(WebCore::FontCache::systemFallbackForCharacters):

LayoutTests:
Simply dump the render tree of a page that includes Khmer and Lao text. The success
of this test depends on font font metrics being different than system fallback font
(which just shows rectangles instead of glyphs).

* fast/text/khmer-lao-font.html: Added.
* platform/ios-sim/fast/text/khmer-lao-font-expected.txt: Added.
* platform/mac/fast/text/khmer-lao-font-expected.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170207 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Removing dead code in platform/graphics/gpu
https://bugs.webkit.org/show_bug.cgi?id=134065

Reviewed by Simon Fraser.

No new tests because there is no behavior change.

* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/gpu/LoopBlinnClassifier.cpp: Removed.
* platform/graphics/gpu/LoopBlinnClassifier.h: Removed.
* platform/graphics/gpu/LoopBlinnConstants.h: Removed.
* platform/graphics/gpu/LoopBlinnLocalTriangulator.cpp: Removed.
* platform/graphics/gpu/LoopBlinnLocalTriangulator.h: Removed.
* platform/graphics/gpu/LoopBlinnMathUtils.cpp: Removed.
* platform/graphics/gpu/LoopBlinnMathUtils.h: Removed.
* platform/graphics/gpu/LoopBlinnPathCache.cpp: Removed.
* platform/graphics/gpu/LoopBlinnPathCache.h: Removed.
* platform/graphics/gpu/LoopBlinnPathProcessor.h: Removed.
* platform/graphics/gpu/LoopBlinnShader.cpp: Removed.
* platform/graphics/gpu/LoopBlinnShader.h: Removed.
* platform/graphics/gpu/LoopBlinnSolidFillShader.cpp: Removed.
* platform/graphics/gpu/LoopBlinnSolidFillShader.h: Removed.
* platform/graphics/gpu/LoopBlinnTextureCoords.cpp: Removed.
* platform/graphics/gpu/LoopBlinnTextureCoords.h: Removed.
* platform/graphics/gpu/Shader.cpp: Removed.
* platform/graphics/gpu/Shader.h: Removed.
* platform/graphics/gpu/SharedGraphicsContext3D.cpp: Removed.
* platform/graphics/gpu/SharedGraphicsContext3D.h: Removed.
* platform/graphics/gpu/mac/DrawingBufferMac.mm: Removed.
* platform/graphics/gpu/opencl/FilterContextOpenCL.cpp: Removed.
* platform/graphics/gpu/opencl/FilterContextOpenCL.h: Removed.
* platform/graphics/gpu/opencl/OpenCLFEColorMatrix.cpp: Removed.
* platform/graphics/gpu/opencl/OpenCLFEFlood.cpp: Removed.
* platform/graphics/gpu/opencl/OpenCLFEImage.cpp: Removed.
* platform/graphics/gpu/opencl/OpenCLFEMerge.cpp: Removed.
* platform/graphics/gpu/opencl/OpenCLFESourceAlpha.cpp: Removed.
* platform/graphics/gpu/opencl/OpenCLFESourceGraphic.cpp: Removed.
* platform/graphics/gpu/opencl/OpenCLFETurbulence.cpp: Removed.
* platform/graphics/gpu/opencl/OpenCLHandle.h: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170208 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add encoding and decoding support for WTF::Optional
https://bugs.webkit.org/show_bug.cgi?id=134125

Reviewed by Andreas Kling.

Source/WebKit2:
* Platform/IPC/ArgumentCoders.h:
(IPC::ArgumentCoder<WTF::Optional<T>>::encode):
(IPC::ArgumentCoder<WTF::Optional<T>>::decode):

Source/WTF:
* wtf/Optional.h:
(WTF::Optional::operator=):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170209 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add ArgumentEncoder support to PageState and friends
https://bugs.webkit.org/show_bug.cgi?id=134128

Reviewed by Andreas Kling.

Change the classes to structs, get rid of the constructors/destructors
and add encode member functions.

* Shared/SessionState.cpp:
(WebKit::HTTPBody::Element::encode):
(WebKit::HTTPBody::encode):
(WebKit::FrameState::encode):
(WebKit::PageState::encode):
(WebKit::HTTPBody::Element::Element): Deleted.
(WebKit::HTTPBody::Element::~Element): Deleted.
(WebKit::FrameState::FrameState): Deleted.
(WebKit::FrameState::~FrameState): Deleted.
(WebKit::PageState::PageState): Deleted.
(WebKit::PageState::~PageState): Deleted.
* Shared/SessionState.h:
(WebKit::HTTPBody::Element::type): Deleted.

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

* Shared/SessionState.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170211 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Always use XPC on iOS
https://bugs.webkit.org/show_bug.cgi?id=134130

Reviewed by Sam Weinig.

* UIProcess/ios/WebProcessProxyIOS.mm:
(WebKit::WebProcessProxy::platformGetLaunchOptions):
(WebKit::shouldUseXPC): Deleted.

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