AudioBufferSourceNode start method causes OfflineAudioContext to start running
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-04-02  Jer Noble  <jer.noble@apple.com>
2
3         AudioBufferSourceNode start method causes OfflineAudioContext to start running
4         https://bugs.webkit.org/show_bug.cgi?id=181939
5         <rdar://problem/36755393>
6
7         Reviewed by Eric Carlson.
8
9         Test: webaudio/offlineaudiocontext-restriction.html
10
11         Don't respect playback restrictions for offline AudioContexts.
12
13         * Modules/webaudio/AudioContext.cpp:
14         (WebCore::AudioContext::constructCommon):
15         * Modules/webaudio/AudioContext.h:
16         (WebCore::AudioContext::isOfflineContext const):
17         (WebCore::AudioContext::userGestureRequiredForAudioStart const):
18         (WebCore::AudioContext::pageConsentRequiredForAudioStart const):
19         (WebCore::AudioContext::isOfflineContext): Deleted.
20
21 2018-04-02  Alejandro G. Castro  <alex@igalia.com>
22
23         [GTK] Make libwebrtc backend buildable for GTK  port
24         https://bugs.webkit.org/show_bug.cgi?id=178860
25
26         Reviewed by Youenn Fablet.
27
28         This is the first step to add webrtc support to the GTK port using
29         the libwebrtc backend.
30
31         No new tests, no new feature added, it should be tested by current
32         tests.
33
34         * CMakeLists.txt: Add the new files to the compilation and set the
35         new includes in the libwebrtc library.
36         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
37         Reorder the includes alphabetically and add some that are missing.
38         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
39         Ditto.
40         * Sources.txt: Add new file to the compilation.
41         * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp:
42         Added. Initial implementation for GTK and WPE.
43         * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.h:
44         Added. Ditto.
45         * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp:
46         Added. Ditto.
47         * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h:
48         Added. Ditto.
49         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
50         Added. Ditto.
51         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h:
52         Added. Ditto.
53         * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp:
54         Added. Ditto.
55         * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.h:
56         Added. Ditto.
57         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp: Added includes
58         for the compilation.
59         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.h: Added, inherit from
60         the LibWebRTCProvider to adapt for glib.
61
62 2018-04-01  Yusuke Suzuki  <utatane.tea@gmail.com>
63
64         Use WTF::Lock instead of GMutex
65         https://bugs.webkit.org/show_bug.cgi?id=184227
66
67         Reviewed by Saam Barati.
68
69         Prefer WTF::Lock over GMutex since these locks are just protecting WebKit C++ fields.
70
71         No behavior change.
72
73         * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
74         (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
75         (WebCore::AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer):
76         (WebCore::AudioSourceProviderGStreamer::provideInput):
77         (WebCore::AudioSourceProviderGStreamer::handleAudioBuffer):
78         (WebCore::AudioSourceProviderGStreamer::clearAdapters):
79         * platform/audio/gstreamer/AudioSourceProviderGStreamer.h:
80         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
81         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
82         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
83         (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const):
84         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
85         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
86         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
87         (WebCore::MediaPlayerPrivateGStreamerBase::paint):
88         (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture):
89         (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
90         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
91         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
92         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
93
94 2018-03-31  Brent Fulgham  <bfulgham@apple.com>
95
96         Show punycode if URL contains hyphen character
97         https://bugs.webkit.org/show_bug.cgi?id=184221
98         <rdar://problem/38044633>
99
100         Reviewed by Darin Adler.
101
102         Revise our "lookalike character" logic to include the hyphen,
103         non-breaking hyphen, and minus sign.
104
105         Test: fast/url/host.html
106
107         * platform/mac/WebCoreNSURLExtras.mm:
108         (WebCore::isLookalikeCharacter):
109
110 2018-03-31  Filip Pizlo  <fpizlo@apple.com>
111
112         JSObject shouldn't do index masking
113         https://bugs.webkit.org/show_bug.cgi?id=184194
114
115         Reviewed by Yusuke Suzuki.
116
117         No new tests because no new behavior.
118
119         * bindings/js/JSDOMConvertSequences.h:
120         (WebCore::Detail::NumericSequenceConverter::convertArray):
121         (WebCore::Detail::SequenceConverter::convertArray):
122
123 2018-03-30  Chris Dumez  <cdumez@apple.com>
124
125         REGRESSION (r229828): Facebook login popup is blank
126         https://bugs.webkit.org/show_bug.cgi?id=184206
127         <rdar://problem/39057006>
128
129         Reviewed by Wenson Hsieh.
130
131         Since r229828, we freeze the layer tree during the navigation policy check.
132         We freeze in WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction()
133         and unfreeze in WebFrameLoaderClient::didDecidePolicyForNavigationAction().
134
135         WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction() gets called
136         from PolicyChecker::checkNavigationPolicy() which has 3 call sites in
137         FrameLoader and one in DocumentLoader for redirects. The call sites in
138         FrameLoader were taking care of calling didDecidePolicyForNavigationAction()
139         on the FrameLoaderClient in their completion handler, but the DocumentLoader
140         call site was failing to do so. As a result, the layer tree would stay frozen.
141
142         To make this a lot less error prone, I moved the call to
143         WebFrameLoaderClient::didDecidePolicyForNavigationAction() to
144         PolicyChecker::checkNavigationPolicy(), inside the completion handler passed
145         to WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(). This way,
146         even if new code starts calling PolicyChecker::checkNavigationPolicy(), we
147         do not need to worry about letting the client know when the policy decision
148         is made.
149
150         No new tests, covered by existing redirection tests with the
151         new assertion I added.
152
153         * loader/FrameLoader.cpp:
154         (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy):
155         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
156         * loader/PolicyChecker.cpp:
157         (WebCore::PolicyChecker::checkNavigationPolicy):
158
159 2018-03-30  Devin Rousso  <webkit@devinrousso.com>
160
161         Web Inspector: tint all pixels drawn by shader program when hovering ShaderProgramTreeElement
162         https://bugs.webkit.org/show_bug.cgi?id=175223
163
164         Reviewed by Matt Baker.
165
166         Test: inspector/canvas/setShaderProgramHighlighted.html
167
168         * html/canvas/InspectorShaderProgram.h:
169         (WebCore::InspectorShaderProgram::highlighted):
170         (WebCore::InspectorShaderProgram::setHighlighted):
171
172         * html/canvas/WebGLRenderingContextBase.cpp:
173         (WebCore::InspectorScopedShaderProgramHighlight::InspectorScopedShaderProgramHighlight):
174         (WebCore::InspectorScopedShaderProgramHighlight::~InspectorScopedShaderProgramHighlight):
175         (WebCore::InspectorScopedShaderProgramHighlight::showHighlight):
176         (WebCore::InspectorScopedShaderProgramHighlight::hideHighlight):
177         (WebCore::InspectorScopedShaderProgramHighlight::saveBlendValue):
178         (WebCore::InspectorScopedShaderProgramHighlight::hasBufferBinding):
179         (WebCore::InspectorScopedShaderProgramHighlight::hasFramebufferParameterAttachment):
180         (WebCore::WebGLRenderingContextBase::drawArrays):
181         (WebCore::WebGLRenderingContextBase::drawElements):
182         If the current shader program has been marked as highlighted, apply a blend right before
183         `drawArrays` and `drawElements` is called, tinting the resulting pixels so that they are
184         visually distinguished from pixels drawn by other shader programs.
185
186         * inspector/InspectorCanvasAgent.h:
187         * inspector/InspectorCanvasAgent.cpp:
188         (WebCore::InspectorCanvasAgent::setShaderProgramHighlighted):
189         (WebCore::InspectorCanvasAgent::isShaderProgramHighlighted):
190
191         * inspector/InspectorInstrumentation.h:
192         * inspector/InspectorInstrumentation.cpp:
193         (WebCore::InspectorInstrumentation::isShaderProgramHighlighted):
194         (WebCore::InspectorInstrumentation::isShaderProgramHighlightedImpl):
195
196 2018-03-30  Wenson Hsieh  <wenson_hsieh@apple.com>
197
198         [Extra zoom mode] Adopt list view controller UI for numeric input types
199         https://bugs.webkit.org/show_bug.cgi?id=184184
200         <rdar://problem/37238916>
201
202         Reviewed by Timothy Hatcher.
203
204         Add a localized string for the OK button shown on number pads in extra zoomed form controls.
205
206         * English.lproj/Localizable.strings:
207         * platform/LocalizedStrings.cpp:
208         (WebCore::numberPadOKButtonTitle):
209         * platform/LocalizedStrings.h:
210
211 2018-03-30  Ryosuke Niwa  <rniwa@webkit.org>
212
213         Copying a list from Microsoft Word to TinyMCE fails when mso-list is the first property
214         https://bugs.webkit.org/show_bug.cgi?id=182938
215         <rdar://problem/37683007>
216
217         Reviewed by Wenson Hsieh.
218
219         Made the logic to detect Microsoft Word's mso-list CSS property more generic by detecting
220         inline styles which start with "mso-list:" and one which line-break right before it: "\nmso-list:"
221
222         Tests: PasteHTML.PreservesMSOList
223
224         * editing/markup.cpp:
225         (WebCore::StyledMarkupAccumulator::shouldPreserveMSOListStyleForElement):
226
227 2018-03-30  Youenn Fablet  <youenn@apple.com>
228
229         NetworkLoadChecker should upgrade redirects if needed
230         https://bugs.webkit.org/show_bug.cgi?id=184098
231
232         Reviewed by Chris Dumez.
233
234         Test: imported/w3c/web-platform-tests/beacon/upgrade-beacon.https.html
235
236         * page/csp/ContentSecurityPolicy.h:
237
238 2018-03-30  Daniel Bates  <dabates@apple.com>
239
240         ASSERTION FAILED: ASSERT(!containsImage || MIMETypeRegistry::isSupportedImageResourceMIMEType([resource MIMEType])) in -[NSPasteboard(WebExtras) _web_writePromisedRTFDFromArchive:containsImage:]
241         https://bugs.webkit.org/show_bug.cgi?id=184161
242
243         Reviewed by Per Arne Vollan.
244
245         Fixes an assertion failure when quiting an app that uses a Legacy WebKit web view
246         after dragging-and-dropping a PDF embedded using an HTML image element into the
247         same web view.
248
249         When performing a drag-and-drop of a PDF document image (WebCore::PDFDocumentImage) we create a WebArchive
250         from the main frame's WebHTMLView and promise AppKit that will provide a Rich Text Format (RTF) document
251         from this archive if needed. For some reason, on app termination AppKit requests that the WebHTMLView
252         fullfill its RTF document promise for the WebArchive created at the start of the drag operation. WebKit
253         expects that the created WebArchive is either for an inline image (e.g. <img>) or an image document that
254         has a supported image resource MIME type (by querying MIMETypeRegistry::isSupportedImageResourceMIMEType())
255         and checks for these cases in this order. PDF/PostScript are not listed in the set of supported image
256         resource MIME types. So, the first check fails and WebKit assumes that the WebArchive was created from
257         an image document of a supported image resource MIME type. However, the WebArchive was created from a
258         WebHTMLView and has MIME type text/html. Therefore the assertion fails. We need to add PDF and PostScript
259         to the set of supported image resource MIME types so that WebKit does not fall back to the WebHTMLView
260         code path. Historically, PDF and PostScript were in the set supported image resource MIME types. Over time
261         the set of MIME types for image resouces (images loaded as a document) became identical to the set of MIME
262         types for images loaded inline (e.g. <img>) and this set omitted the MIME types for PDF and PostScript.
263
264         Additionally it is sufficient to implement MIMETypeRegistry::isSupportedImageResourceMIMEType() in terms
265         of MIMETypeRegistry::isSupportedImageMIMEType() and MIMETypeRegistry::isPDFOrPostScriptMIMEType() instead
266         of allocating a dedicated HashSet for the supported image resource MIME types (as we currently do).
267
268         * dom/DOMImplementation.cpp:
269         (WebCore::DOMImplementation::createDocument): Assert that PDF is a supported image MIME type before
270         instantiating an ImageDocument.
271         * platform/MIMETypeRegistry.cpp:
272         (WebCore::initializeSupportedImageMIMETypes): Remove unnecessary allocation of a HashSet for the support
273         image resource MIME types.
274         (WebCore::MIMETypeRegistry::isSupportedImageResourceMIMEType): Write in terms of MIMETypeRegistry::isSupportedImageMIMEType()
275         and MIMETypeRegistry::isPDFOrPostScriptMIMEType().
276         (WebCore::MIMETypeRegistry::getSupportedImageResourceMIMETypes): Deleted.
277         * platform/MIMETypeRegistry.h:
278
279 2018-03-29  Antoine Quint  <graouts@apple.com>
280
281         [Web Animations] CSSTransition objects should have fill: backwards to allow seeking prior to start time
282         https://bugs.webkit.org/show_bug.cgi?id=184129
283
284         Reviewed by Dean Jackson.
285
286         In order to allow a CSS Transition to be seeked prior to its start time, it needs to have its fill mode set
287         to backwards. Adding code to set the fill mode in CSSTransition::initialize() yields early timing model
288         invalidation and we could get in a situation where stylesWouldYieldNewCSSTransitionsBlendingKeyframes()
289         was called before we had a chance to create blending keyframes for a CSS transitions, since the call
290         to create blending keyframes is made after the call to initialize(), so we now cater for this case.
291
292         * animation/CSSTransition.cpp:
293         (WebCore::CSSTransition::initialize):
294         * animation/CSSTransition.h:
295         * animation/KeyframeEffectReadOnly.cpp:
296         (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const):
297
298 2018-03-30  Daniel Bates  <dabates@apple.com>
299
300         Remove unused MIMETypeRegistry::getSupportedImageMIMETypesForEncoding()
301         https://bugs.webkit.org/show_bug.cgi?id=184154
302
303         Reviewed by Per Arne Vollan.
304
305         * platform/MIMETypeRegistry.cpp:
306         (WebCore::MIMETypeRegistry::getSupportedImageMIMETypesForEncoding): Deleted.
307         * platform/MIMETypeRegistry.h:
308
309 2018-03-30  Ryan Haddad  <ryanhaddad@apple.com>
310
311         Unreviewed, rolling out r230102.
312
313         Caused assertion failures on JSC bots.
314
315         Reverted changeset:
316
317         "A stack overflow in the parsing of a builtin (called by
318         createExecutable) cause a crash instead of a catchable js
319         exception"
320         https://bugs.webkit.org/show_bug.cgi?id=184074
321         https://trac.webkit.org/changeset/230102
322
323 2018-03-30  Robin Morisset  <rmorisset@apple.com>
324
325         A stack overflow in the parsing of a builtin (called by createExecutable) cause a crash instead of a catchable js exception
326         https://bugs.webkit.org/show_bug.cgi?id=184074
327         <rdar://problem/37165897>
328
329         Reviewed by Keith Miller.
330
331         I had to slightly change the type of some bindings between JSC and WebCore. No functional change intended on the WebCore side.
332
333         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
334         (WebCore::JSBuiltinReadableStreamDefaultReaderPrivateConstructor::initializeExecutable):
335         (WebCore::JSBuiltinReadableStreamDefaultControllerPrivateConstructor::initializeExecutable):
336         (WebCore::JSBuiltinReadableByteStreamControllerPrivateConstructor::initializeExecutable):
337         (WebCore::JSBuiltinReadableStreamBYOBReaderPrivateConstructor::initializeExecutable):
338         (WebCore::JSBuiltinReadableStreamBYOBRequestPrivateConstructor::initializeExecutable):
339         * bindings/scripts/CodeGeneratorJS.pm:
340         (GenerateConstructorHelperMethods):
341         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
342         (WebCore::JSTestClassWithJSBuiltinConstructorConstructor::initializeExecutable):
343         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
344         (WebCore::JSTestJSBuiltinConstructorConstructor::initializeExecutable):
345
346 2018-03-29  Antoine Quint  <graouts@apple.com>
347
348         [Web Animations] Correctly obtain the timing function for a given keyframe
349         https://bugs.webkit.org/show_bug.cgi?id=184146
350
351         Reviewed by Dean Jackson.
352
353         The way we would get the timing function for a given KeyframeValue stored in a KeyframeList was really suboptimal.
354         When keyframes were created, we would set the animated element's style on each keyframe, and set keyframe-specific
355         properties and values on top. When figuring out the timing function for a KeyframeValue, we would look at its render
356         style, go through its list of animations, which could include animations that are irrelevant to this specific keyframe
357         list since all animations from the animated element are referenced, and we would have to look up the correct animation
358         by name and get the timing function, even though the timing function stored on the animation was now specific to this
359         particular keyframe.
360
361         We now simply set a m_timingFunction member on a KeyframeValue, which is null if no explicit animation-timing-function
362         was provided for this keyframe in CSS, and otherwise set to a valid TimingFunction.
363
364         This fixes our behavior for a 4 existing animation tests when opted into the CSS Animations and CSS Transitions as
365         Web Animations feature.
366
367         * animation/KeyframeEffectReadOnly.cpp:
368         (WebCore::KeyframeEffectReadOnly::timingFunctionForKeyframeAtIndex):
369         * css/StyleResolver.cpp:
370         (WebCore::StyleResolver::keyframeStylesForAnimation):
371         * page/animation/KeyframeAnimation.cpp:
372         (WebCore::KeyframeAnimation::fetchIntervalEndpointsForProperty const):
373         * platform/animation/TimingFunction.cpp:
374         (WebCore::TimingFunction::createFromCSSText):
375         (WebCore::TimingFunction::createFromCSSValue):
376         * platform/animation/TimingFunction.h:
377         * rendering/RenderLayerBacking.cpp:
378         (WebCore::RenderLayerBacking::startAnimation):
379         * rendering/style/KeyframeList.cpp:
380         (WebCore::KeyframeValue::timingFunction const): Deleted.
381         * rendering/style/KeyframeList.h:
382         (WebCore::KeyframeValue::timingFunction const):
383         (WebCore::KeyframeValue::setTimingFunction):
384
385 2018-03-29  Ryosuke Niwa  <rniwa@webkit.org>
386
387         Copying a list from Microsoft Word to TinyMCE fails when mso-list is on tags other than P
388         https://bugs.webkit.org/show_bug.cgi?id=182954
389         <rdar://problem/37713141>
390
391         Reviewed by Wenson Hsieh.
392
393         Fixed the bug by relaxing the restriction that we only preserve mso-list on p.
394
395         Tests: PasteHTML.PreservesMSOListOnH4
396
397         * editing/markup.cpp:
398         (WebCore::StyledMarkupAccumulator::shouldPreserveMSOListStyleForElement):
399
400 2018-03-29  JF Bastien  <jfbastien@apple.com>
401
402         Use Forward.h instead of forward-declaring WTF::String
403         https://bugs.webkit.org/show_bug.cgi?id=184172
404         <rdar://problem/39026146>
405
406         Reviewed by Yusuke Suzuki.
407
408         As part of #184164 I'm changing WTF::String, and the forward
409         declarations are just wrong because I'm making it templated. We
410         should use Forward.h anyways, so do that instead.
411
412         * css/makeprop.pl:
413         * platform/cocoa/PlaybackSessionInterface.h:
414         * platform/ios/Device.h:
415         * platform/ios/PlaybackSessionInterfaceAVKit.h:
416         * platform/ios/VideoFullscreenInterfaceAVKit.h:
417         * platform/win/PathWalker.h:
418         * testing/js/WebCoreTestSupport.h:
419
420 2018-03-29  Ross Kirsling  <ross.kirsling@sony.com>
421
422         MSVC __forceinline slows down JSC release build fivefold after r229391
423         https://bugs.webkit.org/show_bug.cgi?id=184062
424
425         Reviewed by Alex Christensen.
426
427         * platform/graphics/FormatConverter.cpp:
428         Factor ALWAYS_INLINE_EXCEPT_MSVC out to WTF.
429
430 2018-03-29  Ryan Haddad  <ryanhaddad@apple.com>
431
432         Unreviewed, rolling out r230087.
433
434         Introduced LayoutTest failures.
435
436         Reverted changeset:
437
438         "FrameSelection::appearanceUpdateTimerFired should be robust
439         against layout passes underneath it"
440         https://bugs.webkit.org/show_bug.cgi?id=183395
441         https://trac.webkit.org/changeset/230087
442
443 2018-03-29  Wenson Hsieh  <wenson_hsieh@apple.com>
444
445         FrameSelection::appearanceUpdateTimerFired should be robust against layout passes underneath it
446         https://bugs.webkit.org/show_bug.cgi?id=183395
447         <rdar://problem/38055732>
448
449         Reviewed by Zalan Bujtas.
450
451         In the case where a FrameSelection updates its appearance when m_appearanceUpdateTimer is fired, the
452         FrameSelection's Frame is unprotected, and can be removed by arbitrary script. This patch applies a simple
453         mitigation by wrapping the Frame in a Ref when firing the appearance update timer, and ensuring that layout is
454         really up to date before calling updateAppearanceAfterLayoutOrStyleChange() from the timer.
455
456         Test: editing/selection/iframe-update-selection-appearance.html
457
458         * editing/FrameSelection.cpp:
459         (WebCore::FrameSelection::appearanceUpdateTimerFired):
460
461 2018-03-29  Daniel Bates  <dabates@apple.com>
462
463         Substitute ArchiveFactory::isArchiveMIMEType() for ArchiveFactory::isArchiveMimeType().
464
465         * loader/DocumentLoader.cpp:
466         (WebCore::DocumentLoader::commitLoad):
467         * loader/archive/ArchiveFactory.cpp:
468         (WebCore::ArchiveFactory::isArchiveMIMEType):
469         (WebCore::ArchiveFactory::isArchiveMimeType): Deleted.
470         * loader/archive/ArchiveFactory.h:
471         * platform/MIMETypeRegistry.h:
472
473 2018-03-29  Daniel Bates  <dabates@apple.com>
474
475         MIMETypeRegistry should return const HashSets
476         https://bugs.webkit.org/show_bug.cgi?id=184150
477
478         Reviewed by Per Arne Vollan.
479
480         Only getSupportedNonImageMIMETypes() needs to return a non-const HashSet so that
481         LegacyWebKit can modify the set of non-image MIME types.
482
483         * platform/MIMETypeRegistry.cpp:
484         (WebCore::MIMETypeRegistry::getSupportedImageMIMETypes):
485         (WebCore::MIMETypeRegistry::getSupportedImageResourceMIMETypes):
486         (WebCore::MIMETypeRegistry::getSupportedImageMIMETypesForEncoding):
487         (WebCore::MIMETypeRegistry::getSupportedMediaMIMETypes):
488         (WebCore::MIMETypeRegistry::getPDFMIMETypes):
489         (WebCore::MIMETypeRegistry::getUnsupportedTextMIMETypes):
490         * platform/MIMETypeRegistry.h:
491
492 2018-03-29  Brady Eidson  <beidson@apple.com>
493
494         Update Service Worker feature status.
495         https://bugs.webkit.org/show_bug.cgi?id=184139
496
497         Reviewed by Chris Dumez.
498
499         * features.json:
500
501 2018-03-29  Chris Dumez  <cdumez@apple.com>
502
503         Drop DOMWindow::frames() / DOMWindow::window() methods
504         https://bugs.webkit.org/show_bug.cgi?id=184112
505
506         Reviewed by Daniel Bates.
507
508         Drop DOMWindow::frames() / DOMWindow::window() methods as they are just aliases for DOMWindow::self().
509
510         * page/DOMWindow.h:
511         * page/DOMWindow.idl:
512
513 2018-03-29  Commit Queue  <commit-queue@webkit.org>
514
515         Unreviewed, rolling out r230062.
516         https://bugs.webkit.org/show_bug.cgi?id=184128
517
518         Broke mac port. web content process crashes while loading any
519         web page (Requested by rniwa on #webkit).
520
521         Reverted changeset:
522
523         "MSVC __forceinline slows down JSC release build fivefold
524         after r229391"
525         https://bugs.webkit.org/show_bug.cgi?id=184062
526         https://trac.webkit.org/changeset/230062
527
528 2018-03-28  Antoine Quint  <graouts@apple.com>
529
530         [Web Animations] Implement more CSSPropertyBlendingClient methods
531         https://bugs.webkit.org/show_bug.cgi?id=184077
532
533         Reviewed by Dean Jackson.
534
535         We only had stubs for several of the CSSPropertyBlendingClient methods and thus always implied that we
536         were animating non-matching transform, filter and backdrop-filter properties. We now implement those using
537         the same code used in KeyframeAnimation. This allows for 31 new tests to opt into the CSS Animations and
538         CSS Transitions as Web Animations feature.
539
540         We also ensure we only run a CSSAnimationController assertion in FrameView::didDestroyRenderTree() if
541         we're not using the CSS Animations and CSS Transitions as Web Animations feature.
542
543         * animation/KeyframeEffectReadOnly.cpp:
544         (WebCore::KeyframeEffectReadOnly::copyPropertiesFromSource):
545         (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes):
546         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
547         (WebCore::KeyframeEffectReadOnly::checkForMatchingTransformFunctionLists):
548         (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists):
549         (WebCore::KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists):
550         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes):
551         (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes):
552         * animation/KeyframeEffectReadOnly.h:
553         * page/FrameView.cpp:
554         (WebCore::FrameView::didDestroyRenderTree):
555
556 2018-03-28  Chris Dumez  <cdumez@apple.com>
557
558         Align XMLHttpRequest's open() / send() / abort() with the latest specification
559         https://bugs.webkit.org/show_bug.cgi?id=184108
560
561         Reviewed by Youenn Fablet.
562
563         Align XMLHttpRequest's open() / send() / abort() with the latest specification:
564         - https://xhr.spec.whatwg.org
565
566         No new tests, rebaselined existing layout tests.
567
568         * xml/XMLHttpRequest.cpp:
569         (WebCore::XMLHttpRequest::open):
570         Align with https://xhr.spec.whatwg.org/#the-open()-method:
571         - Change the order of some steps to match the order in the spec. In particular,
572           open() no longer resets the state to UNSENT or abort any existing load when it
573           fails early due to being passed a bad method.
574
575         (WebCore::XMLHttpRequest::createRequest):
576         Align with https://xhr.spec.whatwg.org/#the-send()-method:
577         - Use the simpler "upload listener flag" logic from the spec instead of our more
578           complex m_uploadEventsAllowed flag. This avoids constructing a SecurityOrigin
579           objects on a background thread when XHR is used inside Web Workers, which was
580           not thread-safe.
581         - Set the upload complete flag when the request has no body as per step 9.
582         - After firing the loadstartEvent, return early if the state is no longer OPEN or
583           if the send flag is unset, as per step 11.3.
584
585         (WebCore::XMLHttpRequest::abort):
586         Align with https://xhr.spec.whatwg.org/#the-abort()-method:
587         - Only set the state to UNSENT if the state is still DONE after firing the error
588           events, as per step 3.
589
590         (WebCore::XMLHttpRequest::didSendData):
591         Use new "upload listener flag".
592
593         (WebCore::XMLHttpRequest::dispatchErrorEvents):
594         Align with https://xhr.spec.whatwg.org/#request-error-steps:
595         - Stop firing a progress event in case of error as this is not as per specification
596           and Firefox does not fire those either.
597
598         * xml/XMLHttpRequest.h:
599
600 2018-03-28  Timothy Hatcher  <timothy@apple.com>
601
602         Consolidate NSColor to WebCore::Color conversion and fix system colors.
603
604         https://bugs.webkit.org/show_bug.cgi?id=184096
605         rdar://problem/38918925
606
607         Reviewed by Tim Horton.
608
609         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
610         (CreateCGColorIfDifferent): Use CGColor property on NSColor, don't manually create new CGColor.
611         * platform/graphics/mac/ColorMac.h:
612         * platform/graphics/mac/ColorMac.mm:
613         (WebCore::makeRGBAFromNSColor): Move pattern code from RenderThemeMac's convertNSColorToColor.
614         Also use nextafter for proper RGBA float conversion.
615         * platform/mac/PlatformPasteboardMac.mm:
616         (WebCore::PlatformPasteboard::color): Use colorFromNSColor.
617         * rendering/RenderThemeMac.mm:
618         (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const): Use colorFromNSColor.
619         (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const): Ditto.
620         (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const): Ditto.
621         (WebCore::RenderThemeMac::systemColor const): Ditto.
622         (WebCore::paintAttachmentTitleBackground): Ditto.
623         (WebCore::convertNSColorToColor): Deleted.
624
625 2018-03-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
626
627         The SVGAnimatedProperty wrappers have to be detached from the referenced values before the SVGAnimatedType is deleted
628         https://bugs.webkit.org/show_bug.cgi?id=183972
629
630         Reviewed by Daniel Bates.
631
632         If the SVGAnimatedType is a list type, e.g. SVGLengthListValues, the wrappers
633         of the animated properties have to be detached from the items in the list
634         before it's deleted.
635
636         * svg/SVGAnimateElementBase.cpp:
637         (WebCore::SVGAnimateElementBase::clearAnimatedType):
638
639 2018-03-28  Ross Kirsling  <ross.kirsling@sony.com>
640
641         MSVC __forceinline slows down JSC release build fivefold after r229391
642         https://bugs.webkit.org/show_bug.cgi?id=184062
643
644         Reviewed by Alex Christensen.
645
646         * platform/graphics/FormatConverter.cpp:
647         Factor ALWAYS_INLINE_EXCEPT_MSVC out to WTF.
648
649 2018-03-28  Zalan Bujtas  <zalan@apple.com>
650
651         Make it possible to override the screen size
652         https://bugs.webkit.org/show_bug.cgi?id=184111
653         <rdar://problem/38972181>
654
655         Reviewed by Tim Horton.
656
657         We just call screenSize() atm.
658
659         * page/Chrome.cpp:
660         (WebCore::Chrome::overrideScreenSize const):
661         * page/Chrome.h:
662         * page/ChromeClient.h:
663         * platform/HostWindow.h:
664         * platform/PlatformScreen.h:
665         * platform/ios/PlatformScreenIOS.mm:
666         (WebCore::screenRect):
667         (WebCore::overrideScreenSize):
668
669 2018-03-28  Timothy Hatcher  <timothy@apple.com>
670
671         Include the 'text' color keyword as a system color.
672
673         https://bugs.webkit.org/show_bug.cgi?id=184113
674         rdar://problem/38779267
675
676         Reviewed by Tim Horton.
677
678         * css/StyleColor.cpp:
679         (WebCore::StyleColor::isColorKeyword): Don't check CSSValueMenu, it is a system color and is included.
680         (WebCore::StyleColor::isSystemColor): Include CSSValueText. Check CSSValueWebkitFocusRingColor in the range,
681         since it is immediately after CSSValueAppleSystemYellow.
682
683 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
684
685         [iOS] Multiple select appearance doesn't update when selecting or deselecting rows in the picker view
686         https://bugs.webkit.org/show_bug.cgi?id=184110
687         <rdar://problem/38796648>
688
689         Reviewed by Tim Horton.
690
691         HTMLSelectElement::optionSelectedByUser is invoked upon user interaction with a select menu. This currently
692         takes two separate codepaths, depending on whether or not the menu list appearance is being used to render the
693         select. If a menu list appearance is used, we call selectOption(), which updates validity, updates the element
694         renderer, and then dispatches a `change` event if needed.
695
696         However, if updateSelectedState() is used, we only update form validity and then dispatch the `change` event
697         without updating the renderer, leaving it stale.
698
699         Test: fast/forms/ios/ipad/multiple-select-updates-renderer.html
700
701         * html/HTMLSelectElement.cpp:
702         (WebCore::HTMLSelectElement::optionSelectedByUser):
703
704         Update the renderer after updating the DOM to reflect the selected option.
705
706 2018-03-28  Daniel Bates  <dabates@apple.com>
707
708         Substitute "strong password confirmation auto fill" for "strong confirmation password auto fill"
709         <rdar://problem/36518856>
710
711         * English.lproj/Localizable.strings:
712         * platform/LocalizedStrings.cpp:
713         (WebCore::AXAutoFillStrongConfirmationPasswordLabel):
714
715 2018-03-28  Daniel Bates  <dabates@apple.com>
716
717         WebSocket cookie incorrectly stored
718         https://bugs.webkit.org/show_bug.cgi?id=184100
719         <rdar://problem/37928715>
720
721         Reviewed by Brent Fulgham.
722
723         A cookie received in a WebSocket response should be stored with respect to the
724         origin of the WebSocket server in order for it to be sent in a subsequent request.
725
726         Also removed a FIXME about implementing support for the long since
727         deprecated Set-Cookie2 header.
728
729         Test: http/tests/websocket/tests/hybi/websocket-cookie-overwrite-behavior.html
730
731         * Modules/websockets/WebSocketChannel.cpp:
732         (WebCore::WebSocketChannel::processBuffer):
733         * Modules/websockets/WebSocketHandshake.h:
734
735 2018-03-28  Chris Dumez  <cdumez@apple.com>
736
737         Do process swap when opening a cross-origin URL via window.open(url, '_blank', 'noopener')
738         https://bugs.webkit.org/show_bug.cgi?id=183962
739         <rdar://problem/38817833>
740
741         Reviewed by Brady Eidson.
742
743         Pass extra bits of information to the UIProcess via NavigationAction:
744         - Is it a cross origin navigation caused by window.open()
745         - Does the navigated frame have an opener
746
747         This information is useful to determine on UIProcess side if we want
748         to swap WebProcess.
749
750         * loader/FrameLoadRequest.h:
751         (WebCore::FrameLoadRequest::setIsCrossOriginWindowOpenNavigation):
752         (WebCore::FrameLoadRequest::isCrossOriginWindowOpenNavigation const):
753         * loader/FrameLoader.cpp:
754         (WebCore::FrameLoader::loadURL):
755         * loader/NavigationAction.h:
756         (WebCore::NavigationAction::setIsCrossOriginWindowOpenNavigation):
757         (WebCore::NavigationAction::isCrossOriginWindowOpenNavigation const):
758         (WebCore::NavigationAction::setOpener):
759         (WebCore::NavigationAction::opener const):
760         * page/DOMWindow.cpp:
761         (WebCore::DOMWindow::createWindow):
762
763 2018-03-28  Chris Dumez  <cdumez@apple.com>
764
765         Thread safety issue in IDBFactory' shouldThrowSecurityException()
766         https://bugs.webkit.org/show_bug.cgi?id=184064
767
768         Reviewed by Ryosuke Niwa.
769
770         shouldThrowSecurityException() gets called on a non-main thread but
771         it ended up using the SchemeRegistry via SecurityOrigin::canAccessDatabase()
772         which calls SecurityOrigin::isLocal().
773
774         Since using the SchemeRegistry from the background thread is not safe
775         (we recently added locks which we're trying to remove), and since SecurityOrigin
776         methods are often called from background threads, this patch make SecurityOrigin::isLocal()
777         safe to call from a background thread. To achieve this, we now query the SchemeRegistry
778         in the SecurityOrigin constructor instead as SecurityOrigin objects are expected to be
779         constructed on the main thread.
780
781         * page/SecurityOrigin.cpp:
782         (WebCore::SecurityOrigin::SecurityOrigin):
783         (WebCore::SecurityOrigin::isLocal const): Deleted.
784         * page/SecurityOrigin.h:
785         (WebCore::SecurityOrigin::isLocal const):
786
787 2018-03-28  Ryan Haddad  <ryanhaddad@apple.com>
788
789         Unreviewed, rolling out r230033.
790
791         The LayoutTests modified in this change fail an assertion on
792         WK1.
793
794         Reverted changeset:
795
796         "[Web Animations] Implement more CSSPropertyBlendingClient
797         methods"
798         https://bugs.webkit.org/show_bug.cgi?id=184077
799         https://trac.webkit.org/changeset/230033
800
801 2018-03-28  Chris Dumez  <cdumez@apple.com>
802
803         WebSocket::didReceiveMessage() may construct a SecurityOrigin object on a non-main thread
804         https://bugs.webkit.org/show_bug.cgi?id=184068
805
806         Reviewed by Youenn Fablet.
807
808         WebSocket::didReceiveMessage() may construct a SecurityOrigin object on a non-main thread,
809         which is not safe. We now use SecurityOriginData since we only need an origin String and
810         it is safe to construct a SecurityOriginData on any thread.
811
812         * Modules/websockets/WebSocket.cpp:
813         (WebCore::WebSocket::didReceiveMessage):
814
815 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
816
817         [Extra zoom mode] Make boosted text autosizing values switchable at runtime
818         https://bugs.webkit.org/show_bug.cgi?id=184092
819         <rdar://problem/38939917>
820
821         Reviewed by Tim Horton.
822
823         In r228697, we introduced a new set of boosted text autosizing constants tuned for extra zoom mode, which are
824         currently hard-coded as default values in SettingsBase. However, we've since identified cases where clients may
825         want to opt in or out of boosted text autosizing values and just use the existing values.
826
827         This replaces settings to adjust text autosizing constants with a flag to enable or disable boosted text
828         autosizing; when changed, we update all three text autosizing parameters to their default or boosted values, and
829         then trigger style recalculation.
830
831         Test: TextAutosizingBoost.ChangeAutosizingBoostAtRuntime
832
833         * page/Settings.yaml:
834         * page/SettingsBase.cpp:
835         (WebCore::SettingsBase::shouldEnableTextAutosizingBoostChanged):
836         (WebCore::SettingsBase::defaultOneLineTextMultiplierCoefficient): Deleted.
837         (WebCore::SettingsBase::defaultMultiLineTextMultiplierCoefficient): Deleted.
838         (WebCore::SettingsBase::defaultMaxTextAutosizingScaleIncrease): Deleted.
839
840         Changed these to constant values instead of helper functions, and also introduced boosted text autosizing
841         constants for use in extra zoom mode.
842
843         * page/SettingsBase.h:
844         (WebCore::SettingsBase::oneLineTextMultiplierCoefficient const):
845         (WebCore::SettingsBase::multiLineTextMultiplierCoefficient const):
846         (WebCore::SettingsBase::maxTextAutosizingScaleIncrease const):
847         * rendering/RenderThemeIOS.mm:
848         (WebCore::RenderThemeIOS::extraDefaultStyleSheet):
849
850         Tweak the stylesheet to make `-webkit-text-size-adjust: auto` overridable by web content. Adding the !important
851         is breaking many websites that positioned text such that it is positioned within layout viewport bounds without
852         text autosizing.
853
854 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
855
856         Avoid uninitialized mach ports
857         https://bugs.webkit.org/show_bug.cgi?id=184090
858         <rdar://problem/37261129>
859
860         Reviewed by Chris Dumez.
861
862         It is possible for mach_port_allocate to return an error, but we rarely check its return value. The value
863         of the argument passed to mach_port_allocate is not guaranteed to be valid when it returns an error, so
864         there is a potential for us to try to use invalid ports.
865
866         We should always check return values, and ensure that the mach port variables we seek to initialize are
867         kept in a valid state.
868
869         No new tests, no Web-facing behavior change.
870
871         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
872         (WebCore::attachToAppleGraphicsControl): Initialize masterPort to a default value.
873
874 2018-03-28  Antoine Quint  <graouts@apple.com>
875
876         [Web Animations] Implement more CSSPropertyBlendingClient methods
877         https://bugs.webkit.org/show_bug.cgi?id=184077
878
879         Reviewed by Dean Jackson.
880
881         We only had stubs for several of the CSSPropertyBlendingClient methods and thus always implied that we
882         were animating non-matching transform, filter and backdrop-filter properties. We now implement those using
883         the same code used in KeyframeAnimation. This allows for 31 new tests to opt into the CSS Animations and
884         CSS Transitions as Web Animations feature.
885
886         * animation/KeyframeEffectReadOnly.cpp:
887         (WebCore::KeyframeEffectReadOnly::copyPropertiesFromSource):
888         (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes):
889         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
890         (WebCore::KeyframeEffectReadOnly::checkForMatchingTransformFunctionLists):
891         (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists):
892         (WebCore::KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists):
893         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes):
894         (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes):
895         * animation/KeyframeEffectReadOnly.h:
896
897 2018-03-28  Antoine Quint  <graouts@apple.com>
898
899         [Web Animations] Comparing two matching FramesTimingFunction objects fails
900         https://bugs.webkit.org/show_bug.cgi?id=184078
901
902         Reviewed by Jon Lee.
903
904         Fix a stupid mistake in the == operator for FramesTimingFunction. Without a correct check, we would mistakenly interrupt and
905         restart any transition with a frames() timing function when we check that the Animation objects are similar.
906
907         * platform/animation/TimingFunction.h:
908
909 2018-03-28  Miguel Gomez  <magomez@igalia.com>
910
911         [GTK][WPE] Remove UpdateAtlas
912         https://bugs.webkit.org/show_bug.cgi?id=184042
913
914         Reviewed by Žan Doberšek.
915
916         Remove UpdateAtlas and AreaAllocator classes. Instead of using UpdateAtlas as a cache
917         of buffers to render tiles with cairo, allocate a new buffer for each tile instead.
918
919         Covered by existent tests.
920
921         * loader/EmptyClients.h:
922         * page/ChromeClient.h:
923         * platform/TextureMapper.cmake:
924         * platform/graphics/texmap/coordinated/AreaAllocator.cpp: Removed.
925         * platform/graphics/texmap/coordinated/AreaAllocator.h: Removed.
926         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
927         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
928         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
929         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
930         * platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h:
931         (): Deleted.
932         * platform/graphics/texmap/coordinated/UpdateAtlas.cpp: Removed.
933         * platform/graphics/texmap/coordinated/UpdateAtlas.h: Removed.
934         * testing/Internals.cpp:
935         (WebCore::Internals::resetToConsistentState):
936
937 2018-03-27  Michael Catanzaro  <mcatanzaro@igalia.com>
938
939         Unreviewed, rolling out r230008.
940
941         Lots of HTTP test failures
942
943         Reverted changeset:
944
945         "Remove unused libsoup ResourceHandle implementation"
946         https://bugs.webkit.org/show_bug.cgi?id=184048
947         https://trac.webkit.org/changeset/230008
948
949 2018-03-27  Chris Dumez  <cdumez@apple.com>
950
951         Make it possible to call ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() from non-main threads
952         https://bugs.webkit.org/show_bug.cgi?id=184029
953
954         Reviewed by Youenn Fablet.
955
956         Make it possible to call ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() from non-main threads
957         by having it use SecurityOriginData (which is safe to construct on non-main threads) instead of
958         SecurityOrigin (which isn't).
959
960         ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() is already called from non-main thread in
961         FetchLoader, XHR and WebSocket when used in workers. This wasn't safe.
962
963         * loader/DocumentWriter.cpp:
964         (WebCore::DocumentWriter::begin):
965         * page/csp/ContentSecurityPolicy.cpp:
966         (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded const):
967         (WebCore::ContentSecurityPolicy::setUpgradeInsecureRequests):
968         (WebCore::ContentSecurityPolicy::takeNavigationRequestsToUpgrade):
969         (WebCore::ContentSecurityPolicy::setInsecureNavigationRequestsToUpgrade):
970         * page/csp/ContentSecurityPolicy.h:
971
972 2018-03-27  Daniel Bates  <dabates@apple.com>
973
974         Attempt to fix media control layout tests after <https://trac.webkit.org/changeset/230006/>
975         (https://bugs.webkit.org/show_bug.cgi?id=179983)
976
977         Exempt elements in user agent shadow DOM from having to perform a potentially CORS-
978         enabled fetch for a mask image to try to fix the following tests from timing out:
979             media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline.html
980             media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline.html
981
982         * style/StylePendingResources.cpp:
983         (WebCore::Style::loadPendingImage):
984
985 2018-03-27  Per Arne Vollan  <pvollan@apple.com>
986
987         The layout test fast/canvas/webgl/read-pixels-test.html is timing out.
988         https://bugs.webkit.org/show_bug.cgi?id=183923
989         <rdar://problem/38756869>
990
991         Reviewed by Brent Fulgham.
992
993         The test is timing out when we do not interact directly with the WindowServer, causing
994         OpenGL to fall back to software rendering. In this mode, any call to CGLChoosePixelFormat
995         requesting an accelerated pixel format will fail because it cannot determine which GPU is
996         connected to the display.
997
998         OpenGL treats all GPUs as if they were offline when used in a process (like the WebContent
999         process) that does not directly control the display.
1000
1001         We can get correct behavior if we tell OpenGL which GPU is currently connected to the
1002         display, and if we instruct CGLChoosePixelFormat to create an offline renderer pixel format
1003         by including the 'kCGLPFAAllowOfflineRenderers' flag in its arguments.
1004
1005         We can use CGLSetVirtualScreen with an OpenGL display mask that tells the OpenGL framework
1006         which GPU it should use.
1007
1008         See https://developer.apple.com/library/content/technotes/tn2229/_index.html#//apple_ref/doc/uid/DTS40008924-CH1-SUBSECTION7
1009         for details on how the virtual screen is found from the OpenGL display mask.
1010
1011         No new tests, covered by existing tests.
1012
1013         * WebCore.xcodeproj/project.pbxproj:
1014         * platform/graphics/GraphicsContext3D.h:
1015         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
1016         (WebCore::setPixelFormat):
1017         (WebCore::identifyAndSetCurrentGPU):
1018         (WebCore::GraphicsContext3D::GraphicsContext3D):
1019         (WebCore::GraphicsContext3D::setOpenGLDisplayMask):
1020         (WebCore::GraphicsContext3D::allowOfflineRenderers):
1021
1022 2018-03-27  Jiewen Tan  <jiewen_tan@apple.com>
1023
1024         [WebAuthN] Implement authenticatorGetAssertion
1025         https://bugs.webkit.org/show_bug.cgi?id=183881
1026         <rdar://problem/37258628>
1027
1028         Reviewed by Brent Fulgham.
1029
1030         This patch does the following few things:
1031         1) It implements the spec: https://www.w3.org/TR/webauthn/#op-get-assertion as of 5 December 2017.
1032         2) It tweaks encoding/decoding of PublicKeyCredentialRequestOptions such that options can be passed
1033         between UI and Web processes.
1034         3) It refines the way how LocalAuthenticator::makeCredential find intersection between
1035         excludeCredentialDescriptorList and existing credentials in the authenticator, such that it is faster.
1036         Basically, it takes the CredentialID from the list and treat it as an ASCII string and put it into a
1037         HashSet<String>. It should not matter if a duplicated CredentialID is added. If the hash set is not
1038         empty, the algorithm then queries Keychain for all CredentialIDs related to the current RP ID once.
1039         For every queried CredentialID, the algorithm then treats it as an ASCII string as well and look for
1040         a match in the hash set to produce the intersetction. The new way is also employed in
1041         LocalAuthenticator::getAssertion as well.
1042         4) It abstracts the way to produce authData and thus reorders a bit of code in
1043         LocalAuthenticator::makeCredential.
1044
1045         Covered by API tests.
1046
1047         * Modules/webauthn/AuthenticatorManager.cpp:
1048         (WebCore::AuthenticatorManager::create const):
1049         (WebCore::AuthenticatorManager::discoverFromExternalSource const):
1050         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
1051         * Modules/webauthn/PublicKeyCredentialRequestOptions.h:
1052         (WebCore::PublicKeyCredentialRequestOptions::encode const):
1053         (WebCore::PublicKeyCredentialRequestOptions::decode):
1054         * Modules/webauthn/cocoa/LocalAuthenticator.h:
1055         * Modules/webauthn/cocoa/LocalAuthenticator.mm:
1056         (WebCore::LocalAuthenticatorInternal::buildAuthData):
1057         (WebCore::LocalAuthenticatorInternal::produceHashSet):
1058         (WebCore::LocalAuthenticator::makeCredential):
1059         (WebCore::LocalAuthenticator::getAssertion):
1060         (WebCore::LocalAuthenticator::issueClientCertificate const):
1061         * WebCore.xcodeproj/project.pbxproj:
1062
1063 2018-03-27  Chris Dumez  <cdumez@apple.com>
1064
1065         Avoid constructing SecurityOrigin objects from non-main threads
1066         https://bugs.webkit.org/show_bug.cgi?id=184024
1067
1068         Reviewed by Youenn Fablet.
1069
1070         Avoid constructing SecurityOrigin objects from non-main threads as much as possible
1071         as it is not safe. This patch gets rid of most offending cases but not all of them
1072         yet, which is why I haven't added a ASSERT(isMainThread()) to the SecurityOrigin
1073         constructor yet.
1074
1075         For example, ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() currently
1076         gets called from non-main threads and construct a SecurityOrigin. Fixing this
1077         will require some refactoring that would have made this patch much larger.
1078
1079         * loader/DocumentLoader.cpp:
1080         (WebCore::DocumentLoader::matchRegistration):
1081         * page/EventSource.cpp:
1082         (WebCore::EventSource::didReceiveResponse):
1083         * page/SecurityOrigin.cpp:
1084         (WebCore::SecurityOrigin::SecurityOrigin):
1085         * page/SecurityOrigin.h:
1086         (WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
1087         * testing/Internals.cpp:
1088         (WebCore::Internals::hasServiceWorkerRegistration):
1089         * workers/DedicatedWorkerGlobalScope.cpp:
1090         (WebCore::DedicatedWorkerGlobalScope::create):
1091         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
1092         * workers/DedicatedWorkerGlobalScope.h:
1093         * workers/DedicatedWorkerThread.cpp:
1094         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
1095         * workers/DedicatedWorkerThread.h:
1096         * workers/WorkerGlobalScope.cpp:
1097         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
1098         * workers/WorkerGlobalScope.h:
1099         * workers/WorkerLocation.cpp:
1100         (WebCore::WorkerLocation::origin const):
1101         * workers/WorkerThread.cpp:
1102         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
1103         (WebCore::WorkerThread::workerThread):
1104         * workers/WorkerThread.h:
1105         * workers/service/SWClientConnection.h:
1106         * workers/service/ServiceWorkerContainer.cpp:
1107         (WebCore::ServiceWorkerContainer::getRegistration):
1108         (WebCore::ServiceWorkerContainer::getRegistrations):
1109         * workers/service/ServiceWorkerGlobalScope.cpp:
1110         (WebCore::ServiceWorkerGlobalScope::create):
1111         (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
1112         * workers/service/ServiceWorkerGlobalScope.h:
1113         * workers/service/ServiceWorkerProvider.cpp:
1114         (WebCore::ServiceWorkerProvider::mayHaveServiceWorkerRegisteredForOrigin):
1115         * workers/service/ServiceWorkerProvider.h:
1116         * workers/service/context/ServiceWorkerThread.cpp:
1117         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
1118         (WebCore::fireMessageEvent):
1119         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
1120         * workers/service/context/ServiceWorkerThread.h:
1121
1122 2018-03-27  Alex Christensen  <achristensen@webkit.org>
1123
1124         Remove unused libsoup ResourceHandle implementation
1125         https://bugs.webkit.org/show_bug.cgi?id=184048
1126
1127         Reviewed by Michael Catanzaro.
1128
1129         This code is unused since r228901 so let's remove it!
1130
1131         * platform/network/ResourceHandle.h:
1132         * platform/network/ResourceHandleInternal.h:
1133         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
1134         * platform/network/soup/ResourceHandleSoup.cpp:
1135         (WebCore::ResourceHandle::~ResourceHandle):
1136         (WebCore::ResourceHandleInternal::soupSession):
1137         (WebCore::ResourceHandle::cancelledOrClientless):
1138         (WebCore::ResourceHandle::ensureReadBuffer):
1139         (WebCore::ResourceHandle::currentStreamPosition const):
1140         (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse):
1141         (WebCore::ResourceHandle::didStartRequest):
1142         (WebCore::ResourceHandle::start):
1143         (WebCore::ResourceHandle::releaseForDownload):
1144         (WebCore::ResourceHandle::sendPendingRequest):
1145         (WebCore::ResourceHandle::cancel):
1146         (WebCore::ResourceHandle::shouldUseCredentialStorage):
1147         (WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge):
1148         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
1149         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
1150         (WebCore::ResourceHandle::receivedCredential):
1151         (WebCore::ResourceHandle::receivedCancellation):
1152         (WebCore::ResourceHandle::receivedChallengeRejection):
1153         (WebCore::ResourceHandle::platformSetDefersLoading):
1154         (WebCore::sessionFromContext): Deleted.
1155         (WebCore::ResourceHandle::create): Deleted.
1156         (WebCore::ResourceHandle::ResourceHandle): Deleted.
1157         (WebCore::isAuthenticationFailureStatusCode): Deleted.
1158         (WebCore::tlsErrorsChangedCallback): Deleted.
1159         (WebCore::gotHeadersCallback): Deleted.
1160         (WebCore::applyAuthenticationToRequest): Deleted.
1161         (WebCore::restartedCallback): Deleted.
1162         (WebCore::shouldRedirect): Deleted.
1163         (WebCore::shouldRedirectAsGET): Deleted.
1164         (WebCore::continueAfterWillSendRequest): Deleted.
1165         (WebCore::doRedirect): Deleted.
1166         (WebCore::redirectSkipCallback): Deleted.
1167         (WebCore::wroteBodyDataCallback): Deleted.
1168         (WebCore::cleanupSoupRequestOperation): Deleted.
1169         (WebCore::nextMultipartResponsePartCallback): Deleted.
1170         (WebCore::sendRequestCallback): Deleted.
1171         (WebCore::continueAfterDidReceiveResponse): Deleted.
1172         (WebCore::startingCallback): Deleted.
1173         (WebCore::networkEventCallback): Deleted.
1174         (WebCore::createSoupMessageForHandleAndRequest): Deleted.
1175         (WebCore::createSoupRequestAndMessageForHandle): Deleted.
1176         (WebCore::ResourceHandle::timeoutFired): Deleted.
1177         (WebCore::waitingToSendRequest): Deleted.
1178         (WebCore::readCallback): Deleted.
1179
1180 2018-03-27  Chris Dumez  <cdumez@apple.com>
1181
1182         Move online state detection from the WebProcess to the NetworkProcess
1183         https://bugs.webkit.org/show_bug.cgi?id=183989
1184         <rdar://problem/37093299>
1185
1186         Reviewed by Youenn Fablet.
1187
1188         Move online state detection from the WebProcess to the NetworkProcess. This avoid executing the same (expensive) code in
1189         EACH web process whenever a network interface's state changes. Now, the Network Process monitors network interfaces
1190         and determines the online state whenever an interface's state changes. If the onLine state changes, it notifies all
1191         its connected WebProcesses via IPC.
1192
1193         * inspector/agents/InspectorApplicationCacheAgent.cpp:
1194         (WebCore::InspectorApplicationCacheAgent::networkStateChanged):
1195         * loader/LoaderStrategy.h:
1196         * page/Navigator.cpp:
1197         (WebCore::Navigator::onLine const):
1198         * page/Page.cpp:
1199         * platform/network/NetworkStateNotifier.h:
1200         * workers/Worker.cpp:
1201         (WebCore::Worker::Worker):
1202         (WebCore::Worker::notifyFinished):
1203         * workers/service/context/ServiceWorkerThread.cpp:
1204         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1205         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1206         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
1207
1208 2018-03-27  Daniel Bates  <dabates@apple.com>
1209
1210         CSS mask images should be retrieved using potentially CORS-enabled fetch
1211         https://bugs.webkit.org/show_bug.cgi?id=179983
1212         <rdar://problem/35678149>
1213
1214         Reviewed by Brent Fulgham.
1215
1216         As per <https://drafts.fxtf.org/css-masking-1/#priv-sec> (Editor’s Draft, 23 December 2017)
1217         we should fetch CSS mask images using a potentially CORS-enabled fetch.
1218
1219         Both cross-origin CSS shape-outside images and CSS mask images may be sensitive to timing
1220         attacks that can be used to reveal their pixel data when retrieved without regard to CORS.
1221         For the same reason that we fetch CSS shape-outside images using a potentially CORS-enabled
1222         fetch we should fetch CSS mask the same way. This also makes the behavior of WebKit more
1223         closely align with the behavior in the spec.
1224
1225         Test: http/tests/security/css-mask-image.html
1226
1227         * page/Settings.yaml: Add a setting for toggle "Anonymous" mode fetching of mask images (defaults: true).
1228         We need this setting to avoid breaking the developer convenience feature that some modern media controls
1229         layout tests employ to load assets from the filesystem as opposed to using the hardcoded data URLs baked
1230         into the WebKit binary.
1231         * style/StylePendingResources.cpp: Substitute LoadPolicy::NoCORS and LoadPolicy::Anonymous for
1232         LoadPolicy::Normal and LoadPolicy::ShapeOutside, respectively, to match the terminology used
1233         in the HTML, CSS Shapes Module Level 1, and CSS Masking Module Level 1 specs.
1234         (WebCore::Style::loadPendingImage): Ditto.
1235         (WebCore::Style::loadPendingResources): Use load policy LoadPolicy::Anonymous when fetching
1236         a mask image or shape-outside image.
1237
1238 2018-03-27  Zalan Bujtas  <zalan@apple.com>
1239
1240         RenderBox::parent/firstChild/nextSibling/previousSiblingBox() functions should type check.
1241         https://bugs.webkit.org/show_bug.cgi?id=184032
1242         <rdar://problem/38384984>
1243
1244         Reviewed by Antti Koivisto.
1245
1246         We cannot rely on the correctness of the render tree structure when querying for parent/child/next and previous
1247         sibling since some features (multicolumn/spanners) move subtrees out of their original position (which is highly
1248         undesired and should not be encouraged at all though).
1249         It should also be noted that these functions are not equivalent of typeOfChildren<RenderBox> and the following usage
1250             for (auto* boxChild = firstChildBox(); boxChild; boxChild = boxChild->nextSiblingBox())
1251         can lead to unexpected result.
1252  
1253         Test: fast/multicol/parent-box-when-spanner-is-present.html
1254
1255         * rendering/RenderBox.h:
1256         (WebCore::RenderBox::parentBox const):
1257         (WebCore::RenderBox::firstChildBox const):
1258         (WebCore::RenderBox::lastChildBox const):
1259         (WebCore::RenderBox::previousSiblingBox const):
1260         (WebCore::RenderBox::nextSiblingBox const):
1261         * rendering/RenderListItem.cpp:
1262         (WebCore::RenderListItem::positionListMarker):
1263         * rendering/RenderListMarker.cpp:
1264         (WebCore::RenderListMarker::layout):
1265         * rendering/RenderMultiColumnSet.cpp:
1266         (WebCore::RenderMultiColumnSet::updateLogicalWidth):
1267
1268 2018-03-27  Brent Fulgham  <bfulgham@apple.com>
1269
1270         Further refine cookie read/write logging
1271         https://bugs.webkit.org/show_bug.cgi?id=184044
1272         <rdar://problem/38915610>
1273
1274         Reviewed by Chris Dumez.
1275
1276         Export 'shouldBlockCookies' so that it can be accessed by the WebKit framework.
1277
1278         * platform/network/NetworkStorageSession.h:
1279
1280 2018-03-27  Antoine Quint  <graouts@apple.com>
1281
1282         [Web Animations] Stop using internals.pauseAnimationAtTimeOnElement() in favor of Web Animations API for animations tests
1283         https://bugs.webkit.org/show_bug.cgi?id=184038
1284
1285         Reviewed by Dean Jackson.
1286
1287         Expose a new method to indicate that the runtime flag for CSS Animations and CSS Transitions as Web Animations is enabled.
1288
1289         * testing/InternalSettings.cpp:
1290         (WebCore::InternalSettings::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
1291         * testing/InternalSettings.h:
1292         * testing/InternalSettings.idl:
1293
1294 2018-03-27  Thibault Saunier  <tsaunier@igalia.com>
1295
1296         [GStreamer] Enhance debugging in the BasePlayer
1297         https://bugs.webkit.org/show_bug.cgi?id=184035
1298
1299         Reviewed by Philippe Normand.
1300
1301         No behaviour changes so no test were added/enabled.
1302
1303         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1304         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
1305         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
1306         (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const):
1307         (WebCore::MediaPlayerPrivateGStreamerBase::setVolume):
1308         (WebCore::MediaPlayerPrivateGStreamerBase::volumeChangedCallback):
1309         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted):
1310         (WebCore::MediaPlayerPrivateGStreamerBase::muted const):
1311         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
1312         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
1313         (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement):
1314         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
1315         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached):
1316         (WebCore::MediaPlayerPrivateGStreamerBase::dispatchDecryptionKey):
1317         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
1318
1319 2018-03-27  Eric Carlson  <eric.carlson@apple.com>
1320
1321         Make AVFoundationEnabled preference available on iOS
1322         https://bugs.webkit.org/show_bug.cgi?id=183876
1323         <rdar://problem/38726459>
1324
1325         Reviewed by Youenn Fablet.
1326
1327         Test: AVFoundationPref API test.
1328
1329         * html/HTMLAudioElement.idl: There is no need for a runtime setting to enable/disable audio,
1330         there is already settings.mediaEnabled.
1331         * html/HTMLMediaElement.cpp:
1332         (WebCore::HTMLMediaElement::prepareForLoad): Fail if there are no media engines registered.
1333         (WebCore::HTMLMediaElement::noneSupported): Return early if m_error has already been set.
1334         (WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture): Remove a typo.
1335
1336         * page/RuntimeEnabledFeatures.cpp:
1337         (WebCore::RuntimeEnabledFeatures::audioEnabled const): Deleted.
1338         * page/RuntimeEnabledFeatures.h:
1339
1340 2018-03-27  Fujii Hironori  <Hironori.Fujii@sony.com>
1341
1342         [GTK] Layout test editing/deleting/delete-surrogatepair.html crashing with CRITICAL **: enchant_dict_check: assertion 'g_utf8_validate(word, len, NULL)' failed
1343         https://bugs.webkit.org/show_bug.cgi?id=176799
1344
1345         Reviewed by Carlos Garcia Campos.
1346
1347         The length of a surrogate-pair UTF-16 character is 2 even though
1348         the number of characters is 1. An incorrect string length was
1349         passed to enchant_dict_check if the string contains a
1350         surrogate-pair character because the length was calculated by
1351         applying UTF-16 character position to UTF-8 string.
1352
1353         No new tests (Covered by existing tests).
1354
1355         * platform/text/enchant/TextCheckerEnchant.cpp:
1356         (WebCore::TextCheckerEnchant::checkSpellingOfWord): Changed the
1357         type of an argument `word` from CString to String. Convert a
1358         substring of the argument into UTF-8.
1359         (WebCore::TextCheckerEnchant::checkSpellingOfString): Pass the
1360         original UTF-16 string to checkSpellingOfWord instead of a
1361         converted UTF-8 string.
1362         * platform/text/enchant/TextCheckerEnchant.h: Changed the type of
1363         an argument `word` from CString to String.
1364
1365 2018-03-26  Ms2ger  <Ms2ger@igalia.com>
1366
1367         Remove an unnecessary const_cast from BitmapTextureGL::updateContents().
1368         https://bugs.webkit.org/show_bug.cgi?id=184007
1369
1370         Reviewed by Žan Doberšek.
1371
1372         No new tests.
1373
1374         * platform/graphics/texmap/BitmapTextureGL.cpp:
1375         (WebCore::BitmapTextureGL::updateContents):
1376
1377 2018-03-23  Antoine Quint  <graouts@apple.com>
1378
1379         [Web Animations] Make imported/mozilla/css-animations/test_animation-currenttime.html pass reliably
1380         https://bugs.webkit.org/show_bug.cgi?id=183819
1381
1382         Reviewed by Dean Jackson.
1383
1384         The current time for a CSS Animation exposed via the API should be clamped between 0 and the animation duration.
1385
1386         * animation/CSSAnimation.cpp:
1387         (WebCore::CSSAnimation::bindingsCurrentTime const):
1388         * animation/CSSAnimation.h:
1389         * animation/WebAnimation.h:
1390
1391 2018-03-23  Antoine Quint  <graouts@apple.com>
1392
1393         [Web Animations] Correctly handle timing functions specified by CSS Animations and CSS Transitions
1394         https://bugs.webkit.org/show_bug.cgi?id=183935
1395
1396         Reviewed by Dean Jackson.
1397
1398         We were incorrectly reflecting the animation-timing-function and transition-timing-function values on the generated
1399         DeclarativeAnimation effect timing "easing" property. In fact, those values should only be represented on the keyframes.
1400
1401         In the case of a CSS Animation, the animation-timing-function property set on the element's style serves as the default
1402         value used for all keyframes, and individual keyframes can specify an overriding animation-timing-function. For a CSS
1403         Transition, the transition-timing-function property set on the element's style serves as the timing function of the
1404         from keyframe.
1405
1406         To correctly reflect this, we provide a new timingFunctionForKeyframeAtIndex() function on KeyframeEffectReadOnly
1407         which will return the right TimingFunction object at a given index, regardless of the animation type. In the case
1408         of getKeyframes(), we manually return "linear" for the "to" keyframe since timingFunctionForKeyframeAtIndex()
1409         would otherwise return the same timing function as the "from" keyframe. This avoids creating an extra
1410         LinearTimingFunction object.
1411
1412         As a result, a number of Mozilla imported tests progress since we have correct information on the "easing" property
1413         of objects returned by getKeyframes() and the "progress" reported by getComputedTiming() now always uses a linear
1414         timing function.
1415
1416         * animation/DeclarativeAnimation.cpp:
1417         (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): The timing function of the backing Animation should
1418         not be reflected on the effect's timing object.
1419         * animation/KeyframeEffectReadOnly.cpp:
1420         (WebCore::KeyframeEffectReadOnly::getKeyframes): Return the correct timing function for a keyframe, and use a "linear"
1421         value for the "to" keyframe of a CSS Transition.
1422         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle):
1423         (WebCore::KeyframeEffectReadOnly::timingFunctionForKeyframeAtIndex):
1424         * animation/KeyframeEffectReadOnly.h:
1425
1426 2018-03-26  Chris Dumez  <cdumez@apple.com>
1427
1428         Use SecurityOriginData more consistently in Service Worker code
1429         https://bugs.webkit.org/show_bug.cgi?id=183969
1430
1431         Reviewed by Darin Adler.
1432
1433         Use SecurityOriginData more consistently in Service Worker code to avoid constructing
1434         SecurityOrigin objects unnecessarily.
1435
1436         I also updated SecurityOrigin to use SecurityOriginData as a data member. This reduces
1437         code duplication a bit. This also avoids constructing SecurityOriginData unnecessarily
1438         in some cases as callers can now use SecurityOrigin::data() instead of
1439         SecurityOriginData::fromSecurityOrigin().
1440
1441         No new tests, no Web-facing behavior change.
1442
1443         * Modules/cache/DOMCacheStorage.cpp:
1444         (WebCore::DOMCacheStorage::origin const):
1445         * Modules/encryptedmedia/CDM.cpp:
1446         (WebCore::CDM::storageDirectory const):
1447         * Modules/encryptedmedia/MediaKeySession.cpp:
1448         (WebCore::MediaKeySession::mediaKeysStorageDirectory const):
1449         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
1450         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory const):
1451         * Modules/indexeddb/IDBFactory.cpp:
1452         (WebCore::IDBFactory::openInternal):
1453         (WebCore::IDBFactory::deleteDatabase):
1454         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
1455         (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
1456         * Modules/webdatabase/Database.cpp:
1457         (WebCore::Database::securityOrigin):
1458         * Modules/webdatabase/DatabaseContext.cpp:
1459         (WebCore::DatabaseContext::securityOrigin const):
1460         * Modules/webdatabase/DatabaseContext.h:
1461         * Modules/webdatabase/DatabaseManager.cpp:
1462         (WebCore::DatabaseManager::fullPathForDatabase):
1463         (WebCore::DatabaseManager::detailsForNameAndOrigin):
1464         * html/HTMLMediaElement.cpp:
1465         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const):
1466         * inspector/agents/InspectorDOMStorageAgent.cpp:
1467         (WebCore::InspectorDOMStorageAgent::findStorageArea):
1468         * loader/appcache/ApplicationCacheStorage.cpp:
1469         (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
1470         (WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
1471         (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
1472         (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
1473         (WebCore::ApplicationCacheStorage::store):
1474         (WebCore::ApplicationCacheStorage::ensureOriginRecord):
1475         * page/DOMWindow.cpp:
1476         (WebCore:: const):
1477         * page/SecurityOrigin.cpp:
1478         (WebCore::SecurityOrigin::SecurityOrigin):
1479         (WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
1480         (WebCore::SecurityOrigin::canAccess const):
1481         (WebCore::SecurityOrigin::canDisplay const):
1482         (WebCore::SecurityOrigin::domainForCachePartition const):
1483         (WebCore::SecurityOrigin::isLocal const):
1484         (WebCore::SecurityOrigin::toString const):
1485         (WebCore::SecurityOrigin::toRawString const):
1486         (WebCore::SecurityOrigin::create):
1487         (WebCore::SecurityOrigin::isSameSchemeHostPort const):
1488         * page/SecurityOrigin.h:
1489         (WebCore::SecurityOrigin::protocol const):
1490         (WebCore::SecurityOrigin::host const):
1491         (WebCore::SecurityOrigin::port const):
1492         (WebCore::SecurityOrigin::data const):
1493         (WebCore::SecurityOrigin::isHTTPFamily const):
1494         * page/SecurityOriginData.cpp:
1495         (WebCore::SecurityOriginData::toString const):
1496         (WebCore::SecurityOriginData::fromFrame):
1497         * page/SecurityOriginData.h:
1498         (WebCore::SecurityOriginData::fromURL):
1499         * storage/StorageNamespaceProvider.cpp:
1500         (WebCore::StorageNamespaceProvider::localStorageArea):
1501         * testing/Internals.cpp:
1502         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
1503         * workers/service/ServiceWorkerContainer.cpp:
1504         (WebCore::ServiceWorkerContainer::addRegistration):
1505         (WebCore::ServiceWorkerContainer::removeRegistration):
1506         (WebCore::ServiceWorkerContainer::updateRegistration):
1507         * workers/service/ServiceWorkerRegistrationKey.cpp:
1508         (WebCore::ServiceWorkerRegistrationKey::relatesToOrigin const):
1509         * workers/service/ServiceWorkerRegistrationKey.h:
1510         * workers/service/server/SWOriginStore.cpp:
1511         (WebCore::SWOriginStore::add):
1512         (WebCore::SWOriginStore::remove):
1513         (WebCore::SWOriginStore::clear):
1514         * workers/service/server/SWOriginStore.h:
1515         * workers/service/server/SWServer.cpp:
1516         (WebCore::SWServer::addRegistration):
1517         (WebCore::SWServer::removeRegistration):
1518         (WebCore::SWServer::clear):
1519         (WebCore::SWServer::tryInstallContextData):
1520         (WebCore::SWServer::serverToContextConnectionCreated):
1521         (WebCore::SWServer::markAllWorkersForOriginAsTerminated):
1522         (WebCore::SWServer::unregisterServiceWorkerClient):
1523         (WebCore::SWServer::needsServerToContextConnectionForOrigin const):
1524         * workers/service/server/SWServer.h:
1525         * workers/service/server/SWServerToContextConnection.cpp:
1526         (WebCore::SWServerToContextConnection::SWServerToContextConnection):
1527         (WebCore::SWServerToContextConnection::~SWServerToContextConnection):
1528         (WebCore::SWServerToContextConnection::connectionForOrigin):
1529         * workers/service/server/SWServerToContextConnection.h:
1530         (WebCore::SWServerToContextConnection::securityOrigin const):
1531         * workers/service/server/SWServerWorker.cpp:
1532         (WebCore::SWServerWorker::origin const):
1533         (WebCore::SWServerWorker::securityOrigin const):
1534         * workers/service/server/SWServerWorker.h:
1535
1536 2018-03-26  Brent Fulgham  <bfulgham@apple.com>
1537
1538         Warn against cookie access in the WebContent process using ProcessPrivilege assertions
1539         https://bugs.webkit.org/show_bug.cgi?id=183911
1540         <rdar://problem/38762306>
1541
1542         Reviewed by Youenn Fablet.
1543
1544         Add a set of ProcessPrivilege assertions to enforce the rule that the WebContent process
1545         should never call Cookie API directly. That should only happen in the Networking or
1546         UIProcess. 
1547
1548         Add a new static flag to NetworkStorageSession that indicates if the current process has
1549         permission to interact with the Cookie API.
1550
1551         No new tests since there is no change in behavior.
1552
1553         * platform/network/NetworkStorageSession.cpp:
1554         (WebCore::NetworkStorageSession::NetworkStorageSession):
1555         (WebCore::NetworkStorageSession::processMayUseCookieAPI): Added.
1556         (WebCore::NetworkStorageSession::permitProcessToUseCookieAPI): Added. This also adds
1557         the appropriate flag to the ProcessPrivileges data for the current process.
1558         * platform/network/NetworkStorageSession.h:
1559         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1560         (WebCore::createCFStorageSessionForIdentifier): Do not create cookie storage if the current
1561         process is prohibited from interacting with the Cookie API.
1562         (WebCore::NetworkStorageSession::NetworkStorageSession): Add assertions.
1563         (WebCore::NetworkStorageSession::switchToNewTestingSession): Do not create cookie storage if
1564         the current process is prohibited from interacting with the Cookie API.
1565         (WebCore::NetworkStorageSession::defaultStorageSession): Ditto.
1566         (WebCore::NetworkStorageSession::ensureSession): Ditto.
1567         (WebCore::NetworkStorageSession::cookieStorage const): Ditto.
1568         * platform/network/cocoa/CookieStorageObserver.mm:
1569         (WebCore::CookieStorageObserver::CookieStorageObserver): Assert if accessed from untrusted process.
1570         (WebCore::CookieStorageObserver::startObserving): Ditto.
1571         (WebCore::CookieStorageObserver::stopObserving): Ditto.
1572         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1573         (WebCore::NetworkStorageSession::setCookie):
1574         (WebCore::NetworkStorageSession::setCookies):
1575         (WebCore::NetworkStorageSession::deleteCookie):
1576         (WebCore::nsCookiesToCookieVector):
1577         (WebCore::NetworkStorageSession::getAllCookies):
1578         (WebCore::NetworkStorageSession::getCookies):
1579         (WebCore::NetworkStorageSession::flushCookieStore):
1580         (WebCore::NetworkStorageSession::nsCookieStorage const):
1581         (WebCore::createPrivateStorageSession):
1582         * platform/network/mac/CookieJarMac.mm:
1583         (WebCore::httpCookies):
1584         (WebCore::deleteHTTPCookie):
1585         (WebCore::httpCookiesForURL):
1586         (WebCore::filterCookies):
1587         (WebCore::applyPartitionToCookies):
1588         (WebCore::cookiesInPartitionForURL):
1589         (WebCore::cookiesForSession):
1590         (WebCore::setHTTPCookiesForURL):
1591         (WebCore::deleteAllHTTPCookies):
1592         (WebCore::setCookiesFromDOM):
1593         (WebCore::httpCookieAcceptPolicy):
1594         (WebCore::deleteCookie):
1595         (WebCore::deleteCookiesForHostnames):
1596         (WebCore::deleteAllCookiesModifiedSince):
1597
1598 2018-03-26  Alex Christensen  <achristensen@webkit.org>
1599
1600         Merge ResourceHandleClient::willCacheResponseAsync with ResourceHandleClient::willCacheResponse
1601         https://bugs.webkit.org/show_bug.cgi?id=183965
1602
1603         Reviewed by Chris Dumez.
1604
1605         It turns out that ResourceHandleClient::willCacheResponseAsync didn't do anything and the logic in
1606         ResourceHandleClient::willCacheResponse was not being called.  This makes it so there is one code
1607         path and it executes the logic in ResourceHandleClient::willCacheResponse.
1608
1609         * loader/EmptyFrameLoaderClient.h:
1610         * loader/FrameLoaderClient.h:
1611         * loader/ResourceLoader.h:
1612         * loader/SubresourceLoader.h:
1613         * loader/cocoa/SubresourceLoaderCocoa.mm:
1614         (WebCore::SubresourceLoader::willCacheResponseAsync):
1615         (WebCore::SubresourceLoader::willCacheResponse): Deleted.
1616         * loader/mac/ResourceLoaderMac.mm:
1617         (WebCore::ResourceLoader::willCacheResponseAsync):
1618         (WebCore::ResourceLoader::willCacheResponse): Deleted.
1619         * platform/network/ResourceHandle.h:
1620         * platform/network/ResourceHandleClient.cpp:
1621         (WebCore::ResourceHandleClient::willCacheResponseAsync): Deleted.
1622         * platform/network/ResourceHandleClient.h:
1623         (WebCore::ResourceHandleClient::willCacheResponseAsync):
1624         (WebCore::ResourceHandleClient::shouldCacheResponse):
1625         (WebCore::ResourceHandleClient::willCacheResponse): Deleted.
1626         * platform/network/cf/ResourceHandleCFNet.cpp:
1627         (WebCore::ResourceHandle::continueWillCacheResponse): Deleted.
1628         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
1629         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1630         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
1631         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillCacheResponse): Deleted.
1632         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
1633         * platform/network/mac/ResourceHandleMac.mm:
1634         (WebCore::ResourceHandle::continueWillCacheResponse): Deleted.
1635         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
1636         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1637         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
1638         (-[WebCoreResourceHandleAsOperationQueueDelegate continueWillCacheResponse:]): Deleted.
1639
1640 2018-03-26  Miguel Gomez  <magomez@igalia.com>
1641
1642         [GTK][WPE] Upload correct buffer in BitmapTextureGL::updateContents()
1643         https://bugs.webkit.org/show_bug.cgi?id=184004
1644
1645         Reviewed by Žan Doberšek.
1646
1647         Do not upload the original buffer. Upload the result of creating a subImage buffer
1648         if it was required.
1649
1650         Covered by existent tests.
1651
1652         * platform/graphics/texmap/BitmapTextureGL.cpp:
1653         (WebCore::BitmapTextureGL::updateContents):
1654
1655 2018-03-25  Zan Dobersek  <zdobersek@igalia.com>
1656
1657         [TexMap] Clean up TextureMapperPlatformLayer, TextureMapperBackingStore code
1658         https://bugs.webkit.org/show_bug.cgi?id=183985
1659
1660         Reviewed by Michael Catanzaro.
1661
1662         Clean up TextureMapperPlatformLayer and TextureMapperBackingStore
1663         headers and implementation files. Remove dubious whitespace, use #pragma
1664         once, clean up constructors, destructors, method definitions and remove
1665         unnecessary includes in favor of forward declarations where possible.
1666
1667         The TextureMapperPlatformLayer::swapBuffers() method is removed as it
1668         wasn't called or overridden anywhere.
1669
1670         No new tests -- no change in functionality.
1671
1672         * platform/graphics/texmap/TextureMapperBackingStore.cpp:
1673         * platform/graphics/texmap/TextureMapperBackingStore.h:
1674         (WebCore::TextureMapperBackingStore::drawRepaintCounter):
1675         * platform/graphics/texmap/TextureMapperPlatformLayer.h:
1676         (WebCore::TextureMapperPlatformLayer::setClient):
1677         (WebCore::TextureMapperPlatformLayer::TextureMapperPlatformLayer): Deleted.
1678         (WebCore::TextureMapperPlatformLayer::swapBuffers): Deleted.
1679
1680 2018-03-25  Dan Bernstein  <mitz@apple.com>
1681
1682         [Xcode] Remove workaround only needed for deploying to iOS 10.0 and earlier
1683         https://bugs.webkit.org/show_bug.cgi?id=183999
1684
1685         Reviewed by Sam Weinig.
1686
1687         * Configurations/WebCore.xcconfig: Removed build settings.
1688         * Configurations/WebCoreTestSupport.xcconfig: Removed location of phony WebKitLegacy from
1689           frameworks search path.
1690         * Configurations/WebKitLegacyStub.iOS.tbd: Removed.
1691         * WebCore.xcodeproj/project.pbxproj: Removed script build phase from the Derived Sources target.
1692
1693 2018-03-25  Commit Queue  <commit-queue@webkit.org>
1694
1695         Unreviewed, rolling out r229954.
1696         https://bugs.webkit.org/show_bug.cgi?id=184000
1697
1698         Caused many layout tests to crash on Apple High Sierra,
1699         Sierra, iOS Simulator and GTK Linux Debug test bots (Requested
1700         by dydz on #webkit).
1701
1702         Reverted changeset:
1703
1704         "Use SecurityOriginData more consistently in Service Worker
1705         code"
1706         https://bugs.webkit.org/show_bug.cgi?id=183969
1707         https://trac.webkit.org/changeset/229954
1708
1709 2018-03-23  Alex Christensen  <achristensen@webkit.org>
1710
1711         Use completion handlers for ResourceHandleClient::canAuthenticateAgainstProtectionSpaceAsync
1712         https://bugs.webkit.org/show_bug.cgi?id=183966
1713
1714         Reviewed by Chris Dumez.
1715
1716         No change in behavior.
1717
1718         * loader/ResourceLoader.cpp:
1719         (WebCore::ResourceLoader::canAuthenticateAgainstProtectionSpaceAsync):
1720         * loader/ResourceLoader.h:
1721         * platform/network/BlobResourceHandle.cpp:
1722         * platform/network/PingHandle.h:
1723         * platform/network/ResourceHandle.h:
1724         * platform/network/ResourceHandleClient.h:
1725         * platform/network/SynchronousLoaderClient.cpp:
1726         (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpaceAsync):
1727         * platform/network/SynchronousLoaderClient.h:
1728         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
1729         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1730         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
1731         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
1732         * platform/network/mac/ResourceHandleMac.mm:
1733         (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
1734         (WebCore::ResourceHandle::continueCanAuthenticateAgainstProtectionSpace): Deleted.
1735         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
1736         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1737         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
1738         (-[WebCoreResourceHandleAsOperationQueueDelegate continueCanAuthenticateAgainstProtectionSpace:]): Deleted.
1739
1740 2018-03-24  Chris Dumez  <cdumez@apple.com>
1741
1742         Use SecurityOriginData more consistently in Service Worker code
1743         https://bugs.webkit.org/show_bug.cgi?id=183969
1744
1745         Reviewed by Darin Adler.
1746
1747         Use SecurityOriginData more consistently in Service Worker code to avoid constructing
1748         SecurityOrigin objects unnecessarily.
1749
1750         I also updated SecurityOrigin to use SecurityOriginData as a data member. This reduces
1751         code duplication a bit. This also avoids constructing SecurityOriginData unnecessarily
1752         in some cases as callers can now use SecurityOrigin::data() instead of
1753         SecurityOriginData::fromSecurityOrigin().
1754
1755         No new tests, no Web-facing behavior change.
1756
1757         * Modules/cache/DOMCacheStorage.cpp:
1758         (WebCore::DOMCacheStorage::origin const):
1759         * Modules/encryptedmedia/CDM.cpp:
1760         (WebCore::CDM::storageDirectory const):
1761         * Modules/encryptedmedia/MediaKeySession.cpp:
1762         (WebCore::MediaKeySession::mediaKeysStorageDirectory const):
1763         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
1764         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory const):
1765         * Modules/indexeddb/IDBFactory.cpp:
1766         (WebCore::IDBFactory::openInternal):
1767         (WebCore::IDBFactory::deleteDatabase):
1768         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
1769         (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
1770         * Modules/webdatabase/Database.cpp:
1771         (WebCore::Database::securityOrigin):
1772         * Modules/webdatabase/DatabaseContext.cpp:
1773         (WebCore::DatabaseContext::securityOrigin const):
1774         * Modules/webdatabase/DatabaseContext.h:
1775         * Modules/webdatabase/DatabaseManager.cpp:
1776         (WebCore::DatabaseManager::fullPathForDatabase):
1777         (WebCore::DatabaseManager::detailsForNameAndOrigin):
1778         * html/HTMLMediaElement.cpp:
1779         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const):
1780         * inspector/agents/InspectorDOMStorageAgent.cpp:
1781         (WebCore::InspectorDOMStorageAgent::findStorageArea):
1782         * loader/appcache/ApplicationCacheStorage.cpp:
1783         (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
1784         (WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
1785         (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
1786         (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
1787         (WebCore::ApplicationCacheStorage::store):
1788         (WebCore::ApplicationCacheStorage::ensureOriginRecord):
1789         * page/DOMWindow.cpp:
1790         (WebCore:: const):
1791         * page/SecurityOrigin.cpp:
1792         (WebCore::SecurityOrigin::SecurityOrigin):
1793         (WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
1794         (WebCore::SecurityOrigin::canAccess const):
1795         (WebCore::SecurityOrigin::canDisplay const):
1796         (WebCore::SecurityOrigin::domainForCachePartition const):
1797         (WebCore::SecurityOrigin::isLocal const):
1798         (WebCore::SecurityOrigin::toString const):
1799         (WebCore::SecurityOrigin::toRawString const):
1800         (WebCore::SecurityOrigin::create):
1801         (WebCore::SecurityOrigin::isSameSchemeHostPort const):
1802         * page/SecurityOrigin.h:
1803         (WebCore::SecurityOrigin::protocol const):
1804         (WebCore::SecurityOrigin::host const):
1805         (WebCore::SecurityOrigin::port const):
1806         (WebCore::SecurityOrigin::data const):
1807         (WebCore::SecurityOrigin::isHTTPFamily const):
1808         * page/SecurityOriginData.cpp:
1809         (WebCore::SecurityOriginData::toString const):
1810         (WebCore::SecurityOriginData::fromFrame):
1811         * page/SecurityOriginData.h:
1812         (WebCore::SecurityOriginData::fromURL):
1813         * storage/StorageNamespaceProvider.cpp:
1814         (WebCore::StorageNamespaceProvider::localStorageArea):
1815         * testing/Internals.cpp:
1816         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
1817         * workers/service/ServiceWorkerContainer.cpp:
1818         (WebCore::ServiceWorkerContainer::addRegistration):
1819         (WebCore::ServiceWorkerContainer::removeRegistration):
1820         (WebCore::ServiceWorkerContainer::updateRegistration):
1821         * workers/service/ServiceWorkerRegistrationKey.cpp:
1822         (WebCore::ServiceWorkerRegistrationKey::relatesToOrigin const):
1823         * workers/service/ServiceWorkerRegistrationKey.h:
1824         * workers/service/server/SWOriginStore.cpp:
1825         (WebCore::SWOriginStore::add):
1826         (WebCore::SWOriginStore::remove):
1827         (WebCore::SWOriginStore::clear):
1828         * workers/service/server/SWOriginStore.h:
1829         * workers/service/server/SWServer.cpp:
1830         (WebCore::SWServer::addRegistration):
1831         (WebCore::SWServer::removeRegistration):
1832         (WebCore::SWServer::clear):
1833         (WebCore::SWServer::tryInstallContextData):
1834         (WebCore::SWServer::serverToContextConnectionCreated):
1835         (WebCore::SWServer::markAllWorkersForOriginAsTerminated):
1836         (WebCore::SWServer::unregisterServiceWorkerClient):
1837         (WebCore::SWServer::needsServerToContextConnectionForOrigin const):
1838         * workers/service/server/SWServer.h:
1839         * workers/service/server/SWServerToContextConnection.cpp:
1840         (WebCore::SWServerToContextConnection::SWServerToContextConnection):
1841         (WebCore::SWServerToContextConnection::~SWServerToContextConnection):
1842         (WebCore::SWServerToContextConnection::connectionForOrigin):
1843         * workers/service/server/SWServerToContextConnection.h:
1844         (WebCore::SWServerToContextConnection::securityOrigin const):
1845         * workers/service/server/SWServerWorker.cpp:
1846         (WebCore::SWServerWorker::origin const):
1847         (WebCore::SWServerWorker::securityOrigin const):
1848         * workers/service/server/SWServerWorker.h:
1849
1850 2018-03-24  Commit Queue  <commit-queue@webkit.org>
1851
1852         Unreviewed, rolling out r229792.
1853         https://bugs.webkit.org/show_bug.cgi?id=183980
1854
1855         not actually necessary (Requested by thorton on #webkit).
1856
1857         Reverted changeset:
1858
1859         "Fix the build"
1860         https://trac.webkit.org/changeset/229792
1861
1862 2018-03-23  Tim Horton  <timothy_horton@apple.com>
1863
1864         Fix the geolocation build
1865         https://bugs.webkit.org/show_bug.cgi?id=183975
1866
1867         * Modules/geolocation/ios/GeolocationPositionIOS.mm:
1868         (WebCore::GeolocationPosition::GeolocationPosition):
1869
1870 2018-03-23  Tim Horton  <timothy_horton@apple.com>
1871
1872         Fix the build with no pasteboard
1873         https://bugs.webkit.org/show_bug.cgi?id=183973
1874
1875         Reviewed by Dan Bernstein.
1876
1877         * Configurations/FeatureDefines.xcconfig:
1878         * platform/ios/PlatformPasteboardIOS.mm:
1879
1880 2018-03-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1881
1882         [Extra zoom mode] Fix some localizable strings after r229878
1883         https://bugs.webkit.org/show_bug.cgi?id=183963
1884
1885         Reviewed by Tim Horton.
1886
1887         The WEB_UI_STRING macro was incorrectly used for certain localized strings pertaining to extra zoom mode. To
1888         correct this, make the "Done" string use WEB_UI_STRING with actual UI-facing text; since day, year and month
1889         labels in the date picker are less generalizable to other UI, leave these as unique keys, but change them to
1890         use WEB_UI_STRING_KEY instead.
1891
1892         Additionally, remove now-unused localizable strings for the text input view controller.
1893
1894         * English.lproj/Localizable.strings:
1895         * platform/LocalizedStrings.cpp:
1896         (WebCore::formControlDoneButtonTitle):
1897         (WebCore::datePickerDayLabelTitle):
1898         (WebCore::datePickerMonthLabelTitle):
1899         (WebCore::datePickerYearLabelTitle):
1900
1901 2018-03-23  Chris Dumez  <cdumez@apple.com>
1902
1903         NetworkStateNotifier::updateStateWithoutNotifying() is inefficient
1904         https://bugs.webkit.org/show_bug.cgi?id=183760
1905         <rdar://problem/37093299>
1906
1907         Reviewed by Ryosuke Niwa.
1908
1909         Update NetworkStateNotifier::updateStateWithoutNotifying() to stop calling
1910         SCDynamicStoreCopyKeyList(). SCDynamicStoreCopyKeyList() is expensive as it
1911         expects its key parameter to be a regular expression and it can match several
1912         keys. It is also unnecessary in our case since we already have an exact key.
1913         We now call the more efficient SCDynamicStoreCopyValue() instead, which is
1914         the right thing to call when we have an exact key.
1915
1916         This change was suggested by the SC team.
1917
1918         This was tested manually as there is no easy way to write an automated test
1919         for this.
1920
1921         In a follow-up, I also plan to call this code in the UIProcess (or NetworkProcess)
1922         to avoid calling it once per WebProcess.
1923
1924         * platform/network/mac/NetworkStateNotifierMac.cpp:
1925         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying):
1926
1927 2018-03-23  Daniel Bates  <dabates@apple.com>
1928
1929         Unreviewed, rolling out r229868.
1930
1931         Caused media controls tests to timeout. Will investigate
1932         offline.
1933
1934         Reverted changeset:
1935
1936         "CSS mask images should be retrieved using potentially CORS-
1937         enabled fetch"
1938         https://bugs.webkit.org/show_bug.cgi?id=179983
1939         https://trac.webkit.org/changeset/229868
1940
1941 2018-03-23  Mark Lam  <mark.lam@apple.com>
1942
1943         Add pointer profiling hooks to the CSS JIT.
1944         https://bugs.webkit.org/show_bug.cgi?id=183947
1945         <rdar://problem/38803593>
1946
1947         Reviewed by JF Bastien.
1948
1949         No new tests needed.  Covered by existing tests.
1950
1951         * bindings/scripts/CodeGeneratorJS.pm:
1952         (GenerateImplementation):
1953         - Added a missing application of WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION().
1954
1955         * bindings/scripts/test/JS/JSInterfaceName.cpp:
1956         (WebCore::toJSNewlyCreated):
1957         * bindings/scripts/test/JS/JSMapLike.cpp:
1958         (WebCore::toJSNewlyCreated):
1959         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
1960         (WebCore::toJSNewlyCreated):
1961         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1962         (WebCore::toJSNewlyCreated):
1963         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
1964         (WebCore::toJSNewlyCreated):
1965         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
1966         (WebCore::toJSNewlyCreated):
1967         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
1968         (WebCore::toJSNewlyCreated):
1969         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
1970         (WebCore::toJSNewlyCreated):
1971         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
1972         (WebCore::toJSNewlyCreated):
1973         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
1974         (WebCore::toJSNewlyCreated):
1975         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1976         (WebCore::toJSNewlyCreated):
1977         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1978         (WebCore::toJSNewlyCreated):
1979         * bindings/scripts/test/JS/JSTestException.cpp:
1980         (WebCore::toJSNewlyCreated):
1981         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
1982         (WebCore::toJSNewlyCreated):
1983         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1984         (WebCore::toJSNewlyCreated):
1985         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
1986         (WebCore::toJSNewlyCreated):
1987         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
1988         (WebCore::toJSNewlyCreated):
1989         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
1990         (WebCore::toJSNewlyCreated):
1991         * bindings/scripts/test/JS/JSTestIterable.cpp:
1992         (WebCore::toJSNewlyCreated):
1993         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
1994         (WebCore::toJSNewlyCreated):
1995         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
1996         (WebCore::toJSNewlyCreated):
1997         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
1998         (WebCore::toJSNewlyCreated):
1999         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
2000         (WebCore::toJSNewlyCreated):
2001         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2002         (WebCore::toJSNewlyCreated):
2003         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
2004         (WebCore::toJSNewlyCreated):
2005         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
2006         (WebCore::toJSNewlyCreated):
2007         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
2008         (WebCore::toJSNewlyCreated):
2009         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
2010         (WebCore::toJSNewlyCreated):
2011         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
2012         (WebCore::toJSNewlyCreated):
2013         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
2014         (WebCore::toJSNewlyCreated):
2015         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
2016         (WebCore::toJSNewlyCreated):
2017         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
2018         (WebCore::toJSNewlyCreated):
2019         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
2020         (WebCore::toJSNewlyCreated):
2021         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
2022         (WebCore::toJSNewlyCreated):
2023         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
2024         (WebCore::toJSNewlyCreated):
2025         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
2026         (WebCore::toJSNewlyCreated):
2027         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
2028         (WebCore::toJSNewlyCreated):
2029         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
2030         (WebCore::toJSNewlyCreated):
2031         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
2032         (WebCore::toJSNewlyCreated):
2033         * bindings/scripts/test/JS/JSTestNode.cpp:
2034         (WebCore::toJSNewlyCreated):
2035         * bindings/scripts/test/JS/JSTestObj.cpp:
2036         (WebCore::toJSNewlyCreated):
2037         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2038         (WebCore::toJSNewlyCreated):
2039         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2040         (WebCore::toJSNewlyCreated):
2041         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2042         (WebCore::toJSNewlyCreated):
2043         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
2044         (WebCore::toJSNewlyCreated):
2045         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
2046         (WebCore::toJSNewlyCreated):
2047         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2048         (WebCore::toJSNewlyCreated):
2049         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2050         (WebCore::toJSNewlyCreated):
2051         * bindings/scripts/test/JS/JSTestStringifier.cpp:
2052         (WebCore::toJSNewlyCreated):
2053         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
2054         (WebCore::toJSNewlyCreated):
2055         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
2056         (WebCore::toJSNewlyCreated):
2057         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
2058         (WebCore::toJSNewlyCreated):
2059         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
2060         (WebCore::toJSNewlyCreated):
2061         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
2062         (WebCore::toJSNewlyCreated):
2063         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
2064         (WebCore::toJSNewlyCreated):
2065         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2066         (WebCore::toJSNewlyCreated):
2067         * css/ElementRuleCollector.cpp:
2068         (WebCore::ElementRuleCollector::ruleMatches):
2069         * cssjit/SelectorCompiler.cpp:
2070         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
2071         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker):
2072         * cssjit/SelectorCompiler.h:
2073         (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction):
2074         (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction):
2075         (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext):
2076         (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext):
2077         * dom/SelectorQuery.cpp:
2078         (WebCore::SelectorDataList::executeCompiledSingleMultiSelectorData const):
2079         (WebCore::SelectorDataList::execute const):
2080
2081 2018-03-23  Sihui Liu  <sihui_liu@apple.com>
2082
2083         Local storage getItem() for an empty string returned UNDEFINED value.
2084         https://bugs.webkit.org/show_bug.cgi?id=69138
2085         <rdar://problem/13410974>
2086
2087         Reviewed by Brady Eidson.
2088
2089         * platform/sql/SQLiteStatement.cpp:
2090         (WebCore::SQLiteStatement::getColumnBlobAsString):
2091
2092 2018-03-23  Chris Dumez  <cdumez@apple.com>
2093
2094         Promptly terminate service worker processes when they are no longer needed
2095         https://bugs.webkit.org/show_bug.cgi?id=183873
2096         <rdar://problem/38676995>
2097
2098         Reviewed by Youenn Fablet.
2099
2100         The StorageProcess now keeps track of service worker clients for each security
2101         origin. When there is no longer any clients for a given security origin, the
2102         StorageProcess asks the service worker process for the given origin to terminate
2103         and severs its connection to it.
2104
2105         Change is covered by API test.
2106
2107         * workers/service/server/SWServer.cpp:
2108         (WebCore::SWServer::markAllWorkersForOriginAsTerminated):
2109         Pass the security origin since this is called when a service worker process
2110         crashes. When a service worker process for origin A crashes, we only want
2111         to mark service workers in origin A as terminated, not ALL of them.
2112
2113         (WebCore::SWServer::registerServiceWorkerClient):
2114         (WebCore::SWServer::unregisterServiceWorkerClient):
2115         (WebCore::SWServer::needsServerToContextConnectionForOrigin const):
2116         Tweak logic so that we only relaunch a service worker process if we still
2117         have clients for its security origin.
2118
2119         * workers/service/server/SWServer.h:
2120         (WebCore::SWServer::disableServiceWorkerProcessTerminationDelay):
2121         Add a way to disable the service worker termination delay to facilitate
2122         testing.
2123
2124         * workers/service/server/SWServerToContextConnection.h:
2125
2126 2018-03-23  Brady Eidson  <beidson@apple.com>
2127
2128         Go to back/forward list items after a process-swapped navigation.
2129         <rdar://problem/38690544> and https://bugs.webkit.org/show_bug.cgi?id=183920
2130
2131         Reviewed by Andy Estes.
2132
2133         Covered by new API test.
2134
2135         Most of the changes to WebCore are teaching HistoryItem navigations to know when they should
2136         do a policy check or not.
2137
2138         * WebCore.xcodeproj/project.pbxproj:
2139
2140         * history/BackForwardController.cpp:
2141         (WebCore::BackForwardController::goBackOrForward):
2142         (WebCore::BackForwardController::goBack):
2143         (WebCore::BackForwardController::goForward):
2144
2145         * history/HistoryItem.cpp:
2146         (WebCore::HistoryItem::setStateObject): Actually push state object changes to the UIProcess.
2147           This was a long standing bug that made it difficult to effectively test this change.
2148
2149         * loader/FrameLoader.cpp:
2150         (WebCore::FrameLoader::loadURLIntoChildFrame):
2151         (WebCore::FrameLoader::loadDifferentDocumentItem):
2152         (WebCore::FrameLoader::loadItem):
2153         (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad):
2154         * loader/FrameLoader.h:
2155         * loader/FrameLoaderTypes.h:
2156
2157         * loader/HistoryController.cpp:
2158         (WebCore::HistoryController::goToItem):
2159         (WebCore::HistoryController::setDefersLoading):
2160         (WebCore::HistoryController::recursiveGoToItem):
2161         * loader/HistoryController.h:
2162
2163         * loader/NavigationPolicyCheck.h:
2164
2165         * page/Page.cpp:
2166         (WebCore::Page::goToItem):
2167         * page/Page.h:
2168
2169 2018-03-23  John Wilander  <wilander@apple.com>
2170
2171         Resource Load Statistics: Fix decoder key isPrevalentResource->isVeryPrevalentResource
2172         https://bugs.webkit.org/show_bug.cgi?id=183950
2173         <rdar://problem/38806275>
2174
2175         Reviewed by Brent Fulgham.
2176
2177         * loader/ResourceLoadStatistics.cpp:
2178         (WebCore::ResourceLoadStatistics::decode):
2179             Now isVeryPrevalentResource is decoded to the correct field.
2180
2181 2018-03-23  Youenn Fablet  <youenn@apple.com>
2182
2183         WebProcessPool should not ask to register all clients for each service worker process creation
2184         https://bugs.webkit.org/show_bug.cgi?id=183941
2185
2186         Reviewed by Chris Dumez.
2187
2188         Covered by existing unit tests.
2189         Register all Documents of a process no matter its session ID when asked to.
2190         Make sure that whenever a WebProcess is asked to do so, any further Document will be registered
2191         by calling setMayHaveRegisteredServiceWorkers().
2192         This ensures that a WebProcess created before any service worker but empty at the time a service worker is created
2193         will actually register all its future clients.
2194
2195         Add some assertions to ensure that a client is not registered twice.
2196
2197         * workers/service/ServiceWorkerProvider.cpp:
2198         (WebCore::ServiceWorkerProvider::registerServiceWorkerClients):
2199         * workers/service/ServiceWorkerProvider.h:
2200         * workers/service/server/SWServer.cpp:
2201         (WebCore::SWServer::registerServiceWorkerClient):
2202
2203 2018-03-23  Eric Carlson  <eric.carlson@apple.com>
2204
2205         HTMLElement factory doesn't need to call MediaPlayer::isAvailable
2206         https://bugs.webkit.org/show_bug.cgi?id=183946
2207         <rdar://problem/38802687>
2208
2209         Reviewed by Youenn Fablet.
2210
2211         Test: media/media-disabled.html
2212
2213         * dom/make_names.pl:
2214         (printConstructorInterior):
2215         * page/Settings.yaml:
2216         * page/SettingsDefaultValues.h:
2217
2218 2018-03-23  David Kilzer  <ddkilzer@apple.com>
2219
2220         Stop using dispatch_set_target_queue()
2221         <https://webkit.org/b/183908>
2222         <rdar://problem/33553533>
2223
2224         Reviewed by Daniel Bates.
2225
2226         No new tests since no change in behavior.
2227
2228         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2229         (WebCore::globaVideoCaptureSerialQueue): Remove use of
2230         dispatch_set_target_queue() by changing dispatch_queue_create()
2231         to dispatch_queue_create_with_target().
2232
2233 2018-03-23  Youenn Fablet  <youenn@apple.com>
2234
2235         Use libwebrtc ObjectiveC H264 encoder and decoder
2236         https://bugs.webkit.org/show_bug.cgi?id=183912
2237
2238         Reviewed by Eric Carlson.
2239
2240         No observable change of behavior.
2241         Made use of libwebrtc WebKit utilities.
2242         Updated RealtimeINcomingVideoSourceCocoa as it now receives ObjcVideoFrame.
2243
2244         * Configurations/WebCore.xcconfig:
2245         * SourcesCocoa.txt:
2246         * WebCore.xcodeproj/project.pbxproj:
2247         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
2248         (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa):
2249         (WebCore::LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed):
2250         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
2251         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
2252         (WebCore::LibWebRTCProviderCocoa::setActive):
2253         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
2254         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: Renamed from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp.
2255         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
2256         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
2257         * testing/Internals.cpp: Removed commented out include.
2258
2259 2018-03-23  Youenn Fablet  <youenn@apple.com>
2260
2261         DocumentThreadableLoader should send credentials after redirections and preflight if fetch option credentials is include
2262         https://bugs.webkit.org/show_bug.cgi?id=183928
2263
2264         Reviewed by Chris Dumez.
2265
2266         Tests: imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-redirect.any.html
2267                imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-redirect.any.worker.html
2268
2269         In case mode is include, keep sending credentials even after redirection with preflight.
2270
2271         * loader/DocumentThreadableLoader.cpp:
2272         (WebCore::DocumentThreadableLoader::redirectReceived):
2273
2274 2018-03-23  Tim Horton  <timothy_horton@apple.com>
2275
2276         Fix the build after r229858
2277
2278         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
2279
2280 2018-03-23  Youenn Fablet  <youenn@apple.com>
2281
2282         Allow fully whitelisted plug-ins to match non HTTP URLs
2283         https://bugs.webkit.org/show_bug.cgi?id=183938
2284         rdar://problem/38534312
2285
2286         Reviewed by Chris Dumez.
2287
2288         Covered by manual testing and unit testing.
2289
2290         * platform/URL.cpp:
2291         (WebCore::URL::isMatchingDomain const):
2292
2293 2018-03-23  Youenn Fablet  <youenn@apple.com>
2294
2295         ActiveDOMObject should assert that they are destroyed in the thread they are created
2296         https://bugs.webkit.org/show_bug.cgi?id=183671
2297
2298         Reviewed by Chris Dumez.
2299
2300         No change of behavior.
2301         Moved MessagePort assertion to ActiveDOMObject.
2302
2303         * dom/ActiveDOMObject.cpp:
2304         (WebCore::ActiveDOMObject::~ActiveDOMObject):
2305         * dom/ActiveDOMObject.h:
2306         * dom/MessagePort.cpp:
2307         (WebCore::MessagePort::~MessagePort):
2308         * dom/MessagePort.h:
2309
2310 2018-03-23  Youenn Fablet  <youenn@apple.com>
2311
2312         Safari WebKitWebRTCAudioModule crash during <video> tag update when audio track present in MediaStream
2313         https://bugs.webkit.org/show_bug.cgi?id=181180
2314         <rdar://problem/36302375>
2315
2316         Reviewed by Eric Carlson.
2317
2318         Test: webrtc/video-update-often.html
2319
2320         AudioTrackPrivateMediaStreamCocoa needs to be destroyed in the main thread since it owns a Ref to its MediaStreamTrackPrivate.
2321         We can still ref it on a background thread but we always deref it on the main thread.
2322
2323         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
2324         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
2325         (WebCore::AudioTrackPrivateMediaStreamCocoa::render):
2326
2327 2018-03-23  Sergio Villar Senin  <svillar@igalia.com>
2328
2329         [css-grid] Fix auto repeat tracks computation with definite min sizes
2330         https://bugs.webkit.org/show_bug.cgi?id=183933
2331
2332         Reviewed by Javier Fernandez.
2333
2334         Indefinitely sized containers use the specified definite min-size (if any) as available
2335         space in order to compute the number of auto repeat tracks to create. A bug in that code was
2336         causing the grid to be one track larger than expected. That was only happening in the case
2337         of the free space being a multiple of the total size of the autorepeat tracks.
2338
2339         Test: imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-inline-auto-repeat-001.html
2340
2341         * rendering/RenderGrid.cpp:
2342         (WebCore::RenderGrid::computeAutoRepeatTracksCount const):
2343
2344 2018-03-23  Miguel Gomez  <magomez@igalia.com>
2345
2346         [GTK][WPE] Avoid software color conversion inside BitmapTextureGL
2347         https://bugs.webkit.org/show_bug.cgi?id=183892
2348
2349         Reviewed by Žan Doberšek.
2350
2351         Always use RGBA format on BitmapTextureGL (when no other format is specifically requested). When
2352         the texture is updated from BGRA content, use a flag to indicate the shader to perform a color
2353         conversion during the painting. This way we don't need to swap the R and B components on the CPU.
2354         Also, remove one of the lists in BitmapTexturePool as now all of them have the same format, and
2355         remove the UpdateContentsFlag as we never need to modify the original image data.
2356
2357         Covered by existent tests.
2358
2359         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2360         (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture):
2361         * platform/graphics/texmap/BitmapTexture.cpp:
2362         (WebCore::BitmapTexture::updateContents):
2363         * platform/graphics/texmap/BitmapTexture.h:
2364         * platform/graphics/texmap/BitmapTextureGL.cpp:
2365         (WebCore::BitmapTextureGL::BitmapTextureGL):
2366         (WebCore::BitmapTextureGL::didReset):
2367         (WebCore::BitmapTextureGL::updateContents):
2368         (WebCore::BitmapTextureGL::applyFilters):
2369         (WebCore::swizzleBGRAToRGBA): Deleted.
2370         (WebCore::BitmapTextureGL::updateContentsNoSwizzle): Deleted.
2371         * platform/graphics/texmap/BitmapTextureGL.h:
2372         (WebCore::BitmapTextureGL::colorConvertFlags const):
2373         * platform/graphics/texmap/BitmapTexturePool.cpp:
2374         (WebCore::BitmapTexturePool::acquireTexture):
2375         (WebCore::BitmapTexturePool::releaseUnusedTexturesTimerFired):
2376         * platform/graphics/texmap/BitmapTexturePool.h:
2377         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
2378         (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
2379         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
2380         (WebCore::TextureMapperContextAttributes::get):
2381         * platform/graphics/texmap/TextureMapperContextAttributes.h:
2382         * platform/graphics/texmap/TextureMapperGL.cpp:
2383         (WebCore::TextureMapperGL::drawNumber):
2384         (WebCore::TextureMapperGL::drawTexture):
2385         * platform/graphics/texmap/TextureMapperGL.h:
2386         * platform/graphics/texmap/TextureMapperLayer.cpp:
2387         (WebCore::TextureMapperLayer::paintIntoSurface):
2388         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
2389         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
2390         * platform/graphics/texmap/TextureMapperTile.cpp:
2391         (WebCore::TextureMapperTile::updateContents):
2392         * platform/graphics/texmap/TextureMapperTile.h:
2393         * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
2394         (WebCore::TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded):
2395         (WebCore::TextureMapperTiledBackingStore::updateContents):
2396         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
2397
2398 2018-03-23  Yusuke Suzuki  <utatane.tea@gmail.com>
2399
2400         [WTF] Add standard containers with FastAllocator specialization
2401         https://bugs.webkit.org/show_bug.cgi?id=183789
2402
2403         Reviewed by Darin Adler.
2404
2405         * Modules/indexeddb/IDBKeyData.h:
2406         * Modules/mediasource/SampleMap.h:
2407         * Modules/mediasource/SourceBuffer.cpp:
2408         * Modules/webauthn/cbor/CBORValue.h:
2409         It did not use FastAllocator for its container.
2410
2411         * page/WheelEventTestTrigger.h:
2412         * platform/audio/PlatformMediaSessionManager.h:
2413         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
2414         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
2415         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2416         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2417         * platform/graphics/cv/VideoTextureCopierCV.cpp:
2418         (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction):
2419         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
2420         * platform/wpe/PlatformPasteboardWPE.cpp:
2421         * rendering/OrderIterator.h:
2422
2423 2018-03-23  Antoine Quint  <graouts@apple.com>
2424
2425         [Web Animations] infinite repeat counts aren't reflected for CSS Animations
2426         https://bugs.webkit.org/show_bug.cgi?id=183932
2427
2428         Reviewed by Dean Jackson.
2429
2430         The "infinite" value for animation-repeat-count is reflected as a special value which resolves to -1. We need to check
2431         for this special value before setting the iterations count on the AnimationEffectTimingReadOnly object.
2432
2433         * animation/CSSAnimation.cpp:
2434         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
2435
2436 2018-03-22  Antoine Quint  <graouts@apple.com>
2437
2438         [Web Animations] Correctly cancel animations when a parent gets a "display: none" style or when an element is removed
2439         https://bugs.webkit.org/show_bug.cgi?id=183919
2440
2441         Reviewed by Dean Jackson.
2442
2443         The old CSSAnimationController provided a cancelAnimations(Element&) method that allowed for animations for a given element
2444         to be canceled when a parent element in the hierarchy gets a "display: none" style or if an element with animations is removed.
2445         We add a similar cancelAnimationsForElement(Element&) method on AnimationTimeline and update CSSAnimationController::cancelAnimations()
2446         call sites to use AnimationTimeline::cancelAnimationsForElement() when the flag to use Web Animations is on.
2447
2448         * animation/AnimationTimeline.cpp:
2449         (WebCore::AnimationTimeline::cancelAnimationsForElement): Iterate over all animations for the provided element and call cancel() on them.
2450         * animation/AnimationTimeline.h:
2451         * animation/DocumentTimeline.cpp:
2452         (WebCore::DocumentTimeline::animatedStyleForRenderer): Drive-by fix while I was reviewed call sites to animationsForElement() to make
2453         sure we don't create extra RefPtr<> objects.
2454         * dom/Element.cpp:
2455         (WebCore::Element::removedFromAncestor): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on when an
2456         element is removed.
2457         * dom/PseudoElement.cpp:
2458         (WebCore::PseudoElement::clearHostElement): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on when
2459         a pseudo-element is removed.
2460         * rendering/updating/RenderTreeUpdater.cpp:
2461         (WebCore::RenderTreeUpdater::tearDownRenderers): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on
2462         for all children elements when an element gets a "display: none" style.
2463
2464 2018-03-23  Antoine Quint  <graouts@apple.com>
2465
2466         [Web Animations] Animated transform styles are ignored when calling getComputedStyle()
2467         https://bugs.webkit.org/show_bug.cgi?id=183918
2468
2469         Reviewed by Dean Jackson.
2470
2471         Strictly looking at whether the renderer has a transform is a bad idea when determining whether a
2472         transform is applied for an element. Looking at the RenderStyle is preferable because in the case
2473         of animations running on the compositor, such as a transform-only animation or transition, the
2474         renderer doesn't necessarily have a transform style on it, since we don't blend properties in
2475         software as the animation progresses. Instead, all of the blending is performed by the compositor,
2476         and only the computed style object has the software-blended transform style on it.
2477
2478         We do need to account for inline renderers though as these do not support transforms.
2479
2480         * css/CSSComputedStyleDeclaration.cpp:
2481         (WebCore::computedTransform):
2482
2483 2018-03-22  Antoine Quint  <graouts@apple.com>
2484
2485         [Web Animations] Support "transition: all" for CSS Transitions as Web Animations
2486         https://bugs.webkit.org/show_bug.cgi?id=183917
2487
2488         Reviewed by Dean Jackson.
2489
2490         We now support "transition: all" CSS Transitions by iterating over all known CSS properties should the mode
2491         of the backing animation be AnimateAll. Any property that we find to have a different value in the previous
2492         and current style will have a backing CSSTransition object created for it. To support this, we now explicitly
2493         provide a CSSPropertyID when creating a CSSTransition since we can no longer infer the transition property
2494         from the backing animation, as Animation objects with mode AnimateAll report CSSPropertyInvalid as their
2495         property.
2496
2497         * animation/AnimationTimeline.cpp:
2498         (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): New method that checks whether a given backing
2499         Animation object is suitable for consideration as a CSSTransition, where the mode must not be either AnimateNone
2500         or AnimateUnknownProperty, and should the mode be AnimateSingleProperty, the property must not be CSSPropertyInvalid.
2501         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): We now assemble the list of previously animated
2502         properties by looking at the m_elementToCSSTransitionByCSSPropertyID map and getting its keys. Then we compile
2503         all backing Animation objects found in the old style that match the conditions enforced by the new method
2504         shouldBackingAnimationBeConsideredForCSSTransition(). Then as we iterate over backing Animation objects found
2505         in the new style, we iterate over all known CSS properties if the mode is AnimateAll, indicating that we're dealing
2506         with a "transition: all" style. If we're dealing with a single property, we only process that single property.
2507         * animation/CSSTransition.cpp:
2508         (WebCore::CSSTransition::create): Expect a new CSSPropertyID parameter when creating a new CSSTransition since
2509         we can no longer infer it from the backing Animation object.
2510         (WebCore::CSSTransition::CSSTransition): Expect a new CSSPropertyID parameter when creating a new CSSTransition
2511         since we can no longer infer it from the backing Animation object.
2512         (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): We can no longer use the == overloaded operator
2513         for backing Animation objects to determine whether their respective properties match since this would compare the
2514         "property" member of both Animation objects and when going from a "transition: all" style to one targeting a single
2515         property, we would falsely identify mis-matching Animation objects. Instead, we pass a false flag to animationsMatch()
2516         which indicates that we don't care about matching the transition property itself.
2517         * animation/CSSTransition.h: Expose a new property() accessor which returns the CSSPropertyID passed at construction.
2518         * animation/KeyframeEffectReadOnly.cpp:
2519         (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes): Use the new property() accessor on
2520         CSSTransition to get at the transition property.
2521         * platform/animation/Animation.cpp:
2522         (WebCore::Animation::animationsMatch const): Replace the boolean parameter, which was not in use in WebCore, to indicate
2523         whether we should match the property-related fields. We need this in CSSTransition::matchesBackingAnimationAndStyles().
2524         * platform/animation/Animation.h:
2525
2526 2018-03-22  Tim Horton  <timothy_horton@apple.com>
2527
2528         Adopt WK_ALTERNATE_FRAMEWORKS_DIR in WebCore
2529         https://bugs.webkit.org/show_bug.cgi?id=183930
2530         <rdar://problem/38782249>
2531
2532         Reviewed by Dan Bernstein.
2533
2534         * Configurations/Base.xcconfig:
2535         * Configurations/WebCore.xcconfig:
2536         * Configurations/WebCoreTestSupport.xcconfig:
2537
2538 2018-03-22  Commit Queue  <commit-queue@webkit.org>
2539
2540         Unreviewed, rolling out r229876.
2541         https://bugs.webkit.org/show_bug.cgi?id=183929
2542
2543         Some webrtc tests are timing out on iOS simulator (Requested
2544         by youenn on #webkit).
2545
2546         Reverted changeset:
2547
2548         "Use libwebrtc ObjectiveC H264 encoder and decoder"
2549         https://bugs.webkit.org/show_bug.cgi?id=183912
2550         https://trac.webkit.org/changeset/229876
2551
2552 2018-03-22  Megan Gardner  <megan_gardner@apple.com>
2553
2554         Expose more system colors via CSS
2555         https://bugs.webkit.org/show_bug.cgi?id=183764
2556         <rdar://problem/36975898>
2557
2558         Reviewed by Tim Horton.
2559
2560         Test: fast/css/apple-system-control-colors.html
2561
2562         Expose Apple specific system colors via CSS.
2563
2564         * rendering/RenderThemeMac.mm:
2565         (WebCore::RenderThemeMac::systemColor const):
2566
2567 2018-03-22  Nan Wang  <n_wang@apple.com>
2568
2569         AX: Web table row count is incorrect when role row is added to <tr> in DOM
2570         https://bugs.webkit.org/show_bug.cgi?id=183922
2571
2572         Reviewed by Chris Fleizach.
2573
2574         Although the parent table for an ARIA grid row should be an ARIA table, we
2575         should return the native table if the row is native <tr>.
2576
2577         Test: accessibility/row-with-aria-role-in-native-table.html
2578
2579         * accessibility/AccessibilityARIAGridRow.cpp:
2580         (WebCore::AccessibilityARIAGridRow::parentTable const):
2581
2582 2018-03-22  Chris Dumez  <cdumez@apple.com>
2583
2584         Include security origin in the service worker process name
2585         https://bugs.webkit.org/show_bug.cgi?id=183913
2586
2587         Reviewed by Youenn Fablet.
2588
2589         Updated localizable strings.
2590
2591         * English.lproj/Localizable.strings:
2592
2593 2018-03-22  Youenn Fablet  <youenn@apple.com>
2594
2595         Use libwebrtc ObjectiveC H264 encoder and decoder
2596         https://bugs.webkit.org/show_bug.cgi?id=183912
2597
2598         Reviewed by Eric Carlson.
2599
2600         No observable change of behavior.
2601         Made use of libwebrtc WebKit utilities.
2602         Updated RealtimeINcomingVideoSourceCocoa as it now receives ObjcVideoFrame.
2603
2604         * Configurations/WebCore.xcconfig:
2605         * SourcesCocoa.txt:
2606         * WebCore.xcodeproj/project.pbxproj:
2607         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
2608         (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa):
2609         (WebCore::LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed):
2610         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
2611         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
2612         (WebCore::LibWebRTCProviderCocoa::setActive):
2613         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
2614         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: Renamed from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp.
2615         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
2616         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
2617         * testing/Internals.cpp: Removed commented out include.
2618
2619 2018-03-22  Michael Catanzaro  <mcatanzaro@gnome.org>
2620
2621         Unreviewed, fix format string warnings in service worker code
2622
2623         On Linux x86_64, uint64_t is unsigned long, not unsigned long long.
2624
2625         * workers/service/ServiceWorkerContainer.cpp:
2626         (WebCore::ServiceWorkerContainer::addRegistration):
2627         (WebCore::ServiceWorkerContainer::removeRegistration):
2628         (WebCore::ServiceWorkerContainer::updateRegistration):
2629         (WebCore::ServiceWorkerContainer::jobFailedWithException):
2630         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2631         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
2632         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
2633         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
2634         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
2635
2636 2018-03-22  Daniel Bates  <dabates@apple.com>
2637
2638         Expose SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() as WebKit SPI
2639         https://bugs.webkit.org/show_bug.cgi?id=183907
2640         <rdar://problem/38759127>
2641
2642         Reviewed by Alex Christensen.
2643
2644         Exports SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() so that we can use it from WebKit.
2645
2646         * platform/SchemeRegistry.h:
2647
2648 2018-03-22  Daniel Bates  <dabates@apple.com>
2649
2650         CSS mask images should be retrieved using potentially CORS-enabled fetch
2651         https://bugs.webkit.org/show_bug.cgi?id=179983
2652         <rdar://problem/35678149>
2653
2654         Reviewed by Brent Fulgham.
2655
2656         As per <https://drafts.fxtf.org/css-masking-1/#priv-sec> (Editor's Draft, 23 December 2017)
2657         we should fetch CSS mask images using a potentially CORS-enabled fetch.
2658
2659         Both cross-origin CSS shape-outside images and CSS mask images may be sensitive to timing
2660         attacks that can be used to reveal their pixel data when retrieved without regard to CORS.
2661         For the same reason that we fetch CSS shape-outside images using a potentially CORS-enabled
2662         fetch we should fetch CSS mask the same way. This also makes the behavior of WebKit more
2663         closely align with the behavior in the spec.
2664
2665         Test: http/tests/security/css-mask-image.html
2666
2667         * style/StylePendingResources.cpp: Substitute LoadPolicy::NoCORS and LoadPolicy::Anonymous for
2668         LoadPolicy::Normal and LoadPolicy::ShapeOutside, respectively, to match the terminology used
2669         in the HTML, CSS Shapes Module Level 1, and CSS Masking Module Level 1 specs.
2670         (WebCore::Style::loadPendingImage): Ditto.
2671         (WebCore::Style::loadPendingResources): Use load policy LoadPolicy::Anonymous when fetching
2672         a mask image or shape-outside image.
2673
2674 2018-03-22  Zalan Bujtas  <zalan@apple.com>
2675
2676         [Simple line layout] Text with letter spacing is not positioned properly.
2677         https://bugs.webkit.org/show_bug.cgi?id=183079
2678         <rdar://problem/38762569>
2679
2680         Reviewed by Antti Koivisto.
2681
2682         We need to recompute RenderText::m_canUseSimplifiedTextMeasuring when the font cascade changes
2683         since we might not be able to use the fast path anymore.
2684
2685         Test: fast/text/simple-line-layout-dynamic-letter-word-spacing.html
2686
2687         * rendering/RenderText.cpp:
2688         (WebCore::RenderText::styleDidChange):
2689
2690 2018-03-21  Antoine Quint  <graouts@apple.com>
2691
2692         [Web Animations] Make imported/mozilla/css-animations/test_event-dispatch.html pass reliably
2693         https://bugs.webkit.org/show_bug.cgi?id=183845
2694
2695         Reviewed by Dean Jackson.
2696
2697         Finish the work to get DOM events for CSS Animations and CSS Transitions dispatching as specified.
2698
2699         * animation/AnimationEffectReadOnly.cpp: Move timeEpsilon to be shared as part of WebAnimationUtilities.h since we now need it in
2700         WebAnimation::timeToNextRequiredTick().
2701         * animation/AnimationTimeline.cpp:
2702         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We add a pre-emptive return clause when we know that the AnimationList
2703         for previous and current styles are a match.
2704         * animation/CSSTransition.cpp:
2705         (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Ensure we have a valid effect before downcasting it.
2706         * animation/DeclarativeAnimation.cpp:
2707         (WebCore::DeclarativeAnimation::initialize): We need to call pause() for declarative animations that aren't playing so that the animation's
2708         playState is set correctly and the animation is not idle.
2709         * animation/DocumentTimeline.cpp:
2710         (WebCore::DocumentTimeline::updateAnimationSchedule): We no longer need to pass the current time to timeToNextRequiredTick() since the method has
2711         been reworked to use the animation's current time, which is based on the timeline's current time.
2712         (WebCore::DocumentTimeline::updateAnimations): Avoid creating a copy when iterating over pending hardware animations.
2713         * animation/KeyframeEffectReadOnly.cpp:
2714         (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): We should never generate new blending keyframes if the
2715         old and new styles contain the same value, since there would be no transition between two equal values, and we should only look at whether the new
2716         style value and the recorded target value differ to determine if new blending keyframes are necessary.
2717         * animation/WebAnimation.cpp:
2718         (WebCore::WebAnimation::timeToNextRequiredTick const): We correct our scheduling code which was shown to be broken in several of the newly-imported
2719         Mozilla tests. Any running animation is now scheduled to invalidate again on the next tick, and we use timeEpsilon from WebAnimationUtilities.h to
2720         correctly check if we're right at the active threshold, when we also invalidate on the next tick. If our current time is negative, in other words
2721         when the animation has not yet started, we schedule this animation's next tick to be the negative of that value. In all other cases, no invalidation
2722         needs to be scheduled.
2723         * animation/WebAnimation.h: We move updateFinishedState() to private since this method is not actually used outside of WebAnimation.cpp.
2724         * animation/WebAnimationUtilities.h: Move timeEpsilon to be shared as part of WebAnimationUtilities.h.
2725
2726 2018-03-22  Tim Horton  <timothy_horton@apple.com>
2727
2728         Improve readability of WebCore's OTHER_LDFLAGS
2729         https://bugs.webkit.org/show_bug.cgi?id=183909
2730         <rdar://problem/38760992>
2731
2732         Reviewed by Dan Bernstein.
2733
2734         * Configurations/Base.xcconfig:
2735         * Configurations/FeatureDefines.xcconfig:
2736         * Configurations/WebCore.xcconfig:
2737
2738 2018-03-22  Tim Horton  <timothy_horton@apple.com>
2739
2740         Adopt USE(OPENGL[_ES]) in more places
2741         https://bugs.webkit.org/show_bug.cgi?id=183882
2742         <rdar://problem/37912195>
2743
2744         Reviewed by Dan Bernstein.
2745
2746         * platform/graphics/GraphicsContext3D.h:
2747         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
2748         (WebCore::hasMuxableGPU):
2749         (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
2750         (WebCore::GraphicsContext3D::GraphicsContext3D):
2751         (WebCore::GraphicsContext3D::~GraphicsContext3D):
2752         (WebCore::GraphicsContext3D::makeContextCurrent):
2753         (WebCore::GraphicsContext3D::checkGPUStatus):
2754         (WebCore::GraphicsContext3D::texImageIOSurface2D):
2755         * platform/graphics/cocoa/WebGLLayer.h:
2756         * platform/graphics/cocoa/WebGLLayer.mm:
2757         (-[WebGLLayer initWithGraphicsContext3D:]):
2758         (-[WebGLLayer copyImageSnapshotWithColorSpace:]):
2759         (-[WebGLLayer display]):
2760         * platform/graphics/ios/GraphicsContext3DIOS.h:
2761         * platform/graphics/opengl/Extensions3DOpenGL.cpp:
2762         (WebCore::Extensions3DOpenGL::blitFramebuffer):
2763         (WebCore::Extensions3DOpenGL::createVertexArrayOES):
2764         (WebCore::Extensions3DOpenGL::deleteVertexArrayOES):
2765         (WebCore::Extensions3DOpenGL::isVertexArrayOES):
2766         (WebCore::Extensions3DOpenGL::bindVertexArrayOES):
2767         * platform/graphics/opengl/Extensions3DOpenGL.h:
2768         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
2769         (WebCore::GraphicsContext3D::reshapeFBOs):
2770         (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary):
2771         (WebCore::GraphicsContext3D::renderbufferStorage):
2772         (WebCore::GraphicsContext3D::getIntegerv):
2773         (WebCore::GraphicsContext3D::texImage2D):
2774         (WebCore::GraphicsContext3D::depthRange):
2775         (WebCore::GraphicsContext3D::clearDepth):
2776         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2777         (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
2778         Make it a bit more clear which code is platform-dependent and which code is GL/GLES-dependent.
2779
2780 2018-03-22  Zan Dobersek  <zdobersek@igalia.com>
2781
2782         [TexMap] Make TextureMapperContextAttributes thread-specific
2783         https://bugs.webkit.org/show_bug.cgi?id=183895
2784
2785         Reviewed by Carlos Garcia Campos.
2786
2787         Store the TextureMapperContextAttributes in a thread-specific manner.
2788         The TextureMapperContextAttributes::get() method is now used to retrieve
2789         a reference to that thread-specific object. If it's not been initialized
2790         yet, then the current GL context is used for the initialization, as it
2791         used to be done in the now-removed initialize() method.
2792
2793         TextureMapperPlatformLayerBuffer::clone() method now doesn't need to
2794         be passed a TextureMapperGL object, since the texture can be created
2795         directly by calling BitmapTextureGL::create(), passing the
2796         TextureMapperContextAttributes object that's retrieved from the
2797         thread-specific storage. This further simplifies the
2798         TextureMapperPlatformLayerProxy::Compositor interface, removing the
2799         texmapGL() getter from it.
2800
2801         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2802         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
2803         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
2804         (WebCore::threadSpecificAttributes):
2805         (WebCore::TextureMapperContextAttributes::get):
2806         (WebCore::TextureMapperContextAttributes::initialize): Deleted.
2807         * platform/graphics/texmap/TextureMapperContextAttributes.h:
2808         * platform/graphics/texmap/TextureMapperGL.cpp:
2809         (WebCore::TextureMapperGL::TextureMapperGL):
2810         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
2811         (WebCore::TextureMapperPlatformLayerBuffer::clone):
2812         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
2813         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
2814         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
2815         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
2816
2817 2018-03-22  Zalan Bujtas  <zalan@apple.com>
2818
2819         SVG root is skipped while marking percentage height descendants dirty.
2820         https://bugs.webkit.org/show_bug.cgi?id=183877
2821
2822         Reviewed by Antti Koivisto.
2823
2824         Calling continingBlock() to get to the correct container works as long as the ancestor inline element
2825         renderers are wrapped in anonymous blocks (continuation for example).
2826
2827         While the SVG root renderer is an inline renderer, it is not wrapped or normalized in any way,
2828         so containingBlock() will elegantly skip it and return an SVG root ancestor.
2829         dirtyForLayoutFromPercentageHeightDescendants calls containingBlock() to walk up
2830         on the ancestor chain to mark elements dirty. This fails when there's an SVG subtree in the block chain.
2831         This patch marks the SVG subtree chain dirty to ensure that layout will get to all the dirty leaf renderers 
2832         (note that the SVG subtree is supposed to have only statically positioned elements so parent == containing block).
2833
2834         Covered by existing tests.
2835
2836         * rendering/RenderBlock.cpp:
2837         (WebCore::RenderBlock::dirtyForLayoutFromPercentageHeightDescendants):
2838
2839 2018-03-22  Adrian Perez de Castro  <aperez@igalia.com>
2840
2841         [WPE][GTK] Build failure when ENABLE_VIDEO, ENABLE_WEB_AUDIO and ENABLE_XSLT are disabled
2842         https://bugs.webkit.org/show_bug.cgi?id=183896
2843
2844         Reviewed by Yusuke Suzuki.
2845
2846         No new tests needed.
2847
2848         * bindings/js/JSWebAnimationCustom.cpp: Add missing #include of Document.h
2849
2850 2018-03-21  Chris Dumez  <cdumez@apple.com>
2851
2852         Regression(r229828): WebKit.NoHistoryItemScrollToFragment API test is failing on iOS
2853         https://bugs.webkit.org/show_bug.cgi?id=183886
2854
2855         Reviewed by Wenson Hsieh.
2856
2857         Since r229828, the FrameLoader needs to call FrameLoaderClient::didDecidePolicyForNavigationAction()
2858         whenever a navigation policy decision is made. I added such a call r229828 to
2859         FrameLoader::continueLoadAfterNavigationPolicy() but forgot to add one to
2860         FrameLoader::continueFragmentScrollAfterNavigationPolicy(), which is the equivalent
2861         for fragment navigations.
2862
2863         * loader/FrameLoader.cpp:
2864         (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy):
2865
2866 2018-03-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
2867
2868         Disconnect the SVGPathSegList items from their SVGPathElement before rebuilding a new list
2869         https://bugs.webkit.org/show_bug.cgi?id=183723
2870         <rdar://problem/38517871>
2871
2872         Reviewed by Daniel Bates.
2873
2874         When setting the "d" attribute directly on a path, we rebuild the list
2875         of path segments held for creating the property tear off. The old path
2876         segments need to get disconnected from the path element. We already do 
2877         that when a path segment is replaced or removed.
2878
2879         Test: svg/dom/reuse-pathseg-after-changing-d.html
2880
2881         * svg/SVGPathElement.cpp:
2882         (WebCore::SVGPathElement::svgAttributeChanged):
2883         * svg/SVGPathSegList.cpp:
2884         (WebCore::SVGPathSegList::clear): SVGPathSegListValues::clearContextAndRoles()
2885         will now be called from SVGPathSegListValues::clear() via SVGListProperty::clearValues().
2886         (WebCore::SVGPathSegList::replaceItem):
2887         (WebCore::SVGPathSegList::removeItem):
2888         (WebCore::SVGPathSegList::clearContextAndRoles): Deleted.
2889         * svg/SVGPathSegList.h: SVGPathSegListValues::clearContextAndRoles() will
2890         now be called from SVGPathSegListValues::clear() via SVGListProperty::initializeValues().
2891         * svg/SVGPathSegListValues.cpp:
2892         (WebCore::SVGPathSegListValues::clearItemContextAndRole):
2893         (WebCore::SVGPathSegListValues::clearContextAndRoles):
2894         * svg/SVGPathSegListValues.h:
2895         (WebCore::SVGPathSegListValues::operator=):
2896         (WebCore::SVGPathSegListValues::clear):
2897
2898 2018-03-21  Antoine Quint  <graouts@apple.com>
2899
2900         [Web Animations] Ensure animationcancel and transitioncancel events are dispatched
2901         https://bugs.webkit.org/show_bug.cgi?id=183864
2902
2903         Reviewed by Dean Jackson.
2904
2905         In order to correctly dispatch animationcancel and transitioncancel events, we must call cancel() on CSSAnimation and CSSTransitions
2906         objects that are removed while in a play or pause phase. Additionally, we cancel declarative animations that are moving from a valid
2907         to a null timeline. Finally, when cancel() is called on a declarative animation, we record the timestamp and manually call
2908         invalidateDOMEvents() passing that timestamp in to ensure that the right phase change is recorded and results in the queuing of
2909         animationcancel and transitioncancel events.
2910
2911         * animation/AnimationTimeline.cpp:
2912         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Make sure we cancel all recorded CSS Animations when we newly get a
2913         "display: none" style. We also call the new cancelOrRemoveDeclarativeAnimation() method, instead of removing animations outright,
2914         for all animations that previously existed but are no longer listed in the current style.
2915         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Like in updateCSSAnimationsForElement(), we cancel all recorded CSS
2916         Transitions when we newly get a "display: none" style. We now use the refactored removeDeclarativeAnimation() method to remove an
2917         a transition for a property that was already transitioned in the previous style but has a new backing Animation object. Finally,
2918         like in updateCSSAnimationsForElement(), we call the new cancelOrRemoveDeclarativeAnimation() method, instead of removing transitions
2919         outright, for all transitions that previously existed but are no longer listed in the current style.
2920         (WebCore::AnimationTimeline::removeDeclarativeAnimation): Refactor code into this new method to remove a declarative animation.
2921         (WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation): Cancels a DeclarativeAnimation if it's active or removes it right away.
2922         * animation/AnimationTimeline.h:
2923         * animation/DeclarativeAnimation.cpp:
2924         (WebCore::DeclarativeAnimation::setTimeline): If we're moving from a valid timeline to a null timeline, call cancel() on this animation
2925         such that an animationcancel or transitioncancel event can be dispatched.
2926         (WebCore::DeclarativeAnimation::cancel): Cancelations require the computation of the time at which a declarative animation was canceled,
2927         so we record the animation's active time as it's canceled and manually call invalidateDOMEvents() with that time after the general cancel()
2928         code has run.
2929         (WebCore::DeclarativeAnimation::invalidateDOMEvents): Accept an explicit timestamp for cancel events.
2930         * animation/DeclarativeAnimation.h:
2931         * animation/WebAnimation.h:
2932
2933 2018-03-21  Chris Dumez  <cdumez@apple.com>
2934
2935         ScrollViewInsetTests.RestoreInitialContentOffsetAfterCrash API test is failing with async delegates
2936         https://bugs.webkit.org/show_bug.cgi?id=183787
2937
2938         Reviewed by Wenson Hsieh.
2939
2940         * loader/FrameLoader.cpp:
2941         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
2942         * loader/FrameLoaderClient.h:
2943
2944 2018-03-21  Eric Carlson  <eric.carlson@apple.com>
2945
2946         Clean up platform VideoFullscreenLayerManager
2947         https://bugs.webkit.org/show_bug.cgi?id=183859
2948         <rdar://problem/38715419>
2949
2950         Reviewed by Jer Noble.
2951
2952         No new tests, no functional change.
2953
2954         * WebCore.xcodeproj/project.pbxproj:
2955         * platform/graphics/VideoFullscreenLayerManager.h: Copied from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h.
2956         (WebCore::VideoFullscreenLayerManager::~VideoFullscreenLayerManager):
2957         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2958         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2959         (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
2960         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
2961         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer):
2962         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformLayer const):
2963         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
2964         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame):
2965         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity):
2966         (WebCore::MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation const):
2967         (WebCore::MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds):
2968         (WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation):
2969         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2970         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2971         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
2972         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformLayer const):
2973         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
2974         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer):
2975         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
2976         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame):
2977         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation const):
2978         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds):
2979         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation):
2980         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2981         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2982         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
2983         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
2984         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
2985         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer const):
2986         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer):
2987         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenFrame):
2988         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h.
2989         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm.
2990         (-[WebVideoContainerLayer setBounds:]):
2991         (-[WebVideoContainerLayer setPosition:]):
2992         (WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC):
2993         (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer):
2994         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
2995         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame):
2996         (WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer):
2997         (WebCore::VideoFullscreenLayerManagerObjC::requiresTextTrackRepresentation const):
2998         (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds):
2999         (WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation):
3000
3001 2018-03-21  Antoine Quint  <graouts@apple.com>
3002
3003         [Web Animations] Dispatch DOM events for CSS Transitions and CSS Animations implemented as Web Animations
3004         https://bugs.webkit.org/show_bug.cgi?id=183781
3005
3006         Reviewed by Dean Jackson.
3007
3008         Now that we've implemented CSS Animations and CSS Transitions as Web Animations (webkit.org/b/183504) we can dispatch DOM events
3009         for targets of DeclarativeAnimation objects. To do that, we add a new invalidateDOMEvents() method on DeclarativeAnimations which
3010         is called when the timer scheduled after the timing model has been invalidated fires in DocumentTimeline::performInvalidationTask().
3011         When we check for DOM events to dispatch, we look at the last recorded phase and iteration and determine whether the state of the
3012         animation has changed. We use a GenericEventQueue to enqueue the events such that they are dispatched asynchronously at a moment
3013         when it is safe to evaluate script.
3014
3015         * animation/AnimationEffectReadOnly.h: Make currentIteration() public since we now need it in DeclarativeAnimation::invalidateDOMEvents().
3016         * animation/CSSAnimation.cpp:
3017         (WebCore::CSSAnimation::create): Pass the animation target to the constructor instead of its document.
3018         (WebCore::CSSAnimation::CSSAnimation): Pass the animation target to the superclass instead of its document.
3019         * animation/CSSAnimation.h:
3020         * animation/CSSTransition.cpp:
3021         (WebCore::CSSTransition::create): Pass the animation target to the constructor instead of its document.
3022         (WebCore::CSSTransition::CSSTransition): Pass the animation target to the superclass instead of its document.
3023         * animation/CSSTransition.h:
3024         * animation/DeclarativeAnimation.cpp:
3025         (WebCore::DeclarativeAnimation::DeclarativeAnimation): Expect an Element instead of a Document and use that element as the target of the
3026         GenericEventQueue that we initialize. We also register this element as our m_target.
3027         (WebCore::DeclarativeAnimation::~DeclarativeAnimation): Close the GenericEventQueue member upon destruction.
3028         (WebCore::DeclarativeAnimation::initialize): We need to call pause() for declarative animations that aren't playing so that the animation's
3029         playState is set correctly and the animation is not idle.
3030         (WebCore::DeclarativeAnimation::phaseWithoutEffect const): Because we may need to get an animation's current phase in invalidateDOMEvents()
3031         after an animation's effect has been removed, we provide an alternate way to compute the phase just by looking at the animation's current time.
3032         (WebCore::DeclarativeAnimation::invalidateDOMEvents): Based on the previous and current pending state, iteration and phase, we enqueue animation
3033         and transition DOM events as specified by the CSS Animations Level 2 and CSS Transitions Level 2 specifications.
3034         (WebCore::DeclarativeAnimation::enqueueDOMEvent): Enqueue an event on the GenericEventQueue based on the animation type.
3035         * animation/DeclarativeAnimation.h:
3036         * animation/DocumentTimeline.cpp:
3037         (WebCore::DocumentTimeline::performInvalidationTask): We call invalidateDOMEvents() on all declarative animations registered with this timeline
3038         now that the timing model has been invalidated.
3039         * dom/EventNames.h: Add the names of newly-implemented events (animationcancel, transitioncancel, transitionrun and transitionstart).
3040         * dom/GlobalEventHandlers.idl: Add new attribute-based event handlers for the newly-implemented events.
3041         * html/HTMLAttributeNames.in: Add new attribute-based event handlers for the newly-implemented events.
3042         * html/HTMLElement.cpp:
3043         (WebCore::HTMLElement::createEventHandlerNameMap): Add new attribute-based event handlers for the newly-implemented events.
3044
3045 2018-03-21  Per Arne Vollan  <pvollan@apple.com>
3046
3047         Compile error when not using IOSurface canvas backing store.
3048         https://bugs.webkit.org/show_bug.cgi?id=183855
3049
3050         Reviewed by Brent Fulgham.
3051
3052         The method IOSurface::createFromImageBuffer is only referenced when IOSurface
3053         is used as canvas backing store.
3054
3055         * platform/graphics/cocoa/IOSurface.h:
3056         * platform/graphics/cocoa/IOSurface.mm:
3057
3058 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
3059
3060         [CoordGraphics] Track dirty rects that need update in CoordinatedGraphicsLayer
3061         https://bugs.webkit.org/show_bug.cgi?id=175376
3062
3063         Reviewed by Carlos Garcia Campos.
3064
3065         Follow the GraphicsLayerCA class and track rectangles in need of display
3066         in a Vector object. In case the whole layer needs updating, it's marked
3067         separately, and further rects are ignored.
3068
3069         During layer flush, all the rects are used to invalidate the backing
3070         store, or a single layer-sized rect is used in case the whole layer has
3071         to be updated. We can also bail early from updateContentBuffers() if
3072         there are no dirty rects recorded and there's no pending visible rect
3073         adjustment.
3074
3075         At the end of updateContentBuffers() we now test for an existing
3076         previous backing store before inquiring the backing store if the visible
3077         area is already covered, enabling deletion of this backing store.
3078
3079         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3080         (WebCore::CoordinatedGraphicsLayer::setNeedsDisplay):
3081         (WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect):
3082         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
3083         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3084
3085 2018-03-21  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3086
3087         [WPE] Build failure with ENABLE_VIDEO=OFF when GStreamer is not available
3088         https://bugs.webkit.org/show_bug.cgi?id=183811
3089
3090         Reviewed by Philippe Normand.
3091
3092         Add build guards for USE_GSTREAMER.
3093
3094         No new tests, it is a build fix.
3095
3096         * platform/graphics/gstreamer/GStreamerUtilities.h:
3097
3098 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
3099
3100         [Cairo] Draw Cairo patterns with cairo_paint_with_alpha()
3101         https://bugs.webkit.org/show_bug.cgi?id=183774
3102
3103         Reviewed by Carlos Garcia Campos.
3104
3105         In the drawPatternToCairoContext() helper in CairoOperations.cpp source
3106         file, always clip the painting region to the specified rectangle and
3107         then use cairo_paint_with_alpha() to paint the passed-in pattern object,
3108         not relaying rasterization to cairo_fill() when using opaque alpha. We
3109         still clamp the alpha value to the 0.0 - 1.0 range.
3110
3111         No new tests -- no change in behavior.
3112
3113         * platform/graphics/cairo/CairoOperations.cpp:
3114         (WebCore::Cairo::drawPatternToCairoContext):
3115
3116 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
3117
3118         [TexMap] Have TextureMapperLayer::applyAnimationsRecursively() return running animation status
3119         https://bugs.webkit.org/show_bug.cgi?id=183771
3120
3121         Reviewed by Carlos Garcia Campos.
3122
3123         TextureMapperLayer::applyAnimationsRecursively() should return true when
3124         the TextureMapperLayer tree has currently-running animations that
3125         require continuous scene update.
3126
3127         TextureMapperAnimation::ApplicationResult gains the hasRunningAnimation
3128         member that's set to true if any of the applied animations are still in
3129         playing state. That information is then returned in syncAnimations(),
3130         and the result is accumulated in the top applyAnimationsRecursively()
3131         call and returned there to the caller.
3132
3133         No new tests -- no change in behavior.
3134
3135         * platform/graphics/texmap/TextureMapperAnimation.cpp:
3136         (WebCore::TextureMapperAnimation::apply):
3137         * platform/graphics/texmap/TextureMapperAnimation.h:
3138         * platform/graphics/texmap/TextureMapperLayer.cpp:
3139         (WebCore::TextureMapperLayer::applyAnimationsRecursively):
3140         (WebCore::TextureMapperLayer::syncAnimations):
3141         * platform/graphics/texmap/TextureMapperLayer.h:
3142
3143 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
3144
3145         Use-after-move in SWContextManager::terminateWorker() with Linux x86_64 calling convention
3146         https://bugs.webkit.org/show_bug.cgi?id=183783
3147
3148         Reviewed by Chris Dumez.
3149
3150         In SWContextManager::terminateWorker(), some calling conventions can
3151         end up moving the ServiceWorkerThreadProxy RefPtr into the lambda struct
3152         before that proxy's thread (on which the lambda is bound to execute) is
3153         retrieved.
3154
3155         Avoid this by taking a reference to the thread in a separate earlier
3156         expression, before the RefPtr is moved into the lambda in the following
3157         one.
3158
3159         * workers/service/context/SWContextManager.cpp:
3160         (WebCore::SWContextManager::terminateWorker):
3161
3162 2018-03-21  Timothy Horton  <timothy_horton@apple.com>
3163
3164         Fix the build
3165
3166         * platform/network/cf/FormDataStreamCFNet.cpp:
3167
3168 2018-03-20  Tim Horton  <timothy_horton@apple.com>
3169
3170         Introduce HAVE_MEDIA_PLAYER and HAVE_CORE_VIDEO
3171         https://bugs.webkit.org/show_bug.cgi?id=183803
3172         <rdar://problem/38690487>
3173
3174         Reviewed by Sam Weinig.
3175
3176         * platform/audio/ios/MediaSessionManagerIOS.mm:
3177         (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
3178         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo):
3179         (-[WebMediaSessionHelper initWithCallback:]):
3180         (-[WebMediaSessionHelper dealloc]):
3181         (-[WebMediaSessionHelper hasWirelessTargetsAvailable]):
3182         * platform/cocoa/CoreVideoSoftLink.cpp:
3183         * platform/cocoa/CoreVideoSoftLink.h:
3184         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3185         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3186         (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer):
3187         (WebCore::MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame const):
3188         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
3189         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
3190         (WebCore::MediaSampleAVFObjC::getRGBAImageData const):
3191         * platform/graphics/cv/PixelBufferConformerCV.cpp:
3192         * platform/graphics/cv/PixelBufferConformerCV.h:
3193         * platform/graphics/cv/TextureCacheCV.h:
3194         * platform/graphics/cv/TextureCacheCV.mm:
3195         * platform/graphics/cv/VideoTextureCopierCV.cpp:
3196         * platform/graphics/cv/VideoTextureCopierCV.h:
3197         Make it possible to disable our dependency on MediaPlayer and CoreVideo.
3198
3199 2018-03-20  Tim Horton  <timothy_horton@apple.com>
3200
3201         Enable the minimal simulator feature flag when appropriate
3202         https://bugs.webkit.org/show_bug.cgi?id=183807
3203
3204         Reviewed by Dan Bernstein.
3205
3206         * Configurations/FeatureDefines.xcconfig:
3207
3208 2018-03-19  Ryosuke Niwa  <rniwa@webkit.org>
3209
3210         Expose content attributes on _WKLinkIconParameters
3211         https://bugs.webkit.org/show_bug.cgi?id=183768
3212
3213         Reviewed by Alex Christensen.
3214
3215         Collect a vector of content attributes upon finding touch and fav-icons in order to expose it in a WebKit API.
3216
3217         Tests: IconLoading.DefaultFavicon
3218
3219         * html/LinkIconCollector.cpp:
3220         (WebCore::LinkIconCollector::iconsOfTypes): Collect attributes.
3221         * loader/DocumentLoader.cpp:
3222         (WebCore::DocumentLoader::startIconLoading): Use an empty vector for /favicon.ico.
3223         * platform/LinkIcon.h:
3224         (WebCore::LinkIcon::encode const): Encode the vector of content attributes.
3225         (WebCore::LinkIcon::decode): Ditto for decoding.
3226
3227 2018-03-20  Zalan Bujtas  <zalan@apple.com>
3228
3229         RenderTreeNeedsLayoutChecker fails with absolutely positioned svg and <use>
3230         https://bugs.webkit.org/show_bug.cgi?id=183718
3231
3232         Reviewed by Antti Koivisto.
3233
3234         This patch ensures after resolving the style for an SVG element with a corresponding element (<use>),
3235         we adjust this style for the cloned SVG element too.
3236
3237         Test: svg/in-html/path-with-absolute-positioned-svg-and-use-crash.html
3238
3239         * css/StyleResolver.cpp:
3240         (WebCore::StyleResolver::adjustSVGElementStyle):
3241         (WebCore::StyleResolver::adjustRenderStyle):
3242         * css/StyleResolver.h:
3243         * svg/SVGElement.cpp:
3244         (WebCore::SVGElement::resolveCustomStyle):
3245
3246 2018-03-20  Brady Eidson  <beidson@apple.com>
3247
3248         First piece of process swapping on navigation.
3249         https://bugs.webkit.org/show_bug.cgi?id=183665
3250
3251         Reviewed by Andy Estes.
3252
3253         Covered by API test(s)
3254
3255         This patch:
3256         - A new PolicyAction::Suspend for future use in this feature
3257         - Makes sure that loads triggered as part of a process swap do *not* re-consult the policy delegate
3258
3259         * loader/DocumentLoader.cpp:
3260         (WebCore::DocumentLoader::continueAfterContentPolicy):
3261
3262         * loader/FrameLoadRequest.h:
3263         (WebCore::FrameLoadRequest::setShouldCheckNavigationPolicy):
3264         (WebCore::FrameLoadRequest::shouldCheckNavigationPolicy const):
3265
3266         * loader/FrameLoader.cpp:
3267         (WebCore::FrameLoader::load):
3268         (WebCore::FrameLoader::loadWithDocumentLoader):
3269         * loader/FrameLoader.h:
3270
3271         * loader/FrameLoaderTypes.h: Add a new Policy type "Suspend" to be used in the future
3272           by the process-swap-on-navigation mechanism.
3273
3274         * loader/PolicyChecker.cpp:
3275         (WebCore::PolicyChecker::checkNavigationPolicy):
3276         (WebCore::PolicyChecker::checkNewWindowPolicy):
3277
3278 2018-03-20  Chris Dumez  <cdumez@apple.com>
3279
3280         QuickLook.NavigationDelegate API test is failing on iOS with async policy delegates
3281         https://bugs.webkit.org/show_bug.cgi?id=183791
3282
3283         Reviewed by Alex Christensen.
3284
3285         Update PreviewLoader to not send data (or call finishFinishLoading) until
3286         the resource response has been processed.
3287
3288         * loader/ios/PreviewLoader.mm:
3289         (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]):
3290         (-[WebPreviewLoader connection:didReceiveData:lengthReceived:]):
3291         (-[WebPreviewLoader connectionDidFinishLoading:]):
3292
3293 2018-03-20  Antoine Quint  <graouts@apple.com>
3294
3295         [Web Animations] Update the timing model when pending tasks schedule changes
3296         https://bugs.webkit.org/show_bug.cgi?id=183785
3297
3298         Reviewed by Dean Jackson.
3299
3300         Changing the time at which a pending play or pause task is scheduled changes the pending
3301         state of the animation and thus should notify that the timing model has changed and invalidate
3302         the effect.
3303
3304         * animation/WebAnimation.cpp:
3305         (WebCore::WebAnimation::setTimeToRunPendingPlayTask):
3306         (WebCore::WebAnimation::setTimeToRunPendingPauseTask):
3307         (WebCore::WebAnimation::updatePendingTasks):
3308
3309 2018-03-20  Tim Horton  <timothy_horton@apple.com>
3310
3311         Add and adopt WK_PLATFORM_NAME and adjust default feature defines
3312         https://bugs.webkit.org/show_bug.cgi?id=183758
3313         <rdar://problem/38017644>
3314
3315         Reviewed by Dan Bernstein.
3316
3317         * Configurations/Base.xcconfig:
3318         * Configurations/FeatureDefines.xcconfig:
3319         * WebCore.xcodeproj/project.pbxproj:
3320
3321 2018-03-19  Tim Horton  <timothy_horton@apple.com>
3322
3323         Apply some SDK checks in LocalDefaultSystemAppearance
3324         https://bugs.webkit.org/show_bug.cgi?id=183767
3325         <rdar://problem/38649611>
3326
3327         Reviewed by Zalan Bujtas.
3328
3329         * platform/mac/LocalDefaultSystemAppearance.h:
3330         * platform/mac/LocalDefaultSystemAppearance.mm:
3331         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
3332         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
3333
3334 2018-03-19  Chris Dumez  <cdumez@apple.com>
3335
3336         Have one service worker process per security origin
3337         https://bugs.webkit.org/show_bug.cgi?id=183600
3338         <rdar://problem/35280128>
3339
3340         Reviewed by Brady Eidson.
3341
3342         Split service workers from different origins into their own processes
3343         for security reasons.
3344
3345         * workers/service/server/SWServer.cpp:
3346         (WebCore::SWServer::addRegistrationFromStore):
3347         (WebCore::SWServer::clear):
3348         (WebCore::SWServer::tryInstallContextData):
3349         (WebCore::SWServer::serverToContextConnectionCreated):
3350         (WebCore::SWServer::installContextData):
3351         (WebCore::SWServer::runServiceWorkerIfNecessary):
3352         (WebCore::SWServer::markAllWorkersAsTerminated):
3353         * workers/service/server/SWServer.h:
3354         * workers/service/server/SWServerToContextConnection.cpp:
3355         (WebCore::SWServerToContextConnection::SWServerToContextConnection):
3356         (WebCore::SWServerToContextConnection::~SWServerToContextConnection):
3357         (WebCore::SWServerToContextConnection::connectionForOrigin):
3358         * workers/service/server/SWServerToContextConnection.h:
3359         (WebCore::SWServerToContextConnection::origin):
3360         * workers/service/server/SWServerWorker.cpp:
3361         (WebCore::SWServerWorker::SWServerWorker):
3362         (WebCore::SWServerWorker::securityOrigin const):
3363         (WebCore::SWServerWorker::contextConnection):
3364         * workers/service/server/SWServerWorker.h:
3365
3366 2018-03-19  Megan Gardner  <megan_gardner@apple.com>
3367
3368         Have select element respect current appearance
3369         https://bugs.webkit.org/show_bug.cgi?id=183753
3370
3371         Reviewed by Tim Horton.
3372
3373         Not currently testable, will add tests in a later patch.
3374
3375         Have the menu lists/select elements follow the system colors.
3376
3377         * rendering/RenderThemeMac.mm:
3378         (WebCore::RenderThemeMac::adjustMenuListStyle const):
3379
3380 2018-03-19  Nan Wang  <n_wang@apple.com>
3381
3382         AX: embedded attachments do not work correctly with text marker APIs on macOS
3383         https://bugs.webkit.org/show_bug.cgi?id=183751
3384
3385         Reviewed by Chris Fleizach.
3386
3387         In WebKit1, embedded attachments are not working well with text marker APIs.
3388         We should use the corresponding attachment view in the following cases:
3389         1. Hit testing on an attachment object.
3390         2. Getting the attachment object at a text marker position.
3391         3. Asking for the associated element with NSAccessibilityAttachmentTextAttribute. 
3392
3393         Not able to construct a layout test because it relies on embedded attachments.
3394
3395         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3396         (AXAttributeStringSetElement):
3397         (-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
3398         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
3399
3400 2018-03-19  Jiewen Tan  <jiewen_tan@apple.com>
3401
3402         Unreviewed, another quick fix for r229699
3403
3404         Restricts ENABLE_WEB_AUTHN to only macOS and iOS.
3405
3406         * Configurations/FeatureDefines.xcconfig:
3407
3408 2018-03-19  Daniel Bates  <dabates@apple.com>
3409
3410         Fix case of Strong Password localized string
3411
3412         * English.lproj/Localizable.strings:
3413         * platform/LocalizedStrings.cpp:
3414         (WebCore::autoFillStrongPasswordLabel):
3415
3416 2018-03-19  Chris Dumez  <cdumez@apple.com>
3417
3418         WebKit.WebsitePoliciesAutoplayQuirks API test times out with async policy delegates
3419         https://bugs.webkit.org/show_bug.cgi?id=183702
3420         <rdar://problem/38566060>
3421
3422         Reviewed by Alex Christensen.
3423
3424         The issue is that the test calls loadHTMLString then loadRequest right after, without
3425         waiting for the first load to complete first. loadHTMLString is special as it relies
3426         on substitute data and which schedules a timer to commit the data. When doing the
3427         navigation policy check for the following loadRequest(), the substitute data timer
3428         would fire and commit its data and load. This would in turn cancel the pending
3429         navigation policy check for the loadRequest().
3430
3431         With sync policy delegates, this is not an issue because we take care of stopping
3432         all loaders when receiving the policy decision, which happens synchronously. However,
3433         when the policy decision happens asynchronously, the pending substitute data load
3434         does not get cancelled in time and it gets committed.
3435
3436         To address the issue, we now cancel any pending provisional load before doing the
3437         navigation policy check.
3438
3439         Test: fast/loader/inner-iframe-loads-data-url-into-parent-on-unload-crash-async-delegate.html
3440
3441         * loader/FrameLoader.cpp:
3442         (WebCore::FrameLoader::clearProvisionalLoadForPolicyCheck):
3443         * loader/FrameLoader.h:
3444         * loader/PolicyChecker.cpp:
3445         (WebCore::PolicyChecker::checkNavigationPolicy):
3446         Cancel any pending provisional load before starting the navigation policy check. This call
3447         needs to be here rather than in the call site of policyChecker().checkNavigationPolicy()
3448         because there is code in PolicyChecker::checkNavigationPolicy() which relies on
3449         FrameLoader::activeDocumentLoader().
3450         Also, we only cancel the provisional load if there is a policy document loader. In some
3451         rare cases (when we receive a redirect after navigation policy has been decided for the
3452         initial request), the provisional document loader needs to receive navigation policy
3453         decisions so we cannot clear the provisional document loader in such case.
3454
3455 2018-03-19  Eric Carlson  <eric.carlson@apple.com>
3456
3457         [Extra zoom mode] Require fullscreen for video playback
3458         https://bugs.webkit.org/show_bug.cgi?id=183742
3459         <rdar://problem/38235862>
3460
3461         Reviewed by Jer Noble.
3462
3463         * Modules/modern-media-controls/media/playback-support.js:
3464         (PlaybackSupport.prototype.syncControl): Always show the play button.
3465         * html/HTMLMediaElement.cpp:
3466         (WebCore::HTMLMediaElement::updatePlayState): Return immediately if playback requires fullscreen
3467         (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Call updatePlayState in case 
3468         playback is pending.
3469         * html/HTMLMediaElement.h:
3470         * platform/cocoa/VideoFullscreenModel.h:
3471         (WebCore::VideoFullscreenModel::presentingViewController): New.
3472         (WebCore::VideoFullscreenModel::createVideoFullscreenViewController): New.
3473         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3474         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
3475         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode):
3476         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
3477         (WebCore::PlaybackSessionInterfaceAVKit::seekableRangesChanged):
3478
3479         * platform/ios/VideoFullscreenInterfaceAVKit.h:
3480         * platform/ios/VideoFullscreenInterfaceAVKit.mm: Wrap AVPlayerLayerView so we can change its
3481         behavior.
3482         (WebAVPlayerLayerView_playerLayer):
3483         (WebAVPlayerLayerView_videoView):
3484         (allocWebAVPlayerLayerViewInstance):
3485         (-[WebAVPlayerViewController initWithFullscreenInterface:]):
3486         (-[WebAVPlayerViewController playerViewControllerShouldHandleDoneButtonTap:]):
3487         (-[WebAVPlayerViewController enterFullScreenAnimated:completionHandler:]):
3488         (-[WebAVPlayerViewController exitFullScreenAnimated:completionHandler:]):
3489         (-[WebAVPlayerViewController NO_RETURN_DUE_TO_ASSERT]):
3490         (-[WebAVPlayerViewController isPictureInPicturePossible]):
3491         (-[WebAVPlayerViewController isPictureInPictureActive]):
3492         (-[WebAVPlayerViewController isPictureInPictureSuspended]):
3493         (-[WebAVPlayerViewController pictureInPictureActive]):
3494         (-[WebAVPlayerViewController pictureInPictureWasStartedWhenEnteringBackground]):
3495         (-[WebAVPlayerViewController view]):
3496         (-[WebAVPlayerViewController showsPlaybackControls]):
3497         (-[WebAVPlayerViewController setShowsPlaybackControls:]):
3498         (-[WebAVPlayerViewController setAllowsPictureInPicturePlayback:]):
3499         (-[WebAVPlayerViewController setDelegate:]):
3500         (-[WebAVPlayerViewController setPlayerController:]):
3501         (-[WebAVPlayerViewController avPlayerViewController]):
3502         (-[WebAVPlayerViewController removeFromParentViewController]):
3503         (VideoFullscreenInterfaceAVKit::setupFullscreen):
3504         (fallbackViewController):
3505         (VideoFullscreenInterfaceAVKit::presentingViewController):
3506         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
3507         (VideoFullscreenInterfaceAVKit::doSetup):
3508         (WebCore::supportsPictureInPicture):
3509
3510 2018-03-19  Per Arne Vollan  <pvollan@apple.com>
3511
3512         When the WebContent process is blocked from accessing the WindowServer, the call CVDisplayLinkCreateWithCGDisplay will fail.
3513         https://bugs.webkit.org/show_bug.cgi?id=183604
3514         <rdar://problem/38305109>
3515
3516         Reviewed by Brent Fulgham.
3517
3518         The call to CVDisplayLinkCreateWithCGDisplay can instead be made in the UIProcess. Notify the WebContent process
3519         about display updates by sending a message from the UIProcess on each screen update. This patch adds an extra
3520         IPC step when notifying the WebContent process about display updates. However, the MotionMark benchmark shows no
3521         performance regression when running it with this patch. A possible explanation for this is that the high priority
3522         display link thread is now running in the UIProcess instead of the WebContent process, which means there will be
3523         more available CPU resources for the WebContent process. A run loop observer is added to make sure that only one
3524         display callback (for each display observer) is executed in a single iteration of the run loop. This will make
3525         sure we are not filling the IPC message queue with unhandled display link messages.
3526
3527         No new tests, covered by existing tests. 
3528
3529         * platform/graphics/DisplayRefreshMonitor.h:
3530         (WebCore::DisplayRefreshMonitor::displayLinkFired):
3531         * platform/graphics/DisplayRefreshMonitorManager.cpp:
3532         (WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
3533         * platform/graphics/DisplayRefreshMonitorManager.h:
3534         * platform/graphics/mac/DisplayRefreshMonitorMac.h:
3535
3536 2018-03-19  Megan Gardner  <megan_gardner@apple.com>
3537
3538         Ensure local appearance actually mirrors the app's appearance
3539         https://bugs.webkit.org/show_bug.cgi?id=183743
3540
3541         Reviewed by Tim Horton.
3542
3543         Not currently testable, will add tests in a later patch.
3544
3545         Current appearance isn't always accurate by default and needs to be set manually.
3546
3547         * platform/mac/LocalDefaultSystemAppearance.mm:
3548         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
3549
3550 2018-03-19  Zan Dobersek  <zdobersek@igalia.com>
3551
3552         Unreviewed GCC 4.9 build-fix after r229672.
3553
3554         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
3555         (Nicosia::createCommand): Don't depend on implicit conversion of the
3556         returning std::unique_ptr<> object, and instead only wrap the
3557         heap-allocated PaintingOperation-derived in a std::unique_ptr<> at the
3558         point of return.
3559
3560 2018-03-18  Commit Queue  <commit-queue@webkit.org>
3561
3562         Unreviewed, rolling out r229689.
3563         https://bugs.webkit.org/show_bug.cgi?id=183735
3564
3565         Causes fast/loader/inner-iframe-loads-data-url-into-parent-on-
3566         unload-crash.html to fail with async delegates (Requested by
3567         cdumez_ on #webkit).
3568
3569         Reverted changeset:
3570
3571         "WebKit.WebsitePoliciesAutoplayQuirks API test times out with
3572         async policy delegates"
3573         https://bugs.webkit.org/show_bug.cgi?id=183702
3574         https://trac.webkit.org/changeset/229689
3575
3576 2018-03-17  Tim Horton  <timothy_horton@apple.com>
3577
3578         Correct redefined fnfErr type
3579         https://bugs.webkit.org/show_bug.cgi?id=183728
3580         <rdar://problem/38590063>
3581
3582         Reviewed by Dan Bernstein.
3583
3584         * platform/network/cf/FormDataStreamCFNet.cpp:
3585         CFStreamError's error parameter takes a SInt32, not an int.
3586         Make sure our redefinition has a compatible type.
3587
3588 2018-03-17  Jiewen Tan  <jiewen_tan@apple.com>
3589
3590         [WebAuthN] Implement authenticatorMakeCredential
3591         https://bugs.webkit.org/show_bug.cgi?id=183527
3592         <rdar://problem/35275886>
3593
3594         Reviewed by Brent Fulgham.
3595
3596         This patch does the following few things:
3597         1) It implements the authenticatorMakeCredential logic from the spec: https://www.w3.org/TR/webauthn/#op-make-cred.
3598         2) It tweaks enocding and deocding of PublicKeyCredentialCreationOptions between UIProccess and WebProcess.
3599         3) It soft links LocalAuthentication.Framework to WebCore, which was linked to WebKit.
3600         4) It creates SPI header for DeviceIdentity.Framework, and provides stubs to link it to WebCore.
3601
3602         Here is a detailed explanantion of 1):
3603         1. A helper class called LocalAuthenticator is crafted to represent Apple platform attached authenticator, i.e.
3604         the devices themselves. All operations are currently restricted to iOS at this moment as macOS lacks attestation
3605         support.
3606         2. To do testing, this helper class is then moved from WebKit to WebCore even though all operations can only happens
3607         in the UIProcess. We currently lack the ability to pretend a https environment in TestWebKitAPI which is required by
3608         the WebAuthN API, and thus it is moved to WebCore to perform unit tesing flavor API tests. This is not enough as it
3609         can't test message exchange between the UI and Web processes. We will address this in a subsequent patch.
3610         3. More on testing: The attestation process is abstracted into a protected method such that the testing enviroment can
3611         override it with self attestation as network access is restricted in the WebKit testing enviroment. Also, swizzlers of
3612         LocalAuthentication API are provided to override the behavoir of LAContext.
3613         4. More on testing: The actual Apple attestation can only happen in real device and with network access, therefore
3614         it can only be covered by manual tests at this moment.
3615         5. Back to LocalAuthenticator, it currently has two public methods:
3616                 5.1. makeCredential(): This method is the one does all the magic.
3617                 + It first checks some parameters.
3618                 + It then invokes LAContext to get user consent.
3619                 + It then talks to Apple Attestation Privacy CA to do attestations.
3620                 + It then stores necessary information into the Keychain.
3621                 + Finally it generates the attestation object.
3622                 5.2 isAvailable():
3623                 To check if a LocalAuthenticator is available or not.
3624         6. Even though files are of .mm format, they are written in a way that mixes NS, CF and C++ types. Here is the rule:
3625                 6.1 Use CF type only if it is requested by APIs.
3626                 6.2 Use NS type to manipulate all Objc objects.
3627                 6.3 Use C++ otherwise.
3628
3629         Covered by API tests.
3630
3631         * Configurations/WebCore.xcconfig:
3632         * Modules/credentialmanagement/CredentialsMessenger.cpp:
3633         (WebCore::getIdFromAttestationObject): Deleted.
3634         Decoding attestation object is tedious. UIProcess will instead return credential ID and attestation object
3635         at the same time. Therefore, this method is removed.
3636         * Modules/credentialmanagement/CredentialsMessenger.h:
3637         (WebCore::CreationReturnBundle::CreationReturnBundle): Deleted.
3638         (WebCore::AssertionReturnBundle::AssertionReturnBundle): Deleted.
3639         * Modules/webauthn/COSEConstants.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialType.h.
3640         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
3641         (WebCore::PublicKeyCredentialCreationOptions::isolatedPartialCopyPtr const):
3642         (WebCore::PublicKeyCredentialCreationOptions::Parameters::encode const):
3643         (WebCore::PublicKeyCredentialCreationOptions::Parameters::decode):
3644         (WebCore::PublicKeyCredentialCreationOptions::encode const):
3645         (WebCore::PublicKeyCredentialCreationOptions::decode):
3646         * Modules/webauthn/PublicKeyCredentialDescriptor.h:
3647         (WebCore::PublicKeyCredentialDescriptor::encode const):
3648         (WebCore::PublicKeyCredentialDescriptor::decode):
3649         * Modules/webauthn/PublicKeyCredentialType.h:
3650         * Modules/webauthn/cocoa/LocalAuthenticator.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h.
3651         * Modules/webauthn/cocoa/LocalAuthenticator.mm: Added.
3652         (WebCore::LocalAuthenticatorInternal::freePtrs):
3653         (WebCore::LocalAuthenticator::makeCredential const):
3654         (WebCore::LocalAuthenticator::isAvailable const):
3655         (WebCore::LocalAuthenticator::issueClientCertificate const):
3656         * SourcesCocoa.txt:
3657         * WebCore.xcodeproj/project.pbxproj:
3658         * platform/cocoa/LocalAuthenticationSoftLink.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialType.h.
3659         * platform/cocoa/LocalAuthenticationSoftLink.mm: Added.
3660         * testing/MockCredentialsMessenger.cpp:
3661         (WebCore::MockCredentialsMessenger::setCreationReturnBundle):
3662         (WebCore::MockCredentialsMessenger::makeCredential):
3663         (WebCore::MockCredentialsMessenger::makeCredentialReply):
3664         (WebCore::MockCredentialsMessenger::setAttestationObject): Deleted.
3665         * testing/MockCredentialsMessenger.h:
3666         * testing/MockCredentialsMessenger.idl:
3667
3668 2018-03-16  Brent Fulgham  <bfulgham@apple.com>
3669
3670         Correct debug assertion in Range::borderAndTextRects
3671         https://bugs.webkit.org/show_bug.cgi?id=183710
3672         <rdar://problem/38466976>
3673
3674         Reviewed by Ryosuke Niwa.
3675
3676         A debug assertion will fire if Range::borderAndTextRects is asked to evaluate a set of selected elements, where one of the elements does not have a parent.
3677
3678         We should consider a nullptr parent as satisfying the condition of a parent not being present in the selection set.
3679
3680         Tests: fast/dom/range/range-selection-empty-body.html
3681
3682         * dom/Range.cpp:
3683         (WebCore::Range::borderAndTextRects const):
3684
3685 2018-03-15  Filip Pizlo  <fpizlo@apple.com>
3686
3687         Put the DOM in IsoHeaps
3688         https://bugs.webkit.org/show_bug.cgi?id=183546
3689
3690         Reviewed by Daniel Bates.
3691
3692         No new tests because no change in behavior.
3693         
3694         This puts all descendants of WebCore::Node in isoheaps, so that UAFs on the DOM cannot be
3695         used for RCE attacks. This probably also makes it harder to use UAFs for UXSS, since it means
3696         that DOM UAFs cannot be used for universal read gadgets.
3697         
3698         This looks neutral on Speedometer and membuster, though I did have one round of testing
3699         that led me to believe that membuster was regressed - I just wasn't able to reproduce that
3700         result on subsequent testing.
3701
3702         * Sources.txt:
3703         * WebCore.xcodeproj/project.pbxproj:
3704         * dom/Attr.cpp:
3705         * dom/Attr.h:
3706         * dom/CDATASection.cpp:
3707         * dom/CDATASection.h:
3708         * dom/CharacterData.cpp:
3709         * dom/CharacterData.h:
3710         * dom/Comment.cpp:
3711         * dom/Comment.h:
3712         * dom/ContainerNode.cpp:
3713         * dom/ContainerNode.h:
3714         * dom/Document.cpp:
3715         * dom/Document.h:
3716         * dom/DocumentFragment.cpp:
3717         * dom/DocumentFragment.h:
3718         * dom/DocumentType.cpp:
3719         * dom/DocumentType.h:
3720         * dom/Node.cpp:
3721         * dom/Node.h:
3722         * dom/ProcessingInstruction.cpp:
3723         * dom/ProcessingInstruction.h:
3724         * dom/PseudoElement.cpp:
3725         * dom/PseudoElement.h:
3726         * dom/ShadowRoot.cpp:
3727         * dom/ShadowRoot.h:
3728         * dom/StyledElement.cpp:
3729         * dom/StyledElement.h:
3730         * dom/TemplateContentDocumentFragment.cpp: Added.
3731         * dom/TemplateContentDocumentFragment.h:
3732         * dom/Text.cpp:
3733         * dom/Text.h:
3734         * dom/XMLDocument.cpp: Added.
3735         * dom/XMLDocument.h:
3736         * html/FTPDirectoryDocument.cpp:
3737         * html/FTPDirectoryDocument.h:
3738         * html/FileInputType.cpp:
3739         * html/HTMLAnchorElement.cpp:
3740         * html/HTMLAnchorElement.h:
3741         * html/HTMLAppletElement.cpp:
3742         * html/HTMLAppletElement.h:
3743         * html/HTMLAreaElement.cpp:
3744         * html/HTMLAreaElement.h:
3745         * html/HTMLAttachmentElement.cpp:
3746         * html/HTMLAttachmentElement.h:
3747         * html/HTMLBDIElement.cpp: Added.
3748         * html/HTMLBDIElement.h:
3749         * html/HTMLBRElement.cpp:
3750         * html/HTMLBRElement.h:
3751         * html/HTMLBaseElement.cpp:
3752         * html/HTMLBaseElement.h:
3753         * html/HTMLBodyElement.cpp:
3754         * html/HTMLBodyElement.h:
3755         * html/HTMLButtonElement.cpp:
3756         * html/HTMLButtonElement.h:
3757         * html/HTMLCanvasElement.cpp:
3758         * html/HTMLCanvasElement.h:
3759         * html/HTMLDListElement.cpp:
3760         * html/HTMLDListElement.h:
3761         * html/HTMLDataElement.cpp:
3762         * html/HTMLDataElement.h:
3763         * html/HTMLDataListElement.cpp:
3764         * html/HTMLDataListElement.h:
3765         * html/HTMLDetailsElement.cpp:
3766         * html/HTMLDetailsElement.h:
3767         * html/HTMLDirectoryElement.cpp:
3768         * html/HTMLDirectoryElement.h:
3769         * html/HTMLDivElement.cpp:
3770         * html/HTMLDivElement.h:
3771         * html/HTMLDocument.cpp:
3772         * html/HTMLDocument.h:
3773         * html/HTMLElement.cpp:
3774         * html/HTMLElement.h:
3775         * html/HTMLEmbedElement.cpp:
3776         * html/HTMLEmbedElement.h:
3777         * html/HTMLFieldSetElement.cpp:
3778         * html/HTMLFieldSetElement.h:
3779         * html/HTMLFontElement.cpp:
3780         * html/HTMLFontElement.h:
3781         * html/HTMLFormControlElement.cpp:
3782         * html/HTMLFormControlElement.h:
3783         * html/HTMLFormControlElementWithState.cpp:
3784         * html/HTMLFormControlElementWithState.h:
3785         * html/HTMLFormElement.cpp:
3786         * html/HTMLFormElement.h:
3787         * html/HTMLFrameElement.cpp:
3788         * html/HTMLFrameElement.h:
3789         * html/HTMLFrameElementBase.cpp:
3790         * html/HTMLFrameElementBase.h:
3791         * html/HTMLFrameOwnerElement.cpp:
3792         * html/HTMLFrameOwnerElement.h:
3793         * html/HTMLFrameSetElement.cpp:
3794         * html/HTMLFrameSetElement.h:
3795         * html/HTMLHRElement.cpp:
3796         * html/HTMLHRElement.h:
3797         * html/HTMLHeadElement.cpp:
3798         * html/HTMLHeadElement.h:
3799         * html/HTMLHeadingElement.cpp:
3800         * html/HTMLHeadingElement.h:
3801         * html/HTMLHtmlElement.cpp:
3802         * html/HTMLHtmlElement.h:
3803         * html/HTMLIFrameElement.cpp:
3804         * html/HTMLIFrameElement.h:
3805         * html/HTMLImageElement.cpp:
3806         * html/HTMLImageElement.h:
3807         * html/HTMLInputElement.cpp:
3808         * html/HTMLInputElement.h:
3809         * html/HTMLKeygenElement.cpp:
3810         * html/HTMLKeygenElement.h:
3811         * html/HTMLLIElement.cpp:
3812         * html/HTMLLIElement.h:
3813         * html/HTMLLabelElement.cpp:
3814         * html/HTMLLabelElement.h:
3815         * html/HTMLLegendElement.cpp:
3816         * html/HTMLLegendElement.h:
3817         * html/HTMLLinkElement.cpp:
3818         * html/HTMLLinkElement.h:
3819         * html/HTMLMapElement.cpp:
3820         * html/HTMLMapElement.h:
3821         * html/HTMLMarqueeElement.cpp:
3822         * html/HTMLMarqueeElement.h:
3823         * html/HTMLMenuElement.cpp:
3824         * html/HTMLMenuElement.h:
3825         * html/HTMLMenuItemElement.cpp:
3826         * html/HTMLMenuItemElement.h:
3827         * html/HTMLMetaElement.cpp:
3828         * html/HTMLMetaElement.h:
3829         * html/HTMLMeterElement.cpp:
3830         * html/HTMLMeterElement.h:
3831         * html/HTMLModElement.cpp:
3832         * html/HTMLModElement.h:
3833         * html/HTMLOListElement.cpp:
3834         * html/HTMLOListElement.h:
3835         * html/HTMLObjectElement.cpp:
3836         * html/HTMLObjectElement.h:
3837         * html/HTMLOptGroupElement.cpp:
3838         * html/HTMLOptGroupElement.h:
3839         * html/HTMLOptionElement.cpp:
3840         * html/HTMLOptionElement.h:
3841         * html/HTMLOutputElement.cpp:
3842         * html/HTMLOutputElement.h:
3843         * html/HTMLParagraphElement.cpp:
3844         * html/HTMLParagraphElement.h:
3845         * html/HTMLParamElement.cpp:
3846         * html/HTMLParamElement.h:
3847         * html/HTMLPictureElement.cpp:
3848         * html/HTMLPictureElement.h:
3849         * html/HTMLPlugInElement.cpp:
3850         * html/HTMLPlugInElement.h:
3851         * html/HTMLPlugInImageElement.cpp:
3852         * html/HTMLPlugInImageElement.h:
3853         * html/HTMLPreElement.cpp:
3854         * html/HTMLPreElement.h:
3855         * html/HTMLProgressElement.cpp:
3856         * html/HTMLProgressElement.h:
3857         * html/HTMLQuoteElement.cpp:
3858         * html/HTMLQuoteElement.h:
3859         * html/HTMLScriptElement.cpp:
3860         * html/HTMLScriptElement.h:
3861         * html/HTMLSelectElement.cpp:
3862         * html/HTMLSelectElement.h:
3863         * html/HTMLSlotElement.cpp:
3864         * html/HTMLSlotElement.h:
3865         * html/HTMLSourceElement.cpp:
3866         * html/HTMLSourceElement.h:
3867         * html/HTMLSpanElement.cpp:
3868         * html/HTMLSpanElement.h:
3869         * html/HTMLStyleElement.cpp:
3870         * html/HTMLStyleElement.h:
3871         * html/HTMLSummaryElement.cpp:
3872         * html/HTMLSummaryElement.h:
3873         * html/HTMLTableCaptionElement.cpp:
3874         * html/HTMLTableCaptionElement.h:
3875         * html/HTMLTableCellElement.cpp:
3876         * html/HTMLTableCellElement.h:
3877         * html/HTMLTableColElement.cpp:
3878         * html/HTMLTableColElement.h:
3879         * html/HTMLTableElement.cpp:
3880         * html/HTMLTableElement.h:
3881         * html/HTMLTablePartElement.cpp:
3882         * html/HTMLTablePartElement.h:
3883         * html/HTMLTableRowElement.cpp:
3884         * html/HTMLTableRowElement.h:
3885         * html/HTMLTableSectionElement.cpp:
3886         * html/HTMLTableSectionElement.h:
3887         * html/HTMLTemplateElement.cpp:
3888         * html/HTMLTemplateElement.h:
3889         * html/HTMLTextAreaElement.cpp:
3890         * html/HTMLTextAreaElement.h:
3891         * html/HTMLTextFormControlElement.cpp:
3892         * html/HTMLTextFormControlElement.h:
3893         * html/HTMLTimeElement.cpp:
3894         * html/HTMLTimeElement.h:
3895         * html/HTMLTitleElement.cpp:
3896         * html/HTMLTitleElement.h:
3897         * html/HTMLTrackElement.cpp:
3898         * html/HTMLTrackElement.h:
3899         * html/HTMLUListElement.cpp:
3900         * html/HTMLUListElement.h:
3901         * html/HTMLUnknownElement.cpp: Added.
3902         * html/HTMLUnknownElement.h:
3903         * html/HTMLWBRElement.cpp:
3904         * html/HTMLWBRElement.h:
3905         * html/ImageDocument.cpp:
3906         * html/ImageDocument.h:
3907         * html/LabelableElement.cpp:
3908         * html/LabelableElement.h:
3909         * html/MediaController.cpp:
3910         (MediaController::create): Deleted.
3911         (MediaController::MediaController): Deleted.
3912         (MediaController::addMediaElement): Deleted.
3913         (MediaController::removeMediaElement): Deleted.
3914         (MediaController::containsMediaElement const): Deleted.
3915         (MediaController::buffered const): Deleted.
3916         (MediaController::seekable const): Deleted.
3917         (MediaController::played): Deleted.
3918         (MediaController::duration const): Deleted.
3919         (MediaController::currentTime const): Deleted.
3920         (MediaController::setCurrentTime): Deleted.
3921         (MediaController::unpause): Deleted.
3922         (MediaController::play): Deleted.
3923         (MediaController::pause): Deleted.
3924         (MediaController::setDefaultPlaybackRate): Deleted.
3925         (MediaController::playbackRate const): Deleted.
3926         (MediaController::setPlaybackRate): Deleted.
3927         (MediaController::setVolume): Deleted.
3928         (MediaController::setMuted): Deleted.
3929         (playbackStateWaiting): Deleted.
3930