Modernize HTTPHeaderMap iteration
https://bugs.webkit.org/show_bug.cgi?id=127915

Reviewed by Andreas Kling.

* inspector/InspectorResourceAgent.cpp:
(WebCore::buildObjectForHeaders):
(WebCore::InspectorResourceAgent::willLoadXHR):
(WebCore::InspectorResourceAgent::replayXHR):
* loader/CrossOriginAccessControl.cpp:
(WebCore::isSimpleCrossOriginAccessRequest):
(WebCore::createAccessControlPreflightRequest):
* loader/CrossOriginPreflightResultCache.cpp:
(WebCore::CrossOriginPreflightResultCacheItem::allowsCrossOriginHeaders):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::responseReceived):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::store):
* loader/cache/CachedRawResource.cpp:
(WebCore::CachedRawResource::canReuse):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::updateResponseAfterRevalidation):
* platform/network/HTTPHeaderMap.cpp:
(WebCore::HTTPHeaderMap::copyData):
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::addHTTPHeaderFields):
* platform/network/cf/ResourceRequestCFNet.cpp:
(WebCore::setHeaderFields):
* platform/network/mac/ResourceRequestMac.mm:
(WebCore::ResourceRequest::doUpdatePlatformRequest):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::getAllResponseHeaders):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163089 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] Update test expectations for WK1 and WK2 after r162947
https://bugs.webkit.org/show_bug.cgi?id=127913

Unreviewed EFL gardening.

Patch by Krzysztof Wolanski <k.wolanski@samsung.com> on 2014-01-30

* platform/efl-wk1/TestExpectations:
* platform/efl-wk2/TestExpectations:
* platform/efl/compositing/repaint/invalidations-on-composited-layers-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[curl] Improve realm string parsing in WWW-Authenticate headers
https://bugs.webkit.org/show_bug.cgi?id=127421

Patch by Szabolcs David <davidsz@inf.u-szeged.hu> on 2014-01-30
Reviewed by Brent Fulgham.

The realm string contains quotes at the beginning and end - this is the
opposite of the libsoup implementation. Furthermore, if the header is
concatenated from two or more another headers, it contains more incorrect part.

* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::removeLeadingAndTrailingQuotes):
(WebCore::getProtectionSpace):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163091 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=127371
Explore new API that could be used to help build infinitely scrolling websites
-and corresponding-
<rdar://problem/15244768>

Reviewed by Sam Weinig.

Source/WebCore: 

This patch adds 4 new events called webkitwillrevealbottom, webkitwillrevealtop, 
webkitwillrevealleft, and webkitwillrevealright. These events will fire when the 
user has scrolled close to corresponding edge of the document. Right now that is 
defined to be one viewport away from the corresponding edge. 

FrameView::scrollPositionChanged() and 
FrameView::scrollPositionChangedViaPlatformWidget() now take two parameters 
representing the old scroll position and the new position.
* WebCore.exp.in:

New events.
* dom/Document.h:
* dom/Document.idl:
* dom/Element.h:
* dom/Element.idl:
* dom/EventNames.h:
* html/HTMLAttributeNames.in:
* html/HTMLElement.cpp:
(WebCore::populateEventNameForAttributeLocalNameMap):
* page/DOMWindow.h:
* page/DOMWindow.idl:

Send oldPosition and newPosition to scrollPositionChanged().
* page/FrameView.cpp:
(WebCore::FrameView::setFixedVisibleContentRect):
(WebCore::FrameView::scrollPositionChangedViaPlatformWidget):

After sending scroll events, also call sendWillRevealEdgeEventsIfNeeded() to send 
the see if we should send the new will-reveal events.
(WebCore::FrameView::scrollPositionChanged):

Use the old position and the new position to determine if the events should be 
sent.
(WebCore::FrameView::sendWillRevealEdgeEventsIfNeeded):

Send new parameters to scrollPositionChanged().
(WebCore::FrameView::scrollTo):
(WebCore::FrameView::wheelEvent):
* page/FrameView.h:

Source/WebKit/mac: 

FrameView::scrollPositionChangedViaPlatformWidget() now take two parameters 
representing the old scroll position and the new position.
* WebView/WebHTMLView.mm:
(-[WebHTMLView _frameOrBoundsChanged]):

LayoutTests: 

* fast/events/will-reveal-edges-body-attributes-expected.txt: Added.
* fast/events/will-reveal-edges-body-attributes.html: Added.
* fast/events/will-reveal-edges-event-listeners-expected.txt: Added.
* fast/events/will-reveal-edges-event-listeners.html: Added.
* fast/events/will-reveal-edges-window-attributes-expected.txt: Added.
* fast/events/will-reveal-edges-window-attributes.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163092 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit2 View Gestures (Swipe): Provide a way for clients to provide views to swipe
https://bugs.webkit.org/show_bug.cgi?id=127891
<rdar://problem/15931413>

