ENABLE(ASSERT) used in grid code when !ASSERT_DISABLED is desired
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-10-04  Michael Catanzaro  <mcatanzaro@igalia.com>
2
3         ENABLE(ASSERT) used in grid code when !ASSERT_DISABLED is desired
4         https://bugs.webkit.org/show_bug.cgi?id=190145
5
6         Reviewed by Javier Fernandez.
7
8         Replace ENABLE(ASSERT), which doesn't exist, with !ASSERT_DISABLED.
9
10         * rendering/RenderGrid.cpp:
11         (WebCore::RenderGrid::placeItemsOnGrid const):
12         (WebCore::RenderGrid::baselinePosition const):
13         * rendering/style/GridArea.h:
14         (WebCore::GridSpan::GridSpan):
15
16 2018-10-04  Dan Bernstein  <mitz@apple.com>
17
18         WebCore part of [Xcode] Update some build settings as recommended by Xcode 10
19         https://bugs.webkit.org/show_bug.cgi?id=190250
20
21         Reviewed by Andy Estes.
22
23         * Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA, CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF,
24           CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED, and CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS.
25
26         * WebCore.xcodeproj/project.pbxproj: Let Xcode update LastUpgradeCheck and remove a
27           duplicate reference in a Compile Sources build phase.
28
29         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: Suppress -Wdeprecated-implementations
30           around implementations of deprecated accessibility methods.
31
32         * loader/TextResourceDecoder.cpp:
33         (WebCore::TextResourceDecoder::checkForBOM): Addressed CLANG_WARN_COMMA.
34
35         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
36         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
37           Suppress -Wdeprecated-implementations around implementations of this deprecated delegate method.
38         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): Ditto.
39
40 2018-10-02  Darin Adler  <darin@apple.com>
41
42         AudioNode.connect should use [ReturnValue]
43         https://bugs.webkit.org/show_bug.cgi?id=190231
44
45         Reviewed by Eric Carlson.
46
47         This is a slightly more efficient way to return a value that is always
48         identical to one of the arguments, so use it here.
49
50         * Modules/webaudio/AudioBasicInspectorNode.cpp:
51         (WebCore::AudioBasicInspectorNode::connect): Return ExceptionOr<void>.
52         * Modules/webaudio/AudioBasicInspectorNode.h: Ditto.
53         * Modules/webaudio/AudioNode.cpp:
54         (WebCore::AudioNode::connect): Ditto.
55         * Modules/webaudio/AudioNode.h: Ditto.
56
57         * Modules/webaudio/AudioNode.idl: Use [ReturnValue].
58
59 2018-10-03  Justin Michaud  <justin_michaud@apple.com>
60
61         Registered custom properties should allow inheritance to be controlled
62         https://bugs.webkit.org/show_bug.cgi?id=190038
63
64         Reviewed by Antti Koivisto.
65
66         Tests: css-custom-properties-api/inherits.html
67                css-custom-properties-api/length.html
68                css-custom-properties-api/length2.html
69
70         Add support for inherits property on registered css custom properties, as well
71         as a starting point for evaluating registered custom properties with types. Registered
72         custom properties are evaluated as length values before being substituted. Currently,
73         relative unit cycles are not detected.
74
75         A proper solution is still needed to resolve relative unit cycles, and to apply properties like font
76         and line-height before they are needed by custom properties. In this patch, the font-size property is
77         applied twice, once before and once after resolving custom property values.
78
79         * Sources.txt:
80         * WebCore.xcodeproj/project.pbxproj:
81         * css/CSSComputedStyleDeclaration.cpp:
82         (WebCore::ComputedStyleExtractor::customPropertyValue):
83         (WebCore::CSSComputedStyleDeclaration::length const):
84         (WebCore::CSSComputedStyleDeclaration::item const):
85
86         Allow JS to get custom properties that have been resolved to a length. Also add properties from
87         m_rareNonInheritedData.
88
89         * css/CSSCustomPropertyValue.cpp:
90         (WebCore::CSSCustomPropertyValue::checkVariablesForCycles const):
91         (WebCore::CSSCustomPropertyValue::resolveVariableReferences const):
92         * css/CSSCustomPropertyValue.h:
93         * css/CSSRegisteredCustomProperty.cpp: Copied from Source/WebCore/css/CSSRegisteredCustomProperty.h.
94         (WebCore::CSSRegisteredCustomProperty::CSSRegisteredCustomProperty):
95         (WebCore::CSSRegisteredCustomProperty::initialValueCopy const):
96         * css/CSSRegisteredCustomProperty.h:
97         (WebCore::CSSRegisteredCustomProperty::initialValue const):
98         * css/CSSVariableData.cpp:
99         (WebCore::CSSVariableData::checkVariablesForCycles const):
100         (WebCore::CSSVariableData::checkVariablesForCyclesWithRange const):
101         (WebCore::CSSVariableData::resolveVariableFallback const):
102         (WebCore::CSSVariableData::resolveVariableReference const):
103         (WebCore::CSSVariableData::resolveVariableReferences const):
104         (WebCore::CSSVariableData::resolveTokenRange const):
105         * css/CSSVariableData.h:
106         * css/CSSVariableReferenceValue.cpp:
107         (WebCore::CSSVariableReferenceValue::checkVariablesForCycles const):
108         * css/CSSVariableReferenceValue.h:
109         * css/DOMCSSRegisterCustomProperty.cpp:
110         (WebCore::DOMCSSRegisterCustomProperty::registerProperty):
111
112         Use RenderStyle over passing in a customProperties map.
113
114         * css/StyleBuilder.h:
115         * css/StyleBuilderConverter.h:
116         (WebCore::StyleBuilderConverter::convertLength):
117         (WebCore::StyleBuilderConverter::convertLengthOrAuto):
118         (WebCore::StyleBuilderConverter::convertLengthSizing):
119         (WebCore::StyleBuilderConverter::convertLengthMaxSizing):
120         * css/StyleBuilderCustom.h:
121         (WebCore::StyleBuilderCustom::applyInitialCustomProperty):
122         (WebCore::StyleBuilderCustom::applyInheritCustomProperty):
123         (WebCore::StyleBuilderCustom::applyValueCustomProperty):
124         * css/StyleResolver.cpp:
125         (WebCore::StyleResolver::useSVGZoomRules const):
126         (WebCore::StyleResolver::useSVGZoomRulesForLength const):
127         (WebCore::StyleResolver::applyProperty):
128         (WebCore::StyleResolver::resolvedVariableValue const):
129         (WebCore::StyleResolver::applyCascadedProperties):
130         (WebCore::StyleResolver::useSVGZoomRules): Deleted.
131         (WebCore::StyleResolver::useSVGZoomRulesForLength): Deleted.
132         (WebCore::StyleResolver::resolvedVariableValue): Deleted.
133         * css/StyleResolver.h:
134         * css/makeprop.pl:
135
136         Move custom property initial values to StyleBuilerCustom. Hook them up to correctly deal with
137         inheritance, unset and revert values.
138
139         * css/parser/CSSParser.cpp:
140         (WebCore::CSSParser::parseValueWithVariableReferences):
141         * css/parser/CSSParser.h:
142         * css/parser/CSSParserContext.cpp:
143         (WebCore::CSSParserContext::CSSParserContext):
144         * css/parser/CSSParserContext.h:
145         * css/parser/CSSPropertyParser.cpp:
146         (WebCore::CSSPropertyParser::parseSingleValue):
147
148         Allow parsing custom property values as lengths.
149
150         * rendering/style/RenderStyle.cpp:
151         (WebCore::RenderStyle::checkVariablesInCustomProperties):
152         * rendering/style/RenderStyle.h:
153         (WebCore::RenderStyle::inheritedCustomProperties const):
154         (WebCore::RenderStyle::nonInheritedCustomProperties const):
155         (WebCore::RenderStyle::setInheritedCustomPropertyValue):
156         (WebCore::RenderStyle::setNonInheritedCustomPropertyValue):
157         (WebCore::RenderStyle::getCustomProperty const):
158         (WebCore::RenderStyle::customProperties const): Deleted.
159         (WebCore::RenderStyle::setCustomPropertyValue): Deleted.
160         * rendering/style/StyleRareNonInheritedData.cpp:
161         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
162         (WebCore::StyleRareNonInheritedData::operator== const):
163         * rendering/style/StyleRareNonInheritedData.h:
164         * style/StyleResolveForDocument.cpp:
165         (WebCore::Style::resolveForDocument):
166
167         Add support for RenderStyle to deal with both inherited and non-inherited properties, and to find
168         cycles between them.
169
170 2018-10-03  Ryosuke Niwa  <rniwa@webkit.org>
171
172         Clear m_pendingTargets in MutationObserver::takeRecords
173         https://bugs.webkit.org/show_bug.cgi?id=190240
174
175         Reviewed by Geoffrey Garen.
176
177         In r236781, we delayed the clearing of m_pendingTargets until the end of microtask to avoid a race between
178         mutation record's JS wrappers getting created and GC marking JS wrappers of elements in mutation records.
179
180         This patch shortens this delay to until mutation record's JS wrappers are created. Specifically, we make
181         MutationObserver::takeRecords() return a struct which has both pending targets hash set and the vector of
182         mutation records so that the hash set survives through the creation of JS wrappers for mutation records.
183
184         To do this, a new IDL extended attribute "ResultField" is introduced to specify the member variable in
185         which the result is stored.
186
187         No new tests. Unfortunately, this race condition appears to be impossible to capture in a regression test.
188
189         * bindings/scripts/CodeGeneratorJS.pm:
190         (GenerateOperationBodyDefinition):
191         * bindings/scripts/IDLAttributes.json:
192         * bindings/scripts/test/JS/JSTestInterface.cpp:
193         (WebCore::jsTestInterfacePrototypeFunctionTakeNodesBody):
194         (WebCore::jsTestInterfacePrototypeFunctionTakeNodes):
195         * bindings/scripts/test/TestImplements.idl: Added a test case.
196         * dom/MutationObserver.cpp:
197         (WebCore::MutationObserver::takeRecords):
198         (WebCore::MutationObserver::deliver):
199         * dom/MutationObserver.h:
200         * dom/MutationObserver.idl:
201
202 2018-10-03  Youenn Fablet  <youenn@apple.com>
203
204         Add VP8 support to WebRTC
205         https://bugs.webkit.org/show_bug.cgi?id=189976
206
207         Reviewed by Eric Carlson.
208
209         Add a runtime flag to control activation of VP8 codec.
210         Bind this runtime flag to the video codec factories.
211         Test: webrtc/video-mute-vp8.html
212
213         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
214         (WebCore::createLibWebRTCPeerConnectionBackend):
215         * page/RuntimeEnabledFeatures.h:
216         (WebCore::RuntimeEnabledFeatures::webRTCVP8CodecEnabled const):
217         (WebCore::RuntimeEnabledFeatures::setWebRTCVP8CodecEnabled):
218         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
219         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
220         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
221         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
222         * testing/Internals.cpp:
223         (WebCore::Internals::resetToConsistentState):
224         Enable VP8 codec for tests.
225
226 2018-09-28  Jiewen Tan  <jiewen_tan@apple.com>
227
228         [WebCrypto] ECDSA could not deal with invalid signature inputs
229         https://bugs.webkit.org/show_bug.cgi?id=189879
230         <rdar://problem/44701276>
231
232         Reviewed by Brent Fulgham.
233
234         Add some guards over detections of the start positions of r/s.
235
236         Covered by improved existing tests.
237
238         * crypto/mac/CryptoAlgorithmECDSAMac.cpp:
239         (WebCore::verifyECDSA):
240
241 2018-10-03  Jer Noble  <jer.noble@apple.com>
242
243         Add a quirk to disable Modern EME for sites which are broken with it enabled
244         https://bugs.webkit.org/show_bug.cgi?id=190051
245
246         Reviewed by Daniel Bates.
247
248         Add a new class, parallel to Settings, to track quirk behavior. Extend the bindings
249         generator to support a DisabledByQuirk attribute, and set this attribute for all
250         the Modern EME types. Check whether the quirk is set inside HTMLMediaElement in
251         addition to the existing Setting.
252
253         * Modules/encryptedmedia/MediaKeyMessageEvent.idl:
254         * Modules/encryptedmedia/MediaKeySession.idl:
255         * Modules/encryptedmedia/MediaKeyStatusMap.idl:
256         * Modules/encryptedmedia/MediaKeySystemAccess.idl:
257         * Modules/encryptedmedia/MediaKeys.idl:
258         * Modules/encryptedmedia/NavigatorEME.idl:
259         * Sources.txt:
260         * WebCore.xcodeproj/project.pbxproj:
261         * bindings/scripts/CodeGenerator.pm:
262         (WK_ucfirst):
263         * bindings/scripts/CodeGeneratorJS.pm:
264         (NeedsRuntimeCheck):
265         (GenerateRuntimeEnableConditionalString):
266         * bindings/scripts/IDLAttributes.json:
267         * bindings/scripts/preprocess-idls.pl:
268         (GenerateConstructorAttributes):
269         * dom/Document.cpp:
270         (WebCore::Document::Document):
271         * dom/Document.h:
272         (WebCore::Document::quirks const):
273         * html/HTMLMediaElement.cpp:
274         (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
275         (WebCore::HTMLMediaElement::mediaPlayerInitializationDataEncountered):
276         * html/HTMLMediaElement.idl:
277         * page/Quirks.cpp: Added.
278         (Quirks::Quirks):
279         (Quirks::disableEncryptedMediaAPIQuirk const):
280         * page/Quirks.h: Added.
281
282 2018-10-03  Antoine Quint  <graouts@apple.com>
283
284         [Web Animations] REGRESSION: setting 'animation-name: none' after a 'fill: forwards' animation has completed does not revert to the unanimated style
285         https://bugs.webkit.org/show_bug.cgi?id=190257
286         <rdar://problem/41341473>
287
288         Reviewed by Dean Jackson.
289
290         Test: animations/animation-fill-forwards-removal.html
291
292         While we removed a declarative animation that was no longer targetting its element, we were not removing it from the declarative animation maps
293         on the timeline, which means that the animation would still be picked up when resolving styles. We now notify the timeline that the animation
294         was detached from the element. This preserves the DeclarativeAnimation relationship returning the element as its effect's target and the document
295         timeline as its timeline, but the document timeline will no longer see this animation as targeting this element.
296
297         * animation/AnimationTimeline.cpp:
298         (WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation):
299         * animation/DeclarativeAnimation.h:
300         (WebCore::DeclarativeAnimation::target const):
301
302 2018-10-03  Jer Noble  <jer.noble@apple.com>
303
304         CRASH in CVPixelBufferGetBytePointerCallback()
305         https://bugs.webkit.org/show_bug.cgi?id=190092
306
307         Reviewed by Eric Carlson.
308
309         Speculative fix for crash that occurs when callers of CVPixelBufferGetBytePointerCallback() attempt
310         to read the last byte of a CVPixelBuffer (as a pre-flight check) and crash due to a memory access
311         error. It's speculated that mismatching CVPixelBufferLockBytePointer / CVPixelBufferUnlockBytePointer
312         calls could result in an incorrect state inside the CVPixelBuffer. Add log count checks, locking, and
313         release logging to try to pinpoint if mismatch lock counts are occurring in this code path.
314
315         * platform/graphics/cv/PixelBufferConformerCV.cpp:
316         (WebCore::CVPixelBufferGetBytePointerCallback):
317         (WebCore::CVPixelBufferReleaseBytePointerCallback):
318         (WebCore::CVPixelBufferReleaseInfoCallback):
319         (WebCore::PixelBufferConformerCV::createImageFromPixelBuffer):
320
321 2018-10-03  Chris Dumez  <cdumez@apple.com>
322
323         Regression(r236779): Crash when changing the input element type from inside an 'input' event listener
324         https://bugs.webkit.org/show_bug.cgi?id=190252
325
326         Reviewed by Alex Christensen.
327
328         Add a null check for element() after firing the 'input' event and before firing the 'change' event
329         in case the input event listener changes the input type.
330
331         Tests: fast/dom/HTMLInputElement/change-type-in-click-event-listener.html
332                fast/dom/HTMLInputElement/change-type-in-input-event-listener.html
333
334         * html/BaseCheckableInputType.cpp:
335         (WebCore::BaseCheckableInputType::fireInputAndChangeEvents):
336
337 2018-10-03  Chris Dumez  <cdumez@apple.com>
338
339         Passing noopener=NOOPENER to window.open() should cause the new window to not have an opener
340         https://bugs.webkit.org/show_bug.cgi?id=190251
341
342         Reviewed by Alex Christensen.
343
344         Passing noopener=NOOPENER to window.open() should cause the new window to not have an opener,
345         similarly to noopener=1:
346         - https://html.spec.whatwg.org/#window-open-steps (step 5)
347
348         It does not matter what the value is, if there is a key named "noopener", then the new window
349         should not have an opener.
350
351         No new tests, rebaselined existing test.
352
353         * page/WindowFeatures.cpp:
354         (WebCore::setWindowFeature):
355
356 2018-10-03  Ryosuke Niwa  <rniwa@webkit.org>
357
358         GC can collect JS wrappers of nodes in the mutation records waiting to be delivered
359         https://bugs.webkit.org/show_bug.cgi?id=190115
360
361         Reviewed by Geoffrey Garen.
362
363         Fixed the bug by retaining JS wrappers of elements in mutation records using GCReachableRef.
364
365         This patch deploys GCReachableRef in two places: MutationObserver where each mutation record's
366         target is kept alive and MutationObserverRegistration where each node which had been removed
367         from an observed tree is kept alive for a subtree observation.
368
369         No new test since the test which can reproduce this problem is too slow.
370
371         * dom/GCReachableRef.h:
372         (WebCore::GCReachableRef): Made it work with hash table.
373         (WebCore::GCReachableRef::operator T& const):
374         (WebCore::GCReachableRef::GCReachableRef):
375         (WebCore::GCReachableRef::isHashTableDeletedValue const):
376         (WebCore::GCReachableRef::isHashTableEmptyValue const):
377         (WebCore::GCReachableRef::ptrAllowingHashTableEmptyValue const):
378         (WebCore::GCReachableRef::ptrAllowingHashTableEmptyValue):
379         (WebCore::GCReachableRef::assignToHashTableEmptyValue):
380         (WTF::HashTraits<WebCore::GCReachableRef<P>>::emptyValue):
381         (WTF::HashTraits<WebCore::GCReachableRef<P>>::constructEmptyValue):
382         (WTF::HashTraits<WebCore::GCReachableRef<P>>::isEmptyValue):
383         (WTF::HashTraits<WebCore::GCReachableRef<P>>::assignToEmpty):
384         (WTF::HashTraits<WebCore::GCReachableRef<P>>::peek):
385         (WTF::HashTraits<WebCore::GCReachableRef<P>>::take):
386         * dom/MutationObserver.cpp:
387         (WebCore::MutationObserver::takeRecords): Don't clear m_pendingTargets because that would allow wrappers
388         to be collected before elements in mutation records are accessed. We delay until the end of the current
389         microtask at which point deliver() function is called.
390         (WebCore::MutationObserver::disconnect):
391         (WebCore::MutationObserver::enqueueMutationRecord): Add the target to the list of elements to keep alive.
392         This is needed for a newly inserted node, a node with attribute change, etc...
393         (WebCore::MutationObserver::deliver): Keep the set of transient registration targets alive until mutation
394         records are delivered to each observer. These are nodes which had been removed from a tree and whose
395         subtree had still been obsreved up until this point.
396         * dom/MutationObserver.h:
397         * dom/MutationObserverRegistration.cpp:
398         (WebCore::MutationObserverRegistration::observedSubtreeNodeWillDetach):
399         (WebCore::MutationObserverRegistration::takeTransientRegistrations): Return the hash set of elemenets
400         that need to be kept alive so that MutationObserver::deliver can keep them alive until the deliver
401         function had been called.
402         (WebCore::MutationObserverRegistration::addRegistrationNodesToSet const):
403         * dom/MutationObserverRegistration.h:
404
405 2018-10-03  Dean Jackson  <dino@apple.com>
406
407         Make the Pointer Events feature description valid
408         https://bugs.webkit.org/show_bug.cgi?id=190254
409
410         Reviewed by Simon Fraser.
411
412         * features.json:
413
414 2018-10-03  Matt Lewis  <jlewis3@apple.com>
415
416         Unreviewed, rolling out r236781.
417
418         The test added with this commit is timing out consistently.
419
420         Reverted changeset:
421
422         "GC can collect JS wrappers of nodes in the mutation records
423         waiting to be delivered"
424         https://bugs.webkit.org/show_bug.cgi?id=190115
425         https://trac.webkit.org/changeset/236781
426
427 2018-10-03  Dean Jackson  <dino@apple.com>
428
429         [macOS] Switching to discrete GPU should be done in the UI process
430         https://bugs.webkit.org/show_bug.cgi?id=189361
431         <rdar://problem/43949622>
432
433         Try to fix the IOSMAC build.
434
435         * platform/graphics/GraphicsContext3D.h:
436
437 2018-10-03  Chris Dumez  <cdumez@apple.com>
438
439         input.checked is incorrect while we're parsing its children
440         https://bugs.webkit.org/show_bug.cgi?id=190227
441
442         Reviewed by Ryosuke Niwa.
443
444         input.checked was incorrect while we're parsing its children because we were delaying updating the
445         checked state until HTMLInputElement::finishParsingChildren() is called, to avoid a bad interaction
446         with form state restoration.
447
448         In this patch, we update the checked state as soon as the 'checked' attribute is set, when we know
449         that no form state to restore.
450
451         fast/forms/radio/state-restore-radio-group.html covers the form restoration case and is still
452         passing.
453
454         No new tests, rebaselined existing test.
455
456         * html/FormController.cpp:
457         (WebCore::FormController::hasFormStateToRestore const):
458         * html/FormController.h:
459         * html/HTMLInputElement.cpp:
460         (WebCore::HTMLInputElement::parseAttribute):
461
462 2018-10-03  Miguel Gomez  <magomez@igalia.com>
463
464         [GTK][WPE] Incorrect rendering of layers whose backingStore hasn't changed
465         https://bugs.webkit.org/show_bug.cgi?id=190249
466
467         Reviewed by Žan Doberšek.
468
469         Do not overwrite m_nicosia.performLayerSync when updating the content buffers or we lose
470         the value calculated during the layer flush. Use an OR instead to keep the old value.
471
472         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
473         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
474
475 2018-10-03  Youenn Fablet  <youenn@apple.com>
476
477         Enable H264 simulcast
478         https://bugs.webkit.org/show_bug.cgi?id=190167
479
480         Reviewed by Eric Carlson.
481
482         Activate H264 simulcast trial field.
483         Make track.getSettings() expose width and height for incoming tracks.
484
485         Test: webrtc/simulcast-h264.html
486
487         * Configurations/WebCore.xcconfig:
488         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
489         (WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint):
490         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
491         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
492
493 2018-10-03  Michael Catanzaro  <mcatanzaro@igalia.com>
494
495         -Wunused-variable in RenderLayer::updateScrollableAreaSet
496         https://bugs.webkit.org/show_bug.cgi?id=190200
497
498         Reviewed by Yusuke Suzuki.
499
500         Pass it through UNUSED_VARIABLE().
501
502         * rendering/RenderLayer.cpp:
503         (WebCore::RenderLayer::calculateClipRects const):
504
505 2018-10-03  Zan Dobersek  <zdobersek@igalia.com>
506
507         Ref<FetchResponse> use-after-move in DOMCache::put()
508         https://bugs.webkit.org/show_bug.cgi?id=190239
509
510         Reviewed by Youenn Fablet.
511
512         Retrieve reference from the Ref<FetchResponse> object before it's
513         move-captured in the lambda that's passed to the
514         FetchResponse::consumeBodyReceivedByChunk() method that is invoked on
515         that very same object. This is a classic use-after-move bug that pops
516         up on compilers with different C++ calling convention.
517
518         * Modules/cache/DOMCache.cpp:
519         (WebCore::DOMCache::put):
520
521 2018-10-03  Ryosuke Niwa  <rniwa@webkit.org>
522
523         Enable selectionAcrossShadowBoundariesEnabled by default in WebKitLegacy
524         https://bugs.webkit.org/show_bug.cgi?id=190238
525
526         Reviewed by Antti Koivisto.
527
528         Enable the feature by default.
529
530         * page/Settings.yaml:
531
532 2018-10-02  Ryosuke Niwa  <rniwa@webkit.org>
533
534         Copying content with shadow DOM doesn't copy any contents
535         https://bugs.webkit.org/show_bug.cgi?id=157443
536
537         Reviewed by Wenson Hsieh.
538
539         This patch adds the support for copying and pasting content across shadow boundaries in HTML and plain text,
540         which is enabled whenever selection across shadow boundaries is enabled.
541
542         To do this, TextIterator now has a constructor which takes two Positions, and the node traversal code in
543         StyledMarkupAccumulator has been abstracted via helper functions as done for TextIterator.
544
545         When serializing a HTMl slot element, serialize it as a span with "display: contents" to make sure when
546         the content is pasted into a shadow tree, it wouldn't affect the slot assignment of the shadow tree.
547
548         Tests: editing/pasteboard/copy-paste-across-shadow-boundaries-1.html
549                editing/pasteboard/copy-paste-across-shadow-boundaries-2.html
550                editing/pasteboard/copy-paste-across-shadow-boundaries-3.html
551                editing/pasteboard/copy-paste-across-shadow-boundaries-4.html
552                editing/pasteboard/copy-paste-across-shadow-boundaries-with-style-1.html
553                editing/pasteboard/copy-paste-across-shadow-boundaries-with-style-2.html
554                editing/pasteboard/copy-paste-with-shadow-content.html
555
556         * dom/ComposedTreeIterator.h:
557         (WebCore::assignedSlotIgnoringUserAgentShadow): Moved from TextIterator.cpp.
558         (WebCore::shadowRootIgnoringUserAgentShadow): Ditto.
559         (WebCore::firstChildInComposedTreeIgnoringUserAgentShadow): Ditto.
560         (WebCore::nextSiblingInComposedTreeIgnoringUserAgentShadow): Ditto.
561         * dom/Position.h:
562         (WebCore::Position::treeScope const): Added.
563         * editing/EditingStyle.cpp:
564         (WebCore::EditingStyle::addDisplayContents): Added.
565         * editing/EditingStyle.h:
566         * editing/Editor.cpp:
567         (WebCore::Editor::selectedText const): Use the new behavior when selectionAcrossShadowBoundariesEnabled is set.
568         (WebCore::Editor::selectedTextForDataTransfer const): Ditto.
569         * editing/MarkupAccumulator.cpp:
570         (WebCore::MarkupAccumulator::appendEndElement): Renamed from appendEndTag. Now takes StringBuilder.
571         * editing/MarkupAccumulator.h:
572         (WebCore::MarkupAccumulator::appendEndTag):
573         * editing/TextIterator.cpp:
574         (WebCore::TextIterator::TextIterator): Added a new variant which takes two positions.
575         (WebCore::TextIterator::init):
576         (WebCore::firstChild):
577         (WebCore::nextSibling):
578         (WebCore::plainText): Ditto.
579         * editing/TextIterator.h:
580         * editing/cocoa/EditorCocoa.mm:
581         (WebCore::Editor::selectionInHTMLFormat): Use the new behavior if selectionAcrossShadowBoundariesEnabled is set.
582         * editing/gtk/EditorGtk.cpp:
583         (WebCore::Editor::writeSelectionToPasteboard): Ditto.
584         * editing/markup.cpp:
585         (WebCore::StyledMarkupAccumulator::parentNode): Added.
586         (WebCore::StyledMarkupAccumulator::firstChild): Added.
587         (WebCore::StyledMarkupAccumulator::nextSibling): Added.
588         (WebCore::StyledMarkupAccumulator::nextSkippingChildren): Added.
589         (WebCore::StyledMarkupAccumulator::hasChildNodes): Added.
590         (WebCore::StyledMarkupAccumulator::isDescendantOf): Added.
591         (WebCore::StyledMarkupAccumulator::StyledMarkupAccumulator):
592         (WebCore::StyledMarkupAccumulator::appendElement): Serialize a slot element as a span with display: contents.
593         (WebCore::StyledMarkupAccumulator::appendEndElement): Added. Ditto.
594         (WebCore::StyledMarkupAccumulator::serializeNodes):
595         (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization): Use the newly added helper functions to
596         traverse the composed tree when m_useComposedTree is set.
597         (WebCore::commonShadowIncludingAncestor): Added.
598         (WebCore::serializePreservingVisualAppearanceInternal): Added SerializeComposedTree as an argument. Also use
599         StyledMarkupAccumulator::parentNode to serialize special common ancestors; e.g. to preserve b, i, etc...
600         (WebCore::serializePreservingVisualAppearance): Ditto to the variant which takes VisibleSelection.
601         (WebCore::sanitizedMarkupForFragmentInDocument):
602         * editing/markup.h:
603         * editing/wpe/EditorWPE.cpp:
604         (WebCore::Editor::writeSelectionToPasteboard):
605         * loader/archive/cf/LegacyWebArchive.cpp:
606         (WebCore::LegacyWebArchive::createFromSelection):
607         * page/PageSerializer.cpp:
608         (WebCore::PageSerializer::SerializerMarkupAccumulator::appendEndElement):
609         * testing/Internals.cpp:
610         (WebCore::Internals::setSelectionWithoutValidation): Added. A helper function to create a selection across
611         shadow boundaries for testing purposes.
612         * testing/Internals.h:
613         * testing/Internals.idl:
614
615 2018-10-02  Chris Dumez  <cdumez@apple.com>
616
617         MessageEvent.ports should return the same object
618         https://bugs.webkit.org/show_bug.cgi?id=190151
619
620         Reviewed by Darin Adler.
621
622         MessageEvent.ports should return the same object it was initialized to instead of
623         constructing a new JSValue every time.
624
625         No new tests, rebaselined existing test.
626
627         * bindings/js/JSMessageEventCustom.cpp:
628         (WebCore::JSMessageEvent::ports const):
629         (WebCore::JSMessageEvent::visitAdditionalChildren):
630         * dom/MessageEvent.cpp:
631         (WebCore::MessageEvent::initMessageEvent):
632         * dom/MessageEvent.h:
633         * dom/MessageEvent.idl:
634
635 2018-10-01  Ryosuke Niwa  <rniwa@webkit.org>
636
637         GC can collect JS wrappers of nodes in the mutation records waiting to be delivered
638         https://bugs.webkit.org/show_bug.cgi?id=190115
639
640         Reviewed by Geoffrey Garen.
641
642         Fixed the bug by retaining JS wrappers of elements in mutation records using GCReachableRef.
643
644         This patch deploys GCReachableRef in two places: MutationObserver where each mutation record's
645         target is kept alive and MutationObserverRegistration where each node which had been removed
646         from an observed tree is kept alive for a subtree observation.
647
648         Test: fast/dom/MutationObserver/mutation-observer-retains-js-wrappers-of-targets-alive.html
649
650         * dom/GCReachableRef.h:
651         (WebCore::GCReachableRef): Made it work with hash table.
652         (WebCore::GCReachableRef::operator T& const):
653         (WebCore::GCReachableRef::GCReachableRef):
654         (WebCore::GCReachableRef::isHashTableDeletedValue const):
655         (WebCore::GCReachableRef::isHashTableEmptyValue const):
656         (WebCore::GCReachableRef::ptrAllowingHashTableEmptyValue const):
657         (WebCore::GCReachableRef::ptrAllowingHashTableEmptyValue):
658         (WebCore::GCReachableRef::assignToHashTableEmptyValue):
659         (WTF::HashTraits<WebCore::GCReachableRef<P>>::emptyValue):
660         (WTF::HashTraits<WebCore::GCReachableRef<P>>::constructEmptyValue):
661         (WTF::HashTraits<WebCore::GCReachableRef<P>>::isEmptyValue):
662         (WTF::HashTraits<WebCore::GCReachableRef<P>>::assignToEmpty):
663         (WTF::HashTraits<WebCore::GCReachableRef<P>>::peek):
664         (WTF::HashTraits<WebCore::GCReachableRef<P>>::take):
665         * dom/MutationObserver.cpp:
666         (WebCore::MutationObserver::takeRecords): Don't clear m_pendingTargets because that would allow wrappers
667         to be collected before elements in mutation records are accessed. We delay until the end of the current
668         microtask at which point deliver() function is called.
669         (WebCore::MutationObserver::disconnect):
670         (WebCore::MutationObserver::enqueueMutationRecord): Add the target to the list of elements to keep alive.
671         This is needed for a newly inserted node, a node with attribute change, etc...
672         (WebCore::MutationObserver::deliver): Keep the set of transient registration targets alive until mutation
673         records are delivered to each observer. These are nodes which had been removed from a tree and whose
674         subtree had still been obsreved up until this point.
675         * dom/MutationObserver.h:
676         * dom/MutationObserverRegistration.cpp:
677         (WebCore::MutationObserverRegistration::observedSubtreeNodeWillDetach):
678         (WebCore::MutationObserverRegistration::takeTransientRegistrations): Return the hash set of elemenets
679         that need to be kept alive so that MutationObserver::deliver can keep them alive until the deliver
680         function had been called.
681         (WebCore::MutationObserverRegistration::addRegistrationNodesToSet const):
682         * dom/MutationObserverRegistration.h:
683
684 2018-10-02  Chris Dumez  <cdumez@apple.com>
685
686         radio / checkbox inputs should fire "click, input, change" events in order when clicked
687         https://bugs.webkit.org/show_bug.cgi?id=190223
688
689         Reviewed by Ryosuke Niwa.
690
691         radio / checkbox inputs should fire "click, input, change" events in order when clicked:
692         - https://html.spec.whatwg.org/#radio-button-state-(type=radio)
693         - https://html.spec.whatwg.org/#checkbox-state-(type=checkbox)
694         - https://dom.spec.whatwg.org/#ref-for-eventtarget-activation-behavior③ (step 11)
695
696         Gecko and Blink already behave this way. However, WebKit has the following issues:
697         - the input event is not fired
698         - the click event is fired after the change event
699
700         No new tests, updated / rebaselined existing tests.
701
702         * html/BaseCheckableInputType.cpp:
703         (WebCore::BaseCheckableInputType::fireInputAndChangeEvents):
704         * html/BaseCheckableInputType.h:
705         * html/CheckboxInputType.cpp:
706         (WebCore::CheckboxInputType::willDispatchClick):
707         (WebCore::CheckboxInputType::didDispatchClick):
708         * html/HTMLInputElement.cpp:
709         (WebCore::HTMLInputElement::setChecked):
710         * html/HTMLInputElement.h:
711         * html/RadioInputType.cpp:
712         (WebCore::RadioInputType::willDispatchClick):
713         (WebCore::RadioInputType::didDispatchClick):
714
715 2018-10-02  Chris Dumez  <cdumez@apple.com>
716
717         fieldset.elements should return an HTMLCollection instead of an HTMLFormControlsCollection
718         https://bugs.webkit.org/show_bug.cgi?id=190218
719
720         Reviewed by Alex Christensen.
721
722         fieldset.elements should return an HTMLCollection instead of an HTMLFormControlsCollection:
723         - https://github.com/whatwg/html/commit/8beedf0c2ffd38853caddec67490288f47afc8eb
724
725         Gecko has always behaved this way. Blink aligned with Gecko and the HTML specification in December 2016:
726         - https://bugs.chromium.org/p/chromium/issues/detail?id=665291
727
728         This simplifies our HTMLFieldSetElement code a lot.
729
730         Test: fast/forms/fieldset/fieldset-elements-htmlcollection.html
731
732         * html/CollectionType.h:
733         * html/GenericCachedHTMLCollection.cpp:
734         (WebCore::GenericCachedHTMLCollection<traversalType>::elementMatches const):
735         * html/HTMLCollection.cpp:
736         (WebCore::HTMLCollection::rootTypeFromCollectionType):
737         (WebCore::invalidationTypeExcludingIdAndNameAttributes):
738         * html/HTMLFieldSetElement.cpp:
739         (WebCore::HTMLFieldSetElement::elements):
740         * html/HTMLFieldSetElement.h:
741         * html/HTMLFieldSetElement.idl:
742         * html/HTMLFormControlsCollection.cpp:
743         (WebCore::HTMLFormControlsCollection::HTMLFormControlsCollection):
744         (WebCore:: const):
745         (WebCore::HTMLFormControlsCollection::copyFormControlElementsVector const):
746         (WebCore::HTMLFormControlsCollection::ownerNode const):
747         (WebCore::HTMLFormControlsCollection::updateNamedElementCache const):
748         * html/HTMLFormControlsCollection.h:
749
750 2018-10-02  Devin Rousso  <drousso@apple.com>
751
752         Web Inspector: prevent layer events from firing until the layer information is re-requested
753         https://bugs.webkit.org/show_bug.cgi?id=190159
754
755         Reviewed by Joseph Pecoraro.
756
757         Test: inspector/layers/layerTreeDidChange.html
758
759         * inspector/agents/InspectorLayerTreeAgent.h:
760         * inspector/agents/InspectorLayerTreeAgent.cpp:
761         (WebCore::InspectorLayerTreeAgent::reset):
762         (WebCore::InspectorLayerTreeAgent::layerTreeDidChange):
763         (WebCore::InspectorLayerTreeAgent::layersForNode):
764
765 2018-10-02  Brian Burg  <bburg@apple.com>
766
767         Web Automation: tab default key handler should always cycle focus when page is controlled by automation
768         https://bugs.webkit.org/show_bug.cgi?id=190221
769         <rdar://problem/44914534>
770
771         Reviewed by Joseph Pecoraro.
772
773         This change progresses WPT WebDriver test special_keys.py::test_webdriver_special_key_sends_keydown[TAB-expected24].
774
775         * page/FocusController.cpp:
776         (WebCore::FocusController::advanceFocusInDocumentOrder):
777         Always cycle focus if the page is controlled by automation. If the chrome takes
778         focus, then the first responder will be something other than the WebView, which
779         causes subsequent WebDriver commands to hang.
780
781 2018-10-01  Dean Jackson  <dino@apple.com>
782
783         [macOS] Switching to discrete GPU should be done in the UI process
784         https://bugs.webkit.org/show_bug.cgi?id=189361
785         <rdar://problem/43949622>
786
787         Reviewed by Simon Fraser.
788
789         Based on an earlier patch by Per Arne Vollan.
790
791         Due to the fact we can't talk to the Window Server, the Web Process can
792         no longer muxing to the discrete GPU directly. Instead we have to get the
793         UI Process to process the change. Do this by adding a new Chrome client
794         called GPUClient, that will have implementations provided by both WebKit
795         and legacy WebKit.
796
797         Unfortunately this can't be tested by a regular WKTR since:
798         - it requires specific hardware
799         - swapping to/from the discrete GPU takes about 20 seconds
800         - running concurrent tests could confuse the tests into thinking
801           the wrong GPU is active
802
803         Instead we'll write a specific test for this functionality and
804         run it on a separate bot.
805
806         * WebCore.xcodeproj/project.pbxproj: Add GPUClient files.
807
808         * page/Chrome.cpp: Drive by clean-up.
809         (WebCore::Chrome::windowScreenDidChange):
810
811         * platform/graphics/GraphicsContext3D.h: We need to keep track of
812         whether we've muxed for this context, in order to not respond to
813         the screen change notifications (they are misleading in the case
814         of muxing).
815
816         * platform/graphics/GraphicsContext3DManager.cpp: Rather than try
817         to mux directly, call into GPUClient.
818         (WebCore::GraphicsContext3DManager::displayWasReconfigured):
819         (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
820         (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired):
821         (WebCore::GraphicsContext3DManager::recycleContextIfNecessary):
822         * platform/graphics/GraphicsContext3DManager.h:
823
824         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm: Only reconfigure
825         the virtual display if it didn't happen from muxing.
826         (WebCore::GraphicsContext3D::GraphicsContext3D):
827         (WebCore::GraphicsContext3D::updateCGLContext):
828         (WebCore::GraphicsContext3D::screenDidChange):
829
830         * platform/graphics/mac/SwitchingGPUClient.cpp: Added.
831         (WebCore::SwitchingGPUClient::singleton):
832         (WebCore::SwitchingGPUClient::setSingleton):
833         * platform/graphics/mac/SwitchingGPUClient.h: Added.
834
835         * testing/Internals.cpp: Testing helper.
836         (WebCore::Internals::hasMuxableGPU):
837         * testing/Internals.h:
838         * testing/Internals.idl:
839
840 2018-10-02  Chris Dumez  <cdumez@apple.com>
841
842         Image.__proto__ should be Function.prototype, not HTMLElement.prototype
843         https://bugs.webkit.org/show_bug.cgi?id=190216
844
845         Reviewed by Alex Christensen.
846
847         Properties created for named constructors should always use Function.prototype as prototype, as per:
848         - https://heycam.github.io/webidl/#named-constructors
849
850         Gecko and Blink agree with the Web IDL specification. However, WebKit was using the parent interface's
851         prototype if such a parent existing. So Image.__proto__ would end up being HTMLElement.prototype
852         instead of Function.prototype.
853
854         No new tests, rebaselined existing test.
855
856         * bindings/scripts/CodeGeneratorJS.pm:
857         (GenerateConstructorHelperMethods):
858
859 2018-10-02  Alex Christensen  <achristensen@webkit.org>
860
861         Prepare WebCoreNSURLExtras for ARC
862         https://bugs.webkit.org/show_bug.cgi?id=190219
863
864         Reviewed by Tim Horton.
865
866         ARC doesn't like the explicit sending of -release.
867         Use RetainPtr instead.
868
869         * platform/mac/WebCoreNSURLExtras.mm:
870         (WebCore::collectRangesThatNeedMapping):
871         (WebCore::collectRangesThatNeedEncoding):
872         (WebCore::collectRangesThatNeedDecoding):
873         (WebCore::applyHostNameFunctionToMailToURLString):
874         (WebCore::applyHostNameFunctionToURLString):
875         (WebCore::mapHostNames):
876         (WebCore::stringByTrimmingWhitespace):
877         (WebCore::URLWithUserTypedString):
878         (WebCore::userVisibleString):
879         (WebCore::rangeOfURLScheme):
880         (WebCore::looksLikeAbsoluteURL):
881         (WebCore::retain): Deleted.
882
883 2018-10-02  Basuke Suzuki  <Basuke.Suzuki@sony.com>
884
885         [Curl] Fix missing values of  resource timing API.
886         https://bugs.webkit.org/show_bug.cgi?id=190193
887
888         Reviewed by Alex Christensen.
889
890         The property nextHopProtocol was not returned correctly. It was
891         returned only when remote inspector is opened.
892
893         Tests: http/wpt/resource-timing/rt-nextHopProtocol.html
894                http/wpt/resource-timing/rt-nextHopProtocol.worker.html
895
896         * platform/network/curl/CurlContext.cpp:
897         (WebCore::CurlHandle::getNetworkLoadMetrics):
898         (WebCore::CurlHandle::addExtraNetworkLoadMetrics):
899
900 2018-10-02  Alex Christensen  <achristensen@webkit.org>
901
902         Remove unused linked-on-or-before-iOS5 check
903         https://bugs.webkit.org/show_bug.cgi?id=190164
904
905         Reviewed by Michael Saboff.
906
907         If an app hasn't been updated since iOS5, it can't run supported iOS.
908         This value is also only checked in an uninstantiated template function.
909
910         * platform/URL.cpp:
911         (WebCore::enableURLSchemeCanonicalization): Deleted.
912         (WebCore::equal): Deleted.
913         * platform/URL.h:
914
915 2018-10-02  Alex Christensen  <achristensen@webkit.org>
916
917         Remove ParsedURLString
918         https://bugs.webkit.org/show_bug.cgi?id=190154
919
920         Reviewed by Chris Dumez.
921
922         Before the introduction of URLParser, it would indicate that we should assume the String
923         is from a valid URL so we can skip canonicalization and just find the offsets inside the String
924         to quickly create a URL.  It was a performance optimization that caused security issues when
925         misused.  Since the introduction of URLParser, we have a fast path for all URL parsing, so
926         right now it actually doesn't change any behavior.  It's just a relic of the past that complicates
927         the URL class, making it harder to express which constructor to use and making it harder to move
928         the class.
929
930         * Modules/navigatorcontentutils/NavigatorContentUtils.cpp:
931         (WebCore::NavigatorContentUtils::registerProtocolHandler):
932         (WebCore::NavigatorContentUtils::isProtocolHandlerRegistered):
933         (WebCore::NavigatorContentUtils::unregisterProtocolHandler):
934         * dom/Document.cpp:
935         (WebCore::Document::updateBaseURL):
936         (WebCore::Document::initSecurityContext):
937         * dom/ExtensionStyleSheets.cpp:
938         (WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache const):
939         * dom/ProcessingInstruction.cpp:
940         (WebCore::ProcessingInstruction::checkStyleSheet):
941         * editing/markup.cpp:
942         (WebCore::completeURLs):
943         * fileapi/BlobURL.cpp:
944         (WebCore::BlobURL::createBlobURL):
945         * history/HistoryItem.cpp:
946         (WebCore::HistoryItem::url const):
947         (WebCore::HistoryItem::originalURL const):
948         * html/HTMLFrameElementBase.cpp:
949         (WebCore::HTMLFrameElementBase::location const):
950         * html/HTMLMediaElement.cpp:
951         (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
952         * html/PublicURLManager.cpp:
953         (WebCore::PublicURLManager::stop):
954         * inspector/InspectorStyleSheet.cpp:
955         (WebCore::InspectorStyleSheet::resourceStyleSheetText const):
956         * inspector/agents/InspectorPageAgent.cpp:
957         (WebCore::InspectorPageAgent::getCookies):
958         (WebCore::InspectorPageAgent::deleteCookie):
959         (WebCore::InspectorPageAgent::getResourceContent):
960         (WebCore::InspectorPageAgent::searchInResource):
961         * inspector/agents/page/PageDebuggerAgent.cpp:
962         (WebCore::PageDebuggerAgent::sourceMapURLForScript):
963         * loader/DocumentLoader.cpp:
964         (WebCore::DocumentLoader::subresources const):
965         * loader/FrameLoader.cpp:
966         (WebCore::FrameLoader::init):
967         (WebCore::FrameLoader::initForSynthesizedDocument):
968         * loader/HistoryController.cpp:
969         (WebCore::HistoryController::pushState):
970         (WebCore::HistoryController::replaceState):
971         * loader/appcache/ApplicationCache.cpp:
972         (WebCore::ApplicationCache::addResource):
973         (WebCore::ApplicationCache::resourceForURL):
974         * loader/appcache/ApplicationCacheGroup.cpp:
975         (WebCore::ApplicationCacheGroup::startLoadingEntry):
976         (WebCore::ApplicationCacheGroup::addEntry):
977         * loader/appcache/ApplicationCacheStorage.cpp:
978         (WebCore::ApplicationCacheStorage::cacheGroupForURL):
979         (WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL):
980         (WebCore::ApplicationCacheStorage::loadCache):
981         (WebCore::ApplicationCacheStorage::manifestURLs):
982         * loader/archive/cf/LegacyWebArchive.cpp:
983         (WebCore::LegacyWebArchive::create):
984         * page/DOMWindow.cpp:
985         (WebCore::DOMWindow::createWindow):
986         * page/PageSerializer.cpp:
987         (WebCore::PageSerializer::urlForBlankFrame):
988         * platform/URL.cpp:
989         (WebCore::blankURL):
990         * platform/URL.h:
991         (): Deleted.
992         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
993         (WebCore::MediaPlayerPrivateAVFoundation::load):
994         * platform/network/BlobRegistryImpl.cpp:
995         (WebCore::BlobRegistryImpl::populateBlobsForFileWriting):
996         * platform/network/ResourceRequestBase.h:
997         (WebCore::ResourceRequestBase::decodeBase):
998         * platform/network/ResourceResponseBase.cpp:
999         (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
1000         * platform/network/cf/DNSResolveQueueCFNet.cpp:
1001         (WebCore::DNSResolveQueueCFNet::updateIsUsingProxy):
1002         * platform/network/cf/ResourceRequest.h:
1003         (WebCore::ResourceRequest::ResourceRequest):
1004         * platform/network/curl/CookieJarDB.cpp:
1005         (WebCore::CookieJarDB::searchCookies):
1006         (WebCore::CookieJarDB::setCookie):
1007         (WebCore::CookieJarDB::deleteCookie):
1008         * platform/network/curl/ResourceRequest.h:
1009         (WebCore::ResourceRequest::ResourceRequest):
1010         * platform/network/soup/ResourceRequest.h:
1011         (WebCore::ResourceRequest::ResourceRequest):
1012         * xml/XSLTProcessorLibxslt.cpp:
1013         (WebCore::docLoaderFunc):
1014
1015 2018-10-02  Per Arne Vollan  <pvollan@apple.com>
1016
1017         [WebVTT] Cue with line setting is not rendered correctly
1018         https://bugs.webkit.org/show_bug.cgi?id=190168
1019
1020         Reviewed by Eric Carlson.
1021
1022         When the line setting contains an optional alignment value, the cue is not rendered at the correct position,
1023         see https://w3c.github.io/webvtt/#webvtt-line-cue-setting. This patch does not implement correct handling of
1024         the line setting alignment values, it only makes sure parsing does not fail when the cue has line alignment
1025         settings.
1026
1027         Test: media/track/track-cue-line-position.html
1028
1029         * html/track/VTTCue.cpp:
1030         (WebCore::VTTCueBox::applyCSSProperties):
1031         (WebCore::VTTCue::getPositionCoordinates const):
1032         (WebCore::VTTCue::setCueSettings):
1033
1034 2018-10-02  Antti Koivisto  <antti@apple.com>
1035
1036         User installed fonts are not always disabled when they should be
1037         https://bugs.webkit.org/show_bug.cgi?id=190195
1038
1039         Reviewed by Geoffrey Garen.
1040
1041         SVG images and some theme cases fail to respect the setting. Besides the obvious problem this
1042         is also a performance issue as various font caches include this setting in the key.
1043
1044         * platform/graphics/FontDescription.cpp:
1045         (WebCore::m_shouldAllowUserInstalledFonts):
1046
1047         Initialize to 'No' by default. All paths where user fonts make sense already set the bit from
1048         settings. This fixes some cases in system themes that construct FontDescriptions from scratch.
1049
1050         * rendering/RenderElement.cpp:
1051         (WebCore::RenderElement::styleWillChange):
1052
1053         Add assertion. This verified the change with the existing tests.
1054
1055         * svg/graphics/SVGImage.cpp:
1056         (WebCore::SVGImage::dataChanged):
1057
1058         Always disallow user fonts in SVG used as images.
1059
1060 2018-10-01  Dean Jackson  <dino@apple.com>
1061
1062         Remove CSS Animation Triggers
1063         https://bugs.webkit.org/show_bug.cgi?id=190175
1064         <rdar://problem/44925626>
1065
1066         Reviewed by Simon Fraser.
1067
1068         Remove the never-properly specified CSS Animation Triggers.
1069
1070         * Configurations/FeatureDefines.xcconfig:
1071         * Sources.txt:
1072         * WebCore.xcodeproj/project.pbxproj:
1073         * css/CSSAnimationTriggerScrollValue.cpp: Removed.
1074         * css/CSSAnimationTriggerScrollValue.h: Removed.
1075         * css/CSSComputedStyleDeclaration.cpp:
1076         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
1077         (WebCore::createAnimationTriggerValue): Deleted.
1078         (WebCore::animationTriggerValue): Deleted.
1079         * css/CSSProperties.json:
1080         * css/CSSToStyleMap.cpp:
1081         (WebCore::CSSToStyleMap::mapAnimationTrigger): Deleted.
1082         * css/CSSToStyleMap.h:
1083         * css/CSSValue.cpp:
1084         (WebCore::CSSValue::equals const):
1085         (WebCore::CSSValue::cssText const):
1086         (WebCore::CSSValue::destroy):
1087         * css/CSSValue.h:
1088         (WebCore::CSSValue::isAnimationTriggerScrollValue const): Deleted.
1089         * css/parser/CSSPropertyParser.cpp:
1090         (WebCore::consumeAnimationValue):
1091         (WebCore::CSSPropertyParser::parseSingleValue):
1092         (WebCore::consumeWebkitAnimationTrigger): Deleted.
1093         * page/FrameView.cpp:
1094         (WebCore::FrameView::sendScrollEvent):
1095         * page/RuntimeEnabledFeatures.h:
1096         (WebCore::RuntimeEnabledFeatures::setAnimationTriggersEnabled): Deleted.
1097         (WebCore::RuntimeEnabledFeatures::animationTriggersEnabled const): Deleted.
1098         * page/animation/AnimationBase.cpp:
1099         (WebCore::AnimationBase::updateStateMachine):
1100         (WebCore::AnimationBase::fireAnimationEventsIfNeeded):
1101         (WebCore::AnimationBase::timeToNextService):
1102         (WebCore::AnimationBase::getElapsedTime const):
1103         * page/animation/CSSAnimationController.cpp:
1104         (WebCore::CSSAnimationControllerPrivate::animationWillBeRemoved):
1105         (WebCore::CSSAnimationControllerPrivate::addToAnimationsDependentOnScroll): Deleted.
1106         (WebCore::CSSAnimationControllerPrivate::removeFromAnimationsDependentOnScroll): Deleted.
1107         (WebCore::CSSAnimationControllerPrivate::scrollWasUpdated): Deleted.
1108         (WebCore::CSSAnimationController::wantsScrollUpdates const): Deleted.
1109         (WebCore::CSSAnimationController::scrollWasUpdated): Deleted.
1110         * page/animation/CSSAnimationController.h:
1111         * page/animation/CSSAnimationControllerPrivate.h:
1112         (WebCore::CSSAnimationControllerPrivate::wantsScrollUpdates const): Deleted.
1113         (WebCore::CSSAnimationControllerPrivate::scrollPosition const): Deleted.
1114         * page/animation/CompositeAnimation.cpp:
1115         (WebCore::CompositeAnimation::updateKeyframeAnimations):
1116         * page/animation/CompositeAnimation.h:
1117         (WebCore::CompositeAnimation::hasScrollTriggeredAnimation const): Deleted.
1118         * platform/animation/Animation.cpp:
1119         (WebCore::Animation::Animation):
1120         (WebCore::Animation::operator=):
1121         (WebCore::Animation::animationsMatch const):
1122         * platform/animation/Animation.h:
1123         (WebCore::Animation::isTimingFunctionSet const):
1124         (WebCore::Animation::isEmpty const):
1125         (WebCore::Animation::clearTimingFunction):
1126         (WebCore::Animation::clearAll):
1127         (WebCore::Animation::animationMode const):
1128         (WebCore::Animation::setAnimationMode):
1129         (WebCore::Animation::initialTimingFunction):
1130         (WebCore::Animation::isTriggerSet const): Deleted.
1131         (WebCore::Animation::clearTrigger): Deleted.
1132         (WebCore::Animation::trigger const): Deleted.
1133         (WebCore::Animation::setTrigger): Deleted.
1134         (WebCore::Animation::initialTrigger): Deleted.
1135         * platform/animation/AnimationTrigger.h: Removed.
1136         * platform/graphics/ca/GraphicsLayerCA.cpp:
1137         (WebCore::GraphicsLayerCA::animationCanBeAccelerated const):
1138 2018-10-02  Commit Queue  <commit-queue@webkit.org>
1139
1140         Unreviewed, rolling out r236624 and r236671.
1141         https://bugs.webkit.org/show_bug.cgi?id=190207
1142
1143         The change in r236624 introduced crashes on the bots
1144         (Requested by ryanhaddad on #webkit).
1145
1146         Reverted changesets:
1147
1148         "Refactoring: eliminate raw pointer usage in Fullscreen code"
1149         https://bugs.webkit.org/show_bug.cgi?id=188747
1150         https://trac.webkit.org/changeset/236624
1151
1152         "Unify implementation in VideoFullscreenInterfaceAVKit"
1153         https://bugs.webkit.org/show_bug.cgi?id=190091
1154         https://trac.webkit.org/changeset/236671
1155
1156 2018-10-02  Sihui Liu  <sihui_liu@apple.com>
1157
1158         Add release assertion to ensure m_owningPointerForClose is null in UniqueIDBDatabase::invokeOperationAndTransactionTimer()
1159         https://bugs.webkit.org/show_bug.cgi?id=190178
1160
1161         Reviewed by Chris Dumez.
1162
1163         This would help debug rdar://problem/44902833.
1164
1165         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1166         (WebCore::IDBServer::UniqueIDBDatabase::invokeOperationAndTransactionTimer):
1167
1168 2018-10-02  Commit Queue  <commit-queue@webkit.org>
1169
1170         Unreviewed, rolling out r236719.
1171         https://bugs.webkit.org/show_bug.cgi?id=190197
1172
1173         this revision caused 39 layout test failures that tested for
1174         scrolling, a bug was also not present in the commit or change
1175         log. (Requested by Truitt on #webkit).
1176
1177         Reverted changeset:
1178
1179         "Unreviewed, fix unused variable in
1180         RenderLayer::updateScrollableAreaSet"
1181         https://trac.webkit.org/changeset/236719
1182
1183 2018-10-02  Alicia Boya García  <aboya@igalia.com>
1184
1185         [MSE][GStreamer] Add h264parse to accept MP4 without stss
1186         https://bugs.webkit.org/show_bug.cgi?id=190143
1187
1188         Reviewed by Xabier Rodriguez-Calvar.
1189
1190         The MP4 file used in this URL does not contain a stss (Sync Sample
1191         Box). In consequence, in acordance with the ISO BMFF spec, all samples
1192         are assumed to be sync frames... But in this case that is not true,
1193         it's just that the file is wrong (e.g. created with a buggy muxer).
1194
1195         http://orange-opensource.github.io/hasplayer.js/1.2.0/player.html?url=http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism/Manifest
1196
1197         The way it works in other browsers is because instead of trusting the
1198         MP4 stss table, they rely on parsing the h264 frames. We can do that
1199         too.
1200
1201         This patch also changes RELEASE_ASSERT() when creating the parsers
1202         to GLib criticals.
1203
1204         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1205         (WebCore::createOptionalParserForFormat):
1206
1207 2018-10-02  Eric Carlson  <eric.carlson@apple.com>
1208
1209         [MediaStream] RealtimeMediaSource should be able to vend hashed IDs
1210         https://bugs.webkit.org/show_bug.cgi?id=190142
1211         <rdar://problem/44911109>
1212
1213         Reviewed by Youenn Fablet.
1214
1215         No new tests, covered by existing tests.
1216
1217         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
1218         (WebCore::CanvasCaptureMediaStreamTrack::Source::Source): Update order of parameters passed
1219         to base class.
1220
1221         * Modules/mediastream/MediaDevicesRequest.cpp:
1222         (WebCore::MediaDevicesRequest::start): ASSERT if document.deviceIDHashSalt is not the same
1223         as passed salt.
1224
1225         * Modules/mediastream/MediaStreamTrack.cpp:
1226         (WebCore::MediaStreamTrack::getSettings const): Don't need to hash ID.
1227         (WebCore::MediaStreamTrack::getCapabilities const): Ditto.
1228         * Modules/mediastream/MediaStreamTrack.h:
1229         * Modules/mediastream/MediaStreamTrack.idl:
1230
1231         * Modules/mediastream/UserMediaRequest.cpp:
1232         (WebCore::UserMediaRequest::allow): Pass hash salt to createMediaStream.
1233
1234         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1235         (WebCore::LibWebRTCPeerConnectionBackend::createReceiverForSource): Update order of parameters passed
1236         to base class.
1237
1238         * Modules/webaudio/MediaStreamAudioSource.cpp:
1239         (WebCore::MediaStreamAudioSource::MediaStreamAudioSource): Ditto.
1240         * platform/mediastream/MediaConstraints.h:
1241
1242         * platform/mediastream/RealtimeIncomingAudioSource.cpp:
1243         (WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource): Ditto.
1244
1245         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
1246         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource): Ditto.
1247
1248         * platform/mediastream/RealtimeMediaSource.cpp:
1249         (WebCore::RealtimeMediaSource::RealtimeMediaSource): Calculate hashed ID.
1250         (WebCore::RealtimeMediaSource::selectSettings): Use m_hashedID.
1251         (WebCore::RealtimeMediaSource::hashedId const): New.
1252         (WebCore::RealtimeMediaSource::deviceIDHashSalt const): New.
1253         * platform/mediastream/RealtimeMediaSource.h:
1254
1255         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1256         (WebCore::RealtimeMediaSourceCenter::createMediaStream): Take hash salt, pass it when creating
1257         a source.
1258         (WebCore::RealtimeMediaSourceCenter::getUserMediaDevices): Ditto.
1259         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Ditto.
1260         * platform/mediastream/RealtimeMediaSourceCenter.h:
1261
1262         * platform/mediastream/RealtimeMediaSourceFactory.h:
1263         * platform/mediastream/RealtimeVideoSource.cpp:
1264         (WebCore::RealtimeVideoSource::RealtimeVideoSource): Update parameters.
1265         * platform/mediastream/RealtimeVideoSource.h:
1266
1267         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
1268         (WebCore::GStreamerAudioCaptureSource::create): Ditto.
1269         (WebCore::GStreamerAudioCaptureSource::GStreamerAudioCaptureSource): Ditto.
1270         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h:
1271
1272         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
1273         (WebCore::GStreamerVideoCaptureSource::create): Ditto.
1274         (WebCore::GStreamerVideoCaptureSource::GStreamerVideoCaptureSource): Ditto.
1275         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h:
1276
1277         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
1278         (WebCore::WrappedMockRealtimeAudioSource::WrappedMockRealtimeAudioSource): Ditto.
1279         (WebCore::MockRealtimeAudioSource::create): Ditto.
1280         (WebCore::MockGStreamerAudioCaptureSource::MockGStreamerAudioCaptureSource): Ditto.
1281         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h:
1282
1283         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp:
1284         (WebCore::MockRealtimeVideoSource::create): Ditto.
1285         (WebCore::MockGStreamerVideoCaptureSource::MockGStreamerVideoCaptureSource): Ditto.
1286         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h:
1287
1288         * platform/mediastream/mac/AVVideoCaptureSource.h:
1289         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1290         (WebCore::AVVideoCaptureSource::create): Ditto.
1291         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource): Ditto.
1292         (WebCore::AVVideoCaptureSource::settings): Use hashedId to set device ID.
1293         (WebCore::AVVideoCaptureSource::capabilities): Ditto.
1294
1295         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1296         (WebCore::CoreAudioCaptureSource::create): Update parameters.
1297         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource): Ditto.
1298         (WebCore::CoreAudioCaptureSource::capabilities): Use hashedId to set device ID.
1299         (WebCore::CoreAudioCaptureSource::settings): Ditto.
1300         * platform/mediastream/mac/CoreAudioCaptureSource.h:
1301
1302         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
1303         (WebCore::DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa): Update parameters.
1304         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
1305
1306         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
1307         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
1308         (WebCore::MockRealtimeAudioSource::create): Ditto.
1309         (WebCore::MockRealtimeAudioSourceMac::MockRealtimeAudioSourceMac): Ditto.
1310
1311         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
1312         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1313         (WebCore::MockRealtimeVideoSource::create): Ditto.
1314         (WebCore::MockRealtimeVideoSourceMac::MockRealtimeVideoSourceMac): Ditto.
1315
1316         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1317
1318         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
1319         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
1320         (WebCore::ScreenDisplayCaptureSourceMac::create): Ditto.
1321         (WebCore::ScreenDisplayCaptureSourceMac::ScreenDisplayCaptureSourceMac): Ditto.
1322         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Update logging.
1323         (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream): Ditto.
1324         (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable): Ditto.
1325
1326         * platform/mediastream/mac/WindowDisplayCaptureSourceMac.h:
1327         * platform/mediastream/mac/WindowDisplayCaptureSourceMac.mm:
1328         (WebCore::WindowDisplayCaptureSourceMac::create): Update parameters.
1329
1330         * platform/mock/MockRealtimeAudioSource.cpp:
1331         (WebCore::MockRealtimeAudioSource::create): Ditto.
1332         (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource): Ditto.
1333         (WebCore::MockRealtimeAudioSource::settings): Use hashedId to set device ID.
1334         (WebCore::MockRealtimeAudioSource::capabilities): Ditto.
1335         * platform/mock/MockRealtimeAudioSource.h:
1336
1337         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1338
1339         * platform/mock/MockRealtimeVideoSource.cpp:
1340         (WebCore::MockRealtimeVideoSource::create): Update parameters.
1341         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Ditto.
1342         (WebCore::MockRealtimeVideoSource::capabilities): Use hashedId to set device ID.
1343         (WebCore::MockRealtimeVideoSource::settings): Ditto.
1344         * platform/mock/MockRealtimeVideoSource.h:
1345
1346 2018-10-02  Philippe Normand  <pnormand@igalia.com>
1347
1348         [GStreamer][playbin3] Stream tag lists leaks
1349         https://bugs.webkit.org/show_bug.cgi?id=190192
1350
1351         Reviewed by Xabier Rodriguez-Calvar.
1352
1353         The gst_stream_get_tags() result is transfer-full, so needs to be adopted to prevent a leak.
1354         Also check the tags list pointer which might be NULL in some cases.
1355
1356         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
1357         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
1358         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1359         (WebCore::MediaPlayerPrivateGStreamer::naturalSize const):
1360         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
1361         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
1362
1363 2018-10-01  Michael Catanzaro  <mcatanzaro@igalia.com>
1364
1365         Unreviewed, fix unused variable in RenderLayer::updateScrollableAreaSet
1366
1367         * rendering/RenderLayer.cpp:
1368         (WebCore::RenderLayer::calculateClipRects const): This is a prepare-ChangeLog bug. I don't
1369         have any changes in this function....
1370
1371 2018-10-02  Alicia Boya García  <aboya@igalia.com>
1372
1373         [MSE][GStreamer] Make same thread assert non-release
1374         https://bugs.webkit.org/show_bug.cgi?id=189924
1375
1376         Reviewed by Xabier Rodriguez-Calvar.
1377
1378         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1379         (WebCore::AppendPipeline::handleNewAppsinkSample):
1380
1381 2018-10-01  Ryosuke Niwa  <rniwa@webkit.org>
1382
1383         Add a new variant of serializePreservingVisualAppearance which takes VisibleSelection
1384         https://bugs.webkit.org/show_bug.cgi?id=190108
1385
1386         Reviewed by Wenson Hsieh.
1387
1388         Added a version of serializePreservingVisualAppearance which takes VisibleSelection so that we can avoid creating
1389         a range simply to get the first node and the end node of the selection later. This simple change also fixes a bug
1390         demonstrated in editing/pasteboard/paste-table-003.html.
1391
1392         Test: editing/pasteboard/paste-table-003.html
1393
1394         * editing/cocoa/EditorCocoa.mm:
1395         (WebCore::Editor::selectionInHTMLFormat): Adopt the new variant.
1396         * editing/gtk/EditorGtk.cpp:
1397         (WebCore::Editor::writeSelectionToPasteboard): Ditto.
1398         * editing/markup.cpp:
1399         (WebCore::serializePreservingVisualAppearance): Added.
1400         * editing/markup.h:
1401         * editing/wpe/EditorWPE.cpp:
1402         (WebCore::Editor::writeSelectionToPasteboard): Ditto.
1403         * loader/archive/cf/LegacyWebArchive.cpp:
1404         (WebCore::LegacyWebArchive::createFromSelection): Ditto.
1405         * platform/win/PasteboardWin.cpp:
1406         (WebCore::Pasteboard::writeSelection): Ditto.
1407
1408 2018-10-01  Alex Christensen  <achristensen@webkit.org>
1409
1410         Don't read from WebCore's bundle for IDNScriptWhiteList
1411         https://bugs.webkit.org/show_bug.cgi?id=190157
1412
1413         Reviewed by Dan Bernstein.
1414
1415         No change in behavior.  This increases performance by not reading from the WebCore bundle,
1416         and it makes it so that URL-related functionality can be moved to a place without
1417         a bundle for resources.
1418
1419         * Resources/IDNScriptWhiteList.txt: Removed.
1420         * WebCore.xcodeproj/project.pbxproj:
1421         * platform/mac/WebCoreNSURLExtras.mm:
1422         (WebCore::whiteListIDNScripts):
1423         (WebCore::allCharactersInIDNScriptWhiteList):
1424         (WebCore::readIDNScriptWhiteListFile): Deleted.
1425
1426 2018-10-01  Alex Christensen  <achristensen@webkit.org>
1427
1428         Unreviewed, rolling out r236551.
1429
1430         Fails URL validating too aggressively
1431
1432         Reverted changeset:
1433
1434         "URLWithUserTypedString should return nil for URLs deemed to
1435         be invalid by WebCore::URL"
1436         https://bugs.webkit.org/show_bug.cgi?id=189979
1437         https://trac.webkit.org/changeset/236551
1438
1439 2018-10-01  Keith Miller  <keith_miller@apple.com>
1440
1441         Create a RELEASE_AND_RETURN macro for ExceptionScopes
1442         https://bugs.webkit.org/show_bug.cgi?id=190163
1443
1444         Reviewed by Mark Lam.
1445
1446         The new RELEASE_AND_RETURN does all the work for cases
1447         where you want to return the result of some expression
1448         without explicitly checking for an exception. This is
1449         much like the existing RETURN_IF_EXCEPTION macro.
1450
1451         No new tests since this is a refactor.
1452
1453         * bridge/runtime_array.cpp:
1454         (JSC::RuntimeArray::put):
1455
1456 2018-10-01  Daniel Bates  <dabates@apple.com>
1457
1458         Attempt to fix the watchOS build after <https://trac.webkit.org/changeset/236678>
1459         (https://bugs.webkit.org/show_bug.cgi?id=189974)
1460
1461         Explicitly cast index to unsigned to make the operator[] call unambiguous.
1462
1463         * platform/ios/KeyEventIOS.mm:
1464         (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent):
1465
1466 2018-10-01  Ryosuke Niwa  <rniwa@webkit.org>
1467
1468         ASAN failure in ~GCReachableRef()
1469         https://bugs.webkit.org/show_bug.cgi?id=190113
1470
1471         Reviewed by Darin Adler.
1472
1473         The bug was caused by ~GCReachableRef accessing Ref after it had been poisoned for ASAN
1474         in Ref::leakRef via Ref(Ref&& other). Fixed the bug by using RefPtr instead since that's
1475         the simplest solution here although we could unpoison Ref temporarily as done in ~Ref.
1476
1477         * dom/GCReachableRef.h:
1478         (WebCore::GCReachableRef::GCReachableRef):
1479         (WebCore::GCReachableRef::~GCReachableRef):
1480         (WebCore::GCReachableRef::operator-> const):
1481         (WebCore::GCReachableRef::get const):
1482         (WebCore::GCReachableRef::operator T& const):
1483         (WebCore::GCReachableRef::operator! const):
1484         (WebCore::GCReachableRef::isNull const): Deleted.
1485
1486 2018-10-01  Sihui Liu  <sihui_liu@apple.com>
1487
1488         Remove StorageProcess
1489         https://bugs.webkit.org/show_bug.cgi?id=189975
1490
1491         Reviewed by Geoffrey Garen.
1492
1493         Clean up code. No behavior change.
1494
1495         * English.lproj/Localizable.strings:
1496
1497 2018-10-01  Alicia Boya García  <aboya@igalia.com>
1498
1499         [MSE][GStreamer] Set a minimum sample duration
1500         https://bugs.webkit.org/show_bug.cgi?id=190125
1501
1502         Reviewed by Xabier Rodriguez-Calvar.
1503
1504         The last sample of the audio track in the asset used in this test
1505         player has a tiny duration (100 ns):
1506
1507         http://orange-opensource.github.io/hasplayer.js/1.2.0/player.html?url=http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism/Manifest
1508
1509         So small, we were truncating it to zero. We're not supposed to have
1510         frames with zero duration. Instead, lets set a minimum frame duration
1511         for those fringe cases.
1512
1513         * platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
1514         (WebCore::MediaSampleGStreamer::MediaSampleGStreamer):
1515
1516 2018-10-01  Daniel Bates  <dabates@apple.com>
1517
1518         [iOS] Special keys are misidentified in DOM keyboard events
1519         https://bugs.webkit.org/show_bug.cgi?id=189974
1520
1521         Reviewed by Wenson Hsieh.
1522
1523         This patch fixes two issues:
1524             1. Special keyboard keys would be misidentified in dispatched DOM keyboard events.
1525             2. DOM keypress events may not be dispatched for some special keys.
1526
1527         UIKit uses special input strings to identify the Page Up, Page Down, Escape, Up Arrow, Down Arrow,
1528         Left Arrow, and Right Arrow keys. It also uses ASCII control characters to represent some other
1529         special keys, including Num Lock / Clear, Home, End, Forward Delete, and F1, ..., F24. We need
1530         to explicitly handle these special keyboard keys in order to be able to identify the key that
1531         was pressed as well as to correctly disambiguate a key down to know whether to dispatch a DOM
1532         keypress event for the key.
1533
1534         Unlike UIKit, AppKit reserves Unicode Private Use Area (PUA) code points in 0xF700–0xF8FF to
1535         represent special keyboard keys. This makes it straightforward to disambiguate such keys using
1536         the input string of the keyboard event alone. To simplify the implementation for iOS
1537         we normalize the input string be AppKit compatible. See the explaination for WebCore::windowsKeyCodeForCharCode()
1538         below for more details on why this is done.
1539
1540         Tests: fast/events/ios/keydown-keyup-arrow-keys-in-non-editable-element.html
1541                fast/events/ios/keypress-keys-in-non-editable-element.html
1542
1543         * SourcesCocoa.txt:
1544         * WebCore.xcodeproj/project.pbxproj:
1545         Do not use unified source build strategy when building WebEvent.mm as it makes
1546         use of SoftLinking macros that are incompatible with this strategy.
1547
1548         * platform/ios/KeyEventIOS.mm:
1549         (WebCore::windowsKeyCodeForCharCode): Recognize some special AppKit special char codes.
1550         These special char codes are generated by WebKit. WebKit uses the same special char codes
1551         as AppKit as a convenience instead of defining our own constants for the same purpose.
1552         Encoding the special UIKit input strings (e.g. up arrow) as distinct char codes allows us
1553         to use integer arithmetic and switch blocks to map characters to Windows virtual key
1554         codes as opposed to special cased branches to perform pointer or string comparisions.
1555         The latter would be necessary in Modern WebKit in order for key down events to be properly
1556         disambiguated to dispatch a DOM keypress event because pointers are not perserved, though
1557         what they point to is, when sending the WebEvent from UIProcess to the WebProcess and
1558         vice versa.
1559         (WebCore::isFunctionKey): Convenience function that determines whether the specified char
1560         code corresponds to a function key on the keyboard. The term "function key" is taken from
1561         AppKit parlance to describe a special keyboard key. These keys include F1, F2, ..., F24,
1562         and cursor keys among other special keyboard keys.
1563         (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent): Write in terms of isFunctionKey().
1564         * platform/ios/PlatformEventFactoryIOS.h:
1565         * platform/ios/PlatformEventFactoryIOS.mm:
1566         (WebCore::keyIdentifierForKeyEvent): Remove code to handle UIKit special input strings as
1567         we now map such special input strings to char codes and hence can use the default code path.
1568         (WebCore::keyForKeyEvent): Ditto.
1569         (WebCore::codeForKeyEvent): Remove code to compute the Window virtual key code corresponding
1570         to a UIKit special key command now that we map such special input strings to char codes and
1571         subsequently map the char codes to the Windows virtual key code (see -[WebEvent initWithKeyEventType:...]
1572         constructors). So, we can now use WebEvent.keyCode directly to compute the DOM UIEvents code
1573         for the event.
1574         (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): Remove code to fix up
1575         WebEvent.keyCode to account for UIKit special input strings now that we map such special key
1576         commands to char codes and subsequently map the char codes to the Windows virtual key code (see -[WebEvent initWithKeyEventType:...]
1577         constructors). So, we can now take WebEvent.keyCode verbatim to be the Window virtual key code.
1578         (WebCore::convertSpecialKeyToCharCode): Deleted.
1579         (WebCore::keyCodeForEvent): Deleted.
1580         * platform/ios/WebEvent.mm:
1581         (normalizedStringWithAppKitCompatibilityMapping): Added; converts a UIKit character string
1582         to the corresponding AppKit-compatible one (if not already compatible). See the explaination
1583         for WebCore::windowsKeyCodeForCharCode() above for more details on why this is done.
1584
1585         (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:keyCode:isTabKey:characterSet:]):
1586         (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:withInputManagerHint:keyCode:isTabKey:]):
1587         Normalize the character strings to be AppKit compatible.
1588
1589 2018-10-01  Simon Fraser  <simon.fraser@apple.com>
1590
1591         Optimize RenderStyle::diff() and clean up the code
1592         https://bugs.webkit.org/show_bug.cgi?id=190104
1593
1594         Reviewed by Dan Bernstein.
1595
1596         RenderStyle::changeRequiresLayout() and related should only check values on 
1597         m_rareNonInheritedData and m_rareInheritedData after checking for pointer equality.
1598         To reduce the chances of future changes regressing this, move code comparing values
1599         on StyleRare[Non]InheritedData into dedication functions.
1600         
1601         In addition, the transform comparison double-compared the transformOperations,
1602         because m_rareNonInheritedData->transform != other.m_rareNonInheritedData->transform
1603         is a deep comparison, and it was followed by *m_rareNonInheritedData->transform != *other.m_rareNonInheritedData->transform.
1604         Change the first to be a pointer comparison.
1605
1606         * rendering/style/RenderStyle.cpp:
1607         (WebCore::rareNonInheritedDataChangeRequiresLayout):
1608         (WebCore::rareInheritedDataChangeRequiresLayout):
1609         (WebCore::RenderStyle::changeRequiresLayout const):
1610         (WebCore::rareNonInheritedDataChangeRequiresLayerRepaint):
1611         (WebCore::RenderStyle::changeRequiresLayerRepaint const):
1612         (WebCore::rareNonInheritedDataChangeRequiresRepaint):
1613         (WebCore::rareInheritedDataChangeRequiresRepaint):
1614         (WebCore::RenderStyle::changeRequiresRepaint const):
1615
1616 2018-10-01  Alex Christensen  <achristensen@webkit.org>
1617
1618         URL should not use TextEncoding internally
1619         https://bugs.webkit.org/show_bug.cgi?id=190111
1620
1621         Reviewed by Andy Estes.
1622
1623         That dependency makes it impossible to move or use elsewhere.
1624         Using TextEncoding was overkill because we know the credentials are UTF-8 percent-encoded in a parsed URL.
1625         No change in behavior as verified by new API tests.
1626
1627         * page/SecurityOrigin.cpp:
1628         * page/csp/ContentSecurityPolicySourceList.cpp:
1629         * platform/URL.cpp:
1630         (WebCore::decodeEscapeSequencesFromParsedURL):
1631         (WebCore::URL::user const):
1632         (WebCore::URL::pass const):
1633         (WebCore::URL::fileSystemPath const):
1634         (WebCore::decodeURLEscapeSequences): Deleted.
1635         * platform/URL.h:
1636         * platform/network/DataURLDecoder.cpp:
1637         * platform/text/TextEncoding.cpp:
1638         (WebCore::decodeURLEscapeSequences):
1639         * platform/text/TextEncoding.h:
1640
1641 2018-10-01  Simon Pieters  <zcorpan@gmail.com>
1642
1643         <form> in quirks mode should have margin-block-end: 1em
1644         https://bugs.webkit.org/show_bug.cgi?id=157788
1645
1646         Reviewed by Simon Fraser.
1647
1648         Change the default style for forms to take writing-mode into account
1649         in quirks mode. Matches the behavior of Gecko and Edge and the HTML
1650         standard.
1651
1652         Spec: https://html.spec.whatwg.org/multipage/rendering.html#flow-content-3
1653
1654         Test: imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/flow-content-0/form-margin-quirk.html
1655
1656         * css/quirks.css:
1657         (form):
1658
1659 2018-10-01  Jeremy Jones  <jeremyj@apple.com>
1660
1661         Unify implementation in VideoFullscreenInterfaceAVKit
1662         https://bugs.webkit.org/show_bug.cgi?id=190091
1663         rdar://problem/44734523
1664
1665         Reviewed by Jer Noble.
1666
1667         No new tests because no behavior change.
1668
1669         Unified code in VideoFullscreenInterfaceAVKit now that new code path is proven and include
1670         any changes that had been made in the old path.
1671
1672         * platform/ios/VideoFullscreenInterfaceAVKit.h:
1673         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1674         (-[WebAVPlayerViewControllerDelegate playerViewControllerShouldStartPictureInPictureFromInlineWhenEnteringBackground:]):
1675         (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen):
1676         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
1677         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1678         (VideoFullscreenControllerContext::requestUpdateInlineRect):
1679         (VideoFullscreenControllerContext::requestVideoContentLayer):
1680         (VideoFullscreenControllerContext::returnVideoContentLayer):
1681         (VideoFullscreenControllerContext::didSetupFullscreen):
1682         (VideoFullscreenControllerContext::didExitFullscreen):
1683
1684 2018-10-01  Antoine Quint  <graouts@apple.com>
1685
1686         [Web Animations] Ensure renderers with accelerated animations have layers
1687         https://bugs.webkit.org/show_bug.cgi?id=189990
1688
1689         Reviewed by Simon Fraser.
1690
1691         In r236501 we added code that would make a RenderBox and a RenderInline query the document timeline for whether a given element has
1692         accelerated animations running on it. Since the calls to requiresLayer() are in a hot path, we instead keep a list of elements with
1693         exclusively accelerated animations running.
1694
1695         No new tests, this is already covered by webanimations/accelerated-animation-with-delay.html and webanimations/opacity-animation-yields-compositing-span.html
1696         which respectively check that we can apply an accelerated animation to a non-positioned block and an inline element.
1697
1698         * animation/AnimationTimeline.h:
1699         * animation/DocumentTimeline.cpp:
1700         (WebCore::DocumentTimeline::detachFromDocument):
1701         (WebCore::DocumentTimeline::animationWasAddedToElement):
1702         (WebCore::DocumentTimeline::animationWasRemovedFromElement):
1703         (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange):
1704         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement): Iterate over an element's animations to determine
1705         whether all of its animations are running accelerated, then update the HashSet containing elements running accelerated animations to remove or
1706         add this element.
1707         (WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated const): Make a simple contains() call on the HashSet containing elements
1708         running accelerated animations.
1709         * animation/DocumentTimeline.h:
1710         * animation/KeyframeEffectReadOnly.cpp:
1711         (WebCore::KeyframeEffectReadOnly::updateAcceleratedAnimationState):
1712         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
1713         * rendering/RenderBoxModelObject.h:
1714
1715 2018-10-01  Alicia Boya García  <aboya@igalia.com>
1716
1717         [GStreamer] Fix abort in gst_sample_get_info()
1718         https://bugs.webkit.org/show_bug.cgi?id=190135
1719
1720         Reviewed by Philippe Normand.
1721
1722         A flush can occur before any frame has finished decoding -- especially
1723         in tests, where actions on the player often occur in quick succession.
1724
1725         Therefore, the code must not assume by the time a flush occurs any
1726         frame has reached the sink. This patch fixes a case when such wrong
1727         assumption was causing gst_sample_get_info() to abort (crashing
1728         WebKit).
1729
1730         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1731         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
1732         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink):
1733
1734 2018-10-01  Olivier Blin  <olivier.blin@softathome.com>
1735
1736         [WPE] fix buffer over-read in RenderThemeWPE::mediaControlsStyleSheet()
1737         https://bugs.webkit.org/show_bug.cgi?id=190139
1738
1739         Reviewed by Michael Catanzaro.
1740
1741         Like done upstream for EFL in r210213
1742         https://bugs.webkit.org/show_bug.cgi?id=166622
1743
1744         This has been detected by a charactersAreAllASCII() assert failure.
1745
1746         This is because ASCIILiteral() is wrongly used in mediaControlsStyleSheet().
1747         mediaControlsBaseUserAgentStyleSheet is a char array, not a null-terminated string.
1748         It is thus incorrect to use StringImpl::createFromLiteral() that calls
1749         strlen() to get the string length.
1750
1751         The String::ConstructFromLiteral constructor can not be used, since it
1752         skips the last character.
1753
1754         * platform/wpe/RenderThemeWPE.cpp:
1755         (WebCore::RenderThemeWPE::mediaControlsStyleSheet):
1756         Explicitely pass the size to the String constructor.
1757
1758 2018-10-01  Rob Buis  <rbuis@igalia.com>
1759
1760         Align XMLHttpRequest's overrideMimeType() with the standard
1761         https://bugs.webkit.org/show_bug.cgi?id=169276
1762
1763         Reviewed by Chris Dumez.
1764
1765         Implement the overrideMimeType() as specified in that standard, i.e.
1766         add a check that the passed mime type is valid and if not fallback
1767         to application/octet-stream.
1768
1769         In order for this patch to have any effect, I went ahead and
1770         made an improvement to the ContentType parsing, parseContentType now
1771         will reject mime types that do not match the type / subtype format, I
1772         believe this is required by both RFC2045 and mimesniff specs.
1773
1774         This behavior matches Chrome and Firefox.
1775
1776         Test: web-platform-tests/xhr/overridemimetype-invalid-mime-type.htm
1777
1778         * platform/network/ParsedContentType.cpp:
1779         (WebCore::parseContentType):
1780         * xml/XMLHttpRequest.cpp:
1781         (WebCore::XMLHttpRequest::overrideMimeType):
1782
1783
1784 2018-10-01  Chris Dumez  <cdumez@apple.com>
1785
1786         Make crossOriginObject.then undefined for promises
1787         https://bugs.webkit.org/show_bug.cgi?id=190094
1788
1789         Reviewed by Darin Adler.
1790
1791         Make crossOriginObject.then undefined for promises. This allows promises to work better with cross-origin WindowProxy
1792         and Location objects.
1793
1794         Specification:
1795         - https://github.com/whatwg/html/pull/3242
1796         - https://github.com/whatwg/dom/issues/536
1797
1798         This aligns our behavior with Blink and Gecko.
1799
1800         No new tests, rebaselined existing test.
1801
1802         * bindings/js/JSDOMWindowCustom.cpp:
1803         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
1804         (WebCore::addCrossOriginWindowOwnPropertyNames):
1805         * bindings/js/JSLocationCustom.cpp:
1806         (WebCore::getOwnPropertySlotCommon):
1807         (WebCore::addCrossOriginLocationOwnPropertyNames):
1808
1809 2018-10-01  Xan Lopez  <xan@igalia.com>
1810
1811         [SOUP] Fix the build for libsoup > 2.61.90
1812         https://bugs.webkit.org/show_bug.cgi?id=190126
1813
1814         Reviewed by Michael Catanzaro.
1815
1816         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
1817
1818 2018-10-01  Alicia Boya García  <aboya@igalia.com>
1819
1820         [MSE][GStreamer] Reset running time in PlaybackPipeline::flush()
1821         https://bugs.webkit.org/show_bug.cgi?id=190076
1822
1823         Reviewed by Philippe Normand.
1824
1825         Test: media/media-source/media-source-seek-redundant-append.html
1826
1827         PlaybackPipeline::flush() is called when already enqueued frames are
1828         appended again. This may be caused by a quality change or just a
1829         redundant append. Either way, the pipeline has to be flushed and
1830         playback begin again, but without changing the player position by
1831         much.
1832
1833         There are two kinds of time to consider here: stream time (i.e. the
1834         time of a frame as written in the file, e.g. a frame may have stream
1835         time 0:01:00), and running time (i.e. how much time since playback
1836         started should pass before the frame should be played, e.g. if we
1837         started playing at 0:00:59 that same frame would have a running time
1838         of just 1 second).
1839
1840         Notice how running time depends on where and when playback starts.
1841         Running time can also be optionally resetted after a flush. (This is
1842         indeed done currently by most demuxers after a seek.)
1843
1844         Instead of resetting running time, PlaybackPipeline used to modify the
1845         first GstSegment emitted after the flush. A GstSegment declares the
1846         mapping between stream time and running time for the following frames.
1847         There, PlaybackPipeline used to set `base` (the running time at which
1848         the segment starts) to the position reported by a position query
1849         (which is stream time).
1850
1851         This, of course, only worked when playback (or the last seek) started
1852         at stream time 0:00:00, since that's the only case where running time
1853         equals stream time. In other cases delays as long as the difference
1854         between these timelines would appear. This is demonstrated in the
1855         attached test, where seeks and appends are made in such an order that
1856         the difference is more than 5 minutes, making the playback stall for
1857         >5 minutes before playing 1 second of audio.
1858
1859         This patch fixes the problem by resetting running time with the flush
1860         and not modifying GstSegment.base anymore (it will be left as zero,
1861         which is now correct since the running time has been reset).
1862
1863         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
1864         (WebCore::PlaybackPipeline::flush):
1865         (WebCore::segmentFixerProbe): Deleted.
1866
1867 2018-09-30  Ryosuke Niwa  <rniwa@webkit.org>
1868
1869         Use Position instead of Range in createMarkupInternal
1870         https://bugs.webkit.org/show_bug.cgi?id=190107
1871
1872         Reviewed by Darin Adler.
1873
1874         Use two Position's indicating start and end instead of Range in createMarkupInternal and StylizedMarkupAccumulator
1875         in order to support copy & paste across shadow boundaries in the bug 157443. This patch also removes the use of
1876         Range in MarkupAccumulator since all uses of range is via StylizedMarkupAccumulator.
1877
1878         Also renamed createMarkupInternal to serializePreservingVisualAppearanceInternal to match the rename in r236612.
1879
1880         * dom/Position.cpp:
1881         (WebCore::Position::firstNode const):  Added.
1882         * dom/Position.h:
1883         * editing/MarkupAccumulator.cpp:
1884         (WebCore::MarkupAccumulator::MarkupAccumulator): No longer takes Range.
1885         (WebCore::MarkupAccumulator::appendText): Removed the code to truncate string at the boundary points of the range.
1886         * editing/MarkupAccumulator.h:
1887         (WebCore::MarkupAccumulator): Made this class non-copyable.
1888         * editing/markup.cpp:
1889         (WebCore::StyledMarkupAccumulator::StyledMarkupAccumulator): Now takes and stores two positions.
1890
1891         (WebCore::StyledMarkupAccumulator::appendText): Use textContentRespectingRange in the case annotation is disabled
1892         instead of calling to MarkupAccumulator::appendText, which no longer respects boundary offsets.
1893
1894         (WebCore::StyledMarkupAccumulator::renderedTextRespectingRange): Renamed from renderedText. Updated to respect
1895         boundary offsets defined by m_start and m_end Positions instead of m_range Range.
1896
1897         (WebCore::StyledMarkupAccumulator::textContentRespectingRange): Renamed from stringValueForRange. Ditto.
1898
1899         (WebCore::StyledMarkupAccumulator::serializeNodes): Now computes startNode and pastEnd nodes from start and end
1900         Positions. Note that the end position is always the next node in the tree order  for a character node
1901         and computeNodeAfterPosition returns nullptr for a character data.
1902
1903         (WebCore::highestAncestorToWrapMarkup): Now takes two positions instead of a range.
1904
1905         (WebCore::serializePreservingVisualAppearanceInternal): Renamed from createMarkupInternal. Removed the obsolete
1906         comments which were added for DOMRange in WebKitLegacy.
1907
1908         (WebCore::serializePreservingVisualAppearance):
1909
1910         (WebCore::sanitizedMarkupForFragmentInDocument): Create positions instead of a range to pass to
1911         serializePreservingVisualAppearanceInternal.
1912
1913         (WebCore::serializeFragment):
1914
1915         * editing/markup.h:
1916         * page/PageSerializer.cpp:
1917         (WebCore::PageSerializer::SerializerMarkupAccumulator): Removed the unnecessary WebCore namespace qualifier.
1918
1919 2018-09-30  Walker Henderson  <wjahenderson@gmail.com>
1920
1921         AudioNode.connect should return passed destination node
1922         https://bugs.webkit.org/show_bug.cgi?id=188834
1923
1924         Reviewed by Eric Carlson.
1925
1926         No new tests, rebaselined existing test.
1927
1928         * Modules/webaudio/AudioBasicInspectorNode.cpp:
1929         (WebCore::AudioBasicInspectorNode::connect): Deleted.
1930         * Modules/webaudio/AudioBasicInspectorNode.h:
1931         * Modules/webaudio/AudioNode.cpp:
1932         * Modules/webaudio/AudioNode.h:
1933         * Modules/webaudio/AudioNode.idl:
1934
1935 2018-09-30  Eric Carlson  <eric.carlson@apple.com>
1936
1937         [MediaStream] Clean up RealtimeMediaSource settings change handling
1938         https://bugs.webkit.org/show_bug.cgi?id=189998
1939         <rdar://problem/44797884>
1940
1941         Reviewed by Youenn Fablet.
1942
1943         No new tests, updated webrtc/video-disabled-black.html.
1944
1945         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
1946         (WebCore::CanvasCaptureMediaStreamTrack::Source::Source):
1947         (WebCore::CanvasCaptureMediaStreamTrack::Source::settings):
1948         (WebCore::CanvasCaptureMediaStreamTrack::Source::settingsDidChange):
1949         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
1950         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
1951         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
1952         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
1953         (WebCore::RealtimeIncomingVideoSource::settings):
1954         (WebCore::RealtimeIncomingVideoSource::settingsDidChange):
1955         * platform/mediastream/RealtimeIncomingVideoSource.h:
1956         * platform/mediastream/RealtimeMediaSource.cpp:
1957         (WebCore::RealtimeMediaSource::settingsDidChange):
1958         (WebCore::RealtimeMediaSource::notifySettingsDidChangeObservers):
1959         (WebCore::RealtimeMediaSource::setSize):
1960         (WebCore::RealtimeMediaSource::setFrameRate):
1961         (WebCore::RealtimeMediaSource::setAspectRatio):
1962         (WebCore::RealtimeMediaSource::setFacingMode):
1963         (WebCore::RealtimeMediaSource::setVolume):
1964         (WebCore::RealtimeMediaSource::setSampleRate):
1965         (WebCore::RealtimeMediaSource::setSampleSize):
1966         (WebCore::RealtimeMediaSource::setEchoCancellation):
1967         * platform/mediastream/RealtimeMediaSource.h:
1968         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
1969         (WebCore::GStreamerAudioCaptureSource::settingsDidChange):
1970         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
1971         (WebCore::GStreamerVideoCaptureSource::settingsDidChange):
1972         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1973         (WebCore::AVVideoCaptureSource::settingsDidChange):
1974         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1975         (WebCore::CoreAudioCaptureSource::settingsDidChange):
1976         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
1977         (WebCore::DisplayCaptureSourceCocoa::settingsDidChange):
1978         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
1979         (WebCore::RealtimeIncomingVideoSourceCocoa::processNewSample):
1980         * platform/mock/MockRealtimeAudioSource.cpp:
1981         (WebCore::MockRealtimeAudioSource::settingsDidChange):
1982         * platform/mock/MockRealtimeVideoSource.cpp:
1983         (WebCore::MockRealtimeVideoSource::settingsDidChange):
1984
1985 2018-09-30  Eric Carlson  <eric.carlson@apple.com>
1986
1987         [MediaStream] Use display-specific capture factories
1988         https://bugs.webkit.org/show_bug.cgi?id=190043
1989         <rdar://problem/44834412>
1990
1991         Reviewed by Youenn Fablet.
1992
1993         No new tests, no change in functionality.
1994
1995         * Sources.txt:
1996         * WebCore.xcodeproj/project.pbxproj:
1997         * platform/mediastream/RealtimeMediaSource.cpp:
1998         (WebCore::RealtimeMediaSource::AudioCaptureFactory::~AudioCaptureFactory): Deleted.
1999         (WebCore::RealtimeMediaSource::VideoCaptureFactory::~VideoCaptureFactory): Deleted.
2000         * platform/mediastream/RealtimeMediaSource.h:
2001         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2002         (WebCore::RealtimeMediaSourceCenter::createMediaStream):
2003         (WebCore::RealtimeMediaSourceCenter::getDisplayMediaDevices):
2004         * platform/mediastream/RealtimeMediaSourceCenter.h:
2005         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
2006         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
2007         * platform/mediastream/RealtimeMediaSourceFactory.cpp: Added.
2008         (WebCore::SingleSourceFactory::setActiveSource):
2009         (WebCore::SingleSourceFactory::unsetActiveSource):
2010         * platform/mediastream/RealtimeMediaSourceFactory.h: Added.
2011         (WebCore::SingleSourceFactory::activeSource):
2012         (WebCore::VideoCaptureFactory::setVideoCapturePageState):
2013         (WebCore::DisplayCaptureFactory::setDisplayCapturePageState):
2014         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
2015         (WebCore::libWebRTCVideoCaptureSourceFactory):
2016         (WebCore::libWebRTCDisplayCaptureSourceFactory):
2017         (WebCore::GStreamerVideoCaptureSource::factory):
2018         (WebCore::GStreamerVideoCaptureSource::displayFactory):
2019         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h:
2020         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp:
2021         (WebCore::RealtimeMediaSourceCenterLibWebRTC::audioCaptureSourceFactory):
2022         (WebCore::RealtimeMediaSourceCenterLibWebRTC::audioFactory):
2023         (WebCore::RealtimeMediaSourceCenterLibWebRTC::videoFactory):
2024         (WebCore::RealtimeMediaSourceCenterLibWebRTC::displayCaptureFactory):
2025         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h:
2026         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2027         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
2028         (WebCore::AVVideoCaptureSource::setupCaptureSession):
2029         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2030         (WebCore::CoreAudioCaptureSource::factory):
2031         * platform/mediastream/mac/CoreAudioCaptureSource.h:
2032         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2033         (WebCore::RealtimeMediaSourceCenterMac::videoCaptureSourceFactory):
2034         (WebCore::RealtimeMediaSourceCenterMac::displayCaptureSourceFactory):
2035         (WebCore::RealtimeMediaSourceCenterMac::audioCaptureSourceFactory):
2036         (WebCore::RealtimeMediaSourceCenterMac::audioFactory):
2037         (WebCore::RealtimeMediaSourceCenterMac::videoFactory):
2038         (WebCore::RealtimeMediaSourceCenterMac::displayCaptureFactory):
2039         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
2040         * platform/mock/MockRealtimeAudioSource.cpp:
2041         (WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource):
2042         (WebCore::MockRealtimeAudioSource::startProducingData):
2043         (): Deleted.
2044         (WebCore::mockAudioCaptureSourceFactory): Deleted.
2045         (WebCore::MockRealtimeAudioSource::factory): Deleted.
2046         * platform/mock/MockRealtimeAudioSource.h:
2047         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2048         (WebCore::MockRealtimeVideoSourceFactory::setVideoCapturePageState):
2049         (WebCore::MockRealtimeMediaSourceCenter::audioFactory):
2050         (WebCore::MockRealtimeMediaSourceCenter::videoFactory):
2051         (WebCore::MockRealtimeMediaSourceCenter::displayCaptureFactory):
2052         * platform/mock/MockRealtimeMediaSourceCenter.h:
2053         * platform/mock/MockRealtimeVideoSource.cpp:
2054         (): Deleted.
2055         (WebCore::MockRealtimeVideoSourceFactory::setVideoCapturePageState): Deleted.
2056         (WebCore::mockVideoCaptureSourceFactory): Deleted.
2057         (WebCore::MockRealtimeVideoSource::factory): Deleted.
2058         * platform/mock/MockRealtimeVideoSource.h:
2059
2060 2018-09-29  Oriol Brufau  <obrufau@igalia.com>
2061
2062         [css-grid] Properly align items next to collapsed tracks with gutters
2063         https://bugs.webkit.org/show_bug.cgi?id=190089
2064
2065         Reviewed by Manuel Rego Casasnovas.
2066
2067         gridAreaPositionForInFlowChild could return a wrong end position for
2068         grid items adjacent to a collapsed track, because it didn't take into
2069         account that gutters collapse in that case. Therefore, "center" or
2070         "end" alignments displayed the item at the wrong position.
2071
2072         Test: imported/w3c/web-platform-tests/css/css-grid/alignment/grid-gutters-013.html
2073
2074         * rendering/RenderGrid.cpp:
2075         (WebCore::RenderGrid::gridAreaPositionForInFlowChild const):
2076
2077 2018-09-29  Alicia Boya García  <aboya@igalia.com>
2078
2079         [GStreamer][MSE] Use GObject for GST_TRACE_OBJECT
2080         https://bugs.webkit.org/show_bug.cgi?id=190045
2081
2082         Reviewed by Philippe Normand.
2083
2084         Passing a non-GObject object to GST_TRACE_OBJECT() can be
2085         theoretically misunderstood by the GStreamer logging function, so this
2086         patch avoids that.
2087
2088         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2089         (WebCore::AppendPipeline::appsrcEndOfAppendCheckerProbe):
2090         (WebCore::AppendPipeline::handleEndOfAppend):
2091         (WebCore::AppendPipeline::consumeAppsinkAvailableSamples):
2092         (WebCore::AppendPipeline::pushNewBuffer):
2093
2094 2018-09-28  Zamiul Haque  <zhaque@apple.com>
2095
2096         Angled gradient backgrounds in body render vertically when body height is 0
2097         https://bugs.webkit.org/show_bug.cgi?id=177232
2098         <rdar://problem/34548230>.
2099
2100         Reviewed by Tim Horton.
2101
2102         Specifically, gradients displayed at an angle (ie. 45 degrees) are rendered
2103         as if they are vertical when the body tag containing the gradient
2104         has a height of 0. Other browsers do not render under these circumstances,
2105         so WebKit was modified to follow in suit. The problem was due to layout sizes for
2106         fill tiles being calculated with a minimum height of 1px. A simple change of the
2107         minimum height and width to 0px was enough to bring about the desired behavior.
2108
2109         Tests: angled-background-repeating-gradient-rendering-vertical.html
2110
2111         * rendering/RenderBoxModelObject.cpp:
2112         (WebCore::RenderBoxModelObject::calculateFillTileSize const):
2113
2114 2018-09-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2115
2116         No DOM API to instantiate an attachment for an img element
2117         https://bugs.webkit.org/show_bug.cgi?id=189934
2118         <rdar://problem/44743222>
2119
2120         Reviewed by Ryosuke Niwa.
2121
2122         Adds support for HTMLAttachmentElement.getAttachmentIdentifier, a function that internal WebKit clients can use
2123         to ensure that an image element is backed by a unique _WKAttachment. See below for more details.
2124
2125         Tests:  WKAttachmentTests.AddAttachmentToConnectedImageElement
2126                 WKAttachmentTests.ChangeFileWrapperForPastedImage
2127                 WKAttachmentTests.ConnectImageWithAttachmentToDocument
2128
2129         * dom/Document.cpp:
2130         (WebCore::Document::registerAttachmentIdentifier):
2131
2132         Add a new hook to register an empty _WKAttachment in the UI process with a given identifier. Used when creating
2133         a new empty attachment to back an image element.
2134
2135         * dom/Document.h:
2136         * editing/Editor.cpp:
2137         (WebCore::Editor::registerAttachmentIdentifier):
2138         (WebCore::Editor::notifyClientOfAttachmentUpdates):
2139         * editing/Editor.h:
2140         * html/HTMLAttachmentElement.cpp:
2141         (WebCore::HTMLAttachmentElement::getAttachmentIdentifier):
2142
2143         Creates an attachment element to back the image element, if an attachment does not already exist, and returns
2144         the unique identifier. This also causes an empty corresponding _WKAttachment to be created in the client, whose
2145         file wrapper determines the contents of the image.
2146
2147         (WebCore::HTMLAttachmentElement::ensureUniqueIdentifier):
2148         (WebCore::HTMLAttachmentElement::hasEnclosingImage const):
2149         (WebCore::HTMLAttachmentElement::updateEnclosingImageWithData):
2150
2151         Add a helper that updates the source of the enclosing image element given a content type and image data, by
2152         creating a new blob and blob URL.
2153
2154         * html/HTMLAttachmentElement.h:
2155         * html/HTMLAttachmentElement.idl:
2156         * html/HTMLImageElement.idl:
2157
2158         Rename webkitAttachmentIdentifier to just attachmentIdentifier.
2159
2160         * page/EditorClient.h:
2161         (WebCore::EditorClient::registerAttachmentIdentifier):
2162         (WebCore::EditorClient::didInsertAttachmentWithIdentifier):
2163
2164 2018-09-28  Chris Dumez  <cdumez@apple.com>
2165
2166         The return value of an OnBeforeUnloadEventHandler should always be coerced into a DOMString
2167         https://bugs.webkit.org/show_bug.cgi?id=190090
2168
2169         Reviewed by Ryosuke Niwa.
2170
2171         The return value of an OnBeforeUnloadEventHandler should always be coerced into a DOMString:
2172         - https://html.spec.whatwg.org/#onbeforeunloadeventhandler
2173         - https://html.spec.whatwg.org/#the-event-handler-processing-algorithm (Step 5)
2174
2175         In particular, this means that returning false in an OnBeforeUnloadEventHandler should NOT
2176         cancel the event when the event is a CustomEvent (and not a BeforeUnloadEvent). This is
2177         because the return value cannot be false at:
2178         - https://html.spec.whatwg.org/#the-event-handler-processing-algorithm (Step 5. Otherwise case).
2179
2180         No new tests, rebaselined existing test.
2181
2182         * bindings/js/JSEventListener.cpp:
2183         (WebCore::JSEventListener::handleEvent):
2184
2185 2018-09-28  Simon Fraser  <simon.fraser@apple.com>
2186
2187         RenderLayer::removeOnlyThisLayer() should not call updateLayerPositions()
2188         https://bugs.webkit.org/show_bug.cgi?id=190093
2189
2190         Reviewed by Dean Jackson and Zalan Bujtas.
2191         
2192         It's wrong for RenderLayer::removeOnlyThisLayer() to call updateLayerPositions(),
2193         because this is called at style update time, and layout will be stale.
2194         
2195         It was added (see webkit.org/b/25252) so that opacity changes, which can destroy layers, correctly update
2196         descendants. However, RenderStyle::changeRequiresLayout() checks for opacity <=> no opacity
2197         changes and triggers layout accordingly, which will result in a full post-layout
2198         updateLayerPositions().
2199         
2200         This also revealed that changes to the "isolate" property fail to trigger any kind of style recalc or layout;
2201         we need it to trigger layout (for now) because it affects z-order.
2202
2203         Covered by existing tests.
2204
2205         * rendering/RenderLayer.cpp:
2206         (WebCore::RenderLayer::removeOnlyThisLayer):
2207         * rendering/style/RenderStyle.cpp:
2208         (WebCore::RenderStyle::changeRequiresLayout const):
2209
2210 2018-09-28  Jiewen Tan  <jiewen_tan@apple.com>
2211
2212         [WebAuthN] Polish WebAuthN auto-test environment
2213         https://bugs.webkit.org/show_bug.cgi?id=189283
2214         <rdar://problem/44117828>
2215
2216         Reviewed by Chris Dumez.
2217
2218         This patch removes the old mocking mechanism.
2219
2220         Tests: http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https.html
2221                http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https.html
2222                http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https.html
2223
2224         * DerivedSources.make:
2225         * WebCore.xcodeproj/project.pbxproj:
2226         * testing/Internals.cpp:
2227         (WebCore::Internals::Internals):
2228         (WebCore::Internals::mockAuthenticatorCoordinator const): Deleted.
2229         * testing/Internals.h:
2230         * testing/Internals.idl:
2231         * testing/MockAuthenticatorCoordinator.cpp: Removed.
2232         * testing/MockAuthenticatorCoordinator.h: Removed.
2233         * testing/MockAuthenticatorCoordinator.idl: Removed.
2234
2235 2018-09-28  Jer Noble  <jer.noble@apple.com>
2236
2237         Refactoring: eliminate raw pointer usage in Fullscreen code
2238         https://bugs.webkit.org/show_bug.cgi?id=188747
2239         <rdar://problem/43541164>
2240
2241         Reviewed by Alex Christensen.
2242
2243         Two sources of raw pointers in the Fullscreen code:
2244         - Model classes (PlaybackSessionModel and VideoFullscreenModel) aren't ref-able, so
2245           they are passed around as raw references.
2246         - Observer classes (PlaybackSessionModelClient and VideoFullscreenModelClient, and
2247           VideoFullscreenChangeObserver) are also passed around as raw pointers, but shouldn't
2248           be ref-able.
2249
2250         Make Model classes ref-able by adding ref() and deref() which call virtual refModel and
2251         derefModel methods, overridden by implementing subclasses. Make every concrete observer
2252         inherit from CanMakeWeakPtr, and every registration method take WeakPtr wrappers around
2253         the client interface.
2254
2255         Since every Interface class now holds a strong reference to its Model classes, and each
2256         Model class holds a weak reference to all its clients, no explicit invalidate() method
2257         is necessary.
2258
2259         Notes:
2260
2261         - Since the weak pointer methods need to be able to downcast to the abstract base class,
2262           observers need to inherit publically (rather than privately) from those base classes.
2263         - Media element Models should compose EventListener rather than inheriting from it, since
2264           EventListener has its own RefCount.
2265         - WeakPtrs can't be held in HashSets (because they change value, and therefore hash, when
2266           their underlying object is destroyed), so clients should be stored in a Vector instead.
2267         - Interfaces should be given all required Refs at creation time, so that they can store
2268           those parameters as Refs instead of RefPtrs.
2269
2270         * platform/cocoa/PlaybackSessionInterface.h:
2271         (WebCore::PlaybackSessionInterface::~PlaybackSessionInterface): Deleted.
2272         * platform/cocoa/PlaybackSessionModel.h:
2273         (WebCore::PlaybackSessionModel::ref):
2274         (WebCore::PlaybackSessionModel::deref):
2275         (WebCore::PlaybackSessionModel::~PlaybackSessionModel): Deleted.
2276         * platform/cocoa/PlaybackSessionModelMediaElement.h:
2277         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
2278         (WebCore::PlaybackSessionModelMediaElement::PlaybackSessionModelMediaElement):
2279         (WebCore::PlaybackSessionModelMediaElement::~PlaybackSessionModelMediaElement):
2280         (WebCore::PlaybackSessionModelMediaElement::setMediaElement):
2281         (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
2282         (WebCore::PlaybackSessionModelMediaElement::addClient):
2283         (WebCore::PlaybackSessionModelMediaElement::removeClient):
2284         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionOptions):
2285         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionIndices):
2286         (WebCore::PlaybackSessionModelMediaElement::handleEvent): Deleted.
2287         * platform/cocoa/VideoFullscreenChangeObserver.h:
2288         (WebCore::VideoFullscreenChangeObserver::~VideoFullscreenChangeObserver): Deleted.
2289         * platform/cocoa/VideoFullscreenModel.h:
2290         (WebCore::VideoFullscreenModel::ref):
2291         (WebCore::VideoFullscreenModel::deref):
2292         (WebCore::VideoFullscreenModel::~VideoFullscreenModel): Deleted.
2293         * platform/cocoa/VideoFullscreenModelVideoElement.h:
2294         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
2295         (VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement):
2296         (VideoFullscreenModelVideoElement::setVideoElement):
2297         (VideoFullscreenModelVideoElement::addClient):
2298         (VideoFullscreenModelVideoElement::removeClient):
2299         (VideoFullscreenModelVideoElement::setHasVideo):
2300         (VideoFullscreenModelVideoElement::setVideoDimensions):
2301         (VideoFullscreenModelVideoElement::willEnterPictureInPicture):
2302         (VideoFullscreenModelVideoElement::didEnterPictureInPicture):
2303         (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture):
2304         (VideoFullscreenModelVideoElement::willExitPictureInPicture):
2305         (VideoFullscreenModelVideoElement::didExitPictureInPicture):
2306         (VideoFullscreenModelVideoElement::handleEvent): Deleted.
2307         * platform/ios/PlaybackSessionInterfaceAVKit.h:
2308         (WebCore::PlaybackSessionInterfaceAVKit::create):
2309         (WebCore::PlaybackSessionInterfaceAVKit::playbackSessionModel const):
2310         (): Deleted.
2311         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
2312         (WebCore::PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit):
2313         (WebCore::PlaybackSessionInterfaceAVKit::~PlaybackSessionInterfaceAVKit):
2314         (WebCore::PlaybackSessionInterfaceAVKit::invalidate): Deleted.
2315         * platform/ios/VideoFullscreenInterfaceAVKit.h:
2316         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2317         (-[WebAVPlayerLayer layoutSublayers]):
2318         (-[WebAVPlayerLayer resolveBounds]):
2319         (-[WebAVPlayerLayer setVideoGravity:]):
2320         (VideoFullscreenInterfaceAVKit::create):
2321         (VideoFullscreenInterfaceAVKit::VideoFullscreenInterfaceAVKit):
2322         (VideoFullscreenInterfaceAVKit::~VideoFullscreenInterfaceAVKit):
2323         (VideoFullscreenInterfaceAVKit::setVideoFullscreenChangeObserver):
2324         (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
2325         (VideoFullscreenInterfaceAVKit::setupFullscreen):
2326         (VideoFullscreenInterfaceAVKit::presentingViewController):
2327         (VideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen):
2328         (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen):
2329         (VideoFullscreenInterfaceAVKit::willStartPictureInPicture):
2330         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
2331         (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture):
2332         (VideoFullscreenInterfaceAVKit::willStopPictureInPicture):
2333         (VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
2334         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
2335         (VideoFullscreenInterfaceAVKit::doSetup):
2336         (VideoFullscreenInterfaceAVKit::setMode):
2337         (VideoFullscreenInterfaceAVKit::clearMode):
2338         (VideoFullscreenInterfaceAVKit::setVideoFullscreenModel): Deleted.
2339         (VideoFullscreenInterfaceAVKit::invalidate): Deleted.
2340         * platform/ios/WebAVPlayerController.h:
2341         * platform/ios/WebAVPlayerController.mm:
2342         (-[WebAVPlayerController delegate]):
2343         (-[WebAVPlayerController playbackSessionInterface]):
2344         (-[WebAVPlayerController setPlaybackSessionInterface:]):
2345         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2346         (VideoFullscreenControllerContext::didCleanupFullscreen):
2347         (VideoFullscreenControllerContext::addClient):
2348         (VideoFullscreenControllerContext::removeClient):
2349         (VideoFullscreenControllerContext::willEnterPictureInPicture):
2350         (VideoFullscreenControllerContext::didEnterPictureInPicture):
2351         (VideoFullscreenControllerContext::failedToEnterPictureInPicture):
2352         (VideoFullscreenControllerContext::willExitPictureInPicture):
2353         (VideoFullscreenControllerContext::didExitPictureInPicture):
2354         (VideoFullscreenControllerContext::setUpFullscreen):
2355         * platform/mac/PlaybackSessionInterfaceMac.h:
2356         * platform/mac/PlaybackSessionInterfaceMac.mm:
2357         (WebCore::PlaybackSessionInterfaceMac::create):
2358         (WebCore::PlaybackSessionInterfaceMac::PlaybackSessionInterfaceMac):
2359         (WebCore::PlaybackSessionInterfaceMac::playbackSessionModel const):
2360         (WebCore::PlaybackSessionInterfaceMac::rateChanged):
2361         (WebCore::PlaybackSessionInterfaceMac::beginScrubbing):
2362         (WebCore::PlaybackSessionInterfaceMac::endScrubbing):
2363         (WebCore::PlaybackSessionInterfaceMac::setPlayBackControlsManager):
2364         (WebCore::PlaybackSessionInterfaceMac::updatePlaybackControlsManagerTiming):
2365         (WebCore::PlaybackSessionInterfaceMac::~PlaybackSessionInterfaceMac): Deleted.
2366         (WebCore::PlaybackSessionInterfaceMac::invalidate): Deleted.
2367         * platform/mac/VideoFullscreenInterfaceMac.h:
2368         (WebCore::VideoFullscreenInterfaceMac::create):
2369         (WebCore::VideoFullscreenInterfaceMac::videoFullscreenModel const):
2370         (WebCore::VideoFullscreenInterfaceMac::playbackSessionModel const):
2371         (WebCore::VideoFullscreenInterfaceMac::videoFullscreenChangeObserver const):
2372         * platform/mac/VideoFullscreenInterfaceMac.mm:
2373         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]):
2374         (-[WebVideoFullscreenInterfaceMacObjC boundsDidChangeForVideoViewContainer:]):
2375         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
2376         (-[WebVideoFullscreenInterfaceMacObjC pipActionPlay:]):
2377         (-[WebVideoFullscreenInterfaceMacObjC pipActionPause:]):
2378         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]):
2379         (WebCore::VideoFullscreenInterfaceMac::VideoFullscreenInterfaceMac):
2380         (WebCore::VideoFullscreenInterfaceMac::~VideoFullscreenInterfaceMac):
2381         (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenChangeObserver):
2382         (WebCore::VideoFullscreenInterfaceMac::setMode):
2383         (WebCore::VideoFullscreenInterfaceMac::clearMode):
2384         (WebCore::VideoFullscreenInterfaceMac::invalidate):
2385         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitPiP):
2386         (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenModel): Deleted.
2387         * platform/mac/WebPlaybackControlsManager.mm:
2388         (-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]):
2389         (-[WebPlaybackControlsManager setCurrentAudioTouchBarMediaSelectionOption:]):
2390         (-[WebPlaybackControlsManager setCurrentLegibleTouchBarMediaSelectionOption:]):
2391         (-[WebPlaybackControlsManager togglePlayback]):
2392         (-[WebPlaybackControlsManager setPlaying:]):
2393         (-[WebPlaybackControlsManager isPlaying]):
2394         (-[WebPlaybackControlsManager togglePictureInPicture]):
2395
2396 2018-09-28  Chris Dumez  <cdumez@apple.com>
2397
2398         Drop support for cross-origin-window-policy header
2399         https://bugs.webkit.org/show_bug.cgi?id=190081
2400
2401         Reviewed by Ryosuke Niwa.
2402
2403         Drop support for cross-origin-window-policy header as this was never enabled and its design has
2404         some issues we have not resolved. An alternative is being worked on but will be substantially
2405         different so there is not much value in keeping this code around.
2406
2407         * bindings/js/JSDOMBindingSecurity.cpp:
2408         * bindings/js/JSDOMBindingSecurity.h:
2409         * bindings/js/JSDOMWindowCustom.cpp:
2410         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
2411         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
2412         (WebCore::addCrossOriginWindowPropertyNames):
2413         (WebCore::addScopedChildrenIndexes):
2414         (WebCore::addCrossOriginWindowOwnPropertyNames):
2415         (WebCore::JSDOMWindow::getOwnPropertyNames):
2416         * bindings/js/JSDOMWindowCustom.h:
2417         * bindings/js/JSRemoteDOMWindowCustom.cpp:
2418         * bindings/scripts/CodeGeneratorJS.pm:
2419         (GenerateAttributeGetterBodyDefinition):
2420         (GenerateAttributeSetterBodyDefinition):
2421         (GenerateOperationBodyDefinition):
2422         * bindings/scripts/IDLAttributes.json:
2423         * dom/Document.cpp:
2424         (WebCore::Document::canNavigate):
2425         * loader/FrameLoader.cpp:
2426         (WebCore::FrameLoader::didBeginDocument):
2427         * page/AbstractDOMWindow.cpp:
2428         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
2429         * page/AbstractDOMWindow.h:
2430         * page/DOMWindow.idl:
2431         * page/Settings.yaml:
2432         * platform/network/HTTPParsers.cpp:
2433         * platform/network/HTTPParsers.h:
2434
2435 2018-09-28  Daniel Bates  <dabates@apple.com>
2436
2437         [iOS] Allow programmatic focus when hardware keyboard is attached
2438         https://bugs.webkit.org/show_bug.cgi?id=190017
2439         <rdar://problem/42270463>
2440
2441         Reviewed by Wenson Hsieh.
2442
2443         Add support for checking if the embedding client is WebKitTestRunner and export isDumpRenderTree()
2444         so that we can make use of it from WebKit. We will make use of these functions to keep the current
2445         behavior of disallowing programmatic focus when running tests in these apps. This is needed to
2446         keep testing deterministic. Otherwise, test results would be dependent on whether a hardware
2447         keyboard is attached. When running tests in Simulator.app the hardware keyboard may also not be
2448         connected (i.e. Hardware > Keyboard > Connect Hardware Keyboard is disabled).
2449
2450         * platform/RuntimeApplicationChecks.h:
2451         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2452         (WebCore::IOSApplication::isWebKitTestRunner): Added.
2453
2454 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
2455
2456         REGRESSION(r236609): API tests for mso list preservation are failing
2457         https://bugs.webkit.org/show_bug.cgi?id=190095
2458
2459         Reviewed by Wenson Hsieh.
2460
2461         The regression was caused by appendNodeToPreserveMSOList called after an early return for not having renderer.
2462         Clearly, comment & style elements coming from a MS word document wouldn't have a renderer.
2463
2464         Fixed the bug by changing the order.
2465
2466         * editing/markup.cpp:
2467         (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
2468
2469 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
2470
2471         Build fix after r236612.
2472
2473         * platform/win/PasteboardWin.cpp:
2474         (WebCore::Pasteboard::writeSelection):
2475
2476 2018-09-28  Andy Estes  <aestes@apple.com>
2477
2478         [Apple Pay] Remove the "in-store" button type
2479         https://bugs.webkit.org/show_bug.cgi?id=190079
2480
2481         Reviewed by Tim Horton.
2482
2483         According to <https://developer.apple.com/design/human-interface-guidelines/apple-pay/buttons-and-marks/buttons/>,
2484         this button is meant only for certain kinds of native apps. It shouldn't be available on the web.
2485
2486         Updated http/tests/ssl/applepay/ApplePayButton.html.
2487
2488         * css/CSSPrimitiveValueMappings.h:
2489         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2490         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const):
2491         * css/CSSValueKeywords.in:
2492         * css/parser/CSSParserFastPaths.cpp:
2493         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2494         * rendering/RenderThemeCocoa.mm:
2495         (WebCore::toPKPaymentButtonType):
2496         * rendering/style/RenderStyleConstants.h:
2497
2498 2018-09-28  Chris Dumez  <cdumez@apple.com>
2499
2500         document.open() should throw errors for cross-origin calls
2501         https://bugs.webkit.org/show_bug.cgi?id=189371
2502         <rdar://problem/44282700>
2503
2504         Reviewed by Youenn Fablet.
2505
2506         document.open() / document.write() should throw errors for cross-origin calls as per:
2507         - https://html.spec.whatwg.org/#document-open-steps (Step 4)
2508
2509         No new tests, rebaselined existing tests.
2510
2511         * dom/Document.cpp:
2512         (WebCore::Document::open):
2513         (WebCore::Document::write):
2514         (WebCore::Document::writeln):
2515         * dom/Document.h:
2516
2517 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
2518
2519         Rename createMarkup to serializePreservingVisualAppearance
2520         https://bugs.webkit.org/show_bug.cgi?id=190086
2521
2522         Reviewed by Wenson Hsieh.
2523
2524         Renamed the function to clarify what it does. Also removed the unused Range::toHTML.
2525
2526         * dom/Range.cpp:
2527         (WebCore::Range::toHTML const): Deleted.
2528         * dom/Range.h:
2529         * editing/CompositeEditCommand.cpp:
2530         (WebCore::CompositeEditCommand::moveParagraphs):
2531         * editing/cocoa/EditorCocoa.mm:
2532         (WebCore::Editor::selectionInHTMLFormat):
2533         * editing/gtk/EditorGtk.cpp:
2534         (WebCore::Editor::writeSelectionToPasteboard):
2535         * editing/markup.cpp:
2536         (WebCore::serializePreservingVisualAppearance):
2537         (WebCore::createMarkup): Deleted.
2538         * editing/markup.h:
2539         * editing/wpe/EditorWPE.cpp:
2540         (WebCore::Editor::writeSelectionToPasteboard):
2541         * loader/archive/cf/LegacyWebArchive.cpp:
2542         (WebCore::LegacyWebArchive::create):
2543         (WebCore::LegacyWebArchive::createFromSelection):
2544         * platform/win/PasteboardWin.cpp:
2545         (WebCore::Pasteboard::writeRangeToDataObject):
2546
2547 2018-09-28  Simon Fraser  <simon.fraser@apple.com>
2548
2549         Remove some unused RenderLayer code
2550         https://bugs.webkit.org/show_bug.cgi?id=190078
2551
2552         Reviewed by Zalan Bujtas.
2553
2554         The 'outOfFlowDescendantContainingBlocks' code was related to the accelerated overflow scrolling code that
2555         I removed recently.
2556         
2557         updateDescendantsLayerListsIfNeeded() is never called.
2558
2559         * rendering/RenderLayer.cpp:
2560         (WebCore::RenderLayer::updateDescendantDependentFlags):
2561         (WebCore::RenderLayer::calculateClipRects const):
2562         * rendering/RenderLayer.h:
2563
2564 2018-09-28  Commit Queue  <commit-queue@webkit.org>
2565
2566         Unreviewed, rolling out r236605.
2567         https://bugs.webkit.org/show_bug.cgi?id=190087
2568
2569         caused three API test timeouts (Requested by jernoble on
2570         #webkit).
2571
2572         Reverted changeset:
2573
2574         "Refactoring: eliminate raw pointer usage in Fullscreen code"
2575         https://bugs.webkit.org/show_bug.cgi?id=188747
2576         https://trac.webkit.org/changeset/236605
2577
2578 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
2579
2580         Simplify StyledMarkupAccumulator::traverseNodesForSerialization
2581         https://bugs.webkit.org/show_bug.cgi?id=190073
2582
2583         Reviewed by Antti Koivisto.
2584
2585         Simplified the range traversal algorithm in traverseNodesForSerialization as it was too complicated
2586         to support shadow DOM for copy and paste.
2587
2588         Instead of using NodeTraversal::next to traverse past ancestors and then figuring out which ancestor
2589         must be closed or to wrap the existing markup with, new code collects the list of ancestors as we
2590         traverse out of them.
2591
2592         Also extracted lambdas for generating markup and deciding whether to skip a node as well as keeping
2593         track of the depth of the current markup. This further reduces the code complexity of the actual
2594         node traversal algorithm. Keeping track of the depth allows us to now generate ancestor elements'
2595         closing tags without keeping a stack of ancestor nodes we opened at all times.
2596
2597         * editing/markup.cpp:
2598         (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
2599
2600 2018-09-27  Ryosuke Niwa  <rniwa@webkit.org>
2601
2602         Replace every use of Node::offsetInCharacters() by Node::isCharacterDataNode()
2603         https://bugs.webkit.org/show_bug.cgi?id=190069
2604
2605         Reviewed by Zalan Bujtas.
2606
2607         Removed Node::offsetInCharacters() and replaced every use of it by isCharacterDataNode()
2608         because their implementations are identical.
2609
2610         Note that offsetInCharacters() sounds like a function which returns some kind of an offset
2611         but it doesn't. It returns true when called on a CharacterData and false elsewhere.
2612
2613         * accessibility/AXObjectCache.cpp:
2614         (WebCore::characterOffsetsInOrder):
2615         (WebCore::AXObjectCache::startOrEndCharacterOffsetForRange):
2616         (WebCore::AXObjectCache::characterOffsetFromVisiblePosition):
2617         * dom/CharacterData.cpp:
2618         (WebCore::CharacterData::offsetInCharacters const): Deleted.
2619         * dom/CharacterData.h:
2620         * dom/Node.cpp:
2621         (WebCore::Node::offsetInCharacters const): Deleted.
2622         * dom/Node.h:
2623         * dom/Position.cpp:
2624         (WebCore::Position::parentAnchoredEquivalent const):
2625         * dom/Position.h:
2626         (WebCore::lastOffsetInNode):
2627         (WebCore::minOffsetForNode):
2628         (WebCore::offsetIsBeforeLastNodeOffset):
2629         * dom/Range.cpp:
2630         (WebCore::Range::firstNode const):
2631         (WebCore::Range::pastLastNode const):
2632         * dom/RangeBoundaryPoint.h:
2633         (WebCore::RangeBoundaryPoint::setOffset):
2634         (WebCore::RangeBoundaryPoint::setToEndOfNode):
2635         * editing/Editing.cpp:
2636         (WebCore::lastOffsetForEditing):
2637         * editing/TextIterator.cpp:
2638         (WebCore::nextInPreOrderCrossingShadowBoundaries):
2639         (WebCore::TextIterator::node const):
2640         (WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
2641         * page/DOMSelection.cpp:
2642         (WebCore::DOMSelection::extend):
2643
2644 2018-09-28  Jer Noble  <jer.noble@apple.com>
2645
2646         Refactoring: eliminate raw pointer usage in Fullscreen code
2647         https://bugs.webkit.org/show_bug.cgi?id=188747
2648         <rdar://problem/43541164>
2649
2650         Reviewed by Alex Christensen.
2651
2652         Two sources of raw pointers in the Fullscreen code:
2653         - Model classes (PlaybackSessionModel and VideoFullscreenModel) aren't ref-able, so
2654           they are passed around as raw references.
2655         - Observer classes (PlaybackSessionModelClient and VideoFullscreenModelClient, and
2656           VideoFullscreenChangeObserver) are also passed around as raw pointers, but shouldn't
2657           be ref-able.
2658
2659         Make Model classes ref-able by adding ref() and deref() which call virtual refModel and
2660         derefModel methods, overridden by implementing subclasses. Make every concrete observer
2661         inherit from CanMakeWeakPtr, and every registration method take WeakPtr wrappers around
2662         the client interface.
2663
2664         Since every Interface class now holds a strong reference to its Model classes, and each
2665         Model class holds a weak reference to all its clients, no explicit invalidate() method
2666         is necessary.
2667
2668         Notes:
2669
2670         - Since the weak pointer methods need to be able to downcast to the abstract base class,
2671           observers need to inherit publically (rather than privately) from those base classes.
2672         - Media element Models should compose EventListener rather than inheriting from it, since
2673           EventListener has its own RefCount.
2674         - WeakPtrs can't be held in HashSets (because they change value, and therefore hash, when
2675           their underlying object is destroyed), so clients should be stored in a Vector instead.
2676         - Interfaces should be given all required Refs at creation time, so that they can store
2677           those parameters as Refs instead of RefPtrs.
2678
2679         * platform/cocoa/PlaybackSessionInterface.h:
2680         (WebCore::PlaybackSessionInterface::~PlaybackSessionInterface): Deleted.
2681         * platform/cocoa/PlaybackSessionModel.h:
2682         (WebCore::PlaybackSessionModel::ref):
2683         (WebCore::PlaybackSessionModel::deref):
2684         (WebCore::PlaybackSessionModel::~PlaybackSessionModel): Deleted.
2685         * platform/cocoa/PlaybackSessionModelMediaElement.h:
2686         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
2687         (WebCore::PlaybackSessionModelMediaElement::PlaybackSessionModelMediaElement):
2688         (WebCore::PlaybackSessionModelMediaElement::~PlaybackSessionModelMediaElement):
2689         (WebCore::PlaybackSessionModelMediaElement::setMediaElement):
2690         (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
2691         (WebCore::PlaybackSessionModelMediaElement::addClient):
2692         (WebCore::PlaybackSessionModelMediaElement::removeClient):
2693         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionOptions):
2694         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionIndices):
2695         (WebCore::PlaybackSessionModelMediaElement::handleEvent): Deleted.
2696         * platform/cocoa/VideoFullscreenChangeObserver.h:
2697         (WebCore::VideoFullscreenChangeObserver::~VideoFullscreenChangeObserver): Deleted.
2698         * platform/cocoa/VideoFullscreenModel.h:
2699         (WebCore::VideoFullscreenModel::ref):
2700         (WebCore::VideoFullscreenModel::deref):
2701         (WebCore::VideoFullscreenModel::~VideoFullscreenModel): Deleted.
2702         * platform/cocoa/VideoFullscreenModelVideoElement.h:
2703         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
2704         (VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement):
2705         (VideoFullscreenModelVideoElement::setVideoElement):
2706         (VideoFullscreenModelVideoElement::addClient):
2707         (VideoFullscreenModelVideoElement::removeClient):
2708         (VideoFullscreenModelVideoElement::setHasVideo):
2709         (VideoFullscreenModelVideoElement::setVideoDimensions):
2710         (VideoFullscreenModelVideoElement::willEnterPictureInPicture):
2711         (VideoFullscreenModelVideoElement::didEnterPictureInPicture):
2712         (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture):
2713         (VideoFullscreenModelVideoElement::willExitPictureInPicture):
2714         (VideoFullscreenModelVideoElement::didExitPictureInPicture):
2715         (VideoFullscreenModelVideoElement::handleEvent): Deleted.
2716         * platform/ios/PlaybackSessionInterfaceAVKit.h:
2717         (WebCore::PlaybackSessionInterfaceAVKit::create):
2718         (WebCore::PlaybackSessionInterfaceAVKit::playbackSessionModel const):
2719         (): Deleted.
2720         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
2721         (WebCore::PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit):
2722         (WebCore::PlaybackSessionInterfaceAVKit::~PlaybackSessionInterfaceAVKit):
2723         (WebCore::PlaybackSessionInterfaceAVKit::invalidate): Deleted.
2724         * platform/ios/VideoFullscreenInterfaceAVKit.h:
2725         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2726         (-[WebAVPlayerLayer layoutSublayers]):
2727         (-[WebAVPlayerLayer resolveBounds]):
2728         (-[WebAVPlayerLayer setVideoGravity:]):
2729         (VideoFullscreenInterfaceAVKit::create):
2730         (VideoFullscreenInterfaceAVKit::VideoFullscreenInterfaceAVKit):
2731         (VideoFullscreenInterfaceAVKit::~VideoFullscreenInterfaceAVKit):
2732         (VideoFullscreenInterfaceAVKit::setVideoFullscreenChangeObserver):
2733         (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
2734         (VideoFullscreenInterfaceAVKit::setupFullscreen):
2735         (VideoFullscreenInterfaceAVKit::presentingViewController):
2736         (VideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen):
2737         (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen):
2738         (VideoFullscreenInterfaceAVKit::willStartPictureInPicture):
2739         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
2740         (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture):
2741         (VideoFullscreenInterfaceAVKit::willStopPictureInPicture):
2742         (VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
2743         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
2744         (VideoFullscreenInterfaceAVKit::doSetup):
2745         (VideoFullscreenInterfaceAVKit::setMode):
2746         (VideoFullscreenInterfaceAVKit::clearMode):
2747         (VideoFullscreenInterfaceAVKit::setVideoFullscreenModel): Deleted.
2748         (VideoFullscreenInterfaceAVKit::invalidate): Deleted.
2749         * platform/ios/WebAVPlayerController.h:
2750         * platform/ios/WebAVPlayerController.mm:
2751         (-[WebAVPlayerController delegate]):
2752         (-[WebAVPlayerController playbackSessionInterface]):
2753         (-[WebAVPlayerController setPlaybackSessionInterface:]):
2754         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2755         (VideoFullscreenControllerContext::didCleanupFullscreen):
2756         (VideoFullscreenControllerContext::addClient):
2757         (VideoFullscreenControllerContext::removeClient):
2758         (VideoFullscreenControllerContext::willEnterPictureInPicture):
2759         (VideoFullscreenControllerContext::didEnterPictureInPicture):
2760         (VideoFullscreenControllerContext::failedToEnterPictureInPicture):
2761         (VideoFullscreenControllerContext::willExitPictureInPicture):
2762         (VideoFullscreenControllerContext::didExitPictureInPicture):
2763         (VideoFullscreenControllerContext::setUpFullscreen):
2764         * platform/mac/PlaybackSessionInterfaceMac.h:
2765         * platform/mac/PlaybackSessionInterfaceMac.mm:
2766         (WebCore::PlaybackSessionInterfaceMac::create):
2767         (WebCore::PlaybackSessionInterfaceMac::PlaybackSessionInterfaceMac):
2768         (WebCore::PlaybackSessionInterfaceMac::playbackSessionModel const):
2769         (WebCore::PlaybackSessionInterfaceMac::rateChanged):
2770         (WebCore::PlaybackSessionInterfaceMac::beginScrubbing):
2771         (WebCore::PlaybackSessionInterfaceMac::endScrubbing):
2772         (WebCore::PlaybackSessionInterfaceMac::setPlayBackControlsManager):
2773         (WebCore::PlaybackSessionInterfaceMac::updatePlaybackControlsManagerTiming):
2774         (WebCore::PlaybackSessionInterfaceMac::~PlaybackSessionInterfaceMac): Deleted.
2775         (WebCore::PlaybackSessionInterfaceMac::invalidate): Deleted.
2776         * platform/mac/VideoFullscreenInterfaceMac.h:
2777         (WebCore::VideoFullscreenInterfaceMac::create):
2778         (WebCore::VideoFullscreenInterfaceMac::videoFullscreenModel const):
2779         (WebCore::VideoFullscreenInterfaceMac::playbackSessionModel const):
2780         (WebCore::VideoFullscreenInterfaceMac::videoFullscreenChangeObserver const):
2781         * platform/mac/VideoFullscreenInterfaceMac.mm:
2782         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]):
2783         (-[WebVideoFullscreenInterfaceMacObjC boundsDidChangeForVideoViewContainer:]):
2784         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
2785         (-[WebVideoFullscreenInterfaceMacObjC pipActionPlay:]):
2786         (-[WebVideoFullscreenInterfaceMacObjC pipActionPause:]):
2787         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]):
2788         (WebCore::VideoFullscreenInterfaceMac::VideoFullscreenInterfaceMac):
2789         (WebCore::VideoFullscreenInterfaceMac::~VideoFullscreenInterfaceMac):
2790         (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenChangeObserver):
2791         (WebCore::VideoFullscreenInterfaceMac::setMode):
2792         (WebCore::VideoFullscreenInterfaceMac::clearMode):
2793         (WebCore::VideoFullscreenInterfaceMac::invalidate):
2794         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitPiP):
2795         (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenModel): Deleted.
2796         * platform/mac/WebPlaybackControlsManager.mm:
2797         (-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]):
2798         (-[WebPlaybackControlsManager setCurrentAudioTouchBarMediaSelectionOption:]):
2799         (-[WebPlaybackControlsManager setCurrentLegibleTouchBarMediaSelectionOption:]):
2800         (-[WebPlaybackControlsManager togglePlayback]):
2801         (-[WebPlaybackControlsManager setPlaying:]):
2802         (-[WebPlaybackControlsManager isPlaying]):
2803         (-[WebPlaybackControlsManager togglePictureInPicture]):
2804
2805 2018-09-28  Chris Dumez  <cdumez@apple.com>
2806
2807         Drop iOS specific quirk in SettingsBase::scriptEnabledChanged()
2808         https://bugs.webkit.org/show_bug.cgi?id=190077
2809         <rdar://problem/44812613>
2810
2811         Reviewed by Zalan Bujtas.
2812
2813         Drop iOS specific quirk in SettingsBase::scriptEnabledChanged() that would dirty style after the
2814         "JavaScriptEnabled" setting's state is toggled. I do not see a good reason to do this given that
2815         scripts would not get executed until a reload.
2816
2817         If we find out after dropping this that this is actually useful for some reason, then we can
2818         always bring it back and consider making this non-iOS specific, as well as documenting why this
2819         it is needed.
2820
2821         * page/Settings.yaml:
2822         * page/SettingsBase.cpp:
2823         (WebCore::SettingsBase::scriptEnabledChanged): Deleted.
2824         * page/SettingsBase.h:
2825
2826 2018-09-27  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2827
2828         [Curl] Fix priority issue with multiple cookies with different level of path.
2829         https://bugs.webkit.org/show_bug.cgi?id=189920
2830
2831         Reviewed by Fujii Hironori.
2832
2833         When multiple cookies are stored in the database for same site, the priority of
2834         multiple cookies which matches path criteria was not defined. The backend
2835         implementation `sqlite` then returns the first matching result, which is the one
2836         stored earlier.
2837
2838         Test: http/tests/cookies/cookie-with-multiple-level-path.html
2839
2840         * platform/network/curl/CookieJarDB.cpp:
2841         (WebCore::CookieJarDB::searchCookies):
2842
2843 2018-09-26  Ryosuke Niwa  <rniwa@webkit.org>
2844
2845         Use enum class in createMarkup arguments
2846         https://bugs.webkit.org/show_bug.cgi?id=190028
2847
2848         Reviewed by Wenson Hsieh.
2849
2850         Replaced enums used by createMarkup with equivalent enum classes: EChildrenOnly with SerializedNodes,
2851         EAbsoluteURLs with ResolveURLs, and EFragmentSerialization with SerializationSyntax.
2852
2853         Also replaced the boolean convertBlocksToInlines with an enum class of the same name.
2854
2855         Finally, renamed the createMarkup variant which doesn't serialize style and used for innerHTML and XMLSerializer
2856         to serializeFragment.
2857
2858         * dom/Element.cpp:
2859         (WebCore::Element::innerHTML const):
2860         (WebCore::Element::outerHTML const):
2861         * dom/ShadowRoot.cpp:
2862         (WebCore::ShadowRoot::innerHTML const):
2863         * editing/CompositeEditCommand.cpp:
2864         (WebCore::CompositeEditCommand::moveParagraphs):
2865         * editing/HTMLInterchange.h:
2866         (WebCore::AnnotateForInterchange): Renamed from EAnnotateForInterchange.
2867         * editing/MarkupAccumulator.cpp:
2868         (WebCore::MarkupAccumulator::MarkupAccumulator):
2869         (WebCore::MarkupAccumulator::serializeNodes):
2870         (WebCore::MarkupAccumulator::serializeNodesWithNamespaces):
2871         (WebCore::MarkupAccumulator::resolveURLIfNeeded const):
2872         * editing/MarkupAccumulator.h:
2873         (WebCore::MarkupAccumulator::inXMLFragmentSerialization const):
2874         * editing/ReplaceRangeWithTextCommand.cpp:
2875         (WebCore::ReplaceRangeWithTextCommand::inputEventDataTransfer const):
2876         * editing/ReplaceSelectionCommand.cpp:
2877         (WebCore::ReplaceSelectionCommand::willApplyCommand):
2878         * editing/SpellingCorrectionCommand.cpp:
2879         (WebCore::SpellingCorrectionCommand::inputEventDataTransfer const):
2880         * editing/cocoa/EditorCocoa.mm:
2881         (WebCore::Editor::selectionInHTMLFormat):
2882         * editing/cocoa/WebContentReaderCocoa.mm:
2883         (WebCore::WebContentMarkupReader::readRTFD):
2884         (WebCore::WebContentMarkupReader::readRTF):
2885         * editing/gtk/EditorGtk.cpp:
2886         (WebCore::Editor::writeImageToPasteboard):
2887         (WebCore::Editor::writeSelectionToPasteboard):
2888         * editing/markup.cpp:
2889         (WebCore::StyledMarkupAccumulator::StyledMarkupAccumulator):
2890         (WebCore::StyledMarkupAccumulator::serializeNodes):
2891         (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
2892         (WebCore::highestAncestorToWrapMarkup):
2893         (WebCore::createMarkupInternal):
2894         (WebCore::createMarkup):
2895         (WebCore::sanitizedMarkupForFragmentInDocument):
2896         (WebCore::serializeFragment): Renamed from createMarkup. This is used for innerHTML and XMLSerializer,
2897         which faithfully serializes the fragment without any computed style as inline styles.
2898         (WebCore::documentTypeString):
2899         (WebCore::createFullMarkup): Deleted two varinats used in WebKitLegacy.
2900         * editing/markup.h:
2901         (WebCore::ResolveURLs): Renamed from EAbsoluteURLs.
2902         (WebCore::ConvertBlocksToInlines): Added.
2903         (WebCore::SerializedNodes): Renamed from EChildrenOnly.
2904         (WebCore::SerializationSyntax): Renamed from EFragmentSerialization.
2905         * editing/wpe/EditorWPE.cpp:
2906         (WebCore::Editor::writeSelectionToPasteboard):
2907         * inspector/DOMEditor.cpp:
2908         * inspector/agents/InspectorDOMAgent.cpp:
2909         (WebCore::InspectorDOMAgent::getOuterHTML):
2910         * loader/archive/cf/LegacyWebArchive.cpp:
2911         (WebCore::LegacyWebArchive::create):
2912         (WebCore::LegacyWebArchive::createFromSelection):
2913         * page/PageSerializer.cpp:
2914         (WebCore::PageSerializer::SerializerMarkupAccumulator::SerializerMarkupAccumulator):
2915         (WebCore::PageSerializer::serializeFrame):
2916         * page/win/DragControllerWin.cpp:
2917         (WebCore::DragController::declareAndWriteDragImage):
2918         * Source/WebCore/platform/win/PasteboardWin.cpp:
2919         (WebCore::Pasteboard::writeRangeToDataObject):
2920         (WebCore::Pasteboard::writeSelection):
2921         * xml/XMLHttpRequest.cpp:
2922         (WebCore::XMLHttpRequest::send):
2923         * xml/XMLSerializer.cpp:
2924         (WebCore::XMLSerializer::serializeToString):
2925         * xml/XSLTProcessorLibxslt.cpp:
2926         (WebCore::xsltStylesheetPointer):
2927         (WebCore::xmlDocPtrFromNode):
2928
2929 2018-09-27  John Wilander  <wilander@apple.com>
2930
2931         Resource Load Statistics: Non-redirected top frame navigation should not get captured in statistics
2932         https://bugs.webkit.org/show_bug.cgi?id=190055
2933         <rdar://problem/44843460>
2934
2935         Reviewed by Chris Dumez.
2936
2937         Test: http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html
2938
2939         * loader/ResourceLoadStatistics.cpp:
2940         (WebCore::ResourceLoadStatistics::decode):
2941             Corrects legacy statistics for frames and triggers a re-classification.
2942
2943 2018-09-27  Jer Noble  <jer.noble@apple.com>
2944
2945         Unreviewed watchOS build fix; Fix declaration for ports which USE(ENCRYPTED_MEDIA) but don't
2946         HAVE(AVCONTENTKEYSESSION).
2947
2948         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2949
2950 2018-09-27  Justin Michaud  <justin_michaud@apple.com>
2951
2952         Remove duplicate CSS Properties and Values feature on status page
2953         https://bugs.webkit.org/show_bug.cgi?id=189909
2954
2955         Reviewed by Simon Fraser.
2956
2957         Update CSS properties and values api feature in features.json
2958
2959         * features.json:
2960
2961 2018-09-27  Jer Noble  <jer.noble@apple.com>
2962
2963         MediaPlayer should have mediaPlayerWaitingForKeyChanged() / bool waitingForKey() accessor
2964         https://bugs.webkit.org/show_bug.cgi?id=189951
2965
2966         Reviewed by Eric Carlson.
2967
2968         In order to implement the "Resume Playback" section of EME, part 4, we need to be able
2969         to query whether the MediaPlayer is still waiting for a key after attemptToDecrypt()
2970         has been called. Currently this involves no behavioral changes, as all modern EME ports
2971         will still just notify the media element that they no longer need keys after one has
2972         been added, but future ports may be able to wait for multiple keys before reporting
2973         that it is no longer waiting for keys.
2974
2975         * html/HTMLMediaElement.cpp:
2976         (WebCore::HTMLMediaElement::mediaPlayerWaitingForKeyChanged):
2977         (WebCore::HTMLMediaElement::attemptToResumePlaybackIfNecessary):
2978         (WebCore::HTMLMediaElement::mediaPlayerWaitingForKey): Deleted.
2979         * html/HTMLMediaElement.h:
2980         * platform/graphics/MediaPlayer.cpp:
2981         (WebCore::MediaPlayer::waitingForKeyChanged):
2982         (WebCore::MediaPlayer::waitingForKey const):
2983         (WebCore::MediaPlayer::waitingForKey): Deleted.
2984         * platform/graphics/MediaPlayer.h:
2985         (WebCore::MediaPlayerClient::mediaPlayerWaitingForKeyChanged):
2986         (WebCore::MediaPlayerClient::mediaPlayerWaitingForKey): Deleted.
2987         * platform/graphics/MediaPlayerPrivate.h:
2988         (WebCore::MediaPlayerPrivateInterface::waitingForKey const):
2989         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2990         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2991         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
2992         (WebCore::MediaPlayerPrivateAVFoundationObjC::attemptToDecryptWithInstance):
2993         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2994         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2995         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::attemptToDecryptWithInstance):
2996         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitingForKey const):
2997         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitingForKeyChanged):
2998         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::initializationDataEncountered):
2999         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
3000         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3001         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
3002         (WebCore::SourceBufferPrivateAVFObjC::attemptToDecrypt):
3003         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3004         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
3005         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3006         (WebCore::MediaPlayerPrivateGStreamerBase::reportWaitingForKey):
3007         (WebCore::MediaPlayerPrivateGStreamerBase::setWaitingForKey):
3008         (WebCore::MediaPlayerPrivateGStreamerBase::waitingForKey const):
3009         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3010         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
3011         (webkitMediaCommonEncryptionDecryptSinkEventHandler):
3012
3013 2018-09-27  Alicia Boya García  <aboya@igalia.com>
3014
3015         [MSE] Fix unwanted sample erase from the decode queue
3016         https://bugs.webkit.org/show_bug.cgi?id=180643
3017
3018         Reviewed by Jer Noble.
3019
3020         Test: media/media-source/media-source-append-acb-no-frame-lost.html
3021
3022         This bug reproduced when unordered appends were made. For instance, if
3023         the application appended [0, 10) and then [20, 30), the frame at 20
3024         would be wrongly discarded from the decode queue.
3025
3026         Later the application could append [10, 20) and the gap at [20, 21)
3027         would persist in the decode queue, even if the frame remained in the
3028         track buffer table.
3029
3030         Thanks to Daniel Zhang for reporting the issue.
3031
3032         * Modules/mediasource/SourceBuffer.cpp:
3033         (WebCore::SourceBuffer::provideMediaData):
3034
3035 2018-09-27  Alex Christensen  <achristensen@webkit.org>
3036
3037         URLParser should use TextEncoding through an abstract class
3038         https://bugs.webkit.org/show_bug.cgi?id=190027
3039
3040         Reviewed by Andy Estes.
3041
3042         URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings.
3043         There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time.
3044         All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding.
3045         Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project
3046         without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore.
3047
3048         There is no observable change in behavior.  There is now one virtual function call in a code path in URLParser that is not performance-sensitive,
3049         and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit.
3050
3051         * css/parser/CSSParserContext.h:
3052         (WebCore::CSSParserContext::completeURL const):
3053         * css/parser/CSSParserIdioms.cpp:
3054         (WebCore::completeURL):
3055         * dom/Document.cpp:
3056         (WebCore::Document::completeURL const):
3057         * html/HTMLBaseElement.cpp:
3058         (WebCore::HTMLBaseElement::href const):
3059         Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document.
3060         * loader/FormSubmission.cpp:
3061         (WebCore::FormSubmission::create):
3062         * loader/TextResourceDecoder.cpp:
3063         (WebCore::TextResourceDecoder::encodingForURLParsing):
3064         * loader/TextResourceDecoder.h:
3065         * platform/URL.cpp:
3066         (WebCore::URL::URL):
3067         * platform/URL.h:
3068         (WebCore::URLTextEncoding::~URLTextEncoding):
3069         * platform/URLParser.cpp:
3070         (WebCore::URLParser::encodeNonUTF8Query):
3071         (WebCore::URLParser::copyURLPartsUntil):
3072         (WebCore::URLParser::URLParser):
3073         (WebCore::URLParser::parse):
3074         (WebCore::URLParser::encodeQuery): Deleted.
3075         A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding.
3076         Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding.
3077         * platform/URLParser.h:
3078         (WebCore::URLParser::URLParser):
3079         * platform/text/TextEncoding.cpp:
3080         (WebCore::UTF7Encoding):
3081         (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const):
3082         (WebCore::ASCIIEncoding):
3083         (WebCore::Latin1Encoding):
3084         (WebCore::UTF16BigEndianEncoding):
3085         (WebCore::UTF16LittleEndianEncoding):
3086         (WebCore::UTF8Encoding):
3087         (WebCore::WindowsLatin1Encoding):
3088         (WebCore::TextEncoding::encodingForFormSubmission const): Deleted.
3089         Use NeverDestroyed because TextEncoding now has a virtual destructor.
3090         * platform/text/TextEncoding.h:
3091         Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both.
3092
3093 2018-09-27  John Wilander  <wilander@apple.com>
3094
3095         Resource Load Statistics: Remove temporary compatibility fix for auto-dismiss popups
3096         https://bugs.webkit.org/show_bug.cgi?id=189980
3097         <rdar://problem/44780645>
3098
3099         Reviewed by Alex Christensen.
3100
3101         Test: http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss.html
3102
3103         The change in https://bugs.webkit.org/show_bug.cgi?id=183620 was a temporary
3104         compatibility fix as explained in:
3105         https://webkit.org/blog/8311/intelligent-tracking-prevention-2-0/. We should
3106         remove it.
3107
3108         Most of these changes remove the parameter isTriggeredByUserGesture since it's no longer needed.
3109
3110         * loader/ResourceLoadObserver.cpp:
3111         (WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
3112         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3113         (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
3114         (WebCore::ResourceLoadObserver::logWindowCreation): Deleted.
3115         * loader/ResourceLoadObserver.h:
3116         * page/DOMWindow.cpp:
3117         (WebCore::DOMWindow::createWindow):
3118             Now no longer logs anything to ResourceLoadObserver.
3119
3120 2018-09-27  Ryan Haddad  <ryanhaddad@apple.com>
3121
3122         Unreviewed, rolling out r236557.
3123
3124         Really roll out r236557 this time because it breaks internal
3125         builds.
3126
3127         Reverted changeset:
3128
3129         "Add VP8 support to WebRTC"
3130         https://bugs.webkit.org/show_bug.cgi?id=189976
3131         https://trac.webkit.org/changeset/236557
3132
3133 2018-09-27  Chris Dumez  <cdumez@apple.com>
3134
3135         Fragment should be stripped from document URL during document.open() URL propagation
3136         https://bugs.webkit.org/show_bug.cgi?id=189374
3137         <rdar://problem/44282736>
3138
3139         Reviewed by Alex Christensen.
3140
3141         Strip the Document URL fragment during document.open() URL propagation if the entry document
3142         is not the current document, as per:
3143         - https://html.spec.whatwg.org/#document-open-steps (Step 11.2.)
3144
3145         No new tests, rebaselined existing test.
3146
3147         * dom/Document.cpp:
3148         (WebCore::Document::open):
3149
3150 2018-09-27  Youenn Fablet  <youenn@apple.com>
3151
3152         Add VP8 support to WebRTC
3153         https://bugs.webkit.org/show_bug.cgi?id=189976
3154
3155         Reviewed by Eric Carlson.
3156
3157         Add a runtime flag to control activation of VP8 codec.
3158         Bind this runtime flag to the video codec factories.
3159         Test: webrtc/video-mute-vp8.html
3160
3161         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3162         (WebCore::createLibWebRTCPeerConnectionBackend):
3163         * page/RuntimeEnabledFeatures.h:
3164         (WebCore::RuntimeEnabledFeatures::webRTCVP8CodecEnabled const):
3165         (WebCore::RuntimeEnabledFeatures::setWebRTCVP8CodecEnabled):
3166         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
3167         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
3168         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
3169         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
3170         * testing/Internals.cpp:
3171         (WebCore::Internals::resetToConsistentState):
3172         Enable VP8 codec for tests.
3173
3174 2018-09-27  Chris Dumez  <cdumez@apple.com>
3175
3176         Crash under WebCore::deleteCookiesForHostnames()
3177         https://bugs.webkit.org/show_bug.cgi?id=190040
3178         <rdar://problem/38020368>
3179
3180         Reviewed by Alex Christensen.
3181
3182         Update NetworkStorageSession::deleteCookiesForHostnames() to properly deal with the fact
3183         that NSHTTPCookie.domain can return nil.
3184
3185         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
3186         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
3187
3188 2018-09-27  Youenn Fablet  <youenn@apple.com>
3189
3190         Use kCVPixelFormatType_420YpCbCr8Planar for capturing frames
3191         https://bugs.webkit.org/show_bug.cgi?id=190014
3192
3193         Reviewed by Eric Carlson.
3194
3195         On Mac, rely on the monoplanar format which can be displayed without any issue.
3196         Once rendering is fixed, we should change it back to biplanar as it is closer to what libwebrtc consumes.
3197         Covered by manual testing.
3198
3199         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3200         (WebCore::avVideoCapturePixelBufferFormat):
3201         (WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset):
3202         (WebCore::AVVideoCaptureSource::setupCaptureSession):
3203         (WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
3204
3205 2018-09-27  Andy Estes  <aestes@apple.com>
3206
3207         [Apple Pay] Support granular errors in PaymentDetailsUpdate
3208         https://bugs.webkit.org/show_bug.cgi?id=189938
3209
3210         Reviewed by Youenn Fablet.
3211
3212         Implemented the shippingAddressErrors, payerErrors, and paymentMethodErrors properties on
3213         PaymentDetailsUpdate, as specified in the Payment Request API W3C Editor's Draft of
3214         26 September 2018.
3215
3216         When these errors are specified in a PaymentDetailsUpdate, map them to PaymentErrors. For
3217         shippingAddressErrors and payerErrors, we use the "shippingContactInvalid" code and a
3218         contact field that matches the shippingAddressError or payerError property specified.
3219
3220         For paymentMethodErrors, we interpret this as a sequence of ApplePayErrors, which are
3221         converted to PaymentErrors as in Apple Pay JS.
3222
3223         Tests: http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrors.https.html
3224                http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrorsV3.https.html
3225
3226         * DerivedSources.make: Removed some tabs and added new .idl files.
3227         * Modules/applepay/ApplePayError.idl: Moved ApplePayErrorCode and ApplePayErrorContactField
3228         into their own .idl files so they can be used in MockPaymentError.
3229         * Modules/applepay/ApplePayErrorCode.h: Added.
3230         * Modules/applepay/ApplePayErrorCode.idl: Added.
3231         * Modules/applepay/ApplePayErrorContactField.h: Added.
3232         * Modules/applepay/ApplePayErrorContactField.idl: Added.
3233
3234         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
3235         (WebCore::appendShippingContactInvalidError): Appended a "shippingContactInvalid"
3236         PaymentError to errors if the message is non-null.
3237         (WebCore::ApplePayPaymentHandler::computeErrors const):
3238         (WebCore::ApplePayPaymentHandler::detailsUpdated):
3239         (WebCore::ApplePayPaymentHandler::shippingAddressUpdated): Computed a vector of PaymentErrors
3240         based on shippingAddressErrors, payerErrors, and paymentMethodErrors.
3241
3242         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
3243
3244         * Modules/paymentrequest/PaymentDetailsUpdate.h:
3245         * Modules/paymentrequest/PaymentDetailsUpdate.idl: Defined shippingAddressErrors,
3246         payerErrors, and paymentMethodErrors.
3247
3248         * Modules/paymentrequest/PaymentHandler.h:
3249         * Modules/paymentrequest/PaymentRequest.cpp:
3250         (WebCore::PaymentRequest::paymentMethodChanged):
3251         (WebCore::PaymentRequest::settleDetailsPromise): Passed shippingAddressErrors, payerErrors,
3252         and paymentMethodErrors to the payment handler.
3253
3254         * SourcesCocoa.txt:
3255         * WebCore.xcodeproj/project.pbxproj:
3256
3257         * testing/MockPaymentCoordinator.cpp:
3258         (WebCore::MockPaymentCoordinator::completeShippingContactSelection): Stored errors in m_errors.
3259         * testing/MockPaymentCoordinator.h:
3260         * testing/MockPaymentCoordinator.idl: Added an errors attribute.
3261
3262         * testing/MockPaymentError.h: Added.
3263         * testing/MockPaymentError.idl: Added.
3264
3265 2018-09-27  Alex Christensen  <achristensen@webkit.org>
3266
3267         URLWithUserTypedString should return nil for URLs deemed to be invalid by WebCore::URL
3268         https://bugs.webkit.org/show_bug.cgi?id=189979
3269
3270         Reviewed by Youenn Fablet.
3271
3272         * platform/mac/WebCoreNSURLExtras.mm:
3273         (WebCore::URLWithUserTypedString):
3274         (WebCore::dataForURLComponentType):
3275         (WebCore::URLByRemovingComponentAndSubsequentCharacter):
3276         (WebCore::URLByCanonicalizingURL):
3277         (WebCore::originalURLData):
3278         (WebCore::userVisibleString):
3279
3280 2018-09-27  Chris Dumez  <cdumez@apple.com>
3281
3282         document.open() should not propagate URLs to non-fully active documents
3283         https://bugs.webkit.org/show_bug.cgi?id=189375
3284         <rdar://problem/44282755>
3285
3286         Reviewed by Youenn Fablet.
3287
3288         Update our document.open() to not propagate URLs to non-fully active documents, as per:
3289         - https://html.spec.whatwg.org/#document-open-steps (Step 11)
3290
3291         A "fully active" document is defined by at:
3292         - https://html.spec.whatwg.org/#fully-active
3293
3294         No new tests, rebaselined existing test.
3295
3296         * dom/Document.cpp:
3297         (WebCore::Document::open):
3298         (WebCore::Document::isFullyActive const):
3299         * dom/Document.h:
3300         * dom/Document.idl:
3301
3302 2018-09-27  Alicia Boya García  <aboya@igalia.com>
3303
3304         [MSE][GStreamer] Use sentinel buffer to detect end of append
3305         https://bugs.webkit.org/show_bug.cgi?id=189924
3306
3307         Reviewed by Philippe Normand.
3308
3309         This patch introduces a new mechanism to detect when an append has
3310         been consumed completely by the demuxer. It takes advantage of the
3311         fact that buffer pushing is synchronous: both the appsrc and the
3312         demuxer live in the same streaming thread. When appsrc pushes a
3313         buffer, it's actually making a qtdemux function call (it calls its
3314         "chain" function). The demuxer will return from that call when it has
3315         finished processing that buffer; only then the control returns to
3316         appsrc, that can push the next buffer.
3317
3318         By pushing an additional buffer and capturing it in a probe we can
3319         detect reliably when the previous buffer has been processed.
3320         Because the pipeline only has one thread, at this point no more frames
3321         can arrive to the appsink.
3322
3323         This replaces the old method of detecting end of append which relied
3324         on the `need-data` event, which is more difficult to handle correctly
3325         because it fires whenever the appsrc is empty (or below a given
3326         level), which also happens when a buffer has not been pushed yet or
3327         in response to a flush.
3328
3329         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3330         (WebCore::EndOfAppendMeta::init):
3331         (WebCore::EndOfAppendMeta::transform):
3332         (WebCore::EndOfAppendMeta::free):
3333         (WebCore::AppendPipeline::staticInitialization):
3334         (WebCore::AppendPipeline::AppendPipeline):
3335         (WebCore::AppendPipeline::~AppendPipeline):
3336         (WebCore::AppendPipeline::appsrcEndOfAppendCheckerProbe):
3337         (WebCore::AppendPipeline::handleApplicationMessage):
3338         (WebCore::AppendPipeline::handleEndOfAppend):
3339         (WebCore::AppendPipeline::consumeAppsinkAvailableSamples):
3340         (WebCore::AppendPipeline::resetPipeline):
3341         (WebCore::AppendPipeline::pushNewBuffer):
3342         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived): Deleted.:
3343         (WebCore::AppendPipeline::handleAppsrcAtLeastABufferLeft): Deleted.
3344         (WebCore::AppendPipeline::checkEndOfAppend): Deleted.
3345         (WebCore::AppendPipeline::setAppsrcDataLeavingProbe): Deleted.
3346         (WebCore::AppendPipeline::removeAppsrcDataLeavingProbe): Deleted.
3347         (WebCore::AppendPipeline::reportAppsrcAtLeastABufferLeft): Deleted.
3348         (WebCore::AppendPipeline::reportAppsrcNeedDataReceived): Deleted.
3349         (WebCore::appendPipelineAppsrcDataLeaving): Deleted.
3350         (WebCore::appendPipelineAppsrcNeedData): Deleted.
3351         * platform/graphics/gstreamer/mse/AppendPipeline.h:
3352
3353 2018-09-27  Chris Dumez  <cdumez@apple.com>
3354
3355         The WebContent process should not process incoming IPC while waiting for a sync IPC reply
3356         https://bugs.webkit.org/show_bug.cgi?id=184183
3357         <rdar://problem/36800576>
3358
3359         Reviewed by Ryosuke Niwa.
3360
3361         Drop test infrastructure for the DoNotProcessIncomingMessagesWhenWaitingForSyncReply IPC::SendOption
3362         given that this SendOption was removed from this patch.
3363
3364         * page/ChromeClient.h:
3365         * testing/Internals.cpp:
3366         * testing/Internals.h:
3367         * testing/Internals.idl:
3368
3369 2018-09-27  Philippe Normand  <pnormand@igalia.com>
3370
3371         Unreviewed, GTK Ubuntu LTS build fix attempt after r236396.
3372
3373         * platform/graphics/gstreamer/GStreamerCommon.h:
3374
3375 2018-09-27  Antoine Quint  <graouts@apple.com>
3376
3377         [Web Animations] Turn Web Animations with CSS integration on
3378         https://bugs.webkit.org/show_bug.cgi?id=184819
3379         <rdar://problem/39597337>
3380
3381         Reviewed by Dean Jackson.
3382
3383         * page/RuntimeEnabledFeatures.h:
3384
3385 2018-09-26  YUHAN WU  <yuhan_wu@apple.com>
3386
3387         Video track clone cannot preserve original property
3388         https://bugs.webkit.org/show_bug.cgi?id=189872
3389         <rdar://problem/44706579>
3390
3391         Reviewed by Youenn Fablet.
3392
3393         Fix the issue that the cloned track created by canvas.captureStream().getVideoTracks() cannot keep some attributes, such as enabled.
3394         Updated a testcase expected result:
3395         LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/MediaStreamTrack-contentHint.html
3396