Web Inspector: Audit: provide a way to get the contents of resources
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-03-14  Devin Rousso  <drousso@apple.com>
2
3         Web Inspector: Audit: provide a way to get the contents of resources
4         https://bugs.webkit.org/show_bug.cgi?id=195266
5         <rdar://problem/48550911>
6
7         Reviewed by Joseph Pecoraro.
8
9         Test: inspector/audit/run-resources.html
10
11         * inspector/InspectorAuditResourcesObject.idl: Added.
12         * inspector/InspectorAuditResourcesObject.h: Added.
13         (WebCore::InspectorAuditResourcesObject::create):
14         (WebCore::InspectorAuditResourcesObject::Resource):
15         (WebCore::InspectorAuditResourcesObject::ResourceContent):
16         (WebCore::InspectorAuditResourcesObject::InspectorAuditCachedResourceClient):
17         (WebCore::InspectorAuditResourcesObject::InspectorAuditCachedFontClient):
18         (WebCore::InspectorAuditResourcesObject::InspectorAuditCachedImageClient):
19         (WebCore::InspectorAuditResourcesObject::InspectorAuditCachedRawResourceClient):
20         (WebCore::InspectorAuditResourcesObject::InspectorAuditCachedStyleSheetClient):
21         (WebCore::InspectorAuditResourcesObject::InspectorAuditCachedSVGDocumentClient):
22         * inspector/InspectorAuditResourcesObject.cpp: Added.
23         (WebCore::InspectorAuditResourcesObject::InspectorAuditResourcesObject):
24         (WebCore::InspectorAuditResourcesObject::getResources):
25         (WebCore::InspectorAuditResourcesObject::getResourceContent):
26         (WebCore::InspectorAuditResourcesObject::clientForResource):
27
28         * inspector/agents/InspectorPageAgent.h:
29         * inspector/agents/InspectorPageAgent.cpp:
30         (WebCore::InspectorPageAgent::cachedResourcesForFrame): Added.
31         (WebCore::allResourcesURLsForFrame):
32         Moved a file static function to be a class static function so it can be used elsewhere.
33
34         * CMakeLists.txt:
35         * DerivedSources-input.xcfilelist:
36         * DerivedSources-output.xcfilelist:
37         * DerivedSources.make:
38         * Sources.txt:
39         * WebCore.xcodeproj/project.pbxproj:
40
41 2019-03-14  Devin Rousso  <drousso@apple.com>
42
43         Web Inspector: Console: getEventListeners should work for any EventTarget
44         https://bugs.webkit.org/show_bug.cgi?id=195713
45
46         Reviewed by Joseph Pecoraro.
47
48         Test: inspector/console/command-line-api-getEventListeners.html
49
50         * dom/EventTarget.h:
51         * dom/EventTarget.cpp:
52         (WebCore::EventTarget::eventTypes): Added.
53
54         * inspector/CommandLineAPIHost.idl:
55         * inspector/CommandLineAPIHost.h:
56         (WebCore::CommandLineAPIHost::init):
57         * inspector/CommandLineAPIHost.cpp:
58         (WebCore::CommandLineAPIHost::disconnect):
59         (WebCore::CommandLineAPIHost::getEventListeners):
60         (WebCore::listenerEntriesFromListenerInfo): Deleted.
61
62         * inspector/CommandLineAPIModuleSource.js:
63         (CommandLineAPIImpl.prototype.getEventListeners):
64
65         * inspector/InspectorController.cpp:
66         (WebCore::InspectorController::InspectorController):
67         * inspector/WorkerInspectorController.cpp:
68         (WebCore::WorkerInspectorController::WorkerInspectorController):
69
70 2019-03-14  Devin Rousso  <drousso@apple.com>
71
72         Web Inspector: Styles: `::-webkit-scrollbar*` rules aren't shown
73         https://bugs.webkit.org/show_bug.cgi?id=195123
74         <rdar://problem/48450148>
75
76         Reviewed by Joseph Pecoraro.
77
78         Test: inspector/css/getMatchedStylesForNode.html
79
80         * inspector/agents/InspectorCSSAgent.cpp:
81         (WebCore::protocolValueForPseudoId): Added.
82         (WebCore::InspectorCSSAgent::getMatchedStylesForNode):
83
84 2019-03-13  Benjamin Poulain  <benjamin@webkit.org>
85
86         Fix the argument type of RenderView::resumePausedImageAnimationsIfNeeded()
87         https://bugs.webkit.org/show_bug.cgi?id=195659
88
89         Reviewed by Saam Barati.
90
91         The two callers of resumePausedImageAnimationsIfNeeded() both get the IntRect
92         as a reference. The rect was going on the stack then used as a reference again.
93
94         * rendering/RenderView.cpp:
95         (WebCore::RenderView::resumePausedImageAnimationsIfNeeded):
96         * rendering/RenderView.h:
97
98 2019-03-13  Zalan Bujtas  <zalan@apple.com>
99
100         [ContentChangeObserver] Stop content observation when content calls preventDefault() on touch events
101         https://bugs.webkit.org/show_bug.cgi?id=195724
102         <rdar://problem/48873456>
103
104         Reviewed by Simon Fraser.
105
106         Call willNotProceedWithClick on preventDefault. This is very similar to the long press case.
107
108         * page/ios/ContentChangeObserver.cpp:
109         (WebCore::willNotProceedWithClick):
110         (WebCore::ContentChangeObserver::didRecognizeLongPress):
111         (WebCore::ContentChangeObserver::didPreventDefaultForEvent):
112         * page/ios/ContentChangeObserver.h:
113
114 2019-03-13  Justin Fan  <justin_fan@apple.com>
115
116         [Web GPU] Updates to GPUCommandBuffer for new GPUCommandQueue concept
117         https://bugs.webkit.org/show_bug.cgi?id=195083
118         <rdar://problem/48423591>
119
120         Reviewed by Dean Jackson.
121
122         WebGPUCommandBuffer now represents a completed GPUCommandBuffer that can only be used in queue submits. The previous WebGPUCommandBuffer
123         is now WebGPUCommandEncoder.
124
125         Affected Web GPU tests updated to match new API.
126
127         New files and symbols:
128         * CMakeLists.txt:
129         * DerivedSources.make:
130         * Sources.txt:
131         * WebCore.xcodeproj/project.pbxproj:
132         * bindings/js/WebCoreBuiltinNames.h:
133
134         Implement new WebGPUCommandBuffer, now just a DOM object carrier for a finished GPUCommandBuffer:
135         * Modules/webgpu/WebGPUCommandBuffer.cpp:
136         (WebCore::WebGPUCommandBuffer::create):
137         (WebCore::WebGPUCommandBuffer::WebGPUCommandBuffer):
138         (WebCore::WebGPUBufferCopyView::tryCreateGPUBufferCopyView const): Deleted.
139         (WebCore::WebGPUTextureCopyView::tryCreateGPUTextureCopyView const): Deleted.
140         (WebCore::WebGPUCommandBuffer::beginRenderPass): Deleted.
141         (WebCore::WebGPUCommandBuffer::copyBufferToBuffer): Deleted.
142         (WebCore::WebGPUCommandBuffer::copyBufferToTexture): Deleted.
143         (WebCore::WebGPUCommandBuffer::copyTextureToBuffer): Deleted.
144         (WebCore::WebGPUCommandBuffer::copyTextureToTexture): Deleted.
145         * Modules/webgpu/WebGPUCommandBuffer.h:
146         (WebCore::WebGPUCommandBuffer::commandBuffer):
147         (WebCore::WebGPUCommandBuffer::commandBuffer const): Deleted.
148         * Modules/webgpu/WebGPUCommandBuffer.idl:
149
150         Rename old WebGPUCommandBuffer to WebGPUCommandEncoder:
151         * Modules/webgpu/WebGPUCommandEncoder.cpp: Copied from Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp.
152         (WebCore::WebGPUBufferCopyView::tryCreateGPUBufferCopyView const):
153         (WebCore::WebGPUTextureCopyView::tryCreateGPUTextureCopyView const):
154         (WebCore::WebGPUCommandEncoder::create):
155         (WebCore::WebGPUCommandEncoder::WebGPUCommandEncoder):
156         (WebCore::WebGPUCommandEncoder::beginRenderPass):
157         (WebCore::WebGPUCommandEncoder::copyBufferToBuffer):
158         (WebCore::WebGPUCommandEncoder::copyBufferToTexture):
159         (WebCore::WebGPUCommandEncoder::copyTextureToBuffer):
160         (WebCore::WebGPUCommandEncoder::copyTextureToTexture):
161         (WebCore::WebGPUCommandEncoder::finish): Added. "Completes" this and invalidates it. Returns its GPUCommandBuffer, ready for submission.
162         * Modules/webgpu/WebGPUCommandEncoder.h: Copied from Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h.
163         * Modules/webgpu/WebGPUCommandEncoder.idl: Copied from Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.idl.
164         * Modules/webgpu/WebGPUDevice.cpp:
165         (WebCore::WebGPUDevice::createCommandEncoder const): Renamed fom createCommandBuffer. Now returns non-nullable.
166         (WebCore::WebGPUDevice::createCommandBuffer const): Deleted.
167         * Modules/webgpu/WebGPUDevice.h:
168         * Modules/webgpu/WebGPUDevice.idl:
169         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
170         (WebCore::WebGPUProgrammablePassEncoder::WebGPUProgrammablePassEncoder):
171         (WebCore::WebGPUProgrammablePassEncoder::endPass): No longer returns the original WebGPUCommandBuffer.
172         (WebCore::WebGPUProgrammablePassEncoder::setBindGroup const):
173         (WebCore::WebGPUProgrammablePassEncoder::setPipeline):
174         * Modules/webgpu/WebGPUProgrammablePassEncoder.h:
175         * Modules/webgpu/WebGPUProgrammablePassEncoder.idl:
176         * Modules/webgpu/WebGPUQueue.cpp:
177         (WebCore::WebGPUQueue::submit): Replace unnecessary rvalue reference parameter.
178         * Modules/webgpu/WebGPUQueue.h:
179         * Modules/webgpu/WebGPUQueue.idl:
180         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
181         (WebCore::WebGPURenderPassEncoder::create):
182         (WebCore::WebGPURenderPassEncoder::WebGPURenderPassEncoder):
183         (WebCore::WebGPURenderPassEncoder::setVertexBuffers):
184         (WebCore::WebGPURenderPassEncoder::draw):
185         (WebCore::WebGPURenderPassEncoder::passEncoder const): Now returns a pointer since it is properly backed by a RefPtr.
186         * Modules/webgpu/WebGPURenderPassEncoder.h:
187         * Modules/webgpu/WebGPUSwapChain.cpp:
188         (WebCore::WebGPUSwapChain::getCurrentTexture): No longer invalidates m_currentTexture. Doh!
189         * platform/graphics/gpu/GPUCommandBuffer.h: Missing includes for the *CopyView structs.
190         * platform/graphics/gpu/GPUDevice.cpp:
191         (WebCore::GPUDevice::tryCreateCommandBuffer const): Renamed from createCommandBuffer.
192         (WebCore::GPUDevice::createCommandBuffer): Deleted.
193         * platform/graphics/gpu/GPUDevice.h:
194         * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm:
195         (WebCore::GPUCommandBuffer::tryCreate): Renamed from create.
196         (WebCore::GPUCommandBuffer::create): Deleted.
197
198 2019-03-13  Zalan Bujtas  <zalan@apple.com>
199
200         [WeakPtr] RenderListMarker::m_listItem should be a WeakPtr
201         https://bugs.webkit.org/show_bug.cgi?id=195704
202         <rdar://problem/48486278>
203
204         Reviewed by Simon Fraser.
205
206         * rendering/RenderListMarker.cpp:
207         (WebCore::RenderListMarker::RenderListMarker):
208         (WebCore::RenderListMarker::paint):
209         (WebCore::RenderListMarker::layout):
210         (WebCore::RenderListMarker::updateContent):
211         (WebCore::RenderListMarker::computePreferredLogicalWidths):
212         (WebCore::RenderListMarker::lineHeight const):
213         (WebCore::RenderListMarker::baselinePosition const):
214         (WebCore::RenderListMarker::suffix const):
215         (WebCore::RenderListMarker::isInside const):
216         (WebCore::RenderListMarker::getRelativeMarkerRect):
217         * rendering/RenderListMarker.h:
218
219 2019-03-13  Dean Jackson  <dino@apple.com>
220
221         Block all plugins smaller than 5x5px
222         https://bugs.webkit.org/show_bug.cgi?id=195702
223         <rdar://problem/28435204>
224
225         Reviewed by Sam Weinig.
226
227         Block all plugins that are smaller than a threshold, in this case
228         5px x 5px. Other browsers have implemented this for a while, and now
229         that we have Intersection Observers, small plugins are no longer
230         necessary.
231
232         Test: plugins/small-plugin-blocked.html
233
234         * en.lproj/Localizable.strings: New message for a small plugin.
235         * platform/LocalizedStrings.cpp:
236         (WebCore::pluginTooSmallText):
237         * platform/LocalizedStrings.h:
238
239         * html/HTMLPlugInElement.cpp: Helper function for Internals testing.
240         (WebCore::HTMLPlugInElement::isBelowSizeThreshold const):
241         * html/HTMLPlugInElement.h:
242
243         * loader/EmptyClients.cpp: Removed an unused function.
244         (WebCore::EmptyFrameLoaderClient::recreatePlugin): Deleted.
245         * loader/EmptyFrameLoaderClient.h:
246         * loader/FrameLoaderClient.h:
247
248         * page/Settings.yaml: Add flag for new feature.
249
250         * rendering/RenderEmbeddedObject.cpp: New unavailability reason for
251         embedded objects.
252         (WebCore::unavailablePluginReplacementText):
253         * rendering/RenderEmbeddedObject.h:
254         (WebCore::RenderEmbeddedObject::pluginUnavailabilityReason const):
255
256         * testing/Internals.cpp: Helper function for testing.
257         (WebCore::Internals::pluginIsBelowSizeThreshold):
258         * testing/Internals.h:
259         * testing/Internals.idl:
260
261 2019-03-13  Zalan Bujtas  <zalan@apple.com>
262
263         Use RenderBox::previousSiblingBox/nextSiblingBox in RenderMultiColumnFlow
264         https://bugs.webkit.org/show_bug.cgi?id=195701
265         <rdar://problem/48448658>
266
267         Reviewed by Simon Fraser.
268
269         It's safer to use existing RenderBox functions to get sibling boxes.
270
271         Test: fast/ruby/crash-when-paginated-ruby.html
272
273         * rendering/RenderMultiColumnFlow.cpp:
274         (WebCore::RenderMultiColumnFlow::nextColumnSetOrSpannerSiblingOf):
275         (WebCore::RenderMultiColumnFlow::previousColumnSetOrSpannerSiblingOf):
276
277 2019-03-13  Keith Rollin  <krollin@apple.com>
278
279         Add support for new StagedFrameworks layout
280         https://bugs.webkit.org/show_bug.cgi?id=195543
281
282         Reviewed by Alexey Proskuryakov.
283
284         When creating the WebKit layout for out-of-band Safari/WebKit updates,
285         use an optional path prefix when called for.
286
287         No new tests since there should be no observable behavior difference.
288
289         * Configurations/WebCore.xcconfig:
290
291 2019-03-13  Wenson Hsieh  <wenson_hsieh@apple.com>
292
293         Fix an edge case where HTMLFormElement::removeFormElement is invoked twice with the same element
294         https://bugs.webkit.org/show_bug.cgi?id=195663
295         <rdar://problem/48576391>
296
297         Reviewed by Ryosuke Niwa.
298
299         Currently, it's possible for HTMLFormControlElement's destructor to be reentrant. This may happen if the form
300         control element is ref'd while carrying out its destructor's logic. This may happen in two places in
301         HTMLFormControlElement (didChangeForm and resetDefaultButton), both of which actually don't require ensuring a
302         protected reference to the form control element since they should never result in any script execution.
303
304         To fix the bug, convert these strong references into raw pointers, and add ScriptDisallowedScope to ensure that
305         we don't change these codepaths in the future, such that they trigger arbitrary script execution.
306
307         Test: fast/forms/remove-associated-element-after-gc.html
308
309         * html/HTMLFormControlElement.cpp:
310         (WebCore::HTMLFormControlElement::didChangeForm):
311         * html/HTMLFormElement.cpp:
312         (WebCore::HTMLFormElement::resetDefaultButton):
313
314 2019-03-13  Daniel Bates  <dabates@apple.com>
315
316         Remove some unnecessary !USE(UIKIT_KEYBOARD_ADDITIONS) guards
317         https://bugs.webkit.org/show_bug.cgi?id=195703
318
319         Reviewed by Tim Horton.
320
321         Remove out-of-date comment and unncessary !USE(UIKIT_KEYBOARD_ADDITIONS) guards. Following
322         r240604 we now make use of WebCore::windowsKeyCodeForCharCode() even for hardware key events
323         when USE(UIKIT_KEYBOARD_ADDITIONS) is enabled.
324
325         No functionality changed. So, no new tests.
326
327         * platform/ios/KeyEventIOS.mm:
328         (WebCore::windowsKeyCodeForCharCode):
329         * platform/ios/WebEvent.mm:
330         (normalizedStringWithAppKitCompatibilityMapping):
331
332 2019-03-13  Simon Fraser  <simon.fraser@apple.com>
333
334         Scrolling tree should reposition non-stacking order descendents of overflow:scroll
335         https://bugs.webkit.org/show_bug.cgi?id=195608
336
337         Reviewed by Zalan Bujtas.
338         
339         Step 1: add scrolling tree positioning nodes classes (but don't create them yet).
340
341         Add Scrolling{State,Tree}PositionedNode to track composited layers that have to be repositioned when
342         an async overflow:scroll scrolls. There are two instances in which this is necessary, reflected by
343         the values of ScrollPositioningBehavior:
344
345         ScrollPositioningBehavior::Moves - a composited layer whose containing block chain includes an
346             async overflow scroller, but whose composited (i.e. z-order) parent is outside of the overflow.
347             When the overflow scrolls, this layer has to move along with the overflow.
348
349         ScrollPositioningBehavior::Stationary - a composited layer whose containing block chain skips the
350             overflow scroller, but whose compositing (z-order) parent is the scroller, or inside the scroller.
351             This only applies to position:absolute, on, for example, an overflow:scroll ith opacity.
352
353         PositionedNodes are modeled after Fixed/Sticky nodes, with a new type of layout constraint just called LayoutConstraints.
354         
355         This patch adds support for PositionedNodes in the scrolling trees, but RenderLayerCompositor::computeCoordinatedPositioningForLayer()
356         is just a stub so the new node types aren't created yet.
357         
358         RenderLayerBacking stores a ScrollingNodeID for the positioning role (just like the other roles). Since the Positioning
359         role is about position relative to ancestors, a node with both Positioning and FrameHosting or Scrolling roles treats
360         the Positioning node as the parent of the other types. A node should never have both Positioning and ViewportConstrained roles.
361
362         Test: scrollingcoordinator/scrolling-tree/positioned-nodes.html
363
364         * Sources.txt:
365         * SourcesCocoa.txt:
366         * WebCore.xcodeproj/project.pbxproj:
367         * page/scrolling/AsyncScrollingCoordinator.cpp:
368         (WebCore::AsyncScrollingCoordinator::setPositionedNodeGeometry):
369         (WebCore::AsyncScrollingCoordinator::setRelatedOverflowScrollingNodes):
370         * page/scrolling/AsyncScrollingCoordinator.h:
371         * page/scrolling/ScrollingConstraints.cpp:
372         (WebCore::operator<<):
373         * page/scrolling/ScrollingConstraints.h:
374         (WebCore::LayoutConstraints::LayoutConstraints):
375         (WebCore::LayoutConstraints::operator== const):
376         (WebCore::LayoutConstraints::operator!= const):
377         (WebCore::LayoutConstraints::alignmentOffset const):
378         (WebCore::LayoutConstraints::setAlignmentOffset):
379         (WebCore::LayoutConstraints::layerPositionAtLastLayout const):
380         (WebCore::LayoutConstraints::setLayerPositionAtLastLayout):
381         (WebCore::LayoutConstraints::scrollPositioningBehavior const):
382         (WebCore::LayoutConstraints::setScrollPositioningBehavior):
383         * page/scrolling/ScrollingCoordinator.cpp:
384         (WebCore::operator<<):
385         * page/scrolling/ScrollingCoordinator.h:
386         (WebCore::ScrollingCoordinator::setPositionedNodeGeometry):
387         (WebCore::ScrollingCoordinator::setRelatedOverflowScrollingNodes):
388         * page/scrolling/ScrollingCoordinatorTypes.h:
389         * page/scrolling/ScrollingStateNode.h:
390         (WebCore::ScrollingStateNode::isPositionedNode const):
391         * page/scrolling/ScrollingStatePositionedNode.cpp: Added.
392         (WebCore::ScrollingStatePositionedNode::create):
393         (WebCore::ScrollingStatePositionedNode::ScrollingStatePositionedNode):
394         (WebCore::ScrollingStatePositionedNode::clone):
395         (WebCore::ScrollingStatePositionedNode::setAllPropertiesChanged):
396         (WebCore::ScrollingStatePositionedNode::setRelatedOverflowScrollingNodes):
397         (WebCore::ScrollingStatePositionedNode::updateConstraints):
398         (WebCore::ScrollingStatePositionedNode::dumpProperties const):
399         * page/scrolling/ScrollingStatePositionedNode.h: Added.
400         * page/scrolling/ScrollingStateTree.cpp:
401         (WebCore::ScrollingStateTree::createNode):
402         * page/scrolling/ScrollingTree.cpp:
403         (WebCore::ScrollingTree::updateTreeFromStateNode):
404         * page/scrolling/ScrollingTree.h:
405         * page/scrolling/ScrollingTreeNode.h:
406         (WebCore::ScrollingTreeNode::isPositionedNode const):
407         * page/scrolling/cocoa/ScrollingTreePositionedNode.h: Copied from Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.h.
408         * page/scrolling/cocoa/ScrollingTreePositionedNode.mm: Added.
409         (WebCore::ScrollingTreePositionedNode::create):
410         (WebCore::ScrollingTreePositionedNode::ScrollingTreePositionedNode):
411         (WebCore::ScrollingTreePositionedNode::~ScrollingTreePositionedNode):
412         (WebCore::ScrollingTreePositionedNode::commitStateBeforeChildren):
413         (WebCore::ScrollingTreePositionedNode::applyLayerPositions):
414         (WebCore::ScrollingTreePositionedNode::relatedNodeScrollPositionDidChange):
415         (WebCore::ScrollingTreePositionedNode::dumpProperties const):
416         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
417         * page/scrolling/mac/ScrollingTreeMac.cpp:
418         (ScrollingTreeMac::createScrollingTreeNode):
419         * platform/ScrollTypes.h:
420         * rendering/RenderLayerBacking.cpp:
421         (WebCore::RenderLayerBacking::coordinatedScrollingRoles const):
422         (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
423         * rendering/RenderLayerBacking.h:
424         * rendering/RenderLayerCompositor.cpp:
425         (WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const):
426         (WebCore::scrollCoordinationRoleForNodeType):
427         (WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer):
428         (WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole):
429         (WebCore::RenderLayerCompositor::updateScrollingNodeLayers):
430         (WebCore::RenderLayerCompositor::updateScrollingNodeForPositioningRole):
431         * rendering/RenderLayerCompositor.h:
432
433 2019-03-13  Youenn Fablet  <youenn@apple.com>
434
435         Check IDB quota usage through QuotaManager
436         https://bugs.webkit.org/show_bug.cgi?id=195302
437
438         Reviewed by Chris Dumez.
439
440         For every write operation, compute an estimate size and check for quota before proceeding.
441         When proceeding, store the estimate size in a map.
442         If size of the database is to be computed when the task is not done,
443         the estimate size will be added to the current size of the databases.
444         At the end of the task, the estimate size is removed from the map,
445         and the databases size is refreshed.
446
447         This patch implements size estimation for write tasks.
448         Put/add operations might overestimate the size
449         when an old value will be replaced by a new value.
450         In that case, we do not substract the old value size since we do not know it.
451
452         This patch implements database opening by adding a fixed small cost,
453         as we do not know whether the database is new or not.
454
455         For the first IDB request, we have not computed the size of the database.
456         To do so, we need to go to a background thread and do that file size computation.
457         For that purpose, we add support for being-initialized quota user.
458         Quota manager is calling whenInitialized on its quota user and will
459         delay any quota check requests until its quota user is answering this callback.
460
461         For in process IDB, use the default storage quota per origin and do not increase it.
462         Future work should move it to NetworkProcess and implement some quota checking.
463
464         Cache API and IDB quota management are not yet fully unified.
465         If IDB is used on start-up, we should check for Cache API storage size.
466         Conversely, on Cache API first wite task, even if IDB is not being used,
467         we should compute the size of the IDB data for the given origin.
468
469         Test: http/tests/IndexedDB/storage-limit.https.html
470
471         * Modules/indexeddb/server/IDBBackingStore.h:
472         * Modules/indexeddb/server/IDBServer.cpp:
473         (WebCore::IDBServer::IDBServer::create):
474         (WebCore::IDBServer::IDBServer::IDBServer):
475         (WebCore::IDBServer::m_quotaManagerGetter):
476         (WebCore::IDBServer::IDBServer::QuotaUser::QuotaUser):
477         (WebCore::IDBServer::IDBServer::QuotaUser::~QuotaUser):
478         (WebCore::IDBServer::IDBServer::QuotaUser::clearSpaceUsed):
479         (WebCore::IDBServer::IDBServer::QuotaUser::whenInitialized):
480         (WebCore::IDBServer::IDBServer::QuotaUser::initializeSpaceUsed):
481         (WebCore::IDBServer::IDBServer::quotaUser):
482         (WebCore::IDBServer::IDBServer::startComputingSpaceUsedForOrigin):
483         (WebCore::IDBServer::IDBServer::computeSpaceUsedForOrigin):
484         (WebCore::IDBServer::IDBServer::finishComputingSpaceUsedForOrigin):
485         (WebCore::IDBServer::IDBServer::requestSpace):
486         (WebCore::IDBServer::IDBServer::clearSpaceUsed):
487         (WebCore::IDBServer::IDBServer::setSpaceUsed):
488         (WebCore::IDBServer::IDBServer::increasePotentialSpaceUsed):
489         (WebCore::IDBServer::IDBServer::decreasePotentialSpaceUsed):
490         * Modules/indexeddb/server/IDBServer.h:
491         (WebCore::IDBServer::IDBServer::create):
492         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
493         (WebCore::IDBServer::MemoryIDBBackingStore::databasesSizeForOrigin const):
494         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
495         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
496         (WebCore::IDBServer::SQLiteIDBBackingStore::databasesSizeForFolder):
497         (WebCore::IDBServer::SQLiteIDBBackingStore::databasesSizeForOrigin const):
498         (WebCore::IDBServer::SQLiteIDBBackingStore::maximumSize const):
499         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
500         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
501         (WebCore::IDBServer::estimateSize):
502         (WebCore::IDBServer::UniqueIDBDatabase::UniqueIDBDatabase):
503         (WebCore::IDBServer::quotaErrorMessageName):
504         (WebCore::IDBServer::UniqueIDBDatabase::requestSpace):
505         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentOpenOperation):
506         (WebCore::IDBServer::UniqueIDBDatabase::storeCallbackOrFireError):
507         (WebCore::IDBServer::UniqueIDBDatabase::createObjectStore):
508         (WebCore::IDBServer::UniqueIDBDatabase::createObjectStoreAfterQuotaCheck):
509         (WebCore::IDBServer::UniqueIDBDatabase::renameObjectStore):
510         (WebCore::IDBServer::UniqueIDBDatabase::renameObjectStoreAfterQuotaCheck):
511         (WebCore::IDBServer::UniqueIDBDatabase::createIndex):
512         (WebCore::IDBServer::UniqueIDBDatabase::createIndexAfterQuotaCheck):
513         (WebCore::IDBServer::UniqueIDBDatabase::renameIndex):
514         (WebCore::IDBServer::UniqueIDBDatabase::renameIndexAfterQuotaCheck):
515         (WebCore::IDBServer::UniqueIDBDatabase::putOrAdd):
516         (WebCore::IDBServer::UniqueIDBDatabase::putOrAddAfterQuotaCheck):
517         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply):
518         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
519         (WebCore::IDBServer::UniqueIDBDatabase::updateSpaceUsedIfNeeded):
520         (WebCore::IDBServer::UniqueIDBDatabase::performErrorCallback):
521         (WebCore::IDBServer::UniqueIDBDatabase::performKeyDataCallback):
522         * Modules/indexeddb/server/UniqueIDBDatabase.h:
523         (WebCore::IDBServer::UniqueIDBDatabase::server):
524         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
525         (WebCore::InProcessIDBServer::create):
526         (WebCore::InProcessIDBServer::quotaManager):
527         (WebCore::storageQuotaManagerGetter):
528         (WebCore::InProcessIDBServer::InProcessIDBServer):
529         * Modules/indexeddb/shared/InProcessIDBServer.h:
530         * loader/EmptyClients.cpp:
531         * storage/StorageQuotaManager.cpp:
532         (WebCore::StorageQuotaManager::addUser):
533         (WebCore::StorageQuotaManager::requestSpace):
534         * storage/StorageQuotaManager.h:
535         (WebCore::StorageQuotaManager::defaultQuota):
536         (WebCore::StorageQuotaManager::removeUser):
537         * storage/StorageQuotaUser.h:
538         (WebCore::StorageQuotaUser::whenInitialized):
539
540 2019-03-13  Chris Dumez  <cdumez@apple.com>
541
542         Better build fix after r242901.
543
544         Reviewed by Jer Noble.
545
546         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
547         (MediaSessionManagerCocoa::sessionWillBeginPlayback):
548         (MediaSessionManagerCocoa::updateNowPlayingInfo):
549
550 2019-03-13  Timothy Hatcher  <timothy@apple.com>
551
552         Consolidate ArgumentCodersMac and ArgumentCodersCocoa.
553         https://bugs.webkit.org/show_bug.cgi?id=195636
554         rdar://problem/45055697
555
556         Reviewed by Ryosuke Niwa.
557
558         * editing/DictionaryPopupInfo.h:
559         (WebCore::DictionaryPopupInfo::encodingRequiresPlatformData const): Added.
560         * editing/FontAttributes.h:
561         (WebCore::FontAttributes::encodingRequiresPlatformData const): Added.
562
563 2019-03-13  Chris Dumez  <cdumez@apple.com>
564
565         Unreviewed build fix after r242901.
566
567         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
568         (MediaSessionManagerCocoa::updateNowPlayingInfo):
569
570 2019-03-13  Chris Dumez  <cdumez@apple.com>
571
572         Use a ServiceWorker process per registrable domain
573         https://bugs.webkit.org/show_bug.cgi?id=195649
574
575         Reviewed by Youenn Fablet.
576
577         Use a ServiceWorker process per registrable domain instead of one per security origin. This is
578         more in line with PSON and avoids launching too many processes.
579
580         * page/ClientOrigin.h:
581         (WebCore::ClientOrigin::clientRegistrableDomain const):
582         * workers/service/server/SWServer.cpp:
583         (WebCore::SWServer::tryInstallContextData):
584         (WebCore::SWServer::serverToContextConnectionCreated):
585         (WebCore::SWServer::runServiceWorkerIfNecessary):
586         (WebCore::SWServer::markAllWorkersForRegistrableDomainAsTerminated):
587         (WebCore::SWServer::registerServiceWorkerClient):
588         (WebCore::SWServer::unregisterServiceWorkerClient):
589         (WebCore::SWServer::needsServerToContextConnectionForRegistrableDomain const):
590         * workers/service/server/SWServer.h:
591         * workers/service/server/SWServerToContextConnection.cpp:
592         (WebCore::SWServerToContextConnection::SWServerToContextConnection):
593         (WebCore::SWServerToContextConnection::~SWServerToContextConnection):
594         (WebCore::SWServerToContextConnection::connectionForRegistrableDomain):
595         * workers/service/server/SWServerToContextConnection.h:
596         (WebCore::SWServerToContextConnection::registrableDomain const):
597         * workers/service/server/SWServerWorker.cpp:
598         (WebCore::SWServerWorker::contextConnection):
599         * workers/service/server/SWServerWorker.h:
600         (WebCore::SWServerWorker::registrableDomain const):
601
602 2019-03-13  Chris Dumez  <cdumez@apple.com>
603
604         REGRESSION(PSON, r240660): Navigation over process boundary is flashy when using Cmd-left/right arrow to navigate
605         https://bugs.webkit.org/show_bug.cgi?id=195684
606         <rdar://problem/48294714>
607
608         Reviewed by Antti Koivisto.
609
610         The issue was caused by us failing to suspend the current page on navigation because the source and
611         target WebBackForwardListItem are identical. The source WebBackForwardListItem was wrong.
612
613         When a navigation is triggered by the WebContent process (and not the UIProcess), we create the Navigation
614         object in WebPageProxy::decidePolicyForNavigationAction(). For the navigation's targetItem, we use the
615         target item identifier provided by the WebContent process via the NavigationActionData. However,
616         for the source item, we would use the WebBackForwardList's currentItem in the UIProcess. The issue
617         is that the WebBackForwardList's currentItem usually has already been updated to be the target
618         item via a WebPageProxy::BackForwardGoToItem() synchronous IPC.
619
620         To avoid raciness and given that the current history management is fragile (as it is managed by
621         both the UIProcess and the WebProcess), I am now passing the source item identifier in
622         addition to the target item identifier in the NavigationActionData that is sent by the WebProcess.
623         This is a lot less error prone, the WebProcess knows more accurately which history items it is going
624         from and to.
625
626         * loader/FrameLoader.cpp:
627         (WebCore::FrameLoader::loadURLIntoChildFrame):
628         (WebCore::FrameLoader::loadDifferentDocumentItem):
629         (WebCore::FrameLoader::loadItem):
630         (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad):
631         * loader/FrameLoader.h:
632         * loader/HistoryController.cpp:
633         (WebCore::HistoryController::recursiveGoToItem):
634         * loader/NavigationAction.cpp:
635         (WebCore::NavigationAction::setSourceBackForwardItem):
636         * loader/NavigationAction.h:
637         (WebCore::NavigationAction::sourceBackForwardItemIdentifier const):
638
639 2019-03-13  Jer Noble  <jer.noble@apple.com>
640
641         Add AggregateLogger, a Logger specialization for singleton classes.
642         https://bugs.webkit.org/show_bug.cgi?id=195644
643
644         Reviewed by Eric Carlson.
645
646         Convert debug logging over to release logging through the use of AggregateLogger.
647
648         * platform/audio/PlatformMediaSession.h:
649         (WebCore::PlatformMediaSession::client const):
650         * platform/audio/PlatformMediaSessionManager.cpp:
651         (WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager):
652         (WebCore::PlatformMediaSessionManager::beginInterruption):
653         (WebCore::PlatformMediaSessionManager::endInterruption):
654         (WebCore::PlatformMediaSessionManager::addSession):
655         (WebCore::PlatformMediaSessionManager::removeSession):
656         (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback):
657         (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback):
658         (WebCore::PlatformMediaSessionManager::setCurrentSession):
659         (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const):
660         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const):
661         (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const):
662         (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const):
663         (WebCore::PlatformMediaSessionManager::logChannel const):
664         * platform/audio/PlatformMediaSessionManager.h:
665         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
666         (MediaSessionManagerCocoa::updateSessionState):
667         (MediaSessionManagerCocoa::sessionWillBeginPlayback):
668         (MediaSessionManagerCocoa::removeSession):
669         (MediaSessionManagerCocoa::sessionWillEndPlayback):
670         (MediaSessionManagerCocoa::clientCharacteristicsChanged):
671         (MediaSessionManagerCocoa::updateNowPlayingInfo):
672         * platform/audio/ios/MediaSessionManagerIOS.mm:
673         (WebCore::MediaSessionManageriOS::resetRestrictions):
674         (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
675
676 2019-03-13  Chris Dumez  <cdumez@apple.com>
677
678         Drop legacy WebCore::toRegistrableDomain() utility function
679         https://bugs.webkit.org/show_bug.cgi?id=195637
680
681         Reviewed by Geoffrey Garen.
682
683         Drop legacy toRegistrableDomain() / registrableDomainAreEqual() utility functions.
684         Update call sites to use modern RegistrableDomain type instead.
685
686         * loader/CrossOriginAccessControl.cpp:
687         (WebCore::shouldCrossOriginResourcePolicyCancelLoad):
688         * loader/FrameLoader.cpp:
689         (WebCore::FrameLoader::setFirstPartyForCookies):
690         * page/DOMWindow.cpp:
691         (WebCore::DOMWindow::failedToRegisterDeviceMotionEventListener):
692         * platform/RegistrableDomain.h:
693         (WebCore::registrableDomainsAreEqual):
694         * platform/network/ResourceRequestBase.h:
695         * platform/network/cf/ResourceRequestCFNet.cpp:
696         * platform/network/cocoa/ResourceRequestCocoa.mm:
697
698 2019-03-13  Alex Christensen  <achristensen@webkit.org>
699
700         Prevent checked_cf_cast crashes in ResourceResponse::platformCertificateInfo
701         https://bugs.webkit.org/show_bug.cgi?id=195686
702
703         Reviewed by Tim Horton.
704
705         This covers up a type confusion bug on some OSes until rdar://problem/48853137 is resolved.
706
707         * SourcesCocoa.txt:
708         * WebCore.xcodeproj/project.pbxproj:
709         * platform/network/cocoa/ResourceResponseCocoa.mm:
710
711 2019-03-13  Thibault Saunier  <tsaunier@igalia.com>
712
713         [GStreamer][WebRTC] Add support for omxh264enc encoder
714         https://bugs.webkit.org/show_bug.cgi?id=195676
715
716         Reviewed by Philippe Normand.
717
718         * platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:
719         (setup_omxh264enc):
720         (set_bitrate_bit_per_sec):
721         (gst_webrtc_video_encoder_class_init):
722
723 2019-03-13  Antoine Quint  <graouts@apple.com>
724
725         REGRESSION(r240634): Element::hasPointerCapture() passes a JS-controlled value directly into a HashMap as a key
726         https://bugs.webkit.org/show_bug.cgi?id=195683
727         <rdar://problem/48659950>
728
729         Reviewed by Alex Christensen.
730
731         While PointerID is defined as int32_t, we now use int64_t as the key of the HashMap mapping PointerID to CapturingData so that we use
732         a value outside of the int32_t range as a safe empty and removed values, allowing any int32_t to be provided through the API for
733         lookup in this HashMap.
734
735         Test: pointerevents/pointer-id-crash.html
736
737         * page/PointerCaptureController.h:
738
739 2019-03-12  Brady Eidson  <beidson@apple.com>
740
741         Take UnboundedNetworking assertion when a file upload is in progress.
742         https://bugs.webkit.org/show_bug.cgi?id=195497
743
744         Reviewed by Geoff Garen.
745
746         * platform/network/ResourceRequestBase.cpp:
747         (WebCore::ResourceRequestBase::hasUpload const):
748         * platform/network/ResourceRequestBase.h:
749
750 2019-03-13  Youenn Fablet  <youenn@apple.com>
751
752         Enable libwebrtc logging control through WebCore
753         https://bugs.webkit.org/show_bug.cgi?id=195658
754
755         Reviewed by Eric Carlson.
756
757         Add support for WebCore logging of libwebrtc messages.
758         This is controlled by WebRTC log channel state and level.
759         In case of private browsing mode, any logging is disabled.
760         This will stay for the lifetime of the process.
761         No change of behavior.
762
763         * Modules/mediastream/RTCPeerConnection.cpp:
764         (WebCore::RTCPeerConnection::create):
765         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
766         (WebCore::doReleaseLogging):
767         (WebCore::setLogging):
768         (WebCore::computeLogLevel):
769         (WebCore::initializePeerConnectionFactoryAndThreads):
770         (WebCore::LibWebRTCProvider::setEnableLogging):
771         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
772
773 2019-03-13  Thibault Saunier  <tsaunier@igalia.com>
774
775         [GStreamer][WebRTC] Do not sync encoder on the clock
776         https://bugs.webkit.org/show_bug.cgi?id=195673
777
778         we should encode as fast as possible and totally ignore timestamp while
779         doing so.
780
781         Reviewed by Philippe Normand.
782
783         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
784         (WebCore::GStreamerVideoEncoder::InitEncode):
785
786 2019-03-13  Thibault Saunier  <tsaunier@igalia.com>
787
788         [GStreamer][WebRTC]: Use codec setting video height/width as fallback
789         https://bugs.webkit.org/show_bug.cgi?id=195675
790
791         Reviewed by Philippe Normand.
792
793         In some cases the frame height and width is not set (not sure why/ in
794         what conditions but it happens) so make sure to get the information from
795         the VideoCodec when configuring the encoder.
796
797         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
798         (WebCore::GStreamerVideoDecoder::GStreamerVideoDecoder):
799         (WebCore::GStreamerVideoDecoder::GetCapsForFrame):
800
801 2019-03-13  Miguel Gomez  <magomez@igalia.com>
802
803         [CoordinatedGraphics] Null dereference in CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded
804         https://bugs.webkit.org/show_bug.cgi?id=195615
805
806         Reviewed by Carlos Garcia Campos.
807
808         Exit early if we don't receive a valid coordinator.
809
810         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
811         (WebCore::CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded):
812
813 2019-03-13  Fujii Hironori  <Hironori.Fujii@sony.com>
814
815         [Win][PlayStation] Remove WebCore::standardUserAgentForURL
816         https://bugs.webkit.org/show_bug.cgi?id=195662
817
818         Reviewed by Ryosuke Niwa.
819
820         WebCore::standardUserAgentForURL is just a stub in Windows port.
821
822         No new tests because there is no behavior change.
823
824         * platform/win/UserAgentWin.cpp:
825         (WebCore::standardUserAgentForURL): Deleted.
826         * platform/playstation/UserAgentPlayStation.cpp:
827         (WebCore::standardUserAgentForURL): Deleted.
828
829 2019-03-12  Ross Kirsling  <ross.kirsling@sony.com>
830
831         [Win] Fix a slew of simple clang-cl warnings.
832         https://bugs.webkit.org/show_bug.cgi?id=195652
833
834         Reviewed by Don Olmstead.
835
836         * page/AutoscrollController.cpp:
837         (WebCore::AutoscrollController::handleMouseReleaseEvent): -Wswitch
838         * platform/network/curl/CurlContext.cpp:
839         (WebCore::CurlHandle::willSetupSslCtx):
840         (WebCore::CurlHandle::appendRequestHeaders): -Wunused-variable
841         * platform/network/curl/CurlFormDataStream.cpp:
842         (WebCore::CurlFormDataStream::computeContentLength): -Wunused-variable
843         * platform/network/curl/CurlRequest.cpp:
844         (WebCore::CurlRequest::CurlRequest): -Wreorder
845         (WebCore::CurlRequest::setupTransfer): -Wunused-variable
846         * platform/network/curl/CurlSSLVerifier.cpp:
847         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
848         * platform/network/curl/CurlSSLVerifier.h: -Wunused-private-field
849         * platform/win/LoggingWin.cpp:
850         (WebCore::logLevelString): -Wwritable-strings
851         * rendering/RenderThemeWin.cpp: -Wunused-const-variable (x2)
852         (WebCore::RenderThemeWin::getThemeData): -Wswitch
853
854 2019-03-12  Ryosuke Niwa  <rniwa@webkit.org>
855
856         Move the code for determining the need for touch bar quirks to Quirks class
857         https://bugs.webkit.org/show_bug.cgi?id=195654
858
859         Reviewed by Brent Fulgham.
860
861         Moved the code to determine whether the touch bar quirks are needed or not from WebKit2.
862
863         * WebCore.xcodeproj/project.pbxproj:
864         * page/Quirks.cpp:
865         (WebCore::Quirks::isTouchBarUpdateSupressedForHiddenContentEditable const):
866         (WebCore::Quirks::isNeverRichlyEditableForTouchBar const):
867         * page/Quirks.h:
868
869 2019-03-12  Justin Fan  <justin_fan@apple.com>
870
871         [Web GPU] Update GPURenderPipelineDescriptor and add GPUColorStateDescriptor.format
872         https://bugs.webkit.org/show_bug.cgi?id=195518
873         <rdar://problem/46322356>
874
875         Reviewed by Myles C. Maxfield.
876
877         Upgrade the implementation of GPURenderPipelineDescriptor and GPURenderPipeline and match the updated Web GPU API.
878         Add stubs for GPUColorStateDescriptor so attachment format can be provided by GPURenderPipelineDescriptor.
879
880         All affected Web GPU tests updated to cover existing behavior.
881
882         Update file names and symbols:
883         * CMakeLists.txt:
884         * DerivedSources-input.xcfilelist:
885         * DerivedSources-output.xcfilelist:
886         * DerivedSources.make:
887         * Sources.txt:
888         * WebCore.xcodeproj/project.pbxproj:
889         * bindings/js/WebCoreBuiltinNames.h:
890
891         Updates to GPURenderPipeline, GPURenderPipelineDescriptor, and its components:
892         * Modules/webgpu/GPUColorStateDescriptor.idl: Added. Provide the expected texture format of the render pipeline's color attachments.
893         * Modules/webgpu/GPUInputStateDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUInputStateDescriptor.idl.
894         * Modules/webgpu/GPUTextureFormat.idl: Update the existing values to match the new style.
895         * Modules/webgpu/GPUVertexAttributeDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUVertexAttributeDescriptor.idl.
896         * Modules/webgpu/GPUVertexInputDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUVertexInputDescriptor.idl.
897         * Modules/webgpu/WebGPUDevice.cpp:
898         (WebCore::WebGPUDevice::createPipelineLayout const): Remove unnecessary comment.
899         (WebCore::WebGPUDevice::createRenderPipeline const): Descriptor validation and conversion moved into WebGPURenderPipelineDescriptor.
900         (WebCore::validateAndConvertPipelineStage): Deleted.
901         * Modules/webgpu/WebGPUDevice.h: create* functions should not return nullable.
902         * Modules/webgpu/WebGPUIndexFormat.h: Removed. Moved into GPUInputStateDescriptor.idl.
903         * Modules/webgpu/WebGPUInputStateDescriptor.h: Removed.
904         * Modules/webgpu/WebGPUInputStepMode.idl: Removed. Moved into GPUVertexInputDescriptor.idl.
905         * Modules/webgpu/WebGPUPipelineLayout.h:
906         (WebCore::WebGPUPipelineLayout::pipelineLayout): Getters should return raw references.
907         * Modules/webgpu/WebGPUPipelineStageDescriptor.h: Now shares a common base with GPUPipelineStageDescriptor.
908         * Modules/webgpu/WebGPURenderPipeline.cpp:
909         (WebCore::WebGPURenderPipeline::create):
910         (WebCore::WebGPURenderPipeline::WebGPURenderPipeline):
911         * Modules/webgpu/WebGPURenderPipeline.h:  Now internally nullable.
912         (WebCore::WebGPURenderPipeline::renderPipeline const):
913         (WebCore::WebGPURenderPipeline::renderPipeline): Deleted.
914         * Modules/webgpu/WebGPURenderPipelineDescriptor.cpp:
915         (WebCore::WebGPUPipelineStageDescriptor::asGPUPipelineStageDescriptor const): Validate and convert a WebGPUPipelineStageDescriptor to GPU version.
916         (WebCore::WebGPURenderPipelineDescriptor::asGPURenderPipelineDescriptor const): Ditto for WebGPURenderPipelineDescriptor.
917         * Modules/webgpu/WebGPURenderPipelineDescriptor.h: Now shares a base class and some instance variables with GPURenderPipelineDescriptor.
918         * Modules/webgpu/WebGPURenderPipelineDescriptor.idl: Update GPUPrimitiveTopology for new style and add colorStates.
919         * Modules/webgpu/WebGPUShaderModule.idl: Small pilot to test using InterfaceName to easily rename DOM-facing interfaces.
920         * Modules/webgpu/WebGPUVertexAttributeDescriptor.h: Removed.
921         * Modules/webgpu/WebGPUVertexFormat.idl: Removed. Moved and updated in GPUVertexAttributeDescriptor.idl.
922         * Modules/webgpu/WebGPUVertexInputDescriptor.h: Removed.
923         * platform/graphics/gpu/GPUInputStateDescriptor.h:
924         * platform/graphics/gpu/GPUPipelineStageDescriptor.h:
925         (WebCore::GPUPipelineStageDescriptor::GPUPipelineStageDescriptor):
926         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Add shared base class for Web/GPURenderPipelineDescriptor.
927         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
928         * platform/graphics/gpu/GPUTextureFormat.h:
929         * platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
930         * platform/graphics/gpu/GPUVertexInputDescriptor.h:
931         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
932         (WebCore::setFunctionsForPipelineDescriptor): Make fragment required since descriptor validation fails if fragment function is not found right now.
933         (WebCore::mtlVertexFormatForGPUVertexFormat): Renamed from validateAndConvertVertexFormatToMTLVertexFormat.
934         (WebCore::mtlStepFunctionForGPUInputStepMode): Renamed from validateAndConvertStepModeToMTLStepFunction
935         (WebCore::trySetInputStateForPipelineDescriptor):
936         (WebCore::trySetColorStatesForColorAttachmentArray):
937         (WebCore::tryCreateMtlRenderPipelineState):
938         (WebCore::GPURenderPipeline::create):
939         (WebCore::validateAndConvertVertexFormatToMTLVertexFormat): Deleted.
940         (WebCore::validateAndConvertStepModeToMTLStepFunction): Deleted.
941         * platform/graphics/gpu/cocoa/GPUUtilsMetal.mm:
942         (WebCore::platformTextureFormatForGPUTextureFormat):
943         * platform/graphics/gpu/GPUColorStateDescriptor.h: Added.
944
945         Misc:
946         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
947         (WebCore::WebGPUProgrammablePassEncoder::setPipeline):
948         * Modules/webgpu/WebGPUProgrammablePassEncoder.h:
949         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
950         * platform/graphics/gpu/GPURenderPassEncoder.h:
951         * platform/graphics/gpu/GPURenderPipeline.h:
952         (WebCore::GPURenderPipeline::primitiveTopology const):
953         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
954         (WebCore::GPURenderPassEncoder::setPipeline):
955         (WebCore::primitiveTypeForGPUPrimitiveTopology):
956        
957 2019-03-12  Zalan Bujtas  <zalan@apple.com>
958
959         [ContentChangeObserver] Reset state when touchStart does not turn into click.
960         https://bugs.webkit.org/show_bug.cgi?id=195603
961         <rdar://problem/48796582>
962
963         Reviewed by Simon Fraser.
964
965         Add reset() function to assert and reset the current state.
966
967         * page/ios/ContentChangeObserver.cpp:
968         (WebCore::ContentChangeObserver::willNotProceedWithClick):
969         (WebCore::ContentChangeObserver::adjustObservedState):
970         * page/ios/ContentChangeObserver.h:
971
972 2019-03-12  Timothy Hatcher  <timothy@apple.com>
973
974         Expose document attributes and body background color through HTMLConverter.
975         https://bugs.webkit.org/show_bug.cgi?id=195636
976         rdar://problem/45055697
977
978         Reviewed by Tim Horton.
979
980         * editing/cocoa/HTMLConverter.h:
981         * editing/cocoa/HTMLConverter.mm:
982         (HTMLConverter::convert):
983         (WebCore::attributedStringFromRange):
984         (WebCore::attributedStringFromSelection):
985         (WebCore::attributedStringBetweenStartAndEnd):
986
987 2019-03-12  Antti Koivisto  <antti@apple.com>
988
989         Compositing layer that renders two positioned elements should not hit test
990         https://bugs.webkit.org/show_bug.cgi?id=195371
991         <rdar://problem/48649586>
992
993         Reviewed by Simon Fraser.
994
995         Followup to fix the test case (fast/scrolling/ios/overflow-scroll-overlap-2.html)
996
997         * platform/graphics/ca/GraphicsLayerCA.cpp:
998         (WebCore::GraphicsLayerCA::setEventRegion):
999
1000         Revert a last minute change (that was done to fix a Mac displaylist test).
1001
1002         * rendering/RenderLayerBacking.cpp:
1003         (WebCore::RenderLayerBacking::paintIntoLayer):
1004
1005         Compute the region on iOS only for now (it is not used on other platforms).
1006
1007 2019-03-12  Dean Jackson  <dino@apple.com>
1008
1009         [WebGL] WebGLBuffer can be too large
1010         https://bugs.webkit.org/show_bug.cgi?id=195068
1011         <rdar://problem/48414289>
1012
1013         Reviewed by Antoine Quint.
1014
1015         When creating an element array buffer, make sure to
1016         test against the maximum size of an ArrayBuffer, rather
1017         than just assume it can be created.
1018
1019         Test: fast/canvas/webgl/largeBuffer.html
1020
1021         * html/canvas/WebGLBuffer.cpp:
1022         (WebCore::WebGLBuffer::associateBufferDataImpl):
1023
1024 2019-03-12  Sihui Liu  <sihui_liu@apple.com>
1025
1026         Layout Test imported/w3c/web-platform-tests/IndexedDB/fire-*-event-exception.html are failing
1027         https://bugs.webkit.org/show_bug.cgi?id=195581
1028
1029         Reviewed by Brady Eidson.
1030
1031         Uncaught exceptions should be handled after IDBRequest dispatches events so that IDBTransaction would stay 
1032         active during event dispatch.
1033
1034         * Modules/indexeddb/IDBRequest.cpp:
1035         (WebCore::IDBRequest::dispatchEvent):
1036         (WebCore::IDBRequest::uncaughtExceptionInEventHandler):
1037         * Modules/indexeddb/IDBRequest.h:
1038
1039 2019-03-12  Sihui Liu  <sihui_liu@apple.com>
1040
1041         Layout Test imported/w3c/web-platform-tests/IndexedDB/transaction-abort-request-error.html is failing
1042         https://bugs.webkit.org/show_bug.cgi?id=195570
1043
1044         Reviewed by Brady Eidson.
1045
1046         IDBRequest result should be undefined if it is never set.
1047
1048         * Modules/indexeddb/IDBRequest.cpp:
1049         (WebCore::IDBRequest::IDBRequest):
1050
1051 2019-03-12  Youenn Fablet  <youenn@apple.com>
1052
1053         Rename originsMatch in originSerializationsMatch
1054         https://bugs.webkit.org/show_bug.cgi?id=195572
1055
1056         Reviewed by Jiewen Tan.
1057
1058         In addition to renaming, make use of SecurityOrigin::isSameOriginAs
1059         where it makes more sense than to compare origin serialization.
1060         The main difference is that isSameOriginAs will return false for two different unique origins
1061         while originsSerializationsMatch will not.
1062
1063         * Modules/credentialmanagement/CredentialsContainer.cpp:
1064         (WebCore::CredentialsContainer::doesHaveSameOriginAsItsAncestors):
1065         * Modules/mediastream/RTCController.cpp:
1066         (WebCore::matchDocumentOrigin):
1067         * Modules/mediastream/RTCPeerConnection.cpp:
1068         (WebCore::RTCPeerConnection::certificatesFromConfiguration):
1069         * loader/DocumentLoader.cpp:
1070         (WebCore::DocumentLoader::shouldOpenExternalURLsPolicyToPropagate const):
1071         * loader/cache/CachedResourceLoader.cpp:
1072         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
1073         * page/SecurityOrigin.cpp:
1074         (WebCore::serializedOriginsMatch):
1075         (WebCore::originsMatch): Deleted.
1076         * page/SecurityOrigin.h:
1077
1078 2019-03-12  Zalan Bujtas  <zalan@apple.com>
1079
1080         [Synthetic Click] Dispatch mouseout soon after mouseup
1081         https://bugs.webkit.org/show_bug.cgi?id=195575
1082         <rdar://problem/47093049>
1083
1084         Reviewed by Simon Fraser.
1085
1086         Let's fire a mouseout event when a click is submitted as the result of a tap. It helps to dismiss content which would otherwise require you to move the mouse (cases like control bar on youtube.com).
1087
1088         Test: fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click.html
1089
1090         * page/EventHandler.h:
1091         * page/ios/EventHandlerIOS.mm:
1092         (WebCore::EventHandler::dispatchFakeMouseOut):
1093
1094 2019-03-12  Ryosuke Niwa  <rniwa@webkit.org>
1095
1096         In CachedFrame's constructor, release-assert that DOMWindow still has a frame after page-caching subframes
1097         https://bugs.webkit.org/show_bug.cgi?id=195609
1098
1099         Reviewed by Chris Dumez.
1100
1101         r242677 added release assertions to DOMWindow::suspendForPageCache. But when the first release assert in
1102         that function is hit, we still can't tell whether active DOM objects are detaching frames, or if creating
1103         CachedFrame's on one of subframes is causing the frame to go way.
1104
1105         Add a release assertion immediately after creating CachedFrame on subframes to detect this case.
1106
1107         * history/CachedFrame.cpp:
1108         (WebCore::CachedFrame::CachedFrame):
1109
1110 2019-03-12  Zalan Bujtas  <zalan@apple.com>
1111
1112         [ContentChangeObserver] Stop content change observation when the touch event turns into long press
1113         https://bugs.webkit.org/show_bug.cgi?id=195601
1114         <rdar://problem/48796324>
1115
1116         Reviewed by Wenson Hsieh.
1117
1118         Cancel the ongoing content observation (started at touchStart) when the touch event does not turn into a tap gesture.
1119
1120         Not testable because any subsequent tap would reset the state anyway (though it might be measurable through some code triggering heavy content change).
1121
1122         * page/ios/ContentChangeObserver.cpp:
1123         (WebCore::ContentChangeObserver::didRecognizeLongPress):
1124         (WebCore::ContentChangeObserver::willNotProceedWithClick):
1125         * page/ios/ContentChangeObserver.h:
1126
1127 2019-03-12  Antti Koivisto  <antti@apple.com>
1128
1129         Compositing layer that renders two positioned elements should not hit test
1130         https://bugs.webkit.org/show_bug.cgi?id=195371
1131         <rdar://problem/48649586>
1132
1133         Reviewed by Simon Fraser.
1134
1135         Compute and pass an event region for layers if it differs from layer bounds.
1136
1137         This patch fixes various block overflow and layer expansion cases. It does not handle
1138         overflowing line boxes yet (it adds tests for those too).
1139
1140         Test: fast/scrolling/ios/overflow-scroll-overlap-2.html
1141
1142         * platform/graphics/GraphicsLayer.cpp:
1143         (WebCore::GraphicsLayer::setEventRegion):
1144         * platform/graphics/GraphicsLayer.h:
1145         (WebCore::GraphicsLayer::eventRegion):
1146         * platform/graphics/Region.h:
1147         * platform/graphics/ca/GraphicsLayerCA.cpp:
1148         (WebCore::GraphicsLayerCA::setEventRegion):
1149         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
1150         (WebCore::GraphicsLayerCA::updateEventRegion):
1151
1152         Pass the region via the main platform layer of the graphics layer.
1153
1154         * platform/graphics/ca/GraphicsLayerCA.h:
1155         * platform/graphics/ca/PlatformCALayer.h:
1156         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
1157         * rendering/PaintInfo.h:
1158         * rendering/PaintPhase.h:
1159
1160         Add EventRegion paint phase that computes the region instead of painting anything.
1161
1162         * rendering/RenderBlock.cpp:
1163         (WebCore::RenderBlock::paintObject):
1164         * rendering/RenderLayer.cpp:
1165         (WebCore::RenderLayer::paintForegroundForFragments):
1166         (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
1167
1168         Invoke EventRegion paint phase.
1169
1170         * rendering/RenderLayer.h:
1171         * rendering/RenderLayerBacking.cpp:
1172         (WebCore::RenderLayerBacking::paintIntoLayer):
1173
1174         Request event region when pointing a layer.
1175
1176 2019-03-12  Philippe Normand  <pnormand@igalia.com>
1177
1178         [GStreamer][v4l2] Synchronous video texture flushing support
1179         https://bugs.webkit.org/show_bug.cgi?id=195453
1180
1181         Reviewed by Xabier Rodriguez-Calvar.
1182
1183         The v4l2 video decoder currently requires that downstream users of
1184         the graphics resources complete any pending draw call and release
1185         resources before returning from the DRAIN query.
1186
1187         To accomplish this the player monitors the pipeline and whenever a
1188         v4l2 decoder is added, synchronous video texture flushing support
1189         is enabled. Additionally and for all decoder configurations, a
1190         flush is performed before disposing of the player.
1191
1192         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1193         (WebCore::MediaPlayerPrivateGStreamer::playbinDeepElementAddedCallback):
1194         Monitor elements added to the decodebin bin.
1195         (WebCore::MediaPlayerPrivateGStreamer::decodebinElementAdded): Set
1196         a flag if a v4l2 decoder was added in decodebin.
1197         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Connect
1198         to the deep-element-added signal so as to monitor pipeline
1199         topology updates.
1200         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1201         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1202         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
1203         Flush video texture before disposing of the player.
1204         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
1205         Synchronously flush if the pipeline contains a v4l2 decoder.
1206         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink): Monitor push events only.
1207         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1208         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
1209         (WebCore::TextureMapperPlatformLayerProxy::pushNextBuffer): New
1210         boolean flag used mostly to trigger synchronous flush conditions.
1211         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
1212         Optionally drop the current buffer in a synchronous manner. By
1213         default the method keeps operating asynchronously.
1214         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
1215
1216 2019-03-12  Ryosuke Niwa  <rniwa@webkit.org>
1217
1218         Move the remaining code to decide whether site specific quirks are needed to Quirks class
1219         https://bugs.webkit.org/show_bug.cgi?id=195610
1220
1221         Reviewed by Antti Koivisto.
1222
1223         Moved the remaining code scattered across WebCore to decide whether a site specific quirk
1224         is needed or not to Quirks class introduced in r236818.
1225
1226         * Modules/fetch/FetchRequest.cpp:
1227         (WebCore::needsSignalQuirk): Deleted.
1228         (WebCore::processInvalidSignal):
1229         * html/HTMLFormControlElement.cpp:
1230         (WebCore::HTMLFormControlElement::needsMouseFocusableQuirk const):
1231         * html/HTMLMediaElement.cpp:
1232         (WebCore::needsAutoplayPlayPauseEventsQuirk): Deleted.
1233         (WebCore::HTMLMediaElement::dispatchPlayPauseEventsIfNeedsQuirks):
1234         (WebCore::needsSeekingSupportQuirk): Deleted.
1235         (WebCore::HTMLMediaElement::supportsSeeking const):
1236         * html/MediaElementSession.cpp:
1237         (WebCore::needsArbitraryUserGestureAutoplayQuirk): Deleted.
1238         (WebCore::needsPerDocumentAutoplayBehaviorQuirk): Deleted.
1239         (WebCore::MediaElementSession::playbackPermitted const):
1240         * page/Quirks.cpp:
1241         (WebCore::allowedAutoplayQuirks): Added.
1242         (WebCore::Quirks::needsQuirks const): Added.
1243         (WebCore::Quirks::shouldIgnoreInvalidSignal const): Added.
1244         (WebCore::Quirks::needsFormControlToBeMouseFocusable const): Added.
1245         (WebCore::Quirks::needsAutoplayPlayPauseEvents const): Added.
1246         (WebCore::Quirks::needsSeekingSupportDisabled const): Addd.
1247         (WebCore::Quirks::needsPerDocumentAutoplayBehavior const): Added.
1248         (WebCore::Quirks::shouldAutoplayForArbitraryUserGesture const): Added.
1249         (WebCore::Quirks::hasBrokenEncryptedMediaAPISupportQuirk const): Added.
1250         (WebCore::Quirks::hasWebSQLSupportQuirk const): Fixed the coding style.
1251         * page/Quirks.h:
1252
1253 2019-03-12  Enrique Ocaña González  <eocanha@igalia.com>
1254
1255         [Media][MSE] Don't emit timeUpdate after play() if currentTime hasn't changed
1256         https://bugs.webkit.org/show_bug.cgi?id=195454
1257
1258         Reviewed by Jer Noble.
1259
1260         This change fixes YouTube 2019 MSE Conformance Tests "26. SFRPausedAccuracy"
1261         and "27. HFRPausedAccuracy".
1262
1263         The first timeUpdate event after play() is omitted, because currentTime
1264         doesn't actually change in that scenario.
1265
1266         Tests 26 and 27 measure the time drift (real time vs. media time) on playback
1267         and start counting since the first timeUpdate event. In WebKit, that event
1268         happens at play(), before the pipeline has completed the transition to playing.
1269         Therefore, the real time inherits this startup delay and the test thinks that
1270         the player has drifted.
1271
1272         * html/HTMLMediaElement.cpp:
1273         (WebCore::HTMLMediaElement::playInternal): Don't emit a timeUpdated event unless currentTime has changed.
1274
1275 2019-03-12  Enrique Ocaña González  <eocanha@igalia.com>
1276
1277         [EME][GStreamer] Speculative build fix
1278         https://bugs.webkit.org/show_bug.cgi?id=195614
1279
1280         Unreviewed speculative WPE build fix after r242776.
1281
1282         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h: Added missing include.
1283
1284 2019-03-12  Philippe Normand  <pnormand@igalia.com>
1285
1286         [GStreamer] remove legacy GStreamer version checks
1287         https://bugs.webkit.org/show_bug.cgi?id=195552
1288
1289         Reviewed by Xabier Rodriguez-Calvar.
1290
1291         We require GStreamer 1.8.x so version checks below that make
1292         little sense. Also checks for odd minor version numbers make sense
1293         only for the latest GStreamer git development version.
1294
1295         * platform/graphics/gstreamer/GStreamerCommon.cpp:
1296         (WebCore::initializeGStreamerAndRegisterWebKitElements):
1297         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1298         (WebCore::MediaPlayerPrivateGStreamer::createAudioSink):
1299         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
1300         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1301         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
1302
1303 2019-03-12  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1304
1305         [EME] generateRequest was not using the sanitized init data
1306         https://bugs.webkit.org/show_bug.cgi?id=195555
1307
1308         Reviewed by Jer Noble.
1309
1310         * Modules/encryptedmedia/MediaKeySession.cpp:
1311         (WebCore::MediaKeySession::generateRequest): Use sanitized init
1312         data instead of the original one.
1313
1314 2019-03-12  Rob Buis  <rbuis@igalia.com>
1315
1316         Implement further CORS restrictions
1317         https://bugs.webkit.org/show_bug.cgi?id=188644
1318
1319         Reviewed by Darin Adler.
1320
1321         Verify that header value length is not greater than 128 [1]. Also implement
1322         Step 5 of [2] to append values to existing header value when calling
1323         Headers.append.
1324
1325         Tests: fetch/api/cors/cors-preflight-not-cors-safelisted.any.html
1326                fetch/api/cors/cors-preflight-not-cors-safelisted.any.worker.html
1327                fetch/api/headers/headers-no-cors.window.html
1328
1329         [1] https://fetch.spec.whatwg.org/#cors-safelisted-request-header
1330         [2] https://fetch.spec.whatwg.org/#concept-headers-append
1331
1332         * Modules/fetch/FetchHeaders.cpp:
1333         (WebCore::canWriteHeader):
1334         (WebCore::appendToHeaderMap):
1335         (WebCore::FetchHeaders::remove):
1336         (WebCore::FetchHeaders::set):
1337         (WebCore::FetchHeaders::filterAndFill):
1338         * platform/network/HTTPParsers.cpp:
1339         (WebCore::isCrossOriginSafeRequestHeader): verify that header length is not greater than 128
1340
1341 2019-03-11  Ryosuke Niwa  <rniwa@webkit.org>
1342
1343         Remove OS X Server QuickTime plugin quirks
1344         https://bugs.webkit.org/show_bug.cgi?id=195607
1345
1346         Reviewed by Brent Fulgham.
1347
1348         r87244 added a site specific quirk for Mac OS X Sever wiki pages.
1349         However, the issue has since been resolved as of OS X Mountain Lion,
1350         of which Apple has ended the support in September 2015.
1351
1352         Because the latest versions of Safari no longer supports non-Flash plugins,
1353         the only scenario in which this quirk comes into play is when a third party app
1354         which embeds WKWebView or WebKitLegacy loaded web pages on a OS X Server
1355         running OS X Mountain Lion or earlier.
1356
1357         Given these observations, it's probably safe to remove this quirk from WebKit.
1358
1359         * html/HTMLObjectElement.cpp:
1360         (WebCore::HTMLObjectElement::hasFallbackContent const):
1361         (WebCore::HTMLObjectElement::hasValidClassId):
1362         (WebCore::HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk): Deleted.
1363         * html/HTMLObjectElement.h:
1364
1365 2019-03-11  Ross Kirsling  <ross.kirsling@sony.com>
1366
1367         Unreviewed speculative WPE build fix after r195586.
1368
1369         * platform/encryptedmedia/CDMInstance.h:
1370
1371 2019-03-12  Ryosuke Niwa  <rniwa@webkit.org>
1372
1373         Remove MediaWiki site specific quirks
1374         https://bugs.webkit.org/show_bug.cgi?id=195597
1375
1376         Reviewed by Simon Fraser.
1377
1378         r47383 added a site specific quirk for the KHTML workaround in MediaWiki.
1379
1380         Blink since removed this workaround:
1381         https://github.com/chromium/chromium/commit/ecf84fc9c1a51c8ede7adfd0b0cba446d9a8caa0
1382
1383         Given Chrome has been shipping without this quirk for six years, it's safe to assume
1384         this site specific quirk is no longer neeed for Web compatibility.
1385
1386         * css/StyleSheetContents.cpp:
1387         (WebCore::StyleSheetContents::parseAuthorStyleSheet):
1388         * css/parser/CSSParserContext.cpp:
1389         (WebCore::CSSParserContext::CSSParserContext):
1390         (WebCore::operator==):
1391         * css/parser/CSSParserContext.h:
1392         (WebCore::CSSParserContextHash::hash):
1393
1394 2019-03-11  Ryosuke Niwa  <rniwa@webkit.org>
1395
1396         Remove OpenCube QuickMenu quirks from navigator.appVersion
1397         https://bugs.webkit.org/show_bug.cgi?id=195600
1398
1399         Reviewed by Simon Fraser.
1400
1401         Remove the site specific quirk added in r35050 for OpenCube QuickMenu library for nwa.com
1402
1403         Blink removed this code back in 2013. The fact Chrome has been shipping successfully without
1404         this quirk for six years is a good evidence that it's no longer needed for the Web compatibility.
1405
1406         * page/Navigator.cpp:
1407         (WebCore::Navigator::appVersion const):
1408         (WebCore::shouldHideFourDot): Deleted.
1409
1410 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
1411
1412         Unreviewed, rolling out r242763.
1413
1414         Causes layout test crashes on iOS simulator
1415
1416         Reverted changeset:
1417
1418         "[Synthetic Click] Dispatch mouseout soon after mouseup"
1419         https://bugs.webkit.org/show_bug.cgi?id=195575
1420         https://trac.webkit.org/changeset/242763
1421
1422 2019-03-11  Ross Kirsling  <ross.kirsling@sony.com>
1423
1424         Add Optional to Forward.h.
1425         https://bugs.webkit.org/show_bug.cgi?id=195586
1426
1427         Reviewed by Darin Adler.
1428
1429         * Modules/encryptedmedia/MediaKeyStatusMap.cpp:
1430         * Modules/encryptedmedia/MediaKeyStatusMap.h:
1431         * Modules/webauthn/apdu/ApduCommand.cpp:
1432         * Modules/webauthn/apdu/ApduCommand.h:
1433         * Modules/webauthn/apdu/ApduResponse.cpp:
1434         * Modules/webauthn/apdu/ApduResponse.h:
1435         * Modules/webauthn/fido/FidoHidMessage.cpp:
1436         * Modules/webauthn/fido/FidoHidMessage.h:
1437         * Modules/webauthn/fido/U2fCommandConstructor.cpp:
1438         * Modules/webauthn/fido/U2fCommandConstructor.h:
1439         * Modules/webdatabase/SQLTransaction.cpp:
1440         * Modules/webdatabase/SQLTransaction.h:
1441         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
1442         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h:
1443         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.h:
1444         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
1445         * Modules/webgpu/WHLSL/WHLSLPrepare.h:
1446         * Modules/webgpu/WebGPU.cpp:
1447         * Modules/webgpu/WebGPU.h:
1448         * Modules/webgpu/WebGPUCommandBuffer.cpp:
1449         * Modules/webgpu/WebGPUCommandBuffer.h:
1450         * animation/WebAnimation.cpp:
1451         * animation/WebAnimation.h:
1452         * crypto/gcrypt/GCryptUtilities.cpp:
1453         * crypto/gcrypt/GCryptUtilities.h:
1454         * css/CSSStyleDeclaration.cpp:
1455         * css/CSSStyleDeclaration.h:
1456         * dom/TextDecoder.cpp:
1457         * dom/TextDecoder.h:
1458         * dom/UserGestureIndicator.cpp:
1459         * dom/UserGestureIndicator.h:
1460         * editing/ChangeListTypeCommand.cpp:
1461         * editing/ChangeListTypeCommand.h:
1462         * editing/EditingStyle.cpp:
1463         * editing/EditingStyle.h:
1464         * html/DOMFormData.cpp:
1465         * html/DOMFormData.h:
1466         * html/HTMLAllCollection.cpp:
1467         * html/HTMLAllCollection.h:
1468         * html/HTMLAnchorElement.cpp:
1469         * html/HTMLAnchorElement.h:
1470         * html/ImageBitmap.cpp:
1471         * html/ImageBitmap.h:
1472         * html/canvas/Path2D.h:
1473         * html/canvas/WebMetalEnums.cpp:
1474         * html/canvas/WebMetalEnums.h:
1475         * html/parser/HTMLParserIdioms.cpp:
1476         * html/parser/HTMLParserIdioms.h:
1477         * loader/ResourceCryptographicDigest.cpp:
1478         * loader/ResourceCryptographicDigest.h:
1479         * mathml/MathMLOperatorDictionary.cpp:
1480         * mathml/MathMLOperatorDictionary.h:
1481         * page/PerformanceEntry.cpp:
1482         * page/PerformanceEntry.h:
1483         * page/ResourceUsageData.h:
1484         * platform/ReferrerPolicy.cpp:
1485         * platform/ReferrerPolicy.h:
1486         * platform/Theme.cpp:
1487         * platform/Theme.h:
1488         * platform/encryptedmedia/CDMInstance.h:
1489         * platform/graphics/gpu/GPUDevice.cpp:
1490         * platform/graphics/gpu/GPUDevice.h:
1491         * platform/graphics/transforms/AffineTransform.cpp:
1492         * platform/graphics/transforms/AffineTransform.h:
1493         * platform/graphics/transforms/TransformState.cpp:
1494         * platform/graphics/transforms/TransformState.h:
1495         * platform/graphics/transforms/TransformationMatrix.cpp:
1496         * platform/graphics/transforms/TransformationMatrix.h:
1497         * platform/graphics/win/ImageDecoderDirect2D.cpp:
1498         * platform/graphics/win/ImageDecoderDirect2D.h:
1499         * platform/mediacapabilities/AudioConfiguration.h:
1500         * platform/network/CacheValidation.cpp:
1501         * platform/network/CacheValidation.h:
1502         * platform/network/DataURLDecoder.cpp:
1503         * platform/network/DataURLDecoder.h:
1504         * platform/network/HTTPParsers.cpp:
1505         * platform/network/HTTPParsers.h:
1506         * platform/network/curl/CookieJarDB.cpp:
1507         * platform/network/curl/CookieJarDB.h:
1508         * platform/win/SearchPopupMenuDB.cpp:
1509         * platform/win/SearchPopupMenuDB.h:
1510         * rendering/ImageQualityController.cpp:
1511         * rendering/ImageQualityController.h:
1512         * svg/SVGToOTFFontConversion.cpp:
1513         * svg/SVGToOTFFontConversion.h:
1514         Remove unnecessary includes from headers.
1515
1516 2019-03-11  Jer Noble  <jer.noble@apple.com>
1517
1518         REGRESSION(r236281): YouTube Movies fail with "video format" error
1519         https://bugs.webkit.org/show_bug.cgi?id=195598
1520         <rdar://problem/48782842>
1521
1522         Reviewed by Jon Lee.
1523
1524         Partially revert r236281 for YouTube.com.
1525
1526         * page/Quirks.cpp:
1527         (WebCore::Quirks::hasBrokenEncryptedMediaAPISupportQuirk const):
1528
1529 2019-03-11  Justin Fan  <justin_fan@apple.com>
1530
1531         [Web GPU] BindGroups/Argument buffers: Move MTLBuffer creation from and GPUBindGroup validation to GPUDevice.createBindGroup
1532         https://bugs.webkit.org/show_bug.cgi?id=195519
1533         <rdar://problem/48781297>
1534
1535         Reviewed by Myles C. Maxfield.
1536
1537         Metal's Argument Buffers should not be tied directly to GPUBindGroupLayout; rather, create the MTLBuffer 
1538         in GPUBindGroup creation process.
1539         Move GPUBindGroup validation out of setBindGroup and to GPUBindGroup creation for performance.
1540
1541         Covered by existing tests. No behavior change.
1542
1543         * Modules/webgpu/WebGPUDevice.cpp:
1544         (WebCore::WebGPUDevice::createBindGroup const):
1545         * Sources.txt:
1546         * SourcesCocoa.txt:
1547         * WebCore.xcodeproj/project.pbxproj:
1548         * platform/graphics/gpu/GPUBindGroup.cpp: Removed.
1549         * platform/graphics/gpu/GPUBindGroup.h:
1550         (WebCore::GPUBindGroup::vertexArgsBuffer): A buffer that arguments will be encoded into during setBindGroup.
1551         (WebCore::GPUBindGroup::fragmentArgsBuffer): Ditto.
1552         (WebCore::GPUBindGroup::boundBuffers const): A list of resources that are bound by this GPUBindGroup.
1553         (WebCore::GPUBindGroup::boundTextures const): Ditto.
1554         (WebCore::GPUBindGroup::layout const): Deleted.
1555         (WebCore::GPUBindGroup::bindings const): Deleted.
1556         * platform/graphics/gpu/GPUBindGroupLayout.h: No longer creating and retaining MTLBuffers.
1557         (WebCore::GPUBindGroupLayout::vertexEncoder const):
1558         (WebCore::GPUBindGroupLayout::fragmentEncoder const):
1559         (WebCore::GPUBindGroupLayout::computeEncoder const):
1560         (WebCore::GPUBindGroupLayout::ArgumentEncoderBuffer::isValid const): Deleted.
1561         (WebCore::GPUBindGroupLayout::vertexArguments const): Deleted.
1562         (WebCore::GPUBindGroupLayout::fragmentArguments const): Deleted.
1563         (WebCore::GPUBindGroupLayout::computeArguments const): Deleted.
1564         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
1565         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
1566         (WebCore::tryCreateMtlArgumentEncoder):
1567         (WebCore::GPUBindGroupLayout::tryCreate):
1568         (WebCore::GPUBindGroupLayout::GPUBindGroupLayout):
1569         (WebCore::tryCreateArgumentEncoderAndBuffer): Deleted.
1570         * platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm: Added.
1571         (WebCore::tryCreateArgumentBuffer): Create and associate the MTLBuffer that backs the MTLArgumentEncoder.
1572         (WebCore::tryGetResourceAsBufferBinding): Validate a GPUBindingResource.
1573         (WebCore::trySetBufferOnEncoder): Encodes a GPUBufferBinding's MTLBuffer on a MTLArgumentEncoder.
1574         (WebCore::tryGetResourceAsSampler): Ditto, for GPUSamplers.
1575         (WebCore::trySetSamplerOnEncoder):
1576         (WebCore::tryGetResourceAsTexture): Ditto, for GPUTextures.
1577         (WebCore::trySetTextureOnEncoder):
1578         (WebCore::GPUBindGroup::tryCreate): Most setBindGroup validation moved here.
1579         (WebCore::GPUBindGroup::GPUBindGroup): Retains the resource references needed for setBindGroup. 
1580         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
1581         (WebCore::GPUProgrammablePassEncoder::setBindGroup): Most validation moved to GPUBindGroup::tryCreate().
1582         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder): Deleted.
1583         (WebCore::GPUProgrammablePassEncoder::setResourceAsSamplerOnEncoder): Deleted.
1584         (WebCore::GPUProgrammablePassEncoder::setResourceAsTextureOnEncoder): Deleted.
1585         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
1586         (WebCore::GPURenderPassEncoder::useResource):
1587         (WebCore::GPURenderPassEncoder::setVertexBuffer):
1588         (WebCore::GPURenderPassEncoder::setFragmentBuffer):
1589
1590         Misc:
1591         * platform/graphics/gpu/GPUCommandBuffer.cpp/h: Move missing includes to header.
1592
1593 2019-03-11  Zalan Bujtas  <zalan@apple.com>
1594
1595         [Synthetic Click] Dispatch mouseout soon after mouseup
1596         https://bugs.webkit.org/show_bug.cgi?id=195575
1597         <rdar://problem/47093049>
1598
1599         Reviewed by Simon Fraser.
1600
1601         Let's fire a mouseout event when a click is submitted as the result of a tap. It helps to dismiss content which would otherwise require you to move the mouse (cases like control bar on youtube.com).
1602
1603         Test: fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click.html
1604
1605         * page/EventHandler.h:
1606         * page/ios/EventHandlerIOS.mm:
1607         (WebCore::EventHandler::dispatchFakeMouseOut):
1608
1609 2019-03-11  Youenn Fablet  <youenn@apple.com>
1610
1611         REGRESSION: (r242181) API test DragAndDropTests.ExternalSourcePlainTextToIFrame is Timing out
1612         https://bugs.webkit.org/show_bug.cgi?id=195362
1613
1614         Reviewed by Alexey Proskuryakov.
1615
1616         Covered by API test no longer crashing.
1617
1618         * page/SecurityOrigin.cpp:
1619         (WebCore::originsMatch):
1620         String representation should only match if originsMatch returns true.
1621
1622 2019-03-11  Justin Fan  <justin_fan@apple.com>
1623
1624         [Web GPU] Update GPUSwapChainDescriptor, GPUSwapChain and implement GPUCanvasContext
1625         https://bugs.webkit.org/show_bug.cgi?id=194406
1626         <rdar://problem/47892466>
1627
1628         Reviewed by Myles C. Maxfield.
1629
1630         GPUSwapChain no longer inherits from GPUBasedRenderingContext, and is now created from a GPUDevice. 
1631         WebGPURenderingContext is now GPUCanvasContext and delegates functionality to the GPUSwapChain, if it exists. 
1632         GPUQueue now implicitly presents the GPUSwapChain's current drawable at the task boundary, if one exists.
1633         Creating a new GPUSwapChain with the same GPUCanvasContext invalidates the previous one and its drawable and pipeline attachments.
1634         Calling GPUSwapChain::getCurrentTexture returns the same drawable within one task cycle. 
1635         Some mentions of "WebGPU" have been renamed to "Web GPU" and "gpu".
1636
1637         All Web GPU tests updated to match.
1638
1639         Add new files and symbols.
1640         * CMakeLists.txt:
1641         * DerivedSources-input.xcfilelist:
1642         * DerivedSources-output.xcfilelist:
1643         * DerivedSources.make:
1644         * Sources.txt:
1645         * WebCore.xcodeproj/project.pbxproj:
1646         * bindings/js/WebCoreBuiltinNames.h:
1647
1648         Rename some mentions of "webgpu" to "gpu".
1649         * Modules/webgpu/DOMWindowWebGPU.cpp:
1650         (WebCore::DOMWindowWebGPU::gpu):
1651         (WebCore::DOMWindowWebGPU::gpu const):
1652         * Modules/webgpu/DOMWindowWebGPU.h:
1653         * Modules/webgpu/DOMWindowWebGPU.idl:
1654
1655         Replace WebGPURenderingContext with GPUCanvasContext.
1656         * Modules/webgpu/GPUCanvasContext.cpp: Renamed from Source/WebCore/Modules/webgpu/WebGPURenderingContext.cpp.
1657         (WebCore::GPUCanvasContext::create):
1658         (WebCore::GPUCanvasContext::GPUCanvasContext):
1659         (WebCore::GPUCanvasContext::replaceSwapChain):
1660         (WebCore::GPUCanvasContext::platformLayer const):
1661         (WebCore::GPUCanvasContext::reshape):
1662         (WebCore::GPUCanvasContext::markLayerComposited):
1663         * Modules/webgpu/GPUCanvasContext.h: Renamed from Source/WebCore/Modules/webgpu/WebGPURenderingContext.h.
1664         * Modules/webgpu/GPUCanvasContext.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPURenderingContext.idl.
1665         * dom/Document.cpp:
1666         (WebCore::Document::getCSSCanvasContext):
1667         * dom/Document.h:
1668         * dom/Document.idl:
1669         * html/HTMLCanvasElement.cpp:
1670         (WebCore::HTMLCanvasElement::getContext):
1671         (WebCore::HTMLCanvasElement::isWebGPUType):
1672         (WebCore::HTMLCanvasElement::createContextWebGPU):
1673         (WebCore::HTMLCanvasElement::getContextWebGPU):
1674         * html/HTMLCanvasElement.h:
1675         * html/HTMLCanvasElement.idl:
1676         * inspector/InspectorCanvas.cpp:
1677         (WebCore::InspectorCanvas::buildObjectForCanvas):
1678         * inspector/agents/InspectorCanvasAgent.cpp:
1679         (WebCore::contextAsScriptValue):
1680
1681         Update WebGPUSwapChain.
1682         * Modules/webgpu/GPUTextureDescriptor.idl:
1683         * Modules/webgpu/GPUTextureFormat.idl: Add the other two texture formats supported by CAMetalLayer.
1684         * Modules/webgpu/WebGPUDevice.cpp: Implement createSwapChain.
1685         (WebCore::WebGPUDevice::createSwapChain const):
1686         (WebCore::WebGPUDevice::getQueue const):
1687         (WebCore::WebGPUDevice::getQueue): Deleted.
1688         * Modules/webgpu/WebGPUDevice.h:
1689         * Modules/webgpu/WebGPUDevice.idl:
1690         * Modules/webgpu/WebGPUSwapChain.cpp:
1691         (WebCore::WebGPUSwapChain::create):
1692         (WebCore::WebGPUSwapChain::WebGPUSwapChain):
1693         (WebCore::WebGPUSwapChain::getCurrentTexture): Renamed from getNextTexture. Only returns the next drawable if the last was presented.
1694         (WebCore::WebGPUSwapChain::destroy): Invalidate this GPUSwapChain and its textures and views.
1695         (WebCore::WebGPUSwapChain::configure): Deleted.
1696         (WebCore::WebGPUSwapChain::getNextTexture): Deleted.
1697         (WebCore::WebGPUSwapChain::present): Deleted.
1698         (WebCore::WebGPUSwapChain::reshape): Deleted.
1699         (WebCore::WebGPUSwapChain::markLayerComposited): Deleted.
1700         * Modules/webgpu/WebGPUSwapChain.h: Now a device-based object rather than a rendering context.
1701         (WebCore::WebGPUSwapChain::swapChain const):
1702         (WebCore::WebGPUSwapChain::WebGPUSwapChain): Deleted.
1703         * Modules/webgpu/WebGPUSwapChain.idl:
1704         * Modules/webgpu/WebGPUSwapChainDescriptor.h: Added.
1705         * platform/graphics/gpu/GPUDevice.cpp: Implement tryCreateSwapChain.
1706         (WebCore::GPUDevice::tryCreateSwapChain const):
1707         (WebCore::GPUDevice::getQueue const):
1708         (WebCore::GPUDevice::getQueue): Deleted.
1709         * platform/graphics/gpu/GPUDevice.h: Retain a reference to the current GPUSwapChain, if one exists.
1710         (WebCore::GPUDevice::swapChain const):
1711         * platform/graphics/gpu/GPUQueue.h:
1712         * platform/graphics/gpu/GPUSwapChain.h:
1713         (WebCore::GPUSwapChain::destroy):
1714         * platform/graphics/gpu/GPUSwapChainDescriptor.h: Added.
1715         * platform/graphics/gpu/GPUTextureFormat.h: Add the other two texture formats supported by CAMetalLayer.
1716         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
1717         (WebCore::GPUBuffer::commandBufferCommitted):
1718         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
1719         (WebCore::GPUQueue::tryCreate): Renamed from create to better fit functionality. Now retain a reference to the GPUDevice.
1720         (WebCore::GPUQueue::GPUQueue):
1721         (WebCore::GPUQueue::submit): Now checks state of all resources before marking them as committed or committing any resource.
1722                 In addition, schedules the current drawable to be presented after all commands have been submitted during this task cycle.
1723         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
1724         (WebCore::useAttachments): Ensure that the command buffer is aware of any texture resources used as attachments.
1725         (WebCore::GPURenderPassEncoder::tryCreate):
1726         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
1727         (WebCore::tryGetSupportedPixelFormat): Supported texture formats are the intersection of Web GPU's texture formats and CAMetalLayer's.
1728         (WebCore::setLayerShape):
1729         (WebCore::tryCreateSwapLayer): Create and configure the CAMetalLayer backing the swap chain.
1730         (WebCore::GPUSwapChain::tryCreate):
1731         (WebCore::GPUSwapChain::GPUSwapChain):
1732         (WebCore::GPUSwapChain::tryGetCurrentTexture): Renamed from getNextTexture. Only returns a texture if the last one was presented.
1733         (WebCore::GPUSwapChain::present):
1734         (WebCore::GPUSwapChain::reshape):
1735         (WebCore::GPUSwapChain::takeDrawable): Swaps out the current drawable so that it can be presented. The GPUSwapChain thus releases its reference to it.
1736         (WebCore::GPUSwapChain::create): Deleted.
1737         (WebCore::GPUSwapChain::setDevice): Deleted.
1738         (WebCore::GPUSwapChain::setFormat): Deleted.
1739         (WebCore::GPUSwapChain::getNextTexture): Deleted.
1740         * platform/graphics/gpu/cocoa/GPUUtilsMetal.mm:
1741         (WebCore::platformTextureFormatForGPUTextureFormat):
1742
1743         Misc:
1744         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp: Missing include.
1745
1746 2019-03-11  Chris Dumez  <cdumez@apple.com>
1747
1748         Update device orientation & motion permission native SPI as per latest proposal
1749         https://bugs.webkit.org/show_bug.cgi?id=195567
1750
1751         Reviewed by Youenn Fablet.
1752
1753         * dom/DeviceOrientationAndMotionAccessController.cpp:
1754         (WebCore::DeviceOrientationAndMotionAccessController::shouldAllowAccess):
1755         * page/ChromeClient.h:
1756
1757 2019-03-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1758
1759         [macOS] Dispatching reentrant "contextmenu" events may cause crashes
1760         https://bugs.webkit.org/show_bug.cgi?id=195571
1761         <rdar://problem/48086046>
1762
1763         Reviewed by Andy Estes.
1764
1765         Make ContextMenuController::handleContextMenuEvent robust against reentrancy by guarding it with a boolean flag.
1766         As demonstrated in the test case, it is currently possible to force WebKit into a bad state by dispatching a
1767         synthetic "contextmenu" event from within the scope of one of the "before(copy|cut|paste)" events triggered as
1768         a result of handling a context menu event.
1769
1770         Test: fast/events/contextmenu-reentrancy-crash.html
1771
1772         * page/ContextMenuController.cpp:
1773         (WebCore::ContextMenuController::handleContextMenuEvent):
1774         * page/ContextMenuController.h:
1775
1776 2019-03-11  Andy Estes  <aestes@apple.com>
1777
1778         [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
1779         https://bugs.webkit.org/show_bug.cgi?id=195530
1780         <rdar://problem/48747164>
1781
1782         Reviewed by Alex Christensen.
1783
1784         * Modules/applepay/PaymentCoordinatorClient.h: Defined isWebPaymentCoordinator.
1785         * page/Settings.yaml: Defined the applePayRemoteUIEnabled setting and reordered the other
1786         Apple Pay settings.
1787
1788 2019-03-11  Alex Christensen  <achristensen@webkit.org>
1789
1790         Soft linking to Reveal framework should be optional
1791         https://bugs.webkit.org/show_bug.cgi?id=195576
1792         <rdar://problem/46822452>
1793
1794         Reviewed by Megan Gardner.
1795
1796         Systems exist with ENABLE(REVEAL) true and the Reveal framework does not exist.
1797
1798         * editing/cocoa/DictionaryLookup.mm:
1799         (WebCore::showPopupOrCreateAnimationController):
1800
1801 2019-03-11  Yusuke Suzuki  <ysuzuki@apple.com>
1802
1803         [JSC] Reduce # of structures in JSGlobalObject initialization
1804         https://bugs.webkit.org/show_bug.cgi?id=195498
1805
1806         Reviewed by Darin Adler.
1807
1808         * bindings/js/SerializedScriptValue.cpp:
1809         (WebCore::CloneSerializer::serialize):
1810
1811 2019-03-11  Brent Fulgham  <bfulgham@apple.com>
1812
1813         Remove obsolete runtime flag for StorageAccess API Prompt
1814         https://bugs.webkit.org/show_bug.cgi?id=195564
1815         <rdar://problem/37279014>
1816
1817         Reviewed by Chris Dumez.
1818
1819         This bug tracks the work of removing the obsolete flag that had been used to optionally
1820         prevent display of the StorageAccess API prompt. We have since shipped the final version
1821         of this feature with an always-on prompt, and should have removed this runtime flag.
1822
1823         No test changes because this has no change in behavior. Tests already assume the prompt
1824         behavior, and did not test turning the flag off.
1825
1826         * page/RuntimeEnabledFeatures.h:
1827         (WebCore::RuntimeEnabledFeatures::setStorageAccessPromptsEnabled): Deleted.
1828         (WebCore::RuntimeEnabledFeatures::storageAccessPromptsEnabled const): Deleted.
1829         * testing/InternalSettings.cpp:
1830         (WebCore::InternalSettings::Backup::Backup):
1831         (WebCore::InternalSettings::Backup::restoreTo):
1832         (WebCore::InternalSettings::setStorageAccessPromptsEnabled): Deleted.
1833         * testing/InternalSettings.h:
1834         (): Deleted.
1835         * testing/InternalSettings.idl:
1836
1837 2019-03-11  Eric Carlson  <eric.carlson@apple.com>
1838
1839         Add web audio release logging
1840         https://bugs.webkit.org/show_bug.cgi?id=195554
1841         <rdar://problem/48767211>
1842
1843         Reviewed by Jer Noble.
1844
1845         No new tests, no functional change.
1846
1847         * Modules/webaudio/AudioBasicInspectorNode.cpp:
1848         (WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode):
1849         * Modules/webaudio/AudioBufferSourceNode.cpp:
1850         (WebCore::AudioBufferSourceNode::setBuffer):
1851         (WebCore::AudioBufferSourceNode::startPlaying):
1852         * Modules/webaudio/AudioContext.cpp:
1853         (WebCore::nextLogIdentifier):
1854         (WebCore::AudioContext::AudioContext):
1855         (WebCore::AudioContext::uninitialize):
1856         (WebCore::AudioContext::stop):
1857         (WebCore::AudioContext::createBufferSource):
1858         (WebCore::AudioContext::createMediaElementSource):
1859         (WebCore::AudioContext::createMediaStreamSource):
1860         (WebCore::AudioContext::createScriptProcessor):
1861         (WebCore::AudioContext::createBiquadFilter):
1862         (WebCore::AudioContext::createWaveShaper):
1863         (WebCore::AudioContext::createPanner):
1864         (WebCore::AudioContext::createConvolver):
1865         (WebCore::AudioContext::createDynamicsCompressor):
1866         (WebCore::AudioContext::createAnalyser):
1867         (WebCore::AudioContext::createGain):
1868         (WebCore::AudioContext::createDelay):
1869         (WebCore::AudioContext::createChannelSplitter):
1870         (WebCore::AudioContext::createChannelMerger):
1871         (WebCore::AudioContext::createOscillator):
1872         (WebCore::AudioContext::createPeriodicWave):
1873         (WebCore::AudioContext::willBeginPlayback):
1874         (WebCore::AudioContext::startRendering):
1875         (WebCore::AudioContext::fireCompletionEvent):
1876         (WebCore::AudioContext::logChannel const):
1877         * Modules/webaudio/AudioContext.h:
1878         (WebCore::AudioContext::nextAudioNodeLogIdentifier):
1879         (WebCore::AudioContext::nextAudioParameterLogIdentifier):
1880         * Modules/webaudio/AudioDestinationNode.cpp:
1881         (WebCore::AudioDestinationNode::AudioDestinationNode):
1882         * Modules/webaudio/AudioNode.cpp:
1883         (WebCore::convertEnumerationToString):
1884         (WebCore::AudioNode::AudioNode):
1885         (WebCore::AudioNode::~AudioNode):
1886         (WebCore::AudioNode::setNodeType):
1887         (WebCore::AudioNode::addInput):
1888         (WebCore::AudioNode::addOutput):
1889         (WebCore::AudioNode::connect):
1890         (WebCore::AudioNode::disconnect):
1891         (WebCore::AudioNode::setChannelCount):
1892         (WebCore::AudioNode::setChannelCountMode):
1893         (WebCore::AudioNode::setChannelInterpretation):
1894         (WebCore::AudioNode::logChannel const):
1895         * Modules/webaudio/AudioNode.h:
1896         (WTF::LogArgument<WebCore::AudioNode::NodeType>::toString):
1897         * Modules/webaudio/AudioParam.cpp:
1898         (WebCore::AudioParam::AudioParam):
1899         (WebCore::AudioParam::setValue):
1900         (WebCore::AudioParam::connect):
1901         (WebCore::AudioParam::disconnect):
1902         (WebCore::AudioParam::logChannel const):
1903         * Modules/webaudio/AudioParam.h:
1904         * Modules/webaudio/AudioScheduledSourceNode.cpp:
1905         (WebCore::AudioScheduledSourceNode::start):
1906         (WebCore::AudioScheduledSourceNode::stop):
1907         * Modules/webaudio/BiquadFilterNode.cpp:
1908         (WebCore::BiquadFilterNode::BiquadFilterNode):
1909         * Modules/webaudio/ChannelMergerNode.cpp:
1910         (WebCore::ChannelMergerNode::ChannelMergerNode):
1911         * Modules/webaudio/ChannelSplitterNode.cpp:
1912         (WebCore::ChannelSplitterNode::ChannelSplitterNode):
1913         * Modules/webaudio/ConvolverNode.cpp:
1914         (WebCore::ConvolverNode::ConvolverNode):
1915         * Modules/webaudio/DefaultAudioDestinationNode.cpp:
1916         (WebCore::DefaultAudioDestinationNode::initialize):
1917         (WebCore::DefaultAudioDestinationNode::uninitialize):
1918         (WebCore::DefaultAudioDestinationNode::enableInput):
1919         (WebCore::DefaultAudioDestinationNode::setChannelCount):
1920         * Modules/webaudio/DelayNode.cpp:
1921         (WebCore::DelayNode::DelayNode):
1922         * Modules/webaudio/DynamicsCompressorNode.cpp:
1923         (WebCore::DynamicsCompressorNode::DynamicsCompressorNode):
1924         * Modules/webaudio/GainNode.cpp:
1925         (WebCore::GainNode::GainNode):
1926         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
1927         (WebCore::MediaElementAudioSourceNode::MediaElementAudioSourceNode):
1928         * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
1929         (WebCore::MediaStreamAudioSourceNode::MediaStreamAudioSourceNode):
1930         * Modules/webaudio/OfflineAudioDestinationNode.cpp:
1931         (WebCore::OfflineAudioDestinationNode::startRendering):
1932         * Modules/webaudio/OscillatorNode.cpp:
1933         (WebCore::OscillatorNode::setType):
1934         (WebCore::OscillatorNode::setPeriodicWave):
1935         * Modules/webaudio/OscillatorNode.h:
1936         (WTF::LogArgument<WebCore::OscillatorNode::Type>::toString):
1937         * Modules/webaudio/PannerNode.cpp:
1938         (WebCore::PannerNode::PannerNode):
1939         * Modules/webaudio/ScriptProcessorNode.cpp:
1940         (WebCore::ScriptProcessorNode::ScriptProcessorNode):
1941         * Modules/webaudio/WaveShaperNode.cpp:
1942         (WebCore::WaveShaperNode::WaveShaperNode):
1943         (WebCore::WaveShaperNode::setCurve):
1944         (WebCore::WaveShaperNode::setOversample):
1945         * Modules/webaudio/WaveShaperNode.h:
1946         (WTF::LogArgument<WebCore::WaveShaperNode::OverSampleType>::toString):
1947
1948 2019-03-11  Youenn Fablet  <youenn@apple.com>
1949
1950         Make IDBDatabaseIdentifier take a ClientOrigin as member
1951         https://bugs.webkit.org/show_bug.cgi?id=195544
1952
1953         Reviewed by Geoffrey Garen.
1954
1955         Instead of taking a top and a frame origin, make
1956         make IDBDatabaseIdentifier take a ClientOrigin.
1957
1958         This allows reusing some ClientOrigin code
1959         and will ease implementation of storage quota checking in
1960         NetworkProcess, as quota managers are keyed by client origins.
1961
1962         No change of behavior.
1963
1964         * Modules/indexeddb/IDBDatabaseIdentifier.cpp:
1965         (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier):
1966         (WebCore::IDBDatabaseIdentifier::isolatedCopy const):
1967         (WebCore::IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot const):
1968         (WebCore::IDBDatabaseIdentifier::debugString const):
1969         * Modules/indexeddb/IDBDatabaseIdentifier.h:
1970         (WebCore::IDBDatabaseIdentifier::hash const):
1971         (WebCore::IDBDatabaseIdentifier::operator== const):
1972         (WebCore::IDBDatabaseIdentifier::origin const):
1973         (WebCore::IDBDatabaseIdentifier::isRelatedToOrigin const):
1974         (WebCore::IDBDatabaseIdentifier::encode const):
1975         (WebCore::IDBDatabaseIdentifier::decode):
1976         * page/ClientOrigin.h:
1977         (WebCore::ClientOrigin::isRelated const):
1978
1979 2019-03-11  Zan Dobersek  <zdobersek@igalia.com>
1980
1981         Unreviewed. Manually rolling out r242701 and r242703 since the changes
1982         are causing test timeouts and crashes on GTK and WPE.
1983
1984         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1985         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
1986         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1987         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
1988         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
1989         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink):
1990         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1991         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
1992         (WebCore::TextureMapperPlatformLayerProxy::pushNextBuffer):
1993         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
1994         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
1995         (): Deleted.
1996
1997 2019-03-11  Jer Noble  <jer.noble@apple.com>
1998
1999         Use AVContentKeySession for "com.apple.fps.2_0" CDM version when AVStreamSession is absent
2000         https://bugs.webkit.org/show_bug.cgi?id=195462
2001         <rdar://problem/48712306>
2002
2003         Reviewed by Eric Carlson.
2004
2005         The difference between "com.apple.fps.2_0" and "3_0" is a protocol difference more than an
2006         implementation difference. In "2_0", the "EME nitialization" data comes in the form of a "content
2007         identifier", while the true initialization data is retrieved through a side channel directly from
2008         the attached element. In "3_0", the "EME initialization data" is the exact initialization data
2009         given by the parser, with no "content identifier" at all.
2010
2011         In the original implementation, the "2_0" used AVStreamSession, and "3_0" used AVContentKeySession,
2012         but in the absense of AVStreamSession, those protocol differences are minor and can be implemented
2013         using AVContentKeySession.
2014
2015         Changes:
2016
2017         - Add a new helper struct in CDMPrivateMediaSourceAVFObjC that represents the parsed parameters
2018           of the CDM string.
2019         - Add an "initData()" accessor to SourceBufferPrivateAVFObjC so that the "2_0" path can implement
2020           the side channel access to the necessary initialization data.
2021         - Refactor some of the SPI code to not re-declare unnecessary APIs.
2022         - In CDMSessionAVContentKeySession::generateKeyRequest(), this function can never be called twice
2023           so it is a logical impossibility to have a certificate at this point. Remove all this if() code.
2024
2025         * Modules/encryptedmedia/legacy/LegacyCDM.cpp:
2026         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h:
2027         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
2028         (WebCore::CDMPrivateMediaSourceAVFObjC::parseKeySystem):
2029         (WebCore::queryDecoderAvailability):
2030         (WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystem):
2031         (WebCore::CDMPrivateMediaSourceAVFObjC::createSession):
2032         (WebCore::validKeySystemRE): Deleted.
2033         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h:
2034         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
2035         (WebCore::CDMSessionAVContentKeySession::CDMSessionAVContentKeySession):
2036         (WebCore::CDMSessionAVContentKeySession::generateKeyRequest):
2037         (WebCore::CDMSessionAVContentKeySession::update):
2038         (WebCore::CDMSessionAVContentKeySession::addParser):
2039         (WebCore::CDMSessionAVContentKeySession::removeParser):
2040         (WebCore::CDMSessionAVContentKeySession::contentKeySession):
2041         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
2042         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
2043         (WebCore::CDMSessionAVStreamSession::CDMSessionAVStreamSession):
2044         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2045         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2046         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession):
2047         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2048         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2049         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
2050
2051 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
2052
2053         Unreviewed, rolling out r242688, r242643, r242624.
2054
2055         Caused multiple layout test failures and crashes on iOS and macOS.
2056
2057         Reverted changeset:
2058
2059         "requestAnimationFrame should execute before the next frame"
2060         https://bugs.webkit.org/show_bug.cgi?id=177484
2061         https://trac.webkit.org/changeset/242624/webkit
2062
2063         * Sources.txt:
2064         * WebCore.xcodeproj/project.pbxproj:
2065         * accessibility/mac/AXObjectCacheMac.mm:
2066         (WebCore::AXObjectCache::platformHandleFocusedUIElementChanged):
2067         * animation/DocumentAnimationScheduler.cpp: Added.
2068         (WebCore::DocumentAnimationScheduler::create):
2069         (WebCore::DocumentAnimationScheduler::DocumentAnimationScheduler):
2070         (WebCore::DocumentAnimationScheduler::detachFromDocument):
2071         (WebCore::DocumentAnimationScheduler::scheduleWebAnimationsResolution):
2072         (WebCore::DocumentAnimationScheduler::unscheduleWebAnimationsResolution):
2073         (WebCore::DocumentAnimationScheduler::scheduleScriptedAnimationResolution):
2074         (WebCore::DocumentAnimationScheduler::displayRefreshFired):
2075         (WebCore::DocumentAnimationScheduler::windowScreenDidChange):
2076         (WebCore::DocumentAnimationScheduler::createDisplayRefreshMonitor const):
2077         * animation/DocumentAnimationScheduler.h: Renamed from Source/WebCore/page/RenderingUpdateScheduler.h.
2078         (WebCore::DocumentAnimationScheduler::lastTimestamp):
2079         (WebCore::DocumentAnimationScheduler::isFiring const):
2080         * animation/DocumentTimeline.cpp:
2081         (WebCore::DocumentTimeline::DocumentTimeline):
2082         (WebCore::DocumentTimeline::updateThrottlingState):
2083         (WebCore::DocumentTimeline::suspendAnimations):
2084         (WebCore::DocumentTimeline::resumeAnimations):
2085         (WebCore::DocumentTimeline::liveCurrentTime const):
2086         (WebCore::DocumentTimeline::currentTime):
2087         (WebCore::DocumentTimeline::cacheCurrentTime):
2088         (WebCore::DocumentTimeline::scheduleAnimationResolutionIfNeeded):
2089         (WebCore::DocumentTimeline::animationTimingDidChange):
2090         (WebCore::DocumentTimeline::scheduleAnimationResolution):
2091         (WebCore::DocumentTimeline::unscheduleAnimationResolution):
2092         (WebCore::DocumentTimeline::animationResolutionTimerFired):
2093         (WebCore::DocumentTimeline::updateAnimationsAndSendEvents):
2094         (WebCore::DocumentTimeline::scheduleNextTick):
2095         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
2096         (WebCore::DocumentTimeline::resolveAnimationsForElement):
2097         (WebCore::DocumentTimeline::internalUpdateAnimationsAndSendEvents): Deleted.
2098         * animation/DocumentTimeline.h:
2099         * dom/Document.cpp:
2100         (WebCore::Document::resolveStyle):
2101         (WebCore::Document::prepareForDestruction):
2102         (WebCore::Document::windowScreenDidChange):
2103         (WebCore::Document::updateIntersectionObservations):
2104         (WebCore::Document::scheduleForcedIntersectionObservationUpdate):
2105         (WebCore::Document::animationScheduler):
2106         (WebCore::Document::updateAnimationsAndSendEvents): Deleted.
2107         (WebCore::Document::serviceRequestAnimationFrameCallbacks): Deleted.
2108         * dom/Document.h:
2109         * dom/ScriptedAnimationController.cpp:
2110         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
2111         (WebCore::ScriptedAnimationController::scheduleAnimation):
2112         (WebCore::ScriptedAnimationController::animationTimerFired):
2113         (WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire):
2114         (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks): Deleted.
2115         * dom/ScriptedAnimationController.h:
2116         * page/FrameView.cpp:
2117         (WebCore::FrameView::viewportContentsChanged):
2118         * page/IntersectionObserver.cpp:
2119         (WebCore::IntersectionObserver::observe):
2120         * page/Page.cpp:
2121         (WebCore::Page::Page):
2122         (WebCore::Page::willDisplayPage):
2123         (WebCore::Page::addDocumentNeedingIntersectionObservationUpdate):
2124         (WebCore::Page::updateIntersectionObservations):
2125         (WebCore::Page::scheduleForcedIntersectionObservationUpdate):
2126         (WebCore::Page::layoutIfNeeded): Deleted.
2127         (WebCore::Page::renderingUpdate): Deleted.
2128         (WebCore::Page::renderingUpdateScheduler): Deleted.
2129         * page/Page.h:
2130         * page/PageOverlayController.cpp:
2131         (WebCore::PageOverlayController::didChangeViewExposedRect):
2132         (WebCore::PageOverlayController::notifyFlushRequired):
2133         * page/RenderingUpdateScheduler.cpp: Removed.
2134         * page/ios/ContentChangeObserver.h:
2135         * page/mac/ServicesOverlayController.mm:
2136         (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired):
2137         * rendering/RenderLayerCompositor.cpp:
2138         (WebCore::RenderLayerCompositor::scheduleLayerFlushNow):
2139
2140 2019-03-11  Darin Adler  <darin@apple.com>
2141
2142         Specify fixed precision explicitly to prepare to change String::number and StringBuilder::appendNumber floating point behavior
2143         https://bugs.webkit.org/show_bug.cgi?id=195533
2144
2145         Reviewed by Brent Fulgham.
2146
2147         * accessibility/AccessibilityNodeObject.cpp:
2148         (WebCore::AccessibilityNodeObject::changeValueByStep): Use numberToStringFixedPrecision.
2149         (WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto.
2150         * accessibility/AccessibilityScrollbar.cpp:
2151         (WebCore::AccessibilityScrollbar::setValue): Ditto.
2152         * css/CSSFontVariationValue.cpp:
2153         (WebCore::CSSFontVariationValue::customCSSText const): Use appendFixedPrecisionNumber.
2154         * css/CSSGradientValue.cpp:
2155         (WebCore::CSSLinearGradientValue::customCSSText const): Ditto.
2156         (WebCore::CSSRadialGradientValue::customCSSText const): Ditto.
2157         * css/CSSKeyframeRule.cpp:
2158         (WebCore::StyleRuleKeyframe::keyText const): Ditto.
2159         * css/CSSTimingFunctionValue.cpp:
2160         (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto.
2161         (WebCore::CSSSpringTimingFunctionValue::customCSSText const): Ditto.
2162         * css/parser/CSSParserToken.cpp:
2163         (WebCore::CSSParserToken::serialize const): Ditto.
2164         * html/HTMLImageElement.cpp:
2165         (WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto.
2166         * inspector/InspectorOverlay.cpp:
2167         (WebCore::InspectorOverlay::drawRulers): Use numberToStringFixedPrecision.
2168         * loader/ResourceLoadStatistics.cpp:
2169         (WebCore::ResourceLoadStatistics::toString const): Use appendFixedPrecisionNumber.
2170         * page/PrintContext.cpp:
2171         (WebCore::PrintContext::pageProperty): Use numberToStringFixedPrecision.
2172         * page/cocoa/ResourceUsageOverlayCocoa.mm:
2173         (WebCore::gcTimerString): Use numberToStringFixedPrecision.
2174         * platform/LayoutUnit.h:
2175         (WTF::ValueToString<WebCore::LayoutUnit>::string): Ditto.
2176         * platform/graphics/Color.cpp:
2177         (WebCore::Color::cssText const): Use appendFixedPrecisionNumber.
2178         * platform/graphics/ExtendedColor.cpp:
2179         (WebCore::ExtendedColor::cssText const): Ditto.
2180         * svg/SVGAngleValue.cpp:
2181         (WebCore::SVGAngleValue::valueAsString const): Use numberToStringFixedPrecision.
2182         * svg/SVGNumberListValues.cpp:
2183         (WebCore::SVGNumberListValues::valueAsString const): Use appendFixedPrecisionNumber.
2184         * svg/SVGPathStringBuilder.cpp:
2185         (WebCore::appendNumber): Ditto.
2186         (WebCore::appendPoint): Ditto.
2187         * svg/SVGPointListValues.cpp:
2188         (WebCore::SVGPointListValues::valueAsString const): Ditto.
2189         * svg/SVGTransformValue.cpp:
2190         (WebCore::SVGTransformValue::valueAsString const): Ditto.
2191         * svg/properties/SVGPropertyTraits.h:
2192         (WebCore::SVGPropertyTraits<float>::toString): Use numberToStringFixedPrecision.
2193         (WebCore::SVGPropertyTraits<FloatPoint>::toString): Use appendFixedPrecisionNumber.
2194         (WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto.
2195         * testing/Internals.cpp:
2196         (WebCore::Internals::dumpMarkerRects): Use appendFixedPrecisionNumber.
2197         (WebCore::Internals::getCurrentCursorInfo): Ditto.
2198         * xml/XPathValue.cpp:
2199         (WebCore::XPath::Value::toString const): Use numberToStringFixedPrecision.
2200
2201 2019-03-11  Philippe Normand  <pnormand@igalia.com>
2202
2203         Unreviewed, Non-GStreamer-GL build fix after r242701.
2204
2205         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2206         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
2207
2208 2019-03-11  Philippe Normand  <pnormand@igalia.com>
2209
2210         [GStreamer][v4l2] Synchronous video texture flushing support
2211         https://bugs.webkit.org/show_bug.cgi?id=195453
2212
2213         Reviewed by Xabier Rodriguez-Calvar.
2214
2215         The v4l2 video decoder currently requires that downstream users of
2216         the graphics resources complete any pending draw call and release
2217         resources before returning from the DRAIN query.
2218
2219         To accomplish this the player monitors the pipeline and whenever a
2220         v4l2 decoder is added, synchronous video texture flushing support
2221         is enabled. Additionally and for all decoder configurations, a
2222         flush is performed before disposing of the player.
2223
2224         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2225         (WebCore::MediaPlayerPrivateGStreamer::playbinDeepElementAddedCallback):
2226         Monitor elements added to the decodebin bin.
2227         (WebCore::MediaPlayerPrivateGStreamer::decodebinElementAdded): Set
2228         a flag if a v4l2 decoder was added in decodebin.
2229         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Connect
2230         to the deep-element-added signal so as to monitor pipeline
2231         topology updates.
2232         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2233         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2234         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
2235         Flush video texture before disposing of the player.
2236         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
2237         Synchronously flush if the pipeline contains a v4l2 decoder.
2238         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink): Monitor push events only.
2239         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2240         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
2241         (WebCore::TextureMapperPlatformLayerProxy::pushNextBuffer): New
2242         boolean flag used mostly to trigger synchronous flush conditions.
2243         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
2244         Optionally drop the current buffer in a synchronous manner. By
2245         default the method keeps operating asynchronously.
2246         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
2247
2248 2019-03-11  Antti Koivisto  <antti@apple.com>
2249
2250         Rename contentOffsetInCompostingLayer to contentOffsetInCompositingLayer
2251         https://bugs.webkit.org/show_bug.cgi?id=195553
2252
2253         Reviewed by Simon Fraser.
2254
2255         Less composting, more compositing.
2256
2257         * rendering/RenderLayerBacking.cpp:
2258         (WebCore::RenderLayerBacking::updateBackdropFiltersGeometry):
2259         (WebCore::RenderLayerBacking::resetContentsRect):
2260         (WebCore::RenderLayerBacking::updateChildClippingStrategy):
2261         (WebCore::RenderLayerBacking::updateImageContents):
2262         (WebCore::RenderLayerBacking::contentOffsetInCompositingLayer const):
2263         (WebCore::RenderLayerBacking::contentsBox const):
2264         (WebCore::RenderLayerBacking::backgroundBoxForSimpleContainerPainting const):
2265         (WebCore::RenderLayerBacking::contentOffsetInCompostingLayer const): Deleted.
2266         * rendering/RenderLayerBacking.h:
2267
2268 2019-03-10  Ross Kirsling  <ross.kirsling@sony.com>
2269
2270         Invalid flags in a RegExp literal should be an early SyntaxError
2271         https://bugs.webkit.org/show_bug.cgi?id=195514
2272
2273         Reviewed by Darin Adler.
2274
2275         * bindings/js/SerializedScriptValue.cpp:
2276         (WebCore::CloneDeserializer::readTerminal):
2277         Consume YarrFlags.
2278
2279 2019-03-10  Tim Horton  <timothy_horton@apple.com>
2280
2281         Add SPI to retrieve the set of text inputs in a given rect, and later focus one
2282         https://bugs.webkit.org/show_bug.cgi?id=195499
2283
2284         Reviewed by Darin Adler.
2285
2286         New API tests: WebKit.RequestTextInputContext and WebKit.FocusTextInputContext
2287
2288         * WebCore.xcodeproj/project.pbxproj:
2289         * dom/Document.cpp:
2290         (WebCore::Document::identifierForElement):
2291         (WebCore::Document::elementWithIdentifier):
2292         (WebCore::Document::identifiedElementWasRemovedFromDocument):
2293         * dom/Document.h:
2294         Add a mechanism where Document will vend an ObjectIdentifier for a given
2295         element, and can (if possible) retrieve that element later.
2296
2297         * dom/Element.cpp:
2298         (WebCore::Element::removedFromAncestor):
2299         If an Element has an identifier created for it, inform Document to remove
2300         it from the identifier map when the element is detached.
2301
2302         (WebCore::Element::createElementIdentifier):
2303         * dom/Element.h:
2304         * dom/ElementIdentifier.h: Added.
2305         * dom/ElementRareData.cpp:
2306         * dom/ElementRareData.h:
2307         (WebCore::ElementRareData::hasElementIdentifier const):
2308         (WebCore::ElementRareData::setHasElementIdentifier):
2309         (WebCore::ElementRareData::ElementRareData):
2310         Store a bit indicating if the Element has had a identifier created for it,
2311         so that we can avoid a hash lookup on every Element removal.
2312
2313         * dom/Node.h:
2314         * html/HTMLTextFormControlElement.h:
2315
2316 2019-03-10  Zalan Bujtas  <zalan@apple.com>
2317
2318         [ContentChangeObserver] Fix failing test cases
2319         https://bugs.webkit.org/show_bug.cgi?id=195524
2320         <rdar://problem/48745101>
2321
2322         Reviewed by Simon Fraser.
2323
2324         1. Do not start DOM timer install observation when we already detected change at touchstart.
2325         2. hasPendingActivity() should only care about ContentChangeObserver flags.
2326         3. Do not try to notify the client when we are in the mouseMoved dispatch call (currently it could happen
2327         when a timer gets intalled and removed right away).
2328
2329         * page/ios/ContentChangeObserver.cpp:
2330         (WebCore::ContentChangeObserver::adjustObservedState):
2331         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const): Deleted.
2332         * page/ios/ContentChangeObserver.h:
2333         (WebCore::ContentChangeObserver::hasPendingActivity const):
2334         (WebCore::ContentChangeObserver::isObservationTimeWindowActive const):
2335
2336 2019-03-10  Simon Fraser  <simon.fraser@apple.com>
2337
2338         ScrollingTree should have the final say on where layers go
2339         https://bugs.webkit.org/show_bug.cgi?id=195507
2340
2341         Reviewed by Antti Koivisto.
2342
2343         Main thread layer flushing can race with scrolling tree layer changes on macOS, causing
2344         flashing as layers jump around sometimes. We go to some lengths to avoid this by trying
2345         not to touch properties on layers that are being interacted with (scrollableArea->setIsUserScroll in
2346         updateScrollPositionAfterAsyncScroll()), but that's fragile.
2347
2348         This patch adds ScrollingTree::applyScrollingTreeLayerPositions(), which enters
2349         ScrollingTree::applyLayerPositions() on the main thread/UI process. This traverses
2350         the tree allowing each node to run their layer positioning logic.
2351
2352         For macOS WK2, this is called from TiledCoreAnimationDrawingArea::flushLayers() after flushCompositingStateIncludingSubframes().
2353         For macOS WK2 with UI-side compositing, RemoteLayerTreeDrawingAreaProxy::commitLayerTree()
2354         calls m_webPageProxy.scrollingCoordinatorProxy()->applyScrollingTreeLayerPositions().
2355         iOS WK2 is unchanged, using viewportChangedViaDelegatedScrolling() which does the same thing, allowing
2356         for the dynamic viewport changes that happen when zooming on iOS.
2357
2358         Testing this requires infrastructure that we don't have yet.
2359
2360         * page/scrolling/AsyncScrollingCoordinator.cpp:
2361         (WebCore::AsyncScrollingCoordinator::applyScrollingTreeLayerPositions):
2362         * page/scrolling/AsyncScrollingCoordinator.h:
2363         * page/scrolling/ScrollingCoordinator.h:
2364         (WebCore::ScrollingCoordinator::applyScrollingTreeLayerPositions):
2365         * page/scrolling/ScrollingTree.cpp:
2366         (WebCore::ScrollingTree::handleWheelEvent):
2367         (WebCore::ScrollingTree::commitTreeState):
2368         (WebCore::ScrollingTree::applyLayerPositions):
2369         (WebCore::ScrollingTree::applyLayerPositionsRecursive):
2370         * page/scrolling/ScrollingTree.h:
2371         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
2372         (WebCore::ScrollingTreeFrameHostingNode::applyLayerPositions):
2373         * page/scrolling/ScrollingTreeFrameHostingNode.h:
2374         * page/scrolling/ScrollingTreeNode.h:
2375         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2376         (WebCore::ScrollingTreeScrollingNode::applyLayerPositions):
2377         * page/scrolling/ScrollingTreeScrollingNode.h:
2378         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
2379         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
2380         (WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
2381         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
2382         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
2383         (WebCore::ScrollingTreeStickyNode::applyLayerPositions):
2384         (WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
2385         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
2386         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2387         (WebCore::ScrollingTreeFrameScrollingNodeMac::applyLayerPositions):
2388
2389 2019-03-09  Andy Estes  <aestes@apple.com>
2390
2391         [Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
2392         https://bugs.webkit.org/show_bug.cgi?id=195526
2393         <rdar://problem/48745636>
2394
2395         Reviewed by Chris Dumez.
2396
2397         * Modules/applepay/PaymentCoordinatorClient.h:
2398         * loader/EmptyClients.cpp:
2399         * testing/MockPaymentCoordinator.cpp:
2400         (WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard):
2401         (WebCore::MockPaymentCoordinator::openPaymentSetup):
2402         * testing/MockPaymentCoordinator.h:
2403
2404 2019-03-09  Zalan Bujtas  <zalan@apple.com>
2405
2406         [ContentChangeObserver] Click event fires immediately on hover menu at seriouseats.com
2407         https://bugs.webkit.org/show_bug.cgi?id=195520
2408         <rdar://problem/48740098>
2409
2410         Reviewed by Simon Fraser.
2411
2412         Unfortunately seriouseats has a 300ms hover intent delay to deal with accidental menupane pop-ups. This page also hides this
2413         non-fixed width menupane using absolute positioning and negative left.  
2414
2415         Test: fast/events/touch/ios/content-observation/move-content-from-offscreen.html
2416
2417         * page/ios/ContentChangeObserver.cpp:
2418         (WebCore::ContentChangeObserver::didInstallDOMTimer):
2419         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
2420         (WebCore::ContentChangeObserver::StyleChangeScope::isConsideredHidden const): Content auhtors tend to use x - 1 values (where x = 10^y)
2421
2422 2019-03-09  Chris Dumez  <cdumez@apple.com>
2423
2424         Add assertions to help debug crash under DOMWindowExtension::suspendForPageCache()
2425         https://bugs.webkit.org/show_bug.cgi?id=195488
2426
2427         Reviewed by Ryosuke Niwa.
2428
2429         Try and figure out how the document can be detached from its frame while we're suspending
2430         DOMWindowExtensions.
2431
2432         * page/DOMWindow.cpp:
2433         (WebCore::DOMWindow::willDetachDocumentFromFrame):
2434         (WebCore::DOMWindow::suspendForPageCache):
2435         * page/DOMWindow.h:
2436
2437 2019-03-09  Chris Dumez  <cdumez@apple.com>
2438
2439         Simplify DOMWindowProperty code / handling
2440         https://bugs.webkit.org/show_bug.cgi?id=195495
2441
2442         Reviewed by Ryosuke Niwa.
2443
2444         DOMWindowProperty code was unnecessarily complex because DOMWindowExtension inherited
2445         from it and DOMWindowExtension needs a lot of information about the global object's
2446         lifetime to communicate to the injected bbundle client. This subclassing is also
2447         very confusing because a DOMWindowExtension is not a *property* on the Window object.
2448
2449         This patch updates DOMWindowExtension to stop subclassing DOMWindowProperty and
2450         moves all the complexity from DOMWindowProperty to DOMWindowExtension.
2451         DOMWindowProperty is now a very simple base class which merely has a WeakPtr to
2452         the window and getters for the window and the frame.
2453
2454         * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
2455         (WebCore::DOMWindowIndexedDatabase::DOMWindowIndexedDatabase):
2456         (WebCore::DOMWindowIndexedDatabase::indexedDB):
2457         * Modules/indexeddb/DOMWindowIndexedDatabase.h:
2458         There is no reason for DOMWindowIndexedDatabase to move its IDBFactory to a
2459         separate data member which in PageCache. Script do not run while in PageCache.
2460         Also, frames are nulled out while in the PageCache so the indexedDB() getter
2461         would return null anyway while in PageCache.
2462
2463         * css/StyleMedia.idl:
2464         * loader/appcache/ApplicationCacheHost.cpp:
2465         (WebCore::ApplicationCacheHost::setDOMApplicationCache):
2466         Store a WeakPtr to the DOMApplicationCache for safety.
2467
2468         (WebCore::ApplicationCacheHost::dispatchDOMEvent):
2469         Do not fire events on the DOMApplicationCache if it is frameless to maintain
2470         previous behavior. Previously, the DOMApplicationCache would have been nulled
2471         out when detached from its frame so we would not have fired events.
2472
2473         * loader/appcache/ApplicationCacheHost.h:
2474         * loader/appcache/DOMApplicationCache.cpp:
2475         * loader/appcache/DOMApplicationCache.h:
2476         Remove some unnecessary complexity. The ApplicationCacheHost is owned by the
2477         DocumentLoader, which changes on navigation. There is therefore no reason to
2478         null out the DOMApplicationCache on the ApplicationCacheHost when its gets
2479         detached from its frame or enters PageCache.
2480
2481         * page/BarProp.idl:
2482         * page/DOMSelection.idl:
2483         * page/DOMWindow.cpp:
2484         (WebCore::DOMWindow::willDestroyCachedFrame):
2485         (WebCore::DOMWindow::willDestroyDocumentInFrame):
2486         (WebCore::DOMWindow::willDetachDocumentFromFrame):
2487         (WebCore::DOMWindow::registerExtension):
2488         (WebCore::DOMWindow::unregisterExtension):
2489
2490         (WebCore::DOMWindow::resetDOMWindowProperties): Removed.
2491         Stop clearing some of the DOMWindow's properties when the document gets destroyed or when
2492         the Window for the initial empty document gets reused on navigation. I think we used to
2493         need this because DOMWindowProperty used to hold pointers to their frame. However, this
2494         is no longer the case nowadays as DOMWindowProperty objects get their frame from their
2495         Window.
2496
2497         (WebCore::DOMWindow::resetUnlessSuspendedForDocumentSuspension):
2498         (WebCore::DOMWindow::suspendForPageCache):
2499         (WebCore::DOMWindow::resumeFromPageCache):
2500         * page/DOMWindow.h:
2501         * page/DOMWindowExtension.cpp:
2502         (WebCore::DOMWindowExtension::DOMWindowExtension):
2503         (WebCore::DOMWindowExtension::~DOMWindowExtension):
2504         (WebCore::DOMWindowExtension::frame const):
2505         (WebCore::DOMWindowExtension::suspendForPageCache):
2506         (WebCore::DOMWindowExtension::resumeFromPageCache):
2507         (WebCore::DOMWindowExtension::willDestroyGlobalObjectInCachedFrame):
2508         (WebCore::DOMWindowExtension::willDestroyGlobalObjectInFrame):
2509         (WebCore::DOMWindowExtension::willDetachGlobalObjectFromFrame):
2510         * page/DOMWindowExtension.h:
2511         * page/DOMWindowProperty.cpp:
2512         (WebCore::DOMWindowProperty::DOMWindowProperty):
2513         * page/DOMWindowProperty.h:
2514         (WebCore::DOMWindowProperty::window const):
2515         * page/History.idl:
2516         * page/Location.idl:
2517         * page/Navigator.cpp:
2518         (WebCore::Navigator::plugins):
2519         (WebCore::Navigator::mimeTypes):
2520         * page/PerformanceNavigation.idl:
2521         * page/PerformanceTiming.idl:
2522         * page/Screen.idl:
2523         * page/VisualViewport.cpp:
2524         (WebCore::VisualViewport::scriptExecutionContext const):
2525         * plugins/DOMMimeTypeArray.idl:
2526         * plugins/DOMPluginArray.idl:
2527
2528 2019-03-09  Zalan Bujtas  <zalan@apple.com>
2529
2530         [ContentChangeObserver] Start observing for content change between touchEnd and mouseMoved start
2531         https://bugs.webkit.org/show_bug.cgi?id=195510
2532         <rdar://problem/48735695>
2533
2534         Reviewed by Simon Fraser.
2535
2536         This patch covers the observation of async changes triggered by touchStart/touchEnd (animations, timers, style recalcs).
2537
2538         Test: fast/events/touch/ios/content-observation/visibility-change-after-touch-end.html
2539
2540         * page/ios/ContentChangeObserver.cpp:
2541         (WebCore::ContentChangeObserver::didCancelTouchEvent):
2542         (WebCore::ContentChangeObserver::adjustObservedState):
2543         * page/ios/ContentChangeObserver.h:
2544         (WebCore::ContentChangeObserver::setIsInBetweenTouchEndAndMouseMoved):
2545         (WebCore::ContentChangeObserver::isInBetweenTouchEndAndMouseMoved const):
2546         (WebCore::ContentChangeObserver::isObservingContentChanges const):
2547
2548 2019-03-08  Simon Fraser  <simon.fraser@apple.com>
2549
2550         Make it clearer which data is protected by the two locks in ScrollingTree
2551         https://bugs.webkit.org/show_bug.cgi?id=195501
2552
2553         Reviewed by Tim Horton.
2554
2555         Gather ScrollingTree member variables into two structs, and name the struct
2556         members and the locks to make it clear which data is protected by each lock.
2557         
2558         We only need to protect data read by multiple threads; these are the scrolling
2559         thread, the event handling thread (which runs ThreadedScrollingTree::tryToHandleWheelEvent()),
2560         and the main thread, which pokes various bits of pin/rubber-banding state.
2561         Ideally the main thread would always push data to the scrolling thread via a commit,
2562         but that's not what happens now.
2563
2564         Suspiciously, ScrollingTree::shouldHandleWheelEventSynchronously() uses the root node,
2565         so should probably hold a lock shared with the scrolling thread (webkit.org/b/195502).
2566         
2567         * page/scrolling/ScrollingTree.cpp:
2568         (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously):
2569         (WebCore::ScrollingTree::commitTreeState):
2570         (WebCore::ScrollingTree::setAsyncFrameOrOverflowScrollingEnabled):
2571         (WebCore::ScrollingTree::setMainFrameScrollPosition):
2572         (WebCore::ScrollingTree::eventTrackingTypeForPoint):
2573         (WebCore::ScrollingTree::isRubberBandInProgress):
2574         (WebCore::ScrollingTree::setMainFrameIsRubberBanding):
2575         (WebCore::ScrollingTree::isScrollSnapInProgress):
2576         (WebCore::ScrollingTree::setMainFrameIsScrollSnapping):
2577         (WebCore::ScrollingTree::setMainFramePinState):
2578         (WebCore::ScrollingTree::setCanRubberBandState):
2579         (WebCore::ScrollingTree::setScrollPinningBehavior):
2580         (WebCore::ScrollingTree::scrollPinningBehavior):
2581         (WebCore::ScrollingTree::willWheelEventStartSwipeGesture):
2582         (WebCore::ScrollingTree::latchedNode):
2583         (WebCore::ScrollingTree::setLatchedNode):
2584         (WebCore::ScrollingTree::clearLatchedNode):
2585         (WebCore::ScrollingTree::scrollingTreeAsText):
2586         (WebCore::ScrollingTree::touchActionDataAtPoint const):
2587         (WebCore::ScrollingTree::mainFrameScrollPosition): Deleted.
2588         (WebCore::ScrollingTree::mainFrameLayoutViewport): Deleted.
2589         (WebCore::ScrollingTree::rubberBandsAtLeft): Deleted.
2590         (WebCore::ScrollingTree::rubberBandsAtRight): Deleted.
2591         (WebCore::ScrollingTree::rubberBandsAtBottom): Deleted.
2592         (WebCore::ScrollingTree::rubberBandsAtTop): Deleted.
2593         * page/scrolling/ScrollingTree.h:
2594         (WebCore::ScrollingTree::hasLatchedNode const):
2595         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
2596         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount):
2597         * platform/graphics/FloatPoint.h:
2598         (WebCore::FloatPoint::isZero const):
2599
2600 2019-03-08  Simon Fraser  <simon.fraser@apple.com>
2601
2602         Share some code that sets CALayer positions
2603         https://bugs.webkit.org/show_bug.cgi?id=195485
2604
2605         Reviewed by Zalan Bujtas.
2606
2607         Share some code between ScrollingTreeStickyNode and ScrollingTreeFixedNode that sets the position
2608         of a CALayer given the top-left location.
2609
2610         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
2611         (WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
2612         (WebCore::ScrollingTreeFixedNodeInternal::operator*): Deleted.
2613         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
2614         (WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
2615         (WebCore::ScrollingTreeStickyNodeInternal::operator*): Deleted.
2616         * platform/graphics/cocoa/WebCoreCALayerExtras.h:
2617         * platform/graphics/cocoa/WebCoreCALayerExtras.mm:
2618         (-[CALayer _web_setLayerTopLeftPosition:]):
2619
2620 2019-03-08  Chris Dumez  <cdumez@apple.com>
2621
2622         Add support for Device Orientation / Motion permission API
2623         https://bugs.webkit.org/show_bug.cgi?id=195329
2624         <rdar://problem/47645367>
2625
2626         Reviewed by Geoffrey Garen.
2627
2628         Add support for Device Orientation / Motion permission API:
2629         - https://github.com/w3c/deviceorientation/issues/57
2630
2631         Pages can add event listeners for 'deviceorientation' / 'devicemotion' events but
2632         such events will not be fired until the page's JavaScript calls
2633         DeviceOrientationEvent.requestPermission() / DeviceMotionEvent.requestPermission()
2634         and the user grants the request.
2635
2636         The feature is currently behind an experimental feature flag, off by default.
2637
2638         Tests: fast/device-orientation/device-motion-request-permission-denied.html
2639                fast/device-orientation/device-motion-request-permission-granted.html
2640                fast/device-orientation/device-motion-request-permission-user-gesture.html
2641                fast/device-orientation/device-orientation-request-permission-denied.html
2642                fast/device-orientation/device-orientation-request-permission-granted.html
2643                fast/device-orientation/device-orientation-request-permission-user-gesture.html
2644
2645         * CMakeLists.txt:
2646         * DerivedSources-input.xcfilelist:
2647         * DerivedSources-output.xcfilelist:
2648         * DerivedSources.make:
2649         * Sources.txt:
2650         * WebCore.xcodeproj/project.pbxproj:
2651         * dom/DeviceMotionEvent.h:
2652         * dom/DeviceMotionEvent.idl:
2653         * dom/DeviceOrientationAndMotionAccessController.cpp: Added.
2654         (WebCore::DeviceOrientationAndMotionAccessController::DeviceOrientationAndMotionAccessController):
2655         (WebCore::DeviceOrientationAndMotionAccessController::shouldAllowAccess):
2656         (WebCore::DeviceOrientationAndMotionAccessController::setAccessState):
2657         * dom/DeviceOrientationAndMotionAccessController.h: Added.
2658         (WebCore::DeviceOrientationAndMotionAccessController::accessState const):
2659         * dom/DeviceOrientationEvent.h:
2660         * dom/DeviceOrientationEvent.idl:
2661         * dom/DeviceOrientationOrMotionEvent.cpp: Added.
2662         (WebCore::DeviceOrientationOrMotionEvent::requestPermission):
2663         * dom/DeviceOrientationOrMotionEvent.h: Added.
2664         * dom/DeviceOrientationOrMotionEvent.idl: Added.
2665         * dom/DeviceOrientationOrMotionPermissionState.h: Added.
2666         * dom/DeviceOrientationOrMotionPermissionState.idl: Added.
2667         * dom/Document.cpp:
2668         (WebCore::Document::deviceOrientationAndMotionAccessController):
2669         * dom/Document.h:
2670         * dom/Event.cpp:
2671         * dom/MessagePort.cpp:
2672         * dom/Microtasks.cpp:
2673         * page/ChromeClient.h:
2674         * page/DOMWindow.cpp:
2675         (WebCore::DOMWindow::addEventListener):
2676         (WebCore::DOMWindow::deviceOrientationController const):
2677         (WebCore::DOMWindow::deviceMotionController const):
2678         (WebCore::DOMWindow::isAllowedToUseDeviceMotionOrientation const):
2679         (WebCore::DOMWindow::isAllowedToAddDeviceMotionOrientationListener const):
2680         (WebCore::DOMWindow::startListeningForDeviceOrientationIfNecessary):
2681         (WebCore::DOMWindow::stopListeningForDeviceOrientationIfNecessary):
2682         (WebCore::DOMWindow::startListeningForDeviceMotionIfNecessary):
2683         (WebCore::DOMWindow::stopListeningForDeviceMotionIfNecessary):
2684         (WebCore::DOMWindow::removeEventListener):
2685         (WebCore::DOMWindow::removeAllEventListeners):
2686         * page/DOMWindow.h:
2687         * page/DeviceController.cpp:
2688         (WebCore::DeviceController::hasDeviceEventListener const):
2689         * page/DeviceController.h:
2690         * page/Settings.yaml:
2691
2692 2019-03-08  Zalan Bujtas  <zalan@apple.com>
2693
2694         [ContentChangeObserver] Expand "isConsideredClickable" to descendants
2695         https://bugs.webkit.org/show_bug.cgi?id=195478
2696         <rdar://problem/48724935>
2697
2698         Reviewed by Simon Fraser.
2699
2700         In StyleChangeScope we try to figure out whether newly visible content should stick (menu panes etc) by checking if it is clickable.
2701         This works fine as long as all the visible elements are gaining new renderers through this style update processs.
2702         However when an element becomes visible by a change other than display: (not)none, it's not sufficient to just check the element itself,
2703         since it might not respond to click at all, while its descendants do.
2704         A concrete example is a max-height value change on usps.com, where the max-height is on a container (menu pane).
2705         This container itself is not clickable while most of its children are (menu items).    
2706
2707         Test: fast/events/touch/ios/content-observation/clickable-content-is-inside-a-container.html
2708
2709         * page/ios/ContentChangeObserver.cpp:
2710         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
2711         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
2712         (WebCore::ContentChangeObserver::StyleChangeScope::isConsideredHidden const):
2713         (WebCore::ContentChangeObserver::StyleChangeScope::isConsideredClickable const):
2714         (WebCore::isConsideredHidden): Deleted.
2715         * page/ios/ContentChangeObserver.h:
2716
2717 2019-03-08  Zalan Bujtas  <zalan@apple.com>
2718
2719         [ContentChangeObserver] Cleanup adjustObservedState
2720         https://bugs.webkit.org/show_bug.cgi?id=195470
2721         <rdar://problem/48717823>
2722
2723         Reviewed by Simon Fraser.
2724
2725         This is in preparation for introducing an observation window from touchStart -> mouseMoved.
2726         1. Cancel pending activities (future timers, pending stylesheet recalcs) when visible content change is detected.
2727         2. The fixed time window takes care of notifying the client -timers, style recalcs during the window should not signal themselves.  
2728         3. Reset m_isObservingPendingStyleRecalc at StartedStyleRecalc instead of EndedStyleRecalc. 
2729
2730         * page/ios/ContentChangeObserver.cpp:
2731         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
2732         (WebCore::ContentChangeObserver::styleRecalcDidStart):
2733         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
2734         (WebCore::ContentChangeObserver::adjustObservedState):
2735         * page/ios/ContentChangeObserver.h:
2736         (WebCore::ContentChangeObserver::hasPendingActivity const):
2737         (WebCore::ContentChangeObserver::isObservationTimeWindowActive const):
2738
2739 2019-03-08  Zalan Bujtas  <zalan@apple.com>
2740
2741         [ContentChangeObserver] Add StartedDOMTimerExecution and StartedStyleRecalc
2742         https://bugs.webkit.org/show_bug.cgi?id=195463
2743         <rdar://problem/48714762>
2744
2745         Reviewed by Simon Fraser.
2746
2747         This is in preparation for introducing m_isObservingContentChanges flag to track observing state across events (touchStart -> mouseMoved).
2748
2749         * page/ios/ContentChangeObserver.cpp:
2750         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
2751         (WebCore::ContentChangeObserver::styleRecalcDidStart):
2752         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
2753         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
2754         (WebCore::ContentChangeObserver::adjustObservedState):
2755         * page/ios/ContentChangeObserver.h:
2756         (WebCore::ContentChangeObserver::isObservingPendingStyleRecalc const):
2757         (WebCore::ContentChangeObserver::isObservingStyleRecalc const): Deleted.
2758
2759 2019-03-08  Chris Fleizach  <cfleizach@apple.com>
2760
2761         AX: AOM accessibleclick does not work on iOS
2762         https://bugs.webkit.org/show_bug.cgi?id=195423
2763         <rdar://problem/48682110>
2764
2765         Reviewed by Joanmarie Diggs.
2766
2767         Return this value of this method so it can be surfaced to a higher level.
2768
2769         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2770         (-[WebAccessibilityObjectWrapper _accessibilityActivate]):
2771
2772 2019-03-08  Chris Dumez  <cdumez@apple.com>
2773
2774         imported/w3c/web-platform-tests/FileAPI/reading-data-section/filereader_error.html is a flaky crash
2775         https://bugs.webkit.org/show_bug.cgi?id=195441
2776         <rdar://problem/43437394>
2777
2778         Reviewed by Alexey Proskuryakov.
2779
2780         FileReader is an ActiveDOMObject, which means that FileReader::stop() gets called when
2781         its script execution context is about to get destroyed. FileReader::stop() sets m_state
2782         to DONE. FileReader::abort() would schedule an asynchronous task and then ASSERT that
2783         m_state is not DONE, which would hit if FileReader::stop() had been called in between
2784         the task being scheduled and its execution. To address the issue, have the task abort
2785         early if isContextStopped() returns true.
2786
2787         Also replace calls to setPendingActivity() / unsetPendingActivity() with a
2788         PendingActivity data member as mismatched call to those can lead to leaks.
2789
2790         * fileapi/FileReader.cpp:
2791         (WebCore::FileReader::canSuspendForDocumentSuspension const):
2792         No reason not to suspend if there is no pending read.
2793
2794         (WebCore::FileReader::stop):
2795         (WebCore::FileReader::readInternal):
2796         (WebCore::FileReader::abort):
2797         (WebCore::FileReader::didFinishLoading):
2798         (WebCore::FileReader::didFail):
2799         * fileapi/FileReader.h:
2800
2801 2019-03-08  Zan Dobersek  <zdobersek@igalia.com>
2802
2803         GLContextEGL: desired EGL config should search for 8-bit components by default
2804         https://bugs.webkit.org/show_bug.cgi?id=195413
2805
2806         Reviewed by Carlos Garcia Campos.
2807
2808         The EGL config search in GLContextEGL should by default look for
2809         RGBA8888 configurations while allowing RGB565 as an alternative.
2810         This prevents from accidentally landing on an RGBA1010102
2811         configuration that is available with some graphics stacks, and which is
2812         not expected in e.g. window snapshotting that's done for layout test
2813         output comparison.
2814
2815         * platform/graphics/egl/GLContextEGL.cpp:
2816         (WebCore::GLContextEGL::getEGLConfig): EGL config search should by
2817         default request 8-bit color channels.
2818
2819 2019-03-08  Miguel Gomez  <magomez@igalia.com>
2820
2821         Use a thread safe refcounter for FilterOperation.
2822         https://bugs.webkit.org/show_bug.cgi?id=194149
2823
2824         Reviewed by Carlos Garcia Campos.
2825
2826         Use a thread safe refcounter for FilterOperation.
2827
2828         * platform/graphics/filters/FilterOperation.h:
2829
2830 2019-03-07  Yusuke Suzuki  <ysuzuki@apple.com>
2831
2832         [JSC] Make more fields lazy in JSGlobalObject
2833         https://bugs.webkit.org/show_bug.cgi?id=195449
2834
2835         Reviewed by Mark Lam.
2836
2837         Use arrayBufferConstructor() since getDirect does not work with lazy property.
2838
2839         * bindings/js/JSDOMGlobalObject.cpp:
2840         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
2841
2842 2019-03-07  Zalan Bujtas  <zalan@apple.com>
2843
2844         [ContentChangeObserver][REGRESSION] Check if visibility change happens while dispatching mouseMoved
2845         https://bugs.webkit.org/show_bug.cgi?id=195421
2846         <rdar://problem/48682004>
2847
2848         Reviewed by Simon Fraser.
2849
2850         Visibility change might be triggered synchronously while dispatching mouseMoved event.
2851
2852         Test: fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html
2853
2854         * page/ios/ContentChangeObserver.cpp:
2855         (WebCore::ContentChangeObserver::mouseMovedDidStart):
2856         (WebCore::ContentChangeObserver::mouseMovedDidFinish):
2857         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
2858         * page/ios/ContentChangeObserver.h:
2859         (WebCore::ContentChangeObserver::isObservingContentChanges const):
2860
2861 2019-03-07  Zalan Bujtas  <zalan@apple.com>
2862
2863         [ContentChangeObserver] Check if max-height change triggers visible content change.
2864         https://bugs.webkit.org/show_bug.cgi?id=195417
2865         <rdar://problem/48680631>
2866
2867         Reviewed by Simon Fraser.
2868
2869         A fixed max-height non-zero value could indicate visible content change. usps.com uses this technique to show menu panes.  
2870
2871         Test: fast/events/touch/ios/content-observation/visibility-change-is-max-height-change.html
2872
2873         * page/ios/ContentChangeObserver.cpp:
2874         (WebCore::isConsideredHidden):
2875         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
2876         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
2877         (WebCore::elementImplicitVisibility): Deleted.
2878         * page/ios/ContentChangeObserver.h:
2879
2880 2019-03-07  Yusuke Suzuki  <ysuzuki@apple.com>
2881
2882         Unreviewed, fix failing EWS build for ios-sim
2883
2884         * page/ios/ContentChangeObserver.cpp:
2885         (WebCore::ContentChangeObserver::touchEventDidStart):
2886
2887 2019-03-07  Eric Carlson  <eric.carlson@apple.com>
2888
2889         [MSE] Adopt new AVSampleBufferDisplayLayer SPI
2890         https://bugs.webkit.org/show_bug.cgi?id=195445
2891         <rdar://problem/48480516>
2892
2893         Reviewed by Jer Noble.
2894
2895         No new tests, no functional change.
2896
2897         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2898         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC): Only register for 
2899         kCMSampleBufferConsumerNotification_BufferConsumed notiication when
2900         -[AVSampleBufferDisplayLayer prerollDecodeWithCompletionHandler:] isn't available.
2901         (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC): Ditto, for unregistering.
2902         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Use 
2903         -[AVSampleBufferDisplayLayer prerollDecodeWithCompletionHandler:] when possible.
2904
2905 2019-03-07  Zalan Bujtas  <zalan@apple.com>
2906
2907         [ContentChangeObserver] Click event fires immediately on hover menu at Ebbets.com
2908         https://bugs.webkit.org/show_bug.cgi?id=195397
2909
2910         Reviewed by Simon Fraser.
2911
2912         This patch introduces TouchEventScope to track changes triggered by touch start.
2913
2914         Test: fast/events/touch/ios/content-observation/visibility-change-on-touch-start-simple.html
2915
2916         * page/ios/ContentChangeObserver.cpp:
2917         (WebCore::ContentChangeObserver::touchEventDidStart):
2918         (WebCore::ContentChangeObserver::touchEventDidFinish):
2919         (WebCore::ContentChangeObserver::mouseMovedDidStart):
2920         (WebCore::ContentChangeObserver::mouseMovedDidFinish):
2921         (WebCore::ContentChangeObserver::adjustObservedState):
2922         (WebCore::ContentChangeObserver::TouchEventScope::TouchEventScope):
2923         (WebCore::ContentChangeObserver::TouchEventScope::~TouchEventScope):
2924         * page/ios/ContentChangeObserver.h:
2925         (WebCore::ContentChangeObserver::isObservingContentChanges const):
2926
2927 2019-03-07  Zalan Bujtas  <zalan@apple.com>
2928
2929         [ContentChangeObserver] Introduce fixed duration content observation
2930         https://bugs.webkit.org/show_bug.cgi?id=195295
2931         <rdar://problem/48579913>
2932
2933         Reviewed by Simon Fraser.
2934
2935         Some pages have a runloop-like scheduling setup where the content triggering change happens at a nested timer firing.
2936         This patch helps finding cases like that using a 32ms long fixed window. Currently nested timers get dropped on the floor and
2937         we stop observing for content changes before they even get fired.
2938
2939         Test: fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops.html
2940
2941         * page/ios/ContentChangeObserver.cpp:
2942         (WebCore::ContentChangeObserver::ContentChangeObserver):
2943         (WebCore::ContentChangeObserver::startContentObservationForDuration):
2944         (WebCore::ContentChangeObserver::completeDurationBasedContentObservation):
2945         (WebCore::ContentChangeObserver::didInstallDOMTimer):
2946         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
2947         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
2948         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
2949         (WebCore::ContentChangeObserver::styleRecalcDidStart):
2950         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
2951         (WebCore::ContentChangeObserver::cancelPendingActivities):
2952         (WebCore::ContentChangeObserver::didSuspendActiveDOMObjects):
2953         (WebCore::ContentChangeObserver::willDetachPage):
2954         (WebCore::ContentChangeObserver::contentVisibilityDidChange):
2955         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
2956         (WebCore::ContentChangeObserver::adjustObservedState):
2957         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
2958         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
2959         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange): Deleted.
2960         * page/ios/ContentChangeObserver.h:
2961         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
2962         (WebCore::ContentChangeObserver::isObservingContentChanges const):
2963         (WebCore::ContentChangeObserver::hasPendingActivity const):
2964
2965 2019-03-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
2966
2967         requestAnimationFrame should execute before the next frame
2968         https://bugs.webkit.org/show_bug.cgi?id=177484
2969
2970         Reviewed by Simon Fraser.
2971
2972         This change fixes two issues with animation timing:
2973
2974         1. Calling the requestAnimationFrame callbacks would have happened when
2975            the DisplayLink fires. This may have happened even if the frame is
2976            missed and no display is committed.
2977
2978         2. Style changes and layout triggered by script could trigger painting
2979            at more than 60fps. CoreAnimation commits could happen at more than
2980            60fps, although WindowServer will throttle those, and only some will
2981            be shown on the screen.
2982
2983         This change introduces a new paint scheduling model where painting is
2984         driven by a "RenderingUpdateScheduler", which only triggers paints once
2985         per 16.7ms frame.
2986
2987         Code that previously scheduled a compositing layer flush now schedules a
2988         "RenderingUpdate", and that update is driven by a DisplayRefreshMonitor
2989         callback. When the render happens, we service requestAnimationFrame callbacks,
2990         Web Animations and intersection observations per the "Update the rendering"
2991         step of the HTML Event Loop specification
2992         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
2993
2994         In the future, more rendering steps will be added to this code.
2995
2996         * Sources.txt:
2997         * WebCore.xcodeproj/project.pbxproj:
2998         * accessibility/mac/AXObjectCacheMac.mm:
2999         Fix layout tests by adding null check.
3000
3001         * animation/DocumentAnimationScheduler.cpp: Removed.
3002         * animation/DocumentAnimationScheduler.h: Removed.
3003         * animation/DocumentTimeline.cpp:
3004         (WebCore::DocumentTimeline::DocumentTimeline):
3005         (WebCore::DocumentTimeline::updateThrottlingState):
3006         (WebCore::DocumentTimeline::resumeAnimations):
3007         (WebCore::DocumentTimeline::liveCurrentTime const):
3008         (WebCore::DocumentTimeline::currentTime):
3009         (WebCore::DocumentTimeline::animationTimingDidChange):
3010         (WebCore::DocumentTimeline::scheduleAnimationResolution):
3011         (WebCore::DocumentTimeline::unscheduleAnimationResolution):
3012         (WebCore::DocumentTimeline::updateAnimationsAndSendEvents):
3013         (WebCore::DocumentTimeline::internalUpdateAnimationsAndSendEvents):
3014         (WebCore::DocumentTimeline::scheduleNextTick):
3015         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
3016         Simplify this function by handling the case of no-animations separately.
3017
3018         (WebCore::DocumentTimeline::resolveAnimationsForElement):
3019         Simplify the loop and delete hasPendingAcceleratedAnimations because it
3020         is initialized to true and is not changed inside the loop.
3021
3022         (WebCore::DocumentTimeline::scheduleAnimationResolutionIfNeeded): Deleted.
3023         (WebCore::DocumentTimeline::animationResolutionTimerFired): Deleted.
3024         * animation/DocumentTimeline.h:
3025         * dom/Document.cpp:
3026         (WebCore::Document::resolveStyle):
3027         There is no need to force update in resolveStyle(). notifyFlushRequired()
3028         will be called eventually which will scheduleRenderingUpdate().
3029
3030         (WebCore::Document::prepareForDestruction):
3031         (WebCore::Document::updateAnimationsAndSendEvents):
3032         (WebCore::Document::serviceRequestAnimationFrameCallbacks):
3033         (WebCore::Document::windowScreenDidChange):
3034         (WebCore::Document::updateIntersectionObservations):
3035         (WebCore::Document::scheduleForcedIntersectionObservationUpdate): Deleted.
3036         (WebCore::Document::animationScheduler): Deleted.
3037         * dom/Document.h:
3038         (WebCore::Document::numberOfIntersectionObservers const):
3039         * dom/ScriptedAnimationController.cpp:
3040         (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks):
3041         (WebCore::ScriptedAnimationController::scheduleAnimation):
3042         (WebCore::ScriptedAnimationController::animationTimerFired):
3043         (WebCore::ScriptedAnimationController::serviceScriptedAnimations): Deleted.
3044         (WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire): Deleted.
3045         * dom/ScriptedAnimationController.h:
3046         * page/FrameView.cpp:
3047         (WebCore::FrameView::viewportContentsChanged):
3048         * page/IntersectionObserver.cpp:
3049         (WebCore::IntersectionObserver::observe):
3050         * page/Page.cpp:
3051         (WebCore::Page::Page):
3052         (WebCore::Page::layoutIfNeeded):
3053         (WebCore::Page::renderingUpdate):
3054         (WebCore::Page::renderingUpdateScheduler):
3055         (WebCore::Page::willDisplayPage): Deleted.
3056         (WebCore::Page::addDocumentNeedingIntersectionObservationUpdate): Deleted.
3057         (WebCore::Page::updateIntersectionObservations): Deleted.
3058         (WebCore::Page::scheduleForcedIntersectionObservationUpdate): Deleted.
3059         * page/Page.h:
3060         * page/PageOverlayController.cpp:
3061         (WebCore::PageOverlayController::didChangeViewExposedRect):
3062         (WebCore::PageOverlayController::notifyFlushRequired):
3063         * page/ResourceUsageData.h:
3064         Include header files that become missing because of adding 
3065         RenderingUpdateScheduler.cpp.
3066
3067         * page/RenderingUpdateScheduler.cpp: Added.
3068         (WebCore::RenderingUpdateScheduler::RenderingUpdateScheduler):
3069         (WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
3070         (WebCore::RenderingUpdateScheduler::startTimer):
3071         (WebCore::RenderingUpdateScheduler::clearTimer):
3072         (WebCore::RenderingUpdateScheduler::windowScreenDidChange):
3073         (WebCore::RenderingUpdateScheduler::createDisplayRefreshMonitor const):
3074         (WebCore::RenderingUpdateScheduler::displayRefreshFired):
3075         * page/RenderingUpdateScheduler.h: Added.
3076         (WebCore::RenderingUpdateScheduler::create):
3077         * page/ios/ContentChangeObserver.h:
3078         Include header files that become missing because of adding 
3079         RenderingUpdateScheduler.cpp.
3080
3081         * page/mac/ServicesOverlayController.mm:
3082         (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired):
3083         * rendering/RenderLayerCompositor.cpp:
3084         (WebCore::RenderLayerCompositor::scheduleLayerFlushNow):
3085
3086 2019-03-07  Zalan Bujtas  <zalan@apple.com>
3087
3088         [ContentChangeObserver] Add a setting to be able to turn content change observation on/off
3089         https://bugs.webkit.org/show_bug.cgi?id=195353
3090         <rdar://problem/48626394>
3091
3092         Reviewed by Simon Fraser.
3093
3094         Move content observation tests to a dedicated directory.
3095
3096         Tests: fast/events/touch/ios/content-observation/click-instead-of-hover-simple.html
3097                fast/events/touch/ios/content-observation/hover-when-style-change-is-async.html
3098                fast/events/touch/ios/content-observation/stuck-with-hover-state.html
3099                fast/events/touch/ios/content-observation/style-recalc-schedule-and-force-relalc.html
3100                fast/events/touch/ios/content-observation/visibility-change-happens-at-the-second-timer.html
3101
3102         * page/Settings.yaml:
3103         * page/ios/ContentChangeObserver.cpp:
3104         (WebCore::ContentChangeObserver::didInstallDOMTimer):
3105         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
3106         * page/ios/ContentChangeObserver.h:
3107         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const): Deleted.
3108         * testing/InternalSettings.cpp:
3109         (WebCore::InternalSettings::resetToConsistentState):
3110
3111 2019-03-07  John Wilander  <wilander@apple.com>
3112
3113         Make sure an empty host matches the internal representation "nullOrigin" in WebCore::RegistrableDomain::matches()
3114         https://bugs.webkit.org/show_bug.cgi?id=195435
3115
3116         Reviewed by Brent Fulgham.
3117
3118         No new tests. Tests are currently failing and will pass again with
3119         this patch.
3120
3121         WebCore::RegistrableDomain::matches() is a quick way to compare a
3122         RegistrableDomain with a URL. Since RegistrableDomain represents the
3123         empty host as "nullOrigin," a URL with an empty host needs to match
3124         that representation in WebCore::RegistrableDomain::matches().
3125         Failure to do so caused debug assertions in fast/ layout tests after
3126         https://trac.webkit.org/changeset/242603/webkit.
3127
3128         * platform/RegistrableDomain.h:
3129         (WebCore::RegistrableDomain::matches const):
3130
3131 2019-03-07  Justin Fan  <justin_fan@apple.com>
3132
3133         Unreviewed build fixes since MTLClampToBorderColor is only supported on macOS.
3134
3135         * Modules/webgpu/GPUSamplerDescriptor.idl:
3136         * platform/graphics/gpu/GPUSamplerDescriptor.h:
3137         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm: Forgot include.
3138         * platform/graphics/gpu/cocoa/GPUSamplerMetal.mm:
3139         (WebCore::mtlAddressModeForAddressMode):
3140         (WebCore::tryCreateMtlSamplerState):
3141         (WebCore::mtlBorderColorForBorderColor): Deleted.
3142
3143 2019-03-07  Justin Fan  <justin_fan@apple.com>
3144
3145         [Web GPU] GPUSampler implementation
3146         https://bugs.webkit.org/show_bug.cgi?id=195427
3147         <rdar://problem/48686011>
3148
3149         Reviewed by Dean Jackson.
3150
3151         Implement ability to create GPUSamplers and use them as pipeline resource bindings.
3152
3153         Test: texture-triangle-strip.html updated.
3154
3155         Add symbols to project:
3156         * CMakeLists.txt:
3157         * DerivedSources-input.xcfilelist:
3158         * DerivedSources-output.xcfilelist:
3159         * DerivedSources.make:
3160         * Sources.txt:
3161         * SourcesCocoa.txt:
3162         * WebCore.xcodeproj/project.pbxproj:
3163         * bindings/js/WebCoreBuiltinNames.h:
3164
3165         GPUSampler creation:
3166         * Modules/webgpu/GPUSamplerDescriptor.idl: Added.
3167         * Modules/webgpu/WebGPUDevice.cpp:
3168         (WebCore::WebGPUDevice::createSampler const): Added.
3169         * Modules/webgpu/WebGPUDevice.h:
3170         * Modules/webgpu/WebGPUDevice.idl:
3171         * Modules/webgpu/WebGPUSampler.cpp: Added.
3172         (WebCore::WebGPUSampler::create):
3173         (WebCore::WebGPUSampler::WebGPUSampler):
3174         * Modules/webgpu/WebGPUSampler.h: Added.
3175         (WebCore::WebGPUSampler::sampler const):
3176         * Modules/webgpu/WebGPUSampler.idl: Added.
3177         * platform/graphics/gpu/GPUDevice.cpp:
3178         (WebCore::GPUDevice::tryCreateSampler const): Added.
3179         * platform/graphics/gpu/GPUDevice.h:
3180         * platform/graphics/gpu/GPUSampler.h: Added.
3181         (WebCore::GPUSampler::platformSampler const):
3182         * platform/graphics/gpu/GPUSamplerDescriptor.h: Added.
3183         * platform/graphics/gpu/cocoa/GPUSamplerMetal.mm: Added.
3184         (WebCore::mtlAddressModeForAddressMode):
3185         (WebCore::mtlBorderColorForBorderColor):
3186         (WebCore::mtlMinMagFilterForFilterMode):
3187         (WebCore::mtlMipFilterForFilterMode):
3188         (WebCore::tryCreateMtlSamplerState):
3189         (WebCore::GPUSampler::tryCreate):
3190         (WebCore::GPUSampler::GPUSampler):
3191
3192         Move GPUCompareFunction to Utils for shared use.
3193         * platform/graphics/gpu/GPUCompareFunction.h:
3194         * platform/graphics/gpu/GPUUtils.h:
3195         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
3196         (WebCore::tryCreateMtlDepthStencilState):
3197         (WebCore::validateAndConvertDepthCompareFunctionToMtl): Deleted.
3198         * platform/graphics/gpu/cocoa/GPUUtilsMetal.mm:
3199         (WebCore::platformTextureFormatForGPUTextureFormat):
3200         (WebCore::platformCompareFunctionForGPUCompareFunction):
3201
3202         Expand bind groups to accept GPUSamplers:
3203         * Modules/webgpu/WebGPUBindGroupBinding.h:
3204         * Modules/webgpu/WebGPUBindGroupBinding.idl:
3205         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
3206         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const):
3207         * platform/graphics/gpu/GPUBindGroupBinding.h:
3208         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
3209         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
3210         (WebCore::GPUProgrammablePassEncoder::setBindGroup):
3211         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder):
3212         (WebCore::GPUProgrammablePassEncoder::setResourceAsSamplerOnEncoder): Added.
3213         (WebCore::GPUProgrammablePassEncoder::setResourceAsTextureOnEncoder):
3214
3215         Misc:
3216         * Modules/webgpu/WebGPUTexture.cpp: Missing includes.
3217         * Modules/webgpu/WebGPUTexture.h:
3218         * Modules/webgpu/WebGPUSwapChain.cpp: Removed extra include.
3219
3220 2019-03-07  Commit Queue  <commit-queue@webkit.org>
3221
3222         Unreviewed, rolling out r242297.
3223         https://bugs.webkit.org/show_bug.cgi?id=195430
3224
3225         Broke Microsoft Visio. (Requested by dydz on #webkit).
3226
3227         Reverted changeset:
3228
3229         "[iOS] Turn mouse event simulation on by default"
3230         https://bugs.webkit.org/show_bug.cgi?id=195218
3231         https://trac.webkit.org/changeset/242297
3232
3233 2019-03-07  Sihui Liu  <sihui_liu@apple.com>
3234
3235         Crash in com.apple.WebCore: WebCore::IDBTransaction::pendingOperationTimerFired + 72
3236         https://bugs.webkit.org/show_bug.cgi?id=195214
3237         <rdar://problem/48461116>
3238
3239         Reviewed by Geoffrey Garen.
3240
3241         When IDBTransaction is ready to commit, a commit operation would be schedule to 
3242         m_pendingTransactionOperationQueue. If connection to IDBServer is lost, pending operations are moved to 
3243         m_transactionOperationsInProgressQueue and will be completed with TransactionOperation::doComplete. doComplete 
3244         executes complete function of the operation, clears the complete function, and then removes the operation from 
3245         m_transactionOperationsInProgressQueue. In doComplete, we do early return when complete function is null, 
3246         since the doComplete could be invoked twice due to the race conditions between receiving "operation complete" 
3247         message from server and client-side abort.
3248
3249         However, commit operation does not have a complete function because it should be the last operation of 
3250         transaction and it gets removed from queue in its perform function. A commit operation would not be removed from 
3251         m_transactionOperationsInProgressQueue because of the early return. It would be removed from 
3252         m_transactionOperationMap, which may hold the last ref to the commit operation, in 
3253         IDBTransaction::connectionClosedFromServer. In this case, when pendingOperationTimerFired is called later, the 
3254         commit operation left in m_transactionOperationsInProgressQueue would be used and found to be freed. We should
3255         not use null check of complete function to decide whether an operation is completed.
3256
3257         * Modules/indexeddb/client/TransactionOperation.h:
3258         (WebCore::IDBClient::TransactionOperation::doComplete):
3259
3260 2019-03-07  John Wilander  <wilander@apple.com>
3261
3262         Resource Load Statistics: Log first-party navigations with link decoration
3263         https://bugs.webkit.org/show_bug.cgi?id=195301
3264         <rdar://problem/48569971>
3265
3266         Reviewed by Brent Fulgham.
3267
3268         Test: http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration.html
3269
3270         This patch adds two new members to WebCore::ResourceLoadStatistics:
3271         - topFrameLinkDecorationsFrom, a set of domains
3272         - gotLinkDecorationFromPrevalentResource, a boolean state
3273
3274         * loader/ResourceLoadStatistics.cpp:
3275         (WebCore::ResourceLoadStatistics::encode const):
3276         (WebCore::ResourceLoadStatistics::decode):
3277         (WebCore::ResourceLoadStatistics::toString const):
3278         (WebCore::ResourceLoadStatistics::merge):
3279         * loader/ResourceLoadStatistics.h:
3280
3281 2019-03-07  Simon Fraser  <simon.fraser@apple.com>
3282
3283         [iOS WK] REGRESSION (r242132): Fixed position banners flicker and move when scrolling (Apple, Tesla, YouTube, Reddit)
3284         https://bugs.webkit.org/show_bug.cgi?id=195396
3285         rdar://problem/48518959
3286
3287         Reviewed by Antti Koivisto.
3288         
3289         r242132 introduced two issues that contributed to jumpiness of position:fixed layers when scrolling.
3290         
3291         First, ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling() would early return if the scroll position
3292         hadn't changed. It also needs to check the supplied layoutViewport (if any), but in some cases running the
3293         notifyRelatedNodesAfterScrollPositionChange() code is necessary even without a scroll position change:
3294         if the web process has committed new scrolling tree state (e.g. with new fixed constraints) since
3295         the last call, we have to run the layer positioning code to have fixed layers re-adjust their position relative
3296         to the root. This was the primary bug fix.
3297
3298         Secondly, a layer tree commit can give ScrollingTreeFrameScrollingNode a new layout viewport, but we need to
3299         adjust this by the scrolling tree's current scroll position in case it gets used before the next scroll.
3300
3301         Currently no way to test this, as it's very timing-dependent.
3302
3303         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
3304         (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
3305         (WebCore::ScrollingTreeFrameScrollingNode::scrollPositionAndLayoutViewportMatch):
3306         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
3307         * page/scrolling/ScrollingTreeScrollingNode.cpp:
3308         (WebCore::ScrollingTreeScrollingNode::scrollPositionAndLayoutViewportMatch):
3309         (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
3310         * page/scrolling/ScrollingTreeScrollingNode.h:
3311
3312 2019-03-07  Youenn Fablet  <youenn@apple.com>
3313
3314         Introduce a quota manager for Cache API/Service Worker/IDB storage
3315         https://bugs.webkit.org/show_bug.cgi?id=195283
3316
3317         Reviewed by Chris Dumez.
3318
3319         Introduce a generic quota manager and quota users to be used in Network Process.
3320         Quota manager/users are scoped by client origin.
3321         Quota manager is used to check for quota by an entity wanting to execute a storage task of a given taskSize.
3322         Quota manager will check the current space used by all its quota users.
3323         If the size + taskSize is above quota, it will call a function to try extend the quota.
3324         In the meantime, the task (and all tasks that may be added) are queued.
3325
3326         Once the new quota is received, the quota manager will either allow or disallow the first task in the queue.
3327         The quota manager will try to execute as many tasks as possible with the provided quota.
3328         If some tasks are remaining and quota limit is hit, the quota manager will compute the space needed for all remaining requests
3329         and do another quota extension request.
3330
3331         * Sources.txt:
3332         * WebCore.xcodeproj/project.pbxproj:
3333         * page/ClientOrigin.h:
3334         * storage/StorageQuotaManager.cpp: Added.
3335         (WebCore::StorageQuotaManager::~StorageQuotaManager):
3336         (WebCore::StorageQuotaManager::spaceUsage const):
3337         (WebCore::StorageQuotaManager::requestSpace):
3338         (WebCore::StorageQuotaManager::askForMoreSpace):
3339         (WebCore::StorageQuotaManager::processPendingRequests):
3340         * storage/StorageQuotaManager.h: Added.
3341         (WebCore::StorageQuotaManager::StorageQuotaManager):
3342         (WebCore::StorageQuotaManager::addUser):
3343         (WebCore::StorageQuotaManager::removeUser):
3344         * storage/StorageQuotaUser.h: Added.
3345
3346 2019-03-07  John Wilander  <wilander@apple.com>
3347
3348         Resource Load Statistics: Make it possible to purge only script-accessible cookies
3349         https://bugs.webkit.org/show_bug.cgi?id=195383
3350         <rdar://problem/48570136>
3351
3352         Reviewed by Brent Fulgham.
3353
3354         Test: http/tests/resourceLoadStatistics/delete-script-accessible-cookies.html
3355
3356         This patch provides the ability to purge all script-accessible cookies while leaving
3357         HttpOnly cookies in place.
3358
3359         * loader/CookieJar.h:
3360             Added boolean enum IncludeHttpOnlyCookies for use as function parameter.
3361         * platform/network/NetworkStorageSession.h:
3362         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
3363         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
3364             Support for the new IncludeHttpOnlyCookies flag.
3365         * platform/network/curl/NetworkStorageSessionCurl.cpp:
3366         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
3367             Stubbed out the new function and added a FIXME comment.
3368         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3369         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
3370             Stubbed out the new function and added a FIXME comment.
3371
3372 2019-03-06  Mark Lam  <mark.lam@apple.com>
3373
3374         Exception is a JSCell, not a JSObject.
3375         https://bugs.webkit.org/show_bug.cgi?id=195392
3376
3377         Reviewed by Saam Barati.
3378
3379         * bridge/objc/objc_utility.h:
3380         * bridge/objc/objc_utility.mm:
3381         (JSC::Bindings::throwError):
3382         * bridge/runtime_object.cpp:
3383         (JSC::Bindings::RuntimeObject::throwInvalidAccessError):
3384         * bridge/runtime_object.h:
3385
3386 2019-03-07  Devin Rousso  <drousso@apple.com>
3387
3388         Web Inspector: Canvas: lazily create the agent
3389         https://bugs.webkit.org/show_bug.cgi?id=195241
3390
3391         Reviewed by Joseph Pecoraro.
3392
3393         No functionality change.
3394
3395