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