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