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