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