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