ImageDecoder can be deleted while the async decoder thread is still using it
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-03-13  Miguel Gomez  <magomez@igalia.com>
2
3         ImageDecoder can be deleted while the async decoder thread is still using it
4         https://bugs.webkit.org/show_bug.cgi?id=169199
5
6         Reviewed by Carlos Garcia Campos.
7
8         Make the image decoder used by ImageSource and ImageFrameCache into a RefPtr instead of
9         and unique_ptr, and pass a reference to the decoder thread. This ensures that the decoder
10         will stay alive as long as the decoding thread is processing frames. Also, stop the async
11         decoding queue if a new decoder is set to ImageFrameCache.
12
13         No new tests.
14
15         * platform/graphics/ImageFrameCache.cpp:
16         (WebCore::ImageFrameCache::setDecoder):
17         (WebCore::ImageFrameCache::decoder):
18         (WebCore::ImageFrameCache::startAsyncDecodingQueue):
19         (WebCore::ImageFrameCache::metadata):
20         * platform/graphics/ImageFrameCache.h:
21         (WebCore::ImageFrameCache::setDecoder): Deleted.
22         Moved to source file so we can keep the ImageDecoder forward declaration.
23         (WebCore::ImageFrameCache::decoder): Deleted.
24         Moved to source file so we can keep the ImageDecoder forward declaration.
25         * platform/graphics/ImageSource.h:
26         * platform/graphics/cg/ImageDecoderCG.h:
27         (WebCore::ImageDecoder::create):
28         * platform/graphics/win/ImageDecoderDirect2D.h:
29         (WebCore::ImageDecoder::create):
30         * platform/image-decoders/ImageDecoder.cpp:
31         (WebCore::ImageDecoder::create):
32         * platform/image-decoders/ImageDecoder.h:
33
34 2017-03-13  Manuel Rego Casasnovas  <rego@igalia.com>
35
36         Unprefix -webkit-min-content, -webkit-max-content and -webkit-fit-content
37         https://bugs.webkit.org/show_bug.cgi?id=169195
38
39         Reviewed by Sergio Villar Senin.
40
41         Based on Blink r200846 by <cbiesinger@chromium.org>.
42         https://src.chromium.org/viewvc/blink?revision=200846&view=revision
43
44         This patch adds support for the unprefixed version of these properties,
45         while it keeps the prefixed ones working too.
46         -webkit-fill-available is left out of this change, as the CSS WG
47         is still defining the final keyword and behavior.
48
49         With this patch WebKit will be in the same situation than Blink
50         regarding these intrinsic sizing keywords (see http://crbug.com/245157).
51
52         Test: fast/css-intrinsic-dimensions/height-property-value.html
53               fast/css-intrinsic-dimensions/width-property-value.html
54
55         * css/CSSPrimitiveValue.cpp:
56         (WebCore::CSSPrimitiveValue::init):
57         * css/CSSValueKeywords.in:
58         * css/StyleBuilderConverter.h:
59         (WebCore::StyleBuilderConverter::convertLengthSizing):
60         (WebCore::StyleBuilderConverter::createGridTrackBreadth):
61         * css/html.css:
62         (fieldset):
63         * css/parser/CSSPropertyParser.cpp:
64         (WebCore::validWidthOrHeightKeyword):
65         (WebCore::isGridTrackFixedSized):
66         (WebCore::consumeGridBreadth):
67         * html/track/TextTrackCueGeneric.cpp:
68         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
69         * html/track/VTTCue.cpp:
70         (WebCore::VTTCueBox::applyCSSProperties):
71
72 2017-03-13  Dean Jackson  <dino@apple.com>
73
74         WebGPU remote layer hosting
75         https://bugs.webkit.org/show_bug.cgi?id=169539
76         <rdar://problem/31005380>
77
78         Reviewed by Jon Lee.
79
80         Implement the WebProcess side of WebGPULayer hosting,
81         via LayerTypeWebGPULayer.
82
83         * platform/graphics/ca/PlatformCALayer.cpp:
84         (WebCore::operator<<): Provide nice pretty printing.
85         * platform/graphics/ca/PlatformCALayer.h: Add LayerTypeWebGPULayer.
86         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: Support LayerTypeWebGPULayer.
87         (PlatformCALayerCocoa::layerTypeForPlatformLayer):
88         (PlatformCALayerCocoa::PlatformCALayerCocoa):
89         (PlatformCALayerCocoa::commonInit):
90
91 2017-03-13  Zan Dobersek  <zdobersek@igalia.com>
92
93         Unreviewed GTK+ build fix. Adjust the Cookie constructor
94         invocation in CookieJarSoup, using empty values for the
95         newly-added parameters. This should probably be revised
96         to determine whether meaningful values can be passed in.
97
98         * platform/network/soup/CookieJarSoup.cpp:
99         (WebCore::getRawCookies):
100
101 2017-03-13  Jon Lee  <jonlee@apple.com>
102
103         WebGPU: Backend - hosting WebGPU layers
104         https://bugs.webkit.org/show_bug.cgi?id=169366
105         <rdar://problem/30928735>
106
107         Reviewed by Dean Jackson.
108
109         * html/canvas/WebGPURenderingContext.cpp:
110         (WebCore::WebGPURenderingContext::create): Create the device and the
111         rendering context.
112         * platform/graphics/cocoa/GPUCommandBufferMetal.mm:
113         (WebCore::GPUCommandBuffer::commit):
114         * platform/graphics/cocoa/GPUDrawableMetal.mm:
115         (WebCore::GPUDrawable::release): Fix a log message
116         * platform/graphics/gpu/GPUCommandBuffer.cpp:
117         (WebCore::GPUCommandBuffer::commit): Deleted. Moved to GPUCommandBufferMetal.
118         * rendering/RenderLayerBacking.cpp:
119         (WebCore::canvasCompositingStrategy): WebGPU canvas should return CanvasAsLayerContents.
120
121 2017-03-12  Jon Lee  <jonlee@apple.com>
122
123         Remove stubs from WebGPU front end
124         https://bugs.webkit.org/show_bug.cgi?id=169375
125
126         Reviewed by Dean Jackson.
127
128         Remove stubs and use the back end.
129         * html/canvas/WebGPUCommandBuffer.cpp:
130         * html/canvas/WebGPUCommandBuffer.h:
131         * html/canvas/WebGPUCommandQueue.cpp:
132         * html/canvas/WebGPUCommandQueue.h:
133         * html/canvas/WebGPUDepthStencilDescriptor.cpp:
134         (WebCore::WebGPUDepthStencilDescriptor::setDepthCompareFunction): Remove redundant clause.
135         * html/canvas/WebGPUDepthStencilDescriptor.h:
136         * html/canvas/WebGPUDepthStencilDescriptor.idl: Remove label property. Not needed yet.
137         * html/canvas/WebGPUDepthStencilState.cpp:
138         * html/canvas/WebGPUDepthStencilState.h:
139         * html/canvas/WebGPUEnums.cpp:
140         * html/canvas/WebGPUEnums.h:
141         * html/canvas/WebGPURenderCommandEncoder.cpp:
142         * html/canvas/WebGPURenderCommandEncoder.h:
143         * html/canvas/WebGPURenderPassAttachmentDescriptor.cpp:
144         * html/canvas/WebGPURenderPassAttachmentDescriptor.h:
145         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
146         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.h:
147         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
148         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h:
149         * html/canvas/WebGPURenderPassDescriptor.cpp:
150         (WebCore::WebGPURenderPassDescriptor::colorAttachments): Uncomment code with GPURenderPassColorAttachmentDescriptor available.
151         * html/canvas/WebGPURenderPassDescriptor.h:
152         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp:
153         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h:
154         * html/canvas/WebGPURenderPipelineDescriptor.cpp:
155         * html/canvas/WebGPURenderPipelineDescriptor.h:
156         * html/canvas/WebGPURenderPipelineDescriptor.idl: Remove label property. Not needed yet.
157         * html/canvas/WebGPURenderPipelineState.cpp:
158         * html/canvas/WebGPURenderPipelineState.h:
159
160 2017-03-12  Dean Jackson  <dino@apple.com>
161
162         WebGPU Backend
163         https://bugs.webkit.org/show_bug.cgi?id=169535
164         <rdar://problem/31002364>
165
166         Reviewed by Jon Lee.
167
168         Fill in the remainder of the WebGPU backend. This is effectively
169         a C++ representation of the Metal API.
170
171         * WebCore.xcodeproj/project.pbxproj:
172         * html/canvas/WebGPUDrawable.cpp:
173         (WebCore::WebGPUDrawable::WebGPUDrawable):
174         * html/canvas/WebGPUDrawable.h:
175         (WebCore::GPUDrawable::texture): Deleted.
176         * platform/graphics/cocoa/GPUBufferMetal.mm:
177         (WebCore::GPUBuffer::GPUBuffer):
178         (WebCore::GPUBuffer::platformBuffer):
179         * platform/graphics/cocoa/GPUCommandBufferMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
180         (WebCore::GPUCommandBuffer::GPUCommandBuffer):
181         (WebCore::GPUCommandBuffer::platformCommandBuffer):
182         (WebCore::GPUCommandBuffer::presentDrawable):
183         * platform/graphics/cocoa/GPUCommandQueueMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
184         (WebCore::GPUCommandQueue::GPUCommandQueue):
185         (WebCore::GPUCommandQueue::label):
186         (WebCore::GPUCommandQueue::setLabel):
187         (WebCore::GPUCommandQueue::platformCommandQueue):
188         * platform/graphics/cocoa/GPUDepthStencilDescriptorMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUTextureMetal.mm.
189         (WebCore::GPUDepthStencilDescriptor::GPUDepthStencilDescriptor):
190         (WebCore::GPUDepthStencilDescriptor::depthWriteEnabled):
191         (WebCore::GPUDepthStencilDescriptor::setDepthWriteEnabled):
192         (WebCore::GPUDepthStencilDescriptor::depthCompareFunction):
193         (WebCore::GPUDepthStencilDescriptor::setDepthCompareFunction):
194         (WebCore::GPUDepthStencilDescriptor::platformDepthStencilDescriptor):
195         * platform/graphics/cocoa/GPUDepthStencilStateMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
196         (WebCore::GPUDepthStencilState::GPUDepthStencilState):
197         (WebCore::GPUDepthStencilState::label):
198         (WebCore::GPUDepthStencilState::setLabel):
199         (WebCore::GPUDepthStencilState::platformDepthStencilState):
200         * platform/graphics/cocoa/GPUDrawableMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
201         (WebCore::GPUDrawable::GPUDrawable):
202         (WebCore::GPUDrawable::release):
203         (WebCore::GPUDrawable::platformDrawable):
204         (WebCore::GPUDrawable::platformTexture):
205         * platform/graphics/cocoa/GPUFunctionMetal.mm:
206         (WebCore::GPUFunction::GPUFunction):
207         (WebCore::GPUFunction::platformFunction):
208         * platform/graphics/cocoa/GPULibraryMetal.mm:
209         (WebCore::GPULibrary::GPULibrary):
210         (WebCore::GPULibrary::setLabel):
211         (WebCore::GPULibrary::platformLibrary):
212         * platform/graphics/cocoa/GPURenderCommandEncoderMetal.mm: Added.
213         (WebCore::GPURenderCommandEncoder::GPURenderCommandEncoder):
214         (WebCore::GPURenderCommandEncoder::setRenderPipelineState):
215         (WebCore::GPURenderCommandEncoder::setDepthStencilState):
216         (WebCore::GPURenderCommandEncoder::setVertexBuffer):
217         (WebCore::GPURenderCommandEncoder::setFragmentBuffer):
218         (WebCore::GPURenderCommandEncoder::drawPrimitives):
219         (WebCore::GPURenderCommandEncoder::endEncoding):
220         (WebCore::GPURenderCommandEncoder::platformRenderCommandEncoder):
221         * platform/graphics/cocoa/GPURenderPassAttachmentDescriptorMetal.mm: Added.
222         (WebCore::GPURenderPassAttachmentDescriptor::GPURenderPassAttachmentDescriptor):
223         (WebCore::GPURenderPassAttachmentDescriptor::loadAction):
224         (WebCore::GPURenderPassAttachmentDescriptor::setLoadAction):
225         (WebCore::GPURenderPassAttachmentDescriptor::storeAction):
226         (WebCore::GPURenderPassAttachmentDescriptor::setStoreAction):
227         (WebCore::GPURenderPassAttachmentDescriptor::setTexture):
228         (WebCore::GPURenderPassAttachmentDescriptor::platformRenderPassAttachmentDescriptor):
229         * platform/graphics/cocoa/GPURenderPassColorAttachmentDescriptorMetal.mm: Added.
230         (WebCore::GPURenderPassColorAttachmentDescriptor::create):
231         (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor):
232         (WebCore::GPURenderPassColorAttachmentDescriptor::clearColor):
233         (WebCore::GPURenderPassColorAttachmentDescriptor::setClearColor):
234         (WebCore::GPURenderPassColorAttachmentDescriptor::platformRenderPassColorAttachmentDescriptor):
235         * platform/graphics/cocoa/GPURenderPassDepthAttachmentDescriptorMetal.mm: Added.
236         (WebCore::GPURenderPassDepthAttachmentDescriptor::create):
237         (WebCore::GPURenderPassDepthAttachmentDescriptor::GPURenderPassDepthAttachmentDescriptor):
238         (WebCore::GPURenderPassDepthAttachmentDescriptor::clearDepth):
239         (WebCore::GPURenderPassDepthAttachmentDescriptor::setClearDepth):
240         (WebCore::GPURenderPassDepthAttachmentDescriptor::platformRenderPassDepthAttachmentDescriptor):
241         * platform/graphics/cocoa/GPURenderPassDescriptorMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUBufferMetal.mm.
242         (WebCore::GPURenderPassDescriptor::GPURenderPassDescriptor):
243         (WebCore::GPURenderPassDescriptor::colorAttachments):
244         (WebCore::GPURenderPassDescriptor::depthAttachment):
245         (WebCore::GPURenderPassDescriptor::platformRenderPassDescriptor):
246         * platform/graphics/cocoa/GPURenderPipelineColorAttachmentDescriptorMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPULibraryMetal.mm.
247         (WebCore::GPURenderPipelineColorAttachmentDescriptor::create):
248         (WebCore::GPURenderPipelineColorAttachmentDescriptor::GPURenderPipelineColorAttachmentDescriptor):
249         (WebCore::GPURenderPipelineColorAttachmentDescriptor::pixelFormat):
250         (WebCore::GPURenderPipelineColorAttachmentDescriptor::setPixelFormat):
251         (WebCore::GPURenderPipelineColorAttachmentDescriptor::platformRenderPipelineColorAttachmentDescriptor):
252         * platform/graphics/cocoa/GPURenderPipelineDescriptorMetal.mm: Added.
253         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
254         (WebCore::GPURenderPipelineDescriptor::depthAttachmentPixelFormat):
255         (WebCore::GPURenderPipelineDescriptor::setDepthAttachmentPixelFormat):
256         (WebCore::GPURenderPipelineDescriptor::setVertexFunction):
257         (WebCore::GPURenderPipelineDescriptor::setFragmentFunction):
258         (WebCore::GPURenderPipelineDescriptor::colorAttachments):
259         (WebCore::GPURenderPipelineDescriptor::reset):
260         (WebCore::GPURenderPipelineDescriptor::platformRenderPipelineDescriptor):
261         * platform/graphics/cocoa/GPURenderPipelineStateMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUTextureMetal.mm.
262         (WebCore::GPURenderPipelineState::GPURenderPipelineState):
263         (WebCore::GPURenderPipelineState::label):
264         (WebCore::GPURenderPipelineState::setLabel):
265         (WebCore::GPURenderPipelineState::platformRenderPipelineState):
266         * platform/graphics/cocoa/GPUTextureDescriptorMetal.mm:
267         (WebCore::GPUTextureDescriptor::GPUTextureDescriptor):
268         (WebCore::GPUTextureDescriptor::platformTextureDescriptor):
269         * platform/graphics/cocoa/GPUTextureMetal.mm:
270         (WebCore::GPUTexture::GPUTexture):
271         (WebCore::GPUTexture::platformTexture):
272         * platform/graphics/gpu/GPUBuffer.cpp:
273         * platform/graphics/gpu/GPUBuffer.h:
274         * platform/graphics/gpu/GPUCommandBuffer.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
275         (WebCore::GPUCommandBuffer::create):
276         (WebCore::GPUCommandBuffer::~GPUCommandBuffer):
277         (WebCore::GPUCommandBuffer::commit):
278         (WebCore::GPUCommandBuffer::createRenderCommandEncoder):
279         (WebCore::GPUCommandBuffer::presentDrawable):
280         * platform/graphics/gpu/GPUCommandBuffer.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
281         * platform/graphics/gpu/GPUCommandQueue.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
282         (WebCore::GPUCommandQueue::create):
283         (WebCore::GPUCommandQueue::~GPUCommandQueue):
284         (WebCore::GPUCommandQueue::createCommandBuffer):
285         (WebCore::GPUCommandQueue::label):
286         (WebCore::GPUCommandQueue::setLabel):
287         * platform/graphics/gpu/GPUCommandQueue.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
288         * platform/graphics/gpu/GPUDepthStencilDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
289         (WebCore::GPUDepthStencilDescriptor::create):
290         (WebCore::GPUDepthStencilDescriptor::~GPUDepthStencilDescriptor):
291         (WebCore::GPUDepthStencilDescriptor::depthWriteEnabled):
292         (WebCore::GPUDepthStencilDescriptor::setDepthWriteEnabled):
293         (WebCore::GPUDepthStencilDescriptor::depthCompareFunction):
294         (WebCore::GPUDepthStencilDescriptor::setDepthCompareFunction):
295         * platform/graphics/gpu/GPUDepthStencilDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
296         * platform/graphics/gpu/GPUDepthStencilState.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
297         (WebCore::GPUDepthStencilState::create):
298         (WebCore::GPUDepthStencilState::~GPUDepthStencilState):
299         (WebCore::GPUDepthStencilState::label):
300         (WebCore::GPUDepthStencilState::setLabel):
301         * platform/graphics/gpu/GPUDepthStencilState.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
302         * platform/graphics/gpu/GPUDevice.cpp:
303         (WebCore::GPUDevice::createCommandQueue):
304         (WebCore::GPUDevice::getFramebuffer):
305         * platform/graphics/gpu/GPUDevice.h:
306         (WebCore::GPUDevice::markLayerComposited):
307         (WebCore::GPUDevice::createCommandQueue): Deleted.
308         (WebCore::GPUDevice::getFramebuffer): Deleted.
309         * platform/graphics/gpu/GPUDrawable.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
310         (WebCore::GPUDrawable::create):
311         (WebCore::GPUDrawable::~GPUDrawable):
312         (WebCore::GPUDrawable::release):
313         * platform/graphics/gpu/GPUDrawable.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
314         * platform/graphics/gpu/GPUEnums.h: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
315         * platform/graphics/gpu/GPUFunction.h:
316         * platform/graphics/gpu/GPULibrary.cpp:
317         * platform/graphics/gpu/GPULibrary.h:
318         * platform/graphics/gpu/GPURenderCommandEncoder.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.cpp.
319         (WebCore::GPURenderCommandEncoder::create):
320         (WebCore::GPURenderCommandEncoder::~GPURenderCommandEncoder):
321         (WebCore::GPURenderCommandEncoder::setRenderPipelineState):
322         (WebCore::GPURenderCommandEncoder::setDepthStencilState):
323         (WebCore::GPURenderCommandEncoder::setVertexBuffer):
324         (WebCore::GPURenderCommandEncoder::setFragmentBuffer):
325         (WebCore::GPURenderCommandEncoder::drawPrimitives):
326         (WebCore::GPURenderCommandEncoder::endEncoding):
327         * platform/graphics/gpu/GPURenderCommandEncoder.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
328         * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
329         (WebCore::GPURenderPassAttachmentDescriptor::~GPURenderPassAttachmentDescriptor):
330         (WebCore::GPURenderPassAttachmentDescriptor::GPURenderPassAttachmentDescriptor):
331         (WebCore::GPURenderPassAttachmentDescriptor::loadAction):
332         (WebCore::GPURenderPassAttachmentDescriptor::setLoadAction):
333         (WebCore::GPURenderPassAttachmentDescriptor::storeAction):
334         (WebCore::GPURenderPassAttachmentDescriptor::setStoreAction):
335         (WebCore::GPURenderPassAttachmentDescriptor::setTexture):
336         * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
337         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUDevice.cpp.
338         (WebCore::GPURenderPassColorAttachmentDescriptor::create):
339         (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor):
340         (WebCore::GPURenderPassColorAttachmentDescriptor::~GPURenderPassColorAttachmentDescriptor):
341         (WebCore::GPURenderPassColorAttachmentDescriptor::clearColor):
342         (WebCore::GPURenderPassColorAttachmentDescriptor::setClearColor):
343         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
344         * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
345         (WebCore::GPURenderPassDepthAttachmentDescriptor::create):
346         (WebCore::GPURenderPassDepthAttachmentDescriptor::GPURenderPassDepthAttachmentDescriptor):
347         (WebCore::GPURenderPassDepthAttachmentDescriptor::~GPURenderPassDepthAttachmentDescriptor):
348         (WebCore::GPURenderPassDepthAttachmentDescriptor::clearDepth):
349         (WebCore::GPURenderPassDepthAttachmentDescriptor::setClearDepth):
350         * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
351         * platform/graphics/gpu/GPURenderPassDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
352         (WebCore::GPURenderPassDescriptor::create):
353         (WebCore::GPURenderPassDescriptor::~GPURenderPassDescriptor):
354         (WebCore::GPURenderPassDescriptor::depthAttachment):
355         * platform/graphics/gpu/GPURenderPassDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
356         * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
357         (WebCore::GPURenderPipelineColorAttachmentDescriptor::~GPURenderPipelineColorAttachmentDescriptor):
358         (WebCore::GPURenderPipelineColorAttachmentDescriptor::GPURenderPipelineColorAttachmentDescriptor):
359         (WebCore::GPURenderPipelineColorAttachmentDescriptor::pixelFormat):
360         (WebCore::GPURenderPipelineColorAttachmentDescriptor::setPixelFormat):
361         * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
362         * platform/graphics/gpu/GPURenderPipelineDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUDevice.cpp.
363         (WebCore::GPURenderPipelineDescriptor::create):
364         (WebCore::GPURenderPipelineDescriptor::~GPURenderPipelineDescriptor):
365         (WebCore::GPURenderPipelineDescriptor::depthAttachmentPixelFormat):
366         (WebCore::GPURenderPipelineDescriptor::setDepthAttachmentPixelFormat):
367         (WebCore::GPURenderPipelineDescriptor::setVertexFunction):
368         (WebCore::GPURenderPipelineDescriptor::setFragmentFunction):
369         (WebCore::GPURenderPipelineDescriptor::colorAttachments):
370         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
371         * platform/graphics/gpu/GPURenderPipelineState.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.cpp.
372         (WebCore::GPURenderPipelineState::create):
373         (WebCore::GPURenderPipelineState::~GPURenderPipelineState):
374         (WebCore::GPURenderPipelineState::label):
375         (WebCore::GPURenderPipelineState::setLabel):
376         * platform/graphics/gpu/GPURenderPipelineState.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
377         * platform/graphics/gpu/GPUTexture.cpp:
378         (WebCore::GPUTexture::createFromDrawable):
379         (WebCore::GPUTexture::createFromExistingTexture): Deleted.
380         * platform/graphics/gpu/GPUTexture.h:
381         * platform/graphics/gpu/GPUTextureDescriptor.cpp:
382         * platform/graphics/gpu/GPUTextureDescriptor.h:
383
384 2017-03-12  Zalan Bujtas  <zalan@apple.com>
385
386         Simple line layout: Paginated content is not painted properly when font overflows line height.
387         https://bugs.webkit.org/show_bug.cgi?id=169516
388
389         Reviewed by Antti Koivisto.
390
391         adjustLineIndexForStruts should take the IndexType::First/Last into account
392         when searching for the line index in a paginated context.
393         This also changes the the computed offset height from m_lineHeight to m_ascent + m_descent
394         so that we can find lines with large fonts (but small line height).
395
396         Test: fast/multicol/simple-line-layout-line-index-after-strut.html
397
398         * rendering/SimpleLineLayoutResolver.cpp:
399         (WebCore::SimpleLineLayout::RunResolver::adjustLineIndexForStruts):
400         (WebCore::SimpleLineLayout::RunResolver::lineIndexForHeight):
401         (WebCore::SimpleLineLayout::RunResolver::rangeForRect):
402         * rendering/SimpleLineLayoutResolver.h:
403
404 2017-03-12  Brady Eidson  <beidson@apple.com>
405
406         Add full NSHTTPCookie fidelity to WebCore::Cookie.
407         https://bugs.webkit.org/show_bug.cgi?id=169514
408
409         Reviewed by Dean Jackson.
410
411         No new tests (Refactor, no testable behavior change for now).
412
413         * platform/Cookie.h:
414         (WebCore::Cookie::Cookie):
415         (WebCore::Cookie::encode):
416         (WebCore::Cookie::decode):
417         
418         * platform/network/cocoa/CookieCocoa.mm:
419         (WebCore::portVectorFromList):
420         (WebCore::portStringFromVector):
421         (WebCore::Cookie::Cookie):
422         (WebCore::Cookie::operator NSHTTPCookie *):
423         
424         * platform/network/mac/CookieJarMac.mm:
425         (WebCore::getRawCookies):
426
427 2017-03-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
428
429         REGRESSION (r213764): Async image decoding is disabled for animated images
430         https://bugs.webkit.org/show_bug.cgi?id=169529
431
432         Reviewed by Jon Lee.
433         
434         The change r213764 causes the animated images to be decoded synchronously
435         because we were calling frameImageAtIndex() with an empty sizeForDrawing
436         but with a valid subsamplingLevel. This call is translated to be synchronous
437         image decoding. The fix is get the current image frame without any decoding.
438         This is because are sure that in the case of animated image, the current
439         image frame can not be deleted.
440
441         * platform/graphics/BitmapImage.cpp:
442         (WebCore::BitmapImage::draw):
443
444 2017-03-12  Romain Bellessort  <romain.bellessort@crf.canon.fr>
445
446         [Readable Streams API] Implement ReadableStreamBYOBRequest respond() (closed stream state)
447         https://bugs.webkit.org/show_bug.cgi?id=168781
448
449         Reviewed by Youenn Fablet.
450
451         Implemented ReadableStreamBYOBRequest respond() method in the case of a closed stream.
452
453         Added tests related to respond() method and updated WPT imported tests expectations.
454
455         * Modules/streams/ReadableByteStreamInternals.js:
456         (readableByteStreamControllerRespond): Added.
457         (readableByteStreamControllerRespondInternal): Added.
458         (readableByteStreamControllerRespondInClosedState): Added.
459         (readableByteStreamControllerShiftPendingPullInto): Added.
460         (readableByteStreamControllerInvalidateBYOBRequest): Added.
461         (readableByteStreamControllerCommitPullIntoDescriptor): Added.
462         (readableByteStreamControllerConvertPullIntoDescriptor): Added.
463         (readableStreamFulfillReadIntoRequest): Added.
464         * Modules/streams/ReadableStreamBYOBRequest.js:
465         (respond): Implemented.
466
467 2017-03-11  Simon Fraser  <simon.fraser@apple.com>
468
469         Fix memory estimate for layers supporting subpixel-antialised text
470         https://bugs.webkit.org/show_bug.cgi?id=169507
471         rdar://problem/30979337
472
473         Reviewed by Alexey Proskuryakov.
474
475         Deep color layers on iOS use 5 bytes per pixel, layers supporting subpixel-antialiaed 
476         text on Mac use 8 bytes per pixel.
477
478         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
479         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
480         (PlatformCALayerCocoa::backingStoreBytesPerPixel):
481
482 2017-03-11  Youenn Fablet  <youenn@apple.com>
483
484         XMLHttpRequest: make setRequestHeader() use `, ` as separator (including a space)
485         https://bugs.webkit.org/show_bug.cgi?id=169285
486
487         Reviewed by Sam Weinig.
488
489         Covered by updated tests.
490
491         * platform/network/HTTPHeaderMap.cpp:
492         (WebCore::HTTPHeaderMap::add): Reverting back to ', '.
493
494 2017-03-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
495
496         Enable async image decoding for large images
497         https://bugs.webkit.org/show_bug.cgi?id=165039
498
499         Reviewed by Simon Fraser.
500
501         When BitmapImage::draw() is called for a large image, we are going to request async
502         image decoding for the native image instead of drawing it. If a lower resolution 
503         native image is available for this, it is going to be drawn. Otherwise nothing will
504         be drawn. In both cases, a repaint will be scheduled for the image observer. This
505         should improve the image first time paint and the scrolling scenarios. It also makes
506         the scrolling more responsive by removing the decoding step from the main thread. 
507         
508         For now we are going to disable the asynchronous image decoding for the webkit test
509         runner because drawing the image does not block the page rendering anymore. An image
510         can be repainted later when its frame is ready for painting. This can cause a test
511         to fail because the webkit test runner may capture an image for the page before painting
512         all the images. The asynchronous image decoding can to be explicitly enabled from
513         the test page. Once the specs of the image 'async' attribute and 'ready' event is
514         approved, this should be revisited. It is important to test what we ship and eventually
515         async image decoding should be enabled in the webkit test runner.
516
517         * loader/cache/CachedImage.h: Change the default of LargeImageAsyncDecoding and AnimatedImageAsyncDecoding
518         to be false. This change fixes a layout test which creates an CachedImage inside an ImageDocument. The
519         CachedImage in this case does not have a loader so getting the values of these options from the settings
520         which is false for the DRT/WTR did not happen.
521         * platform/graphics/BitmapImage.cpp:
522         (WebCore::BitmapImage::destroyDecodedData): ImageSource::hasDecodingQueue() is renamed to ImageSource::hasAsyncDecodingQueue().
523         (WebCore::BitmapImage::frameImageAtIndex): Use String::utf8().data() instead of String::characters8().
524         (WebCore::BitmapImage::draw): If drawing the current frame is called while it is being
525         decoded, draw the current native image if the current frame was decoded but for a 
526         different size  and and will not invoke decoding while painting. If the frame is being
527         decoded and there isn't a decoded frame, return without drawing but set a flag that
528         that this image needs a repaint.
529         (WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImage): Renaming a function.
530         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImage): Ditto.
531         (WebCore::BitmapImage::internalStartAnimation): Use String::utf8().data() instead of String::characters8().
532         (WebCore::BitmapImage::advanceAnimation): Ditto.
533         (WebCore::BitmapImage::internalAdvanceAnimation): Ditto.
534         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Now this callback can be
535         called form the ImageFrameCache when finishing a frame of an animated image or the
536         frame of a large image. For large images, we need to call CachedImage::changedInRect()
537         if this image needs a repaint. If the decoding queue is idle, we should close it.
538         (WebCore::BitmapImage::isLargeImageAsyncDecodingRequired): Deleted. Function was renamed.
539         (WebCore::BitmapImage::isAnimatedImageAsyncDecodingRequired): Deleted. Ditto.
540         * platform/graphics/BitmapImage.h:
541
542         * platform/graphics/ImageFrameCache.cpp:
543         (WebCore::ImageFrameCache::~ImageFrameCache): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
544         (WebCore::ImageFrameCache::decodingQueue): Change the QNS of the decoding thread to be WorkQueue::QOS::Default.
545         WorkQueue::QOS::UserInteractive causes the scrolling thread to preempted  which can make the scrolling choppy.
546         (WebCore::ImageFrameCache::startAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
547         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Ditto.
548         (WebCore::ImageFrameCache::isAsyncDecodingQueueIdle): A helper function to tell whether the decoding thread is idle.
549         (WebCore::ImageFrameCache::stopAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
550         * platform/graphics/ImageFrameCache.h:
551         (WebCore::ImageFrameCache::hasAsyncDecodingQueue): Rename this function to be consistent with the rest of the functions.
552         (WebCore::ImageFrameCache::hasDecodingQueue): Deleted.
553
554         * platform/graphics/ImageSource.cpp:
555         (WebCore::ImageSource::shouldUseAsyncDecoding): Renaming a function. Change the heuristic for large images be
556         a little bigger than the heuristic for animated images.
557         (WebCore::ImageSource::isAsyncDecodingRequired): Deleted.
558         * platform/graphics/ImageSource.h:
559         (WebCore::ImageSource::hasAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
560         (WebCore::ImageSource::isAsyncDecodingQueueIdle): A wrapper for ImageFrameCache::isAsyncDecodingQueueIdle().
561         (WebCore::ImageSource::hasDecodingQueue): Deleted.
562         
563         * platform/graphics/cg/ImageDecoderCG.cpp:
564         (WebCore::ImageDecoder::createFrameImageAtIndex): CGImageSourceCreateThumbnailAtIndex() returns a CGImage with
565         the image native size regardless of the subsamplingLevel unless kCGImageSourceSubsampleFactor is passed. Here
566         we are trying to see which size is smaller: the image native size or the sizeForDrawing. If we want a CGImage
567         with the image native size, sizeForDrawing will not passed. So we need to get the image native size with the
568         default subsampling and then compare it with sizeForDrawing.
569
570 2017-03-11  Jon Lee  <jonlee@apple.com>
571
572         WebGPU prototype - Front-End
573         https://bugs.webkit.org/show_bug.cgi?id=167952
574
575         Reviewed by Dean Jackson.
576
577         This patch adds all of the relevant front-end files, and builds successfully when
578         ENABLE(WEBGPU) is off. For the back-end components that are not yet
579         implemented, a stub was added with a FIXME.
580
581         * DerivedSources.make: Add all the new IDL files.
582         * WebCore.xcodeproj/project.pbxproj: New IDL, front-end and generated files.
583
584         JS custom bindings.
585         * bindings/js/JSDocumentCustom.cpp: Add WebGPU clause for getCSSCanvasContext.
586         * bindings/js/JSHTMLCanvasElementCustom.cpp:
587         (WebCore::JSHTMLCanvasElement::getContext):
588         * bindings/js/JSWebGPURenderPassAttachmentDescriptorCustom.cpp: Added.
589         * bindings/js/JSWebGPURenderingContextCustom.cpp: Added.
590         * html/HTMLCanvasElement.cpp:
591         (WebCore::HTMLCanvasElement::getContext):
592         (WebCore::HTMLCanvasElement::isWebGPUType):
593         (WebCore::HTMLCanvasElement::getContextWebGPU):
594         (WebCore::HTMLCanvasElement::reset):
595         (WebCore::HTMLCanvasElement::paint):
596         (WebCore::HTMLCanvasElement::isGPU):
597         (WebCore::HTMLCanvasElement::getContextWebGPU): For release builds, switch to ASSERT_UNUSED.
598         * html/HTMLCanvasElement.h:
599         * html/canvas/CanvasRenderingContext.h:
600         (WebCore::CanvasRenderingContext::isGPU):
601
602         .cpp, .h, .idl files, wrapped in WEBGPU conditional, and enabled at runtime.
603         * html/canvas/WebGPUBuffer:
604         * html/canvas/WebGPUCommandBuffer:
605         * html/canvas/WebGPUCommandQueue:
606         * html/canvas/WebGPUDepthStencilDescriptor:
607         * html/canvas/WebGPUDepthStencilState:
608         * html/canvas/WebGPUDrawable:
609         * html/canvas/WebGPUEnums:
610         * html/canvas/WebGPUFunction:
611         * html/canvas/WebGPULibrary:
612         * html/canvas/WebGPUObject (no IDL):
613         * html/canvas/WebGPURenderCommandEncoder:
614         * html/canvas/WebGPURenderPassAttachmentDescriptor:
615         * html/canvas/WebGPURenderPassColorAttachmentDescriptor:
616         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor:
617         * html/canvas/WebGPURenderPassDescriptor:
618         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor:
619         * html/canvas/WebGPURenderPipelineDescriptor:
620         * html/canvas/WebGPURenderPipelineState:
621         * html/canvas/WebGPURenderingContext:
622         * html/canvas/WebGPUTexture:
623         * html/canvas/WebGPUTextureDescriptor:  Add stubs.
624
625 2017-03-11  Brady Eidson  <beidson@apple.com>
626
627         Cleanup "addCookie" and its sole user.
628         https://bugs.webkit.org/show_bug.cgi?id=169486
629
630         Reviewed by Brian Burg.
631
632         No new tests (Refactor, no behavior change)
633
634         * WebCore.xcodeproj/project.pbxproj:
635
636         * loader/CookieJar.cpp:
637         (WebCore::addCookie): Deleted.
638         * loader/CookieJar.h:
639
640         * platform/Cookie.h:
641         (WebCore::Cookie::Cookie):
642         (WebCore::CookieHash::hash):
643         (WebCore::CookieHash::equal):
644         (WebCore::Cookie::encode):
645         (WebCore::Cookie::decode):
646
647         * platform/CookiesStrategy.h:
648
649         * platform/network/NetworkStorageSession.h:
650
651         * platform/network/PlatformCookieJar.h:
652
653         * platform/network/cf/CookieJarCFNet.cpp:
654         (WebCore::addCookie): Deleted.
655
656         * platform/network/cocoa/CookieCocoa.mm: Copied from Source/WebCore/loader/CookieJar.h.
657         (WebCore::Cookie::operator NSHTTPCookie *):
658
659         * platform/network/cocoa/NetworkStorageSessionCocoa.mm: Copied from Source/WebCore/loader/CookieJar.h.
660         (WebCore::NetworkStorageSession::setCookies):
661         (WebCore::NetworkStorageSession::nsCookieStorage):
662
663         * platform/network/curl/CookieJarCurl.cpp:
664         (WebCore::addCookie): Deleted.
665
666         * platform/network/mac/CookieJarMac.mm:
667         (WebCore::deleteCookiesForHostnames):
668         (WebCore::deleteAllCookiesModifiedSince):
669         (WebCore::addCookie): Deleted.
670         (WebCore::cookieStorage): Deleted.
671
672         * platform/network/soup/CookieJarSoup.cpp:
673         (WebCore::toSoupCookie): Deleted.
674         (WebCore::addCookie): Deleted.
675
676         * platform/network/soup/NetworkStorageSessionSoup.cpp:
677         (WebCore::toSoupCookie):
678         (WebCore::NetworkStorageSession::setCookies):
679
680 2017-03-10  Alex Christensen  <achristensen@webkit.org>
681
682         Fix watch and tv builds after r213294
683         https://bugs.webkit.org/show_bug.cgi?id=169508
684
685         Reviewed by Dan Bernstein.
686
687         * Configurations/FeatureDefines.xcconfig:
688
689 2017-03-10  Dave Hyatt  <hyatt@apple.com>
690
691         Percentage constrained images shrinking inside blocks inside nested flex boxes
692         https://bugs.webkit.org/show_bug.cgi?id=169438
693
694         Reviewed by Dean Jackson.
695
696         Added new test in fast/hidpi.
697
698         * rendering/RenderBlock.cpp:
699         (WebCore::RenderBlock::computeChildPreferredLogicalWidths):
700         Make sure to clear out flexbox override sizes when computing preferred logical widths,
701         since they should not ever influence the preferred size.
702
703 2017-03-10  Youenn Fablet  <youenn@apple.com>
704
705         Move libwebrtc backend to using tracks
706         https://bugs.webkit.org/show_bug.cgi?id=169472
707
708         Reviewed by Alex Christensen.
709
710         Covered by current test sets.
711
712         This change allows to move away from streams and use more tracks.
713         This allows future better alignment with the spec and better implementation of sender/receover/transceiver.
714
715         Small refactoring to use more Ref<> in WebRTC track-based code.
716         Added a notifyAddedTrack to notify the backend that a track was added.
717         For libwebrtc, this allows calling AddTrack before making the offer.
718         Updated mock libwebrtc backend accordingly.
719
720         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
721         (WebCore::MediaEndpointPeerConnection::replaceTrack):
722         (WebCore::MediaEndpointPeerConnection::replaceTrackTask):
723         * Modules/mediastream/MediaEndpointPeerConnection.h:
724         * Modules/mediastream/PeerConnectionBackend.h:
725         (WebCore::PeerConnectionBackend::notifyAddedTrack):
726         * Modules/mediastream/RTCPeerConnection.cpp:
727         (WebCore::RTCPeerConnection::addTrack):
728         (WebCore::RTCPeerConnection::replaceTrack):
729         * Modules/mediastream/RTCPeerConnection.h:
730         * Modules/mediastream/RTCRtpSender.cpp:
731         (WebCore::RTCRtpSender::create):
732         (WebCore::RTCRtpSender::RTCRtpSender):
733         (WebCore::RTCRtpSender::setTrack):
734         * Modules/mediastream/RTCRtpSender.h:
735         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
736         (WebCore::LibWebRTCMediaEndpoint::addTrack):
737         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
738         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
739         (WebCore::LibWebRTCMediaEndpoint::getStats):
740         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
741         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
742         (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate):
743         (WebCore::LibWebRTCPeerConnectionBackend::notifyAddedTrack):
744         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
745         * testing/MockLibWebRTCPeerConnection.cpp:
746         (WebCore::MockLibWebRTCPeerConnection::AddTrack):
747         (WebCore::MockLibWebRTCPeerConnection::RemoveTrack):
748         (WebCore::MockLibWebRTCPeerConnection::CreateOffer):
749         (WebCore::MockLibWebRTCPeerConnection::CreateAnswer):
750         * testing/MockLibWebRTCPeerConnection.h:
751         (WebCore::MockRtpSender::MockRtpSender):
752         (WebCore::MockRtpSender::ssrc):
753         (WebCore::MockRtpSender::media_type):
754         (WebCore::MockRtpSender::id):
755         (WebCore::MockRtpSender::stream_ids):
756         (WebCore::MockRtpSender::GetParameters):
757         (WebCore::MockRtpSender::SetParameters):
758         (WebCore::MockRtpSender::GetDtmfSender):
759
760 2017-03-10  Zalan Bujtas  <zalan@apple.com>
761
762         Simple line layout: Check how many orphans needed on the current page before breaking.
763         https://bugs.webkit.org/show_bug.cgi?id=169477
764
765         Reviewed by Antti Koivisto.
766
767         Before breaking for the widows we actually need to check for orphans first.
768
769         Test: fast/multicol/simple-line-layout-orphans-and-widows.html
770
771         * rendering/SimpleLineLayoutPagination.cpp:
772         (WebCore::SimpleLineLayout::computeLineBreakIndex):
773         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
774
775 2017-03-10  Dean Jackson  <dino@apple.com>
776
777         WebGPU: Backend - Textures and TextureDescriptors
778         https://bugs.webkit.org/show_bug.cgi?id=169365
779         <rdar://problem/30928716>
780
781         Reviewed by Jon Lee with help from Anders Carlsson.
782
783         Backend implementation of textures for WebGPU, which adds
784         the GPUTexture and GPUTextureDescriptor classes, as well
785         as a creation method on GPUDevice.
786
787         * PlatformMac.cmake:
788         * WebCore.xcodeproj/project.pbxproj:
789         * platform/graphics/cocoa/GPUTextureDescriptorMetal.mm: Added.
790         (WebCore::GPUTextureDescriptor::GPUTextureDescriptor):
791         (WebCore::GPUTextureDescriptor::width):
792         (WebCore::GPUTextureDescriptor::setWidth):
793         (WebCore::GPUTextureDescriptor::height):
794         (WebCore::GPUTextureDescriptor::setHeight):
795         (WebCore::GPUTextureDescriptor::sampleCount):
796         (WebCore::GPUTextureDescriptor::setSampleCount):
797         (WebCore::GPUTextureDescriptor::textureType):
798         (WebCore::GPUTextureDescriptor::setTextureType):
799         (WebCore::GPUTextureDescriptor::storageMode):
800         (WebCore::GPUTextureDescriptor::setStorageMode):
801         (WebCore::GPUTextureDescriptor::usage):
802         (WebCore::GPUTextureDescriptor::setUsage):
803         (WebCore::GPUTextureDescriptor::platformTextureDescriptor):
804         * platform/graphics/cocoa/GPUTextureMetal.mm:
805         (WebCore::GPUTexture::GPUTexture):
806         (WebCore::GPUTexture::width):
807         (WebCore::GPUTexture::height):
808         (WebCore::GPUTexture::platformTexture):
809         * platform/graphics/gpu/GPUDevice.cpp:
810         (WebCore::GPUDevice::createTexture):
811         * platform/graphics/gpu/GPUDevice.h:
812         * platform/graphics/gpu/GPUTexture.cpp:
813         (WebCore::GPUTexture::create):
814         (WebCore::GPUTexture::createFromExistingTexture):
815         (WebCore::GPUTexture::~GPUTexture):
816         (WebCore::GPUTexture::width):
817         (WebCore::GPUTexture::height):
818         * platform/graphics/gpu/GPUTexture.h:
819         * platform/graphics/gpu/GPUTextureDescriptor.cpp:
820         (WebCore::GPUTextureDescriptor::create):
821         (WebCore::GPUTextureDescriptor::~GPUTextureDescriptor):
822         (WebCore::GPUTextureDescriptor::width):
823         (WebCore::GPUTextureDescriptor::setWidth):
824         (WebCore::GPUTextureDescriptor::height):
825         (WebCore::GPUTextureDescriptor::setHeight):
826         (WebCore::GPUTextureDescriptor::sampleCount):
827         (WebCore::GPUTextureDescriptor::setSampleCount):
828         (WebCore::GPUTextureDescriptor::textureType):
829         (WebCore::GPUTextureDescriptor::setTextureType):
830         (WebCore::GPUTextureDescriptor::storageMode):
831         (WebCore::GPUTextureDescriptor::setStorageMode):
832         (WebCore::GPUTextureDescriptor::usage):
833         (WebCore::GPUTextureDescriptor::setUsage):
834         * platform/graphics/gpu/GPUTextureDescriptor.h:
835
836 2017-03-10  Per Arne Vollan  <pvollan@apple.com>
837
838         [Win] Scrollbars buttons have incorrect size in HiDPI.
839         https://bugs.webkit.org/show_bug.cgi?id=169463
840
841         Reviewed by Alex Christensen.
842
843         There seems to be a bug in DrawThemeBackground when the device context is scaled.
844         We can work around this by scaling the drawing rectangle instead.
845  
846         * platform/win/ScrollbarThemeWin.cpp:
847         (WebCore::ScrollbarThemeWin::paintButton):
848
849 2017-03-10  Zalan Bujtas  <zalan@apple.com>
850
851         Simple line layout: Oprhan lines with visual overflow does not work properly.
852         https://bugs.webkit.org/show_bug.cgi?id=169409
853
854         Reviewed by Antti Koivisto.
855
856         Add visual overflow checking for block strut. This logic is copied from RenderBlockFlow::adjustLinePositionForPagination.
857
858         Covered by existing test.
859
860         * rendering/SimpleLineLayoutFunctions.cpp:
861         (WebCore::SimpleLineLayout::computeOverflow):
862         * rendering/SimpleLineLayoutFunctions.h:
863         * rendering/SimpleLineLayoutPagination.cpp:
864         (WebCore::SimpleLineLayout::setPageBreakForLine):
865
866 2017-03-09  Simon Fraser  <simon.fraser@apple.com>
867
868         [iOS WK2] Layer content blurry with nested perspective and transforms
869         https://bugs.webkit.org/show_bug.cgi?id=169457
870         rdar://problem/29879484
871
872         Reviewed by Tim Horton.
873
874         We set rasterizationScale on CALayers to the same values as contentsScale, to
875         avoid blurry layers when CA rasterizes, which often happens with nested perspective
876         transforms.
877         
878         However, in UI-side compositing, if the page is not zoomed, we never applied the
879         rasterizationScale in the UI process. This happened because the PlatformCALayerRemote
880         constructor set m_properties.contentsScale, but did not set the dirty bit that
881         triggers the application of contentsScale and rasterizationScale in RemoteLayerTreePropertyApplier.
882         The fix is to set this dirty bit.
883         
884         The rest of the changes are for testing. Internals now exposes layerIDForElement()
885         for returns an internal (non-stable-across-loads) layerID, which can be passed
886         to UIScriptController.propertiesOfLayerWithID() in the UI process, which inspects
887         the built layer (UIView) hierarchy. propertiesOfLayerWithID() returns a dictionary
888         which the test can dump as JSON, or pull values out of.
889
890         A few #pragma once cleanups also.
891
892         Tests: compositing/ios/basic-layer-properties.html
893                compositing/ios/rasterization-scale.html
894
895         * testing/Internals.cpp:
896         (WebCore::Internals::layerIDForElement):
897         * testing/Internals.h:
898         * testing/Internals.idl:
899
900 2017-03-10  Commit Queue  <commit-queue@webkit.org>
901
902         Unreviewed, rolling out r213618.
903         https://bugs.webkit.org/show_bug.cgi?id=169475
904
905         Suspect this is the cause of a large memory regression
906         (Requested by jonlee_ on #webkit).
907
908         Reverted changeset:
909
910         "Enable async image decoding for large images"
911         https://bugs.webkit.org/show_bug.cgi?id=165039
912         http://trac.webkit.org/changeset/213618
913
914 2017-03-10  Antti Koivisto  <antti@apple.com>
915
916         Allow the page to render before <link> stylesheet tags in body
917         https://bugs.webkit.org/show_bug.cgi?id=149157
918         <rdar://problem/24658830>
919
920         Reviewed by Simon Fraser.
921
922         Currently we block style and renderer building completely if document has any loading
923         stylesheets. In case a script queries something layout dependent we construct the render
924         tree with whatever style we have but block painting in it.
925
926         This patch changes behavior so that a loading stylesheet in body only blocks rendering for elements
927         that are after it. The expectation is that such stylesheets rarely affect elements before them
928         and the elements can be rendered without causing ugly visible styling changes.
929
930         The patch replaces the old flash-of-unstyled-content (FOUC) preventation mechanism with a more
931         fine-grained one. Paint blocking is now done on per-renderer basis with based on isNonFinal flag in
932         RenderStyle.
933
934         For stylesheets in head the behavior should be largely unchanged.
935
936         Test: http/tests/incremental/stylesheet-body-incremental-rendering.html
937
938         * css/StyleResolver.cpp:
939         (WebCore::StyleResolver::pseudoStyleRulesForElement):
940         * dom/Document.cpp:
941         (WebCore::Document::Document):
942         (WebCore::Document::resolveStyle):
943         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
944
945             Remove the old FOUC preventation state tracking.
946
947         (WebCore::Document::shouldScheduleLayout):
948         (WebCore::Document::didRemoveAllPendingStylesheet):
949
950             Repaints will now get triggered by the normal style mechanism.
951
952         * dom/Document.h:
953         (WebCore::Document::hasNodesWithNonFinalStyle):
954         (WebCore::Document::setHasNodesWithNonFinalStyle):
955
956             Track if we need to recompute the style later because non-final or unstyled elements.
957
958         (WebCore::Document::didLayoutWithPendingStylesheets): Deleted.
959         (WebCore::Document::hasNodesWithPlaceholderStyle): Deleted.
960         (WebCore::Document::setHasNodesWithPlaceholderStyle): Deleted.
961         * html/HTMLFrameSetElement.cpp:
962         (WebCore::HTMLFrameSetElement::rendererIsNeeded):
963         * page/FrameView.cpp:
964         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty):
965
966             Don't qualify as visually non-empty if we have loading stylesheets in head (even if there is
967             a fouc-prevented render tree).
968
969         (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
970         * rendering/RenderBlock.cpp:
971         (WebCore::RenderBlock::paintContents):
972
973             Instead of a global test, block painting if isNonFinal is set in the renderer's style.
974
975         * rendering/RenderLayer.cpp:
976         (WebCore::shouldSuppressPaintingLayer):
977         * rendering/style/RenderStyle.cpp:
978         (WebCore::RenderStyle::changeRequiresRepaint):
979
980             The isNonFinal flag prevents painting so we need to trigger repaint when it gets cleared.
981
982         * rendering/style/RenderStyle.h:
983         (WebCore::RenderStyle::isNotFinal):
984         (WebCore::RenderStyle::setIsNotFinal):
985         (WebCore::RenderStyle::isPlaceholderStyle): Deleted.
986         (WebCore::RenderStyle::setIsPlaceholderStyle): Deleted.
987
988             There is no need for placeholder styles anymore. Reuse the bit for isNotFinal.
989
990         * rendering/style/StyleRareNonInheritedData.cpp:
991         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
992         (WebCore::StyleRareNonInheritedData::operator==):
993         * rendering/style/StyleRareNonInheritedData.h:
994         * style/StyleScope.cpp:
995         (WebCore::Style::Scope::analyzeStyleSheetChange):
996         (WebCore::Style::Scope::updateActiveStyleSheets):
997         * style/StyleTreeResolver.cpp:
998         (WebCore::Style::TreeResolver::styleForElement):
999         (WebCore::Style::TreeResolver::resolveElement):
1000
1001             If we have seens a loading stylesheet and don't have a renderer yet don't style the element.
1002             In case there is a renderer or we are ignoring pending sheets, resolve the style normally
1003             but mark it as non-final.
1004
1005         (WebCore::Style::makePlaceholderStyle): Deleted.
1006
1007 2017-03-10  Antti Koivisto  <antti@apple.com>
1008
1009         imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute.html is unreliable
1010         https://bugs.webkit.org/show_bug.cgi?id=169465
1011
1012         Reviewed by Zalan Bujtas.
1013
1014         It shows all subtests passing but that is a bug. We don't even support all the unit types.
1015         The test occasionally fails when reloading, that failing results are actually the correct ones.
1016
1017         * css/parser/SizesAttributeParser.cpp:
1018         (WebCore::SizesAttributeParser::SizesAttributeParser):
1019
1020             Ensure we have correct size for the iframe before parsing 'sizes' attribute values. The interpretation of
1021             these may depend on the iframe dimensions.
1022
1023 2017-03-10  Antoine Quint  <graouts@apple.com>
1024
1025         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
1026         https://bugs.webkit.org/show_bug.cgi?id=168409
1027
1028         Unreviewed.
1029
1030         Add some debugging in the hope of understanding why airplay-button.html fails once a day on bots.
1031
1032         * Modules/modern-media-controls/controls/scheduler.js:
1033         (const.scheduler.new.prototype.scheduleLayout):
1034         (const.scheduler.new.prototype.unscheduleLayout):
1035         (const.scheduler.new.prototype._requestFrameIfNeeded):
1036         (const.scheduler.new.prototype._frameDidFire):
1037         (const.scheduler.new.prototype._layout):
1038
1039 2017-03-09  Ryan Haddad  <ryanhaddad@apple.com>
1040
1041         Unreviewed, rolling out r213633.
1042
1043         This change caused LayoutTest imported/w3c/web-platform-
1044         tests/html/semantics/embedded-content/the-img-
1045         element/sizes/parse-a-sizes-attribute.html to become a flaky
1046         failure.
1047
1048         Reverted changeset:
1049
1050         "Loading in-body stylesheets should not block rendering of
1051         elements before them"
1052         https://bugs.webkit.org/show_bug.cgi?id=169345
1053         http://trac.webkit.org/changeset/213633
1054
1055 2017-03-09  Alex Christensen  <achristensen@webkit.org>
1056
1057         Fix CMake build
1058
1059         * PlatformMac.cmake:
1060
1061 2017-03-09  Alex Christensen  <achristensen@webkit.org>
1062
1063         Fix GTK build after r213696
1064
1065         * PlatformMac.cmake:
1066
1067 2017-03-09  Brian Nicholson  <bnicholson@mozilla.com> and Alex Christensen  <achristensen@webkit.org>
1068
1069         Expose public APIs for content filters
1070         https://bugs.webkit.org/show_bug.cgi?id=150479
1071
1072         Reviewed by Brady Eidson and Geoff Garen.
1073
1074         * English.lproj/Localizable.strings:
1075
1076 2017-03-09  Matt Baker  <mattbaker@apple.com>
1077
1078         Web Inspector: Add XHR breakpoints UI
1079         https://bugs.webkit.org/show_bug.cgi?id=168763
1080         <rdar://problem/30952439>
1081
1082         Reviewed by Joseph Pecoraro.
1083
1084         Test: inspector/dom-debugger/xhr-breakpoints.html
1085
1086         * inspector/InspectorDOMDebuggerAgent.cpp:
1087         (WebCore::InspectorDOMDebuggerAgent::discardBindings):
1088         (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
1089         Don't break for XHRs when breakpoints are disabled.
1090
1091 2017-03-09  Michael Saboff  <msaboff@apple.com>
1092
1093         Add plumbing to WebProcess to enable JavaScriptCore configuration and logging
1094         https://bugs.webkit.org/show_bug.cgi?id=169387
1095
1096         Reviewed by Filip Pizlo.
1097
1098         Added a forwarding header file for JavScriptCore/runtime/ConfigFile.h.
1099
1100         * ForwardingHeaders/runtime/ConfigFile.h: Added.
1101
1102 2017-03-09  John Wilander  <wilander@apple.com>
1103
1104         Resource Load Statistics: Remove statistics data as part of full website data removal
1105         https://bugs.webkit.org/show_bug.cgi?id=169448
1106
1107         Reviewed by Alex Christensen.
1108
1109         Test: http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store.html
1110
1111         * loader/ResourceLoadObserver.cpp:
1112         (WebCore::ResourceLoadObserver::clearInMemoryAndPersistentStore):
1113             The version of this function that takes a modifiedSince parameter
1114             checks if it is equal to or less than the start of the Unix epoch.
1115             If so, it clears the store. This is to support clear all website
1116             data.
1117         * loader/ResourceLoadObserver.h:
1118         * loader/ResourceLoadStatisticsStore.cpp:
1119         (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent):
1120         (WebCore::ResourceLoadStatisticsStore::setWritePersistentStoreCallback):
1121         * loader/ResourceLoadStatisticsStore.h:
1122             Added m_writePersistentStoreHandler, a setter for it, and
1123             ResourceLoadStatisticsStore::clearInMemoryAndPersistent().
1124
1125 2017-03-09  Matt Rajca  <mrajca@apple.com>
1126
1127         Only consider autoplay interference in the first 10 seconds of playback.
1128         https://bugs.webkit.org/show_bug.cgi?id=169455
1129
1130         Reviewed by Alex Christensen.
1131
1132         If the media duration is relatively long, say, 10 minutes, and you pause 5 minutes in, that's
1133         probably not a strong indication users may not want auto-play. This patch limits interference
1134         events to the first 10 seconds of automatic playback.
1135
1136         * html/HTMLMediaElement.cpp:
1137         (WebCore::HTMLMediaElement::setReadyState):
1138         (WebCore::HTMLMediaElement::play):
1139         (WebCore::HTMLMediaElement::playInternal):
1140         (WebCore::HTMLMediaElement::pauseInternal):
1141         (WebCore::HTMLMediaElement::setMuted):
1142         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
1143         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
1144         (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay):
1145         (WebCore::HTMLMediaElement::setPlaybackWithoutUserGesture):
1146         (WebCore::HTMLMediaElement::pageMutedStateDidChange):
1147         * html/HTMLMediaElement.h:
1148
1149 2017-03-09  Brady Eidson  <beidson@apple.com>
1150
1151         Add WKURLSchemeHandler API for handling custom protocols.
1152         https://bugs.webkit.org/show_bug.cgi?id=169422
1153
1154         Reviewed by Tim Horton.
1155
1156         * platform/URLParser.cpp:
1157         (WebCore::URLParser::maybeCanonicalizeScheme):
1158         (WebCore::URLParser::isSpecialScheme):
1159         * platform/URLParser.h:
1160
1161 2017-03-09  Dean Jackson  <dino@apple.com>
1162
1163         WebGPU: Backend - Buffers
1164         https://bugs.webkit.org/show_bug.cgi?id=169451
1165         <rdar://problem/30959168>
1166
1167         Reviewed by Tim Horton.
1168
1169         Implement the backend for GPUBuffer, which
1170         represents a chunk of memory that can be used
1171         by the GPU. You create one using an ArrayBufferView.
1172
1173         WebKit API Test: GPUBuffer.mm
1174
1175         * PlatformMac.cmake:
1176         * WebCore.xcodeproj/project.pbxproj:
1177         * platform/graphics/cocoa/GPUBufferMetal.mm:
1178         (WebCore::GPUBuffer::GPUBuffer):
1179         (WebCore::GPUBuffer::length):
1180         (WebCore::GPUBuffer::contents):
1181         (WebCore::GPUBuffer::platformBuffer):
1182         * platform/graphics/gpu/GPUBuffer.cpp:
1183         (WebCore::GPUBuffer::create):
1184         (WebCore::GPUBuffer::~GPUBuffer):
1185         (WebCore::GPUBuffer::length):
1186         (WebCore::GPUBuffer::contents):
1187         * platform/graphics/gpu/GPUBuffer.h:
1188         * platform/graphics/gpu/GPUDevice.cpp:
1189         (WebCore::GPUDevice::createBufferFromData):
1190         * platform/graphics/gpu/GPUDevice.h:
1191
1192 2017-03-09  Joseph Pecoraro  <pecoraro@apple.com>
1193
1194         Web Inspector: Show HTTP protocol version and other Network Load Metrics (IP Address, Priority, Connection ID)
1195         https://bugs.webkit.org/show_bug.cgi?id=29687
1196         <rdar://problem/19281586>
1197
1198         Reviewed by Matt Baker and Brian Burg.
1199
1200         Test: http/tests/inspector/network/resource-metrics.html
1201
1202         * inspector/InspectorNetworkAgent.cpp:
1203         (WebCore::toProtocol):
1204         (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
1205         (WebCore::InspectorNetworkAgent::didFinishLoading):
1206         Send metrics at didFinishLoading time, we do not have all of
1207         these at didReceiveResponse time.
1208
1209         * inspector/InspectorInstrumentation.cpp:
1210         (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
1211         * inspector/InspectorInstrumentation.h:
1212         (WebCore::InspectorInstrumentation::didFinishLoading):
1213         * inspector/InspectorNetworkAgent.h:
1214         * loader/CrossOriginPreflightChecker.cpp:
1215         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
1216         * loader/DocumentLoader.cpp:
1217         (WebCore::DocumentLoader::finishedLoading):
1218         * loader/ResourceLoadNotifier.cpp:
1219         (WebCore::ResourceLoadNotifier::didFinishLoad):
1220         (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
1221         (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
1222         * loader/ResourceLoadNotifier.h:
1223         * loader/SubresourceLoader.cpp:
1224         (WebCore::SubresourceLoader::didFinishLoading):
1225         * loader/appcache/ApplicationCacheGroup.cpp:
1226         (WebCore::ApplicationCacheGroup::didFinishLoading):
1227         Include or pass on NetworkLoadMetrics to Web Inspector.
1228
1229         * platform/network/NetworkLoadMetrics.h:
1230         (WebCore::NetworkLoadMetrics::isolatedCopy):
1231         (WebCore::NetworkLoadMetrics::reset):
1232         (WebCore::NetworkLoadMetrics::operator==):
1233         (WebCore::NetworkLoadMetrics::encode):
1234         (WebCore::NetworkLoadMetrics::decode):
1235         Add new optional metrics properties.
1236
1237         (WTF::Persistence::Coder<std::optional<WebCore::NetworkLoadPriority>>::encode):
1238         (WTF::Persistence::Coder<std::optional<WebCore::NetworkLoadPriority>>::decode):
1239         We never encode this but this is needed for the compiler.
1240
1241         * platform/spi/cocoa/NSURLConnectionSPI.h:
1242         New SPI for NSURLSessionTaskTransactionMetrics details.
1243
1244 2017-03-09  Anders Carlsson  <andersca@apple.com>
1245
1246         Use the right conditional.
1247
1248         * Modules/applepay/ApplePayError.idl:
1249
1250 2017-03-09  Daniel Bates  <dabates@apple.com>
1251
1252         Guard Credential Management implementation behind a runtime enabled feature flag
1253         https://bugs.webkit.org/show_bug.cgi?id=169364
1254         <rdar://problem/30957425>
1255
1256         Reviewed by Brent Fulgham.
1257
1258         Add a runtime enabled feature flag for Credential Management (disabled by default).
1259         Once we are happy with this feature we can enable the feature by default or remove the
1260         the runtime enabled feature flag so as to enable it by default.
1261
1262         * Modules/credentials/BasicCredential.idl: Enable only if the runtime enabled feature flag is
1263          enabled.
1264         * Modules/credentials/PasswordCredential.idl: Ditto.
1265         * Modules/credentials/SiteBoundCredential.idl: Ditto.
1266         * page/RuntimeEnabledFeatures.h:
1267         (WebCore::RuntimeEnabledFeatures::setCredentialManagementEnabled): Added.
1268         (WebCore::RuntimeEnabledFeatures::credentialManagementEnabled): Added.
1269
1270 2017-03-09  Anders Carlsson  <andersca@apple.com>
1271
1272         Add delegate support to WebCore
1273         https://bugs.webkit.org/show_bug.cgi?id=169427
1274         Part of rdar://problem/28880714.
1275
1276         Reviewed by Geoffrey Garen.
1277
1278         * Configurations/FeatureDefines.xcconfig:
1279         Add feature define.
1280
1281         * DerivedSources.make:
1282         Add idl files.
1283
1284         * Modules/applepay/ApplePayError.cpp:
1285         (WebCore::ApplePayError::create):
1286         (WebCore::ApplePayError::ApplePayError):
1287         (WebCore::ApplePayError::~ApplePayError):
1288         * Modules/applepay/ApplePayError.h:
1289         * Modules/applepay/ApplePayError.idl:
1290         * Modules/applepay/ApplePayPaymentAuthorizationResult.h:
1291         * Modules/applepay/ApplePayPaymentAuthorizationResult.idl:
1292         * Modules/applepay/ApplePayPaymentMethodUpdate.h:
1293         * Modules/applepay/ApplePayPaymentMethodUpdate.idl:
1294         * Modules/applepay/ApplePayShippingContactUpdate.h:
1295         * Modules/applepay/ApplePayShippingContactUpdate.idl:
1296         * Modules/applepay/ApplePayShippingMethodUpdate.h:
1297         * Modules/applepay/ApplePayShippingMethodUpdate.idl:
1298         Add new files.
1299
1300         * Modules/applepay/ApplePaySession.cpp:
1301         (WebCore::toPaymentAuthorizationStatus):
1302         Move this function to the top.
1303
1304         (WebCore::convertAndValidate):
1305         Add new convertAndValidate functions.
1306
1307         (WebCore::ApplePaySession::completeShippingMethodSelection):
1308         (WebCore::ApplePaySession::completeShippingContactSelection):
1309         (WebCore::ApplePaySession::completePaymentMethodSelection):
1310         (WebCore::ApplePaySession::completePayment):
1311         * Modules/applepay/ApplePaySession.h:
1312         * Modules/applepay/ApplePaySession.idl:
1313         Implement the old functions in terms of the new functions.
1314
1315         * Modules/applepay/PaymentCoordinator.cpp:
1316         * WebCore.xcodeproj/project.pbxproj:
1317         Add new files.
1318
1319 2017-03-09  Yoav Weiss  <yoav@yoav.ws>
1320
1321         [link preload] Double downloads of preloaded CSS
1322         https://bugs.webkit.org/show_bug.cgi?id=169274
1323
1324         Reviewed by Antti Koivisto.
1325
1326         Avoid reloading link preloads in case of a charset mismatch.
1327
1328         Charset mismatch can happen for header based preloads, as they are requested before
1329         the HTML's `<meta charset>` tag is processed. This change makes sure that in those
1330         cases, we modify the resource's encoding setting instead of reloading it.
1331
1332         Test: http/tests/preload/single_download_preload_headers.php
1333
1334         * loader/cache/CachedResource.cpp:
1335         (WebCore::CachedResource::CachedResource): Initialize m_unknownCharset to be the same as the preload flag.
1336         * loader/cache/CachedResource.h:
1337         (WebCore::CachedResource::hasUnknownEncoding):
1338         (WebCore::CachedResource::setHasUnknownEncoding):
1339         * loader/cache/CachedResourceLoader.cpp:
1340         (WebCore::CachedResourceLoader::determineRevalidationPolicy): In case of a charset
1341         mismatch, set the encoding of the Resource instead of reloading it if the charset is unknown.
1342
1343 2017-03-09  Jiewen Tan  <jiewen_tan@apple.com>
1344
1345         Implement PBKDF2 in WebCrypto
1346         https://bugs.webkit.org/show_bug.cgi?id=143458
1347         <rdar://problem/27311703>
1348
1349         Reviewed by Brent Fulgham.
1350
1351         This patch implements PBKDF2 according to the spec:
1352         https://www.w3.org/TR/WebCryptoAPI/#pbkdf2. Supported
1353         operations include deriveKey, deriveBits, importKey and
1354         getKeyLength.
1355
1356         Tests: crypto/subtle/ecdh-import-key-derive-pbkdf2-key.html
1357                crypto/subtle/pbkdf2-derive-bits-malformed-parametrs.html
1358                crypto/subtle/pbkdf2-import-key-derive-bits.html
1359                crypto/subtle/pbkdf2-import-key-derive-hmac-key.html
1360                crypto/subtle/pbkdf2-import-key-malformed-parameters.html
1361                crypto/subtle/pbkdf2-import-key.html
1362                crypto/workers/subtle/pbkdf2-import-key-derive-bits.html
1363                crypto/workers/subtle/pbkdf2-import-key-derive-hmac-key.html
1364                crypto/workers/subtle/pbkdf2-import-key.html
1365
1366         * CMakeLists.txt:
1367         * DerivedSources.make:
1368         * PlatformGTK.cmake:
1369         * PlatformMac.cmake:
1370         * WebCore.xcodeproj/project.pbxproj:
1371         * bindings/js/JSCryptoKeyCustom.cpp:
1372         (WebCore::JSCryptoKey::algorithm):
1373         Added RawKeyAlgorithm.
1374         * bindings/js/JSSubtleCryptoCustom.cpp:
1375         (WebCore::normalizeCryptoAlgorithmParameters):
1376         A bit of reordering.
1377         * bindings/js/SerializedScriptValue.cpp:
1378         (WebCore::CloneSerializer::write):
1379         Faked implementation.
1380         * crypto/CryptoAlgorithmParameters.h:
1381         * crypto/CryptoKey.h:
1382         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp: Added.
1383         (WebCore::CryptoAlgorithmPBKDF2::create):
1384         (WebCore::CryptoAlgorithmPBKDF2::identifier):
1385         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
1386         (WebCore::CryptoAlgorithmPBKDF2::importKey):
1387         (WebCore::CryptoAlgorithmPBKDF2::getKeyLength):
1388         * crypto/algorithms/CryptoAlgorithmPBKDF2.h: Added.
1389         * crypto/gnutls/CryptoAlgorithmPBKDF2GnuTLS.cpp: Added.
1390         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
1391         * crypto/keys/CryptoKeyRaw.cpp: Added.
1392         (WebCore::CryptoKeyRaw::CryptoKeyRaw):
1393         (WebCore::CryptoKeyRaw::buildAlgorithm):
1394         (WebCore::CryptoKeyRaw::exportData):
1395         * crypto/keys/CryptoKeyRaw.h: Added.
1396         (WebCore::RawKeyAlgorithm::RawKeyAlgorithm):
1397         The CryptoKey class for PBKDF2 and later on HKDF.
1398         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp: Added.
1399         (WebCore::commonCryptoHMACAlgorithm):
1400         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
1401         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
1402         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
1403         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h: Added.
1404         * crypto/parameters/Pbkdf2Params.idl: Added.
1405
1406 2017-03-09  Antoine Quint  <graouts@apple.com>
1407
1408         [Modern Media Controls] iOS: long press on play button shows the Copy menu
1409         https://bugs.webkit.org/show_bug.cgi?id=169355
1410         <rdar://problem/30928998>
1411
1412         Reviewed by Dean Jackson.
1413
1414         Disable built-in UI behavior that shows a magnifier or a copy callout when pressing
1415         on an element for a long time. These do not make sense for media controls.
1416
1417         Test: media/modern-media-controls/audio/audio-controls-styles.html
1418
1419         * Modules/modern-media-controls/controls/media-controls.css:
1420         (:host):
1421
1422 2017-03-09  Alex Christensen  <achristensen@webkit.org>
1423
1424         [Content Extensions] Introduce if-top-url and unless-top-url
1425         https://bugs.webkit.org/show_bug.cgi?id=169433
1426
1427         Reviewed by Brady Eidson.
1428
1429         In r184116 I added if-domain and unless-domain to control whether a rule applies
1430         based on the domain of the main document URL.  I'm expanding this by adding if-top-url
1431         and unless-top-url that run regular expressions on the entire main document URL so that
1432         example.com/user1content can be distinguished from example.com/user2content.
1433         To not add to the number of passes we make on the URLs for each load and to maintain JSON
1434         backwards compatibility, I've made it so that if-top-url and unless-top-url can be used
1435         instead of if-domain and unless-domain (which continue to work) but the two condition types
1436         cannot be used together since running regular expressions on the entire main document URL
1437         is strictly more powerful than checking the domain and subdomains.
1438         As a minor detail, content extension regexes are by default ASCII-case-insensitive, so I've
1439         done the same with top URL regexes, adding top-url-filter-is-case-sensitive to mirror the existing
1440         url-filter-is-case-sensitive if the JSON author decides to make regexes case sensitive.
1441
1442         Covered by new API tests.
1443
1444         * contentextensions/CompiledContentExtension.h:
1445         * contentextensions/ContentExtension.cpp:
1446         (WebCore::ContentExtensions::ContentExtension::populateConditionCacheIfNeeded):
1447         (WebCore::ContentExtensions::ContentExtension::topURLActions):
1448         (WebCore::ContentExtensions::ContentExtension::cachedConditionedActions): Deleted.
1449         * contentextensions/ContentExtension.h:
1450         * contentextensions/ContentExtensionCompiler.cpp:
1451         (WebCore::ContentExtensions::addUniversalActionsToDFA):
1452         (WebCore::ContentExtensions::compileToBytecode):
1453         We had three copies of compiling to bytecode that were almost the same and would've been made into three copies of the same code.
1454         I moved them to one helper function that is called three times.
1455         (WebCore::ContentExtensions::compileRuleList):
1456         * contentextensions/ContentExtensionCompiler.h:
1457         * contentextensions/ContentExtensionError.cpp:
1458         (WebCore::ContentExtensions::contentExtensionErrorCategory):
1459         Add the new error type for JSON that tries to use if-top-url and unless-top-url with if-domain and unless-domain.
1460         * contentextensions/ContentExtensionError.h:
1461         * contentextensions/ContentExtensionParser.cpp:
1462         (WebCore::ContentExtensions::loadTrigger):
1463         Parse the new values if-top-url, unless-top-url, and top-url-filter-is-case-sensitive.
1464         * contentextensions/ContentExtensionRule.h:
1465         (WebCore::ContentExtensions::Trigger::~Trigger):
1466         * contentextensions/ContentExtensionsBackend.cpp:
1467         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
1468         * contentextensions/DFABytecodeInterpreter.cpp:
1469         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretAppendAction):
1470         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretTestFlagsAndAppendAction):
1471         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretWithConditions):
1472         * contentextensions/DFABytecodeInterpreter.h:
1473
1474 2017-03-09  Nikita Vasilyev  <nvasilyev@apple.com>
1475
1476         Web Inspector: Show individual messages in the content pane for a WebSocket
1477         https://bugs.webkit.org/show_bug.cgi?id=169011
1478
1479         Reviewed by Joseph Pecoraro.
1480
1481         Add walltime parameter.
1482
1483         No new tests. Tests will be added in a follow up patch.
1484
1485         * inspector/InspectorNetworkAgent.cpp:
1486         (WebCore::InspectorNetworkAgent::willSendWebSocketHandshakeRequest):
1487
1488 2017-03-09  Brent Fulgham  <bfulgham@apple.com>
1489
1490         Unreviewed build fix after r213628.
1491
1492         Use 'size_t' for the function definition to match the header file. If you do not,
1493         the 32-bit build fails..
1494
1495         * crypto/gnutls/CryptoAlgorithmECDHGnuTLS.cpp:
1496         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
1497
1498 2017-03-09  Wenson Hsieh  <wenson_hsieh@apple.com>
1499
1500         [WK2] Add a UI delegate hook for custom handling of data interaction operations
1501         https://bugs.webkit.org/show_bug.cgi?id=169430
1502         <rdar://problem/30954654>
1503
1504         Reviewed by Tim Horton.
1505
1506         Ensure that m_documentUnderMouse is properly cleaned up even in the case where no drag operation was performed
1507         due to the drop bailing at the client layer.
1508
1509         * page/DragController.cpp:
1510         (WebCore::DragController::dragEnded):
1511
1512 2017-03-08  Matt Rajca  <mrajca@apple.com>
1513
1514         Let clients control autoplay quirks with website policies.
1515         https://bugs.webkit.org/show_bug.cgi?id=169390
1516
1517         Reviewed by Wenson Hsieh.
1518
1519         Added API tests.
1520
1521         Many sites incorrectly assume media will start off playing and display a pause button from the
1522         start. We can trick many of these sites into updating their controls by sending a "pause"
1523         event when we prevent a media element from playing.
1524
1525         We don't want this to become standard web behavior, however, since ultimately sites should adapt
1526         to the new behavior. This patch lets clients decide which limited set of sites gets to use auto-play
1527         quirks.
1528
1529         * html/HTMLMediaElement.cpp:
1530         (WebCore::needsAutoplayPlayPauseEventsQuirk):
1531         * loader/DocumentLoader.h:
1532         (WebCore::DocumentLoader::allowsAutoplayQuirks):
1533         (WebCore::DocumentLoader::setAllowsAutoplayQuirks):
1534
1535 2017-03-09  Mark Lam  <mark.lam@apple.com>
1536
1537         Make the VM Traps mechanism non-polling for the DFG and FTL.
1538         https://bugs.webkit.org/show_bug.cgi?id=168920
1539         <rdar://problem/30738588>
1540
1541         Reviewed by Filip Pizlo.
1542
1543         No new tests needed.  This is covered by existing tests.
1544
1545         * bindings/js/WorkerScriptController.cpp:
1546         (WebCore::WorkerScriptController::WorkerScriptController):
1547         (WebCore::WorkerScriptController::scheduleExecutionTermination):
1548
1549 2017-03-08  Dean Jackson  <dino@apple.com>
1550
1551         WebGPU: Backend - Library and Functions
1552         https://bugs.webkit.org/show_bug.cgi?id=169371
1553         <rdar://problem/30928792>
1554
1555         Reviewed by Tim Horton.
1556
1557         Implement the backends for GPULibrary and GPUFunction.
1558         A GPULibrary is created from a GPUDevice, given some
1559         shader source code. You can then extract the GPUFunctions
1560         from the library.
1561
1562         WebKitAPITests: GPULibrary and GPUFunction.
1563
1564         * WebCore.xcodeproj/project.pbxproj:
1565         * platform/graphics/cocoa/GPUFunctionMetal.mm:
1566         (WebCore::GPUFunction::GPUFunction):
1567         (WebCore::GPUFunction::name):
1568         (WebCore::GPUFunction::platformFunction):
1569         * platform/graphics/cocoa/GPULibraryMetal.mm:
1570         (WebCore::GPULibrary::GPULibrary):
1571         (WebCore::GPULibrary::label):
1572         (WebCore::GPULibrary::setLabel):
1573         (WebCore::GPULibrary::functionNames):
1574         (WebCore::GPULibrary::platformLibrary):
1575         * platform/graphics/gpu/GPUDevice.cpp:
1576         (WebCore::GPUDevice::createLibrary):
1577         * platform/graphics/gpu/GPUDevice.h:
1578         * platform/graphics/gpu/GPUFunction.cpp:
1579         (WebCore::GPUFunction::create):
1580         (WebCore::GPUFunction::~GPUFunction):
1581         (WebCore::GPUFunction::GPUFunction):
1582         (WebCore::GPUFunction::name):
1583         * platform/graphics/gpu/GPUFunction.h:
1584         * platform/graphics/gpu/GPULibrary.cpp:
1585         (WebCore::GPULibrary::create):
1586         (WebCore::GPULibrary::~GPULibrary):
1587         (WebCore::GPULibrary::label):
1588         (WebCore::GPULibrary::setLabel):
1589         (WebCore::GPULibrary::functionNames):
1590         (WebCore::GPULibrary::functionWithName):
1591         * platform/graphics/gpu/GPULibrary.h:
1592
1593 2017-03-09  Chris Dumez  <cdumez@apple.com>
1594
1595         Align Document.elementFromPoint() with the CSSOM specification
1596         https://bugs.webkit.org/show_bug.cgi?id=169403
1597
1598         Reviewed by Sam Weinig.
1599
1600         Align Document.elementFromPoint() with the CSSOM specification:
1601         - https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface
1602
1603         In particular, the parameters should be mandatory and of type double.
1604
1605         The parameters are mandatory in both Firefox and Chrome already. Parameters
1606         are finite floating point in Firefox and integers in Chrome.
1607
1608         Test: fast/dom/elementFromPoint-parameters.html
1609
1610         * dom/DocumentOrShadowRoot.idl:
1611         * dom/TreeScope.cpp:
1612         (WebCore::TreeScope::elementFromPoint):
1613         * dom/TreeScope.h:
1614
1615 2017-03-09  Antoine Quint  <graouts@apple.com>
1616
1617         [Modern Media Controls] Fullscreen controls are difficult to drag around
1618         https://bugs.webkit.org/show_bug.cgi?id=169412
1619         <rdar://problem/30931892>
1620
1621         Reviewed by Eric Carlson.
1622
1623         Up until now, we would simply check that the event target when attempting to
1624         initiate a drag would be the controls bar and not any of its children. This
1625         was not so great as this would encompass also a large margin around the left,
1626         center and right button containers as well as the time labels. We now check
1627         that the event target is anything but an interactive element (<button> or <input>).
1628
1629         The existing test at media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html
1630         has been updated to initiate dragging right between the rewind and play/pause button,
1631         which would fail prior to this patch since this would have hit-tested within the center
1632         button container and thus prevent dragging.
1633
1634         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
1635         (.media-controls.mac.fullscreen button.volume-down):
1636         (.media-controls.mac.fullscreen button.volume-up):
1637         (.media-controls.mac.fullscreen button.rewind):
1638         (.media-controls.mac.fullscreen button.play-pause):
1639         (.media-controls.mac.fullscreen button.forward):
1640         (.media-controls.mac.fullscreen .buttons-container.right button):
1641         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
1642         (MacOSFullscreenMediaControls.prototype._handleMousedown):
1643         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
1644         (.media-controls.mac.inline > .controls-bar button):
1645         * Modules/modern-media-controls/controls/macos-media-controls.css:
1646         (.media-controls.mac > .controls-bar button):
1647
1648 2017-03-09  Antoine Quint  <graouts@apple.com>
1649
1650         [Modern Media Controls] Controls are not visible in fullscreen without the controls attribute
1651         https://bugs.webkit.org/show_bug.cgi?id=169411
1652         <rdar://problem/30931724>
1653
1654         Reviewed by Eric Carlson.
1655
1656         Ensure we show controls in fullscreen in the absence of the controls attribute.
1657
1658         Tests: media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element.html
1659                media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video.html
1660
1661         * Modules/modern-media-controls/media/controls-visibility-support.js:
1662         (ControlsVisibilitySupport.prototype.get mediaEvents):
1663         (ControlsVisibilitySupport.prototype._updateControls):
1664         (ControlsVisibilitySupport):
1665
1666 2017-03-09  Zalan Bujtas  <zalan@apple.com>
1667
1668         Simple line layout: Add top level pagination support.
1669         https://bugs.webkit.org/show_bug.cgi?id=169410
1670         <rdar://problem/28536227>
1671
1672         Reviewed by Antti Koivisto.
1673
1674         This patch enables top level pagination for simple line layout.
1675
1676         Covered by existing tests.
1677
1678         * rendering/RenderMultiColumnFlowThread.h:
1679         * rendering/RenderView.cpp:
1680         (WebCore::RenderView::pushLayoutStateForPagination): Pagination flag needs to be set before calling pushLayoutStateForCurrentFlowThread.
1681         * rendering/SimpleLineLayout.cpp:
1682         (WebCore::SimpleLineLayout::canUseForWithReason):
1683         * rendering/SimpleLineLayoutCoverage.cpp:
1684         (WebCore::SimpleLineLayout::printReason):
1685         * rendering/SimpleLineLayoutCoverage.h:
1686         * rendering/SimpleLineLayoutFunctions.cpp:
1687         (WebCore::SimpleLineLayout::paintFlow):
1688         * rendering/SimpleLineLayoutPagination.cpp:
1689         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow): Matching normal line layout values.
1690         (WebCore::SimpleLineLayout::setPageBreakForLine): Logic here matches RenderBlockFlow::adjustLinePositionForPagination
1691
1692 2017-03-09  Tomas Popela  <tpopela@redhat.com>
1693
1694         [GStreamer][MSE] Fix 'comparison between signed and unsigned integer
1695         expressions' warning
1696
1697         Reviewed by Žan Doberšek.
1698
1699         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
1700         (WebCore::PlaybackPipeline::flush):
1701
1702 2017-03-08  Per Arne Vollan  <pvollan@apple.com>
1703
1704         Implement stroke-width CSS property.
1705         https://bugs.webkit.org/show_bug.cgi?id=169273
1706
1707         Reviewed by Simon Fraser.
1708
1709         Support setting text stroke width using the CSS property stroke-width, see https://drafts.fxtf.org/paint/.
1710         Text stroke width can currently be set with the -webkit-text-stroke-width property. To make sure this still
1711         works, I added a check to determine if the stroke-width property has been explicitly set. If it has not been
1712         set, we fall back to the value of the -webkit-text-stroke-width property.
1713
1714         Tests: fast/css/stroke-width-percent.html
1715                fast/css/stroke-width.html
1716
1717         * css/CSSProperties.json:
1718         * css/StyleBuilderCustom.h:
1719         (WebCore::StyleBuilderCustom::applyValueStrokeWidth):
1720         (WebCore::StyleBuilderCustom::applyValueWebkitTextStrokeWidth):
1721         * rendering/InlineFlowBox.cpp:
1722         (WebCore::InlineFlowBox::addToLine):
1723         (WebCore::InlineFlowBox::addTextBoxVisualOverflow):
1724         * rendering/SimpleLineLayoutFunctions.cpp:
1725         (WebCore::SimpleLineLayout::computeOverflow):
1726         * rendering/TextDecorationPainter.cpp:
1727         (WebCore::decorationColor):
1728         * rendering/TextPaintStyle.cpp:
1729         (WebCore::computeTextPaintStyle):
1730         (WebCore::computeTextSelectionPaintStyle):
1731         * rendering/style/RenderStyle.cpp:
1732         (WebCore::RenderStyle::RenderStyle):
1733         (WebCore::RenderStyle::computedTextStrokeWidth):
1734         * rendering/style/RenderStyle.h:
1735         (WebCore::RenderStyle::setHasExplicitlySetStrokeWidth):
1736         (WebCore::RenderStyle::hasExplicitlySetStrokeWidth):
1737         (WebCore::RenderStyle::setHasExplicitlySetWebKitTextStrokeWidth):
1738         (WebCore::RenderStyle::hasExplicitlySetWebKitTextStrokeWidth):
1739         (WebCore::RenderStyle::InheritedFlags::operator==):
1740
1741 2017-03-09  Antti Koivisto  <antti@apple.com>
1742
1743         Allow the page to render before <link> stylesheet tags in body
1744         https://bugs.webkit.org/show_bug.cgi?id=149157
1745         <rdar://problem/24658830>
1746
1747         Reviewed by Simon Fraser.
1748
1749         Currently we block style and renderer building completely if document has any loading
1750         stylesheets. In case a script queries something layout dependent we construct the render
1751         tree with whatever style we have but block painting in it.
1752
1753         This patch changes behavior so that a loading stylesheet in body only blocks rendering for elements
1754         that are after it. The expectation is that such stylesheets rarely affect elements before them
1755         and the elements can be rendered without causing ugly visible styling changes.
1756
1757         The patch replaces the old flash-of-unstyled-content (FOUC) preventation mechanism with a more
1758         fine-grained one. Paint blocking is now done on per-renderer basis with based on isNonFinal flag in
1759         RenderStyle.
1760
1761         For stylesheets in head the behavior should be largely unchanged.
1762
1763         Test: http/tests/incremental/stylesheet-body-incremental-rendering.html
1764
1765         * css/StyleResolver.cpp:
1766         (WebCore::StyleResolver::pseudoStyleRulesForElement):
1767         * dom/Document.cpp:
1768         (WebCore::Document::Document):
1769         (WebCore::Document::resolveStyle):
1770         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
1771
1772             Remove the old FOUC preventation state tracking.
1773
1774         (WebCore::Document::shouldScheduleLayout):
1775         (WebCore::Document::didRemoveAllPendingStylesheet):
1776
1777             Repaints will now get triggered by the normal style mechanism.
1778
1779         * dom/Document.h:
1780         (WebCore::Document::hasNodesWithNonFinalStyle):
1781         (WebCore::Document::setHasNodesWithNonFinalStyle):
1782
1783             Track if we need to recompute the style later because non-final or unstyled elements.
1784
1785         (WebCore::Document::didLayoutWithPendingStylesheets): Deleted.
1786         (WebCore::Document::hasNodesWithPlaceholderStyle): Deleted.
1787         (WebCore::Document::setHasNodesWithPlaceholderStyle): Deleted.
1788         * html/HTMLFrameSetElement.cpp:
1789         (WebCore::HTMLFrameSetElement::rendererIsNeeded):
1790         * page/FrameView.cpp:
1791         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty):
1792
1793             Don't qualify as visually non-empty if we have loading stylesheets in head (even if there is
1794             a fouc-prevented render tree).
1795
1796         (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
1797         * rendering/RenderBlock.cpp:
1798         (WebCore::RenderBlock::paintContents):
1799
1800             Instead of a global test, block painting if isNonFinal is set in the renderer's style.
1801
1802         * rendering/RenderLayer.cpp:
1803         (WebCore::shouldSuppressPaintingLayer):
1804         * rendering/style/RenderStyle.cpp:
1805         (WebCore::RenderStyle::changeRequiresRepaint):
1806
1807             The isNonFinal flag prevents painting so we need to trigger repaint when it gets cleared.
1808
1809         * rendering/style/RenderStyle.h:
1810         (WebCore::RenderStyle::isNotFinal):
1811         (WebCore::RenderStyle::setIsNotFinal):
1812         (WebCore::RenderStyle::isPlaceholderStyle): Deleted.
1813         (WebCore::RenderStyle::setIsPlaceholderStyle): Deleted.
1814
1815             There is no need for placeholder styles anymore. Reuse the bit for isNotFinal.
1816
1817         * rendering/style/StyleRareNonInheritedData.cpp:
1818         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
1819         (WebCore::StyleRareNonInheritedData::operator==):
1820         * rendering/style/StyleRareNonInheritedData.h:
1821         * style/StyleScope.cpp:
1822         (WebCore::Style::Scope::analyzeStyleSheetChange):
1823         (WebCore::Style::Scope::updateActiveStyleSheets):
1824         * style/StyleTreeResolver.cpp:
1825         (WebCore::Style::TreeResolver::styleForElement):
1826         (WebCore::Style::TreeResolver::resolveElement):
1827
1828             If we have seens a loading stylesheet and don't have a renderer yet don't style the element.
1829             In case there is a renderer or we are ignoring pending sheets, resolve the style normally
1830             but mark it as non-final.
1831
1832         (WebCore::Style::makePlaceholderStyle): Deleted.
1833
1834 2017-03-08  Antoine Quint  <graouts@apple.com>
1835
1836         [Modern Media Controls] iOS: Live Broadcast video shows scrubber with 00:00 duration until paused
1837         https://bugs.webkit.org/show_bug.cgi?id=169374
1838         <rdar://problem/30063273>
1839
1840         Reviewed by Dean Jackson.
1841
1842         We need to make sure we update the controls layout when they come back from being hidden, so promote
1843         that functionality from MacOSInlineMediaControls to MediaControls so that iOS can pick that behavior
1844         up.
1845
1846         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-status-label-enabled-hidden-controls-bar.html
1847
1848         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
1849         (MacOSInlineMediaControls.prototype.controlsBarVisibilityDidChange): Deleted.
1850         * Modules/modern-media-controls/controls/media-controls.js:
1851         (MediaControls.prototype.controlsBarVisibilityDidChange):
1852
1853 2017-03-08  Jiewen Tan  <jiewen_tan@apple.com>
1854
1855         [WebCrypto] Implement SubtleCrypto::DeriveKey method
1856         https://bugs.webkit.org/show_bug.cgi?id=169386
1857         <rdar://problem/23789585>
1858
1859         Reviewed by Brent Fulgham.
1860
1861         This patch does following few things:
1862         1. It implements SubtleCrypto::DeriveKey method according to the spec:
1863         https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-deriveKey.
1864         2. It implements getKeyLength operations for AES-CBC, AES-KW, AES-CFB,
1865         AES-GCM, and HMAC, which is needed by the SubtleCrypto::DeriveKey method.
1866         3. It enables ECDH DeriveKey operation.
1867         4. It replaces unigned long with size_t in all the crypto codes.
1868
1869         Tests: crypto/subtle/derive-key-malformed-parameters.html
1870                crypto/subtle/ecdh-import-key-derive-aes-key.html
1871                crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length.html
1872                crypto/subtle/unwrap-key-malformed-parameters.html
1873                crypto/subtle/wrap-key-malformed-parameters.html
1874                crypto/workers/subtle/ecdh-import-key-derive-key.html
1875
1876         * CMakeLists.txt:
1877         * DerivedSources.make:
1878         * WebCore.xcodeproj/project.pbxproj:
1879         * bindings/js/JSSubtleCryptoCustom.cpp:
1880         (WebCore::normalizeCryptoAlgorithmParameters):
1881         (WebCore::jsSubtleCryptoFunctionEncryptPromise):
1882         (WebCore::jsSubtleCryptoFunctionDecryptPromise):
1883         (WebCore::jsSubtleCryptoFunctionSignPromise):
1884         (WebCore::jsSubtleCryptoFunctionVerifyPromise):
1885         (WebCore::jsSubtleCryptoFunctionDigestPromise):
1886         (WebCore::jsSubtleCryptoFunctionDeriveKeyPromise):
1887         (WebCore::jsSubtleCryptoFunctionDeriveBitsPromise):
1888         Remove unnecessary return statement from callbacks.
1889         * crypto/CryptoAlgorithm.cpp:
1890         (WebCore::CryptoAlgorithm::deriveBits):
1891         (WebCore::CryptoAlgorithm::getKeyLength):
1892         * crypto/CryptoAlgorithm.h:
1893         * crypto/CryptoAlgorithmParameters.h:
1894         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
1895         (WebCore::CryptoAlgorithmAES_CBC::generateKey):
1896         (WebCore::CryptoAlgorithmAES_CBC::getKeyLength):
1897         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
1898         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
1899         (WebCore::CryptoAlgorithmAES_CFB::generateKey):
1900         (WebCore::CryptoAlgorithmAES_CFB::getKeyLength):
1901         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
1902         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
1903         (WebCore::CryptoAlgorithmAES_GCM::generateKey):
1904         (WebCore::CryptoAlgorithmAES_GCM::getKeyLength):
1905         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
1906         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1907         (WebCore::CryptoAlgorithmAES_KW::generateKey):
1908         (WebCore::CryptoAlgorithmAES_KW::getKeyLength):
1909         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
1910         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
1911         (WebCore::CryptoAlgorithmECDH::deriveBits):
1912         * crypto/algorithms/CryptoAlgorithmECDH.h:
1913         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1914         (WebCore::CryptoAlgorithmHMAC::getKeyLength):
1915         * crypto/algorithms/CryptoAlgorithmHMAC.h:
1916         * crypto/keys/CryptoKeyAES.cpp:
1917         (WebCore::CryptoKeyAES::getKeyLength):
1918         * crypto/keys/CryptoKeyAES.h:
1919         * crypto/keys/CryptoKeyHMAC.cpp:
1920         (WebCore::getKeyLengthFromHash):
1921         (WebCore::CryptoKeyHMAC::generate):
1922         (WebCore::CryptoKeyHMAC::getKeyLength):
1923         * crypto/keys/CryptoKeyHMAC.h:
1924         * crypto/mac/CryptoAlgorithmECDHMac.cpp:
1925         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
1926         * crypto/parameters/AesKeyParams.idl: Renamed from Source/WebCore/crypto/parameters/AesKeyGenParams.idl.
1927         * crypto/parameters/CryptoAlgorithmAesKeyParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyGenParams.h.
1928         Rename AesKeyGenParams to AesKeyParams to represent a unified dictionary for AesKeyGenParams and AesDerivedKeyParams.
1929         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
1930         * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h:
1931
1932 2017-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1933
1934         Add plumbing for WebCore to notify WebKit2 when an edit drag has concluded
1935         https://bugs.webkit.org/show_bug.cgi?id=169392
1936         <rdar://problem/30882974>
1937
1938         Reviewed by Tim Horton.
1939
1940         Add DragClient::didConcludeEditDrag and invoke it after performing an edit drag in
1941         DragController::performDragOperation.
1942
1943         * page/DragClient.h:
1944         (WebCore::DragClient::didConcludeEditDrag):
1945         * page/DragController.cpp:
1946         (WebCore::DragController::performDragOperation):
1947
1948 2017-03-08  Matt Baker  <mattbaker@apple.com>
1949
1950         Web Inspector: Add DOM breakpoints UI for node/subtree modification events
1951         https://bugs.webkit.org/show_bug.cgi?id=168101
1952
1953         Reviewed by Joseph Pecoraro.
1954
1955         Test: inspector/dom-debugger/dom-breakpoints.html
1956
1957         * inspector/InspectorDOMAgent.h:
1958         Removed declarations for undefined member functions.
1959
1960         * inspector/InspectorDOMDebuggerAgent.cpp:
1961         (WebCore::InspectorDOMDebuggerAgent::disable):
1962         (WebCore::InspectorDOMDebuggerAgent::mainFrameDOMContentLoaded):
1963         (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode):
1964         (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode):
1965         (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr):
1966         Check that DebuggerAgent breakpoints are active before breaking.
1967         (WebCore::InspectorDOMDebuggerAgent::clear): Deleted.
1968         Replaced by call to discardBindings.
1969         * inspector/InspectorDOMDebuggerAgent.h:
1970
1971         * inspector/InspectorInstrumentation.cpp:
1972         (WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl):
1973         DOMDebugger agent needs to discard bindings when the main frame navigates.
1974
1975 2017-03-08  Jiewen Tan  <jiewen_tan@apple.com>
1976
1977         [WebCrypto] Implement ECDH DeriveBits operation
1978         https://bugs.webkit.org/show_bug.cgi?id=169319
1979         <rdar://problem/23789585>
1980
1981         Reviewed by Brent Fulgham.
1982
1983         This patch implements DeriveBits operation of ECDH according to the spec:
1984         https://www.w3.org/TR/WebCryptoAPI/#ecdh-operations.
1985
1986         Tests: crypto/subtle/derive-bits-malformed-parameters.html
1987                crypto/subtle/ecdh-derive-bits-malformed-parametrs.html
1988                crypto/subtle/ecdh-generate-key-derive-bits.html
1989                crypto/subtle/ecdh-import-key-derive-bits-custom-length.html
1990                crypto/subtle/ecdh-import-key-derive-bits-null-length.html
1991                crypto/workers/subtle/ecdh-import-key-derive-bits.html
1992
1993         * CMakeLists.txt:
1994         * DerivedSources.make:
1995         * PlatformGTK.cmake:
1996         * PlatformMac.cmake:
1997         * WebCore.xcodeproj/project.pbxproj:
1998         * bindings/js/JSSubtleCryptoCustom.cpp:
1999         (WebCore::normalizeCryptoAlgorithmParameters):
2000         (WebCore::jsSubtleCryptoFunctionDeriveKeyPromise):
2001         (WebCore::jsSubtleCryptoFunctionDeriveBitsPromise):
2002         (WebCore::JSSubtleCrypto::generateKey):
2003         Reorder a bit of the functions.
2004         * crypto/CommonCryptoUtilities.h:
2005         * crypto/CryptoAlgorithm.cpp:
2006         (WebCore::CryptoAlgorithm::deriveBits):
2007         * crypto/CryptoAlgorithm.h:
2008         * crypto/CryptoAlgorithmParameters.h:
2009         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
2010         (WebCore::CryptoAlgorithmECDH::deriveBits):
2011         * crypto/algorithms/CryptoAlgorithmECDH.h:
2012         * crypto/gnutls/CryptoAlgorithmECDHGnuTLS.cpp: Added.
2013         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
2014         * crypto/keys/CryptoKeyEC.h:
2015         * crypto/mac/CryptoAlgorithmECDHMac.cpp: Added.
2016         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
2017         * crypto/parameters/CryptoAlgorithmEcdhKeyDeriveParams.h: Added.
2018         * crypto/parameters/EcdhKeyDeriveParams.idl: Added.
2019
2020 2017-03-08  John Wilander  <wilander@apple.com>
2021
2022         Resource Load Statistics: Communicate to the network process which domains to partition
2023         https://bugs.webkit.org/show_bug.cgi?id=169322
2024         <rdar://problem/30768921>
2025
2026         Reviewed by Alex Christensen.
2027
2028         Test: http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html
2029
2030         * loader/ResourceLoadObserver.cpp:
2031         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2032             Now calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
2033             to tell the network process the domain has got user interaction.
2034         (WebCore::ResourceLoadObserver::logUserInteraction):
2035             Now calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
2036             to tell the network process the domain has got user interaction.
2037         (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
2038             To allow TestRunner to set a domain for which
2039             partitioning should be applied.
2040         (WebCore::ResourceLoadObserver::primaryDomain):
2041             New overloaded convenience function.
2042         * loader/ResourceLoadObserver.h:
2043         * loader/ResourceLoadStatisticsStore.cpp:
2044         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
2045             Now bootstraps the network process' set of known domains to
2046             partition cookies for.
2047         (WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback):
2048         (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
2049         (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
2050             Now tells the network process to start partitioning again
2051             when user interaction ages out.
2052         * loader/ResourceLoadStatisticsStore.h:
2053         * platform/network/NetworkStorageSession.h:
2054         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2055         (WebCore::NetworkStorageSession::shouldPartitionCookiesForHost):
2056         (WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts):
2057
2058 2017-03-08  Joseph Pecoraro  <pecoraro@apple.com>
2059
2060         Web Inspector: Should be able to see where Resources came from (Memory Cache, Disk Cache)
2061         https://bugs.webkit.org/show_bug.cgi?id=164892
2062         <rdar://problem/29320562>
2063
2064         Reviewed by Brian Burg.
2065
2066         Test: http/tests/inspector/network/resource-response-source-disk-cache.html
2067               http/tests/inspector/network/resource-response-source-memory-cache.html
2068               http/tests/inspector/network/resource-response-source-network.html
2069
2070         * platform/network/ResourceResponseBase.cpp:
2071         (WebCore::ResourceResponseBase::setSource): Deleted.
2072         * platform/network/ResourceResponseBase.h:
2073         (WebCore::ResourceResponseBase::setSource):
2074         Make Source mutable to allow it to be set in const methods.
2075
2076         * loader/SubresourceLoader.cpp:
2077         (WebCore::SubresourceLoader::didReceiveResponse):
2078         Set the Response source after a successful memory cache validation
2079         as early as possible so that future copies have up to date info.
2080
2081         * inspector/InspectorNetworkAgent.cpp:
2082         (WebCore::responseSource):
2083         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
2084         (WebCore::InspectorNetworkAgent::didLoadResourceFromMemoryCache):
2085         (WebCore::InspectorNetworkAgent::markResourceAsCached): Deleted.
2086         Eliminate this "markResourceAsCached" path.
2087         Update Response to include required source parameter instead of
2088         optional fromDiskCache parameter.
2089
2090         * inspector/InspectorInstrumentation.cpp:
2091         (WebCore::InspectorInstrumentation::markResourceAsCachedImpl): Deleted.
2092         * inspector/InspectorInstrumentation.h:
2093         (WebCore::InspectorInstrumentation::markResourceAsCached): Deleted.
2094         * inspector/InspectorNetworkAgent.h:
2095         * loader/FrameLoader.cpp:
2096         (WebCore::FrameLoader::loadedResourceFromMemoryCache):
2097         Eliminate this "markResourceAsCached" call because the later delegate
2098         messages will include this information.
2099
2100 2017-03-08  Chris Dumez  <cdumez@apple.com>
2101
2102         Drop support for non-standard document.all.tags()
2103         https://bugs.webkit.org/show_bug.cgi?id=169337
2104
2105         Reviewed by Sam Weinig.
2106
2107         Drop support for non-standard document.all.tags(). It is not part of the specification:
2108         - https://html.spec.whatwg.org/multipage/infrastructure.html#the-htmlallcollection-interface
2109
2110         It is not supported by Firefox and its support was dropped from Chrome back in early 2014:
2111         - https://src.chromium.org/viewvc/blink?view=revision&revision=166870
2112
2113         No new tests, updated existing test.
2114
2115         * html/HTMLAllCollection.cpp:
2116         * html/HTMLAllCollection.h:
2117         * html/HTMLAllCollection.idl:
2118
2119 2017-03-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
2120
2121         Enable async image decoding for large images
2122         https://bugs.webkit.org/show_bug.cgi?id=165039
2123
2124         Reviewed by Simon Fraser.
2125
2126         Once FrameView finishes flushing compositing, it will request all its
2127         images, which intersect with the tileCoverageRect (aka the futureRect)
2128         of the  TileController, to start asynchronously decoding their image frames.
2129         This should improve the image first time paint and the scrolling scenarios.
2130         It also makes the scrolling more responsive by removing the decoding step
2131         from the main thread. 
2132         
2133         For now we are going to disable the asynchronous image decoding for the
2134         webkit test runner because drawing the image does not block the page rendering
2135         anymore. An image can be repainted later when its frame is ready for painting.
2136         This can cause a test to fail because the webkit test runner may capture
2137         an image for the page before painting all the images. The asynchronous image
2138         decoding can to be explicitly enabled from the test page. Once the specs
2139         of the image 'async' attribute and 'ready' event is approved, this should
2140         be revisited. It is important to test what we ship and eventually async
2141         image decoding should be enabled in the webkit test runner.
2142
2143         * html/HTMLImageElement.cpp:
2144         (WebCore::HTMLImageElement::didAttachRenderers):
2145         (WebCore::HTMLImageElement::willDetachRenderers):
2146         Register/unregister the renderer of the HTMLImageElement for async image decoding
2147         from the RenderView. I followed what HTMLMediaElement to registerForVisibleInViewportCallback().
2148         * html/HTMLImageElement.h:
2149         
2150         * page/FrameView.cpp:
2151         (WebCore::FrameView::flushCompositingStateForThisFrame): For all the images inside
2152         the  tileCoverageRect of the TileController, request async image decoding.
2153         (WebCore::FrameView::applyRecursivelyWithAbsoluteRect): Request the async image decoding for the
2154         the images inside this FrameView and then recursively do the same thing for all sub FrameViews.
2155         (WebCore::FrameView::requestAsyncDecodingForImagesInAbsoluteRect): Calls the RenderView to
2156         make the request.
2157         (WebCore::FrameView::requestAsyncDecodingForImagesInAbsoluteRectIncludingSubframes): Calls
2158         applyRecursivelyWithAbsoluteRect giving an apply lambda which calls requestAsyncDecodingForImagesInAbsoluteRect.
2159         * page/FrameView.h:
2160
2161         * platform/graphics/BitmapImage.cpp:
2162         (WebCore::BitmapImage::destroyDecodedData): ImageSource::hasDecodingQueue() is renamed to ImageSource::hasAsyncDecodingQueue().
2163         (WebCore::BitmapImage::dataChanged): Use String::utf8().data() instead of String::characters8().
2164         (WebCore::BitmapImage::draw): If drawing the current frame is called while it is being
2165         decoded, draw the the image if the current frame was decoded but for a different size 
2166         and and will not invoke decoding while painting. If the frame is being decoded and there
2167         isn't a decoded frame, return without drawing but set a flag that that this image needs
2168         a repaint.
2169         (WebCore::BitmapImage::internalStartAnimation): Use String::utf8().data() instead of String::characters8().
2170         (WebCore::BitmapImage::advanceAnimation): Ditto.
2171         (WebCore::BitmapImage::internalAdvanceAnimation): Ditto.
2172         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Now this callback can be
2173         called form the ImageFrameCache when finishing a frame of an animated image or the
2174         frame of a large image. For large images, we need to call CachedImage::changedInRect()
2175         if this image needs a repaint. If the decoding queue is idle, we should close it.
2176         (WebCore::BitmapImage::requestAsyncDecoding): This is called form 
2177         RenderView::requestAsyncDecodingForImagesInRect().
2178         * platform/graphics/BitmapImage.h:
2179
2180         * platform/graphics/Image.h:
2181         (WebCore::Image::requestAsyncDecoding): Add the default implementation of a virtual function.
2182
2183         * platform/graphics/ImageFrameCache.cpp:
2184         (WebCore::ImageFrameCache::~ImageFrameCache): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
2185         (WebCore::ImageFrameCache::decodingQueue): Change the QNS of the decoding thread to be WorkQueue::QOS::Default.
2186         WorkQueue::QOS::UserInteractive causes the scrolling thread to preempted  which can make the scrolling choppy.
2187         (WebCore::ImageFrameCache::startAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
2188         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Ditto.
2189         (WebCore::ImageFrameCache::isAsyncDecodingQueueIdle): A helper function to tell whether the decoding thread is idle.
2190         (WebCore::ImageFrameCache::stopAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
2191         * platform/graphics/ImageFrameCache.h:
2192         (WebCore::ImageFrameCache::hasAsyncDecodingQueue): Rename this function to be consistent with the rest of the functions.
2193         (WebCore::ImageFrameCache::hasDecodingQueue): Deleted.
2194
2195         * platform/graphics/ImageSource.h:
2196         (WebCore::ImageSource::hasAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
2197         (WebCore::ImageSource::isAsyncDecodingQueueIdle): A wrapper for ImageFrameCache::isAsyncDecodingQueueIdle().
2198         (WebCore::ImageSource::hasDecodingQueue): Deleted.
2199         
2200         * platform/graphics/TiledBacking.h: Fix a comment. tileGridExtent() is the only one that is used for testing.
2201
2202         * rendering/RenderElement.cpp:
2203         (WebCore::RenderElement::~RenderElement):
2204         (WebCore::RenderElement::intersectsAbsoluteRect): Make this function does what shouldRepaintForImageAnimation()
2205         was doing expect the check for document.activeDOMObjectsAreSuspended().
2206         (WebCore::RenderElement::newImageAnimationFrameAvailable): Replace the call to
2207         shouldRepaintForImageAnimation() by checking document().activeDOMObjectsAreSuspended() then a call to
2208         RenderElement::intersectsAbsoluteRect().
2209         (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded): Ditto.
2210         (WebCore::RenderElement::registerForAsyncImageDecodingCallback): Call the RenderView to register the renderer..
2211         (WebCore::RenderElement::unregisterForAsyncImageDecodingCallback): Call the RenderView to unregister the renderer..
2212         (WebCore::shouldRepaintForImageAnimation): Deleted.
2213         * rendering/RenderElement.h:
2214
2215         * rendering/RenderObject.cpp:
2216         (WebCore::RenderObject::setIsRegisteredForAsyncImageDecodingCallback):
2217         * rendering/RenderObject.h:
2218         (WebCore::RenderObject::isRegisteredForAsyncImageDecodingCallback):
2219         (WebCore::RenderObject::RenderObjectRareData::RenderObjectRareData):
2220         Mark/unmark the renderer for being RegisteredForAsyncImageDecodingCallback.
2221
2222         * rendering/RenderReplaced.h: Make intrinsicSize() be a public function.
2223
2224         * rendering/RenderView.cpp:
2225         (WebCore::RenderView::registerForAsyncImageDecodingCallback): Register a renderer for async image decoding.
2226         (WebCore::RenderView::unregisterForAsyncImageDecodingCallback): Remove a renderer from the list of async image decoding.
2227         (WebCore::RenderView::requestAsyncDecodingForImagesInAbsoluteRect):This loops through all the registered RenderImages
2228         inside this RenderView and if any of them intersects with the rectangle, requestAsyncDecoding for it.
2229         * rendering/RenderView.h:
2230
2231 2017-03-08  Michael Catanzaro  <mcatanzaro@igalia.com>
2232
2233         Fix missing return value after r213499
2234         https://bugs.webkit.org/show_bug.cgi?id=168198
2235
2236         Reviewed by Myles C. Maxfield.
2237
2238         * platform/text/CharacterProperties.h:
2239         (WebCore::isEmojiGroupCandidate):
2240
2241 2017-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2242
2243         Add TextIndicator support for providing a snapshot excluding selected content
2244         https://bugs.webkit.org/show_bug.cgi?id=169309
2245         <rdar://problem/30883525>
2246
2247         Reviewed by Tim Horton.
2248
2249         Work towards <rdar://problem/30882974>. Adds support in TextIndicator to include a snapshot of all visible
2250         content, excluding nodes captured in the current selection. This comes in the form of the new
2251         TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection flag -- see per-method changes for more details.
2252
2253         No new tests, since there is no change in behavior yet.
2254
2255         * page/FrameSnapshotting.cpp:
2256         (WebCore::snapshotFrameRectWithClip):
2257         * page/FrameSnapshotting.h:
2258
2259         Introduce a new snapshot option flag, SnapshotOptionsPaintEverythingExcludingSelection.
2260
2261         (WebCore::snapshotFrameRectWithClip):
2262         * page/TextIndicator.cpp:
2263
2264         If TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection is turned on, capture and include a
2265         snapshot of the visible bounds of the frame.
2266
2267         (WebCore::takeSnapshot):
2268         (WebCore::takeSnapshots):
2269         (WebCore::initializeIndicator):
2270         * page/TextIndicator.h:
2271
2272         Introduce TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection.
2273
2274         * platform/graphics/FontCascade.cpp:
2275         (WebCore::FontCascade::widthOfTextRange):
2276         * platform/graphics/FontCascade.h:
2277
2278         Teach FontCascade to retrieve the width of a range in a TextRun, and also compute the widths of the TextRun
2279         before and after the range. This is used by InlineTextBox to compute the painting rect to clip out when skipping
2280         text decorations for the selected region of the TextRun.
2281
2282         * rendering/InlineTextBox.cpp:
2283
2284         Teach InlineTextBox to respect PaintBehaviorExcludeSelection. When painting text, if this paint behavior is
2285         used, we will not paint the portion of the text run that lies inside the range determined by selectionStartEnd().
2286         Similarly, when painting text decorations, we exclude the rect surrounding the selected content.
2287
2288         (WebCore::InlineTextBox::paint):
2289         (WebCore::InlineTextBox::paintDecoration):
2290         * rendering/InlineTextBox.h:
2291         * rendering/PaintPhase.h:
2292
2293         Introduce PaintBehaviorExcludeSelection, used to inform members of the render tree not to paint portions that
2294         lie within the current selection range.
2295
2296         * rendering/RenderLayer.cpp:
2297
2298         Propagate the PaintBehaviorExcludeSelection flag to children when painting.
2299
2300         (WebCore::RenderLayer::paintLayerContents):
2301         (WebCore::RenderLayer::paintForegroundForFragments):
2302         * rendering/RenderReplaced.cpp:
2303         (WebCore::RenderReplaced::shouldPaint):
2304
2305         Teach RenderReplaced to respect PaintBehaviorExcludeSelection by bailing from painting if it is selected and the
2306         paint behavior is enabled.
2307
2308         * rendering/TextDecorationPainter.h:
2309         * rendering/TextPaintStyle.cpp:
2310         (WebCore::computeTextSelectionPaintStyle):
2311         * rendering/TextPaintStyle.h:
2312         * rendering/TextPainter.cpp:
2313         (WebCore::TextPainter::paintText):
2314         * rendering/TextPainter.h:
2315
2316 2017-03-08  Youenn Fablet  <youenn@apple.com>
2317
2318         Support PeerConnectionStates::BundlePolicy::MaxBundle when setting rtc configuration
2319         https://bugs.webkit.org/show_bug.cgi?id=169389
2320
2321         Reviewed by Eric Carlson.
2322
2323         Temporary fix to support appr.tc web site.
2324         A future patch should allow to set MaxBundle.
2325
2326         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2327         (WebCore::configurationFromMediaEndpointConfiguration):
2328
2329 2017-03-08  Chris Dumez  <cdumez@apple.com>
2330
2331         Drop select.remove() / options.remove() overloads taking an option element in parameter
2332         https://bugs.webkit.org/show_bug.cgi?id=169339
2333
2334         Reviewed by Sam Weinig.
2335
2336         Drop select.remove() / options.remove() overloads taking an option element in parameter.
2337         It is non-standard:
2338         - https://html.spec.whatwg.org/multipage/forms.html#the-select-element
2339         - https://html.spec.whatwg.org/multipage/infrastructure.html#htmloptionscollection
2340
2341         It is not supported by Firefox and was removed from Chrome:
2342         - https://bugs.chromium.org/p/chromium/issues/detail?id=345697
2343         - https://bugs.chromium.org/p/chromium/issues/detail?id=398627
2344
2345         Chrome UseCounter data shows consistent 0% usage:
2346         - https://www.chromestatus.com/metrics/feature/timeline/popularity/398
2347
2348         Test: fast/dom/HTMLSelectElement/remove-option-element.html
2349
2350         * html/HTMLOptionsCollection.cpp:
2351         * html/HTMLOptionsCollection.h:
2352         * html/HTMLOptionsCollection.idl:
2353         * html/HTMLSelectElement.cpp:
2354         * html/HTMLSelectElement.h:
2355         * html/HTMLSelectElement.idl:
2356
2357 2017-03-08  Chris Dumez  <cdumez@apple.com>
2358
2359         Parameter to input.setCustomValidity() should not be nullable
2360         https://bugs.webkit.org/show_bug.cgi?id=169332
2361
2362         Reviewed by Sam Weinig.
2363
2364         Parameter to input.setCustomValidity() should not be nullable:
2365         - https://html.spec.whatwg.org/#htmlinputelement
2366
2367         Firefox and Chrome agree with the specification so the change
2368         should be safe.
2369
2370         Test: fast/forms/setCustomValidity-null-parameter.html
2371
2372         * html/HTMLButtonElement.idl:
2373         * html/HTMLFieldSetElement.idl:
2374         * html/HTMLInputElement.idl:
2375         * html/HTMLKeygenElement.idl:
2376         * html/HTMLObjectElement.idl:
2377         * html/HTMLOutputElement.idl:
2378         * html/HTMLSelectElement.idl:
2379         * html/HTMLTextAreaElement.idl:
2380
2381 2017-03-08  Simon Fraser  <simon.fraser@apple.com>
2382
2383         Support transitions/animations of background-position with right/bottom-relative values
2384         https://bugs.webkit.org/show_bug.cgi?id=162048
2385
2386         Reviewed by Dean Jackson.
2387         
2388         Re-landing r206713.
2389         
2390         Make transitions between "background-position: 10px 20px" and "background-position: right 10px bottom 20px"
2391         work. We do this by by converting "right 10px" to "calc(100% - 10px)" when blending.
2392         
2393         Also improve logging of calculated lengths, and better animation logging for FillLayer properties.
2394
2395         Test: transitions/background-position-transitions.html
2396
2397         * page/animation/CSSPropertyAnimation.cpp:
2398         (WebCore::FillLayerAnimationPropertyWrapperBase::FillLayerAnimationPropertyWrapperBase): Keep the propertyID
2399         around so logging can use it.
2400         (WebCore::FillLayerAnimationPropertyWrapperBase::property):
2401         (WebCore::FillLayerPropertyWrapperGetter::FillLayerPropertyWrapperGetter):
2402         (WebCore::FillLayerPropertyWrapperGetter::value):
2403         (WebCore::FillLayerPropertyWrapper::FillLayerPropertyWrapper):
2404         (WebCore::createCalculatedLength):
2405         (WebCore::FillLayerPositionPropertyWrapper::FillLayerPositionPropertyWrapper):
2406         (WebCore::FillLayerRefCountedPropertyWrapper::FillLayerRefCountedPropertyWrapper):
2407         (WebCore::FillLayerStyleImagePropertyWrapper::FillLayerStyleImagePropertyWrapper):
2408         (WebCore::FillLayersPropertyWrapper::FillLayersPropertyWrapper):
2409         (WebCore::CSSPropertyAnimation::blendProperties): Blend then log, so that the logging
2410         can show the result.
2411         * platform/CalculationValue.cpp:
2412         (WebCore::CalcExpressionNumber::dump):
2413         (WebCore::CalcExpressionBinaryOperation::dump):
2414         (WebCore::CalcExpressionLength::dump):
2415         (WebCore::CalcExpressionBlendLength::dump):
2416         (WebCore::operator<<):
2417         * platform/CalculationValue.h:
2418         * platform/Length.cpp:
2419         (WebCore::operator<<):
2420
2421 2017-03-08  Anders Carlsson  <andersca@apple.com>
2422
2423         Simplify the PaymentCoordinator interface
2424         https://bugs.webkit.org/show_bug.cgi?id=169382
2425         Part of rdar://problem/28880714.
2426
2427         Reviewed by Tim Horton.
2428
2429         Add four new structs: PaymentAuthorizationResult, PaymentMethodUpdate, ShippingContactUpdate and ShippingMethodUpdate.
2430         Change the various PaymentCoordinator and PaymentCoordinatorClient functions to take these new objects instead of multiple parameters.
2431
2432         * Modules/applepay/ApplePaySession.cpp:
2433         (WebCore::ApplePaySession::completeShippingMethodSelection):
2434         (WebCore::ApplePaySession::completeShippingContactSelection):
2435         (WebCore::ApplePaySession::completePaymentMethodSelection):
2436         (WebCore::ApplePaySession::completePayment):
2437         (WebCore::ApplePaySession::didSelectShippingMethod):
2438         (WebCore::ApplePaySession::didSelectShippingContact):
2439         * Modules/applepay/PaymentAuthorizationStatus.h:
2440         * Modules/applepay/PaymentCoordinator.cpp:
2441         (WebCore::PaymentCoordinator::completeShippingMethodSelection):
2442         (WebCore::PaymentCoordinator::completeShippingContactSelection):
2443         (WebCore::PaymentCoordinator::completePaymentMethodSelection):
2444         (WebCore::PaymentCoordinator::completePaymentSession):
2445         * Modules/applepay/PaymentCoordinator.h:
2446         * Modules/applepay/PaymentCoordinatorClient.h:
2447         * Modules/applepay/PaymentRequest.h:
2448         * loader/EmptyClients.cpp:
2449
2450 2017-03-08  Simon Fraser  <simon.fraser@apple.com>
2451
2452         Change determineNonLayerDescendantsPaintedContent to max out based on renderers traversed
2453         https://bugs.webkit.org/show_bug.cgi?id=169384
2454
2455         Reviewed by Zalan Bujtas.
2456
2457         determineNonLayerDescendantsPaintedContent() would bail after depth 3, sibling count 20. However,
2458         empirical testing shows that it would run to completion more often if the limit was based on the
2459         number of nodes traversed (in particular, it's common to see fairly deep subtrees with few siblings).
2460         Running to completion has huge memory advantages, because we can then be sure to have checked all the
2461         renderers for smoothed text, allowing us, on some pages, to avoid the extra memory cost of using
2462         layers that support subpixel-antialiased text.
2463
2464         Performance measurement shows that mean runtime of this function goes up from 0.30us to 0.34us
2465         with a 200 renderer limit, which seems worthwhile.
2466
2467         Test: compositing/contents-format/subpixel-antialiased-text-traversal.html
2468
2469         * rendering/RenderLayer.cpp:
2470         (WebCore::RenderLayer::calculateClipRects):
2471
2472 2017-03-08  Youenn Fablet  <youenn@apple.com>
2473
2474         Support canvas captureStream
2475         https://bugs.webkit.org/show_bug.cgi?id=169192
2476
2477         Reviewed by Dean Jackson.
2478
2479         Tests: fast/mediacapturefromelement/CanvasCaptureMediaStream-2d-events.html
2480                fast/mediacapturefromelement/CanvasCaptureMediaStream-capture-out-of-DOM-element.html
2481                fast/mediacapturefromelement/CanvasCaptureMediaStream-clone-track.html
2482                fast/mediacapturefromelement/CanvasCaptureMediaStream-creation.html
2483                fast/mediacapturefromelement/CanvasCaptureMediaStream-exceptions.html
2484                fast/mediacapturefromelement/CanvasCaptureMediaStream-framerate-0.html
2485                fast/mediacapturefromelement/CanvasCaptureMediaStream-imagebitmaprenderingcontext.html
2486                fast/mediacapturefromelement/CanvasCaptureMediaStream-offscreencanvas.html
2487                fast/mediacapturefromelement/CanvasCaptureMediaStream-request-frame-events.html
2488                fast/mediacapturefromelement/CanvasCaptureMediaStream-webgl-events.html
2489
2490         Adding canvas captureStream as defined in https://w3c.github.io/mediacapture-fromelement/#html-canvas-element-media-capture-extensions
2491         This allows creating a video MediaStreamTrack fed by canvas taken frames.
2492         Frames are produced when canvas get changed.
2493
2494         Tests taken from Chromium.
2495
2496         * CMakeLists.txt:
2497         * DerivedSources.make:
2498         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: Added.
2499         (WebCore::CanvasCaptureMediaStreamTrack::create):
2500         (WebCore::CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack):
2501         (WebCore::CanvasCaptureMediaStreamTrack::Source::create):
2502         (WebCore::CanvasCaptureMediaStreamTrack::Source::Source):
2503         (WebCore::CanvasCaptureMediaStreamTrack::Source::startProducingData):
2504         (WebCore::CanvasCaptureMediaStreamTrack::Source::stopProducingData):
2505         (WebCore::CanvasCaptureMediaStreamTrack::Source::requestFrameTimerFired):
2506         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasDestroyed):
2507         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
2508         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged):
2509         (WebCore::CanvasCaptureMediaStreamTrack::Source::captureCanvas):
2510         (WebCore::CanvasCaptureMediaStreamTrack::Source::paintCurrentFrameInContext):
2511         (WebCore::CanvasCaptureMediaStreamTrack::Source::currentFrameImage):
2512         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h: Added.
2513         (isType):
2514         * Modules/mediastream/CanvasCaptureMediaStreamTrack.idl: Added.
2515         * Modules/mediastream/MediaStreamTrack.h:
2516         (WebCore::MediaStreamTrack::isCanvas):
2517         * Modules/mediastream/MediaStreamTrack.idl:
2518         * WebCore.xcodeproj/project.pbxproj:
2519         * bindings/js/JSMediaStreamTrackCustom.cpp:
2520         (WebCore::toJSNewlyCreated):
2521         (WebCore::toJS):
2522         * html/HTMLCanvasElement.cpp:
2523         (WebCore::HTMLCanvasElement::toMediaSample):
2524         (WebCore::HTMLCanvasElement::captureStream):
2525         * html/HTMLCanvasElement.h:
2526         * html/HTMLCanvasElement.idl:
2527         * html/canvas/WebGL2RenderingContext.cpp:
2528         (WebCore::WebGL2RenderingContext::clear):
2529         * html/canvas/WebGLRenderingContextBase.cpp:
2530         (WebCore::WebGLRenderingContextBase::markContextChangedAndNotifyCanvasObserver):
2531         (WebCore::WebGLRenderingContextBase::drawArrays):
2532         (WebCore::WebGLRenderingContextBase::drawElements):
2533         (WebCore::WebGLRenderingContextBase::drawArraysInstanced):
2534         (WebCore::WebGLRenderingContextBase::drawElementsInstanced):
2535         * html/canvas/WebGLRenderingContextBase.h:
2536         * platform/graphics/ImageBuffer.cpp:
2537         (WebCore::ImageBuffer::toBGRAData):
2538         * platform/graphics/ImageBuffer.h:
2539         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
2540         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
2541         (WebCore::releaseUint8Vector):
2542         (WebCore::MediaSampleAVFObjC::createImageSample):
2543         * platform/graphics/cg/ImageBufferCG.cpp:
2544         * platform/graphics/cg/ImageBufferDataCG.cpp:
2545         (WebCore::transferData):
2546         (WebCore::ImageBufferData::toBGRAData):
2547         * platform/graphics/cg/ImageBufferDataCG.h:
2548
2549 2017-03-07  Anders Carlsson  <andersca@apple.com>
2550
2551         Use the new code path when dragging web contents
2552         https://bugs.webkit.org/show_bug.cgi?id=169298
2553
2554         Reviewed by Beth Dakin.
2555
2556         * editing/Editor.h:
2557         * editing/cocoa/EditorCocoa.mm:
2558         (WebCore::Editor::writeSelection):
2559         Add a new function that writes the selection to a writer object.
2560
2561         * page/DragController.cpp:
2562         (WebCore::DragController::startDrag):
2563         Use the new writeSelection if mustUseLegacyDragClient is false.
2564
2565         * platform/PasteboardWriterData.cpp:
2566         (WebCore::PasteboardWriterData::WebContent::WebContent):
2567         (WebCore::PasteboardWriterData::WebContent::~WebContent):
2568         (WebCore::PasteboardWriterData::setWebContent):
2569         * platform/PasteboardWriterData.h:
2570         Add getters and setters.
2571
2572         * platform/mac/PasteboardWriter.mm:
2573         (WebCore::toUTIUnlessAlreadyUTI):
2574         Add a helper.
2575
2576         (WebCore::createPasteboardWriter):
2577         Convert web content to pasteboard types.
2578
2579 2017-03-08  Dave Hyatt  <hyatt@apple.com>
2580
2581         CSS Multicolumn should not clip columns horizontally
2582         https://bugs.webkit.org/show_bug.cgi?id=169363
2583
2584         Reviewed by Sam Weinig.
2585
2586         Revised multiple tests in fast/multicol.
2587
2588         * rendering/RenderMultiColumnSet.cpp:
2589         (WebCore::RenderMultiColumnSet::flowThreadPortionOverflowRect):
2590         Stop clipping horizontally. Section 8.1 of the spec changed from "clip" to "don't clip",
2591         so we're changing to match the latest draft. Keep iBooks-based pagination clipping though.
2592
2593 2017-03-08  Simon Fraser  <simon.fraser@apple.com>
2594
2595         Add support for history.scrollRestoration
2596         https://bugs.webkit.org/show_bug.cgi?id=147782
2597         rdar://problem/22614568
2598
2599         Reviewed by Sam Weinig.
2600
2601         Add support for history.scrollRestoration, per spec:
2602         <https://html.spec.whatwg.org/multipage/browsers.html#dom-history-scroll-restoration>
2603
2604         This is a new attribute on the History interface. On setting, sets the "shouldRestoreScrollPosition"
2605         state on the current history item, and the getter returns that state. pushState() inherits the
2606         state from the current item.
2607
2608         HistoryController::restoreScrollPositionAndViewState() consults this state, and if set to "manual"
2609         ("don't restore) it just uses the current scroll position (we need something to pass to
2610         setPageScaleFactor() so can't just avoid the restoration).
2611
2612         FrameLoader::scrollToFragmentWithParentBoundary() also needs to consult the historyItem
2613         to know if it's OK to scroll to a fragment, on back/forward same-document loads.
2614
2615         Tests: fast/history/history-scroll-restoration-attribute.html
2616                fast/history/history-scroll-restoration.html
2617
2618         * history/HistoryItem.cpp:
2619         (WebCore::HistoryItem::HistoryItem):
2620         (WebCore::HistoryItem::shouldRestoreScrollPosition):
2621         (WebCore::HistoryItem::setShouldRestoreScrollPosition):
2622         * history/HistoryItem.h:
2623         * loader/FrameLoader.cpp:
2624         (WebCore::FrameLoader::loadInSameDocument):
2625         (WebCore::itemAllowsScrollRestoration):
2626         (WebCore::isSameDocumentReload):
2627         (WebCore::FrameLoader::scrollToFragmentWithParentBoundary):
2628         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
2629         * loader/FrameLoader.h:
2630         * loader/HistoryController.cpp:
2631         (WebCore::HistoryController::restoreScrollPositionAndViewState):
2632         (WebCore::HistoryController::goToItem):
2633         (WebCore::HistoryController::pushState):
2634         (WebCore::HistoryController::replaceState):
2635         * page/History.cpp:
2636         (WebCore::History::scrollRestoration):
2637         (WebCore::History::setScrollRestoration):
2638         * page/History.h:
2639         * page/History.idl:
2640
2641 2017-03-08  Chris Dumez  <cdumez@apple.com>
2642
2643         [iOS] Throttle DOM timers to 30fps in low power mode
2644         https://bugs.webkit.org/show_bug.cgi?id=169213
2645         <rdar://problem/30876965>
2646
2647         Reviewed by Simon Fraser.
2648
2649         Throttle and align DOM timers to ~30fps in low power mode on iOS
2650         to save battery.
2651
2652         Test: fast/dom/timer-throttling-lowPowerMode.html
2653
2654         * page/DOMTimer.h:
2655         * page/Page.cpp:
2656         (WebCore::Page::handleLowModePowerChange):
2657         (WebCore::Page::updateDOMTimerAlignmentInterval):
2658
2659 2017-03-08  Chris Dumez  <cdumez@apple.com>
2660
2661         Update outdated comment about HTMLElement.dropzone
2662         https://bugs.webkit.org/show_bug.cgi?id=169338
2663
2664         Reviewed by Sam Weinig.
2665
2666         Update outdated comment about HTMLElement.dropzone since it was dropped
2667         from the HTML specification:
2668         - https://github.com/whatwg/html/commit/3044a7e8517a4488cea811789d19974a8d5a56ae
2669
2670         Also add comment about HTMLElement.webkitdropzone since Blink dropped
2671         it in:
2672         - https://bugs.chromium.org/p/chromium/issues/detail?id=688943
2673
2674         * html/HTMLElement.idl:
2675
2676 2017-03-06  Matt Rajca  <mrajca@apple.com>
2677
2678         Add support for an autoplay play-pause events quirk.
2679         https://bugs.webkit.org/show_bug.cgi?id=169235
2680
2681         Reviewed by Jer Noble.
2682
2683         For sites that assume media starts off playing, send a playing and pause event to trigger
2684         custom media controls to update.
2685
2686         * html/HTMLMediaElement.cpp:
2687         (WebCore::needsAutoplayPlayPauseEventsQuirk):
2688         (WebCore::HTMLMediaElement::dispatchPlayPauseEventsIfNeedsQuirks):
2689         (WebCore::HTMLMediaElement::setReadyState):
2690         (WebCore::HTMLMediaElement::play):
2691         * html/HTMLMediaElement.h:
2692
2693 2017-03-08  Zan Dobersek  <zdobersek@igalia.com>
2694
2695         MediaPlayerPrivateGStreamerBase::volume() should override the MediaPlayerPrivate method
2696         https://bugs.webkit.org/show_bug.cgi?id=169347
2697
2698         Reviewed by Carlos Garcia Campos.
2699
2700         Enable the MediaPlayerPrivate::volume() method for the USE(GSTREAMER) configuration
2701         and override it in the MediaPlayerPrivateGStreamerBase class.
2702
2703         * platform/graphics/MediaPlayerPrivate.h:
2704         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2705
2706 2017-03-08  Enrique Ocaña González  <eocanha@igalia.com>
2707
2708         [GStreamer][MSE] Actually implement flush() on playback pipeline
2709         https://bugs.webkit.org/show_bug.cgi?id=169202
2710
2711         Reviewed by Žan Doberšek.
2712
2713         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp: Added GRefPtr support for GstQuery.
2714         (WTF::adoptGRef):
2715         (WTF::refGPtr<GstQuery>):
2716         (WTF::derefGPtr<GstQuery>):
2717         * platform/graphics/gstreamer/GRefPtrGStreamer.h: Ditto.
2718         * platform/graphics/gstreamer/GUniquePtrGStreamer.h: Added GUniquePtr support for GstSegment.
2719         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
2720         (WebCore::MediaSourceClientGStreamerMSE::flush): Only actually flush in the non-seek case. For the seek case,
2721         GStreamer seek will already do the flush.
2722         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
2723         (WebCore::PlaybackPipeline::addSourceBuffer): Configure appsrc to be time-based instead of bytes-based to ensure
2724         that the segments it produces are time-based.
2725         (WebCore::segmentFixerProbe): This captures the next segment in the stream and "fixes" its base time by setting
2726         it to the start time. This prevent audio/video desynchronizations.
2727         (WebCore::PlaybackPipeline::flush): Really implement flushing by sending flush start/stop events, reconfiguring
2728         appsrc with a new (seamless) segment (so it reconfigures the rest of the elements in that stream), and attached
2729         a segmentFixerProbe to fix the segment emitted by basesrc (appsrc). The current pipeline position is used as
2730         start time used for the new segment. This prevents displaying samples already displayed before flushing, while
2731         allowing the decoder to decode them as a base for future (dependent) p-frame and b-frame samples.
2732
2733 2017-03-07  Simon Fraser  <simon.fraser@apple.com>
2734
2735         Remove never-implemented CSS3 text decoration-related properties
2736         https://bugs.webkit.org/show_bug.cgi?id=169009
2737
2738         Reviewed by Zalan Bujtas.
2739
2740         The following CSS properties were added many years ago based on an old CSS3 Text
2741         draft (https://www.w3.org/TR/2003/CR-css3-text-20030514/), but never had any implementations.
2742         Remove them.
2743
2744             text-line-through
2745             text-line-through-color
2746             text-line-through-mode
2747             text-line-through-style
2748             text-line-through-width
2749             text-overline
2750             text-overline-color
2751             text-overline-mode
2752             text-overline-style
2753             text-overline-width
2754             text-underline
2755             text-underline-color
2756             text-underline-mode
2757             text-underline-style
2758             text-underline-width
2759
2760         * WebCore.xcodeproj/project.pbxproj:
2761         * css/CSSComputedStyleDeclaration.cpp:
2762         (WebCore::ComputedStyleExtractor::propertyValue):
2763         * css/CSSProperties.json:
2764         * css/parser/CSSParserFastPaths.cpp:
2765         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
2766
2767 2017-03-07  Simon Fraser  <simon.fraser@apple.com>
2768
2769         Have fixedPositionCreatesStackingContext be on by default everywhere
2770         https://bugs.webkit.org/show_bug.cgi?id=169334
2771
2772         Reviewed by Zalan Bujtas.
2773
2774         It makes no sense to have web-exposed CSS functionality be different based on setting,
2775         and other browser are now aligned with having position:fixed create stacking context.
2776
2777         So remove the fixedPositionCreatesStackingContext setting and have StyleResolver::adjustRenderStyle()
2778         always force stacking context for position:fixed.
2779
2780         * css/StyleResolver.cpp:
2781         (WebCore::StyleResolver::adjustRenderStyle):
2782         * page/Settings.cpp:
2783         * page/Settings.in:
2784
2785 2017-03-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
2786
2787         Asynchronous image decoding should consider the drawing size if it is smaller than the size of the image
2788         https://bugs.webkit.org/show_bug.cgi?id=168814
2789
2790         Reviewed by Simon Fraser.
2791
2792         If the image destinationRect.size() is smaller than the imageSourceSize
2793         (e.g. 3000x3000 pixels), CGImageSourceCreateThumbnailAtIndex() is slower
2794         than CGImageSourceCreateImageAtIndex() in decoding this image. To overcome
2795         this problem, the entry (kCGImageSourceThumbnailMaxPixelSize,
2796         max(destinationRect.width, destinationRect.height)) is added to the options
2797         dictionary when calling CGImageSourceCreateThumbnailAtIndex(). This will
2798         avoid copying a large block of memory for the unscaled bitmap image.
2799
2800         An argument named 'sizeForDrawing' of type std::optional<IntSize> will be passed
2801         all the way from BitmapImage to ImageDecoder. If bool(sizeForDrawing) equals
2802         true that means we want async image decoding. Otherwise the image will be decoded
2803         synchronously.
2804
2805         The subsamplingLevel argument will be passed as std::optional<SubsamplingLevel>.
2806         to ImageFrame query functions. When combined with sizeForDrawing, the meaning of
2807         these two arguments will be the following:
2808         -- !bool(subsamplingLevel): No caching is required. return what is stored in ImageFrameCache.
2809         -- bool(subsamplingLevel) && !bool(sizeForDrawing): Match subsamplingLevel only. Recache if it's different.
2810         -- bool(subsamplingLevel) && bool(sizeForDrawing): Match both both. . Recache if one of them is different.
2811
2812         We are going to allow decoding the same ImageFrame for different sizeForDrawings.
2813         The rule is a new decoding is allowed only if the maxPixelSize(sizeForDrawing) of
2814         the last requested image decoding is less than the new request sizeForDrawing.
2815
2816         * loader/cache/CachedImage.h: Add a helper function which returns the URL of a CachedImage.
2817
2818         * platform/graphics/BitmapImage.cpp:
2819         (WebCore::BitmapImage::frameImageAtIndex): Add a new argument for sizeForDrawing.
2820         (WebCore::BitmapImage::nativeImage): Pass an empty sizeForDrawing to frameImageAtIndex(). We an image with the native size.
2821         (WebCore::BitmapImage::nativeImageForCurrentFrame): Ditto.
2822         (WebCore::BitmapImage::nativeImageOfSize): Ditto.
2823         (WebCore::BitmapImage::draw): Pass the destRect.size() to internalStartAnimation().
2824         (WebCore::BitmapImage::isAsyncDecodingRequired): A helper function to answer the question
2825         whether the async image decoding is required. It takes into account the animated images, the
2826         large image, and the image size.
2827         (WebCore::BitmapImage::internalStartAnimation):  If async image decoding is requested for this frame m_sizeForDraw
2828         will be set. If internalStartAnimation() is called from startAnimation(), sizeForDraw will be empty. In this
2829         case no async image decoding will be requested. This happens only when startAnimation() is called from outside
2830         BitmapImage::draw().
2831         (WebCore::BitmapImage::advanceAnimation): Change the log message.
2832         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Ditto.
2833         * platform/graphics/BitmapImage.h:
2834
2835         * platform/graphics/ImageFrame.cpp:
2836         (WebCore::ImageFrame::operator=):  Include m_sizeForDraw in the properties of ImageFrame.
2837         (WebCore::maxPixelSize): Returns the maximum of the width() and the height of an IntSize.
2838         (WebCore::ImageFrame::isBeingDecoded): Returns true if the ImageFrame is currently being decoded for a specific sizeForDrawing.
2839         (WebCore::ImageFrame::hasValidNativeImage): Ditto.
2840         * platform/graphics/ImageFrame.h:
2841         (WebCore::ImageFrame::enqueueSizeForDecoding): Adds a new sizeForDrawing; this sets the ImageFrame is being decoded for this sizeForDrawing.
2842         (WebCore::ImageFrame::dequeueSizeForDecoding): Removes the first sizeForDrawing was enqueued; this marks this ImageFrame has finished decoding for this sizeForDrawing.
2843         (WebCore::ImageFrame::clearSizeForDecoding): Clears the sizeForDecoding queue. Marks the ImageFrame for not being decoded.
2844         (WebCore::ImageFrame::isEmpty): Replace Decoding::Empty by Decoding::None.
2845         (WebCore::ImageFrame::sizeForDrawing): Returns the ImageFrame sizeForDraw.
2846         (WebCore::ImageFrame::hasDecodedNativeImage): Returns true if the ImageFrame doesn't need decoding before drawing.
2847         (WebCore::ImageFrame::hasValidNativeImage): Deleted. Moved to the source file.
2848
2849         * platform/graphics/ImageFrameCache.cpp:
2850         (WebCore::ImageFrameCache::setFrameNativeImageAtIndex): Take a new argument for sizeForDraw.
2851         (WebCore::ImageFrameCache::setFrameMetadataAtIndex):  When sizeForDraw is set, use the decoder to get the image
2852         frame size. Otherwise, get the size of the nativeImage.
2853         (WebCore::ImageFrameCache::replaceFrameNativeImageAtIndex): Take a new argument for sizeForDraw.
2854         (WebCore::ImageFrameCache::cacheFrameNativeImageAtIndex): Ditto.
2855         (WebCore::ImageFrameCache::startAsyncDecodingQueue): Pass the sizeForDraw as a new property of the ImageFrame.
2856         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Store sizeForDraw in ImageFrameRequest. Delete unneeded check.
2857         This function always receives a valid subsamplingLevel. 
2858         (WebCore::ImageFrameCache::stopAsyncDecodingQueue): Marks all the queued ImageFrames for not being decoded.
2859         (WebCore::ImageFrameCache::frameAtIndexCacheIfNeeded): Take a new argument for sizeForDraw. If this function fixes the
2860         properties of ImageFrame properties, keep the old sizeForDraw and/or subsamplingLevel. If a new frame is 
2861         decoded, no async image decoding will be done in this code path. So pass an empty std::optional<IntSize> to 
2862         ImageDecoder::createFrameImageAtIndex() and store std::optional<IntSize> in ImageFrame.
2863         (WebCore::ImageFrameCache::frameMetadataAtIndex): A new helper function which takes a variable number of arguments which
2864         will be passed to the (ImageFrame::*functor).
2865         (WebCore::ImageFrameCache::frameMetadataAtIndexCacheIfNeeded): Make this function takes a variable number of arguments which
2866         will be passed to the frameAtIndexCacheIfNeeded().
2867         (WebCore::ImageFrameCache::size): Pass an Metadata, valid SubsamplingLevel and empty sizeForDraw to frameMetadataAtIndexCacheIfNeeded().
2868         (WebCore::ImageFrameCache::sizeRespectingOrientation): Ditto.
2869         (WebCore::ImageFrameCache::singlePixelSolidColor): Pass MetadataAndImage, empty SubsamplingLevel and empty sizeForDraw to
2870         frameMetadataAtIndexCacheIfNeeded(); we can use the current frame image regardless of its size.
2871         (WebCore::ImageFrameCache::frameIsBeingDecodedAtIndex): Pass the ImageFrame method as a function argument instead of 
2872         passing it as a template argument.
2873         (WebCore::ImageFrameCache::frameIsCompleteAtIndex): Ditto.
2874         (WebCore::ImageFrameCache::frameHasAlphaAtIndex): Ditto.
2875         (WebCore::ImageFrameCache::frameHasImageAtIndex): Ditto.
2876         (WebCore::ImageFrameCache::frameHasValidNativeImageAtIndex): Pass subsamplingLevel and sizeForDrawing to frameMetadataAtIndex().
2877         (WebCore::ImageFrameCache::frameHasDecodedNativeImage): New helper function to answer the question whether an ImageFrame will need
2878         decoding when drawing or not.
2879         (WebCore::ImageFrameCache::frameSubsamplingLevelAtIndex):  Pass the ImageFrame method as a function argument instead of 
2880         passing it as a template argument.
2881         (WebCore::ImageFrameCache::frameSizeAtIndex): Ditto.
2882         (WebCore::ImageFrameCache::frameBytesAtIndex): Ditto.
2883         (WebCore::ImageFrameCache::frameDurationAtIndex): Ditto.
2884         (WebCore::ImageFrameCache::frameOrientationAtIndex):
2885         (WebCore::ImageFrameCache::frameImageAtIndex): Ditto.
2886         (WebCore::ImageFrameCache::frameAtIndex): Deleted. Renamed to frameAtIndexCacheIfNeeded().
2887         * platform/graphics/ImageFrameCache.h:
2888         (WebCore::ImageFrameCache::frameAtIndexCacheIfNeeded):
2889
2890         * platform/graphics/ImageObserver.h: Define a virtual function for image sourceUrl().
2891
2892         * platform/graphics/ImageSource.cpp:
2893         (WebCore::ImageSource::frameImageAtIndex): Take a new argument for sizeForDrawing.
2894         * platform/graphics/ImageSource.h:
2895         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex): Take a new argument for sizeForDrawing.
2896         (WebCore::ImageSource::frameHasValidNativeImageAtIndex): Ditto.
2897         (WebCore::ImageSource::frameHasDecodedNativeImage): New helper function.
2898         (WebCore::ImageSource::frameImageAtIndex): Ditto.
2899
2900         * platform/graphics/cg/ImageDecoderCG.cpp:
2901         (WebCore::createImageSourceOptions): Create a dictionary with the basic image decoding options.
2902         (WebCore::createImageSourceAsyncOptions): Create a dictionary with the basic asynchronous image decoding options.
2903         (WebCore::appendImageSourceOption): Append the SubsamplingLevel or the MaxPixelSize option to an CGImageSource options dictionary.
2904         (WebCore::appendImageSourceOptions): Append the SubsamplingLevel and the MaxPixelSize option to an CGImageSource options dictionary.
2905         (WebCore::imageSourceOptions): Creates a dictionary for the synchronous image decoding options.
2906         (WebCore::imageSourceAsyncOptions): Creates a dictionary for the asynchronous image decoding options.
2907         (WebCore::ImageDecoder::createFrameImageAtIndex): Replace the DecodingMode argument by an std::optional<IntSize>.
2908         * platform/graphics/cg/ImageDecoderCG.h: Change a prototype.
2909
2910         * platform/graphics/win/ImageDecoderDirect2D.cpp: 
2911         (WebCore::ImageDecoder::createFrameImageAtIndex): Replace the DecodingMode argument by an std::optional<IntSize>.
2912         * platform/graphics/win/ImageDecoderDirect2D.h: Change a prototype.
2913
2914         * platform/image-decoders/ImageDecoder.cpp: 
2915         (WebCore::ImageDecoder::createFrameImageAtIndex): Replace the DecodingMode argument by an std::optional<IntSize>.
2916         * platform/image-decoders/ImageDecoder.h: Change a prototype.
2917
2918 2017-03-07  Simon Fraser  <simon.fraser@apple.com>
2919
2920         Parsing -webkit-hyphenate-character uses confusingly named consumeLocale()
2921         https://bugs.webkit.org/show_bug.cgi?id=168638
2922
2923         Reviewed by Zalan Bujtas.
2924
2925         Parsing CSSPropertyWebkitHyphenateCharacter very confusingly called consumeLocale(),
2926         which is really just "consume the 'auto' ident or a string", so rename that function.
2927
2928         * css/parser/CSSPropertyParser.cpp:
2929         (WebCore::consumeAutoOrString):
2930         (WebCore::CSSPropertyParser::parseSingleValue):
2931         (WebCore::consumeLocale): Deleted.
2932
2933 2017-03-07  Jiewen Tan  <jiewen_tan@apple.com>
2934
2935         [WebCrypto] Implement ECDH ImportKey/ExportKey operations
2936         https://bugs.webkit.org/show_bug.cgi?id=169257
2937         <rdar://problem/23789585>
2938
2939         Reviewed by Brent Fulgham.
2940
2941         This patch implements ECDH ImportKey/ExportKey operations according to:
2942         https://www.w3.org/TR/WebCryptoAPI/#ecdh-operations. Sad that we can't
2943         support SPKI/PKCS8 formats at this moment due to lack of necessary
2944         support in the underlying crypto library. Bug 169318 is tracking the
2945         issue. Also, this patch fixes minor bugs while importing JWK keys for
2946         HMAC/RSA.
2947
2948         Tests: crypto/subtle/ec-export-key-malformed-parameters.html
2949                crypto/subtle/ec-import-jwk-key-export-jwk-key-private.html
2950                crypto/subtle/ec-import-jwk-key-export-jwk-key-public.html
2951                crypto/subtle/ec-import-jwk-key-export-raw-key.html
2952                crypto/subtle/ec-import-key-malformed-parameters.html
2953                crypto/subtle/ec-import-raw-key-export-jwk-key.html
2954                crypto/subtle/ec-import-raw-key-export-raw-key.html
2955                crypto/subtle/ecdh-generate-export-jwk-key-p256.html
2956                crypto/subtle/ecdh-generate-export-jwk-key-p384.html
2957                crypto/subtle/ecdh-generate-export-key-raw-p256.html
2958                crypto/subtle/ecdh-generate-export-key-raw-p384.html
2959                crypto/subtle/ecdh-import-jwk-key-minimum.html
2960                crypto/subtle/ecdh-import-jwk-private-key-p256.html
2961                crypto/subtle/ecdh-import-jwk-private-key-p384.html
2962                crypto/subtle/ecdh-import-jwk-public-key-p256.html
2963                crypto/subtle/ecdh-import-jwk-public-key-p384.html
2964                crypto/subtle/ecdh-import-raw-key-p256.html
2965                crypto/subtle/ecdh-import-raw-key-p384.html
2966                crypto/workers/subtle/ec-generate-export-jwk-key.html
2967                crypto/workers/subtle/ec-generate-export-raw-key.html
2968                crypto/workers/subtle/ec-import-jwk-key-private.html
2969                crypto/workers/subtle/ec-import-jwk-key-public.html
2970                crypto/workers/subtle/ec-import-raw-key.html
2971
2972         * bindings/js/JSSubtleCryptoCustom.cpp:
2973         (WebCore::normalizeCryptoAlgorithmParameters):
2974         (WebCore::supportExportKeyThrow):
2975         Added EC family support.
2976         * crypto/CommonCryptoUtilities.h:
2977         Added needed CommonCrypto SPIs.
2978         * crypto/CryptoAlgorithm.h:
2979         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
2980         (WebCore::CryptoAlgorithmECDH::importKey):
2981         (WebCore::CryptoAlgorithmECDH::exportKey):
2982         * crypto/algorithms/CryptoAlgorithmECDH.h:
2983         * crypto/gnutls/CryptoKeyECGnuTLS.cpp:
2984         (WebCore::CryptoKeyEC::keySizeInBits):
2985         (WebCore::CryptoKeyEC::exportRaw):
2986         (WebCore::CryptoKeyEC::platformImportRaw):
2987         (WebCore::CryptoKeyEC::platformImportJWKPublic):
2988         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
2989         (WebCore::CryptoKeyEC::platformAddFieldElements):
2990         Faked implementations for GTK+.
2991         * crypto/keys/CryptoKeyEC.cpp:
2992         (WebCore::toNamedCurve):
2993         (WebCore::CryptoKeyEC::generatePair):
2994         (WebCore::CryptoKeyEC::importRaw):
2995         (WebCore::CryptoKeyEC::importJwk):
2996         (WebCore::CryptoKeyEC::exportJwk):
2997         * crypto/keys/CryptoKeyEC.h:
2998         * crypto/keys/CryptoKeyHMAC.cpp:
2999         (WebCore::CryptoKeyHMAC::importJwk):
3000         Fixed a bug.
3001         * crypto/keys/CryptoKeyRSA.cpp:
3002         (WebCore::CryptoKeyRSA::importJwk):
3003         Fixed a bug.
3004         * crypto/mac/CryptoKeyECMac.cpp:
3005         (WebCore::doesUncompressedPointMatchNamedCurve):
3006         (WebCore::doesFieldElementMatchNamedCurve):
3007         (WebCore::getKeySizeFromNamedCurve):
3008         (WebCore::CryptoKeyEC::~CryptoKeyEC):
3009         (WebCore::CryptoKeyEC::keySizeInBits):
3010         (WebCore::CryptoKeyEC::exportRaw):
3011         (WebCore::CryptoKeyEC::platformGeneratePair):
3012         (WebCore::CryptoKeyEC::platformImportRaw):
3013         (WebCore::CryptoKeyEC::platformImportJWKPublic):
3014         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
3015         (WebCore::CryptoKeyEC::platformAddFieldElements):
3016
3017 2017-03-07  Youenn Fablet  <youenn@apple.com>
3018
3019         WebRTC can be used even if getUserMedia is off
3020         https://bugs.webkit.org/show_bug.cgi?id=169303
3021
3022         Reviewed by Alex Christensen.
3023
3024         * page/RuntimeEnabledFeatures.h:
3025         (WebCore::RuntimeEnabledFeatures::peerConnectionEnabled): No longer tieing peerConnectionEnabled to
3026         mediaStreamEnabled.
3027
3028 2017-03-07  Dean Jackson  <dino@apple.com>
3029
3030         Make platformDevice() not inline, to avoid a
3031         weak external symbol issue on newer compilers/linkers
3032
3033         * platform/graphics/cocoa/GPUDeviceMetal.mm:
3034         (WebCore::GPUDevice::platformDevice):
3035         * platform/graphics/gpu/GPUDevice.h:
3036         (WebCore::GPUDevice::platformDevice): Deleted.
3037
3038 2017-03-07  Dean Jackson  <dino@apple.com>
3039
3040         Some platforms won't be able to create a GPUDevice
3041         https://bugs.webkit.org/show_bug.cgi?id=169314
3042         <rdar://problems/30907521>
3043
3044         Reviewed by Jon Lee.
3045
3046         Protect for the case where the hardware doesn't support Metal. And
3047         we might as well disable WebGPU completely in the iOS simulator
3048         for now.
3049
3050         * Configurations/FeatureDefines.xcconfig:
3051         * platform/graphics/cocoa/GPUDeviceMetal.mm:
3052         (WebCore::GPUDevice::GPUDevice):
3053         * platform/graphics/gpu/GPUDevice.cpp:
3054         (WebCore::GPUDevice::create):
3055
3056 2017-03-07  Maureen Daum  <mdaum@apple.com>
3057
3058         Correctly check for an empty database file.
3059         <rdar://problem/30542242> Removing Website Data not working (WebSQL directories being left behind)
3060         https://bugs.webkit.org/show_bug.cgi?id=169256
3061
3062         Reviewed by Brady Eidson.
3063
3064         Tests: DatabaseTrackerTest.DeleteDatabaseFileIfEmpty verifies that we actually delete an empty file.
3065
3066         Instead of checking that a database file's size is zero bytes, we should check if it contains
3067         any tables. Once we open an empty database file and set its journal mode to WAL, it will have a
3068         valid SQLite header and therefore will no longer be empty. We can know that the database was empty
3069         if it does not contain any tables.
3070
3071         * Modules/webdatabase/DatabaseTracker.cpp:
3072         (WebCore::DatabaseTracker::deleteDatabaseFileIfEmpty):
3073         Use BEGIN EXCLUSIVE TRANSACTION in order to obtain the exclusive lock. If the database doesn't contain
3074         any tables, it is empty and can be deleted.
3075
3076 2017-03-07  Alex Christensen  <achristensen@webkit.org>
3077
3078         [URLParser] Fix file URLs that are just file:// and a Windows drive letter
3079         https://bugs.webkit.org/show_bug.cgi?id=169242
3080
3081         Reviewed by Tim Horton.
3082
3083         This is specified in https://url.spec.whatwg.org/#file-host-state and tested by a newly-passing
3084         web platform test.  I added the check for the windows drive quirk in the FileHost state of the
3085         parser but I forgot it when FileHost is the terminal state.
3086
3087         * platform/URLParser.cpp:
3088         (WebCore::URLParser::parse):
3089
3090 2017-03-07  Chris Dumez  <cdumez@apple.com>
3091
3092         Drop non-standard MessageEvent.webkitInitMessageEvent()
3093         https://bugs.webkit.org/show_bug.cgi?id=169295
3094
3095         Reviewed by Joseph Pecoraro.
3096
3097         Drop non-standard MessageEvent.webkitInitMessageEvent().
3098
3099         Chrome dropped it almost 3 years ago. They had UseCounter data showing
3100         consistent 0% usage:
3101         - https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/H6lsGFqdy3Y
3102         - https://www.chromestatus.com/metrics/feature/timeline/popularity/223
3103         - https://src.chromium.org/viewvc/blink?revision=174967&view=revision
3104
3105         * bindings/js/JSMessageEventCustom.cpp:
3106         (WebCore::handleInitMessageEvent): Deleted.
3107         (WebCore::JSMessageEvent::webkitInitMessageEvent): Deleted.
3108         * dom/MessageEvent.idl:
3109
3110 2017-03-07  Chris Dumez  <cdumez@apple.com>
3111
3112         Label of an <option> element should not be displayed in quirks mode
3113         https://bugs.webkit.org/show_bug.cgi?id=169296
3114         <rdar://problem/30900751>
3115
3116         Reviewed by Simon Fraser.
3117
3118         Label of an <option> element should not be displayed in quirks mode, to
3119         match Chrome and Firefox. However, we should still display the label in
3120         strict mode, as per the HTML specification:
3121         - https://html.spec.whatwg.org/multipage/rendering.html#the-select-element-2
3122
3123         Chrome renders the label in strict mode, same as us. Firefox does not:
3124         - https://bugzilla.mozilla.org/show_bug.cgi?id=1345242
3125
3126         Tests: fast/dom/HTMLOptionElement/option-label-quirksmode.html
3127                fast/dom/HTMLOptionElement/option-label-quirksmode2.html
3128                fast/dom/HTMLOptionElement/option-label-strictmode.html
3129
3130         * html/HTMLOptionElement.cpp:
3131         (WebCore::HTMLOptionElement::displayLabel):
3132         (WebCore::HTMLOptionElement::textIndentedToRespectGroupLabel):
3133         * html/HTMLOptionElement.h:
3134
3135 2017-03-07  Dean Jackson  <dino@apple.com>
3136
3137         Add GPUDevice implementation and WebGPULayer
3138         https://bugs.webkit.org/show_bug.cgi?id=169219
3139         <rdar://problem/30879048>
3140
3141         Reviewed by Sam Weinig.
3142
3143         Add a basic implementation of a GPUDevice object,
3144         which references a MTLDevice. Also add a WebGPULayer
3145         that will ultimately be used to host WebGPU content.
3146
3147         WebKit API Test: WebCore/mac/GPUDevice.mm
3148
3149         * Configurations/WebCore.xcconfig: Link to Metal.
3150
3151         * PlatformMac.cmake: New files.
3152         * WebCore.xcodeproj/project.pbxproj:
3153
3154         * platform/Logging.h: Add a WebGPU logging channel.
3155
3156         * platform/graphics/cocoa/GPUDeviceMetal.mm: Added.
3157         (WebCore::GPUDevice::GPUDevice): Cocoa implementation.
3158         (WebCore::GPUDevice::reshape):
3159         * platform/graphics/cocoa/WebGPULayer.h: Added.
3160         * platform/graphics/cocoa/WebGPULayer.mm: Added.
3161         (-[WebGPULayer initWithGPUDevice:]):
3162         (-[WebGPULayer copyImageSnapshotWithColorSpace:]):
3163         (-[WebGPULayer display]):
3164         * platform/graphics/gpu/GPUDevice.cpp: Added.
3165         (WebCore::GPUDevice::create):
3166         (WebCore::GPUDevice::~GPUDevice):
3167         (WebCore::GPUDevice::GPUDevice): Implementation for platforms
3168         other than Mac and iOS hardware.
3169         (WebCore::GPUDevice::reshape):
3170         * platform/graphics/gpu/GPUDevice.h: Added.
3171         (WebCore::GPUDevice::platformLayer):
3172         (WebCore::GPUDevice::platformDevice):
3173         (WebCore::GPUDevice::layer):
3174
3175 2017-03-07  Antoine Quint  <graouts@apple.com>
3176
3177         [Modern Media Controls] Log an error to the console when an image fails to load
3178         https://bugs.webkit.org/show_bug.cgi?id=169292
3179
3180         Reviewed by Dean Jackson.
3181
3182         In order to help debug flaky tests we now log the image source when an image fails to load.
3183
3184         * Modules/modern-media-controls/controls/icon-button.js:
3185         (IconButton.prototype.handleEvent):
3186         (IconButton.prototype._loadImage):
3187
3188 2017-03-07  Zalan Bujtas  <zalan@apple.com>
3189
3190         Simple line layout: Do not use invalid m_lastNonWhitespaceFragment while removing trailing whitespace.
3191         https://bugs.webkit.org/show_bug.cgi?id=169288
3192         rdar://problem/30576976
3193
3194         Reviewed by Antti Koivisto.
3195
3196         When the current line has nothing but whitespace, m_lastNonWhitespaceFragment is invalid so
3197         we should not use the start/end values to decide how many characters we need to revert.
3198         This patch makes m_lastNonWhitespaceFragment optional. When it's invalid we just remove
3199         all the runs from the current line since they are all considered whitespace runs.
3200
3201         Test: fast/text/simple-line-layout-line-is-all-whitespace.html
3202
3203         * rendering/SimpleLineLayout.cpp:
3204         (WebCore::SimpleLineLayout::revertAllRunsOnCurrentLine):
3205         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace):
3206
3207 2017-03-07  Alex Christensen  <achristensen@webkit.org>
3208
3209         [Content Extensions] Rename "Domain" to "Condition" where appropriate
3210         https://bugs.webkit.org/show_bug.cgi?id=169297
3211
3212         Reviewed by Brady Eidson.
3213
3214         In r184116 I added the ability for a content blocker author to add conditions to the triggers,
3215         if-domain and unless-domain which look at the domain of the main document URL.
3216         I plan to add more conditions soon to run regexes on the entire URL, but to make that patch more
3217         manageable, I took the non-behavior-changing parts and put them in this patch.
3218
3219         No change in behavior except some error messages were made more generic.
3220
3221         * contentextensions/CompiledContentExtension.h:
3222         * contentextensions/ContentExtension.cpp:
3223         (WebCore::ContentExtensions::ContentExtension::ContentExtension):
3224         (WebCore::ContentExtensions::ContentExtension::compileGlobalDisplayNoneStyleSheet):
3225         (WebCore::ContentExtensions::ContentExtension::populateConditionCacheIfNeeded):
3226         Pass the main document URL instead of just the domain.  No change in behavior yet.
3227         (WebCore::ContentExtensions::ContentExtension::cachedConditionedActions):
3228         (WebCore::ContentExtensions::ContentExtension::universalActionsWithConditions):
3229         (WebCore::ContentExtensions::ContentExtension::populateDomainCacheIfNeeded): Deleted.
3230         (WebCore::ContentExtensions::ContentExtension::cachedDomainActions): Deleted.
3231         (WebCore::ContentExtensions::ContentExtension::universalActionsWithDomains): Deleted.
3232         * contentextensions/ContentExtension.h:
3233         (WebCore::ContentExtensions::ContentExtension::universalActionsWithoutConditions):
3234         (WebCore::ContentExtensions::ContentExtension::universalActionsWithoutDomains): Deleted.
3235         * contentextensions/ContentExtensionCompiler.cpp:
3236         (WebCore::ContentExtensions::serializeActions):
3237         (WebCore::ContentExtensions::compileRuleList):
3238         * contentextensions/ContentExtensionCompiler.h:
3239         * contentextensions/ContentExtensionError.cpp:
3240         (WebCore::ContentExtensions::contentExtensionErrorCategory):
3241         * contentextensions/ContentExtensionError.h:
3242         * contentextensions/ContentExtensionParser.cpp:
3243         (WebCore::ContentExtensions::getStringList):
3244         Don't pass the error type as a parameter.  It's always JSONInvalidConditionList.
3245         (WebCore::ContentExtensions::getDomainList):
3246         (WebCore::ContentExtensions::loadTrigger):
3247         * contentextensions/ContentExtensionRule.h:
3248         (WebCore::ContentExtensions::Trigger::~Trigger):
3249         (WebCore::ContentExtensions::Trigger::isEmpty):
3250         (WebCore::ContentExtensions::Trigger::operator==):
3251         (WebCore::ContentExtensions::TriggerHash::hash):
3252         Use bitwise xor instead of bitwise or to have fewer hash collisions.
3253         Also, before we were accidentally doing the same hash operation here for IfDomain and UnlessDomain.
3254         This caused unnecessary hash collisions.  This is fixed, but should not change any behavior.
3255         * contentextensions/ContentExtensionsBackend.cpp:
3256         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
3257         * contentextensions/DFABytecode.h:
3258         (WebCore::ContentExtensions::instructionSizeWithArguments):
3259         * contentextensions/DFABytecodeCompiler.cpp:
3260         (WebCore::ContentExtensions::DFABytecodeCompiler::emitAppendAction):
3261         * contentextensions/DFABytecodeInterpreter.cpp:
3262         (WebCore::ContentExtensions::matchesCondition):
3263         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretAppendAction):
3264         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretTestFlagsAndAppendAction):
3265         (WebCore::ContentExtensions::DFABytecodeInterpreter::actionsMatchingEverything):
3266         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretWithConditions):
3267         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpret):
3268         (WebCore::ContentExtensions::matchesDomain): Deleted.
3269         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretWithDomains): Deleted.
3270         * contentextensions/DFABytecodeInterpreter.h:
3271         * loader/ResourceLoadInfo.h:
3272
3273 2017-03-07  Michael Catanzaro  <mcatanzaro@igalia.com>
3274
3275         [FreeType] FontPlatformData::fallbacks() returns unprepared FcPatterns
3276         https://bugs.webkit.org/show_bug.cgi?id=164689
3277
3278         Reviewed by Carlos Garcia Campos.
3279
3280         From the documentation of FcFontSort():
3281
3282         """The returned FcFontSet references FcPattern structures which may be shared by the
3283         return value from multiple FcFontSort calls, applications must not modify these patterns.
3284         Instead, they should be passed, along with p to FcFontRenderPrepare which combines them into
3285         a complete pattern."""
3286
3287         That means each call to FcFontSort() must be followed up by a call to FcFontRenderPrepare(),
3288         else the patterns will lack information about how to draw the font properly.
3289
3290         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
3291         (WebCore::FontPlatformData::fallbacks):
3292
3293 2017-03-07  Myles C. Maxfield  <mmaxfield@apple.com>
3294
3295         Parsing font descriptors inside @font-face needs to accept ranges
3296         https://bugs.webkit.org/show_bug.cgi?id=168893
3297
3298         Reviewed by Dean Jackson.
3299
3300         Parse font-weight, font-stretch, and font-style ranges according to
3301         https://drafts.csswg.org/css-fonts-4/#font-prop-desc. There is one difference, though:
3302         as documented in https://github.com/w3c/csswg-drafts/issues/783, slashes are a better
3303         delimiters than hyphens, so this patch implements that instead. I'll update the spec to
3304         include slashes as soon as possible.
3305
3306         Because this patch is all about creating FontSelectionValues from fonts, it doesn't
3307         actually modify the font selection algorithm, and therefore only tests the creation of
3308         these new values. The font selection algorithm itself is already tested elsewhere.
3309
3310         This new work is behind the ENABLE(VARIATION_FONTS) flag.
3311
3312         Test: fast/text/font-selection-font-face-parse.html
3313
3314         * css/CSSFontFace.cpp:
3315         (WebCore::calculateWeightRange):
3316         (WebCore::calculateStretchRange):
3317         (WebCore::calculateItalicRange):
3318         * css/parser/CSSPropertyParser.cpp:
3319         (WebCore::consumeFontWeightRange):
3320         (WebCore::consumeFontStretchRange):
3321         (WebCore::consumeFontStyleRange):
3322         (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
3323         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3324         (WebCore::extractVariationBounds):
3325         (WebCore::variationCapabilitiesForFontDescriptor):
3326         (WebCore::capabilitiesForFontDescriptor):
3327
3328 2017-03-07  Dave Hyatt  <hyatt@apple.com>
3329
3330         Animated GIFs fail to play in multi-column layout
3331         https://bugs.webkit.org/show_bug.cgi?id=167901
3332         <rdar://problem/30382262>
3333
3334         Reviewed by Zalan Bujtas.
3335
3336         * rendering/RenderBox.cpp:
3337         (WebCore::RenderBox::computeRectForRepaint):
3338         Make sure to handle the case where we pass in a null repaintContainer and need
3339         to cross a multicolumn flow thread -> region boundary as a result.
3340
3341 2017-03-07  Fujii Hironori  <Hironori.Fujii@sony.com>
3342
3343         ShadowBlur::calculateLayerBoundingRect doesn't need to return the enclosingIntRect of layerRect
3344         https://bugs.webkit.org/show_bug.cgi?id=168650
3345
3346         Reviewed by Simon Fraser.
3347
3348         No new tests, no behavior change.
3349
3350         * platform/graphics/ShadowBlur.h: Change the type of return value
3351         from IntRect to IntSize.
3352         * platform/graphics/ShadowBlur.cpp:
3353         (WebCore::ShadowBlur::calculateLayerBoundingRect): Ditto.
3354         (WebCore::ShadowBlur::drawRectShadow): Rename a variable layerRect layerSize.
3355         (WebCore::ShadowBlur::drawInsetShadow): Ditto.
3356         (WebCore::ShadowBlur::drawRectShadowWithoutTiling): Ditto.
3357         (WebCore::ShadowBlur::drawInsetShadowWithoutTiling): Ditto.
3358         (WebCore::ShadowBlur::beginShadowLayer): Ditto.
3359
3360 2017-03-07  Chris Dumez  <cdumez@apple.com>
3361
3362         Replace debug assertion with release one in Frame::setView()
3363         https://bugs.webkit.org/show_bug.cgi?id=169189
3364
3365         Reviewed by Ryosuke Niwa.
3366
3367         Replace debug assertion with release one in Frame::setView() to make make sure the
3368         document does not have a living render tree. This will help identify possible
3369         remaining cases where this can happen.
3370
3371         * dom/Document.cpp:
3372         (WebCore::Document::didBecomeCurrentDocumentInView): Deleted.
3373         * dom/Document.h:
3374         * page/Frame.cpp:
3375