Web Replay: memoize fallback time values for document.lastModified
https://bugs.webkit.org/show_bug.cgi?id=131318

Reviewed by Joseph Pecoraro.

Source/WebCore:
If a document's Last-Modified header can't be found or used, then
document.lastModified is derived from the current system time or
from filesystem data, which is obviously nondeterministic.

It's better to handle this inside Document::lastModified rather than using
MemoizedDOMResult, because only the fallback case is nondeterministic.

Test: http/tests/inspector/replay/document-last-modified-fallback-value.html

* dom/Document.cpp:
(WebCore::Document::lastModified): Save or reuse memoized fallback value.
* replay/WebInputs.json: Add input DocumentLastModifiedDate.

LayoutTests:
* http/tests/inspector/replay/document-last-modified-fallback-value.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167261 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2 iOS] Scrolling to anchor links is broken
https://bugs.webkit.org/show_bug.cgi?id=131618
<rdar://problem/16599144>

Source/WebCore:

Reviewed by Tim Horton.

Have ScrollingTreeScrollingNode pass RequestedScrollPosition updates
to the scrolling tree, so that the scrolling tree can have custom behavior
for them if necessary.

* page/scrolling/ScrollingTree.h:
(WebCore::ScrollingTree::scrollingTreeNodeRequestsScroll):
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::updateAfterChildren):
* page/scrolling/ScrollingTreeScrollingNode.h:

Source/WebKit2:

Reviewed by Tim Horton.

The RemoteScrollingTree implements scrollingTreeNodeRequestsScroll
to get informed about requested scroll position updates, and passes
them along via the RemoteScrollingCoordinatorProxy, WebPageProxy and PageClient
to the WKWebView, which performs a scroll.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _scrollToContentOffset:WebCore::]): Scroll to content offset,
taking page scale and insets into account.
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/CoordinatedGraphics/WebView.cpp:
(WebKit::WebView::requestScroll):
* UIProcess/CoordinatedGraphics/WebView.h:
* UIProcess/PageClient.h:
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll):
Pass scrolls along to the WebPageProxy for the root node. We will also need
to handle programmatic scrolls for overflow soon.
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
* UIProcess/Scrolling/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::scrollingTreeNodeRequestsScroll):
* UIProcess/Scrolling/RemoteScrollingTree.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestScroll):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::canScrollView):
(WebKit::PageClientImpl::requestScroll):
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::requestScroll):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167262 268f45cc-cd09-0410-ab3c-d52691b4dbfc
monotonicallyIncreasingTime() should only initialize its static timebaseInfo once.
<https://webkit.org/b/131630>

Reviewed by Filip Pizlo.

The current initialization of the static field is not thread safe.

* wtf/CurrentTime.cpp:
(WTF::monotonicallyIncreasingTime):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167263 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use after free in WebCore::CachedResourceHandleBase::~CachedResourceHandleBase / WebCore::removeDetachedChildrenInContainer
https://bugs.webkit.org/show_bug.cgi?id=131169

Reviewed by Eric Carlson.

Invalidate the WebCoreAVFResourceLoader owned by MediaPlayerPrivateAVFoundationObjC
in its destructor, to prevent a private function being called in response to the
WebCoreAVFResourceLoader being stopped.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC):
* platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
* platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
(WebCore::WebCoreAVFResourceLoader::invalidate):

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

* UIProcess/mac/PageClientImpl.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167265 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Run filter animations in the UI process with UI-side compositing
https://bugs.webkit.org/show_bug.cgi?id=131199
<rdar://problem/16479487>

Source/WebCore:

Reviewed by Sam Weinig.

Add FilterOperation::clone() which is used during decoding.
Export some things.

* WebCore.exp.in:
* platform/graphics/filters/FilterOperation.h:

Source/WebKit2:

Reviewed by Sam Weinig.

* Shared/WebCoreArgumentCoders.cpp: Removed lots of WebCore::
(IPC::ArgumentCoder<SelectionRect>::decode):
(IPC::ArgumentCoder<PasteboardWebContent>::encode):
(IPC::ArgumentCoder<PasteboardWebContent>::decode):
(IPC::ArgumentCoder<PasteboardImage>::encode):
(IPC::ArgumentCoder<PasteboardImage>::decode):
(IPC::ArgumentCoder<URL>::decode):
(IPC::ArgumentCoder<UserStyleSheet>::encode):
(IPC::ArgumentCoder<UserStyleSheet>::decode):
(IPC::ArgumentCoder<UserScript>::encode):
(IPC::ArgumentCoder<UserScript>::decode):
(IPC::ArgumentCoder<ScrollableAreaParameters>::encode):
(IPC::ArgumentCoder<ScrollableAreaParameters>::decode):
(IPC::ArgumentCoder<FixedPositionViewportConstraints>::encode):
(IPC::ArgumentCoder<FixedPositionViewportConstraints>::decode):
(IPC::ArgumentCoder<StickyPositionViewportConstraints>::encode):
(IPC::ArgumentCoder<StickyPositionViewportConstraints>::decode):
(IPC::ArgumentCoder<FilterOperation>::encode):
(IPC::decodeFilterOperation):
(IPC::ArgumentCoder<FilterOperations>::encode):
(IPC::ArgumentCoder<WebCore::UserStyleSheet>::encode): Deleted.
(IPC::ArgumentCoder<WebCore::UserStyleSheet>::decode): Deleted.
(IPC::ArgumentCoder<WebCore::UserScript>::encode): Deleted.
(IPC::ArgumentCoder<WebCore::UserScript>::decode): Deleted.
(IPC::ArgumentCoder<WebCore::ScrollableAreaParameters>::encode): Deleted.
(IPC::ArgumentCoder<WebCore::ScrollableAreaParameters>::decode): Deleted.
(IPC::ArgumentCoder<WebCore::FixedPositionViewportConstraints>::encode): Deleted.
(IPC::ArgumentCoder<WebCore::FixedPositionViewportConstraints>::decode): Deleted.
(IPC::ArgumentCoder<WebCore::StickyPositionViewportConstraints>::encode): Deleted.
(IPC::ArgumentCoder<WebCore::StickyPositionViewportConstraints>::decode): Deleted.
(IPC::encodeFilterOperation): Deleted.
Add encoding/decoding support for FilterOperation.
decodeFilterOperation() has to be a bare function because of the RefPtr
out parameter.
REFERENCE filters should never be encoded, since they have CachedSVGDocumentReferences.

