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