Reviewed by Anders Carlsson.

* UIProcess/API/Cocoa/WKViewPrivate.h: Add the SPI.

* UIProcess/API/ios/PageClientImplIOS.h:
* UIProcess/API/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::clearCustomSwipeViews):
* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::clearCustomSwipeViews):
* UIProcess/PageClient.h:
Plumb clearCustomSwipeViews() so that WebPageProxy can clear
ViewGestureController's list of custom views when the current
back-forward item changes.

* UIProcess/API/mac/WKView.mm:
(-[WKView _takeViewSnapshot]):
If we have custom swipe views, use the union of their bounds as the snapshot region.

(-[WKView _setCustomSwipeViews:]):
Forward along to ViewGestureController.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didChangeBackForwardList):
When the current back forward list item changes, clear the custom swipe views.

* UIProcess/mac/ViewGestureController.h:
(WebKit::ViewGestureController::setCustomSwipeViews):
(WebKit::ViewGestureController::customSwipeViews):
* UIProcess/mac/ViewGestureController.mm:
(WebKit::ViewGestureController::windowRelativeBoundsForCustomSwipeViews):
Compute the union of the custom swipe view bounds in the window's coordinate space.

(WebKit::ViewGestureController::beginSwipeGesture):
Store the layers we'll be swiping as the "live" layers in m_currentSwipeLiveLayers.
Don't set a shadow (yet) if we have custom swipe views, because it's not clear where to put it.

(WebKit::ViewGestureController::handleSwipeGesture):
Compute the swipe distance ('width') based on the union of the custom views bounds if needed.
Update the transform of all of the live layers. We use transform instead of position now
so that clients can set the position (having an identity transform is one of the SPI caveats).

(WebKit::ViewGestureController::removeSwipeSnapshot):
Reset the transform on all of the live layers.
Clear the list of live layers.

* WebCore.exp.in:
A surprising export.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163093 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[MediaControls][iOS] Add a "start load" button.
https://bugs.webkit.org/show_bug.cgi?id=127861

Reviewed by Eric Carlson.

Add a "start load" button which replaces the controls on platforms
where inline playback is not allowed, or when playback without a
user gesture is not allowed.

Add an accessor to MediaControlsHost to query whether inline playback is allowed.:
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::mediaPlaybackAllowsInline):
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.idl:
* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::mediaSession):

Update the base controller to allow more functions to be overridden:
* Modules/mediacontrols/mediaControlsApple.js:
(Controller):
(Controller.prototype.shouldHaveAnyUI):
(Controller.prototype.updateBase):
(Controller.prototype.setControlsType):
(Controller.prototype.updateControls):
(Controller.prototype.handleFullscreenChange):

Add the new button, and allow for switching between "start", "inline", and "fullscreen" controls:
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.addVideoListeners):
(ControllerIOS.prototype.removeVideoListeners):
(ControllerIOS.prototype.createBase):
(ControllerIOS.prototype.shouldHaveStartPlaybackButton):
(ControllerIOS.prototype.shouldHaveControls):
(ControllerIOS.prototype.shouldHaveAnyUI):
(ControllerIOS.prototype.createControls):
(ControllerIOS.prototype.setControlsType):
(ControllerIOS.prototype.addStartPlaybackControls):
(ControllerIOS.prototype.removeStartPlaybackControls):
(ControllerIOS.prototype.updateControls):
(ControllerIOS.prototype.handleStartPlaybackButtonTouchStart):
(ControllerIOS.prototype.handleStartPlaybackButtonTouchEnd):
(ControllerIOS.prototype.handleStartPlaybackButtonTouchCancel):
(ControllerIOS.prototype.handleReadyStateChange):

Add the new art:
* Modules/mediacontrols/mediaControlsiOS.css:
(audio::-webkit-media-controls-start-playback-button):
(audio::-webkit-media-controls-start-playback-button.failed):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163094 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make TestWebKitAPI build and run for iOS
https://bugs.webkit.org/show_bug.cgi?id=127925

Reviewed by Andy Estes.

* TestWebKitAPI/Configurations/Base.xcconfig:
- Don't warn on 64-32 bit conversion on x86_64 and arm64
- Don't build mac/*
* TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig:
- Link WebKit2 on all platforms

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163095 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Enable iOS Tools builds by default
https://bugs.webkit.org/show_bug.cgi?id=127919

Reviewed by Andy Estes.

* Makefile:
Build all the tools except MiniBrowser on iOS
* Scripts/build-webkit:
Ditto.
Build WebKitTestRunnerApp target on iOS.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163096 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Refactor WebVideoFullscreenController separating AVKit from MediaElement.
https://bugs.webkit.org/show_bug.cgi?id=127762

Patch by Jeremy Jones <jeremyj@apple.com> on 2014-01-30
Reviewed by Jer Noble.

