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