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