Refactor WebVideoFullscreenControllerAVKit implementation into two abstract interfaces with concrete implementations:
WebVideoFullscreenModel, WebVideoFullscreenInterface, WebVideoFullscreenModelMediaElement, WebVideoFullscreenInterfaceAVKit.

* WebCore.xcodeproj/project.pbxproj:
* platform/ios/WebVideoFullscreenControllerAVKit.h:
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(-[WebVideoFullscreenController init]):
(-[WebVideoFullscreenController dealloc]):
(-[WebVideoFullscreenController enterFullscreen:]):
(-[WebVideoFullscreenController exitFullscreen]):
* platform/ios/WebVideoFullscreenInterface.h: Copied from Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h.
(WebCore::WebVideoFullscreenInterface::~WebVideoFullscreenInterface):
* platform/ios/WebVideoFullscreenInterfaceAVKit.h: Added.
(WebCore::WebVideoFullscreenInterfaceAVKit::~WebVideoFullscreenInterfaceAVKit):
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm: Added.
(NS_ENUM):
(-[WebAVPlayerController init]):
(-[WebAVPlayerController dealloc]):
(-[WebAVPlayerController forwardingTargetForSelector:]):
(-[WebAVPlayerController playerViewController:shouldDismissWithReason:]):
(-[WebAVPlayerController play:]):
(-[WebAVPlayerController pause:]):
(-[WebAVPlayerController togglePlayback:]):
(-[WebAVPlayerController isPlaying]):
(-[WebAVPlayerController setPlaying:]):
(+[WebAVPlayerController keyPathsForValuesAffectingPlaying]):
(-[WebAVPlayerController seekToTime:]):
(:m_videoFullscreenModel):
(WebVideoFullscreenInterfaceAVKit::setWebVideoFullscreenModel):
(WebVideoFullscreenInterfaceAVKit::setDuration):
(WebVideoFullscreenInterfaceAVKit::setCurrentTime):
(WebVideoFullscreenInterfaceAVKit::setRate):
(WebVideoFullscreenInterfaceAVKit::setVideoDimensions):
(WebVideoFullscreenInterfaceAVKit::setVideoLayer):
(WebVideoFullscreenInterfaceAVKit::enterFullscreen):
(WebVideoFullscreenInterfaceAVKit::exitFullscreen):
* platform/ios/WebVideoFullscreenModel.h: Copied from Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h.
(WebCore::WebVideoFullscreenModel::~WebVideoFullscreenModel):
* platform/ios/WebVideoFullscreenModelMediaElement.h: Copied from Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h.
(WebCore::WebVideoFullscreenModelMediaElement::~WebVideoFullscreenModelMediaElement):
(WebCore::WebVideoFullscreenModelMediaElement::setWebVideoFullscreenInterface):
* platform/ios/WebVideoFullscreenModelMediaElement.mm: Added.
(WebVideoFullscreenModelMediaElement::setMediaElement):
(WebVideoFullscreenModelMediaElement::handleEvent):
(WebVideoFullscreenModelMediaElement::requestExitFullScreen):
(WebVideoFullscreenModelMediaElement::play):
(WebVideoFullscreenModelMediaElement::pause):
(WebVideoFullscreenModelMediaElement::togglePlayState):
(WebVideoFullscreenModelMediaElement::seekToTime):
(WebVideoFullscreenModelMediaElement::didExitFullscreen):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add WKNavigationDelegate class
https://bugs.webkit.org/show_bug.cgi?id=127927

Reviewed by Dan Bernstein.

Source/WebKit2:

* UIProcess/API/Cocoa/WKNavigationDelegate.h: Copied from Source/WebKit2/UIProcess/Cocoa/NavigationState.h.
* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView navigationDelegate]):
(-[WKWebView setNavigationDelegate:]):
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::navigationDelegate):
(WebKit::NavigationState::setNavigationDelegate):
* WebKit2.xcodeproj/project.pbxproj:

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/Navigation.mm:
(TEST):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163098 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Host plug-ins in XPC services
<https://webkit.org/b/127897> / <rdar://problem/13675955>

We disabled use of XPC services for plug-ins back in r143829 as the per-architecture services
were not being built for the appropriate architectures. Fixing that allows us to reenable them.

Reviewed by Anders Carlsson.

* Configurations/PluginService.32.xcconfig: Use VALID_ARCHS to restrict the service
to building for i386-only in production builds. Non-production builds allow building
for all standard architectures to ensure that Xcode will be able to build this target.
The exact architecture used isn't a concern for non-production builds since we'll use
the development version of the service anyway.
* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
(WebKit::shouldUseXPC): Remove the workaround that disables use of the XPC services.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163099 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r163037): WebKit2.PageLoadBasic API test failing on Mountain Lion
https://bugs.webkit.org/show_bug.cgi?id=127934

Disable the failing test on Mountain Lion.

* TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp:
(TestWebKitAPI::TEST):

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