Roll out r242014; it caused crashes in compositing logging (webkit.org/b/195141)
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-02-27  Simon Fraser  <simon.fraser@apple.com>
2
3         Roll out r242014; it caused crashes in compositing logging (webkit.org/b/195141)
4
5         * dom/Document.cpp:
6         (WebCore::Document::lastModified const):
7         * html/FTPDirectoryDocument.cpp:
8         (WebCore::processFileDateString):
9         * mathml/MathMLElement.cpp:
10         (WebCore::convertToPercentageIfNeeded):
11         (WebCore::MathMLElement::collectStyleForPresentationAttribute):
12         * page/cocoa/ResourceUsageOverlayCocoa.mm:
13         (WebCore::ResourceUsageOverlay::platformDraw):
14         * page/linux/ResourceUsageOverlayLinux.cpp:
15         (WebCore::cpuUsageString):
16         (WebCore::gcTimerString):
17         * platform/DateComponents.cpp:
18         (WebCore::DateComponents::toStringForTime const):
19         (WebCore::DateComponents::toString const):
20         * platform/LocalizedStrings.cpp:
21         (WebCore::localizedString):
22         * platform/audio/HRTFElevation.cpp:
23         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
24         * platform/mock/MockRealtimeVideoSource.cpp:
25         (WebCore::MockRealtimeVideoSource::drawText):
26         * rendering/RenderLayerCompositor.cpp:
27         (WebCore::RenderLayerCompositor::logLayerInfo):
28         * rendering/RenderTheme.cpp:
29         (WebCore::RenderTheme::formatMediaControlsTime const):
30
31 2019-02-27  Zalan Bujtas  <zalan@apple.com>
32
33         [ContentChangeObserver] Move _WKObservingContentChanges from global to ContentChangeObserver class
34         https://bugs.webkit.org/show_bug.cgi?id=195091
35         <rdar://problem/48427271>
36
37         Reviewed by Tim Horton.
38
39         * page/ios/ContentChangeObserver.h:
40         * page/ios/ContentChangeObserver.mm:
41         (WebCore::ContentChangeObserver::startObservingContentChanges):
42         (WebCore::ContentChangeObserver::stopObservingContentChanges):
43         (WebCore::ContentChangeObserver::isObservingContentChanges):
44         * platform/ios/wak/WKContentObservation.cpp:
45         (WKObservingContentChanges): Deleted.
46         (WKStartObservingContentChanges): Deleted.
47         (WKStopObservingContentChanges): Deleted.
48         * platform/ios/wak/WKContentObservation.h:
49         * platform/ios/wak/WKContentObservationInternal.h:
50
51 2019-02-27  Brady Eidson  <beidson@apple.com>
52
53         Universal links from Google search results pages don't open the app.
54         <rdar://problem/46887179> and https://bugs.webkit.org/show_bug.cgi?id=195126
55
56         Reviewed by Geoffrey Garen.
57
58         Covered by new API tests.
59
60         * loader/DocumentLoader.cpp:
61         (WebCore::DocumentLoader::shouldOpenExternalURLsPolicyToPropagate const): Propagate the external URL policy from
62           an iframe if it is from the same security origin as the main frame.
63
64 2019-02-27  Zalan Bujtas  <zalan@apple.com>
65
66         [ContentChangeObserver] Move DOMTimer schedule handling from global to ContentChangeObserver class
67         https://bugs.webkit.org/show_bug.cgi?id=195090
68         <rdar://problem/48426771>
69
70         Reviewed by Tim Horton.
71
72         Also remove some unused functions from WKContentObservationInternal.
73
74         * page/ios/ContentChangeObserver.h:
75         * page/ios/ContentChangeObserver.mm:
76         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling):
77         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling):
78         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling):
79         * platform/ios/wak/WKContentObservation.cpp:
80         (WKStartObservingDOMTimerScheduling): Deleted.
81         (WKStopObservingDOMTimerScheduling): Deleted.
82         (WKIsObservingDOMTimerScheduling): Deleted.
83         * platform/ios/wak/WKContentObservation.h:
84         * platform/ios/wak/WKContentObservationInternal.h:
85
86 2019-02-27  Zalan Bujtas  <zalan@apple.com>
87
88         [ContentChangeObserver] Move style recalc handling from global to ContentChangeObserver class
89         https://bugs.webkit.org/show_bug.cgi?id=195087
90
91         Reviewed by Simon Fraser.
92
93         Add m_observingNextStyleRecalc/m_observingStyleRecalcScheduling to ContentChangeObserver and move the related code over from WK functions.
94
95         * page/ios/ContentChangeObserver.h:
96         * page/ios/ContentChangeObserver.mm:
97         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling):
98         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling):
99         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling):
100         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
101         (WebCore::ContentChangeObserver::shouldObserveNextStyleRecalc):
102         (WebCore::ContentChangeObserver::setObservedContentChange):
103         * platform/ios/wak/WKContentObservation.cpp:
104         (WKSetObservedContentChange):
105         (WKStartObservingStyleRecalcScheduling): Deleted.
106         (WKStopObservingStyleRecalcScheduling): Deleted.
107         (WKIsObservingStyleRecalcScheduling): Deleted.
108         (WKSetShouldObserveNextStyleRecalc): Deleted.
109         (WKShouldObserveNextStyleRecalc): Deleted.
110         * platform/ios/wak/WKContentObservation.h:
111
112 2019-02-27  Zalan Bujtas  <zalan@apple.com>
113
114         [ContentChangeObserver] Move DOM timer handling from global to ContentChangeObserver class
115         https://bugs.webkit.org/show_bug.cgi?id=195070
116         <rdar://problem/48417650>
117
118         Reviewed by Tim Horton.
119
120         Add DOM timer list to ContentChangeObserver and move the related code over from WK functions.
121
122         * page/ios/ContentChangeObserver.h:
123         * page/ios/ContentChangeObserver.mm:
124         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling):
125         (WebCore::ContentChangeObserver::countOfObservedDOMTimers):
126         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
127         (WebCore::ContentChangeObserver::setObservedContentChange):
128         (WebCore::ContentChangeObserver::containsObservedDOMTimer):
129         (WebCore::ContentChangeObserver::addObservedDOMTimer):
130         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
131         * platform/ios/wak/WKContentObservation.cpp:
132         (WKStartObservingDOMTimerScheduling):
133         (WKSetObservedContentChange):
134         (WebThreadGetObservedDOMTimers): Deleted.
135         (WebThreadCountOfObservedDOMTimers): Deleted.
136         (WebThreadClearObservedDOMTimers): Deleted.
137         (WebThreadContainsObservedDOMTimer): Deleted.
138         (WebThreadAddObservedDOMTimer): Deleted.
139         (WebThreadRemoveObservedDOMTimer): Deleted.
140         * platform/ios/wak/WKContentObservation.h:
141
142 2019-02-27  Justin Fan  <justin_fan@apple.com>
143         Fix build errors after Web GPU buffer updates changed some IDL fields from unsigned long to unsigned long long.
144
145         Unreviewed build fix.
146
147         * Modules/webgpu/WebGPUBuffer.cpp:
148         (WebCore::WebGPUBuffer::setSubData):
149         * Modules/webgpu/WebGPUBuffer.h:
150         * Modules/webgpu/WebGPUBufferBinding.h:
151         * Modules/webgpu/WebGPURenderPassEncoder.idl:
152         * platform/graphics/gpu/GPUBufferBinding.h:
153         * platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
154         * platform/graphics/gpu/GPUVertexInputDescriptor.h:
155
156 2019-02-27  John Wilander  <wilander@apple.com>
157
158         Adopt WebCore::RegistrableDomain in WebCore::ResourceLoadStatistics and WebKit::NetworkProcessProxy
159         https://bugs.webkit.org/show_bug.cgi?id=195071
160         <rdar://problem/48417690>
161
162         Reviewed by Alex Christensen and Brent Fulgham.
163
164         No new tests. This patch maintains functionality covered by plenty of layout
165         tests under http/tests/resourceLoadStatistics/ and http/tests/storageAccess.
166
167         This patch adopts WebCore::RegistrableDomain in WebCore::ResourceLoadStatistics
168         and makes the necessary infrastructure changes to support that.
169
170         The previous HashCountedSets in WebCore::ResourceLoadStatistics are now just
171         HashSets since we never used the counts for anything. This change simplified
172         encoding and decoding for IPC and will eventually simplify encoding and
173         decoding in loader/ResourceLoadStatistics.cpp when we obsolete statistics
174         model version 14 and below.
175
176         The patch also makes WebCore::RegistrableDomain's String constructor private.
177         A new create function WebCore::RegistrableDomain::uncheckedCreateFromString()
178         is introduced to better signal to users that creating a registrable domain
179         object with a string may create an object that doesn't match a registrable
180         domain in a valid HTTP-family URL. This change (private String constructor)
181         motivated a change in WebCore::AdClickAttribution where the Source and
182         Destination structs now take a URL as parameter instead of a String.
183
184         Finally, this patch harmonizes parameter and variable naming, going from
185         "origin" to "domain" and "mainFrame" to "topFrame."
186
187         * html/HTMLAnchorElement.cpp:
188         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
189         * html/HTMLMediaElement.cpp:
190         (WebCore::HTMLMediaElement::mediaSessionTitle const):
191         * loader/AdClickAttribution.h:
192         (WebCore::AdClickAttribution::Source::Source):
193         (WebCore::AdClickAttribution::Source::deletedValue):
194         (WebCore::AdClickAttribution::Destination::Destination):
195         (WebCore::AdClickAttribution::Destination::deletedValue):
196         (WebCore::AdClickAttribution::decode):
197         * loader/ResourceLoadObserver.cpp:
198         (WebCore::ResourceLoadObserver::logSubresourceLoading):
199         (WebCore::ResourceLoadObserver::logWebSocketLoading):
200         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
201         (WebCore::ResourceLoadObserver::statisticsForURL):
202         (WebCore::ResourceLoadObserver::statisticsForOrigin): Deleted.
203         * loader/ResourceLoadObserver.h:
204         * loader/ResourceLoadStatistics.cpp:
205         (WebCore::encodeHashSet):
206         (WebCore::ResourceLoadStatistics::encode const):
207         (WebCore::decodeHashCountedSet):
208         (WebCore::decodeHashSet):
209         (WebCore::ResourceLoadStatistics::decode):
210         (WebCore::appendHashSet):
211         (WebCore::ResourceLoadStatistics::toString const):
212         (WebCore::ResourceLoadStatistics::merge):
213         (WebCore::encodeHashCountedSet): Deleted.
214         (WebCore::encodeOriginHashSet): Deleted.
215         (WebCore::decodeOriginHashSet): Deleted.
216         (WebCore::appendHashCountedSet): Deleted.
217         * loader/ResourceLoadStatistics.h:
218         * platform/RegistrableDomain.h:
219         (WebCore::RegistrableDomain::uncheckedCreateFromString):
220         (WebCore::RegistrableDomain::RegistrableDomain):
221         * testing/Internals.cpp:
222         (WebCore::Internals::resourceLoadStatisticsForURL):
223         (WebCore::Internals::resourceLoadStatisticsForOrigin): Deleted.
224         * testing/Internals.h:
225         * testing/Internals.idl:
226
227 2019-02-27  Justin Fan  <justin_fan@apple.com>
228
229         [Web GPU] Buffer updates part 2: setSubData, GPU/CPU synchronization
230         https://bugs.webkit.org/show_bug.cgi?id=195077
231         <rdar://problem/47805229>
232
233         Reviewed by Dean Jackson.
234
235         Implement GPUBuffer.setSubData and prevent the resolving of mapping promises if the buffer is scheduled to be 
236         used on the GPU, and add handlers to resolve such promises after command buffer execution completes. In addition,
237         update buffer sizes to u64 (unsigned long in C++) as per the updated Web GPU API.
238
239         Tests: webgpu/buffer-command-buffer-races.html
240                webgpu/map-read-buffers.html
241
242         * Modules/webgpu/WebGPUBindGroup.h:
243         (WebCore::WebGPUBindGroup::bindGroup const):
244         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
245         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Rename binding -> bufferBinding to reduce confusion.
246         * Modules/webgpu/WebGPUBuffer.cpp: Small tweaks.
247         (WebCore::WebGPUBuffer::setSubData):
248         (WebCore::WebGPUBuffer::unmap): Correctly fail if buffer is destroyed.
249         (WebCore::WebGPUBuffer::destroy):
250         (WebCore::WebGPUBuffer::rejectOrRegisterPromiseCallback):
251         * Modules/webgpu/WebGPUBuffer.h:
252         (WebCore::WebGPUBuffer::buffer const): Returned buffer is no longer const so that it can be used in completed handler callbacks.
253         * Modules/webgpu/WebGPUBuffer.idl: Enable setSubData.
254         * Modules/webgpu/WebGPUCommandBuffer.cpp:
255         (WebCore::WebGPUCommandBuffer::beginRenderPass):
256         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
257         (WebCore::WebGPUProgrammablePassEncoder::setBindGroup const):
258         * Modules/webgpu/WebGPUProgrammablePassEncoder.h:
259         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
260         (WebCore::WebGPURenderPassEncoder::setVertexBuffers):
261         * Sources.txt:
262         * WebCore.xcodeproj/project.pbxproj:
263         * platform/graphics/gpu/GPUBuffer.h:
264         (WebCore::GPUBuffer::isTransferDst const): Added various state and flag getters.
265         (WebCore::GPUBuffer::isVertex const):
266         (WebCore::GPUBuffer::isUniform const):
267         (WebCore::GPUBuffer::isStorage const):
268         (WebCore::GPUBuffer::isReadOnly const):
269         (WebCore::GPUBuffer::isMappable const):
270         (WebCore::GPUBuffer::isMapWrite const):
271         (WebCore::GPUBuffer::isMapRead const):
272         (WebCore::GPUBuffer::isMapWriteable const):
273         (WebCore::GPUBuffer::isMapReadable const):
274         * platform/graphics/gpu/GPUBufferBinding.h:
275         * platform/graphics/gpu/GPUCommandBuffer.h:
276         (WebCore::GPUCommandBuffer::usedBuffers const):
277         (WebCore::GPUCommandBuffer::useBuffer):
278         * platform/graphics/gpu/GPUDevice.cpp:
279         (WebCore::GPUDevice::tryCreateBuffer): Pass Ref of itself for Buffer to request the Queue later, if needed.
280         (WebCore::GPUDevice::tryCreateBuffer const): Deleted.
281         * platform/graphics/gpu/GPUDevice.h:
282         * platform/graphics/gpu/GPUProgrammablePassEncoder.cpp: Retain the encoder's commandBuffer to reference its used resource buffers.
283         (WebCore::GPUProgrammablePassEncoder::GPUProgrammablePassEncoder):
284         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
285         (WebCore::GPUProgrammablePassEncoder::commandBuffer const):
286         * platform/graphics/gpu/GPURenderPassEncoder.h:
287         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
288         (WebCore::GPUBuffer::validateBufferCreate): Move validation out of tryCreate.
289         (WebCore::GPUBuffer::tryCreate): Create both shared and private buffers, depending on usage.
290         (WebCore::GPUBuffer::GPUBuffer):
291         (WebCore::GPUBuffer::~GPUBuffer): Call destroy instead of just unmap.
292         (WebCore::GPUBuffer::state const):
293         (WebCore::GPUBuffer::setSubData): Uses a cached collection of staging MTLBuffers to encode data copies to the implementation MTLBuffer.
294         (WebCore::GPUBuffer::commandBufferCommitted): Register on the GPUBuffer that the provided MTLCommandBuffer uses it, and is about to be committed.
295         (WebCore::GPUBuffer::commandBufferCompleted): MTLCommandBuffer's onCompletedHandler calls this.
296         (WebCore::GPUBuffer::reuseSubDataBuffer): SetSubData's blit command buffers call this to return a staging buffer to the pool.
297         (WebCore::GPUBuffer::registerMappingCallback):
298         (WebCore::GPUBuffer::runMappingCallback):
299         (WebCore::GPUBuffer::unmap):
300         (WebCore::GPUBuffer::destroy):
301         (WebCore::GPUBuffer::tryCreateSharedBuffer): Deleted.
302         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
303         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder):
304         (WebCore::GPUProgrammablePassEncoder::setBindGroup):
305         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
306         (WebCore::GPUQueue::submit): Ensure submitted buffers are in the correct state, and add completed handlers for synchronization.
307         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
308         (WebCore::GPURenderPassEncoder::tryCreate):
309         (WebCore::GPURenderPassEncoder::GPURenderPassEncoder): Retain the commandBuffer for later reference.
310         (WebCore::GPURenderPassEncoder::setVertexBuffers): Mark vertex buffers as used before submission.
311         (WebCore::GPURenderPassEncoder::create): Deleted.
312
313         Buffer size updates in the IDL:
314         * Modules/webgpu/GPUBufferDescriptor.idl:
315         * Modules/webgpu/WebGPUBuffer.idl:
316         * Modules/webgpu/WebGPUBufferBinding.idl:
317         * Modules/webgpu/WebGPUCommandBuffer.idl:
318         * Modules/webgpu/WebGPURenderPassEncoder.idl:
319         * Modules/webgpu/WebGPUVertexAttributeDescriptor.idl:
320         * Modules/webgpu/WebGPUVertexInputDescriptor.idl:
321
322 2019-02-27  Youenn Fablet  <youenn@apple.com>
323
324         Remove LeetCode FetchRequest quirk
325         https://bugs.webkit.org/show_bug.cgi?id=195100
326
327         Reviewed by Alex Christensen.
328
329         Covered by manual testing.
330
331         * Modules/fetch/FetchRequest.cpp:
332         (WebCore::needsSignalQuirk):
333
334 2019-02-27  Chris Dumez  <cdumez@apple.com>
335
336         Unable to log into chase.com on iPad when DeviceMotionEvent API is disabled
337         https://bugs.webkit.org/show_bug.cgi?id=195101
338         <rdar://problem/48423023>
339
340         Reviewed by Geoffrey Garen.
341
342         Add site-specific quirk for chase.com on iOS where we fire a dummy DeviceMotionEvent if the page
343         tries to register a "devicemotion" event listener and fails because the API is disabled. This is
344         needed to unblock the site and proceed with the login flow.
345
346         Unfortunately, document()->settings().needsSiteSpecificQuirks() is false on iOS so I could not
347         guard the quirk behind this flag.
348
349         * page/DOMWindow.cpp:
350         (WebCore::DOMWindow::addEventListener):
351         (WebCore::DOMWindow::failedToRegisterDeviceMotionEventListener):
352         * page/DOMWindow.h:
353
354 2019-02-27  Antoine Quint  <graouts@apple.com>
355
356         Support Pointer Events on macOS
357         https://bugs.webkit.org/show_bug.cgi?id=195008
358         <rdar://problem/47454419>
359
360         Reviewed by Dean Jackson.
361
362         We now dispatch relevant pointer events as we prepare to dispatch mouse events. In most cases, this means we dispatch
363         a pointer event of the same type, with "mouse" being substituted by "pointer", and with the same properties with the
364         exception that if preventDefault() is called for a "pointerdown" event, the matching "mousedown" will not be dispatched,
365         and the same behavior also extends to "pointerup".
366
367         Tests: pointerevents/mouse/over-enter-out-leave.html
368                pointerevents/mouse/pointer-capture.html
369                pointerevents/mouse/pointer-event-basic-properties.html
370                pointerevents/mouse/pointer-events-before-mouse-events.html
371                pointerevents/mouse/pointerdown-prevent-default.html
372
373         * Configurations/FeatureDefines.xcconfig:
374         * dom/Document.cpp: All of the touch-action related members and functions should be iOS-specific since the touch-action
375         property does not have any effect on macOS.
376         (WebCore::Document::invalidateRenderingDependentRegions):
377         (WebCore::Document::nodeWillBeRemoved):
378         (WebCore::Document::updateTouchActionElements):
379         * dom/Document.h:
380         * dom/Element.cpp:
381         (WebCore::Element::dispatchMouseEvent): Dispatch a pointer event matching the mouse event that is about to be dispatched.
382         If preventDefault() is called in the event handler for either "pointerdown" or "pointerup", do not proceed with dispatching
383         the mouse event.
384         * dom/PointerEvent.cpp:
385         (WebCore::pointerEventType):
386         (WebCore::PointerEvent::create):
387         * dom/PointerEvent.h:
388         * page/EventHandler.cpp: Check both the pointer and mouse events to see if we need to dispatch "enter" and "leave" events.
389         (WebCore::hierarchyHasCapturingEventListeners):
390         (WebCore::EventHandler::updateMouseEventTargetNode):
391         * page/PointerCaptureController.cpp: Fix a build error which only happened on macOS.
392         (WebCore::PointerCaptureController::PointerCaptureController): Create the CapturingData for the unique mouse pointer.
393         (WebCore::PointerCaptureController::hasPointerCapture): The code did not match the spec cited in the comment, only the
394         pending target override needs to be considered to determine whether a given element has pointer capture enabled.
395         (WebCore::PointerCaptureController::dispatchEvent): Dispatch the provided pointer event, accounting for pointer capture if
396         it is set.
397         * page/PointerLockController.cpp: Fix a build error which only happened on macOS.
398         * style/StyleTreeResolver.cpp:
399         (WebCore::Style::TreeResolver::resolveElement): Code related to touch-action is only relevant to iOS.
400
401 2019-02-27  Sihui Liu  <sihui_liu@apple.com>
402
403         Network Process is put to suspended when holding locked IndexedDB files
404         https://bugs.webkit.org/show_bug.cgi?id=195024
405         <rdar://problem/45194169>
406
407         Reviewed by Geoffrey Garen.
408
409         We found network process was suspended when IDBDatabase was being closed in the background database thread, 
410         holding locks to its database file. To avoid starvation or deadlock, we need to keep network process alive by 
411         taking background assertion in UI process until the closes are done and locks are released.
412
413         * Modules/indexeddb/server/IDBServer.cpp:
414         (WebCore::IDBServer::IDBServer::create):
415         (WebCore::IDBServer::IDBServer::IDBServer):
416         (WebCore::IDBServer::IDBServer::createBackingStore):
417         (WebCore::IDBServer::IDBServer::closeDatabase):
418         (WebCore::IDBServer::IDBServer::didCloseDatabase):
419         * Modules/indexeddb/server/IDBServer.h:
420         (WebCore::IDBServer::IDBServer::create):
421         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
422         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentDeleteOperation):
423         (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose):
424         (WebCore::IDBServer::UniqueIDBDatabase::didShutdownForClose):
425         (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
426         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
427         (WebCore::IDBServer::UniqueIDBDatabase::notifyServerAboutClose):
428         * Modules/indexeddb/server/UniqueIDBDatabase.h:
429
430 2019-02-26  Simon Fraser  <simon.fraser@apple.com>
431
432         Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
433         https://bugs.webkit.org/show_bug.cgi?id=194973
434
435         Reviewed by Antti Koivisto.
436
437         This patch cleans up how the scrolling tree responds to scrolls.
438
439         First, ScrollingTreeScrollingNode::m_currentScrollPosition is "truth" for scrolling thread/
440         UI process scroll position.
441
442         On macOS where handleWheelEvent on the scrolling thread changes scroll position, the
443         bottleneck is ScrollingTreeScrollingNode::scrollTo() which sets the new scroll position,
444         update the visual viewport (for frame scrolls) updates the scrolledContentsLayer position,
445         updates related layers on this node (counter-scrolling layers etc), and then tells the
446         scrolling tree, which recurses through descendant nodes so they can adjust their layer
447         positions.
448
449         On iOS, the bottleneck is ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling(),
450         which does the above other than setting scrolledContentsLayer (since we're reacting to
451         layer state changes, not producing them).
452
453         updateLayersAfterAncestorChange() is renamed to relatedNodeScrollPositionDidChange(), and
454         ScrollingTree does the tree walk so classes don't have to implement
455         updateLayersAfterAncestorChange() just to talk children. The ScrollingTree tree walk knows
456         how to get the correct layoutViewport and to stop at frame boundaries (layer updates never
457         need to cross frame boundaries).
458
459         We preserve 'cumulativeDelta'; it's necessary for things like fixed inside overflow:scroll,
460         since the fixed state was computed with the "layout" scroll position, so we have to account
461         for the scroll delta since the last committed position. It's possible we could improve this
462         in future.
463
464         * page/scrolling/ScrollingTree.cpp:
465         (WebCore::ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling):
466         (WebCore::ScrollingTree::notifyRelatedNodesAfterScrollPositionChange):
467         (WebCore::ScrollingTree::notifyRelatedNodesRecursive):
468         (WebCore::ScrollingTree::mainFrameLayoutViewport):
469         (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling): Deleted.
470         * page/scrolling/ScrollingTree.h:
471         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
472         (WebCore::ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange): Deleted.
473         * page/scrolling/ScrollingTreeFrameHostingNode.h:
474         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
475         (WebCore::ScrollingTreeFrameScrollingNode::updateViewportForCurrentScrollPosition):
476         (WebCore::ScrollingTreeFrameScrollingNode::localToContentsPoint const):
477         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
478         * page/scrolling/ScrollingTreeNode.cpp:
479         (WebCore::ScrollingTreeNode::relatedNodeScrollPositionDidChange):
480         (WebCore::ScrollingTreeNode::enclosingScrollingNodeIncludingSelf):
481         * page/scrolling/ScrollingTreeNode.h:
482         * page/scrolling/ScrollingTreeScrollingNode.cpp:
483         (WebCore::ScrollingTreeScrollingNode::minimumScrollPosition const):
484         (WebCore::ScrollingTreeScrollingNode::scrollLimitReached const):
485         (WebCore::ScrollingTreeScrollingNode::adjustedScrollPosition const):
486         (WebCore::ScrollingTreeScrollingNode::scrollBy):
487         (WebCore::ScrollingTreeScrollingNode::scrollTo):
488         (WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged):
489         (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
490         (WebCore::ScrollingTreeScrollingNode::localToContentsPoint const):
491         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterAncestorChange): Deleted.
492         (WebCore::ScrollingTreeScrollingNode::setScrollPosition): Deleted.
493         * page/scrolling/ScrollingTreeScrollingNode.h:
494         * page/scrolling/ScrollingTreeScrollingNodeDelegate.h:
495         (WebCore::ScrollingTreeScrollingNodeDelegate::currentScrollPosition const):
496         (WebCore::ScrollingTreeScrollingNodeDelegate::scrollPosition const): Deleted.
497         * page/scrolling/ThreadedScrollingTree.cpp:
498         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
499         * page/scrolling/ThreadedScrollingTree.h:
500         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
501         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
502         (WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
503         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange): Deleted.
504         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
505         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
506         (WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
507         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange): Deleted.
508         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
509         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
510         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
511         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
512         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
513         (WebCore::ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition const):
514         (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged):
515         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
516         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers):
517         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState):
518         (WebCore::ScrollingTreeFrameScrollingNodeMac::exposedUnfilledArea const):
519         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): Deleted.
520         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition): Deleted.
521         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition): Deleted.
522         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateLayersAfterViewportChange): Deleted.
523         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
524         (): Deleted.
525         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
526         (WebCore::ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition const):
527         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
528         (WebCore::ScrollingTreeOverflowScrollingNodeMac::~ScrollingTreeOverflowScrollingNodeMac): Deleted.
529         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange): Deleted.
530         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): Deleted.
531         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition): Deleted.
532         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): Deleted.
533         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterDelegatedScroll): Deleted.
534         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
535         (WebCore::ScrollingTreeScrollingNodeDelegateMac::isAlreadyPinnedInDirectionOfGesture):
536         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount):
537         (WebCore::ScrollingTreeScrollingNodeDelegateMac::pinnedInDirection):
538         (WebCore::ScrollingTreeScrollingNodeDelegateMac::adjustScrollPositionToBoundsIfNecessary):
539         (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollOffset const):
540         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollOnAxis):
541
542 2019-02-22  Simon Fraser  <simon.fraser@apple.com>
543
544         Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
545         https://bugs.webkit.org/show_bug.cgi?id=194973
546
547         Reviewed by Antti Koivisto.
548
549         The "master" value for the scroll position of a ScrollingTreeScrollingNode is now its m_scrollPosition member;
550         layout viewports and layer positions will be set from this. This allows scrollPosition() to no longer be virtual
551         and require different code for each scrolling node subclass, and adds a choke point that we can use to update
552         the layout viewport.
553         
554         We can remove m_probableMainThreadScrollPosition on ScrollingTreeFrameScrollingNodeMac because this was really just
555         an alias for the scroll position.
556
557         Add some isRootNode() checks for things that should only affect the main frame.
558
559         * page/scrolling/ScrollingTree.h: Remove fixedPositionRect() which was unused, and is a per-frame thing so makes
560         no sense here.
561         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
562         (WebCore::ScrollingTreeFrameScrollingNode::didChangeScrollPosition):
563         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
564         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewport const):
565         (WebCore::ScrollingTreeFrameScrollingNode::setLayoutViewport):
566         (WebCore::ScrollingTreeFrameScrollingNode::fixedPositionRect): Deleted.
567         * page/scrolling/ScrollingTreeScrollingNode.cpp:
568         (WebCore::ScrollingTreeScrollingNode::setScrollPosition):
569         (WebCore::ScrollingTreeScrollingNode::setScrollPositionInternal):
570         (WebCore::ScrollingTreeScrollingNode::didChangeScrollPosition):
571         * page/scrolling/ScrollingTreeScrollingNode.h:
572         (WebCore::ScrollingTreeScrollingNode::scrollPosition const):
573         * page/scrolling/ios/ScrollingTreeIOS.cpp:
574         (WebCore::ScrollingTreeIOS::fixedPositionRect): Deleted.
575         * page/scrolling/ios/ScrollingTreeIOS.h:
576         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
577         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
578         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
579         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
580         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
581         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
582         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState):
583         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): Deleted.
584         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
585         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
586         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): Deleted.
587
588 2019-02-27  Ulrich Pflueger  <up@nanocosmos.de>
589
590         [MSE] SourceBuffer sample time increment vs. last frame duration check is broken
591         https://bugs.webkit.org/show_bug.cgi?id=194747
592         <rdar://problem/48148469>
593
594         Reviewed by Jer Noble.
595
596         Prevent unintended frame drops by including last frame duration in discontinuity check. 
597
598         Test: media/media-source/media-source-append-variable-frame-lengths-with-matching-durations.html
599
600         * Modules/mediasource/SourceBuffer.cpp:
601         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
602
603 2019-02-27  Timothy Hatcher  <timothy@apple.com>
604
605         REGRESSION: WebKit content crash in Base System (because NSAppearance is NULL).
606         https://bugs.webkit.org/show_bug.cgi?id=195086
607         rdar://problem/48419124
608
609         Reviewed by Tim Horton.
610
611         * platform/mac/ScrollAnimatorMac.mm:
612         (-[WebScrollerImpDelegate effectiveAppearanceForScrollerImp:]): Always return a valid NSAppearance.
613
614 2019-02-26  Wenson Hsieh  <wenson_hsieh@apple.com>
615
616         Remove conditional compile guard for InsertIntoTextNodeCommand::doReapply
617         https://bugs.webkit.org/show_bug.cgi?id=195067
618         <rdar://problem/44812080>
619
620         Reviewed by Tim Horton.
621
622         This iOS-specific override was introduced to fix <rdar://problem/7114425>, in which the last typed character
623         would be revealed when redoing text input on iOS inside a password field. The associated change fixed this bug
624         by overriding doReapply on iOS to only insert text (instead of additionally handling password echo); however, it
625         really makes sense to skip password echo when redoing on all platforms, so we can just remove the platform-
626         specific guards around this logic.
627
628         Doing this allows us to add the `hasEditableStyle()` check on iOS when redoing text insertion, which results in
629         a very subtle behavior change covered by the new layout test below.
630
631         Test: editing/undo/redo-text-insertion-in-non-editable-node.html
632
633         * editing/InsertIntoTextNodeCommand.cpp:
634         (WebCore::InsertIntoTextNodeCommand::doReapply):
635         * editing/InsertIntoTextNodeCommand.h:
636
637 2019-02-26  Keith Miller  <keith_miller@apple.com>
638
639         Code quality cleanup in NeverDestroyed
640         https://bugs.webkit.org/show_bug.cgi?id=194824
641
642         Reviewed by Mark Lam.
643
644         name_names.pl should not just assume the layout of LazyNeverDestroyed.
645
646         * dom/make_names.pl:
647         (printNamesCppFile):
648
649 2019-02-26  Zalan Bujtas  <zalan@apple.com>
650
651         Do not try to observe the timer when Page is nullptr
652         https://bugs.webkit.org/show_bug.cgi?id=195076
653
654         Reviewed by Tim Horton.
655
656         Covered by fast/dom/Window/timer-null-script-execution-context.html.
657
658         * page/DOMTimer.cpp:
659         (WebCore::DOMTimer::install):
660
661 2019-02-20  Jer Noble  <jer.noble@apple.com>
662
663         [Cocoa] Media elements will restart network buffering just before suspending
664         https://bugs.webkit.org/show_bug.cgi?id=193691
665
666         Reviewed by Eric Carlson.
667
668         API Test: WebKit.ProcessSuspendMediaBuffering
669
670         Allow the Page to suspend all media buffering in its child Documents.
671
672         * dom/Document.cpp:
673         (WebCore::Document::suspendAllMediaBuffering):
674         (WebCore::Document::resumeAllMediaBuffering):
675         * dom/Document.h:
676         * html/MediaElementSession.cpp:
677         (WebCore::MediaElementSession::dataBufferingPermitted const):
678         (WebCore::MediaElementSession::suspendBuffering):
679         (WebCore::MediaElementSession::resumeBuffering):
680         (WebCore::MediaElementSession::bufferingSuspended const):
681         * html/MediaElementSession.h:
682         * page/Page.cpp:
683         (WebCore::Page::suspendAllMediaBuffering):
684         (WebCore::Page::resumeAllMediaBuffering):
685         * page/Page.h:
686         (WebCore::Page::mediaPlaybackIsSuspended const):
687         (WebCore::Page::mediaBufferingIsSuspended const):
688         (WebCore::Page::mediaPlaybackIsSuspended): Deleted.
689         * platform/audio/PlatformMediaSession.h:
690         (WebCore::PlatformMediaSession::suspendBuffering):
691         (WebCore::PlatformMediaSession::resumeBuffering):
692         * platform/audio/PlatformMediaSessionManager.cpp:
693         (WebCore::PlatformMediaSessionManager::suspendAllMediaBufferingForDocument):
694         (WebCore::PlatformMediaSessionManager::resumeAllMediaBufferingForDocument):
695         * platform/audio/PlatformMediaSessionManager.h:
696
697 2019-02-26  Youenn Fablet  <youenn@apple.com>
698
699         Move service worker response validation from the service worker client to the service worker itself
700         https://bugs.webkit.org/show_bug.cgi?id=194716
701
702         Reviewed by Geoffrey Garen.
703
704         Added response validation at service worker side.
705
706         No change of behavior except for now logging validation error messages in the console.
707         Covered by rebased tests.
708
709         * workers/service/context/ServiceWorkerFetch.cpp:
710         (WebCore::ServiceWorkerFetch::validateResponse):
711         (WebCore::ServiceWorkerFetch::processResponse):
712         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
713
714 2019-02-26  Sihui Liu  <sihui_liu@apple.com>
715
716         [Mac WK2] storage/indexeddb/IDBObject-leak.html is flaky
717         https://bugs.webkit.org/show_bug.cgi?id=195036
718
719         Reviewed by Geoffrey Garen.
720
721         When connection to IDBServer is lost, IDBDatabase in web process should not only stop active transactions, but 
722         also transactions in committing process.
723
724         Also, TransactionOpration should clear its perform function when the operation is being completed, otherwise 
725         there is a reference cycle of TransactionOpration.
726
727         Covered by existing tests storage/indexeddb/IDBObject-leak.html.
728
729         * Modules/indexeddb/IDBDatabase.cpp:
730         (WebCore::IDBDatabase::connectionToServerLost): notify committing transasctions that connection is lost.
731         * Modules/indexeddb/IDBTransaction.cpp:
732         (WebCore::IDBTransaction::connectionClosedFromServer): notify IDBConnectionProxy that transaction ends.
733         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
734         (WebCore::IDBClient::IDBConnectionProxy::forgetTransaction): clear finished transactions.
735         * Modules/indexeddb/client/IDBConnectionProxy.h:
736         * Modules/indexeddb/client/TransactionOperation.h:
737         (WebCore::IDBClient::TransactionOperation::doComplete): clear perform function unconditionally when the 
738         operation is in completion process. 
739
740 2019-02-26  Zalan Bujtas  <zalan@apple.com>
741
742         [ContentChangeObserver] clearContentChangeObservers should be internal to ContentChangeObserver class
743         https://bugs.webkit.org/show_bug.cgi?id=195066
744         <rdar://problem/48411682>
745
746         Reviewed by Tim Horton.
747
748         Now all the empty clearContentChangeObservers() implementations can be removed.
749
750         * dom/Document.cpp:
751         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
752         * loader/EmptyClients.h:
753         * page/ChromeClient.h:
754         * page/Frame.cpp:
755         (WebCore::Frame::willDetachPage):
756         * page/ios/ContentChangeObserver.h:
757         * page/ios/ContentChangeObserver.mm:
758         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
759         (WebCore::ContentChangeObserver::didSuspendActiveDOMObjects): Might need to merge them.
760         (WebCore::ContentChangeObserver::willDetachPage):
761
762 2019-02-26  Zalan Bujtas  <zalan@apple.com>
763
764         [ContentChangeObserver] Move style recalc schedule observation logic to ContentChangeObserver
765         https://bugs.webkit.org/show_bug.cgi?id=195062
766         <rdar://problem/48409258>
767
768         Reviewed by Tim Horton.
769
770         Also rename registerDOMTimerForContentObservationIfNeeded to be consistent with the did* naming style.
771
772         * dom/Document.cpp:
773         (WebCore::Document::scheduleStyleRecalc):
774         * page/DOMTimer.cpp:
775         (WebCore::DOMTimer::install):
776         * page/ios/ContentChangeObserver.h:
777         * page/ios/ContentChangeObserver.mm:
778         (WebCore::ContentChangeObserver::didInstallDOMTimer):
779         (WebCore::ContentChangeObserver::didScheduleStyleRecalc):
780         (WebCore::ContentChangeObserver::registerDOMTimerForContentObservationIfNeeded): Deleted.
781
782 2019-02-26  Chris Dumez  <cdumez@apple.com>
783
784         [iOS] Regression(PSON) Scroll position is no longer restored when navigating back to reddit.com
785         https://bugs.webkit.org/show_bug.cgi?id=195054
786         <rdar://problem/48330549>
787
788         Reviewed by Geoff Garen.
789
790         Add MaintainMemoryCache flag to indicate that the memory cache should not get purged.
791
792         * page/MemoryRelease.cpp:
793         (WebCore::releaseNoncriticalMemory):
794         (WebCore::releaseCriticalMemory):
795         (WebCore::releaseMemory):
796         * page/MemoryRelease.h:
797
798 2019-02-26  Commit Queue  <commit-queue@webkit.org>
799
800         Unreviewed, rolling out r241970.
801         https://bugs.webkit.org/show_bug.cgi?id=195057
802
803         made the QuickLook.LegacyQuickLookContent API test flakey
804         (Requested by estes on #webkit).
805
806         Reverted changeset:
807
808         "[iOS] Break a reference cycle between PreviewLoader and
809         ResourceLoader"
810         https://bugs.webkit.org/show_bug.cgi?id=194964
811         https://trac.webkit.org/changeset/241970
812
813 2019-02-26  Zalan Bujtas  <zalan@apple.com>
814
815         [ContentChangeObserver] Simplify content observation API by removing explicit DOMTimer observation.
816         https://bugs.webkit.org/show_bug.cgi?id=195023
817         <rdar://problem/48381885>
818
819         Reviewed by Tim Horton.
820
821         In the future we might decide that certain activities don't require DOMTimer observation, but that should
822         be internal to ContentChangeObserver.
823
824         * page/ios/ContentChangeObserver.h:
825         * page/ios/ContentChangeObserver.mm:
826         (WebCore::ContentChangeObserver::startObservingContentChanges):
827         (WebCore::ContentChangeObserver::stopObservingContentChanges):
828         * page/ios/EventHandlerIOS.mm:
829         (WebCore::EventHandler::mouseMoved):
830
831 2019-02-26  Zalan Bujtas  <zalan@apple.com>
832
833         [ContentChangeObserver] Move observing logic from Document::updateStyleIfNeeded to ContentChangeObserver
834         https://bugs.webkit.org/show_bug.cgi?id=195032
835         <rdar://problem/48388063>
836
837         Reviewed by Tim Horton.
838
839         This might eventually turn into a regular start/stop content observing call.
840
841         * dom/Document.cpp:
842         (WebCore::Document::updateStyleIfNeeded):
843         * page/ios/ContentChangeObserver.h:
844         * page/ios/ContentChangeObserver.mm:
845         (WebCore::ContentChangeObserver::startObservingStyleResolve):
846         (WebCore::ContentChangeObserver::stopObservingStyleResolve):
847
848 2019-02-26  Zalan Bujtas  <zalan@apple.com>
849
850         [ContentChangeObserver] Move CheckForVisibilityChange to ContentChangeObserver class
851         https://bugs.webkit.org/show_bug.cgi?id=195035
852         <rdar://problem/48389123>
853
854         Reviewed by Tim Horton.
855
856         Visibility checking logic belongs to ContentChangeObserver.
857
858         * page/ios/ContentChangeObserver.h:
859         * page/ios/ContentChangeObserver.mm:
860         (WebCore::elementImplicitVisibility):
861         (WebCore::ContentChangeObserver::StyleChange::StyleChange):
862         (WebCore::ContentChangeObserver::StyleChange::~StyleChange):
863         * rendering/updating/RenderTreeUpdater.cpp:
864         (WebCore::RenderTreeUpdater::updateElementRenderer):
865         (WebCore::elementImplicitVisibility): Deleted.
866         (WebCore::CheckForVisibilityChange::CheckForVisibilityChange): Deleted.
867         (WebCore::CheckForVisibilityChange::~CheckForVisibilityChange): Deleted.
868
869 2019-02-26  Philippe Normand  <pnormand@igalia.com>
870
871         [EGL] Runtime support for RGB565 pixel layout
872         https://bugs.webkit.org/show_bug.cgi?id=194817
873
874         Reviewed by Carlos Garcia Campos.
875
876         Currently our graphics pipeline always relies on a ARGB8888 (32
877         bpp) pixel configuration. On some low-end (old) embedded platforms
878         the graphics driver is sometimes optimized for 16 bpp
879         configurations, such as RGB565. On those platforms the application
880         can now set the WEBKIT_EGL_PIXEL_LAYOUT environment variable to
881         "RGB565" to adjust to the best pixel configuration supported by
882         the screen and graphics driver.
883
884         * platform/graphics/egl/GLContextEGL.cpp:
885         (WebCore::GLContextEGL::getEGLConfig):
886
887 2019-02-26  Philippe Normand  <pnormand@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
888
889         [WPE] Add API for webview background color configuration
890         https://bugs.webkit.org/show_bug.cgi?id=192305
891
892         Reviewed by Michael Catanzaro.
893
894         Adapt the FrameView API to allow a default non-white background color.
895
896         * page/Frame.cpp:
897         (WebCore::Frame::createView): Replace isTransparent argument with a background color one.
898         * page/Frame.h:
899         * page/FrameView.cpp:
900         (WebCore::FrameView::recalculateBaseBackgroundColor): Use Color::transparent if m_isTransparent is true.
901         (WebCore::FrameView::updateBackgroundRecursively): Allow the fallback background color to be non-white, this is
902         used only in non-dark-mode-css build configurations.
903         * page/FrameView.h:
904         * testing/Internals.cpp:
905         (WebCore::Internals::setViewIsTransparent): Use Color::transparent if transparent is true.
906
907 2019-02-25  Yongjun Zhang  <yongjun_zhang@apple.com>
908
909         scalableNativeWebpageParameters() is not preserved on new page navigation.
910         https://bugs.webkit.org/show_bug.cgi?id=194892
911         <rdar://problem/47538280>
912
913         If a page's current default viewport configuration is scalableNativeWebpageParameters due to
914         the fact that m_canIgnoreScalingConstraints is true, loading a new page should preserve this
915         configuration until we derive the right values from viewport meta-tag.
916
917         Reviewed by Wenson Hsieh.
918
919         Test: fast/viewport/ios/viewport-shrink-to-fit-on-new-navigation.html
920
921         * page/ViewportConfiguration.cpp:
922         (WebCore::ViewportConfiguration::canOverrideConfigurationParameters const): Use fixedNativeWebpageParameters().
923         (WebCore::ViewportConfiguration::updateDefaultConfiguration): Use nativeWebpageParameters.
924         (WebCore::ViewportConfiguration::nativeWebpageParameters): Return the appropriate default configuration
925             based on m_canIgnoreScalingConstraints and shouldIgnoreMinimumEffectiveDeviceWidth().
926         (WebCore::ViewportConfiguration::fixedNativeWebpageParameters): Renamed from nativeWebpageParameters()
927         (WebCore::ViewportConfiguration::scalableNativeWebpageParameters): Use fixedNativeWebpageParameters.
928         * page/ViewportConfiguration.h: Make nativeWebpageParameters() an instance method and change the old
929             static method to fixedNativeWebpageParameters which better reflects the actual behavior.
930
931 2019-02-25  Zalan Bujtas  <zalan@apple.com>
932
933         [ContentChangeObserver] Move observing logic from DOMWindow::clearTimeout to ContentChangeObserver
934         https://bugs.webkit.org/show_bug.cgi?id=194988
935         <rdar://problem/48343040>
936
937         Reviewed by Tim Horton.
938
939         ContentChangeObserver::removeDOMTimer takes care of the canceled timer removal.
940
941         * page/DOMWindow.cpp:
942         (WebCore::DOMWindow::clearTimeout):
943         * page/ios/ContentChangeObserver.h:
944         * page/ios/ContentChangeObserver.mm:
945         (WebCore::ContentChangeObserver::startObservingDOMTimer):
946         (WebCore::ContentChangeObserver::stopObservingDOMTimer):
947         (WebCore::ContentChangeObserver::removeDOMTimer):
948
949 2019-02-25  Zalan Bujtas  <zalan@apple.com>
950
951         [ContentChangeObserver] Move observing logic from DOMTimer to ContentChangeObserver
952         https://bugs.webkit.org/show_bug.cgi?id=194987
953         <rdar://problem/48342910>
954
955         Reviewed by Tim Horton.
956
957         Content obvservation logic should all move to the ContentChangeObserver class.
958
959         * page/DOMTimer.cpp:
960         (WebCore::DOMTimer::install):
961         (WebCore::DOMTimer::fired):
962         * page/Page.cpp:
963         (WebCore::Page::Page):
964         * page/Page.h:
965         (WebCore::Page::contentChangeObserver):
966         * page/ios/ContentChangeObserver.h:
967         * page/ios/ContentChangeObserver.mm:
968         (WebCore::ContentChangeObserver::ContentChangeObserver):
969         (WebCore::ContentChangeObserver::registerDOMTimerForContentObservationIfNeeded):
970         (WebCore::ContentChangeObserver::startObservingDOMTimer):
971         (WebCore::ContentChangeObserver::stopObservingDOMTimer):
972         (WebCore::ContentChangeObserver::containsObservedDOMTimer):
973         (WebCore::ContentChangeObserver::addObservedDOMTimer):
974         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
975
976 2019-02-25  John Wilander  <wilander@apple.com>
977
978         Introduce and adopt new class RegistrableDomain for eTLD+1
979         https://bugs.webkit.org/show_bug.cgi?id=194791
980         <rdar://problem/48179240>
981
982         Reviewed by Alex Christensen, Fujii Hironori, and Brent Fulgham.
983
984         A new API test was added. Plenty of existing layout tests under
985         http/tests/resourceLoadStatistics/ and http/tests/storageAccess/ test the code.
986
987         This patch introduces and adopts a new class called WebCore::RegistrableDomain
988         which represents a domain's eTLD+1 (effective top level domain plus one) and is
989         the basis for the term "site," as in same-site. Other popular names include
990         high-level domain, primary domain, and top privately controlled/owned domain.
991         Effective top level domains are enumerated on the Public Suffix List
992         (https://publicsuffix.org).
993
994         This class just uses the full domain for when the Public Suffix List cannot help
995         finding the registrable domain and for WebKit ports that haven't enabled
996         PUBLIC_SUFFIX_LIST. It also uses the string "nullOrigin" as a representation
997         for the null or unique origin (this matches how these origins were handled
998         before).
999
1000         The implementation is a wrapper around a String and the functions and class
1001         members that now make use of this new class used to handle regular String
1002         objects which didn't help much in terms of type safety or guarantees that the
1003         string had already been converted to an eTLD+1.
1004
1005         We've at least two bad bugs in the Storage Access API because of confusion
1006         between a URL's eTLD+1 and its host. The usage of WebCore::RegistrableDomain
1007         will prohibit such bugs in the future.
1008
1009         Partitioning in WebKit also uses eTLD+1 to a large extent. I plan to adopt
1010         WebCore::RegistrableDomain for partitioning in a later patch.
1011
1012         This patch also enhances parameter naming by:
1013         - Removing parts that refer to "primary" as in primaryDomain.
1014         - Replacing references to "TopPrivatelyControlledDomain" with "RegistrableDomain."
1015         - Replacing references to "TopPrivatelyOwnedDomain" with "RegistrableDomain."
1016         - Using the term "domain" consistently instead of e.g. "host."
1017
1018         * WebCore.xcodeproj/project.pbxproj:
1019         * dom/Document.cpp:
1020         (WebCore::Document::hasRequestedPageSpecificStorageAccessWithUserInteraction):
1021         (WebCore::Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction):
1022         * dom/Document.h:
1023         * html/HTMLAnchorElement.cpp:
1024         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
1025         * html/HTMLMediaElement.cpp:
1026         (WebCore::HTMLMediaElement::mediaSessionTitle const):
1027         * loader/AdClickAttribution.cpp:
1028         (WebCore::AdClickAttribution::url const):
1029         (WebCore::AdClickAttribution::referrer const):
1030         (WebCore::AdClickAttribution::toString const):
1031         * loader/AdClickAttribution.h:
1032         (WebCore::AdClickAttribution::Source::Source):
1033         (WebCore::AdClickAttribution::Source::matches const):
1034         (WebCore::AdClickAttribution::Source::deleteValue):
1035         (WebCore::AdClickAttribution::Destination::Destination):
1036         (WebCore::AdClickAttribution::Destination::matches const):
1037         (WebCore::AdClickAttribution::Destination::deleteValue):
1038         * loader/ResourceLoadObserver.cpp:
1039         (WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
1040         (WebCore::ResourceLoadObserver::setLogUserInteractionNotificationCallback):
1041         (WebCore::ResourceLoadObserver::setLogWebSocketLoadingNotificationCallback):
1042         (WebCore::ResourceLoadObserver::setLogSubresourceLoadingNotificationCallback):
1043         (WebCore::ResourceLoadObserver::setLogSubresourceRedirectNotificationCallback):
1044         (WebCore::ResourceLoadObserver::logSubresourceLoading):
1045         (WebCore::ResourceLoadObserver::logWebSocketLoading):
1046         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1047         (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
1048         (WebCore::ResourceLoadObserver::logFontLoad):
1049         (WebCore::ResourceLoadObserver::logCanvasRead):
1050         (WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
1051         (WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
1052         (WebCore::ResourceLoadObserver::logScreenAPIAccessed):
1053         (WebCore::ResourceLoadObserver::ensureResourceStatisticsForRegistrableDomain):
1054         (WebCore::ResourceLoadObserver::statisticsForOrigin):
1055         (WebCore::primaryDomain): Deleted.
1056         (WebCore::ResourceLoadObserver::ensureResourceStatisticsForPrimaryDomain): Deleted.
1057         * loader/ResourceLoadObserver.h:
1058         * loader/ResourceLoadStatistics.cpp:
1059         (WebCore::ResourceLoadStatistics::encode const):
1060         (WebCore::ResourceLoadStatistics::decode):
1061         (WebCore::ResourceLoadStatistics::toString const):
1062         (WebCore::ResourceLoadStatistics::merge):
1063         (WebCore::ResourceLoadStatistics::primaryDomain): Deleted.
1064         * loader/ResourceLoadStatistics.h:
1065         (WebCore::ResourceLoadStatistics::ResourceLoadStatistics):
1066         * page/Page.cpp:
1067         (WebCore::Page::logNavigation):
1068         (WebCore::Page::mainFrameLoadStarted):
1069         * page/Page.h:
1070         * page/PerformanceMonitor.cpp:
1071         (WebCore::reportPageOverPostLoadResourceThreshold):
1072         * platform/RegistrableDomain.h: Added.
1073         (WebCore::RegistrableDomain::RegistrableDomain):
1074         (WebCore::RegistrableDomain::isEmpty const):
1075         (WebCore::RegistrableDomain::string const):
1076         (WebCore::RegistrableDomain::operator!= const):
1077         (WebCore::RegistrableDomain::operator== const):
1078         (WebCore::RegistrableDomain::matches const):
1079         (WebCore::RegistrableDomain::isolatedCopy const):
1080         (WebCore::RegistrableDomain::isHashTableDeletedValue const):
1081         (WebCore::RegistrableDomain::hash const):
1082         (WebCore::RegistrableDomain::RegistrableDomainHash::hash):
1083         (WebCore::RegistrableDomain::RegistrableDomainHash::equal):
1084         (WebCore::RegistrableDomain::encode const):
1085         (WebCore::RegistrableDomain::decode):
1086         * platform/network/NetworkStorageSession.cpp:
1087         (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const):
1088         (WebCore::NetworkStorageSession::shouldBlockCookies const):
1089         (WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor):
1090         (WebCore::NetworkStorageSession::removePrevalentDomains):
1091         (WebCore::NetworkStorageSession::hasStorageAccess const):
1092         (WebCore::NetworkStorageSession::getAllStorageAccessEntries const):
1093         (WebCore::NetworkStorageSession::grantStorageAccess):
1094         (WebCore::getPartitioningDomain): Deleted.
1095         * platform/network/NetworkStorageSession.h:
1096
1097 2019-02-25  Chris Fleizach  <cfleizach@apple.com>
1098
1099         AX: <footer> HTML5 tag not reading as ARIA Landmark to VoiceOver
1100         https://bugs.webkit.org/show_bug.cgi?id=190138
1101         <rdar://problem/44907695>
1102
1103         Reviewed by Joanmarie Diggs.
1104
1105         Make sure that footer elements use the right role depending on their context.
1106         If scoped to body, they become contentinfo. Otherwise they are just delineated by
1107         a footer subrole.
1108
1109         * accessibility/AccessibilityObject.cpp:
1110         (WebCore::AccessibilityObject::isLandmark const):
1111         * accessibility/AccessibilityRenderObject.cpp:
1112         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
1113         (WebCore::AccessibilityRenderObject::isDescendantOfElementType const):
1114         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
1115         * accessibility/AccessibilityRenderObject.h:
1116         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1117         (-[WebAccessibilityObjectWrapper _accessibilityIsLandmarkRole:]):
1118         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1119         (-[WebAccessibilityObjectWrapper subrole]):
1120
1121 2019-02-25  Sihui Liu  <sihui_liu@apple.com>
1122
1123         IndexedDB: IDBDatabase and IDBTransaction are leaked in layout tests
1124         https://bugs.webkit.org/show_bug.cgi?id=194709
1125
1126         Reviewed by Geoffrey Garen.
1127
1128         When connection to IDB server is closed, IDBTransaction would abort without notifying IDBDatabase, so 
1129         IDBDatabase didn't clear its reference to IDBTransaction which created a reference cycle. 
1130  
1131         Also IDBTransaction didn't clear its reference to IDBRequest in this case and it led to another reference cycle
1132         between IDBOpenDBRequest and IDBTransaction.
1133
1134         Test: storage/indexeddb/IDBObject-leak.html
1135
1136         * Modules/indexeddb/IDBDatabase.cpp:
1137         (WebCore::IDBDatabase::connectionToServerLost):
1138         * Modules/indexeddb/IDBTransaction.cpp:
1139         (WebCore::IDBTransaction::IDBTransaction):
1140         (WebCore::IDBTransaction::~IDBTransaction):
1141         (WebCore::IDBTransaction::connectionClosedFromServer):
1142         * Modules/indexeddb/IDBTransaction.h:
1143         * testing/Internals.cpp:
1144         (WebCore::Internals::numberOfIDBTransactions const):
1145         * testing/Internals.h:
1146         * testing/Internals.idl:
1147
1148 2019-02-25  Zalan Bujtas  <zalan@apple.com>
1149
1150         Add missing stream parameter. Unreviewed.
1151
1152         * page/DOMTimer.cpp:
1153         (WebCore::DOMTimer::fired):
1154
1155 2019-02-25  Zalan Bujtas  <zalan@apple.com>
1156
1157         Unreviewed build fix after r242032.
1158
1159         * page/DOMTimer.cpp:
1160         (WebCore::DOMTimer::install):
1161
1162 2019-02-20  Darin Adler  <darin@apple.com>
1163
1164         Incorrect use of String::foldCase for font family names
1165         https://bugs.webkit.org/show_bug.cgi?id=194895
1166
1167         Reviewed by Myles C. Maxfield.
1168
1169         * platform/graphics/FontCascadeDescription.cpp:
1170         (WebCore::FontCascadeDescription::familiesEqualForTextAutoSizing): Use
1171         familyNamesAreEqual instead of calling convertToASCIILowercase directly.
1172         (WebCore::FontCascadeDescription::familyNamesAreEqual): Use AtomicString's
1173         operator== when we want case sensitive family name comparisons. This is a special
1174         case to accomodate CoreText, which uses "."-prefix names for internal fonts that
1175         are treated case sensitively. (Ideally webpages would not use these fonts at all.)
1176         (WebCore::FontCascadeDescription::familyNameHash): Use AtomicString's existingHash
1177         when we want case sensitive family name hashing.
1178         (WebCore::FontCascadeDescription::foldedFamilyName): Take a String instead of an
1179         AtomicString so we can use this at an additional call site. Converting from an
1180         AtomicString to a String if free and automatic at the existing call sites. Use
1181         convertToASCIILowercase instead of foldCase for three reasons: 1) Other functions
1182         here are folding only ASCII case by using ASCIICaseInsensitiveHash, and this one
1183         must be consistent. 2) this is considerably faster, and 3) font family names don't
1184         need arbitrary Unicode case folding, it's only A-Z that should be folded.
1185         * platform/graphics/FontCascadeDescription.h: Take a String instead of AtomicString
1186         in the foldedFamilyName function.
1187
1188         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1189         (WebCore::FontDatabase::collectionForFamily): Instead of calling foldCase, use
1190         FontCascadeDescription::foldedFamilyName to correctly fold font family names.
1191
1192 2019-02-25  Charlie Turner  <cturner@igalia.com>
1193
1194         [EME][GStreamer] Replace caps field loop with gst_structure_remove_fields
1195         https://bugs.webkit.org/show_bug.cgi?id=194992
1196
1197         Reviewed by Xabier Rodriguez-Calvar.
1198
1199         Refactoring, no new tests.
1200
1201         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
1202         (transformCaps): Simplify the code a little. The idea to use this
1203         utility function came from a review upstream here:
1204         https://gitlab.freedesktop.org/gstreamer/gst-devtools/merge_requests/67
1205
1206 2019-02-25  Alicia Boya García  <aboya@igalia.com>
1207
1208         [MSE][GStreamer] Batch player duration updates
1209         https://bugs.webkit.org/show_bug.cgi?id=194220
1210
1211         Reviewed by Xabier Rodriguez-Calvar.
1212
1213         This saves up a ton of CPU cycles doing layout unnecessarily when all
1214         the appended frames extend the duration of the movie, like in
1215         YTTV 2018 59.DASHLatencyVP9.
1216
1217         This patch is an optimization that introduces no new behavior.
1218
1219         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1220         (WebCore::AppendPipeline::consumeAppsinkAvailableSamples):
1221         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1222         (WebCore::MediaPlayerPrivateGStreamerMSE::blockDurationChanges):
1223         (WebCore::MediaPlayerPrivateGStreamerMSE::unblockDurationChanges):
1224         (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
1225         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
1226
1227 2019-02-25  Miguel Gomez  <magomez@igalia.com>
1228
1229         [WPE] Add support for holepunch using an external video player
1230         https://bugs.webkit.org/show_bug.cgi?id=194899
1231
1232         Reviewed by Xabier Rodriguez-Calvar.
1233
1234         Implement the holepunch feature to allow playback using an external player. This creates
1235         a new dummy MediaPlayerPrivateHolePunch that accepts only the type "video/holepunch", and
1236         whose goal is to just draw a transparent rectangle in the position where the video should be.
1237         This can be used to allow a player placed on a lower plane than the browser to become visible.
1238
1239         Added ManualTest wpe/video-player-holepunch-external.html to test the feature.
1240
1241         * PlatformWPE.cmake:
1242         * platform/HolePunch.cmake: Added.
1243         * platform/graphics/MediaPlayer.cpp:
1244         (WebCore::buildMediaEnginesVector):
1245         * platform/graphics/holepunch/MediaPlayerPrivateHolePunch.cpp: Added.
1246         (WebCore::MediaPlayerPrivateHolePunch::MediaPlayerPrivateHolePunch):
1247         (WebCore::MediaPlayerPrivateHolePunch::~MediaPlayerPrivateHolePunch):
1248         (WebCore::MediaPlayerPrivateHolePunch::platformLayer const):
1249         (WebCore::MediaPlayerPrivateHolePunch::naturalSize const):
1250         (WebCore::MediaPlayerPrivateHolePunch::pushNextHolePunchBuffer):
1251         (WebCore::MediaPlayerPrivateHolePunch::swapBuffersIfNeeded):
1252         (WebCore::MediaPlayerPrivateHolePunch::proxy const):
1253         (WebCore::mimeTypeCache):
1254         (WebCore::MediaPlayerPrivateHolePunch::getSupportedTypes):
1255         (WebCore::MediaPlayerPrivateHolePunch::supportsType):
1256         (WebCore::MediaPlayerPrivateHolePunch::registerMediaEngine):
1257         (WebCore::MediaPlayerPrivateHolePunch::notifyReadyState):
1258         * platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h: Added.
1259         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
1260         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
1261
1262 2019-02-24  Zalan Bujtas  <zalan@apple.com>
1263
1264         Introduce ContentChangeObserver class
1265         https://bugs.webkit.org/show_bug.cgi?id=194977
1266         <rdar://problem/48338115>
1267
1268         Reviewed by Simon Fraser.
1269
1270         This patch is about piping through all the related WK* calls. 
1271
1272         * SourcesCocoa.txt:
1273         * WebCore.xcodeproj/project.pbxproj:
1274         * dom/Document.cpp:
1275         (WebCore::Document::scheduleStyleRecalc):
1276         (WebCore::Document::updateStyleIfNeeded):
1277         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
1278         * loader/FrameLoader.cpp:
1279         * page/DOMTimer.cpp:
1280         (WebCore::DOMTimer::install):
1281         (WebCore::DOMTimer::fired):
1282         * page/DOMWindow.cpp:
1283         (WebCore::DOMWindow::clearTimeout):
1284         * page/Frame.cpp:
1285         (WebCore::Frame::willDetachPage):
1286         * page/Page.h:
1287         (WebCore::Page::contentChangeObserver):
1288         * page/ios/EventHandlerIOS.mm:
1289         (WebCore::EventHandler::mouseMoved):
1290         * rendering/updating/RenderTreeUpdater.cpp:
1291         (WebCore::RenderTreeUpdater::updateElementRenderer):
1292         (WebCore::CheckForVisibilityChange::CheckForVisibilityChange):
1293         (WebCore::CheckForVisibilityChange::~CheckForVisibilityChange):
1294
1295 2019-02-24  Simon Fraser  <simon.fraser@apple.com>
1296
1297         Migrate from "fixedPositionRect" to "layoutViewport" in the scrolling tree
1298         https://bugs.webkit.org/show_bug.cgi?id=194984
1299
1300         Reviewed by Sam Weinig.
1301
1302         Rename "fixedPositionRect" to "layoutViewport" in scrolling tree code.
1303
1304         Remove ScrollingTree::fixedPositionRect() which was only used on iOS, to fetch the
1305         current layout viewport rect. Instead, set the layout viewport on the root
1306         node in ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling().
1307
1308         * page/scrolling/ScrollingTree.cpp:
1309         (WebCore::ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling):
1310         (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling): Deleted.
1311         * page/scrolling/ScrollingTree.h:
1312         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
1313         (WebCore::ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange):
1314         * page/scrolling/ScrollingTreeFrameHostingNode.h:
1315         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1316         * page/scrolling/ScrollingTreeNode.h:
1317         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1318         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterAncestorChange):
1319         * page/scrolling/ScrollingTreeScrollingNode.h:
1320         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
1321         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
1322         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
1323         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
1324         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
1325         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):
1326         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1327         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
1328         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1329         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange):
1330         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition):
1331
1332 2019-02-24  Devin Rousso  <drousso@apple.com>
1333
1334         Web Inspector: Change the InspectorOverlay to use native rather than canvas
1335         https://bugs.webkit.org/show_bug.cgi?id=105023
1336         <rdar://problem/13443692>
1337
1338         Reviewed by Brian Burg.
1339
1340         Should be no change in observed functionality.
1341
1342         * inspector/InspectorOverlay.h:
1343         * inspector/InspectorOverlay.cpp:
1344         (WebCore::truncateWithEllipsis): Added.
1345         (WebCore::localPointToRootPoint): Added.
1346         (WebCore::contentsQuadToCoordinateSystem):
1347         (WebCore::effectiveElementForNode): Added.
1348         (WebCore::quadToPath): Added.
1349         (WebCore::drawOutlinedQuadWithClip): Added.
1350         (WebCore::drawOutlinedQuad): Added.
1351         (WebCore::drawFragmentHighlight): Added.
1352         (WebCore::drawShapeHighlight): Added.
1353         (WebCore::InspectorOverlay::paint):
1354         (WebCore::InspectorOverlay::setIndicating):
1355         (WebCore::InspectorOverlay::shouldShowOverlay const):
1356         (WebCore::InspectorOverlay::update):
1357         (WebCore::InspectorOverlay::setShowPaintRects): Added.
1358         (WebCore::InspectorOverlay::showPaintRect):
1359         (WebCore::InspectorOverlay::updatePaintRectsTimerFired):
1360         (WebCore::InspectorOverlay::drawNodeHighlight):
1361         (WebCore::InspectorOverlay::drawQuadHighlight):
1362         (WebCore::InspectorOverlay::drawPaintRects):
1363         (WebCore::InspectorOverlay::drawBounds): Added.
1364         (WebCore::InspectorOverlay::drawRulers):
1365         (WebCore::InspectorOverlay::drawElementTitle): Added.
1366         (WebCore::contentsQuadToPage): Deleted.
1367         (WebCore::InspectorOverlay::setPausedInDebuggerMessage): Deleted.
1368         (WebCore::buildObjectForPoint): Deleted.
1369         (WebCore::buildObjectForRect): Deleted.
1370         (WebCore::buildArrayForQuad): Deleted.
1371         (WebCore::buildObjectForHighlight): Deleted.
1372         (WebCore::buildObjectForSize): Deleted.
1373         (WebCore::InspectorOverlay::setShowingPaintRects): Deleted.
1374         (WebCore::buildArrayForRendererFragments): Deleted.
1375         (WebCore::localPointToRoot): Deleted.
1376         (WebCore::appendPathCommandAndPoints): Deleted.
1377         (WebCore::appendPathSegment): Deleted.
1378         (WebCore::buildObjectForShapeOutside): Deleted.
1379         (WebCore::buildObjectForElementData): Deleted.
1380         (WebCore::InspectorOverlay::buildHighlightObjectForNode const): Deleted.
1381         (WebCore::InspectorOverlay::buildObjectForHighlightedNodes const): Deleted.
1382         (WebCore::InspectorOverlay::drawPausedInDebuggerMessage): Deleted.
1383         (WebCore::InspectorOverlay::overlayPage): Deleted.
1384         (WebCore::InspectorOverlay::forcePaint): Deleted.
1385         (WebCore::InspectorOverlay::reset): Deleted.
1386         (WebCore::evaluateCommandInOverlay): Deleted.
1387         (WebCore::InspectorOverlay::evaluateInOverlay): Deleted.
1388         (WebCore::InspectorOverlay::freePage): Deleted.
1389
1390         * inspector/agents/InspectorPageAgent.cpp:
1391         (WebCore::InspectorPageAgent::disable):
1392         (WebCore::InspectorPageAgent::setShowPaintRects):
1393         Drive-by: rename `setShowingPaintRects` to better match the protocol.
1394
1395         * inspector/agents/page/PageDebuggerAgent.h:
1396         * inspector/agents/page/PageDebuggerAgent.cpp:
1397         (WebCore::PageDebuggerAgent::PageDebuggerAgent):
1398         (WebCore::PageDebuggerAgent::setOverlayMessage): Deleted.
1399         Remove `Debugger.setOverlayMessage` command as it hasn't been used and is no longer supported.
1400
1401         * inspector/InspectorController.h:
1402         * inspector/InspectorController.cpp:
1403         (WebCore::InspectorController::createLazyAgents):
1404         (WebCore::InspectorController::disconnectFrontend):
1405         (WebCore::InspectorController::disconnectAllFrontends):
1406         (WebCore::InspectorController::buildObjectForHighlightedNodes const): Deleted.
1407
1408         * testing/Internals.h:
1409         * testing/Internals.idl:
1410         * testing/Internals.cpp:
1411         (WebCore::Internals::inspectorHighlightObject): Deleted.
1412
1413         * inspector/InspectorOverlayPage.css: Removed.
1414         * inspector/InspectorOverlayPage.html: Removed.
1415         * inspector/InspectorOverlayPage.js: Removed.
1416
1417         * CMakeLists.txt:
1418         * DerivedSources-input.xcfilelist:
1419         * DerivedSources-output.xcfilelist:
1420         * DerivedSources.make:
1421         * WebCore.xcodeproj/project.pbxproj:
1422
1423 2019-02-20  Darin Adler  <darin@apple.com>
1424
1425         Finish removing String::format
1426         https://bugs.webkit.org/show_bug.cgi?id=194893
1427
1428         Reviewed by Daniel Bates.
1429
1430         * dom/Document.cpp:
1431         (WebCore::Document::lastModified const): Use makeString and pad.
1432         * html/FTPDirectoryDocument.cpp:
1433         (WebCore::processFileDateString): Ditto.
1434
1435         * mathml/MathMLElement.cpp:
1436         (WebCore::convertToPercentageIfNeeded): Use makeString and FormattedNumber.
1437
1438         * page/cocoa/ResourceUsageOverlayCocoa.mm:
1439         (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and pad.
1440
1441         * page/linux/ResourceUsageOverlayLinux.cpp:
1442         (WebCore::cpuUsageString): Use makeString, FormattedNumber, and pad.
1443         (WebCore::gcTimerString): Use String::number.
1444
1445         * platform/DateComponents.cpp:
1446         (WebCore::DateComponents::toStringForTime const): Use makeString and pad.
1447         (WebCore::DateComponents::toString const): Ditto.
1448
1449         * platform/LocalizedStrings.cpp: Removed comment that mentioned String::format,
1450         and that was also inaccurate.
1451
1452         * platform/audio/HRTFElevation.cpp:
1453         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
1454         Use makeString and pad.
1455         * platform/mock/MockRealtimeVideoSource.cpp:
1456         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
1457         * rendering/RenderLayerCompositor.cpp:
1458         (WebCore::RenderLayerCompositor::logLayerInfo): Ditto.
1459         * rendering/RenderTheme.cpp:
1460         (WebCore::RenderTheme::formatMediaControlsTime const): Ditto.
1461
1462 2019-02-24  Michael Catanzaro  <mcatanzaro@igalia.com>
1463
1464         [WPE][GTK] Remove user agent quirk for washingtonpost.com
1465         https://bugs.webkit.org/show_bug.cgi?id=194981
1466
1467         Reviewed by Žan Doberšek.
1468
1469         Remove user agent quirk for washingtonpost.com because we support JPEG 2000 now.
1470
1471         * platform/UserAgentQuirks.cpp:
1472         (WebCore::urlRequiresChromeBrowser):
1473
1474 2019-02-23  Simon Fraser  <simon.fraser@apple.com>
1475
1476         Remove remnants of iOS WK1 scrolling tree code
1477         https://bugs.webkit.org/show_bug.cgi?id=194980
1478
1479         Reviewed by Sam Weinig.
1480
1481         Remove ScrollingTreeIOS and ScrollingCoordinatorIOS which were never instantiated,
1482         to reduce maintenance costs and simplify.
1483
1484         Merge ScrollingTreeFrameScrollingNodeIOS into ScrollingTreeFrameScrollingNodeRemoteIOS
1485         since that was the only concrete subclass, removing code which never applies to iOS WK2
1486         (e.g. the synchronous scrolling code path).
1487
1488         * SourcesCocoa.txt:
1489         * WebCore.xcodeproj/project.pbxproj:
1490         * page/FrameView.h:
1491         * page/scrolling/ScrollingCoordinator.cpp:
1492         * page/scrolling/ScrollingTree.h:
1493         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1494         * page/scrolling/ScrollingTreeNode.h:
1495         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1496         (WebCore::ScrollingTreeScrollingNode::handleWheelEvent):
1497         * page/scrolling/ScrollingTreeScrollingNode.h:
1498         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterDelegatedScroll): Deleted.
1499         (WebCore::ScrollingTreeScrollingNode::scrollableAreaSize const): Deleted.
1500         (WebCore::ScrollingTreeScrollingNode::totalContentsSize const): Deleted.
1501         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsets const): Deleted.
1502         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsets const): Deleted.
1503         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsetRanges const): Deleted.
1504         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsetRanges const): Deleted.
1505         (WebCore::ScrollingTreeScrollingNode::currentHorizontalSnapPointIndex const): Deleted.
1506         (WebCore::ScrollingTreeScrollingNode::currentVerticalSnapPointIndex const): Deleted.
1507         (WebCore::ScrollingTreeScrollingNode::setCurrentHorizontalSnapPointIndex): Deleted.
1508         (WebCore::ScrollingTreeScrollingNode::setCurrentVerticalSnapPointIndex): Deleted.
1509         (WebCore::ScrollingTreeScrollingNode::useDarkAppearanceForScrollbars const): Deleted.
1510         (WebCore::ScrollingTreeScrollingNode::lastCommittedScrollPosition const): Deleted.
1511         (WebCore::ScrollingTreeScrollingNode::reachableContentsSize const): Deleted.
1512         (WebCore::ScrollingTreeScrollingNode::parentRelativeScrollableRect const): Deleted.
1513         (WebCore::ScrollingTreeScrollingNode::scrollOrigin const): Deleted.
1514         (WebCore::ScrollingTreeScrollingNode::totalContentsSizeForRubberBand const): Deleted.
1515         (WebCore::ScrollingTreeScrollingNode::setTotalContentsSizeForRubberBand): Deleted.
1516         (WebCore::ScrollingTreeScrollingNode::horizontalScrollElasticity const): Deleted.
1517         (WebCore::ScrollingTreeScrollingNode::verticalScrollElasticity const): Deleted.
1518         (WebCore::ScrollingTreeScrollingNode::hasEnabledHorizontalScrollbar const): Deleted.
1519         (WebCore::ScrollingTreeScrollingNode::hasEnabledVerticalScrollbar const): Deleted.
1520         (WebCore::ScrollingTreeScrollingNode::canHaveScrollbars const): Deleted.
1521         (WebCore::ScrollingTreeScrollingNode::expectsWheelEventTestTrigger const): Deleted.
1522         (WebCore::ScrollingTreeScrollingNode::scrollContainerLayer const): Deleted.
1523         (WebCore::ScrollingTreeScrollingNode::scrolledContentsLayer const): Deleted.
1524         * page/scrolling/ios/ScrollingCoordinatorIOS.h: Removed.
1525         * page/scrolling/ios/ScrollingCoordinatorIOS.mm: Removed.
1526         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h: Removed.
1527         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: Removed.
1528         * page/scrolling/ios/ScrollingTreeIOS.cpp: Removed.
1529         * page/scrolling/ios/ScrollingTreeIOS.h: Removed.
1530         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1531         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
1532
1533 2019-02-23  Justin Fan  <justin_fan@apple.com>
1534
1535         [WebGPU] Buffer updates part 1: async mapping functions, unmap, and destroy
1536         https://bugs.webkit.org/show_bug.cgi?id=194665
1537
1538         Reviewed by Dean Jackson.
1539
1540         Test: map-write-buffers.html. Other tests updated to match new API.
1541
1542         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp: Added.
1543         (WebCore::validateBufferBindingType): Ensure buffer binding usages match the binding type.
1544         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Logic moved out from WebGPUDevice.cpp.
1545         * Modules/webgpu/WebGPUBindGroupDescriptor.h:
1546         * Modules/webgpu/WebGPUBuffer.cpp: Added GPUBuffer functionality.
1547         (WebCore::WebGPUBuffer::create):
1548         (WebCore::WebGPUBuffer::WebGPUBuffer):
1549         (WebCore::WebGPUBuffer::mapReadAsync):
1550         (WebCore::WebGPUBuffer::mapWriteAsync):
1551         (WebCore::WebGPUBuffer::unmap):
1552         (WebCore::WebGPUBuffer::destroy):
1553         (WebCore::WebGPUBuffer::rejectOrRegisterPromiseCallback): Register a mapping request on the GPUBuffer, if valid.
1554         * Modules/webgpu/WebGPUBuffer.h:
1555         (WebCore::WebGPUBuffer::buffer const):
1556         (WebCore::WebGPUBuffer::mapping const): Deleted.
1557         * Modules/webgpu/WebGPUBuffer.idl: Update to latest API and enable every function except setSubData.
1558         * Modules/webgpu/WebGPUCommandBuffer.cpp:
1559         (WebCore::WebGPUCommandBuffer::beginRenderPass): Renamed descriptor conversion method.
1560         * Modules/webgpu/WebGPUDevice.cpp:
1561         (WebCore::WebGPUDevice::createBuffer const): Update to non-nullable return type.
1562         (WebCore::WebGPUDevice::createBindGroup const): Move descriptor validation logic to descriptor implementation.
1563         * Modules/webgpu/WebGPUDevice.h:
1564         * Modules/webgpu/WebGPURenderPassDescriptor.cpp:
1565         (WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const): Renamed from validateAndConvertToGPUVersion.
1566         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
1567         (WebCore::WebGPURenderPassEncoder::setVertexBuffers): Add validation for submitted buffers.
1568         * platform/graphics/gpu/GPUBuffer.cpp: Added.
1569         (WebCore::GPUBuffer::PendingMappingCallback::PendingMappingCallback): New struct for retaining a reference to mapping callbacks.
1570         * platform/graphics/gpu/GPUBuffer.h: Add functionality to retain callbacks and usage bits.
1571         (WebCore::GPUBuffer::isVertex const):
1572         (WebCore::GPUBuffer::isUniform const):
1573         (WebCore::GPUBuffer::isStorage const):
1574         (WebCore::GPUBuffer::isReadOnly const):
1575         (WebCore::GPUBuffer::PendingMapPromise::create):
1576         (WebCore::GPUBuffer::isMappable const):
1577         (WebCore::GPUBuffer::isMapWriteable const):
1578         (WebCore::GPUBuffer::isMapReadable const):
1579         (WebCore::GPUBuffer::mapping const): Deleted.
1580         * platform/graphics/gpu/GPUBufferUsage.h: enum class cannot be logical ORed together.
1581         * platform/graphics/gpu/GPUDevice.cpp:
1582         (WebCore::GPUDevice::tryCreateBuffer const): Renamed from createBuffer. 
1583         (WebCore::GPUDevice::createBuffer const): Deleted.
1584         * platform/graphics/gpu/GPUDevice.h:
1585         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
1586         (WebCore::GPUBuffer::tryCreateSharedBuffer): Attempt to create a MTLBuffer with shared memory.
1587         (WebCore::GPUBuffer::tryCreate): No longer use Gigacage-allocated memory for MTLBuffer.
1588         (WebCore::GPUBuffer::GPUBuffer):
1589         (WebCore::GPUBuffer::~GPUBuffer):
1590         (WebCore::GPUBuffer::registerMappingCallback): Register the provided callback to be executed when the staging buffer can be safely exposed.
1591         (WebCore::GPUBuffer::stagingBufferForRead): Prepare the arrayBuffer for reading and run the mapping callback.
1592         (WebCore::GPUBuffer::stagingBufferForWrite): Ditto, but for writing.
1593         (WebCore::GPUBuffer::unmap): If needed, copy the staging ArrayBuffer to the MTLBuffer. Unregister any mapping callback.
1594         (WebCore::GPUBuffer::destroy): Stub implementation for now. Frees the MTLBuffer as soon as possible.
1595         (WebCore::GPUBuffer::create): Deleted.
1596         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
1597         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder): Ensure only read-only GPUBuffers are used as read-only on the GPU.
1598
1599         Add symbols for new files:
1600         * Sources.txt:
1601         * WebCore.xcodeproj/project.pbxproj:
1602
1603 2019-02-23  Keith Miller  <keith_miller@apple.com>
1604
1605         Add new mac target numbers
1606         https://bugs.webkit.org/show_bug.cgi?id=194955
1607
1608         Reviewed by Tim Horton.
1609
1610         * Configurations/Base.xcconfig:
1611         * Configurations/DebugRelease.xcconfig:
1612
1613 2019-02-23  chris fleizach  <cfleizach@apple.com>
1614
1615         AX: WebKit is incorrectly mapping the <meter> element to progressbar
1616         https://bugs.webkit.org/show_bug.cgi?id=164051
1617         <rdar://problem/29055615>
1618
1619         Reviewed by Joanmarie Diggs.
1620
1621         Add a specific role for meter and map that to the appropriate mac role. 
1622
1623         * accessibility/AccessibilityNodeObject.cpp:
1624         (WebCore::AccessibilityNodeObject::canHaveChildren const):
1625         (WebCore::AccessibilityNodeObject::isProgressIndicator const):
1626         * accessibility/AccessibilityObject.cpp:
1627         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent const):
1628         (WebCore::AccessibilityObject::isRangeControl const):
1629         (WebCore::AccessibilityObject::computedRoleString const):
1630         * accessibility/AccessibilityObjectInterface.h:
1631         * accessibility/AccessibilityProgressIndicator.cpp:
1632         (WebCore::AccessibilityProgressIndicator::roleValue const):
1633         * accessibility/AccessibilityProgressIndicator.h:
1634         * accessibility/AccessibilityRenderObject.cpp:
1635         (WebCore::AccessibilityRenderObject::shouldFocusActiveDescendant const):
1636         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1637         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
1638         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1639         (createAccessibilityRoleMap):
1640
1641 2019-02-22  Ryosuke Niwa  <rniwa@webkit.org>
1642
1643         Crash in SWServerJobQueue::runNextJobSynchronously
1644         https://bugs.webkit.org/show_bug.cgi?id=194974
1645
1646         Reviewed by Geoffrey Garen.
1647
1648         We suspect the crash is happening due to m_jobQueue being empty in runNextJobSynchronously
1649         or there is a timer heap corruption again :(
1650
1651         Exit early when m_jobQueue is empty. Also add a debug assert that this should never happen
1652         but convert an existing release assert to a debug assert since this appears to be hitting
1653         too frequently in wild.
1654
1655         * workers/service/server/SWServerJobQueue.cpp:
1656         (WebCore::SWServerJobQueue::runNextJobSynchronously):
1657
1658 2019-02-22  Simon Fraser  <simon.fraser@apple.com>
1659
1660         Clean up the setScrollPosition/setScrollPositionWithoutContentEdgeConstraints confusion in the scrolling tree nodes
1661         https://bugs.webkit.org/show_bug.cgi?id=194968
1662
1663         Reviewed by Antti Koivisto.
1664
1665         Having both setScrollPosition() and setScrollPositionWithoutContentEdgeConstraints() is confusing because
1666         you can't tell which is the bottleneck. So add a 'clamp' parameter to setScrollPosition() and merge them.
1667
1668         ScrollingTreeFrameScrollingNodeMac::setScrollPosition() replicates a bit of code but future cleanups will
1669         reduce that.
1670
1671         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1672         (WebCore::ScrollingTreeFrameScrollingNode::setScrollPosition): Deleted. This was the same as the base class method.
1673         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1674         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1675         (WebCore::ScrollingTreeScrollingNode::setScrollPosition):
1676         (WebCore::ScrollingTreeScrollingNode::clampScrollPosition const):
1677         (WebCore::ScrollingTreeScrollingNode::scrollBy):
1678         (WebCore::ScrollingTreeScrollingNode::setScrollPositionWithoutContentEdgeConstraints): Deleted.
1679         (WebCore::ScrollingTreeScrollingNode::scrollByWithoutContentEdgeConstraints): Deleted.
1680         * page/scrolling/ScrollingTreeScrollingNode.h:
1681         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
1682         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
1683         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPosition):
1684         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints): Deleted. Did nothing.
1685         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1686         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1687         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
1688         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
1689         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
1690         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): Deleted.
1691         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
1692         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1693         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition):
1694         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): Deleted.
1695         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
1696         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollByWithoutContentEdgeConstraints):
1697         * platform/PlatformWheelEvent.h:
1698         (WebCore::PlatformWheelEvent::delta const):
1699         * platform/ScrollTypes.h:
1700
1701 2019-02-22  Eric Liang  <ericliang@apple.com>
1702
1703         AX: Treat AXChildrenInNavigationOrder as AXChildren before adding support for aria-flowto
1704         https://bugs.webkit.org/show_bug.cgi?id=194923
1705
1706         Reviewed by Chris Fleizach.
1707
1708         Added AXChildrenInNavigationOrder attribute that returns the same array as from AXChildren. It prevents AppKit from reordering elements from the fallback AXChildren attribute.
1709
1710         Test: accessibility/mac/children-in-navigation-order-returns-children.html
1711
1712         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1713         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1714
1715 2019-02-22  Tim Horton  <timothy_horton@apple.com>
1716
1717         ProcessSwap.PageOverlayLayerPersistence fails on iOS and in debug builds
1718         https://bugs.webkit.org/show_bug.cgi?id=194963
1719
1720         Reviewed by Dean Jackson.
1721
1722         Tested by existing failing API test.
1723
1724         * page/Page.cpp:
1725         (WebCore::Page::installedPageOverlaysChanged): Deleted.
1726         * page/Page.h:
1727         (WebCore::Page::pageOverlayController):
1728         * page/PageOverlayController.cpp:
1729         (WebCore::PageOverlayController::installedPageOverlaysChanged):
1730         (WebCore::PageOverlayController::detachViewOverlayLayers):
1731         (WebCore::PageOverlayController::installPageOverlay):
1732         (WebCore::PageOverlayController::uninstallPageOverlay):
1733         (WebCore::PageOverlayController::willDetachRootLayer): Deleted.
1734         * page/PageOverlayController.h:
1735         As intended by r240940, move installedPageOverlaysChanged to PageOverlayController.
1736         Also, make it ignore isInWindow state; otherwise, if you install a overlay
1737         and then come into window, nothing installs the root layer. There is no
1738         need for this code to follow in-window state manually anymore since
1739         the DrawingArea and RenderLayerCompositor just hook the layers up when needed.
1740
1741         Make some methods private, and make detachViewOverlayLayers only touch
1742         *view* overlays, so that we don't detach the document-relative root
1743         layer when you drop to having no view overlays. This maintains
1744         existing behavior because nothing was calling PageOverlayController::detachViewOverlayLayers.
1745
1746         Now there are no callers of willDetachRootLayer, so remove it.
1747
1748 2019-02-22  Andy Estes  <aestes@apple.com>
1749
1750         [iOS] Break a reference cycle between PreviewLoader and ResourceLoader
1751         https://bugs.webkit.org/show_bug.cgi?id=194964
1752         <rdar://problem/48279441>
1753
1754         Reviewed by Alex Christensen.
1755
1756         When a document's QuickLook preview is loaded, a reference cycle is created between
1757         PreviewLoader and ResourceLoader. Break the cycle by clearing m_previewLoader in
1758         ResourceLoader::releaseResources().
1759
1760         Fixes leaks detected by `run-webkit-tests --leaks LayoutTests/quicklook`.
1761
1762         * loader/ResourceLoader.cpp:
1763         (WebCore::ResourceLoader::releaseResources):
1764
1765 2019-02-22  Sihui Liu  <sihui_liu@apple.com>
1766
1767         Crash under IDBServer::IDBConnectionToClient::identifier() const
1768         https://bugs.webkit.org/show_bug.cgi?id=194843
1769         <rdar://problem/48203102>
1770
1771         Reviewed by Geoffrey Garen.
1772
1773         UniqueIDBDatabase should ignore requests from connections that are already closed.
1774
1775         Tests are hard to create without some tricks on UniqueIDBDatabase so this fix is verified manually. 
1776         One test is created by adding delay to UniqueIDBDatabase::openBackingStore on the background thread to make sure
1777         disconnection of web process happens before UniqueIDBDatabase::didOpenBackingStore, because didOpenBackingStore
1778         may start a version change transaction and ask for identifier from the connection that is already gone.
1779
1780         * Modules/indexeddb/server/IDBConnectionToClient.cpp:
1781         (WebCore::IDBServer::IDBConnectionToClient::connectionToClientClosed):
1782         * Modules/indexeddb/server/IDBConnectionToClient.h:
1783         (WebCore::IDBServer::IDBConnectionToClient::isClosed):
1784         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1785         (WebCore::IDBServer::UniqueIDBDatabase::clearStalePendingOpenDBRequests):
1786         (WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations):
1787         (WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired):
1788         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1789
1790 2019-02-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1791
1792         Input type "formatSetInlineTextDirection" is dispatched when changing paragraph-level text direction
1793         https://bugs.webkit.org/show_bug.cgi?id=194703
1794         <rdar://problem/48111775>
1795
1796         Reviewed by Ryosuke Niwa.
1797
1798         Currently, when changing text direction, WebKit always sends input events of type formatSetInlineTextDirection,
1799         even when changing paragraph text direction. Instead, we should be emitting formatSetBlockTextDirection in this
1800         scenario. This is problematic when using the context menus on macOS to change writing direction, since changing
1801         "Selection Direction" is currently indistinguishable from changing "Paragraph Direction".
1802
1803         To fix this, we split EditAction::SetWritingDirection into EditAction::SetInlineWritingDirection and
1804         EditAction::SetBlockWritingDirection, which emit inline and block text direction input events, respectively.
1805
1806         Tests: fast/events/before-input-events-prevent-block-text-direction.html
1807                fast/events/before-input-events-prevent-inline-text-direction.html
1808
1809         * editing/CompositeEditCommand.cpp:
1810         (WebCore::CompositeEditCommand::apply):
1811         * editing/EditAction.cpp:
1812         (WebCore::undoRedoLabel):
1813         * editing/EditAction.h:
1814         * editing/EditCommand.cpp:
1815         (WebCore::inputTypeNameForEditingAction):
1816         * editing/Editor.cpp:
1817         (WebCore::inputEventDataForEditingStyleAndAction):
1818         (WebCore::Editor::setBaseWritingDirection):
1819         * editing/EditorCommand.cpp:
1820         (WebCore::executeMakeTextWritingDirectionLeftToRight):
1821         (WebCore::executeMakeTextWritingDirectionNatural):
1822         (WebCore::executeMakeTextWritingDirectionRightToLeft):
1823
1824 2019-02-22  Rob Buis  <rbuis@igalia.com>
1825
1826         Remove stripLeadingAndTrailingWhitespace from MathMLElement.cpp
1827         https://bugs.webkit.org/show_bug.cgi?id=160172
1828
1829         Reviewed by Frédéric Wang.
1830
1831         Remove stripLeadingAndTrailingWhitespace and use stripLeadingAndTrailingHTTPSpaces
1832         from HTTPParsers instead.
1833
1834         No new tests, already covered by MathML tests.
1835
1836         * mathml/MathMLElement.cpp:
1837         (WebCore::MathMLElement::stripLeadingAndTrailingWhitespace): Deleted.
1838         * mathml/MathMLElement.h:
1839         * mathml/MathMLPresentationElement.cpp:
1840         (WebCore::MathMLPresentationElement::parseMathMLLength):
1841         * mathml/MathMLTokenElement.cpp:
1842         (WebCore::MathMLTokenElement::convertToSingleCodePoint):
1843
1844 2019-02-22  Eric Carlson  <eric.carlson@apple.com>
1845
1846         Update some media logging
1847         https://bugs.webkit.org/show_bug.cgi?id=194915
1848
1849         Reviewed by Jer Noble.
1850
1851         No new tests, no functional change.
1852
1853         * Modules/mediasource/SourceBuffer.cpp:
1854         (WebCore::SourceBuffer::evictCodedFrames):
1855         (WebCore::SourceBuffer::provideMediaData):
1856         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
1857
1858         * html/HTMLMediaElement.cpp:
1859         (WebCore::HTMLMediaElement::checkPlaybackTargetCompatablity):
1860         (WebCore::HTMLMediaElement::loadResource):
1861         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
1862         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
1863         (WebCore::HTMLMediaElement::seekTask):
1864         (WebCore::HTMLMediaElement::playInternal):
1865         (WebCore::HTMLMediaElement::pauseInternal):
1866         (WebCore::HTMLMediaElement::setLoop):
1867         (WebCore::HTMLMediaElement::setControls):
1868         (WebCore::HTMLMediaElement::sourceWasRemoved):
1869
1870         * html/MediaElementSession.cpp:
1871         (WebCore::convertEnumerationToString):
1872
1873         * html/MediaElementSession.h:
1874         (WTF::LogArgument<WebCore::MediaPlaybackDenialReason>::toString):
1875
1876         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1877         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
1878
1879 2019-02-22  Rob Buis  <rbuis@igalia.com>
1880
1881         Fix unitless usage of mathsize
1882         https://bugs.webkit.org/show_bug.cgi?id=194940
1883
1884         Reviewed by Frédéric Wang.
1885
1886         Convert unitless lengths to percentage values to correct the computed
1887         font size.
1888
1889         * mathml/MathMLElement.cpp:
1890         (WebCore::convertToPercentageIfNeeded):
1891         (WebCore::MathMLElement::collectStyleForPresentationAttribute):
1892
1893 2019-02-21  Simon Fraser  <simon.fraser@apple.com>
1894
1895         Hardcode Visual Viewports on everywhere except iOS WK1
1896         https://bugs.webkit.org/show_bug.cgi?id=194928
1897
1898         Reviewed by Zalan Bujtas.
1899
1900         Remove the WK1 and WK2 preferences and MiniBrowser menu item for "visual viewports",
1901         change the default value of the Setting to 'true', and hardcode WebView on iOS to
1902         set it to false. The setting has shipped for several years and there's no need to turn
1903         it off now.
1904
1905         Similarly, disable the "Visual Viewport API" on iOS WK1, since it makes no sense if
1906         Visual Viewports are not enabled.
1907         
1908         Remove the "visualViewportEnabled" flag and unused code paths from scrolling tree code
1909         that only runs in WK2
1910
1911         * page/Settings.yaml:
1912         * page/scrolling/AsyncScrollingCoordinator.cpp:
1913         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
1914         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
1915         (WebCore::AsyncScrollingCoordinator::visualViewportEnabled const): Deleted.
1916         * page/scrolling/AsyncScrollingCoordinator.h:
1917         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
1918         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
1919         (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged):
1920         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
1921         (WebCore::ScrollingStateFrameScrollingNode::setVisualViewportEnabled): Deleted.
1922         * page/scrolling/ScrollingStateFrameScrollingNode.h:
1923         * page/scrolling/ScrollingTree.cpp:
1924         (WebCore::ScrollingTree::commitTreeState):
1925         * page/scrolling/ScrollingTree.h:
1926         (WebCore::ScrollingTree::visualViewportEnabled const): Deleted.
1927         (WebCore::ScrollingTree::setVisualViewportEnabled): Deleted.
1928         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1929         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition const):
1930         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1931         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
1932         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
1933
1934 2019-02-21  Darin Adler  <darin@apple.com>
1935
1936         Some refinements for Node and Document
1937         https://bugs.webkit.org/show_bug.cgi?id=194764
1938
1939         Reviewed by Ryosuke Niwa.
1940
1941         * accessibility/AccessibilityObject.cpp:
1942         (WebCore::AccessibilityObject::press): Use shadowHost instead of
1943         deprecatedShadowAncestorNode.
1944         (WebCore::AccessibilityObject::axObjectCache const): Tweak coding style.
1945         (WebCore::AccessibilityObject::focusedUIElement const): Use existing page
1946         function to streamline.
1947
1948         * accessibility/AccessibilityRenderObject.cpp:
1949         (WebCore::AccessibilityRenderObject::accessKey const): Use
1950         attributeWithoutSynchronization for efficiency and consistency with other
1951         code working with the accesskey attribute.
1952
1953         * dom/ContainerNode.cpp:
1954         (WebCore::ContainerNode::childrenChanged): Added call to
1955         invalidateAccessKeyCache, replacing old scheme tied to style recalculation.
1956
1957         * dom/DecodedDataDocumentParser.cpp:
1958         (WebCore::DecodedDataDocumentParser::appendBytes): Update for name and return
1959         type change of createDecoderIfNeeded to decoder.
1960         (WebCore::DecodedDataDocumentParser::flush): Ditto.
1961
1962         * dom/Document.cpp:
1963         (WebCore::Document::elementForAccessKey): Renamed from getElementForAccessKey
1964         to match WebKit coding style. Changed to use unique_ptr instead of separate
1965         boolean to keep track of map validity status.
1966         (WebCore::Document::buildAccessKeyCache): Renamed from buildAccessKeyMap to
1967         clarify that this is a cache. Changed to use composedTreeDescendants rather
1968         than explicit calls to shadowRoot. Use add instead of set so that first element
1969         in document order wins, instead of last element in document order. Updated
1970         to make a new map in a new unique_ptr instead of populating a map.
1971         (WebCore::Document::invalidateAccessKeyCacheSlowCase): Renamed from
1972         invalidateAccessKeyMap, and left an inline part in the header so the fast case
1973         of quickly checking for a null pointer can be inlined.
1974         (WebCore::Document::doctype const): Use downcast instead of static_cast.
1975         (WebCore::Document::scheduleStyleRecalc): Moved call to invalidateAccessKeyMap
1976         from here to childrenChanged and accesskey attribute change handling.
1977         (WebCore::Document::processFormatDetection): Set m_isTelephoneNumberParsingAllowed
1978         directly since this is the only place that does it and we don't need to factor
1979         that one line of code into a function.
1980         (WebCore::Document::getOverrideStyle): Moved to header since it's just a stub
1981         that always returns nullptr and can be inlined.
1982         (WebCore::Document::setIsTelephoneNumberParsingAllowed): Deleted.
1983         (WebCore::Document::ensureTemplateDocument): Removed nullptr frame argument to
1984         the create function, since Document::create now always involves no frame.
1985         (WebCore::Document::didAssociateFormControl): Changed argument type to a reference
1986         and simplified the logic with a local variable.
1987         (WebCore::Document::didAssociateFormControlsTimerFired): Simplified the null
1988         checks and rearranged things so that m_associatedFormControls will always
1989         get cleared even if the document is no longer associated with a page.
1990
1991         * dom/Document.h: Removed unnnecessary explicit values for enumerations (first
1992         value is always zero, etc.) and formatted simple enumerations in a single line
1993         for easier reading. Moved Document::create fucntion bodies out of line, removed
1994         the frame argument from the simple "create with URL" overload and made the frame
1995         argument for createNonRenderedPlaceholder be a reference rather than a pointer.
1996         Renamed getElementByAccessKey to elementForAccessKey, invalidateAccessKeyMap to
1997         invalidateAccessKeyCache, buildAccessKeyMap to buildAccessKeCache,
1998         m_elementsByAccessKey to m_accessKeyCache and changed its type.
1999         Removed bogus "DOM methods" comment, unused setParserFeature friend declaration,
2000         setIsTelephoneNumberParsingAllowed function, and m_accessKeyMapValid flag.
2001
2002         * dom/Document.idl: Added comment highlighting that getOverrideStyle is just a
2003         placeholder returning null.
2004
2005         * dom/Element.cpp:
2006         (WebCore::Element::attributeChanged): Call invalidateAccessKeyCache when the
2007         value of the accesskey attribute is changed. Also moved the class attribute code
2008         so the attributes here are in alphabetical order (only class and id were out of
2009         alphabetical order).
2010
2011         * dom/Node.cpp:
2012         (WebCore::Node::isDescendantOrShadowDescendantOf const): Rewrote to no longer
2013         use deprecatedShadowAncestorNode and used boolean operators to make it a
2014         single line and easier to understand. Also added a FIXME since the
2015         containsIncludingShadowDOM function is so similar, yet differently written.
2016         (WebCore::Node::contains const): Rewrote as a single line to make this easier
2017         to read and to *slightly* improve the speed in the "this == node" case.
2018         (WebCore::Node::containsIncludingHostElements const): Use downcast.
2019         (WebCore::Node::deprecatedShadowAncestorNode const): Deleted.
2020
2021         * dom/Node.h: Deleted now-unused deprecatedShadowAncestorNode.
2022
2023         * editing/ReplaceSelectionCommand.cpp:
2024         (WebCore::ReplacementFragment::ReplacementFragment): Rewrote to use shadowHost
2025         instead of deprecatedShadowAncestorNode.
2026
2027         * html/FormAssociatedElement.cpp:
2028         (WebCore::FormAssociatedElement::resetFormOwner): Pass reference to
2029         didAssociateFormControl.
2030         (WebCore::FormAssociatedElement::formAttributeChanged): Ditto.
2031
2032         * html/HTMLAreaElement.cpp:
2033         (WebCore::HTMLAreaElement::parseAttribute): Removed special case for accesskey
2034         attribute, because we want to call the base class parseAttribute in that case.
2035
2036         * html/HTMLFormElement.cpp:
2037         (WebCore::HTMLFormElement::insertedIntoAncestor): Pass reference to
2038         didAssociateFormControl.
2039
2040         * html/HTMLSelectElement.cpp:
2041         (WebCore::HTMLSelectElement::parseAttribute): Removed special case for accesskey
2042         attribute with mysterious FIXME, because we want to call the base class
2043         parseAttribute in that case. The old code had no effect before; the access key
2044         logic would still find the attribute; if the goal is to ignore the attribute
2045         for these elements we will need a different solution.
2046         * html/HTMLTextAreaElement.cpp:
2047         (WebCore::HTMLTextAreaElement::parseAttribute): Ditto.
2048
2049         * loader/DocumentLoader.cpp:
2050         (WebCore::DocumentLoader::DocumentLoader): Removed code that was always passing
2051         nullptr as the frame for the newly created DocumentWriter. It used m_frame, but
2052         m_frame was always null.
2053         (WebCore::DocumentLoader::attachToFrame): Pass reference to DocumentWriter::setFrame.
2054
2055         * loader/DocumentWriter.cpp:
2056         (WebCore::DocumentWriter::DocumentWriter): Deleted. The old version set m_frame to
2057         the passed in frame, which was always nullptr, and initialized some booleans and an
2058         enumeration, which are now initialized in the class definition.
2059         (WebCore::DocumentWriter::createDocument): Pass a reference for the frame.
2060         (WebCore::DocumentWriter::begin): Updated now that State is an enum class.
2061         (WebCore::DocumentWriter::decoder): Renamed from createDecoderIfNeeded and changed
2062         to return a reference.
2063         (WebCore::DocumentWriter::addData): Use RELEASE_ASSERT instead of if/CRASH and
2064         updated now that State is an enum class.
2065         (WebCore::DocumentWriter::insertDataSynchronously): Updated now that State is an
2066         enum class.
2067         (WebCore::DocumentWriter::end): Ditto.
2068
2069         * loader/DocumentWriter.h: Removed unneeded include and forward declaration.
2070         Removed the frame pointer argument to the constructor, caller was always passing a
2071         nullptr. Changed argument to setFrame to be a reference. Renamed createDecoderIfNeeded
2072         to decoder and changed it to return a reference. Initialized m_frame,
2073         m_hasReceivedSomeData, m_encodingWasChosenByUser, and m_state here so we don't need
2074         to initialize them in a constructor. Renamed the enum from WriterState to State since
2075         it's a member of DocumentWriter already, and made it an enum class rather than ending
2076         each enumeration value with WritingState.
2077
2078         * page/DragController.cpp:
2079         (WebCore::isEnabledColorInput): Removed boolean argument setToShadowAncestor. The
2080         one caller that formerly passed true now calls the new hasEnabledColorInputAsShadowHost
2081         function instead.
2082         (WebCore::hasEnabledColorInputAsShadowHost): Added.
2083         (WebCore::elementUnderMouse): Use shadowHost instead of deprecatedShadowAncestorNode.
2084         Also added FIXME since it seems this should instead be using parentElementInComposedTree.
2085         (WebCore::DragController::concludeEditDrag): Removed "false" argument to isEnabledColorInput.
2086         (WebCore::DragController::canProcessDrag): Removed "true" argument to isEnabledColorInput
2087         and added call to hasEnabledColorInputAsShadowHost. Also put the value of the node to drag
2088         into a local variable to simplify code.
2089         (WebCore::DragController::draggableElement const): Removed "false" argument to isEnabledColorInput.
2090
2091         * page/EventHandler.cpp:
2092         (WebCore::EventHandler::handleAccessKey): Update name of elementForAccessKey.
2093
2094         * page/FocusController.cpp:
2095         (WebCore::clearSelectionIfNeeded): Use shadowHost instead of deprecatedShadowAncestorNode.
2096
2097         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2098         (WebCore::createPageForServiceWorker): Pass reference instead of pointer for frame to
2099         Document::createNonRenderedPlaceholder.
2100
2101 2019-02-21  Daniel Bates  <dabates@apple.com>
2102
2103         Same Site Lax cookies are not sent with cross-site redirect from client-initiated load
2104         https://bugs.webkit.org/show_bug.cgi?id=194906
2105         <rdar://problem/44305947>
2106
2107         Reviewed by Brent Fulgham.
2108
2109         Ensure that a request for a top-level navigation is annotated as such regardless of whether
2110         the request has a computed Same Site policy.
2111
2112         "New loads" initiated by a the client (Safari) either by API or a human either explicitly
2113         typing a URL in the address bar or Command + clicking a hyperlink to open it in a new window/tab
2114         are always considered Same Site. This is by definition from the spec. [1] as we aren't navigating
2115         from an existing page. (Command + click should be thought of as a convenience to the user from
2116         having to copy the hyperlink's URL, create a new window, and paste the URL into the address bar).
2117         Currently the frame loader marks a request as a top-level navigation if and only if the request
2118         does not have a pre-computed Same Site policy. However, "New loads" have a pre-computed Same Site
2119         policy. So, these loads would never be marked as a top-level navigation by the frame loading code.
2120         Therefore, if the "new load" turned out to be a cross-site redirect then WebKit would incorrectly
2121         tell the networking stack that the load was a cross-site, non-top-level navigation, and per the
2122         Same Site spec [2], the networking stack would not send Same Site Lax cookies. Instead,
2123         WebKit should unconditionally ensure that requests are marked as a top-level navigation, if applicable.
2124
2125         [1] See Note for (1) in  <https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-5.2>
2126         [2] <https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-5.3.7.1>
2127
2128         Test: http/tests/cookies/same-site/user-load-cross-site-redirect.php
2129
2130         * loader/FrameLoader.cpp:
2131         (WebCore::FrameLoader::addExtraFieldsToRequest): Unconditionally update the request's top-
2132         level navigation bit.
2133         * platform/network/ResourceRequestBase.cpp:
2134         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Unconditionally copy a request's top-
2135         level navigation bit.
2136
2137 2019-02-21  Per Arne Vollan  <pvollan@apple.com>
2138
2139         Layout Test fast/text/international/khmer-selection.html is crashing
2140         https://bugs.webkit.org/show_bug.cgi?id=191368
2141
2142         Reviewed by Brent Fulgham.
2143
2144         GlyphBuffer's offset array wasn't getting filled by UniscribeController.
2145         Our underlining code requires this array.
2146
2147         Uniscribe gives us a character -> glyph mapping, so we just have to compute
2148         the inverse and give it to the GlyphBuffer.
2149
2150         This patch is written by Myles C. Maxfield.
2151
2152         Test: fast/text/international/khmer-selection.html.
2153
2154         * platform/graphics/GlyphBuffer.h:
2155         (WebCore::GlyphBuffer::add):
2156         * platform/graphics/displaylists/DisplayListItems.cpp:
2157         (WebCore::DisplayList::DrawGlyphs::generateGlyphBuffer const):
2158         * platform/graphics/win/UniscribeController.cpp:
2159         (WebCore::UniscribeController::advance):
2160         (WebCore::UniscribeController::itemizeShapeAndPlace):
2161         (WebCore::UniscribeController::shapeAndPlaceItem):
2162         * platform/graphics/win/UniscribeController.h:
2163
2164 2019-02-21  Sihui Liu  <sihui_liu@apple.com>
2165
2166         IndexedDB: leak UniqueIDBDatabase in layout tests
2167         https://bugs.webkit.org/show_bug.cgi?id=194870
2168         <rdar://problem/48163812>
2169
2170         Reviewed by Geoffrey Garen.
2171
2172         UniqueIDBDatabase owns a pointer to itself after it is hard closed. It should release the pointer when it 
2173         receives confirmation from clients and all pending tasks are done. UniqueIDBDatabase already checks whether the
2174         pointer should be released when a database task finishes, but it didn't perform a check when a confirm message 
2175         is received. 
2176
2177         No new test as the order of task completion and confirmation arrival is uncertain.
2178
2179         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2180         (WebCore::IDBServer::UniqueIDBDatabase::confirmDidCloseFromServer):
2181
2182 2019-02-21  Andy Estes  <aestes@apple.com>
2183
2184         contentfiltering tests leak documents
2185         https://bugs.webkit.org/show_bug.cgi?id=189434
2186         <rdar://44239943>
2187
2188         Reviewed by Simon Fraser.
2189
2190         Changed ContentFilter to capture the blocked Frame as a WeakPtr to break a reference cycle.
2191
2192         This fixes world leaks in several tests in LayoutTests/contentfiltering/.
2193
2194         * bindings/js/ScriptController.h:
2195         * loader/ContentFilter.cpp:
2196         (WebCore::ContentFilter::didDecide):
2197
2198 2019-02-21  Don Olmstead  <don.olmstead@sony.com>
2199
2200         [CMake][Win] Fix !USE(CF) build of WebCore
2201         https://bugs.webkit.org/show_bug.cgi?id=194879
2202
2203         Reviewed by Konstantin Tokarev.
2204
2205         * PlatformAppleWin.cmake:
2206         * PlatformWin.cmake:
2207         * PlatformWinCairo.cmake:
2208
2209 2019-02-21  Zalan Bujtas  <zalan@apple.com>
2210
2211         [LFC][Floats] Add support for placing formatting roots in-between floats.
2212         https://bugs.webkit.org/show_bug.cgi?id=194902
2213
2214         Reviewed by Antti Koivisto.
2215
2216         This patch add support for placing a formatting root box in-between existing floats.
2217         The initial vertical position of a formatting root is its static position which can make the box
2218         placed above exsiting floats (whereas we can never place a regular float above existing floats.)
2219
2220         Test: fast/block/block-only/floats-and-block-formatting-roots.html
2221
2222         * layout/blockformatting/BlockFormattingContext.cpp:
2223         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
2224         * layout/floats/FloatingContext.cpp:
2225         (WebCore::Layout::FloatPair::LeftRightIndex::isEmpty const):
2226         (WebCore::Layout::FloatPair::isEmpty const):
2227         (WebCore::Layout::FloatPair::operator* const):
2228         (WebCore::Layout::Iterator::operator* const):
2229         (WebCore::Layout::begin):
2230         (WebCore::Layout::end):
2231         (WebCore::Layout::FloatingContext::positionForFloat const):
2232         (WebCore::Layout::FloatingContext::positionForFormattingContextRoot const):
2233         (WebCore::Layout::findAvailablePosition):
2234         (WebCore::Layout::FloatingContext::findPositionForFloatBox const):
2235         (WebCore::Layout::FloatingContext::findPositionForFormattingContextRoot const):
2236         (WebCore::Layout::FloatPair::FloatPair):
2237         (WebCore::Layout::FloatPair::left const):
2238         (WebCore::Layout::FloatPair::right const):
2239         (WebCore::Layout::FloatPair::intersects const):
2240         (WebCore::Layout::FloatPair::operator == const):
2241         (WebCore::Layout::FloatPair::horizontalConstraints const):
2242         (WebCore::Layout::FloatPair::bottom const):
2243         (WebCore::Layout::Iterator::operator++):
2244         (WebCore::Layout::Iterator::set):
2245         (WebCore::Layout::FloatingPair::isEmpty const): Deleted.
2246         (WebCore::Layout::FloatingPair::verticalConstraint const): Deleted.
2247         (WebCore::Layout::FloatingContext::positionForFloatAvoiding const): Deleted.
2248         (WebCore::Layout::FloatingContext::floatingPosition const): Deleted.
2249         (WebCore::Layout::FloatingPair::FloatingPair): Deleted.
2250         (WebCore::Layout::FloatingPair::left const): Deleted.
2251         (WebCore::Layout::FloatingPair::right const): Deleted.
2252         (WebCore::Layout::FloatingPair::intersects const): Deleted.
2253         (WebCore::Layout::FloatingPair::operator == const): Deleted.
2254         (WebCore::Layout::FloatingPair::horizontalConstraints const): Deleted.
2255         (WebCore::Layout::FloatingPair::bottom const): Deleted.
2256         * layout/floats/FloatingContext.h:
2257
2258 2019-02-21  Rob Buis  <rbuis@igalia.com>
2259
2260         Update MIME type parser
2261         https://bugs.webkit.org/show_bug.cgi?id=180526
2262
2263         Reviewed by Darin Adler.
2264
2265         Further testing showed the MIME parser needs these fixes:
2266         - stripWhitespace is wrong for removing HTTP whitespace, use
2267           stripLeadingAndTrailingHTTPSpaces instead.
2268         - HTTP Token code points checking for Rfc2045 and Mimesniff were
2269           mixed up, use the dedicated isValidHTTPToken for Mimesniff mode.
2270         - Quoted Strings were not unescaped/escaped, this seems ok for
2271           serializing but is wrong when gettings individual parameter values.
2272           Implement [1] and [2] Step 2.4 to properly unescape and escape.
2273
2274         This change also tries to avoid hard to read uses of find.
2275
2276         Test: ParsedContentType.Serialize
2277
2278         [1] https://fetch.spec.whatwg.org/#collect-an-http-quoted-string
2279         [2] https://mimesniff.spec.whatwg.org/#serializing-a-mime-type
2280
2281         * platform/network/ParsedContentType.cpp:
2282         (WebCore::skipSpaces):
2283         (WebCore::parseToken):
2284         (WebCore::isNotQuoteOrBackslash):
2285         (WebCore::collectHTTPQuotedString):
2286         (WebCore::containsNonTokenCharacters):
2287         (WebCore::parseQuotedString):
2288         (WebCore::ParsedContentType::parseContentType):
2289         (WebCore::ParsedContentType::create):
2290         (WebCore::ParsedContentType::setContentType):
2291         (WebCore::containsNonQuoteStringTokenCharacters):
2292         (WebCore::ParsedContentType::setContentTypeParameter):
2293         (WebCore::ParsedContentType::serialize const):
2294         (WebCore::substringForRange): Deleted.
2295         (WebCore::isNonTokenCharacter): Deleted.
2296         (WebCore::isNonQuotedStringTokenCharacter): Deleted.
2297         * platform/network/ParsedContentType.h:
2298
2299 2019-02-20  Simon Fraser  <simon.fraser@apple.com>
2300
2301         REGRESSION (240698): Fixed position banners flicker and move when scrolling on iOS
2302         https://bugs.webkit.org/show_bug.cgi?id=194889
2303         rdar://problem/47755552
2304
2305         Reviewed by Tim Horton.
2306         
2307         After r240698 we could commit scrolling changes for a fixed node where the "viewportRectAtLastLayout" and the layer
2308         position were mismatched; this happened when AsyncScrollingCoordinator::reconcileScrollingState() came back from the UI process
2309         with an unstable update and set a new layoutViewport, then some other layout triggered a compositing tree update. During the tree
2310         update, we'd update the fixed scrolling node with the new viewport, and an old layer position.
2311         
2312         Fix by ensuring that we only update the geometry info for a scrolling tree node when we update layer geometry for the corresponding
2313         layer.
2314
2315         Not currently testable.
2316
2317         * rendering/RenderLayerCompositor.cpp:
2318         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
2319
2320 2019-02-20  Dean Jackson  <dino@apple.com>
2321
2322         Rotation animations sometimes use the wrong origin (affects apple.com)
2323         https://bugs.webkit.org/show_bug.cgi?id=194878
2324         <rdar://problem/43908047>
2325
2326         Reviewed by Simon Fraser.
2327
2328         Some versions of CoreAnimation apply additive animations in reverse
2329         order. Detect this and reverse the list of animations we provide.
2330
2331         Update the existing animations/additive-transform-animations.html test to
2332         be a ref-test that would identify this failure. Previously it relied on
2333         a pixel test.
2334
2335         * platform/graphics/ca/GraphicsLayerCA.cpp: Use 
2336             HAVE_CA_WHERE_ADDITIVE_TRANSFORMS_ARE_REVERSED to decide whether or
2337             not to flip the list of animations (and mark the correct ones as
2338             additive).
2339         (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
2340         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
2341
2342 2019-02-20  Don Olmstead  <don.olmstead@sony.com>
2343
2344         [Win] Guard CF usage in RenderThemeWin
2345         https://bugs.webkit.org/show_bug.cgi?id=194875
2346
2347         Reviewed by Alex Christensen.
2348
2349         No new tests. No change in behavior.
2350
2351         Add #if USE(CF) checks to RenderThemeWin so it can compile without CF support.
2352
2353         * rendering/RenderThemeWin.cpp:
2354         (WebCore::RenderThemeWin::stringWithContentsOfFile):
2355         (WebCore::RenderThemeWin::mediaControlsStyleSheet):
2356         (WebCore::RenderThemeWin::mediaControlsScript):
2357         * rendering/RenderThemeWin.h:
2358
2359 2019-02-20  Ryosuke Niwa  <rniwa@webkit.org>
2360
2361         Crash in DOMWindowExtension::suspendForPageCache
2362         https://bugs.webkit.org/show_bug.cgi?id=194871
2363
2364         Reviewed by Chris Dumez.
2365
2366         This is a speculative fix for a crash in DOMWindowExtension::suspendForPageCache.
2367
2368         We think it's possible for DOMWindowExtension::suspendForPageCache notifying the clients via
2369         dispatchWillDisconnectDOMWindowExtensionFromGlobalObject to remove other DOMWindowExtension's.
2370         Check that each DOMWindowProperty is still in m_properties before invoking suspendForPageCache
2371         to avoid the crash.
2372
2373         * page/DOMWindow.cpp:
2374         (WebCore::DOMWindow::willDestroyCachedFrame):
2375         (WebCore::DOMWindow::willDestroyDocumentInFrame):
2376         (WebCore::DOMWindow::willDetachDocumentFromFrame):
2377         (WebCore::DOMWindow::suspendForPageCache):
2378         (WebCore::DOMWindow::resumeFromPageCache):
2379         * page/DOMWindowExtension.cpp:
2380         (WebCore::DOMWindowExtension::suspendForPageCache):
2381
2382 2019-02-20  Alex Christensen  <achristensen@webkit.org>
2383
2384         Always call CompletionHandlers after r240909
2385         https://bugs.webkit.org/show_bug.cgi?id=194823
2386
2387         Reviewed by Ryosuke Niwa.
2388
2389         * loader/PolicyChecker.cpp:
2390         (WebCore::PolicyChecker::checkNavigationPolicy):
2391         (WebCore::PolicyChecker::checkNewWindowPolicy):
2392
2393 2019-02-20  Andy Estes  <aestes@apple.com>
2394
2395         [Xcode] Add SDKVariant.xcconfig to various Xcode projects
2396         https://bugs.webkit.org/show_bug.cgi?id=194869
2397
2398         Rubber-stamped by Jer Noble.
2399
2400         * WebCore.xcodeproj/project.pbxproj:
2401
2402 2019-02-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
2403
2404         drawImage() clears the canvas if it's the source of the image and globalCompositeOperation is "copy"
2405         https://bugs.webkit.org/show_bug.cgi?id=194746
2406
2407         Reviewed by Dean Jackson.
2408
2409         Test: fast/canvas/canvas-drawImage-composite-copy.html
2410
2411         If the source canvas of drawImage() is the same as the destination and
2412         globalCompositeOperation is set to "copy", copy the srcRect from the 
2413         canvas to a temporary buffer before calling clearCanvas() then drawImage
2414         from this temporary buffer.
2415
2416         * html/canvas/CanvasRenderingContext2DBase.cpp:
2417         (WebCore::CanvasRenderingContext2DBase::drawImage):
2418         * platform/graphics/ImageBuffer.cpp:
2419         (WebCore::ImageBuffer::copyRectToBuffer):
2420         * platform/graphics/ImageBuffer.h:
2421
2422 2019-02-20  Simon Fraser  <simon.fraser@apple.com>
2423
2424         REGRESSION (r241788>): ASSERTION FAILED: !m_normalFlowListDirty in TestWebKitAPI.WebKit.ResizeReversePaginatedWebView test
2425         https://bugs.webkit.org/show_bug.cgi?id=194866
2426
2427         Reviewed by Antti Koivisto.
2428
2429         r241788 removed some calls that updated layer lists (normal flow and z-order) during compositing updates, causing
2430         a later call to RenderLayerCompositor::recursiveRepaintLayer() to assert when the lists were dirty. Fix by updating
2431         the lists in RenderLayerCompositor::recursiveRepaintLayer(), as we do in various other places.
2432
2433         * rendering/RenderLayerCompositor.cpp:
2434         (WebCore::RenderLayerCompositor::recursiveRepaintLayer):
2435
2436 2019-02-20  Daniel Bates  <dabates@apple.com>
2437
2438         [iOS] Tweak UI for focus rings
2439         https://bugs.webkit.org/show_bug.cgi?id=194864
2440         <rdar://problem/47831886>
2441
2442         Reviewed by Brent Fulgham.
2443
2444         Make use of UIKit constants to make focus rings pretty.
2445
2446         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
2447         (WebCore::drawFocusRingAtTime):
2448
2449 2019-02-20  Timothy Hatcher  <timothy@apple.com>
2450
2451         RenderThemeIOS should use RenderTheme's color cache instead of its own.
2452         https://bugs.webkit.org/show_bug.cgi?id=194822
2453         rdar://problem/48208296
2454
2455         Reviewed by Tim Horton.
2456
2457         Tested by fast/css/apple-system-colors.html.
2458
2459         * css/CSSValueKeywords.in:
2460         * css/parser/CSSPropertyParser.cpp:
2461         (WebCore::isAppleLegacyCssValueKeyword):
2462         * platform/graphics/Color.h:
2463         * platform/graphics/cg/ColorCG.cpp:
2464         (WebCore::makeRGBAFromCGColor):
2465         (WebCore::Color::Color):
2466         * rendering/RenderThemeIOS.h:
2467         * rendering/RenderThemeIOS.mm:
2468         (WebCore::RenderThemeIOS::systemColor const):
2469         * rendering/RenderThemeMac.mm:
2470         (WebCore::RenderThemeMac::systemColor const):
2471
2472 2019-02-20  Loïc Yhuel  <loic.yhuel@softathome.com>
2473
2474         Fix crash when opening Web Inspector after a WebSocket was blocked by content extensions
2475         https://bugs.webkit.org/show_bug.cgi?id=194819
2476
2477         Reviewed by Joseph Pecoraro.
2478
2479         Test: http/tests/inspector/network/contentextensions/blocked-websocket-crash.html
2480
2481         * Modules/websockets/WebSocketChannel.h:
2482         (WebCore::WebSocketChannel::hasCreatedHandshake):
2483         * inspector/agents/page/PageNetworkAgent.cpp:
2484         Ignore WebSocketChannel without an WebSocketHandshake, which would crash in InspectorNetworkAgent::enable.
2485
2486 2019-02-20  Zalan Bujtas  <zalan@apple.com>
2487
2488         [LFC][Floats] Make FloatAvoider::resetPosition implicit
2489         https://bugs.webkit.org/show_bug.cgi?id=194855
2490
2491         Reviewed by Antti Koivisto.
2492
2493         Let's compute the initial top/left position during c'tor time.
2494         This is in preparation for fixing formatting root box placement in a float context.
2495
2496         * layout/floats/FloatAvoider.cpp:
2497         (WebCore::Layout::FloatAvoider::resetPosition): Deleted.
2498         * layout/floats/FloatAvoider.h:
2499         (WebCore::Layout::FloatAvoider::displayBox):
2500         (WebCore::Layout::FloatAvoider::initialVerticalPosition const): Deleted.
2501         * layout/floats/FloatBox.cpp:
2502         (WebCore::Layout::FloatBox::FloatBox):
2503         (WebCore::Layout::FloatBox::initialVerticalPosition const):
2504         * layout/floats/FloatBox.h:
2505         * layout/floats/FloatingContext.cpp:
2506         (WebCore::Layout::FloatingContext::floatingPosition const):
2507
2508 2019-02-20  Don Olmstead  <don.olmstead@sony.com>
2509
2510         [MSVC] Fix compilation errors with lambdas in Service Workers
2511         https://bugs.webkit.org/show_bug.cgi?id=194841
2512
2513         Reviewed by Alex Christensen.
2514
2515         No new tests. No change in behavior.
2516
2517         MSVC has problems with the scoping of `this` within a nested lambda. In these cases `this` is
2518         referring to the enclosing lambda according to MSVC. This patch works around this behavior
2519         through by using the `protectedThis` pattern in WebKit code.
2520
2521         * workers/service/server/RegistrationDatabase.cpp:
2522         (WebCore::RegistrationDatabase::openSQLiteDatabase):
2523
2524 2019-02-20  Adrian Perez de Castro  <aperez@igalia.com>
2525
2526         [WPE][GTK] Enable support for CONTENT_EXTENSIONS
2527         https://bugs.webkit.org/show_bug.cgi?id=167941
2528
2529         Reviewed by Carlos Garcia Campos.
2530
2531         * platform/gtk/po/POTFILES.in: Added WebKitUserContentFilterStore.cpp
2532         to the list of files with translatable strings.
2533
2534 2019-02-19  Simon Fraser  <simon.fraser@apple.com>
2535
2536         REGRESSION (r238090): Toggling visibility on the <html> element can result in a blank web view
2537         https://bugs.webkit.org/show_bug.cgi?id=194827
2538         rdar://problem/47620594
2539
2540         Reviewed by Antti Koivisto.
2541
2542         Incremental compositing updates, added in rr238090, use repaints as a trigger for re-evaluating
2543         layer configurations, since a repaint implies that a layer gains painted content. This is done
2544         via the call to setNeedsCompositingConfigurationUpdate() in RenderLayerBacking::setContentsNeedDisplay{InRect}.
2545         The RenderView's layer is opted out of this to avoid doing lots of redundant layer config recomputation
2546         for the root. The configuration state that matters here is whether the layer contains painted content,
2547         and therefore needs backing store; this is computed by RenderLayerBacking::isSimpleContainerCompositingLayer(),
2548         and feeds into GraphicsLayer::drawsContent().
2549
2550         However, if <html> starts as "visibility:hidden" or "opacity:0", as some sites do to hide incremental loading,
2551         then we'll fail to recompute 'drawsContent' for the root and leave the root with drawsContent=false, which
2552         causes RenderLayerBacking::setContentsNeedDisplay{InRect} to short-circuit, and then we paint nothing.
2553
2554         Ironically, 'drawsContent' doesn't actually save any backing store for the root, since it has no affect on
2555         the root tile caches; we always make tiles. So the simple fix here is to change RenderLayerBacking::isSimpleContainerCompositingLayer()
2556         to always return false for the RenderView's layer (the root).
2557         
2558         Testing this was tricky; ref testing doesn't work because we force repaint, and we normally skip
2559         properties of the root in layer tree dumps to hide WK1/WK2 differences. Therefore I had to add
2560         LAYER_TREE_INCLUDES_ROOT_LAYER_PROPERTIES and fix RenderLayerBacking::shouldDumpPropertyForLayer to
2561         respect it.
2562
2563         Test: compositing/visibility/root-visibility-toggle.html
2564
2565         * page/Frame.h:
2566         * platform/graphics/GraphicsLayer.cpp:
2567         (WebCore::GraphicsLayer::dumpProperties const):
2568         * platform/graphics/GraphicsLayerClient.h:
2569         (WebCore::GraphicsLayerClient::shouldDumpPropertyForLayer const):
2570         * rendering/RenderLayerBacking.cpp:
2571         (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer const):
2572         (WebCore::RenderLayerBacking::shouldDumpPropertyForLayer const):
2573         * rendering/RenderLayerBacking.h:
2574         * rendering/RenderLayerCompositor.cpp:
2575         (WebCore::RenderLayerCompositor::layerTreeAsText):
2576         * testing/Internals.cpp:
2577         (WebCore::toLayerTreeFlags):
2578         * testing/Internals.h:
2579         * testing/Internals.idl:
2580
2581 2019-02-19  Ryosuke Niwa  <rniwa@webkit.org>
2582
2583         REGRESSION(r240909): Release assertion in FrameLoader::loadPostRequest when opening new window
2584         https://bugs.webkit.org/show_bug.cgi?id=194820
2585
2586         Reviewed by Geoffrey Garen.
2587
2588         This release assertion was wrong. The invocation of PolicyChecker::checkNewWindowPolicy in FrameLoader
2589         doesn’t require PolicyChecker's load type to be set in PolicyChecker because FrameLoader's
2590         continueLoadAfterNewWindowPolicy invokes loadWithNavigationAction which sets the load type later,
2591         and we don't rely on PolicyChecker's load type until then.
2592
2593         Fixed the crash by removing relese asserts before invoking checkNewWindowPolicy accordingly.
2594
2595         This patch reverts r241015 since it too was asserting that PolicyChecker's load type is set before
2596         invoking checkNewWindowPolicy which is not the right assumption.
2597
2598         Test: fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation.html
2599
2600         * loader/FrameLoader.cpp:
2601         (WebCore::FrameLoader::loadURL):
2602         (WebCore::FrameLoader::load):
2603         (WebCore::FrameLoader::loadPostRequest):
2604
2605 2019-02-19  Zalan Bujtas  <zalan@apple.com>
2606
2607         Fix post-commit feedback.
2608
2609         Unreviewed. 
2610
2611         * layout/floats/FloatingContext.cpp:
2612         (WebCore::Layout::FloatingPair::intersects const):
2613
2614 2019-02-19  Zalan Bujtas  <zalan@apple.com>
2615
2616         [LFC][Floats] Remove redundant intersecting logic
2617         https://bugs.webkit.org/show_bug.cgi?id=194804
2618
2619         Reviewed by Antti Koivisto.
2620
2621         floatAvoider.overflowsContainingBlock() check already (and properly) takes care of the far left/right case (see comment).
2622
2623         * layout/floats/FloatingContext.cpp:
2624         (WebCore::Layout::FloatingContext::floatingPosition const):
2625         (WebCore::Layout::FloatingPair::intersects const):
2626
2627 2019-02-19  Commit Queue  <commit-queue@webkit.org>
2628
2629         Unreviewed, rolling out r241722.
2630         https://bugs.webkit.org/show_bug.cgi?id=194801
2631
2632         Causing time outs and EWS failures after expectation file was
2633         added. (Requested by ShawnRoberts on #webkit).
2634
2635         Reverted changeset:
2636
2637         "IndexedDB: leak IDBDatabase and IDBTransacstion in layout
2638         tests"
2639         https://bugs.webkit.org/show_bug.cgi?id=194709
2640         https://trac.webkit.org/changeset/241722
2641
2642 2019-02-16  Darin Adler  <darin@apple.com>
2643
2644         Continue reducing use of String::format, now focusing on hex: "%p", "%x", etc.
2645         https://bugs.webkit.org/show_bug.cgi?id=194752
2646
2647         Reviewed by Daniel Bates.
2648
2649         * Modules/websockets/WebSocket.cpp: Added an include of HexNumber.h. This previously
2650         got included because of Logger.h, but that no longer pulls in HexNumber.h.
2651
2652         * css/CSSMarkup.cpp: Removed unneeded include of StringBuffer.h.
2653         * css/CSSPrimitiveValue.cpp: Ditto.
2654
2655         * css/CSSUnicodeRangeValue.cpp:
2656         (WebCore::CSSUnicodeRangeValue::customCSSText const): Use makeString and hex instead
2657         of String::format and "%x".
2658
2659         * html/HTMLMediaElement.h:
2660         (WTF::ValueToString<WebCore::TextTrackCue::string): Use a non-template function,
2661         TextTrackCure::debugString, so we don't need to use HextNumber.h in a header.
2662
2663         * html/canvas/WebGLRenderingContextBase.cpp:
2664         (GetErrorString): Use makeString and hex instead of String::format and "%04x".
2665
2666         * html/track/TextTrackCue.cpp:
2667         (WebCore::TextTrackCue::debugString const): Added. Moved string conversion here
2668         from HTMLMediaElement.h and use makeString instead of String::format. Also use
2669         the word "debug" to make it clear that it's not OK to use this string, with a
2670         pointer value serialized into it, outside of debugging.
2671         * html/track/TextTrackCue.h: Added TextTrackCue::debugString.
2672
2673         * page/linux/ResourceUsageOverlayLinux.cpp:
2674         (WebCore::formatByteNumber): Use makeString and FormattedNumber::fixedWidth
2675         instead of String::format and "%.1f" etc.
2676
2677         * platform/cocoa/KeyEventCocoa.mm:
2678         (WebCore::keyIdentifierForCharCode): Use the new hex function here instead of
2679         the old code that did each of the four characters explicitly.
2680
2681         * platform/gamepad/mac/HIDGamepad.cpp:
2682         (WebCore::HIDGamepad::HIDGamepad): Use makeString instead of String::format.
2683
2684         * platform/graphics/Color.cpp:
2685         (WebCore::Color::nameForRenderTreeAsText const): Use hex instead of doing each
2686         digit separately.
2687
2688         * platform/graphics/FloatPolygon.cpp:
2689         (WebCore::FloatPolygonEdge::debugString const): Added. Moved string conversion here
2690         from the header and use makeString instead of String::format. Also use
2691         the word "debug" to make it clear that it's not OK to use this string, with a
2692         pointer value serialized into it, outside of debugging.
2693         * platform/graphics/FloatPolygon.h: Updated for the above.
2694
2695         * platform/graphics/ca/GraphicsLayerCA.cpp:
2696         (WebCore::GraphicsLayerCA::setName): Use makeString instead of String::format.
2697         (WebCore::GraphicsLayerCA::recursiveCommitChanges): DItto.
2698         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2699         (WebCore::MediaPlayerPrivateGStreamer::load): Ditto.
2700         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Ditto.
2701         * platform/gtk/PlatformKeyboardEventGtk.cpp:
2702         (WebCore::PlatformKeyboardEvent::keyIdentifierForGdkKeyCode): Ditto.
2703         * platform/libwpe/PlatformKeyboardEventLibWPE.cpp:
2704         (WebCore::PlatformKeyboardEvent::keyIdentifierForWPEKeyCode): Ditto.
2705         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
2706         (WebCore::GStreamerVideoEncoder::makeElement): Ditto.
2707         (WebCore::GStreamerVideoEncoder::InitEncode): Ditto.
2708
2709         * platform/text/TextCodecLatin1.cpp: Removed unneeded include of StringBuffer.h
2710         and "using namespace WTF".
2711
2712         * platform/win/GDIObjectCounter.cpp:
2713         (WebCore::GDIObjectCounter::GDIObjectCounter): Use makeString instead of String::format.
2714         * platform/win/KeyEventWin.cpp:
2715         (WebCore::keyIdentifierForWindowsKeyCode): Ditto.
2716
2717         * rendering/FloatingObjects.cpp:
2718         (WebCore::FloatingObject::debugString const): Added. Moved string conversion here
2719         from the header and use makeString instead of String::format. Also use
2720         the word "debug" to make it clear that it's not OK to use this string, with a
2721         pointer value serialized into it, outside of debugging.
2722         * rendering/FloatingObjects.h: Updated for the above.
2723
2724         * rendering/RenderFragmentContainer.cpp:
2725         (WebCore::RenderFragmentContainer::debugString const): Added. Moved string
2726         conversion here from the header and use makeString instead of String::format.
2727         Also use the word "debug" to make it clear that it's not OK to use this string,
2728         with a pointer value serialized into it, outside of debugging.
2729         * rendering/RenderFragmentContainer.h: Updated for the above.
2730         * rendering/RenderFragmentedFlow.h: Ditto.
2731
2732         * testing/Internals.cpp:
2733         (WebCore::Internals::address): Use makeString instead of String::format.
2734
2735 2019-02-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2736
2737         [iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements
2738         https://bugs.webkit.org/show_bug.cgi?id=194670
2739         <rdar://problem/39066529>
2740
2741         Reviewed by Tim Horton.
2742
2743         Adds support for pasting files on the pasteboard as attachment elements, if the attachment element runtime
2744         switch is enabled. Currently, the only types of data that can be pasted as attachments are images, which take a
2745         special codepath in WebContentReader::readImage.
2746
2747         This patch adds a readDataBuffer method that converts a given blob of data from the pasteboard into an
2748         attachment-element-backed representation in the DOM (i.e. either an attachment element or image element that
2749         contains an attachment element). In the case where the given pasteboard item has been explicitly marked as an
2750         attachment (via the preferredPresentationStyle hint) and the item has at least one type representation that
2751         conforms to "public.content", we take this codepath instead of first attempting the web content reading types
2752         supported by default in WebKit.
2753
2754         See below for more detail.
2755
2756         Test: WKAttachmentTestsIOS.InsertPastedFilesAsAttachments
2757
2758         * editing/Editor.cpp:
2759         (WebCore::Editor::clientReplacementURLForResource): Deleted.
2760         * editing/Editor.h:
2761         * editing/WebContentReader.h:
2762         * editing/cocoa/WebContentReaderCocoa.mm:
2763         (WebCore::mimeTypeFromContentType):
2764         (WebCore::contentTypeIsSuitableForInlineImageRepresentation):
2765         (WebCore::createFragmentAndAddResources):
2766         (WebCore::sanitizeMarkupWithArchive):
2767
2768         Remove all logic for handling subresource URL replacement. See WebKit ChangeLog for more details on this.
2769
2770         (WebCore::WebContentReader::readImage):
2771         (WebCore::attachmentForFilePath):
2772         (WebCore::attachmentForData):
2773
2774         Add a helper that creates an attachment element for a given blob of data and content type. The logic here is
2775         quite similar to that of attachmentForFilePath, and we should find a way to either merge them, or pull out more
2776         of their similarities into helper functions.
2777
2778         (WebCore::WebContentReader::readDataBuffer):
2779         (WebCore::replaceSubresourceURLsWithURLsFromClient): Deleted.
2780
2781         Remove more logic for handling subresource URL replacement. See WebKit ChangeLog for more details on this.
2782
2783         * loader/EmptyClients.cpp:
2784         * page/EditorClient.h:
2785         * platform/Pasteboard.h:
2786         * platform/PasteboardItemInfo.h:
2787         (WebCore::PasteboardItemInfo::contentTypeForHighestFidelityItem const):
2788         (WebCore::PasteboardItemInfo::pathForHighestFidelityItem const):
2789         (WebCore::PasteboardItemInfo::encode const):
2790         (WebCore::PasteboardItemInfo::decode):
2791
2792         Add contentTypesByFidelity to PasteboardItemInfo, instead of requesting this information using a separate IPC
2793         message. This means we can also remove getTypesByFidelityForItemAtIndex, and just use the item's types in
2794         fidelity order instead.
2795
2796         * platform/PasteboardStrategy.h:
2797         * platform/PlatformPasteboard.h:
2798         * platform/ios/AbstractPasteboard.h:
2799         * platform/ios/PasteboardIOS.mm:
2800         (WebCore::Pasteboard::read):
2801
2802         Shave off (potentially many) sync IPC messages to the UI process by pulling each call to
2803         informationForItemAtIndex out of the inner loop when reading web content.
2804
2805         (WebCore::Pasteboard::readRespectingUTIFidelities):
2806
2807         Shave off one extraneous sync IPC message by rolling the types in fidelity order into the request for
2808         PasteboardItemInfo, instead of being sent in a separate message.
2809
2810         * platform/ios/PlatformPasteboardIOS.mm:
2811         (WebCore::PlatformPasteboard::informationForItemAtIndex):
2812
2813         Populate contentTypesForFileUpload in the case where UIPasteboard is used (i.e. copy and paste).
2814
2815         (WebCore::PlatformPasteboard::getTypesByFidelityForItemAtIndex): Deleted.
2816         * platform/ios/WebItemProviderPasteboard.h:
2817         * platform/ios/WebItemProviderPasteboard.mm:
2818         (-[WebItemProviderPasteboard pasteboardTypesByFidelityForItemAtIndex:]): Deleted.
2819
2820 2019-02-18  Daniel Bates  <dabates@apple.com>
2821
2822         Clean up and modernize RenderThemeIOS::paintCheckboxDecorations()
2823         https://bugs.webkit.org/show_bug.cgi?id=194785
2824
2825         Reviewed by Simon Fraser.
2826
2827         Change from early return to else-clause to make the states clearer and make it more straightforward
2828         to share more common code. Use constexpr, allocate temporary vectors with inline capacity, and
2829         switch to uniform initializer syntax.
2830
2831         * rendering/RenderThemeIOS.mm:
2832         (WebCore::RenderThemeIOS::paintCheckboxDecorations):
2833
2834 2019-02-18  Daniel Bates  <dabates@apple.com>
2835
2836         [iOS] Focus ring for checkboxes, radio buttons, buttons and search fields should hug tighter to the contour
2837         https://bugs.webkit.org/show_bug.cgi?id=193599
2838         <rdar://problem/47399602>
2839
2840         Reviewed by Simon Fraser.
2841
2842         For now, iOS uses a 3px outline width for its focus rings. Do not inset the focus ring on iOS
2843         for text fields, textareas, keygens, and selects so as to match the visual appearance of all
2844         the other controls.
2845
2846         Tests: fast/forms/ios/focus-button.html
2847                fast/forms/ios/focus-checkbox.html
2848                fast/forms/ios/focus-checked-checkbox.html
2849                fast/forms/ios/focus-checked-radio.html
2850                fast/forms/ios/focus-radio.html
2851                fast/forms/ios/focus-reset-button.html
2852                fast/forms/ios/focus-search-field.html
2853                fast/forms/ios/focus-submit-button.html
2854                fast/forms/ios/focus-text-field.html
2855                fast/forms/ios/focus-textarea.html
2856
2857         * css/html.css:
2858         (:focus): Use 3px outline width.
2859         (input:focus, textarea:focus, keygen:focus, select:focus): Guard this code to exclude it when building for iOS.
2860         * rendering/RenderBox.cpp:
2861         (WebCore::RenderBox::paintBoxDecorations): Add FIXME comment.
2862         * rendering/RenderElement.cpp:
2863         (WebCore::RenderElement::paintOutline): Call RenderTheme::adjustPaintRect() to adjust the paint rect.
2864         Otherwise, the focus rings for radios and checkboxes are drawn at the wrong y-coordinate and are not snug.
2865
2866 2019-02-18  Oriol Brufau  <obrufau@igalia.com>
2867
2868         [css-grid] Handle indefinite percentages in fit-content()
2869         https://bugs.webkit.org/show_bug.cgi?id=194509
2870
2871         Reviewed by Javier Fernandez.
2872
2873         Test: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-fit-content-percentage.html
2874
2875         If the size of the grid container depends on the size of its tracks,
2876         a percentage in fit-content() is indefinite. Without this patch, some
2877         places treated this case as fit-content(0), which prevented the grid
2878         container from growing enough to contain the max-content contribution
2879         of its grid items.
2880
2881         This patch treats such fit-content() as minmax(auto, max-content),
2882         but once the size of the grid container is known and it is laid out
2883         "for real", then the percentage is definite and it's used.
2884
2885         * rendering/GridTrackSizingAlgorithm.cpp:
2886         (WebCore::GridTrackSizingAlgorithm::gridTrackSize const):
2887         (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):
2888
2889 2019-02-18  John Wilander  <wilander@apple.com>
2890
2891         Check the existence of the frame in Document::hasFrameSpecificStorageAccess() and Document::setHasFrameSpecificStorageAccess()
2892         https://bugs.webkit.org/show_bug.cgi?id=194777
2893         <rdar://problem/47731945>
2894
2895         Reviewed by Geoffrey Garen and Chris Dumez.
2896
2897         Test: http/tests/storageAccess/remove-requesting-iframe.html
2898
2899         * dom/Document.cpp:
2900         (WebCore::Document::hasFrameSpecificStorageAccess const):
2901             Now checks for the existence of the frame.
2902         (WebCore::Document::setHasFrameSpecificStorageAccess):
2903             Now checks for the existence of the frame.
2904         * loader/ResourceLoadObserver.cpp:
2905         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2906             Now checks that the session ID is valid.
2907
2908 2019-02-18  Jer Noble  <jer.noble@apple.com>
2909
2910         -[AVSampleBufferDisplayLayer player]: Unrecognized selector crash
2911         https://bugs.webkit.org/show_bug.cgi?id=194790
2912         <rdar://problem/33866742>
2913
2914         Reviewed by Jon Lee.
2915
2916         Ensure that a WebVideoContainerLayer's sole sublayer is actually an AVPlayerLayer (and not
2917         an AVSampleBufferDisplayLayer) before reporting that the layer type is LayerTypeAVPlayerLayer.
2918
2919         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2920         (WebCore::PlatformCALayerCocoa::layerTypeForPlatformLayer):
2921
2922 2019-02-18  Joseph Pecoraro  <pecoraro@apple.com>
2923
2924         Web Inspector: Better categorize CPU usage per-thread / worker
2925         https://bugs.webkit.org/show_bug.cgi?id=194564
2926
2927         Reviewed by Devin Rousso.
2928
2929         Test: inspector/cpu-profiler/threads.html
2930
2931         * workers/WorkerThread.cpp:
2932         (WebCore::WorkerThread::workerThreadsMutex):
2933         (WebCore::WorkerThread::workerThreadCount):
2934         (WebCore::WorkerThread::WorkerThread):
2935         (WebCore::WorkerThread::~WorkerThread):
2936         (WebCore::WorkerThread::workerThread):
2937         (WebCore::WorkerThread::releaseFastMallocFreeMemoryInAllThreads):
2938         * workers/WorkerThread.h:
2939         (WebCore::WorkerThread::identifier const):
2940         Expose the set of all WorkerThreads.
2941
2942         * inspector/agents/InspectorCPUProfilerAgent.cpp:
2943         (WebCore::InspectorCPUProfilerAgent::collectSample):
2944         Send inspector additional per-thread data.
2945
2946         * page/ResourceUsageData.h:
2947         (WebCore::WorkerCPUInfo::WorkerCPUInfo):
2948         * page/cocoa/ResourceUsageThreadCocoa.mm:
2949         (WebCore::ThreadInfo::ThreadInfo):
2950         (WebCore::threadInfos):
2951         (WebCore::ResourceUsageThread::platformCollectCPUData):
2952         (WebCore::threadSendRights): Deleted.
2953         (WebCore::cpuUsage): Deleted.
2954         Compute per-thread values on cocoa ports.
2955
2956         * page/linux/ResourceUsageThreadLinux.cpp:
2957         (WebCore::ResourceUsageThread::platformCollectCPUData):
2958         Stub per-thread values on linux ports.
2959
2960 2019-02-18  Jer Noble  <jer.noble@apple.com>
2961
2962         Uncaught Exception crash in MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeControlStatus()
2963         https://bugs.webkit.org/show_bug.cgi?id=194786
2964
2965         Reviewed by Eric Carlson.
2966
2967         Convert a runtime crash to a debug assert by wrapping the call to -[AVPlayer removeObserver:forKeyPath:]
2968         in an exception handler.
2969
2970         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2971         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeControlStatus):
2972
2973 2019-02-18  Daniel Bates  <dabates@apple.com>
2974
2975         [iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element
2976         https://bugs.webkit.org/show_bug.cgi?id=192824
2977         <rdar://problem/47100332>
2978
2979         Reviewed by Wenson Hsieh.
2980
2981         When building with USE(UIKIT_KEYBOARD_ADDITIONS) enabled, normalize input strings for some more key codes
2982         now that hardware key events to non-editable elements use the same code path as for editable elements. 
2983
2984         * platform/ios/KeyEventIOS.mm:
2985         (WebCore::windowsKeyCodeForCharCode): Demarcate mappings that are only needed when building with
2986         !USE(UIKIT_KEYBOARD_ADDITIONS) in the hope that one day we can remove this code.
2987         (WebCore::isFunctionKey): Ditto.
2988         * platform/ios/WebEvent.mm:
2989         (normalizedStringWithAppKitCompatibilityMapping): Normalize some more input strings when building with
2990         USE(UIKIT_KEYBOARD_ADDITIONS) enabled.
2991
2992 2019-02-18  Eric Carlson  <eric.carlson@apple.com>
2993
2994         Add MSE logging configuration
2995         https://bugs.webkit.org/show_bug.cgi?id=194719
2996         <rdar://problem/48122151>
2997
2998         Reviewed by Joseph Pecoraro.
2999
3000         No new tests, updated inspector/console/webcore-logging.html.
3001
3002         * dom/Document.cpp:
3003         (WebCore::messageSourceForWTFLogChannel): Recognize the MSE logging channel.
3004
3005         * inspector/agents/WebConsoleAgent.cpp:
3006         (WebCore::WebConsoleAgent::getLoggingChannels): Ditto.
3007
3008 2019-02-18  Antoine Quint  <graouts@apple.com>
3009
3010         [iOS] Dispatch additional events along with pointerdown and pointerup
3011         https://bugs.webkit.org/show_bug.cgi?id=194776
3012         <rdar://problem/48164284>
3013
3014         Reviewed by Brent Fulgham.
3015
3016         The Pointer Events specification mandates that "pointerover" and "pointerenter" events precede a "pointerdown" event and that "pointerout"
3017         and "pointerleave" events follow a "pointerup" event. We remove the EventHandler::dispatchPointerEventForTouchAtIndex() method and replace
3018         it with a PointerCaptureController::dispatchEventForTouchAtIndex() that can handle the dispatch of such additional events correctly, also
3019         allowing for two PointerCaptureController methods (pointerEventWillBeDispatched and pointerEventWasDispatched) to become private.
3020
3021         Test: pointerevents/ios/over-enter-out-leave.html
3022
3023         * dom/EventNames.h: Add the new "pointerover", "pointerenter", "pointerout" and "pointerleave" event types.
3024         * dom/PointerEvent.h:
3025         * dom/ios/PointerEventIOS.cpp:
3026         (WebCore::PointerEvent::create):
3027         * page/EventHandler.cpp:
3028         (WebCore::EventHandler::dispatchPointerEventForTouchAtIndex): Deleted.
3029         * page/EventHandler.h:
3030         * page/PointerCaptureController.cpp:
3031         (WebCore::PointerCaptureController::dispatchEventForTouchAtIndex): Take the existing code from EventHandler::dispatchPointerEventForTouchAtIndex()
3032         and extend it to dispatch additional events as mandated. Since several events may be dispatched we check whether the dispatch of any of those events
3033         had defaultPrevented() or defaultHanded() return true and return those values as a pair.
3034         (WebCore::PointerCaptureController::pointerEventWasDispatched):
3035         * page/PointerCaptureController.h:
3036
3037 2019-02-18  Sihui Liu  <sihui_liu@apple.com>
3038
3039         IndexedDB: leak IDBDatabase and IDBTransacstion in layout tests
3040         https://bugs.webkit.org/show_bug.cgi?id=194709
3041
3042         Reviewed by Geoffrey Garen.
3043
3044         When connection to IDB server is closed, IDBTransaction would abort without notifying IDBDatabase, so 
3045         IDBDatabase didn't clear its reference to IDBTransaction which created a reference cycle. 
3046
3047         Also IDBTransaction didn't clear its reference to IDBRequest in this case and it led to another reference cycle
3048         between IDBOpenDBRequest and IDBTransaction.
3049
3050         Test: storage/indexeddb/IDBObject-leak.html
3051
3052         * Modules/indexeddb/IDBDatabase.cpp:
3053         (WebCore::IDBDatabase::connectionToServerLost):
3054         * Modules/indexeddb/IDBTransaction.cpp:
3055         (WebCore::IDBTransaction::IDBTransaction):
3056         (WebCore::IDBTransaction::~IDBTransaction):
3057         (WebCore::IDBTransaction::finishedDispatchEventForRequest):
3058         (WebCore::IDBTransaction::connectionClosedFromServer):
3059         * Modules/indexeddb/IDBTransaction.h:
3060         * testing/Internals.cpp:
3061         (WebCore::Internals::numberOfIDBTransactions const):
3062         * testing/Internals.h:
3063         * testing/Internals.idl:
3064
3065 2019-02-18  Chris Fleizach  <cfleizach@apple.com>
3066
3067         AX: PSON: Going back from apple.com to search results, cannot interact with HTML content. Disabling Swap Processes on Cross-Site Navigation resolves the issue.
3068         https://bugs.webkit.org/show_bug.cgi?id=194742
3069
3070         Reviewed by Chris Dumez.
3071
3072         With the new process model, WebProcess hits a case where it tries to send the "page loaded" notification before VoiceOver
3073         had a chance to register for any notifications. This leads to those notifications being dropped (and thus this bug).
3074
3075         This change instead asks the UIProcess to send the notification, which we know VoiceOver has registered for, and can reliably
3076         receive notifications.
3077
3078         It also sends the notification for "load failures," which to the VO users' perspective amounts to the same thing as a successful
3079         page load.
3080
3081         * accessibility/mac/AXObjectCacheMac.mm:
3082         (WebCore::AXObjectCache::frameLoadingEventPlatformNotification):
3083
3084 2019-02-18  Megan Gardner  <megan_gardner@apple.com>
3085
3086         Turn On Smart Delete
3087         https://bugs.webkit.org/show_bug.cgi?id=194320
3088
3089         Reviewed by Ryosuke Niwa.
3090
3091         Updated the following tests to work with iOS:
3092         * editing/deleting/smart-delete-001.html:
3093         * editing/deleting/smart-delete-002.html:
3094         * editing/deleting/smart-delete-003.html:
3095         * editing/deleting/smart-delete-004.html:
3096         * editing/deleting/smart-delete-across-editable-boundaries-2.html:
3097         * editing/selection/delete-word-granularity-text-control.html:
3098
3099         Turn on Smart delete for iOS at all times. Modify checks to allow Mac and iOS and other 
3100         platforms to turn on smart delete when desired.
3101
3102         * editing/Editor.cpp:
3103         (WebCore::Editor::shouldSmartDelete):
3104         Allow platfroms to determine if smart delete should be on.
3105         On mac, this is via word granularity, on iOS this is just on all the time.
3106         (WebCore::Editor::canSmartCopyOrDelete):
3107         (WebCore::Editor::performCutOrCopy):
3108         * editing/Editor.h:
3109         * editing/EditorCommand.cpp:
3110         (WebCore::executeDelete):
3111         * editing/ios/EditorIOS.mm:
3112         (WebCore::Editor::shouldSmartDelete):
3113         * editing/mac/EditorMac.mm:
3114         (WebCore::Editor::shouldSmartDelete):
3115
3116 2019-02-17  David Kilzer  <ddkilzer@apple.com>
3117
3118         Unreviewed, rolling out r241620.
3119
3120         "Causes use-after-free crashes running layout tests with ASan and GuardMalloc."
3121         (Requested by ddkilzer on #webkit.)
3122
3123         Reverted changeset:
3124
3125         "[WTF] Add environment variable helpers"
3126         https://bugs.webkit.org/show_bug.cgi?id=192405
3127         https://trac.webkit.org/changeset/241620
3128
3129 2019-02-16  Zalan Bujtas  <zalan@apple.com>
3130
3131         [LFC] RenderImage's default intrinsic size is 0.
3132         https://bugs.webkit.org/show_bug.cgi?id=194745
3133
3134         Reviewed by Antti Koivisto.
3135
3136         While the images are being loaded, their intrinsic size is set to 0 (RenderImage c'tor). Note that this code is temporary.
3137         * layout/layouttree/LayoutTreeBuilder.cpp:
3138         (WebCore::Layout::TreeBuilder::createSubTree):
3139
3140 2019-02-16  Zalan Bujtas  <zalan@apple.com>
3141
3142         [LFC][BFC] Add support for block replaced intrinsic width.
3143         https://bugs.webkit.org/show_bug.cgi?id=194705
3144
3145         Reviewed by Simon Fraser.
3146
3147         Replaced boxes should report their intrinsic width as preferred widths.
3148
3149         Test: fast/block/block-only/replaced-intrinsic-width-simple.html
3150
3151         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3152         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
3153
3154 2019-02-16  Zalan Bujtas  <zalan@apple.com>
3155
3156         [LFC] Apply min/max width constraints to preferred width computation
3157         https://bugs.webkit.org/show_bug.cgi?id=194739
3158
3159         Reviewed by Simon Fraser.
3160
3161         Ensure that both min-height and max-height are taken into account while computing the preferred width.
3162
3163         Test: fast/block/block-only/min-max-and-preferred-width-simple.html
3164
3165         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3166         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
3167
3168 2019-02-15  Yusuke Suzuki  <ysuzuki@apple.com>
3169
3170         [JSC] Make builtin objects more lazily initialized under non-JIT mode
3171         https://bugs.webkit.org/show_bug.cgi?id=194727
3172
3173         Reviewed by Saam Barati.
3174
3175         * Modules/streams/ReadableByteStreamInternals.js:
3176         (privateInitializeReadableByteStreamController):
3177         (readableByteStreamControllerRespond):
3178
3179 2019-02-15  Dean Jackson  <dino@apple.com>
3180
3181         Allow emulation of user gestures from Web Inspector console
3182         https://bugs.webkit.org/show_bug.cgi?id=194725
3183         <rdar://problem/48126604>
3184
3185         Reviewed by Joseph Pecoraro and Devin Rousso.
3186
3187         Test: inspector/runtime/evaluate-userGestureEmulation.html
3188
3189         * inspector/agents/page/PageRuntimeAgent.cpp: Override the emulate method and create
3190         a UserGestureIndicator based on the emulateUserGesture option.
3191         (WebCore::PageRuntimeAgent::evaluate):
3192         * inspector/agents/page/PageRuntimeAgent.h:
3193
3194 2019-02-15  Chris Dumez  <cdumez@apple.com>
3195
3196         Sample domainsVisited diagnostic logging
3197         https://bugs.webkit.org/show_bug.cgi?id=194657
3198
3199         Reviewed by Ryosuke Niwa.
3200
3201         Sample domainsVisited diagnostic logging, we are getting a lot of data from
3202         this key and this is hurting our other keys.
3203
3204         * page/Page.cpp:
3205         (WebCore::Page::logNavigation):
3206
3207 2019-02-15  Ryosuke Niwa  <rniwa@webkit.org>
3208
3209         Crash in the hit testing code via HTMLPlugInElement::isReplacementObscured()
3210         https://bugs.webkit.org/show_bug.cgi?id=194691
3211
3212         Reviewed by Simon Fraser.
3213
3214         The crash was caused by HTMLPlugInElement::isReplacementObscured updating the document
3215         without updating the layout of ancestor documents (i.e. documents in which frame owner
3216         elements appear) even though it hit-tests against the top-level document's RenderView.
3217
3218         Fixed the bug by updating the layout of the top-level document as needed.
3219
3220         Test: plugins/unsupported-plugin-with-replacement-in-iframe-crash.html
3221
3222         * html/HTMLPlugInElement.cpp:
3223         (WebCore::HTMLPlugInElement::isReplacementObscured):
3224
3225 2019-02-15  Ross Kirsling  <ross.kirsling@sony.com>
3226
3227         [WTF] Add environment variable helpers
3228         https://bugs.webkit.org/show_bug.cgi?id=192405
3229
3230         Reviewed by Michael Catanzaro.
3231
3232         * platform/NotImplemented.h:
3233         * platform/cocoa/SystemVersion.mm:
3234         (WebCore::createSystemMarketingVersion):
3235         * platform/graphics/gstreamer/GStreamerCommon.cpp:
3236         (WebCore::initializeGStreamer):
3237         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3238         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
3239         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
3240         (Nicosia::PaintingEngine::create):
3241         * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
3242         (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
3243         * platform/graphics/x11/PlatformDisplayX11.cpp:
3244         (WebCore::PlatformDisplayX11::create):
3245         * platform/gtk/RenderThemeWidget.cpp:
3246         (WebCore::RenderThemeScrollbar::RenderThemeScrollbar):
3247         * platform/gtk/ScrollbarThemeGtk.cpp:
3248         (WebCore::ScrollbarThemeGtk::ScrollbarThemeGtk):
3249         * platform/network/curl/CurlContext.cpp:
3250         (WebCore::CurlContext::CurlContext):
3251         (WebCore::EnvironmentVariableReader::read): Deleted.
3252         (WebCore::EnvironmentVariableReader::defined): Deleted.
3253         (WebCore::EnvironmentVariableReader::readAs): Deleted.
3254         (WebCore::EnvironmentVariableReader::sscanTemplate): Deleted.
3255         (WebCore::EnvironmentVariableReader::sscanTemplate<signed>): Deleted.
3256         (WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>): Deleted.
3257         * platform/network/curl/NetworkStorageSessionCurl.cpp:
3258         (WebCore::defaultCookieJarPath):
3259         * platform/network/playstation/CurlSSLHandlePlayStation.cpp:
3260         (WebCore::getCACertPathEnv):
3261         * platform/network/win/CurlSSLHandleWin.cpp:
3262         (WebCore::getCACertPathEnv):
3263         * platform/text/hyphen/HyphenationLibHyphen.cpp:
3264         (WebCore::topLevelPath):
3265         (WebCore::webkitBuildDirectory):
3266         * platform/unix/LoggingUnix.cpp:
3267         (WebCore::logLevelString):
3268         * platform/win/LoggingWin.cpp:
3269         (WebCore::logLevelString):
3270         Utilize WTF::Environment where possible.
3271
3272 2019-02-15  Antoine Quint  <graouts@apple.com>
3273
3274         Add a method to dispatch a PointerEvent based on a PlatformTouchEvent
3275         https://bugs.webkit.org/show_bug.cgi?id=194702
3276         <rdar://problem/48109355>
3277
3278         Reviewed by Dean Jackson.
3279
3280         * page/EventHandler.cpp:
3281         (WebCore::EventHandler::dispatchPointerEventForTouchAtIndex):
3282         * page/EventHandler.h:
3283
3284 2019-02-15  Per Arne Vollan  <pvollan@apple.com>
3285
3286         [WebVTT] Inline WebVTT styles should start with '::cue'
3287         https://bugs.webkit.org/show_bug.cgi?id=194227
3288
3289         Reviewed by Eric Carlson.
3290
3291         The original fix in r241203 is not sufficient, since it only checks if the CSS string starts
3292         with '::cue'. Before accepting a CSS string from a WebVTT file, it should be checked that
3293         all selectors starts with '::cue'.
3294
3295         Test: media/track/track-cue-css.html
3296
3297         * html/track/WebVTTParser.cpp:
3298         (WebCore::WebVTTParser::checkAndStoreStyleSheet):
3299
3300 2019-02-15  Youenn Fablet  <youenn@apple.com>
3301
3302         Add binding tests for ContextAllowsMediaDevices and ContextHasServiceWorkerScheme
3303         https://bugs.webkit.org/show_bug.cgi?id=194713
3304
3305         Reviewed by Eric Carlson.
3306
3307         Binding tests covering mediaDevices and serviceWorker attributes.
3308
3309         * bindings/scripts/test/JS/JSTestObj.cpp:
3310         (WebCore::JSTestObjPrototype::finishCreation):
3311         (WebCore::jsTestObjMediaDevices1Getter):
3312         (WebCore::jsTestObjMediaDevices1):
3313         (WebCore::jsTestObjMediaDevices2Getter):
3314         (WebCore::jsTestObjMediaDevices2):
3315         (WebCore::jsTestObjServiceWorkers1Getter):
3316         (WebCore::jsTestObjServiceWorkers1):
3317         (WebCore::jsTestObjServiceWorkers2Getter):
3318         (WebCore::jsTestObjServiceWorkers2):
3319         * bindings/scripts/test/TestObj.idl:
3320
3321 2019-02-15  Beth Dakin  <bdakin@apple.com>
3322
3323         Build fix.
3324
3325         * rendering/RenderThemeIOS.mm:
3326         (WebCore::iconForAttachment):
3327
3328 2019-02-15  Youenn Fablet  <youenn@apple.com>
3329
3330         Make ServiceWorkerClientFetch closer to WebResourceLoader
3331         https://bugs.webkit.org/show_bug.cgi?id=194651
3332
3333         Reviewed by Alex Christensen.
3334
3335         Check for redirection response and if so call a specific client API.
3336         Ensure ServiceWorkerFetch::Client gets called in the service worker thread proxy
3337         so that its m_connection is only accessed on that thread.
3338
3339         Covered by existing tests.
3340
3341         * platform/network/FormData.h:
3342         * platform/network/ResourceErrorBase.h:
3343         * workers/service/context/ServiceWorkerFetch.cpp:
3344         (WebCore::ServiceWorkerFetch::processResponse):
3345         * workers/service/context/ServiceWorkerFetch.h:
3346         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3347         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
3348         (WebCore::ServiceWorkerThreadProxy::continueDidReceiveFetchResponse):
3349         * workers/service/context/ServiceWorkerThreadProxy.h:
3350
3351 2019-02-15  Youenn Fablet  <youenn@apple.com>
3352
3353         Make navigator.mediaDevices SecureContext
3354         https://bugs.webkit.org/show_bug.cgi?id=194666
3355
3356         Reviewed by Eric Carlson.
3357
3358         Make navigator.mediaDevices SecureContext.
3359         This can still be enabled for unsecure context using the existing page settings.
3360         To cover that case, introduce ContextHasMediaDevices custom IDL keyword.
3361
3362         Covered by API test.
3363
3364         * Modules/mediastream/NavigatorMediaDevices.idl:
3365         * bindings/scripts/CodeGeneratorJS.pm:
3366         (GenerateRuntimeEnableConditionalString):
3367         * bindings/scripts/IDLAttributes.json:
3368         * dom/ScriptExecutionContext.cpp:
3369         (WebCore::ScriptExecutionContext::hasMediaDevices const):
3370         (WebCore::ScriptExecutionContext::hasServiceWorkerScheme const):
3371         * dom/ScriptExecutionContext.h:
3372
3373 2019-02-15  Youenn Fablet  <youenn@apple.com>
3374
3375         WebSocket should not fire events after being stopped
3376         https://bugs.webkit.org/show_bug.cgi?id=194690
3377
3378         Reviewed by Geoffrey Garen.
3379
3380         dispatchOrQueueErrorEvent is scheduled using RunLoop::main().dispatch or dispatch_async.
3381         This makes it possible to dispatch an event while WebSocket is already stopped.
3382         Instead, use Document::postTask so that the task is only executed if WebSocket is not stopped.
3383
3384         As a refactoring, make use of PendingActivity to keep track of setPendingActivity/unsetPendingActivity more easily.
3385
3386         * Modules/websockets/WebSocket.cpp:
3387         (WebCore::WebSocket::stop):
3388         (WebCore::WebSocket::connect):
3389         * Modules/websockets/WebSocket.h:
3390
3391 2019-02-15  Youenn Fablet  <youenn@apple.com>
3392
3393         Performance should not fire events when its context is stopped
3394         https://bugs.webkit.org/show_bug.cgi?id=194689
3395
3396         Reviewed by Alex Christensen.
3397
3398         Stop the timer when its context is destroyed.
3399         Add an assertion to ensure the timer does not fire after context is destroyed.
3400
3401         * page/Performance.cpp:
3402         (WebCore::Performance::stop):
3403
3404 2019-02-15  Alex Christensen  <achristensen@webkit.org>
3405
3406         REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
3407         https://bugs.webkit.org/show_bug.cgi?id=194523
3408
3409         Reviewed by Geoffrey Garen.
3410
3411         The scope of the FormCreationContext was limited to the scope of createHTTPBodyCFReadStream,
3412         so when it was used in formCreate it was lucky to get the same context if the stack hadn't been overwritten
3413         and if the FormData hadn't been freed.  Instead, keep it alive with new/delete like we do the FormStreamFields.
3414         A younger me should've noticed this when reviewing r218517.
3415
3416         * platform/network/cf/FormDataStreamCFNet.cpp:
3417         (WebCore::formCreate):
3418         (WebCore::createHTTPBodyCFReadStream):
3419
3420 2019-02-15  Commit Queue  <commit-queue@webkit.org>
3421
3422         Unreviewed, rolling out r241559 and r241566.
3423         https://bugs.webkit.org/show_bug.cgi?id=194710
3424
3425         Causes layout test crashes under GuardMalloc (Requested by
3426         ryanhaddad on #webkit).
3427
3428         Reverted changesets:
3429
3430         "[WTF] Add environment variable helpers"
3431         https://bugs.webkit.org/show_bug.cgi?id=192405
3432         https://trac.webkit.org/changeset/241559
3433
3434         "Unreviewed build fix for WinCairo Debug after r241559."
3435         https://trac.webkit.org/changeset/241566
3436
3437 2019-02-15  Youenn Fablet  <youenn@apple.com>
3438
3439         Stop the endpoint synchronously in RTCPeerConnection::close
3440         https://bugs.webkit.org/show_bug.cgi?id=194688
3441
3442         Reviewed by Eric Carlson.
3443
3444         In the case where the peer connection is being closed, it was asynchronously stopping the endpoint.
3445         But the endpoint, before being stopped, could try to fire an event.
3446         If the context is gone in between, we end up with a null pointer dereference.
3447
3448         * Modules/mediastream/RTCPeerConnection.cpp:
3449         (WebCore::RTCPeerConnection::close):
3450
3451 2019-02-15  Zalan Bujtas  <zalan@apple.com>
3452
3453         [LFC] Out-of-flow box is never a float box
3454         https://bugs.webkit.org/show_bug.cgi?id=194704
3455
3456         Reviewed by Antti Koivisto.
3457
3458         We can't have it both ways. Absolute positioning wins.
3459
3460         Test: fast/block/block-only/out-of-flow-is-never-float-box.html
3461
3462         * layout/layouttree/LayoutBox.cpp:
3463         (WebCore::Layout::Box::isFloatingPositioned const):
3464         (WebCore::Layout::Box::isLeftFloatingPositioned const):
3465         (WebCore::Layout::Box::isRightFloatingPositioned const):
3466
3467 2019-02-15  Philippe Normand  <pnormand@igalia.com>
3468
3469         [GStreamer] Simplify GObject class name check
3470         https://bugs.webkit.org/show_bug.cgi?id=194537
3471
3472         Reviewed by Michael Catanzaro.
3473
3474         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3475         (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback):
3476         Use G_OBJECT_TYPE_NAME() to filter out uridecodebin child
3477         elements.
3478
3479 2019-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>
3480
3481         Refactor EditingStyle::textDirection to return an Optional<WritingDirection> instead of a bool
3482         https://bugs.webkit.org/show_bug.cgi?id=194686
3483
3484         Reviewed by Ryosuke Niwa.
3485
3486         Changes EditingStyle::textDirection to return an Optional<WritingDirection>, instead of taking a reference to
3487         the resulting WritingDirection. No change in behavior.
3488
3489         * editing/ApplyStyleCommand.cpp:
3490         (WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi):
3491         (WebCore::ApplyStyleCommand::applyInlineStyle):
3492         * editing/EditingStyle.cpp:
3493         (WebCore::EditingStyle::textDirection const):
3494         (WebCore::EditingStyle::textDirectionForSelection):
3495         * editing/EditingStyle.h:
3496
3497 2019-02-10  Darin Adler  <darin@apple.com>
3498
3499         Replace more uses of String::format with StringConcatenate (mostly non-Apple platform-specific cases)
3500         https://bugs.webkit.org/show_bug.cgi?id=194487
3501
3502         Reviewed by Daniel Bates.
3503
3504         * accessibility/win/AccessibilityObjectWrapperWin.cpp:
3505         (WebCore::AccessibilityObjectWrapper::accessibilityAttributeValue): Use makeString
3506         instead of String::format.
3507
3508         * page/linux/ResourceUsageOverlayLinux.cpp:
3509         (WebCore::formatByteNumber): Use String::number instead of String::format.
3510
3511         * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
3512         (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
3513         Use makeString instead of String::format.
3514         * platform/glib/UserAgentGLib.cpp:
3515         (WebCore::platformVersionForUAString): Ditto.
3516         * platform/graphics/gstreamer/GStreamerCommon.cpp:
3517         (WebCore::simpleBusMessageCallback): Ditto.
3518         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3519         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Ditto.
3520         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3521         (WebCore::AppendPipeline::AppendPipeline): Ditto.
3522         (WebCore::AppendPipeline::handleStateChangeMessage): Ditto.
3523         (WebCore::AppendPipeline::resetParserState): Ditto.
3524         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3525         (WebCore::MediaPlayerPrivateGStreamerMSE::load): Ditto.
3526         (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek): Ditto.
3527
3528         * platform/graphics/gtk/ImageBufferGtk.cpp:
3529         (WebCore::encodeImage): Use String::number instead of String::format.
3530
3531         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
3532         (WebCore::GStreamerAudioCaptureSource::create): Use makeString instead of
3533         String::format.
3534         * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:
3535         (WebCore::GStreamerCaptureDeviceManager::addDevice): Ditto.
3536         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
3537         (WebCore::webkitMediaStreamSrcAddPad): Ditto.
3538         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
3539         (WebCore::GStreamerVideoCaptureSource::create): Ditto.
3540         * platform/network/curl/CookieJarDB.cpp:
3541         (WebCore::CookieJarDB::verifySchemaVersion): Ditto.
3542         * platform/win/SearchPopupMenuDB.cpp:
3543         (WebCore::SearchPopupMenuDB::verifySchemaVersion): Ditto.
3544
3545 2019-02-15  Philippe Normand  <pnormand@igalia.com>
3546
3547         [GStreamer] Decoding media-capabilities configuration initial support
3548         https://bugs.webkit.org/show_bug.cgi?id=191191
3549
3550         Reviewed by Xabier Rodriguez-Calvar.
3551
3552         This patch enables basic platform probing for GStreamer decoders,
3553         optionally using Hardware decoding capabilities. The previous code
3554         for decoders/demuxers probing partially duplicated between the MSE
3555         player and its parent class was moved to a new module called
3556         GStreamerRegistryScanner. There is one instance of it for the MSE player
3557         and one for the parent class.
3558
3559         The scanner can check for the presence of the GstElement Hardware
3560         metadata classifier in decoders and thus advise the
3561         MediaEngineConfigurationFactoryGStreamer that hardware decoding is
3562         supported or not. This is only a first step though. The scanner
3563         should also probably attempt a NULL->READY transition on decoders
3564         to validate specific input caps are supported. As this might
3565         require changes in GStreamer, this part of the patch wasn't
3566         included.
3567
3568         This patch is covered by the existing media tests.
3569
3570         * platform/GStreamer.cmake: New files.
3571         * platform/graphics/MediaPlayer.cpp: Add support for converting
3572         SupportsType enum to string.
3573         (WebCore::convertEnumerationToString):
3574         * platform/graphics/MediaPlayer.h: Ditto.
3575         * platform/graphics/MediaPlayerEnums.h: Ditto.
3576         * platform/graphics/gstreamer/GStreamerCommon.cpp: Move
3577         gstRegistryHasElementForMediaType to GStreamerRegistryScanner.
3578         * platform/graphics/gstreamer/GStreamerCommon.h: Ditto.
3579         * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp: Added.
3580         (WebCore::GStreamerRegistryScanner::singleton):
3581         (WebCore::GStreamerRegistryScanner::GStreamerRegistryScanner): Initialize
3582         supported mime-types and codecs from the GStreamer registry.
3583         (WebCore::GStreamerRegistryScanner::~GStreamerRegistryScanner): Free the element factories.
3584         (WebCore::GStreamerRegistryScanner::gstRegistryHasElementForMediaType):
3585         Check the input caps are supported, optionally using hardware
3586         device.
3587         (WebCore::GStreamerRegistryScanner::fillMimeTypeSetFromCapsMapping):
3588         Moved from MediaPlayerPrivateGStreamer{,MSE}.
3589         (WebCore::GStreamerRegistryScanner::initialize): Ditto.
3590         (WebCore::GStreamerRegistryScanner::supportsCodec const): Ditto.
3591         (WebCore::GStreamerRegistryScanner::supportsAllCodecs const): Ditto.
3592         (WebCore::GStreamerRegistryScanner::isDecodingSupported const): Check
3593         the given configuration is supported. For now hardware support is
3594         checked for video configurations only as it is quite uncommon
3595         anyway to have hardware-enabled audio decoders.
3596         * platform/graphics/gstreamer/GStreamerRegistryScanner.h: Added.
3597         (WebCore::GStreamerRegistryScanner::mimeTypeSet):
3598         (WebCore::GStreamerRegistryScanner::supportsContainerType const):
3599         (WebCore::GStreamerRegistryScanner::RegistryLookupResult::operator bool const):
3600         * platform/graphics/gstreamer/MediaEngineConfigurationFactoryGStreamer.cpp: Added.
3601         (WebCore::createMediaPlayerDecodingConfigurationGStreamer):
3602         * platform/graphics/gstreamer/MediaEngineConfigurationFactoryGStreamer.h: Added.
3603         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3604         Rely on new GStreamerRegistryScanner and add some debugging macros.
3605         (WebCore::MediaPlayerPrivateGStreamer::getSupportedTypes):
3606         (WebCore::MediaPlayerPrivateGStreamer::supportsType):
3607         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Ditto. Also
3608         plug qtdemux for AAC containers, this is an explicit consequence
3609         of finer-grained codecs probing.
3610         (WebCore::AppendPipeline::AppendPipeline):
3611         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
3612         * platform/graphics/gstreamer/mse/GStreamerRegistryScannerMSE.cpp: Added.
3613         (WebCore::GStreamerRegistryScannerMSE::singleton):
3614         (WebCore::GStreamerRegistryScannerMSE::GStreamerRegistryScannerMSE):
3615         * platform/graphics/gstreamer/mse/GStreamerRegistryScannerMSE.h: Added.
3616         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3617         Rely on new GStreamerRegistryScanner and add some debugging macros.
3618         (WebCore::MediaPlayerPrivateGStreamerMSE::getSupportedTypes):
3619         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType):
3620         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
3621         * platform/mediacapabilities/MediaEngineConfigurationFactory.cpp:
3622         (WebCore::factories): GStreamer support.
3623
3624 2019-02-14  Joseph Pecoraro  <pecoraro@apple.com>
3625
3626         Web Inspector: Occasional crash under WebCore::CSSStyleSheet::item called from Inspector
3627         https://bugs.webkit.org/show_bug.cgi?id=194671
3628         <rdar://problem/47628191>
3629
3630         Reviewed by Devin Rousso.
3631
3632         * css/CSSStyleSheet.cpp:
3633         (WebCore::CSSStyleSheet::item):
3634         A crash may happen if the m_childRuleCSSOMWrappers Vector gets out of
3635         sync with the m_contents list of rules. In particular if the wrappers
3636         vector is shorter than the rule list. We tried exercising code paths
3637         that modify these lists but were not able to reproduce the crash.
3638         To avoid a crash we can make this access safer and avoid the original
3639         overflow. At the same time we will keep and promote the assertion that
3640         would catch the lists getting out of sync in debug builds.
3641
3642 2019-02-14  Ross Kirsling  <ross.kirsling@sony.com>
3643
3644         Unreviewed build fix for WinCairo Debug after r241559.
3645
3646         * platform/network/curl/CurlContext.cpp:
3647         (WebCore::CurlContext::CurlContext):
3648
3649 2019-02-14  Ross Kirsling  <ross.kirsling@sony.com>
3650
3651         [WTF] Add environment variable helpers
3652         https://bugs.webkit.org/show_bug.cgi?id=192405
3653
3654         Reviewed by Michael Catanzaro.
3655
3656         * platform/NotImplemented.h:
3657         * platform/cocoa/SystemVersion.mm:
3658         (WebCore::createSystemMarketingVersion):
3659         * platform/graphics/gstreamer/GStreamerCommon.cpp:
3660         (WebCore::initializeGStreamer):
3661         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3662         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
3663         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
3664         (Nicosia::PaintingEngine::create):
3665         * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
3666         (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
3667         * platform/graphics/x11/PlatformDisplayX11.cpp:
3668         (WebCore::PlatformDisplayX11::create):
3669         * platform/gtk/RenderThemeWidget.cpp:
3670         (WebCore::RenderThemeScrollbar::RenderThemeScrollbar):
3671         * platform/gtk/ScrollbarThemeGtk.cpp:
3672         (WebCore::ScrollbarThemeGtk::ScrollbarThemeGtk):
3673         * platform/network/curl/CurlContext.cpp:
3674         (WebCore::CurlContext::CurlContext):
3675         (WebCore::EnvironmentVariableReader::read): Deleted.
3676         (WebCore::EnvironmentVariableReader::defined): Deleted.
3677         (WebCore::EnvironmentVariableReader::readAs): Deleted.
3678         (WebCore::EnvironmentVariableReader::sscanTemplate): Deleted.
3679         (WebCore::EnvironmentVariableReader::sscanTemplate<signed>): Deleted.
3680         (WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>): Deleted.
3681         * platform/network/curl/NetworkStorageSessionCurl.cpp:
3682         (WebCore::defaultCookieJarPath):
3683         * platform/network/playstation/CurlSSLHandlePlayStation.cpp:
3684         (WebCore::getCACertPathEnv):
3685         * platform/network/win/CurlSSLHandleWin.cpp:
3686         (WebCore::getCACertPathEnv):
3687         * platform/text/hyphen/HyphenationLibHyphen.cpp:
3688         (WebCore::topLevelPath):
3689         (WebCore::webkitBuildDirectory):
3690         * platform/unix/LoggingUnix.cpp:
3691         (WebCore::logLevelString):
3692         * platform/win/LoggingWin.cpp:
3693         (WebCore::logLevelString):
3694         Utilize WTF::Environment where possible.
3695
3696 2019-02-14  Chris Dumez  <cdumez@apple.com>
3697
3698         [PSON] Introduce a WebContent Process cache
3699         https://bugs.webkit.org/show_bug.cgi?id=194594
3700         <rdar://problem/46793397>
3701
3702         Reviewed by Geoff Garen.
3703
3704         Update localizable strings.
3705
3706         * en.lproj/Localizable.strings:
3707
3708 2019-02-14  Commit Queue  <commit-queue@webkit.org>
3709
3710         Unreviewed, rolling out r241486.
3711         https://bugs.webkit.org/show_bug.cgi?id=194655
3712
3713         causing API failures in builds (Requested by ShawnRoberts on
3714         #webkit).
3715
3716         Reverted changeset:
3717
3718         "[Cocoa] Media elements will restart network buffering just
3719         before suspending"
3720         https://bugs.webkit.org/show_bug.cgi?id=193691
3721         https://trac.webkit.org/changeset/241486
3722
3723 2019-02-13  Brian Burg  <bburg@apple.com>
3724
3725         Web Inspector: don't include accessibility role in DOM.Node object payloads
3726         https://bugs.webkit.org/show_bug.cgi?id=194623
3727         <rdar://problem/36384037>
3728
3729         Reviewed by Devin Rousso.
3730
3731         Accessibility properties are complicated to fetch at all the points where we want to build and push nodes immediately.
3732         Turning on AX often indirectly causes style recalc and layout. This is bad because we are often building nodes in the
3733         first place due to a DOM node tree update (i.e., NodeInserted).
3734
3735         It turns out that DOM.getAccessibilityPropertiesForNode is called every time we display
3736         the computed role in the Elements Tab > Nodes Sidebar > Accessibility Section. So it is not
3737         necessary to collect this information in a problematic way when initially pushing the node, as
3738         it will be updated anyway.
3739
3740         No new tests, no change in behavior.
3741
3742         * inspector/agents/InspectorDOMAgent.cpp:
3743         (WebCore::InspectorDOMAgent::buildObjectForNode):
3744
3745 2019-02-14  Zalan Bujtas  <zalan@apple.com>
3746
3747         [LFC][BFC][MarginCollapse] Replaced boxes don't collapse through their margins
3748         https://bugs.webkit.org/show_bug.cgi?id=194622
3749
3750         Reviewed by Antti Koivisto.
3751
3752         Ensure that block replaced boxes don't collapse through their vertical margins. 
3753
3754         Test: fast/block/block-only/block-replaced-with-vertical-margins.html
3755
3756         * layout/blockformatting/BlockMarginCollapse.cpp:
3757         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
3758         * page/FrameViewLayoutContext.cpp:
3759         (WebCore::layoutUsingFormattingContext):
3760
3761 2019-02-14  Zalan Bujtas  <zalan@apple.com>
3762
3763         [LFC] Shrink-to-fit-width should be constrained by min/max width
3764         https://bugs.webkit.org/show_bug.cgi?id=194653
3765
3766         Reviewed by Antti Koivisto.
3767
3768         Use the fixed value of min-width/max-width to constrain the computed preferred width.
3769
3770         * layout/FormattingContext.h:
3771         * layout/FormattingContextGeometry.cpp:
3772         (WebCore::Layout::FormattingContext::Geometry::constrainByMinMaxWidth):
3773         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3774         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
3775         * layout/inlineformatting/InlineFormattingContext.cpp:
3776         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
3777
3778 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
3779
3780         Crash in DOMTimer::fired
3781         https://bugs.webkit.org/show_bug.cgi?id=194638
3782
3783         Reviewed by Brent Fulgham.
3784
3785         This patch continues the saga of hunting down timer related crashes after r239814, r225985, r227934.
3786
3787         The crash was caused by the bug that we don't remove a DOMTimer from NestedTimersMap if a DOMTimer
3788         is created & installed inside another DOMTimer's callback (via execute call in DOMTimer::fired).
3789
3790         Fixed the crash by using a Ref in NestedTimersMap. This will keep the timer alive until we exit
3791         from DOMTimer::fired. Because DOMTimer::fired always calls stopTracking() which clears the map
3792         we would not leak these DOM timers.
3793
3794         We could, alternatively, use WeakPtr in NestedTimersMap but that would unnecessarily increase the
3795         size of DOMTimer for a very marginal benefit of DOMTimer objcets being deleted slightly earlier.
3796         Deleting itself in DOMTimer's destructor involves more logic & house keeping in the timer code,
3797         and is no longer the preferred approach when dealing with these classes of bugs in WebKit.
3798
3799         Test: fast/dom/timer-destruction-during-firing.html
3800
3801         * page/DOMTimer.cpp:
3802         (WebCore::NestedTimersMap::add):
3803         (WebCore::DOMTimer::install):
3804         (WebCore::DOMTimer::fired):
3805
3806 2019-02-13  Joseph Pecoraro  <pecoraro@apple.com>
3807
3808         Web Inspector: Crash when inspecting an element that constantly changes visibility
3809         https://bugs.webkit.org/show_bug.cgi?id=194632
3810         <rdar://problem/48060258>
3811
3812         Reviewed by Matt Baker and Devin Rousso.
3813
3814         * inspector/agents/InspectorDOMAgent.h:
3815         * inspector/agents/InspectorDOMAgent.cpp:
3816         (WebCore::InspectorDOMAgent::processAccessibilityChildren):
3817         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
3818         Don't use rvalue-references as that was taking ownership and deleting
3819         the object we want to keep around. Instead simplify this to just use
3820         references so no ref counting changes happen.
3821
3822 2019-02-13  Chris Fleizach  <cfleizach@apple.com>
3823
3824         AX: Crash in handleMenuOpen
3825         https://bugs.webkit.org/show_bug.cgi?id=194627
3826
3827         Reviewed by Zalan Bujtas.
3828
3829         Tests run under libGuardMalloc will cause crashes.
3830
3831         This list of objects is a Node list, not an Element list, so we were
3832         not removing some nodes when they were being deallocated.
3833
3834         * accessibility/AXObjectCache.cpp:
3835         (WebCore::AXObjectCache::remove):
3836
3837 2019-02-13  Jer Noble  <jer.noble@apple.com>
3838
3839         [Mac] PiP window can get "stuck" if PiP is closed while Safari window is minimized.
3840         https://bugs.webkit.org/show_bug.cgi?id=194621
3841         <rdar://problem/48002560>
3842
3843         Reviewed by Eric Carlson.
3844
3845         When Safari is minimized, no rAF() requests are executed. Don't gate responding to presentation
3846         change events in the media-controller.js on rAF().
3847
3848         * Modules/modern-media-controls/media/media-controller.js:
3849         (MediaController.prototype._returnMediaLayerToInlineIfNeeded):
3850
3851 2019-02-13  John Wilander  <wilander@apple.com>
3852
3853         Ignore Ad Click Attribution where source and destination are same-site
3854         https://bugs.webkit.org/show_bug.cgi?id=194620
3855         <rdar://problem/47890018>
3856
3857         Reviewed by Jiewen Tan.
3858
3859         Updated the existing test.
3860
3861         We should not accept Ad Click Attribution requests where the site of the
3862         anchor tag and its addestination attribute are same-site. Such attributions
3863         don’t make sense (the site can track intra-site clicks through better means)
3864         and would just lead to increased memory use where are the pending
3865         attributions are stored.
3866
3867         For ports that don't have access to the Public Suffix List, this patch
3868         only checks that the hosts don't match, i.e. not just eTLD+1.
3869
3870         * html/HTMLAnchorElement.cpp:
3871         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
3872             Now returns WTF::nullopt if the current document and the
3873             addestination are same site. Also fixed a console message
3874             typo.
3875
3876 2019-02-13  Eric Carlson  <eric.carlson@apple.com> and Youenn Fablet  <youenn@apple.com>
3877
3878         getUserMedia with an ideal deviceId constraint doesn't always select the correct device
3879         https://bugs.webkit.org/show_bug.cgi?id=193614
3880
3881         Reviewed by Eric Carlson.
3882
3883         Compute a fitness score based on constraints.
3884         For each constraint, a fitness score is computed from the distance.
3885         The smaller the distance, the higher the score.
3886         Fitness scores are then summed to give a device fitness score.
3887         Matching devices are then sorted according the fitness score.
3888
3889         For important constraints, deviceId and facingMode, add a more important weight.
3890         This ensures that should any of these ideal constraints are set, they will be respected.
3891
3892         Restrict our automatic setting of default constraints to not add a default ideal facingMode in case of existing deviceId constraint.
3893         Do not set a default ideal frameRate if width and height are already set.
3894
3895         Covered by updated test.
3896
3897         * platform/mediastream/MediaConstraints.cpp:
3898         (WebCore::FlattenedConstraint::set):
3899         (WebCore::MediaConstraints::setDefaultVideoConstraints):
3900         * platform/mediastream/RealtimeMediaSource.cpp:
3901         (WebCore::RealtimeMediaSource::fitnessDistance):
3902         (WebCore::RealtimeMediaSource::selectSettings):
3903         (WebCore::RealtimeMediaSource::supportsConstraints):
3904         (WebCore::RealtimeMediaSource::applyConstraints):
3905         * platform/mediastream/RealtimeMediaSource.h:
3906         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3907         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
3908
3909 2019-02-13  Eric Carlson  <eric.carlson@apple.com>
3910
3911         [iOS] Add a hack to work around buggy video control library
3912         https://bugs.webkit.org/show_bug.cgi?id=194615
3913         <rdar://problem/46146946>
3914
3915         Reviewed by Jer Noble.
3916
3917         Test: media/ios/video-volume-ios-quirk.html
3918
3919         * html/HTMLMediaElement.cpp:
3920         (WebCore::HTMLMediaElement::setVolume): Change m_volume for one turn of the runloop.
3921         (WebCore::HTMLMediaElement::cancelPendingTasks): Clear the task queue used to restore m_volume.
3922         (WebCore::HTMLMediaElement::closeTaskQueues): Close it.
3923         * html/HTMLMediaElement.h:
3924
3925 2019-02-13  Jer Noble  <jer.noble@apple.com>
3926
3927         [Cocoa] Media elements will restart network buffering just before suspending
3928         https://bugs.webkit.org/show_bug.cgi?id=193691
3929
3930         Reviewed by Eric Carlson.
3931
3932         API Test: WebKit.ProcessSuspendMediaBuffering
3933
3934         Allow the Page to suspend all media buffering in its child Documents.
3935
3936         * dom/Document.cpp:
3937         (WebCore::Document::suspendAllMediaBuffering):
3938         (WebCore::Document::resumeAllMediaBuffering):
3939         * dom/Document.h:
3940         * html/MediaElementSession.cpp: