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