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