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