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