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