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