b7987559edc23c6e342990ec1a11ff5fd7fd90ec
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-08-05  Rob Buis  <rbuis@igalia.com>
2
3         [GTK][WPE] Fetch tests assert in SubresourceLoader::didReceiveResponse()
4         https://bugs.webkit.org/show_bug.cgi?id=188163
5
6         Reviewed by Frédéric Wang.
7
8         Fetch in manual redirect mode uses didReceiveResponse instead of
9         willSendRequestInternal, so update the ASSERT.
10
11         * loader/SubresourceLoader.cpp:
12         (WebCore::SubresourceLoader::didReceiveResponse):
13
14 2018-08-05  Yusuke Suzuki  <utatane.tea@gmail.com>
15
16         Add support for microtasks in workers
17         https://bugs.webkit.org/show_bug.cgi?id=188246
18
19         Reviewed by Darin Adler.
20
21         This patch adds the microtask mechanism to workers. To adopt the existing microtask mechanism from the main thread,
22         we extend JSMainThreadExecState for non-main-threads. We rename it to JSExecState, and store stacked
23         ExecState* data in thread local storage in ThreadGlobalData instead of a static variable s_mainThreadState.
24
25         We add MicrotaskQueue to WorkerGlobalScope since each worker has its own thread and it should have its
26         own microtask queue.
27
28         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
29         * Sources.txt:
30         * WebCore.xcodeproj/project.pbxproj:
31         * bindings/js/JSBindingsAllInOne.cpp:
32         * bindings/js/JSCallbackData.cpp:
33         (WebCore::JSCallbackData::invokeCallback):
34         * bindings/js/JSCustomElementInterface.cpp:
35         (WebCore::constructCustomElementSynchronously):
36         (WebCore::JSCustomElementInterface::upgradeElement):
37         (WebCore::JSCustomElementInterface::invokeCallback):
38         * bindings/js/JSCustomXPathNSResolver.cpp:
39         (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
40         * bindings/js/JSDOMGlobalObjectTask.cpp:
41         * bindings/js/JSDOMWindowBase.cpp:
42         (WebCore::JSDOMWindowBase::queueTaskToEventLoop):
43         Queue a microtask to MicrotaskQueue instead of posting a macrotask.
44
45         (WebCore::JSDOMWindowMicrotaskCallback::create): Deleted.
46         (WebCore::JSDOMWindowMicrotaskCallback::call): Deleted.
47         (WebCore::JSDOMWindowMicrotaskCallback::JSDOMWindowMicrotaskCallback): Deleted.
48         (): Deleted.
49         Extract JSDOMWindowMicrotaskCallback as JSMicrotaskCallback and create a new file for it.
50
51         * bindings/js/JSErrorHandler.cpp:
52         (WebCore::JSErrorHandler::handleEvent):
53         * bindings/js/JSEventListener.cpp:
54         (WebCore::JSEventListener::handleEvent):
55         * bindings/js/JSExecState.cpp: Renamed from Source/WebCore/bindings/js/JSMainThreadExecState.cpp.
56         (WebCore::JSExecState::didLeaveScriptContext):
57         If we are in a main thread, we consume main thread microtask queue. If we are in worker thread,
58         we consume a microtask queue per worker.
59
60         (WebCore::functionCallHandlerFromAnyThread):
61         (WebCore::evaluateHandlerFromAnyThread):
62         * bindings/js/JSExecState.h: Renamed from Source/WebCore/bindings/js/JSMainThreadExecState.h.
63         (WebCore::JSExecState::currentState):
64         (WebCore::JSExecState::call):
65         (WebCore::JSExecState::evaluate):
66         (WebCore::JSExecState::profiledCall):
67         (WebCore::JSExecState::profiledEvaluate):
68         (WebCore::JSExecState::runTask):
69         (WebCore::JSExecState::loadModule):
70         (WebCore::JSExecState::linkAndEvaluateModule):
71         (WebCore::JSExecState::JSExecState):
72         (WebCore::JSExecState::~JSExecState):
73         (WebCore::JSExecState::setCurrentState):
74         Store and load ExecState in thread local storage, ThreadGlobalData. This allows us to use it for workers.
75
76         (WebCore::JSMainThreadNullState::JSMainThreadNullState):
77         (WebCore::JSMainThreadNullState::~JSMainThreadNullState):
78         We keep this name "JSMainThreadNullState" since CustomElementReactionStack should be stick to the main thread.
79         And this class is only used in the main thread.
80
81         * bindings/js/JSExecStateInstrumentation.h: Renamed from Source/WebCore/bindings/js/JSMainThreadExecStateInstrumentation.h.
82         (WebCore::JSExecState::instrumentFunctionInternal):
83         (WebCore::JSExecState::instrumentFunctionCall):
84         (WebCore::JSExecState::instrumentFunctionConstruct):
85         * bindings/js/JSMicrotaskCallback.h: Copied from Source/WebKitLegacy/mac/DOM/DOMHTMLBaseElement.mm.
86         (WebCore::JSMicrotaskCallback::create):
87         (WebCore::JSMicrotaskCallback::call):
88         (WebCore::JSMicrotaskCallback::JSMicrotaskCallback):
89         * bindings/js/JSWorkerGlobalScopeBase.cpp:
90         (WebCore::JSWorkerGlobalScopeBase::queueTaskToEventLoop):
91         * bindings/js/ScheduledAction.cpp:
92         (WebCore::ScheduledAction::executeFunctionInContext):
93         * bindings/js/ScriptController.cpp:
94         (WebCore::ScriptController::evaluateInWorld):
95         (WebCore::ScriptController::loadModuleScriptInWorld):
96         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
97         (WebCore::ScriptController::canAccessFromCurrentOrigin):
98         * bindings/js/WorkerScriptController.cpp:
99         (WebCore::WorkerScriptController::evaluate):
100         * bridge/objc/WebScriptObject.mm:
101         (-[WebScriptObject callWebScriptMethod:withArguments:]):
102         (-[WebScriptObject evaluateWebScript:]):
103         * html/canvas/WebGLRenderingContextBase.cpp:
104         (WebCore::WebGLRenderingContextBase::compileShader):
105         (WebCore::WebGLRenderingContextBase::printToConsole):
106         * inspector/InspectorCanvas.cpp:
107         (WebCore::InspectorCanvas::buildObjectForCanvas):
108         (WebCore::InspectorCanvas::buildAction):
109         * inspector/InspectorController.cpp:
110         * inspector/InspectorFrontendHost.cpp:
111         * inspector/TimelineRecordFactory.cpp:
112         (WebCore::TimelineRecordFactory::createGenericRecord):
113         * inspector/WorkerInspectorController.cpp:
114         * inspector/agents/InspectorCanvasAgent.cpp:
115         * inspector/agents/InspectorNetworkAgent.cpp:
116         (WebCore::InspectorNetworkAgent::buildInitiatorObject):
117         * page/DOMWindow.cpp:
118         (WebCore::DOMWindow::postMessage):
119         * page/PageConsoleClient.cpp:
120         (WebCore::PageConsoleClient::addMessage):
121         * page/csp/ContentSecurityPolicy.cpp:
122         (WebCore::ContentSecurityPolicy::reportViolation const):
123         * platform/ThreadGlobalData.h:
124         (WebCore::ThreadGlobalData::ThreadGlobalData::currentState const):
125         (WebCore::ThreadGlobalData::ThreadGlobalData::setCurrentState):
126         * workers/WorkerGlobalScope.cpp:
127         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
128         (WebCore::WorkerGlobalScope::removeMicrotaskQueue):
129         * workers/WorkerGlobalScope.h:
130         (WebCore::WorkerGlobalScope::microtaskQueue const):
131         * workers/WorkerThread.cpp:
132         (WebCore::WorkerThread::stop):
133         * workers/service/ExtendableEvent.cpp:
134         (WebCore::ExtendableEvent::addExtendLifetimePromise):
135         When dispatching an "install" event from service worker, we first create an event,
136         dispatch it, and set a handler which is called when a pending promise count becomes zero.
137         However, the old code checked pending promise count in a queued microtask. It worked
138         previously because microtask is actually a macrotask in the service worker. So this check
139         is done after a handler is set. But this patch introduces real microtask, and this check
140         happens before a handler is set because dispatching an event can exhaust microtask queue.
141         According to the spec, this check should not be done in microtask[1]. We make this checking
142         part as a macrotask. We note that algorithm noted as FIXMEs should be done in this
143         microtask while the checking part should not be done.
144
145         [1]: https://w3c.github.io/ServiceWorker/#installation-algorithm
146
147 2018-08-05  Ryosuke Niwa  <rniwa@webkit.org>
148
149         Properties set on window.customElements can disappear due to GC
150         https://bugs.webkit.org/show_bug.cgi?id=172575
151
152         Lexicologically sort the IDL attributes per Darin's comment.
153
154         * dom/CustomElementRegistry.idl:
155
156 2018-08-05  Zalan Bujtas  <zalan@apple.com>
157
158         [LFC][BFC] contentHeightForFormattingContextRoot uses the wrong coordinate system to compute the height.
159         https://bugs.webkit.org/show_bug.cgi?id=188319
160
161         Reviewed by Antti Koivisto.
162
163         Display::Box::marginBox() is in the coordinate system of the box itself (8px top margin translates to y = -8px).
164         What we need instead to compute the content height is the top/bottom position in the containing block's coordinate system (rect and rectWithMargin).
165
166         * layout/FormattingContextGeometry.cpp:
167         (WebCore::Layout::contentHeightForFormattingContextRoot):
168
169 2018-08-05  Ms2ger  <Ms2ger@igalia.com>
170
171         [GStreamer] Remove unsound assertions in MediaPlayerPrivateGStreamerBase.
172         https://bugs.webkit.org/show_bug.cgi?id=188162
173
174         Reviewed by Philippe Normand.
175
176         These assertions sometimes fail, and there's a runtime check right
177         after them anyway.
178
179         Tests: fast/canvas/webgl/texImage2D-video-flipY-false.html
180                fast/canvas/webgl/texImage2D-video-flipY-true.html
181
182         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
183         (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture):
184         (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
185
186 2018-08-05  Philippe Normand  <pnormand@igalia.com>
187
188         [MediaCapabilities] Platform integration
189         https://bugs.webkit.org/show_bug.cgi?id=187850
190
191         Reviewed by Eric Carlson.
192
193         Mock platform support for the MediaCapabilities specification.
194
195         Test: media/mediacapabilities/mock-decodingInfo.html
196               media/mediacapabilities/mock-encodingInfo.html
197
198         * Modules/mediacapabilities/MediaCapabilities.cpp:
199         (WebCore::MediaCapabilities::decodingInfo):
200         (WebCore::MediaCapabilities::encodingInfo):
201         * Modules/mediacapabilities/MediaCapabilitiesInfo.h:
202         (WebCore::MediaCapabilitiesInfo::create):
203         * PlatformGTK.cmake:
204         * PlatformMac.cmake:
205         * PlatformWPE.cmake:
206         * Sources.txt:
207         * WebCore.xcodeproj/project.pbxproj:
208         * platform/mediacapabilities/MediaEngineConfiguration.cpp: Added.
209         (WebCore::MediaEngineVideoConfiguration::MediaEngineVideoConfiguration):
210         (WebCore::MediaEngineAudioConfiguration::MediaEngineAudioConfiguration):
211         (WebCore::MediaEngineConfiguration::MediaEngineConfiguration):
212         * platform/mediacapabilities/MediaEngineConfiguration.h: Added.
213         (WebCore::MediaEngineVideoConfiguration::create):
214         (WebCore::MediaEngineVideoConfiguration::contentType const):
215         (WebCore::MediaEngineVideoConfiguration::size const):
216         (WebCore::MediaEngineVideoConfiguration::bitrate const):
217         (WebCore::MediaEngineVideoConfiguration::framerate const):
218         (WebCore::MediaEngineAudioConfiguration::create):
219         (WebCore::MediaEngineAudioConfiguration::contentType const):
220         (WebCore::MediaEngineAudioConfiguration::channels const):
221         (WebCore::MediaEngineAudioConfiguration::bitrate const):
222         (WebCore::MediaEngineAudioConfiguration::samplerate const):
223         (WebCore::MediaEngineConfiguration::audioConfiguration const):
224         (WebCore::MediaEngineConfiguration::videoConfiguration const):
225         * platform/mediacapabilities/MediaEngineConfigurationFactory.cpp: Added.
226         (WebCore::mockEnabled):
227         (WebCore::MediaEngineConfigurationFactory::createDecodingConfiguration):
228         (WebCore::MediaEngineConfigurationFactory::createEncodingConfiguration):
229         (WebCore::MediaEngineConfigurationFactory::enableMock):
230         (WebCore::MediaEngineConfigurationFactory::disableMock):
231         * platform/mediacapabilities/MediaEngineConfigurationFactory.h: Added.
232         * platform/mediacapabilities/MediaEngineDecodingConfiguration.h: Added.
233         (WebCore::MediaEngineDecodingConfiguration::MediaEngineDecodingConfiguration):
234         (WebCore::MediaEngineDecodingConfiguration::canDecodeMedia):
235         (WebCore::MediaEngineDecodingConfiguration::canSmoothlyDecodeMedia):
236         (WebCore::MediaEngineDecodingConfiguration::canPowerEfficientlyDecodeMedia):
237         (WebCore::MediaEngineDecodingConfiguration::decodingType const):
238         * platform/mediacapabilities/MediaEngineEncodingConfiguration.h: Added.
239         (WebCore::MediaEngineEncodingConfiguration::MediaEngineEncodingConfiguration):
240         (WebCore::MediaEngineEncodingConfiguration::canEncodeMedia):
241         (WebCore::MediaEngineEncodingConfiguration::canSmoothlyEncodeMedia):
242         (WebCore::MediaEngineEncodingConfiguration::canPowerEfficientlyEncodeMedia):
243         (WebCore::MediaEngineEncodingConfiguration::encodingType const):
244         * platform/mock/MediaEngineDecodingConfigurationMock.cpp: Added.
245         (WebCore::MediaEngineDecodingConfigurationMock::canDecodeMedia):
246         (WebCore::MediaEngineDecodingConfigurationMock::canSmoothlyDecodeMedia):
247         (WebCore::MediaEngineDecodingConfigurationMock::canPowerEfficientlyDecodeMedia):
248         * platform/mock/MediaEngineDecodingConfigurationMock.h: Added.
249         * platform/mock/MediaEngineEncodingConfigurationMock.cpp: Added.
250         (WebCore::MediaEngineEncodingConfigurationMock::canEncodeMedia):
251         (WebCore::MediaEngineEncodingConfigurationMock::canSmoothlyEncodeMedia):
252         (WebCore::MediaEngineEncodingConfigurationMock::canPowerEfficientlyEncodeMedia):
253         * platform/mock/MediaEngineEncodingConfigurationMock.h: Added.
254         * testing/Internals.cpp:
255         (WebCore::Internals::resetToConsistentState):
256         (WebCore::Internals::enableMockMediaCapabilities):
257         * testing/Internals.h:
258         * testing/Internals.idl:
259
260 2018-08-04  Simon Fraser  <simon.fraser@apple.com>
261
262         Make WebCore::Timer more space-efficient
263         https://bugs.webkit.org/show_bug.cgi?id=187455
264
265         Reviewed by Brent Fulgham.
266
267         Steal a bit from m_heapIndex for m_wasDeleted to eliminate padding in Timer.
268         This reduces the size of Document, which has 8 Timers, from 3360 to 3296 bytes (saving 64 bytes).
269
270         * platform/Timer.cpp:
271         (WebCore::TimerBase::TimerBase):
272         * platform/Timer.h:
273
274 2018-08-04  Ryosuke Niwa  <rniwa@webkit.org>
275
276         Properties set on window.customElements can disappear due to GC
277         https://bugs.webkit.org/show_bug.cgi?id=172575
278         <rdar://problem/32440668>
279
280         Reviewed by Saam Barati.
281
282         Fixed the bug that JS wrapper of CustomElementsRegistry can erroneously get collected during GC
283         by keeping it alive as long as the global object is alive.
284
285         Test: fast/custom-elements/custom-element-registry-wrapper-should-stay-alive.html
286
287         * dom/CustomElementRegistry.cpp:
288         (WebCore::CustomElementRegistry::create):
289         (WebCore::CustomElementRegistry::CustomElementRegistry):
290         * dom/CustomElementRegistry.h:
291         (WebCore::CustomElementRegistry): Make this inherited from ContextDestructionObserver.
292         * dom/CustomElementRegistry.idl: Set GenerateIsReachable=ImplScriptExecutionContext in IDL. This will
293         make CustomElementRegistry reachable from the global object.
294         * page/DOMWindow.cpp:
295         (WebCore::DOMWindow::ensureCustomElementRegistry):
296
297 2018-08-03  Ryosuke Niwa  <rniwa@webkit.org>
298
299         innerHTML should not synchronously create a custom element
300         https://bugs.webkit.org/show_bug.cgi?id=188327
301         <rdar://problem/42923114>
302
303         Reviewed by Daniel Bates.
304
305         Fixed the bug that the fragment parsing algorithm was synchronously constructing a custom element instead of
306         enqueuing an element to upgrade.
307
308         The fragment parsing algorithm creates an element for a token with *will execute script* flag set to false:
309         https://html.spec.whatwg.org/multipage/parsing.html#create-an-element-for-the-token
310         which results in creating an element with synchronous custom elements flag *not* set:
311         https://dom.spec.whatwg.org/#concept-create-element
312
313         When synchronous custom elements flag is false, we're supposed to create an element and enqueue a custom element
314         upgrade reaction. createHTMLElementOrFindCustomElementInterface was missing this last logic. 
315
316         Also fixed a bug that Element::enqueueToUpgrade would hit a debug assertion when a custom element which has been
317         enqueued to upgrade is enqueued to upgrade for the second time. In this case, we need to put the element into the
318         current element queue (https://html.spec.whatwg.org/multipage/custom-elements.html#current-element-queue) again.
319
320         While the specification simply enqueues another upgrade reaction and bails out immediately in the first step of
321         the upgrade, WebKit's implementation simply avoids this redundancy in the first place:
322         https://html.spec.whatwg.org/multipage/custom-elements.html#concept-upgrade-an-element
323
324         Existing tests such as imported/w3c/web-platform-tests/custom-elements/reactions/Document.html exercises this
325         code path after the fragment parsing algorithm fix.
326
327         Tests: imported/w3c/web-platform-tests/custom-elements/connected-callbacks-html-fragment-parsing.html
328
329         * dom/CustomElementReactionQueue.cpp:
330         (WebCore::CustomElementReactionQueueItem::type const): Added for an assertion.
331         (WebCore::CustomElementReactionQueue::enqueueElementUpgrade): Enqueue this element to the current element queue
332         by calling ensureCurrentQueue and avoid inserting a redundant upgrade reaction.
333         * dom/CustomElementReactionQueue.h:
334         * dom/Element.cpp:
335         (WebCore::Element::enqueueToUpgrade): Handle the case when a custom element is enqueued to upgrade for the second
336         time while it had been waiting in some element queue. In this case, the reaction queue for this element has
337         already been created and we simply need to put this element back into the current element queue (i.e. this element
338         now belongs to both element queues).
339         * html/parser/HTMLConstructionSite.cpp:
340         (WebCore::findCustomElementInterface): Extracted out of createHTMLElementOrFindCustomElementInterface.
341         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface): Fixed the bug that the HTML parser
342         was synchronously constructing a custom element even for the fragment parsing algorithm.
343
344 2018-08-03  Ben Richards  <benton_richards@apple.com>
345
346         We should cache the compiled sandbox profile in a data vault
347         https://bugs.webkit.org/show_bug.cgi?id=184991
348
349         Reviewed by Ryosuke Niwa.
350
351         Added functionality to FileHandle so that it can lock a file while open.
352         Added a function to FileSystem to delete non empty directories.
353
354         * platform/FileHandle.cpp:
355         (WebCore::FileHandle::FileHandle):
356         (WebCore::FileHandle::open):
357         (WebCore::FileHandle::close):
358         * platform/FileHandle.h:
359         * platform/FileSystem.h:
360         * platform/cocoa/FileSystemCocoa.mm:
361         (WebCore::FileSystem::deleteNonEmptyDirectory):
362
363 2018-08-03  Justin Fan  <justin_fan@apple.com>
364
365         WebGL 2 conformance: vertex_arrays/vertex_array_object.html
366         https://bugs.webkit.org/show_bug.cgi?id=188291
367         <rdar://problem/42792709>
368
369         Reviewed by Dean Jackson.
370
371         Get https://www.khronos.org/registry/webgl/conformance-suites/2.0.0/conformance2/vertex_arrays/vertex-array-object.html 
372         working on Mac OS and iOS, and check in the new test expectations.
373
374         Existing test: webgl/2.0.0/conformance2/vertex_arrays/vertex-array-object.html
375
376         * html/canvas/WebGL2RenderingContext.cpp:
377         (WebCore::WebGL2RenderingContext::initializeVertexArrayObjects):
378         (WebCore::WebGL2RenderingContext::deleteVertexArray):
379         * html/canvas/WebGLRenderingContextBase.cpp:
380         (WebCore::WebGLRenderingContextBase::deleteObject):
381         * html/canvas/WebGLVertexArrayObject.cpp:
382         (WebCore::WebGLVertexArrayObject::WebGLVertexArrayObject):
383         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
384         (WebCore::GraphicsContext3D::checkVaryingsPacking const):
385         (WebCore::GraphicsContext3D::createVertexArray):
386         (WebCore::GraphicsContext3D::deleteVertexArray):
387         (WebCore::GraphicsContext3D::isVertexArray):
388         (WebCore::GraphicsContext3D::bindVertexArray):
389
390 2018-08-03  Sam Weinig  <sam@webkit.org>
391
392         Remove WebGPUObject
393         https://bugs.webkit.org/show_bug.cgi?id=188114
394
395         Reviewed by Darin Adler.
396
397         This removes the unecessary WebGPUObject base class and updates the classes
398         that were inheriting from it to instead inherit directly from RefCounted. This
399         shrinks the size of all the classes that were inheriting from it, as they no
400         longer store a RefPtr<WebGPURenderingContext> member, which is unused. Most
401         of the classes also shrink because they can be devirtualized.
402
403         This also updates most of the create functions and constructors for the classes
404         that were inheriting from WebGPUObject to no longer require the WebGPURenderingContext
405         to be passed in. 
406         - For WebGPUBuffer, WebGPUCommandQueue, WebGPUComputeCommandEncoder, WebGPUComputePipelineState, 
407         WebGPUDepthStencilState, WebGPUDrawable, WebGPUFunction, WebGPULibrary, WebGPURenderCommandEncoder, 
408         WebGPURenderPassDepthAttachmentDescriptor, WebGPURenderPipelineColorAttachmentDescriptor, 
409         WebGPURenderPipelineState, and WebGPUTexture the WebGPURenderingContext and any other additional 
410         parameters needed for initialization were replaced with the underlying type (e.g. WebGPUBuffer 
411         now gets passed a GPUBuffer).
412         - WebGPUCommandBuffer is passed a GPUCommandQueue, since it needs to construct the underlying
413         GPUCommandBuffer itself so it can pass in the completion handler.
414         - For WebGPUDepthStencilDescriptor, WebGPURenderPassAttachmentDescriptor, 
415         WebGPURenderPassColorAttachmentDescriptor, WebGPURenderPassDescriptor and WebGPURenderPipelineDescriptor
416         the create and constructor functions are empty.        
417
418         * Sources.txt:
419         * WebCore.xcodeproj/project.pbxproj:
420         Remove WebGPUObject.h/cpp
421
422         * html/canvas/WebGPUBuffer.cpp:
423         (WebCore::WebGPUBuffer::WebGPUBuffer):
424         * html/canvas/WebGPUBuffer.h:
425         * html/canvas/WebGPUBuffer.idl:
426         Switch from inheriting from WebGPUObject to directly inheriting from 
427         RefCounted<WebGPUBuffer>. Since this de-virtualizes it, also add 
428         ImplementationLacksVTable to the IDL file. Also update create 
429         and constructor to take a GPUBuffer directly, rather than the context.
430
431         * html/canvas/WebGPUCommandBuffer.cpp:
432         (WebCore::WebGPUCommandBuffer::create):
433         (WebCore::WebGPUCommandBuffer::WebGPUCommandBuffer):
434         Update create and constructor to no longer require a context, as it would
435         now be unused, as it no longer inherits from WebGPUObject nor needs to hold
436         onto the context for any reason.
437
438         (WebCore::WebGPUCommandBuffer::createRenderCommandEncoderWithDescriptor):
439         Update to call the new WebGPURenderCommandEncoder::create, which no longer
440         requires a context.
441
442         (WebCore::WebGPUCommandBuffer::createComputeCommandEncoder):
443         Update to call the new WebGPUComputeCommandEncoder::create, which no longer
444         requires a context.
445
446         * html/canvas/WebGPUCommandBuffer.h:
447         * html/canvas/WebGPUCommandBuffer.idl:
448         Switch from inheriting from GPUObject to directly inheriting from 
449         RefCounted<WebGPUCommandBuffer>. Since this de-virtualizes it, also add 
450         ImplementationLacksVTable to the IDL file. Also update create and constructor 
451         to no longer take a context, and just take a GPUCommandQueue. We can't directly
452         pass a GPUCommandBuffer as WebGPUCommandBuffer needs to pass in a completion handler
453         on construction of the underlying GPUCommandBuffer.
454         
455         * html/canvas/WebGPUCommandQueue.cpp:
456         (WebCore::WebGPUCommandQueue::WebGPUCommandQueue):
457         (WebCore::WebGPUCommandQueue::createCommandBuffer):
458         Update to call the new WebGPUCommandBuffer::create, which no longer
459         requires a context.
460     
461         * html/canvas/WebGPUCommandQueue.h:
462         * html/canvas/WebGPUCommandQueue.idl:
463         Switch from inheriting from GPUObject to directly inheriting from 
464         RefCounted<WebGPUCommandQueue>. Since this de-virtualizes it, also add 
465         ImplementationLacksVTable to the IDL file. Also update create and
466         constructor to take a GPUCommandQueue directly.
467
468         * html/canvas/WebGPUComputeCommandEncoder.cpp:
469         (WebCore::WebGPUComputeCommandEncoder::create):
470         (WebCore::WebGPUComputeCommandEncoder::WebGPUComputeCommandEncoder):
471         * html/canvas/WebGPUComputeCommandEncoder.h:
472         * html/canvas/WebGPUComputeCommandEncoder.idl:
473         Switch from inheriting from GPUObject to directly inheriting from 
474         RefCounted<WebGPUComputeCommandEncoder>. Since this de-virtualizes it, 
475         also add ImplementationLacksVTable to the IDL file. Also update create and
476         constructor to take a GPUComputeCommandEncoder directly
477
478         * html/canvas/WebGPUComputePipelineState.cpp:
479         (WebCore::WebGPUComputePipelineState::WebGPUComputePipelineState):
480         * html/canvas/WebGPUComputePipelineState.h:
481         * html/canvas/WebGPUComputePipelineState.idl:
482         Switch from inheriting from WebGPUObject to directly inheriting from 
483         RefCounted<WebGPUComputePipelineState>. Since this de-virtualizes it, also add 
484         ImplementationLacksVTable to the IDL file. Also update create and
485         constructor to take a GPUComputePipelineState directly.
486
487         * html/canvas/WebGPUDepthStencilDescriptor.cpp:
488         Remove unneeded include of include "WebGPURenderingContext.h".
489
490         * html/canvas/WebGPUDepthStencilDescriptor.h:
491         * html/canvas/WebGPUDepthStencilDescriptor.idl:
492         Switch from inheriting from WebGPUObject to directly inheriting from 
493         RefCounted<WebGPUDepthStencilDescriptor>. Since this de-virtualizes it, also add 
494         ImplementationLacksVTable to the IDL file.
495
496         * html/canvas/WebGPUDepthStencilState.cpp:
497         (WebCore::WebGPUDepthStencilState::WebGPUDepthStencilState):
498         * html/canvas/WebGPUDepthStencilState.h:
499         * html/canvas/WebGPUDepthStencilState.idl:
500         Switch from inheriting from WebGPUObject to directly inheriting from 
501         RefCounted<WebGPUDepthStencilState>. Since this de-virtualizes it, also add 
502         ImplementationLacksVTable to the IDL file. Also update create and
503         constructor to take a GPUDepthStencilState directly.
504
505         * html/canvas/WebGPUDrawable.cpp:
506         (WebCore::WebGPUDrawable::WebGPUDrawable):
507         * html/canvas/WebGPUDrawable.h:
508         * html/canvas/WebGPUDrawable.idl:
509         Switch from inheriting from WebGPUObject to directly inheriting from 
510         RefCounted<WebGPUDrawable>. Since this de-virtualizes it, also add 
511         ImplementationLacksVTable to the IDL file. Also update create and
512         constructor to take a GPUDrawable directly.
513
514         * html/canvas/WebGPUFunction.cpp:
515         (WebCore::WebGPUFunction::create):
516         (WebCore::WebGPUFunction::WebGPUFunction):
517         * html/canvas/WebGPUFunction.h:
518         * html/canvas/WebGPUFunction.idl:
519         Switch from inheriting from GPUObject to directly inheriting from 
520         RefCounted<WebGPUFunction>. Since this de-virtualizes it, also add 
521         ImplementationLacksVTable to the IDL file. Also update create and
522         constructor to take a GPUFunction directly.
523
524         * html/canvas/WebGPULibrary.cpp:
525         (WebCore::WebGPULibrary::WebGPULibrary):
526         (WebCore::WebGPULibrary::functionWithName const):
527         Update for new WebGPUFunction::create, which no longer requires a
528         context.
529
530         * html/canvas/WebGPULibrary.h:
531         * html/canvas/WebGPULibrary.idl:
532         Switch from inheriting from WebGPUObject to directly inheriting from 
533         RefCounted<WebGPULibrary>. Since this de-virtualizes it, also add 
534         ImplementationLacksVTable to the IDL file. Also update create and
535         constructor to take a GPULibrary directly, rather than the context.
536         Unlike the other create functions that take their underlying type, this
537         one also continues to need the sourceCode String to be passed, as that
538         is not available from the underlying GPULibrary and must be stored
539         seperately.
540
541         * html/canvas/WebGPUObject.cpp: Removed.
542         * html/canvas/WebGPUObject.h: Removed.
543         Deleted.
544
545         * html/canvas/WebGPURenderCommandEncoder.cpp:
546         (WebCore::WebGPURenderCommandEncoder::create):
547         (WebCore::WebGPURenderCommandEncoder::WebGPURenderCommandEncoder):
548         * html/canvas/WebGPURenderCommandEncoder.h:
549         * html/canvas/WebGPURenderCommandEncoder.idl:
550         Switch from inheriting from GPUObject to directly inheriting from
551         RefCounted<WebGPURenderCommandEncoder>. Since this de-virtualizes it, also add
552         ImplementationLacksVTable to the IDL file. Also update create and
553         constructor to take a GPURenderCommandEncoder directly.
554
555         * html/canvas/WebGPURenderPassAttachmentDescriptor.cpp:
556         (WebCore::WebGPURenderPassAttachmentDescriptor::WebGPURenderPassAttachmentDescriptor):
557         * html/canvas/WebGPURenderPassAttachmentDescriptor.h:
558         Switch from inheriting from GPUObject to directly inheriting from 
559         RefCounted<WebGPURenderPassAttachmentDescriptor>. Also update create and 
560         constructor to no longer take a context, as it is now not used. This remains virtual
561         as it is inherited from by WebGPURenderPassColorAttachmentDescriptor and WebGPURenderPassDepthAttachmentDescriptor.
562
563         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
564         (WebCore::WebGPURenderPassColorAttachmentDescriptor::create):
565         (WebCore::WebGPURenderPassColorAttachmentDescriptor::WebGPURenderPassColorAttachmentDescriptor):
566         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.h:
567         Update create and constructor to no longer take a context, as it is now not used. Declare final
568         as this is not inherited by anything.
569
570         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
571         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::create):
572         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::WebGPURenderPassDepthAttachmentDescriptor):
573         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h:
574         Update create and constructor to no longer take a context, as it is now not used. Declare final
575         as this is not inherited by anything.
576
577         * html/canvas/WebGPURenderPassDescriptor.cpp:
578         (WebCore::WebGPURenderPassDescriptor::depthAttachment):
579         Update for new WebGPURenderPassDepthAttachmentDescriptor::create function which no longer requires
580         a context. 
581         
582         Semi-interesting note: This function was previously calling "*context()" to pass a WebGPURenderingContext&
583         to WebGPURenderPassDepthAttachmentDescriptor::create. However, "context()" was always returning null, as
584         the constructor of WebGPURenderPassDescriptor was not initializing the WebGPUObject with a WebGPURenderingContext.
585         Now, one might think that this would cause a null-deref, but, because it was being assigned into a 
586         WebGPURenderingContext&, no dereference happens right away (it essentially just passes a pointer) and since
587         the function it is being passed to does not use it, it never actually gets dereferenced.
588
589         (WebCore::WebGPURenderPassDescriptor::colorAttachments):
590         Update for new WebGPURenderPassColorAttachmentDescriptor::create function which no longer requires
591         a context. 
592
593         * html/canvas/WebGPURenderPassDescriptor.h:
594         * html/canvas/WebGPURenderPassDescriptor.idl:
595         Switch from inheriting from GPUObject to directly inheriting from
596         RefCounted<WebGPURenderPassDescriptor>. Since this de-virtualizes it, also add
597         ImplementationLacksVTable to the IDL file.
598
599         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp:
600         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::create):
601         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::WebGPURenderPipelineColorAttachmentDescriptor):
602         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h:
603         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.idl:
604         Switch from inheriting from GPUObject to directly inheriting from
605         RefCounted<WebGPURenderPipelineColorAttachmentDescriptor>. Since this de-virtualizes it, also add
606         ImplementationLacksVTable to the IDL file. Also update create and constructor to
607         no longer take a context, as it is now not used.
608
609         * html/canvas/WebGPURenderPipelineDescriptor.cpp:
610         (WebCore::WebGPURenderPipelineDescriptor::colorAttachments):
611         Update for new WebGPURenderPipelineColorAttachmentDescriptor::create which no longer requires
612         a context.
613
614         * html/canvas/WebGPURenderPipelineDescriptor.h:
615         * html/canvas/WebGPURenderPipelineDescriptor.idl:
616         Switch from inheriting from GPUObject to directly inheriting from
617         RefCounted<WebGPURenderPipelineDescriptor>. Since this de-virtualizes it, also add
618         ImplementationLacksVTable to the IDL file.
619
620         * html/canvas/WebGPURenderPipelineState.cpp:
621         (WebCore::WebGPURenderPipelineState::WebGPURenderPipelineState):
622         * html/canvas/WebGPURenderPipelineState.h:
623         * html/canvas/WebGPURenderPipelineState.idl:
624         Switch from inheriting from GPUObject to directly inheriting from
625         RefCounted<WebGPURenderPipelineState>. Since this de-virtualizes it, also add
626         ImplementationLacksVTable to the IDL file. Also update create and
627         constructor to take a GPURenderPipelineState directly.
628
629         * html/canvas/WebGPURenderingContext.cpp:
630         (WebCore::WebGPURenderingContext::createLibrary):
631         (WebCore::WebGPURenderingContext::createRenderPipelineState):
632         (WebCore::WebGPURenderingContext::createDepthStencilState):
633         (WebCore::WebGPURenderingContext::createComputePipelineState):
634         (WebCore::WebGPURenderingContext::createCommandQueue):
635         (WebCore::WebGPURenderingContext::nextDrawable):
636         (WebCore::WebGPURenderingContext::createBuffer):
637         (WebCore::WebGPURenderingContext::createTexture):
638         Update for new create functions which require the caller to pass
639         the underlying type.
640
641         * html/canvas/WebGPUTexture.cpp:
642         (WebCore::WebGPUTexture::createFromDrawableTexture):
643         Renamed to create.
644
645         (WebCore::WebGPUTexture::create): Deleted
646         All callers now pass a GPUTexture directly.
647
648         * html/canvas/WebGPUTexture.h:
649         * html/canvas/WebGPUTexture.idl:
650         Switch from inheriting from GPUObject to directly inheriting from
651         RefCounted<WebGPUTexture>. Since this de-virtualizes it, also add
652         ImplementationLacksVTable to the IDL file. 
653
654         * html/canvas/WebGPUTextureDescriptor.h:
655         * html/canvas/WebGPUTextureDescriptor.idl:
656         Switch from inheriting from GPUObject to directly inheriting from
657         RefCounted<WebGPUTextureDescriptor>. Since this de-virtualizes it, also add
658         ImplementationLacksVTable to the IDL file.
659
660 2018-08-03  Alex Christensen  <achristensen@webkit.org>
661
662         Fix spelling of "overridden"
663         https://bugs.webkit.org/show_bug.cgi?id=188315
664
665         Reviewed by Darin Adler.
666
667         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
668         (-[WebAccessibilityObjectWrapper accessibilityLabel]):
669         (-[WebAccessibilityObjectWrapper accessibilityValue]):
670         * contentextensions/ContentExtensionsBackend.h:
671         * editing/EditingStyle.cpp:
672         (WebCore::EditingStyle::removeStyleFromRulesAndContext):
673         * inspector/CommandLineAPIModuleSource.js:
674         * platform/ScrollView.h:
675         * platform/ScrollableArea.h:
676         * platform/mediasession/MediaSessionInterruptionProvider.h:
677         * rendering/RenderFragmentedFlow.cpp:
678         (WebCore::RenderFragmentedFlow::adjustedPositionRelativeToOffsetParent const):
679         * rendering/RenderLayer.h:
680         * rendering/RenderListBox.h:
681         * rendering/svg/RenderSVGResourceClipper.cpp:
682         (WebCore::RenderSVGResourceClipper::drawContentIntoMaskImage):
683         * svg/SVGElement.cpp:
684         (WebCore::SVGElement::localCoordinateSpaceTransform const):
685         * svg/SVGLengthContext.cpp:
686         (WebCore::SVGLengthContext::SVGLengthContext):
687         (WebCore::SVGLengthContext::convertValueToUserUnits const):
688         (WebCore::SVGLengthContext::determineViewport const):
689         * svg/SVGLengthContext.h:
690
691 2018-08-03  Zalan Bujtas  <zalan@apple.com>
692
693         [LFC][BFC] Special case the document renderer when computing the height and margin
694         https://bugs.webkit.org/show_bug.cgi?id=188313
695
696         Reviewed by Antti Koivisto.
697
698         The document renderer is certainly special and its geometry is likely to be computed as part of "10.6.6 Complicated cases" (spec is unclear) but probably not by
699         making the it a formatting root. Let's just special case it at contentHeightForFormattingContextRoot(), since having the document renderer as a context root has unwanted side effect. 
700
701         * layout/FormattingContextGeometry.cpp:
702         (WebCore::Layout::contentHeightForFormattingContextRoot):
703         * layout/layouttree/LayoutBox.cpp:
704         (WebCore::Layout::Box::establishesBlockFormattingContext const):
705
706 2018-08-03  Zalan Bujtas  <zalan@apple.com>
707
708         [LFC][BFC] Layout out-of-flow descendants only on the formatting context root.
709         https://bugs.webkit.org/show_bug.cgi?id=188312
710
711         Reviewed by Antti Koivisto.
712
713         Collect out-of-flow descendants on the formatting root container instead of the containing block and run layout on them on the root level. It's more efficient this way.
714
715         * layout/blockformatting/BlockFormattingContext.cpp:
716         (WebCore::Layout::BlockFormattingContext::layout const):
717         * layout/layouttree/LayoutTreeBuilder.cpp:
718         (WebCore::Layout::TreeBuilder::createSubTree):
719
720 2018-08-03  Andy Estes  <aestes@apple.com>
721
722         ContentFilterUnblockHandler's constructors access moved-from variables
723         https://bugs.webkit.org/show_bug.cgi?id=188308
724         <rdar://problem/42882758>
725
726         Reviewed by Alex Christensen.
727
728         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
729
730 2018-08-03  Zalan Bujtas  <zalan@apple.com>
731
732         [LFC][Floating] Now that the document renderer belongs to "complicated cases", adjust viewport stretching.
733         https://bugs.webkit.org/show_bug.cgi?id=188306
734
735         Reviewed by Antti Koivisto.
736
737         And add passing cases for floats.
738
739         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
740         (WebCore::Layout::initialContainingBlock):
741         (WebCore::Layout::isStretchedToInitialContainingBlock):
742         (WebCore::Layout::stretchHeightToInitialContainingBlock):
743         (WebCore::Layout::stretchWidthToInitialContainingBlock):
744         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
745         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
746         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
747         (WebCore::Layout::isStretchedToViewport): Deleted.
748
749 2018-08-03  Zalan Bujtas  <zalan@apple.com>
750
751         [LFC] Do not check margin box while validating geometry.
752         https://bugs.webkit.org/show_bug.cgi?id=188297
753
754         Reviewed by Antti Koivisto.
755
756         The current RenderBox::marginBox implementation is not spec compliant. Ignore it for now.
757
758         * layout/Verification.cpp:
759         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
760
761 2018-08-03  Carlos Garcia Campos  <cgarcia@igalia.com>
762
763         [WPE] Use WPE key symbols and new API instead of xkbcommon and the key mapper
764         https://bugs.webkit.org/show_bug.cgi?id=188093
765
766         Reviewed by Žan Doberšek.
767
768         Add helper functions to get key code, hardware key code, key identifier and windows key code from a WPE key symbol.
769
770         * platform/PlatformKeyboardEvent.h:
771         * platform/wpe/PlatformKeyboardEventWPE.cpp:
772         (WebCore::PlatformKeyboardEvent::keyValueForWPEKeyCode):
773         (WebCore::PlatformKeyboardEvent::keyCodeForHardwareKeyCode):
774         (WebCore::PlatformKeyboardEvent::keyIdentifierForWPEKeyCode):
775         (WebCore::PlatformKeyboardEvent::windowsKeyCodeForWPEKeyCode):
776         (WebCore::PlatformKeyboardEvent::singleCharacterString):
777
778 2018-08-02  Ryosuke Niwa  <rniwa@webkit.org>
779
780         Release assert when throwing exceptions in custom element reactions
781         https://bugs.webkit.org/show_bug.cgi?id=187805
782         <rdar://problem/42432714>
783
784         Reviewed by Saam Barati.
785
786         The release assertion was hit because we were not catching & re-throwing the exception thrown by DOM API
787         before trying to execute custom elements reactions in ~CustomElementReactionStack as specified here:
788         https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions
789         Fixed the bug by capturing the exception and re-throwing the exception as specified.
790
791         Tests: imported/w3c/web-platform-tests/custom-elements/reactions/with-exceptions.html
792
793         * bindings/js/JSMainThreadExecState.h:
794         (WebCore::JSMainThreadNullState::JSMainThreadNullState): Use the previous JS state.
795         * bindings/scripts/CodeGeneratorJS.pm:
796         (GeneratePut): Pass in the exec state to CustomElementReactionStack.
797         (GeneratePutByIndex): Ditto.
798         (GenerateDefineOwnProperty): Ditto.
799         (GenerateDeletePropertyCommon): Ditto.
800         (GenerateAttributeSetterBodyDefinition): Ditto.
801         (GenerateOperationBodyDefinition): Ditto.
802         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
803         (WebCore::setJSTestCEReactionsAttributeWithCEReactionsSetter):
804         (WebCore::setJSTestCEReactionsReflectAttributeWithCEReactionsSetter):
805         (WebCore::jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsBody):
806         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
807         (WebCore::setJSTestCEReactionsStringifierValueSetter):
808         * dom/CustomElementReactionQueue.cpp:
809         (WebCore::CustomElementReactionQueue::ElementQueue::processQueue): Added. If there is a script running
810         in the stack (i.e. ExecState is not null), catch any exception before executing custom element reactions,
811         then re-throw the exception afterwards. ExecState is null when DOM API is invoked via Objective-C bindings
812         or when custom element reactions are executed in the backup queue (e.g. for editing operations).
813         (WebCore::CustomElementReactionStack::processQueue):
814         (WebCore::CustomElementReactionQueue::processBackupQueue):
815         * dom/CustomElementReactionQueue.h:
816         (WebCore::CustomElementReactionStack::CustomElementReactionStack):
817         (WebCore::CustomElementReactionStack::~CustomElementReactionStack):
818
819 2018-08-02  Zalan Bujtas  <zalan@apple.com>
820
821         [LFC][BFC] Apply the "10.6.6 Complicated cases" when computing height and margin for the document renderer
822         https://bugs.webkit.org/show_bug.cgi?id=188296
823
824         Reviewed by Simon Fraser.
825
826         The spec is not clear about what to do with the document renderer. It behaves as if it was a formatting context root when
827         it comes to computing the content height. Let's apply "10.6.6 Complicated cases" for now.
828
829         * layout/FormattingContext.h:
830         * layout/FormattingContextGeometry.cpp:
831         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
832         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
833         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin): Deleted.
834         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
835         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
836         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
837         * layout/layouttree/LayoutBox.cpp:
838         (WebCore::Layout::Box::establishesBlockFormattingContext const):
839         * layout/layouttree/LayoutBox.h:
840
841 2018-08-02  Zalan Bujtas  <zalan@apple.com>
842
843         [LFC][Floating] Add FloatingState::bottom() to enable content height computation for formatting roots.
844         https://bugs.webkit.org/show_bug.cgi?id=188294
845
846         Reviewed by Simon Fraser.
847
848         "10.6.7 'Auto' heights for block formatting context roots
849         ...
850         In addition, if the element has any floating descendants whose bottom margin edge is below the element's bottom content edge,
851         then the height is increased to include those edges. Only floats that participate in this block formatting context are taken into
852         account, e.g., floats inside absolutely positioned descendants or other floats are not..."
853
854         * layout/FloatingState.cpp:
855         (WebCore::Layout::FloatingState::bottom const):
856         * layout/FloatingState.h:
857         * layout/FormattingContextGeometry.cpp:
858         (WebCore::Layout::contentHeightForFormattingContextRoot):
859
860 2018-08-02  Jer Noble  <jer.noble@apple.com>
861
862         Control center controls disappear when pausing, locking device.
863         https://bugs.webkit.org/show_bug.cgi?id=188282
864         <rdar://problem/42497809>
865
866         Reviewed by Eric Carlson.
867
868         Test: platform/mac/media/audio-session-category-video-paused.html
869
870         MediaRemote will set any app whose audio session category changes from MediaPlayback to
871         Ambient as not eligable for being the "now playing" app. Previously, due to the ordering of
872         events, we never moved from MediaPlayback to Ambient when pausing <video>, even though that
873         was the intention. Now that that bug is fixed, it exposed this new issue with MediaRemote.
874
875         To solve the new issue, make our audio session category policy more explicit: once we are in
876         MediaPlayback category, we will remain so as long as the media element in queston stays
877         loaded, has played, and is never interrupted by the system.
878
879         Make MediaSessionManagerCocoa a proper subclass of PlatformMediaSessionManager, and make
880         MediaSessionManageriOS and -Mac subclasses of the -Cocoa class. Add a new
881         m_hasPlayedSinceLastInterruption ivar to PlatformMediaSession, set when the state() changes
882         to Playing, and cleared during an interruption. Check this flag when deciding what audio 
883         sessino category to set in MediaSessionManagerCocoa.
884
885         * WebCore.xcodeproj/project.pbxproj:
886         * platform/audio/PlatformMediaSession.cpp:
887         (WebCore::PlatformMediaSession::setState):
888         * platform/audio/PlatformMediaSession.h:
889         (WebCore::PlatformMediaSession::hasPlayedSinceLastInterruption const):
890         (WebCore::PlatformMediaSession::clearHasPlayedSinceLastInterruption):
891         * platform/audio/PlatformMediaSessionManager.cpp:
892         (WebCore::PlatformMediaSessionManager::updateSessionState): Deleted.
893         * platform/audio/PlatformMediaSessionManager.h:
894         (WebCore::PlatformMediaSessionManager::audioHardwareListener):
895         (WebCore::PlatformMediaSessionManager::updateSessionState):
896         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
897         (MediaSessionManagerCocoa::updateSessionState):
898         (MediaSessionManagerCocoa::beginInterruption):
899         (PlatformMediaSessionManager::updateSessionState): Deleted.
900         * platform/audio/cocoa/MediaSessionManagerCocoa.h: Added.
901         * platform/audio/ios/MediaSessionManagerIOS.h:
902         * platform/audio/ios/MediaSessionManagerIOS.mm:
903         (WebCore::MediaSessionManageriOS::MediaSessionManageriOS):
904         * platform/audio/mac/MediaSessionManagerMac.h:
905         * platform/audio/mac/MediaSessionManagerMac.mm:
906         (WebCore::MediaSessionManagerMac::MediaSessionManagerMac):
907
908 2018-08-02  Nan Wang  <n_wang@apple.com>
909
910         AX: [iOS] add support to return the attributed string under the element
911         https://bugs.webkit.org/show_bug.cgi?id=188276
912         <rdar://problem/42872357>
913
914         Reviewed by Chris Fleizach.
915
916         Provided a way on iOS to return the attributed string under the element for 
917         better performance.
918
919         Test: accessibility/ios-simulator/attributed-string-for-element.html
920
921         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
922         (-[WebAccessibilityObjectWrapper _stringFromStartMarker:toEndMarker:attributed:]):
923         (-[WebAccessibilityObjectWrapper _stringForRange:attributed:]):
924         (-[WebAccessibilityObjectWrapper attributedStringForElement]):
925
926 2018-08-02  Zalan Bujtas  <zalan@apple.com>
927
928         [LFC][Floating] Remove redundant LayoutContext member variable.
929         https://bugs.webkit.org/show_bug.cgi?id=188286
930
931         Reviewed by Simon Fraser.
932
933         * layout/FloatingContext.cpp:
934         (WebCore::Layout::begin):
935         (WebCore::Layout::end):
936         (WebCore::Layout::FloatingContext::floatingPosition const):
937         (WebCore::Layout::FloatingPair::FloatingPair):
938         (WebCore::Layout::Iterator::Iterator):
939
940 2018-08-02  Ryosuke Niwa  <rniwa@webkit.org>
941
942         Move queue processing logic from CustomElementReactionStack to CustomElementReactionQueue
943         https://bugs.webkit.org/show_bug.cgi?id=188277
944
945         Reviewed by Wenson Hsieh.
946
947         Moved ensureCurrentQueue, processBackupQueue, ElementQueue, ensureBackupQueue, and backupElementQueue
948         from CustomElementReactionStack to CustomElementReactionQueue to simplify CustomElementReactionStack.
949
950         No new tests since there is no behavior change.
951
952         * dom/CustomElementReactionQueue.cpp:
953         (WebCore::CustomElementReactionQueue::enqueueElementUpgrade):
954         (WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded):
955         (WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded):
956         (WebCore::CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded):
957         (WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded):
958         (WebCore::CustomElementReactionQueue::ElementQueue::add): Moved from CustomElementReactionStack.
959         (WebCore::CustomElementReactionQueue::ElementQueue::invokeAll): Ditto.
960         (WebCore::CustomElementReactionQueue::ensureCurrentQueue): Ditto.
961         (WebCore::CustomElementReactionQueue::ensureBackupQueue): Ditto.
962         (WebCore::CustomElementReactionQueue::processBackupQueue): Ditto.
963         (WebCore::CustomElementReactionQueue::backupElementQueue): Ditto.
964         * dom/CustomElementReactionQueue.h:
965         (WebCore::CustomElementReactionStack::hasCurrentProcessingStack): Deleted. It was never called.
966
967 2018-08-02  Timothy Hatcher  <timothy@apple.com>
968
969         Text selection color is hard to see in dark mode web views.
970         https://bugs.webkit.org/show_bug.cgi?id=188260
971         rdar://problem/42721294
972
973         Reviewed by Simon Fraser.
974
975         Stop using blendWithWhite() to transform the AppKit selection color in dark mode.
976         Using an alpha of 80% gives good contrast, and still works good for selections over images.
977
978         * platform/graphics/Color.cpp:
979         (WebCore::Color::blendWithWhite const): Mark new colors as semantic if the original is.
980         (WebCore::Color::colorWithAlpha const): Ditto.
981         * rendering/RenderElement.cpp:
982         (WebCore::RenderElement::selectionBackgroundColor const): Use transformSelectionBackgroundColor.
983         * rendering/RenderTheme.cpp:
984         (WebCore::RenderTheme::activeSelectionBackgroundColor const): Use transformSelectionBackgroundColor.
985         (WebCore::RenderTheme::inactiveSelectionBackgroundColor const): Ditto.
986         (WebCore::RenderTheme::transformSelectionBackgroundColor const): Added. Just blend with white.
987         * rendering/RenderTheme.h:
988         * rendering/RenderThemeMac.h:
989         * rendering/RenderThemeMac.mm:
990         (WebCore::RenderThemeMac::transformSelectionBackgroundColor const): Added. Use an alpha with the color
991         in dark mode, otherwise fallback to RenderTheme.
992         (WebCore::RenderThemeMac::systemColor const): Use activeListBoxSelectionBackgroundColor()
993         and activeSelectionBackgroundColor() instead of caching the colors again. Update hardcoded color.
994
995 2018-08-02  Zalan Bujtas  <zalan@apple.com>
996
997         [LFC][Floating] Use displayBox.rectWithMargin().bottom instead of displayBox.bottom() to where applicable.
998         https://bugs.webkit.org/show_bug.cgi?id=188274
999
1000         Reviewed by Antti Koivisto.
1001
1002         Float placement uses the margin box.
1003
1004         * layout/FloatingContext.cpp:
1005         (WebCore::Layout::FloatingPair::bottom const):
1006         (WebCore::Layout::Iterator::operator++):
1007         (WebCore::Layout::Iterator::set):
1008
1009 2018-08-02  Zalan Bujtas  <zalan@apple.com>
1010
1011         [LFC][Floating] Right aligned float's horizontal candidate position is miscomputed.
1012         https://bugs.webkit.org/show_bug.cgi?id=188273
1013
1014         Reviewed by Antti Koivisto.
1015
1016         rightAlignedBoxLeft is already shifted with the size of the margin box.
1017
1018         * layout/FloatingContext.cpp:
1019         (WebCore::Layout::FloatingContext::alignWithFloatings const):
1020
1021 2018-08-02  Zalan Bujtas  <zalan@apple.com>
1022
1023         [LFC] Display:Box::rectWithMargin()'s width and height don't include margin left/top.
1024         https://bugs.webkit.org/show_bug.cgi?id=188272
1025
1026         Reviewed by Antti Koivisto.
1027
1028         * layout/displaytree/DisplayBox.h:
1029         (WebCore::Display::Box::rectWithMargin const):
1030
1031 2018-08-02  Zalan Bujtas  <zalan@apple.com>
1032
1033         [LFC][Floating] Containing block of a float could push the candidate position beyond the current float.
1034         https://bugs.webkit.org/show_bug.cgi?id=188264
1035
1036         Reviewed by Antti Koivisto.
1037
1038         <div id=first style="float: left; width: 100px; height: 10px;"></div>
1039         <div id=second style="float: left; width: 10px; height: 10px;"></div>
1040         <div style="width: 50px; height: 50px;>
1041             <div id=third style="float: left; width: 10px; height: 10px;"></div>
1042         </div>
1043         In the example above by the time the "third" float comes in, we are already at 110px horizontally. However the containing block of the "third" float forces
1044         the candidate position at 0px. In such cases intersecting won't work since the candidate position is beyond the last(second) float (horizontally).
1045         We could either keep going back to the previous floats on this vertical position and eventually intersect with "first" or just compare the horizontal
1046         positions and ensure that the left/right float is not going to be placed to the left/right of the last float on the current vertical position.
1047
1048         * layout/FloatingContext.cpp:
1049         (WebCore::Layout::FloatingPair::intersects const):
1050
1051 2018-08-01  Ryosuke Niwa  <rniwa@webkit.org>
1052
1053         Implement customElements.upgrade()
1054         https://bugs.webkit.org/show_bug.cgi?id=183397
1055
1056         Reviewed by Frédéric Wang.
1057
1058         Added the support to upgrade custom elements directly. Ordinarily, custom elements get upgraded as they are
1059         inserted / connected into a document but some script libraries and authors want to be able to upgrade them before that.
1060         Also see https://github.com/w3c/webcomponents/issues/710
1061
1062         Implemented the method as specified at:
1063         https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-upgrade
1064
1065             When invoked, the upgrade(root) method must run these steps:
1066             1. Let candidates be a list of all of root's shadow-including inclusive descendant elements,
1067                in shadow-including tree order.
1068             2. For each candidate of candidates, try to upgrade candidate.
1069
1070         Tests: imported/w3c/web-platform-tests/custom-elements/custom-element-registry/upgrade.html
1071
1072         * dom/CustomElementReactionQueue.cpp:
1073         (WebCore::CustomElementReactionQueue::enqueueElementUpgradeIfDefined): Removed the assertion that the upgraded element
1074         is connected since the whole point of this API is to upgrade a disconnected element.
1075         * dom/CustomElementRegistry.cpp:
1076         (WebCore::upgradeElementsInShadowIncludingdescendants): Added.
1077         (WebCore::CustomElementRegistry::upgrade): Added.
1078         * dom/CustomElementRegistry.h: Forward declare DeferredPromise instead of unnecessarily including JSDOMPromiseDeferred.h.
1079         * dom/CustomElementRegistry.idl:
1080         * dom/Element.cpp:
1081         (WebCore::Element::insertedIntoAncestor): Moved the assertion here.
1082
1083 2018-08-02  Simon Fraser  <simon.fraser@apple.com>
1084
1085         Convert calc-related enums to 8-bit enum classes
1086         https://bugs.webkit.org/show_bug.cgi?id=188215
1087
1088         Reviewed by Zalan Bujtas.
1089
1090         This shrinks CSSCalcOperation from 48 to 32 bytes.
1091
1092         * css/CSSCalculationValue.cpp:
1093         (WebCore::unitCategory):
1094         (WebCore::determineCategory):
1095         (WebCore::resolvedTypeForMinOrMax):
1096         (WebCore::isIntegerResult):
1097         (WebCore::CSSCalcExpressionNodeParser::parseValue):
1098         (WebCore::CSSCalcExpressionNodeParser::parseValueMultiplicativeExpression):
1099         (WebCore::CSSCalcExpressionNodeParser::parseAdditiveValueExpression):
1100         (WebCore::CSSCalcExpressionNodeParser::parseMinMaxExpression):
1101         (WebCore::createBlendHalf):
1102         (WebCore::createCSS):
1103         * css/CSSCalculationValue.h:
1104         * css/CSSPrimitiveValue.cpp:
1105         (WebCore::CSSPrimitiveValue::primitiveType const):
1106         * css/StyleBuilderConverter.h:
1107         (WebCore::StyleBuilderConverter::convertTo100PercentMinusLength):
1108         * css/parser/CSSPropertyParserHelpers.cpp:
1109         (WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumberRaw):
1110         (WebCore::CSSPropertyParserHelpers::CalcParser::consumePositiveIntegerRaw):
1111         (WebCore::CSSPropertyParserHelpers::consumeInteger):
1112         (WebCore::CSSPropertyParserHelpers::consumePositiveIntegerRaw):
1113         (WebCore::CSSPropertyParserHelpers::consumeNumberRaw):
1114         (WebCore::CSSPropertyParserHelpers::consumeNumber):
1115         (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
1116         (WebCore::CSSPropertyParserHelpers::consumeLength):
1117         (WebCore::CSSPropertyParserHelpers::consumePercent):
1118         (WebCore::CSSPropertyParserHelpers::canConsumeCalcValue):
1119         (WebCore::CSSPropertyParserHelpers::consumeLengthOrPercent):
1120         (WebCore::CSSPropertyParserHelpers::consumeAngle):
1121         (WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
1122         (WebCore::CSSPropertyParserHelpers::consumeTime):
1123         * platform/CalculationValue.cpp:
1124         (WebCore::CalcExpressionNumber::operator== const):
1125         (WebCore::CalcExpressionOperation::evaluate const):
1126         (WebCore::CalcExpressionOperation::operator== const):
1127         (WebCore::CalcExpressionOperation::dump const):
1128         (WebCore::CalcExpressionLength::operator== const):
1129         (WebCore::CalcExpressionBlendLength::CalcExpressionBlendLength):
1130         (WebCore::CalcExpressionBlendLength::operator== const):
1131         (WebCore::operator<<):
1132         * platform/CalculationValue.h:
1133         (WebCore::CalcExpressionNumber::CalcExpressionNumber):
1134         (WebCore::toCalcExpressionNumber):
1135         (WebCore::CalcExpressionLength::CalcExpressionLength):
1136         (WebCore::toCalcExpressionLength):
1137         (WebCore::CalcExpressionOperation::CalcExpressionOperation):
1138         (WebCore::toCalcExpressionOperation):
1139         (WebCore::toCalcExpressionBlendLength):
1140         * platform/Length.cpp:
1141         (WebCore::convertTo100PercentMinusLength):
1142
1143 2018-08-02  Charlie Turner  <cturner@igalia.com>
1144
1145         Handle zero-sized ISOMP4 boxes appropriately
1146         https://bugs.webkit.org/show_bug.cgi?id=188256
1147
1148         Reviewed by Jer Noble.
1149
1150         According to ISO/IEC 14496-12:2012(E), when the Box classes' size
1151         field is zero, the implied size of the box extends to the end of
1152         the file. If this detail is not taken into account, CENC
1153         sanitization can incorrectly report an invalid box size, since 0
1154         != the number of bytes in this box, specifically, the data layout
1155         of Box is as follows,
1156
1157         aligned(8) class Box (unsigned int(32) boxtype,
1158               optional unsigned int(8)[16] extended_type) {
1159            unsigned int(32) size;
1160            unsigned int(32) type = boxtype;
1161            if (size==1) {
1162              unsigned int(64) largesize;
1163            } else if (size==0) { // This is the case now handled.
1164              // box extends to end of file
1165            }
1166            if (boxtype==‘uuid’) {
1167              unsigned int(8)[16] usertype = extended_type;
1168            }
1169         }
1170
1171         Tested by imported/w3c/web-platform-tests/encrypted-media/clearkey-generate-request-disallowed-input.https.html
1172
1173         * platform/graphics/iso/ISOBox.cpp:
1174         (WebCore::ISOBox::peekBox): Check if the parsed size is zero, and
1175         if it is, the size is calculated as the total number of bytes in
1176         the incoming DataView.
1177         (WebCore::ISOBox::parse): Ditto.
1178
1179 2018-08-01  Dan Bernstein  <mitz@apple.com>
1180
1181         Optionally expose Attr::style to JavaScript
1182         https://bugs.webkit.org/show_bug.cgi?id=188226
1183         <rdar://problem/42818113>
1184
1185         Reviewed by Darin Adler.
1186
1187         Test: TestWebKitAPI/Tests/WebKitCocoa/AttrStyle.mm
1188
1189         * dom/Attr.cpp: Update comment.
1190         * dom/Attr.idl: Define the style attribute, enabled at runtime by the AttrStyle feature.
1191
1192         * page/RuntimeEnabledFeatures.h:
1193         (WebCore::RuntimeEnabledFeatures::setAttrStyleEnabled): Added this accessor.
1194         (WebCore::RuntimeEnabledFeatures::attrStyleEnabled const): Ditto.
1195
1196 2018-08-02  David Fenton  <david_fenton@apple.com>
1197
1198         Unreviewed, rolling out r234489.
1199
1200         Caused 50+ crashes and 60+ API failures on iOS
1201
1202         Reverted changeset:
1203
1204         "[WTF] Rename String::format to String::deprecatedFormat"
1205         https://bugs.webkit.org/show_bug.cgi?id=188191
1206         https://trac.webkit.org/changeset/234489
1207
1208 2018-08-02  Zalan Bujtas  <zalan@apple.com>
1209
1210         [LFC][Floating] Do not pass formatting root to FloatingContext
1211         https://bugs.webkit.org/show_bug.cgi?id=188257
1212
1213         Reviewed by Antti Koivisto.
1214
1215         If we ever need it, we can get it from FloatingState.
1216
1217         * layout/FloatingContext.cpp:
1218         (WebCore::Layout::FloatingContext::FloatingContext):
1219         * layout/FloatingContext.h:
1220         * layout/blockformatting/BlockFormattingContext.cpp:
1221         (WebCore::Layout::BlockFormattingContext::layout const):
1222
1223 2018-08-01  Zalan Bujtas  <zalan@apple.com>
1224
1225         [LFC][Floating] Convert all coordinates relative to the formatting context root.
1226         https://bugs.webkit.org/show_bug.cgi?id=188249
1227
1228         Reviewed by Antti Koivisto.
1229
1230         The idea here is that all the float related computation should be happening in the same coordinate system.
1231         FloatItem holds the transformed Display::Box for both the layout box and its containing block. 
1232
1233         * layout/FloatingContext.cpp:
1234         (WebCore::Layout::begin):
1235         (WebCore::Layout::end):
1236         (WebCore::Layout::FloatingContext::computePosition const):
1237         (WebCore::Layout::FloatingContext::floatingPosition const):
1238         (WebCore::Layout::FloatingContext::initialVerticalPosition const):
1239         (WebCore::Layout::FloatingContext::alignWithContainingBlock const):
1240         (WebCore::Layout::FloatingContext::alignWithFloatings const):
1241         (WebCore::Layout::FloatingContext::toContainingBlock const):
1242         (WebCore::Layout::FloatingPair::FloatingPair):
1243         (WebCore::Layout::FloatingPair::left const):
1244         (WebCore::Layout::FloatingPair::right const):
1245         (WebCore::Layout::Iterator::Iterator):
1246         (WebCore::Layout::previousFloatingIndex):
1247         (WebCore::Layout::Iterator::operator++):
1248         (WebCore::Layout::Iterator::set):
1249         * layout/FloatingContext.h:
1250         * layout/FloatingState.cpp:
1251         (WebCore::Layout::FloatingState::FloatItem::FloatItem):
1252         (WebCore::Layout::FloatingState::remove):
1253         (WebCore::Layout::FloatingState::append):
1254         * layout/FloatingState.h:
1255         (WebCore::Layout::FloatingState::isEmpty const):
1256         (WebCore::Layout::FloatingState::FloatItem::layoutBox const):
1257         (WebCore::Layout::FloatingState::FloatItem::containingBlock const):
1258         (WebCore::Layout::FloatingState::FloatItem::displayBox const):
1259         (WebCore::Layout::FloatingState::FloatItem::containingBlockDisplayBox const):
1260         (WebCore::Layout::FloatingState::floats const):
1261         (WebCore::Layout::FloatingState::last const):
1262         (WebCore::Layout::FloatingState::root const):
1263         (WebCore::Layout::FloatingState::floatings const): Deleted.
1264         * layout/displaytree/DisplayBox.h:
1265
1266 2018-08-02  Charlie Turner  <cturner@igalia.com>
1267
1268         [GStreamer] Dynamically adjust blocksize
1269         https://bugs.webkit.org/show_bug.cgi?id=188194
1270
1271         Reviewed by Xabier Rodriguez-Calvar.
1272
1273         Update the blocksize depending on how much is obtained from a read
1274         of the input stream. This avoids doing too many reads in small
1275         chunks when larger amounts of data are available and also prevents
1276         using a very large memory area to read a small chunk of data.
1277
1278         Adapted from https://bugzilla.gnome.org/show_bug.cgi?id=767833
1279
1280         No tests new tests since no change in functionality.
1281
1282         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1283         (webkit_web_src_init):
1284         (CachedResourceStreamingClient::checkUpdateBlocksize):
1285         (CachedResourceStreamingClient::dataReceived):
1286
1287 2018-08-02  Charlie Turner  <cturner@igalia.com>
1288
1289         [GStreamer] Stop pushing buffers when seeking status changes
1290         https://bugs.webkit.org/show_bug.cgi?id=188193
1291
1292         Reviewed by Xabier Rodriguez-Calvar.
1293
1294         After switching to splitting buffers into smaller block sizes in
1295
1296             https://bugs.webkit.org/show_bug.cgi?id=182829
1297
1298         It was found that during the individual buffer pushes, the seeking
1299         status could change behind our backs from another thread. When
1300         this happens, buffers from incorrect offsets would find their way
1301         into appsrc and eventually the demuxer itself, which would start
1302         parsing from a random place and at best give a confusing error
1303         message.
1304
1305         The solution here is break from pushing buffers when the seeking
1306         status has been has changed. Flushes will clear out what we've
1307         already delivered into the appsrc, then we must make sure to not
1308         continue sending buffers in there after the flush.
1309
1310         No new tests since this is a timing bug.
1311
1312         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1313         (CachedResourceStreamingClient::dataReceived):
1314
1315 2018-08-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1316
1317         Unreviewed, revert TransformationMatrix::operator== change
1318         https://bugs.webkit.org/show_bug.cgi?id=188197
1319
1320         This change partially revert cleaning up of TransformationMatrix since memcmp does not
1321         follow double comparison algorithm. So semantics was accidentally changed.
1322
1323         * platform/graphics/transforms/TransformationMatrix.h:
1324         (WebCore::TransformationMatrix::operator== const):
1325
1326 2018-08-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1327
1328         Unreviewed, rename TransformationMatrix::Identity to TransformationMatrix::identity
1329         https://bugs.webkit.org/show_bug.cgi?id=188204
1330
1331         Follow the coding style.
1332
1333         * platform/graphics/GraphicsLayer.cpp:
1334         (WebCore::GraphicsLayer::transform const):
1335         (WebCore::GraphicsLayer::childrenTransform const):
1336         * platform/graphics/transforms/TransformationMatrix.cpp:
1337         * platform/graphics/transforms/TransformationMatrix.h:
1338
1339 2018-08-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1340
1341         Add self.queueMicrotask(f) on DOMWindow
1342         https://bugs.webkit.org/show_bug.cgi?id=188212
1343
1344         Reviewed by Ryosuke Niwa.
1345
1346         This patch adds self.queueMicrotask(f) in DOMWindow, which takes a function and enqueue it into microtask queue.
1347         We do not add this to Worker's global scope since our worker does not support microtasks correctly.
1348
1349         Tests: js/dom/queue-microtask-window.html
1350
1351         * bindings/js/JSDOMWindowCustom.cpp:
1352         (WebCore::JSDOMWindow::queueMicrotask):
1353         Post a microtask to JSC's microtask mechanism. This will eventually go to WebCore's MicrotaskQueue code.
1354
1355         * page/DOMWindow.idl:
1356
1357 2018-08-01  Tomas Popela  <tpopela@redhat.com>
1358
1359         [WTF] Rename String::format to String::deprecatedFormat
1360         https://bugs.webkit.org/show_bug.cgi?id=188191
1361
1362         Reviewed by Darin Adler.
1363
1364         It should be replaced with string concatenation.
1365
1366         * Modules/indexeddb/IDBKeyData.cpp:
1367         (WebCore::IDBKeyData::loggingString const):
1368         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1369         (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord):
1370         * Modules/indexeddb/shared/IDBCursorInfo.cpp:
1371         (WebCore::IDBCursorInfo::loggingString const):
1372         * Modules/indexeddb/shared/IDBGetAllRecordsData.cpp:
1373         (WebCore::IDBGetAllRecordsData::loggingString const):
1374         * Modules/indexeddb/shared/IDBGetRecordData.cpp:
1375         (WebCore::IDBGetRecordData::loggingString const):
1376         * Modules/indexeddb/shared/IDBIndexInfo.cpp:
1377         (WebCore::IDBIndexInfo::loggingString const):
1378         (WebCore::IDBIndexInfo::condensedLoggingString const):
1379         * Modules/indexeddb/shared/IDBIterateCursorData.cpp:
1380         (WebCore::IDBIterateCursorData::loggingString const):
1381         * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
1382         (WebCore::IDBObjectStoreInfo::condensedLoggingString const):
1383         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
1384         (WebCore::IDBResourceIdentifier::loggingString const):
1385         * Modules/webdatabase/Database.cpp:
1386         (WebCore::formatErrorMessage):
1387         * Modules/webdatabase/SQLError.h:
1388         (WebCore::SQLError::create):
1389         * Modules/websockets/WebSocket.cpp:
1390         (WebCore::encodeProtocolString):
1391         * accessibility/win/AccessibilityObjectWrapperWin.cpp:
1392         (WebCore::AccessibilityObjectWrapper::accessibilityAttributeValue):
1393         * css/CSSUnicodeRangeValue.cpp:
1394         (WebCore::CSSUnicodeRangeValue::customCSSText const):
1395         * css/MediaQueryEvaluator.cpp:
1396         (WebCore::aspectRatioValueAsString):
1397         * css/parser/CSSParserToken.cpp:
1398         (WebCore::CSSParserToken::serialize const):
1399         * css/parser/CSSPropertyParserHelpers.cpp:
1400         (WebCore::CSSPropertyParserHelpers::parseHexColor):
1401         * dom/Document.cpp:
1402         (WebCore::Document::lastModified):
1403         * html/FTPDirectoryDocument.cpp:
1404         (WebCore::processFilesizeString):
1405         (WebCore::processFileDateString):
1406         * html/HTMLMediaElement.h:
1407         (WTF::ValueToString<WebCore::TextTrackCue::string):
1408         * html/HTMLSelectElement.cpp:
1409         (WebCore::HTMLSelectElement::setLength):
1410         * html/ImageDocument.cpp:
1411         (WebCore::ImageDocument::imageUpdated):
1412         * html/canvas/WebGLRenderingContextBase.cpp:
1413         * html/parser/XSSAuditor.cpp:
1414         (WebCore::XSSAuditor::init):
1415         * html/track/VTTCue.cpp:
1416         (WebCore::VTTCueBox::applyCSSProperties):
1417         * inspector/InspectorFrontendClientLocal.cpp:
1418         (WebCore::InspectorFrontendClientLocal::setDockingUnavailable):
1419         (WebCore::InspectorFrontendClientLocal::setAttachedWindow):
1420         (WebCore::InspectorFrontendClientLocal::setDebuggingEnabled):
1421         (WebCore::InspectorFrontendClientLocal::setTimelineProfilingEnabled):
1422         (WebCore::InspectorFrontendClientLocal::showMainResourceForFrame):
1423         * inspector/agents/InspectorCSSAgent.cpp:
1424         * inspector/agents/InspectorIndexedDBAgent.cpp:
1425         * page/CaptionUserPreferencesMediaAF.cpp:
1426         (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const):
1427         * page/History.cpp:
1428         (WebCore::History::stateObjectAdded):
1429         * page/MemoryRelease.cpp:
1430         (WebCore::logMemoryStatisticsAtTimeOfDeath):
1431         * page/cocoa/ResourceUsageOverlayCocoa.mm:
1432         (WebCore::formatByteNumber):
1433         (WebCore::gcTimerString):
1434         (WebCore::ResourceUsageOverlay::platformDraw):
1435         * page/cocoa/ResourceUsageThreadCocoa.mm:
1436         (WebCore::logFootprintComparison):
1437         * page/linux/ResourceUsageOverlayLinux.cpp:
1438         (WebCore::cpuUsageString):
1439         (WebCore::formatByteNumber):
1440         (WebCore::gcTimerString):
1441         * page/scrolling/AxisScrollSnapOffsets.cpp:
1442         (WebCore::snapOffsetsToString):
1443         (WebCore::snapOffsetRangesToString):
1444         (WebCore::snapPortOrAreaToString):
1445         * platform/DateComponents.cpp:
1446         (WebCore::DateComponents::toStringForTime const):
1447         (WebCore::DateComponents::toString const):
1448         * platform/LocalizedStrings.cpp:
1449         * platform/animation/TimingFunction.cpp:
1450         (WebCore::TimingFunction::cssText const):
1451         * platform/audio/HRTFElevation.cpp:
1452         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
1453         * platform/cocoa/KeyEventCocoa.mm:
1454         (WebCore::keyIdentifierForCharCode):
1455         * platform/gamepad/mac/HIDGamepad.cpp:
1456         (WebCore::HIDGamepad::HIDGamepad):
1457         * platform/glib/UserAgentGLib.cpp:
1458         (WebCore::platformVersionForUAString):
1459         * platform/graphics/Color.cpp:
1460         (WebCore::Color::nameForRenderTreeAsText const):
1461         * platform/graphics/FloatPolygon.h:
1462         (WTF::ValueToString<WebCore::FloatPolygonEdge::string):
1463         * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
1464         (WebCore::AVTrackPrivateAVFObjCImpl::id const):
1465         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
1466         (WebCore::MediaSampleAVFObjC::MediaSampleAVFObjC):
1467         * platform/graphics/ca/GraphicsLayerCA.cpp:
1468         (WebCore::GraphicsLayerCA::setName):
1469         (WebCore::GraphicsLayerCA::setContentsToSolidColor):
1470         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
1471         (WebCore::GraphicsLayerCA::updateContentsImage):
1472         (WebCore::GraphicsLayerCA::updateContentsRects):
1473         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
1474         * platform/graphics/gstreamer/GStreamerCommon.cpp:
1475         (WebCore::simpleBusMessageCallback):
1476         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1477         (WebCore::MediaPlayerPrivateGStreamer::load):
1478         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
1479         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
1480         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1481         (WebCore::AppendPipeline::handleStateChangeMessage):
1482         (WebCore::AppendPipeline::resetPipeline):
1483         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1484         (WebCore::MediaPlayerPrivateGStreamerMSE::load):
1485         (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek):
1486         * platform/graphics/gtk/ImageBufferGtk.cpp:
1487         (WebCore::encodeImage):
1488         * platform/gtk/PlatformKeyboardEventGtk.cpp:
1489         (WebCore::PlatformKeyboardEvent::keyIdentifierForGdkKeyCode):
1490         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
1491         (WebCore::GStreamerAudioCaptureSource::create):
1492         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
1493         (WebCore::webkitMediaStreamSrcAddPad):
1494         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
1495         (WebCore::GStreamerVideoCaptureSource::create):
1496         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
1497         (WebCore::GStreamerVideoEncoder::makeElement):
1498         * platform/mock/MockRealtimeVideoSource.cpp:
1499         (WebCore::MockRealtimeVideoSource::drawText):
1500         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
1501         * platform/network/ParsedContentRange.cpp:
1502         (WebCore::ParsedContentRange::headerValue const):
1503         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1504         (WebCore::NetworkStorageSession::switchToNewTestingSession):
1505         * platform/sql/SQLiteDatabase.cpp:
1506         (WebCore::unauthorizedSQLFunction):
1507         * platform/text/PlatformLocale.cpp:
1508         (WebCore::DateTimeStringBuilder::visitField):
1509         * platform/win/GDIObjectCounter.cpp:
1510         (WebCore::GDIObjectCounter::GDIObjectCounter):
1511         * platform/win/KeyEventWin.cpp:
1512         (WebCore::keyIdentifierForWindowsKeyCode):
1513         * rendering/FloatingObjects.h:
1514         (WTF::ValueToString<WebCore::FloatingObject::string):
1515         * rendering/RenderFragmentedFlow.h:
1516         (WTF::ValueToString<WebCore::RenderFragmentContainer::string):
1517         * rendering/RenderLayerCompositor.cpp:
1518         (WebCore::RenderLayerCompositor::logLayerInfo):
1519         * rendering/RenderTheme.cpp:
1520         (WebCore::RenderTheme::formatMediaControlsTime const):
1521         * testing/Internals.cpp:
1522         (WebCore::Internals::address):
1523         * workers/service/server/RegistrationDatabase.cpp:
1524         (WebCore::RegistrationDatabase::ensureValidRecordsTable):
1525         (WebCore::RegistrationDatabase::importRecords):
1526
1527 2018-08-01  Alex Christensen  <achristensen@webkit.org>
1528
1529         Move all calls to ResourceLoader::start to WebKitLegacy
1530         https://bugs.webkit.org/show_bug.cgi?id=184946
1531
1532         Reviewed by Andy Estes.
1533
1534         This is in preparation for moving ResourceLoader::start to WebKitLegacy along with all ResourceHandle code.
1535         I move the code that moves m_deferredRequest into m_request into WebKitLegacy, which won't change behavior for
1536         modern WebKit because modern WebKit never calls ResourceLoader::start, the only place where m_deferredRequest
1537         is ever set.  This won't change behavior for WebKitLegacy because the same operations happen in the same order.
1538
1539         * loader/LoaderStrategy.h:
1540         * loader/ResourceLoader.cpp:
1541         (WebCore::ResourceLoader::setDefersLoading):
1542         * loader/ResourceLoader.h:
1543         (WebCore::ResourceLoader::setRequest):
1544         (WebCore::ResourceLoader::deferredRequest const):
1545         (WebCore::ResourceLoader::takeDeferredRequest):
1546
1547 2018-08-01  Nan Wang  <n_wang@apple.com>
1548
1549         AX: AOM: Add ARIA IDL Attribute Reflection
1550         https://bugs.webkit.org/show_bug.cgi?id=184676
1551         <rdar://problem/39476882>
1552
1553         Reviewed by Chris Fleizach.
1554
1555         Test: accessibility/ARIA-reflection.html
1556
1557         * CMakeLists.txt:
1558         * DerivedSources.make:
1559         * WebCore.xcodeproj/project.pbxproj:
1560         * accessibility/AccessibilityRole.idl: Added.
1561         * accessibility/AriaAttributes.idl: Added.
1562         * dom/Element.idl:
1563         * page/RuntimeEnabledFeatures.h:
1564         (WebCore::RuntimeEnabledFeatures::setAriaReflectionEnabled):
1565         (WebCore::RuntimeEnabledFeatures::ariaReflectionEnabled const):
1566
1567 2018-08-01  Zalan Bujtas  <zalan@apple.com>
1568
1569         [LFC][Floating] Revert back to only one list for the all the floatings.
1570         https://bugs.webkit.org/show_bug.cgi?id=188232
1571
1572         Reviewed by Antti Koivisto.
1573
1574         If the combined floating list turns out to be a performance bottleneck, we can still split it into left and right. However at this point
1575         having 2 dedicated lists just makes the implementation more complicated.
1576
1577         * layout/FloatingContext.cpp:
1578         (WebCore::Layout::begin):
1579         (WebCore::Layout::end):
1580         (WebCore::Layout::FloatingPair::FloatingPair):
1581         (WebCore::Layout::FloatingPair::left const):
1582         (WebCore::Layout::FloatingPair::right const):
1583         (WebCore::Layout::Iterator::Iterator):
1584         (WebCore::Layout::previousFloatingIndex):
1585         (WebCore::Layout::Iterator::operator++):
1586         (WebCore::Layout::Iterator::set):
1587         (WebCore::Layout::floatingDisplayBox): Deleted.
1588         * layout/FloatingState.cpp:
1589         (WebCore::Layout::FloatingState::remove):
1590         (WebCore::Layout::FloatingState::append):
1591         * layout/FloatingState.h:
1592         (WebCore::Layout::FloatingState::isEmpty const):
1593         (WebCore::Layout::FloatingState::floatings const):
1594         (WebCore::Layout::FloatingState::last const):
1595
1596 2018-08-01  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1597
1598         [Curl] Change synchronous request logic using MessageQueue to match with Mac port.
1599         https://bugs.webkit.org/show_bug.cgi?id=188206
1600
1601         Reviewed by Alex Christensen.
1602
1603         Port synchronous request logic from ResourceHandleMac to use MessageQueue for
1604         client callback invocation. This makes simplify the logic of CurlRequest because
1605         now every requests are handled in Curl thread and there's no difference between
1606         sync and async requests.
1607
1608         Test: Covered by these tests:
1609         - http\tests\xmlhttprequest\simple-sync.html
1610         - http\tests\xmlhttprequest\xmlhttprequest-unsafe-redirect.html
1611
1612         * platform/network/ResourceHandleInternal.h:
1613         * platform/network/curl/CurlRequest.cpp: Remove synchronous request logics.
1614         (WebCore::CurlRequest::CurlRequest):
1615         (WebCore::CurlRequest::invalidateClient):
1616         (WebCore::CurlRequest::start):
1617         (WebCore::CurlRequest::cancel):
1618         (WebCore::CurlRequest::runOnMainThread): Added message queue handling.
1619         (WebCore::CurlRequest::runOnWorkerThreadIfRequired):
1620         (WebCore::CurlRequest::didReceiveData):
1621         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
1622         (WebCore::CurlRequest::completeDidReceiveResponse):
1623         (WebCore::CurlRequest::updateHandlePauseState):
1624         (WebCore::CurlRequest::isHandlePaused const):
1625         * platform/network/curl/CurlRequest.h:
1626         (WebCore::CurlRequest::create):
1627         (WebCore::CurlRequest::resourceRequest const):
1628         * platform/network/curl/ResourceHandleCurl.cpp:
1629         (WebCore::ResourceHandle::createCurlRequest):
1630         (WebCore::ResourceHandle::restartRequestWithCredential):
1631         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1632         (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse):
1633         (WebCore::ResourceHandle::continueAfterDidReceiveResponse):
1634         (WebCore::ResourceHandle::continueAfterWillSendRequest):
1635         (WebCore::ResourceHandle::handleDataURL):
1636
1637 2018-08-01  Zalan Bujtas  <zalan@apple.com>
1638
1639         [LFC][Floating] Use margin box consistently while placing a floating.
1640         https://bugs.webkit.org/show_bug.cgi?id=188222
1641
1642         Reviewed by Antti Koivisto.
1643
1644         The floating box fits when its margin box fits.
1645
1646         * layout/FloatingContext.cpp:
1647         (WebCore::Layout::FloatingContext::computePosition const):
1648         (WebCore::Layout::FloatingContext::floatingPosition const):
1649         (WebCore::Layout::FloatingContext::initialVerticalPosition const):
1650         (WebCore::Layout::FloatingContext::alignWithContainingBlock const):
1651         (WebCore::Layout::FloatingContext::alignWithFloatings const):
1652         (WebCore::Layout::FloatingPair::intersects const):
1653         * layout/displaytree/DisplayBox.h:
1654         (WebCore::Display::Box::rectWithMargin const):
1655
1656 2018-08-01  Zalan Bujtas  <zalan@apple.com>
1657
1658         [LFC] Add FormattingContext::mapToAncestor geometry mapping function
1659         https://bugs.webkit.org/show_bug.cgi?id=188188
1660
1661         Reviewed by Antti Koivisto.
1662
1663         * layout/FormattingContext.cpp:
1664         (WebCore::Layout::FormattingContext::mapToAncestor):
1665         * layout/FormattingContext.h:
1666         * layout/displaytree/DisplayBox.cpp:
1667         (WebCore::Display::Box::clone const):
1668         * layout/displaytree/DisplayBox.h:
1669
1670 2018-08-01  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1671
1672         [Curl] Bugfix on ResourceHandle::cancel()
1673         https://bugs.webkit.org/show_bug.cgi?id=188234
1674
1675         Reviewed by Darin Adler.
1676         Trivial bug. The actual request was not cancelled correctly.
1677
1678         * platform/network/curl/ResourceHandleCurl.cpp:
1679         (WebCore::ResourceHandle::cancel):
1680
1681 2018-08-01  Zalan Bujtas  <zalan@apple.com>
1682
1683         [LFC][Floating] FloatingState should take the formatting root box.
1684         https://bugs.webkit.org/show_bug.cgi?id=188214
1685
1686         Reviewed by Antti Koivisto.
1687
1688         This will be taken into use when FormattingContext takes all boxes in the coordinate system of the formatting root.
1689
1690         * layout/FloatingState.cpp:
1691         (WebCore::Layout::FloatingState::FloatingState):
1692         (WebCore::Layout::belongsToThisFloatingContext):
1693         (WebCore::Layout::FloatingState::append):
1694         * layout/FloatingState.h:
1695         (WebCore::Layout::FloatingState::create):
1696         * layout/LayoutContext.cpp:
1697         (WebCore::Layout::LayoutContext::establishedFormattingState):
1698
1699 2018-08-01  Zalan Bujtas  <zalan@apple.com>
1700
1701         [LFC][Floating] Align new floating with the bottom of the existing floatings.
1702         https://bugs.webkit.org/show_bug.cgi?id=188213
1703
1704         Reviewed by Antti Koivisto.
1705
1706         When the incoming floating does not fit at all, align its top with the bottom of the existing floatings.
1707
1708         * layout/FloatingContext.cpp:
1709         (WebCore::Layout::FloatingContext::floatingPosition const):
1710         (WebCore::Layout::FloatingPair::bottom const):
1711
1712 2018-08-01  Eric Carlson  <eric.carlson@apple.com>
1713
1714         Always use MediaPlayback audio category when playing to AppleTV
1715         https://bugs.webkit.org/show_bug.cgi?id=188230
1716         <rdar://problem/42497809>
1717
1718         Reviewed by Jer Noble.
1719
1720         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
1721         (PlatformMediaSessionManager::updateSessionState): Check session.isPlayingToWirelessPlaybackTarget().
1722
1723 2018-08-01  Timothy Hatcher  <timothy@apple.com>
1724
1725         Hardcode some system colors to avoid fingerprinting exposure.
1726         https://bugs.webkit.org/show_bug.cgi?id=188203
1727         rdar://problem/42781630
1728
1729         Reviewed by Tim Horton.
1730
1731         Passes existing tests with the hardcoded blue system appearance.
1732
1733         * rendering/RenderTheme.h:
1734         * rendering/RenderThemeMac.mm:
1735         (WebCore::RenderThemeMac::systemColor const):
1736         Adds special handling for some system colors. Fixes -apple-system-selected-text-background
1737         to match the real selection color by using blendWithWhite().
1738
1739 2018-08-01  Eric Carlson  <eric.carlson@apple.com>
1740
1741         [iOS] Remove the delay before setting audio session category added in r233535
1742         https://bugs.webkit.org/show_bug.cgi?id=188225
1743
1744         Reviewed by Jer Noble.
1745
1746         * platform/audio/PlatformMediaSessionManager.cpp:
1747         (WebCore::PlatformMediaSessionManager::beginInterruption): scheduleUpdateSessionState -> updateSessionState.
1748         (WebCore::PlatformMediaSessionManager::addSession): Ditto.
1749         (WebCore::PlatformMediaSessionManager::removeSession): Ditto.
1750         (WebCore::PlatformMediaSessionManager::sessionStateChanged): Ditto.
1751         (WebCore::PlatformMediaSessionManager::sessionCanProduceAudioChanged): Ditto.
1752         (WebCore::PlatformMediaSessionManager::updateSessionState): Ditto.
1753         (WebCore::PlatformMediaSessionManager::audioOutputDeviceChanged): Ditto.
1754         (WebCore::PlatformMediaSessionManager::scheduleUpdateSessionState): Deleted.
1755         * platform/audio/PlatformMediaSessionManager.h:
1756
1757         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
1758         (PlatformMediaSessionManager::updateSessionState):
1759         (PlatformMediaSessionManager::scheduleUpdateSessionState): Deleted.
1760         * rendering/RenderLayer.cpp:
1761         (WebCore::RenderLayer::updateClipRects):
1762
1763 2018-08-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1764
1765         Add TransformationMatrix::Identity
1766         https://bugs.webkit.org/show_bug.cgi?id=188204
1767
1768         Reviewed by Simon Fraser.
1769
1770         This patch adds TransformationMatrix::Identity, which is a static const variable holding an identity matrix.
1771
1772         No behavior change.
1773
1774         * platform/graphics/GraphicsLayer.cpp:
1775         (WebCore::GraphicsLayer::transform const):
1776         (WebCore::GraphicsLayer::childrenTransform const):
1777         (): Deleted.
1778         * platform/graphics/transforms/TransformationMatrix.cpp:
1779         * platform/graphics/transforms/TransformationMatrix.h:
1780
1781 2018-08-01  Thibault Saunier  <tsaunier@igalia.com>
1782
1783         [GStreamer] Make sure that first buffer running time is 0 in GStreamerMediaStreamSource
1784         https://bugs.webkit.org/show_bug.cgi?id=188210
1785
1786         This is a live source and the first frame is the beginning of the stream,
1787         but that doesn't mean that the incoming stream from the camera didn't start
1788         before. We need to set a pad offset on each srcpad of the source to compensate
1789         for that. This is the exact same logic as in webrtc GStreamerVideo/Enc/Dec/oder.
1790
1791         Reviewed by Alejandro G. Castro.
1792
1793         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
1794         (WebCore::webkit_media_stream_src_init):
1795         (WebCore::webkitMediaStreamSrcPushVideoSample):
1796         (WebCore::webkitMediaStreamSrcPushAudioSample):
1797
1798 2018-08-01  Zan Dobersek  <zdobersek@igalia.com>
1799
1800         [CoordGraphics] Move CoordinatedBackingStore to WebCore
1801         https://bugs.webkit.org/show_bug.cgi?id=188158
1802
1803         Reviewed by Carlos Garcia Campos.
1804
1805         Move the CoordinatedBackingStore class from WebKit to WebCore. It has no
1806         dependency on anything in the WebKit layer, and it's more suitable to
1807         future needs to keep it in the WebCore layer.
1808
1809         * platform/TextureMapper.cmake:
1810         * platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp: Renamed from Source/WebKit/Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp.
1811         * platform/graphics/texmap/coordinated/CoordinatedBackingStore.h: Renamed from Source/WebKit/Shared/CoordinatedGraphics/CoordinatedBackingStore.h.
1812         (WebCore::CoordinatedBackingStoreTile::CoordinatedBackingStoreTile):
1813         (WebCore::CoordinatedBackingStore::rect const):
1814
1815 2018-07-31  Myles C. Maxfield  <mmaxfield@apple.com>
1816
1817         [WIN] Fix tests for text with initial advances
1818         https://bugs.webkit.org/show_bug.cgi?id=188099
1819
1820         Reviewed by Darin Adler.
1821
1822         Fixup after r234318.
1823
1824         Tests: fast/text/complex-first-glyph-with-initial-advance.html
1825                fast/text/initial-advance-in-intermediate-run-complex.html
1826
1827         * platform/graphics/ComplexTextController.cpp:
1828         * platform/graphics/FontCascade.cpp:
1829         (WebCore::FontCascade::drawGlyphBuffer const):
1830
1831 2018-07-31  Alex Christensen  <achristensen@webkit.org>
1832
1833         REGRESSION (r231107): MoviStar+ launches to a blank black screen
1834         https://bugs.webkit.org/show_bug.cgi?id=188139
1835
1836         Reviewed by Brent Fulgham.
1837
1838         For this app, revert behavior to how it was before r231107 with a linked-on-or-before check.
1839         r231107 increased our fetch spec conformance, which we intend to keep.  This makes a low-risk
1840         targeted fix that will fix the affected app until they update.  
1841
1842         I manually verified this fixes the app.
1843
1844         * loader/DocumentThreadableLoader.cpp:
1845         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
1846         * platform/RuntimeApplicationChecks.h:
1847         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
1848         (WebCore::applicationSDKVersionOverride):
1849         (WebCore::setApplicationSDKVersion):
1850         (WebCore::applicationSDKVersion):
1851         (WebCore::IOSApplication::isMoviStarPlus):
1852
1853 2018-07-31  Myles C. Maxfield  <mmaxfield@apple.com>
1854
1855         [Cocoa] Addressing post-review comments on r234158
1856         https://bugs.webkit.org/show_bug.cgi?id=188202
1857
1858         Reviewed by Darin Adler.
1859
1860         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1861         (WebCore::FontCache::lastResortFallbackFont):
1862
1863 2018-07-31  John Wilander  <wilander@apple.com>
1864
1865         Resource Load Statistics: Remove partitioned cookies for reduced complexity, lower memory footprint, and ability to support more platforms
1866         https://bugs.webkit.org/show_bug.cgi?id=188109
1867         <rdar://problem/42664391>
1868
1869         Reviewed by Brent Fulgham, Chris Dumez, and Alex Christensen.
1870
1871         Tests: http/tests/resourceLoadStatistics/cookie-deletion.html
1872                http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html
1873                http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html
1874                http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html
1875                http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe.html
1876                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html
1877                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame.html
1878                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html
1879                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html
1880                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html
1881                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe.html
1882
1883         This patch removes cookie partitioning which reduces the model to just
1884         blocked cookies (in third-party contexts) and first-party cookie access.
1885
1886         Several of the changes are renaming to reflect that there are no more
1887         cookie partitions. However, the compile-time check remains for now since
1888         this change is not ready to ship.
1889
1890         The test cases mentioned about are not new. They are just renamed to
1891         reflect the code changes and to shorten their names (as requested by
1892         non-Cocoa platforms).
1893
1894         * loader/ResourceLoadStatistics.cpp:
1895         (WebCore::ResourceLoadStatistics::toString const):
1896         (WebCore::ResourceLoadStatistics::merge):
1897             Removed the use of isMarkedForCookiePartitioning.
1898         * loader/ResourceLoadStatistics.h:
1899             Removed isMarkedForCookiePartitioning.
1900         * platform/network/NetworkStorageSession.h:
1901         * platform/network/ResourceHandle.h:
1902             Renamed applySniffingPoliciesAndStoragePartitionIfNeeded() to
1903             applySniffingPoliciesIfNeeded().
1904         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1905         (WebCore::getPartitioningDomain):
1906         (WebCore::NetworkStorageSession::shouldBlockCookies const):
1907             Now takes a frame ID and a page ID to be able to support
1908             the Storage Access API. This was previously handled by
1909             shouldPartitionCookies() which is now deleted.
1910         (WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor):
1911             Renamed from setPrevalentDomainsToPartitionOrBlockCookies().
1912         (WebCore::NetworkStorageSession::removePrevalentDomains):
1913             No longer needs to clear the member variable for partitioned cookie domains.
1914         (WebCore::NetworkStorageSession::setCookieStoragePartitioningEnabled): Deleted.
1915         (WebCore::NetworkStorageSession::cookieStoragePartition const): Deleted.
1916         (WebCore::NetworkStorageSession::shouldPartitionCookies const): Deleted.
1917         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies): Deleted.
1918             Renamed to setPrevalentDomainsToBlockCookiesFor().
1919         * platform/network/mac/CookieJarMac.mm:
1920         (WebCore::cookiesForURL):
1921             Now calls session.shouldBlockCookies() instead of the
1922             wrapper cookiesAreBlockedForURL().
1923         (WebCore::setCookiesFromDOM):
1924             No longer checks for partition.
1925         (WebCore::applyPartitionToCookies): Deleted.
1926         (WebCore::cookiesAreBlockedForURL): Deleted.
1927             This was just a wrapper for session.shouldBlockCookies().
1928         (WebCore::cookiesInPartitionForURL): Deleted.
1929         * platform/network/mac/ResourceHandleMac.mm:
1930         (WebCore::ResourceHandle::applySniffingPoliciesIfNeeded):
1931             Renamed from applySniffingPoliciesAndStoragePartitionIfNeeded().
1932         (WebCore::ResourceHandle::createNSURLConnection):
1933             Consequence of function name change.
1934         (WebCore::ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded): Deleted.
1935             Renamed to applySniffingPoliciesIfNeeded().
1936
1937 2018-07-31  Wenson Hsieh  <wenson_hsieh@apple.com>
1938
1939         [iOS] Spelling suggestions cannot be selected in focused form controls when zoomed in
1940         https://bugs.webkit.org/show_bug.cgi?id=188107
1941         <rdar://problem/42354250>
1942
1943         Reviewed by Tim Horton.
1944
1945         After r232040, the synthetic click gesture recognizer was enabled when tapping inside of the focused element,
1946         which allows the page to handle click events inside editable content. However, this means that codepaths in
1947         EventHandler that are responsible for changing selection due to default click event behaviors on macOS are now
1948         active on iOS; this conflicts with selection changes due to text interaction gestures, which are the existing
1949         mechanism for modifying the selection on iOS.
1950
1951         To address this, we defer selection changes when clicking to text interaction gestures on iOS by tweaking the
1952         default behavior of a click on iOS to /not/ change selection when moving within the same editable root. This is
1953         similar to r233311, but in a different codepath that specifically handles selection changes when clicking on
1954         content that is already selected.
1955
1956         Test: fast/forms/ios/click-should-not-suppress-misspelling.html
1957
1958         * page/EventHandler.cpp:
1959         (WebCore::EventHandler::handleMouseReleaseEvent):
1960
1961 2018-07-31  Yusuke Suzuki  <utatane.tea@gmail.com>
1962
1963         Clean up TransformationMatrix implementation
1964         https://bugs.webkit.org/show_bug.cgi?id=188197
1965
1966         Reviewed by Simon Fraser.
1967
1968         We perform cleaning up of TransformationMatrix.
1969
1970         1. We drop user-defined operator= and copy constructor. Default ones works well for TransformationMatrix.
1971         2. Remove unused setMatrix. We explicitly use memcpy in TransformationMatrix.cpp (only one place).
1972         3. Use memcmp for implementing operator==.
1973
1974         In (2) and (3), we use `memcpy(&matrix[0][0], &tmp[0][0], sizeof(Matrix4))` instead of `memcpy(matrix, tmp, sizeof(Matrix4))`,
1975         since they both are non nullptr and the former is easier to understand.
1976
1977         * platform/graphics/transforms/TransformationMatrix.cpp:
1978         (WebCore::TransformationMatrix::multiply):
1979         * platform/graphics/transforms/TransformationMatrix.h:
1980         (WebCore::TransformationMatrix::setMatrix):
1981         (WebCore::TransformationMatrix::operator== const):
1982         (WebCore::TransformationMatrix::operator =): Deleted.
1983
1984 2018-07-31  Timothy Hatcher  <timothy@apple.com>
1985
1986         Don't call RenderTheme::platformColorsDidChange() during printing.
1987         https://bugs.webkit.org/show_bug.cgi?id=188181
1988         rdar://problem/42360070
1989
1990         Reviewed by Tim Horton.
1991
1992         * inspector/agents/InspectorPageAgent.cpp:
1993         (WebCore::InspectorPageAgent::setEmulatedMedia): Call m_page.updateStyleAfterChangeInEnvironment()
1994         instead of going to styleStope() and remove call to RenderTheme::platformColorsDidChange().
1995         * page/FrameView.cpp:
1996         (WebCore::FrameView::adjustMediaTypeForPrinting): Remove call RenderTheme::platformColorsDidChange().
1997
1998 2018-07-31  Yusuke Suzuki  <utatane.tea@gmail.com>
1999
2000         Use static const global variable for TransformationMatrix instead of NeverDestroyed
2001         https://bugs.webkit.org/show_bug.cgi?id=188195
2002
2003         Reviewed by Darin Adler.
2004
2005         Since TransformationMatrix does not have a non-trivial destructor, we can put it
2006         as static const global variable if its constructor is constexpr. This patch makes
2007         some of constructors constexpr and makes identityTransform static const global variable
2008         instead of NeverDestroyed<> + static function. This removes unnecessary static function
2009         and lazy initialization.
2010
2011         No behavior change.
2012
2013         * platform/graphics/GraphicsLayer.cpp:
2014         (WebCore::GraphicsLayer::transform const):
2015         (WebCore::GraphicsLayer::childrenTransform const):
2016         (WebCore::identityTransform): Deleted.
2017         * platform/graphics/transforms/TransformationMatrix.h:
2018         (WebCore::TransformationMatrix::TransformationMatrix):
2019
2020 2018-07-31  Zalan Bujtas  <zalan@apple.com>
2021
2022         [LFC][Floating] Add basic left/right floating positioning.
2023         https://bugs.webkit.org/show_bug.cgi?id=188148
2024
2025         Reviewed by Antti Koivisto.
2026
2027         This patch implements simple floating positioning.
2028         (Floatings with different containing blocks do not work yet.)
2029
2030         * layout/FloatingContext.cpp:
2031         (WebCore::Layout::FloatingPair::isEmpty const):
2032         (WebCore::Layout::Iterator::current const):
2033         (WebCore::Layout::Iterator::verticalPosition const):
2034         (WebCore::Layout::FloatingContext::FloatingContext):
2035         (WebCore::Layout::FloatingContext::computePosition const):
2036         (WebCore::Layout::FloatingContext::floatingPosition const):
2037         (WebCore::Layout::FloatingContext::initialVerticalPosition const):
2038         (WebCore::Layout::FloatingContext::alignWithContainingBlock const):
2039         (WebCore::Layout::FloatingContext::alignWithFloatings const):
2040         (WebCore::Layout::floatingDisplayBox):
2041         (WebCore::Layout::FloatingPair::FloatingPair):
2042         (WebCore::Layout::FloatingPair::left const):
2043         (WebCore::Layout::FloatingPair::right const):
2044         (WebCore::Layout::FloatingPair::intersects const):
2045         (WebCore::Layout::Iterator::Iterator):
2046         (WebCore::Layout::Iterator::operator++):
2047         (WebCore::Layout::Iterator::set):
2048         (WebCore::Layout::FloatingContext::computePosition): Deleted.
2049         * layout/FloatingContext.h:
2050         * layout/FloatingState.cpp:
2051         (WebCore::Layout::FloatingState::append):
2052         * layout/FloatingState.h:
2053         (WebCore::Layout::FloatingState::floatings const):
2054         (WebCore::Layout::FloatingState::last const):
2055         * layout/blockformatting/BlockFormattingContext.cpp:
2056         (WebCore::Layout::BlockFormattingContext::layout const):
2057         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
2058         * layout/displaytree/DisplayBox.cpp:
2059         (WebCore::Display::Box::Rect::Rect):
2060         * layout/displaytree/DisplayBox.h:
2061         (WebCore::Display::Box::Rect::intersects const):
2062         (WebCore::Display::Box::rect const):
2063
2064 2018-07-31  Rob Buis  <rbuis@igalia.com>
2065
2066         Remove ResourceResponse::cacheBodyKey API
2067         https://bugs.webkit.org/show_bug.cgi?id=188192
2068
2069         Reviewed by Frédéric Wang.
2070
2071         Removed unused API.
2072
2073         No new tests needed since this API is not used.
2074
2075         * platform/network/ResourceResponseBase.h:
2076         (WebCore::ResourceResponseBase::encode const):
2077         (WebCore::ResourceResponseBase::decode):
2078         (WebCore::ResourceResponseBase::cacheBodyKey const): Deleted.
2079         (WebCore::ResourceResponseBase::setCacheBodyKey): Deleted.
2080
2081 2018-07-30  Simon Fraser  <simon.fraser@apple.com>
2082
2083         Shrink GraphicsLayerCA
2084         https://bugs.webkit.org/show_bug.cgi?id=188141
2085
2086         Reviewed by Zalan Bujtas.
2087         
2088         Shrink GraphicsLayerCA from 1040 to 880 bytes by:
2089         * moving all the clone-related stuff into the lazily-allocated m_layerClones
2090         * moving all the animation-related stuff into the lazily-allocated m_animations
2091         * making enums be 8-bit
2092         * re-ordering data members
2093
2094         * page/cocoa/ResourceUsageOverlayCocoa.mm:
2095         (WebCore::ResourceUsageOverlay::platformInitialize):
2096         * platform/graphics/GraphicsLayer.cpp:
2097         (WebCore::GraphicsLayer::GraphicsLayer):
2098         (WebCore::operator<<):
2099         * platform/graphics/GraphicsLayer.h:
2100         * platform/graphics/GraphicsLayerClient.h:
2101         * platform/graphics/WindRule.h:
2102         * platform/graphics/ca/GraphicsLayerCA.cpp:
2103         (WebCore::GraphicsLayerCA::GraphicsLayerCA):
2104         (WebCore::GraphicsLayerCA::moveOrCopyAnimations):
2105         (WebCore::GraphicsLayerCA::addProcessingActionForAnimation):
2106         (WebCore::GraphicsLayerCA::setContentsToSolidColor):
2107         (WebCore::GraphicsLayerCA::setContentsToImage):
2108         (WebCore::GraphicsLayerCA::setContentsToPlatformLayer):
2109         (WebCore::GraphicsLayerCA::contentsLayerForMedia const):
2110         (WebCore::GraphicsLayerCA::layerDidDisplay):
2111         (WebCore::layerTypeForCustomBackdropAppearance):
2112         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
2113         (WebCore::GraphicsLayerCA::updateGeometry):
2114         (WebCore::GraphicsLayerCA::updateMasksToBounds):
2115         (WebCore::GraphicsLayerCA::updateContentsVisibility):
2116         (WebCore::GraphicsLayerCA::updateContentsOpaque):
2117         (WebCore::GraphicsLayerCA::updateBackfaceVisibility):
2118         (WebCore::GraphicsLayerCA::updateFilters):
2119         (WebCore::GraphicsLayerCA::updateBackdropFilters):
2120         (WebCore::GraphicsLayerCA::updateBackdropFiltersRect):
2121         (WebCore::GraphicsLayerCA::ensureStructuralLayer):
2122         (WebCore::GraphicsLayerCA::updateDrawsContent):
2123         (WebCore::GraphicsLayerCA::updateCoverage):
2124         (WebCore::GraphicsLayerCA::updateDebugIndicators):
2125         (WebCore::GraphicsLayerCA::updateContentsImage):
2126         (WebCore::GraphicsLayerCA::updateContentsPlatformLayer):
2127         (WebCore::GraphicsLayerCA::updateContentsColorLayer):
2128         (WebCore::GraphicsLayerCA::updateContentsRects):
2129         (WebCore::GraphicsLayerCA::updateMasksToBoundsRect):
2130         (WebCore::GraphicsLayerCA::updateMaskLayer):
2131         (WebCore::GraphicsLayerCA::updateAnimations):
2132         (WebCore::GraphicsLayerCA::isRunningTransformAnimation const):
2133         (WebCore::GraphicsLayerCA::ensureLayerAnimations):
2134         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
2135         * platform/graphics/ca/GraphicsLayerCA.h:
2136         (WebCore::GraphicsLayerCA::animationIsRunning const):
2137         (WebCore::GraphicsLayerCA::primaryLayerClones const): Deleted.
2138         * platform/graphics/ca/PlatformCALayerClient.h:
2139         (WebCore::PlatformCALayerClient::platformCALayerContentsOrientation const):
2140         * platform/graphics/ca/TileCoverageMap.h:
2141         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
2142         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2143         (PlatformCALayerCocoa::PlatformCALayerCocoa):
2144         (PlatformCALayerCocoa::requiresCustomAppearanceUpdateOnBoundsChange const):
2145         (PlatformCALayerCocoa::updateCustomAppearance):
2146         (PlatformCALayer::drawLayerContents):
2147         * rendering/RenderLayerBacking.cpp:
2148         (WebCore::RenderLayerBacking::updateCustomAppearance):
2149         (WebCore::RenderLayerBacking::updateConfiguration):
2150         * rendering/RenderLayerCompositor.cpp:
2151         (WebCore::RenderLayerCompositor::rootBackgroundColorOrTransparencyChanged):
2152         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
2153
2154 2018-07-30  Justin Fan  <justin_fan@apple.com>
2155
2156         [WebGL2] Support compilation of GLSL ES version 300 shaders
2157         https://bugs.webkit.org/show_bug.cgi?id=187982
2158         <rdar://problem/42564229>
2159
2160         Reviewed by Dean Jackson.
2161
2162         Test: fast/canvas/webgl/webgl2-glsl3-compile.html
2163
2164         * html/canvas/WebGLRenderingContextBase.cpp:
2165         (WebCore::WebGLRenderingContextBase::create): Rename 'useGLES3' to 'isWebGL2' (everywhere) to make more sense.
2166         * platform/graphics/GraphicsContext3DAttributes.h: Rename 'useGLES3' to 'isWebGL2'.
2167         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
2168         (WebCore::setPixelFormat): Back WebGL2 contexts with OpenGL 4 for full OpenGL ES 3 support. 
2169         (WebCore::GraphicsContext3D::GraphicsContext3D): Request correct GLSL output version and WebGL 2 for ANGLE shader compilation.
2170         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2171         (WebCore::GraphicsContext3D::checkVaryingsPacking const): MAX_VARYING_FLOATS is deprecated in OpenGL 3+.
2172         * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp: Rename 'useGLES3' to 'isWebGL2'.
2173         (WebCore::GraphicsContext3D::create):
2174         (WebCore::GraphicsContext3D::GraphicsContext3D):
2175
2176 2018-07-30  Justin Fan  <justin_fan@apple.com>
2177
2178         Match GraphicsContext3D with correct virtual screen using registryID
2179         https://bugs.webkit.org/show_bug.cgi?id=188072
2180         <rdar://problem/42634940>
2181
2182         Reviewed by Dean Jackson.
2183
2184         Follow up to https://bugs.webkit.org/show_bug.cgi?id=187750. Rather than matching rendererIDs, 
2185         which can vary between processes, match GPU to display using registryID that is unique to a GPU, 
2186         which was added to CGL in MacOS 10.13. 
2187
2188         No new tests. Manually tested on MacBookPro13,3 and iMacPro1,1 with Apple DisplayPort Cinema Display
2189         and RX 580 external GPU. 
2190
2191         * platform/PlatformScreen.h:
2192         * platform/ScreenProperties.h:
2193         (WebCore::ScreenData::encode const):
2194         (WebCore::ScreenData::decode):
2195         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
2196         (WebCore::setGPUByRegistryID):
2197         (WebCore::setGPUByDisplayMask):
2198         (WebCore::GraphicsContext3D::GraphicsContext3D):
2199         (WebCore::GraphicsContext3D::screenDidChange):
2200         (WebCore::identifyAndSetCurrentGPU): Deleted.
2201         * platform/mac/PlatformScreenMac.mm:
2202         (WebCore::collectScreenProperties):
2203         (WebCore::primaryRegistryID):
2204         (WebCore::registryIDForDisplay):
2205         (WebCore::registryIDForDisplayMask):
2206         (WebCore::rendererIDForDisplayMask): Deleted.
2207         (WebCore::rendererIDForDisplay): Deleted.
2208         (WebCore::primaryRendererID): Deleted.
2209
2210 2018-07-30  Rob Buis  <rbuis@igalia.com>
2211
2212         Merge PlatformCookieJar functions into NetworkStorageSession
2213         https://bugs.webkit.org/show_bug.cgi?id=188137
2214
2215         Reviewed by Alex Christensen.
2216
2217         No new tests -- no change in WebKit functionality.
2218
2219         * PlatformMac.cmake: Remove CookieJarMac.mm reference
2220         * SourcesCocoa.txt: Remove CookieJarMac.mm reference
2221         * WebCore.xcodeproj/project.pbxproj:
2222         * loader/CookieJar.cpp: Remove PlatformCookieJar.h reference.
2223         * platform/Curl.cmake: Remove CookieJarCurl.cpp reference.
2224         * platform/SourcesSoup.txt: Remove CookieJarSoup.cpp reference.
2225         * platform/network/CacheValidation.cpp: Adapt callsites to use
2226         NetworkStorageSession instead of CookieJar functions.
2227
2228         (WebCore::headerValueForVary):
2229         * platform/network/NetworkStorageSession.h: Add PlatformCookieJar
2230         functions.
2231
2232         * platform/network/PlatformCookieJar.h: Removed.
2233         * platform/network/SocketStreamHandleImpl.cpp: Adapt callsites to
2234         use NetworkStorageSession instead of CookieJar functions.
2235         (WebCore::cookieDataForHandshake):
2236         * platform/network/cf/CookieJarCFNet.cpp: Removed.
2237         * platform/network/cf/NetworkStorageSessionCFNet.cpp: Move functions
2238         from CookieJarCFNet.cpp.
2239         (WebCore::cookieDomain):
2240         (WebCore::canonicalCookieTime):
2241         (WebCore::cookieCreatedTime):
2242         (WebCore::cookieExpirationTime):
2243         (WebCore::cookieName):
2244         (WebCore::cookiePath):
2245         (WebCore::cookieValue):
2246         (WebCore::filterCookies):
2247         (WebCore::copyCookiesForURLWithFirstPartyURL):
2248         (WebCore::createCookies):
2249         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
2250         (WebCore::containsSecureCookies):
2251         (WebCore::NetworkStorageSession::cookiesForDOM const):
2252         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
2253         (WebCore::NetworkStorageSession::cookiesEnabled const):
2254         (WebCore::NetworkStorageSession::getRawCookies const):
2255         (WebCore::NetworkStorageSession::deleteCookie const):
2256         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
2257         (WebCore::NetworkStorageSession::deleteAllCookies):
2258         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
2259         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
2260         * platform/network/cocoa/NetworkStorageSessionCocoa.mm: Move functions
2261         from CookieJarMac.mm.
2262         (WebCore::httpCookies):
2263         (WebCore::deleteHTTPCookie):
2264         (WebCore::policyProperties):
2265         (WebCore::cookiesForURL):
2266         (WebCore::setHTTPCookiesForURL):
2267         (WebCore::httpCookiesForURL):
2268         (WebCore::filterCookies):
2269         (WebCore::applyPartitionToCookies):
2270         (WebCore::cookiesAreBlockedForURL):
2271         (WebCore::cookiesInPartitionForURL):
2272         (WebCore::cookiesForSession):
2273         (WebCore::deleteAllHTTPCookies):
2274         (WebCore::NetworkStorageSession::cookiesForDOM const):
2275         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
2276         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
2277         (WebCore::httpCookieAcceptPolicy):
2278         (WebCore::NetworkStorageSession::cookiesEnabled const):
2279         (WebCore::NetworkStorageSession::getRawCookies const):
2280         (WebCore::NetworkStorageSession::deleteCookie const):
2281         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
2282         (WebCore::NetworkStorageSession::deleteAllCookies):
2283         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
2284         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
2285         * platform/network/curl/CookieJarCurl.cpp: Removed.
2286         * platform/network/curl/CookieJarCurl.h:
2287         * platform/network/curl/NetworkStorageSessionCurl.cpp: Merge functions
2288         from CookieJarCurl.cpp.
2289         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
2290         (WebCore::NetworkStorageSession::cookiesEnabled const):
2291         (WebCore::NetworkStorageSession::cookiesForDOM const):
2292         (WebCore::NetworkStorageSession::deleteCookie const):
2293         (WebCore::NetworkStorageSession::deleteAllCookies):
2294         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
2295         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
2296         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
2297         (WebCore::NetworkStorageSession::getRawCookies const):
2298         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
2299         * platform/network/mac/CookieJarMac.mm: Removed.
2300         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2301         * platform/network/soup/CookieJarSoup.cpp: Removed.
2302         * platform/network/soup/NetworkStorageSessionSoup.cpp: Merge functions
2303         from CookieJarSoup.cpp.
2304         (WebCore::NetworkStorageSession::cookiesEnabled const):
2305         (WebCore::httpOnlyCookieExists):
2306         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
2307         (WebCore::NetworkStorageSession::deleteCookie const):
2308         (WebCore::NetworkStorageSession::deleteAllCookies):
2309         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
2310         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
2311         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
2312         (WebCore::NetworkStorageSession::getRawCookies const):
2313         (WebCore::cookiesForSession):
2314         (WebCore::NetworkStorageSession::cookiesForDOM const):
2315         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
2316
2317 2018-07-30  Chris Dumez  <cdumez@apple.com>
2318
2319         Nullptr crash accessing Document in GenericEventQueue::dispatchOneEvent()
2320         https://bugs.webkit.org/show_bug.cgi?id=187284
2321
2322         Unreviewed, roll r233496 and r233571 now that all known issues have been fixed via
2323         dependency bugs.
2324
2325         Test: media/track/video-track-addition-and-frame-removal.html
2326
2327         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
2328         (WebCore::WebKitMediaKeySession::suspend):
2329         (WebCore::WebKitMediaKeySession::resume):
2330         (WebCore::WebKitMediaKeySession::stop):
2331         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
2332         * Modules/mediasource/MediaSource.cpp:
2333         (WebCore::MediaSource::removeSourceBuffer):
2334         (WebCore::MediaSource::suspend):
2335         (WebCore::MediaSource::resume):
2336         * Modules/mediasource/MediaSource.h:
2337         * Modules/mediasource/SourceBuffer.cpp:
2338         (WebCore::SourceBuffer::suspend):
2339         (WebCore::SourceBuffer::resume):
2340         (WebCore::SourceBuffer::stop):
2341         * Modules/mediasource/SourceBuffer.h:
2342         * Modules/mediasource/SourceBufferList.cpp:
2343         (WebCore::SourceBufferList::SourceBufferList):
2344         (WebCore::SourceBufferList::canSuspendForDocumentSuspension const):
2345         (WebCore::SourceBufferList::suspend):
2346         (WebCore::SourceBufferList::resume):
2347         (WebCore::SourceBufferList::stop):
2348         (WebCore::SourceBufferList::activeDOMObjectName const):
2349         * Modules/mediasource/SourceBufferList.h:
2350         * Modules/mediasource/SourceBufferList.idl:
2351         * dom/Document.h:
2352         (WebCore::Document::hasBrowsingContext const):
2353         * dom/GenericEventQueue.cpp:
2354         (WebCore::GenericEventQueue::dispatchOneEvent):
2355         * html/HTMLMediaElement.cpp:
2356         (WebCore::HTMLMediaElement::prepareForLoad):
2357         (WebCore::HTMLMediaElement::selectMediaResource):
2358         (WebCore::HTMLMediaElement::prepareToPlay):
2359         (WebCore::HTMLMediaElement::playInternal):
2360         (WebCore::HTMLMediaElement::pauseInternal):
2361         (WebCore::HTMLMediaElement::sourceWasAdded):
2362         * html/track/AudioTrackList.cpp:
2363         (AudioTrackList::activeDOMObjectName const):
2364         * html/track/AudioTrackList.h:
2365         * html/track/AudioTrackList.idl:
2366         * html/track/TextTrackList.cpp:
2367         (TextTrackList::activeDOMObjectName const):
2368         * html/track/TextTrackList.h:
2369         * html/track/TextTrackList.idl:
2370         * html/track/TrackListBase.cpp:
2371         (WebCore::TrackListBase::TrackListBase):
2372         (WebCore::TrackListBase::canSuspendForDocumentSuspension const):
2373         (WebCore::TrackListBase::suspend):
2374         (WebCore::TrackListBase::resume):
2375         (WebCore::TrackListBase::stop):
2376         * html/track/TrackListBase.h:
2377         * html/track/VideoTrackList.cpp:
2378         (VideoTrackList::activeDOMObjectName const):
2379         * html/track/VideoTrackList.h:
2380         * html/track/VideoTrackList.idl:
2381
2382 2018-07-30  Chris Dumez  <cdumez@apple.com>
2383
2384         Unreviewed internal build fix after r234347.
2385
2386         * html/StepRange.cpp:
2387         (WebCore::StepRange::StepRange):
2388
2389 2018-07-29  Simon Fraser  <simon.fraser@apple.com>
2390
2391         Shrink GraphicsLayer by making m_transform and m_childrenTransform be unique_ptrs
2392         https://bugs.webkit.org/show_bug.cgi?id=188143
2393
2394         Reviewed by Zalan Bujtas.
2395
2396         m_transform and m_childrenTransform are usually identity; save space by making
2397         these unique_ptrs. The getters still return references by returning a reference
2398         to a NeverDestroyed<TransformationMatrix> if necessary.
2399         
2400         Shrinks GraphicsLayerCA from 840 to 640 bytes.
2401
2402         * platform/graphics/GraphicsLayer.cpp:
2403         (WebCore::identityTransform):
2404         (WebCore::GraphicsLayer::transform const):
2405         (WebCore::GraphicsLayer::setTransform):
2406         (WebCore::GraphicsLayer::childrenTransform const):
2407         (WebCore::GraphicsLayer::setChildrenTransform):
2408         (WebCore::GraphicsLayer::dumpProperties const):
2409         * platform/graphics/GraphicsLayer.h:
2410         (WebCore::GraphicsLayer::hasNonIdentityTransform const):
2411         (WebCore::GraphicsLayer::hasNonIdentityChildrenTransform const):
2412         (WebCore::GraphicsLayer::transform const): Deleted.
2413         (WebCore::GraphicsLayer::setTransform): Deleted.
2414         (WebCore::GraphicsLayer::childrenTransform const): Deleted.
2415         (WebCore::GraphicsLayer::setChildrenTransform): Deleted.
2416         (WebCore::GraphicsLayer::hasFlattenedPerspectiveTransform): Deleted. It was unused.
2417         * platform/graphics/ca/GraphicsLayerCA.cpp:
2418         (WebCore::GraphicsLayerCA::setTransform):
2419         (WebCore::GraphicsLayerCA::setChildrenTransform):
2420         (WebCore::GraphicsLayerCA::layerTransform const):
2421         (WebCore::GraphicsLayerCA::updateTransform):
2422         (WebCore::GraphicsLayerCA::updateChildrenTransform):
2423         (WebCore::GraphicsLayerCA::removeCAAnimationFromLayer):
2424
2425 2018-07-30  Thibault Saunier  <tsaunier@igalia.com>
2426
2427         [GStreamer] Make codecparsers optionnal
2428         https://bugs.webkit.org/show_bug.cgi?id=188010
2429
2430         And avoid building libWebRTC if it won't be used. While there is no other
2431         WebRTC backend, it makes no sense to expose an option.
2432
2433         Error out when WEBRTC or MEDIA_STREAM is enabled but GStreamer < 1.10
2434
2435         Reviewed by Alejandro G. Castro.
2436
2437         * platform/GStreamer.cmake:
2438
2439 2018-07-28  Darin Adler  <darin@apple.com>
2440
2441         [Cocoa] Update more WebCore Objective-C code to be ARC compatible
2442         https://bugs.webkit.org/show_bug.cgi?id=188140
2443
2444         Reviewed by Sam Weinig.
2445
2446         This make sure we don't put any Objective-C objects into HashMap/Set
2447         data structures, which doesn't work under ARC at this time. We could
2448         fix that some day, but it's pretty simple to change code not to rely
2449         on it, for now, and not as simple to support it in HashMap/Set.
2450
2451         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
2452         (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
2453         Use CFRetain/CFAutorelease instead of retain/autorelease.
2454
2455         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2456         (createAccessibilityRoleMap): Use CFStringRef in a HashMap rather than
2457         NSString * for string constants.
2458         (roleValueToNSString): Updated for above change.
2459
2460         * bridge/objc/WebScriptObject.mm:
2461         (-[WebScriptObject stringRepresentation]): Updated since objectValue
2462         is now CFTypeRef rather than NSObject *.
2463
2464         * bridge/objc/objc_instance.mm:
2465         (ObjcInstance::create): Use CFTypeRef instead of id for the key types
2466         in a HashMap.
2467         (ObjcInstance::~ObjcInstance): Updated for the above change.
2468         (ObjcInstance::invokeObjcMethod): Updated since objectValue is now
2469         CFTypeRef.
2470         (ObjcInstance::invokeDefaultMethod): Ditto.
2471         (ObjcInstance::setValueOfUndefinedField): Ditto.
2472         * bridge/objc/objc_runtime.mm:
2473         (JSC::Bindings::ObjcArray::setValueAt const): Ditto.
2474
2475         * bridge/objc/objc_utility.h: Use #pragma once. Use CFTypeRef instead
2476         of NSObject * for objectValue, since it's in a union and ARC does not
2477         support strong Objective-C object pointers in a union.
2478
2479         * bridge/objc/objc_utility.mm:
2480         (JSC::Bindings::convertValueToObjcValue): Updated since objectValue is
2481         now CFTypeRef.
2482
2483         * editing/cocoa/HTMLConverter.mm:
2484         (HTMLConverter::_processElement): Use CFTypeRef rather than NSTextTable
2485         for a HashMap.
2486         (HTMLConverter::_exitElement): Ditto.
2487
2488         * editing/cocoa/WebContentReaderCocoa.mm:
2489         (WebCore::attributesForAttributedStringConversion): Use CFRetain rather
2490         than -[NSObject retain] in a workaround for an overrelease.
2491
2492         * editing/mac/DictionaryLookup.h: Removed code to make this usable from
2493         non-Objective-C source files. Use tuples rather than out arguments
2494         for the results of the various functions.
2495
2496         * editing/mac/DictionaryLookup.mm:
2497         (WebCore::DictionaryLookup::rangeForSelection): Return a tuple rather
2498         than using an out argument for options.
2499         (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto.
2500         (WebCore::DictionaryLookup::stringForPDFSelection): Ditto.
2501         (WebCore::showPopupOrCreateAnimationController): Removed use of typedef
2502         PlatformAnimationController.
2503         (WebCore::DictionaryLookup::animationControllerForPopup): Ditto.
2504
2505         * html/HTMLMediaElement.h: Put the videoFullscreenLayer function inside
2506         an __OBJC__ ifdef since we can't do the type conversion without the
2507         full Objective-C type.
2508
2509         * page/mac/EventHandlerMac.mm:
2510         (WebCore::selfRetainingNSScrollViewScrollWheel): Use CFRetain/CFRelease
2511         instead of retain/release.
2512         (WebCore::EventHandler::selectClosestWordFromHitTestResultBasedOnLookup):
2513         Updated to use tuple return value from DictionaryLookup.
2514
2515         * page/scrolling/ScrollingStateNode.h: Replaced direct use of PlatformLayer*
2516         in a union with use of a "typless" void* pointer and added helper functions
2517         to convert in both directions.
2518         * page/scrolling/cocoa/ScrollingStateNode.mm:
2519         (WebCore::LayerRepresentation::retainPlatformLayer): Use CFRetain instead
2520         of retain.
2521         (WebCore::LayerRepresentation::releasePlatformLayer): Use CFRelease instead
2522         of release.
2523         (WebCore::LayerRepresentation::makePlatformLayerTyped): Added.
2524         (WebCore::LayerRepresentation::makePlatformLayerTypeless): Ditto.
2525         * page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp:
2526         (WebCore::LayerRepresentation::retainPlatformLayer): Updated argument type.
2527         (WebCore::LayerRepresentation::releasePlatformLayer): Ditto.
2528         (WebCore::LayerRepresentation::makePlatformLayerTyped): Added.
2529         (WebCore::LayerRepresentation::makePlatformLayerTypeless): Ditto.
2530
2531         * platform/gamepad/cocoa/GameControllerGamepadProvider.h: Use CFTypeRef
2532         instad of GCController * for key type of HashMap.
2533         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
2534         (WebCore::GameControllerGamepadProvider::controllerDidConnect): Updated
2535         for the above change.
2536         (WebCore::GameControllerGamepadProvider::controllerDidDisconnect): Ditto.
2537
2538         * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
2539         Use SOFT_LINK_CONSTANT_MAY_FAIL instead of SOFT_LINK_POINTER_OPTIONAL for
2540         strings, since SOFT_LINK_POINTER_OPTIONAL does not work for Objective-C
2541         types under ARC.
2542         (WebCore::AVTrackPrivateAVFObjCImpl::audioKind const): Added checks
2543         for the constants.
2544         (WebCore::AVTrackPrivateAVFObjCImpl::videoKind const): Ditto.
2545         (WebCore::AVTrackPrivateAVFObjCImpl::label const): Ditto.
2546
2547         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h:
2548         Use #pragma once and use CFTypeRef instead of AVMediaSelectionOption *
2549         in the key to a HashMap.
2550         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm:
2551         (WebCore::MediaSelectionGroupAVFObjC::updateOptions): Updated for
2552         the above change.
2553
2554         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
2555         Use SOFT_LINK_CONSTANT_MAY_FAIL instead of SOFT_LINK_POINTER_OPTIONAL for
2556         strings, since SOFT_LINK_POINTER_OPTIONAL does not work for Objective-C
2557         types under ARC.
2558         (WebCore::customSchemeURL): Removed unnecessary use of
2559         NeverDestroyed<RetainPtr>. Can just use a straight pointer without calling
2560         release, and that works with or without ARC.
2561         (WebCore::imageDecoderAssetOptions): Ditto. Here, had to add a retain,
2562         which we'll remove when we turn on ARC. Added canLoad checks, needed
2563         because of SOFT_LINK_CONSTANT_MAY_FAIL.
2564         (WebCore::ImageDecoderAVFObjC::firstEnabledTrack): Added canLoad check,
2565         needed because of SOFT_LINK_CONSTANT_MAY_FAIL.
2566
2567         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2568         Use CFTypeRef instead of AVAssetResourceLoadingRequest in HashMap.
2569         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2570         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
2571         Updated for above.
2572         (WebCore::MediaPlayerPrivateAVFoundationObjC::didCancelLoadingRequest): Ditto.
2573         (WebCore::MediaPlayerPrivateAVFoundationObjC::didStopLoadingRequest): Ditto.
2574
2575         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2576         Use CFTypeRef instead of AVSampleBufferAudioRenderer in HashMap.
2577         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2578         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVolume): Updated for above.
2579         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setMuted): Ditto.
2580         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPreservesPitch): Ditto.
2581         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableAudioSample): Ditto.
2582         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addAudioRenderer): Ditto.
2583         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeAudioRenderer): Ditto.
2584
2585         * platform/graphics/metal/GPUDrawableMetal.mm: Updated include; under ARC, it's
2586         not safe to call a method on a class without seeing its interface.
2587
2588         * platform/mac/VideoFullscreenInterfaceMac.mm: Added an explicit
2589         __unsafe_unretained for a delegate. Could consider moving to weak, but for now
2590         this preserves the current behavior and compiles under ARC.
2591
2592         * platform/mac/WebCoreFullScreenPlaceholderView.h: Use strong for the contents,
2593         weak for the target, and changed the action to be hard-coded instead of an
2594         arbitrary selector. If we find we need the flexibility again later, we can do
2595         it with a block, which is more ARC-friendly than calling an arbitrary selector.
2596         * platform/mac/WebCoreFullScreenPlaceholderView.mm:
2597         (-[WebCoreFullScreenPlaceholderView initWithFrame:]): Call function directly
2598         instead of taking advantage of "using".
2599         (-[WebCoreFullScreenPlaceholderView mouseDown:]): Call cancelOperation: on the
2600         target rather than performing an arbitrary selector.
2601
2602         * platform/mac/WebCoreObjCExtras.mm:
2603         (WebCoreObjCScheduleDeallocateOnMainThread): Use sel_registerName instead of
2604         @selector, since @selector is not supported under ARC.
2605
2606         * platform/network/ResourceHandle.h: Use a return value rather than using an
2607         inout argument in applySniffingPoliciesAndStoragePartitionIfNeeded.
2608
2609         * platform/network/cocoa/CookieStorageObserver.mm:
2610         (WebCore::CookieStorageObserver::startObserving): Removed unnecessary
2611         assertion of repondsToSelector since we are about to dispatch it immediately
2612         after. Call the selector in the conventional way instead of using performSelector.
2613
2614         * platform/network/cocoa/WebCoreNSURLSession.h: Use #pragma once and use
2615         CFTypeRef instead of an Objective-C type. Also use an explicit __unsafe_unretained
2616         for the session in the data task.
2617         * platform/network/cocoa/WebCoreNSURLSession.mm:
2618         (-[WebCoreNSURLSession dealloc]): Updated for the above.
2619         (-[WebCoreNSURLSession taskCompleted:]): Ditto.
2620         (-[WebCoreNSURLSession invalidateAndCancel]): Ditto.
2621         (-[WebCoreNSURLSession getTasksWithCompletionHandler:]): Ditto.
2622         (-[WebCoreNSURLSession getAllTasksWithCompletionHandler:]): Ditto.
2623         (-[WebCoreNSURLSession dataTaskWithRequest:]): Ditto.
2624         (-[WebCoreNSURLSession dataTaskWithURL:]): Ditto.
2625
2626         * platform/network/mac/ResourceHandleMac.mm:
2627         (WebCore::ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded):
2628         Use a return value instead of an inout argument. Also use bridging casts.
2629         (WebCore::ResourceHandle::createNSURLConnection): Updated for the change above.
2630         Also use a bridging cast.
2631         (WebCore::ResourceHandle::schedule): Use a bridging cast.
2632         (WebCore::ResourceHandle::unschedule): Ditto.
2633
2634         * platform/network/mac/WebCoreURLResponse.mm:
2635         (WebCore::adjustMIMETypeIfNecessary): Use a bridging cast.
2636
2637         * testing/Internals.cpp:
2638         (WebCore::Internals::rangeForDictionaryLookupAtLocation): Moved the macOS
2639         version of this function out of this file ...
2640         * testing/Internals.mm:
2641         (WebCore::Internals::rangeForDictionaryLookupAtLocation): ... to here.
2642
2643 2018-07-29  Yusuke Suzuki  <utatane.tea@gmail.com>
2644
2645         Use static global variables instead of static NeverDestroyed inside function if possible
2646         https://bugs.webkit.org/show_bug.cgi?id=188146
2647
2648         Reviewed by Darin Adler.
2649
2650         This patch leverages constexpr constructors / trivial destructors more to remove unnecessary `static NeverDestroyed`
2651         inside a function. It simplifies the code, removes the unnecessary function, and ensures the initialization at
2652         a program loader phase.
2653
2654         We make StepRange::StepDescription constructor constexpr to remove bunch of `static NeverDestroyed<const StepRange::StepDescription>`.
2655         And we use `static Lock` since WTF::Lock has constexpr constructor.
2656
2657         No behavior change.
2658
2659         * dom/MessagePort.cpp:
2660         (WebCore::MessagePort::deref const):
2661         (WebCore::MessagePort::isExistingMessagePortLocallyReachable):
2662         (WebCore::MessagePort::notifyMessageAvailable):
2663         (WebCore::MessagePort::MessagePort):
2664         (WebCore::MessagePort::~MessagePort):
2665         (WebCore::allMessagePortsLock): Deleted.
2666         * dom/ScriptExecutionContext.cpp:
2667         (WebCore::ScriptExecutionContext::contextIdentifier const):
2668         (WebCore::ScriptExecutionContext::removeFromContextsMap):
2669         (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
2670         (WebCore::ScriptExecutionContext::postTaskTo):
2671         (WebCore::allScriptExecutionContextsMapLock): Deleted.
2672         * html/DateInputType.cpp:
2673         (WebCore::DateInputType::createStepRange const):
2674         * html/DateTimeInputType.cpp:
2675         (WebCore::DateTimeInputType::createStepRange const):
2676         * html/DateTimeLocalInputType.cpp:
2677         (WebCore::DateTimeLocalInputType::createStepRange const):
2678         * html/MonthInputType.cpp:
2679         (WebCore::MonthInputType::createStepRange const):
2680         * html/RangeInputType.cpp:
2681         (WebCore::RangeInputType::createStepRange const):
2682         * html/StepRange.h:
2683         (WebCore::StepRange::StepDescription::StepDescription):
2684         * html/TimeInputType.cpp:
2685         (WebCore::TimeInputType::createStepRange const):
2686         * html/WeekInputType.cpp:
2687         (WebCore::WeekInputType::createStepRange const):
2688         * page/SecurityPolicy.cpp:
2689         (WebCore::originAccessMap):
2690         (WebCore::SecurityPolicy::isAccessWhiteListed):
2691         (WebCore::SecurityPolicy::addOriginAccessWhitelistEntry):
2692         (WebCore::SecurityPolicy::removeOriginAccessWhitelistEntry):
2693         (WebCore::SecurityPolicy::resetOriginAccessWhitelists):
2694         (WebCore::originAccessMapLock): Deleted.
2695         * platform/SchemeRegistry.cpp:
2696         (WebCore::allBuiltinSchemes):
2697         (WebCore::builtinLocalURLSchemes):
2698         (WebCore::localURLSchemes):
2699         (WebCore::displayIsolatedURLSchemes):
2700         (WebCore::builtinSecureSchemes):
2701         (WebCore::secureSchemes):
2702         (WebCore::builtinSchemesWithUniqueOrigins):
2703         (WebCore::schemesWithUniqueOrigins):
2704         (WebCore::builtinCanDisplayOnlyIfCanRequestSchemes):
2705         (WebCore::canDisplayOnlyIfCanRequestSchemes):
2706         (WebCore::SchemeRegistry::registerURLSchemeAsLocal):
2707         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsLocal):
2708         (WebCore::ContentSecurityPolicyBypassingSchemes):
2709         (WebCore::cachePartitioningSchemes):
2710         (WebCore::serviceWorkerSchemes):
2711         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal):
2712         (WebCore::SchemeRegistry::registerURLSchemeAsNoAccess):
2713         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsNoAccess):
2714         (WebCore::SchemeRegistry::registerURLSchemeAsDisplayIsolated):
2715         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated):
2716         (WebCore::SchemeRegistry::registerURLSchemeAsSecure):
2717         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsSecure):
2718         (WebCore::SchemeRegistry::canDisplayOnlyIfCanRequest):
2719         (WebCore::SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest):
2720         (WebCore::SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy):
2721         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy):
2722         (WebCore::SchemeRegistry::schemeShouldBypassContentSecurityPolicy):
2723         (WebCore::SchemeRegistry::registerURLSchemeAsCachePartitioned):
2724         (WebCore::SchemeRegistry::shouldPartitionCacheForURLScheme):
2725         (WebCore::SchemeRegistry::registerURLSchemeServiceWorkersCanHandle):
2726         (WebCore::SchemeRegistry::canServiceWorkersHandleURLScheme):
2727         (WebCore::SchemeRegistry::isServiceWorkerContainerCustomScheme):
2728         (WebCore::schemeRegistryLock): Deleted.
2729
2730 2018-07-29  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2731
2732         [Curl] Fix the bug when client reject the redirect on WebKitLegacy.
2733         https://bugs.webkit.org/show_bug.cgi?id=188130
2734
2735         Reviewed by Darin Adler.
2736
2737         ResourceHandle for Curl port has a bug when a client returns en empty request which
2738         indicates the redirecti is rejected by the client. It should be quit the task immediately,
2739         but it kept doing the job. Fixed.
2740         NetworkDataTask implementation did the right thing and there's no bug for them. 
2741
2742         Test: http/tests/xmlhttprequest/xmlhttprequest-unsafe-redirect-expected.txt
2743
2744         * platform/network/curl/ResourceHandleCurl.cpp:
2745         (WebCore::ResourceHandle::continueAfterWillSendRequest):
2746
2747 2018-07-28  Simon Fraser  <simon.fraser@apple.com>
2748
2749         Reset CompositingPolicyOverride between tests
2750         https://bugs.webkit.org/show_bug.cgi?id=188138
2751
2752         Reviewed by Zalan Bujtas.
2753
2754         WK1 tests were failing after r234330 because the compositing policy override optional
2755         was left set on the Page (WK1 has injected bundle SPI to clear it). Fix by having 
2756         Internals::resetToConsistentState clear this state.
2757
2758         * testing/Internals.cpp:
2759         (WebCore::Internals::resetToConsistentState):
2760
2761 2018-07-24  Simon Fraser  <simon.fraser@apple.com>
2762
2763         Animation stops with object-fit:contain on an animated 2d canvas
2764         https://bugs.webkit.org/show_bug.cgi?id=187840
2765
2766         Reviewed by Zalan Bujtas.
2767         
2768         If a canvas has object-fit: cover or contain, repaints need to mapped through
2769         the rect that is used to position the canvas in the element bounds, which is replacedContentRect().
2770         
2771         Add a version of replacedContentRect() that doesn't require passing the intrinsicSize() since
2772         all but RenderVideo just pass the RenderReplaced's intrinsicSize.
2773
2774         Test: fast/repaint/canvas-object-fit.html
2775
2776         * html/HTMLCanvasElement.cpp:
2777         (WebCore::HTMLCanvasElement::didDraw):
2778         * rendering/RenderHTMLCanvas.cpp:
2779         (WebCore::RenderHTMLCanvas::paintReplaced):
2780         * rendering/RenderImage.cpp:
2781         (WebCore::RenderImage::updateInnerContentRect):
2782         (WebCore::RenderImage::paintReplaced):
2783         * rendering/RenderLayerBacking.cpp:
2784         (WebCore::RenderLayerBacking::contentsBox const):
2785         * rendering/RenderReplaced.h:
2786         (WebCore::RenderReplaced::replacedContentRect const):
2787         * rendering/shapes/ShapeOutsideInfo.cpp:
2788         (WebCore::ShapeOutsideInfo::createShapeForImage const):
2789
2790 2018-07-27  Simon Fraser  <simon.fraser@apple.com>
2791
2792         Adjust the color matrix for the inverse apple-invert-lightness() transformation
2793         https://bugs.webkit.org/show_bug.cgi?id=188131
2794         rdar://problem/42673070
2795
2796         Reviewed by Zalan Bujtas.
2797
2798         Use the correct inverse matrix values.
2799
2800         Test: editing/style/inverse-color-filter.html
2801
2802         * platform/graphics/filters/FilterOperation.cpp:
2803         (WebCore::InvertLightnessFilterOperation::inverseTransformColor const):
2804
2805 2018-07-27  Eric Carlson  <eric.carlson@apple.com>
2806
2807         [iOS] Don't deactivate audio session
2808         https://bugs.webkit.org/show_bug.cgi?id=188127
2809         <rdar://problem/42544143>
2810
2811         Reviewed by Jon Lee.
2812         
2813         r233435 includes a change that deactivates the shared audio session when there are no more
2814         active media sessions. This is a good in WK2 because it allows other applications to resume
2815         playing audio when WebKit stops playing, but it is potentially bad in WK1 where the host
2816         app may also be playing audio.
2817
2818         * platform/audio/PlatformMediaSessionManager.cpp:
2819         (WebCore::PlatformMediaSessionManager::removeSession): Don't deactivate the audio session.
2820
2821 2018-07-27  Chris Dumez  <cdumez@apple.com>
2822
2823         Fix thread-safety issues related to RealtimeMediaSource::audioSamplesAvailable()
2824         https://bugs.webkit.org/show_bug.cgi?id=188097
2825         <rdar://problem/42558823>
2826
2827         Reviewed by Eric Carlson.
2828
2829         Fix thread-safety issues related to RealtimeMediaSource::audioSamplesAvailable(). RealtimeMediaSource::audioSamplesAvailable()
2830         is called on a background thread but iterates over observers that may get destroyed concurrently on the main thread.
2831
2832         To address the issue:
2833         - Introduce a Lock to protect m_observer accesses
2834         - Copy observers to a Vector before iterating over them
2835
2836         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2837         (WebCore::MediaStreamTrackPrivate::forEachObserver const):
2838         (WebCore::MediaStreamTrackPrivate::addObserver):
2839         (WebCore::MediaStreamTrackPrivate::removeObserver):
2840         (WebCore::MediaStreamTrackPrivate::setEnabled):
2841         (WebCore::MediaStreamTrackPrivate::endTrack):
2842         (WebCore::MediaStreamTrackPrivate::sourceStarted):
2843         (WebCore::MediaStreamTrackPrivate::sourceStopped):
2844         (WebCore::MediaStreamTrackPrivate::sourceMutedChanged):
2845         (WebCore::MediaStreamTrackPrivate::sourceSettingsChanged):
2846         (WebCore::MediaStreamTrackPrivate::videoSampleAvailable):
2847         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
2848         (WebCore::MediaStreamTrackPrivate::updateReadyState):
2849         * platform/mediastream/MediaStreamTrackPrivate.h:
2850         (WebCore::MediaStreamTrackPrivate::Observer::sampleBufferUpdated):
2851         (WebCore::MediaStreamTrackPrivate::Observer::audioSamplesAvailable):
2852         * platform/mediastream/RealtimeMediaSource.cpp:
2853         (WebCore::RealtimeMediaSource::addObserver):
2854         (WebCore::RealtimeMediaSource::removeObserver):
2855         (WebCore::RealtimeMediaSource::forEachObserver const):
2856         (WebCore::RealtimeMediaSource::notifyMutedObservers const):
2857         (WebCore::RealtimeMediaSource::settingsDidChange):
2858         (WebCore::RealtimeMediaSource::videoSampleAvailable):
2859         (WebCore::RealtimeMediaSource::audioSamplesAvailable):
2860         (WebCore::RealtimeMediaSource::start):
2861         (WebCore::RealtimeMediaSource::requestStop):
2862         (WebCore::RealtimeMediaSource::captureFailed):
2863         * platform/mediastream/RealtimeMediaSource.h:
2864         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
2865         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
2866         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp:
2867         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
2868
2869 2018-07-27  Alex Christensen  <achristensen@webkit.org>
2870
2871         Don't include WebPageProxy.h just for UndoOrRedo
2872         https://bugs.webkit.org/show_bug.cgi?id=188086
2873
2874         Reviewed by Saam Barati.
2875
2876         * platform/DragItem.h:
2877
2878 2018-07-27  Alex Christensen  <achristensen@webkit.org>
2879
2880         Make CompletionHandler more const correct
2881         https://bugs.webkit.org/show_bug.cgi?id=186543
2882
2883         Reviewed by Saam Barati.
2884
2885         * dom/messageports/MessagePortChannel.cpp:
2886         (WebCore::MessagePortChannel::checkRemotePortForActivity):
2887         * dom/messageports/MessagePortChannelProviderImpl.cpp:
2888         (WebCore::MessagePortChannelProviderImpl::checkRemotePortForActivity):
2889         * loader/DocumentLoader.cpp:
2890         (WebCore::DocumentLoader::responseReceived):
2891         * loader/FrameLoader.cpp:
2892         (WebCore::FrameLoader::loadURL):
2893         (WebCore::FrameLoader::loadWithDocumentLoader):
2894         (WebCore::FrameLoader::loadPostRequest):
2895         * platform/network/cocoa/WebCoreNSURLSession.mm:
2896         (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived):
2897         * workers/service/server/RegistrationDatabase.cpp:
2898         (WebCore::RegistrationDatabase::pushChanges):
2899         (WebCore::RegistrationDatabase::clearAll):
2900         * workers/service/server/SWServer.cpp:
2901         (WebCore::SWServer::matchAll):
2902         * workers/service/server/SWServer.h:
2903         * workers/service/server/SWServerWorker.cpp:
2904         (WebCore::SWServerWorker::matchAll):
2905         * workers/service/server/SWServerWorker.h:
2906
2907 2018-07-27  Simon Fraser  <simon.fraser@apple.com>
2908
2909         Be more conservative with compositing layer creation when memory is low
2910         https://bugs.webkit.org/show_bug.cgi?id=187866
2911         rdar://problem/42366345
2912
2913         Reviewed by Zalan Bujtas.
2914         
2915         When process physical footprint is above a fraction of the jetsam limit, be more conservative in making
2916         compositing layers. We avoid compositing for these situations:
2917         1. Layers with 3D transforms which are affine (like translateZ(0)).
2918         2. Layers with will-change
2919         3. Layers for canvases (other than WebGL/WebGPU)
2920         
2921         We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS,
2922         falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%.
2923         Compositing chooses to be more conservative in either "conservative" or "strict" memory modes.
2924         
2925         Plumb through a "compositingPolicyOverride" both so that on-device testing isn't
2926         flakily falling into a different mode, and so that we can impose the conservative
2927         mode for testing.
2928
2929         Test: compositing/layer-creation/compositing-policy.html
2930
2931         * page/Page.h:
2932         (WebCore::Page::compositingPolicyOverride const):
2933         (WebCore::Page::setCompositingPolicyOverride):
2934         * platform/graphics/transforms/Matrix3DTransformOperation.cpp:
2935         (WebCore::Matrix3DTransformOperation::isRepresentableIn2D const):
2936         * platform/graphics/transforms/Matrix3DTransformOperation.h:
2937         * platform/graphics/transforms/PerspectiveTransformOperation.h:
2938         * platform/graphics/transforms/RotateTransformOperation.h:
2939         * platform/graphics/transforms/ScaleTransformOperation.h:
2940         * platform/graphics/transforms/TransformOperation.h:
2941         (WebCore::TransformOperation::isRepresentableIn2D const):
2942         * platform/graphics/transforms/TransformOperations.h:
2943         (WebCore::TransformOperations::has3DOperation const):
2944         (WebCore::TransformOperations::isRepresentableIn2D const):
2945         * platform/graphics/transforms/TranslateTransformOperation.h:
2946         * rendering/RenderLayerBacking.cpp:
2947         (WebCore::RenderLayerBacking::updateGeometry):
2948         * rendering/RenderLayerCompositor.cpp:
2949         (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
2950         (WebCore::RenderLayerCompositor::updateCompositingPolicy):
2951         (WebCore::RenderLayerCompositor::updateCompositingLayers):
2952         (WebCore::RenderLayerCompositor::requiresCompositingForTransform const):
2953         (WebCore::RenderLayerCompositor::requiresCompositingForVideo const):
2954         (WebCore::RenderLayerCompositor::requiresCompositingForCanvas const):
2955         (WebCore::RenderLayerCompositor::requiresCompositingForPlugin const):
2956         (WebCore::RenderLayerCompositor::requiresCompositingForWillChange const):
2957         (WebCore::RenderLayerCompositor::needsFixedRootBackgroundLayer const):
2958         (WebCore::operator<<):
2959         * rendering/RenderLayerCompositor.h:
2960         * testing/Internals.cpp:
2961         (WebCore::Internals::setCompositingPolicyOverride):
2962         (WebCore::Internals::compositingPolicyOverride const):
2963         * testing/Internals.h:
2964         * testing/Internals.idl:
2965
2966 2018-07-27  Zalan Bujtas  <zalan@apple.com>
2967
2968         [WK1] ASSERTION FAILED: renderer().repaintLayoutRects().m_repaintRect == renderer().clippedOverflowRectForRepaint(renderer().containerForRepaint()) in WebCore::RenderLayer::updateLayerPositionsAfterScroll
2969         https://bugs.webkit.org/show_bug.cgi?id=188122
2970         <rdar://problem/42584790>
2971
2972         Reviewed by Simon Fraser.
2973
2974         When ScrollView's m_paintsEntireContents flag flips due to layer backing changes, the repaint area transitions from
2975         visual to layout overflow. When this happens the cached repaint rects become invalid and they need to be recomputed.
2976         Currently there's no mechanism to trigger repaint cache invalidation from ScrollView.
2977         Skip assertion for now on WK1 (see webkit.org/b/188121)
2978
2979         * rendering/RenderLayer.cpp:
2980         (WebCore::RenderLayer::updateLayerPositionsAfterScroll):
2981
2982 2018-07-27  Myles C. Maxfield  <mmaxfield@apple.com>
2983
2984         [WIN] Crash when trying to access store pages
2985         https://bugs.webkit.org/show_bug.cgi?id=188032
2986         <rdar://problem/42467016>
2987
2988         Reviewed by Brent Fulgham.
2989
2990         The Windows implementation of GlyphBuffer has an additional member, m_offsets, which represents
2991         an additional offset to the position to paint each glyph. It also has two add() functions, one
2992         which appends to this vector, and one which doesn't. The one that doesn't append to the vector
2993         should never be called on Windows (because Windows requires this vector to be full).
2994
2995         There were two situations where it was getting called:
2996         1) Inside ComplexTextController
2997         2) Inside display list playback
2998
2999         Windows shouldn't be using ComplexTextController because the Windows implementation of this 
3000         class isn't ready yet; instead it should be using UniscribeController. The display list playback
3001         code should be used on Windows.
3002
3003         Rather than fix the function to append an offset, we actually don't need the m_offsets vector
3004         in the first place. Instead, we can do it the same way that the Cocoa ports do it, which is to
3005         bake the offsets into the glyph advances. This is possible because the GlyphBuffer doesn't need
3006         to distinguish between layout advances and paint advances, so we can bake them together and
3007         just put paint advances in the GlyphBuffer. This should be a small (probably within-the-noise)
3008         performance and memory improvement.
3009
3010         * platform/graphics/ComplexTextController.cpp:
3011         (WebCore::ComplexTextController::ComplexTextController): Make sure that ComplexTextController
3012         isn't used on Windows.
3013         * platform/graphics/FontCascade.cpp:
3014         (WebCore::FontCascade::widthOfTextRange const): Switch from ComplexTextController to
3015         UniscribeController on Windows.
3016         (WebCore::FontCascade::drawGlyphBuffer const): After deleting the m_offsets vector, there's
3017         no reason to consult it when drawing.
3018         * platform/graphics/GlyphBuffer.h: Remove m_offsets
3019         (WebCore::GlyphBuffer::clear):
3020         (WebCore::GlyphBuffer::advanceAt const):
3021         (WebCore::GlyphBuffer::add):
3022         (WebCore::GlyphBuffer::expandLastAdvance):
3023         (WebCore::GlyphBuffer::shrink):
3024         (WebCore::GlyphBuffer::swap):
3025         (WebCore::GlyphBuffer::offsetAt const): Deleted.
3026         * platform/graphics/win/FontCGWin.cpp:
3027         (WebCore::FontCascade::drawGlyphs): After deleting the m_offsets vector, there's no reason
3028         to consult it when drawing.
3029         * platform/graphics/win/FontCascadeDirect2D.cpp:
3030         (WebCore::FontCascade::drawGlyphs): Ditto.
3031         * platform/graphics/win/UniscribeController.cpp:
3032         (WebCore::UniscribeController::shapeAndPlaceItem): Bake in the offsets into the glyph advances.
3033
3034 2018-07-27  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3035
3036         [Curl] Crash on synchronous request via ResourceHandle.
3037         https://bugs.webkit.org/show_bug.cgi?id=188033
3038
3039         Reviewed by Alex Christensen.
3040
3041         The timing of instantiation of delegate was wrong. Move it inside `delegate` getter().
3042         This bug was introduced at r228577.
3043
3044         Test: http/tests/xmlhttprequest/simple-sync.html
3045
3046         * platform/network/curl/ResourceHandleCurl.cpp:
3047         (WebCore::ResourceHandle::start):
3048         (WebCore::ResourceHandle::delegate):
3049
3050 2018-07-03  David Fenton  <david_fenton@apple.com>
3051
3052         Unreviewed, rolling out r233461.
3053
3054         assertions triggered on ios11 Debug wk2
3055
3056         Reverted changeset:
3057
3058         "[iOS] Add assert to catch improper use of WebCore::Timer in
3059         UI Process"
3060         https://bugs.webkit.org/show_bug.cgi?id=185330
3061         https://trac.webkit.org/changeset/233461
3062
3063 2018-07-27  Chris Dumez  <cdumez@apple.com>
3064
3065         [Media] Avoid unnecessarily constructing *TrackList objects
3066         https://bugs.webkit.org/show_bug.cgi?id=188094
3067
3068         Reviewed by Eric Carlson.
3069
3070         Avoid unnecessarily constructing *TrackList objects as this is preventing us from making them
3071         ActiveDOMObjects.
3072
3073         * Modules/mediasource/MediaSource.cpp:
3074         (WebCore::MediaSource::removeSourceBuffer):
3075         * Modules/mediasource/SourceBuffer.cpp:
3076         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment):
3077         * html/HTMLMediaElement.cpp:
3078         (WebCore::HTMLMediaElement::addAudioTrack):
3079         (WebCore::HTMLMediaElement::addTextTrack):
3080         (WebCore::HTMLMediaElement::addVideoTrack):
3081         (WebCore::HTMLMediaElement::ensureAudioTracks):
3082         (WebCore::HTMLMediaElement::ensureTextTracks):
3083         (WebCore::HTMLMediaElement::ensureVideoTracks):
3084         (WebCore::HTMLMediaElement::setSelectedTextTrack):
3085         (WebCore::HTMLMediaElement::audioTracks): Deleted.
3086         (WebCore::HTMLMediaElement::textTracks): Deleted.
3087         (WebCore::HTMLMediaElement::videoTracks): Deleted.
3088         * html/HTMLMediaElement.h:
3089         (WebCore::HTMLMediaElement::audioTracks const):
3090         (WebCore::HTMLMediaElement::textTracks const):
3091         (WebCore::HTMLMediaElement::videoTracks const):
3092         * html/HTMLMediaElement.idl:
3093         * html/shadow/MediaControlElements.cpp:
3094         (WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay):
3095         (WebCore::MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu):
3096         (WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
3097         * html/track/TextTrack.cpp:
3098         (WebCore::TextTrack::setKind):
3099         (WebCore::TextTrack::trackIndex):
3100         (WebCore::TextTrack::trackIndexRelativeToRenderedTracks):
3101         (WebCore::TextTrack::setLanguage):
3102         * html/track/VideoTrack.cpp:
3103         (WebCore::VideoTrack::setKind):
3104         (WebCore::VideoTrack::setLanguage):
3105         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
3106         (WebCore::PlaybackSessionModelMediaElement::setMediaElement):
3107         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionOptions):
3108
3109 2018-07-27  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3110
3111         [Curl] Set correct source info to ResourceResponse.
3112         https://bugs.webkit.org/show_bug.cgi?id=188069
3113
3114         Reviewed by Fujii Hironori.
3115
3116         ResourceResponseBase::Source::Network must be set by each ports. Curl port
3117         didn't set this.
3118
3119         Test: http/tests/cache/disk-cache/disk-cache-302-status-code.html
3120
3121         * platform/network/curl/ResourceResponseCurl.cpp:
3122         (WebCore::ResourceResponse::ResourceResponse):
3123
3124 2018-07-26  Andy VanWagoner  <andy@vanwagoner.family>
3125
3126         [INTL] Remove INTL sub-feature compile flags
3127         https://bugs.webkit.org/show_bug.cgi?id=188081
3128
3129         Reviewed by Michael Catanzaro.
3130
3131         Compile time feature flags for INTL sub features were removed, and are covered by existing tests.
3132
3133         * Configurations/FeatureDefines.xcconfig:
3134
3135 2018-07-26  Zalan Bujtas  <zalan@apple.com>
3136
3137         [Fullscreen] Do not create composited layers for renderers unless they are part of the fullscreen subtree.
3138         https://bugs.webkit.org/show_bug.cgi?id=188087
3139         <rdar://problem/42632124>
3140
3141         Reviewed by Simon Fraser.
3142
3143         Sibling composited layers prevent battery lifetime optimizations when in fullscreen.
3144
3145         Test: compositing/no-compositing-when-fulll-screen-is-present.html
3146
3147         * rendering/RenderLayer.cpp:
3148         (WebCore::RenderLayer::isDescendantOf const):
3149         * rendering/RenderLayer.h:
3150         * rendering/RenderLayerCompositor.cpp:
3151         (WebCore::isDescendantOfFullScreenLayer):
3152         (WebCore::RenderLayerCompositor::requiresCompositingForWillChange const):
3153         (WebCore::RenderLayerCompositor::requiresCompositingForPosition const):
3154
3155 2018-07-26  Ryan Haddad  <ryanhaddad@apple.com>
3156
3157         Unreviewed, rolling out r234281.
3158
3159         Broke internal builds.
3160
3161         Reverted changeset:
3162
3163         "[Datalist] Add button to TextFieldInputs with a datalist"
3164         https://bugs.webkit.org/show_bug.cgi?id=187741
3165         https://trac.webkit.org/changeset/234281
3166
3167 2018-07-26  Aditya Keerthi  <akeerthi@apple.com>
3168
3169         [Datalist] Add button to TextFieldInputs with a datalist
3170         https://bugs.webkit.org/show_bug.cgi?id=187741
3171
3172         Reviewed by Tim Horton.
3173
3174         TextFieldInputs that have an associated datalist element should be drawn as
3175         combo boxes. However, we cannot use NSComboBox for this control, as NSComboBox
3176         is not height-resizable. Furthermore, the input should also be able to contain
3177         additional elements, such as the stepper for type=number and the cancel button
3178         for type=search. For these reasons, we draw a button at the end of the input,
3179         mimicking appearance of a combo box.
3180
3181         The list-button -webkit-appearance value was added to display the new button.
3182
3183         Tests: fast/forms/datalist/datalist-searchinput-appearance.html
3184                fast/forms/datalist/datalist-textinput-appearance.html
3185
3186         * Resources/ListButtonArrow.png: Added.
3187         * Resources/ListButtonArrow@2x.png: Added.
3188         * WebCore.xcodeproj/project.pbxproj:
3189         * css/CSSPrimitiveValueMappings.h:
3190         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3191         * css/CSSProperties.json:
3192         * css/CSSValueKeywords.in:
3193         * css/html.css:
3194         (input::-webkit-list-button):
3195         * html/HTMLInputElement.cpp:
3196         (WebCore::HTMLInputElement::dataListButtonElement const):
3197         (WebCore::HTMLInputElement::isShowingList const):
3198         * html/HTMLInputElement.h:
3199         * html/InputType.h:
3200         (WebCore::InputType::dataListButtonElement const):
3201         (WebCore::InputType::isShowingList const):
3202         * html/TextFieldInputType.cpp:
3203         (WebCore::TextFieldInputType::needsContainer const):
3204         (WebCore::TextFieldInputType::createShadowSubtree):
3205         (WebCore::TextFieldInputType::destroyShadowSubtree):
3206         (WebCore::TextFieldInputType::listAttributeTargetChanged):
3207         (WebCore::TextFieldInputType::dataListButtonElement const):
3208         (WebCore::TextFieldInputType::dataListButtonElementWasClicked):
3209         (WebCore::TextFieldInputType::didCloseSuggestions):
3210         (WebCore::TextFieldInputType::isShowingList const):
3211         * html/TextFieldInputType.h:
3212         * html/shadow/DataListButtonElement.cpp: Added.
3213         (WebCore::DataListButtonElement::create):
3214         (WebCore::DataListButtonElement::DataListButtonElement):
3215         (WebCore::DataListButtonElement::~DataListButtonElement):
3216         (WebCore::DataListButtonElement::defaultEventHandler):
3217         * html/shadow/DataListButtonElement.h: Added.
3218         * platform/ThemeTypes.h:
3219         * rendering/RenderTheme.cpp:
3220         (WebCore::RenderTheme::adjustStyle):
3221         (WebCore::RenderTheme::adjustListButtonStyle const):
3222         * rendering/RenderTheme.h:
3223         * rendering/RenderThemeMac.h:
3224         * rendering/RenderThemeMac.mm:
3225         (-[WebListButtonCell drawWithFrame:inView:]):
3226         (WebCore::RenderThemeMac::paintListButtonForInput):
3227         (WebCore::RenderThemeMac::adjustListButtonStyle const):
3228         (WebCore::RenderThemeMac::paintTextField):
3229         (WebCore::RenderThemeMac::paintSearchField):
3230         (WebCore::RenderThemeMac::paintSearchFieldCancelButton):
3231         (WebCore::RenderThemeMac::listButton const):
3232
3233 2018-07-26  Antoine Quint  <graouts@apple.com>
3234
3235         [Web Animations] Accelerated animations don't respect a positive delay value
3236         https://bugs.webkit.org/show_bug.cgi?id=186930
3237         <rdar://problem/41393393>
3238
3239         Reviewed by Dean Jackson.
3240
3241         Test: webanimations/accelerated-animation-with-delay.html
3242
3243         We would mistakenly clear the list of pending accelerated actions in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
3244         even if we failed to proceed because of the target element's renderer not being composited yet. Now, we clear the list after
3245         we've established we can apply them, and if we can't we inform the animation with a call to acceleratedStateDidChange() which
3246         will in turn call into the document timeline so that we may consider these animations on the next tick.
3247
3248         For this to work correctly we must make a change to DocumentTimeline::applyPendingAcceleratedAnimations() which only cleared
3249         its list of pending accelerated animations _after_ iterating through them, which would be problematic since we would now add
3250         animations to this list. That list is now copied and cleared prior to iterating through its members.
3251
3252         We also fix the naming of the m_pendingAcceleratedActions copy in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
3253         to have a more similar name.
3254
3255         * animation/DocumentTimeline.cpp:
3256         (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations):
3257         * animation/KeyframeEffectReadOnly.cpp:
3258         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
3259
3260 2018-07-26  Ross Kirsling  <ross.kirsling@sony.com>
3261
3262         String(View) should have a splitAllowingEmptyEntries function instead of a flag parameter
3263         https://bugs.webkit.org/show_bug.cgi?id=187963
3264
3265         Reviewed by Alex Christensen.
3266
3267         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
3268         (WebCore::convert):
3269         * Modules/cache/DOMCache.cpp:
3270         (WebCore::hasResponseVaryStarHeaderValue):
3271         * Modules/cache/DOMCacheEngine.cpp:
3272         (WebCore::DOMCacheEngine::queryCacheMatch):
3273         * Modules/mediastream/PeerConnectionBackend.cpp:
3274         (WebCore::filterICECandidate):
3275         (WebCore::PeerConnectionBackend::filterSDP const):
3276         * Modules/websockets/WebSocketHandshake.cpp:
3277         (WebCore::WebSocketHandshake::checkResponseHeaders):
3278         * accessibility/AccessibilityObject.h:
3279         (WebCore::AccessibilityObject::determineARIADropEffects):
3280         * accessibility/AccessibilityRenderObject.cpp:
3281         (WebCore::AccessibilityRenderObject::determineARIADropEffects):
3282         * accessibility/AccessibilityRenderObject.h:
3283         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3284         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3285         * editing/cocoa/DataDetection.mm:
3286         (WebCore::DataDetection::shouldCancelDefaultAction):
3287         * editing/markup.cpp:
3288         (WebCore::fillContainerFromString):
3289         (WebCore::createFragmentFromText):
3290         * html/EmailInputType.cpp:
3291         (WebCore::EmailInputType::typeMismatchFor const):
3292         (WebCore::EmailInputType::sanitizeValue const):
3293         * html/HTMLInputElement.cpp:
3294         (WebCore::parseAcceptAttribute):
3295         * html/ValidationMessage.cpp:
3296         (WebCore::ValidationMessage::setMessageDOMAndStartTimer):
3297         * html/canvas/WebGLRenderingContextBase.cpp:
3298         (WebCore::WebGLRenderingContextBase::compileShader):
3299         * inspector/agents/InspectorDOMAgent.cpp:
3300         (WebCore::InspectorDOMAgent::nodeForPath):
3301         * loader/FormSubmission.cpp:
3302         (WebCore::encodingFromAcceptCharset):
3303         * loader/ResourceTiming.cpp:
3304         (WebCore::passesTimingAllowCheck):
3305         * page/WindowFeatures.cpp:
3306         (WebCore::parseDisabledAdaptations):
3307         (WebCore::parseDialogFeaturesMap):
3308         * platform/URL.cpp:
3309         (WebCore::isIPv4Address):
3310         (WebCore::isIPv6Address):
3311         * platform/graphics/GLContext.cpp:
3312         (WebCore::GLContext::version):
3313         * platform/graphics/freetype/FontCacheFreeType.cpp:
3314         (WebCore::patternToFamilies):
3315         * platform/graphics/gstreamer/GStreamerCommon.cpp:
3316         (WebCore::extractGStreamerOptionsFromCommandLine):
3317         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
3318         (WebCore::Extensions3DOpenGLCommon::Extensions3DOpenGLCommon):
3319         (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions):
3320         * platform/gtk/PasteboardHelper.cpp:
3321         (WebCore::PasteboardHelper::fillSelectionData):
3322         * platform/gtk/SelectionData.cpp:
3323         (WebCore::SelectionData::setURIList):
3324         * platform/network/CacheValidation.cpp:
3325         (WebCore::collectVaryingRequestHeaders):
3326         * platform/network/HTTPParsers.cpp:
3327         (WebCore::filenameFromHTTPContentDisposition):
3328         (WebCore::parseXFrameOptionsHeader):
3329         (WebCore::parseAccessControlExposeHeadersAllowList):
3330         * platform/network/curl/CookieUtil.cpp:
3331         (WebCore::CookieUtil::parseCookieHeader):
3332         * platform/network/curl/CurlCacheEntry.cpp:
3333         (WebCore::CurlCacheEntry::loadResponseHeaders):
3334         * platform/network/curl/CurlCacheManager.cpp:
3335         (WebCore::CurlCacheManager::loadIndex):
3336         * platform/network/soup/CookieJarSoup.cpp:
3337         (WebCore::setCookiesFromDOM):
3338         * svg/SVGAnimationElement.cpp:
3339         (WebCore::SVGAnimationElement::parseAttribute):
3340         * svg/SVGToOTFFontConversion.cpp:
3341         (WebCore::SVGToOTFFontConverter::appendOS2Table):
3342         * svg/animation/SVGSMILElement.cpp:
3343         (WebCore::SVGSMILElement::parseBeginOrEnd):
3344         * testing/MockCDMFactory.cpp:
3345         (WebCore::MockCDM::sanitizeResponse const):
3346         (WebCore::MockCDMInstance::updateLicense):
3347         Update split/splitAllowingEmptyEntries usage.
3348
3349 2018-07-26  Nan Wang  <n_wang@apple.com>
3350
3351         AX: nothing returned for various previous text marker APIs from one div/p node to another
3352         https://bugs.webkit.org/show_bug.cgi?id=188071
3353
3354         Reviewed by Chris Fleizach.
3355
3356         TextIterator is emitting an extra '\n' at the end of the <p> node and there's no
3357         corresponding text node in the DOM tree, so we are not able to handle that for 
3358         text markers. Fixed it by ignoring the extra '\n' and anchor the text marker to 
3359         the previous child text node.
3360
3361         Test: accessibility/mac/text-marker-p-tags.html
3362
3363         * accessibility/AXObjectCache.cpp:
3364         (WebCore::AXObjectCache::traverseToOffsetInRange):
3365
3366 2018-07-26  Commit Queue  <commit-queue@webkit.org>
3367
3368         Unreviewed, rolling out r234181 and r234189.
3369         https://bugs.webkit.org/show_bug.cgi?id=188075
3370
3371         These are not needed right now (Requested by thorton on
3372         #webkit).
3373
3374         Reverted changesets:
3375
3376         "Enable Web Content Filtering on watchOS"
3377         https://bugs.webkit.org/show_bug.cgi?id=187979
3378         https://trac.webkit.org/changeset/234181
3379
3380         "HAVE(PARENTAL_CONTROLS) should be true on watchOS"
3381         https://bugs.webkit.org/show_bug.cgi?id=187985
3382         https://trac.webkit.org/changeset/234189
3383
3384 2018-07-26  Timothy Hatcher  <timothy@apple.com>
3385
3386         Use the Page's appearance when converting pasteboard attributed strings.
3387         https://bugs.webkit.org/show_bug.cgi?id=188067
3388         rdar://problem/42632246
3389
3390         Reviewed by Wenson Hsieh.
3391
3392         * editing/cocoa/WebContentReaderCocoa.mm:
3393         (WebCore::createFragment): Create a LocalDefaultSystemAppearance based on the Page.
3394
3395 2018-07-26  Eric Carlson  <eric.carlson@apple.com>
3396
3397         Switching tabs should not close PiP window
3398         https://bugs.webkit.org/show_bug.cgi?id=188054
3399         <rdar://problem/41212379>
3400
3401         Reviewed by Jon Lee.
3402
3403         No new tests, fixes an existing test.
3404         
3405         Prior to r233926, calling VideoFullscreenInterfaceMac::requestHideAndExitFullscreen was a noop.
3406         In r233926 it was updated to close the PiP window and was called from the PIPViewControllerDelegate
3407         selectors to close the PiP window. requestHideAndExitFullscreen is also called from 
3408         WebPageProxy::viewDidLeaveWindow when the web view is removed from it window, so switching
3409         tabs also closed the PiP window. Revert the changes to requestHideAndExitFullscreen, and add
3410         a new method that is only used by the delegate to exit PiP.
3411
3412         * platform/mac/VideoFullscreenInterfaceMac.h:
3413         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Make this an empty,
3414         do-nothing method.
3415         * platform/mac/VideoFullscreenInterfaceMac.mm:
3416         (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]): Call requestHideAndExitPiP.
3417         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]): Ditto.
3418         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitPiP): Renamed from requestHideAndExitFullscreen.
3419         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Deleted.
3420
3421 2018-07-04  Darin Adler  <darin@apple.com>
3422
3423         Improve WebGPU implementation, including using Metal Objective-C protocols more simply and correctly
3424         https://bugs.webkit.org/show_bug.cgi?id=187333
3425
3426         Reviewed by Sam Weinig.
3427
3428         - Used a new OBJC_PROTOCOL macro to handle things in the Metal API that are protocols.
3429           The code previously had used OBJC_CLASS, but that created unrelated classes.
3430           Fixing this allows removing many typecasts that were in the existing code, makes it
3431           ARC-compatible, and also allowed the compiler to detect a couple mistakes where we
3432           were calling methods that don't exist.
3433
3434         - Eliminated use of separate heap-allocated, reference-counted objects to
3435           hold pointers to Metal objects.
3436
3437         - Reduced the use of the WebGPU wrappers to pass around arguments inside the code.
3438           They are now used only as part of the DOM binding; the inner GPU objects are used
3439           whenever possible. This cuts down the number of separate functions needed a bit,
3440           since we don't always need accessors for the things inside the wrappers.
3441
3442         - Used references rather than pointers in many cases.
3443
3444         - Took out three kinds of null checks: 1) Unneeded ones since Objective-C has the
3445           "do nothing and return 0" behavior for methods without return values and that return
3446           integer scalars. 2) Checks that aren't needed because the code has clear, invariant
3447           guarantees that the pointer won't be null. 3) The simplest variant of (2), checks
3448           that can be obviated by using reference types instead of pointer types.
3449
3450         - For Metal-specific functions and data members, used the function name metal() and
3451           the data member name m_metal rather than longer wordier names with the word "platform"
3452           in them. We could use "platform" if these objects were platform-specific objects used
3453           in a cross-platform way that needed a common name. But in this case it's clearer to
3454           call them "metal" since we are dropping down to the metal with Metal API, and
3455           shared platform-independent code will not be accessing these.
3456
3457         - Fixed the common mistake of using "unsigned long" in our C++ code to match IDL.
3458           The "unsigned long" type in IDL correponds to the "unsigned" type in WebKit code.
3459
3460         - Used "const" more in the GPU functions that are wrappers around Metal objects to
3461           reflect the fact that these have semantics of smart pointers; most operations can be
3462           done without changing which object is pointed to. This allows us to use const
3463           references to pass things around without reference count churn.
3464
3465         - Reduced includes.
3466
3467         - Added "explicit" keywords where appropriate.
3468
3469         - Removed unused functions. In particular, removed non-Metal stub versions of the
3470           functions in the GPU classes: the right way to start a new port is to clone the
3471           Metal-specific files and turn the into stubs if needed, it does not make it
3472           significantly more convenient to have stubs in the platform independent files,
3473           especially ones that are not compiled for any platform.
3474
3475         - Removed most the WEBCORE_EXPORT in the GPU headers; left only what's needed to
3476           support testing with TestWebKitAPI.
3477
3478         - Fixed two storage leaks in GPUDevice by adding missing adoptNS.
3479
3480         * PlatformMac.cmake: Moved files from platform/graphics/cocoa to platform/graphics/metal.
3481         * SourcesCocoa.txt: Ditto.
3482         * WebCore.xcodeproj/project.pbxproj: Ditto. Fixed paths on some files and groups/directories.
3483         Made the platform files that abstract GPU all be "project" visible, not "private", since
3484         they don't need to be visible outside WebCore. Removed reference to FontSelectionKeywordValues.h,
3485         which does not seem to be a source file, a derived source file, or mentioned in any change log.
3486
3487         * bindings/js/JSWebGPURenderPassAttachmentDescriptorCustom.cpp:
3488         (WebCore::toJSNewlyCreated): Create the correct wrapper for a
3489         WebGPURenderPassDepthAttachmentDescriptor. The old code would instead
3490         create a WebGPURenderPassAttachmentDescriptor wrapper, which can't be
3491         used to access the clearDepth attribute.
3492
3493         * html/canvas/WebGPUBuffer.cpp:
3494         (WebCore::WebGPUBuffer::create): Use more references rather than pointers for things
3495         that are never null. Added comment about possibly returning null on failure in future.
3496         (WebCore::WebGPUBuffer::WebGPUBuffer): Updated to store the GPUBuffer inside the class
3497         instead of in a separate reference counted object.
3498         * html/canvas/WebGPUBuffer.h: Ditto.
3499
3500         * html/canvas/WebGPUCommandBuffer.cpp:
3501         (WebCore::WebGPUCommandBuffer::create): Use references and lower level types.
3502         (WebCore::WebGPUCommandBuffer::WebGPUCommandBuffer): Store the GPUCommandBuffer
3503         inside the class.
3504         (WebCore::WebGPUCommandBuffer::commit): Removed unneeded null checks.
3505         (WebCore::WebGPUCommandBuffer::presentDrawable): Ditto.
3506         (WebCore::WebGPUCommandBuffer::createRenderCommandEncoderWithDescriptor):
3507         Removed unneeded local variable.
3508         (WebCore::WebGPUCommandBuffer::createComputeCommandEncoder): Ditto.
3509         (WebCore::WebGPUCommandBuffer::completed): Store the DOMPromiseProxy in this
3510         class, not in GPUCommandBuffer.
3511         * html/canvas/WebGPUCommandBuffer.h: Ditto.
3512
3513         * html/canvas/WebGPUCommandQueue.cpp:
3514         (WebCore::WebGPUCommandQueue::create): Use references and lower level types.
3515         (WebCore::WebGPUCommandQueue::WebGPUCommandQueue): Store the GPUCommandQueue
3516         inside the class.
3517         (WebCore::WebGPUCommandQueue::createCommandBuffer): Ditto.
3518         * html/canvas/WebGPUCommandQueue.h: Ditto.
3519         * html/canvas/WebGPUCommandQueue.idl: The return value of createCommandBuffer
3520         is no longer nullable.
3521
3522         * html/canvas/WebGPUComputeCommandEncoder.cpp:
3523         (WebCore::WebGPUComputeCommandEncoder::create): More of the same.
3524         (WebCore::WebGPUComputeCommandEncoder::WebGPUComputeCommandEncoder): Ditto.
3525         (WebCore::WebGPUComputeCommandEncoder::setComputePipelineState): Ditto.
3526         (WebCore::WebGPUComputeCommandEncoder::setBuffer): Ditto.
3527         (WebCore::WebGPUComputeCommandEncoder::dispatch): Ditto.
3528         (WebCore::WebGPUComputeCommandEncoder::endEncoding): Ditto.
3529         * html/canvas/WebGPUComputeCommandEncoder.h: Ditto.
3530
3531         * html/canvas/WebGPUComputePipelineState.cpp:
3532         (WebCore::WebGPUComputePipelineState::create): More of the same.
3533         (WebCore::WebGPUComputePipelineState::WebGPUComputePipelineState): Ditto.
3534         * html/canvas/WebGPUComputePipelineState.h: Ditto.
3535
3536         * html/canvas/WebGPUDepthStencilDescriptor.cpp:
3537         (WebCore::WebGPUDepthStencilDescriptor::create): More of the same.
3538         (WebCore::WebGPUDepthStencilDescriptor::depthWriteEnabled const): Ditto.
3539         (WebCore::WebGPUDepthStencilDescriptor::setDepthWriteEnabled): Ditto.
3540         (WebCore::WebGPUDepthStencilDescriptor::depthCompareFunction const): Ditto.
3541         (WebCore::WebGPUDepthStencilDescriptor::setDepthCompareFunction): Ditto.
3542         * html/canvas/WebGPUDepthStencilDescriptor.h: Ditto. Also fixed a bug
3543         where m_depthCompareFunction was uninitialized in newly created objects.
3544
3545         * html/canvas/WebGPUDepthStencilState.cpp:
3546         (WebCore::WebGPUDepthStencilState::create): More of the same.
3547         (WebCore::WebGPUDepthStencilState::WebGPUDepthStencilState): Ditto.
3548         (WebCore::WebGPUDepthStencilState::label const): Ditto.
3549         (WebCore::WebGPUDepthStencilState::setLabel): Ditto.
3550         * html/canvas/WebGPUDepthStencilState.h: Ditto.
3551
3552         * html/canvas/WebGPUDrawable.cpp:
3553         (WebCore::WebGPUDrawable::create): More of the same.
3554         (WebCore::WebGPUDrawable::WebGPUDrawable): Ditto.
3555         * html/canvas/WebGPUDrawable.h: Ditto.
3556
3557         * html/canvas/WebGPUEnums.cpp: Removed some stray const.
3558         * html/canvas/WebGPUEnums.h: Ditto.
3559
3560         * html/canvas/WebGPUFunction.cpp:
3561         (WebCore::WebGPUFunction::create): More of the same.
3562         (WebCore::WebGPUFunction::WebGPUFunction): Ditto.
3563         * html/canvas/WebGPUFunction.h: Ditto.
3564
3565         * html/canvas/WebGPULibrary.cpp:
3566         (WebCore::WebGPULibrary::create): More of the same.
3567         (WebCore::WebGPULibrary::WebGPULibrary): Ditto.
3568         (WebCore::WebGPULibrary::functionNames const): Ditto.
3569         (WebCore::WebGPULibrary::functionWithName const): Ditto.
3570         * html/canvas/WebGPULibrary.h: Ditto.
3571
3572         * html/canvas/WebGPUObject.cpp:
3573         (WebCore::WebGPUObject::WebGPUObject):
3574         (WebCore::WebGPUObject::deleteObject): Deleted this unused function.
3575         We can bring it back later if we find we need it the way we did with the
3576         WebGL implementation, but currently it's a never-called stub. Also
3577         deleted the isDeleted and m_deleted for the same reason.
3578         * html/canvas/WebGPUObject.h: Ditto.
3579
3580         * html/canvas/WebGPURenderCommandEncoder.cpp:
3581         (WebCore::WebGPURenderCommandEncoder::create): More of the same.
3582         (WebCore::WebGPURenderCommandEncoder::WebGPURenderCommandEncoder): Ditto.
3583         (WebCore::WebGPURenderCommandEncoder::setRenderPipelineState): Ditto.
3584         (WebCore::WebGPURenderCommandEncoder::setDepthStencilState): Ditto.
3585         (WebCore::WebGPURenderCommandEncoder::setVertexBuffer): Ditto.
3586         (WebCore::WebGPURenderCommandEncoder::setFragmentBuffer): Ditto.
3587         (WebCore::WebGPURenderCommandEncoder::drawPrimitives): Ditto.
3588         (WebCore::WebGPURenderCommandEncoder::endEncoding): Ditto.
3589         * html/canvas/WebGPURenderCommandEncoder.h: Ditto.
3590
3591         * html/canvas/WebGPURenderPassAttachmentDescriptor.cpp:
3592         (WebCore::WebGPURenderPassAttachmentDescriptor::WebGPURenderPassAttachmentDescriptor):
3593         More of the same.
3594         (WebCore::WebGPURenderPassAttachmentDescriptor::loadAction const): Ditto.
3595         (WebCore::WebGPURenderPassAttachmentDescriptor::setLoadAction): Ditto.
3596         (WebCore::WebGPURenderPassAttachmentDescriptor::storeAction const): Ditto.
3597         (WebCore::WebGPURenderPassAttachmentDescriptor::setStoreAction): Ditto.
3598         (WebCore::WebGPURenderPassAttachmentDescriptor::texture const): Ditto.
3599         (WebCore::WebGPURenderPassAttachmentDescriptor::setTexture): Ditto.
3600         * html/canvas/WebGPURenderPassAttachmentDescriptor.h: Ditto.
3601
3602         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
3603         (WebCore::WebGPURenderPassColorAttachmentDescriptor::create): More of the same.
3604         (WebCore::WebGPURenderPassColorAttachmentDescriptor::WebGPURenderPassColorAttachmentDescriptor): Ditto.
3605         (WebCore::WebGPURenderPassColorAttachmentDescriptor::descriptor const): Ditto.
3606         (WebCore::WebGPURenderPassColorAttachmentDescriptor::clearColor const): Ditto.
3607         (WebCore::WebGPURenderPassColorAttachmentDescriptor::setClearColor): Ditto.
3608         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.h: Ditto.
3609
3610         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
3611         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::create): More of the same.
3612         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::WebGPURenderPassDepthAttachmentDescriptor): Ditto.
3613         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::clearDepth const): Ditto.
3614         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::setClearDepth): Ditto.
3615         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::descriptor const): Ditto.
3616         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h: Ditto.
3617
3618         * html/canvas/WebGPURenderPassDescriptor.cpp:
3619         (WebCore::WebGPURenderPassDescriptor::create): More of the same.
3620         (WebCore::WebGPURenderPassDescriptor::depthAttachment): Ditto.
3621         (WebCore::WebGPURenderPassDescriptor::colorAttachments): Ditto.
3622         * html/canvas/WebGPURenderPassDescriptor.h: Ditto.
3623
3624         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp:
3625         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::create): More of the same.
3626         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::WebGPURenderPipelineColorAttachmentDescriptor): Ditto.
3627         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::pixelFormat const): Ditto.
3628         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::setPixelFormat): Ditto.
3629         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h: Ditto.
3630
3631         * html/canvas/WebGPURenderPipelineDescriptor.cpp:
3632         (WebCore::WebGPURenderPipelineDescriptor::create): More of the same.
3633         (WebCore::WebGPURenderPipelineDescriptor::vertexFunction const): Ditto.
3634         (WebCore::WebGPURenderPipelineDescriptor::setVertexFunction): Ditto.
3635         (WebCore::WebGPURenderPipelineDescriptor::fragmentFunction const): Ditto.
3636         (WebCore::WebGPURenderPipelineDescriptor::setFragmentFunction): Ditto.
3637         (WebCore::WebGPURenderPipelineDescriptor::colorAttachments): Ditto.
3638         (WebCore::WebGPURenderPipelineDescriptor::depthAttachmentPixelFormat const): Ditto.
3639         (WebCore::WebGPURenderPipelineDescriptor::setDepthAttachmentPixelFormat): Ditto.
3640         (WebCore::WebGPURenderPipelineDescriptor::reset): Ditto.
3641         * html/canvas/WebGPURenderPipelineDescriptor.h: Ditto.
3642
3643         * html/canvas/WebGPURenderPipelineState.cpp:
3644         (WebCore::WebGPURenderPipelineState::create): More of the same.
3645         (WebCore::WebGPURenderPipelineState::WebGPURenderPipelineState): Ditto.
3646         (WebCore::WebGPURenderPipelineState::label const): Ditto.
3647         (WebCore::WebGPURenderPipelineState::setLabel): Ditto.
3648         * html/canvas/WebGPURenderPipelineState.h: Ditto.
3649
3650         * html/canvas/WebGPURenderingContext.cpp:
3651         (WebCore::WebGPURenderingContext::create): More of the same.
3652         (WebCore::WebGPURenderingContext::WebGPURenderingContext): Ditto.
3653         (WebCore::WebGPURenderingContext::initializeNewContext): Ditto.
3654         (WebCore::WebGPURenderingContext::platformLayer const): Ditto.
3655         (WebCore::WebGPURenderingContext::markLayerComposited): Ditto.
3656         (WebCore::WebGPURenderingContext::reshape): Ditto.
3657         (WebCore::WebGPURenderingContext::createLibrary): Ditto.
3658         (WebCore::WebGPURenderingContext::createRenderPipelineState): Ditto.
3659         (WebCore::WebGPURenderingContext::createDepthStencilState): Ditto.
3660         (WebCore::WebGPURenderingContext::createComputePipelineState): Ditto.
3661         (WebCore::WebGPURenderingContext::createCommandQueue): Ditto.
3662         (WebCore::WebGPURenderingContext::nextDrawable): Ditto.
3663         (WebCore::WebGPURenderingContext::createBuffer): Ditto.
3664         (WebCore::WebGPURenderingContext::createTexture): Ditto.
3665         * html/canvas/WebGPURenderingContext.h: Made many functions final and
3666         private.
3667         * html/canvas/WebGPURenderingContext.idl: The return value of most of
3668         the create functions are no longer nullable.
3669
3670         * html/canvas/WebGPUSize.h: Use "unsigned" instead of "unsigned long".
3671
3672         * html/canvas/WebGPUTexture.cpp:
3673         (WebCore::WebGPUTexture::createFromDrawableTexture): More of the same.
3674         (WebCore::WebGPUTexture::create): Ditto.
3675         (WebCore::WebGPUTexture::WebGPUTexture): Ditto.
3676         * html/canvas/WebGPUTexture.h: Ditto.
3677
3678         * html/canvas/WebGPUTextureDescriptor.cpp:
3679         (WebCore::WebGPUTextureDescriptor::create): More of the same.
3680         (WebCore::WebGPUTextureDescriptor::WebGPUTextureDescriptor): Ditto.
3681         (WebCore::WebGPUTextureDescriptor::width const): Ditto.
3682         (WebCore::WebGPUTextureDescriptor::setWidth): Ditto.
3683         (WebCore::WebGPUTextureDescriptor::height const): Ditto.
3684         (WebCore::WebGPUTextureDescriptor::setHeight): Ditto.
3685         (WebCore::WebGPUTextureDescriptor::sampleCount const): Ditto.
3686         (WebCore::WebGPUTextureDescriptor::setSampleCount): Ditto.
3687         (WebCore::WebGPUTextureDescriptor::textureType const): Ditto.
3688         (WebCore::WebGPUTextureDescriptor::setTextureType): Ditto.
3689         (WebCore::WebGPUTextureDescriptor::storageMode const): Ditto.
3690         (WebCore::WebGPUTextureDescriptor::setStorageMode): Ditto.
3691         (WebCore::WebGPUTextureDescriptor::usage const): Ditto.
3692         (WebCore::WebGPUTextureDescriptor::setUsage): Ditto.
3693         * html/canvas/WebGPUTextureDescriptor.h: Ditto.
3694
3695         * platform/graphics/metal/GPUBufferMetal.mm: Moved from "cocoa" directory.
3696         (WebCore::GPUBuffer::GPUBuffer): Simplify code using references and the
3697         "metal" naming.
3698
3699         * platform/graphics/metal/GPUCommandBufferMetal.mm:
3700         (WebCore::GPUCommandBuffer::GPUCommandBuffer): Take a function to be called as the
3701         completed handler and set it up.
3702         (WebCore::GPUCommandBuffer::presentDrawable const): Ditto.
3703         (WebCore::GPUCommandBuffer::commit const): Ditto.
3704         (WebCore::GPUCommandBuffer::addCompletedHandler): Deleted.
3705
3706         * platform/graphics/metal/GPUCommandQueueMetal.mm:
3707         (WebCore::GPUCommandQueue::GPUCommandQueue): Ditto. Also rewrote label handling a bit.
3708         (WebCore::GPUCommandQueue::label const): Ditto.
3709         (WebCore::GPUCommandQueue::setLabel const): Ditto.
3710
3711         * platform/graphics/metal/GPUComputeCommandEncoderMetal.mm:
3712         (WebCore::GPUComputeCommandEncoder::GPUComputeCommandEncoder): Ditto.
3713         (WebCore::GPUComputeCommandEncoder::setComputePipelineState const): Ditto.
3714         (WebCore::GPUComputeCommandEncoder::setBuffer const): Ditto.
3715         (WebCore::GPUComputeCommandEncoder::dispatch const): Ditto.
3716         (WebCore::GPUComputeCommandEncoder::endEncoding const): Ditto.
3717
3718         * platform/graphics/metal/GPUComputePipelineStateMetal.mm:
3719         (WebCore::GPUComputePipelineState::GPUComputePipelineState): Ditto.
3720
3721         * platform/graphics/metal/GPUDepthStencilDescriptorMetal.mm:
3722         (WebCore::GPUDepthStencilDescriptor::GPUDepthStencilDescriptor): Ditto.
3723         (WebCore::GPUDepthStencilDescriptor::depthWriteEnabled const): Ditto.
3724         (WebCore::GPUDepthStencilDescriptor::setDepthWriteEnabled const): Ditto.
3725         (WebCore::GPUDepthStencilDescriptor::depthCompareFunction const): Ditto.
3726         (WebCore::GPUDepthStencilDescriptor::setDepthCompareFunction const): Ditto.
3727
3728         * platform/graphics/metal/GPUDepthStencilStateMetal.mm:
3729         (WebCore::GPUDepthStencilState::GPUDepthStencilState): Ditto.
3730         (WebCore::GPUDepthStencilState::label const): Ditto.
3731         (WebCore::GPUDepthStencilState::setLabel const): Ditto. This is one of the
3732         functions that was calling a method that does not exist. Added a comment.
3733
3734         * platform/graphics/metal/GPUDeviceMetal.mm:
3735         (WebCore::GPUDevice::GPUDevice): Ditto. Also fixed two storage leaks where
3736         we neglected to do adoptNS on the result of MTLCreateSystemDefaultDevice and
3737         on the result of -[[WebGPULayer alloc] initWithGPUDevice:].
3738         (WebCore::GPUDevice::reshape const): Ditto.
3739         (WebCore::GPUDevice::platformLayer const): Ditto.
3740         (WebCore::GPUDevice::operator! const): Ditto.
3741
3742         * platform/graphics/metal/GPUDrawableMetal.mm:
3743         (WebCore::GPUDrawable::GPUDrawable): Ditto.
3744         (WebCore::GPUDrawable::release): Ditto.
3745         (WebCore::GPUDrawable::metal const): Ditto.
3746         (WebCore::GPUDrawable::texture const): Ditto.
3747
3748         * platform/graphics/metal/GPUFunctionMetal.mm:
3749         (WebCore::GPUFunction::GPUFunction): Ditto.
3750         (WebCore::GPUFunction::name const): Ditto.
3751         (WebCore::GPUFunction::metal const): Ditto.
3752         (WebCore::GPUFunction::operator! const): Ditto.
3753
3754         * platform/graphics/metal/GPULibraryMetal.mm:
3755         (WebCore::GPULibrary::GPULibrary): Ditto.
3756         (WebCore::GPULibrary::label const): Ditto.
3757         (WebCore::GPULibrary::setLabel const): Ditto.
3758         (WebCore::GPULibrary::functionNames const): Ditto.
3759         (WebCore::GPULibrary::metal const): Ditto.
3760
3761         * platform/graphics/metal/GPURenderCommandEncoderMetal.mm:
3762         (WebCore::GPURenderCommandEncoder::GPURenderCommandEncoder): Ditto.
3763         (WebCore::GPURenderCommandEncoder::setRenderPipelineState const): Ditto.
3764         (WebCore::GPURenderCommandEncoder::setDepthStencilState const): Ditto.
3765         (WebCore::GPURenderCommandEncoder::setVertexBuffer const): Ditto.
3766         (WebCore::GPURenderCommandEncoder::setFragmentBuffer const): Ditto.
3767         (WebCore::GPURenderCommandEncoder::drawPrimitives const): Ditto.
3768         (WebCore::GPURenderCommandEncoder::endEncoding const): Ditto.
3769
3770         * platform/graphics/metal/GPURenderPassAttachmentDescriptorMetal.mm:
3771         (WebCore::GPURenderPassAttachmentDescriptor::GPURenderPassAttachmentDescriptor): Ditto.
3772         (WebCore::GPURenderPassAttachmentDescriptor::loadAction const): Ditto.
3773         (WebCore::GPURenderPassAttachmentDescriptor::setLoadAction const): Ditto.
3774         (WebCore::GPURenderPassAttachmentDescriptor::storeAction const): Ditto.
3775         (WebCore::GPURenderPassAttachmentDescriptor::setStoreAction const): Ditto.
3776         (WebCore::GPURenderPassAttachmentDescriptor::setTexture const): Ditto.
3777
3778         * platform/graphics/metal/GPURenderPassColorAttachmentDescriptorMetal.mm:
3779         (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor): Ditto.
3780         (WebCore::GPURenderPassColorAttachmentDescriptor::clearColor const): Ditto.
3781         (WebCore::GPURenderPassColorAttachmentDescriptor::setClearColor const): Ditto.
3782         (WebCore::GPURenderPassColorAttachmentDescriptor::metal const): Ditto.
3783
3784         * platform/graphics/metal/GPURenderPassDepthAttachmentDescriptorMetal.mm:
3785         (WebCore::GPURenderPassDepthAttachmentDescriptor::GPURenderPassDepthAttachmentDescriptor): Ditto.
3786         (WebCore::GPURenderPassDepthAttachmentDescriptor::clearDepth const): Ditto.
3787         (WebCore::GPURenderPassDepthAttachmentDescriptor::setClearDepth const): Ditto.
3788         (WebCore::GPURenderPassDepthAttachmentDescriptor::metal const): Ditto.
3789
3790         * platform/graphics/metal/GPURenderPassDescriptorMetal.mm:
3791         (WebCore::GPURenderPassDescriptor::GPURenderPassDescriptor): Ditto.
3792         (WebCore::GPURenderPassDescriptor::colorAttachments const): Ditto.
3793         (WebCore::GPURenderPassDescriptor::depthAttachment const): Ditto.
3794         (WebCore::GPURenderPassDescriptor::metal const): Ditto.
3795
3796         * platform/graphics/metal/GPURenderPipelineColorAttachmentDescriptorMetal.mm:
3797         (WebCore::GPURenderPipelineColorAttachmentDescriptor::GPURenderPipelineColorAttachmentDescriptor): Ditto.
3798         (WebCore::GPURenderPipelineColorAttachmentDescriptor::pixelFormat const): Ditto.
3799         (WebCore::GPURenderPipelineColorAttachmentDescriptor::setPixelFormat const): Ditto.
3800         (WebCore::GPURenderPipelineColorAttachmentDescriptor::metal const): Ditto.
3801
3802         * platform/graphics/metal/GPURenderPipelineDescriptorMetal.mm:
3803         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor): Ditto.
3804         (WebCore::GPURenderPipelineDescriptor::depthAttachmentPixelFormat const): Ditto.
3805         (WebCore::GPURenderPipelineDescriptor::setDepthAttachmentPixelFormat const): Ditto.
3806         (WebCore::GPURenderPipelineDescriptor::setVertexFunction const): Ditto.
3807         (WebCore::GPURenderPipelineDescriptor::setFragmentFunction const): Ditto.
3808         (WebCore::GPURenderPipelineDescriptor::colorAttachments const): Ditto.
3809         (WebCore::GPURenderPipelineDescriptor::reset const): Ditto.
3810         (WebCore::GPURenderPipelineDescriptor::metal const): Ditto.
3811
3812         * platform/graphics/metal/GPURenderPipelineStateMetal.mm:
3813         (WebCore::GPURenderPipelineState::GPURenderPipelineState): Ditto.
3814         (WebCore::GPURenderPipelineState::label const): Ditto.
3815         (WebCore::GPURenderPipelineState::setLabel const): Ditto. This is one of the
3816         functions that was calling a method that does not exist. Added a comment.
3817         (WebCore::GPURenderPipelineState::metal const): Ditto.
3818
3819         * platform/graphics/metal/GPUTextureDescriptorMetal.mm:
3820         (WebCore::GPUTextureDescriptor::GPUTextureDescriptor): Ditto.
3821         (WebCore::GPUTextureDescriptor::width const): Ditto.
3822         (WebCore::GPUTextureDescriptor::setWidth const): Ditto.
3823         (WebCore::GPUTextureDescriptor::height const): Ditto.
3824         (WebCore::GPUTextureDescriptor::setHeight const): Ditto.
3825         (WebCore::GPUTextureDescriptor::sampleCount const): Ditto.
3826         (WebCore::GPUTextureDescriptor::setSampleCount const): Ditto.
3827         (WebCore::GPUTextureDescriptor::textureType const): Ditto.
3828         (WebCore::GPUTextureDescriptor::setTextureType const): Ditto.
3829         (WebCore::GPUTextureDescriptor::storageMode const): Ditto.
3830         (WebCore::GPUTextureDescriptor::setStorageMode const): Ditto.
3831         (WebCore::GPUTextureDescriptor::usage const): Ditto.
3832         (WebCore::GPUTextureDescriptor::setUsage const): Ditto.
3833         (WebCore::GPUTextureDescriptor::metal const): Ditto.
3834
3835         * platform/graphics/metal/GPUTextureMetal.mm:
3836         (WebCore::GPUTexture::GPUTexture): Ditto.
3837         (WebCore::GPUTexture::width const): Ditto.
3838         (WebCore::GPUTexture::height const): Ditto.
3839         (WebCore::GPUTexture::metal const): Ditto.
3840
3841         * platform/graphics/gpu/GPUBuffer.cpp: Removed unused stubs.
3842         (WebCore::GPUBuffer::length const): Moved this function here since it has
3843         a useful platform-independent implementation.
3844
3845         * platform/graphics/gpu/GPUBuffer.h: Use OBJC_PROTOCOL for MTLBuffer.
3846         Did the other thigs mentioned above: USE(METAL), remove WEBCORE_EXPORT,
3847         no longer be RefCounted, etc.
3848
3849         * platform/graphics/gpu/GPUCommandBuffer.cpp: Ditto.
3850         * platform/graphics/gpu/GPUCommandBuffer.h: Ditto. Use OBJC_PROTOCOL
3851         for MTLCommandBuffer.
3852
3853         * platform/graphics/gpu/GPUCommandQueue.cpp: Ditto.
3854         * platform/graphics/gpu/GPUCommandQueue.h: Ditto. Use OBJC_PROTOCOL for
3855         MTLCommandQueue.
3856
3857         * platform/graphics/gpu/GPUComputeCommandEncoder.cpp: Ditto.
3858         * platform/graphics/gpu/GPUComputeCommandEncoder.h: Ditto. Use OBJC_PROTOCOL for
3859         MTLComputeCommandEncoder.
3860
3861         * platform/graphics/gpu/GPUComputePipelineState.cpp: Ditto.
3862         * platform/graphics/gpu/GPUComputePipelineState.h: Ditto. Use OBJC_PROTOCOL for
3863         MTLComputePipelineState.
3864
3865         * platform/graphics/gpu/GPUDepthStencilDescriptor.cpp: Ditto.
3866         * platform/graphics/gpu/GPUDepthStencilDescriptor.h: Ditto.
3867
3868         * platform/graphics/gpu/GPUDepthStencilState.cpp: Ditto.
3869         * platform/graphics/gpu/GPUDepthStencilState.h: Ditto. Use OBJC_PROTOCOL for
3870         MTLDepthStencilState.
3871
3872         * platform/graphics/gpu/GPUDevice.cpp: Ditto.
3873         * platform/graphics/gpu/GPUDevice.h: Ditto. Use OBJC_PROTOCOL for MTLDevice.
3874
3875         * platform/graphics/gpu/GPUDrawable.cpp: Ditto.
3876         * platform/graphics/gpu/GPUDrawable.h: Ditto. Use OBJC_PROTOCOL for
3877         MTLDrawable and MTLTexture.
3878
3879         * platform/graphics/gpu/GPUEnums.h: Tweaked formatting.
3880
3881         * platform/graphics/gpu/GPUFunction.cpp: Ditto.
3882         * platform/graphics/gpu/GPUFunction.h: Ditto. Use OBJC_PROTOCOL for
3883         MTLFunction.
3884
3885         * platform/graphics/gpu/GPULibrary.cpp: Ditto.
3886         * platform/graphics/gpu/GPULibrary.h: Ditto. Use OBJC_PROTOCOL for
3887         MTLLibrary.
3888
3889         * platform/graphics/gpu/GPURenderCommandEncoder.cpp: Ditto.
3890         * platform/graphics/gpu/GPURenderCommandEncoder.h: Ditto.
3891         Use OBJC_PROTOCOL for MTLRenderCommandEncoder.
3892
3893         * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.cpp: Ditto.
3894         * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.h: Ditto.
3895
3896         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.cpp: Ditto.
3897         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h: Ditto.
3898
3899         * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.cpp: Ditto.
3900         * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.h: Ditto.
3901
3902         * platform/graphics/gpu/GPURenderPassDescriptor.cpp: Ditto.
3903         * platform/graphics/gpu/GPURenderPassDescriptor.h: Ditto.
3904
3905         * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.cpp: Ditto.
3906         * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.h: Ditto.
3907
3908         * platform/graphics/gpu/GPURenderPipelineDescriptor.cpp: Ditto.
3909         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Ditto.
3910
3911         * platform/graphics/gpu/GPURenderPipelineState.cpp: Ditto.
3912         * platform/graphics/gpu/GPURenderPipelineState.h: Ditto. Use OBJC_PROTOCOL
3913         for MTLRenderPipelineState.
3914
3915         * platform/graphics/gpu/GPUSize.h: Use "unsigned" instead of "unsigned long".
3916
3917         * platform/graphics/gpu/GPUTexture.cpp: Ditto.
3918         * platform/graphics/gpu/GPUTexture.h: Ditto. Use OBJC_PROTOCOL for