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