Playing media elements which call "pause(); play()" will have the play promise rejected.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-12-18  Jer Noble  <jer.noble@apple.com>
2
3         Playing media elements which call "pause(); play()" will have the play promise rejected.
4         https://bugs.webkit.org/show_bug.cgi?id=180781
5
6         Reviewed by Eric Carlson.
7
8         Test: media/video-pause-play-resolve.html
9
10         When scheduling a rejection or resolution of existing play promises, move() the existing
11         promises into the block. This ensures that valid promises aren't added to the play promise
12         vector between when a rejection is scheduled and when it runs.
13
14         Drive-by fix: Don't return false from playInternal() just so the newly created promise will
15         get rejected. The pause() command will reject the promise, so just make sure it's added to
16         the m_pendingPlayPromises before calling playInternal().
17
18         Drive-by fix #2: The spec referenced by playInternal() and pauseInternal() doesn't say to
19         call the "Media Element Load Algorithm" (i.e., prepareForLoad()); it says to call the
20         "Resource Selection Algorithm" (i.e., selectMediaResource()). But fixing this bug caused
21         an assertion crash when the resource selection task was fired and m_player was null. This
22         was because the algorithm is being run at stop() time due to stop() calling pause(). The
23         solution to this ASSERT is to stop the m_resourceSelectionTaskQueue in stop().
24
25         * html/HTMLMediaElement.cpp:
26         (WebCore::HTMLMediaElement::scheduleRejectPendingPlayPromises):
27         (WebCore::HTMLMediaElement::rejectPendingPlayPromises):
28         (WebCore::HTMLMediaElement::resolvePendingPlayPromises):
29         (WebCore::HTMLMediaElement::scheduleNotifyAboutPlaying):
30         (WebCore::HTMLMediaElement::notifyAboutPlaying):
31         (WebCore::HTMLMediaElement::noneSupported):
32         (WebCore::HTMLMediaElement::cancelPendingEventsAndCallbacks):
33         (WebCore::HTMLMediaElement::play):
34         (WebCore::HTMLMediaElement::playInternal):
35         (WebCore::HTMLMediaElement::pauseInternal):
36         (WebCore::HTMLMediaElement::stop):
37         * html/HTMLMediaElement.h:
38
39 2017-12-18  Daniel Bates  <dabates@apple.com>
40
41         Add SPI to query for the current and last auto fill button type and pass user data object to _webView:focusShouldStartInputSession:
42         https://bugs.webkit.org/show_bug.cgi?id=180774
43         <rdar://problem/36033832>
44
45         Reviewed by Tim Horton.
46
47         Expose a way for an embedding client to query for the auto fill button type of a specific
48         input element as it may not be feasible for a client to track such state themselves. For
49         similar reasons track and expose SPI to query for the last auto fill button type for a
50         specific field.
51
52         Test: fast/forms/auto-fill-button/last-auto-fill-button-type.html
53
54         * html/HTMLInputElement.cpp:
55         (WebCore::HTMLInputElement::HTMLInputElement):
56         (WebCore::HTMLInputElement::setShowAutoFillButton):
57         Update the last auto fill button type.
58
59         * html/HTMLInputElement.h:
60         (WebCore::HTMLInputElement::lastAutoFillButtonType const): Added.
61
62         * testing/Internals.cpp:
63         (WebCore::toAutoFillButtonType):
64         (WebCore::toInternalsAutoFillButtonType):
65         (WebCore::Internals::autoFillButtonType):
66         (WebCore::Internals::lastAutoFillButtonType):
67         * testing/Internals.h:
68         * testing/Internals.idl:
69         Add functions for testing.
70
71 2017-12-17  John Wilander  <wilander@apple.com>
72
73         Storage Access API: Make document.hasStorageAccess() retrieve current status from the network process
74         https://bugs.webkit.org/show_bug.cgi?id=180681
75         <rdar://problem/35982161>
76
77         Reviewed by Alex Christensen.
78
79         Tests: http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html
80                http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html
81
82         This change makes an asynchronous request to the network process
83         to see if storage access has been granted for this frame, on this
84         page, for this domain.
85
86         * dom/Document.cpp:
87         (WebCore::Document::hasStorageAccess):
88         * page/ChromeClient.h:
89
90 2017-12-17  Chris Dumez  <cdumez@apple.com>
91
92         Strip fragment identifier from ServiceWorker's scriptURL
93         https://bugs.webkit.org/show_bug.cgi?id=180887
94
95         Reviewed by Darin Adler.
96
97         Strip fragment identifier from ServiceWorker's scriptURL to match Firefox and Chrome.
98         This behavior does not appear to be specified so I filed:
99         - https://github.com/w3c/ServiceWorker/issues/1249
100
101         No new tests, rebaselined existing test.
102
103         * workers/service/server/SWServerWorker.cpp:
104         (WebCore::m_script):
105
106 2017-12-17  Antti Koivisto  <antti@apple.com>
107
108         Move render tree updating related files under rendering/updating/
109         https://bugs.webkit.org/show_bug.cgi?id=180918
110
111         Reviewed by Darin Adler.
112
113         * CMakeLists.txt:
114         * Sources.txt:
115         * WebCore.xcodeproj/project.pbxproj:
116         * rendering/RenderTreeBuilder.cpp: Removed.
117         * rendering/RenderTreeBuilder.h: Removed.
118         * rendering/updating: Added.
119         * rendering/updating/RenderTreeBuilder.cpp: Copied from Source/WebCore/rendering/RenderTreeBuilder.cpp.
120         * rendering/updating/RenderTreeBuilder.h: Copied from Source/WebCore/rendering/RenderTreeBuilder.h.
121         * rendering/updating/RenderTreePosition.cpp: Copied from Source/WebCore/style/RenderTreePosition.cpp.
122         * rendering/updating/RenderTreePosition.h: Copied from Source/WebCore/style/RenderTreePosition.h.
123         * rendering/updating/RenderTreeUpdater.cpp: Copied from Source/WebCore/style/RenderTreeUpdater.cpp.
124         * rendering/updating/RenderTreeUpdater.h: Copied from Source/WebCore/style/RenderTreeUpdater.h.
125         * rendering/updating/RenderTreeUpdaterFirstLetter.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterFirstLetter.cpp.
126         * rendering/updating/RenderTreeUpdaterFirstLetter.h: Copied from Source/WebCore/style/RenderTreeUpdaterFirstLetter.h.
127         * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterGeneratedContent.cpp.
128         * rendering/updating/RenderTreeUpdaterGeneratedContent.h: Copied from Source/WebCore/style/RenderTreeUpdaterGeneratedContent.h.
129         * rendering/updating/RenderTreeUpdaterListItem.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterListItem.cpp.
130         * rendering/updating/RenderTreeUpdaterListItem.h: Copied from Source/WebCore/style/RenderTreeUpdaterListItem.h.
131         * rendering/updating/RenderTreeUpdaterMultiColumn.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterMultiColumn.cpp.
132         * rendering/updating/RenderTreeUpdaterMultiColumn.h: Copied from Source/WebCore/style/RenderTreeUpdaterMultiColumn.h.
133         * style/RenderTreePosition.cpp: Removed.
134         * style/RenderTreePosition.h: Removed.
135         * style/RenderTreeUpdater.cpp: Removed.
136         * style/RenderTreeUpdater.h: Removed.
137         * style/RenderTreeUpdaterFirstLetter.cpp: Removed.
138         * style/RenderTreeUpdaterFirstLetter.h: Removed.
139         * style/RenderTreeUpdaterGeneratedContent.cpp: Removed.
140         * style/RenderTreeUpdaterGeneratedContent.h: Removed.
141         * style/RenderTreeUpdaterListItem.cpp: Removed.
142         * style/RenderTreeUpdaterListItem.h: Removed.
143         * style/RenderTreeUpdaterMultiColumn.cpp: Removed.
144         * style/RenderTreeUpdaterMultiColumn.h: Removed.
145
146 2017-12-17  Yusuke Suzuki  <utatane.tea@gmail.com>
147
148         [JSC][WebCore][CSSJIT] Remove VM reference in CSSJIT
149         https://bugs.webkit.org/show_bug.cgi?id=180917
150
151         Reviewed by Sam Weinig.
152
153         Remove VM reference in CSSJIT. CSSJIT should not be
154         bound to a specific VM.
155
156         No behavior change.
157
158         * css/ElementRuleCollector.cpp:
159         (WebCore::ElementRuleCollector::ruleMatches):
160         * cssjit/SelectorCompiler.cpp:
161         (WebCore::SelectorCompiler::compileSelector):
162         * cssjit/SelectorCompiler.h:
163         * dom/SelectorQuery.cpp:
164         (WebCore::SelectorDataList::compileSelector):
165         (WebCore::SelectorDataList::execute const):
166         * dom/SelectorQuery.h:
167
168 2017-12-16  Dan Bernstein  <mitz@apple.com>
169
170         WKWebView has no equivalent of -[WebView setAlwaysShowVerticalScroller:]
171         https://bugs.webkit.org/show_bug.cgi?id=180613
172         <rdar://problem/35946124>
173
174         Reviewed by Geoff Garen.
175
176         Test: TestWebKitAPI/Tests/WebKitCocoa/WKWebViewAlwaysShowsScroller.mm
177
178         * platform/ScrollView.h: Exported setScrollbarModes.
179
180 2017-12-16  Antti Koivisto  <antti@apple.com>
181
182         Introduce RenderTreeBuilder
183         https://bugs.webkit.org/show_bug.cgi?id=180817
184
185         Reviewed by Zalan Bujtas.
186
187         RenderTreeBuilder is responsible of building the render tree, including construction of various anonymous
188         renderers. Renderer subtype specific render tree construction code will eventually move there.
189
190         This patch adds RenderTreeBuilder class and passes it as a parameter for all addChild implementations.
191         Future patches can then mechanically move the building code from renderers to RenderTreeBuilder.
192
193         It also moves one addChild implementation (RenderRuby::addChild -> RenderTreeBuilder::rubyRunInsertChild)
194         to RenderTreeBuilder as a test.
195
196         * WebCore.xcodeproj/project.pbxproj:
197         * rendering/RenderBlock.cpp:
198         (WebCore::RenderBlock::addChildToContinuation):
199         (WebCore::RenderBlock::addChild):
200         (WebCore::RenderBlock::addChildIgnoringContinuation):
201         * rendering/RenderBlock.h:
202         * rendering/RenderBlockFlow.cpp:
203         (WebCore::RenderBlockFlow::addChild):
204         * rendering/RenderBlockFlow.h:
205         * rendering/RenderBoxModelObject.cpp:
206         (WebCore::RenderBoxModelObject::moveChildTo):
207         * rendering/RenderButton.cpp:
208         (WebCore::RenderButton::addChild):
209         (WebCore::RenderButton::setText):
210         * rendering/RenderButton.h:
211         * rendering/RenderElement.cpp:
212         (WebCore::RenderElement::addChild):
213         * rendering/RenderElement.h:
214         (WebCore::RenderElement::addChildIgnoringContinuation):
215         * rendering/RenderFullScreen.cpp:
216         (WebCore::RenderFullScreen::wrapNewRenderer):
217         (WebCore::RenderFullScreen::wrapExistingRenderer):
218         (WebCore::RenderFullScreen::unwrapRenderer):
219         (WebCore::RenderFullScreen::createPlaceholder):
220         * rendering/RenderGrid.cpp:
221         (WebCore::RenderGrid::addChild):
222         * rendering/RenderGrid.h:
223         * rendering/RenderInline.cpp:
224         (WebCore::RenderInline::addChild):
225         (WebCore::RenderInline::addChildIgnoringContinuation):
226         (WebCore::RenderInline::splitInlines):
227         (WebCore::RenderInline::splitFlow):
228         (WebCore::RenderInline::addChildToContinuation):
229         (WebCore::RenderInline::childBecameNonInline):
230         * rendering/RenderInline.h:
231         * rendering/RenderMenuList.cpp:
232         (WebCore::RenderMenuList::createInnerBlock):
233         (RenderMenuList::addChild):
234         (RenderMenuList::setText):
235         * rendering/RenderMenuList.h:
236         * rendering/RenderMultiColumnFlow.cpp:
237         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
238         * rendering/RenderQuote.cpp:
239         (WebCore::RenderQuote::updateTextRenderer):
240         (WebCore::RenderQuote::updateRenderer):
241         * rendering/RenderQuote.h:
242         * rendering/RenderRuby.cpp:
243         (WebCore::RenderRubyAsInline::addChild):
244         (WebCore::RenderRubyAsBlock::addChild):
245         * rendering/RenderRuby.h:
246         * rendering/RenderRubyBase.h:
247         * rendering/RenderRubyRun.cpp:
248         (WebCore::RenderRubyRun::rubyBaseSafe):
249         (WebCore::RenderRubyRun::addChild): Deleted.
250         * rendering/RenderRubyRun.h:
251         * rendering/RenderTable.cpp:
252         (WebCore::RenderTable::addChild):
253         * rendering/RenderTable.h:
254         * rendering/RenderTableRow.cpp:
255         (WebCore::RenderTableRow::addChild):
256         * rendering/RenderTableRow.h:
257         * rendering/RenderTableSection.cpp:
258         (WebCore::RenderTableSection::addChild):
259         * rendering/RenderTableSection.h:
260         * rendering/RenderTreeBuilder.cpp: Added.
261         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
262         (WebCore::RenderTreeBuilder::~RenderTreeBuilder):
263         (WebCore::RenderTreeBuilder::insertChild):
264         (WebCore::RenderTreeBuilder::rubyRunInsertChild):
265         * rendering/RenderTreeBuilder.h: Added.
266         (WebCore::RenderTreeBuilder::current):
267         * rendering/TextAutoSizing.cpp:
268         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
269         * rendering/mathml/RenderMathMLFenced.cpp:
270         (WebCore::RenderMathMLFenced::updateFromElement):
271         (WebCore::RenderMathMLFenced::makeFences):
272         (WebCore::RenderMathMLFenced::addChild):
273         * rendering/mathml/RenderMathMLFenced.h:
274         * rendering/svg/RenderSVGContainer.cpp:
275         (WebCore::RenderSVGContainer::addChild):
276         * rendering/svg/RenderSVGContainer.h:
277         * rendering/svg/RenderSVGInline.cpp:
278         (WebCore::RenderSVGInline::addChild):
279         * rendering/svg/RenderSVGInline.h:
280         * rendering/svg/RenderSVGRoot.cpp:
281         (WebCore::RenderSVGRoot::addChild):
282         * rendering/svg/RenderSVGRoot.h:
283         * rendering/svg/RenderSVGText.cpp:
284         (WebCore::RenderSVGText::addChild):
285         * rendering/svg/RenderSVGText.h:
286         * style/RenderTreePosition.cpp:
287         (WebCore::RenderTreePosition::insert): Deleted.
288         * style/RenderTreePosition.h:
289         (WebCore::RenderTreePosition::RenderTreePosition):
290         (WebCore::RenderTreePosition::nextSibling const):
291         (WebCore::RenderTreePosition::canInsert const): Deleted.
292         * style/RenderTreeUpdater.cpp:
293         (WebCore::RenderTreeUpdater::updateAfterDescendants):
294         (WebCore::RenderTreeUpdater::createRenderer):
295         (WebCore::RenderTreeUpdater::createTextRenderer):
296         (WebCore::RenderTreeUpdater::updateTextRenderer):
297         (WebCore::createTextRenderer): Deleted.
298         * style/RenderTreeUpdater.h:
299         * style/RenderTreeUpdaterFirstLetter.cpp:
300         (WebCore::updateFirstLetterStyle):
301         (WebCore::createFirstLetterRenderer):
302         * style/RenderTreeUpdaterGeneratedContent.cpp:
303         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
304         (WebCore::createContentRenderers):
305         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
306         * style/RenderTreeUpdaterListItem.cpp:
307         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
308         * style/RenderTreeUpdaterListItem.h:
309         * style/RenderTreeUpdaterMultiColumn.cpp:
310         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow):
311         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
312
313 2017-12-16  Romain Bellessort  <romain.bellessort@crf.canon.fr>
314
315         [Readable Streams API] Fix filling of descriptor from queue
316         https://bugs.webkit.org/show_bug.cgi?id=172717
317
318         Reviewed by Youenn Fablet.
319
320         Fixed the filling of descriptor from queue (step 10.d at [1]). When first implemented,
321         spec comprised a bug and code was not reachable. Spec has now been fixed and code can
322         now be reached.
323
324         [1] https://streams.spec.whatwg.org/#readable-byte-stream-controller-fill-pull-into-descriptor-from-queue
325
326         No new tests (covered by WPT tests, whose expectations have been updated).
327
328         * Modules/streams/ReadableByteStreamInternals.js:
329         (readableByteStreamControllerFillDescriptorFromQueue): Updated.
330
331 2017-12-16  Brady Eidson  <beidson@apple.com>
332
333         Implement getting ServiceWorker registrations for the WKWebsiteDataStore API
334         https://bugs.webkit.org/show_bug.cgi?id=180886
335
336         Reviewed by Chris Dumez.
337
338         No new tests (API test coming soon).
339
340         * workers/service/server/SWServer.cpp:
341         (WebCore::SWServer::registrationStoreImportComplete):
342         (WebCore::SWServer::SWServer):
343         (WebCore::SWServer::getOriginsWithRegistrations):
344         (WebCore::SWServer::performGetOriginsWithRegistrationsCallbacks):
345         * workers/service/server/SWServer.h:
346
347 2017-12-16  Yusuke Suzuki  <utatane.tea@gmail.com>
348
349         Remove unnecessary boolean result of start() functions
350         https://bugs.webkit.org/show_bug.cgi?id=180856
351
352         Reviewed by Darin Adler.
353
354         No behavior change.
355
356         * Modules/webaudio/AsyncAudioDecoder.cpp:
357         (WebCore::AsyncAudioDecoder::~AsyncAudioDecoder):
358         * Modules/webdatabase/DatabaseContext.cpp:
359         (WebCore::DatabaseContext::databaseThread):
360         * Modules/webdatabase/DatabaseThread.cpp:
361         (WebCore::DatabaseThread::start):
362         Now `Thread::create` always succeeds (if it fails, WebKit crashes).
363         DatabaseThread::start() now always returns true. So, we do not need
364         to return bool.
365
366         * Modules/webdatabase/DatabaseThread.h:
367         * platform/network/curl/CurlDownload.cpp:
368         (WebCore::CurlDownload::start):
369         * platform/network/curl/CurlDownload.h:
370         * platform/network/curl/ResourceHandleCurl.cpp:
371         (WebCore::ResourceHandle::start):
372         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
373         (WebCore::ResourceHandleCurlDelegate::start):
374         * platform/network/curl/ResourceHandleCurlDelegate.h:
375
376 2017-12-16  Chris Dumez  <cdumez@apple.com>
377
378         Add optimization when updating a SW registration results in the exact same script
379         https://bugs.webkit.org/show_bug.cgi?id=180891
380
381         Reviewed by Geoffrey Garen.
382
383         Add optimization when updating a SW registration results in the exact same script:
384         - https://w3c.github.io/ServiceWorker/#update-algorithm (step 8)
385
386         No new tests, rebaselined existing test.
387
388         * workers/service/server/SWServerJobQueue.cpp:
389         (WebCore::SWServerJobQueue::scriptFetchFinished):
390
391 2017-12-16  Youenn Fablet  <youenn@apple.com>
392
393         Service worker script fetch request should set the Service-Worker header
394         https://bugs.webkit.org/show_bug.cgi?id=180889
395
396         Reviewed by Chris Dumez.
397
398         Test: http/wpt/service-workers/check-service-worker-header.https.html
399
400         Update WorkerScriptLoader to take a request instead of an URL.
401         Updates Worker implementation and use it in ServiceWorkerJob to set the missing request header.
402
403         * workers/Worker.cpp:
404         (WebCore::Worker::create):
405         * workers/WorkerScriptLoader.cpp:
406         (WebCore::WorkerScriptLoader::loadAsynchronously):
407         * workers/WorkerScriptLoader.h:
408         * workers/service/ServiceWorkerJob.cpp:
409         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
410
411 2017-12-15  Ryan Haddad  <ryanhaddad@apple.com>
412
413         Unreviewed, rolling out r225969.
414
415         This change introduced LayoutTest crashes.
416
417         Reverted changeset:
418
419         "Introduce RenderTreeBuilder"
420         https://bugs.webkit.org/show_bug.cgi?id=180817
421         https://trac.webkit.org/changeset/225969
422
423 2017-12-15  Chris Dumez  <cdumez@apple.com>
424
425         Support updating a service worker registration's updateViaCache flag
426         https://bugs.webkit.org/show_bug.cgi?id=180888
427
428         Reviewed by Brady Eidson.
429
430         Support updating a service worker registration's updateViaCache flag to match other browsers:
431         - https://github.com/w3c/ServiceWorker/issues/1189
432
433         No new tests, rebaselined existing test.
434
435         * workers/service/SWClientConnection.cpp:
436         (WebCore::SWClientConnection::setRegistrationUpdateViaCache):
437         * workers/service/SWClientConnection.h:
438         * workers/service/ServiceWorkerRegistration.cpp:
439         (WebCore::ServiceWorkerRegistration::setUpdateViaCache):
440         * workers/service/ServiceWorkerRegistration.h:
441         * workers/service/server/SWServer.h:
442         * workers/service/server/SWServerJobQueue.cpp:
443         (WebCore::SWServerJobQueue::runRegisterJob):
444         * workers/service/server/SWServerRegistration.cpp:
445         (WebCore::SWServerRegistration::setUpdateViaCache):
446         * workers/service/server/SWServerRegistration.h:
447
448 2017-12-15  Ryan Haddad  <ryanhaddad@apple.com>
449
450         Unreviewed, rolling out r225941.
451
452         This change introduced LayoutTest crashes and assertion
453         failures.
454
455         Reverted changeset:
456
457         "Web Inspector: replace HTMLCanvasElement with
458         CanvasRenderingContext for instrumentation logic"
459         https://bugs.webkit.org/show_bug.cgi?id=180770
460         https://trac.webkit.org/changeset/225941
461
462 2017-12-15  Ryosuke Niwa  <rniwa@webkit.org>
463
464         Add a release assert that Timer::m_wasDeleted is false in setNextFireTime
465         https://bugs.webkit.org/show_bug.cgi?id=180860
466         <rdar://problem/36066500>
467
468         Reviewed by David Kilzer.
469
470         Turn an exist debug-only assertion into a release assertion to help diagnose a crash
471         which appears to be caused by a freed timer getting scheduled back into the timer heap.
472
473         * platform/Timer.cpp:
474         (WebCore::TimerBase::~TimerBase):
475         (WebCore::TimerBase::setNextFireTime):
476         * platform/Timer.h:
477
478 2017-12-15  Simon Fraser  <simon.fraser@apple.com>
479
480         Elements animated on-screen are missing sometimes
481         https://bugs.webkit.org/show_bug.cgi?id=180773
482         rdar://problem/34923438
483
484         Reviewed by Zalan Bujtas.
485         
486         After r225310 it was still possible for elements to be missing backing store when brought
487         on-screen via an animation. This occurred if a child element was outside the bounds of the
488         element being animated.
489
490         Fix by making sure that GraphicsLayer's "animatedExtent" took composited child layers into account.
491
492         As for r225310, no test because this is timing sensitive and hard to reliably make a test for.
493
494         * rendering/RenderLayer.cpp:
495         (WebCore::RenderLayer::calculateClipRects const):
496         * rendering/RenderLayer.h:
497         * rendering/RenderLayerBacking.cpp:
498         (WebCore::RenderLayerBacking::updateGeometry):
499
500 2017-12-15  Chris Dumez  <cdumez@apple.com>
501
502         imported/w3c/web-platform-tests/service-workers/service-worker/update.https.html is sometimes crashing in Debug builds
503         https://bugs.webkit.org/show_bug.cgi?id=180867
504
505         Reviewed by Brady Eidson.
506
507         Fix assertion to make sure the worker is terminating if it is already in m_runningOrTerminatingWorkers.
508
509         * workers/service/server/SWServer.cpp:
510         (WebCore::SWServer::runServiceWorker):
511
512 2017-12-15  Chris Dumez  <cdumez@apple.com>
513
514         Service Worker Registration promise is sometimes not rejected when the script load fails
515         https://bugs.webkit.org/show_bug.cgi?id=180849
516
517         Reviewed by Brady Eidson.
518
519         Service Worker Registration promise is sometimes not rejected when the script load fails.
520         This was caused by the ServiceWorkerJob sometimes passing a null ResourceError to the
521         StorageProcess, even though the load failed.
522
523         No new tests, rebaselined exisiting tests.
524
525         * workers/WorkerScriptLoader.cpp:
526         (WebCore::WorkerScriptLoader::notifyError):
527         * workers/service/ServiceWorkerJob.cpp:
528         (WebCore::ServiceWorkerJob::notifyFinished):
529
530 2017-12-15  Youenn Fablet  <youenn@apple.com>
531
532         WebRTC Stats should not be console logged from a background thread
533         https://bugs.webkit.org/show_bug.cgi?id=180845
534
535         Reviewed by Eric Carlson.
536
537         Ensuring console log are done in the main thread.
538
539         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
540         (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
541
542 2017-12-15  Antti Koivisto  <antti@apple.com>
543
544         Introduce RenderTreeBuilder
545         https://bugs.webkit.org/show_bug.cgi?id=180817
546
547         Reviewed by Zalan Bujtas.
548
549         RenderTreeBuilder is responsible of building the render tree, including construction of various anonymous
550         renderers. Renderer subtype specific render tree construction code will eventually move there.
551
552         This patch adds RenderTreeBuilder class and passes it as a parameter for all addChild implementations.
553         Future patches can then mechanically move the building code from renderers to RenderTreeBuilder.
554
555         It also moves one addChild implementation (RenderRuby::addChild -> RenderTreeBuilder::rubyRunInsertChild)
556         to RenderTreeBuilder as a test.
557
558         * WebCore.xcodeproj/project.pbxproj:
559         * rendering/RenderBlock.cpp:
560         (WebCore::RenderBlock::addChildToContinuation):
561         (WebCore::RenderBlock::addChild):
562         (WebCore::RenderBlock::addChildIgnoringContinuation):
563         * rendering/RenderBlock.h:
564         * rendering/RenderBlockFlow.cpp:
565         (WebCore::RenderBlockFlow::addChild):
566         * rendering/RenderBlockFlow.h:
567         * rendering/RenderBoxModelObject.cpp:
568         (WebCore::RenderBoxModelObject::moveChildTo):
569         * rendering/RenderButton.cpp:
570         (WebCore::RenderButton::addChild):
571         (WebCore::RenderButton::setText):
572         * rendering/RenderButton.h:
573         * rendering/RenderElement.cpp:
574         (WebCore::RenderElement::addChild):
575         * rendering/RenderElement.h:
576         (WebCore::RenderElement::addChildIgnoringContinuation):
577         * rendering/RenderFullScreen.cpp:
578         (WebCore::RenderFullScreen::wrapNewRenderer):
579         (WebCore::RenderFullScreen::wrapExistingRenderer):
580         (WebCore::RenderFullScreen::unwrapRenderer):
581         (WebCore::RenderFullScreen::createPlaceholder):
582         * rendering/RenderGrid.cpp:
583         (WebCore::RenderGrid::addChild):
584         * rendering/RenderGrid.h:
585         * rendering/RenderInline.cpp:
586         (WebCore::RenderInline::addChild):
587         (WebCore::RenderInline::addChildIgnoringContinuation):
588         (WebCore::RenderInline::splitInlines):
589         (WebCore::RenderInline::splitFlow):
590         (WebCore::RenderInline::addChildToContinuation):
591         (WebCore::RenderInline::childBecameNonInline):
592         * rendering/RenderInline.h:
593         * rendering/RenderMenuList.cpp:
594         (WebCore::RenderMenuList::createInnerBlock):
595         (RenderMenuList::addChild):
596         (RenderMenuList::setText):
597         * rendering/RenderMenuList.h:
598         * rendering/RenderMultiColumnFlow.cpp:
599         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
600         * rendering/RenderQuote.cpp:
601         (WebCore::RenderQuote::updateTextRenderer):
602         (WebCore::RenderQuote::updateRenderer):
603         * rendering/RenderQuote.h:
604         * rendering/RenderRuby.cpp:
605         (WebCore::RenderRubyAsInline::addChild):
606         (WebCore::RenderRubyAsBlock::addChild):
607         * rendering/RenderRuby.h:
608         * rendering/RenderRubyBase.h:
609         * rendering/RenderRubyRun.cpp:
610         (WebCore::RenderRubyRun::rubyBaseSafe):
611         (WebCore::RenderRubyRun::addChild): Deleted.
612         * rendering/RenderRubyRun.h:
613         * rendering/RenderTable.cpp:
614         (WebCore::RenderTable::addChild):
615         * rendering/RenderTable.h:
616         * rendering/RenderTableRow.cpp:
617         (WebCore::RenderTableRow::addChild):
618         * rendering/RenderTableRow.h:
619         * rendering/RenderTableSection.cpp:
620         (WebCore::RenderTableSection::addChild):
621         * rendering/RenderTableSection.h:
622         * rendering/RenderTreeBuilder.cpp: Added.
623         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
624         (WebCore::RenderTreeBuilder::~RenderTreeBuilder):
625         (WebCore::RenderTreeBuilder::insertChild):
626         (WebCore::RenderTreeBuilder::rubyRunInsertChild):
627         * rendering/RenderTreeBuilder.h: Added.
628         (WebCore::RenderTreeBuilder::current):
629         * rendering/TextAutoSizing.cpp:
630         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
631         * rendering/mathml/RenderMathMLFenced.cpp:
632         (WebCore::RenderMathMLFenced::updateFromElement):
633         (WebCore::RenderMathMLFenced::makeFences):
634         (WebCore::RenderMathMLFenced::addChild):
635         * rendering/mathml/RenderMathMLFenced.h:
636         * rendering/svg/RenderSVGContainer.cpp:
637         (WebCore::RenderSVGContainer::addChild):
638         * rendering/svg/RenderSVGContainer.h:
639         * rendering/svg/RenderSVGInline.cpp:
640         (WebCore::RenderSVGInline::addChild):
641         * rendering/svg/RenderSVGInline.h:
642         * rendering/svg/RenderSVGRoot.cpp:
643         (WebCore::RenderSVGRoot::addChild):
644         * rendering/svg/RenderSVGRoot.h:
645         * rendering/svg/RenderSVGText.cpp:
646         (WebCore::RenderSVGText::addChild):
647         * rendering/svg/RenderSVGText.h:
648         * style/RenderTreePosition.cpp:
649         (WebCore::RenderTreePosition::insert): Deleted.
650         * style/RenderTreePosition.h:
651         (WebCore::RenderTreePosition::RenderTreePosition):
652         (WebCore::RenderTreePosition::nextSibling const):
653         (WebCore::RenderTreePosition::canInsert const): Deleted.
654         * style/RenderTreeUpdater.cpp:
655         (WebCore::RenderTreeUpdater::updateAfterDescendants):
656         (WebCore::RenderTreeUpdater::createRenderer):
657         (WebCore::RenderTreeUpdater::createTextRenderer):
658         (WebCore::RenderTreeUpdater::updateTextRenderer):
659         (WebCore::createTextRenderer): Deleted.
660         * style/RenderTreeUpdater.h:
661         * style/RenderTreeUpdaterFirstLetter.cpp:
662         (WebCore::updateFirstLetterStyle):
663         (WebCore::createFirstLetterRenderer):
664         * style/RenderTreeUpdaterGeneratedContent.cpp:
665         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
666         (WebCore::createContentRenderers):
667         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
668         * style/RenderTreeUpdaterListItem.cpp:
669         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
670         * style/RenderTreeUpdaterListItem.h:
671         * style/RenderTreeUpdaterMultiColumn.cpp:
672         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow):
673         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
674
675 2017-12-14  Youenn Fablet  <youenn@apple.com>
676
677         Implement <iframe allow="camera; microphone">
678         https://bugs.webkit.org/show_bug.cgi?id=167430
679
680         Reviewed by Eric Carlson.
681
682         Tests: imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-default-feature-policy.https.sub.html
683
684         Adding allow attribute to HTMLIFrameElement as per https://wicg.github.io/feature-policy/#iframe-allow-attribute.
685         Cross-origin iframes will get access to camera/microphone based on this attribute value.
686         Same-origin iframes do not need any attribute.
687         In case getUserMedia requests both camera and microphone, and allow attribute is only one of these,
688         getUserMedia access is denied. This goes against the tests but is not very clear from the specification.
689
690         * Modules/mediastream/UserMediaRequest.cpp:
691         (WebCore::isSecure):
692         (WebCore::isAllowedToUse):
693         (WebCore::canCallGetUserMedia):
694         (WebCore::UserMediaRequest::start):
695         * html/HTMLAttributeNames.in:
696         * html/HTMLIFrameElement.cpp:
697         (WebCore::HTMLIFrameElement::parseAttribute):
698         * html/HTMLIFrameElement.h:
699         * html/HTMLIFrameElement.idl:
700
701 2017-12-14  Zalan Bujtas  <zalan@apple.com>
702
703         Inconsistent section grid could lead to CrashOnOverflow
704         https://bugs.webkit.org/show_bug.cgi?id=180850
705         <rdar://problem/34064811>
706
707         Reviewed by Simon Fraser.
708
709         Each RenderTableSection maintains a grid of rows and columns. The number of columns in this grid equals the
710         maximum number of columns in the entire table (taking spans and multiple sections into account).
711         Since the maximum number of columns might change while re-computing the sections, we need to
712         adjust them accordingly at the end (otherwise it could lead to inconsistent grids where rows have different number of columns).
713
714         Test: fast/table/table-row-oveflow-crash.html
715
716         * rendering/RenderTable.cpp:
717         (WebCore::RenderTable::recalcSections const):
718         * rendering/RenderTableSection.cpp:
719         (WebCore::RenderTableSection::removeRedundantColumns):
720         * rendering/RenderTableSection.h:
721
722 2017-12-14  David Kilzer  <ddkilzer@apple.com>
723
724         Enable -Wstrict-prototypes for WebKit
725         <https://webkit.org/b/180757>
726         <rdar://problem/36024132>
727
728         Rubber-stamped by Joseph Pecoraro.
729
730         * Configurations/Base.xcconfig:
731         (CLANG_WARN_STRICT_PROTOTYPES): Add. Set to YES.
732
733 2017-12-14  Youenn Fablet  <youenn@apple.com>
734
735         srflx and relay ICE candidates lack raddr (rel-addr) and rport (rel-port) attributes if getUserMedia access has not been granted
736         https://bugs.webkit.org/show_bug.cgi?id=180842
737
738         Reviewed by Jon Lee.
739
740         Manually tested since there is no way to gather reflexive or stun candidates in WebKit CI.
741
742         * Modules/mediastream/PeerConnectionBackend.cpp:
743         (WebCore::filterICECandidate):
744
745 2017-12-14  Commit Queue  <commit-queue@webkit.org>
746
747         Unreviewed, rolling out r225878.
748         https://bugs.webkit.org/show_bug.cgi?id=180855
749
750         Introduced a crash in HTMLPictureElement. We're taking a
751         different approach for webkit.org/b/180769 (Requested by rniwa
752         on #webkit).
753
754         Reverted changeset:
755
756         "Crash inside ImageLoader::updateFromElement()"
757         https://bugs.webkit.org/show_bug.cgi?id=180769
758         https://trac.webkit.org/changeset/225878
759
760 2017-12-14  Ryan Haddad  <ryanhaddad@apple.com>
761
762         Unreviewed, rolling out r225931.
763
764         Breaks internal builds.
765
766         Reverted changeset:
767
768         "Fix Mac CMake build"
769         https://bugs.webkit.org/show_bug.cgi?id=180835
770         https://trac.webkit.org/changeset/225931
771
772 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
773
774         Another Windows build fix.
775
776         * platform/graphics/cg/GraphicsContextCG.cpp:
777         (WebCore::extendedSRGBColorSpaceRef):
778
779 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
780
781         Fix Windows build after r225915.
782
783         Windows doens't have dispatch_once with blocks. Switch to use lambda functions instead.
784
785         * platform/graphics/cg/GraphicsContextCG.cpp:
786         (WebCore::sRGBColorSpaceRef):
787         (WebCore::linearRGBColorSpaceRef):
788         (WebCore::extendedSRGBColorSpaceRef):
789         (WebCore::displayP3ColorSpaceRef):
790
791 2017-12-14  Devin Rousso  <webkit@devinrousso.com>
792
793         Web Inspector: replace HTMLCanvasElement with CanvasRenderingContext for instrumentation logic
794         https://bugs.webkit.org/show_bug.cgi?id=180770
795
796         Reviewed by Joseph Pecoraro.
797
798         No change in functionality.
799
800         * html/canvas/CanvasRenderingContext.h:
801         * html/canvas/CanvasRenderingContext.cpp:
802         (WebCore::CanvasRenderingContext::~CanvasRenderingContext):
803         Instead of waiting on the HTMLCanvasElement to destruct to call willDestroyCanvasRenderingContext
804         we can call out in the destructor and know that the CanvasRenderingContext will be destroyed
805         immediately thereafter.
806
807         * html/canvas/CanvasRenderingContext2D.h:
808         * html/canvas/CanvasRenderingContext2D.cpp:
809         (WebCore::CanvasRenderingContext2D::create):
810         * html/canvas/ImageBitmapRenderingContext.h:
811         * html/canvas/ImageBitmapRenderingContext.cpp:
812         (WebCore::ImageBitmapRenderingContext::create):
813         * html/canvas/WebGL2RenderingContext.h:
814         * html/canvas/WebGL2RenderingContext.cpp:
815         (WebCore::WebGL2RenderingContext::create):
816         * html/canvas/WebGLRenderingContext.h:
817         * html/canvas/WebGLRenderingContext.cpp:
818         (WebCore::WebGLRenderingContext::create):
819         * html/canvas/WebGLRenderingContextBase.cpp:
820         (WebCore::WebGLRenderingContextBase::create):
821         * html/canvas/WebGPURenderingContext.cpp:
822         (WebCore::WebGPURenderingContext::create):
823         * html/HTMLCanvasElement.cpp:
824         (WebCore::HTMLCanvasElement::createContext2d):
825         (WebCore::HTMLCanvasElement::createContextWebGL):
826         (WebCore::HTMLCanvasElement::createContextWebGPU):
827         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
828         (WebCore::HTMLCanvasElement::paint):
829         (WebCore::HTMLCanvasElement::setImageBuffer const):
830         Instead of adding didCreateCanvasRenderingContext calls at the construction sites of each
831         context, we can make the constructors private and force the usage of static `create` functions.
832         This way, we have access to the fully constructed object and have a guaranteed path for creation.
833
834         * inspector/InspectorCanvas.h:
835         * inspector/InspectorCanvas.cpp:
836         (WebCore::InspectorCanvas::create):
837         (WebCore::InspectorCanvas::InspectorCanvas):
838         (WebCore::InspectorCanvas::canvasElement):
839         (WebCore::InspectorCanvas::resetRecordingData):
840         (WebCore::InspectorCanvas::recordAction):
841         (WebCore::InspectorCanvas::buildObjectForCanvas):
842         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
843         (WebCore::InspectorCanvas::buildInitialState):
844         
845         * inspector/InspectorShaderProgram.h:
846         * inspector/InspectorShaderProgram.cpp:
847         (WebCore::InspectorShaderProgram::context const):
848
849         * inspector/agents/InspectorCanvasAgent.h:
850         * inspector/agents/InspectorCanvasAgent.cpp:
851         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
852         (WebCore::InspectorCanvasAgent::enable):
853         (WebCore::InspectorCanvasAgent::disable):
854         (WebCore::InspectorCanvasAgent::requestNode):
855         (WebCore::InspectorCanvasAgent::requestContent):
856         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
857         (WebCore::contextAsScriptValue):
858         (WebCore::InspectorCanvasAgent::resolveCanvasContext):
859         (WebCore::InspectorCanvasAgent::startRecording):
860         (WebCore::InspectorCanvasAgent::stopRecording):
861         (WebCore::InspectorCanvasAgent::updateShader):
862         (WebCore::InspectorCanvasAgent::frameNavigated):
863         (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
864         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
865         (WebCore::InspectorCanvasAgent::willDestroyCanvasRenderingContext):
866         (WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
867         (WebCore::InspectorCanvasAgent::recordCanvasAction):
868         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
869         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
870         (WebCore::InspectorCanvasAgent::didEnableExtension):
871         (WebCore::InspectorCanvasAgent::didCreateProgram):
872         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
873         (WebCore::InspectorCanvasAgent::canvasRecordingTimerFired):
874         (WebCore::InspectorCanvasAgent::clearCanvasData):
875         (WebCore::InspectorCanvasAgent::unbindCanvas):
876         (WebCore::InspectorCanvasAgent::findInspectorCanvas):
877         (WebCore::InspectorCanvasAgent::unbindProgram):
878         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas): Deleted.
879         (WebCore::InspectorCanvasAgent::canvasDestroyed): Deleted.
880
881         * inspector/InspectorInstrumentation.h:
882         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
883         (WebCore::InspectorInstrumentation::willDestroyCanvasRenderingContext):
884         (WebCore::InspectorInstrumentation::didChangeCanvasMemory):
885         (WebCore::InspectorInstrumentation::recordCanvasAction):
886         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame):
887         (WebCore::InspectorInstrumentation::didEnableExtension):
888         (WebCore::InspectorInstrumentation::didCreateProgram):
889         (WebCore::InspectorInstrumentation::willDeleteProgram):
890         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
891         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
892         (WebCore::InspectorInstrumentation::didCreateCSSCanvas): Deleted.
893         * inspector/InspectorInstrumentation.cpp:
894         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
895         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
896         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
897         (WebCore::InspectorInstrumentation::willDestroyCanvasRenderingContextImpl):
898         (WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl):
899         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrameImpl):
900         (WebCore::InspectorInstrumentation::didEnableExtensionImpl):
901         (WebCore::InspectorInstrumentation::didCreateProgramImpl):
902         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl): Deleted.
903
904         * page/PageConsoleClient.cpp:
905         (WebCore::PageConsoleClient::record):
906         (WebCore::PageConsoleClient::recordEnd):
907
908         * dom/Document.h:
909         * dom/Document.cpp:
910         (WebCore::Document::getCSSCanvasElement):
911         (WebCore::Document::nameForCSSCanvasElement const):
912         We have no reason to save the CSS canvas name for each InspectorCanvas object, so instead we
913         can just query for the name based on the CanvasRenderingContext's HTMLCanvasElement (assuming
914         it is not an OffscreenCanvas) when we need it.
915
916 2017-12-14  Chris Dumez  <cdumez@apple.com>
917
918         self.importScripts() should obey updateViaCache inside service workers
919         https://bugs.webkit.org/show_bug.cgi?id=180826
920
921         Reviewed by Youenn Fablet.
922
923         self.importScripts() should obey updateViaCache inside service workers, as per:
924         - https://html.spec.whatwg.org/multipage/workers.html#dom-workerglobalscope-importscripts
925
926         Tests: http/tests/workers/service/registration-updateViaCache-all-importScripts.html
927                http/tests/workers/service/registration-updateViaCache-imports-importScripts.html
928                http/tests/workers/service/registration-updateViaCache-none-importScripts.html
929
930         * workers/WorkerGlobalScope.cpp:
931         (WebCore::WorkerGlobalScope::importScripts):
932         * workers/WorkerScriptLoader.cpp:
933         (WebCore::WorkerScriptLoader::loadSynchronously):
934         * workers/WorkerScriptLoader.h:
935         * workers/service/SWClientConnection.cpp:
936         (WebCore::SWClientConnection::setRegistrationLastUpdateTime):
937         * workers/service/SWClientConnection.h:
938         * workers/service/ServiceWorkerRegistration.cpp:
939         (WebCore::ServiceWorkerRegistration::lastUpdateTime const):
940         (WebCore::ServiceWorkerRegistration::setLastUpdateTime):
941         * workers/service/ServiceWorkerRegistration.h:
942         * workers/service/server/SWServer.h:
943         * workers/service/server/SWServerRegistration.cpp:
944         (WebCore::SWServerRegistration::setLastUpdateTime):
945         * workers/service/server/SWServerRegistration.h:
946
947 2017-12-14  Yusuke Suzuki  <utatane.tea@gmail.com>
948
949         Drop Thread::tryCreate
950         https://bugs.webkit.org/show_bug.cgi?id=180808
951
952         Reviewed by Darin Adler.
953
954         This change reveals that nobody cares the WorkerThread::start's failure.
955         We should use `Thread::create` to ensure thread is actually starting.
956
957         * workers/WorkerThread.cpp:
958         (WebCore::WorkerThread::start):
959         * workers/WorkerThread.h:
960
961 2017-12-14  Alicia Boya García  <aboya@igalia.com>
962
963         [MSE] Add isValid() check before using trackBuffer.lastEnqueuedPresentationTime
964         https://bugs.webkit.org/show_bug.cgi?id=180258
965
966         Reviewed by Jer Noble.
967
968         * Modules/mediasource/SourceBuffer.cpp:
969         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
970
971 2017-12-14  John Wilander  <wilander@apple.com>
972
973         Storage Access API: Implement frame-specific access in the document.cookie layer
974         https://bugs.webkit.org/show_bug.cgi?id=180682
975         <rdar://problem/35982257>
976
977         Reviewed by Alex Christensen.
978
979         No new tests. Changed expected result from existing test.
980
981         CookiesStrategy::cookiesForDOM(), CookiesStrategy::setCookiesFromDOM(),
982         CookiesStrategy::cookieRequestHeaderFieldValue(), and
983         CookiesStrategy::getRawCookies() now take optional parameters for
984         frameID and pageID to allow frame-specific scoping of cookies.
985
986         This change makes the return values of FrameLoaderClient::frameID()
987         and FrameLoaderClient::pageID() std::optional<uint64_t> so that
988         WebCore can call those getters and get the right return values in
989         WebKit and std:nullopt in WebKitLegacy.
990
991         * dom/Document.cpp:
992         (WebCore::Document::requestStorageAccess):
993         * loader/CookieJar.cpp:
994         (WebCore::cookies):
995         (WebCore::setCookies):
996         (WebCore::cookieRequestHeaderFieldValue):
997         (WebCore::getRawCookies):
998         * loader/EmptyFrameLoaderClient.h:
999         * loader/FrameLoaderClient.h:
1000         * platform/CookiesStrategy.h:
1001         * platform/network/CacheValidation.cpp:
1002         (WebCore::headerValueForVary):
1003         * platform/network/PlatformCookieJar.h:
1004         * platform/network/cf/CookieJarCFNet.cpp:
1005         (WebCore::setCookiesFromDOM):
1006         (WebCore::cookiesForDOM):
1007         (WebCore::cookieRequestHeaderFieldValue):
1008         (WebCore::getRawCookies):
1009         * platform/network/curl/CookieJarCurl.cpp:
1010         (WebCore::CookieJarCurlFileSystem::setCookiesFromDOM):
1011         (WebCore::CookieJarCurlFileSystem::cookiesForDOM):
1012         (WebCore::CookieJarCurlFileSystem::cookieRequestHeaderFieldValue):
1013         (WebCore::CookieJarCurlFileSystem::getRawCookies):
1014         (WebCore::cookiesForDOM):
1015         (WebCore::setCookiesFromDOM):
1016         (WebCore::cookieRequestHeaderFieldValue):
1017         (WebCore::getRawCookies):
1018         * platform/network/curl/CookieJarCurl.h:
1019         * platform/network/mac/CookieJarMac.mm:
1020         (WebCore::cookiesInPartitionForURL):
1021         (WebCore::cookiesForURL):
1022         (WebCore::cookiesForSession):
1023         (WebCore::cookiesForDOM):
1024         (WebCore::cookieRequestHeaderFieldValue):
1025         (WebCore::setCookiesFromDOM):
1026         (WebCore::getRawCookies):
1027         * platform/network/soup/CookieJarSoup.cpp:
1028         (WebCore::setCookiesFromDOM):
1029         (WebCore::cookiesForDOM):
1030         (WebCore::cookieRequestHeaderFieldValue):
1031         (WebCore::getRawCookies):
1032
1033 2017-12-14  Alex Christensen  <achristensen@webkit.org>
1034
1035         Fix Mac CMake build
1036         https://bugs.webkit.org/show_bug.cgi?id=180835
1037
1038         Reviewed by Andy Estes.
1039
1040         * PlatformMac.cmake:
1041         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
1042
1043 2017-12-14  Antoine Quint  <graouts@apple.com>
1044
1045         [Web Animations] Use is<> when possible
1046         https://bugs.webkit.org/show_bug.cgi?id=180832
1047
1048         Reviewed by Dean Jackson.
1049
1050         Adopt is<> when possible.
1051
1052         * animation/WebAnimation.cpp:
1053         (WebCore::WebAnimation::setEffect):
1054         (WebCore::WebAnimation::setTimeline):
1055         (WebCore::WebAnimation::startOrStopAccelerated):
1056
1057 2017-12-14  Antoine Quint  <graouts@apple.com>
1058
1059         [Web Animations] Bring timeline and currentTime setters closer to compliance
1060         https://bugs.webkit.org/show_bug.cgi?id=180834
1061
1062         Reviewed by Dean Jackson.
1063
1064         Now that we've added support for the concept of a hold time, pending tasks
1065         and updating the finished state, adopt those in places we had already implemented
1066         but weren't fully compliant.
1067
1068         Web Platform Tests cover these behaviors, but we're currently failing those tests
1069         due to lacking an implementation for Element.animate().
1070
1071         * animation/WebAnimation.cpp:
1072         (WebCore::WebAnimation::setTimeline): Add some spec comments to clarify the code behavior
1073         and implement step 4 of the "setting the timeline" procedure where we reset the hold time
1074         to an unresolved value if the start time is resolved, as well as step 5 where we update the
1075         finished state. Finally, we also ensure we update the pending tasks as the ready state is
1076         dependent on a timeline being set.
1077         (WebCore::WebAnimation::bindingsStartTime const): Invert the way we test for an unresolved
1078         value to match prior review comments by Dean Jackson.
1079         (WebCore::WebAnimation::setBindingsStartTime): Use a boolean check rather than checking
1080         equality with std::nullopt.
1081         (WebCore::WebAnimation::setBindingsCurrentTime): Do not raise an exception when setting
1082         an unresolved time.
1083
1084 2017-12-14  Antoine Quint  <graouts@apple.com>
1085
1086         [Web Animations] Implement the cancel() method on Animation
1087         https://bugs.webkit.org/show_bug.cgi?id=180830
1088         <rdar://problem/36055816>
1089
1090         Reviewed by Dean Jackson.
1091
1092         We implement the cancel() method on the Animation interface with full spec text defining
1093         the normative behavior of those methods and code matching those steps. Implementing the
1094         cancel() method required implementing the notion of "resetting pending tasks",
1095         which the Web Animations spec defines as well.
1096
1097         * animation/WebAnimation.cpp:
1098         (WebCore::WebAnimation::setEffect):
1099         (WebCore::WebAnimation::cancel):
1100         (WebCore::WebAnimation::resetPendingTasks):
1101         * animation/WebAnimation.h:
1102         * animation/WebAnimation.idl:
1103
1104 2017-12-14  Jer Noble  <jer.noble@apple.com>
1105
1106         "Click to exit fullscreen" text not legible on High Sierra
1107         https://bugs.webkit.org/show_bug.cgi?id=180825
1108         <rdar://problem/32839983>
1109
1110         Reviewed by Eric Carlson.
1111
1112         Explicitly set the NSVisualAffectView's .appearance property.
1113
1114         * platform/mac/WebCoreFullScreenPlaceholderView.mm:
1115         (-[WebCoreFullScreenPlaceholderView initWithFrame:]):
1116
1117 2017-12-14  Antoine Quint  <graouts@apple.com>
1118
1119         [Web Animations] Implement the finish() method on Animation
1120         https://bugs.webkit.org/show_bug.cgi?id=180822
1121         <rdar://problem/36053282>
1122
1123         Reviewed by Dean Jackson.
1124
1125         We implement the finish() method on the Animation interface with full spec text defining
1126         the normative behavior of those methods and code matching those steps. Implementing the
1127         finish() method required implementing the notion of "silently setting the current time",
1128         which the Web Animations spec defines as well.
1129
1130         * animation/WebAnimation.cpp:
1131         (WebCore::WebAnimation::silentlySetCurrentTime):
1132         (WebCore::WebAnimation::setCurrentTime):
1133         (WebCore::WebAnimation::finish):
1134         * animation/WebAnimation.h:
1135         * animation/WebAnimation.idl:
1136
1137 2017-12-14  Chris Dumez  <cdumez@apple.com>
1138
1139         Service worker script fetching currently always uses the network cache
1140         https://bugs.webkit.org/show_bug.cgi?id=180816
1141
1142         Reviewed by Alex Christensen.
1143
1144         Service worker script fetching currently always uses the network cache. This is incorrect as per:
1145         - https://w3c.github.io/ServiceWorker/#update-algorithm (step 7.2)
1146
1147         Tests: http/tests/workers/service/registration-updateViaCache-all.html
1148                http/tests/workers/service/registration-updateViaCache-none.html
1149
1150         * workers/Worker.cpp:
1151         (WebCore::Worker::create):
1152         * workers/WorkerScriptLoader.cpp:
1153         (WebCore::WorkerScriptLoader::loadAsynchronously):
1154         * workers/WorkerScriptLoader.h:
1155         * workers/service/SWClientConnection.cpp:
1156         (WebCore::SWClientConnection::startScriptFetchForServer):
1157         * workers/service/SWClientConnection.h:
1158         * workers/service/ServiceWorkerContainer.cpp:
1159         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
1160         * workers/service/ServiceWorkerContainer.h:
1161         * workers/service/ServiceWorkerJob.cpp:
1162         (WebCore::ServiceWorkerJob::startScriptFetch):
1163         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
1164         * workers/service/ServiceWorkerJob.h:
1165         * workers/service/ServiceWorkerJobClient.h:
1166         * workers/service/server/SWServer.cpp:
1167         (WebCore::SWServer::startScriptFetch):
1168         * workers/service/server/SWServer.h:
1169         * workers/service/server/SWServerJobQueue.cpp:
1170         (WebCore::SWServerJobQueue::runUpdateJob):
1171         * workers/service/server/SWServerRegistration.h:
1172         (WebCore::SWServerRegistration::lastUpdateTime const):
1173
1174 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
1175
1176         Remove ColorSpaceDeviceRGB and most users of the obsolete deviceRGB colorspace
1177         https://bugs.webkit.org/show_bug.cgi?id=180689
1178
1179         Reviewed by Darin Adler.
1180         
1181         Address issues noted by Darin in r225797:
1182         
1183         Existing and new code mistakenly allocated colorspaces on every call, because
1184         they didn't initialize the static variable on the first call. Avoid this mistake
1185         by using dispatch_once() in these functions.
1186
1187         Fix a case where the extendedSRGBColorSpaceRef() fallback was returning deviceRGB
1188         instead of sRGB.
1189
1190         * platform/graphics/cg/GraphicsContextCG.cpp:
1191         (WebCore::sRGBColorSpaceRef):
1192         (WebCore::linearRGBColorSpaceRef):
1193         (WebCore::extendedSRGBColorSpaceRef):
1194         (WebCore::displayP3ColorSpaceRef):
1195         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1196         (WebCore::linearRGBColorSpaceRef):
1197
1198 2017-12-13  Keith Miller  <keith_miller@apple.com>
1199
1200         JSObjects should have a mask for loading indexed properties
1201         https://bugs.webkit.org/show_bug.cgi?id=180768
1202
1203         Reviewed by Mark Lam.
1204
1205         * bindings/js/JSDOMConvertSequences.h:
1206         (WebCore::Detail::NumericSequenceConverter::convertArray):
1207         (WebCore::Detail::SequenceConverter::convertArray):
1208
1209 2017-12-13  Antoine Quint  <graouts@apple.com>
1210
1211         [Web Animations] Implement the play() and pause() methods on Animation
1212         https://bugs.webkit.org/show_bug.cgi?id=178932
1213         <rdar://problem/35271069>
1214
1215         Reviewed by Eric Carlson.
1216
1217         We implement the play() and pause() methods of the Animation interface with full spec text defining
1218         the normative behavior of those methods and code matching those steps. Playing and pausing animations
1219         incur running a play or pause task when conditions are met, specifically here when the timeline is ready.
1220         So we add the notion of pending tasks and provide a proper implementation of pending() which we had
1221         introduced in an earlier patch with a constant false return value.
1222
1223         Note that the play() method exposes an auto-rewinding flag which we always set to true, but other specs,
1224         namely CSS Animations, do not require the rewinding behavior, so we expose it for future use.
1225
1226         * animation/WebAnimation.cpp:
1227         (WebCore::WebAnimation::play):
1228         (WebCore::WebAnimation::setTimeToRunPendingPlayTask):
1229         (WebCore::WebAnimation::runPendingPlayTask):
1230         (WebCore::WebAnimation::pause):
1231         (WebCore::WebAnimation::setTimeToRunPendingPauseTask):
1232         (WebCore::WebAnimation::runPendingPauseTask):
1233         (WebCore::WebAnimation::updatePendingTasks):
1234         * animation/WebAnimation.h:
1235         * animation/WebAnimation.idl:
1236
1237 2017-12-14  Frederic Wang  <fwang@igalia.com>
1238
1239         Make GraphicsLayer::dumpProperties dump m_offsetFromRenderer
1240         https://bugs.webkit.org/show_bug.cgi?id=180473
1241
1242         Reviewed by Antonio Gomes.
1243
1244         No new tests, this is just a new debug info.
1245
1246         * platform/graphics/GraphicsLayer.cpp:
1247         (WebCore::GraphicsLayer::dumpProperties const): Dump the offset from renderer if nonzero.
1248
1249 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1250
1251         REGRESSION(r225769): Build errors with constexpr std::tie on older gcc
1252         https://bugs.webkit.org/show_bug.cgi?id=180692
1253
1254         Reviewed by Carlos Garcia Campos.
1255
1256         * platform/graphics/FontSelectionAlgorithm.h:
1257         (WebCore::FontSelectionRange::operator== const):
1258         (WebCore::FontSelectionRequest::tied const):
1259         (WebCore::FontSelectionCapabilities::tied const):
1260         (WebCore::FontSelectionSpecifiedCapabilities:: const):
1261
1262 2017-12-13  Daniel Bates  <dabates@apple.com>
1263
1264         Fix the Windows build after <https://trac.webkit.org/changeset/225879>
1265         (https://bugs.webkit.org/show_bug.cgi?id=180651)
1266
1267         * html/TextFieldInputType.cpp:
1268         (WebCore::autoFillButtonTypeToAccessibilityLabel):
1269         (WebCore::autoFillButtonTypeToAutoFillButtonText):
1270         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
1271
1272 2017-12-13  Devin Rousso  <webkit@devinrousso.com>
1273
1274         Web Inspector: add instrumentation for ImageBitmapRenderingContext
1275         https://bugs.webkit.org/show_bug.cgi?id=180736
1276
1277         Reviewed by Joseph Pecoraro.
1278
1279         Tests: inspector/canvas/create-context-bitmaprenderer.html
1280                inspector/canvas/requestContent-bitmaprenderer.html
1281                inspector/canvas/resolveCanvasContext-bitmaprenderer.html
1282
1283         * CMakeLists.txt:
1284         * Sources.txt:
1285         * WebCore.xcodeproj/project.pbxproj:
1286
1287         * html/HTMLCanvasElement.cpp:
1288         (WebCore::HTMLCanvasElement::getContext):
1289         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
1290         Support passing an optional settings dictionary when creating an ImageBitmapRenderingContext.
1291
1292         * inspector/agents/InspectorCanvasAgent.cpp:
1293         (WebCore::InspectorCanvasAgent::requestContent):
1294         (WebCore::contextAsScriptValue):
1295
1296         * bindings/js/CallTracerTypes.h:
1297
1298         * inspector/InspectorCanvas.h:
1299         * inspector/InspectorCanvas.cpp:
1300         (WebCore::InspectorCanvas::buildObjectForCanvas):
1301         (WebCore::InspectorCanvas::indexForData):
1302         (WebCore::InspectorCanvas::buildAction):
1303         (WebCore::InspectorCanvas::buildArrayForImageBitmap): Deleted.
1304
1305 2017-12-13  Daniel Bates  <dabates@apple.com>
1306
1307         Add more auto fill button types
1308         https://bugs.webkit.org/show_bug.cgi?id=180651
1309         <rdar://problem/35891125>
1310         And
1311         <rdar://problem/35977943>
1312
1313         Reviewed by Brent Fulgham.
1314
1315         Tests: fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button.html
1316                fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button.html
1317                fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
1318                fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
1319                fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button.html
1320                fast/forms/auto-fill-button/input-strong-password-auto-fill-button.html
1321
1322         * English.lproj/Localizable.strings:
1323         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1324         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): Add strings for new auto fill button types.
1325
1326         * css/CSSSelector.cpp:
1327         (WebCore::CSSSelector::selectorText const):
1328         * css/CSSSelector.h:
1329         * css/SelectorChecker.cpp:
1330         (WebCore::SelectorChecker::checkOne const):
1331         * css/SelectorCheckerTestFunctions.h:
1332         (WebCore::isAutofilledStrongPassword):
1333         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
1334         * css/html.css:
1335         (input::-webkit-strong-password-auto-fill-button):
1336         (input:-webkit-autofill-strong-password):
1337         (input:-webkit-autofill, input:-webkit-autofill-strong-password):
1338         (input:-webkit-autofill): Deleted.
1339         * cssjit/SelectorCompiler.cpp:
1340         (WebCore::SelectorCompiler::addPseudoClassType):
1341         Add new CSS pseudo class and CSS styles.
1342
1343         * html/HTMLInputElement.cpp:
1344         (WebCore::HTMLInputElement::reset): Hide the auto fill button when the form is reset. This is also called
1345         whenever we suspend the page to put it into the page cache.
1346         (WebCore::HTMLInputElement::setShowAutoFillButton): Modified to update the editability of the inner text element
1347         and invalidate styles for the subtree as the editability may have changed depending on the auto fill button type.
1348
1349         (WebCore::autoFillStrongPasswordMaskImage):
1350         (WebCore::HTMLInputElement::createInnerTextStyle):
1351         (WebCore::HTMLInputElement::createInnerTextStyle const): Deleted.
1352         Adjust the look of the inner text field. This function is not const because we may need to resolve style to
1353         generate a mask image.
1354
1355         * html/HTMLInputElement.h:
1356         (WebCore::HTMLInputElement::autoFillButtonType const): Fix style nit; use a C++ style cast while I am in
1357         this area.
1358         (WebCore::HTMLInputElement::hasAutoFillStrongPasswordButton const): Added.
1359
1360         * html/HTMLTextAreaElement.cpp:
1361         (WebCore::HTMLTextAreaElement::createInnerTextStyle):
1362         (WebCore::HTMLTextAreaElement::createInnerTextStyle const): Deleted.
1363         Made this non-const because HTMLInputElement::createInnerTextStyle() needs to be non-const. See above.
1364
1365         * html/HTMLTextAreaElement.h:
1366         * html/HTMLTextFormControlElement.cpp:
1367         (WebCore::HTMLTextFormControlElement::isInnerTextElementEditable const):
1368         (WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability):
1369         Extract out the query to determine if the inner text element is editable into a virtual function isInnerTextElementEditable()
1370         and have updateInnerTextElementEditability() make use of it. By default a field is considered editable if it is not disabled
1371         or read-only. We override updateInnerTextElementEditability() in HTMLInputElement to also consider the auto fill button type.
1372
1373         * html/HTMLTextFormControlElement.h:
1374         * html/TextFieldInputType.cpp:
1375         (WebCore::autoFillButtonTypeToAccessibilityLabel):
1376         (WebCore::autoFillButtonTypeToAutoFillButtonText):
1377         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
1378         (WebCore::isAutoFillButtonTypeChanged):
1379         (WebCore::TextFieldInputType::createAutoFillButton):
1380         (WebCore::TextFieldInputType::updateAutoFillButton):
1381         Support having text for the auto fill button.
1382
1383         * platform/LocalizedStrings.cpp:
1384         (WebCore::AXAutoFillStrongPasswordLabel):
1385         (WebCore::AXAutoFillStrongConfirmationPasswordLabel):
1386         (WebCore::autoFillStrongPasswordLabel):
1387         * platform/LocalizedStrings.h:
1388         Add localized strings.
1389
1390         * rendering/RenderTextControlSingleLine.h: Disallow scrolling depending on the auto fill button type.
1391
1392         * testing/Internals.cpp:
1393         (WebCore::toAutoFillButtonType):
1394         * testing/Internals.h:
1395         * testing/Internals.idl:
1396         Add support for testing.
1397
1398 2017-12-13  Ryosuke Niwa  <rniwa@webkit.org>
1399
1400         Crash inside ImageLoader::updateFromElement()
1401         https://bugs.webkit.org/show_bug.cgi?id=180769
1402         <rdar://problem/35278782>
1403
1404         Reviewed by Antti Koivisto.
1405
1406         Fixed the crash by moving all call sites of ImageLoader::updateFromElement() to be post insertion callbacks
1407         where it's safe to execute arbitrary scripts.
1408
1409         No new test since existing tests cover this with a newly added release assert in ImageLoader.
1410
1411         * html/HTMLImageElement.cpp:
1412         (WebCore::HTMLImageElement::insertedIntoAncestor):
1413         (WebCore::HTMLImageElement::didFinishInsertingNode): Extracted from insertedIntoAncestor to call
1414         selectImageSource or updateFromElement.
1415         * html/HTMLImageElement.h: Made many member functions final.
1416         * html/HTMLInputElement.cpp:
1417         (WebCore::HTMLInputElement::didAttachRenderers): Delay the call to ImageLoader::updateFromElement() in
1418         ImageInputType using a post style resolution callback.
1419         * html/HTMLMetaElement.h:
1420         * html/HTMLPictureElement.cpp:
1421         (WebCore::HTMLPictureElement::sourcesChanged): Store the list of child image elements into a vector before
1422         calling selectImageSource since each call may execute arbitrary scripts.
1423         * html/HTMLSourceElement.cpp:
1424         (WebCore::HTMLSourceElement::insertedIntoAncestor): Delay the call to ImageLoader::updateFromElement()
1425         using a post style resolution callback.
1426         (WebCore::HTMLSourceElement::didFinishInsertingNode): Extracted from insertedIntoAncestor.
1427         * html/HTMLSourceElement.h:
1428         * html/HTMLVideoElement.cpp:
1429         (WebCore::HTMLVideoElement::didAttachRenderers):
1430         (WebCore::HTMLVideoElement::updateAfterStyleResolution): Extracted from didAttachRenderers.
1431         * html/HTMLVideoElement.h:
1432         * html/ImageInputType.cpp:
1433         (WebCore::ImageInputType::needsPostStyleResolutionCallback): Added. Returns true so that HTMLInputElement's
1434         didAttachRenderers would register a post style resolution callback.
1435         (WebCore::ImageInputType::updateAfterStyleResolution): Extracted from attach.
1436         (WebCore::ImageInputType::attach): Deleted.
1437         * html/ImageInputType.h:
1438         * html/InputType.cpp:
1439         (WebCore::InputType::needsPostStyleResolutionCallback): Added. All but ImageInputType returns false.
1440         (WebCore::InputType::updateAfterStyleResolution): Added.
1441         (WebCore::InputType::attach): Deleted.
1442         * html/InputType.h:
1443         * loader/ImageLoader.cpp:
1444         (WebCore::ImageLoader::updateFromElement): Added a release assertion. There is no direct security implication
1445         so there is no need to use RELEASE_ASSERT_WITH_SECURITY_IMPLICATION here.
1446         * svg/SVGImageElement.cpp:
1447         (WebCore::SVGImageElement::insertedIntoAncestor):
1448         (WebCore::SVGImageElement::didFinishInsertingNode):
1449         * svg/SVGImageElement.h:
1450
1451 2017-12-13  Zalan Bujtas  <zalan@apple.com>
1452
1453         RenderImage can be destroyed even before setting the style on it.
1454         https://bugs.webkit.org/show_bug.cgi?id=180767
1455         <rdar://problem/33965995>
1456
1457         Reviewed by Simon Fraser.
1458
1459         In certain cases, when the newly constructed renderer can't be inserted into the tree (parent can only have specific type of children etc),
1460         RenderTreeUpdater destroys it right away. While destroying a RenderImage, the associated image resource assumes
1461         that the image renderer has been initialized through RenderElement::initializeStyle(). This is an incorrect
1462         assumption.
1463         This patch also makes RenderImageResource's m_renderer a weak pointer.
1464            
1465         Test: fast/images/crash-when-image-renderer-is-destroyed-before-calling-initializeStyle.html
1466
1467         * rendering/RenderImageResource.cpp:
1468         (WebCore::RenderImageResource::initialize):
1469         (WebCore::RenderImageResource::setCachedImage):
1470         (WebCore::RenderImageResource::resetAnimation):
1471         (WebCore::RenderImageResource::image const):
1472         (WebCore::RenderImageResource::setContainerContext):
1473         (WebCore::RenderImageResource::imageSize const):
1474         * rendering/RenderImageResource.h:
1475         (WebCore::RenderImageResource::renderer const):
1476         * rendering/RenderImageResourceStyleImage.cpp:
1477         (WebCore::RenderImageResourceStyleImage::shutdown):
1478
1479 2017-12-13  Ryosuke Niwa  <rniwa@webkit.org>
1480
1481         Update the SVG use element's shadow trees explicitly before the style recall
1482         https://bugs.webkit.org/show_bug.cgi?id=180729
1483         <rdar://problem/36009806>
1484
1485         Reviewed by Antti Koivisto.
1486
1487         Update the SVG use element's shadow trees before start resolving styles. Document now has a hash set of all
1488         connected SVG use elements with invalidated shadow trees. SVGUseElement adds itself to this set when its
1489         shadow tree gets invalidated, or it gets newly connected to a document with the invalidated shadow tree.
1490         SVGUseElement removes itself from this set when it updates its shadow tree or it gets disconnected from
1491         a document with the invalidated shadow tree.
1492
1493         No new tests. Covered by existing tests.
1494
1495         * dom/Document.cpp:
1496         (WebCore::Document::~Document): Assert that m_svgUseElements has been cleared.
1497         (WebCore::Document::resolveStyle): Update the shadow trees of SVG use elements with invalidated shadow trees.
1498         (WebCore::Document::addSVGUseElement): Added.
1499         (WebCore::Document::removeSVGUseElement): Added.
1500         * dom/Document.h:
1501         (WebCore::Document::svgUseElements const): Added.
1502         * dom/Element.cpp:
1503         (WebCore::Element::cloneElementWithChildren): Removed EventAllowedScope since the SVG use element's shadow
1504         tree is no longer updated when there is a NoEventDispatchAssertion in the stack.
1505         (WebCore::Element::cloneElementWithoutChildren): Ditto.
1506         * style/StyleTreeResolver.cpp:
1507         (WebCore::Style::TreeResolver::resolveComposedTree): No longer drops the assertion now that SVG use element's
1508         shadow tree is updated before calling this function.
1509         * svg/SVGUseElement.cpp:
1510         (WebCore::SVGUseElement::insertedIntoAncestor): Add the element to the document's hash set if this use element's
1511         shadow tree needs to be updated (m_shadowTreeNeedsUpdate is set), and it got newly connected.
1512         (WebCore::SVGUseElement::removedFromAncestor): Ditto for removal. We have to check m_shadowTreeNeedsUpdate before
1513         calling SVGGraphicsElement::removedFromAncestor or updateExternalDocument since either function can invoke
1514         m_shadowTreeNeedsUpdate to true.
1515         (WebCore::SVGUseElement::willRecalcStyle): Deleted. We no longer call updateShadowTree during style recalc.
1516         (WebCore::SVGUseElement::updateShadowTree): Remove this element from the document's hah set. We can't clear all
1517         the entries in the map at once in Document::resolveStyle because updating the shadow trees of a SVG use element
1518         can result in a sync IPC in ImageLoader::updateFromElement, which end up executing arbitrary author scripts.
1519         (WebCore::SVGUseElement::cloneTarget const): Removed EventAllowedScope since the SVG use element's shadow tree
1520         is no longer updated when there is a NoEventDispatchAssertion in the stack.
1521         (WebCore::SVGUseElement::expandUseElementsInShadowTree const): Ditto.
1522         (WebCore::SVGUseElement::expandSymbolElementsInShadowTree const): Ditto.
1523         (WebCore::SVGUseElement::invalidateShadowTree): Add the element to the document's hash set if it's connected.
1524         * svg/SVGUseElement.h:
1525
1526 2017-12-13  Per Arne Vollan  <pvollan@apple.com>
1527
1528         REGRESSION(225597): Can't select a text box or web view on a page when VO is on.
1529         https://bugs.webkit.org/show_bug.cgi?id=180756
1530         <rdar://problem/35996158>
1531
1532         Reviewed by Brent Fulgham.
1533
1534         No new tests.
1535
1536         * platform/mac/EventLoopMac.mm:
1537         (WebCore::EventLoop::cycle):
1538
1539 2017-12-13  Antoine Quint  <graouts@apple.com>
1540
1541         [Web Animations] Implement the "updating the finished state" procedure
1542         https://bugs.webkit.org/show_bug.cgi?id=180743
1543         <rdar://problem/36017232>
1544
1545         Reviewed by Simon Fraser.
1546
1547         The Web Animations spec defines a procedure for "updating the finished state", which should run as the timeline time
1548         changes and is responsible for ultimately triggering finish events and fulfil the "finished" promise. The procedure
1549         allows for two flags to control its behavior: didSeek and synchronouslyNotify. When synchronouslyNotify is true, the
1550         "finish notification steps" procedure is ran right away, otherwise it's queued as a microtask.
1551
1552         In this patch we introduce the notion of "hold time", which is the time held while an animation is paused. It will be
1553         set by the pause() and play() method in future patches.
1554
1555         * animation/DocumentTimeline.cpp:
1556         (WebCore::DocumentTimeline::updateAnimations): Update the finished state as the timeline time changes with both flags
1557         set to false.
1558         * animation/WebAnimation.cpp:
1559         (WebCore::WebAnimation::currentTime const): Add a private currentTime(bool) variant which allows for the hold time to
1560         be ignored in case updateFinishedState() was called with the didSeek flag set to false.
1561         (WebCore::WebAnimation::updateFinishedState): Implement the procedure as specified with all spec-mandated steps inline.
1562         (WebCore::WebAnimation::scheduleMicrotaskIfNeeded): Schedule a microtask to complete the "finish notification steps"
1563         if we haven't scheduled a microtask before.
1564         (WebCore::WebAnimation::performMicrotask): Perform the microtask if the "finish notification steps" procedure hasn't
1565         been canceled after it was originally scheduled, as tracked by the m_finishNotificationStepsMicrotaskPending flag, since
1566         microtasks are not presently cancelable.
1567         (WebCore::WebAnimation::finishNotificationSteps): Implement the procedure as specified with all spec-mandated steps inline,
1568         dispatching a "finish" events and fulfilling the "finished" promise.
1569         * animation/WebAnimation.h:
1570         * animation/WebAnimation.idl:
1571         * dom/EventNames.h:
1572
1573 2017-12-13  Simon Fraser  <simon.fraser@apple.com>
1574
1575         Fix crash under Document::visualUpdatesSuppressionTimerFired()
1576         https://bugs.webkit.org/show_bug.cgi?id=180758
1577         Document::visualUpdatesSuppressionTimerFired
1578
1579         Reviewed by Zalan Bujtas.
1580
1581         Speculative fix for crash under visualUpdatesSuppressionTimerFired() where view()
1582         can be null. Add null checks for the view() in all code called from this function.
1583
1584         * dom/Document.cpp:
1585         (WebCore::Document::setVisualUpdatesAllowed):
1586         (WebCore::Document::visualUpdatesSuppressionTimerFired):
1587
1588 2017-12-13  Zalan Bujtas  <zalan@apple.com>
1589
1590         ASSERT(LayoutDisallowedScope::isLayoutAllowed()) whenever hitting Enter in Web Inspector console
1591         https://bugs.webkit.org/show_bug.cgi?id=180690
1592
1593         Reviewed by Simon Fraser.
1594
1595         Defer text replacement notification until after layout is done to avoid unexpected forced layouts.
1596
1597         Covered by existing tests.
1598
1599         * accessibility/AXObjectCache.cpp:
1600         (WebCore::AXObjectCache::disableAccessibility):
1601         (WebCore::AXObjectCache::remove):
1602         (WebCore::filterMapForRemoval):
1603         (WebCore::filterListForRemoval):
1604         (WebCore::AXObjectCache::prepareForDocumentDestruction):
1605         (WebCore::AXObjectCache::performDeferredCacheUpdate):
1606         (WebCore::AXObjectCache::deferTextReplacementNotificationForTextControl):
1607         (WebCore::filterForRemoval): Deleted.
1608         * accessibility/AXObjectCache.h: Need to use the base (Element) class since
1609         we can't call is<HTMLTextFormControlElement> in Node d'tor.
1610         (WebCore::AXObjectCache::deferTextReplacementNotificationForTextControl):
1611         * html/HTMLTextFormControlElement.cpp:
1612         (WebCore::HTMLTextFormControlElement::setInnerTextValue):
1613
1614 2017-12-13  Ryan Haddad  <ryanhaddad@apple.com>
1615
1616         Unreviewed, rolling out r225836.
1617
1618         Broke the Windows build.
1619
1620         Reverted changeset:
1621
1622         "Unify some WebGL sources"
1623         https://bugs.webkit.org/show_bug.cgi?id=180726
1624         https://trac.webkit.org/changeset/225836
1625
1626 2017-12-13  Andy Estes  <aestes@apple.com>
1627
1628         [Payment Request] Remove ApplePayPaymentMethodUpdateEvent and use PaymentDetailsModifiers instead
1629         https://bugs.webkit.org/show_bug.cgi?id=180737
1630         <rdar://problem/36013152>
1631
1632         Reviewed by Brady Eidson.
1633
1634         Instead of firing a non-standard "applepaypaymentmethodupdate" event when the payment method
1635         changes, use the PaymentDetailsModifier mechanism to allow the merchant to specify override
1636         totals and additional display items per payment method type.
1637
1638         Test: http/tests/ssl/applepay/ApplePayPaymentDetailsModifier.https.html
1639
1640         * DerivedSources.make:
1641         * Modules/applepay/ApplePayLineItem.idl:
1642         * Modules/applepay/ApplePayPaymentMethod.h:
1643         * Modules/applepay/ApplePayPaymentMethod.idl:
1644         * Modules/applepay/ApplePayPaymentMethodType.h: Added.
1645         * Modules/applepay/ApplePayPaymentMethodType.idl: Added.
1646         * Modules/applepay/cocoa/PaymentMethodCocoa.mm:
1647         * Modules/applepay/paymentrequest/ApplePayModifier.h: Added.
1648         * Modules/applepay/paymentrequest/ApplePayModifier.idl: Added.
1649         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1650         (WebCore::ApplePayPaymentHandler::show):
1651         (WebCore::ApplePayPaymentHandler::computeTotalAndLineItems):
1652         (WebCore::ApplePayPaymentHandler::detailsUpdated):
1653         (WebCore::ApplePayPaymentHandler::shippingAddressUpdated):
1654         (WebCore::ApplePayPaymentHandler::shippingOptionUpdated):
1655         (WebCore::ApplePayPaymentHandler::paymentMethodUpdated):
1656         (WebCore::ApplePayPaymentHandler::didSelectPaymentMethod):
1657         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
1658         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.cpp: Removed.
1659         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.h: Removed.
1660         * Modules/paymentrequest/PaymentRequest.h:
1661         * Modules/paymentrequest/PaymentRequest.idl:
1662         * WebCore.xcodeproj/project.pbxproj:
1663         * dom/EventNames.h:
1664         * dom/EventNames.in:
1665         * testing/MockPaymentCoordinator.cpp:
1666         (WebCore::convert):
1667         (WebCore::MockPaymentCoordinator::updateTotalAndLineItems):
1668         (WebCore::MockPaymentCoordinator::completeShippingMethodSelection):
1669         (WebCore::MockPaymentCoordinator::completeShippingContactSelection):
1670         (WebCore::MockPaymentCoordinator::completePaymentMethodSelection):
1671         * testing/MockPaymentCoordinator.h:
1672         * testing/MockPaymentCoordinator.idl:
1673
1674 2017-12-12  Zalan Bujtas  <zalan@apple.com>
1675
1676         is<HTMLTextFormControlElement> reports the input type.
1677         https://bugs.webkit.org/show_bug.cgi?id=180721
1678         <rdar://problem/36005123>
1679
1680         Reviewed by Ryosuke Niwa.
1681
1682         This patch ensures that is<HTMLTextFormControlElement> consistently returns true even
1683         when the input type changes from text to non-text (checkbox etc).
1684
1685         * accessibility/AccessibilityObject.cpp:
1686         (WebCore::AccessibilityObject::selectText):
1687         * dom/Element.h:
1688         (WebCore::Element::isTextFormControlElement const):
1689         (WebCore::Element::isTextField const):
1690         (WebCore::Element::isTextFormControl const): Deleted.
1691         * editing/Editor.cpp:
1692         (WebCore::Editor::selectionForCommand):
1693         (WebCore::Editor::setBaseWritingDirection):
1694         (WebCore::findFirstMarkable):
1695         * editing/FrameSelection.cpp:
1696         (WebCore::FrameSelection::selectAll):
1697         * html/FormController.cpp:
1698         (WebCore::FormController::formElementsCharacterCount const):
1699         * html/HTMLElement.cpp:
1700         (WebCore::HTMLElement::directionality const):
1701         * html/HTMLInputElement.h:
1702         * html/HTMLTextAreaElement.h:
1703         * html/HTMLTextFormControlElement.cpp:
1704         (WebCore::HTMLTextFormControlElement::didEditInnerTextValue):
1705         (WebCore::HTMLTextFormControlElement::selectedText const):
1706         (WebCore::HTMLTextFormControlElement::setSelectionRange):
1707         (WebCore::HTMLTextFormControlElement::selectionStart const):
1708         (WebCore::HTMLTextFormControlElement::computeSelectionStart const):
1709         (WebCore::HTMLTextFormControlElement::selectionEnd const):
1710         (WebCore::HTMLTextFormControlElement::computeSelectionEnd const):
1711         (WebCore::HTMLTextFormControlElement::selectionDirection const):
1712         (WebCore::HTMLTextFormControlElement::computeSelectionDirection const):
1713         (WebCore::HTMLTextFormControlElement::selection const):
1714         (WebCore::HTMLTextFormControlElement::selectionChanged):
1715         (WebCore::HTMLTextFormControlElement::lastChangeWasUserEdit const):
1716         (WebCore::HTMLTextFormControlElement::setInnerTextValue):
1717         (WebCore::HTMLTextFormControlElement::valueWithHardLineBreaks const):
1718         (WebCore::enclosingTextFormControl):
1719         * html/HTMLTextFormControlElement.h:
1720         (isType):
1721         * rendering/HitTestResult.cpp:
1722         (WebCore::HitTestResult::isOverTextInsideFormControlElement const):
1723
1724 2017-12-12  Dean Jackson  <dino@apple.com>
1725
1726         Unify some WebGL sources
1727         https://bugs.webkit.org/show_bug.cgi?id=180726
1728
1729         Rubber-stamped by Keith, weeks ago.
1730
1731         * Sources.txt:
1732         * WebCore.xcodeproj/project.pbxproj:
1733         * html/canvas/WebGLRenderingContextBase.cpp:
1734
1735 2017-12-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1736
1737         Unreviewed, fix !ENABLE(MEDIA_STREAM) build after r225822
1738         https://bugs.webkit.org/show_bug.cgi?id=180666
1739         <rdar://problem/36008948>
1740
1741         * html/HTMLMediaElement.cpp:
1742
1743 2017-12-12  Alex Christensen  <achristensen@webkit.org>
1744
1745         Fix possible out-of-bounds read in protocolIsInHTTPFamily
1746         https://bugs.webkit.org/show_bug.cgi?id=180688
1747
1748         Reviewed by Daniel Bates.
1749
1750         It wouldn't read very far out of bounds, and it would just change a bool return value,
1751         but it's still out of bounds.  Covered by an API test that ASAN wouldn't like.
1752
1753         * platform/URL.cpp:
1754         (WebCore::protocolIsInHTTPFamily):
1755         Check bounds before reading a string.
1756
1757 2017-12-12  Youenn Fablet  <youenn@apple.com>
1758
1759         getUserMedia is resolving before the document knows it is capturing
1760         https://bugs.webkit.org/show_bug.cgi?id=180699
1761
1762         Reviewed by Eric Carlson.
1763
1764         Covered by updated test.
1765
1766         Ensure the document state is capturing when getUserMedia promise is resolved by doing the following:
1767         - Promise is resolved when MediaStream is producing data.
1768         - MediaStream asks Document to update its state when MediaStream state is updated.
1769
1770         Introduce PendingActivationMediaStream for waiting for the MediaStream to produce data.
1771
1772         * Modules/mediastream/MediaStream.cpp:
1773         (WebCore::MediaStream::statusDidChange):
1774         * Modules/mediastream/UserMediaRequest.cpp:
1775         (WebCore::UserMediaRequest::allow):
1776         (WebCore::UserMediaRequest::contextDestroyed):
1777         (WebCore::UserMediaRequest::PendingActivationMediaStream::PendingActivationMediaStream):
1778         (WebCore::UserMediaRequest::PendingActivationMediaStream::~PendingActivationMediaStream):
1779         (WebCore::UserMediaRequest::PendingActivationMediaStream::characteristicsChanged):
1780         (WebCore::UserMediaRequest::mediaStreamIsReady):
1781         * Modules/mediastream/UserMediaRequest.h:
1782         (WebCore::UserMediaRequest::PendingActivationMediaStream::create):
1783         * platform/mediastream/RealtimeMediaSourceCenter.h:
1784         * WebCore/WebCore.xcodeproj/project.pbxproj:
1785
1786 2017-12-12  John Wilander  <wilander@apple.com>
1787
1788         Storage Access API: Implement frame-specific access in the network storage session layer
1789         https://bugs.webkit.org/show_bug.cgi?id=180679
1790         <rdar://problem/35982116>
1791
1792         Reviewed by Alex Christensen.
1793
1794         Tests: http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame.html
1795                http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-but-try-access-from-wrong-frame.html
1796
1797         This changes adds frameID and pageID to what is communicated for
1798         storage access and also stored in the network process' table of
1799         partitioning exceptions.
1800
1801         * dom/Document.cpp:
1802         (WebCore::Document::hasStorageAccess):
1803             Now makes use of the new m_hasFrameSpecificStorageAccess to check
1804             if access has already been granted to this document's domain and
1805             frame.
1806         (WebCore::Document::requestStorageAccess):
1807             Now submits frameID and pageID in the request call and sets
1808             m_hasFrameSpecificStorageAccess upon granted access callback.
1809         * dom/Document.h:
1810         * page/ChromeClient.h:
1811         * platform/network/NetworkStorageSession.h:
1812         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1813         (WebCore::NetworkStorageSession::cookieStoragePartition const):
1814         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
1815         (WebCore::NetworkStorageSession::isStorageAccessGranted const):
1816         (WebCore::NetworkStorageSession::setStorageAccessGranted):
1817             Now makes use of frameID and pageID for partitioning exceptions.
1818         * platform/network/mac/CookieJarMac.mm:
1819         (WebCore::cookiesInPartitionForURL):
1820         (WebCore::setCookiesFromDOM):
1821             Submits std::nullopt for frameID and pageID.
1822             Follow-up work tracked in https://bugs.webkit.org/show_bug.cgi?id=180682. 
1823         * platform/network/mac/ResourceHandleMac.mm:
1824         (WebCore::ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded):
1825             Submits std::nullopt for frameID and pageID.
1826             Follow-up work tracked in https://bugs.webkit.org/show_bug.cgi?id=180682. 
1827
1828 2017-12-12  Youenn Fablet  <youenn@apple.com>
1829
1830         Playing webrtc video tracks should prevent from display to got to sleep
1831         https://bugs.webkit.org/show_bug.cgi?id=180666
1832
1833         Reviewed by Darin Adler.
1834
1835         Done through manual testing by checking screen assertions taken on webrtc sites.
1836
1837         * html/HTMLMediaElement.cpp:
1838         (WebCore::HTMLMediaElement::shouldDisableSleep const):
1839
1840 2017-12-12  Dean Jackson  <dino@apple.com>
1841
1842         Add CanvasRenderingContext2DBase class and OffscreenCanvasRenderingContext2D
1843         https://bugs.webkit.org/show_bug.cgi?id=180718
1844         <rdar://problem/36004015>
1845
1846         Reviewed by Sam Weinig.
1847
1848         Add an OffscreenCanvasRenderingContext2D class, and in the process create a shared
1849         base class for it and CanvasRenderingContext2D, called CanvasRenderingContext2DBase.
1850         The base class has nearly all the functionality, with the exception of the text
1851         and focus rendering APIs, which are only exposed on CanvasRenderingContext2D.
1852
1853         At the moment CanvasRenderingContext2DBase's implementation still expects the attached
1854         canvas to be an HTMLCanvasElement, but that's ok since you can't yet create an
1855         OffscreenCanvasRenderingContext2D. A subsequent patch will do the right thing.
1856
1857         No change in functionality at the moment, so covered by the existing tests.
1858
1859         * DerivedSources.make: Add the new IDL file.
1860
1861         * Sources.txt: Add all the new files to compile.
1862         * WebCore.xcodeproj/project.pbxproj:
1863
1864         * bindings/js/JSCanvasRenderingContext2DCustom.cpp: Removed some unnecessary headers, and
1865         added JSC:: where appropriate.
1866         (WebCore::JSCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots):
1867         (WebCore::JSCanvasRenderingContext2D::visitAdditionalChildren):
1868
1869         * bindings/js/JSOffscreenCanvasRenderingContext2DCustom.cpp: Copied from Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp.
1870         (WebCore::root): New root function that just returns the address of the OffscreenCanvas.
1871         (WebCore::JSOffscreenCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots):
1872         (WebCore::JSOffscreenCanvasRenderingContext2D::visitAdditionalChildren):
1873
1874         * bindings/js/JSWorkerNavigatorCustom.cpp: Add JSC:: to fix a compilation error.
1875         (WebCore::JSWorkerNavigator::visitAdditionalChildren):
1876
1877         * bindings/js/WebCoreBuiltinNames.h: New IDL types.
1878
1879         * html/OffscreenCanvas.idl: Explicitly generates an IsReachable.
1880
1881         * html/canvas/CanvasRenderingContext.h:
1882         (WebCore::CanvasRenderingContext::isOffscreen2d const): Helper for is<> trait.
1883
1884         * html/canvas/CanvasRenderingContext2D.cpp: Nearly everything has been moved to the Base class.
1885         * html/canvas/CanvasRenderingContext2D.h:
1886         * html/canvas/CanvasRenderingContext2DBase.cpp: Copied from Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp.
1887         * html/canvas/CanvasRenderingContext2DBase.h: Copied from Source/WebCore/html/canvas/CanvasRenderingContext2D.h.
1888
1889         * html/canvas/OffscreenCanvasRenderingContext2D.cpp: Added. Basic implementation that
1890         just uses the Base class.
1891         (WebCore::OffscreenCanvasRenderingContext2D::OffscreenCanvasRenderingContext2D):
1892         * html/canvas/OffscreenCanvasRenderingContext2D.h: Added.
1893         * html/canvas/OffscreenCanvasRenderingContext2D.idl: Added.
1894
1895 2017-12-12  Jer Noble  <jer.noble@apple.com>
1896
1897         [EME] Support FPS-over-HLS in the Modern EME API
1898         https://bugs.webkit.org/show_bug.cgi?id=180707
1899
1900         Reviewed by Eric Carlson.
1901
1902         Add support for the "skd" initDataType, where the initData is the URI provided in the 
1903         EXT-X-KEY tag in a HLS manifest:
1904
1905         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
1906         (WebCore::CDMPrivateFairPlayStreaming::sinfName):
1907         (WebCore::CDMPrivateFairPlayStreaming::skdName):
1908         (WebCore::extractSinfData):
1909         (WebCore::CDMPrivateFairPlayStreaming::sanitizeSkd):
1910         (WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsSkd):
1911         (WebCore::validInitDataTypes):
1912         (WebCore::CDMFactory::platformRegisterFactories):
1913         (WebCore::CDMPrivateFairPlayStreaming::supportsInitDataType const):
1914         (WebCore::CDMPrivateFairPlayStreaming::supportsConfiguration const):
1915         (WebCore::CDMPrivateFairPlayStreaming::supportsInitData const):
1916         (WebCore::sinfName): Deleted.
1917
1918         Add support for creating a AVContentKeyRequest from a skd key URI rather than from
1919         initialization data, and for extracting keyIDs from the AVContentKeyRequest identifier.
1920
1921         * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
1922         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
1923         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1924         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::keyIDs):
1925         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestLicense):
1926         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
1927         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
1928
1929         Add support for AVContentKeySession to MediaPlayerPrivateAVFoundationObjC, and for emitting
1930         initializationData messages when encountering a loading request for a "skd" URI.
1931
1932         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1933         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1934         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
1935         (WebCore::MediaPlayerPrivateAVFoundationObjC::cdmInstanceAttached):
1936         (WebCore::MediaPlayerPrivateAVFoundationObjC::cdmInstanceDetached):
1937         (WebCore::MediaPlayerPrivateAVFoundationObjC::attemptToDecryptWithInstance):
1938
1939 2017-12-12  Antoine Quint  <graouts@apple.com>
1940
1941         [Web Animations] Expose promises on Animation interface
1942         https://bugs.webkit.org/show_bug.cgi?id=180710
1943         <rdar://problem/36000604>
1944
1945         Reviewed by Dean Jackson.
1946
1947         Expose the "ready" and "finished" promises on Animation. A future patch will fulfil or reject them.
1948
1949         * animation/WebAnimation.cpp:
1950         (WebCore::WebAnimation::WebAnimation):
1951         (WebCore::WebAnimation::readyPromiseResolve):
1952         (WebCore::WebAnimation::finishedPromiseResolve):
1953         * animation/WebAnimation.h:
1954         * animation/WebAnimation.idl:
1955
1956 2017-12-12  Youenn Fablet  <youenn@apple.com>
1957
1958         Fetch Event header filtering should apply in CORS mode only
1959         https://bugs.webkit.org/show_bug.cgi?id=180708
1960
1961         Reviewed by Alex Christensen.
1962
1963         Covered by no-longer failing test.
1964
1965         * workers/service/context/ServiceWorkerFetch.cpp: cleaning headers only in case of CORS mode.
1966
1967 2017-12-12  Myles C. Maxfield  <mmaxfield@apple.com>
1968
1969         REGRESSION (Safari 11): custom <font-face> tag crashes a page
1970         https://bugs.webkit.org/show_bug.cgi?id=177848
1971
1972         Reviewed by Darin Adler.
1973
1974         We currently use the CSS property parsers to parse SVG's <font-face> element attributes. Instead,
1975         we should be using the CSS descriptor parsers to parse these attributes. However, this is a
1976         fairly involved task, so until I can finish that, this patch fixes the crash. The crash is simple;
1977         the descriptors shouldn't accept the universal keywords ("initial", "inherit", etc.) and our
1978         font-face machinery assumes this. So the fix is just detect these keywords and explicitly disallow
1979         them.
1980
1981         Test: svg/text/font-style-keyword.html
1982
1983         * svg/SVGFontFaceElement.cpp:
1984         (WebCore::SVGFontFaceElement::parseAttribute):
1985
1986 2017-12-12  Antoine Quint  <graouts@apple.com>
1987
1988         [Web Animations] Implement the playState property on Animation
1989         https://bugs.webkit.org/show_bug.cgi?id=180711
1990         <rdar://problem/36000982>
1991
1992         Reviewed by Dean Jackson.
1993
1994         Expose the playState and pending properties. The playState property has a complete implementation but
1995         has some test failures due to Animation lacking correct behavior while running animations which will
1996         be fixed in a followup patch. The pending property is a placeholder until we implement pending play
1997         and pause tasks in followup patches.
1998
1999         * animation/WebAnimation.cpp:
2000         (WebCore::WebAnimation::playState const):
2001         (WebCore::WebAnimation::effectEndTime const):
2002         * animation/WebAnimation.h:
2003         * animation/WebAnimation.idl:
2004
2005 2017-12-12  Javier Fernandez  <jfernandez@igalia.com>
2006
2007         [css-grid] Implement alignment for absolute positioned grid items
2008         https://bugs.webkit.org/show_bug.cgi?id=180632
2009
2010         Reviewed by Manuel Rego Casasnovas.
2011
2012         We are changing how we compute the grid area's size of positioned
2013         items, trying to make the logic as independent as possible of the
2014         grid container's direction.
2015
2016         The new way of placing absolute positioned elements in their grid area
2017         is based on the previously computed area's size. This provide a
2018         mechanism to place an item in its area respecting the offsets derived
2019         from the Content Alignment CSS properties and, which is more important,
2020         ignoring the grid container's direction.
2021
2022         Additionally, we use the already implemented alignment logic that's
2023         used for regular grid items. This patch provides almost full alignment
2024         capabilities for positioned objects, with the exception of 'stretch'.
2025
2026         It's worth mentioning that some of the test cases using vertical-rl
2027         writing mode will fail because of the bug 180633.
2028
2029         Updated web-platform-tests results of the test cases that pass now.
2030
2031         * rendering/GridLayoutFunctions.cpp:
2032        (WebCore::GridLayoutFunctions::hasOverrideContainingBlockContentSizeForChild):
2033         (WebCore::GridLayoutFunctions::overrideContainingBlockContentSizeForChild):
2034         * rendering/GridLayoutFunctions.h:
2035         * rendering/GridTrackSizingAlgorithm.cpp:
2036         (WebCore::GridTrackSizingAlgorithmStrategy::updateOverrideContainingBlockContentSizeForChild const):
2037         * rendering/RenderGrid.cpp:
2038         (WebCore::RenderGrid::layoutBlock):
2039         (WebCore::RenderGrid::gridItemOffset const):
2040         (WebCore::RenderGrid::hasStaticPositionForChild const):
2041         (WebCore::RenderGrid::layoutPositionedObject):
2042         (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
2043         (WebCore::RenderGrid::columnAxisPositionForChild const):
2044         (WebCore::RenderGrid::rowAxisPositionForChild const):
2045         (WebCore::RenderGrid::columnAxisOffsetForChild const):
2046         (WebCore::RenderGrid::rowAxisOffsetForChild const):
2047         (WebCore::RenderGrid::gridPositionIsAutoForOutOfFlow const):
2048         (WebCore::RenderGrid::resolveAutoStartGridPosition const):
2049         (WebCore::RenderGrid::resolveAutoEndGridPosition const):
2050         (WebCore::RenderGrid::gridAreaBreadthForOutOfFlowChild):
2051         (WebCore::RenderGrid::logicalOffsetForChild const):
2052         (WebCore::RenderGrid::gridAreaPositionForOutOfFlowChild const):
2053         (WebCore::RenderGrid::gridAreaPositionForInFlowChild const):
2054         (WebCore::RenderGrid::gridAreaPositionForChild const):
2055         (WebCore::RenderGrid::translateOutOfFlowRTLCoordinate const):
2056         (WebCore::RenderGrid::findChildLogicalPosition const):
2057         * rendering/RenderGrid.h:
2058         * rendering/style/GridPositionsResolver.cpp:
2059         (WebCore::adjustGridPositionsFromStyle):
2060         (WebCore::GridPositionsResolver::initialPositionSide):
2061         (WebCore::GridPositionsResolver::finalPositionSide):
2062         * rendering/style/GridPositionsResolver.h:
2063
2064 2017-12-12  Jer Noble  <jer.noble@apple.com>
2065
2066         [EME] Support reporting and restoring persistent usage data.
2067         https://bugs.webkit.org/show_bug.cgi?id=180684
2068
2069         Reviewed by Eric Carlson.
2070
2071         Add support for reading and acknowledging persistent usage data from the MediaKeys storage
2072         directory.
2073
2074         Add a mechanism for passing the storage location down to CDMPrivate and CDMInstance objects
2075         inside of the CDM class itself:
2076
2077         * Modules/encryptedmedia/CDM.cpp:
2078         (WebCore::CDM::createInstance):
2079         (WebCore::CDM::storageDirectory const):
2080         * Modules/encryptedmedia/CDM.h:
2081
2082         Support loading expired session data, acknowledging expired session data, closing sessions
2083         and removing usable key data.
2084
2085         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
2086         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2087         (WebCore::isEqual):
2088         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
2089         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::loadSession):
2090         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::closeSession):
2091         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::removeSessionData):
2092
2093 2017-12-12  Christopher Reid  <chris.reid@sony.com>
2094
2095         WebGL TextureMapperShaderProgram shaders don't compile in MSVC
2096         https://bugs.webkit.org/show_bug.cgi?id=180709
2097
2098         Reviewed by Myles C. Maxfield.
2099
2100         No new tests, no change in behavior.
2101
2102         Vertex and Fragment shaders were not compiling because TextureMapperShaderProgram.cpp was
2103         stringifying "#if USE(OPENGL_ES_2) ... #endif" into the shaders rather than evaluating these
2104         preprocessor directives before the STRINGIFY expansion.
2105
2106         Moved these #if conditions outside of STRINGIFY to remove compiler ambiguity.
2107
2108         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
2109
2110 2017-12-12  Zach Li  <zachli@apple.com>
2111         [WK2] Expose image via WKBundleHitTestResult API.
2112         https://bugs.webkit.org/show_bug.cgi?id=180552.
2113         rdar://problem/23951521
2114
2115         Reviewed by Simon Fraser.
2116
2117         * platform/graphics/ImageSource.h:
2118         This method will be used by clients outside WebCore, so
2119         add WEBCORE_EXPORT.
2120
2121 2017-12-12  Simon Fraser  <simon.fraser@apple.com>
2122
2123         Remove ColorSpaceDeviceRGB and most users of the obsolete deviceRGB colorspace
2124         https://bugs.webkit.org/show_bug.cgi?id=180689
2125
2126         Reviewed by Tim Horton.
2127
2128         Remove the ColorSpaceDeviceRGB enum and users.
2129
2130         ImageBuffer now uses sRGB instead of deviceRGB in the few cases that used the latter.
2131
2132         Switch Windows CG code to use sRGBColorSpaceRef() instead of deviceRGBColorSpaceRef().
2133
2134         Have linearRGBColorSpaceRef() use kCGColorSpaceLinearSRGB, which is present in iOS 9 and 10.11 and later.
2135
2136         * page/win/FrameCGWin.cpp:
2137         (WebCore::imageFromRect):
2138         * platform/graphics/Color.cpp:
2139         (WebCore::operator<<):
2140         * platform/graphics/ColorSpace.h:
2141         * platform/graphics/ImageBuffer.cpp:
2142         (WebCore::ImageBuffer::transformColorSpace):
2143         * platform/graphics/cg/ColorCG.cpp:
2144         (WebCore::Color::Color):
2145         (WebCore::leakCGColor):
2146         (WebCore::createCGColorWithDeviceRGBA): Deleted.
2147         * platform/graphics/cg/GraphicsContextCG.cpp:
2148         (WebCore::sRGBColorSpaceRef):
2149         (WebCore::linearRGBColorSpaceRef):
2150         (WebCore::extendedSRGBColorSpaceRef):
2151         (WebCore::displayP3ColorSpaceRef):
2152         (WebCore::deviceRGBColorSpaceRef): Deleted.
2153         * platform/graphics/cg/GraphicsContextCG.h:
2154         (WebCore::cachedCGColorSpace):
2155         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
2156         * platform/graphics/win/GraphicsContextCGWin.cpp:
2157         (WebCore::CGContextWithHDC):
2158         (WebCore::GraphicsContext::releaseWindowsContext):
2159         (WebCore::GraphicsContext::drawWindowsBitmap):
2160         * platform/graphics/win/ImageCGWin.cpp:
2161         (WebCore::BitmapImage::create):
2162         (WebCore::BitmapImage::getHBITMAPOfSize):
2163         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2164         (WebCore::MockRealtimeVideoSourceMac::pixelBufferFromCGImage const):
2165         * platform/win/DragImageCGWin.cpp:
2166         (WebCore::allocImage):
2167         (WebCore::createCgContextFromBitmap):
2168         * rendering/svg/RenderSVGResourceFilter.cpp:
2169         (WebCore::RenderSVGResourceFilter::postApplyResource):
2170         * rendering/svg/RenderSVGResourceMasker.cpp:
2171         (WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
2172
2173 2017-12-12  Youenn Fablet  <youenn@apple.com>
2174
2175         Navigation requests should use navigate fetch mode
2176         https://bugs.webkit.org/show_bug.cgi?id=179808
2177
2178         Reviewed by Chris Dumez.
2179
2180         Covered by existing tests.
2181
2182         * Modules/fetch/FetchRequest.cpp:
2183         (WebCore::buildOptions): Update to throw only if init.mode is Navigate.
2184         * Modules/fetch/FetchRequestInit.h:
2185         (WebCore::FetchRequestInit::hasMembers const): If init is present, set default values as per spec.
2186         * loader/DocumentLoader.cpp:
2187         (WebCore::DocumentLoader::loadMainResource): Set fetch mode to navigate.
2188         * loader/DocumentThreadableLoader.cpp:
2189         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Bypass preflight in case fetch mode is navigate.
2190
2191 2017-12-12  Simon Fraser  <simon.fraser@apple.com>
2192
2193         HTML-page with <object type="image/svg+xml" data="foo.svg"> often is blank
2194         https://bugs.webkit.org/show_bug.cgi?id=180524
2195         <rdar://problem/35920554>
2196
2197         Reviewed by Antti Koivisto.
2198
2199         The test case has script that conditionalizes behavior on whether window.innerWidth/Height
2200         are zero during the load event. We didn't force layout in innerWidth/Height, so whether
2201         they would zero depended on whether the parent frame had laid out, which was timing-sensitive.
2202
2203         Fix by triggering enough layout in the parent document so that the FrameView is resized before
2204         fetching its dimensions in innerWidth/Height. This causes our behavior to match Chrome and Firefox.
2205
2206         Test: fast/dom/iframe-innerWidth.html
2207
2208         * dom/EventDispatcher.cpp:
2209         (WebCore::EventDispatcher::dispatchEvent): Add some logging that helped me diagnose this.
2210         * page/DOMWindow.cpp:
2211         (WebCore::DOMWindow::innerHeight const):
2212         (WebCore::DOMWindow::innerWidth const):
2213
2214 2017-12-11  Antoine Quint  <graouts@apple.com>
2215
2216         [Web Animations] Enqueue and dispatch animation events
2217         https://bugs.webkit.org/show_bug.cgi?id=180657
2218         <rdar://problem/35970103>
2219
2220         Reviewed by Chris Dumez.
2221
2222         Now that we have support for the AnimationPlaybackEvent interface, we need a way to enqueue
2223         such events for dispatch at the opportune time. The Web Animations spec defines two ways
2224         to queue and dispatch events.
2225
2226         If the animation has a "document for timing", it should enqueue events on this document.
2227         In our implementation, if the animation timeline is set to a DocumentTimeline, that means
2228         it has a document for timing, and we let the DocumentTimeline enqueue those events, which
2229         will be dispatched through a dedicated GenericTaskQueue<Timer>. These events will be sorted
2230         by their respective timeline time before being dispatched.
2231
2232         If there is no document for timing, events should be dispatched as a standalone task.
2233
2234         * animation/DocumentTimeline.cpp:
2235         (WebCore::DocumentTimeline::~DocumentTimeline): Close the event dispatch task queue when the
2236         document timeline is torn down.
2237         (WebCore::DocumentTimeline::enqueueAnimationPlaybackEvent): Add the provided event to the
2238         pending animation events queue and, if one hasn't been registered yet, enqueue a task to
2239         dispatch events using a GenericTaskQueue<Timer>.
2240         (WebCore::compareAnimationPlaybackEvents): Comparator used to sort events in performEventDispatchTask()
2241         where events are sorted such that unresolved timeline times come first, and then from the
2242         earlier resolved timeline times to the later resolved timeline times. Events with unresolved
2243         timeline times and equal resolved timeline times are sorted in the order they were enqueued.
2244         (WebCore::DocumentTimeline::performEventDispatchTask): Run a stable sort on a copy of the pending list
2245         of events to dispatch and dispatch the events individually on their respective animations.
2246         * animation/DocumentTimeline.h:
2247         * animation/WebAnimation.cpp:
2248         (WebCore::WebAnimation::create): Pass in the document to the constructor.
2249         (WebCore::WebAnimation::WebAnimation): Use the provided document to initialize ActiveDOMObject.
2250         (WebCore::WebAnimation::enqueueAnimationPlaybackEvent): Create an AnimationPlaybackEvent with
2251         the provided type, timeline time and animation time and enqueue it on the document timeline,
2252         if one is available, or dispatch on this animation as a standalone task.
2253         (WebCore::WebAnimation::acceleratedRunningStateDidChange):
2254         (WebCore::WebAnimation::activeDOMObjectName const):
2255         (WebCore::WebAnimation::canSuspendForDocumentSuspension const):
2256         (WebCore::WebAnimation::stop):
2257         * animation/WebAnimation.h: Define WebAnimation to be an EventTarget and an ActiveDOMObject.
2258         * animation/WebAnimation.idl: Define WebAnimation to be an EventTarget and an ActiveDOMObject.
2259         * dom/EventTargetFactory.in:
2260
2261 2017-12-12  Chris Dumez  <cdumez@apple.com>
2262
2263         Simplify IPC code between WebProcess and StorageProcess for serviceWorker.postMessage()
2264         https://bugs.webkit.org/show_bug.cgi?id=180683
2265
2266         Reviewed by Brady Eidson.
2267
2268         Merge the 2 code paths from calling postMessage() from a ServiceWorkerClient and from
2269         a ServiceWorker. Also, postMessage() now only IPCs an identifier from the WebContent
2270         process to the StorageProcess. The ServiceWorkerClientData is looked up on Storage
2271         process side from the identifier before being sent to the context process.
2272
2273         * workers/service/SWClientConnection.h:
2274         * workers/service/ServiceWorker.cpp:
2275         (WebCore::ServiceWorker::postMessage):
2276         * workers/service/ServiceWorkerTypes.h:
2277         * workers/service/server/SWServer.cpp:
2278         (WebCore::SWServer::clientByID const):
2279         (WebCore::SWServer::matchAll):
2280         (WebCore::SWServer::forEachClientForOrigin):
2281         (WebCore::SWServer::claim):
2282         (WebCore::SWServer::registerServiceWorkerClient):
2283         (WebCore::SWServer::unregisterServiceWorkerClient):
2284         * workers/service/server/SWServer.h:
2285         * workers/service/server/SWServerWorker.cpp:
2286         (WebCore::SWServerWorker::findClientByIdentifier):
2287         * workers/service/server/SWServerWorker.h:
2288
2289 2017-12-12  Youenn Fablet  <youenn@apple.com>
2290
2291         Allow AudioContext to start when getUserMedia is on
2292         https://bugs.webkit.org/show_bug.cgi?id=180680
2293
2294         Reviewed by Eric Carlson.
2295
2296         Test: webrtc/getUserMedia-webaudio-autoplay.html
2297
2298         * Modules/webaudio/AudioContext.cpp:
2299         (WebCore::AudioContext::willBeginPlayback):
2300
2301 2017-12-12  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2302
2303         [Readable Streams API] Throw RangeError if a size is provided when creating a readable byte stream
2304         https://bugs.webkit.org/show_bug.cgi?id=180470
2305
2306         Reviewed by Youenn Fablet.
2307
2308         Throw a RangeError if a ReadableStream is created with type 'bytes' and with a
2309         non-undefined strategy size, as per latest spec:
2310         - https://github.com/whatwg/streams/pull/856
2311         - https://streams.spec.whatwg.org/#rs-constructor (step 4.c)
2312
2313         One new test imported from WPT to check that RangeError is thrown.
2314
2315         * Modules/streams/ReadableStream.js:
2316         (initializeReadableStream): Check strategy size and throw RangeError if needed.
2317
2318 2017-12-12  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2319
2320         [GTK][WebRTC] Stop warning with so much verbosity about not implemented RealtimeMediaSourceCenter
2321         https://bugs.webkit.org/show_bug.cgi?id=180694
2322
2323         Reviewed by Youenn Fablet.
2324
2325         No new tests -- no change in functionality.
2326
2327         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2328         (WebCore::RealtimeMediaSourceCenter::singleton):
2329
2330 2017-12-12  Ms2ger  <Ms2ger@igalia.com>
2331
2332         Implement {DOMMimeTypeArray, DOMPluginArray}::supportedPropertyNames().
2333         https://bugs.webkit.org/show_bug.cgi?id=180471
2334
2335         Reviewed by Darin Adler.
2336
2337         Test: imported/w3c/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-pluginarray.html
2338
2339         * plugins/DOMMimeTypeArray.cpp:
2340         (WebCore::DOMMimeTypeArray::supportedPropertyNames):
2341         * plugins/DOMPluginArray.cpp:
2342         (WebCore::DOMPluginArray::supportedPropertyNames):
2343
2344 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
2345
2346         [WTF] Thread::create should have Thread::tryCreate
2347         https://bugs.webkit.org/show_bug.cgi?id=180333
2348
2349         Reviewed by Darin Adler.
2350
2351         No behavior change.
2352
2353         * bindings/js/GCController.cpp:
2354         (WebCore::GCController::garbageCollectOnAlternateThreadForDebugging):
2355         * platform/audio/ReverbConvolver.cpp:
2356         (WebCore::ReverbConvolver::ReverbConvolver):
2357         * platform/audio/ReverbConvolver.h:
2358         * workers/WorkerThread.cpp:
2359         (WebCore::WorkerThread::start):
2360
2361 2017-12-11  Manuel Rego Casasnovas  <rego@igalia.com>
2362
2363         [css-grid] Automatic minimum size is not clamped if min track sizing function is auto
2364         https://bugs.webkit.org/show_bug.cgi?id=180283
2365
2366         Reviewed by Darin Adler.
2367
2368         We were not clamping the automatic minimum size when
2369         the min track sizing function was intrinsic (e.g. minmax(auto, 0px)).
2370         However the spec (https://drafts.csswg.org/css-grid/#min-size-auto)
2371         is very clear regarding that.
2372
2373         This patch modifies
2374         GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem(),
2375         so in the case of a fixed max track sizing function it clamps
2376         the automatic minimum size of the item to the stretch fit
2377         of the grid area's size.
2378         It needs to take into account if the item has fixed size, margin, border
2379         and/or padding as those cannot be clamped.
2380
2381         Using WPT tests to verify this behavior,
2382         and corrected a bunch of other tests that were wrong.
2383
2384         Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-017.html
2385               imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-022.html
2386               imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-023.html
2387
2388         * rendering/GridTrackSizingAlgorithm.cpp:
2389         (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem):
2390         * rendering/GridTrackSizingAlgorithm.h:
2391         (WebCore::GridTrack::growthLimitIsInfinite const):
2392         * rendering/style/GridTrackSize.h:
2393         (WebCore::GridTrackSize::cacheMinMaxTrackBreadthTypes):
2394         (WebCore::GridTrackSize::hasFixedMaxTrackBreadth const):
2395
2396 2017-12-11  Zan Dobersek  <zdobersek@igalia.com>
2397
2398         [Cairo] Cairo::clipToImageBuffer() should operate on a cairo_surface_t
2399         https://bugs.webkit.org/show_bug.cgi?id=180665
2400
2401         Reviewed by Michael Catanzaro.
2402
2403         Have the Cairo::clipToImageBuffer() function in the CairoUtilities code
2404         operate on a cairo_surface_t object, instead of an Image object.
2405
2406         Call site in GraphicsContext::clipToImageBuffer() is adjusted to first
2407         ensure a non-null Image object, and then retrieve a cairo_surface_t
2408         object from that, passing it on to Cairo::clipToImageBuffer().
2409
2410         No new tests -- no change in functionality.
2411
2412         * platform/graphics/cairo/CairoOperations.cpp:
2413         (WebCore::Cairo::clipToImageBuffer):
2414         * platform/graphics/cairo/CairoOperations.h:
2415         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2416         (WebCore::GraphicsContext::clipToImageBuffer):
2417
2418 2017-12-11  Zan Dobersek  <zdobersek@igalia.com>
2419
2420         [Cairo] Don't use a static cairo_surface_t object for CairoPath contexts
2421         https://bugs.webkit.org/show_bug.cgi?id=180663
2422
2423         Reviewed by Michael Catanzaro.
2424
2425         Instead of using a single cairo_surface_t object and sharing it between
2426         different cairo_t objects handled by CairoPath, create a new mock 1x1px
2427         alpha-only surface for each cairo_t object that's allocated in the
2428         CairoPath constructor.
2429
2430         This avoids potential issues in how Cairo's state handling internally
2431         uses these surfaces, which is completely opaque to us and out of our
2432         control. This also avoids crashes when using this one cairo_surface_t
2433         object through different CairoPath objects across different threads.
2434
2435         No new tests -- no change in behavior.
2436
2437         * platform/graphics/cairo/PlatformPathCairo.cpp:
2438         (WebCore::CairoPath::CairoPath):
2439         (WebCore::pathSurface): Deleted.
2440         * platform/graphics/cairo/PlatformPathCairo.h:
2441         (WebCore::CairoPath::context):
2442
2443 2017-12-11  Zan Dobersek  <zdobersek@igalia.com>
2444
2445         [CoordGraphics] Move UpdateAtlas, AreaAllocator into the platform layer
2446         https://bugs.webkit.org/show_bug.cgi?id=180641
2447
2448         Reviewed by Michael Catanzaro.
2449
2450         Move the UpdateAtlas and AreaAllocator classes and their source files
2451         into the platform layer. This still means using the WebCore namespace,
2452         but apart from that these two classes have no dependency on anything in
2453         the WebKit layer, so they can be moved from there.
2454
2455         No new tests -- no change in functionality.
2456
2457         * platform/TextureMapper.cmake:
2458         * platform/graphics/texmap/coordinated/AreaAllocator.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp.
2459         (WebCore::AreaAllocator::AreaAllocator):
2460         (WebCore::AreaAllocator::~AreaAllocator):
2461         (WebCore::AreaAllocator::expand):
2462         (WebCore::AreaAllocator::expandBy):
2463         (WebCore::AreaAllocator::release):
2464         (WebCore::AreaAllocator::overhead const):
2465         (WebCore::AreaAllocator::roundAllocation const):
2466         (WebCore::GeneralAreaAllocator::GeneralAreaAllocator):
2467         (WebCore::GeneralAreaAllocator::~GeneralAreaAllocator):
2468         (WebCore::GeneralAreaAllocator::freeNode):
2469         (WebCore::GeneralAreaAllocator::expand):
2470         (WebCore::fitsWithin):
2471         (WebCore::GeneralAreaAllocator::allocate):
2472         (WebCore::GeneralAreaAllocator::allocateFromNode):
2473         (WebCore::GeneralAreaAllocator::splitNode):
2474         (WebCore::GeneralAreaAllocator::updateLargestFree):
2475         (WebCore::GeneralAreaAllocator::release):
2476         (WebCore::GeneralAreaAllocator::overhead const):
2477         * platform/graphics/texmap/coordinated/AreaAllocator.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.h.
2478         (WebCore::nextPowerOfTwo):
2479         (WebCore::AreaAllocator::size const):
2480         (WebCore::AreaAllocator::minimumAllocation const):
2481         (WebCore::AreaAllocator::setMinimumAllocation):
2482         (WebCore::AreaAllocator::margin const):
2483         (WebCore::AreaAllocator::setMargin):
2484         * platform/graphics/texmap/coordinated/UpdateAtlas.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp.
2485         (WebCore::UpdateAtlas::UpdateAtlas):
2486         (WebCore::UpdateAtlas::~UpdateAtlas):
2487         (WebCore::UpdateAtlas::buildLayoutIfNeeded):
2488         (WebCore::UpdateAtlas::didSwapBuffers):
2489         (WebCore::UpdateAtlas::getCoordinatedBuffer):
2490         * platform/graphics/texmap/coordinated/UpdateAtlas.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h.
2491         (WebCore::UpdateAtlas::size const):
2492         (WebCore::UpdateAtlas::supportsAlpha const):
2493         (WebCore::UpdateAtlas::addTimeInactive):
2494         (WebCore::UpdateAtlas::isInactive const):
2495         (WebCore::UpdateAtlas::isInUse const):
2496
2497 2017-12-11  Ryosuke Niwa  <rniwa@webkit.org>
2498
2499         Disable NoEventDispatchAssertion release assertion in WebKit1
2500         https://bugs.webkit.org/show_bug.cgi?id=180616
2501
2502         Reviewed by Zalan Bujtas.
2503
2504         Disabled the release assertion for NoEventDispatchAssertion in WebKit1 since there are many
2505         delegate callbacks that happen at unsafe timing, and we don't have any hope of fixing them
2506         in short term.
2507
2508         * bindings/js/ScriptController.cpp:
2509         (WebCore::ScriptController::canExecuteScripts):
2510         * dom/Document.cpp:
2511         (WebCore::isSafeToUpdateStyleOrLayout):
2512         * dom/ScriptElement.cpp:
2513         (WebCore::ScriptElement::executeClassicScript):
2514         * platform/RuntimeApplicationChecks.h:
2515         (WebCore::isInWebProcess):
2516         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2517         (WebCore::isInWebProcess): Extracted from IOSApplication::isWebProcess.
2518         (WebCore::IOSApplication::isWebProcess):
2519
2520 2017-12-11  Darin Adler  <darin@apple.com>
2521
2522         Improve FontSelectionAlgorithm, including moving from IntegerHasher to Hasher
2523         https://bugs.webkit.org/show_bug.cgi?id=180340
2524
2525         Reviewed by Dan Bates.
2526
2527         * css/CSSFontFaceSet.h: Moved FontSelectionRequestKey and FontSelectionRequestKeyHash
2528         here to be private members, and used a std::optional instead of a class for this.
2529         Also use the new Hasher to compute the hash. Also added FontSelectionRequestKeyHashTraits.
2530
2531         * platform/graphics/FontDescription.cpp:
2532         (WebCore::FontDescription::FontDescription): Updated since FontSelectionRequest
2533         does not always have a constructor any more.
2534
2535         * platform/graphics/FontSelectionAlgorithm.h: Tweaked comments. Used "using" instead
2536         of typedef. Formatted some trivial functions as single lines. Stopped using
2537         NeverDestroyed for simple classes like FontSelectionValue; it's not needed unless
2538         there is a destructor. Got rid of some incorrect use of const. Replaced some member
2539         functions with non-member functions. Moved some function bodies out of class definitions.
2540         Used a lot of constexpr functions.
2541         (WebCore::FontSelectionRequest::tied const): Added so we can easily write both == and the
2542         hash function without listing the data members.
2543         (WebCore::add): Added an overload so we can hash things that include FontSelectionRequest.
2544         (WebCore::FontSelectionRequestKey::FontSelectionRequestKey): Changed this class to
2545         use std::optional instead of a separate boolean for deleted values.
2546         (WebCore::FontSelectionRequestKey::isHashTableDeletedValue const): Ditto.
2547         (WebCore::FontSelectionRequestKey::operator== const): Ditto.
2548         (WebCore::FontSelectionRequestKeyHash::hash): Ditto.
2549         (WebCore::FontSelectionRequestKeyHash::equal): Ditto.
2550         (WebCore::FontSelectionCapabilities::tied const): Added so we can easily write both ==
2551         and the hash function without listing the data members.
2552         (WebCore::FontSelectionSpecifiedCapabilities::tied const): Ditto.
2553         (WebCore::FontSelectionAlgorithm::FontSelectionAlgorithm): Use make_unique instead of new.
2554
2555         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2556         (WebCore::findClosestFont): Move in the vector instead of copying it when creating a
2557         FontSelectionAlgorithm object.
2558
2559 2017-12-11  Jer Noble  <jer.noble@apple.com>
2560
2561         [EME] support update() for FairPlayStreaming in Modern EME API
2562         https://bugs.webkit.org/show_bug.cgi?id=180542
2563
2564         Reviewed by Eric Carlson.
2565
2566         Support the updateLicense() method in CDMInstanceFairPlayStreaming. Also, support adding a
2567         AVStreamDataParser to the AVContentKeySession.
2568
2569         Drive-by fixes:
2570
2571         - Sometimes, AVFoundation will give us a base64 encoded string with spaces url-disallowed
2572         characters, so use base64Decode() rather than base64URLDecode().
2573
2574         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
2575         (WebCore::validFairPlayStreamingSchemes):
2576         (WebCore::extractSinfData):
2577         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
2578         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2579         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
2580         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
2581         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
2582         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2583         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstance const):
2584         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2585         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
2586         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceDetached):
2587         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::attemptToDecryptWithInstance):
2588         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2589         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2590         (WebCore::SourceBufferPrivateAVFObjC::destroyParser):
2591         (WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
2592
2593 2017-12-11  Eric Carlson  <eric.carlson@apple.com>
2594
2595         Web Inspector: Optionally log WebKit log parameters as JSON
2596         https://bugs.webkit.org/show_bug.cgi?id=180529
2597         <rdar://problem/35909462>
2598
2599         Reviewed by Joseph Pecoraro.
2600
2601         * dom/Document.cpp:
2602         (WebCore::Document::didLogMessage):Update for API change. Don't check for main thread, that
2603         is already done in addConsoleMessage.
2604         * dom/Document.h:
2605
2606         * html/HTMLMediaElement.cpp:
2607         (WebCore::HTMLMediaElement::updatePlayState): Cleanup logging.
2608
2609         * html/track/DataCue.cpp:
2610         (WebCore::DataCue::toJSONString const): Serialize to JSON string.
2611         (WebCore::DataCue::toString const): Deleted.
2612         * html/track/DataCue.h:
2613         (WTF::LogArgument<WebCore::DataCue>::toString):
2614
2615         * html/track/TextTrackCue.cpp:
2616         (WebCore::TextTrackCue::toJSON const): Ditto.
2617         (WebCore::TextTrackCue::toJSONString const):
2618         (WebCore::TextTrackCue::toString const): Deleted.
2619         * html/track/TextTrackCue.h:
2620         (WTF::LogArgument<WebCore::TextTrackCue>::toString):
2621
2622         * html/track/TextTrackCueGeneric.cpp:
2623         (WebCore::TextTrackCueGeneric::toJSONString const): Ditto.
2624         (WebCore::TextTrackCueGeneric::toString const): Deleted.
2625         * html/track/TextTrackCueGeneric.h:
2626         (WTF::LogArgument<WebCore::TextTrackCueGeneric>::toString):
2627
2628         * html/track/VTTCue.cpp:
2629         (WebCore::VTTCue::toJSONString const): Ditto.
2630         (WebCore::VTTCue::toString const): Deleted.
2631         * html/track/VTTCue.h:
2632         (WTF::LogArgument<WebCore::VTTCue>::toString):
2633
2634         * platform/graphics/InbandTextTrackPrivateClient.h:
2635         (WebCore::GenericCueData::toJSONString const): Ditto.
2636         (WTF::LogArgument<WebCore::GenericCueData>::toString):
2637         (WebCore::GenericCueData::toString const): Deleted.
2638
2639         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
2640         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Cleanup logging.
2641         (WebCore::InbandTextTrackPrivateAVF::removeCompletedCues): Ditto.
2642         (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): Log the entire cue.
2643         (WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer): Cleanup logging.
2644
2645         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
2646         (WebCore::MediaPlayerPrivateAVFoundation::maxMediaTimeSeekable const): Don't log, it isn't
2647         interesting and happens frequently.
2648         (WebCore::MediaPlayerPrivateAVFoundation::minMediaTimeSeekable const): Ditto.
2649
2650         * platform/graphics/iso/ISOVTTCue.cpp:
2651         (WebCore::ISOWebVTTCue::toJSONString const): Serialize to JSON string.
2652
2653         * platform/graphics/iso/ISOVTTCue.h:
2654         (WTF::LogArgument<WebCore::ISOWebVTTCue>::toString): Ditto.
2655
2656 2017-12-11  Youenn Fablet  <youenn@apple.com>
2657
2658         Use VCP H264 encoder for platforms supporting it
2659         https://bugs.webkit.org/show_bug.cgi?id=179076
2660         rdar://problem/35180773
2661
2662         Reviewed by Eric Carlson.
2663
2664         Covered by existing test coverage.
2665
2666         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp:
2667         (WebCore::VideoToolboxVideoEncoderFactory::setActive):
2668         (WebCore::VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder):
2669         (WebCore::VideoToolboxVideoEncoderFactory::DestroyVideoEncoder):
2670         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h:
2671
2672 2017-12-11  Chris Dumez  <cdumez@apple.com>
2673
2674         Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData
2675         https://bugs.webkit.org/show_bug.cgi?id=180669
2676
2677         Reviewed by Youenn Fablet.
2678
2679         Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData, for consistency with
2680         ServiceWorkerIdentifier / ServiceWorkerData, and start simplifying the postMessage() code.
2681
2682         * WebCore.xcodeproj/project.pbxproj:
2683         * dom/Document.cpp:
2684         (WebCore::Document::setServiceWorkerConnection):
2685         * workers/service/SWClientConnection.h:
2686         * workers/service/ServiceWorker.cpp:
2687         (WebCore::ServiceWorker::postMessage):
2688         * workers/service/ServiceWorkerClient.cpp:
2689         (WebCore::ServiceWorkerClient::getOrCreate):
2690         (WebCore::ServiceWorkerClient::ServiceWorkerClient):
2691         * workers/service/ServiceWorkerClient.h:
2692         (WebCore::ServiceWorkerClient::identifier const):
2693         * workers/service/ServiceWorkerClientData.cpp:
2694         (WebCore::ServiceWorkerClientData::isolatedCopy const):
2695         (WebCore::ServiceWorkerClientData::from):
2696         * workers/service/ServiceWorkerClientData.h:
2697         (WebCore::ServiceWorkerClientData::encode const):
2698         (WebCore::ServiceWorkerClientData::decode):
2699         * workers/service/ServiceWorkerClientInformation.h: Removed.
2700         * workers/service/ServiceWorkerClients.cpp:
2701         (WebCore::didFinishGetRequest):
2702         (WebCore::ServiceWorkerClients::get):
2703         (WebCore::matchAllCompleted):
2704         * workers/service/ServiceWorkerTypes.h:
2705         * workers/service/ServiceWorkerWindowClient.cpp:
2706         (WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
2707         * workers/service/ServiceWorkerWindowClient.h:
2708         * workers/service/context/SWContextManager.cpp:
2709         (WebCore::SWContextManager::postMessageToServiceWorker):
2710         * workers/service/context/SWContextManager.h:
2711         * workers/service/context/ServiceWorkerThread.cpp:
2712         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
2713         * workers/service/context/ServiceWorkerThread.h:
2714         * workers/service/server/SWServer.cpp:
2715         (WebCore::SWServer::findClientByIdentifier):
2716         (WebCore::SWServer::matchAll):
2717         (WebCore::SWServer::claim):
2718         (WebCore::SWServer::registerServiceWorkerClient):
2719         * workers/service/server/SWServer.h:
2720         * workers/service/server/SWServerToContextConnection.h:
2721         * workers/service/server/SWServerWorker.h:
2722
2723 2017-12-11  Daniel Bates  <dabates@apple.com>
2724
2725         Fix the macOS Sierra build following r225179
2726         (https://bugs.webkit.org/show_bug.cgi?id=180011)
2727
2728         Substitute TARGET_MAC_OS_X_VERSION_LESS_THAN_101300 for TARGET_MAC_OS_X_VERSION_LESS_THAN_1013000.
2729
2730         * Configurations/WebCore.xcconfig:
2731
2732 2017-12-11  Zalan Bujtas  <zalan@apple.com>
2733
2734         Make FrameView objects IsoHeap allocated
2735         https://bugs.webkit.org/show_bug.cgi?id=180668
2736         <rdar://problem/35976738>
2737
2738         Reviewed by Simon Fraser.
2739
2740         Related to <https://trac.webkit.org/changeset/225719/webkit>
2741
2742         * page/FrameView.cpp:
2743         * page/FrameView.h:
2744
2745 2017-12-11  Antoine Quint  <graouts@apple.com>
2746
2747         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
2748         https://bugs.webkit.org/show_bug.cgi?id=180647
2749
2750         Reviewed by Dean Jackson.
2751
2752         Actually fix Windows build this time.
2753
2754         * animation/AnimationPlaybackEventInit.h:
2755
2756 2017-12-11  Antoine Quint  <graouts@apple.com>
2757
2758         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
2759         https://bugs.webkit.org/show_bug.cgi?id=180647
2760         <rdar://problem/35966325>
2761
2762         Reviewed by Dean Jackson.
2763
2764         Unreviewed, fix Windows build.
2765
2766         * animation/AnimationPlaybackEventInit.h:
2767
2768 2017-12-11  Zalan Bujtas  <zalan@apple.com>
2769
2770         FloatingObjects/FloatingObject classes should hold weak references to renderers
2771         https://bugs.webkit.org/show_bug.cgi?id=180627
2772         <rdar://problem/35954069>
2773
2774         Reviewed by Antti Koivisto.
2775
2776         * rendering/FloatingObjects.cpp:
2777         (WebCore::FloatingObject::FloatingObject):
2778         (WebCore::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter):
2779         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter::ComputeFloatOffsetForFloatLayoutAdapter):
2780         (WebCore::ComputeFloatOffsetForLineLayoutAdapter::ComputeFloatOffsetForLineLayoutAdapter):
2781         (WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
2782         (WebCore::FindNextFloatLogicalBottomAdapter::collectIfNeeded):
2783         (WebCore::FloatingObjects::findNextFloatLogicalBottomBelow):
2784         (WebCore::FloatingObjects::findNextFloatLogicalBottomBelowForBlock):
2785         (WebCore::FloatingObjects::FloatingObjects):
2786         (WebCore::FloatingObjects::clearLineBoxTreePointers):
2787         (WebCore::FloatingObjects::logicalLeftOffsetForPositioningFloat):
2788         (WebCore::FloatingObjects::logicalRightOffsetForPositioningFloat):
2789         (WebCore::FloatingObjects::logicalLeftOffset):
2790         (WebCore::FloatingObjects::logicalRightOffset):
2791         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
2792         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
2793         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatTypeValue>::heightRemaining const):
2794         (WebCore::ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded):
2795         (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
2796         (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
2797         * rendering/FloatingObjects.h:
2798         (WebCore::FloatingObject::renderer const):
2799         (WebCore::FloatingObjects::renderer const):
2800
2801 2017-12-11  David Quesada  <david_quesada@apple.com>
2802
2803         Turn on ENABLE_APPLICATION_MANIFEST
2804         https://bugs.webkit.org/show_bug.cgi?id=180562
2805         rdar://problem/35924737
2806
2807         Reviewed by Geoffrey Garen.
2808
2809         * Configurations/FeatureDefines.xcconfig:
2810         * loader/LinkLoader.cpp:
2811         (WebCore::createLinkPreloadResourceClient):
2812         * loader/cached/CachedResourceRequest.cpp:
2813             Add a missing #include that was implicitly added in the unified source when
2814             the feature is disabled.
2815
2816 2017-12-11  Dean Jackson  <dino@apple.com>
2817
2818         Add a runtime feature flag for ImageBitmap and OffscreenCanvas
2819         https://bugs.webkit.org/show_bug.cgi?id=180652
2820         <rdar://problem/35969611>
2821
2822         Reviewed by Antoine Quint.
2823
2824         Add a RuntimeEnabledFeature for these interfaces, and link the bindings
2825         to the feature.
2826
2827         Test: fast/canvas/offscreen-enabled.html
2828
2829         * bindings/js/WebCoreBuiltinNames.h:
2830         * html/ImageBitmap.idl:
2831         * html/OffscreenCanvas.idl:
2832         * page/RuntimeEnabledFeatures.h:
2833         (WebCore::RuntimeEnabledFeatures::setImageBitmapOffscreenCanvasEnabled):
2834         (WebCore::RuntimeEnabledFeatures::imageBitmapOffscreenCanvasEnabled const):
2835         * page/WindowOrWorkerGlobalScope.idl:
2836
2837 2017-12-11  Antoine Quint  <graouts@apple.com>
2838
2839         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
2840         https://bugs.webkit.org/show_bug.cgi?id=180647
2841         <rdar://problem/35966325>
2842
2843         Reviewed by Dean Jackson.
2844
2845         We implement the AnimationPlaybackEvent interface and AnimationPlaybackEventInit dictionary
2846         as the first step towards dispatching animation "finish" and "cancel" events.
2847
2848         Animation playback events will be dispatched on Animation objects and expose the timeline time
2849         and animation current time at the time they were constructed. Dispatch itself, which will be
2850         the focus of the next patch, is not synchronous, so it's important to track those values
2851         at creation time.
2852
2853         No new tests yet, followup patches will enable event dispatch and existing Web Platform Tests
2854         will show progressions.
2855
2856         * CMakeLists.txt:
2857         * DerivedSources.make:
2858         * Sources.txt:
2859         * WebCore.xcodeproj/project.pbxproj:
2860         * animation/AnimationPlaybackEvent.cpp: Added.
2861         (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent):
2862         (WebCore::AnimationPlaybackEvent::bindingsCurrentTime const):
2863         (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const):
2864         * animation/AnimationPlaybackEvent.h: Added.
2865         * animation/AnimationPlaybackEvent.idl: Added.
2866         * animation/AnimationPlaybackEventInit.h: Added.
2867         * animation/AnimationPlaybackEventInit.idl: Added.
2868         * bindings/js/WebCoreBuiltinNames.h:
2869         * dom/EventNames.in:
2870
2871 2017-12-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2872
2873         [WinCairo] DumpRenderTree times out for all non-http tests
2874         https://bugs.webkit.org/show_bug.cgi?id=180571
2875
2876         Reviewed by Alex Christensen.
2877
2878         Bug fix on processing the curl event for file protocol.
2879
2880         No new tests. This fix is to run existing tests.
2881
2882         * platform/network/curl/CurlRequest.cpp:
2883         (WebCore::CurlRequest::completeDidReceiveResponse):
2884         * platform/network/curl/CurlRequest.h:
2885         (WebCore::CurlRequest::isCompleted const):
2886         (WebCore::CurlRequest::isCancelled const):
2887         (WebCore::CurlRequest::isCompletedOrCancelled const):
2888
2889 2017-12-11  Manuel Rego Casasnovas  <rego@igalia.com>
2890
2891         REGRESSION(r221931): Row stretch doesn't work for grid container with min-height
2892         https://bugs.webkit.org/show_bug.cgi?id=180287
2893
2894         Reviewed by Darin Adler.
2895
2896         In r221931 we moved the stretch phase as the last step of
2897         the track sizing algorithm.
2898         However this introduced a regression as we were no longer
2899         taking into account the grid container min-width|height constraints
2900         during this step.
2901
2902         The CSS WG modified the spec so it now defines what to do
2903         in these situations (https://drafts.csswg.org/css-grid/#algo-stretch):
2904           "If the free space is indefinite, but the grid container
2905            has a definite min-width/height, use that size to calculate
2906            the free space for this step instead."
2907
2908         This patch adds a new method
2909         GridTrackSizingAlgorithmStrategy::freeSpaceForStretchAutoTracksStep().
2910         When we're in the DefiniteSizeStrategy it just returns the current
2911         free space.
2912         For the IndefiniteSizeStrategy in the columns case we don't need
2913         any special computation (the same that happens in
2914         recomputeUsedFlexFractionIfNeeded()); for rows it uses the min size
2915         of the grid container (respecting min-width|height properties)
2916         to calculate the free space.
2917
2918         Test: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-stretch-respects-min-size-001.html
2919
2920         * rendering/GridTrackSizingAlgorithm.cpp:
2921         (WebCore::IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const):
2922         (WebCore::DefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const):
2923         (WebCore::GridTrackSizingAlgorithm::stretchAutoTracks):
2924         * rendering/GridTrackSizingAlgorithm.h:
2925
2926 2017-12-10  Minsheng Liu  <lambda@liu.ms>
2927
2928         Incorrect bounds inside <mover>/<munder> when a stretchy operator is present
2929         https://bugs.webkit.org/show_bug.cgi?id=179682
2930
2931         Reviewed by Frédéric Wang.
2932
2933         Currently a stretchy operator inside <mover>/<munder>/<munderover> is stretched
2934         during paint() rather than layout(), which leads to both end user confusion
2935         and many unexpected behaviors. This patch rewrites
2936         RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren()
2937         to both eliminate the issue and make operator stretching more standard
2938         conforming.
2939
2940         A test is added to check the stretch width of stretchy operators in various
2941         scenarios:
2942         mathml/opentype/munderover-stretch-width.html
2943
2944         A previous test is updated:
2945         mathml/opentype/opentype-stretchy-horizontal.html
2946
2947         * rendering/mathml/RenderMathMLOperator.cpp:
2948         (WebCore::RenderMathMLOperator::stretchTo):
2949         (WebCore::RenderMathMLOperator::resetStretchSize):
2950         (WebCore::RenderMathMLOperator::paint):
2951         * rendering/mathml/RenderMathMLOperator.h:
2952         (WebCore::RenderMathMLOperator::setStretchWidthLocked):
2953         (WebCore::RenderMathMLOperator::isStretchWidthLocked const):
2954         * rendering/mathml/RenderMathMLUnderOver.cpp:
2955         (WebCore::toHorizontalStretchyOperator):
2956         (WebCore::fixLayoutAfterStretch):
2957         (WebCore::RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren):
2958
2959 2017-12-10  Yusuke Suzuki  <utatane.tea@gmail.com>
2960
2961         Unreviewed, follow-up patch after r225470
2962         https://bugs.webkit.org/show_bug.cgi?id=180308
2963
2964         * Modules/webdatabase/SQLTransaction.cpp:
2965         (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
2966         Use consistent operands.
2967
2968         * bindings/js/JSCallbackData.h:
2969         (WebCore::JSCallbackData::JSCallbackData):
2970         Use class field initializer.
2971
2972         * xml/parser/XMLDocumentParserLibxml2.cpp:
2973         (WebCore::openFunc):
2974         Use consistent operands.
2975
2976 2017-12-09  Ryosuke Niwa  <rniwa@webkit.org>
2977
2978         iOS: Crash in Document::updateLayout() via Document::processViewport
2979         https://bugs.webkit.org/show_bug.cgi?id=180619
2980         <rdar://problem/35717575>
2981
2982         Reviewed by Zalan Bujtas.
2983
2984         The crash is caused by modern media controls updating the layout in the middle of insertedIntoAncestor
2985         via HTMLMediaElement::setControllerJSProperty inside Document::pageScaleFactorChangedAndStable.
2986
2987         Fixed the crash by delaying the work to update the viewport configuration until didFinishInsertingNode
2988         since updating the viewport configuration results in a lot of related code running in response,
2989         and making sure all that code never tries to execute an author script is not attainable in the short term,
2990         and a maintenance nightmare in the long term.
2991
2992         Test: media/ios/viewport-change-with-video.html
2993
2994         * html/HTMLMetaElement.cpp:
2995         (WebCore::HTMLMetaElement::insertedIntoAncestor):
2996         (WebCore::HTMLMetaElement::didFinishInsertingNode): Added.
2997         * html/HTMLMetaElement.h:
2998
2999 2017-12-08  Zalan Bujtas  <zalan@apple.com>
3000
3001         Document::updateLayout() could destroy current frame.
3002         https://bugs.webkit.org/show_bug.cgi?id=180525
3003         <rdar://problem/35906836>
3004
3005         Reviewed by Simon Fraser.
3006
3007         Early return when Document::updateLayout() triggers Frame destruction.
3008
3009         Test: fast/frames/crash-when-iframe-is-remove-in-eventhandler.html
3010
3011         * dom/TreeScope.cpp:
3012         (WebCore::absolutePointIfNotClipped):
3013
3014 2017-12-08  Chris Dumez  <cdumez@apple.com>
3015
3016         ServiceWorkerGlobalScope is a global object and should be marked as [ImplicitThis] in the IDL
3017         https://bugs.webkit.org/show_bug.cgi?id=180615
3018
3019         Reviewed by Brady Eidson.
3020
3021         ServiceWorkerGlobalScope is a global object and should be marked as [ImplicitThis] in the IDL, similarly to what we do for Window.
3022         This allows a getter to be fallback to the global object as ThisValue when the cast of the ThisValue to the expected type fails.
3023
3024         No new tests, rebaselined existing test.
3025
3026         * workers/DedicatedWorkerGlobalScope.idl:
3027         * workers/WorkerGlobalScope.idl:
3028         * workers/service/ServiceWorkerGlobalScope.idl:
3029
3030 2017-12-08  Brady Eidson  <beidson@apple.com>
3031
3032         Delay some service worker operations until after the database import completes.
3033         https://bugs.webkit.org/show_bug.cgi?id=180573
3034
3035         Reviewed by Chris Dumez.
3036
3037         No new tests (Not testable yet).
3038
3039         Right after the storage process launches it starts importing registration records.
3040         During this time, a lot of the decisions we make regarding registrations, fetch, etc.
3041         are invalid, as they rely on those in-memory records being in place.
3042         
3043         This patch delays certain things until after the initial origin table import is complete.
3044         
3045         * workers/service/server/RegistrationStore.cpp:
3046         (WebCore::RegistrationStore::databaseOpenedAndRecordsImported):
3047
3048         * workers/service/server/SWOriginStore.h:
3049
3050         * workers/service/server/SWServer.cpp:
3051         (WebCore::SWServer::registrationStoreImportComplete): Tell the origin store the initial
3052           import was completed.
3053         (WebCore::SWServer::addRegistrationFromStore):
3054         * workers/service/server/SWServer.h:
3055
3056 2017-12-08  Youenn Fablet  <youenn@apple.com>
3057
3058         Service Worker should use a correct user agent
3059         https://bugs.webkit.org/show_bug.cgi?id=180566
3060         <rdar://problem/35926295>
3061
3062         Reviewed by Chris Dumez.
3063
3064         Test: http/wpt/service-workers/useragent.https.html
3065
3066         Make ServiceWorkerFrameLoaderClient return a valid UserAgent.
3067         Pass user agent to ServiceWorkerThread so that navigation.userAgent is correctly initialized.
3068         Allow ServiceWorkerFrameLoaderClient to clean itself when no longer needed.
3069
3070         * loader/EmptyFrameLoaderClient.h:
3071         * workers/service/context/ServiceWorkerThread.cpp:
3072         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
3073         * workers/service/context/ServiceWorkerThread.h:
3074         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3075         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
3076         (WebCore::ServiceWorkerThreadProxy::frameLoaderClient):
3077         * workers/service/context/ServiceWorkerThreadProxy.h:
3078
3079 2017-12-07  Simon Fraser  <simon.fraser@apple.com>
3080
3081         Wrong caret position for input field inside a fixed position parent on iOS 11
3082         https://bugs.webkit.org/show_bug.cgi?id=176896
3083         rdar://problem/33726145
3084
3085         Reviewed by Tim Horton.
3086
3087         In r219668 I added code to compute a layout viewport rect in the web process, so that
3088         after programmatic scrolling, getBoundingClientRect() would return the correct values.
3089         However, that computation sometimes used a different visual viewport than the UI process,
3090         resulting in a different layout viewport being set. This would happen when the keyboard
3091         was visible, and the combination of this and zooming when focusing an input would result
3092         in a state where the scrolling tree contained notes computed with the bad layout viewport.
3093         This could cause apparently offset fixed elements, and bad caret positioning if those fixed
3094         elements contained the focused input.
3095
3096         Fix by passing to the web process the same visual viewport rect that the UI process is using,
3097         namely "unobscuredContentRectRespectingInputViewBounds". This was already being set in
3098         VisibleContentRectUpdateInfo but wasn't encoded/decoded, so fix that. Set it as an optional<>
3099         on FrameView when different from the normal visual viewport, and return it from
3100         visualViewportRect().
3101
3102         Some other minor logging changes.
3103
3104         Test: fast/visual-viewport/ios/caret-after-focus-in-fixed.html
3105
3106         * page/FrameView.cpp:
3107         (WebCore::FrameView::setVisualViewportOverrideRect):
3108         (WebCore::FrameView::updateLayoutViewport):
3109         (WebCore::FrameView::visualViewportRect const):
3110         * page/FrameView.h:
3111         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
3112         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
3113
3114 2017-12-08  Zalan Bujtas  <zalan@apple.com>
3115
3116         Make inline box objects IsoHeap allocated.
3117         https://bugs.webkit.org/show_bug.cgi?id=180556
3118         <rdar://problem/35923629>
3119
3120         Reviewed by Filip Pizlo.
3121
3122         * rendering/EllipsisBox.cpp:
3123         * rendering/EllipsisBox.h:
3124         * rendering/InlineBox.cpp:
3125         * rendering/InlineBox.h:
3126         * rendering/InlineElementBox.cpp:
3127         * rendering/InlineElementBox.h:
3128         * rendering/InlineFlowBox.cpp:
3129         * rendering/InlineFlowBox.h:
3130         * rendering/InlineTextBox.cpp:
3131         * rendering/InlineTextBox.h:
3132         * rendering/RootInlineBox.cpp:
3133         * rendering/RootInlineBox.h:
3134         * rendering/TrailingFloatsRootInlineBox.h:
3135         * rendering/svg/SVGInlineFlowBox.cpp:
3136         * rendering/svg/SVGInlineFlowBox.h:
3137         * rendering/svg/SVGInlineTextBox.cpp:
3138         * rendering/svg/SVGInlineTextBox.h:
3139         * rendering/svg/SVGRootInlineBox.cpp:
3140         * rendering/svg/SVGRootInlineBox.h:
3141
3142 2017-12-08  Chris Dumez  <cdumez@apple.com>
3143
3144         Clearing all Website Data should remove service worker registrations on disk
3145         https://bugs.webkit.org/show_bug.cgi?id=180558
3146
3147         Reviewed by Youenn Fablet.
3148
3149         Clear service worker registrations on disk in addition to the ones in memory.
3150
3151         * workers/service/server/RegistrationDatabase.cpp:
3152         (WebCore::v1RecordsTableSchema):
3153         (WebCore::v1RecordsTableSchemaAlternate):
3154         (WebCore::databaseFilename):
3155         Make sure these always get called from the background thread since they use
3156         a static string.
3157
3158         (WebCore::RegistrationDatabase::RegistrationDatabase):
3159         Call importRecordsIfNecessary() instead of openSQLiteDatabase(). importRecordsIfNecessary()
3160         only calls openSQLiteDatabase() if the database file exists, to avoid creating a database
3161         file unnecessarily.
3162
3163         (WebCore::RegistrationDatabase::databasePath const):
3164         New method which returns the database file path.
3165
3166         (WebCore::RegistrationDatabase::openSQLiteDatabase):
3167
3168         (WebCore::RegistrationDatabase::importRecordsIfNecessary):
3169         New methods which imports records if the database file exist. It the database file does
3170         not exist, it does not create it.
3171
3172         (WebCore::RegistrationDatabase::pushChanges):
3173         Call completion handler when changes are pushed.
3174
3175         (WebCore::RegistrationDatabase::clearAll):
3176         Close the database if it is open, then remove the database files.
3177
3178         (WebCore::RegistrationDatabase::doPushChanges):
3179         If the database is not already open, we now open it when trying to write changes for
3180         the first time.
3181
3182         * workers/service/server/RegistrationDatabase.h:
3183         * workers/service/server/RegistrationStore.cpp:
3184         (WebCore::RegistrationStore::clearAll):
3185         (WebCore::RegistrationStore::flushChanges):
3186         * workers/service/server/RegistrationStore.h:
3187
3188         * workers/service/server/SWServer.cpp:
3189         (WebCore::SWServer::clearAll):
3190         (WebCore::SWServer::clear):
3191         Also clear the database.
3192
3193         * workers/service/server/SWServer.h:
3194
3195         * workers/service/server/SWServerWorker.cpp:
3196         (WebCore::SWServerWorker::terminate):
3197         Only call SWServer::terminateWorker() if the worker is running. Otherwise, we hit
3198         an assertion when clearing a registration would worker was already terminated.
3199
3200 2017-12-08  Joseph Pecoraro  <pecoraro@apple.com>
3201
3202         ServiceWorker Inspector: Various issues inspecting service worker on mobile.twitter.com
3203         https://bugs.webkit.org/show_bug.cgi?id=180520
3204         <rdar://problem/35900764>
3205
3206         Reviewed by Brian Burg.
3207
3208         * inspector/agents/worker/ServiceWorkerAgent.cpp:
3209         (WebCore::ServiceWorkerAgent::getInitializationInfo):
3210         * inspector/agents/worker/ServiceWorkerAgent.h:
3211         Add initial script content to initialization so we always at least have main resource content.
3212
3213 2017-12-08  Joseph Pecoraro  <pecoraro@apple.com>
3214
3215         ServiceWorker Inspector: Should be able to see image content from CacheStorage.add(url) network request
3216         https://bugs.webkit.org/show_bug.cgi?id=180506
3217
3218         Reviewed by Brian Burg.
3219
3220         No test as this only happens inside a ServiceWorker inspector which
3221         we don't yet have a way to test. In a Page Inspector, the
3222         CacheStorage.add network request already behaves as expected.
3223
3224         * inspector/NetworkResourcesData.cpp:
3225         (WebCore::NetworkResourcesData::responseReceived):
3226         (WebCore::shouldBufferResourceData):
3227         * inspector/NetworkResourcesData.h:
3228         (WebCore::NetworkResourcesData::ResourceData::forceBufferData const):
3229         (WebCore::NetworkResourcesData::ResourceData::setForceBufferData):
3230         Provide a way to force buffering in NetworkResourceData.
3231
3232         * inspector/agents/InspectorNetworkAgent.cpp:
3233         (WebCore::InspectorNetworkAgent::didReceiveResponse):
3234         * inspector/agents/InspectorNetworkAgent.h:
3235         * inspector/agents/page/PageNetworkAgent.h:
3236         * inspector/agents/worker/WorkerNetworkAgent.h:
3237         Enable force buffering in a Worker Network Agent.
3238
3239 2017-12-08  Daniel Bates  <dabates@apple.com>
3240
3241         Remove unnecessary prefix from AutoFillButtonType enumerators
3242         https://bugs.webkit.org/show_bug.cgi?id=180512
3243
3244         Reviewed by Tim Horton.
3245
3246         * testing/Internals.cpp:
3247         (WebCore::toAutoFillButtonType):
3248         * testing/Internals.h:
3249         * testing/Internals.idl:
3250
3251 2017-12-08  Dean Jackson  <dino@apple.com>
3252
3253         Implement transferToImageBitmap for WebGL offscreen canvas objects
3254         https://bugs.webkit.org/show_bug.cgi?id=180603
3255         <rdar://problem/34147143>
3256
3257         Reviewed by Sam Weinig.
3258
3259         Implement the basic version of creating an ImageBitmap from an
3260         OffscreenCanvas that is using a WebGL context.
3261
3262         Tests: http/wpt/offscreen-canvas/transferToImageBitmap-empty.html
3263                http/wpt/offscreen-canvas/transferToImageBitmap-webgl.html
3264
3265         * html/ImageBitmap.cpp:
3266         (WebCore::ImageBitmap::create): Add a new constructor to be used by OffscreenCanvas.
3267         Creates a blank ImageBitmap.
3268         * html/ImageBitmap.h:
3269
3270         * html/OffscreenCanvas.cpp:
3271         (WebCore::OffscreenCanvas::transferToImageBitmap): Create a new ImageBitmap
3272         and paint the current canvas into it.
3273
3274 2017-12-08  Youenn Fablet  <youenn@apple.com>
3275
3276         WebServiceWorkerProvider should use Cancellation error to notify DTL that it cannot handle a fetch
3277         https://bugs.webkit.org/show_bug.cgi?id=180584
3278
3279         Reviewed by Alex Christensen.
3280
3281         Previously, for each cross origin fetch that is going through a service worker and service worker is not handling the fetch,
3282         we return an AccessControl error so that DocumentThreadableLoader will do preflight and regular load through the network.
3283         This error is wrongly logged in the Inspector.
3284         Change error type to Cancellation so that the Inspector does not log it.
3285
3286         * loader/DocumentThreadableLoader.cpp:
3287         (WebCore::DocumentThreadableLoader::didFail):
3288
3289 2017-12-08  Youenn Fablet  <youenn@apple.com>
3290
3291         Service Worker should use a correct SessionID
3292         https://bugs.webkit.org/show_bug.cgi?id=180585
3293
3294         Reviewed by Alex Christensen.
3295
3296         Test: http/tests/workers/service/serviceworker-private-browsing.https.html
3297
3298         Store SessionID in SWServer and send it as part of service worker instantiation.
3299
3300         * workers/service/server/SWServer.cpp:
3301         (WebCore::SWServer::SWServer):
3302         (WebCore::SWServer::installContextData):
3303         (WebCore::SWServer::runServiceWorker):
3304         * workers/service/server/SWServer.h:
3305         * workers/service/server/SWServerToContextConnection.h:
3306
3307 2017-12-08  Youenn Fablet  <youenn@apple.com>
3308
3309         FetchResponse should keep unfiltered ResourceResponse so that it can be used in Service Worker
3310         https://bugs.webkit.org/show_bug.cgi?id=179641
3311         <rdar://problem/35923570>
3312
3313         Reviewed by Alex Christensen.
3314
3315         Covered by existing rebased tests.
3316
3317         FetchResponse will now store an unfiltered response.
3318         If it needs to expose it to JavaScript, it will create a filtered response lazily.
3319         This allows service worker to send back to web pages, opaque responses containing every information.
3320
3321         Updating Document::initSecurityContext so that any document loaded with a response whose tainting is Opaque gets a unique origin.
3322         This ensures cross-origin checks to work if service worker returns such a response on a same origin URL.
3323
3324         Updated SubresourceLoader to check cross origin service worker responses based on their tainting.
3325
3326         * Modules/fetch/FetchResponse.cpp:
3327         (WebCore::FetchResponse::create):
3328         (WebCore::FetchResponse::error):
3329         (WebCore::FetchResponse::redirect):
3330         (WebCore::FetchResponse::FetchResponse):
3331         (WebCore::FetchResponse::clone):
3332         (WebCore::FetchResponse::url const):
3333         (WebCore::FetchResponse::filteredResponse const):
3334         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
3335         (WebCore::FetchResponse::resourceResponse const):
3336         * Modules/fetch/FetchResponse.h:
3337         (WebCore::FetchResponse::create): Deleted.
3338         * dom/Document.cpp:
3339         (WebCore::Document::initSecurityContext):
3340         * loader/SubresourceLoader.cpp:
3341         (WebCore::SubresourceLoader::willSendRequestInternal):
3342         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
3343
3344 2017-12-08  David Quesada  <david_quesada@apple.com>
3345
3346         ApplicationManifestParser should strip whitespace from the raw input
3347         https://bugs.webkit.org/show_bug.cgi?id=180539
3348         rdar://problem/35915075
3349
3350         Reviewed by Joseph Pecoraro.
3351
3352         * Modules/applicationmanifest/ApplicationManifestParser.cpp:
3353         (WebCore::ApplicationManifestParser::parseManifest):
3354
3355 2017-12-08  Eric Carlson  <eric.carlson@apple.com>
3356
3357         Move Logger from PAL to WTF so it can be used outside of WebCore
3358         https://bugs.webkit.org/show_bug.cgi?id=180561
3359
3360         Reviewed by Alex Christensen.
3361
3362         No new tests, existing API test updated.
3363
3364         * Modules/mediastream/PeerConnectionBackend.h:
3365         * Modules/mediastream/RTCPeerConnection.h:
3366         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
3367         (PAL::LogArgument<webrtc::RTCStats>::toString): Deleted.
3368         * dom/Document.cpp:
3369         * dom/Document.h:
3370         * html/HTMLMediaElement.cpp:
3371         (PAL::LogArgument<WebCore::URL>::toString): Deleted.
3372         * html/HTMLMediaElement.h:
3373         * html/HTMLMediaElementEnums.h:
3374         (PAL::LogArgument<WebCore::HTMLMediaElementEnums::ReadyState>::toString): Deleted.
3375         (PAL::LogArgument<WebCore::HTMLMediaElementEnums::NetworkState>::toString): Deleted.
3376         * html/MediaElementSession.cpp:
3377         (WebCore::MediaElementSession::logger const):
3378         * html/MediaElementSession.h:
3379         * html/track/DataCue.h:
3380         (PAL::LogArgument<WebCore::DataCue>::toString): Deleted.
3381         * html/track/TextTrackCue.h:
3382         (PAL::LogArgument<WebCore::TextTrackCue>::toString): Deleted.
3383         * html/track/TextTrackCueGeneric.h:
3384         (PAL::LogArgument<WebCore::TextTrackCueGeneric>::toString): Deleted.
3385         * html/track/TrackBase.cpp:
3386         (WebCore::nullLogger):
3387         (WebCore::TrackBase::TrackBase):
3388         * html/track/TrackBase.h:
3389         * html/track/VTTCue.h:
3390         (PAL::LogArgument<WebCore::VTTCue>::toString): Deleted.
3391         * platform/graphics/InbandTextTrackPrivate.h:
3392         * platform/graphics/InbandTextTrackPrivateClient.h:
3393         (PAL::LogArgument<WebCore::GenericCueData>::toString): Deleted.
3394         * platform/graphics/MediaPlayer.cpp:
3395         (WebCore::nullLogger):
3396         (WebCore::MediaPlayer::mediaPlayerLogger):
3397         * platform/graphics/MediaPlayer.h:
3398         (WTF::LogArgument<MediaTime>::toString):
3399         (PAL::LogArgument<WTF::MediaTime>::toString): Deleted.
3400         * platform/graphics/MediaPlayerEnums.h:
3401         (PAL::LogArgument<WebCore::MediaPlayerEnums::ReadyState>::toString): Deleted.
3402         (PAL::LogArgument<WebCore::MediaPlayerEnums::NetworkState>::toString): Deleted.
3403         * platform/graphics/TrackPrivateBase.cpp:
3404         (WebCore::TrackPrivateBase::setLogger):
3405         * platform/graphics/TrackPrivateBase.h:
3406         * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
3407         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
3408         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
3409         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3410         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
3411         * platform/mediastream/RTCIceConnectionState.h:
3412         (PAL::LogArgument<WebCore::RTCIceConnectionState>::toString): Deleted.
3413         * platform/mediastream/RTCIceGatheringState.h:
3414         (PAL::LogArgument<WebCore::RTCIceGatheringState>::toString): Deleted.
3415         * platform/mediastream/RTCPeerConnectionState.h:
3416         (PAL::LogArgument<WebCore::RTCPeerConnectionState>::toString): Deleted.
3417         * platform/mediastream/RTCSignalingState.h:
3418         (PAL::LogArgument<WebCore::RTCSignalingState>::toString): Deleted.
3419         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3420
3421 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
3422
3423         Remove pthread_once in favor of dispatch_once
3424         https://bugs.webkit.org/show_bug.cgi?id=180591
3425
3426         Reviewed by Saam Barati.
3427
3428         No behavior change.
3429
3430         * platform/mac/WebCoreNSURLExtras.mm:
3431         (WebCore::allCharactersInIDNScriptWhiteList):
3432         (WebCore::readIDNScriptWhiteList): Deleted.
3433
3434 2017-12-08  Chris Dumez  <cdumez@apple.com>
<