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