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