Switching tabs should not close PiP window
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-07-26  Eric Carlson  <eric.carlson@apple.com>
2
3         Switching tabs should not close PiP window
4         https://bugs.webkit.org/show_bug.cgi?id=188054
5         <rdar://problem/41212379>
6
7         Reviewed by Jon Lee.
8
9         No new tests, fixes an existing test.
10         
11         Prior to r233926, calling VideoFullscreenInterfaceMac::requestHideAndExitFullscreen was a noop.
12         In r233926 it was updated to close the PiP window and was called from the PIPViewControllerDelegate
13         selectors to close the PiP window. requestHideAndExitFullscreen is also called from 
14         WebPageProxy::viewDidLeaveWindow when the web view is removed from it window, so switching
15         tabs also closed the PiP window. Revert the changes to requestHideAndExitFullscreen, and add
16         a new method that is only used by the delegate to exit PiP.
17
18         * platform/mac/VideoFullscreenInterfaceMac.h:
19         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Make this an empty,
20         do-nothing method.
21         * platform/mac/VideoFullscreenInterfaceMac.mm:
22         (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]): Call requestHideAndExitPiP.
23         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]): Ditto.
24         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitPiP): Renamed from requestHideAndExitFullscreen.
25         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Deleted.
26
27 2018-07-04  Darin Adler  <darin@apple.com>
28
29         Improve WebGPU implementation, including using Metal Objective-C protocols more simply and correctly
30         https://bugs.webkit.org/show_bug.cgi?id=187333
31
32         Reviewed by Sam Weinig.
33
34         - Used a new OBJC_PROTOCOL macro to handle things in the Metal API that are protocols.
35           The code previously had used OBJC_CLASS, but that created unrelated classes.
36           Fixing this allows removing many typecasts that were in the existing code, makes it
37           ARC-compatible, and also allowed the compiler to detect a couple mistakes where we
38           were calling methods that don't exist.
39
40         - Eliminated use of separate heap-allocated, reference-counted objects to
41           hold pointers to Metal objects.
42
43         - Reduced the use of the WebGPU wrappers to pass around arguments inside the code.
44           They are now used only as part of the DOM binding; the inner GPU objects are used
45           whenever possible. This cuts down the number of separate functions needed a bit,
46           since we don't always need accessors for the things inside the wrappers.
47
48         - Used references rather than pointers in many cases.
49
50         - Took out three kinds of null checks: 1) Unneeded ones since Objective-C has the
51           "do nothing and return 0" behavior for methods without return values and that return
52           integer scalars. 2) Checks that aren't needed because the code has clear, invariant
53           guarantees that the pointer won't be null. 3) The simplest variant of (2), checks
54           that can be obviated by using reference types instead of pointer types.
55
56         - For Metal-specific functions and data members, used the function name metal() and
57           the data member name m_metal rather than longer wordier names with the word "platform"
58           in them. We could use "platform" if these objects were platform-specific objects used
59           in a cross-platform way that needed a common name. But in this case it's clearer to
60           call them "metal" since we are dropping down to the metal with Metal API, and
61           shared platform-independent code will not be accessing these.
62
63         - Fixed the common mistake of using "unsigned long" in our C++ code to match IDL.
64           The "unsigned long" type in IDL correponds to the "unsigned" type in WebKit code.
65
66         - Used "const" more in the GPU functions that are wrappers around Metal objects to
67           reflect the fact that these have semantics of smart pointers; most operations can be
68           done without changing which object is pointed to. This allows us to use const
69           references to pass things around without reference count churn.
70
71         - Reduced includes.
72
73         - Added "explicit" keywords where appropriate.
74
75         - Removed unused functions. In particular, removed non-Metal stub versions of the
76           functions in the GPU classes: the right way to start a new port is to clone the
77           Metal-specific files and turn the into stubs if needed, it does not make it
78           significantly more convenient to have stubs in the platform independent files,
79           especially ones that are not compiled for any platform.
80
81         - Removed most the WEBCORE_EXPORT in the GPU headers; left only what's needed to
82           support testing with TestWebKitAPI.
83
84         - Fixed two storage leaks in GPUDevice by adding missing adoptNS.
85
86         * PlatformMac.cmake: Moved files from platform/graphics/cocoa to platform/graphics/metal.
87         * SourcesCocoa.txt: Ditto.
88         * WebCore.xcodeproj/project.pbxproj: Ditto. Fixed paths on some files and groups/directories.
89         Made the platform files that abstract GPU all be "project" visible, not "private", since
90         they don't need to be visible outside WebCore. Removed reference to FontSelectionKeywordValues.h,
91         which does not seem to be a source file, a derived source file, or mentioned in any change log.
92
93         * bindings/js/JSWebGPURenderPassAttachmentDescriptorCustom.cpp:
94         (WebCore::toJSNewlyCreated): Create the correct wrapper for a
95         WebGPURenderPassDepthAttachmentDescriptor. The old code would instead
96         create a WebGPURenderPassAttachmentDescriptor wrapper, which can't be
97         used to access the clearDepth attribute.
98
99         * html/canvas/WebGPUBuffer.cpp:
100         (WebCore::WebGPUBuffer::create): Use more references rather than pointers for things
101         that are never null. Added comment about possibly returning null on failure in future.
102         (WebCore::WebGPUBuffer::WebGPUBuffer): Updated to store the GPUBuffer inside the class
103         instead of in a separate reference counted object.
104         * html/canvas/WebGPUBuffer.h: Ditto.
105
106         * html/canvas/WebGPUCommandBuffer.cpp:
107         (WebCore::WebGPUCommandBuffer::create): Use references and lower level types.
108         (WebCore::WebGPUCommandBuffer::WebGPUCommandBuffer): Store the GPUCommandBuffer
109         inside the class.
110         (WebCore::WebGPUCommandBuffer::commit): Removed unneeded null checks.
111         (WebCore::WebGPUCommandBuffer::presentDrawable): Ditto.
112         (WebCore::WebGPUCommandBuffer::createRenderCommandEncoderWithDescriptor):
113         Removed unneeded local variable.
114         (WebCore::WebGPUCommandBuffer::createComputeCommandEncoder): Ditto.
115         (WebCore::WebGPUCommandBuffer::completed): Store the DOMPromiseProxy in this
116         class, not in GPUCommandBuffer.
117         * html/canvas/WebGPUCommandBuffer.h: Ditto.
118
119         * html/canvas/WebGPUCommandQueue.cpp:
120         (WebCore::WebGPUCommandQueue::create): Use references and lower level types.
121         (WebCore::WebGPUCommandQueue::WebGPUCommandQueue): Store the GPUCommandQueue
122         inside the class.
123         (WebCore::WebGPUCommandQueue::createCommandBuffer): Ditto.
124         * html/canvas/WebGPUCommandQueue.h: Ditto.
125         * html/canvas/WebGPUCommandQueue.idl: The return value of createCommandBuffer
126         is no longer nullable.
127
128         * html/canvas/WebGPUComputeCommandEncoder.cpp:
129         (WebCore::WebGPUComputeCommandEncoder::create): More of the same.
130         (WebCore::WebGPUComputeCommandEncoder::WebGPUComputeCommandEncoder): Ditto.
131         (WebCore::WebGPUComputeCommandEncoder::setComputePipelineState): Ditto.
132         (WebCore::WebGPUComputeCommandEncoder::setBuffer): Ditto.
133         (WebCore::WebGPUComputeCommandEncoder::dispatch): Ditto.
134         (WebCore::WebGPUComputeCommandEncoder::endEncoding): Ditto.
135         * html/canvas/WebGPUComputeCommandEncoder.h: Ditto.
136
137         * html/canvas/WebGPUComputePipelineState.cpp:
138         (WebCore::WebGPUComputePipelineState::create): More of the same.
139         (WebCore::WebGPUComputePipelineState::WebGPUComputePipelineState): Ditto.
140         * html/canvas/WebGPUComputePipelineState.h: Ditto.
141
142         * html/canvas/WebGPUDepthStencilDescriptor.cpp:
143         (WebCore::WebGPUDepthStencilDescriptor::create): More of the same.
144         (WebCore::WebGPUDepthStencilDescriptor::depthWriteEnabled const): Ditto.
145         (WebCore::WebGPUDepthStencilDescriptor::setDepthWriteEnabled): Ditto.
146         (WebCore::WebGPUDepthStencilDescriptor::depthCompareFunction const): Ditto.
147         (WebCore::WebGPUDepthStencilDescriptor::setDepthCompareFunction): Ditto.
148         * html/canvas/WebGPUDepthStencilDescriptor.h: Ditto. Also fixed a bug
149         where m_depthCompareFunction was uninitialized in newly created objects.
150
151         * html/canvas/WebGPUDepthStencilState.cpp:
152         (WebCore::WebGPUDepthStencilState::create): More of the same.
153         (WebCore::WebGPUDepthStencilState::WebGPUDepthStencilState): Ditto.
154         (WebCore::WebGPUDepthStencilState::label const): Ditto.
155         (WebCore::WebGPUDepthStencilState::setLabel): Ditto.
156         * html/canvas/WebGPUDepthStencilState.h: Ditto.
157
158         * html/canvas/WebGPUDrawable.cpp:
159         (WebCore::WebGPUDrawable::create): More of the same.
160         (WebCore::WebGPUDrawable::WebGPUDrawable): Ditto.
161         * html/canvas/WebGPUDrawable.h: Ditto.
162
163         * html/canvas/WebGPUEnums.cpp: Removed some stray const.
164         * html/canvas/WebGPUEnums.h: Ditto.
165
166         * html/canvas/WebGPUFunction.cpp:
167         (WebCore::WebGPUFunction::create): More of the same.
168         (WebCore::WebGPUFunction::WebGPUFunction): Ditto.
169         * html/canvas/WebGPUFunction.h: Ditto.
170
171         * html/canvas/WebGPULibrary.cpp:
172         (WebCore::WebGPULibrary::create): More of the same.
173         (WebCore::WebGPULibrary::WebGPULibrary): Ditto.
174         (WebCore::WebGPULibrary::functionNames const): Ditto.
175         (WebCore::WebGPULibrary::functionWithName const): Ditto.
176         * html/canvas/WebGPULibrary.h: Ditto.
177
178         * html/canvas/WebGPUObject.cpp:
179         (WebCore::WebGPUObject::WebGPUObject):
180         (WebCore::WebGPUObject::deleteObject): Deleted this unused function.
181         We can bring it back later if we find we need it the way we did with the
182         WebGL implementation, but currently it's a never-called stub. Also
183         deleted the isDeleted and m_deleted for the same reason.
184         * html/canvas/WebGPUObject.h: Ditto.
185
186         * html/canvas/WebGPURenderCommandEncoder.cpp:
187         (WebCore::WebGPURenderCommandEncoder::create): More of the same.
188         (WebCore::WebGPURenderCommandEncoder::WebGPURenderCommandEncoder): Ditto.
189         (WebCore::WebGPURenderCommandEncoder::setRenderPipelineState): Ditto.
190         (WebCore::WebGPURenderCommandEncoder::setDepthStencilState): Ditto.
191         (WebCore::WebGPURenderCommandEncoder::setVertexBuffer): Ditto.
192         (WebCore::WebGPURenderCommandEncoder::setFragmentBuffer): Ditto.
193         (WebCore::WebGPURenderCommandEncoder::drawPrimitives): Ditto.
194         (WebCore::WebGPURenderCommandEncoder::endEncoding): Ditto.
195         * html/canvas/WebGPURenderCommandEncoder.h: Ditto.
196
197         * html/canvas/WebGPURenderPassAttachmentDescriptor.cpp:
198         (WebCore::WebGPURenderPassAttachmentDescriptor::WebGPURenderPassAttachmentDescriptor):
199         More of the same.
200         (WebCore::WebGPURenderPassAttachmentDescriptor::loadAction const): Ditto.
201         (WebCore::WebGPURenderPassAttachmentDescriptor::setLoadAction): Ditto.
202         (WebCore::WebGPURenderPassAttachmentDescriptor::storeAction const): Ditto.
203         (WebCore::WebGPURenderPassAttachmentDescriptor::setStoreAction): Ditto.
204         (WebCore::WebGPURenderPassAttachmentDescriptor::texture const): Ditto.
205         (WebCore::WebGPURenderPassAttachmentDescriptor::setTexture): Ditto.
206         * html/canvas/WebGPURenderPassAttachmentDescriptor.h: Ditto.
207
208         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
209         (WebCore::WebGPURenderPassColorAttachmentDescriptor::create): More of the same.
210         (WebCore::WebGPURenderPassColorAttachmentDescriptor::WebGPURenderPassColorAttachmentDescriptor): Ditto.
211         (WebCore::WebGPURenderPassColorAttachmentDescriptor::descriptor const): Ditto.
212         (WebCore::WebGPURenderPassColorAttachmentDescriptor::clearColor const): Ditto.
213         (WebCore::WebGPURenderPassColorAttachmentDescriptor::setClearColor): Ditto.
214         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.h: Ditto.
215
216         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
217         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::create): More of the same.
218         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::WebGPURenderPassDepthAttachmentDescriptor): Ditto.
219         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::clearDepth const): Ditto.
220         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::setClearDepth): Ditto.
221         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::descriptor const): Ditto.
222         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h: Ditto.
223
224         * html/canvas/WebGPURenderPassDescriptor.cpp:
225         (WebCore::WebGPURenderPassDescriptor::create): More of the same.
226         (WebCore::WebGPURenderPassDescriptor::depthAttachment): Ditto.
227         (WebCore::WebGPURenderPassDescriptor::colorAttachments): Ditto.
228         * html/canvas/WebGPURenderPassDescriptor.h: Ditto.
229
230         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp:
231         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::create): More of the same.
232         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::WebGPURenderPipelineColorAttachmentDescriptor): Ditto.
233         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::pixelFormat const): Ditto.
234         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::setPixelFormat): Ditto.
235         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h: Ditto.
236
237         * html/canvas/WebGPURenderPipelineDescriptor.cpp:
238         (WebCore::WebGPURenderPipelineDescriptor::create): More of the same.
239         (WebCore::WebGPURenderPipelineDescriptor::vertexFunction const): Ditto.
240         (WebCore::WebGPURenderPipelineDescriptor::setVertexFunction): Ditto.
241         (WebCore::WebGPURenderPipelineDescriptor::fragmentFunction const): Ditto.
242         (WebCore::WebGPURenderPipelineDescriptor::setFragmentFunction): Ditto.
243         (WebCore::WebGPURenderPipelineDescriptor::colorAttachments): Ditto.
244         (WebCore::WebGPURenderPipelineDescriptor::depthAttachmentPixelFormat const): Ditto.
245         (WebCore::WebGPURenderPipelineDescriptor::setDepthAttachmentPixelFormat): Ditto.
246         (WebCore::WebGPURenderPipelineDescriptor::reset): Ditto.
247         * html/canvas/WebGPURenderPipelineDescriptor.h: Ditto.
248
249         * html/canvas/WebGPURenderPipelineState.cpp:
250         (WebCore::WebGPURenderPipelineState::create): More of the same.
251         (WebCore::WebGPURenderPipelineState::WebGPURenderPipelineState): Ditto.
252         (WebCore::WebGPURenderPipelineState::label const): Ditto.
253         (WebCore::WebGPURenderPipelineState::setLabel): Ditto.
254         * html/canvas/WebGPURenderPipelineState.h: Ditto.
255
256         * html/canvas/WebGPURenderingContext.cpp:
257         (WebCore::WebGPURenderingContext::create): More of the same.
258         (WebCore::WebGPURenderingContext::WebGPURenderingContext): Ditto.
259         (WebCore::WebGPURenderingContext::initializeNewContext): Ditto.
260         (WebCore::WebGPURenderingContext::platformLayer const): Ditto.
261         (WebCore::WebGPURenderingContext::markLayerComposited): Ditto.
262         (WebCore::WebGPURenderingContext::reshape): Ditto.
263         (WebCore::WebGPURenderingContext::createLibrary): Ditto.
264         (WebCore::WebGPURenderingContext::createRenderPipelineState): Ditto.
265         (WebCore::WebGPURenderingContext::createDepthStencilState): Ditto.
266         (WebCore::WebGPURenderingContext::createComputePipelineState): Ditto.
267         (WebCore::WebGPURenderingContext::createCommandQueue): Ditto.
268         (WebCore::WebGPURenderingContext::nextDrawable): Ditto.
269         (WebCore::WebGPURenderingContext::createBuffer): Ditto.
270         (WebCore::WebGPURenderingContext::createTexture): Ditto.
271         * html/canvas/WebGPURenderingContext.h: Made many functions final and
272         private.
273         * html/canvas/WebGPURenderingContext.idl: The return value of most of
274         the create functions are no longer nullable.
275
276         * html/canvas/WebGPUSize.h: Use "unsigned" instead of "unsigned long".
277
278         * html/canvas/WebGPUTexture.cpp:
279         (WebCore::WebGPUTexture::createFromDrawableTexture): More of the same.
280         (WebCore::WebGPUTexture::create): Ditto.
281         (WebCore::WebGPUTexture::WebGPUTexture): Ditto.
282         * html/canvas/WebGPUTexture.h: Ditto.
283
284         * html/canvas/WebGPUTextureDescriptor.cpp:
285         (WebCore::WebGPUTextureDescriptor::create): More of the same.
286         (WebCore::WebGPUTextureDescriptor::WebGPUTextureDescriptor): Ditto.
287         (WebCore::WebGPUTextureDescriptor::width const): Ditto.
288         (WebCore::WebGPUTextureDescriptor::setWidth): Ditto.
289         (WebCore::WebGPUTextureDescriptor::height const): Ditto.
290         (WebCore::WebGPUTextureDescriptor::setHeight): Ditto.
291         (WebCore::WebGPUTextureDescriptor::sampleCount const): Ditto.
292         (WebCore::WebGPUTextureDescriptor::setSampleCount): Ditto.
293         (WebCore::WebGPUTextureDescriptor::textureType const): Ditto.
294         (WebCore::WebGPUTextureDescriptor::setTextureType): Ditto.
295         (WebCore::WebGPUTextureDescriptor::storageMode const): Ditto.
296         (WebCore::WebGPUTextureDescriptor::setStorageMode): Ditto.
297         (WebCore::WebGPUTextureDescriptor::usage const): Ditto.
298         (WebCore::WebGPUTextureDescriptor::setUsage): Ditto.
299         * html/canvas/WebGPUTextureDescriptor.h: Ditto.
300
301         * platform/graphics/metal/GPUBufferMetal.mm: Moved from "cocoa" directory.
302         (WebCore::GPUBuffer::GPUBuffer): Simplify code using references and the
303         "metal" naming.
304
305         * platform/graphics/metal/GPUCommandBufferMetal.mm:
306         (WebCore::GPUCommandBuffer::GPUCommandBuffer): Take a function to be called as the
307         completed handler and set it up.
308         (WebCore::GPUCommandBuffer::presentDrawable const): Ditto.
309         (WebCore::GPUCommandBuffer::commit const): Ditto.
310         (WebCore::GPUCommandBuffer::addCompletedHandler): Deleted.
311
312         * platform/graphics/metal/GPUCommandQueueMetal.mm:
313         (WebCore::GPUCommandQueue::GPUCommandQueue): Ditto. Also rewrote label handling a bit.
314         (WebCore::GPUCommandQueue::label const): Ditto.
315         (WebCore::GPUCommandQueue::setLabel const): Ditto.
316
317         * platform/graphics/metal/GPUComputeCommandEncoderMetal.mm:
318         (WebCore::GPUComputeCommandEncoder::GPUComputeCommandEncoder): Ditto.
319         (WebCore::GPUComputeCommandEncoder::setComputePipelineState const): Ditto.
320         (WebCore::GPUComputeCommandEncoder::setBuffer const): Ditto.
321         (WebCore::GPUComputeCommandEncoder::dispatch const): Ditto.
322         (WebCore::GPUComputeCommandEncoder::endEncoding const): Ditto.
323
324         * platform/graphics/metal/GPUComputePipelineStateMetal.mm:
325         (WebCore::GPUComputePipelineState::GPUComputePipelineState): Ditto.
326
327         * platform/graphics/metal/GPUDepthStencilDescriptorMetal.mm:
328         (WebCore::GPUDepthStencilDescriptor::GPUDepthStencilDescriptor): Ditto.
329         (WebCore::GPUDepthStencilDescriptor::depthWriteEnabled const): Ditto.
330         (WebCore::GPUDepthStencilDescriptor::setDepthWriteEnabled const): Ditto.
331         (WebCore::GPUDepthStencilDescriptor::depthCompareFunction const): Ditto.
332         (WebCore::GPUDepthStencilDescriptor::setDepthCompareFunction const): Ditto.
333
334         * platform/graphics/metal/GPUDepthStencilStateMetal.mm:
335         (WebCore::GPUDepthStencilState::GPUDepthStencilState): Ditto.
336         (WebCore::GPUDepthStencilState::label const): Ditto.
337         (WebCore::GPUDepthStencilState::setLabel const): Ditto. This is one of the
338         functions that was calling a method that does not exist. Added a comment.
339
340         * platform/graphics/metal/GPUDeviceMetal.mm:
341         (WebCore::GPUDevice::GPUDevice): Ditto. Also fixed two storage leaks where
342         we neglected to do adoptNS on the result of MTLCreateSystemDefaultDevice and
343         on the result of -[[WebGPULayer alloc] initWithGPUDevice:].
344         (WebCore::GPUDevice::reshape const): Ditto.
345         (WebCore::GPUDevice::platformLayer const): Ditto.
346         (WebCore::GPUDevice::operator! const): Ditto.
347
348         * platform/graphics/metal/GPUDrawableMetal.mm:
349         (WebCore::GPUDrawable::GPUDrawable): Ditto.
350         (WebCore::GPUDrawable::release): Ditto.
351         (WebCore::GPUDrawable::metal const): Ditto.
352         (WebCore::GPUDrawable::texture const): Ditto.
353
354         * platform/graphics/metal/GPUFunctionMetal.mm:
355         (WebCore::GPUFunction::GPUFunction): Ditto.
356         (WebCore::GPUFunction::name const): Ditto.
357         (WebCore::GPUFunction::metal const): Ditto.
358         (WebCore::GPUFunction::operator! const): Ditto.
359
360         * platform/graphics/metal/GPULibraryMetal.mm:
361         (WebCore::GPULibrary::GPULibrary): Ditto.
362         (WebCore::GPULibrary::label const): Ditto.
363         (WebCore::GPULibrary::setLabel const): Ditto.
364         (WebCore::GPULibrary::functionNames const): Ditto.
365         (WebCore::GPULibrary::metal const): Ditto.
366
367         * platform/graphics/metal/GPURenderCommandEncoderMetal.mm:
368         (WebCore::GPURenderCommandEncoder::GPURenderCommandEncoder): Ditto.
369         (WebCore::GPURenderCommandEncoder::setRenderPipelineState const): Ditto.
370         (WebCore::GPURenderCommandEncoder::setDepthStencilState const): Ditto.
371         (WebCore::GPURenderCommandEncoder::setVertexBuffer const): Ditto.
372         (WebCore::GPURenderCommandEncoder::setFragmentBuffer const): Ditto.
373         (WebCore::GPURenderCommandEncoder::drawPrimitives const): Ditto.
374         (WebCore::GPURenderCommandEncoder::endEncoding const): Ditto.
375
376         * platform/graphics/metal/GPURenderPassAttachmentDescriptorMetal.mm:
377         (WebCore::GPURenderPassAttachmentDescriptor::GPURenderPassAttachmentDescriptor): Ditto.
378         (WebCore::GPURenderPassAttachmentDescriptor::loadAction const): Ditto.
379         (WebCore::GPURenderPassAttachmentDescriptor::setLoadAction const): Ditto.
380         (WebCore::GPURenderPassAttachmentDescriptor::storeAction const): Ditto.
381         (WebCore::GPURenderPassAttachmentDescriptor::setStoreAction const): Ditto.
382         (WebCore::GPURenderPassAttachmentDescriptor::setTexture const): Ditto.
383
384         * platform/graphics/metal/GPURenderPassColorAttachmentDescriptorMetal.mm:
385         (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor): Ditto.
386         (WebCore::GPURenderPassColorAttachmentDescriptor::clearColor const): Ditto.
387         (WebCore::GPURenderPassColorAttachmentDescriptor::setClearColor const): Ditto.
388         (WebCore::GPURenderPassColorAttachmentDescriptor::metal const): Ditto.
389
390         * platform/graphics/metal/GPURenderPassDepthAttachmentDescriptorMetal.mm:
391         (WebCore::GPURenderPassDepthAttachmentDescriptor::GPURenderPassDepthAttachmentDescriptor): Ditto.
392         (WebCore::GPURenderPassDepthAttachmentDescriptor::clearDepth const): Ditto.
393         (WebCore::GPURenderPassDepthAttachmentDescriptor::setClearDepth const): Ditto.
394         (WebCore::GPURenderPassDepthAttachmentDescriptor::metal const): Ditto.
395
396         * platform/graphics/metal/GPURenderPassDescriptorMetal.mm:
397         (WebCore::GPURenderPassDescriptor::GPURenderPassDescriptor): Ditto.
398         (WebCore::GPURenderPassDescriptor::colorAttachments const): Ditto.
399         (WebCore::GPURenderPassDescriptor::depthAttachment const): Ditto.
400         (WebCore::GPURenderPassDescriptor::metal const): Ditto.
401
402         * platform/graphics/metal/GPURenderPipelineColorAttachmentDescriptorMetal.mm:
403         (WebCore::GPURenderPipelineColorAttachmentDescriptor::GPURenderPipelineColorAttachmentDescriptor): Ditto.
404         (WebCore::GPURenderPipelineColorAttachmentDescriptor::pixelFormat const): Ditto.
405         (WebCore::GPURenderPipelineColorAttachmentDescriptor::setPixelFormat const): Ditto.
406         (WebCore::GPURenderPipelineColorAttachmentDescriptor::metal const): Ditto.
407
408         * platform/graphics/metal/GPURenderPipelineDescriptorMetal.mm:
409         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor): Ditto.
410         (WebCore::GPURenderPipelineDescriptor::depthAttachmentPixelFormat const): Ditto.
411         (WebCore::GPURenderPipelineDescriptor::setDepthAttachmentPixelFormat const): Ditto.
412         (WebCore::GPURenderPipelineDescriptor::setVertexFunction const): Ditto.
413         (WebCore::GPURenderPipelineDescriptor::setFragmentFunction const): Ditto.
414         (WebCore::GPURenderPipelineDescriptor::colorAttachments const): Ditto.
415         (WebCore::GPURenderPipelineDescriptor::reset const): Ditto.
416         (WebCore::GPURenderPipelineDescriptor::metal const): Ditto.
417
418         * platform/graphics/metal/GPURenderPipelineStateMetal.mm:
419         (WebCore::GPURenderPipelineState::GPURenderPipelineState): Ditto.
420         (WebCore::GPURenderPipelineState::label const): Ditto.
421         (WebCore::GPURenderPipelineState::setLabel const): Ditto. This is one of the
422         functions that was calling a method that does not exist. Added a comment.
423         (WebCore::GPURenderPipelineState::metal const): Ditto.
424
425         * platform/graphics/metal/GPUTextureDescriptorMetal.mm:
426         (WebCore::GPUTextureDescriptor::GPUTextureDescriptor): Ditto.
427         (WebCore::GPUTextureDescriptor::width const): Ditto.
428         (WebCore::GPUTextureDescriptor::setWidth const): Ditto.
429         (WebCore::GPUTextureDescriptor::height const): Ditto.
430         (WebCore::GPUTextureDescriptor::setHeight const): Ditto.
431         (WebCore::GPUTextureDescriptor::sampleCount const): Ditto.
432         (WebCore::GPUTextureDescriptor::setSampleCount const): Ditto.
433         (WebCore::GPUTextureDescriptor::textureType const): Ditto.
434         (WebCore::GPUTextureDescriptor::setTextureType const): Ditto.
435         (WebCore::GPUTextureDescriptor::storageMode const): Ditto.
436         (WebCore::GPUTextureDescriptor::setStorageMode const): Ditto.
437         (WebCore::GPUTextureDescriptor::usage const): Ditto.
438         (WebCore::GPUTextureDescriptor::setUsage const): Ditto.
439         (WebCore::GPUTextureDescriptor::metal const): Ditto.
440
441         * platform/graphics/metal/GPUTextureMetal.mm:
442         (WebCore::GPUTexture::GPUTexture): Ditto.
443         (WebCore::GPUTexture::width const): Ditto.
444         (WebCore::GPUTexture::height const): Ditto.
445         (WebCore::GPUTexture::metal const): Ditto.
446
447         * platform/graphics/gpu/GPUBuffer.cpp: Removed unused stubs.
448         (WebCore::GPUBuffer::length const): Moved this function here since it has
449         a useful platform-independent implementation.
450
451         * platform/graphics/gpu/GPUBuffer.h: Use OBJC_PROTOCOL for MTLBuffer.
452         Did the other thigs mentioned above: USE(METAL), remove WEBCORE_EXPORT,
453         no longer be RefCounted, etc.
454
455         * platform/graphics/gpu/GPUCommandBuffer.cpp: Ditto.
456         * platform/graphics/gpu/GPUCommandBuffer.h: Ditto. Use OBJC_PROTOCOL
457         for MTLCommandBuffer.
458
459         * platform/graphics/gpu/GPUCommandQueue.cpp: Ditto.
460         * platform/graphics/gpu/GPUCommandQueue.h: Ditto. Use OBJC_PROTOCOL for
461         MTLCommandQueue.
462
463         * platform/graphics/gpu/GPUComputeCommandEncoder.cpp: Ditto.
464         * platform/graphics/gpu/GPUComputeCommandEncoder.h: Ditto. Use OBJC_PROTOCOL for
465         MTLComputeCommandEncoder.
466
467         * platform/graphics/gpu/GPUComputePipelineState.cpp: Ditto.
468         * platform/graphics/gpu/GPUComputePipelineState.h: Ditto. Use OBJC_PROTOCOL for
469         MTLComputePipelineState.
470
471         * platform/graphics/gpu/GPUDepthStencilDescriptor.cpp: Ditto.
472         * platform/graphics/gpu/GPUDepthStencilDescriptor.h: Ditto.
473
474         * platform/graphics/gpu/GPUDepthStencilState.cpp: Ditto.
475         * platform/graphics/gpu/GPUDepthStencilState.h: Ditto. Use OBJC_PROTOCOL for
476         MTLDepthStencilState.
477
478         * platform/graphics/gpu/GPUDevice.cpp: Ditto.
479         * platform/graphics/gpu/GPUDevice.h: Ditto. Use OBJC_PROTOCOL for MTLDevice.
480
481         * platform/graphics/gpu/GPUDrawable.cpp: Ditto.
482         * platform/graphics/gpu/GPUDrawable.h: Ditto. Use OBJC_PROTOCOL for
483         MTLDrawable and MTLTexture.
484
485         * platform/graphics/gpu/GPUEnums.h: Tweaked formatting.
486
487         * platform/graphics/gpu/GPUFunction.cpp: Ditto.
488         * platform/graphics/gpu/GPUFunction.h: Ditto. Use OBJC_PROTOCOL for
489         MTLFunction.
490
491         * platform/graphics/gpu/GPULibrary.cpp: Ditto.
492         * platform/graphics/gpu/GPULibrary.h: Ditto. Use OBJC_PROTOCOL for
493         MTLLibrary.
494
495         * platform/graphics/gpu/GPURenderCommandEncoder.cpp: Ditto.
496         * platform/graphics/gpu/GPURenderCommandEncoder.h: Ditto.
497         Use OBJC_PROTOCOL for MTLRenderCommandEncoder.
498
499         * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.cpp: Ditto.
500         * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.h: Ditto.
501
502         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.cpp: Ditto.
503         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h: Ditto.
504
505         * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.cpp: Ditto.
506         * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.h: Ditto.
507
508         * platform/graphics/gpu/GPURenderPassDescriptor.cpp: Ditto.
509         * platform/graphics/gpu/GPURenderPassDescriptor.h: Ditto.
510
511         * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.cpp: Ditto.
512         * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.h: Ditto.
513
514         * platform/graphics/gpu/GPURenderPipelineDescriptor.cpp: Ditto.
515         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Ditto.
516
517         * platform/graphics/gpu/GPURenderPipelineState.cpp: Ditto.
518         * platform/graphics/gpu/GPURenderPipelineState.h: Ditto. Use OBJC_PROTOCOL
519         for MTLRenderPipelineState.
520
521         * platform/graphics/gpu/GPUSize.h: Use "unsigned" instead of "unsigned long".
522
523         * platform/graphics/gpu/GPUTexture.cpp: Ditto.
524         * platform/graphics/gpu/GPUTexture.h: Ditto. Use OBJC_PROTOCOL for
525         MTLTexture.
526
527         * platform/graphics/gpu/GPUTextureDescriptor.cpp: Ditto.
528         * platform/graphics/gpu/GPUTextureDescriptor.h: Ditto.
529
530 2018-07-26  Zalan Bujtas  <zalan@apple.com>
531
532         [LFC][Floating] Add skeleton for basic positioning.
533         https://bugs.webkit.org/show_bug.cgi?id=187974
534
535         Reviewed by Antti Koivisto.
536
537         Add floating boxes to an empty floating context.
538
539         * layout/FloatingContext.cpp:
540         (WebCore::Layout::FloatingContext::FloatingContext):
541         (WebCore::Layout::FloatingContext::computePosition):
542         * layout/FloatingContext.h:
543         (WebCore::Layout::FloatingContext::floatingState const):
544         (WebCore::Layout::FloatingContext::layoutContext const):
545         * layout/FloatingState.cpp:
546         (WebCore::Layout::FloatingState::FloatingState):
547         (WebCore::Layout::FloatingState::append):
548         * layout/FloatingState.h:
549         (WebCore::Layout::FloatingState::create):
550         (WebCore::Layout::FloatingState::isEmpty const):
551         (WebCore::Layout::FloatingState::layoutContext const):
552         * layout/FormattingState.h:
553         * layout/LayoutContext.cpp:
554         (WebCore::Layout::LayoutContext::establishedFormattingState):
555         * layout/LayoutContext.h:
556         * layout/blockformatting/BlockFormattingContext.cpp:
557         (WebCore::Layout::BlockFormattingContext::layout const):
558         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
559         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
560         * layout/blockformatting/BlockFormattingContext.h:
561         * layout/blockformatting/BlockInvalidation.cpp:
562         (WebCore::Layout::invalidationStopsAtFormattingContextBoundary):
563         * layout/layouttree/LayoutBox.cpp:
564         (WebCore::Layout::Box::isLeftFloatingPositioned const):
565         (WebCore::Layout::Box::isRightFloatingPositioned const):
566         * layout/layouttree/LayoutBox.h:
567
568 2018-07-26  Zalan Bujtas  <zalan@apple.com>
569
570         [LFC][BFC] Do not try to access containing block's height during descendant height computation
571         https://bugs.webkit.org/show_bug.cgi?id=187970
572
573         Reviewed by Antti Koivisto.
574
575         Mostly becasue in BFC, we compute the descendents' height first so the containing block's height is probably not computed yet.
576
577         * layout/FormattingContextGeometry.cpp:
578         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
579         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
580         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
581
582 2018-07-26  Frederic Wang  <fwang@igalia.com>
583
584         Unreviewed, add bug references into FIXME comments for CSSOM View API
585
586         * dom/Element.idl:
587         * page/ScrollToOptions.idl:
588
589 2018-07-26  Zalan Bujtas  <zalan@apple.com>
590
591         [LFC][BFC] assert-not-implemented-yet on inflow non-replaced height when style is not fixed/auto.
592         https://bugs.webkit.org/show_bug.cgi?id=187969
593
594         Reviewed by Antti Koivisto.
595
596         Assert on unsupported height types when computing inflow non-replaced height.
597
598         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
599         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
600
601 2018-07-26  Antoine Quint  <graouts@apple.com>
602
603         [Web Animations] REGRESSION: transition added immediately after element creation doesn't work
604         https://bugs.webkit.org/show_bug.cgi?id=187942
605
606         Reviewed by Dean Jackson.
607
608         Tests: webanimations/accelerated-transition-by-removing-property.html
609                webanimations/partly-accelerated-transition-by-removing-property.html
610
611         The Style::TreeResolver::createAnimatedElementUpdate() function expected a flag to be set that indicates that
612         running animations on an element should yield a change in composited state for that element's layer. We did not
613         have code accounting for this flag in the Web Animations engine. We now have a resolveAnimationsForElement()
614         method on DocumentTimeline which looks at all animations resolved on the element and see if all of them are
615         running accelerated and whether at least one of them is pending. In that case, we set the shouldRecompositeLayer
616         flag in createAnimatedElementUpdate() to true which guarantees the element's layer will have a backing when
617         we attempt to start the animation in KeyframeEffectReadOnly::applyPendingAcceleratedActions() where we would
618         have previously failed to have layer-backed renderer to perform an accelerated animation on (under certain
619         circumstances, see test).
620
621         * animation/DocumentTimeline.cpp:
622         (WebCore::DocumentTimeline::resolveAnimationsForElement):
623         * animation/DocumentTimeline.h:
624         * animation/KeyframeEffectReadOnly.h:
625         (WebCore::KeyframeEffectReadOnly::hasPendingAcceleratedAction const):
626         * style/StyleTreeResolver.cpp:
627         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
628
629 2018-07-25  Chris Dumez  <cdumez@apple.com>
630
631         Allow ActiveDOMObject's canSuspend / suspend / resume overrides to destroy ActiveDOMObjects
632         https://bugs.webkit.org/show_bug.cgi?id=188025
633
634         Reviewed by Alex Christensen.
635
636         Apply the same logic as in ScriptExecutionContext::stopActiveDOMObjects() to support destruction of
637         ActiveDOMObjects while we're calling ActiveDOMObject's canSuspend / suspend / resume overrides.
638
639         We copy m_activeDOMObjects into a Vector and iterate over the copy instead of m_activeDOMObjects.
640         Since ActiveDOMObject is not RefCounted or CanMakeWeakPtr, we verify that the raw pointer is still
641         valid by checking if m_activeDOMObjects still contains it, as we iterate. This is safe as the
642         ActiveDOMObject destructor removes the object from ScriptExecutionContext::m_activeDOMObjects.
643         New ActiveDOMObjects with the same pointer value cannot be created while we iterate as we already
644         prevent the construction of new ActiveDOMObjects while we iterate via RELEASE_ASSERT().
645
646         * dom/ScriptExecutionContext.cpp:
647         (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension):
648         (WebCore::ScriptExecutionContext::forEachActiveDOMObject const):
649         (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
650         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
651         (WebCore::ScriptExecutionContext::stopActiveDOMObjects):
652         (WebCore::ScriptExecutionContext::willDestroyActiveDOMObject):
653         * dom/ScriptExecutionContext.h:
654
655 2018-07-25  Justin Fan  <justin_fan@apple.com>
656
657         Systems with no NSScreens hitting assertion in rendererIDForDisplay when creating WebGL context
658         https://bugs.webkit.org/show_bug.cgi?id=188023
659         <rdar://problem/42476622>
660
661         Reviewed by Simon Fraser.
662
663         On systems with no NSScreens, PlatformScreenMac's screenData map is not populated; rendererIDForDisplay
664         will thus hit an assertion rather than returning 0. Removing the assertion for now. 
665
666         Covered by existing tests.
667
668         * platform/mac/PlatformScreenMac.mm:
669         (WebCore::rendererIDForDisplay):
670
671 2018-07-25  Zalan Bujtas  <zalan@apple.com>
672
673         Build fix after r234215. Unreviewed.
674
675         * rendering/RenderTheme.cpp:
676
677 2018-07-25  Zalan Bujtas  <zalan@apple.com>
678
679         REGRESSION(r227577) Text on TV & Movies page doesn't wrap properly in iTunes
680         https://bugs.webkit.org/show_bug.cgi?id=188018
681         <rdar://problem/42517520>
682
683         Reviewed by Dean Jackson.
684
685         Manual rollout of r227577.
686
687         Test: fast/overflow/line-clamp-with-text-shadow.html
688
689         * Sources.txt:
690         * WebCore.xcodeproj/project.pbxproj:
691         * css/CSSComputedStyleDeclaration.cpp:
692         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
693         * css/CSSProperties.json:
694         * css/StyleBuilderCustom.h:
695         (WebCore::StyleBuilderCustom::applyValueWebkitLinesClamp): Deleted.
696         * css/parser/CSSParserContext.cpp:
697         (WebCore::CSSParserContext::CSSParserContext):
698         * css/parser/CSSParserContext.h:
699         (WebCore::CSSParserContextHash::hash):
700         * css/parser/CSSPropertyParser.cpp:
701         (WebCore::CSSPropertyParser::parseSingleValue):
702         (WebCore::consumeLinesClamp): Deleted.
703         * page/Settings.yaml:
704         * rendering/RenderBlockFlow.cpp:
705         (WebCore::RenderBlockFlow::willCreateColumns const):
706         (WebCore::getHeightForLineCount):
707         (WebCore::RenderBlockFlow::heightForLineCount):
708         (WebCore::RenderBlockFlow::layoutExcludedChildren):
709         (WebCore::RenderBlockFlow::logicalHeightForLineCount): Deleted.
710         (WebCore::RenderBlockFlow::logicalHeightExcludingLineCount): Deleted.
711         * rendering/RenderBlockFlow.h:
712         * rendering/RenderDeprecatedFlexibleBox.cpp:
713         (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
714         * rendering/RenderFragmentContainer.cpp:
715         (WebCore::RenderFragmentContainer::pageLogicalHeightForOffset const): Deleted.
716         * rendering/RenderFragmentContainer.h:
717         * rendering/RenderFragmentedFlow.cpp:
718         (WebCore::RenderFragmentedFlow::validateFragments):
719         (WebCore::RenderFragmentedFlow::pageLogicalHeightForOffset const):
720         (WebCore::RenderFragmentedFlow::pageRemainingLogicalHeightForOffset const):
721         * rendering/RenderFragmentedFlow.h:
722         * rendering/RenderLinesClampFlow.cpp: Removed.
723         * rendering/RenderLinesClampFlow.h: Removed.
724         * rendering/RenderLinesClampSet.cpp: Removed.
725         * rendering/RenderLinesClampSet.h: Removed.
726         * rendering/RenderMultiColumnFlow.cpp:
727         (WebCore::RenderMultiColumnFlow::isColumnSpanningDescendant const): Deleted.
728         (WebCore::RenderMultiColumnFlow::createMultiColumnSet): Deleted.
729         * rendering/RenderMultiColumnFlow.h:
730         (WebCore::RenderMultiColumnFlow::multiColumnBlockFlow const): Deleted.
731         (WebCore::RenderMultiColumnFlow::hasColumnSpanner const): Deleted.
732         (WebCore::RenderMultiColumnFlow::findColumnSpannerPlaceholder const): Deleted.
733         (WebCore::RenderMultiColumnFlow::columnCount const): Deleted.
734         (WebCore::RenderMultiColumnFlow::columnWidth const): Deleted.
735         (WebCore::RenderMultiColumnFlow::columnHeightAvailable const): Deleted.
736         (WebCore::RenderMultiColumnFlow::setColumnHeightAvailable): Deleted.
737         (WebCore::RenderMultiColumnFlow::inBalancingPass const): Deleted.
738         (WebCore::RenderMultiColumnFlow::setInBalancingPass): Deleted.
739         (WebCore::RenderMultiColumnFlow::needsHeightsRecalculation const): Deleted.
740         (WebCore::RenderMultiColumnFlow::setNeedsHeightsRecalculation): Deleted.
741         (WebCore::RenderMultiColumnFlow::shouldRelayoutForPagination const): Deleted.
742         (WebCore::RenderMultiColumnFlow::setColumnCountAndWidth): Deleted.
743         (WebCore::RenderMultiColumnFlow::progressionIsInline const): Deleted.
744         (WebCore::RenderMultiColumnFlow::setProgressionIsInline): Deleted.
745         (WebCore::RenderMultiColumnFlow::progressionIsReversed const): Deleted.
746         (WebCore::RenderMultiColumnFlow::setProgressionIsReversed): Deleted.
747         (WebCore::RenderMultiColumnFlow::spannerMap): Deleted.
748         * rendering/RenderMultiColumnSet.cpp:
749         (WebCore::RenderMultiColumnSet::collectLayerFragments):
750         (WebCore::RenderMultiColumnSet::columnTranslationForOffset const):
751         * rendering/RenderMultiColumnSet.h:
752         (WebCore::RenderMultiColumnSet::multiColumnBlockFlow const): Deleted.
753         (WebCore::RenderMultiColumnSet::multiColumnFlow const): Deleted.
754         (WebCore::RenderMultiColumnSet::logicalTopInFragmentedFlow const): Deleted.
755         (WebCore::RenderMultiColumnSet::logicalBottomInFragmentedFlow const): Deleted.
756         (WebCore::RenderMultiColumnSet::logicalHeightInFragmentedFlow const): Deleted.
757         (WebCore::RenderMultiColumnSet::computedColumnCount const): Deleted.
758         (WebCore::RenderMultiColumnSet::computedColumnWidth const): Deleted.
759         (WebCore::RenderMultiColumnSet::computedColumnHeight const): Deleted.
760         (WebCore::RenderMultiColumnSet::columnHeightComputed const): Deleted.
761         (WebCore::RenderMultiColumnSet::setComputedColumnWidthAndCount): Deleted.
762         (WebCore::RenderMultiColumnSet::updateMinimumColumnHeight): Deleted.
763         (WebCore::RenderMultiColumnSet::minimumColumnHeight const): Deleted.
764         (WebCore::RenderMultiColumnSet::forcedBreaksCount const): Deleted.
765         (WebCore::RenderMultiColumnSet::hasBeenFlowed const): Deleted.
766         (WebCore::RenderMultiColumnSet::skipLayerFragmentCollectionForColumn const): Deleted.
767         (WebCore::RenderMultiColumnSet::customBlockProgressionAdjustmentForColumn const): Deleted.
768         (WebCore::RenderMultiColumnSet::ContentRun::ContentRun): Deleted.
769         (WebCore::RenderMultiColumnSet::ContentRun::assumedImplicitBreaks const): Deleted.
770         (WebCore::RenderMultiColumnSet::ContentRun::assumeAnotherImplicitBreak): Deleted.
771         (WebCore::RenderMultiColumnSet::ContentRun::breakOffset const): Deleted.
772         (WebCore::RenderMultiColumnSet::ContentRun::columnLogicalHeight const): Deleted.
773         * rendering/RenderObject.h:
774         (WebCore::RenderObject::isRenderLinesClampFlow const): Deleted.
775         (WebCore::RenderObject::isRenderLinesClampSet const): Deleted.
776         * rendering/style/LineClampValue.h:
777         (WebCore::LinesClampValue::LinesClampValue): Deleted.
778         (WebCore::LinesClampValue::isNone const): Deleted.
779         (WebCore::LinesClampValue::operator== const): Deleted.
780         (WebCore::LinesClampValue::operator!= const): Deleted.
781         (WebCore::LinesClampValue::start const): Deleted.
782         (WebCore::LinesClampValue::end const): Deleted.
783         (WebCore::LinesClampValue::center const): Deleted.
784         * rendering/style/RenderStyle.h:
785         (WebCore::RenderStyle::lineClamp const):
786         (WebCore::RenderStyle::setLineClamp):
787         (WebCore::RenderStyle::initialLineClamp):
788         (WebCore::RenderStyle::hasInlineColumnAxis const):
789         (WebCore::RenderStyle::linesClamp const): Deleted.
790         (WebCore::RenderStyle::hasLinesClamp const): Deleted.
791         (WebCore::RenderStyle::setLinesClamp): Deleted.
792         (WebCore::RenderStyle::initialLinesClamp): Deleted.
793         * rendering/style/StyleRareNonInheritedData.cpp:
794         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
795         (WebCore::StyleRareNonInheritedData::operator== const):
796         * rendering/style/StyleRareNonInheritedData.h:
797         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
798         (WebCore::isValidColumnSpanner):
799         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
800         (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant):
801
802 2018-07-25  Chris Dumez  <cdumez@apple.com>
803
804         navigator.userAgent may return outdated value after webView.customUserAgent is set
805         https://bugs.webkit.org/show_bug.cgi?id=188009
806         <rdar://problem/42566456>
807
808         Reviewed by Alex Christensen.
809
810         Invalidate the navigator.userAgent cache whenever the user agent gets changed to avoid exposing
811         outdated values to JavaScript.
812
813         * page/Navigator.cpp:
814         (WebCore::Navigator::userAgentChanged):
815         * page/Navigator.h:
816         * page/NavigatorID.idl:
817         * page/Page.cpp:
818         (WebCore::Page::userAgentChanged):
819         * page/Page.h:
820
821 2018-07-25  David Fenton  <david_fenton@apple.com>
822
823         Unreviewed, rolling out r234187.
824
825         the layout test added with this change is flaky on the bots
826
827         Reverted changeset:
828
829         "Animation stops with object-fit:contain on an animated 2d
830         canvas"
831         https://bugs.webkit.org/show_bug.cgi?id=187840
832         https://trac.webkit.org/changeset/234187
833
834 2018-07-25  Chris Dumez  <cdumez@apple.com>
835
836         Turn assertion preventing removal of ActiveDOMObjects while we iterate over them into a RELEASE_ASSERT
837         https://bugs.webkit.org/show_bug.cgi?id=187978
838
839         Reviewed by Eric Carlson.
840
841         Turn assertion preventing removal of ActiveDOMObjects while we iterate over them into a RELEASE_ASSERT.
842         If code does this, this leads to hard to investigate crashes such as rdar://problem/42160890. With a
843         release assertion, we would find the culprits right away. The assertion guarding against addition of
844         ActiveDOMObjects while we iterate is already a RELEASE_ASSERT.
845
846         * dom/ScriptExecutionContext.cpp:
847         (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension):
848         (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
849         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
850         (WebCore::ScriptExecutionContext::willDestroyActiveDOMObject):
851         * dom/ScriptExecutionContext.h:
852
853 2018-07-24  Chris Dumez  <cdumez@apple.com>
854
855         REGRESSION (r219757): Accessing response getter of XHR instance from IFRAME sets constructor to Object from the IFRAME
856         https://bugs.webkit.org/show_bug.cgi?id=187411
857         <rdar://problem/41920593>
858
859         Reviewed by Sam Weinig.
860
861         Update JSXMLHttpRequest::response() to use the XMLHttpRequest's global object exec when constructing a JSONObject
862         for the response instead of the caller's exec.
863
864         Test: http/tests/xmlhttprequest/xhr-response-constructor-subframe.html
865
866         * bindings/js/JSXMLHttpRequestCustom.cpp:
867         (WebCore::JSXMLHttpRequest::response const):
868
869 2018-07-24  Simon Fraser  <simon.fraser@apple.com>
870
871         Animation stops with object-fit:contain on an animated 2d canvas
872         https://bugs.webkit.org/show_bug.cgi?id=187840
873
874         Reviewed by Zalan Bujtas.
875         
876         If a canvas has object-fit: cover or contain, repaints need to mapped through
877         the rect that is used to position the canvas in the element bounds, which is replacedContentRect().
878         
879         Add a version of replacedContentRect() that doesn't require passing the intrinsicSize() since
880         all but RenderVideo just pass the RenderReplaced's intrinsicSize.
881
882         Test: fast/repaint/canvas-object-fit.html
883
884         * html/HTMLCanvasElement.cpp:
885         (WebCore::HTMLCanvasElement::didDraw):
886         * rendering/RenderHTMLCanvas.cpp:
887         (WebCore::RenderHTMLCanvas::paintReplaced):
888         * rendering/RenderImage.cpp:
889         (WebCore::RenderImage::updateInnerContentRect):
890         (WebCore::RenderImage::paintReplaced):
891         * rendering/RenderLayerBacking.cpp:
892         (WebCore::RenderLayerBacking::contentsBox const):
893         * rendering/RenderReplaced.h:
894         (WebCore::RenderReplaced::replacedContentRect const):
895         * rendering/shapes/ShapeOutsideInfo.cpp:
896         (WebCore::ShapeOutsideInfo::createShapeForImage const):
897
898 2018-07-24  Basuke Suzuki  <Basuke.Suzuki@sony.com>
899
900         [Curl] Add support for wss:// websockets
901         https://bugs.webkit.org/show_bug.cgi?id=172630
902
903         Reviewed by Fujii Hironori.
904
905         To support secure WebSocket connection, it is almost rewritten by using existing
906         backend for CurlHandle to handle TLS connection and proxy support.
907
908         Test: http/tests/websocket/tests/hybi/simple-wss.html
909
910         * platform/network/curl/CurlContext.cpp:
911         (WebCore::CurlSocketHandle::CurlSocketHandle):
912         (WebCore::CurlSocketHandle::connect):
913         (WebCore::CurlSocketHandle::send):
914         (WebCore::CurlSocketHandle::receive):
915         (WebCore::CurlSocketHandle::wait):
916         * platform/network/curl/CurlContext.h:
917         * platform/network/curl/SocketStreamHandleImpl.h:
918         (WebCore::SocketStreamHandleImpl::SocketData::SocketData): Deleted.
919         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
920         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
921         (WebCore::SocketStreamHandleImpl::~SocketStreamHandleImpl):
922         (WebCore::SocketStreamHandleImpl::platformSendInternal):
923         (WebCore::SocketStreamHandleImpl::platformClose):
924         (WebCore::SocketStreamHandleImpl::threadEntryPoint):
925         (WebCore::SocketStreamHandleImpl::handleError):
926         (WebCore::SocketStreamHandleImpl::stopThread):
927         (WebCore::createCopy): Deleted.
928         (WebCore::SocketStreamHandleImpl::readData): Deleted.
929         (WebCore::SocketStreamHandleImpl::sendData): Deleted.
930         (WebCore::SocketStreamHandleImpl::waitForAvailableData): Deleted.
931         (WebCore::SocketStreamHandleImpl::startThread): Deleted.
932         (WebCore::SocketStreamHandleImpl::didReceiveData): Deleted.
933         (WebCore::SocketStreamHandleImpl::didOpenSocket): Deleted.
934
935 2018-07-24  Tim Horton  <timothy_horton@apple.com>
936
937         Enable Web Content Filtering on watchOS
938         https://bugs.webkit.org/show_bug.cgi?id=187979
939         <rdar://problem/42559346>
940
941         Reviewed by Wenson Hsieh.
942
943         * Configurations/FeatureDefines.xcconfig:
944
945 2018-07-24  Chris Dumez  <cdumez@apple.com>
946
947         Unreviewed, rolling out r233496 and r233571.
948
949         Likely cause of <rdar://problem/42160890> and
950         <rdar://problem/42329658> as ActiveDOMObjects can now be
951         constructed / destroyed while we are iterating over them.
952
953         Reverted changesets:
954
955         "Nullptr crash accessing Document in
956         GenericEventQueue::dispatchOneEvent()"
957         https://bugs.webkit.org/show_bug.cgi?id=187284
958         https://trac.webkit.org/changeset/233496
959
960         "REGRESSION(r233496): macOS Sierra hits debug assertions in
961         TrackListBase::suspend"
962         https://bugs.webkit.org/show_bug.cgi?id=187378
963         https://trac.webkit.org/changeset/233571
964
965 2018-07-24  Aditya Keerthi  <akeerthi@apple.com>
966
967         [Datalist][macOS] Display suggestions for input[type=color]
968         https://bugs.webkit.org/show_bug.cgi?id=187794
969
970         Reviewed by Tim Horton.
971
972         * html/ColorInputType.cpp:
973         (WebCore::ColorInputType::shouldRespectListAttribute):
974
975 2018-07-24  Ryan Haddad  <ryanhaddad@apple.com>
976
977         Unreviewed, rolling out r234121.
978
979         Caused perf test failures.
980
981         Reverted changeset:
982
983         "We should cache the compiled sandbox profile in a data vault"
984         https://bugs.webkit.org/show_bug.cgi?id=184991
985         https://trac.webkit.org/changeset/234121
986
987 2018-07-24  Antoine Quint  <graouts@apple.com>
988
989         [Web Animations] Add an ASSERT() to check the contract that a CSSTransition has a valid effect in setTimingProperties()
990         https://bugs.webkit.org/show_bug.cgi?id=187954
991
992         Reviewed by Dean Jackson.
993
994         * animation/CSSTransition.cpp:
995         (WebCore::CSSTransition::setTimingProperties):
996
997 2018-07-24  Antoine Quint  <graouts@apple.com>
998
999         [Web Animations] Crash when setting an animation style on an existing animation that had its effect set to null
1000         https://bugs.webkit.org/show_bug.cgi?id=187953
1001
1002         Reviewed by Dean Jackson.
1003
1004         Test: webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect.html
1005
1006         Ensure that we have a valid effect before proceeding to update its timing. 
1007
1008         * animation/CSSAnimation.cpp:
1009         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
1010
1011 2018-07-24  Eric Carlson  <eric.carlson@apple.com>
1012
1013         [MediaStream] Restructure getDisplayMedia classes
1014         https://bugs.webkit.org/show_bug.cgi?id=187905
1015         <rdar://problem/42500215>
1016
1017         Unreviewed build fix.
1018
1019         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: 
1020
1021 2018-07-24  Antoine Quint  <graouts@apple.com>
1022
1023         [Web Animations] Crash when setting "animation: none" after clearing an animation's effect
1024         https://bugs.webkit.org/show_bug.cgi?id=187952
1025
1026         Reviewed by Dean Jackson.
1027
1028         Test: webanimations/setting-css-animation-none-after-clearing-effect.html
1029
1030         We need to ensure that the animation we're trying to remove has not had its effect cleared via the
1031         Web Animations API since its creation before trying to check its phase.
1032
1033         * animation/AnimationTimeline.cpp:
1034         (WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation):
1035
1036 2018-07-24  Antoine Quint  <graouts@apple.com>
1037
1038         [Web Animations] Crash accessing CSSAnimation::bindingsCurrentTime when effect has been set to null
1039         https://bugs.webkit.org/show_bug.cgi?id=187950
1040         <rdar://problem/42515747>
1041
1042         Reviewed by Dean Jackson.
1043
1044         Test: webanimations/accessing-current-time-after-clearing-css-animation-effect.html
1045
1046         While a CSSAnimation has an effect created for it by the implementation, the developer may yet manipulate
1047         its effect via the Web Animations API and set it to null. As such, we must not assume it's always non-null.
1048
1049         * animation/CSSAnimation.cpp:
1050         (WebCore::CSSAnimation::bindingsCurrentTime const):
1051
1052 2018-07-24  Zalan Bujtas  <zalan@apple.com>
1053
1054         [LFC][IFC] BlockContainer::establishesInlineFormattingContext should only check the first inflow child.
1055         https://bugs.webkit.org/show_bug.cgi?id=187965
1056
1057         Reviewed by Antti Koivisto.
1058
1059         * layout/layouttree/LayoutBlockContainer.cpp:
1060         (WebCore::Layout::BlockContainer::establishesInlineFormattingContext const):
1061
1062 2018-07-24  Myles C. Maxfield  <mmaxfield@apple.com>
1063
1064         [Cocoa] Stop crashing in lastResortFallbackFont()
1065         https://bugs.webkit.org/show_bug.cgi?id=187936
1066
1067         Reviewed by Jon Lee.
1068
1069         CoreText can get into a state where both Times and Lucida Grande are inaccessible.
1070         Instead of crashing, we should use the real LastResort, which is backed by a section
1071         in the .rodata of the CoreText dylib, and as such should always exist.
1072
1073         * platform/graphics/FontCache.cpp:
1074         (WebCore::FontCache::fontForFamily):
1075         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1076         (WebCore::FontCache::lastResortFallbackFont):
1077
1078 2018-07-24  Daniel Bates  <dabates@apple.com>
1079
1080         Cannot view PDF's on my.gov.au: "Refused to load https://my.gov.au/attachment/viewAttachment because it
1081         appears in neither the object-src directive nor the default-src directive of the Content Security Policy"
1082         https://bugs.webkit.org/show_bug.cgi?id=187870
1083         <rdar://problem/41190880>
1084
1085         Reviewed by Dean Jackson.
1086
1087         Fixes an issue where opening attachments on my.gov.au would show a "Blocked Plug-in" message.
1088
1089         Opening an attachment on my.gov.au opens a same-origin plugin document in a child window. Currently
1090         same-origin plugin documents inherit their CSP policy from their opener. If the opener's CSP policy
1091         disallows embedding plugins then the plugin document would be blocked from loading a plugin. For now
1092         we relax the inheritance model such that we only inherit the plugin-types and report-uri directives
1093         from the opener.
1094
1095         Developers that want to block plugin content from being loaded in a same-origin child window must now
1096         serve such plugin content with a CSP policy that includes "object-src 'none'". This matches the behavior
1097         described in the second Note in section object-src of the CSP 3 spec: <https://w3c.github.io/webappsec-csp/#directive-object-src>
1098         (Editor's Draft, 10 July 2018). It also makes the behavior in WebKit more closely aligned with the
1099         behavior of Chrome and Firefox.
1100
1101         Tests: http/tests/security/contentSecurityPolicy/same-origin-plugin-document-allowed-in-child-window.html
1102                http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window-report.php
1103                http/tests/security/contentSecurityPolicy/same-origin-plugin-document-with-csp-blocked-in-child-window.html
1104
1105         * dom/Document.cpp:
1106         (WebCore::Document::initContentSecurityPolicy): For plugin documents that have an opener call ContentSecurityPolicy::createPolicyForPluginDocumentFrom()
1107         to only inherit the plugin-types and report-uri directives from its opener's CSP policy. Otherwise, call ContentSecurityPolicy::copyStateFrom()
1108         to inherit all directives from the owner frame as we do now.
1109         * page/csp/ContentSecurityPolicy.cpp:
1110         (WebCore::ContentSecurityPolicy::createPolicyForPluginDocumentFrom): Create a new policy from the specified policy
1111         inheriting only the plugin-types and report-uri directives.
1112         * page/csp/ContentSecurityPolicy.h: Define a new PolicyFrom enumerator, InheritedForPluginDocument, for plugin documents
1113         loaded in a child window.
1114         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
1115         (WebCore::ContentSecurityPolicyDirectiveList::parse): When policyFrom is InheritedForPluginDocument then only
1116         recognize the plugin-types and report-uri directives when parsing the policy.
1117
1118 2018-07-24  Daniel Bates  <dabates@apple.com>
1119
1120         Rename Document::firstPartyForSameSiteCookies() to siteForCookies()
1121         https://bugs.webkit.org/show_bug.cgi?id=187892
1122
1123         Reviewed by Dean Jackson.
1124
1125         Standardize on the spec. language "site for cookies" for the names of the setter and getter
1126         on Document. The latest description of Same-Site cookies is in <https://httpwg.org/http-extensions/rfc6265bis.html>.
1127
1128         No functionality changed. So, no new tests.
1129
1130         * dom/Document.h:
1131         (WebCore::Document::siteForCookies const):
1132         (WebCore::Document::setSiteForCookies):
1133         (WebCore::Document::firstPartyForSameSiteCookies const): Deleted.
1134         (WebCore::Document::setFirstPartyForSameSiteCookies): Deleted.
1135         * loader/FrameLoader.cpp:
1136         (WebCore::FrameLoader::setFirstPartyForCookies):
1137         (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded):
1138         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1139         (WebCore::createPageForServiceWorker):
1140         * xml/XSLTProcessor.cpp:
1141         (WebCore::XSLTProcessor::createDocumentFromSource):
1142
1143 2018-07-24  Ross Kirsling  <ross.kirsling@sony.com>
1144
1145         WebCore::URL::hostIsIPAddress needs a Windows implementation
1146         https://bugs.webkit.org/show_bug.cgi?id=187859
1147
1148         Reviewed by Fujii Hironori.
1149
1150         * platform/URL.cpp:
1151         (WebCore::isIPv4Address): Added.
1152         (WebCore::isIPv6Address): Added.
1153         (WebCore::URL::hostIsIPAddress):
1154         Turn this stub into a platform-agnostic default implementation.
1155
1156 2018-07-24  Eric Carlson  <eric.carlson@apple.com>
1157
1158         [MediaStream] Restructure getDisplayMedia classes
1159         https://bugs.webkit.org/show_bug.cgi?id=187905
1160
1161         Reviewed by Dean Jackson.
1162
1163         No new tests, no functional changes.
1164
1165         * platform/mediastream/CaptureDeviceManager.h:
1166         (WebCore::CaptureDeviceManager::refreshCaptureDevices): Deleted, no need for it to be a 
1167         virtual method.
1168         * platform/mediastream/mac/AVCaptureDeviceManager.h:
1169
1170         * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h: refreshCaptureDevices is
1171         no longer virtual.
1172
1173         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
1174         (WebCore::DisplayCaptureManagerCocoa::captureDevices):
1175         (WebCore::DisplayCaptureManagerCocoa::updateDisplayCaptureDevices): Moved functionality 
1176         to ScreenDisplayCaptureSourceMac.
1177         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): Ditto.
1178         (WebCore::displayReconfigurationCallBack): Deleted, moved to ScreenDisplayCaptureSourceMac.
1179         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa): Deleted.
1180         (WebCore::DisplayCaptureManagerCocoa::refreshCaptureDevices): Deleted.
1181         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
1182
1183         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
1184         (WebCore::roundUpToMacroblockMultiple): Moved from ScreenDisplayCaptureSourceMac.
1185         (WebCore::DisplayCaptureSourceCocoa::applySize): Ditto.
1186         (WebCore::DisplayCaptureSourceCocoa::sampleBufferFromPixelBuffer): Ditto.
1187         (WebCore::DisplayCaptureSourceCocoa::pixelBufferFromIOSurface): Ditto.
1188         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
1189
1190         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
1191         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
1192         (WebCore::updateDisplayID):
1193         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Fix log message.
1194         (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream): Ditto.
1195         (WebCore::ScreenDisplayCaptureSourceMac::applySize): Update for base class changes.
1196         (WebCore::ScreenDisplayCaptureSourceMac::applyFrameRate): Ditto.
1197         (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable): Ditto.
1198         (WebCore::ScreenDisplayCaptureSourceMac::screenCaptureDeviceWithPersistentID): Moved from
1199         DisplayCaptureManagerCocoa.
1200         (WebCore::ScreenDisplayCaptureSourceMac::screenCaptureDevices): Ditto.
1201         (WebCore::roundUpToMacroblockMultiple): Moved to DisplayCaptureSourceCocoa.
1202         (WebCore::ScreenDisplayCaptureSourceMac::updateDisplayID): Ditto.
1203         (WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer): Ditto.
1204         (WebCore::ScreenDisplayCaptureSourceMac::pixelBufferFromIOSurface): Ditto.
1205
1206 2018-07-24  Zalan Bujtas  <zalan@apple.com>
1207
1208         [LFC] Move geometry data structures to a dedicated file
1209         https://bugs.webkit.org/show_bug.cgi?id=187939
1210
1211         Reviewed by Antti Koivisto.
1212
1213         * WebCore.xcodeproj/project.pbxproj:
1214         * layout/FormattingContext.h:
1215         (WebCore::Layout::FormattingContext::Geometry::Position::operator LayoutPoint const): Deleted.
1216         * layout/FormattingContextGeometry.cpp:
1217         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
1218         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1219         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1220         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1221         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
1222         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1223         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
1224         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
1225         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
1226         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
1227         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
1228         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
1229         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1230         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1231         (WebCore::Layout::FormattingContext::Geometry::computedBorder):
1232         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
1233         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
1234         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
1235         * layout/blockformatting/BlockFormattingContext.h:
1236         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1237         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1238         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1239         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
1240         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
1241         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
1242         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1243         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
1244         * layout/displaytree/DisplayBox.h:
1245         (WebCore::Display::Box::setHorizontalMargin):
1246         (WebCore::Display::Box::setVerticalMargin):
1247         (WebCore::Display::Box::setVerticalNonCollapsedMargin):
1248         (WebCore::Display::Box::setBorder):
1249         (WebCore::Display::Box::setPadding):
1250
1251 2018-07-24  Thibault Saunier  <tsaunier@igalia.com>
1252
1253         [GStreamer] Implement bitrate modulation support in GStreamer based libwebrtc Encoders
1254         https://bugs.webkit.org/show_bug.cgi?id=187643
1255
1256         Reviewed by Philippe Normand.
1257
1258         Problem being that we do not have a proper unified encoder API in GStreamer, some work
1259         started at https://bugzilla.gnome.org/show_bug.cgi?id=796716 but it is quite controversial
1260         and meanwhile we should just move forward working around that limitation.
1261
1262         Source/WebCore:
1263         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
1264         (WebCore::GStreamerVideoEncoder::GStreamerVideoEncoder):
1265         (WebCore::GStreamerVideoEncoder::InitEncode):
1266         (WebCore::GStreamerVideoEncoder::getBitrateSetter):
1267         (WebCore::GStreamerVideoEncoder::createEncoder):
1268         (WebCore::GStreamerVideoEncoder::AddCodecIfSupported):
1269         (WebCore::GStreamerVideoEncoder::SetRestrictionCaps):
1270         (WebCore::GStreamerVideoEncoder::CreateEncoder): Deleted.
1271
1272 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
1273
1274         REGRESSION(r234055): inverted return values in MediaPlayer::wouldTaintOrigin()
1275         https://bugs.webkit.org/show_bug.cgi?id=187944
1276
1277         Reviewed by Carlos Garcia Campos.
1278
1279         The MediaPlayer::wouldTaintOrigin(), as introduced in r234055, should
1280         return false when the URL protocol is `data:`, and should return true
1281         when the given SecurityOrigin cannot access the media URL.
1282
1283         This matches behavior of CanvasRenderingContext::wouldTaintOrigin()
1284         which the new method falls back to when the MediaPlayerPrivate
1285         implementation doesn't or can't determine the would-taint result.
1286
1287         This fixes a bunch of failing and timing-out WebGL test cases on ports
1288         using GStreamer (on which the MediaPlayerPrivate derivate doesn't
1289         implement the wouldTaintOrigin() method).
1290
1291         * platform/graphics/MediaPlayer.cpp:
1292         (WebCore::MediaPlayer::wouldTaintOrigin const):
1293
1294 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
1295
1296         [TextureMapper] Separate repaint counter state from debug visuals
1297         https://bugs.webkit.org/show_bug.cgi?id=187946
1298
1299         Reviewed by Carlos Garcia Campos.
1300
1301         Instead of managing the repaint counter visibility along with the
1302         debug border visuals, do that together with the repaint count value.
1303
1304         TextureMapperLayer::setRepaintCount() is renamed to setRepaintCounter()
1305         and now also sets the repaint counter visibility state instead of the
1306         setDebugVisuals() method.
1307
1308         GraphicsLayerTextureMapper implementation is adjusted appropriately.
1309         The unused setRepaintCount() method is also removed.
1310
1311         CoordinatedGraphicsLayerState now holds repaint counter state (both
1312         visibility and count value) in a struct that's separate from debug
1313         border state. CoordinatedGraphicsLayer implementation now updates
1314         that state accordingly.
1315
1316         No new tests -- no change in behavior.
1317
1318         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
1319         (WebCore::GraphicsLayerTextureMapper::setShowRepaintCounter):
1320         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
1321         (WebCore::GraphicsLayerTextureMapper::setRepaintCount): Deleted.
1322         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
1323         * platform/graphics/texmap/TextureMapperLayer.cpp:
1324         (WebCore::TextureMapperLayer::setDebugVisuals):
1325         (WebCore::TextureMapperLayer::setRepaintCounter):
1326         (WebCore::TextureMapperLayer::setRepaintCount): Deleted.
1327         * platform/graphics/texmap/TextureMapperLayer.h:
1328         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1329         (WebCore::CoordinatedGraphicsLayer::didUpdateTileBuffers):
1330         (WebCore::CoordinatedGraphicsLayer::setShowRepaintCounter):
1331         (WebCore::CoordinatedGraphicsLayer::syncLayerState):
1332         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
1333         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
1334         (WebCore::DebugVisuals::DebugVisuals): Deleted.
1335
1336 2018-07-24  Thibault Saunier  <tsaunier@igalia.com>
1337
1338         [WPE][GTK] Implement PeerConnection API on top of libwebrtc
1339         https://bugs.webkit.org/show_bug.cgi?id=186932
1340
1341         Reviewed by Philippe Normand.
1342
1343         Enabled many webrtc tests.
1344
1345         * platform/GStreamer.cmake: Build new files
1346         * platform/graphics/gstreamer/GStreamerCommon.cpp: Fix minor style issues
1347         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: Add a way to give precise name to pipelines
1348         and give useful names to pipelines with sources comming from a PeerConnection
1349         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Ditto.
1350         * platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.cpp: Added. Implement a subclass of webrtc::VideoFrame
1351         to represent a kNative GStreamer video frame.
1352         * platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.h: Added. Ditto.
1353         * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp: Handle incoming audio samples from libwebrtc.
1354         * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.h: Ditto.
1355         * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp: Handle incoming video frames from libwebrtc.
1356         * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h: Ditto.
1357         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp: Handle passing locally captured audio sample to libwebrtc.
1358         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h: Ditto.
1359         * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp: Handle passing locally captured vidoe frames to libwebrtc.
1360         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp: Added. Implement a video decoder factory and LibWebRTC Video decoders based on GStreamer.
1361         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.h: Added. Ditto.
1362         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp: Added. Implement a video encoder factory and LibWebRTC H264/VP8 Video encoders based on GStreamer.
1363         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.h: Added. Ditto.
1364         * platform/mediastream/libwebrtc/LibWebRTCAudioFormat.h: Add information about signness of the LibWebRTC audio format.
1365         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp: Add support for newly added Encoder/Decoder factories.
1366         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.h: Ditto.
1367
1368 2018-07-24  Dirk Schulze  <krit@webkit.org>
1369
1370         [css-masking] Black backdrop on -webkit-clip-path on SVG root
1371         https://bugs.webkit.org/show_bug.cgi?id=187880
1372
1373         Reviewed by Simon Fraser.
1374
1375         For SVG document root elements, we currently clip twice:
1376         In RenderLayer and SVGRenderSupport.
1377         Avoid clipping in RenderLayer which currently clips before we established a
1378         backdrop for an SVG document.
1379
1380         Tests: svg/clip-path/clip-path-on-svg-005-expected.svg
1381                svg/clip-path/clip-path-on-svg-005.svg
1382
1383         * rendering/RenderLayer.cpp:
1384         (WebCore::RenderLayer::setupClipPath): Skip actual clipping.
1385
1386 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
1387
1388         [Nicosia] Add TextureMapperAnimations member to CompositingLayer::LayerState
1389         https://bugs.webkit.org/show_bug.cgi?id=187941
1390
1391         Reviewed by Carlos Garcia Campos.
1392
1393         Nicosia::CompositingLayer::LayerState gains a TextureMapperAnimations
1394         member that will be assigned a list of all active animations during each
1395         layer flush. Despite the name, TextureMapperAnimations doesn't depend on
1396         any other TextureMapper class. It might be renamed and moved in the
1397         future, but for now it's used as-is.
1398
1399         In CoordinatedGraphicsLayer, the syncAnimations() method now flips on
1400         the animationsChanged flag in the LayerState::Delta struct. This causes
1401         all the active animations to be copied over into the layer state in
1402         flushCompositingStateForThisLayerOnly().
1403
1404         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
1405         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1406         (WebCore::CoordinatedGraphicsLayer::syncAnimations):
1407         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
1408
1409 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
1410
1411         [Nicosia] Add FilterOperations member to CompositionLayer::LayerState
1412         https://bugs.webkit.org/show_bug.cgi?id=187901
1413
1414         Reviewed by Carlos Garcia Campos.
1415
1416         Nicosia::CompositionLayer::LayerState gains a FilterOperations member
1417         that can be assigned the list of filter operations for a given layer.
1418         The corresponding filtersChanged boolean is added to LayerState::Delta.
1419
1420         CoordinatedGraphicsLayer::syncFilters() flips on that delta member,
1421         which in turn causes the FilterOperations value to be updated during
1422         the layer flush, in flushCompositingStateForThisLayerOnly().
1423
1424         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
1425         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1426         (WebCore::CoordinatedGraphicsLayer::syncFilters):
1427         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
1428
1429 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
1430
1431         [CoordGraphics] Use adjusted position, anchor point, size values for Nicosia::CompositionLayer state
1432         https://bugs.webkit.org/show_bug.cgi?id=187899
1433
1434         Reviewed by Carlos Garcia Campos.
1435
1436         As is done for the CoordinatedGraphicsLayerState, the scale-adjusted
1437         position, anchor point and size values should be used when updating the
1438         corresponding Nicosia::CompositionLayer::LayerState members.
1439
1440         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1441         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
1442
1443 2018-07-23  Manuel Rego Casasnovas  <rego@igalia.com>
1444
1445         [css-grid] Add support for calc() in gutter properties
1446         https://bugs.webkit.org/show_bug.cgi?id=187902
1447
1448         Reviewed by Simon Fraser.
1449
1450         The parsing was already accepting calc() in grid row and column gaps,
1451         however the code was not taking that into account properly.
1452         If the calc() had a percentage it was ignored and that's wrong.
1453
1454         The fix is just a change in the ceck at RenderGrid::availableSpaceForGutters().
1455
1456         Tests: imported/w3c/web-platform-tests/css/css-grid/abspos/grid-positioned-items-gaps-002-rtl.html
1457                imported/w3c/web-platform-tests/css/css-grid/abspos/grid-positioned-items-gaps-002.html
1458                imported/w3c/web-platform-tests/css/css-grid/alignment/grid-gutters-011.html
1459                imported/w3c/web-platform-tests/css/css-grid/alignment/grid-gutters-012.html
1460
1461         * rendering/RenderGrid.cpp:
1462         (WebCore::RenderGrid::availableSpaceForGutters const):
1463
1464 2018-07-23  Aditya Keerthi  <akeerthi@apple.com>
1465
1466         Remove extraneous #endif in html.css
1467         https://bugs.webkit.org/show_bug.cgi?id=187934
1468
1469         Reviewed by Tim Horton.
1470
1471         * css/html.css: Remove extraneous #endif.
1472
1473 2018-07-23  Sihui Liu  <sihui_liu@apple.com>
1474
1475         CrashTracer: com.apple.WebKit.Storage at WebCore: WebCore::encodeKey
1476         https://bugs.webkit.org/show_bug.cgi?id=187927
1477
1478         Reviewed by Chris Dumez.
1479
1480         IDBKeyData is valid only when each key of it is valid.
1481
1482         Test: LayoutTests/storage/indexeddb/index-multientry.html
1483
1484         * Modules/indexeddb/IDBKeyData.cpp:
1485         (WebCore::IDBKeyData::isValid const):
1486         * Modules/indexeddb/IDBKeyData.h:
1487         (WebCore::IDBKeyData::isValid const): Deleted.
1488
1489 2018-07-23  Ben Richards  <benton_richards@apple.com>
1490
1491         We should cache the compiled sandbox profile in a data vault
1492         https://bugs.webkit.org/show_bug.cgi?id=184991
1493
1494         Reviewed by Ryosuke Niwa.
1495
1496         Added functionality to FileHandle so that it can lock a file while open.
1497         Added a function to FileSystem to delete non empty directories.
1498
1499         * platform/FileHandle.cpp:
1500         (WebCore::FileHandle::FileHandle):
1501         (WebCore::FileHandle::open):
1502         (WebCore::FileHandle::close):
1503         * platform/FileHandle.h:
1504         * platform/FileSystem.h:
1505         * platform/cocoa/FileSystemCocoa.mm:
1506         (WebCore::FileSystem::deleteNonEmptyDirectory):
1507
1508 2018-07-23  Justin Fan  <justin_fan@apple.com>
1509
1510         [macOS] Ensure that WebGL contexts are always set to an accelerated virtual screen
1511         https://bugs.webkit.org/show_bug.cgi?id=187923
1512
1513         Reviewed by Dean Jackson.
1514
1515         On eGPU displays, it is possible that CGL does not match the preferred renderer. 
1516         In this case, and when the web process is blocked from accessing the window server, 
1517         3D contexts *may* default to the software renderer. Ensure that even if this occurs,
1518         we set the context to use a hardware-accelerated renderer/virtual screen.
1519
1520         No new tests. Existing behavior covered by existing tests.
1521         Requires multiple screens, at least one attached to an eGPU, to stress. 
1522
1523         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
1524         (WebCore::identifyAndSetCurrentGPU):
1525
1526 2018-07-23  Sam Weinig  <sam@webkit.org>
1527
1528         Convert some obvious never-null pointers to references in the editing code
1529         https://bugs.webkit.org/show_bug.cgi?id=187914
1530
1531         Reviewed by Dean Jackson.
1532
1533         Fixup trivial cases of never-null pointers that really should be references.
1534
1535         * editing/ApplyStyleCommand.cpp:
1536         (WebCore::ApplyStyleCommand::shouldApplyInlineStyleToRun):
1537         (WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
1538         (WebCore::ApplyStyleCommand::removeImplicitlyStyledElement):
1539         (WebCore::ApplyStyleCommand::removeCSSStyle):
1540         (WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
1541         (WebCore::ApplyStyleCommand::applyInlineStyleChange):
1542         * editing/EditingStyle.cpp:
1543         (WebCore::EditingStyle::overrideWithStyle):
1544         (WebCore::EditingStyle::conflictsWithInlineStyleOfElement const):
1545         (WebCore::EditingStyle::conflictsWithImplicitStyleOfElement const):
1546         (WebCore::EditingStyle::conflictsWithImplicitStyleOfAttributes const):
1547         (WebCore::EditingStyle::extractConflictingImplicitStyleOfAttributes const):
1548         (WebCore::EditingStyle::styleIsPresentInComputedStyleOfNode const):
1549         (WebCore::EditingStyle::elementIsStyledSpanOrHTMLEquivalent):
1550         (WebCore::EditingStyle::mergeInlineStyleOfElement):
1551         (WebCore::EditingStyle::wrappingStyleForSerialization):
1552         (WebCore::EditingStyle::legacyFontSize const):
1553         (WebCore::StyleChange::StyleChange):
1554         (WebCore::StyleChange::extractTextStyles):
1555         (WebCore::legacyFontSizeFromCSSValue):
1556         * editing/EditingStyle.h:
1557         (WebCore::EditingStyle::conflictsWithInlineStyleOfElement const):
1558         * editing/Editor.cpp:
1559         (WebCore::Editor::selectionStartCSSPropertyValue):
1560         * editing/ReplaceSelectionCommand.cpp:
1561         (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
1562         (WebCore::isInlineNodeWithStyle):
1563         * editing/markup.cpp:
1564         (WebCore::StyledMarkupAccumulator::appendElement):
1565         (WebCore::StyledMarkupAccumulator::serializeNodes):
1566
1567 2018-07-23  Per Arne Vollan  <pvollan@apple.com>
1568
1569         WebCore::primaryScreenDisplayID() always return 0
1570         https://bugs.webkit.org/show_bug.cgi?id=187922
1571         <rdar://problem/42286933>
1572
1573         Reviewed by Geoffrey Garen.
1574
1575         This function should return a valid display ID.
1576
1577         No new tests. Testing this requires a dual monitor setup.
1578
1579         * platform/mac/PlatformScreenMac.mm:
1580         (WebCore::primaryScreenDisplayID):
1581
1582 2018-07-23  Nan Wang  <n_wang@apple.com>
1583
1584         AX: Press tab to highlight items on a webpage is not working with voiceover enabled
1585         https://bugs.webkit.org/show_bug.cgi?id=187824
1586
1587         Reviewed by Zalan Bujtas.
1588
1589         We are deferring posting focused element change notification when the document needs a
1590         style recalculation. However, we only perform the cache update after a layout is completed.
1591         Added a timer to perform the cache update in the next runloop when non-layout type of mutation
1592         happens.
1593         
1594         Test: accessibility/mac/tab-focus-post-notification.html
1595
1596         * accessibility/AXObjectCache.cpp:
1597         (WebCore::AXObjectCache::AXObjectCache):
1598         (WebCore::AXObjectCache::~AXObjectCache):
1599         (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded):
1600         (WebCore::AXObjectCache::performCacheUpdateTimerFired):
1601         * accessibility/AXObjectCache.h:
1602         (WebCore::AXObjectCache::AXObjectCache):
1603         (WebCore::AXObjectCache::performCacheUpdateTimerFired):
1604
1605 2018-07-23  Chris Dumez  <cdumez@apple.com>
1606
1607         WebResourceLoadStatisticsStore fails to unregister itself as a MessageReceiver in its destructor
1608         https://bugs.webkit.org/show_bug.cgi?id=187910
1609         <rdar://problem/42356526>
1610
1611         Reviewed by Brent Fulgham.
1612
1613         Add internals API that causes the ResourceLoadObserver to notify its observer, and avoid waiting
1614         for the 5 second delay.
1615
1616         * testing/Internals.cpp:
1617         (WebCore::Internals::notifyResourceLoadObserver):
1618         * testing/Internals.h:
1619         * testing/Internals.idl:
1620
1621 2018-07-23  Zalan Bujtas  <zalan@apple.com>
1622
1623         [LCF][IFC] Add support for hyphenation.
1624         https://bugs.webkit.org/show_bug.cgi?id=187913
1625
1626         Reviewed by Antti Koivisto.
1627
1628         Move the hyphenation logic over from SimpleLineLayout::TextFragmentIterator.
1629
1630         * layout/inlineformatting/textlayout/Runs.h:
1631         (WebCore::Layout::TextRun::hasHyphen const):
1632         (WebCore::Layout::LayoutRun::setHasHyphen):
1633         (WebCore::Layout::LayoutRun::hasHyphen const):
1634         (WebCore::Layout::LayoutRun::LayoutRun):
1635         (WebCore::Layout::TextRun::createNonWhitespaceRunWithHyphen):
1636         (WebCore::Layout::TextRun::TextRun):
1637         * layout/inlineformatting/textlayout/TextContentProvider.cpp:
1638         (WebCore::Layout::TextContentProvider::findTextItemSlow const):
1639         (WebCore::Layout::TextContentProvider::width const):
1640         (WebCore::Layout::TextContentProvider::hyphenPositionBefore const):
1641         * layout/inlineformatting/textlayout/TextContentProvider.h:
1642         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp:
1643         (WebCore::Layout::SimpleLineBreaker::Line::setTextAlign):
1644         (WebCore::Layout::SimpleLineBreaker::Line::justifyRuns):
1645         (WebCore::Layout::SimpleLineBreaker::Line::adjustRunsForTextAlign):
1646         (WebCore::Layout::SimpleLineBreaker::Line::collectExpansionOpportunities):
1647         (WebCore::Layout::SimpleLineBreaker::Line::closeLastRun):
1648         (WebCore::Layout::SimpleLineBreaker::Line::append):
1649         (WebCore::Layout::SimpleLineBreaker::Line::reset):
1650         (WebCore::Layout::SimpleLineBreaker::Style::Style):
1651         (WebCore::Layout::SimpleLineBreaker::handleLineEnd):
1652         (WebCore::Layout::SimpleLineBreaker::createRunsForLine):
1653         (WebCore::Layout::SimpleLineBreaker::hyphenPositionBefore const):
1654         (WebCore::Layout::SimpleLineBreaker::adjustSplitPositionWithHyphenation const):
1655         (WebCore::Layout::SimpleLineBreaker::split const):
1656         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.h:
1657
1658 2018-07-23  Antoine Quint  <graouts@apple.com>
1659
1660         [Web Animations] Querying the current time of a finished CSSAnimation after removing its target leads to a crash
1661         https://bugs.webkit.org/show_bug.cgi?id=187906
1662
1663         Reviewed by Dean Jackson.
1664
1665         Test: webanimations/accessing-current-time-after-finished-css-animation-target-removal.html
1666
1667         Because we carelessly look at a CSSAnimation's effect's timing in DeclarativeAnimation::bindingsCurrentTime
1668         without checking that the effect is non-null, we can crash in the case where the animation is finished and
1669         its target element has been removed, which caused the effect to be set to null.
1670
1671         We do not actually fix the lack of a null check, which will be the scope of a different patch, but instead
1672         ensure that we do _not_ set the animation's effect to null when its target is removed, which used to be
1673         performed via a call to WebAnimation::remove(). Instead, we introduce AnimationTimeline::elementWasRemoved()
1674         which notifies the timeline of an element being removed such that we may stop referencing any animation
1675         targeting this element from the various data structures holding strong references to the animation in question,
1676         and we then cancel the animation silently, which is a new option that ensures promises aren't resolved or
1677         rejected as a result.
1678
1679         Finally, the WebAnimation and AnimationEffectReadOnly classes established a ref-cycle as WebAnimation has
1680         `RefPtr<AnimationEffectReadOnly> m_effect` and AnimationEffectReadOnly has `RefPtr<WebAnimation> m_animation`.
1681         While it is correct that WebAnimation owns its effect, which is established by the DOM API, the
1682         reverse is not correct since we only hold the reverse internally for the benefit of our implementation.
1683         As such, we change AnimationEffectReadOnly's m_animation to be a WeakPtr<WebAnimation>. This means not
1684         calling WebAnimation::remove() and simply removing the animation from the animation maps on the timeline
1685         is sufficient to guarantee that the document timeline will not leak (and with it the document).
1686
1687         * animation/AnimationEffectReadOnly.h:
1688         (WebCore::AnimationEffectReadOnly::setAnimation):
1689         * animation/AnimationTimeline.cpp:
1690         (WebCore::AnimationTimeline::elementWasRemoved):
1691         * animation/AnimationTimeline.h:
1692         * animation/WebAnimation.cpp:
1693         (WebCore::WebAnimation::cancel):
1694         (WebCore::WebAnimation::resetPendingTasks):
1695         * animation/WebAnimation.h:
1696         * dom/Element.cpp:
1697         (WebCore::Element::removedFromAncestor):
1698         * rendering/updating/RenderTreeUpdater.cpp:
1699         (WebCore::RenderTreeUpdater::tearDownRenderers):
1700
1701 2018-07-23  Aditya Keerthi  <akeerthi@apple.com>
1702
1703         [iOS] Add support for input[type=color]
1704         https://bugs.webkit.org/show_bug.cgi?id=187871
1705
1706         Reviewed by Tim Horton.
1707
1708         * css/html.css: Remove unwanted styling for color inputs with a list attribute.
1709         * html/ColorInputType.cpp: Make the element focusable.
1710         (WebCore::ColorInputType::isMouseFocusable const):
1711         (WebCore::ColorInputType::isKeyboardFocusable const):
1712         * html/ColorInputType.h:
1713         * html/HTMLInputElement.h: Expose isColorControl() to WebKit.
1714         * page/Chrome.cpp:
1715         (WebCore::Chrome::createColorChooser):
1716
1717 2018-07-22  Dean Jackson  <dino@apple.com>
1718
1719         fullscreen env() variables should have initial values
1720         https://bugs.webkit.org/show_bug.cgi?id=187897
1721         <rdar://problem/42485682>
1722
1723         Reviewed by Sam Weinig.
1724
1725         The env() values for fullscreen properties need to be
1726         initialized, rather than wait for values to be set from WebKit.
1727         Without this, feature detection doesn't work, and properties
1728         won't parse correctly.
1729
1730         Test: fullscreen/fullscreen-env-initial.html
1731
1732         * dom/ConstantPropertyMap.cpp:
1733         (WebCore::ConstantPropertyMap::buildValues): Initialize the fullscreen values.
1734         (WebCore::ConstantPropertyMap::updateConstantsForFullscreen): Renamed function, because it
1735         also updates the duration value.
1736         (WebCore::ConstantPropertyMap::didChangeFullscreenInsets): Call new name.
1737         (WebCore::ConstantPropertyMap::updateConstantsForFullscreenInsets): Deleted.
1738         * dom/ConstantPropertyMap.h:
1739         * page/Page.cpp:
1740         (WebCore::Page::setFullscreenAutoHideDuration): Don't change the value if it doesn't need it.
1741         * page/Page.h: Add accessor for fullscreenAutoHideDuration. Also add a member variable.
1742         (WebCore::Page::fullscreenAutoHideDuration const):
1743
1744 2018-07-22  Zalan Bujtas  <zalan@apple.com>
1745
1746         [LFC][IFC] Add center/right/justify line alignment support.
1747         https://bugs.webkit.org/show_bug.cgi?id=187890
1748
1749         Reviewed by Antti Koivisto.
1750
1751         Move over some more code from simple line layout.
1752         (though text-align: justify is more preformant as now expansion opportunities are added as we process the text runs
1753         -as opposed to iterting through the runs again when we reach the end of the line.) 
1754
1755         * layout/inlineformatting/textlayout/Runs.h:
1756         (WebCore::Layout::LayoutRun::setLeft):
1757         (WebCore::Layout::LayoutRun::setExpansion):
1758         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp:
1759         (WebCore::Layout::SimpleLineBreaker::Line::Line):
1760         (WebCore::Layout::SimpleLineBreaker::Line::setTextAlign):
1761         (WebCore::Layout::SimpleLineBreaker::Line::adjustedLeftForTextAlign const):
1762         (WebCore::Layout::SimpleLineBreaker::Line::justifyRuns):
1763         (WebCore::Layout::SimpleLineBreaker::Line::adjustRunsForTextAlign):
1764         (WebCore::Layout::expansionOpportunity):
1765         (WebCore::Layout::expansionBehavior):
1766         (WebCore::Layout::SimpleLineBreaker::Line::collectExpansionOpportunities):
1767         (WebCore::Layout::SimpleLineBreaker::Line::closeLastRun):
1768         (WebCore::Layout::SimpleLineBreaker::Line::append):
1769         (WebCore::Layout::SimpleLineBreaker::Line::collapseTrailingWhitespace):
1770         (WebCore::Layout::SimpleLineBreaker::Line::reset):
1771         (WebCore::Layout::SimpleLineBreaker::Style::Style):
1772         (WebCore::Layout::SimpleLineBreaker::handleLineEnd):
1773         (WebCore::Layout::SimpleLineBreaker::handleLineStart):
1774         (WebCore::Layout::isTextAlignRight):
1775         (WebCore::Layout::SimpleLineBreaker::createRunsForLine):
1776         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.h:
1777         (WebCore::Layout::SimpleLineBreaker::Line::setAvailableWidth):
1778         (WebCore::Layout::SimpleLineBreaker::Line::setCollapseWhitespace):
1779
1780 2018-07-21  Zalan Bujtas  <zalan@apple.com>
1781
1782         [LFC][IFC] Add verification for inline text runs.
1783         https://bugs.webkit.org/show_bug.cgi?id=187879
1784
1785         Reviewed by Antti Koivisto.
1786
1787         * layout/Verification.cpp:
1788         (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
1789         (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
1790         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
1791         (WebCore::Layout::verifyAndOutputSubtree):
1792         (WebCore::Layout::outputMismatchingBoxInformationIfNeeded): Deleted.
1793         * layout/inlineformatting/InlineFormattingContext.cpp:
1794         (WebCore::Layout::InlineFormattingContext::layout const):
1795         * layout/inlineformatting/InlineFormattingState.h:
1796         (WebCore::Layout::InlineFormattingState::addLayoutRuns):
1797         (WebCore::Layout::InlineFormattingState::layoutRuns const):
1798         * layout/layouttree/LayoutTreeBuilder.cpp:
1799         (WebCore::Layout::outputLayoutBox):
1800         (WebCore::Layout::outputLayoutTree):
1801         (WebCore::Layout::TreeBuilder::showLayoutTree):
1802
1803 2018-07-21  Zalan Bujtas  <zalan@apple.com>
1804
1805         [LFC] Do not use virtual methods to construct floating/formatting states.
1806         https://bugs.webkit.org/show_bug.cgi?id=187875
1807
1808         Reviewed by Antti Koivisto.
1809
1810         LayoutContext::establishedFormattingState() does not require FormattingContext anymore only the root of the context.
1811
1812         * layout/FormattingContext.cpp:
1813         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1814         * layout/FormattingContext.h:
1815         * layout/LayoutContext.cpp:
1816         (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
1817         (WebCore::Layout::LayoutContext::formattingStateForBox const):
1818         (WebCore::Layout::LayoutContext::establishedFormattingState):
1819         * layout/LayoutContext.h:
1820         * layout/blockformatting/BlockFormattingContext.cpp:
1821         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
1822         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
1823         (WebCore::Layout::BlockFormattingContext::createFormattingState const): Deleted.
1824         (WebCore::Layout::BlockFormattingContext::createOrFindFloatingState const): Deleted.
1825         * layout/blockformatting/BlockFormattingContext.h:
1826         * layout/inlineformatting/InlineFormattingContext.cpp:
1827         (WebCore::Layout::InlineFormattingContext::createFormattingState const): Deleted.
1828         (WebCore::Layout::InlineFormattingContext::createOrFindFloatingState const): Deleted.
1829         * layout/inlineformatting/InlineFormattingContext.h:
1830
1831 2018-07-21  Zalan Bujtas  <zalan@apple.com>
1832
1833         [LFC][BFC] Do not collapse top/bottom margin with first/last inflow child from a non-block formatting context.
1834         https://bugs.webkit.org/show_bug.cgi?id=187867
1835
1836         Reviewed by Antti Koivisto.
1837
1838         The box's top/bottom margin never collapses with a non-block inflow child.
1839
1840         * layout/blockformatting/BlockMarginCollapse.cpp:
1841         (WebCore::Layout::isMarginTopCollapsedWithSibling):
1842         (WebCore::Layout::isMarginBottomCollapsedWithSibling):
1843         (WebCore::Layout::isMarginTopCollapsedWithParent):
1844         (WebCore::Layout::isMarginBottomCollapsedThrough):
1845         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild):
1846         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginTop):
1847         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginTop):
1848         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBottom):
1849         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
1850         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
1851         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
1852         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild):
1853         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBottom):
1854         * layout/layouttree/LayoutBox.cpp:
1855         (WebCore::Layout::Box::establishesBlockFormattingContextOnly const): <div style="overflow: hidden">foobar</div> establishes both inline and block formatting context (inline wins though).
1856         * layout/layouttree/LayoutBox.h: establishesBlockFormattingContext() does not need to be virtual since we can determine it by looking at the box's style. -while in case
1857         of inline formatting context, it is about the content.
1858
1859 2018-07-20  Jer Noble  <jer.noble@apple.com>
1860
1861         REGRESSION (r233974): Cannot close pip'd video; pops back into PiP.
1862         https://bugs.webkit.org/show_bug.cgi?id=187873
1863
1864         Reviewed by Jon Lee.
1865
1866         When the PIP machinery on Mac wants to close the PIP window (due to the close button being clicked), it does
1867         not consult our -shouldClosePiP handler; it just tells us that we're going to close. So we never setup the 
1868         necessary state on the WebProcess side and still think that our "targetIsFullscreen". When we get the "stop"
1869         action, just request exit fullscreen, but set up the _pipState to think we're already exiting (because we are).
1870
1871         * platform/mac/VideoFullscreenInterfaceMac.mm:
1872         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]):
1873
1874 2018-07-20  Justin Fan  <justin_fan@apple.com>
1875
1876         Safari WebGL does not consistently provide correct GPU context on eGPU systems
1877         https://bugs.webkit.org/show_bug.cgi?id=187750
1878         <rdar://problem/39531436>
1879
1880         Reviewed by Dean Jackson.
1881
1882         Move GraphicsContext3DManager into its own class, and notify it when page/Chrome receives a 
1883         windowScreenDidChange message. Add a private data struct to track which hostWindow created each context.
1884         Upon notification, Manager updates the contexts that match the hostWindow with the
1885         provided displayID. Each context matches displayID to rendererID (set during process creation 
1886         if window server is blocked), which is matched to a virtual screen, and updates its GPU accordingly.
1887
1888         No new tests. This requires multiple GPUs or eGPUs, each with attached display(s), to test.
1889
1890         * WebCore.xcodeproj/project.pbxproj:
1891         * page/Chrome.cpp:
1892         (WebCore::Chrome::windowScreenDidChange): Now calls GraphicsContext3DManager::screenDidChange().
1893         * platform/PlatformScreen.h:
1894         * platform/ScreenProperties.h: Add rendererID to struct.
1895         (WebCore::ScreenData::encode const):
1896         (WebCore::ScreenData::decode):
1897         * platform/graphics/GraphicsContext3D.h:
1898         * platform/graphics/GraphicsContext3DManager.cpp: Added (copied out of GraphicsContext3DCocoa.mm).
1899         (WebCore::attachToAppleGraphicsControl):
1900         (WebCore::hasMuxCapability):
1901         (WebCore::hasMuxableGPU):
1902         (WebCore::GraphicsContext3DManager::sharedManager):
1903         (WebCore::displayWasReconfigured):
1904         (WebCore::GraphicsContext3DManager::updateAllContexts):
1905         (WebCore::GraphicsContext3DManager::screenDidChange):
1906         (WebCore::GraphicsContext3DManager::addContext):
1907         (WebCore::GraphicsContext3DManager::removeContext):
1908         (WebCore::GraphicsContext3DManager::hostWindowForContext const):
1909         (WebCore::GraphicsContext3DManager::addContextRequiringHighPerformance):
1910         (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance):
1911         (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
1912         (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired):
1913         (WebCore::GraphicsContext3DManager::recycleContextIfNecessary):
1914         * platform/graphics/GraphicsContext3DManager.h: Added (copied out of GraphicsContext3DCocoa.mm).
1915         (WebCore::GraphicsContext3DManager::hasTooManyContexts const):
1916         (WebCore::GraphicsContext3DManager::GraphicsContext3DManager):
1917         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
1918         (WebCore::GraphicsContext3D::create):
1919         (WebCore::GraphicsContext3D::createShared):
1920         (WebCore::identifyAndSetCurrentGPU): Now matches rendererIDs to determine virtual screen. 
1921         (WebCore::GraphicsContext3D::GraphicsContext3D):
1922         (WebCore::GraphicsContext3D::~GraphicsContext3D):
1923         (WebCore::GraphicsContext3D::setContextVisibility):
1924         (WebCore::GraphicsContext3D::simulateContextChanged):
1925         (WebCore::GraphicsContext3D::screenDidChange):
1926         (WebCore::attachToAppleGraphicsControl): Deleted.
1927         (WebCore::hasMuxCapability): Deleted.
1928         (WebCore::hasMuxableGPU): Deleted.
1929         (WebCore::GraphicsContext3DManager::GraphicsContext3DManager): Deleted.
1930         (WebCore::GraphicsContext3DManager::hasTooManyContexts const): Deleted.
1931         (WebCore::manager): Deleted.
1932         (WebCore::displayWasReconfigured): Deleted.
1933         (WebCore::GraphicsContext3DManager::updateAllContexts): Deleted.
1934         (WebCore::GraphicsContext3DManager::addContext): Deleted.
1935         (WebCore::GraphicsContext3DManager::removeContext): Deleted.
1936         (WebCore::GraphicsContext3DManager::addContextRequiringHighPerformance): Deleted.
1937         (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance): Deleted.
1938         (WebCore::GraphicsContext3DManager::updateHighPerformanceState): Deleted.
1939         (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired): Deleted.
1940         (WebCore::GraphicsContext3DManager::recycleContextIfNecessary): Deleted.
1941         * platform/mac/PlatformScreenMac.mm: Provide a display's rendererID.
1942         (WebCore::rendererIDForDisplayMask):
1943         (WebCore::collectScreenProperties):
1944         (WebCore::rendererIDForDisplay):
1945         (WebCore::primaryRendererID):
1946
1947 2018-07-19  Simon Fraser  <simon.fraser@apple.com>
1948
1949         Remove completed animations from GraphicsLayer, thus avoiding excessive backing store allocation
1950         https://bugs.webkit.org/show_bug.cgi?id=187844
1951         rdar://problem/40387294
1952
1953         Reviewed by Dean Jackson.
1954         
1955         A keyframe animation which animates 3D transforms, and is fill-forwards, currently
1956         leaves the GraphicsLayer in a state where it has a "running" animation. However, the
1957         logic that computes animation extent in RenderLayerBacking::updateGeometry() only does
1958         so for running or paused animations. GraphicsLayer then thinks that it has an active
1959         transform animation with unknown extent, and refuses to detach its backing store.
1960         
1961         This triggers excessive layer creation on some sites (e.g. https://www.kqed.org).
1962         
1963         Fix by always removing animations from the GraphicsLayer when they finish, whether
1964         or not they fill forwards. This is done by having KeyframeAnimation::onAnimationEnd()
1965         always call endAnimation().
1966         
1967         This change only fixes the non-Web Animation code path. webkit.org/b/187845 exists
1968         to fix the other code path.
1969         
1970         Also improve some logging that would have revealed this problem sooner.
1971
1972         Test: compositing/backing/backing-store-attachment-fill-forwards-animation.html
1973
1974         * page/animation/AnimationBase.h:
1975         (WebCore::AnimationBase::endAnimation):
1976         * page/animation/ImplicitAnimation.cpp:
1977         (WebCore::ImplicitAnimation::endAnimation):
1978         * page/animation/ImplicitAnimation.h:
1979         * page/animation/KeyframeAnimation.cpp:
1980         (WebCore::KeyframeAnimation::endAnimation):
1981         (WebCore::KeyframeAnimation::onAnimationEnd):
1982         * page/animation/KeyframeAnimation.h:
1983         * platform/graphics/ca/GraphicsLayerCA.cpp:
1984         (WebCore::GraphicsLayerCA::addAnimation):
1985         (WebCore::GraphicsLayerCA::updateCoverage):
1986
1987 2018-07-20  Ryosuke Niwa  <rniwa@apple.com>
1988
1989         Picking a color from the color panel for typing attributes needs to inverse transform through color-filter
1990         https://bugs.webkit.org/show_bug.cgi?id=187846
1991
1992         Reviewed by Simon Fraser.
1993
1994         This patch refines the color inversion for editing introduced in r234005 so that font panels and WebKit embedders
1995         can get and set inverted colors using attributed strings for a selected text in an editable region.
1996
1997         More specifically, when font panels or WebKit embedders set a font color or a background color via WebView's
1998         _applyStyleToSelection and _applyEditingStyleToSelection, WebKit would automatically invert the color before inserting
1999         into DOM so that the color visible to the user matches that's given to WebKit. Conversely,
2000         [WebView attributedSubstringFromRange:nsRange] now return the color visible to the user, i.e. the color after
2001         the color filter had been applied, so that some WebKit embedders can present the visually identical color to the user.
2002
2003         Because DOM never sees the color filter's effect in the computed style, etc... this patch reverts the change made to
2004         StyleChange in r234005 to avoid inverting the color passed to execCommand. This makes editing apps which is unaware
2005         of the dark mode or -apple-color-filter continue to function (because the color picker implemented in DOM will be
2006         applied of the same color filter before being presented to the user).
2007
2008         Finally, this patch introduces a testing hook in applyCommandToFrame so that executing foreColor or backColor with
2009         the soruce of CommandFromMenuOrKeyBinding would trigger the same code path as the one taken by Objective-C 
2010
2011         Tests: editing/execCommand/set-backColor-with-color-filter-from-scripts.html
2012                editing/execCommand/set-foreColor-with-color-filter-from-scripts.html
2013                editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html
2014                editing/style/set-backColor-with-color-filter.html
2015                editing/style/set-foreColor-with-color-filter.html
2016
2017         * editing/EditingStyle.cpp:
2018         (WebCore::EditingStyle::inverseTransformColorIfNeeded): Added.
2019         (WebCore::StyleChange::StyleChange): Revert the change made in r234005 since this code is also used by execCommand
2020         which is not desirable, and won't work for background color.
2021         (WebCore::StyleChange::extractTextStyles): Ditto.
2022         * editing/EditingStyle.h:
2023         * editing/Editor.cpp:
2024         (WebCore::Editor::applyStyle):
2025         (WebCore::Editor::applyStyleToSelection): Call EditingStyle::inverseTransformColorIfNeeded when ColorFilterMode is
2026         set to InvertColor.
2027         * editing/Editor.h:
2028         * editing/EditorCommand.cpp:
2029         (WebCore::applyCommandToFrame): Added the aforementioned testing hook.
2030         * editing/cocoa/HTMLConverter.mm:
2031         (WebCore::editingAttributedStringFromRange): Take the color filtr into account. Some WebKit embedders use this
2032         function to compute the font color in the selected text. Note that this function is mostly used for input methods
2033         so the color doesn't really matter, and its implementation is distinct from that of HTMLConverter.
2034
2035 2018-07-19  Jer Noble  <jer.noble@apple.com>
2036
2037         HLS resources with remote subresources will not taint canvasses.
2038         https://bugs.webkit.org/show_bug.cgi?id=187731
2039         <rdar://problem/42290703>
2040
2041         Reviewed by Brady Eidson.
2042
2043         Test: http/tests/security/canvas-remote-read-remote-video-hls.html
2044
2045         Most media sources are single-resource; they are accessed from a single origin. HLS manifests can contain many
2046         subresources from arbitrary origins, and canvases should be tainted when painted from media elements whose
2047         subresources were retrieved from tainting origins.
2048
2049         Add a new method to HTMLMediaElement, wouldTaintOrigin(), taking a SecurityOrigin, and returning whether the
2050         media element would taint that origin. This gets piped all the way down to MediaPlayerPrivateAVFoundationObjC
2051         which uses WebCoreNSURLSession to track all the origins of all the responses which resulted from the media
2052         element's load.
2053
2054         Drive-by fix: also fix this issue for media elements which render to an AudioContext.
2055
2056         Drive-by fix #2: CanvasRenderingContext2DBase::createPattern() needs to check the return value of
2057         ImageBuffer::create() before using it.
2058
2059         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
2060         (WebCore::MediaElementAudioSourceNode::wouldTaintOrigin):
2061         * html/HTMLMediaElement.cpp:
2062         (WebCore::HTMLMediaElement::didAttachRenderers):
2063         (WebCore::HTMLMediaElement::didDetachRenderers):
2064         (WebCore::HTMLMediaElement::scheduleUpdateShouldAutoplay):
2065         * html/HTMLMediaElement.h:
2066         (WebCore::HTMLMediaElement::wouldTaintOrigin const):
2067         * html/canvas/CanvasRenderingContext.cpp:
2068         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
2069         * html/canvas/CanvasRenderingContext2DBase.cpp:
2070         (WebCore::CanvasRenderingContext2DBase::createPattern):
2071         * platform/graphics/MediaPlayer.cpp:
2072         (WebCore::MediaPlayer::wouldTaintOrigin const):
2073         * platform/graphics/MediaPlayer.h:
2074         * platform/graphics/MediaPlayerPrivate.h:
2075         (WebCore::MediaPlayerPrivateInterface::hasSingleSecurityOrigin const):
2076         (WebCore::MediaPlayerPrivateInterface::wouldTaintOrigin const):
2077         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
2078         (WebCore::CDMSessionAVContentKeySession::update):
2079         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2080         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2081         (WebCore::MediaPlayerPrivateAVFoundationObjC::wouldTaintOrigin const):
2082         * platform/network/cocoa/WebCoreNSURLSession.h:
2083         * platform/network/cocoa/WebCoreNSURLSession.mm:
2084         (-[WebCoreNSURLSession task:didReceiveResponseFromOrigin:]):
2085         (-[WebCoreNSURLSession wouldTaintOrigin:]):
2086         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
2087
2088 2018-07-20  Zalan Bujtas  <zalan@apple.com>
2089
2090         Update FrameView::paintContents to use release logging.
2091         https://bugs.webkit.org/show_bug.cgi?id=187854
2092         <rdar://problem/42432371>
2093
2094         Reviewed by Simon Fraser.
2095
2096         Adding release logging helps identifying blank content cases. 
2097
2098         * page/FrameView.cpp:
2099         (WebCore::FrameView::paintContents):
2100
2101 2018-07-20  Jer Noble  <jer.noble@apple.com>
2102
2103         First Auto-PiP from Fullscreen too small & animation blocks
2104         https://bugs.webkit.org/show_bug.cgi?id=187745
2105         <rdar://problem/42316583>
2106
2107         Reviewed by Jon Lee.
2108
2109         1) When Auto-PiPing, we don't have the luxury of setting up the fullscreen state
2110         ahead of time; we get notified that PiP has already started. The area of the code
2111         which does this just-in-time setup needs to set the video layer's frame so that the
2112         transform within the PiP window is correct.
2113
2114         2) We generate a placeholder image when going into fullscreen, but we need to do
2115         so synchronously. Create the AVPlayerItemVideoOutput up front at AVPlayerItem creation
2116         time wherever AVPIVO is available.
2117
2118         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2119         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
2120         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2121         (VideoFullscreenInterfaceAVKit::doSetup):
2122
2123 2018-07-20  Antoine Quint  <graouts@apple.com>
2124
2125         DeclarativeAnimation should suspend, resume, & stop m_eventQueue
2126         https://bugs.webkit.org/show_bug.cgi?id=187216
2127         <rdar://problem/41669739>
2128
2129         Reviewed by Ryosuke Niwa.
2130
2131         Suspend, resume and close the GenericEventQueue for DeclarativeAnimation as instructed through the DOMActiveObject protocol.
2132
2133         * animation/DeclarativeAnimation.cpp:
2134         (WebCore::DeclarativeAnimation::stop):
2135         (WebCore::DeclarativeAnimation::suspend):
2136         (WebCore::DeclarativeAnimation::resume):
2137         * animation/DeclarativeAnimation.h:
2138         * animation/WebAnimation.h:
2139
2140 2018-07-20  Zalan Bujtas  <zalan@apple.com>
2141
2142         [LFC][Inline formatting context] Add basic text content handling.
2143         https://bugs.webkit.org/show_bug.cgi?id=187860
2144
2145         Reviewed by Antti Koivisto.
2146
2147         InlineFormattingContext::layout() walks through the formatting root's descendant list in a post-order fashion and
2148         feeds the TextContentProvider.
2149         Eventually this would turn into a more generic loop where we stop and process the text content when finding a non-text content box (float, inline-box etc), but right now
2150         this is about text content only.
2151
2152         * layout/displaytree/DisplayBox.h:
2153         (WebCore::Display::Box::contentBoxBottom const):
2154         (WebCore::Display::Box::contentBoxRight const):
2155         * layout/inlineformatting/InlineFormattingContext.cpp:
2156         (WebCore::Layout::InlineFormattingContext::layout const):
2157         * layout/inlineformatting/textlayout/TextContentProvider.cpp:
2158         (WebCore::Layout::TextContentProvider::textRuns): Add a helper function to support the case when all we need is just the run list in one go.
2159         * layout/inlineformatting/textlayout/TextContentProvider.h:
2160         * layout/layouttree/LayoutBox.cpp:
2161         (WebCore::Layout::Box::isDescendantOf const):
2162         * layout/layouttree/LayoutBox.h:
2163         * layout/layouttree/LayoutInlineBox.h:
2164         (WebCore::Layout::InlineBox::textContent const):
2165
2166 2018-07-20  Youenn Fablet  <youenn@apple.com>
2167
2168         FetchResponse should close its stream when loading finishes
2169         https://bugs.webkit.org/show_bug.cgi?id=187790
2170
2171         Reviewed by Chris Dumez.
2172
2173         It simplifies for a FetchResponse to push all its data into its stream if already created at end of load time.
2174         Did some refactoring in FetchBodyOwner to have a cleaner relationship with the stream source.
2175         Did a minor refactoring to expose the error description when loading fails as part of the rejected promise.
2176         This is consistent to errors sent back through callbacks.
2177
2178         Covered by existing tests.
2179
2180         * Modules/fetch/FetchBodyOwner.cpp:
2181         (WebCore::FetchBodyOwner::~FetchBodyOwner):
2182         * Modules/fetch/FetchBodyOwner.h:
2183         * Modules/fetch/FetchBodySource.cpp:
2184         (WebCore::FetchBodySource::FetchBodySource):
2185         (WebCore::FetchBodySource::setActive):
2186         (WebCore::FetchBodySource::setInactive):
2187         (WebCore::FetchBodySource::doStart):
2188         (WebCore::FetchBodySource::doPull):
2189         (WebCore::FetchBodySource::doCancel):
2190         (WebCore::FetchBodySource::cleanBodyOwner):
2191         * Modules/fetch/FetchBodySource.h:
2192         * Modules/fetch/FetchResponse.cpp:
2193         (WebCore::FetchResponse::BodyLoader::didSucceed):
2194         (WebCore::FetchResponse::BodyLoader::didFail):
2195
2196 2018-07-20  Jer Noble  <jer.noble@apple.com>
2197
2198         REGRESSION(r233969): ASSERT in -[WebAVPlayerLayer setVideoGravity:]
2199         https://bugs.webkit.org/show_bug.cgi?id=187814
2200         <rdar://problem/42391869>
2201
2202         Reviewed by Eric Carlson.
2203
2204         After r233969 caused models to disassociate themselves from interfaces, it is now possible that an
2205         VideoFullscreenInterfaceAVKit can have a nil model. We should null-check, not ASSERT, now that the
2206         assertion no longer holds true.
2207
2208         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2209         (-[WebAVPlayerLayer layoutSublayers]):
2210         (-[WebAVPlayerLayer resolveBounds]):
2211         (-[WebAVPlayerLayer setVideoGravity:]):
2212
2213 2018-07-19  Antoine Quint  <graouts@apple.com>
2214
2215         Flaky crash in AnimationTimeline::cancelOrRemoveDeclarativeAnimation
2216         https://bugs.webkit.org/show_bug.cgi?id=187530
2217         <rdar://problem/42095186>
2218
2219         Reviewed by Dean Jackson.
2220
2221         We would crash in cancelOrRemoveDeclarativeAnimation() because updateCSSAnimationsForElement() would pass
2222         nullptr values due to the return value of cssAnimationsByName.take(nameOfAnimationToRemove). This is because
2223         we would create animations for animation names that may be empty or not match an existing @keyframes rule.
2224         Not only was that wasteful, but it was also non-compliant, and as a result of fixing this we're actually
2225         seeing a progression in the CSS Animations WPT tests.
2226
2227         * animation/AnimationTimeline.cpp:
2228         (WebCore::shouldConsiderAnimation): New function that performs all required steps to see if a provided animation
2229         is valid and has a name that is not "none", not the empty string and matches the name of a @keyframes rule.
2230         (WebCore::AnimationTimeline::updateCSSAnimationsForElement):
2231         * animation/KeyframeEffectReadOnly.cpp:
2232         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): We no longer need to check whether we have
2233         an empty animation name since we're no longer creating CSSAnimation objects in that circumstance.
2234         * css/StyleResolver.cpp:
2235         (WebCore::StyleResolver::isAnimationNameValid): Add a new method that checks whether the provided animation name
2236         a known @keyframes rule.
2237         * css/StyleResolver.h:
2238
2239 2018-07-19  Chris Dumez  <cdumez@apple.com>
2240
2241         Crash under WebCore::DocumentWriter::addData()
2242         https://bugs.webkit.org/show_bug.cgi?id=187819
2243         <rdar://problem/41328743>
2244
2245         Reviewed by Brady Eidson.
2246
2247         When AppCache is used a DocumentLoader may start a NetworkLoad even though it has substitute data.
2248         In DocumentLoader::continueAfterContentPolicy(), if we have substitute data we commit this data
2249         and call finishLoad(). However, if the case where there was a NetworkLoad started, we'll send the
2250         ContinueDidReceiveResponse IPC back to the network process and it will start sending us data for
2251         the load. This could lead to crashes such as <rdar://problem/41328743> since the DocumentLoader
2252         has already committed data and finished loading when it gets the data from the network process.
2253
2254         To address the issue, we now call clearMainResource() in continueAfterContentPolicy(), after we've
2255         decided to commit the substitute data. This effectively removes the DocumentLoader as a client of
2256         the CachedResource so that its will not be notified of following load progress. We do not cancel
2257         the load as other CachedResourceClients may be interested in the load (ApplicationCacheResourceLoader
2258         in particular, in order to update its cached data).
2259
2260         * loader/DocumentLoader.cpp:
2261         (WebCore::DocumentLoader::continueAfterContentPolicy):
2262
2263 2018-07-19  Dean Jackson  <dino@apple.com>
2264
2265         CrashTracer: com.apple.WebKit.WebContent.Development at com.apple.WebCore: std::optional<WTF::Vector<WebCore::PluginInfo, 0ul, WTF::CrashOnOverflow, 16ul> >::operator* & + 73
2266         https://bugs.webkit.org/show_bug.cgi?id=187820
2267         <rdar://problem/42017759>
2268
2269         Reviewed by Antoine Quint.
2270
2271         Speculative fix for this crash, which is accessing an optional without checking
2272         if it exists. The crash logs didn't point to a reproducible test case.
2273
2274         * plugins/PluginData.cpp:
2275         (WebCore::PluginData::supportsWebVisibleMimeTypeForURL const): Return false if
2276         the optional doesn't exist.
2277
2278 2018-07-19  Antoine Quint  <graouts@apple.com>
2279
2280         Ensure DocumentTimeline is kept alive until the VM::whenIdle callback is called
2281         https://bugs.webkit.org/show_bug.cgi?id=187692
2282
2283         Reviewed by Ryosuke Niwa.
2284
2285         Ensure we keep the DocumentTimeline alive until the VM::whenIdle callback is called.
2286
2287         * animation/DocumentTimeline.cpp:
2288         (WebCore::DocumentTimeline::currentTime):
2289
2290 2018-07-18  Simon Fraser  <simon.fraser@apple.com>
2291
2292         Setting foreground color when editing should take color-filter into account, and report the correct foreground color for collapsed selections
2293         https://bugs.webkit.org/show_bug.cgi?id=187778
2294
2295         Reviewed by Ryosuke Niwa.
2296         
2297         Fix two aspects of editing with color-filter:
2298
2299         1. When setting foreground color, inverse-transform the color through -apple-color-filter so that the user gets the color
2300            they chose when in Dark Mode. Tested by editing/style/exec-command-foreColor-with-color-filter.html.
2301
2302         2. When retrieving the style of the collapsed selection, take color filter into account so that color picker
2303            reflects the color the users sees, instead of the content color. Tested by editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html
2304
2305         Add two additional tests that ensure that -apple-color-filter does not impact the NSAttributedString code
2306         path, since -apple-color-filter should not affect the behavior of Copy.
2307
2308         Tests: editing/mac/attributed-string/attrib-string-colors-with-color-filter.html
2309                editing/mac/attributed-string/attrib-string-range-with-color-filter.html
2310                editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html
2311                editing/style/exec-command-foreColor-with-color-filter.html
2312
2313         * editing/EditingStyle.cpp:
2314         (WebCore::StyleChange::StyleChange):
2315         (WebCore::StyleChange::extractTextStyles):
2316         * editing/EditingStyle.h:
2317         * editing/cocoa/EditorCocoa.mm:
2318         (WebCore::Editor::fontAttributesForSelectionStart const):
2319         * platform/graphics/filters/FilterOperation.cpp:
2320         (WebCore::InvertLightnessFilterOperation::inverseTransformColor const):
2321         * platform/graphics/filters/FilterOperation.h:
2322         (WebCore::FilterOperation::inverseTransformColor const):
2323         * platform/graphics/filters/FilterOperations.cpp:
2324         (WebCore::FilterOperations::transformColor const):
2325         (WebCore::FilterOperations::inverseTransformColor const):
2326         * platform/graphics/filters/FilterOperations.h:
2327
2328 2018-07-19  David Fenton  <david_fenton@apple.com>
2329
2330         Unreviewed, rolling out r233994.
2331
2332         Caused EWS and bot failures due to assertions added
2333
2334         Reverted changeset:
2335
2336         "FetchResponse should close its stream when loading finishes"
2337         https://bugs.webkit.org/show_bug.cgi?id=187790
2338         https://trac.webkit.org/changeset/233994
2339
2340 2018-07-19  Jer Noble  <jer.noble@apple.com>
2341
2342         REGRESSION(r233926): media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline.html is a TIMEOUT failure
2343         https://bugs.webkit.org/show_bug.cgi?id=187813
2344
2345         Reviewed by Jon Lee.
2346
2347         In r233926, we changed the behavior of entering PiP to exit fullscreen only after entering PiP completes. The
2348         test in question will immediately request "inline" presentation mode once the PiP animation begins, and thus
2349         it's asking to "exit fullscreen" when both in standard fullscreen and also in PiP. The fix is not to bail out
2350         early if we're in standard (element) fullscreen, but to allow the remaining steps to complete and exit PiP as
2351         well.
2352
2353         * html/HTMLMediaElement.cpp:
2354         (WebCore::HTMLMediaElement::exitFullscreen):
2355
2356 2018-07-19  Zalan Bujtas  <zalan@apple.com>
2357
2358         [LFC] Introduce simple line breaker.
2359         https://bugs.webkit.org/show_bug.cgi?id=187688
2360
2361         Reviewed by Antti Koivisto.
2362
2363         This patch takes the simple line layout implementation and refactors it in a way it is no longer requires a RenderBlockFlow object to run on.
2364         Also this patch decouples text run generation and line breaking (and this implementation is going to replace the current simple line layout codebase)
2365
2366         TextContentProvider: Acts both as the container for all the text content (including hard line breaks) and as an iterator for the generated text runs.
2367         SimpleTextRunGenerator: TextContentProvider uses it as the text run generator for simple content (in the future we'll have a ComplexTextRunGenerator).
2368         SimpleLineBreaker: Input -> text runs + line constraints; Output -> layout runs after line breaking.
2369
2370         * Sources.txt:
2371         * WebCore.xcodeproj/project.pbxproj:
2372         * layout/inlineformatting/textlayout/ContentProvider.cpp: Added.
2373         (WebCore::Layout::TextContentProvider::TextItem::Style::Style):
2374         (WebCore::Layout::TextContentProvider::ContentProvider):
2375         (WebCore::Layout::TextContentProvider::~ContentProvider):
2376         (WebCore::Layout::TextContentProvider::appendText):
2377         (WebCore::Layout::TextContentProvider::appendLineBreak):
2378         (WebCore::Layout::TextContentProvider::width const):
2379         (WebCore::Layout::TextContentProvider::textWidth const):
2380         (WebCore::Layout::TextContentProvider::fixedPitchWidth const):
2381         (WebCore::Layout::TextContentProvider::toTextItemIndex const):
2382         (WebCore::Layout::TextContentProvider::length const):
2383         (WebCore::Layout::TextContentProvider::iterator):
2384         (WebCore::Layout::TextContentProvider::findNextRun):
2385         (WebCore::Layout::TextContentProvider::current const):
2386         * layout/inlineformatting/textlayout/ContentProvider.h: Added.
2387         (WebCore::Layout::TextContentProvider::textContent const):
2388         (WebCore::Layout::TextContentProvider::hardLineBreaks const):
2389         (WebCore::Layout::TextContentProvider::Iterator::current const):
2390         (WebCore::Layout::TextContentProvider::contains const):
2391         (WebCore::Layout::TextContentProvider::Iterator::Iterator):
2392         (WebCore::Layout::TextContentProvider::Iterator::operator++):
2393         * layout/inlineformatting/textlayout/Runs.h: Added.
2394         (WebCore::Layout::TextRun::isWhitespace const):
2395         (WebCore::Layout::TextRun::isNonWhitespace const):
2396         (WebCore::Layout::TextRun::isLineBreak const):
2397         (WebCore::Layout::TextRun::isSoftLineBreak const):
2398         (WebCore::Layout::TextRun::isHardLineBreak const):
2399         (WebCore::Layout::TextRun::isValid const):
2400         (WebCore::Layout::TextRun::isCollapsed const):
2401         (WebCore::Layout::TextRun::type const):
2402         (WebCore::Layout::TextRun::setIsCollapsed):
2403         (WebCore::Layout::TextRun::setWidth):
2404         (WebCore::Layout::LayoutRun::start const):
2405         (WebCore::Layout::LayoutRun::end const):
2406         (WebCore::Layout::LayoutRun::length const):
2407         (WebCore::Layout::LayoutRun::left const):
2408         (WebCore::Layout::LayoutRun::right const):
2409         (WebCore::Layout::LayoutRun::width const):
2410         (WebCore::Layout::LayoutRun::isEndOfLine const):
2411         (WebCore::Layout::LayoutRun::setEnd):
2412         (WebCore::Layout::LayoutRun::setRight):
2413         (WebCore::Layout::LayoutRun::setIsEndOfLine):
2414         (WebCore::Layout::LayoutRun::LayoutRun):
2415         (WebCore::Layout::TextRun::createWhitespaceRun):
2416         (WebCore::Layout::TextRun::createNonWhitespaceRun):
2417         (WebCore::Layout::TextRun::createSoftLineBreakRun):
2418         (WebCore::Layout::TextRun::createHardLineBreakRun):
2419         (WebCore::Layout::TextRun::TextRun):
2420         (WebCore::Layout::TextRun::start const):
2421         (WebCore::Layout::TextRun::end const):
2422         (WebCore::Layout::TextRun::length const):
2423         (WebCore::Layout::TextRun::width const):
2424         * layout/inlineformatting/textlayout/simple/SimpleContentProvider.cpp: Added.
2425         (WebCore::Layout::SimpleContentProvider::SimpleContentProvider):
2426         (WebCore::Layout::SimpleContentProvider::current const):
2427         (WebCore::Layout::SimpleContentProvider::reset):
2428         (WebCore::Layout::SimpleContentProvider::findNextRun):
2429         (WebCore::Layout::SimpleContentProvider::moveToNextBreakablePosition):
2430         (WebCore::Layout::SimpleContentProvider::moveToNextNonWhitespacePosition):
2431         (WebCore::Layout::SimpleContentProvider::isAtLineBreak const):
2432         (WebCore::Layout::SimpleContentProvider::isAtSoftLineBreak const):
2433         * layout/inlineformatting/textlayout/simple/SimpleContentProvider.h: Added.
2434         (WebCore::Layout::SimpleContentProvider::Iterator::reset):
2435         (WebCore::Layout::SimpleContentProvider::Position::operator== const):
2436         (WebCore::Layout::SimpleContentProvider::Position::operator< const):
2437         (WebCore::Layout::SimpleContentProvider::Position::operator ContentPosition const):
2438         (WebCore::Layout::SimpleContentProvider::Position::resetItemPosition):
2439         (WebCore::Layout::SimpleContentProvider::Position::contentPosition const):
2440         (WebCore::Layout::SimpleContentProvider::Position::itemPosition const):
2441         (WebCore::Layout::SimpleContentProvider::Iterator<T>::Iterator):
2442         (WebCore::Layout::SimpleContentProvider::Iterator<T>::current const):
2443         (WebCore::Layout::SimpleContentProvider::Iterator<T>::operator):
2444         (WebCore::Layout::SimpleContentProvider::Position::operator++):
2445         (WebCore::Layout::SimpleContentProvider::Position::operator+=):
2446         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp: Added.
2447         (WebCore::Layout::SimpleLineBreaker::TextRunList::TextRunList):
2448         (WebCore::Layout::SimpleLineBreaker::Line::Line):
2449         (WebCore::Layout::adjustedEndPosition):
2450         (WebCore::Layout::SimpleLineBreaker::Line::append):
2451         (WebCore::Layout::SimpleLineBreaker::Line::collapseTrailingWhitespace):
2452         (WebCore::Layout::SimpleLineBreaker::Line::reset):
2453         (WebCore::Layout::SimpleLineBreaker::Style::Style):
2454         (WebCore::Layout::SimpleLineBreaker::SimpleLineBreaker):
2455         (WebCore::Layout::SimpleLineBreaker::runs):
2456         (WebCore::Layout::SimpleLineBreaker::createRunsForLine):
2457         (WebCore::Layout::SimpleLineBreaker::handleOverflownRun):
2458         (WebCore::Layout::SimpleLineBreaker::collapseLeadingWhitespace):
2459         (WebCore::Layout::SimpleLineBreaker::collapseTrailingWhitespace):
2460         (WebCore::Layout::SimpleLineBreaker::splitTextRun):
2461         (WebCore::Layout::SimpleLineBreaker::split const):
2462         (WebCore::Layout::SimpleLineBreaker::availableWidth const):
2463         (WebCore::Layout::SimpleLineBreaker::verticalPosition const):
2464         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.h: Added.
2465         (WebCore::Layout::SimpleLineBreaker::TextRunList::overrideCurrent):
2466         (WebCore::Layout::SimpleLineBreaker::TextRunList::isCurrentOverridden const):
2467         (WebCore::Layout::SimpleLineBreaker::Line::availableWidth const):
2468         (WebCore::Layout::SimpleLineBreaker::Line::hasContent const):
2469         (WebCore::Layout::SimpleLineBreaker::Line::setAvailableWidth):
2470         (WebCore::Layout::SimpleLineBreaker::Line::hasTrailingWhitespace const):
2471         (WebCore::Layout::SimpleLineBreaker::Line::isWhitespaceOnly const):
2472         (WebCore::Layout::SimpleLineBreaker::wrapContentOnOverflow const):
2473         (WebCore::Layout::SimpleLineBreaker::TextRunList::current const):
2474         (WebCore::Layout::SimpleLineBreaker::TextRunList::operator++):
2475
2476 2018-07-19  Keith Rollin  <krollin@apple.com>
2477
2478         Remove duplicate compilation of WebKitNSImageExtras.mm
2479         https://bugs.webkit.org/show_bug.cgi?id=187782
2480
2481         Reviewed by Alex Christensen.
2482
2483         WebKitNSImageExtras.mm gets compiled twice, once because it's in
2484         WebCore.xcodeproj/project.pbxproj and once because it's in
2485         Webcore/SourcesCocoa.txt. This can lead to duplicate definition
2486         errors, particularly when building with LTO enabled. Fix this by
2487         removing the entry from the Xcode project.
2488
2489         No new tests -- no change in WebKit functionality.
2490
2491         * WebCore.xcodeproj/project.pbxproj:
2492
2493 2018-07-19  Youenn Fablet  <youenn@apple.com>
2494
2495         FetchResponse should close its stream when loading finishes
2496         https://bugs.webkit.org/show_bug.cgi?id=187790
2497
2498         Reviewed by Chris Dumez.
2499
2500         It simplifies for a FetchResponse to push all its data into its stream if already created at end of load time.
2501         Did some refactoring in FetchBodyOwner to have a cleaner relationship with the stream source.
2502         Did a minor refactoring to expose the error description when loading fails as part of the rejected promise.
2503         This is consistent to errors sent back through callbacks.
2504
2505         Covered by existing tests.
2506
2507         * Modules/fetch/FetchBodyOwner.cpp:
2508         (WebCore::FetchBodyOwner::~FetchBodyOwner):
2509         * Modules/fetch/FetchBodyOwner.h:
2510         * Modules/fetch/FetchBodySource.cpp:
2511         (WebCore::FetchBodySource::FetchBodySource):
2512         (WebCore::FetchBodySource::setActive):
2513         (WebCore::FetchBodySource::setInactive):
2514         (WebCore::FetchBodySource::doStart):
2515         (WebCore::FetchBodySource::doPull):
2516         (WebCore::FetchBodySource::doCancel):
2517         (WebCore::FetchBodySource::cleanBodyOwner):
2518         * Modules/fetch/FetchBodySource.h:
2519         * Modules/fetch/FetchResponse.cpp:
2520         (WebCore::FetchResponse::BodyLoader::didSucceed):
2521         (WebCore::FetchResponse::BodyLoader::didFail):
2522
2523 2018-07-19  Jon Lee  <jonlee@apple.com>
2524
2525         Update iOS fullscreen alert text again
2526         https://bugs.webkit.org/show_bug.cgi?id=187797
2527         rdar://problem/42373783
2528
2529         Reviewed by Jer Noble.
2530
2531         * English.lproj/Localizable.strings:
2532
2533 2018-07-19  Keith Rollin  <krollin@apple.com>
2534
2535         Adjust WEBCORE_EXPORT annotations for LTO
2536         https://bugs.webkit.org/show_bug.cgi?id=187781
2537         <rdar://problem/42351124>
2538
2539         Reviewed by Alex Christensen.
2540
2541         Continuation of Bug 186944. This bug addresses issues not caught
2542         during the first pass of adjustments. The initial work focussed on
2543         macOS; this one addresses issues found when building for iOS. From
2544         186944:
2545
2546         Adjust a number of places that result in WebKit's
2547         'check-for-weak-vtables-and-externals' script reporting weak external
2548         symbols:
2549
2550             ERROR: WebCore has a weak external symbol in it (/Volumes/Data/dev/webkit/OpenSource/WebKitBuild/Release/WebCore.framework/Versions/A/WebCore)
2551             ERROR: A weak external symbol is generated when a symbol is defined in multiple compilation units and is also marked as being exported from the library.
2552             ERROR: A common cause of weak external symbols is when an inline function is listed in the linker export file.
2553             ...
2554
2555         These cases are caused by inline methods being marked with WTF_EXPORT
2556         (or related macro) or with an inline function being in a class marked
2557         as such, and when enabling LTO builds.
2558
2559         For the most part, address these by removing the WEBCORE_EXPORT
2560         annotation from inline methods. In some cases, move the implementation
2561         out-of-line because it's the class that has the WEBCORE_EXPORT on it
2562         and removing the annotation from the class would be too disruptive.
2563         Finally, in other cases, move the implementation out-of-line because
2564         check-for-weak-vtables-and-externals still complains when keeping the
2565         implementation inline and removing the annotation; this seems to
2566         typically (but not always) happen with destructors.
2567
2568         No new tests. There is no changed functionality. Only the annotation
2569         and treatment of inline methods are altered.
2570
2571         * platform/graphics/FourCC.h:
2572         (WebCore::FourCC::FourCC):
2573         * platform/graphics/IntPoint.h:
2574         (WebCore::IntPoint::IntPoint):
2575         * platform/mediastream/RealtimeMediaSource.cpp:
2576         (WebCore::RealtimeMediaSource::Observer::~Observer):
2577         (WebCore::RealtimeMediaSource::AudioCaptureFactory::~AudioCaptureFactory):
2578         (WebCore::RealtimeMediaSource::VideoCaptureFactory::~VideoCaptureFactory):
2579         * platform/mediastream/RealtimeMediaSource.h:
2580         * workers/service/ServiceWorkerProvider.cpp:
2581         (WebCore::ServiceWorkerProvider::~ServiceWorkerProvider):
2582         * workers/service/ServiceWorkerProvider.h:
2583
2584 2018-07-19  Charlie Turner  <cturner@igalia.com>
2585
2586         [GStreamer] Return a valid time values in unprerolled states
2587         https://bugs.webkit.org/show_bug.cgi?id=187111
2588
2589         Reviewed by Xabier Rodriguez-Calvar.
2590
2591         After r230584 in bug 180253, asserts were added in
2592         PlatformTimeRanges::add to check that both ends of the range were
2593         valid times. In the non-MSE GStreamer player, this assert was
2594         firing on https://www.w3.org/2010/05/video/mediaevents.html due to
2595         seekable being called in nonprerolled states. In this case
2596         MediaPlayerPrivateInterface::seekable was calling GStreamer's
2597         maxTimeSeekable, which calls in durationMediaTime. The guard
2598         against calling gst_element_query_duration when not prerolled was
2599         returning a different time value than when the duration query
2600         itself failed. Hence the assert firing.
2601
2602         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2603         (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime const):
2604
2605 2018-07-19  Antoine Quint  <graouts@apple.com>
2606
2607         Hitting RELEASE_ASSERT(!m_activeDOMObjectAdditionForbidden) under HTMLMediaElement::resume()
2608         https://bugs.webkit.org/show_bug.cgi?id=187793
2609         <rdar://problem/42308469>
2610
2611         Reviewed by Chris Dumez.
2612
2613         Ensure we do not call JS under resume(), which would happen as a result of calling configureMediaControls() in prepareForLoad().
2614
2615         * html/HTMLMediaElement.cpp:
2616         (WebCore::HTMLMediaElement::~HTMLMediaElement):
2617         (WebCore::HTMLMediaElement::contextDestroyed):
2618         (WebCore::HTMLMediaElement::stop):
2619         (WebCore::HTMLMediaElement::suspend):
2620         (WebCore::HTMLMediaElement::resume):
2621         * html/HTMLMediaElement.h:
2622
2623 2018-07-19  Philippe Normand  <pnormand@igalia.com>
2624
2625         [GStreamer][MSE] imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported.html crashes
2626         https://bugs.webkit.org/show_bug.cgi?id=187469
2627
2628         Reviewed by Žan Doberšek.
2629
2630         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
2631         (webKitMediaSrcFreeStream): Fix critical warning. The appsrc
2632         element is created only when a valid sourcebuffer is in use.
2633
2634 2018-07-19  Frederic Wang  <fwang@igalia.com>
2635
2636         Fix message of NotSupportedError exception thrown during custom element creation
2637         https://bugs.webkit.org/show_bug.cgi?id=187757
2638
2639         Reviewed by Yusuke Suzuki.
2640
2641         In bug 161528, some new exceptions were introduced for custom element creation [1] but the
2642         actual text has some issues. This patch fixes one typo and one wrong message.
2643
2644         [1] https://dom.spec.whatwg.org/#concept-create-element
2645
2646         Test: fast/custom-elements/exceptions-for-synchronous-custom-element-creation.html
2647
2648         * bindings/js/JSCustomElementInterface.cpp:
2649         (WebCore::constructCustomElementSynchronously):
2650
2651 2018-07-18  Jer Noble  <jer.noble@apple.com>
2652
2653         Unreviewed API Test fix; restored a line inadventantly removed in r233926.
2654
2655         * platform/mac/VideoFullscreenInterfaceMac.mm:
2656         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
2657
2658 2018-07-18  Antoine Quint  <graouts@apple.com>
2659
2660         [Web Animations] Interpolation between font-styles with a keyword value should be discrete
2661         https://bugs.webkit.org/show_bug.cgi?id=187722
2662
2663         Reviewed by Myles Maxfield.
2664
2665         Animating between "font-style: normal" or "font-style: oblique" and any another value should yield a discrete
2666         interpolation where the from-value is used from 0 and up to (but excluding) 0.5, and the to-value from 0.5 to 1.
2667
2668         In order to be able to detect the "normal" value, we make the "slope" of a FontSelectionRequest an optional type
2669         where the std::nullopt value indicates "normal" and other values an "oblique" value. Since we also need to
2670         distinguish the "italic" value from an "oblique" value, we implement a custom PropertyWrapper for the "font-style"
2671         property where we ensure the fontStyleAxis property of the font description matches the value we're blending to.
2672         Indeed, in the case where we may animate from "normal" to "italic", the fontStyleAxis on the blended style would
2673         remain "slnt" since it is the base value for "normal".
2674
2675         * accessibility/AccessibilityRenderObject.cpp:
2676         (WebCore::AccessibilityRenderObject::hasPlainText const):
2677         * css/CSSComputedStyleDeclaration.cpp:
2678         (WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
2679         * css/CSSComputedStyleDeclaration.h:
2680         * css/CSSFontFace.cpp:
2681         (WebCore::calculateItalicRange):
2682         * css/CSSFontFaceSet.cpp:
2683         (WebCore::computeFontSelectionRequest):
2684         * css/FontSelectionValueInlines.h:
2685         (WebCore::fontStyleKeyword):
2686         (WebCore::fontStyleValue): Deleted.
2687         * css/StyleBuilderConverter.h:
2688         (WebCore::StyleBuilderConverter::convertFontStyleFromValue):
2689         * page/animation/CSSPropertyAnimation.cpp:
2690         (WebCore::blendFunc):
2691         (WebCore::PropertyWrapperFontStyle::PropertyWrapperFontStyle):
2692         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2693         * platform/graphics/FontCache.h:
2694         (WebCore::FontDescriptionKey::computeHash const):
2695         * platform/graphics/FontCascade.h:
2696         (WebCore::FontCascade::italic const):
2697         * platform/graphics/FontDescription.h:
2698         (WebCore::FontDescription::italic const):
2699         (WebCore::FontDescription::setItalic):
2700         (WebCore::FontDescription::setIsItalic):
2701         (WebCore::FontCascadeDescription::initialItalic):
2702         * platform/graphics/FontSelectionAlgorithm.cpp:
2703         (WebCore::FontSelectionAlgorithm::styleDistance const):
2704         * platform/graphics/FontSelectionAlgorithm.h:
2705         (WebCore::isItalic):
2706         (WebCore::FontSelectionRequest::tied const):
2707         (WebCore::operator<<): Implement the required stream operator.
2708         (WebCore::operator==): Mark this function as inline instead of constexpr since tied() is no longer constexpr
2709         due to taking an std::optional<>.
2710         (WebCore::operator!=):
2711         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2712         (WebCore::preparePlatformFont):
2713         * platform/graphics/win/FontCacheWin.cpp:
2714         (WebCore::FontCache::createFontPlatformData):
2715         * rendering/style/RenderStyle.cpp:
2716         (WebCore::RenderStyle::setFontItalic):
2717         * rendering/style/RenderStyle.h:
2718         (WebCore::RenderStyle::fontItalic const):
2719
2720 2018-07-18  Jer Noble  <jer.noble@apple.com>
2721
2722         Unreviewed build fix after r233926; BOOL !== bool.
2723
2724         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2725         (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const):
2726
2727 2018-07-18  Jer Noble  <jer.noble@apple.com>
2728
2729         PiP from Element Fullscreen should match AVKit's behavior
2730         https://bugs.webkit.org/show_bug.cgi?id=187623
2731
2732         Reviewed by Jon Lee.
2733
2734         PiP behavior should be defined at the WebKit2 level, and not in HTMLMediaElement:
2735
2736         * html/HTMLMediaElement.cpp:
2737         (WebCore::HTMLMediaElement::enterFullscreen):
2738
2739         Add an accessor for pictureInPictureWasStartedWhenEnteringBackground():
2740
2741         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
2742         (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const):
2743
2744         Add VideoFullscreenModelClient virutal methods for PiP change notifications:
2745
2746         * platform/cocoa/VideoFullscreenModel.h:
2747         (WebCore::VideoFullscreenModelClient::hasVideoChanged):
2748         (WebCore::VideoFullscreenModelClient::videoDimensionsChanged):
2749         (WebCore::VideoFullscreenModelClient::willEnterPictureInPicture):
2750         (WebCore::VideoFullscreenModelClient::didEnterPictureInPicture):
2751         (WebCore::VideoFullscreenModelClient::failedToEnterPictureInPicture):
2752         (WebCore::VideoFullscreenModelClient::willExitPictureInPicture):
2753         (WebCore::VideoFullscreenModelClient::didExitPictureInPicture):
2754         (WebCore::VideoFullscreenModelClient::failedToExitPictureInPicture):
2755         * platform/cocoa/VideoFullscreenModelVideoElement.h:
2756         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
2757         (VideoFullscreenModelVideoElement::willEnterPictureInPicture):
2758         (VideoFullscreenModelVideoElement::didEnterPictureInPicture):
2759         (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture):
2760         (VideoFullscreenModelVideoElement::willExitPictureInPicture):
2761         (VideoFullscreenModelVideoElement::didExitPictureInPicture):
2762         (VideoFullscreenModelVideoElement::failedToExitPictureInPicture):
2763         * platform/ios/VideoFullscreenInterfaceAVKit.h:
2764         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2765         (-[WebAVPlayerLayer layoutSublayers]):
2766         (-[WebAVPlayerLayer resolveBounds]):
2767         (-[WebAVPlayerLayer setVideoGravity:]):
2768         (VideoFullscreenInterfaceAVKit::setupFullscreen):
2769         (VideoFullscreenInterfaceAVKit::presentingViewController):
2770         (VideoFullscreenInterfaceAVKit::willStartPictureInPicture):
2771         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
2772         (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture):
2773         (VideoFullscreenInterfaceAVKit::willStopPictureInPicture):
2774         (VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
2775         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
2776         (VideoFullscreenInterfaceAVKit::doSetup):
2777         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2778         (VideoFullscreenControllerContext::willEnterPictureInPicture):
2779         (VideoFullscreenControllerContext::didEnterPictureInPicture):
2780         (VideoFullscreenControllerContext::failedToEnterPictureInPicture):
2781         (VideoFullscreenControllerContext::willExitPictureInPicture):
2782         (VideoFullscreenControllerContext::didExitPictureInPicture):
2783         (VideoFullscreenControllerContext::failedToExitPictureInPicture):
2784         * platform/mac/VideoFullscreenInterfaceMac.h:
2785         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Deleted.
2786         * platform/mac/VideoFullscreenInterfaceMac.mm:
2787         (-[WebVideoFullscreenInterfaceMacObjC invalidateFullscreenState]):
2788         (-[WebVideoFullscreenInterfaceMacObjC exitPIP]):
2789         (-[WebVideoFullscreenInterfaceMacObjC exitPIPAnimatingToRect:inWindow:]):
2790         (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]):
2791         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
2792         (WebCore::VideoFullscreenInterfaceMac::enterFullscreen):
2793         (WebCore::VideoFullscreenInterfaceMac::exitFullscreen):
2794         (WebCore::VideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode):
2795         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen):
2796
2797 2018-07-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2798
2799         [Curl] Disable CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST specified by setAllowsAnyHTTPSCertificate.
2800         https://bugs.webkit.org/show_bug.cgi?id=187611
2801
2802         Reviewed by Fujii Hironori.
2803
2804         Current interface for TLS certificate validation for Curl port are as follows:
2805
2806         - WEBCORE_EXPORT void setHostAllowsAnyHTTPSCertificate(const String&);
2807         - bool isAllowedHTTPSCertificateHost(const String&);
2808         - bool canIgnoredHTTPSCertificate(const String&, const Vector<CertificateInfo::Certificate>&);
2809
2810         First one registers a host to be ignored for any certificate check. Once it is registered, no
2811         further certificate validation check is executed.
2812         Second one checks the host is registered in the list above.
2813         Third one is weird. The method signature implies it checks the certificate for the host and detect
2814         whether we can ignore this certificate for the host, but actually it  just check only the host and
2815         register the certificate into the vector. Then in the next request for the host, the certificate
2816         will be checked with the previously stored certificate.
2817
2818         It's hard to understand, but in short,
2819         - We can register a host as an exception for any TLS certificate validation.
2820         - But only certificate arrived first is ignored, not any certificates for the host
2821           (which is rare, but possible for mis configured web cluster).
2822
2823         This behavior is incomplete. To ignore any certificates of the host, these two methods are enough:
2824
2825         - void allowAnyHTTPSCertificatesForHost(const String&)
2826         - bool canIgnoreAnyHTTPSCertificatesForHost(const String&)
2827
2828         No new tests. Covered by existing tests.
2829
2830         * platform/network/curl/CertificateInfo.h:
2831         * platform/network/curl/CurlContext.cpp:
2832         (WebCore::CurlHandle::enableSSLForHost): Ignore TLS verification for registered host.
2833         * platform/network/curl/CurlSSLHandle.cpp:
2834         (WebCore::CurlSSLHandle::allowAnyHTTPSCertificatesForHost): Added.
2835         (WebCore::CurlSSLHandle::canIgnoreAnyHTTPSCertificatesForHost const): Ditto.
2836         (WebCore::CurlSSLHandle::setClientCertificateInfo): Separate lock.
2837         (WebCore::CurlSSLHandle::getSSLClientCertificate const): Ditto and add const.
2838         (WebCore::CurlSSLHandle::setHostAllowsAnyHTTPSCertificate): Deleted.
2839         (WebCore::CurlSSLHandle::isAllowedHTTPSCertificateHost): Deleted.
2840         (WebCore::CurlSSLHandle::canIgnoredHTTPSCertificate): Deleted.
2841         (WebCore::CurlSSLHandle::getSSLClientCertificate): Deleted.
2842         * platform/network/curl/CurlSSLHandle.h:
2843         * platform/network/curl/CurlSSLVerifier.cpp:
2844         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
2845         (WebCore::CurlSSLVerifier::collectInfo): Renamed from verify.
2846         (WebCore::CurlSSLVerifier::verifyCallback):
2847         (WebCore::CurlSSLVerifier::verify): Renamed to collectInfo.
2848         * platform/network/curl/CurlSSLVerifier.h:
2849         * platform/network/curl/ResourceHandleCurl.cpp:
2850         (WebCore::ResourceHandle::setHostAllowsAnyHTTPSCertificate): Rename calling method.
2851
2852 2018-07-18  Myles C. Maxfield  <mmaxfield@apple.com>
2853
2854         Rename WordBreak::Break to WordBreak::BreakWord
2855         https://bugs.webkit.org/show_bug.cgi?id=187767
2856
2857         Reviewed by Simon Fraser.
2858
2859         These breaking properties are very confusing. There are:
2860
2861         1. word-break: break-all, a standard value that allows breaking after every
2862         character.
2863         2. word-break: break-word, a non-standard value which allows for breaking after
2864         every character, but only if the word is too long for the available width (otherwise
2865         it works the same as word-break: normal). This affects the min-content-size of the
2866         text (and makes it equal to what it would be if word-break: break-all was
2867         specified).
2868         3. word-wrap: break-word, which is the same as word-break: break-word, but doesn't
2869         affect the min-content-size of the text.
2870         4. overflow-wrap: break-word, which is the same as word-wrap: break-word.
2871
2872         Because this is so confusing it's valuable for our internal enums to match the names
2873         of the official CSS properties/values.
2874
2875         No new tests because there is no behavior change.
2876
2877         * css/CSSPrimitiveValueMappings.h:
2878         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2879         (WebCore::CSSPrimitiveValue::operator WordBreak const):
2880         * rendering/RenderText.cpp:
2881         (WebCore::RenderText::computePreferredLogicalWidths):
2882         * rendering/style/RenderStyle.h:
2883         (WebCore::RenderStyle::breakWords const):
2884         * rendering/style/RenderStyleConstants.h:
2885
2886 2018-07-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2887
2888         Add SPI to defer running async script until after document load
2889         https://bugs.webkit.org/show_bug.cgi?id=187748
2890         <rdar://problem/42317378>
2891
2892         Reviewed by Ryosuke Niwa and Tim Horton.
2893
2894         On watchOS, we currently observe that time-consuming async scripts can block the first paint of Reader, leaving
2895         the user with a blank screen for tens of seconds. One way to mitigate this is to defer async script execution
2896         until after document load (i.e. the same timing as DOMContentLoaded).
2897
2898         This patch introduces an SPI configuration allowing internal clients to defer execution of asynchronous script
2899         until after document load; this, in combination with the parser yielding token introduced in r233891, allows
2900         Safari on watchOS to avoid being blocked on slow script execution before the first paint of the Reader page on
2901         most article-like pages. See below for more details.
2902
2903         Test: RunScriptAfterDocumentLoad.ExecutionOrderOfScriptsInDocument
2904
2905         * dom/Document.cpp:
2906         (WebCore::Document::shouldDeferAsynchronousScriptsUntilParsingFinishes const):
2907         (WebCore::Document::finishedParsing):
2908
2909         Notify ScriptRunner when the Document has finished parsing, and is about to fire DOMContentLoaded.
2910
2911         * dom/Document.h:
2912         * dom/ScriptRunner.cpp:
2913         (WebCore::ScriptRunner::documentFinishedParsing):
2914
2915         When the document is finished parsing, kick off the script execution timer if needed to run any async script
2916         that has been deferred.
2917
2918         (WebCore::ScriptRunner::notifyFinished):
2919         (WebCore::ScriptRunner::timerFired):
2920
2921         Instead of always taking from the list of async scripts to execute, check our document to see whether we should
2922         defer this until after document load. If so, ignore `m_scriptsToExecuteSoon`.
2923
2924         * dom/ScriptRunner.h:
2925         * page/Settings.yaml:
2926
2927         Add a WebCore setting for this behavior.
2928
2929 2018-07-18  Zan Dobersek  <zdobersek@igalia.com>
2930
2931         [Nicosia] Add debug border, repaint counter state tracking to Nicosia::CompositionLayer
2932         https://bugs.webkit.org/show_bug.cgi?id=187749
2933
2934         Reviewed by Carlos Garcia Campos.
2935
2936         Add the RepaintCounter and DebugBorder structs to
2937         Nicosia::CompositionLayer::LayerState, tracking visibility as well as
2938         repaint count or debug color and width.
2939
2940         Instances of RepaintCounter and DebugBorder types are kept in each
2941         CoordinatedGraphicsLayer object, updating the relevant data as it is
2942         changed (since the GraphicsLayer object isn't tracking these values on
2943         its own). During layer flush these values (if changed) are then copied
2944         over into the CompositionLayer state.
2945
2946         * platform/graphics/nicosia/NicosiaPlatformLayer.cpp:
2947         Also fix the year in the license header.
2948         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
2949         Also fix the year in the license header.
2950         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2951         (WebCore::CoordinatedGraphicsLayer::didUpdateTileBuffers):
2952         (WebCore::CoordinatedGraphicsLayer::setShowDebugBorder):
2953         (WebCore::CoordinatedGraphicsLayer::setShowRepaintCounter):
2954         (WebCore::CoordinatedGraphicsLayer::setDebugBorder):
2955         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
2956         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2957
2958 2018-07-18  Zan Dobersek  <zdobersek@igalia.com>
2959
2960         [CoordGraphics] Start tracking Nicosia layers in CoordinatedGraphicsState
2961         https://bugs.webkit.org/show_bug.cgi?id=187751
2962
2963         Reviewed by Carlos Garcia Campos.
2964
2965         Start including the Nicosia::CompositionLayer objects in the
2966         CoordinatedGraphicsState struct, under a separate NicosiaState struct.
2967         References to all the layers in a given scene are kept in a HashSet,
2968         and a separate reference to the root layer kept in a separate member
2969         variable.
2970
2971         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2972         (WebCore::CoordinatedGraphicsLayer::compositionLayer const):
2973         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2974         Add the getter method that returns internal Nicosia::CompositionLayer
2975         object. This can't be defined in the class definition because of
2976         WEBCORE_EXPORT used on the CoordinatedGraphicsLayer class.
2977         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
2978
2979 2018-07-18  Simon Fraser  <simon.fraser@apple.com>
2980
2981         Shrink CompositeAnimation and AnimationBase
2982         https://bugs.webkit.org/show_bug.cgi?id=187683
2983
2984         Reviewed by Daniel Bates.
2985
2986         Reduce the size of CompositeAnimation and AnimationBase.
2987
2988         * page/animation/AnimationBase.h:
2989         * page/animation/CompositeAnimation.h:
2990
2991 2018-07-17  Antoine Quint  <graouts@apple.com>
2992
2993         Ensure timingFunctionForKeyframeAtIndex() can be used from setAnimatedPropertiesInStyle().
2994         https://bugs.webkit.org/show_bug.cgi?id=187637
2995         <rdar://problem/42157915>
2996
2997         Reviewed by Dean Jackson.
2998
2999         Test: webanimations/empty-keyframes-crash.html
3000
3001         Unlike what we assumed, it is possible to have a non-declarative animation without any parsed keyframes.
3002         This can happen as a result of calling `Element.animate({}, …)`. In this case, we want to return a null
3003         value in timingFunctionForKeyframeAtIndex() so we update the call site in setAnimatedPropertiesInStyle()
3004         which is the only place where we didn't check for a null value and didn't know for sure that there would
3005         be parsed keyframes to rely on in the case of a WebAnimation instance.
3006
3007         * animation/KeyframeEffectReadOnly.cpp:
3008         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle):
3009         (WebCore::KeyframeEffectReadOnly::timingFunctionForKeyframeAtIndex):
3010
3011 2018-07-15  Jiewen Tan  <jiewen_tan@apple.com>
3012
3013         [WebCrypto] Crypto operations should copy their parameters before hoping to another thread
3014         https://bugs.webkit.org/show_bug.cgi?id=187501
3015         <rdar://problem/41438160>
3016
3017         Reviewed by Youenn Fablet.
3018
3019         This patch aims at making all captured variables in all crypto lambdas that need to be passed
3020         to a worker thread thread safe, which includes:
3021         1) changing ref counted objects to thread safe ref counted object.
3022         2) adding isolatedCopy methods to non ref counted classes, so they can be called by CrossThreadCopy().
3023
3024         In addition to above changes, this patch also does the following things:
3025         1) change the name CryptoAlgorithm::dispatchOperation => CryptoAlgorithm::dispatchOperationInWorkQueue
3026         to make it clear that lambdas will be passed to a secondary thread.
3027         2) make CryptoAlgorithmParameters as const parameters for all methods.
3028         3) add null checks on BufferSource.length() and .data().
3029
3030         Tests: crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html
3031                http/wpt/crypto/aes-cbc-crash.any.html
3032                http/wpt/crypto/aes-cbc-crash.any.worker.html
3033                http/wpt/crypto/aes-ctr-crash.any.html
3034                http/wpt/crypto/aes-ctr-crash.any.worker.html
3035                http/wpt/crypto/aes-gcm-crash.any.html
3036                http/wpt/crypto/aes-gcm-crash.any.worker.html
3037                http/wpt/crypto/derive-hmac-key-crash.any.html
3038                http/wpt/crypto/derive-hmac-key-crash.any.worker.html
3039                http/wpt/crypto/ecdsa-crash.any.html
3040                http/wpt/crypto/ecdsa-crash.any.worker.html
3041                http/wpt/crypto/hkdf-crash.any.html
3042                http/wpt/crypto/hkdf-crash.any.worker.html
3043                http/wpt/crypto/pbkdf2-crash.any.html
3044                http/wpt/crypto/pbkdf2-crash.any.worker.html
3045                http/wpt/crypto/rsa-oaep-crash.any.html
3046                http/wpt/crypto/rsa-oaep-crash.any.worker.html
3047                http/wpt/crypto/rsa-pss-crash.any.html
3048                http/wpt/crypto/rsa-pss-crash.any.worker.html
3049                http/wpt/crypto/unwrap-ec-key-crash.any.html
3050                http/wpt/crypto/unwrap-ec-key-crash.any.worker.html
3051                http/wpt/crypto/unwrap-rsa-key-crash.any.html
3052                http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html
3053
3054         * bindings/js/BufferSource.h:
3055         (WebCore::BufferSource::data const):
3056         (WebCore::BufferSource::length const):
3057         * crypto/CryptoAlgorithm.cpp:
3058         (WebCore::CryptoAlgorithm::encrypt):
3059         (WebCore::CryptoAlgorithm::decrypt):
3060         (WebCore::CryptoAlgorithm::sign):
3061         (WebCore::CryptoAlgorithm::verify):
3062         (WebCore::CryptoAlgorithm::deriveBits):
3063         (WebCore::CryptoAlgorithm::importKey):
3064         (WebCore::dispatchAlgorithmOperation):
3065         (WebCore::CryptoAlgorithm::dispatchOperationInWorkQueue):
3066         (WebCore::CryptoAlgorithm::dispatchOperation): Deleted.
3067         * crypto/CryptoAlgorithm.h:
3068         * crypto/SubtleCrypto.cpp:
3069         (WebCore::crossThreadCopyImportParams):
3070         (WebCore::SubtleCrypto::encrypt):
3071         (WebCore::SubtleCrypto::decrypt):
3072         (WebCore::SubtleCrypto::sign):
3073         (WebCore::SubtleCrypto::verify):
3074         (WebCore::SubtleCrypto::deriveKey):
3075         (WebCore::SubtleCrypto::deriveBits):
3076         (WebCore::SubtleCrypto::importKey):
3077         (WebCore::SubtleCrypto::wrapKey):
3078         (WebCore::SubtleCrypto::unwrapKey):
3079         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
3080         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
3081         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
3082         (WebCore::CryptoAlgorithmAES_CBC::importKey):
3083         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
3084         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
3085         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
3086         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
3087         (WebCore::CryptoAlgorithmAES_CFB::importKey):
3088         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
3089         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
3090         (WebCore::parametersAreValid):
3091         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
3092         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
3093         (WebCore::CryptoAlgorithmAES_CTR::importKey):
3094         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
3095         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
3096         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
3097         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
3098         (WebCore::CryptoAlgorithmAES_GCM::importKey):
3099         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
3100         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
3101         (WebCore::CryptoAlgorithmAES_KW::importKey):
3102         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
3103         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
3104         (WebCore::CryptoAlgorithmECDH::deriveBits):
3105         (WebCore::CryptoAlgorithmECDH::importKey):
3106         * crypto/algorithms/CryptoAlgorithmECDH.h:
3107         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
3108         (WebCore::CryptoAlgorithmECDSA::sign):
3109         (WebCore::CryptoAlgorithmECDSA::verify):
3110         (WebCore::CryptoAlgorithmECDSA::importKey):
3111         * crypto/algorithms/CryptoAlgorithmECDSA.h:
3112         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
3113         (WebCore::CryptoAlgorithmHKDF::deriveBits):
3114         (WebCore::CryptoAlgorithmHKDF::importKey):
3115         * crypto/algorithms/CryptoAlgorithmHKDF.h:
3116         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
3117         (WebCore::CryptoAlgorithmHMAC::sign):
3118         (WebCore::CryptoAlgorithmHMAC::verify):
3119         (WebCore::CryptoAlgorithmHMAC::importKey):
3120         * crypto/algorithms/CryptoAlgorithmHMAC.h:
3121         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
3122         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
3123         (WebCore::CryptoAlgorithmPBKDF2::importKey):
3124         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
3125         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
3126         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
3127         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
3128         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
3129         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
3130         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
3131         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
3132         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
3133         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
3134         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
3135         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
3136         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
3137         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
3138         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
3139         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
3140         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
3141         (WebCore::CryptoAlgorithmRSA_PSS::sign):
3142         (WebCore::CryptoAlgorithmRSA_PSS::verify):
3143         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
3144         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
3145         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
3146         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
3147         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
3148         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
3149         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
3150         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
3151         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
3152         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
3153         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
3154         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
3155         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
3156         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
3157         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
3158         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
3159         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
3160         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
3161         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
3162         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
3163         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
3164         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
3165         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
3166         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
3167         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
3168         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
3169         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
3170         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
3171         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
3172         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
3173         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
3174         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
3175         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
3176         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
3177         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
3178         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
3179         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
3180         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
3181         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
3182         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
3183         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
3184         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
3185         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
3186         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
3187         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
3188         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
3189         * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h:
3190         * crypto/parameters/CryptoAlgorithmAesCtrParams.h:
3191         * crypto/parameters/CryptoAlgorithmAesGcmParams.h:
3192         * crypto/parameters/CryptoAlgorithmEcKeyParams.h:
3193         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
3194         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
3195         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
3196         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
3197         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
3198         * crypto/parameters/CryptoAlgorithmRsaOaepParams.h:
3199         * crypto/parameters/CryptoAlgorithmRsaPssParams.h:
3200
3201 2018-07-17  Antoine Quint  <graouts@apple.com>
3202
3203         [Web Animations] Interpolation between lengths with an "auto" value should be discrete
3204         https://bugs.webkit.org/show_bug.cgi?id=187721
3205
3206         Reviewed by Dean Jackson.
3207
3208         When interpolating between two Length values, if one is "auto", we should use the from-value
3209         from 0 and up to (but excluding) 0.5, and use the to-value from 0.5 to 1.
3210
3211         This change caused a regression in the legacy animation engine since it would create a CSS
3212         transition even when the underlying and target values were non-interpolable. As such, the
3213         underlying value would be used until the transition's mid-point and the tests at 
3214         legacy-animation-engine/imported/blink/transitions/transition-not-interpolable.html and
3215         legacy-animation-engine/fast/animation/height-auto-transition-computed-value.html would fail
3216         expecting the target value to be used immediately. We now ensure that no transition is actually
3217         started if two values for a given property cannot be interpolated.
3218
3219         * page/animation/CompositeAnimation.cpp:
3220         (WebCore::CompositeAnimation::updateTransitions):
3221         * platform/Length.cpp:
3222         (WebCore::blend):
3223
3224 2018-07-17  Wenson Hsieh  <wenson_hsieh@apple.com>
3225
3226         Add an SPI hook to allow clients to yield document parsing and script execution
3227         https://bugs.webkit.org/show_bug.cgi?id=187682
3228         <rdar://problem/42207453>
3229
3230         Reviewed by Ryosuke Niwa.
3231
3232         Using a single web process for both the Reader page and original web page on watchOS has multiple benefits,
3233         including: (1) allowing the user to bail out of Reader and view the original web page without having to load it
3234         again, and (2) improving the bringup time of the Reader page, since subresources are already cached in process
3235         and we don't eat the additional cost of a web process launch if prewarming fails.
3236
3237         However, this has some drawbacks as well, one of which is that main thread work being done on behalf of the
3238         original page may contend with work being done to load and render the Reader page. This is especially bad when
3239         the page is in the middle of executing heavy script after Safari has already detected that the Reader version of
3240         the page is available, but before it has finished loading the Reader page. The result is that script on the
3241         original page may block the first paint of the Reader page (on New York Times articles, this often leads to an
3242         apparent page load time of 25-35 seconds before the user sees anything besides a blank screen).
3243
3244         To mitigate this, we introduce a way for injected bundle clients to yield parsing and async script execution on
3245         a document. This capability is surfaced in the form of an opaque token which clients may request from a
3246         WKDOMDocument. Construction of the token causes the document to begin yielding and defer execution of previously
3247         scheduled scripts, only if there were no active tokens on the document already. Similarly, destruction of all
3248         active tokens on the document causes it to stop yielding and resume execution of scripts if needed.
3249
3250         Tests:  ParserYieldTokenTests.PreventDocumentLoadByTakingParserYieldToken
3251                 ParserYieldTokenTests.TakeMultipleParserYieldTokens
3252                 ParserYieldTokenTests.DeferredScriptExecutesBeforeDocumentLoadWhenTakingParserYieldToken
3253                 ParserYieldTokenTests.AsyncScriptRunsWhenFetched
3254
3255         * dom/Document.cpp:
3256         (WebCore::Document::implicitOpen):
3257
3258         If the parser yield token was taken before the document's parser was created, tell the parser's scheduler to
3259         start yielding immediately after creation.
3260
3261         (WebCore::DocumentParserYieldToken::DocumentParserYieldToken):
3262         (WebCore::DocumentParserYieldToken::~DocumentParserYieldToken):
3263         * dom/Document.h:
3264
3265         Introduce a parser yield count to Document; as long as this count is greater than 0, we consider the Document to
3266         have active yield tokens. When constructing or destroying a ParserYieldToken, we increment and decrement the
3267         parser yield count (respectively).
3268
3269         (WebCore::Document::createParserYieldToken):
3270         (WebCore::Document::hasActiveParserYieldToken const):
3271         * dom/DocumentParser.h:
3272         (WebCore::DocumentParser::didBeginYieldingParser):
3273         (WebCore::DocumentParser::didEndYieldingParser):
3274
3275         Hooks for Document to tell its parser that we've started or finished yielding. This updates a flag on the
3276         parser's scheduler which is consulted when we determine whether to yield before a pumping token or executing
3277         script.
3278
3279         * dom/ScriptRunner.cpp:
3280         (WebCore::ScriptRunner::resume):
3281         (WebCore::ScriptRunner::notifyFinished):
3282         * dom/ScriptRunner.h:
3283         (WebCore::ScriptRunner::didBeginYieldingParser):
3284         (WebCore::ScriptRunner::didEndYieldingParser):
3285
3286         Hooks for Document to tell its ScriptRunner that we've started or finished yielding. These wrap calls to suspend
3287         and resume.
3288
3289         * html/parser/HTMLDocumentParser.cpp:
3290         (WebCore::HTMLDocumentParser::didBeginYieldingParser):
3291         (WebCore::HTMLDocumentParser::didEndYieldingParser):
3292
3293         Plumb to didBegin/didEnd calls to the HTMLParserScheduler.
3294
3295         * html/parser/HTMLDocumentParser.h:
3296         * html/parser/HTMLParserScheduler.cpp:
3297         (WebCore::HTMLParserScheduler::shouldYieldBeforeExecutingScript):
3298         * html/parser/HTMLParserScheduler.h:
3299         (WebCore::HTMLParserScheduler::shouldYieldBeforeToken):
3300
3301         Consult a flag when determining whether to yield. This flag is set to true only while the document has an active
3302         parser yield token.
3303
3304         (WebCore::HTMLParserScheduler::isScheduledForResume const):
3305
3306         Consider the parser scheduler to be scheduled for resume if there are active tokens. Without this change, we
3307         incorrectly consider the document to be finished loading when we have yield tokens, since it appears that the
3308         parser is no longer scheduled to pump its tokenizer.
3309
3310         (WebCore::HTMLParserScheduler::didBeginYieldingParser):
3311         (WebCore::HTMLParserScheduler::didEndYieldingParser):
3312
3313         When the Document begins yielding due to the documet having active tokens or ends yielding after the document
3314         loses all of its yield tokens, update a flag on the parser scheduler. After we finish yielding, additionally
3315         reschedule the parser if needed to ensure that we continue parsing the document; without this additional change
3316         to resume, we'll never get the document load or load events after relinquishing the yield token.
3317
3318 2018-07-17  Dirk Schulze  <krit@webkit.org>
3319
3320         [clip-path] Implement support for margin-box as reference box and box shape
3321         https://bugs.webkit.org/show_bug.cgi?id=127984
3322
3323         Reviewed by Simon Fraser.
3324
3325         Compute