77e34594c085eb7159467beff9304d9f626391ec
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-03-03  Yoav Weiss  <yoav@yoav.ws>
2
3         Link headers for subresources are not being processes
4         https://bugs.webkit.org/show_bug.cgi?id=181789
5
6         Reviewed by Youenn Fablet.
7
8         Triggers Link header processing when the Link headers arrive on a subresource.
9
10         Test: http/tests/preload/link-header-on-subresource.html
11
12         * loader/LinkLoader.cpp:
13         (WebCore::LinkLoader::loadLinksFromHeader): Change the media check conditions.
14         * loader/LinkLoader.h: Add a third state for media checks.
15         * loader/SubresourceLoader.cpp:
16         (WebCore::SubresourceLoader::didReceiveResponse): Preload links from headers for subresources.
17
18 2018-03-02  Yusuke Suzuki  <utatane.tea@gmail.com>
19
20         [WTF] Remove RunLoop and RunLoop::Timer's interface using double as seconds
21         https://bugs.webkit.org/show_bug.cgi?id=183293
22
23         Reviewed by Alex Christensen.
24
25         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
26         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
27
28 2018-03-02  Dean Jackson  <dino@apple.com>
29
30         Remove NP_GLContext since it is unsupported
31         https://bugs.webkit.org/show_bug.cgi?id=183305
32         <rdar://problem/36875555>
33
34         Reviewed by Simon Fraser.
35
36         * plugins/npapi.h: Remove NP_GLContext and mention that
37         it is not supported.
38
39 2018-03-02  Chris Dumez  <cdumez@apple.com>
40
41         imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-protocol-setter-non-broken.html crashes with async policy delegates
42         https://bugs.webkit.org/show_bug.cgi?id=183294
43         <rdar://problem/38073596>
44
45         Reviewed by Youenn Fablet.
46
47         Drop code that was added to SubresourceLoader::willCancel() in r228852. The purpose of this code
48         was to make sure that SubresourceLoader::m_policyForResponseCompletionHandler always gets called,
49         even when the load is cancelled. However, this code is not needed (since m_policyForResponseCompletionHandler
50         is a CompletionHandler, an assertion will be hit if we fail to call it and we'll know). Calling
51         the completionHandler inside SubresourceLoader::willCancel() is too early and leads to crashes.
52
53         The completionHandler currently gets called DocumentLoader::responseReceived() via a call to
54         mainResourceLoader->didReceiveResponsePolicy(). Note that in r229177, we made sure that the
55         call to didReceiveResponsePolicy() happens *after* the call to continueAfterContentPolicy()
56         to maintain our non-async policy delegate behavior. However, continueAfterContentPolicy()
57         would end up calling willCancel() and call the completionHandler when shouldContinue was
58         false.
59
60         Test: http/wpt/html/browsers/history/the-location-interface/location-protocol-setter-non-broken-async-delegate.html
61
62         * loader/SubresourceLoader.cpp:
63         (WebCore::SubresourceLoader::willCancel):
64
65 2018-03-02  Tim Horton  <timothy_horton@apple.com>
66
67         Fix the build after r229185 and r229184
68
69         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
70         (WebCore::exernalDeviceDisplayNameForPlayer):
71         * platform/ios/DeviceOrientationClientIOS.h:
72         * platform/ios/DeviceOrientationClientIOS.mm:
73
74 2018-03-02  Tim Horton  <timothy_horton@apple.com>
75
76         Make the !ENABLE(DEVICE_ORIENTATION) iOS build succeed
77         https://bugs.webkit.org/show_bug.cgi?id=183296
78
79         Reviewed by Dan Bernstein.
80
81         * platform/ios/DeviceMotionClientIOS.h:
82         * platform/ios/DeviceMotionClientIOS.mm:
83         * platform/ios/WebCoreMotionManager.h:
84         * platform/ios/WebCoreMotionManager.mm:
85
86 2018-03-02  Tim Horton  <timothy_horton@apple.com>
87
88         Make it possible to build for iOS without Celestial
89         https://bugs.webkit.org/show_bug.cgi?id=183295
90         <rdar://problem/38074468>
91
92         Reviewed by Dan Bernstein.
93
94         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
95         (WebCore::exernalDeviceDisplayNameForPlayer):
96
97 2018-03-02  Youenn Fablet  <youenn@apple.com>
98
99         Clients should register to StorageProcess with their service worker registration identifier
100         https://bugs.webkit.org/show_bug.cgi?id=182313
101         <rdar://problem/38044403>
102
103         Reviewed by Chris Dumez.
104
105         Relanding with fixing matchAll for uncontrolled clients.
106
107         No observable change of behavior in regular conditions.
108         When service worker process crashes, the service worker identifiers sent by the WebProcess might be wrong
109         and we will not be able to retrieve the registration from these identifiers.
110         The storage process will be able to still process correctly messages coming from the WebProcess to register clients of the registration.
111         Otherwise, there is a chance that WebProcess clients will not be added to the SWServerRegistration.m_clientsUsingRegistration maps.
112
113         * dom/Document.cpp:
114         (WebCore::Document::setServiceWorkerConnection):
115         * workers/service/SWClientConnection.h:
116         * workers/service/server/SWServer.cpp:
117         (WebCore::SWServer::matchAll):
118         (WebCore::SWServer::claim):
119         (WebCore::SWServer::registerServiceWorkerClient):
120         (WebCore::SWServer::unregisterServiceWorkerClient):
121         (WebCore::SWServer::setClientActiveWorker): Deleted.
122         * workers/service/server/SWServer.h:
123         * workers/service/server/SWServerRegistration.cpp:
124         (WebCore::SWServerRegistration::activate):
125
126 2018-03-02  Youenn Fablet  <youenn@apple.com>
127
128         Loads for a Document controlled by a Service Worker should not use AppCache
129         https://bugs.webkit.org/show_bug.cgi?id=183148
130
131         Reviewed by Chris Dumez.
132
133         Covered by updated test.
134
135         Postponing document loading through app cache after matching service worker registration.
136         Trying to load through app cache only if there is no service worker registration.
137
138         Disabling app cache for any load that has a service worker registration identifier.
139
140         * loader/DocumentLoader.cpp:
141         (WebCore::DocumentLoader::redirectReceived):
142         (WebCore::DocumentLoader::willSendRequest):
143         (WebCore::DocumentLoader::tryLoadingRequestFromApplicationCache):
144         (WebCore::DocumentLoader::tryLoadingRedirectRequestFromApplicationCache):
145         (WebCore::DocumentLoader::restartLoadingDueToServiceWorkerRegistrationChange):
146         (WebCore::DocumentLoader::scheduleSubstituteResourceLoad):
147         (WebCore::DocumentLoader::startLoadingMainResource):
148         * loader/DocumentLoader.h:
149         * loader/appcache/ApplicationCacheHost.cpp:
150         (WebCore::ApplicationCacheHost::maybeLoadMainResource):
151         (WebCore::ApplicationCacheHost::maybeLoadMainResourceForRedirect):
152         (WebCore::ApplicationCacheHost::maybeLoadResource):
153         (WebCore::ApplicationCacheHost::scheduleLoadFallbackResourceFromApplicationCache):
154         * loader/appcache/ApplicationCacheHost.h:
155
156 2018-03-02  Chris Dumez  <cdumez@apple.com>
157
158         fast/events/before-unload-remove-itself.html crashes with async policy delegates
159         https://bugs.webkit.org/show_bug.cgi?id=183290
160         <rdar://problem/38069045>
161
162         Reviewed by Alex Christensen.
163
164         When the navigation policy happens asynchronously, it is now possible for the
165         Frame / FrameLoader to get destroyed between the point that policyChecker().checkNavigationPolicy()
166         is called and when continueLoadAfterNavigationPolicy() is called.
167
168         To address the issue, we now protect the Frame and capture it in the lambda passed
169         to policyChecker().checkNavigationPolicy().
170
171         Test: fast/events/before-unload-remove-itself-async-delegate.html
172
173         * loader/FrameLoader.cpp:
174         (WebCore::FrameLoader::loadURL):
175         (WebCore::FrameLoader::loadWithDocumentLoader):
176
177 2018-03-02  Chris Dumez  <cdumez@apple.com>
178
179         Converting a load to a download does not work with async policy delegates
180         https://bugs.webkit.org/show_bug.cgi?id=183254
181         <rdar://problem/38035334>
182
183         Reviewed by Youenn Fablet.
184
185         Update DocumentLoader::responseReceived() to call didReceiveResponsePolicy()
186         on the mainResourceLoader *after* calling continueAfterContentPolicy(),
187         not *before*. This makes sure that the WebResourceLoader sends the
188         NetworkResourceLoader::ContinueDidReceiveResponse IPC back to the Network
189         Process *after* the policy decision has been processed, which restores the
190         pre-r228852 order.
191
192         Test: fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download-async-delegate.html
193
194         * loader/DocumentLoader.cpp:
195         (WebCore::DocumentLoader::responseReceived):
196
197 2018-03-02  Youenn Fablet  <youenn@apple.com>
198
199         Some RealtimeMediaSource methods do not need to be marked as virtual
200         https://bugs.webkit.org/show_bug.cgi?id=183272
201
202         Reviewed by Eric Carlson.
203
204         No change of behavior.
205
206         * platform/mediastream/RealtimeMediaSource.h:
207
208 2018-03-01  Yusuke Suzuki  <utatane.tea@gmail.com>
209
210         Remove monotonicallyIncreasingTime
211         https://bugs.webkit.org/show_bug.cgi?id=182911
212
213         Reviewed by Michael Catanzaro.
214
215         While generic code uses MonotonicTime, CAAnimation uses media time (CFTimeInterval).
216         At this boundary, we convert MonotonicTime to media time, this is the same logic to
217         the code before this patch.
218
219         * Modules/gamepad/Gamepad.h:
220         * Modules/mediasource/SourceBuffer.cpp:
221         (WebCore::SourceBuffer::SourceBuffer):
222         (WebCore::SourceBuffer::monitorBufferingRate):
223         * Modules/mediasource/SourceBuffer.h:
224         * Modules/speech/SpeechSynthesis.cpp:
225         (WebCore::SpeechSynthesis::startSpeakingImmediately):
226         (WebCore::SpeechSynthesis::fireEvent):
227         * Modules/speech/SpeechSynthesisUtterance.h:
228         * contentextensions/ContentExtensionCompiler.cpp:
229         (WebCore::ContentExtensions::compileRuleList):
230         * contentextensions/ContentExtensionParser.cpp:
231         (WebCore::ContentExtensions::parseRuleList):
232         * contentextensions/ContentExtensionsBackend.cpp:
233         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad const):
234         * dom/Element.cpp:
235         (WebCore::Element::setActive):
236         * history/CachedPage.cpp:
237         (WebCore::CachedPage::CachedPage):
238         (WebCore::CachedPage::hasExpired const):
239         * history/CachedPage.h:
240         * html/HTMLMediaElement.cpp:
241         (WebCore::HTMLMediaElement::startProgressEventTimer):
242         (WebCore::HTMLMediaElement::progressEventTimerFired):
243         (WebCore::HTMLMediaElement::refreshCachedTime const):
244         (WebCore::HTMLMediaElement::invalidateCachedTime const):
245         (WebCore::HTMLMediaElement::currentMediaTime const):
246         (WebCore::HTMLMediaElement::startPlaybackProgressTimer):
247         * html/HTMLMediaElement.h:
248         * html/MediaElementSession.cpp:
249         (WebCore::MediaElementSession::removeBehaviorRestriction):
250         (WebCore::MediaElementSession::mostRecentUserInteractionTime const):
251         (WebCore::MediaElementSession::resetPlaybackSessionState):
252         * html/MediaElementSession.h:
253         * html/parser/HTMLParserScheduler.cpp:
254         (WebCore::PumpSession::PumpSession):
255         (WebCore::HTMLParserScheduler::HTMLParserScheduler):
256         * html/parser/HTMLParserScheduler.h:
257         (WebCore::HTMLParserScheduler::checkForYield):
258         * inspector/InspectorCanvas.cpp:
259         (WebCore::InspectorCanvas::recordAction):
260         (WebCore::InspectorCanvas::finalizeFrame):
261         * inspector/InspectorCanvas.h:
262         * inspector/agents/InspectorMemoryAgent.cpp:
263         (WebCore::InspectorMemoryAgent::startTracking):
264         (WebCore::InspectorMemoryAgent::didHandleMemoryPressure):
265         (WebCore::InspectorMemoryAgent::collectSample):
266         * inspector/agents/InspectorNetworkAgent.cpp:
267         (WebCore::InspectorNetworkAgent::buildObjectForTiming):
268         (WebCore::InspectorNetworkAgent::timestamp):
269         (WebCore::InspectorNetworkAgent::didFinishLoading):
270         * inspector/agents/InspectorPageAgent.cpp:
271         (WebCore::InspectorPageAgent::timestamp):
272         * inspector/agents/InspectorTimelineAgent.cpp:
273         (WebCore::InspectorTimelineAgent::timestamp):
274         * inspector/agents/WebHeapAgent.cpp:
275         (WebCore::WebHeapAgent::dispatchGarbageCollectedEvent):
276         * inspector/agents/WebHeapAgent.h:
277         * loader/cache/CachedCSSStyleSheet.cpp:
278         (WebCore::CachedCSSStyleSheet::restoreParsedStyleSheet):
279         * loader/cache/CachedImage.cpp:
280         (WebCore::CachedImage::didDraw):
281         * loader/cache/CachedResource.cpp:
282         (WebCore::CachedResource::didAccessDecodedData):
283         * loader/cache/CachedResource.h:
284         * loader/cache/MemoryCache.cpp:
285         (WebCore::MemoryCache::pruneLiveResourcesToSize):
286         * page/EventHandler.cpp:
287         (WebCore::MaximumDurationTracker::MaximumDurationTracker):
288         (WebCore::MaximumDurationTracker::~MaximumDurationTracker):
289         * page/FocusController.cpp:
290         (WebCore::FocusController::setFocusedElement):
291         (WebCore::FocusController::timeSinceFocusWasSet const):
292         * page/FocusController.h:
293         * page/FrameView.cpp:
294         (WebCore::FrameView::reset):
295         (WebCore::FrameView::willPaintContents):
296         (WebCore::FrameView::didPaintContents):
297         * page/FrameView.h:
298         * page/animation/AnimationBase.cpp:
299         (WebCore::AnimationBase::freezeAtTime):
300         (WebCore::AnimationBase::beginAnimationUpdateTime const):
301         * page/animation/AnimationBase.h:
302         (WebCore::AnimationBase::onAnimationStartResponse):
303         * page/animation/CSSAnimationController.cpp:
304         (WebCore::CSSAnimationControllerPrivate::beginAnimationUpdateTime):
305         (WebCore::CSSAnimationControllerPrivate::receivedStartTimeResponse):
306         (WebCore::CSSAnimationControllerPrivate::startTimeResponse):
307         (WebCore::CSSAnimationController::notifyAnimationStarted):
308         * page/animation/CSSAnimationController.h:
309         * page/animation/CSSAnimationControllerPrivate.h:
310         * page/mac/WheelEventDeltaFilterMac.h:
311         * page/mac/WheelEventDeltaFilterMac.mm:
312         (WebCore::WheelEventDeltaFilterMac::beginFilteringDeltas):
313         (WebCore::WheelEventDeltaFilterMac::updateFromDelta):
314         (WebCore::WheelEventDeltaFilterMac::endFilteringDeltas):
315         * platform/ControlStates.h:
316         (WebCore::ControlStates::timeSinceControlWasFocused const):
317         (WebCore::ControlStates::setTimeSinceControlWasFocused):
318         * platform/PlatformSpeechSynthesisUtterance.h:
319         (WebCore::PlatformSpeechSynthesisUtterance::startTime const):
320         (WebCore::PlatformSpeechSynthesisUtterance::setStartTime):
321         * platform/gamepad/PlatformGamepad.h:
322         (WebCore::PlatformGamepad::lastUpdateTime const):
323         (WebCore::PlatformGamepad::connectTime const):
324         (WebCore::PlatformGamepad::PlatformGamepad):
325         * platform/gamepad/cocoa/GameControllerGamepad.mm:
326         (WebCore::GameControllerGamepad::setupAsExtendedGamepad):
327         (WebCore::GameControllerGamepad::setupAsGamepad):
328         * platform/gamepad/mac/HIDGamepad.cpp:
329         (WebCore::HIDGamepad::HIDGamepad):
330         (WebCore::HIDGamepad::valueChanged):
331         * platform/graphics/GraphicsLayer.cpp:
332         (WebCore::GraphicsLayer::suspendAnimations):
333         * platform/graphics/GraphicsLayer.h:
334         * platform/graphics/GraphicsLayerClient.h:
335         (WebCore::GraphicsLayerClient::notifyAnimationStarted):
336         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
337         (WebCore::LayerClient::platformCALayerAnimationStarted):
338         (WebCore::AVFWrapper::createImageForTimeInRect):
339         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
340         (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect):
341         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
342         * platform/graphics/ca/GraphicsLayerCA.cpp:
343         (WebCore::GraphicsLayerCA::addAnimation):
344         (WebCore::GraphicsLayerCA::pauseAnimation):
345         (WebCore::GraphicsLayerCA::platformCALayerAnimationStarted):
346         (WebCore::GraphicsLayerCA::setAnimationOnLayer):
347         (WebCore::GraphicsLayerCA::pauseCAAnimationOnLayer):
348         (WebCore::GraphicsLayerCA::createAnimationFromKeyframes):
349         (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
350         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
351         * platform/graphics/ca/GraphicsLayerCA.h:
352         (WebCore::GraphicsLayerCA::LayerPropertyAnimation::LayerPropertyAnimation):
353         (WebCore::GraphicsLayerCA::AnimationProcessingAction::AnimationProcessingAction):
354         * platform/graphics/ca/LayerPool.cpp:
355         (WebCore::LayerPool::LayerPool):
356         (WebCore::LayerPool::addLayer):
357         (WebCore::LayerPool::decayedCapacity const):
358         (WebCore::LayerPool::pruneTimerFired):
359         * platform/graphics/ca/LayerPool.h:
360         * platform/graphics/ca/PlatformCAAnimation.h:
361         * platform/graphics/ca/PlatformCALayer.h:
362         * platform/graphics/ca/PlatformCALayerClient.h:
363         (WebCore::PlatformCALayerClient::platformCALayerAnimationStarted):
364         * platform/graphics/ca/TileGrid.cpp:
365         (WebCore::TileGrid::revalidateTiles):
366         (WebCore::TileGrid::startedNewCohort):
367         (WebCore::TileGrid::TileCohortInfo::timeUntilExpiration):
368         (WebCore::TileGrid::cohortRemovalTimerFired):
369         * platform/graphics/ca/TileGrid.h:
370         (WebCore::TileGrid::TileCohortInfo::TileCohortInfo):
371         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
372         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
373         (mediaTimeToCurrentTime):
374         (-[WebAnimationDelegate animationDidStart:]):
375         (PlatformCALayerCocoa::animationStarted):
376         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
377         (WebCore::CACFLayerTreeHost::notifyAnimationsStarted):
378         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
379         (PlatformCALayerWin::animationStarted):
380         (PlatformCALayerWin::layerTreeAsString const):
381         * platform/graphics/ca/win/PlatformCALayerWin.h:
382         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
383         (WebCore::WebCoreDecompressionSession::decodeSample):
384         * platform/graphics/texmap/BitmapTexturePool.cpp:
385         (WebCore::BitmapTexturePool::releaseUnusedTexturesTimerFired):
386         * platform/graphics/texmap/BitmapTexturePool.h:
387         (WebCore::BitmapTexturePool::Entry::markIsInUse):
388         (WebCore::BitmapTexturePool::Entry::canBeReleased const):
389         (): Deleted.
390         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
391         (WebCore::GraphicsLayerTextureMapper::GraphicsLayerTextureMapper):
392         (WebCore::GraphicsLayerTextureMapper::addAnimation):
393         (WebCore::GraphicsLayerTextureMapper::pauseAnimation):
394         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
395         * platform/graphics/texmap/TextureMapperAnimation.cpp:
396         (WebCore::TextureMapperAnimation::TextureMapperAnimation):
397         (WebCore::TextureMapperAnimation::apply):
398         (WebCore::TextureMapperAnimation::pause):
399         (WebCore::TextureMapperAnimation::resume):
400         (WebCore::TextureMapperAnimation::computeTotalRunningTime):
401         (WebCore::TextureMapperAnimations::pause):
402         (WebCore::TextureMapperAnimations::suspend):
403         * platform/graphics/texmap/TextureMapperAnimation.h:
404         (WebCore::TextureMapperAnimation::startTime const):
405         (WebCore::TextureMapperAnimation::pauseTime const):
406         * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
407         (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
408         (WebCore::TextureMapperFPSCounter::updateFPSAndDisplay):
409         * platform/graphics/texmap/TextureMapperFPSCounter.h:
410         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
411         (WebCore::TextureMapperPlatformLayerBuffer::markUsed):
412         (WebCore::TextureMapperPlatformLayerBuffer::lastUsedTime const):
413         (): Deleted.
414         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
415         (WebCore::TextureMapperPlatformLayerProxy::releaseUnusedBuffersTimerFired):
416         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
417         (WebCore::CoordinatedGraphicsLayer::addAnimation):
418         (WebCore::CoordinatedGraphicsLayer::pauseAnimation):
419         (WebCore::CoordinatedGraphicsLayer::suspendAnimations):
420         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
421         * platform/mediastream/RealtimeMediaSource.h:
422         * platform/mediastream/RealtimeOutgoingVideoSource.cpp:
423         (WebCore::RealtimeOutgoingVideoSource::sendFrame):
424         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
425         (WebCore::LibWebRTCAudioModule::StartPlayoutOnAudioThread):
426         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
427         (WebCore::DisplayCaptureSourceCocoa::startProducingData):
428         (WebCore::DisplayCaptureSourceCocoa::stopProducingData):
429         (WebCore::DisplayCaptureSourceCocoa::elapsedTime):
430         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
431         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
432         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
433         (WebCore::MockRealtimeAudioSourceMac::render):
434         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
435         (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer):
436         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
437         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
438         (WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer):
439         (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable):
440         * platform/mock/MockRealtimeAudioSource.cpp:
441         (WebCore::MockRealtimeAudioSource::startProducingData):
442         (WebCore::MockRealtimeAudioSource::stopProducingData):
443         (WebCore::MockRealtimeAudioSource::elapsedTime):
444         (WebCore::MockRealtimeAudioSource::tick):
445         (WebCore::MockRealtimeAudioSource::delaySamples):
446         * platform/mock/MockRealtimeAudioSource.h:
447         (WebCore::MockRealtimeAudioSource::render):
448         * platform/mock/MockRealtimeVideoSource.cpp:
449         (WebCore::MockRealtimeVideoSource::startProducingData):
450         (WebCore::MockRealtimeVideoSource::stopProducingData):
451         (WebCore::MockRealtimeVideoSource::elapsedTime):
452         (WebCore::MockRealtimeVideoSource::drawText):
453         (WebCore::MockRealtimeVideoSource::delaySamples):
454         (WebCore::MockRealtimeVideoSource::generateFrame):
455         * platform/mock/MockRealtimeVideoSource.h:
456         * platform/network/DNSResolveQueue.cpp:
457         (WebCore::DNSResolveQueue::DNSResolveQueue):
458         (WebCore::DNSResolveQueue::isUsingProxy):
459         * platform/network/DNSResolveQueue.h:
460         * rendering/RenderBoxModelObject.cpp:
461         (WebCore::RenderBoxModelObject::suspendAnimations):
462         * rendering/RenderBoxModelObject.h:
463         * rendering/RenderElement.cpp:
464         (WebCore::RenderElement::paintFocusRing):
465         * rendering/RenderImage.cpp:
466         (WebCore::RenderImage::paintAreaElementFocusRing):
467         * rendering/RenderLayerBacking.cpp:
468         (WebCore::RenderLayerBacking::notifyAnimationStarted):
469         (WebCore::RenderLayerBacking::suspendAnimations):
470         * rendering/RenderLayerBacking.h:
471         * rendering/RenderLayerCompositor.cpp:
472         (WebCore::RenderLayerCompositor::didPaintBacking):
473         * rendering/RenderProgress.cpp:
474         (WebCore::RenderProgress::RenderProgress):
475         (WebCore::RenderProgress::animationProgress const):
476         (WebCore::RenderProgress::updateAnimationState):
477         * rendering/RenderProgress.h:
478         * rendering/RenderTheme.cpp:
479         (WebCore::RenderTheme::animationDurationForProgressBar const):
480         * rendering/RenderTheme.h:
481         * rendering/RenderThemeGtk.cpp:
482         (WebCore::RenderThemeGtk::animationDurationForProgressBar const):
483         * rendering/RenderThemeGtk.h:
484         * rendering/RenderThemeIOS.h:
485         * rendering/RenderThemeIOS.mm:
486         (WebCore::RenderThemeIOS::animationDurationForProgressBar const):
487         * rendering/RenderThemeMac.h:
488         * rendering/RenderThemeMac.mm:
489         (WebCore::RenderThemeMac::animationDurationForProgressBar const):
490         * svg/animation/SMILTimeContainer.cpp:
491         (WebCore::SMILTimeContainer::SMILTimeContainer):
492         (WebCore::SMILTimeContainer::elapsed const):
493         (WebCore::SMILTimeContainer::isActive const):
494         (WebCore::SMILTimeContainer::isPaused const):
495         (WebCore::SMILTimeContainer::isStarted const):
496         (WebCore::SMILTimeContainer::begin):
497         (WebCore::SMILTimeContainer::pause):
498         (WebCore::SMILTimeContainer::resume):
499         (WebCore::SMILTimeContainer::setElapsed):
500         (WebCore::SMILTimeContainer::timerFired):
501         * svg/animation/SMILTimeContainer.h:
502         * testing/Internals.cpp:
503         (WebCore::Internals::delayMediaStreamTrackSamples):
504         * testing/MockGamepad.cpp:
505         (WebCore::MockGamepad::MockGamepad):
506         (WebCore::MockGamepad::updateDetails):
507         (WebCore::MockGamepad::setAxisValue):
508         (WebCore::MockGamepad::setButtonValue):
509
510 2018-03-02  Alejandro G. Castro  <alex@igalia.com>
511
512         Make LibWebRTCProvider port agnostic again after r215424
513         https://bugs.webkit.org/show_bug.cgi?id=183080
514
515         Reviewed by Youenn Fablet.
516
517         In the r215424 commit the webRTCAvailable function started to use a function from the DARWIN platform,
518         we have moved that code to the cocoa class and created a glib implementation that will be used in the future
519         to implement the LibWebRTCProviderGlib class.
520
521         No new tests, this is a refactor.
522
523         * Sources.txt: Add the compilation of the new file.
524         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: Remove the webRTCAvailable function from this file.
525         (WebCore::LibWebRTCProvider::create): We want to use this even when LIBWEBRTC is not used.
526         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
527         (WebCore::LibWebRTCProvider::webRTCAvailable): Moved the code from the LibWebRTCProvider class.
528         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp:
529         (WebCore::LibWebRTCProvider::webRTCAvailable): Add the glib implementation, basically true, we are always
530         linking libwebrtc for the moment in these situations.
531
532 2018-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
533
534         REGRESSION(r222843): [HarfBuzz] Combining enclosed keycap not correctly handled
535         https://bugs.webkit.org/show_bug.cgi?id=183246
536
537         Reviewed by Michael Catanzaro.
538
539         We are not correctly handling the combining enclosed keycap since we switched to use
540         ComplexTextController. This is because fontForCombiningCharacterSequence() always returns the font of the first
541         character, without checking if that font can render the whole sequence or not. Before 222843, the shaper did
542         that check when creating the text runs. In this case the sequence was split and a different font was used for the
543         text and the mark. This patch makes fontForCombiningCharacterSequence() try to find a suitable font for the
544         whole sequence, first looking at the CSS fallbacks and finally at system ones. The result is much better than
545         the old one, because we use the same font for both the text and the mark. If there isn't any font to render the
546         mark, then we fallback to use the first character font, since we will end up rendering the missing glyph
547         character, it's better to use the same font than the first character one.
548
549         Test: fast/text/combining-enclosing-keycap.html
550
551         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
552         (WebCore::FontCascade::fontForCombiningCharacterSequence const): Check if the first charatcer font can render
553         the whole sequence, trying with fallbacks otherwise.
554         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
555         (WebCore::Font::canRenderCombiningCharacterSequence const): Check if the font face has glyphs for the whole
556         sequence not just the first character.
557
558 2018-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
559
560         [FreeType] Remove FontPlatformData fallbacks
561         https://bugs.webkit.org/show_bug.cgi?id=183210
562
563         Reviewed by Michael Catanzaro.
564
565         They are only used by FontCache::systemFallbackForCharacters() where a direct FcFontMatch provides the same
566         or better results.
567
568         * platform/graphics/FontPlatformData.h: Remove fallbacks.
569         * platform/graphics/freetype/FontCacheFreeType.cpp:
570         (WebCore::FontCache::systemFallbackForCharacters): Use FcFontMatch() only.
571         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
572         (WebCore::FontPlatformData::fallbacks): Removed.
573
574 2018-03-01  Commit Queue  <commit-queue@webkit.org>
575
576         Unreviewed, rolling out r229153.
577         https://bugs.webkit.org/show_bug.cgi?id=183274
578
579         it is breaking imported/w3c/web-platform-tests/service-workers
580         /service-worker/clients-matchall-exact-controller.https.html
581         (Requested by youenn on #webkit).
582
583         Reverted changeset:
584
585         "Clients should register to StorageProcess with their service
586         worker registration identifier"
587         https://bugs.webkit.org/show_bug.cgi?id=182313
588         https://trac.webkit.org/changeset/229153
589
590 2018-03-01  Youenn Fablet  <youenn@apple.com>
591
592         Clients should register to StorageProcess with their service worker registration identifier
593         https://bugs.webkit.org/show_bug.cgi?id=182313
594
595         Reviewed by Chris Dumez.
596
597         No observable change of behavior in regular conditions.
598         When service worker process crashes, the service worker identifiers sent by the WebProcess might be wrong
599         and we will not be able to retrieve the registration from these identifiers.
600         The storage process will be able to still process correctly messages coming from the WebProcess to register clients of the registration.
601         Otherwise, there is a chance that WebProcess clients will not be added to the SWServerRegistration.m_clientsUsingRegistration maps.
602
603         * dom/Document.cpp:
604         (WebCore::Document::setServiceWorkerConnection):
605         * workers/service/SWClientConnection.h:
606         * workers/service/server/SWServer.cpp:
607         (WebCore::SWServer::registerServiceWorkerClient):
608         * workers/service/server/SWServer.h:
609
610 2018-03-01  Youenn Fablet  <youenn@apple.com>
611
612         Add API test to validate setting of service worker and cache storage directories
613         https://bugs.webkit.org/show_bug.cgi?id=182543
614
615         Reviewed by Chris Dumez.
616
617         Covered by API tests.
618
619         Add getters to service worker registration directory.
620
621         * testing/Internals.cpp:
622         (WebCore::Internals::serviceWorkerRegistrationDirectory):
623         * testing/Internals.h:
624         * testing/Internals.idl:
625         * workers/service/SWClientConnection.h:
626         * workers/service/server/RegistrationDatabase.h:
627         (WebCore::RegistrationDatabase::serviceWorkerRegistrationDirectory const):
628         * workers/service/server/RegistrationStore.h:
629         (WebCore::RegistrationStore::serviceWorkerRegistrationDirectory const):
630         * workers/service/server/SWServer.h:
631         (WebCore::SWServer::serviceWorkerRegistrationDirectory const):
632
633 2018-03-01  Youenn Fablet  <youenn@apple.com>
634
635         SWServer::removeClientServiceWorkerRegistration should not log an error if there is no registration
636         https://bugs.webkit.org/show_bug.cgi?id=183248
637
638         Reviewed by Chris Dumez.
639
640         No change of behavior.
641         Removed the error logging.
642         As can be seen from running api and layout tests, a web process can ask a registration to be unregistered
643         and by the time it goes to the StorageProcess, the registration is already cleared.
644
645         * workers/service/server/SWServer.cpp:
646         (WebCore::SWServer::removeClientServiceWorkerRegistration):
647
648 2018-03-01  Daniel Bates  <dabates@apple.com>
649
650         CSS ::selection stroke-color and stroke-width are not applied to selected text in text fields
651         and ::selection:window-inactive stroke-color and stroke-width are never applied
652         https://bugs.webkit.org/show_bug.cgi?id=183178
653
654         Reviewed by David Hyatt.
655
656         This change fixes the following two issues:
657             1. Properties stroke-color and stroke-width are not applied to the ::selection pseudo-
658                element of text fields.
659             2. Properties stroke-color and stroke-width are never applied to ::selection:window-inactive
660                pseudo elements.
661
662         Currently when computing the paint styles for selected text we query the cached styles for
663         the ::selection pseudo element on the renderer. Text fields are implemented using a User Agent
664         shadow DOM. With regards to issue (1) the renderer queried was the inner most renderer for
665         the text in the text field. But it should have been the shadow host renderer (i.e. the renderer
666         for the <input>). With regards to issue (2) we cannot retrieve cached styles for the
667         ::selection pseudo element because it can be effected by a pseudo class, :window-inactive,
668         which matches when the page is deactivated (i.e. the window is in the background as the user
669         made another window the frontmost window). Both of these issues are fixed by making use
670         of RenderElement::selectionPseudoStyle().
671
672         Tests: fast/selectors/selection-window-inactive-stroke-color.html
673                fast/selectors/selection-window-inactive-text-shadow.html
674                fast/selectors/text-field-selection-stroke-color.html
675                fast/selectors/text-field-selection-text-shadow.html
676                fast/selectors/text-field-selection-window-inactive-stroke-color.html
677                fast/selectors/text-field-selection-window-inactive-text-shadow.html
678
679         * rendering/RenderText.h:
680         (WebCore::RenderText::selectionPseudoStyle const): Add a convenience function that turns
681         around and calls the function of the same name on its parent.
682         * rendering/TextPaintStyle.cpp:
683         (WebCore::computeTextSelectionPaintStyle): Modified to use RenderText::selectionPseudoStyle()
684         instead of directly querying for the cached styles for the ::selection pseudo element.
685
686 2018-03-01  Per Arne Vollan  <pvollan@apple.com>
687
688         Scrollbar preferences are ignored when the WebContent process doesn't have access to the WindowServer.
689         https://bugs.webkit.org/show_bug.cgi?id=183231
690         <rdar://problem/37793457>
691
692         Reviewed by Brent Fulgham.
693
694         When the WebContent process doesn't have access to the WindowServer, the scrollbars are always of the overlay type.
695         The notification about scrollbar preferences is never received by the WebContent process when there is no
696         WindowServer access. This can be fixed by adding an observer of scrollbar preferences in the UI process, and
697         notifying the WebProcess about this by sending it a message. This message should also contain the preferred
698         scrollbar type, since the call '[NSScroller preferredScrollerStyle]' will always return the overlay style when
699         there is no WindowServer access.
700
701         No new tests, covered by existing tests.
702
703         * WebCore.xcodeproj/project.pbxproj:
704         * platform/mac/NSScrollerImpDetails.h:
705         * platform/mac/NSScrollerImpDetails.mm:
706         (WebCore::ScrollerStyle::recommendedScrollerStyle):
707         (WebCore::ScrollerStyle::setUseOverlayScrollbars):
708         (WebCore::recommendedScrollerStyle): Deleted.
709         * platform/mac/ScrollAnimatorMac.mm:
710         (WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
711         (WebCore::ScrollAnimatorMac::mouseEnteredScrollbar const):
712         (WebCore::ScrollAnimatorMac::mouseExitedScrollbar const):
713         (WebCore::ScrollAnimatorMac::shouldScrollbarParticipateInHitTesting):
714         * platform/mac/ScrollbarThemeMac.mm:
715         (WebCore::ScrollbarThemeMac::registerScrollbar):
716         (WebCore::ScrollbarThemeMac::scrollbarThickness):
717         (WebCore::ScrollbarThemeMac::usesOverlayScrollbarsChanged):
718
719 2018-03-01  Myles C. Maxfield  <mmaxfield@apple.com>
720
721         Temporarily enable user-installed-fonts everywhere until we can stop crashing on launch
722         https://bugs.webkit.org/show_bug.cgi?id=183255
723
724         Unreviewed.
725
726         Tests are already disabled.
727
728         * platform/graphics/cocoa/FontCacheCoreText.cpp:
729
730 2018-03-01  Basuke Suzuki  <Basuke.Suzuki@sony.com>
731
732         [Curl] Split DNS cache expiration and connection timeout setting.
733         https://bugs.webkit.org/show_bug.cgi?id=182979
734
735         It was mis-implemented and was named ambiguous name 'enableTimeout'.
736         Implement each feature correctly.
737
738         Reviewed by Per Arne Vollan.
739
740         * platform/network/curl/CurlContext.cpp:
741         (WebCore::EnvironmentVariableReader::read):
742         (WebCore::EnvironmentVariableReader::defined):
743         (WebCore::EnvironmentVariableReader::readAs):
744         (WebCore::EnvironmentVariableReader::sscanTemplate):
745         (WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>):
746         (WebCore::CurlContext::CurlContext):
747         (WebCore::safeTimeValue):
748         (WebCore::CurlHandle::setDnsCacheTimeout):
749         (WebCore::CurlHandle::setConnectTimeout):
750         (WebCore::CurlHandle::setTimeout):
751         (WebCore::CurlHandle::enableTimeout): Deleted.
752         * platform/network/curl/CurlContext.h:
753         (WebCore::CurlContext::dnsCacheTimeout const):
754         (WebCore::CurlContext::connectTimeout const):
755         * platform/network/curl/CurlRequest.cpp:
756         (WebCore::CurlRequest::setupTransfer):
757
758 2018-03-01  Zalan Bujtas  <zalan@apple.com>
759
760         Remove RenderElement::s_noLongerAffectsParentBlock
761         https://bugs.webkit.org/show_bug.cgi?id=183196
762         <rdar://problem/38030797>
763
764         Reviewed by Antti Koivisto.
765
766         Remove the hack to track floating/out-of-flow changes between styleWillChange and styleDidChange.
767
768         Covered by existing tests.
769
770         * rendering/RenderBlockFlow.cpp:
771         (WebCore::RenderBlockFlow::styleDidChange):
772         * rendering/RenderElement.cpp:
773         (WebCore::RenderElement::styleWillChange):
774         (WebCore::RenderElement::noLongerAffectsParentBlock const):
775         (WebCore::RenderElement::styleDidChange):
776         * rendering/RenderElement.h:
777         (WebCore::RenderElement::noLongerAffectsParentBlock const): Deleted.
778
779 2018-03-01  Chris Dumez  <cdumez@apple.com>
780
781         imported/w3c/web-platform-tests/html/browsers/windows/browsing-context.html fails with async policy delegates
782         https://bugs.webkit.org/show_bug.cgi?id=183225
783         <rdar://problem/38003828>
784
785         Reviewed by Alex Christensen.
786
787         Bypass navigation policy check when loading about:blank. This does not seem necessary and it would not
788         be Web-compatible for such policy check to happen synchronously. This is because an iframe without src
789         or src="about:blank" should load synchronously as per HTML specification.
790
791         Test: http/wpt/html/browsers/windows/browsing-context.html
792
793         * loader/PolicyChecker.cpp:
794         (WebCore::PolicyChecker::checkNavigationPolicy):
795
796 2018-03-01  Christopher Reid  <chris.reid@sony.com>
797
798         [Curl] Linker errors in some curl files due to missing exports
799         https://bugs.webkit.org/show_bug.cgi?id=183238
800
801         Reviewed by Alex Christensen.
802
803         No new tests, no change in behavior.
804
805         Adding WEBCORE_EXPORT to functions now used in WebKit.
806
807         * platform/network/NetworkStorageSession.h:
808         * platform/network/curl/CookieJarDB.h:
809         * platform/network/curl/CurlContext.h:
810
811 2018-03-01  Commit Queue  <commit-queue@webkit.org>
812
813         Unreviewed, rolling out r229130.
814         https://bugs.webkit.org/show_bug.cgi?id=183244
815
816         It breaks AppleWin compilation (Requested by alexg__ on
817         #webkit).
818
819         Reverted changeset:
820
821         "Make LibWebRTCProvider port agnostic again after r215424"
822         https://bugs.webkit.org/show_bug.cgi?id=183080
823         https://trac.webkit.org/changeset/229130
824
825 2018-03-01  Alejandro G. Castro  <alex@igalia.com>
826
827         Make LibWebRTCProvider port agnostic again after r215424
828         https://bugs.webkit.org/show_bug.cgi?id=183080
829
830         Reviewed by Youenn Fablet.
831
832         In the r215424 commit the webRTCAvailable function started to use a function from the DARWIN platform,
833         we have moved that code to the cocoa class and created a glib implementation that will be used in the future
834         to implement the LibWebRTCProviderGlib class.
835
836         No new tests, this is a refactor.
837
838         * Sources.txt: Add the compilation of the new file.
839         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: Remove the webRTCAvailable function from this file.
840         (WebCore::LibWebRTCProvider::create): We want to use this even when LIBWEBRTC is not used.
841         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
842         (WebCore::LibWebRTCProvider::webRTCAvailable): Moved the code from the LibWebRTCProvider class.
843         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp:
844         (WebCore::LibWebRTCProvider::webRTCAvailable): Add the glib implementation, basically true, we are always
845         linking libwebrtc for the moment in these situations.
846
847 2018-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
848
849         [FreeType] Color emojis in WebKitGTK+ for great justice
850         https://bugs.webkit.org/show_bug.cgi?id=183155
851
852         Reviewed by Michael Catanzaro.
853
854         Emojis are actually rendered if there's an emoji font installed in the system, but the size is so tiny that we
855         don't see them. This is because for some reason the matrix we are getting from fontconfig contains a scale,
856         which we don't expect. We only get the fontconfig matrix to apply rotations in case of oblique fonts, and then we
857         always apply the scale for the computed pixel font size. Ignoring the fontconfig matrix scale fixes the issue.
858
859         * platform/graphics/freetype/FontCacheFreeType.cpp:
860         (WebCore::fontWeightToFontconfigWeight): Moved here since it's now used by configurePatternForFontDescription().
861         (WebCore::configurePatternForFontDescription): Helper function to apply the same options for fallback pattern.
862         (WebCore::createFontConfigPatternForCharacters): Use configurePatternForFontDescription().
863         (WebCore::findBestFontGivenFallbacks): Adopt the returned reference.
864         (WebCore::FontCache::systemFallbackForCharacters): Clean it up.
865         (WebCore::FontCache::createFontPlatformData): Use configurePatternForFontDescription().
866         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
867         (WebCore::FontPlatformData::buildScaledFont): Ignore the scale returned by fontconfig matrix.
868
869 2018-02-28  Philippe Normand  <pnormand@igalia.com>
870
871         [GStreamer] text samples no longer processed
872         https://bugs.webkit.org/show_bug.cgi?id=183212
873
874         Reviewed by Xabier Rodriguez-Calvar.
875
876         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
877         (WebCore::MediaPlayerPrivateGStreamer::newTextSample): Refer to
878         track stream ID instead of (potentially) manually generated track
879         ID stored as hashmap keys.
880
881 2018-02-28  Tim Horton  <timothy_horton@apple.com>
882
883         Push WTF_PLATFORM_IOS down into preprocessor.pm instead of trying to determine it inside
884         https://bugs.webkit.org/show_bug.cgi?id=183193
885
886         Reviewed by Andy Estes.
887
888         * DerivedSources.make:
889         * bindings/scripts/preprocessor.pm:
890         (applyPreprocessor):
891         Instead of trying to discern WTF_PLATFORM_IOS inside preprocessor.pm,
892         push it down from DerivedSources.make. Also clean up DerivedSources.make
893         a tiny bit by adding a variable, FEATURE_AND_PLATFORM_DEFINES, which
894         contains both FEATURE_DEFINES and WTF_PLATFORM macros if needed.
895
896 2018-02-28  Nan Wang  <n_wang@apple.com>
897
898         AX: AOM: Dispatch accessiblesetvalue event
899         https://bugs.webkit.org/show_bug.cgi?id=183021
900         <rdar://problem/37764242>
901
902         Reviewed by Chris Fleizach.
903
904         Accessibility events.
905         Spec: https://wicg.github.io/aom/spec/phase2.html
906
907         Added a new event type AccessibleSetValueEvent. 
908
909         Test: accessibility/mac/AOM-event-accessiblesetvalue.html
910
911         * CMakeLists.txt:
912         * DerivedSources.make:
913         * Sources.txt:
914         * WebCore.xcodeproj/project.pbxproj:
915         * accessibility/AccessibilityAllInOne.cpp:
916         * accessibility/AccessibilityNodeObject.cpp:
917         (WebCore::AccessibilityNodeObject::canSetValueAttribute const):
918         * accessibility/AccessibilityObject.cpp:
919         (WebCore::AccessibilityObject::press):
920         (WebCore::AccessibilityObject::dispatchAccessibilityEvent):
921         (WebCore::AccessibilityObject::dispatchAccessibleSetValueEvent):
922         * accessibility/AccessibilityObject.h:
923         * accessibility/AccessibilityRenderObject.cpp:
924         (WebCore::AccessibilityRenderObject::setValue):
925         * accessibility/AccessibilityScrollbar.cpp:
926         (WebCore::AccessibilityScrollbar::setValue):
927         * accessibility/AccessibilitySlider.cpp:
928         (WebCore::AccessibilitySlider::setValue):
929         * accessibility/AccessibleSetValueEvent.cpp: Added.
930         (WebCore::AccessibleSetValueEvent::AccessibleSetValueEvent):
931         * accessibility/AccessibleSetValueEvent.h: Added.
932         (WebCore::AccessibleSetValueEvent::create):
933         (WebCore::AccessibleSetValueEvent::value const):
934         * accessibility/AccessibleSetValueEvent.idl: Added.
935         * dom/Element.idl:
936         * dom/EventNames.h:
937         * dom/EventNames.in:
938
939 2018-02-28  Chris Dumez  <cdumez@apple.com>
940
941         html/browsers/browsing-the-web/navigating-across-documents/006.html fails with async policy delegates
942         https://bugs.webkit.org/show_bug.cgi?id=183168
943         <rdar://problem/37951341>
944
945         Reviewed by Alex Christensen.
946
947         The test has an anchor element with both a 'click' event handler which submits a form
948         and an href attribute. When clicking the link, as per specification, things happen in
949         this order:
950         1. We fire the click event at the anchor, which will execute the event handler and submit the form.
951            Submitting the form *schedules* a navigation to 'click.html'.
952         2. We execute the anchor activation code which *navigates* to 'href.html'. The navigation to
953            'href' is supposed to cancel the pending navigation to 'click.html' and we should navigate
954            to 'href.html', which is what the test asserts.
955
956         The issue for us is that we do not cancel pending navigations until after the navigation
957         policy decision is made, when the provisional loads actually starts, in FrameLoader::provisionalLoadStarted().
958         Because the policy decision for the navigation can now be made asynchronously, the NavigationScheduler
959         timer can now fire while the decision is made and we'll submit the form, thus navigating to
960         'click.html'.
961
962         To address the issue, we now cancel any pending navigations in FrameLoader::loadWithDocumentLoader(),
963         *before* doing the policy check for the navigation.
964
965         Test: http/wpt/html/browsers/browsing-the-web/navigating-across-documents/006.html
966
967         * loader/FrameLoader.cpp:
968         (WebCore::FrameLoader::loadWithDocumentLoader):
969
970 2018-02-28  John Wilander  <wilander@apple.com>
971
972         Add a second tier of prevalence to facilitate telemetry on very prevalent domains
973         https://bugs.webkit.org/show_bug.cgi?id=183218
974         <rdar://problem/37992388>
975
976         Reviewed by Brent Fulgham.
977
978         Test: http/tests/resourceLoadStatistics/classify-as-very-prevalent-based-on-mixed-statistics.html
979
980         * loader/ResourceLoadStatistics.cpp:
981         (WebCore::ResourceLoadStatistics::encode const):
982         (WebCore::ResourceLoadStatistics::decode):
983         (WebCore::ResourceLoadStatistics::toString const):
984         (WebCore::ResourceLoadStatistics::merge):
985             Handling of the new boolean field isVeryPrevalentResource.
986         * loader/ResourceLoadStatistics.h:
987             Added the new boolean field isVeryPrevalentResource.
988
989 2018-02-28  Alex Christensen  <achristensen@webkit.org>
990
991         Reduce use of NetworkingContext in WebKit
992         https://bugs.webkit.org/show_bug.cgi?id=183213
993
994         Reviewed by Brady Eidson.
995
996         NetworkingContext is intended to be used only with ResourceHandle, which is now only used in WebKitLegacy.
997         Now that we don't use ResourceHandle in the WebProcess, everything that was done through the NetworkingContext
998         can now be done a cleaner way with no change in behavior.
999
1000         * loader/FrameLoader.cpp:
1001         (WebCore::FrameLoader::loadResourceSynchronously):
1002         * loader/LinkLoader.cpp:
1003         (WebCore::LinkLoader::loadLink):
1004         * loader/LoaderStrategy.h:
1005         * platform/network/ProxyServer.h:
1006         * platform/network/cf/ProxyServerCFNet.cpp:
1007         (WebCore::proxyServersForURL):
1008         * platform/network/curl/ProxyServerCurl.cpp:
1009         (WebCore::proxyServersForURL):
1010         * platform/network/soup/ProxyServerSoup.cpp:
1011         (WebCore::proxyServersForURL):
1012
1013 2018-02-28  Zalan Bujtas  <zalan@apple.com>
1014
1015         Remove RenderElement::s_affectsParentBlock
1016         https://bugs.webkit.org/show_bug.cgi?id=183187
1017         <rdar://problem/37961079>
1018
1019         Reviewed by Antti Koivisto.
1020
1021         Remove the hack to track floating/out-of-flow changes between styleWillChange and styleDidChange.
1022
1023         Covered by existing tests.
1024
1025         * rendering/RenderElement.cpp:
1026         (WebCore::RenderElement::styleWillChange):
1027         (WebCore::RenderElement::styleDidChange):
1028         * rendering/RenderElement.h:
1029
1030 2018-02-28  Antti Koivisto  <antti@apple.com>
1031
1032         Filter attribute selectors with selector filter
1033         https://bugs.webkit.org/show_bug.cgi?id=183200
1034
1035         Reviewed by Zalan Bujtas.
1036
1037         Currently selector filtering is done based on tags, classes and ids. We should include attributes too.
1038
1039         This patch adds filtering based on attribute name (but not content).
1040
1041         * css/SelectorFilter.cpp:
1042         (WebCore::isExcludedAttribute):
1043
1044             Ignore id, class and style attributes. First two are already handled and the last is common but is rarely
1045             used in selectors.
1046
1047         (WebCore::collectElementIdentifierHashes):
1048
1049             Collect attributes.
1050             Remove the unnecessary StyledElement casting.
1051
1052         (WebCore::collectSimpleSelectorHash):
1053
1054             Collect attribute selectors.
1055
1056         (WebCore::chooseSelectorHashesForFilter):
1057
1058             Pick attributes with high priority for the filter as it is likely a good signal.
1059
1060 2018-02-27  Sergio Villar Senin  <svillar@igalia.com>
1061
1062         [WebVR] Convert VRPlatformDisplayInfo into a class
1063         https://bugs.webkit.org/show_bug.cgi?id=183162
1064
1065         Reviewed by Žan Doberšek.
1066
1067         In preparation for further changes we're transforming the
1068         VRPlatformDisplayInfo into a class. All the members are now private
1069         and the class provides the needed getters/setters.
1070
1071         Apart from that VRDisplayCapabilityFlags is now just an unsigned and
1072         the different flags are defined in VRDisplayCapabilityFlag enum.
1073         Another cleanup was the removal of VRDisplayCapabilities.cpp as
1074         everything can be implemented in the header.
1075
1076         * Modules/webvr/VRDisplay.cpp:
1077         (WebCore::VRDisplay::VRDisplay):
1078         (WebCore::VRDisplay::isConnected const):
1079         (WebCore::VRDisplay::stageParameters const):
1080         * Modules/webvr/VRDisplayCapabilities.cpp: Removed.
1081         * Modules/webvr/VRDisplayCapabilities.h:
1082         (WebCore::VRDisplayCapabilities::hasPosition const):
1083         (WebCore::VRDisplayCapabilities::hasOrientation const):
1084         (WebCore::VRDisplayCapabilities::hasExternalDisplay const):
1085         (WebCore::VRDisplayCapabilities::canPresent const):
1086         (WebCore::VRDisplayCapabilities::maxLayer const):
1087         (WebCore::VRDisplayCapabilities::VRDisplayCapabilities):
1088         * Sources.txt:
1089         * platform/vr/VRPlatformDisplay.h:
1090         (WebCore::VRPlatformDisplayInfo::displayName const):
1091         (WebCore::VRPlatformDisplayInfo::setDisplayName):
1092         (WebCore::VRPlatformDisplayInfo::isConnected const):
1093         (WebCore::VRPlatformDisplayInfo::setIsConnected):
1094         (WebCore::VRPlatformDisplayInfo::isMounted const):
1095         (WebCore::VRPlatformDisplayInfo::setIsMounted):
1096         (WebCore::VRPlatformDisplayInfo::capabilityFlags const):
1097         (WebCore::VRPlatformDisplayInfo::setCapabilityFlags):
1098         (WebCore::VRPlatformDisplayInfo::displayIdentifier const):
1099         (WebCore::VRPlatformDisplayInfo::setDisplayIdentifier):
1100         (WebCore::VRPlatformDisplayInfo::eyeTranslation const):
1101         (WebCore::VRPlatformDisplayInfo::setEyeTranslation):
1102         (WebCore::VRPlatformDisplayInfo::eyeFieldOfView const):
1103         (WebCore::VRPlatformDisplayInfo::setEyeFieldOfView):
1104         (WebCore::VRPlatformDisplayInfo::renderSize const):
1105         (WebCore::VRPlatformDisplayInfo::setRenderSize):
1106         (WebCore::VRPlatformDisplayInfo::setPlayAreaBounds):
1107         (WebCore::VRPlatformDisplayInfo::playAreaBounds const):
1108         (WebCore::VRPlatformDisplayInfo::setSittingToStandingTransform):
1109         (WebCore::VRPlatformDisplayInfo::sittingToStandingTransform const):
1110         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
1111         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
1112         (WebCore::VRPlatformDisplayOpenVR::updateEyeParameters):
1113         (WebCore::VRPlatformDisplayOpenVR::updateStageParameters):
1114
1115 2018-02-27  Commit Queue  <commit-queue@webkit.org>
1116
1117         Unreviewed, rolling out r229060.
1118         https://bugs.webkit.org/show_bug.cgi?id=183198
1119
1120         This patch causes crashes on two SVG tests (Requested by fredw
1121         on #webkit).
1122
1123         Reverted changeset:
1124
1125         "Relayout frames after AsyncFrameScrolling or FrameFlattening
1126         option is changed"
1127         https://bugs.webkit.org/show_bug.cgi?id=183081
1128         https://trac.webkit.org/changeset/229060
1129
1130 2018-02-27  Youenn Fablet  <youenn@apple.com>
1131
1132         Do not trigger a service worker match in case of document redirection if it will be already served by AppCache
1133         https://bugs.webkit.org/show_bug.cgi?id=183185
1134         <rdar://problem/37693796>
1135
1136         Reviewed by Chris Dumez.
1137
1138         Disabling service worker matching in case there is a substitute data.
1139         Otherwise there is a risk for a double load, substitute data first and the new load
1140         triggered if matching a new registration.
1141         A future fix should first do service worker registration matching and if there is no registration query appcache.
1142
1143         Test: http/tests/appcache/main-resource-redirect-with-sw.html
1144
1145         * loader/DocumentLoader.cpp:
1146         (WebCore::DocumentLoader::redirectReceived):
1147
1148 2018-02-27  Tim Horton  <timothy_horton@apple.com>
1149
1150         Ensure target triple is propagated correctly to DerivedSources.make
1151         https://bugs.webkit.org/show_bug.cgi?id=183189
1152         <rdar://problem/37959694>
1153
1154         Reviewed by Dan Bernstein.
1155
1156         If we don't propagate the target triple, we can sometimes build with
1157         the wrong options enabled.
1158
1159         * Configurations/Base.xcconfig:
1160         Mentioning LLVM_TARGET_TRIPLE_SUFFIX here is required to get it to be available to scripts.
1161
1162         * DerivedSources.make:
1163         Propagate the target triple into our compiler invocations.
1164
1165 2018-02-27  Doug Russell  <doug@getitdownonpaper.com>
1166
1167         AX: Spell check and style attributes should be optional when fetching attributed string
1168         https://bugs.webkit.org/show_bug.cgi?id=160744
1169
1170         Reviewed by Chris Fleizach.
1171
1172         The overhead of fetching a spell checked attributed string via AX API is substantial. 
1173         In some cases on the order of 7/8 of the total time spent fetching the string.
1174
1175         This change introduces the new attribute AXAttributedStringForTextMarkerRangeWithOptions which accepts an NSDictionary as it's parameter with keys "AXTextMarkerRange" (AXTextMarkerRangeRef) and "AXSpellCheck" (NSNumber(BOOL)).
1176
1177         AXAttributedStringForTextMarkerRange will remain unchanged.
1178
1179         Tests: accessibility/mac/attributed-string/attributed-string-for-range-with-options.html
1180                accessibility/mac/attributed-string/attributed-string-for-range.html
1181
1182         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1183         (AXAttributedStringAppendText):
1184         (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:]):
1185         (-[WebAccessibilityObjectWrapper accessibilityParameterizedAttributeNames]):
1186         (-[WebAccessibilityObjectWrapper doAXAttributedStringForRange:]):
1187         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
1188         (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]): Deleted.
1189
1190 2018-02-27  Daniel Bates  <dabates@apple.com>
1191
1192         Standardize terminology for marked text
1193         https://bugs.webkit.org/show_bug.cgi?id=180999
1194
1195         Reviewed by Zalan Bujtas.
1196
1197         The name MarkerSubrange is a misnomer for a data structure that associates a text subrange with a type
1198         and optional document marker. In particular, a MarkerSubrange may not always correspond to a document
1199         marker. For instance, selected text is represented using a MarkerSubrange that does not have a
1200         corresponding document marker. Let's standardize on the phrase "marked text" as the canonical way to
1201         describe these tagged text subranges.
1202
1203         * Sources.txt:
1204         * WebCore.xcodeproj/project.pbxproj:
1205         * rendering/InlineTextBox.cpp:
1206         (WebCore::InlineTextBox::localSelectionRect const):
1207         (WebCore::InlineTextBox::MarkedTextStyle::areBackgroundMarkedTextStylesEqual):
1208         (WebCore::InlineTextBox::MarkedTextStyle::areForegroundMarkedTextStylesEqual):
1209         (WebCore::InlineTextBox::MarkedTextStyle::areDecorationMarkedTextStylesEqual):
1210         (WebCore::InlineTextBox::StyledMarkedText::StyledMarkedText):
1211         (WebCore::createMarkedTextFromSelectionInBox):
1212         (WebCore::InlineTextBox::paint):
1213         (WebCore::InlineTextBox::paintPlatformDocumentMarkers):
1214         (WebCore::InlineTextBox::paintPlatformDocumentMarker):
1215         (WebCore::InlineTextBox::computeStyleForUnmarkedMarkedText const):
1216         (WebCore::InlineTextBox::resolveStyleForMarkedText):
1217         (WebCore::InlineTextBox::subdivideAndResolveStyle):
1218         (WebCore::InlineTextBox::coalesceAdjacentMarkedTexts):
1219         (WebCore::InlineTextBox::collectMarkedTextsForDraggedContent):
1220         (WebCore::InlineTextBox::collectMarkedTextsForDocumentMarkers):
1221         (WebCore::InlineTextBox::paintMarkedTexts):
1222         (WebCore::InlineTextBox::paintMarkedTextBackground):
1223         (WebCore::InlineTextBox::paintMarkedTextForeground):
1224         (WebCore::InlineTextBox::paintMarkedTextDecoration):
1225         (WebCore::InlineTextBox::paintCompositionBackground):
1226         (WebCore::InlineTextBox::MarkerSubrangeStyle::areBackgroundMarkerSubrangeStylesEqual): Deleted.
1227         (WebCore::InlineTextBox::MarkerSubrangeStyle::areForegroundMarkerSubrangeStylesEqual): Deleted.
1228         (WebCore::InlineTextBox::MarkerSubrangeStyle::areDecorationMarkerSubrangeStylesEqual): Deleted.
1229         (WebCore::InlineTextBox::StyledMarkerSubrange::StyledMarkerSubrange): Deleted.
1230         (WebCore::createMarkerSubrangeFromSelectionInBox): Deleted.
1231         (WebCore::InlineTextBox::computeStyleForUnmarkedMarkerSubrange const): Deleted.
1232         (WebCore::InlineTextBox::resolveStyleForSubrange): Deleted.
1233         (WebCore::InlineTextBox::coalesceAdjacentSubranges): Deleted.
1234         (WebCore::InlineTextBox::collectSubrangesForDraggedContent): Deleted.
1235         (WebCore::InlineTextBox::collectSubrangesForDocumentMarkers): Deleted.
1236         (WebCore::InlineTextBox::paintMarkerSubranges): Deleted.
1237         (WebCore::InlineTextBox::paintTextSubrangeBackground): Deleted.
1238         (WebCore::InlineTextBox::paintTextSubrangeForeground): Deleted.
1239         (WebCore::InlineTextBox::paintTextSubrangeDecoration): Deleted.
1240         * rendering/InlineTextBox.h:
1241         (WebCore::InlineTextBox::paintMarkedTexts):
1242         (WebCore::InlineTextBox::paintMarkerSubranges): Deleted.
1243         * rendering/MarkedText.cpp: Renamed from Source/WebCore/rendering/MarkerSubrange.cpp.
1244         (WebCore::subdivide):
1245         * rendering/MarkedText.h: Renamed from Source/WebCore/rendering/MarkerSubrange.h.
1246         (WebCore::MarkedText::MarkedText):
1247         (WebCore::MarkedText::isEmpty const):
1248         (WebCore::MarkedText::operator!= const):
1249         (WebCore::MarkedText::operator== const):
1250
1251 2018-02-27  Chris Dumez  <cdumez@apple.com>
1252
1253         Unreviewed, roll out r228430.
1254
1255         Roll out r228430 now that it is no longer needed after r228852.
1256
1257         No new tests, initial fix is still covered by WebKit.RespondToPolicyForNavigationResponseAsynchronously
1258         API test.
1259
1260         * loader/FrameLoader.cpp:
1261         (WebCore::FrameLoader::stopLoading):
1262         * loader/NavigationScheduler.cpp:
1263         (WebCore::NavigationScheduler::schedule):
1264
1265 2018-02-27  Antoine Quint  <graouts@apple.com>
1266
1267         [Web Animations] Correct implementation of pending tasks and promises
1268         https://bugs.webkit.org/show_bug.cgi?id=183161
1269
1270         Reviewed by Dean Jackson.
1271
1272         We had an incorrect implementation of the spec due to two misinterpretations.
1273
1274         The first one is about pending tasks (play and pause) which the spec says should
1275         be performed by "scheduling a task". In WebCore, this means using postTask() on a
1276         ScriptExecutionContext, such as Document. One of the big practical changes is that
1277         calling play() on an animation correctly sets its startTime to null (unresolved)
1278         immediately after the call to play() returns before setting it to a resolved value
1279         when the task is performed asynchronously. As a result, the playState is now always
1280         accurate.
1281
1282         The second one is about promises where new promises need to be created in certain
1283         situations called out by the spec. We used to call clear() on them, but this merely
1284         resets the fulfillment or rejection state of the promise, while the spec requires
1285         a different object to be returned for the promise. We now create our promises using
1286         makeUniqueRef<> when new promise objects are expected to be created.
1287
1288         This patch also corrects a few smaller bugs and spec compliant issues, called out
1289         below, related to pending tasks and promises uncovered while looking at relevant
1290         WPT tests.
1291
1292         * animation/DocumentTimeline.h: Expose the Document used to create this timeline such
1293         that it may be used by WebAnimation objects registered for this timeline when scheduling
1294         a task is required via postTask().
1295         * animation/WebAnimation.cpp:
1296         (WebCore::WebAnimation::WebAnimation):
1297         (WebCore::WebAnimation::setBindingsStartTime):
1298         (WebCore::WebAnimation::setCurrentTime):
1299         (WebCore::WebAnimation::cancel): Ensure the finished promise has not already been fulfilled
1300         before rejecting it. While the spec does not specifically call this out, a promise may not
1301         be rejected after being fulfilled, and we would hit an ASSERT if we didn't also check that
1302         it was in the correct pending state before attemping to reject it.
1303         (WebCore::WebAnimation::resetPendingTasks):
1304         (WebCore::WebAnimation::finish):
1305         (WebCore::WebAnimation::updateFinishedState):
1306         (WebCore::WebAnimation::finishNotificationSteps):
1307         (WebCore::WebAnimation::play): We used to only check for a pending pause task before canceling
1308         that task, but the spec says to check for either a pending pause or play task (ie. pending())
1309         and to cancel whichever is scheduled.
1310         (WebCore::WebAnimation::runPendingPlayTask): We were missing an assertion called out by the
1311         spec when running a pending task.
1312         (WebCore::WebAnimation::pause):
1313         (WebCore::WebAnimation::runPendingPauseTask):
1314         (WebCore::WebAnimation::updatePendingTasks): We now use postTask() on the animation's associated
1315         timeline's document to schedule pending tasks for which the criteria to run are met, ie. there
1316         is an associated timeline.
1317         * animation/WebAnimation.h:
1318
1319 2018-02-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1320
1321         [Extra zoom mode] Implement additional SPI for adjusting viewport shrink-to-fit behavior
1322         https://bugs.webkit.org/show_bug.cgi?id=183100
1323         <rdar://problem/37840987>
1324
1325         Reviewed by Tim Horton.
1326
1327         Introduce new customization options to ViewportConfiguration. The first is m_forceHorizontalShrinkToFit, which
1328         (when set to true) forces the viewport to scale using shrink-to-fit heuristics, regardless of whether
1329         "shrink-to-fit=no" is specified via viewport parameters or if content width did not exceed minimum layout size.
1330         The second is m_viewSize, which reflects the true size of the viewport. See WebKit ChangeLog for more details.
1331
1332         Tests: ViewportSizingTests.ForceShrinkToFitViewportOverridesViewportParameters
1333                ViewportSizingTests.ShrinkToFitViewportWithMinimumAllowedLayoutWidth
1334
1335         * page/ViewportConfiguration.cpp:
1336         (WebCore::ViewportConfiguration::ViewportConfiguration):
1337         (WebCore::ViewportConfiguration::setMinimumLayoutSize):
1338
1339         Plumb the real size of the view alongside the minimum layout size when updating the minimum layout size.
1340
1341         (WebCore::ViewportConfiguration::setForceHorizontalShrinkToFit):
1342         (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const):
1343
1344         Bail early and return true if forceHorizontalShrinkToFit is set. This forces shrink-to-fit even in cases where
1345         "shrink-to-fit" is set to "no", or content dimensions don't exceed layout dimensions.
1346
1347         (WebCore::ViewportConfiguration::initialScaleFromSize const):
1348
1349         Use view dimensions rather than minimum layout dimensions when computing the initial scale. Minimum layout size
1350         is no longer always equal to the size of the view if the client has specified a minimum allowed layout width. As
1351         such, when computing the initial scale, to ensure that the content (which was laid out using the minimum layout
1352         size) fits within the real viewport, we need to divide real viewport dimensions by content dimensions.
1353
1354         (WebCore::ViewportConfiguration::minimumScale const):
1355
1356         Similarly, use view size instead of minimum layout size to compute minimum scale.
1357
1358         (WebCore::ViewportConfiguration::description const):
1359         * page/ViewportConfiguration.h:
1360
1361 2018-02-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1362
1363         Unreviewed, fix the debug build after r228877.
1364
1365         In the case where CAN_DISALLOW_USER_INSTALLED_FONTS is enabled, this function doesn't return anything when
1366         allowUserInstalledFonts != AllowUserInstalledFonts::No. Fix the build by moving `return nullptr;` back out of
1367         the `#else`.
1368
1369         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1370         (WebCore::installedFontMandatoryAttributes):
1371
1372 2018-02-27  Milan Crha  <mcrha@redhat.com>
1373
1374         Potential privacy issue: DNS prefetching can be re-enabled
1375         https://bugs.webkit.org/show_bug.cgi?id=182924
1376
1377         Reviewed by Michael Catanzaro.
1378
1379         * dom/Document.cpp:
1380         (WebCore::Document::parseDNSPrefetchControlHeader):
1381
1382 2018-02-26  Antoine Quint  <graouts@apple.com>
1383
1384         [Web Animations] Implement the procedure to set the target effect of an animation
1385         https://bugs.webkit.org/show_bug.cgi?id=183146
1386
1387         Reviewed by Dean Jackson.
1388
1389         We only had a partial implementation of setEffect() and we now update it to cover the entire
1390         implementation as mandated by the spec. While this doesn't yield any WPT results changes, this
1391         patch will help getting a significant number of new PASS results when we get around to implement
1392         correct support for async procedures (pending pause/play tasks and promises) in the next patch.
1393
1394         * animation/WebAnimation.cpp:
1395         (WebCore::WebAnimation::setEffect):
1396
1397 2018-02-26  Antoine Quint  <graouts@apple.com>
1398
1399         [Web Animations] Update the playState implementation
1400         https://bugs.webkit.org/show_bug.cgi?id=183145
1401
1402         Reviewed by Dean Jackson.
1403
1404         The Web Animations spec has changed since we first implemented the playState property and the "pending"
1405         enum value has been dropped since then (there is a separate "pending" property which we also implement).
1406         We update our implementation to match the latest spec text. This does not change WPT test results a lot,
1407         but this patch will help getting a significant number of new PASS results when we get around to implementing
1408         correct support for async procedures (pending pause/play tasks and promises) in a couple of patches.
1409   
1410         * animation/WebAnimation.cpp:
1411         (WebCore::WebAnimation::playState const):
1412         * animation/WebAnimation.h:
1413         * animation/WebAnimation.idl:
1414
1415 2018-02-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1416
1417         Address post-review comment after r229049.
1418         https://bugs.webkit.org/show_bug.cgi?id=183142
1419
1420         Reviewed by Tim Horton.
1421
1422         Wrap a newly added string literal with ASCIILiteral.
1423
1424         * rendering/RenderThemeIOS.mm:
1425         (WebCore::RenderThemeIOS::extraDefaultStyleSheet):
1426
1427 2018-02-26  Mark Lam  <mark.lam@apple.com>
1428
1429         Modernize FINALIZE_CODE and peer macros to use __VA_ARGS__ arguments.
1430         https://bugs.webkit.org/show_bug.cgi?id=183159
1431         <rdar://problem/37930837>
1432
1433         Reviewed by Keith Miller.
1434
1435         No new tests needed because this is just a refactoring patch.
1436
1437         * cssjit/SelectorCompiler.cpp:
1438         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
1439
1440 2018-02-26  Dan Bernstein  <mitz@apple.com>
1441
1442         Removed references to files that were removed in r228912.
1443
1444         * WebCore.xcodeproj/project.pbxproj: Removed references to SourcesIOS.txt and SourcesMac.txt.
1445
1446 2018-02-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1447
1448         [Extra zoom mode] Tweak UA stylesheet to improve legibility of rendered text
1449         https://bugs.webkit.org/show_bug.cgi?id=183142
1450         <rdar://problem/37912966>
1451
1452         Reviewed by Tim Horton.
1453
1454         Force text-size-adjust and hyphens to be always on in EXTRA_ZOOM_MODE. To accomplish this, we override the extra
1455         style sheet in RenderTheme to include these two style rules.
1456
1457         * rendering/RenderThemeIOS.h:
1458         * rendering/RenderThemeIOS.mm:
1459         (WebCore::RenderThemeIOS::extraDefaultStyleSheet):
1460
1461 2018-02-26  Don Olmstead  <don.olmstead@sony.com>
1462
1463         Fix WebCore includes within WebKitLegacy
1464         https://bugs.webkit.org/show_bug.cgi?id=183147
1465
1466         Reviewed by Tim Horton.
1467
1468         No new tests. No change in behavior.
1469
1470         * PlatformWin.cmake:
1471         * platform/win/GDIUtilities.h:
1472
1473 2018-02-26  Youenn Fablet  <youenn@apple.com>
1474
1475         Add some more release logging related to DocumentWriter::addData crash
1476         https://bugs.webkit.org/show_bug.cgi?id=183141
1477
1478         Reviewed by Chris Dumez.
1479
1480         No change of behavior.
1481         Add some additional release logging to verify whether DocumentWriter::begin was called and exited before updating its state.
1482
1483         * loader/DocumentLoader.cpp:
1484         (WebCore::DocumentLoader::commitData):
1485         * loader/DocumentWriter.cpp:
1486         (WebCore::DocumentWriter::begin):
1487         * loader/DocumentWriter.h:
1488
1489 2018-02-26  Antoine Quint  <graouts@apple.com>
1490
1491         [Web Animations] Implement the procedure to set the start time
1492         https://bugs.webkit.org/show_bug.cgi?id=183137
1493
1494         Reviewed by Dean Jackson.
1495
1496         Implement the procedure to set the start time as setBindingsStartTime() and use the setStartTime() method as
1497         an internal method to set the m_startTime instance variable and invalidate the timing model rather than run
1498         the entire procedure which should only be called when setting the "startTime" property through the JS API.
1499
1500         * animation/WebAnimation.cpp:
1501         (WebCore::WebAnimation::setTimeline):
1502         (WebCore::WebAnimation::setBindingsStartTime):
1503         (WebCore::WebAnimation::setStartTime):
1504         (WebCore::WebAnimation::silentlySetCurrentTime):
1505         (WebCore::WebAnimation::finish):
1506         (WebCore::WebAnimation::updateFinishedState):
1507         (WebCore::WebAnimation::runPendingPlayTask):
1508         (WebCore::WebAnimation::runPendingPauseTask):
1509
1510 2018-02-26  Christopher Reid  <chris.reid@sony.com>
1511
1512         [Curl] Cookies are not being added to the Cookie field in Request Headers
1513         https://bugs.webkit.org/show_bug.cgi?id=183095
1514
1515         Reviewed by Alex Christensen.
1516
1517         Populating the Cookie request header field now that cookies are no longer handled in libcurl.
1518
1519         * platform/network/curl/CookieJarCurlDatabase.cpp: Renaming the httpOnly variable as its actual use wasn't clear
1520         * platform/network/curl/ResourceHandleCurl.cpp:
1521
1522 2018-02-26  Antoine Quint  <graouts@apple.com>
1523
1524         [Web Animations] Ensure setting the hold time invalidates the timing model
1525         https://bugs.webkit.org/show_bug.cgi?id=183136
1526
1527         Reviewed by Dean Jackson.
1528
1529         We used to always set the m_holdTime member variable directly, but the computation of the currentTime
1530         depends on the value of m_holdTime, so setting the hold time should invalidate the timing model as well
1531         as setting the m_holdTime member variable. In this patch we add a new setHoldTime() private method that
1532         sets the member variable and invalidates the timing model.
1533
1534         * animation/WebAnimation.cpp:
1535         (WebCore::WebAnimation::setTimeline):
1536         (WebCore::WebAnimation::setHoldTime):
1537         (WebCore::WebAnimation::silentlySetCurrentTime):
1538         (WebCore::WebAnimation::setCurrentTime):
1539         (WebCore::WebAnimation::cancel):
1540         (WebCore::WebAnimation::finish):
1541         (WebCore::WebAnimation::updateFinishedState):
1542         (WebCore::WebAnimation::play):
1543         (WebCore::WebAnimation::runPendingPlayTask):
1544         (WebCore::WebAnimation::pause):
1545         (WebCore::WebAnimation::runPendingPauseTask):
1546         * animation/WebAnimation.h:
1547
1548 2018-02-26  Youenn Fablet  <youenn@apple.com>
1549
1550         MessagePort is not always destroyed in the right thread
1551         https://bugs.webkit.org/show_bug.cgi?id=183053
1552
1553         Reviewed by Chris Dumez.
1554
1555         Make existingMessagePortForIdentifier take a lambda so that we hold the lock until there
1556         is no longer a need to keep the MessagePort around.
1557         This is very time sensitive and does not happen a lot when running WPT tests.
1558
1559         Update existing call sites to pass a lambda.
1560
1561         * dom/MessagePort.cpp:
1562         (WebCore::MessagePort::existingMessagePortForIdentifier):
1563         * dom/MessagePort.h:
1564         * dom/messageports/MessagePortChannelProviderImpl.cpp:
1565         (WebCore::MessagePortChannelProviderImpl::postMessageToRemote):
1566         (WebCore::MessagePortChannelProviderImpl::checkProcessLocalPortForActivity):
1567
1568 2018-02-26  Commit Queue  <commit-queue@webkit.org>
1569
1570         Unreviewed, rolling out r226745.
1571         https://bugs.webkit.org/show_bug.cgi?id=183132
1572
1573         This is breaking some websites (Requested by youenn on
1574         #webkit).
1575
1576         Reverted changeset:
1577
1578         "Use no-cache fetch mode when loading main documents with
1579         location.reload()"
1580         https://bugs.webkit.org/show_bug.cgi?id=181285
1581         https://trac.webkit.org/changeset/226745
1582
1583 2018-02-26  Philippe Normand  <pnormand@igalia.com>
1584
1585         Unreviewed, USE_GSTREAMER_PLAYBIN3 build fix.
1586
1587         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1588         There is no such ENABLE_GSTREAMER_PLAYBIN3.
1589
1590 2018-02-26  Philippe Normand  <pnormand@igalia.com>
1591
1592         Unreviewed, manual rollout of r228866 causing EGL_BAD_CONTEXT errors
1593
1594         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1595         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
1596         Create an EGL display, even in Wayland.
1597
1598 2018-02-21  Sergio Villar Senin  <svillar@igalia.com>
1599
1600         [WebVR][OpenVR] Retrieve displayId and the z-depth of eye view frustum
1601         https://bugs.webkit.org/show_bug.cgi?id=182999
1602
1603         Reviewed by Žan Doberšek.
1604
1605         Retrieve the z-depth of the eye view frustum and the HMD unique id.
1606         The unique identifier is generated by the VRPlatormManager whereas
1607         we use the default values from the spec for the z-depth (those can
1608         be changed by applications later via JavaScript).
1609
1610         Once this lands the only remaining data to be retrieved from VR
1611         backends for VRDisplay is the pose (getPose() call) and the frame
1612         data (getFrameData() call).
1613
1614         * Modules/webvr/VRDisplay.cpp:
1615         (WebCore::VRDisplay::VRDisplay):
1616         (WebCore::VRDisplay::displayId const): Deleted.
1617         (WebCore::VRDisplay::displayName const): Deleted.
1618         (WebCore::VRDisplay::depthNear const): Deleted.
1619         (WebCore::VRDisplay::setDepthNear): Deleted.
1620         (WebCore::VRDisplay::depthFar const): Deleted.
1621         (WebCore::VRDisplay::setDepthFar): Deleted.
1622         * Modules/webvr/VRDisplay.h:
1623         (WebCore::VRDisplay::displayId const): Moved implementation from
1624         source file.
1625         (WebCore::VRDisplay::displayName const): Ditto.
1626         (WebCore::VRDisplay::depthNear const):
1627         (WebCore::VRDisplay::setDepthNear):
1628         (WebCore::VRDisplay::depthFar const):
1629         (WebCore::VRDisplay::setDepthFar):
1630         * platform/vr/VRManager.cpp:
1631         (WebCore::VRManager::generateUniqueDisplayIdentifier):
1632         * platform/vr/VRManager.h:
1633         * platform/vr/VRPlatformDisplay.h:
1634         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
1635         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
1636
1637 2018-02-26  Charlie Turner  <cturner@igalia.com>
1638
1639         Fix build error with !LOG_DISABLED
1640         https://bugs.webkit.org/show_bug.cgi?id=183049
1641
1642         Reviewed by Philippe Normand.
1643
1644         The following error message was being reported when doing a
1645         release build with -DLOG_DISABLED=0:
1646
1647         ../../Source/WebCore/dom/messageports/MessagePortChannel.cpp: In member function ‘void WebCore::MessagePortChannel::entanglePortWithProcess(const WebCore::MessagePortIdentifier&, WebCore::ProcessIdentifier)’:
1648 ../../Source/WebCore/dom/messageports/MessagePortChannel.cpp:85:111: error: ‘logString’ was not declared in this scope
1649      LOG(MessagePorts, "MessagePortChannel %s (%p) entangling port %s (that port has %zu messages available)", logString().utf8().data(), this, port.logString().utf8().data(), m_pendingMessages[i].size());
1650
1651         Other uses of logString are guarded by !LOG_DISABLED rather than
1652         NDEBUG, which was the cause of this issue.
1653
1654         * dom/messageports/MessagePortChannel.h: Guard using !LOG_DISABLED
1655         rather than NDEBUG.
1656
1657 2018-02-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1658
1659         [GStreamer] User current executable name instead of g_get_prgname() for gst_init
1660         https://bugs.webkit.org/show_bug.cgi?id=183119
1661
1662         Reviewed by Philippe Normand.
1663
1664         g_get_prgname() is only set for programs using GOptionContext, calling gtk_init or explicitly calling
1665         g_set_prgname(). Use WTF::getCurrentExecutableName() instead.
1666
1667         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
1668         (WebCore::initializeGStreamer):
1669
1670 2018-02-25  Wenson Hsieh  <wenson_hsieh@apple.com>
1671
1672         [Extra zoom mode] Disable downloadable binary fonts by default
1673         https://bugs.webkit.org/show_bug.cgi?id=183102
1674         <rdar://problem/37860699>
1675
1676         Reviewed by Tim Horton.
1677
1678         Disable downloadable binary fonts by default in extra zoom mode by making the initial value of
1679         `downloadableBinaryFontsEnabled` conditional. Layout tests are not possible at this time; test to be added once
1680         layout test support is in place.
1681
1682         * page/Settings.yaml:
1683         * page/SettingsBase.cpp:
1684         (WebCore::SettingsBase::defaultDownloadableBinaryFontsEnabled):
1685         * page/SettingsBase.h:
1686
1687 2018-02-25  Chris Dumez  <cdumez@apple.com>
1688
1689         Service workers do not work well inside Web.app
1690         https://bugs.webkit.org/show_bug.cgi?id=183105
1691         <rdar://problem/37864140>
1692
1693         Reviewed by Youenn Fablet.
1694
1695         SessionID::defaultSessionID() was hardcoded in the ServiceWorkerThread constructor
1696         instead of using the sessionID of the SWServer that created the service worker thread.
1697         As a result, when the Service Worker would establish a SWClientConnection to the
1698         server, it would use the wrong sessionID and would end up using a different SWServer
1699         (Since we have a different SWServer instance per sessionID). As a result,
1700         ServiceWorkerRegistration / ServiceWorker objects inside the service worker would not
1701         be kept in sync with the server (since they registered themselves with the wrong
1702         SWServer).
1703
1704         Covered by new API test.
1705
1706         * workers/service/ServiceWorkerContextData.cpp:
1707         (WebCore::ServiceWorkerContextData::isolatedCopy const):
1708         * workers/service/ServiceWorkerContextData.h:
1709         (WebCore::ServiceWorkerContextData::encode const):
1710         (WebCore::ServiceWorkerContextData::decode):
1711         * workers/service/context/ServiceWorkerThread.cpp:
1712         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1713         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1714         (WebCore::createPageForServiceWorker):
1715         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
1716         * workers/service/server/RegistrationDatabase.cpp:
1717         (WebCore::RegistrationDatabase::importRecords):
1718         * workers/service/server/RegistrationStore.h:
1719         (WebCore::RegistrationStore::server):
1720         * workers/service/server/SWServer.cpp:
1721         (WebCore::SWServer::updateWorker):
1722         * workers/service/server/SWServerWorker.cpp:
1723         (WebCore::SWServerWorker::contextData const):
1724
1725 2018-02-24  Fujii Hironori  <Hironori.Fujii@sony.com>
1726
1727         Null-dereference of the second argument `resource` of DocumentLoader::scheduleSubstituteResourceLoad
1728         https://bugs.webkit.org/show_bug.cgi?id=182920
1729
1730         Reviewed by Darin Adler.
1731
1732         A test case
1733         imported/w3c/web-platform-tests/html/browsers/offline/appcache/workers/appcache-worker.html
1734         always crashes due to a null-dereference if compiled and optimized
1735         by GCC 7.2. The second argument `resource` of
1736         DocumentLoader::scheduleSubstituteResourceLoad can be null if the
1737         resource can't be found in cache. I guess GCC optimizes inline
1738         HashMap::add based on assuming the `resource` never becomes null
1739         because its type is SubstituteResource&.
1740
1741         This changes introduces a new method
1742         DocumentLoader::scheduleCannotShowURLError because it looks tricky
1743         to pass a nullptr to the second argument of
1744         scheduleSubstituteResourceLoad.
1745
1746         No new tests (Covered by existing tests).
1747
1748         * loader/DocumentLoader.cpp:
1749         (WebCore::DocumentLoader::scheduleCannotShowURLError): Added a new method.
1750         * loader/DocumentLoader.h:
1751         * loader/appcache/ApplicationCacheHost.cpp:
1752         (WebCore::ApplicationCacheHost::maybeLoadResource):
1753         Call scheduleCannotShowURLError if the resource not found in the appcache.
1754
1755 2018-02-17  Darin Adler  <darin@apple.com>
1756
1757         Prepare for ExtendedColor changes (first step)
1758         https://bugs.webkit.org/show_bug.cgi?id=182904
1759
1760         Reviewed by Sam Weinig.
1761
1762         * css/CSSValuePool.cpp:
1763         (WebCore::CSSValuePool::createColorValue): Use HashMap::ensure.
1764         (WebCore::CSSValuePool::createFontFamilyValue): Ditto.
1765         (WebCore::CSSValuePool::createFontFaceValue): Ditto.
1766
1767         * css/parser/CSSParserFastPaths.cpp:
1768         (WebCore::CSSParserFastPaths::maybeParseValue): Tightened up
1769         the logic a bit.
1770
1771         * html/canvas/CanvasRenderingContext2D.cpp: Removed many unneeded includes.
1772
1773         * inspector/InspectorCanvas.cpp:
1774         (WebCore::InspectorCanvas::recordAction): Updated for Ref instead of
1775         RefPtr and to use move semantics.
1776         (WebCore::buildArrayForAffineTransform): Return Ref instead of RefPtr.
1777         (WebCore::buildArrayForVector): Ditto.
1778         (WebCore::InspectorCanvas::buildInitialState): Ditto. Also use auto more.
1779         (WebCore::InspectorCanvas::buildAction): Ditto.
1780         (WebCore::InspectorCanvas::buildArrayForCanvasGradient): Ditto.
1781         (WebCore::InspectorCanvas::buildArrayForCanvasPattern): Ditto.
1782         (WebCore::InspectorCanvas::buildArrayForImageData): Ditto.
1783         * inspector/InspectorCanvas.h: Updated for the above. Also us "using" instead
1784         of typedef and removed unneeded ErrorString typedef and some includes.
1785
1786         * page/DragController.cpp:
1787         (WebCore::DragController::concludeEditDrag): Use auto and Ref.
1788
1789         * platform/DragData.h: Used pragma once and reorganized includes a bit.
1790
1791         * platform/graphics/ImageFrame.h:
1792         (WebCore::ImageFrame::frameBytes const): Use uint32_t instead of RGBA32 to
1793         prepare for removal of the RGBA32 type coming in a future patch.
1794         * platform/graphics/ImageSource.cpp:
1795         (WebCore::ImageSource::cacheNativeImageAtIndex): Ditto.
1796         (WebCore::ImageSource::canUseAsyncDecoding): Ditto.
1797
1798         * platform/graphics/cocoa/GraphicsContextCocoa.mm: Tweaked #if for Mac-only
1799         code to use PLATFORM(MAC) to be easier to read.
1800         (WebCore::GraphicsContext::focusRingColor): Use sRGBColorSpaceRef instead of
1801         calling CGColorSpaceCreateWithName each time.
1802
1803         * platform/graphics/texmap/TextureMapperFPSCounter.cpp: Added include needed
1804         now that it was removed from some header.
1805
1806         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h: Use uint32_t
1807         instead of RGBA32 to prepare for removal of the RGBA32 type coming in a future patch.
1808         * platform/image-decoders/ScalableImageDecoder.cpp:
1809         (WebCore::ScalableImageDecoder::frameBytesAtIndex const): Ditto.
1810         * platform/image-decoders/cairo/ImageBackingStoreCairo.cpp:
1811         (WebCore::ImageBackingStore::image const): Ditto.
1812         * platform/image-decoders/gif/GIFImageDecoder.cpp:
1813         (WebCore::GIFImageDecoder::haveDecodedRow): Ditto.
1814         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
1815         (WebCore::setPixel): Ditto.
1816         (WebCore::JPEGImageDecoder::outputScanlines): Ditto.
1817         * platform/image-decoders/png/PNGImageDecoder.cpp:
1818         (WebCore::PNGImageDecoder::rowAvailable): Ditto.
1819         (WebCore::PNGImageDecoder::frameComplete): Ditto.
1820         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
1821         (WebCore::WEBPImageDecoder::decodeFrame): Ditto.
1822         (WebCore::WEBPImageDecoder::applyPostProcessing): Ditto.
1823
1824         * platform/mac/PlatformPasteboardMac.mm:
1825         (WebCore::PlatformPasteboard::color): Added comments.
1826
1827         * rendering/EllipsisBox.cpp:
1828         (WebCore::EllipsisBox::paintSelection): Use Color::isVisible.
1829
1830 2018-02-23  Chris Dumez  <cdumez@apple.com>
1831
1832         Crash under SchemeRegistry::shouldTreatURLSchemeAsLocal(WTF::String const&)
1833         https://bugs.webkit.org/show_bug.cgi?id=183066
1834         <rdar://problem/37804111>
1835
1836         Reviewed by Ryosuke Niwa.
1837
1838         SecurityOrigin objects are constructed on various threads. However, someone added a
1839         shouldTreatAsPotentiallyTrustworthy() call to the SecurityOrigin constructor which
1840         was not thread safe. This is because this function relies on SchemeRegistry::shouldTreatURLSchemeAsSecure()
1841         and SchemeRegistry::shouldTreatURLSchemeAsLocal() which were relying on global static HashMaps without
1842         locks.
1843
1844         Update SecurityOrigin to initialize m_isPotentiallyTrustworthy lazily, to avoid paying
1845         initialization cost in the constructor. This is only queries by SecurityContext::isSecureContext().
1846
1847         Make SchemeRegistry::shouldTreatURLSchemeAsLocal() and SchemeRegistry::shouldTreatURLSchemeAsSecure()
1848         thread-safe, since they are needed to initialize SecurityOrigin::m_isPotentiallyTrustworthy from
1849         various threads.
1850
1851         SchemeRegistry::shouldTreatURLSchemeAsSecure() is only called from SecurityOrigin (which requires
1852         thread-safety), and getUserMedia() which is not hot code so the extra locking there should not
1853         be an issue.
1854
1855         SchemeRegistry::shouldTreatURLSchemeAsLocal() is called from SecurityOrigin (which requires thread-
1856         safety). It is also called from isQuickLookPreviewURL(), MHTMLArchive::create(), Page::userStyleSheetLocationChanged(),
1857         isRemoteWebArchive() and HTMLPlugInImageElement. All these are not hot code so I do not think
1858         we need a fast path.
1859
1860         * page/SecurityOrigin.cpp:
1861         (WebCore::isLoopbackIPAddress):
1862         (WebCore::shouldTreatAsPotentiallyTrustworthy):
1863         (WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
1864         (WebCore::SecurityOrigin::isLocalHostOrLoopbackIPAddress):
1865         * page/SecurityOrigin.h:
1866         * platform/SchemeRegistry.cpp:
1867         (WebCore::localURLSchemesLock):
1868         (WebCore::localURLSchemes):
1869         (WebCore::secureSchemesLock):
1870         (WebCore::secureSchemes):
1871         (WebCore::SchemeRegistry::registerURLSchemeAsLocal):
1872         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsLocal):
1873         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal):
1874         (WebCore::SchemeRegistry::registerURLSchemeAsSecure):
1875         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsSecure):
1876         * platform/SchemeRegistry.h:
1877
1878 2018-02-23  Christopher Reid  <chris.reid@sony.com>
1879
1880         [Curl] Cookie Database files are wrongfully getting deleted when the database is opened
1881         https://bugs.webkit.org/show_bug.cgi?id=183051
1882
1883         Reviewed by Per Arne Vollan.
1884
1885         The file stat logic was backwards causing a wrongful detection of database corruption.
1886         Fixed the logic and abstracted these calls to use FileSystem.
1887
1888         * platform/network/curl/CookieJarDB.cpp:
1889
1890 2018-02-23  Zalan Bujtas  <zalan@apple.com>
1891
1892         [RenderTreeBuilder] Make RenderTreeBuilder::* classes WTF_MAKE_FAST_ALLOCATED
1893         https://bugs.webkit.org/show_bug.cgi?id=183084
1894         <rdar://problem/37828706>
1895
1896         Reviewed by Antti Koivisto.
1897
1898         * rendering/updating/RenderTreeBuilderBlock.h:
1899         * rendering/updating/RenderTreeBuilderBlockFlow.h:
1900         * rendering/updating/RenderTreeBuilderContinuation.h:
1901         * rendering/updating/RenderTreeBuilderFirstLetter.h:
1902         * rendering/updating/RenderTreeBuilderFormControls.h:
1903         * rendering/updating/RenderTreeBuilderFullScreen.h:
1904         * rendering/updating/RenderTreeBuilderInline.h:
1905         * rendering/updating/RenderTreeBuilderList.h:
1906         * rendering/updating/RenderTreeBuilderMathML.h:
1907         * rendering/updating/RenderTreeBuilderMultiColumn.h:
1908         * rendering/updating/RenderTreeBuilderRuby.h:
1909         * rendering/updating/RenderTreeBuilderSVG.h:
1910         * rendering/updating/RenderTreeBuilderTable.h:
1911         * rendering/updating/RenderTreeUpdaterGeneratedContent.h:
1912
1913 2018-02-23  Zalan Bujtas  <zalan@apple.com>
1914
1915         [RenderTreeBuilder] Move RenderFullScreen::createPlaceholder to RenderTreeBuilder
1916         https://bugs.webkit.org/show_bug.cgi?id=183027
1917         <rdar://problem/37773058>
1918
1919         Reviewed by Antti Koivisto.
1920
1921         No change in functionality.
1922
1923         * dom/Document.cpp:
1924         (WebCore::Document::setFullScreenRenderer):
1925         * dom/Document.h:
1926         * rendering/RenderFullScreen.cpp:
1927         (WebCore::RenderFullScreenPlaceholder::RenderFullScreenPlaceholder):
1928         (WebCore::RenderFullScreenPlaceholder::isRenderFullScreenPlaceholder const):
1929         (WebCore::RenderFullScreen::wrapNewRenderer):
1930         (WebCore::RenderFullScreen::wrapExistingRenderer):
1931         (): Deleted.
1932         (WebCore::RenderFullScreen::createPlaceholder): Deleted.
1933         * rendering/RenderFullScreen.h:
1934         * rendering/updating/RenderTreeBuilder.cpp:
1935         (WebCore::RenderTreeBuilder::createPlaceholderForFullScreen):
1936         * rendering/updating/RenderTreeBuilder.h:
1937         * rendering/updating/RenderTreeBuilderFullScreen.cpp:
1938         (WebCore::RenderTreeBuilder::FullScreen::createPlaceholder):
1939         * rendering/updating/RenderTreeBuilderFullScreen.h:
1940
1941 2018-02-23  Zalan Bujtas  <zalan@apple.com>
1942
1943         [RenderTreeBuilder] Add WARN_UNUSED_RETURN to detach()
1944         https://bugs.webkit.org/show_bug.cgi?id=183073
1945         <rdar://problem/37814585>
1946
1947         Reviewed by Antti Koivisto.
1948
1949         So that we don't destroy a renderer accidentally.
1950
1951         * rendering/updating/RenderTreeBuilderBlock.h:
1952         * rendering/updating/RenderTreeBuilderRuby.h:
1953         * rendering/updating/RenderTreeBuilderSVG.h:
1954
1955 2018-02-22  Antoine Quint  <graouts@apple.com>
1956
1957         REGRESSION (r228445): A big pause button shows over YouTube videos if you tap "Tap To Unmute" on iOS
1958         https://bugs.webkit.org/show_bug.cgi?id=183074
1959         <rdar://problem/37747028>
1960
1961         Reviewed by Eric Carlson.
1962
1963         Test: media/modern-media-controls/start-support/start-support-disable-controls-and-re-enable-post-play.html
1964
1965         In the fix for webkit.org/b/182668, we made it so that when the "controls" attribute is absent from a media
1966         element we stop listening to the bulk of media events and prevent controls from updating any DOM properties
1967         so as to minimize the amount of CPU usage by the Web process.
1968
1969         An unfortunate side effect was that, if the media controls were disabled at the time the video starts playing,
1970         the StartSupport class would thus not catch the "play" event and would not be able to set the "hasPlayed"
1971         property to "true" on the MediaController, which would then prevent the _shouldShowStartButton() from returning
1972         "false". As a result, if the "controls" attribute was turned back on after the media started playing, they
1973         would default to showing the start button, which would be then in the play state, ie. showing the pause icon.
1974
1975         We now set the "hasPlayed" property in the "play" event handler on MediaController, which is always registered
1976         regardless of the "controls" attribute setting. We also ensure we invalidate the "showStartButton" property on
1977         the media controls when StartSupport is enabled, which is the case when the "controls" attribute is toggled back
1978         to "true" from a previous "false" value.
1979
1980         * Modules/modern-media-controls/media/media-controller.js:
1981         (MediaController.prototype.handleEvent):
1982         * Modules/modern-media-controls/media/start-support.js:
1983         (StartSupport):
1984         (StartSupport.prototype.enable):
1985         (StartSupport.prototype.handleEvent):
1986         (StartSupport.prototype._updateShowsStartButton):
1987
1988 2018-02-23  Carlos Garcia Campos  <cgarcia@igalia.com>
1989
1990         [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser
1991         https://bugs.webkit.org/show_bug.cgi?id=173655
1992         <rdar://problem/37706341>
1993
1994         Reviewed by Philippe Normand.
1995
1996         Do not assume gst is only used in the WebProcess, the MIMETypeRegistry also uses gst to get the list of
1997         supported media types. Move the code to extract gst options from the process command line to a helper function
1998         and use it in the UI process to pass the options to the WebProcess, but also in the current process when gst is
1999         initialized without providing options.
2000
2001         Fixes several unit tests that use MIMETypeRegistry in the UI process.
2002
2003         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
2004         (WebCore::extractGStreamerOptionsFromCommandLine): Helper to get the gst options from the current process
2005         command line.
2006         (WebCore::initializeGStreamer): Ensure this is called once. Get the gst options from the given vector or extract
2007         it from the command line if not provided.
2008         * platform/graphics/gstreamer/GStreamerUtilities.h:
2009         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2010         (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements): Bring back the gst
2011         initialization here.
2012
2013 2018-02-23  Philippe Normand  <pnormand@igalia.com>
2014
2015         [GStreamer] HTTP totalBytes query returns 0 after seeking (sometimes)
2016         https://bugs.webkit.org/show_bug.cgi?id=183002
2017
2018         Reviewed by Xabier Rodriguez-Calvar.
2019
2020         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2021         (webkit_web_src_init): Initialize member variables. Also no need
2022         to set the appsrc size at that point.
2023         (webKitWebSrcStop): There is no need to reset the size when
2024         seeking. Size should in most cases represent the Content-Length
2025         response attribute, even when seeking.
2026         (webKitWebSrcStart): No need to reset the size attribute.
2027         (webKitWebSrcQueryWithParent): Let appsrc handle DURATION queries.
2028         (CachedResourceStreamingClient::responseReceived): Emit duration notification one time only.
2029
2030 2018-02-23  Philippe Normand  <pnormand@igalia.com>
2031
2032         [GStreamer] media/video-src-blob-using-open-panel.html crashes in Debug
2033         https://bugs.webkit.org/show_bug.cgi?id=183005
2034
2035         Reviewed by Xabier Rodriguez-Calvar.
2036
2037         Test: media/video-src-blob-using-open-panel.html
2038
2039         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2040         (WebCore::convertToInternalProtocol): Also convert blob URIs
2041         because they're handled by our httpsrc element.
2042         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2043         (webKitWebSrcGetProtocols): Prefix blob URIs too, for consistency purpose.
2044
2045 2018-02-22  Yusuke Suzuki  <utatane.tea@gmail.com>
2046
2047         Remove currentTime() / currentTimeMS()
2048         https://bugs.webkit.org/show_bug.cgi?id=183052
2049
2050         Reviewed by Mark Lam.
2051
2052         * Modules/geolocation/Geolocation.cpp:
2053         (WebCore::Geolocation::haveSuitableCachedPosition):
2054         * dom/DOMTimeStamp.h:
2055         (WebCore::convertSecondsToDOMTimeStamp):
2056         * fileapi/File.cpp:
2057         (WebCore::File::File):
2058         (WebCore::File::lastModified const):
2059         * history/HistoryItem.cpp:
2060         (WebCore::generateSequenceNumber):
2061         * html/BaseDateAndTimeInputType.cpp:
2062         (WebCore::BaseDateAndTimeInputType::defaultValueForStepUp const):
2063         * html/DateTimeInputType.cpp:
2064         (WebCore::DateTimeInputType::defaultValueForStepUp const):
2065         * html/MonthInputType.cpp:
2066         (WebCore::MonthInputType::defaultValueForStepUp const):
2067         * html/TimeInputType.cpp:
2068         (WebCore::TimeInputType::defaultValueForStepUp const):
2069         * inspector/agents/InspectorNetworkAgent.cpp:
2070         (WebCore::InspectorNetworkAgent::willSendRequest):
2071         (WebCore::InspectorNetworkAgent::willSendWebSocketHandshakeRequest):
2072         * loader/EmptyFrameLoaderClient.h:
2073         * loader/FormSubmission.cpp:
2074         (WebCore::generateFormDataIdentifier):
2075         * loader/FrameLoader.cpp:
2076         (WebCore::FrameLoader::clientRedirected):
2077         * loader/FrameLoader.h:
2078         * loader/FrameLoaderClient.h:
2079         * loader/NavigationScheduler.cpp:
2080         * page/History.cpp:
2081         (WebCore::History::stateObjectAdded):
2082         * page/History.h:
2083         * page/PageOverlay.cpp:
2084         (WebCore::PageOverlay::startFadeAnimation):
2085         (WebCore::PageOverlay::fadeAnimationTimerFired):
2086         * page/PageOverlay.h:
2087         * platform/graphics/cg/GraphicsContextCG.cpp:
2088         (WebCore::GraphicsContext::drawNativeImage):
2089         * platform/ios/LegacyTileLayerPool.h:
2090         * platform/ios/LegacyTileLayerPool.mm:
2091         (WebCore::LegacyTileLayerPool::LegacyTileLayerPool):
2092         (WebCore::LegacyTileLayerPool::addLayer):
2093         (WebCore::LegacyTileLayerPool::decayedCapacity const):
2094         (WebCore::LegacyTileLayerPool::prune):
2095         * platform/ios/SystemMemoryIOS.cpp:
2096         (WebCore::systemMemoryLevel):
2097         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
2098         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
2099
2100 2018-02-22  Per Arne Vollan  <pvollan@apple.com>
2101
2102         The WebContent process should not use NSScreen in the screenDepth implementation.
2103         https://bugs.webkit.org/show_bug.cgi?id=183048
2104
2105         Reviewed by Brent Fulgham.
2106
2107         NSScreen method calls should be done in the UIProcess, since these calls will communicate with
2108         the WindowServer. The screen depth property can be retrieved in the UIProcess, and sent to the
2109         WebContent process, where it is cached. Whenever screen properties change, the UIProcess will
2110         send the new screen properties to the WebProcess.
2111
2112         No new tests, covered by existing tests.
2113
2114         * platform/ScreenProperties.h:
2115         (WebCore::ScreenProperties::encode const):
2116         (WebCore::ScreenProperties::decode):
2117         * platform/mac/PlatformScreenMac.mm:
2118         (WebCore::getScreenProperties):
2119         (WebCore::screenDepth):
2120         (WebCore::screenDepthPerComponent):
2121         (WebCore::screenRect):
2122         (WebCore::screenAvailableRect):
2123
2124 2018-02-22  Zalan Bujtas  <zalan@apple.com>
2125
2126         [RenderTreeBuilder] Rename insertChild() -> attach(), takeChild() -> detach() and removeAndDestroy() -> destroy()
2127         https://bugs.webkit.org/show_bug.cgi?id=183061
2128         <rdar://problem/37800269>
2129
2130         Reviewed by Ryosuke Niwa.
2131
2132         ...and moveChildTo() -> move() (moveChildrenTo() -> moveChildren()),
2133         removeFromParentAndDestroyCleaningUpAnonymousWrappers() -> destroyAndCleanUpAnonymousWrappers()
2134
2135         No change in functionality.
2136
2137         * dom/Document.cpp:
2138         (WebCore::Document::destroyRenderTree):
2139         (WebCore::Document::setFullScreenRenderer):
2140         * rendering/RenderBlockFlow.cpp:
2141         (WebCore::RenderBlockFlow::styleDidChange):
2142         * rendering/RenderButton.cpp:
2143         (WebCore::RenderButton::setText):
2144         * rendering/RenderElement.cpp:
2145         (WebCore::RenderElement::didAttachChild):
2146         (WebCore::RenderElement::didInsertChild): Deleted.
2147         * rendering/RenderElement.h:
2148         * rendering/RenderFullScreen.cpp:
2149         (WebCore::RenderFullScreen::wrapNewRenderer):
2150         (WebCore::RenderFullScreen::wrapExistingRenderer):
2151         (WebCore::RenderFullScreen::unwrapRenderer):
2152         (WebCore::RenderFullScreen::createPlaceholder):
2153         * rendering/RenderMenuList.cpp:
2154         (RenderMenuList::didAttachChild):
2155         (RenderMenuList::setText):
2156         (RenderMenuList::didInsertChild): Deleted.
2157         * rendering/RenderMenuList.h:
2158         * rendering/RenderQuote.cpp:
2159         (WebCore::RenderQuote::updateTextRenderer):
2160         * rendering/RenderTextFragment.cpp:
2161         (WebCore::RenderTextFragment::setText):
2162         * rendering/updating/RenderTreeBuilder.cpp:
2163         (WebCore::RenderTreeBuilder::destroy):
2164         (WebCore::RenderTreeBuilder::attach):
2165         (WebCore::RenderTreeBuilder::attachIgnoringContinuation):
2166         (WebCore::RenderTreeBuilder::detach):
2167         (WebCore::RenderTreeBuilder::attachToRenderElement):
2168         (WebCore::RenderTreeBuilder::attachToRenderElementInternal):
2169         (WebCore::RenderTreeBuilder::move):
2170         (WebCore::RenderTreeBuilder::moveAllChildren):
2171         (WebCore::RenderTreeBuilder::moveChildren):
2172         (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloats):
2173         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
2174         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
2175         (WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock):
2176         (WebCore::RenderTreeBuilder::destroyAndCleanUpAnonymousWrappers):
2177         (WebCore::RenderTreeBuilder::detachFromRenderGrid):
2178         (WebCore::RenderTreeBuilder::detachFromRenderElement):
2179         (WebCore::RenderTreeBuilder::attachToRenderGrid):
2180         (WebCore::RenderTreeBuilder::removeAndDestroy): Deleted.
2181         (WebCore::RenderTreeBuilder::insertChild): Deleted.
2182         (WebCore::RenderTreeBuilder::insertChildIgnoringContinuation): Deleted.
2183         (WebCore::RenderTreeBuilder::takeChild): Deleted.
2184         (WebCore::RenderTreeBuilder::insertChildToRenderElement): Deleted.
2185         (WebCore::RenderTreeBuilder::insertChildToRenderElementInternal): Deleted.
2186         (WebCore::RenderTreeBuilder::moveChildTo): Deleted.
2187         (WebCore::RenderTreeBuilder::moveAllChildrenTo): Deleted.
2188         (WebCore::RenderTreeBuilder::moveChildrenTo): Deleted.
2189         (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloatsTo): Deleted.
2190         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers): Deleted.
2191         (WebCore::RenderTreeBuilder::takeChildFromRenderGrid): Deleted.
2192         (WebCore::RenderTreeBuilder::takeChildFromRenderElement): Deleted.
2193         (WebCore::RenderTreeBuilder::insertChildToRenderGrid): Deleted.
2194         * rendering/updating/RenderTreeBuilder.h:
2195         * rendering/updating/RenderTreeBuilderBlock.cpp:
2196         (WebCore::RenderTreeBuilder::Block::attach):
2197         (WebCore::RenderTreeBuilder::Block::insertChildToContinuation):
2198         (WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation):
2199         (WebCore::RenderTreeBuilder::Block::removeLeftoverAnonymousBlock):
2200         (WebCore::RenderTreeBuilder::Block::detach):
2201         (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild):
2202         (WebCore::RenderTreeBuilder::Block::insertChild): Deleted.
2203         (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation): Deleted.
2204         (WebCore::RenderTreeBuilder::Block::takeChild): Deleted.
2205         * rendering/updating/RenderTreeBuilderBlock.h:
2206         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
2207         (WebCore::RenderTreeBuilder::BlockFlow::attach):
2208         (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloats):
2209         (WebCore::RenderTreeBuilder::BlockFlow::insertChild): Deleted.
2210         (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloatsTo): Deleted.
2211         * rendering/updating/RenderTreeBuilderBlockFlow.h:
2212         * rendering/updating/RenderTreeBuilderContinuation.cpp:
2213         (WebCore::RenderTreeBuilder::Continuation::cleanupOnDestroy):
2214         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
2215         (WebCore::RenderTreeBuilder::FirstLetter::cleanupOnDestroy):
2216         (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
2217         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
2218         * rendering/updating/RenderTreeBuilderFormControls.cpp:
2219         (WebCore::RenderTreeBuilder::FormControls::attach):
2220         (WebCore::RenderTreeBuilder::FormControls::detach):
2221         (WebCore::RenderTreeBuilder::FormControls::findOrCreateParentForChild):
2222         (WebCore::RenderTreeBuilder::FormControls::insertChild): Deleted.
2223         (WebCore::RenderTreeBuilder::FormControls::takeChild): Deleted.
2224         * rendering/updating/RenderTreeBuilderFormControls.h:
2225         * rendering/updating/RenderTreeBuilderFullScreen.cpp:
2226         (WebCore::RenderTreeBuilder::FullScreen::cleanupOnDestroy):
2227         * rendering/updating/RenderTreeBuilderInline.cpp:
2228         (WebCore::RenderTreeBuilder::Inline::attach):
2229         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
2230         (WebCore::RenderTreeBuilder::Inline::attachIgnoringContinuation):
2231         (WebCore::RenderTreeBuilder::Inline::splitFlow):
2232         (WebCore::RenderTreeBuilder::Inline::splitInlines):
2233         (WebCore::RenderTreeBuilder::Inline::childBecameNonInline):
2234         (WebCore::RenderTreeBuilder::Inline::insertChild): Deleted.
2235         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation): Deleted.
2236         * rendering/updating/RenderTreeBuilderInline.h:
2237         * rendering/updating/RenderTreeBuilderList.cpp:
2238         (WebCore::RenderTreeBuilder::List::updateItemMarker):
2239         * rendering/updating/RenderTreeBuilderMathML.cpp:
2240         (WebCore::RenderTreeBuilder::MathML::makeFences):
2241         (WebCore::RenderTreeBuilder::MathML::attach):
2242         (WebCore::RenderTreeBuilder::MathML::insertChild): Deleted.
2243         * rendering/updating/RenderTreeBuilderMathML.h:
2244         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
2245         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
2246         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
2247         (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant):
2248         (WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
2249         * rendering/updating/RenderTreeBuilderRuby.cpp:
2250         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
2251         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
2252         (WebCore::RenderTreeBuilder::Ruby::attach):
2253         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
2254         (WebCore::RenderTreeBuilder::Ruby::rubyBaseSafe):
2255         (WebCore::RenderTreeBuilder::Ruby::detach):
2256         (WebCore::RenderTreeBuilder::Ruby::insertChild): Deleted.
2257         (WebCore::RenderTreeBuilder::Ruby::takeChild): Deleted.
2258         * rendering/updating/RenderTreeBuilderRuby.h:
2259         * rendering/updating/RenderTreeBuilderSVG.cpp:
2260         (WebCore::RenderTreeBuilder::SVG::attach):
2261         (WebCore::RenderTreeBuilder::SVG::detach):
2262         (WebCore::RenderTreeBuilder::SVG::insertChild): Deleted.
2263         (WebCore::RenderTreeBuilder::SVG::takeChild): Deleted.
2264         * rendering/updating/RenderTreeBuilderSVG.h:
2265         * rendering/updating/RenderTreeBuilderTable.cpp:
2266         (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild):
2267         (WebCore::RenderTreeBuilder::Table::attach):
2268         (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
2269         (WebCore::RenderTreeBuilder::Table::insertChild): Deleted.
2270         * rendering/updating/RenderTreeBuilderTable.h:
2271         * rendering/updating/RenderTreeUpdater.cpp:
2272         (WebCore::RenderTreeUpdater::createRenderer):
2273         (WebCore::RenderTreeUpdater::createTextRenderer):
2274         (WebCore::RenderTreeUpdater::tearDownRenderers):
2275         (WebCore::RenderTreeUpdater::tearDownTextRenderer):
2276         (WebCore::RenderTreeUpdater::tearDownLeftoverPaginationRenderersIfNeeded):
2277         * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
2278         (WebCore::createContentRenderers):
2279
2280 2018-02-22  Chris Dumez  <cdumez@apple.com>
2281
2282         ResourceRequestBase::isolatedCopy() fails to isolate copy the cachePartition
2283         https://bugs.webkit.org/show_bug.cgi?id=183059
2284         <rdar://problem/37800202>
2285
2286         Reviewed by Youenn Fablet.
2287
2288         Update ResourceRequestBase::setAsIsolatedCopy() to call isolatedCopy() on the cachePartition as well,
2289         given that it is a String and it would not be safe to send it to another thread otherwise.
2290
2291         * platform/network/ResourceRequestBase.cpp:
2292         (WebCore::ResourceRequestBase::setAsIsolatedCopy):
2293
2294 2018-02-22  Chris Dumez  <cdumez@apple.com>
2295
2296         ServiceWorkerContainer::startScriptFetchForJob() fails to isolate copy the registrationKey before passing it to the main thread
2297         https://bugs.webkit.org/show_bug.cgi?id=183050
2298         <rdar://problem/37796881>
2299
2300         Reviewed by Youenn Fablet.
2301
2302         Create an isolated copy of the registrationKey before passing it to the main thread in ServiceWorkerContainer's
2303         startScriptFetchForJob() / jobFinishedLoadingScript() / jobFailedLoadingScript().
2304
2305         * workers/service/ServiceWorkerContainer.cpp:
2306         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
2307         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
2308         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
2309
2310 2018-02-22  Chris Dumez  <cdumez@apple.com>
2311
2312         ServiceWorkerContainer::scheduleJob() fails to isolate copy the jobData before passing it to the main thread
2313         https://bugs.webkit.org/show_bug.cgi?id=183046
2314         <rdar://problem/37793395>
2315
2316         Reviewed by Youenn Fablet.
2317
2318         Make sure we isolate copy the jobData before passing it to the main thread in ServiceWorkerContainer::scheduleJob().
2319         The jobData contains Strings / URLs so it is not safe to have non-isolated copies of it on various threads.
2320
2321         * workers/service/ServiceWorkerContainer.cpp:
2322         (WebCore::ServiceWorkerContainer::scheduleJob):
2323
2324 2018-02-22  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2325
2326         [Curl] Fix warning on clang.
2327         https://bugs.webkit.org/show_bug.cgi?id=182986
2328
2329         Reviewed by Konstantin Tokarev.
2330
2331         No new tests because there's no behaviro changes.
2332
2333         * platform/network/curl/CurlResourceHandleDelegate.cpp:
2334         (WebCore::CurlResourceHandleDelegate::curlDidSendData):
2335         (WebCore::CurlResourceHandleDelegate::curlDidReceiveBuffer):
2336         (WebCore::CurlResourceHandleDelegate::curlDidFailWithError):
2337         * platform/network/curl/CurlResourceHandleDelegate.h:
2338
2339 2018-02-22  Youenn Fablet  <youenn@apple.com>
2340
2341         WorkerCacheStorageConnection::doRemove can assert in case two frames try to delete the same cache at the same time
2342         https://bugs.webkit.org/show_bug.cgi?id=183041
2343
2344         Reviewed by Chris Dumez.
2345
2346         * Modules/cache/WorkerCacheStorageConnection.cpp:
2347         (WebCore::WorkerCacheStorageConnection::doRemove): Update the assertion to accept the
2348         case of an already deleted cache, i.e. returned identifer is 0.
2349
2350 2018-02-22  Alejandro G. Castro  <alex@igalia.com>
2351
2352         Remove some code leftovers in LibWebRTCMediaEndpoint and RealtimeOutgoingVideoSource classes
2353         https://bugs.webkit.org/show_bug.cgi?id=183031
2354
2355         Reviewed by Youenn Fablet.
2356
2357         This include and namespace are not required in the file.
2358
2359         Just removing unused code, no tests required.
2360
2361         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2362
2363 2018-02-22  Chris Dumez  <cdumez@apple.com>
2364
2365         Document.open() cancels existing provisional load but not navigation policy check
2366         https://bugs.webkit.org/show_bug.cgi?id=183012
2367         <rdar://problem/37755831>
2368
2369         Reviewed by Alex Christensen.
2370
2371         Test: fast/dom/Document/open-with-pending-load-async-policy.html
2372
2373         * dom/Document.cpp:
2374         (WebCore::Document::open):
2375         The existing code was calling FrameLoader::stopAllLoaders() when the loader's state
2376         is FrameStateProvisional. The issue is that the FrameLoader's state only gets set
2377         to FrameStateProvisional after the policy decision for the navigation is made.
2378         This means that we fail to cancel a pending load if is still in the policy decision
2379         stage, which can happen when the policy decision is made asynchronously. We now
2380         also cancel such pending navigation policy checks as well.
2381
2382         * loader/PolicyChecker.cpp:
2383         (WebCore::PolicyChecker::checkNavigationPolicy):
2384         Make sure the m_delegateIsDecidingNavigationPolicy flag gets reset inside the
2385         lambda. Otherwise, it gets reset too early when the policy decision is made
2386         asynchronously.
2387
2388 2018-02-22  Youenn Fablet  <youenn@apple.com>
2389
2390         Add release asserts for service worker fetch and postMessage events
2391         https://bugs.webkit.org/show_bug.cgi?id=183025
2392         rdar://problem/37765052
2393
2394         Reviewed by Daniel Bates.
2395
2396         Add release assertion so that a service worker will only dispatch a message event
2397         for clients and service workers with the same origin.
2398         No change of behavior.
2399
2400         * platform/network/ResourceRequestBase.h:
2401         * workers/service/context/ServiceWorkerThread.cpp:
2402         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
2403         * workers/service/context/ServiceWorkerThreadProxy.h:
2404
2405 2018-02-22  Miguel Gomez  <magomez@igalia.com>
2406
2407         including both gl3.h and gl2.h when USE_OPENGL_ES is enabled
2408         https://bugs.webkit.org/show_bug.cgi?id=183008
2409
2410         Reviewed by Michael Catanzaro.
2411
2412         Don't include GLES3 headers as we stick to GLES2 API resources.
2413
2414         No new tests, no behavior change.
2415
2416         * platform/graphics/GLContext.cpp:
2417
2418 2018-02-22  Ms2ger  <Ms2ger@igalia.com>
2419
2420         [GTK][WPE] Fix some build errors in service workers code
2421         https://bugs.webkit.org/show_bug.cgi?id=182966
2422
2423         Reviewed by Žan Doberšek.
2424
2425         No new tests: no change in behavior.
2426
2427         * workers/service/ServiceWorkerProvider.h: add missing forward declaration.
2428
2429 2018-02-21  Zalan Bujtas  <zalan@apple.com>
2430
2431         [RenderTreeBuilder] Move RenderObject::insertedInto() mutation logic to RenderTreeBuilder
2432         https://bugs.webkit.org/show_bug.cgi?id=183022
2433         <rdar://problem/37764326>
2434
2435         Reviewed by Antti Koivisto.
2436
2437         No change in functionality.
2438
2439         * rendering/RenderObject.cpp:
2440         (WebCore::RenderObject::insertedIntoTree):
2441         * rendering/updating/RenderTreeBuilder.cpp:
2442         (WebCore::RenderTreeBuilder::insertChildToRenderElementInternal):
2443         (WebCore::RenderTreeBuilder::moveChildrenTo):
2444         (WebCore::RenderTreeBuilder::multiColumnDescendantInserted): Deleted.
2445         * rendering/updating/RenderTreeBuilder.h:
2446
2447 2018-02-21  Tim Horton  <timothy_horton@apple.com>
2448
2449         Include all Cocoa sources in all Cocoa platform builds
2450         https://bugs.webkit.org/show_bug.cgi?id=183026
2451         <rdar://problem/37513101>
2452
2453         Reviewed by Dan Bernstein.
2454
2455         Similar to r228571, don't have separate Sources files for iOS and Mac.
2456         All sources now have #ifdefs that ensure that only the right ones
2457         build on the right platforms. This makes it much easier to reason
2458         about what builds where by just looking at the sources.
2459
2460         * SourcesCocoa.txt:
2461         * SourcesIOS.txt: Removed.
2462         * SourcesMac.txt: Removed.
2463         * WebCore.xcodeproj/project.pbxproj:
2464         * editing/WebContentReader.h:
2465         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
2466
2467 2018-02-21  Youenn Fablet  <youenn@apple.com>
2468
2469         Make SubstituteResource take a ResourceResponse r-value
2470         https://bugs.webkit.org/show_bug.cgi?id=183020
2471
2472         Reviewed by Alex Christensen.
2473
2474         No change of behavior.
2475         Make SubstituteResource take a ResourceResponse r-value.
2476         Update ArchiveResource accordingly.
2477         Take benefit of that in ApplicationCacheResource to set the response source to ApplicationCache
2478         before passing it to SubstituteResource constructor.
2479
2480         * loader/SubstituteResource.h:
2481         (WebCore::SubstituteResource::SubstituteResource):
2482         (WebCore::SubstituteResource::resourceResponse): Deleted.
2483         * loader/appcache/ApplicationCacheResource.cpp:
2484         (WebCore::ApplicationCacheResource::create):
2485         (WebCore::ApplicationCacheResource::ApplicationCacheResource):
2486         * loader/appcache/ApplicationCacheResource.h:
2487         (WebCore::ApplicationCacheResource::create): Deleted.
2488         * loader/archive/ArchiveResource.cpp:
2489         (WebCore::ArchiveResource::ArchiveResource):
2490
2491 2018-02-21  Zalan Bujtas  <zalan@apple.com>
2492
2493         [RenderTreeBuilder] ::willBeRemoved() does not need RenderTreeBuilder anymore.
2494         https://bugs.webkit.org/show_bug.cgi?id=183019
2495         <rdar://problem/37761421>
2496
2497         Reviewed by Antti Koivisto.
2498
2499         All the willBeDestroyed() mutations have been moved over to RenderTreeBuilder. 
2500
2501         No change in functionality.
2502
2503         * rendering/RenderBlock.cpp:
2504         (WebCore::RenderBlock::willBeDestroyed):
2505         * rendering/RenderBlock.h:
2506         * rendering/RenderBlockFlow.cpp:
2507         (WebCore::RenderBlockFlow::willBeDestroyed):
2508         * rendering/RenderBlockFlow.h:
2509         * rendering/RenderBox.cpp:
2510         (WebCore::RenderBox::willBeDestroyed):
2511         * rendering/RenderBox.h:
2512         * rendering/RenderBoxModelObject.cpp:
2513         (WebCore::RenderBoxModelObject::willBeDestroyed):
2514         * rendering/RenderBoxModelObject.h:
2515         * rendering/RenderCounter.cpp:
2516         (WebCore::RenderCounter::willBeDestroyed):
2517         * rendering/RenderCounter.h:
2518         * rendering/RenderElement.cpp:
2519         (WebCore::RenderElement::willBeDestroyed):
2520         * rendering/RenderElement.h:
2521         * rendering/RenderEmbeddedObject.cpp:
2522         (WebCore::RenderEmbeddedObject::willBeDestroyed):
2523         * rendering/RenderEmbeddedObject.h:
2524         * rendering/RenderFragmentedFlow.cpp:
2525         (WebCore::RenderFragmentedFlow::willBeDestroyed):
2526         * rendering/RenderFragmentedFlow.h:
2527         * rendering/RenderImage.cpp:
2528         (WebCore::RenderImage::willBeDestroyed):
2529         * rendering/RenderImage.h:
2530         * rendering/RenderInline.cpp:
2531         (WebCore::RenderInline::willBeDestroyed):
2532         * rendering/RenderInline.h:
2533         * rendering/RenderLayerModelObject.cpp:
2534         (WebCore::RenderLayerModelObject::willBeDestroyed):
2535         * rendering/RenderLayerModelObject.h:
2536         * rendering/RenderListBox.cpp:
2537         (WebCore::RenderListBox::willBeDestroyed):
2538         * rendering/RenderListBox.h:
2539         * rendering/RenderListMarker.cpp:
2540         (WebCore::RenderListMarker::willBeDestroyed):
2541         * rendering/RenderListMarker.h:
2542         * rendering/RenderMenuList.cpp:
2543         (WebCore::RenderMenuList::willBeDestroyed):
2544         * rendering/RenderMenuList.h:
2545         * rendering/RenderObject.cpp:
2546         (WebCore::RenderObject::willBeDestroyed):
2547         (WebCore::RenderObject::destroy):
2548         * rendering/RenderObject.h:
2549         * rendering/RenderReplaced.cpp:
2550         (WebCore::RenderReplaced::willBeDestroyed):
2551         * rendering/RenderReplaced.h:
2552         * rendering/RenderSearchField.cpp:
2553         (WebCore::RenderSearchField::willBeDestroyed):
2554         * rendering/RenderSearchField.h:
2555         * rendering/RenderSnapshottedPlugIn.cpp:
2556         (WebCore::RenderSnapshottedPlugIn::willBeDestroyed):
2557         * rendering/RenderSnapshottedPlugIn.h:
2558         * rendering/RenderText.cpp:
2559         (WebCore::RenderText::willBeDestroyed):
2560         * rendering/RenderText.h:
2561         * rendering/RenderTextControlMultiLine.cpp:
2562         (WebCore::RenderTextControlMultiLine::willBeDestroyed):
2563         * rendering/RenderTextControlMultiLine.h:
2564         * rendering/RenderVideo.cpp:
2565         (WebCore::RenderVideo::willBeDestroyed):
2566         * rendering/RenderVideo.h:
2567         * rendering/RenderWidget.cpp:
2568         (WebCore::RenderWidget::willBeDestroyed):
2569         * rendering/RenderWidget.h:
2570         * rendering/svg/RenderSVGBlock.cpp:
2571         (WebCore::RenderSVGBlock::willBeDestroyed):
2572         * rendering/svg/RenderSVGBlock.h:
2573         * rendering/svg/RenderSVGImage.cpp:
2574         (WebCore::RenderSVGImage::willBeDestroyed):
2575         * rendering/svg/RenderSVGImage.h:
2576         * rendering/svg/RenderSVGInline.cpp:
2577         (WebCore::RenderSVGInline::willBeDestroyed):
2578         * rendering/svg/RenderSVGInline.h:
2579         * rendering/svg/RenderSVGModelObject.cpp:
2580         (WebCore::RenderSVGModelObject::willBeDestroyed):
2581         * rendering/svg/RenderSVGModelObject.h:
2582         * rendering/svg/RenderSVGResourceContainer.cpp:
2583         (WebCore::RenderSVGResourceContainer::willBeDestroyed):
2584         * rendering/svg/RenderSVGResourceContainer.h:
2585         * rendering/svg/RenderSVGRoot.cpp:
2586         (WebCore::RenderSVGRoot::willBeDestroyed):
2587         * rendering/svg/RenderSVGRoot.h:
2588         * rendering/svg/RenderSVGText.cpp:
2589         (WebCore::RenderSVGText::willBeDestroyed):
2590         * rendering/svg/RenderSVGText.h:
2591
2592 2018-02-21  Per Arne Vollan  <pvollan@apple.com>
2593
2594         The WebContent process should not use NSScreen in the screenAvailableRect/screenRect implementations.
2595         https://bugs.webkit.org/show_bug.cgi?id=182855
2596
2597         Reviewed by Brent Fulgham.
2598
2599         On macOS, the functions screenAvailableRect and screenRect is implemented using NSScreen, which is communicating
2600         with the WindowServer. To avoid this WindowServer communication from the WebContent process when calling
2601         screenAvailableRect and screenRect, it is possible to let the UIProcess send a message to the WebContent
2602         process whenever there is a change in the display properties, and have the WebContent process cache these
2603         display properties. This message should also be sent to a newly started WebContent process.
2604
2605         No new tests, covered by existing tests.
2606
2607         * WebCore.xcodeproj/project.pbxproj:
2608         * platform/PlatformScreen.h:
2609         * platform/mac/PlatformScreenMac.mm:
2610         (WebCore::getScreenProperties):
2611         (WebCore::screenProperties):
2612         (WebCore::setScreenProperties):
2613         (WebCore::screenRect):
2614         (WebCore::screenAvailableRect):
2615         * platform/ScreenProperties.h: Added.
2616         (WebCore::ScreenProperties::encode const):
2617         (WebCore::ScreenProperties::decode):
2618
2619 2018-02-21  Christopher Reid  <chris.reid@sony.com>
2620
2621         [Curl] Curl Cookie Database File should be configurable using NetworkProcessCreationParameters
2622         https://bugs.webkit.org/show_bug.cgi?id=182751
2623
2624         Reviewed by Youenn Fablet.
2625
2626         No change in behavior.
2627
2628         Adding support to set a custom CookieJar Database.
2629         Took CookieJarDB::open() out of its constructor because both the Network and Web process
2630         were trying to open the journal files but one process was failing due to a lack of permission.
2631         Now the database file is lazily opened and only the Network process will try to open the database.
2632         Some cleanup was done to CookieJarDB too.
2633
2634         * platform/network/NetworkStorageSession.h:
2635         * platform/network/curl/CookieJarDB.cpp:
2636         * platform/network/curl/CookieJarDB.h:
2637         * platform/network/curl/NetworkStorageSessionCurl.cpp:
2638
2639 2018-02-21  Chris Dumez  <cdumez@apple.com>
2640
2641         Regression(r228708): Crash under WebCore::MediaResource::responseReceived(WebCore::CachedResource&, WebCore::ResourceResponse const&)
2642         https://bugs.webkit.org/show_bug.cgi?id=183018
2643         <rdar://problem/37754154>
2644
2645         Reviewed by Eric Carlson.
2646
2647         The fix at r228708 was trying to address the fact that avplayer sometimes
2648         deallocates WebCoreNSURLSessionDataTask objects on a non-main thread, which
2649         was not safe because its _resource data member needs to be deallocated on
2650         the main thread.
2651
2652         The issue is that r228708 caused _resource to outlive its WebCoreNSURLSessionDataTask.
2653         This is an issue because _resource has a client data member (of type WebCoreNSURLSessionDataTaskClient)
2654         which has a raw pointer to the WebCoreNSURLSessionDataTask. This means that the main thread could
2655         call methods like responseReceived() on the resource, which would call responseReceived() on the
2656         client, which would try to call [WebCoreNSURLSessionDataTask receivedResponse:] with an invalid
2657         m_task pointer.
2658
2659         To address the issue, I introduced a clearTask() method on WebCoreNSURLSessionDataTaskClient, which
2660         gets called from a non-main thread to clear the client's m_task pointer when the task is destroyed
2661         on a non-main thread. So that this is safe, every time the client tries to use m_task, we now
2662         acquire a lock for thread-safety and do a null-check on m_task.
2663
2664         No new tests, no known reproduction case.
2665
2666         * platform/graphics/PlatformMediaResourceLoader.h:
2667         (WebCore::PlatformMediaResource::client):
2668         * platform/network/cocoa/WebCoreNSURLSession.mm:
2669         (WebCore::WebCoreNSURLSessionDataTaskClient::clearTask):
2670         (WebCore::WebCoreNSURLSessionDataTaskClient::dataSent):
2671         (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
2672         (WebCore::WebCoreNSURLSessionDataTaskClient::shouldCacheResponse):
2673         (WebCore::WebCoreNSURLSessionDataTaskClient::dataReceived):
2674         (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived):
2675         (WebCore::WebCoreNSURLSessionDataTaskClient::accessControlCheckFailed):
2676         (WebCore::WebCoreNSURLSessionDataTaskClient::loadFailed):
2677         (WebCore::WebCoreNSURLSessionDataTaskClient::loadFinished):
2678         (-[WebCoreNSURLSessionDataTask dealloc]):
2679
2680 2018-02-21  Youenn Fablet  <youenn@apple.com>
2681
2682         Move AppCache loading to the NetworkProcess
2683         https://bugs.webkit.org/show_bug.cgi?id=178540
2684         <rdar://problem/37119346>
2685
2686         Reviewed by Alex Christensen.
2687
2688         Covered by existing tests.
2689
2690         Use ApplicationResourceLoader for cache entry loading.
2691         Remove all ResourceHandle use from ApplicationCacheGroup.
2692         Renamed m_loader in m_manifestLoader and added a new m_entryLoader to load cache entries.
2693
2694         Updated ApplicationCacheResourceLoader to handle different types of CachedResource.
2695         This allows in particular to handle redirections based on the resource type and create the ApplicationCacheResource with the right type.
2696         Use Include as credentials mode as per specification.
2697
2698         Add a new ApplicationCache ResourceResonse::Source.
2699         This allows fixing an assertion and should allow better inspector support if needs be.
2700
2701         * inspector/agents/InspectorNetworkAgent.cpp:
2702         (WebCore::responseSource):
2703         * loader/ResourceLoader.cpp:
2704         (WebCore::logResourceResponseSource):
2705         * loader/SubstituteResource.h:
2706         (WebCore::SubstituteResource::resourceResponse):
2707         * loader/appcache/ApplicationCacheGroup.cpp:
2708         (WebCore::ApplicationCacheGroup::stopLoading):
2709         (WebCore::ApplicationCacheGroup::update):
2710         (WebCore::ApplicationCacheGroup::didFinishLoading):
2711         (WebCore::ApplicationCacheGroup::didFinishLoadingEntry):
2712         (WebCore::ApplicationCacheGroup::didFail):
2713         (WebCore::ApplicationCacheGroup::didFailLoadingEntry):
2714         (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
2715         (WebCore::ApplicationCacheGroup::startLoadingEntry):
2716         * loader/appcache/ApplicationCacheGroup.h:
2717         * loader/appcache/ApplicationCacheResource.cpp:
2718         (WebCore::ApplicationCacheResource::ApplicationCacheResource):
2719         * loader/appcache/ApplicationCacheResourceLoader.cpp:
2720         (WebCore::ApplicationCacheResourceLoader::create):
2721         (WebCore::ApplicationCacheResourceLoader::ApplicationCacheResourceLoader):
2722         (WebCore::ApplicationCacheResourceLoader::responseReceived):
2723         (WebCore::ApplicationCacheResourceLoader::redirectReceived):
2724         * loader/appcache/ApplicationCacheResourceLoader.h:
2725         * platform/network/ResourceResponseBase.h:
2726         * platform/network/cocoa/ResourceResponseCocoa.mm:
2727         (WebCore::ResourceResponse::platformCertificateInfo const):
2728         * testing/Internals.cpp:
2729         (WebCore::responseSourceToString):
2730
2731 2018-02-21  Zalan Bujtas  <zalan@apple.com>
2732
2733         [RenderTreeBuilder] Move RenderBoxModelObject::willBeRemoved() mutation logic to RenderTreeBuilder
2734         https://bugs.webkit.org/show_bug.cgi?id=183014
2735         <rdar://problem/37757428>
2736
2737         Reviewed by Antti Koivisto.
2738
2739         No change in functionality.
2740
2741         * Sources.txt:
2742         * WebCore.xcodeproj/project.pbxproj:
2743         * rendering/RenderBoxModelObject.cpp:
2744         (WebCore::RenderBoxModelObject::~RenderBoxModelObject):
2745         (WebCore::RenderBoxModelObject::willBeDestroyed):
2746         (WebCore::RenderBoxModelObject::continuationChainNode const):
2747         (): Deleted.
2748         (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations): Deleted.
2749         * rendering/RenderBoxModelObject.h:
2750         * rendering/updating/RenderTreeBuilder.cpp:
2751         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2752         (WebCore::RenderTreeBuilder::removeAndDestroy):
2753         * rendering/updating/RenderTreeBuilder.h:
2754         (WebCore::RenderTreeBuilder::continuationBuilder):
2755         * rendering/updating/RenderTreeBuilderContinuation.cpp: Added.
2756         (WebCore::RenderTreeBuilder::Continuation::Continuation):
2757         (WebCore::RenderTreeBuilder::Continuation::cleanupOnDestroy):
2758         * rendering/updating/RenderTreeBuilderContinuation.h: Added.
2759
2760 2018-02-21  Youenn Fablet  <youenn@apple.com>
2761
2762         ServiceWorkerJob::m_lastResponse is unneeded
2763         https://bugs.webkit.org/show_bug.cgi?id=183013
2764
2765         Reviewed by Chris Dumez.
2766
2767         Remove this field since not used anywhere.
2768
2769         * workers/service/ServiceWorkerJob.cpp:
2770         (WebCore::ServiceWorkerJob::didReceiveResponse):
2771         * workers/service/ServiceWorkerJob.h:
2772
2773 2018-02-21  Youenn Fablet  <youenn@apple.com>
2774
2775         Use ResourceLoader to load appcache manifest
2776         https://bugs.webkit.org/show_bug.cgi?id=182861
2777
2778         Reviewed by Alex Christensen.
2779
2780         Covered by updated tests.
2781
2782         Add ApplicationCacheResourceLoader to load an ApplicationCacheResource from a ResourceLoader.
2783         Make use of it to load the app cache manifest.
2784         Future work should load entries using the same loader.
2785
2786         Remove manifest handle.
2787         Ensure that DocumentLoader does not register the manifest resource loader as its lifetime
2788         is handled by its ApplicationCacheGroup.
2789
2790         Add a ResourceLoader option to bypass the application cache.
2791         Use it for manifest loading.
2792
2793         * Sources.txt:
2794         * WebCore.xcodeproj/project.pbxproj:
2795         * loader/DocumentLoader.cpp:
2796         (WebCore::DocumentLoader::addSubresourceLoader):
2797         * loader/ResourceLoaderOptions.h:
2798         * loader/appcache/ApplicationCacheGroup.cpp:
2799         (WebCore::ApplicationCacheGroup::stopLoading):
2800         (WebCore::ApplicationCacheGroup::update):
2801         (WebCore::ApplicationCacheGroup::createRequest):
2802         (WebCore::ApplicationCacheGroup::didReceiveResponseAsync):
2803         (WebCore::ApplicationCacheGroup::didReceiveData):
2804         (WebCore::ApplicationCacheGroup::didFinishLoading):
2805         (WebCore::ApplicationCacheGroup::didFail):
2806         (WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
2807         (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
2808         * loader/appcache/ApplicationCacheGroup.h:
2809         * loader/appcache/ApplicationCacheHost.cpp:
2810         (WebCore::ApplicationCacheHost::maybeLoadResource):
2811         (WebCore::ApplicationCacheHost::maybeLoadFallbackForRedirect):
2812         (WebCore::ApplicationCacheHost::maybeLoadFallbackForResponse):
2813         (WebCore::ApplicationCacheHost::maybeLoadFallbackForError):
2814         * loader/appcache/ApplicationCacheResourceLoader.cpp: Added.
2815         * loader/appcache/ApplicationCacheResourceLoader.h: Added.
2816
2817 2018-02-21  Don Olmstead  <don.olmstead@sony.com>
2818
2819         [CMake][Win] Use cmakeconfig.h rather than config.h and Platform.h
2820         https://bugs.webkit.org/show_bug.cgi?id=182883
2821
2822         Reviewed by Per Arne Vollan.
2823
2824         No new tests. No change in behavior.
2825
2826         * WebCorePrefix.h:
2827         * config.h:
2828         * testing/js/WebCoreTestSupportPrefix.h:
2829
2830 2018-02-21  Zalan Bujtas  <zalan@apple.com>
2831
2832         [RenderTreeBuilder] Move RenderView::willBeRemoved() mutation logic to RenderTreeBuilder
2833         https://bugs.webkit.org/show_bug.cgi?id=183009
2834
2835         Reviewed by Antti Koivisto.
2836
2837         No change in functionality.
2838
2839         * dom/Document.cpp:
2840         (WebCore::Document::destroyRenderTree):
2841         * rendering/RenderView.cpp:
2842         (WebCore::RenderView::~RenderView):
2843         (WebCore::RenderView::willBeDestroyed): Deleted.
2844         * rendering/RenderView.h:
2845
2846 2018-02-21  Michael Catanzaro  <mcatanzaro@igalia.com>
2847
2848         [GTK] USE_UPOWER causes crashes inside a chroot or on systems with broken dbus/upower
2849         https://bugs.webkit.org/show_bug.cgi?id=181825
2850
2851         Reviewed by Carlos Garcia Campos.
2852
2853         We could fix this crash, but that would not be good enough, because upower-glib is a
2854         synchronous API that wraps D-Bus calls. That's not acceptable for use in the web process.
2855         Rewrite LowPowerModeNotifierGLib to use upower's D-Bus API directly, instead.
2856
2857         Note that this also enables LowPowerModeNotifier for WPE, since the USE(UPOWER) build
2858         flag is no longer needed.
2859
2860         * platform/LowPowerModeNotifier.cpp:
2861         * platform/LowPowerModeNotifier.h:
2862         * platform/glib/LowPowerModeNotifierGLib.cpp:
2863         (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
2864         (WebCore::LowPowerModeNotifier::updateWarningLevel):
2865         (WebCore::LowPowerModeNotifier::warningLevelChanged):
2866         (WebCore::LowPowerModeNotifier::gPropertiesChangedCallback):
2867         (WebCore::LowPowerModeNotifier::~LowPowerModeNotifier):
2868         (WebCore::LowPowerModeNotifier::updateState): Deleted.
2869         (WebCore::LowPowerModeNotifier::warningLevelCallback): Deleted.
2870
2871 2018-02-21  Chris Dumez  <cdumez@apple.com>
2872
2873         VTTCue constructor should use 'double' type for startTime / endTime
2874         https://bugs.webkit.org/show_bug.cgi?id=182988
2875
2876         Reviewed by Eric Carlson.
2877
2878         VTTCue constructor should use 'double' type for startTime / endTime, not
2879         'unrestricted double':
2880         - https://w3c.github.io/webvtt/#the-vttcue-interface
2881
2882         Otherwise, we end up potentially returning NaN for TextTrackCue.startTime / endTime,
2883         even though those correctly use type 'double':
2884         - https://html.spec.whatwg.org/multipage/media.html#texttrackcue
2885
2886         The new behavior is consistent with Firefox and Chrome.
2887
2888         No new tests, updated existing test.
2889
2890         * bindings/js/JSDOMConvertNumbers.h:
2891         (WebCore::JSConverter<IDLDouble>::convert):
2892         Add assertion to make sure our implementation never tries to return NaN
2893         for an IDL attribute of type 'double'. This would be invalid as per Web
2894         IDL spec and would crash if the NaN being returned was impure as JSValue
2895         could not store it as a double.
2896
2897         * html/track/VTTCue.idl:
2898         Update constructor parameters to use 'double' type instead of 'unrestricted
2899         double', as per:
2900         - https://w3c.github.io/webvtt/#the-vttcue-interface
2901
2902 2018-02-21  Zalan Bujtas  <zalan@apple.com>
2903
2904         [RenderTreeBuilder] Move RenderTextFragment::willBeRemoved() mutation logic to RenderTreeBuilder
2905         https://bugs.webkit.org/show_bug.cgi?id=182946
2906         <rdar://problem/37690039>
2907
2908         Reviewed by Antti Koivisto.
2909
2910         No change in functionality.
2911
2912         * rendering/RenderTextFragment.cpp:
2913         (WebCore::RenderTextFragment::willBeDestroyed):
2914         * rendering/updating/RenderTreeBuilder.cpp:
2915         (WebCore::RenderTreeBuilder::takeChild):
2916         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
2917         (WebCore::RenderTreeBuilder::FirstLetter::cleanupOnRemoval):
2918         * rendering/updating/RenderTreeBuilderFirstLetter.h:
2919
2920 2018-02-21  Ms2ger  <Ms2ger@igalia.com>
2921
2922         [GCrypt] Remove unsound assertion from CryptoKeyRSA::exportData().
2923         https://bugs.webkit.org/show_bug.cgi?id=183001
2924
2925         Reviewed by Philippe Normand.
2926
2927         This function is called from structured cloning, in particular when storing
2928         a key in IndexedDB. This would trip the assertion if the key in question is
2929         non-exportable.
2930
2931         The assertion was copied from the macOS implementation in r172389; it was
2932         subsequently removed there in r172898 to handle this case.
2933
2934         Test: crypto/subtle/rsa-indexeddb-non-exportable.html
2935
2936         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
2937         (WebCore::CryptoKeyRSA::exportData const): remove assertion.
2938
2939 2018-02-21  Myles C. Maxfield  <mmaxfield@apple.com>
2940
2941         [Cocoa] Make system-ui obey the user-installed-font policy
2942         https://bugs.webkit.org/show_bug.cgi?id=182860
2943         <rdar://problem/36158249>
2944
2945         Reviewed by Antti Koivisto.
2946
2947         We have a completely different codepath for system-ui which makes it follow the system's
2948         font cascade list. This codepath (along with all the other relevant places which create
2949         system fonts) needs to obey the AllowUserInstalledFonts enum. This patch is fairly
2950         mechanical; we simply are hooking up the flag across SystemFontDatabase.
2951
2952         There are a few places which creates system fonts which this patch doesn't touch. This is
2953         not a problem because all the remaining places either:
2954         1) Simply pull out some attributes of the font (name, weight, size, etc.) and then throw
2955         away the font object itself, or
2956         2) Use the font in an environment where script cannot access the characters rendered (such
2957         as DragImages or the fullscreen placeholder view or the inside of the attachment element).
2958
2959         Test: fast/text/user-installed-fonts/system-ui.html
2960
2961         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2962         (WebCore::FontDatabase::collectionForFamily):
2963         (WebCore::FontDatabase::fontForPostScriptName):
2964         (WebCore::fontWithFamily):
2965         (WebCore::installedFontMandatoryAttributes):
2966         (WebCore::createSpecificFontForInstalledFonts):
2967         * platform/graphics/cocoa/FontCacheCoreText.h:
2968         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
2969         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::operator== const):
2970         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::hash const):
2971         (WebCore::SystemFontDatabase::systemFontCascadeList):
2972         (WebCore::SystemFontDatabase::removeCascadeList):
2973         (WebCore::SystemFontDatabase::computeCascadeList):
2974         (WebCore::systemFontParameters):
2975         (WebCore::systemFontCascadeList):
2976         (WebCore::FontCascadeDescription::effectiveFamilyCount const):
2977         (WebCore::FontCascadeDescription::effectiveFamilyAt const):
2978         * platform/graphics/ios/FontCacheIOS.mm:
2979         (WebCore::platformFontWithFamilySpecialCase):
2980         * platform/graphics/mac/FontCacheMac.mm:
2981         (WebCore::platformFontWithFamilySpecialCase):
2982
2983 2018-02-21  Chris Dumez  <cdumez@apple.com>
2984
2985         Unreviewed attempt to fix build after r228867.
2986
2987         * Modules/webvr/VRStageParameters.cpp:
2988
2989 2018-02-21  Philippe Normand  <pnormand@igalia.com>
2990
2991         [GStreamer] Rewrite purgeInvalid*Tracks methods
2992         https://bugs.webkit.org/show_bug.cgi?id=183004
2993
2994         Reviewed by Carlos Garcia Campos.
2995
2996         Removing items from a hashmap while iterating is bad.
2997
2998         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2999         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks):
3000         Safely remove items from the hashmap using removeIf().
3001         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto.
3002         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto.
3003
3004 2018-02-21  Chris Dumez  <cdumez@apple.com>
3005
3006         Unreviewed attempt to fix build after r228867.
3007
3008         * Modules/webvr/VRStageParameters.cpp:
3009
3010 2018-02-21  Philippe Normand  <pnormand@igalia.com>
3011
3012         [GStreamer] Crash in Debug build when purging invalid tracks
3013         https://bugs.webkit.org/show_bug.cgi?id=182997
3014
3015         Reviewed by Xabier Rodriguez-Calvar.
3016
3017         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3018         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks): Clear the hashmap when there is no valid track left.
3019         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto.
3020         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto.
3021         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
3022         (WebCore::TrackPrivateBaseGStreamer::getLanguageCode): Demote debugging, this appears too much at least with playbin2.
3023         (WebCore::TrackPrivateBaseGStreamer::getTag): Ditto.
3024
3025 2018-02-21  Philippe Normand  <pnormand@igalia.com>
3026
3027         [GStreamer] We need to adopt GstGlDisplays after GStreamer 1.13.1
3028         https://bugs.webkit.org/show_bug.cgi?id=182996
3029
3030         Reviewed by Xabier Rodriguez-Calvar.
3031
3032         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3033         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
3034         Adopt references when running with GStreamer 1.13.1 to avoid
3035         memory leaks.
3036
3037 2018-02-20  Philippe Normand  <pnormand@igalia.com>
3038
3039         [GTK] Layout test media/track/track-in-band-duplicate-tracks-when-source-changes.html failing since r228617
3040         https://bugs.webkit.org/show_bug.cgi?id=160131
3041         <rdar://problem/35873985>
3042
3043         Reviewed by Michael Catanzaro.
3044
3045         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3046         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText): We
3047         can't assume the pad has a sticky event here like implemented in
3048         InbandTextTrackPrivateGStreamer because it might be emitted after
3049         the track was created. So fallback to a dummy stream ID like in
3050         the Audio and Video tracks.
3051
3052 2018-02-20  Sergio Villar Senin  <svillar@igalia.com>
3053
3054         [WebVR][OpenVR] Retrieve stage parameters
3055         https://bugs.webkit.org/show_bug.cgi?id=182976
3056
3057         Reviewed by Žan Doberšek.
3058
3059         Use OpenVR to retrieve stage parameters, i.e., play area size and
3060         the transformation from sitting to standing position. It includes
3061         the same fallback used by Firefox to provide sensible values in case
3062         we cannot get the required information from the VR SDK (it's quite
3063         common not to have defined a play area).
3064
3065         * Modules/webvr/VRDisplay.cpp:
3066         (WebCore::VRDisplay::stageParameters const):
3067         * Modules/webvr/VRDisplay.h:
3068         * Modules/webvr/VRStageParameters.cpp:
3069         (WebCore::VRStageParameters::VRStageParameters):
3070         (WebCore::VRStageParameters::sittingToStandingTransform const):
3071         (WebCore::VRStageParameters::sizeX const):
3072         (WebCore::VRStageParameters::sizeZ const):
3073         * Modules/webvr/VRStageParameters.h:
3074         (WebCore::VRStageParameters::create):
3075         * platform/vr/VRPlatformDisplay.h:
3076         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
3077         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
3078         (WebCore::VRPlatformDisplayOpenVR::updateStageParameters):
3079         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
3080
3081 2018-02-21  Philippe Normand  <pnormand@igalia.com>
3082
3083         [GStreamer] Create a Wayland GL display instead of EGL
3084         https://bugs.webkit.org/show_bug.cgi?id=182968
3085
3086         Reviewed by Xabier Rodriguez-Calvar.
3087
3088         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3089         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
3090         Add logging and instantiate a GstDisplayWayland display instead of
3091         an EGL display when running under a Wayland compositor.
3092
3093 2018-02-21  Zalan Bujtas  <zalan@apple.com>
3094
3095         [RenderTreeBuilder] Move RenderFullScreen::willBeRemoved() mutation logic to RenderTreeBuilder
3096         https://bugs.webkit.org/show_bug.cgi?id=182947
3097         <rdar://problem/37690848>
3098
3099         Reviewed by Antti Koivisto.
3100
3101         No change in functionality.
3102
3103         * Sources.txt:
3104         * WebCore.xcodeproj/project.pbxproj:
3105         * rendering/RenderFullScreen.cpp:
3106         (WebCore::RenderFullScreen::willBeDestroyed):
3107         * rendering/updating/RenderTreeBuilder.cpp:
3108         (WebCore::RenderTreeBuilder::takeChild):
3109         * rendering/updating/RenderTreeBuilder.h:
3110         (WebCore::RenderTreeBuilder::fullScreenBuilder):
3111         * rendering/updating/RenderTreeBuilderFullScreen.cpp: Added.
3112         (WebCore::RenderTreeBuilder::FullScreen::FullScreen):
3113         (WebCore::RenderTreeBuilder::FullScreen::cleanupOnRemoval):
3114         * rendering/updating/RenderTreeBuilderFullScreen.h: Added.
3115         * rendering/updating/RenderTreeBuilderMathML.cpp:
3116
3117 2018-02-20  Zalan Bujtas  <zalan@apple.com>
3118
3119         [RenderTreeBuilder] Move RenderListItem::willBeRemoved() mutation logic to RenderTreeBuilder
3120         https://bugs.webkit.org/show_bug.cgi?id=182943
3121         <rdar://problem/37689029>
3122
3123         Reviewed by Antti Koivisto.
3124
3125         We don't need to destroy the marker in RenderListItem::willBeRemoved(), because it gets deleted
3126         in RenderTreeBuilder::removeAndDestroy() together with RenderListItem (as long as the marker is
3127         the RenderListItem's descendent). 
3128
3129         Covered by existing tests.
3130
3131         * rendering/RenderListItem.cpp:
3132         (WebCore::RenderListItem::~RenderListItem):
3133         (WebCore::RenderListItem::willBeDestroyed): Deleted.
3134         * rendering/RenderListItem.h:
3135
3136 2018-02-20  Nan Wang  <n_wang@apple.com>
3137
3138         AX: Keyboard focus not following VoiceOver cursor into web content or within web content.
3139         https://bugs.webkit.org/show_bug.cgi?id=182752
3140         <rdar://problem/37518233>
3141
3142         Reviewed by Ryosuke Niwa.
3143
3144         Call the assistive technology specific method for becoming first responder.
3145
3146         Test: accessibility/mac/accessibility-make-first-responder.html
3147
3148         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3149         (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
3150         * page/ChromeClient.h:
3151
3152 2018-02-20  Tim Horton  <timothy_horton@apple.com>
3153
3154         Introduce HAVE(IOSURFACE_ACCELERATOR)
3155         https://bugs.webkit.org/show_bug.cgi?id=182955
3156         <rdar://problem/37699510>
3157
3158         Reviewed by Sam Weinig.
3159
3160         No new tests, no change in behavior.
3161
3162         Introduce HAVE(IOSURFACE_ACCELERATOR) and guard all uses of
3163         IOSurfaceAccelerator behind it.
3164
3165         Rename USE(IOSURFACE) to HAVE(IOSURFACE) for accuracy.
3166
3167         * page/cocoa/MemoryReleaseCocoa.mm:
3168         * platform/graphics/ca/TileController.cpp:
3169         * platform/graphics/cg/IOSurfacePool.cpp:
3170         * platform/graphics/cg/IOSurfacePool.h:
3171         * platform/graphics/cg/ImageBufferCG.cpp:
3172         * platform/graphics/cocoa/IOSurface.h:
3173         * platform/graphics/cocoa/IOSurface.mm:
3174         * platform/graphics/cocoa/IOSurfacePoolCocoa.mm:
3175         * platform/graphics/cv/VideoTextureCopierCV.cpp:
3176         * platform/graphics/cv/VideoTextureCopierCV.h:
3177
3178 2018-02-20  Chris Dumez  <cdumez@apple.com>
3179
3180         Provisional load may get committed before receiving the decidePolicyForNavigationResponse response
3181         https://bugs.webkit.org/show_bug.cgi?id=182720
3182         <rdar://problem/37515204>
3183
3184         Reviewed by Alex Christensen.
3185
3186         Wait for the policy response from the client after receiving a resource response,
3187         before sending the NetworkResourceLoader::ContinueDidReceiveResponse IPC back to
3188         the NetworkProcess. Otherwise, the network process may start sending us data and
3189         we may end up committing the provisional load before receiving the policy decision
3190         fron the client.
3191
3192         Change is covered by new API test.
3193
3194         * loader/DocumentLoader.cpp:
3195         (WebCore::DocumentLoader::responseReceived):
3196         * loader/NetscapePlugInStreamLoader.cpp:
3197         (WebCore::NetscapePlugInStreamLoader::didReceiveResponse):
3198         * loader/NetscapePlugInStreamLoader.h:
3199         * loader/ResourceLoader.cpp:
3200         (WebCore::ResourceLoader::deliverResponseAndData):
3201         (WebCore::ResourceLoader::loadDataURL):
3202         (WebCore::ResourceLoader::didReceiveResponse):
3203         (WebCore::ResourceLoader::didReceiveResponseAsync):
3204         * loader/ResourceLoader.h:
3205         * loader/SubresourceLoader.cpp:
3206         (WebCore::SubresourceLoader::didReceiveResponse):
3207         (WebCore::SubresourceLoader::didReceiveResponsePolicy):
3208         (WebCore::SubresourceLoader::willCancel):
3209         * loader/SubresourceLoader.h:
3210         * loader/ios/PreviewLoader.mm:
3211         (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]):
3212
3213 2018-02-20  Chris Dumez  <cdumez@apple.com>
3214
3215         Crash under JSC::JSCell::toNumber(JSC::ExecState*)
3216         https://bugs.webkit.org/show_bug.cgi?id=182984
3217         <rdar://problem/37694346>
3218
3219         Reviewed by Mark Lam.
3220
3221         The issue was caused by DOMMatrix attributes potentially returning "impure"
3222         NaN values. We would call JSC::jsNumber(double) to construct the JSValue
3223         but this is only safe for pure NaN values. Make sure we purify the double
3224         returned by the implementation for IDL attributes of type 'unrestricted double'
3225         before calling JSC::jsNumber(double).
3226
3227         No new tests, extended existing test.
3228
3229         * bindings/js/JSDOMConvertNumbers.h:
3230         (WebCore::JSConverter<IDLUnrestrictedDouble>::convert):
3231         * testing/TypeConversions.h:
3232         (WebCore::TypeConversions::testImpureNaNUnrestrictedDouble const):
3233         (WebCore::TypeConversions::testImpureNaN2UnrestrictedDouble const):
3234         (WebCore::TypeConversions::testQuietNaNUnrestrictedDouble const):
3235         * testing/TypeConversions.idl:
3236
3237 2018-02-20  Tim Horton  <timothy_horton@apple.com>
3238
3239         Make more use of USE(OPENGL_ES) where it makes sense
3240         https://bugs.webkit.org/show_bug.cgi?id=182957
3241         <rdar://problem/37699443>
3242
3243         Reviewed by Dan Bernstein.
3244
3245         No new tests, no behavior change.
3246
3247         Make use of USE(OPENGL_ES) for CoreVideo functions that differ based
3248         on GL availability. Also adjust GraphicsContext3D in the same way.
3249
3250         * platform/cocoa/CoreVideoSoftLink.cpp:
3251         * platform/cocoa/CoreVideoSoftLink.h:
3252         * platform/graphics/GraphicsContext3D.h:
3253         * platform/graphics/cv/TextureCacheCV.mm:
3254         (WebCore::TextureCacheCV::create):
3255         (WebCore::TextureCacheCV::textureFromImage):
3256         * platform/graphics/cv/VideoTextureCopierCV.cpp:
3257         (WebCore::enumToStringMap):
3258         (WebCore::VideoTextureCopierCV::initializeContextObjects):
3259         (WebCore::VideoTextureCopierCV::initializeUVContextObjects):
3260         (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture):
3261         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture):
3262
3263 2018-02-20  Nan Wang  <n_wang@apple.com>
3264
3265         AX: AOM: Dispatch accessibleclick event
3266         https://bugs.webkit.org/show_bug.cgi?id=180898
3267         <rdar://problem/36086710>
3268
3269         Reviewed by Ryosuke Niwa.
3270
3271         Accessibility events.
3272         Spec: https://wicg.github.io/aom/spec/phase2.html
3273
3274         This patch allows developers to register event handlers on Elements
3275         for custom accessibility events.
3276
3277         Accessibility events go through a capturing and bubbling phase just
3278         like DOM events, but in the accessibility tree.
3279
3280         Implemented "accessibleclick" event.
3281
3282         Test: accessibility/mac/AOM-events.html
3283
3284         * accessibility/AccessibilityObject.cpp:
3285         (WebCore::AccessibilityObject::press):
3286         (WebCore::AccessibilityObject::dispatchAccessibilityEvent):
3287         * accessibility/AccessibilityObject.h:
3288         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3289         (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]):
3290         * dom/Element.idl:
3291         * dom/EventDispatcher.cpp:
3292         (WebCore::dispatchEventWithType):
3293         (WebCore::EventDispatcher::dispatchEvent):
3294         * dom/EventDispatcher.h:
3295         * dom/EventNames.h:
3296         * dom/EventPath.cpp:
3297         (WebCore::EventPath::EventPath):
3298         * dom/EventPath.h:
3299
3300 2018-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>
3301
3302         [iOS 11.3 Beta] Can't copy a URL from Safari and paste it into the Gmail app
3303         https://bugs.webkit.org/show_bug.cgi?id=182952
3304         <rdar://problem/37636190>
3305
3306         Reviewed by Tim Horton.
3307
3308         After r220865 refactored the iOS copy codepaths to use NSItemProviders, we stopped writing the URL as plain text
3309         to the pasteboard. However, this means clients that only check for "text/plain" (or one of its aliases) on the
3310         pasteboard won't read any data on paste.
3311
3312         To fix this, we restore the pre-iOS 11.3 behavior of writing both the URL and plain text to the pasteboard.
3313         Since we're using item providers, we also ensure that the NSURL is at a higher fidelity than the string to make
3314         it clear that the data should be consumed as a URL.
3315
3316         This patch also rebaselines an existing drag and drop test to cover this change, and adds a new API test,
3317         ActionSheetTests.CopyLinkWritesURLAndPlainText, which simulates copying a link using the share sheet and pasting
3318         into a DataTransfer-dumping test harness.
3319
3320         * platform/ios/PlatformPasteboardIOS.mm:
3321         (WebCore::PlatformPasteboard::write):
3322
3323 2018-02-20  Eric Carlson  <eric.carlson@apple.com>
3324
3325         [iOS] Returning from Auto-PiP causes Safari to be unresponsive
3326         https://bugs.webkit.org/show_bug.cgi?id=182977
3327         <rdar://problem/37685981>
3328
3329         Reviewed by Jer Noble.
3330
3331         Remove the error handling added in r228115, it breaks auto-pip.
3332
3333         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
3334         (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
3335         (VideoFullscreenInterfaceAVKit::enterFullscreenStandard):
3336         (VideoFullscreenInterfaceAVKit::exitFullscreen):
3337         (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
3338         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
3339         (VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler):
3340         (VideoFullscreenInterfaceAVKit::exitFullscreenHandler):
3341         (VideoFullscreenInterfaceAVKit::enterFullscreenHandler):
3342
3343 2018-02-20  Jer Noble  <jer.noble@apple.com>
3344
3345         [EME] Adopt new AVContentKeySession success delegate callback
3346         https://bugs.webkit.org/show_bug.cgi?id=182974
3347         <rdar://problem/36079035>
3348
3349         Reviewed by Eric Carlson.
3350
3351         Store the updateLicenseCallback if the new protocol method is present and supported.
3352
3353         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
3354         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
3355         (-[WebCoreFPSContentKeySessionDelegate contentKeySession:contentKeyRequestDidSucceed:]):
3356         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
3357         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
3358         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestDidSucceed):
3359
3360 2018-02-19  Dean Jackson  <dino@apple.com>
3361
3362         Handle all writing-modes in downcast
3363         https://bugs.webkit.org/show_bug.cgi?id=182949
3364         <rdar://problem/37710687>
3365
3366         Reviewed by Myles Maxfield.
3367
3368         It appears we forgot to handle the deprecated "lr"
3369         writing-mode value.
3370
3371         Test: fast/writing-mode/svg-writing-modes.html
3372
3373         * css/CSSPrimitiveValueMappings.h:
3374         (WebCore::CSSPrimitiveValue::operator WritingMode const):
3375
3376 2018-02-20  Zan Dobersek  <zdobersek@igalia.com>
3377
3378         [Cairo] Drop target GraphicsContext usage in Cairo operations
3379         https://bugs.webkit.org/show_bug.cgi?id=182964
3380
3381         Reviewed by Carlos Garcia Campos.
3382
3383         The GraphicsContext parameters in various Cairo operations are not used
3384         anymore, so they can be removed. Callsites are updated to reflect this.
3385
3386         * platform/graphics/cairo/CairoOperations.cpp:
3387         (WebCore::Cairo::drawShadowLayerBuffer):
3388         (WebCore::Cairo::fillShadowBuffer):
3389         (WebCore::Cairo::drawPathShadow):
3390         (WebCore::Cairo::drawGlyphsShadow):
3391         (WebCore::Cairo::fillRect):
3392         (WebCore::Cairo::fillRoundedRect):
3393         (WebCore::Cairo::fillRectWithRoundedHole):
3394         (WebCore::Cairo::fillPath):
3395         (WebCore::Cairo::strokeRect):
3396         (WebCore::Cairo::strokePath):
3397         (WebCore::Cairo::drawGlyphs):
3398         (WebCore::Cairo::drawNativeImage):
3399         (WebCore::Cairo::drawSurface):
3400         * platform/graphics/cairo/CairoOperations.h:
3401         * platform/graphics/cairo/FontCairo.cpp:
3402         (WebCore::FontCascade::drawGlyphs):
3403         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3404         (WebCore::GraphicsContext::drawNativeImage):
3405         (WebCore::GraphicsContext::fillPath):
3406         (WebCore::GraphicsContext::strokePath):
3407         (WebCore::GraphicsContext::fillRect):
3408         (WebCore::GraphicsContext::strokeRect):
3409         (WebCore::GraphicsContext::platformFillRoundedRect):
3410         (WebCore::GraphicsContext::fillRectWithRoundedHole):
3411         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
3412         (WebCore::GraphicsContextImplCairo::fillRect):
3413         (WebCore::GraphicsContextImplCairo::fillRoundedRect):
3414         (WebCore::GraphicsContextImplCairo::fillRectWithRoundedHole):
3415         (WebCore::GraphicsContextImplCairo::fillPath):
3416         (WebCore::GraphicsContextImplCairo::strokeRect):
3417         (WebCore::GraphicsContextImplCairo::strokePath):
3418         (WebCore::GraphicsContextImplCairo::drawGlyphs):
3419         (WebCore::GraphicsContextImplCairo::drawNativeImage):
3420         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
3421         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
3422
3423 2018-02-20  Sergio Villar Senin  <svillar@igalia.com>
3424
3425         [WebVR][OpenVR] Retrieve eye parameters and field of view
3426         https://bugs.webkit.org/show_bug.cgi?id=182962
3427
3428         Reviewed by Žan Doberšek.
3429
3430         Get the required data from OpenVR to fill in the VREyeParameters and
3431         the VRFieldOfView objects.
3432
3433         * Modules/webvr/VRDisplay.cpp: Create some attributes in the
3434         body of the constructor instead in the member initialization list to
3435         avoid calling getDisplayInfo() multiple times.
3436         (WebCore::VRDisplay::VRDisplay):
3437         (WebCore::VRDisplay::capabilities const):
3438         (WebCore::VRDisplay::getEyeParameters const):
3439         * Modules/webvr/VRDisplay.h:
3440         * Modules/webvr/VREyeParameters.cpp:
3441         (WebCore::VREyeParameters::VREyeParameters): Added new attributes to
3442         the constructor.
3443         (WebCore::VREyeParameters::offset const): Return a Ref instead of
3444         a raw pointer.
3445         (WebCore::VREyeParameters::renderWidth const):
3446         (WebCore::VREyeParameters::renderHeight const):
3447         * Modules/webvr/VREyeParameters.h:
3448         (WebCore::VREyeParameters::create):
3449         * Modules/webvr/VRFieldOfView.cpp: Removed. All the impletementation
3450         fits perfectly in the header file.
3451         * Modules/webvr/VRFieldOfView.h:
3452         (WebCore::VRFieldOfView::create):
3453         (WebCore::VRFieldOfView::upDegrees const):
3454         (WebCore::VRFieldOfView::rightDegrees const):
3455         (WebCore::VRFieldOfView::downDegrees const):
3456         (WebCore::VRFieldOfView::leftDegrees const):
3457         (WebCore::VRFieldOfView::VRFieldOfView):
3458         * Sources.txt:
3459         * platform/vr/VRPlatformDisplay.h: Added some more data to the
3460         VRPlatformDisplayInfo struct.
3461         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
3462         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
3463         (WebCore::VRPlatformDisplayOpenVR::computeFieldOfView): Computes the
3464         up/down/left/right FOV angles in degrees from the raw project
3465         values returned by OpenVR.
3466         (WebCore::VRPlatformDisplayOpenVR::updateEyeParameters): Fills in
3467         the eye parameter info.
3468         (WebCore::VRPlatformDisplayOpenVR::~VRPlatformDisplayOpenVR):
3469         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
3470
3471 2018-02-20  Philippe Normand  <pnormand@igalia.com>
3472
3473         [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser
3474         https://bugs.webkit.org/show_bug.cgi?id=173655
3475
3476         Reviewed by Xabier Rodriguez-Calvar.
3477
3478         The FIXME in GStreamerUtilities.cpp asks to pass the command line
3479         parameters to the GStreamer initialization function.
3480
3481         Based on initial patch by: Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
3482
3483         * Modules/webaudio/AudioContext.cpp:
3484         (WebCore::AudioContext::constructCommon): Removes the call to the method
3485         that GStreamer initializes. It is no longer necessary.
3486         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3487         (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements): Ditto
3488         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3489         (WebCore::initializeGStreamerAndRegisterWebKitMSEElement): Ditto
3490         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
3491         (WebCore::initializeGStreamer): Receive the GStreamer options and initialize GStreamer.
3492         * platform/graphics/gstreamer/GStreamerUtilities.h: Add vector which contains
3493         GStreamer options as the input parameter of the initializeGStreamer() method.
3494
3495 2018-02-20  Miguel Gomez  <magomez@igalia.com>
3496
3497         [GTK] whatsapp web blurry in some parts, sharp on others
3498         https://bugs.webkit.org/show_bug.cgi?id=182673
3499
3500         Reviewed by Carlos Garcia Campos.
3501
3502         CoordinatedGraphicsLayer::createBackingStore() uses the scale factor returned by effectiveContentsScale(),
3503         which is always 1 if selfOrAncestorHaveNonAffineTransforms() returns true. But this fuction always returns
3504         true if the layer has an AnimatedPropertyTransform animation, which means that layers with those animations
3505         won't use the appropriate scale factor, causing blurry renderings.
3506
3507         This patch removes the animations check, so animated layers properly use the required scale factor.
3508
3509         No new tests, no behavior change.
3510
3511         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3512         (WebCore::CoordinatedGraphicsLayer::selfOrAncestorHaveNonAffineTransforms):
3513
3514 2018-02-20  Zan Dobersek  <zdobersek@igalia.com>
3515
3516         [Cairo] Leverage ShadowBlur without using scratch buffer, target GraphicsContext
3517         https://bugs.webkit.org/show_bug.cgi?id=182958
3518
3519         Reviewed by Carlos Garcia Campos.
3520
3521         To allow ShadowBlur usage in different threads, avoid the ShadowBlur
3522         class using the scratch buffer internally. The current implementation of
3523         that scratch buffer is not thread-safe and its usage in such conditions
3524         can lead to crashes.
3525
3526         Instead, the new methods use a temporary ImageBuffer object for drawing.
3527         This does negate the efficiency of possibly reusing the scratch buffer,
3528         but at this point that is not yet the priority. This only affects ports
3529         using Cairo for drawing.
3530
3531         The added methods don't require a target GraphicsContext object to be
3532         passed in, instead they accept buffer draw callbacks that are invoked
3533         with the temporary ImageBuffer object containing the rasterized shadow,
3534         as well as position and size parameters. The CTM and clip bounds values
3535         also have to be passed in manually. In CairoOperations.cpp, the provided
3536         callbacks invoke commands that are equivalent in effect to those that
3537         would otherwise be invoked on the target GraphicsContext object in the
3538         ShadowBlur class.
3539
3540         For now, this approach has to avoid the tiling-based drawing of the
3541         rectangular shadows in drawRectShadow() and inset shadows in
3542         drawInsetShadow(), and instead stick to the non-tiling fallback. While
3543         only affecting Cairo-using ports, with some refactoring it should be
3544         possible to again leverage the tiling-based approach as well.
3545
3546         The beginShadowLayer() and endShadowLayer() functions, which are only
3547         used in CairoOperations.cpp, are replaced with the drawShadowLayer()
3548         method. This one accepts an additional callback that allows the caller
3549         to explicitly draw the shadow shape using the provided shadowing
3550         GraphicsContext object. As with the other two new methods, a temporary
3551         ImageBuffer object is used, and the buffer draw callback is invoked to
3552         allow caller to properly handle the shadowing output.
3553
3554         In CairoOperations.cpp, the new ShadowBlur methods are exercised, with
3555         direct Cairo operation invocation replacing the GraphicsContext calls
3556         otherwise done through ShadowBlur. ShadowState object now also has to
3557         track the global alpha and the global composite operator values so that
3558         it can properly rasterize the resulting shadow into the final image.
3559
3560         No new tests -- no change in behavior.
3561
3562         * platform/graphics/ShadowBlur.cpp:
3563         (WebCore::ShadowBlur::adjustBlurRadius):
3564         (WebCore::ShadowBlur::calculateLayerBoundingRect):
3565         (WebCore::ShadowBlur::drawRectShadow):
3566         (WebCore::ShadowBlur::drawInsetShadow):
3567         (WebCore::ShadowBlur::drawShadowLayer):
3568         (WebCore::ShadowBlur::beginShadowLayer): Deleted.
3569         (WebCore::ShadowBlur::endShadowLayer): Deleted.
3570         * platform/graphics/ShadowBlur.h:
3571         * platform/graphics/cairo/CairoOperations.cpp:
3572         (WebCore::Cairo::drawShadowLayerBuffer):
3573         (WebCore::Cairo::fillShadowBuffer):
3574         (WebCore::Cairo::drawPathShadow):
3575         (WebCore::Cairo::drawGlyphsShadow):
3576         (WebCore::Cairo::ShadowState::ShadowState):
3577         (WebCore::Cairo::fillRect):
3578         (WebCore::Cairo::fillRoundedRect):
3579         (WebCore::Cairo::fillRectWithRoundedHole):
3580         (WebCore::Cairo::drawSurface):
3581         * platform/graphics/cairo/CairoOperations.h:
3582         Default-initialize FillSource::fillRule to RULE_NONZERO.
3583         * platform/graphics/cairo/PlatformContextCairo.h:
3584         Drop the ShadowBlur.h include, it's moved to CairoOperations.cpp.
3585         * rendering/RenderThemeGtk.cpp:
3586         Explicitly include the FloatRoundedRect.h header now that it's not
3587         included through the ShadowBlur.h header via PlatformContextCairo.h.
3588
3589 2018-02-20  Sergio Villar Senin  <svillar@igalia.com>
3590
3591         [WebVR] Use RuntimeEnabledFeatures to enable/disable WebVR
3592         https://bugs.webkit.org/show_bug.cgi?id=182961
3593
3594         Reviewed by Xabier Rodriguez-Calvar.
3595
3596         The shared feature was properly added to RuntimeEnabledFeatures some
3597         time ago but the code was instead using a private method in
3598         NavigatorWebVR to temporarily disable it. WebVR is enabled in
3599         WebPreferences.yaml for GTK+ & WPE as default experimental feature.
3600
3601         * Modules/webvr/NavigatorWebVR.cpp:
3602         (WebCore::NavigatorWebVR::getVRDisplays):
3603         (WebCore::NavigatorWebVR::vrEnabled): Deleted.
3604
3605 2018-02-19  Antti Koivisto  <antti@apple.com>
3606
3607         Use selector filter when invalidating descendants
3608         https://bugs.webkit.org/show_bug.cgi?id=182839
3609         <rdar://problem/37581072>
3610
3611         Reviewed by Zalan Bujtas.
3612
3613         We can make descendant invalidation faster by enabling filtering.
3614
3615         * css/SelectorFilter.cpp:
3616         (WebCore::SelectorFilter::initializeParentStack):
3617
3618             Traverse and reverse the ancestor chain, and push it.
3619
3620         (WebCore::SelectorFilter::pushParent):
3621         (WebCore::SelectorFilter::pushParentInitializingIfNeeded):
3622
3623             Add a version of pushParent that can initialize the stack.
3624
3625         (WebCore::SelectorFilter::popParent):
3626         (WebCore::SelectorFilter::popParentsUntil):
3627
3628             Pop until a given parent element.
3629
3630         (WebCore::SelectorFilter::pushParentStackFrame): Deleted.
3631         (WebCore::SelectorFilter::popParentStackFrame): Deleted.
3632
3633             These were the same as push/popParent.
3634
3635         * css/SelectorFilter.h:
3636         (WebCore::SelectorFilter::popParent): Deleted.
3637         * style/StyleInvalidator.cpp:
3638         (WebCore::Style::Invalidator::invalidateStyleForDescendants):
3639
3640             Use pushParentInitializingIfNeeded.
3641
3642         (WebCore::Style::Invalidator::invalidateStyleWithMatchElement):
3643
3644             Use selector filter when doing descendant tree invalidation.
3645             Make sure to pop it until the parent when reusing.
3646
3647 2018-02-19  Fujii Hironori  <Hironori.Fujii@sony.com>
3648
3649         null m_lastNodeInserted dereference at ReplaceSelectionCommand::InsertedNodes::lastLeafInserted
3650         https://bugs.webkit.org/show_bug.cgi?id=161947
3651
3652         Reviewed by Ryosuke Niwa.
3653
3654         InsertedNodes happened to be empty if the inserted nodes were
3655         removed. Add more checks if InsertedNodes is empty.
3656
3657         No new tests (Covered by existing tests).
3658
3659         * editing/ReplaceSelectionCommand.cpp:
3660         (WebCore::ReplaceSelectionCommand::doApply): Return early if InsertedNodes becomes empty.
3661         * editing/ReplaceSelectionCommand.h:
3662         (WebCore::ReplaceSelectionCommand::InsertedNodes::isEmpty): New method.
3663         (WebCore::ReplaceSelectionCommand::InsertedNodes::lastLeafInserted const):
3664         Assert m_lastNodeInserted is not null.
3665         (WebCore::ReplaceSelectionCommand::InsertedNodes::pastLastLeaf const): Ditto.
3666
3667 2018-02-19  Said Abou-Hallawa  <sabouhallawa@apple.com>
3668
3669         Add SVGPropertyTraits::fromString() to all the SVG animated types
3670         https://bugs.webkit.org/show_bug.cgi?id=182901
3671
3672         Reviewed by Dean Jackson.
3673
3674         This is a work toward https://bugs.webkit.org/show_bug.cgi?id=168586. The
3675         goal is is to templatize the SVGAnimatedType class and to use SVGPropertyTraits
3676         methods inside the template functions.
3677
3678         * WebCore.xcodeproj/project.pbxproj: Move the enum and the SVGPropertyTraits
3679         from SVGMarkerElement.h to SVGMarkerTypes.h.
3680         * svg/SVGAngle.h:
3681         (WebCore::SVGAngle::SVGAngle): Delete unused constructor and create() method.
3682         * svg/SVGAngleValue.h:
3683         * svg/SVGAnimateMotionElement.cpp:
3684         (WebCore::parsePoint): Deleted. Move this function to SVGParserUtilities.cpp
3685         * svg/SVGAnimatedAngle.cpp:
3686         (WebCore::SVGAnimatedAngleAnimator::constructFromString): Use SVGPropertyTraits::fromString().
3687         * svg/SVGAnimatedBoolean.cpp:
3688         (WebCore::SVGAnimatedBooleanAnimator::constructFromString): Ditto.
3689         * svg/SVGAnimatedColor.cpp:
3690         (WebCore::SVGAnimatedColorAnimator::constructFromString): Ditto.
3691         (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes): Use const.
3692         (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue): Ditto.
3693         * svg/SVGAnimatedEnumeration.cpp:
3694         (WebCore::SVGAnimatedEnumerationAnimator::constructFromString): Ditto.
3695         * svg/SVGAnimatedInteger.cpp:
3696         (WebCore::SVGAnimatedIntegerAnimator::constructFromString): Ditto.
3697         * svg/SVGAnimatedIntegerOptionalInteger.cpp:
3698         (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString): Ditto.
3699         * svg/SVGAnimatedLength.cpp:
3700         * svg/SVGAnimatedLengthList.cpp:
3701         (WebCore::SVGAnimatedLengthListAnimator::constructFromString): Ditto.
3702         * svg/SVGAnimatedNumber.cpp:
3703         (WebCore::SVGAnimatedNumberAnimator::constructFromString): Ditto
3704         (WebCore::parseNumberFromString):
3705         * svg/SVGAnimatedNumberList.cpp:
3706         (WebCore::SVGAnimatedNumberListAnimator::constructFromString): Ditto.
3707         * svg/SVGAnimatedNumberOptionalNumber.cpp:
3708         (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString): Ditto.
3709         * svg/SVGAnimatedPath.cpp:
3710         (WebCore::SVGAnimatedPathAnimator::constructFromString): Ditto.
3711         * svg/SVGAnimatedPointList.cpp:
3712         (WebCore::SVGAnimatedPointListAnimator::constructFromString): Ditto.
3713         * svg/SVGAnimatedPreserveAspectRatio.cpp:
3714         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString): Ditto.
3715         * svg/SVGAnimatedRect.cpp:
3716         (WebCore::SVGAnimatedRectAnimator::constructFromString): Ditto.
3717         * svg/SVGAnimatedString.cpp:
3718         (WebCore::SVGAnimatedStringAnimator::constructFromString): Ditto.
3719         * svg/SVGAnimatedTransformList.cpp:
3720         (WebCore::SVGAnimatedTransformListAnimator::constructFromString): Ditto.
3721         * svg/SVGLength.h:
3722         (WebCore::SVGLength::SVGLength): Delete unused constructor and create() method.
3723         * svg/SVGLengthListValues.h:
3724         (WebCore::SVGPropertyTraits<SVGLengthListValues>::fromString): New SVGPropertyTraits method.
3725         (WebCore::SVGPropertyTraits<SVGLengthListValues>::parse): Ditto.
3726         * svg/SVGMarkerElement.h:
3727         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue): Deleted.
3728         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): Deleted.
3729         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString): Deleted.
3730         (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Deleted.
3731         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue): Deleted.
3732         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): Deleted.
3733         * svg/SVGMarkerTypes.h: Added.
3734         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue):
3735         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString):
3736         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString):
3737         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
3738         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
3739         (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue):
3740         * svg/SVGMatrix.h: Delete unused constructor and create method.
3741         * svg/SVGNumber.h:
3742         (WebCore::SVGNumber::SVGNumber): Ditto.
3743         * svg/SVGNumberListValues.h:
3744         (WebCore::SVGPropertyTraits<SVGNumberListValues>::fromString): New SVGPropertyTraits method.
3745         * svg/SVGParserUtilities.cpp:
3746         (WebCore::parsePoint): This is moved from SVGAnimateMotionElement.cpp
3747         * svg/SVGParserUtilities.h:
3748         * svg/SVGPathByteStream.h:
3749         (WebCore::SVGPathByteStream::SVGPathByteStream):
3750         (WebCore::SVGPathByteStream::operator=): Add copy and move assignment operators.
3751         (WebCore::SVGPathByteStream::copy const): Use the copy assignment.
3752         (WebCore::SVGPathByteStream::isEmpty const): Use Data.isEmpty().
3753         (WebCore::SVGPropertyTraits<SVGPathByteStream>::initialValue): New SVGPropertyTraits method.
3754         (WebCore::SVGPropertyTraits<SVGPathByteStream>::fromString): Ditto.
3755         * svg/SVGPathUtilities.cpp:
3756         (WebCore::addToSVGPathByteStream): Answer Simon's questions which were added in r190844.
3757         * svg/SVGPoint.h:
3758         (WebCore::SVGPoint::SVGPoint): Delete unused constructor and create method.
3759         * svg/SVGPointListValues.h:
3760         (WebCore::SVGPropertyTraits<SVGPointListValues>::fromString): New SVGPropertyTraits method.
3761         * svg/SVGPolyElement.cpp:
3762         (WebCore::SVGPolyElement::parseAttribute): Use the move assignment operator.
3763         * svg/SVGPreserveAspectRatio.h:
3764         (WebCore::SVGPreserveAspectRatio::SVGPreserveAspectRatio): Delete unused constructor and create method.
3765         * svg/SVGPreserveAspectRatioValue.cpp:
3766         (WebCore::SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue): Add new constructor.
3767         * svg/SVGPreserveAspectRatioValue.h:
3768         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString): New SVGPropertyTraits method.
3769         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString): Ditto.
3770         * svg/SVGRect.h:
3771         (WebCore::SVGRect::SVGRect): Delete unused constructor and create method.
3772         * svg/SVGRectTraits.h: Removed.
3773         * svg/SVGTransform.h:
3774         (WebCore::SVGTransform::SVGTransform): Delete unused constructor and create method.
3775         * svg/SVGTransformListValues.h:
3776         (WebCore::SVGPropertyTraits<SVGTransformListValues>::fromString): New SVGPropertyTraits method.
3777         * svg/properties/SVGPropertyTearOff.h: Delete unused create method.
3778         * svg/properties/SVGPropertyTraits.h: New SVGPropertyTraits methods.
3779         (WebCore::SVGPropertyTraits<bool>::fromString): 
3780         (WebCore::SVGPropertyTraits<Color>::initialValue):
3781         (WebCore::SVGPropertyTraits<Color>::fromString):
3782         (WebCore::SVGPropertyTraits<Color>::parse):
3783         (WebCore::SVGPropertyTraits<Color>::toString):
3784         (WebCore::SVGPropertyTraits<int>::fromString):
3785         (WebCore::SVGPropertyTraits<float>::fromString):
3786         (WebCore::SVGPropertyTraits<float>::parse):
3787         (WebCore::SVGPropertyTraits<FloatPoint>::initialValue):
3788         (WebCore::SVGPropertyTraits<FloatPoint>::fromString):
3789         (WebCore::SVGPropertyTraits<FloatPoint>::parse):
3790         (WebCore::SVGPropertyTraits<FloatPoint>::toString):
3791         (WebCore::SVGPropertyTraits<FloatRect>::initialValue):
3792         (WebCore::SVGPropertyTraits<FloatRect>::fromString):
3793         (WebCore::SVGPropertyTraits<FloatRect>::parse):
3794         (WebCore::SVGPropertyTraits<FloatRect>::toString):
3795         (WebCore::SVGPropertyTraits<String>::fromString):
3796         (WebCore::SVGPropertyTraits<String>::parse):
3797         (WebCore::SVGPropertyTraits<String>::toString):
3798
3799 2018-02-19  Antoine Quint  <graouts@apple.com>
3800
3801         [Modern Media Controls] Implement a compact set of media controls
3802         https://bugs.webkit.org/show_bug.cgi?id=182937
3803         <rdar://problem/37682257>
3804
3805         Reviewed by Eric Carlson.
3806
3807         We add a new type of media controls used when we need stripped down and compact controls. The new
3808         CompactMediaControls only show a play/pause button and an invalid placard and disregard all media
3809         events that are not relevant to the display of these controls.
3810
3811         To distinguish cases where we need to show compact media controls, we expose a new property on
3812         MediaControlsHost called "compactMode".
3813
3814         Tests: media/modern-media-controls/compact-media-controls/compact-media-controls-constructor.html
3815                media/modern-media-controls/compact-media-controls/compact-media-controls-layout.html
3816
3817         * Modules/mediacontrols/MediaControlsHost.cpp:
3818         (WebCore::MediaControlsHost::base64StringForIconNameAndType const):
3819         (WebCore::MediaControlsHost::compactMode const):
3820         * Modules/mediacontrols/MediaControlsHost.h:
3821         (WebCore::MediaControlsHost::setSimulateCompactMode):
3822         * Modules/mediacontrols/MediaControlsHost.idl:
3823         * Modules/modern-media-controls/controls/compact-media-controls.js: Added.
3824         (CompactMediaControls.prototype.get scaleFactor):
3825         (CompactMediaControls.prototype.set scaleFactor):
3826         (CompactMediaControls.prototype.get shouldCenterControlsVertically):
3827         (CompactMediaControls.prototype.set shouldCenterControlsVertically):
3828         (CompactMediaControls.prototype.get placard):
3829         (CompactMediaControls.prototype.set placard):
3830         (CompactMediaControls.prototype.layout):
3831         (CompactMediaControls.prototype.commitProperty):
3832         * Modules/modern-media-controls/controls/icon-service.js:
3833         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconAndLayoutTraits):
3834         (const.iconService.new.IconService):
3835         * Modules/modern-media-controls/controls/inline-media-controls.js:
3836         * Modules/modern-media-controls/controls/layout-item.js:
3837         * Modules/modern-media-controls/js-files:
3838         * Modules/modern-media-controls/main.js:
3839         * Modules/modern-media-controls/media/media-controller.js:
3840         (MediaController.prototype.get layoutTraits):
3841         (MediaController.prototype._supportingObjectClasses): Compute the set of MediaControllerSupport classes based
3842         on the layout traits such that in compact mode we only return PlacardSupport and PlaybackSupport.
3843         (MediaController.prototype._updateControlsIfNeeded):
3844         (MediaController.prototype._controlsClassForLayoutTraits):
3845         (MediaController.prototype._shouldControlsBeAvailable):
3846         * Modules/modern-media-controls/media/placard-support.js:
3847         (PlacardSupport.prototype.get mediaEvents): Only track the "error" event in compact mode since this is the only
3848         relevant placard.
3849         * Modules/modern-media-controls/media/playback-support.js:
3850         (PlaybackSupport.prototype.syncControl): Only show or hide the play/pause button based on the playback state
3851         when in compact mode.
3852         (PlaybackSupport):
3853         * WebCore.xcodeproj/project.pbxproj:
3854
3855 2018-02-19  Antoine Quint  <graouts@apple.com>
3856
3857         [Web Animations] Make KeyframeEffect target nullable and read-write
3858         https://bugs.webkit.org/show_bug.cgi?id=182741
3859
3860         Reviewed by Dean Jackson.
3861
3862         We used to completely disregard null targets, for instance not parsing keyframes, but targets
3863         can be null and are also supposed to be read-write for KeyframeEffect. We now update the IDL
3864         for KeyframeEffect to mark the target property as read-write and update the implementation
3865         to correctly handle null targets.
3866
3867         This revealed a few issues in our implementation by allowing more WPT tests to run. So we also
3868         ensure that:
3869         
3870         - we don't crash when parsing font-related properties by calling update() on the generated
3871         RenderStyle's FontCascade when parsing keyframes.
3872
3873         - CSS properties are provided as camel-case and not as hyphenated form
3874
3875         - values provided in keyframes dictionaries are only read for valid properties
3876
3877         - styles for effect targets are invalidated as soon as the timing model for that animation
3878         is changed
3879
3880         * animation/KeyframeEffect.idl:
3881         * animation/KeyframeEffectReadOnly.cpp:
3882         (WebCore::invalidateElement): Add a new utility method to invalidate a given element since
3883         we may want to invalidate not only the current target (m_target) but also a previous target.
3884         (WebCore::IDLAttributeNameToAnimationPropertyName): Move this function below CSSPropertyIDToIDLAttributeName
3885         so that it can call that function. We also check that we reject CSS properties that are not provided in
3886         camel-case form (eg. "font-size" vs. "fontSize").
3887         (WebCore::processIterableKeyframes): Only read the JS values if we know that the provided JS property name
3888         maps to a valid CSS property.
3889         (WebCore::KeyframeEffectReadOnly::processKeyframes): Allow keyframes to be processed even if the effect's
3890         target is null.
3891         (WebCore::KeyframeEffectReadOnly::setTarget): Notify the animation that the effect target has changed and
3892         invalidate the style of the new target and the old targets, if any. We also update the blending keyframes
3893         since this task may not have been completed in a previous call to processKeyframes() due to the target being
3894         null at that time.
3895         (WebCore::KeyframeEffectReadOnly::invalidate): Use the invalidateElement() utility.
3896         * animation/KeyframeEffectReadOnly.h:
3897         * animation/WebAnimation.cpp:
3898         (WebCore::WebAnimation::effectTargetDidChange): This method is called in KeyframeEffectReadOnly::setTarget()
3899         to inform the animation of the previous effect target and the new one upon a target change. This allows us to
3900         forward this information onto the timeline so that we correctly add or remove the targets from the list of
3901         animated elements.
3902         * animation/WebAnimation.h:
3903
3904 2018-02-19  Chris Dumez  <cdumez@apple.com>
3905
3906         Crash under MIMETypeRegistry::isSupportedJavaScriptMIMEType()
3907         https://bugs.webkit.org/show_bug.cgi?id=182927
3908         <rdar://problem/37675748>
3909
3910         Reviewed by Antti Koivisto.
3911
3912         Make it safe to call MIMETypeRegistry::isSupportedJavaScriptMIMEType() from the non-main thread.
3913         It is currently being called from a background thread in the following places:
3914         - ServiceWorkerJob::didReceiveResponse()
3915         - WorkerGlobalScope::importScripts()
3916
3917         These call sites on non-main threads were added recently with the support for service workers.
3918
3919         No new tests, already covered by existing tests that flakily experience service worker
3920         process crashes.
3921
3922         * platform/MIMETypeRegistry.cpp:
3923         (WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType):
3924
3925 2018-02-19  Dean Jackson  <dino@apple.com>
3926
3927         SIGFPE @ int WebCore::SVGToOTFFontConverter::scaleUnitsPerEm<int> const + 45
3928         https://bugs.webkit.org/show_bug.cgi?id=182944
3929         <rdar://problem/35369984>
3930
3931         Reviewed by Myles Maxfield.
3932
3933         Avoid a divide-by-zero.
3934
3935         Test: svg/text/font-bad-unitsperem.html
3936
3937         * svg/SVGFontFaceElement.cpp:
3938         (WebCore::SVGFontFaceElement::unitsPerEm const):
3939
3940 2018-02-19  Tim Horton  <timothy_horton@apple.com>
3941
3942         REGRESSION (r219342): Touch event coordinates and elementFromPoint coordinates differ
3943         https://bugs.webkit.org/show_bug.cgi?id=182910
3944         <rdar://problem/37533950>
3945
3946         Reviewed by Simon Fraser.
3947
3948         We reverted other changes to the definition of client coordinates
3949         in r219829 due to compatibility concerns. However, we failed to revert
3950         r219342 on trunk, leaving elementFromPoint() using coordinates relative
3951         to the layout viewport.
3952
3953         Add a currently off-by-default setting to switch on layout-viewport-relative
3954         client coordinates and guard the elementFromPoint changes behind it.
3955         A future patch should roll r219829 back in also behind this setting, so
3956         that everything remains consistent regardless of which coordinate space we choose.
3957
3958         * dom/TreeScope.cpp:
3959         (WebCore::absolutePointIfNotClipped):
3960         * page/Settings.yaml:
3961         * rendering/RenderLayer.cpp:
3962         (WebCore::RenderLayer::hitTest):
3963
3964 2018-02-19  Eric Carlson  <eric.carlson@apple.com>
3965
3966         [Extra zoom mode] Don't allow PiP media playback
3967         https://bugs.webkit.org/show_bug.cgi?id=182930
3968         <rdar://problem/37676259>
3969
3970         Reviewed by Andy Estes.
3971
3972         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3973         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Don't call setPIPModeEnabled:
3974         if it isn't implemented.
3975         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.
3976
3977 2018-02-19  Antoine Quint  <graouts@apple.com>
3978
3979         [Web Animations] Decouple parsing JS keyframes and computing blending keyframes