d38951597368eaf18ddfef031fa06dc2fbeb62ab
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-01-31  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2
3         [EME] Fix NavigatorEME::tryNextSupportedConfiguration typo
4         https://bugs.webkit.org/show_bug.cgi?id=182324
5
6         Reviewed by Žan Doberšek.
7
8         * Modules/encryptedmedia/NavigatorEME.cpp:
9         (WebCore::tryNextSupportedConfiguration): Fix
10         candidateCofiguration typo.
11
12 2018-01-30  Fujii Hironori  <Hironori.Fujii@sony.com>
13
14         [WinCairo] syntheticBoldOffset makes a font with embedded bitmap fonts shown as double strike in HiDPI
15         https://bugs.webkit.org/show_bug.cgi?id=182093
16
17         Reviewed by Alex Christensen.
18
19         WebKit draws texts doubly by shifting 1px for fonts without bold
20         fonts but bold font is desired. This synthetic bold method draws
21         fonts with embedded bitmap fonts look like double strike in HiDPI.
22
23         No new tests (Covered by the existing tests).
24
25         * platform/graphics/win/FontCacheWin.cpp:
26         (WebCore::createGDIFont): Overwrite lfWeight if the desired weight
27         is bold and matched font weight is't bold and in WinCairo port.
28         Fix wrong indentation.
29
30 2018-01-30  Youenn Fablet  <youenn@apple.com> and Oleksandr Skachkov  <gskachkov@gmail.com>
31
32         FetchResponse should support ConsumeData callback on chunk data is received
33         https://bugs.webkit.org/show_bug.cgi?id=181600
34         <rdar://problem/36932547>
35
36         Reviewed by Alex Christensen.
37
38         Test: imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html
39
40         Apply same read-by-chunk strategy for body coming from network as for body coming from ReadableStream.
41         Refactor to have one consumeBodyReceivedByChunk method for both cases.
42         This allows streaming data from a service worker to WebProcess as would be done by NetworkProcess.
43
44         * Modules/cache/DOMCache.cpp:
45         (WebCore::DOMCache::addAll):
46         (WebCore::DOMCache::put):
47         * Modules/fetch/FetchResponse.cpp:
48         (WebCore::FetchResponse::BodyLoader::didSucceed):
49         (WebCore::FetchResponse::BodyLoader::didReceiveData):
50         (WebCore::FetchResponse::BodyLoader::consumeDataByChunk):
51         (WebCore::FetchResponse::consumeBody):
52         (WebCore::FetchResponse::consumeBodyReceivedByChunk):
53         * Modules/fetch/FetchResponse.h:
54         * workers/service/context/ServiceWorkerFetch.cpp:
55         (WebCore::ServiceWorkerFetch::processResponse):
56
57 2018-01-30  Don Olmstead  <don.olmstead@sony.com>
58
59         JSExports.h should be included as <JavaScriptCore/JSExportMacros.h>
60         https://bugs.webkit.org/show_bug.cgi?id=182312
61
62         Reviewed by Michael Catanzaro.
63
64         No new tests. No change in behavior.
65
66         * config.h:
67
68 2018-01-30  Chris Nardi  <cnardi@chromium.org>
69
70         Use double-quotes when serializing font-feature-settings
71         https://bugs.webkit.org/show_bug.cgi?id=182201
72
73         According to the CSSOM spec, all strings should be serialized with double-quotes. The feature
74         tag value was previously serialized with single-quotes; change this to double-quotes to match
75         the spec and non-WebKit browsers.
76
77         Reviewed by Myles C. Maxfield.
78
79         Updated css3/font-feature-settings-parsing.html, fast/css/inherited-properties-rare-text.html,
80         and fast/text/font-face-javascript.html.
81
82         * css/CSSFontFeatureValue.cpp:
83         (WebCore::CSSFontFeatureValue::customCSSText const):
84
85 2018-01-30  Brent Fulgham  <bfulgham@apple.com>
86
87         Add telemetry to track storage access API adoption
88         https://bugs.webkit.org/show_bug.cgi?id=182197
89         <rdar://problem/35803309>
90
91         Reviewed by Chris Dumez.
92
93         Part 2: Add telemetry for the Storage Access API case
94
95         Adds a new convenience method to identify origin/page/frame combinations that
96         have been granted access to the Storage Access API. This is used for debug
97         logging in the NetworkProcess. It is not used in production builds.
98
99         * platform/network/NetworkStorageSession.h:
100         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
101         (WebCore::NetworkStorageSession::hasStorageAccessForFrame const): Added.
102
103 2018-01-30  Ryosuke Niwa  <rniwa@webkit.org>
104
105         Release assert in updateLayout() via AXObjectCache::childrenChanged
106         https://bugs.webkit.org/show_bug.cgi?id=182279
107         <rdar://problem/36994456>
108
109         Reviewed by Antti Koivisto.
110
111         Disable the assertion in Document::updateLayout and Document::updateStyle* in this particular circumstance as fixing it
112         would require a large architectural refactoring of the accessibility code.
113
114         Test: accessibility/accessibility-object-update-during-style-resolution-crash.html
115
116         * accessibility/AXObjectCache.cpp:
117         (WebCore::AXObjectCache::childrenChanged): Disabled the release assertion here.
118         * dom/Document.cpp:
119         (WebCore::Document::isSafeToUpdateStyleOrLayout const): Check LayoutAssertionDisableScope::shouldDisable.
120         * dom/ScriptDisallowedScope.h:
121         (WebCore::ScriptDisallowedScope::LayoutAssertionDisableScope): Added.
122         (WebCore::ScriptDisallowedScope::LayoutAssertionDisableScope::LayoutAssertionDisableScope): Added.
123         (WebCore::ScriptDisallowedScope::LayoutAssertionDisableScope::~LayoutAssertionDisableScope): Added.
124         (WebCore::ScriptDisallowedScope::LayoutAssertionDisableScope::shouldDisable): Added.
125         * page/LayoutContext.cpp:
126         (WebCore::LayoutContext::layout): Check LayoutAssertionDisableScope::shouldDisable.
127
128 2018-01-30  Zalan Bujtas  <zalan@apple.com>
129
130         [RenderTreeBuilder] Move RenderRubyRun::rubyBaseSafe to RenderTreeBuilder::Ruby
131         https://bugs.webkit.org/show_bug.cgi?id=182306
132         <rdar://problem/37041440>
133
134         Reviewed by Antti Koivisto.
135
136         With all the ruby mutation code moving, only RenderTreeBuilder calls RenderRubyRun::rubyBaseSafe.
137
138         No change in functionality.
139
140         * rendering/RenderRubyRun.cpp:
141         (WebCore::RenderRubyRun::rubyText const):
142         (WebCore::RenderRubyRun::rubyBase const):
143         (WebCore::RenderRubyRun::firstLineBlock const):
144         (WebCore::RenderRubyRun::takeChild):
145         (WebCore::RenderRubyRun::rubyBaseSafe): Deleted.
146         * rendering/RenderRubyRun.h:
147         * rendering/updating/RenderTreeBuilderRuby.cpp:
148         (WebCore::RenderTreeBuilder::Ruby::insertChild):
149         (WebCore::RenderTreeBuilder::Ruby::rubyBaseSafe):
150         * rendering/updating/RenderTreeBuilderRuby.h:
151
152 2018-01-30  Fujii Hironori  <Hironori.Fujii@sony.com>
153
154         Unified sources for FEMorphology.cpp seems to break the windows build.
155         https://bugs.webkit.org/show_bug.cgi?id=178847
156
157         Reviewed by Yusuke Suzuki.
158
159         Fix a compilation error.
160         platform/graphics/filters/SpotLightSource.cpp(45): error C2027: use of undefined type 'WebCore::FilterEffect'
161
162         No new tests (No behavior change)
163
164         * Sources.txt: Removed @no-unify for FEMorphology.cpp.
165         * platform/graphics/filters/SpotLightSource.cpp: Added #include "FilterEffect.h".
166
167 2018-01-30  Myles C. Maxfield  <mmaxfield@apple.com>
168
169         Test fix after r227776
170         https://bugs.webkit.org/show_bug.cgi?id=180951
171
172         Unreviewed.
173
174         * platform/graphics/cocoa/FontCacheCoreText.cpp:
175         (WebCore::mandatoryAttributesForUserInstalledFonts):
176
177 2018-01-30  Dean Jackson  <dino@apple.com>
178
179         CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::Document::updateStyleIfNeeded
180         https://bugs.webkit.org/show_bug.cgi?id=182299
181         <rdar://problem/36853088>
182
183         Removing a misleading comment based on Zalan Bujtas's feedback.
184
185         * rendering/RenderElement.cpp:
186         (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded):
187
188 2018-01-30  Dean Jackson  <dino@apple.com>
189
190         CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::Document::updateStyleIfNeeded
191         https://bugs.webkit.org/show_bug.cgi?id=182299
192         <rdar://problem/36853088>
193
194         Reviewed by Simon Fraser.
195
196         Mostly speculative fix for the case where a scrollTo moves an
197         animated SVG image into view, causing its animation to restart during
198         a paint operation. This was causing a release ASSERT, so we now defer
199         the resumption of the animation into a timer.
200
201         Test: svg/animated-svgImage-scroll.html
202
203         * rendering/RenderElement.cpp:
204         (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded): Enqueue the
205         animation if it is an SVGImage.
206         * svg/graphics/SVGImage.cpp: Add a timer to enqueue animation starts.
207         (WebCore::SVGImage::SVGImage):
208         (WebCore::SVGImage::startAnimationTimerFired):
209         (WebCore::SVGImage::enqueueStartAnimation):
210         (WebCore::SVGImage::stopAnimation):
211         * svg/graphics/SVGImage.h:
212
213 2018-01-30  Chris Dumez  <cdumez@apple.com>
214
215         Service worker registration soft updates happen too frequently
216         https://bugs.webkit.org/show_bug.cgi?id=182296
217         <rdar://problem/37031862>
218
219         Reviewed by Youenn Fablet.
220
221         Move code that updates the registration's last update check time from after
222         the script bytecheck to before, as per:
223         - https://w3c.github.io/ServiceWorker/#update (step 7.19)
224
225         This way, the last update check time gets updated even if the newly fetched
226         script is identical to the previous one, which is the common case.
227
228         * workers/service/server/SWServer.cpp:
229         (WebCore::SWServer::updateWorker):
230         * workers/service/server/SWServerJobQueue.cpp:
231         (WebCore::SWServerJobQueue::scriptFetchFinished):
232
233 2018-01-30  Zalan Bujtas  <zalan@apple.com>
234
235         [RenderTreeBuilder] Move childBecameNonInline to RenderTreeBuilder
236         https://bugs.webkit.org/show_bug.cgi?id=182265
237         <rdar://problem/37004459>
238
239         Reviewed by Antti Koivisto.
240
241         Move the mutation code that wraps/unwraps a child element when its flow state changes
242         from(to) in-flow to(from) floating/out-of-flow.
243
244         No change in functionality.
245
246         * rendering/RenderBlock.cpp:
247         (WebCore::RenderBlock::childBecameNonInline): Deleted.
248         * rendering/RenderBlock.h:
249         * rendering/RenderBoxModelObject.h:
250         (WebCore::RenderBoxModelObject::childBecameNonInline): Deleted.
251         * rendering/RenderElement.cpp:
252         (WebCore::RenderElement::styleDidChange):
253         (WebCore::RenderElement::handleDynamicFloatPositionChange): Deleted.
254         * rendering/RenderInline.cpp:
255         (WebCore::RenderInline::childBecameNonInline): Deleted.
256         * rendering/RenderInline.h:
257         * rendering/updating/RenderTreeBuilder.cpp:
258         (WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock):
259         (WebCore::RenderTreeBuilder::splitFlow): Deleted.
260         * rendering/updating/RenderTreeBuilder.h:
261         * rendering/updating/RenderTreeBuilderBlock.cpp:
262         (WebCore::RenderTreeBuilder::Block::childBecameNonInline):
263         * rendering/updating/RenderTreeBuilderBlock.h:
264         * rendering/updating/RenderTreeBuilderInline.cpp:
265         (WebCore::RenderTreeBuilder::Inline::childBecameNonInline):
266         * rendering/updating/RenderTreeBuilderInline.h:
267
268 2018-01-30  Brent Fulgham  <bfulgham@apple.com>
269
270         Add telemetry to track storage access API adoption
271         https://bugs.webkit.org/show_bug.cgi?id=182197
272         <rdar://problem/35803309>
273
274         Reviewed by Chris Dumez.
275         
276         Partial roll-out of r227755.
277
278         The original patch assumed the WebContent process kept track of user interaction. This is
279         only tracked in the UIProcess, so we can get rid of some of the logging code adding in
280         r227755.
281
282         * loader/ResourceLoadObserver.cpp:
283         (WebCore::ResourceLoadObserver::logFrameNavigation):
284         (WebCore::ResourceLoadObserver::logSubresourceLoading):
285         (WebCore::ResourceLoadObserver::setTimeToLivePartitionFree): Deleted.
286         (WebCore::ResourceLoadObserver::wasAccessedWithinInteractionWindow const): Deleted.
287         * loader/ResourceLoadObserver.h:
288
289 2018-01-30  Chris Dumez  <cdumez@apple.com>
290
291         Make sure we never create a WebSWClientConnection with an invalid sessionID
292         https://bugs.webkit.org/show_bug.cgi?id=182276
293         <rdar://problem/36582633>
294
295         Reviewed by Alex Christensen.
296
297         Make sure we never create a WebSWClientConnection with an invalid sessionID as this
298         could corrupt our hash tables.
299
300         * dom/Document.cpp:
301         (WebCore::Document::privateBrowsingStateDidChange):
302         * workers/service/ServiceWorker.cpp:
303         (WebCore::ServiceWorker::postMessage):
304         * workers/service/ServiceWorkerContainer.cpp:
305         (WebCore::ServiceWorkerContainer::ready):
306         (WebCore::ServiceWorkerContainer::getRegistration):
307         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationRequest):
308         (WebCore::ServiceWorkerContainer::getRegistrations):
309         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationsRequest):
310         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
311         (WebCore::ServiceWorkerContainer::ensureSWClientConnection):
312
313 2018-01-30  Antti Koivisto  <antti@apple.com>
314
315         Avoid traversing too much when doing class change invalidation
316         https://bugs.webkit.org/show_bug.cgi?id=181604
317
318         Reviewed by Zalan Bujtas.
319
320         We are now collecting information about which part of the tree a change in class can potentially affect.
321         Use the information to traverse only the required elements in Style::Invalidator.
322
323         The same mechanism can be later used for attribute and id change invalidation.
324
325         * css/DocumentRuleSets.cpp:
326         (WebCore::DocumentRuleSets::collectFeatures const):
327         (WebCore::DocumentRuleSets::classInvalidationRuleSets const):
328         (WebCore::DocumentRuleSets::subjectClassRules const): Deleted.
329         (WebCore::DocumentRuleSets::ancestorClassRules const): Deleted.
330
331             Remove separate subject and ancestor invalidation RuleSets. Instead collect all invalidation rulesets
332             to a vector along with their MatchElements.
333
334         * css/DocumentRuleSets.h:
335         * css/RuleFeature.cpp:
336         (WebCore::RuleFeatureSet::computeNextMatchElement):
337         (WebCore::RuleFeatureSet::computeSubSelectorMatchElement):
338         (WebCore::RuleFeatureSet::collectFeatures):
339
340             Similarly collect all class invalidation RuleFeatures to a general HashMap along with the MatchElement.
341
342         (WebCore::RuleFeatureSet::add):
343         (WebCore::RuleFeatureSet::clear):
344         (WebCore::RuleFeatureSet::shrinkToFit):
345         * css/RuleFeature.h:
346         (WebCore::RuleFeature::RuleFeature):
347         * style/ClassChangeInvalidation.cpp:
348         (WebCore::Style::ClassChangeInvalidation::computeInvalidation):
349
350             Find out InvalidationRuleSets to use.
351
352         (WebCore::Style::ClassChangeInvalidation::invalidateStyleWithRuleSets):
353
354             Pass them to Style::Invalidator.
355
356         * style/ClassChangeInvalidation.h:
357         * style/StyleInvalidator.cpp:
358         (WebCore::Style::Invalidator::invalidateStyleForTree):
359         (WebCore::Style::Invalidator::invalidateStyleForDescendants):
360         (WebCore::Style::Invalidator::invalidateStyleWithMatchElement):
361
362             Traverse only the part of the tree needed by the given MatchElement.
363
364         * style/StyleInvalidator.h:
365         * style/StyleSharingResolver.cpp:
366         (WebCore::Style::SharingResolver::classNamesAffectedByRules const):
367
368 2018-01-30  Javier Fernandez  <jfernandez@igalia.com>
369
370         [css-align] The 'baseline' value must be invalid for the 'justify-content' property
371         https://bugs.webkit.org/show_bug.cgi?id=181794
372
373         Reviewed by Antti Koivisto.
374
375         The CSS WG has resolved that it doesn't make sense to define Baseline
376         Content-Alignment in the inline/main axis.
377
378         https://github.com/w3c/csswg-drafts/issues/1184
379
380         The spec has been updated so that <baseline-postion> is not valid for
381         the 'justify-content' property's syntax. This CL updates our parsing
382         logic to match the new spec, including the parsing logic of the
383         place-content shorthand.
384
385         Additionally, this CL updates the computed value of the
386         <baseline-position> values to match other browsers.
387
388         We don't implement support for <baseline-position> values in the
389         Content Distribution properties (align-content and justify-content),
390         so I don't expect this change to break content of sites using the CSS
391         Box Alignment feature.
392
393         No new tests, just adapt the Web Platform Tests we already have to the new CSS syntax.
394
395         * css/parser/CSSPropertyParser.cpp:
396         (WebCore::getBaselineKeyword):
397         (WebCore::consumeBaselineKeyword):
398         (WebCore::consumeContentDistributionOverflowPosition):
399         (WebCore::consumeSelfPositionOverflowPosition):
400         (WebCore::CSSPropertyParser::parseSingleValue):
401         (WebCore::consumeSimplifiedContentPosition):
402         (WebCore::CSSPropertyParser::consumePlaceContentShorthand):
403         (WebCore::consumeSimplifiedItemPosition):
404
405 2018-01-30  Basuke Suzuki  <Basuke.Suzuki@sony.com>
406
407         [WinCairo] Fix forwarding header conflict of WebKit on WinCairo
408         https://bugs.webkit.org/show_bug.cgi?id=177202
409
410         Reviewed by Alex Christensen.
411
412         * PlatformWin.cmake:
413
414 2018-01-30  Myles C. Maxfield  <mmaxfield@apple.com>
415
416         A disallowed user-installed font may be used if its PostScript name is specified
417         https://bugs.webkit.org/show_bug.cgi?id=180951
418
419         Reviewed by Brent Fulgham.
420
421         This patch adds a new CoreText font attribute, kCTFontFallbackOptionAttribute, to the
422         fonts which WebKit creates. It also adds this attribute to web fonts, so that font
423         fallback will happen according to our rules about user-installed fonts. It also marks
424         these font attributes as "mandatory" so CoreText will be guaranteed to follow the
425         policy.
426
427         Test: fast/text/user-installed-fonts/disable.html
428
429         * platform/graphics/FontCache.h:
430         (WebCore::FontDescriptionKey::makeFlagsKey):
431         * platform/graphics/cocoa/FontCacheCoreText.cpp:
432         (WebCore::FontDatabase::collectionForFamily):
433         (WebCore::FontDatabase::fontForPostScriptName):
434         (WebCore::addAttributesForUserInstalledFonts):
435         (WebCore::mandatoryAttributesForUserInstalledFonts):
436         * platform/graphics/mac/FontCustomPlatformData.cpp:
437         (WebCore::FontCustomPlatformData::fontPlatformData):
438
439 2018-01-29  Youenn Fablet  <youenn@apple.com>
440
441         Cache API should make sure to resolve caches.open promises in the same order as called
442         https://bugs.webkit.org/show_bug.cgi?id=182193
443         <rdar://problem/36930363>
444
445         Reviewed by Chris Dumez.
446
447         Covered by LayoutTests/http/wpt/cache-storage/cache-open-delete-in-parallel.https.html.
448
449         * Modules/cache/DOMCacheStorage.cpp:
450         (WebCore::DOMCacheStorage::doRemove): Removed optimization consisting in removing the cache from DOMCacheStorage object synchronously.
451         This optimization prevents going to the network process to try deleting the cache.
452
453 2018-01-29  Jiewen Tan  <jiewen_tan@apple.com>
454
455         [WebAuthN] Add a compile-time feature flag
456         https://bugs.webkit.org/show_bug.cgi?id=182211
457         <rdar://problem/36936365>
458
459         Reviewed by Brent Fulgham.
460
461         Add a compile-time feature flag for WebAuthN as most of the functionality is platform
462         dependent.
463
464         No tests.
465
466         * Configurations/FeatureDefines.xcconfig:
467         * Modules/credentialmanagement/BasicCredential.cpp:
468         * Modules/credentialmanagement/BasicCredential.h:
469         * Modules/credentialmanagement/BasicCredential.idl:
470         * Modules/credentialmanagement/CredentialCreationOptions.h:
471         * Modules/credentialmanagement/CredentialCreationOptions.idl:
472         * Modules/credentialmanagement/CredentialRequestOptions.h:
473         * Modules/credentialmanagement/CredentialRequestOptions.idl:
474         * Modules/credentialmanagement/CredentialsContainer.cpp:
475         * Modules/credentialmanagement/CredentialsContainer.h:
476         * Modules/credentialmanagement/CredentialsContainer.idl:
477         * Modules/credentialmanagement/NavigatorCredentials.cpp:
478         * Modules/credentialmanagement/NavigatorCredentials.h:
479         * Modules/credentialmanagement/NavigatorCredentials.idl:
480         * Modules/webauthn/Authenticator.cpp:
481         * Modules/webauthn/Authenticator.h:
482         * Modules/webauthn/AuthenticatorAssertionResponse.cpp:
483         * Modules/webauthn/AuthenticatorAssertionResponse.h:
484         * Modules/webauthn/AuthenticatorAssertionResponse.idl:
485         * Modules/webauthn/AuthenticatorAttestationResponse.cpp:
486         * Modules/webauthn/AuthenticatorAttestationResponse.h:
487         * Modules/webauthn/AuthenticatorAttestationResponse.idl:
488         * Modules/webauthn/AuthenticatorResponse.cpp:
489         * Modules/webauthn/AuthenticatorResponse.h:
490         * Modules/webauthn/AuthenticatorResponse.idl:
491         * Modules/webauthn/PublicKeyCredential.cpp:
492         * Modules/webauthn/PublicKeyCredential.h:
493         * Modules/webauthn/PublicKeyCredential.idl:
494         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
495         * Modules/webauthn/PublicKeyCredentialCreationOptions.idl:
496         * Modules/webauthn/PublicKeyCredentialDescriptor.h:
497         * Modules/webauthn/PublicKeyCredentialDescriptor.idl:
498         * Modules/webauthn/PublicKeyCredentialRequestOptions.h:
499         * Modules/webauthn/PublicKeyCredentialRequestOptions.idl:
500         * Modules/webauthn/PublicKeyCredentialType.h:
501         * Modules/webauthn/PublicKeyCredentialType.idl:
502         * bindings/js/JSAuthenticatorResponseCustom.cpp:
503         * bindings/js/JSBasicCredentialCustom.cpp:
504
505 2018-01-29  John Wilander  <wilander@apple.com>
506
507         Resource Load Statistics: Introduce debug mode as experimental feature
508         https://bugs.webkit.org/show_bug.cgi?id=182199
509         <rdar://problem/36930364>
510
511         Reviewed by Alex Christensen.
512
513         No new tests. This adds an experimental feature.
514
515         The only changes to default behavior are:
516         - Increased resolution on timestamps which is needed to be able to set shorter
517           timeouts in debug mode.
518         - Only update partitioning and blocking table when needed. This is an optimization
519           which pays off in less XPC with shorter timeouts.
520
521         * loader/ResourceLoadObserver.cpp:
522         (WebCore::reduceTimeResolution):
523         (WebCore::ResourceLoadObserver::logFrameNavigation):
524         (WebCore::ResourceLoadObserver::logSubresourceLoading):
525         (WebCore::ResourceLoadObserver::logWebSocketLoading):
526         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
527         (WebCore::reduceToHourlyTimeResolution): Deleted.
528         * page/RuntimeEnabledFeatures.h:
529         (WebCore::RuntimeEnabledFeatures::setResourceLoadStatisticsDebugMode):
530         (WebCore::RuntimeEnabledFeatures::resourceLoadStatisticsDebugMode const):
531         * page/Settings.yaml:
532
533 2018-01-29  Oleksandr Skachkov  <gskachkov@gmail.com>
534
535         FetchResponse should support ConsumeData callback on chunk data is received: handling ReadableStream bodies
536         https://bugs.webkit.org/show_bug.cgi?id=182008
537
538         Reviewed by Youenn Fablet.
539
540         Modify FetchResponse to support ConsumeData callback with 
541         handling of ReadableStream by chunks
542
543         * Modules/cache/DOMCache.cpp:
544         (WebCore::DOMCache::put):
545         * Modules/fetch/FetchBodyConsumer.cpp:
546         (WebCore::FetchBodyConsumer::resolve):
547         * Modules/fetch/FetchResponse.cpp:
548         (WebCore::FetchResponse::consumeBodyFromReadableStream):
549         * Modules/fetch/FetchResponse.h:
550         * Modules/streams/ReadableStreamChunk.h: Added.
551         * Modules/streams/ReadableStreamSink.cpp:
552         (WebCore::ReadableStreamToSharedBufferSink::enqueue):
553         (WebCore::ReadableStreamToSharedBufferSink::close):
554         * Modules/streams/ReadableStreamSink.h:
555         * WebCore.xcodeproj/project.pbxproj:
556         * workers/service/context/ServiceWorkerFetch.cpp:
557         (WebCore::ServiceWorkerFetch::processResponse):
558
559 2018-01-29  Andy Estes  <aestes@apple.com>
560
561         [iOS] Restrict synthetic clicks to the origin that handled the underlying touch event
562         https://bugs.webkit.org/show_bug.cgi?id=182252
563         <rdar://problem/21555881>
564
565         Reviewed by Tim Horton.
566
567         Test: http/tests/events/touch/ios/cross-frame-single-tap-same-origin.https.html
568
569         * dom/Document.h:
570         (WebCore::Document::handlingTouchEvent const):
571         * page/EventHandler.h:
572         (WebCore::EventHandler::touchEventTargetSubframe const):
573         (WebCore::EventHandler::touches const):
574
575         Exposed some information needed by WebPage::updatePotentialTapSecurityOrigin().
576
577         * page/Frame.h:
578         * page/ios/FrameIOS.mm:
579         (WebCore::Frame::betterApproximateNode):
580         (WebCore::Frame::qualifyingNodeAtViewportLocation):
581
582         Changed NodeQualifier from a function pointer to a WTF::Function.
583
584         (WebCore::Frame::nodeRespondingToClickEvents):
585
586         Turned ancestorRespondingToClickEvents() into a lambda that captures originRestriction. In
587         the lambda, if there is an origin restriction, return nullptr if the hit test result's inner
588         Node is not in the restricted origin.
589
590         (WebCore::Frame::nodeRespondingToScrollWheelEvents):
591
592         Turned ancestorRespondingToScrollWheelEvents() into a lambda.
593
594         (WebCore::ancestorRespondingToScrollWheelEvents):
595
596         Moved to lambda in nodeRespondingToScrollWheelEvents().
597
598         (WebCore::ancestorRespondingToClickEvents):
599
600         Moved to lambda in nodeRespondingToClickEvents().
601
602 2018-01-29  Emilio Cobos Álvarez  <emilio@crisal.io>
603
604         Trivially cleanup std::optional usage in RenderBlockFlow.
605         https://bugs.webkit.org/show_bug.cgi?id=182142
606
607         Reviewed by Antti Koivisto.
608
609         No new tests, no behavior change.
610
611         * rendering/RenderBlockFlow.cpp:
612         (WebCore::RenderBlockFlow::firstLineBaseline const):
613         (WebCore::RenderBlockFlow::inlineBlockBaseline const):
614
615 2018-01-29  Brent Fulgham  <bfulgham@apple.com>
616
617         Add telemetry to track storage access API adoption
618         https://bugs.webkit.org/show_bug.cgi?id=182197
619         <rdar://problem/35803309>
620
621         Reviewed by Chris Dumez.
622         
623         Part 1: Add telemetry for the user interaction case
624         
625         This patch adds telemetry to track how frequently third-party cookies are
626         used in a first party context due to user interaction. This will help
627         understand cases where the new Storage Access API can help, and to help
628         us understand if we have considered relevant use cases in its design.
629
630         * loader/ResourceLoadObserver.cpp:
631         (WebCore::ResourceLoadObserver::setTimeToLivePartitionFree): Let the observer
632         know the first party interaction duration.
633         (WebCore::ResourceLoadObserver::wasAccessedWithinInteractionWindow const): Added.
634         (WebCore::ResourceLoadObserver::logFrameNavigation): Note when a third party 
635         resource is accessed as a first party due to user interaction. 
636         (WebCore::ResourceLoadObserver::logSubresourceLoading): Ditto.
637         * loader/ResourceLoadObserver.h:
638         * loader/ResourceLoadStatistics.cpp:
639         (WebCore::ResourceLoadStatistics::encode const): Handle new fields.
640         (WebCore::ResourceLoadStatistics::decode): Ditto.
641         * loader/ResourceLoadStatistics.h:
642
643 2018-01-29  Antti Koivisto  <antti@apple.com>
644
645         CalcExpressionBlendLength::evaluate hits stack limit
646         https://bugs.webkit.org/show_bug.cgi?id=182243
647
648         Reviewed by Zalan Bujtas.
649
650         Speculative fix to prevent nesting of CalcExpressionBlendLength.
651
652         No test, don't know how to make one.
653
654         * platform/CalculationValue.cpp:
655         (WebCore::CalcExpressionBlendLength::CalcExpressionBlendLength):
656
657         CalcExpressionBlendLength is only used in Length values of animated style. Normally such styles are not used
658         as input for further blending but there are some paths where this could in principle happen. Repeated
659         application (for each animation frame) could construct CalcExpressionBlendLength expression that blows
660         the stack when evaluated.
661
662         Speculatively fix by flattening any nesting.
663
664         * platform/CalculationValue.h:
665         (WebCore::CalcExpressionBlendLength::CalcExpressionBlendLength): Deleted.
666
667 2018-01-29  Chris Dumez  <cdumez@apple.com>
668
669         Drop unnecessary "ServiceWorker Task Thread" in SWServer
670         https://bugs.webkit.org/show_bug.cgi?id=182253
671
672         Reviewed by Youenn Fablet.
673
674         Drop unnecessary "ServiceWorker Task Thread" in SWServer. We're spinning a thread for
675         each SWServer that is never used.
676
677         * workers/service/server/SWServer.cpp:
678         (WebCore::SWServer::~SWServer):
679         (WebCore::SWServer::SWServer):
680         (WebCore::SWServer::taskThreadEntryPoint): Deleted.
681         (WebCore::SWServer::postTask): Deleted.
682         (WebCore::SWServer::postTaskReply): Deleted.
683         (WebCore::SWServer::handleTaskRepliesOnMainThread): Deleted.
684         * workers/service/server/SWServer.h:
685
686 2018-01-29  Matt Lewis  <jlewis3@apple.com>
687
688         Unreviewed, rolling out r227731.
689
690         This caused and assertion failure in API tests.
691
692         Reverted changeset:
693
694         "Layout Test fast/events/beforeunload-dom-manipulation-
695         crash.html is crashing"
696         https://bugs.webkit.org/show_bug.cgi?id=181204
697         https://trac.webkit.org/changeset/227731
698
699 2018-01-29  Brady Eidson  <beidson@apple.com>
700
701         Make it possible for apps that use both WK1 and WK2 to use MessagePorts.
702         https://bugs.webkit.org/show_bug.cgi?id=182229
703
704         Reviewed by Chris Dumez.
705
706         Covered by existing LayoutTests and a new API test.
707
708         * dom/messageports/MessagePortChannel.cpp:
709         (WebCore::MessagePortChannel::checkRemotePortForActivity): Don't use the global singleton
710           provider. Instead use the provider that belongs to the owning registry.
711
712         * dom/messageports/MessagePortChannelProviderImpl.cpp:
713         (WebCore::MessagePortChannelProviderImpl::MessagePortChannelProviderImpl): Pass a reference
714           to *this to the Registry.
715         * dom/messageports/MessagePortChannelProviderImpl.h:
716
717         * dom/messageports/MessagePortChannelRegistry.cpp:
718         (WebCore::MessagePortChannelRegistry::MessagePortChannelRegistry): Keep a Provider member so
719           MessagePortChannels can get to it instead of relying on the global singleton provider.
720         * dom/messageports/MessagePortChannelRegistry.h:
721         (WebCore::MessagePortChannelRegistry::provider):
722
723 2018-01-29  Per Arne Vollan  <pvollan@apple.com>
724
725         Layout Test fast/events/beforeunload-dom-manipulation-crash.html is crashing
726         https://bugs.webkit.org/show_bug.cgi?id=181204
727         <rdar://problem/36256274>
728
729         Reviewed by Ryosuke Niwa.
730
731         When a frame element is moved in the DOM tree during the execution of a beforeunload handler,
732         the frame will be detached when removed from its previous position in the DOM tree. When being
733         detached, an attempt will also be made to stop the load by calling FrameLoader::stopAllLoaders().
734         However, this method will return early when executed in a beforeunload handler, since navigation
735         is not allowed then. The end result is a detached frame which will continue to load, and hitting
736         asserts in DocumentLoader::dataReceived(), and DocumentLoader::notifyFinished(). It should be
737         possible to stop a frame load, even when executing a beforeunload handler.
738
739         No new tests. Covered by the existing test fast/events/beforeunload-dom-manipulation-crash.html.
740
741         * loader/FrameLoader.cpp:
742         (WebCore::FrameLoader::isStopLoadingAllowed const):
743         (WebCore::FrameLoader::stopAllLoaders):
744         * loader/FrameLoader.h:
745
746 2018-01-29  Miguel Gomez  <magomez@igalia.com>
747
748         [CoordnatedGraphics] A child layer of a semitransparent layer isn't clipped properly
749         https://bugs.webkit.org/show_bug.cgi?id=181080
750
751         Reviewed by Žan Doberšek.
752
753         Check whether the applied clipping area is empty before drawing the children of a TextureMapperLayer. If
754         the area is empty no children will be drawn, so we can avoid drawing them.
755
756         No new tests -- no change in behavior.
757
758         * platform/graphics/texmap/TextureMapperLayer.cpp:
759         (WebCore::TextureMapperLayer::paintSelfAndChildren):
760
761 2018-01-29  Zan Dobersek  <zdobersek@igalia.com>
762
763         [Cairo] Add GraphicsContextImplCairo::createFactory() helpers
764         https://bugs.webkit.org/show_bug.cgi?id=182238
765
766         Reviewed by Carlos Garcia Campos.
767
768         Instead of duplicating lambdas that return a newly-created
769         GraphicsContextImplCairo object, provide static createFactory() helpers
770         on that class that produce GraphicsContextImplFactory wrappers which are
771         then invoked in the GraphicsContext constructor. The static functions
772         accept either the PlatformContextCairo reference or the cairo_t pointer,
773         invoking the proper GraphicsContextImplCairo constructor in the returned
774         lambda wrapper.
775
776         No new tests -- no change in functionality.
777
778         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
779         (WebCore::GraphicsContextImplCairo::createFactory):
780         * platform/graphics/cairo/GraphicsContextImplCairo.h:
781         * platform/graphics/cairo/ImageBufferCairo.cpp:
782         (WebCore::ImageBuffer::ImageBuffer):
783         * platform/graphics/cairo/PathCairo.cpp:
784         (WebCore::Path::strokeBoundingRect const):
785         (WebCore::Path::strokeContains const):
786         * platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp:
787         (Nicosia::PaintingContextCairo::PaintingContextCairo):
788         * platform/graphics/win/ImageCairoWin.cpp:
789         (WebCore::BitmapImage::getHBITMAPOfSize):
790
791 2018-01-29  Zan Dobersek  <zdobersek@igalia.com>
792
793         Construct GraphicsContext with NonPaintingReasons::NoReason in FrameView::adjustPageHeightDeprecated()
794         https://bugs.webkit.org/show_bug.cgi?id=182235
795
796         Reviewed by Carlos Garcia Campos.
797
798         Pass the NonPaintingReasons::NoReason value to the GraphicsContext
799         constructor in FrameView::adjustPageHeightDeprecated(). This has the
800         same effect as when passing a null PlatformGraphicsContext to the
801         constructor, which effectively disables any painting through that
802         GraphicsContext, but doesn't have a platform-specific connotation.
803
804         No new tests -- no change in functionality.
805
806         * page/FrameView.cpp:
807         (WebCore::FrameView::adjustPageHeightDeprecated):
808
809 2018-01-29  Zan Dobersek  <zdobersek@igalia.com>
810
811         [Cairo] Remove the GraphicsContext(cairo_t*) constructor
812         https://bugs.webkit.org/show_bug.cgi?id=182234
813
814         Reviewed by Carlos Garcia Campos.
815
816         Instead of using the GraphicsContext(cairo_t*) constructor, leverage the
817         GraphicsContextImplCairo class and work with an existing Cairo context
818         through that GraphicsContextImpl implementation.
819
820         A new GraphicsContextImplCairo constructor is added, expecting pointer
821         to the cairo_t object. With that, a PlatformContextCairo object is
822         created, with ownership of that object now being handled by the
823         GraphicsContextImplCairo class.
824
825         Call sites of the GraphicsContext(cairo_t*) constructor are adjusted to
826         instead provide a factory function that returns a fresh
827         GraphicsContextImplCairo object, passing that cairo_t object to its
828         constructor.
829
830         No new tests -- no change in behavior.
831
832         * platform/graphics/GraphicsContext.h:
833         * platform/graphics/cairo/GraphicsContextCairo.cpp:
834         (WebCore::GraphicsContext::GraphicsContext): Deleted.
835         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
836         (WebCore::GraphicsContextImplCairo::GraphicsContextImplCairo):
837         (WebCore::m_private):
838         * platform/graphics/cairo/GraphicsContextImplCairo.h:
839         * platform/graphics/cairo/PathCairo.cpp:
840         (WebCore::Path::strokeBoundingRect const):
841         (WebCore::Path::strokeContains const):
842         * platform/graphics/win/ImageCairoWin.cpp:
843         (WebCore::BitmapImage::getHBITMAPOfSize):
844
845 2018-01-28  Minsheng Liu  <lambda@liu.ms>
846
847         Overflow of formulas is hidden for display mathematics
848         https://bugs.webkit.org/show_bug.cgi?id=160547
849
850         Reviewed by Frédéric Wang.
851
852         Previously, <math> with display="block" uses its container's logical width as logical width.
853         However, that behavior will truncate overflowed contents. The patch fixes it by setting
854         the logical width as its content width rather than its container's logical width
855         if the former is wider than the latter.
856
857         Test: mathml/presentation/display-math-horizontal-overflow.html
858
859         * rendering/mathml/RenderMathMLRow.cpp:
860         (WebCore::RenderMathMLRow::layoutBlock):
861
862 2018-01-26  Antoine Quint  <graouts@apple.com>
863
864         [Web Animations] Distinguish between an omitted and a null timeline argument to the Animation constructor
865         https://bugs.webkit.org/show_bug.cgi?id=179065
866         <rdar://problem/36869046>
867
868         Reviewed by Dean Jackson.
869
870         The Web Animations specification requires that a missing or undefined "timeline" parameter means that the
871         document's timeline should be used, but a null value should be supported. To support this, we need to provide
872         a custom Animation constructor where we can check on the ExecState whether the second argument passed is
873         undefined, which is true if an explicit "undefined" value is passed or if the argument does not exist.
874
875         * Sources.txt: Add the new JSWebAnimationCustom.cpp file.
876         * WebCore.xcodeproj/project.pbxproj: Add the new JSWebAnimationCustom.cpp file.
877         * animation/WebAnimation.cpp:
878         (WebCore::WebAnimation::create): Add a create() variant that doesn't provide an AnimationTimeline parameter
879         to clearly indicate that the provided Document's timeline should be used.
880         * animation/WebAnimation.h:
881         * animation/WebAnimation.idl:
882         * bindings/js/JSWebAnimationCustom.cpp: Added.
883         (WebCore::constructJSWebAnimation): Provide a custom Animation constructor where we check whether the second
884         argument, the timeline, is undefined.
885         * dom/Element.cpp:
886         (WebCore::Element::animate): Use the new create() variant since passing "nullptr" now means a null timeline.
887
888 2018-01-26  Ricky Mondello  <rmondello@apple.com>
889
890         Use the standard -webkit-autofill color on iOS
891         https://bugs.webkit.org/show_bug.cgi?id=182182
892
893         Reviewed by Tim Horton.
894
895         * css/html.css:
896         (input:-webkit-autofill, input:-webkit-autofill-strong-password):
897
898 2018-01-26  Dean Jackson  <dino@apple.com>
899
900         REGRESSION (r222961): Clear function not clearing whole screen when antialias is set to false
901         https://bugs.webkit.org/show_bug.cgi?id=179368
902         <rdar://problem/36111549>
903
904         Reviewed by Sam Weinig.
905
906         When we changed from using a CAOpenGLLayer to a regular CALayer, we should
907         have also swapped the "opaque" property to "contentsOpaque".
908
909         Covered by the existing test: fast/canvas/webgl/context-attributes-alpha.html
910         (when run on some hardware!)
911
912         * platform/graphics/cocoa/WebGLLayer.mm:
913         (-[WebGLLayer initWithGraphicsContext3D:]):
914
915 2018-01-26  Mark Lam  <mark.lam@apple.com>
916
917         Add infrastructure for pointer preparation.
918         https://bugs.webkit.org/show_bug.cgi?id=182191
919         <rdar://problem/36889194>
920
921         Reviewed by JF Bastien.
922
923         No new tests because this patch does not introduce any behavior change.
924
925         * bindings/scripts/CodeGeneratorJS.pm:
926         (GenerateImplementation):
927         * bindings/scripts/test/JS/JSInterfaceName.cpp:
928         (WebCore::toJSNewlyCreated):
929         * bindings/scripts/test/JS/JSMapLike.cpp:
930         (WebCore::toJSNewlyCreated):
931         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
932         (WebCore::toJSNewlyCreated):
933         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
934         (WebCore::toJSNewlyCreated):
935         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
936         (WebCore::toJSNewlyCreated):
937         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
938         (WebCore::toJSNewlyCreated):
939         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
940         (WebCore::toJSNewlyCreated):
941         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
942         (WebCore::toJSNewlyCreated):
943         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
944         (WebCore::toJSNewlyCreated):
945         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
946         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
947         (WebCore::toJSNewlyCreated):
948         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
949         (WebCore::toJSNewlyCreated):
950         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
951         (WebCore::toJSNewlyCreated):
952         * bindings/scripts/test/JS/JSTestException.cpp:
953         (WebCore::toJSNewlyCreated):
954         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
955         (WebCore::toJSNewlyCreated):
956         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
957         (WebCore::toJSNewlyCreated):
958         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
959         (WebCore::toJSNewlyCreated):
960         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
961         (WebCore::toJSNewlyCreated):
962         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
963         (WebCore::toJSNewlyCreated):
964         * bindings/scripts/test/JS/JSTestInterface.cpp:
965         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
966         * bindings/scripts/test/JS/JSTestIterable.cpp:
967         (WebCore::toJSNewlyCreated):
968         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
969         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
970         (WebCore::toJSNewlyCreated):
971         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
972         (WebCore::toJSNewlyCreated):
973         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
974         (WebCore::toJSNewlyCreated):
975         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
976         (WebCore::toJSNewlyCreated):
977         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
978         (WebCore::toJSNewlyCreated):
979         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
980         (WebCore::toJSNewlyCreated):
981         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
982         (WebCore::toJSNewlyCreated):
983         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
984         (WebCore::toJSNewlyCreated):
985         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
986         (WebCore::toJSNewlyCreated):
987         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
988         (WebCore::toJSNewlyCreated):
989         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
990         (WebCore::toJSNewlyCreated):
991         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
992         (WebCore::toJSNewlyCreated):
993         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
994         (WebCore::toJSNewlyCreated):
995         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
996         (WebCore::toJSNewlyCreated):
997         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
998         (WebCore::toJSNewlyCreated):
999         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
1000         (WebCore::toJSNewlyCreated):
1001         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
1002         (WebCore::toJSNewlyCreated):
1003         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
1004         (WebCore::toJSNewlyCreated):
1005         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
1006         (WebCore::toJSNewlyCreated):
1007         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
1008         (WebCore::toJSNewlyCreated):
1009         * bindings/scripts/test/JS/JSTestNode.cpp:
1010         (WebCore::toJSNewlyCreated):
1011         * bindings/scripts/test/JS/JSTestObj.cpp:
1012         (WebCore::toJSNewlyCreated):
1013         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1014         (WebCore::toJSNewlyCreated):
1015         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1016         (WebCore::toJSNewlyCreated):
1017         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1018         (WebCore::toJSNewlyCreated):
1019         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
1020         (WebCore::toJSNewlyCreated):
1021         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
1022         (WebCore::toJSNewlyCreated):
1023         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1024         (WebCore::toJSNewlyCreated):
1025         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp:
1026         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
1027         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
1028         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1029         (WebCore::toJSNewlyCreated):
1030         * bindings/scripts/test/JS/JSTestStringifier.cpp:
1031         (WebCore::toJSNewlyCreated):
1032         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
1033         (WebCore::toJSNewlyCreated):
1034         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
1035         (WebCore::toJSNewlyCreated):
1036         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
1037         (WebCore::toJSNewlyCreated):
1038         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
1039         (WebCore::toJSNewlyCreated):
1040         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
1041         (WebCore::toJSNewlyCreated):
1042         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
1043         (WebCore::toJSNewlyCreated):
1044         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1045         (WebCore::toJSNewlyCreated):
1046
1047 2018-01-26  Simon Fraser  <simon.fraser@apple.com>
1048
1049         REGRESSiON (r226492): Crash under Element::absoluteEventBounds() on a SVGPathElement which has not been laid out yet
1050         https://bugs.webkit.org/show_bug.cgi?id=182185
1051         rdar://problem/36836262
1052
1053         Reviewed by Zalan Bujtas.
1054
1055         Document::absoluteRegionForEventTargets() can fire when layout is dirty, and SVGPathElement's path() can be null if it
1056         hasn't been laid out yet. So protect against a null path in getBBox().
1057
1058         Not easily testable because internals.nonFastScrollableRects() forces layout, and the crash depends on the timing of
1059         absoluteRegionForEventTargets().
1060
1061         * svg/SVGPathElement.cpp:
1062         (WebCore::SVGPathElement::getBBox):
1063
1064 2018-01-26  Chris Dumez  <cdumez@apple.com>
1065
1066         Offlined content does not work for apps on home screen
1067         https://bugs.webkit.org/show_bug.cgi?id=182070
1068         <rdar://problem/36843906>
1069
1070         Reviewed by Youenn Fablet.
1071
1072         Already registered service workers were unable to intercept the very first
1073         load because registration matching was happening after the registration
1074         was loaded from disk, but *before* its active worker was populated.
1075
1076         We now initialize the registrations' active worker as soon as we load
1077         them from disk. We do not necessarily have a SW Context process connection
1078         identifier yet at this point so I made it optional on the SWServerWorker.
1079         This identifier gets set on the SWServerWorker when the worker is actually
1080         launched and gets cleared when the SWServerWorker gets terminated.
1081
1082         Covered by new API test.
1083
1084         * workers/service/server/SWServer.cpp:
1085         (WebCore::SWServer::addRegistrationFromStore):
1086         (WebCore::SWServer::installContextData):
1087         (WebCore::SWServer::terminateWorkerInternal):
1088         (WebCore::SWServer::workerContextTerminated):
1089         (WebCore::SWServer::fireInstallEvent):
1090         (WebCore::SWServer::fireActivateEvent):
1091         * workers/service/server/SWServerWorker.cpp:
1092         (WebCore::SWServerWorker::SWServerWorker):
1093         * workers/service/server/SWServerWorker.h:
1094         (WebCore::SWServerWorker::contextConnectionIdentifier const):
1095         (WebCore::SWServerWorker::setContextConnectionIdentifier):
1096
1097 2018-01-26  Chris Nardi  <cnardi@chromium.org>
1098
1099         Addressing post-review comments after r226614
1100         https://bugs.webkit.org/show_bug.cgi?id=182151
1101
1102         Reviewed by Myles C. Maxfield.
1103
1104         * html/HTMLTextAreaElement.cpp:
1105         (WebCore::HTMLTextAreaElement::sanitizeUserInputValue):
1106         * html/TextFieldInputType.cpp:
1107         (WebCore::limitLength):
1108         * platform/LocalizedStrings.cpp:
1109         (WebCore::truncatedStringForLookupMenuItem):
1110         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
1111         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
1112
1113 2018-01-26  Antoine Quint  <graouts@apple.com>
1114
1115         [iOS] prefers-reduced-motion media query is not working
1116         https://bugs.webkit.org/show_bug.cgi?id=182169
1117         <rdar://problem/36801631>
1118
1119         Reviewed by Dean Jackson.
1120
1121         The code that would eventually query UIKit for the system setting was not run since USE(NEW_THEME) is off on iOS.
1122         Adding a PLATFORM(IOS) flag here allows the code to run.
1123
1124         * css/MediaQueryEvaluator.cpp:
1125         (WebCore::prefersReducedMotionEvaluate):
1126
1127 2018-01-26  Youenn Fablet  <youenn@apple.com>
1128
1129         CSP post checks should be done for service worker responses
1130         https://bugs.webkit.org/show_bug.cgi?id=182160
1131
1132         Reviewed by Daniel Bates.
1133
1134         Covered by updated test.
1135
1136         Add security checks when receiving a service worker response.
1137
1138         * loader/SubresourceLoader.cpp:
1139         (WebCore::SubresourceLoader::didReceiveResponse):
1140         * loader/cache/CachedResourceLoader.h:
1141
1142 2018-01-26  Manuel Rego Casasnovas  <rego@igalia.com>
1143
1144         [css-multicol] Support percentages in column-gap
1145         https://bugs.webkit.org/show_bug.cgi?id=182004
1146
1147         Reviewed by Javier Fernandez.
1148
1149         This patch adds percentage support to column-gap property.
1150
1151         Most of the changes are related to the parsing logic,
1152         the column-gap property now accepts both length and percentages,
1153         on top of the "normal" initial value.
1154         A new utility class GapLength has been added, as it'll be useful
1155         to implement row-gap in the future.
1156
1157         Apart from that the muticolumn layout code has been modified
1158         to resolve the percentage gaps (treating them as zero while computing
1159         preferred widths) and resolving them during layout.
1160         This doesn't follow the current text on the spec, but there is an
1161         ongoing discussion that might cause the text is changed:
1162         https://github.com/w3c/csswg-drafts/issues/509#issuecomment-355242101
1163         We could update the implementation once we have a definitive answer
1164         from the CSS WG.
1165
1166         Test: web-platform-tests/css/css-multicol/multicol-gap-percentage-001.html
1167
1168         * Sources.txt:
1169         * WebCore.xcodeproj/project.pbxproj:
1170         * css/CSSComputedStyleDeclaration.cpp:
1171         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
1172         * css/CSSProperties.json:
1173         * css/StyleBuilderConverter.h:
1174         (WebCore::StyleBuilderConverter::convertGapLength):
1175         * css/StyleBuilderCustom.h:
1176         (WebCore::forwardInheritedValue):
1177         * css/parser/CSSPropertyParser.cpp:
1178         (WebCore::consumeGapLength):
1179         (WebCore::CSSPropertyParser::parseSingleValue):
1180         * page/FrameView.cpp:
1181         (WebCore::FrameView::applyPaginationToViewport):
1182         * page/animation/CSSPropertyAnimation.cpp:
1183         (WebCore::blendFunc):
1184         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
1185         * rendering/RenderBlockFlow.cpp:
1186         (WebCore::RenderBlockFlow::columnGap const):
1187         * rendering/RenderMultiColumnSet.cpp:
1188         (WebCore::RenderMultiColumnSet::columnGap const):
1189         * rendering/style/GapLength.cpp: Added.
1190         (WebCore::operator<<):
1191         * rendering/style/GapLength.h: Added.
1192         (WebCore::GapLength::GapLength):
1193         (WebCore::GapLength::isNormal const):
1194         (WebCore::GapLength::length const):
1195         (WebCore::GapLength::operator== const):
1196         * rendering/style/RenderStyle.h:
1197         (WebCore::RenderStyle::columnGap const):
1198         (WebCore::RenderStyle::setColumnGap):
1199         (WebCore::RenderStyle::initialColumnGap):
1200         * rendering/style/StyleMultiColData.cpp:
1201         (WebCore::StyleMultiColData::StyleMultiColData):
1202         (WebCore::StyleMultiColData::operator== const):
1203         * rendering/style/StyleMultiColData.h:
1204         * style/StyleResolveForDocument.cpp:
1205         (WebCore::Style::resolveForDocument):
1206
1207 2018-01-26  Emilio Cobos Álvarez  <emilio@crisal.io>
1208
1209         Remove unused RenderFragmentedFlow::createFragmentedFlowStyle.
1210         https://bugs.webkit.org/show_bug.cgi?id=182138
1211
1212         Reviewed by Manuel Rego Casasnovas.
1213
1214         Has no callers.
1215
1216         No new tests, just removes unused code so no behavior change.
1217
1218         * rendering/RenderFragmentedFlow.cpp:
1219         * rendering/RenderFragmentedFlow.h:
1220
1221 2018-01-26  Emilio Cobos Álvarez  <emilio@crisal.io>
1222
1223         Remove useless RenderBlockFlow overrides.
1224         https://bugs.webkit.org/show_bug.cgi?id=182139
1225
1226         Reviewed by Manuel Rego Casasnovas.
1227
1228         I think these are leftovers from the CSS regions removal, looking at
1229         blame.
1230
1231         No new tests, no behavior change.
1232
1233         * rendering/RenderBlockFlow.cpp:
1234         * rendering/RenderBlockFlow.h:
1235
1236 2018-01-25  Joseph Pecoraro  <pecoraro@apple.com>
1237
1238         Web Inspector: Add InspectorShaderProgram to Unified Sources build
1239         https://bugs.webkit.org/show_bug.cgi?id=182084
1240
1241         Reviewed by Dan Bernstein.
1242
1243         * CMakeLists.txt:
1244         * WebCore.xcodeproj/project.pbxproj:
1245         * Sources.txt:
1246         Move to Sources.txt always.
1247
1248         * inspector/InspectorShaderProgram.cpp:
1249         Add ENABLE(WEBGL) guard to contents.
1250
1251 2018-01-25  Ryosuke Niwa  <rniwa@webkit.org>
1252
1253         Make scrolling to the focused element async
1254         https://bugs.webkit.org/show_bug.cgi?id=181575
1255         <rdar://problem/36459767>
1256
1257         Reviewed by Simon Fraser.
1258
1259         Made the revealing of the focused element asynchronous in Element::focus. Like selection, schedule a timer when
1260         a new element is focused, and only scroll to the focused element when the timer fires. If any other scrolling
1261         happens meanwhile, we cancel this timer.
1262
1263         There are two Web exposed behavioral changes:
1264         1. The scrolling position doesn't change immediately when calling Element::focus.
1265         2. Only the last focused element will be revealed.
1266
1267         Both behavioral changes pose its own compatibility risks but we're making a conscious decision here since
1268         the scrolling asynchronous has a clear performance benefit.
1269
1270         There is one edge case to cosnider: when the history controller restores the scrolling position, canceling the
1271         timer results in a focused element in an overflow: hidden element to be never revealed. Expediate revealing of
1272         the focused element in this one case instead of canceling.
1273
1274         Tests: fast/scrolling/scroll-to-focused-element-asynchronously.html
1275                fast/scrolling/scroll-to-focused-element-canceled-by-fragment-navigation.html
1276
1277         * dom/Element.cpp:
1278         (WebCore::Element::focus): Call updateFocusAppearance on focusAppearanceUpdateTarget to handle HTMLAreaElement
1279         which delegates the focus appearance update to its image element.
1280         (WebCore::Element::focusAppearanceUpdateTarget): Extracted. Returns "this" element for all but HTMLAreaElement.
1281         (WebCore::Element::updateFocusAppearance): Schedule the revealing of the focused element in FrameView instead of
1282         synchronously scrolling to the focused element.
1283         * dom/Element.h:
1284         (WebCore::Element::defaultFocusTextStateChangeIntent):
1285         * html/HTMLAreaElement.cpp:
1286         (WebCore::HTMLAreaElement::focusAppearanceUpdateTarget): Extracted from updateFocusAppearance.
1287         (WebCore::HTMLAreaElement::updateFocusAppearance): Deleted.
1288         * html/HTMLAreaElement.h:
1289         * loader/HistoryController.cpp:
1290         (WebCore::HistoryController::restoreScrollPositionAndViewState): Reveal the focused element
1291         prior to restoring the scrolling location of the fragment navigation. This is needed to reveal a focused element
1292         inside overflow: hidden element which got focused.
1293         * page/FrameView.cpp:
1294         (WebCore::FrameView::FrameView): Added a boolean flag and a timer for scrolling to the focused element.
1295         (WebCore::FrameView::reset): Stop the timer and clear the flag.
1296         (WebCore::FrameView::maintainScrollPositionAtAnchor): Ditto when scrolling to an anchor.
1297         (WebCore::FrameView::setScrollPosition): Ditto when some other programatic scroll or the user scrolls the view.
1298         (WebCore::FrameView::scheduleScrollToFocusedElement): Added.
1299         (WebCore::FrameView::scrollToFocusedElementImmediatelyIfNeeded): Added.
1300         (WebCore::FrameView::scrollToFocusedElementTimerFired): Added.
1301         (WebCore::FrameView::scrollToAnchor): Stop the timer and clear the flag when scrolling to an achor.
1302         (WebCore::FrameView::setWasScrolledByUser): Ditto when the user scrolls.
1303         * page/FrameView.h:
1304
1305 2018-01-25  Said Abou-Hallawa  <sabouhallawa@apple.com>
1306
1307         REGRESSION(r217236): [iOS] PDFDocumentImage does not update its cached ImageBuffer if it has a sub-rectangle of the image
1308         https://bugs.webkit.org/show_bug.cgi?id=182083
1309
1310         Reviewed by Simon Fraser.
1311
1312         Test: fast/images/pdf-as-image-dest-rect-change.html
1313
1314         Revert the change r217236 back. Fix the issue of throwing out the cached
1315         ImageBuffer of the PDF document image when moving its rectangle.
1316
1317         * platform/graphics/cg/PDFDocumentImage.cpp:
1318         (WebCore::PDFDocumentImage::cacheParametersMatch): Return the if-statement
1319         which was deleted in r217236 back but intersect it with dstRect. The context
1320         clipping rectangle can be more than the dstRect.
1321         (WebCore::PDFDocumentImage::updateCachedImageIfNeeded):
1322         -- Remove a wrong optimization which used to work for Mac only if the context
1323            interpolation quality is not set to low or none quality. This optimization
1324            does not consider the case when srcRect or destRect change after caching
1325            the ImageBuffer. Or even if m_cachedImageRect does not include the
1326            whole clipping rectangle.
1327         -- Move back the call to cacheParametersMatch() before changing the
1328            m_cachedImageRect.
1329         -- Always intersect the clipping rectangle with the dstRect to ensure we
1330            only look at the dirty rectangle inside the image boundary.
1331         -- If cacheParametersMatch() returns true, set m_cachedDestinationRect to
1332            dstRect and move m_cachedImageRect by the difference between the new
1333            and the old dstRects since no re-caching will happen.
1334         * platform/graphics/cg/PDFDocumentImage.h:
1335         * testing/Internals.cpp:
1336         (WebCore::pdfDocumentImageFromImageElement):
1337         (WebCore::Internals::pdfDocumentCachingCount):
1338         * testing/Internals.h:
1339         * testing/Internals.idl:
1340         Add an internal API which returns the number of drawing the PDF into an
1341         ImageBuffer.
1342
1343 2018-01-25  Joseph Pecoraro  <pecoraro@apple.com>
1344
1345         Web Inspector: Remove unnecessary developerExtrasEnabled checks
1346         https://bugs.webkit.org/show_bug.cgi?id=182156
1347
1348         Reviewed by Matt Baker.
1349
1350         * inspector/InspectorInstrumentation.cpp:
1351         (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl):
1352         (WebCore::InspectorInstrumentation::frameDocumentUpdatedImpl):
1353         (WebCore::InspectorInstrumentation::didCreateWebSocketImpl):
1354         These checks should not be needed. The step above bails if there is
1355         no inspector frontend, and there can be no inspector frontend unless
1356         developer extras enabled are enabled.
1357
1358 2018-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
1359
1360         Add localizable strings for extra-zoomed form controls
1361         https://bugs.webkit.org/show_bug.cgi?id=182080
1362
1363         Reviewed by Tim Horton.
1364
1365         Add new localizable strings. Additionally, run `update-webkit-localizable-strings` to re-sort
1366         Localizable.strings.
1367
1368         * English.lproj/Localizable.strings:
1369         * platform/LocalizedStrings.cpp:
1370         (WebCore::formControlCancelButtonTitle):
1371         (WebCore::formControlHideButtonTitle):
1372         (WebCore::formControlGoButtonTitle):
1373         (WebCore::formControlSearchButtonTitle):
1374         (WebCore::textInputModeWriteButton):
1375         (WebCore::textInputModeSpeechButton):
1376         * platform/LocalizedStrings.h:
1377
1378 2018-01-25  Chris Dumez  <cdumez@apple.com>
1379
1380         Access to service workers / Cache API should be disabled in sandboxed frames without allow-same-origin flag
1381         https://bugs.webkit.org/show_bug.cgi?id=182140
1382         <rdar://problem/36879952>
1383
1384         Reviewed by Youenn Fablet.
1385
1386         Throw a SecurityError when accessing navigator.serviceWorker or window.caches inside a sandboxed iframe
1387         without the allow-same-origin flag. This behavior is consistent with Chrome. Firefox, however, seems
1388         to return these objects but have their API reject promises with a SecurityError instead.
1389
1390         No new tests, rebaselined existing tests.
1391
1392         * Modules/cache/DOMWindowCaches.cpp:
1393         (WebCore::DOMWindowCaches::caches): Deleted.
1394         * Modules/cache/DOMWindowCaches.h:
1395         * Modules/cache/DOMWindowCaches.idl:
1396         * page/NavigatorBase.cpp:
1397         * page/NavigatorBase.h:
1398         * page/NavigatorServiceWorker.idl:
1399
1400 2018-01-25  Chris Dumez  <cdumez@apple.com>
1401
1402         Clients.get(id) should only returns clients in the service worker's origin
1403         https://bugs.webkit.org/show_bug.cgi?id=182149
1404         <rdar://problem/36882310>
1405
1406         Reviewed by Youenn Fablet.
1407
1408         When looking for SW clients with a given identifier, only look in the list of
1409         clients that have the same origin as the service worker.
1410
1411         No new tests, rebaselined existing test.
1412
1413         * workers/service/server/SWServer.cpp:
1414         (WebCore::SWServer::serviceWorkerClientWithOriginByID const):
1415         (WebCore::SWServer::serviceWorkerClientByID const): Deleted.
1416         * workers/service/server/SWServer.h:
1417         * workers/service/server/SWServerWorker.cpp:
1418         (WebCore::SWServerWorker::findClientByIdentifier const):
1419         * workers/service/server/SWServerWorker.h:
1420
1421 2018-01-25  Youenn Fablet  <youenn@apple.com>
1422
1423         WebPluginInfoProvider should handle null host queries
1424         https://bugs.webkit.org/show_bug.cgi?id=182112
1425
1426         Reviewed by Chris Dumez.
1427
1428         No change of behavior.
1429
1430         Removed assertion that is not always true, as shown by API tests.
1431
1432         * loader/DocumentLoader.cpp:
1433         (WebCore::DocumentLoader::responseReceived):
1434
1435 2018-01-25  Youenn Fablet  <youenn@apple.com>
1436
1437         ShapeOutside should use same origin credentials mode
1438         https://bugs.webkit.org/show_bug.cgi?id=182141
1439
1440         Reviewed by Chris Dumez.
1441
1442         Covered by updated test.
1443         As per https://drafts.csswg.org/css-shapes/#shape-outside-property, ShapeOutside images
1444         should be fetched with anonymous cors mode, meaning credentials should be set to same-origin.
1445
1446         * style/StylePendingResources.cpp:
1447         (WebCore::Style::loadPendingImage):
1448
1449 2018-01-25  John Wilander  <wilander@apple.com>
1450
1451         Make sure we have a frame as we iterate in ResourceLoadObserver::nonNullOwnerURL()
1452         https://bugs.webkit.org/show_bug.cgi?id=182116
1453         <rdar://problem/36210134>
1454
1455         Reviewed by Alex Christensen.
1456
1457         No new tests. No known repro case, just crash logs.
1458
1459         * loader/ResourceLoadObserver.cpp:
1460         (WebCore::ResourceLoadObserver::nonNullOwnerURL const):
1461
1462 2018-01-25  Jer Noble  <jer.noble@apple.com>
1463
1464         Move ImageDecoderAVFObjC from using AVSampleBufferGenerator to AVAssetReaderOutput for parsing
1465         https://bugs.webkit.org/show_bug.cgi?id=182091
1466
1467         Reviewed by Eric Carlson.
1468
1469         No new tests; should be covered by existing tests.
1470
1471         AVSampleBufferGenerator is not available on iOS, so in order to enable ImageDecoderAVFObjC there,
1472         we must adopt a similar API which is available both on iOS and macOS: AVAssetReaderOutput. Unlike
1473         the generator, AVAssetReaderOutput doesn't necessarily generate samples in decode order, so we'll
1474         repurpose the SampleMap from EME to hold the decoded samples as well as their generated images.
1475
1476         * Modules/mediasource/SampleMap.cpp:
1477         * Modules/mediasource/SampleMap.h:
1478         (WebCore::SampleMap::size const):
1479         * platform/MIMETypeRegistry.cpp:
1480         (WebCore::MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType):
1481         * platform/MediaSample.h:
1482         (WebCore::MediaSample::hasAlpha const):
1483         * platform/graphics/ImageDecoder.cpp:
1484         (WebCore::ImageDecoder::create):
1485         (WebCore::ImageDecoder::supportsMediaType):
1486         * platform/graphics/avfoundation/MediaSampleAVFObjC.h: Make non-final.
1487         (WebCore::MediaSampleAVFObjC::sampleBuffer const):
1488         (WebCore::MediaSampleAVFObjC::MediaSampleAVFObjC):
1489         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
1490         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
1491         (WebCore::ImageDecoderAVFObjCSample::create):
1492         (WebCore::ImageDecoderAVFObjCSample::sampleBuffer const):
1493         (WebCore::ImageDecoderAVFObjCSample::image const):
1494         (WebCore::ImageDecoderAVFObjCSample::setImage):
1495         (WebCore::ImageDecoderAVFObjCSample::ImageDecoderAVFObjCSample):
1496         (WebCore::ImageDecoderAVFObjCSample::cacheMetadata):
1497         (WebCore::toSample):
1498         (WebCore::ImageDecoderAVFObjC::readSamples):
1499         (WebCore::ImageDecoderAVFObjC::storeSampleBuffer):
1500         (WebCore::ImageDecoderAVFObjC::advanceCursor):
1501         (WebCore::ImageDecoderAVFObjC::setTrack):
1502         (WebCore::ImageDecoderAVFObjC::encodedDataStatus const):
1503         (WebCore::ImageDecoderAVFObjC::repetitionCount const):
1504         (WebCore::ImageDecoderAVFObjC::frameIsCompleteAtIndex const):
1505         (WebCore::ImageDecoderAVFObjC::frameDurationAtIndex const):
1506         (WebCore::ImageDecoderAVFObjC::frameHasAlphaAtIndex const):
1507         (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex):
1508         (WebCore::ImageDecoderAVFObjC::setData):
1509         (WebCore::ImageDecoderAVFObjC::clearFrameBufferCache):
1510         (WebCore::ImageDecoderAVFObjC::sampleAtIndex const):
1511         (WebCore::ImageDecoderAVFObjC::readSampleMetadata): Deleted.
1512
1513 2018-01-25  Youenn Fablet  <youenn@apple.com>
1514
1515         DocumentThreadableLoader should ensure service worker is not reused if redirection comes from the network
1516         https://bugs.webkit.org/show_bug.cgi?id=182137
1517
1518         Reviewed by Chris Dumez.
1519
1520         Covered by rebased test.
1521         In case redirection does not come from memory cache or service worker, disable service worker interception when following the redirection.
1522
1523         * loader/DocumentThreadableLoader.cpp:
1524         (WebCore::DocumentThreadableLoader::redirectReceived):
1525
1526 2018-01-25  Youenn Fablet  <youenn@apple.com>
1527
1528         DocumentLoader should interrupt ongoing load when getting a redirection from network that matches a service worker
1529         https://bugs.webkit.org/show_bug.cgi?id=182115
1530
1531         Reviewed by Alex Christensen.
1532
1533         Covered by rebased test.
1534
1535         In case a navigation load is going to the network process,
1536         we need to interrupt it if having a redirection that leads to a new request going to a service worker.
1537
1538         * loader/DocumentLoader.cpp:
1539         (WebCore::DocumentLoader::redirectReceived):
1540
1541 2018-01-25  Chris Dumez  <cdumez@apple.com>
1542
1543         Registering same scope as the script directory without the last slash should fail
1544         https://bugs.webkit.org/show_bug.cgi?id=182122
1545         <rdar://problem/36877167>
1546
1547         Reviewed by Youenn Fablet.
1548
1549         This aligns our behavior with Firefox and Chrome.
1550
1551         No new tests, rebaselined existing test.
1552
1553         * workers/service/ServiceWorkerJob.cpp:
1554         (WebCore::ServiceWorkerJob::didReceiveResponse):
1555
1556 2018-01-25  Antoine Quint  <graouts@apple.com>
1557
1558         [Web Animations] Expose the reverse() method
1559         https://bugs.webkit.org/show_bug.cgi?id=182100
1560         <rdar://problem/36867117>
1561
1562         Reviewed by Dean Jackson.
1563
1564         We expose and implement the reverse() method on Animation as specified.
1565
1566         * animation/WebAnimation.cpp:
1567         (WebCore::WebAnimation::setPlaybackRate):
1568         (WebCore::WebAnimation::reverse):
1569         * animation/WebAnimation.h:
1570         * animation/WebAnimation.idl:
1571
1572 2018-01-25  Antoine Quint  <graouts@apple.com>
1573
1574         [Web Animations] Account for provided easings when computing progress and resolving keyframe effect values
1575         https://bugs.webkit.org/show_bug.cgi?id=182098
1576         <rdar://problem/36866149>
1577
1578         Reviewed by Dean Jackson.
1579
1580         We now account for the timing functions provided through the "easing" propreties on whole animation effects
1581         and individual keyframes. Exposing those exposed shortcomings of our keyframe resolution in general through
1582         WPT tests so we now implement the "effect value of a keyframe effect" procedure from the spec to correctly
1583         resolve keyframes in KeyframeEffect::setAnimatedPropertiesInStyle(). The tests also showed some shortcomings
1584         in our TimingFunction code where our step() function resolution wasn't fully compliant and our cubic-bezier()
1585         resolution not accurate enough. We now have microsecond accuracy when resolving cubic-bezier() timing functions
1586         and identify cubic-bezier(0, 0, 0, 0), cubic-bezier(0, 0, 1, 1) and cubic-bezier(1, 1, 1, 1) as linear timing
1587         functions, as called out by the WPT tests.
1588
1589         * animation/AnimationEffect.cpp:
1590         (WebCore::AnimationEffect::transformedProgress const): Account for the effect-wide timing function when computing
1591         the progress.
1592         (WebCore::AnimationEffect::iterationProgress const): Use the transformed progress now that we support this procedure.
1593         * animation/AnimationEffect.h:
1594         * animation/KeyframeEffect.cpp:
1595         (WebCore::KeyframeEffect::apply): We now use the computed progress from AnimationEffect rather than compute based
1596         on the provided time, which we've dropped as an argument.
1597         (WebCore::KeyframeEffect::getAnimatedStyle):
1598         (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): Implement the "effect value of a keyframe effect" procedure
1599         in full as specified (save for composite operations).
1600         (WebCore::KeyframeEffect::applyAtLocalTime): Deleted.
1601         * animation/KeyframeEffect.h:
1602         * animation/WebAnimation.cpp:
1603         (WebCore::WebAnimation::resolve):
1604         * css/CSSTimingFunctionValue.h: Fix a small error made in a previous patch where we used "int" instead of "unsigned".
1605         * platform/animation/TimingFunction.cpp:
1606         (WebCore::TimingFunction::transformTime const):
1607         * platform/animation/TimingFunction.h:
1608
1609 2018-01-25  Antoine Quint  <graouts@apple.com>
1610
1611         [Web Animations] Avoid querying the current time multiple time when resolving the play state
1612         https://bugs.webkit.org/show_bug.cgi?id=182099
1613
1614         Reviewed by Dean Jackson.
1615
1616         No test change since this shouldn't cause any change in behavior.
1617
1618         * animation/WebAnimation.cpp:
1619         (WebCore::WebAnimation::playState const):
1620
1621 2018-01-25  Youenn Fablet  <youenn@apple.com>
1622
1623         Set integrity fetch options for loading scripts and CSS
1624         https://bugs.webkit.org/show_bug.cgi?id=182077
1625
1626         Reviewed by Chris Dumez.
1627
1628         Covered by updated test.
1629
1630         Set integrity fetch option in script and CSS loading.
1631
1632         * bindings/js/CachedModuleScriptLoader.cpp:
1633         (WebCore::CachedModuleScriptLoader::load):
1634         * bindings/js/CachedScriptFetcher.cpp:
1635         (WebCore::CachedScriptFetcher::requestModuleScript const):
1636         (WebCore::CachedScriptFetcher::requestScriptWithCache const):
1637         * bindings/js/CachedScriptFetcher.h:
1638         * dom/LoadableClassicScript.cpp:
1639         (WebCore::LoadableClassicScript::load):
1640         * dom/ScriptElementCachedScriptFetcher.cpp:
1641         (WebCore::ScriptElementCachedScriptFetcher::requestModuleScript const):
1642         * dom/ScriptElementCachedScriptFetcher.h:
1643         * html/HTMLLinkElement.cpp:
1644         (WebCore::HTMLLinkElement::process):
1645
1646 2018-01-25  Zan Dobersek  <zdobersek@igalia.com>
1647
1648         [Cairo] Use GraphicsContextImplCairo in Nicosia::PaintingContextCairo
1649         https://bugs.webkit.org/show_bug.cgi?id=182094
1650
1651         Reviewed by Carlos Garcia Campos.
1652
1653         Have Nicosia::PaintingContextCairo create a GraphicsContext object that
1654         utilizes a factory function which returns a freshly-allocated
1655         GraphicsContextImplCairo through which all the painting is then done.
1656         This moves GraphicsLayer painting over to using the GraphicsContextImpl
1657         infrastructure.
1658
1659         No new tests -- no changes in behavior.
1660
1661         * platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp:
1662         (Nicosia::PaintingContextCairo::PaintingContextCairo):
1663
1664 2018-01-24  Frederic Wang  <fwang@igalia.com>
1665
1666         ScrollingStateNode::reconcileLayerPositionForViewportRect is only called on direct children of the root
1667         https://bugs.webkit.org/show_bug.cgi?id=179946
1668
1669         Reviewed by Simon Fraser.
1670
1671         ScrollingStateNode::reconcileLayerPositionForViewportRect is currently only called on the
1672         direct children of root of the scrolling tree. Hence nodes like "position: fixed" will not
1673         update their layers after scrolling when they are deeper in the tree. This is already
1674         possible on iOS with overflow nodes and will happen with subframes when async scrolling is
1675         implemented. This commit fixes that issue by recursively calling the function
1676         ScrollingStateNode::reconcileLayerPositionForViewportRect on the scrolling tree.
1677
1678         Test: fast/scrolling/ios/reconcile-layer-position-recursive.html
1679
1680         * page/scrolling/AsyncScrollingCoordinator.cpp:
1681         (WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions): Just call
1682         reconcileLayerPositionForViewportRect on the root node.
1683         * page/scrolling/ScrollingStateNode.cpp:
1684         (WebCore::ScrollingStateNode::reconcileLayerPositionForViewportRect): By default, this
1685         function now recursively calls reconcileLayerPositionForViewportRect on the children.
1686         * page/scrolling/ScrollingStateNode.h:
1687         * page/scrolling/ScrollingStateFixedNode.cpp:
1688         (WebCore::ScrollingStateFixedNode::reconcileLayerPositionForViewportRect): Call the function
1689         on children.
1690         * page/scrolling/ScrollingStateStickyNode.cpp:
1691         (WebCore::ScrollingStateStickyNode::reconcileLayerPositionForViewportRect): Ditto.
1692
1693 2018-01-24  Zan Dobersek  <zdobersek@igalia.com>
1694
1695         [Cairo] Use GraphicsContextImplCairo for ImageBuffer context
1696         https://bugs.webkit.org/show_bug.cgi?id=181977
1697
1698         Reviewed by Carlos Garcia Campos.
1699
1700         Enhance the GraphicsContextImpl interface to the point of enabling the
1701         Cairo-based implementation to be used for GraphicsContext construction
1702         in ImageBufferCairo.cpp.
1703
1704         In order to enable GraphicsContextImpl implementations to properly
1705         manage PlatformGraphicsContext objects, the hasPlatformContext() and
1706         platformContext() methods are added. Cairo implementation returns true
1707         in the first method, and returns pointer to the PlatformContextCairo
1708         object in the second. The DisplayList::Recorder, due to its recording
1709         nature, doesn't manage such an object, so it returns false and nullptr,
1710         respectively.
1711
1712         GraphicsContextImpl also gains the setCTM(), getCTM(), clipBounds() and
1713         roundToDevicePixels() methods, corresponding to the GraphicsContext
1714         methods that now invoke these new methods on any existing m_impl object.
1715         GraphicsContextImplCairo implementations mimic the existing behavior in
1716         the Cairo-specific GraphicsContext methods, but DisplayList::Recorder
1717         implementations remain no-op, logging the invocation but doing nothing
1718         otherwise.
1719
1720         drawImage() and drawTiledImage() methods on the GraphicsContextImpl
1721         interface are changed to return the ImageDrawResult value, corresponding
1722         to what's been done in the method. In DisplayList::Recorder, the methods
1723         return ImageDrawResult::DidRecord, while in GraphicsContextImplCairo the
1724         methods return the return result of Image::draw() or Image::drawTiled()
1725         call.
1726
1727         To make the protected Image::draw() and Image::drawTiled() methods
1728         accessible, invocations of those are packed into static drawImageImpl()
1729         and drawTiledImageImpl() functions on the GraphicsContextImpl class.
1730         This makes it possible to simply declare GraphicsContextImpl class as a
1731         friend class of Image, and not every specific GraphicsContextImpl
1732         derivation. Implementations of these functions mirror behavior of the
1733         drawImage() and drawTiledImage() methods on the GraphicsContext class,
1734         when an m_impl object isn't present, constructing a scope-tied
1735         InterpolationQualityMaintainer object and invoking the relevant Image
1736         method.
1737
1738         To make immediate use of the new GraphicsContextImplCairo functionality,
1739         the GraphicsContext construction in Cairo-specific ImageBuffer
1740         implementation now uses a factory function that returns a new
1741         GraphicsContextImplCairo object through which the given
1742         PlatformContextCairo is used for painting.
1743
1744         No new tests -- no change in functionality.
1745
1746         * platform/graphics/GraphicsContext.cpp:
1747         (WebCore::GraphicsContext::hasPlatformContext const):
1748         (WebCore::GraphicsContext::drawImage):
1749         (WebCore::GraphicsContext::drawTiledImage):
1750         * platform/graphics/GraphicsContext.h:
1751         (WebCore::GraphicsContext::hasPlatformContext const): Deleted.
1752         * platform/graphics/GraphicsContextImpl.cpp:
1753         (WebCore::GraphicsContextImpl::drawImageImpl):
1754         (WebCore::GraphicsContextImpl::drawTiledImageImpl):
1755         * platform/graphics/GraphicsContextImpl.h:
1756         * platform/graphics/Image.h:
1757         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1758         (WebCore::GraphicsContext::getCTM const):
1759         (WebCore::GraphicsContext::platformContext const):
1760         (WebCore::GraphicsContext::clipBounds const):
1761         (WebCore::GraphicsContext::roundToDevicePixels):
1762         (WebCore::GraphicsContext::setCTM):
1763         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
1764         (WebCore::m_private):
1765         (WebCore::GraphicsContextImplCairo::~GraphicsContextImplCairo):
1766         (WebCore::GraphicsContextImplCairo::hasPlatformContext const):
1767         (WebCore::GraphicsContextImplCairo::platformContext const):
1768         (WebCore::GraphicsContextImplCairo::updateState):
1769         (WebCore::GraphicsContextImplCairo::setLineCap):
1770         (WebCore::GraphicsContextImplCairo::setLineDash):
1771         (WebCore::GraphicsContextImplCairo::setLineJoin):
1772         (WebCore::GraphicsContextImplCairo::setMiterLimit):
1773         (WebCore::GraphicsContextImplCairo::fillRect):
1774         (WebCore::GraphicsContextImplCairo::fillRoundedRect):
1775         (WebCore::GraphicsContextImplCairo::fillRectWithRoundedHole):
1776         (WebCore::GraphicsContextImplCairo::fillPath):
1777         (WebCore::GraphicsContextImplCairo::fillEllipse):
1778         (WebCore::GraphicsContextImplCairo::strokeRect):
1779         (WebCore::GraphicsContextImplCairo::strokePath):
1780         (WebCore::GraphicsContextImplCairo::strokeEllipse):
1781         (WebCore::GraphicsContextImplCairo::clearRect):
1782         (WebCore::GraphicsContextImplCairo::drawGlyphs):
1783         (WebCore::GraphicsContextImplCairo::drawImage):
1784         (WebCore::GraphicsContextImplCairo::drawTiledImage):
1785         (WebCore::GraphicsContextImplCairo::drawNativeImage):
1786         (WebCore::GraphicsContextImplCairo::drawPattern):
1787         (WebCore::GraphicsContextImplCairo::drawRect):
1788         (WebCore::GraphicsContextImplCairo::drawLine):
1789         (WebCore::GraphicsContextImplCairo::drawLinesForText):
1790         (WebCore::GraphicsContextImplCairo::drawLineForDocumentMarker):
1791         (WebCore::GraphicsContextImplCairo::drawEllipse):
1792         (WebCore::GraphicsContextImplCairo::drawFocusRing):
1793         (WebCore::GraphicsContextImplCairo::save):
1794         (WebCore::GraphicsContextImplCairo::restore):
1795         (WebCore::GraphicsContextImplCairo::translate):
1796         (WebCore::GraphicsContextImplCairo::rotate):
1797         (WebCore::GraphicsContextImplCairo::scale):
1798         (WebCore::GraphicsContextImplCairo::concatCTM):
1799         (WebCore::GraphicsContextImplCairo::setCTM):
1800         (WebCore::GraphicsContextImplCairo::getCTM):
1801         (WebCore::GraphicsContextImplCairo::beginTransparencyLayer):
1802         (WebCore::GraphicsContextImplCairo::endTransparencyLayer):
1803         (WebCore::GraphicsContextImplCairo::clip):
1804         (WebCore::GraphicsContextImplCairo::clipOut):
1805         (WebCore::GraphicsContextImplCairo::clipPath):
1806         (WebCore::GraphicsContextImplCairo::clipBounds):
1807         (WebCore::GraphicsContextImplCairo::roundToDevicePixels):
1808         (WebCore::m_platformContext): Deleted.
1809         * platform/graphics/cairo/GraphicsContextImplCairo.h:
1810         * platform/graphics/cairo/ImageBufferCairo.cpp:
1811         (WebCore::ImageBuffer::ImageBuffer):
1812         * platform/graphics/cg/GraphicsContextCG.cpp:
1813         (WebCore::GraphicsContext::clipBounds const):
1814         (WebCore::GraphicsContext::setCTM):
1815         (WebCore::GraphicsContext::getCTM const):
1816         (WebCore::GraphicsContext::roundToDevicePixels):
1817         * platform/graphics/displaylists/DisplayListRecorder.cpp:
1818         (WebCore::DisplayList::Recorder::drawImage):
1819         (WebCore::DisplayList::Recorder::drawTiledImage):
1820         (WebCore::DisplayList::Recorder::drawNativeImage):
1821         (WebCore::DisplayList::Recorder::setCTM):
1822         (WebCore::DisplayList::Recorder::getCTM):
1823         (WebCore::DisplayList::Recorder::clipBounds):
1824         (WebCore::DisplayList::Recorder::roundToDevicePixels):
1825         * platform/graphics/displaylists/DisplayListRecorder.h:
1826
1827 2018-01-24  Christopher Reid  <chris.reid@sony.com>
1828
1829         Linker error in ShareableBitmapCairo.cpp  undefined reference to WebCore::Cairo::ShadowState::ShadowState
1830         https://bugs.webkit.org/show_bug.cgi?id=182060
1831
1832         Reviewed by Žan Doberšek.
1833
1834         No new tests, no change in behavior.
1835
1836         Added exports to WebCore::Cairo::ShadowState::ShadowState.
1837
1838         * platform/graphics/cairo/CairoOperations.h:
1839
1840 2018-01-24  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1841
1842         [Curl] Implement didSendData client callback.
1843         https://bugs.webkit.org/show_bug.cgi?id=182063
1844
1845         Reviewed by Alex Christensen.
1846
1847         No new tests (covered by existing tests).
1848
1849         * platform/network/curl/CurlDownload.h:
1850         * platform/network/curl/CurlRequest.cpp:
1851         (WebCore::CurlRequest::willSendData):
1852         * platform/network/curl/CurlRequestClient.h:
1853         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
1854         (WebCore::ResourceHandleCurlDelegate::curlDidSendData):
1855         * platform/network/curl/ResourceHandleCurlDelegate.h:
1856
1857 2018-01-24  Jiewen Tan  <jiewen_tan@apple.com>
1858
1859         [WebAuthN] Implement PublicKeyCredential’s [[DiscoverFromExternalSource]] with a dummy authenticator
1860         https://bugs.webkit.org/show_bug.cgi?id=182032
1861         <rdar://problem/36459922>
1862
1863         Reviewed by Brent Fulgham.
1864
1865         This patch implements PublicKeyCredential's [[DiscoverFromExternalSource]] from
1866         https://www.w3.org/TR/webauthn/#getAssertion as of 5 December 2017. In order to
1867         do testing, a dummy authenticator is implemented to exercise a failure and a
1868         pass path. A number of dependencies need to be resolved later in order to comply
1869         with the spec, which are marked by FIXME in the patch and tracked by proper
1870         bugs. Those dependencies will be addressed once the first prototype is finshed.
1871
1872         Tests: http/tests/webauthn/public-key-credential-get-with-invalid-parameters.https.html
1873                http/wpt/credential-management/credentialscontainer-store-basics.https.html
1874                http/wpt/webauthn/public-key-credential-get-failure.https.html
1875                http/wpt/webauthn/public-key-credential-get-success.https.html
1876
1877         * Modules/credentialmanagement/CredentialsContainer.cpp:
1878         (WebCore::CredentialsContainer::get):
1879         (WebCore::CredentialsContainer::isCreate):
1880         Fixes some minor issues.
1881         * Modules/webauthn/Authenticator.cpp:
1882         (WebCore::Authenticator::getAssertion const):
1883         * Modules/webauthn/Authenticator.h:
1884         (WebCore::Authenticator::AssertionReturnBundle::AssertionReturnBundle):
1885         * Modules/webauthn/PublicKeyCredential.cpp:
1886         (WebCore::PublicKeyCredential::collectFromCredentialStore):
1887         Changed a parameter type.
1888         (WebCore::PublicKeyCredential::discoverFromExternalSource):
1889         (WebCore::PublicKeyCredential::create):
1890         Improved some comments.
1891         * Modules/webauthn/PublicKeyCredential.h:
1892         * Modules/webauthn/PublicKeyCredentialRequestOptions.h:
1893         (): Deleted.
1894         * bindings/js/JSAuthenticatorResponseCustom.cpp:
1895         (WebCore::toJSNewlyCreated):
1896
1897 2018-01-24  Dean Jackson  <dino@apple.com>
1898
1899         Move WebGL's colorspace code into IOSurface
1900         https://bugs.webkit.org/show_bug.cgi?id=182076
1901         <rdar://problem/36846863>
1902
1903         Reviewed by Simon Fraser, with assistance from Tim Horton.
1904
1905         Rather than have WebGLLayer talk directly to an IOSurfaceRef,
1906         use a helper function on WebCore::IOSurface.
1907
1908         No behaviour change.
1909
1910         * platform/graphics/cocoa/IOSurface.h:
1911         * platform/graphics/cocoa/IOSurface.mm:
1912         (WebCore::IOSurface::migrateColorSpaceToProperties): Add new helper.
1913         * platform/graphics/cocoa/WebGLLayer.mm:
1914         (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]): The
1915         newly created IOSurfaces call the helper to set up their colorspace.
1916
1917 2018-01-24  Dean Jackson  <dino@apple.com>
1918
1919         Add a note about not implementing these functions without discussion.
1920         <rdar://problem/36666458>
1921
1922         * html/canvas/WebGL2RenderingContext.cpp:
1923         (WebCore::WebGL2RenderingContext::clientWaitSync):
1924         (WebCore::WebGL2RenderingContext::getSyncParameter):
1925
1926 2018-01-24  Youenn Fablet  <youenn@apple.com>
1927
1928         Opaque being-loaded responses should clone their body
1929         https://bugs.webkit.org/show_bug.cgi?id=182056
1930
1931         Reviewed by Brady Eidson.
1932
1933         Test: http/wpt/service-workers/clone-opaque-being-loaded-response.https.html
1934
1935         When cloning a being-loaded response, make sure we create a ReadableStream.
1936         Before the patch, the readableStream was not created in that case for opaque responses.
1937
1938         * Modules/fetch/FetchBodyOwner.cpp:
1939         (WebCore::FetchBodyOwner::readableStream):
1940         (WebCore::FetchBodyOwner::createReadableStream):
1941         * Modules/fetch/FetchBodyOwner.h:
1942         * Modules/fetch/FetchResponse.cpp:
1943         (WebCore::FetchResponse::clone):
1944
1945 2018-01-24  Chris Dumez  <cdumez@apple.com>
1946
1947         close() operation should not be exposed inside a ServiceWorkerGlobalScope
1948         https://bugs.webkit.org/show_bug.cgi?id=182057
1949
1950         Reviewed by Youenn Fablet.
1951
1952         Move close() from WorkerGlobalScope to DedicatedWorkerGlobalScope as per:
1953         - https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope
1954
1955         This change to the specification was made to avoid exposing this deprecated
1956         features to service workers (which are new).
1957
1958         No new tests, rebaselined existing test.
1959
1960         * workers/DedicatedWorkerGlobalScope.idl:
1961         * workers/WorkerGlobalScope.idl:
1962
1963 2018-01-24  David Hyatt  <hyatt@apple.com>
1964
1965         Implement line clamp for mail.
1966         https://bugs.webkit.org/show_bug.cgi?id=180818
1967
1968         Reviewed by Dean Jackson.
1969
1970         This patch implements a form of clamping that can clamp lines at both the top
1971         and the bottom, and the interior can be replaced with a DOM element (identified
1972         by id) that replaces the middle section.
1973
1974         The implementation derives from the multicolumn classes, but ultimately the
1975         clamp should derive from the fragmentset classes instead (with most of the current
1976         multicolumn code moving into base classes).
1977
1978         The virtualization of many of the multicolumn functions is something that would happen
1979         once we move pages/printing over to this pagination model anyway.
1980
1981         * Sources.txt:
1982         * WebCore.xcodeproj/project.pbxproj:
1983         Add the new clamp classes.
1984
1985         * css/CSSComputedStyleDeclaration.cpp:
1986         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
1987         * css/CSSProperties.json:
1988         * css/StyleBuilderCustom.h:
1989         (WebCore::StyleBuilderCustom::applyValueWebkitLinesClamp):
1990         * css/parser/CSSParser.cpp:
1991         (WebCore::CSSParserContext::CSSParserContext):
1992         * css/parser/CSSParserMode.h:
1993         (WebCore::CSSParserContextHash::hash):
1994         * css/parser/CSSPropertyParser.cpp:
1995         (WebCore::consumeLinesClamp):
1996         (WebCore::CSSPropertyParser::parseSingleValue):
1997         Implement the new CSS property, webkit-lines-clamp. This is only exposed if a preference
1998         is set, so it is not exposed to the Web.
1999
2000         * page/Settings.yaml:
2001         Add a new setting to control allowing access to the new CSS property.
2002
2003         * rendering/RenderBlockFlow.cpp:
2004         (WebCore::RenderBlockFlow::willCreateColumns const):
2005         Make sure columns are created when lines clamp is set.
2006
2007         (WebCore::getHeightForLineCount):
2008         (WebCore::RenderBlockFlow::logicalHeightForLineCount):
2009         (WebCore::RenderBlockFlow::logicalHeightExcludingLineCount):
2010         (WebCore::RenderBlockFlow::layoutExcludedChildren):
2011         (WebCore::RenderBlockFlow::heightForLineCount): Deleted.
2012         * rendering/RenderBlockFlow.h:
2013         Re-use the same clamping logic as the old line clamp code, but modernize it to work
2014         with writing modes and to be able to go backwards from the end of the block.
2015
2016         * rendering/RenderDeprecatedFlexibleBox.cpp:
2017         (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
2018         The line count method got renamed to have the word "logical" in it, since it now
2019         works with vertical writing.
2020
2021         * rendering/RenderFragmentContainer.cpp:
2022         (WebCore::RenderFragmentContainer::pageLogicalHeightForOffset const):
2023         * rendering/RenderFragmentContainer.h:
2024         Since line clamp sets have variable page heights, this new method takes the offset
2025         as an argument so that it can return the appropriate page for the given offset.
2026         This method will eventually be used by printing/page sets as well, since pages
2027         can have variable heights.
2028
2029         * rendering/RenderFragmentedFlow.cpp:
2030         (WebCore::RenderFragmentedFlow::validateFragments):
2031         (WebCore::RenderFragmentedFlow::pageLogicalHeightForOffset const):
2032         (WebCore::RenderFragmentedFlow::pageRemainingLogicalHeightForOffset const):
2033         * rendering/RenderFragmentedFlow.h:
2034         Support for variable page heights in a fragment set.
2035
2036         * rendering/RenderLinesClampFlow.cpp: Added.
2037         (WebCore::RenderLinesClampFlow::RenderLinesClampFlow):
2038         (WebCore::RenderLinesClampFlow::renderName const):
2039         (WebCore::RenderLinesClampFlow::layout):
2040         (WebCore::RenderLinesClampFlow::createMultiColumnSet):
2041         (WebCore::RenderLinesClampFlow::isChildAllowedInFragmentedFlow const):
2042         (WebCore::RenderLinesClampFlow::layoutFlowExcludedObjects):
2043         * rendering/RenderLinesClampFlow.h: Added.
2044         * rendering/RenderLinesClampSet.cpp: Added.
2045         (WebCore::RenderLinesClampSet::RenderLinesClampSet):
2046         (WebCore::RenderLinesClampSet::recalculateColumnHeight):
2047         (WebCore::RenderLinesClampSet::computeLogicalHeight const):
2048         (WebCore::RenderLinesClampSet::columnCount const):
2049         (WebCore::RenderLinesClampSet::columnRectAt const):
2050         (WebCore::RenderLinesClampSet::columnIndexAtOffset const):
2051         (WebCore::RenderLinesClampSet::pageLogicalTopForOffset const):
2052         (WebCore::RenderLinesClampSet::pageLogicalHeightForOffset const):
2053         (WebCore::RenderLinesClampSet::fragmentedFlowPortionRectAt const):
2054         (WebCore::RenderLinesClampSet::fragmentedFlowPortionOverflowRect):
2055         (WebCore::RenderLinesClampSet::customBlockProgressionAdjustmentForColumn const):
2056         (WebCore::RenderLinesClampSet::renderName const):
2057         * rendering/RenderLinesClampSet.h: Added.
2058         The new classes. They subclass all the methods necessary to do multi-pass layout,
2059         and to determine the page heights of each section.
2060
2061         * rendering/RenderMultiColumnFlow.cpp:
2062         (WebCore::RenderMultiColumnFlow::isColumnSpanningDescendant const):
2063         (WebCore::isValidColumnSpanner):
2064         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
2065         (WebCore::RenderMultiColumnFlow::createMultiColumnSet):
2066         * rendering/RenderMultiColumnFlow.h:
2067         * rendering/RenderMultiColumnSet.cpp:
2068         (WebCore::RenderMultiColumnSet::collectLayerFragments):
2069         (WebCore::RenderMultiColumnSet::columnTranslationForOffset const):
2070         * rendering/RenderMultiColumnSet.h:
2071         (WebCore::RenderMultiColumnSet::skipLayerFragmentCollectionForColumn const):
2072         (WebCore::RenderMultiColumnSet::customBlockProgressionAdjustmentForColumn const):
2073         Virtualized methods so that lines clamp can subclass and change behavior.
2074
2075         * rendering/RenderObject.h:
2076         (WebCore::RenderObject::isRenderLinesClampFlow const):
2077         (WebCore::RenderObject::isRenderLinesClampSet const):
2078         Add new functions for type checking.
2079
2080         * rendering/RenderRubyText.cpp:
2081         Include adjustment.
2082
2083         * rendering/style/LineClampValue.h:
2084         (WebCore::LinesClampValue::LinesClampValue):
2085         (WebCore::LinesClampValue::isNone const):
2086         (WebCore::LinesClampValue::operator== const):
2087         (WebCore::LinesClampValue::operator!= const):
2088         (WebCore::LinesClampValue::start const):
2089         (WebCore::LinesClampValue::end const):
2090         (WebCore::LinesClampValue::center const):
2091         * rendering/style/RenderStyle.h:
2092         (WebCore::RenderStyle::linesClamp const):
2093         (WebCore::RenderStyle::hasLinesClamp const):
2094         (WebCore::RenderStyle::setLinesClamp):
2095         (WebCore::RenderStyle::initialLinesClamp):
2096         (WebCore::RenderStyle::hasInlineColumnAxis const):
2097         * rendering/style/StyleRareNonInheritedData.cpp:
2098         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
2099         (WebCore::StyleRareNonInheritedData::operator== const):
2100         * rendering/style/StyleRareNonInheritedData.h:
2101         The front end style implementation of the new property.
2102
2103         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
2104         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
2105         Make sure to build the correct renderer when lines clamp is set.
2106
2107 2018-01-24  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2108
2109         [Curl] Allocate CurlSSLVerifier only when it is required.
2110         https://bugs.webkit.org/show_bug.cgi?id=182061
2111
2112         CurlSSLVerifier was a member function of CurlRequest. This patch do
2113         lazy initialization of it only when actually it is required.
2114         Also configuration method is not required by moving those stuff to
2115         constructor of SSLVerifier which makes much safer because there's
2116         no change to change its behavior from outside.
2117
2118         Reviewed by Alex Christensen.
2119
2120         * platform/network/curl/CurlRequest.cpp:
2121         (WebCore::CurlRequest::willSetupSslCtx):
2122         (WebCore::CurlRequest::didCompleteTransfer):
2123         (WebCore::CurlRequest::finalizeTransfer):
2124         * platform/network/curl/CurlRequest.h:
2125         * platform/network/curl/CurlSSLVerifier.cpp:
2126         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
2127         (WebCore::CurlSSLVerifier::setSslCtx): Deleted.
2128         * platform/network/curl/CurlSSLVerifier.h:
2129         (WebCore::CurlSSLVerifier::setCurlHandle): Deleted.
2130         (WebCore::CurlSSLVerifier::setHostName): Deleted.
2131
2132 2018-01-24  Antti Koivisto  <antti@apple.com>
2133
2134         Assertion failure in RenderMultiColumnSet::requiresBalancing() on fast/multicol/spanner-crash-when-adding-summary.html
2135         https://bugs.webkit.org/show_bug.cgi?id=179308
2136         <rdar://problem/34592771>
2137
2138         Reviewed by Zalan Bujtas.
2139
2140         The issue here is that we fail to tear down render tree for a summary element because adding another summary element
2141         takes it out of the composed tree. This leaves behind renderers that break some multicolumn assumptions.
2142
2143         * rendering/updating/RenderTreeUpdater.cpp:
2144         (WebCore::RenderTreeUpdater::tearDownRenderers):
2145         (WebCore::RenderTreeUpdater::tearDownLeftoverShadowHostChildren):
2146
2147         When tearing down renderers go through the real children of the shadow hosts at the end and see if we left any renderers behind.
2148         If so, tear them down too.
2149
2150         * rendering/updating/RenderTreeUpdater.h:
2151
2152 2018-01-24  Daniel Bates  <dabates@apple.com>
2153
2154         [CSP] Check policy for targeted windows when navigating to a JavaScript URL
2155         https://bugs.webkit.org/show_bug.cgi?id=182018
2156         <rdar://problem/36795781>
2157
2158         Reviewed by Brent Fulgham.
2159
2160         Move the CSP check to be earlier in the function.
2161
2162         Test: http/tests/security/contentSecurityPolicy/window-open-javascript-url-with-target-blocked.html
2163
2164         * loader/FrameLoader.cpp:
2165         (WebCore::createWindow):
2166
2167 2018-01-24  Chris Dumez  <cdumez@apple.com>
2168
2169         Add a IPC::SendSyncOption indicating we should not process incoming IPC while waiting for the sync reply
2170         https://bugs.webkit.org/show_bug.cgi?id=182021
2171         <rdar://problem/21629943>
2172
2173         Reviewed by Ryosuke Niwa.
2174
2175         Add layout testing infrastructure for the new flag.
2176
2177         Test: fast/misc/testIncomingSyncIPCMessageWhileWaitingForSyncReply.html
2178
2179         * page/ChromeClient.h:
2180         * testing/Internals.cpp:
2181         (WebCore::Internals::testIncomingSyncIPCMessageWhileWaitingForSyncReply):
2182         * testing/Internals.h:
2183         * testing/Internals.idl:
2184
2185 2018-01-24  Alex Christensen  <achristensen@webkit.org>
2186
2187         Remove pre-Sierra-OS-specific code in WebCore
2188         https://bugs.webkit.org/show_bug.cgi?id=182026
2189
2190         Reviewed by Tim Horton.
2191
2192         * page/cocoa/UserAgent.mm:
2193         (WebCore::systemMarketingVersionForUserAgentString):
2194         * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm:
2195         (WebCore::ScrollingMomentumCalculatorMac::retargetedScrollOffsetDidChange):
2196         * platform/cocoa/PasteboardCocoa.mm:
2197         (WebCore::bitmapPNGFileType):
2198         * platform/graphics/FontPlatformData.cpp:
2199         * platform/graphics/FontPlatformData.h:
2200         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
2201         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer):
2202         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2203         (layerContentsFormat):
2204         (PlatformCALayerCocoa::updateContentsFormat):
2205         (PlatformCALayerCocoa::backingStoreBytesPerPixel const):
2206         * platform/graphics/cg/GraphicsContextCG.cpp:
2207         (WebCore::linearRGBColorSpaceRef):
2208         (WebCore::extendedSRGBColorSpaceRef):
2209         * platform/graphics/cg/PDFDocumentImage.cpp:
2210         (WebCore::PDFDocumentImage::drawPDFPage):
2211         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2212         (WebCore::getCSSAttribute):
2213         (WebCore::capabilitiesForFontDescriptor):
2214         (WebCore::findClosestFont):
2215         (WebCore::platformFontLookupWithFamily):
2216         (WebCore::lookupFallbackFont):
2217         (WebCore::fontWeightFromCoreText): Deleted.
2218         * platform/graphics/cocoa/FontCocoa.mm:
2219         (WebCore::Font::variantCapsSupportsCharacterForSynthesis const):
2220         (WebCore::Font::platformWidthForGlyph const):
2221         (WebCore::advanceForColorBitmapFont): Deleted.
2222         (WebCore::canUseFastGlyphAdvanceGetter): Deleted.
2223         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
2224         (WebCore::FontPlatformData::FontPlatformData):
2225         (WebCore::FontPlatformData::hash const):
2226         (WebCore::FontPlatformData::platformIsEqual const):
2227         (WebCore::FontPlatformData::ctFont const):
2228         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
2229         (WebCore::linearRGBColorSpaceRef): Deleted.
2230         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
2231         (WebCore::WebCoreDecompressionSession::setTimebase):
2232         * platform/graphics/mac/FontCustomPlatformData.cpp:
2233         (WebCore::FontCustomPlatformData::supportsFormat):
2234         * platform/mac/PlatformScreenMac.mm:
2235         (WebCore::screenSupportsExtendedColor):
2236         * platform/mac/ScrollbarThemeMac.mm:
2237         (WebCore::ScrollbarThemeMac::didCreateScrollerImp):
2238         (WebCore::ScrollbarThemeMac::isLayoutDirectionRTL):
2239         * platform/mac/ThemeMac.mm:
2240         (WebCore::ThemeMac::userPrefersReducedMotion const):
2241         * platform/network/cocoa/ResourceRequestCocoa.mm:
2242         (WebCore::ResourceRequest::doUpdatePlatformRequest):
2243         * platform/text/mac/TextBoundaries.mm:
2244         (WebCore::findNextWordFromIndex):
2245         * rendering/RenderLayerModelObject.cpp:
2246         (WebCore::RenderLayerModelObject::shouldPlaceBlockDirectionScrollbarOnLeft const):
2247         * testing/Internals.mm:
2248         (WebCore::Internals::userPrefersReducedMotion const):
2249
2250 2018-01-24  Alex Christensen  <achristensen@webkit.org>
2251
2252         Remove WebProcess authentication code
2253         https://bugs.webkit.org/show_bug.cgi?id=182020
2254
2255         Reviewed by Brady Eidson.
2256
2257         We were keeping it around for pre-NetworkSession media loading, which is gone now.
2258
2259         * html/HTMLMediaElement.cpp:
2260         (WebCore::HTMLMediaElement::mediaPlayerShouldWaitForResponseToAuthenticationChallenge): Deleted.
2261         * html/HTMLMediaElement.h:
2262         * loader/ResourceLoader.cpp:
2263         (WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
2264         * loader/ResourceLoader.h:
2265         * platform/graphics/MediaPlayer.cpp:
2266         (WebCore::MediaPlayer::shouldWaitForResponseToAuthenticationChallenge): Deleted.
2267         * platform/graphics/MediaPlayer.h:
2268         (WebCore::MediaPlayerClient::mediaPlayerShouldWaitForResponseToAuthenticationChallenge): Deleted.
2269         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2270         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2271         (-[WebCoreAVFLoaderDelegate resourceLoader:shouldWaitForResponseToAuthenticationChallenge:]):
2272         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge): Deleted.
2273
2274 2018-01-24  Joanmarie Diggs  <jdiggs@igalia.com>
2275
2276         AX: SVG AAM mapping trumps ARIA role attribute in the case of SVG root
2277         https://bugs.webkit.org/show_bug.cgi?id=181994
2278
2279         Reviewed by Chris Fleizach.
2280
2281         Only return AccessibilityRole::Group if we have no author-provided
2282         ARIA role attribute value.
2283
2284         Test: accessibility/svg-element-with-aria-role.html
2285
2286         * accessibility/AccessibilitySVGRoot.cpp:
2287         (WebCore::AccessibilitySVGRoot::roleValue const):
2288         * accessibility/AccessibilitySVGRoot.h:
2289
2290 2018-01-24  Alex Christensen  <achristensen@webkit.org>
2291
2292         Remove unused QTKit preference
2293         https://bugs.webkit.org/show_bug.cgi?id=181968
2294
2295         Reviewed by Alexey Proskuryakov.
2296
2297         They weren't used and didn't do anything.
2298
2299         * page/DeprecatedGlobalSettings.cpp:
2300         (WebCore::DeprecatedGlobalSettings::setQTKitEnabled): Deleted.
2301         * page/DeprecatedGlobalSettings.h:
2302         (WebCore::DeprecatedGlobalSettings::isQTKitEnabled): Deleted.
2303
2304 2018-01-24  Antoine Quint  <graouts@apple.com>
2305
2306         [Web Animations] Compute the progress and currentIteration properties on getComputedTiming()
2307         https://bugs.webkit.org/show_bug.cgi?id=182039
2308         <rdar://problem/36813568>
2309
2310         Reviewed by Dean Jackson.
2311
2312         Compute the "progress" and "currentIteration" properties on the dictionary returned by getComputedTiming().
2313         To support this we implement several procedures from the specification implemented separately with links
2314         and steps copied from the specification. There is one last procedure we don't implement, which is to obtain
2315         the transformed time following the application of the provided easing, which will be the next patch.
2316
2317         * animation/AnimationEffect.cpp:
2318         (WebCore::AnimationEffect::phase const):
2319         (WebCore::AnimationEffect::activeTime const):
2320         (WebCore::AnimationEffect::overallProgress const):
2321         (WebCore::AnimationEffect::simpleIterationProgress const):
2322         (WebCore::AnimationEffect::currentIteration const):
2323         (WebCore::AnimationEffect::currentDirection const):
2324         (WebCore::AnimationEffect::directedProgress const):
2325         (WebCore::AnimationEffect::iterationProgress const):
2326         (WebCore::AnimationEffect::getComputedTiming):
2327         * animation/AnimationEffect.h:
2328
2329 2018-01-24  Daniel Bates  <dabates@apple.com>
2330
2331         REGRESSION (r226138): Selecting a line that ends with zero-width joiner (ZWJ) may cause text transformation
2332         https://bugs.webkit.org/show_bug.cgi?id=181993
2333         <rdar://problem/36421080>
2334
2335         Reviewed by David Hyatt.
2336
2337         Re-implement paint optimization that was inadvertently removed in r226138. This optimization
2338         works around an issue where selecting the last printable character in a line that is followed
2339         followed by a zero-width joiner transforms the selected character.
2340
2341         We need to fix <https://bugs.webkit.org/show_bug.cgi?id=181964> to improve the interaction
2342         of selection and zero-width joiner characters. For now, re-implement a paint optimization
2343         to perform a single paint operation when the style of the non-selected text is identical
2344         to the style of the selected text.
2345
2346         Test: fast/text/mac/select-character-before-zero-width-joiner.html
2347
2348         * rendering/InlineTextBox.cpp:
2349         (WebCore::InlineTextBox::MarkerSubrangeStyle::areBackgroundMarkerSubrangeStylesEqual):
2350         (WebCore::InlineTextBox::MarkerSubrangeStyle::areForegroundMarkerSubrangeStylesEqual):
2351         (WebCore::InlineTextBox::MarkerSubrangeStyle::areDecorationMarkerSubrangeStylesEqual):
2352         Add helper functions to determine when marker styles are identical. We make use of these
2353         equality functions to coalesce adjacent subranges that have the same visual style and
2354         hence reduce the number of drawing commands to paint all the subranges in a line.
2355  
2356         (WebCore::InlineTextBox::paint): Coalesce subranges before painting.
2357
2358         (WebCore::InlineTextBox::subdivideAndResolveStyle): Split out the logic to coalesce
2359         subranges with the same style into its own function InlineTextBox::coalesceAdjacentSubranges()
2360         and kept this function focused on subdivision and style resolution. Manually compute
2361         the frontmost subranges so that we can resolve style for each subrange with respect to
2362         the correct base style. Formerly we always resolved style with respect the specified
2363         base style. Now we resolve style with respect the previous frontmost subrange to ensure
2364         styles cascade as expected. This change causes no visual difference now. Once we implement
2365         <https://bugs.webkit.org/show_bug.cgi?id=175784> we will be able to test this change
2366         with respect to selection of ::spelling-error/::grammar-error pseudo elements.
2367
2368         (WebCore::InlineTextBox::coalesceAdjacentSubranges): Extracted logic from InlineTextBox::subdivideAndResolveStyle().
2369
2370         (WebCore::InlineTextBox::MarkerSubrangeStyle::operator== const): Deleted.
2371         (WebCore::InlineTextBox::MarkerSubrangeStyle::operator!= const): Deleted.
2372         Comparing MarkerSubrangeStyle objects should be performed using the appropriate
2373         are*MarkerSubrangeStylesEqual() non-member function.
2374
2375         * rendering/InlineTextBox.h:
2376         * rendering/MarkerSubrange.cpp:
2377         (WebCore::subdivide): Remove overlap strategy FrontmostWithLongestEffectiveRange
2378         as this strategy is now implemented by InlineTextBox::subdivideAndResolveStyle() and
2379         InlineTextBox::coalesceAdjacentSubranges() that compute the set of frontmost subranges and
2380         coalesces adjacent subranges with the same style into the longest effective subrange,
2381         respectively. Unlike WebCore::subdivide(), InlineTextBox knows what the base style should
2382         be for the subranges and can more aggressively coalesce adjacent subranges of different
2383         types that have the same visual style.
2384         * rendering/MarkerSubrange.h:
2385
2386 2018-01-24  Youenn Fablet  <youenn@apple.com>
2387
2388         Fetch response should copy its url from the request if null
2389         https://bugs.webkit.org/show_bug.cgi?id=182048
2390
2391         Reviewed by Chris Dumez.
2392
2393         No change of behavior.
2394
2395         * loader/DocumentLoader.cpp:
2396         (WebCore::DocumentLoader::responseReceived): Add assertion to check that the response URL is not null.
2397
2398 2018-01-24  Youenn Fablet  <youenn@apple.com>
2399
2400         Account for memory cache in DocumentThreadableLoader::didReceiveResponse assertion
2401         https://bugs.webkit.org/show_bug.cgi?id=182049
2402
2403         Reviewed by Chris Dumez.
2404
2405         No change of behavior.
2406         A response served from Service Worker may be cached in Memory Cache and reused later on.
2407         Update DTL assertion to handle that case.
2408
2409         * loader/DocumentThreadableLoader.cpp:
2410         (WebCore::DocumentThreadableLoader::didReceiveResponse):
2411
2412 2018-01-24  Eric Carlson  <eric.carlson@apple.com>
2413
2414         REGRESSION(r227457): Release assert in updateLayout while destructing a media element
2415         https://bugs.webkit.org/show_bug.cgi?id=182038
2416         <rdar://problem/36812083>
2417
2418         Reviewed by Jer Noble.
2419
2420         * html/MediaElementSession.cpp:
2421         (WebCore::isMainContentForPurposesOfAutoplay): Early return if element.isSuspended().
2422         * platform/audio/mac/MediaSessionManagerMac.mm:
2423         (WebCore::MediaSessionManagerMac::clientCharacteristicsChanged): Call scheduleUpdateNowPlayingInfo
2424         instead of updateNowPlayingInfo.
2425
2426 2018-01-24  Chris Fleizach  <cfleizach@apple.com>
2427
2428         AX: Provide a way for VoiceOver to uniquely identify a web session
2429         https://bugs.webkit.org/show_bug.cgi?id=181894
2430
2431         Reviewed by Joanmarie Diggs.
2432
2433         Add a way for VoiceOver to uniquely track a web page session.
2434
2435         Test: accessibility/mac/session-id.html
2436
2437         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2438         (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
2439         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2440
2441 2018-01-24  Antti Koivisto  <antti@apple.com>
2442
2443         RenderBlockRareData::m_enclosingFragmentedFlow should be WeakPtr
2444         https://bugs.webkit.org/show_bug.cgi?id=182045
2445         <rdar://problem/36334787>
2446
2447         Reviewed by Zalan Bujtas.
2448
2449         For safety.
2450
2451         * rendering/RenderBlock.cpp:
2452         (WebCore::RenderBlock::cachedEnclosingFragmentedFlow const):
2453         (WebCore::RenderBlock::updateCachedEnclosingFragmentedFlow const):
2454         (WebCore::RenderBlock::locateEnclosingFragmentedFlow const):
2455
2456 2018-01-23  Dean Jackson  <dino@apple.com>
2457
2458         REGRESSION (r222961?): sRGB images shown in WebGL are over-saturated on a wide gamut monitor
2459         https://bugs.webkit.org/show_bug.cgi?id=182033
2460         <rdar://problem/36377780>
2461
2462         Reviewed by Antoine Quint.
2463
2464         My fix for YouTube360 changed the way we composite WebGL on macOS. Unfortunately it dropped
2465         a flag telling the compositor the colorspace of the content should be sRGB. Reinstate this
2466         by explicitly setting the colorspace on the IOSurface we use for WebGL back buffers.
2467
2468         This *should* be covered by the test in:
2469         fast/canvas/webgl/match-page-color-space.html
2470         ... however, it shows a problem with our testing infrastructure. As long as it is not
2471         testing on a Wide Gamut display, and explicitly setting the color profile, an automated
2472         test won't pick up this regression. I could add an Internals helper to query the colorspace
2473         of the WebGL content, but that doesn't actually verify the composited result, which is
2474         all that matters.
2475
2476         * platform/graphics/cocoa/WebGLLayer.mm:
2477         (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
2478
2479 2018-01-24  Ms2ger  <Ms2ger@igalia.com>
2480
2481         [GTK] Fix some test failures in ATK selection handling.
2482         https://bugs.webkit.org/show_bug.cgi?id=168369
2483         <rdar://problem/30534881>
2484
2485         Reviewed by Joanmarie Diggs.
2486
2487         In r208479, selectionBelongsToObject was changed to return false if the
2488         intersectsNode call returns an exception.
2489
2490         In particular, this caused accessibility/gtk/text-at-offset-textarea.html
2491         to fail. In this test, the selection is situated in the shadow DOM of the
2492         textarea, while the node that is checked for intersection is the textarea
2493         itself. In line with the standard, intersectsNode returns an exception in
2494         this case.
2495
2496         This caused webkitAccessibleText{Word, Line, Sentence}ForBoundary to stop
2497         returning the expected text in the tested case. Removing this check fixes
2498         the test, along with some others.
2499
2500         Tests: accessibility/gtk/text-at-offset-textarea.html
2501                accessibility/gtk/text-at-offset-textinput.html
2502                accessibility/selected-text-range-aria-elements.html
2503                accessibility/textarea-selected-text-range.html
2504
2505         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
2506         (getSelectionOffsetsForObject): Remove the selectionBelongsToObject() call.
2507
2508 2018-01-18  Sergio Villar Senin  <svillar@igalia.com>
2509
2510         [WebVR] Add OpenVR to the tree and to the build
2511         https://bugs.webkit.org/show_bug.cgi?id=177298
2512
2513         Reviewed by Žan Doberšek.
2514
2515         Added build dependencies with the OpenVR library.
2516
2517         * CMakeLists.txt:
2518
2519 2018-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
2520
2521         Harden against layout passes triggered when iterating through HTMLFormElement::associatedElements
2522         https://bugs.webkit.org/show_bug.cgi?id=182037
2523         <rdar://problem/36747812>
2524
2525         Reviewed by Ryosuke Niwa.
2526
2527         Observe that HTMLFormElement::associatedElements returns a const reference to a Vector of raw
2528         FormAssociatedElement pointers. In various call sites that iterate through these associated elements using this
2529         function, some require synchronous layout updates per iteration, which can lead to a bad time when combined with
2530         the first observation.
2531
2532         To address this, we introduce HTMLFormElement::copyAssociatedElementsVector. This returns a new vector
2533         containing strong Refs to each associated element. From each call site that may trigger synchronous layout and
2534         execute arbitrary script while iterating over associated form elements, we instead use iterate over protected
2535         FormAssociatedElements.
2536
2537         From each call site that currently doesn't (and shouldn't) require a layout update, we use the old version that
2538         returns a list of raw FormAssociatedElement pointers, but add ScriptDisallowedScopes to ensure that we never
2539         execute script there in the future.
2540
2541         Test: fast/forms/form-data-associated-element-iteration.html
2542
2543         * html/DOMFormData.cpp:
2544         (WebCore::DOMFormData::DOMFormData):
2545
2546         Change to use copyAssociatedElementsVector().
2547
2548         * html/FormController.cpp:
2549         (WebCore::recordFormStructure):
2550         (WebCore::FormController::restoreControlStateIn):
2551
2552         Change to use copyAssociatedElementsVector().
2553
2554         * html/HTMLFieldSetElement.cpp:
2555         (WebCore::HTMLFieldSetElement::copyAssociatedElementsVector const):
2556         (WebCore:: const):
2557         (WebCore::HTMLFieldSetElement::length const):
2558
2559         Refactor to use unsafeAssociatedElements().
2560
2561         * html/HTMLFieldSetElement.h:
2562         * html/HTMLFormControlsCollection.cpp:
2563         (WebCore:: const):
2564         (WebCore::HTMLFormControlsCollection::copyFormControlElementsVector const):
2565         (WebCore::HTMLFormControlsCollection::customElementAfter const):
2566         (WebCore::HTMLFormControlsCollection::updateNamedElementCache const):
2567
2568         Refactor these to use unsafeAssociatedElements().
2569
2570         * html/HTMLFormControlsCollection.h:
2571         * html/HTMLFormElement.cpp:
2572         (WebCore::HTMLFormElement::unsafeAssociatedElements const):
2573         (WebCore::HTMLFormElement::copyAssociatedElementsVector const):
2574         * html/HTMLFormElement.h:
2575         * loader/FormSubmission.cpp:
2576         (WebCore::FormSubmission::create):
2577
2578         Refactor to use copyAssociatedElementsVector().
2579
2580 2018-01-23  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2581
2582         [Curl] Fix wrong redirection with relative url when it happens from
2583         different host than original host.
2584         https://bugs.webkit.org/show_bug.cgi?id=181873
2585
2586         Reviewed by Alex Christensen.
2587
2588         * platform/network/curl/CurlDownload.cpp:
2589         (WebCore::CurlDownload::willSendRequest):
2590         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
2591         (WebCore::ResourceHandleCurlDelegate::willSendRequest):
2592
2593 2018-01-23  Eric Carlson  <eric.carlson@apple.com>
2594
2595         Resign NowPlaying status when no media element is eligible
2596         https://bugs.webkit.org/show_bug.cgi?id=181914
2597         <rdar://problem/35294116>
2598
2599         Reviewed by Jer Noble.
2600
2601         Updated API test.
2602
2603         * html/HTMLMediaElement.cpp:
2604         (WebCore::HTMLMediaElement::removedFromAncestor): Call mediaSession->clientCharacteristicsChanged
2605         so NowPlaying status will be updated.
2606
2607         * html/MediaElementSession.cpp:
2608         (WebCore::MediaElementSession::playbackPermitted const): Return early when the media 
2609         element has been suspended.
2610         (WebCore::MediaElementSession::canShowControlsManager const): Return false when being queried
2611         for NowPlaying status in an inactive document or when element has been suspended.
2612         (WebCore::isMainContentForPurposesOfAutoplay): Return early if it isn't safe to update
2613         style because HitTest can force a layout.
2614         (WebCore::MediaElementSession::updateIsMainContent const): Ditto.
2615
2616         * platform/audio/PlatformMediaSessionManager.cpp:
2617         (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Implement in for all
2618         ports.
2619         * platform/audio/PlatformMediaSessionManager.h:
2620         (WebCore::PlatformMediaSessionManager::registeredAsNowPlayingApplication const):
2621         * platform/audio/ios/MediaSessionManagerIOS.h:
2622         * platform/audio/mac/MediaSessionManagerMac.h:
2623         * platform/audio/mac/MediaSessionManagerMac.mm:
2624         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): Call MRMediaRemoteSetCanBeNowPlayingApplication
2625         whenever status changes.
2626         (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Deleted, implemented
2627         in the base class.
2628
2629 2018-01-23  Alex Christensen  <achristensen@webkit.org>
2630
2631         Use CompletionHandlers for ResourceHandleClient::didReceiveResponseAsync
2632         https://bugs.webkit.org/show_bug.cgi?id=181961
2633
2634         Reviewed by Michael Catanzaro.
2635
2636         No change in behavior.
2637
2638         * loader/ResourceLoader.cpp:
2639         (WebCore::ResourceLoader::didReceiveResponseAsync):
2640         * loader/ResourceLoader.h:
2641         * loader/appcache/ApplicationCacheGroup.cpp:
2642         (WebCore::ApplicationCacheGroup::didReceiveResponseAsync):
2643         * loader/appcache/ApplicationCacheGroup.h:
2644         * platform/network/BlobResourceHandle.cpp:
2645         (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
2646         (WebCore::BlobResourceHandle::notifyResponseOnError):
2647         (WebCore::BlobResourceHandle::continueDidReceiveResponse): Deleted.
2648         * platform/network/BlobResourceHandle.h:
2649         * platform/network/PingHandle.h:
2650         * platform/network/ResourceHandle.cpp:
2651         (WebCore::ResourceHandle::didReceiveResponse):
2652         * platform/network/ResourceHandle.h:
2653         * platform/network/ResourceHandleClient.h:
2654         * platform/network/SynchronousLoaderClient.cpp:
2655         (WebCore::SynchronousLoaderClient::didReceiveResponseAsync):
2656         * platform/network/SynchronousLoaderClient.h:
2657         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
2658         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
2659         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueDidReceiveResponse): Deleted.
2660         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
2661         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse):
2662         (WebCore::ResourceHandleCurlDelegate::handleDataURL):
2663         (WebCore::ResourceHandleCurlDelegate::continueDidReceiveResponse): Deleted.
2664         * platform/network/mac/ResourceHandleMac.mm:
2665         (WebCore::ResourceHandle::continueDidReceiveResponse): Deleted.
2666         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
2667         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2668         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
2669         (-[WebCoreResourceHandleAsOperationQueueDelegate continueDidReceiveResponse]): Deleted.
2670         * platform/network/soup/ResourceHandleSoup.cpp:
2671         (WebCore::nextMultipartResponsePartCallback):
2672         (WebCore::sendRequestCallback):
2673         (WebCore::ResourceHandle::continueDidReceiveResponse): Deleted.
2674
2675 2018-01-23  Chris Dumez  <cdumez@apple.com>
2676
2677         Unreviewed, rollout r227216 as it seems to be causing deadlocks
2678         https://bugs.webkit.org/show_bug.cgi?id=182013
2679
2680         * page/ChromeClient.h:
2681         * testing/Internals.cpp:
2682         (WebCore::Internals::testIncomingSyncIPCMessageWhileWaitingForSyncReply): Deleted.
2683         * testing/Internals.h:
2684         * testing/Internals.idl:
2685
2686 2018-01-23  Ali Juma  <ajuma@chromium.org>
2687
2688         REGRESSION (r226622): ASSERTION FAILED: !m_frame in WebCore::DOMWindowProperty::willDestroyGlobalObjectInCachedFrame()
2689         https://bugs.webkit.org/show_bug.cgi?id=181756
2690
2691         Reviewed by Simon Fraser.
2692
2693         Don't create a VisualViewport for a suspended DOMWindow. When a DOMWindow is suspended
2694         for document suspension, all DOMWindowProperties are disconnected from their frame.
2695         Creating a new VisualViewport while in this state means unexpectedly having a DOMWindowProperty
2696         that's connected to a frame, and this leads to an assertion failure.
2697
2698         Test: http/tests/navigation/https-in-page-cache.html
2699
2700         * page/DOMWindow.cpp:
2701         (WebCore::DOMWindow::visualViewport const):
2702         Don't create a VisualViewport while suspended.
2703         * page/FrameView.cpp:
2704         (WebCore::FrameView::updateLayoutViewport):
2705         Handle null DOMWindow::visualViewport.
2706
2707 2018-01-23  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2708
2709         [Curl] CurlRequest must protect its client from disposal while it's on duty.
2710         https://bugs.webkit.org/show_bug.cgi?id=181875
2711
2712         Reviewed by Alex Christensen.
2713
2714         No new tests. It's covered by existing tests.
2715
2716         * platform/network/curl/CurlDownload.h:
2717         * platform/network/curl/CurlRequest.cpp:
2718         (WebCore::CurlRequest::callClient):
2719         (WebCore::CurlRequest::didReceiveData):
2720         (WebCore::CurlRequest::didReceiveDataFromMultipart):
2721         (WebCore::CurlRequest::didCompleteTransfer):
2722         (WebCore::CurlRequest::invokeDidReceiveResponse):
2723         * platform/network/curl/CurlRequest.h:
2724         * platform/network/curl/CurlRequestClient.h:
2725         * platform/network/curl/ResourceHandleCurlDelegate.h:
2726
2727 2018-01-23  Commit Queue  <commit-queue@webkit.org>
2728
2729         Unreviewed, rolling out r227437.
2730         https://bugs.webkit.org/show_bug.cgi?id=182011
2731
2732         broke build (Requested by alexchristensen on #webkit).
2733
2734         Reverted changeset:
2735
2736         "Remove unused QTKit preference"
2737         https://bugs.webkit.org/show_bug.cgi?id=181968
2738         https://trac.webkit.org/changeset/227437
2739
2740 2018-01-23  Antoine Quint  <graouts@apple.com>
2741
2742         [Web Animations] Expose getKeyframes() and parsing of remaining keyframe properties
2743         https://bugs.webkit.org/show_bug.cgi?id=181978
2744
2745         Not reviewed.
2746
2747         Fix failures for http/wpt/web-animations/interfaces/AnimationEffectTiming/easing.html introduced in the previous patch.
2748         Those keyword values are not expected.
2749
2750         * platform/animation/TimingFunction.cpp:
2751         (WebCore::TimingFunction::cssText const):
2752
2753 2018-01-23  Simon Fraser  <simon.fraser@apple.com>
2754
2755         feMorphology stops applying if either x or y radius is 0 but should not.
2756         https://bugs.webkit.org/show_bug.cgi?id=181903
2757
2758         Reviewed by Dean Jackson.
2759         
2760         feMorphology should allow the radius on one axis to be zero but still apply the effect
2761         (it's akin to a blur on just one axis). Also, any negative radius, or zero on both axes
2762         should act like a pass-through, rather than outputting transparent blank (this is a spec
2763         change from SVG 1.1 to SVG 2).
2764
2765         Tests: svg/filters/feMorphology-zero-radius-one-axis-expected.svg
2766                svg/filters/feMorphology-zero-radius-one-axis.svg
2767
2768         * platform/graphics/filters/FEMorphology.cpp:
2769         (WebCore::FEMorphology::platformApplyDegenerate):
2770         * platform/graphics/filters/FilterEffect.cpp:
2771         (WebCore::FilterEffect::createImageBufferResult):
2772
2773 2018-01-23  Alex Christensen  <achristensen@webkit.org>
2774
2775         Remove unused MediaPlayerSupportsTypeClient
2776         https://bugs.webkit.org/show_bug.cgi?id=182003
2777
2778         Reviewed by Sam Weinig.
2779
2780         This was used for a QTKit-specific hack I removed in r227372.
2781
2782         * Modules/encryptedmedia/CDM.cpp:
2783         (WebCore::CDM::getSupportedCapabilitiesForAudioVideoType):
2784         * Modules/mediasource/MediaSource.cpp:
2785         (WebCore::MediaSource::isTypeSupported):
2786         * dom/DOMImplementation.cpp:
2787         (WebCore::DOMImplementation::createDocument):
2788         (WebCore::DOMImplementationSupportsTypeClient::DOMImplementationSupportsTypeClient): Deleted.
2789         (): Deleted.
2790         * html/HTMLMediaElement.cpp:
2791         (WebCore::HTMLMediaElement::canPlayType const):
2792         (WebCore::HTMLMediaElement::selectNextSourceChild):
2793         (WebCore::HTMLMediaElement::mediaPlayerNeedsSiteSpecificHacks const): Deleted.
2794         (WebCore::HTMLMediaElement::mediaPlayerDocumentHost const): Deleted.
2795         * html/HTMLMediaElement.h:
2796         * platform/graphics/MediaPlayer.cpp:
2797         (WebCore::MediaPlayer::supportsType):
2798         * platform/graphics/MediaPlayer.h:
2799         (WebCore::MediaPlayerSupportsTypeClient::mediaPlayerNeedsSiteSpecificHacks const): Deleted.
2800         (WebCore::MediaPlayerSupportsTypeClient::mediaPlayerDocumentHost const): Deleted.
2801
2802 2018-01-23  Alex Christensen  <achristensen@webkit.org>
2803
2804         Remove unused QTKit preference
2805         https://bugs.webkit.org/show_bug.cgi?id=181968
2806
2807         Reviewed by Alexey Proskuryakov.
2808
2809         They weren't used and didn't do anything.
2810
2811         * page/DeprecatedGlobalSettings.cpp:
2812         (WebCore::DeprecatedGlobalSettings::setQTKitEnabled): Deleted.
2813         * page/DeprecatedGlobalSettings.h:
2814         (WebCore::DeprecatedGlobalSettings::isQTKitEnabled): Deleted.
2815
2816 2018-01-23  Javier Fernandez  <jfernandez@igalia.com>
2817
2818         [css-align] 'left' and 'right' should parse as invalid in block/cross-axis alignment
2819         https://bugs.webkit.org/show_bug.cgi?id=181792
2820
2821         Reviewed by Antti Koivisto.
2822
2823         The CSS WG resolved to remove the 'left' and 'right' values from the
2824         block/cross axis alignment properties.
2825
2826         https://github.com/w3c/csswg-drafts/issues/1403
2827
2828         This patch changes the CSS parsing logic of all the CSS Box Alignment
2829         properties, both block-axis (align-{self, items, content} and
2830         inline-axis (justify-{self, items, content}).
2831
2832         Additionally, the alignment shorthands (place-{self, items, content})
2833         have been also changed to respect the new syntax.
2834
2835         Despite the number of layout tests changed, I don't think this
2836         change will break any content in current sites. The CSS values
2837         'left' and 'right' were introduced by the new CSS Box Alignment
2838         spec and only implemented by the CSS Grid Layout feature, shipped
2839         last year. Additionally, the removed values have no effect on the
2840         layout result when they are applied to the block/cross-axis CSS
2841         Alignment properties.
2842
2843         Tests: imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-001.html
2844                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-002.html
2845                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-003.html
2846                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-004.html
2847                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-005.html
2848                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-001.html
2849                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-002.html
2850                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-003.html
2851                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-004.html
2852                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-005.html
2853                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-001.html
2854                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-002.html
2855                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-003.html
2856                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-004.html
2857                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-005.html
2858                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-006.html
2859                imported/w3c/web-platform-tests/css/css-align/default-alignment/justify-items-legacy-001.html
2860                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-001.html
2861                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-002.html
2862                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-003.html
2863                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-004.html
2864                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-005.html
2865                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-001.html
2866                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-002.html
2867                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-003.html
2868                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-004.html
2869                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-005.html
2870                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-006.html
2871                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-001.html
2872                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-002.html
2873                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-003.html
2874                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-004.html
2875                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-005.html
2876                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-006.html
2877                imported/w3c/web-platform-tests/css/css-align/distribution-values/space-evenly-001.html
2878                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-001.html
2879                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-002.html
2880                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-003.html
2881                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-004.html
2882                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-005.html
2883                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-001.html
2884                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-002.html
2885                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-003.html
2886                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-004.html
2887                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-005.html
2888                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-001.html
2889                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-002.html
2890                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-003.html
2891                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-004.html
2892                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-005.html
2893                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-006.html
2894
2895         * css/parser/CSSPropertyParser.cpp:
2896         (WebCore::isLeftOrRightKeyword):
2897         (WebCore::isContentPositionKeyword):
2898         (WebCore::isContentPositionOrLeftOrRightKeyword):
2899         (WebCore::consumeContentDistributionOverflowPosition):
2900         (WebCore::isSelfPositionKeyword):
2901         (WebCore::isSelfPositionOrLeftOrRightKeyword):
2902         (WebCore::consumeSelfPositionOverflowPosition):
2903         (WebCore::consumeAlignItems):
2904         (WebCore::consumeJustifyItems):
2905         (WebCore::CSSPropertyParser::parseSingleValue):
2906         (WebCore::consumeSimplifiedContentPosition):
2907         (WebCore::CSSPropertyParser::consumePlaceContentShorthand):
2908         (WebCore::consumeSimplifiedItemPosition):
2909         (WebCore::CSSPropertyParser::consumePlaceItemsShorthand):
2910         (WebCore::CSSPropertyParser::consumePlaceSelfShorthand):
2911
2912 2018-01-23  Simon Fraser  <simon.fraser@apple.com>
2913
2914         Element with position:fixed stops scrolling at the bottom of the page, but is painted in the right place on Chacos.com.
2915         https://bugs.webkit.org/show_bug.cgi?id=181741
2916         rdar://problem/36593581
2917
2918         Reviewed by Tim Horton.
2919
2920         The #ifdef for iOS was wrong; on iOS, visibleSize() is in content coordinates and matches
2921         unscaledDocumentRect, so there's no need to scale it. Doing so computed the wrong unscaledMaximumScrollPosition
2922         which broke hit-testing when the document minimum scale was > 1.
2923
2924         Test: fast/visual-viewport/ios/min-scale-greater-than-one.html
2925
2926         * page/FrameView.cpp:
2927         (WebCore::FrameView::unscaledMaximumScrollPosition const):
2928
2929 2018-01-23  Antoine Quint  <graouts@apple.com>
2930
2931         [Web Animations] Expose getKeyframes() and parsing of remaining keyframe properties
2932         https://bugs.webkit.org/show_bug.cgi?id=181978
2933         <rdar://problem/36772586>
2934
2935         Reviewed by Dean Jackson.
2936
2937         We finish our implementation of multiple keyframes by exposing the getKeyframes() method on KeyframeEffect and
2938         parsing the remaining properties that can be exposed on keyframes: "easing" and "composite". And since we parse
2939         those properties on keyframes, we also parse "easing" on AnimationEffectTiming and "composite" and "iterationComposite"
2940         on KeyframeEffect. 
2941
2942         To support this, we implement a new TimingFunction::createFromCSSText() method which takes in a string that is
2943         a value provided directly via the JS API. As its converse, we expose a TimingFunction::cssText() method which
2944         provides a string that can be sent back to JS to represent a timing function, using keywords when the timing
2945         function matches one and ommitting default values.
2946
2947         We now also keep track of the original "offset" value provided through the JS API since that value is required
2948         when calling getKeyframes() and distinct from the "computedOffset". These original offsets, composite operations
2949         and timing functions are kept as separate Vectors from the KeyframeList since this type does not support exposing
2950         those. We may consider improving that in a future patch.
2951
2952         Finally, we make some adjustments in the keyframe parsing to comply with the specification and correctly parse
2953         all provided timing functions, regardless of the number of keyframes and timing functions provided.
2954
2955         Note that this patch is only about parsing, storing and returning provided easing and composite operations but
2956         that such values will only be used for the resolution of animation effects in future patches.
2957
2958         * animation/AnimationEffect.cpp:
2959         (WebCore::AnimationEffect::getComputedTiming): Set the "easing" property on the getComputedTiming() return value
2960         now that we expose "easing" on AnimationEffectTiming.
2961         * animation/AnimationEffectTiming.cpp:
2962         (WebCore::AnimationEffectTiming::AnimationEffectTiming): Create a linear TimingFunction by default.
2963         (WebCore::AnimationEffectTiming::setEasing): Parse the "easing" value and propagate an exception for invalid values.
2964         * animation/AnimationEffectTiming.h: Expose the new "easing" property and backing TimingFunction.
2965         * animation/AnimationEffectTiming.idl: Expose the new "easing" property.
2966         * animation/KeyframeEffect.cpp:
2967         (WebCore::CSSPropertyIDToIDLAttributeName): Provide a way to convert the name of a CSS property to a string that can
2968         be used to generate a JS property name for use by getKeyframes().
2969         (WebCore::computeMissingKeyframeOffsets): Implement the full steps of the spec.
2970         (WebCore::processIterableKeyframes): Fix a problematic declaration for the easing variable.
2971         (WebCore::processPropertyIndexedKeyframes): Now that ProcessedKeyframe has both an offset and a computedOffset, use
2972         computed offsets. We also fix a couple of loops to fix compliance issues revealed by WPT tests.
2973         (WebCore::KeyframeEffect::create): Parse the provided "easing" property on the KeyframeEffectOptions object.
2974         (WebCore::KeyframeEffect::getKeyframes): Implement the getKeyframes() method as mandated by the spec.
2975         (WebCore::KeyframeEffect::processKeyframes): Keep a list of unused easings so these might be parsed as well, and
2976         potentially throw exceptions, as mandated by the spec. For valid easings, store their matching TimingFunction in
2977         m_timingFunctions, original offset values in m_offsets and CompositeOperation values in m_compositeOperations.
2978         * animation/KeyframeEffect.h: Switch the order in which we specify some of the Variant types so that default values
2979         are correctly used.
2980         * animation/KeyframeEffect.idl: Switch the order in which we specify some of the Variant types so that default values
2981         are correctly used.
2982         * platform/animation/TimingFunction.cpp:
2983         (WebCore::TimingFunction::createFromCSSText):
2984         (WebCore::TimingFunction::cssText const):
2985         * platform/animation/TimingFunction.h:
2986
2987 2018-01-23  Brady Eidson  <beidson@apple.com>
2988
2989         Allow passing MessagePorts across processes (e.g. ServiceWorkers).
2990         https://bugs.webkit.org/show_bug.cgi?id=181178
2991
2992         Reviewed by Andy Estes.
2993
2994         Test: http/tests/workers/service/basic-messageport.html
2995
2996         * dom/MessagePort.cpp:
2997         (WebCore::MessagePort::MessagePort):
2998         (WebCore::MessagePort::~MessagePort):
2999
3000         * dom/messageports/MessagePortChannel.cpp:
3001         (WebCore::MessagePortChannel::entanglePortWithProcess):
3002         * dom/messageports/MessagePortChannel.h:
3003
3004         * workers/service/SWClientConnection.cpp:
3005         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
3006         * workers/service/SWClientConnection.h:
3007
3008         * workers/service/ServiceWorker.cpp:
3009         (WebCore::ServiceWorker::postMessage):
3010
3011         * workers/service/ServiceWorkerClient.cpp:
3012         (WebCore::ServiceWorkerClient::postMessage):
3013
3014         * workers/service/context/SWContextManager.cpp:
3015         (WebCore::SWContextManager::postMessageToServiceWorker):
3016         * workers/service/context/SWContextManager.h:
3017
3018 2018-01-23  Commit Queue  <commit-queue@webkit.org>
3019
3020         Unreviewed, rolling out r227279 and r227373.
3021         https://bugs.webkit.org/show_bug.cgi?id=181988
3022
3023         The LayoutTest crash fix introduced an API test failure.
3024         (Requested by ryanhaddad on #webkit).
3025
3026         Reverted changesets:
3027
3028         "Resign NowPlaying status when no media element is eligible"
3029         https://bugs.webkit.org/show_bug.cgi?id=181914
3030         https://trac.webkit.org/changeset/227279
3031
3032         "Resign NowPlaying status when no media element is eligible"
3033         https://bugs.webkit.org/show_bug.cgi?id=181914
3034         https://trac.webkit.org/changeset/227373
3035
3036 2018-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
3037
3038         Unreviewed, fix some format specifiers added in r227190
3039         https://bugs.webkit.org/show_bug.cgi?id=181454
3040
3041         * dom/messageports/MessagePortChannel.cpp:
3042         (WebCore::MessagePortChannel::takeAllMessagesForPort):
3043
3044 2018-01-23  Ting-Wei Lan  <lantw44@gmail.com>
3045
3046         [GTK] Add user agent quirk for Microsoft Outlook Web App
3047         https://bugs.webkit.org/show_bug.cgi?id=181982
3048
3049         Reviewed by Michael Catanzaro.
3050
3051         Microsoft Outlook Web App forces users to switch to the lite version on
3052         the login page with our standard user agent on all non-macOS systems.
3053         Since it is an application that can be installed by different companies,
3054         schools and organizations, it is not possible to fix the issue unless
3055         we keep a big list of host names that are known to run it. We check the
3056         host name instead of the base domain name here because it is not
3057         expected to run all sites under a base domain on this webmail and
3058         calendar application.
3059
3060         https://mail.ntu.edu.tw is a site that is known to run Microsoft Outlook
3061         Web App for several years, and it is not likely to change. When there
3062         are other sites found to run it and having the same user agent problem,
3063         we can expand the list to include them.
3064
3065         * platform/UserAgentQuirks.cpp:
3066         (WebCore::urlRequiresMacintoshPlatform):
3067
3068 2018-01-23  Yacine Bandou  <yacine.bandou_ext@softathome.com>
3069
3070         [EME] Add support of multi keys from different sessions in CDMinstanceClearKey
3071         https://bugs.webkit.org/show_bug.cgi?id=180083
3072
3073         Reviewed by Xabier Rodriguez-Calvar.
3074
3075         Add support of multi keys from different MediaKeySession in CDMInstanceClearKey.
3076
3077         Currently the CDMInstanceClearKey manages two "m_keys", one is a WTF::Vector
3078         where it stores the list of last added keys, an other which is defined in the
3079         ClearKeyState::singleton it is a WTF::HashMap, in this last one, it stores the
3080         keys lists of each created session.
3081
3082         The method "keys()" of CDMInstanceClearKey returns the first "m_keys" which
3083         contains just the list of last keys.
3084
3085         The goal of this commit is to return all keys lists of all sessions, thus
3086         we remove the "m_keys" which is WTF::Vector and we modify the method
3087         "keys()" to return all keys lists, which is stored in "m_keys" WTF::HashMap,
3088         in one Vector instead of return just the list of last keys.
3089
3090         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
3091         (WebCore::CDMInstanceClearKey::keys const):
3092         (WebCore::CDMInstanceClearKey::updateLicense):
3093         * platform/encryptedmedia/clearkey/CDMClearKey.h:
3094
3095 2018-01-22  Simon Fraser  <simon.fraser@apple.com>
3096
3097         Optimize building the non-fast scrollable region with multiple iframes
3098         https://bugs.webkit.org/show_bug.cgi?id=181971
3099
3100         Reviewed by Zalan Bujtas.
3101
3102         AsyncScrollingCoordinator::frameViewLayoutUpdated() is called every time a subframe lays out.
3103         We don't need to eagerly update the non-fast scrollable region at this time; we can just mark
3104         it dirty, and rely on the existing scrolling tree commit code to recompute it.
3105
3106         On my machine this makes fast/frames/lots-of-objects.html no longer a timeout.
3107
3108         * page/scrolling/AsyncScrollingCoordinator.cpp:
3109         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
3110
3111 2018-01-22  Jiewen Tan  <jiewen_tan@apple.com>
3112
3113         [WebAuthN] Implement PublicKeyCredential's [[Create]] with a dummy authenticator
3114         https://bugs.webkit.org/show_bug.cgi?id=181928
3115         <rdar://problem/36459893>
3116
3117         Reviewed by Brent Fulgham.
3118
3119         This patch implements PublicKeyCredential's [[Create]] from https://www.w3.org/TR/webauthn/#createCredential
3120         as of 5 December 2017. In order to do testing, a dummy authenticator is implemented to exercise a failure
3121         and a pass path. A number of dependencies need to be resolved later in order to comply with the spec.
3122         Also, the current architecture of handling async WebAuthN operations including dispatching, timeout, and aborting
3123         might need a redesign once the underlying authenticator is clear. Since this is our first attempt to implement
3124         a prototype, all those limitations, in my opinion, can be marked as non-blocking to accelerate the whole
3125         process. Those limitations will then be addressed once the first prototype is finshed.
3126
3127         Tests: http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https.html
3128                http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html
3129                http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html
3130                http/wpt/webauthn/idl.https.html
3131                http/wpt/webauthn/public-key-credential-create-failure.https.html
3132                http/wpt/webauthn/public-key-credential-create-success.https.html
3133
3134         * Modules/credentialmanagement/BasicCredential.h:
3135         * Modules/credentialmanagement/BasicCredential.idl:
3136         * Modules/credentialmanagement/CredentialsContainer.cpp:
3137         (WebCore::CredentialsContainer::PendingPromise::PendingPromise):
3138         (WebCore::CredentialsContainer::dispatchTask):
3139         (WebCore::CredentialsContainer::get):
3140         (WebCore::CredentialsContainer::isCreate):
3141         (WebCore::CredentialsContainer::preventSilentAccess const):
3142         (WebCore::CredentialsContainer::preventSilentAccess): Deleted.
3143         * Modules/credentialmanagement/CredentialsContainer.h:
3144         (WebCore::CredentialsContainer::PendingPromise::create):
3145         * Modules/webauthn/Authenticator.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp.
3146         (WebCore::Authenticator::singleton):
3147         (WebCore::Authenticator::makeCredential const):
3148         * Modules/webauthn/Authenticator.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h.
3149         * Modules/webauthn/AuthenticatorAssertionResponse.cpp:
3150         (WebCore::AuthenticatorAssertionResponse::authenticatorData const):
3151         (WebCore::AuthenticatorAssertionResponse::signature const):
3152         (WebCore::AuthenticatorAssertionResponse::userHandle const):
3153         (WebCore::AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse): Deleted.
3154         (WebCore::AuthenticatorAssertionResponse::authenticatorData): Deleted.
3155         (WebCore::AuthenticatorAssertionResponse::signature): Deleted.
3156         (WebCore::AuthenticatorAssertionResponse::userHandle): Deleted.
3157         * Modules/webauthn/AuthenticatorAssertionResponse.h:
3158         (WebCore::AuthenticatorAssertionResponse::create):
3159         * Modules/webauthn/AuthenticatorAttestationResponse.cpp:
3160         (WebCore::AuthenticatorAttestationResponse::attestationObject const):
3161         (WebCore::AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse): Deleted.
3162         (WebCore::AuthenticatorAttestationResponse::attestationObject): Deleted.
3163         * Modules/webauthn/AuthenticatorAttestationResponse.h:
3164         (WebCore::AuthenticatorAttestationResponse::create):
3165         * Modules/webauthn/AuthenticatorResponse.cpp:
3166         (WebCore::AuthenticatorResponse::clientDataJSON const):
3167         (WebCore::AuthenticatorResponse::~AuthenticatorResponse): Deleted.
3168         (WebCore::AuthenticatorResponse::clientDataJSON): Deleted.
3169         * Modules/webauthn/AuthenticatorResponse.h:
3170         * Modules/webauthn/AuthenticatorResponse.idl:
3171         * Modules/webauthn/PublicKeyCredential.cpp:
3172         (WebCore::PublicKeyCredentialInternal::produceClientDataJson):
3173         (WebCore::PublicKeyCredentialInternal::produceClientDataJsonHash):
3174         (WebCore::PublicKeyCredentialInternal::getIdFromAttestationObject):
3175         (WebCore::PublicKeyCredential::PublicKeyCredential):
3176         (WebCore::PublicKeyCredential::discoverFromExternalSource):
3177         (WebCore::PublicKeyCredential::create):
3178         (WebCore::PublicKeyCredential::rawId const):
3179         (WebCore::PublicKeyCredential::response const):
3180         (WebCore::PublicKeyCredential::getClientExtensionResults const):
3181         (WebCore::PublicKeyCredential::rawId): Deleted.
3182         (WebCore::PublicKeyCredential::response): Deleted.
3183         (WebCore::PublicKeyCredential::getClientExtensionResults): Deleted.
3184         * Modules/webauthn/PublicKeyCredential.h:
3185         * Modules/webauthn/PublicKeyCredential.idl:
3186         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
3187         (): Deleted.
3188         * Modules/webauthn/PublicKeyCredentialDescriptor.h:
3189         * Modules/webauthn/PublicKeyCredentialDescriptor.idl:
3190         * Sources.txt:
3191         * WebCore.xcodeproj/project.pbxproj:
3192         * bindings/js/JSAuthenticatorResponseCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorAttestationResponse.cpp.
3193         (WebCore::toJSNewlyCreated):
3194         (WebCore::toJS):
3195         * bindings/js/JSBasicCredentialCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp.
3196         (WebCore::toJSNewlyCreated):
3197         (WebCore::toJS):
3198         * bindings/js/JSBindingsAllInOne.cpp:
3199
3200 2018-01-22  Myles C. Maxfield  <mmaxfield@apple.com>
3201
3202         [Cocoa] Support font collections
3203         https://bugs.webkit.org/show_bug.cgi?id=181826
3204         <rdar://problem/36455137>
3205
3206         Reviewed by Dean Jackson.
3207
3208         Use the CoreText call CTFontManagerCreateFontDescriptorsFromData() to get all the descriptors inside
3209         the collection file. We select which one by using the fragment identifier at the end of the url linking
3210         to the remote font. For example, to select the 4th font inside a TTC file, the @font-face block would
3211         look like:
3212
3213         @font-face {
3214             font-family: "MyFont";
3215             src: url("path/to/font.ttc#4");
3216         }
3217
3218         Note that these numbers are 1-indexed.
3219
3220         The CSS Fonts spec states:
3221         > Fragment identifiers are used to indicate which font to load. If a container format lacks a defined
3222         > fragment identifier scheme, implementations should use a simple 1-based indexing scheme (e.g.
3223         > "font-collection#1" for the first font, "font-collection#2" for the second font).
3224
3225         Not only are TTC font collections supported, but WOFF2 font collections are also supported, which is
3226         increasingly important web standard.
3227
3228         No new tests because I don't have a font collection file with the appropriate license for the
3229         WebKit repository. I tested manually.
3230
3231         * css/CSSFontFaceSource.cpp:
3232         (WebCore::CSSFontFaceSource::load):
3233         * loader/cache/CachedFont.cpp:
3234         (WebCore::CachedFont::calculateIndex const):
3235         (WebCore::CachedFont::ensureCustomFontData):
3236         (WebCore::CachedFont::createCustomFontData):
3237         * loader/cache/CachedFont.h:
3238         * platform/graphics/cairo/FontCustomPlatformData.h:
3239         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
3240         (WebCore::createFontCustomPlatformData):
3241         * platform/graphics/mac/FontCustomPlatformData.cpp:
3242         (WebCore::createFontCustomPlatformData):
3243         * platform/graphics/mac/FontCustomPlatformData.h:
3244         * platform/graphics/win/FontCustomPlatformData.cpp:
3245         (WebCore::createFontCustomPlatformData):
3246         * platform/graphics/win/FontCustomPlatformData.h:
3247         * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
3248         (WebCore::createFontCustomPlatformData):
3249
3250 2018-01-22  Simon Fraser  <simon.fraser@apple.com>
3251
3252         REGRESSION (r227011): fast/frames/hidpi-position-iframe-on-device-pixel.html times out
3253         https://bugs.webkit.org/show_bug.cgi?id=181959
3254
3255         Reviewed by Zalan Bujtas.
3256
3257         This test creates 300 iframes, which became slow after r227011 because they all became part
3258         of the non-fast scrollable region, slowing down ScrollingCoordinator::absoluteEventTrackingRegionsForFrame().
3259
3260         Fix by not adding non-scrollable iframes, and making FrameView::isScrollable() more efficient for frames
3261         that have not done layout yet.
3262
3263         * page/FrameView.cpp:
3264         (WebCore::FrameView::isScrollable):
3265         (WebCore::FrameView::addChild):
3266
3267 2018-01-22  Dan Bernstein  <mitz@apple.com>
3268
3269         Fixed building for macOS 10.12 with the macOS 10.13 SDK after r227156.
3270
3271         * Configurations/WebCore.xcconfig:
3272
3273 2018-01-22  Simon Fraser  <simon.fraser@apple.com>
3274
3275         REGRESSION (r226981): ASSERTION FAILED: startY >= 0 && endY <= height && startY < endY in WebCore::FEMorphology::platformApplyGeneric
3276         https://bugs.webkit.org/show_bug.cgi?id=181836
3277
3278         Reviewed by Tim Horton.
3279         
3280         All the filters that use ParallelJobs<> has the same type of bug where very wide but not tall
3281         filter regions could result in computing an optimalThreadNumber that was greater than the
3282         number of rows to process, which resulted in jobs with zero rows to process.
3283
3284         Since we split the work by rows, cap the maximum number of threads to height/8 so that each job
3285         has at least 8 rows of pixels to process. Add some assertions to detect jobs with zero rows.
3286
3287         FEMorphology was also using implicit float -> int conversion to detect integer overflow of radius,
3288         so change that to use explicit clamping.
3289         
3290         Tests: svg/filters/feLighting-parallel-jobs.svg
3291                svg/filters/feTurbulence-parallel-jobs-wide.svg
3292
3293         * platform/graphics/filters/FELighting.cpp:
3294         (WebCore::FELighting::platformApplyGenericPaint):
3295         (WebCore::FELighting::platformApplyGeneric):
3296         * platform/graphics/filters/FEMorphology.cpp:
3297         (WebCore::FEMorphology::platformApplyGeneric):
3298         (WebCore::FEMorphology::platformApply):
3299         (WebCore::FEMorphology::platformApplyDegenerate):
3300         (WebCore::FEMorphology::platformApplySoftware):
3301         * platform/graphics/filters/FETurbulence.cpp:
3302         (WebCore::FETurbulence::fillRegion const):
3303         (WebCore::FETurbulence::platformApplySoftware):
3304
3305 2018-01-22  Eric Carlson  <eric.carlson@apple.com>
3306
3307         Resign NowPlaying status when no media element is eligible
3308         https://bugs.webkit.org/show_bug.cgi?id=181914
3309         <rdar://problem/35294116>
3310
3311         Reviewed by Jer Noble.
3312
3313         No new tests, these changes prevent existing tests from crashing.
3314
3315         * html/HTMLMediaElement.h:
3316         * html/MediaElementSession.cpp:
3317         (WebCore::MediaElementSession::playbackPermitted const): Return early when the media 
3318         element has been suspended.
3319         (WebCore::MediaElementSession::canShowControlsManager const): Return false when the
3320         media element has been suspended.
3321         (WebCore::isMainContentForPurposesOfAutoplay): Return early if it isn't safe to update
3322         style because HitTest can force a layout.
3323         (WebCore::MediaElementSession::updateIsMainContent const): Ditto.
3324
3325 2018-01-22  Alex Christensen  <achristensen@webkit.org>
3326
3327         Begin removing QTKit code
3328         https://bugs.webkit.org/show_bug.cgi?id=181951
3329
3330         Reviewed by Jer Noble.
3331
3332         QTKit was being used on El Capitan and before.
3333
3334         * Configurations/WebCore.xcconfig:
3335         * SourcesMac.txt:
3336         * WebCore.xcodeproj/project.pbxproj:
3337         * platform/graphics/MediaPlayer.cpp:
3338         (WebCore::buildMediaEnginesVector):
3339         (WebCore::MediaPlayer::supportsType):
3340         * platform/graphics/mac/MediaPlayerPrivateQTKit.h: Removed.
3341         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: Removed.
3342         * platform/graphics/mac/MediaTimeQTKit.h: Removed.
3343         * platform/graphics/mac/MediaTimeQTKit.mm: Removed.
3344         * platform/mac/WebVideoFullscreenController.mm:
3345         (-[WebVideoFullscreenController setVideoElement:]):
3346         (-[WebVideoFullscreenController updatePowerAssertions]):
3347
3348 2018-01-22  Per Arne Vollan  <pvollan@apple.com>
3349
3350         [Win] Null pointer crash under WebCore::RenderStyle::colorIncludingFallback.
3351         https://bugs.webkit.org/show_bug.cgi?id=181801
3352         <rdar://problem/35614900>
3353
3354         Reviewed by Brent Fulgham.
3355
3356         Do not paint synchronously when popup items have been added or changed while the popup is visible.
3357         If new popup items have been added after the popup was shown, a synchronous paint operation will
3358         possibly access their style before it is ready, leading to a null pointer crash. The invalidated
3359         area will be painted asynchronously.
3360
3361         No new tests. To reproduce this crash, it is necessary to open a popup with JavaScript, add new
3362         popup items, and then end the test. Opening the popup can be done by sending a mousedown event
3363         with the eventsender. However, on Windows the mousedown event is sent synchronously, and will
3364         block as long as the popup is open and running the popup event loop. This means no JS can be
3365         executed until the popup is closed, causing the test to always time out before new popup items
3366         can be added. I have verified the fix with a manual test case.
3367
3368         * platform/win/PopupMenuWin.cpp:
3369         (WebCore::PopupMenuWin::updateFromElement):
3370
3371 2018-01-22  Chris Dumez  <cdumez@apple.com>
3372
3373         RELEASE_ASSERT(registration) hit in SWServer::installContextData(const ServiceWorkerContextData&)
3374         https://bugs.webkit.org/show_bug.cgi?id=181941
3375         <rdar://problem/36744892>
3376
3377         Reviewed by Youenn Fablet.
3378
3379         Make sure we clear SWServer::m_pendingContextDatas & SWServer::m_pendingJobs as needed
3380         when clearing Website data. Otherwise, we will hit assertion when those gets processed
3381         after the connection to the SW process has been established (not to mentioned we failed
3382         to clear some in-memory data even though the user asked us to).
3383
3384         * workers/service/server/SWServer.cpp:
3385         (WebCore::SWServer::clearAll):
3386         (WebCore::SWServer::clear):
3387
3388 2018-01-22  Ryosuke Niwa  <rniwa@webkit.org>
3389
3390         Blob conversion and sanitization doesn't work with Microsoft Word for Mac 2011
3391         https://bugs.webkit.org/show_bug.cgi?id=181616
3392         <rdar://problem/36484908>
3393
3394         Reviewed by Wenson Hsieh.
3395
3396         The bug was caused by WebContentReader::readHTML and WebContentMarkupReader::readHTML not sanitizing plain HTML string
3397         as done for web archives even when custom pasteboard data is enabled. Fixed the bug by doing the sanitization.
3398
3399         Unfortunately, we can't make file URLs available in this case because WebContent process doesn't have sandbox extensions
3400         to access local files referenced by the HTML source in the clipboard, and we can't make WebContent process request for
3401         a sandbox extension¸on an arbitrary local file, as it would defeat the whole point of sandboxing.
3402
3403         Instead, we strip away all HTML attributes referencing a URL whose scheme is not HTTP, HTTPS, or data when sanitizing
3404         text/html from the clipboard to avoid exposing local file paths, which can reveal privacy & security sensitive data
3405         such as the user's full name, and the location of private containers of other applications in the system.
3406
3407         Tests: PasteHTML.DoesNotSanitizeHTMLWhenCustomPasteboardDataIsDisabled
3408                PasteHTML.DoesNotStripFileURLsWhenCustomPasteboardDataIsDisabled
3409                PasteHTML.ExposesHTMLTypeInDataTransfer
3410                PasteHTML.KeepsHTTPURLs
3411                PasteHTML.SanitizesHTML
3412                PasteHTML.StripsFileURLs
3413
3414         * editing/cocoa/WebContentReaderCocoa.mm:
3415         (WebCore::WebContentReader::readHTML): Fixed the bug by sanitizing the markup, and stripping away file URLs.
3416         (WebCore::WebContentMarkupReader::readHTML): Ditto.
3417         * editing/markup.cpp:
3418         (WebCore::removeSubresourceURLAttributes): Added.
3419         (WebCore::sanitizeMarkup): Added.
3420         * editing/markup.h:
3421
3422 2018-01-22  Chris Dumez  <cdumez@apple.com>
3423
3424         Add release logging to help debug issues related to service workers
3425         https://bugs.webkit.org/show_bug.cgi?id=181935
3426         <rdar://problem/36735900>
3427
3428         Reviewed by Brady Eidson.
3429
3430         * workers/service/ServiceWorker.cpp:
3431         (WebCore::ServiceWorker::ServiceWorker):
3432         (WebCore::ServiceWorker::scheduleTaskToUpdateState):
3433         (WebCore::ServiceWorker::postMessage):
3434         (WebCore::ServiceWorker::isAlwaysOnLoggingAllowed const):
3435         * workers/service/ServiceWorker.h:
3436         * workers/service/ServiceWorkerContainer.cpp:
3437         (WebCore::ServiceWorkerContainer::addRegistration):
3438         (WebCore::ServiceWorkerContainer::removeRegistration):
3439         (WebCore::ServiceWorkerContainer::updateRegistration):
3440         (WebCore::ServiceWorkerContainer::jobFailedWithException):
3441         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
3442         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
3443         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
3444         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
3445         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
3446         (WebCore::ServiceWorkerContainer::isAlwaysOnLoggingAllowed const):
3447         * workers/service/ServiceWorkerContainer.h:
3448         * workers/service/ServiceWorkerRegistration.cpp:
3449         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
3450         (WebCore::ServiceWorkerRegistration::updateStateFromServer):
3451         (WebCore::ServiceWorkerRegistration::scheduleTaskToFireUpdateFoundEvent):
3452         * workers/service/server/SWServer.cpp:
3453         (WebCore::SWServer::scriptContextFailedToStart):
3454         (WebCore::SWServer::didFinishInstall):
3455         (WebCore::SWServer::didFinishActivation):
3456         (WebCore::SWServer::terminateWorkerInternal):
3457         * workers/service/server/SWServerJobQueue.cpp:
3458         (WebCore::SWServerJobQueue::didResolveRegistrationPromise):
3459         (WebCore::SWServerJobQueue::runRegisterJob):
3460
3461 2018-01-22  Youenn Fablet  <youenn@apple.com>
3462
3463         Safari Tech Preview can't use GitHub login at forums.swift.org
3464         https://bugs.webkit.org/show_bug.cgi?id=181908
3465         <rdar://problem/36715111>
3466
3467         Reviewed by Chris Dumez.
3468
3469         Test: http/wpt/service-workers/navigation-redirect.https.html
3470
3471         For subresource loads, redirections will not change who is in charge of continuing the load (service worker or network process).
3472         For navigation loads, we need to match the registration for every redirection since this is using the Manual redirect mode.
3473         This allows starting the load with a service worker and finishing the load with another service worker, which will become the controller.
3474
3475         Implement this by wrapping the registration matching of an URL within DocumentLoader::matchRegistration.
3476         Use that method in DocumentLoader::redirectReceived.
3477
3478         * loader/DocumentLoader.cpp:
3479         (WebCore::DocumentLoader::matchRegistration):
3480         (WebCore::doRegistrationsMatch):
3481         (WebCore::DocumentLoader::redirectReceived):
3482         (WebCore::DocumentLoader::startLoadingMainResource):
3483         * loader/DocumentLoader.h:
3484
3485 2018-01-22  Antti Koivisto  <antti@apple.com>
3486
3487         REGRESSION (Safari 11): Buttons inside a fieldset legend cannot be clicked on in Safari 11
3488         https://bugs.webkit.org/show_bug.cgi?id=179666
3489         <rdar://problem/35534292>
3490
3491         Reviewed by Zalan Bujtas.
3492
3493         The legend element of a fieldset is in the border area, outside the clip rect.
3494         With overflow:hidden mouse events won't reach it.
3495
3496         Test case by Dhaya Benmessaoud.
3497
3498         Test: fast/forms/legend-overflow-hidden-hit-test.html
3499
3500         * rendering/RenderBlock.cpp:
3501         (WebCore::RenderBlock::nodeAtPoint):
3502         (WebCore::RenderBlock::hitTestExcludedChildrenInBorder):
3503
3504         Add a special case to hit testing to handle legend, similarly to what is done for painting.
3505
3506         * rendering/RenderBlock.h:
3507
3508 2018-01-22  Joanmarie Diggs  <jdiggs@igalia.com>
3509
3510         AX: Implement support for Graphics ARIA roles
3511         https://bugs.webkit.org/show_bug.cgi?id=181796
3512
3513         Reviewed by Chris Fleizach.
3514
3515         Add mappings for the three new roles (graphics-document, graphics-object,
3516         and graphics-symbol) as per the Graphics Accessibility API Mappings spec.
3517
3518         No new tests; instead, new test cases added to roles-computedRoleString.html
3519         and roles-exposed.html.
3520
3521         * accessibility/AccessibilityObject.cpp:
3522         (WebCore::initializeRoleMap):
3523         (WebCore::AccessibilityObject::computedRoleString const):
3524         * accessibility/AccessibilityObject.h:
3525         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
3526         (atkRole):
3527         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3528         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
3529         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3530         (createAccessibilityRoleMap):
3531         (-[WebAccessibilityObjectWrapper subrole]):
3532         (-[WebAccessibilityObjectWrapper roleDescription]):
3533
3534 2018-01-22  Antti Koivisto  <antti@apple.com>
3535
3536         REGRESSION(r224535): Can't write reviews in the App Store
3537         https://bugs.webkit.org/show_bug.cgi?id=181936
3538         <rdar://problem/36670246>
3539
3540         Reviewed by Zalan Bujtas.
3541
3542         * page/LayoutContext.cpp:
3543         (WebCore::LayoutContext::updateStyleForLayout):
3544
3545         r224535 was about media queries but it also removed a seemingly spurious call to SyleScope::didChangeStyleSheetEnvironment
3546         from the path that does not involve media queries.
3547         Turns out UITextContentView somehow depended on it, so revert this specific change.
3548
3549 2018-01-22  Brady Eidson  <beidson@apple.com>
3550
3551         In WebKit2, make the MessagePortChannelRegistry live in the UI process.
3552         https://bugs.webkit.org/show_bug.cgi?id=181922
3553
3554         Reviewed by Andy Estes.
3555
3556         No new tests (Refactor, no behavior change)
3557
3558         Add encoder/decoders and EXPORT a whole bunch of stuff.
3559         
3560         * WebCore.xcodeproj/project.pbxproj:
3561
3562         * dom/MessagePort.h:
3563
3564         * dom/messageports/MessagePortChannel.cpp:
3565         (WebCore::MessagePortChannel::processForPort):
3566         * dom/messageports/MessagePortChannel.h:
3567
3568         * dom/messageports/MessagePortChannelProvider.h:
3569         * dom/messageports/MessagePortChannelRegistry.h:
3570
3571         * dom/messageports/MessageWithMessagePorts.h:
3572         (WebCore::MessageWithMessagePorts::encode const):
3573         (WebCore::MessageWithMessagePorts::decode):
3574
3575 2018-01-22  Youenn Fablet  <youenn@apple.com>
3576
3577         Fetch Headers from an Opaque response should be filtered out
3578         https://bugs.webkit.org/show_bug.cgi?id=181926
3579
3580         Reviewed by Chris Dumez.
3581
3582         Covered by updated test.
3583
3584         Refactor to use the same FetchResponse::create for Cache API and cloning.
3585         In this method, ensure that response and headers are filtered correctly according response tainting.
3586         Make also sure that synthetic responses do not get filtered (not needed since created by JavaScript).
3587
3588         Introduce helper routine to set the header map of a resource response.
3589         Use this routine when cloning a synthetic response as in that case, m_internalResponse has no header at all.
3590
3591         * Modules/cache/DOMCache.cpp:
3592         (WebCore::DOMCache::updateRecords):
3593         * Modules/fetch/FetchResponse.cpp:
3594         (WebCore::FetchResponse::create):
3595         (WebCore::FetchResponse::clone):
3596         * Modules/fetch/FetchResponse.h:
3597         * platform/network/ResourceResponseBase.cpp:
3598         (WebCore::ResourceResponseBase::setHTTPHeaderFields):
3599         * platform/network/ResourceResponseBase.h:
3600         * testing/ServiceWorkerInternals.cpp:
3601         (WebCore::ServiceWorkerInternals::createOpaqueWithBlobBodyResponse):
3602
3603 2018-01-22  Javier Fernandez  <jfernandez@igalia.com>
3604
3605         [css-align] 'overflow' keyword must precede the self-position and content-position value
3606         https://bugs.webkit.org/show_bug.cgi?id=181793
3607
3608         Reviewed by Antti Koivisto.
3609
3610         There were several discussions to avoid ambiguities with the complex
3611         values, specially when it comes to define the place-xxx shorthands.
3612
3613         One of the sources of problems is the 'overflow-position' keyword. The
3614         CSS WG has decided to change the syntax of all the CSS Box Alignment
3615         properties so that the 'overflow-position' keyword always precede the
3616         'self-position' or the 'content-position' keywords.
3617
3618         https://github.com/w3c/csswg-drafts/issues/1446#event-1125715434
3619
3620         In order to apply this change to the Content Distribution properties'
3621         (align-content and justify-content) syntax I had to completely
3622         re-implement their parsing function. Thanks to this I addressed also
3623         the issue with the content-distribution fallback, which cannot be
3624         specified explicitly now.
3625
3626         https://github.com/w3c/csswg-drafts/issues/1002#ref-commit-c38cac4
3627
3628         No new tests, just rebaselined the expected results of the test cases affected.
3629
3630         Despite the so many layout tests affected by this change, it's
3631         unlikely that it might break any content in current web
3632         sites. This patch changes the new CSS syntax, obviously backward
3633         compatible, defined by the new CSS Box Alignment. The
3634         'overflow-position' keyword is only used by the layout models
3635         implementing the new spec, so far only CSS Grid Layout.
3636         Considering that CSS Grid has been shipped last year, it's unlikely
3637         that many sites are using the new CSS values.
3638
3639         * css/CSSComputedStyleDeclaration.cpp:
3640         (WebCore::valueForItemPositionWithOverflowAlignment):
3641         (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):
3642         * css/CSSContentDistributionValue.cpp:
3643         (WebCore::CSSContentDistributionValue::customCSSText const):
3644         * css/StyleBuilderConverter.h:
3645         (WebCore::StyleBuilderConverter::convertSelfOrDefaultAlignmentData):
3646         * css/parser/CSSPropertyParser.cpp:
3647         (WebCore::consumeOverflowPositionKeyword):
3648         (WebCore::consumeContentPositionKeyword):
3649         (WebCore::consumeContentDistributionOverflowPosition):
3650         (WebCore::consumeSelfPositionOverflowPosition):
3651
3652 2018-01-22  Chris Nardi  <csnardi1@gmail.com>
3653
3654         Parse calc() in CSS media queries
3655         https://bugs.webkit.org/show_bug.cgi?id=181716
3656
3657         calc() was previously unsupported inside of media queries. This change
3658         adds in support for parsing calc inside of media queries.
3659
3660         Reviewed by Antti Koivisto.
3661
3662         Tests: Imported web-platform-tests/css/mediaqueries
3663
3664         * css/MediaQueryExpression.cpp:
3665         (WebCore::featureWithValidIdent): Updated function to take a CSSPrimitiveValue.
3666         (WebCore::featureWithValidDensity): Updated function to take a CSSPrimitiveValue instead of a CSSParserToken.
3667         (WebCore::featureWithValidPositiveLength): Ditto.
3668         (WebCore::featureExpectingPositiveInteger): Ditto.
3669         (WebCore::featureWithPositiveInteger): Ditto.
3670         (WebCore::featureWithPositiveNumber): Ditto.
3671         (WebCore::featureWithZeroOrOne): Ditto.
3672         (WebCore::MediaQueryExpression::MediaQueryExpression): Use CSSPropertyParserHelpers for consuming.
3673         * css/MediaQueryExpression.h:
3674         * css/parser/CSSPropertyParserHelpers.cpp:
3675         (WebCore::CSSPropertyParserHelpers::consumeResolution): Added function for use in media query expression parsing.
3676         * css/parser/CSSPropertyParserHelpers.h:
3677         * css/parser/MediaQueryParser.cpp:
3678         (WebCore::MediaQueryParser::readRestrictor): Updated functions to take a CSSParserTokenRange in order to use CSSPropertyParserHelpers.
3679         (WebCore::MediaQueryParser::readMediaNot): Ditto.
3680         (WebCore::MediaQueryParser::readMediaType): Ditto.
3681         (WebCore::MediaQueryParser::readAnd): Ditto.
3682         (WebCore::MediaQueryParser::readFeatureStart): Ditto.
3683         (WebCore::MediaQueryParser::readFeature): Ditto.
3684         (WebCore::MediaQueryParser::readFeatureColon): Ditto.
3685         (WebCore::MediaQueryParser::readFeatureValue): Ditto.
3686         (WebCore::MediaQueryParser::readFeatureEnd): Ditto.
3687         (WebCore::MediaQueryParser::skipUntilComma): Ditto.
3688         (WebCore::MediaQueryParser::skipUntilBlockEnd): Ditto.
3689         (WebCore::MediaQueryParser::processToken): Ditto.
3690         (WebCore::MediaQueryParser::parseInternal): Ditto.
3691         (WebCore::MediaQueryData::clear): Removed reference to m_valueList
3692         (WebCore::MediaQueryData::addExpression): Use CSSParserTokenRange.
3693         (WebCore::MediaQueryData::lastExpressionValid): New helper function.
3694         (WebCore::MediaQueryData::removeLastExpression): New helper function.
3695         * css/parser/MediaQueryParser.h:
3696
3697 2018-01-22  Zan Dobersek  <zdobersek@igalia.com>
3698
3699         [Cairo] Refactor PlatformContextCairo::drawSurfaceToContext() into a Cairo operation
3700         https://bugs.webkit.org/show_bug.cgi?id=181930
3701
3702         Reviewed by Carlos Garcia Campos.
3703
3704         Move the PlatformContextCairo::drawSurfaceToContext() code into the
3705         Cairo namespace as an operation, renaming it to drawSurface(). Mirroring
3706         other operations, the PlatformContextCairo object is now passed through
3707         a reference as the first argument to the function, and cairo_t context
3708         object is retrieved from that.
3709
3710         Call sites of the PlatformContextCairo::drawSurfaceToContext() method
3711         are adjusted to now call Cairo::drawSurface() and properly pass the
3712         PlatformContextCairo object to the function.
3713
3714         No new tests -- no change in functionality.
3715
3716         * platform/graphics/cairo/CairoOperations.cpp:
3717         (WebCore::Cairo::prepareForStroking): Make this static.
3718         (WebCore::Cairo::drawPatternToCairoContext):
3719         (WebCore::Cairo::drawNativeImage):
3720         (WebCore::Cairo::drawSurface):
3721         * platform/graphics/cairo/CairoOperations.h:
3722         * platform/graphics/cairo/PlatformContextCairo.cpp:
3723         (WebCore::drawPatternToCairoContext): Deleted.
3724         (WebCore::PlatformContextCairo::drawSurfaceToContext): Deleted.
3725         * platform/graphics/cairo/PlatformContextCairo.h:
3726         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
3727         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
3728
3729 2018-01-22  Manuel Rego Casasnovas  <rego@igalia.com>
3730
3731         [css-grid] Spanning Grid item has too much space at the bottom / is too high
3732         https://bugs.webkit.org/show_bug.cgi?id=181677
3733
3734         Reviewed by Javier Fernandez.
3735
3736         In IndefiniteSizeStrategy::findUsedFlexFraction() we were not
3737         subtracting the size of the gutters when we call findFrUnitSize().
3738         If an item spans several tracks, we cannot pass the maxContentForChild()
3739         directly, we need to subtract the gutters as they are treated
3740         as fixed size tracks in the algorithm.
3741
3742         The spec text is pretty clear regarding this
3743         (https://drafts.csswg.org/css-grid/#algo-find-fr-size):
3744         "Let leftover space be the space to fill minus the base sizes
3745          of the non-flexible grid tracks."
3746
3747         Gutters are treated as fixed-size tracks for the purpose
3748         of the track sizing algorithm, so we need to subtract them from the
3749         leftover space while finding the size of an "fr".
3750
3751         Tests: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-find-fr-size-gutters-001.html
3752                imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-find-fr-size-gutters-002.html
3753
3754         * rendering/GridTrackSizingAlgorithm.cpp:
3755         (WebCore::GridTrackSizingAlgorithm::findFrUnitSize const):
3756         (WebCore::IndefiniteSizeStrategy::findUsedFlexFraction const):
3757
3758 2018-01-21  Ryosuke Niwa  <rniwa@webkit.org>
3759
3760         Turning off custom pasteboard data doesn't actually turn it off in WK2
3761         https://bugs.webkit.org/show_bug.cgi?id=181920
3762         <rdar://problem/36686429>
3763
3764         Reviewed by Wenson Hsieh.
3765
3766         Replaced the global settings for custom pasteboard data by regular runtime enabled flags.
3767
3768         * dom/DataTransfer.cpp:
3769         (WebCore::DataTransfer::getDataForItem const):
3770         (WebCore::DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths const):
3771         (WebCore::DataTransfer::setDataFromItemList):
3772         (WebCore::DataTransfer::types const):
3773         (WebCore::DataTransfer::commitToPasteboard):
3774         * dom/DataTransferItemList.cpp:
3775         (WebCore::shouldExposeTypeInItemList):
3776         * editing/Editor.cpp:
3777         (WebCore::createDataTransferForClipboardEvent):
3778         * editing/cocoa/WebContentReaderCocoa.mm:
3779         (WebCore::createFragmentAndAddResources):
3780         (WebCore::WebContentReader::readWebArchive):
3781         * page/DeprecatedGlobalSettings.cpp:
3782         (WebCore::DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled): Deleted.
3783         * page/DeprecatedGlobalSettings.h:
3784         (WebCore::DeprecatedGlobalSettings::setCustomPasteboardDataEnabled): Deleted.
3785         (WebCore::DeprecatedGlobalSettings::customPasteboardDataEnabled): Deleted.
3786         * page/RuntimeEnabledFeatures.h:
3787         (WebCore::RuntimeEnabledFeatures::setCustomPasteboardDataEnabled):
3788         (WebCore::RuntimeEnabledFeatures::customPasteboardDataEnabled const):
3789         * testing/InternalSettings.cpp:
3790         (WebCore::InternalSettings::Backup::Backup):
3791         (WebCore::InternalSettings::Backup::restoreTo):
3792         (WebCore::InternalSettings::setCustomPasteboardDataEnabled):
3793
3794 2018-01-21  Wenson Hsieh  <wenson_hsieh@apple.com>
3795
3796         Add a new feature flag for EXTRA_ZOOM_MODE and reintroduce AdditionalFeatureDefines.h
3797         https://bugs.webkit.org/show_bug.cgi?id=181918
3798
3799         Reviewed by Tim Horton.
3800
3801         Add EXTRA_ZOOM_MODE to FeatureDefines.xconfig (off by default). No change in behavior.
3802
3803         * Configurations/FeatureDefines.xcconfig:
3804
3805 2018-01-19  Ryosuke Niwa  <rniwa@webkit.org>
3806
3807         Release assertion in canExecuteScript when executing scripts during page cache restore
3808         https://bugs.webkit.org/show_bug.cgi?id=181902
3809
3810         Reviewed by Antti Koivisto.
3811
3812         The crash was caused by an erroneous instantiation of ScriptDisallowedScope::InMainThread in CachedPage::restore.
3813         It can execute arbitrary scripts since CachedFrame::open can update style, layout, and evaluate media queries.
3814
3815         This is fine because there is no way to put this page back into a page cache until the load is commited via
3816         FrameLoader::commitProvisionalLoad is invoked later which only happens after CachedPage::restore had exited.
3817
3818         Also added a release assert to make sure this condition holds.
3819
3820         Tests: fast/history/page-cache-execute-script-during-restore.html
3821                fast/history/page-cache-navigate-during-restore.html
3822
3823         * history/CachedPage.cpp:
3824         (WebCore::CachedPageRestorationScope::CachedPageRestorationScope): Added.
3825         (WebCore::CachedPageRestorationScope::~CachedPageRestorationScope): Added.
3826         (WebCore::CachedPage::restore): Don't instantiate ScriptDisallowedScope::InMainThread. Set isRestoringCachedPage
3827         on the cached pate to release-assert that there won't be any attempt to put this very page back into the cache.
3828         * history/PageCache.cpp:
3829         (WebCore::canCachePage): Added a release assert to make sure the page which is in the process of being restored
3830         from the page cache is not put into the page cache.
3831         * page/Page.h:
3832         (WebCore::Page::setIsRestoringCachedPage): Added.
3833         (WebCore::Page::isRestoringCachedPage const): Added.
3834
3835 2018-01-21  Eric Carlson  <eric.carlson@apple.com>
3836
3837         Resign NowPlaying status when no media element is eligible
3838         https://bugs.webkit.org/show_bug.cgi?id=181914
3839         <rdar://problem/35294116>
3840
3841         Reviewed by Jer Noble.
3842
3843         Updated API test.
3844
3845         * html/HTMLMediaElement.cpp:
3846         (WebCore::HTMLMediaElement::removedFromAncestor): Call mediaSession->clientCharacteristicsChanged
3847         so NowPlaying status will be updated.
3848
3849         * html/MediaElementSession.cpp:
3850         (WebCore::MediaElementSession::canShowControlsManager const): Return false when being queried
3851         for NowPlaying status in an inactive document.
3852
3853         * platform/audio/PlatformMediaSessionManager.cpp:
3854         (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Implement in for all
3855         ports.
3856         * platform/audio/PlatformMediaSessionManager.h:
3857         (WebCore::PlatformMediaSessionManager::registeredAsNowPlayingApplication const):
3858         * platform/audio/ios/MediaSessionManagerIOS.h:
3859         * platform/audio/mac/MediaSessionManagerMac.h:
3860         * platform/audio/mac/MediaSessionManagerMac.mm:
3861         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): Call MRMediaRemoteSetCanBeNowPlayingApplication
3862         whenever status changes.
3863         (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Deleted, implemented
3864         in the base class.
3865
3866 2018-01-21  Jer Noble  <jer.noble@apple.com>
3867
3868         REGRESSION (macOS 10.13.2): imported/w3c/web-platform-tests/media-source/mediasource-* LayoutTests failing
3869         https://bugs.webkit.org/show_bug.cgi?id=181891
3870
3871         Reviewed by Eric Carlson.
3872
3873         In macOS 10.13.2, CoreMedia changed the definition of CMSampleBufferGetDuration() to return
3874         the presentation duration rather than the decode duration. For media streams where those two
3875         durations are identical (or at least, closely similar), this isn't a problem. But the media
3876         file used in the WPT tests have an unusual frame cadence: decode durations go {3000, 1, 5999,
3877         1, 5999,...} and presentation durations go {3000, 2999, 3000, 2999}. This caused one check in
3878         the "Coded Frame Processing" algorithm to begin failing, where it checks that the delta
3879         between the last sample's decode time and the new decode time is no more than 2x as far as
3880         the last sample's duration. That's not a problem as long as the "duration" is the "decode
3881         duration" and the samples are all adjacent. Once the "duration" is "presentation duration",
3882         all the assumptions in the algorithm are invalidated. In the WPT test case, the delta between
3883         decode times is 5999, and 2 * the presentation duration is 5998, causing all samples up to
3884         the next sync sample to be dropped.
3885
3886         To work around this change in behavior, we'll adopt the same technique used by Mozilla's MSE
3887         implementation, which was done for similar reasons. Rather than track the "last frame duration",
3888         we'll record the "greatest frame duration", and use actual decode timestamps to derive this
3889         duration. The "greatest frame duration" field will be reset at the same times as "last frame
3890         duration", and will be used only in the part of the algorithm that checks for large decode
3891         timestamp gaps.
3892
3893         * Modules/mediasource/SourceBuffer.cpp:
3894         (WebCore::SourceBuffer::TrackBuffer::TrackBuffer):
3895         (WebCore::SourceBuffer::resetParserState):
3896         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
3897
3898 2018-01-21  Andy Estes  <aestes@apple.com>
3899
3900         [ios] LayoutTest imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html is crashing in JSC::JSONParse
3901         https://bugs.webkit.org/show_bug.cgi?id=177832
3902         <rdar://problem/34805315>
3903
3904         Reviewed by Tim Horton.
3905
3906         Test: http/tests/paymentrequest/rejects_if_not_active.https.html
3907
3908         * Modules/paymentrequest/PaymentRequest.cpp:
3909         (WebCore::PaymentRequest::show): Rejected promise if the document is not active.
3910
3911 2018-01-20  Brady Eidson  <beidson@apple.com>
3912
3913         Make garbage collection of MessagePort objects be asynchronous.
3914         https://bugs.webkit.org/show_bug.cgi?id=181910
3915
3916         Reviewed by Andy Estes.
3917
3918         No new tests (Covered by existing tests, including GC-specific ones).
3919
3920         The basic premise here is as follows:
3921         - You can *always* GC a MessagePort that is closed
3922         - You can *always* GC a MessagePort that has no onmessage handler, as incoming messages cannot 
3923           possibly revive it.
3924         - You can GC a MessagePort, even if it has a message handler, as long as there are no messages 
3925           in flight between it and the remote port, and as long as the remote port is "maybe eligible for GC."
3926           
3927         A MessagePort is considered "maybe eligible for GC" once hasPendingActivity is asked once.
3928         
3929         A MessagePort loses "maybe eligible for GC" status once it is used for sending or receiving a message.
3930         
3931         The changes to MessagePort.cpp implement the above with a tiny little bool-driven state machine.
3932         * dom/MessagePort.cpp:
3933         (WebCore::MessagePort::postMessage):
3934         (WebCore::MessagePort::disentangle):
3935         (WebCore::MessagePort::registerLocalActivity):
3936         (WebCore::MessagePort::start):
3937         (WebCore::MessagePort::close):
3938         (WebCore::MessagePort::contextDestroyed):
3939         (WebCore::MessagePort::dispatchMessages):
3940         (WebCore::MessagePort::hasPendingActivity const):
3941         (WebCore::MessagePort::isLocallyReachable const):
3942         (WebCore::MessagePort::addEventListener):
3943         (WebCore::MessagePort::removeEventListener):
3944         * dom/MessagePort.h:
3945
3946         - Remove the lock and any background-thread code paths
3947         - Add ASSERT(isMainThread())s throughout
3948         * dom/messageports/MessagePortChannel.cpp:
3949         (WebCore::MessagePortChannel::MessagePortChannel):
3950         (WebCore::MessagePortChannel::includesPort):
3951         (WebCore::MessagePortChannel::entanglePortWithProcess):
3952         (WebCore::MessagePortChannel::disentanglePort):
3953         (WebCore::MessagePortChannel::closePort):
3954         (WebCore::MessagePortChannel::postMessageToRemote):
3955         (WebCore::MessagePortChannel::takeAllMessagesForPort):
3956         (WebCore::MessagePortChannel::checkRemotePortForActivity):
3957         (WebCore::MessagePortChannel::hasAnyMessagesPendingOrInFlight const):
3958         * dom/messageports/MessagePortChannel.h:
3959         
3960         Add a callback for a MessagePortChannel to go ask the remote MessagePort object about local activity:
3961         * dom/messageports/MessagePortChannelProvider.h:
3962         * dom/messageports/MessagePortChannelProviderImpl.cpp:
3963         (WebCore::MessagePortChannelProviderImpl::checkRemotePortForActivity):
3964         (WebCore::MessagePortChannelProviderImpl::checkProcessLocalPortForActivity):