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