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