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