Add binding tests for ContextAllowsMediaDevices and ContextHasServiceWorkerScheme
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-02-15  Youenn Fablet  <youenn@apple.com>
2
3         Add binding tests for ContextAllowsMediaDevices and ContextHasServiceWorkerScheme
4         https://bugs.webkit.org/show_bug.cgi?id=194713
5
6         Reviewed by Eric Carlson.
7
8         Binding tests covering mediaDevices and serviceWorker attributes.
9
10         * bindings/scripts/test/JS/JSTestObj.cpp:
11         (WebCore::JSTestObjPrototype::finishCreation):
12         (WebCore::jsTestObjMediaDevices1Getter):
13         (WebCore::jsTestObjMediaDevices1):
14         (WebCore::jsTestObjMediaDevices2Getter):
15         (WebCore::jsTestObjMediaDevices2):
16         (WebCore::jsTestObjServiceWorkers1Getter):
17         (WebCore::jsTestObjServiceWorkers1):
18         (WebCore::jsTestObjServiceWorkers2Getter):
19         (WebCore::jsTestObjServiceWorkers2):
20         * bindings/scripts/test/TestObj.idl:
21
22 2019-02-15  Beth Dakin  <bdakin@apple.com>
23
24         Build fix.
25
26         * rendering/RenderThemeIOS.mm:
27         (WebCore::iconForAttachment):
28
29 2019-02-15  Youenn Fablet  <youenn@apple.com>
30
31         Make ServiceWorkerClientFetch closer to WebResourceLoader
32         https://bugs.webkit.org/show_bug.cgi?id=194651
33
34         Reviewed by Alex Christensen.
35
36         Check for redirection response and if so call a specific client API.
37         Ensure ServiceWorkerFetch::Client gets called in the service worker thread proxy
38         so that its m_connection is only accessed on that thread.
39
40         Covered by existing tests.
41
42         * platform/network/FormData.h:
43         * platform/network/ResourceErrorBase.h:
44         * workers/service/context/ServiceWorkerFetch.cpp:
45         (WebCore::ServiceWorkerFetch::processResponse):
46         * workers/service/context/ServiceWorkerFetch.h:
47         * workers/service/context/ServiceWorkerThreadProxy.cpp:
48         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
49         (WebCore::ServiceWorkerThreadProxy::continueDidReceiveFetchResponse):
50         * workers/service/context/ServiceWorkerThreadProxy.h:
51
52 2019-02-15  Youenn Fablet  <youenn@apple.com>
53
54         Make navigator.mediaDevices SecureContext
55         https://bugs.webkit.org/show_bug.cgi?id=194666
56
57         Reviewed by Eric Carlson.
58
59         Make navigator.mediaDevices SecureContext.
60         This can still be enabled for unsecure context using the existing page settings.
61         To cover that case, introduce ContextHasMediaDevices custom IDL keyword.
62
63         Covered by API test.
64
65         * Modules/mediastream/NavigatorMediaDevices.idl:
66         * bindings/scripts/CodeGeneratorJS.pm:
67         (GenerateRuntimeEnableConditionalString):
68         * bindings/scripts/IDLAttributes.json:
69         * dom/ScriptExecutionContext.cpp:
70         (WebCore::ScriptExecutionContext::hasMediaDevices const):
71         (WebCore::ScriptExecutionContext::hasServiceWorkerScheme const):
72         * dom/ScriptExecutionContext.h:
73
74 2019-02-15  Youenn Fablet  <youenn@apple.com>
75
76         WebSocket should not fire events after being stopped
77         https://bugs.webkit.org/show_bug.cgi?id=194690
78
79         Reviewed by Geoffrey Garen.
80
81         dispatchOrQueueErrorEvent is scheduled using RunLoop::main().dispatch or dispatch_async.
82         This makes it possible to dispatch an event while WebSocket is already stopped.
83         Instead, use Document::postTask so that the task is only executed if WebSocket is not stopped.
84
85         As a refactoring, make use of PendingActivity to keep track of setPendingActivity/unsetPendingActivity more easily.
86
87         * Modules/websockets/WebSocket.cpp:
88         (WebCore::WebSocket::stop):
89         (WebCore::WebSocket::connect):
90         * Modules/websockets/WebSocket.h:
91
92 2019-02-15  Youenn Fablet  <youenn@apple.com>
93
94         Performance should not fire events when its context is stopped
95         https://bugs.webkit.org/show_bug.cgi?id=194689
96
97         Reviewed by Alex Christensen.
98
99         Stop the timer when its context is destroyed.
100         Add an assertion to ensure the timer does not fire after context is destroyed.
101
102         * page/Performance.cpp:
103         (WebCore::Performance::stop):
104
105 2019-02-15  Alex Christensen  <achristensen@webkit.org>
106
107         REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
108         https://bugs.webkit.org/show_bug.cgi?id=194523
109
110         Reviewed by Geoffrey Garen.
111
112         The scope of the FormCreationContext was limited to the scope of createHTTPBodyCFReadStream,
113         so when it was used in formCreate it was lucky to get the same context if the stack hadn't been overwritten
114         and if the FormData hadn't been freed.  Instead, keep it alive with new/delete like we do the FormStreamFields.
115         A younger me should've noticed this when reviewing r218517.
116
117         * platform/network/cf/FormDataStreamCFNet.cpp:
118         (WebCore::formCreate):
119         (WebCore::createHTTPBodyCFReadStream):
120
121 2019-02-15  Commit Queue  <commit-queue@webkit.org>
122
123         Unreviewed, rolling out r241559 and r241566.
124         https://bugs.webkit.org/show_bug.cgi?id=194710
125
126         Causes layout test crashes under GuardMalloc (Requested by
127         ryanhaddad on #webkit).
128
129         Reverted changesets:
130
131         "[WTF] Add environment variable helpers"
132         https://bugs.webkit.org/show_bug.cgi?id=192405
133         https://trac.webkit.org/changeset/241559
134
135         "Unreviewed build fix for WinCairo Debug after r241559."
136         https://trac.webkit.org/changeset/241566
137
138 2019-02-15  Youenn Fablet  <youenn@apple.com>
139
140         Stop the endpoint synchronously in RTCPeerConnection::close
141         https://bugs.webkit.org/show_bug.cgi?id=194688
142
143         Reviewed by Eric Carlson.
144
145         In the case where the peer connection is being closed, it was asynchronously stopping the endpoint.
146         But the endpoint, before being stopped, could try to fire an event.
147         If the context is gone in between, we end up with a null pointer dereference.
148
149         * Modules/mediastream/RTCPeerConnection.cpp:
150         (WebCore::RTCPeerConnection::close):
151
152 2019-02-15  Zalan Bujtas  <zalan@apple.com>
153
154         [LFC] Out-of-flow box is never a float box
155         https://bugs.webkit.org/show_bug.cgi?id=194704
156
157         Reviewed by Antti Koivisto.
158
159         We can't have it both ways. Absolute positioning wins.
160
161         Test: fast/block/block-only/out-of-flow-is-never-float-box.html
162
163         * layout/layouttree/LayoutBox.cpp:
164         (WebCore::Layout::Box::isFloatingPositioned const):
165         (WebCore::Layout::Box::isLeftFloatingPositioned const):
166         (WebCore::Layout::Box::isRightFloatingPositioned const):
167
168 2019-02-15  Philippe Normand  <pnormand@igalia.com>
169
170         [GStreamer] Simplify GObject class name check
171         https://bugs.webkit.org/show_bug.cgi?id=194537
172
173         Reviewed by Michael Catanzaro.
174
175         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
176         (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback):
177         Use G_OBJECT_TYPE_NAME() to filter out uridecodebin child
178         elements.
179
180 2019-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>
181
182         Refactor EditingStyle::textDirection to return an Optional<WritingDirection> instead of a bool
183         https://bugs.webkit.org/show_bug.cgi?id=194686
184
185         Reviewed by Ryosuke Niwa.
186
187         Changes EditingStyle::textDirection to return an Optional<WritingDirection>, instead of taking a reference to
188         the resulting WritingDirection. No change in behavior.
189
190         * editing/ApplyStyleCommand.cpp:
191         (WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi):
192         (WebCore::ApplyStyleCommand::applyInlineStyle):
193         * editing/EditingStyle.cpp:
194         (WebCore::EditingStyle::textDirection const):
195         (WebCore::EditingStyle::textDirectionForSelection):
196         * editing/EditingStyle.h:
197
198 2019-02-10  Darin Adler  <darin@apple.com>
199
200         Replace more uses of String::format with StringConcatenate (mostly non-Apple platform-specific cases)
201         https://bugs.webkit.org/show_bug.cgi?id=194487
202
203         Reviewed by Daniel Bates.
204
205         * accessibility/win/AccessibilityObjectWrapperWin.cpp:
206         (WebCore::AccessibilityObjectWrapper::accessibilityAttributeValue): Use makeString
207         instead of String::format.
208
209         * page/linux/ResourceUsageOverlayLinux.cpp:
210         (WebCore::formatByteNumber): Use String::number instead of String::format.
211
212         * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
213         (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
214         Use makeString instead of String::format.
215         * platform/glib/UserAgentGLib.cpp:
216         (WebCore::platformVersionForUAString): Ditto.
217         * platform/graphics/gstreamer/GStreamerCommon.cpp:
218         (WebCore::simpleBusMessageCallback): Ditto.
219         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
220         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Ditto.
221         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
222         (WebCore::AppendPipeline::AppendPipeline): Ditto.
223         (WebCore::AppendPipeline::handleStateChangeMessage): Ditto.
224         (WebCore::AppendPipeline::resetParserState): Ditto.
225         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
226         (WebCore::MediaPlayerPrivateGStreamerMSE::load): Ditto.
227         (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek): Ditto.
228
229         * platform/graphics/gtk/ImageBufferGtk.cpp:
230         (WebCore::encodeImage): Use String::number instead of String::format.
231
232         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
233         (WebCore::GStreamerAudioCaptureSource::create): Use makeString instead of
234         String::format.
235         * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:
236         (WebCore::GStreamerCaptureDeviceManager::addDevice): Ditto.
237         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
238         (WebCore::webkitMediaStreamSrcAddPad): Ditto.
239         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
240         (WebCore::GStreamerVideoCaptureSource::create): Ditto.
241         * platform/network/curl/CookieJarDB.cpp:
242         (WebCore::CookieJarDB::verifySchemaVersion): Ditto.
243         * platform/win/SearchPopupMenuDB.cpp:
244         (WebCore::SearchPopupMenuDB::verifySchemaVersion): Ditto.
245
246 2019-02-15  Philippe Normand  <pnormand@igalia.com>
247
248         [GStreamer] Decoding media-capabilities configuration initial support
249         https://bugs.webkit.org/show_bug.cgi?id=191191
250
251         Reviewed by Xabier Rodriguez-Calvar.
252
253         This patch enables basic platform probing for GStreamer decoders,
254         optionally using Hardware decoding capabilities. The previous code
255         for decoders/demuxers probing partially duplicated between the MSE
256         player and its parent class was moved to a new module called
257         GStreamerRegistryScanner. There is one instance of it for the MSE player
258         and one for the parent class.
259
260         The scanner can check for the presence of the GstElement Hardware
261         metadata classifier in decoders and thus advise the
262         MediaEngineConfigurationFactoryGStreamer that hardware decoding is
263         supported or not. This is only a first step though. The scanner
264         should also probably attempt a NULL->READY transition on decoders
265         to validate specific input caps are supported. As this might
266         require changes in GStreamer, this part of the patch wasn't
267         included.
268
269         This patch is covered by the existing media tests.
270
271         * platform/GStreamer.cmake: New files.
272         * platform/graphics/MediaPlayer.cpp: Add support for converting
273         SupportsType enum to string.
274         (WebCore::convertEnumerationToString):
275         * platform/graphics/MediaPlayer.h: Ditto.
276         * platform/graphics/MediaPlayerEnums.h: Ditto.
277         * platform/graphics/gstreamer/GStreamerCommon.cpp: Move
278         gstRegistryHasElementForMediaType to GStreamerRegistryScanner.
279         * platform/graphics/gstreamer/GStreamerCommon.h: Ditto.
280         * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp: Added.
281         (WebCore::GStreamerRegistryScanner::singleton):
282         (WebCore::GStreamerRegistryScanner::GStreamerRegistryScanner): Initialize
283         supported mime-types and codecs from the GStreamer registry.
284         (WebCore::GStreamerRegistryScanner::~GStreamerRegistryScanner): Free the element factories.
285         (WebCore::GStreamerRegistryScanner::gstRegistryHasElementForMediaType):
286         Check the input caps are supported, optionally using hardware
287         device.
288         (WebCore::GStreamerRegistryScanner::fillMimeTypeSetFromCapsMapping):
289         Moved from MediaPlayerPrivateGStreamer{,MSE}.
290         (WebCore::GStreamerRegistryScanner::initialize): Ditto.
291         (WebCore::GStreamerRegistryScanner::supportsCodec const): Ditto.
292         (WebCore::GStreamerRegistryScanner::supportsAllCodecs const): Ditto.
293         (WebCore::GStreamerRegistryScanner::isDecodingSupported const): Check
294         the given configuration is supported. For now hardware support is
295         checked for video configurations only as it is quite uncommon
296         anyway to have hardware-enabled audio decoders.
297         * platform/graphics/gstreamer/GStreamerRegistryScanner.h: Added.
298         (WebCore::GStreamerRegistryScanner::mimeTypeSet):
299         (WebCore::GStreamerRegistryScanner::supportsContainerType const):
300         (WebCore::GStreamerRegistryScanner::RegistryLookupResult::operator bool const):
301         * platform/graphics/gstreamer/MediaEngineConfigurationFactoryGStreamer.cpp: Added.
302         (WebCore::createMediaPlayerDecodingConfigurationGStreamer):
303         * platform/graphics/gstreamer/MediaEngineConfigurationFactoryGStreamer.h: Added.
304         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
305         Rely on new GStreamerRegistryScanner and add some debugging macros.
306         (WebCore::MediaPlayerPrivateGStreamer::getSupportedTypes):
307         (WebCore::MediaPlayerPrivateGStreamer::supportsType):
308         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Ditto. Also
309         plug qtdemux for AAC containers, this is an explicit consequence
310         of finer-grained codecs probing.
311         (WebCore::AppendPipeline::AppendPipeline):
312         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
313         * platform/graphics/gstreamer/mse/GStreamerRegistryScannerMSE.cpp: Added.
314         (WebCore::GStreamerRegistryScannerMSE::singleton):
315         (WebCore::GStreamerRegistryScannerMSE::GStreamerRegistryScannerMSE):
316         * platform/graphics/gstreamer/mse/GStreamerRegistryScannerMSE.h: Added.
317         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
318         Rely on new GStreamerRegistryScanner and add some debugging macros.
319         (WebCore::MediaPlayerPrivateGStreamerMSE::getSupportedTypes):
320         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType):
321         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
322         * platform/mediacapabilities/MediaEngineConfigurationFactory.cpp:
323         (WebCore::factories): GStreamer support.
324
325 2019-02-14  Joseph Pecoraro  <pecoraro@apple.com>
326
327         Web Inspector: Occasional crash under WebCore::CSSStyleSheet::item called from Inspector
328         https://bugs.webkit.org/show_bug.cgi?id=194671
329         <rdar://problem/47628191>
330
331         Reviewed by Devin Rousso.
332
333         * css/CSSStyleSheet.cpp:
334         (WebCore::CSSStyleSheet::item):
335         A crash may happen if the m_childRuleCSSOMWrappers Vector gets out of
336         sync with the m_contents list of rules. In particular if the wrappers
337         vector is shorter than the rule list. We tried exercising code paths
338         that modify these lists but were not able to reproduce the crash.
339         To avoid a crash we can make this access safer and avoid the original
340         overflow. At the same time we will keep and promote the assertion that
341         would catch the lists getting out of sync in debug builds.
342
343 2019-02-14  Ross Kirsling  <ross.kirsling@sony.com>
344
345         Unreviewed build fix for WinCairo Debug after r241559.
346
347         * platform/network/curl/CurlContext.cpp:
348         (WebCore::CurlContext::CurlContext):
349
350 2019-02-14  Ross Kirsling  <ross.kirsling@sony.com>
351
352         [WTF] Add environment variable helpers
353         https://bugs.webkit.org/show_bug.cgi?id=192405
354
355         Reviewed by Michael Catanzaro.
356
357         * platform/NotImplemented.h:
358         * platform/cocoa/SystemVersion.mm:
359         (WebCore::createSystemMarketingVersion):
360         * platform/graphics/gstreamer/GStreamerCommon.cpp:
361         (WebCore::initializeGStreamer):
362         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
363         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
364         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
365         (Nicosia::PaintingEngine::create):
366         * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
367         (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
368         * platform/graphics/x11/PlatformDisplayX11.cpp:
369         (WebCore::PlatformDisplayX11::create):
370         * platform/gtk/RenderThemeWidget.cpp:
371         (WebCore::RenderThemeScrollbar::RenderThemeScrollbar):
372         * platform/gtk/ScrollbarThemeGtk.cpp:
373         (WebCore::ScrollbarThemeGtk::ScrollbarThemeGtk):
374         * platform/network/curl/CurlContext.cpp:
375         (WebCore::CurlContext::CurlContext):
376         (WebCore::EnvironmentVariableReader::read): Deleted.
377         (WebCore::EnvironmentVariableReader::defined): Deleted.
378         (WebCore::EnvironmentVariableReader::readAs): Deleted.
379         (WebCore::EnvironmentVariableReader::sscanTemplate): Deleted.
380         (WebCore::EnvironmentVariableReader::sscanTemplate<signed>): Deleted.
381         (WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>): Deleted.
382         * platform/network/curl/NetworkStorageSessionCurl.cpp:
383         (WebCore::defaultCookieJarPath):
384         * platform/network/playstation/CurlSSLHandlePlayStation.cpp:
385         (WebCore::getCACertPathEnv):
386         * platform/network/win/CurlSSLHandleWin.cpp:
387         (WebCore::getCACertPathEnv):
388         * platform/text/hyphen/HyphenationLibHyphen.cpp:
389         (WebCore::topLevelPath):
390         (WebCore::webkitBuildDirectory):
391         * platform/unix/LoggingUnix.cpp:
392         (WebCore::logLevelString):
393         * platform/win/LoggingWin.cpp:
394         (WebCore::logLevelString):
395         Utilize WTF::Environment where possible.
396
397 2019-02-14  Chris Dumez  <cdumez@apple.com>
398
399         [PSON] Introduce a WebContent Process cache
400         https://bugs.webkit.org/show_bug.cgi?id=194594
401         <rdar://problem/46793397>
402
403         Reviewed by Geoff Garen.
404
405         Update localizable strings.
406
407         * en.lproj/Localizable.strings:
408
409 2019-02-14  Commit Queue  <commit-queue@webkit.org>
410
411         Unreviewed, rolling out r241486.
412         https://bugs.webkit.org/show_bug.cgi?id=194655
413
414         causing API failures in builds (Requested by ShawnRoberts on
415         #webkit).
416
417         Reverted changeset:
418
419         "[Cocoa] Media elements will restart network buffering just
420         before suspending"
421         https://bugs.webkit.org/show_bug.cgi?id=193691
422         https://trac.webkit.org/changeset/241486
423
424 2019-02-13  Brian Burg  <bburg@apple.com>
425
426         Web Inspector: don't include accessibility role in DOM.Node object payloads
427         https://bugs.webkit.org/show_bug.cgi?id=194623
428         <rdar://problem/36384037>
429
430         Reviewed by Devin Rousso.
431
432         Accessibility properties are complicated to fetch at all the points where we want to build and push nodes immediately.
433         Turning on AX often indirectly causes style recalc and layout. This is bad because we are often building nodes in the
434         first place due to a DOM node tree update (i.e., NodeInserted).
435
436         It turns out that DOM.getAccessibilityPropertiesForNode is called every time we display
437         the computed role in the Elements Tab > Nodes Sidebar > Accessibility Section. So it is not
438         necessary to collect this information in a problematic way when initially pushing the node, as
439         it will be updated anyway.
440
441         No new tests, no change in behavior.
442
443         * inspector/agents/InspectorDOMAgent.cpp:
444         (WebCore::InspectorDOMAgent::buildObjectForNode):
445
446 2019-02-14  Zalan Bujtas  <zalan@apple.com>
447
448         [LFC][BFC][MarginCollapse] Replaced boxes don't collapse through their margins
449         https://bugs.webkit.org/show_bug.cgi?id=194622
450
451         Reviewed by Antti Koivisto.
452
453         Ensure that block replaced boxes don't collapse through their vertical margins. 
454
455         Test: fast/block/block-only/block-replaced-with-vertical-margins.html
456
457         * layout/blockformatting/BlockMarginCollapse.cpp:
458         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
459         * page/FrameViewLayoutContext.cpp:
460         (WebCore::layoutUsingFormattingContext):
461
462 2019-02-14  Zalan Bujtas  <zalan@apple.com>
463
464         [LFC] Shrink-to-fit-width should be constrained by min/max width
465         https://bugs.webkit.org/show_bug.cgi?id=194653
466
467         Reviewed by Antti Koivisto.
468
469         Use the fixed value of min-width/max-width to constrain the computed preferred width.
470
471         * layout/FormattingContext.h:
472         * layout/FormattingContextGeometry.cpp:
473         (WebCore::Layout::FormattingContext::Geometry::constrainByMinMaxWidth):
474         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
475         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
476         * layout/inlineformatting/InlineFormattingContext.cpp:
477         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
478
479 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
480
481         Crash in DOMTimer::fired
482         https://bugs.webkit.org/show_bug.cgi?id=194638
483
484         Reviewed by Brent Fulgham.
485
486         This patch continues the saga of hunting down timer related crashes after r239814, r225985, r227934.
487
488         The crash was caused by the bug that we don't remove a DOMTimer from NestedTimersMap if a DOMTimer
489         is created & installed inside another DOMTimer's callback (via execute call in DOMTimer::fired).
490
491         Fixed the crash by using a Ref in NestedTimersMap. This will keep the timer alive until we exit
492         from DOMTimer::fired. Because DOMTimer::fired always calls stopTracking() which clears the map
493         we would not leak these DOM timers.
494
495         We could, alternatively, use WeakPtr in NestedTimersMap but that would unnecessarily increase the
496         size of DOMTimer for a very marginal benefit of DOMTimer objcets being deleted slightly earlier.
497         Deleting itself in DOMTimer's destructor involves more logic & house keeping in the timer code,
498         and is no longer the preferred approach when dealing with these classes of bugs in WebKit.
499
500         Test: fast/dom/timer-destruction-during-firing.html
501
502         * page/DOMTimer.cpp:
503         (WebCore::NestedTimersMap::add):
504         (WebCore::DOMTimer::install):
505         (WebCore::DOMTimer::fired):
506
507 2019-02-13  Joseph Pecoraro  <pecoraro@apple.com>
508
509         Web Inspector: Crash when inspecting an element that constantly changes visibility
510         https://bugs.webkit.org/show_bug.cgi?id=194632
511         <rdar://problem/48060258>
512
513         Reviewed by Matt Baker and Devin Rousso.
514
515         * inspector/agents/InspectorDOMAgent.h:
516         * inspector/agents/InspectorDOMAgent.cpp:
517         (WebCore::InspectorDOMAgent::processAccessibilityChildren):
518         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
519         Don't use rvalue-references as that was taking ownership and deleting
520         the object we want to keep around. Instead simplify this to just use
521         references so no ref counting changes happen.
522
523 2019-02-13  Chris Fleizach  <cfleizach@apple.com>
524
525         AX: Crash in handleMenuOpen
526         https://bugs.webkit.org/show_bug.cgi?id=194627
527
528         Reviewed by Zalan Bujtas.
529
530         Tests run under libGuardMalloc will cause crashes.
531
532         This list of objects is a Node list, not an Element list, so we were
533         not removing some nodes when they were being deallocated.
534
535         * accessibility/AXObjectCache.cpp:
536         (WebCore::AXObjectCache::remove):
537
538 2019-02-13  Jer Noble  <jer.noble@apple.com>
539
540         [Mac] PiP window can get "stuck" if PiP is closed while Safari window is minimized.
541         https://bugs.webkit.org/show_bug.cgi?id=194621
542         <rdar://problem/48002560>
543
544         Reviewed by Eric Carlson.
545
546         When Safari is minimized, no rAF() requests are executed. Don't gate responding to presentation
547         change events in the media-controller.js on rAF().
548
549         * Modules/modern-media-controls/media/media-controller.js:
550         (MediaController.prototype._returnMediaLayerToInlineIfNeeded):
551
552 2019-02-13  John Wilander  <wilander@apple.com>
553
554         Ignore Ad Click Attribution where source and destination are same-site
555         https://bugs.webkit.org/show_bug.cgi?id=194620
556         <rdar://problem/47890018>
557
558         Reviewed by Jiewen Tan.
559
560         Updated the existing test.
561
562         We should not accept Ad Click Attribution requests where the site of the
563         anchor tag and its addestination attribute are same-site. Such attributions
564         don’t make sense (the site can track intra-site clicks through better means)
565         and would just lead to increased memory use where are the pending
566         attributions are stored.
567
568         For ports that don't have access to the Public Suffix List, this patch
569         only checks that the hosts don't match, i.e. not just eTLD+1.
570
571         * html/HTMLAnchorElement.cpp:
572         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
573             Now returns WTF::nullopt if the current document and the
574             addestination are same site. Also fixed a console message
575             typo.
576
577 2019-02-13  Eric Carlson  <eric.carlson@apple.com> and Youenn Fablet  <youenn@apple.com>
578
579         getUserMedia with an ideal deviceId constraint doesn't always select the correct device
580         https://bugs.webkit.org/show_bug.cgi?id=193614
581
582         Reviewed by Eric Carlson.
583
584         Compute a fitness score based on constraints.
585         For each constraint, a fitness score is computed from the distance.
586         The smaller the distance, the higher the score.
587         Fitness scores are then summed to give a device fitness score.
588         Matching devices are then sorted according the fitness score.
589
590         For important constraints, deviceId and facingMode, add a more important weight.
591         This ensures that should any of these ideal constraints are set, they will be respected.
592
593         Restrict our automatic setting of default constraints to not add a default ideal facingMode in case of existing deviceId constraint.
594         Do not set a default ideal frameRate if width and height are already set.
595
596         Covered by updated test.
597
598         * platform/mediastream/MediaConstraints.cpp:
599         (WebCore::FlattenedConstraint::set):
600         (WebCore::MediaConstraints::setDefaultVideoConstraints):
601         * platform/mediastream/RealtimeMediaSource.cpp:
602         (WebCore::RealtimeMediaSource::fitnessDistance):
603         (WebCore::RealtimeMediaSource::selectSettings):
604         (WebCore::RealtimeMediaSource::supportsConstraints):
605         (WebCore::RealtimeMediaSource::applyConstraints):
606         * platform/mediastream/RealtimeMediaSource.h:
607         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
608         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
609
610 2019-02-13  Eric Carlson  <eric.carlson@apple.com>
611
612         [iOS] Add a hack to work around buggy video control library
613         https://bugs.webkit.org/show_bug.cgi?id=194615
614         <rdar://problem/46146946>
615
616         Reviewed by Jer Noble.
617
618         Test: media/ios/video-volume-ios-quirk.html
619
620         * html/HTMLMediaElement.cpp:
621         (WebCore::HTMLMediaElement::setVolume): Change m_volume for one turn of the runloop.
622         (WebCore::HTMLMediaElement::cancelPendingTasks): Clear the task queue used to restore m_volume.
623         (WebCore::HTMLMediaElement::closeTaskQueues): Close it.
624         * html/HTMLMediaElement.h:
625
626 2019-02-13  Jer Noble  <jer.noble@apple.com>
627
628         [Cocoa] Media elements will restart network buffering just before suspending
629         https://bugs.webkit.org/show_bug.cgi?id=193691
630
631         Reviewed by Eric Carlson.
632
633         API Test: WebKit.ProcessSuspendMediaBuffering
634
635         Allow the Page to suspend all media buffering in its child Documents.
636
637         * dom/Document.cpp:
638         (WebCore::Document::suspendAllMediaBuffering):
639         (WebCore::Document::resumeAllMediaBuffering):
640         * dom/Document.h:
641         * html/MediaElementSession.cpp:
642         (WebCore::MediaElementSession::dataBufferingPermitted const):
643         (WebCore::MediaElementSession::suspendBuffering):
644         (WebCore::MediaElementSession::resumeBuffering):
645         (WebCore::MediaElementSession::bufferingSuspended const):
646         * html/MediaElementSession.h:
647         * page/Page.cpp:
648         (WebCore::Page::suspendAllMediaBuffering):
649         (WebCore::Page::resumeAllMediaBuffering):
650         * page/Page.h:
651         (WebCore::Page::mediaPlaybackIsSuspended const):
652         (WebCore::Page::mediaBufferingIsSuspended const):
653         (WebCore::Page::mediaPlaybackIsSuspended): Deleted.
654         * platform/audio/PlatformMediaSession.h:
655         (WebCore::PlatformMediaSession::suspendBuffering):
656         (WebCore::PlatformMediaSession::resumeBuffering):
657         * platform/audio/PlatformMediaSessionManager.cpp:
658         (WebCore::PlatformMediaSessionManager::suspendAllMediaBufferingForDocument):
659         (WebCore::PlatformMediaSessionManager::resumeAllMediaBufferingForDocument):
660         * platform/audio/PlatformMediaSessionManager.h:
661
662 2019-02-13  Jer Noble  <jer.noble@apple.com>
663
664         Entering fullscreen inside a shadow root will not set fullscreen pseudoclasses outside of root
665         https://bugs.webkit.org/show_bug.cgi?id=194516
666         <rdar://problem/44678353>
667
668         Reviewed by Antoine Quint.
669
670         Test: fast/shadow-dom/fullscreen-in-shadow-full-screen-ancestor.html
671
672         When walking up the element ancestor chain, use parentElementInComposedTree() to
673         walk past the shadow root boundary.
674
675         * dom/Element.cpp:
676         (WebCore::parentCrossingFrameBoundaries):
677
678 2019-02-13  Chris Dumez  <cdumez@apple.com>
679
680         Unreviewed, update localizable strings.
681
682         * en.lproj/Localizable.strings:
683
684 2019-02-12  Jiewen Tan  <jiewen_tan@apple.com>
685
686         Further restricting webarchive loads
687         https://bugs.webkit.org/show_bug.cgi?id=194567
688         <rdar://problem/47610130>
689
690         Reviewed by Youenn Fablet.
691
692         This patch futher restricts main frame webarchive loads to the followings:
693         1) loaded by clients;
694         2) loaded by drag;
695         3) reloaded from any of the previous two.
696
697         It moves setAlwaysAllowLocalWebarchive, which is used for testing only, from Document
698         to FrameLoader such that the option is remembered during redirections.
699
700         Covered by API tests.
701
702         * dom/Document.h:
703         (WebCore::Document::setAlwaysAllowLocalWebarchive): Deleted.
704         (WebCore::Document::alwaysAllowLocalWebarchive const): Deleted.
705         * loader/DocumentLoader.cpp:
706         (WebCore::DocumentLoader::disallowWebArchive const):
707         * loader/DocumentLoader.h:
708         (WebCore::DocumentLoader::setAllowsWebArchiveForMainFrame):
709         (WebCore::DocumentLoader::allowsWebArchiveForMainFrame):
710         * loader/FrameLoadRequest.h:
711         (WebCore::FrameLoadRequest::setIsRequestFromClientOrUserInput):
712         (WebCore::FrameLoadRequest::isRequestFromClientOrUserInput):
713         * loader/FrameLoader.cpp:
714         (WebCore::FrameLoader::load):
715         (WebCore::FrameLoader::reload):
716         * loader/FrameLoader.h:
717         (WebCore::FrameLoader::setAlwaysAllowLocalWebarchive):
718         (WebCore::FrameLoader::alwaysAllowLocalWebarchive const):
719         * page/DragController.cpp:
720         (WebCore::DragController::performDragOperation):
721         * testing/Internals.cpp:
722         (WebCore::Internals::setAlwaysAllowLocalWebarchive const):
723         * testing/Internals.h:
724         * testing/Internals.idl:
725
726 2019-02-13  Jer Noble  <jer.noble@apple.com>
727
728         Null-deref crash at SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged()
729         https://bugs.webkit.org/show_bug.cgi?id=194613
730         <rdar://problem/48023912>
731
732         Reviewed by Eric Carlson.
733
734         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
735         (WebCore::SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
736
737 2019-02-13  Michael Catanzaro  <mcatanzaro@igalia.com>
738
739         Unreviewed, fix unused variable warnings after r241148/r241251
740         https://bugs.webkit.org/show_bug.cgi?id=194348
741         <rdar://problem/47566449>
742
743         * Modules/mediasource/SourceBuffer.cpp:
744         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError):
745         (WebCore::SourceBuffer::evictCodedFrames):
746         (WebCore::SourceBuffer::provideMediaData):
747
748 2019-02-13  Sihui Liu  <sihui_liu@apple.com>
749
750         REGRESSION: [ Mac Debug WK2 ] Layout Test storage/indexeddb/key-type-infinity-private.html is a flaky crash
751         https://bugs.webkit.org/show_bug.cgi?id=194413
752         <rdar://problem/47897254>
753
754         Reviewed by Brady Eidson.
755
756         IDB clients expected transaction operations to be executed in order, but in 
757         UniqueIDBDatabase::immediateCloseForUserDelete, callbacks in callback map were errored out randomly.
758         This patch added a callback queue to UniqueIDBDatabase to make sure callbacks will be called in the same order
759         as IDB Server receives the request.
760
761         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
762         (WebCore::IDBServer::UniqueIDBDatabase::storeCallbackOrFireError):
763         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
764         (WebCore::IDBServer::UniqueIDBDatabase::performErrorCallback):
765         (WebCore::IDBServer::UniqueIDBDatabase::performKeyDataCallback):
766         (WebCore::IDBServer::UniqueIDBDatabase::performGetResultCallback):
767         (WebCore::IDBServer::UniqueIDBDatabase::performGetAllResultsCallback):
768         (WebCore::IDBServer::UniqueIDBDatabase::performCountCallback):
769         (WebCore::IDBServer::UniqueIDBDatabase::forgetErrorCallback):
770         * Modules/indexeddb/server/UniqueIDBDatabase.h:
771
772 2019-02-13  John Wilander  <wilander@apple.com>
773
774         Store Ad Click Attribution requests in the network process
775         https://bugs.webkit.org/show_bug.cgi?id=194510
776         <rdar://problem/47650118>
777
778         Reviewed by Alex Christensen and Daniel Bates.
779
780         Test: http/tests/adClickAttribution/store-ad-click-attribution.html
781
782         This patch adds support functions for validation and storage of
783         WebCore::AdClickAttribution objects. It also adds WTF::HashTraits so that
784         WebCore::AdClickAttribution::Source and WebCore::AdClickAttribution::Destination
785         can be used in a HashMap.
786
787         * loader/AdClickAttribution.cpp:
788         (WebCore::AdClickAttribution::toString const):
789         * loader/AdClickAttribution.h:
790         (WebCore::AdClickAttribution::Source::operator== const):
791         (WebCore::AdClickAttribution::Source::deletedValue):
792         (WebCore::AdClickAttribution::Source::constructDeletedValue):
793         (WebCore::AdClickAttribution::Source::deleteValue):
794         (WebCore::AdClickAttribution::Source::isDeletedValue const):
795         (WebCore::AdClickAttribution::SourceHash::hash):
796         (WebCore::AdClickAttribution::SourceHash::equal):
797         (WebCore::AdClickAttribution::Destination::operator== const):
798         (WebCore::AdClickAttribution::Destination::matches const):
799             This convenience function allows matching of a WTF::URL object.
800         (WebCore::AdClickAttribution::Destination::deletedValue):
801         (WebCore::AdClickAttribution::Destination::constructDeletedValue):
802         (WebCore::AdClickAttribution::Destination::deleteValue):
803         (WebCore::AdClickAttribution::Destination::isDeletedValue const):
804         (WebCore::AdClickAttribution::DestinationHash::hash):
805         (WebCore::AdClickAttribution::DestinationHash::equal):
806         (WebCore::AdClickAttribution::source const):
807         (WebCore::AdClickAttribution::destination const):
808             Getters added to support mapped storage based on source and destination.
809         (WTF::HashTraits<WebCore::AdClickAttribution::Source>::emptyValue):
810         (WTF::HashTraits<WebCore::AdClickAttribution::Source>::constructDeletedValue):
811         (WTF::HashTraits<WebCore::AdClickAttribution::Source>::isDeletedValue):
812         (WTF::HashTraits<WebCore::AdClickAttribution::Destination>::emptyValue):
813         (WTF::HashTraits<WebCore::AdClickAttribution::Destination>::constructDeletedValue):
814         (WTF::HashTraits<WebCore::AdClickAttribution::Destination>::isDeletedValue):
815         * loader/NavigationAction.h:
816         (WebCore::NavigationAction::adClickAttribution const):
817         (WebCore::NavigationAction::adClickAttribution): Deleted.
818             Corrected the constness of this function.
819
820 2019-02-13  Eric Carlson  <eric.carlson@apple.com>
821
822         Revert r240434
823         https://bugs.webkit.org/show_bug.cgi?id=194600
824         <rdar://problem/48044566>
825
826         Reviewed by Brent Fulgham.
827
828         * html/HTMLMediaElement.cpp:
829         (WebCore::HTMLMediaElement::setVolume):
830         (WebCore::HTMLMediaElement::mediaPlayerVolumeChanged):
831         (WebCore::HTMLMediaElement::updateVolume):
832         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
833         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVolume):
834
835 2019-02-13  Alex Christensen  <achristensen@webkit.org>
836
837         Stop using setDefersLoading from WebCore
838         https://bugs.webkit.org/show_bug.cgi?id=194315
839
840         Reviewed by Jer Noble.
841
842         That is what CompletionHandlers are for.
843
844         * loader/MediaResourceLoader.cpp:
845         (WebCore::MediaResource::responseReceived):
846         (WebCore::MediaResource::setDefersLoading): Deleted.
847         * loader/MediaResourceLoader.h:
848         * platform/graphics/PlatformMediaResourceLoader.h:
849         (WebCore::PlatformMediaResourceClient::responseReceived):
850         (WebCore::PlatformMediaResource::stop):
851         (WebCore::PlatformMediaResource::setDefersLoading): Deleted.
852         * platform/network/cocoa/WebCoreNSURLSession.mm:
853         (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
854         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:completionHandler:]):
855         (-[WebCoreNSURLSessionDataTask _setDefersLoading:]): Deleted.
856         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): Deleted.
857
858 2019-02-13  Jer Noble  <jer.noble@apple.com>
859
860         [Cocoa] Switch to CVPixelBufferGetBytesPerRow() for calculating CVPixelBuffer base address size.
861         https://bugs.webkit.org/show_bug.cgi?id=194580
862         <rdar://problem/42727739>
863
864         Reviewed by Eric Carlson.
865
866         * platform/cocoa/CoreVideoSoftLink.cpp:
867         * platform/cocoa/CoreVideoSoftLink.h:
868         * platform/graphics/cv/PixelBufferConformerCV.cpp:
869         (WebCore::CVPixelBufferGetBytePointerCallback):
870         (WebCore::PixelBufferConformerCV::createImageFromPixelBuffer):
871
872 2019-02-13  Antoine Quint  <graouts@apple.com>
873
874         Support simulated mouse events on iOS based on a PlatformTouchEvent
875         https://bugs.webkit.org/show_bug.cgi?id=194501
876         <rdar://problem/46910790>
877
878         Reviewed by Dean Jackson.
879
880         Add support for two new internal runtime flags to control whether simulated mouse events should be dipatched along with touch events and
881         whether simulated mousemove events dispatched should automatically trigger the behavior preventDefault() would also trigger. To facilitate
882         that, we allow for a MouseEvent to be created, much like a PointerEvent, based on a PlatformTouchEvent. Then, we set a flag on Event within
883         EventTarget::innerInvokeEventListeners() to see whether any page code has been evaluated as a result of a mousemove event being dispatched.
884         Finally, we also track mouse events when invalidating touch regions provided the required internal runtime flag is on.
885
886         Test: fast/events/touch/ios/mouse-events-dispatch-with-touch.html
887
888         * SourcesCocoa.txt:
889         * WebCore.xcodeproj/project.pbxproj:
890         * dom/Event.cpp:
891         * dom/Event.h:
892         (WebCore::Event::hasEncounteredListener const):
893         (WebCore::Event::setHasEncounteredListener):
894         * dom/EventNames.h:
895         (WebCore::EventNames::isTouchRelatedEventType const):
896         (WebCore::EventNames::touchRelatedEventNames const):
897         (WebCore::EventNames::extendedTouchRelatedEventNames const):
898         (WebCore::EventNames::isTouchEventType const): Deleted.
899         (WebCore::EventNames::touchAndPointerEventNames const): Deleted.
900         * dom/EventTarget.cpp:
901         (WebCore::EventTarget::innerInvokeEventListeners):
902         * dom/MouseEvent.h:
903         * dom/Node.cpp:
904         (WebCore::Node::moveNodeToNewDocument):
905         (WebCore::tryAddEventListener):
906         (WebCore::tryRemoveEventListener):
907         (WebCore::Node::defaultEventHandler):
908         * dom/ios/MouseEventIOS.cpp: Added.
909         (WebCore::mouseEventType):
910         (WebCore::MouseEvent::create):
911         * dom/ios/PointerEventIOS.cpp:
912         (WebCore::pointerEventType):
913         (WebCore::PointerEvent::create):
914         (WebCore::eventType): Deleted.
915         * page/DOMWindow.cpp:
916         (WebCore::DOMWindow::addEventListener):
917         (WebCore::DOMWindow::removeEventListener):
918         * page/EventHandler.h:
919         * page/RuntimeEnabledFeatures.h:
920         (WebCore::RuntimeEnabledFeatures::mouseEventsSimulationEnabled const):
921         (WebCore::RuntimeEnabledFeatures::setMouseEventsSimulationEnabled):
922         (WebCore::RuntimeEnabledFeatures::mousemoveEventHandlingPreventsDefaultEnabled const):
923         (WebCore::RuntimeEnabledFeatures::setMousemoveEventHandlingPreventsDefaultEnabled):
924
925 2019-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>
926
927         [FreeType] Unable to render some Hebrew characters
928         https://bugs.webkit.org/show_bug.cgi?id=194498
929
930         Reviewed by Michael Catanzaro.
931
932         We are failing to find a font for some of the combining character sequences because normalization is failing due
933         to overflow error. In case of overflow, normalize returns the required length for the normalized characters, so
934         we should handle that case to resize the output buffer and try again.
935
936         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
937         (WebCore::FontCascade::fontForCombiningCharacterSequence const):
938
939 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
940
941         Release assert in PolicyCheckIdentifier::isValidFor via WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction
942         https://bugs.webkit.org/show_bug.cgi?id=194582
943
944         Reviewed by Antti Koivisto.
945
946         Check the zero-ness of m_policyCheck first so that we can differentiate process ID being wrong
947         from the non-generated identifier being sent to us as it was the case in this failure.
948
949         * loader/PolicyChecker.cpp:
950         (WebCore::PolicyCheckIdentifier::isValidFor):
951
952 2019-02-13  Commit Queue  <commit-queue@webkit.org>
953
954         Unreviewed, rolling out r241273.
955         https://bugs.webkit.org/show_bug.cgi?id=194579
956
957         This change is causing a flaky assertion failure crash in High
958         Sierra Debug (Requested by ShawnRoberts on #webkit).
959
960         Reverted changeset:
961
962         "Stop using setDefersLoading from WebCore"
963         https://bugs.webkit.org/show_bug.cgi?id=194315
964         https://trac.webkit.org/changeset/241273
965
966 2019-02-12  Mark Lam  <mark.lam@apple.com>
967
968         Remove unnecessary null check in bindings.
969         https://bugs.webkit.org/show_bug.cgi?id=194581
970
971         Reviewed by Yusuke Suzuki.
972
973         It is always safe to call visitor.containsOpaqueRoot(root) with a null root pointer.
974         It will just return false.  Since we don't expect the root pointer to be null in
975         the common case, having a null check here is also not optimal.  We'll remove this
976         unneeded null check.
977
978         * bindings/scripts/CodeGeneratorJS.pm:
979         (GenerateImplementation):
980         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
981         (WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots):
982
983 2019-02-12  Rob Buis  <rbuis@igalia.com>
984
985         Align with Fetch on data: URLs
986         https://bugs.webkit.org/show_bug.cgi?id=182325
987
988         Reviewed by Alex Christensen.
989
990         The MIME type part of the data url should be serialized as
991         specified in step 3 under "data" [1].
992
993         Test: web-platform-tests/fetch/data-urls/processing.any.js
994
995         [1] https://fetch.spec.whatwg.org/#concept-scheme-fetch 
996
997         * platform/network/DataURLDecoder.cpp:
998         (WebCore::DataURLDecoder::parseMediaType):
999
1000 2019-02-12  Alex Christensen  <achristensen@webkit.org>
1001
1002         Build fix after r241320
1003         https://bugs.webkit.org/show_bug.cgi?id=194271
1004
1005         * page/Frame.cpp:
1006         (WebCore::Frame::requestDOMPasteAccess):
1007
1008 2019-02-12  Justin Fan  <justin_fan@apple.com>
1009
1010         [WebGPU] Remove WebGPUBufferDescriptor/Usage and use GPU versions
1011         https://bugs.webkit.org/show_bug.cgi?id=194552
1012
1013         Reviewed by Dean Jackson.
1014
1015         WebGPUBufferDescriptor/Usage have been renamed to GPUBufferDescriptor/Usage in the Web GPU API.
1016         Consolidate the two versions of these classes in our implementation.
1017
1018         Affected layout tests updated with new names. No change in behavior.
1019
1020         * CMakeLists.txt:
1021         * DerivedSources-input.xcfilelist:
1022         * DerivedSources-output.xcfilelist:
1023         * DerivedSources.make:
1024         * Modules/webgpu/GPUBufferDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBufferDescriptor.idl.
1025         * Modules/webgpu/GPUBufferUsage.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBufferUsage.idl.
1026         * Modules/webgpu/WebGPUBufferUsage.h: Removed.
1027         * Modules/webgpu/WebGPUDevice.cpp:
1028         (WebCore::WebGPUDevice::createBuffer const):
1029         * Modules/webgpu/WebGPUDevice.h:
1030         * Modules/webgpu/WebGPUDevice.idl:
1031         * Sources.txt:
1032         * WebCore.xcodeproj/project.pbxproj:
1033         * bindings/js/WebCoreBuiltinNames.h:
1034         * platform/graphics/gpu/GPUBufferDescriptor.h: Moved out GPUBufferUsage.
1035         * platform/graphics/gpu/GPUBufferUsage.h: Moved from GPUBufferDescriptor.h.
1036
1037 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1038
1039         Unreviewed, try to fix the internal iOS build after r241321
1040
1041         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
1042
1043 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1044
1045         Allow pages to trigger programmatic paste from script on iOS
1046         https://bugs.webkit.org/show_bug.cgi?id=194271
1047         <rdar://problem/47808810>
1048
1049         Reviewed by Tim Horton.
1050
1051         Tests: editing/pasteboard/ios/dom-paste-confirmation.html
1052                editing/pasteboard/ios/dom-paste-consecutive-confirmations.html
1053                editing/pasteboard/ios/dom-paste-rejection.html
1054                editing/pasteboard/ios/dom-paste-requires-user-gesture.html
1055
1056         * dom/UserGestureIndicator.cpp:
1057         (WebCore::UserGestureIndicator::~UserGestureIndicator):
1058
1059         Reset a gesture token's DOM paste access when exiting the scope of a user gesture. This prevents DOM paste
1060         access permissions from leaking into `setTimeout()` callbacks when we forward user gesture tokens.
1061
1062         * dom/UserGestureIndicator.h:
1063         (WebCore::UserGestureToken::resetDOMPasteAccess):
1064
1065 2019-02-12  Chris Fleizach  <cfleizach@apple.com>
1066
1067         AX: IsolatedTree: Implement more attributes
1068         https://bugs.webkit.org/show_bug.cgi?id=193911
1069         <rdar://problem/47599217>
1070
1071         Reviewed by Daniel Bates.
1072
1073         Make use of new HIServices SPI to use a secondary AX thread.
1074         Store root node/focused node status in IsolatedTree rather than on the element.
1075         Implement the following attributes: children, parent, isIgnored, isTree, isTreeItem, relativeFrame, speechHint, title, description.
1076         Implement hit-testing using relative-frames.
1077         Ensure that WKAccessibilityWebPageObject queries happen on main thread when they need to.
1078
1079         * SourcesCocoa.txt:
1080         * WebCore.xcodeproj/project.pbxproj:
1081         * accessibility/AXObjectCache.cpp:
1082         (WebCore::AXObjectCache::generateIsolatedAccessibilityTree):
1083         * accessibility/AXObjectCache.h:
1084         (WebCore::AXObjectCache::focusedUIElementForPage):
1085         * accessibility/AccessibilityAttachment.cpp:
1086         (WebCore::AccessibilityAttachment::accessibilityText const):
1087         (WebCore::AccessibilityAttachment::accessibilityText): Deleted.
1088         * accessibility/AccessibilityAttachment.h:
1089         * accessibility/AccessibilityImageMapLink.cpp:
1090         (WebCore::AccessibilityImageMapLink::accessibilityText const):
1091         (WebCore::AccessibilityImageMapLink::accessibilityText): Deleted.
1092         * accessibility/AccessibilityImageMapLink.h:
1093         * accessibility/AccessibilityMediaControls.cpp:
1094         (WebCore::AccessibilityMediaControl::accessibilityText const):
1095         (WebCore::AccessibilityMediaControl::accessibilityText): Deleted.
1096         * accessibility/AccessibilityMediaControls.h:
1097         * accessibility/AccessibilityNodeObject.cpp:
1098         (WebCore::AccessibilityNodeObject::accessibilityText const):
1099         (WebCore::AccessibilityNodeObject::accessibilityText): Deleted.
1100         * accessibility/AccessibilityNodeObject.h:
1101         * accessibility/AccessibilityObject.cpp:
1102         (WebCore::AccessibilityObject::convertFrameToSpace const):
1103         (WebCore::AccessibilityObject::relativeFrame const):
1104         (WebCore::AccessibilityObject::elementAccessibilityHitTest const):
1105         (WebCore::AccessibilityObject::focusedUIElement const):
1106         * accessibility/AccessibilityObject.h:
1107         (WebCore::AccessibilityObject::accessibilityText const):
1108         (WebCore::AccessibilityObject::isLink const): Deleted.
1109         (WebCore::AccessibilityObject::isImage const): Deleted.
1110         (WebCore::AccessibilityObject::isAttachment const): Deleted.
1111         (WebCore::AccessibilityObject::isFileUploadButton const): Deleted.
1112         (WebCore::AccessibilityObject::isImageMapLink const): Deleted.
1113         (WebCore::AccessibilityObject::isMediaControlLabel const): Deleted.
1114         (WebCore::AccessibilityObject::isTree const): Deleted.
1115         (WebCore::AccessibilityObject::isTreeItem const): Deleted.
1116         (WebCore::AccessibilityObject::isScrollbar const): Deleted.
1117         (WebCore::AccessibilityObject::accessibilityHitTest const): Deleted.
1118         (WebCore::AccessibilityObject::accessibilityText): Deleted.
1119         (WebCore::AccessibilityObject::roleValue const): Deleted.
1120         (WebCore::AccessibilityObject::wrapper const): Deleted.
1121         * accessibility/AccessibilityObjectInterface.h: Replaced.
1122         * accessibility/AccessibilityRenderObject.cpp:
1123         (WebCore::AccessibilityRenderObject::isTabItemSelected const):
1124         (WebCore::AccessibilityRenderObject::remoteSVGElementHitTest const):
1125         (WebCore::AccessibilityRenderObject::elementAccessibilityHitTest const):
1126         (WebCore::AccessibilityRenderObject::accessibilityHitTest const):
1127         (WebCore::AccessibilityRenderObject::selectedChildren):
1128         * accessibility/AccessibilityRenderObject.h:
1129         * accessibility/AccessibilitySVGElement.cpp:
1130         (WebCore::AccessibilitySVGElement::accessibilityText const):
1131         (WebCore::AccessibilitySVGElement::accessibilityText): Deleted.
1132         * accessibility/AccessibilitySVGElement.h:
1133         * accessibility/AccessibilityScrollView.cpp:
1134         (WebCore::AccessibilityScrollView::accessibilityHitTest const):
1135         * accessibility/AccessibilityScrollView.h:
1136         * accessibility/ios/AccessibilityObjectIOS.mm:
1137         (WebCore::AccessibilityObject::fileUploadButtonReturnsValueInTitle const):
1138         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1139         (-[WebAccessibilityObjectWrapper fileUploadButtonReturnsValueInTitle]): Deleted.
1140         * accessibility/isolatedtree: Replaced.
1141         * accessibility/isolatedtree/AXIsolatedTree.cpp: Added.
1142         (WebCore::AXIsolatedTree::treePageCache):
1143         (WebCore::AXIsolatedTree::AXIsolatedTree):
1144         (WebCore::AXIsolatedTree::nodeInTreeForID):
1145         (WebCore::AXIsolatedTree::nodeForID const):
1146         (WebCore::AXIsolatedTree::focusedUIElement):
1147         (WebCore::AXIsolatedTree::setRootNodeID):
1148         (WebCore::AXIsolatedTree::setFocusedNodeID):
1149         (WebCore::AXIsolatedTree::setInitialRequestInProgress):
1150         (WebCore::AXIsolatedTree::applyPendingChanges):
1151         * accessibility/isolatedtree/AXIsolatedTree.h: Added.
1152         * accessibility/isolatedtree/AXIsolatedTreeNode.cpp: Added.
1153         (WebCore::AXIsolatedTreeNode::AXIsolatedTreeNode):
1154         (WebCore::AXIsolatedTreeNode::~AXIsolatedTreeNode):
1155         (WebCore::AXIsolatedTreeNode::initializeAttributeData):
1156         (WebCore::AXIsolatedTreeNode::setProperty):
1157         (WebCore::AXIsolatedTreeNode::setParent):
1158         (WebCore::AXIsolatedTreeNode::setTreeIdentifier):
1159         (WebCore::AXIsolatedTreeNode::focusedUIElement const):
1160         (WebCore::AXIsolatedTreeNode::parentObjectInterfaceUnignored const):
1161         (WebCore::AXIsolatedTreeNode::accessibilityHitTest const):
1162         (WebCore::AXIsolatedTreeNode::tree const):
1163         (WebCore::AXIsolatedTreeNode::rectAttributeValue const):
1164         (WebCore::AXIsolatedTreeNode::stringAttributeValue const):
1165         * accessibility/isolatedtree/AXIsolatedTreeNode.h: Added.
1166         * accessibility/mac/AXObjectCacheMac.mm:
1167         (WebCore::AXObjectCache::associateIsolatedTreeNode):
1168         * accessibility/mac/AccessibilityObjectBase.mm: Added.
1169         (WebCore::AccessibilityObject::speechHintAttributeValue const):
1170         (WebCore::AccessibilityObject::descriptionAttributeValue const):
1171         (WebCore::AccessibilityObject::titleAttributeValue const):
1172         (WebCore::AccessibilityObject::helpTextAttributeValue const):
1173         * accessibility/mac/AccessibilityObjectMac.mm:
1174         (WebCore::AccessibilityObject::fileUploadButtonReturnsValueInTitle const):
1175         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
1176         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
1177         (addChildToArray):
1178         (convertToNSArray):
1179         (-[WebAccessibilityObjectWrapperBase isolatedTreeNode]):
1180         (-[WebAccessibilityObjectWrapperBase detach]):
1181         (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
1182         (-[WebAccessibilityObjectWrapperBase accessibilityObject]):
1183         (-[WebAccessibilityObjectWrapperBase baseAccessibilityTitle]):
1184         (-[WebAccessibilityObjectWrapperBase axBackingObject]):
1185         (-[WebAccessibilityObjectWrapperBase baseAccessibilityDescription]):
1186         (-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]):
1187         (-[WebAccessibilityObjectWrapperBase baseAccessibilityHelpText]):
1188         (convertPathToScreenSpaceFunction):
1189         (-[WebAccessibilityObjectWrapperBase convertRectToSpace:space:]):
1190         (-[WebAccessibilityObjectWrapperBase ariaLandmarkRoleDescription]):
1191         (-[WebAccessibilityObjectWrapperBase titleTagShouldBeUsedInDescriptionField]): Deleted.
1192         (-[WebAccessibilityObjectWrapperBase fileUploadButtonReturnsValueInTitle]): Deleted.
1193         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1194         (-[WebAccessibilityObjectWrapper IGNORE_WARNINGS_END]):
1195         (-[WebAccessibilityObjectWrapper childrenVectorSize]):
1196         (-[WebAccessibilityObjectWrapper childrenVectorArray]):
1197         (-[WebAccessibilityObjectWrapper position]):
1198         (-[WebAccessibilityObjectWrapper subrole]):
1199         (-[WebAccessibilityObjectWrapper roleDescription]):
1200         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1201         (-[WebAccessibilityObjectWrapper accessibilityFocusedUIElement]):
1202         (-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
1203         (-[WebAccessibilityObjectWrapper accessibilityIndexOfChild:]):
1204         (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeCount:]):
1205         (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]):
1206
1207 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1208
1209         Allow pages to trigger programmatic paste from script on iOS
1210         https://bugs.webkit.org/show_bug.cgi?id=194271
1211         <rdar://problem/47808810>
1212
1213         Reviewed by Ryosuke Niwa.
1214
1215         Add support for allowing script to trigger programmatic paste commands. Currently on macOS and iOS, the ability
1216         to trigger programmatic paste (i.e. `document.execCommand('Paste');`) is disabled by default, such that
1217         execCommand is simply a no-op that returns false. This policy is a privacy measure (common among other major
1218         browsers) that prevents untrusted web content from sniffing content from the system pasteboard (even on user
1219         interaction, since unintended user interaction occasionally happens as well!).
1220
1221         In order to make it possible for web pages to programmatically paste without opening the door to privacy and
1222         security issues, we make paste commands triggered from bindings present platform UI on iOS, in the form of a
1223         callout bar with the single option to paste. This UI is dismissed upon any user interaction; furthermore, any
1224         user interaction short of explicitly triggering the "Paste" action subsequently prevents the page from executing
1225         the paste (and causes execCommand to return false). However, if the paste action is chosen by the user, we
1226         instead follow through with the programmatic paste command.
1227
1228         New tests to come in a followup patch.
1229
1230         * WebCore.xcodeproj/project.pbxproj:
1231         * dom/DOMPasteAccessPolicy.h: Added.
1232         * dom/UserGestureIndicator.h:
1233         (WebCore::UserGestureToken::domPasteAccessPolicy const):
1234         (WebCore::UserGestureToken::didRequestDOMPasteAccess):
1235
1236         Add helpers on UserGestureToken to update and query the current DOM paste access policy. The access policies are
1237         "NotRequestedYet" (i.e. pending a response from the user), "Granted" (the user has granted DOM paste access to
1238         the page), or "Denied" (the user has prevented the page from reading the contents of the clipboard). When DOM
1239         paste access is granted or rejected, make this decision sticky until the end of the current user gesture.
1240
1241         * editing/EditorCommand.cpp:
1242         (WebCore::executePaste):
1243         (WebCore::executePasteAndMatchStyle):
1244         (WebCore::executePasteAsPlainText):
1245         (WebCore::executePasteAsQuotation):
1246
1247         When executing a paste command where the source is DOM bindings, request DOM paste if needed before proceeding
1248         with the paste.
1249
1250         (WebCore::supportedPaste):
1251         * loader/EmptyClients.cpp:
1252         * page/EditorClient.h:
1253         * page/Frame.cpp:
1254         (WebCore::Frame::requestDOMPasteAccess):
1255
1256         Add a helper method that requests access to the clipboard on behalf of script when pasting.
1257
1258         * page/Frame.h:
1259         * page/Settings.yaml:
1260
1261         Introduce a new WebCore setting, used to gate DOM paste access requests.
1262
1263 2019-02-12  Alex Christensen  <achristensen@webkit.org>
1264
1265         Remove setDefersLoading infrastructure from WebKit2
1266         https://bugs.webkit.org/show_bug.cgi?id=194506
1267
1268         Reviewed by Brady Eidson.
1269
1270         setDefersLoading is inherently racy from WebCore to the NetworkProcess,
1271         it adds unwanted complexity to the initialization and use of network objects,
1272         and it has led to many unrecoverable hang bugs over the years.
1273         We needed to force it into WebKit2 to transition some existing clients who relied on it,
1274         but we have recently finished transitioning those clients to other solutions, mostly
1275         completion handlers.
1276
1277         * inspector/PageScriptDebugServer.cpp:
1278         (WebCore::PageScriptDebugServer::setJavaScriptPaused):
1279
1280 2019-02-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1281
1282         Unreviewed, fix build warnings after content extensions enablement
1283         https://bugs.webkit.org/show_bug.cgi?id=193622
1284         <rdar://problem/47982850>
1285
1286         * contentextensions/DFABytecode.h:
1287         (WebCore::ContentExtensions::instructionSizeWithArguments):
1288         * contentextensions/DFABytecodeCompiler.h:
1289         * contentextensions/URLFilterParser.cpp:
1290         (WebCore::ContentExtensions::URLFilterParser::statusString):
1291
1292 2019-02-12  Justin Fan  <justin_fan@apple.com>
1293
1294         [Web GPU] DepthStencilAttachment implementation
1295         https://bugs.webkit.org/show_bug.cgi?id=194458
1296         <rdar://problem/47932446>
1297
1298         Reviewed by Dean Jackson.
1299
1300         Implement ability to provide a depth attachment to the render pass encoder. Also implement
1301         GPULoad/StoreOp and update color attachments' implementation for full functionality.
1302
1303         Test: webgpu/depth-enabled-triangle-strip.html
1304
1305         Update project files for new symbols:
1306         * CMakeLists.txt:
1307         * DerivedSources-input.xcfilelist:
1308         * DerivedSources-output.xcfilelist:
1309         * DerivedSources.make:
1310         * Sources.txt:
1311         * WebCore.xcodeproj/project.pbxproj:
1312
1313         * Modules/webgpu/GPUColor.idl: Renamed from WebGPUColor.idl
1314         * Modules/webgpu/GPULoadOp.idl: Added. Interface for attachment operation enum.
1315         * Modules/webgpu/GPUStoreOp.idl: Ditto.
1316         * Modules/webpug/WebGPUColor.h: Removed.
1317         * Modules/webgpu/WebGPUCommandBuffer.cpp: Refactored descriptor validation logic out of this file.
1318         (WebCore::WebGPUCommandBuffer::beginRenderPass):
1319         * Modules/webgpu/WebGPURenderPassDescriptor.cpp: Added. Now owns code for validating descriptors.
1320         (WebCore::WebGPURenderPassDescriptor::validateAndConvertToGPUVersion const):
1321         * Modules/webgpu/WebGPURenderPassColorAttachmentDescriptor.h/idl: Removed. Code moved into WebGPURenderPassDescriptor.
1322         * Modules/webgpu/WebGPURenderPassDescriptor.h: Move sub-descriptor definitions into this file.
1323         * Modules/webgpu/WebGPURenderPassDescriptor.idl: Ditto.
1324         * Modules/webgpu/WebGPURenderPipelineDescriptor.h: Make depthStencilState optional to match API update.
1325         * Modules/webgpu/WebGPURenderPipelineDescriptor.idl: Ditto.
1326         * Modules/webgpu/WebGPUTextureView.h:
1327         * platform/graphics/gpu/GPULoadOp.h: Added.
1328         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h: Removed (moved into GPURenderPassDescriptor).
1329         * platform/graphics/gpu/GPURenderPassDescriptor.h: Mirror WebGPU* changes.
1330         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Make depthStencilState optional.
1331         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
1332         * platform/graphics/gpu/GPUStoreOp.h: Added.
1333         * platform/graphics/gpu/GPUTexture.h:
1334         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
1335         (WebCore::loadActionForGPULoadOp): Added.
1336         (WebCore::storeActionForGPUStoreOp): Added.
1337         (WebCore::populateMtlColorAttachmentsArray): Added. Create all expected color attachments, rather than just the first.
1338         (WebCore::populateMtlDepthStencilAttachment): Added.
1339         (WebCore::GPURenderPassEncoder::create):
1340         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm: Make depthStencilState optional.
1341         (WebCore::GPURenderPipeline::create):
1342
1343 2019-02-12  David Kilzer  <ddkilzer@apple.com>
1344
1345         REGRESSION (r238955, r240494): Soft-linking optional Lookup.framework triggers release assertion when missing
1346         <https://webkit.org/b/194529>
1347         <rdar://problem/47924449>
1348
1349         Reviewed by Eric Carlson.
1350
1351         * SourcesCocoa.txt:
1352         - Do not include DataDetectorsCoreSoftLink.mm in unified
1353           sources.
1354         * WebCore.xcodeproj/project.pbxproj:
1355         - Add DataDetectorsCoreSoftLink.mm to the WebCore target now
1356           that it isn't part of the unifed sources.
1357         * platform/cocoa/DataDetectorsCoreSoftLink.mm:
1358         - Switch from using SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL() to
1359           SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE() when linking
1360           DataDetectorsCore.framework. None of the other macros assume
1361           this framework is optional, and it was likely made optional
1362           originally because the framework was new to iOS and thus
1363           didn't exist on older versions.
1364         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1365         - Change use of SOFT_LINK_CLASS_FOR_SOURCE() macros to
1366           SOFT_LINK_CLASS() since the latter can only be used with
1367           SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation).  This broke after
1368           the fix for <wtf/SoftLinking.h> was applied.
1369
1370 2019-02-12  Youenn Fablet  <youenn@apple.com>
1371
1372         Make use of is<SubresourceLoader>
1373         https://bugs.webkit.org/show_bug.cgi?id=194541
1374
1375         Reviewed by Alex Christensen.
1376
1377         No change of behavior.
1378
1379         * inspector/agents/InspectorNetworkAgent.cpp:
1380         (WebCore::InspectorNetworkAgent::didReceiveResponse):
1381         * loader/SubresourceLoader.h:
1382         (isType):
1383
1384 2019-02-12  Mark Lam  <mark.lam@apple.com>
1385
1386         Add some null checks in JSNodeCustom.h's root() and generated isReachableFromOpaqueRoots() functions.
1387         https://bugs.webkit.org/show_bug.cgi?id=194530
1388         <rdar://problem/47973274>
1389
1390         Reviewed by Chris Dumez.
1391
1392         This is needed to fix a null pointer dereference that arises from the following scenario:
1393         1. a Document detaches from its StyleSheetList.
1394         2. the JSStyleSheetList that is associated with the detached StyleSheetList has yet
1395            to be scanned and collected by the GC.
1396         3. the GC eventually looks for the opaque root of the StyleSheetList's owner, and
1397            discovers a null owner pointer.
1398
1399         This patch fixes this issue by applying the following null checks:
1400
1401         1. Add a null check in JSNodeCustom.h's root().
1402
1403            root() is called from a isReachableFromOpaqueRoots() generated by CodeGeneratorJS.pm.
1404            isReachableFromOpaqueRoots() calls a ownerNode() method and passes its result
1405            to root().  However, depending on which class the ownerNode() method belongs to,
1406            it can either return a pointer or a reference.  The null check only makes sense
1407            in the pointer case.
1408
1409            To accommodate the 2 forms, root() itself is has an overload that takes a
1410            reference instead of a pointer.
1411
1412            Since CodeGeneratorJS.pm can't tell what the generated class' ownerNode()
1413            returns, it can't discern when the result is a pointer and apply the null check.
1414            Instead, we just add the null check to the version of root() that takes a
1415            pointer.  If the node pointer is null, we'll return a null opaque root.
1416
1417         2. Fix CodeGeneratorJS.pm to null check the opaque root before using it.
1418
1419         * bindings/js/JSNodeCustom.h:
1420         (WebCore::root):
1421         * bindings/scripts/CodeGeneratorJS.pm:
1422         (GenerateImplementation):
1423         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
1424         (WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots):
1425
1426 2019-02-12  Andy Estes  <aestes@apple.com>
1427
1428         [iOSMac] Enable Parental Controls Content Filtering
1429         https://bugs.webkit.org/show_bug.cgi?id=194521
1430         <rdar://39732376>
1431
1432         Reviewed by Tim Horton.
1433
1434         * Configurations/FeatureDefines.xcconfig:
1435         * platform/ContentFilterUnblockHandler.h:
1436         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
1437         * platform/cocoa/ParentalControlsContentFilter.mm:
1438
1439 2019-02-11  Jer Noble  <jer.noble@apple.com>
1440
1441         Unreviewed build fix; add a HAVE_CELESTIAL guard around Celestial framework usage.
1442
1443         * platform/audio/ios/MediaSessionManagerIOS.h:
1444         * platform/audio/ios/MediaSessionManagerIOS.mm:
1445         (WebCore::MediaSessionManageriOS::providePresentingApplicationPIDIfNecessary):
1446
1447 2019-02-12  Antti Koivisto  <antti@apple.com>
1448
1449         Crash in WebCore::ScrollingTree::updateTreeFromStateNode
1450         https://bugs.webkit.org/show_bug.cgi?id=194538
1451         <rdar://problem/47841926>
1452
1453         Reviewed by Zalan Bujtas.
1454
1455         * page/scrolling/ScrollingTree.cpp:
1456         (WebCore::ScrollingTree::updateTreeFromStateNode):
1457
1458         Make sure we don't leave node entry behind in m_nodeMap in case we failed to add it to the parent.
1459
1460 2019-02-12  Zalan Bujtas  <zalan@apple.com>
1461
1462         [LFC] Remove redundant InlineFormattingContext::computeBorderAndPadding
1463         https://bugs.webkit.org/show_bug.cgi?id=194540
1464
1465         Reviewed by Antti Koivisto.
1466
1467         Use FormattingContext::computeBorderAndPadding instead.
1468
1469         * layout/FormattingContext.cpp:
1470         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
1471         * layout/FormattingContext.h:
1472         * layout/inlineformatting/InlineFormattingContext.cpp:
1473         (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const): Deleted.
1474         * layout/inlineformatting/InlineFormattingContext.h:
1475
1476 2019-02-12  Zalan Bujtas  <zalan@apple.com>
1477
1478         [LFC][IFC] Add intrinsic width support for float boxes.
1479         https://bugs.webkit.org/show_bug.cgi?id=194528
1480
1481         Reviewed by Antti Koivisto.
1482
1483         This patch implements a very simple float box support for intrinsic width.
1484
1485         * layout/inlineformatting/InlineFormattingContext.cpp:
1486         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
1487         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFloatBox const):
1488         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForInlineBlock const):
1489         (WebCore::Layout::InlineFormattingContext::computeMargin const):
1490         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const): Deleted.
1491         * layout/inlineformatting/InlineFormattingContext.h:
1492
1493 2019-02-12  Rob Buis  <rbuis@igalia.com>
1494
1495         Implement serializing in MIME type parser
1496         https://bugs.webkit.org/show_bug.cgi?id=193909
1497
1498         Reviewed by Darin Adler.
1499
1500         Implement serializing in MIME type parser [1], to preserve the parameter
1501         order the Vector m_parameterNames is introduced, since HashMaps do not
1502         guarantee any order.
1503
1504         Test: ParsedContentType.Serialize
1505
1506         [1] https://mimesniff.spec.whatwg.org/#serializing-a-mime-type
1507
1508         * platform/network/ParsedContentType.cpp:
1509         (WebCore::skipSpaces):
1510         (WebCore::parseQuotedString):
1511         (WebCore::ParsedContentType::parseContentType):
1512         (WebCore::ParsedContentType::parameterValueForName const):
1513         (WebCore::ParsedContentType::parameterCount const):
1514         (WebCore::ParsedContentType::setContentType):
1515         (WebCore::ParsedContentType::setContentTypeParameter):
1516         (WebCore::ParsedContentType::serialize const):
1517         * platform/network/ParsedContentType.h:
1518
1519 2019-02-08  Chris Fleizach  <cfleizach@apple.com>
1520
1521         AXObjectCache::childrenChanged shouldn't update layout or style during another style recalc
1522         https://bugs.webkit.org/show_bug.cgi?id=182280
1523         <rdar://problem/37018386>
1524
1525         Reviewed by Alan Bujtas.
1526
1527         Remove the possibility that changing children calls back into updating layout by
1528         handling children changes in a deferred manner.
1529
1530         This follows the same architecture as many other deferred changes, but also requires us to check deferred changes
1531         in updateBackingStore, because things like aria-hidden changes won't trigger a layout, but will require us to update children.
1532
1533         A few tests had to be modified to no longer change the tree and then check the children immediately. 
1534
1535         * accessibility/AXObjectCache.cpp:
1536         (WebCore::AXObjectCache::remove):
1537         (WebCore::AXObjectCache::childrenChanged):
1538         (WebCore::AXObjectCache::prepareForDocumentDestruction):
1539         (WebCore::AXObjectCache::performDeferredCacheUpdate):
1540         * accessibility/AXObjectCache.h:
1541         * accessibility/AccessibilityObject.cpp:
1542         (WebCore::AccessibilityObject::updateBackingStore):
1543         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
1544         (convertToNSArray):
1545         (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
1546
1547 2019-02-11  Myles C. Maxfield  <mmaxfield@apple.com>
1548
1549         [Cocoa] Ask platform for generic font family mappings
1550         https://bugs.webkit.org/show_bug.cgi?id=187723
1551         <rdar://problem/41892438>
1552
1553         Reviewed by Brent Fulgham.
1554
1555         WebKit API allows setting the generic font families for the USCRIPT_COMMON script.
1556         When trying to style a character with a generic font family, we first look to see if
1557         we have a mapping for the particular script the character is rendered with, and if we
1558         don't find a match, we then check USCRIPT_COMMON.
1559
1560         In the Cocoa ports, the only way families get set for non-USCRIPT_COMMON scripts (aka
1561         the only scripts which won't use the API families) is in
1562         SettingsBase::initializeDefaultFontFamilies(). That function only sets the families
1563         for the CJK scripts.
1564
1565         The mappings inside SettingsBase are incorrect and conflict with our policy regarding
1566         user-installed fonts. Instead, we should be consulting with the platform for some of
1567         these mappings, by calling CTFontDescriptorCreateForCSSFamily(). However, the WebKit
1568         API still has to work to set the mappings for untagged content. Therefore, we use the
1569         system mappings for language-tagged content, and the API mappings for non-language-tagged
1570         content. This is a good balance that makes sure we always have a good mapping for every
1571         language, but API clients can still set the mappings, too.
1572
1573         Test: fast/text/ja-sans-serif.html
1574
1575         * css/CSSComputedStyleDeclaration.cpp:
1576         * css/CSSFontSelector.cpp:
1577         (WebCore::resolveGenericFamily):
1578         * css/parser/CSSPropertyParser.cpp:
1579         (WebCore::consumeFontFamily):
1580         * page/cocoa/SettingsBaseCocoa.mm:
1581         (WebCore::SettingsBase::initializeDefaultFontFamilies):
1582         (WebCore::osakaMonoIsInstalled): Deleted.
1583         * platform/graphics/FontDescription.cpp:
1584         (WebCore::FontDescription::platformResolveGenericFamily):
1585         * platform/graphics/FontDescription.h:
1586         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
1587         (WebCore::computeSpecializedChineseLocale):
1588         (WebCore::cachedSpecializedChineseLocale):
1589         (WebCore::languageChanged):
1590         (WebCore::FontDescription::platformResolveGenericFamily):
1591         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
1592         (WebCore::SystemFontDatabaseCoreText::clear):
1593         (WebCore::genericFamily):
1594         (WebCore::SystemFontDatabaseCoreText::serifFamily):
1595         (WebCore::SystemFontDatabaseCoreText::sansSerifFamily):
1596         (WebCore::SystemFontDatabaseCoreText::cursiveFamily):
1597         (WebCore::SystemFontDatabaseCoreText::fantasyFamily):
1598         (WebCore::SystemFontDatabaseCoreText::monospaceFamily):
1599         * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
1600
1601 2019-02-11  Adrian Perez de Castro  <aperez@igalia.com>
1602
1603         [GTK][WPE] Add content extensions support in WKTR and unskip layout tests
1604         https://bugs.webkit.org/show_bug.cgi?id=193622
1605
1606         Reviewed by Michael Catanzaro.
1607
1608         No new tests needed.
1609
1610         * SourcesCocoa.txt: Remove loader/ResourceLoadInfo.cpp, it's not Cocoa-specific anymore.
1611         * Sources.txt: Add loader/ResourceLoadInfo.cpp, all ports use it now.
1612
1613 2019-02-11  Daniel Bates  <dabates@apple.com>
1614
1615         [iOS] Mouse/Touch/Pointer events are missing modifier keys
1616         https://bugs.webkit.org/show_bug.cgi?id=191446
1617         <rdar://problem/45929460>
1618
1619         Reviewed by Tim Horton.
1620
1621         Extract the modifier flags from the WebEvent. This code is only used by Legacy WebKit
1622         on iOS and we will need to fix <rdar://problem/47929759> in order for modifier flags
1623         to be passed to WebKit.
1624
1625         Tests: fast/events/touch/ios/mouse-events-with-modifiers.html
1626                fast/events/touch/ios/pointer-events-with-modifiers.html
1627                fast/events/touch/ios/touch-events-with-modifiers.html
1628
1629         * platform/ios/PlatformEventFactoryIOS.mm:
1630         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
1631         * platform/ios/WebEvent.h:
1632         * platform/ios/WebEvent.mm:
1633         (-[WebEvent initWithMouseEventType:timeStamp:location:]):
1634         (-[WebEvent initWithMouseEventType:timeStamp:location:modifiers:]):
1635
1636 2019-02-11  Jer Noble  <jer.noble@apple.com>
1637
1638         [Cocoa] Notify AVSystemController of our presenting PID before registering as a Now Playing app.
1639         https://bugs.webkit.org/show_bug.cgi?id=194504
1640
1641         Reviewed by Eric Carlson.
1642
1643         This allows the MediaRemote framework to associate the WebContent process with its host application.
1644
1645         * Modules/mediastream/UserMediaRequest.cpp:
1646         (WebCore::UserMediaRequest::start):
1647         * platform/audio/PlatformMediaSessionManager.h:
1648         (WebCore::PlatformMediaSessionManager::prepareToSendUserMediaPermissionRequest):
1649         * platform/audio/cocoa/MediaSessionManagerCocoa.h:
1650         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
1651         (MediaSessionManagerCocoa::prepareToSendUserMediaPermissionRequest):
1652         (MediaSessionManagerCocoa::providePresentingApplicationPIDIfNecessary):
1653         (MediaSessionManagerCocoa::updateNowPlayingInfo):
1654
1655 2019-02-11  Commit Queue  <commit-queue@webkit.org>
1656
1657         Unreviewed, rolling out r241272 and r241276.
1658         https://bugs.webkit.org/show_bug.cgi?id=194514
1659
1660         Broke the Apple Internal build and the fix requires human
1661         intervention :( (Requested by dydz on #webkit).
1662
1663         Reverted changesets:
1664
1665         "[iOS] Mouse/Touch/Pointer events are missing modifier keys"
1666         https://bugs.webkit.org/show_bug.cgi?id=191446
1667         https://trac.webkit.org/changeset/241272
1668
1669         "Fix internal iOS build after r241272"
1670         https://bugs.webkit.org/show_bug.cgi?id=191446
1671         https://trac.webkit.org/changeset/241276
1672
1673 2019-02-11  Alex Christensen  <achristensen@webkit.org>
1674
1675         Stop using setDefersLoading from WebCore
1676         https://bugs.webkit.org/show_bug.cgi?id=194315
1677
1678         Reviewed by Jer Noble.
1679
1680         That is what CompletionHandlers are for.
1681
1682         * loader/MediaResourceLoader.cpp:
1683         (WebCore::MediaResource::responseReceived):
1684         (WebCore::MediaResource::setDefersLoading): Deleted.
1685         * loader/MediaResourceLoader.h:
1686         * platform/graphics/PlatformMediaResourceLoader.h:
1687         (WebCore::PlatformMediaResourceClient::responseReceived):
1688         (WebCore::PlatformMediaResource::stop):
1689         (WebCore::PlatformMediaResource::setDefersLoading): Deleted.
1690         * platform/network/cocoa/WebCoreNSURLSession.mm:
1691         (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
1692         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:completionHandler:]):
1693         (-[WebCoreNSURLSessionDataTask _setDefersLoading:]): Deleted.
1694         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): Deleted.
1695
1696 2019-02-11  Daniel Bates  <dabates@apple.com>
1697
1698         [iOS] Mouse/Touch/Pointer events are missing modifier keys
1699         https://bugs.webkit.org/show_bug.cgi?id=191446
1700         <rdar://problem/45929460>
1701
1702         Reviewed by Tim Horton.
1703
1704         Extract the modifier flags from the WebEvent. This code is only used by Legacy WebKit
1705         on iOS and we will need to fix <rdar://problem/47929759> in order for modifier flags
1706         to be passed to WebKit.
1707
1708         Tests: fast/events/touch/ios/mouse-events-with-modifiers.html
1709                fast/events/touch/ios/pointer-events-with-modifiers.html
1710                fast/events/touch/ios/touch-events-with-modifiers.html
1711
1712         * platform/ios/PlatformEventFactoryIOS.mm:
1713         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
1714         * platform/ios/WebEvent.h:
1715         * platform/ios/WebEvent.mm:
1716         (-[WebEvent initWithMouseEventType:timeStamp:location:]):
1717         (-[WebEvent initWithMouseEventType:timeStamp:location:modifiers:]):
1718
1719 2019-02-11  Daniel Bates  <dabates@apple.com>
1720
1721         Separate out outline-style: auto user-agent appearance from Mac animated focus ring drawing
1722         https://bugs.webkit.org/show_bug.cgi?id=193591
1723
1724         Reviewed by Simon Fraser.
1725
1726         Untangle the Mac-specific concept of animated focus ring drawing from the concepts of using
1727         the fancy shrink-wrapped focus ring appearance and using the platform focus ring color when
1728         outline-style: auto.
1729
1730         No functionality changed. So, no new tests.
1731
1732         * platform/graphics/GraphicsContext.h:
1733         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1734         (WebCore::drawFocusRing):
1735         (WebCore::drawFocusRingToContextAtTime):
1736         Change some macro guards.
1737
1738         * rendering/RenderElement.cpp:
1739         (WebCore::usePlatformFocusRingColorForOutlineStyleAuto): Added.
1740         (WebCore::useShrinkWrappedFocusRingForOutlineStyleAuto): Added.
1741         (WebCore::drawFocusRing): Added.
1742         (WebCore::RenderElement::paintFocusRing): Write in terms of drawFocusRing().
1743
1744 2019-02-11  Truitt Savell  <tsavell@apple.com>
1745
1746         Unreviewed, rolling out r241229.
1747
1748         Revision broke internal builds for watchOS.
1749
1750         Reverted changeset:
1751
1752         "[Cocoa] Ask platform for generic font family mappings"
1753         https://bugs.webkit.org/show_bug.cgi?id=187723
1754         https://trac.webkit.org/changeset/241229
1755
1756 2019-02-11  Youenn Fablet  <youenn@apple.com>
1757
1758         Make Request constructor throw if FetchRequestInit.signal is not undefined, null or an AbortSignal object
1759         https://bugs.webkit.org/show_bug.cgi?id=194404
1760         <rdar://problem/47891915>
1761
1762         Reviewed by Geoffrey Garen.
1763
1764         Align with the spec, except for known problematic web sites.
1765         Covered by updated test.
1766
1767         * Modules/fetch/FetchRequest.cpp:
1768         (WebCore::needsSignalQuirk):
1769         (WebCore::processInvalidSignal):
1770         (WebCore::FetchRequest::initializeWith):
1771
1772 2019-02-11  Zalan Bujtas  <zalan@apple.com>
1773
1774         [LFC] FormattingContext::Geometry::floatingHeightAndMargin should take UsedHorizontalValues
1775         https://bugs.webkit.org/show_bug.cgi?id=194490
1776
1777         Reviewed by Antti Koivisto.
1778
1779         This is in preparation for adding floating preferred width computation support. It requires height computaiton
1780         which uses containing block width to resolve vertical margins.
1781
1782         * layout/FormattingContext.cpp:
1783         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
1784         * layout/FormattingContext.h:
1785         * layout/FormattingContextGeometry.cpp:
1786         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
1787         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1788         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
1789         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
1790         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1791         (WebCore::Layout::FormattingContext::Geometry::computedVerticalMargin):
1792         * layout/FormattingContextQuirks.cpp:
1793         (WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight):
1794         * layout/LayoutUnits.h:
1795         (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
1796         * layout/blockformatting/BlockFormattingContext.cpp:
1797         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
1798         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1799         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1800         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1801         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
1802         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
1803         * layout/blockformatting/BlockMarginCollapse.cpp:
1804         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues):
1805         (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
1806         * layout/inlineformatting/InlineFormattingContext.cpp:
1807         (WebCore::Layout::InlineFormattingContext::layout const):
1808         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
1809         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
1810         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin):
1811
1812 2019-02-11  Zalan Bujtas  <zalan@apple.com>
1813
1814         [LFC] FormattingContext::intrinsicWidthConstraints should compute and save the intrinsic widths consistently.
1815         https://bugs.webkit.org/show_bug.cgi?id=194483
1816
1817         Reviewed by Antti Koivisto.
1818
1819         Rename intrinsicWidthConstraints to computeIntrinsicWidthConstraints (it does not return the width values anymore).
1820
1821         * layout/FormattingContext.h:
1822         * layout/FormattingContextGeometry.cpp:
1823         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
1824         * layout/blockformatting/BlockFormattingContext.cpp:
1825         (WebCore::Layout::BlockFormattingContext::computeIntrinsicWidthConstraints const):
1826         (WebCore::Layout::BlockFormattingContext::intrinsicWidthConstraints const): Deleted.
1827         * layout/blockformatting/BlockFormattingContext.h:
1828         * layout/inlineformatting/InlineFormattingContext.cpp:
1829         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
1830         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const):
1831         (WebCore::Layout::InlineFormattingContext::intrinsicWidthConstraints const): Deleted.
1832         * layout/inlineformatting/InlineFormattingContext.h:
1833
1834 2019-02-10  Zalan Bujtas  <zalan@apple.com>
1835
1836         [LFC] Fix spelling error.
1837         https://bugs.webkit.org/show_bug.cgi?id=194489
1838
1839         Reviewed by Simon Fraser.
1840
1841         instrinsic -> intrinsic
1842
1843         * layout/FormattingContext.h:
1844         * layout/FormattingContextGeometry.cpp:
1845         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
1846         * layout/FormattingState.h:
1847         (WebCore::Layout::FormattingState::setIntrinsicWidthConstraints):
1848         (WebCore::Layout::FormattingState::clearIntrinsicWidthConstraints):
1849         (WebCore::Layout::FormattingState::intrinsicWidthConstraints const):
1850         (WebCore::Layout::FormattingState::setInstrinsicWidthConstraints): Deleted.
1851         (WebCore::Layout::FormattingState::clearInstrinsicWidthConstraints): Deleted.
1852         (WebCore::Layout::FormattingState::instrinsicWidthConstraints const): Deleted.
1853         * layout/blockformatting/BlockFormattingContext.cpp:
1854         (WebCore::Layout::BlockFormattingContext::intrinsicWidthConstraints const):
1855         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const): Deleted.
1856         * layout/blockformatting/BlockFormattingContext.h:
1857         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1858         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraintsNeedChildrenWidth):
1859         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
1860         (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraintsNeedChildrenWidth): Deleted.
1861         (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraints): Deleted.
1862         * layout/inlineformatting/InlineFormattingContext.cpp:
1863         (WebCore::Layout::InlineFormattingContext::intrinsicWidthConstraints const):
1864         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const):
1865         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const): Deleted.
1866         * layout/inlineformatting/InlineFormattingContext.h:
1867
1868 2019-02-10  Darin Adler  <darin@apple.com>
1869
1870         Switch uses of StringBuilder with String::format for hex numbers to use HexNumber.h instead
1871         https://bugs.webkit.org/show_bug.cgi?id=194485
1872
1873         Reviewed by Daniel Bates.
1874
1875         * Modules/websockets/WebSocket.cpp:
1876         (WebCore::encodeProtocolString): Use appendUnsignedAsHexFixedSize instead of String::format.
1877
1878         * css/parser/CSSParserToken.cpp:
1879         (WebCore::CSSParserToken::serialize const): Fixed style of many return statements
1880         that called a function returning void; doesn't match WebKit's prevailing style.
1881         Also use break instead of return. Used appendLiteral instead of append in many
1882         cases, and append character instead of single-character literal in others.
1883         Use appendUnsignedAsHex instead of String::format.
1884
1885         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1886         (WebCore::generateHashedName): Use appendUnsignedAsHex instad of appendUnsigned64AsHex.
1887         Should come back here and use makeString once we make HexNumber.h work with that.
1888
1889         * platform/mac/WebCoreNSURLExtras.mm: Removed unnecessary include of HexNumber.h.
1890
1891         * rendering/RenderTreeAsText.cpp:
1892         (WebCore::quoteAndEscapeNonPrintables): Use appendLiteral instead of multiple calls
1893         to character append. Touched because it was next to a call to appendUnsignedAsHex.
1894
1895 2019-02-10  Pablo Saavedra  <psaavedra@igalia.com>
1896
1897         libWPEWebKit-0.1.so: undefined reference to `JSC::JSValue::asCell() const
1898         https://bugs.webkit.org/show_bug.cgi?id=194484
1899
1900         Reviewed by Darin Adler.
1901
1902         * bindings/js/JSUndoItemCustom.cpp:
1903
1904 2019-02-10  Philippe Normand  <pnormand@igalia.com>
1905
1906         Unreviewed, GTK Debug build fix after r241148.
1907
1908         * Modules/mediasource/SourceBuffer.cpp:
1909         (WebCore::removeSamplesFromTrackBuffer):
1910         SourceBuffer::logClassName and friends are declared for
1911         !RELEASE_LOG_DISABLED builds so adapt calling sites accordingly.
1912
1913 2019-02-10  Zalan Bujtas  <zalan@apple.com>
1914
1915         [LFC][IFC] Add intrinsic width support for inline-block boxes
1916         https://bugs.webkit.org/show_bug.cgi?id=194479
1917
1918         Reviewed by Antti Koivisto.
1919
1920         Compute the intrinsic width for the inline-block (formatting context root) and set it as the content box width while
1921         laying out the content for the min/max width.
1922
1923         <div style="position: absolute">before<span id=inline-block style="display: inline-block">inline_block content<span>after</div>
1924
1925         The "inline-block" formatting root returns "inline_block" width for the minimum and "inline_block width" for
1926         the maximum width. These min/max values are used to figure out the intrinsic width for the parent <div>.
1927
1928         * layout/inlineformatting/InlineFormattingContext.cpp:
1929         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
1930         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const):
1931         (WebCore::Layout::InlineFormattingContext::computeMargin const):
1932         * layout/inlineformatting/InlineFormattingContext.h:
1933         * page/FrameViewLayoutContext.cpp:
1934         (WebCore::layoutUsingFormattingContext):
1935
1936 2019-02-10  Zalan Bujtas  <zalan@apple.com>
1937
1938         [LFC][IFC] Add intrinsic width support for replaced boxes
1939         https://bugs.webkit.org/show_bug.cgi?id=194478
1940
1941         Reviewed by Antti Koivisto.
1942
1943         * layout/inlineformatting/InlineFormattingContext.cpp:
1944         (WebCore::Layout::InlineFormattingContext::layout const):
1945         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
1946         (WebCore::Layout::InlineFormattingContext::computeMargin const):
1947         (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const):
1948         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
1949         (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForReplacedInlineBox const):
1950         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const): Deleted.
1951         * layout/inlineformatting/InlineFormattingContext.h:
1952
1953 2019-02-10  Alicia Boya García  <aboya@igalia.com>
1954
1955         [MSE][GStreamer] Add missing return type to lambda
1956         https://bugs.webkit.org/show_bug.cgi?id=194414
1957
1958         Reviewed by Darin Adler.
1959
1960         Since g_signal_connect() is untyped, a compiler error was not
1961         generated when a lambda with a missing GstFlowReturn return type was
1962         provided for a signal that expects it.
1963
1964         This used to work before r240784 because a recent function call had
1965         set GST_FLOW_OK in the return value register and it happened to
1966         survive until the lambda function call ended. Starting on that commit
1967         such return value was removed and it stopped working on debug.
1968
1969         Of course, the actual problem is in the signature of the lambda
1970         function, and this patch fixes that.
1971
1972         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1973         (WebCore::AppendPipeline::AppendPipeline):
1974
1975 2019-02-09  Darin Adler  <darin@apple.com>
1976
1977         Eliminate unnecessary String temporaries by using StringConcatenateNumbers
1978         https://bugs.webkit.org/show_bug.cgi?id=194021
1979
1980         Reviewed by Geoffrey Garen.
1981
1982         For floating point numbers, String::number gives a fixed precision result,
1983         stripping trailing zeroes. When possible, I changed the code to instead use the
1984         equivalent of String::numberToStringECMAScript, which is what makeString does by
1985         default for floating point, gives the same results for many cases, and gives
1986         better results in many others. However, for floats, we do not yet have a good
1987         implementation, so instead I used FormattedNumber::fixedPrecision to match
1988         the old behavior.
1989
1990         * Modules/indexeddb/shared/IDBTransactionInfo.cpp:
1991         (WebCore::IDBTransactionInfo::loggingString const): Remove String::number and let
1992         makeString do the conversion without allocating/destroying a String.
1993         * Modules/websockets/ThreadableWebSocketChannel.cpp:
1994         (WebCore::ThreadableWebSocketChannel::create): Ditto.
1995         * Modules/websockets/WebSocket.cpp:
1996         (WebCore::WebSocket::connect): Ditto. Added a cast to "unsigned" to sidestep the
1997         ambiguity with 16-bit unsigned types that are sometimes used for numbers (uint16_t)
1998         and sometimes used for UTF-16 code units (UChar) and can be the same type.
1999
2000         * Modules/websockets/WebSocketChannel.cpp:
2001         (WebCore::WebSocketChannel::didFailSocketStream): Use ASCIILiteral when intializing
2002         a string instead of just a normal C literal. Switched to makeString so we could
2003         remove String::number and do the conversion without allocating/destroying a String.
2004         (WebCore::WebSocketChannel::didFail): Ditto.
2005         (WebCore::WebSocketChannel::processFrame): Ditto.
2006         * Modules/websockets/WebSocketFrame.cpp:
2007         (WebCore::WebSocketFrame::parseFrame): Ditto.
2008         * Modules/websockets/WebSocketHandshake.cpp:
2009         (WebCore::WebSocketHandshake::readServerHandshake): Ditto.
2010         * accessibility/AccessibilityRenderObject.cpp:
2011         (WebCore::AccessibilityRenderObject::positionalDescriptionForMSAA const): Ditto.
2012         * bindings/js/JSDOMConvertNumbers.cpp:
2013         (WebCore::rangeErrorString): Ditto.
2014         * css/CSSAspectRatioValue.cpp:
2015         (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. Used
2016         FormattedNumber::fixedPrecision since these are floats.
2017
2018         * css/DOMMatrixReadOnly.cpp:
2019         (WebCore::DOMMatrixReadOnly::toString const): Use
2020         StringBuilder::builder.appendECMAScriptNumber instead of
2021         String::numberToStringECMAScript so we can do it without allocating/destroying
2022         a String.
2023         * css/WebKitCSSMatrix.cpp:
2024         (WebCore::WebKitCSSMatrix::toString const): Ditto.
2025
2026         * dom/MessagePortIdentifier.h:
2027         (WebCore::MessagePortIdentifier::logString const): Remove String::number and let
2028         makeString do the conversion without allocating/destroying a String.
2029
2030         * editing/cocoa/DataDetection.mm:
2031         (WebCore::dataDetectorStringForPath): Remove unnecessary type casts on values
2032         passed to String::number and to StringBuilder::appendNumber. These could do
2033         harm if the values were out of range, and should not be necessary.
2034
2035         * history/BackForwardItemIdentifier.h:
2036         (WebCore::BackForwardItemIdentifier::logString const): Remove String::number
2037         and let makeString do the conversion without allocating/destroying a String.
2038         * html/FTPDirectoryDocument.cpp:
2039         (WebCore::processFileDateString): Ditto.
2040         * html/canvas/WebGLRenderingContextBase.cpp:
2041         (WebCore::WebGLRenderingContextBase::getUniformLocation): Ditto.
2042         (WebCore::WebGLRenderingContextBase::checkTextureCompleteness): Ditto.
2043         * inspector/agents/WebConsoleAgent.cpp:
2044         (WebCore::WebConsoleAgent::didReceiveResponse): Ditto.
2045         * loader/WorkerThreadableLoader.cpp:
2046         (WebCore::WorkerThreadableLoader::loadResourceSynchronously): Ditto.
2047         * loader/appcache/ApplicationCacheGroup.cpp:
2048         (WebCore::ApplicationCacheGroup::didFailLoadingManifest): Ditto.
2049         * page/PageSerializer.cpp:
2050         (WebCore::PageSerializer::urlForBlankFrame): Ditto.
2051         * page/PrintContext.cpp:
2052         (WebCore::PrintContext::pageProperty): Ditto.
2053         (WebCore::PrintContext::pageSizeAndMarginsInPixels): Ditto.
2054
2055         * page/WheelEventTestTrigger.cpp:
2056         (WebCore::dumpState): Use StringBuilder::appendNumber instead of
2057         String::number so we can do it without allocating/destroying a String.
2058         Also use StringBuilder::appendLiteral on a literal.
2059
2060         * page/cocoa/ResourceUsageOverlayCocoa.mm:
2061         (WebCore::ResourceUsageOverlay::platformDraw): Pass explicit
2062         KeepTrailingZeros to FormattedNumber::fixedPrecision to preserve behavior,
2063         since default is now to truncate trailing zeros.
2064
2065         * platform/graphics/Color.cpp:
2066         (WebCore::Color::cssText): Use StringBuilder::appendNumber instead of
2067         calling numberToFixedPrecisionString to do the same thing.
2068         * platform/graphics/ExtendedColor.cpp:
2069         (WebCore::ExtendedColor::cssText): Ditto.
2070
2071         * platform/graphics/ca/GraphicsLayerCA.cpp:
2072         (WebCore::animationIdentifier): Remove String::number and let makeString
2073         do the conversion without allocating/destroying a String. Had to add
2074         a typecast to convert the enumeration into an integer.
2075         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
2076         (WebCore::PlatformCAFilters::setFiltersOnLayer): Ditto.
2077         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
2078         (WebCore::FontPlatformData::description const): Ditto.
2079
2080         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
2081         (WebCore::MockMediaSample::MockMediaSample): Use AtomicString::number
2082         instead of String::number to avoid unneccessarily allocating an additional
2083         temporary String when an AtomicString already exists.
2084
2085         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2086         (WebCore::SocketStreamHandleImpl::reportErrorToClient): Remove String::number
2087         and let makeString do the conversion without allocating/destroying a String.
2088         * platform/sql/SQLiteDatabase.cpp:
2089         (WebCore::SQLiteDatabase::setMaximumSize): Ditto.
2090         (WebCore::SQLiteDatabase::setSynchronous): Ditto. Had to add a typecast to
2091         convert the enumeration into an integer.
2092         * svg/SVGAngleValue.cpp:
2093         (WebCore::SVGAngleValue::valueAsString const): Ditto.
2094         * svg/SVGLengthValue.cpp:
2095         (WebCore::SVGLengthValue::valueAsString const): Ditto.
2096         * testing/Internals.cpp:
2097         (WebCore::Internals::configurationForViewport): Ditto. Used
2098         FormattedNumber::fixedPrecision since these are floats.
2099         (WebCore::Internals::getCurrentCursorInfo): Use StringBuilder::appendNumber
2100         instead of calling numberToFixedPrecisionString to do the same thing.
2101         (WebCore::Internals::queueMicroTask): Remove String::number and let makeString
2102         do the conversion without allocating/destroying a String.
2103         (WebCore::appendOffsets): Use StringBuilder::appendNumber instead of
2104         String::number so we can do it without allocating/destroying a String.
2105
2106         * workers/service/ServiceWorkerClientIdentifier.h:
2107         (WebCore::ServiceWorkerClientIdentifier::toString const): Remove String::number
2108         and let makeString do the conversion without allocating/destroying a String.
2109         * workers/service/server/RegistrationDatabase.cpp:
2110         (WebCore::databaseFilenameFromVersion): Ditto.
2111
2112 2019-02-09  Zalan Bujtas  <zalan@apple.com>
2113
2114         [LFC][IFC] Add intrinsic width support for basic inline containers
2115         https://bugs.webkit.org/show_bug.cgi?id=194473
2116
2117         Reviewed by Antti Koivisto.
2118
2119         Preferred width computation logic is very similar to normal layout.
2120         One of the main difference is that the preferred width codepath does not provide valid containing block width.
2121         This patch implement basic inline container support by passing nullopt containing block width in UsedHorizontalValues. 
2122
2123         * layout/inlineformatting/InlineFormattingContext.cpp:
2124         (WebCore::Layout::InlineFormattingContext::layout const):
2125         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
2126         (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const):
2127         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const):
2128         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
2129         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
2130         (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForReplacedInlineBox const):
2131         * layout/inlineformatting/InlineFormattingContext.h:
2132
2133 2019-02-08  Myles C. Maxfield  <mmaxfield@apple.com>
2134
2135         [Cocoa] CTLineGetGlyphRuns() might return nullptr
2136         https://bugs.webkit.org/show_bug.cgi?id=194467
2137         <rdar://problem/42423999>
2138
2139         Reviewed by Simon Fraser.
2140
2141         Be somewhat defensive to try to make sure this sort of thing doesn't happen in the future.
2142
2143         Covered by find/text/find-backwards.html
2144
2145         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
2146         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
2147
2148 2019-02-08  Myles C. Maxfield  <mmaxfield@apple.com>
2149
2150         [Cocoa] Ask platform for generic font family mappings
2151         https://bugs.webkit.org/show_bug.cgi?id=187723
2152         <rdar://problem/41892438>
2153
2154         Reviewed by Brent Fulgham.
2155
2156         WebKit API allows setting the generic font families for the USCRIPT_COMMON script.
2157         When trying to style a character with a generic font family, we first look to see if
2158         we have a mapping for the particular script the character is rendered with, and if we
2159         don't find a match, we then check USCRIPT_COMMON.
2160
2161         In the Cocoa ports, the only way families get set for non-USCRIPT_COMMON scripts (aka
2162         the only scripts which won't use the API families) is in
2163         SettingsBase::initializeDefaultFontFamilies(). That function only sets the families
2164         for the CJK scripts.
2165
2166         The mappings inside SettingsBase are incorrect and conflict with our policy regarding
2167         user-installed fonts. Instead, we should be consulting with the platform for some of
2168         these mappings, by calling CTFontDescriptorCreateForCSSFamily(). However, the WebKit
2169         API still has to work to set the mappings for untagged content. Therefore, we use the
2170         system mappings for language-tagged content, and the API mappings for non-language-tagged
2171         content. This is a good balance that makes sure we always have a good mapping for every
2172         language, but API clients can still set the mappings, too.
2173
2174         Test: fast/text/ja-sans-serif.html
2175
2176         * css/CSSComputedStyleDeclaration.cpp:
2177         * css/CSSFontSelector.cpp:
2178         (WebCore::resolveGenericFamily):
2179         * css/parser/CSSPropertyParser.cpp:
2180         (WebCore::consumeFontFamily):
2181         * page/cocoa/SettingsBaseCocoa.mm:
2182         (WebCore::SettingsBase::initializeDefaultFontFamilies):
2183         (WebCore::osakaMonoIsInstalled): Deleted.
2184         * platform/graphics/FontDescription.cpp:
2185         (WebCore::FontDescription::platformResolveGenericFamily):
2186         * platform/graphics/FontDescription.h:
2187         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
2188         (WebCore::computeSpecializedChineseLocale):
2189         (WebCore::cachedSpecializedChineseLocale):
2190         (WebCore::languageChanged):
2191         (WebCore::FontDescription::platformResolveGenericFamily):
2192         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
2193         (WebCore::SystemFontDatabaseCoreText::clear):
2194         (WebCore::SystemFontDatabaseCoreText::serifFamily):
2195         (WebCore::SystemFontDatabaseCoreText::sansSerifFamily):
2196         (WebCore::SystemFontDatabaseCoreText::cursiveFamily):
2197         (WebCore::SystemFontDatabaseCoreText::fantasyFamily):
2198         (WebCore::SystemFontDatabaseCoreText::monospaceFamily):
2199         * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
2200
2201 2019-02-08  Yusuke Suzuki  <ysuzuki@apple.com>
2202
2203         [JSC] Shrink sizeof(CodeBlock) more
2204         https://bugs.webkit.org/show_bug.cgi?id=194419
2205
2206         Reviewed by Mark Lam.
2207
2208         * testing/Internals.cpp:
2209         (WebCore::Internals::parserMetaData):
2210
2211 2019-02-08  Chris Dumez  <cdumez@apple.com>
2212
2213         [Cocoa] Optimize ResourceResponse::platformLazyInit()
2214         https://bugs.webkit.org/show_bug.cgi?id=194438
2215
2216         Reviewed by Alex Christensen.
2217
2218         Optimize ResourceResponse::platformLazyInit(). Most of the CPU time currently goes into getting the
2219         HTTP headers from CFNetwork:
2220         """
2221         Sample Count, Samples %, CPU %, Symbol
2222         46, 0.0%, 0.0%, WebCore::initializeHTTPHeaders(WebCore::OnlyCommonHeaders, NSHTTPURLResponse*, WebCore::HTTPHeaderMap&) (in WebCore)
2223         34, 0.0%, 0.0%,     HTTPHeaderDict::copyAsOrdinaryDict(__CFAllocator const*) const (in CFNetwork)
2224         11, 0.0%, 0.0%,     CFDictionaryApplyFunction (in CoreFoundation)
2225         """
2226
2227         We currently have 2 levels of initialization: CommonFieldsOnly & AllFields. With WebKit2, most ResourceResponses get sent over IPC
2228         and thus end up getting initialized twice, once with CommonFieldsOnly and then with AllFields.
2229         This would cause us to call the expensive HTTPHeaderDict::copyAsOrdinaryDict() twice instead of once, simply to initialize the common
2230         HTTP headers first and then the uncommon ones later.
2231
2232         This patch updates ResourceResponse::platformLazyInit() to initialize all HTTP headers at once, as soon as CommonFieldsOnly
2233         initialization is requested, so that we no longer copy all HTTP headers twice.
2234
2235         * platform/network/cocoa/ResourceResponseCocoa.mm:
2236         (WebCore::initializeHTTPHeaders):
2237         (WebCore::ResourceResponse::platformLazyInit):
2238
2239 2019-02-08  Justin Fan  <justin_fan@apple.com>
2240
2241         [Web GPU] Build fix for MTLStorageMode availability on different Cocoa platforms
2242         https://bugs.webkit.org/show_bug.cgi?id=194443
2243
2244         Unreviewed build fix.
2245
2246         For MTLTextures, MTLStorageModeManaged is only available on macOS. Other platforms,
2247         if not using MTLStorageModePrivate, must use MTLStorageModeShared.
2248
2249         Behavior unchanged.
2250
2251         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
2252         (WebCore::storageModeForPixelFormatAndSampleCount):
2253
2254 2019-02-08  Per Arne Vollan  <pvollan@apple.com>
2255
2256         [WebVTT] Inline WebVTT styles should start with '::cue'
2257         https://bugs.webkit.org/show_bug.cgi?id=194227
2258         <rdar://problem/47791087>
2259
2260         Reviewed by Eric Carlson.
2261
2262         Check that the CSS string starts with '::cue' and is successfully parsed before adding it
2263         to the CSS stylesheet list. Also, the caption preferences CSS string should start with
2264         '::cue', since it is added inside the video shadow root element.
2265
2266         Test: media/track/track-cue-css.html
2267
2268         * html/track/WebVTTParser.cpp:
2269         (WebCore::WebVTTParser::checkAndStoreStyleSheet):
2270         * page/CaptionUserPreferencesMediaAF.cpp:
2271         (WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride const):
2272
2273 2019-02-08  Youenn Fablet  <youenn@apple.com>
2274
2275         Running RTCRtpSender.getCapabilities("video") before initial offer breaks VP8
2276         https://bugs.webkit.org/show_bug.cgi?id=194380
2277         <rdar://problem/47916514>
2278
2279         Reviewed by Eric Carlson.
2280
2281         Set whether VP8 is supported at creation of the page.
2282         This ensures that any call creating a peer connection factory will end up supporting the runtime flag configuration.
2283
2284         Add internal API to enable resetting the factory to enable proper testing.
2285
2286         Covered by updated test.
2287
2288         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2289         (WebCore::createLibWebRTCPeerConnectionBackend):
2290         * page/Page.cpp:
2291         (WebCore::m_applicationManifest):
2292         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2293         * testing/Internals.cpp:
2294         (WebCore::Internals::clearPeerConnectionFactory):
2295         * testing/Internals.h:
2296         * testing/Internals.idl:
2297
2298 2019-02-08  Andy Estes  <aestes@apple.com>
2299
2300         [WebIDL] Support serializing sequences and FrozenArrays of non-interfaces
2301         https://bugs.webkit.org/show_bug.cgi?id=190997
2302         <rdar://problem/35983035>
2303
2304         Reviewed by Brent Fulgham.
2305
2306         Support serializing sequences and FrozenArrays of types that aren't interfaces. This is
2307         needed to properly serialize PaymentAddress, which has a FrozenArray of DOMStrings.
2308
2309         We should support serializing sequences of interfaces too, but that's slightly more
2310         complicated since it involves iterating the sequence and serializing each of its items. I
2311         left that as a follow-up task, since I don't see any IDLs that currently need this.
2312
2313         We also don't support serializing sequences with the CachedAttribute or CustomGetter
2314         extended attributes, because WebIDL specifies that a new array should be created when
2315         converting an IDL sequence into an ECMAScript value.
2316
2317         Added bindings test cases to TestSerialization.idl and PaymentAddress test cases to
2318         http/tests/paymentrequest/payment-address-attributes-and-toJSON-method.https.html.
2319
2320         * bindings/scripts/CodeGenerator.pm:
2321         (GetInterfaceForType): Renamed from GetInterfaceForAttribute.
2322         (IsSerializableType): Modified to allow sequences and FrozenArrays of non-interface types.
2323         (hasCachedAttributeOrCustomGetterExtendedAttribute): Added a helper to determine if an
2324         attribute has the CachedAttribute or CustomGetter extended attributes.
2325         (IsSerializableAttribute): Checked for sequences with the CachedAttribute or CustomGetter
2326         extended attributes before calling IsSerializableType.
2327         (GetInterfaceForAttribute): Renamed to GetInterfaceForType.
2328         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2329         * bindings/scripts/test/TestSerialization.idl:
2330
2331 2019-02-08  Sihui Liu  <sihui_liu@apple.com>
2332
2333         IndexedDB tests leak documents
2334         https://bugs.webkit.org/show_bug.cgi?id=189435
2335         <rdar://problem/44240043>
2336
2337         Reviewed by Geoffrey Garen.
2338
2339         Remove use of JSC::Strong in IndexedDatabase.
2340
2341         * Modules/indexeddb/IDBCursor.cpp:
2342         (WebCore::IDBCursor::update):
2343         (WebCore::IDBCursor::continuePrimaryKey):
2344         (WebCore::IDBCursor::continueFunction):
2345         (WebCore::IDBCursor::deleteFunction):
2346         (WebCore::IDBCursor::setGetResult):
2347         * Modules/indexeddb/IDBCursor.h:
2348         (WebCore::IDBCursor::key):
2349         (WebCore::IDBCursor::primaryKey):
2350         (WebCore::IDBCursor::value):
2351         (WebCore::IDBCursor::keyWrapper):
2352         (WebCore::IDBCursor::primaryKeyWrapper):
2353         (WebCore::IDBCursor::valueWrapper):
2354         (WebCore::IDBCursor::key const): Deleted.
2355         (WebCore::IDBCursor::primaryKey const): Deleted.
2356         (WebCore::IDBCursor::value const): Deleted.
2357         * Modules/indexeddb/IDBCursor.idl:
2358         * Modules/indexeddb/IDBCursorWithValue.idl:
2359         * Modules/indexeddb/IDBObjectStore.cpp:
2360         (WebCore::IDBObjectStore::putForCursorUpdate):
2361         * Modules/indexeddb/IDBObjectStore.h:
2362         * Modules/indexeddb/IDBRequest.cpp:
2363         (WebCore::IDBRequest::IDBRequest):
2364         (WebCore::IDBRequest::~IDBRequest):
2365         (WebCore::IDBRequest::result const):
2366         (WebCore::IDBRequest::setResult):
2367         (WebCore::IDBRequest::setResultToStructuredClone):
2368         (WebCore::IDBRequest::setResultToUndefined):
2369         (WebCore::IDBRequest::resultCursor):
2370         (WebCore::IDBRequest::willIterateCursor):
2371         (WebCore::IDBRequest::didOpenOrIterateCursor):
2372         * Modules/indexeddb/IDBRequest.h:
2373         (WebCore::IDBRequest::resultWrapper):
2374         * Modules/indexeddb/IDBRequest.idl:
2375         * Sources.txt:
2376         * WebCore.xcodeproj/project.pbxproj:
2377         * bindings/js/JSIDBCursorCustom.cpp:
2378         (WebCore::JSIDBCursor::key const):
2379         (WebCore::JSIDBCursor::primaryKey const):
2380         (WebCore::JSIDBCursor::visitAdditionalChildren):
2381         * bindings/js/JSIDBCursorWithValueCustom.cpp:
2382         (WebCore::JSIDBCursorWithValue::value const):
2383         (WebCore::JSIDBCursorWithValue::visitAdditionalChildren):
2384         * bindings/js/JSIDBRequestCustom.cpp: Added.
2385         (WebCore::JSIDBRequest::result const):
2386         (WebCore::JSIDBRequest::visitAdditionalChildren):
2387         * inspector/agents/InspectorIndexedDBAgent.cpp:
2388
2389 2019-02-08  Zalan Bujtas  <zalan@apple.com>
2390
2391         [LFC] The used containing block width value is optional
2392         https://bugs.webkit.org/show_bug.cgi?id=194428
2393
2394         Reviewed by Antti Koivisto.
2395
2396         The preferred width codepath cannot provide a valid used containing block width value.
2397
2398         "The percentage is calculated with respect to the width of the generated box's containing block.
2399         If the containing block's width depends on this element's width, then the resulting layout is undefined in CSS 2.2."
2400
2401         Let's use 0 as used value for now.
2402
2403         * layout/FormattingContextGeometry.cpp:
2404         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
2405         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2406         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
2407         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2408         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
2409         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
2410         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
2411         (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin):
2412         * layout/LayoutUnits.h:
2413         (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
2414         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2415         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
2416         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
2417         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
2418         * page/FrameViewLayoutContext.cpp:
2419
2420 2019-02-08  Zalan Bujtas  <zalan@apple.com>
2421
2422         [LFC] Horizontal geometry compute functions should take the containing block's width as a used value
2423         https://bugs.webkit.org/show_bug.cgi?id=194424
2424
2425         Reviewed by Antti Koivisto.
2426
2427         This is in preparation for passing optional containing block width for the preferred with codepath. 
2428
2429         * layout/FormattingContext.cpp:
2430         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
2431         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
2432         * layout/FormattingContext.h:
2433         * layout/FormattingContextGeometry.cpp:
2434         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
2435         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2436         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
2437         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2438         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
2439         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
2440         (WebCore::Layout::FormattingContext::Geometry::computedBorder):
2441         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
2442         (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin):
2443         * layout/LayoutUnits.h:
2444         (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
2445         * layout/blockformatting/BlockFormattingContext.cpp:
2446         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
2447         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2448         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
2449         * layout/inlineformatting/InlineFormattingContext.cpp:
2450         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const):
2451         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
2452         * layout/inlineformatting/InlineFormattingContext.h:
2453         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
2454         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
2455
2456 2019-02-08  Benjamin Poulain  <benjamin@webkit.org>
2457
2458         clampTo(): do not convert the input to double when dealing with integers
2459         https://bugs.webkit.org/show_bug.cgi?id=194263
2460         <rdar://problem/47692312>
2461
2462         Reviewed by Darin Adler.
2463
2464         Make the calls to clampTo<float>() unambiguous.
2465
2466         * page/FrameView.cpp:
2467         (WebCore::FrameView::computeUpdatedLayoutViewportRect):
2468         * rendering/style/RenderStyle.h:
2469         (WebCore::RenderStyle::setOpacity):
2470         (WebCore::RenderStyle::setShapeImageThreshold):
2471
2472 2019-02-08  Eric Liang  <ericliang@apple.com>
2473
2474         When performing AXPress, check to see if the menu list is disabled.
2475         https://bugs.webkit.org/show_bug.cgi?id=193878
2476
2477         Reviewed by Chris Fleizach.
2478
2479         Test: accessibility/mac/press-not-work-for-disabled-menu-list.html
2480
2481         * accessibility/AXObjectCache.h:
2482         * accessibility/AccessibilityMenuList.cpp:
2483         (WebCore::AccessibilityMenuList::press):
2484         * accessibility/mac/AXObjectCacheMac.mm:
2485         (WebCore::AXObjectCache::postPlatformNotification):
2486
2487 2019-02-07  Devin Rousso  <drousso@apple.com>
2488
2489         PseudoElement created for any ::before/::after selector regardless of whether a content property exists
2490         https://bugs.webkit.org/show_bug.cgi?id=194423
2491         <rdar://problem/46787260>
2492
2493         Reviewed by Antti Koivisto.
2494
2495         Test: inspector/css/pseudo-creation.html
2496
2497         * style/StyleTreeResolver.cpp:
2498         (WebCore::Style::TreeResolver::resolvePseudoStyle):
2499         We should only be creating `PseudoElement`s if we actually have a `content` proprety in the
2500         `PseudoElement`'s style. Otherwise, we end up creating `PseudoElement`s for every CSS rule
2501         that has a `::before`/`::after`, only to immediately destroy them as there is nothing to show.
2502
2503 2019-02-07  Chris Dumez  <cdumez@apple.com>
2504
2505         Mark more heap-allocated classes as fast allocated
2506         https://bugs.webkit.org/show_bug.cgi?id=194422
2507
2508         Reviewed by Ryosuke Niwa.
2509
2510         * Modules/applepay/PaymentCoordinator.h:
2511         * Modules/beacon/NavigatorBeacon.h:
2512         * Modules/cache/DOMWindowCaches.h:
2513         * Modules/cache/WorkerGlobalScopeCaches.h:
2514         * Modules/credentialmanagement/NavigatorCredentials.h:
2515         * Modules/encryptedmedia/legacy/LegacyCDMPrivateClearKey.h:
2516         * Modules/gamepad/NavigatorGamepad.h:
2517         * Modules/indexeddb/IDBGetAllResult.h:
2518         * Modules/indexeddb/IDBGetResult.h:
2519         * Modules/indexeddb/IDBKeyData.h:
2520         * Modules/indexeddb/IDBValue.h:
2521         * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h:
2522         * Modules/indexeddb/server/IndexValueEntry.h:
2523         * Modules/indexeddb/server/IndexValueStore.h:
2524         * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
2525         * Modules/indexeddb/server/MemoryCursor.h:
2526         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
2527         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
2528         * Modules/indexeddb/server/SQLiteIDBCursor.h:
2529         * Modules/indexeddb/server/SQLiteIDBTransaction.h:
2530         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2531         * Modules/indexeddb/shared/IDBDatabaseInfo.h:
2532         * Modules/indexeddb/shared/IDBResourceIdentifier.h:
2533         * Modules/indexeddb/shared/IDBTransactionInfo.h:
2534         * Modules/mediacapabilities/NavigatorMediaCapabilities.h:
2535         * Modules/mediasession/WebMediaSessionManager.cpp:
2536         * Modules/mediastream/NavigatorMediaDevices.h:
2537         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
2538         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h:
2539         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
2540         * Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h:
2541         * Modules/navigatorcontentutils/NavigatorContentUtils.h:
2542         * Modules/quota/DOMWindowQuota.h:
2543         * Modules/quota/NavigatorStorageQuota.h:
2544         * Modules/quota/WorkerNavigatorStorageQuota.h:
2545         * Modules/speech/DOMWindowSpeechSynthesis.h:
2546         * Modules/webaudio/BiquadProcessor.h:
2547         * Modules/webaudio/DelayProcessor.h:
2548         * Modules/webauthn/fido/FidoHidPacket.h:
2549         * Modules/webdriver/NavigatorWebDriver.h:
2550         * Modules/webgpu/DOMWindowWebGPU.h:
2551         * Modules/websockets/WebSocketChannel.h:
2552         * Modules/webvr/NavigatorWebVR.h:
2553         * accessibility/AXObjectCache.h:
2554         * bindings/js/DOMGCOutputConstraint.h:
2555         * bindings/js/DOMPromiseProxy.h:
2556         * bridge/c/c_runtime.h:
2557         * contentextensions/CombinedURLFilters.cpp:
2558         * crypto/CryptoAlgorithmParameters.h:
2559         * css/CSSComputedStyleDeclaration.h:
2560         * css/CSSRegisteredCustomProperty.h:
2561         * css/DOMCSSPaintWorklet.h:
2562         * css/DOMCSSRegisterCustomProperty.h:
2563         * css/StyleRule.h:
2564         * dom/ConstantPropertyMap.h:
2565         * dom/CustomElementReactionQueue.h:
2566         * dom/Document.h:
2567         * dom/GenericEventQueue.h:
2568         * dom/RejectedPromiseTracker.h:
2569         * dom/UserGestureIndicator.h:
2570         * editing/ReplaceSelectionCommand.cpp:
2571         * editing/SelectionRectGatherer.h:
2572         * editing/TextIterator.h:
2573         * editing/cocoa/HTMLConverter.mm:
2574         * fileapi/AsyncFileStream.cpp:
2575         * fileapi/AsyncFileStream.h:
2576         * html/forms/FileIconLoader.h:
2577         * html/parser/HTMLTreeBuilder.h:
2578         * html/track/WebVTTParser.h:
2579         * inspector/DOMPatchSupport.cpp:
2580         * loader/FrameLoaderClient.h:
2581         * loader/WorkerThreadableLoader.cpp:
2582         * page/IntersectionObserver.h:
2583         * page/PerformanceMonitor.h:
2584         * page/PerformanceUserTiming.h:
2585         * page/PrintContext.h:
2586         * page/ValidationMessageClient.h:
2587         * platform/ColorChooser.h:
2588         * platform/ControlStates.h:
2589         * platform/DataListSuggestionPicker.h:
2590         * platform/FileStream.h:
2591         * platform/KeyedCoding.h:
2592         * platform/LowPowerModeNotifier.h:
2593         * platform/PlatformSpeechSynthesizer.h:
2594         * platform/WebGLStateTracker.h:
2595         * platform/audio/AudioArray.h:
2596         * platform/audio/AudioDestination.h:
2597         * platform/audio/DownSampler.h:
2598         * platform/audio/DynamicsCompressor.h:
2599         * platform/audio/FFTFrame.h:
2600         * platform/audio/HRTFDatabase.h:
2601         * platform/audio/MultiChannelResampler.h:
2602         * platform/audio/Panner.h:
2603         * platform/audio/Reverb.h:
2604         * platform/audio/ReverbConvolver.h:
2605         * platform/audio/ReverbConvolverStage.h:
2606         * platform/audio/UpSampler.h:
2607         * platform/audio/mac/AudioSessionMac.cpp:
2608         * platform/audio/mac/CAAudioStreamDescription.h:
2609         * platform/audio/mac/CARingBuffer.h:
2610         * platform/cocoa/ScrollSnapAnimatorState.h:
2611         * platform/gamepad/PlatformGamepad.h:
2612         * platform/graphics/GraphicsLayer.cpp:
2613         * platform/graphics/GraphicsLayerFactory.h:
2614         * platform/graphics/PlatformTimeRanges.h:
2615         * platform/graphics/TextTrackRepresentation.h:
2616         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h:
2617         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
2618         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
2619         * platform/graphics/displaylists/DisplayListRecorder.h:
2620         * platform/network/cocoa/WebCoreNSURLSession.mm:
2621         * platform/sql/SQLiteDatabase.h:
2622         * platform/text/TextCodecICU.h:
2623         * rendering/GridBaselineAlignment.h:
2624         * rendering/GridTrackSizingAlgorithm.h:
2625         * rendering/RenderObject.h:
2626         * rendering/style/GridArea.h:
2627         * workers/service/context/SWContextManager.h:
2628
2629 2019-02-07  Justin Fan  <justin_fan@apple.com>
2630
2631         [Web GPU] GPUDevice::createTexture implementation prototype
2632         https://bugs.webkit.org/show_bug.cgi?id=194409
2633         <rdar://problem/47894312>
2634
2635         Reviewed by Myles C. Maxfield.
2636
2637         Test: textures-textureviews.html updated to test new functionality.
2638
2639         Implement GPUDevice::createTexture():
2640         * Modules/webgpu/WebGPUDevice.cpp:
2641         (WebCore::WebGPUDevice::createTexture const):
2642         * Modules/webgpu/WebGPUDevice.h:
2643         * Modules/webgpu/WebGPUDevice.idl:
2644         * Modules/webgpu/WebGPUTexture.cpp:
2645         (WebCore::WebGPUTexture::create): Modified to return non-nullable to match direction of API.
2646         (WebCore::WebGPUTexture::WebGPUTexture):
2647         * Modules/webgpu/WebGPUTexture.h:
2648
2649         Metal backend MTLTextureDescriptor and MTLTexture creation:
2650         * platform/graphics/gpu/GPUDevice.cpp:
2651         (WebCore::GPUDevice::tryCreateTexture const):
2652         * platform/graphics/gpu/GPUDevice.h:
2653         * platform/graphics/gpu/GPUTexture.h:
2654         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
2655         (WebCore::mtlTextureTypeForGPUTextureDescriptor):
2656         (WebCore::mtlTextureUsageForGPUTextureUsageFlags):
2657         (WebCore::storageModeForPixelFormatAndSampleCount):
2658         (WebCore::tryCreateMtlTextureDescriptor):
2659         (WebCore::GPUTexture::tryCreate):
2660         (WebCore::GPUTexture::createDefaultTextureView): Add ObjC try/catch guards.
2661
2662         Add GPUUtils.h/cpp for shared utility functions:
2663         * SourcesCocoa.txt:
2664         * WebCore.xcodeproj/project.pbxproj:
2665         * platform/graphics/gpu/GPUUtils.h: Added. Moved platformTextureFormatForGPUTextureFormat here.
2666         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
2667         (WebCore::GPUSwapChain::setFormat):
2668         (WebCore::platformTextureFormatForGPUTextureFormat): Moved to GPUUtils.
2669         * platform/graphics/gpu/cocoa/GPUUtilsMetal.mm: Added.
2670         (WebCore::platformTextureFormatForGPUTextureFormat): Moved here to be referenced by multiple files.
2671
2672 2019-02-07  Sihui Liu  <sihui_liu@apple.com>
2673
2674         REGRESSION(r239887): Crash under IDBConnectionToClient::didDeleteDatabase(WebCore::IDBResultData const&)
2675         https://bugs.webkit.org/show_bug.cgi?id=194402
2676         <rdar://problem/47858241>
2677
2678         Reviewed by Geoffrey Garen.
2679
2680         r239887 removed a reference cycle of IDBConnectionToClient so that IDBConnectionToClient would no longer be
2681         around forever. Therefore, ServerOpenRequest should keep a reference to IDBConnectionToClient to make sure it
2682         is valid during access.
2683
2684         * Modules/indexeddb/server/ServerOpenDBRequest.cpp:
2685         (WebCore::IDBServer::ServerOpenDBRequest::maybeNotifyRequestBlocked):
2686         (WebCore::IDBServer::ServerOpenDBRequest::notifyDidDeleteDatabase):
2687         * Modules/indexeddb/server/ServerOpenDBRequest.h:
2688
2689 2019-02-07  Timothy Hatcher  <timothy@apple.com>
2690
2691         Overflow element scrollbar is light for dark mode content.
2692         https://bugs.webkit.org/show_bug.cgi?id=194407
2693         rdar://problem/45991585
2694
2695         Reviewed by Beth Dakin.
2696
2697         Tested by css-dark-mode/supported-color-schemes-scrollbar.html.
2698
2699         * page/ChromeClient.h:
2700         (WebCore::FrameView::preferredScrollbarOverlayStyle): Return WTF::nullopt by default to avoid
2701         short-circuiting auto detection in recalculateScrollbarOverlayStyle() for clients, like WK1,
2702         that do not implement preferredScrollbarOverlayStyle().
2703         * page/FrameView.cpp:
2704         (WebCore::FrameView::recalculateScrollbarOverlayStyle): Use WTF::nullopt in the false case
2705         to auto detect overlay style when page() is null.
2706         * rendering/RenderLayer.cpp:
2707         (WebCore::RenderLayer::useDarkAppearance const): Added.
2708         * rendering/RenderLayer.h:
2709         * testing/Internals.cpp:
2710         (WebCore::Internals::scrollbarOverlayStyle const): Added Node argument.
2711         (WebCore::Internals::scrollbarUsingDarkAppearance const): Added.
2712         * testing/Internals.h:
2713         * testing/Internals.idl:
2714
2715 2019-02-07  Eric Carlson  <eric.carlson@apple.com>
2716
2717         [MSE] Convert debug-only logging to runtime logging
2718         https://bugs.webkit.org/show_bug.cgi?id=194348
2719         <rdar://problem/47566449>
2720
2721         Reviewed by Jer Noble.
2722
2723         No new tests, this just changes existing logging.
2724
2725         * Modules/mediasource/MediaSource.cpp:
2726         (WebCore::convertEnumerationToString):
2727         (WebCore::MediaSource::MediaSource):
2728         (WebCore::MediaSource::~MediaSource):
2729         (WebCore::MediaSource::setPrivateAndOpen):
2730         (WebCore::MediaSource::addedToRegistry):
2731         (WebCore::MediaSource::removedFromRegistry):
2732         (WebCore::MediaSource::durationChanged):
2733         (WebCore::MediaSource::seekToTime):
2734         (WebCore::MediaSource::completeSeek):
2735         (WebCore::MediaSource::setLiveSeekableRange):
2736         (WebCore::MediaSource::clearLiveSeekableRange):
2737         (WebCore::MediaSource::setDuration):
2738         (WebCore::MediaSource::setDurationInternal):
2739         (WebCore::MediaSource::setReadyState):
2740         (WebCore::MediaSource::endOfStream):
2741         (WebCore::MediaSource::streamEndedWithError):
2742         (WebCore::MediaSource::addSourceBuffer):
2743         (WebCore::MediaSource::removeSourceBuffer):
2744         (WebCore::MediaSource::isTypeSupported):
2745         (WebCore::MediaSource::detachFromElement):
2746         (WebCore::MediaSource::attachToElement):
2747         (WebCore::MediaSource::openIfInEndedState):
2748         (WebCore::MediaSource::suspend):
2749         (WebCore::MediaSource::resume):
2750         (WebCore::MediaSource::stop):
2751         (WebCore::MediaSource::onReadyStateChange):
2752         (WebCore::MediaSource::scheduleEvent):
2753         (WebCore::MediaSource::logChannel const):
2754         (WebCore::MediaSourceInternal::toString): Deleted.
2755         * Modules/mediasource/MediaSource.h:
2756         (WTF::LogArgument<WebCore::MediaSource::EndOfStreamError>::toString):
2757         (WTF::LogArgument<WebCore::MediaSource::ReadyState>::toString):
2758         * Modules/mediasource/SourceBuffer.cpp:
2759         (WebCore::SourceBuffer::SourceBuffer):
2760         (WebCore::SourceBuffer::~SourceBuffer):
2761         (WebCore::SourceBuffer::remove):
2762         (WebCore::SourceBuffer::seekToTime):
2763         (WebCore::SourceBuffer::appendBufferInternal):
2764         (WebCore::SourceBuffer::sourceBufferPrivateAppendComplete):
2765         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError):
2766         (WebCore::removeSamplesFromTrackBuffer):
2767         (WebCore::SourceBuffer::removeCodedFrames):
2768         (WebCore::SourceBuffer::evictCodedFrames):
2769         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment):
2770         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
2771         (WebCore::SourceBuffer::sourceBufferPrivateReenqueSamples):
2772         (WebCore::SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples):
2773         (WebCore::SourceBuffer::provideMediaData):
2774         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
2775         (WebCore::SourceBuffer::monitorBufferingRate):
2776         (WebCore::SourceBuffer::logChannel const):
2777         * Modules/mediasource/SourceBuffer.h:
2778         * dom/Document.cpp:
2779         (WebCore::messageSourceForWTFLogChannel):
2780         (WebCore::Document::didLogMessage):
2781         * html/HTMLMediaElement.cpp:
2782         (WebCore::convertEnumerationToString):
2783         (WebCore::HTMLMediaElement::scheduleCheckPlaybackTargetCompatability):
2784         (WebCore::HTMLMediaElement::selectMediaResource):
2785         (WebCore::HTMLMediaElement::loadResource):
2786         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
2787         (WebCore::HTMLMediaElement::scheduleConfigureTextTracks):
2788         (WebCore::HTMLMediaElement::scheduleMediaEngineWasUpdated):
2789         (WebCore::HTMLMediaElement::scheduleUpdatePlayState):
2790         (WebCore::HTMLMediaElement::scheduleUpdateMediaState):
2791         * platform/ContentType.cpp:
2792         (WebCore::ContentType::toJSONString const):
2793         * platform/ContentType.h:
2794         (WTF::LogArgument<WebCore::ContentType>::toString):
2795         * platform/MediaSample.h:
2796         (WebCore::MediaSample::toJSONString const):
2797         (WTF::LogArgument<WebCore::MediaSample>::toString):
2798         * platform/graphics/FloatSize.cpp:
2799         (WebCore::FloatSize::toJSONObject const):
2800         (WebCore::FloatSize::toJSONString const):
2801         * platform/graphics/FloatSize.h:
2802         (WTF::LogArgument<WebCore::FloatSize>::toString):
2803         * platform/graphics/MediaSourcePrivate.h:
2804         (WebCore::MediaSourcePrivate::mediaSourceLogIdentifier):
2805         (WTF::LogArgument<WebCore::MediaSourcePrivate::AddStatus>::toString):
2806         (WTF::LogArgument<WebCore::MediaSourcePrivate::EndOfStreamStatus>::toString):
2807         * platform/graphics/SourceBufferPrivate.h:
2808         (WebCore::SourceBufferPrivate::sourceBufferLogger const):
2809         (WebCore::SourceBufferPrivate::sourceBufferLogIdentifier):
2810         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2811         (WebCore::MediaPlayerPrivateAVFoundationObjC::setMuted):
2812         (WebCore::MediaPlayerPrivateAVFoundationObjC::setClosedCaptionsVisible):
2813         (WebCore::MediaPlayerPrivateAVFoundationObjC::isCurrentPlaybackTargetWireless const):
2814         (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessVideoPlaybackDisabled const):
2815         (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessVideoPlaybackDisabled):
2816         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget):
2817         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldBufferData):
2818         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2819         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogIdentifier):
2820         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogger):
2821         (WTF::LogArgument<WebCore::MediaPlayerPrivateMediaSourceAVFObjC::SeekState>::toString):
2822         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2823         (WebCore::convertEnumerationToString):
2824         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
2825         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::~MediaPlayerPrivateMediaSourceAVFObjC):
2826         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load):
2827         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::play):
2828         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal):
2829         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pause):
2830         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pauseInternal):
2831         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVolume):
2832         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setMuted):
2833         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVisible):
2834         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance):
2835         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
2836         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted):
2837         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekCompleted):
2838         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPreservesPitch):
2839         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame):
2840         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateAllRenderersHaveAvailableSamples):
2841         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
2842         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setNaturalSize):
2843         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession):
2844         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
2845         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
2846         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceDetached):
2847         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::attemptToDecryptWithInstance):
2848         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitingForKeyChanged):
2849         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::initializationDataEncountered):
2850         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setReadyState):
2851         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setNetworkState):
2852         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setShouldPlayToPlaybackTarget):
2853         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isCurrentPlaybackTargetWireless const):
2854         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::logChannel const):
2855         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2856         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
2857         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h:
2858         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
2859         (WebCore::MediaSampleAVFObjC::toJSONString const):
2860         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
2861         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
2862         (WebCore::MediaSourcePrivateAVFObjC::MediaSourcePrivateAVFObjC):
2863         (WebCore::MediaSourcePrivateAVFObjC::~MediaSourcePrivateAVFObjC):
2864         (WebCore::MediaSourcePrivateAVFObjC::addSourceBuffer):
2865         (WebCore::MediaSourcePrivateAVFObjC::logChannel const):
2866         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2867         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2868         (WebCore::bufferWasConsumedCallback):
2869         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
2870         (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
2871         (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):
2872         (WebCore::SourceBufferPrivateAVFObjC::didFailToParseStreamDataWithError):
2873         (WebCore::SourceBufferPrivateAVFObjC::processCodedFrame):
2874         (WebCore::SourceBufferPrivateAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID):
2875         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
2876         (WebCore::SourceBufferPrivateAVFObjC::append):
2877         (WebCore::SourceBufferPrivateAVFObjC::abort):
2878         (WebCore::SourceBufferPrivateAVFObjC::resetParserState):
2879         (WebCore::SourceBufferPrivateAVFObjC::removedFromMediaSource):
2880         (WebCore::SourceBufferPrivateAVFObjC::setReadyState):
2881         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
2882         (WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
2883         (WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
2884         (WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError):
2885         (WebCore::SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
2886         (WebCore::SourceBufferPrivateAVFObjC::flush):
2887         (WebCore::SourceBufferPrivateAVFObjC::flushVideo):
2888         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
2889         (WebCore::SourceBufferPrivateAVFObjC::bufferWasConsumed):
2890         (WebCore::SourceBufferPrivateAVFObjC::setActive):
2891         (WebCore::SourceBufferPrivateAVFObjC::willSeek):
2892         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples):
2893         (WebCore::SourceBufferPrivateAVFObjC::canSwitchToType):
2894         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession):
2895         (WebCore::SourceBufferPrivateAVFObjC::logChannel const):
2896
2897 2019-02-07  Youenn Fablet  <youenn@apple.com>
2898
2899         Simplify applyConstraints callbacks
2900         https://bugs.webkit.org/show_bug.cgi?id=194297
2901
2902         Reviewed by Eric Carlson.
2903
2904         Make use of one callback for both success and failure cases.
2905         No changed of behavior.
2906
2907         * Modules/mediastream/MediaStreamTrack.cpp:
2908         (WebCore::MediaStreamTrack::applyConstraints):
2909         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2910         (WebCore::MediaStreamTrackPrivate::applyConstraints):
2911         * platform/mediastream/MediaStreamTrackPrivate.h:
2912         * platform/mediastream/RealtimeMediaSource.cpp:
2913         (WebCore::RealtimeMediaSource::applyConstraints):
2914         * platform/mediastream/RealtimeMediaSource.h:
2915         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2916         (WebCore::AVVideoCaptureSource::create):
2917         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2918         (WebCore::CoreAudioCaptureSource::create):
2919         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
2920         (WebCore::MockGStreamerAudioCaptureSource::applyConstraints):
2921         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h:
2922         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp:
2923         (WebCore::MockGStreamerVideoCaptureSource::applyConstraints):
2924         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h:
2925
2926 2019-02-07  Youenn Fablet  <youenn@apple.com>
2927
2928         Unable to sign in leetcode.
2929         https://bugs.webkit.org/show_bug.cgi?id=194366
2930         rdar://problem/47259025.
2931
2932         Reviewed by Chris Dumez.
2933
2934         In case a signal is passed as part of a FetchRequestInit,
2935         the IDL binding code is throwing an exception in case signal is not an AbortSignal object.
2936         This breaks an AbortSignal shim used in some web sites.
2937         Relaxed the IDL binding rule by marking signal as any and doing the conversion in FetchRequest.
2938
2939         Test: http/wpt/fetch/request-abort.html
2940         Also covered by manually signing in to leetcode.
2941
2942         * Modules/fetch/FetchRequest.cpp:
2943         (WebCore::FetchRequest::initializeWith):
2944         * Modules/fetch/FetchRequestInit.h:
2945         (WebCore::FetchRequestInit::hasMembers const):
2946         * Modules/fetch/FetchRequestInit.idl:
2947
2948 2019-02-07  Youenn Fablet  <youenn@apple.com>
2949
2950         Make to clear sources from UserMediaCaptureManagerProxy and UserMediaCaptureManager when no longer needed
2951         https://bugs.webkit.org/show_bug.cgi?id=194312
2952
2953         Reviewed by Eric Carlson.
2954
2955         Add a way for sources to know when they are ended, i.e. that they will never be started again.
2956         No observable change of behavior.
2957
2958         * platform/mediastream/RealtimeMediaSource.cpp:
2959         (WebCore::RealtimeMediaSource::requestStop):
2960         * platform/mediastream/RealtimeMediaSource.h:
2961
2962 2019-02-07  Jer Noble  <jer.noble@apple.com>
2963
2964         HTMLMediaElement registers wrong ScriptExecutionContext with its ActiveDOMObject parent class
2965         https://bugs.webkit.org/show_bug.cgi?id=194360
2966
2967         HTMLMediaElement registers the Document used to create it with ActiveDOMObject, when it should
2968         really use that Document's contextDocument(). Rather than just fix this in HTMLMediaElement,
2969         make sure that the correct document is used everywhere by adding a new ActiveDOMObject constructor
2970         taking a Document&, and making an explicitly deleted Document* constructor to catch any new cases.
2971
2972         Reviewed by Geoffrey Garen.
2973
2974         * Modules/applepay/ApplePaySession.cpp:
2975         (WebCore::ApplePaySession::ApplePaySession):
2976         * Modules/mediarecorder/MediaRecorder.cpp:
2977         (WebCore::MediaRecorder::MediaRecorder):
2978         * Modules/mediastream/MediaDevices.cpp:
2979         (WebCore::MediaDevices::MediaDevices):
2980         * Modules/mediastream/UserMediaRequest.cpp:
2981         (WebCore::UserMediaRequest::UserMediaRequest):
2982         * Modules/notifications/Notification.cpp:
2983         (WebCore::Notification::Notification):
2984         * Modules/paymentrequest/PaymentRequest.cpp:
2985         (WebCore::PaymentRequest::PaymentRequest):
2986         * Modules/webaudio/AudioContext.cpp:
2987         (WebCore::AudioContext::AudioContext):
2988         * animation/WebAnimation.cpp:
2989         (WebCore::WebAnimation::WebAnimation):
2990         * css/FontFaceSet.cpp:
2991         (WebCore::FontFaceSet::FontFaceSet):
2992         * dom/ActiveDOMObject.cpp:
2993         (WebCore::ActiveDOMObject::ActiveDOMObject):
2994         * dom/ActiveDOMObject.h:
2995         * dom/Document.h:
2996         (WebCore::ActiveDOMObject::ActiveDOMObject):
2997         * html/HTMLMarqueeElement.cpp:
2998         (WebCore::HTMLMarqueeElement::HTMLMarqueeElement):
2999         * html/HTMLMediaElement.cpp:
3000         (WebCore::HTMLMediaElement::HTMLMediaElement):
3001         * html/HTMLSourceElement.cpp:
3002         (WebCore::HTMLSourceElement::HTMLSourceElement):
3003         * page/IntersectionObserver.cpp:
3004         (WebCore::IntersectionObserver::IntersectionObserver):
3005
3006 2019-02-07  Zalan Bujtas  <zalan@apple.com>
3007
3008         [LFC][Out-of-flow] Use the containing block's padding width when computing min/max width.
3009         https://bugs.webkit.org/show_bug.cgi?id=194391
3010
3011         Reviewed by Antti Koivisto.
3012
3013         The spec is not clear about this but that's what matches the current behaviour.
3014
3015         Test: fast/block/block-only/absolute-positioned-min-max-percentage-with-parent-padding.html
3016
3017         * layout/FormattingContext.cpp:
3018         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
3019
3020 2019-02-07  Zalan Bujtas  <zalan@apple.com>
3021
3022         [LFC] Use dedicated data structures for optional used values (input to geometry functions)
3023         https://bugs.webkit.org/show_bug.cgi?id=194376
3024
3025         Reviewed by Antti Koivisto.
3026
3027         This is in preparation for being able to pass in the containing block's width as an optional used value.
3028         During layout we always have a valid width for the containing block, however it's not the case while computing the preferred width.
3029
3030         * layout/FormattingContext.cpp:
3031         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
3032         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
3033         * layout/FormattingContext.h:
3034         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry): Deleted.
3035         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry): Deleted.
3036         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin): Deleted.
3037         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin): Deleted.
3038         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin): Deleted.
3039         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): Deleted.
3040         (): Deleted.
3041         (WebCore::Layout::FormattingContext::Geometry::complicatedCases): Deleted.
3042         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): Deleted.
3043         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): Deleted.
3044         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): Deleted.
3045         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): Deleted.
3046         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin): Deleted.
3047         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): Deleted.
3048         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): Deleted.
3049         * layout/FormattingContextGeometry.cpp:
3050         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
3051         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
3052         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
3053         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
3054         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
3055         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
3056         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
3057         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
3058         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
3059         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
3060         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
3061         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
3062         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
3063         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
3064         * layout/LayoutUnits.h:
3065         * layout/blockformatting/BlockFormattingContext.cpp:
3066         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
3067         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
3068         * layout/blockformatting/BlockFormattingContext.h:
3069         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin): Deleted.
3070         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin): Deleted.
3071         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): Deleted.
3072         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): Deleted.
3073         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): Deleted.
3074         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3075         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
3076         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
3077         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
3078         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
3079         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
3080         * layout/inlineformatting/InlineFormattingContext.cpp:
3081         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
3082         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
3083         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
3084         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
3085         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin):
3086         * page/FrameViewLayoutContext.cpp:
3087         (WebCore::layoutUsingFormattingContext):
3088
3089 2019-02-07  Antti Koivisto  <antti@apple.com>
3090
3091         Infinite recursion via CachedResource::~CachedResource
3092         https://bugs.webkit.org/show_bug.cgi?id=194378
3093         <rdar://problem/42023295>
3094
3095         Reviewed by Daniel Bates.
3096
3097         I don't know the exact steps to trigger this but the mechanism seems clear.
3098
3099         1) An existing resource is removed from or replaced in CachedResourceLoader::m_documentResources map.
3100         2) This decrements the handle count of resource and causes it be deleted.
3101         3) CachedResource::~CachedResource calls m_owningCachedResourceLoader->removeCachedResource(*this). This only happens with
3102            resources that are "owned" by CachedResourceLoader which is a rare special case (used by image document and if memory cache is disabled).
3103         4) CachedResourceLoader::removeCachedResource looks up the resource from the map which causes a temporary CachedResourceHandle to be created.
3104            This increments the handle count of the resource from 0 back to 1.
3105         5) When the temporary dies, CachedResource::~CachedResource is called again and we cycle back to 3).
3106
3107         The fix here is simply to remove CachedResourceLoader::removeCachedResource call from ~CachedResource.
3108         It is a leftover from when the map contained raw pointers instead of owning CachedResourceHandles.
3109
3110         Since m_documentResources map has a handle to the resource, the only way we are in the destructor is that the resource
3111         has been removed from the map already (or is in process of being removed like in this crash). Any call that does anything
3112         other than bail out is going to crash.
3113
3114         CachedResource::n_owningCachedResourceLoader member and CachedResourceLoader::removeCachedResource function only exist to
3115         support this erranous call so they are removed as well.
3116
3117         * loader/ImageLoader.cpp:
3118         (WebCore::ImageLoader::updateFromElement):
3119         * loader/cache/CachedResource.cpp:
3120         (WebCore::CachedResource::~CachedResource):
3121
3122         This is the substantive change. The rest just removes now-dead code.
3123
3124         * loader/cache/CachedResource.h:
3125         (WebCore::CachedResource::setOwningCachedResourceLoader): Deleted.
3126         * loader/cache/CachedResourceLoader.cpp:
3127         (WebCore::CachedResourceLoader::~CachedResourceLoader):
3128         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
3129         (WebCore::CachedResourceLoader::requestResource):
3130         (WebCore::CachedResourceLoader::loadResource):
3131         (WebCore::CachedResourceLoader::garbageCollectDocumentResources):
3132         (WebCore::CachedResourceLoader::removeCachedResource): Deleted.
3133         * loader/cache/CachedResourceLoader.h:
3134
3135 2019-02-07  Miguel Gomez  <magomez@igalia.com>
3136
3137         [WPE] Implement GStreamer based holepunch
3138         https://bugs.webkit.org/show_bug.cgi?id=193715
3139
3140         Reviewed by Xabier Rodriguez-Calvar.
3141
3142         Implement GStreamer based holepunch functionality. Instead of getting the video frames from the
3143         video sink and drawing then, the player just draws a transparent rectangle on the position where
3144         the video should be. MediaPlayerPrivateGStreamerBase will instantiate a platform dependant video
3145         sink which will be in charge of displaying the video frames in some way (usually on a plane below
3146         the browser), and will push empty frames to the compositor indicating that the rectangle to draw
3147         should overwrite the existent content. TextureMapperPlatformLayerBuffer::HolePunchClient is used
3148         to tell the video sink where to position the video so it's set below the browser transparent hole.
3149
3150         Added ManualTest wpe/video-player-holepunch.html to test the feature.
3151
3152         * platform/graphics/MediaPlayer.cpp:
3153         (WebCore::MediaPlayer::shouldIgnoreIntrinsicSize):
3154         * platform/graphics/MediaPlayer.h:
3155         * platform/graphics/MediaPlayerPrivate.h:
3156         (WebCore::MediaPlayerPrivateInterface::shouldIgnoreIntrinsicSize):
3157         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3158         (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const):
3159         (WebCore::MediaPlayerPrivateGStreamerBase::swapBuffersIfNeeded):
3160         (WebCore::setRectangleToVideoSink):
3161         (WebCore::GStreamerHolePunchClient::GStreamerHolePunchClient):
3162         (WebCore::MediaPlayerPrivateGStreamerBase::createHolePunchVideoSink):
3163         (WebCore::MediaPlayerPrivateGStreamerBase::pushNextHolePunchBuffer):
3164         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):
3165         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3166         * platform/graphics/texmap/TextureMapper.h:
3167         * platform/graphics/texmap/TextureMapperGL.cpp:
3168         (WebCore::TextureMapperGL::drawSolidColor):
3169         * platform/graphics/texmap/TextureMapperGL.h:
3170         * platform/graphics/texmap/TextureMapperLayer.cpp:
3171         (WebCore::TextureMapperLayer::paintSelf):
3172         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
3173         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
3174         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
3175         (WebCore::TextureMapperPlatformLayerBuffer::setHolePunchClient):
3176         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3177         (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer):
3178         * rendering/RenderVideo.cpp:
3179         (WebCore::RenderVideo::videoBox const):
3180
3181 2019-02-06  Benjamin Poulain  <benjamin@webkit.org>
3182
3183         Unreviewed, rolling out r240759 and r240944.
3184
3185         Some timer uses are done off the main thread, WebCore::Timer
3186         cannot be used
3187
3188         Reverted changesets:
3189
3190         "<rdar://problem/47570443> Responsiveness timers are too
3191         expensive for frequent events"
3192         https://bugs.webkit.org/show_bug.cgi?id=194003
3193         https://trac.webkit.org/changeset/240759
3194
3195         "Use deferrable timer to restart the Responsiveness Timer on
3196         each wheel event"
3197         https://bugs.webkit.org/show_bug.cgi?id=194135
3198         https://trac.webkit.org/changeset/240944
3199
3200 2019-02-06  Keith Rollin  <krollin@apple.com>
3201
3202         Update .xcfilelist files
3203
3204         Unreviewed build fix.
3205
3206         * DerivedSources-input.xcfilelist:
3207         * DerivedSources-output.xcfilelist:
3208
3209 2019-02-06  Devin Rousso  <drousso@apple.com>
3210
3211         Web Inspector: DOM: don't send the entire function string with each event listener
3212         https://bugs.webkit.org/show_bug.cgi?id=194293
3213         <rdar://problem/47822809>
3214
3215         Reviewed by Joseph Pecoraro.
3216
3217         Test: inspector/dom/getEventListenersForNode.html
3218
3219         * inspector/agents/InspectorDOMAgent.cpp:
3220         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
3221
3222 2019-02-06  Andy Estes  <aestes@apple.com>
3223
3224         [Payment Request] It should be possible to require a phonetic name for shipping contacts
3225         https://bugs.webkit.org/show_bug.cgi?id=194311
3226         <rdar://46733045>
3227
3228         Reviewed by Alex Christensen.
3229
3230         It should be possible to require that a shipping contact has a phonetic name in Payment Request.
3231         To accomplish this, move requiredShippingContactFields from ApplePayPaymentRequest to
3232         ApplePayRequestBase so that it can be used as part of an Apple Pay payment method data.
3233
3234         Since required shipping contact fields can now be specified both in
3235         requiredShippingContactFields and PaymentOptions, we merge the required fields from these
3236         two sources such that, e.g., email is required if it is specified in either place.
3237
3238         So that clients can detect this new feature, the API version number is bumped from 5 to 6.
3239
3240         Added test cases to ApplePayRequestShippingContact.https.html and ApplePayRequestShippingContactV3.https.html.
3241
3242         * DerivedSources.make:
3243         * Modules/applepay/ApplePayPaymentRequest.h:
3244         * Modules/applepay/ApplePayPaymentRequest.idl:
3245         * Modules/applepay/ApplePayRequestBase.cpp:
3246         (WebCore::convertAndValidate):
3247         * Modules/applepay/ApplePayRequestBase.h:
3248         * Modules/applepay/ApplePayRequestBase.idl:
3249         * Modules/applepay/ApplePaySession.cpp:
3250         (WebCore::convertAndValidate):
3251         * Modules/applepay/PaymentCoordinatorClient.cpp: Added.
3252         (WebCore::PaymentCoordinatorClient::supportsVersion):
3253         * Modules/applepay/PaymentCoordinatorClient.h:
3254         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
3255         (WebCore::mergePaymentOptions):
3256         (WebCore::ApplePayPaymentHandler::show):
3257         * SourcesCocoa.txt:
3258         * WebCore.xcodeproj/project.pbxproj:
3259         * loader/EmptyClients.cpp:
3260         * testing/MockPaymentContactFields.h: Added.
3261         (WebCore::MockPaymentContactFields::MockPaymentContactFields):
3262         * testing/MockPaymentContactFields.idl: Added.
3263         * testing/MockPaymentCoordinator.cpp:
3264         (WebCore::MockPaymentCoordinator::showPaymentUI):
3265         (WebCore::MockPaymentCoordinator::supportsVersion): Deleted.
3266         * testing/MockPaymentCoordinator.h:
3267         * testing/MockPaymentCoordinator.idl:
3268
3269 2019-02-06  Yusuke Suzuki  <ysuzuki@apple.com>
3270
3271         [JSC] PrivateName to PublicName hash table is wasteful
3272         https://bugs.webkit.org/show_bug.cgi?id=194277
3273
3274         Reviewed by Michael Saboff.
3275
3276         Use WebCoreBuiltinNames instead of adding WebCore names to JSC CommonIdentifiers.
3277
3278         * bindings/js/JSDOMWindowCustom.cpp:
3279         (WebCore::addCrossOriginPropertyNames):
3280         * bindings/js/JSLocationCustom.cpp:
3281         (WebCore::getOwnPropertySlotCommon):
3282         (WebCore::putCommon):
3283         * bindings/js/WebCoreBuiltinNames.h:
3284
3285 2019-02-06  Keith Rollin  <krollin@apple.com>
3286
3287         Really enable the automatic checking and regenerations of .xcfilelists during builds
3288         https://bugs.webkit.org/show_bug.cgi?id=194357
3289         <rdar://problem/47861231>
3290
3291         Reviewed by Chris Dumez.
3292
3293         Bug 194124 was supposed to enable the automatic checking and
3294         regenerating of .xcfilelist files during the build. While related
3295         changes were included in that patch, the change to actually enable the
3296         operation somehow was omitted. This patch actually enables the
3297         operation. The check-xcfilelist.sh scripts now check
3298         WK_DISABLE_CHECK_XCFILELISTS, and if it's "1", opts-out the developer
3299         from the checking.
3300
3301         No new tests since there should be no observable behavior difference.
3302
3303         * Scripts/check-xcfilelists.sh:
3304
3305 2019-02-06  John Wilander  <wilander@apple.com>
3306
3307         Forward Ad Click Attribution data from HTMLAnchorElement::handleClick() to WebKit::NavigationActionData
3308         https://bugs.webkit.org/show_bug.cgi?id=194325
3309         <rdar://problem/47840283>
3310
3311         Reviewed by Chris Dumez.
3312
3313         No new tests. This is just data forwarding. Once the data is stored, I will create
3314         test infrastructure to query it.
3315
3316         * html/HTMLAnchorElement.cpp:
3317         (WebCore::HTMLAnchorElement::handleClick):
3318         * loader/AdClickAttribution.h:
3319         (WebCore::AdClickAttribution::encode const):
3320         (WebCore::AdClickAttribution::decode):
3321         (WebCore::AdClickAttribution::Conversion::encode const):
3322         (WebCore::AdClickAttribution::Conversion::decode):
3323             Infrastructure for IPC.
3324         * loader/FrameLoader.cpp:
3325         (WebCore::FrameLoader::urlSelected):
3326         (WebCore::FrameLoader::loadURLIntoChildFrame):
3327         (WebCore::FrameLoader::loadFrameRequest):
3328         (WebCore::FrameLoader::loadURL):
3329             These functions forward the optional WebCore::AdClickAttribution object
3330             FrameLoader::loadURL() creates the NavigationAction object and sets the
3331             WebCore::AdClickAttribution object on there.
3332         * loader/FrameLoader.h:
3333         (WebCore::FrameLoader::urlSelected):
3334         (WebCore::FrameLoader::loadURL):
3335         * loader/NavigationAction.h:
3336         (WebCore::NavigationAction::adClickAttribution):
3337         (WebCore::NavigationAction::setAdClickAttribution):
3338
3339 2019-02-06  Justin Fan  <justin_fan@apple.com>
3340
3341         [Web GPU] Implement supporting dictionaries for GPUTexture
3342         https://bugs.webkit.org/show_bug.cgi?id=194354
3343
3344         Reviewed by Dean Jackson.
3345
3346         Add dictionaries needed to create a GPUTextureDescriptor.
3347
3348         No new tests; no change in behavior. 
3349
3350         New interface and dictionaries added:
3351         * Modules/webgpu/GPUExtent3D.idl:
3352         * Modules/webgpu/GPUTextureDescriptor.idl:
3353         * Modules/webgpu/GPUTextureDimension.idl:
3354         * Modules/webgpu/GPUTextureUsage.idl:
3355         * platform/graphics/gpu/GPUExtent3D.h:
3356         * platform/graphics/gpu/GPUTextureDescriptor.h:
3357         * platform/graphics/gpu/GPUTextureDimension.h:
3358         * platform/graphics/gpu/GPUTextureUsage.h:
3359
3360         Update WebGPUTextureFormatEnum to GPUTextureFormat:
3361         * Modules/webgpu/WebGPUTextureFormatEnum.h: Removed.
3362         * Modules/webgpu/GPUTextureFormat.idl: Renamed from WebGPUTextureFormatEnum.idl and updated to hyphen-case.
3363         * platform/graphics/gpu/GPUTextureFormat.h: Renamed from GPUTextureFormatEnum and updated for hyphen-case IDL.
3364         * Modules/webgpu/WebGPUSwapChain.cpp:
3365         * Modules/webgpu/WebGPUSwapChain.h:
3366         * Modules/webgpu/WebGPUSwapChain.idl:
3367         * platform/graphics/gpu/GPUSwapChain.h:
3368         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
3369         (WebCore::platformTextureFormatForGPUTextureFormat):
3370         (WebCore::GPUSwapChain::setFormat):
3371
3372         Update project files with new symbols:
3373         * CMakeLists.txt:
3374         * DerivedSources.make:
3375         * Sources.txt:
3376         * WebCore.xcodeproj/project.pbxproj:
3377         * bindings/js/WebCoreBuiltinNames.h:
3378
3379 2019-02-12  Dean Jackson  <dino@apple.com>
3380
3381         BitmapRenderer should handle existing ImageBuffers
3382         https://bugs.webkit.org/show_bug.cgi?id=194555
3383         <rdar://problem/47857150>
3384
3385         Reviewed by Tim Horton.
3386
3387         Our logic in ImageBitmapRenderingContext assumed that
3388         it had always created the ImageBuffer being used. However, it's
3389         valid to call something like toBlob() or toDataURL() before creating
3390         a context, so we need to handle the case where an ImageBuffer
3391         already exists.
3392
3393         Test: fast/canvas/bitmaprenderer-created-after-toBlob.html
3394
3395         * html/HTMLCanvasElement.cpp:
3396         (WebCore::HTMLCanvasElement::createImageBuffer const): Move some logic into setImageBuffer.
3397         (WebCore::HTMLCanvasElement::setImageBuffer const): Make sure to clear the state saver.
3398
3399 2019-02-06  Daniel Bates  <dabates@apple.com>
3400
3401         Standardize on ControlKey instead of CtrlKey
3402         https://bugs.webkit.org/show_bug.cgi?id=194317
3403
3404         Reviewed by Tim Horton.
3405
3406         * dom/UIEventWithKeyState.cpp:
3407         (WebCore::UIEventWithKeyState::modifiersFromInitializer):
3408         (WebCore::UIEventWithKeyState::setModifierKeys):
3409         * dom/UIEventWithKeyState.h:
3410         (WebCore::UIEventWithKeyState::ctrlKey const):
3411         * page/ios/EventHandlerIOS.mm:
3412         (WebCore::EventHandler::accessKeyModifiers):
3413         * page/mac/EventHandlerMac.mm:
3414         (WebCore::EventHandler::accessKeyModifiers):
3415         * platform/PlatformEvent.h:
3416         (WebCore::PlatformEvent::controlKey const):
3417         (WebCore::PlatformEvent::PlatformEvent):
3418         (WebCore::PlatformEvent::ctrlKey const): Deleted.
3419         * platform/cocoa/KeyEventCocoa.mm:
3420         (WebCore::PlatformKeyboardEvent::getCurrentModifierState):
3421         * platform/gtk/PlatformKeyboardEventGtk.cpp:
3422         (WebCore::modifiersForGdkKeyEvent):
3423         * platform/gtk/PlatformMouseEventGtk.cpp:
3424         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
3425         * platform/gtk/PlatformWheelEventGtk.cpp:
3426         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
3427         * platform/ios/KeyEventIOS.mm:
3428         (WebCore::PlatformKeyboardEvent::currentStateOfModifierKeys):
3429         * platform/ios/PlatformEventFactoryIOS.mm:
3430         (WebCore::modifiersForEvent):
3431         * platform/mac/KeyEventMac.mm:
3432         (WebCore::PlatformKeyboardEvent::currentStateOfModifierKeys):
3433         * platform/mac/PlatformEventFactoryMac.mm:
3434         (WebCore::modifiersForEvent):
3435         * testing/Internals.cpp:
3436         (WebCore::Internals::accessKeyModifiers const):
3437
3438 2019-02-06  Alex Christensen  <achristensen@webkit.org>
3439
3440         Fix WatchOS build
3441         https://bugs.webkit.org/show_bug.cgi?id=194353
3442
3443         Rubber stamped by Tim Horton and Wenson Hsieh.
3444
3445         * rendering/RenderThemeIOS.mm:
3446         (WebCore::iconForAttachment):
3447
3448 2019-02-06  Olivier Blin  <olivier.blin@softathome.com>
3449
3450         [SVG] fix SVGURIReference build by including SVGElement
3451         https://bugs.webkit.org/show_bug.cgi?id=194292
3452
3453         Reviewed by Michael Catanzaro.
3454
3455         * svg/SVGURIReference.h:
3456         SVGURIReference is making use of SVGElement in its constructor, but
3457         it was not declared.
3458
3459         The issue was not seen in unified builds because it was grouped with
3460         other files including SVGElement.
3461
3462 2019-02-06  Zalan Bujtas  <zalan@apple.com>
3463
3464         [LFC][IFC] Move line layout code to a dedicated file
3465         https://bugs.webkit.org/show_bug.cgi?id=194328
3466
3467         Reviewed by Antti Koivisto.
3468
3469         * Sources.txt:
3470         * WebCore.xcodeproj/project.pbxproj:
3471         * layout/inlineformatting/InlineFormattingContext.cpp:
3472         (WebCore::Layout::InlineFormattingContext::layout const):
3473         (WebCore::Layout::isTrimmableContent): Deleted.
3474         (WebCore::Layout::InlineFormattingContext::initializeNewLine const): Deleted.
3475         (WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const): Deleted.
3476         (WebCore::Layout::InlineFormattingContext::createFinalRuns const): Deleted.
3477         (WebCore::Layout::InlineFormattingContext::postProcessInlineRuns const): Deleted.
3478         (WebCore::Layout::InlineFormattingContext::closeLine const): Deleted.
3479         (WebCore::Layout::InlineFormattingContext::appendContentToLine const): Deleted.
3480         (WebCore::Layout::InlineFormattingContext::layoutInlineContent const): Deleted.
3481         (WebCore::Layout::InlineFormattingContext::computeFloatPosition const): Deleted.
3482         (WebCore::Layout::InlineFormattingContext::placeInFlowPositionedChildren const): Deleted.
3483         * layout/inlineformatting/InlineFormattingContext.h:
3484         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::hasContent const):
3485         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::isClosed const):
3486         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::isFirstLine const):
3487         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::runs):
3488         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::contentLogicalLeft const):
3489         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::availableWidth const):
3490         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::lastRunType const):
3491         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::logicalTop const):
3492         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::logicalBottom const):
3493         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::logicalHeight const):
3494         (WebCore::Layout::InlineFormattingContext::Line::hasContent const): Deleted.
3495         (WebCore::Layout::InlineFormattingContext::Line::isClosed const): Deleted.
3496         (WebCore::Layout::InlineFormattingContext::Line::isFirstLine const): Deleted.
3497         (WebCore::Layout::InlineFormattingContext::Line::runs): Deleted.
3498         (WebCore::Layout::InlineFormattingContext::Line::contentLogicalLeft const): Deleted.
3499         (WebCore::Layout::InlineFormattingContext::Line::availableWidth const): Deleted.
3500         (WebCore::Layout::InlineFormattingContext::Line::lastRunType const): Deleted.
3501         (WebCore::Layout::InlineFormattingContext::Line::logicalTop const): Deleted.
3502         (WebCore::Layout::InlineFormattingContext::Line::logicalBottom const): Deleted.
3503         (WebCore::Layout::InlineFormattingContext::Line::logicalHeight const): Deleted.
3504         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
3505         (WebCore::Layout::adjustedLineLogicalLeft): Deleted.
3506         (WebCore::Layout::InlineFormattingContext::Geometry::justifyRuns): Deleted.
3507         (WebCore::Layout::InlineFormattingContext::Geometry::computeExpansionOpportunities): Deleted.
3508         (WebCore::Layout::InlineFormattingContext::Geometry::alignRuns): Deleted.
3509         (WebCore::Layout::InlineFormattingContext::Geometry::runWidth): Deleted.
3510         * layout/inlineformatting/Line.cpp:
3511         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::init):
3512         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::adjustLogicalLeft):
3513         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::adjustLogicalRight):
3514         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::contentLogicalRight const):
3515         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::appendContent):
3516         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::close):
3517         (WebCore::Layout::InlineFormattingContext::Line::init): Deleted.
3518         (WebCore::Layout::InlineFormattingContext::Line::adjustLogicalLeft): Deleted.
3519         (WebCore::Layout::InlineFormattingContext::Line::adjustLogicalRight): Deleted.
3520         (WebCore::Layout::InlineFormattingContext::Line::contentLogicalRight const): Deleted.
3521         (WebCore::Layout::InlineFormattingContext::Line::appendContent): Deleted.
3522         (WebCore::Layout::InlineFormattingContext::Line::close): Deleted.
3523
3524 2019-02-06  Youenn Fablet  <youenn@apple.com>
3525
3526         CoreAudioCaptureSource should not configure its audio unit until it starts producing data
3527         https://bugs.webkit.org/show_bug.cgi?id=194310
3528
3529         Reviewed by Eric Carlson.
3530
3531         Delay the configuration of the audio unit until the source is instructed to start producing data.
3532         This allows the UIProcess to not start changing the audio unit when
3533         checking for constraints during getUserMedia call before the prompt.
3534         Covered by manual testing.
3535
3536         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
3537         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
3538         (WebCore::CoreAudioCaptureSource::initializeToStartProducingData):
3539         (WebCore::CoreAudioCaptureSource::startProducingData):
3540         * platform/mediastream/mac/CoreAudioCaptureSource.h:
3541
3542 2019-02-06  Youenn Fablet  <youenn@apple.com>
3543
3544         Disable audio ducking at Audio Unit setup time
3545         https://bugs.webkit.org/show_bug.cgi?id=194303
3546
3547         Reviewed by Eric Carlson.
3548
3549         When creating a CoreAudioCaptureSource, the audio unit might be
3550         reconfigured if a past audio capture was done.
3551         This might trigger audio ducking which is undone in startInternal.
3552         In some cases, startInternal will never call start.
3553         In that case, the audio unit will continue ducking the other processing.
3554         To ensure ducking is disabled, unduck in setupAudioUnit as well as startInternal.
3555
3556         In addition to that, once a shared unit is created, it stays alive until the UIProcess exits.
3557         This might affect all applications.
3558         Instead, whenever the shared unit is stopped, clean it so as to restore the state as if no capture ever happened.
3559         This has noticeable effects in the quality of audio being played on bluetooth devices.
3560
3561         Covered by manual tests.
3562
3563         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
3564         (WebCore::CoreAudioSharedUnit::setupAudioUnit):
3565         (WebCore::CoreAudioSharedUnit::unduck):
3566         (WebCore::CoreAudioSharedUnit::startInternal):
3567         (WebCore::CoreAudioSharedUnit::captureFailed):
3568         (WebCore::CoreAudioSharedUnit::stopProducingData):
3569
3570 2019-02-06  Antti Koivisto  <antti@apple.com>
3571
3572         RELEASE_ASSERT(!m_document.isResolvingTreeStyle()) in com.apple.WebKit.WebContent at WebCore: WebCore::StyleResolver::~StyleResolver
3573         https://bugs.webkit.org/show_bug.cgi?id=194333
3574         <rdar://problem/47822929>
3575
3576         Reviewed by Zalan Bujtas.
3577
3578         Content extensions may mutate the extension stylesheet in the middle of a style resolution as a result of
3579         the legacy animation code triggering a resource load.
3580
3581         Test: http/tests/contentextensions/css-display-none-keyframe.html
3582
3583         * style/StyleScope.cpp:
3584         (WebCore::Style::Scope::scheduleUpdate):
3585
3586         Avoid clearing the style resolver if we are in the middle of a style resolution.
3587         A better fix that avoid doing this in the first place is tracked by https://bugs.webkit.org/show_bug.cgi?id=194335.
3588
3589 2019-02-06  Pablo Saavedra  <psaavedra@igalia.com>
3590
3591         Build failure after r240315
3592         https://bugs.webkit.org/show_bug.cgi?id=194341
3593
3594         Reviewed by Wenson Hsieh.
3595
3596         * bindings/js/JSUndoItemCustom.cpp:
3597         (WebCore::JSUndoItemOwner::isReachableFromOpaqueRoots):
3598
3599 2019-02-05  Ryosuke Niwa  <rniwa@webkit.org>
3600
3601         REGRESSION (r240909): Release assert in FrameLoader::loadURL when navigating with a non-existent target name
3602         https://bugs.webkit.org/show_bug.cgi?id=194329
3603
3604         Reviewed by Geoffrey Garen.
3605
3606         The bug was caused by the code path for when navigating with a specific target frame name that does not exist
3607         never setting the load type of PolicyChecker. As a result, we would use whatever load type used in the previous
3608         navigation, resulting in this release assertion.
3609
3610         Updating the load type here should in theory fix the underlying bug r240909 was meant to catch & fix.
3611
3612         Test: fast/loader/navigate-with-new-target-after-back-forward-navigation.html
3613
3614         * loader/FrameLoader.cpp:
3615         (WebCore::FrameLoader::loadURL):
3616
3617 2019-02-05  Claudio Saavedra  <csaavedra@igalia.com>
3618
3619         [FreeType] Build fix for Debian stable
3620
3621         Unreviewed build fix.
3622
3623         Debian stable currently has a version of fontconfig that doesn't
3624         yet have FC_COLOR. #ifdef its use to fix the build.
3625
3626         * platform/graphics/freetype/FontCacheFreeType.cpp:
3627         (WebCore::FontCache::systemFallbackForCharacters):
3628
3629 2019-02-05  Alex Christensen  <achristensen@webkit.org>
3630
3631         Stop using blobRegistry in NetworkProcess
3632         https://bugs.webkit.org/show_bug.cgi?id=194027
3633
3634         Reviewed by Youenn Fablet.
3635
3636         Also stop using NetworkBlobRegistry::singleton.
3637         Instead, have the NetworkProcess own a NetworkBlobRegistry which owns a BlobRegistryImpl.
3638         We now have to resolve all blob file references while we still have a
3639         NetworkConnectionToWebProcess/NetworkProcess/NetworkBlobRegistry/BlobRegistryImpl instead of
3640         using the singleton after we have passed everything to the loading code, but it works the same
3641         as it did before.  We must consume the sandbox extension from the BlobRegistryImpl before using
3642         the resolved files, so I pass around a Vector<RefPtr<WebCore::BlobDataFileReference>> so we know
3643         which extensions to revoke.
3644
3645         * platform/network/BlobRegistryImpl.h:
3646         * platform/network/FormData.cpp:
3647         (WebCore::appendBlobResolved):
3648         (WebCore::FormData::resolveBlobReferences):
3649         * platform/network/FormData.h:
3650         * platform/network/cf/FormDataStreamCFNet.cpp:
3651         (WebCore::createHTTPBodyCFReadStream):
3652         * platform/network/curl/CurlFormDataStream.cpp:
3653         (WebCore::CurlFormDataStream::CurlFormDataStream):
3654
3655 2019-02-05  Truitt Savell  <tsavell@apple.com>
3656
3657         Unreviewed, rolling out r240984.
3658
3659         Revision casued two API timeouts
3660
3661         Reverted changeset:
3662
3663         "Stop using blobRegistry in NetworkProcess"
3664         https://bugs.webkit.org/show_bug.cgi?id=194027
3665         https://trac.webkit.org/changeset/240984
3666
3667 2019-02-05  Keith Rollin  <krollin@apple.com>
3668
3669         Enable the automatic checking and regenerations of .xcfilelists during builds
3670         https://bugs.webkit.org/show_bug.cgi?id=194124
3671         <rdar://problem/47721277>
3672
3673         Reviewed by Tim Horton.
3674
3675         Bug 193790 add a facility for checking -- during build time -- that
3676         any needed .xcfilelist files are up-to-date and for updating them if
3677         they are not. This facility was initially opt-in by setting
3678         WK_ENABLE_CHECK_XCFILELISTS until other pieces were in place and until
3679         the process seemed robust. Its now time to enable this facility and
3680         make it opt-out. If there is a need to disable this facility, set and
3681         export WK_DISABLE_CHECK_XCFILELISTS=1 in your environment before
3682         running `make` or `build-webkit`, or before running Xcode from the
3683         command line.
3684
3685         Additionally, remove the step that generates a list of source files
3686         going into the UnifiedSources build step. It's only necessarily to
3687         specify Sources.txt and SourcesCocoa.txt as inputs.
3688
3689         No new tests since there should be no observable behavior difference.
3690
3691         * UnifiedSources-input.xcfilelist: Removed.
3692         * WebCore.xcodeproj/project.pbxproj:
3693
3694 2019-02-05  Keith Rollin  <krollin@apple.com>
3695
3696         Update .xcfilelist files
3697         https://bugs.webkit.org/show_bug.cgi?id=194121
3698         <rdar://problem/47720863>
3699
3700         Reviewed by Tim Horton.
3701
3702         Preparatory to enabling the facility for automatically updating the
3703         .xcfilelist files, check in a freshly-updated set so that not everyone
3704         runs up against having to regenerate them themselves.
3705
3706         No new tests since there should be no observable behavior difference.
3707
3708         * DerivedSources-input.xcfilelist:
3709         * DerivedSources-output.xcfilelist:
3710
3711 2019-02-05  Alex Christensen  <achristensen@webkit.org>
3712
3713         Stop using blobRegistry in NetworkProcess
3714         https://bugs.webkit.org/show_bug.cgi?id=194027
3715
3716         Reviewed by Youenn Fablet.
3717
3718         Also stop using NetworkBlobRegistry::singleton.
3719         Instead, have the NetworkProcess own a NetworkBlobRegistry which owns a BlobRegistryImpl.
3720         We now have to resolve all blob file references while we still have a
3721         NetworkConnectionToWebProcess/NetworkProcess/NetworkBlobRegistry/BlobRegistryImpl instead of
3722         using the singleton after we have passed everything to the loading code, but it works the same
3723         as it did before.  We must consume the sandbox extension from the BlobRegistryImpl before using
3724         the resolved files, so I pass around a Vector<RefPtr<WebCore::BlobDataFileReference>> so we know
3725         which extensions to revoke.
3726
3727         * platform/network/BlobRegistryImpl.h:
3728         * platform/network/FormData.cpp:
3729         (WebCore::appendBlobResolved):
3730         (WebCore::FormData::resolveBlobReferences):
3731         * platform/network/FormData.h:
3732         * platform/network/cf/FormDataStreamCFNet.cpp:
3733         (WebCore::createHTTPBodyCFReadStream):
3734         * platform/network/curl/CurlFormDataStream.cpp:
3735         (WebCore::CurlFormDataStream::CurlFormDataStream):
3736
3737 2019-02-05  Ryan Haddad  <ryanhaddad@apple.com>
3738
3739         Unreviewed, rolling out r240742.
3740
3741         Causes crashes on iOS simulator.
3742
3743         Reverted changeset:
3744
3745         "[iOS] Keyups for non-modifier keys identified as "Dead" when
3746         not focused in a content-editable element"
3747         https://bugs.webkit.org/show_bug.cgi?id=192824
3748         https://trac.webkit.org/changeset/240742
3749
3750 2019-02-05  Zalan Bujtas  <zalan@apple.com>
3751
3752         [LFC][IFC] collectInlineContent should use pre-computed margins, paddings and borders
3753         https://bugs.webkit.org/show_bug.cgi?id=194269
3754
3755         Reviewed by Antti Koivisto.
3756
3757         In this patch we pre-compute the margins padding and borders for formatting context roots, replaced boxes and non-replaced containers.
3758         These property values are input to collectInlineContent's inline item detaching logic.
3759
3760         * layout/inlineformatting/InlineFormattingContext.cpp:
3761         (WebCore::Layout::nextInPreOrder):
3762         (WebCore::Layout::InlineFormattingContext::layout const):
3763         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const):
3764         (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
3765         * layout/inlineformatting/InlineFormattingContext.h:
3766         * layout/layouttree/LayoutBox.h: ran out bits. 
3767
3768 2019-02-05  Antoine Quint  <graouts@apple.com>
3769
3770         REGRESSION (r240579): com.apple.WebKit.WebContent at WebCore: WebCore::Document::absoluteEventRegionForNode
3771         https://bugs.webkit.org/show_bug.cgi?id=194284
3772         <rdar://problem/47774298>
3773
3774         Reviewed by Antti Koivisto.
3775
3776         The m_touchActionElements list needs to be HashSet<RefPtr<Element>> instead of HashSet<Element*>. It was initially storing raw pointers based on m_touchEventTargets
3777         which is an EventTargetSet (typedef’d to HashCountedSet<Node*>), but that's because these nodes have an event listener registered for them and as such are kept alive,
3778         whereas elements with a touch-action property aren’t. Elements are removed from this list from Document::nodeWillBeRemoved() and from Document::updateTouchActionElements(),
3779         the latter being called from Style::TreeResolver::resolveElement().
3780
3781         * dom/Document.cpp:
3782         (WebCore::Document::updateTouchActionElements):
3783         * dom/Document.h:
3784         (WebCore::Document::touchActionElements const):
3785
3786 2019-02-05  Benjamin Poulain  <benjamin@webkit.org>
3787
3788         Hit testing functions optimizations
3789         https://bugs.webkit.org/show_bug.cgi?id=194073
3790         <rdar://problem/47692312>
3791
3792         Reviewed by Zalan Bujtas.
3793
3794         This patch implements some easy optimizations that speed up
3795         hit testing without changing the algorithms.
3796
3797         * page/FrameViewLayoutContext.h:
3798         The code for:
3799             view().frameView().layoutContext().isPaintOffsetCacheEnabled()
3800         followed by:
3801             view().frameView().layoutContext().layoutState()
3802         was loading all the intermediate values twice and calling layoutState()
3803         twice.
3804
3805         By marking the function as pure, Clang can CSE the whole thing and
3806         remove the duplicated code.
3807
3808         * platform/graphics/LayoutRect.h:
3809         (WebCore::LayoutRect::isInfinite const):
3810         That one is pretty funny.
3811
3812         Since LayoutRect::isInfinite() was implemented before operator==() is
3813         declared, the compiler was falling back to the implicit convertion to FloatRect()
3814         before doing any comparison.
3815
3816         This explains a bunch of the convertions to float when using LayoutRect.
3817
3818         * rendering/RenderBox.cpp:
3819         (WebCore::RenderBox::mapLocalToContainer const):
3820         Just reoder to make the register nice and clean for the optimization described above.
3821
3822 2019-02-04  Yusuke Suzuki  <ysuzuki@apple.com>
3823
3824         [JSC] Shrink size of VM by lazily allocating IsoSubspaces for non-common types
3825         https://bugs.webkit.org/show_bug.cgi?id=193993
3826
3827         Reviewed by Keith Miller.
3828
3829         * bindings/scripts/CodeGeneratorJS.pm:
3830         (GenerateHeader):
3831         * bridge/runtime_method.h:
3832
3833 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
3834
3835         Move some macOS/iOS scrolling code into the scrolling/cocoa directory
3836         https://bugs.webkit.org/show_bug.cgi?id=194245
3837
3838         Reviewed by Zalan Bujtas.
3839
3840         ScrollingTreeFixedNode and ScrollingTreeStickyNode are used on iOS and macOS, so move them to the cocoa
3841         directory.
3842
3843         Standardize on the ordering of ENABLE(ASYNC_SCROLLING) && PLATFORM(MAC).
3844
3845         Stop building ScrollingThread for iOS (it's never used), and stub out some functions so things build.
3846
3847         * SourcesCocoa.txt:
3848         * WebCore.xcodeproj/project.pbxproj:
3849         * page/scrolling/ScrollingThread.cpp:
3850         (WebCore::ScrollingThread::initializeRunLoop):
3851         (WebCore::ScrollingThread::wakeUpRunLoop):
3852         (WebCore::ScrollingThread::threadRunLoopSourceCallback):
3853         * page/scrolling/cocoa/ScrollingTreeFixedNode.h: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.h.
3854         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm.
3855         * page/scrolling/cocoa/ScrollingTreeStickyNode.h: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.h.
3856         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm.
3857         * page/scrolling/mac/ScrollingThreadMac.mm:
3858         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
3859         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
3860
3861 2019-02-04  Ms2ger  <Ms2ger@igalia.com>
3862
3863         [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI
3864         https://bugs.webkit.org/show_bug.cgi?id=174816
3865
3866         Reviewed by Michael Catanzaro.
3867
3868         Tests: enabled fast/url/user-visible/.
3869
3870         * testing/Internals.cpp:
3871         (WebCore::Internals::userVisibleString): Enable method on all platforms.
3872
3873 2019-02-04  Fujii Hironori  <Hironori.Fujii@sony.com>
3874
3875         [curl] ASSERTION FAILED: !m_didNotifyResponse || m_multipartHandle
3876         https://bugs.webkit.org/show_bug.cgi?id=190895
3877
3878         Reviewed by Ross Kirsling.
3879
3880         An assertion was failing in CurlRequest::invokeDidReceiveResponse
3881         because DidReceiveResponse was already dispatched. This condition
3882         was met if CurlRequestScheduler::completeTransfer is called while
3883         waiting for the reply for the first DidReceiveResponse.
3884
3885         No new tests, covered by existing tests.
3886
3887         * platform/network/curl/CurlRequest.h:
3888         (WebCore::CurlRequest::needToInvokeDidReceiveResponse const):
3889         Return true if m_didNotifyResponse is false disregard to
3890         m_didReturnFromNotify.
3891
3892 2019-02-04  Said Abou-Hallawa  <said@apple.com>
3893
3894         [CG] Enable setAdditionalSupportedImageTypes for WK1
3895         https://bugs.webkit.org/show_bug.cgi?id=194190
3896
3897         Reviewed by Tim Horton.
3898
3899         Move the function webCoreStringVectorFromNSStringArray from WebKit to
3900         WebCore so it can be used by both WebKit and WebKitLegacy.
3901
3902         * platform/mac/StringUtilities.h:
3903         * platform/mac/StringUtilities.mm:
3904         (WebCore::webCoreStringVectorFromNSStringArray):
3905
3906 2019-02-04  Justin Fan  <justin_fan@apple.com>
3907
3908         [Web GPU] Code clean-up for RenderPipeline backend
3909         https://bugs.webkit.org/show_bug.cgi?id=194238
3910
3911         Reviewed by Dean Jackson.
3912
3913         Replace dot syntax setters with calls to setter methods, and remove unnecessary setter calls for 
3914         the input state's descriptor arrays.
3915
3916         Covered by existing tests; no change in behavior.
3917
3918         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
3919         (WebCore::tryCreateMtlDepthStencilState): Refactor to use implicit setters rather than dot syntax.
3920         (WebCore::setInputStateForPipelineDescriptor): Ditto, and remove unnecessary setter calls on array objects.
3921
3922 2019-02-04  Benjamin Poulain  <benjamin@webkit.org>
3923
3924         Use deferrable timer to restart the Responsiveness Timer on each wheel event
3925         https://bugs.webkit.org/show_bug.cgi?id=194135
3926         <rdar://problem/47724099>
3927
3928         Reviewed by Simon Fraser.
3929
3930         The original DeferrableOneShotTimer was not really deferrable.
3931         What it allows is to restart the count down from scratch after
3932         firing.
3933
3934         For this optimization, I want to keep the correct timing but avoid
3935         starting a real timer every time.
3936
3937         I renamed DeferrableOneShotTimer to ResettableOneShotTimer and
3938         created a real DeferrableOneShotTimer that support deadlines.
3939
3940         * css/CSSImageGeneratorValue.cpp:
3941         * html/HTMLPlugInImageElement.h:
3942         * loader/cache/CachedResource.h:
3943         * platform/Timer.cpp:
3944         (WebCore::DeferrableOneShotTimer::startOneShot):
3945         (WebCore::DeferrableOneShotTimer::fired):
3946         * platform/Timer.h:
3947         (WebCore::TimerBase::nextFireTime const):
3948         (WebCore::ResettableOneShotTimer::ResettableOneShotTimer):
3949         (WebCore::DeferrableOneShotTimer::DeferrableOneShotTimer):
3950         (WebCore::DeferrableOneShotTimer::stop):
3951         (WebCore::DeferrableOneShotTimer::restart): Deleted.
3952         * platform/graphics/ca/TileController.h:
3953         * platform/graphics/cg/SubimageCacheWithTimer.h:
3954
3955 2019-02-04  Antoine Quint  <graouts@apple.com>
3956
3957         Use constants for pointer types
3958