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