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