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