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