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