* Shared/WebCoreArgumentCoders.h:

* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTextStream::operator<<):
Add logging for filter animations to the RemoteLayerTree log output.

* WebProcess/WebPage/mac/GraphicsLayerCARemote.h:
* WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp:
(WebKit::GraphicsLayerCARemote::addAnimation): Deleted. We can run
filter animations now.

* WebProcess/WebPage/mac/PlatformCAAnimationRemote.h:
KeyValues have a RefPtr<WebCore::FilterOperation> now (which can't be part of
the union because we need its constructor to get called).
* WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm:
(WebKit::PlatformCAAnimationRemote::KeyframeValue::encode): Encode the filter.
(WebKit::PlatformCAAnimationRemote::KeyframeValue::decode): Decode the filter.
(WebKit::PlatformCAAnimationRemote::setFromValue): Implement.
(WebKit::PlatformCAAnimationRemote::setToValue): Implement.
(WebKit::PlatformCAAnimationRemote::setValues): Implement.
(WebKit::animationValueFromKeyframeValue): Handle filters.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167266 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Eliminate CachedFrame::m_mousePressNode
https://bugs.webkit.org/show_bug.cgi?id=131626

Reviewed by Brady Eidson.

I couldn't find any observable effect of this change.

* history/CachedFrame.cpp:
(WebCore::CachedFrameBase::CachedFrameBase):
(WebCore::CachedFrameBase::restore):
(WebCore::CachedFrame::clear):
* history/CachedFrame.h:
(WebCore::CachedFrame::documentLoader):
(WebCore::CachedFrame::mousePressNode): Deleted.
Eliminated m_mousePressNode, accessor, and code that reached out to EventHandler.

* page/EventHandler.cpp:
(WebCore::EventHandler::mousePressNode): Deleted.
(WebCore::EventHandler::setMousePressNode): Deleted.
* page/EventHandler.h:
(WebCore::EventHandler::setMousePressed): Deleted. This function was already unused.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167267 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (WebKit2 View Gestures): Double-tap doesn't work properly when there's no element underneath the cursor
https://bugs.webkit.org/show_bug.cgi?id=131629
<rdar://problem/16192821>

Reviewed by Dan Bernstein.

* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
If there's nothing under the cursor, zoom towards the cursor instead of towards 0,0.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167268 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[sh4] Allow use of SubImmediates in LLINT.
https://bugs.webkit.org/show_bug.cgi?id=131608

Reviewed by Mark Lam.

Allow use of SubImmediates with const pool so the sh4 architecture can
share the arm path for setEntryAddress macro. It reduces architecture
specific code and lead to a more optimal generated code for sh4.

* llint/LowLevelInterpreter.asm:
* offlineasm/sh4.rb:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167269 268f45cc-cd09-0410-ab3c-d52691b4dbfc
RenderLayerCompositor's m_layerForOverhangAreas should be offset by the 
topContentInset
https://bugs.webkit.org/show_bug.cgi?id=131632
-and corresponding-
<rdar://problem/16609602>

Reviewed by Tim Horton.

Offset m_layerForOverhangAreas by the topContentInset. 
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateOverflowControlsLayers):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167270 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Allow dynamic changes of WKThumbnailView snapshot scale
https://bugs.webkit.org/show_bug.cgi?id=131628
<rdar://problem/16584156>

Reviewed by Beth Dakin.

* UIProcess/API/Cocoa/_WKThumbnailView.mm:
(-[_WKThumbnailView _requestSnapshotIfNeeded]):
Don't bail from requesting a snapshot just because we already had one; we want to resnapshot.
Keep track of when we bail from requesting a snapshot because we have one in-flight, so we can request it later.

(-[_WKThumbnailView _didTakeSnapshot:]):
Apply the scale to the bitmap size (whoops!).
Make CA always resize the content to fill the thumbnail view's layer, respecting aspect ratio.
Re-snapshot if we previously deferred a snapshot.

(-[_WKThumbnailView setScale:]):
If we get a scale change, request a new snapshot.

(-[_WKThumbnailView setUsesSnapshot:]):
Never apply thumbnail scale to the page if we're using snapshots. It's unnecessary,
because scale will be applied simply when painting the software snapshot.
Apply the thumbnail scale if we're going from usesSnapshot -> !usesSnapshot.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::snapshotAtSize):
Snapshots should use the greater of the two scales, so as to never leave a portion of the snapshot unpainted.


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