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