9c93ff4e644627f05edd6f0651092d49a35d0185
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-01-23  Dean Jackson  <dino@apple.com>
2
3         REGRESSION (r222961?): sRGB images shown in WebGL are over-saturated on a wide gamut monitor
4         https://bugs.webkit.org/show_bug.cgi?id=182033
5         <rdar://problem/36377780>
6
7         Reviewed by Antoine Quint.
8
9         My fix for YouTube360 changed the way we composite WebGL on macOS. Unfortunately it dropped
10         a flag telling the compositor the colorspace of the content should be sRGB. Reinstate this
11         by explicitly setting the colorspace on the IOSurface we use for WebGL back buffers.
12
13         This *should* be covered by the test in:
14         fast/canvas/webgl/match-page-color-space.html
15         ... however, it shows a problem with our testing infrastructure. As long as it is not
16         testing on a Wide Gamut display, and explicitly setting the color profile, an automated
17         test won't pick up this regression. I could add an Internals helper to query the colorspace
18         of the WebGL content, but that doesn't actually verify the composited result, which is
19         all that matters.
20
21         * platform/graphics/cocoa/WebGLLayer.mm:
22         (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
23
24 2018-01-24  Ms2ger  <Ms2ger@igalia.com>
25
26         [GTK] Fix some test failures in ATK selection handling.
27         https://bugs.webkit.org/show_bug.cgi?id=168369
28         <rdar://problem/30534881>
29
30         Reviewed by Joanmarie Diggs.
31
32         In r208479, selectionBelongsToObject was changed to return false if the
33         intersectsNode call returns an exception.
34
35         In particular, this caused accessibility/gtk/text-at-offset-textarea.html
36         to fail. In this test, the selection is situated in the shadow DOM of the
37         textarea, while the node that is checked for intersection is the textarea
38         itself. In line with the standard, intersectsNode returns an exception in
39         this case.
40
41         This caused webkitAccessibleText{Word, Line, Sentence}ForBoundary to stop
42         returning the expected text in the tested case. Removing this check fixes
43         the test, along with some others.
44
45         Tests: accessibility/gtk/text-at-offset-textarea.html
46                accessibility/gtk/text-at-offset-textinput.html
47                accessibility/selected-text-range-aria-elements.html
48                accessibility/textarea-selected-text-range.html
49
50         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
51         (getSelectionOffsetsForObject): Remove the selectionBelongsToObject() call.
52
53 2018-01-18  Sergio Villar Senin  <svillar@igalia.com>
54
55         [WebVR] Add OpenVR to the tree and to the build
56         https://bugs.webkit.org/show_bug.cgi?id=177298
57
58         Reviewed by Žan Doberšek.
59
60         Added build dependencies with the OpenVR library.
61
62         * CMakeLists.txt:
63
64 2018-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
65
66         Harden against layout passes triggered when iterating through HTMLFormElement::associatedElements
67         https://bugs.webkit.org/show_bug.cgi?id=182037
68         <rdar://problem/36747812>
69
70         Reviewed by Ryosuke Niwa.
71
72         Observe that HTMLFormElement::associatedElements returns a const reference to a Vector of raw
73         FormAssociatedElement pointers. In various call sites that iterate through these associated elements using this
74         function, some require synchronous layout updates per iteration, which can lead to a bad time when combined with
75         the first observation.
76
77         To address this, we introduce HTMLFormElement::copyAssociatedElementsVector. This returns a new vector
78         containing strong Refs to each associated element. From each call site that may trigger synchronous layout and
79         execute arbitrary script while iterating over associated form elements, we instead use iterate over protected
80         FormAssociatedElements.
81
82         From each call site that currently doesn't (and shouldn't) require a layout update, we use the old version that
83         returns a list of raw FormAssociatedElement pointers, but add ScriptDisallowedScopes to ensure that we never
84         execute script there in the future.
85
86         Test: fast/forms/form-data-associated-element-iteration.html
87
88         * html/DOMFormData.cpp:
89         (WebCore::DOMFormData::DOMFormData):
90
91         Change to use copyAssociatedElementsVector().
92
93         * html/FormController.cpp:
94         (WebCore::recordFormStructure):
95         (WebCore::FormController::restoreControlStateIn):
96
97         Change to use copyAssociatedElementsVector().
98
99         * html/HTMLFieldSetElement.cpp:
100         (WebCore::HTMLFieldSetElement::copyAssociatedElementsVector const):
101         (WebCore:: const):
102         (WebCore::HTMLFieldSetElement::length const):
103
104         Refactor to use unsafeAssociatedElements().
105
106         * html/HTMLFieldSetElement.h:
107         * html/HTMLFormControlsCollection.cpp:
108         (WebCore:: const):
109         (WebCore::HTMLFormControlsCollection::copyFormControlElementsVector const):
110         (WebCore::HTMLFormControlsCollection::customElementAfter const):
111         (WebCore::HTMLFormControlsCollection::updateNamedElementCache const):
112
113         Refactor these to use unsafeAssociatedElements().
114
115         * html/HTMLFormControlsCollection.h:
116         * html/HTMLFormElement.cpp:
117         (WebCore::HTMLFormElement::unsafeAssociatedElements const):
118         (WebCore::HTMLFormElement::copyAssociatedElementsVector const):
119         * html/HTMLFormElement.h:
120         * loader/FormSubmission.cpp:
121         (WebCore::FormSubmission::create):
122
123         Refactor to use copyAssociatedElementsVector().
124
125 2018-01-23  Basuke Suzuki  <Basuke.Suzuki@sony.com>
126
127         [Curl] Fix wrong redirection with relative url when it happens from
128         different host than original host.
129         https://bugs.webkit.org/show_bug.cgi?id=181873
130
131         Reviewed by Alex Christensen.
132
133         * platform/network/curl/CurlDownload.cpp:
134         (WebCore::CurlDownload::willSendRequest):
135         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
136         (WebCore::ResourceHandleCurlDelegate::willSendRequest):
137
138 2018-01-23  Eric Carlson  <eric.carlson@apple.com>
139
140         Resign NowPlaying status when no media element is eligible
141         https://bugs.webkit.org/show_bug.cgi?id=181914
142         <rdar://problem/35294116>
143
144         Reviewed by Jer Noble.
145
146         Updated API test.
147
148         * html/HTMLMediaElement.cpp:
149         (WebCore::HTMLMediaElement::removedFromAncestor): Call mediaSession->clientCharacteristicsChanged
150         so NowPlaying status will be updated.
151
152         * html/MediaElementSession.cpp:
153         (WebCore::MediaElementSession::playbackPermitted const): Return early when the media 
154         element has been suspended.
155         (WebCore::MediaElementSession::canShowControlsManager const): Return false when being queried
156         for NowPlaying status in an inactive document or when element has been suspended.
157         (WebCore::isMainContentForPurposesOfAutoplay): Return early if it isn't safe to update
158         style because HitTest can force a layout.
159         (WebCore::MediaElementSession::updateIsMainContent const): Ditto.
160
161         * platform/audio/PlatformMediaSessionManager.cpp:
162         (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Implement in for all
163         ports.
164         * platform/audio/PlatformMediaSessionManager.h:
165         (WebCore::PlatformMediaSessionManager::registeredAsNowPlayingApplication const):
166         * platform/audio/ios/MediaSessionManagerIOS.h:
167         * platform/audio/mac/MediaSessionManagerMac.h:
168         * platform/audio/mac/MediaSessionManagerMac.mm:
169         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): Call MRMediaRemoteSetCanBeNowPlayingApplication
170         whenever status changes.
171         (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Deleted, implemented
172         in the base class.
173
174 2018-01-23  Alex Christensen  <achristensen@webkit.org>
175
176         Use CompletionHandlers for ResourceHandleClient::didReceiveResponseAsync
177         https://bugs.webkit.org/show_bug.cgi?id=181961
178
179         Reviewed by Michael Catanzaro.
180
181         No change in behavior.
182
183         * loader/ResourceLoader.cpp:
184         (WebCore::ResourceLoader::didReceiveResponseAsync):
185         * loader/ResourceLoader.h:
186         * loader/appcache/ApplicationCacheGroup.cpp:
187         (WebCore::ApplicationCacheGroup::didReceiveResponseAsync):
188         * loader/appcache/ApplicationCacheGroup.h:
189         * platform/network/BlobResourceHandle.cpp:
190         (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
191         (WebCore::BlobResourceHandle::notifyResponseOnError):
192         (WebCore::BlobResourceHandle::continueDidReceiveResponse): Deleted.
193         * platform/network/BlobResourceHandle.h:
194         * platform/network/PingHandle.h:
195         * platform/network/ResourceHandle.cpp:
196         (WebCore::ResourceHandle::didReceiveResponse):
197         * platform/network/ResourceHandle.h:
198         * platform/network/ResourceHandleClient.h:
199         * platform/network/SynchronousLoaderClient.cpp:
200         (WebCore::SynchronousLoaderClient::didReceiveResponseAsync):
201         * platform/network/SynchronousLoaderClient.h:
202         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
203         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
204         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueDidReceiveResponse): Deleted.
205         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
206         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse):
207         (WebCore::ResourceHandleCurlDelegate::handleDataURL):
208         (WebCore::ResourceHandleCurlDelegate::continueDidReceiveResponse): Deleted.
209         * platform/network/mac/ResourceHandleMac.mm:
210         (WebCore::ResourceHandle::continueDidReceiveResponse): Deleted.
211         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
212         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
213         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
214         (-[WebCoreResourceHandleAsOperationQueueDelegate continueDidReceiveResponse]): Deleted.
215         * platform/network/soup/ResourceHandleSoup.cpp:
216         (WebCore::nextMultipartResponsePartCallback):
217         (WebCore::sendRequestCallback):
218         (WebCore::ResourceHandle::continueDidReceiveResponse): Deleted.
219
220 2018-01-23  Chris Dumez  <cdumez@apple.com>
221
222         Unreviewed, rollout r227216 as it seems to be causing deadlocks
223         https://bugs.webkit.org/show_bug.cgi?id=182013
224
225         * page/ChromeClient.h:
226         * testing/Internals.cpp:
227         (WebCore::Internals::testIncomingSyncIPCMessageWhileWaitingForSyncReply): Deleted.
228         * testing/Internals.h:
229         * testing/Internals.idl:
230
231 2018-01-23  Ali Juma  <ajuma@chromium.org>
232
233         REGRESSION (r226622): ASSERTION FAILED: !m_frame in WebCore::DOMWindowProperty::willDestroyGlobalObjectInCachedFrame()
234         https://bugs.webkit.org/show_bug.cgi?id=181756
235
236         Reviewed by Simon Fraser.
237
238         Don't create a VisualViewport for a suspended DOMWindow. When a DOMWindow is suspended
239         for document suspension, all DOMWindowProperties are disconnected from their frame.
240         Creating a new VisualViewport while in this state means unexpectedly having a DOMWindowProperty
241         that's connected to a frame, and this leads to an assertion failure.
242
243         Test: http/tests/navigation/https-in-page-cache.html
244
245         * page/DOMWindow.cpp:
246         (WebCore::DOMWindow::visualViewport const):
247         Don't create a VisualViewport while suspended.
248         * page/FrameView.cpp:
249         (WebCore::FrameView::updateLayoutViewport):
250         Handle null DOMWindow::visualViewport.
251
252 2018-01-23  Basuke Suzuki  <Basuke.Suzuki@sony.com>
253
254         [Curl] CurlRequest must protect its client from disposal while it's on duty.
255         https://bugs.webkit.org/show_bug.cgi?id=181875
256
257         Reviewed by Alex Christensen.
258
259         No new tests. It's covered by existing tests.
260
261         * platform/network/curl/CurlDownload.h:
262         * platform/network/curl/CurlRequest.cpp:
263         (WebCore::CurlRequest::callClient):
264         (WebCore::CurlRequest::didReceiveData):
265         (WebCore::CurlRequest::didReceiveDataFromMultipart):
266         (WebCore::CurlRequest::didCompleteTransfer):
267         (WebCore::CurlRequest::invokeDidReceiveResponse):
268         * platform/network/curl/CurlRequest.h:
269         * platform/network/curl/CurlRequestClient.h:
270         * platform/network/curl/ResourceHandleCurlDelegate.h:
271
272 2018-01-23  Commit Queue  <commit-queue@webkit.org>
273
274         Unreviewed, rolling out r227437.
275         https://bugs.webkit.org/show_bug.cgi?id=182011
276
277         broke build (Requested by alexchristensen on #webkit).
278
279         Reverted changeset:
280
281         "Remove unused QTKit preference"
282         https://bugs.webkit.org/show_bug.cgi?id=181968
283         https://trac.webkit.org/changeset/227437
284
285 2018-01-23  Antoine Quint  <graouts@apple.com>
286
287         [Web Animations] Expose getKeyframes() and parsing of remaining keyframe properties
288         https://bugs.webkit.org/show_bug.cgi?id=181978
289
290         Not reviewed.
291
292         Fix failures for http/wpt/web-animations/interfaces/AnimationEffectTiming/easing.html introduced in the previous patch.
293         Those keyword values are not expected.
294
295         * platform/animation/TimingFunction.cpp:
296         (WebCore::TimingFunction::cssText const):
297
298 2018-01-23  Simon Fraser  <simon.fraser@apple.com>
299
300         feMorphology stops applying if either x or y radius is 0 but should not.
301         https://bugs.webkit.org/show_bug.cgi?id=181903
302
303         Reviewed by Dean Jackson.
304         
305         feMorphology should allow the radius on one axis to be zero but still apply the effect
306         (it's akin to a blur on just one axis). Also, any negative radius, or zero on both axes
307         should act like a pass-through, rather than outputting transparent blank (this is a spec
308         change from SVG 1.1 to SVG 2).
309
310         Tests: svg/filters/feMorphology-zero-radius-one-axis-expected.svg
311                svg/filters/feMorphology-zero-radius-one-axis.svg
312
313         * platform/graphics/filters/FEMorphology.cpp:
314         (WebCore::FEMorphology::platformApplyDegenerate):
315         * platform/graphics/filters/FilterEffect.cpp:
316         (WebCore::FilterEffect::createImageBufferResult):
317
318 2018-01-23  Alex Christensen  <achristensen@webkit.org>
319
320         Remove unused MediaPlayerSupportsTypeClient
321         https://bugs.webkit.org/show_bug.cgi?id=182003
322
323         Reviewed by Sam Weinig.
324
325         This was used for a QTKit-specific hack I removed in r227372.
326
327         * Modules/encryptedmedia/CDM.cpp:
328         (WebCore::CDM::getSupportedCapabilitiesForAudioVideoType):
329         * Modules/mediasource/MediaSource.cpp:
330         (WebCore::MediaSource::isTypeSupported):
331         * dom/DOMImplementation.cpp:
332         (WebCore::DOMImplementation::createDocument):
333         (WebCore::DOMImplementationSupportsTypeClient::DOMImplementationSupportsTypeClient): Deleted.
334         (): Deleted.
335         * html/HTMLMediaElement.cpp:
336         (WebCore::HTMLMediaElement::canPlayType const):
337         (WebCore::HTMLMediaElement::selectNextSourceChild):
338         (WebCore::HTMLMediaElement::mediaPlayerNeedsSiteSpecificHacks const): Deleted.
339         (WebCore::HTMLMediaElement::mediaPlayerDocumentHost const): Deleted.
340         * html/HTMLMediaElement.h:
341         * platform/graphics/MediaPlayer.cpp:
342         (WebCore::MediaPlayer::supportsType):
343         * platform/graphics/MediaPlayer.h:
344         (WebCore::MediaPlayerSupportsTypeClient::mediaPlayerNeedsSiteSpecificHacks const): Deleted.
345         (WebCore::MediaPlayerSupportsTypeClient::mediaPlayerDocumentHost const): Deleted.
346
347 2018-01-23  Alex Christensen  <achristensen@webkit.org>
348
349         Remove unused QTKit preference
350         https://bugs.webkit.org/show_bug.cgi?id=181968
351
352         Reviewed by Alexey Proskuryakov.
353
354         They weren't used and didn't do anything.
355
356         * page/DeprecatedGlobalSettings.cpp:
357         (WebCore::DeprecatedGlobalSettings::setQTKitEnabled): Deleted.
358         * page/DeprecatedGlobalSettings.h:
359         (WebCore::DeprecatedGlobalSettings::isQTKitEnabled): Deleted.
360
361 2018-01-23  Javier Fernandez  <jfernandez@igalia.com>
362
363         [css-align] 'left' and 'right' should parse as invalid in block/cross-axis alignment
364         https://bugs.webkit.org/show_bug.cgi?id=181792
365
366         Reviewed by Antti Koivisto.
367
368         The CSS WG resolved to remove the 'left' and 'right' values from the
369         block/cross axis alignment properties.
370
371         https://github.com/w3c/csswg-drafts/issues/1403
372
373         This patch changes the CSS parsing logic of all the CSS Box Alignment
374         properties, both block-axis (align-{self, items, content} and
375         inline-axis (justify-{self, items, content}).
376
377         Additionally, the alignment shorthands (place-{self, items, content})
378         have been also changed to respect the new syntax.
379
380         Despite the number of layout tests changed, I don't think this
381         change will break any content in current sites. The CSS values
382         'left' and 'right' were introduced by the new CSS Box Alignment
383         spec and only implemented by the CSS Grid Layout feature, shipped
384         last year. Additionally, the removed values have no effect on the
385         layout result when they are applied to the block/cross-axis CSS
386         Alignment properties.
387
388         Tests: imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-001.html
389                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-002.html
390                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-003.html
391                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-004.html
392                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-005.html
393                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-001.html
394                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-002.html
395                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-003.html
396                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-004.html
397                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-005.html
398                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-001.html
399                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-002.html
400                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-003.html
401                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-004.html
402                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-005.html
403                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-006.html
404                imported/w3c/web-platform-tests/css/css-align/default-alignment/justify-items-legacy-001.html
405                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-001.html
406                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-002.html
407                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-003.html
408                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-004.html
409                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-005.html
410                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-001.html
411                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-002.html
412                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-003.html
413                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-004.html
414                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-005.html
415                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-006.html
416                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-001.html
417                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-002.html
418                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-003.html
419                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-004.html
420                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-005.html
421                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-006.html
422                imported/w3c/web-platform-tests/css/css-align/distribution-values/space-evenly-001.html
423                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-001.html
424                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-002.html
425                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-003.html
426                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-004.html
427                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-005.html
428                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-001.html
429                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-002.html
430                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-003.html
431                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-004.html
432                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-005.html
433                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-001.html
434                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-002.html
435                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-003.html
436                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-004.html
437                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-005.html
438                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-006.html
439
440         * css/parser/CSSPropertyParser.cpp:
441         (WebCore::isLeftOrRightKeyword):
442         (WebCore::isContentPositionKeyword):
443         (WebCore::isContentPositionOrLeftOrRightKeyword):
444         (WebCore::consumeContentDistributionOverflowPosition):
445         (WebCore::isSelfPositionKeyword):
446         (WebCore::isSelfPositionOrLeftOrRightKeyword):
447         (WebCore::consumeSelfPositionOverflowPosition):
448         (WebCore::consumeAlignItems):
449         (WebCore::consumeJustifyItems):
450         (WebCore::CSSPropertyParser::parseSingleValue):
451         (WebCore::consumeSimplifiedContentPosition):
452         (WebCore::CSSPropertyParser::consumePlaceContentShorthand):
453         (WebCore::consumeSimplifiedItemPosition):
454         (WebCore::CSSPropertyParser::consumePlaceItemsShorthand):
455         (WebCore::CSSPropertyParser::consumePlaceSelfShorthand):
456
457 2018-01-23  Simon Fraser  <simon.fraser@apple.com>
458
459         Element with position:fixed stops scrolling at the bottom of the page, but is painted in the right place on Chacos.com.
460         https://bugs.webkit.org/show_bug.cgi?id=181741
461         rdar://problem/36593581
462
463         Reviewed by Tim Horton.
464
465         The #ifdef for iOS was wrong; on iOS, visibleSize() is in content coordinates and matches
466         unscaledDocumentRect, so there's no need to scale it. Doing so computed the wrong unscaledMaximumScrollPosition
467         which broke hit-testing when the document minimum scale was > 1.
468
469         Test: fast/visual-viewport/ios/min-scale-greater-than-one.html
470
471         * page/FrameView.cpp:
472         (WebCore::FrameView::unscaledMaximumScrollPosition const):
473
474 2018-01-23  Antoine Quint  <graouts@apple.com>
475
476         [Web Animations] Expose getKeyframes() and parsing of remaining keyframe properties
477         https://bugs.webkit.org/show_bug.cgi?id=181978
478         <rdar://problem/36772586>
479
480         Reviewed by Dean Jackson.
481
482         We finish our implementation of multiple keyframes by exposing the getKeyframes() method on KeyframeEffect and
483         parsing the remaining properties that can be exposed on keyframes: "easing" and "composite". And since we parse
484         those properties on keyframes, we also parse "easing" on AnimationEffectTiming and "composite" and "iterationComposite"
485         on KeyframeEffect. 
486
487         To support this, we implement a new TimingFunction::createFromCSSText() method which takes in a string that is
488         a value provided directly via the JS API. As its converse, we expose a TimingFunction::cssText() method which
489         provides a string that can be sent back to JS to represent a timing function, using keywords when the timing
490         function matches one and ommitting default values.
491
492         We now also keep track of the original "offset" value provided through the JS API since that value is required
493         when calling getKeyframes() and distinct from the "computedOffset". These original offsets, composite operations
494         and timing functions are kept as separate Vectors from the KeyframeList since this type does not support exposing
495         those. We may consider improving that in a future patch.
496
497         Finally, we make some adjustments in the keyframe parsing to comply with the specification and correctly parse
498         all provided timing functions, regardless of the number of keyframes and timing functions provided.
499
500         Note that this patch is only about parsing, storing and returning provided easing and composite operations but
501         that such values will only be used for the resolution of animation effects in future patches.
502
503         * animation/AnimationEffect.cpp:
504         (WebCore::AnimationEffect::getComputedTiming): Set the "easing" property on the getComputedTiming() return value
505         now that we expose "easing" on AnimationEffectTiming.
506         * animation/AnimationEffectTiming.cpp:
507         (WebCore::AnimationEffectTiming::AnimationEffectTiming): Create a linear TimingFunction by default.
508         (WebCore::AnimationEffectTiming::setEasing): Parse the "easing" value and propagate an exception for invalid values.
509         * animation/AnimationEffectTiming.h: Expose the new "easing" property and backing TimingFunction.
510         * animation/AnimationEffectTiming.idl: Expose the new "easing" property.
511         * animation/KeyframeEffect.cpp:
512         (WebCore::CSSPropertyIDToIDLAttributeName): Provide a way to convert the name of a CSS property to a string that can
513         be used to generate a JS property name for use by getKeyframes().
514         (WebCore::computeMissingKeyframeOffsets): Implement the full steps of the spec.
515         (WebCore::processIterableKeyframes): Fix a problematic declaration for the easing variable.
516         (WebCore::processPropertyIndexedKeyframes): Now that ProcessedKeyframe has both an offset and a computedOffset, use
517         computed offsets. We also fix a couple of loops to fix compliance issues revealed by WPT tests.
518         (WebCore::KeyframeEffect::create): Parse the provided "easing" property on the KeyframeEffectOptions object.
519         (WebCore::KeyframeEffect::getKeyframes): Implement the getKeyframes() method as mandated by the spec.
520         (WebCore::KeyframeEffect::processKeyframes): Keep a list of unused easings so these might be parsed as well, and
521         potentially throw exceptions, as mandated by the spec. For valid easings, store their matching TimingFunction in
522         m_timingFunctions, original offset values in m_offsets and CompositeOperation values in m_compositeOperations.
523         * animation/KeyframeEffect.h: Switch the order in which we specify some of the Variant types so that default values
524         are correctly used.
525         * animation/KeyframeEffect.idl: Switch the order in which we specify some of the Variant types so that default values
526         are correctly used.
527         * platform/animation/TimingFunction.cpp:
528         (WebCore::TimingFunction::createFromCSSText):
529         (WebCore::TimingFunction::cssText const):
530         * platform/animation/TimingFunction.h:
531
532 2018-01-23  Brady Eidson  <beidson@apple.com>
533
534         Allow passing MessagePorts across processes (e.g. ServiceWorkers).
535         https://bugs.webkit.org/show_bug.cgi?id=181178
536
537         Reviewed by Andy Estes.
538
539         Test: http/tests/workers/service/basic-messageport.html
540
541         * dom/MessagePort.cpp:
542         (WebCore::MessagePort::MessagePort):
543         (WebCore::MessagePort::~MessagePort):
544
545         * dom/messageports/MessagePortChannel.cpp:
546         (WebCore::MessagePortChannel::entanglePortWithProcess):
547         * dom/messageports/MessagePortChannel.h:
548
549         * workers/service/SWClientConnection.cpp:
550         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
551         * workers/service/SWClientConnection.h:
552
553         * workers/service/ServiceWorker.cpp:
554         (WebCore::ServiceWorker::postMessage):
555
556         * workers/service/ServiceWorkerClient.cpp:
557         (WebCore::ServiceWorkerClient::postMessage):
558
559         * workers/service/context/SWContextManager.cpp:
560         (WebCore::SWContextManager::postMessageToServiceWorker):
561         * workers/service/context/SWContextManager.h:
562
563 2018-01-23  Commit Queue  <commit-queue@webkit.org>
564
565         Unreviewed, rolling out r227279 and r227373.
566         https://bugs.webkit.org/show_bug.cgi?id=181988
567
568         The LayoutTest crash fix introduced an API test failure.
569         (Requested by ryanhaddad on #webkit).
570
571         Reverted changesets:
572
573         "Resign NowPlaying status when no media element is eligible"
574         https://bugs.webkit.org/show_bug.cgi?id=181914
575         https://trac.webkit.org/changeset/227279
576
577         "Resign NowPlaying status when no media element is eligible"
578         https://bugs.webkit.org/show_bug.cgi?id=181914
579         https://trac.webkit.org/changeset/227373
580
581 2018-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
582
583         Unreviewed, fix some format specifiers added in r227190
584         https://bugs.webkit.org/show_bug.cgi?id=181454
585
586         * dom/messageports/MessagePortChannel.cpp:
587         (WebCore::MessagePortChannel::takeAllMessagesForPort):
588
589 2018-01-23  Ting-Wei Lan  <lantw44@gmail.com>
590
591         [GTK] Add user agent quirk for Microsoft Outlook Web App
592         https://bugs.webkit.org/show_bug.cgi?id=181982
593
594         Reviewed by Michael Catanzaro.
595
596         Microsoft Outlook Web App forces users to switch to the lite version on
597         the login page with our standard user agent on all non-macOS systems.
598         Since it is an application that can be installed by different companies,
599         schools and organizations, it is not possible to fix the issue unless
600         we keep a big list of host names that are known to run it. We check the
601         host name instead of the base domain name here because it is not
602         expected to run all sites under a base domain on this webmail and
603         calendar application.
604
605         https://mail.ntu.edu.tw is a site that is known to run Microsoft Outlook
606         Web App for several years, and it is not likely to change. When there
607         are other sites found to run it and having the same user agent problem,
608         we can expand the list to include them.
609
610         * platform/UserAgentQuirks.cpp:
611         (WebCore::urlRequiresMacintoshPlatform):
612
613 2018-01-23  Yacine Bandou  <yacine.bandou_ext@softathome.com>
614
615         [EME] Add support of multi keys from different sessions in CDMinstanceClearKey
616         https://bugs.webkit.org/show_bug.cgi?id=180083
617
618         Reviewed by Xabier Rodriguez-Calvar.
619
620         Add support of multi keys from different MediaKeySession in CDMInstanceClearKey.
621
622         Currently the CDMInstanceClearKey manages two "m_keys", one is a WTF::Vector
623         where it stores the list of last added keys, an other which is defined in the
624         ClearKeyState::singleton it is a WTF::HashMap, in this last one, it stores the
625         keys lists of each created session.
626
627         The method "keys()" of CDMInstanceClearKey returns the first "m_keys" which
628         contains just the list of last keys.
629
630         The goal of this commit is to return all keys lists of all sessions, thus
631         we remove the "m_keys" which is WTF::Vector and we modify the method
632         "keys()" to return all keys lists, which is stored in "m_keys" WTF::HashMap,
633         in one Vector instead of return just the list of last keys.
634
635         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
636         (WebCore::CDMInstanceClearKey::keys const):
637         (WebCore::CDMInstanceClearKey::updateLicense):
638         * platform/encryptedmedia/clearkey/CDMClearKey.h:
639
640 2018-01-22  Simon Fraser  <simon.fraser@apple.com>
641
642         Optimize building the non-fast scrollable region with multiple iframes
643         https://bugs.webkit.org/show_bug.cgi?id=181971
644
645         Reviewed by Zalan Bujtas.
646
647         AsyncScrollingCoordinator::frameViewLayoutUpdated() is called every time a subframe lays out.
648         We don't need to eagerly update the non-fast scrollable region at this time; we can just mark
649         it dirty, and rely on the existing scrolling tree commit code to recompute it.
650
651         On my machine this makes fast/frames/lots-of-objects.html no longer a timeout.
652
653         * page/scrolling/AsyncScrollingCoordinator.cpp:
654         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
655
656 2018-01-22  Jiewen Tan  <jiewen_tan@apple.com>
657
658         [WebAuthN] Implement PublicKeyCredential's [[Create]] with a dummy authenticator
659         https://bugs.webkit.org/show_bug.cgi?id=181928
660         <rdar://problem/36459893>
661
662         Reviewed by Brent Fulgham.
663
664         This patch implements PublicKeyCredential's [[Create]] from https://www.w3.org/TR/webauthn/#createCredential
665         as of 5 December 2017. In order to do testing, a dummy authenticator is implemented to exercise a failure
666         and a pass path. A number of dependencies need to be resolved later in order to comply with the spec.
667         Also, the current architecture of handling async WebAuthN operations including dispatching, timeout, and aborting
668         might need a redesign once the underlying authenticator is clear. Since this is our first attempt to implement
669         a prototype, all those limitations, in my opinion, can be marked as non-blocking to accelerate the whole
670         process. Those limitations will then be addressed once the first prototype is finshed.
671
672         Tests: http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https.html
673                http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html
674                http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html
675                http/wpt/webauthn/idl.https.html
676                http/wpt/webauthn/public-key-credential-create-failure.https.html
677                http/wpt/webauthn/public-key-credential-create-success.https.html
678
679         * Modules/credentialmanagement/BasicCredential.h:
680         * Modules/credentialmanagement/BasicCredential.idl:
681         * Modules/credentialmanagement/CredentialsContainer.cpp:
682         (WebCore::CredentialsContainer::PendingPromise::PendingPromise):
683         (WebCore::CredentialsContainer::dispatchTask):
684         (WebCore::CredentialsContainer::get):
685         (WebCore::CredentialsContainer::isCreate):
686         (WebCore::CredentialsContainer::preventSilentAccess const):
687         (WebCore::CredentialsContainer::preventSilentAccess): Deleted.
688         * Modules/credentialmanagement/CredentialsContainer.h:
689         (WebCore::CredentialsContainer::PendingPromise::create):
690         * Modules/webauthn/Authenticator.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp.
691         (WebCore::Authenticator::singleton):
692         (WebCore::Authenticator::makeCredential const):
693         * Modules/webauthn/Authenticator.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h.
694         * Modules/webauthn/AuthenticatorAssertionResponse.cpp:
695         (WebCore::AuthenticatorAssertionResponse::authenticatorData const):
696         (WebCore::AuthenticatorAssertionResponse::signature const):
697         (WebCore::AuthenticatorAssertionResponse::userHandle const):
698         (WebCore::AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse): Deleted.
699         (WebCore::AuthenticatorAssertionResponse::authenticatorData): Deleted.
700         (WebCore::AuthenticatorAssertionResponse::signature): Deleted.
701         (WebCore::AuthenticatorAssertionResponse::userHandle): Deleted.
702         * Modules/webauthn/AuthenticatorAssertionResponse.h:
703         (WebCore::AuthenticatorAssertionResponse::create):
704         * Modules/webauthn/AuthenticatorAttestationResponse.cpp:
705         (WebCore::AuthenticatorAttestationResponse::attestationObject const):
706         (WebCore::AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse): Deleted.
707         (WebCore::AuthenticatorAttestationResponse::attestationObject): Deleted.
708         * Modules/webauthn/AuthenticatorAttestationResponse.h:
709         (WebCore::AuthenticatorAttestationResponse::create):
710         * Modules/webauthn/AuthenticatorResponse.cpp:
711         (WebCore::AuthenticatorResponse::clientDataJSON const):
712         (WebCore::AuthenticatorResponse::~AuthenticatorResponse): Deleted.
713         (WebCore::AuthenticatorResponse::clientDataJSON): Deleted.
714         * Modules/webauthn/AuthenticatorResponse.h:
715         * Modules/webauthn/AuthenticatorResponse.idl:
716         * Modules/webauthn/PublicKeyCredential.cpp:
717         (WebCore::PublicKeyCredentialInternal::produceClientDataJson):
718         (WebCore::PublicKeyCredentialInternal::produceClientDataJsonHash):
719         (WebCore::PublicKeyCredentialInternal::getIdFromAttestationObject):
720         (WebCore::PublicKeyCredential::PublicKeyCredential):
721         (WebCore::PublicKeyCredential::discoverFromExternalSource):
722         (WebCore::PublicKeyCredential::create):
723         (WebCore::PublicKeyCredential::rawId const):
724         (WebCore::PublicKeyCredential::response const):
725         (WebCore::PublicKeyCredential::getClientExtensionResults const):
726         (WebCore::PublicKeyCredential::rawId): Deleted.
727         (WebCore::PublicKeyCredential::response): Deleted.
728         (WebCore::PublicKeyCredential::getClientExtensionResults): Deleted.
729         * Modules/webauthn/PublicKeyCredential.h:
730         * Modules/webauthn/PublicKeyCredential.idl:
731         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
732         (): Deleted.
733         * Modules/webauthn/PublicKeyCredentialDescriptor.h:
734         * Modules/webauthn/PublicKeyCredentialDescriptor.idl:
735         * Sources.txt:
736         * WebCore.xcodeproj/project.pbxproj:
737         * bindings/js/JSAuthenticatorResponseCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorAttestationResponse.cpp.
738         (WebCore::toJSNewlyCreated):
739         (WebCore::toJS):
740         * bindings/js/JSBasicCredentialCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp.
741         (WebCore::toJSNewlyCreated):
742         (WebCore::toJS):
743         * bindings/js/JSBindingsAllInOne.cpp:
744
745 2018-01-22  Myles C. Maxfield  <mmaxfield@apple.com>
746
747         [Cocoa] Support font collections
748         https://bugs.webkit.org/show_bug.cgi?id=181826
749         <rdar://problem/36455137>
750
751         Reviewed by Dean Jackson.
752
753         Use the CoreText call CTFontManagerCreateFontDescriptorsFromData() to get all the descriptors inside
754         the collection file. We select which one by using the fragment identifier at the end of the url linking
755         to the remote font. For example, to select the 4th font inside a TTC file, the @font-face block would
756         look like:
757
758         @font-face {
759             font-family: "MyFont";
760             src: url("path/to/font.ttc#4");
761         }
762
763         Note that these numbers are 1-indexed.
764
765         The CSS Fonts spec states:
766         > Fragment identifiers are used to indicate which font to load. If a container format lacks a defined
767         > fragment identifier scheme, implementations should use a simple 1-based indexing scheme (e.g.
768         > "font-collection#1" for the first font, "font-collection#2" for the second font).
769
770         Not only are TTC font collections supported, but WOFF2 font collections are also supported, which is
771         increasingly important web standard.
772
773         No new tests because I don't have a font collection file with the appropriate license for the
774         WebKit repository. I tested manually.
775
776         * css/CSSFontFaceSource.cpp:
777         (WebCore::CSSFontFaceSource::load):
778         * loader/cache/CachedFont.cpp:
779         (WebCore::CachedFont::calculateIndex const):
780         (WebCore::CachedFont::ensureCustomFontData):
781         (WebCore::CachedFont::createCustomFontData):
782         * loader/cache/CachedFont.h:
783         * platform/graphics/cairo/FontCustomPlatformData.h:
784         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
785         (WebCore::createFontCustomPlatformData):
786         * platform/graphics/mac/FontCustomPlatformData.cpp:
787         (WebCore::createFontCustomPlatformData):
788         * platform/graphics/mac/FontCustomPlatformData.h:
789         * platform/graphics/win/FontCustomPlatformData.cpp:
790         (WebCore::createFontCustomPlatformData):
791         * platform/graphics/win/FontCustomPlatformData.h:
792         * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
793         (WebCore::createFontCustomPlatformData):
794
795 2018-01-22  Simon Fraser  <simon.fraser@apple.com>
796
797         REGRESSION (r227011): fast/frames/hidpi-position-iframe-on-device-pixel.html times out
798         https://bugs.webkit.org/show_bug.cgi?id=181959
799
800         Reviewed by Zalan Bujtas.
801
802         This test creates 300 iframes, which became slow after r227011 because they all became part
803         of the non-fast scrollable region, slowing down ScrollingCoordinator::absoluteEventTrackingRegionsForFrame().
804
805         Fix by not adding non-scrollable iframes, and making FrameView::isScrollable() more efficient for frames
806         that have not done layout yet.
807
808         * page/FrameView.cpp:
809         (WebCore::FrameView::isScrollable):
810         (WebCore::FrameView::addChild):
811
812 2018-01-22  Dan Bernstein  <mitz@apple.com>
813
814         Fixed building for macOS 10.12 with the macOS 10.13 SDK after r227156.
815
816         * Configurations/WebCore.xcconfig:
817
818 2018-01-22  Simon Fraser  <simon.fraser@apple.com>
819
820         REGRESSION (r226981): ASSERTION FAILED: startY >= 0 && endY <= height && startY < endY in WebCore::FEMorphology::platformApplyGeneric
821         https://bugs.webkit.org/show_bug.cgi?id=181836
822
823         Reviewed by Tim Horton.
824         
825         All the filters that use ParallelJobs<> has the same type of bug where very wide but not tall
826         filter regions could result in computing an optimalThreadNumber that was greater than the
827         number of rows to process, which resulted in jobs with zero rows to process.
828
829         Since we split the work by rows, cap the maximum number of threads to height/8 so that each job
830         has at least 8 rows of pixels to process. Add some assertions to detect jobs with zero rows.
831
832         FEMorphology was also using implicit float -> int conversion to detect integer overflow of radius,
833         so change that to use explicit clamping.
834         
835         Tests: svg/filters/feLighting-parallel-jobs.svg
836                svg/filters/feTurbulence-parallel-jobs-wide.svg
837
838         * platform/graphics/filters/FELighting.cpp:
839         (WebCore::FELighting::platformApplyGenericPaint):
840         (WebCore::FELighting::platformApplyGeneric):
841         * platform/graphics/filters/FEMorphology.cpp:
842         (WebCore::FEMorphology::platformApplyGeneric):
843         (WebCore::FEMorphology::platformApply):
844         (WebCore::FEMorphology::platformApplyDegenerate):
845         (WebCore::FEMorphology::platformApplySoftware):
846         * platform/graphics/filters/FETurbulence.cpp:
847         (WebCore::FETurbulence::fillRegion const):
848         (WebCore::FETurbulence::platformApplySoftware):
849
850 2018-01-22  Eric Carlson  <eric.carlson@apple.com>
851
852         Resign NowPlaying status when no media element is eligible
853         https://bugs.webkit.org/show_bug.cgi?id=181914
854         <rdar://problem/35294116>
855
856         Reviewed by Jer Noble.
857
858         No new tests, these changes prevent existing tests from crashing.
859
860         * html/HTMLMediaElement.h:
861         * html/MediaElementSession.cpp:
862         (WebCore::MediaElementSession::playbackPermitted const): Return early when the media 
863         element has been suspended.
864         (WebCore::MediaElementSession::canShowControlsManager const): Return false when the
865         media element has been suspended.
866         (WebCore::isMainContentForPurposesOfAutoplay): Return early if it isn't safe to update
867         style because HitTest can force a layout.
868         (WebCore::MediaElementSession::updateIsMainContent const): Ditto.
869
870 2018-01-22  Alex Christensen  <achristensen@webkit.org>
871
872         Begin removing QTKit code
873         https://bugs.webkit.org/show_bug.cgi?id=181951
874
875         Reviewed by Jer Noble.
876
877         QTKit was being used on El Capitan and before.
878
879         * Configurations/WebCore.xcconfig:
880         * SourcesMac.txt:
881         * WebCore.xcodeproj/project.pbxproj:
882         * platform/graphics/MediaPlayer.cpp:
883         (WebCore::buildMediaEnginesVector):
884         (WebCore::MediaPlayer::supportsType):
885         * platform/graphics/mac/MediaPlayerPrivateQTKit.h: Removed.
886         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: Removed.
887         * platform/graphics/mac/MediaTimeQTKit.h: Removed.
888         * platform/graphics/mac/MediaTimeQTKit.mm: Removed.
889         * platform/mac/WebVideoFullscreenController.mm:
890         (-[WebVideoFullscreenController setVideoElement:]):
891         (-[WebVideoFullscreenController updatePowerAssertions]):
892
893 2018-01-22  Per Arne Vollan  <pvollan@apple.com>
894
895         [Win] Null pointer crash under WebCore::RenderStyle::colorIncludingFallback.
896         https://bugs.webkit.org/show_bug.cgi?id=181801
897         <rdar://problem/35614900>
898
899         Reviewed by Brent Fulgham.
900
901         Do not paint synchronously when popup items have been added or changed while the popup is visible.
902         If new popup items have been added after the popup was shown, a synchronous paint operation will
903         possibly access their style before it is ready, leading to a null pointer crash. The invalidated
904         area will be painted asynchronously.
905
906         No new tests. To reproduce this crash, it is necessary to open a popup with JavaScript, add new
907         popup items, and then end the test. Opening the popup can be done by sending a mousedown event
908         with the eventsender. However, on Windows the mousedown event is sent synchronously, and will
909         block as long as the popup is open and running the popup event loop. This means no JS can be
910         executed until the popup is closed, causing the test to always time out before new popup items
911         can be added. I have verified the fix with a manual test case.
912
913         * platform/win/PopupMenuWin.cpp:
914         (WebCore::PopupMenuWin::updateFromElement):
915
916 2018-01-22  Chris Dumez  <cdumez@apple.com>
917
918         RELEASE_ASSERT(registration) hit in SWServer::installContextData(const ServiceWorkerContextData&)
919         https://bugs.webkit.org/show_bug.cgi?id=181941
920         <rdar://problem/36744892>
921
922         Reviewed by Youenn Fablet.
923
924         Make sure we clear SWServer::m_pendingContextDatas & SWServer::m_pendingJobs as needed
925         when clearing Website data. Otherwise, we will hit assertion when those gets processed
926         after the connection to the SW process has been established (not to mentioned we failed
927         to clear some in-memory data even though the user asked us to).
928
929         * workers/service/server/SWServer.cpp:
930         (WebCore::SWServer::clearAll):
931         (WebCore::SWServer::clear):
932
933 2018-01-22  Ryosuke Niwa  <rniwa@webkit.org>
934
935         Blob conversion and sanitization doesn't work with Microsoft Word for Mac 2011
936         https://bugs.webkit.org/show_bug.cgi?id=181616
937         <rdar://problem/36484908>
938
939         Reviewed by Wenson Hsieh.
940
941         The bug was caused by WebContentReader::readHTML and WebContentMarkupReader::readHTML not sanitizing plain HTML string
942         as done for web archives even when custom pasteboard data is enabled. Fixed the bug by doing the sanitization.
943
944         Unfortunately, we can't make file URLs available in this case because WebContent process doesn't have sandbox extensions
945         to access local files referenced by the HTML source in the clipboard, and we can't make WebContent process request for
946         a sandbox extension¸on an arbitrary local file, as it would defeat the whole point of sandboxing.
947
948         Instead, we strip away all HTML attributes referencing a URL whose scheme is not HTTP, HTTPS, or data when sanitizing
949         text/html from the clipboard to avoid exposing local file paths, which can reveal privacy & security sensitive data
950         such as the user's full name, and the location of private containers of other applications in the system.
951
952         Tests: PasteHTML.DoesNotSanitizeHTMLWhenCustomPasteboardDataIsDisabled
953                PasteHTML.DoesNotStripFileURLsWhenCustomPasteboardDataIsDisabled
954                PasteHTML.ExposesHTMLTypeInDataTransfer
955                PasteHTML.KeepsHTTPURLs
956                PasteHTML.SanitizesHTML
957                PasteHTML.StripsFileURLs
958
959         * editing/cocoa/WebContentReaderCocoa.mm:
960         (WebCore::WebContentReader::readHTML): Fixed the bug by sanitizing the markup, and stripping away file URLs.
961         (WebCore::WebContentMarkupReader::readHTML): Ditto.
962         * editing/markup.cpp:
963         (WebCore::removeSubresourceURLAttributes): Added.
964         (WebCore::sanitizeMarkup): Added.
965         * editing/markup.h:
966
967 2018-01-22  Chris Dumez  <cdumez@apple.com>
968
969         Add release logging to help debug issues related to service workers
970         https://bugs.webkit.org/show_bug.cgi?id=181935
971         <rdar://problem/36735900>
972
973         Reviewed by Brady Eidson.
974
975         * workers/service/ServiceWorker.cpp:
976         (WebCore::ServiceWorker::ServiceWorker):
977         (WebCore::ServiceWorker::scheduleTaskToUpdateState):
978         (WebCore::ServiceWorker::postMessage):
979         (WebCore::ServiceWorker::isAlwaysOnLoggingAllowed const):
980         * workers/service/ServiceWorker.h:
981         * workers/service/ServiceWorkerContainer.cpp:
982         (WebCore::ServiceWorkerContainer::addRegistration):
983         (WebCore::ServiceWorkerContainer::removeRegistration):
984         (WebCore::ServiceWorkerContainer::updateRegistration):
985         (WebCore::ServiceWorkerContainer::jobFailedWithException):
986         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
987         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
988         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
989         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
990         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
991         (WebCore::ServiceWorkerContainer::isAlwaysOnLoggingAllowed const):
992         * workers/service/ServiceWorkerContainer.h:
993         * workers/service/ServiceWorkerRegistration.cpp:
994         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
995         (WebCore::ServiceWorkerRegistration::updateStateFromServer):
996         (WebCore::ServiceWorkerRegistration::scheduleTaskToFireUpdateFoundEvent):
997         * workers/service/server/SWServer.cpp:
998         (WebCore::SWServer::scriptContextFailedToStart):
999         (WebCore::SWServer::didFinishInstall):
1000         (WebCore::SWServer::didFinishActivation):
1001         (WebCore::SWServer::terminateWorkerInternal):
1002         * workers/service/server/SWServerJobQueue.cpp:
1003         (WebCore::SWServerJobQueue::didResolveRegistrationPromise):
1004         (WebCore::SWServerJobQueue::runRegisterJob):
1005
1006 2018-01-22  Youenn Fablet  <youenn@apple.com>
1007
1008         Safari Tech Preview can't use GitHub login at forums.swift.org
1009         https://bugs.webkit.org/show_bug.cgi?id=181908
1010         <rdar://problem/36715111>
1011
1012         Reviewed by Chris Dumez.
1013
1014         Test: http/wpt/service-workers/navigation-redirect.https.html
1015
1016         For subresource loads, redirections will not change who is in charge of continuing the load (service worker or network process).
1017         For navigation loads, we need to match the registration for every redirection since this is using the Manual redirect mode.
1018         This allows starting the load with a service worker and finishing the load with another service worker, which will become the controller.
1019
1020         Implement this by wrapping the registration matching of an URL within DocumentLoader::matchRegistration.
1021         Use that method in DocumentLoader::redirectReceived.
1022
1023         * loader/DocumentLoader.cpp:
1024         (WebCore::DocumentLoader::matchRegistration):
1025         (WebCore::doRegistrationsMatch):
1026         (WebCore::DocumentLoader::redirectReceived):
1027         (WebCore::DocumentLoader::startLoadingMainResource):
1028         * loader/DocumentLoader.h:
1029
1030 2018-01-22  Antti Koivisto  <antti@apple.com>
1031
1032         REGRESSION (Safari 11): Buttons inside a fieldset legend cannot be clicked on in Safari 11
1033         https://bugs.webkit.org/show_bug.cgi?id=179666
1034         <rdar://problem/35534292>
1035
1036         Reviewed by Zalan Bujtas.
1037
1038         The legend element of a fieldset is in the border area, outside the clip rect.
1039         With overflow:hidden mouse events won't reach it.
1040
1041         Test case by Dhaya Benmessaoud.
1042
1043         Test: fast/forms/legend-overflow-hidden-hit-test.html
1044
1045         * rendering/RenderBlock.cpp:
1046         (WebCore::RenderBlock::nodeAtPoint):
1047         (WebCore::RenderBlock::hitTestExcludedChildrenInBorder):
1048
1049         Add a special case to hit testing to handle legend, similarly to what is done for painting.
1050
1051         * rendering/RenderBlock.h:
1052
1053 2018-01-22  Joanmarie Diggs  <jdiggs@igalia.com>
1054
1055         AX: Implement support for Graphics ARIA roles
1056         https://bugs.webkit.org/show_bug.cgi?id=181796
1057
1058         Reviewed by Chris Fleizach.
1059
1060         Add mappings for the three new roles (graphics-document, graphics-object,
1061         and graphics-symbol) as per the Graphics Accessibility API Mappings spec.
1062
1063         No new tests; instead, new test cases added to roles-computedRoleString.html
1064         and roles-exposed.html.
1065
1066         * accessibility/AccessibilityObject.cpp:
1067         (WebCore::initializeRoleMap):
1068         (WebCore::AccessibilityObject::computedRoleString const):
1069         * accessibility/AccessibilityObject.h:
1070         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1071         (atkRole):
1072         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1073         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
1074         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1075         (createAccessibilityRoleMap):
1076         (-[WebAccessibilityObjectWrapper subrole]):
1077         (-[WebAccessibilityObjectWrapper roleDescription]):
1078
1079 2018-01-22  Antti Koivisto  <antti@apple.com>
1080
1081         REGRESSION(r224535): Can't write reviews in the App Store
1082         https://bugs.webkit.org/show_bug.cgi?id=181936
1083         <rdar://problem/36670246>
1084
1085         Reviewed by Zalan Bujtas.
1086
1087         * page/LayoutContext.cpp:
1088         (WebCore::LayoutContext::updateStyleForLayout):
1089
1090         r224535 was about media queries but it also removed a seemingly spurious call to SyleScope::didChangeStyleSheetEnvironment
1091         from the path that does not involve media queries.
1092         Turns out UITextContentView somehow depended on it, so revert this specific change.
1093
1094 2018-01-22  Brady Eidson  <beidson@apple.com>
1095
1096         In WebKit2, make the MessagePortChannelRegistry live in the UI process.
1097         https://bugs.webkit.org/show_bug.cgi?id=181922
1098
1099         Reviewed by Andy Estes.
1100
1101         No new tests (Refactor, no behavior change)
1102
1103         Add encoder/decoders and EXPORT a whole bunch of stuff.
1104         
1105         * WebCore.xcodeproj/project.pbxproj:
1106
1107         * dom/MessagePort.h:
1108
1109         * dom/messageports/MessagePortChannel.cpp:
1110         (WebCore::MessagePortChannel::processForPort):
1111         * dom/messageports/MessagePortChannel.h:
1112
1113         * dom/messageports/MessagePortChannelProvider.h:
1114         * dom/messageports/MessagePortChannelRegistry.h:
1115
1116         * dom/messageports/MessageWithMessagePorts.h:
1117         (WebCore::MessageWithMessagePorts::encode const):
1118         (WebCore::MessageWithMessagePorts::decode):
1119
1120 2018-01-22  Youenn Fablet  <youenn@apple.com>
1121
1122         Fetch Headers from an Opaque response should be filtered out
1123         https://bugs.webkit.org/show_bug.cgi?id=181926
1124
1125         Reviewed by Chris Dumez.
1126
1127         Covered by updated test.
1128
1129         Refactor to use the same FetchResponse::create for Cache API and cloning.
1130         In this method, ensure that response and headers are filtered correctly according response tainting.
1131         Make also sure that synthetic responses do not get filtered (not needed since created by JavaScript).
1132
1133         Introduce helper routine to set the header map of a resource response.
1134         Use this routine when cloning a synthetic response as in that case, m_internalResponse has no header at all.
1135
1136         * Modules/cache/DOMCache.cpp:
1137         (WebCore::DOMCache::updateRecords):
1138         * Modules/fetch/FetchResponse.cpp:
1139         (WebCore::FetchResponse::create):
1140         (WebCore::FetchResponse::clone):
1141         * Modules/fetch/FetchResponse.h:
1142         * platform/network/ResourceResponseBase.cpp:
1143         (WebCore::ResourceResponseBase::setHTTPHeaderFields):
1144         * platform/network/ResourceResponseBase.h:
1145         * testing/ServiceWorkerInternals.cpp:
1146         (WebCore::ServiceWorkerInternals::createOpaqueWithBlobBodyResponse):
1147
1148 2018-01-22  Javier Fernandez  <jfernandez@igalia.com>
1149
1150         [css-align] 'overflow' keyword must precede the self-position and content-position value
1151         https://bugs.webkit.org/show_bug.cgi?id=181793
1152
1153         Reviewed by Antti Koivisto.
1154
1155         There were several discussions to avoid ambiguities with the complex
1156         values, specially when it comes to define the place-xxx shorthands.
1157
1158         One of the sources of problems is the 'overflow-position' keyword. The
1159         CSS WG has decided to change the syntax of all the CSS Box Alignment
1160         properties so that the 'overflow-position' keyword always precede the
1161         'self-position' or the 'content-position' keywords.
1162
1163         https://github.com/w3c/csswg-drafts/issues/1446#event-1125715434
1164
1165         In order to apply this change to the Content Distribution properties'
1166         (align-content and justify-content) syntax I had to completely
1167         re-implement their parsing function. Thanks to this I addressed also
1168         the issue with the content-distribution fallback, which cannot be
1169         specified explicitly now.
1170
1171         https://github.com/w3c/csswg-drafts/issues/1002#ref-commit-c38cac4
1172
1173         No new tests, just rebaselined the expected results of the test cases affected.
1174
1175         Despite the so many layout tests affected by this change, it's
1176         unlikely that it might break any content in current web
1177         sites. This patch changes the new CSS syntax, obviously backward
1178         compatible, defined by the new CSS Box Alignment. The
1179         'overflow-position' keyword is only used by the layout models
1180         implementing the new spec, so far only CSS Grid Layout.
1181         Considering that CSS Grid has been shipped last year, it's unlikely
1182         that many sites are using the new CSS values.
1183
1184         * css/CSSComputedStyleDeclaration.cpp:
1185         (WebCore::valueForItemPositionWithOverflowAlignment):
1186         (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):
1187         * css/CSSContentDistributionValue.cpp:
1188         (WebCore::CSSContentDistributionValue::customCSSText const):
1189         * css/StyleBuilderConverter.h:
1190         (WebCore::StyleBuilderConverter::convertSelfOrDefaultAlignmentData):
1191         * css/parser/CSSPropertyParser.cpp:
1192         (WebCore::consumeOverflowPositionKeyword):
1193         (WebCore::consumeContentPositionKeyword):
1194         (WebCore::consumeContentDistributionOverflowPosition):
1195         (WebCore::consumeSelfPositionOverflowPosition):
1196
1197 2018-01-22  Chris Nardi  <csnardi1@gmail.com>
1198
1199         Parse calc() in CSS media queries
1200         https://bugs.webkit.org/show_bug.cgi?id=181716
1201
1202         calc() was previously unsupported inside of media queries. This change
1203         adds in support for parsing calc inside of media queries.
1204
1205         Reviewed by Antti Koivisto.
1206
1207         Tests: Imported web-platform-tests/css/mediaqueries
1208
1209         * css/MediaQueryExpression.cpp:
1210         (WebCore::featureWithValidIdent): Updated function to take a CSSPrimitiveValue.
1211         (WebCore::featureWithValidDensity): Updated function to take a CSSPrimitiveValue instead of a CSSParserToken.
1212         (WebCore::featureWithValidPositiveLength): Ditto.
1213         (WebCore::featureExpectingPositiveInteger): Ditto.
1214         (WebCore::featureWithPositiveInteger): Ditto.
1215         (WebCore::featureWithPositiveNumber): Ditto.
1216         (WebCore::featureWithZeroOrOne): Ditto.
1217         (WebCore::MediaQueryExpression::MediaQueryExpression): Use CSSPropertyParserHelpers for consuming.
1218         * css/MediaQueryExpression.h:
1219         * css/parser/CSSPropertyParserHelpers.cpp:
1220         (WebCore::CSSPropertyParserHelpers::consumeResolution): Added function for use in media query expression parsing.
1221         * css/parser/CSSPropertyParserHelpers.h:
1222         * css/parser/MediaQueryParser.cpp:
1223         (WebCore::MediaQueryParser::readRestrictor): Updated functions to take a CSSParserTokenRange in order to use CSSPropertyParserHelpers.
1224         (WebCore::MediaQueryParser::readMediaNot): Ditto.
1225         (WebCore::MediaQueryParser::readMediaType): Ditto.
1226         (WebCore::MediaQueryParser::readAnd): Ditto.
1227         (WebCore::MediaQueryParser::readFeatureStart): Ditto.
1228         (WebCore::MediaQueryParser::readFeature): Ditto.
1229         (WebCore::MediaQueryParser::readFeatureColon): Ditto.
1230         (WebCore::MediaQueryParser::readFeatureValue): Ditto.
1231         (WebCore::MediaQueryParser::readFeatureEnd): Ditto.
1232         (WebCore::MediaQueryParser::skipUntilComma): Ditto.
1233         (WebCore::MediaQueryParser::skipUntilBlockEnd): Ditto.
1234         (WebCore::MediaQueryParser::processToken): Ditto.
1235         (WebCore::MediaQueryParser::parseInternal): Ditto.
1236         (WebCore::MediaQueryData::clear): Removed reference to m_valueList
1237         (WebCore::MediaQueryData::addExpression): Use CSSParserTokenRange.
1238         (WebCore::MediaQueryData::lastExpressionValid): New helper function.
1239         (WebCore::MediaQueryData::removeLastExpression): New helper function.
1240         * css/parser/MediaQueryParser.h:
1241
1242 2018-01-22  Zan Dobersek  <zdobersek@igalia.com>
1243
1244         [Cairo] Refactor PlatformContextCairo::drawSurfaceToContext() into a Cairo operation
1245         https://bugs.webkit.org/show_bug.cgi?id=181930
1246
1247         Reviewed by Carlos Garcia Campos.
1248
1249         Move the PlatformContextCairo::drawSurfaceToContext() code into the
1250         Cairo namespace as an operation, renaming it to drawSurface(). Mirroring
1251         other operations, the PlatformContextCairo object is now passed through
1252         a reference as the first argument to the function, and cairo_t context
1253         object is retrieved from that.
1254
1255         Call sites of the PlatformContextCairo::drawSurfaceToContext() method
1256         are adjusted to now call Cairo::drawSurface() and properly pass the
1257         PlatformContextCairo object to the function.
1258
1259         No new tests -- no change in functionality.
1260
1261         * platform/graphics/cairo/CairoOperations.cpp:
1262         (WebCore::Cairo::prepareForStroking): Make this static.
1263         (WebCore::Cairo::drawPatternToCairoContext):
1264         (WebCore::Cairo::drawNativeImage):
1265         (WebCore::Cairo::drawSurface):
1266         * platform/graphics/cairo/CairoOperations.h:
1267         * platform/graphics/cairo/PlatformContextCairo.cpp:
1268         (WebCore::drawPatternToCairoContext): Deleted.
1269         (WebCore::PlatformContextCairo::drawSurfaceToContext): Deleted.
1270         * platform/graphics/cairo/PlatformContextCairo.h:
1271         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1272         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
1273
1274 2018-01-22  Manuel Rego Casasnovas  <rego@igalia.com>
1275
1276         [css-grid] Spanning Grid item has too much space at the bottom / is too high
1277         https://bugs.webkit.org/show_bug.cgi?id=181677
1278
1279         Reviewed by Javier Fernandez.
1280
1281         In IndefiniteSizeStrategy::findUsedFlexFraction() we were not
1282         subtracting the size of the gutters when we call findFrUnitSize().
1283         If an item spans several tracks, we cannot pass the maxContentForChild()
1284         directly, we need to subtract the gutters as they are treated
1285         as fixed size tracks in the algorithm.
1286
1287         The spec text is pretty clear regarding this
1288         (https://drafts.csswg.org/css-grid/#algo-find-fr-size):
1289         "Let leftover space be the space to fill minus the base sizes
1290          of the non-flexible grid tracks."
1291
1292         Gutters are treated as fixed-size tracks for the purpose
1293         of the track sizing algorithm, so we need to subtract them from the
1294         leftover space while finding the size of an "fr".
1295
1296         Tests: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-find-fr-size-gutters-001.html
1297                imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-find-fr-size-gutters-002.html
1298
1299         * rendering/GridTrackSizingAlgorithm.cpp:
1300         (WebCore::GridTrackSizingAlgorithm::findFrUnitSize const):
1301         (WebCore::IndefiniteSizeStrategy::findUsedFlexFraction const):
1302
1303 2018-01-21  Ryosuke Niwa  <rniwa@webkit.org>
1304
1305         Turning off custom pasteboard data doesn't actually turn it off in WK2
1306         https://bugs.webkit.org/show_bug.cgi?id=181920
1307         <rdar://problem/36686429>
1308
1309         Reviewed by Wenson Hsieh.
1310
1311         Replaced the global settings for custom pasteboard data by regular runtime enabled flags.
1312
1313         * dom/DataTransfer.cpp:
1314         (WebCore::DataTransfer::getDataForItem const):
1315         (WebCore::DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths const):
1316         (WebCore::DataTransfer::setDataFromItemList):
1317         (WebCore::DataTransfer::types const):
1318         (WebCore::DataTransfer::commitToPasteboard):
1319         * dom/DataTransferItemList.cpp:
1320         (WebCore::shouldExposeTypeInItemList):
1321         * editing/Editor.cpp:
1322         (WebCore::createDataTransferForClipboardEvent):
1323         * editing/cocoa/WebContentReaderCocoa.mm:
1324         (WebCore::createFragmentAndAddResources):
1325         (WebCore::WebContentReader::readWebArchive):
1326         * page/DeprecatedGlobalSettings.cpp:
1327         (WebCore::DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled): Deleted.
1328         * page/DeprecatedGlobalSettings.h:
1329         (WebCore::DeprecatedGlobalSettings::setCustomPasteboardDataEnabled): Deleted.
1330         (WebCore::DeprecatedGlobalSettings::customPasteboardDataEnabled): Deleted.
1331         * page/RuntimeEnabledFeatures.h:
1332         (WebCore::RuntimeEnabledFeatures::setCustomPasteboardDataEnabled):
1333         (WebCore::RuntimeEnabledFeatures::customPasteboardDataEnabled const):
1334         * testing/InternalSettings.cpp:
1335         (WebCore::InternalSettings::Backup::Backup):
1336         (WebCore::InternalSettings::Backup::restoreTo):
1337         (WebCore::InternalSettings::setCustomPasteboardDataEnabled):
1338
1339 2018-01-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1340
1341         Add a new feature flag for EXTRA_ZOOM_MODE and reintroduce AdditionalFeatureDefines.h
1342         https://bugs.webkit.org/show_bug.cgi?id=181918
1343
1344         Reviewed by Tim Horton.
1345
1346         Add EXTRA_ZOOM_MODE to FeatureDefines.xconfig (off by default). No change in behavior.
1347
1348         * Configurations/FeatureDefines.xcconfig:
1349
1350 2018-01-19  Ryosuke Niwa  <rniwa@webkit.org>
1351
1352         Release assertion in canExecuteScript when executing scripts during page cache restore
1353         https://bugs.webkit.org/show_bug.cgi?id=181902
1354
1355         Reviewed by Antti Koivisto.
1356
1357         The crash was caused by an erroneous instantiation of ScriptDisallowedScope::InMainThread in CachedPage::restore.
1358         It can execute arbitrary scripts since CachedFrame::open can update style, layout, and evaluate media queries.
1359
1360         This is fine because there is no way to put this page back into a page cache until the load is commited via
1361         FrameLoader::commitProvisionalLoad is invoked later which only happens after CachedPage::restore had exited.
1362
1363         Also added a release assert to make sure this condition holds.
1364
1365         Tests: fast/history/page-cache-execute-script-during-restore.html
1366                fast/history/page-cache-navigate-during-restore.html
1367
1368         * history/CachedPage.cpp:
1369         (WebCore::CachedPageRestorationScope::CachedPageRestorationScope): Added.
1370         (WebCore::CachedPageRestorationScope::~CachedPageRestorationScope): Added.
1371         (WebCore::CachedPage::restore): Don't instantiate ScriptDisallowedScope::InMainThread. Set isRestoringCachedPage
1372         on the cached pate to release-assert that there won't be any attempt to put this very page back into the cache.
1373         * history/PageCache.cpp:
1374         (WebCore::canCachePage): Added a release assert to make sure the page which is in the process of being restored
1375         from the page cache is not put into the page cache.
1376         * page/Page.h:
1377         (WebCore::Page::setIsRestoringCachedPage): Added.
1378         (WebCore::Page::isRestoringCachedPage const): Added.
1379
1380 2018-01-21  Eric Carlson  <eric.carlson@apple.com>
1381
1382         Resign NowPlaying status when no media element is eligible
1383         https://bugs.webkit.org/show_bug.cgi?id=181914
1384         <rdar://problem/35294116>
1385
1386         Reviewed by Jer Noble.
1387
1388         Updated API test.
1389
1390         * html/HTMLMediaElement.cpp:
1391         (WebCore::HTMLMediaElement::removedFromAncestor): Call mediaSession->clientCharacteristicsChanged
1392         so NowPlaying status will be updated.
1393
1394         * html/MediaElementSession.cpp:
1395         (WebCore::MediaElementSession::canShowControlsManager const): Return false when being queried
1396         for NowPlaying status in an inactive document.
1397
1398         * platform/audio/PlatformMediaSessionManager.cpp:
1399         (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Implement in for all
1400         ports.
1401         * platform/audio/PlatformMediaSessionManager.h:
1402         (WebCore::PlatformMediaSessionManager::registeredAsNowPlayingApplication const):
1403         * platform/audio/ios/MediaSessionManagerIOS.h:
1404         * platform/audio/mac/MediaSessionManagerMac.h:
1405         * platform/audio/mac/MediaSessionManagerMac.mm:
1406         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): Call MRMediaRemoteSetCanBeNowPlayingApplication
1407         whenever status changes.
1408         (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Deleted, implemented
1409         in the base class.
1410
1411 2018-01-21  Jer Noble  <jer.noble@apple.com>
1412
1413         REGRESSION (macOS 10.13.2): imported/w3c/web-platform-tests/media-source/mediasource-* LayoutTests failing
1414         https://bugs.webkit.org/show_bug.cgi?id=181891
1415
1416         Reviewed by Eric Carlson.
1417
1418         In macOS 10.13.2, CoreMedia changed the definition of CMSampleBufferGetDuration() to return
1419         the presentation duration rather than the decode duration. For media streams where those two
1420         durations are identical (or at least, closely similar), this isn't a problem. But the media
1421         file used in the WPT tests have an unusual frame cadence: decode durations go {3000, 1, 5999,
1422         1, 5999,...} and presentation durations go {3000, 2999, 3000, 2999}. This caused one check in
1423         the "Coded Frame Processing" algorithm to begin failing, where it checks that the delta
1424         between the last sample's decode time and the new decode time is no more than 2x as far as
1425         the last sample's duration. That's not a problem as long as the "duration" is the "decode
1426         duration" and the samples are all adjacent. Once the "duration" is "presentation duration",
1427         all the assumptions in the algorithm are invalidated. In the WPT test case, the delta between
1428         decode times is 5999, and 2 * the presentation duration is 5998, causing all samples up to
1429         the next sync sample to be dropped.
1430
1431         To work around this change in behavior, we'll adopt the same technique used by Mozilla's MSE
1432         implementation, which was done for similar reasons. Rather than track the "last frame duration",
1433         we'll record the "greatest frame duration", and use actual decode timestamps to derive this
1434         duration. The "greatest frame duration" field will be reset at the same times as "last frame
1435         duration", and will be used only in the part of the algorithm that checks for large decode
1436         timestamp gaps.
1437
1438         * Modules/mediasource/SourceBuffer.cpp:
1439         (WebCore::SourceBuffer::TrackBuffer::TrackBuffer):
1440         (WebCore::SourceBuffer::resetParserState):
1441         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
1442
1443 2018-01-21  Andy Estes  <aestes@apple.com>
1444
1445         [ios] LayoutTest imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html is crashing in JSC::JSONParse
1446         https://bugs.webkit.org/show_bug.cgi?id=177832
1447         <rdar://problem/34805315>
1448
1449         Reviewed by Tim Horton.
1450
1451         Test: http/tests/paymentrequest/rejects_if_not_active.https.html
1452
1453         * Modules/paymentrequest/PaymentRequest.cpp:
1454         (WebCore::PaymentRequest::show): Rejected promise if the document is not active.
1455
1456 2018-01-20  Brady Eidson  <beidson@apple.com>
1457
1458         Make garbage collection of MessagePort objects be asynchronous.
1459         https://bugs.webkit.org/show_bug.cgi?id=181910
1460
1461         Reviewed by Andy Estes.
1462
1463         No new tests (Covered by existing tests, including GC-specific ones).
1464
1465         The basic premise here is as follows:
1466         - You can *always* GC a MessagePort that is closed
1467         - You can *always* GC a MessagePort that has no onmessage handler, as incoming messages cannot 
1468           possibly revive it.
1469         - You can GC a MessagePort, even if it has a message handler, as long as there are no messages 
1470           in flight between it and the remote port, and as long as the remote port is "maybe eligible for GC."
1471           
1472         A MessagePort is considered "maybe eligible for GC" once hasPendingActivity is asked once.
1473         
1474         A MessagePort loses "maybe eligible for GC" status once it is used for sending or receiving a message.
1475         
1476         The changes to MessagePort.cpp implement the above with a tiny little bool-driven state machine.
1477         * dom/MessagePort.cpp:
1478         (WebCore::MessagePort::postMessage):
1479         (WebCore::MessagePort::disentangle):
1480         (WebCore::MessagePort::registerLocalActivity):
1481         (WebCore::MessagePort::start):
1482         (WebCore::MessagePort::close):
1483         (WebCore::MessagePort::contextDestroyed):
1484         (WebCore::MessagePort::dispatchMessages):
1485         (WebCore::MessagePort::hasPendingActivity const):
1486         (WebCore::MessagePort::isLocallyReachable const):
1487         (WebCore::MessagePort::addEventListener):
1488         (WebCore::MessagePort::removeEventListener):
1489         * dom/MessagePort.h:
1490
1491         - Remove the lock and any background-thread code paths
1492         - Add ASSERT(isMainThread())s throughout
1493         * dom/messageports/MessagePortChannel.cpp:
1494         (WebCore::MessagePortChannel::MessagePortChannel):
1495         (WebCore::MessagePortChannel::includesPort):
1496         (WebCore::MessagePortChannel::entanglePortWithProcess):
1497         (WebCore::MessagePortChannel::disentanglePort):
1498         (WebCore::MessagePortChannel::closePort):
1499         (WebCore::MessagePortChannel::postMessageToRemote):
1500         (WebCore::MessagePortChannel::takeAllMessagesForPort):
1501         (WebCore::MessagePortChannel::checkRemotePortForActivity):
1502         (WebCore::MessagePortChannel::hasAnyMessagesPendingOrInFlight const):
1503         * dom/messageports/MessagePortChannel.h:
1504         
1505         Add a callback for a MessagePortChannel to go ask the remote MessagePort object about local activity:
1506         * dom/messageports/MessagePortChannelProvider.h:
1507         * dom/messageports/MessagePortChannelProviderImpl.cpp:
1508         (WebCore::MessagePortChannelProviderImpl::checkRemotePortForActivity):
1509         (WebCore::MessagePortChannelProviderImpl::checkProcessLocalPortForActivity):
1510         (WebCore::MessagePortChannelProviderImpl::hasMessagesForPorts_temporarySync): Deleted.
1511         * dom/messageports/MessagePortChannelProviderImpl.h:
1512         
1513         - Remove the lock and any background-thread code paths
1514         - Add ASSERT(isMainThread())s throughout
1515         * dom/messageports/MessagePortChannelRegistry.cpp:
1516         (WebCore::MessagePortChannelRegistry::messagePortChannelCreated):
1517         (WebCore::MessagePortChannelRegistry::messagePortChannelDestroyed):
1518         (WebCore::MessagePortChannelRegistry::didEntangleLocalToRemote):
1519         (WebCore::MessagePortChannelRegistry::didDisentangleMessagePort):
1520         (WebCore::MessagePortChannelRegistry::didCloseMessagePort):
1521         (WebCore::MessagePortChannelRegistry::didPostMessageToRemote):
1522         (WebCore::MessagePortChannelRegistry::takeAllMessagesForPort):
1523         (WebCore::MessagePortChannelRegistry::checkRemotePortForActivity):
1524         (WebCore::MessagePortChannelRegistry::existingChannelContainingPort):
1525         (WebCore::MessagePortChannelRegistry::hasMessagesForPorts_temporarySync): Deleted.
1526         * dom/messageports/MessagePortChannelRegistry.h:
1527
1528 2018-01-20  Andy Estes  <aestes@apple.com>
1529
1530         [Apple Pay] Stop eagerly loading PassKit.framework
1531         https://bugs.webkit.org/show_bug.cgi?id=181911
1532         <rdar://problem/36555369>
1533
1534         Reviewed by Tim Horton.
1535
1536         r226458 and r226123 added code that caused PassKit.framework to be eagerly loaded when
1537         initializing a WKWebView. This is costly and should only be done when Apple Pay is first used.
1538
1539         To avoid eagerly loading PassKit, this patch does two things:
1540
1541         1. Instead of sending the available payment networks as part of WebPageCreationParameters,
1542         PaymentCoordinator asks for them using a syncrhonous message the first time they are needed.
1543         2. Instead of setting the Apple Pay preference to false when PassKit can't be loaded,
1544         the following API entry points check for a missing PassKit and return false, or throw
1545         exceptions, or reject promises:
1546             - ApplePaySession.canMakePayments()
1547             - ApplePaySession.canMakePaymentsWithActiveCard()
1548             - ApplePaySession.openPaymentSetup()
1549             - ApplePaySession.begin()
1550
1551         No new tests for (1), which causes no change in behavior. (2) was manually verified by
1552         locally moving aside PassKit.framework, but that's not possible to do in an automated test.
1553
1554         * Modules/applepay/PaymentCoordinator.cpp:
1555         (WebCore::PaymentCoordinator::PaymentCoordinator):
1556         (WebCore::PaymentCoordinator::validatedPaymentNetwork const):
1557         (WebCore::toHashSet): Deleted.
1558         * Modules/applepay/PaymentCoordinator.h:
1559         * Modules/applepay/PaymentCoordinatorClient.h:
1560         * loader/EmptyClients.cpp:
1561         * page/MainFrame.cpp:
1562         (WebCore::MainFrame::MainFrame):
1563
1564         Removed PaymentCoordinator::m_availablePaymentNetworks and made
1565         PaymentCoordinator::validatedPaymentNetwork() call
1566         PaymentCoordinatorClient::validatedPaymentNetwork() instead.
1567
1568         * page/PageConfiguration.h:
1569
1570         Removed availablePaymentNetworks from PageConfiguration.
1571
1572         * testing/Internals.cpp:
1573         (WebCore::Internals::Internals):
1574         * testing/MockPaymentCoordinator.cpp:
1575         (WebCore::MockPaymentCoordinator::validatedPaymentNetwork):
1576         * testing/MockPaymentCoordinator.h:
1577
1578         Implemented PaymentCoordinatorClient::validatedPaymentNetwork().
1579
1580 2018-01-20  Jer Noble  <jer.noble@apple.com>
1581
1582         Release ASSERT when reloading Vimeo page @ WebCore: WebCore::Document::updateLayout
1583         https://bugs.webkit.org/show_bug.cgi?id=181840
1584         <rdar://problem/36186214>
1585
1586         Reviewed by Simon Fraser.
1587
1588         Test: media/video-fullscreen-reload-crash.html
1589
1590         Short circuit play() or pause() operations if the document is suspended or stopped.
1591
1592         * html/HTMLMediaElement.cpp:
1593         (WebCore::HTMLMediaElement::playInternal):
1594         (WebCore::HTMLMediaElement::pauseInternal):
1595
1596 2018-01-20  Youenn Fablet  <youenn@apple.com>
1597
1598         fetch redirect is incompatible with "no-cors" mode
1599         https://bugs.webkit.org/show_bug.cgi?id=181866
1600         <rdar://problem/35827140>
1601
1602         Reviewed by Chris Dumez.
1603
1604         Covered by updated tests.
1605
1606         Return a network error when no-cors mode and redirect mode is manual or error.
1607         Update preflight implementation to no longer use manual redirect mode to simulate https://fetch.spec.whatwg.org/#http-network-or-cache-fetch.
1608         Instead implement redirectReceived callback to treat any redirect response as the preflight response.
1609
1610         * loader/cache/CachedResourceLoader.cpp:
1611         (WebCore::CachedResourceLoader::canRequest):
1612         * loader/CrossOriginPreflightChecker.cpp:
1613         (WebCore::CrossOriginPreflightChecker::redirectReceived):
1614         (WebCore::CrossOriginPreflightChecker::startPreflight):
1615         * loader/CrossOriginPreflightChecker.h:
1616
1617 2018-01-19  Wenson Hsieh  <wenson_hsieh@apple.com>
1618
1619         [macOS] [WK2] Drag location is computed incorrectly when dragging content from subframes
1620         https://bugs.webkit.org/show_bug.cgi?id=181896
1621         <rdar://problem/35479043>
1622
1623         Reviewed by Tim Horton.
1624
1625         In r218837, I packaged most of the information needed to start a drag into DragItem, which is propagated to the client layer
1626         via the startDrag codepath. However, this introduced a bug in computing the event position and drag location in window
1627         coordinates. Consider the case where we're determining the drag image offset for a dragged element in a subframe:
1628
1629         Before the patch, the drag location (which starts out in the subframe's content coordinates) would be converted to root view
1630         coordinates, which would then be converted to mainframe content coordinates, which would then be converted to window coordinates
1631         using the mainframe's view. After the patch, we carry out the same math until the last step, where we erroneously use the
1632         _subframe's_ view to convert to window coordinates from content coordinates. This results in the position of the iframe relative
1633         to the mainframe being accounted for twice.
1634
1635         To fix this, we simply use the main frame's view to convert from mainframe content coordinates to window coordinates while
1636         computing the drag location. As for the event position in window coordinates, this is currently unused by any codepath in WebKit,
1637         so we can just remove it altogether.
1638
1639         Since this bug only affects drag and drop in the macOS WebKit2 port, there's currently no way to test this. I'll be using
1640         <https://bugs.webkit.org/show_bug.cgi?id=181898> to track adding test support for drag and drop on macOS WebKit2. Manually tested
1641         dragging in both WebKit1 and WebKit2 on macOS. dragLocationInWindowCoordinates isn't used at all for iOS drag and drop.
1642
1643         * page/DragController.cpp:
1644         (WebCore::DragController::doSystemDrag):
1645         * platform/DragItem.h:
1646         (WebCore::DragItem::encode const):
1647         (WebCore::DragItem::decode):
1648
1649 2018-01-19  Ryan Haddad  <ryanhaddad@apple.com>
1650
1651         Unreviewed, rolling out r227235.
1652
1653         The test for this change consistently times out on High
1654         Sierra.
1655
1656         Reverted changeset:
1657
1658         "Support for preconnect Link headers"
1659         https://bugs.webkit.org/show_bug.cgi?id=181657
1660         https://trac.webkit.org/changeset/227235
1661
1662 2018-01-19  Youenn Fablet  <youenn@apple.com>
1663
1664         Cache storage errors like Quota should trigger console messages
1665         https://bugs.webkit.org/show_bug.cgi?id=181879
1666         <rdar://problem/36669048>
1667
1668         Reviewed by Chris Dumez.
1669
1670         Covered by rebased test.
1671
1672         * Modules/cache/DOMCache.cpp:
1673         (WebCore::DOMCache::retrieveRecords):
1674         (WebCore::DOMCache::batchDeleteOperation):
1675         (WebCore::DOMCache::batchPutOperation):
1676         * Modules/cache/DOMCacheEngine.cpp:
1677         (WebCore::DOMCacheEngine::errorToException):
1678         (WebCore::DOMCacheEngine::logErrorAndConvertToException):
1679         * Modules/cache/DOMCacheEngine.h:
1680         * Modules/cache/DOMCacheStorage.cpp:
1681         (WebCore::DOMCacheStorage::retrieveCaches):
1682         (WebCore::DOMCacheStorage::doOpen):
1683         (WebCore::DOMCacheStorage::doRemove):
1684
1685 2018-01-19  Youenn Fablet  <youenn@apple.com>
1686
1687         Do not go to the storage process when registering a service worker client if there is no service worker registered
1688         https://bugs.webkit.org/show_bug.cgi?id=181740
1689         <rdar://problem/36650400>
1690
1691         Reviewed by Chris Dumez.
1692
1693         Register a document as service worker client only if there is an existing service worker connection.
1694         This allows not creating any connection if no service worker is registered.
1695
1696         Add internals API to test whether a service worker connection was created or not.
1697         This is used by API tests that cover the changes.
1698
1699         * dom/Document.cpp:
1700         (WebCore::Document::privateBrowsingStateDidChange): No need to create a service worker connection if client is not registered yet.
1701         (WebCore::Document::setServiceWorkerConnection): No need to unregister/register if service worker connection is the same.
1702         Similarly, if Document is to be destroyed or suspended, we should not register it.
1703         * loader/DocumentLoader.cpp:
1704         (WebCore::DocumentLoader::commitData):
1705         * testing/Internals.cpp:
1706         (WebCore::Internals::hasServiceWorkerConnection):
1707         * testing/Internals.h:
1708         * testing/Internals.idl:
1709         * workers/service/ServiceWorkerProvider.cpp:
1710         (WebCore::ServiceWorkerProvider::registerServiceWorkerClients):
1711         * workers/service/ServiceWorkerProvider.h:
1712
1713 2018-01-19  Dean Jackson  <dino@apple.com>
1714
1715         REGRESSION (r221092): Swipe actions are hard to perform in FastMail app
1716         https://bugs.webkit.org/show_bug.cgi?id=181817
1717         <rdar://problem/35274055>
1718
1719         Add a setting for controlling whether touch listeners are passive
1720         by default on document/window/body.
1721
1722         Updated existing test.
1723
1724         * dom/EventTarget.cpp:
1725         (WebCore::EventTarget::addEventListener):
1726         * page/Settings.yaml:
1727
1728 2018-01-19  Daniel Bates  <dabates@apple.com>
1729
1730         Update frame-ancestor directive to match Content Security Policy Level 3
1731         https://bugs.webkit.org/show_bug.cgi?id=178891
1732         <rdar://problem/35209458>
1733
1734         Reviewed by Alex Christensen.
1735
1736         Derived from Blink e667cc2e501fabab3605b838e4ee0d642a9c4a59:
1737         <https://chromium.googlesource.com/chromium/src.git/+/e667cc2e501fabab3605b838e4ee0d642a9c4a59>
1738
1739         Update frame-ancestor directive to match against the origin of the ancestor document per the
1740         Content Security Policy Level 3 spec.: <https://w3c.github.io/webappsec-csp/> (15 January 2018).
1741         Specifically this change in behavior was made to CSP 3 in <https://github.com/w3c/webappsec/issues/311>.
1742         In earlier versions of the spec, the frame-ancestor directive matched against the URL of the
1743         ancestor document.
1744
1745         Disregarding allow-same-origin sandboxed iframes, a document with policy "frame-ancestor 'self'"
1746         will be blocked from loading in a sandboxed iframe as a result of this change.
1747
1748         Tests: http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-allow-same-origin-sandboxed-cross-url-allow.html
1749                http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-sandboxed-cross-url-block.html
1750
1751         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
1752         (WebCore::checkFrameAncestors):
1753
1754 2018-01-19  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1755
1756         [Curl] Add timeout support to XMLHttpRequest
1757         https://bugs.webkit.org/show_bug.cgi?id=181876
1758
1759         Reviewed by Alex Christensen 
1760
1761         * platform/network/ResourceRequestBase.cpp:
1762         * platform/network/curl/CurlContext.cpp:
1763         (WebCore::CurlHandle::setTimeout):
1764         * platform/network/curl/CurlContext.h:
1765         * platform/network/curl/CurlRequest.cpp:
1766         (WebCore::CurlRequest::setupTransfer):
1767         (WebCore::CurlRequest::didCompleteTransfer):
1768         * platform/network/curl/ResourceError.h:
1769         * platform/network/curl/ResourceErrorCurl.cpp:
1770         (WebCore::ResourceError::httpError):
1771
1772 2018-01-19  Yoav Weiss  <yoav@yoav.ws>
1773
1774         Support for preconnect Link headers
1775         https://bugs.webkit.org/show_bug.cgi?id=181657
1776
1777         Reviewed by Darin Adler.
1778
1779         Move the preconnect functionality into its own function, and
1780         also call this function when Link headers are processed.
1781
1782         Test: http/tests/preconnect/link-header-rel-preconnect-http.php
1783
1784         * loader/LinkLoader.cpp:
1785         (WebCore::LinkLoader::loadLinksFromHeader): Call preconnectIfNeeded.
1786         (WebCore::LinkLoader::preconnectIfNeeded): Preconnect to a host functionality moved here.
1787         (WebCore::LinkLoader::loadLink): Call preconnectIfNeeded.
1788         * loader/LinkLoader.h:
1789
1790 2018-01-19  Joseph Pecoraro  <pecoraro@apple.com>
1791
1792         AppCache: Log a Deprecation warning to the Console when AppCache is used
1793         https://bugs.webkit.org/show_bug.cgi?id=181778
1794
1795         Reviewed by Alex Christensen.
1796
1797         * html/HTMLHtmlElement.cpp:
1798         (WebCore::HTMLHtmlElement::insertedByParser):
1799
1800 2018-01-19  Chris Dumez  <cdumez@apple.com>
1801
1802         ASSERT(registration || isTerminating()) hit in SWServerWorker::skipWaiting()
1803         https://bugs.webkit.org/show_bug.cgi?id=181761
1804         <rdar://problem/36594564>
1805
1806         Reviewed by Youenn Fablet.
1807
1808         There is a short period of time, early in the registration process where a
1809         SWServerWorker object exists for a registration but is not in the registration's
1810         installing/waiting/active slots yet. As a result, if a registration is cleared
1811         during this period (for e.g. due to the user clearing all website data), that
1812         SWServerWorker will not be terminated. We then hit assertion later on when this
1813         worker is trying to do things (like call skipWaiting).
1814
1815         To address the issue, we now keep a reference this SWServerWorker on the
1816         registration, via a new SWServerRegistration::m_preInstallationWorker data member.
1817         When the registration is cleared, we now take care of terminating this worker.
1818
1819         No new tests, covered by existing tests that crash flakily in debug builds.
1820
1821         * workers/WorkerThread.cpp:
1822         (WebCore::WorkerThread::stop):
1823         if the mutex is locked, then the worker thread is still starting. We spin the
1824         runloop and try to stop again later. This avoids the deadlock shown in
1825         Bug 181763 as the worker thread may need to interact with the main thread
1826         during startup.
1827
1828         * workers/service/server/SWServer.cpp:
1829         (WebCore::SWServer::installContextData):
1830         * workers/service/server/SWServerJobQueue.cpp:
1831         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
1832         (WebCore::SWServerJobQueue::install):
1833         * workers/service/server/SWServerRegistration.cpp:
1834         (WebCore::SWServerRegistration::~SWServerRegistration):
1835         (WebCore::SWServerRegistration::setPreInstallationWorker):
1836         (WebCore::SWServerRegistration::clear):
1837         * workers/service/server/SWServerRegistration.h:
1838         (WebCore::SWServerRegistration::preInstallationWorker const):
1839
1840 2018-01-19  Chris Dumez  <cdumez@apple.com>
1841
1842         Service worker registrations restored from disk may not be reused when the JS calls register() again
1843         https://bugs.webkit.org/show_bug.cgi?id=181810
1844         <rdar://problem/36591711>
1845
1846         Reviewed by Youenn Fablet.
1847
1848         The issue was that when restoring a registration from disk, we would not set its active worker right
1849         away. We only set it later in installContextData(). installContextData() is only called after we’ve
1850         launched the service worker process and established a connection to it.
1851
1852         However, we would start processing jobs (such as registrations) before we’ve established the connection
1853         to the service worker process. SWServerJobQueue::runRegisterJob(), in order to reuse an existing
1854         registration checks the registration’s active worker has the right script URL. The issue was that when
1855         this code would execute, we may not have set the registration’s active service worker yet, in which case,
1856         we would update the existing registration instead of reusing it as-is.
1857
1858         To address the issue, we now delay the processing of jobs until the connection to the service worker
1859         process has been established and we've installed all pending contexts via installContextData().
1860
1861         Changed is covered by new API test.
1862
1863         * workers/service/server/SWServer.cpp:
1864         (WebCore::SWServer::Connection::scheduleJobInServer):
1865         (WebCore::SWServer::scheduleJob):
1866         (WebCore::SWServer::serverToContextConnectionCreated):
1867         * workers/service/server/SWServer.h:
1868
1869 2018-01-19  James Craig  <jcraig@apple.com>
1870
1871         AX: when invert colors is on, double-invert image and picture elements in UserAgentStyleSheet
1872         https://bugs.webkit.org/show_bug.cgi?id=181281
1873         <rdar://problem/36291776>
1874
1875         Reviewed by Simon Fraser.
1876
1877         Updated "Smart Invert" to include img and picture element inversion and tests.
1878
1879         Tests: accessibility/smart-invert-reference.html
1880                accessibility/smart-invert.html
1881
1882         * css/html.css:
1883         (@media (inverted-colors)):
1884         (img:not(picture>img), picture, video):
1885
1886 2018-01-19  Chris Dumez  <cdumez@apple.com>
1887
1888         The WebContent process should not process incoming IPC while waiting for a sync IPC reply
1889         https://bugs.webkit.org/show_bug.cgi?id=181560
1890
1891         Reviewed by Ryosuke Niwa.
1892
1893         Add internals API for testing purposes.
1894
1895         Test: fast/misc/testIncomingSyncIPCMessageWhileWaitingForSyncReply.html
1896
1897         * page/ChromeClient.h:
1898         * testing/Internals.cpp:
1899         (WebCore::Internals::testIncomingSyncIPCMessageWhileWaitingForSyncReply):
1900         * testing/Internals.h:
1901         * testing/Internals.idl:
1902
1903 2018-01-19  Keith Miller  <keith_miller@apple.com>
1904
1905         HaveInternalSDK includes should be "#include?"
1906         https://bugs.webkit.org/show_bug.cgi?id=179670
1907
1908         Reviewed by Dan Bernstein.
1909
1910         * Configurations/Base.xcconfig:
1911
1912 2018-01-19  Daniel Bates  <dabates@apple.com>
1913
1914         Fix misspelling; substitute willDetachRenderer for willDetatchRenderer.
1915
1916         * html/HTMLPlugInImageElement.cpp:
1917         (WebCore::HTMLPlugInImageElement::willDetachRenderers):
1918         * plugins/PluginViewBase.h:
1919         (WebCore::PluginViewBase::willDetachRenderer):
1920         (WebCore::PluginViewBase::willDetatchRenderer): Deleted.
1921
1922 2018-01-19  Jonathan Bedard  <jbedard@apple.com>
1923
1924         Unreviewed build fix, remove unused lambda captures.
1925
1926         * dom/messageports/MessagePortChannel.cpp:
1927         (WebCore::MessagePortChannel::takeAllMessagesForPort):
1928         * dom/messageports/MessagePortChannelRegistry.cpp:
1929         (WebCore::MessagePortChannelRegistry::messagePortChannelCreated):
1930
1931 2018-01-19  Antoine Quint  <graouts@apple.com>
1932
1933         [Web Animations] Expose timing properties (delay, endDelay, fill, iterationStart, iterations, direction) and getComputedTiming()
1934         https://bugs.webkit.org/show_bug.cgi?id=181857
1935         <rdar://problem/36660081>
1936
1937         Reviewed by Dean Jackson.
1938
1939         We start the work to implement the rest of the Web Animations timing and animation model by exposing more properties on
1940         AnimationEffectTiming to control delay (delay, endDelay), looping (iterationStart, iterations), fill and direction.
1941         Additionally, we expose the getComputedTiming() method on AnimationEffect, although it currently lacks some computed
1942         properties that will come in later patch as we implement various processes defined by the spec. We also update the
1943         existing duration() method on AnimationEffectTiming to be called iterationDuration() to match the terms used in the
1944         specification.
1945
1946         Finally, we make all new properties, and update existing ones, that expose a time value go through the new utility
1947         function secondsToWebAnimationsAPITime() to guarantee rounded values with microseconds precision, as advised by
1948         the Web Animations specification.
1949
1950         * CMakeLists.txt:
1951         * DerivedSources.make:
1952         * Sources.txt:
1953         * WebCore.xcodeproj/project.pbxproj:
1954         * animation/AnimationEffect.cpp:
1955         (WebCore::AnimationEffect::localTime const):
1956         (WebCore::AnimationEffect::getComputedTiming):
1957         * animation/AnimationEffect.h:
1958         * animation/AnimationEffect.idl:
1959         * animation/AnimationEffectTiming.cpp:
1960         (WebCore::AnimationEffectTiming::AnimationEffectTiming):
1961         (WebCore::AnimationEffectTiming::setIterationStart):
1962         (WebCore::AnimationEffectTiming::setIterations):
1963         (WebCore::AnimationEffectTiming::bindingsDuration const):
1964         (WebCore::AnimationEffectTiming::setBindingsDuration):
1965         (WebCore::AnimationEffectTiming::endTime const):
1966         (WebCore::AnimationEffectTiming::activeDuration const):
1967         * animation/AnimationEffectTiming.h:
1968         * animation/AnimationEffectTiming.idl:
1969         * animation/AnimationPlaybackEvent.cpp:
1970         (WebCore::AnimationPlaybackEvent::bindingsCurrentTime const):
1971         (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const):
1972         * animation/AnimationTimeline.cpp:
1973         (WebCore::AnimationTimeline::bindingsCurrentTime):
1974         * animation/ComputedTimingProperties.h: Added.
1975         * animation/ComputedTimingProperties.idl: Added. We set nullable double values to a default value of "null" since
1976         otherwise setting those properties to a null value would not set the properties in the converted JS dictionary.
1977         * animation/KeyframeEffect.cpp:
1978         (WebCore::KeyframeEffect::create): Handle new timing properties passed in the KeyframeEffectOptions dictionary.
1979         (WebCore::KeyframeEffect::applyAtLocalTime):
1980         (WebCore::KeyframeEffect::getAnimatedStyle):
1981         (WebCore::KeyframeEffect::startOrStopAccelerated):
1982         * animation/WebAnimation.cpp:
1983         (WebCore::WebAnimation::bindingsStartTime const):
1984         (WebCore::WebAnimation::bindingsCurrentTime const):
1985         (WebCore::WebAnimation::effectEndTime const):
1986         (WebCore::WebAnimation::timeToNextRequiredTick const):
1987         * animation/WebAnimationUtilities.h: Added.
1988         (WebCore::secondsToWebAnimationsAPITime):
1989
1990 2018-01-19  Alex Christensen  <achristensen@webkit.org>
1991
1992         Remove dead networking code
1993         https://bugs.webkit.org/show_bug.cgi?id=181813
1994
1995         Reviewed by Tim Horton.
1996
1997         CFURLConnection is only used on Windows.
1998
1999         * platform/network/cf/ResourceError.h:
2000         * platform/network/cf/ResourceRequest.h:
2001         (WebCore::ResourceRequest::encodingRequiresPlatformData const):
2002         * platform/network/cf/ResourceRequestCFNet.cpp:
2003         (WebCore::findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction):
2004         (WebCore::ResourceRequest::doUpdatePlatformRequest):
2005         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
2006         (WebCore::ResourceRequest::doUpdateResourceRequest):
2007         (WebCore::ResourceRequest::setStorageSession):
2008         * platform/network/cf/ResourceResponse.h:
2009         (WebCore::ResourceResponse::ResourceResponse):
2010
2011 2018-01-19  Alex Christensen  <achristensen@webkit.org>
2012
2013         Remove unused WebViewPrivate _allowCookies
2014         https://bugs.webkit.org/show_bug.cgi?id=181812
2015
2016         Reviewed by Tim Horton.
2017
2018         This SPI was in the original iOS upstreaming and has not been used in many years.
2019
2020         * platform/network/ResourceRequestBase.cpp:
2021         (WebCore::ResourceRequestBase::setDefaultAllowCookies): Deleted.
2022         (WebCore::ResourceRequestBase::defaultAllowCookies): Deleted.
2023         * platform/network/ResourceRequestBase.h:
2024         (WebCore::ResourceRequestBase::ResourceRequestBase):
2025
2026 2018-01-18  Brady Eidson  <beidson@apple.com>
2027
2028         Make in-process MessagePorts be (mostly) asynchronous
2029         https://bugs.webkit.org/show_bug.cgi?id=181454
2030
2031         Reviewed by Alex Christensen.
2032
2033         No new tests (Covered *brutally* by existing tests)
2034
2035         Part of making MessagePorts be a thing we can pass across processes is making them work async.
2036         
2037         The existing "MessagePortChannel" method of abstraction was not cut out for this.
2038         This patch gets rid of MessagePortChannel and adds a new MessagePortChannelProvider abstraction.
2039         It then gets the new machinery working in-process (with some pieces of out-of-process in place)
2040
2041         One synchronous behavior this patch maintains is the hasPendingActivity() check used to support GC.
2042         That will (creatively) be made async in the next followup.
2043         
2044         More generally from MessagePorts, this patch also adds a "MessageWithMessagePorts" object to be used
2045         with all forms of postMessage(). Much better.
2046         
2047         * CMakeLists.txt:
2048         * Sources.txt:
2049         * WebCore.xcodeproj/project.pbxproj:
2050
2051         * dom/InProcessMessagePortChannel.cpp: Removed.
2052         * dom/InProcessMessagePortChannel.h: Removed.
2053         * dom/MessagePortChannel.cpp: Removed.
2054         * dom/MessagePortChannel.h: Removed.
2055
2056         * dom/MessageChannel.cpp:
2057         (WebCore::MessageChannel::create):
2058         (WebCore::MessageChannel::MessageChannel):
2059         (WebCore::m_port2): Deleted.
2060         * dom/MessageChannel.h:
2061         (WebCore::MessageChannel::create): Deleted.
2062
2063         * dom/MessagePort.cpp:
2064         (WebCore::MessagePort::create):
2065         (WebCore::MessagePort::MessagePort):
2066         (WebCore::MessagePort::~MessagePort):
2067         (WebCore::MessagePort::entangle):
2068         (WebCore::MessagePort::postMessage):
2069         (WebCore::MessagePort::disentangle):
2070         (WebCore::MessagePort::messageAvailable):
2071         (WebCore::MessagePort::start):
2072         (WebCore::MessagePort::close):
2073         (WebCore::MessagePort::contextDestroyed):
2074         (WebCore::MessagePort::dispatchMessages):
2075         (WebCore::MessagePort::hasPendingActivity const):
2076         (WebCore::MessagePort::locallyEntangledPort const):
2077         (WebCore::MessagePort::disentanglePorts):
2078         (WebCore::MessagePort::entanglePorts):
2079         (WebCore::MessagePort::entangleWithRemote): Deleted.
2080         * dom/MessagePort.h:
2081
2082         * dom/MessagePortIdentifier.h:
2083         (WebCore::MessagePortIdentifier::logString const):
2084
2085         * dom/ScriptExecutionContext.cpp:
2086         (WebCore::ScriptExecutionContext::processMessageWithMessagePortsSoon):
2087         (WebCore::ScriptExecutionContext::dispatchMessagePortEvents):
2088         (WebCore::ScriptExecutionContext::processMessagePortMessagesSoon): Deleted.
2089         * dom/ScriptExecutionContext.h:
2090
2091         Add a single object that represents two intertwined ports, tracks their pending
2092         messages, tracks which process they're in, etc etc:
2093         * dom/messageports/MessagePortChannel.cpp: Added.
2094         (WebCore::MessagePortChannel::create):
2095         (WebCore::MessagePortChannel::MessagePortChannel):
2096         (WebCore::MessagePortChannel::~MessagePortChannel):
2097         (WebCore::MessagePortChannel::includesPort):
2098         (WebCore::MessagePortChannel::entanglePortWithProcess):
2099         (WebCore::MessagePortChannel::disentanglePort):
2100         (WebCore::MessagePortChannel::closePort):
2101         (WebCore::MessagePortChannel::postMessageToRemote):
2102         (WebCore::MessagePortChannel::takeAllMessagesForPort):
2103         (WebCore::MessagePortChannel::hasAnyMessagesPendingOrInFlight const):
2104         * dom/messageports/MessagePortChannel.h: Added.
2105         (WebCore::MessagePortChannel::port1 const):
2106         (WebCore::MessagePortChannel::port2 const):
2107         (WebCore::MessagePortChannel::logString const):
2108
2109         Abstraction for creating and operating on MessagePorts in a potentially cross-process way:
2110         * dom/messageports/MessagePortChannelProvider.cpp: Added.
2111         (WebCore::MessagePortChannelProvider::singleton):
2112         (WebCore::MessagePortChannelProvider::setSharedProvider):
2113         * dom/messageports/MessagePortChannelProvider.h: Added.
2114         (WebCore::MessagePortChannelProvider::~MessagePortChannelProvider):
2115
2116         Adds a concrete implementation of that provider to be used in-process (e.g. WK1):
2117         * dom/messageports/MessagePortChannelProviderImpl.cpp: Added.
2118         (WebCore::MessagePortChannelProviderImpl::~MessagePortChannelProviderImpl):
2119         (WebCore::MessagePortChannelProviderImpl::performActionOnAppropriateThread):
2120         (WebCore::MessagePortChannelProviderImpl::createNewMessagePortChannel):
2121         (WebCore::MessagePortChannelProviderImpl::entangleLocalPortInThisProcessToRemote):
2122         (WebCore::MessagePortChannelProviderImpl::messagePortDisentangled):
2123         (WebCore::MessagePortChannelProviderImpl::messagePortClosed):
2124         (WebCore::MessagePortChannelProviderImpl::postMessageToRemote):
2125         (WebCore::MessagePortChannelProviderImpl::takeAllMessagesForPort):
2126         (WebCore::MessagePortChannelProviderImpl::hasMessagesForPorts_temporarySync):
2127         * dom/messageports/MessagePortChannelProviderImpl.h: Added.
2128
2129         Adds a main thread object to handle the set of all MessagePortChannels that are open.
2130         For now it lives in the WebProcess, but for out-of-process it will live in the UIProcess:
2131         * dom/messageports/MessagePortChannelRegistry.cpp: Added.
2132         (WebCore::MessagePortChannelRegistry::~MessagePortChannelRegistry):
2133         (WebCore::MessagePortChannelRegistry::didCreateMessagePortChannel):
2134         (WebCore::MessagePortChannelRegistry::messagePortChannelCreated):
2135         (WebCore::MessagePortChannelRegistry::messagePortChannelDestroyed):
2136         (WebCore::MessagePortChannelRegistry::didEntangleLocalToRemote):
2137         (WebCore::MessagePortChannelRegistry::didDisentangleMessagePort):
2138         (WebCore::MessagePortChannelRegistry::didCloseMessagePort):
2139         (WebCore::MessagePortChannelRegistry::didPostMessageToRemote):
2140         (WebCore::MessagePortChannelRegistry::takeAllMessagesForPort):
2141         (WebCore::MessagePortChannelRegistry::hasMessagesForPorts_temporarySync): This is named against style
2142           and weird on purpose - to call attention to how bad it is and how it's temporary.
2143         (WebCore::MessagePortChannelRegistry::existingChannelContainingPort):
2144         * dom/messageports/MessagePortChannelRegistry.h: Added.
2145
2146         Add an object that represents a "SerializedScriptValue for the message payload and the ports
2147         that are being transferred along with that payload". This is used in all forms of postMessage():
2148         * dom/messageports/MessageWithMessagePorts.cpp: Added.
2149         * dom/messageports/MessageWithMessagePorts.h: Added.
2150
2151         * page/DOMWindow.cpp:
2152         (WebCore::PostMessageTimer::PostMessageTimer):
2153         (WebCore::PostMessageTimer::event):
2154         (WebCore::DOMWindow::postMessage):
2155
2156         * platform/Logging.h:
2157
2158         * workers/DedicatedWorkerGlobalScope.cpp:
2159         (WebCore::DedicatedWorkerGlobalScope::postMessage):
2160
2161         * workers/Worker.cpp:
2162         (WebCore::Worker::postMessage):
2163
2164         * workers/WorkerGlobalScopeProxy.h:
2165
2166         * workers/WorkerMessagingProxy.cpp:
2167         (WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
2168         (WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope):
2169         * workers/WorkerMessagingProxy.h:
2170
2171         * workers/WorkerObjectProxy.h:
2172
2173         * workers/service/ServiceWorker.cpp:
2174         (WebCore::ServiceWorker::postMessage):
2175
2176         * workers/service/ServiceWorkerClient.cpp:
2177         (WebCore::ServiceWorkerClient::postMessage):
2178
2179         * workers/service/context/SWContextManager.cpp:
2180         (WebCore::SWContextManager::postMessageToServiceWorker):
2181
2182         * workers/service/context/ServiceWorkerThread.cpp:
2183         (WebCore::fireMessageEvent):
2184         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
2185         * workers/service/context/ServiceWorkerThread.h:
2186
2187 2018-01-18  Ryan Haddad  <ryanhaddad@apple.com>
2188
2189         Unreviewed build fix, removed unused lambda capture.
2190
2191         * workers/service/context/SWContextManager.cpp:
2192         (WebCore::SWContextManager::ServiceWorkerTerminationRequest::ServiceWorkerTerminationRequest):
2193
2194 2018-01-18  Chris Dumez  <cdumez@apple.com>
2195
2196         We should be able to terminate service workers that are unresponsive
2197         https://bugs.webkit.org/show_bug.cgi?id=181563
2198         <rdar://problem/35280031>
2199
2200         Reviewed by Alex Christensen.
2201
2202         Test: http/tests/workers/service/postmessage-after-terminating-hung-worker.html
2203
2204         * workers/service/context/SWContextManager.cpp:
2205         (WebCore::SWContextManager::terminateWorker):
2206         Before calling WorkerThread::stop(), set a timer with the given timeout parameter.
2207         If the worker thread has not stopped when the timer fires, forcefully exit the
2208         service worker process. The StorageProcess will take care of relaunching the
2209         service worker process if it exits abruptly.
2210
2211         (WebCore::SWContextManager::serviceWorkerFailedToTerminate):
2212         Log error message if we failed to terminate a service worker and call exit().
2213
2214         (WebCore::SWContextManager::ServiceWorkerTerminationRequest::ServiceWorkerTerminationRequest):
2215
2216         * workers/service/context/SWContextManager.h:
2217
2218 2018-01-18  Youenn Fablet  <youenn@apple.com>
2219
2220         Do not go to the storage process when loading a main resource if there is no service worker registered
2221         https://bugs.webkit.org/show_bug.cgi?id=181395
2222
2223         Reviewed by Chris Dumez.
2224
2225         No observable behavior change.
2226         Instead of creating a connection to know whether there is a potential service worker,
2227         Ask the service worker provider that will use the connection if needed.
2228         Otherwise, it will use a default value provided by the UIProcess.
2229
2230         Tested by cleaning all service workers and checking the computed value of the default value,
2231         then observing whether pages registering service workers work well.
2232
2233         * loader/DocumentLoader.cpp:
2234         (WebCore::DocumentLoader::startLoadingMainResource):
2235         * workers/service/ServiceWorkerProvider.cpp:
2236         (WebCore::ServiceWorkerProvider::mayHaveServiceWorkerRegisteredForOrigin):
2237         * workers/service/ServiceWorkerProvider.h:
2238
2239 2018-01-18  Dan Bernstein  <mitz@apple.com>
2240
2241         [Xcode] Streamline and future-proof target-macOS-version-dependent build setting definitions
2242         https://bugs.webkit.org/show_bug.cgi?id=181803
2243
2244         Reviewed by Tim Horton.
2245
2246         * Configurations/Base.xcconfig: Updated.
2247         * Configurations/DebugRelease.xcconfig: Ditto.
2248         * Configurations/FeatureDefines.xcconfig: Adopted macOSTargetConditionals helpers.
2249         * Configurations/Version.xcconfig: Updated.
2250         * Configurations/macOSTargetConditionals.xcconfig: Added. Defines helper build settings
2251           useful for defining settings that depend on the target macOS version.
2252
2253 2018-01-18  Chris Dumez  <cdumez@apple.com>
2254
2255         Service Workers restored from persistent storage have 'redundant' state
2256         https://bugs.webkit.org/show_bug.cgi?id=181749
2257         <rdar://problem/36556486>
2258
2259         Reviewed by Youenn Fablet.
2260
2261         Tested by new API test.
2262
2263         * workers/service/server/SWServer.cpp:
2264         (WebCore::SWServer::installContextData):
2265         Make sure the SWServerWorker's state is set to "activated" after it is assigned to
2266         the registrations' active slot. Otherwise, it stays in its default state (redundant).
2267
2268 2018-01-18  Antti Koivisto  <antti@apple.com>
2269
2270         REGRESSION(r225650): The scores of MotionMark tests Multiply and Leaves dropped by 8%
2271         https://bugs.webkit.org/show_bug.cgi?id=181460
2272         <rdar://problem/36379776>
2273
2274         Reviewed by Ryosuke Niwa.
2275
2276         * css/parser/CSSParser.cpp:
2277         (WebCore::CSSParserContext::CSSParserContext):
2278
2279         Don't do the expensive security origin test if the supplied sheet base URL is null. This
2280         is true for rules coming from the same document.
2281
2282 2018-01-18  Antti Koivisto  <antti@apple.com>
2283
2284         REGRESSION (r223604): Setting :before/after pseudo element on <noscript> asserts
2285         https://bugs.webkit.org/show_bug.cgi?id=181795
2286         <rdar://problem/36334524>
2287
2288         Reviewed by David Kilzer.
2289
2290         <noscript> disallows renderer generation outside CSS mechanisms, however we would still construct
2291         PseudoElements for them during style resolution. These were never removed properly because the
2292         pseudo element removal was tied to render tree teardown. Without proper removal the associated
2293         animations were also not canceled.
2294
2295         Test: fast/css-generated-content/noscript-pseudo-anim-crash.html
2296
2297         * dom/Element.cpp:
2298         (WebCore::Element::removedFromAncestor):
2299
2300         Take care to get rid of PseudoElements when the element is removed from the tree.
2301         This also cancels any associated animations.
2302
2303 2018-01-18  Chris Fleizach  <cfleizach@apple.com>
2304
2305         AX: Aria-activedescendant not supported
2306         https://bugs.webkit.org/show_bug.cgi?id=161734
2307         <rdar://problem/28202679>
2308
2309         Reviewed by Joanmarie Diggs.
2310
2311         When a combo-box owns/controls a list/listbox/grid/tree, the owned element needs to check the active-descendant of the combobox when
2312         checking if it has selected children. 
2313         The target of the selection change notification should also be the owned element in these cases.
2314
2315         Test: accessibility/aria-combobox-controlling-list.html
2316
2317         * accessibility/AccessibilityObject.cpp:
2318         (WebCore::AccessibilityObject::selectedListItem):
2319         * accessibility/AccessibilityObject.h:
2320         * accessibility/AccessibilityRenderObject.cpp:
2321         (WebCore::AccessibilityRenderObject::targetElementForActiveDescendant const):
2322         (WebCore::AccessibilityRenderObject::handleActiveDescendantChanged):
2323         (WebCore::AccessibilityRenderObject::canHaveSelectedChildren const):
2324         (WebCore::AccessibilityRenderObject::selectedChildren):
2325         * accessibility/AccessibilityRenderObject.h:
2326         * accessibility/mac/AXObjectCacheMac.mm:
2327         (WebCore::AXObjectCache::postPlatformNotification):
2328
2329 2018-01-17  Per Arne Vollan  <pvollan@apple.com>
2330
2331         REGRESSION (r224780): Text stroke not applied to video captions.
2332         https://bugs.webkit.org/show_bug.cgi?id=181743
2333         <rdar://problem/35874338>
2334
2335         Reviewed by Simon Fraser.
2336
2337         Tests: media/track/track-css-visible-stroke-expected.html
2338                media/track/track-css-visible-stroke.html
2339
2340         After r224780, it is no longer possible to mix text stroke styles with webkit
2341         legacy text stroke styles.
2342
2343         * css/StyleResolver.cpp:
2344         (WebCore::isValidCueStyleProperty):
2345         * page/CaptionUserPreferencesMediaAF.cpp:
2346         (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS const):
2347
2348 2018-01-18  Andy Estes  <aestes@apple.com>
2349
2350         [Payment Request] Support a default shipping address for Apple Pay
2351         https://bugs.webkit.org/show_bug.cgi?id=181754
2352         <rdar://problem/36009733>
2353
2354         Reviewed by Brady Eidson.
2355
2356         Move shippingContact from ApplePayPaymentRequest to ApplePayRequestBase. This allows
2357         merchants to specify a default shipping address when using Apple Pay with Payment Request.
2358
2359         This also fixes a bug found during testing where
2360         +[NSPersonNameComponentsFormatter localizedStringFromPersonNameComponents:style:options:]
2361         would throw an exception when passed a nil NSPersonNameComponents.
2362
2363         Test: http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html
2364
2365         * Modules/applepay/ApplePayPaymentRequest.h:
2366         * Modules/applepay/ApplePayPaymentRequest.idl:
2367         * Modules/applepay/ApplePayRequestBase.cpp:
2368         (WebCore::convertAndValidate):
2369         * Modules/applepay/ApplePayRequestBase.h:
2370         * Modules/applepay/ApplePayRequestBase.idl:
2371         * Modules/applepay/ApplePaySession.cpp:
2372         (WebCore::convertAndValidate):
2373         * Modules/applepay/ApplePaySessionPaymentRequest.h:
2374         (WebCore::ApplePaySessionPaymentRequest::version const):
2375         (WebCore::ApplePaySessionPaymentRequest::setVersion):
2376         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
2377         (WebCore::convert):
2378         * Modules/applepay/paymentrequest/ApplePayRequest.idl:
2379         * testing/MockPaymentCoordinator.cpp:
2380         (WebCore::MockPaymentCoordinator::showPaymentUI):
2381         (WebCore::MockPaymentCoordinator::completeMerchantValidation):
2382         * testing/MockPaymentCoordinator.h:
2383
2384 2018-01-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2385
2386         [iOS] Specify -[NSURL _title] for the associated URL when copying an image element
2387         https://bugs.webkit.org/show_bug.cgi?id=181783
2388         <rdar://problem/35785445>
2389
2390         Reviewed by Ryosuke Niwa.
2391
2392         Always specify the -[NSURL _title] to be either the title specified in a PasteboardImage's inner PasteboardURL,
2393         or if no title is specified, fall back to the user-visible URL string. This is because at least one internal
2394         client always tries to use the -_title property to determine the title of a pasted URL, or if none is specified,
2395         the -suggestedName. Since we need to set suggestedName to the preferred file name of the copied image and we
2396         don't want the suggested name to become the title of the link, we need to explicitly set the link title.
2397
2398         In doing so, this patch also fixes a bug wherein we forget to set the _title of the NSURL we're registering to
2399         an NSItemProvider.
2400
2401         Tests:  ActionSheetTests.CopyImageElementWithHREFAndTitle (new)
2402                 ActionSheetTests.CopyImageElementWithHREF (modified)
2403
2404         * platform/ios/PlatformPasteboardIOS.mm:
2405         (WebCore::PlatformPasteboard::write):
2406
2407 2018-01-17  Jer Noble  <jer.noble@apple.com>
2408
2409         WebVTT served via HLS never results in cues
2410         https://bugs.webkit.org/show_bug.cgi?id=181773
2411
2412         Reviewed by Eric Carlson.
2413
2414         Test: http/tests/media/hls/hls-webvtt-tracks.html
2415
2416         Three independant errors conspired to keep in-band WebVTT samples from parsing:
2417
2418         - The definition of ISOWebVTTCue::boxTypeName() was incorrect.
2419         - ISOWebVTTCue::parse() didn't call it's superclass's parse() method (leading to an incorrect size and offset).
2420         - Use String::fromUTF8() rather than String.adopt(StringVector&&).
2421
2422         * platform/graphics/iso/ISOVTTCue.cpp:
2423         (WebCore::ISOWebVTTCue::parse):
2424         * platform/graphics/iso/ISOVTTCue.h:
2425         (WebCore::ISOWebVTTCue::boxTypeName):
2426
2427 2018-01-17  John Wilander  <wilander@apple.com>
2428
2429         Resource Load Statistics: Block cookies for prevalent resources without user interaction
2430         https://bugs.webkit.org/show_bug.cgi?id=177394
2431         <rdar://problem/34613960>
2432
2433         Reviewed by Alex Christensen.
2434
2435         Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect.html
2436                http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html
2437                http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html
2438                http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html
2439
2440         * platform/network/NetworkStorageSession.h:
2441             Now exports NetworkStorageSession::nsCookieStorage().
2442         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2443         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
2444             Fixes the FIXME.
2445
2446 2018-01-17  Dean Jackson  <dino@apple.com>
2447
2448         Remove linked-on test for Snow Leopard
2449         https://bugs.webkit.org/show_bug.cgi?id=181770
2450
2451         Reviewed by Eric Carlson.
2452
2453         Remove a very old linked-on-or-after test.
2454
2455         * platform/graphics/ca/GraphicsLayerCA.cpp:
2456
2457 2018-01-17  Matt Lewis  <jlewis3@apple.com>
2458
2459         Unreviewed, rolling out r227098.
2460
2461         This broke the build.
2462
2463         Reverted changeset:
2464
2465         "Remove linked-on test for Snow Leopard"
2466         https://bugs.webkit.org/show_bug.cgi?id=181770
2467         https://trac.webkit.org/changeset/227098
2468
2469 2018-01-17  Dean Jackson  <dino@apple.com>
2470
2471         Remove linked-on test for Snow Leopard
2472         https://bugs.webkit.org/show_bug.cgi?id=181770
2473
2474         Reviewed by Eric Carlson.
2475
2476         Remove a very old linked-on-or-after test.
2477
2478         * platform/graphics/ca/GraphicsLayerCA.cpp:
2479
2480 2018-01-17  Stephan Szabo  <stephan.szabo@sony.com>
2481
2482         [Curl] Use ResourceRequest::encodeWithPlatformData()
2483         https://bugs.webkit.org/show_bug.cgi?id=181768
2484
2485         Reviewed by Alex Christensen.
2486
2487         No new tests, assertion hit in downstream port, should be covered by
2488         existing tests.
2489
2490         * platform/network/curl/ResourceRequest.h:
2491         (WebCore::ResourceRequest::encodeWithPlatformData const):
2492         (WebCore::ResourceRequest::decodeWithPlatformData):
2493
2494 2018-01-17  Eric Carlson  <eric.carlson@apple.com>
2495
2496         Use existing RGB colorspace instead of creating a new one
2497         https://bugs.webkit.org/show_bug.cgi?id=181765
2498         <rdar://problem/36595753>
2499
2500         Reviewed by Dean Jackson.
2501
2502         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
2503         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Use sRGBColorSpaceRef instead
2504         of creating a new static colorspace.
2505
2506 2018-01-17  Matt Lewis  <jlewis3@apple.com>
2507
2508         Unreviewed, rolling out r227076.
2509
2510         This breaks internal builds
2511
2512         Reverted changeset:
2513
2514         "Resource Load Statistics: Block cookies for prevalent
2515         resources without user interaction"
2516         https://bugs.webkit.org/show_bug.cgi?id=177394
2517         https://trac.webkit.org/changeset/227076
2518
2519 2018-01-17  Ryosuke Niwa  <rniwa@webkit.org>
2520
2521         input and textarea elements should reveal selection in setSelection when focused
2522         https://bugs.webkit.org/show_bug.cgi?id=181715
2523         <rdar://problem/36570546>
2524
2525         Reviewed by Zalan Bujtas.
2526
2527         Made input and textarea elements reveal selection in FrameSelection::setSelection instead of by directly
2528         invoking FrameSelection::revealSelection in their respective updateFocusAppearance to unify code paths.
2529
2530         Also added options to reveal selection up to the main frame to SetSelectionOption to be used in iOS.
2531
2532         * editing/FrameSelection.cpp:
2533         (WebCore::FrameSelection::FrameSelection):
2534         (WebCore::FrameSelection::moveWithoutValidationTo): Takes SelectionRevealMode as an argument and converts
2535         sets appropriate selection options.
2536         (WebCore::FrameSelection::setSelection): Reconstruct SelectionRevealMode out of selection option sets.
2537         (WebCore::FrameSelection::updateAndRevealSelection):
2538         * editing/FrameSelection.h:
2539         (WebCore::FrameSelection): Added RevealSelectionUpToMainFrame as a SelectionRevealMode and replaced
2540         m_shouldRevealSelection by m_selectionRevealMode.
2541         * html/HTMLInputElement.cpp:
2542         (WebCore::HTMLInputElement::updateFocusAppearance): Pass SelectionRevealMode to HTMLTextFormControlElement's
2543         select and restoreCachedSelection instead of directly invoking FrameSelection::revealSelection.
2544         * html/HTMLTextAreaElement.cpp:
2545         (WebCore::HTMLTextAreaElement::updateFocusAppearance): Ditto.
2546         * html/HTMLTextFormControlElement.cpp:
2547         (WebCore::HTMLTextFormControlElement::select):
2548         (WebCore::HTMLTextFormControlElement::setSelectionRange):
2549         (WebCore::HTMLTextFormControlElement::restoreCachedSelection):
2550         * html/HTMLTextFormControlElement.h:
2551
2552 2018-01-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2553
2554         WEBKIT_FRAMEWORK should not modify file-global include directories
2555         https://bugs.webkit.org/show_bug.cgi?id=181656
2556
2557         Reviewed by Konstantin Tokarev.
2558
2559         * CMakeLists.txt:
2560         * PlatformWPE.cmake:
2561
2562 2018-01-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2563
2564         [GTK] Try even harder not to static link WTF into libwebkit2gtk
2565         https://bugs.webkit.org/show_bug.cgi?id=181751
2566
2567         Reviewed by Alex Christensen.
2568
2569         We don't want two copies of WTF. It should only be in libjavascriptcoregtk.
2570
2571         * PlatformGTK.cmake:
2572
2573 2018-01-17  Zalan Bujtas  <zalan@apple.com>
2574
2575         Multicol: RenderMultiColumnFlow should not inherit the flow state
2576         https://bugs.webkit.org/show_bug.cgi?id=181762
2577         <rdar://problem/35448565>
2578
2579         Reviewed by Simon Fraser.
2580
2581         Do not compute the inherited flow state flag for RenderMultiColumnFlow.
2582         It is (by definition) always inside a fragmented flow.
2583
2584         Test: fast/multicol/crash-when-out-of-flow-positioned-becomes-in-flow.html
2585
2586         * rendering/RenderObject.cpp:
2587         (WebCore::RenderObject::computedFragmentedFlowState):
2588
2589 2018-01-17  Alex Christensen  <achristensen@webkit.org>
2590
2591         Deprecate Application Cache
2592         https://bugs.webkit.org/show_bug.cgi?id=181764
2593
2594         Reviewed by Geoffrey Garen.
2595
2596         * features.json:
2597
2598 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2599
2600         [iOS simulator] API test WKAttachmentTests.InjectedBundleReplaceURLWhenPastingImage is failing
2601         https://bugs.webkit.org/show_bug.cgi?id=181758
2602
2603         Reviewed by Tim Horton.
2604
2605         This test is failing because Editor::clientReplacementURLForResource expects a MIME type, but on iOS, the type
2606         paramter passed into WebContentReader::readImage is a UTI; subsequently, the bundle editing delegate receives
2607         a MIME type that's actually a UTI, which is incorrect. To address this, ensure that a MIME type is passed to
2608         bundle SPI by converting the type in WebContentReader::readImage to a MIME type.
2609
2610         * editing/cocoa/WebContentReaderCocoa.mm:
2611         (WebCore::WebContentReader::readImage):
2612
2613 2018-01-17  Antti Koivisto  <antti@apple.com>
2614
2615         REGRESSION (r226385?): Crash in com.apple.WebCore: WebCore::MediaQueryEvaluator::evaluate const + 32
2616         https://bugs.webkit.org/show_bug.cgi?id=181742
2617         <rdar://problem/36334726>
2618
2619         Reviewed by David Kilzer.
2620
2621         Test: fast/media/mediaqueryevaluator-crash.html
2622
2623         * css/MediaQueryEvaluator.cpp:
2624         (WebCore::MediaQueryEvaluator::MediaQueryEvaluator):
2625
2626         Use WeakPtr<Document> instead of a plain Frame pointer.
2627
2628         (WebCore::MediaQueryEvaluator::evaluate const):
2629
2630         Get the frame via document.
2631
2632         * css/MediaQueryEvaluator.h:
2633         * dom/Document.cpp:
2634         (WebCore::Document::prepareForDestruction):
2635
2636         Take care to clear style resolver.
2637
2638 2018-01-17  Youenn Fablet  <youenn@apple.com>
2639
2640         Put fetch request keepAlive behind a runtime flag
2641         https://bugs.webkit.org/show_bug.cgi?id=181592
2642
2643         Reviewed by Chris Dumez.
2644
2645         No change of behavior.
2646
2647         * Modules/fetch/FetchRequest.idl:
2648         * page/RuntimeEnabledFeatures.h:
2649         (WebCore::RuntimeEnabledFeatures::fetchAPIKeepAliveEnabled const):
2650         (WebCore::RuntimeEnabledFeatures::setFetchAPIKeepAliveEnabled):
2651
2652 2018-01-17  Per Arne Vollan  <pvollan@apple.com>
2653
2654         [Win] Use switch when converting from ResourceRequestCachePolicy to platform cache policy.
2655         https://bugs.webkit.org/show_bug.cgi?id=181686
2656
2657         Reviewed by Alex Christensen.
2658
2659         No new tests, covered by existing tests.
2660
2661         A switch will make the function easier on the eyes. Also, use the function in places where the ResourceRequestCachePolicy
2662         is just casted to a platform cache policy.
2663
2664         * platform/network/cf/ResourceRequestCFNet.cpp:
2665         (WebCore::toPlatformRequestCachePolicy):
2666
2667 2018-01-17  John Wilander  <wilander@apple.com>
2668
2669         Resource Load Statistics: Block cookies for prevalent resources without user interaction
2670         https://bugs.webkit.org/show_bug.cgi?id=177394
2671         <rdar://problem/34613960>
2672
2673         Reviewed by Alex Christensen.
2674
2675         Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect.html
2676                http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html
2677                http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html
2678                http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html
2679
2680         * platform/network/NetworkStorageSession.h:
2681             Now exports NetworkStorageSession::nsCookieStorage().
2682         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2683         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
2684             Fixes the FIXME.
2685
2686 2018-01-17  Daniel Bates  <dabates@apple.com>
2687
2688         REGRESSION (r222795): Cardiogram never signs in
2689         https://bugs.webkit.org/show_bug.cgi?id=181693
2690         <rdar://problem/36286293>
2691
2692         Reviewed by Ryosuke Niwa.
2693
2694         Exempt Cardiogram from the XHR header restrictions in r222795.
2695
2696         Following r222795 only Dashboard widgets are allowed to set arbitrary XHR headers.
2697         However Cardiogram also depends on such functionality.
2698
2699         Test: fast/xmlhttprequest/set-dangerous-headers-from-file-when-setting-enabled.html
2700
2701         * page/Settings.yaml:
2702         * platform/RuntimeApplicationChecks.h:
2703         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2704         (WebCore::IOSApplication::isCardiogram):
2705         * xml/XMLHttpRequest.cpp:
2706         (WebCore::XMLHttpRequest::setRequestHeader):
2707
2708 2018-01-17  Daniel Bates  <dabates@apple.com>
2709
2710         ASSERTION FAILED: !m_completionHandler in PingHandle::~PingHandle()
2711         https://bugs.webkit.org/show_bug.cgi?id=181746
2712         <rdar://problem/36586248>
2713
2714         Reviewed by Chris Dumez.
2715
2716         Call PingHandle::pingLoadComplete() with an error when NSURLConnection queries
2717         whether the ping is able to respond to an authentication request. (Pings do not
2718         respond to authenticate requests.) It will call the completion handler, nullify
2719         the completion handler, and deallocate the PingHandle. Nullifying the completion
2720         handler is necessary to avoid the assertion failure in ~PingHandle().
2721
2722         Test: http/tests/misc/before-unload-load-image.html
2723
2724         * platform/network/PingHandle.h:
2725
2726 2018-01-17  Daniel Bates  <dabates@apple.com>
2727
2728         WebCoreResourceHandleAsOperationQueueDelegate/ResourceHandleCFURLConnectionDelegateWithOperationQueue may
2729         be deleted in main thread callback
2730         https://bugs.webkit.org/show_bug.cgi?id=181747
2731         <rdar://problem/36588120>
2732
2733         Reviewed by Alex Christensen.
2734
2735         Retain the delegate (e.g. WebCoreResourceHandleAsOperationQueueDelegate) before scheduling
2736         a main thread callback and blocking on a semaphore for its reply because the main thread
2737         callback can do anything, including deleting the delegate, before the non-main thread
2738         has a chance to execute. For instance, a PingHandle will delete itself (and hence delete
2739         its resource handle delegate) in most of the code paths invoked by the delegate.
2740
2741         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
2742         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
2743         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
2744         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
2745         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
2746         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2747         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
2748         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
2749         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
2750         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
2751
2752 2018-01-17  Chris Dumez  <cdumez@apple.com>
2753
2754         'fetch' event may be sent to a service worker before its state is set to 'activated'
2755         https://bugs.webkit.org/show_bug.cgi?id=181698
2756         <rdar://problem/36554856>
2757
2758         Reviewed by Youenn Fablet.
2759
2760         'fetch' event may be sent to a service worker before its state is set to 'activated'.
2761         When the registration's active worker needs to intercept a load, and its state is 'activating',
2762         we queue the request to send the fetch event in SWServerWorker::m_whenActivatedHandlers.
2763         Once the SWServerWorker::setState() is called with 'activated' state, we then call the
2764         handlers in m_whenActivatedHandlers to make send the fetch event now that the worker is
2765         activated. The issue is that even though the worker is activated and its state was set to
2766         'activated' on Storage process side, we had not yet notified the ServiceWorker process
2767         of the service worker's new state yet.
2768
2769         To address the issue, we now make sure that SWServerWorker::m_whenActivatedHandlers are
2770         called *after* we've sent the IPC to the ServiceWorker process to update the worker's
2771         state to 'activated'. Also, we now call ServiceWorkerFetch::dispatchFetchEvent()
2772         asynchronously in a postTask() as the service worker's state is also updated asynchronously
2773         in a postTask. This is as per specification [1], which says to "queue a task" to fire
2774         the fetch event.
2775
2776         [1] https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (step 18)
2777
2778         No new tests, covered by imported/w3c/web-platform-tests/service-workers/service-worker/fetch-waits-for-activate.https.html
2779         which hits the new assertion without the fix.
2780
2781         * workers/service/context/ServiceWorkerFetch.cpp:
2782         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
2783         Add assertions to make sure that we dispatch the fetch event on the right worker and
2784         that the worker is in 'activated' state.
2785
2786         * workers/service/context/ServiceWorkerThread.cpp:
2787         (WebCore::ServiceWorkerThread::postFetchTask):
2788         Queue a task to fire the fetch event as per:
2789         - https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (step 18)
2790         We need to match the specification exactly here or things will happen in the wrong
2791         order. In particular, things like "update registration state" and "update worker state"
2792         might happen *after* firing the fetch event, even though the IPC for "update registration/worker
2793         state" was sent before the "fire fetch event" one, because the code for updating a registration/
2794         worker state already queues a task, as per the specification.
2795
2796         * workers/service/server/SWServerRegistration.cpp:
2797         (WebCore::SWServerRegistration::updateWorkerState):
2798         * workers/service/server/SWServerRegistration.h:
2799         * workers/service/server/SWServerWorker.cpp:
2800         (WebCore::SWServerWorker::setState):
2801         Move code to send the IPC to the Service Worker process whenever the service worker's state
2802         needs to be updated from SWServerRegistration::updateWorkerState() to SWServerWorker::setState().
2803         This way, we can make sure the IPC is sent *before* we call the m_whenActivatedHandlers handlers,
2804         as they may also send IPC to the Service Worker process, and we need to make sure this IPC happens
2805         after so that the service worker is in the right state.
2806
2807 2018-01-17  Stephan Szabo  <stephan.szabo@sony.com>
2808
2809         Page.cpp only sees forward declaration of ApplicationStateChangeListener when ENABLE(VIDEO) is off
2810         https://bugs.webkit.org/show_bug.cgi?id=181713
2811
2812         Reviewed by Darin Adler.
2813
2814         No new tests (build fix).
2815
2816         * page/Page.cpp: Add include for ApplicationStateChangeListener
2817
2818 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2819
2820         Add injected bundle SPI to replace subresource URLs when dropping or pasting rich content
2821         https://bugs.webkit.org/show_bug.cgi?id=181637
2822         <rdar://problem/36508471>
2823
2824         Reviewed by Tim Horton.
2825
2826         Before carrying out blob URL conversion for pasted or dropped rich content, let the editor client replace
2827         subresource URLs in WebKit2 by calling out to new injected bundle SPI. See comments below for more detail.
2828
2829         Tests:  WKAttachmentTests.InjectedBundleReplaceURLsWhenPastingAttributedString
2830                 WKAttachmentTests.InjectedBundleReplaceURLWhenPastingImage
2831
2832         * editing/Editor.cpp:
2833         (WebCore::Editor::clientReplacementURLForResource):
2834         * editing/Editor.h:
2835
2836         Add a new helper to call out to the editor client for a URL string to replace a given ArchiveResource. In
2837         WebKit2, this calls out to the injected bundle's new `replacementURLForResource` SPI hook.
2838
2839         * editing/cocoa/WebContentReaderCocoa.mm:
2840         (WebCore::shouldReplaceSubresourceURL):
2841         (WebCore::replaceRichContentWithAttachments):
2842         (WebCore::replaceSubresourceURLsWithURLsFromClient):
2843
2844         Add a new static helper to replace subresource URLs in the given DocumentFragment with URLs supplied by the
2845         editor client. Additionally builds a list of ArchiveResources that have not been replaced, for use at call sites
2846         so that we don't unnecessarily create more Blobs for ArchiveResources that have already been replaced.
2847
2848         (WebCore::createFragmentAndAddResources):
2849         (WebCore::sanitizeMarkupWithArchive):
2850
2851         Tweak web content reading codepaths to first replace subresource URLs with editor-client-supplied URLs.
2852
2853         (WebCore::WebContentReader::readImage):
2854         (WebCore::shouldConvertToBlob): Deleted.
2855
2856         Rename this helper to shouldReplaceSubresourceURL, blob URL replacement is no longer the only scenario in which
2857         we replace resource URLs, but in both cases, we still want to ignore `http:`-family and `data:` URLs.
2858
2859         * loader/EmptyClients.cpp:
2860         * page/EditorClient.h:
2861
2862 2018-01-17  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2863         [EME][GStreamer] Add the full-sample encryption support in the GStreamer ClearKey decryptor
2864         https://bugs.webkit.org/show_bug.cgi?id=180080
2865
2866         Reviewed by Xabier Rodriguez-Calvar.
2867
2868         Currently the GStreamer clearKey decryptor doesn't support the full-sample encryption,
2869         where the buffer is entirely encrypted, it supports only the sub-sample encryption.
2870
2871         Test: media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
2872
2873         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
2874         (webKitMediaClearKeyDecryptorDecrypt):
2875
2876 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
2877
2878         Unreviewed follow-up to r227051.
2879
2880         * platform/graphics/cairo/CairoOperations.h: Fix declaration of the
2881         fillRoundedRect() function by removing the bool parameter that's not
2882         used at all in the definition. This went unspotted due to the unified
2883         source build including the implementation file before fillRoundedRect()
2884         usage in GrapihcsContextCairo.cpp, leaving the declaration undefined
2885         and instead using the definition directly.
2886
2887 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
2888
2889         [Cairo] Don't mirror global alpha and image interpolation quality state values in PlatformContextCairo
2890         https://bugs.webkit.org/show_bug.cgi?id=181725
2891
2892         Reviewed by Carlos Garcia Campos.
2893
2894         Don't duplicate global alpha and image interpolation quality state
2895         values on the PlatformContextCairo. Instead, retrieve them from
2896         the managing GraphicsContextState when necessary.
2897
2898         For Cairo operations, the FillSource and StrokeSource containers now
2899         store the global alpha value, using it during the operation executions.
2900         For drawNativeImage(), the global alpha and interpolation quality values
2901         are passed through arguments.
2902
2903         In PlatformContextCairo, the two values are no longer stored on the
2904         internally-managed stack, and the getter-setter pairs for the two values
2905         are removed. In drawSurfaceToContext(), the two values are now expected
2906         to be passed through the method arguments.
2907
2908         No new tests -- no change in behavior.
2909
2910         * platform/graphics/cairo/CairoOperations.cpp:
2911         (WebCore::Cairo::prepareForFilling):
2912         (WebCore::Cairo::prepareForStroking):
2913         (WebCore::Cairo::drawPathShadow):
2914         (WebCore::Cairo::fillCurrentCairoPath):
2915         (WebCore::Cairo::FillSource::FillSource):
2916         (WebCore::Cairo::StrokeSource::StrokeSource):
2917         (WebCore::Cairo::strokeRect):
2918         (WebCore::Cairo::strokePath):
2919         (WebCore::Cairo::drawGlyphs):
2920         (WebCore::Cairo::drawNativeImage):
2921         (WebCore::Cairo::State::setGlobalAlpha): Deleted.
2922         (WebCore::Cairo::State::setImageInterpolationQuality): Deleted.
2923         * platform/graphics/cairo/CairoOperations.h:
2924         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2925         (WebCore::GraphicsContext::drawNativeImage):
2926         (WebCore::GraphicsContext::setPlatformAlpha):
2927         (WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
2928         * platform/graphics/cairo/PlatformContextCairo.cpp:
2929         (WebCore::PlatformContextCairo::save):
2930         (WebCore::PlatformContextCairo::drawSurfaceToContext):
2931         (WebCore::PlatformContextCairo::State::State): Deleted.
2932         (WebCore::PlatformContextCairo::setImageInterpolationQuality): Deleted.
2933         (WebCore::PlatformContextCairo::imageInterpolationQuality const): Deleted.
2934         (WebCore::PlatformContextCairo::globalAlpha const): Deleted.
2935         (WebCore::PlatformContextCairo::setGlobalAlpha): Deleted.
2936         * platform/graphics/cairo/PlatformContextCairo.h:
2937         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2938         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
2939
2940 2018-01-17  Philippe Normand  <pnormand@igalia.com>
2941
2942         REGRESSION(r226973/r226974): Four multimedia tests failing
2943         https://bugs.webkit.org/show_bug.cgi?id=181696
2944
2945         Reviewed by Carlos Garcia Campos.
2946
2947         This patch reverts some of the changes of the above revisions so as to fix layout test failures.
2948
2949         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2950         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Properly
2951         prepare stalled event when an error was detected.
2952         (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats): Revert to previous version.
2953         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): Ditto.
2954         (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const):
2955         Emit progress event also when streaming but not when an error was
2956         detected.
2957         (WebCore::MediaPlayerPrivateGStreamer::totalBytes const): use isLiveStream like everywhere else.
2958         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2959         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2960         (webkit_web_src_init): Revert to keep-alive FALSE by default.
2961
2962 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
2963
2964         [Cairo] Move prepareForFilling(), prepareForStroking() code to CairoOperations
2965         https://bugs.webkit.org/show_bug.cgi?id=181721
2966
2967         Reviewed by Carlos Garcia Campos.
2968
2969         Move the prepareForFilling() and prepareForStroking() code off of the
2970         PlatformContextCairo class and into static functions inside the
2971         CairoOperations implementation files. The original methods weren't
2972         called from any place other than the Cairo operations, and they only
2973         operated with the cairo_t object that's stored in and retrievable from
2974         the PlatformContextCairo object.
2975
2976         No new tests -- no change in behavior.
2977
2978         * platform/graphics/cairo/CairoOperations.cpp:
2979         (WebCore::Cairo::reduceSourceByAlpha):
2980         (WebCore::Cairo::prepareCairoContextSource):
2981         (WebCore::Cairo::clipForPatternFilling):
2982         (WebCore::Cairo::prepareForFilling):
2983         (WebCore::Cairo::prepareForStroking):
2984         (WebCore::Cairo::drawPathShadow):
2985         (WebCore::Cairo::fillCurrentCairoPath):
2986         (WebCore::Cairo::strokeRect):
2987         (WebCore::Cairo::strokePath):
2988         (WebCore::Cairo::drawGlyphs):
2989         * platform/graphics/cairo/PlatformContextCairo.cpp:
2990         (WebCore::reduceSourceByAlpha): Deleted.
2991         (WebCore::prepareCairoContextSource): Deleted.
2992         (WebCore::PlatformContextCairo::prepareForFilling): Deleted.
2993         (WebCore::PlatformContextCairo::prepareForStroking): Deleted.
2994         (WebCore::PlatformContextCairo::clipForPatternFilling): Deleted.
2995         * platform/graphics/cairo/PlatformContextCairo.h:
2996
2997 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
2998
2999         [Cairo] Use one-time ShadowBlur objects when performing shadowing
3000         https://bugs.webkit.org/show_bug.cgi?id=181720
3001
3002         Reviewed by Carlos Garcia Campos.
3003
3004         Don't maintain a ShadowBlur object in the PlatformContextCairo class.
3005         Instead, use temporary ShadowBlur objects whenever shadowing is needed,
3006         providing all the shadow state information to it and drawing shadow into
3007         the given GraphicsContext object.
3008
3009         ShadowBlur constructors are cleaned up. The 'shadows ignored' argument
3010         can now also be provided to the variant that accepts explicit shadow
3011         attributes, but the argument is false by default.
3012
3013         In CairoOperations, the ShadowBlurUsage functionality is rolled into the
3014         new ShadowState class. ShadowState parameter is now used for operations
3015         that might need to perform shadow painting. Call sites are modified
3016         accordingly.
3017
3018         Cairo::State::setShadowValues() and Cairo::State::clearShadow() are
3019         removed, since the ShadowBlur object that was modified through those is
3020         being removed from the PlatformContextCairo class. We still have to flip
3021         the Y-axis of the shadow offset in GraphicsContext::setPlatformShadow()
3022         when shadows are ignoring transformations.
3023
3024         No new tests -- no change in behavior.
3025
3026         * platform/graphics/ShadowBlur.cpp:
3027         (WebCore::ShadowBlur::ShadowBlur):
3028         * platform/graphics/ShadowBlur.h:
3029         * platform/graphics/cairo/CairoOperations.cpp:
3030         (WebCore::Cairo::drawPathShadow):
3031         (WebCore::Cairo::drawGlyphsShadow):
3032         (WebCore::Cairo::ShadowState::ShadowState):
3033         (WebCore::Cairo::ShadowState::isVisible const):
3034         (WebCore::Cairo::ShadowState::isRequired const):
3035         (WebCore::Cairo::fillRect):
3036         (WebCore::Cairo::fillRoundedRect):
3037         (WebCore::Cairo::fillRectWithRoundedHole):
3038         (WebCore::Cairo::fillPath):
3039         (WebCore::Cairo::strokeRect):
3040         (WebCore::Cairo::strokePath):
3041         (WebCore::Cairo::drawGlyphs):
3042         (WebCore::Cairo::drawNativeImage):
3043         (WebCore::Cairo::State::setShadowValues): Deleted.
3044         (WebCore::Cairo::State::clearShadow): Deleted.
3045         (WebCore::Cairo::ShadowBlurUsage::ShadowBlurUsage): Deleted.
3046         (WebCore::Cairo::ShadowBlurUsage::required const): Deleted.
3047         * platform/graphics/cairo/CairoOperations.h:
3048         * platform/graphics/cairo/FontCairo.cpp:
3049         (WebCore::FontCascade::drawGlyphs):
3050         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3051         (WebCore::GraphicsContext::restorePlatformState):
3052         (WebCore::GraphicsContext::drawNativeImage):
3053         (WebCore::GraphicsContext::fillPath):
3054         (WebCore::GraphicsContext::strokePath):
3055         (WebCore::GraphicsContext::fillRect):
3056         (WebCore::GraphicsContext::setPlatformShadow):
3057         (WebCore::GraphicsContext::clearPlatformShadow):
3058         (WebCore::GraphicsContext::strokeRect):
3059         (WebCore::GraphicsContext::platformFillRoundedRect):
3060         (WebCore::GraphicsContext::fillRectWithRoundedHole):
3061         * platform/graphics/cairo/PlatformContextCairo.cpp:
3062         (WebCore::PlatformContextCairo::drawSurfaceToContext):
3063         * platform/graphics/cairo/PlatformContextCairo.h:
3064         (WebCore::PlatformContextCairo::shadowBlur): Deleted.
3065         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
3066         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
3067
3068 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
3069
3070         CanvasImageData: createImageData() parameter should not be nullable
3071         https://bugs.webkit.org/show_bug.cgi?id=181670
3072
3073         Reviewed by Sam Weinig.
3074
3075         createImageData() method on the CanvasImageData interface should not
3076         treat the ImageData parameter as nullable, but should instead reject any
3077         null values with a TypeError, as demanded by the specification.
3078
3079         No new tests -- current tests covering createImageData(null) are updated
3080         to properly cover new behavior of throwing a TypeError exception.
3081
3082         * html/canvas/CanvasImageData.idl:
3083         * html/canvas/CanvasRenderingContext2DBase.cpp:
3084         (WebCore::CanvasRenderingContext2DBase::createImageData const):
3085         * html/canvas/CanvasRenderingContext2DBase.h:
3086
3087 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
3088
3089         [CMake] Remove WebCoreDerivedSources library target
3090         https://bugs.webkit.org/show_bug.cgi?id=181664
3091
3092         Reviewed by Carlos Garcia Campos.
3093
3094         After unified source build has been introduced, CMake Visual
3095         Studio build suffers complicated unnecessary recompilation issues
3096         because Visual Studio invokes scripts twice in both WebCore and
3097         WebCoreDerivedSources projects (Bug 181117).
3098
3099         WebCoreDerivedSources library has been introduced in r198766 to
3100         avoid command line length limit of CMake Ninja build on macOS.
3101         Fortunately, unified source build has reduced the number of source
3102         files to compile, WebCore doesn't need to be split anymore.
3103
3104         No new tests (No behavior change)
3105
3106         * CMakeLists.txt: Replaced WebCore_DERIVED_SOURCES with WebCore_SOURCES. Removed WebCoreDerivedSources library target.
3107         Do not compile each JavaScript Builtins.cpp files because the unified source WebCoreJSBuiltins.cpp is already included.
3108         * PlatformGTK.cmake: Replaced WebCore_DERIVED_SOURCES with WebCore_SOURCES.
3109         * PlatformWin.cmake: Ditto.
3110
3111 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
3112
3113         Can't scroll iframe after toggling it to display:none and back
3114         https://bugs.webkit.org/show_bug.cgi?id=181708
3115         rdar://problem/13234778
3116
3117         Reviewed by Tim Horton.
3118
3119         Nothing updated the FrameView's set of scrollable areas when a subframe came back from display:none.
3120         Mirror the existing virtual removeChild() by making addChild() virtual, and using it to mark
3121         the FrameView's scrollable area set as dirty.
3122
3123         Test: tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe.html
3124
3125         * page/FrameView.cpp:
3126         (WebCore::FrameView::addChild):
3127         * page/FrameView.h:
3128         * platform/ScrollView.h:
3129
3130 2018-01-16  Chris Dumez  <cdumez@apple.com>
3131
3132         SWServerWorker::m_contextConnectionIdentifier may get out of date
3133         https://bugs.webkit.org/show_bug.cgi?id=181687
3134         <rdar://problem/36548111>
3135
3136         Reviewed by Brady Eidson.
3137
3138         SWServerWorker::m_contextConnectionIdentifier may get out of date. This happens when the
3139         context process crashes and is relaunched.
3140
3141         No new tests, added assertion in terminateWorkerInternal() that hits without this fix.
3142
3143         * workers/service/server/SWServer.cpp:
3144         (WebCore::SWServer::runServiceWorker):
3145         (WebCore::SWServer::terminateWorkerInternal):
3146         (WebCore::SWServer::unregisterServiceWorkerClient):
3147         * workers/service/server/SWServerWorker.h:
3148         (WebCore::SWServerWorker::setContextConnectionIdentifier):
3149
3150 2018-01-16  Jer Noble  <jer.noble@apple.com>
3151
3152         Reset MediaSourcePrivateAVFObjC's m_sourceBufferWithSelectedVideo when the underlying SourceBufferPrivate is removed.
3153         https://bugs.webkit.org/show_bug.cgi?id=181707
3154         <rdar://problem/34809474>
3155
3156         Reviewed by Eric Carlson.
3157
3158         Test: media/media-source/media-source-remove-unload-crash.html
3159
3160         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
3161         (WebCore::MediaSourcePrivateAVFObjC::removeSourceBuffer):
3162
3163 2018-01-12  Jiewen Tan  <jiewen_tan@apple.com>
3164
3165         [WebAuthN] Implement dummy WebAuthN IDLs
3166         https://bugs.webkit.org/show_bug.cgi?id=181627
3167         <rdar://problem/36459864>
3168
3169         Reviewed by Alex Christensen.
3170
3171         This patch implements dummy WebAuthN IDLs and connect them with Credential Management as well.
3172         All implementations in this patch are subject to change when real implementations land. The
3173         purpose here on the other hand is to have IDLs, bindings and implementations connected. This
3174         patch should handle all IDLs that we need.
3175
3176         No tests.
3177
3178         * CMakeLists.txt:
3179         * DerivedSources.make:
3180         * Modules/credentialmanagement/CredentialCreationOptions.h:
3181         * Modules/credentialmanagement/CredentialCreationOptions.idl:
3182         * Modules/credentialmanagement/CredentialRequestOptions.h:
3183         * Modules/credentialmanagement/CredentialRequestOptions.idl:
3184         * Modules/webauthn/AuthenticatorAssertionResponse.cpp: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp.
3185         (WebCore::AuthenticatorAssertionResponse::AuthenticatorAssertionResponse):
3186         (WebCore::AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse):
3187         (WebCore::AuthenticatorAssertionResponse::authenticatorData):
3188         (WebCore::AuthenticatorAssertionResponse::signature):
3189         (WebCore::AuthenticatorAssertionResponse::userHandle):
3190         * Modules/webauthn/AuthenticatorAssertionResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
3191         * Modules/webauthn/AuthenticatorAssertionResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
3192         * Modules/webauthn/AuthenticatorAttestationResponse.cpp: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
3193         (WebCore::AuthenticatorAttestationResponse::AuthenticatorAttestationResponse):
3194         (WebCore::AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse):
3195         (WebCore::AuthenticatorAttestationResponse::attestationObject):
3196         * Modules/webauthn/AuthenticatorAttestationResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
3197         * Modules/webauthn/AuthenticatorAttestationResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
3198         * Modules/webauthn/AuthenticatorResponse.cpp: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
3199         (WebCore::AuthenticatorResponse::AuthenticatorResponse):
3200         (WebCore::AuthenticatorResponse::~AuthenticatorResponse):
3201         (WebCore::AuthenticatorResponse::clientDataJSON):
3202         * Modules/webauthn/AuthenticatorResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
3203         * Modules/webauthn/AuthenticatorResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
3204         * Modules/webauthn/PublicKeyCredential.cpp:
3205         (WebCore::PublicKeyCredential::rawId):
3206         (WebCore::PublicKeyCredential::response):
3207         (WebCore::PublicKeyCredential::getClientExtensionResults):
3208         (WebCore::PublicKeyCredential::isUserVerifyingPlatformAuthenticatorAvailable):
3209         * Modules/webauthn/PublicKeyCredential.h:
3210         * Modules/webauthn/PublicKeyCredential.idl:
3211         * Modules/webauthn/PublicKeyCredentialCreationOptions.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
3212         * Modules/webauthn/PublicKeyCredentialCreationOptions.idl: Added.
3213         * Modules/webauthn/PublicKeyCredentialDescriptor.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
3214         * Modules/webauthn/PublicKeyCredentialDescriptor.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
3215         * Modules/webauthn/PublicKeyCredentialRequestOptions.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
3216         * Modules/webauthn/PublicKeyCredentialRequestOptions.idl: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
3217         * Modules/webauthn/PublicKeyCredentialType.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
3218         * Modules/webauthn/PublicKeyCredentialType.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
3219         * Sources.txt:
3220         * WebCore.xcodeproj/project.pbxproj:
3221         * bindings/js/WebCoreBuiltinNames.h:
3222
3223 2018-01-16  Zalan Bujtas  <zalan@apple.com>
3224
3225         AX: Do not trigger layout in updateBackingStore() unless it is safe to do so
3226         https://bugs.webkit.org/show_bug.cgi?id=181703
3227         <rdar://problem/36365706>
3228
3229         Reviewed by Ryosuke Niwa.
3230
3231         Document::isSafeToUpdateStyleOrLayout() can tell whether it is safe to run layout.
3232
3233         Unable to create test with WebInspector involved. 
3234
3235         * accessibility/AccessibilityObject.cpp:
3236         (WebCore::AccessibilityObject::updateBackingStore):
3237         * dom/Document.cpp:
3238         (WebCore::Document::isSafeToUpdateStyleOrLayout const):
3239         (WebCore::Document::updateStyleIfNeeded):
3240         (WebCore::Document::updateLayout):
3241         (WebCore::isSafeToUpdateStyleOrLayout): Deleted.
3242         * dom/Document.h:
3243
3244 2018-01-16  Ryan Haddad  <ryanhaddad@apple.com>
3245
3246         Unreviewed, rolling out r226962.
3247
3248         The LayoutTest added with this change is a flaky timeout.
3249
3250         Reverted changeset:
3251
3252         "Support for preconnect Link headers"
3253         https://bugs.webkit.org/show_bug.cgi?id=181657
3254         https://trac.webkit.org/changeset/226962
3255
3256 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
3257
3258         Text looks bad on some CSS spec pages
3259         https://bugs.webkit.org/show_bug.cgi?id=181700
3260         rdar://problem/36552107
3261
3262         Reviewed by Tim Horton.
3263
3264         When making new tiles in a TileController, we failed to set their "supports antialiased layer text"
3265         setting, so tile caches could end up with a mixture of layers that do and do not support
3266         antialiased layer text.
3267
3268         No tests because the tiled drawing tests don't dump out tiles inside of tile caches.
3269
3270         * platform/graphics/ca/TileController.cpp:
3271         (WebCore::TileController::createTileLayer):
3272
3273 2018-01-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
3274
3275         REGRESSION(r221292): svg/animations/animateTransform-pattern-transform.html crashes with security assertion
3276         https://bugs.webkit.org/show_bug.cgi?id=179986
3277
3278         Reviewed by Simon Fraser.
3279
3280         This patch reverts all or parts of the following changes-sets
3281             <http://trac.webkit.org/changeset/221292>
3282             <http://trac.webkit.org/changeset/197967>
3283             <http://trac.webkit.org/changeset/196670>
3284
3285         A JS statement like this:
3286             var item = text.x.animVal.getItem(0);
3287
3288         Creates the following C++ objects:
3289             SVGAnimatedListPropertyTearOff<SVGLengthListValues> for 'text.x'
3290             SVGListPropertyTearOff<SVGLengthListValues> for 'text.x.animVal'
3291             SVGPropertyTearOff<SVGLengthValue> for 'text.x.animVal.getItem(0)'
3292
3293         If 'item' changes, the attribute 'x' of the element '<text>' will change
3294         as well. But this binding works only in one direction. If the attribute
3295         'x' of the element '<text>' changes, e.g.:
3296
3297             text.setAttribute('x', '10,20,30');
3298
3299         This will detach 'item' from the element <text> and any further changes 
3300         in 'item' won't affect the attribute 'x' of element <text>.
3301
3302         The one direction binding can only work if this chain of tear-off objects
3303         is kept connected. This is implemented by RefCounted back pointers from
3304         SVGPropertyTearOff and SVGListPropertyTearOff to SVGAnimatedListPropertyTearOff.
3305
3306         The security crashes and the memory leaks are happening because of the
3307         raw forward pointers:
3308             -- SVGAnimatedListPropertyTearOff maintains raw pointers of type
3309                SVGListPropertyTearOff for m_baseVal and m_animVal
3310             -- The m_wrappers and m_animatedWrappers of SVGAnimatedListPropertyTearOff
3311                are vectors of raw pointer Vector<SVGLength*>
3312
3313         To control the life cycle of the raw pointers, SVGListPropertyTearOff and
3314         SVGPropertyTearOff call SVGAnimatedListPropertyTearOff::propertyWillBeDeleted()
3315         to notify it they are going to be deleted. In propertyWillBeDeleted(), we
3316         clear the pointers so they are not used after being freed. This mechanism
3317         has been error-prone and we've never got it 100% right.
3318
3319         The solution we need to adopt with SVG tear-off objects is the following:
3320             -- All the forward pointers should be weak pointers.
3321             -- All the back pointers should be ref pointers.
3322
3323         This solution may not look intuitive but it solves the bugs and keeps the
3324         one direction binding. The forward weak pointers allows the tear-off
3325         objects to go aways if no reference from JS exists. The back ref pointers
3326         maintains the chain of objects and guarantees the correct binding.
3327
3328         * svg/SVGPathSegList.h:
3329         * svg/SVGTransformList.h:
3330         * svg/properties/SVGAnimatedListPropertyTearOff.h:
3331         (WebCore::SVGAnimatedListPropertyTearOff::baseVal):
3332         (WebCore::SVGAnimatedListPropertyTearOff::animVal):
3333         * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
3334         * svg/properties/SVGAnimatedProperty.h:
3335         (WebCore::SVGAnimatedProperty::isAnimatedListTearOff const):
3336         (WebCore::SVGAnimatedProperty::propertyWillBeDeleted): Deleted.
3337         * svg/properties/SVGAnimatedPropertyTearOff.h:
3338         * svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
3339         * svg/properties/SVGListProperty.h:
3340         (WebCore::SVGListProperty::initializeValuesAndWrappers):
3341         (WebCore::SVGListProperty::getItemValuesAndWrappers):
3342         (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
3343         (WebCore::SVGListProperty::replaceItemValuesAndWrappers):
3344         (WebCore::SVGListProperty::removeItemValuesAndWrappers):
3345         (WebCore::SVGListProperty::appendItemValuesAndWrappers):
3346         (WebCore::SVGListProperty::createWeakPtr const):
3347         * svg/properties/SVGListPropertyTearOff.h:
3348         (WebCore::SVGListPropertyTearOff::removeItemFromList):
3349         (WebCore::SVGListPropertyTearOff::~SVGListPropertyTearOff): Deleted.
3350         * svg/properties/SVGPropertyTearOff.h:
3351         (WebCore::SVGPropertyTearOff::createWeakPtr const):
3352         (WebCore::SVGPropertyTearOff::~SVGPropertyTearOff):
3353
3354 2018-01-16  Eric Carlson  <eric.carlson@apple.com>
3355
3356         AVSampleBufferDisplayLayer should be flushed when application activates
3357         https://bugs.webkit.org/show_bug.cgi?id=181623
3358         <rdar://problem/36487738>
3359
3360         Reviewed by Darin Adler.
3361
3362         No new tests, I wasn't able to reproduce it in a test.
3363
3364         * WebCore.xcodeproj/project.pbxproj:
3365         * dom/Document.cpp:
3366         (WebCore::Document::addApplicationStateChangeListener): New.
3367         (WebCore::Document::removeApplicationStateChangeListener): Ditto.
3368         (WebCore::Document::forEachApplicationStateChangeListener): Ditto.
3369         * dom/Document.h:
3370
3371         * html/HTMLMediaElement.cpp:
3372         (WebCore::HTMLMediaElement::registerWithDocument): Register for application state changes.
3373         (WebCore::HTMLMediaElement::unregisterWithDocument): Unregister.
3374         (WebCore::HTMLMediaElement::applicationWillResignActive): Pass through to the player.
3375         (WebCore::HTMLMediaElement::applicationDidBecomeActive): Ditto.
3376         * html/HTMLMediaElement.h:
3377
3378         * page/ApplicationStateChangeListener.h: Added.
3379         (WebCore::ApplicationStateChangeListener::applicationWillResignActive):
3380         (WebCore::ApplicationStateChangeListener::applicationDidBecomeActive):
3381         * page/Page.cpp:
3382         (WebCore::Page::forEachDocument):
3383         (WebCore::Page::applicationWillResignActive):
3384         (WebCore::Page::applicationDidEnterBackground):
3385         (WebCore::Page::applicationWillEnterForeground):
3386         (WebCore::Page::applicationDidBecomeActive):
3387         * page/Page.h:
3388         * platform/graphics/MediaPlayer.cpp:
3389         (WebCore::MediaPlayer::applicationWillResignActive):
3390         (WebCore::MediaPlayer::applicationDidBecomeActive):
3391         * platform/graphics/MediaPlayer.h:
3392         * platform/graphics/MediaPlayerPrivate.h:
3393         (WebCore::MediaPlayerPrivateInterface::applicationWillResignActive):
3394         (WebCore::MediaPlayerPrivateInterface::applicationDidBecomeActive):
3395
3396         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3397         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3398         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Switch
3399         to release logging.
3400         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC): Ditto.
3401         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueCorrectedVideoSample): Split out of enqueueVideoSample.
3402         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): Move code that updates
3403         the display later to enqueueCorrectedVideoSample. Rearrange logic to the image painter sample
3404         buffer has the correct timestamp.
3405         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerErrorDidChange): Switch to release logging.
3406         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): Ditto.
3407         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive): f the display
3408         layer is in the "failed" state, flush the renderer and update the display mode.
3409         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers): Switch to release logging.
3410         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::load): Ditto.
3411         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::cancelLoad): Ditto.
3412         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareToPlay): Ditto.
3413         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode): Ditto.
3414         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): Ditto.
3415         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): Ditto.
3416         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume): Ditto.
3417         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted): Ditto.
3418         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateReadyState) Ditto.:
3419         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::logChannel const): Ditto.
3420         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes): Deleted.
3421
3422 2018-01-16  Michael Catanzaro  <mcatanzaro@igalia.com>
3423
3424         PAL should link to JavaScriptCore rather than WTF
3425         https://bugs.webkit.org/show_bug.cgi?id=181683
3426
3427         Reviewed by Konstantin Tokarev.
3428
3429         Do not link directly to JavaScriptCore. Get it via PAL.
3430
3431         * CMakeLists.txt:
3432
3433 2018-01-16  Zach Li  <zachli@apple.com>
3434
3435         Add pop-up policy support in website policies.
3436         https://bugs.webkit.org/show_bug.cgi?id=181544.
3437         rdar://problem/30521400.
3438
3439         Reviewed by Alex Christensen.
3440
3441         * loader/DocumentLoader.h:
3442         Introduce pop-up policy getter and setter. Initialize
3443         the policy as Default.
3444         (WebCore::DocumentLoader::popUpPolicy const):
3445         (WebCore::DocumentLoader::setPopUpPolicy):
3446         * page/DOMWindow.cpp:
3447         (WebCore::DOMWindow::allowPopUp):
3448         Pop-up policy specified on a per-page basis holds
3449         precedence over the global policy. If no pop-up policy
3450         is specified during navigation, global policy is used.
3451
3452 2018-01-16  Jer Noble  <jer.noble@apple.com>
3453
3454         Crash playing audio-only HLS stream via hls.js (MSE)
3455         https://bugs.webkit.org/show_bug.cgi?id=181691
3456         <rdar://problem/32967295>
3457
3458         Reviewed by Eric Carlson.
3459
3460         Add a weak-link check to the block called by -[AVSampleBufferDisplayLayer requestMediaDataWhenReadyOnQueue:usingBlock:].
3461
3462         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3463         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
3464         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):
3465         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer):
3466
3467 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
3468
3469         Rename applyHorizontalScale/applyVerticalScale in SVG filters, and related cleanup
3470         https://bugs.webkit.org/show_bug.cgi?id=181684
3471
3472         Reviewed by Alex Christensen.
3473
3474         Rename the confusing applyHorizontalScale/applyVerticalScale to scaledByFilterResolution(),
3475         and have it take and return a FloatSize. Change callers to do math in terms of FloatSizes.
3476
3477         Add inflate(size) to each of the rect classes.
3478
3479         * platform/graphics/FloatRect.h:
3480         (WebCore::FloatRect::inflate):
3481         * platform/graphics/IntRect.h:
3482         (WebCore::IntRect::inflate):
3483         * platform/graphics/LayoutRect.h:
3484         (WebCore::LayoutRect::inflate):
3485         * platform/graphics/filters/FEDisplacementMap.cpp:
3486         (WebCore::FEDisplacementMap::platformApplySoftware):
3487         * platform/graphics/filters/FEDropShadow.cpp:
3488         (WebCore::FEDropShadow::determineAbsolutePaintRect):
3489         (WebCore::FEDropShadow::platformApplySoftware):
3490         * platform/graphics/filters/FEGaussianBlur.cpp:
3491         (WebCore::FEGaussianBlur::calculateUnscaledKernelSize):
3492         (WebCore::FEGaussianBlur::calculateKernelSize):
3493         (WebCore::FEGaussianBlur::determineAbsolutePaintRect):
3494         (WebCore::FEGaussianBlur::platformApplySoftware):
3495         * platform/graphics/filters/FEGaussianBlur.h:
3496         * platform/graphics/filters/FEMorphology.cpp:
3497         (WebCore::FEMorphology::determineAbsolutePaintRect):
3498         (WebCore::FEMorphology::platformApplySoftware):
3499         * platform/graphics/filters/FEOffset.cpp:
3500         (WebCore::FEOffset::determineAbsolutePaintRect):
3501         (WebCore::FEOffset::platformApplySoftware):
3502         * platform/graphics/filters/Filter.h:
3503         (WebCore::Filter::setSourceImage):
3504         (WebCore::Filter::scaledByFilterResolution const):
3505         (WebCore::Filter::applyHorizontalScale const): Deleted.
3506         (WebCore::Filter::applyVerticalScale const): Deleted.
3507         * platform/graphics/filters/FilterOperations.cpp:
3508         (WebCore::outsetSizeForBlur):
3509         * rendering/FilterEffectRenderer.h:
3510         * svg/graphics/filters/SVGFilter.cpp:
3511         (WebCore::SVGFilter::scaledByFilterResolution const):
3512         (WebCore::SVGFilter::applyHorizontalScale const): Deleted.
3513         (WebCore::SVGFilter::applyVerticalScale const): Deleted.
3514         * svg/graphics/filters/SVGFilter.h:
3515
3516 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
3517
3518         [CMake][Mac] Fix the build errors
3519         https://bugs.webkit.org/show_bug.cgi?id=181665
3520
3521         Reviewed by Alex Christensen.
3522
3523         No new tests (No behavior change)
3524
3525         * CMakeLists.txt: Added Modules/paymentrequest/MerchantValidationEvent.idl to compile.
3526         * PlatformMac.cmake: Added Modules/paymentrequest/MerchantValidationEvent.cpp to compile.
3527         Added workers/service/context and Modules/applicationmanifest as forwarding header paths.
3528
3529 2018-01-16  Wenson Hsieh  <wenson_hsieh@apple.com>
3530
3531         [Attachment Support] Provide the `src` of an attachment to the UI delegate when an attachment is inserted
3532         https://bugs.webkit.org/show_bug.cgi?id=181638
3533         <rdar://problem/36508702>
3534
3535         Reviewed by Dan Bernstein.
3536
3537         Adjust the `didInsertAttachment` codepath to additionally propagate the attachment element's `src`.
3538         Additionally, fix an issue with insertion and removal client notifications wherein the client can receive
3539         insertion calls without corresponding removal calls, or vice versa. This is an existing issue, but matters more
3540         now because we actually need to access the attachment element for its `src` when propagating changes to the
3541         client. See below for details.
3542
3543         Test: WKAttachmentTests.AttachmentUpdatesWhenInsertingRichMarkup
3544
3545         * dom/Document.h:
3546         (WebCore::Document::attachmentElementsByIdentifier const):
3547         * editing/Editor.cpp:
3548         (WebCore::Editor::notifyClientOfAttachmentUpdates):
3549         * page/EditorClient.h:
3550         (WebCore::EditorClient::didInsertAttachment):
3551         * page/Frame.cpp:
3552         (WebCore::Frame::setDocument):
3553
3554         When a Frame's document changes, inform the client that the attachments in the previous document are going away.
3555         For each attachment currently connected to the document, we have either (1) already informed the client that it
3556         was inserted, or (2) the attachment is pending an insertion call to the client. If (1) is the case, then we'll
3557         tell the client that the attachment is removed, which will balance out the earlier insertion call. If (2) is the
3558         case, then we'll remove the previously inserted attachment identifier from the set of attachment identifiers
3559         pending insertion, and the client won't be informed of insertions or removals.
3560
3561 2018-01-16  Antoine Quint  <graouts@apple.com>
3562
3563         Use traits for animation timing functions
3564         https://bugs.webkit.org/show_bug.cgi?id=181651
3565
3566         Reviewed by Dean Jackson.
3567
3568         Cleaning up Dean's previous patch as suggested by Darin's post-commit review comments. The
3569         downcast function can match const automatically and it's a better style to put the * inside
3570         the downcast call rather than outside.
3571
3572         * css/CSSComputedStyleDeclaration.cpp:
3573         (WebCore::createTimingFunctionValue):
3574         * platform/animation/TimingFunction.cpp:
3575         (WebCore::operator<<):
3576         (WebCore::TimingFunction::transformTime const):
3577         * platform/animation/TimingFunction.h:
3578         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
3579         (WebCore::toCAMediaTimingFunction):
3580
3581 2018-01-16  Philippe Normand  <pnormand@igalia.com>
3582
3583         [GStreamer] Live streaming cleanups
3584         https://bugs.webkit.org/show_bug.cgi?id=181672
3585
3586         Reviewed by Michael Catanzaro.
3587
3588         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3589         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Switch to
3590         streaming code path when no content-length was reported by the
3591         http source element.
3592         (WebCore::MediaPlayerPrivateGStreamer::totalBytes const): Return early when streaming.
3593         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3594         (CachedResourceStreamingClient::responseReceived): Emit headers as
3595         an element message, like souphttpsrc.
3596
3597 2018-01-15  Philippe Normand  <pnormand@igalia.com>
3598
3599         [GStreamer] misc fixes and cleanups
3600         https://bugs.webkit.org/show_bug.cgi?id=181647
3601
3602         Reviewed by Michael Catanzaro.
3603
3604         * platform/graphics/MediaPlayer.cpp:
3605         (WebCore::convertEnumerationToString): New utility function to convert preload enum to string.
3606         * platform/graphics/MediaPlayerEnums.h: Ditto.
3607         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3608         (WebCore::MediaPlayerPrivateGStreamer::load): Debug tweak
3609         (WebCore::MediaPlayerPrivateGStreamer::prepareToPlay): Ditto
3610         (WebCore::MediaPlayerPrivateGStreamer::play): Ditto
3611         (WebCore::MediaPlayerPrivateGStreamer::paused const): Ditto
3612         (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats): Prevent useless state update.
3613         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): Ditto.
3614         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Debug tweak.
3615         (WebCore::MediaPlayerPrivateGStreamer::setDownloadBuffering): Ditto.
3616         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
3617         Remove useless handlesSyncMessage method.
3618         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3619         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Prevent useless state update.
3620         (WebCore::MediaPlayerPrivateGStreamerBase::muted const): Debug tweak.
3621         (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement): Ditto.
3622         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3623         (webkit_web_src_init): Enable keepAlive by default like in souphttpsrc.
3624         (webKitWebSrcStart): Debug tweak.
3625         (webKitWebSrcQueryWithParent): Ditto.
3626         (webKitWebSrcNeedData): Ditto.
3627         (CachedResourceStreamingClient::responseReceived): Change appsrc
3628         stream-type when we wan't seek. Also update caps like souphttpsrc
3629         does.
3630         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.h: Add forward declaration of MediaPlayer.
3631         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
3632         (WebCore::MediaSourceClientGStreamerMSE::append): Fix compilation warning.
3633
3634 2018-01-16  Yacine Bandou  <yacine.bandou_ext@softathome.com>
3635
3636         [WPE] Two clearkey tests failing since r226621
3637         https://bugs.webkit.org/show_bug.cgi?id=181532
3638
3639         Reviewed by Xabier Rodriguez-Calvar.
3640
3641         Whith a fake initData, we can have a pssh size nul, thus we should check it.
3642         We saw this issue in the subtest "initData longer than 64Kb characters" in
3643         the clearkey-generate-request-disallowed-input layout test.
3644
3645         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
3646         (WebCore::extractKeyidsLocationFromCencInitData):
3647
3648 2018-01-15  Yoav Weiss  <yoav@yoav.ws>
3649
3650         Support for preconnect Link headers
3651         https://bugs.webkit.org/show_bug.cgi?id=181657
3652
3653         Reviewed by Darin Adler.
3654
3655         Move the preconnect functionality into its own function, and
3656         also call this function when Link headers are processed.
3657
3658         Test: http/tests/preconnect/link-header-rel-preconnect-http.php
3659
3660         * loader/LinkLoader.cpp:
3661         (WebCore::LinkLoader::loadLinksFromHeader): Call preconnect.
3662         (WebCore::LinkLoader::preconnect): Preconnect to a host functionality moved here.
3663         (WebCore::LinkLoader::preload): Renamed `preloadIfNeeded` to `preload`.
3664         (WebCore::LinkLoader::loadLink): Call preconnect.
3665         * loader/LinkLoader.h:
3666
3667 2018-01-15  Michael Catanzaro  <mcatanzaro@igalia.com>
3668
3669         Improve use of ExportMacros
3670         https://bugs.webkit.org/show_bug.cgi?id=181652
3671
3672         Reviewed by Konstantin Tokarev.
3673
3674         Remove a comment.
3675
3676         * platform/PlatformExportMacros.h:
3677
3678 2018-01-15  Konstantin Tokarev  <annulen@yandex.ru>
3679
3680         image-rendering should affect scaling of border-image
3681         https://bugs.webkit.org/show_bug.cgi?id=169440
3682
3683         Reviewed by Michael Catanzaro.
3684
3685         Test: fast/borders/border-image-pixelated.html
3686
3687         * rendering/style/NinePieceImage.cpp:
3688         (WebCore::NinePieceImage::paint):
3689
3690 2018-01-15  Tomas Popela  <tpopela@redhat.com>
3691
3692         2.19.3 ACCELERATED_2D_CANVAS support is broken
3693         https://bugs.webkit.org/show_bug.cgi?id=180799
3694
3695         Reviewed by Michael Catanzaro.
3696
3697         * html/canvas/CanvasRenderingContext2DBase.cpp:
3698         (WebCore::CanvasRenderingContext2DBase::didDraw):
3699
3700 2018-01-15  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3701
3702         [Curl] Enable HTTP/2
3703         https://bugs.webkit.org/show_bug.cgi?id=181551
3704
3705         Reviewed by Michael Catanzaro.
3706
3707         Start supporting HTTP/2 protocol. The first step is just enabling the HTTP/2 on Curl backend.
3708         Next step will be to enable multiplexing feature.
3709
3710         No new tests because we don't have HTTP/2 test backend yet.
3711
3712         * platform/network/curl/CurlContext.cpp:
3713         (WebCore::CurlContext::isHttp2Enabled const):
3714         (WebCore::CurlHandle::enableHttp):
3715         (WebCore::CurlHandle::enableHttpGetRequest):
3716         (WebCore::CurlHandle::enableHttpHeadRequest):
3717         (WebCore::CurlHandle::enableHttpPostRequest):
3718         (WebCore::CurlHandle::enableHttpPutRequest):
3719         (WebCore::CurlHandle::setHttpCustomRequest):
3720         * platform/network/curl/CurlContext.h:
3721
3722 2018-01-15  Dean Jackson  <dino@apple.com>
3723
3724         Use a helper function for checked arithmetic in WebGL validation
3725         https://bugs.webkit.org/show_bug.cgi?id=181620
3726         <rdar://problem/36485879>
3727
3728         Reviewed by Eric Carlson.
3729
3730         Eric recommended using a templated helper function to do
3731         a common arithmetic check in WebGL validation.
3732
3733         * html/canvas/WebGL2RenderingContext.cpp:
3734         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
3735         * html/canvas/WebGLRenderingContext.cpp:
3736         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
3737         * html/canvas/WebGLRenderingContextBase.cpp:
3738         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
3739         (WebCore::WebGLRenderingContextBase::validateDrawArrays):
3740         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0):
3741         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0):
3742         * html/canvas/WebGLRenderingContextBase.h:
3743         (WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): New helper.
3744
3745 2018-01-15  Dean Jackson  <dino@apple.com>
3746
3747         Use traits for animation timing functions
3748         https://bugs.webkit.org/show_bug.cgi?id=181651
3749         <rdar://problem/36525328>
3750
3751         Reviewed by Antoine Quint.
3752
3753         Use the type traits for TimingFunction classes, so
3754         we can is<> and downcast<>.
3755
3756         * css/CSSComputedStyleDeclaration.cpp:
3757         (WebCore::createTimingFunctionValue):
3758         * platform/animation/TimingFunction.cpp:
3759         (WebCore::TimingFunction::transformTime const):
3760         * platform/animation/TimingFunction.h:
3761         * platform/graphics/ca/GraphicsLayerCA.cpp:
3762         (WebCore::animationHasStepsTimingFunction):
3763         (WebCore::animationHasFramesTimingFunction):
3764         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
3765         (WebCore::toCAMediaTimingFunction):
3766
3767 2018-01-15  Youenn Fablet  <youenn@apple.com>
3768
3769         RealtimeMediaSource should be ThreadSafeRefCounted
3770         https://bugs.webkit.org/show_bug.cgi?id=181649
3771
3772         Reviewed by Eric Carlson.
3773
3774         Difficult to write a test as this is really racy.
3775         RealtimeIncomingVideoSourceCocoa::OnFrame is taking a reference on a background thread
3776         to send a task to the main thread.
3777         This requires it to be thread safe ref counted.
3778
3779         * platform/mediastream/RealtimeMediaSource.h:
3780
3781 2018-01-15  Philippe Normand  <pnormand@igalia.com>
3782
3783         Prevent useless MediaPlayer mute state notifications
3784         https://bugs.webkit.org/show_bug.cgi?id=181646
3785
3786         Reviewed by Carlos Garcia Campos.
3787
3788         On GTK port the mute change notification was triggering the test
3789         runner to think the whole page mute state had changed and that
3790         media elements were muted. The simplest solution is to propagate
3791         the notification only if the state actually changed.
3792
3793         * platform/graphics/MediaPlayer.cpp:
3794         (WebCore::MediaPlayer::muteChanged): Propagate mute notification
3795         only if the mute state actually changed.
3796
3797 2018-01-15  Sebastian Dröge  <sebastian@centricular.com>
3798
3799         [GStreamer] Don't wait for draw condition variable when shutting down.
3800         https://bugs.webkit.org/show_bug.cgi?id=180978
3801
3802         Reviewed by Carlos Garcia Campos.
3803
3804         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3805         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
3806         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
3807         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3808         By also waiting for the draw condition variable while shutting down,
3809         it is possible that the GStreamer video sink is waiting for the main
3810         thread to actually render the current frame, while at the same time
3811         the main thread is waiting for the GStreamer video sink to shut down,
3812         resulting in a deadlock.
3813
3814 2018-01-13  Minsheng Liu  <lambda@liu.ms>
3815
3816         MathML Lengths should take zoom level into account
3817         https://bugs.webkit.org/show_bug.cgi?id=180029
3818
3819         Reviewed by Frédéric Wang.
3820
3821         The patch applies the effective zoom factor to physical units in toUserUnits().
3822
3823         Test: mathml/presentation/mspace-units-with-zoom.html
3824
3825         * rendering/mathml/RenderMathMLBlock.cpp:
3826         (WebCore::toUserUnits):
3827
3828 2018-01-12  Chris Dumez  <cdumez@apple.com>
3829
3830         ASSERTION FAILED: registration || isTerminating() in WebCore::SWServerWorker::skipWaiting()
3831         https://bugs.webkit.org/show_bug.cgi?id=181603
3832         <rdar://problem/36476050>
3833
3834         Reviewed by Youenn Fablet.
3835
3836         No new tests, covered by existing tests that crash flakily.
3837
3838         * workers/service/server/SWServer.cpp:
3839         (WebCore::SWServer::terminateWorkerInternal):
3840         If the connection to the context process is gone, make sure we make the worker as terminated
3841         so that it does not stay in Running state and in SWServer::m_runningOrTerminatingWorkers.
3842
3843         * workers/service/server/SWServerRegistration.cpp:
3844         (WebCore::SWServerRegistration::~SWServerRegistration):
3845         Add assertions to make sure none of the registration's workers are still running when
3846         the registration is destroyed.
3847
3848         (WebCore::SWServerRegistration::updateRegistrationState):
3849         Make sure registration workers that are overwritten are not still running.
3850
3851         * workers/service/server/SWServerWorker.cpp:
3852         (WebCore::SWServerWorker::setState):
3853         If a worker's state is set to redundant, make sure we also terminate it.
3854
3855 2018-01-12  Commit Queue  <commit-queue@webkit.org>
3856
3857         Unreviewed, rolling out r226927.
3858         https://bugs.webkit.org/show_bug.cgi?id=181621
3859
3860         Breaks 32-bit and iOS release for some reason that i don't
3861         understand yet (Requested by dino on #webkit).
3862
3863         Reverted changeset:
3864
3865         "Use a helper function for checked arithmetic in WebGL
3866         validation"
3867         https://bugs.webkit.org/show_bug.cgi?id=181620
3868         https://trac.webkit.org/changeset/226927
3869
3870 2018-01-12  Myles C. Maxfield  <mmaxfield@apple.com>
3871
3872         Data URL fonts split in the middle of an alphabet cause random letters to disappear
3873         https://bugs.webkit.org/show_bug.cgi?id=175845
3874         <rdar://problem/33996578>
3875
3876         Reviewed by Brent Fulgham.
3877
3878         It is fairly common practice for a font foundry to split a font up into two files such that a semi-random
3879         half of the alphabet is present in one of the files, and the other half is present in the other file. This
3880         practice involves representing the files as data URLs, so as to minimize the time it takes to load them.
3881
3882         Because resource loading is asynchronous (even for data URLs), it is possible today to get a paint after
3883         the first file is loaded but before the second file is loaded. Indeed, because of the way font fallback
3884         works, we will never start loading the second file until a layout has occurred with the first font.
3885
3886         Because a site usually only uses this pattern for a handful of fonts, and I've never seen this pattern
3887         being used for CJK fonts, it isn't very expensive to opportunistically decode these data URLs eagerly.
3888         Using this method doesn't actually guarantee that the two fonts will load in between successive paints,
3889         but it at least makes this much more likely. This patch implements this strategy, along with a size
3890         threshold to make sure that we won't decode any super large data URLs when it isn't necessary.
3891
3892         Test: fast/text/font-load-data-partitioned-alphabet.html
3893
3894         * css/CSSFontFace.cpp:
3895         (WebCore::CSSFontFace::opportunisticallyStartFontDataURLLoading):
3896         * css/CSSFontFace.h:
3897         * css/CSSFontFaceSource.cpp:
3898         (WebCore::CSSFontFaceSource::opportunisticallyStartFontDataURLLoading):
3899         * css/CSSFontFaceSource.h:
3900         * css/CSSFontSelector.cpp:
3901         (WebCore::CSSFontSelector::opportunisticallyStartFontDataURLLoading):
3902         * css/CSSFontSelector.h:
3903         * platform/graphics/FontCascadeFonts.cpp:
3904         (WebCore::opportunisticallyStartFontDataURLLoading):
3905         (WebCore::FontCascadeFonts::glyphDataForVariant):
3906         * platform/graphics/FontSelector.h:
3907
3908 2018-01-12  Alex Christensen  <achristensen@webkit.org>
3909
3910         History state should be updated during client redirects with asynchronous policy decisions
3911         https://bugs.webkit.org/show_bug.cgi?id=181358
3912         <rdar://problem/35547689>
3913
3914         Reviewed by Andy Estes.
3915
3916         When decidePolicyForNavigationAction is responded to asynchronously during a client redirect, 
3917         HistoryController::updateForRedirectWithLockedBackForwardList does not update the history because
3918         the document loader has not been marked as a client redirect because the FrameLoader only looks
3919         at its provisional document loader to mark it as a client redirect.  When decidePolicyForNavigationAction
3920         is responded to asynchronously, though, the FrameLoader's provisional document loader has moved to 
3921         its policy document loader.  To get both asynchronous and synchronous cases, let's just mark the document
3922         loader as a client redirect whether it's the provisional or policy document loader.
3923
3924         Covered by a new API test.
3925
3926         * loader/FrameLoader.cpp:
3927         (WebCore::FrameLoader::loadURL):
3928         (WebCore::FrameLoader::loadPostRequest):
3929
3930 2018-01-12  Dean Jackson  <dino@apple.com>
3931
3932         Use a helper function for checked arithmetic in WebGL validation
3933         https://bugs.webkit.org/show_bug.cgi?id=181620
3934         <rdar://problem/36485879>
3935
3936         Reviewed by Eric Carlson.
3937
3938         Eric recommended using a templated helper function to do
3939         a common arithmetic check in WebGL validation.
3940
3941         * html/canvas/WebGL2RenderingContext.cpp:
3942         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
3943         * html/canvas/WebGLRenderingContext.cpp:
3944         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
3945         * html/canvas/WebGLRenderingContextBase.cpp:
3946         (WebCore::WebGLRenderingCo