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