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