848e2a14217a34d8c958a3efac4344c426316760
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2020-02-23  Darin Adler  <darin@apple.com>
2
3         Refactor TextTrackCue to use more traditional design patterns
4         https://bugs.webkit.org/show_bug.cgi?id=208114
5
6         Reviewed by Alex Christensen.
7
8         - Fixed is<VTTCue> to accurately match the class hierarchy. Before, TextTrackCueGeneric
9           derived from VTTCue, but is<VTTCue> would return false. Normalizing this lets us use
10           is<VTTCue> and downcast<VTTCue> in the conventional way.
11         - Made the TextTrackCue::isEqual function a non-virtual function that calls a virtual
12           function TextTrackCue::cueContentsMatch. Before there was a mix of overridding both
13           functions in derived classes, achieving the same thing in multiple ways with
14           unneccessary additional virtual function call overhead.
15         - Made the TextTrackCue::toJSONString function a non-virtual function that calls a
16           virtual funtion TextTrackCue::toJSON. Before there were two virtual functions and
17           inconsistent patterns for which one was overridden.
18
19         * html/HTMLMediaElement.cpp:
20         (WebCore::HTMLMediaElement::textTrackRemoveCue): Use downcast instead of toVTTCue.
21
22         * html/HTMLMediaElement.h: Removed some unneeded includes.
23
24         * html/shadow/MediaControlElements.cpp:
25         (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Use downcast
26         instead of toVTTCue.
27         (WebCore::MediaControlTextTrackContainerElement::processActiveVTTCue): Removed
28         an assertion that no longer makes sense; guaranteed at runtime.
29
30         * html/shadow/MediaControls.h: Removed an unneeded include.
31
32         * html/track/DataCue.cpp:
33         (WebCore::toDataCue): Deleted. No need for this function since we can use
34         downcast<DataCue> instead.
35         (WebCore::DataCue::cueContentsMatch const): Removed unnecessary check of cueType.
36         The isEqual function checks cueType and only calls this function if it matches.
37         Use downcast instead of toDataCue.
38         (WebCore::DataCue::isEqual const): Deleted. Base class now handles this.
39         (WebCore::DataCue::doesExtendCue const): Deleted. Was never being called.
40         (WebCore::DataCue::toJSONString const): Deleted. Override toJSON instead.
41         (WebCore::DataCue::toJSON const): Moved the code here that used to be in toJSONString.
42
43         * html/track/DataCue.h: Reduced includes. Made overridden functions private
44         and final. Removed functions as mmentioned above. Changed WTF::LogArgument implementation
45         to just forward to TextTrackCue instead of reimplementing here.
46
47         * html/track/InbandDataTextTrack.cpp:
48         (WebCore::InbandDataTextTrack::removeCue): Use downcast instead of toDataCue.
49
50         * html/track/InbandGenericTextTrack.cpp: Removed an unneeded include.
51
52         * html/track/LoadableTextTrack.cpp:
53         (WebCore::LoadableTextTrack::LoadableTextTrack): Removed unneeded initialization of
54         m_isDefault, which is initialized in the class definition.
55         (WebCore::LoadableTextTrack::newCuesAvailable): Removed unneeded call to toVTTCue,
56         taking advantage of the better interface of getNewCues, which now returns
57         Vector<Ref<VTTCue>>, making the type explicit.
58
59         * html/track/TextTrack.cpp:
60         (WebCore::TextTrack::addCue): Use is<DataCue> instead of checking cueType.
61
62         * html/track/TextTrackCue.cpp:
63         (WebCore::TextTrackCue::create): Fixed confusing naming that called the fragment the
64         cue is contained in "cueDocument"; call it cueFragment instead. This constructor
65         already required that the ScriptExecutionContext be a Document. Did the type cast
66         for that up front. In the future would be good to change the argument type to Document.
67         Also fixed how the newly-created fragment is passed to the constructor. The old code
68         tried to use DocumentFragment&& to pass ownership, but since this is a reference-counted
69         object it needs to be Ref<DocumentFragment>&&.
70         (WebCore::TextTrackCue::TextTrackCue):
71         (WebCore::TextTrackCue::scriptExecutionContext const): Moved this here from the header
72         file so we can compile without TextTrackCue.h including Document.h.
73         (WebCore::TextTrackCue::cueContentsMatch const): Removed the code that checks cueType.
74         It's now isEqual that is responsible for checking that the cueType matches, and
75         cueContentsMatch is only called when the types are the same.
76         (WebCore::TextTrackCue::isEqual const): Reordered the boolean checks a bit so it's
77         easier to see the logic; no need for a cascade of if statements.
78         (WebCore::TextTrackCue::doesExtendCue const): Deleted. Was never being called.
79         (WebCore::operator<<): Use downcast instead of toVTTCue.
80
81         * html/track/TextTrackCue.h: Made isEqual no longer virtual. The per-class behavior
82         is now all in the virtual cueContentsMatch function, only called by isEqual.
83         Removed uncalled doesExtendCue function. Added some argument names in cases where
84         the type alone did not make their purpose clear. Made some things more private.
85         Replaced m_scriptExecutionContext with m_document.
86
87         * html/track/TextTrackCueGeneric.cpp:
88         (WebCore::TextTrackCueGeneric::create): Moved this function here from the header.
89         (WebCore::TextTrackCueGeneric::TextTrackCueGeneric): Initialized data members in the
90         class definition so they don't also need to be initialized here.
91         (WebCore::TextTrackCueGeneric::cueContentsMatch const): Rewrote using && rather than
92         castcading if statements, making the function shorter andd easier to read.
93         (WebCore::TextTrackCueGeneric::isEqual const): Deleted. Base class now handes this.
94         The old version had confusing logic to deal with checking cue type; can now do this
95         in a more straightforward way.
96         (WebCore::TextTrackCueGeneric::doesExtendCue const): Deleted. Was never called.
97         (WebCore::TextTrackCueGeneric::isOrderedBefore const): Use is<TextTrackCueGeneric>
98         and downcast<TextTrackCueGeneric>.
99         (WebCore::TextTrackCueGeneric::isPositionedAbove const): Ditto. Also merged two
100         if statements so there is less repeated logic.
101         (WebCore::TextTrackCueGeneric::toJSONString const): Deleted.
102         (WebCore::TextTrackCueGeneric::toJSON const): Moved code here that was in toJSONString.
103
104         * html/track/TextTrackCueGeneric.h: Made things more private. Changed WTF::LogArgument
105         implementation to just forward to TextTrackCue instead of reimplementing here.
106
107         * html/track/TextTrackCueList.cpp:
108         (WebCore::TextTrackCueList::create): Moved here from header.
109         * html/track/TextTrackCueList.h: Ditto.
110
111         * html/track/VTTCue.cpp: Moved undefinedPosition to be a private static constexpr
112         data member so it can be used in initialization.
113         (WebCore::VTTCueBox::applyCSSProperties): Use is<VTTCue> and downcast<VTTCue>.
114         (WebCore::VTTCue::create): Moved more overloads of this function here from the
115         header file.
116         (WebCore::VTTCue::VTTCue): Take Document instead of ScriptExecutionContext.
117         Also took the ScriptExecutionContext argument away from the initialize function.
118         (WebCore::VTTCue::initialize): Do less initialization here. This function is
119         only called in constructors, so it doesn't need to initialize anything that
120         is initialized in all constructors or initialized in the class definition.
121         What remains are things that require a little code to initialize and the
122         bitfields, which can't be initialized in the class definition.
123         (WebCore::VTTCue::setPosition): Rearranged the code a tiny bit.
124         (WebCore::copyWebVTTNodeToDOMTree): Made this a non-member function. Also changed
125         the argument types to use references.
126         (WebCore::VTTCue::getCueAsHTML): Updated for changes to copyWebVTTNodeToDOMTree.
127         (WebCore::VTTCue::removeDisplayTree): Check m_displayTree directly instead
128         of calling a hasDisplayTree function, since that's more a more straightforward
129         way to guard a subsequent line of code that then uses m_displayTree.
130         (WebCore::VTTCue::setCueSettings): Merged two if statements into one.
131         (WebCore::VTTCue::cueContentsMatch const): Rewrote using && rather than
132         castcading if statements, making the function shorter andd easier to read.
133         (WebCore::VTTCue::isEqual const): Deleted. Base class now handles this.
134         (WebCore::VTTCue::doesExtendCue const): Deleted. Was never called.
135         (WebCore::toVTTCue): Deleted.
136         (WebCore::VTTCue::toJSONString const): Deleted. Base class now handles this.
137         (WebCore::VTTCue::toJSON const): Added a comment.
138
139         * html/track/VTTCue.h: Moved create functions out of header, made some things
140         more private and final, initialized more data members in the class definition.
141         Removed toVTTCue. Changed WTF::LogArgument implementation to just forward to
142         TextTrackCue instead of reimplementing here. Corrected the isType function so
143         it knows about both cue types that result in a VTTCue object. This allows us
144         to use is<VTTCue> and downcast<VTTCue> in the normal way. Removed the FIXME
145         saying we should do that.
146
147         * loader/TextTrackLoader.cpp:
148         (WebCore::TextTrackLoader::getNewCues): Changed to return a Vector<Ref<VTTCue>>.
149         In modern C++ return value is better than an out argument for a function like
150         this, and the more-specific type helps us at the call sites.
151
152         * loader/TextTrackLoader.h: Updated for the above.
153
154         * page/CaptionUserPreferencesMediaAF.cpp: Removed unneeded include.
155
156         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
157         Use #pragma once and removed some unneded includes and forward declarations.
158
159         * rendering/RenderVTTCue.cpp:
160         (WebCore::RenderVTTCue::RenderVTTCue): Use downcast<VTTCue>.
161         (WebCore::RenderVTTCue::layout): Removed unneeded call to toVTTCue.
162         (WebCore::RenderVTTCue::repositionGenericCue): Use downcast instead of
163         static_cast for TextTrackCueGeneric.
164
165         * style/RuleSet.cpp: Removed unneeded include.
166
167 2020-02-24  Chris Fleizach  <cfleizach@apple.com>
168
169         AX: Support relative frames for isolated trees correctly
170         https://bugs.webkit.org/show_bug.cgi?id=208169
171         <rdar://problem/59746529>
172
173         Reviewed by Zalan Bujtas.
174
175         To support relative frames correctly for accessibility, we should:
176           1) Only expose for isolated tree clients.
177           2) Support FloatRects in the attribute variants.
178           
179         This patch also fixes an issue where we weren't reserving capacity before using.
180
181         * accessibility/isolatedtree/AXIsolatedObject.cpp:
182         (WebCore::AXIsolatedObject::setObjectVectorProperty):
183         * accessibility/isolatedtree/AXIsolatedObject.h:
184         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
185         (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
186         (-[WebAccessibilityObjectWrapper ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
187
188 2020-02-24  ChangSeok Oh  <changseok@webkit.org>
189
190         PS-2019-006: [GTK] WebKit - AXObjectCache - m_deferredFocusedNodeChange - UaF
191         https://bugs.webkit.org/show_bug.cgi?id=204342
192
193         Reviewed by Carlos Garcia Campos.
194
195         m_deferredFocusedNodeChange keeps pairs of a old node and a new one
196         to update a focused node later. When a node is removed in the document,
197         it is also removed from the pair vector. The problem is only comparing
198         the new node in each pair with a removed node decides the removal.
199         In the case where the removed node lives in m_deferredFocusedNodeChange
200         as an old node, a crash happens while we get a renderer of the removed node
201         to handle focused elements. To fix this, we find all entries of which old node
202         is matched to the removed node, and set their first value null.
203
204         No new tests since no functionality changed.
205
206         * accessibility/AXObjectCache.cpp:
207         (WebCore::AXObjectCache::remove):
208
209 2020-02-24  Zalan Bujtas  <zalan@apple.com>
210
211         [LFC][IFC][Floats] Fix float boxes embedded to unbreakable inline runs.
212         https://bugs.webkit.org/show_bug.cgi?id=208112
213         <rdar://problem/59709701>
214
215         Reviewed by Antti Koivisto.
216
217         This patch fixes the cases when the float is embedded to otherwise unbreakable inline content.
218         e.g. "text_<div style="float: left"></div>_content"
219
220         The logic goes like this:
221         1. collect the floats inside the unbreakable candidate content
222         2. mark them intrusive if they potentially influence the current line
223         3. at handleFloatsAndInlineContent(), adjust available width with the intrusive floats first
224         4. feed the inline content to the LineBreaker
225         6. commit the float content based on the line breaking result (commit none, partially, all).
226         (Note that this algorithm produces a different layout compared to WebKit trunk. It mostly matches FireFox though.)
227
228         * layout/inlineformatting/InlineFormattingContext.cpp:
229         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthForConstraint const):
230         (WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
231         * layout/inlineformatting/InlineLineBuilder.cpp:
232         (WebCore::Layout::LineBuilder::moveLogicalLeft):
233         (WebCore::Layout::LineBuilder::moveLogicalRight):
234         * layout/inlineformatting/LineLayoutContext.cpp:
235         (WebCore::Layout::isAtSoftWrapOpportunity):
236         (WebCore::Layout::nextWrapOpportunity):
237         (WebCore::Layout::LineCandidate::FloatContent::append):
238         (WebCore::Layout::LineLayoutContext::layoutLine):
239         (WebCore::Layout::LineLayoutContext::close):
240         (WebCore::Layout::LineLayoutContext::nextContentForLine):
241         (WebCore::Layout::LineLayoutContext::addIntrusiveFloats):
242         (WebCore::Layout::LineLayoutContext::revertIntrusiveFloats):
243         (WebCore::Layout::LineLayoutContext::handleFloatsAndInlineContent):
244         (WebCore::Layout::isLineConsideredEmpty): Deleted.
245         (WebCore::Layout::LineLayoutContext::tryAddingFloatContent): Deleted.
246         (WebCore::Layout::LineLayoutContext::tryAddingInlineItems): Deleted.
247         * layout/inlineformatting/LineLayoutContext.h:
248
249 2020-02-24  Nikos Mouchtaris  <nmouchtaris@apple.com>
250
251         Add canShare function for Web Share API v2
252         https://bugs.webkit.org/show_bug.cgi?id=207491
253
254         Reviewed by Tim Horton.
255
256         Added files member to share data and canShare function to
257         navigator.cpp. Can share function should always be used 
258         before call to share, and can be used to check if file 
259         sharing is implemented by passing a share data object with
260         only files.
261
262         Imported new Web Platform Tests to test new function.
263
264         * page/Navigator.cpp:
265         (WebCore::Navigator::canShare): Will currently return false for 
266         only file share data objects, since file sharing is currently 
267         not implemented.
268         (WebCore::Navigator::share): Changed to use canShare to 
269         determine if data is shareable.
270         * page/Navigator.h:
271         * page/NavigatorShare.idl:
272         * page/ShareData.h:
273         * page/ShareData.idl:
274
275 2020-02-24  Yusuke Suzuki  <ysuzuki@apple.com>
276
277         [WTF] Attach WARN_UNUSED_RETURN to makeScopeExit and fix existing wrong usage
278         https://bugs.webkit.org/show_bug.cgi?id=208162
279
280         Reviewed by Robin Morisset.
281
282         * html/HTMLLinkElement.cpp:
283         (WebCore::HTMLLinkElement::process):
284
285 2020-02-24  Jiewen Tan  <jiewen_tan@apple.com>
286
287         [WebAuthn] Implement SPI for the platform authenticator
288         https://bugs.webkit.org/show_bug.cgi?id=208087
289         <rdar://problem/59369305>
290
291         Reviewed by Brent Fulgham.
292
293         Enhances AuthenticatorAssertionResponse to accommondate responses
294         returned from the platform authenticator.
295
296         Covered by API tests.
297
298         * Modules/webauthn/AuthenticatorAssertionResponse.cpp:
299         (WebCore::AuthenticatorAssertionResponse::create):
300         (WebCore::AuthenticatorAssertionResponse::setAuthenticatorData):
301         (WebCore::AuthenticatorAssertionResponse::AuthenticatorAssertionResponse):
302         * Modules/webauthn/AuthenticatorAssertionResponse.h:
303         (WebCore::AuthenticatorAssertionResponse::authenticatorData const):
304         (WebCore::AuthenticatorAssertionResponse::signature const):
305         (WebCore::AuthenticatorAssertionResponse::name const):
306         (WebCore::AuthenticatorAssertionResponse::displayName const):
307         (WebCore::AuthenticatorAssertionResponse::numberOfCredentials const):
308         (WebCore::AuthenticatorAssertionResponse::accessControl const):
309         (WebCore::AuthenticatorAssertionResponse::setSignature):
310         (WebCore::AuthenticatorAssertionResponse::setName):
311         (WebCore::AuthenticatorAssertionResponse::setDisplayName):
312         (WebCore::AuthenticatorAssertionResponse::setNumberOfCredentials):
313
314 2020-02-24  Simon Fraser  <simon.fraser@apple.com>
315
316         Rename the clashing WebOverlayLayer classes
317         https://bugs.webkit.org/show_bug.cgi?id=208156
318         rdar://problem/59739250
319
320         Reviewed by Tim Horton.
321
322         The name WebOverlayLayer was used in two places. Rename them both to more specific names.
323
324         * page/cocoa/ResourceUsageOverlayCocoa.mm:
325         (-[WebResourceUsageOverlayLayer initWithResourceUsageOverlay:]):
326         (WebCore::ResourceUsageOverlay::platformInitialize):
327         (-[WebOverlayLayer initWithResourceUsageOverlay:]): Deleted.
328         (-[WebOverlayLayer drawInContext:]): Deleted.
329
330 2020-02-24  Andres Gonzalez  <andresg_22@apple.com>
331
332         [WebAccessibilityObjectWrapper updateObjectBackingStore] should return the backing object.
333         https://bugs.webkit.org/show_bug.cgi?id=208153
334
335         Reviewed by Chris Fleizach.
336
337         Covered by existing tests.
338
339         Currently in many WebAccessibilityObjectWrapper's methods we call
340         updateObjectBackingStore followed by one or more calls to
341         axBackingObject. This patch eliminates this unnecessary call by making
342         updateObjectBackingStore return the backing object. It also cleans up
343         other unnecessary calls to axBackingObject and does some minor code
344         cleanup.
345
346         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
347         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
348         (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
349         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
350         (-[WebAccessibilityObjectWrapper ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
351         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
352         (-[WebAccessibilityObjectWrapper accessibilityFocusedUIElement]):
353         (-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
354         (-[WebAccessibilityObjectWrapper accessibilityIsAttributeSettable:]):
355         (-[WebAccessibilityObjectWrapper _accessibilityPerformPressAction]):
356         (-[WebAccessibilityObjectWrapper _accessibilityPerformIncrementAction]):
357         (-[WebAccessibilityObjectWrapper _accessibilityPerformDecrementAction]):
358         (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]):
359         (-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]):
360         (-[WebAccessibilityObjectWrapper accessibilityInsertText:]):
361         (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
362         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
363         (-[WebAccessibilityObjectWrapper accessibilityIndexOfChild:]):
364         (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeCount:]):
365         (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]):
366
367 2020-02-24  Zalan Bujtas  <zalan@apple.com>
368
369         [LFC][IFC][Floats] Fix float box handling inside unbreakable content
370         https://bugs.webkit.org/show_bug.cgi?id=208109
371         <rdar://problem/59708646>
372
373         Reviewed by Antti Koivisto.
374
375         We've been handling float boxes and other inline items as mutually exclusive content (in the context of unbreakable candidate runs).
376         While this works in most cases, when the unbreakable content includes float boxes, the layout
377         ends up being incorrect.
378         This patch is in preparation for making sure we process the inline content and the associated float boxes as one entity.
379         (e.g "text_<div style="float: left"></div>_content" produces an unbreakable inline content of [text_][_content] and an associated float box)
380
381         * layout/inlineformatting/LineLayoutContext.cpp:
382         (WebCore::Layout::isAtSoftWrapOpportunity):
383         (WebCore::Layout::LineCandidate::FloatContent::append):
384         (WebCore::Layout::LineCandidate::FloatContent::list const):
385         (WebCore::Layout::LineCandidate::FloatContent::reset):
386         (WebCore::Layout::LineCandidate::reset):
387         (WebCore::Layout::LineLayoutContext::layoutLine):
388         (WebCore::Layout::LineLayoutContext::nextContentForLine):
389         (WebCore::Layout::LineLayoutContext::tryAddingFloatContent):
390         (WebCore::Layout::LineLayoutContext::tryAddingFloatItem): Deleted.
391         * layout/inlineformatting/LineLayoutContext.h:
392
393 2020-02-24  Chris Dumez  <cdumez@apple.com>
394
395         Document / DOMWindow objects get leaked on CNN.com due to CSSTransitions
396         https://bugs.webkit.org/show_bug.cgi?id=208145
397
398         Reviewed by Antoine Quint.
399
400         Break reference cycles using WeakPtr so that CSSTransitions can no longer cause whole document / DOM trees to
401         get leaked.
402
403         * animation/DocumentTimeline.cpp:
404         (WebCore::DocumentTimeline::DocumentTimeline):
405         * animation/DocumentTimeline.h:
406         * animation/KeyframeEffect.cpp:
407         (WebCore::KeyframeEffect::KeyframeEffect):
408         (WebCore::KeyframeEffect::setTarget):
409         * animation/KeyframeEffect.h:
410
411 2020-02-24  Youenn Fablet  <youenn@apple.com>
412
413         Add a runtime flag dedicated to WebRTC codecs in GPUProcess
414         https://bugs.webkit.org/show_bug.cgi?id=208136
415
416         Reviewed by Alex Christensen.
417
418         Add a runtime flag for WebRTC codecs in GPUProcess.
419         Enable the flag by default for MacOS.
420
421         * page/RuntimeEnabledFeatures.h:
422         (WebCore::RuntimeEnabledFeatures::webRTCPlatformCodecsInGPUProcessEnabled const):
423         (WebCore::RuntimeEnabledFeatures::setWebRTCPlatformCodecsInGPUProcessEnabled):
424         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
425         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
426         * testing/Internals.cpp:
427         (WebCore::Internals::resetToConsistentState):
428         (WebCore::Internals::setUseGPUProcessForWebRTC):
429
430 2020-02-24  Simon Fraser  <simon.fraser@apple.com>
431
432         Remove geometry information from the scrolling tree
433         https://bugs.webkit.org/show_bug.cgi?id=208085
434
435         Reviewed by Sam Weinig.
436
437         The scrolling tree doesn't have enough information to do hit-testing because it has
438         no representation of layers that overlap scrollers. We'll have to do hit-testing another
439         way, so remove hit-testing-geometry data from the scrolling tree.
440
441         * page/scrolling/AsyncScrollingCoordinator.cpp:
442         (WebCore::AsyncScrollingCoordinator::setRectRelativeToParentNode): Deleted.
443         * page/scrolling/AsyncScrollingCoordinator.h:
444         * page/scrolling/ScrollingCoordinator.h:
445         (WebCore::ScrollingCoordinator::setRectRelativeToParentNode): Deleted.
446         * page/scrolling/ScrollingStateFrameHostingNode.cpp:
447         (WebCore::ScrollingStateFrameHostingNode::ScrollingStateFrameHostingNode):
448         (WebCore::ScrollingStateFrameHostingNode::dumpProperties const):
449         (WebCore::ScrollingStateFrameHostingNode::setPropertyChangedBitsAfterReattach): Deleted.
450         (WebCore::ScrollingStateFrameHostingNode::setParentRelativeScrollableRect): Deleted.
451         * page/scrolling/ScrollingStateFrameHostingNode.h:
452         * page/scrolling/ScrollingStateScrollingNode.cpp:
453         (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
454         (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach):
455         (WebCore::ScrollingStateScrollingNode::dumpProperties const):
456         (WebCore::ScrollingStateScrollingNode::setParentRelativeScrollableRect): Deleted.
457         * page/scrolling/ScrollingStateScrollingNode.h:
458         (WebCore::ScrollingStateScrollingNode::parentRelativeScrollableRect const): Deleted.
459         * page/scrolling/ScrollingTree.cpp:
460         (WebCore::ScrollingTree::handleWheelEvent):
461         (WebCore::ScrollingTree::scrollingNodeForPoint):
462         * page/scrolling/ScrollingTree.h:
463         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
464         (WebCore::ScrollingTreeFrameHostingNode::commitStateBeforeChildren):
465         (WebCore::ScrollingTreeFrameHostingNode::dumpProperties const):
466         (WebCore::ScrollingTreeFrameHostingNode::parentToLocalPoint const): Deleted.
467         * page/scrolling/ScrollingTreeFrameHostingNode.h:
468         (WebCore::ScrollingTreeFrameHostingNode::parentRelativeScrollableRect const): Deleted.
469         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
470         (WebCore::ScrollingTreeFrameScrollingNode::parentToLocalPoint const): Deleted.
471         (WebCore::ScrollingTreeFrameScrollingNode::localToContentsPoint const): Deleted.
472         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
473         * page/scrolling/ScrollingTreeNode.cpp:
474         (WebCore::ScrollingTreeNode::ScrollingTreeNode):
475         (WebCore::ScrollingTreeNode::scrollingNodeForPoint const): Deleted.
476         * page/scrolling/ScrollingTreeNode.h:
477         (WebCore::ScrollingTreeNode::parentToLocalPoint const): Deleted.
478         (WebCore::ScrollingTreeNode::localToContentsPoint const): Deleted.
479         * page/scrolling/ScrollingTreeScrollingNode.cpp:
480         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
481         (WebCore::ScrollingTreeScrollingNode::dumpProperties const):
482         (WebCore::ScrollingTreeScrollingNode::parentToLocalPoint const): Deleted.
483         (WebCore::ScrollingTreeScrollingNode::localToContentsPoint const): Deleted.
484         (WebCore::ScrollingTreeScrollingNode::scrollingNodeForPoint const): Deleted.
485         * page/scrolling/ScrollingTreeScrollingNode.h:
486         * rendering/RenderLayerCompositor.cpp:
487         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
488         (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole):
489         (WebCore::RenderLayerCompositor::rootParentRelativeScrollableRect const): Deleted.
490         * rendering/RenderLayerCompositor.h:
491
492 2020-02-24  Alex Christensen  <achristensen@webkit.org>
493
494         WKWebViewConfiguration._corsDisablingPatterns should also disable CORS for non-DocumentThreadableLoader loading
495         https://bugs.webkit.org/show_bug.cgi?id=208035
496         <rdar://problem/58011337>
497
498         Reviewed by Tim Hatcher.
499
500         Covered by an API test.
501
502         * loader/CrossOriginAccessControl.cpp:
503         (WebCore::createPotentialAccessControlRequest):
504
505 2020-02-24  Zalan Bujtas  <zalan@apple.com>
506
507         [LFC][IFC] Remove redundant trailing line break handling.
508         https://bugs.webkit.org/show_bug.cgi?id=208108
509         <rdar://problem/59708620>
510
511         Reviewed by Antti Koivisto.
512
513         LineLayoutContext::layoutLine should be able to handle both cases of trailing line breaks.
514         (This patch also makes tryAddingInlineItems return explicit IsEndOfLine values.)
515
516         * layout/inlineformatting/LineLayoutContext.cpp:
517         (WebCore::Layout::LineLayoutContext::layoutLine):
518         (WebCore::Layout::LineLayoutContext::tryAddingInlineItems):
519
520 2020-02-24  Zalan Bujtas  <zalan@apple.com>
521
522         [LFC][IFC][Floats] Move float handling out of LineBreaker
523         https://bugs.webkit.org/show_bug.cgi?id=208107
524         <rdar://problem/59708575>
525
526         Reviewed by Antti Koivisto.
527
528         LineBreaker should only deal with inline content.
529
530         * layout/inlineformatting/InlineLineBreaker.cpp:
531         (WebCore::Layout::LineBreaker::shouldWrapFloatBox): Deleted.
532         * layout/inlineformatting/InlineLineBreaker.h:
533         * layout/inlineformatting/LineLayoutContext.cpp:
534         (WebCore::Layout::LineLayoutContext::tryAddingFloatItem):
535
536 2020-02-24  Antoine Quint  <graouts@webkit.org>
537
538         RenderLayerBacking::notifyAnimationStarted calls directly into the old animation controller
539         https://bugs.webkit.org/show_bug.cgi?id=207979
540
541         Reviewed by Simon Fraser.
542
543         Only call into CSSAnimationController if the "Web Animations for CSS Animations" flag is disabled.
544
545         * rendering/RenderLayerBacking.cpp:
546         (WebCore::RenderLayerBacking::notifyAnimationStarted):
547
548 2020-02-24  Rob Buis  <rbuis@igalia.com>
549
550         Handle page closure for stale-while-revalidate revalidations
551         https://bugs.webkit.org/show_bug.cgi?id=204147
552
553         Reviewed by Youenn Fablet.
554
555         Add a new hook to LoaderStrategy to signal browsing context removal
556         and call it when the main frame stops all loaders.
557
558         Test: imported/w3c/web-platform-tests/fetch/stale-while-revalidate/frame-removal.html
559
560         * loader/FrameLoader.cpp:
561         (WebCore::FrameLoader::stopAllLoaders):
562         * loader/LoaderStrategy.h:
563         * loader/cache/CachedResource.cpp:
564         (WebCore::CachedResource::canUseCacheValidator const):
565
566 2020-02-24  Andres Gonzalez  <andresg_22@apple.com>
567
568         Fix for build: follow up to bug 208074.
569         https://bugs.webkit.org/show_bug.cgi?id=208133
570
571         Unreviewed build fix.
572
573         No new tests needed.
574
575         * accessibility/isolatedtree/AXIsolatedObject.cpp:
576         (WebCore::AXIsolatedObject::cellForColumnAndRow):
577
578 2020-02-24  Philippe Normand  <pnormand@igalia.com>
579
580         [GStreamer][WPE] Add GstGLMemoryEGL support for the video-plane-display
581         https://bugs.webkit.org/show_bug.cgi?id=208046
582
583         Reviewed by Žan Doberšek.
584
585         The glupload element might fill EGL memories in some cases, so for
586         the video sink we can then directly access the corresponding
587         EGLImage and export it to DMABuf, instead of using the more
588         general GLMemory code path.
589
590         With this patch we also ensure that both DMABuf FD and stride are valid.
591
592         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
593         (WebCore::GstVideoFrameHolder::GstVideoFrameHolder):
594         (WebCore::GstVideoFrameHolder::handoffVideoDmaBuf):
595
596 2020-02-23  Andres Gonzalez  <andresg_22@apple.com>
597
598         AXIsolatedObject support for tables.
599         https://bugs.webkit.org/show_bug.cgi?id=208074
600
601         Reviewed by Chris Fleizach.
602
603         Covered by existing tests.
604
605         AccessibilityObjectWrapper code and some utility functions in
606         AccessibilityObject.cpp assume that AX objects can be downcast to a
607         specialized subclass like AccessibilityTable. That is not true for
608         AXIsolatedObjects, and the reason why tables don’t work in IsolatedTree
609         mode.
610
611         To solve this problem, this patch exposes the AccessibilityTable
612         interface as part of the AXCoreObject. Thus it eliminates the need to
613         downcast an AX object to an AccessibilityTable. It also implements the
614         AccessibilityTable interface in the AXIsolatedObject class. The same
615         approach will be used in subsequent patches for other specialized
616         interfaces used by client code.
617
618         * accessibility/AccessibilityARIAGrid.cpp:
619         (WebCore::AccessibilityARIAGrid::addChildren):
620         * accessibility/AccessibilityARIAGrid.h:
621         * accessibility/AccessibilityARIAGridCell.cpp:
622         (WebCore::AccessibilityARIAGridCell::parentTable const):
623         (WebCore::AccessibilityARIAGridCell::rowIndexRange const):
624         (WebCore::AccessibilityARIAGridCell::columnIndexRange const):
625         * accessibility/AccessibilityARIAGridRow.cpp:
626         (WebCore::AccessibilityARIAGridRow::disclosedRows):
627         (WebCore::AccessibilityARIAGridRow::disclosedByRow const):
628         (WebCore::AccessibilityARIAGridRow::parentTable const):
629         * accessibility/AccessibilityNodeObject.cpp:
630         (WebCore::shouldUseAccessibilityObjectInnerText):
631         * accessibility/AccessibilityObject.cpp:
632         (WebCore::appendChildrenToArray): Use AXCoreObject interface instead of downcasting.
633         (WebCore::Accessibility::isAccessibilityObjectSearchMatchAtIndex): Use AXCoreObject interface instead of downcasting.
634         * accessibility/AccessibilityObject.h:
635         * accessibility/AccessibilityObjectInterface.h: AXCoreObject now exposes the table interface.
636         * accessibility/AccessibilityRenderObject.cpp:
637         (WebCore::AccessibilityRenderObject::ariaSelectedRows):
638         * accessibility/AccessibilityTable.cpp:
639         (WebCore::AccessibilityTable::AccessibilityTable):
640         (WebCore::AccessibilityTable::init):
641         (WebCore::AccessibilityTable::isExposable const):
642         (WebCore::AccessibilityTable::addChildren):
643         (WebCore::AccessibilityTable::headerContainer): Returns an AXCoreObject.
644
645         The following methods now return a vector of objects instead of taking
646         and out parameter. RVO guaranties that this does not cause extra copy.
647         (WebCore::AccessibilityTable::columns):
648         (WebCore::AccessibilityTable::rows):
649         (WebCore::AccessibilityTable::columnHeaders):
650         (WebCore::AccessibilityTable::rowHeaders):
651         (WebCore::AccessibilityTable::visibleRows):
652         (WebCore::AccessibilityTable::cells):
653
654         (WebCore::AccessibilityTable::tableLevel const):
655         (WebCore::AccessibilityTable::roleValue const):
656         (WebCore::AccessibilityTable::computeAccessibilityIsIgnored const):
657         (WebCore::AccessibilityTable::title const):
658         (WebCore::AccessibilityTable::isExposableThroughAccessibility const): Renamed to just isExposable.
659         * accessibility/AccessibilityTable.h:
660         (WebCore::AccessibilityTable::supportsSelectedRows): Deleted.
661         * accessibility/AccessibilityTableCell.cpp:
662         (WebCore::AccessibilityTableCell::parentTable const):
663         (WebCore::AccessibilityTableCell::isTableCell const):
664         (WebCore::AccessibilityTableCell::columnHeaders):
665         (WebCore::AccessibilityTableCell::rowHeaders):
666         * accessibility/AccessibilityTableCell.h:
667         * accessibility/AccessibilityTableColumn.cpp:
668         (WebCore::AccessibilityTableColumn::headerObject):
669         (WebCore::AccessibilityTableColumn::addChildren):
670         * accessibility/AccessibilityTableHeaderContainer.cpp:
671         (WebCore::AccessibilityTableHeaderContainer::addChildren):
672         * accessibility/AccessibilityTableRow.cpp:
673         (WebCore::AccessibilityTableRow::isTableRow const):
674         (WebCore::AccessibilityTableRow::parentTable const):
675         * accessibility/atk/WebKitAccessible.cpp:
676         (webkitAccessibleGetAttributes):
677         * accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
678         (webkitAccessibleTableGetColumnHeader):
679         (webkitAccessibleTableGetRowHeader):
680         * accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp:
681         (webkitAccessibleTableCellGetColumnHeaderCells):
682         (webkitAccessibleTableCellGetRowHeaderCells):
683         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
684         (-[WebAccessibilityObjectWrapper tableParent]):
685         (-[WebAccessibilityObjectWrapper accessibilityHeaderElements]):
686         * accessibility/isolatedtree/AXIsolatedObject.cpp:
687         (WebCore::AXIsolatedObject::initializeAttributeData):
688         (WebCore::AXIsolatedObject::setObjectVectorProperty):
689         (WebCore::AXIsolatedObject::cellForColumnAndRow):
690         (WebCore::AXIsolatedObject::fillChildrenVectorForProperty const):
691         (WebCore::AXIsolatedObject::isAccessibilityTableInstance const):
692         (WebCore::AXIsolatedObject::isDataTable const): Deleted.
693         * accessibility/isolatedtree/AXIsolatedObject.h:
694         * accessibility/isolatedtree/AXIsolatedTree.cpp:
695         (WebCore::AXIsolatedTree::nodeForID const):
696         (WebCore::AXIsolatedTree::objectsForIDs const):
697         * accessibility/isolatedtree/AXIsolatedTree.h:
698         * accessibility/mac/AXObjectCacheMac.mm:
699         (WebCore::AXObjectCache::postPlatformNotification):
700         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
701         In addition to replacing the downcast to AccessibilityTable, cleaned up
702         the unnecessary calls to self.axBackingObject. This used to be a macro,
703         but it is now a method that check for the execution thread and returns
704         the appropriate AX object.
705         (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
706         (-[WebAccessibilityObjectWrapper ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
707         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
708         (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
709         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
710
711 2020-02-23  Adrian Perez de Castro  <aperez@igalia.com>
712
713         Non-unified build fixes late February 2020 edition
714         https://bugs.webkit.org/show_bug.cgi?id=208111
715
716         Unreviewed build fix.
717
718         No new tests needed.
719
720         * dom/WindowEventLoop.cpp: Add missing include.
721         * html/HTMLEmbedElement.cpp: Ditto.
722         * html/HTMLFrameSetElement.cpp: Ditto.
723         * html/HTMLOptionElement.cpp: Ditto.
724         * html/HTMLTablePartElement.cpp: Ditto.
725         * html/HTMLTextFormControlElement.cpp: Ditto.
726         * html/RangeInputType.cpp: Ditto.
727         * inspector/agents/InspectorCSSAgent.cpp: Ditto.
728         * loader/ImageLoader.h: Add missing forward declration for WebCore::Document.
729         * platform/graphics/ImageBuffer.cpp: Add missing include.
730         * platform/graphics/filters/FilterEffect.cpp: Ditto.
731         * platform/wpe/ThemeWPE.h: Add missing include and forward declaration for WebCore::Path.
732         * svg/graphics/filters/SVGFilterBuilder.cpp: Add missing include.
733
734 2020-02-23  Darin Adler  <darin@apple.com>
735
736         Follow up element iterator work by reducing includes and using is<> in a few more places
737         https://bugs.webkit.org/show_bug.cgi?id=207816
738
739         Reviewed by Antti Koivisto.
740
741         * accessibility/AccessibilityTableColumn.cpp: Removed unneeded includes.
742         * bindings/js/JSDOMWindowCustom.cpp: Ditto.
743         * dom/CustomElementRegistry.cpp: Ditto.
744         * dom/Node.cpp: Ditto.
745         * editing/markup.cpp: Ditto.
746         * html/GenericCachedHTMLCollection.cpp: Ditto.
747         * html/HTMLCollection.cpp: Ditto.
748         * html/HTMLFrameSetElement.cpp: Ditto.
749         * html/track/TextTrackCue.cpp: Ditto.
750         * page/scrolling/AxisScrollSnapOffsets.cpp: Ditto.
751
752         * platform/DataListSuggestionsClient.h: Reduced includes, use forward declarations.
753
754         * style/StyleResolver.cpp:
755         (WebCore::Style::isAtShadowBoundary): Use the is<ShadowRoot> function.
756
757         * rendering/svg/RenderSVGResourceClipper.cpp:
758         (WebCore::RenderSVGResourceClipper::pathOnlyClipping): Use is<RenderSVGText> and
759         is<SVGGraphicsElement>, tweak coding style a tiny bit, and fix wording of comments.
760
761         * svg/SVGAElement.cpp:
762         (WebCore::SVGAElement::createElementRenderer): Use is<SVGElement>.
763
764         * svg/SVGElement.cpp: Removed unneeded includes.
765         (WebCore::SVGElement::isOutermostSVGSVGElement): Use is<SVGElement> and
766         is<SVGForeignObjectElement>.
767         (WebCore::SVGElement::reportAttributeParsingError): Use is<SVGElement>.
768         (WebCore::SVGElement::updateRelativeLengthsInformation): Use
769         is<SVGGraphicsElement> and is<SVGElement>, and use an if statement instead of
770         a while loop since this doesn't loop.
771
772 2020-02-22  Darin Adler  <darin@apple.com>
773
774         Fix HTMLDataListElement.options to include even options that are not suggestions
775         https://bugs.webkit.org/show_bug.cgi?id=208102
776
777         Reviewed by Antti Koivisto.
778
779         * html/ColorInputType.cpp:
780         (WebCore::ColorInputType::suggestedColors const): Use
781         HTMLDataListElement::suggestions instead of HTMLCollection, both for efficiency
782         and for correctness.
783
784         * html/GenericCachedHTMLCollection.cpp:
785         (WebCore::GenericCachedHTMLCollection<traversalType>::elementMatches const):
786         Removed code to filter out options that are not valid suggestions. This is not
787         called for in the HTML specification.
788
789         * html/HTMLDataListElement.cpp:
790         (WebCore::HTMLDataListElement::isSuggestion): Added.
791
792         * html/HTMLDataListElement.h: Added isSuggestion and suggestions functions so
793         logic about which datalist options are suggestions can be easily shared. The
794         suggestions uses the new filteredDescendants function template.
795
796         * html/HTMLInputElement.cpp:
797         (WebCore::HTMLInputElement::setupDateTimeChooserParameters): Use
798         HTMLDataListElement::suggestions instead of HTMLCollection.
799
800         * html/TextFieldInputType.cpp:
801         (WebCore::TextFieldInputType::suggestions):  Use
802         HTMLDataListElement::suggestions instead of HTMLCollection. Also added a FIXME
803         since this implementation uses case-insensitive ASCII but it's for user interface
804         and the current implementation might be insufficient for some lanagues.
805
806         * rendering/RenderTheme.cpp:
807         (WebCore::RenderTheme::paintSliderTicks): Use
808         HTMLDataListElement::suggestions instead of HTMLCollection.
809
810 2020-02-22  Darin Adler  <darin@apple.com>
811
812         Refine the DOM element iterator implementation
813         https://bugs.webkit.org/show_bug.cgi?id=208100
814
815         Reviewed by Antti Koivisto.
816
817         - Removed the duplicate descendant iterator, keeping the one that matches
818           the style of the ancestor and child iterators.
819         - Removed the non-template elementAncestors, elementChildren, elementDescendants,
820           and elementLineage functions and changed callers to use xxxOfType<Element> instead.
821         - Renamed "IteratorAdapter" templates to "Range", choosing that term to match the
822           upcoming C++20 Ranges library and range-based for loops.
823         - Changed the iterators to use an actual "nullptr" for end, following the "sentinel"
824           design pattern from the Ranges library. Still kept a tiny bit of using an iterator
825           for end around, only so we can use iterator library functions like std::distance
826           while waiting for std::ranges::distance, which is compatible with sentinels.
827         - Implemented const correctness by using const types instead of separate "Const"
828           class templates. This cut down on source code size a lot. These element iterators
829           don't need whole separate templates to implement the const correctness the way
830           collection classes like HashMap do.
831         - Improved some other details, like using more const and constexpr on members.
832           All the functions on a range are const, because the range itself doesn't ever
833           get modified, and all functions on an iterator are also const, because only
834           operations like ++ and -- actually modify the iterator.
835         - For now at least, removed extra code we don't need in practice. We never need to
836           compare iterators to each other except when iterating a range, for example, so
837           kept the != used for range iteration but not ==.
838         - Simplified the HTMLCollection implementations by taking advantage of the null-
839           based and sentinel designs. There are various places where we can write
840           simpler code and pass around fewer arguments.
841         - Added a new descendantsOfType template that takes a predicate and filters to only
842           the elements that match that predicate. Similar concept to how we implement HTML
843           collections, and possibly could be used even more eventually.
844         - Use std::iterator in ElementIterator so we don't need to do that in derived
845           classes. Also made more of ElementIterator protected to make it more explicit
846           that it's an abstract class template and not something to be used directly.
847
848         The most unusual clients of the elmeent ranges and iterators are HTMLCollection and
849         the related caches, and this patch includes changes to those to adopt the new model.
850
851         * Headers.cmake: Removed ElementDescendantIterator.h.
852         * WebCore.xcodeproj/project.pbxproj: Ditto.
853
854         * dom/ChildNodeList.cpp:
855         (WebCore::ChildNodeList::ChildNodeList): Removed initialization of m_indexCache
856         since the constructor no longer requires arguments.
857         (WebCore::ChildNodeList::invalidateCache): Removed argument to
858         CollectionIndexCache::invalidate.
859         * dom/ChildNodeList.h: Removed collectionEnd, since it's no longer needed.
860
861         * dom/CollectionIndexCache.h: Removed the collection argument to the
862         constructor, hasValidCache, and invalidate functions. Updated algorithms to use
863         null style termination instead of actually relying on comparing with an end
864         iterator, since that works for our element iterators.
865
866         * dom/ContainerNode.cpp:
867         (WebCore::ContainerNode::childElementCount const):: Use an empty initializer
868         list instead of the result of the end function since std::distance requires
869         both begin and end iterators have the same type.
870
871         * dom/ElementAncestorIterator.h: Made the changes mentioned above, plus moved the
872         declarations of functions to the top of the file, since the classes are
873         implementation details, used downcast instead of static_cast.
874
875         * dom/ElementAndTextDescendantIterator.h: Renamed IteratorAdapter to Range,
876         mostly didn't make other changes since this is not one of the element iterators.
877
878         * dom/ElementChildIterator.h: Made the changes mentioned above, plus moved the
879         declarations of functions to the top of the file, since the classes are
880         implementation details.
881
882         * dom/ElementDescendantIterator.h: Removed.
883
884         * dom/ElementIterator.h: Made the changes mentioned above.
885
886         * dom/LiveNodeList.cpp: Removed some unneeded includes, including HTMLCollection.h.
887         (WebCore::LiveNodeList::LiveNodeList): Simplified a little bit.
888         (WebCore::LiveNodeList::rootNode): Moved to the header.
889
890         * dom/LiveNodeList.h: Updated since CollectionTraversal now uses the
891         more modern ElementDescendantIterator, not the older one that used a vector of
892         ancestors to do the iteration. Also use WTF_MAKE_ISO_NONALLOCATABLE since
893         LiveNodeList is an abstract class, and made some members protected. Removed
894         CachedLiveNodeList::rootNode since it was identical to LiveNodeList::rootNode,
895         and made LiveNodeList::rootNode protected so it can be called in
896         CachedLiveNodeList, and moved it to the header so it will still be inlined.
897         Simplified CachedListNodeList to use more final, to name long types less by
898         using "auto" and "using", and to not pass arguments to functions that don't
899         need them any more.
900
901         * dom/NameNodeList.cpp:
902         (WebCore::NameNodeList::create): Moved here from the header.
903         * dom/NameNodeList.h: Removed unneeded includes and comment, moved create
904         function out of the header.
905
906         * dom/TypedElementDescendantIterator.h: Made all the change mentioned above.
907         Also added a new filteredDescendants function, range, and iterator that uses
908         a filter function. Not used yet in this patch; use comes in a future one.
909
910         * html/CachedHTMLCollection.h: Updated includes, shortened type names,
911         and used auto to simplify the code a bit. Removed unneeded collection arguments
912         from various CollectionIndexCache functions.
913
914         * html/CollectionTraversal.h: Updated to use the new/typed version of
915         ElementDescendantIterator. Removed end functions. Use shorter type names.
916         Tweaked algorithms to use null termination for loops instead of end iterators.
917
918         * html/HTMLFormControlsCollection.h:
919         (WebCore::HTMLFormControlsCollection::item const): Removed unneeded class
920         template arguments.
921
922         * html/HTMLFormElement.cpp:
923         (WebCore::HTMLFormElement::formElementIndex): Changed to use the null check
924         instead of comparing iterator with end.
925         * html/HTMLMediaElement.cpp:
926         (WebCore::HTMLMediaElement::selectNextSourceChild): Ditto.
927
928         * html/HTMLTableSectionElement.cpp:
929         (WebCore::HTMLTableSectionElement::numRows const): Pass a default-constructed
930         iterator for end to std::distance. When we get C++20 we can clean this up by
931         using std::ranges::distances instead.
932
933         * html/LabelsNodeList.cpp:
934         (WebCore::LabelsNodeList::create): Moved here from the header.
935         * html/LabelsNodeList.h: Removed unneeded include, tweaked coding style a bit,
936         moved create function into the .cpp file.
937
938         * html/RadioNodeList.cpp: Removed unneeded include.
939         (WebCore::RadioNodeList::create): Moved this here from the header.
940         (WebCore::nonEmptyRadioButton): Renamed from toRadioButtonInputElement to make
941         a little clearer what the function does.
942         (WebCore::RadioNodeList::value const): Updated to use nonEmptyRadioButton and
943         straighten out the loop a tiny bit.
944         (WebCore::RadioNodeList::setValue): Ditto.
945         (WebCore::RadioNodeList::checkElementMatchesRadioNodeListFilter const): Deleted.
946         (WebCore::RadioNodeList::elementMatches const): Merged in the logic from
947         checkElementMatchesRadioNodeListFilter, since the separate function wasn't helpful.
948
949         * html/RadioNodeList.h: Removed unneeded includes. Moved the create function out
950         of the header. Removed unneeded override of the item function to tighten the
951         return type; not used in WebCore and not helpful for bindings. Made more private.
952
953         * style/StyleInvalidator.cpp:
954         (WebCore::Style::Invalidator::invalidateStyleForDescendants): Use null checking
955         style for the loop rather than comparing with end.
956         (WebCore::Style::Invalidator::invalidateStyleWithMatchElement): Remove an unneeded
957         local variable and braces.
958
959         * svg/SVGUseElement.cpp:
960         (WebCore::removeDisallowedElementsFromSubtree): Use null checking style rather than
961         comparing with end.
962         (WebCore::SVGUseElement::expandUseElementsInShadowTree const): Ditto. Also use
963         dropAssertions rather than assigning to end with a comment saying it drops assertions.
964         (WebCore::SVGUseElement::expandSymbolElementsInShadowTree const): Ditto.
965
966 2020-02-22  Darin Adler  <darin@apple.com>
967
968         Put more of the datalist element implementation inside ENABLE(DATALIST_ELEMENT)
969         https://bugs.webkit.org/show_bug.cgi?id=208098
970
971         Reviewed by Antti Koivisto.
972
973         * html/HTMLFormControlElement.cpp:
974         (WebCore::HTMLFormControlElement::computeWillValidate const): Use
975         ancestorsOfType instead of a loop. Since this involves using the class
976         HTMLDataListElement, it's only implemented when ENABLE(DATALIST_ELEMENT)
977         is true. The old code would always do this validation for elements with
978         the datalist tag even if the element is not implemented, so this changes
979         behavior and affects some test results.
980
981 2020-02-22  Jer Noble  <jer.noble@apple.com>
982
983         Stop using QTKit for rendering WK1 video fullscreen controls
984         https://bugs.webkit.org/show_bug.cgi?id=207795
985         <rdar://problem/48894915>
986
987         Reviewed by Jon Lee.
988
989         Drive-by fixes:
990
991         - Don't set the video layer to not-visible when in video fullscreen mode.
992         - Export previously un-exported methods.
993         - Make some ios-only classes available on mac.
994         - Add a couple previously unimplemented properties to WebAVPlayerController needed by AVKit.
995         - WebCoreFullscreenWindow doesn't depend on FULLSCREEN_API.
996
997         * WebCore.xcodeproj/project.pbxproj:
998         * html/HTMLMediaElement.cpp:
999         (WebCore::HTMLMediaElement::visibilityStateChanged):
1000         * html/HTMLMediaElement.h:
1001         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
1002         * platform/ios/PlaybackSessionInterfaceAVKit.h:
1003         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
1004         (WebCore::PlaybackSessionInterfaceAVKit::externalPlaybackChanged):
1005         * platform/ios/WebAVPlayerController.h:
1006         * platform/ios/WebAVPlayerController.mm:
1007         (-[WebAVPlayerController canSeekFrameBackward]):
1008         (-[WebAVPlayerController canSeekFrameForward]):
1009         * platform/mac/WebCoreFullScreenWindow.h:
1010         * platform/mac/WebCoreFullScreenWindow.mm:
1011
1012 2020-02-22  Darin Adler  <darin@apple.com>
1013
1014         Use DOM element iterators more, and more consistently
1015         https://bugs.webkit.org/show_bug.cgi?id=208097
1016
1017         Reviewed by Antti Koivisto.
1018
1019         - Added uses of element iterators in many places that had hand-written loops.
1020         - Eliminated most uses of elementAncestors, elementChildren, elementDescendants,
1021           and elementLineage functions and use ancestorsOfType<Element>,
1022           childrenOfType<Element>, descendantsOfType<Element> and lineageOfType<Element>
1023           instead. In particular, descendantsOfType<Element> uses a better traversal
1024           algorithm than elementDescendants does.
1025
1026         - Unrelated: Omit template arguments in various cases where the C++ language lets
1027           us just give the name of the class template without repeating the arguments.
1028         - Unrelated: Remove some uses of the inefficient Node::nodeType function.
1029
1030         * accessibility/AccessibilityNodeObject.cpp:
1031         (WebCore::AccessibilityNodeObject::mouseButtonListener const): Use
1032         lineageOfType instead of elementLineage.
1033
1034         * accessibility/AccessibilityRenderObject.cpp:
1035         (WebCore::AccessibilityRenderObject::accessibilityImageMapHitTest const):
1036         Use ancestorsOfType instead of a handwritten loop.
1037
1038         * dom/AllDescendantsCollection.h:
1039         (WebCore::AllDescendantsCollection::AllDescendantsCollection): Removed
1040         class template arguments.
1041         * dom/ClassCollection.h:
1042         (WebCore::ClassCollection::ClassCollection): Ditto.
1043
1044         * dom/DocumentFragment.cpp:
1045         (WebCore::DocumentFragment::getElementById const): Use
1046         descendantsOfType insteadof elementDescendants.
1047
1048         * dom/Element.cpp:
1049         (WebCore::Element::computeInheritedLanguage const): Use lineageOfType
1050         instead of a handrwitten loop.
1051
1052         * dom/SelectorQuery.cpp:
1053         (WebCore::SelectorDataList::closest const): Use lineageOfType instead of an
1054         explicit loop.
1055         (WebCore::elementsForLocalName): Use descendantsOfType instead of elementDescendants.
1056         (WebCore::anyElement): Ditto.
1057         (WebCore::SelectorDataList::executeSingleTagNameSelectorData const): Ditto.
1058         (WebCore::SelectorDataList::executeSingleClassNameSelectorData const): Ditto.
1059         (WebCore::SelectorDataList::executeSingleSelectorData const): Ditto.
1060         (WebCore::SelectorDataList::executeSingleMultiSelectorData const): Ditto.
1061         (WebCore::SelectorDataList::executeCompiledSimpleSelectorChecker const): Ditto.
1062         (WebCore::SelectorDataList::executeCompiledSelectorCheckerWithCheckingContext const): Ditto.
1063         (WebCore::SelectorDataList::executeCompiledSingleMultiSelectorData const): Ditto.
1064
1065         * dom/TagCollection.cpp:
1066         (WebCore::TagCollectionNS::TagCollectionNS): Removed class template arguments.
1067         (WebCore::TagCollection::TagCollection): Ditto.
1068         (WebCore::HTMLTagCollection::HTMLTagCollection): Ditto.
1069
1070         * editing/Editor.cpp:
1071         (WebCore::Editor::applyEditingStyleToBodyElement const): Use the function
1072         descendantsOfType<HTMLBodyElement> instead of getElementByTagName(bodyTag).
1073         Also merged applyEditingStyleToElement in here.
1074         (WebCore::Editor::applyEditingStyleToElement const): Deleted.
1075
1076         * editing/Editor.h: Deleted applyEditingStyleToElement.
1077
1078         * editing/FrameSelection.cpp:
1079         (WebCore::scanForForm): Cleaned up descendantsOfType loop so there's no
1080         explicit use of end. Also changed if nesting a little bit.
1081
1082         * editing/TextManipulationController.cpp:
1083         (WebCore::ExclusionRuleMatcher::isExcluded): Use lineageOfType instead of
1084         elementLineage.
1085
1086         * html/HTMLAllCollection.h: Removed class template arguments.
1087
1088         * html/HTMLElement.cpp:
1089         (WebCore::elementAffectsDirectionality): Refactored so we get a more efficient
1090         implementation when the type of the element is known.
1091         (WebCore::HTMLElement::adjustDirectionalityIfNeededAfterChildAttributeChanged):
1092         Use lineageOfType instead of elementLineage.
1093
1094         * html/HTMLElement.h: Removed some uneeeded forward declarations.
1095
1096         * html/HTMLEmbedElement.cpp:
1097         (WebCore::findWidgetRenderer): Use ancestorsOfType instead of a loop.
1098
1099         * html/HTMLFormControlElement.cpp:
1100         (WebCore::HTMLFormControlElement::enclosingFormControlElement): Deleted.
1101
1102         * html/HTMLFormControlElement.h: Deleted unused enclosingFormControlElement.
1103
1104         * html/HTMLFormControlsCollection.cpp:
1105         (WebCore::HTMLFormControlsCollection::HTMLFormControlsCollection): Removed
1106         class template arguments.
1107         (WebCore::HTMLFormControlsCollection::ownerNode const): Ditto.
1108         (WebCore::HTMLFormControlsCollection::invalidateCacheForDocument): Ditto.
1109
1110         * html/HTMLOptGroupElement.cpp:
1111         (WebCore::HTMLOptGroupElement::ownerSelectElement const): Use ancestorsOfType
1112         instead of a hand-written loop.
1113
1114         * html/HTMLOptionElement.cpp:
1115         (WebCore::HTMLOptionElement::parseAttribute): Use ancestorsOfType instead of
1116         calling ownerDataListElement.
1117         (WebCore::HTMLOptionElement::childrenChanged): Ditto.
1118         (WebCore::HTMLOptionElement::ownerDataListElement const): Deleted. Since the
1119         same option element can be used by multiple nested data list elements, the
1120         concept of a single "owner" data list element isn't correct.
1121         (WebCore::HTMLOptionElement::ownerSelectElement const): Use ancestorsOfType
1122         instead of a hand-written loop.
1123
1124         * html/HTMLOptionElement.h: Deleted ownerDataListElement.
1125
1126         * html/HTMLOptionsCollection.cpp:
1127         (WebCore::HTMLOptionsCollection::HTMLOptionsCollection): Removed class
1128         template arguments.
1129
1130         * html/HTMLTableCellElement.cpp:
1131         (WebCore::HTMLTableCellElement::additionalPresentationAttributeStyle const):
1132         Use auto since findParentTable now returns a const table pointer.
1133         * html/HTMLTableColElement.cpp:
1134         (WebCore::HTMLTableColElement::additionalPresentationAttributeStyle const):
1135         Ditto.
1136
1137         * html/HTMLTableElement.cpp:
1138         (WebCore::HTMLTableElement::createSharedCellStyle): Made const.
1139         (WebCore::HTMLTableElement::additionalCellStyle): Ditto.
1140         (WebCore::HTMLTableElement::additionalGroupStyle): Ditto.
1141
1142         * html/HTMLTableElement.h: Made the functions const, and m_sharedCellStyle
1143         mutable.
1144
1145         * html/HTMLTablePartElement.cpp:
1146         (WebCore::HTMLTablePartElement::findParentTable const): Use ancestorsOfType
1147         instead of a hand-written loop. Also revised return type to be const-consistent.
1148
1149         * html/HTMLTablePartElement.h: Updated return type.
1150
1151         * html/HTMLTableRowsCollection.cpp:
1152         (WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection): Removed class
1153         template arguments.
1154
1155         * html/HTMLTextFormControlElement.cpp:
1156         (WebCore::parentHTMLElement): Deleted.
1157         (WebCore::HTMLTextFormControlElement::directionForFormData const): Use
1158         lineageOfType rather than a hand-written loop. Also got rid of the multiple
1159         strings in return paths since the function always returns one of two strings.
1160
1161         * inspector/InspectorAuditAccessibilityObject.cpp:
1162         (WebCore::InspectorAuditAccessibilityObject::getElementsByComputedRole):
1163         Use descendantsOfType instead of elementDescendants.
1164
1165         * inspector/agents/InspectorCSSAgent.cpp:
1166         (WebCore::InspectorCSSAgent::getMatchedStylesForNode): Use ancestorsOfType
1167         instead of a hand-written loop.
1168
1169         * inspector/agents/InspectorDOMAgent.cpp:
1170         (WebCore::InspectorDOMAgent::inspect): Use isElementNode and isDocumentNode
1171         instead of the much slower nodeType.
1172         (WebCore::InspectorDOMAgent::highlightMousedOverNode): Use isTextNode instead of
1173         the much slower nodeType.
1174
1175         * page/DragController.cpp:
1176         (WebCore::containingLinkElement): Added. Uses lineageOfType instead of elementLineage.
1177         (WebCore::DragController::doSystemDrag): Updated for the above.
1178
1179         * rendering/svg/SVGRenderSupport.cpp:
1180         (WebCore::SVGRenderSupport::updateMaskedAncestorShouldIsolateBlending):
1181         Use ancestorsOfType instead of a hand-written loop.
1182
1183         * svg/SVGElement.h: Make computedStyle public so we can use it even after downcasting
1184         to SVGElement or a class derived from it. This arises in the revised version of
1185         SVGRenderSupport::updateMaskedAncestorShouldIsolateBlending, which will now be able
1186         to compile a non-virtual call to the function as a bonus.
1187
1188         * xml/parser/XMLDocumentParser.cpp:
1189         (WebCore::findXMLParsingNamespaces): Factored this function out from
1190         parseDocumentFragment. Use lineageOfType instead of elementLineage. Also add a null
1191         check that seems to have been needed before.
1192         (WebCore::XMLDocumentParser::parseDocumentFragment): Use findXMLParsingNamespaces.
1193
1194 2020-02-22  Darin Adler  <darin@apple.com>
1195
1196         Some small improvements to DOM bindings for HTML collections
1197         https://bugs.webkit.org/show_bug.cgi?id=208092
1198
1199         Reviewed by Antti Koivisto.
1200
1201         * WebCore.xcodeproj/project.pbxproj: Added RadioNodeList.idl.
1202
1203         * html/HTMLAllCollection.idl: Specify [RequiresExistingAtomString] on the
1204         argument to namedItem, and [AtomString] for the argument to item.
1205         * html/HTMLCollection.idl: Ditto.
1206         * html/HTMLFormControlsCollection.idl: Ditto.
1207         * html/HTMLOptionsCollection.idl: Ditto.
1208         * html/HTMLSelectElement.idl: Ditto.
1209
1210         * html/RadioNodeList.idl: Removed unneeded getter; the inherited one from NodeList
1211         works correctly, and this isn't more efficient because of a more specific type.
1212
1213 2020-02-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1214
1215         Remove an unused local variable after r256808
1216         https://bugs.webkit.org/show_bug.cgi?id=208072
1217
1218         Reviewed by Chris Dumez.
1219
1220         Remove scriptsToExecuteSoon.
1221
1222         * dom/ScriptRunner.cpp:
1223         (WebCore::ScriptRunner::timerFired):
1224
1225 2020-02-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
1226
1227         Create a new ImageBuffer type for drawing on a DisplayList
1228         https://bugs.webkit.org/show_bug.cgi?id=207109
1229
1230         Reviewed by Simon Fraser.
1231
1232         DisplayList::ImageBuffer inherits ConcreteImageBuffer and DrawingContext.
1233         The drawing context will be the context of DrawingContext. The operations
1234         of ConcreteImageBuffer will have to ensure the recorded display-list is
1235         replayed back before getting the pixels of the ImageBufferBackend.
1236
1237         * Sources.txt:
1238         * WebCore.xcodeproj/project.pbxproj:
1239
1240         * html/HTMLCanvasElement.cpp:
1241         (WebCore::HTMLCanvasElement::createContext2d):
1242         (WebCore::HTMLCanvasElement::setUsesDisplayListDrawing):
1243         (WebCore::HTMLCanvasElement::setTracksDisplayListReplay):
1244         (WebCore::HTMLCanvasElement::displayListAsText const):
1245         (WebCore::HTMLCanvasElement::replayDisplayListAsText const):
1246         All the DisplayList operations will be routed to the DrawingContext of
1247         the ImageBuffer.
1248
1249         (WebCore::HTMLCanvasElement::createImageBuffer const):
1250         createImageBuffer() can decide the ImageBuffer type based on the settings
1251         and the size of the canvas.
1252
1253         * html/HTMLCanvasElement.h:
1254         * platform/graphics/ConcreteImageBuffer.h:
1255         (WebCore::ConcreteImageBuffer::create):
1256         The type of the ImageBuffer will be passed to this function such that
1257         it can create instances of derived classes.
1258
1259         * platform/graphics/ImageBuffer.cpp:
1260         (WebCore::ImageBuffer::create):
1261         Create ImageBuffers which record the drawing commands to DisplayLists before
1262         committing them to the back-ends.
1263
1264         * platform/graphics/ImageBuffer.h:
1265         (WebCore::ImageBuffer::drawingContext):
1266         (WebCore::ImageBuffer::flushDrawingContext):
1267         Add virtual methods to support DisplayList in ImageBuffer.
1268
1269         * platform/graphics/PlatformImageBuffer.h:
1270         * platform/graphics/RenderingMode.h:
1271         Add DisplayList types to RenderingMode and define platform types for
1272         DisplayList ImageBuffers.
1273
1274         * platform/graphics/displaylists/DisplayListDrawingContext.cpp: Added.
1275         (WebCore::DisplayList::DrawingContext::DrawingContext):
1276         (WebCore::DisplayList::DrawingContext::setTracksDisplayListReplay):
1277         (WebCore::DisplayList::DrawingContext::replayDisplayList):
1278         * platform/graphics/displaylists/DisplayListDrawingContext.h: Added.
1279         (WebCore::DisplayList::DrawingContext::context const):
1280         (WebCore::DisplayList::DrawingContext::displayList):
1281         (WebCore::DisplayList::DrawingContext::displayList const):
1282         (WebCore::DisplayList::DrawingContext::replayedDisplayList const):
1283         DisplayList::DrawingContext holds a recording and an optional replaying 
1284         back DisplayLists. It also provides a recording GraphicsContext.
1285
1286         * platform/graphics/displaylists/DisplayListImageBuffer.h: Added.
1287         (WebCore::DisplayList::ImageBuffer::create):
1288         (WebCore::DisplayList::ImageBuffer::ImageBuffer):
1289         (WebCore::DisplayList::ImageBuffer::~ImageBuffer):
1290         Drawing commands will be recorded first because context() is overridden
1291         to return the GraphicsContext of DrawingContext. These drawing commands
1292         will be flushed before getting the pixels of the back-end because 
1293         flushDrawingContext() is overridden to replay back the recorded DisplayList
1294         to the GraphicsContext of the back-end.
1295
1296 2020-02-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1297
1298         [macOS] Large form controls are rendered at the wrong NSControlSize
1299         https://bugs.webkit.org/show_bug.cgi?id=208043
1300         <rdar://problem/59659134>
1301
1302         Reviewed by Tim Horton.
1303
1304         When painting form controls that are larger than a certain threshold (for the most part, 21px), use
1305         NSControlSizeLarge instead of NSControlSizeRegular. This makes us choose a more appropriate appearance when
1306         painting native large form controls, as long as the system supports it. Note that not all the metrics for
1307         NSControlSizeLarge form controls are finalized, as noted in the per-method comments below.
1308
1309         With this patch alone, there is no change in behavior yet; in the near future, these changes will be covered by
1310         new platform-specific baselines.
1311
1312         * platform/PopupMenuStyle.h: Add a new PopupMenuSizeLarge that corresponds to a popup that has NSControlSizeLarge.
1313         * platform/mac/ThemeMac.h: Add a helper to check (at runtime) whether the new large form control size is enabled.
1314         * platform/mac/ThemeMac.mm:
1315         (WebCore::controlSizeForFont): Add a new font size breakpoint, for which we use NSControlSizeLarge instead of
1316         NSControlSizeRegular.
1317
1318         (WebCore::sizeFromNSControlSize):
1319         (WebCore::sizeFromFont):
1320         (WebCore::controlSizeFromPixelSize):
1321         (WebCore::setControlSize):
1322         (WebCore::checkboxSizes): Reflect the fact that checkboxes with NSControlSizeLarge are 16 by 16.
1323         (WebCore::checkboxMargins): Just match NSControlSizeRegular margins for now. These seem incorrect already, even
1324         for NSControlSizeRegular in macOS 10.15.
1325
1326         (WebCore::radioSizes): Reflect the fact that radio buttons with NSControlSizeLarge are 16 by 16, and
1327         NSControlSizeRegular radio buttons are 14 by 14.
1328
1329         (WebCore::radioMargins): Just match NSControlSizeRegular margins for now. These seem incorrect already, even for
1330         NSControlSizeRegular in macOS 10.15.
1331
1332         (WebCore::buttonSizes): Reflect the fact that buttons with NSControlSizeLarge are 28px tall.
1333         (WebCore::buttonMargins): Just match NSControlSizeRegular margins for now, and add a FIXME about updating them.
1334         (WebCore::setUpButtonCell):
1335         (WebCore::stepperSizes): NSControlSizeLarge matches NSControlSizeRegular at the moment.
1336         (WebCore::stepperControlSizeForFont): Add a new font size breakpoint for using NSControlSizeLarge.
1337         * rendering/RenderThemeMac.mm:
1338         (WebCore::RenderThemeMac::controlSizeForFont const):
1339         (WebCore::RenderThemeMac::controlSizeForCell const):
1340         (WebCore::RenderThemeMac::controlSizeForSystemFont const):
1341         (WebCore::RenderThemeMac::popupButtonMargins const):
1342         (WebCore::RenderThemeMac::popupButtonSizes const):
1343         (WebCore::RenderThemeMac::popupButtonPadding const):
1344
1345         NSControlSizeLarge metrics for popup buttons cannot be determined yet.
1346
1347         (WebCore::RenderThemeMac::progressBarSizes const):
1348         (WebCore::RenderThemeMac::progressBarMargins const):
1349         (WebCore::RenderThemeMac::paintProgressBar):
1350
1351         NSControlSizeLarge matches NSControlSizeRegular at the moment.
1352
1353         (WebCore::menuListButtonSizes):
1354         (WebCore::RenderThemeMac::popupMenuSize const):
1355         (WebCore::RenderThemeMac::menuListSizes const):
1356         (WebCore::RenderThemeMac::searchFieldSizes const):
1357         (WebCore::RenderThemeMac::cancelButtonSizes const):
1358         (WebCore::RenderThemeMac::resultsButtonSizes const):
1359
1360         Search field results and cancel buttons have the same size in NSControlSizeLarge as in NSControlSizeRegular.
1361
1362 2020-02-21  Michael Catanzaro  <mcatanzaro@gnome.org>
1363
1364         [WPE][GTK] googleapis.com is a public suffix, defeating isGoogle() check in UserAgentQuirks.cpp
1365         https://bugs.webkit.org/show_bug.cgi?id=207984
1366
1367         Reviewed by Daniel Bates.
1368
1369         Fix the check for googleapis.com. Since it's now a public suffix, we can no longer check the
1370         URL's base domain here. Instead, we can check endsWith().
1371
1372         I considered switching to endsWith() for all the checks in this file, to make our user agent
1373         quirks robust to future changes in the public suffix list, but checking the base domain is
1374         nicer and it seems unnecessary. We can continue to adjust our quirks in the future as
1375         necessary.
1376
1377         The public suffix list:
1378         https://github.com/publicsuffix/list/blob/7922d7c20e246552be418e8f72e577899fd30d99/public_suffix_list.dat#L11922
1379
1380         * platform/UserAgentQuirks.cpp:
1381         (WebCore::isGoogle):
1382
1383 2020-02-21  Simon Fraser  <simon.fraser@apple.com>
1384
1385         [Web Animations] Repeated animations on pseudo elements will fail to run after a while
1386         https://bugs.webkit.org/show_bug.cgi?id=207993
1387         <rdar://problem/59428472>
1388
1389         Reviewed by Zalan Bujtas.
1390
1391         We failed to clear PseudoElement* from AnimationTimeline's various HashMaps on destruction,
1392         causing animations to fail to run when those pointer addresses were reused.
1393
1394         Make DeclarativeAnimation::owningElement() be a WeakPtr<>.
1395
1396         Test: animations/many-pseudo-animations.html
1397
1398         * animation/AnimationTimeline.cpp:
1399         (WebCore::AnimationTimeline::willDestoryRendererForElement):
1400         (WebCore::AnimationTimeline::elementWasRemoved):
1401         * animation/AnimationTimeline.h:
1402         * animation/DeclarativeAnimation.cpp:
1403         (WebCore::DeclarativeAnimation::DeclarativeAnimation):
1404         (WebCore::DeclarativeAnimation::enqueueDOMEvent):
1405         * animation/DeclarativeAnimation.h:
1406         (WebCore::DeclarativeAnimation::owningElement const):
1407         * dom/Element.cpp:
1408         (WebCore::Element::removedFromAncestor):
1409         * dom/PseudoElement.cpp:
1410         (WebCore::PseudoElement::clearHostElement):
1411         * rendering/updating/RenderTreeUpdater.cpp:
1412         (WebCore::RenderTreeUpdater::tearDownRenderers):
1413
1414 2020-02-21  Lauro Moura  <lmoura@igalia.com>
1415
1416         [GStreamer] TextCombinerGStreamer is failing to compile with Gst1.14
1417         https://bugs.webkit.org/show_bug.cgi?id=208041
1418
1419         Reviewed by Xabier Rodriguez-Calvar.
1420
1421         Replace usage of gst_clear_object and gst_clear_tag_list with previous
1422         *_unref functions. The clear versions were added in 1.16 while Ubuntu
1423         18.04 (current LTS) and Debian stable uses 1.14.
1424
1425         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
1426         (webkitTextCombinerPadDispose):
1427
1428 2020-02-21  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1429
1430         Value sanitization for input[type=text] should not truncate a value at a control character
1431         https://bugs.webkit.org/show_bug.cgi?id=207900
1432
1433         Reviewed by Darin Adler.
1434
1435         Stop truncating value at a control character. The new behavior is compatible with Chrome and Firefox.
1436         Inspired on Chromium patch https://codereview.chromium.org/189843008
1437
1438         Covered by existing tests: affected layout tests are modified to reflect the new behaviour.
1439         This improves WPT pass-rate in around 49K new subtest passes for Japanesse encoding tests.
1440
1441         * html/TextFieldInputType.cpp:
1442         (WebCore::limitLength):
1443
1444 2020-02-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1445
1446         [WPE] Use custom theme style for media controls
1447         https://bugs.webkit.org/show_bug.cgi?id=208002
1448
1449         Reviewed by Adrian Perez de Castro.
1450
1451         Add mediaControlsAdwaita.css and mediaControlsAdwaita.js. The style is based on GTK port with a few differences:
1452
1453           - Adwaita icons are included in the css.
1454           - All buttons have effects for hover, pressed and disabled states.
1455           - Mute and fullscreen (only for videos) buttons are always visible, but disabled when not available to avoid
1456             the dancing when they are shown.
1457           - Media duration is always shown too (for non-live streams), being 00:00 and disabled when unknown, for the
1458             same reason.
1459           - Timeline and volume sliders are smaller and their thumbs are circled instead of rounded rectangles.
1460           - Slider thumbs also have effects for hover, pressed and disabled states.
1461
1462         * Modules/mediacontrols/mediaControlsAdwaita.css: Added.
1463         (audio::-webkit-media-controls-panel.hidden,):
1464         (body:-webkit-full-page-media):
1465         (audio):
1466         (audio:-webkit-full-page-media,):
1467         (audio:-webkit-full-page-media::-webkit-media-controls-panel,):
1468         (::-webkit-media-controls):
1469         (audio::-webkit-media-controls-enclosure,):
1470         (video::-webkit-media-controls-enclosure):
1471         (audio::-webkit-media-controls-panel,):
1472         (video::-webkit-media-controls-panel):
1473         (video::-webkit-media-controls-panel div.mute-box,):
1474         (audio::-webkit-media-controls-panel div.mute-box.hidden,):
1475         (audio::-webkit-media-controls-mute-button,):
1476         (audio::-webkit-media-controls-mute-button.muted,):
1477         (audio::-webkit-media-controls-play-button,):
1478         (audio::-webkit-media-controls-play-button.paused,):
1479         (audio::-webkit-media-controls-current-time-display,):
1480         (audio::-webkit-media-controls-current-time-display.no-duration,):
1481         (audio::-webkit-media-controls-current-time-display.hidden,):
1482         (audio::-webkit-media-controls-timeline,):
1483         (input[type="range"][disabled]::-webkit-media-slider-thumb,):
1484         (audio::-webkit-media-controls-timeline.hidden,):
1485         (audio::-webkit-media-controls-volume-slider-container,):
1486         (audio::-webkit-media-controls-volume-slider-container.hiding,):
1487         (audio::-webkit-media-controls-volume-slider-container.down,):
1488         (audio::-webkit-media-controls-panel .hiding.down,):
1489         (audio::-webkit-media-controls-volume-slider,):
1490         (audio::-webkit-media-controls-volume-slider-container input[type="range"]::-webkit-media-slider-container > div,):
1491         (input[type="range"]::-webkit-media-slider-container):
1492         (input[type="range"]::-webkit-media-slider-container > div):
1493         (input[type="range"]::-webkit-media-slider-thumb):
1494         (audio::-webkit-media-controls-toggle-closed-captions-button,):
1495         (audio::-webkit-media-controls-toggle-closed-captions-button.hidden,):
1496         (video::-webkit-media-controls-closed-captions-container):
1497         (video::-webkit-media-controls-closed-captions-container.out):
1498         (video::-webkit-media-controls-closed-captions-container.hidden):
1499         (video::-webkit-media-controls-closed-captions-container h3):
1500         (video::-webkit-media-controls-closed-captions-container ul):
1501         (video::-webkit-media-controls-closed-captions-container li):
1502         (video::-webkit-media-controls-closed-captions-container li.selected):
1503         (audio::-webkit-media-controls-fullscreen-button,):
1504         (audio::-webkit-media-controls-fullscreen-button.hidden,):
1505         (audio::-webkit-media-controls-panel button:hover,):
1506         (audio::-webkit-media-controls-panel button:active,):
1507         (audio::-webkit-media-controls-panel button[disabled],):
1508         * Modules/mediacontrols/mediaControlsAdwaita.js: Added.
1509         (createControls):
1510         (ControllerAdwaita):
1511         (contains):
1512         (ControllerAdwaita.prototype.createControls):
1513         (ControllerAdwaita.prototype.configureInlineControls):
1514         (ControllerAdwaita.prototype.shouldHaveControls):
1515         (ControllerAdwaita.prototype.reconnectControls):
1516         (ControllerAdwaita.prototype.setStatusHidden):
1517         (ControllerAdwaita.prototype.updateTime):
1518         (ControllerAdwaita.prototype.handleTimeUpdate):
1519         (ControllerAdwaita.prototype.updateHasAudio):
1520         (ControllerAdwaita.prototype.handleMuteButtonMouseOver):
1521         (ControllerAdwaita.prototype.handleVolumeBoxMouseOut):
1522         (ControllerAdwaita.prototype.removeControls):
1523         (ControllerAdwaita.prototype.addControls):
1524         (ControllerAdwaita.prototype.updateFullscreenButton):
1525         (ControllerAdwaita.prototype.updateReadyState):
1526         (ControllerAdwaita.prototype.updateDuration):
1527         (ControllerAdwaita.prototype.setIsLive):
1528         (ControllerAdwaita.prototype.updatePlaying):
1529         (ControllerAdwaita.prototype.updateProgress):
1530         (ControllerAdwaita.prototype.handleCaptionButtonClicked):
1531         (ControllerAdwaita.prototype.buildCaptionMenu):
1532         (ControllerAdwaita.prototype.destroyCaptionMenu):
1533         (ControllerAdwaita.prototype.showCaptionMenu):
1534         (ControllerAdwaita.prototype.hideCaptionMenu):
1535         (ControllerAdwaita.prototype.captionMenuTransitionEnd):
1536         (ControllerAdwaita.prototype.handleCaptionButtonMouseOver):
1537         (ControllerAdwaita.prototype.handleCaptionButtonShowMenu):
1538         (ControllerAdwaita.prototype.handleCaptionButtonMouseOut):
1539         (ControllerAdwaita.prototype.handleCaptionMouseOut):
1540         * Modules/mediacontrols/mediaControlsBase.js:
1541         * PlatformWPE.cmake:
1542         * platform/wpe/RenderThemeWPE.cpp:
1543         (WebCore::RenderThemeWPE::extraMediaControlsStyleSheet):
1544         (WebCore::RenderThemeWPE::mediaControlsScript):
1545         (WebCore::RenderThemeWPE::paintMediaSliderTrack):
1546         (WebCore::RenderThemeWPE::paintMediaVolumeSliderTrack):
1547         * platform/wpe/RenderThemeWPE.h:
1548
1549 2020-02-21  Fujii Hironori  <Hironori.Fujii@sony.com>
1550
1551         Unreviewed build fix for Windows ports
1552
1553         > WebKitBuild\Release\WTF\Headers\wtf/RefPtr.h(44): error C2027: use of undefined type 'WebCore::ImageData'
1554
1555         RefPtr<ImageData> is used without defining ImageData.
1556
1557         * platform/graphics/ConcreteImageBuffer.h: Added #include "ImageData.h".
1558
1559 2020-02-21  Jack Lee  <shihchieh_lee@apple.com>
1560
1561         Nullptr crash in RenderStyle::isFlippedBlocksWritingMode when fragment flow gains a new in-flow descendant
1562         https://bugs.webkit.org/show_bug.cgi?id=207296
1563         <rdar://problem/49687828>
1564
1565         Reviewed by Antti Koivisto.
1566
1567         When a multi-column fragment flow gains a new in-flow descendant, we need to call
1568         multiColumnDescendantInserted so RenderMultiColumnSet would be created for the new
1569         descendant.
1570
1571         Test: fast/multicol/fragflow-gains-new-in-flow-descendant-crash.html
1572
1573         * rendering/updating/RenderTreeBuilder.cpp:
1574         (WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock):
1575
1576 2020-02-20  Michael Catanzaro  <mcatanzaro@gnome.org>
1577
1578         [GTK] Improve user agent quirk for Google Docs and Google Drive
1579         https://bugs.webkit.org/show_bug.cgi?id=206506
1580
1581         Reviewed by Carlos Garcia Campos.
1582
1583         Stop using our macOS platform quirk for Google Docs and Google Drive. It is not successfully
1584         suppressing the unsupported browser warnings that it was added to avoid. It is also
1585         responsible for complaints from users who do not like seeing macOS-style shortcuts with
1586         the Command key rather than Ctrl.
1587
1588         Replace it with a new Firefox browser quirk. We can avoid the unsupported browser warning in
1589         Google Docs by using this quirk on accounts.youtube.com. There's no need for any other quirk
1590         specific to Google Docs (although removing the macOS platform quirk means we'll instead
1591         begin using the x86_64 Linux quirk that we send to other Google domains). Google Drive will
1592         also use this new quirk.
1593
1594         Also, remove a stale comment instructing developers to test downloading the Hangouts browser
1595         plugin. We no longer support NPAPI, so Google Hangouts is a lost cause until we get WebRTC
1596         working.
1597
1598         * platform/UserAgentQuirks.cpp:
1599         (WebCore::urlRequiresFirefoxBrowser):
1600         (WebCore::urlRequiresMacintoshPlatform):
1601         (WebCore::urlRequiresLinuxDesktopPlatform):
1602         (WebCore::UserAgentQuirks::quirksForURL):
1603         (WebCore::UserAgentQuirks::stringForQuirk):
1604         * platform/UserAgentQuirks.h:
1605         * platform/glib/UserAgentGLib.cpp:
1606         (WebCore::buildUserAgentString):
1607
1608 2020-02-20  Peng Liu  <peng.liu6@apple.com>
1609
1610         [Media in GPU process] Synchronize the properties of video layers in the GPU process with the hosting layer in the web process
1611         https://bugs.webkit.org/show_bug.cgi?id=206132
1612
1613         Reviewed by Jer Noble.
1614
1615         Update the name (for debugging) of the CALayer created by _web_renderLayerWithContextID (The CALayer will not be only used as video layers).
1616         This patch also fixes the ordering issue related to VideoLayerManagerObjC.h and VideoLayerManagerObjC.mm in the Xcode project file.
1617
1618         * WebCore.xcodeproj/project.pbxproj:
1619         * platform/graphics/cocoa/WebCoreCALayerExtras.mm:
1620         (+[CALayer _web_renderLayerWithContextID:]):
1621
1622 2020-02-20  Zalan Bujtas  <zalan@apple.com>
1623
1624         [First paint] Let optional style recalcs go through while in visually-non-empty state.
1625         https://bugs.webkit.org/show_bug.cgi?id=208020
1626         <rdar://problem/59636549>
1627
1628         Reviewed by Simon Fraser.
1629
1630         This is the final step to ensure we don't end up delaying the qualifiesAsVisuallyNonEmpty check when
1631         the page happens to not trigger synchronous style recalcs.
1632
1633         Here is the optimized flow:
1634         Optional style realc -> FrameView::styleAndRenderTreeDidChange -> qualifiesAsVisuallyNonEmpty -> Document::shouldScheduleLayout true.
1635
1636         This could be a slight regression in certain cases because now we let the optional style recalcs through and
1637         only delay the redundant layouts (as opposed to delay both).
1638
1639         * dom/Document.cpp:
1640         (WebCore::Document::scheduleStyleRecalc):
1641         (WebCore::Document::shouldScheduleLayout):
1642
1643 2020-02-20  Eric Carlson  <eric.carlson@apple.com>
1644
1645         Support in-band metadata cues when loading media in the GPU Process
1646         https://bugs.webkit.org/show_bug.cgi?id=207904
1647         <rdar://problem/59561647>
1648
1649         Reviewed by Dean Jackson.
1650
1651         No new tests, unskipped existing tests.
1652
1653         * WebCore.xcodeproj/project.pbxproj:
1654         * html/HTMLMediaElement.cpp:
1655         (WebCore::HTMLMediaElement::selectMediaResource):
1656         (WebCore::HTMLMediaElement::play):
1657         (WebCore::HTMLMediaElement::mediaEngineWasUpdated):
1658         (WebCore::HTMLMediaElement::mediaPlayerEngineUpdated):
1659         * html/track/InbandDataTextTrack.cpp:
1660         (WebCore::InbandDataTextTrack::addDataCue):
1661         (WebCore::InbandDataTextTrack::findIncompleteCue):
1662         (WebCore::InbandDataTextTrack::updateDataCue):
1663         (WebCore::InbandDataTextTrack::removeDataCue):
1664         (WebCore::InbandDataTextTrack::removeCue):
1665         * html/track/InbandDataTextTrack.h:
1666         * html/track/TextTrack.cpp:
1667         (WebCore::TextTrack::addCue):
1668         * html/track/TextTrack.h:
1669         (WebCore::TextTrack::cuesInternal const):
1670         * html/track/TextTrackCue.cpp:
1671         (WebCore::TextTrackCue::cueIndex const):
1672         * platform/SerializedPlatformDataCue.h:
1673         (WebCore::SerializedPlatformDataCue::deserialize const):
1674         (WebCore::SerializedPlatformDataCue::data const):
1675         (WebCore::SerializedPlatformDataCue::isEqual const):
1676         (WebCore::SerializedPlatformDataCue::platformType const):
1677         (WebCore::SerializedPlatformDataCue::encodingRequiresPlatformData const):
1678         (WebCore::SerializedPlatformDataCue::encodableValue const):
1679         * platform/graphics/MediaPlayer.cpp:
1680         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1681         (WebCore::MediaPlayerPrivateAVFoundationObjC::metadataDidArrive):
1682         * platform/mac/SerializedPlatformDataCueMac.h:
1683         * platform/mac/SerializedPlatformDataCueMac.mm:
1684         (WebCore::SerializedPlatformDataCue::create):
1685         (WebCore::SerializedPlatformDataCueMac::SerializedPlatformDataCueMac):
1686         (WebCore::SerializedPlatformDataCueMac::~SerializedPlatformDataCueMac):
1687         (WebCore::SerializedPlatformDataCueMac::isEqual const):
1688         (WebCore::toSerializedPlatformDataCueMac):
1689         (WebCore::SerializedPlatformDataCueMac::allowedClassesForNativeValues):
1690         (WebCore::SerializedPlatformDataCueMac::encodableValue const):
1691         (WebCore::jsValueWithAVMetadataItemInContext):
1692         (WebCore::NSDictionaryWithAVMetadataItem):
1693         (WebCore::SerializedPlatformDataCueMac::create): Deleted.
1694
1695 2020-02-20  Sunny He  <sunny_he@apple.com>
1696
1697         Fix crash in Page::updateRendering when document has no domWindow
1698         https://bugs.webkit.org/show_bug.cgi?id=207975
1699         <rdar://56999099>
1700
1701         Reviewed by Ryosuke Niwa.
1702
1703         When a subframe is navigated, a new document is created and
1704         the window is transfered asynchronously. It is possible to have
1705         a call to updateRendering in the middle of this process, resulting
1706         in an attempt to update a document with no window. Add a check for
1707         this case and skip such documents.
1708
1709         No test, since this crash relies on sensitive timing that cannot be
1710         consistently replicated in a test case.
1711
1712         * page/Page.cpp:
1713         (WebCore::Page::updateRendering):
1714
1715 2020-02-20  Zalan Bujtas  <zalan@apple.com>
1716
1717         [First paint] FrameView::loadProgressingStatusChanged should check m_firstVisuallyNonEmptyLayoutMilestoneIsPending
1718         https://bugs.webkit.org/show_bug.cgi?id=208008
1719         <rdar://problem/59630957>
1720
1721         Reviewed by Antti Koivisto.
1722
1723         If we haven't had a chance to issue a visually-non-empty milestone, we definitely need to check the content again when the load
1724         is finally completed.
1725
1726         * page/FrameView.cpp:
1727         (WebCore::FrameView::loadProgressingStatusChanged):
1728
1729 2020-02-20  Alicia Boya García  <aboya@igalia.com>
1730
1731         [GStreamer] Fix race in TextCombinerGStreamer
1732         https://bugs.webkit.org/show_bug.cgi?id=208001
1733
1734         Reviewed by Xabier Rodriguez-Calvar.
1735
1736         TextCombinerGStreamer uses the CAPS event to determine whether adding
1737         a webvttenc between the text track pad and the funnel element used to
1738         be able to display several subtitles at the same time.
1739
1740         The way this was done previously had a race though: all text track
1741         pads were preemptively linked directly to the funnel, only adding the
1742         webvttenc element later in the middle when receiving the CAPS event.
1743
1744         When two or more text tracks were present, it wasn't infrequent that
1745         one track had its CAPS event processed (causing the webvttenc element
1746         to be added) and propagated (fixating the funnel caps) before another
1747         track attempted caps negotiation. Because the pads were connected to
1748         the funnel preemptively, and because without the webvttenc element the
1749         caps of the text pad don't match the funnel's, this causes a caps
1750         mismatch error, stopping playback completely. The CAPS event is
1751         therefore never sent.
1752
1753         To avoid this race, we must avoid linking elements until we get the
1754         CAPS events, when we actually know where we should link them to,
1755         therefore avoiding early caps negotiation errors.
1756
1757         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
1758         (webkitTextCombinerPadDispose):
1759         (webkitTextCombinerPadEvent):
1760         (webkitTextCombinerRequestNewPad):
1761         (webkitTextCombinerReleasePad):
1762         (webkit_text_combiner_class_init):
1763         (webkitTextCombinerPadFinalize): Deleted.
1764
1765 2020-02-20  Zalan Bujtas  <zalan@apple.com>
1766
1767         [First paint] Let's check visually-non-empty state in FrameView::styleAndRenderTreeDidChange
1768         https://bugs.webkit.org/show_bug.cgi?id=208013
1769         <rdar://problem/59633427>
1770
1771         Reviewed by Antti Koivisto.
1772
1773         This patch completely decouples m_contentQualifiesAsVisuallyNonEmpty and m_firstVisuallyNonEmptyLayoutMilestoneIsPending.
1774         Now FrameView can be in the state where m_contentQualifiesAsVisuallyNonEmpty is true while
1775         m_firstVisuallyNonEmptyLayoutMilestoneIsPending is false (which is a perfectly valid state to be in).
1776         This will enable us to delay optional layouts after style recalcs when the content is still visually empty.
1777         (If a FrameView::isVisuallyNonEmpty() caller regresses after this change, it means that the caller is interested in
1778         whether the non-empty milestone has been issued or not and it needs to switch over to a different API.)
1779
1780         * page/FrameView.cpp:
1781         (WebCore::FrameView::styleAndRenderTreeDidChange):
1782         (WebCore::FrameView::loadProgressingStatusChanged):
1783         (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
1784
1785 2020-02-20  Takashi Komori  <Takashi.Komori@sony.com>
1786
1787         [Curl] Simplify Cookie class.
1788         https://bugs.webkit.org/show_bug.cgi?id=207930
1789
1790         Reviewed by Don Olmstead.
1791
1792         Removed redundant CookieJarCurl.cpp and made NetworkDataTaskCurl access CookieJarDB directly.
1793         CookieJarCurl was used for supporting file based cookie database but now it is no longer used.
1794
1795         No new tests. Covered by existing tests.
1796
1797         * platform/Curl.cmake:
1798         * platform/network/NetworkStorageSession.h:
1799         * platform/network/curl/CookieJarCurl.cpp: Removed.
1800         * platform/network/curl/CookieJarCurl.h: Removed.
1801         * platform/network/curl/CurlResourceHandleDelegate.cpp:
1802         (WebCore::handleCookieHeaders):
1803         * platform/network/curl/NetworkStorageSessionCurl.cpp:
1804         (WebCore::cookiesForSession):
1805         (WebCore::NetworkStorageSession::NetworkStorageSession):
1806         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
1807         (WebCore::NetworkStorageSession::setCookiesFromHTTPResponse const):
1808         (WebCore::NetworkStorageSession::setCookieAcceptPolicy const):
1809         (WebCore::NetworkStorageSession::cookieAcceptPolicy const):
1810         (WebCore::NetworkStorageSession::cookiesForDOM const):
1811         (WebCore::NetworkStorageSession::setCookies):
1812         (WebCore::NetworkStorageSession::setCookie):
1813         (WebCore::NetworkStorageSession::deleteCookie):
1814         (WebCore::NetworkStorageSession::deleteCookie const):
1815         (WebCore::NetworkStorageSession::deleteAllCookies):
1816         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
1817         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
1818         (WebCore::NetworkStorageSession::getAllCookies):
1819         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
1820         (WebCore::NetworkStorageSession::getRawCookies const):
1821         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
1822         * platform/network/curl/ResourceHandleCurl.cpp:
1823         (WebCore::ResourceHandle::createCurlRequest):
1824
1825 2020-02-20  Youenn Fablet  <youenn@apple.com>
1826
1827         Move system listeners from PlatformMediaSessionManager to MediaSessionManagerCocoa
1828         https://bugs.webkit.org/show_bug.cgi?id=208011
1829
1830         Reviewed by Eric Carlson.
1831
1832         We will want the listeners to be running in GPUProcess.
1833         The plan is to have a generic PlatformMediaSessionManager that is hooked to GPUProcess
1834         through a counterpart session manager in GPUProcess.
1835         Given listeners are only supported in Cocoa ports, it is fine moving them to MediaSessionManagerCocoa.
1836         This way we can decide to instantiate either a MediaSessionManagerCocoa in WebProcess or in GPUProcess.
1837
1838         For this to work, we have to make addSession virtual to be able to create the listeners lazily when adding a session.
1839
1840         No change of behavior.
1841
1842         * platform/audio/PlatformMediaSessionManager.cpp:
1843         (WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager):
1844         (WebCore::PlatformMediaSessionManager::addSession):
1845         (WebCore::PlatformMediaSessionManager::hasNoSession const):
1846         (WebCore::PlatformMediaSessionManager::removeSession):
1847         (WebCore::PlatformMediaSessionManager::setCurrentSession):
1848         (WebCore::PlatformMediaSessionManager::processDidReceiveRemoteControlCommand):
1849         (WebCore::PlatformMediaSessionManager::computeSupportsSeeking const):
1850         (WebCore::PlatformMediaSessionManager::processSystemWillSleep):
1851         (WebCore::PlatformMediaSessionManager::processSystemDidWake):
1852         * platform/audio/PlatformMediaSessionManager.h:
1853         * platform/audio/cocoa/MediaSessionManagerCocoa.h:
1854         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
1855         (MediaSessionManagerCocoa::MediaSessionManagerCocoa):
1856         (MediaSessionManagerCocoa::updateSessionState):
1857         (MediaSessionManagerCocoa::addSession):
1858         (MediaSessionManagerCocoa::removeSession):
1859         (MediaSessionManagerCocoa::setCurrentSession):
1860         * testing/Internals.cpp:
1861         (WebCore::Internals::postRemoteControlCommand):
1862         (WebCore::Internals::simulateSystemSleep const):
1863         (WebCore::Internals::simulateSystemWake const):
1864
1865 2020-02-19  Justin Fan  <justin_fan@apple.com>
1866
1867         GraphicsContextGLOpenGL::transformFeedbackVaryings passes deallocated memory to gl::TransformFeedbackVaryings
1868         https://bugs.webkit.org/show_bug.cgi?id=207526
1869
1870         Reviewed by Brent Fulgham.
1871
1872         Covered by WebGL2 Transform Feedback tests.
1873
1874         * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
1875         (WebCore::GraphicsContextGLOpenGL::transformFeedbackVaryings):
1876
1877 2020-02-20  Antti Koivisto  <antti@apple.com>
1878
1879         [macOS] Disable RunLoop function dispatch when there is a pending rendering update
1880         https://bugs.webkit.org/show_bug.cgi?id=207931
1881
1882         Reviewed by Geoffrey Garen.
1883
1884         Functions dispatched via RunLoop::dispatch() are executed before the rendering update runloop observer.
1885         This can significantly delay rendering updates as asyncronous IPC is handled via this mechanism.
1886         Most importantly network resources are dispatched to the main thread this way, sometimes triggering expensive
1887         synchronous parsing and script execution.
1888
1889         This patch adds a mechanims for disabling function dispatch temporarily while there is a pending rendering update.
1890
1891         * dom/WindowEventLoop.cpp:
1892         (WebCore::WindowEventLoop::breakToAllowRenderingUpdate):
1893
1894 2020-02-20  Zalan Bujtas  <zalan@apple.com>
1895
1896         [LFC] Sometimes subframes don't even have document elements.
1897         https://bugs.webkit.org/show_bug.cgi?id=208006
1898         <rdar://problem/59629147>
1899
1900         Reviewed by Antti Koivisto.
1901
1902         Test: fast/layoutformattingcontext/subframe-with-display-none-html.html
1903
1904         Do not try to layout a formatting context when it has no content at all.
1905
1906         * layout/LayoutContext.cpp:
1907         (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
1908
1909 2020-02-20  Zalan Bujtas  <zalan@apple.com>
1910
1911         [LFC][BFC] Fix geometryForBox::isOkToAccessDisplayBox for EscapeReason::FindFixedHeightAncestorQuirk
1912         https://bugs.webkit.org/show_bug.cgi?id=207983
1913         <rdar://problem/59615246>
1914
1915         Reviewed by Antti Koivisto.
1916
1917         Test: fast/layoutformattingcontext/height-percentage-quirk-to-icb.html
1918
1919         The height percentage quirk walks the ancestor chain and looks for fixed height block level boxes.
1920         It can potentially walk all the way up to the ICB. This patch gives access to the ICB's geometry when
1921         FormattingContext::geometryForBox() has EscapeReason::FindFixedHeightAncestorQuirk. 
1922
1923         * layout/FormattingContext.cpp:
1924         (WebCore::Layout::FormattingContext::geometryForBox const):
1925
1926 2020-02-20  Zalan Bujtas  <zalan@apple.com>
1927
1928         [LFC][Out-of-flow] FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned should ignore inline boxes
1929         https://bugs.webkit.org/show_bug.cgi?id=207994
1930         <rdar://problem/59618280>
1931
1932         Reviewed by Antti Koivisto.
1933
1934         Test: fast/layoutformattingcontext/absolute-positioned-box-with-inline-sibling.html
1935
1936         https://www.w3.org/TR/CSS22/visudet.html#abs-non-replaced-height
1937
1938         "For the purposes of this section and the next, the term "static position" (of an element) refers, roughly,
1939         to the position an element would have had in the normal flow."
1940
1941         This does not seem to be well-defined for sibling inline boxes. Let's just stick with block level boxes for now.
1942
1943         * layout/FormattingContextGeometry.cpp:
1944         (WebCore::Layout::FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned const):
1945
1946 2020-02-20  Don Olmstead  <don.olmstead@sony.com>
1947
1948         [CMake] Add WebP targets
1949         https://bugs.webkit.org/show_bug.cgi?id=207982
1950
1951         Reviewed by Adrian Perez de Castro.
1952
1953         Use the WebP targets.
1954
1955         * platform/ImageDecoders.cmake:
1956
1957 2020-02-20  Rob Buis  <rbuis@igalia.com>
1958
1959         Lazy load images using base url at parse time
1960         https://bugs.webkit.org/show_bug.cgi?id=207902
1961
1962         Reviewed by Darin Adler.
1963
1964         The spec says to use the base url at parse time for request
1965         url, ignoring changes to base url after that [1]. To fix this
1966         add a new state LoadImmediately to LazyImageLoadState where
1967         the parse time url from the initial request is reused.
1968
1969         [1] https://html.spec.whatwg.org/multipage/images.html#update-the-image-data
1970
1971         Tests: imported/web-platform-tests/html/semantics/embedded-content/the-img-element/original-base-url-applied-2.html
1972                imported/web-platform-tests/html/semantics/embedded-content/the-img-element/original-base-url-applied.html
1973
1974         * loader/ImageLoader.cpp:
1975         (WebCore::ImageLoader::updateFromElement):
1976         (WebCore::ImageLoader::loadDeferredImage):
1977         * loader/ImageLoader.h:
1978
1979 2020-02-20  Don Olmstead  <don.olmstead@sony.com>
1980
1981         [CMake] Add WPE::libwpe target
1982         https://bugs.webkit.org/show_bug.cgi?id=207970
1983
1984         Reviewed by Adrian Perez de Castro.
1985
1986         Use the WPE::libwpe target.
1987
1988         * PlatformGTK.cmake:
1989         * PlatformPlayStation.cmake:
1990         * PlatformWPE.cmake:
1991
1992 2020-02-20  Andres Gonzalez  <andresg_22@apple.com>
1993
1994         [WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange] must run on the main thread.
1995         https://bugs.webkit.org/show_bug.cgi?id=207958
1996
1997         Reviewed by Darin Adler.
1998
1999         Covered by existing tests.
2000
2001         [WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange]
2002         calls into TextIterator and Node, thus it must be dispatched to the
2003         main thread.
2004
2005         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2006         (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:]):
2007
2008 2020-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2009
2010         [WPE] Use custom colors for text and listbox selection
2011         https://bugs.webkit.org/show_bug.cgi?id=207836
2012
2013         Reviewed by Adrian Perez de Castro.
2014
2015         * platform/wpe/RenderThemeWPE.cpp:
2016         (WebCore::RenderThemeWPE::platformActiveSelectionBackgroundColor const):
2017         (WebCore::RenderThemeWPE::platformInactiveSelectionBackgroundColor const):
2018         (WebCore::RenderThemeWPE::platformActiveSelectionForegroundColor const):
2019         (WebCore::RenderThemeWPE::platformInactiveSelectionForegroundColor const):
2020         (WebCore::RenderThemeWPE::platformActiveListBoxSelectionBackgroundColor const):
2021         (WebCore::RenderThemeWPE::platformInactiveListBoxSelectionBackgroundColor const):
2022         (WebCore::RenderThemeWPE::platformActiveListBoxSelectionForegroundColor const):
2023         (WebCore::RenderThemeWPE::platformInactiveListBoxSelectionForegroundColor const):
2024         (WebCore::RenderThemeWPE::paintTextField):
2025         * platform/wpe/RenderThemeWPE.h:
2026
2027 2020-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2028
2029         [WPE] Use the theme to render the focus ring
2030         https://bugs.webkit.org/show_bug.cgi?id=207758
2031
2032         Reviewed by Adrian Perez de Castro.
2033
2034         This makes form controls consistent with elements having an auto outline.
2035
2036         * PlatformWPE.cmake: Add platform/wpe to include dirs.
2037         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2038         (WebCore::GraphicsContext::drawFocusRing): Use ThemeWPE::focusColor.
2039         * platform/wpe/RenderThemeWPE.cpp:
2040         (WebCore::RenderThemeWPE::platformFocusRingColor const): Implement it to return the focus color used by ThemeWPE.
2041         * platform/wpe/RenderThemeWPE.h:
2042         * platform/wpe/ThemeWPE.cpp:
2043         (WebCore::ThemeWPE::focusColor): Return the focus color.
2044         (WebCore::ThemeWPE::paintFocus): Add new methods receiving a path or list of rectangles and a color.
2045         * platform/wpe/ThemeWPE.h:
2046
2047 2020-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2048
2049         [WPE] Add support for rendering sliders for range elements
2050         https://bugs.webkit.org/show_bug.cgi?id=207694
2051
2052         Reviewed by Adrian Perez de Castro.
2053
2054         * platform/wpe/RenderThemeWPE.cpp:
2055         (WebCore::RenderThemeWPE::supportsFocusRing const):
2056         (WebCore::RenderThemeWPE::paintSliderTrack):
2057         (WebCore::RenderThemeWPE::adjustSliderThumbSize const):
2058         (WebCore::RenderThemeWPE::paintSliderThumb):
2059         * platform/wpe/RenderThemeWPE.h:
2060
2061 2020-02-19  Jack Lee  <shihchieh_lee@apple.com>
2062
2063         ASSERTION FAILED: roundedIntPoint(LayoutPoint(rendererMappedResult)) == result in WebCore::RenderGeometryMap::mapToContainer
2064         https://bugs.webkit.org/show_bug.cgi?id=151030
2065         <rdar://problem/27711142>
2066
2067         Reviewed by Darin Adler.
2068
2069         Track if m_accumulatedOffset ever becomes saturated, and if so, do not assert on unexpected rendererMappedResult.
2070
2071         Test: fast/layers/geometry-map-saturated-offset-assert.html
2072
2073         * platform/graphics/LayoutSize.h:
2074         (WebCore::LayoutSize::mightBeSaturated const):
2075         * rendering/RenderGeometryMap.cpp:
2076         (WebCore::RenderGeometryMap::mapToContainer const):
2077         (WebCore::RenderGeometryMap::stepInserted):
2078         (WebCore::RenderGeometryMap::stepRemoved):
2079         * rendering/RenderGeometryMap.h:
2080
2081 2020-02-19  Youenn Fablet  <youenn@apple.com>
2082
2083         Add support for AudioSession handling in GPUProcess for capture
2084         https://bugs.webkit.org/show_bug.cgi?id=207950
2085
2086         Reviewed by Eric Carlson.
2087
2088         Add a dedicated interface for handling audio capture in session manager.
2089         This was previoulsy PlatformMediaSessionClient, but this one is more related to audio/video rendering.
2090         Use this new interface for MediaStreamTrack capture sources.
2091         The session manager now owns a WeakHashSet of capture sources to compute the correct AudioSession category.
2092
2093         Modernize the code, for instance use an enum class for MediaType to remove some debug asserts.
2094         Add a new PlatformMediaSessionManager::create that is used for sharedManager.
2095
2096         Remove the direct use of PlatformMediaSessionManager::sharedManager from classes that can be used outside of WebProcess.
2097         This includes BaseAudioSharedUnit, for which we add a audioUnitWillStart callback
2098         so that we compute the right AudioSession category before starting the capture.
2099
2100         Covered by existing tests and debug assertions to check for AudioSession category computation.
2101
2102         * Modules/mediastream/MediaStreamTrack.cpp:
2103         (WebCore::MediaStreamTrack::MediaStreamTrack):
2104         (WebCore::MediaStreamTrack::~MediaStreamTrack):
2105         (WebCore::MediaStreamTrack::configureTrackRendering):
2106         (WebCore::MediaStreamTrack::isCapturingAudio const):
2107         * Modules/mediastream/MediaStreamTrack.h:
2108         * Modules/webaudio/AudioContext.h:
2109         * html/HTMLAudioElement.h:
2110         * html/HTMLMediaElement.cpp:
2111         (WebCore::HTMLMediaElement::shouldDisableSleep const):
2112         (WebCore::HTMLMediaElement::mediaType const):
2113         (WebCore::HTMLMediaElement::presentationType const):
2114         * html/HTMLVideoElement.h:
2115         * html/MediaElementSession.cpp:
2116         (WebCore::MediaElementSession::canShowControlsManager const):
2117         * html/MediaElementSession.h:
2118         * platform/audio/PlatformMediaSession.cpp:
2119         (WebCore::PlatformMediaSession::PlatformMediaSession):
2120         (WebCore::PlatformMediaSession::activeAudioSessionRequired const):
2121         * platform/audio/PlatformMediaSession.h:
2122         * platform/audio/PlatformMediaSessionManager.cpp:
2123         (WebCore::sharedPlatformMediaSessionManager):
2124         (WebCore::PlatformMediaSessionManager::sharedManager):
2125         (WebCore::PlatformMediaSessionManager::sharedManagerIfExists):
2126         (WebCore::PlatformMediaSessionManager::create):
2127         (WebCore::indexFromMediaType):
2128         (WebCore::PlatformMediaSessionManager::resetRestrictions):
2129         (WebCore::PlatformMediaSessionManager::has const):
2130         (WebCore::PlatformMediaSessionManager::count const):
2131         (WebCore::PlatformMediaSessionManager::countActiveAudioCaptureSources):
2132         (WebCore::PlatformMediaSessionManager::addRestriction):
2133         (WebCore::PlatformMediaSessionManager::removeRestriction):
2134         (WebCore::PlatformMediaSessionManager::restrictions):
2135         (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback):
2136         (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive):
2137         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive):
2138         (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground):
2139         (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground):
2140         (WebCore::PlatformMediaSessionManager::sessionIsPlayingToWirelessPlaybackTargetChanged):
2141         (WebCore::PlatformMediaSessionManager::addAudioCaptureSource):
2142         (WebCore::PlatformMediaSessionManager::removeAudioCaptureSource):
2143         * platform/audio/PlatformMediaSessionManager.h:
2144         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
2145         (PlatformMediaSessionManager::create):
2146         (MediaSessionManagerCocoa::updateSessionState):
2147         * platform/audio/ios/MediaSessionManagerIOS.mm:
2148         (WebCore::PlatformMediaSessionManager::create):
2149         (WebCore::MediaSessionManageriOS::resetRestrictions):
2150         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2151         (WebCore::MediaStreamTrackPrivate::audioUnitWillStart):
2152         * platform/mediastream/MediaStreamTrackPrivate.h:
2153         * platform/mediastream/RealtimeMediaSource.h:
2154         * platform/mediastream/mac/BaseAudioSharedUnit.cpp:
2155         (WebCore::BaseAudioSharedUnit::startUnit):
2156         * platform/mediastream/mac/BaseAudioSharedUnit.h:
2157         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2158         (WebCore::CoreAudioCaptureSource::audioUnitWillStart):
2159         * platform/mediastream/mac/CoreAudioCaptureSource.h:
2160         * testing/Internals.cpp:
2161         (WebCore::mediaTypeFromString):
2162         (WebCore::Internals::setMediaSessionRestrictions):
2163         (WebCore::Internals::mediaSessionRestrictions const):
2164
2165 2020-02-19  Sunny He  <sunny_he@apple.com>
2166
2167         Fix crash when Node::normalize() triggers mutation event that modifies child order
2168         https://bugs.webkit.org/show_bug.cgi?id=207875
2169         <rdar://58976682>
2170
2171         Reviewed by Ryosuke Niwa.
2172
2173         When Node::normalize() merges two text nodes, it calls appendData
2174         before textNodesMerged. If there is a mutator event registered, it
2175         will fire on the call to appendData, potentially changing the child
2176         order and causing a nullptr crash due to incorrect sibling pointers.
2177         Reverse the order of these calls to ensure order gets correctly
2178         updated.
2179
2180         Test: fast/dom/Node/normalize-mutation-event.html
2181
2182         * dom/Node.cpp:
2183         (WebCore::Node::normalize):
2184
2185 2020-02-19  Peng Liu  <peng.liu6@apple.com>
2186
2187         Fix check-webkit-style errors related to AVFoundationSPI.h
2188         https://bugs.webkit.org/show_bug.cgi?id=207834
2189
2190         Reviewed by Daniel Bates.
2191
2192         No new tests, no functional change.
2193
2194         Revert the change in r256770 regarding the headers ordering.
2195
2196         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
2197         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2198
2199 2020-02-19  Zalan Bujtas  <zalan@apple.com>
2200
2201         [LFC][Integration] Do not try to lay out a formatting context unless there's some content in it
2202         https://bugs.webkit.org/show_bug.cgi?id=207956
2203         <rdar://problem/59455700>
2204
2205         Reviewed by Simon Fraser.
2206
2207         LineLayout::layout() normally don't get called when the block level box has not children (canUse() returns false for such cases), but we are probably missing some invalidation here
2208         so we end up with an "empty" formatting context.
2209
2210         * layout/integration/LayoutIntegrationLineLayout.cpp:
2211         (WebCore::LayoutIntegration::LineLayout::layout):
2212
2213 2020-02-19  Zalan Bujtas  <zalan@apple.com>
2214
2215         [First paint] Introduce FrameView::m_firstVisuallyNonEmptyLayoutMilestoneIsPending
2216         https://bugs.webkit.org/show_bug.cgi?id=207966
2217         <rdar://problem/59606528>
2218
2219         Reviewed by Simon Fraser.
2220
2221         This is in preparation for decoupling the "content is qualified as visually non-empty" check and layout, when
2222         the check happens soon after style recalc/render tree building and we need to wait until after layout to
2223         issue the milestone.
2224
2225         * page/FrameView.cpp:
2226         (WebCore::FrameView::resetLayoutMilestones):
2227         (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
2228         * page/FrameView.h:
2229
2230 2020-02-19  Youenn Fablet  <youenn@apple.com>
2231
2232         [mac debug] Regression: http/tests/websocket/tests/hybi/workers/worker-reload.html is a flaky crash
2233         https://bugs.webkit.org/show_bug.cgi?id=207940
2234         <rdar://problem/59592000>
2235
2236         Reviewed by Chris Dumez.
2237
2238         Covered by debug asserts.
2239
2240         * Modules/websockets/WebSocket.cpp:
2241         (WebCore::WebSocket::connect):
2242         Pass registrable domain instead of URL.
2243         Isolate copy the domain before hopping to main thread for extra protection.
2244
2245 2020-02-19  Youenn Fablet  <youenn@apple.com>
2246
2247         Remove PlatformMediaSession::characteristics()
2248         https://bugs.webkit.org/show_bug.cgi?id=207926
2249
2250         Reviewed by Eric Carlson.
2251
2252         No change of behavior, removing no longer used code.
2253
2254         * Modules/mediastream/MediaStreamTrack.cpp:
2255         (WebCore::MediaStreamTrack::characteristics const): Deleted.
2256         * Modules/mediastream/MediaStreamTrack.h:
2257         * Modules/webaudio/AudioContext.h:
2258         * html/HTMLMediaElement.cpp:
2259         (WebCore::HTMLMediaElement::characteristics const): Deleted.
2260         * html/HTMLMediaElement.h:
2261         * platform/audio/PlatformMediaSession.cpp:
2262         (WebCore::PlatformMediaSession::characteristics const): Deleted.
2263         * platform/audio/PlatformMediaSession.h:
2264         (WebCore::PlatformMediaSessionClient::displayType const):
2265
2266 2020-02-19  Zalan Bujtas  <zalan@apple.com>
2267
2268         [LFC][Floats] FloatingContext::constraints should be able to handle empty candidate ranges (points)
2269         https://bugs.webkit.org/show_bug.cgi?id=207937
2270         <rdar://problem/59591109>
2271
2272         Reviewed by Antti Koivisto.
2273
2274         Test: fast/layoutformattingcontext/floats-shrinking-line-simple.html
2275
2276         Handle the case when the incoming vertical range is empty (line is empty).
2277
2278         * layout/floats/FloatingContext.cpp:
2279         (WebCore::Layout::FloatingContext::constraints const):
2280         * layout/floats/FloatingContext.h:
2281         * layout/inlineformatting/InlineFormattingContext.cpp:
2282         (WebCore::Layout::InlineFormattingContext::lineLayout):
2283
2284 2020-02-19  Brent Fulgham  <bfulgham@apple.com>
2285
2286         Re-disable top-level data URL navigations
2287         https://bugs.webkit.org/show_bug.cgi?id=207917
2288         <rdar://problem/59568037>
2289
2290         Reviewed by Darin Adler.
2291
2292         Calls to WKPage and WKWebView API used to load data and strings directly should be recognized by
2293         the loading code as being from client API calls. This brings these API behaviors into alignment
2294         with similar API for loading URLs and URLRequests directly. This change also allows us to enforce
2295         stricter handling of Data URLs, and to remove the need to explicitly permit top-level data URL
2296         navigation when client APIs are used.
2297
2298         Tested by TestWebKitAPI Navigation tests.
2299
2300         * page/Settings.yaml:
2301
2302 2020-02-19  Zalan Bujtas  <zalan@apple.com>
2303
2304         [LFC][IFC] Anonymous inline text box container is not the only type of anonymous containers
2305         https://bugs.webkit.org/show_bug.cgi?id=207945
2306         <rdar://problem/59592411>
2307
2308         Reviewed by Antti Koivisto.
2309
2310         Test: fast/layoutformattingcontext/anonymous-inline-container-simple.html
2311
2312         We construct anonymous inline containers for certain features like first-letter.
2313
2314         * layout/inlineformatting/InlineFormattingContext.cpp:
2315         (WebCore::Layout::nextInlineLevelBoxToLayout):
2316         (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
2317         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
2318         (WebCore::Layout::InlineFormattingContext::collectInlineContentIfNeeded):
2319
2320 2020-02-19  Megan Gardner  <megan_gardner@apple.com>
2321
2322         Ensure that contenteditable carets on macCatalyst are the right color, especially in Dark Mode
2323         https://bugs.webkit.org/show_bug.cgi?id=207789
2324         <rdar://problem/59429715>
2325
2326         Reviewed by Tim Horton.
2327
2328         Factor out caret color calculation to be used in WebPageIOS.
2329
2330         Fixes EditorStateTests.CaretColorInContentEditable.
2331
2332         * editing/FrameSelection.cpp:
2333         (WebCore::CaretBase::computeCaretColor):
2334         (WebCore::CaretBase::paintCaret const):
2335         * editing/FrameSelection.h:
2336
2337 2020-02-19  Chris Dumez  <cdumez@apple.com>
2338
2339         Unreviewed, fix assertions in storage access API layout tests after r256882.
2340
2341         * dom/DocumentStorageAccess.idl:
2342         Only expose the storage access API operations to the Web when the corresponding setting is
2343         enabled instead of relying on an assertion.
2344
2345         * testing/Internals.cpp:
2346         (WebCore::Internals::resetToConsistentState):
2347         Stop disabling the storage access API since the API is enabled by default.
2348
2349 2020-02-18  Zalan Bujtas  <zalan@apple.com>
2350
2351         Rename ScrollView::styleDidChange to styleAndRenderTreeDidChange
2352         https://bugs.webkit.org/show_bug.cgi?id=207921
2353
2354         Reviewed by Simon Fraser.
2355
2356         When ScrollView::styleDidChange is called we actually finished updating the render tree as well.
2357
2358         * dom/Document.cpp:
2359         (WebCore::Document::resolveStyle):
2360         * page/FrameView.cpp:
2361         (WebCore::FrameView::styleAndRenderTreeDidChange):
2362         (WebCore::FrameView::styleDidChange): Deleted.
2363         * page/FrameView.h:
2364         * platform/ScrollView.cpp:
2365         (WebCore::ScrollView::styleAndRenderTreeDidChange):
2366         (WebCore::ScrollView::styleDidChange): Deleted.
2367         * platform/ScrollView.h:
2368         * rendering/RenderView.cpp: FrameView::styleDidChange gets called by the Document.
2369         (WebCore::RenderView::styleDidChange): Deleted.
2370         * rendering/RenderView.h:
2371
2372 2020-02-18  Jack Lee  <shihchieh_lee@apple.com>
2373
2374         ASSERTION FAILED: !m_embeddedObjectsToUpdate->contains(nullptr) in WebCore::FrameView::updateEmbeddedObjects
2375         https://bugs.webkit.org/show_bug.cgi?id=191532
2376         <rdar://problem/46151555>
2377
2378         Reviewed by Darin Adler.
2379
2380         Add reentrancy protection for FrameView::updateEmbeddedObjects().
2381         Move the common code in renderWidgetLoadingPlugin() to inherited class, HTMLPlugInElement.
2382
2383         Test: fast/text/textCombine-update-embeddedObj-assert.html
2384
2385         * html/HTMLAppletElement.cpp:
2386         (WebCore::HTMLAppletElement::renderWidgetLoadingPlugin const):
2387         * html/HTMLEmbedElement.cpp:
2388         (WebCore::HTMLEmbedElement::renderWidgetLoadingPlugin const):
2389         * html/HTMLObjectElement.cpp:
2390         (WebCore::HTMLObjectElement::renderWidgetLoadingPlugin const): Deleted.
2391         * html/HTMLObjectElement.h:
2392         * html/HTMLPlugInElement.cpp:
2393         (WebCore::HTMLPlugInElement::renderWidgetLoadingPlugin const):
2394         * html/HTMLPlugInElement.h:
2395         * page/FrameView.cpp:
2396         (WebCore::FrameView::updateEmbeddedObjects):
2397         * page/FrameView.h:
2398
2399 2020-02-18  Youenn Fablet  <youenn@apple.com>
2400
2401         Reduce use of PlatformMediaSessionManager::sharedManager()
2402         https://bugs.webkit.org/show_bug.cgi?id=207924
2403
2404         Reviewed by Eric Carlson.
2405
2406         The plan is to be able to have PlatformMediaSession in GPU process which might have different managers,
2407         typically a manager per connection to web process.
2408         For that reason, reduce the use of the sharedManager to classes that can only live in WebProcess.
2409         No change of behavior.
2410
2411         * Modules/mediastream/MediaStreamTrack.cpp:
2412         (WebCore::MediaStreamTrack::MediaStreamTrack):
2413         * Modules/webaudio/AudioContext.cpp:
2414         (WebCore::AudioContext::AudioContext):
2415         * html/MediaElementSession.cpp:
2416         (WebCore::MediaElementSession::MediaElementSession):
2417         (WebCore::MediaElementSession::clientDataBufferingTimerFired):
2418         (WebCore::MediaElementSession::setHasPlaybackTargetAvailabilityListeners):
2419         * platform/audio/PlatformMediaSession.cpp:
2420         (WebCore::PlatformMediaSession::create):
2421         (WebCore::PlatformMediaSession::PlatformMediaSession):
2422         (WebCore::PlatformMediaSession::~PlatformMediaSession):
2423         (WebCore::PlatformMediaSession::setState):
2424         (WebCore::PlatformMediaSession::clientWillBeginPlayback):
2425         (WebCore::PlatformMediaSession::processClientWillPausePlayback):
2426         (WebCore::PlatformMediaSession::stopSession):
2427         (WebCore::PlatformMediaSession::isPlayingToWirelessPlaybackTargetChanged):
2428         (WebCore::PlatformMediaSession::canProduceAudioChanged):
2429         (WebCore::PlatformMediaSession::clientCharacteristicsChanged):
2430         (WebCore::PlatformMediaSession::manager):
2431         * platform/audio/PlatformMediaSession.h:
2432         * platform/audio/PlatformMediaSessionManager.h:
2433
2434 2020-02-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2435
2436         REGRESSION (r256093): fast/events/touch/ios/block-without-overflow-scroll.html is failing
2437         https://bugs.webkit.org/show_bug.cgi?id=207919
2438         <rdar://problem/59565344>
2439
2440         Reviewed by Tim Horton.
2441
2442         Three iOS-specific layout tests began to fail after r256093, since they currently depend on a particular
2443         ordering when iterating over elements in a hash map. Instead of just rebaselining these tests, we can make them
2444         more robust against similar changes in the future by forcing a deterministic order when printing out synchronous
2445         touch event regions for testing.
2446
2447         I arbitrarily chose to sort the keys (which are touch event type names) in alphabetical order.
2448
2449         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
2450         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
2451
2452 2020-02-18  Youenn Fablet  <youenn@apple.com>
2453
2454         PlatformMediaSessionClient::processingUserGestureForMedia is not needed
2455         https://bugs.webkit.org/show_bug.cgi?id=207922
2456
2457         Reviewed by Eric Carlson.
2458
2459         All code relies on the document and the virtual method is never used so remove it.
2460         No change of behavior.
2461
2462         * Modules/mediastream/MediaStreamTrack.cpp:
2463         (WebCore::MediaStreamTrack::processingUserGestureForMedia const): Deleted.
2464         * Modules/mediastream/MediaStreamTrack.h:
2465         * Modules/webaudio/AudioContext.cpp:
2466         (WebCore::AudioContext::processingUserGestureForMedia const): Deleted.
2467         * Modules/webaudio/AudioContext.h:
2468         * html/HTMLMediaElement.h:
2469         * platform/audio/PlatformMediaSession.h:
2470
2471 2020-02-18  Youenn Fablet  <youenn@apple.com>
2472
2473         SWServer::claim should check for the service worker to be active
2474         https://bugs.webkit.org/show_bug.cgi?id=207739
2475         <rdar://problem/45441129>
2476
2477         Reviewed by Alex Christensen.
2478
2479         claim is only working for service workers that are active.
2480         But there might be a time when a service worker is active in its web process but redundant in networking process.
2481         Thus, we need to move the check from WebProcess to NetworkProcess.
2482
2483         * workers/service/ServiceWorkerClients.cpp:
2484         (WebCore::ServiceWorkerClients::claim):
2485         * workers/service/context/SWContextManager.h:
2486         * workers/service/server/SWServer.cpp:
2487         (WebCore::SWServer::claim):
2488         * workers/service/server/SWServer.h:
2489         * workers/service/server/SWServerToContextConnection.cpp:
2490         (WebCore::SWServerToContextConnection::claim):
2491         * workers/service/server/SWServerToContextConnection.h:
2492         * workers/service/server/SWServerWorker.cpp:
2493         (WebCore::SWServerWorker::claim): Deleted.
2494         * workers/service/server/SWServerWorker.h:
2495         (WebCore::SWServerWorker::isActive const):
2496
2497 2020-02-18  Zalan Bujtas  <zalan@apple.com>
2498
2499         [LFC][IFC] Replaced elements can also establish formatting contexts.
2500         https://bugs.webkit.org/show_bug.cgi?id=207923
2501         <rdar://problem/59571203>
2502
2503         Reviewed by Simon Fraser.
2504
2505         While replaced boxes (leaf boxes) can also establish formatting contexts (e.g. style="inline-block"), we
2506         only need to construct formatting context objects for the root's descendants (and not for the root itself). 
2507
2508         Test: fast/layoutformattingcontext/block-only/replaced-as-inline-block-simple.html
2509
2510         * layout/inlineformatting/InlineFormattingContext.cpp:
2511         (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
2512
2513 2020-02-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
2514
2515         Allow different back-ends for ImageBuffer
2516         https://bugs.webkit.org/show_bug.cgi?id=207048
2517
2518         Reviewed by Tim Horton.
2519
2520         ImageBuffer will be re-factored to decouple the platform specifics and
2521         the back-end details from the interface "ImageBuffer".
2522
2523         A class hierarchy for the ImageBufferBackend will added to allow code
2524         sharing and to split the code according to the platform and the back-end
2525         details.
2526
2527         ImageBuffer will be kept interface with the rest of the code but different
2528         back-ends will be created. ConcreteImageBuffer is a template class which
2529         inherits ImageBuffer and will  act as a bridge to the concrete
2530         ImageBufferBackend.
2531
2532         Based on the RenderingMode, a ConcreteImageBuffer<BackendType> will
2533         be created. Instead of checking the renderingMode in many places of the
2534         code and instead of and using preprocessor directives, all these decisions
2535         will be made in the concrete ImageBufferBackend.
2536
2537         This re-factoring will allow creating new types of ImageBuffers backed by
2538         new ImageBufferBackends. These new ImageBufferBackends will implement
2539         DisplayList drawing and synchronize remote rendering.
2540
2541         * Headers.cmake:
2542         * PlatformAppleWin.cmake:
2543         * PlatformFTW.cmake:
2544         * PlatformMac.cmake:
2545         * PlatformWin.cmake:
2546         * Sources.txt:
2547         * SourcesCocoa.txt:
2548         * WebCore.xcodeproj/project.pbxproj:
2549         * html/CanvasBase.cpp:
2550         (WebCore::CanvasBase::setImageBuffer const):
2551         * platform/Cairo.cmake:
2552         * platform/SourcesCairo.txt:
2553         * platform/graphics/BitmapImage.cpp:
2554         (WebCore::BitmapImage::nativeImageForCurrentFrameRespectingOrientation):
2555         * platform/graphics/ConcreteImageBuffer.h: Added.
2556         (WebCore::ConcreteImageBuffer::create):
2557         (WebCore::ConcreteImageBuffer::ConcreteImageBuffer):
2558         (WebCore::ConcreteImageBuffer::ensureBackend const):
2559         (WebCore::ConcreteImageBuffer::putImageData):
2560         * platform/graphics/ImageBuffer.cpp:
2561         (WebCore::ImageBuffer::create):
2562         (WebCore::ImageBuffer::createCompatibleBuffer):
2563         (WebCore::ImageBuffer::sizeNeedsClamping):
2564         (WebCore::ImageBuffer::compatibleBufferSize):
2565         (WebCore::ImageBuffer::sinkIntoNativeImage):
2566         (WebCore::ImageBuffer::sinkIntoImage):
2567         (WebCore::ImageBuffer::drawConsuming):
2568         (WebCore::ImageBuffer::toBGRAData const): Deleted.
2569         (WebCore::ImageBuffer::transformColorSpace): Deleted.
2570         (WebCore::ImageBuffer::genericConvertToLuminanceMask): Deleted.
2571         (WebCore::ImageBuffer::convertToLuminanceMask): Deleted.
2572         (WebCore::ImageBuffer::platformLayer const): Deleted.
2573         (WebCore::ImageBuffer::copyToPlatformTexture): Deleted.
2574         (WebCore::ImageBuffer::memoryCost const): Deleted.
2575         (WebCore::ImageBuffer::externalMemoryCost const): Deleted.
2576         * platform/graphics/ImageBuffer.h:
2577         (WebCore::ImageBuffer::draw):
2578         (WebCore::ImageBuffer::drawPattern):
2579         (WebCore::ImageBuffer::drawConsuming):
2580         (WebCore::ImageBuffer::putImageData):
2581         (): Deleted.
2582         (WebCore::ImageBuffer::internalSize const): Deleted.
2583         (WebCore::ImageBuffer::logicalSize const): Deleted.
2584         (WebCore::ImageBuffer::resolutionScale const): Deleted.
2585         (WebCore::ImageBuffer::baseTransform const): Deleted.
2586         * platform/graphics/ImageBufferBackend.cpp: Added.
2587         (WebCore::ImageBufferBackend::ImageBufferBackend):
2588         (WebCore::ImageBufferBackend::calculateBackendSize):
2589         (WebCore::ImageBufferBackend::sinkIntoNativeImage):
2590         (WebCore::ImageBufferBackend::sinkIntoImage):
2591         (WebCore::ImageBufferBackend::drawConsuming):
2592         (WebCore::ImageBufferBackend::convertToLuminanceMask):
2593         (WebCore::ImageBufferBackend::toBGRAData const):
2594         (WebCore::copyPremultipliedToPremultiplied):
2595         (WebCore::copyPremultipliedToUnpremultiplied):
2596         (WebCore::copyUnpremultipliedToPremultiplied):
2597         (WebCore::copyFunctor):
2598         (WebCore::ImageBufferBackend::copyImagePixels const):
2599         (WebCore::ImageBufferBackend::getImageData const):
2600         (WebCore::ImageBufferBackend::putImageData):
2601         * platform/graphics/ImageBufferBackend.h: Added.
2602         (WebCore::ImageBufferBackend::flushContext):
2603         (WebCore::ImageBufferBackend::logicalSize const):
2604         (WebCore::ImageBufferBackend::backendSize const):
2605         (WebCore::ImageBufferBackend::resolutionScale const):
2606         (WebCore::ImageBufferBackend::colorSpace const):
2607         (WebCore::ImageBufferBackend::baseTransform const):
2608         (WebCore::ImageBufferBackend::memoryCost const):
2609         (WebCore::ImageBufferBackend::externalMemoryCost const):
2610         (WebCore::ImageBufferBackend::transformColorSpace):
2611         (WebCore::ImageBufferBackend::platformLayer const):
2612         (WebCore::ImageBufferBackend::copyToPlatformTexture const):
2613         (WebCore::ImageBufferBackend::bytesPerRow const):
2614         (WebCore::ImageBufferBackend::backendColorFormat const):
2615         (WebCore::ImageBufferBackend::toBackendCoordinates const):
2616         (WebCore::ImageBufferBackend::logicalRect const):
2617         (WebCore::ImageBufferBackend::backendRect const):
2618         * platform/graphics/PlatformImageBuffer.h: Added.
2619         * platform/graphics/ShadowBlur.cpp:
2620         (WebCore::ShadowBlur::drawShadowBuffer):
2621         * platform/graphics/cairo/CairoOperations.cpp:
2622         (WebCore::Cairo::drawShadowLayerBuffer):
2623         (WebCore::Cairo::drawShadowImage):
2624         (WebCore::Cairo::fillShadowBuffer):
2625         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2626         (WebCore::GraphicsContext::clipToImageBuffer):
2627         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
2628         (WebCore::GraphicsContextImplCairo::clipToImageBuffer):
2629         * platform/graphics/cairo/ImageBufferCairo.cpp: Removed.
2630         * platform/graphics/cairo/ImageBufferCairoBackend.cpp: Added.
2631         (WebCore::ImageBufferCairoBackend::copyImage const):
2632         (WebCore::ImageBufferCairoBackend::draw):
2633         (WebCore::ImageBufferCairoBackend::drawPattern):
2634         (WebCore::ImageBufferCairoBackend::transformColorSpace):
2635         (WebCore::ImageBufferCairoBackend::toDataURL const):
2636         (WebCore::ImageBufferCairoBackend::toData const):
2637         * platform/graphics/cairo/ImageBufferCairoBackend.h: Added.
2638         (WebCore::ImageBufferCairoBackend::platformTransformColorSpace):
2639         * platform/graphics/cairo/ImageBufferCairoGLSurfaceBackend.cpp: Added.
2640         (WebCore::clearSurface):
2641         (WebCore::ImageBufferCairoGLSurfaceBackend::create):
2642         (WebCore::ImageBufferCairoGLSurfaceBackend::ImageBufferCairoGLSurfaceBackend):
2643         (WebCore::ImageBufferCairoGLSurfaceBackend::~ImageBufferCairoGLSurfaceBackend):
2644         (WebCore::ImageBuffer::platformLayer const):
2645         (WebCore::ImageBufferCairoGLSurfaceBackend::copyToPlatformTexture):
2646         (WebCore::ImageBufferCairoGLSurfaceBackend::createCompositorBuffer):
2647         (WebCore::ImageBufferCairoGLSurfaceBackend::swapBuffersIfNeeded):
2648         (WebCore::ImageBufferCairoGLSurfaceBackend::paintToTextureMapper):
2649         * platform/graphics/cairo/ImageBufferCairoGLSurfaceBackend.h: Added.
2650         * platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp: Added.
2651         (WebCore::ImageBufferCairoImageSurfaceBackend::create):
2652         (WebCore::ImageBufferCairoImageSurfaceBackend::ImageBufferCairoImageSurfaceBackend):
2653         (WebCore::ImageBufferCairoImageSurfaceBackend::platformTransformColorSpace):
2654         * platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.h: Added.
2655         * platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp: Added.
2656         (WebCore::ImageBufferCairoSurfaceBackend::ImageBufferCairoSurfaceBackend):
2657         (WebCore::ImageBufferCairoSurfaceBackend::context const):
2658         (WebCore::ImageBufferCairoSurfaceBackend::bytesPerRow const):
2659         (WebCore::ImageBufferCairoSurfaceBackend::copyNativeImage const):
2660         (WebCore::ImageBufferCairoSurfaceBackend::cairoSurfaceCoerceToImage const):
2661         (WebCore::ImageBufferCairoSurfaceBackend::toBGRAData const):
2662         (WebCore::ImageBufferCairoSurfaceBackend::getImageData const):
2663         (WebCore::ImageBufferCairoSurfaceBackend::putImageData):
2664         * platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h: Added.
2665         * platform/graphics/cg/ImageBufferCG.cpp: Removed.
2666         * platform/graphics/cg/ImageBufferCGBackend.cpp: Added.
2667         (WebCore::ImageBufferCGBackend::contextColorSpace):
2668         (WebCore::ImageBufferCGBackend::setupContext):
2669         (WebCore::createCroppedImageIfNecessary):
2670         (WebCore::createBitmapImageAfterScalingIfNeeded):
2671         (WebCore::ImageBufferCGBackend::copyImage const):
2672         (WebCore::ImageBufferCGBackend::sinkIntoImage):
2673         (WebCore::ImageBufferCGBackend::draw):
2674         (WebCore::ImageBufferCGBackend::drawPattern):
2675         (WebCore::ImageBufferCGBackend::baseTransform const):
2676         (WebCore::ImageBufferCGBackend::toCFData const):
2677         (WebCore::ImageBufferCGBackend::toData const):
2678         (WebCore::ImageBufferCGBackend::toDataURL const):
2679         (WebCore::makeVImageBuffer):
2680         (WebCore::copyImagePixelsAccelerated):
2681         (WebCore::ImageBufferCGBackend::copyImagePixels const):
2682         * platform/graphics/cg/ImageBufferCGBackend.h: Added.
2683         * platform/graphics/cg/ImageBufferCGBitmapBackend.cpp: Added.
2684         (WebCore::ImageBufferCGBitmapBackend::create):
2685         (WebCore::ImageBufferCGBitmapBackend::ImageBufferCGBitmapBackend):
2686         (WebCore::ImageBufferCGBitmapBackend::context const):
2687         (WebCore::ImageBufferCGBitmapBackend::copyNativeImage const):
2688         (WebCore::ImageBufferCGBitmapBackend::toBGRAData const):
2689         (WebCore::ImageBufferCGBitmapBackend::getImageData const):
2690         (WebCore::ImageBufferCGBitmapBackend::putImageData):
2691         * platform/graphics/cg/ImageBufferCGBitmapBackend.h: Added.
2692         * platform/graphics/cg/ImageBufferDataCG.cpp: Removed.
2693         * platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp: Added.
2694         (WebCore::ImageBufferIOSurfaceBackend::calculateBackendSize):
2695         (WebCore::ImageBufferIOSurfaceBackend::contextColorSpace):
2696         (WebCore::ImageBufferIOSurfaceBackend::create):
2697         (WebCore::ImageBufferIOSurfaceBackend::ImageBufferIOSurfaceBackend):
2698         (WebCore::ImageBufferIOSurfaceBackend::context const):
2699         (WebCore::ImageBufferIOSurfaceBackend::flushContext):
2700         (WebCore::ImageBufferIOSurfaceBackend::memoryCost const):
2701         (WebCore::ImageBufferIOSurfaceBackend::externalMemoryCost const):
2702         (WebCore::ImageBufferIOSurfaceBackend::bytesPerRow const):
2703         (WebCore::ImageBufferIOSurfaceBackend::backendColorFormat const):
2704         (WebCore::ImageBufferIOSurfaceBackend::copyNativeImage const):
2705         (WebCore::ImageBufferIOSurfaceBackend::sinkIntoNativeImage):
2706         (WebCore::ImageBufferIOSurfaceBackend::drawConsuming):
2707         (WebCore::ImageBufferIOSurfaceBackend::toBGRAData const):
2708         (WebCore::ImageBufferIOSurfaceBackend::getImageData const):
2709         (WebCore::ImageBufferIOSurfaceBackend::putImageData):
2710         * platform/graphics/cg/ImageBufferIOSurfaceBackend.h: Added.
2711         * platform/graphics/cg/PDFDocumentImage.cpp:
2712         (WebCore::PDFDocumentImage::updateCachedImageIfNeeded):
2713         * platform/graphics/cocoa/IOSurface.mm:
2714         (WebCore::IOSurface::createFromImageBuffer): Deleted.
2715         * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:
2716         (WebCore::GraphicsContextGLOpenGL::paintRenderingResultsToCanvas):
2717         * platform/graphics/win/ImageBufferDataDirect2D.cpp: Removed.
2718         * platform/graphics/win/ImageBufferDataDirect2D.h: Removed.
2719         * platform/graphics/win/ImageBufferDirect2D.cpp: Removed.
2720         * platform/graphics/win/ImageBufferDirect2DBackend.cpp: Added.
2721         (WebCore::ImageBufferDirect2DBackend::create):
2722         (WebCore::ImageBufferDirect2DBackend::ImageBufferDirect2DBackend):
2723         (WebCore::ImageBufferDirect2DBackend::context const):
2724         (WebCore::ImageBufferDirect2DBackend::flushContext):
2725         (WebCore::ImageBufferDirect2DBackend::copyNativeImage const):
2726         (WebCore::createCroppedImageIfNecessary):
2727         (WebCore::createBitmapImageAfterScalingIfNeeded):
2728         (WebCore::ImageBufferDirect2DBackend::copyImage const):
2729         (WebCore::ImageBufferDirect2DBackend::sinkIntoImage):
2730         (WebCore::ImageBufferDirect2DBackend::compatibleBitmap):
2731         (WebCore::ImageBufferDirect2DBackend::draw):
2732         (WebCore::ImageBufferDirect2DBackend::drawPattern):
2733         (WebCore::ImageBufferDirect2DBackend::toDataURL const):
2734         (WebCore::ImageBufferDirect2DBackend::toData const):
2735         (WebCore::ImageBufferDirect2DBackend::toBGRAData const):
2736         (WebCore::ImageBufferDirect2DBackend::getImageData const):
2737         (WebCore::ImageBufferDirect2DBackend::putImageData):
2738         * platform/graphics/win/ImageBufferDirect2DBackend.h: Added.
2739         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp:
2740         (WebCore::WrappedMockRealtimeVideoSource::updateSampleBuffer):
2741         * rendering/svg/SVGRenderingContext.cpp:
2742         (WebCore::SVGRenderingContext::bufferForeground):
2743
2744 2020-02-18  Zalan Bujtas  <zalan@apple.com>
2745
2746         [First paint] Remove elementOverflowRectIsLargerThanThreshold check in qualifiesAsVisuallyNonEmpty
2747         https://bugs.webkit.org/show_bug.cgi?id=207907
2748         <rdar://problem/59562169>
2749
2750         Reviewed by Geoffrey Garen.
2751
2752         This is in preparation for being able to qualify for visually non-empty content without looking at geometry.
2753         This check was added long ago, initially with a 200px value which got reduced to 48px to reduce painting latency on google search result page.
2754         At this point a 48px threshold does not make too much sense.
2755
2756         * page/FrameView.cpp:
2757         (WebCore::FrameView::qualifiesAsSignificantRenderedText const):
2758         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const):
2759         (WebCore::elementOverflowRectIsLargerThanThreshold): Deleted.
2760
2761 2020-02-18  Daniel Bates  <dabates@apple.com>
2762
2763         Ask the EditorClient whether to reveal the current selection after insertion
2764         https://bugs.webkit.org/show_bug.cgi?id=207866
2765         <rdar://problem/59553028>
2766
2767         Reviewed by Wenson Hsieh.
2768
2769         Adds a new EditorClient function shouldRevealCurrentSelectionAfterInsertion() that returns whether
2770         the client wants the engine to reveal the current selection after insertion. The default implementation
2771         always returns true. On iOS it returns the result of WebPage::shouldRevealCurrentSelectionAfterInsertion().
2772
2773         * editing/Editor.cpp:
2774         (WebCore::Editor::insertTextWithoutSendingTextEvent): Call EditorClient::shouldRevealCurrentSelectionAfterInsertion().
2775         If it returns false then skip the code to reveal the current selection: the UI process will call back
2776         into WebPage::setShouldRevealCurrentSelectionAfterInsertion() when it is ready to reveal the current
2777         selection. Otherwise, do what we do now.
2778         * editing/Editor.h:
2779         * page/EditorClient.h:
2780         (WebCore::EditorClient::shouldRevealCurrentSelectionAfterInsertion const): Added.
2781         * page/Page.cpp:
2782         (WebCore::Page::revealCurrentSelection): Added.
2783         * page/Page.h:
2784
2785 2020-02-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2786
2787         [macOS] Web process may crash under ServicesOverlayController::buildPotentialHighlightsIfNeeded
2788         https://bugs.webkit.org/show_bug.cgi?id=207899
2789         <rdar://problem/55658207>
2790
2791         Reviewed by Tim Horton and Simon Fraser.
2792
2793         Mitigates a null pointer crash in ServicesOverlayController::buildPotentialHighlightsIfNeeded(), wherein the
2794         focused frame may not have a FrameView when the ServicesOverlayController's selection invalidation timer fires.
2795         This is possible if, while being focused, the newly focused subframe is unparented and reparented, which causes
2796         it to momentarily have a null view. During this time, if a selection change had occurred earlier in the runloop,
2797         it will schedule the page overlay controller invalidation timer, which will fire and discover that the currently
2798         focused frame no longer has a FrameView.
2799
2800         Test: editing/selection/selection-change-in-disconnected-frame-crash.html
2801
2802         * page/mac/ServicesOverlayController.mm:
2803         (WebCore::ServicesOverlayController::buildSelectionHighlight):
2804
2805 2020-02-18  Peng Liu  <peng.liu6@apple.com>
2806
2807         MediaSource.isTypeSupported() says "video/mp4;codecs=\"avc3.42C015\"" is not supported, but it is
2808         https://bugs.webkit.org/show_bug.cgi?id=207622
2809
2810         Reviewed by Eric Carlson.
2811
2812         Revert the behavior change of MediaPlayerPrivateMediaSourceAVFObjC::supportsType() in r253952.
2813
2814         * platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm:
2815         (WebCore::AVAssetMIMETypeCache::canDecodeExtendedType):
2816
2817 2020-02-18  Antti Koivisto  <antti@apple.com>
2818
2819         [macOS] Don't fire timers when there is a pending rendering update
2820         https://bugs.webkit.org/show_bug.cgi?id=207889
2821
2822         Reviewed by Simon Fraser.
2823
2824         * WebCore.xcodeproj/project.pbxproj:
2825         * dom/WindowEventLoop.cpp:
2826         (WebCore::WindowEventLoop::breakToAllowRenderingUpdate):
2827
2828         Add the exported interface to WindowEventLoop as the future direction is to do everything via it.
2829         For now it just calls into ThreadTimers rather than doing anything with the event loop itself.
2830
2831         * dom/WindowEventLoop.h:
2832         * platform/ThreadTimers.cpp:
2833         (WebCore::ThreadTimers::sharedTimerFiredInternal):
2834         (WebCore::ThreadTimers::breakFireLoopForRenderingUpdate):
2835
2836         If we are in a firing timer set a flag so that no more timers are fired during the current runloop cycle.
2837
2838         * platform/ThreadTimers.h:
2839
2840 2020-02-18  Youenn Fablet  <youenn@apple.com>
2841
2842         Remove PlatformMediaSessionClient dependency on Document
2843         https://bugs.webkit.org/show_bug.cgi?id=207892
2844
2845         Reviewed by Eric Carlson.
2846
2847         Move DocumentIdentifier to Platform folder.
2848         Use DocumentIdentifier instead of Document in PlatformMediaSession/Manager.
2849         No change of behavior.
2850
2851         * Headers.cmake:
2852         * Modules/mediastream/MediaStreamTrack.cpp:
2853         (WebCore::MediaStreamTrack::hostingDocumentIdentifier const):
2854         * Modules/mediastream/MediaStreamTrack.h:
2855         * Modules/webaudio/AudioContext.cpp:
2856         (WebCore::AudioContext::hostingDocumentIdentifier const):
2857         (WebCore::AudioContext::hostingDocument const): Deleted.
2858         * Modules/webaudio/AudioContext.h:
2859         * WebCore.xcodeproj/project.pbxproj:
2860         * dom/Document.cpp:
2861         (WebCore::Document::stopAllMediaPlayback):
2862         (WebCore::Document::suspendAllMediaPlayback):
2863         (WebCore::Document::resumeAllMediaPlayback):
2864         (WebCore::Document::suspendAllMediaBuffering):
2865         (WebCore::Document::resumeAllMediaBuffering):
2866         * html/HTMLMediaElement.h:
2867         * platform/DocumentIdentifier.h: Renamed from Source/WebCore/dom/DocumentIdentifier.h.
2868         * platform/audio/PlatformMediaSession.cpp:
2869         (WebCore::PlatformMediaSession::PlatformMediaSession):
2870         * platform/audio/PlatformMediaSession.h:
2871         * platform/audio/PlatformMediaSessionManager.cpp:
2872         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForDocument):
2873         (WebCore::PlatformMediaSessionManager::suspendAllMediaPlaybackForDocument):
2874         (WebCore::PlatformMediaSessionManager::resumeAllMediaPlaybackForDocument):
2875         (WebCore::PlatformMediaSessionManager::suspendAllMediaBufferingForDocument):
2876         (WebCore::PlatformMediaSessionManager::resumeAllMediaBufferingForDocument):
2877         (WebCore::PlatformMediaSessionManager::sessionsMatching const):
2878         (WebCore::PlatformMediaSessionManager::forEachDocumentSession):
2879         * platform/audio/PlatformMediaSessionManager.h:
2880
2881 2020-02-18  Zalan Bujtas  <zalan@apple.com>
2882
2883         [LFC][Quirk] Add additional escape reason to cover the case when body needs access to both the body and the ICB geometry
2884         https://bugs.webkit.org/show_bug.cgi?id=207869
2885         <rdar://problem/59531225>
2886
2887         Reviewed by Antti Koivisto.
2888
2889         Test: fast/layoutformattingcontext/out-of-flow-html-and-body-stretches-to-viewport.html
2890
2891         When the body is stretched all the way to the ICB, we have to read both the document box's and the ICB's geometry.
2892         This patch also refactors Quirks::stretchedInFlowHeight a bit to decouple the document and the body cases.
2893
2894         * layout/FormattingContext.cpp:
2895         (WebCore::Layout::FormattingContext::geometryForBox const):
2896         * layout/FormattingContext.h:
2897         * layout/blockformatting/BlockFormattingContext.h:
2898         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2899         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
2900         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
2901         (WebCore::Layout::BlockFormattingContext::Quirks::needsStretching const):
2902         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
2903
2904 2020-02-18  Per Arne Vollan  <pvollan@apple.com>
2905
2906         Move [UIDevice currentDevice] calls to UI process
2907         https://bugs.webkit.org/show_bug.cgi?id=204320
2908
2909         Reviewed by Darin Adler.
2910
2911         Calling [UIDevice currentDevice] will cause the runningboard daemon to be accessed. Since this service will be removed from
2912         the WebContent sandbox, these calls should be moved to the UI process. The function exernalDeviceDisplayNameForPlayer in
2913         MediaPlayerPrivateAVFoundationObjC.mm is calling [[PAL::getUIDeviceClass() currentDevice] localizedModel], which should be
2914         moved to the UI process.
2915
2916         API test: WebKit.LocalizedDeviceName
2917
2918         * SourcesCocoa.txt:
2919         * WebCore.xcodeproj/project.pbxproj:
2920         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2921         (WebCore::exernalDeviceDisplayNameForPlayer):
2922         * platform/ios/LocalizedDeviceModel.h: Added.
2923         * platform/ios/LocalizedDeviceModel.mm: Added.
2924         (WebCore::cachedLocalizedDeviceModel):
2925         (WebCore::localizedDeviceModel):
2926         (WebCore::setLocalizedDeviceModel):
2927
2928 2020-02-18  Youenn Fablet  <youenn@apple.com>
2929
2930         Use more ObjectIdentifier in WebRTC MDNS register
2931         https://bugs.webkit.org/show_bug.cgi?id=207548
2932
2933         Reviewed by Eric Carlson.
2934
2935         Pass document identifiers instead of uint64_t to mdns register.
2936         No change of behavior.
2937
2938         * Modules/mediastream/PeerConnectionBackend.cpp:
2939         (WebCore::PeerConnectionBackend::registerMDNSName):
2940         * dom/Document.cpp:
2941         (WebCore::Document::prepareForDestruction):
2942         (WebCore::Document::suspend):
2943         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2944
2945 2020-02-18  Kate Cheney  <katherine_cheney@apple.com>
2946
2947         Web socket loads should be captured for logging per-page prevalent domains
2948         https://bugs.webkit.org/show_bug.cgi?id=207840
2949         <rdar://problem/59511746>
2950
2951         Reviewed by Chris Dumez.
2952
2953         Test: http/tests/websocket/web-socket-loads-captured-in-per-page-domains.html
2954
2955         Captures a domain connection via WebSocket to check if it should be
2956         logged as a prevalent resource.
2957
2958         * Modules/websockets/WebSocket.cpp:
2959         (WebCore::WebSocket::connect):
2960
2961 2020-02-18  Simon Fraser  <simon.fraser@apple.com>
2962
2963         Move from "layer flush" terminology to "rendering update"
2964         https://bugs.webkit.org/show_bug.cgi?id=207870
2965
2966         Reviewed by Tim Horton.
2967
2968         Rename various functions and member variables to move away from the legacy "layer flush"
2969         terminology and instead use "rendering update", matching Page::updateRendering(). The fact
2970         that we have layers is an implementation detail.
2971         
2972         Change LayerFlushThrottlingState to be an OptionSet<>.
2973
2974         * Headers.cmake:
2975         * WebCore.xcodeproj/project.pbxproj:
2976         * dom/Document.cpp:
2977         (WebCore::Document::scheduleStyleRecalc):
2978         (WebCore::Document::shouldScheduleLayout):
2979         * loader/EmptyClients.h:
2980         * page/ChromeClient.h:
2981         (WebCore::ChromeClient::renderingUpdateThrottlingIsActive const):
2982         (WebCore::ChromeClient::adjustRenderUpdateThrottling):
2983         (WebCore::ChromeClient::layerFlushThrottlingIsActive const): Deleted.
2984         (WebCore::ChromeClient::adjustLayerFlushThrottling): Deleted.
2985         * page/FrameView.cpp:
2986         (WebCore::determineLayerFlushThrottleState):
2987         (WebCore::FrameView::disableLayerFlushThrottlingTemporarilyForInteraction):
2988         (WebCore::FrameView::updateLayerFlushThrottling):
2989         * page/RenderingUpdateScheduler.cpp:
2990         (WebCore::RenderingUpdateScheduler::scheduleImmediateRenderingUpdate):
2991         * page/RenderingUpdateThrottleState.h: Renamed from Source/WebCore/page/LayerFlushThrottleState.h.
2992
2993 2020-02-18  Chris Dumez  <cdumez@apple.com>
2994
2995         ASSERT_NOT_REACHED() under WebPageProxy::suspendCurrentPageIfPossible()
2996         https://bugs.webkit.org/show_bug.cgi?id=207868
2997         <rdar://problem/59464606>
2998
2999         Reviewed by John Wilander.
3000
3001         Test: http/tests/navigation/process-swap-on-client-side-redirect-private.html
3002
3003         * loader/HistoryController.cpp:
3004         (WebCore::HistoryController::updateForSameDocumentNavigation):
3005         Methods in HistoryController avoids updating visited links and calling updateGlobalHistory()
3006         on the FrameLoaderClient when in an ephemeral session. However, updateForSameDocumentNavigation()
3007         was returning early in ephemeral sessions, which was overly aggressive and bypasses things we
3008         really need to do, like updating the current HistoryItem's url.
3009
3010 2020-02-18  Zalan Bujtas  <zalan@apple.com>
3011
3012         [LFC][IFC] Add missing float check in inline line layout
3013         https://bugs.webkit.org/show_bug.cgi?id=207878
3014         <rdar://problem/59537467>
3015
3016         Reviewed by Antti Koivisto.
3017
3018         Test: fast/layoutformattingcontext/float-in-inline-context-simple.html
3019
3020         Make sure float content gets laid out as well. 
3021
3022         * layout/inlineformatting/InlineFormattingContext.cpp:
3023         (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
3024         * layout/inlineformatting/LineLayoutContext.cpp:
3025         (WebCore::Layout::isAtSoftWrapOpportunity):
3026         (WebCore::Layout::nextWrapOpportunity):
3027
3028 2020-02-18  Jacob Uphoff  <jacob_uphoff@apple.com>
3029
3030         Unreviewed, rolling out r256804.
3031
3032         This broke 50+ media tests on mac debug
3033
3034         Reverted changeset:
3035
3036         "MediaSource.isTypeSupported() says
3037         "video/mp4;codecs=\"avc3.42C015\"" is not supported, but it
3038         is"
3039         https://bugs.webkit.org/show_bug.cgi?id=207622
3040         https://trac.webkit.org/changeset/256804
3041
3042 2020-02-18  Zalan Bujtas  <zalan@apple.com>
3043
3044         [LFC][TreeBuilding] Take createLineBreakBox's return value
3045         https://bugs.webkit.org/show_bug.cgi?id=207879
3046         <rdar://problem/59537585>
3047
3048         Reviewed by Antti Koivisto.
3049
3050         Test: fast/layoutformattingcontext/br-in-inline-content-simple.html
3051
3052         * layout/layouttree/LayoutTreeBuilder.cpp:
3053         (WebCore::Layout::TreeBuilder::createLayoutBox):
3054
3055 2020-02-18  Oriol Brufau  <obrufau@igalia.com>
3056
3057         [css-grid] Improve performance of track sizing algorithm for spanning items
3058         https://bugs.webkit.org/show_bug.cgi?id=207852
3059
3060         Reviewed by Javier Fernandez.
3061
3062         Calculating the used sizing function for a track is not a very expensive
3063         operation, but it's not trivial either, and the track sizing algorithm
3064         needs to access sizing functions all over the place. This ends up having
3065         a performance cost, especially for spanning items.
3066
3067         Intrinsic contributions from items that span a single track are handled
3068         in a simpler way than when the span is greater than 1. In the former
3069         case, SizeTrackToFitNonSpanningItem only calculates the track sizing
3070         function of each track once per each item in that track. But in the
3071         latter case we not only calculate the track sizing function of multiple
3072         tracks per item, we also repeat this 5 times in order to handle the
3073         various TrackSizeComputationPhase.
3074
3075         Therefore, to increase performance, this patch caches the used track
3076         sizing functions in the tracks themselves.
3077
3078         This is a port of these Chromium patches:
3079         - https://chromium-review.googlesource.com/c/chromium/src/+/1901292
3080         - https://chromium-review.googlesource.com/c/chromium/src/+/1919140
3081         - https://chromium-review.googlesource.com/c/chromium/src/+/1940107
3082
3083         Chromium has a auto-grid-lots-of-spanning-data perf test. In WebKit, its
3084         performance improves by 40% with this patch.
3085
3086         * rendering/GridTrackSizingAlgorithm.cpp:
3087         (WebCore::GridTrack::setCachedTrackSize):
3088         (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem):
3089         (WebCore::GridTrackSizingAlgorithm::spanningItemCrossesFlexibleSizedTracks const):
3090         (WebCore::GridTrackSizingAlgorithm::increaseSizesToAccommodateSpanningItems):
3091         (WebCore::GridTrackSizingAlgorithm::estimatedGridAreaBreadthForChild const):
3092         (WebCore::GridTrackSizingAlgorithm::isIntrinsicSizedGridArea const):
3093         (WebCore::GridTrackSizingAlgorithm::calculateGridTrackSize const):
3094         (WebCore::GridTrackSizingAlgorithm::computeFlexFactorUnitSize const):
3095         (WebCore::GridTrackSizingAlgorithm::computeFlexSizedTracksGrowth const):
3096         (WebCore::GridTrackSizingAlgorithm::findFrUnitSize const):
3097         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
3098         (WebCore::normalizedFlexFraction):
3099         (WebCore::IndefiniteSizeStrategy::findUsedFlexFraction const):
3100         (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):
3101         (WebCore::GridTrackSizingAlgorithm::tracksAreWiderThanMinTrackBreadth const):
3102         * rendering/GridTrackSizingAlgorithm.h:
3103         (WebCore::GridTrack::cachedTrackSize const):
3104
3105 2020-02-18  Chris Lord  <clord@igalia.com>
3106
3107         [ARM] Build failure on arm due to invalid use of incomplete type 'class WebCore::ImageData' in FEBlendNEON.h
3108         https://bugs.webkit.org/show_bug.cgi?id=207885
3109
3110         Reviewed by Carlos Alberto Lopez Perez.
3111
3112         No new tests, no functional change.
3113
3114         * platform/graphics/cpu/arm/filters/FEBlendNEON.h:
3115
3116 2020-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>
3117
3118         [WPE] Add support for rendering progress bars
3119         https://bugs.webkit.org/show_bug.cgi?id=207688
3120
3121         Reviewed by Adrian Perez de Castro.
3122
3123         * platform/wpe/RenderThemeWPE.cpp:
3124         (WebCore::RenderThemeWPE::animationRepeatIntervalForProgressBar const):
3125         (WebCore::RenderThemeWPE::animationDurationForProgressBar const):
3126         (WebCore::RenderThemeWPE::progressBarRectForBounds const):
3127         (WebCore::RenderThemeWPE::paintProgressBar):
3128         * platform/wpe/RenderThemeWPE.h:
3129
3130 2020-02-18  Carlos Garcia Campos  <cgarcia@igalia.com>
3131
3132         [WPE] Add support for rendering spin buttons
3133         https://bugs.webkit.org/show_bug.cgi?id=207686
3134
3135         Reviewed by Adrian Perez de Castro.
3136
3137         * platform/wpe/RenderThemeWPE.cpp:
3138         (WebCore::RenderThemeWPE::popupInternalPaddingBox const): Rename arrowSize as menuListButtonArrowSize.
3139         (WebCore::RenderThemeWPE::paintMenuList): Use ThemeWPE::paintArrow().
3140         * platform/wpe/ThemeWPE.cpp:
3141         (WebCore::ThemeWPE::paintArrow): Moved from RenderThemeWPE and added direction parameter.
3142         (WebCore::ThemeWPE::controlSize const): Set size of spin buttons.
3143         (WebCore::ThemeWPE::paint): Call paintSpinButton() for spin buttons.
3144         (WebCore::ThemeWPE::paintSpinButton): Paint the buttons.
3145         * platform/wpe/ThemeWPE.h:
3146
3147 2020-02-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
3148
3149         Make ImageBuffer::getImageData() and putImageData() return and take ImageData
3150         https://bugs.webkit.org/show_bug.cgi?id=206621
3151
3152         Reviewed by Tim Horton.
3153
3154         -- Combine ImageBuffer::getUnmultipliedImageData() and getPremultipliedImageData()
3155            in one function and name it getImageData();
3156
3157         -- Make getImageData() returns a RefPtr<ImageData> since the canvas code
3158            used to encapsulate the returned the returned Uint8ClampedArray into
3159            an ImageData and send it to JavaScriptCore.
3160
3161         -- Rename ImageBuffer::putByteArray() to ImageBuffer::putImageData() and
3162            make it take an ImageData since the byte array has to be associated
3163            with an IntSize and separating them does not look a good design.
3164
3165         -- Remove the enum ImageBuffer::CoordinateSystem. All the callers need to
3166            pass rectangles and sizes in logical coordinates. The ImageData has to
3167            be scaled according to the ImgeBuffer::resolutionScale(). 
3168
3169         * bindings/js/SerializedScriptValue.cpp:
3170         (WebCore::CloneSerializer::dumpImageBitmap):
3171         (WebCore::CloneDeserializer::readImageBitmap):
3172         * html/canvas/CanvasRenderingContext2DBase.cpp:
3173         (WebCore::CanvasRenderingContext2DBase::getImageData const):
3174         (WebCore::CanvasRenderingContext2DBase::putImageData):
3175         * html/canvas/CanvasRenderingContext2DBase.h:
3176         * page/PageConsoleClient.cpp:
3177         (WebCore::PageConsoleClient::screenshot):
3178         * platform/graphics/ImageBuffer.cpp:
3179         (WebCore::ImageBuffer::convertToLuminanceMask):
3180         (WebCore::ImageBuffer::transformColorSpace): Deleted.
3181         Move this function to ImageBufferCairo.cpp.
3182
3183         (WebCore::ImageBuffer::genericConvertToLuminanceMask): Deleted.
3184         convertToLuminanceMask() and genericConvertToLuminanceMask() are not 
3185         overridden by any platform. So delete genericConvertToLuminanceMask() and
3186         move its body to convertToLuminanceMask().
3187
3188         * platform/graphics/ImageBuffer.h:
3189         (WebCore::ImageBuffer::draw):
3190         (WebCore::ImageBuffer::drawPattern):
3191         (WebCore::ImageBuffer::drawConsuming):
3192         (WebCore::ImageBuffer::putImageData):
3193         Make the private functions be public and remove the friend classes.
3194
3195         * platform/graphics/ShadowBlur.cpp:
3196         (WebCore::ShadowBlur::blurShadowBuffer):
3197         * platform/graphics/cairo/ImageBufferCairo.cpp:
3198         (WebCore::ImageBuffer::transformColorSpace):
3199         (WebCore::getData):
3200         (WebCore::ImageBuffer::getImageData const):
3201         (WebCore::ImageBuffer::putImageData):
3202         (WebCore::getImageData): Deleted.
3203         (WebCore::logicalUnit): Deleted.
3204         (WebCore::backingStoreUnit): Deleted.
3205         (WebCore::ImageBuffer::getUnmultipliedImageData const): Deleted.
3206         (WebCore::ImageBuffer::getPremultipliedImageData const): Deleted.
3207         (WebCore::ImageBuffer::putByteArray): Deleted.
3208         * platform/graphics/cg/ImageBufferCG.cpp:
3209         (WebCore::ImageBuffer::getImageData const):
3210         (WebCore::ImageBuffer::putImageData):
3211         (WebCore::ImageBuffer::toCFData const):
3212         (WebCore::ImageBuffer::getUnmultipliedImageData const): Deleted.
3213         (WebCore::ImageBuffer::getPremultipliedImageData const): Deleted.
3214         (WebCore::ImageBuffer::putByteArray): Deleted.
3215         * platform/graphics/cg/ImageBufferDataCG.cpp:
3216         (WebCore::ImageBufferData::getData const):
3217         (WebCore::ImageBufferData::putData):
3218         * platform/graphics/cg/ImageBufferDataCG.h:
3219         All the rectangles and sizes have to be passed in logical coordinates. To
3220         deal with the pixels' data we need to scale them by the resolutionScale().
3221
3222         * platform/graphics/cpu/arm/filters/FEBlendNEON.h:
3223         (WebCore::FEBlend::platformApplySoftware):
3224         * platform/graphics/filters/FEColorMatrix.cpp:
3225         (WebCore::FEColorMatrix::platformApplySoftware):
3226         * platform/graphics/filters/FEComponentTransfer.cpp:
3227         (WebCore::FEComponentTransfer::platformApplySoftware):
3228         * platform/graphics/filters/FEComposite.cpp:
3229         (WebCore::FEComposite::platformApplySoftware):
3230         * platform/graphics/filters/FEConvolveMatrix.cpp:
3231         (WebCore::FEConvolveMatrix::platformApplySoftware):
3232         * platform/graphics/filters/FEDisplacementMap.cpp:
3233         (WebCore::FEDisplacementMap::platformApplySoftware):
3234         * platform/graphics/filters/FEDropShadow.cpp:
3235         (WebCore::FEDropShadow::platformApplySoftware):
3236         This was the only place which was passing a rectangle in a the back-end
3237         coordinates along with BackingStoreCoordinateSystem. Instead we can pass
3238         the rectangle in logical coordinates and then use ImageData::size() since
3239         it must be scaled with resolutionScale() when the ImageData is created.
3240
3241         * platform/graphics/filters/FEGaussianBlur.cpp:
3242         (WebCore::FEGaussianBlur::platformApplySoftware):
3243         * platform/graphics/filters/FELighting.cpp:
3244         (WebCore::FELighting::platformApplySoftware):
3245         * platform/graphics/filters/FEMorphology.cpp:
3246         (WebCore::FEMorphology::platformApplySoftware):
3247         * platform/graphics/filters/FETurbulence.cpp:
3248         (WebCore::FETurbulence::platformApplySoftware):
3249         * platform/graphics/filters/FilterEffect.cpp:
3250         (WebCore::FilterEffect::forceValidPreMultipliedPixels):
3251         (WebCore::FilterEffect::imageBufferResult):
3252         (WebCore::FilterEffect::copyUnmultipliedResult):
3253         (WebCore::FilterEffect::copyPremultipliedResult):
3254         (WebCore::FilterEffect::createImageBufferResult):
3255         (WebCore::FilterEffect::createUnmultipliedImageResult):
3256         (WebCore::FilterEffect::createPremultipliedImageResult):
3257         * platform/graphics/filters/FilterEffect.h:
3258         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
3259         (WebCore::ImageBufferData::getData const):
3260         (WebCore::ImageBufferData::putData):
3261         * platform/graphics/win/ImageBufferDataDirect2D.h:
3262         * platform/graphics/win/ImageBufferDirect2D.cpp:
3263         (WebCore::ImageBuffer::getImageData const):
3264         (WebCore::ImageBuffer::putImageData):
3265         (WebCore::ImageBuffer::getUnmultipliedImageData const): Deleted.
3266         (WebCore::ImageBuffer::getPremultipliedImageData const): Deleted.
3267         (WebCore::ImageBuffer::putByteArray): Deleted.
3268         * rendering/shapes/Shape.cpp:
3269         (WebCore::Shape::createRasterShape):
3270
3271 2020-02-17  Wenson Hsieh  <wenson_hsieh@apple.com>
3272
3273         Selection cannot be modified via text interaction in some areas of the compose body field in Gmail
3274         https://bugs.webkit.org/show_bug.cgi?id=207854
3275         <rdar://problem/59218824>
3276
3277         Reviewed by Tim Horton.
3278
3279         Currently, several codepaths that are consulted when performing text interaction gestures on iOS to make and
3280         modify text selections (e.g. double taps and long presses) rely on Frame::visiblePositionForPoint to map the
3281         touch location to a visible editing position on the page. visiblePositionForPoint uses the hit-testing option
3282         AllowChildFrameContent, which allows it to find and select text within subframes. However, this option also
3283         includes content in hidden ("visibility: hidden;") frames. This means that text selection gestures on iOS are
3284         unable to find otherwise selectable text, if a hidden child frame overlaps the text.
3285
3286         To fix this, we instead use the AllowVisibleChildFrameContentOnly hit-testing option, which will ignore such
3287         hidden subframes.
3288
3289         Test: editing/selection/ios/select-text-under-hidden-subframe.html
3290
3291         * page/Frame.cpp:
3292         (WebCore::Frame::visiblePositionForPoint const):
3293
3294 2020-02-17  Chris Dumez  <cdumez@apple.com>
3295
3296         [WK2][Cocoa] Implement in-WebProcess cookie cache to avoid sync IPC for document.cookie in most cases
3297         https://bugs.webkit.org/show_bug.cgi?id=207593
3298         <rdar://problem/56027027>
3299
3300         Reviewed by Antti Koivisto.
3301
3302         Implement in-WebProcess DOM cookie cache for serving `document.cookie` requests from JavaScript.
3303
3304         The first time document.cookie is called for a given host, the WebProcess will pull in all the
3305         non-HTTPOnly cookies for that host from the NetworkProcess (still via sync IPC) and store them
3306         in an in-memory cookie store. Later document.cookie calls for this host from this WebProcess
3307         will then leverage the in-memory cookie store and avoid doing a sync IPC to the NetworkProcess
3308         entirely.
3309
3310         To maintain the in-process cookie store up-to-date, the WebProcess subscribe for cookie-change
3311         notifications from the NetworkProcess, only for the hosts it is interested in.
3312
3313         If the page's JavaScript sets a cookie by setting document.cookie, we will not invalidate the
3314         cache for performance reasons. Instead, we set the cookie in our in-memory cookie before
3315         sending the new cookie to the NetworkProcess.
3316
3317         For compatibility reasons, any sync IPC to a given host will currently invalidate the cookie
3318         cache for this host. This is because this synchronous load may cause cookies to get set
3319         synchronously and the page could access document.cookie right after the sync XHR. This behavior
3320         is covered by the following existing test:
3321         - http/tests/cookies/sync-xhr-set-cookie-invalidates-cache.html
3322
3323         Another limitation of the current implementation of the cookie cache is that it is currently
3324         only leveraged for first party content. This is suboptimal and could be improved in a later
3325         iteration. However, the default behavior in Safari is that third-party iframes do not have
3326         cookie access unless they request it using the storage access API. We also currently have
3327         a limit of 5 hosts with cached cookies per WebProcess.
3328
3329         Tests: http/tests/cookies/document-cookie-after-showModalDialog.html
3330                http/tests/cookies/document-cookie-during-iframe-parsing.html
3331
3332         * dom/Document.cpp:
3333         (WebCore::Document::didLoadResourceSynchronously):
3334         * dom/Document.h:
3335         * dom/ScriptExecutionContext.cpp:
3336         (WebCore::ScriptExecutionContext::didLoadResourceSynchronously):
3337         * dom/ScriptExecutionContext.h:
3338         * loader/CookieJar.h:
3339         * loader/ThreadableLoader.cpp:
3340         (WebCore::ThreadableLoader::loadResourceSynchronously):
3341         * page/MemoryRelease.cpp:
3342         (WebCore::releaseCriticalMemory):
3343         * page/Settings.yaml:
3344         * platform/network/NetworkStorageSession.h:
3345         (WebCore::CookieChangeObserver::~CookieChangeObserver):
3346         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3347         (WebCore::NetworkStorageSession::NetworkStorageSession):
3348         (WebCore::NetworkStorageSession::cookieStorage const):
3349         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
3350         (WebCore::NetworkStorageSession::~NetworkStorageSession):
3351         (WebCore::NetworkStorageSession::setCookie):
3352         (WebCore::NetworkStorageSession::setCookies):
3353         (WebCore::NetworkStorageSession::deleteCookie):
3354         (WebCore::nsCookiesToCookieVector):
3355         (WebCore::NetworkStorageSession::nsCookieStorage const):
3356         (WebCore::createPrivateStorageSession):
3357         (WebCore::NetworkStorageSession::httpCookies const):
3358         (WebCore::NetworkStorageSession::deleteHTTPCookie const):
3359         (WebCore::NetworkStorageSession::setHTTPCookiesForURL const):
3360         (WebCore::NetworkStorageSession::httpCookiesForURL const):
3361         (WebCore::filterCookies):
3362         (WebCore::NetworkStorageSession::cookiesForURL const):
3363         (WebCore::NetworkStorageSession::cookiesForSession const):
3364         (WebCore::NetworkStorageSession::cookiesForDOM const):
3365         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
3366         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
3367         (WebCore::NetworkStorageSession::getRawCookies const):
3368         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
3369         (WebCore::NetworkStorageSession::registerCookieChangeListenersIfNecessary):
3370         (WebCore::NetworkStorageSession::unregisterCookieChangeListenersIfNecessary):
3371         (WebCore::NetworkStorageSession::startListeningForCookieChangeNotifications):
3372         (WebCore::NetworkStorageSession::stopListeningForCookieChangeNotifications):
3373         (WebCore::NetworkStorageSession::domCookiesForHost):
3374         (WebCore::NetworkStorageSession::supportsCookieChangeListenerAPI const):
3375
3376 2020-02-17  Chris Dumez  <cdumez@apple.com>
3377
3378         Defer execution of async scripts until until the document is loaded
3379         https://bugs.webkit.org/show_bug.cgi?id=207698
3380         <rdar://problem/57625747>
3381
3382         Reviewed Antti Koivisto.
3383
3384         Defer execution of async scripts until until the document is loaded by default to reduce time
3385         to first paint.
3386
3387         * dom/ScriptElement.h:
3388         * dom/ScriptRunner.cpp:
3389         (WebCore::ScriptRunner::timerFired):
3390         Make sure we do not defer scripts that were not added by the parser and that do not have the
3391         'async' attribute set.
3392
3393         * page/Settings.yaml:
3394
3395 2020-02-17  Youenn Fablet  <youenn@apple.com>
3396
3397         Do not call whenReady callbacks in case of network process crash
3398         https://bugs.webkit.org/show_bug.cgi?id=207661
3399
3400         Reviewed by Chris Dumez.
3401
3402         * workers/service/WorkerSWClientConnection.cpp:
3403         (WebCore::WorkerSWClientConnection::~WorkerSWClientConnection):
3404         The callback is a Function so it is fine not calling it and calling it with a default value is not safe.
3405
3406 2020-02-17  Peng Liu  <peng.liu6@apple.com>
3407
3408         MediaSource.isTypeSupported() says "video/mp4;codecs=\"avc3.42C015\"" is not supported, but it is
3409         https://bugs.webkit.org/show_bug.cgi?id=207622
3410
3411         Reviewed by Eric Carlson.
3412
3413         Revert the behavior change of MediaPlayerPrivateMediaSourceAVFObjC::supportsType() in r253952.
3414
3415         * platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm:
3416         (WebCore::AVAssetMIMETypeCache::canDecodeExtendedType):
3417
3418 2020-02-17  Youenn Fablet  <youenn@apple.com>
3419
3420         WebSocketChannelInspector.cpp should include ProgressTracker.h
3421         https://bugs.webkit.org/show_bug.cgi?id=207862
3422
3423         Unreviewed, build fix.
3424
3425         * Modules/websockets/WebSocketChannelInspector.cpp:
3426
3427 2020-02-17  Mark Lam  <mark.lam@apple.com>
3428
3429         getVTablePointer() should return a const void*.
3430         https://bugs.webkit.org/show_bug.cgi?id=207871
3431         <rdar://problem/59525721>
3432
3433         Reviewed by Yusuke Suzuki.
3434
3435         * bindings/scripts/CodeGeneratorJS.pm:
3436         (GenerateImplementation):
3437         * bindings/scripts/test/JS/JSInterfaceName.cpp:
3438         (WebCore::toJSNewlyCreated):
3439         * bindings/scripts/test/JS/JSMapLike.cpp:
3440         (WebCore::toJSNewlyCreated):
3441         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
3442         (WebCore::toJSNewlyCreated):
3443         * bindings/scripts/test/JS/JSReadOnlySetLike.cpp:
3444         (WebCore::toJSNewlyCreated):
3445         * bindings/scripts/test/JS/JSSetLike.cpp:
3446         (WebCore::toJSNewlyCreated):
3447         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
3448         (WebCore::toJSNewlyCreated):
3449         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
3450         (WebCore::toJSNewlyCreated):
3451         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
3452         (WebCore::toJSNewlyCreated):
3453         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
3454         (WebCore::toJSNewlyCreated):
3455         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
3456         (WebCore::toJSNewlyCreated):
3457         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
3458         (WebCore::toJSNewlyCreated):
3459         * bindings/scripts/test/JS/JSTestEnabledForContext.cpp:
3460         (WebCore::toJSNewlyCreated):
3461         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
3462         (WebCore::toJSNewlyCreated):
3463         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
3464         (WebCore::toJSNewlyCreated):
3465         * bindings/scripts/test/JS/JSTestException.cpp:
3466         (WebCore::toJSNewlyCreated):
3467         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
3468         (WebCore::toJSNewlyCreated):
3469         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3470         (WebCore::toJSNewlyCreated):
3471         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
3472         (WebCore::toJSNewlyCreated):
3473         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
3474         (WebCore::toJSNewlyCreated):
3475         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
3476         (WebCore::toJSNewlyCreated):
3477         * bindings/scripts/test/JS/JSTestIterable.cpp:
3478         (WebCore::toJSNewlyCreated):
3479         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
3480         (WebCore::toJSNewlyCreated):
3481         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
3482         (WebCore::toJSNewlyCreated):
3483         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
3484         (WebCore::toJSNewlyCreated):
3485         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
3486         (WebCore::toJSNewlyCreated):
3487         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
3488         (WebCore::toJSNewlyCreated):
3489         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
3490         (WebCore::toJSNewlyCreated):
3491         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
3492         (WebCore::toJSNewlyCreated):
3493         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
3494         (WebCore::toJSNewlyCreated):
3495         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
3496         (WebCore::toJSNewlyCreated):
3497         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
3498         (WebCore::toJSNewlyCreated):
3499         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
3500         (WebCore::toJSNewlyCreated):
3501         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
3502         (WebCore::toJSNewlyCreated):
3503         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
3504         (WebCore::toJSNewlyCreated):
3505         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
3506         (WebCore::toJSNewlyCreated):
3507         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
3508         (WebCore::toJSNewlyCreated):
3509         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
3510         (WebCore::toJSNewlyCreated):
3511         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
3512         (WebCore::toJSNewlyCreated):
3513         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
3514         (WebCore::toJSNewlyCreated):
3515         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
3516         (WebCore::toJSNewlyCreated):
3517         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
3518         (WebCore::toJSNewlyCreated):
3519         * bindings/scripts/test/JS/JSTestNode.cpp:
3520         (WebCore::toJSNewlyCreated):
3521         * bindings/scripts/test/JS/JSTestObj.cpp:
3522         (WebCore::toJSNewlyCreated):
3523         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
3524         (WebCore::toJSNewlyCreated):
3525         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
3526         (WebCore::toJSNewlyCreated):
3527         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
3528         (WebCore::toJSNewlyCreated):
3529         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
3530         (WebCore::toJSNewlyCreated):
3531         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
3532         (WebCore::toJSNewlyCreated):
3533         * bindings/scripts/test/JS/JSTestSerialization.cpp:
3534         (WebCore::toJSNewlyCreated):
3535         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
3536         (WebCore::toJSNewlyCreated):
3537         * bindings/scripts/test/JS/JSTestStringifier.cpp:
3538         (WebCore::toJSNewlyCreated):
3539         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
3540         (WebCore::toJSNewlyCreated):
3541         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
3542         (WebCore::toJSNewlyCreated):
3543         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
3544         (WebCore::toJSNewlyCreated):
3545         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
3546         (WebCore::toJSNewlyCreated):
3547         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
3548         (WebCore::toJSNewlyCreated):
3549         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
3550         (WebCore::toJSNewlyCreated):
3551         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3552         (WebCore::toJSNewlyCreated):
3553
3554 2020-02-17  Rob Buis  <rbuis@igalia.com>
3555
3556         Main implementation for lazy image loading
3557         https://bugs.webkit.org/show_bug.cgi?id=200764
3558
3559         Reviewed by Darin Adler.
3560
3561         Implement lazy image loading as specified here [1]. Lazy image loading
3562         is controlled by the loading attribute on <img>. When the loading attribute is
3563         not specified, the behavior is like before this patch, i.e. loading is
3564         eager.
3565
3566         Not all loading=lazy requests will turn into actual lazy image loads, when
3567         scripting is turned off they will not be deferred [2].
3568
3569         This implementation relies on Intersection Observer and hence works on WK2 only.
3570
3571         Deferred images are painted using a simple outline until fully loaded.
3572
3573         [1] https://html.spec.whatwg.org/#attr-img-loading
3574         [2] https://html.spec.whatwg.org/#will-lazy-load-image-steps
3575
3576         Tests: http/tests/lazyload/attribute.html
3577                http/tests/lazyload/js-image.html
3578                http/tests/lazyload/lazy-image-load-in-iframes-scripting-disabled.html
3579                http/tests/lazyload/lazy-image-load-in-iframes-scripting-enabled.html
3580                http/tests/lazyload/lazy.html
3581                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/below-viewport-image-loading-lazy-load-event.html
3582                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/disconnected-image-loading-lazy.html
3583                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/iframe-loading-eager.html
3584                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/iframe-loading-lazy.html
3585                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-eager.html
3586                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-below-viewport-dynamic.html
3587                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-in-cross-origin-ifame-001.sub.html
3588                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-in-cross-origin-ifame-002.sub.html
3589                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-in-script-disabled-iframe.html
3590                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-in-viewport-dynamic.html
3591                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-load-event.html
3592                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-move-document.html
3593                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-move-into-script-disabled-iframe.html
3594                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-multicol.html
3595                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/image-loading-lazy.html
3596                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/invisible-image.html
3597                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/move-element-and-scroll.html
3598                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/not-rendered-below-viewport-image-loading-lazy.html
3599                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/not-rendered-image-loading-lazy.html
3600                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/original-base-url-applied-2.html
3601                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/original-base-url-applied-iframe.html
3602                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/original-base-url-applied.html
3603                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/original-crossorigin-applied.sub.html
3604                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/original-referrer-policy-applied.sub.html
3605                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/picture-loading-lazy.html
3606                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/remove-element-and-scroll.html
3607
3608         * Sources.txt:
3609         * WebCore.xcodeproj/project.pbxproj:
3610         * dom/Document.cpp:
3611         (WebCore::Document::lazyLoadImageObserver):
3612         * dom/Document.h:
3613         * html/HTMLImageElement.cpp:
3614         (WebCore::HTMLImageElement::HTMLImageElement):
3615         (WebCore::HTMLImageElement::create):
3616         (WebCore::HTMLImageElement::hasLazyLoadableAttributeValue):
3617         (WebCore::HTMLImageElement::parseAttribute):
3618         (WebCore::HTMLImageElement::loadDeferredImage):
3619         (WebCore::HTMLImageElement::didMoveToNewDocument):
3620         (WebCore::HTMLImageElement::loadingForBindings const):
3621         (WebCore::HTMLImageElement::setLoadingForBindings):
3622         (WebCore::HTMLImageElement::isDeferred const):
3623         (WebCore::HTMLImageElement::isLazyLoadable const):
3624         * html/HTMLImageElement.h:
3625         (WebCore::HTMLImageElement::createdByParser const): Deleted.
3626         * html/HTMLImageElement.idl:
3627         * html/HTMLInputElement.cpp:
3628         (WebCore::HTMLInputElement::didMoveToNewDocument):
3629         * html/HTMLPlugInImageElement.cpp:
3630         (WebCore::HTMLPlugInImageElement::didMoveToNewDocument):
3631         * html/HTMLTagNames.in:
3632         * html/HTMLVideoElement.cpp:
3633         (WebCore::HTMLVideoElement::didMoveToNewDocument):
3634         * html/LazyLoadImageObserver.cpp: Added.
3635         (WebCore::LazyLoadImageObserver::observe):
3636         (WebCore::LazyLoadImageObserver::unobserve):
3637         (WebCore::LazyLoadImageObserver::intersectionObserver):
3638         (WebCore::LazyLoadImageObserver::isObserved const):
3639         * html/LazyLoadImageObserver.h: Added.
3640         (WebCore::LazyLoadImageObserver::create):
3641         * html/parser/HTMLPreloadScanner.cpp:
3642         (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest):
3643         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
3644         * loader/ImageLoader.cpp:
3645         (WebCore::ImageLoader::updateFromElement):
3646         (WebCore::ImageLoader::notifyFinished):
3647         (WebCore::ImageLoader::elementDidMoveToNewDocument):
3648         (WebCore::ImageLoader::loadDeferredImage):
3649         * loader/ImageLoader.h:
3650         (WebCore::ImageLoader::isDeferred const):
3651         * loader/cache/CachedImage.h:
3652         * loader/cache/CachedResourceLoader.cpp:
3653         (WebCore::CachedResourceLoader::requestImage):
3654         (WebCore::CachedResourceLoader::requestResource):
3655         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
3656         (WebCore::CachedResourceLoader::clientDefersImage const):
3657         (WebCore::CachedResourceLoader::shouldDeferImageLoad const):
3658         (WebCore::CachedResourceLoader::reloadImagesIfNotDeferred):
3659         * loader/cache/CachedResourceLoader.h:
3660         * rendering/RenderImage.cpp:
3661         (WebCore::isDeferredImage):
3662         (WebCore::RenderImage::paintReplaced):
3663         * svg/SVGImageElement.cpp:
3664         (WebCore::SVGImageElement::didMoveToNewDocument):
3665
3666 2020-02-17  Zalan Bujtas  <zalan@apple.com>
3667
3668         Inline boxes for images that represent nothing should collapse to empty.
3669         https://bugs.webkit.org/show_bug.cgi?id=207740
3670         <rdar://problem/57339992>
3671
3672         Reviewed by Darin Adler.
3673
3674         Tests: fast/images/inline-image-box-with-no-alt-should-collapse-no-quirks.html
3675                fast/images/inline-image-box-with-no-alt-should-collapse-quirks.html
3676
3677         Let's collapse inline boxes when we would display a broken image only and
3678         1. alt attribute is explicitly set to empty and
3679         2. both height and width are auto or we are in standards mode.
3680
3681         https://html.spec.whatwg.org/multipage/rendering.html#images-3
3682
3683         * rendering/RenderImage.cpp:
3684         (WebCore::RenderImage::shouldCollapseToEmpty const):
3685         (WebCore::RenderImage::computeReplacedLogicalWidth const):
3686         (WebCore::RenderImage::computeReplacedLogicalHeight const):
3687         (WebCore::RenderImage::imageChanged):
3688         (WebCore::RenderImage::layout):
3689         * rendering/RenderImage.h:
3690
3691 2020-02-17  Peng Liu  <peng.liu6@apple.com>
3692
3693         Fix check-webkit-style errors related to AVFoundationSPI.h
3694         https://bugs.webkit.org/show_bug.cgi?id=207834
3695
3696         Reviewed by Eric Carlson.
3697
3698         No new tests, no functional change.
3699
3700         This patch fixes check-webkit-style errors, especially the ones related to soft-link headers.
3701         The soft-link headers should be included after other headers.
3702
3703         * platform/audio/ios/AudioSessionIOS.mm:
3704         * platform/audio/ios/MediaSessionManagerIOS.mm:
3705         * platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm:
3706         * platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.mm:
3707         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
3708         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
3709         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
3710         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
3711         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3712         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3713         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3714         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3715
3716 2020-02-17  Pinki Gyanchandani  <pgyanchandani@apple.com>
3717
3718         Null Ptr Deref @ WebCore::Node::Treescope
3719         https://bugs.webkit.org/show_bug.cgi?id=207748
3720
3721         Reviewed by Darin Adler.
3722
3723         Added a check for isTextField after updateLayoutIgnorePendingStylesheets as that could cause modification of input element type.
3724
3725         Test: editing/selection/ignore-selection-range-on-input-style-change.html
3726
3727         * html/HTMLTextFormControlElement.cpp:
3728         (WebCore::HTMLTextFormControlElement::setSelectionRange):
3729
3730 2020-02-17  Youenn Fablet  <youenn@apple.com>
3731
3732         Add WebInspector support to WebKit::WebSocketChannel
3733         https://bugs.webkit.org/show_bug.cgi?id=207794
3734
3735         Reviewed by Darin Adler.
3736
3737         Add a wrapper around Inspector for using it in WebInspector.
3738         This allows getting preliminary support of WebInspector for the new WebSocket path.
3739
3740         * Modules/websockets/WebSocketChannelInspector.cpp: Added.
3741         (WebCore::WebSocketChannelInspector::WebSocketChannelInspector):
3742         (WebCore::WebSocketChannelInspector::didCreateWebSocket):
3743         (WebCore::WebSocketChannelInspector::willSendWebSocketHandshakeRequest):
3744         (WebCore::WebSocketChannelInspector::didReceiveWebSocketHandshakeResponse):
3745         (WebCore::WebSocketChannelInspector::didCloseWebSocket):
3746         (WebCore::WebSocketChannelInspector::didReceiveWebSocketFrame):
3747         (WebCore::WebSocketChannelInspector::didSendWebSocketFrame):
3748         (WebCore::WebSocketChannelInspector::didReceiveWebSocketFrameError):
3749         * Modules/websockets/WebSocketChannelInspector.h: Added.
3750         * Modules/websockets/WebSocketFrame.h:
3751         * Sources.txt:
3752         * WebCore.xcodeproj/project.pbxproj:
3753
3754 2020-02-17  Youenn Fablet  <youenn@apple.com>
3755
3756         Validate scopeURL is valid when reading it from the database
3757         https://bugs.webkit.org/show_bug.cgi?id=207721
3758
3759         Reviewed by Darin Adler.
3760
3761         * workers/service/server/RegistrationDatabase.cpp:
3762         (WebCore::RegistrationDatabase::importRecords):
3763         In case scopeURL is not good, skip the registration, as done for other registration parameters.
3764
3765 2020-02-17  Zalan Bujtas  <zalan@apple.com>
3766
3767         [LFC][Out-of-flow] FormattingContext::computeOutOfFlowHorizontalGeometry needs verticalConstraints
3768         https://bugs.webkit.org/show_bug.cgi?id=207832
3769         <rdar://problem/59499844>
3770
3771         Reviewed by Dean Jackson.
3772
3773         Test: fast/layoutformattingcontext/simple-absolute-positioned-replaced-inline-element-with-percentage-height.html
3774
3775         Inline replaced width computation needs the value of the computed content height. In case of percentage value, in order to
3776         resolve it we need the containing block's height. At this point the containing block's vertical values are usually not
3777         computed yet, unless the current box happens to be an out-of-flow.
3778
3779         * layout/FormattingContext.cpp:
3780         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
3781         (WebCore::Layout::FormattingContext::layoutOutOfFlowContent):
3782         * layout/FormattingContext.h:
3783         * layout/FormattingContextGeometry.cpp:
3784         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry const):
3785         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin const):
3786         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
3787         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin const):
3788         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3789         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin const):
3790         * layout/inlineformatting/InlineFormattingContext.cpp:
3791         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin):
3792         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
3793         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
3794
3795 2020-02-17  Zalan Bujtas  <zalan@apple.com>
3796
3797         [LFC][IFC] LineLayoutContext::nextContentForLine should be able to handle regular inline boxes
3798         https://bugs.webkit.org/show_bug.cgi?id=207829
3799         <rdar://problem/59498031>
3800
3801         Reviewed by Antti Koivisto.
3802
3803         Test: fast/layoutformattingcontext/simple-inline-block.html
3804
3805         Add missing inline box handling.
3806
3807         * layout/inlineformatting/LineLayoutContext.cpp:
3808         (WebCore::Layout::LineLayoutContext::nextContentForLine):
3809
3810 2020-02-17  James Darpinian  <jdarpinian@chromium.org>
3811
3812         ANGLE: Fix object deletion behavior.
3813         https://bugs.webkit.org/show_bug.cgi?id=205610
3814
3815         Fixes WebGL conformance tests object-deletion-behavior.html and vertex-array-object.html.
3816
3817         Reviewed by Dean Jackson.
3818
3819         * html/canvas/WebGL2RenderingContext.cpp:
3820         (WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter):
3821             No error when getting attachment name with a null attachment.
3822         * html/canvas/WebGLObject.cpp:
3823         (WebCore::WebGLObject::deleteObject):
3824             Don't delay deleting objects when using ANGLE, becuase ANGLE handles object
3825             deletion correctly with WebGL semantics. This fixes some conformance tests
3826             including vertex-array-object.html.
3827         * html/canvas/WebGLObject.h:
3828         * html/canvas/WebGLRenderingContextBase.cpp:
3829         (WebCore::WebGLRenderingContextBase::checkObjectToBeBound):
3830             Always generate INVALID_OPERATION when the object is deleted.
3831         (WebCore::WebGLRenderingContextBase::validateAndCacheBufferBinding):
3832         (WebCore::WebGLRenderingContextBase::bindFramebuffer):
3833         (WebCore::WebGLRenderingContextBase::bindRenderbuffer):
3834         (WebCore::WebGLRenderingContextBase::bindTexture):
3835         (WebCore::WebGLRenderingContextBase::useProgram):
3836         * html/canvas/WebGLRenderingContextBase.h:
3837
3838 2020-02-17  Per Arne Vollan  <pvollan@apple.com>
3839
3840         Use CF prefs direct mode in the WebContent process
3841         https://bugs.webkit.org/show_bug.cgi?id=203420
3842
3843         Reviewed by Brent Fulgham.
3844
3845         Add Internals functions to read preferences.
3846
3847         API tests: Tests added in PreferenceChanges.mm.
3848
3849         * testing/Internals.cpp:
3850         (WebCore::Internals::readPreferenceInteger):
3851         (WebCore::Internals::encodedPreferenceValue):
3852         * testing/Internals.h:
3853         * testing/Internals.idl:
3854         * testing/Internals.mm:
3855         (WebCore::Internals::encodedPreferenceValue):
3856
3857 2020-02-17  Youenn Fablet  <youenn@apple.com>
3858
3859         Do not send the client URL to network process
3860         https://bugs.webkit.org/show_bug.cgi?id=207803
3861
3862         Reviewed by Darin Adler.
3863
3864         Instead of sending the client URL through threads and IPC, we can retrieve it in NetworkProcess from the client identifier.
3865         Implement this, as this is more efficient and safer.
3866         No change of behavior.
3867
3868         * workers/service/SWClientConnection.h:
3869         * workers/service/ServiceWorkerContainer.cpp:
3870         (WebCore::ServiceWorkerContainer::unregisterRegistration):
3871         * workers/service/WorkerSWClientConnection.cpp:
3872         (WebCore::WorkerSWClientConnection::scheduleUnregisterJobInServer):
3873         * workers/service/WorkerSWClientConnection.h:
3874         * workers/service/server/SWServer.cpp:
3875         (WebCore::SWServer::scheduleUnregisterJob):
3876         * workers/service/server/SWServer.h:
3877
3878 2020-02-17  Víctor Manuel Jáquez Leal  <vjaquez@igalia.com>
3879
3880         a lot gcc warnings because of %{public}s format specifier
3881         https://bugs.webkit.org/show_bug.cgi?id=207478
3882
3883         Reviewed by Darin Adler.
3884
3885         Add PUBLIC_LOG_STRING macro which is defined depending on if
3886         os_log()[1] is used or rather old printf().
3887
3888         OS Logging processes format specifiers for privacy matters, for
3889         example dynamic strings, which demands %{public}s. But these
3890         specifiers are not valid for printf().
3891
3892         Calls to logging with this specifier, if they are not Mac/Darwing
3893         exclusive, use this new macro to avoid gcc warnings.
3894
3895         1. https://developer.apple.com/documentation/os/logging?language=objc
3896
3897         No new tests. Covered by existing tests.
3898
3899         * loader/AdClickAttribution.cpp:
3900         (WebCore::AdClickAttribution::parseConversionRequest):
3901         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
3902         (WebCore::doReleaseLogging):
3903         * workers/service/server/RegistrationDatabase.cpp:
3904         (WebCore::RegistrationDatabase::openSQLiteDatabase):
3905
3906 2020-02-17  Sihui Liu  <sihui_liu@apple.com>
3907
3908         IndexedDB: index cursor iteration is slow when there are a lot of index records from different object stores
3909         https://bugs.webkit.org/show_bug.cgi?id=207377
3910         <rdar://problem/59288679>
3911
3912         Reviewed by Brady Eidson.
3913
3914         Make the Index of IndexRecords table include indexID since we always perform search with indexID.
3915         This would let SQLite optimize the index statement in SQLiteCursor with Covering Index and fix the slowness.
3916
3917         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
3918         (WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsIndex):
3919         (WebCore::IDBServer::v1IndexRecordsIndexSchema): Deleted.
3920
3921 2020-02-17  Zalan Bujtas  <zalan@apple.com>
3922
3923         [LFC] Remove ReplacedBox::m_layoutBox
3924         https://bugs.webkit.org/show_bug.cgi?id=207830
3925         <rdar://problem/59498829>
3926
3927         Reviewed by Antti Koivisto.
3928
3929         Test:&