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