[Async overflow scrolling] Absolute positioned element inside async overflow scroll...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-05-25  Simon Fraser  <simon.fraser@apple.com>
2
3         [Async overflow scrolling] Absolute positioned element inside async overflow scroll didn't get composited sometimes
4         https://bugs.webkit.org/show_bug.cgi?id=198237
5
6         Reviewed by Antti Koivisto.
7
8         The logic in requiresCompositingForIndirectReason() that decides if we need to do
9         compositing for a layer that needs to move independently of its enclosing scroller
10         was wrong.
11
12         Instead of asking question about the enclosing compositing layer, it needs to ask
13         whether it has different positioning behavior from the layer that it would
14         otherwise paint into, which is its paint-order parent.
15
16         "paintsIntoProvidedBacking" already does a containing-block check against the
17         scroller, so we know we don't have to do the check in that case.
18
19         Test: scrollingcoordinator/scrolling-tree/absolute-inside-stacking-in-scroller.html
20
21         * rendering/RenderLayerCompositor.cpp:
22         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
23         (WebCore::enclosingCompositedScrollingLayer):
24         (WebCore::isScrolledByOverflowScrollLayer):
25         (WebCore::isNonScrolledLayerInsideScrolledCompositedAncestor):
26         (WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const):
27         * rendering/RenderLayerCompositor.h:
28
29 2019-05-25  Simon Fraser  <simon.fraser@apple.com>
30
31         [macOS] Fix programmatic scroll in RTL overflow with async scrolling enabled
32         https://bugs.webkit.org/show_bug.cgi?id=198226
33
34         Reviewed by Antti Koivisto.
35
36         On macOS we need to use a scroll offset to set the layer position, not
37         a scroll position.
38
39         Test: scrollingcoordinator/mac/rtl-programmatic-overflow-scroll.html
40
41         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
42         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
43
44 2019-05-24  Joonghun Park  <jh718.park@samsung.com>
45
46         Make computed width of non-replaced inline return computed style.
47         https://bugs.webkit.org/show_bug.cgi?id=197814
48
49         Reviewed by Antti Koivisto.
50
51         Currently, Computed width of non-replaced inline incorrectly returns "auto"
52         instead of the computed value.
53         This patch changes the behavior according to
54         https://drafts.csswg.org/cssom/#resolved-value as below.
55
56         'If the property applies to the element or pseudo-element
57         and the resolved value of the display property is not none or contents,
58         then the resolved value is the used value.
59         Otherwise the resolved value is the computed value.'
60
61         * css/CSSComputedStyleDeclaration.cpp:
62         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
63
64 2019-05-24  Myles C. Maxfield  <mmaxfield@apple.com>
65
66         [WHLSL] Allow vertex attributes to have arbitrary names in the shader
67         https://bugs.webkit.org/show_bug.cgi?id=198235
68
69         Reviewed by Dean Jackson and Justin Fan.
70
71         Metal doesn't allow arbitrary vertex attribute IDs. If you try to create a vertex attribute > 16,
72         the Metal validation layer will assert. So, we need to have a mapping from whatever the WebGPU
73         API says the vertex attribute IDs should be to the internally-used vertex attribute IDs.
74
75         Test: webgpu/whlsl-arbitrary-vertex-attribute-locations.html
76
77         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
78         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::VertexEntryPointScaffolding):
79         * Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h:
80         * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp:
81         (WebCore::WHLSL::matchVertexAttributes):
82         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
83         (WebCore::convertRenderPipelineDescriptor):
84         (WebCore::trySetInputStateForPipelineDescriptor):
85
86 2019-05-24  Timothy Hatcher  <timothy@apple.com>
87
88         Refactor how showLetterpressedGlyphsWithAdvances gets the graphics context.
89         https://bugs.webkit.org/show_bug.cgi?id=198225
90
91         Reviewed by Dean Jackson.
92
93         * platform/graphics/cocoa/FontCascadeCocoa.mm:
94         (WebCore::showLetterpressedGlyphsWithAdvances):
95         (WebCore::FontCascade::drawGlyphs):
96
97 2019-05-24  Timothy Hatcher  <timothy@apple.com>
98
99         Plumb dark appearance down to GraphicsContext.
100         https://bugs.webkit.org/show_bug.cgi?id=198224
101         rdar://problem/51068494
102
103         Reviewed by Dean Jackson.
104
105         No test yet, as it is not testable until this gets used.
106
107         * platform/graphics/GraphicsContext.cpp:
108         (WebCore::GraphicsContextStateChange::changesFromState const):
109         (WebCore::GraphicsContextStateChange::accumulate):
110         (WebCore::GraphicsContextStateChange::apply const):
111         (WebCore::GraphicsContextStateChange::dump const):
112         (WebCore::GraphicsContext::setUseDarkAppearance):
113         * platform/graphics/GraphicsContext.h:
114         (WebCore::GraphicsContext::useDarkAppearance const):
115         * rendering/TextPaintStyle.cpp:
116         (WebCore::TextPaintStyle::operator== const):
117         (WebCore::computeTextPaintStyle):
118         (WebCore::updateGraphicsContext):
119         * rendering/TextPaintStyle.h:
120
121 2019-05-24  Youenn Fablet  <youenn@apple.com>
122
123         Make sure completion handler is always called in SWServer::startSuspension
124         https://bugs.webkit.org/show_bug.cgi?id=198215
125
126         Reviewed by Alex Christensen.
127
128         * workers/service/server/SWServer.cpp:
129         (WebCore::SWServer::startSuspension):
130         Make sure completion handler is called in case of no registration store.
131
132 2019-05-24  Ryosuke Niwa  <rniwa@webkit.org>
133
134         Asssertion failure in dispatchSubtreeModifiedEvent due to TextFieldInputType updating UA shadow tree inside Element::removedFromAncestor
135         https://bugs.webkit.org/show_bug.cgi?id=198216
136
137         Reviewed by Brent Fulgham.
138
139         The bug was caused by ListAttributeTargetObserver::idTargetChanged() updating the shadow tree of an input element
140         within Element::removedFromAncestor via TextFieldInputType::createDataListDropdownIndicator(). Fixed it by
141         supressing the assertions with ScriptDisallowedScope::EventAllowedScope since it's always safe to update
142         UA shadow trees of input elements as it's not exposed to author scripts.
143
144         Avoiding the creation of dropdown indicator in this particular scenario is a lot more involved and it's not
145         particularly correct because there could be another datalist element which matches the ID specified in list
146         content attribute after the removal of the old datalist element.
147
148         Test: fast/forms/datalist/datalist-removal-assertion.html
149
150         * html/TextFieldInputType.cpp:
151         (WebCore::TextFieldInputType::createDataListDropdownIndicator):
152         (WebCore::TextFieldInputType::createContainer):
153         * html/shadow/DataListButtonElement.cpp:
154         (WebCore::DataListButtonElement::DataListButtonElement):
155
156 2019-05-24  Saam barati  <sbarati@apple.com>
157
158         [WHLSL] ReadModifyWriteExpression always has a result and new value expression
159         https://bugs.webkit.org/show_bug.cgi?id=198079
160
161         Reviewed by Myles Maxfield.
162
163         Let's not pretend it might not.
164
165         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
166         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression):
167         (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression):
168         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeNewValueExpression):
169         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeResultExpression):
170         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
171         (WebCore::WHLSL::ASTDumper::visit):
172         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
173         (WebCore::WHLSL::Checker::visit):
174         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
175         (WebCore::WHLSL::PropertyResolver::visit):
176         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
177         (WebCore::WHLSL::Visitor::visit):
178
179 2019-05-23  Simon Fraser  <simon.fraser@apple.com>
180
181         With async overflow scrolling, programmatic scroll to a negative offset fails to clamp the scroll offset
182         https://bugs.webkit.org/show_bug.cgi?id=198208
183         <rdar://problem/49720087>
184
185         Reviewed by Zalan Bujtas.
186
187         RenderLayer::scrollToOffset() needs to pass the clamped offset to scrollingCoordinator->requestScrollPositionUpdate(),
188         otherwise the scrolling tree will round-trip a negative value and scrollLeft will end up negative.
189
190         Test: fast/scrolling/programmatic-scroll-to-negative-offset.html
191
192         * rendering/RenderLayer.cpp:
193         (WebCore::RenderLayer::scrollToOffset):
194
195 2019-05-23  Devin Rousso  <drousso@apple.com>
196
197         Web Inspector: Overlay: rulers/guides should be shown whenever element selection is enabled
198         https://bugs.webkit.org/show_bug.cgi?id=198088
199
200         Reviewed by Timothy Hatcher.
201
202         When trying to "measure" the absolute position (to the viewport) or relative position (to
203         another element) of a given element, often the easiest way is to enable Element Selection
204         and Show Rulers at the same time.
205
206         This can have the undesired "side-effect" of having the rulers be always present, even when
207         not highlighting any nodes.
208
209         The ideal functionality is to allow the rulers/guides to be shown when element selection is
210         active and a node is hovered, regardless of whether "Show Rulers" is enabled.
211
212         * inspector/InspectorOverlay.h:
213         (WebCore::InspectorOverlay::setShowRulersDuringElementSelection): Added.
214         * inspector/InspectorOverlay.cpp:
215         (WebCore::InspectorOverlay::paint):
216         (WebCore::InspectorOverlay::shouldShowOverlay):
217         (WebCore::InspectorOverlay::drawNodeHighlight):
218         (WebCore::InspectorOverlay::drawQuadHighlight):
219         (WebCore::InspectorOverlay::drawElementTitle):
220         If `showRulersDuringElementSelection` is enabled, draw rulers whenever any highlight bounds
221         are calculated, but don't update the overlay if it's the only thing enabled (e.g. if there's
222         no currently hovered node, the overlay will disappear).
223
224         * inspector/agents/InspectorDOMAgent.cpp:
225         (WebCore::InspectorDOMAgent::willDestroyFrontendAndBackend):
226         (WebCore::InspectorDOMAgent::inspect):
227         (WebCore::InspectorDOMAgent::setInspectModeEnabled):
228         (WebCore::InspectorDOMAgent::setSearchingForNode):
229         Add an optional `showRulers` parameter to `DOM.setInspectModeEnabled` that supersedes the
230         current value of `Page.setShowRulers` as to whether rulers/guides are shown.
231
232 2019-05-23  Devin Rousso  <drousso@apple.com>
233
234         Web Inspector: Overlay: rulers should switch sides if they intersect the highlighted node(s) so they don't obstruct any content
235         https://bugs.webkit.org/show_bug.cgi?id=198165
236
237         Reviewed by Timothy Hatcher.
238
239         If the highlighted node is against the top edge of the screen, the top ruler should shift to
240         the bottom, unless the highlighted node is also against the bottom edge of the screen.
241
242         If the highlighted node is against the left edge of the screen, the left ruler should shift
243         to the right, unless the highlighted node is also against the right edge of the screen.
244
245         This way, unless the node is very wide/tall, the rulers won't be drawn on top of anything
246         being highlighted.
247
248         * inspector/InspectorOverlay.h:
249         * inspector/InspectorOverlay.cpp:
250         (WebCore::InspectorOverlay::paint):
251         (WebCore::InspectorOverlay::drawNodeHighlight):
252         (WebCore::InspectorOverlay::drawQuadHighlight):
253         (WebCore::InspectorOverlay::drawBounds):
254         (WebCore::InspectorOverlay::drawRulers):
255         Drive-by: create an alias for the type (`FloatRect`) used when calculating the bounds of
256                   everything that's highlighted.
257
258 2019-05-23  Saam barati  <sbarati@apple.com>
259
260         [WHLSL] Make the AST dumper disambiguate expressions using parenthesis to represent AST construction
261         https://bugs.webkit.org/show_bug.cgi?id=198199
262
263         Reviewed by Myles C. Maxfield.
264
265         We would dump "*foo.bar" for "(*foo).bar", which is super confusing.
266         We now dump "(*foo).bar".
267
268         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
269         (WebCore::WHLSL::ASTDumper::visit):
270
271 2019-05-23  Saam barati  <sbarati@apple.com>
272
273         [WHLSL] Don't wrap anonymous variables in parens in the AST dumper
274         https://bugs.webkit.org/show_bug.cgi?id=198196
275
276         Reviewed by Myles C. Maxfield.
277
278         This makes the dump of 'foo.bar.x = 42' go from
279         ($(0x7f86d9d94440) = &foo, $(0x7f86d9d944e0) = operator.bar(*$(0x7f86d9d94440)), $(0x7f86d9d944e0) = operator.x=($(0x7f86d9d944e0), 42), *$(0x7f86d9d94440) = operator.bar=(*$(0x7f86d9d94440), $(0x7f86d9d944e0)));
280         
281         to:
282         ($0x7f86d9d94440 = &foo, $0x7f86d9d944e0 = operator.bar(*$0x7f86d9d94440), $0x7f86d9d944e0 = operator.x=($0x7f86d9d944e0, 42), *$0x7f86d9d94440 = operator.bar=(*$0x7f86d9d94440, $0x7f86d9d944e0));
283
284         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
285         (WebCore::WHLSL::ASTDumper::visit):
286
287 2019-05-23  Myles C. Maxfield  <mmaxfield@apple.com>
288
289         [WHLSL] Implement property resolver
290         https://bugs.webkit.org/show_bug.cgi?id=195925
291         <rdar://problem/48219643>
292
293         Unreviewed watchOS build fix.
294
295         * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h:
296         (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression):
297
298 2019-05-23  Saam barati  <sbarati@apple.com>
299
300         [WHLSL] Property resolver needs to recurse to handle the base when simplifying rvalues
301         https://bugs.webkit.org/show_bug.cgi?id=198193
302
303         Reviewed by Myles Maxfield.
304
305         We were only transforming the top most node in the AST. So things like
306         'x = foo.bar' would work, but 'x = foo.bar.baz' would not.
307
308         Test: webgpu/whlsl-nested-dot-expression-rvalue.html
309
310         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
311         (WebCore::WHLSL::PropertyResolver::simplifyRightValue):
312
313 2019-05-22  Stephanie Lewis  <slewis@apple.com>
314
315         release builds of webkit cannot be used to generate a dyld shared cache
316         https://bugs.webkit.org/show_bug.cgi?id=198150
317         <rdar://problem/50675982>
318
319         Reviewed by Dan Bernstein.
320
321         Restrict the -not_for_dyld_shared_cache linker flag to macosx
322
323         * Configurations/WebCore.xcconfig:
324
325 2019-05-23  Zalan Bujtas  <zalan@apple.com>
326
327         [Hittest] Move hittesting from RenderView to Document
328         https://bugs.webkit.org/show_bug.cgi?id=198192
329         <rdar://problem/51077762>
330
331         Reviewed by Antti Koivisto.
332
333         RenderView is not refcounted and may be destroyed in updateLayout(), so enter hit-testing from Document.
334
335         * accessibility/AccessibilityObject.cpp:
336         (WebCore::AccessibilityObject::press):
337         * accessibility/AccessibilityRenderObject.cpp:
338         (WebCore::AccessibilityRenderObject::visiblePositionForPoint const):
339         * dom/Document.cpp:
340         (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower):
341         (WebCore::FrameFlatteningLayoutDisallower::~FrameFlatteningLayoutDisallower):
342         (WebCore::Document::scheduleStyleRecalc):
343         (WebCore::Document::prepareMouseEvent):
344         (WebCore::Document::hitTest):
345         * dom/Document.h:
346         (WebCore::Document::inHitTesting const):
347         * dom/TreeScope.cpp:
348         (WebCore::TreeScope::nodeFromPoint):
349         (WebCore::TreeScope::elementsFromPoint):
350         * editing/FrameSelection.cpp:
351         (WebCore::FrameSelection::contains const):
352         * html/HTMLPlugInElement.cpp:
353         (WebCore::HTMLPlugInElement::isReplacementObscured):
354         * html/MediaElementSession.cpp:
355         (WebCore::isElementMainContentForPurposesOfAutoplay):
356         * page/DragController.cpp:
357         (WebCore::elementUnderMouse):
358         * page/EventHandler.cpp:
359         (WebCore::EventHandler::handleMouseDraggedEvent):
360         (WebCore::EventHandler::eventMayStartDrag const):
361         (WebCore::EventHandler::updateSelectionForMouseDrag):
362         (WebCore::EventHandler::hitTestResultAtPoint const):
363         (WebCore::EventHandler::updateCursor):
364         (WebCore::EventHandler::isInsideScrollbar const):
365         (WebCore::EventHandler::handleWheelEvent):
366         (WebCore::EventHandler::hoverTimerFired):
367         (WebCore::EventHandler::handleDrag):
368         (WebCore::hitTestResultInFrame):
369         * page/FrameViewLayoutContext.cpp:
370         (WebCore::FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange):
371         * rendering/RenderView.cpp:
372         (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower): Deleted.
373         (WebCore::FrameFlatteningLayoutDisallower::~FrameFlatteningLayoutDisallower): Deleted.
374         (): Deleted.
375         (WebCore::RenderView::hitTest): Deleted.
376         * rendering/RenderView.h:
377         * rendering/RenderWidget.cpp:
378         (WebCore::RenderWidget::nodeAtPoint):
379         * testing/Internals.cpp:
380         (WebCore::Internals::nodesFromRect const):
381
382 2019-05-23  Youenn Fablet  <youenn@apple.com>
383
384         CacheStorageConnection callbacks should be completed on network connection close
385         https://bugs.webkit.org/show_bug.cgi?id=195757
386
387         Reviewed by Alex Christensen.
388
389         Move HashMap-based callbacks to WorkerCacheStorageConnection.
390         Make CacheStorageConnection default API to implement use callbacks.
391         This is used by WebKit layer to do AsyncReply IPC.
392
393         Move DOMCacheEngine callbacks to CompletionHandler.
394
395         Test: http/wpt/cache-storage/cache-storage-networkprocess-crash.html
396
397         * Modules/cache/CacheStorageConnection.cpp:
398         * Modules/cache/CacheStorageConnection.h:
399         (WebCore::CacheStorageConnection::engineRepresentation):
400         * Modules/cache/DOMCacheEngine.h:
401         * Modules/cache/WorkerCacheStorageConnection.cpp:
402         (WebCore::recordsDataFromRecords):
403         (WebCore::recordsDataOrErrorFromRecords):
404         (WebCore::recordsFromRecordsData):
405         (WebCore::recordsOrErrorFromRecordsData):
406         (WebCore::WorkerCacheStorageConnection::open):
407         (WebCore::WorkerCacheStorageConnection::openOrRemoveCompleted):
408         (WebCore::WorkerCacheStorageConnection::remove):
409         (WebCore::WorkerCacheStorageConnection::retrieveCaches):
410         (WebCore::WorkerCacheStorageConnection::retrieveCachesCompleted):
411         (WebCore::WorkerCacheStorageConnection::retrieveRecords):
412         (WebCore::WorkerCacheStorageConnection::retrieveRecordsCompleted):
413         (WebCore::WorkerCacheStorageConnection::batchDeleteOperation):
414         (WebCore::WorkerCacheStorageConnection::deleteRecordsCompleted):
415         (WebCore::WorkerCacheStorageConnection::batchPutOperation):
416         (WebCore::WorkerCacheStorageConnection::putRecordsCompleted):
417         (WebCore::WorkerCacheStorageConnection::reference):
418         (WebCore::WorkerCacheStorageConnection::dereference):
419         (WebCore::WorkerCacheStorageConnection::clearPendingRequests):
420         * Modules/cache/WorkerCacheStorageConnection.h:
421         * page/CacheStorageProvider.h:
422         (WebCore::CacheStorageProvider::createCacheStorageConnection):
423
424 2019-05-23  Youenn Fablet  <youenn@apple.com>
425
426         Multiple videos (with audios) with autoplay & playinline not working. Only one video play at a time.
427         https://bugs.webkit.org/show_bug.cgi?id=193312
428         <rdar://problem/47189864>
429
430         Reviewed by Jer Noble.
431
432         Allow all MediaStream backed video elements to play together.
433         Any non MediaStream backed video will stop all MediaStream backed video elements.
434         Conversely, all non MediaStream backed videos will stop when playing one MediaStream backed video.
435
436         Refactor PlatformMediaSessionManager as the way to iterate through sessions
437         is not safe when pausing a session: if playing, the session will be moved in the array of sessions.
438
439         To handle this, copy the list of sessions before iterating through them.
440         For extra safety, make sessions WeakPtr.
441
442         Add routines for the case of filtering with a predicate taking a const session.
443         In that case, we do not copy the vector but iterate through it as a small optimization.
444
445         Test: webrtc/concurrentVideoPlayback.html
446
447         * html/HTMLMediaElement.cpp:
448         (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager):
449         (WebCore::HTMLMediaElement::hasMediaStreamSource const):
450         * html/HTMLMediaElement.h:
451         * platform/audio/PlatformMediaSession.cpp:
452         (WebCore::PlatformMediaSession::activeAudioSessionRequired const):
453         (WebCore::PlatformMediaSession::canPlayConcurrently const):
454         (WebCore::PlatformMediaSession::activeAudioSessionRequired): Deleted.
455         * platform/audio/PlatformMediaSession.h:
456         (WebCore::PlatformMediaSessionClient::hasMediaStreamSource const):
457         * platform/audio/PlatformMediaSessionManager.cpp:
458         (WebCore::PlatformMediaSessionManager::has const):
459         (WebCore::PlatformMediaSessionManager::activeAudioSessionRequired const):
460         (WebCore::PlatformMediaSessionManager::canProduceAudio const):
461         (WebCore::PlatformMediaSessionManager::count const):
462         (WebCore::PlatformMediaSessionManager::beginInterruption):
463         (WebCore::PlatformMediaSessionManager::endInterruption):
464         (WebCore::PlatformMediaSessionManager::addSession):
465         (WebCore::PlatformMediaSessionManager::removeSession):
466         (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback):
467         (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback):
468         (WebCore::PlatformMediaSessionManager::setCurrentSession):
469         (WebCore::PlatformMediaSessionManager::currentSession const):
470         (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive):
471         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive):
472         (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground):
473         (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground):
474         (WebCore::PlatformMediaSessionManager::systemWillSleep):
475         (WebCore::PlatformMediaSessionManager::systemDidWake):
476         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForDocument):
477         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForProcess):
478         (WebCore::PlatformMediaSessionManager::suspendAllMediaPlaybackForDocument):
479         (WebCore::PlatformMediaSessionManager::resumeAllMediaPlaybackForDocument):
480         (WebCore::PlatformMediaSessionManager::suspendAllMediaBufferingForDocument):
481         (WebCore::PlatformMediaSessionManager::resumeAllMediaBufferingForDocument):
482         (WebCore::PlatformMediaSessionManager::currentSessionsMatching const):
483         (WebCore::PlatformMediaSessionManager::forEachMatchingSession):
484         (WebCore::PlatformMediaSessionManager::forEachMatchingSession const):
485         (WebCore::PlatformMediaSessionManager::forEachSession):
486         (WebCore::PlatformMediaSessionManager::anyOfSessions const):
487         (): Deleted.
488         (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const): Deleted.
489         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const): Deleted.
490         (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const): Deleted.
491         (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const): Deleted.
492         (WebCore::PlatformMediaSessionManager::forEachSession const): Deleted.
493         (WebCore::PlatformMediaSessionManager::findSession const): Deleted.
494         * platform/audio/PlatformMediaSessionManager.h:
495         (WebCore::PlatformMediaSessionManager::anyOfSessions const): Deleted.
496         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
497         (MediaSessionManagerCocoa::updateSessionState):
498         (MediaSessionManagerCocoa::beginInterruption):
499         * platform/audio/ios/MediaSessionManagerIOS.mm:
500         (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
501         (WebCore::MediaSessionManageriOS::externalOutputDeviceAvailableDidChange):
502
503 2019-05-23  Saam barati  <sbarati@apple.com>
504
505         [WHLSL] Add a helper for in-place AST mutation
506         https://bugs.webkit.org/show_bug.cgi?id=198175
507
508         Reviewed by Myles Maxfield.
509
510         This makes WHLSL AST mutation code a bit easier to read and write.
511         
512         Code that looked like:
513         ```
514         static_assert(sizeof(AST::DereferenceExpression) <= sizeof(AST::DotExpression), "Dot expressions need to be able to become dereference expressions without updating backreferences");
515         void* location = &dotExpression;
516         dotExpression.~DotExpression();
517         auto* dereferenceExpression = new (location) AST::DereferenceExpression(WTFMove(origin), WTFMove(callExpression));
518         ```
519         
520         Can now be:
521         ```
522         auto* dereferenceExpression = AST::replaceWith<AST::DereferenceExpression>(dotExpression, WTFMove(origin), WTFMove(callExpression));
523         ```
524
525         * Modules/webgpu/WHLSL/AST/WHLSLNode.h:
526         (WebCore::WHLSL::AST::replaceWith):
527         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
528         (WebCore::WHLSL::NameResolver::visit):
529         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
530         (WebCore::WHLSL::PropertyResolver::visit):
531         (WebCore::WHLSL::PropertyResolver::simplifyRightValue):
532         (WebCore::WHLSL::LeftValueSimplifier::visit):
533
534 2019-05-23  Eric Carlson  <eric.carlson@apple.com>
535
536         [macOS,iOS] Add always-on logging for AVPlayerTimeControlStatus changes
537         https://bugs.webkit.org/show_bug.cgi?id=197946
538         <rdar://problem/50627457>
539
540         Reviewed by Jon Lee.
541
542         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
543         (WebCore::convertEnumerationToString):
544         (WTF::LogArgument<AVPlayerTimeControlStatus>::toString):
545         (WebCore::MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange):
546
547 2019-05-23  Antoine Quint  <graouts@apple.com>
548
549         [Pointer Events] Compatibility mouse events can only be prevented while the pointer is pressed
550         https://bugs.webkit.org/show_bug.cgi?id=198178
551
552         Reviewed by Dean Jackson.
553
554         Test: pointerevents/mouse/compatibility-mouse-events-prevention-mouse-released.html
555
556         The Pointer Events spec, in https://www.w3.org/TR/pointerevents/#compatibility-mapping-with-mouse-events, says that "Mouse events
557         can only be prevented when the pointer is down. Hovering pointers (e.g. a mouse with no buttons pressed) cannot have their mouse
558         events prevented." We now track whether the pointer is pressed and clear the preventsCompatibilityMouseEvents when the pointer is
559         moved and it is not pressed.
560
561         * page/PointerCaptureController.cpp:
562         (WebCore::PointerCaptureController::pointerEventWasDispatched):
563         * page/PointerCaptureController.h:
564
565 2019-05-23  Simon Fraser  <simon.fraser@apple.com>
566
567         Build fix after r245695.
568
569         * dom/Element.cpp:
570
571 2019-05-23  Antoine Quint  <graouts@apple.com>
572
573         [Pointer Events] The mouseover, mouseout, mouseenter, and mouseleave events should not be prevented while the pointer is down
574         https://bugs.webkit.org/show_bug.cgi?id=198177
575
576         Reviewed by Dean Jackson.
577
578         Test: pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed.html
579
580         The Pointer Event spec, in https://www.w3.org/TR/pointerevents/#compatibility-mapping-with-mouse-events, says that "the mouseover,
581         mouseout, mouseenter, and mouseleave events are never prevented (even if the pointer is down)." We add a new static function which
582         indicates what is "compatibility" mouse event since those should be excluded, along with "click", which we already excluded.
583
584         * dom/Element.cpp:
585         (WebCore::isCompatibilityMouseEvent):
586         (WebCore::Element::dispatchMouseEvent):
587
588 2019-05-23  Jon Davis  <jond@apple.com>
589
590         Update feature status for shipped features
591         https://bugs.webkit.org/show_bug.cgi?id=196783
592
593         Reviewed by Timothy Hatcher.
594         
595         Updated feature status for Beacon API, CSS Text Decoration Level 4, Intersection Observer,
596         Conic Gradients, Datalist Element, and Web Share.
597
598         * features.json:
599
600 2019-05-23  Simon Fraser  <simon.fraser@apple.com>
601
602         Create scrolling tree nodes for descendants of position:absolute inside stacking-context overflow
603         https://bugs.webkit.org/show_bug.cgi?id=198154
604
605         Reviewed by Antti Koivisto.
606         
607         There exists code that creates scrolling tree nodes for position:absolute when the containing block
608         chain skips an enclosing scroller, but the compositing ancestor tree includes the scroller. However
609         this code explicitly checked that the layer was position:absolute.
610
611         This needed to be generalized for any layer whose containing block ancestor chain includes
612         a position:absolute that skips the scroller, for example a transformed inside a position:absolute,
613         so remove an explicit isAbsolutelyPositioned() check and some similar assertions.
614
615         Test: scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow.html
616
617         * rendering/RenderLayerCompositor.cpp:
618         (WebCore::collectStationaryLayerRelatedOverflowNodes):
619         (WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const):
620         (WebCore::collectRelatedCoordinatedScrollingNodes):
621
622 2019-05-23  Adrian Perez de Castro  <aperez@igalia.com>
623
624         Fix a few missing header inclusions often masked by by unified sources
625         https://bugs.webkit.org/show_bug.cgi?id=198180
626
627         Reviewed by Eric Carlson.
628
629         * editing/markup.h: Add missing "FloatSize.h" inclusion.
630         * html/FeaturePolicy.cpp: Add missing "HTMLParserIdioms.h" inclusion.
631         * platform/text/TextCodec.cpp: Add missing <cstdio> inclusion.
632
633 2019-05-23  Myles C. Maxfield  <mmaxfield@apple.com>
634
635         [WHLSL] Implement property resolver
636         https://bugs.webkit.org/show_bug.cgi?id=195925
637         <rdar://problem/48219643>
638
639         Reviewed by Saam Barati and Robin Morisset.
640
641         The property resolver is the thing that replaces dot expressions, index expressions, and
642         read-modify-write expressions with calls to getters, setters, and anders. This patch doesn't
643         fully implement the property resolver, but implements enough for simple dot expressions to
644         work. This is enough for us to be able to test most of the rest of the compiler. Index
645         expressions and read-modify-write expressions are not fully included in this patch, and will
646         be finished in a follow-up patch.
647
648         The property resolver may introduce anonymous variables in various places. In order to do
649         this, after the property resolver runs, it will insert all these anonymous variables in the
650         beginning of the function. However, this means that entries in the VariableDeclarations
651         vector will all shift, which means VariableDeclarations have to be allocated on the heap so
652         backreferences to them stay valid. This patch moves the storage associated with these values
653         to living directly in the vector's storage to living in heap storage (via filling the vector
654         with UniqueRefs).
655
656         This patch also adds the third concept of value-ness. We now have right values, left values,
657         and abstract left values (for things which have setters but have no address). This addition
658         is required for the analysis the property resolver performs. This concept is also present in
659         the spec.
660
661         Test: webgpu/whlsl-dot-expressions.html
662
663         * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h:
664         (WebCore::WHLSL::AST::TypeAnnotation::TypeAnnotation):
665         (WebCore::WHLSL::AST::TypeAnnotation::leftAddressSpace const):
666         (WebCore::WHLSL::AST::TypeAnnotation::isRightValue const):
667         (WebCore::WHLSL::AST::TypeAnnotation::visit):
668         * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h:
669         (WebCore::WHLSL::AST::AssignmentExpression::takeRight):
670         * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h:
671         * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h:
672         * Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h:
673         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
674         (WebCore::WHLSL::AST::Expression::maybeResolvedType):
675         (WebCore::WHLSL::AST::Expression::resolvedType):
676         (WebCore::WHLSL::AST::Expression::maybeTypeAnnotation const):
677         (WebCore::WHLSL::AST::Expression::typeAnnotation const):
678         (WebCore::WHLSL::AST::Expression::setTypeAnnotation):
679         (WebCore::WHLSL::AST::Expression::addressSpace const): Deleted.
680         (WebCore::WHLSL::AST::Expression::setAddressSpace): Deleted.
681         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h:
682         (WebCore::WHLSL::AST::FloatLiteral::clone const):
683         * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h:
684         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp:
685         (WebCore::WHLSL::AST::IntegerLiteral::valueForSelectedType const):
686         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h:
687         (WebCore::WHLSL::AST::IntegerLiteral::clone const):
688         * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h:
689         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression):
690         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::leftValue):
691         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue): Deleted.
692         * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h:
693         (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression):
694         (WebCore::WHLSL::AST::MakePointerExpression::leftValue):
695         (WebCore::WHLSL::AST::MakePointerExpression::lValue): Deleted.
696         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h:
697         (WebCore::WHLSL::AST::NullLiteral::clone const):
698         * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h:
699         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetterOverloads):
700         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetterOverloads):
701         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAnderOverloads):
702         (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunction):
703         (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunction):
704         (WebCore::WHLSL::AST::PropertyAccessExpression::threadAnderFunction):
705         (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunction):
706         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetterOverloads):
707         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAnderOverloads):
708         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetterOverloads):
709         (WebCore::WHLSL::AST::PropertyAccessExpression::setGetterFunction):
710         (WebCore::WHLSL::AST::PropertyAccessExpression::setAnderFunction):
711         (WebCore::WHLSL::AST::PropertyAccessExpression::setThreadAnderFunction):
712         (WebCore::WHLSL::AST::PropertyAccessExpression::setSetterFunction):
713         (WebCore::WHLSL::AST::PropertyAccessExpression::takeBase):
714         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetOverloads): Deleted.
715         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetOverloads): Deleted.
716         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAndOverloads): Deleted.
717         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetOverloads): Deleted.
718         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetOverloads): Deleted.
719         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAndOverloads): Deleted.
720         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
721         (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference):
722         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference):
723         (WebCore::WHLSL::AST::ReadModifyWriteExpression::leftValue):
724         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeLeftValue):
725         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeOldValue):
726         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeNewValue):
727         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeNewValueExpression):
728         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeResultExpression):
729         (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression):
730         (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue): Deleted.
731         * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h:
732         (WebCore::WHLSL::AST::ResolvableType::maybeResolvedType const):
733         (WebCore::WHLSL::AST::ResolvableType::resolvedType const):
734         (WebCore::WHLSL::AST::ResolvableType::maybeResolvedType):
735         (WebCore::WHLSL::AST::ResolvableType::resolvedType):
736         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp:
737         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const):
738         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp:
739         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const):
740         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp:
741         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const):
742         * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h:
743         (WebCore::WHLSL::AST::StructureDefinition::find):
744         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
745         (WebCore::WHLSL::AST::TypeReference::maybeResolvedType const):
746         (WebCore::WHLSL::AST::TypeReference::resolvedType const):
747         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp:
748         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::valueForSelectedType const):
749         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h:
750         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const):
751         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
752         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h:
753         (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement):
754         (WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations):
755         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
756         (WebCore::WHLSL::Metal::attributeForSemantic):
757         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledInputPath):
758         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpackResourcesAndNamedBuiltIns):
759         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::helperTypes):
760         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::unpack):
761         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
762         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::visit):
763         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
764         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
765         (WebCore::WHLSL::Metal::writeNativeFunction):
766         * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp:
767         (WebCore::WHLSL::Metal::writeNativeType):
768         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
769         (WebCore::WHLSL::Metal::findInVector):
770         (WebCore::WHLSL::Metal::TypeNamer::visit):
771         (WebCore::WHLSL::Metal::TypeNamer::createNameNode):
772         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
773         (WebCore::WHLSL::ASTDumper::visit):
774         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp:
775         (WebCore::WHLSL::checkDuplicateFunctions):
776         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
777         (WebCore::WHLSL::resolveWithOperatorAnderIndexer):
778         (WebCore::WHLSL::resolveWithOperatorLength):
779         (WebCore::WHLSL::resolveWithReferenceComparator):
780         (WebCore::WHLSL::resolveByInstantiation):
781         (WebCore::WHLSL::checkOperatorOverload):
782         (WebCore::WHLSL::Checker::assignTypes):
783         (WebCore::WHLSL::commit):
784         (WebCore::WHLSL::Checker::visit):
785         (WebCore::WHLSL::Checker::recurseAndGetInfo):
786         (WebCore::WHLSL::Checker::getInfo):
787         (WebCore::WHLSL::Checker::assignType):
788         (WebCore::WHLSL::Checker::forwardType):
789         (WebCore::WHLSL::getUnnamedType):
790         (WebCore::WHLSL::Checker::finishVisitingPropertyAccess): Deleted.
791         (WebCore::WHLSL::Checker::recurseAndWrapBaseType): Deleted.
792         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp:
793         (WebCore::WHLSL::Gatherer::takeEntryPointItems):
794         (WebCore::WHLSL::Gatherer::visit):
795         * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp:
796         (WebCore::WHLSL::matchAndCommit):
797         (WebCore::WHLSL::commit):
798         (WebCore::WHLSL::inferTypesForCall):
799         * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp:
800         (WebCore::WHLSL::getNativeTypeDeclaration):
801         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
802         (WebCore::WHLSL::NameResolver::visit):
803         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
804         (WebCore::WHLSL::Parser::parseParameters):
805         (WebCore::WHLSL::Parser::parseVariableDeclarations):
806         * Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h:
807         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
808         (WebCore::WHLSL::prepareShared):
809         * Modules/webgpu/WHLSL/WHLSLPrepare.h:
810         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp: Added.
811         (WebCore::WHLSL::PropertyResolver::visit):
812         (WebCore::WHLSL::setterCall):
813         (WebCore::WHLSL::getterCall):
814         (WebCore::WHLSL::modify):
815         (WebCore::WHLSL::PropertyResolver::simplifyRightValue):
816         (WebCore::WHLSL::LeftValueSimplifier::visit):
817         (WebCore::WHLSL::PropertyResolver::simplifyLeftValue):
818         (WebCore::WHLSL::resolveProperties):
819         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h.
820         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp:
821         (WebCore::WHLSL::RecursiveTypeChecker::visit):
822         * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp:
823         (WebCore::WHLSL::conversionCost):
824         * Modules/webgpu/WHLSL/WHLSLResolvingType.h:
825         (WebCore::WHLSL::ResolvingType::getUnnamedType):
826         * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt:
827         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
828         (WebCore::WHLSL::FindArrayTypes::takeArrayTypes):
829         (WebCore::WHLSL::synthesizeArrayOperatorLength):
830         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
831         (WebCore::WHLSL::FindAllTypes::takeUnnamedTypes):
832         (WebCore::WHLSL::FindAllTypes::takeNamedTypes):
833         (WebCore::WHLSL::synthesizeConstructors):
834         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
835         (WebCore::WHLSL::synthesizeEnumerationFunctions):
836         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
837         (WebCore::WHLSL::synthesizeStructureAccessors):
838         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
839         (WebCore::WHLSL::Visitor::visit):
840         * Modules/webgpu/WHLSL/WHLSLVisitor.h:
841         * Sources.txt:
842         * WebCore.xcodeproj/project.pbxproj:
843         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
844         (WebCore::trySetWHLSLFunctionsForPipelineDescriptor):
845
846 2019-05-22  Myles C. Maxfield  <mmaxfield@apple.com>
847
848         font-optical-sizing applies the wrong variation value
849         https://bugs.webkit.org/show_bug.cgi?id=197528
850         <rdar://problem/50152854>
851
852         Reviewed by Antti Koivisto.
853
854         The OpenType spec says in
855         https://docs.microsoft.com/en-us/typography/opentype/spec/dvaraxistag_opsz
856
857         "Scale interpretation: Values can be interpreted as text size, in points."
858
859         It turns out that it means "typographic point size" which is equal to CSS pixels, not
860         CSS points.
861
862         There are two parts of the font that are sensitive to optical sizing: variation values and
863         the trak table. We don't want to set the variation value directly because then the trak table
864         won't be affected. Instead, we can use kCTFontOpticalSizeAttribute to set both of them together.
865         We will only do this when the CSS says text-rendering:optimizeLegibility or when the font has
866         an opsz axis but no STAT table. Otherwise, we won't do anything special, which lets CoreText
867         handle the default behavior for us. This gives us the same default behavior as the rest of the
868         system.
869
870         Tests: fast/text/variations/optical-sizing-trak-2.html
871                fast/text/variations/optical-sizing-trak.html
872                fast/text/variations/optical-sizing-units-2.html
873                fast/text/variations/optical-sizing-units.html
874
875         * platform/graphics/cocoa/FontCacheCoreText.cpp:
876         (WebCore::FontType::FontType):
877         (WebCore::preparePlatformFont):
878         (WebCore::fontWithFamily):
879         (WebCore::FontCache::systemFallbackForCharacters):
880         * platform/graphics/cocoa/FontCacheCoreText.h:
881         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
882         (WebCore::FontFamilySpecificationCoreText::fontRanges const):
883         * platform/graphics/mac/FontCustomPlatformData.cpp:
884         (WebCore::FontCustomPlatformData::fontPlatformData):
885
886 2019-05-22  Antti Koivisto  <antti@apple.com>
887
888         Subselectors not searched when determining property whitelist for selector
889         https://bugs.webkit.org/show_bug.cgi?id=198147
890         <rdar://problem/50405208>
891
892         Reviewed by Zalan Bujtas.
893
894         This can cause marker elements get style they shouldn't.
895
896         Test: fast/lists/marker-style-subselector-whitelist.html
897
898         * css/RuleSet.cpp:
899         (WebCore::determinePropertyWhitelistType):
900
901         Check subselectors too.
902
903 2019-05-22  Saam barati  <sbarati@apple.com>
904
905         WHLSL: fix enum parsing
906         https://bugs.webkit.org/show_bug.cgi?id=198087
907
908         Reviewed by Myles Maxfield.
909
910         This fixes two bugs:
911         
912         1. We were using a String by reference after moving the underlying owner of
913         the string. This would lead to the String becoming the empty value, and
914         crashing when used as a key in a hash map.
915         2. We were incorrectly producing a syntax error for enum declarations by
916         saying it's invalid if an enum value was added to a hash map for the first
917         time. This logic should be negated. We need to error when it's added for
918         the second time and onwards.
919
920         Test: webgpu/whlsl-dont-crash-parsing-enum.html
921
922         * Modules/webgpu/WHLSL/AST/WHLSLAST.h: Replaced.
923         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h:
924         (WebCore::WHLSL::AST::EnumerationDefinition::add):
925         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h:
926         (WebCore::WHLSL::AST::EnumerationMember::name):
927         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp: Replaced.
928         (WebCore::WHLSL::ASTDumper::visit):
929         * Modules/webgpu/WHLSL/WHLSLASTDumper.h: Replaced.
930
931 2019-05-22  Simon Fraser  <simon.fraser@apple.com>
932
933         Fix scrolling tree state for more obscure combinations of positioning and paint order
934         https://bugs.webkit.org/show_bug.cgi?id=198139
935
936         Reviewed by Antti Koivisto.
937
938         There were three places in RenderLayerCompositor that used a version of ancestor
939         layer traversal looking at containing blocks, and all three had issues. So make a
940         shared function to do the ancestor walk, and use it thrice.
941
942         isScrolledByOverflowScrollLayer() fumbled containingBlockCanSkipLayers, so failed
943         to create a scrolling tree node for a composited layer inside position:fixed in
944         overflow (tested by composited-in-absolute-in-overflow.html).
945
946         collectStationaryLayerRelatedOverflowNodes() failed to handle nested
947         overflow:scroll; it needs to find all the composited scrollers that affect the
948         position of the given layer relative to its compositing ancestor, which may be the
949         scroller, or a descendant of the scroller. However, it didn't walk up far enough
950         and find more that one ancestor. Tested by absolute-in-nested-sc-scrollers.html.
951
952         enclosingClippingScopes() was OK but now uses the share function.
953
954         Tests: scrollingcoordinator/scrolling-tree/absolute-in-nested-sc-scrollers.html
955                scrollingcoordinator/scrolling-tree/composited-in-absolute-in-overflow.html
956
957         * rendering/RenderLayerCompositor.cpp:
958         (WebCore::traverseAncestorLayers):
959         (WebCore::enclosingClippingScopes):
960         (WebCore::isScrolledByOverflowScrollLayer):
961         (WebCore::collectStationaryLayerRelatedOverflowNodes):
962         (WebCore::collectRelatedCoordinatedScrollingNodes):
963
964 2019-05-22  Simon Fraser  <simon.fraser@apple.com>
965
966         Inner scroller of nested overflow:scrolls jitters when scrolling
967         https://bugs.webkit.org/show_bug.cgi?id=198131
968
969         Reviewed by Antti Koivisto.
970
971         enclosingCompositedScrollingLayer(layer) would return the layer itself, rather than
972         its scrolling ancestor, which meant that a composited scroller nested inside another
973         scroller would fail to get a "Moves" scrolling tree node, and therefore jitter
974         when scrolling.
975
976         Test: scrollingcoordinator/scrolling-tree/nested-overflow-scroll.html
977
978         * rendering/RenderLayerCompositor.cpp:
979         (WebCore::enclosingCompositedScrollingLayer):
980
981 2019-05-22  Ryan Haddad  <ryanhaddad@apple.com>
982
983         Unreviewed, rolling out r245598.
984
985         Breaks watchOS build.
986
987         Reverted changeset:
988
989         "font-optical-sizing applies the wrong variation value"
990         https://bugs.webkit.org/show_bug.cgi?id=197528
991         https://trac.webkit.org/changeset/245598
992
993 2019-05-22  Daniel Bates  <dabates@apple.com>
994
995         WebKit does not generate an ESC key event for CMD+.
996         https://bugs.webkit.org/show_bug.cgi?id=198137
997         <rdar://problem/51038641>
998
999         Reviewed by Brent Fulgham.
1000
1001         This patch maps the Command + '.' keystroke to the 'Escape'. This also requires a change to UIKit to properly pass
1002         the key state to WebKit (see <rdar://problem/46431552>).
1003
1004         * platform/ios/WebEvent.mm:
1005         (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:withInputManagerHint:keyCode:isTabKey:]):
1006
1007 2019-05-22  Ali Juma  <ajuma@chromium.org>
1008
1009         Intersection Observer: bounding client rect is wrong for an inline element
1010         https://bugs.webkit.org/show_bug.cgi?id=198009
1011
1012         Reviewed by Simon Fraser.
1013
1014         Make target rect computation for inline elements share logic with the computation
1015         of bounding client rects.
1016
1017         Test: imported/w3c/web-platform-tests/intersection-observer/inline-with-block-child-client-rect.html
1018
1019         * dom/Document.cpp:
1020         (WebCore::computeIntersectionState):
1021         * dom/Element.cpp:
1022         (WebCore::Element::boundingAbsoluteRectWithoutLayout):
1023         (WebCore::Element::boundingClientRect):
1024         * dom/Element.h:
1025
1026 2019-05-22  Antoine Quint  <graouts@apple.com>
1027
1028         [iOS] Compatibility mouse events aren't prevented by calling preventDefault() on pointerdown
1029         https://bugs.webkit.org/show_bug.cgi?id=198124
1030         <rdar://problem/50410863>
1031
1032         Reviewed by Tim Horton.
1033
1034         This fix builds atop the one made for wkb.ug/198072 which fixes this bug on macOS alone.
1035
1036         In order to correctly prevent "compatibility" mouse events from being dispatched when the initial "pointerdown" event had preventDefault()
1037         called while handled, we need to pass the PointerID for the touch that triggered a tap gesture in the UI process down in the Web process
1038         and into the resulting PlatformMouseEvent. This will allow upon dispatch of a PlatformMouseEvent to call into PointerCaptureController
1039         to identify if the dispatch of mouse events is allowed for the event's PointerID.
1040
1041         To support this, some refactoring was required. The PointerID header is now under platform/ such that PlatformMouseEvent may safely use it.
1042         Additionally, PointerEvent::defaultMousePointerIdentifier() is now a global mousePointerID defined in PointerID.h.
1043
1044         Finally, PointerCaptureController::touchEndedOrWasCancelledForIdentifier() has been renamed to PointerCaptureController::touchWithIdentifierWasRemoved() and
1045         has WEBCORE_EXPORT such that it may be called from WebKit as the indication that a pointer is no longer active will now be initiated in WebKit
1046         on the UI process side.
1047
1048         Testing is covered by the pre-existing imported/w3c/web-platform-tests/pointerevents/pointerevent_suppress_compat_events_on_click.html
1049         which will now run on iOS through a change to WebKitAdditions.
1050
1051         * Headers.cmake:
1052         * WebCore.xcodeproj/project.pbxproj:
1053         * dom/Element.cpp:
1054         (WebCore::Element::dispatchMouseEvent): When dealing with a mouse event on iOS, check whether the mouse event's PointerID allows for compatibility
1055         mouse events to be dispatched using PointerCaptureController::preventsCompatibilityMouseEventsForIdentifier(). The "click" event is not a compatibility
1056         mouse event.
1057         * dom/PointerEvent.h:
1058         * page/PointerCaptureController.cpp:
1059         (WebCore::PointerCaptureController::PointerCaptureController):
1060         (WebCore::PointerCaptureController::touchWithIdentifierWasRemoved):
1061         (WebCore::PointerCaptureController::touchEndedOrWasCancelledForIdentifier): Deleted.
1062         * page/PointerCaptureController.h:
1063         * platform/PlatformMouseEvent.h:
1064         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
1065         (WebCore::PlatformMouseEvent::pointerId const):
1066         * platform/PointerID.h: Renamed from Source/WebCore/dom/PointerID.h.
1067         (WebCore::mousePointerID):
1068
1069 2019-05-22  Jiewen Tan  <jiewen_tan@apple.com>
1070
1071         [WebAuthN] Support Attestation Conveyance Preference
1072         https://bugs.webkit.org/show_bug.cgi?id=192722
1073         <rdar://problem/49939647>
1074
1075         Reviewed by Brent Fulgham.
1076
1077         This patch implements https://www.w3.org/TR/webauthn/#enumdef-attestationconveyancepreference, together with
1078         Step 20 with regard to AttestationConveyancePreference of https://www.w3.org/TR/webauthn/#createCredential.
1079         Few notes with regard to Step 20: 1) We treat indirect attestation as direct attestation as we don't MITM
1080         the attestation process; 2) We won't distinguish self attestation and return it to keep consistency between
1081         the response and the request. If callers want none attestation, they will very likely ignore fmt and attStmt
1082         of the attestation object, and therefore it is meaningless to return self attestation.
1083
1084         Covered by new tests within existing files.
1085
1086         * CMakeLists.txt:
1087         * DerivedSources-input.xcfilelist:
1088         * DerivedSources-output.xcfilelist:
1089         * DerivedSources.make:
1090         * Headers.cmake:
1091         * Modules/webauthn/AttestationConveyancePreference.h: Copied from Source/WebCore/Modules/webauthn/WebAuthenticationUtils.h.
1092         * Modules/webauthn/AttestationConveyancePreference.idl: Copied from Source/WebCore/Modules/webauthn/WebAuthenticationUtils.h.
1093         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
1094         (WebCore::PublicKeyCredentialCreationOptions::encode const):
1095         (WebCore::PublicKeyCredentialCreationOptions::decode):
1096         * Modules/webauthn/PublicKeyCredentialCreationOptions.idl:
1097         * Modules/webauthn/WebAuthenticationConstants.h:
1098         * Modules/webauthn/WebAuthenticationUtils.cpp:
1099         (WebCore::buildAttestationObject):
1100         * Modules/webauthn/WebAuthenticationUtils.h:
1101         * Modules/webauthn/fido/DeviceResponseConverter.cpp:
1102         (fido::readCTAPMakeCredentialResponse):
1103         * Modules/webauthn/fido/DeviceResponseConverter.h:
1104         * Modules/webauthn/fido/FidoConstants.h:
1105         noneAttestationValue is moved to WebAuthenticationConstants.h.
1106         * Modules/webauthn/fido/U2fResponseConverter.cpp:
1107         (fido::readU2fRegisterResponse):
1108         * Modules/webauthn/fido/U2fResponseConverter.h:
1109         * Sources.txt:
1110         * WebCore.xcodeproj/project.pbxproj:
1111
1112 2019-05-22  Zalan Bujtas  <zalan@apple.com>
1113
1114         [Paste] Add support for preferred presentation size when pasting an image
1115         https://bugs.webkit.org/show_bug.cgi?id=198132
1116         <rdar://problem/50886917>
1117
1118         Reviewed by Wenson Hsieh.
1119
1120         Set the pasted <img> width/height attributes when the preferred presentation size is available.
1121
1122         * editing/WebContentReader.h:
1123         * editing/cocoa/WebContentReaderCocoa.mm:
1124         (WebCore::createFragmentForImageAttachment):
1125         (WebCore::WebContentReader::readImage):
1126         * editing/markup.cpp:
1127         (WebCore::createFragmentForImageAndURL):
1128         * editing/markup.h:
1129         * platform/Pasteboard.h:
1130         (WebCore::PasteboardWebContentReader::readImage):
1131         * platform/PasteboardItemInfo.h:
1132         (WebCore::PasteboardItemInfo::encode const):
1133         (WebCore::PasteboardItemInfo::decode):
1134         * platform/ios/PasteboardIOS.mm:
1135         (WebCore::Pasteboard::readPasteboardWebContentDataForType):
1136         (WebCore::Pasteboard::read):
1137         (WebCore::Pasteboard::readRespectingUTIFidelities):
1138         * platform/ios/PlatformPasteboardIOS.mm:
1139         (WebCore::PlatformPasteboard::informationForItemAtIndex):
1140
1141 2019-05-22  Jer Noble  <jer.noble@apple.com>
1142
1143         Hide MediaCapabilities.encodingInfo() when the platform does not support it.
1144         https://bugs.webkit.org/show_bug.cgi?id=197476
1145
1146         Reviewed by Eric Carlson.
1147
1148         Test: platform/mac/media/mediacapabilities/mediacapabilities-encodingInfo-undefined.html
1149
1150         Add a new IDL attribute, CustomEnabled, which allows non Settings-based enabling of attributes and objects.
1151
1152         * Modules/mediacapabilities/MediaCapabilities.idl:
1153         * WebCore.xcodeproj/project.pbxproj:
1154         * bindings/js/JSMediaCapabilitiesCustom.h: Copied from Source/WebCore/Modules/mediacapabilities/MediaCapabilities.idl.
1155         (WebCore::JSMediaCapabilitiesEncodingInfoIsEnabled):
1156         * bindings/scripts/CodeGeneratorJS.pm:
1157         (NeedsRuntimeCheck):
1158         (GenerateRuntimeEnableConditionalString):
1159         * bindings/scripts/IDLAttributes.json:
1160         * bindings/scripts/preprocess-idls.pl:
1161         (GenerateConstructorAttributes):
1162         * platform/mediacapabilities/MediaEngineConfigurationFactory.cpp:
1163         (WebCore::MediaEngineConfigurationFactory::hasDecodingConfigurationFactory):
1164         (WebCore::MediaEngineConfigurationFactory::hasEncodingConfigurationFactory):
1165         * platform/mediacapabilities/MediaEngineConfigurationFactory.h:
1166
1167 2019-05-22  Youenn Fablet  <youenn@apple.com>
1168
1169         Implement Feature policy self/none/* parsing
1170         https://bugs.webkit.org/show_bug.cgi?id=198078
1171
1172         Reviewed by Eric Carlson.
1173
1174         Start to implement https://w3c.github.io/webappsec-feature-policy/#algo-parse-policy-directive
1175         'src' is not supported yet.
1176         Apply the rules to getUserMedia.
1177         Update getDisplayMedia keyword from 'display' to 'display-capture' as per spec.
1178
1179         Test: imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-feature-policy-none.https.html
1180
1181         * Headers.cmake:
1182         * Modules/mediastream/UserMediaController.cpp:
1183         (WebCore::isSecure):
1184         (WebCore::isAllowedByFeaturePolicy):
1185         (WebCore::isAllowedToUse):
1186         * Sources.txt:
1187         * WebCore.xcodeproj/project.pbxproj:
1188         * html/FeaturePolicy.cpp: Added.
1189         (WebCore::isAllowedByFeaturePolicy):
1190         (WebCore::processOriginItem):
1191         (WebCore::updateList):
1192         (WebCore::FeaturePolicy::parse):
1193         (WebCore::FeaturePolicy::allows const):
1194         * html/FeaturePolicy.h: Added.
1195         * html/HTMLIFrameElement.cpp:
1196         (WebCore::HTMLIFrameElement::featurePolicy const):
1197         * html/HTMLIFrameElement.h:
1198
1199 2019-05-21  Jer Noble  <jer.noble@apple.com>
1200
1201         Media controls don't show in WK2 video fullscreen sometimes
1202         https://bugs.webkit.org/show_bug.cgi?id=198094
1203         <rdar://problem/50970661>
1204
1205         Reviewed by Tim Horton.
1206
1207         Ensure that the WebAVPlayerLayer never allows hit testing, as this keeps touches from reaching
1208         AVKit's controls.
1209
1210         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1211         (-[WebAVPlayerLayer init]):
1212
1213 2019-05-21  Saam barati  <sbarati@apple.com>
1214
1215         WHLSL: Add an AST dumper
1216         https://bugs.webkit.org/show_bug.cgi?id=198059
1217
1218         Reviewed by Myles Maxfield.
1219
1220         This patch makes it so we can dump the WHLSL program's AST.
1221         This will become useful when we're debugging passes that
1222         transform the AST.
1223         
1224         The dumper mostly prints in a style where the dump is almost
1225         valid WHLSL code. E.g, this WHLSL program:
1226         ```
1227         int foo(int arg) {
1228             return arg + 1;
1229         }
1230         ```
1231         
1232         gets dumped as:
1233         ```
1234         int foo(int arg) {
1235            return operator+(arg, 1);
1236         }
1237         ```
1238         
1239         This patch also adds a way to dump between each pass, after
1240         parsing, or at the end of all passes. Currently, this is controlled
1241         by a static variable. I'll make these runtime configurable in a follow
1242         up: https://bugs.webkit.org/show_bug.cgi?id=198097
1243
1244         No new tests because this is used for logging.
1245
1246         * Modules/webgpu/WHLSL/AST/WHLSLAST.h: Added.
1247         * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h:
1248         (WebCore::WHLSL::AST::toString):
1249         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h:
1250         (WebCore::WHLSL::AST::BuiltInSemantic::toString const):
1251         * Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h:
1252         (WebCore::WHLSL::AST::toString):
1253         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h:
1254         (WebCore::WHLSL::AST::ResourceSemantic::toString):
1255         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
1256         (WebCore::WHLSL::Metal::toString): Deleted.
1257         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp: Added.
1258         (WebCore::WHLSL::ASTDumper::visit):
1259         * Modules/webgpu/WHLSL/WHLSLASTDumper.h: Added.
1260         (WebCore::WHLSL::ASTDumper::toString):
1261         (WebCore::WHLSL::ASTDumper::Indent::Indent):
1262         (WebCore::WHLSL::ASTDumper::bumpIndent):
1263         (WebCore::WHLSL::toString):
1264         (WebCore::WHLSL::dumpAST):
1265         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
1266         (WebCore::WHLSL::dumpASTIfNeeded):
1267         (WebCore::WHLSL::dumpASTAfterParsingIfNeeded):
1268         (WebCore::WHLSL::dumpASTBetweenEachPassIfNeeded):
1269         (WebCore::WHLSL::dumpASTAtEndIfNeeded):
1270         (WebCore::WHLSL::prepareShared):
1271         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
1272         * Sources.txt:
1273         * WebCore.xcodeproj/project.pbxproj:
1274
1275 2019-05-21  Saam barati  <sbarati@apple.com>
1276
1277         WHLSL: Parsing negative int literals parses the positive value instead
1278         https://bugs.webkit.org/show_bug.cgi?id=198096
1279
1280         Reviewed by Dean Jackson.
1281
1282         I also made the code around < INT_MIN a bit easier to follow along with.
1283
1284         No new tests because we haven't imported WHLSL test suite yet.
1285         Verified this works using the AST dumper.
1286
1287         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
1288         (WebCore::WHLSL::intLiteralToInt):
1289
1290 2019-05-21  Myles C. Maxfield  <mmaxfield@apple.com>
1291
1292         font-optical-sizing applies the wrong variation value
1293         https://bugs.webkit.org/show_bug.cgi?id=197528
1294         <rdar://problem/50152854>
1295
1296         Reviewed by Antti Koivisto.
1297
1298         The OpenType spec says in
1299         https://docs.microsoft.com/en-us/typography/opentype/spec/dvaraxistag_opsz
1300
1301         "Scale interpretation: Values can be interpreted as text size, in points."
1302
1303         It turns out that it means "typographic point size" which is equal to CSS pixels, not
1304         CSS points.
1305
1306         There are two parts of the font that are sensitive to optical sizing: variation values and
1307         the trak table. We don't want to set the variation value directly because then the trak table
1308         won't be affected. Instead, we can use kCTFontOpticalSizeAttribute to set both of them together.
1309         We will only do this when the CSS says text-rendering:optimizeLegibility or when the font has
1310         an opsz axis but no STAT table. Otherwise, we won't do anything special, which lets CoreText
1311         handle the default behavior for us. This gives us the same default behavior as the rest of the
1312         system.
1313
1314         Tests: fast/text/variations/optical-sizing-trak-2.html
1315                fast/text/variations/optical-sizing-trak.html
1316                fast/text/variations/optical-sizing-units.html
1317                fast/text/variations/optical-sizing-units-2.html
1318
1319         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1320         (WebCore::FontType::FontType):
1321         (WebCore::preparePlatformFont):
1322         (WebCore::fontWithFamily):
1323         (WebCore::FontCache::systemFallbackForCharacters):
1324         * platform/graphics/cocoa/FontCacheCoreText.h:
1325         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
1326         (WebCore::FontFamilySpecificationCoreText::fontRanges const):
1327         * platform/graphics/mac/FontCustomPlatformData.cpp:
1328         (WebCore::FontCustomPlatformData::fontPlatformData):
1329
1330 2019-05-21  Simon Fraser  <simon.fraser@apple.com>
1331
1332         Layer flashing and poor perf during scrolling of message list on gmail.com and hotmail.com - overlap testing needs to constrained to clipping scopes
1333         https://bugs.webkit.org/show_bug.cgi?id=198091
1334         <rdar://problem/49403082>
1335
1336         Reviewed by Antti Koivisto.
1337         
1338         When overflow:scroll is scrolled asynchronously, we need to have already created compositing layers where necessary
1339         for clipped-out layers in the scrolled content so that we have something to reveal. We also have ensure
1340         that layers inside the scroller (but scrolled out of view) don't trigger overlap with layers outside the scroller.
1341         All this has to work when the containing block hierarchy (clipping/scrolling) doesn't match the paint order hierarchy (structure
1342         of the z-order and compositing trees).
1343
1344         Overlap testing previously simply used a list of rectangles per compositing container (OverlapMapContainer). This is
1345         a series of layer bounds, built up as we traver the layer tree in z-order. Layers contribute to container N-2, and test
1346         against container N-1.
1347         
1348         To handle overlap with non-stacking-context scrollers, introduce the concept of a ClippingScope, which encompasses
1349         a set of layers sharing the same composited-scrolling containing-block ancestor. Within a ClippingScope, layer bounds
1350         are computed unclipped. Between them, bounds are tested clipped.
1351         
1352         Conceptually, each OverlapMapContainer has a tree of ClippingScopes (reflecting the containing-block order tree of
1353         composited overflow scroll), and rects are added to the appropriate ClippingScope. This tree is currently always
1354         root-relative; the root node is the RenderView's RenderLayer, and will accumulate the bounds of layers not inside
1355         composited overflow scroll (just like the old code).
1356         
1357         When a OverlapMapContainer is popped, the list of rectangles in its ClippingScope tree is merged with that of the previous
1358         container.
1359
1360         Tests: compositing/layer-creation/clipping-scope/nested-scroller-overlap.html
1361                compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller.html
1362                compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller.html
1363                compositing/layer-creation/clipping-scope/scroller-with-negative-z-children.html
1364                compositing/layer-creation/clipping-scope/shared-layers-in-scroller.html
1365
1366         * rendering/LayerOverlapMap.cpp:
1367         (WebCore::operator<<):
1368         (WebCore::OverlapMapContainer::OverlapMapContainer):
1369         (WebCore::OverlapMapContainer::ClippingScope::ClippingScope):
1370         (WebCore::OverlapMapContainer::ClippingScope::childWithLayer const):
1371         (WebCore::OverlapMapContainer::ClippingScope::addChildWithLayerAndBounds):
1372         (WebCore::OverlapMapContainer::ClippingScope::addChild):
1373         (WebCore::OverlapMapContainer::ClippingScope::appendRect):
1374         (WebCore::OverlapMapContainer::clippingScopeContainingLayerChildRecursive):
1375         (WebCore::OverlapMapContainer::scopeContainingLayer const):
1376         (WebCore::OverlapMapContainer::rootScope const):
1377         (WebCore::OverlapMapContainer::rootScope):
1378         (WebCore::OverlapMapContainer::add):
1379         (WebCore::OverlapMapContainer::overlapsLayers const):
1380         (WebCore::OverlapMapContainer::mergeClippingScopesRecursive):
1381         (WebCore::OverlapMapContainer::append):
1382         (WebCore::OverlapMapContainer::ensureClippingScopeForLayers):
1383         (WebCore::OverlapMapContainer::findClippingScopeForLayers const):
1384         (WebCore::OverlapMapContainer::recursiveOutputToStream const):
1385         (WebCore::OverlapMapContainer::dump const):
1386         (WebCore::LayerOverlapMap::LayerOverlapMap):
1387         (WebCore::LayerOverlapMap::add):
1388         (WebCore::LayerOverlapMap::overlapsLayers const):
1389         (WebCore::LayerOverlapMap::pushCompositingContainer):
1390         (WebCore::LayerOverlapMap::popCompositingContainer):
1391         (WebCore::OverlapMapContainer::unite): Deleted.
1392         (WebCore::OverlapMapContainer::rectList const): Deleted.
1393         * rendering/LayerOverlapMap.h:
1394         * rendering/RenderLayerCompositor.cpp:
1395         (WebCore::RenderLayerCompositor::BackingSharingState::appendSharingLayer):
1396         (WebCore::RenderLayerCompositor::BackingSharingState::updateBeforeDescendantTraversal):
1397         (WebCore::RenderLayerCompositor::updateCompositingLayers):
1398         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
1399         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
1400         (WebCore::RenderLayerCompositor::computeExtent const):
1401         (WebCore::createsClippingScope):
1402         (WebCore::enclosingClippingScopes):
1403         (WebCore::RenderLayerCompositor::addToOverlapMap const):
1404         (WebCore::RenderLayerCompositor::updateOverlapMap const):
1405         (WebCore::RenderLayerCompositor::layerOverlaps const):
1406         * rendering/RenderLayerCompositor.h:
1407
1408 2019-05-21  Antoine Quint  <graouts@apple.com>
1409
1410         [macOS] Compatibility mouse events aren't prevented by calling preventDefault() on pointerdown
1411         https://bugs.webkit.org/show_bug.cgi?id=198072
1412         <rdar://problem/50983361>
1413
1414         Reviewed by Dean Jackson.
1415
1416         The Pointer Events spec says that "compatibility" mouse events, which means all mouse events save for "click",
1417         should not be dispatched for a given pointer if preventDefault() was called during the dispatch of the "pointerdown"
1418         event. Additionally, calling preventDefault() during the dispatch of "pointerup" has no effect.
1419
1420         * dom/Element.cpp:
1421         (WebCore::Element::dispatchMouseEvent):
1422         * page/PointerCaptureController.cpp:
1423         (WebCore::PointerCaptureController::preventsCompatibilityMouseEventsForIdentifier):
1424         (WebCore::PointerCaptureController::pointerEventWasDispatched):
1425         * page/PointerCaptureController.h:
1426
1427 2019-05-21  Antti Koivisto  <antti@apple.com>
1428
1429         RTL/overflow scroll tests fail with async overflow enabled
1430         https://bugs.webkit.org/show_bug.cgi?id=196013
1431         <rdar://problem/49066649>
1432
1433         Reviewed by Simon Fraser.
1434
1435         Test: compositing/ios/rtl-overflow-scrolling-2.html
1436
1437         This patch makes the basic RTL cases work in the scrolling tree.
1438
1439         * page/scrolling/AsyncScrollingCoordinator.cpp:
1440         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
1441         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1442         (WebCore::ScrollingTreeScrollingNode::minimumScrollPosition const):
1443         (WebCore::ScrollingTreeScrollingNode::maximumScrollPosition const):
1444
1445         Add missing scroll offset <-> scroll position conversions.
1446
1447 2019-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1448
1449         [WPE] Add initial accessibility support using ATK
1450         https://bugs.webkit.org/show_bug.cgi?id=197413
1451
1452         Reviewed by Michael Catanzaro.
1453
1454         Use USE(ATK) instead of PLATFORM(GTK) for ATK related code and use ATK when available for WPE port too.
1455
1456         * PlatformWPE.cmake:
1457         * SourcesWPE.txt:
1458         * accessibility/AXObjectCache.h:
1459         * accessibility/AccessibilityList.cpp:
1460         (WebCore::AccessibilityList::childHasPseudoVisibleListItemMarkers):
1461         * accessibility/AccessibilityNodeObject.cpp:
1462         (WebCore::AccessibilityNodeObject::canSetValueAttribute const):
1463         * accessibility/AccessibilityObject.cpp:
1464         (WebCore::AccessibilityObject::textIteratorBehaviorForTextRange const):
1465         * accessibility/AccessibilityObject.h:
1466         * accessibility/AccessibilityObjectInterface.h:
1467         * accessibility/AccessibilityRenderObject.cpp:
1468         (WebCore::AccessibilityRenderObject::indexForVisiblePosition const):
1469         (WebCore::AccessibilityRenderObject::shouldNotifyActiveDescendant const):
1470         * accessibility/AccessibilityTableColumn.cpp:
1471         (WebCore::AccessibilityTableColumn::computeAccessibilityIsIgnored const):
1472         * accessibility/AccessibilityTableHeaderContainer.cpp:
1473         (WebCore::AccessibilityTableHeaderContainer::computeAccessibilityIsIgnored const):
1474         * accessibility/atk/WebKitAccessible.cpp:
1475         (webkitAccessibleGetAttributes):
1476         * accessibility/wpe/AXObjectCacheWPE.cpp: Removed.
1477         * accessibility/wpe/AccessibilityObjectWPE.cpp: Removed.
1478         * editing/FrameSelection.h:
1479
1480 2019-05-20  Ross Kirsling  <ross.kirsling@sony.com>
1481
1482         Make lossy LayoutUnit constructors explicit
1483         https://bugs.webkit.org/show_bug.cgi?id=191811
1484
1485         Reviewed by Antti Koivisto.
1486
1487         * platform/LayoutUnit.h:
1488         Make lossy unary constructors explicit.
1489         For ergonomics, give float overloads to copy constructor and round/floor/ceil functions.
1490
1491         * css/LengthFunctions.h:
1492         * platform/graphics/LayoutPoint.h:
1493         * platform/graphics/LayoutRect.h:
1494         * platform/graphics/LayoutSize.h:
1495         * rendering/RenderBox.h:
1496         * rendering/RenderElement.h:
1497         Templatize common functions to allow LayoutUnit itself to dictate which types it allows.
1498
1499         * html/shadow/SliderThumbElement.cpp:
1500         * page/FrameView.cpp:
1501         * page/Page.cpp:
1502         * page/SpatialNavigation.cpp:
1503         * page/scrolling/AxisScrollSnapOffsets.cpp:
1504         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1505         * layout/FormattingContextGeometry.cpp:
1506         * layout/FormattingContextQuirks.cpp:
1507         * layout/LayoutState.cpp:
1508         * layout/displaytree/DisplayBox.h:
1509         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
1510         * layout/layouttree/LayoutReplaced.cpp:
1511         * platform/animation/AnimationUtilities.h:
1512         * platform/cocoa/ScrollSnapAnimatorState.mm:
1513         * rendering/BorderEdge.cpp:
1514         * rendering/EllipsisBox.cpp:
1515         * rendering/FixedTableLayout.cpp:
1516         * rendering/InlineBox.cpp:
1517         * rendering/InlineFlowBox.cpp:
1518         * rendering/InlineFlowBox.h:
1519         * rendering/InlineTextBox.cpp:
1520         * rendering/RenderBlock.cpp:
1521         * rendering/RenderBlockFlow.cpp:
1522         * rendering/RenderBlockLineLayout.cpp:
1523         * rendering/RenderBox.cpp:
1524         * rendering/RenderBoxModelObject.cpp:
1525         * rendering/RenderBoxModelObject.h:
1526         * rendering/RenderDeprecatedFlexibleBox.cpp:
1527         * rendering/RenderElement.cpp:
1528         * rendering/RenderImage.cpp:
1529         * rendering/RenderInline.cpp:
1530         * rendering/RenderLineBreak.cpp:
1531         * rendering/RenderListMarker.cpp:
1532         * rendering/RenderMultiColumnSet.cpp:
1533         * rendering/RenderMultiColumnSet.h:
1534         * rendering/RenderObject.cpp:
1535         * rendering/RenderReplaced.cpp:
1536         * rendering/RenderTable.cpp:
1537         * rendering/RenderTableCell.cpp:
1538         * rendering/RenderTableSection.cpp:
1539         * rendering/RenderText.cpp:
1540         * rendering/RenderTextControlMultiLine.cpp:
1541         * rendering/RenderThemeMac.mm:
1542         * rendering/RenderVTTCue.cpp:
1543         * rendering/RenderView.cpp:
1544         * rendering/RootInlineBox.cpp:
1545         * rendering/SimpleLineLayoutFunctions.cpp:
1546         * rendering/SimpleLineLayoutPagination.cpp:
1547         * rendering/SimpleLineLayoutResolver.cpp:
1548         * rendering/line/LineWidth.cpp:
1549         * rendering/mathml/MathOperator.cpp:
1550         * rendering/mathml/RenderMathMLBlock.cpp:
1551         * rendering/mathml/RenderMathMLBlock.h:
1552         * rendering/mathml/RenderMathMLFencedOperator.h:
1553         * rendering/mathml/RenderMathMLFraction.cpp:
1554         * rendering/mathml/RenderMathMLMenclose.cpp:
1555         * rendering/mathml/RenderMathMLOperator.cpp:
1556         * rendering/mathml/RenderMathMLRoot.cpp:
1557         * rendering/mathml/RenderMathMLScripts.cpp:
1558         * rendering/mathml/RenderMathMLToken.cpp:
1559         * rendering/shapes/BoxShape.cpp:
1560         * rendering/shapes/ShapeOutsideInfo.cpp:
1561         * rendering/style/CollapsedBorderValue.h:
1562         * rendering/style/NinePieceImage.cpp:
1563         * rendering/style/NinePieceImage.h:
1564         * rendering/style/RenderStyle.cpp:
1565         * rendering/style/RenderStyle.h:
1566         * rendering/svg/RenderSVGText.cpp:
1567         * rendering/svg/SVGInlineTextBox.cpp:
1568         Make usage of LayoutUnit(float) and LayoutUnit(double) explicit where needed.
1569
1570 2019-05-20  Jer Noble  <jer.noble@apple.com>
1571
1572         Provide an explicit UIModalPresentation style when creating an AVPlayerViewController for fullscreen.
1573         https://bugs.webkit.org/show_bug.cgi?id=198052
1574
1575         Reviewed by Tim Horton.
1576
1577         Make sure AVPlayerViewController has an "overFullScreen" modal style.
1578
1579         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1580         (-[WebAVPlayerViewController initWithFullscreenInterface:]):
1581
1582 2019-05-20  Chris Dumez  <cdumez@apple.com>
1583
1584         Fix security check in ScriptController::canAccessFromCurrentOrigin()
1585         https://bugs.webkit.org/show_bug.cgi?id=196730
1586         <rdar://problem/49731231>
1587
1588         Reviewed by Ryosuke Niwa.
1589
1590         Fix security check in ScriptController::canAccessFromCurrentOrigin() when there is no
1591         current JS exec state. Instead of returning true unconditionally, we now fall back to
1592         using the accessing document's origin for the security check. The new behavior is
1593         aligned with Blink:
1594         https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/html/html_frame_element_base.cc?rcl=d3f22423d512b45466f1694020e20da9e0c6ee6a&l=62
1595
1596         This fix is based on a patch from Sergei Glazunov <glazunov@google.com>.
1597
1598         Test: http/tests/security/showModalDialog-sync-cross-origin-page-load2.html
1599
1600         * bindings/js/ScriptController.cpp:
1601         (WebCore::ScriptController::canAccessFromCurrentOrigin):
1602         * bindings/js/ScriptController.h:
1603         * html/HTMLFrameElementBase.cpp:
1604         (WebCore::HTMLFrameElementBase::isURLAllowed const):
1605
1606 2019-05-20  Gabe Giosia  <giosia@google.com>
1607
1608         Range getBoundingClientRect returning zero rect on simple text node with <br> before it
1609         https://bugs.webkit.org/show_bug.cgi?id=182181
1610
1611         Reviewed by Antti Koivisto.
1612         
1613         Correct rect of RenderText in a block element when used in a Range
1614         over a line break element. The end offset was miscalculated.
1615
1616         Addded line-break case to fast/dom/Range/getBoundingClientRect.html
1617
1618         * rendering/SimpleLineLayoutFunctions.cpp:
1619         (WebCore::SimpleLineLayout::collectAbsoluteQuadsForRange):
1620         * rendering/SimpleLineLayoutResolver.cpp:
1621         (WebCore::SimpleLineLayout::RunResolver::rangeForRendererWithOffsets const):
1622
1623 2019-05-19  Brent Fulgham  <bfulgham@apple.com>
1624
1625         Unreviewed build fix after r245508.
1626
1627         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: Don't use
1628         an 'import' directive in a C++ file.
1629
1630 2019-05-19  Brent Fulgham  <bfulgham@apple.com>
1631
1632         Wait to get frame until after layout has been run
1633         https://bugs.webkit.org/show_bug.cgi?id=197999
1634         <rdar://problem/50800345>
1635
1636         Reviewed by Alex Christensen.
1637
1638         The current frame can change when layout runs, so don't bother retrieving
1639         the frame until the final layout pass is complete.
1640
1641         Test: fast/dom/window-inner-width-crash.html
1642
1643         * page/DOMWindow.cpp:
1644         (WebCore::DOMWindow::innerHeight const): Move frame access past the
1645         layout operation.
1646         (WebCore::DOMWindow::innerWidth const): Ditto.
1647         (WebCore::DOMWindow::scrollX const): Ditto.
1648         (WebCore::DOMWindow::scrollY const): Ditto.
1649
1650 2019-05-19  Brent Fulgham  <bfulgham@apple.com>
1651
1652         Unreviewed build fix
1653
1654         Attempting to build with only Open Source sources on shipping software with
1655         ASan enabled triggers build failures due to missing includes. This patch adds
1656         the necessary includes to cleanly build WebCore.
1657
1658         * Modules/applepay/ApplePaySession.cpp:
1659         * Modules/applepay/PaymentSession.cpp:
1660         * Modules/mediastream/UserMediaController.cpp:
1661         * bindings/js/ScriptController.cpp:
1662         * contentextensions/ContentExtensionsBackend.cpp:
1663         * dom/Document.cpp:
1664         * dom/ScriptedAnimationController.cpp:
1665         * editing/cocoa/EditorCocoa.mm:
1666         * editing/cocoa/HTMLConverter.mm:
1667         * editing/cocoa/WebContentReaderCocoa.mm:
1668         * editing/markup.cpp:
1669         * history/CachedFrame.cpp:
1670         * html/HTMLDocument.cpp:
1671         * html/HTMLHtmlElement.cpp:
1672         * html/HTMLMediaElement.cpp:
1673         * html/ImageDocument.cpp:
1674         * html/MediaDocument.cpp:
1675         * html/PluginDocument.cpp:
1676         * html/parser/HTMLDocumentParser.cpp:
1677         * html/parser/XSSAuditor.cpp:
1678         * inspector/InspectorInstrumentation.cpp:
1679         * inspector/agents/InspectorApplicationCacheAgent.cpp:
1680         * inspector/agents/InspectorNetworkAgent.cpp:
1681         * inspector/agents/InspectorPageAgent.cpp:
1682         * inspector/agents/page/PageNetworkAgent.cpp:
1683         * loader/ApplicationManifestLoader.cpp:
1684         * loader/FrameLoader.cpp:
1685         * loader/LoadTiming.cpp:
1686         * loader/NetscapePlugInStreamLoader.cpp:
1687         * loader/ResourceLoader.cpp:
1688         * loader/SubresourceLoader.cpp:
1689         * loader/appcache/ApplicationCacheHost.cpp:
1690         * loader/archive/cf/LegacyWebArchive.cpp:
1691         * loader/icon/IconLoader.cpp:
1692         * page/ContextMenuController.cpp:
1693         * page/FrameView.cpp:
1694         * page/Page.cpp:
1695         * page/Performance.cpp:
1696         * page/PerformanceNavigation.cpp:
1697         * page/Quirks.cpp:
1698         * page/UserContentProvider.cpp:
1699         * page/csp/ContentSecurityPolicy.cpp:
1700         * page/mac/PageMac.mm:
1701         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
1702         * svg/graphics/SVGImage.cpp:
1703         * testing/Internals.cpp:
1704
1705 2019-05-19  Antoine Quint  <graouts@apple.com>
1706
1707         [Pointer Events] Listening to a "pointerover", "pointerenter", "pointerout" or "pointerleave" event alone does not fire the event on iOS
1708         https://bugs.webkit.org/show_bug.cgi?id=197882
1709         <rdar://problem/50769116>
1710
1711         Reviewed by Dean Jackson.
1712
1713         Tests: pointerevents/ios/pointerenter-alone.html
1714                pointerevents/ios/pointerleave-alone.html
1715                pointerevents/ios/pointerout-alone.html
1716                pointerevents/ios/pointerover-alone.html
1717
1718         * dom/EventNames.h:
1719         (WebCore::EventNames::isTouchRelatedEventType const):
1720         (WebCore::EventNames::touchRelatedEventNames const):
1721         (WebCore::EventNames::extendedTouchRelatedEventNames const):
1722
1723 2019-05-19  Antoine Quint  <graouts@apple.com>
1724
1725         [Pointer Events] A pointer should be marked as primary for all of its events
1726         https://bugs.webkit.org/show_bug.cgi?id=197909
1727         <rdar://problem/50801608>
1728
1729         Reviewed by Dean Jackson.
1730
1731         Add an ivar for EventHandler which we'll use in WebKitAdditions code to track the touch identifier
1732         of the very first touch to start in a given sequence.
1733
1734         * page/EventHandler.h:
1735
1736 2019-05-19  Darin Adler  <darin@apple.com>
1737
1738         Change String::number to use "shortest" instead of "fixed precision 6 digits"
1739         https://bugs.webkit.org/show_bug.cgi?id=178319
1740
1741         Reviewed by Sam Weinig.
1742
1743         * accessibility/atk/WebKitAccessibleInterfaceValue.cpp:
1744         (webkitAccessibleSetNewValue): Use String::numberToStringFixedPrecision
1745         instead of String::number to be explicit about the fact that it's fixed precision.
1746         * page/linux/ResourceUsageOverlayLinux.cpp:
1747         (gcTimerString): Ditto.
1748
1749         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
1750         (printTransform): Use appendFixedPrecisionNumber instead of appendNumber
1751         to be explicit about the fact that it's fixed precision.
1752         (printLayer): Ditto.
1753         (WebCore::PlatformCALayerWin::layerTreeAsString const): Ditto.
1754         * platform/graphics/freetype/FontCacheFreeType.cpp:
1755         (buildVariationSettings): Ditto.
1756
1757         * svg/SVGNumberList.h: Use appendFixedPrecisionNumber instead of appendNumber
1758         to be explicit about the fact that it's fixed precision. We'll consider moving
1759         to shortest later.
1760
1761         * svg/SVGPathUtilities.cpp:
1762         (WebCore::buildStringFromPath): Use appendNumberShortest instead of
1763         appendNumberECMAScript since these are single-precision.
1764
1765         * svg/SVGPointList.h: Use appendFixedPrecisionNumber instead of appendNumber
1766         to be explicit about the fact that it's fixed precision. We'll consider moving
1767         to shortest later.
1768         * svg/SVGTransformValue.h: Ditto.
1769
1770 2019-05-19  Simon Fraser  <simon.fraser@apple.com>
1771
1772         Layers painting into shared backing need to contribute to overlap
1773         https://bugs.webkit.org/show_bug.cgi?id=198021
1774
1775         Reviewed by Zalan Bujtas.
1776         
1777         Layers that paint into a composited (non-root) layer get added to the overlap map so
1778         that later layers correct overlap them; this is done via the test against currentState.compositingAncestor.
1779
1780         We need the same logic for layers that paint into shared backing; they need to behave
1781         the same way in terms of how they contribute to overlap. We already had currentState.backingSharingAncestor
1782         which was unused, but now use it for this, and correctly null it out when a layer composites.
1783
1784         Bug was noticed during testing, and not known to affect any websites (though it probably does).
1785         
1786         Also move the overlap container popping into updateOverlapMap() so the two callers can
1787         share the code, and more explicitly track whether a container was pushed.
1788
1789         Test: compositing/shared-backing/sharing-child-contributes-to-overlap.html
1790
1791         * rendering/RenderLayerCompositor.cpp:
1792         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
1793         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
1794         (WebCore::RenderLayerCompositor::updateOverlapMap const):
1795         * rendering/RenderLayerCompositor.h:
1796
1797 2019-05-17  Joonghun Park  <pjh0718@gmail.com>
1798
1799         Implement CSS `display: flow-root` (modern clearfix)
1800         https://bugs.webkit.org/show_bug.cgi?id=165603
1801
1802         Reviewed by Zalan Bujtas.
1803
1804         This change follows https://drafts.csswg.org/css-display-3/#valdef-display-flow-root as below.
1805
1806         'display: flow-root' generates a block container box, and lays out its contents using flow layout.
1807         It always establishes a new block formatting context for its contents.
1808
1809         * css/CSSPrimitiveValueMappings.h:
1810         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1811         * css/CSSValueKeywords.in:
1812         * css/StyleResolver.cpp:
1813         (WebCore::equivalentBlockDisplay):
1814         * css/parser/CSSParserFastPaths.cpp:
1815         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1816         * rendering/RenderBox.cpp:
1817         (WebCore::RenderBox::createsNewFormattingContext const):
1818         * rendering/RenderElement.cpp:
1819         (WebCore::RenderElement::createFor):
1820         * rendering/style/RenderStyleConstants.h:
1821
1822 2019-05-17  Don Olmstead  <don.olmstead@sony.com>
1823
1824         [CMake] Use builtin FindICU
1825         https://bugs.webkit.org/show_bug.cgi?id=197934
1826
1827         Reviewed by Michael Catanzaro.
1828
1829         Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.
1830
1831         * CMakeLists.txt:
1832         * PlatformPlayStation.cmake:
1833         * PlatformWPE.cmake:
1834
1835 2019-05-17  Alex Christensen  <achristensen@webkit.org>
1836
1837         Enable legacy EME for iOS WKWebView
1838         https://bugs.webkit.org/show_bug.cgi?id=197964
1839         <rdar://problem/50625666>
1840
1841         Reviewed by Wenson Hsieh.
1842
1843         This was attempted unsuccessfully in r230169.
1844         Verified manually that it works as desired.
1845
1846         * page/RuntimeEnabledFeatures.h:
1847
1848 2019-05-17  Sihui Liu  <sihui_liu@apple.com>
1849
1850         ASSERTION FAILED: !m_backingStore in WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore(uint64_t)
1851         https://bugs.webkit.org/show_bug.cgi?id=197741
1852         <rdar://problem/50625006>
1853
1854         Reviewed by Youenn Fablet.
1855
1856         If an open request is made before a delete request, open task should be performed before delete task on the
1857         database thread. After r242911, open request needs to wait decision of StorageQuotaManager before posting task
1858         to database thread, while delete request needs not. This makes deletion happen before open.
1859
1860         We need to make sure tasks are in correct order by not starting next open or delete request when database is in 
1861         the middle of open or deletion.
1862
1863         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1864         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentOpenOperation):
1865         (WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations):
1866
1867 2019-05-17  Antoine Quint  <graouts@apple.com>
1868
1869         Add a website policy to disable the legacy -webkit-overflow-scrolling:touch behavior
1870         https://bugs.webkit.org/show_bug.cgi?id=197943
1871         <rdar://problem/49078202>
1872
1873         Reviewed by Brent Fulgham.
1874
1875         Tests: fast/scrolling/ipad/overflow-scrolling-touch-enabled-stacking-modern-compatibility-mode.html
1876                platform/ipad/fast/css/webkit-overflow-scrolling-parsing-modern-compatibility-mode.html
1877
1878         * css/parser/CSSParserContext.cpp:
1879         (WebCore::CSSParserContext::CSSParserContext):
1880         * loader/DocumentLoader.h:
1881         (WebCore::DocumentLoader::legacyOverflowScrollingTouchPolicy const):
1882         (WebCore::DocumentLoader::setLegacyOverflowScrollingTouchPolicy):
1883
1884 2019-05-17  Alex Christensen  <achristensen@webkit.org>
1885
1886         Add SPI to set a list of hosts to which to send custom header fields cross-origin
1887         https://bugs.webkit.org/show_bug.cgi?id=197397
1888
1889         Reviewed by Geoff Garen.
1890
1891         In r223001 I added the ability to send custom headers, but with a restriction that they will not be sent except to the origin of the main document.
1892         We need the ability to specify what origins to send these headers to even if they are not first party requests.
1893         We get this information in a list of strings which are the hosts to send the headers to.  Some of the strings have an asterisk at the beginning,
1894         indicating that the headers are to be sent to all subdomains.
1895
1896         I repurposed some ObjC SPI that was never adopted, but I keep testing the C API that was to verify no regression.
1897         I also added some new API tests for the new behavior.
1898
1899         * Sources.txt:
1900         * WebCore.xcodeproj/project.pbxproj:
1901         * loader/CustomHeaderFields.cpp: Added.
1902         (WebCore::CustomHeaderFields::thirdPartyDomainsMatch const):
1903         * loader/CustomHeaderFields.h: Added.
1904         (WebCore::CustomHeaderFields::encode const):
1905         (WebCore::CustomHeaderFields::decode):
1906         * loader/DocumentLoader.cpp:
1907         (WebCore::DocumentLoader::setCustomHeaderFields): Deleted.
1908         * loader/DocumentLoader.h:
1909         (WebCore::DocumentLoader::setCustomHeaderFields):
1910         (WebCore::DocumentLoader::customHeaderFields const):
1911         (WebCore::DocumentLoader::customHeaderFields): Deleted.
1912         * loader/cache/CachedResourceLoader.cpp:
1913         (WebCore::CachedResourceLoader::requestResource):
1914
1915 2019-05-17  Youenn Fablet  <youenn@apple.com>
1916
1917         Make AVVideoCaptureSource more robust to configuration failures
1918         https://bugs.webkit.org/show_bug.cgi?id=197997
1919         rdar://problem/50875662
1920
1921         Reviewed by Eric Carlson.
1922
1923         Covered by manual testing.
1924
1925         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1926         (WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate):
1927         Make sure to commit configuration once calling beginConfiguration.
1928         In case of error in setting frame rate, log the error but continue capturing.
1929
1930 2019-05-17  Rob Buis  <rbuis@igalia.com>
1931
1932         Implement imagesrcset and imagesizes attributes on link rel=preload
1933         https://bugs.webkit.org/show_bug.cgi?id=192950
1934
1935         Reviewed by Youenn Fablet.
1936
1937         Implement imagesrcset and imagesizes attributes for both Link header
1938         and link element.
1939
1940         Tests: imported/w3c/web-platform-tests/preload/dynamic-adding-preload-imagesrcset.html
1941                imported/w3c/web-platform-tests/preload/link-header-preload-delay-onload.html
1942                imported/w3c/web-platform-tests/preload/link-header-preload-imagesrcset.html
1943                imported/w3c/web-platform-tests/preload/link-header-preload-nonce.html
1944                imported/w3c/web-platform-tests/preload/link-header-preload.html
1945                imported/w3c/web-platform-tests/preload/onload-event.html
1946                imported/w3c/web-platform-tests/preload/preload-with-type.html
1947
1948         * html/HTMLAttributeNames.in:
1949         * html/HTMLLinkElement.cpp:
1950         (WebCore::HTMLLinkElement::process):
1951         * html/HTMLLinkElement.idl:
1952         * loader/LinkHeader.cpp:
1953         (WebCore::paramterNameFromString):
1954         (WebCore::LinkHeader::setValue):
1955         (WebCore::LinkHeader::LinkHeader):
1956         * loader/LinkHeader.h:
1957         (WebCore::LinkHeader::imageSrcSet const):
1958         (WebCore::LinkHeader::imageSizes const):
1959         (WebCore::LinkHeader::isViewportDependent const):
1960         * loader/LinkLoader.cpp:
1961         (WebCore::LinkLoader::loadLinksFromHeader):
1962         (WebCore::LinkLoader::preloadIfNeeded):
1963         (WebCore::LinkLoader::loadLink):
1964         * loader/LinkLoader.h:
1965
1966 2019-05-17  Keith Rollin  <krollin@apple.com>
1967
1968         Re-enable generate-xcfilelists
1969         https://bugs.webkit.org/show_bug.cgi?id=197933
1970         <rdar://problem/50831677>
1971
1972         Reviewed by Jonathan Bedard.
1973
1974         The following two tasks have been completed, and we can re-enable
1975         generate-xcfilelists:
1976
1977         Bug 197619 <rdar://problem/50507392> Temporarily disable generate-xcfilelists (197619)
1978         Bug 197622 <rdar://problem/50508222> Rewrite generate-xcfilelists in Python (197622)
1979
1980         No new tests -- no change in user-visible functionality.
1981
1982         * Scripts/check-xcfilelists.sh:
1983
1984 2019-05-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1985
1986         Fix a typo in some user agent string logic
1987         https://bugs.webkit.org/show_bug.cgi?id=197992
1988         <rdar://problem/50895962>
1989
1990         Reviewed by Brent Fulgham.
1991
1992         Adjust the major version number for the desktop user agent string.
1993
1994         * platform/ios/UserAgentIOS.mm:
1995         (WebCore::standardUserAgentWithApplicationName):
1996
1997 2019-05-17  Simon Fraser  <simon.fraser@apple.com>
1998
1999         REGRESSION (r245170): gmail.com inbox table header flickers
2000         https://bugs.webkit.org/show_bug.cgi?id=198005
2001         <rdar://problem/50907718>
2002
2003         Reviewed by Antti Koivisto.
2004
2005         When a layer started as painting into shared backing, but then became independently
2006         composited (e.g. by having to clip composited children), it wouldn't have the "overlap"
2007         indirect compositing reason. This allowed requiresOwnBackingStore() to say that it
2008         could paint into some ancestor, but this breaks overlap. So in this code path,
2009         put IndirectCompositingReason::Overlap back on the layer which restores the previous
2010         behavior.
2011
2012         Make some logging changes to help diagnose things like this.
2013
2014         Test: compositing/shared-backing/overlap-after-end-sharing.html
2015
2016         * rendering/RenderLayer.cpp:
2017         (WebCore::RenderLayer::calculateClipRects const):
2018         (WebCore::outputPaintOrderTreeLegend):
2019         (WebCore::outputPaintOrderTreeRecursive):
2020         * rendering/RenderLayer.h:
2021         * rendering/RenderLayerCompositor.cpp:
2022         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
2023         (WebCore::RenderLayerCompositor::updateBacking):
2024         (WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
2025         (WebCore::RenderLayerCompositor::reasonsForCompositing const):
2026         (WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const):
2027         * rendering/RenderLayerCompositor.h:
2028
2029 2019-05-17  Simon Fraser  <simon.fraser@apple.com>
2030
2031         REGRESSION (r245170): gmail.com header flickers when hovering over the animating buttons
2032         https://bugs.webkit.org/show_bug.cgi?id=197975
2033         <rdar://problem/50865946>
2034
2035         Reviewed by Antti Koivisto.
2036
2037         When computeCompositingRequirements() determined that a layer could paint into shared backing, it
2038         pushed an overlap container. If that layer then converted to normal composting, we'd push a second
2039         overlap container, which left the overlap map in a bad state for the rest of the compositing
2040         traversal, causing layers to not get composited when necessary.
2041
2042         Test: compositing/shared-backing/overlap-after-shared-to-composited.html
2043
2044         * rendering/RenderLayerCompositor.cpp:
2045         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
2046
2047 2019-05-17  Commit Queue  <commit-queue@webkit.org>
2048
2049         Unreviewed, rolling out r245401.
2050         https://bugs.webkit.org/show_bug.cgi?id=197990
2051
2052         Causing internal build failures (Requested by ShawnRoberts on
2053         #webkit).
2054
2055         Reverted changeset:
2056
2057         "Add SPI to set a list of hosts to which to send custom header
2058         fields cross-origin"
2059         https://bugs.webkit.org/show_bug.cgi?id=197397
2060         https://trac.webkit.org/changeset/245401
2061
2062 2019-05-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
2063
2064         SVGElement should detach itself from all its properties before it is deleted
2065         https://bugs.webkit.org/show_bug.cgi?id=197954
2066
2067         Reviewed by Simon Fraser.
2068
2069         Before deleting the SVGElement node, SVGElement::detachAllProperties()
2070         needs to be called. This will make the properties be detached objects
2071         which means no change will be committed unless these properties are
2072         attached to another owner.
2073
2074         Test: svg/dom/svg-properties-detach-change.html
2075
2076         * dom/Node.cpp:
2077         (WebCore::Node::removedLastRef):
2078         * svg/SVGElement.h:
2079         (WebCore::SVGElement::detachAllProperties):
2080
2081 2019-05-17  Eric Carlson  <eric.carlson@apple.com>
2082
2083         Allow sequential playback of media files when initial playback started with a user gesture
2084         https://bugs.webkit.org/show_bug.cgi?id=197959
2085         <rdar://problem/50655207>
2086
2087         Reviewed by Youenn Fablet.
2088
2089         Test: media/playlist-inherits-user-gesture.html
2090
2091         * dom/Document.cpp:
2092         (WebCore::Document::processingUserGestureForMedia const): Return true if it is within
2093         one second of the last HTMLMediaElement 'ended' event.
2094         * dom/Document.h:
2095         (WebCore::Document::mediaFinishedPlaying):
2096
2097         * html/HTMLMediaElement.cpp:
2098         (WebCore::HTMLMediaElement::parseAttribute): removeBehaviorsRestrictionsAfterFirstUserGesture -> 
2099         removeBehaviorRestrictionsAfterFirstUserGesture.
2100         (WebCore::HTMLMediaElement::load): Ditto. Don't call removeBehaviorsRestrictionsAfterFirstUserGesture,
2101         it will be done in prepareForLoad.
2102         (WebCore::HTMLMediaElement::prepareForLoad): removeBehaviorsRestrictionsAfterFirstUserGesture -> 
2103         removeBehaviorRestrictionsAfterFirstUserGesture.
2104         (WebCore::HTMLMediaElement::audioTrackEnabledChanged): Ditto.
2105         (WebCore::HTMLMediaElement::play): Ditto.
2106         (WebCore::HTMLMediaElement::pause): Ditto.
2107         (WebCore::HTMLMediaElement::setVolume): Ditto.
2108         (WebCore::HTMLMediaElement::setMuted): Ditto.
2109         (WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker): Ditto.
2110         (WebCore::HTMLMediaElement::dispatchEvent): Call document().mediaFinishedPlaying()
2111         when dispatching the 'ended' event.
2112         (WebCore::HTMLMediaElement::removeBehaviorRestrictionsAfterFirstUserGesture): Rename. Set
2113         m_removedBehaviorRestrictionsAfterFirstUserGesture.
2114         (WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture): Deleted.
2115         * html/HTMLMediaElement.h:
2116         
2117         * html/HTMLVideoElement.cpp:
2118         (WebCore:HTMLVideoElement::nativeImageForCurrentTime): Convert to runtime logging.
2119         (WebCore:HTMLVideoElement::webkitEnterFullscreen): Ditto.
2120         (WebCore:HTMLVideoElement::webkitSetPresentationMode): Ditto.
2121         (WebCore:HTMLVideoElement::fullscreenModeChanged): Ditto.
2122
2123         * html/MediaElementSession.cpp:
2124         (WebCore::MediaElementSession::removeBehaviorRestriction): Update log message.
2125
2126 2019-05-17  Brent Fulgham  <bfulgham@apple.com>
2127
2128         Hardening: Prevent FrameLoader crash due to SetForScope
2129         https://bugs.webkit.org/show_bug.cgi?id=197458
2130         <rdar://problem/50368338>
2131
2132         Reviewed by Chris Dumez.
2133
2134         Since SetForScope takes action during a function returns, it might cause
2135         a crash if its scope is broader than the value it is resetting.
2136
2137         * loader/FrameLoader.cpp:
2138         (WebCore::FrameLoader::loadDifferentDocumentItem):
2139
2140 2019-05-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2141
2142         [GTK] Need WebKitContextMenuItemType to open emoji picker
2143         https://bugs.webkit.org/show_bug.cgi?id=176760
2144
2145         Reviewed by Michael Catanzaro.
2146
2147         Add a new context menu item to insert an emoji.
2148
2149         * loader/EmptyClients.cpp: Empty implementation of ContextMenuClient::insertEmoji().
2150         * page/ContextMenuClient.h: Add insertEmoji for GTK port.
2151         * page/ContextMenuController.cpp:
2152         (WebCore::ContextMenuController::contextMenuItemSelected): Handle insert emoji action.
2153         (WebCore::ContextMenuController::populate): Add insert emoji item after select all.
2154         (WebCore::ContextMenuController::checkOrEnableIfNeeded const): Handle insert emoji action.
2155         * platform/ContextMenuItem.h: Add insert emoji action.
2156         * platform/LocalizedStrings.h:
2157         * platform/gtk/LocalizedStringsGtk.cpp:
2158         (WebCore::contextMenuItemTagInsertEmoji):
2159
2160 2019-05-16  Greg Doolittle  <gr3g@apple.com>
2161
2162         AX: Unship some ARIA string reflectors that are to-be-replaced by element reflection
2163         https://bugs.webkit.org/show_bug.cgi?id=197764
2164         <rdar://problem/50649689>
2165
2166         Reviewed by Chris Fleizach.
2167
2168         Specifically these:
2169         - ariaActiveDescendant
2170         - ariaControls
2171         - ariaDescribedBy
2172         - ariaDetails
2173         - ariaErrorMessage
2174         - ariaFlowTo
2175         - ariaLabelledBy
2176         - ariaOwns
2177
2178         Test: LayoutTests/accessibility/ARIA-reflections.html (updated)
2179
2180         * accessibility/AriaAttributes.idl:
2181
2182 2019-05-16  Youenn Fablet  <youenn@apple.com>
2183
2184         CoreAudioCaptureSource should be marked as an audio capture track
2185         https://bugs.webkit.org/show_bug.cgi?id=197953
2186         <rdar://problem/50552007>
2187
2188         Reviewed by Eric Carlson.
2189
2190         Manually tested.
2191
2192         * platform/mediastream/mac/CoreAudioCaptureSource.h:
2193         Mark it as microphone so that it can get muted properly.
2194
2195 2019-05-16  Alex Christensen  <achristensen@webkit.org>
2196
2197         Add SPI to set a list of hosts to which to send custom header fields cross-origin
2198         https://bugs.webkit.org/show_bug.cgi?id=197397
2199
2200         Reviewed by Geoff Garen.
2201
2202         In r223001 I added the ability to send custom headers, but with a restriction that they will not be sent except to the origin of the main document.
2203         We need the ability to specify what origins to send these headers to even if they are not first party requests.
2204         We get this information in a list of strings which are the hosts to send the headers to.  Some of the strings have an asterisk at the beginning,
2205         indicating that the headers are to be sent to all subdomains.
2206
2207         I repurposed some ObjC SPI that was never adopted, but I keep testing the C API that was to verify no regression.
2208         I also added some new API tests for the new behavior.
2209
2210         * Sources.txt:
2211         * WebCore.xcodeproj/project.pbxproj:
2212         * loader/CustomHeaderFields.cpp: Added.
2213         (WebCore::CustomHeaderFields::thirdPartyDomainsMatch const):
2214         * loader/CustomHeaderFields.h: Added.
2215         (WebCore::CustomHeaderFields::encode const):
2216         (WebCore::CustomHeaderFields::decode):
2217         * loader/DocumentLoader.cpp:
2218         (WebCore::DocumentLoader::setCustomHeaderFields): Deleted.
2219         * loader/DocumentLoader.h:
2220         (WebCore::DocumentLoader::setCustomHeaderFields):
2221         (WebCore::DocumentLoader::customHeaderFields const):
2222         (WebCore::DocumentLoader::customHeaderFields): Deleted.
2223         * loader/cache/CachedResourceLoader.cpp:
2224         (WebCore::CachedResourceLoader::requestResource):
2225
2226 2019-05-16  Ali Juma  <ajuma@chromium.org>
2227
2228         [IntersectionObserver] Regression: No initial observation when nothing else triggers rendering
2229         https://bugs.webkit.org/show_bug.cgi?id=197891
2230
2231         Reviewed by Simon Fraser.
2232
2233         Schedule a rendering update whenever a new IntersectionObserver target is added.
2234
2235         Test: intersection-observer/initial-observation.html
2236
2237         * page/IntersectionObserver.cpp:
2238         (WebCore::IntersectionObserver::observe):
2239
2240 2019-05-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2241
2242         [FreeType] Some character sequences with a variation selector are not rendered
2243         https://bugs.webkit.org/show_bug.cgi?id=197838
2244
2245         Reviewed by Michael Catanzaro.
2246
2247         We get the invalid glyph instead. See http://mts.io/2015/04/21/unicode-symbol-render-text-emoji/. In the table at
2248         the end the Emoji and Text columns are not correctly rendered. It happens also when copying an emoji from
2249         GtkEmojiChooser and pasting in WebKit text field, because GTK appends U+FE0F to all emojis to force the emoji
2250         style. We need to take into account the variation selector when checking if a font can render a combining
2251         sequence, using FT_Face_GetCharVariantIndex to get the right glyph in case of variation character present.
2252
2253         * platform/graphics/Font.cpp:
2254         (WebCore::Font::platformSupportsCodePoint const): Add optional variation parameter.
2255         (WebCore::Font::canRenderCombiningCharacterSequence const): Take into account variation selector characters
2256         * platform/graphics/Font.h:
2257         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
2258         (WebCore::FontCascade::fontForCombiningCharacterSequence const): Check variation selectors 0xFE0E and 0xFE0F to
2259         decide whether to use the emoji or text style.
2260         * platform/graphics/cocoa/FontCocoa.mm:
2261         (WebCore::Font::platformSupportsCodePoint const): Return false when a variation character is passed so that
2262         characters are checked individually.
2263         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
2264         (WebCore::Font::platformSupportsCodePoint const): Use FT_Face_GetCharVariantIndex when a variation character is
2265         passed.
2266         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
2267         (WebCore::harfBuzzFontFunctions): Do not return true when FT_Face_GetCharVariantIndex returns 0.
2268
2269 2019-05-16  Greg Hughes  <ghughes@apple.com>
2270
2271         Updated screenHasInvertedColors to use AppKit when available
2272         https://bugs.webkit.org/show_bug.cgi?id=197935
2273         <rdar://problem/50834405>
2274
2275         Reviewed by Chris Fleizach.
2276
2277         * platform/mac/PlatformScreenMac.mm:
2278         (WebCore::collectScreenProperties):
2279         (WebCore::screenHasInvertedColors):
2280
2281 2019-05-15  Simon Fraser  <simon.fraser@apple.com>
2282
2283         Avoid a recursive descendants layer walk sometimes
2284         https://bugs.webkit.org/show_bug.cgi?id=197939
2285
2286         Reviewed by Zalan Bujtas.
2287
2288         If a layer got composited post-descendants because it needs to clip, for example, we'd do a recursive
2289         descendant tree walk to add layers to the overlap map. However, all the descendants would already
2290         have contributed to the overlap map if some non-root ancestor was already composited. So we can
2291         skip the addDescendantsToOverlapMapRecursive() if we know, before descendants, whether there's
2292         a non-root composited ancestor.
2293
2294         * rendering/RenderLayerCompositor.cpp:
2295         (WebCore::RenderLayerCompositor::CompositingState::hasNonRootCompositedAncestor const):
2296         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
2297
2298 2019-05-15  Simon Fraser  <simon.fraser@apple.com>
2299
2300         Clean up code related to compositing overlap map maintenance
2301         https://bugs.webkit.org/show_bug.cgi?id=197936
2302
2303         Reviewed by Zalan Bujtas.
2304
2305         Clarify the logic around updating the overlap map:
2306
2307         When a layer becomes composited, or paints into a non-root composited layer, we add it to the overlap map
2308         after traversing descendants (since it only affets layers later in traversal).
2309
2310         If a layer became composited after traversing descendants, we need to go back and add all the descendants
2311         to the overlap map with a recursive traversal.
2312
2313         We can do all this near the end of computeCompositingRequirements/traverseUnchangedSubtree because
2314         we only check overlap when we enter this function on later layers.
2315
2316         Add a CompositingOverlap log channel and use it to log the state of the overlap map.
2317
2318         * platform/Logging.h:
2319         * rendering/RenderLayerCompositor.cpp:
2320         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
2321         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
2322         (WebCore::RenderLayerCompositor::addToOverlapMap const):
2323         (WebCore::RenderLayerCompositor::addDescendantsToOverlapMapRecursive const):
2324         (WebCore::RenderLayerCompositor::updateOverlapMap const):
2325         (WebCore::RenderLayerCompositor::addToOverlapMap): Deleted.
2326         (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): Deleted.
2327         * rendering/RenderLayerCompositor.h:
2328
2329 2019-05-15  Timothy Hatcher  <timothy@apple.com>
2330
2331         REGRESSION (r245072): Missing code in Document::styleColorOptions to propagate StyleColor::Options::UseInactiveAppearance
2332         https://bugs.webkit.org/show_bug.cgi?id=197930
2333         rdar://problem/49833954
2334
2335         Reviewed by Wenson Hsieh and Megan Gardner.
2336
2337         Add some code that was missing from Document in my original patch for r245072.
2338
2339         * dom/Document.cpp:
2340         (WebCore::Document::useSystemAppearance const): Drive-by fix code style.
2341         (WebCore::Document::useInactiveAppearance const): Added.
2342         (WebCore::Document::styleColorOptions const): Add StyleColor::Options::UseInactiveAppearance.
2343         * dom/Document.h: Added useInactiveAppearance().
2344
2345 2019-05-15  Devin Rousso  <drousso@apple.com>
2346
2347         Web Inspector: user gesture toggle should also force user interaction flag
2348         https://bugs.webkit.org/show_bug.cgi?id=197269
2349
2350         Reviewed by Joseph Pecoraro.
2351
2352         Test: inspector/runtime/evaluate-userGestureEmulation-userIsInteracting.html
2353
2354         * inspector/agents/page/PageRuntimeAgent.cpp:
2355         (WebCore::PageRuntimeAgent::evaluate):
2356
2357         * page/ChromeClient.h:
2358         (WebCore::ChromeClient::userIsInteracting const): Added.
2359         (WebCore::ChromeClient::setUserIsInteracting): Added.
2360
2361         * testing/Internals.idl:
2362         * testing/Internals.h:
2363         * testing/Internals.cpp:
2364         (WebCore::Internals::userIsInteracting): Added.
2365
2366 2019-05-15  Zalan Bujtas  <zalan@apple.com>
2367
2368         Do not create a shape object outside of the layout context
2369         https://bugs.webkit.org/show_bug.cgi?id=197926
2370         <rdar://problem/50627858>
2371
2372         Reviewed by Simon Fraser.
2373
2374         ShapeOutside objects are used to compute line constrains during layout (in a strict sense, they are part of the layout context and should only be mutated during layout).
2375         If we don't create one during layout, we probably don't need to know its geometry during paint (or any other non-layout activity) either.
2376
2377         Test: fast/block/float/float-with-shape-outside-crash.html
2378
2379         * rendering/FloatingObjects.cpp:
2380         (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
2381         (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
2382         * rendering/shapes/ShapeOutsideInfo.cpp:
2383         (WebCore::ShapeOutsideInfo::computeDeltasForContainingBlockLine):
2384
2385 2019-05-15  Youenn Fablet  <youenn@apple.com>
2386
2387         Mark beacon and ping loads as low priority
2388         https://bugs.webkit.org/show_bug.cgi?id=197919
2389         <rdar://problem/50818286>
2390
2391         Reviewed by Alex Christensen.
2392
2393         No JS observable change of behavior.
2394
2395         * Modules/beacon/NavigatorBeacon.cpp:
2396         (WebCore::NavigatorBeacon::sendBeacon):
2397         * loader/PingLoader.cpp:
2398         (WebCore::PingLoader::sendPing):
2399
2400 2019-05-15  Simon Fraser  <simon.fraser@apple.com>
2401
2402         Clean up RenderLayerCompositor::computeCompositingRequirements() and traverseUnchangedSubtree()
2403         https://bugs.webkit.org/show_bug.cgi?id=197931
2404
2405         Reviewed by Zalan Bujtas.
2406
2407         These functions have grown and become hard to maintain, so try to undo some technical debt.
2408
2409         Rename "childState" to "currentState" since it's the state we pass to children, but also
2410         is state we change when the current layer becomes composited.
2411
2412         Separate the layerWillComposite() lambda from layerWillCompositePostDescendants().
2413
2414         Group the chunks of code at end of the functions into:
2415             - updating bits on RenderLayer
2416             - updating compositingState with changes from children and our state
2417             - doing post-traversal work on overlapMap and backingSharingState
2418
2419         Code shared between the two functions is pushed into CompositingState::updateWithDescendantStateAndLayer().
2420
2421         This moves code around but should not cause any behavior change.
2422
2423         * rendering/RenderLayerBacking.cpp:
2424         (WebCore::RenderLayerBacking::updateConfiguration):
2425         * rendering/RenderLayerCompositor.cpp:
2426         (WebCore::RenderLayerCompositor::OverlapExtent::knownToBeHaveExtentUncertainty const):
2427         (WebCore::RenderLayerCompositor::CompositingState::updateWithDescendantStateAndLayer):
2428         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
2429         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
2430         (WebCore::RenderLayerCompositor::clipsCompositingDescendants):
2431         (WebCore::RenderLayerCompositor::CompositingState::propagateStateFromChildren): Deleted.
2432         (WebCore::RenderLayerCompositor::CompositingState::propagateStateFromChildrenForUnchangedSubtree): Deleted.
2433         (WebCore::RenderLayerCompositor::clipsCompositingDescendants const): Deleted.
2434         * rendering/RenderLayerCompositor.h:
2435
2436 2019-05-15  Simon Fraser  <simon.fraser@apple.com>
2437
2438         Make LayerOverlapMap able to output to a TextStream
2439         https://bugs.webkit.org/show_bug.cgi?id=197923
2440
2441         Reviewed by Zalan Bujtas.
2442
2443         Make it possible output LayerOverlapMap to a TextStream for logging.
2444
2445         * rendering/LayerOverlapMap.cpp:
2446         (WebCore::OverlapMapContainer::rectList const):
2447         (WebCore::operator<<):
2448         * rendering/LayerOverlapMap.h:
2449         (WebCore::LayerOverlapMap::overlapStack const):
2450
2451 2019-05-15  Youenn Fablet  <youenn@apple.com>
2452
2453         getUserMedia sandbox extensions should not be revoked when a getUserMedia allowed request is being processed
2454         https://bugs.webkit.org/show_bug.cgi?id=197851
2455
2456         Reviewed by Alex Christensen.
2457
2458         Add a completion handler to create a new capture stream.
2459         This is used by WK2 layer to acknowledge the pending capture request is completed.
2460         Just after the completion handler, make sure to update the document media state.
2461         This is done to ensure that, should capture failing, the UIProcess
2462         knows about it and can manage proper sandbox extension revocation.
2463
2464         Test: fast/mediastream/gum-stop-track.html
2465
2466         * Modules/mediastream/UserMediaRequest.cpp:
2467         (WebCore::UserMediaRequest::allow):
2468         (WebCore::UserMediaRequest::PendingActivationMediaStream::PendingActivationMediaStream):
2469         (WebCore::UserMediaRequest::PendingActivationMediaStream::~PendingActivationMediaStream):
2470         * Modules/mediastream/UserMediaRequest.h:
2471         (WebCore::UserMediaRequest::PendingActivationMediaStream::create):
2472         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2473         (WebCore::MockRealtimeMediaSourceCenter::mockRealtimeMediaSourceCenterEnabled):
2474         * platform/mock/MockRealtimeMediaSourceCenter.h:
2475
2476 2019-05-15  Simon Fraser  <simon.fraser@apple.com>
2477
2478         Make LOG_WITH_STREAM more efficient
2479         https://bugs.webkit.org/show_bug.cgi?id=197905
2480
2481         Reviewed by Alex Christensen.
2482
2483         No longer need to conditionalize ClipRects logging on the channel being enabled
2484         since LOG_WITH_STREAM fix the performance problem.
2485
2486         Convert some RenderLayerCompositor logging to use LOG_WITH_STREAM.
2487
2488         * rendering/RenderLayer.cpp:
2489         (WebCore::RenderLayer::calculateClipRects const):
2490         (WebCore::clipRectsLogEnabled): Deleted.
2491         * rendering/RenderLayerCompositor.cpp:
2492         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
2493         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
2494
2495 2019-05-15  Simon Fraser  <simon.fraser@apple.com>
2496
2497         Move RenderLayerCompositor's OverlapMap to its own file
2498         https://bugs.webkit.org/show_bug.cgi?id=197915
2499
2500         Reviewed by Alex Christensen.
2501
2502         Move OverlapMap to its own file.
2503         Make use of RectList, which was in the file but unused!
2504         Allocate OverlapMapContainer on the heap both to avoid header pollution of internals,
2505         and because they will get bigger in future.
2506
2507         No behavior change.
2508
2509         * Sources.txt:
2510         * WebCore.xcodeproj/project.pbxproj:
2511         * rendering/LayerOverlapMap.cpp: Added.
2512         (WebCore::RectList::append):
2513         (WebCore::RectList::intersects const):
2514         (WebCore::OverlapMapContainer::add):
2515         (WebCore::OverlapMapContainer::overlapsLayers const):
2516         (WebCore::OverlapMapContainer::unite):
2517         (WebCore::LayerOverlapMap::LayerOverlapMap):
2518         (WebCore::LayerOverlapMap::add):
2519         (WebCore::LayerOverlapMap::overlapsLayers const):
2520         (WebCore::LayerOverlapMap::pushCompositingContainer):
2521         (WebCore::LayerOverlapMap::popCompositingContainer):
2522         * rendering/LayerOverlapMap.h: Added.
2523         (WebCore::LayerOverlapMap::isEmpty const):
2524         (WebCore::LayerOverlapMap::geometryMap const):
2525         (WebCore::LayerOverlapMap::geometryMap):
2526         * rendering/RenderLayerCompositor.cpp:
2527         (WebCore::RenderLayerCompositor::updateCompositingLayers):
2528         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
2529         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
2530         (WebCore::RenderLayerCompositor::computeExtent const):
2531         (WebCore::RenderLayerCompositor::addToOverlapMap):
2532         (WebCore::RenderLayerCompositor::addToOverlapMapRecursive):
2533         (WebCore::OverlapMapContainer::add): Deleted.
2534         (WebCore::OverlapMapContainer::overlapsLayers const): Deleted.
2535         (WebCore::OverlapMapContainer::unite): Deleted.
2536         (WebCore::RenderLayerCompositor::OverlapMap::OverlapMap): Deleted.
2537         (WebCore::RenderLayerCompositor::OverlapMap::add): Deleted.
2538         (WebCore::RenderLayerCompositor::OverlapMap::overlapsLayers const): Deleted.
2539         (WebCore::RenderLayerCompositor::OverlapMap::isEmpty const): Deleted.
2540         (WebCore::RenderLayerCompositor::OverlapMap::pushCompositingContainer): Deleted.
2541         (WebCore::RenderLayerCompositor::OverlapMap::popCompositingContainer): Deleted.
2542         (WebCore::RenderLayerCompositor::OverlapMap::geometryMap const): Deleted.
2543         (WebCore::RenderLayerCompositor::OverlapMap::geometryMap): Deleted.
2544         (WebCore::RenderLayerCompositor::OverlapMap::RectList::append): Deleted.
2545         (WebCore::RenderLayerCompositor::OverlapMap::RectList::intersects const): Deleted.
2546         * rendering/RenderLayerCompositor.h:
2547
2548 2019-05-15  Devin Rousso  <drousso@apple.com>
2549
2550         Web Automation: elements larger than the viewport have incorrect in-view center point
2551         https://bugs.webkit.org/show_bug.cgi?id=195696
2552         <rdar://problem/48737122>
2553
2554         Reviewed by Simon Fraser.
2555
2556         Original patch by Brian Burg <bburg@apple.com>.
2557
2558         Some conversion methods do not exist for `FloatRect`/`FloatPoint`. Fill them in as needed,
2559         and export some symbols used by WebDriver code to compute an element's in-view center point
2560         in various coordinate systems.
2561
2562         * dom/TreeScope.h:
2563         * dom/TreeScope.cpp:
2564         (WebCore::TreeScope::elementsFromPoint): Added.
2565         * page/FrameView.h:
2566         * page/FrameView.cpp:
2567         (WebCore::FrameView::absoluteToLayoutViewportPoint const): Added.
2568         (WebCore::FrameView::layoutViewportToAbsoluteRect const): Added.
2569         (WebCore::FrameView::absoluteToLayoutViewportRect const): Added.
2570         * platform/ScrollView.h:
2571         * platform/ScrollView.cpp:
2572         (WebCore::ScrollView::viewToContents const): Added.
2573         (WebCore::ScrollView::contentsToView const): Added.
2574         (WebCore::ScrollView::contentsToRootView const): Added.
2575         * platform/Widget.h:
2576         * platform/Widget.cpp:
2577         (WebCore::Widget::convertToRootView const): Added.
2578         (WebCore::Widget::convertFromRootView const): Added.
2579         (WebCore::Widget::convertToContainingView const): Added.
2580         (WebCore::Widget::convertFromContainingView const): Added.
2581
2582 2019-05-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2583
2584         Missing cursor/caret showing in search field on google.com
2585         https://bugs.webkit.org/show_bug.cgi?id=197862
2586         <rdar://problem/50291989>
2587
2588         Reviewed by Simon Fraser.
2589
2590         In this bug, the search field is inside of a fixed position container, which is inside of an empty "overflow:
2591         hidden" form element (the new layout test demonstrates a simple version of this). The layer of the fixed
2592         position container's renderer has an overflow clipping layer of itself, and its clipping rect is non-empty, so
2593         the heuristic initially identifies the layer as not fully clipped. However, as the heuristic ascends the
2594         RenderLayer tree, it then finds the layer for the "overflow: hidden" form element's renderer; this layer is
2595         completely clipped, which causes the heuristic to incorrectly believe that the editable element is completely
2596         clipped.
2597
2598         To fix the bug, this patch reworks the clipping portion of the heuristic, such that we no longer need to ascend
2599         the layer tree. Instead of computing the clip rect relative to the nearest ancestor that has an overflow clip
2600         and then walking up the layer tree repeating this process, simply compute the clip rect relative to RenderView's
2601         layer, and then walk up to the parent frame and repeat if necessary.
2602
2603         Test: editing/selection/ios/do-not-hide-selection-in-visible-field.html
2604
2605         * rendering/RenderLayer.cpp:
2606         (WebCore::RenderLayer::isTransparentOrFullyClippedRespectingParentFrames const):
2607
2608 2019-05-14  Andy Estes  <aestes@apple.com>
2609
2610         [Apple Pay] Payment APIs should be completely disabled in web views into which clients have injected user scripts
2611         https://bugs.webkit.org/show_bug.cgi?id=197751
2612         <rdar://problem/50631563>
2613
2614         Reviewed by Alex Christensen.
2615
2616         In r243324, when a document has had user agent scripts injected into it, payment APIs were
2617         disabled at runtime by having all entry points return falsy values or throw exceptions
2618         (e.g., ApplePaySession.canMakePayments() returns false).
2619
2620         In the case of user scripts in particular (e.g., WKUserScript), since we know whether these
2621         exist at the time we create a document's DOMWindow, we can do better than r243324 by
2622         completely disabling the payment APIs in the presence of user scripts.
2623
2624         To achieve this, this change introduces the 'EnabledByContext' extended attribute for
2625         interfaces, which instructs the bindings generator to add a conjunct to the payment API
2626         constructors that asks the interface's implementation class whether it should be enabled for
2627         a given ScriptExecutionContext. The PaymentRequest and ApplePaySession interfaces adopt this
2628         new extended attribute to implement the new user script check.
2629
2630         Added new API tests.
2631
2632         * Modules/applepay/ApplePaySession.idl:
2633         * Modules/applepay/PaymentCoordinator.cpp:
2634         (WebCore::PaymentCoordinator::shouldEnableApplePayAPIs const):
2635         * Modules/applepay/PaymentCoordinator.h:
2636         * Modules/applepay/PaymentSession.cpp:
2637         (WebCore::PaymentSession::enabledForContext):
2638         * Modules/applepay/PaymentSession.h:
2639         * Modules/paymentrequest/PaymentHandler.cpp:
2640         (WebCore::PaymentHandler::enabledForContext):
2641         * Modules/paymentrequest/PaymentHandler.h:
2642         * Modules/paymentrequest/PaymentRequest.cpp:
2643         (WebCore::PaymentRequest::enabledForContext):
2644         * Modules/paymentrequest/PaymentRequest.h:
2645         * Modules/paymentrequest/PaymentRequest.idl:
2646         * bindings/scripts/CodeGeneratorJS.pm:
2647         (NeedsRuntimeCheck):
2648         (GenerateRuntimeEnableConditionalString):
2649         * bindings/scripts/IDLAttributes.json:
2650         * bindings/scripts/preprocess-idls.pl:
2651         (GenerateConstructorAttributes):
2652         * bindings/scripts/test/JS/JSTestEnabledForContext.cpp: Added.
2653         * bindings/scripts/test/JS/JSTestEnabledForContext.h: Added.
2654         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2655         (WebCore::JSTestGlobalObject::finishCreation):
2656         (WebCore::jsTestGlobalObjectTestEnabledForContextConstructorGetter):
2657         (WebCore::jsTestGlobalObjectTestEnabledForContextConstructor):
2658         (WebCore::setJSTestGlobalObjectTestEnabledForContextConstructorSetter):
2659         (WebCore::setJSTestGlobalObjectTestEnabledForContextConstructor):
2660         * bindings/scripts/test/TestEnabledForContext.idl: Added.
2661
2662 2019-05-14  Robin Morisset  <rmorisset@apple.com>
2663
2664         [WHLSL] parseEffectfulSuffix() is never called
2665         https://bugs.webkit.org/show_bug.cgi?id=195864
2666         <rdar://problem/50746278>
2667
2668         Reviewed by Myles C. Maxfield.
2669
2670         The fix is trivial: when parseEffectfulPrefix does not see a ++ or --, it must call parseEffectfulSuffix.
2671
2672         No test yet, as it is not testable until the property resolver is finished.
2673         It will be tested with the rest of the compiler, when we port the testsuite from the js implementation (it already covers this case).
2674
2675         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
2676         (WebCore::WHLSL::Parser::parseEffectfulPrefix):
2677
2678 2019-05-14  Robin Morisset  <rmorisset@apple.com>
2679
2680         [WHLSL] parseEffectfulAssignment should not call parseCallExpression directly
2681         https://bugs.webkit.org/show_bug.cgi?id=197890
2682
2683         Reviewed by Myles Maxfield.
2684
2685         callExpression already appears in effSuffix which is in effPrefix which is in effAssignment, so having it directly in effAssignment as well is useless (and ambiguous).
2686         I've already fixed the grammar (https://github.com/gpuweb/WHLSL/commit/a07005f4d692fe3370618dca5db218992b362049), the grammar was always good, this patch is fixing the parser.
2687
2688         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
2689         (WebCore::WHLSL::Parser::parseEffectfulAssignment):
2690
2691 2019-05-14  Ross Kirsling  <ross.kirsling@sony.com>
2692
2693         Unreviewed restoration of non-unified build.
2694
2695         * Modules/cache/DOMCache.cpp:
2696         * bindings/js/JSLazyEventListener.h:
2697         * loader/NavigationScheduler.h:
2698         * page/Quirks.cpp:
2699         * page/Quirks.h:
2700         * rendering/ClipRect.cpp:
2701
2702 2019-05-14  Zalan Bujtas  <zalan@apple.com>
2703
2704         Do not try to issue repaint while the render tree is being destroyed.
2705         https://bugs.webkit.org/show_bug.cgi?id=197461
2706         <rdar://problem/50368992>
2707
2708         Reviewed by Simon Fraser.
2709
2710         Test: http/tests/svg/crash-on-reload-with-filter.html
2711
2712         We don't need to compute repaint rects when the render tree is getting torn down. We'll issue a full repaint at some point.
2713         Also during full render tree destruction the inline tree state is undefined. We should avoid accessing it.
2714
2715         * rendering/svg/RenderSVGResourceContainer.cpp:
2716         (WebCore::RenderSVGResourceContainer::markAllClientLayersForInvalidation):
2717
2718 2019-05-14  Youenn Fablet  <youenn@apple.com>
2719
2720         A service worker process should app nap when all its clients app nap
2721         https://bugs.webkit.org/show_bug.cgi?id=185626
2722         <rdar://problem/46785908>
2723
2724         Reviewed by Alex Christensen.
2725
2726         Update RegistrableDomain to work with SecurityOriginData.
2727         Add internal API to enable accessing to service worker process throttle state.
2728
2729         Test: http/wpt/service-workers/mac/processSuppression.https.html
2730
2731         * platform/RegistrableDomain.h:
2732         (WebCore::RegistrableDomain::RegistrableDomain):
2733         (WebCore::RegistrableDomain::matches const):
2734         (WebCore::RegistrableDomain::registrableDomainFromHost):
2735         * testing/ServiceWorkerInternals.cpp:
2736         (WebCore::ServiceWorkerInternals::isThrottleable const):
2737         * testing/ServiceWorkerInternals.h:
2738         * testing/ServiceWorkerInternals.idl:
2739         * workers/service/SWClientConnection.h:
2740         * workers/service/context/SWContextManager.cpp:
2741         * workers/service/context/SWContextManager.h:
2742         * workers/service/server/SWServer.cpp:
2743         (WebCore::SWServer::serverToContextConnectionCreated):
2744         * workers/service/server/SWServer.h:
2745         (WebCore::SWServer::Connection::server const):
2746         (WebCore::SWServer::connections const):
2747         * workers/service/server/SWServerToContextConnection.h:
2748
2749 2019-05-14  Youenn Fablet  <youenn@apple.com>
2750
2751         getUserMedia capture changes on iOS after homing out
2752         https://bugs.webkit.org/show_bug.cgi?id=197707
2753
2754         Reviewed by Eric Carlson.
2755
2756         In case of muting an AVVideoCaptureSource on iOS, the session is cleared.
2757         We need to store the preset information, to setup the new session on unnmuting correctly.
2758         Manually tested.
2759
2760         * platform/mediastream/mac/AVVideoCaptureSource.h:
2761         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2762         (WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset):
2763         (WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate):
2764         (WebCore::AVVideoCaptureSource::setupCaptureSession):
2765
2766 2019-05-14  Oriol Brufau  <obrufau@igalia.com>
2767
2768         [css-grid] Update grid when changing auto repeat type
2769         https://bugs.webkit.org/show_bug.cgi?id=197849
2770
2771         Reviewed by Javier Fernandez.
2772
2773         Test: imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-change-auto-repeat-tracks.html
2774
2775         This patch makes two 'repeat()' values for 'grid-template' be considered
2776         to be different if one uses 'auto-fill' and the other 'auto-fit'.
2777
2778         Previously, they were considered to be equal if the repeated values
2779         were the same, without comparing the repeat type. Therefore, the grid
2780         was not updated when setting both values one after the other.
2781
2782         * css/CSSGridAutoRepeatValue.cpp:
2783         (WebCore::CSSGridAutoRepeatValue::equals const):
2784         * css/CSSGridAutoRepeatValue.h:
2785
2786 2019-05-14  Antti Koivisto  <antti@apple.com>
2787
2788         Event region computation should respect transforms
2789         https://bugs.webkit.org/show_bug.cgi?id=197836
2790         <rdar://problem/50762971>
2791
2792         Reviewed by Darin Adler.
2793
2794         * platform/graphics/transforms/AffineTransform.cpp:
2795         (WebCore::AffineTransform::mapRegion const):
2796
2797         Add support for transforming regions. Non-rectlinear results use enclosing rects.
2798
2799         * platform/graphics/transforms/AffineTransform.h:
2800         * rendering/EventRegion.cpp:
2801         (WebCore::EventRegionContext::EventRegionContext):
2802         (WebCore::EventRegionContext::pushTransform):
2803         (WebCore::EventRegionContext::popTransform):
2804         (WebCore::EventRegionContext::unite):
2805         (WebCore::EventRegionContext::contains const):
2806
2807         Add a context object that holds the current transform.
2808
2809         * rendering/EventRegion.h:
2810         (WebCore::EventRegion::makeContext):
2811         * rendering/InlineTextBox.cpp:
2812         (WebCore::InlineTextBox::paint):
2813         * rendering/PaintInfo.h:
2814
2815         Replace the region object with the context.
2816
2817         * rendering/RenderBlock.cpp:
2818         (WebCore::RenderBlock::paintObject):
2819         * rendering/RenderLayer.cpp:
2820         (WebCore::RenderLayer::paintLayerByApplyingTransform):
2821
2822         Apply transforms to regions if needed.
2823
2824         (WebCore::RenderLayer::collectEventRegionForFragments):
2825         * rendering/RenderLayer.h:
2826         * rendering/RenderLayerBacking.cpp:
2827         (WebCore::RenderLayerBacking::updateEventRegion):
2828         * rendering/SimpleLineLayoutFunctions.cpp:
2829         (WebCore::SimpleLineLayout::paintFlow):
2830
2831 2019-05-14  Youenn Fablet  <youenn@apple.com>
2832
2833         Video frame resizing should be using Trim
2834         https://bugs.webkit.org/show_bug.cgi?id=197722
2835         <rdar://problem/50602188>
2836
2837         Reviewed by Eric Carlson.
2838
2839         Move from letter box to trim mode for resizing.
2840         This ensures no black stripes are present when rendering the stream.
2841
2842         Test: fast/mediastream/resize-trim.html
2843
2844         * platform/cocoa/VideoToolboxSoftLink.cpp:
2845         * platform/cocoa/VideoToolboxSoftLink.h:
2846         * platform/graphics/cv/ImageTransferSessionVT.mm:
2847         (WebCore::ImageTransferSessionVT::ImageTransferSessionVT):
2848
2849 2019-05-14  Yusuke Suzuki  <ysuzuki@apple.com>
2850
2851         [JSC] Shrink sizeof(UnlinkedFunctionExecutable) more
2852         https://bugs.webkit.org/show_bug.cgi?id=197833
2853
2854         Reviewed by Darin Adler.
2855
2856         * testing/Internals.cpp:
2857         (WebCore::Internals::parserMetaData):
2858
2859 2019-05-14  Antoine Quint  <graouts@apple.com>
2860
2861         [Pointer Events] The pointerenter and pointerleave events target the wrong element on iOS
2862         https://bugs.webkit.org/show_bug.cgi?id=197881
2863         <rdar://problem/50187657>
2864
2865         Reviewed by Dean Jackson.
2866
2867         Test: pointerevents/ios/enter-leave-target.html
2868
2869         The "pointerenter" and "pointerleave" should target the element on which the event listener was added and not
2870         the element that would otherwise hit test. This matches the behavior of "mouseenter" and "mouseleave" on macOS.
2871
2872         * page/PointerCaptureController.cpp:
2873         (WebCore::PointerCaptureController::dispatchEventForTouchAtIndex):
2874
2875 2019-05-14  Said Abou-Hallawa  <sabouhallawa@apple.com>
2876
2877         [CG] Adding support for HEIF-sequence ('public.heics') images
2878         https://bugs.webkit.org/show_bug.cgi?id=197384
2879
2880         Reviewed by Simon Fraser.
2881
2882         -- Get the image repetitionCount and the frame duration.
2883         -- Add a new function setAdditionalSupportedImageTypesForTesting() which
2884            takes a delimited String.
2885         -- Add internal APIs to retrive the image frame count and the frame
2886            duration.
2887
2888         Tests: fast/images/animated-heics-draw.html
2889                fast/images/animated-heics-verify.html
2890
2891         * platform/graphics/ImageSource.h:
2892         * platform/graphics/cg/ImageDecoderCG.cpp:
2893         (WebCore::animationPropertiesFromProperties):
2894         (WebCore::animationHEICSPropertiesFromProperties):
2895         (WebCore::ImageDecoderCG::repetitionCount const):
2896         (WebCore::ImageDecoderCG::frameDurationAtIndex const):
2897         * platform/graphics/cg/UTIRegistry.cpp:
2898         (WebCore::setAdditionalSupportedImageTypesForTesting):
2899         * platform/graphics/cg/UTIRegistry.h:
2900         * testing/Internals.cpp:
2901         (WebCore::Internals::imageFrameCount):
2902         (WebCore::Internals::imageFrameDurationAtIndex):
2903         * testing/Internals.h:
2904         * testing/Internals.idl:
2905         * testing/js/WebCoreTestSupport.cpp:
2906         (WebCoreTestSupport::setAdditionalSupportedImageTypesForTesting):
2907         * testing/js/WebCoreTestSupport.h:
2908
2909 2019-05-14  Manuel Rego Casasnovas  <rego@igalia.com>
2910
2911         [css-grid] Use max size to compute auto repeat tracks
2912         https://bugs.webkit.org/show_bug.cgi?id=197854
2913
2914         Reviewed by Javier Fernandez.
2915
2916         When available size is indefinite we should use max size to compute the number of auto repeat tracks.
2917
2918         The spec text is very clear (https://drafts.csswg.org/css-grid/#auto-repeat):
2919         > When auto-fill is given as the repetition number, if the grid container
2920         > has a definite size or **max size** in the relevant axis...
2921
2922         So far we were not doing that for widths, in this patch we modify RenderGrid::computeAutoRepeatTracksCount()
2923         to do the same than for heights.
2924
2925         We also take advantage to fix problems related to min|max sizes and box-sizing property,
2926         that were inconsistent for columns and rows.
2927
2928         Tests: imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-max-size-001.html
2929                imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-max-size-002.html
2930                imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-min-max-size-001.html
2931                imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-min-size-001.html
2932                imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-min-size-002.html
2933
2934         * rendering/RenderGrid.cpp:
2935         (WebCore::RenderGrid::computeAutoRepeatTracksCount const):
2936
2937 2019-05-14  Joonghun Park  <pjh0718@gmail.com>
2938
2939         Implement page-break-* and -webkit-column-break-* as legacy-shorthands.
2940         https://bugs.webkit.org/show_bug.cgi?id=197656
2941
2942         Reviewed by Darin Adler.
2943
2944         According to https://drafts.csswg.org/css-cascade-4/#legacy-shorthand,
2945         implement page-break-* and -webkit-column-break-* as legacy-shorthands for break-*.
2946
2947         This change also serialize page-break-* properties
2948         to CSSStyleDeclaration,
2949         per https://drafts.csswg.org/css-break/#page-break-properties.
2950
2951         * css/CSSProperties.json:
2952         * css/StyleBuilderConverter.h:
2953         (WebCore::StyleBuilderConverter::convertFontSynthesis):
2954         (WebCore::StyleBuilderConverter::convertPageBreakBetween): Deleted.
2955         (WebCore::StyleBuilderConverter::convertPageBreakInside): Deleted.
2956         (WebCore::StyleBuilderConverter::convertColumnBreakBetween): Deleted.
2957         (WebCore::StyleBuilderConverter::convertColumnBreakInside): Deleted.
2958         * css/StyleProperties.cpp:
2959         (WebCore::StyleProperties::getPropertyValue const):
2960         (WebCore::StyleProperties::pageBreakPropertyValue const):
2961         * css/StyleProperties.h:
2962         * css/parser/CSSPropertyParser.cpp:
2963         (WebCore::CSSPropertyParser::parseValueStart):
2964         (WebCore::mapFromPageBreakBetween):
2965         (WebCore::CSSPropertyParser::parseShorthand):
2966         (WebCore::isLegacyBreakProperty): Deleted.
2967
2968 2019-05-14  Javier Fernandez  <jfernandez@igalia.com>
2969
2970         Implement "line-break: anywhere"
2971         https://bugs.webkit.org/show_bug.cgi?id=181169
2972         <rdar://problem/48507088>
2973
2974         Reviewed by Myles C. Maxfield.
2975
2976         The CSS WG resolved [1] to add a new value 'anywhere' to the 'line-break'
2977         CSS property in order to allow additional breaking opportunities not
2978         considered in the definition of the 'word-break: break-all'.
2979
2980         [1] https://github.com/w3c/csswg-drafts/issues/1171
2981
2982         Tests: imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-003.html
2983                imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-004.html
2984                imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-005.html
2985                imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-006.html
2986                imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-007.html
2987                imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-008.html
2988                imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-009.html
2989                imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-010.html
2990                imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-011.html
2991                imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-012.html
2992                imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-016.html
2993                imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-017.html
2994                imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-018.html
2995                imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-019.html
2996                imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-021.html
2997                imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-022.html
2998                imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-023.html
2999                imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-024.html
3000
3001         * css/CSSPrimitiveValueMappings.h:
3002         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3003         (WebCore::CSSPrimitiveValue::operator LineBreak const):
3004         * css/CSSProperties.json:
3005         * css/CSSValueKeywords.in:
3006         * css/parser/CSSParserFastPaths.cpp:
3007         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
3008         * rendering/BreakLines.h:
3009         (WebCore::nextBreakablePositionBreakCharacter):
3010         (WebCore::isBreakable):
3011         * rendering/RenderText.cpp:
3012         (WebCore::mapLineBreakToIteratorMode):
3013         (WebCore::RenderText::computePreferredLogicalWidths):
3014         * rendering/line/BreakingContext.h:
3015         (WebCore::BreakingContext::handleText):
3016         * rendering/style/RenderStyleConstants.h:
3017
3018 2019-05-13  Yusuke Suzuki  <ysuzuki@apple.com>
3019
3020         Unreviewed, build fix after 245258, missing ThreadSpecific.h include
3021         https://bugs.webkit.org/show_bug.cgi?id=197146
3022
3023         * platform/ios/wak/WebCoreThread.mm:
3024
3025 2019-05-13  Yusuke Suzuki  <ysuzuki@apple.com>
3026
3027         [WTF] Simplify GCThread and CompilationThread flags by adding them to WTF::Thread
3028         https://bugs.webkit.org/show_bug.cgi?id=197146
3029
3030         Reviewed by Saam Barati.
3031
3032         * Modules/indexeddb/IDBDatabase.cpp:
3033         (WebCore::IDBDatabase::hasPendingActivity const):
3034         * Modules/indexeddb/IDBRequest.cpp:
3035         (WebCore::IDBRequest::hasPendingActivity const):
3036         * Modules/indexeddb/IDBTransaction.cpp:
3037         (WebCore::IDBTransaction::hasPendingActivity const):
3038
3039 2019-05-13  Geoffrey Garen  <ggaren@apple.com>
3040
3041         Downgrade RELEASE_ASSERT TO RELEASE_LOG_FAULT for SQLite Class A files
3042         https://bugs.webkit.org/show_bug.cgi?id=197760
3043
3044         Reviewed by Jer Noble.
3045
3046         Only makeSafeToUseMemoryMapForPath() if needed. (Fixed missing brace.)
3047
3048         * platform/sql/SQLiteDatabase.cpp:
3049         (WebCore::SQLiteDatabase::open):
3050
3051 2019-05-13  Tadeu Zagallo  <tzagallo@apple.com>
3052
3053         JSObject::getOwnPropertyDescriptor is missing an exception check
3054         https://bugs.webkit.org/show_bug.cgi?id=197693
3055
3056         Reviewed by Saam Barati.
3057
3058         JSObject::getOwnPropertyDescriptor assumes that getOwnPropertySlot returns false
3059         if an exception is thrown, but that was not true for JSLocation::getOwnPropertySlotCommon.
3060
3061         This is already covered by http/tests/security/cross-frame-access-getOwnPropertyDescriptor.html
3062
3063         * bindings/js/JSLocationCustom.cpp:
3064         (WebCore::getOwnPropertySlotCommon):
3065         (WebCore::JSLocation::getOwnPropertySlot):
3066         (WebCore::JSLocation::getOwnPropertySlotByIndex):
3067
3068 2019-05-13  Antti Koivisto  <antti@apple.com>
3069
3070         REGRESSION (r245208): compositing/shared-backing/sharing-bounds-non-clipping-shared-layer.html asserts
3071         https://bugs.webkit.org/show_bug.cgi?id=197818
3072         <rdar://problem/50705762>
3073
3074         Reviewed by Simon Fraser.
3075
3076         Tests: fast/scrolling/ios/event-region-scale-transform-shared.html
3077                fast/scrolling/ios/event-region-translate-transform-shared.html
3078
3079         This fixes the assert. However the added tests demonstrate that transform is not taken into account
3080         when computing the event region, https://bugs.webkit.org/show_bug.cgi?id=197836.
3081
3082         * rendering/RenderLayerBacking.cpp:
3083         (WebCore::RenderLayerBacking::updateEventRegion):
3084
3085 2019-05-13  Wenson Hsieh  <wenson_hsieh@apple.com>
3086
3087         [macOS] Font formatting options don't work when composing a message in Yahoo mail
3088         https://bugs.webkit.org/show_bug.cgi?id=197813
3089         <rdar://problem/49382250>
3090
3091         Reviewed by Darin Adler.
3092
3093         The bug happens because on mousedown, the "Aa Font" menu item's event handler hides itself before changing the
3094         font at the text selection. This causes us to clear the selection in FocusController::setFocusedElement.
3095
3096         There is existing logic in clearSelectionIfNeeded that would normally prevent us from clearing the selection due
3097         to the mousePressNode not being able to start a selection. However, since the clickable element in this case is
3098         hidden during mousedown, it is missing a renderer, and we bail from the `mousePressNode->renderer() &&
3099         !mousePressNode->canStartSelection()` check as a result.
3100
3101         This check was orginally added in https://trac.webkit.org/r24334 to avoid clearing the selection when clicking
3102         a button; the intention appears to have been making it so that clicking on something that could not start a
3103         selection (back then, synonymous with -webkit-user-select: ignore;) would not clear the current selection; to
3104         this end, it seems odd to additionally require that the thing being clicked should still have a renderer, so
3105         it seems safe to remove this requirement.
3106
3107         Test: editing/selection/preserve-selection-when-clicking-button.html
3108
3109         * page/FocusController.cpp:
3110         (WebCore::clearSelectionIfNeeded):
3111
3112 2019-05-13  Eric Carlson  <eric.carlson@apple.com>
3113
3114         https://bugs.webkit.org/show_bug.cgi?id=197793
3115         <rdar://problem/46429187>
3116
3117         Unreviewed, build fix after r245199.
3118
3119         * platform/audio/ios/MediaSessionManagerIOS.mm:
3120         (WebCore::MediaSessionManageriOS::externalOutputDeviceAvailableDidChange):
3121
3122 2019-05-13  Darin Adler  <darin@apple.com>
3123
3124         WHLSLPrepare.cpp always recompiles, even if nothing was changed
3125         https://bugs.webkit.org/show_bug.cgi?id=197151
3126
3127         Reviewed by Dan Bernstein and Keith Rollin.
3128
3129         * DerivedSources-input.xcfilelist: Script updated this automatically after
3130         DerivedSources.make was corrected.
3131         * DerivedSources-output.xcfilelist: Ditto, although I had to manually remove
3132         one bogus leftover reference to WHLSLStandardLibrary.cpp.
3133
3134         * DerivedSources.make: Updated the rule that builds WHSLStandardLibrary.h to
3135         no longer refer to nonexistent WHLSLStandardLibrary.cpp. Because the dependency
3136         was on a file that was never created, the rule to regenerate WHSLStandardLibrary.h
3137         was running on every build, instead of only when one of the dependencies changed.
3138
3139 2019-05-12  Simon Fraser  <simon.fraser@apple.com>
3140
3141         When the set of backing-sharing layers changes, we need to issue a repaint
3142         https://bugs.webkit.org/show_bug.cgi?id=197825
3143
3144         Reviewed by Zalan Bujtas.
3145
3146         If the set of layers painting into a shared backing store changes, we need
3147         to repaint that backing store. This happens when scrolling as shared layers
3148         enter the visible area.
3149
3150         Test: compositing/shared-backing/overflow-scroll/repaint-shared-on-scroll.html
3151
3152         * rendering/RenderLayerBacking.cpp:
3153         (WebCore::RenderLayerBacking::setBackingSharingLayers):
3154
3155 2019-05-02  Simon Fraser  <simon.fraser@apple.com>
3156
3157         Add logging for RenderLayer clip rects
3158         https://bugs.webkit.org/show_bug.cgi?id=197547
3159
3160         Reviewed by Zalan Bujtas.
3161
3162         Add a ClipRects log channel, and stream output for ClipRect and ClipRects.
3163
3164         The ClipRect code is performance sensitive, even in debug, so guard the log sites
3165         with clipRectsLogEnabled() because the macro still evaluates its arguments even if
3166         the channel is disabled (we need some better way to log that doesn't do this).
3167
3168         * platform/Logging.h:
3169         * rendering/ClipRect.cpp:
3170         (WebCore::operator<<):
3171         * rendering/ClipRect.h:
3172         * rendering/RenderLayer.cpp:
3173         (WebCore::operator<<):
3174         (WebCore::RenderLayer::calculateClipRects const):
3175         * rendering/RenderLayer.h:
3176
3177 2019-05-12  Simon Fraser  <simon.fraser@apple.com>
3178
3179         Refactor composited backing-sharing code
3180         https://bugs.webkit.org/show_bug.cgi?id=197824
3181
3182         Reviewed by Zalan Bujtas.
3183
3184         Clean up the backing-sharing code to share more code, and make it easier to understand.
3185         
3186         Moves more logic into member functions on BackingSharingState, which are named to make
3187         their functions clearer: startBackingSharingSequence/endBackingSharingSequence.
3188         
3189         computeCompositingRequirements() and traverseUnchangedSubtree() now just call
3190         updateBeforeDescendantTraversal/updateAfterDescendantTraversal.
3191
3192         No behavior change.
3193
3194         * rendering/RenderLayerBacking.cpp:
3195         (WebCore::RenderLayerBacking::willBeDestroyed):
3196         (WebCore::RenderLayerBacking::setBackingSharingLayers): Remove the early return, since
3197         we need to call setBackingProviderLayer() on the sharing layers in both code paths.
3198         (WebCore::RenderLayerBacking::removeBackingSharingLayer):
3199         (WebCore::RenderLayerBacking::clearBackingSharingLayers):
3200         * rendering/RenderLayerCompositor.cpp:
3201         (WebCore::RenderLayerCompositor::BackingSharingState::backingProviderCandidate const):
3202         (WebCore::RenderLayerCompositor::BackingSharingState::appendSharingLayer):
3203         (WebCore::RenderLayerCompositor::BackingSharingState::startBackingSharingSequence):
3204         (WebCore::RenderLayerCompositor::BackingSharingState::endBackingSharingSequence):
3205         (WebCore::RenderLayerCompositor::BackingSharingState::updateBeforeDescendantTraversal):
3206         (WebCore::RenderLayerCompositor::BackingSharingState::updateAfterDescendantTraversal):
3207         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
3208         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
3209         (WebCore::RenderLayerCompositor::BackingSharingState::resetBackingProviderCandidate): Deleted.
3210         * rendering/RenderLayerCompositor.h:
3211
3212 2019-05-12  Youenn Fablet  <youenn@apple.com>
3213
3214         Use clampTo in AVVideoCaptureSource::setSizeAndFrameRateWithPreset
3215         https://bugs.webkit.org/show_bug.cgi?id=197704
3216
3217         Reviewed by Alex Christensen.
3218
3219         Use clampTo as suggested in bug 196214 review.
3220         No change of behavior.
3221
3222         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3223         (WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset):
3224
3225 2019-05-12  Youenn Fablet  <youenn@apple.com>
3226
3227         Use the main screen for screen capture
3228         https://bugs.webkit.org/show_bug.cgi?id=197804
3229         <rdar://problem/47671383>
3230
3231         Reviewed by Eric Carlson.
3232
3233         If the main screen, i.e. the screen that has focus at the time of
3234         selection of the screen to capture, is capturable, add it to the list
3235         of screen devices, but do not add any other screen.
3236         This will make sure the main screen is selected.
3237         Manually tested.
3238
3239         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
3240         (WebCore::ScreenDisplayCaptureSourceMac::screenCaptureDevices):
3241
3242 2019-05-12  Takashi Komori  <Takashi.Komori@sony.com>
3243
3244         [Curl] Suppress extra didReceiveAuthenticationChallenge call when accessing a server which checks basic auth.
3245         https://bugs.webkit.org/show_bug.cgi?id=197650
3246
3247         Reviewed by Fujii Hironori.
3248
3249         When Curl port accesses a page which checks Basic Authentication credential and server trust challenge occurs,
3250         Curl port calls extra didReceiveAuthenticationChallenge unnecessarily.
3251         This is because Curl port discards information about allowed server trust challenge before in NetworkDataTaskCurl::restartWithCredential.
3252
3253         Test: http/tests/ssl/curl/certificate-and-authentication.html
3254
3255         * platform/network/curl/CurlRequest.h:
3256         (WebCore::CurlRequest::isServerTrustEvaluationDisabled):
3257
3258 2019-05-11  Simon Fraser  <simon.fraser@apple.com>
3259
3260         Overflow scroll that becomes non-scrollable should stop being composited
3261         https://bugs.webkit.org/show_bug.cgi?id=197817
3262         <rdar://problem/50697290>
3263
3264         Reviewed by Antti Koivisto.
3265
3266         Remove the iOS-specific #ifdef around code that triggers a compositing re-evaluation
3267         when scrolling state changes.
3268
3269         Test: compositing/scrolling/async-overflow-scrolling/become-non-scrollable.html
3270
3271         * rendering/RenderLayer.cpp:
3272         (WebCore::RenderLayer::updateScrollInfoAfterLayout):
3273
3274 2019-05-11  Simon Fraser  <simon.fraser@apple.com>
3275
3276         Layer bounds are incorrect for sharing layers that paint with transforms
3277         https://bugs.webkit.org/show_bug.cgi?id=197768
3278         <rdar://problem/50695493>
3279
3280         Reviewed by Zalan Bujtas.
3281
3282         We don't need to traverse shared layers if the backing-provider has overflow clip,
3283         because we know they are containing-block descendants and therefore clipped.
3284
3285         Note tha the CSS "clip" property doesn't guarantee this, because the clip rect
3286         can be larger than the element, so in that case we just traverse shared layers.
3287
3288         Tests: compositing/shared-backing/sharing-bounds-clip.html
3289                compositing/shared-backing/sharing-bounds-non-clipping-shared-layer.html
3290                compositing/shared-backing/sharing-bounds-transformed-sharing-layer.html
3291                compositing/shared-backing/sharing-bounds.html
3292
3293         * rendering/RenderLayerBacking.cpp:
3294         (WebCore::RenderLayerBacking::updateCompositedBounds):
3295
3296 2019-05-11  Simon Fraser  <simon.fraser@apple.com>
3297
3298         Translucent gradient rendering bug due to will-change transform
3299         https://bugs.webkit.org/show_bug.cgi?id=197654
3300         <rdar://problem/50547664>
3301
3302         Reviewed by Dean Jackson.
3303         
3304         We failed to re-evaluate 'contentsOpaque' when a background changed, because this
3305         happened in updateGeometry() and that doesn't run for background changes.
3306         
3307         However, 'contentsOpaque' also requires knowing about geometry because we have to
3308         turn it off when there's subpixel positioning, and updateConfiguration()
3309         runs before updateGeometry().
3310         
3311         So compute m_hasSubpixelRounding in updateGeometry() and set contentsOpaque in
3312         updateAfterDescendants().
3313
3314         Test: compositing/contents-opaque/background-change-to-transparent.html
3315
3316         * rendering/RenderLayerBacking.cpp:
3317         (WebCore::RenderLayerBacking::updateConfiguration):
3318         (WebCore::RenderLayerBacking::updateGeometry):
3319         (WebCore::RenderLayerBacking::updateAfterDescendants):
3320         * rendering/RenderLayerBacking.h:
3321
3322 2019-05-11  Simon Fraser  <simon.fraser@apple.com>
3323
3324         When the scroller hosting a shared layer becomes non-scrollable, content disappears
3325         https://bugs.webkit.org/show_bug.cgi?id=197766
3326         <rdar://problem/50695808>
3327
3328         Reviewed by Zalan Bujtas.
3329
3330         RenderLayerCompositor::requiresOwnBackingStore() should return true for a layer that shares
3331         its backing store. We always made backing for overlap layers, so even  if the sharing layers
3332         have no painted content, this should rarely be a backing store memory regression.
3333
3334         Test: compositing/shared-backing/overflow-scroll/sharing-layer-becomes-non-scrollable.html
3335
3336         * rendering/RenderLayerCompositor.cpp:
3337         (WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
3338
3339 2019-05-11  Simon Fraser  <simon.fraser@apple.com>
3340
3341         Backing-sharing layers with transforms render incorrectly
3342         https://bugs.webkit.org/show_bug.cgi?id=197692
3343         <rdar://problem/50652127>
3344
3345         Reviewed by Antti Koivisto.
3346
3347         Layers that paint into shared backing need to enter the RenderLayer painting code
3348         in a way that paints the filters, transforms, opacity and blending.
3349         
3350         RenderLayerBacking::paintIntoLayer() normally enters at paintLayerContents(), because
3351         the effects are rendered via the GraphicsLayer, but shared layers will paint effects.
3352         Note that if the backing-provider has effects, it will be the stacking context
3353         for the shared layers, so it's correct that sharing layers are impacted by effects
3354         on the backing-provider.
3355
3356         In addition, we have to ensure that we don't over-eagerly make layers shared.
3357         Consider:
3358         
3359         <div class="clipping">
3360             <div class="sharing">
3361                 <div class="inner">
3362                 </div>
3363             </div>
3364         </div>
3365         
3366         Here "clipping" is the provider layer, "sharing" paints into shared backing, but
3367         we don't want to also mark "inner" as sharing, since "sharing" will just paint it.
3368         This is akin to avoiding unnecessary compositing of z-order descendants when they can just
3369         paint.
3370         
3371         To do this we need to ensure that sharing layers are treated like compositing layers
3372         in the overlap map, i.e. when a layer is sharing, we call overlapMap.pushCompositingContainer(),
3373         and later overlapMap.popCompositingContainer().
3374
3375         Tests: compositing/shared-backing/nested-shared-layers-with-opacity.html
3376                compositing/shared-backing/shared-layer-has-blending.html
3377                compositing/shared-backing/shared-layer-has-filter.html
3378                compositing/shared-backing/shared-layer-has-opacity.html
3379                compositing/shared-backing/shared-layer-has-reflection.html
3380                compositing/shared-backing/shared-layer-has-transform.html
3381                compositing/shared-backing/shared-layer-isolates-blending.html
3382                compositing/shared-backing/shared-transformed-layer-bounds.html
3383                compositing/shared-backing/sharing-layer-becomes-non-scrollable.html
3384                compositing/shared-backing/sharing-layer-has-effect.html
3385
3386         * rendering/RenderLayer.cpp:
3387         (WebCore::RenderLayer::paintLayer):
3388         (WebCore::RenderLayer::paintLayerWithEffects):
3389         * rendering/RenderLayer.h:
3390         * rendering/RenderLayerBacking.cpp:
3391         (WebCore::RenderLayerBacking::paintIntoLayer):
3392         * rendering/RenderLayerCompositor.cpp:
3393         (WebCore::RenderLayerCompositor::CompositingState::stateForPaintOrderChildren const):
3394         (WebCore::backingProviderLayerCanIncludeLayer):
3395         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
3396         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
3397
3398 2019-05-10  Youenn Fablet  <youenn@apple.com>
3399
3400         A service worker instance should be terminated when its SWServer is destroyed
3401         https://bugs.webkit.org/show_bug.cgi?id=197801
3402         <rdar://problem/50587270>
3403
3404         Reviewed by Chris Dumez.
3405
3406         On session destruction, the SWServer is destroyed.
3407         At that time, it should terminate all its running service workers.
3408         Covered by updated API test.
3409
3410         * workers/service/server/SWServer.cpp:
3411         (WebCore::SWServer::~SWServer):