[GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-02-20  Philippe Normand  <pnormand@igalia.com>
2
3         [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser
4         https://bugs.webkit.org/show_bug.cgi?id=173655
5
6         Reviewed by Xabier Rodriguez-Calvar.
7
8         The FIXME in GStreamerUtilities.cpp asks to pass the command line
9         parameters to the GStreamer initialization function.
10
11         Based on initial patch by: Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
12
13         * Modules/webaudio/AudioContext.cpp:
14         (WebCore::AudioContext::constructCommon): Removes the call to the method
15         that GStreamer initializes. It is no longer necessary.
16         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
17         (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements): Ditto
18         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
19         (WebCore::initializeGStreamerAndRegisterWebKitMSEElement): Ditto
20         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
21         (WebCore::initializeGStreamer): Receive the GStreamer options and initialize GStreamer.
22         * platform/graphics/gstreamer/GStreamerUtilities.h: Add vector which contains
23         GStreamer options as the input parameter of the initializeGStreamer() method.
24
25 2018-02-20  Miguel Gomez  <magomez@igalia.com>
26
27         [GTK] whatsapp web blurry in some parts, sharp on others
28         https://bugs.webkit.org/show_bug.cgi?id=182673
29
30         Reviewed by Carlos Garcia Campos.
31
32         CoordinatedGraphicsLayer::createBackingStore() uses the scale factor returned by effectiveContentsScale(),
33         which is always 1 if selfOrAncestorHaveNonAffineTransforms() returns true. But this fuction always returns
34         true if the layer has an AnimatedPropertyTransform animation, which means that layers with those animations
35         won't use the appropriate scale factor, causing blurry renderings.
36
37         This patch removes the animations check, so animated layers properly use the required scale factor.
38
39         No new tests, no behavior change.
40
41         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
42         (WebCore::CoordinatedGraphicsLayer::selfOrAncestorHaveNonAffineTransforms):
43
44 2018-02-20  Zan Dobersek  <zdobersek@igalia.com>
45
46         [Cairo] Leverage ShadowBlur without using scratch buffer, target GraphicsContext
47         https://bugs.webkit.org/show_bug.cgi?id=182958
48
49         Reviewed by Carlos Garcia Campos.
50
51         To allow ShadowBlur usage in different threads, avoid the ShadowBlur
52         class using the scratch buffer internally. The current implementation of
53         that scratch buffer is not thread-safe and its usage in such conditions
54         can lead to crashes.
55
56         Instead, the new methods use a temporary ImageBuffer object for drawing.
57         This does negate the efficiency of possibly reusing the scratch buffer,
58         but at this point that is not yet the priority. This only affects ports
59         using Cairo for drawing.
60
61         The added methods don't require a target GraphicsContext object to be
62         passed in, instead they accept buffer draw callbacks that are invoked
63         with the temporary ImageBuffer object containing the rasterized shadow,
64         as well as position and size parameters. The CTM and clip bounds values
65         also have to be passed in manually. In CairoOperations.cpp, the provided
66         callbacks invoke commands that are equivalent in effect to those that
67         would otherwise be invoked on the target GraphicsContext object in the
68         ShadowBlur class.
69
70         For now, this approach has to avoid the tiling-based drawing of the
71         rectangular shadows in drawRectShadow() and inset shadows in
72         drawInsetShadow(), and instead stick to the non-tiling fallback. While
73         only affecting Cairo-using ports, with some refactoring it should be
74         possible to again leverage the tiling-based approach as well.
75
76         The beginShadowLayer() and endShadowLayer() functions, which are only
77         used in CairoOperations.cpp, are replaced with the drawShadowLayer()
78         method. This one accepts an additional callback that allows the caller
79         to explicitly draw the shadow shape using the provided shadowing
80         GraphicsContext object. As with the other two new methods, a temporary
81         ImageBuffer object is used, and the buffer draw callback is invoked to
82         allow caller to properly handle the shadowing output.
83
84         In CairoOperations.cpp, the new ShadowBlur methods are exercised, with
85         direct Cairo operation invocation replacing the GraphicsContext calls
86         otherwise done through ShadowBlur. ShadowState object now also has to
87         track the global alpha and the global composite operator values so that
88         it can properly rasterize the resulting shadow into the final image.
89
90         No new tests -- no change in behavior.
91
92         * platform/graphics/ShadowBlur.cpp:
93         (WebCore::ShadowBlur::adjustBlurRadius):
94         (WebCore::ShadowBlur::calculateLayerBoundingRect):
95         (WebCore::ShadowBlur::drawRectShadow):
96         (WebCore::ShadowBlur::drawInsetShadow):
97         (WebCore::ShadowBlur::drawShadowLayer):
98         (WebCore::ShadowBlur::beginShadowLayer): Deleted.
99         (WebCore::ShadowBlur::endShadowLayer): Deleted.
100         * platform/graphics/ShadowBlur.h:
101         * platform/graphics/cairo/CairoOperations.cpp:
102         (WebCore::Cairo::drawShadowLayerBuffer):
103         (WebCore::Cairo::fillShadowBuffer):
104         (WebCore::Cairo::drawPathShadow):
105         (WebCore::Cairo::drawGlyphsShadow):
106         (WebCore::Cairo::ShadowState::ShadowState):
107         (WebCore::Cairo::fillRect):
108         (WebCore::Cairo::fillRoundedRect):
109         (WebCore::Cairo::fillRectWithRoundedHole):
110         (WebCore::Cairo::drawSurface):
111         * platform/graphics/cairo/CairoOperations.h:
112         Default-initialize FillSource::fillRule to RULE_NONZERO.
113         * platform/graphics/cairo/PlatformContextCairo.h:
114         Drop the ShadowBlur.h include, it's moved to CairoOperations.cpp.
115         * rendering/RenderThemeGtk.cpp:
116         Explicitly include the FloatRoundedRect.h header now that it's not
117         included through the ShadowBlur.h header via PlatformContextCairo.h.
118
119 2018-02-20  Sergio Villar Senin  <svillar@igalia.com>
120
121         [WebVR] Use RuntimeEnabledFeatures to enable/disable WebVR
122         https://bugs.webkit.org/show_bug.cgi?id=182961
123
124         Reviewed by Xabier Rodriguez-Calvar.
125
126         The shared feature was properly added to RuntimeEnabledFeatures some
127         time ago but the code was instead using a private method in
128         NavigatorWebVR to temporarily disable it. WebVR is enabled in
129         WebPreferences.yaml for GTK+ & WPE as default experimental feature.
130
131         * Modules/webvr/NavigatorWebVR.cpp:
132         (WebCore::NavigatorWebVR::getVRDisplays):
133         (WebCore::NavigatorWebVR::vrEnabled): Deleted.
134
135 2018-02-19  Antti Koivisto  <antti@apple.com>
136
137         Use selector filter when invalidating descendants
138         https://bugs.webkit.org/show_bug.cgi?id=182839
139         <rdar://problem/37581072>
140
141         Reviewed by Zalan Bujtas.
142
143         We can make descendant invalidation faster by enabling filtering.
144
145         * css/SelectorFilter.cpp:
146         (WebCore::SelectorFilter::initializeParentStack):
147
148             Traverse and reverse the ancestor chain, and push it.
149
150         (WebCore::SelectorFilter::pushParent):
151         (WebCore::SelectorFilter::pushParentInitializingIfNeeded):
152
153             Add a version of pushParent that can initialize the stack.
154
155         (WebCore::SelectorFilter::popParent):
156         (WebCore::SelectorFilter::popParentsUntil):
157
158             Pop until a given parent element.
159
160         (WebCore::SelectorFilter::pushParentStackFrame): Deleted.
161         (WebCore::SelectorFilter::popParentStackFrame): Deleted.
162
163             These were the same as push/popParent.
164
165         * css/SelectorFilter.h:
166         (WebCore::SelectorFilter::popParent): Deleted.
167         * style/StyleInvalidator.cpp:
168         (WebCore::Style::Invalidator::invalidateStyleForDescendants):
169
170             Use pushParentInitializingIfNeeded.
171
172         (WebCore::Style::Invalidator::invalidateStyleWithMatchElement):
173
174             Use selector filter when doing descendant tree invalidation.
175             Make sure to pop it until the parent when reusing.
176
177 2018-02-19  Fujii Hironori  <Hironori.Fujii@sony.com>
178
179         null m_lastNodeInserted dereference at ReplaceSelectionCommand::InsertedNodes::lastLeafInserted
180         https://bugs.webkit.org/show_bug.cgi?id=161947
181
182         Reviewed by Ryosuke Niwa.
183
184         InsertedNodes happened to be empty if the inserted nodes were
185         removed. Add more checks if InsertedNodes is empty.
186
187         No new tests (Covered by existing tests).
188
189         * editing/ReplaceSelectionCommand.cpp:
190         (WebCore::ReplaceSelectionCommand::doApply): Return early if InsertedNodes becomes empty.
191         * editing/ReplaceSelectionCommand.h:
192         (WebCore::ReplaceSelectionCommand::InsertedNodes::isEmpty): New method.
193         (WebCore::ReplaceSelectionCommand::InsertedNodes::lastLeafInserted const):
194         Assert m_lastNodeInserted is not null.
195         (WebCore::ReplaceSelectionCommand::InsertedNodes::pastLastLeaf const): Ditto.
196
197 2018-02-19  Said Abou-Hallawa  <sabouhallawa@apple.com>
198
199         Add SVGPropertyTraits::fromString() to all the SVG animated types
200         https://bugs.webkit.org/show_bug.cgi?id=182901
201
202         Reviewed by Dean Jackson.
203
204         This is a work toward https://bugs.webkit.org/show_bug.cgi?id=168586. The
205         goal is is to templatize the SVGAnimatedType class and to use SVGPropertyTraits
206         methods inside the template functions.
207
208         * WebCore.xcodeproj/project.pbxproj: Move the enum and the SVGPropertyTraits
209         from SVGMarkerElement.h to SVGMarkerTypes.h.
210         * svg/SVGAngle.h:
211         (WebCore::SVGAngle::SVGAngle): Delete unused constructor and create() method.
212         * svg/SVGAngleValue.h:
213         * svg/SVGAnimateMotionElement.cpp:
214         (WebCore::parsePoint): Deleted. Move this function to SVGParserUtilities.cpp
215         * svg/SVGAnimatedAngle.cpp:
216         (WebCore::SVGAnimatedAngleAnimator::constructFromString): Use SVGPropertyTraits::fromString().
217         * svg/SVGAnimatedBoolean.cpp:
218         (WebCore::SVGAnimatedBooleanAnimator::constructFromString): Ditto.
219         * svg/SVGAnimatedColor.cpp:
220         (WebCore::SVGAnimatedColorAnimator::constructFromString): Ditto.
221         (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes): Use const.
222         (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue): Ditto.
223         * svg/SVGAnimatedEnumeration.cpp:
224         (WebCore::SVGAnimatedEnumerationAnimator::constructFromString): Ditto.
225         * svg/SVGAnimatedInteger.cpp:
226         (WebCore::SVGAnimatedIntegerAnimator::constructFromString): Ditto.
227         * svg/SVGAnimatedIntegerOptionalInteger.cpp:
228         (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString): Ditto.
229         * svg/SVGAnimatedLength.cpp:
230         * svg/SVGAnimatedLengthList.cpp:
231         (WebCore::SVGAnimatedLengthListAnimator::constructFromString): Ditto.
232         * svg/SVGAnimatedNumber.cpp:
233         (WebCore::SVGAnimatedNumberAnimator::constructFromString): Ditto
234         (WebCore::parseNumberFromString):
235         * svg/SVGAnimatedNumberList.cpp:
236         (WebCore::SVGAnimatedNumberListAnimator::constructFromString): Ditto.
237         * svg/SVGAnimatedNumberOptionalNumber.cpp:
238         (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString): Ditto.
239         * svg/SVGAnimatedPath.cpp:
240         (WebCore::SVGAnimatedPathAnimator::constructFromString): Ditto.
241         * svg/SVGAnimatedPointList.cpp:
242         (WebCore::SVGAnimatedPointListAnimator::constructFromString): Ditto.
243         * svg/SVGAnimatedPreserveAspectRatio.cpp:
244         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString): Ditto.
245         * svg/SVGAnimatedRect.cpp:
246         (WebCore::SVGAnimatedRectAnimator::constructFromString): Ditto.
247         * svg/SVGAnimatedString.cpp:
248         (WebCore::SVGAnimatedStringAnimator::constructFromString): Ditto.
249         * svg/SVGAnimatedTransformList.cpp:
250         (WebCore::SVGAnimatedTransformListAnimator::constructFromString): Ditto.
251         * svg/SVGLength.h:
252         (WebCore::SVGLength::SVGLength): Delete unused constructor and create() method.
253         * svg/SVGLengthListValues.h:
254         (WebCore::SVGPropertyTraits<SVGLengthListValues>::fromString): New SVGPropertyTraits method.
255         (WebCore::SVGPropertyTraits<SVGLengthListValues>::parse): Ditto.
256         * svg/SVGMarkerElement.h:
257         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue): Deleted.
258         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): Deleted.
259         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString): Deleted.
260         (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Deleted.
261         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue): Deleted.
262         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): Deleted.
263         * svg/SVGMarkerTypes.h: Added.
264         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue):
265         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString):
266         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString):
267         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
268         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
269         (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue):
270         * svg/SVGMatrix.h: Delete unused constructor and create method.
271         * svg/SVGNumber.h:
272         (WebCore::SVGNumber::SVGNumber): Ditto.
273         * svg/SVGNumberListValues.h:
274         (WebCore::SVGPropertyTraits<SVGNumberListValues>::fromString): New SVGPropertyTraits method.
275         * svg/SVGParserUtilities.cpp:
276         (WebCore::parsePoint): This is moved from SVGAnimateMotionElement.cpp
277         * svg/SVGParserUtilities.h:
278         * svg/SVGPathByteStream.h:
279         (WebCore::SVGPathByteStream::SVGPathByteStream):
280         (WebCore::SVGPathByteStream::operator=): Add copy and move assignment operators.
281         (WebCore::SVGPathByteStream::copy const): Use the copy assignment.
282         (WebCore::SVGPathByteStream::isEmpty const): Use Data.isEmpty().
283         (WebCore::SVGPropertyTraits<SVGPathByteStream>::initialValue): New SVGPropertyTraits method.
284         (WebCore::SVGPropertyTraits<SVGPathByteStream>::fromString): Ditto.
285         * svg/SVGPathUtilities.cpp:
286         (WebCore::addToSVGPathByteStream): Answer Simon's questions which were added in r190844.
287         * svg/SVGPoint.h:
288         (WebCore::SVGPoint::SVGPoint): Delete unused constructor and create method.
289         * svg/SVGPointListValues.h:
290         (WebCore::SVGPropertyTraits<SVGPointListValues>::fromString): New SVGPropertyTraits method.
291         * svg/SVGPolyElement.cpp:
292         (WebCore::SVGPolyElement::parseAttribute): Use the move assignment operator.
293         * svg/SVGPreserveAspectRatio.h:
294         (WebCore::SVGPreserveAspectRatio::SVGPreserveAspectRatio): Delete unused constructor and create method.
295         * svg/SVGPreserveAspectRatioValue.cpp:
296         (WebCore::SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue): Add new constructor.
297         * svg/SVGPreserveAspectRatioValue.h:
298         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString): New SVGPropertyTraits method.
299         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString): Ditto.
300         * svg/SVGRect.h:
301         (WebCore::SVGRect::SVGRect): Delete unused constructor and create method.
302         * svg/SVGRectTraits.h: Removed.
303         * svg/SVGTransform.h:
304         (WebCore::SVGTransform::SVGTransform): Delete unused constructor and create method.
305         * svg/SVGTransformListValues.h:
306         (WebCore::SVGPropertyTraits<SVGTransformListValues>::fromString): New SVGPropertyTraits method.
307         * svg/properties/SVGPropertyTearOff.h: Delete unused create method.
308         * svg/properties/SVGPropertyTraits.h: New SVGPropertyTraits methods.
309         (WebCore::SVGPropertyTraits<bool>::fromString): 
310         (WebCore::SVGPropertyTraits<Color>::initialValue):
311         (WebCore::SVGPropertyTraits<Color>::fromString):
312         (WebCore::SVGPropertyTraits<Color>::parse):
313         (WebCore::SVGPropertyTraits<Color>::toString):
314         (WebCore::SVGPropertyTraits<int>::fromString):
315         (WebCore::SVGPropertyTraits<float>::fromString):
316         (WebCore::SVGPropertyTraits<float>::parse):
317         (WebCore::SVGPropertyTraits<FloatPoint>::initialValue):
318         (WebCore::SVGPropertyTraits<FloatPoint>::fromString):
319         (WebCore::SVGPropertyTraits<FloatPoint>::parse):
320         (WebCore::SVGPropertyTraits<FloatPoint>::toString):
321         (WebCore::SVGPropertyTraits<FloatRect>::initialValue):
322         (WebCore::SVGPropertyTraits<FloatRect>::fromString):
323         (WebCore::SVGPropertyTraits<FloatRect>::parse):
324         (WebCore::SVGPropertyTraits<FloatRect>::toString):
325         (WebCore::SVGPropertyTraits<String>::fromString):
326         (WebCore::SVGPropertyTraits<String>::parse):
327         (WebCore::SVGPropertyTraits<String>::toString):
328
329 2018-02-19  Antoine Quint  <graouts@apple.com>
330
331         [Modern Media Controls] Implement a compact set of media controls
332         https://bugs.webkit.org/show_bug.cgi?id=182937
333         <rdar://problem/37682257>
334
335         Reviewed by Eric Carlson.
336
337         We add a new type of media controls used when we need stripped down and compact controls. The new
338         CompactMediaControls only show a play/pause button and an invalid placard and disregard all media
339         events that are not relevant to the display of these controls.
340
341         To distinguish cases where we need to show compact media controls, we expose a new property on
342         MediaControlsHost called "compactMode".
343
344         Tests: media/modern-media-controls/compact-media-controls/compact-media-controls-constructor.html
345                media/modern-media-controls/compact-media-controls/compact-media-controls-layout.html
346
347         * Modules/mediacontrols/MediaControlsHost.cpp:
348         (WebCore::MediaControlsHost::base64StringForIconNameAndType const):
349         (WebCore::MediaControlsHost::compactMode const):
350         * Modules/mediacontrols/MediaControlsHost.h:
351         (WebCore::MediaControlsHost::setSimulateCompactMode):
352         * Modules/mediacontrols/MediaControlsHost.idl:
353         * Modules/modern-media-controls/controls/compact-media-controls.js: Added.
354         (CompactMediaControls.prototype.get scaleFactor):
355         (CompactMediaControls.prototype.set scaleFactor):
356         (CompactMediaControls.prototype.get shouldCenterControlsVertically):
357         (CompactMediaControls.prototype.set shouldCenterControlsVertically):
358         (CompactMediaControls.prototype.get placard):
359         (CompactMediaControls.prototype.set placard):
360         (CompactMediaControls.prototype.layout):
361         (CompactMediaControls.prototype.commitProperty):
362         * Modules/modern-media-controls/controls/icon-service.js:
363         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconAndLayoutTraits):
364         (const.iconService.new.IconService):
365         * Modules/modern-media-controls/controls/inline-media-controls.js:
366         * Modules/modern-media-controls/controls/layout-item.js:
367         * Modules/modern-media-controls/js-files:
368         * Modules/modern-media-controls/main.js:
369         * Modules/modern-media-controls/media/media-controller.js:
370         (MediaController.prototype.get layoutTraits):
371         (MediaController.prototype._supportingObjectClasses): Compute the set of MediaControllerSupport classes based
372         on the layout traits such that in compact mode we only return PlacardSupport and PlaybackSupport.
373         (MediaController.prototype._updateControlsIfNeeded):
374         (MediaController.prototype._controlsClassForLayoutTraits):
375         (MediaController.prototype._shouldControlsBeAvailable):
376         * Modules/modern-media-controls/media/placard-support.js:
377         (PlacardSupport.prototype.get mediaEvents): Only track the "error" event in compact mode since this is the only
378         relevant placard.
379         * Modules/modern-media-controls/media/playback-support.js:
380         (PlaybackSupport.prototype.syncControl): Only show or hide the play/pause button based on the playback state
381         when in compact mode.
382         (PlaybackSupport):
383         * WebCore.xcodeproj/project.pbxproj:
384
385 2018-02-19  Antoine Quint  <graouts@apple.com>
386
387         [Web Animations] Make KeyframeEffect target nullable and read-write
388         https://bugs.webkit.org/show_bug.cgi?id=182741
389
390         Reviewed by Dean Jackson.
391
392         We used to completely disregard null targets, for instance not parsing keyframes, but targets
393         can be null and are also supposed to be read-write for KeyframeEffect. We now update the IDL
394         for KeyframeEffect to mark the target property as read-write and update the implementation
395         to correctly handle null targets.
396
397         This revealed a few issues in our implementation by allowing more WPT tests to run. So we also
398         ensure that:
399         
400         - we don't crash when parsing font-related properties by calling update() on the generated
401         RenderStyle's FontCascade when parsing keyframes.
402
403         - CSS properties are provided as camel-case and not as hyphenated form
404
405         - values provided in keyframes dictionaries are only read for valid properties
406
407         - styles for effect targets are invalidated as soon as the timing model for that animation
408         is changed
409
410         * animation/KeyframeEffect.idl:
411         * animation/KeyframeEffectReadOnly.cpp:
412         (WebCore::invalidateElement): Add a new utility method to invalidate a given element since
413         we may want to invalidate not only the current target (m_target) but also a previous target.
414         (WebCore::IDLAttributeNameToAnimationPropertyName): Move this function below CSSPropertyIDToIDLAttributeName
415         so that it can call that function. We also check that we reject CSS properties that are not provided in
416         camel-case form (eg. "font-size" vs. "fontSize").
417         (WebCore::processIterableKeyframes): Only read the JS values if we know that the provided JS property name
418         maps to a valid CSS property.
419         (WebCore::KeyframeEffectReadOnly::processKeyframes): Allow keyframes to be processed even if the effect's
420         target is null.
421         (WebCore::KeyframeEffectReadOnly::setTarget): Notify the animation that the effect target has changed and
422         invalidate the style of the new target and the old targets, if any. We also update the blending keyframes
423         since this task may not have been completed in a previous call to processKeyframes() due to the target being
424         null at that time.
425         (WebCore::KeyframeEffectReadOnly::invalidate): Use the invalidateElement() utility.
426         * animation/KeyframeEffectReadOnly.h:
427         * animation/WebAnimation.cpp:
428         (WebCore::WebAnimation::effectTargetDidChange): This method is called in KeyframeEffectReadOnly::setTarget()
429         to inform the animation of the previous effect target and the new one upon a target change. This allows us to
430         forward this information onto the timeline so that we correctly add or remove the targets from the list of
431         animated elements.
432         * animation/WebAnimation.h:
433
434 2018-02-19  Chris Dumez  <cdumez@apple.com>
435
436         Crash under MIMETypeRegistry::isSupportedJavaScriptMIMEType()
437         https://bugs.webkit.org/show_bug.cgi?id=182927
438         <rdar://problem/37675748>
439
440         Reviewed by Antti Koivisto.
441
442         Make it safe to call MIMETypeRegistry::isSupportedJavaScriptMIMEType() from the non-main thread.
443         It is currently being called from a background thread in the following places:
444         - ServiceWorkerJob::didReceiveResponse()
445         - WorkerGlobalScope::importScripts()
446
447         These call sites on non-main threads were added recently with the support for service workers.
448
449         No new tests, already covered by existing tests that flakily experience service worker
450         process crashes.
451
452         * platform/MIMETypeRegistry.cpp:
453         (WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType):
454
455 2018-02-19  Dean Jackson  <dino@apple.com>
456
457         SIGFPE @ int WebCore::SVGToOTFFontConverter::scaleUnitsPerEm<int> const + 45
458         https://bugs.webkit.org/show_bug.cgi?id=182944
459         <rdar://problem/35369984>
460
461         Reviewed by Myles Maxfield.
462
463         Avoid a divide-by-zero.
464
465         Test: svg/text/font-bad-unitsperem.html
466
467         * svg/SVGFontFaceElement.cpp:
468         (WebCore::SVGFontFaceElement::unitsPerEm const):
469
470 2018-02-19  Tim Horton  <timothy_horton@apple.com>
471
472         REGRESSION (r219342): Touch event coordinates and elementFromPoint coordinates differ
473         https://bugs.webkit.org/show_bug.cgi?id=182910
474         <rdar://problem/37533950>
475
476         Reviewed by Simon Fraser.
477
478         We reverted other changes to the definition of client coordinates
479         in r219829 due to compatibility concerns. However, we failed to revert
480         r219342 on trunk, leaving elementFromPoint() using coordinates relative
481         to the layout viewport.
482
483         Add a currently off-by-default setting to switch on layout-viewport-relative
484         client coordinates and guard the elementFromPoint changes behind it.
485         A future patch should roll r219829 back in also behind this setting, so
486         that everything remains consistent regardless of which coordinate space we choose.
487
488         * dom/TreeScope.cpp:
489         (WebCore::absolutePointIfNotClipped):
490         * page/Settings.yaml:
491         * rendering/RenderLayer.cpp:
492         (WebCore::RenderLayer::hitTest):
493
494 2018-02-19  Eric Carlson  <eric.carlson@apple.com>
495
496         [Extra zoom mode] Don't allow PiP media playback
497         https://bugs.webkit.org/show_bug.cgi?id=182930
498         <rdar://problem/37676259>
499
500         Reviewed by Andy Estes.
501
502         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
503         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Don't call setPIPModeEnabled:
504         if it isn't implemented.
505         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.
506
507 2018-02-19  Antoine Quint  <graouts@apple.com>
508
509         [Web Animations] Decouple parsing JS keyframes and computing blending keyframes
510         https://bugs.webkit.org/show_bug.cgi?id=182939
511         <rdar://problem/37678364>
512
513         Reviewed by Dean Jackson.
514
515         Move all the code used to create the KeyframeList into a dedicated updateBlendingKeyframes() method.
516
517         No new tests since this code change has no user-visible impact.
518
519         * animation/KeyframeEffectReadOnly.cpp:
520         (WebCore::KeyframeEffectReadOnly::processKeyframes):
521         (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes):
522         * animation/KeyframeEffectReadOnly.h:
523
524 2018-02-19  Jer Noble  <jer.noble@apple.com>
525
526         [EME] Add mechanism for MediaKeySession to react to HDCP changes
527         https://bugs.webkit.org/show_bug.cgi?id=182935
528
529         Reviewed by Eric Carlson.
530
531         Add a client callback interface to CDMInterface to allow subclasses to communicate up to
532         MediaKeySEssion. Add a virtual method to CDMInterface to allow it to be notified of HDCP
533         status changes. Override this method in CDMInstanceFairPlayStreamingAVFObjC. Hook up the
534         outputObscuredDueToInsufficientExternalProtectionChanged() methods in both
535         MediaPlayerPrivateAVFoundationObjC and MediaPlayerPrivateMediaSourceAVFObjC to this new
536         CDMInstance method. Add an Internals method to simulate an HDCP error for testing purposes.
537
538         * Modules/encryptedmedia/MediaKeySession.cpp:
539         (WebCore::MediaKeySession::MediaKeySession):
540         (WebCore::MediaKeySession::~MediaKeySession):
541         (WebCore::MediaKeySession::updateKeyStatuses):
542         * Modules/encryptedmedia/MediaKeySession.h:
543         * platform/encryptedmedia/CDMInstance.h:
544         (WebCore::CDMInstance::setHDCPStatus):
545         (WebCore::CDMInstance::setClient):
546         (WebCore::CDMInstance::clearClient):
547         * platform/graphics/MediaPlayer.cpp:
548         (WebCore::MediaPlayer::beginSimulatedHDCPError):
549         (WebCore::MediaPlayer::endSimulatedHDCPError):
550         * platform/graphics/MediaPlayer.h:
551         * platform/graphics/MediaPlayerPrivate.h:
552         (WebCore::MediaPlayerPrivateInterface::beginSimulatedHDCPError):
553         (WebCore::MediaPlayerPrivateInterface::endSimulatedHDCPError):
554         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
555         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
556         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setClient):
557         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::clearClient):
558         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionIdentifierChanged):
559         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
560         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
561         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
562         (WebCore::MediaPlayerPrivateAVFoundationObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
563         (WebCore::playerKVOProperties):
564         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
565         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
566         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
567         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
568         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
569         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
570         (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):
571         (WebCore::SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
572         * testing/Internals.cpp:
573         (WebCore::Internals::beginSimulatedHDCPError):
574         (WebCore::Internals::endSimulatedHDCPError):
575         * testing/Internals.h:
576         * testing/Internals.idl:
577
578 2018-02-19  Chris Dumez  <cdumez@apple.com>
579
580         CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::TimerBase::~TimerBase
581         https://bugs.webkit.org/show_bug.cgi?id=182931
582         <rdar://problem/37602962>
583
584         Reviewed by Antti Koivisto.
585
586         Make sure PlatformMediaResource is ThreadSafeRefCounted since it is being
587         used from several threads in WebCoreNSURLSession. Also make sure it is
588         always destroyed on the main thread since it ends up destroying a
589         CachedRawResource object.
590
591         No new tests, no known reproduction case.
592
593         * platform/graphics/PlatformMediaResourceLoader.h:
594         * platform/network/cocoa/WebCoreNSURLSession.mm:
595         (-[WebCoreNSURLSessionDataTask dealloc]):
596
597 2018-02-19  Zalan Bujtas  <zalan@apple.com>
598
599         [RenderTreeBuilder] Rename RenderTreeBuilder::removeAndDestroyChild() -> removeAndDestroy()
600         https://bugs.webkit.org/show_bug.cgi?id=182934
601         <rdar://problem/37678241>
602
603         Reviewed by Antti Koivisto.
604
605         No change in functionality.
606
607         * dom/Document.cpp:
608         (WebCore::Document::setFullScreenRenderer):
609         * rendering/RenderBoxModelObject.cpp:
610         (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
611         * rendering/RenderButton.cpp:
612         (WebCore::RenderButton::setText):
613         * rendering/RenderFullScreen.cpp:
614         (WebCore::RenderFullScreen::willBeDestroyed):
615         (WebCore::RenderFullScreen::unwrapRenderer):
616         * rendering/RenderListItem.cpp:
617         (WebCore::RenderListItem::willBeDestroyed):
618         * rendering/RenderTextFragment.cpp:
619         (WebCore::RenderTextFragment::willBeDestroyed):
620         (WebCore::RenderTextFragment::setText):
621         * rendering/RenderView.cpp:
622         (WebCore::RenderView::willBeDestroyed):
623         * rendering/updating/RenderTreeBuilder.cpp:
624         (WebCore::RenderTreeBuilder::removeAndDestroy):
625         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
626         (WebCore::RenderTreeBuilder::removeAndDestroyChild): Deleted.
627         * rendering/updating/RenderTreeBuilder.h:
628         * rendering/updating/RenderTreeBuilderBlock.cpp:
629         (WebCore::RenderTreeBuilder::Block::takeChild):
630         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
631         (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
632         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
633         * rendering/updating/RenderTreeBuilderList.cpp:
634         (WebCore::RenderTreeBuilder::List::updateItemMarker):
635         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
636         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
637         (WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
638         * rendering/updating/RenderTreeBuilderRuby.cpp:
639         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
640         (WebCore::RenderTreeBuilder::Ruby::takeChild):
641
642 2018-02-19  Daniel Bates  <dabates@apple.com>
643
644         Do not block authentication challenge to navigated resources
645         https://bugs.webkit.org/show_bug.cgi?id=182807
646         <rdar://problem/37481619>
647
648         Reviewed by Brent Fulgham.
649
650         Blocking the main resource from asking for credentials depending on how it was
651         navigated to could be confusing to a person and breaks web compatibility. Restore
652         the behavior before r224134.
653
654         * loader/FrameLoader.cpp:
655         (WebCore::FrameLoader::receivedFirstData):
656         * loader/ResourceLoader.cpp:
657         (WebCore::ResourceLoader::init):
658         (WebCore::ResourceLoader::willSendRequestInternal):
659         (WebCore::ResourceLoader::didBlockAuthenticationChallenge):
660         (WebCore::ResourceLoader::isAllowedToAskUserForCredentials const):
661         (WebCore::ResourceLoader::isMixedContent const): Deleted.
662         * loader/ResourceLoader.h:
663         (WebCore::ResourceLoader::wasAuthenticationChallengeBlocked const):
664         (WebCore::ResourceLoader::wasInsecureRequestSeen const): Deleted.
665
666 2018-02-17  Antoine Quint  <graouts@apple.com>
667
668         [Web Animations] Store all parsed keyframe input information in a single structure
669         https://bugs.webkit.org/show_bug.cgi?id=182903
670
671         Reviewed by Dean Jackson.
672
673         When parsing keyframe input provided through the JS API, we used to create several data structures.
674         During parsing we would create a Vector<ProcessedKeyframe> where we would store the validated values
675         for "offset", "easing" and "composite" as well as CSS properties and CSS values as strings. 
676
677         Then we would create a KeyframeList, a class that pre-dates the work on Web Animations and is used
678         for hardware animations, with RenderStyle objects that are used for CSS property blending at runtime.
679         Once the KeyframeList was created, the Vector<ProcessedKeyframe> was discarded.
680
681         Since KeyframeList did not know about nullable offsets, timing functions and composite operations, and
682         because we do not with to modify a legacy class that we will eventually remove once all the Web Animations
683         work is complete, we also stored the parsed offsets as m_offsets, the timing functions as m_timingFunctions
684         and the composite operations as m_compositeOperations.
685
686         In this patch we rename the ProcessedKeyframe structure used temporarily during parsing to ParsedKeyframe and
687         store both the input and processed data related to a given keyframe in that single structure which we keep
688         around as m_parsedKeyframes when we finished processing the keyframes input. This update ParsedKeyframe structure
689         allows to keep around the original nullable offsets, the original CSS properties and CSS values as strings as
690         a HashMap<CSSPropertyID, String>, as well as the CSS properties and CSS values as CSSValue objects using a
691         MutableStyleProperties object. 
692
693         This has the benefit of reducing the number of members, but also pave the way for supporting read-write targets
694         where we will be able to decouple parsing keyframes and creating a KeyframeList, which requires a valid target
695         to create RenderStyle objects used for blending, since the original parsing-time information is now stored.
696
697         Finally, this allowed getKeyframes() to be more compliant by returning the CSS values as originally provided in
698         the keyframe input with shorthand properties when provided, rather than the long-hands we used to read back
699         through RenderStyle objects.
700
701         The generated KeyframeList is now stored as m_blendingKeyframes and is only used for the purpose of interfacing
702         with hardware animations and CSS property blending.
703
704         While ProcessedKeyframe was copyable due to holding only simple types, ParsedKeyframe is not since it uses a Ref
705         to hold the MutableStyleProperties. This uncovered some cases where we copied ProcessedKeyframe objects, we now
706         ensure that the ParsedKeyframe objects are moved instead, which was the correct thing to do all along.
707
708         * animation/KeyframeEffectReadOnly.cpp:
709         (WebCore::computeMissingKeyframeOffsets): While we used to store std::optional<double> for the computed offset,
710         we now store a simple double, which makes more sense since the computed offset is eventually a fully resolved
711         value after calling computeMissingKeyframeOffsets(). So we now compute the final computed offset without resorting
712         to intermediate nullable computed offsets.
713         (WebCore::processIterableKeyframes):
714         (WebCore::processPropertyIndexedKeyframes):
715         (WebCore::KeyframeEffectReadOnly::KeyframeEffectReadOnly):
716         (WebCore::KeyframeEffectReadOnly::copyPropertiesFromSource):
717         (WebCore::KeyframeEffectReadOnly::getKeyframes):
718         (WebCore::KeyframeEffectReadOnly::processKeyframes):
719         (WebCore::KeyframeEffectReadOnly::computeStackingContextImpact):
720         (WebCore::KeyframeEffectReadOnly::shouldRunAccelerated):
721         (WebCore::KeyframeEffectReadOnly::getAnimatedStyle):
722         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle):
723         (WebCore::KeyframeEffectReadOnly::startOrStopAccelerated):
724         * animation/KeyframeEffectReadOnly.h:
725         (WebCore::KeyframeEffectReadOnly::ParsedKeyframe::ParsedKeyframe):
726
727 2018-02-19  Zalan Bujtas  <zalan@apple.com>
728
729         [RenderTreeBuilder] Remove redundant RenderObject::removeFromParentAndDestroy
730         https://bugs.webkit.org/show_bug.cgi?id=182926
731         <rdar://problem/37674997>
732
733         Reviewed by Antti Koivisto.
734
735         Call RenderTreeBuilder::removeAndDestroyChild() directly instead. 
736
737         No change in functionality.
738
739         * dom/Document.cpp:
740         (WebCore::Document::setFullScreenRenderer):
741         * rendering/RenderBoxModelObject.cpp:
742         (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
743         * rendering/RenderButton.cpp:
744         (WebCore::RenderButton::setText):
745         * rendering/RenderFullScreen.cpp:
746         (WebCore::RenderFullScreen::willBeDestroyed):
747         (WebCore::RenderFullScreen::unwrapRenderer):
748         * rendering/RenderListItem.cpp:
749         (WebCore::RenderListItem::willBeDestroyed):
750         * rendering/RenderObject.cpp:
751         (WebCore::RenderObject::removeFromParentAndDestroy): Deleted.
752         * rendering/RenderObject.h:
753         * rendering/RenderTextFragment.cpp:
754         (WebCore::RenderTextFragment::willBeDestroyed):
755         (WebCore::RenderTextFragment::setText):
756         * rendering/updating/RenderTreeBuilder.cpp:
757         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
758         * rendering/updating/RenderTreeBuilderBlock.cpp:
759         (WebCore::RenderTreeBuilder::Block::takeChild):
760         * rendering/updating/RenderTreeBuilderList.cpp:
761         (WebCore::RenderTreeBuilder::List::updateItemMarker):
762         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
763         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
764         (WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
765         * rendering/updating/RenderTreeBuilderRuby.cpp:
766         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
767         (WebCore::RenderTreeBuilder::Ruby::takeChild):
768
769 2018-02-19  Tim Horton  <timothy_horton@apple.com>
770
771         Increase text autosizing constants for extra zoom mode
772         https://bugs.webkit.org/show_bug.cgi?id=182919
773         <rdar://problem/37671259>
774
775         Reviewed by Wenson Hsieh.
776
777         * page/Settings.yaml:
778         * page/SettingsBase.cpp:
779         (WebCore::SettingsBase::defaultMinimumZoomFontSize):
780         (WebCore::SettingsBase::defaultOneLineTextMultiplierCoefficient):
781         (WebCore::SettingsBase::defaultMultiLineTextMultiplierCoefficient):
782         (WebCore::SettingsBase::defaultMaxTextAutosizingScaleIncrease):
783         * page/SettingsBase.h:
784         * rendering/RenderBlockFlow.cpp:
785         (WebCore::oneLineTextMultiplier):
786         (WebCore::textMultiplier):
787         (WebCore::RenderBlockFlow::adjustComputedFontSizes):
788         * rendering/TextAutoSizing.cpp:
789         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
790         Make autosizing constants settings, and change their default values.
791
792 2018-02-17  Antoine Quint  <graouts@apple.com>
793
794         [Web Animations] Accept null composite modes in keyframes
795         https://bugs.webkit.org/show_bug.cgi?id=182902
796
797         Reviewed by Dean Jackson.
798
799         The Web Animations spec used to specify that that composite modes should be non-null and instead not be
800         provided when specifying keyframes, but now null values are accepted. We update the IDL input types used
801         when parsing keyframes to allow for null values.
802
803         We had already updated the getKeyframes() output in webkit.org/b/182600.
804
805         * animation/KeyframeEffectReadOnly.cpp:
806         (WebCore::processIterableKeyframes):
807         (WebCore::processKeyframeLikeObject):
808         (WebCore::processPropertyIndexedKeyframes):
809         * animation/KeyframeEffectReadOnly.h:
810         * animation/KeyframeEffectReadOnly.idl:
811
812 2018-02-19  Ms2ger  <Ms2ger@igalia.com>
813
814         Explicitly qualify some method calls on this in lamdas in Service Worker code.
815         https://bugs.webkit.org/show_bug.cgi?id=182875
816
817         Reviewed by Chris Dumez.
818
819         This is necessary for the code to build with GCC 5. Other code already
820         appears to have been adapted similarly.
821
822         No change in functionality.
823
824         * loader/DocumentLoader.cpp:
825         (WebCore::DocumentLoader::redirectReceived):
826         (WebCore::DocumentLoader::startLoadingMainResource):
827         * workers/service/ServiceWorkerContainer.cpp:
828         (WebCore::ServiceWorkerContainer::ready):
829         (WebCore::ServiceWorkerContainer::getRegistration):
830         (WebCore::ServiceWorkerContainer::getRegistrations):
831         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationsRequest):
832         * workers/service/ServiceWorkerGlobalScope.cpp:
833         (WebCore::ServiceWorkerGlobalScope::updateExtendedEventsSet):
834         * workers/service/server/SWServer.cpp:
835         (WebCore::SWServer::claim):
836         (WebCore::SWServer::Connection::resolveRegistrationReadyRequests):
837         * workers/service/server/SWServerRegistration.cpp:
838         (WebCore::SWServerRegistration::updateRegistrationState):
839         (WebCore::SWServerRegistration::setUpdateViaCache):
840         (WebCore::SWServerRegistration::setLastUpdateTime):
841         (WebCore::SWServerRegistration::fireUpdateFoundEvent):
842         * workers/service/server/SWServerWorker.cpp:
843         (WebCore::SWServerWorker::setState):
844
845 2018-02-19  Zalan Bujtas  <zalan@apple.com>
846
847         [RenderTreeBuilder] Move RenderElement::removeAndDestroyChild() to RenderTreeBuilder
848         https://bugs.webkit.org/show_bug.cgi?id=182915
849         <rdar://problem/37658123>
850
851         Reviewed by Antti Koivisto.
852
853         No change in functionality.
854
855         * rendering/RenderElement.cpp:
856         (WebCore::RenderElement::removeAndDestroyChild): Deleted.
857         * rendering/RenderElement.h:
858         (WebCore::RenderElement::isChildAllowed const):
859         * rendering/RenderObject.cpp:
860         (WebCore::RenderObject::removeFromParentAndDestroy):
861         * rendering/RenderView.cpp:
862         (WebCore::RenderView::willBeDestroyed):
863         * rendering/updating/RenderTreeBuilder.cpp:
864         (WebCore::RenderTreeBuilder::removeAndDestroyChild):
865         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
866         * rendering/updating/RenderTreeBuilder.h:
867         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
868         (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
869         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
870
871 2018-02-12  Sergio Villar Senin  <svillar@igalia.com>
872
873         [WebVR][OpenVR] Implement getVRDisplays()
874         https://bugs.webkit.org/show_bug.cgi?id=182692
875
876         Reviewed by Žan Doberšek.
877
878         This provides an implementation of Navigator's getVRDisplays()
879         method using OpenVR as backend. It queues several promises in
880         a queue and resolves them all just once. The information retrieved
881         is very minimal for the time being, but this change lays the ground
882         for all the changes that are about to land.
883
884         The VR code uses a VRManager which is the interface with the
885         platform code and the responsible for instantiating the right
886         platform code. This platform code is currently being implemented
887         using OpenVR but could we also ported in the future to OpenXR or any
888         other VR SDK.
889
890         * CMakeLists.txt:
891         * Modules/webvr/NavigatorWebVR.cpp:
892         (WebCore::NavigatorWebVR::getVRDisplays):
893         (WebCore::NavigatorWebVR::vrEnabled):
894         * Modules/webvr/NavigatorWebVR.h:
895         * Modules/webvr/VRDisplay.cpp:
896         (WebCore::VRDisplay::create):
897         (WebCore::VRDisplay::VRDisplay):
898         (WebCore::VRDisplay::isConnected const):
899         (WebCore::VRDisplay::displayName const):
900         * Modules/webvr/VRDisplay.h:
901         * Modules/webvr/VRDisplayCapabilities.cpp:
902         (WebCore::VRDisplayCapabilities::VRDisplayCapabilities):
903         (WebCore::VRDisplayCapabilities::hasPosition const):
904         (WebCore::VRDisplayCapabilities::hasOrientation const):
905         (WebCore::VRDisplayCapabilities::hasExternalDisplay const):
906         (WebCore::VRDisplayCapabilities::canPresent const):
907         (WebCore::VRDisplayCapabilities::maxLayer const):
908         * Modules/webvr/VRDisplayCapabilities.h:
909         (WebCore::VRDisplayCapabilities::create):
910         * Sources.txt:
911         * platform/vr/VRManager.cpp: Added. This is the main interface used by bindings code to
912         access VR devices data provided by platform code.
913         (WebCore::VRManager::singleton):
914         (WebCore::VRManager::VRManager):
915         (WebCore::VRManager::~VRManager):
916         (WebCore::VRManager::refreshVRDevices):
917         * platform/vr/VRManager.h: Added.
918         * platform/vr/VRPlatformDisplay.h: Added. Abstraction of a VR display system. To be
919         implemented by backends like OpenVR, OpenXR...
920         * platform/vr/VRPlatformManager.h: Added. Abstraction of the platform specific class which
921         retrieves data from VR devices. To be implemented by backends like OpenVR, OpenXR...
922         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp: Added.
923         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
924         * platform/vr/openvr/VRPlatformDisplayOpenVR.h: Added.
925         * platform/vr/openvr/VRPlatformManagerOpenVR.cpp: Added.
926         (WebCore::VRPlatformManagerOpenVR::create):
927         (WebCore::VRPlatformManagerOpenVR::VRPlatformManagerOpenVR):
928         (WebCore::VRPlatformManagerOpenVR::~VRPlatformManagerOpenVR):
929         (WebCore::VRPlatformManagerOpenVR::initOpenVR):
930         * platform/vr/openvr/VRPlatformManagerOpenVR.h: Added.
931         * WebCore.xcodeproj/project.pbxproj:
932
933 2018-02-19  Manuel Rego Casasnovas  <rego@igalia.com>
934
935         [css-grid] Apply automatic minimum size clamping to spanning items too
936         https://bugs.webkit.org/show_bug.cgi?id=182684
937
938         Reviewed by Javier Fernandez.
939
940         In r225776 we added the conditions from the spec to apply
941         the automatic minimum size clamping when required
942         but only to non-spanning items.
943         See: https://drafts.csswg.org/css-grid/#min-size-auto
944
945         This patch moves the code from GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem()
946         to GridTrackSizingAlgorithmStrategy::minSizeForChild()
947         that way the clamping is applied for both spanning and non-spanning items.
948
949         This somehow reverts r225776, as it was adding some duplicated code.
950         All the checks to know if we should use that part of the spec
951         were already present in GridTrackSizingAlgorithmStrategy::minSizeForChild().
952
953         Apart from using the previous code, there's a new loop to verify
954         that the max track sizing function is fixed for all the tracks of the item.
955
956         Tests: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-024.html
957                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-025.html
958
959         * rendering/GridTrackSizingAlgorithm.cpp:
960         (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem):
961         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
962
963 2018-02-19  Philippe Normand  <pnormand@igalia.com>
964
965         [GTK][GStreamer] Replaying a webm video twice causes the video to stop getting rendered
966         https://bugs.webkit.org/show_bug.cgi?id=176789
967
968         Reviewed by Xabier Rodriguez-Calvar.
969
970         Ensure the wrapped GstGLContext is set when the pipeline goes from
971         READY to PAUSED state. This is a workaround for
972         https://bugzilla.gnome.org/show_bug.cgi?id=757933.
973
974         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
975         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Add debug statement.
976         (WebCore::MediaPlayerPrivateGStreamer::readyTimerFired): Ditto.
977         (WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
978         Ensure the wrapped GstGLContext is set when the pipeline goes from
979         READY to PAUSED state.
980         (WebCore::MediaPlayerPrivateGStreamer::didEnd): Add debug statement.
981         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
982         Change the requestGLContext to be a method instead of a static
983         function. Being a static function was a requirement for the now-removed OpenWebRTC player.
984         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): Add
985         debug statement, fix requestGLContext usage.
986         (WebCore::MediaPlayerPrivateGStreamerBase::requestGLContext): Refactor as method.
987         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer): Fix requestGLContext usage.
988         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL): Remove fixed FIXME.
989         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGLVideoSinkContext):
990         Set display and app wrapped contexts on the video sink.
991         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
992
993 2018-02-19  Xabier Rodriguez Calvar  <calvaris@igalia.com>
994
995         [GStreamer] Crash in WebCore::MediaPlayerRequestInstallMissingPluginsCallback::complete
996         https://bugs.webkit.org/show_bug.cgi?id=166733
997
998         Reviewed by Philippe Normand.
999
1000         There are a couple of issues to tackle here.
1001
1002         First is handling getting more than one missing plugin
1003         installation request at the same time. For this we add the request
1004         to a Vector and handle them there.
1005
1006         Second is that if the player is dead and we still get the result,
1007         bad things happen. For that we "weaked" the pointer capture by the
1008         lambda.
1009
1010         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1011         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
1012         Handle Vector of callbacks.
1013         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Weak
1014         private player pointer and put the callback in the Vector.
1015         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1016         Callback becomes Vector.
1017         * platform/graphics/gstreamer/MediaPlayerRequestInstallMissingPluginsCallback.h:
1018         (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::create):
1019         (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::complete):
1020         (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::MediaPlayerRequestInstallMissingPluginsCallback):
1021         Callback function is refactored into a "using" type and added self
1022         as parameter to the function.
1023
1024 2018-02-19  Philippe Normand  <pnormand@igalia.com>
1025
1026         [GStreamer] Playbin3 support
1027         https://bugs.webkit.org/show_bug.cgi?id=182530
1028
1029         Reviewed by Xabier Rodriguez-Calvar.
1030
1031         This patch introduces opt-in support for the playbin3 GStreamer
1032         element. This new playback element is still considered
1033         experimental but it can still be very useful for media assets
1034         containing multiple tracks of the same type. In such scenario
1035         audio/video decoders would be created only for the selected tracks
1036         whereas playbin2 creates decoder for each track.
1037
1038         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp: Take
1039         a weak pointer of the media player instead of playbin and call the
1040         player when enabling tracks. Also use the GstStream API instead of
1041         inspecting the pad when playbin3 is used.
1042         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
1043         (WebCore::AudioTrackPrivateGStreamer::disconnect):
1044         (WebCore::AudioTrackPrivateGStreamer::markAsActive):
1045         (WebCore::AudioTrackPrivateGStreamer::setEnabled):
1046         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
1047         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp: GstStream and
1048         GstStreamCollection smart pointer support.
1049         (WTF::adoptGRef):
1050         (WTF::refGPtr<GstStream>):
1051         (WTF::derefGPtr<GstStream>):
1052         (WTF::refGPtr<GstStreamCollection>):
1053         (WTF::derefGPtr<GstStreamCollection>):
1054         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
1055         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
1056         Use the GstStream API instead of inspecting the pad when playbin3
1057         is used.
1058         (WebCore::InbandTextTrackPrivateGStreamer::InbandTextTrackPrivateGStreamer):
1059         (WebCore::InbandTextTrackPrivateGStreamer::disconnect):
1060         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
1061         (WebCore::InbandTextTrackPrivateGStreamer::create):
1062         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1063         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
1064         m_{audio,video,text}Tracks are now hashmaps, which is a bit more
1065         convenient to use than Vectors.
1066         (WebCore::MediaPlayerPrivateGStreamer::updateTracks): Update our
1067         tracks implementations depending on the streams stored in the
1068         collection.
1069         (WebCore::MediaPlayerPrivateGStreamer::enableTrack): Activate the
1070         given track. This method is called by the TrackPrivate
1071         implementations.
1072         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
1073         Refactored legacy (playbin2) support for track hashmap storage.
1074         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
1075         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText): Ditto.
1076         (WebCore::MediaPlayerPrivateGStreamer::newTextSample): Use track hashmap storage.
1077         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): React on
1078         playbin3 GstStream messages, store the collection provided and
1079         activate the given selected streams accordingly.
1080         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks): Invalidate tracks no longer needed.
1081         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto.
1082         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto.
1083         (WebCore::MediaPlayerPrivateGStreamer::sourceSetupCallback):
1084         Refactoring, use source-setup signal instead of the source
1085         property which is not supported in playbin3.
1086         (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback):
1087         Promoted logging messages, GST_TRACE should be used for very
1088         frequent and less interesting messages.
1089         (WebCore::MediaPlayerPrivateGStreamer::downloadBufferFileCreatedCallback): Ditto.
1090         (WebCore::MediaPlayerPrivateGStreamer::sourceSetup): Called by the source-setup signal handler.
1091         (WebCore::MediaPlayerPrivateGStreamer::setDownloadBuffering): Debugging message added.
1092         (WebCore::MediaPlayerPrivateGStreamer::setPreload): Ditto.
1093         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Create a
1094         playbin3 element if USE(GSTREAMER_PLAYBIN3) was enabled and
1095         connect to playbin2 signals otherwise.
1096         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1097         (WebCore::MediaPlayerPrivateGStreamer::createWeakPtr): Promoted to public.
1098         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1099         New StreamCollectionChanged notification type, used the sub-class.
1100         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
1101         (WebCore::TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer): Support for GstStream API.
1102         (WebCore::TrackPrivateBaseGStreamer::disconnect): Clear GstStream too.
1103         (WebCore::TrackPrivateBaseGStreamer::tagsChanged): Get tags from GstStream.
1104         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfActiveChanged): No need to check m_pad twice.
1105         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged): Ditto.
1106         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
1107         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp: Take
1108         a weak pointer of the media player instead of playbin and call the
1109         player when enabling tracks. Also use the GstStream API instead of
1110         inspecting the pad when playbin3 is used.
1111         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
1112         (WebCore::VideoTrackPrivateGStreamer::disconnect):
1113         (WebCore::VideoTrackPrivateGStreamer::markAsActive):
1114         (WebCore::VideoTrackPrivateGStreamer::setSelected):
1115         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
1116         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Pass player pointer to track constructor.
1117         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
1118         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: Source-setup signal handler.
1119         (WebCore::MediaPlayerPrivateGStreamerMSE::sourceSetup):
1120         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
1121
1122 2018-02-19  Fujii Hironori  <Hironori.Fujii@sony.com>
1123
1124         REGRESSION(r219298): RELEASE_ASSERT(!m_owningPointerForClose) fails in WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose
1125         https://bugs.webkit.org/show_bug.cgi?id=174354
1126         <rdar://problem/33294987>
1127
1128         Reviewed by Michael Catanzaro.
1129
1130         UniqueIDBDatabase::invokeOperationAndTransactionTimer was called
1131         even after m_owningPointerForClose was set in
1132         UniqueIDBDatabase::didDeleteBackingStore.
1133
1134         No new tests (Covered by existing tests).
1135
1136         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1137         (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
1138         Do not start deleting the UniqueIDBDatabase. Just call invokeOperationAndTransactionTimer.
1139         (WebCore::IDBServer::UniqueIDBDatabase::invokeOperationAndTransactionTimer):
1140         Assert m_owningPointerForClose is null.
1141
1142 2018-02-18  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
1143
1144         Fix build error after r228417 without ACCESSIBILITY
1145         https://bugs.webkit.org/show_bug.cgi?id=182914
1146
1147         Reviewed by Chris Fleizach.
1148
1149         An inline empty version of AXObjectCache::deferFocusdUIElementChangeIfNeeded()
1150         needs to be defined if not HAVE(ACCESSIBILITY). 
1151
1152         * accessibility/AXObjectCache.h:
1153         (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded):
1154
1155 2018-02-18  Zalan Bujtas  <zalan@apple.com>
1156
1157         [RenderTreeBuilder] REGRESSION(r228238) Detach renderer before destroying its subtree.
1158         https://bugs.webkit.org/show_bug.cgi?id=182908
1159         <rdar://problem/37619394>
1160
1161         Reviewed by Antti Koivisto.
1162
1163         Prior to r228238 we first detached the to-be-destroyed renderer and then
1164         started nuking its descendants. r228238 changed the order and now the descendants are
1165         destroyed while they are still attached to the tree. Apparently some of the takeChild()
1166         normalization logic gets triggered now that the renderers still have access to their previous/next
1167         siblings. This is unexpected and it shouldn't matter whether the subtree is still attached.
1168         Let's revert it to the original order for now (see webkit.org/b/182909).
1169
1170         Test: fast/block/crash-when-subtree-is-still-attached.html
1171
1172         * rendering/RenderElement.cpp:
1173         (WebCore::RenderElement::removeAndDestroyChild):
1174
1175 2018-02-18  Charlie Turner  <cturner@igalia.com>
1176
1177         [GStreamer] Push smaller buffers from HTTP source
1178         https://bugs.webkit.org/show_bug.cgi?id=182829
1179
1180         Reviewed by Philippe Normand.
1181
1182         Split the received buffer into smaller buffers of a size consistent
1183         with the basesrc (4KiB). It is important not to push large buffers
1184         into the appsrc (where large is relative to the appsrc's configured
1185         byte size). If large buffers are pushed, then when they are internally
1186         dequeued by the appsrc, the buffering percentage can dramatically
1187         plummet due to a large amount of bytes being removed after a push. This
1188         can in turn trick the media player into thinking it needs to buffer,
1189         and then issuing a spurious set of playing->paused then
1190         paused->playing transitions, which by the time the buffering logic
1191         completes, data are already available.
1192
1193         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1194         (CachedResourceStreamingClient::dataReceived):
1195
1196 2018-02-17  Darin Adler  <darin@apple.com>
1197
1198         Web Inspector: get rid of remaining uses of OptOutput<T>
1199         https://bugs.webkit.org/show_bug.cgi?id=180607
1200
1201         Reviewed by Brian Burg.
1202
1203         * inspector/InspectorStyleSheet.cpp:
1204         (WebCore::buildSourceRangeObject): Take a const Vector& instead of a Vector*.
1205         (WebCore::InspectorStyle::buildObjectForStyle const): Pass lineEndings() instead
1206         of lineEndings().get().
1207         (WebCore::InspectorStyle::styleWithProperties const): Ditto.
1208         (WebCore::InspectorStyleSheet::buildObjectForSelectorList): Ditto.
1209         (WebCore::InspectorStyleSheet::lineEndings const): Return a Vector instead of
1210         a std::unique_ptr<Vector>.
1211         (WebCore::InspectorStyleSheetForInlineStyle::lineEndings const): Ditto.
1212         * inspector/InspectorStyleSheet.h: Updated for the above.
1213
1214         * inspector/agents/InspectorCSSAgent.h: Removed some bogus const.
1215         * inspector/agents/InspectorCanvasAgent.cpp: Ditto.
1216         * inspector/agents/InspectorCanvasAgent.h: Ditto.
1217
1218         * inspector/agents/InspectorDOMDebuggerAgent.cpp: Improved type of global strings
1219         so we don't waste space with a pointer to the string.
1220         (WebCore::InspectorDOMDebuggerAgent::setEventListenerBreakpoint): Removed
1221         explicit creation of String, which was wasteful and unnecessary.
1222         (WebCore::InspectorDOMDebuggerAgent::setInstrumentationBreakpoint): Ditto.
1223         (WebCore::InspectorDOMDebuggerAgent::removeEventListenerBreakpoint): Ditto.
1224         (WebCore::InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint): Ditto.
1225         (WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint): Removed bogus const.
1226
1227         * inspector/agents/InspectorDOMDebuggerAgent.h: Removed bogus const and use
1228         final instead of override.
1229         * inspector/agents/InspectorPageAgent.cpp: Ditto.
1230         * inspector/agents/InspectorPageAgent.h: Ditto.
1231
1232 2018-02-16  Zalan Bujtas  <zalan@apple.com>
1233
1234         [RenderTreeBuilder] Cleanup RenderTreeBuilder
1235         https://bugs.webkit.org/show_bug.cgi?id=182899
1236         <rdar://problem/37627888>
1237
1238         Reviewed by Antti Koivisto.
1239
1240         No change in functionality.
1241
1242         * rendering/RenderBlockFlow.cpp:
1243         (WebCore::RenderBlockFlow::styleDidChange):
1244         * rendering/updating/RenderTreeBuilder.cpp:
1245         (WebCore::RenderTreeBuilder::takeChild):
1246         (WebCore::RenderTreeBuilder::moveChildTo):
1247         (WebCore::RenderTreeBuilder::moveAllChildrenTo):
1248         (WebCore::RenderTreeBuilder::moveChildrenTo):
1249         (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloatsTo):
1250         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
1251         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
1252         (WebCore::RenderTreeBuilder::takeChildFromRenderMenuList): Deleted.
1253         (WebCore::RenderTreeBuilder::takeChildFromRenderButton): Deleted.
1254         * rendering/updating/RenderTreeBuilder.h:
1255         (WebCore::RenderTreeBuilder::current):
1256         * rendering/updating/RenderTreeBuilderBlock.cpp:
1257         (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild):
1258         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
1259         (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloatsTo):
1260         * rendering/updating/RenderTreeBuilderFormControls.cpp:
1261         (WebCore::RenderTreeBuilder::FormControls::takeChild):
1262         * rendering/updating/RenderTreeBuilderFormControls.h:
1263         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
1264         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
1265         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
1266         * rendering/updating/RenderTreeBuilderRuby.cpp:
1267         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
1268         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
1269         (WebCore::RenderTreeBuilder::Ruby::takeChild):
1270         * rendering/updating/RenderTreeBuilderTable.cpp:
1271         (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
1272
1273 2018-02-16  Daniel Bates  <dabates@apple.com>
1274
1275         Remove UTF-32 BOM parsing code
1276         https://bugs.webkit.org/show_bug.cgi?id=182900
1277         <rdar://problem/37238717>
1278
1279         Reviewed by Alexey Proskuryakov.
1280
1281         The UTF-32 encodings were removed from the text codec registry in r224747. So,
1282         we no longer need code to parse UTF-32{BE, LE} BOM or encode and decode these
1283         variants.
1284
1285         * dom/TextDecoder.cpp:
1286         (WebCore::codeUnitByteSize):
1287         * loader/TextResourceDecoder.cpp:
1288         (WebCore::TextResourceDecoder::checkForBOM):
1289         (WebCore::TextResourceDecoder::checkForHeadCharset):
1290         * platform/text/TextEncoding.cpp:
1291         (WebCore::TextEncoding::isNonByteBasedEncoding const):
1292         (WebCore::UTF32BigEndianEncoding): Deleted.
1293         (WebCore::UTF32LittleEndianEncoding): Deleted.
1294         * platform/text/TextEncoding.h:
1295
1296 2018-02-16  Zalan Bujtas  <zalan@apple.com>
1297
1298         [RenderTreeBuilder] Move RenderBoxModelObject::moveChild*() to RenderTreeBuilder
1299         https://bugs.webkit.org/show_bug.cgi?id=182896
1300         <rdar://problem/37623051>
1301
1302         Reviewed by Antti Koivisto.
1303
1304         No change in functionality.
1305
1306         * rendering/RenderBlock.h:
1307         (WebCore::RenderBlock::moveAllChildrenIncludingFloatsTo): Deleted.
1308         * rendering/RenderBlockFlow.cpp:
1309         (WebCore::RenderBlockFlow::styleDidChange):
1310         (WebCore::RenderBlockFlow::moveAllChildrenIncludingFloatsTo): Deleted.
1311         * rendering/RenderBlockFlow.h:
1312         * rendering/RenderBoxModelObject.cpp:
1313         (WebCore::RenderBoxModelObject::moveChildTo): Deleted.
1314         (WebCore::RenderBoxModelObject::moveChildrenTo): Deleted.
1315         (WebCore::RenderBoxModelObject::moveAllChildrenToInternal): Deleted.
1316         * rendering/RenderBoxModelObject.h:
1317         (WebCore::RenderBoxModelObject::moveChildTo): Deleted.
1318         (WebCore::RenderBoxModelObject::moveAllChildrenTo): Deleted.
1319         (WebCore::RenderBoxModelObject::moveChildrenTo): Deleted.
1320         * rendering/updating/RenderTreeBuilder.cpp:
1321         (WebCore::RenderTreeBuilder::moveChildTo):
1322         (WebCore::RenderTreeBuilder::moveAllChildrenTo):
1323         (WebCore::RenderTreeBuilder::moveChildrenTo):
1324         (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloatsTo):
1325         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
1326         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
1327         * rendering/updating/RenderTreeBuilder.h:
1328         * rendering/updating/RenderTreeBuilderBlock.cpp:
1329         (WebCore::moveAllChildrenToInternal):
1330         (WebCore::RenderTreeBuilder::Block::removeLeftoverAnonymousBlock):
1331         (WebCore::RenderTreeBuilder::Block::takeChild):
1332         (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild):
1333         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
1334         (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloatsTo):
1335         * rendering/updating/RenderTreeBuilderBlockFlow.h:
1336         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
1337         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
1338         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
1339         * rendering/updating/RenderTreeBuilderRuby.cpp:
1340         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
1341         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
1342         (WebCore::RenderTreeBuilder::Ruby::takeChild):
1343         * rendering/updating/RenderTreeBuilderTable.cpp:
1344         (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
1345
1346 2018-02-16  Andy Estes  <aestes@apple.com>
1347
1348         [Cocoa] Stop using non-prefixed vDSP functions in 32-bit builds
1349         https://bugs.webkit.org/show_bug.cgi?id=182898
1350         <rdar://problem/37195079>
1351
1352         Reviewed by Tim Horton.
1353
1354         There's no need to use non-prefixed vDSP function aliases on 32-bit builds.
1355         The vDSP-prefixed versions are available on all Cocoa platforms we currently support.
1356
1357         * platform/audio/DirectConvolver.cpp:
1358         (WebCore::DirectConvolver::process):
1359         * platform/audio/VectorMath.cpp:
1360         (WebCore::VectorMath::vsmul):
1361         (WebCore::VectorMath::vadd):
1362         (WebCore::VectorMath::vmul):
1363         (WebCore::VectorMath::zvmul):
1364
1365 2018-02-16  Ryan Haddad  <ryanhaddad@apple.com>
1366
1367         Unreviewed, rolling out r228575.
1368
1369         Introduced LayoutTest crashes under GuardMalloc.
1370
1371         Reverted changeset:
1372
1373         "Use ResourceLoader to load appcache manifest"
1374         https://bugs.webkit.org/show_bug.cgi?id=182861
1375         https://trac.webkit.org/changeset/228575
1376
1377 2018-02-16  Dean Jackson  <dino@apple.com>
1378
1379         Use OPENGL macros to be more clear about which OpenGL/ES WebGL uses on Cocoa
1380         https://bugs.webkit.org/show_bug.cgi?id=182894
1381
1382         Reviewed by Tim Horton.
1383
1384         Adjust the places where we check for PLATFORM(MAC) or
1385         PLATFORM(IOS) related to WebGL, and instead rely
1386         on USE(OPENGL) USE(OPENGL_ES).
1387
1388         * CMakeLists.txt:
1389         * PlatformGTK.cmake:
1390         * platform/graphics/GLContext.cpp:
1391         (WebCore::initializeOpenGLShimsIfNeeded):
1392         * platform/graphics/GraphicsContext3DPrivate.cpp:
1393         * platform/graphics/OpenGLESShims.h:
1394         * platform/graphics/cairo/ImageBufferCairo.cpp:
1395         * platform/graphics/egl/GLContextEGL.cpp:
1396         (WebCore::GLContextEGL::getEGLConfig):
1397         (WebCore::GLContextEGL::createContext):
1398         (WebCore::GLContextEGL::createSharingContext):
1399         * platform/graphics/egl/GLContextEGLWPE.cpp:
1400         (WebCore::GLContextEGL::createWPEContext):
1401         * platform/graphics/egl/GLContextEGLWayland.cpp:
1402         (WebCore::GLContextEGL::createWaylandContext):
1403         * platform/graphics/egl/GLContextEGLX11.cpp:
1404         (WebCore::GLContextEGL::createPixmapContext):
1405         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1406         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
1407         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
1408         (WebCore::VideoTextureCopierGStreamer::VideoTextureCopierGStreamer):
1409         (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer):
1410         (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
1411         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h:
1412         * platform/graphics/opengl/Extensions3DOpenGLES.cpp:
1413         * platform/graphics/opengl/Extensions3DOpenGLES.h:
1414         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
1415         (WebCore::GraphicsContext3D::create):
1416         (WebCore::GraphicsContext3D::GraphicsContext3D):
1417         (WebCore::GraphicsContext3D::isGLES2Compliant const):
1418         * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp:
1419         (WebCore::GraphicsContext3D::create):
1420         (WebCore::GraphicsContext3D::GraphicsContext3D):
1421         (WebCore::GraphicsContext3D::~GraphicsContext3D):
1422         (WebCore::GraphicsContext3D::isGLES2Compliant const):
1423         (WebCore::GraphicsContext3D::getExtensions):
1424         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
1425         (WebCore::TextureMapperContextAttributes::initialize):
1426         * platform/graphics/texmap/TextureMapperGL.cpp:
1427         (WebCore::TextureMapperGLData::~TextureMapperGLData):
1428         (WebCore::TextureMapperGLData::getVAO):
1429         (WebCore::TextureMapperGL::beginPainting):
1430         (WebCore::TextureMapperGL::endPainting):
1431         * platform/graphics/texmap/TextureMapperGLHeaders.h:
1432         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
1433         (WebCore::TextureMapperShaderProgram::create):
1434
1435 2018-02-16  Zalan Bujtas  <zalan@apple.com>
1436
1437         [RenderTreeBuilder] Move RenderElement::insertChildInternal() to RenderTreeBuilder
1438         https://bugs.webkit.org/show_bug.cgi?id=182885
1439         <rdar://problem/37617371>
1440
1441         Reviewed by Antti Koivisto.
1442
1443         No change in functionality.
1444
1445         * rendering/RenderElement.cpp:
1446         (WebCore::RenderElement::insertChildInternal): Deleted.
1447         * rendering/RenderObject.h:
1448         * rendering/updating/RenderTreeBuilder.cpp:
1449         (WebCore::RenderTreeBuilder::insertChildToRenderElement):
1450
1451 2018-02-16  Youenn Fablet  <youenn@apple.com>
1452
1453         Allow specifying which plug-ins are supported
1454         https://bugs.webkit.org/show_bug.cgi?id=182748
1455
1456         Reviewed by Chris Dumez.
1457
1458         Tests: http/tests/plugins/nounsupported-plugin.html
1459                http/tests/plugins/supported-plugin-all-origin-visibility.html
1460                http/tests/plugins/supported-plugin-on-specific-origin.html
1461                http/tests/plugins/supported-plugin-origin-specific-visibility.html
1462                http/tests/plugins/unsupported-plugin-on-specific-origin.html
1463                plugins/unsupported-plugin.html
1464
1465         Added support for computing plugin web visibility with the added knowledge of supported plugins.
1466         In case of a plugin failing to be created due to being unsupported, update the UI
1467         to use mark the plugin as "Unexpected plug in".
1468
1469         Added internal API to retrieve the plug-in error description message.
1470
1471         * English.lproj/Localizable.strings:
1472         * WebCore.xcodeproj/project.pbxproj:
1473         * html/HTMLPlugInElement.cpp:
1474         (WebCore::HTMLPlugInElement::setReplacement):
1475         * html/HTMLPlugInElement.h:
1476         * loader/EmptyClients.cpp:
1477         * platform/LocalizedStrings.cpp:
1478         (WebCore::unsupportedPluginText):
1479         * platform/LocalizedStrings.h:
1480         * plugins/PluginData.cpp:
1481         (WebCore::PluginData::initPlugins):
1482         * plugins/PluginData.h:
1483         (WebCore::decodePluginNames):
1484         (WebCore::encodePluginNames):
1485         (WebCore::SupportedPluginNames::decode):
1486         (WebCore::SupportedPluginNames::encode const):
1487         * plugins/PluginInfoProvider.h:
1488         * rendering/RenderEmbeddedObject.cpp:
1489         (WebCore::unavailablePluginReplacementText):
1490         * rendering/RenderEmbeddedObject.h:
1491         (WebCore::RenderEmbeddedObject::pluginReplacementTextIfUnavailable const):
1492         * testing/Internals.cpp:
1493         (WebCore::Internals::unavailablePluginReplacementText):
1494         * testing/Internals.h:
1495         * testing/Internals.idl:
1496
1497 2018-02-16  Chris Dumez  <cdumez@apple.com>
1498
1499         http/tests/security/http-0.9/xhr-blocked.html is flaky
1500         https://bugs.webkit.org/show_bug.cgi?id=182857
1501         <rdar://problem/37616958>
1502
1503         Reviewed by Antti Koivisto.
1504
1505         WebCoreResourceHandleAsOperationQueueDelegate does not own the messageQueue and
1506         the detachHandle function was failing to nullout m_messageQueue when the resourceHandle
1507         gets destroyed. This means that callFunctionOnMainThread would sometimes try to append
1508         to a dead messageQueue.
1509
1510         No new tests, already covered by:
1511         http/tests/security/http-0.9/xhr-blocked.html is flaky
1512
1513         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1514         (-[WebCoreResourceHandleAsOperationQueueDelegate detachHandle]):
1515
1516 2018-02-16  Antti Koivisto  <antti@apple.com>
1517
1518         Assert in mixed blend animation
1519         https://bugs.webkit.org/show_bug.cgi?id=182887
1520         <rdar://problem/37598140>
1521
1522         Reviewed by Zalan Bujtas.
1523
1524         Test: fast/css/calc-mixed-blend-crash.html
1525
1526         * platform/CalculationValue.cpp:
1527         (WebCore::CalcExpressionBlendLength::CalcExpressionBlendLength):
1528
1529         Fix mismatch between the type test and the value used.
1530
1531 2018-02-16  Zalan Bujtas  <zalan@apple.com>
1532
1533         [RenderTreeBuilder] Move RenderBlock/RenderInline::addChildIgnoringContinuation() to RenderTreeBuilder
1534         https://bugs.webkit.org/show_bug.cgi?id=182876
1535         <rdar://problem/37607604>
1536
1537         Reviewed by Antti Koivisto.
1538
1539         No change in functionality.
1540
1541         * rendering/RenderBlock.cpp:
1542         (WebCore::RenderBlock::addChildIgnoringContinuation): Deleted.
1543         * rendering/RenderBlock.h:
1544         * rendering/RenderElement.cpp:
1545         (WebCore::RenderElement::addChildIgnoringContinuation): Deleted.
1546         * rendering/RenderElement.h:
1547         * rendering/RenderInline.cpp:
1548         (WebCore::RenderInline::addChildIgnoringContinuation): Deleted.
1549         * rendering/RenderInline.h:
1550         * rendering/updating/RenderTreeBuilder.cpp:
1551         (WebCore::RenderTreeBuilder::insertChildIgnoringContinuation):
1552         (WebCore::RenderTreeBuilder::insertChildToRenderBlockIgnoringContinuation): Deleted.
1553         (WebCore::RenderTreeBuilder::insertChildToRenderInlineIgnoringContinuation): Deleted.
1554         * rendering/updating/RenderTreeBuilder.h:
1555         * rendering/updating/RenderTreeBuilderBlock.cpp:
1556         (WebCore::RenderTreeBuilder::Block::insertChildToContinuation):
1557         * rendering/updating/RenderTreeBuilderInline.cpp:
1558         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
1559         (WebCore::RenderTreeBuilder::Inline::splitInlines):
1560
1561 2018-02-16  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1562
1563         [Curl] Unify logic of ResourceHandleCurlDelegate into ResourceHandle
1564         https://bugs.webkit.org/show_bug.cgi?id=182578
1565
1566         Reconstruct the classes to match Curl port network layer more similar
1567         structure with other ports. Move CurlRequest handling into ResourceHandle
1568         and makes CurlResourceHandleDelegate simple life cycle. Also its duty is
1569         for most of incoming data and event handling from CurRequest.
1570
1571         Reviewed by Alex Christensen.
1572
1573         No new tests because there's no new behavior.
1574
1575         * platform/Curl.cmake:
1576         * platform/network/ResourceHandle.h:
1577         * platform/network/ResourceHandleInternal.h:
1578         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
1579         * platform/network/curl/CurlCacheManager.cpp:
1580         (WebCore::CurlCacheManager::didReceiveResponse):
1581         * platform/network/curl/CurlDownload.cpp:
1582         (WebCore::CurlDownload::~CurlDownload):
1583         (WebCore::CurlDownload::createCurlRequest):
1584         (WebCore::CurlDownload::curlDidReceiveResponse):
1585         (WebCore::CurlDownload::curlDidReceiveBuffer):
1586         (WebCore::CurlDownload::curlDidComplete):
1587         (WebCore::CurlDownload::curlDidFailWithError):
1588         (WebCore::CurlDownload::willSendRequest):
1589         * platform/network/curl/CurlDownload.h:
1590         * platform/network/curl/CurlRequest.cpp:
1591         (WebCore::CurlRequest::CurlRequest):
1592         (WebCore::CurlRequest::cancel):
1593         (WebCore::CurlRequest::callClient):
1594         (WebCore::CurlRequest::willSendData):
1595         (WebCore::CurlRequest::didReceiveData):
1596         (WebCore::CurlRequest::didReceiveDataFromMultipart):
1597         (WebCore::CurlRequest::didCompleteTransfer):
1598         (WebCore::CurlRequest::invokeDidReceiveResponse):
1599         * platform/network/curl/CurlRequest.h:
1600         (WebCore::CurlRequest::create):
1601         (WebCore::CurlRequest::invalidateClient):
1602         (WebCore::CurlRequest::setClient): Deleted.
1603         * platform/network/curl/CurlRequestClient.h:
1604         * platform/network/curl/CurlResourceHandleDelegate.cpp: Added.
1605         (WebCore::CurlResourceHandleDelegate::CurlResourceHandleDelegate):
1606         (WebCore::CurlResourceHandleDelegate::ref):
1607         (WebCore::CurlResourceHandleDelegate::deref):
1608         (WebCore::CurlResourceHandleDelegate::cancelledOrClientless):
1609         (WebCore::CurlResourceHandleDelegate::client const):
1610         (WebCore::CurlResourceHandleDelegate::d):
1611         (WebCore::CurlResourceHandleDelegate::curlDidSendData):
1612         (WebCore::handleCookieHeaders):
1613         (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse):
1614         (WebCore::CurlResourceHandleDelegate::curlDidReceiveBuffer):
1615         (WebCore::CurlResourceHandleDelegate::curlDidComplete):
1616         (WebCore::CurlResourceHandleDelegate::curlDidFailWithError):
1617         * platform/network/curl/CurlResourceHandleDelegate.h: Added.
1618         (WebCore::CurlResourceHandleDelegate::response const):
1619         * platform/network/curl/ResourceHandleCurl.cpp:
1620         (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
1621         (WebCore::ResourceHandle::start):
1622         (WebCore::ResourceHandle::cancel):
1623         (WebCore::ResourceHandle::cancelledOrClientless):
1624         (WebCore::ResourceHandle::createCurlRequest):
1625         (WebCore::ResourceHandle::delegate):
1626         (WebCore::ResourceHandle::platformSetDefersLoading):
1627         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
1628         (WebCore::ResourceHandle::receivedCredential):
1629         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
1630         (WebCore::ResourceHandle::getCredential):
1631         (WebCore::ResourceHandle::restartRequestWithCredential):
1632         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1633         (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse):
1634         (WebCore::ResourceHandle::continueAfterDidReceiveResponse):
1635         (WebCore::ResourceHandle::shouldRedirectAsGET):
1636         (WebCore::ResourceHandle::willSendRequest):
1637         (WebCore::ResourceHandle::continueAfterWillSendRequest):
1638         (WebCore::ResourceHandle::handleDataURL):
1639         * platform/network/curl/ResourceHandleCurlDelegate.cpp: Removed.
1640         * platform/network/curl/ResourceHandleCurlDelegate.h: Removed.
1641
1642 2018-02-16  Youenn Fablet  <youenn@apple.com>
1643
1644         Use ResourceLoader to load appcache manifest
1645         https://bugs.webkit.org/show_bug.cgi?id=182861
1646
1647         Reviewed by Alex Christensen.
1648
1649         Covered by updated tests.
1650
1651         Add ApplicationCacheResourceLoader to load an ApplicationCacheResource from a ResourceLoader.
1652         Make use of it to load the app cache manifest.
1653         Future work should load entries using the same loader.
1654
1655         Remove manifest handle.
1656         Ensure that DocumentLoader does not register the manifest resource loader as its lifetime
1657         is handled by its ApplicationCacheGroup.
1658
1659         Add a ResourceLoader option to bypass the application cache.
1660         Use it for manifest loading.
1661
1662         * Sources.txt:
1663         * WebCore.xcodeproj/project.pbxproj:
1664         * loader/DocumentLoader.cpp:
1665         (WebCore::DocumentLoader::addSubresourceLoader):
1666         * loader/ResourceLoaderOptions.h:
1667         * loader/appcache/ApplicationCacheGroup.cpp:
1668         (WebCore::ApplicationCacheGroup::stopLoading):
1669         (WebCore::ApplicationCacheGroup::update):
1670         (WebCore::ApplicationCacheGroup::createRequest):
1671         (WebCore::ApplicationCacheGroup::didReceiveResponseAsync):
1672         (WebCore::ApplicationCacheGroup::didReceiveData):
1673         (WebCore::ApplicationCacheGroup::didFinishLoading):
1674         (WebCore::ApplicationCacheGroup::didFail):
1675         (WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
1676         (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
1677         * loader/appcache/ApplicationCacheGroup.h:
1678         * loader/appcache/ApplicationCacheHost.cpp:
1679         (WebCore::ApplicationCacheHost::maybeLoadResource):
1680         (WebCore::ApplicationCacheHost::maybeLoadFallbackForRedirect):
1681         (WebCore::ApplicationCacheHost::maybeLoadFallbackForResponse):
1682         (WebCore::ApplicationCacheHost::maybeLoadFallbackForError):
1683         * loader/appcache/ApplicationCacheResourceLoader.cpp: Added.
1684         * loader/appcache/ApplicationCacheResourceLoader.h: Added.
1685
1686 2018-02-16  Chris Dumez  <cdumez@apple.com>
1687
1688         Crash under WebCore::EventTarget::fireEventListeners
1689         https://bugs.webkit.org/show_bug.cgi?id=182880
1690         <rdar://problem/20788804>
1691
1692         Reviewed by Youenn Fablet.
1693
1694         Make sure the 'ended' event does not get dispatched on a
1695         AudioScheduledSourceNode after ActiveDOMObjects have been stopped.
1696
1697         Test: webaudio/audiobuffersource-ended-detached-frame.html
1698
1699         * Modules/webaudio/AudioScheduledSourceNode.cpp:
1700         (WebCore::AudioScheduledSourceNode::finish):
1701
1702 2018-02-16  Jiewen Tan  <jiewen_tan@apple.com>
1703
1704         [WebAuthN] Implement PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()
1705         https://bugs.webkit.org/show_bug.cgi?id=182771
1706         <rdar://problem/36459988>
1707
1708         Reviewed by Brent Fulgham.
1709
1710         This patch implements PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()
1711         per https://www.w3.org/TR/webauthn/#isUserVerifyingPlatformAuthenticatorAvailable with some
1712         limitations.
1713
1714         In addition, it changes DeferredPromise to DOMPromiseDeferred<> for all CredentialsManagement
1715         and WebAuthN API.
1716
1717         Test: http/wpt/webauthn/public-key-is-user-verifying-platform-authenticator-available.html
1718
1719         * Modules/credentialmanagement/CredentialsContainer.cpp:
1720         (WebCore::CredentialsContainer::get):
1721         (WebCore::CredentialsContainer::store):
1722         (WebCore::CredentialsContainer::isCreate):
1723         (WebCore::CredentialsContainer::preventSilentAccess const):
1724         * Modules/credentialmanagement/CredentialsContainer.h:
1725         * Modules/credentialmanagement/CredentialsMessenger.cpp:
1726         (WebCore::CredentialsMessenger::addCreationCompletionHandler):
1727         Remove a redundant assertion.
1728         (WebCore::CredentialsMessenger::addRequestCompletionHandler):
1729         Remove a redundant assertion.
1730         (WebCore::CredentialsMessenger::addQueryCompletionHandler):
1731         (WebCore::CredentialsMessenger::takeQueryCompletionHandler):
1732         * Modules/credentialmanagement/CredentialsMessenger.h:
1733         * Modules/webauthn/AuthenticatorManager.cpp:
1734         (WebCore::AuthenticatorManagerInternal::initTimeoutTimer):
1735         (WebCore::AuthenticatorManager::create const):
1736         (WebCore::AuthenticatorManager::discoverFromExternalSource const):
1737         (WebCore::AuthenticatorManager::isUserVerifyingPlatformAuthenticatorAvailable const):
1738         * Modules/webauthn/AuthenticatorManager.h:
1739         * Modules/webauthn/PublicKeyCredential.cpp:
1740         (WebCore::PublicKeyCredential::isUserVerifyingPlatformAuthenticatorAvailable):
1741         * Modules/webauthn/PublicKeyCredential.h:
1742         * testing/MockCredentialsMessenger.cpp:
1743         (WebCore::MockCredentialsMessenger::isUserVerifyingPlatformAuthenticatorAvailable):
1744         (WebCore::MockCredentialsMessenger::isUserVerifyingPlatformAuthenticatorAvailableReply):
1745         * testing/MockCredentialsMessenger.h:
1746         * testing/MockCredentialsMessenger.idl:
1747
1748 2018-02-16  Tim Horton  <timothy_horton@apple.com>
1749
1750         Stop using EXCLUDED_SOURCE_FILE_NAMES for touch and gesture files in WebCore
1751         https://bugs.webkit.org/show_bug.cgi?id=182866
1752
1753         Reviewed by Daniel Bates.
1754
1755         * Configurations/WebCore.xcconfig:
1756         These generated files already have ENABLE() flags around them,
1757         so there's no reason to exclude them explicitly.
1758
1759 2018-02-16  Chris Dumez  <cdumez@apple.com>
1760
1761         Unreviewed, fix iOS build after r228562.
1762
1763         * workers/service/server/RegistrationDatabase.cpp:
1764         (WebCore::RegistrationDatabase::openSQLiteDatabase):
1765
1766 2018-02-16  Zalan Bujtas  <zalan@apple.com>
1767
1768         [RenderTreeBuilder] Move RenderElement::addChild() to RenderTreeBuilder
1769         https://bugs.webkit.org/show_bug.cgi?id=182878
1770         <rdar://problem/37608349>
1771
1772         Reviewed by Antti Koivisto.
1773
1774         This patch removes the last addChild() related mutation logic from the renderers.
1775
1776         No change in functionality.
1777
1778         * rendering/RenderElement.cpp:
1779         (WebCore::RenderElement::didInsertChild):
1780         (WebCore::RenderElement::addChild): Deleted.
1781         * rendering/RenderElement.h:
1782         (WebCore::RenderElement::isChildAllowed const):
1783         * rendering/updating/RenderTreeBuilder.cpp:
1784         (WebCore::RenderTreeBuilder::insertChild):
1785         (WebCore::RenderTreeBuilder::insertChildToRenderElement):
1786         * rendering/updating/RenderTreeBuilder.h:
1787         * rendering/updating/RenderTreeBuilderBlock.cpp:
1788         (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation):
1789         * rendering/updating/RenderTreeBuilderInline.cpp:
1790         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation):
1791         * rendering/updating/RenderTreeBuilderSVG.cpp:
1792         (WebCore::RenderTreeBuilder::SVG::insertChild):
1793         * rendering/updating/RenderTreeBuilderTable.cpp:
1794         (WebCore::RenderTreeBuilder::Table::insertChild):
1795
1796 2018-02-16  Matt Lewis  <jlewis3@apple.com>
1797
1798         Unreviewed, rolling out r228546.
1799
1800         This caused a consistent crash on all macOS WK2 platforms.
1801
1802         Reverted changeset:
1803
1804         "Web Inspector: get rid of remaining uses of OptOutput<T>"
1805         https://bugs.webkit.org/show_bug.cgi?id=180607
1806         https://trac.webkit.org/changeset/228546
1807
1808 2018-02-16  Youenn Fablet  <youenn@apple.com>
1809
1810         Log the error message when failing to open the database
1811         https://bugs.webkit.org/show_bug.cgi?id=182795
1812         <rdar://problem/37592399>
1813
1814         Unreviewed.
1815         Fixing iOS simulator debug build.
1816
1817         * workers/service/server/RegistrationDatabase.cpp:
1818         (WebCore::RegistrationDatabase::openSQLiteDatabase):
1819
1820 2018-02-16  Fujii Hironori  <Hironori.Fujii@sony.com>
1821
1822         IndexedDB: Several test crash in when destroying a IDBKeyData
1823         https://bugs.webkit.org/show_bug.cgi?id=167576
1824
1825         Reviewed by Michael Catanzaro.
1826
1827         IDBKeyDataHashTraits::constructDeletedValue is using operator= to
1828         assign deletedValue. But, the value is destructed just before
1829         calling constructDeletedValue. You can't use operator= for a
1830         destructed value.
1831
1832         No new tests (Covered by existing tests).
1833
1834         * Modules/indexeddb/IDBKeyData.h:
1835         (WebCore::IDBKeyDataHashTraits::constructDeletedValue):
1836         Construct null value before assigning deletedValue.
1837
1838 2018-02-16  Zalan Bujtas  <zalan@apple.com>
1839
1840         [RenderTreeBuilder] Move RenderBlock/RenderBlockFlow::addChild() to RenderTreeBuilder
1841         https://bugs.webkit.org/show_bug.cgi?id=182862
1842         <rdar://problem/37595464>
1843
1844         Reviewed by Antti Koivisto.
1845
1846         No change in functionality.
1847
1848         * rendering/RenderBlock.cpp:
1849         (WebCore::RenderBlock::addChild): Deleted.
1850         * rendering/RenderBlock.h:
1851         * rendering/RenderBlockFlow.cpp:
1852         (WebCore::RenderBlockFlow::addChild): Deleted.
1853         * rendering/RenderBlockFlow.h:
1854         * rendering/updating/RenderTreeBuilder.cpp:
1855         (WebCore::RenderTreeBuilder::insertChild):
1856         (WebCore::RenderTreeBuilder::insertChildToRenderBlock): Deleted.
1857         (WebCore::RenderTreeBuilder::insertChildToRenderBlockFlow): Deleted.
1858         * rendering/updating/RenderTreeBuilder.h:
1859         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
1860         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
1861         * rendering/updating/RenderTreeBuilderFormControls.cpp:
1862         (WebCore::RenderTreeBuilder::FormControls::findOrCreateParentForChild):
1863         * rendering/updating/RenderTreeBuilderMathML.cpp:
1864         (WebCore::RenderTreeBuilder::MathML::makeFences):
1865         (WebCore::RenderTreeBuilder::MathML::insertChild):
1866         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
1867         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
1868         (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant):
1869         * rendering/updating/RenderTreeBuilderRuby.cpp:
1870         (WebCore::RenderTreeBuilder::Ruby::insertChild):
1871         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
1872         (WebCore::RenderTreeBuilder::Ruby::rubyBaseSafe):
1873         * rendering/updating/RenderTreeBuilderSVG.cpp:
1874         (WebCore::RenderTreeBuilder::SVG::insertChild):
1875
1876 2018-02-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1877
1878         [Extra zoom mode] Add basic support for <input type='date'> using date picker UI
1879         https://bugs.webkit.org/show_bug.cgi?id=182847
1880         <rdar://problem/35143111>
1881
1882         Reviewed by Tim Horton.
1883
1884         Add new localized strings for "month", "day" and "year" as they appear in the date picker.
1885
1886         * English.lproj/Localizable.strings:
1887         * platform/LocalizedStrings.cpp:
1888         (WebCore::textInputModeWriteButtonTitle):
1889         (WebCore::textInputModeSpeechButtonTitle):
1890         (WebCore::datePickerDayLabelTitle):
1891         (WebCore::datePickerMonthLabelTitle):
1892         (WebCore::datePickerYearLabelTitle):
1893         (WebCore::textInputModeWriteButton): Deleted.
1894         (WebCore::textInputModeSpeechButton): Deleted.
1895         * platform/LocalizedStrings.h:
1896
1897 2018-02-16  Zan Dobersek  <zdobersek@igalia.com>
1898
1899         HarfBuzzFace should operate with a FontPlatformData reference
1900         https://bugs.webkit.org/show_bug.cgi?id=182863
1901
1902         Reviewed by Carlos Garcia Campos.
1903
1904         Instead of keeping a never-null pointer to FontPlatformData,
1905         HarfBuzzFace should operate with a FontPlatformData reference.
1906
1907         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
1908         (WebCore::FontPlatformData::harfBuzzFace const):
1909         * platform/graphics/harfbuzz/HarfBuzzFace.cpp:
1910         (WebCore::HarfBuzzFace::HarfBuzzFace):
1911         * platform/graphics/harfbuzz/HarfBuzzFace.h:
1912         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
1913         (WebCore::HarfBuzzFace::createFace):
1914         (WebCore::HarfBuzzFace::createFont):
1915
1916 2018-02-15  Zalan Bujtas  <zalan@apple.com>
1917
1918         [RenderTreeBuilder] parent.Render*::addChild() cleanup
1919         https://bugs.webkit.org/show_bug.cgi?id=182842
1920         <rdar://problem/37585524>
1921
1922         Reviewed by Antti Koivisto.
1923
1924         No change in functionality.
1925
1926         * rendering/updating/RenderTreeBuilderBlock.cpp:
1927         (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation):
1928         * rendering/updating/RenderTreeBuilderFormControls.cpp:
1929         (WebCore::RenderTreeBuilder::FormControls::createInnerRendererIfNeeded):
1930         * rendering/updating/RenderTreeBuilderInline.cpp:
1931         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation):
1932         * rendering/updating/RenderTreeBuilderMathML.cpp:
1933         (WebCore::RenderTreeBuilder::MathML::makeFences):
1934         (WebCore::RenderTreeBuilder::MathML::insertChild):
1935         * rendering/updating/RenderTreeBuilderSVG.cpp:
1936         (WebCore::RenderTreeBuilder::SVG::insertChild):
1937         * rendering/updating/RenderTreeBuilderTable.cpp:
1938         (WebCore::RenderTreeBuilder::Table::insertChild):
1939
1940 2018-02-15  Megan Gardner  <megan_gardner@apple.com>
1941
1942         Support scrolling for non-editable web-selection and start autoscroll when near screen edges
1943         https://bugs.webkit.org/show_bug.cgi?id=182815
1944
1945         Reviewed by Tim Horton.
1946
1947         Adjust the position we are autoscrolling to so that when we are close to an edge, we will start autoscrolling
1948         while we are still inside the view. Autoscrolling still happens when you drag past the edge of a view.
1949
1950         No new tests (This is difficult to test in this state, but when we switch assistants, test will also be added).
1951
1952         * page/EventHandler.h:
1953         * page/ios/EventHandlerIOS.mm:
1954         (WebCore::EventHandler::startSelectionAutoscroll):
1955         (WebCore::EventHandler::cancelSelectionAutoscroll):
1956         (WebCore::autoscrollAdjustmentFactorForScreenBoundaries):
1957         (WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll const):
1958         (WebCore::EventHandler::startTextAutoscroll): Deleted.
1959         (WebCore::EventHandler::cancelTextAutoscroll): Deleted.
1960
1961 2018-02-15  Youenn Fablet  <youenn@apple.com>
1962
1963         Log the error message when failing to open the database
1964         https://bugs.webkit.org/show_bug.cgi?id=182795
1965
1966         Reviewed by Chris Dumez.
1967
1968         No change of behavior.
1969         Print the error message as it does not contain any user private information.
1970
1971         * workers/service/server/RegistrationDatabase.cpp:
1972         (WebCore::RegistrationDatabase::openSQLiteDatabase):
1973
1974 2018-02-15  Zalan Bujtas  <zalan@apple.com>
1975
1976         [RenderTreeBuilder] Move RenderMenuList::addChild() to RenderTreeBuilder
1977         https://bugs.webkit.org/show_bug.cgi?id=182840
1978         <rdar://problem/37583638>
1979
1980         Reviewed by Antti Koivisto.
1981
1982         No change in functionality.
1983
1984         * rendering/RenderMenuList.cpp:
1985         (RenderMenuList::didInsertChild):
1986         (RenderMenuList::addChild): Deleted.
1987         * rendering/RenderMenuList.h:
1988         * rendering/updating/RenderTreeBuilder.cpp:
1989         (WebCore::RenderTreeBuilder::insertChild):
1990         * rendering/updating/RenderTreeBuilderFormControls.cpp:
1991         (WebCore::RenderTreeBuilder::FormControls::findOrCreateParentForChild):
1992         (WebCore::RenderTreeBuilder::FormControls::insertChild):
1993         (WebCore::RenderTreeBuilder::FormControls::createInnerRendererIfNeeded): Deleted.
1994         * rendering/updating/RenderTreeBuilderFormControls.h:
1995
1996 2018-02-15  Darin Adler  <darin@apple.com>
1997
1998         Web Inspector: get rid of remaining uses of OptOutput<T>
1999         https://bugs.webkit.org/show_bug.cgi?id=180607
2000
2001         Reviewed by Brian Burg.
2002
2003         * inspector/InspectorStyleSheet.cpp:
2004         (WebCore::buildSourceRangeObject): Take a const Vector& instead of a Vector*.
2005         (WebCore::InspectorStyle::buildObjectForStyle const): Pass lineEndings() instead
2006         of lineEndings().get().
2007         (WebCore::InspectorStyle::styleWithProperties const): Ditto.
2008         (WebCore::InspectorStyleSheet::buildObjectForSelectorList): Ditto.
2009         (WebCore::InspectorStyleSheet::lineEndings const): Return a Vector instead of
2010         a std::unique_ptr<Vector>.
2011         (WebCore::InspectorStyleSheetForInlineStyle::lineEndings const): Ditto.
2012         * inspector/InspectorStyleSheet.h: Updated for the above.
2013
2014         * inspector/agents/InspectorCSSAgent.h: Removed some bogus const.
2015         * inspector/agents/InspectorCanvasAgent.cpp: Ditto.
2016         * inspector/agents/InspectorCanvasAgent.h: Ditto.
2017
2018         * inspector/agents/InspectorDOMDebuggerAgent.cpp: Improved type of global strings
2019         so we don't waste space with a pointer to the string.
2020         (WebCore::InspectorDOMDebuggerAgent::setEventListenerBreakpoint): Removed
2021         explicit creation of String, which was wasteful and unnecessary.
2022         (WebCore::InspectorDOMDebuggerAgent::setInstrumentationBreakpoint): Ditto.
2023         (WebCore::InspectorDOMDebuggerAgent::removeEventListenerBreakpoint): Ditto.
2024         (WebCore::InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint): Ditto.
2025         (WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint): Removed bogus const.
2026
2027         * inspector/agents/InspectorDOMDebuggerAgent.h: Removed bogus const and use
2028         final instead of override.
2029         * inspector/agents/InspectorPageAgent.cpp: Ditto.
2030         * inspector/agents/InspectorPageAgent.h: Ditto.
2031
2032 2018-02-15  Chris Dumez  <cdumez@apple.com>
2033
2034         Flaky Test: imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl-worker.html
2035         https://bugs.webkit.org/show_bug.cgi?id=182270
2036         <rdar://problem/36904314>
2037
2038         Reviewed by Antti Koivisto.
2039
2040         No new tests, already covered by existing tests that crash flakily on the bots.
2041
2042         * loader/ThreadableLoaderClientWrapper.h:
2043         (WebCore::ThreadableLoaderClientWrapper::ThreadableLoaderClientWrapper):
2044         isolate copy the initiator string as this object can be destroyed on a different thread. This was
2045         causing the test to flakily crash as well when destroying ThreadLocalData.
2046
2047         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
2048         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2049         (scheduledWithCustomRunLoopMode):
2050         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
2051         Fix thread safety issue in callFunctionOnMainThread. This function is called from a background thread
2052         to get to the main thread. However, it relied on m_handle which would get nullified on the main thread
2053         by detachHandle when the ResourceHandle is destroyed. Fix the issue by not relying on m_handle anymore.
2054
2055         (-[WebCoreResourceHandleAsOperationQueueDelegate initWithHandle:messageQueue:]):
2056         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
2057         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
2058         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
2059         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
2060         - Go back to using autorelease() instead of get() for the returned objects to match the code pre-r224522.
2061         - Dispatch the protectedSelf variables that were added in r227073 to the main thread to make sure we do
2062           not get destroyed on the background thread when protectedSelf is the last strong reference to self.
2063           Destroying the WebCoreResourceHandleAsOperationQueueDelegate on the background safe is unsafe due to
2064           its m_messageQueue data member which contains lambdas that may capture anything.
2065         - Add a Lock to protect against detachHandle getting called on the main thread and nulling out
2066           m_handle / m_requestResult / m_cachedResponseResult while the background thread may be accessing
2067           them.
2068
2069 2018-02-15  Zalan Bujtas  <zalan@apple.com>
2070
2071         [RenderTreeBuilder] Move RenderTableRow::addChild() to RenderTreeBuilder
2072         https://bugs.webkit.org/show_bug.cgi?id=182838
2073         <rdar://problem/37580762>
2074
2075         Reviewed by Antti Koivisto.
2076
2077         No change in functionality.
2078
2079         * rendering/RenderTableRow.cpp:
2080         (WebCore::RenderTableRow::didInsertTableCell):
2081         (WebCore::RenderTableRow::addChild): Deleted.
2082         * rendering/RenderTableRow.h:
2083         * rendering/updating/RenderTreeBuilder.cpp:
2084         (WebCore::RenderTreeBuilder::insertChild):
2085         (WebCore::RenderTreeBuilder::insertChildToRenderTableRow): Deleted.
2086         * rendering/updating/RenderTreeBuilder.h:
2087         * rendering/updating/RenderTreeBuilderTable.cpp:
2088         (WebCore::RenderTreeBuilder::Table::insertChild):
2089
2090 2018-02-15  Antoine Quint  <graouts@apple.com>
2091
2092         [Web Animations] Ensure that changing the timing model updates styles synchronously
2093         https://bugs.webkit.org/show_bug.cgi?id=182836
2094
2095         Reviewed by Dean Jackson.
2096
2097         We did not invalidate the timing model when properties of an effect's timing object changed
2098         and even when we did invalidate the timing model, we did not update styles on effect targets
2099         synchronously, only scheduling such updates for the next animation frame.
2100
2101         In this patch we expose the effect on the timing object such that changing timing properties
2102         can notify the effect of a change in the timing model, which can then be forwarded to the
2103         animation (which already informs its timeline, if any).
2104
2105         Additionally, when an animation's timing model has changed, we now invalidate the effect, which
2106         will update styles synchronously.
2107
2108         This produces a number of progressions in WPT tests.
2109
2110         * animation/AnimationEffectReadOnly.cpp:
2111         (WebCore::AnimationEffectReadOnly::AnimationEffectReadOnly): Set the timing object's effect upon
2112         effect construction.
2113         (WebCore::AnimationEffectReadOnly::~AnimationEffectReadOnly): Set the timing object's effect to
2114         null upon effect destruction.
2115         (WebCore::AnimationEffectReadOnly::timingDidChange): Notify the animation (if any) that its timing
2116         model changed following a change in the timing properties.
2117         * animation/AnimationEffectReadOnly.h: Add a new virtual invalidate() method that subclasses can
2118         override to implement invalidation behavior when the animation finds out its timing model changed.
2119         * animation/AnimationEffectTimingReadOnly.cpp: Notify the effect when a property changes such
2120         that it may notify its animation of a timing model change.
2121         (WebCore::AnimationEffectTimingReadOnly::propertyDidChange):
2122         (WebCore::AnimationEffectTimingReadOnly::setIterationStart):
2123         (WebCore::AnimationEffectTimingReadOnly::setIterations):
2124         (WebCore::AnimationEffectTimingReadOnly::setBindingsDuration):
2125         (WebCore::AnimationEffectTimingReadOnly::setEasing):
2126         (WebCore::AnimationEffectTimingReadOnly::setDelay):
2127         (WebCore::AnimationEffectTimingReadOnly::setEndDelay):
2128         (WebCore::AnimationEffectTimingReadOnly::setFill):
2129         (WebCore::AnimationEffectTimingReadOnly::setIterationDuration):
2130         (WebCore::AnimationEffectTimingReadOnly::setDirection):
2131         * animation/AnimationEffectTimingReadOnly.h:
2132         (WebCore::AnimationEffectTimingReadOnly::setEffect):
2133         (WebCore::AnimationEffectTimingReadOnly::setBindingsDelay):
2134         (WebCore::AnimationEffectTimingReadOnly::setBindingsEndDelay):
2135         (WebCore::AnimationEffectTimingReadOnly::setDelay): Deleted.
2136         (WebCore::AnimationEffectTimingReadOnly::setEndDelay): Deleted.
2137         (WebCore::AnimationEffectTimingReadOnly::setFill): Deleted.
2138         (WebCore::AnimationEffectTimingReadOnly::setIterationDuration): Deleted.
2139         (WebCore::AnimationEffectTimingReadOnly::setDirection): Deleted.
2140         * animation/AnimationTimeline.cpp: Rename animationTimingModelDidChange() to timingModelDidChange()
2141         to align it with the new WebAnimation::timingModelDidChange() method.
2142         (WebCore::AnimationTimeline::addAnimation):
2143         (WebCore::AnimationTimeline::removeAnimation):
2144         (WebCore::AnimationTimeline::setCurrentTime):
2145         * animation/AnimationTimeline.h:
2146         (WebCore::AnimationTimeline::timingModelDidChange):
2147         (WebCore::AnimationTimeline::animationTimingModelDidChange): Deleted.
2148         * animation/DocumentTimeline.cpp:
2149         (WebCore::DocumentTimeline::timingModelDidChange):
2150         (WebCore::DocumentTimeline::updateAnimations):
2151         (WebCore::DocumentTimeline::animationTimingModelDidChange): Deleted.
2152         * animation/DocumentTimeline.h:
2153         * animation/KeyframeEffectReadOnly.cpp:
2154         (WebCore::KeyframeEffectReadOnly::invalidate): Override the invalidate() method to perform a synchronous
2155         style update in order to ensure that timing properties are accounted for right as they change.
2156         * animation/KeyframeEffectReadOnly.h:
2157         * animation/WebAnimation.cpp:
2158         (WebCore::WebAnimation::timingModelDidChange): Invalidate the effect and notify the timeline of a timing
2159         model change when an animation is notified that its timing model has changed.
2160         (WebCore::WebAnimation::setStartTime):
2161         * animation/WebAnimation.h:
2162
2163 2018-02-15  Timothy Horton  <timothy_horton@apple.com>
2164
2165         Fix the build.
2166
2167         * platform/ios/KeyEventCodesIOS.h:
2168
2169 2018-02-15  John Wilander  <wilander@apple.com>
2170
2171         Resource Load Statistics: Make sure WebResourceLoadStatisticsStore::mergeWithDataFromDecoder() can ingest older plist versions and not reset the database
2172         https://bugs.webkit.org/show_bug.cgi?id=182812
2173         <rdar://problem/37511406>
2174
2175         Reviewed by Brent Fulgham.
2176
2177         No new tests. Tested manually between versions of Safari.
2178
2179         * loader/ResourceLoadStatistics.cpp:
2180         (WebCore::ResourceLoadStatistics::decode):
2181             Now only expects these fields for model version 11 or higher:
2182             - topFrameUniqueRedirectsTo
2183             - topFrameUniqueRedirectsFrom
2184             - subresourceUniqueRedirectsFrom
2185             - timesAccessedAsFirstPartyDueToUserInteraction
2186             - timesAccessedAsFirstPartyDueToStorageAccessAPI
2187         * loader/ResourceLoadStatistics.h:
2188
2189 2018-02-15  Tim Horton  <timothy_horton@apple.com>
2190
2191         Stop using EXCLUDED_SOURCE_FILE_NAMES for actual source files in WebCore
2192         https://bugs.webkit.org/show_bug.cgi?id=182822
2193
2194         Reviewed by Dan Bernstein.
2195
2196         It's much easier to reason about things if xcconfigs don't apply extra
2197         constraints to which source files actually build on a per-platform basis.
2198         We should use #ifs instead like we usually do.
2199
2200         * Configurations/WebCore.xcconfig:
2201         * Modules/geolocation/ios/GeolocationPositionIOS.mm:
2202         * accessibility/ios/AccessibilityObjectIOS.mm:
2203         * accessibility/mac/AXObjectCacheMac.mm:
2204         * accessibility/mac/AccessibilityObjectMac.mm:
2205         * accessibility/mac/WebAccessibilityObjectWrapperMac.h:
2206         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2207         * dom/DataTransferMac.mm:
2208         * editing/ios/DictationCommandIOS.cpp:
2209         * editing/ios/DictationCommandIOS.h:
2210         * editing/ios/EditorIOS.mm:
2211         * editing/ios/WebContentReaderIOS.mm:
2212         * editing/mac/EditorMac.mm:
2213         * editing/mac/WebContentReaderMac.mm:
2214         * page/ios/EventHandlerIOS.mm:
2215         * page/ios/FrameIOS.mm:
2216         * page/mac/EventHandlerMac.mm:
2217         * page/scrolling/ios/ScrollingCoordinatorIOS.h:
2218         * page/scrolling/ios/ScrollingCoordinatorIOS.mm:
2219         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
2220         * platform/ThreadCheck.h:
2221         * platform/audio/ios/AudioDestinationIOS.h:
2222         * platform/audio/ios/AudioFileReaderIOS.h:
2223         * platform/audio/ios/MediaSessionManagerIOS.h:
2224         * platform/graphics/ios/DisplayRefreshMonitorIOS.h:
2225         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
2226         * platform/graphics/ios/FontCacheIOS.mm:
2227         * platform/graphics/ios/GraphicsContext3DIOS.h:
2228         * platform/graphics/ios/IconIOS.mm:
2229         * platform/graphics/mac/ColorMac.h:
2230         * platform/graphics/mac/ColorMac.mm:
2231         * platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
2232         * platform/graphics/mac/DisplayRefreshMonitorMac.h:
2233         * platform/graphics/mac/IconMac.mm:
2234         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
2235         * platform/ios/CursorIOS.cpp:
2236         * platform/ios/DeviceMotionClientIOS.h:
2237         * platform/ios/DeviceOrientationClientIOS.h:
2238         * platform/ios/EventLoopIOS.mm:
2239         * platform/ios/KeyEventCodesIOS.h:
2240         * platform/ios/LowPowerModeNotifierIOS.mm:
2241         * platform/ios/PasteboardIOS.mm:
2242         * platform/ios/PlatformEventFactoryIOS.h:
2243         * platform/ios/PlatformEventFactoryIOS.mm:
2244         * platform/ios/PlatformPasteboardIOS.mm:
2245         * platform/ios/PlatformScreenIOS.mm:
2246         * platform/ios/PlatformSpeechSynthesizerIOS.mm:
2247         * platform/ios/RemoteCommandListenerIOS.h:
2248         * platform/ios/RemoteCommandListenerIOS.mm:
2249         * platform/ios/SSLKeyGeneratorIOS.cpp:
2250         * platform/ios/ScrollAnimatorIOS.h:
2251         * platform/ios/ScrollAnimatorIOS.mm:
2252         * platform/ios/ScrollViewIOS.mm:
2253         * platform/ios/ScrollbarThemeIOS.h:
2254         * platform/ios/ScrollbarThemeIOS.mm:
2255         * platform/ios/SystemMemoryIOS.cpp:
2256         * platform/ios/ThemeIOS.h:
2257         * platform/ios/ThemeIOS.mm:
2258         * platform/ios/TileControllerMemoryHandlerIOS.cpp:
2259         * platform/ios/TileControllerMemoryHandlerIOS.h:
2260         * platform/ios/UserAgentIOS.mm:
2261         * platform/ios/ValidationBubbleIOS.mm:
2262         * platform/ios/WidgetIOS.mm:
2263         * platform/mac/CursorMac.mm:
2264         * platform/mac/EventLoopMac.mm:
2265         * platform/mac/LocalCurrentGraphicsContext.h:
2266         * platform/mac/LocalCurrentGraphicsContext.mm:
2267         * platform/mac/NSScrollerImpDetails.h:
2268         * platform/mac/NSScrollerImpDetails.mm:
2269         * platform/mac/PasteboardMac.mm:
2270         * platform/mac/PlatformEventFactoryMac.h:
2271         * platform/mac/PlatformEventFactoryMac.mm:
2272         * platform/mac/PlatformPasteboardMac.mm:
2273         * platform/mac/PlatformScreenMac.mm:
2274         * platform/mac/PlatformSpeechSynthesizerMac.mm:
2275         * platform/mac/SSLKeyGeneratorMac.mm:
2276         * platform/mac/ScrollViewMac.mm:
2277         * platform/mac/ScrollbarThemeMac.h:
2278         * platform/mac/ScrollbarThemeMac.mm:
2279         * platform/mac/ThemeMac.h:
2280         * platform/mac/ThemeMac.mm:
2281         * platform/mac/ThreadCheck.mm:
2282         * platform/mac/UserAgentMac.mm:
2283         * platform/mac/WebCoreView.h:
2284         * platform/mac/WebCoreView.m:
2285         * platform/mac/WidgetMac.mm:
2286         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.h:
2287         * platform/network/ios/NetworkStateNotifierIOS.mm:
2288         * platform/network/ios/WebCoreURLResponseIOS.h:
2289         * platform/network/ios/WebCoreURLResponseIOS.mm:
2290         * platform/network/mac/NetworkStateNotifierMac.cpp:
2291
2292 2018-02-15  Zalan Bujtas  <zalan@apple.com>
2293
2294         [RenderTreeBuilder] Move RenderTableSection::addChild() to RenderTreeBuilder
2295         https://bugs.webkit.org/show_bug.cgi?id=182835
2296         <rdar://problem/37579191>
2297
2298         Reviewed by Antti Koivisto.
2299
2300         No change in functionality.
2301
2302         * rendering/RenderTableSection.cpp:
2303         (WebCore::RenderTableSection::willInsertTableRow):
2304         (WebCore::RenderTableSection::addChild): Deleted.
2305         * rendering/RenderTableSection.h:
2306         * rendering/updating/RenderTreeBuilder.cpp:
2307         (WebCore::RenderTreeBuilder::insertChild): Leftover from r228529.
2308         (WebCore::RenderTreeBuilder::insertChildToRenderTable): Deleted. Leftover from r228529.
2309         (WebCore::RenderTreeBuilder::insertChildToRenderTableSection): Deleted.
2310         * rendering/updating/RenderTreeBuilder.h:
2311         * rendering/updating/RenderTreeBuilderTable.cpp:
2312         (WebCore::RenderTreeBuilder::Table::insertChild):
2313
2314 2018-02-15  Zalan Bujtas  <zalan@apple.com>
2315
2316         [RenderTreeBuilder] Move RenderTable::addChild() to RenderTreeBuilder
2317         https://bugs.webkit.org/show_bug.cgi?id=182832
2318         <rdar://problem/37576362>
2319
2320         Reviewed by Antti Koivisto.
2321
2322         No change in functionality.
2323
2324         * rendering/RenderTable.cpp:
2325         (WebCore::RenderTable::willInsertTableColumn):
2326         (WebCore::RenderTable::willInsertTableSection):
2327         (WebCore::RenderTable::addChild): Deleted.
2328         * rendering/RenderTable.h:
2329         * rendering/updating/RenderTreeBuilder.cpp:
2330         (WebCore::RenderTreeBuilder::insertChild):
2331         * rendering/updating/RenderTreeBuilderTable.cpp:
2332         (WebCore::RenderTreeBuilder::Table::insertChild):
2333
2334 2018-02-14  Darin Adler  <darin@apple.com>
2335
2336         Use std::make_unique instead of explicit calls to new and instead of writing create functions
2337         https://bugs.webkit.org/show_bug.cgi?id=182821
2338
2339         Reviewed by Anders Carlsson.
2340
2341         * loader/LinkLoader.cpp:
2342         (WebCore::createLinkPreloadResourceClient): Use std::make_unique insteadof create functions.
2343
2344         * loader/LinkPreloadResourceClients.h: Make constructors public, get rid of create functions,
2345         make overrides be private and final, get rid of unnecessary public default virtual destructors
2346         that the compiler will generate correctly without anything explicit.
2347
2348         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
2349         (WebCore::CDMFactoryClearKey::createCDM): Use std::make_unique instead of std::unique_ptr/new.
2350
2351         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2352         (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): Use
2353         std::make_unique instead of calling a create function.
2354         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2355         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC): Ditto.
2356         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2357         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Ditto.
2358
2359         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h: Made the constructor
2360         public and got rid of the create function.
2361         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
2362         (WebCore::VideoFullscreenLayerManager::create): Deleted.
2363
2364         * rendering/GridTrackSizingAlgorithm.cpp:
2365         (WebCore::GridTrackSizingAlgorithm::computeFlexFactorUnitSize const):
2366         Use std::make_unique instead of std::unique_ptr/new.
2367
2368 2018-02-15  Andy Estes  <aestes@apple.com>
2369
2370         Finish unifying Apple Pay and Payment Request sources
2371         https://bugs.webkit.org/show_bug.cgi?id=182831
2372
2373         Reviewed by Keith Miller.
2374
2375         * Sources.txt:
2376         * SourcesCocoa.txt:
2377         * WebCore.xcodeproj/project.pbxproj:
2378
2379 2018-02-15  Zan Dobersek  <zdobersek@igalia.com>
2380
2381         HarfBuzzFace: rework cache entry reference holding
2382         https://bugs.webkit.org/show_bug.cgi?id=182828
2383
2384         Reviewed by Michael Catanzaro.
2385
2386         Move the FaceCacheEntry and HarfBuzzFaceCache types into the
2387         HarfBuzzFace class as CacheEntry and Cache, respectively. The Cache
2388         singleton is also moved there.
2389
2390         In the HarfBuzzFace constructor, we now don't increase the CacheEntry
2391         reference, but instead just keep a reference to that object through
2392         a RefPtr<CacheEntry> object. We don't need to retrieve the hb_face_t
2393         object and the glyph cache HashMap in the constructor anymore, we just
2394         retrieve them when necessary through that CacheEntry reference.
2395
2396         In the destructor, that RefPtr<CacheEntry> object is nulled out before
2397         the object in Cache is removed if that's where the final reference is
2398         kept.
2399
2400         * platform/graphics/harfbuzz/HarfBuzzFace.cpp:
2401         (WebCore::HarfBuzzFace::CacheEntry::CacheEntry):
2402         (WebCore::HarfBuzzFace::CacheEntry::~CacheEntry):
2403         (WebCore::HarfBuzzFace::cache):
2404         (WebCore::HarfBuzzFace::HarfBuzzFace):
2405         (WebCore::HarfBuzzFace::~HarfBuzzFace):
2406         (WebCore::HarfBuzzFace::setScriptForVerticalGlyphSubstitution):
2407         (WebCore::FaceCacheEntry::create): Deleted.
2408         (WebCore::FaceCacheEntry::~FaceCacheEntry): Deleted.
2409         (WebCore::FaceCacheEntry::face): Deleted.
2410         (WebCore::FaceCacheEntry::glyphCache): Deleted.
2411         (WebCore::FaceCacheEntry::FaceCacheEntry): Deleted.
2412         (WebCore::harfBuzzFaceCache): Deleted.
2413         * platform/graphics/harfbuzz/HarfBuzzFace.h:
2414         (WebCore::HarfBuzzFace::CacheEntry::create):
2415         (WebCore::HarfBuzzFace::CacheEntry::face):
2416         (WebCore::HarfBuzzFace::CacheEntry::glyphCache):
2417         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
2418         (WebCore::harfBuzzGetGlyph):
2419         (WebCore::HarfBuzzFace::createFont):
2420
2421 2018-02-15  Zan Dobersek  <zdobersek@igalia.com>
2422
2423         FontPlatformData::harfBuzzFace() should return a reference
2424         https://bugs.webkit.org/show_bug.cgi?id=182825
2425
2426         Reviewed by Carlos Garcia Campos.
2427
2428         Have FontPlatformData::harfBuzzFace() return a reference instead of a
2429         pointer, given that the returned HarfBuzzFace object cannot be null.
2430
2431         Call-sites of FontPlatformData::harfBuzzFace() are adjusted.
2432         OpenTypeMathData constructors are also changed to not rely on
2433         preprocessor to correctly position the closing brace.
2434
2435         * platform/graphics/FontPlatformData.h:
2436         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
2437         (WebCore::FontPlatformData::harfBuzzFace const):
2438         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
2439         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
2440         * platform/graphics/opentype/OpenTypeMathData.cpp:
2441         (WebCore::OpenTypeMathData::OpenTypeMathData):
2442
2443 2018-02-15  Jiewen Tan  <jiewen_tan@apple.com>
2444
2445         [WebAuthN] Revisit the whole async model of task dispatching, timeout and aborting
2446         https://bugs.webkit.org/show_bug.cgi?id=181946
2447         <rdar://problem/37258262>
2448
2449         Reviewed by Chris Dumez.
2450
2451         This patch changes the original async model from a work queue to IPC between WebProcess
2452         and UIProcess. Since all authenticator operations must be handled in the UIProcess due
2453         to sandboxing, this message passing IPC async model then surpasses the original multi
2454         threading model. To cooperate that, a CredentialsMessenger class is then created and
2455         all task dispatching code is moved thre.
2456
2457         As an improvement over existing code, static functions from PublicKeyCredential are
2458         moved to AuthenticatorManager. AuthenticatorManager is made as a singleton such that
2459         when static functions are called, they could reach the CredentialsMessenger to interact
2460         with UIProccess. CredentialsMessenger and AuthenticatorManager are separated so later
2461         on when other Credential types are created, they can reuse the same IPC messenger.
2462
2463         What's more, a mock CredentialsMessenger is then created to mock behaviors of UIProcess
2464         for testing purpose.
2465
2466         Covered by existing tests.
2467
2468         * DerivedSources.make:
2469         * Modules/credentialmanagement/BasicCredential.h:
2470         * Modules/credentialmanagement/CredentialsContainer.cpp:
2471         (WebCore::CredentialsContainer::CredentialsContainer):
2472         (WebCore::CredentialsContainer::doesHaveSameOriginAsItsAncestors):
2473         (WebCore::CredentialsContainer::get):
2474         (WebCore::CredentialsContainer::isCreate):
2475         (WebCore::CredentialsContainer::PendingPromise::PendingPromise): Deleted.
2476         (WebCore::CredentialsContainer::dispatchTask): Deleted.
2477         * Modules/credentialmanagement/CredentialsContainer.h:
2478         (WebCore::CredentialsContainer::PendingPromise::create): Deleted.
2479         * Modules/credentialmanagement/CredentialsMessenger.cpp: Added.
2480         (WebCore::CredentialsMessenger::exceptionReply):
2481         (WebCore::CredentialsMessenger::addCreationCompletionHandler):
2482         (WebCore::CredentialsMessenger::takeCreationCompletionHandler):
2483         (WebCore::CredentialsMessenger::addRequestCompletionHandler):
2484         (WebCore::CredentialsMessenger::takeRequestCompletionHandler):
2485         (WebCore::CredentialsMessenger::addQueryCompletionHandler):
2486         (WebCore::CredentialsMessenger::takeQueryCompletionHandler):
2487         (WebCore::getIdFromAttestationObject):
2488         * Modules/credentialmanagement/CredentialsMessenger.h: Added.
2489         (WebCore::CreationReturnBundle::CreationReturnBundle):
2490         (WebCore::AssertionReturnBundle::AssertionReturnBundle):
2491         (WebCore::CredentialsMessenger::weakPtrFactory const):
2492         * Modules/webauthn/Authenticator.cpp: Removed.
2493         * Modules/webauthn/Authenticator.h: Removed.
2494         * Modules/webauthn/AuthenticatorManager.cpp: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp.
2495         (WebCore::AuthenticatorManagerInternal::produceClientDataJson):
2496         (WebCore::AuthenticatorManagerInternal::produceClientDataJsonHash):
2497         (WebCore::AuthenticatorManagerInternal::initTimer):
2498         (WebCore::AuthenticatorManagerInternal::didTimerFire):
2499         (WebCore::AuthenticatorManager::singleton):
2500         (WebCore::AuthenticatorManager::setMessenger):
2501         (WebCore::AuthenticatorManager::create const):
2502         (WebCore::AuthenticatorManager::discoverFromExternalSource const):
2503         * Modules/webauthn/AuthenticatorManager.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h.
2504         * Modules/webauthn/AuthenticatorResponse.h:
2505         * Modules/webauthn/PublicKeyCredential.cpp:
2506         (WebCore::PublicKeyCredentialInternal::produceClientDataJson): Deleted.
2507         (WebCore::PublicKeyCredentialInternal::produceClientDataJsonHash): Deleted.
2508         (WebCore::PublicKeyCredentialInternal::getIdFromAttestationObject): Deleted.
2509         (WebCore::PublicKeyCredential::collectFromCredentialStore): Deleted.
2510         (WebCore::PublicKeyCredential::discoverFromExternalSource): Deleted.
2511         (WebCore::PublicKeyCredential::store): Deleted.
2512         (WebCore::PublicKeyCredential::create): Deleted.
2513         (WebCore::PublicKeyCredential::rawId const): Deleted.
2514         (WebCore::PublicKeyCredential::response const): Deleted.
2515         * Modules/webauthn/PublicKeyCredential.h:
2516         * Sources.txt:
2517         * WebCore.xcodeproj/project.pbxproj:
2518         * testing/Internals.cpp:
2519         (WebCore::Internals::Internals):
2520         (WebCore::Internals::mockCredentialsMessenger const):
2521         * testing/Internals.h:
2522         * testing/Internals.idl:
2523         * testing/MockCredentialsMessenger.cpp: Added.
2524         (WebCore::MockCredentialsMessenger::MockCredentialsMessenger):
2525         (WebCore::MockCredentialsMessenger::~MockCredentialsMessenger):
2526         (WebCore::MockCredentialsMessenger::setAttestationObject):
2527         (WebCore::MockCredentialsMessenger::setAssertionReturnBundle):
2528         (WebCore::MockCredentialsMessenger::makeCredential):
2529         (WebCore::MockCredentialsMessenger::getAssertion):
2530         (WebCore::MockCredentialsMessenger::makeCredentialReply):
2531         (WebCore::MockCredentialsMessenger::getAssertionReply):
2532         * testing/MockCredentialsMessenger.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h.
2533         * testing/MockCredentialsMessenger.idl: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h.
2534
2535 2018-02-15  Zalan Bujtas  <zalan@apple.com>
2536
2537         [RenderTreeBuilder] Move RenderInline/RenderGrid::addChild() to RenderTreeBuilder
2538         https://bugs.webkit.org/show_bug.cgi?id=182819
2539         <rdar://problem/37558187>
2540
2541         Reviewed by Antti Koivisto.
2542
2543         No change in functionality.
2544
2545         * rendering/RenderGrid.cpp:
2546         (WebCore::RenderGrid::addChild): Deleted.
2547         * rendering/RenderGrid.h:
2548         * rendering/RenderInline.cpp:
2549         (WebCore::RenderInline::addChild): Deleted.
2550         * rendering/RenderInline.h:
2551         * rendering/updating/RenderTreeBuilder.cpp:
2552         (WebCore::RenderTreeBuilder::insertChild):
2553         (WebCore::RenderTreeBuilder::takeChild): Deleted.
2554         * rendering/updating/RenderTreeBuilder.h:
2555         * rendering/updating/RenderTreeBuilderRuby.cpp:
2556         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
2557         * rendering/updating/RenderTreeBuilderSVG.cpp:
2558         (WebCore::RenderTreeBuilder::SVG::insertChild):
2559
2560 2018-02-15  Antoine Quint  <graouts@apple.com>
2561
2562         [Modern Media Controls] REGRESSION: Inline media controls are not disabled while in fullscreen on iOS
2563         https://bugs.webkit.org/show_bug.cgi?id=182830
2564         <rdar://problem/37537909>
2565
2566         Reviewed by Eric Carlson.
2567
2568         The test media/modern-media-controls/media-controller/ios/media-controller-stop-updates-in-fullscreen.html
2569         regressed when fixing webkit.org/b/182668 since we now started only caring about the presence of the "controls"
2570         attribute to identify that WebKit media controls should be available.
2571
2572         We now have a dedicated _shouldControlsBeAvailable() method which more clearly establishes the conditions under
2573         which controls should be available and correctly disables them while in fullscreen on iOS, regardless of the
2574         "controls" attribute value.
2575
2576         * Modules/modern-media-controls/media/media-controller.js:
2577         (MediaController.prototype._shouldControlsBeAvailable):
2578         (MediaController.prototype._updateControlsAvailability):
2579
2580 2018-02-15  Matt Lewis  <jlewis3@apple.com>
2581
2582         Unreviewed, rolling out r228495.
2583
2584         This caused mulitple perf tests to fail consistently.
2585
2586         Reverted changeset:
2587
2588         "Resource Load Statistics: Make sure
2589         WebResourceLoadStatisticsStore::mergeWithDataFromDecoder() can
2590         ingest older plist versions and not reset the database"
2591         https://bugs.webkit.org/show_bug.cgi?id=182812
2592         https://trac.webkit.org/changeset/228495
2593
2594 2018-02-15  Zan Dobersek  <zdobersek@igalia.com>
2595
2596         Clean up HarfBuzzFaceCairo
2597         https://bugs.webkit.org/show_bug.cgi?id=182824
2598
2599         Reviewed by Carlos Garcia Campos.
2600
2601         Clean up Cairo-specific bits of HarfBuzzFace implementation.
2602
2603         HarfBuzzFontData is simplified, removing the constructor and turning the
2604         cairo_scaled_font_t member into a RefPtr<>, tying the Cairo object's
2605         lifetime to the lifetime of the HarfBuzzFontData instance.
2606
2607         HarfBuzz font callbacks have the HarfBuzzFontData casting cleaned up,
2608         casting the user data pointer straight into a HarfBuzzFontData reference
2609         that's then used in the functions. HarfBuzzFontData member access is
2610         also adjusted.
2611
2612         HarfBuzzFace::createFace() now references the cairo_scaled_font_t object
2613         that is then set as the user data pointer, with the destroy callback
2614         that dereferences that object also specified. With hb_face_t being a
2615         reference-counted object itself, this ensures the cairo_scaled_font_t
2616         object doesn't get destroyed while hb_face_t is still alive.
2617
2618         In HarfBuzzFace::createFont(), the hb_font_t creation is cleaned up,
2619         with a C++ lambda used as the destroy callback.
2620
2621         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
2622         (WebCore::harfBuzzGetGlyph):
2623         (WebCore::harfBuzzGetGlyphHorizontalAdvance):
2624         (WebCore::harfBuzzGetGlyphExtents):
2625         (WebCore::harfBuzzCairoGetTable):
2626         (WebCore::HarfBuzzFace::createFace):
2627         (WebCore::HarfBuzzFace::createFont):
2628         (WebCore::HarfBuzzFontData::HarfBuzzFontData): Deleted.
2629         (WebCore::destroyHarfBuzzFontData): Deleted.
2630
2631 2018-02-15  Philippe Normand  <pnormand@igalia.com>
2632
2633         [GStreamer] WebVTT caps changed in GStreamer 1.14
2634         https://bugs.webkit.org/show_bug.cgi?id=182690
2635
2636         Reviewed by Xabier Rodriguez-Calvar.
2637
2638         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2639         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Use
2640         text/vtt caps only for GStreamer versions inferior or equal to
2641         1.12. In 1.13 (current git master) the VTT caps format changed to
2642         application/x-subtitle-vtt.
2643
2644 2018-02-15  Zan Dobersek  <zdobersek@igalia.com>
2645
2646         HarfBuzzFace should not be ref-counted
2647         https://bugs.webkit.org/show_bug.cgi?id=182823
2648
2649         Reviewed by Carlos Garcia Campos.
2650
2651         The HarfBuzzFace objects shouldn't be copied along in FontPlatformData
2652         copy assignment operator, which made it a requirement for that class to
2653         be ref-counted. Cairo-based HarfBuzzFace implementation uses the
2654         cairo_scaled_font_t object from FontPlatformData internally, but upon
2655         FontPlatformData cloning that scaled font object could change, meaning
2656         HarfBuzzFace object that's shared with another FontPlatformData object
2657         would end up using a different cairo_scaled_font_t object from the one
2658         that's been regenerated in the newly-cloned FontPlatformData object.
2659
2660         Instead of ref-counting the HarfBuzzFace objects, they should be handled
2661         in FontPlatformData through std::unique_ptr<>. In the FontPlatformData
2662         copy assignment operator, the copy target's m_harfBuzzFace object is
2663         nulled out, allowing the next harfBuzzFace() call to construct an
2664         object that properly leverages the cairo_scaled_font_t object that could
2665         have changed during cloning.
2666
2667         * platform/graphics/FontPlatformData.h:
2668         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
2669         (WebCore::FontPlatformData::operator=):
2670         (WebCore::FontPlatformData::harfBuzzFace const):
2671         * platform/graphics/harfbuzz/HarfBuzzFace.h:
2672         (WebCore::HarfBuzzFace::create): Deleted.
2673
2674 2018-02-14  Zalan Bujtas  <zalan@apple.com>
2675
2676         [RenderTreeBuilder] Move RenderMathMLFenced::addChild() to RenderTreeBuilder
2677         https://bugs.webkit.org/show_bug.cgi?id=182817
2678         <rdar://problem/37556761>
2679
2680         Reviewed by Antti Koivisto.
2681
2682         No change in functionality.
2683
2684         * rendering/mathml/RenderMathMLFenced.cpp:
2685         (WebCore::RenderMathMLFenced::addChild): Deleted.
2686         * rendering/mathml/RenderMathMLFenced.h:
2687         * rendering/updating/RenderTreeBuilder.cpp:
2688         (WebCore::RenderTreeBuilder::insertChild):
2689         (WebCore::RenderTreeBuilder::insertChildToRenderMathMLFenced): Deleted.
2690         * rendering/updating/RenderTreeBuilder.h:
2691         * rendering/updating/RenderTreeBuilderMathML.cpp:
2692         (WebCore::RenderTreeBuilder::MathML::insertChild):
2693
2694 2018-02-14  Antti Koivisto  <antti@apple.com>
2695
2696         Do sibling invalidation on mutation
2697         https://bugs.webkit.org/show_bug.cgi?id=182809
2698
2699         Reviewed by Zalan Bujtas.
2700
2701         We used to invalidate siblings for sibling combinators and nth-pseudo classes during style resolution tree walk.
2702         This would consider any element with invalid style a reason to invalidate siblings too. However we now do
2703         accurate invalidation on class and attribute changes and this approach ends up invalidating too much.
2704
2705         This patch sibling style invalidation to mutation time and removes invalidation code from style resolution tree walk.
2706
2707         * dom/Element.cpp:
2708         (WebCore::invalidateSiblingsIfNeeded):
2709
2710             Helper to invalidate siblings.
2711
2712         (WebCore::Element::invalidateStyle):
2713         (WebCore::Element::invalidateStyleAndLayerComposition):
2714         (WebCore::Element::invalidateStyleForSubtree):
2715         (WebCore::Element::invalidateStyleAndRenderersForSubtree):
2716
2717             Invalidate siblings if needed based on affectsNextSibling/affectedByPreviousSibling bits.
2718
2719         (WebCore::Element::invalidateStyleInternal):
2720         (WebCore::Element::invalidateStyleForSubtreeInternal):
2721
2722             Add "internal" versions that don't invalidate siblings. These are used by StyleInvalidator for accurate invalidation.
2723
2724         * dom/Element.h:
2725         * style/StyleInvalidator.cpp:
2726         (WebCore::Style::Invalidator::invalidateIfNeeded):
2727         (WebCore::Style::Invalidator::invalidateStyle):
2728
2729             Use internal invalidation functions.
2730
2731         * style/StyleTreeResolver.cpp:
2732         (WebCore::Style::resetStyleForNonRenderedDescendants):
2733         (WebCore::Style::TreeResolver::resolveComposedTree):
2734
2735             Remove sibling invalidation.
2736
2737         * style/StyleTreeResolver.h:
2738
2739 2018-02-14  John Wilander  <wilander@apple.com>
2740
2741         Resource Load Statistics: Make sure WebResourceLoadStatisticsStore::mergeWithDataFromDecoder() can ingest older plist versions and not reset the database
2742         https://bugs.webkit.org/show_bug.cgi?id=182812
2743         <rdar://problem/37511406>
2744
2745         Reviewed by Brent Fulgham.
2746
2747         No new tests. Tested manually between versions of Safari.
2748
2749         * loader/ResourceLoadStatistics.cpp:
2750         (WebCore::ResourceLoadStatistics::decode):
2751             Now only expects these fields for model version 11 or higher:
2752             - topFrameUniqueRedirectsTo
2753             - topFrameUniqueRedirectsFrom
2754             - subresourceUniqueRedirectsFrom
2755             - timesAccessedAsFirstPartyDueToUserInteraction
2756             - timesAccessedAsFirstPartyDueToStorageAccessAPI
2757         * loader/ResourceLoadStatistics.h:
2758
2759 2018-02-14  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2760
2761         [WinCairo] Fix several build warnings under WebCore/platform
2762         https://bugs.webkit.org/show_bug.cgi?id=182802
2763
2764         Reviewed by Konstantin Tokarev.
2765
2766         Warning C4101 'fileModificationDate': unreferenced local variable
2767                 Source\WebCore\platform\network\curl\CurlCacheEntry.cpp:279
2768
2769         Warning C4239 nonstandard extension used: 'argument': conversion from 'WTF::String'
2770         to 'WTF::String &'
2771                 Source\WebCore\platform\text\win\LocaleWin.cpp:75
2772                 Source\WebCore\platform\text\win\LocaleWin.cpp:77
2773
2774         Warning C4838 conversion from 'UINT' to 'CLIPFORMAT' requires a narrowing conversion
2775                 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:170
2776                 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:325
2777                 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:332
2778                 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:351
2779                 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:358
2780                 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:366
2781                 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:373
2782                 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:380
2783                 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:387
2784
2785         * platform/network/curl/CurlCacheEntry.cpp:
2786         (WebCore::CurlCacheEntry::parseResponseHeaders):
2787         * platform/text/win/LocaleWin.cpp:
2788         (WebCore::LCIDFromLocaleInternal):
2789         * platform/win/ClipboardUtilitiesWin.cpp:
2790         (WebCore::registerClipboardFormat):
2791         (WebCore::texthtmlFormat):
2792         (WebCore::urlWFormat):
2793         (WebCore::urlFormat):
2794         (WebCore::filenameWFormat):
2795         (WebCore::filenameFormat):
2796         (WebCore::htmlFormat):
2797         (WebCore::smartPasteFormat):
2798         (WebCore::fileDescriptorFormat):
2799         (WebCore::fileContentFormatZero):
2800
2801 2018-02-14  Zalan Bujtas  <zalan@apple.com>
2802
2803         [RenderTreeBuilder] Move RenderSVG*::addChild() to RenderTreeBuilder
2804         https://bugs.webkit.org/show_bug.cgi?id=182811
2805         <rdar://problem/37549714>
2806
2807         Reviewed by Antti Koivisto.
2808
2809         No change in functionality.
2810
2811         * rendering/svg/RenderSVGContainer.cpp:
2812         (WebCore::RenderSVGContainer::addChild): Deleted.
2813         * rendering/svg/RenderSVGContainer.h:
2814         * rendering/svg/RenderSVGInline.cpp:
2815         (WebCore::RenderSVGInline::addChild): Deleted.
2816         * rendering/svg/RenderSVGInline.h:
2817         * rendering/svg/RenderSVGRoot.cpp:
2818         (WebCore::RenderSVGRoot::addChild): Deleted.
2819         * rendering/svg/RenderSVGRoot.h:
2820         * rendering/svg/RenderSVGText.cpp:
2821         (WebCore::RenderSVGText::addChild): Deleted.
2822         * rendering/svg/RenderSVGText.h:
2823         * rendering/updating/RenderTreeBuilder.cpp:
2824         (WebCore::RenderTreeBuilder::insertChild):
2825         (WebCore::RenderTreeBuilder::insertChildToSVGContainer): Deleted.
2826         (WebCore::RenderTreeBuilder::insertChildToSVGInline): Deleted.
2827         (WebCore::RenderTreeBuilder::insertChildToSVGRoot): Deleted.
2828         (WebCore::RenderTreeBuilder::insertChildToSVGText): Deleted.
2829         * rendering/updating/RenderTreeBuilder.h:
2830
2831 2018-02-14  Daniel Bates  <dabates@apple.com>
2832
2833         Disallow cross-origin subresources from asking for credentials
2834         https://bugs.webkit.org/show_bug.cgi?id=182579
2835         <rdar://problem/36162271>
2836
2837         Reviewed by Andy Estes.
2838
2839         Prompts for credentials to load cross-origin subresources are typically seen as unexpected
2840         by a person that navigates to- or interacts with- a web page. The cross-origin and implicit
2841         loading nature of these subresources makes asking for credentials questionable because they
2842         are not being served by the same origin of the page a person explicitly loaded and are not
2843         guaranteed to correspond to an explicit user interaction other than the initial load of the
2844         page. We know that subresources that ask for credentials can be abused as part of a phishing
2845         attack. It seems reasonable to disallow cross-origin subresources from asking for credentials
2846         due to their questionable nature and the risk for abuse. This will also make the behavior
2847         of WebKit match the behavior of Chrome.
2848
2849         Tests: http/tests/media/video-auth-with-allowCrossOriginSubresourcesToAskForCredentials.html
2850                http/tests/security/basic-auth-subresource.html
2851                http/tests/security/mixedContent/insecure-basic-auth-image-allowCrossOriginSubresourcesToAskForCredentials.https.html
2852                http/tests/security/mixedContent/insecure-image-redirects-to-basic-auth-secure-image-allowCrossOriginSubresourcesToAskForCredentials.html
2853                http/tests/security/mixedContent/secure-redirect-to-insecure-redirect-to-basic-auth-secure-image-allowCrossOriginSubresourcesToAskForCredentials.https.html
2854                http/tests/security/mixedContent/secure-redirect-to-secure-redirect-to-basic-auth-insecure-image-allowCrossOriginSubresourcesToAskForCredentials.https.html
2855                http/tests/security/mixedContent/secure-redirect-to-secure-redirect-to-basic-auth-secure-image-allowCrossOriginSubresourcesToAskForCredentials.https.html
2856
2857         * loader/ResourceLoader.cpp:
2858         (WebCore::ResourceLoader::isSubresourceLoader const): Formerly non-const.
2859         (WebCore::ResourceLoader::shouldAllowResourceToAskForCredentials const): Added.
2860         (WebCore::ResourceLoader::didBlockAuthenticationChallenge): Emit Web Inspector console message if
2861         the authentication challenge was blocked because the request is cross origin.
2862         (WebCore::ResourceLoader::isAllowedToAskUserForCredentials const): Disallow a cross-origin
2863         request from prompting for credentials.
2864         (WebCore::ResourceLoader::isSubresourceLoader): Deleted; made const.
2865         * loader/ResourceLoader.h:
2866         * loader/SubresourceLoader.cpp:
2867         (WebCore::SubresourceLoader::SubresourceLoader): Update ResourceLoader state so that block cross-origin
2868         subresources from prompting for credentials, if applicable.
2869         (WebCore::SubresourceLoader::isSubresourceLoader const): Formerly non-const.
2870         (WebCore::SubresourceLoader::isSubresourceLoader): Deleted; made const.
2871         * loader/SubresourceLoader.h:
2872         * page/Settings.yaml: Add setting allowCrossOriginSubresourcesToAskForCredentials (defaults: false -
2873         do not allow cross origin subresources to ask for credentials).
2874
2875 2018-02-14  Don Olmstead  <don.olmstead@sony.com>
2876
2877         WebCore headers should not include config.h or PlatformExportMacros.h
2878         https://bugs.webkit.org/show_bug.cgi?id=182799
2879
2880         Reviewed by Darin Adler.
2881
2882         No new tests. No change in behavior.
2883
2884         * Modules/speech/SpeechSynthesis.h:
2885         * bindings/js/JSDOMGlobalObject.h:
2886         * contentextensions/ContentExtensionError.h:
2887         * contentextensions/DFA.h:
2888         * dom/ContextDestructionObserver.h:
2889         * dom/DeviceOrientationClient.h:
2890         * dom/DeviceOrientationData.h:
2891         * editing/cocoa/HTMLConverter.h:
2892         * loader/FrameLoaderStateMachine.h:
2893         * loader/cache/CachedResourceHandle.h:
2894         * page/FrameDestructionObserver.h:
2895         * page/RuntimeEnabledFeatures.h:
2896         * platform/URL.h:
2897         * platform/audio/AudioHardwareListener.h:
2898         * platform/audio/AudioSession.h:
2899         * platform/graphics/Color.h:
2900         * platform/graphics/IntSize.h:
2901         * platform/graphics/transforms/AffineTransform.h:
2902         * platform/graphics/win/LocalWindowsContext.h:
2903         * platform/network/CacheValidation.h:
2904         * platform/network/CredentialBase.h:
2905         * platform/network/ResourceHandleClient.h:
2906         * platform/network/cf/CertificateInfo.h:
2907
2908 2018-02-12  Ryosuke Niwa  <rniwa@webkit.org>
2909
2910         REGRESSION (r223440): Copying & pasting a list from Microsoft Word to TinyMCE fails
2911         https://bugs.webkit.org/show_bug.cgi?id=182564
2912
2913         Reviewed by Wenson Hsieh.
2914
2915         Unfortunately, r228352 was inadaquate to fix copying & pasting of a list item from Microsoft Word into TinyMCE
2916         in older verions of TinyMCE. This patch amends the approach taken by r228352 to make it work across the board
2917         as well as unbreak GMail.
2918
2919         Turns out older versions of TinyMCE can't handle list items when computed styles are added as inline style
2920         declarations by WebKit. To make this work, avoid adding any computed styles as inline styles within mso-list
2921         conditionals as well as any p elements whose style attribute contains "mso-list" property. We would instead
2922         preserve these styles by keeping Microsoft Word's CSS style rules in addition to special @list rules.
2923
2924         In addition, not keeping the style element of Microsoft Word in a head element as done in r228352 causes some
2925         versions of TinyMCE to treat it as regular text, and inserting a bunch of @list rules as user visible text.
2926         To work around this problem, we serialize the style rules as a comment (<!-- ~ -->) within a head element.
2927
2928         Furthermore, when Microsoft Word is in the compatibility mode, it does not generate xmlns:o as the first xmlns
2929         declaration. Generalized the code to detect Microsoft Word's HTML declaration by looking for xmlns:o and xmlns:w
2930         xmls declarations. 
2931
2932         Finally, it turns out that Gmail has its own handling of list items copy & pasted from Microsoft Word, and also
2933         needs this quirks but in the pasted HTML, not the one exposed in getData. As such, this patch also enables the
2934         MSO list quirks in the pasted content as well as the one exposed in getData.
2935
2936         Tests: PasteHTML.PreservesMSOList
2937                PasteHTML.PreservesMSOListInCompatibilityMode
2938                PasteHTML.StripsMSOListWhenMissingMSOHTMLElement
2939                PasteWebArchive.PreservesMSOList
2940                PasteWebArchive.PreservesMSOListInCompatibilityMode
2941                PasteWebArchive.StripsMSOListWhenMissingMSOHTMLElement
2942
2943         * editing/HTMLInterchange.h:
2944         * editing/ReplaceSelectionCommand.cpp:
2945         (WebCore::removeHeadContents): Don't remove the special style element needed for the MSO list quirks since we
2946         don't keep the computed style as inline styles in this case.
2947         * editing/cocoa/WebContentReaderCocoa.mm:
2948         (WebCore::WebContentReader::readWebArchive): Enable the quirks in the pasted content as well as opposed to
2949         just in DataTransfer API exposed to the JavaScript.
2950         (WebCore::WebContentReader::readHTML): Ditto.
2951         * editing/markup.cpp:
2952         (WebCore::shouldPreserveMSOLists): Added. Generalized the logic to detect a Microsoft Word document.
2953         more xmlns declarations.
2954         (WebCore::StyledMarkupAccumulator::shouldPreserveMSOListStyleForElement): Added.
2955         (WebCore::StyledMarkupAccumulator::appendElement): Don't generate the second style element here for elements
2956         with most-list properties. Instead, avoid overriding inline styles with computed styles altogether.
2957         (WebCore::StyledMarkupAccumulator::appendNodeToPreserveMSOList): Include the style rules as well as list rules
2958         and wrap the "style" element in a "head" element to make it compatible with older versions of TinyMCE.
2959
2960 2018-02-14  Dean Jackson  <dino@apple.com>
2961
2962         CrashTracer: com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot + 618
2963         https://bugs.webkit.org/show_bug.cgi?id=182798
2964         <rdar://problem/23337253>
2965
2966         Reviewed by Eric Carlson.
2967
2968         Speculative fix for a crash in HTMLPlugInImageElement::didAddUserAgentShadowRoot.
2969         The guess is that the m_swapRendererTimer is set, and the display state changes to
2970         something that does not require a shadow root, but before the timer fires.
2971         Fix this by ensuring that the timer is reset on every display state change.
2972
2973         * html/HTMLPlugInElement.cpp:
2974         (WebCore::HTMLPlugInElement::setDisplayState): Guard for sets that wouldn't
2975         actually change value, and make sure we always reset the timer.
2976
2977 2018-02-14  Antoine Quint  <graouts@apple.com>
2978
2979         [Modern Media Controls] Don't use arrays as values for localisable strings
2980         https://bugs.webkit.org/show_bug.cgi?id=182791
2981         <rdar://problem/36007262>
2982
2983         Reviewed by Dean Jackson.
2984
2985         Localization tools expect localizable strings to be specified as key-value pairs where both the key and the pair
2986         are plain strings. For the skip buttons, we used an array value to specify a replacement string. We now perform
2987         this task in code with a centralized SkipSeconds constant defining the skip amount.
2988
2989         * English.lproj/modern-media-controls-localized-strings.js:
2990         * Modules/modern-media-controls/controls/icon-service.js:
2991         * Modules/modern-media-controls/main.js:
2992         (UIString):
2993         * Modules/modern-media-controls/media/skip-back-support.js:
2994         (SkipBackSupport.prototype.buttonWasPressed):
2995         * Modules/modern-media-controls/media/skip-forward-support.js:
2996         (SkipForwardSupport.prototype.buttonWasPressed):
2997
2998 2018-02-14  Ryan Haddad  <ryanhaddad@apple.com>
2999
3000         Unreviewed, rolling out r228444.
3001
3002         Introduced API and Layout test failures.
3003
3004         Reverted changeset:
3005
3006         "[WebAuthN] Revisit the whole async model of task dispatching,
3007         timeout and aborting"
3008         https://bugs.webkit.org/show_bug.cgi?id=181946
3009         https://trac.webkit.org/changeset/228444
3010
3011 2018-02-14  Brent Fulgham  <bfulgham@apple.com>
3012
3013         Confirm proper thread in UserGestureIndicator constructor
3014         https://bugs.webkit.org/show_bug.cgi?id=175980
3015
3016         Reviewed by Daniel Bates.
3017
3018         Document is a main-thread object. If we enter the UserGestureIndicator constructor
3019         on a non-main thread, we should ASSERT, not return silently.
3020
3021         * dom/UserGestureIndicator.cpp:
3022         (WebCore::UserGestureIndicator::UserGestureIndicator):
3023
3024 2018-02-14  Zalan Bujtas  <zalan@apple.com>
3025
3026         [RenderTreeBuilder] Remove redundant RenderTreeBuilder methods
3027         https://bugs.webkit.org/show_bug.cgi?id=182770
3028         <rdar://problem/37525627>
3029
3030         Reviewed by Daniel Bates.
3031
3032         No change in functionality.
3033
3034         * rendering/updating/RenderTreeBuilder.cpp:
3035         (WebCore::RenderTreeBuilder::dropAnonymousBoxChild): Deleted.
3036         (WebCore::RenderTreeBuilder::moveRubyChildren): Deleted.
3037         (WebCore::RenderTreeBuilder::resolveMovedChildForMultiColumnFlow): Deleted.
3038         * rendering/updating/RenderTreeBuilder.h:
3039         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
3040         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
3041         * rendering/updating/RenderTreeBuilderInline.cpp:
3042         (WebCore::RenderTreeBuilder::Inline::insertChild):
3043         * rendering/updating/RenderTreeBuilderRuby.cpp:
3044         (WebCore::RenderTreeBuilder::Ruby::takeChild):
3045
3046 2018-02-14  Zalan Bujtas  <zalan@apple.com>
3047
3048         [RenderTreeBuilder] Move RenderElement::takeChild() to RenderTreeBuilder
3049         https://bugs.webkit.org/show_bug.cgi?id=182762
3050         <rdar://problem/37523756>
3051
3052         Reviewed by Daniel Bates.
3053
3054         This patch removes the remaining takeChild() related mutation logic from the renderers.
3055
3056         No change in functionality.
3057
3058         * rendering/RenderBoxModelObject.cpp:
3059         (WebCore::RenderBoxModelObject::moveChildTo):
3060         * rendering/RenderElement.cpp:
3061         (WebCore::RenderElement::takeChild): Deleted.
3062         (WebCore::RenderElement::takeChildInternal): Deleted.
3063         * rendering/RenderElement.h:
3064         * rendering/RenderObject.h:
3065         * rendering/updating/RenderTreeBuilder.cpp:
3066         (WebCore::RenderTreeBuilder::takeChild):
3067         (WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock):
3068         (WebCore::RenderTreeBuilder::takeChildFromRenderElement):
3069         * rendering/updating/RenderTreeBuilder.h:
3070         * rendering/updating/RenderTreeBuilderBlock.cpp:
3071         (WebCore::RenderTreeBuilder::Block::removeLeftoverAnonymousBlock):
3072         (WebCore::RenderTreeBuilder::Block::takeChild):
3073         (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild):
3074         * rendering/updating/RenderTreeBuilderInline.cpp:
3075         (WebCore::RenderTreeBuilder::Inline::splitFlow):
3076         (WebCore::RenderTreeBuilder::Inline::splitInlines):
3077         (WebCore::RenderTreeBuilder::Inline::childBecameNonInline):
3078         * rendering/updating/RenderTreeBuilderRuby.cpp:
3079         (WebCore::RenderTreeBuilder::Ruby::takeChild):
3080         * rendering/updating/RenderTreeBuilderSVG.cpp:
3081         (WebCore::RenderTreeBuilder::SVG::takeChild): Leftover from the previous patch.
3082
3083 2018-02-13  Antti Koivisto  <antti@apple.com>
3084
3085         REGRESSION(r228313): Membuster | macOS | All Devices | 1.5 MB
3086         https://bugs.webkit.org/show_bug.cgi?id=182744
3087         <rdar://problem/37463770>
3088
3089         Reviewed by Zalan Bujtas.
3090
3091         We need to respect low memory notifications explicitly now that the compiled selectors are not part of RuleData.
3092
3093         * css/StyleRule.cpp:
3094         (WebCore::StyleRule::StyleRule):
3095         * css/StyleRule.h:
3096
3097         Switch to std::unique_ptr<[]> from Vector to avoid unnecessary bloat.
3098
3099         * css/StyleSheetContents.cpp:
3100         (WebCore::traverseRulesInVector):
3101         (WebCore::StyleSheetContents::traverseRules const):
3102
3103         Add a rule traversal function, similar to the existing traverseSubresources.
3104
3105         (WebCore::StyleSheetContents::traverseSubresources const):
3106
3107         Use traverseRules to implement traverseSubresources.
3108
3109         (WebCore::traverseSubresourcesInRules): Deleted.
3110         * css/StyleSheetContents.h:
3111         * page/MemoryRelease.cpp:
3112         (WebCore::releaseCriticalMemory):
3113         * style/StyleScope.cpp:
3114         (WebCore::Style::Scope::releaseMemory):
3115
3116         Release memory for compiled selectors on memory notification.
3117
3118         * style/StyleScope.h:
3119
3120 2018-02-13  Commit Queue  <commit-queue@webkit.org>
3121
3122         Unreviewed, rolling out r228431.
3123         https://bugs.webkit.org/show_bug.cgi?id=182766
3124
3125         Regressed CMake build stability (Requested by dolmstead on
3126         #webkit).
3127
3128         Reverted changeset:
3129
3130         "[CMake] Make WebCore headers copies"
3131         https://bugs.webkit.org/show_bug.cgi?id=182512
3132         https://trac.webkit.org/changeset/228431
3133
3134 2018-02-13  Commit Queue  <commit-queue@webkit.org>
3135
3136         Unreviewed, rolling out r228437, r228439, and r228440.
3137         https://bugs.webkit.org/show_bug.cgi?id=182756
3138
3139         Introduced LayoutTest failures (Requested by ryanhadd_ on
3140         #webkit).
3141
3142         Reverted changesets:
3143
3144         "[Web Animations] Make KeyframeEffect target nullable and
3145         read-write"
3146         https://bugs.webkit.org/show_bug.cgi?id=182741
3147         https://trac.webkit.org/changeset/228437
3148
3149         "Unreviewed attempt to fix build after r228437."
3150         https://trac.webkit.org/changeset/228439
3151
3152         "[Web Animations] Make KeyframeEffect target nullable and
3153         read-write"
3154         https://bugs.webkit.org/show_bug.cgi?id=182741
3155         https://trac.webkit.org/changeset/228440
3156
3157 2018-02-13  Antoine Quint  <graouts@apple.com>
3158
3159         Removing the controls attribute from a <video> element does not tear down the controls shadow DOM nor cancel event listeners.
3160         https://bugs.webkit.org/show_bug.cgi?id=182668
3161         <rdar://problem/33793004>
3162
3163         Reviewed by Jer Noble.
3164
3165         When controls were turned off for inline media players, we would remove all media controls elements from the shadow root,
3166         but we would nevertheless continue to listen to media events and, as a result, update properties of the media controls
3167         which would lead to requestAnimationFrame() calls that would update the detached DOM nodes.
3168
3169         We now only listent to media events if controls are turned on.
3170
3171         * Modules/modern-media-controls/media/controls-visibility-support.js:
3172         (ControlsVisibilitySupport.prototype.enable): Remove the mutation observer from ControlsVisibilitySupport since observing
3173         changes to the controls attribute is now performed directly in MediaController. We need to make sure that we update the
3174         controls however since fadesWhileIdle is turned off in the disable() call to ensure that the auto-hide behavior is disabled
3175         as well.
3176         (ControlsVisibilitySupport.prototype.disable): Disable the auto-hide controller as well.
3177         (ControlsVisibilitySupport.prototype._updateControls): Remove code that has now been moved into MediaController._updateControlsAvailability().
3178         * Modules/modern-media-controls/media/media-controller.js:
3179         (MediaController): Listen to the "play" event on the media so that we call _updateControlsAvailability() in this situation to account for
3180         shouldForceControlsDisplay on MediaControlsHost. We also register for a mutation observer to track when the controls attribute availability
3181         changes in which case we want to call _updateControlsAvailability() as well.
3182         (MediaController.prototype.handleEvent): Call _updateControlsAvailability() instead of _updateiOSFullscreenProperties() which has been renamed
3183         and expanded.
3184         (MediaController.prototype._updateControlsIfNeeded): Call _updateControlsAvailability() after controls have been updated.
3185         (MediaController.prototype._updateControlsAvailability): We now disable supporting media controller objects when we know that controls should
3186         be hidden in all cases except when in fullscreen on macOS.
3187         (MediaController.prototype._updateiOSFullscreenProperties): Deleted.
3188         * Modules/modern-media-controls/media/placard-support.js:
3189         (PlacardSupport.prototype.disable): Only allow the media events required to track when to show placards when in fullscreen since inline media
3190         players need to show the AirPlay and picture-in-picture placards even when controls are disabled.
3191
3192 2018-02-13  Jiewen Tan  <jiewen_tan@apple.com>
3193
3194         [WebAuthN] Revisit the whole async model of task dispatching, timeout and aborting
3195         https://bugs.webkit.org/show_bug.cgi?id=181946
3196         <rdar://problem/37258262>
3197
3198         Reviewed by Chris Dumez.
3199
3200         This patch changes the original async model from a work queue to IPC between WebProcess
3201         and UIProcess. Since all authenticator operations must be handled in the UIProcess due
3202         to sandboxing, this message passing IPC async model then surpasses the original multi
3203         threading model. To cooperate that, a CredentialsMessenger class is then created and
3204         all task dispatching code is moved thre.
3205
3206         As an improvement over existing code, static functions from PublicKeyCredential are
3207         moved to AuthenticatorManager. AuthenticatorManager is made as a singleton such that
3208         when static functions are called, they could reach the CredentialsMessenger to interact
3209         with UIProccess. CredentialsMessenger and AuthenticatorManager are separated so later
3210         on when other Credential types are created, they can reuse the same IPC messenger.
3211
3212         What's more, a mock CredentialsMessenger is then created to mock behaviors of UIProcess
3213         for testing purpose.
3214
3215         Covered by existing tests.
3216
3217         * DerivedSources.make:
3218         * Modules/credentialmanagement/BasicCredential.h:
3219         * Modules/credentialmanagement/CredentialsContainer.cpp:
3220         (WebCore::CredentialsContainer::CredentialsContainer):
3221         (WebCore::CredentialsContainer::doesHaveSameOriginAsItsAncestors):
3222         (WebCore::CredentialsContainer::get):
3223         (WebCore::CredentialsContainer::isCreate):
3224         (WebCore::CredentialsContainer::PendingPromise::PendingPromise): Deleted.
3225         (WebCore::CredentialsContainer::dispatchTask): Deleted.
3226         * Modules/credentialmanagement/CredentialsContainer.h:
3227         (WebCore::CredentialsContainer::PendingPromise::create): Deleted.
3228         * Modules/credentialmanagement/CredentialsMessenger.cpp: Added.
3229         (WebCore::CredentialsMessenger::exceptionReply):
3230         (WebCore::CredentialsMessenger::addCreationCompletionHandler):
3231         (WebCore::CredentialsMessenger::takeCreationCompletionHandler):
3232         (WebCore::CredentialsMessenger::addRequestCompletionHandler):
3233         (WebCore::CredentialsMessenger::takeRequestCompletionHandler):
3234         (WebCore::CredentialsMessenger::addQueryCompletionHandler):
3235         (WebCore::CredentialsMessenger::takeQueryCompletionHandler):
3236         (WebCore::getIdFromAttestationObject):
3237         * Modules/credentialmanagement/CredentialsMessenger.h: Added.
3238         (WebCore::CreationReturnBundle::CreationReturnBundle):
3239         (WebCore::AssertionReturnBundle::AssertionReturnBundle):
3240         (WebCore::CredentialsMessenger::weakPtrFactory const):
3241         * Modules/webauthn/Authenticator.cpp: Removed.
3242         * Modules/webauthn/Authenticator.h: Removed.
3243         * Modules/webauthn/AuthenticatorManager.cpp: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp.
3244         (WebCore::AuthenticatorManagerInternal::produceClientDataJson):
3245         (WebCore::AuthenticatorManagerInternal::produceClientDataJsonHash):
3246         (WebCore::AuthenticatorManagerInternal::initTimer):
3247         (WebCore::AuthenticatorManagerInternal::didTimerFire):
3248         (WebCore::AuthenticatorManager::singleton):
3249         (WebCore::AuthenticatorManager::setMessenger):
3250         (WebCore::AuthenticatorManager::create const):
3251         (WebCore::AuthenticatorManager::discoverFromExternalSource const):
3252         * Modules/webauthn/AuthenticatorManager.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h.
3253         * Modules/webauthn/AuthenticatorResponse.h:
3254         * Modules/webauthn/PublicKeyCredential.cpp:
3255         (WebCore::PublicKeyCredentialInternal::produceClientDataJson): Deleted.
3256         (WebCore::PublicKeyCredentialInternal::produceClientDataJsonHash): Deleted.
3257         (WebCore::PublicKeyCredentialInternal::getIdFromAttestationObject): Deleted.
3258         (WebCore::PublicKeyCredential::collectFromCredentialStore): Deleted.
3259         (WebCore::PublicKeyCredential::discoverFromExternalSource): Deleted.
3260         (WebCore::PublicKeyCredential::store): Deleted.
3261         (WebCore::PublicKeyCredential::create): Deleted.
3262         (WebCore::PublicKeyCredential::rawId const): Deleted.
3263         (WebCore::PublicKeyCredential::response const): Deleted.
3264         * Modules/webauthn/PublicKeyCredential.h:
3265         * Sources.txt:
3266         * WebCore.xcodeproj/project.pbxproj:
3267         * testing/Internals.cpp:
3268         (WebCore::Internals::Internals):
3269         (WebCore::Internals::mockCredentialsMessenger const):
3270         * testing/Internals.h:
3271         * testing/Internals.idl:
3272         * testing/MockCredentialsMessenger.cpp: Added.
3273         (WebCore::MockCredentialsMessenger::setAttestationObject):
3274         (WebCore::MockCredentialsMessenger::setAssertionReturnBundle):
3275         (WebCore::MockCredentialsMessenger::makeCredential):
3276         (WebCore::MockCredentialsMessenger::getAssertion):
3277         (WebCore::MockCredentialsMessenger::makeCredentialReply):
3278         (WebCore::MockCredentialsMessenger::getAssertionReply):
3279         * testing/MockCredentialsMessenger.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h.
3280         * testing/MockCredentialsMessenger.idl: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h.
3281
3282 2018-02-13  Zalan Bujtas  <zalan@apple.com>
3283
3284         [RenderTreeBuilder] Move RenderBlock::takeChild() to RenderTreeBuilder
3285         https://bugs.webkit.org/show_bug.cgi?id=182746
3286         <rdar://problem/37512871>
3287
3288         Reviewed by Antti Koivisto.
3289
3290         No change in functionality.
3291
3292         * rendering/RenderBlock.cpp:
3293         (WebCore::RenderBlock::takeChild): Deleted.
3294         * rendering/RenderBlock.h:
3295         * rendering/updating/RenderTreeBuilder.cpp:
3296         (WebCore::RenderTreeBuilder::takeChild):
3297         (WebCore::RenderTreeBuilder::takeChildFromRenderMenuList):
3298         (WebCore::RenderTreeBuilder::takeChildFromRenderButton):
3299         (WebCore::RenderTreeBuilder::takeChildFromRenderGrid):
3300         (WebCore::RenderTreeBuilder::takeChildFromRenderBlock): Deleted.
3301         * rendering/updating/RenderTreeBuilder.h:
3302         * rendering/updating/RenderTreeBuilderBlock.cpp:
3303         (WebCore::RenderTreeBuilder::Block::takeChild):
3304
3305 2018-02-13  Antoine Quint  <graouts@apple.com>
3306
3307         [Web Animations] Make KeyframeEffect target nullable and read-write
3308         https://bugs.webkit.org/show_bug.cgi?id=182741
3309
3310         Additional unreviewed attempt to fix build after r228437.
3311
3312         * dom/Element.h:
3313
3314 2018-02-13  Chris Dumez  <cdumez@apple.com>
3315
3316         Unreviewed attempt to fix build after r228437.
3317
3318         * dom/Element.h:
3319
3320 2018-02-13  Antoine Quint  <graouts@apple.com>
3321
3322         [Web Animations] Make KeyframeEffect target nullable and read-write
3323         https://bugs.webkit.org/show_bug.cgi?id=182741
3324
3325         Reviewed by Dean Jackson.
3326
3327         We used to completely disregard null targets, for instance not parsing keyframes, but targets
3328         can be null and are also supposed to be read-write for KeyframeEffect. We now update the IDL
3329         for KeyframeEffect to mark the target property as read-write and update the implementation
3330         to correctly handle null targets by creating a StyleResolver based on the ScriptExecutionContext's
3331         document's document element (the <html> element in practice) and not the target itself, since it
3332         can be null.
3333
3334         This revealed a few issues in our implementation by allowing more WPT tests to run. So we also
3335         ensure that:
3336         
3337         - we don't crash when parsing font-related properties by calling update() on the generated
3338         RenderStyle's FontCascade when parsing keyframes.
3339
3340         - CSS properties are provided as camel-case and not as hyphenated form
3341
3342         - values provided in keyframes dictionaries are only read for valid properties
3343
3344         - styles for effect targets are invalidated as soon as the timing model for that animation
3345         is changed
3346
3347         We also rename AnimationTimeline::animationTimingModelDidChange() to AnimationTimeline::timingModelDidChange()
3348         since the previous name didn't add useful information and we're adding a new WebAnimation::timingModelDidChange()
3349         method, so having the two methods have a similar name made more sense.
3350
3351         * animation/Animatable.idl: Call animate() with a ScriptExecutionContext rather than a ScriptState
3352         so that the ScriptExecutionContext can be passed to the KeyframeEffectReadOnly constructor.
3353         * animation/AnimationEffectReadOnly.h: Add a new invalidate() method, designed to be subclassed, that
3354         is called when the timing model for this effect or owning animation has changed.
3355         * animation/AnimationTimeline.cpp: Rename animationTimingModelDidChange() to timingModelDidChange().
3356         (WebCore::AnimationTimeline::addAnimation):
3357         (WebCore::AnimationTimeline::removeAnimation):
3358         (WebCore::AnimationTimeline::setCurrentTime):
3359         * animation/AnimationTimeline.h: Rename animationTimingModelDidChange() to timingModelDidChange().
3360         (WebCore::AnimationTimeline::timingModelDidChange):
3361         (WebCore::AnimationTimeline::animationTimingModelDidChange): Deleted.
3362         * animation/DocumentTimeline.cpp: Rename animationTimingModelDidChange() to timingModelDidChange().
3363         (WebCore::DocumentTimeline::timingModelDidChange):