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