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