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