6b4bdf9625cbcccf83950d29b806420f37f8022c
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-03-16  Jiewen Tan  <jiewen_tan@apple.com>
2
3         [WebCrypto] Support SPKI/PKCS8 for Elliptic Curve
4         https://bugs.webkit.org/show_bug.cgi?id=169318
5         <rdar://problem/31081956>
6
7         Reviewed by Brent Fulgham.
8
9         This patch adds SPKI/PKCS8 support for Elliptic Curve cryptos. We can now import/export
10         SPKI/PKCS8 Elliptic Curve keys after this change. Few things to note: 1) This patch
11         implements a loose DER encoder/decoder for hacking the underlying CommonCrypto library.
12         2) It only permits id-ecPublicKey as the AlgorithmIdentifier following OpenSSL/Chrome(BoringSSL).
13         3) It follows OpenSSL/Chrome(BoringSSL) to replace ECParameters in ECPrivateKey with custom
14         tags. Hence, we should fully comply with OpenSSL/Chrome(BoringSSL).
15
16         Tests: crypto/subtle/ec-import-jwk-key-export-pkcs8-key.html
17                crypto/subtle/ec-import-jwk-key-export-spki-key.html
18                crypto/subtle/ec-import-pkcs8-key-export-jwk-key.html
19                crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p256.html
20                crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p384.html
21                crypto/subtle/ec-import-raw-key-export-spki-key.html
22                crypto/subtle/ec-import-spki-key-export-jwk-key.html
23                crypto/subtle/ec-import-spki-key-export-raw-key.html
24                crypto/subtle/ec-import-spki-key-export-spki-key-p256.html
25                crypto/subtle/ec-import-spki-key-export-spki-key-p384.html
26                crypto/subtle/ecdh-generate-export-key-spki-p256.html
27                crypto/subtle/ecdh-generate-export-key-spki-p384.html
28                crypto/subtle/ecdh-generate-export-pkcs8-p256.html
29                crypto/subtle/ecdh-generate-export-pkcs8-p384.html
30                crypto/subtle/ecdh-import-pkcs8-key-p256.html
31                crypto/subtle/ecdh-import-pkcs8-key-p384.html
32                crypto/subtle/ecdh-import-spki-key-p256.html
33                crypto/subtle/ecdh-import-spki-key-p384.html
34                crypto/workers/subtle/ec-generate-export-pkcs8-key.html
35                crypto/workers/subtle/ec-generate-export-spki-key.html
36                crypto/workers/subtle/ec-import-pkcs8-key.html
37                crypto/workers/subtle/ec-import-spki-key.html
38
39         * WebCore.xcodeproj/project.pbxproj:
40         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
41         (WebCore::CryptoAlgorithmECDH::importKey):
42         (WebCore::CryptoAlgorithmECDH::exportKey):
43         * crypto/gnutls/CryptoKeyECGnuTLS.cpp:
44         (WebCore::CryptoKeyEC::platformExportRaw):
45         (WebCore::CryptoKeyEC::platformImportSpki):
46         (WebCore::CryptoKeyEC::platformExportSpki):
47         (WebCore::CryptoKeyEC::platformImportPkcs8):
48         (WebCore::CryptoKeyEC::platformExportPkcs8):
49         (WebCore::CryptoKeyEC::exportRaw): Deleted.
50         * crypto/keys/CryptoKeyEC.cpp:
51         (WebCore::CryptoKeyEC::importSpki):
52         (WebCore::CryptoKeyEC::importPkcs8):
53         (WebCore::CryptoKeyEC::exportRaw):
54         (WebCore::CryptoKeyEC::exportSpki):
55         (WebCore::CryptoKeyEC::exportPkcs8):
56         * crypto/keys/CryptoKeyEC.h:
57         * crypto/mac/CommonCryptoDERUtilities.h: Added.
58         (WebCore::bytesUsedToEncodedLength):
59         (WebCore::extraBytesNeededForEncodedLength):
60         (WebCore::addEncodedASN1Length):
61         (WebCore::bytesNeededForEncodedLength):
62         * crypto/mac/CryptoKeyECMac.cpp:
63         (WebCore::compareBytes):
64         (WebCore::CryptoKeyEC::platformExportRaw):
65         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
66         (WebCore::getOID):
67         (WebCore::CryptoKeyEC::platformImportSpki):
68         (WebCore::CryptoKeyEC::platformExportSpki):
69         (WebCore::CryptoKeyEC::platformImportPkcs8):
70         (WebCore::CryptoKeyEC::platformExportPkcs8):
71         (WebCore::CryptoKeyEC::exportRaw): Deleted.
72         Enlarge the robust of exportRaw.
73         * crypto/mac/CryptoKeyRSAMac.cpp:
74         (WebCore::CryptoKeyRSA::exportSpki):
75         (WebCore::CryptoKeyRSA::exportPkcs8):
76         Enhance the implementation.
77         (WebCore::bytesUsedToEncodedLength): Deleted.
78         (WebCore::bytesNeededForEncodedLength): Deleted.
79         (WebCore::addEncodedASN1Length): Deleted.
80         Moved to CommonCryptoDERUtilities.h.
81
82 2017-03-16  Alex Christensen  <achristensen@webkit.org>
83
84         Don't use an optional for didReceiveSocketStreamData's length
85         https://bugs.webkit.org/show_bug.cgi?id=169699
86
87         Reviewed by Brady Eidson.
88
89         Rather than sending a message with an optional length, send a message with a length
90         and send a different message if the receiving of bytes failed.
91
92         No new tests (no behavior change).
93
94         * Modules/websockets/WebSocketChannel.cpp:
95         (WebCore::WebSocketChannel::didReceiveSocketStreamData):
96         * Modules/websockets/WebSocketChannel.h:
97         * platform/network/SocketStreamHandleClient.h:
98         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
99         (WebCore::SocketStreamHandleImpl::readStreamCallback):
100         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
101         (WebCore::SocketStreamHandleImpl::readBytes):
102
103 2017-03-16  Zalan Bujtas  <zalan@apple.com>
104
105         Simple line layout: Extend webkit-hyphenate-limit-lines to cover subsequent words.
106         https://bugs.webkit.org/show_bug.cgi?id=169631
107
108         Reviewed by Antti Koivisto.
109
110         This patch extends webkit-hyphenate-limit-lines to cover separate words across multiple lines.
111         Example:
112           webkit-hyphenate-limit-lines: 1;
113           "if this line wraps at foo-
114           bar, the next line should
115           not hyphenate at all. How-
116           ever the line after that
117           could."
118
119         Test: fast/text/simple-line-layout-hyphenation-limit-lines-accross-words.html
120
121         * rendering/SimpleLineLayout.cpp:
122         (WebCore::SimpleLineLayout::LineState::setHyphenationDisabled):
123         (WebCore::SimpleLineLayout::LineState::isHyphenationDisabled):
124         (WebCore::SimpleLineLayout::updateLineConstrains):
125         (WebCore::SimpleLineLayout::hyphenPositionForFragment):
126         (WebCore::SimpleLineLayout::splitFragmentToFitLine):
127         (WebCore::SimpleLineLayout::createLineRuns):
128         (WebCore::SimpleLineLayout::createTextRuns):
129         * rendering/SimpleLineLayoutTextFragmentIterator.h:
130         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::hasHyphen):
131         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::splitWithHyphen):
132         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::wrappingWithHyphenCounter): Deleted.
133
134 2017-03-16  Zan Dobersek  <zdobersek@igalia.com>
135
136         [GLib] Add SSLKeyGeneratorGLib.cpp
137         https://bugs.webkit.org/show_bug.cgi?id=169740
138
139         Reviewed by Sergio Villar Senin.
140
141         Move the getSupportedKeySizes() and signedPublicKeyAndChallengeString()
142         functions from TemporaryLinkStubs.cpp to SSLKeyGeneratorGLib.cpp. The
143         userIdleTime() function can be removed in this process since it's not
144         used anywhere anymore.
145
146         * PlatformGTK.cmake:
147         * platform/glib/SSLKeyGeneratorGLib.cpp: Renamed from Source/WebCore/platform/gtk/TemporaryLinkStubs.cpp.
148         (WebCore::getSupportedKeySizes):
149         (WebCore::signedPublicKeyAndChallengeString):
150
151 2017-03-16  Zalan Bujtas  <zalan@apple.com>
152
153         Stay inside the continuation while searching for a candidate ancestor for insertion.
154         https://bugs.webkit.org/show_bug.cgi?id=169768
155         <rdar://problem/30959936>
156
157         Reviewed by David Hyatt.
158
159         Test: fast/inline/continuation-crash-with-anon-ancestors.html
160
161         * rendering/RenderInline.cpp:
162         (WebCore::RenderInline::addChildToContinuation):
163
164 2017-03-16  Jon Lee  <jonlee@apple.com>
165
166         Add FIXMEs to update WebRTC
167         https://bugs.webkit.org/show_bug.cgi?id=169735
168
169         Reviewed by Youenn Fablet.
170
171         Rearrange order of methods and properties based on the 13 March 2017
172         version of the WebRTC spec.
173
174         * CMakeLists.txt: Add RTCIceTransport and RTCIceTransportState.
175         * DerivedSources.make:
176         * Modules/mediastream/RTCDTMFSender.idl:
177         * Modules/mediastream/RTCDTMFToneChangeEvent.idl:
178         * Modules/mediastream/RTCDataChannelEvent.idl:
179         * Modules/mediastream/RTCIceCandidate.idl:
180         * Modules/mediastream/RTCIceCandidateEvent.idl:
181         * Modules/mediastream/RTCIceServer.idl:
182         * Modules/mediastream/RTCIceTransport.cpp: Added.
183         * Modules/mediastream/RTCIceTransport.idl: Added.
184         * Modules/mediastream/RTCIceTransport.h: Minor update to rename state to transportState.
185         (WebCore::RTCIceTransport::state):
186         (WebCore::RTCIceTransport::setState):
187         (WebCore::RTCIceTransport::transportState): Deleted.
188         (WebCore::RTCIceTransport::setTransportState): Deleted.
189         * Modules/mediastream/RTCIceTransportState.h: Added.
190         * Modules/mediastream/RTCIceTransportState.idl: Added.
191         * Modules/mediastream/RTCPeerConnection.h:
192         * Modules/mediastream/RTCPeerConnection.idl:
193         * Modules/mediastream/RTCRtpReceiver.idl:
194         * Modules/mediastream/RTCRtpSender.idl:
195         * Modules/mediastream/RTCRtpTransceiver.idl:
196         * Modules/mediastream/RTCStatsReport.idl:
197         * WebCore.xcodeproj/project.pbxproj:
198         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
199         (WebCore::MediaEndpointPeerConnection::iceTransportStateChanged): Refactor.
200
201 2017-03-16  Youenn Fablet  <youenn@apple.com>
202
203         Improve WebRTC track enabled support
204         https://bugs.webkit.org/show_bug.cgi?id=169727
205
206         Reviewed by Alex Christensen.
207
208         Tests: webrtc/peer-connection-audio-mute2.html
209                webrtc/peer-connection-remote-audio-mute.html
210                webrtc/video-remote-mute.html
211
212         Making sure muted/disabled sources produce silence/black frames.
213         For outgoing audio/video sources, this should be done by the actual a/v providers.
214         We keep this filtering here until we are sure they implement that.
215
216         * platform/audio/mac/AudioSampleDataSource.mm:
217         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks): Ensuring disabled audio tracks send silence.
218         Used for outgoing webrtc tracks.
219         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
220         (WebCore::MockRealtimeAudioSourceMac::render): Ditto.
221         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
222         (WebCore::RealtimeIncomingAudioSource::OnData): Ditto.
223         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
224         (WebCore::RealtimeIncomingVideoSource::pixelBufferFromVideoFrame): Generating black frames if muted.
225         (WebCore::RealtimeIncomingVideoSource::OnFrame):
226         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
227         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
228         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable): Ensuring we quit after sending black frame.
229
230 2017-03-16  Youenn Fablet  <youenn@apple.com>
231
232         LibWebRTC outgoing source should be thread safe refcounted
233         https://bugs.webkit.org/show_bug.cgi?id=169726
234
235         Reviewed by Alex Christensen.
236
237         Preventive fix.
238         Also fixing the size of the buffer for the audio source as its reserved size is byte count.
239
240         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
241         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
242
243 2017-03-16  Youenn Fablet  <youenn@apple.com>
244
245         MediaStreamTrack remote() no longer exists
246         https://bugs.webkit.org/show_bug.cgi?id=169734
247
248         Reviewed by Alex Christensen.
249
250         Removing MediaStreamTrack remote.
251         Removing RealtimeMediaSource::remote as isCaptureSource which is closer to its use in MediaStreamPrivate to
252         detect whether sources are capture sources or not.
253
254         * Modules/mediastream/MediaStream.cpp:
255         (WebCore::MediaStream::mediaState):
256         * platform/mediastream/MediaStreamPrivate.cpp:
257         (WebCore::MediaStreamPrivate::hasCaptureVideoSource):
258         (WebCore::MediaStreamPrivate::hasCaptureAudioSource):
259         (WebCore::MediaStreamPrivate::hasLocalVideoSource): Deleted.
260         (WebCore::MediaStreamPrivate::hasLocalAudioSource): Deleted.
261         * platform/mediastream/MediaStreamPrivate.h:
262         * Modules/mediastream/MediaStreamTrack.cpp:
263         (WebCore::MediaStreamTrack::stopProducingData):
264         (WebCore::MediaStreamTrack::remote): Deleted.
265         * Modules/mediastream/MediaStreamTrack.h:
266         * Modules/mediastream/MediaStreamTrack.idl:
267         * Modules/webaudio/MediaStreamAudioSource.h:
268         * platform/mediastream/MediaStreamPrivate.cpp:
269         (WebCore::MediaStreamPrivate::hasLocalVideoSource):
270         (WebCore::MediaStreamPrivate::hasLocalAudioSource):
271         * platform/mediastream/MediaStreamTrackPrivate.cpp:
272         (WebCore::MediaStreamTrackPrivate::isCaptureTrack):
273         (WebCore::MediaStreamTrackPrivate::remote): Deleted.
274         * platform/mediastream/MediaStreamTrackPrivate.h:
275         * platform/mediastream/RealtimeMediaSource.cpp:
276         (WebCore::RealtimeMediaSource::reset):
277         * platform/mediastream/RealtimeMediaSource.h:
278         (WebCore::RealtimeMediaSource::isCaptureSource):
279         (WebCore::RealtimeMediaSource::remote): Deleted.
280         (WebCore::RealtimeMediaSource::setRemote): Deleted.
281         * platform/mediastream/mac/AVMediaCaptureSource.h:
282         * platform/mock/MockRealtimeAudioSource.h:
283         * platform/mock/MockRealtimeVideoSource.h:
284
285 2017-03-16  Manuel Rego Casasnovas  <rego@igalia.com>
286
287         [css-grid] Crash on debug removing a positioned child
288         https://bugs.webkit.org/show_bug.cgi?id=169739
289
290         Reviewed by Sergio Villar Senin.
291
292         When we add or remove a positioned item we don't need to mark
293         the grid as dirty, because positioned items do not affect the layout
294         of the grid at all.
295
296         This was causing a crash when a positioned item was removed
297         after a layout. As after the positioned item was removed,
298         the method RenderGrid::layoutBlock() was not called,
299         so when the grid was repainted we got a crash.
300
301         Test: fast/css-grid-layout/grid-crash-remove-positioned-item.html
302
303         * rendering/RenderGrid.cpp:
304         (WebCore::RenderGrid::addChild): Add early return to avoid marking
305         the grid as dirty for positioned grid items.
306         (WebCore::RenderGrid::removeChild): Ditto.
307
308 2017-03-16  Carlos Alberto Lopez Perez  <clopez@igalia.com>
309
310         [WebRTC] SDP sess-id in the "o=" line should be a value between 0 and LLONG_MAX.
311         https://bugs.webkit.org/show_bug.cgi?id=169681
312
313         Reviewed by Alejandro G. Castro.
314
315         Use an int64_t type for storing sess-id and ensure that the value generated is always between 0 and LLONG_MAX (2^63-1).
316         To the JS world (sdp.js) we pass and read this value as a string type.
317
318         The JS world (sdp.js) was already using a string type for sess-id.
319         This caused a bug when reading the sess-id value at configurationFromJSON(): no value was obtained because a numeric type was expected.
320
321         So, after this patch, sess-id is passed and read as a string from sdp.js, and converted to an int64_t type for internal use.
322         This way we also avoid a rounding problem that happens with values near LLONG_MAX when converting from int64_t to double when passed to the JS world,
323         and that could cause that we end passing a number bigger than LLONG_MAX to sdp.js.
324
325         * Modules/mediastream/SDPProcessor.cpp:
326         (WebCore::configurationFromJSON):
327         (WebCore::configurationToJSON):
328         * platform/mediastream/MediaEndpointSessionConfiguration.h:
329         (WebCore::MediaEndpointSessionConfiguration::sessionId):
330         (WebCore::MediaEndpointSessionConfiguration::setSessionId):
331         (WebCore::MediaEndpointSessionConfiguration::MediaEndpointSessionConfiguration):
332
333 2017-03-15  Jon Lee  <jonlee@apple.com>
334
335         Flatten RTC enum naming
336         https://bugs.webkit.org/show_bug.cgi?id=169664
337
338         Reviewed by Youenn Fablet.
339
340         Use consistent names of RTC enums throughout WebCore. This means surfacing
341         ICE enums out of PeerConnectionState. Keep the old names around for other
342         ports.
343
344         Add RTCIceConnectionState, RTCIceGatheringState, and RTCSignalingState enums.
345         * CMakeLists.txt:
346         * DerivedSources.make:
347         * Modules/mediastream/RTCIceConnectionState.h: Added. The enum is defined in
348         PeerConnectionStates.h, so just include that file.
349         * Modules/mediastream/RTCIceConnectionState.idl: Added.
350         * Modules/mediastream/RTCIceGatheringState.h: Added.
351         * Modules/mediastream/RTCIceGatheringState.idl: Added.
352         * Modules/mediastream/RTCSignalingState.h: Added.
353         * Modules/mediastream/RTCSignalingState.idl: Added.
354         * WebCore.xcodeproj/project.pbxproj:
355
356         * platform/mediastream/PeerConnectionStates.h: Move the existing enums into
357         WebCore, but keep aliases to the old names within the PeerConnectionStates
358         namespace.
359
360         Refactor to use the new enum names.
361         * Modules/mediastream/MediaEndpointPeerConnection.cpp: Refactor.
362         * Modules/mediastream/MediaEndpointPeerConnection.h:
363         * Modules/mediastream/PeerConnectionBackend.cpp:
364         * Modules/mediastream/PeerConnectionBackend.h:
365         * Modules/mediastream/RTCConfiguration.h:
366         * Modules/mediastream/RTCConfiguration.idl: Add FIXMEs for bringing this up
367         to spec.
368         * Modules/mediastream/RTCIceTransport.h:
369         * Modules/mediastream/RTCPeerConnection.cpp: Refactor the three functions
370         below to using the enum instead of returning strings. This allows remove of
371         the internal* versions of these functions.
372         (WebCore::RTCPeerConnection::signalingState): Deleted.
373         (WebCore::RTCPeerConnection::iceGatheringState): Deleted.
374         (WebCore::RTCPeerConnection::iceConnectionState): Deleted.
375         * Modules/mediastream/RTCPeerConnection.h: Replace internalSignalingState,
376         internalIceGatheringState, and internalIceConnectionState.
377         * Modules/mediastream/RTCPeerConnection.idl:
378         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
379         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
380         * platform/mediastream/MediaEndpoint.h:
381         * platform/mediastream/MediaEndpointConfiguration.cpp:
382         * platform/mediastream/MediaEndpointConfiguration.h:
383         * platform/mock/MockMediaEndpoint.cpp:
384         * platform/mock/MockMediaEndpoint.h:
385         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
386         (WebCore::MediaEndpointOwr::processIceTransportStateChange):
387
388 2017-03-15  Jer Noble  <jer.noble@apple.com>
389
390         Optionally capture audio in the UIProcess
391         https://bugs.webkit.org/show_bug.cgi?id=169609
392
393         Reviewed by Alex Christensen.
394
395         Export some previously un-exported symbols from WebCore for use in WebKit2.
396
397         * WebCore.xcodeproj/project.pbxproj:
398         * platform/audio/WebAudioBufferList.h:
399         * platform/mediastream/RealtimeMediaSource.h:
400
401 2017-03-15  Zalan Bujtas  <zalan@apple.com>
402
403         Do not reparent floating object until after intruding/overhanging dependency is cleared.
404         https://bugs.webkit.org/show_bug.cgi?id=169711
405         <rdar://problem/30959743>
406
407         Reviewed by Simon Fraser.
408
409         This patch ensures that we cleanup the m_floatingObjects for siblings before reparenting the fresh float.  
410
411         Test: fast/block/float/inline-becomes-float-and-moves-around.html
412
413         * rendering/RenderBlockFlow.cpp:
414         (WebCore::RenderBlockFlow::styleDidChange):
415         * rendering/RenderElement.cpp:
416         (WebCore::RenderElement::styleDidChange):
417         * rendering/RenderElement.h:
418         (WebCore::RenderElement::noLongerAffectsParentBlock):
419
420 2017-03-15  Dean Jackson  <dino@apple.com>
421
422         Make a base class for WebGL and WebGPU contexts
423         https://bugs.webkit.org/show_bug.cgi?id=169651
424         <rdar://problem/31053489>
425
426         Reviewed by Simon Fraser.
427
428         Add a new pure virtual base class, GPUBasedCanvasRenderingContext, that
429         will be used by WebGL and WebGPU rendering contexts. This allows us
430         to avoid some code duplication, since many places treat the two
431         as the same.
432
433         Also rename is3d() -> isWebGL() and isGPU() -> isWebGPU().
434
435         * WebCore.xcodeproj/project.pbxproj: New file.
436         * html/HTMLCanvasElement.cpp:
437         (WebCore::HTMLCanvasElement::getContextWebGL):
438         (WebCore::HTMLCanvasElement::getContextWebGPU):
439         (WebCore::HTMLCanvasElement::reset):
440         (WebCore::HTMLCanvasElement::paint):
441         (WebCore::HTMLCanvasElement::isGPUBased):
442         (WebCore::HTMLCanvasElement::getImageData):
443         (WebCore::HTMLCanvasElement::isGPU): Deleted.
444         (WebCore::HTMLCanvasElement::is3D): Deleted.
445         * html/HTMLCanvasElement.h:
446         * html/canvas/CanvasRenderingContext.h:
447         (WebCore::CanvasRenderingContext::isWebGL):
448         (WebCore::CanvasRenderingContext::isWebGPU):
449         (WebCore::CanvasRenderingContext::isGPUBased):
450         (WebCore::CanvasRenderingContext::is3d): Deleted.
451         (WebCore::CanvasRenderingContext::isGPU): Deleted.
452         * html/canvas/GPUBasedCanvasRenderingContext.h: Added.
453         (WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):
454         * html/canvas/WebGLRenderingContextBase.cpp:
455         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
456         * html/canvas/WebGLRenderingContextBase.h:
457         * html/canvas/WebGPURenderingContext.cpp:
458         (WebCore::WebGPURenderingContext::WebGPURenderingContext):
459         * html/canvas/WebGPURenderingContext.h:
460         * rendering/RenderLayerBacking.cpp:
461         (WebCore::canvasCompositingStrategy):
462
463 2017-03-15  Daniel Bates  <dabates@apple.com>
464
465         Iteratively dispatch DOM events after restoring a cached page
466         https://bugs.webkit.org/show_bug.cgi?id=169703
467         <rdar://problem/31075903>
468
469         Reviewed by Brady Eidson.
470
471         Make dispatching of DOM events when restoring a page from the page cache symmetric with
472         dispatching of events when saving a page to the page cache.
473
474         * history/CachedFrame.cpp:
475         (WebCore::CachedFrameBase::restore): Move code to dispatch events from here to FrameLoader::didRestoreFromCachedPage().
476         * loader/FrameLoader.cpp:
477         (WebCore::FrameLoader::commitProvisionalLoad): Ensure that no DOM events are dispatched during
478         restoration of a cached page. Call didRestoreFromCachedPage() after restoring the page to
479         dispatch DOM events on the restored frames.
480         (WebCore::FrameLoader::willRestoreFromCachedPage): Renamed; formerly named prepareForCachedPageRestore().
481         (WebCore::FrameLoader::didRestoreFromCachedPage): Added.
482         (WebCore::FrameLoader::prepareForCachedPageRestore): Renamed to willRestoreFromCachedPage().
483         * loader/FrameLoader.h:
484         * page/FrameTree.cpp:
485         (WebCore::FrameTree::traverseNextInPostOrderWithWrap): Returns the next Frame* in a post-order
486         traversal of the frame tree optionally wrapping around to the deepest first child in the tree.
487         (WebCore::FrameTree::deepFirstChild): Added.
488         * page/FrameTree.h:
489
490 2017-03-15  Dave Hyatt  <hyatt@apple.com>
491
492         Positioned SVG not sized correctly
493         https://bugs.webkit.org/show_bug.cgi?id=169693
494         <rdar://problem/30996893>
495
496         Reviewed by Zalan Bujtas.
497
498         Test: svg/in-html/rect-positioned.html
499
500         Change computeReplacedLogicalHeight to take an estimatedUsedWidth. This
501         value is used instead of the available logical width to resolve replaced
502         elements without intrinsic sizes but with aspect ratios set.
503
504         * rendering/RenderBox.cpp:
505         (WebCore::RenderBox::computeReplacedLogicalHeight):
506         * rendering/RenderBox.h:
507         * rendering/RenderReplaced.cpp:
508         (WebCore::RenderReplaced::computeConstrainedLogicalWidth):
509         (WebCore::RenderReplaced::computeReplacedLogicalWidth):
510         (WebCore::RenderReplaced::computeReplacedLogicalHeight):
511         * rendering/RenderReplaced.h:
512         * rendering/RenderVideo.cpp:
513         (WebCore::RenderVideo::computeReplacedLogicalHeight): Deleted.
514         * rendering/RenderVideo.h:
515         * rendering/svg/RenderSVGRoot.cpp:
516         (WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
517         (WebCore::RenderSVGRoot::computeReplacedLogicalHeight):
518         * rendering/svg/RenderSVGRoot.h:
519
520 2017-03-15  Antoine Quint  <graouts@apple.com>
521
522         [Modern Media Controls] Using the arrow keys to navigate in the tracks menu also scrolls the page
523         https://bugs.webkit.org/show_bug.cgi?id=169671
524         <rdar://problem/31060091>
525
526         Reviewed by Eric Carlson.
527
528         We need to call preventDefault() when handling a "keydown" event that we recognize.
529
530         Test: media/modern-media-controls/tracks-panel/tracks-panel-prevent-default-on-keydown.html
531
532         * Modules/modern-media-controls/controls/tracks-panel.js:
533         (TracksPanel.prototype._handleKeydown):
534
535 2017-03-15  Antoine Quint  <graouts@apple.com>
536
537         [Modern Media Controls] Tracks menu overlaps controls bar in fullscreen
538         https://bugs.webkit.org/show_bug.cgi?id=169670
539         <rdar://problem/31060086>
540         
541         Reviewed by Eric Carlson.
542
543         It used to be that the top of the tracks button was the same as the top of the controls
544         bar, but that changed when we fixed https://bugs.webkit.org/show_bug.cgi?id=169412. We
545         now use the top of the controls bar to computed the y-position for the tracks panel.
546
547         We are not adding a new test, instead we're unflaking a test that started failing
548         reliably once we fixed https://bugs.webkit.org/show_bug.cgi?id=169412.
549
550         * Modules/modern-media-controls/controls/macos-media-controls.js:
551         (MacOSMediaControls.prototype.showTracksPanel):
552
553 2017-03-14  Jon Lee  <jonlee@apple.com>
554
555         Clean up RTCPeerConnection IDL
556         https://bugs.webkit.org/show_bug.cgi?id=169660
557
558         Reviewed by Youenn Fablet.
559
560         * Modules/mediastream/RTCPeerConnection.cpp:
561         (WebCore::RTCPeerConnection::addTransceiver): Refactor to use RTCRtpTransceiverInit.
562         (WebCore::RTCPeerConnection::completeAddTransceiver):
563         * Modules/mediastream/RTCPeerConnection.h: Remove redundant definitions.
564         * Modules/mediastream/RTCPeerConnection.idl: Using 13 March 2017 Editor's Draft of
565         WebRTC spec. Move RTCOfferAnswerOptions out to separate IDLs. Keep RTCDataChannelInit and
566         RTCRtpTransceiverInit since they appear to be used only in RTCPeerConnection.
567             Reorder the properties, functions, and events based on their appearance in the spec.
568         Legacy MediaStream calls are placed at the end. I tried to use "partial interface" in the
569         same file, but in the end nothing was generated, so everything is contained in one interface
570         block.
571
572         * Modules/mediastream/RTCEnums.h: Added. This will be an all-in-one header to hold the
573         enums.
574
575         Move RTCAnswerOptions, RTCOfferAnswerOptions, RTCOfferOptions, RTCRtpTransceiverDirection
576         out to their own IDL's.
577         * CMakeLists.txt:
578         * DerivedSources.make:
579         * Modules/mediastream/RTCAnswerOptions.h: Added.
580         * Modules/mediastream/RTCAnswerOptions.idl: Added.
581         * Modules/mediastream/RTCOfferAnswerOptions.h:
582         * Modules/mediastream/RTCOfferAnswerOptions.idl: Added.
583         * Modules/mediastream/RTCOfferOptions.h: Added. Remove |offerToReceiveVideo| and
584         |offerToReceiveAudio|, which are not used.
585         * Modules/mediastream/RTCOfferOptions.idl: Added.
586         * Modules/mediastream/RTCRtpTransceiverDirection.h: Added.
587         * Modules/mediastream/RTCRtpTransceiverDirection.idl: Added. Use a typedef for
588         RTCRtpTransceiverDirection to prevent the code generator from prefixing RTCRtpTransceiver.
589         * Modules/mediastream/RTCRtpTransceiver.idl: Move RTCRtpTransceiverDirection.
590         * WebCore.xcodeproj/project.pbxproj: Add IDLs and derived sources. Remove unused
591         HTMLMediaElementMediaStream.h. Reorder.
592
593         Refactor.
594         * Modules/mediastream/RTCRtpTransceiver.h: Use RTCRtpTransceiverDirection.
595         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
596
597 2017-03-15  Zan Dobersek  <zdobersek@igalia.com>
598
599         [GTK] Initialize m_button, m_clickCount members in PlatformMouseEvent constructors
600         https://bugs.webkit.org/show_bug.cgi?id=169666
601
602         Reviewed by Michael Catanzaro.
603
604         Initialize the m_button and m_clickCount class members in the GTK+-specific
605         implementation of PlatformMouseEvent constructors to NoButton and 0,
606         respectively. The constructors expect to operate on passed-in GTK+ events
607         that will be able to initialize those two members to some valid values, but
608         this is not guaranteed.
609
610         * platform/gtk/PlatformMouseEventGtk.cpp:
611         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
612
613 2017-03-15  Zan Dobersek  <zdobersek@igalia.com>
614
615         [TexMap] Add missing class member initializations
616         https://bugs.webkit.org/show_bug.cgi?id=169665
617
618         Reviewed by Michael Catanzaro.
619
620         Zero-initialize the members in various TextureMapper classes
621         that are missing the proper initialization, as reported by
622         the Coverity tool.
623
624         * platform/graphics/texmap/BitmapTexturePool.h:
625         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
626         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
627         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
628         * platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h:
629
630 2017-03-15  Alex Christensen  <achristensen@webkit.org>
631
632         Compiled content extensions should include the JSON source
633         https://bugs.webkit.org/show_bug.cgi?id=169643
634
635         Reviewed by Geoffrey Garen.
636
637         Serializing the JSON string from which a content extension was compiled
638         to disk with the compiled content extension will allow us to validate content
639         extensions and automatically migrate older content extensions to new versions.
640         It less than doubles the size of the compiled content extension on disk, and when
641         interpreting the bytecode that memory is never read, so it doesn't increase our
642         dirty memory usage.
643
644         Covered by new API tests.
645
646         * contentextensions/ContentExtensionCompiler.cpp:
647         (WebCore::ContentExtensions::compileRuleList):
648         * contentextensions/ContentExtensionCompiler.h:
649
650 2017-03-15  Antoine Quint  <graouts@apple.com>
651
652         [Modern Media Controls] Captions do not default to Auto when language is changed
653         https://bugs.webkit.org/show_bug.cgi?id=169675
654         <rdar://problem/30423369>
655
656         Reviewed by Eric Carlson.
657
658         Ensure we correctly mark the Off and Auto items as selected when we are using the
659         Off and Auto tracks.
660
661         Tests: media/modern-media-controls/tracks-support/tracks-support-auto-text-track.html
662                media/modern-media-controls/tracks-support/tracks-support-off-text-track.html
663
664         * Modules/modern-media-controls/media/tracks-support.js:
665         (TracksSupport.prototype.tracksPanelIsTrackInSectionSelected):
666         (TracksSupport.prototype.tracksPanelSelectionDidChange):
667
668 2017-03-15  Ryan Haddad  <ryanhaddad@apple.com>
669
670         Unreviewed, rolling out r213977.
671
672         This change broke the Windows build.
673
674         Reverted changeset:
675
676         "Make a base class for WebGL and WebGPU contexts"
677         https://bugs.webkit.org/show_bug.cgi?id=169651
678         http://trac.webkit.org/changeset/213977
679
680 2017-03-15  Youenn Fablet  <youenn@apple.com>
681
682         run-webkit-tests is always creating mock libwebrtc tracks
683         https://bugs.webkit.org/show_bug.cgi?id=169658
684
685         Reviewed by Alex Christensen.
686
687         Tests: webrtc/peer-connection-audio-mute.html
688                webrtc/video-mute.html
689
690         Creating real libwebrtc av tracks in case of RealTwoPeerConnections mock factory.
691
692         * testing/MockLibWebRTCPeerConnection.cpp:
693         (WebCore::MockLibWebRTCPeerConnectionFactory::CreateVideoTrack):
694         (WebCore::MockLibWebRTCPeerConnectionFactory::CreateAudioTrack):
695         * testing/MockLibWebRTCPeerConnection.h:
696
697 2017-03-15  Youenn Fablet  <youenn@apple.com>
698
699         Preventive clean-up: ensure RTCPeerConnection stays valid when calling postTask
700         https://bugs.webkit.org/show_bug.cgi?id=169661
701
702         Reviewed by Alex Christensen.
703
704         Protecting the RTCPeerConnection object when calling postTask since it might get collected between the task post
705         and task run. Also do not send negotiationNeeded event if RTCPeerConnection is closed (covered by added test).
706
707         * Modules/mediastream/RTCPeerConnection.cpp:
708         (WebCore::RTCPeerConnection::updateIceGatheringState):
709         (WebCore::RTCPeerConnection::updateIceConnectionState):
710         (WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent):
711
712 2017-03-15  Antoine Quint  <graouts@apple.com>
713
714         [Modern Media Controls] Always use six digits to display time when overall media duration is an hour or more
715         https://bugs.webkit.org/show_bug.cgi?id=169668
716         <rdar://problem/31059699>
717
718         Reviewed by Dean Jackson.
719
720         Always use six digits to display times when the overall media duration is an hour or more. This
721         ensures that we don't display too much white space around labels when we know we will eventually
722         need six digits to display the full time, but the current time to display is under an hour.
723
724         Test: media/modern-media-controls/time-control/time-control-use-six-digits-for-time-labels.html
725
726         * Modules/modern-media-controls/controls/time-control.js:
727         (TimeControl.prototype.get useSixDigitsForTimeLabels):
728         (TimeControl.prototype.set useSixDigitsForTimeLabels):
729         (TimeControl.prototype.set width):
730         (TimeControl.prototype.get isSufficientlyWide):
731         (TimeControl.prototype._availableWidthHasChanged):
732         (TimeControl.prototype.get labelsMayDisplayTimesOverAnHour): Deleted.
733         (TimeControl.prototype.set labelsMayDisplayTimesOverAnHour): Deleted.
734         * Modules/modern-media-controls/controls/time-label.js:
735         (TimeLabel.prototype._formattedTime):
736         * Modules/modern-media-controls/media/time-labels-support.js:
737         (TimeLabelsSupport.prototype.syncControl):
738         (TimeLabelsSupport):
739
740 2017-03-15  Dean Jackson  <dino@apple.com>
741
742         Sort Xcode project files
743         https://bugs.webkit.org/show_bug.cgi?id=169669
744
745         Reviewed by Antoine Quint.
746
747         * WebCore.xcodeproj/project.pbxproj:
748
749 2017-03-14  Dean Jackson  <dino@apple.com>
750
751         Make a base class for WebGL and WebGPU contexts
752         https://bugs.webkit.org/show_bug.cgi?id=169651
753         <rdar://problem/31053489>
754
755         Reviewed by Simon Fraser.
756
757         Add a new pure virtual base class, GPUBasedCanvasRenderingContext, that
758         will be used by WebGL and WebGPU rendering contexts. This allows us
759         to avoid some code duplication, since many places treat the two
760         as the same.
761
762         Also rename is3d() -> isWebGL() and isGPU() -> isWebGPU().
763
764         * WebCore.xcodeproj/project.pbxproj: New file.
765         * html/HTMLCanvasElement.cpp:
766         (WebCore::HTMLCanvasElement::getContextWebGL):
767         (WebCore::HTMLCanvasElement::getContextWebGPU):
768         (WebCore::HTMLCanvasElement::reset):
769         (WebCore::HTMLCanvasElement::paint):
770         (WebCore::HTMLCanvasElement::isGPUBased):
771         (WebCore::HTMLCanvasElement::getImageData):
772         (WebCore::HTMLCanvasElement::isGPU): Deleted.
773         (WebCore::HTMLCanvasElement::is3D): Deleted.
774         * html/HTMLCanvasElement.h:
775         * html/canvas/CanvasRenderingContext.h:
776         (WebCore::CanvasRenderingContext::isWebGL):
777         (WebCore::CanvasRenderingContext::isWebGPU):
778         (WebCore::CanvasRenderingContext::isGPUBased):
779         (WebCore::CanvasRenderingContext::is3d): Deleted.
780         (WebCore::CanvasRenderingContext::isGPU): Deleted.
781         * html/canvas/GPUBasedCanvasRenderingContext.h: Added.
782         (WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):
783         * html/canvas/WebGLRenderingContextBase.cpp:
784         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
785         * html/canvas/WebGLRenderingContextBase.h:
786         * html/canvas/WebGPURenderingContext.cpp:
787         (WebCore::WebGPURenderingContext::WebGPURenderingContext):
788         * html/canvas/WebGPURenderingContext.h:
789         * rendering/RenderLayerBacking.cpp:
790         (WebCore::canvasCompositingStrategy):
791
792 2017-03-15  Zan Dobersek  <zdobersek@igalia.com>
793
794         Unreviewed GTK+ build fix. Sprinkle ENABLE(MEDIA_STREAM) build guards
795         in the Internals class to avoid compilation failures when building
796         with this feature disabled.
797
798         * testing/Internals.cpp:
799         (WebCore::Internals::~Internals):
800         * testing/Internals.h:
801         * testing/Internals.idl:
802
803 2017-03-14  Youenn Fablet  <youenn@apple.com>
804
805         CanvasCapture should not generate a frame per each canvas draw command
806         https://bugs.webkit.org/show_bug.cgi?id=169498
807
808         Reviewed by Simon Fraser & Eric Carlson.
809
810         Test: fast/mediastream/captureStream/canvas2d-heavy-drawing.html
811
812         Making Canvas capture be asynchronous.
813         This ensures that one frame will be created for a set of synchronous draw commands.
814         In the future, we should find a better approach, like aligning with requestAnimationFrame.
815         Adding internals observer API for media stream tracks.
816
817         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
818         (WebCore::CanvasCaptureMediaStreamTrack::Source::Source):
819         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged):
820         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
821         * Modules/mediastream/MediaStreamTrack.idl:
822         * platform/mediastream/RealtimeMediaSource.h:
823         * testing/Internals.cpp:
824         (WebCore::Internals::~Internals):
825         (WebCore::Internals::observeMediaStreamTrack):
826         * testing/Internals.h:
827         * testing/Internals.idl:
828
829 2017-03-14  Wenson Hsieh  <wenson_hsieh@apple.com>
830
831         RenderElements should unregister for viewport visibility callbacks when they are destroyed
832         https://bugs.webkit.org/show_bug.cgi?id=169521
833         <rdar://problem/30959545>
834
835         Reviewed by Simon Fraser.
836
837         When registering a RenderElement for viewport visibility callbacks, we always need to make sure that it is unregistered
838         before it is destroyed. While we account for this in the destructor of RenderElement, we only unregister in the destructor
839         if we are already registered for visibility callbacks. In the call to RenderObject::willBeDestroyed(), we clear out rare
840         data, which holds RenderElement's viewport callback registration state, so upon entering the destructor of RenderElement,
841         we skip unregistration because RenderElement thinks that it is not registered.
842
843         We can mitigate this by unregistering the RenderElement earlier, in RenderElement::willBeDestroyed, prior to clearing out
844         the rare data. However, we'd ideally want to move the cleanup logic out of the destructor altogether and into willBeDestroyed
845         (see https://bugs.webkit.org/show_bug.cgi?id=169650).
846
847         Test: fast/media/video-element-in-details-collapse.html
848
849         * rendering/RenderElement.cpp:
850         (WebCore::RenderElement::willBeDestroyed):
851
852 2017-03-14  Dean Jackson  <dino@apple.com>
853
854         Rename LayerTypeWebGLLayer and use it for both WebGL and WebGPU
855         https://bugs.webkit.org/show_bug.cgi?id=169628
856         <rdar://problems/31047025>
857
858         Fix Windows build.
859
860         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
861         (printLayer):
862
863 2017-03-14  Andy Estes  <aestes@apple.com>
864
865         REGRESSION (r209760): Apple Pay doesn't work on sites that specify empty contact fields
866         https://bugs.webkit.org/show_bug.cgi?id=169639
867         <rdar://problem/30957789>
868
869         Reviewed by Anders Carlsson.
870
871         Shipping and billing contact fields are allowed to be empty.
872
873         * Modules/applepay/ApplePaySession.cpp:
874         (WebCore::convertAndValidate):
875
876 2017-03-14  Anders Carlsson  <andersca@apple.com>
877
878         Propagate PassKit errors
879         https://bugs.webkit.org/show_bug.cgi?id=169633
880         rdar://problem/31043392
881
882         Reviewed by Dean Jackson.
883
884         * Modules/applepay/ApplePayError.idl:
885         * Modules/applepay/ApplePaySession.cpp:
886         (WebCore::convert):
887         (WebCore::convertAndValidate):
888         * Modules/applepay/PaymentRequest.h:
889
890 2017-03-14  Alan Kinsley  <zalan@apple.com>
891
892         Simple line layout: Adjust hyphenation constrains based on the normal line layout line-breaking logic.
893         https://bugs.webkit.org/show_bug.cgi?id=169617
894
895         Reviewed by Antti Koivisto.
896
897         This patch ensures that simple line layout ends up with the same hyphenation context as normal line layout. 
898
899         Test: fast/text/simple-line-layout-hyphenation-constrains.html
900
901         * rendering/SimpleLineLayout.cpp:
902         (WebCore::SimpleLineLayout::hyphenPositionForFragment): see webkit.org/b/169613
903         (WebCore::SimpleLineLayout::splitFragmentToFitLine):
904         * rendering/line/BreakingContext.h: Integral -> fractional.
905         (WebCore::tryHyphenating):
906
907 2017-03-06  Jer Noble  <jer.noble@apple.com>
908
909         Refactor: Allow WebKit2 to override the creation of RealtimeMediaSources
910         https://bugs.webkit.org/show_bug.cgi?id=169227
911
912         Reviewed by Eric Carlson.
913
914         Allow clients of RealtimeMediaSourceCenter to specify a factory for creating
915         RealtimeMediaSources, to be used by subclasess of RealtimeMediaSourceCenter. Add virtual
916         methods to retrieve the "default" factories for the RealtimeMediaSourceCenter subclass. The
917         requires moving the creation of sources up from CaptureDeviceManager into
918         RealtimeMediaSourceCenterMac, and the addition of factory methods to AVAudioCaptureSource
919         and AVVideoCaptureSource.
920
921         * platform/mediastream/CaptureDeviceManager.cpp:
922         (CaptureDeviceManager::deviceWithUID):
923         (CaptureDeviceManager::bestSourcesForTypeAndConstraints): Deleted.
924         (CaptureDeviceManager::sourceWithUID): Deleted.
925         * platform/mediastream/CaptureDeviceManager.h:
926         * platform/mediastream/RealtimeMediaSource.h:
927         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
928         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
929         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
930         (WebCore::RealtimeMediaSourceCenter::setVideoFactory):
931         (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory):
932         * platform/mediastream/RealtimeMediaSourceCenter.h:
933         (WebCore::RealtimeMediaSourceCenter::audioFactory):
934         (WebCore::RealtimeMediaSourceCenter::videoFactory):
935         * platform/mediastream/mac/AVAudioCaptureSource.h:
936         * platform/mediastream/mac/AVAudioCaptureSource.mm:
937         (WebCore::AVAudioCaptureSource::factory):
938         * platform/mediastream/mac/AVCaptureDeviceManager.h:
939         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
940         (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints): Deleted.
941         * platform/mediastream/mac/AVMediaCaptureSource.h:
942         * platform/mediastream/mac/AVVideoCaptureSource.h:
943         * platform/mediastream/mac/AVVideoCaptureSource.mm:
944         (WebCore::AVVideoCaptureSource::factory):
945         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
946         (WebCore::RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac):
947         (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints):
948         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
949         (WebCore::RealtimeMediaSourceCenterMac::bestSourcesForTypeAndConstraints):
950         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory):
951         (WebCore::RealtimeMediaSourceCenterMac::defaultVideoFactory):
952         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
953         * platform/mock/MockRealtimeAudioSource.cpp:
954         (WebCore::MockRealtimeAudioSource::factory):
955         * platform/mock/MockRealtimeAudioSource.h:
956         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
957         (WebCore::MockRealtimeMediaSourceCenter::defaultAudioFactory):
958         (WebCore::MockRealtimeMediaSourceCenter::defaultVideoFactory):
959         * platform/mock/MockRealtimeMediaSourceCenter.h:
960         * platform/mock/MockRealtimeVideoSource.cpp:
961         (WebCore::MockRealtimeVideoSource::factory):
962         * platform/mock/MockRealtimeVideoSource.h:
963
964 2017-03-14  Dean Jackson  <dino@apple.com>
965
966         Rename LayerTypeWebGLLayer and use it for both WebGL and WebGPU
967         https://bugs.webkit.org/show_bug.cgi?id=169628
968         <rdar://problems/31047025>
969
970         Reviewed by Simon Fraser.
971
972         Rename LayerTypeWebGLLayer to LayerTypeContentsProvidedLayer
973         and use it for both WebGLLayer and WebGPULayer, to avoid
974         code duplication.
975
976         * platform/graphics/ca/PlatformCALayer.cpp:
977         (WebCore::operator<<):
978         * platform/graphics/ca/PlatformCALayer.h:
979         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
980         (PlatformCALayerCocoa::layerTypeForPlatformLayer):
981         (PlatformCALayerCocoa::PlatformCALayerCocoa):
982         (PlatformCALayerCocoa::commonInit):
983
984 2017-03-13  Jer Noble  <jer.noble@apple.com>
985
986         Make classes used by Media Stream encode/decode friendly
987         https://bugs.webkit.org/show_bug.cgi?id=169567
988
989         Reviewed by Eric Carlson.
990
991         Add encode() and decode() methods and implementations to a variety of media stream related classes.
992
993         * platform/audio/mac/CAAudioStreamDescription.h:
994         (WebCore::CAAudioStreamDescription::encode):
995         (WebCore::CAAudioStreamDescription::decode):
996         * platform/mediastream/RealtimeMediaSourceSettings.h:
997         (WebCore::RealtimeMediaSourceSettings::width):
998         (WebCore::RealtimeMediaSourceSettings::setWidth):
999         (WebCore::RealtimeMediaSourceSettings::height):
1000         (WebCore::RealtimeMediaSourceSettings::setHeight):
1001         (WebCore::RealtimeMediaSourceSettings::sampleRate):
1002         (WebCore::RealtimeMediaSourceSettings::setSampleRate):
1003         (WebCore::RealtimeMediaSourceSettings::sampleSize):
1004         (WebCore::RealtimeMediaSourceSettings::setSampleSize):
1005         (WebCore::RealtimeMediaSourceSettings::encode):
1006         (WebCore::RealtimeMediaSourceSettings::decode):
1007         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h:
1008         (WebCore::RealtimeMediaSourceSupportedConstraints::encode):
1009         (WebCore::RealtimeMediaSourceSupportedConstraints::decode):
1010
1011 2017-03-14  Jer Noble  <jer.noble@apple.com>
1012
1013         Adapt CARingBuffer to be usable across processes
1014         https://bugs.webkit.org/show_bug.cgi?id=169591
1015
1016         Reviewed by Alex Christensen.
1017
1018         When used with a SharedMemory backing store, storing the pointers to channel data at the beginning
1019         of the channel data itself is problematic: when the SharedMemory is mapped on the far side of the
1020         process boundary, it will not exist at the same memory location as it did on the near side. Instead
1021         of storing these pointers inside the channel data, store them in a small (usually 1 or 2 entry) vector
1022         recreated when the backing store is (re-)allocated.
1023
1024         * platform/audio/mac/CARingBuffer.cpp:
1025         (WebCore::CARingBuffer::CARingBuffer):
1026         (WebCore::CARingBuffer::allocate):
1027         (WebCore::CARingBuffer::deallocate):
1028         (WebCore::ZeroRange):
1029         (WebCore::StoreABL):
1030         (WebCore::FetchABL):
1031         (WebCore::CARingBuffer::store):
1032         (WebCore::CARingBuffer::getCurrentFrameBounds):
1033         (WebCore::CARingBuffer::fetch):
1034         * platform/audio/mac/CARingBuffer.h:
1035
1036 2017-03-14  Jer Noble  <jer.noble@apple.com>
1037
1038         Pulling more frames from AudioSampleDataSource than the last push added will always fail.
1039         https://bugs.webkit.org/show_bug.cgi?id=168644
1040
1041         Reviewed by Eric Carlson.
1042
1043         Rather than use the delta between the ring buffer's end time and the last pushed timestamp
1044         (or what is effectively the number of samples in the last push operation) to determine if
1045         there is enough buffered data to satisfy a pull operation, use the ring buffer's actual
1046         buffered duration.
1047
1048         Then, instead of saving the last pushed timestamp, explicitly save the last push count, and
1049         use that data to inform how much to offset the output timestamps (or what is effectively how
1050         much to allow the source to pre-buffer).
1051
1052         * platform/audio/mac/AudioSampleDataSource.cpp:
1053         (WebCore::AudioSampleDataSource::pushSamplesInternal):
1054         (WebCore::AudioSampleDataSource::pullSamplesInternal):
1055         * platform/audio/mac/AudioSampleDataSource.h:
1056
1057 2017-03-14  Megan Gardner  <megan_gardner@apple.com>
1058
1059         Correctly export WebItemProviderPasteboard
1060         https://bugs.webkit.org/show_bug.cgi?id=169578
1061
1062         Reviewed by Tim Horton.
1063
1064         * platform/ios/WebItemProviderPasteboard.h:
1065
1066 2017-03-14  Adrian Perez de Castro  <aperez@igalia.com>
1067
1068         Remove redundant check for "firstLine" in RenderBlock::lineHeight()
1069         https://bugs.webkit.org/show_bug.cgi?id=169610
1070
1071         Reviewed by Michael Catanzaro.
1072
1073         * rendering/RenderBlock.cpp:
1074         (WebCore::RenderBlock::lineHeight): Remove test of "firstLine" that
1075         was already checked in the condition for the enclosing if-clause.
1076
1077 2017-03-14  Antoine Quint  <graouts@apple.com>
1078
1079         [Modern Media Controls] Fullscreen controls during Live Broadcast is completely broken
1080         https://bugs.webkit.org/show_bug.cgi?id=169354
1081         <rdar://problem/30636370>
1082
1083         Reviewed by Dean Jackson.
1084
1085         When playing a Live Broadcast video in fullscreen, we should not show any scrubbing-related
1086         piece of UI and ensure that we show the status label.
1087
1088         Test: http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html
1089
1090         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
1091         (.media-controls.mac.fullscreen > .controls-bar .status-label):
1092         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
1093         (MacOSFullscreenMediaControls.prototype.layout):
1094         * Modules/modern-media-controls/media/seek-support.js:
1095         (SeekSupport.prototype.get mediaEvents):
1096         (SeekSupport.prototype.syncControl):
1097
1098 2017-03-14  Joseph Pecoraro  <pecoraro@apple.com>
1099
1100         Web Inspector: More accurate Resource Timing data in Web Inspector
1101         https://bugs.webkit.org/show_bug.cgi?id=169577
1102
1103         Reviewed by Youenn Fablet.
1104
1105         * inspector/InspectorNetworkAgent.h:
1106         * inspector/InspectorNetworkAgent.cpp:
1107         (WebCore::InspectorNetworkAgent::didFinishLoading):
1108         Use the ResourceLoader to get the start time that responseEnd is relative to
1109         so we can send the more accurate responseEnd when available.
1110
1111         * inspector/InspectorInstrumentation.cpp:
1112         (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
1113         * inspector/InspectorInstrumentation.h:
1114         (WebCore::InspectorInstrumentation::didFinishLoading):
1115         * loader/CrossOriginPreflightChecker.cpp:
1116         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
1117         * loader/DocumentLoader.cpp:
1118         (WebCore::DocumentLoader::finishedLoading):
1119         * loader/ResourceLoadNotifier.cpp:
1120         (WebCore::ResourceLoadNotifier::didFinishLoad):
1121         (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
1122         (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
1123         * loader/ResourceLoadNotifier.h:
1124         * loader/appcache/ApplicationCacheGroup.cpp:
1125         (WebCore::ApplicationCacheGroup::didFinishLoading):
1126         Pass ResourceLoader through to Web Inspector in didFinishLoading.
1127
1128         * platform/network/cocoa/NetworkLoadMetrics.mm:
1129         (WebCore::copyTimingData):
1130         The differences from the reference start are in Seconds, not milliseconds.
1131
1132 2017-03-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1133
1134         [WK2] Data interaction tests occasionally hit assertions in debug builds
1135         https://bugs.webkit.org/show_bug.cgi?id=169002
1136         <rdar://problem/30994806>
1137
1138         Reviewed by Tim Horton.
1139
1140         Data interaction unit tests occasionally fail due to the UI process expecting the latest received EditorState to
1141         contain post layout data, but finding that it does not in -[WKContentView selectedTextRange]. The incomplete
1142         EditorStates in question are sent while performing a data interaction operation, due to transient changes in the
1143         frame selection. The UI process does not need to (and should not) be informed of these selection changes at all.
1144
1145         We can fix this by preventing the editor client from responding to selection changes during data interaction
1146         operation. This patch also renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges to better
1147         reflect the fact that it is used outside of the context of holding selection change updates during IME. We
1148         already use this affordance in various places, such as TextIndicator (while taking a snapshot on iOS), in
1149         FindController on iOS, and when replacing selected or dictated text. Additionally, there is no logic in
1150         setIgnoreCompositionSelectionChange that limits its use to composition.
1151
1152         * editing/Editor.cpp:
1153         (WebCore::Editor::cancelCompositionIfSelectionIsInvalid):
1154         (WebCore::Editor::setComposition):
1155         (WebCore::Editor::revealSelectionAfterEditingOperation):
1156         (WebCore::Editor::setIgnoreSelectionChanges):
1157         (WebCore::Editor::changeSelectionAfterCommand):
1158         (WebCore::Editor::respondToChangedSelection):
1159         (WebCore::Editor::setIgnoreCompositionSelectionChange): Deleted.
1160         * editing/Editor.h:
1161         (WebCore::Editor::ignoreSelectionChanges):
1162         (WebCore::Editor::ignoreCompositionSelectionChange): Deleted.
1163         * editing/mac/EditorMac.mm:
1164         (WebCore::Editor::selectionWillChange):
1165         * page/TextIndicator.cpp:
1166         (WebCore::TextIndicator::createWithRange):
1167
1168 2017-03-14  Antoine Quint  <graouts@apple.com>
1169
1170         [Modern Media Controls] iOS may attempt to load fullscreen icon variants
1171         https://bugs.webkit.org/show_bug.cgi?id=169608
1172         <rdar://problem/31037369>
1173
1174         Reviewed by Eric Carlson.
1175
1176         Only return fullscreen or compact variants for macOS.
1177
1178         * Modules/modern-media-controls/controls/icon-service.js:
1179         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconNameAndLayoutTraits):
1180         (const.iconService.new.IconService):
1181
1182 2017-03-14  Antoine Quint  <graouts@apple.com>
1183
1184         [Modern Media Controls] Controls are laid out incorrectly with RTL languages
1185         https://bugs.webkit.org/show_bug.cgi?id=169605
1186         <rdar://problem/30975709>
1187
1188         Reviewed by Eric Carlson.
1189
1190         Encorce "direction: ltr" on the controls since the controls layout should not be changed
1191         by the host page's direction.
1192
1193         Test: media/modern-media-controls/media-controls/media-controls-controls-bar-always-ltr.html
1194
1195         * Modules/modern-media-controls/controls/controls-bar.css:
1196         (.controls-bar):
1197
1198 2017-03-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1199
1200         Make RepaintRegionAccumulator hold a WeakPtr to its root RenderView
1201         https://bugs.webkit.org/show_bug.cgi?id=168480
1202         <rdar://problem/30566976>
1203
1204         Reviewed by Antti Koivisto.
1205
1206         Implements two mitigations to prevent the symptoms of the bug from occurring (see the bugzilla for more details).
1207
1208         Test: editing/execCommand/show-modal-dialog-during-execCommand.html
1209
1210         * editing/EditorCommand.cpp:
1211         (WebCore::Editor::Command::execute):
1212
1213         Do not allow edit commands to execute if the frame's document before and after layout differ (that is, edit commands
1214         triggered by a certain document should not run on a different document).
1215
1216         * rendering/RenderView.cpp:
1217         (WebCore::RenderView::RenderView):
1218         (WebCore::RenderView::RepaintRegionAccumulator::RepaintRegionAccumulator):
1219
1220         Turns RepaintRegionAccumulator's reference to its root RenderView into a WeakPtr to gracefully handle the case
1221         where its RenderView is destroyed before RepaintRegionAccumulator's destructor gets a chance to flush the
1222         RenderView's repaint regions.
1223
1224         * rendering/RenderView.h:
1225
1226 2017-03-14  Zan Dobersek  <zdobersek@igalia.com>
1227
1228         [GLib] Use USE(GLIB) guards in WebCore/workers/
1229         https://bugs.webkit.org/show_bug.cgi?id=169595
1230
1231         Reviewed by Carlos Garcia Campos.
1232
1233         Utilize the USE(GLIB) build guards in the WorkerRunLoop and WorkerThread
1234         class implementations to guard GLib-specific header inclusions and GLib
1235         API invocations, instead of the more specific PLATFORM(GTK) guards.
1236
1237         * workers/WorkerRunLoop.cpp:
1238         (WebCore::WorkerRunLoop::runInMode):
1239         * workers/WorkerThread.cpp:
1240         (WebCore::WorkerThread::workerThread):
1241
1242 2017-03-14  Zan Dobersek  <zdobersek@igalia.com>
1243
1244         [Soup] Suppress compiler warnings in NetworkStorageSession
1245         https://bugs.webkit.org/show_bug.cgi?id=169593
1246
1247         Reviewed by Carlos Garcia Campos.
1248
1249         Return default-constructed Vector objects in the NetworkStorageSession's
1250         getAllCookies() and getCookies() methods, avoiding compiler warnings.
1251
1252         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1253         (WebCore::NetworkStorageSession::getAllCookies):
1254         (WebCore::NetworkStorageSession::getCookies):
1255
1256 2017-03-13  Joseph Pecoraro  <pecoraro@apple.com>
1257
1258         Remove unused methods of ResourceRequestBase
1259         https://bugs.webkit.org/show_bug.cgi?id=169579
1260
1261         Reviewed by Youenn Fablet.
1262
1263         * platform/network/ResourceRequestBase.h:
1264         (WebCore::ResourceRequestBase::reportUploadProgress): Deleted.
1265         (WebCore::ResourceRequestBase::setReportUploadProgress): Deleted.
1266         (WebCore::ResourceRequestBase::reportLoadTiming): Deleted.
1267         (WebCore::ResourceRequestBase::setReportLoadTiming): Deleted.
1268         (WebCore::ResourceRequestBase::reportRawHeaders): Deleted.
1269         (WebCore::ResourceRequestBase::setReportRawHeaders): Deleted.
1270         Remove unused code.
1271
1272         * inspector/InspectorNetworkAgent.cpp:
1273         (WebCore::InspectorNetworkAgent::willSendRequest):
1274         * loader/ResourceLoadNotifier.cpp:
1275         (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
1276         * xml/XMLHttpRequest.cpp:
1277         (WebCore::XMLHttpRequest::createRequest):
1278         Remove callers of setters that did nothing.
1279
1280 2017-03-13  Youenn Fablet  <youenn@apple.com>
1281
1282         Make RealtimeMediaSource::type an enum class
1283         https://bugs.webkit.org/show_bug.cgi?id=169491
1284
1285         Reviewed by Sam Weinig.
1286
1287         No change of behavior.
1288
1289         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
1290         (WebCore::CanvasCaptureMediaStreamTrack::Source::Source):
1291         * Modules/mediastream/MediaStream.cpp:
1292         (WebCore::MediaStream::getAudioTracks):
1293         (WebCore::MediaStream::getVideoTracks):
1294         * Modules/mediastream/MediaStreamTrack.cpp:
1295         (WebCore::MediaStreamTrack::kind):
1296         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1297         (WebCore::LibWebRTCMediaEndpoint::addTrack):
1298         * Modules/webaudio/MediaStreamAudioSource.cpp:
1299         (WebCore::MediaStreamAudioSource::MediaStreamAudioSource):
1300         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1301         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated):
1302         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
1303         * platform/mediastream/CaptureDeviceManager.cpp:
1304         (CaptureDeviceManager::bestSourcesForTypeAndConstraints):
1305         (CaptureDeviceManager::sourceWithUID):
1306         * platform/mediastream/MediaEndpoint.cpp:
1307         * platform/mediastream/RealtimeMediaSource.h:
1308         * platform/mediastream/mac/AVAudioCaptureSource.mm:
1309         (WebCore::AVAudioCaptureSource::AVAudioCaptureSource):
1310         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1311         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
1312         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1313         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
1314         * platform/mock/MockMediaEndpoint.cpp:
1315         (WebCore::MockMediaEndpoint::createMutedRemoteSource):
1316         * platform/mock/MockRealtimeAudioSource.cpp:
1317         (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource):
1318         * platform/mock/MockRealtimeMediaSource.cpp:
1319         (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource):
1320         * platform/mock/MockRealtimeVideoSource.cpp:
1321         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
1322
1323 2017-03-13  Eric Carlson  <eric.carlson@apple.com>
1324
1325         [MediaStream] Move paintCurrentFrameInContext from RealtimeMediaSources to MediaPlayer
1326         https://bugs.webkit.org/show_bug.cgi?id=169474
1327         <rdar://problem/30976747>
1328
1329         Reviewed by Youenn Fablet.
1330
1331         Every video capture source has extremely similar code to render the current frame to
1332         a graphics context. Because the media player gets every video sample buffer, have it
1333         hang onto the most recent frame so it can implement paintCurrentFrameInContext directly.
1334         Fix an existing race condition that occasionally caused the readyState to advance to 
1335         "have enough data" before a video was ready to paint by defining a MediaStreamTrackPrivate
1336         readyState and observing that.
1337
1338         No new tests, covered by existing tests. These changes uncovered a bug in 
1339         fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html, which 
1340         was updated.
1341
1342         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
1343         (WebCore::CanvasCaptureMediaStreamTrack::Source::captureCanvas):
1344         (WebCore::CanvasCaptureMediaStreamTrack::Source::paintCurrentFrameInContext): Deleted.
1345         (WebCore::CanvasCaptureMediaStreamTrack::Source::currentFrameImage): Deleted.
1346         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
1347
1348         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1349         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1350         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
1351         Drive-by change - don't pass status to parent callback, it is a property of the layer.
1352         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable): Drive-by cleanup - we don't
1353         use AVSampleBufferRenderSynchronizer so don't fail if it isn't available.
1354         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): Hang onto new frame,
1355         invalidate cached image, update readyState.
1356         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): No more "updatePausedImage".
1357         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Drive-by cleanup - Add an early
1358          return if there is no need for a layer.
1359         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): renderingModeChanged -> updateRenderingMode.
1360         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode): Minor cleanup.
1361         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode): Renamed from renderingModeChanged,
1362         add a bool return to signal when the mode changes.
1363         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): No more m_haveEverPlayed. Update display
1364         mode immediately.
1365         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): No more paused image.
1366         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentReadyState): Only return HaveNothing, HaveMetadata,
1367         or HaveEnoughData. Don't return HaveEnoughData until all enabled tracks are providing data and never
1368         drop back to HaveMetadata.
1369         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateRenderingMode): Renamed from renderingModeChanged.
1370         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::characteristicsChanged): Update intrinsic
1371         size directly.
1372         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated): No more m_hasReceivedMedia.
1373         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::readyStateChanged): Ditto.
1374         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack): Reset imagePainter
1375         when active video track changes.
1376         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateCurrentFrameImage): Deleted.
1377         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext): Paint current
1378         frame image.
1379         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::CurrentFramePainter::reset): New.
1380         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::shouldEnqueueVideoSampleBuffer): Deleted.
1381         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updatePausedImage): Deleted.
1382         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateIntrinsicSize): Deleted.
1383         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::renderingModeChanged): Deleted.
1384         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSamplesAvailable): Deleted.
1385
1386         * platform/mediastream/MediaStreamPrivate.cpp:
1387         (WebCore::MediaStreamPrivate::paintCurrentFrameInContext): Deleted.
1388         (WebCore::MediaStreamPrivate::currentFrameImage): Deleted.
1389         * platform/mediastream/MediaStreamPrivate.h:
1390
1391         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1392         (WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate):
1393         (WebCore::MediaStreamTrackPrivate::endTrack): Update readyState.
1394         (WebCore::MediaStreamTrackPrivate::clone): Clone readyState.
1395         (WebCore::MediaStreamTrackPrivate::sourceStopped): Update readyState.
1396         (WebCore::MediaStreamTrackPrivate::videoSampleAvailable): Ditto.
1397         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable): Ditto.
1398         (WebCore::MediaStreamTrackPrivate::updateReadyState): New, update readyState and notify observers.
1399         (WebCore::MediaStreamTrackPrivate::paintCurrentFrameInContext): Deleted.
1400         * platform/mediastream/MediaStreamTrackPrivate.h:
1401
1402         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1403         (WebCore::MediaStreamTrackPrivate::paintCurrentFrameInContext): Deleted.
1404         * platform/mediastream/RealtimeMediaSource.h:
1405         (WebCore::RealtimeMediaSource::currentFrameImage): Deleted.
1406         (WebCore::RealtimeMediaSource::paintCurrentFrameInContext): Deleted.
1407
1408         * platform/mediastream/mac/AVMediaCaptureSource.mm:
1409         (-[WebCoreAVMediaCaptureSourceObserver disconnect]): Drive-by fix - clear m_callback
1410         after calling removeNotificationObservers.
1411         (-[WebCoreAVMediaCaptureSourceObserver removeNotificationObservers]): Drive-by fix - remove 
1412         the correct listener.
1413         (-[WebCoreAVMediaCaptureSourceObserver endSessionInterrupted:]):
1414
1415         * platform/mediastream/mac/AVVideoCaptureSource.h:
1416         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1417         (WebCore::AVVideoCaptureSource::currentFrameImage): Deleted.
1418         (WebCore::AVVideoCaptureSource::currentFrameCGImage): Deleted.
1419         (WebCore::AVVideoCaptureSource::paintCurrentFrameInContext): Deleted.
1420
1421         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
1422         (WebCore::drawImage): Deleted.
1423         (WebCore::RealtimeIncomingVideoSource::currentFrameImage): Deleted.
1424         (WebCore::RealtimeIncomingVideoSource::paintCurrentFrameInContext): Deleted.
1425         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
1426
1427         * platform/mock/MockRealtimeVideoSource.cpp:
1428         (WebCore::MockRealtimeVideoSource::paintCurrentFrameInContext): Deleted.
1429         (WebCore::MockRealtimeVideoSource::currentFrameImage): Deleted.
1430         * platform/mock/MockRealtimeVideoSource.h:
1431
1432 2017-03-13  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1433
1434         [GTK][SOUP] Fix build after r213877
1435         https://bugs.webkit.org/show_bug.cgi?id=140191
1436
1437         Unreviewed build fix.
1438
1439         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1440         (WebCore::NetworkStorageSession::setCookie): Add missing setCookie() declaration.
1441
1442 2017-03-13  Brady Eidson  <beidson@apple.com>
1443
1444         WKWebView provides no access to cookies.
1445         https://bugs.webkit.org/show_bug.cgi?id=140191
1446
1447         Reviewed by Tim Horton.
1448
1449         Covered by API tests.
1450
1451         * platform/Cookie.h:
1452
1453         * platform/network/NetworkStorageSession.h:
1454         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1455         (WebCore::NetworkStorageSession::setCookie):
1456         (WebCore::NetworkStorageSession::deleteCookie):
1457         (WebCore::nsCookiesToCookieVector):
1458         (WebCore::NetworkStorageSession::getAllCookies):
1459         (WebCore::NetworkStorageSession::getCookies):
1460
1461         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1462         (WebCore::NetworkStorageSession::deleteCookie):
1463         (WebCore::NetworkStorageSession::getAllCookies):
1464         (WebCore::NetworkStorageSession::getCookies):
1465
1466 2017-03-13  Devin Rousso  <webkit@devinrousso.com>
1467
1468         Web Inspector: Event Listeners section is missing 'once', 'passive' event listener flags
1469         https://bugs.webkit.org/show_bug.cgi?id=167080
1470
1471         Reviewed by Joseph Pecoraro.
1472
1473         Test: inspector/dom/getEventListenersForNode.html
1474
1475         * inspector/InspectorDOMAgent.cpp:
1476         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
1477         Add "passive" and "once" values to the EventListener protocol object when applicable.
1478
1479 2017-03-13  John Wilander  <wilander@apple.com>
1480
1481         Resource Load Statistics: More efficient network process messaging + Fix bug in user interaction reporting
1482         https://bugs.webkit.org/show_bug.cgi?id=169506
1483
1484         Reviewed by Alex Christensen.
1485
1486         Covered by previous test which now follows the code path more closely to when reporting
1487         happens in the web process.
1488
1489         * loader/ResourceLoadObserver.cpp:
1490         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1491             No longer explicitly calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
1492             Instead just calls ResourceLoadStatisticsStore::fireDataModificationHandler().
1493         (WebCore::ResourceLoadObserver::logUserInteraction):
1494             Updated to call the new ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
1495         (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
1496             Now takes two vectors – domainsToRemove and domainsToAdd.
1497         * loader/ResourceLoadObserver.h:
1498         * loader/ResourceLoadStatistics.cpp:
1499         (WebCore::ResourceLoadStatistics::toString):
1500             Added boolean field isMarkedForCookiePartitioning.
1501         (WebCore::ResourceLoadStatistics::merge):
1502             Added boolean field isMarkedForCookiePartitioning.
1503         * loader/ResourceLoadStatistics.h:
1504             Added boolean field isMarkedForCookiePartitioning.
1505         * loader/ResourceLoadStatisticsStore.cpp:
1506         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
1507             Now marks statistics with isMarkedForCookiePartitioning before sending them off to
1508             ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
1509         (WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback):
1510             Now accepts a handler with two vectors.
1511         (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
1512             Now the only exported version of this function is the one without arguments.
1513             The one internal to WebCore accepts two vectors – domainsToRemove and domainsToAdd.
1514             The exported one generates the two vectors and then calls the internal one.
1515         (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
1516             No longer explicitly calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
1517         * loader/ResourceLoadStatisticsStore.h:
1518         * platform/network/NetworkStorageSession.h:
1519         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1520         (WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts):
1521             Now takes two vectors – domainsToRemove and domainsToAdd.
1522
1523 2017-03-13  Dean Jackson  <dino@apple.com>
1524
1525         Respect the runtime flag for WebGPU, default feature to off.
1526         https://bugs.webkit.org/show_bug.cgi?id=169564
1527         <rdar://problems/31018864>
1528
1529         Reviewed by Tim Horton.
1530
1531         Make sure WebGPU respects its runtime feature flag. Also, since
1532         this implementation doesn't validate content, it should default
1533         to being disabled.
1534
1535         Test: fast/canvas/webgpu/webgpu-runtime-flag.html
1536
1537         * html/HTMLCanvasElement.cpp:
1538         (WebCore::HTMLCanvasElement::getContext):
1539         (WebCore::HTMLCanvasElement::getContextWebGPU):
1540
1541 2017-03-13  Alex Christensen  <achristensen@webkit.org>
1542
1543         Fix CMake build.
1544
1545         * PlatformMac.cmake:
1546         Add new files.
1547
1548 2017-03-13  Chris Dumez  <cdumez@apple.com>
1549
1550         Allow termination of background WebProcesses that go over a given CPU usage threshold
1551         https://bugs.webkit.org/show_bug.cgi?id=169456
1552         <rdar://problem/30960968>
1553
1554         Reviewed by Andreas Kling.
1555
1556         Add CPUMonitor utility class to monitor CPU usage and call a provided lambda
1557         whenever the process exceeds the provided CPU limit over a given period of
1558         time.
1559
1560         * WebCore.xcodeproj/project.pbxproj:
1561         * platform/CPUMonitor.cpp: Added.
1562         (WebCore::CPUMonitor::CPUMonitor):
1563         (WebCore::CPUMonitor::setCPULimit):
1564         (WebCore::CPUMonitor::timerFired):
1565         * platform/CPUMonitor.h: Added.
1566
1567 2017-03-13  Antoine Quint  <graouts@apple.com>
1568
1569         [Modern Media Controls] Volume icon doesn't turn to mute when the knob is set to 0
1570         https://bugs.webkit.org/show_bug.cgi?id=169553
1571         <rdar://problem/30754543>
1572
1573         Reviewed by Eric Carlson.
1574
1575         When we start changing the volume using the mouse, we record the volume at that point
1576         and as we drag the volume slider, we set the mute button to show that the media is
1577         muted if the volume is 0, and set the actual media volume to be the initial volume
1578         prior to dragging. This way, when we toggle the "muted" property by pressing the
1579         mute button, the original volume is restored.
1580
1581         To function correctly, this required some changed to Slider. The volume slider would
1582         fail to update if the value set was the same as the initial value since we would use
1583         only the "change" event to identify the end of a slider drag interaction. This was
1584         incorrect since if the initial value and the final value while dragging the slider
1585         were the same, no "change" event would be fired. So we now use mouse events to
1586         identify when the slider is being dragged.
1587
1588         Test: media/modern-media-controls/volume-support/volume-support-drag-to-mute.html
1589
1590         * Modules/modern-media-controls/controls/slider.js:
1591         (Slider.prototype.set value):
1592         (Slider.prototype.handleEvent):
1593         (Slider.prototype._handleMousedownEvent):
1594         (Slider.prototype._handleInputEvent):
1595         (Slider.prototype._handleMouseupEvent):
1596         (Slider.prototype._handleChangeEvent): Deleted.
1597         * Modules/modern-media-controls/controls/volume-slider.js:
1598         (VolumeSlider):
1599         (VolumeSlider.prototype.draw):
1600         (VolumeSlider.prototype.handleEvent): Deleted.
1601         * Modules/modern-media-controls/media/volume-support.js:
1602         (VolumeSupport.prototype.controlValueWillStartChanging):
1603         (VolumeSupport.prototype.controlValueDidChange):
1604
1605 2017-03-13  Per Arne Vollan  <pvollan@apple.com>
1606
1607         [Win] Compile error.
1608         https://bugs.webkit.org/show_bug.cgi?id=169546
1609
1610         Reviewed by Brent Fulgham.
1611
1612         There is no matching constructor in the Cookie class.
1613
1614         * platform/network/cf/CookieJarCFNet.cpp:
1615         (WebCore::getRawCookies):
1616
1617 2017-03-13  Miguel Gomez  <magomez@igalia.com>
1618
1619         ImageDecoder can be deleted while the async decoder thread is still using it
1620         https://bugs.webkit.org/show_bug.cgi?id=169199
1621
1622         Reviewed by Carlos Garcia Campos.
1623
1624         Make the image decoder used by ImageSource and ImageFrameCache into a RefPtr instead of
1625         and unique_ptr, and pass a reference to the decoder thread. This ensures that the decoder
1626         will stay alive as long as the decoding thread is processing frames. Also, stop the async
1627         decoding queue if a new decoder is set to ImageFrameCache.
1628
1629         No new tests.
1630
1631         * platform/graphics/ImageFrameCache.cpp:
1632         (WebCore::ImageFrameCache::setDecoder):
1633         (WebCore::ImageFrameCache::decoder):
1634         (WebCore::ImageFrameCache::startAsyncDecodingQueue):
1635         (WebCore::ImageFrameCache::metadata):
1636         * platform/graphics/ImageFrameCache.h:
1637         (WebCore::ImageFrameCache::setDecoder): Deleted.
1638         Moved to source file so we can keep the ImageDecoder forward declaration.
1639         (WebCore::ImageFrameCache::decoder): Deleted.
1640         Moved to source file so we can keep the ImageDecoder forward declaration.
1641         * platform/graphics/ImageSource.h:
1642         * platform/graphics/cg/ImageDecoderCG.h:
1643         (WebCore::ImageDecoder::create):
1644         * platform/graphics/win/ImageDecoderDirect2D.h:
1645         (WebCore::ImageDecoder::create):
1646         * platform/image-decoders/ImageDecoder.cpp:
1647         (WebCore::ImageDecoder::create):
1648         * platform/image-decoders/ImageDecoder.h:
1649
1650 2017-03-13  Manuel Rego Casasnovas  <rego@igalia.com>
1651
1652         Unprefix -webkit-min-content, -webkit-max-content and -webkit-fit-content
1653         https://bugs.webkit.org/show_bug.cgi?id=169195
1654
1655         Reviewed by Sergio Villar Senin.
1656
1657         Based on Blink r200846 by <cbiesinger@chromium.org>.
1658         https://src.chromium.org/viewvc/blink?revision=200846&view=revision
1659
1660         This patch adds support for the unprefixed version of these properties,
1661         while it keeps the prefixed ones working too.
1662         -webkit-fill-available is left out of this change, as the CSS WG
1663         is still defining the final keyword and behavior.
1664
1665         With this patch WebKit will be in the same situation than Blink
1666         regarding these intrinsic sizing keywords (see http://crbug.com/245157).
1667
1668         Test: fast/css-intrinsic-dimensions/height-property-value.html
1669               fast/css-intrinsic-dimensions/width-property-value.html
1670
1671         * css/CSSPrimitiveValue.cpp:
1672         (WebCore::CSSPrimitiveValue::init):
1673         * css/CSSValueKeywords.in:
1674         * css/StyleBuilderConverter.h:
1675         (WebCore::StyleBuilderConverter::convertLengthSizing):
1676         (WebCore::StyleBuilderConverter::createGridTrackBreadth):
1677         * css/html.css:
1678         (fieldset):
1679         * css/parser/CSSPropertyParser.cpp:
1680         (WebCore::validWidthOrHeightKeyword):
1681         (WebCore::isGridTrackFixedSized):
1682         (WebCore::consumeGridBreadth):
1683         * html/track/TextTrackCueGeneric.cpp:
1684         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
1685         * html/track/VTTCue.cpp:
1686         (WebCore::VTTCueBox::applyCSSProperties):
1687
1688 2017-03-13  Dean Jackson  <dino@apple.com>
1689
1690         WebGPU remote layer hosting
1691         https://bugs.webkit.org/show_bug.cgi?id=169539
1692         <rdar://problem/31005380>
1693
1694         Reviewed by Jon Lee.
1695
1696         Implement the WebProcess side of WebGPULayer hosting,
1697         via LayerTypeWebGPULayer.
1698
1699         * platform/graphics/ca/PlatformCALayer.cpp:
1700         (WebCore::operator<<): Provide nice pretty printing.
1701         * platform/graphics/ca/PlatformCALayer.h: Add LayerTypeWebGPULayer.
1702         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: Support LayerTypeWebGPULayer.
1703         (PlatformCALayerCocoa::layerTypeForPlatformLayer):
1704         (PlatformCALayerCocoa::PlatformCALayerCocoa):
1705         (PlatformCALayerCocoa::commonInit):
1706
1707 2017-03-13  Zan Dobersek  <zdobersek@igalia.com>
1708
1709         Unreviewed GTK+ build fix. Adjust the Cookie constructor
1710         invocation in CookieJarSoup, using empty values for the
1711         newly-added parameters. This should probably be revised
1712         to determine whether meaningful values can be passed in.
1713
1714         * platform/network/soup/CookieJarSoup.cpp:
1715         (WebCore::getRawCookies):
1716
1717 2017-03-13  Jon Lee  <jonlee@apple.com>
1718
1719         WebGPU: Backend - hosting WebGPU layers
1720         https://bugs.webkit.org/show_bug.cgi?id=169366
1721         <rdar://problem/30928735>
1722
1723         Reviewed by Dean Jackson.
1724
1725         * html/canvas/WebGPURenderingContext.cpp:
1726         (WebCore::WebGPURenderingContext::create): Create the device and the
1727         rendering context.
1728         * platform/graphics/cocoa/GPUCommandBufferMetal.mm:
1729         (WebCore::GPUCommandBuffer::commit):
1730         * platform/graphics/cocoa/GPUDrawableMetal.mm:
1731         (WebCore::GPUDrawable::release): Fix a log message
1732         * platform/graphics/gpu/GPUCommandBuffer.cpp:
1733         (WebCore::GPUCommandBuffer::commit): Deleted. Moved to GPUCommandBufferMetal.
1734         * rendering/RenderLayerBacking.cpp:
1735         (WebCore::canvasCompositingStrategy): WebGPU canvas should return CanvasAsLayerContents.
1736
1737 2017-03-12  Jon Lee  <jonlee@apple.com>
1738
1739         Remove stubs from WebGPU front end
1740         https://bugs.webkit.org/show_bug.cgi?id=169375
1741
1742         Reviewed by Dean Jackson.
1743
1744         Remove stubs and use the back end.
1745         * html/canvas/WebGPUCommandBuffer.cpp:
1746         * html/canvas/WebGPUCommandBuffer.h:
1747         * html/canvas/WebGPUCommandQueue.cpp:
1748         * html/canvas/WebGPUCommandQueue.h:
1749         * html/canvas/WebGPUDepthStencilDescriptor.cpp:
1750         (WebCore::WebGPUDepthStencilDescriptor::setDepthCompareFunction): Remove redundant clause.
1751         * html/canvas/WebGPUDepthStencilDescriptor.h:
1752         * html/canvas/WebGPUDepthStencilDescriptor.idl: Remove label property. Not needed yet.
1753         * html/canvas/WebGPUDepthStencilState.cpp:
1754         * html/canvas/WebGPUDepthStencilState.h:
1755         * html/canvas/WebGPUEnums.cpp:
1756         * html/canvas/WebGPUEnums.h:
1757         * html/canvas/WebGPURenderCommandEncoder.cpp:
1758         * html/canvas/WebGPURenderCommandEncoder.h:
1759         * html/canvas/WebGPURenderPassAttachmentDescriptor.cpp:
1760         * html/canvas/WebGPURenderPassAttachmentDescriptor.h:
1761         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
1762         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.h:
1763         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
1764         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h:
1765         * html/canvas/WebGPURenderPassDescriptor.cpp:
1766         (WebCore::WebGPURenderPassDescriptor::colorAttachments): Uncomment code with GPURenderPassColorAttachmentDescriptor available.
1767         * html/canvas/WebGPURenderPassDescriptor.h:
1768         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp:
1769         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h:
1770         * html/canvas/WebGPURenderPipelineDescriptor.cpp:
1771         * html/canvas/WebGPURenderPipelineDescriptor.h:
1772         * html/canvas/WebGPURenderPipelineDescriptor.idl: Remove label property. Not needed yet.
1773         * html/canvas/WebGPURenderPipelineState.cpp:
1774         * html/canvas/WebGPURenderPipelineState.h:
1775
1776 2017-03-12  Dean Jackson  <dino@apple.com>
1777
1778         WebGPU Backend
1779         https://bugs.webkit.org/show_bug.cgi?id=169535
1780         <rdar://problem/31002364>
1781
1782         Reviewed by Jon Lee.
1783
1784         Fill in the remainder of the WebGPU backend. This is effectively
1785         a C++ representation of the Metal API.
1786
1787         * WebCore.xcodeproj/project.pbxproj:
1788         * html/canvas/WebGPUDrawable.cpp:
1789         (WebCore::WebGPUDrawable::WebGPUDrawable):
1790         * html/canvas/WebGPUDrawable.h:
1791         (WebCore::GPUDrawable::texture): Deleted.
1792         * platform/graphics/cocoa/GPUBufferMetal.mm:
1793         (WebCore::GPUBuffer::GPUBuffer):
1794         (WebCore::GPUBuffer::platformBuffer):
1795         * platform/graphics/cocoa/GPUCommandBufferMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
1796         (WebCore::GPUCommandBuffer::GPUCommandBuffer):
1797         (WebCore::GPUCommandBuffer::platformCommandBuffer):
1798         (WebCore::GPUCommandBuffer::presentDrawable):
1799         * platform/graphics/cocoa/GPUCommandQueueMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
1800         (WebCore::GPUCommandQueue::GPUCommandQueue):
1801         (WebCore::GPUCommandQueue::label):
1802         (WebCore::GPUCommandQueue::setLabel):
1803         (WebCore::GPUCommandQueue::platformCommandQueue):
1804         * platform/graphics/cocoa/GPUDepthStencilDescriptorMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUTextureMetal.mm.
1805         (WebCore::GPUDepthStencilDescriptor::GPUDepthStencilDescriptor):
1806         (WebCore::GPUDepthStencilDescriptor::depthWriteEnabled):
1807         (WebCore::GPUDepthStencilDescriptor::setDepthWriteEnabled):
1808         (WebCore::GPUDepthStencilDescriptor::depthCompareFunction):
1809         (WebCore::GPUDepthStencilDescriptor::setDepthCompareFunction):
1810         (WebCore::GPUDepthStencilDescriptor::platformDepthStencilDescriptor):
1811         * platform/graphics/cocoa/GPUDepthStencilStateMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
1812         (WebCore::GPUDepthStencilState::GPUDepthStencilState):
1813         (WebCore::GPUDepthStencilState::label):
1814         (WebCore::GPUDepthStencilState::setLabel):
1815         (WebCore::GPUDepthStencilState::platformDepthStencilState):
1816         * platform/graphics/cocoa/GPUDrawableMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
1817         (WebCore::GPUDrawable::GPUDrawable):
1818         (WebCore::GPUDrawable::release):
1819         (WebCore::GPUDrawable::platformDrawable):
1820         (WebCore::GPUDrawable::platformTexture):
1821         * platform/graphics/cocoa/GPUFunctionMetal.mm:
1822         (WebCore::GPUFunction::GPUFunction):
1823         (WebCore::GPUFunction::platformFunction):
1824         * platform/graphics/cocoa/GPULibraryMetal.mm:
1825         (WebCore::GPULibrary::GPULibrary):
1826         (WebCore::GPULibrary::setLabel):
1827         (WebCore::GPULibrary::platformLibrary):
1828         * platform/graphics/cocoa/GPURenderCommandEncoderMetal.mm: Added.
1829         (WebCore::GPURenderCommandEncoder::GPURenderCommandEncoder):
1830         (WebCore::GPURenderCommandEncoder::setRenderPipelineState):
1831         (WebCore::GPURenderCommandEncoder::setDepthStencilState):
1832         (WebCore::GPURenderCommandEncoder::setVertexBuffer):
1833         (WebCore::GPURenderCommandEncoder::setFragmentBuffer):
1834         (WebCore::GPURenderCommandEncoder::drawPrimitives):
1835         (WebCore::GPURenderCommandEncoder::endEncoding):
1836         (WebCore::GPURenderCommandEncoder::platformRenderCommandEncoder):
1837         * platform/graphics/cocoa/GPURenderPassAttachmentDescriptorMetal.mm: Added.
1838         (WebCore::GPURenderPassAttachmentDescriptor::GPURenderPassAttachmentDescriptor):
1839         (WebCore::GPURenderPassAttachmentDescriptor::loadAction):
1840         (WebCore::GPURenderPassAttachmentDescriptor::setLoadAction):
1841         (WebCore::GPURenderPassAttachmentDescriptor::storeAction):
1842         (WebCore::GPURenderPassAttachmentDescriptor::setStoreAction):
1843         (WebCore::GPURenderPassAttachmentDescriptor::setTexture):
1844         (WebCore::GPURenderPassAttachmentDescriptor::platformRenderPassAttachmentDescriptor):
1845         * platform/graphics/cocoa/GPURenderPassColorAttachmentDescriptorMetal.mm: Added.
1846         (WebCore::GPURenderPassColorAttachmentDescriptor::create):
1847         (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor):
1848         (WebCore::GPURenderPassColorAttachmentDescriptor::clearColor):
1849         (WebCore::GPURenderPassColorAttachmentDescriptor::setClearColor):
1850         (WebCore::GPURenderPassColorAttachmentDescriptor::platformRenderPassColorAttachmentDescriptor):
1851         * platform/graphics/cocoa/GPURenderPassDepthAttachmentDescriptorMetal.mm: Added.
1852         (WebCore::GPURenderPassDepthAttachmentDescriptor::create):
1853         (WebCore::GPURenderPassDepthAttachmentDescriptor::GPURenderPassDepthAttachmentDescriptor):
1854         (WebCore::GPURenderPassDepthAttachmentDescriptor::clearDepth):
1855         (WebCore::GPURenderPassDepthAttachmentDescriptor::setClearDepth):
1856         (WebCore::GPURenderPassDepthAttachmentDescriptor::platformRenderPassDepthAttachmentDescriptor):
1857         * platform/graphics/cocoa/GPURenderPassDescriptorMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUBufferMetal.mm.
1858         (WebCore::GPURenderPassDescriptor::GPURenderPassDescriptor):
1859         (WebCore::GPURenderPassDescriptor::colorAttachments):
1860         (WebCore::GPURenderPassDescriptor::depthAttachment):
1861         (WebCore::GPURenderPassDescriptor::platformRenderPassDescriptor):
1862         * platform/graphics/cocoa/GPURenderPipelineColorAttachmentDescriptorMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPULibraryMetal.mm.
1863         (WebCore::GPURenderPipelineColorAttachmentDescriptor::create):
1864         (WebCore::GPURenderPipelineColorAttachmentDescriptor::GPURenderPipelineColorAttachmentDescriptor):
1865         (WebCore::GPURenderPipelineColorAttachmentDescriptor::pixelFormat):
1866         (WebCore::GPURenderPipelineColorAttachmentDescriptor::setPixelFormat):
1867         (WebCore::GPURenderPipelineColorAttachmentDescriptor::platformRenderPipelineColorAttachmentDescriptor):
1868         * platform/graphics/cocoa/GPURenderPipelineDescriptorMetal.mm: Added.
1869         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
1870         (WebCore::GPURenderPipelineDescriptor::depthAttachmentPixelFormat):
1871         (WebCore::GPURenderPipelineDescriptor::setDepthAttachmentPixelFormat):
1872         (WebCore::GPURenderPipelineDescriptor::setVertexFunction):
1873         (WebCore::GPURenderPipelineDescriptor::setFragmentFunction):
1874         (WebCore::GPURenderPipelineDescriptor::colorAttachments):
1875         (WebCore::GPURenderPipelineDescriptor::reset):
1876         (WebCore::GPURenderPipelineDescriptor::platformRenderPipelineDescriptor):
1877         * platform/graphics/cocoa/GPURenderPipelineStateMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUTextureMetal.mm.
1878         (WebCore::GPURenderPipelineState::GPURenderPipelineState):
1879         (WebCore::GPURenderPipelineState::label):
1880         (WebCore::GPURenderPipelineState::setLabel):
1881         (WebCore::GPURenderPipelineState::platformRenderPipelineState):
1882         * platform/graphics/cocoa/GPUTextureDescriptorMetal.mm:
1883         (WebCore::GPUTextureDescriptor::GPUTextureDescriptor):
1884         (WebCore::GPUTextureDescriptor::platformTextureDescriptor):
1885         * platform/graphics/cocoa/GPUTextureMetal.mm:
1886         (WebCore::GPUTexture::GPUTexture):
1887         (WebCore::GPUTexture::platformTexture):
1888         * platform/graphics/gpu/GPUBuffer.cpp:
1889         * platform/graphics/gpu/GPUBuffer.h:
1890         * platform/graphics/gpu/GPUCommandBuffer.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
1891         (WebCore::GPUCommandBuffer::create):
1892         (WebCore::GPUCommandBuffer::~GPUCommandBuffer):
1893         (WebCore::GPUCommandBuffer::commit):
1894         (WebCore::GPUCommandBuffer::createRenderCommandEncoder):
1895         (WebCore::GPUCommandBuffer::presentDrawable):
1896         * platform/graphics/gpu/GPUCommandBuffer.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
1897         * platform/graphics/gpu/GPUCommandQueue.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
1898         (WebCore::GPUCommandQueue::create):
1899         (WebCore::GPUCommandQueue::~GPUCommandQueue):
1900         (WebCore::GPUCommandQueue::createCommandBuffer):
1901         (WebCore::GPUCommandQueue::label):
1902         (WebCore::GPUCommandQueue::setLabel):
1903         * platform/graphics/gpu/GPUCommandQueue.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
1904         * platform/graphics/gpu/GPUDepthStencilDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
1905         (WebCore::GPUDepthStencilDescriptor::create):
1906         (WebCore::GPUDepthStencilDescriptor::~GPUDepthStencilDescriptor):
1907         (WebCore::GPUDepthStencilDescriptor::depthWriteEnabled):
1908         (WebCore::GPUDepthStencilDescriptor::setDepthWriteEnabled):
1909         (WebCore::GPUDepthStencilDescriptor::depthCompareFunction):
1910         (WebCore::GPUDepthStencilDescriptor::setDepthCompareFunction):
1911         * platform/graphics/gpu/GPUDepthStencilDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
1912         * platform/graphics/gpu/GPUDepthStencilState.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
1913         (WebCore::GPUDepthStencilState::create):
1914         (WebCore::GPUDepthStencilState::~GPUDepthStencilState):
1915         (WebCore::GPUDepthStencilState::label):
1916         (WebCore::GPUDepthStencilState::setLabel):
1917         * platform/graphics/gpu/GPUDepthStencilState.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
1918         * platform/graphics/gpu/GPUDevice.cpp:
1919         (WebCore::GPUDevice::createCommandQueue):
1920         (WebCore::GPUDevice::getFramebuffer):
1921         * platform/graphics/gpu/GPUDevice.h:
1922         (WebCore::GPUDevice::markLayerComposited):
1923         (WebCore::GPUDevice::createCommandQueue): Deleted.
1924         (WebCore::GPUDevice::getFramebuffer): Deleted.
1925         * platform/graphics/gpu/GPUDrawable.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
1926         (WebCore::GPUDrawable::create):
1927         (WebCore::GPUDrawable::~GPUDrawable):
1928         (WebCore::GPUDrawable::release):
1929         * platform/graphics/gpu/GPUDrawable.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
1930         * platform/graphics/gpu/GPUEnums.h: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
1931         * platform/graphics/gpu/GPUFunction.h:
1932         * platform/graphics/gpu/GPULibrary.cpp:
1933         * platform/graphics/gpu/GPULibrary.h:
1934         * platform/graphics/gpu/GPURenderCommandEncoder.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.cpp.
1935         (WebCore::GPURenderCommandEncoder::create):
1936         (WebCore::GPURenderCommandEncoder::~GPURenderCommandEncoder):
1937         (WebCore::GPURenderCommandEncoder::setRenderPipelineState):
1938         (WebCore::GPURenderCommandEncoder::setDepthStencilState):
1939         (WebCore::GPURenderCommandEncoder::setVertexBuffer):
1940         (WebCore::GPURenderCommandEncoder::setFragmentBuffer):
1941         (WebCore::GPURenderCommandEncoder::drawPrimitives):
1942         (WebCore::GPURenderCommandEncoder::endEncoding):
1943         * platform/graphics/gpu/GPURenderCommandEncoder.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
1944         * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
1945         (WebCore::GPURenderPassAttachmentDescriptor::~GPURenderPassAttachmentDescriptor):
1946         (WebCore::GPURenderPassAttachmentDescriptor::GPURenderPassAttachmentDescriptor):
1947         (WebCore::GPURenderPassAttachmentDescriptor::loadAction):
1948         (WebCore::GPURenderPassAttachmentDescriptor::setLoadAction):
1949         (WebCore::GPURenderPassAttachmentDescriptor::storeAction):
1950         (WebCore::GPURenderPassAttachmentDescriptor::setStoreAction):
1951         (WebCore::GPURenderPassAttachmentDescriptor::setTexture):
1952         * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
1953         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUDevice.cpp.
1954         (WebCore::GPURenderPassColorAttachmentDescriptor::create):
1955         (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor):
1956         (WebCore::GPURenderPassColorAttachmentDescriptor::~GPURenderPassColorAttachmentDescriptor):
1957         (WebCore::GPURenderPassColorAttachmentDescriptor::clearColor):
1958         (WebCore::GPURenderPassColorAttachmentDescriptor::setClearColor):
1959         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
1960         * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
1961         (WebCore::GPURenderPassDepthAttachmentDescriptor::create):
1962         (WebCore::GPURenderPassDepthAttachmentDescriptor::GPURenderPassDepthAttachmentDescriptor):
1963         (WebCore::GPURenderPassDepthAttachmentDescriptor::~GPURenderPassDepthAttachmentDescriptor):
1964         (WebCore::GPURenderPassDepthAttachmentDescriptor::clearDepth):
1965         (WebCore::GPURenderPassDepthAttachmentDescriptor::setClearDepth):
1966         * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
1967         * platform/graphics/gpu/GPURenderPassDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
1968         (WebCore::GPURenderPassDescriptor::create):
1969         (WebCore::GPURenderPassDescriptor::~GPURenderPassDescriptor):
1970         (WebCore::GPURenderPassDescriptor::depthAttachment):
1971         * platform/graphics/gpu/GPURenderPassDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
1972         * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
1973         (WebCore::GPURenderPipelineColorAttachmentDescriptor::~GPURenderPipelineColorAttachmentDescriptor):
1974         (WebCore::GPURenderPipelineColorAttachmentDescriptor::GPURenderPipelineColorAttachmentDescriptor):
1975         (WebCore::GPURenderPipelineColorAttachmentDescriptor::pixelFormat):
1976         (WebCore::GPURenderPipelineColorAttachmentDescriptor::setPixelFormat):
1977         * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
1978         * platform/graphics/gpu/GPURenderPipelineDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUDevice.cpp.
1979         (WebCore::GPURenderPipelineDescriptor::create):
1980         (WebCore::GPURenderPipelineDescriptor::~GPURenderPipelineDescriptor):
1981         (WebCore::GPURenderPipelineDescriptor::depthAttachmentPixelFormat):
1982         (WebCore::GPURenderPipelineDescriptor::setDepthAttachmentPixelFormat):
1983         (WebCore::GPURenderPipelineDescriptor::setVertexFunction):
1984         (WebCore::GPURenderPipelineDescriptor::setFragmentFunction):
1985         (WebCore::GPURenderPipelineDescriptor::colorAttachments):
1986         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
1987         * platform/graphics/gpu/GPURenderPipelineState.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.cpp.
1988         (WebCore::GPURenderPipelineState::create):
1989         (WebCore::GPURenderPipelineState::~GPURenderPipelineState):
1990         (WebCore::GPURenderPipelineState::label):
1991         (WebCore::GPURenderPipelineState::setLabel):
1992         * platform/graphics/gpu/GPURenderPipelineState.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
1993         * platform/graphics/gpu/GPUTexture.cpp:
1994         (WebCore::GPUTexture::createFromDrawable):
1995         (WebCore::GPUTexture::createFromExistingTexture): Deleted.
1996         * platform/graphics/gpu/GPUTexture.h:
1997         * platform/graphics/gpu/GPUTextureDescriptor.cpp:
1998         * platform/graphics/gpu/GPUTextureDescriptor.h:
1999
2000 2017-03-12  Zalan Bujtas  <zalan@apple.com>
2001
2002         Simple line layout: Paginated content is not painted properly when font overflows line height.
2003         https://bugs.webkit.org/show_bug.cgi?id=169516
2004
2005         Reviewed by Antti Koivisto.
2006
2007         adjustLineIndexForStruts should take the IndexType::First/Last into account
2008         when searching for the line index in a paginated context.
2009         This also changes the the computed offset height from m_lineHeight to m_ascent + m_descent
2010         so that we can find lines with large fonts (but small line height).
2011
2012         Test: fast/multicol/simple-line-layout-line-index-after-strut.html
2013
2014         * rendering/SimpleLineLayoutResolver.cpp:
2015         (WebCore::SimpleLineLayout::RunResolver::adjustLineIndexForStruts):
2016         (WebCore::SimpleLineLayout::RunResolver::lineIndexForHeight):
2017         (WebCore::SimpleLineLayout::RunResolver::rangeForRect):
2018         * rendering/SimpleLineLayoutResolver.h:
2019
2020 2017-03-12  Brady Eidson  <beidson@apple.com>
2021
2022         Add full NSHTTPCookie fidelity to WebCore::Cookie.
2023         https://bugs.webkit.org/show_bug.cgi?id=169514
2024
2025         Reviewed by Dean Jackson.
2026
2027         No new tests (Refactor, no testable behavior change for now).
2028
2029         * platform/Cookie.h:
2030         (WebCore::Cookie::Cookie):
2031         (WebCore::Cookie::encode):
2032         (WebCore::Cookie::decode):
2033         
2034         * platform/network/cocoa/CookieCocoa.mm:
2035         (WebCore::portVectorFromList):
2036         (WebCore::portStringFromVector):
2037         (WebCore::Cookie::Cookie):
2038         (WebCore::Cookie::operator NSHTTPCookie *):
2039         
2040         * platform/network/mac/CookieJarMac.mm:
2041         (WebCore::getRawCookies):
2042
2043 2017-03-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
2044
2045         REGRESSION (r213764): Async image decoding is disabled for animated images
2046         https://bugs.webkit.org/show_bug.cgi?id=169529
2047
2048         Reviewed by Jon Lee.
2049         
2050         The change r213764 causes the animated images to be decoded synchronously
2051         because we were calling frameImageAtIndex() with an empty sizeForDrawing
2052         but with a valid subsamplingLevel. This call is translated to be synchronous
2053         image decoding. The fix is get the current image frame without any decoding.
2054         This is because are sure that in the case of animated image, the current
2055         image frame can not be deleted.
2056
2057         * platform/graphics/BitmapImage.cpp:
2058         (WebCore::BitmapImage::draw):
2059
2060 2017-03-12  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2061
2062         [Readable Streams API] Implement ReadableStreamBYOBRequest respond() (closed stream state)
2063         https://bugs.webkit.org/show_bug.cgi?id=168781
2064
2065         Reviewed by Youenn Fablet.
2066
2067         Implemented ReadableStreamBYOBRequest respond() method in the case of a closed stream.
2068
2069         Added tests related to respond() method and updated WPT imported tests expectations.
2070
2071         * Modules/streams/ReadableByteStreamInternals.js:
2072         (readableByteStreamControllerRespond): Added.
2073         (readableByteStreamControllerRespondInternal): Added.
2074         (readableByteStreamControllerRespondInClosedState): Added.
2075         (readableByteStreamControllerShiftPendingPullInto): Added.
2076         (readableByteStreamControllerInvalidateBYOBRequest): Added.
2077         (readableByteStreamControllerCommitPullIntoDescriptor): Added.
2078         (readableByteStreamControllerConvertPullIntoDescriptor): Added.
2079         (readableStreamFulfillReadIntoRequest): Added.
2080         * Modules/streams/ReadableStreamBYOBRequest.js:
2081         (respond): Implemented.
2082
2083 2017-03-11  Simon Fraser  <simon.fraser@apple.com>
2084
2085         Fix memory estimate for layers supporting subpixel-antialised text
2086         https://bugs.webkit.org/show_bug.cgi?id=169507
2087         rdar://problem/30979337
2088
2089         Reviewed by Alexey Proskuryakov.
2090
2091         Deep color layers on iOS use 5 bytes per pixel, layers supporting subpixel-antialiaed 
2092         text on Mac use 8 bytes per pixel.
2093
2094         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
2095         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2096         (PlatformCALayerCocoa::backingStoreBytesPerPixel):
2097
2098 2017-03-11  Youenn Fablet  <youenn@apple.com>
2099
2100         XMLHttpRequest: make setRequestHeader() use `, ` as separator (including a space)
2101         https://bugs.webkit.org/show_bug.cgi?id=169285
2102
2103         Reviewed by Sam Weinig.
2104
2105         Covered by updated tests.
2106
2107         * platform/network/HTTPHeaderMap.cpp:
2108         (WebCore::HTTPHeaderMap::add): Reverting back to ', '.
2109
2110 2017-03-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
2111
2112         Enable async image decoding for large images
2113         https://bugs.webkit.org/show_bug.cgi?id=165039
2114
2115         Reviewed by Simon Fraser.
2116
2117         When BitmapImage::draw() is called for a large image, we are going to request async
2118         image decoding for the native image instead of drawing it. If a lower resolution 
2119         native image is available for this, it is going to be drawn. Otherwise nothing will
2120         be drawn. In both cases, a repaint will be scheduled for the image observer. This
2121         should improve the image first time paint and the scrolling scenarios. It also makes
2122         the scrolling more responsive by removing the decoding step from the main thread. 
2123         
2124         For now we are going to disable the asynchronous image decoding for the webkit test
2125         runner because drawing the image does not block the page rendering anymore. An image
2126         can be repainted later when its frame is ready for painting. This can cause a test
2127         to fail because the webkit test runner may capture an image for the page before painting
2128         all the images. The asynchronous image decoding can to be explicitly enabled from
2129         the test page. Once the specs of the image 'async' attribute and 'ready' event is
2130         approved, this should be revisited. It is important to test what we ship and eventually
2131         async image decoding should be enabled in the webkit test runner.
2132
2133         * loader/cache/CachedImage.h: Change the default of LargeImageAsyncDecoding and AnimatedImageAsyncDecoding
2134         to be false. This change fixes a layout test which creates an CachedImage inside an ImageDocument. The
2135         CachedImage in this case does not have a loader so getting the values of these options from the settings
2136         which is false for the DRT/WTR did not happen.
2137         * platform/graphics/BitmapImage.cpp:
2138         (WebCore::BitmapImage::destroyDecodedData): ImageSource::hasDecodingQueue() is renamed to ImageSource::hasAsyncDecodingQueue().
2139         (WebCore::BitmapImage::frameImageAtIndex): Use String::utf8().data() instead of String::characters8().
2140         (WebCore::BitmapImage::draw): If drawing the current frame is called while it is being
2141         decoded, draw the current native image if the current frame was decoded but for a 
2142         different size  and and will not invoke decoding while painting. If the frame is being
2143         decoded and there isn't a decoded frame, return without drawing but set a flag that
2144         that this image needs a repaint.
2145         (WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImage): Renaming a function.
2146         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImage): Ditto.
2147         (WebCore::BitmapImage::internalStartAnimation): Use String::utf8().data() instead of String::characters8().
2148         (WebCore::BitmapImage::advanceAnimation): Ditto.
2149         (WebCore::BitmapImage::internalAdvanceAnimation): Ditto.
2150         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Now this callback can be
2151         called form the ImageFrameCache when finishing a frame of an animated image or the
2152         frame of a large image. For large images, we need to call CachedImage::changedInRect()
2153         if this image needs a repaint. If the decoding queue is idle, we should close it.
2154         (WebCore::BitmapImage::isLargeImageAsyncDecodingRequired): Deleted. Function was renamed.
2155         (WebCore::BitmapImage::isAnimatedImageAsyncDecodingRequired): Deleted. Ditto.
2156         * platform/graphics/BitmapImage.h:
2157
2158         * platform/graphics/ImageFrameCache.cpp:
2159         (WebCore::ImageFrameCache::~ImageFrameCache): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
2160         (WebCore::ImageFrameCache::decodingQueue): Change the QNS of the decoding thread to be WorkQueue::QOS::Default.
2161         WorkQueue::QOS::UserInteractive causes the scrolling thread to preempted  which can make the scrolling choppy.
2162         (WebCore::ImageFrameCache::startAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
2163         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Ditto.
2164         (WebCore::ImageFrameCache::isAsyncDecodingQueueIdle): A helper function to tell whether the decoding thread is idle.
2165         (WebCore::ImageFrameCache::stopAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
2166         * platform/graphics/ImageFrameCache.h:
2167         (WebCore::ImageFrameCache::hasAsyncDecodingQueue): Rename this function to be consistent with the rest of the functions.
2168         (WebCore::ImageFrameCache::hasDecodingQueue): Deleted.
2169
2170         * platform/graphics/ImageSource.cpp:
2171         (WebCore::ImageSource::shouldUseAsyncDecoding): Renaming a function. Change the heuristic for large images be
2172         a little bigger than the heuristic for animated images.
2173         (WebCore::ImageSource::isAsyncDecodingRequired): Deleted.
2174         * platform/graphics/ImageSource.h:
2175         (WebCore::ImageSource::hasAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
2176         (WebCore::ImageSource::isAsyncDecodingQueueIdle): A wrapper for ImageFrameCache::isAsyncDecodingQueueIdle().
2177         (WebCore::ImageSource::hasDecodingQueue): Deleted.
2178         
2179         * platform/graphics/cg/ImageDecoderCG.cpp:
2180         (WebCore::ImageDecoder::createFrameImageAtIndex): CGImageSourceCreateThumbnailAtIndex() returns a CGImage with
2181         the image native size regardless of the subsamplingLevel unless kCGImageSourceSubsampleFactor is passed. Here
2182         we are trying to see which size is smaller: the image native size or the sizeForDrawing. If we want a CGImage
2183         with the image native size, sizeForDrawing will not passed. So we need to get the image native size with the
2184         default subsampling and then compare it with sizeForDrawing.
2185
2186 2017-03-11  Jon Lee  <jonlee@apple.com>
2187
2188         WebGPU prototype - Front-End
2189         https://bugs.webkit.org/show_bug.cgi?id=167952
2190
2191         Reviewed by Dean Jackson.
2192
2193         This patch adds all of the relevant front-end files, and builds successfully when
2194         ENABLE(WEBGPU) is off. For the back-end components that are not yet
2195         implemented, a stub was added with a FIXME.
2196
2197         * DerivedSources.make: Add all the new IDL files.
2198         * WebCore.xcodeproj/project.pbxproj: New IDL, front-end and generated files.
2199
2200         JS custom bindings.
2201         * bindings/js/JSDocumentCustom.cpp: Add WebGPU clause for getCSSCanvasContext.
2202         * bindings/js/JSHTMLCanvasElementCustom.cpp:
2203         (WebCore::JSHTMLCanvasElement::getContext):
2204         * bindings/js/JSWebGPURenderPassAttachmentDescriptorCustom.cpp: Added.
2205         * bindings/js/JSWebGPURenderingContextCustom.cpp: Added.
2206         * html/HTMLCanvasElement.cpp:
2207         (WebCore::HTMLCanvasElement::getContext):
2208         (WebCore::HTMLCanvasElement::isWebGPUType):
2209         (WebCore::HTMLCanvasElement::getContextWebGPU):
2210         (WebCore::HTMLCanvasElement::reset):
2211         (WebCore::HTMLCanvasElement::paint):
2212         (WebCore::HTMLCanvasElement::isGPU):
2213         (WebCore::HTMLCanvasElement::getContextWebGPU): For release builds, switch to ASSERT_UNUSED.
2214         * html/HTMLCanvasElement.h:
2215         * html/canvas/CanvasRenderingContext.h:
2216         (WebCore::CanvasRenderingContext::isGPU):
2217
2218         .cpp, .h, .idl files, wrapped in WEBGPU conditional, and enabled at runtime.
2219         * html/canvas/WebGPUBuffer:
2220         * html/canvas/WebGPUCommandBuffer:
2221         * html/canvas/WebGPUCommandQueue:
2222         * html/canvas/WebGPUDepthStencilDescriptor:
2223         * html/canvas/WebGPUDepthStencilState:
2224         * html/canvas/WebGPUDrawable:
2225         * html/canvas/WebGPUEnums:
2226         * html/canvas/WebGPUFunction:
2227         * html/canvas/WebGPULibrary:
2228         * html/canvas/WebGPUObject (no IDL):
2229         * html/canvas/WebGPURenderCommandEncoder:
2230         * html/canvas/WebGPURenderPassAttachmentDescriptor:
2231         * html/canvas/WebGPURenderPassColorAttachmentDescriptor:
2232         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor:
2233         * html/canvas/WebGPURenderPassDescriptor:
2234         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor:
2235         * html/canvas/WebGPURenderPipelineDescriptor:
2236         * html/canvas/WebGPURenderPipelineState:
2237         * html/canvas/WebGPURenderingContext:
2238         * html/canvas/WebGPUTexture:
2239         * html/canvas/WebGPUTextureDescriptor:  Add stubs.
2240
2241 2017-03-11  Brady Eidson  <beidson@apple.com>
2242
2243         Cleanup "addCookie" and its sole user.
2244         https://bugs.webkit.org/show_bug.cgi?id=169486
2245
2246         Reviewed by Brian Burg.
2247
2248         No new tests (Refactor, no behavior change)
2249
2250         * WebCore.xcodeproj/project.pbxproj:
2251
2252         * loader/CookieJar.cpp:
2253         (WebCore::addCookie): Deleted.
2254         * loader/CookieJar.h:
2255
2256         * platform/Cookie.h:
2257         (WebCore::Cookie::Cookie):
2258         (WebCore::CookieHash::hash):
2259         (WebCore::CookieHash::equal):
2260         (WebCore::Cookie::encode):
2261         (WebCore::Cookie::decode):
2262
2263         * platform/CookiesStrategy.h:
2264
2265         * platform/network/NetworkStorageSession.h:
2266
2267         * platform/network/PlatformCookieJar.h:
2268
2269         * platform/network/cf/CookieJarCFNet.cpp:
2270         (WebCore::addCookie): Deleted.
2271
2272         * platform/network/cocoa/CookieCocoa.mm: Copied from Source/WebCore/loader/CookieJar.h.
2273         (WebCore::Cookie::operator NSHTTPCookie *):
2274
2275         * platform/network/cocoa/NetworkStorageSessionCocoa.mm: Copied from Source/WebCore/loader/CookieJar.h.
2276         (WebCore::NetworkStorageSession::setCookies):
2277         (WebCore::NetworkStorageSession::nsCookieStorage):
2278
2279         * platform/network/curl/CookieJarCurl.cpp:
2280         (WebCore::addCookie): Deleted.
2281
2282         * platform/network/mac/CookieJarMac.mm:
2283         (WebCore::deleteCookiesForHostnames):
2284         (WebCore::deleteAllCookiesModifiedSince):
2285         (WebCore::addCookie): Deleted.
2286         (WebCore::cookieStorage): Deleted.
2287
2288         * platform/network/soup/CookieJarSoup.cpp:
2289         (WebCore::toSoupCookie): Deleted.
2290         (WebCore::addCookie): Deleted.
2291
2292         * platform/network/soup/NetworkStorageSessionSoup.cpp:
2293         (WebCore::toSoupCookie):
2294         (WebCore::NetworkStorageSession::setCookies):
2295
2296 2017-03-10  Alex Christensen  <achristensen@webkit.org>
2297
2298         Fix watch and tv builds after r213294
2299         https://bugs.webkit.org/show_bug.cgi?id=169508
2300
2301         Reviewed by Dan Bernstein.
2302
2303         * Configurations/FeatureDefines.xcconfig:
2304
2305 2017-03-10  Dave Hyatt  <hyatt@apple.com>
2306
2307         Percentage constrained images shrinking inside blocks inside nested flex boxes
2308         https://bugs.webkit.org/show_bug.cgi?id=169438
2309
2310         Reviewed by Dean Jackson.
2311
2312         Added new test in fast/hidpi.
2313
2314         * rendering/RenderBlock.cpp:
2315         (WebCore::RenderBlock::computeChildPreferredLogicalWidths):
2316         Make sure to clear out flexbox override sizes when computing preferred logical widths,
2317         since they should not ever influence the preferred size.
2318
2319 2017-03-10  Youenn Fablet  <youenn@apple.com>
2320
2321         Move libwebrtc backend to using tracks
2322         https://bugs.webkit.org/show_bug.cgi?id=169472
2323
2324         Reviewed by Alex Christensen.
2325
2326         Covered by current test sets.
2327
2328         This change allows to move away from streams and use more tracks.
2329         This allows future better alignment with the spec and better implementation of sender/receover/transceiver.
2330
2331         Small refactoring to use more Ref<> in WebRTC track-based code.
2332         Added a notifyAddedTrack to notify the backend that a track was added.
2333         For libwebrtc, this allows calling AddTrack before making the offer.
2334         Updated mock libwebrtc backend accordingly.
2335
2336         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2337         (WebCore::MediaEndpointPeerConnection::replaceTrack):
2338         (WebCore::MediaEndpointPeerConnection::replaceTrackTask):
2339         * Modules/mediastream/MediaEndpointPeerConnection.h:
2340         * Modules/mediastream/PeerConnectionBackend.h:
2341         (WebCore::PeerConnectionBackend::notifyAddedTrack):
2342         * Modules/mediastream/RTCPeerConnection.cpp:
2343         (WebCore::RTCPeerConnection::addTrack):
2344         (WebCore::RTCPeerConnection::replaceTrack):
2345         * Modules/mediastream/RTCPeerConnection.h:
2346         * Modules/mediastream/RTCRtpSender.cpp:
2347         (WebCore::RTCRtpSender::create):
2348         (WebCore::RTCRtpSender::RTCRtpSender):
2349         (WebCore::RTCRtpSender::setTrack):
2350         * Modules/mediastream/RTCRtpSender.h:
2351         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2352         (WebCore::LibWebRTCMediaEndpoint::addTrack):
2353         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
2354         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
2355         (WebCore::LibWebRTCMediaEndpoint::getStats):
2356         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2357         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2358         (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate):
2359         (WebCore::LibWebRTCPeerConnectionBackend::notifyAddedTrack):
2360         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2361         * testing/MockLibWebRTCPeerConnection.cpp:
2362         (WebCore::MockLibWebRTCPeerConnection::AddTrack):
2363         (WebCore::MockLibWebRTCPeerConnection::RemoveTrack):
2364         (WebCore::MockLibWebRTCPeerConnection::CreateOffer):
2365         (WebCore::MockLibWebRTCPeerConnection::CreateAnswer):
2366         * testing/MockLibWebRTCPeerConnection.h:
2367         (WebCore::MockRtpSender::MockRtpSender):
2368         (WebCore::MockRtpSender::ssrc):
2369         (WebCore::MockRtpSender::media_type):
2370         (WebCore::MockRtpSender::id):
2371         (WebCore::MockRtpSender::stream_ids):
2372         (WebCore::MockRtpSender::GetParameters):
2373         (WebCore::MockRtpSender::SetParameters):
2374         (WebCore::MockRtpSender::GetDtmfSender):
2375
2376 2017-03-10  Zalan Bujtas  <zalan@apple.com>
2377
2378         Simple line layout: Check how many orphans needed on the current page before breaking.
2379         https://bugs.webkit.org/show_bug.cgi?id=169477
2380
2381         Reviewed by Antti Koivisto.
2382
2383         Before breaking for the widows we actually need to check for orphans first.
2384
2385         Test: fast/multicol/simple-line-layout-orphans-and-widows.html
2386
2387         * rendering/SimpleLineLayoutPagination.cpp:
2388         (WebCore::SimpleLineLayout::computeLineBreakIndex):
2389         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
2390
2391 2017-03-10  Dean Jackson  <dino@apple.com>
2392
2393         WebGPU: Backend - Textures and TextureDescriptors
2394         https://bugs.webkit.org/show_bug.cgi?id=169365
2395         <rdar://problem/30928716>
2396
2397         Reviewed by Jon Lee with help from Anders Carlsson.
2398
2399         Backend implementation of textures for WebGPU, which adds
2400         the GPUTexture and GPUTextureDescriptor classes, as well
2401         as a creation method on GPUDevice.
2402
2403         * PlatformMac.cmake:
2404         * WebCore.xcodeproj/project.pbxproj:
2405         * platform/graphics/cocoa/GPUTextureDescriptorMetal.mm: Added.
2406         (WebCore::GPUTextureDescriptor::GPUTextureDescriptor):
2407         (WebCore::GPUTextureDescriptor::width):
2408         (WebCore::GPUTextureDescriptor::setWidth):
2409         (WebCore::GPUTextureDescriptor::height):
2410         (WebCore::GPUTextureDescriptor::setHeight):
2411         (WebCore::GPUTextureDescriptor::sampleCount):
2412         (WebCore::GPUTextureDescriptor::setSampleCount):
2413         (WebCore::GPUTextureDescriptor::textureType):
2414         (WebCore::GPUTextureDescriptor::setTextureType):
2415         (WebCore::GPUTextureDescriptor::storageMode):
2416         (WebCore::GPUTextureDescriptor::setStorageMode):
2417         (WebCore::GPUTextureDescriptor::usage):
2418         (WebCore::GPUTextureDescriptor::setUsage):
2419         (WebCore::GPUTextureDescriptor::platformTextureDescriptor):
2420         * platform/graphics/cocoa/GPUTextureMetal.mm:
2421         (WebCore::GPUTexture::GPUTexture):
2422         (WebCore::GPUTexture::width):
2423         (WebCore::GPUTexture::height):
2424         (WebCore::GPUTexture::platformTexture):
2425         * platform/graphics/gpu/GPUDevice.cpp:
2426         (WebCore::GPUDevice::createTexture):
2427         * platform/graphics/gpu/GPUDevice.h:
2428         * platform/graphics/gpu/GPUTexture.cpp:
2429         (WebCore::GPUTexture::create):
2430         (WebCore::GPUTexture::createFromExistingTexture):
2431         (WebCore::GPUTexture::~GPUTexture):
2432         (WebCore::GPUTexture::width):
2433         (WebCore::GPUTexture::height):
2434         * platform/graphics/gpu/GPUTexture.h:
2435         * platform/graphics/gpu/GPUTextureDescriptor.cpp:
2436         (WebCore::GPUTextureDescriptor::create):
2437         (WebCore::GPUTextureDescriptor::~GPUTextureDescriptor):
2438         (WebCore::GPUTextureDescriptor::width):
2439         (WebCore::GPUTextureDescriptor::setWidth):
2440         (WebCore::GPUTextureDescriptor::height):
2441         (WebCore::GPUTextureDescriptor::setHeight):
2442         (WebCore::GPUTextureDescriptor::sampleCount):
2443         (WebCore::GPUTextureDescriptor::setSampleCount):
2444         (WebCore::GPUTextureDescriptor::textureType):
2445         (WebCore::GPUTextureDescriptor::setTextureType):
2446         (WebCore::GPUTextureDescriptor::storageMode):
2447         (WebCore::GPUTextureDescriptor::setStorageMode):
2448         (WebCore::GPUTextureDescriptor::usage):
2449         (WebCore::GPUTextureDescriptor::setUsage):
2450         * platform/graphics/gpu/GPUTextureDescriptor.h:
2451
2452 2017-03-10  Per Arne Vollan  <pvollan@apple.com>
2453
2454         [Win] Scrollbars buttons have incorrect size in HiDPI.
2455         https://bugs.webkit.org/show_bug.cgi?id=169463
2456
2457         Reviewed by Alex Christensen.
2458
2459         There seems to be a bug in DrawThemeBackground when the device context is scaled.
2460         We can work around this by scaling the drawing rectangle instead.
2461  
2462         * platform/win/ScrollbarThemeWin.cpp:
2463         (WebCore::ScrollbarThemeWin::paintButton):
2464
2465 2017-03-10  Zalan Bujtas  <zalan@apple.com>
2466
2467         Simple line layout: Oprhan lines with visual overflow does not work properly.
2468         https://bugs.webkit.org/show_bug.cgi?id=169409
2469
2470         Reviewed by Antti Koivisto.
2471
2472         Add visual overflow checking for block strut. This logic is copied from RenderBlockFlow::adjustLinePositionForPagination.
2473
2474         Covered by existing test.
2475
2476         * rendering/SimpleLineLayoutFunctions.cpp:
2477         (WebCore::SimpleLineLayout::computeOverflow):
2478         * rendering/SimpleLineLayoutFunctions.h:
2479         * rendering/SimpleLineLayoutPagination.cpp:
2480         (WebCore::SimpleLineLayout::setPageBreakForLine):
2481
2482 2017-03-09  Simon Fraser  <simon.fraser@apple.com>
2483
2484         [iOS WK2] Layer content blurry with nested perspective and transforms
2485         https://bugs.webkit.org/show_bug.cgi?id=169457
2486         rdar://problem/29879484
2487
2488         Reviewed by Tim Horton.
2489
2490         We set rasterizationScale on CALayers to the same values as contentsScale, to
2491         avoid blurry layers when CA rasterizes, which often happens with nested perspective
2492         transforms.
2493         
2494         However, in UI-side compositing, if the page is not zoomed, we never applied the
2495         rasterizationScale in the UI process. This happened because the PlatformCALayerRemote
2496         constructor set m_properties.contentsScale, but did not set the dirty bit that
2497         triggers the application of contentsScale and rasterizationScale in RemoteLayerTreePropertyApplier.
2498         The fix is to set this dirty bit.
2499         
2500         The rest of the changes are for testing. Internals now exposes layerIDForElement()
2501         for returns an internal (non-stable-across-loads) layerID, which can be passed
2502         to UIScriptController.propertiesOfLayerWithID() in the UI process, which inspects
2503         the built layer (UIView) hierarchy. propertiesOfLayerWithID() returns a dictionary
2504         which the test can dump as JSON, or pull values out of.
2505
2506         A few #pragma once cleanups also.
2507
2508         Tests: compositing/ios/basic-layer-properties.html
2509                compositing/ios/rasterization-scale.html
2510
2511         * testing/Internals.cpp:
2512         (WebCore::Internals::layerIDForElement):
2513         * testing/Internals.h:
2514         * testing/Internals.idl:
2515
2516 2017-03-10  Commit Queue  <commit-queue@webkit.org>
2517
2518         Unreviewed, rolling out r213618.
2519         https://bugs.webkit.org/show_bug.cgi?id=169475
2520
2521         Suspect this is the cause of a large memory regression
2522         (Requested by jonlee_ on #webkit).
2523
2524         Reverted changeset:
2525
2526         "Enable async image decoding for large images"
2527         https://bugs.webkit.org/show_bug.cgi?id=165039
2528         http://trac.webkit.org/changeset/213618
2529
2530 2017-03-10  Antti Koivisto  <antti@apple.com>
2531
2532         Allow the page to render before <link> stylesheet tags in body
2533         https://bugs.webkit.org/show_bug.cgi?id=149157
2534         <rdar://problem/24658830>
2535
2536         Reviewed by Simon Fraser.
2537
2538         Currently we block style and renderer building completely if document has any loading
2539         stylesheets. In case a script queries something layout dependent we construct the render
2540         tree with whatever style we have but block painting in it.
2541
2542         This patch changes behavior so that a loading stylesheet in body only blocks rendering for elements
2543         that are after it. The expectation is that such stylesheets rarely affect elements before them
2544         and the elements can be rendered without causing ugly visible styling changes.
2545
2546         The patch replaces the old flash-of-unstyled-content (FOUC) preventation mechanism with a more
2547         fine-grained one. Paint blocking is now done on per-renderer basis with based on isNonFinal flag in
2548         RenderStyle.
2549
2550         For stylesheets in head the behavior should be largely unchanged.
2551
2552         Test: http/tests/incremental/stylesheet-body-incremental-rendering.html
2553
2554         * css/StyleResolver.cpp:
2555         (WebCore::StyleResolver::pseudoStyleRulesForElement):
2556         * dom/Document.cpp:
2557         (WebCore::Document::Document):
2558         (WebCore::Document::resolveStyle):
2559         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
2560
2561             Remove the old FOUC preventation state tracking.
2562
2563         (WebCore::Document::shouldScheduleLayout):
2564         (WebCore::Document::didRemoveAllPendingStylesheet):
2565
2566             Repaints will now get triggered by the normal style mechanism.
2567
2568         * dom/Document.h:
2569         (WebCore::Document::hasNodesWithNonFinalStyle):
2570         (WebCore::Document::setHasNodesWithNonFinalStyle):
2571
2572             Track if we need to recompute the style later because non-final or unstyled elements.
2573
2574         (WebCore::Document::didLayoutWithPendingStylesheets): Deleted.
2575         (WebCore::Document::hasNodesWithPlaceholderStyle): Deleted.
2576         (WebCore::Document::setHasNodesWithPlaceholderStyle): Deleted.
2577         * html/HTMLFrameSetElement.cpp:
2578         (WebCore::HTMLFrameSetElement::rendererIsNeeded):
2579         * page/FrameView.cpp:
2580         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty):
2581
2582             Don't qualify as visually non-empty if we have loading stylesheets in head (even if there is
2583             a fouc-prevented render tree).
2584
2585         (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
2586         * rendering/RenderBlock.cpp:
2587         (WebCore::RenderBlock::paintContents):
2588
2589             Instead of a global test, block painting if isNonFinal is set in the renderer's style.
2590
2591         * rendering/RenderLayer.cpp:
2592         (WebCore::shouldSuppressPaintingLayer):
2593         * rendering/style/RenderStyle.cpp:
2594         (WebCore::RenderStyle::changeRequiresRepaint):
2595
2596             The isNonFinal flag prevents painting so we need to trigger repaint when it gets cleared.
2597
2598         * rendering/style/RenderStyle.h:
2599         (WebCore::RenderStyle::isNotFinal):
2600         (WebCore::RenderStyle::setIsNotFinal):
2601         (WebCore::RenderStyle::isPlaceholderStyle): Deleted.
2602         (WebCore::RenderStyle::setIsPlaceholderStyle): Deleted.
2603
2604             There is no need for placeholder styles anymore. Reuse the bit for isNotFinal.
2605
2606         * rendering/style/StyleRareNonInheritedData.cpp:
2607         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
2608         (WebCore::StyleRareNonInheritedData::operator==):
2609         * rendering/style/StyleRareNonInheritedData.h:
2610         * style/StyleScope.cpp:
2611         (WebCore::Style::Scope::analyzeStyleSheetChange):
2612         (WebCore::Style::Scope::updateActiveStyleSheets):
2613         * style/StyleTreeResolver.cpp:
2614         (WebCore::Style::TreeResolver::styleForElement):
2615         (WebCore::Style::TreeResolver::resolveElement):
2616
2617             If we have seens a loading stylesheet and don't have a renderer yet don't style the element.
2618             In case there is a renderer or we are ignoring pending sheets, resolve the style normally
2619             but mark it as non-final.
2620
2621         (WebCore::Style::makePlaceholderStyle): Deleted.
2622
2623 2017-03-10  Antti Koivisto  <antti@apple.com>
2624
2625         imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute.html is unreliable
2626         https://bugs.webkit.org/show_bug.cgi?id=169465
2627
2628         Reviewed by Zalan Bujtas.
2629
2630         It shows all subtests passing but that is a bug. We don't even support all the unit types.
2631         The test occasionally fails when reloading, that failing results are actually the correct ones.
2632
2633         * css/parser/SizesAttributeParser.cpp:
2634         (WebCore::SizesAttributeParser::SizesAttributeParser):
2635
2636             Ensure we have correct size for the iframe before parsing 'sizes' attribute values. The interpretation of
2637             these may depend on the iframe dimensions.
2638
2639 2017-03-10  Antoine Quint  <graouts@apple.com>
2640
2641         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
2642         https://bugs.webkit.org/show_bug.cgi?id=168409
2643
2644         Unreviewed.
2645
2646         Add some debugging in the hope of understanding why airplay-button.html fails once a day on bots.
2647
2648         * Modules/modern-media-controls/controls/scheduler.js:
2649         (const.scheduler.new.prototype.scheduleLayout):
2650         (const.scheduler.new.prototype.unscheduleLayout):
2651         (const.scheduler.new.prototype._requestFrameIfNeeded):
2652         (const.scheduler.new.prototype._frameDidFire):
2653         (const.scheduler.new.prototype._layout):
2654
2655 2017-03-09  Ryan Haddad  <ryanhaddad@apple.com>
2656
2657         Unreviewed, rolling out r213633.
2658
2659         This change caused LayoutTest imported/w3c/web-platform-
2660         tests/html/semantics/embedded-content/the-img-
2661         element/sizes/parse-a-sizes-attribute.html to become a flaky
2662         failure.
2663
2664         Reverted changeset:
2665
2666         "Loading in-body stylesheets should not block rendering of
2667         elements before them"
2668         https://bugs.webkit.org/show_bug.cgi?id=169345
2669         http://trac.webkit.org/changeset/213633
2670
2671 2017-03-09  Alex Christensen  <achristensen@webkit.org>
2672
2673         Fix CMake build
2674
2675         * PlatformMac.cmake:
2676
2677 2017-03-09  Alex Christensen  <achristensen@webkit.org>
2678
2679         Fix GTK build after r213696
2680
2681         * PlatformMac.cmake:
2682
2683 2017-03-09  Brian Nicholson  <bnicholson@mozilla.com> and Alex Christensen  <achristensen@webkit.org>
2684
2685         Expose public APIs for content filters
2686         https://bugs.webkit.org/show_bug.cgi?id=150479
2687
2688         Reviewed by Brady Eidson and Geoff Garen.
2689
2690         * English.lproj/Localizable.strings:
2691
2692 2017-03-09  Matt Baker  <mattbaker@apple.com>
2693
2694         Web Inspector: Add XHR breakpoints UI
2695         https://bugs.webkit.org/show_bug.cgi?id=168763
2696         <rdar://problem/30952439>
2697
2698         Reviewed by Joseph Pecoraro.
2699
2700         Test: inspector/dom-debugger/xhr-breakpoints.html
2701
2702         * inspector/InspectorDOMDebuggerAgent.cpp:
2703         (WebCore::InspectorDOMDebuggerAgent::discardBindings):
2704         (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
2705         Don't break for XHRs when breakpoints are disabled.
2706
2707 2017-03-09  Michael Saboff  <msaboff@apple.com>
2708
2709         Add plumbing to WebProcess to enable JavaScriptCore configuration and logging
2710         https://bugs.webkit.org/show_bug.cgi?id=169387
2711
2712         Reviewed by Filip Pizlo.
2713
2714         Added a forwarding header file for JavScriptCore/runtime/ConfigFile.h.
2715
2716         * ForwardingHeaders/runtime/ConfigFile.h: Added.
2717
2718 2017-03-09  John Wilander  <wilander@apple.com>
2719
2720         Resource Load Statistics: Remove statistics data as part of full website data removal
2721         https://bugs.webkit.org/show_bug.cgi?id=169448
2722
2723         Reviewed by Alex Christensen.
2724
2725         Test: http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store.html
2726
2727         * loader/ResourceLoadObserver.cpp:
2728         (WebCore::ResourceLoadObserver::clearInMemoryAndPersistentStore):
2729             The version of this function that takes a modifiedSince parameter
2730             checks if it is equal to or less than the start of the Unix epoch.
2731             If so, it clears the store. This is to support clear all website
2732             data.
2733         * loader/ResourceLoadObserver.h:
2734         * loader/ResourceLoadStatisticsStore.cpp:
2735         (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent):
2736         (WebCore::ResourceLoadStatisticsStore::setWritePersistentStoreCallback):
2737         * loader/ResourceLoadStatisticsStore.h:
2738             Added m_writePersistentStoreHandler, a setter for it, and
2739             ResourceLoadStatisticsStore::clearInMemoryAndPersistent().
2740
2741 2017-03-09  Matt Rajca  <mrajca@apple.com>
2742
2743         Only consider autoplay interference in the first 10 seconds of playback.
2744         https://bugs.webkit.org/show_bug.cgi?id=169455
2745
2746         Reviewed by Alex Christensen.
2747
2748         If the media duration is relatively long, say, 10 minutes, and you pause 5 minutes in, that's
2749         probably not a strong indication users may not want auto-play. This patch limits interference
2750         events to the first 10 seconds of automatic playback.
2751
2752         * html/HTMLMediaElement.cpp:
2753         (WebCore::HTMLMediaElement::setReadyState):
2754         (WebCore::HTMLMediaElement::play):
2755         (WebCore::HTMLMediaElement::playInternal):
2756         (WebCore::HTMLMediaElement::pauseInternal):
2757         (WebCore::HTMLMediaElement::setMuted):
2758         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
2759         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
2760         (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay):
2761         (WebCore::HTMLMediaElement::setPlaybackWithoutUserGesture):
2762         (WebCore::HTMLMediaElement::pageMutedStateDidChange):
2763         * html/HTMLMediaElement.h:
2764
2765 2017-03-09  Brady Eidson  <beidson@apple.com>
2766
2767         Add WKURLSchemeHandler API for handling custom protocols.
2768         https://bugs.webkit.org/show_bug.cgi?id=169422
2769
2770         Reviewed by Tim Horton.
2771
2772         * platform/URLParser.cpp:
2773         (WebCore::URLParser::maybeCanonicalizeScheme):
2774         (WebCore::URLParser::isSpecialScheme):
2775         * platform/URLParser.h:
2776
2777 2017-03-09  Dean Jackson  <dino@apple.com>
2778
2779         WebGPU: Backend - Buffers
2780         https://bugs.webkit.org/show_bug.cgi?id=169451
2781         <rdar://problem/30959168>
2782
2783         Reviewed by Tim Horton.
2784
2785         Implement the backend for GPUBuffer, which
2786         represents a chunk of memory that can be used
2787         by the GPU. You create one using an ArrayBufferView.
2788
2789         WebKit API Test: GPUBuffer.mm
2790
2791         * PlatformMac.cmake:
2792         * WebCore.xcodeproj/project.pbxproj:
2793         * platform/graphics/cocoa/GPUBufferMetal.mm:
2794         (WebCore::GPUBuffer::GPUBuffer):
2795         (WebCore::GPUBuffer::length):
2796         (WebCore::GPUBuffer::contents):
2797         (WebCore::GPUBuffer::platformBuffer):
2798         * platform/graphics/gpu/GPUBuffer.cpp:
2799         (WebCore::GPUBuffer::create):
2800         (WebCore::GPUBuffer::~GPUBuffer):
2801         (WebCore::GPUBuffer::length):
2802         (WebCore::GPUBuffer::contents):
2803         * platform/graphics/gpu/GPUBuffer.h:
2804         * platform/graphics/gpu/GPUDevice.cpp:
2805         (WebCore::GPUDevice::createBufferFromData):
2806         * platform/graphics/gpu/GPUDevice.h:
2807
2808 2017-03-09  Joseph Pecoraro  <pecoraro@apple.com>
2809
2810         Web Inspector: Show HTTP protocol version and other Network Load Metrics (IP Address, Priority, Connection ID)
2811         https://bugs.webkit.org/show_bug.cgi?id=29687
2812         <rdar://problem/19281586>
2813
2814         Reviewed by Matt Baker and Brian Burg.
2815
2816         Test: http/tests/inspector/network/resource-metrics.html
2817
2818         * inspector/InspectorNetworkAgent.cpp:
2819         (WebCore::toProtocol):
2820         (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
2821         (WebCore::InspectorNetworkAgent::didFinishLoading):
2822         Send metrics at didFinishLoading time, we do not have all of
2823         these at didReceiveResponse time.
2824
2825         * inspector/InspectorInstrumentation.cpp:
2826         (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
2827         * inspector/InspectorInstrumentation.h:
2828         (WebCore::InspectorInstrumentation::didFinishLoading):
2829         * inspector/InspectorNetworkAgent.h:
2830         * loader/CrossOriginPreflightChecker.cpp:
2831         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
2832         * loader/DocumentLoader.cpp:
2833         (WebCore::DocumentLoader::finishedLoading):
2834         * loader/ResourceLoadNotifier.cpp:
2835         (WebCore::ResourceLoadNotifier::didFinishLoad):
2836         (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
2837         (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
2838         * loader/ResourceLoadNotifier.h:
2839         * loader/SubresourceLoader.cpp:
2840         (WebCore::SubresourceLoader::didFinishLoading):
2841         * loader/appcache/ApplicationCacheGroup.cpp:
2842         (WebCore::ApplicationCacheGroup::didFinishLoading):
2843         Include or pass on NetworkLoadMetrics to Web Inspector.
2844
2845         * platform/network/NetworkLoadMetrics.h:
2846         (WebCore::NetworkLoadMetrics::isolatedCopy):
2847         (WebCore::NetworkLoadMetrics::reset):
2848         (WebCore::NetworkLoadMetrics::operator==):
2849         (WebCore::NetworkLoadMetrics::encode):
2850         (WebCore::NetworkLoadMetrics::decode):
2851         Add new optional metrics properties.
2852
2853         (WTF::Persistence::Coder<std::optional<WebCore::NetworkLoadPriority>>::encode):
2854         (WTF::Persistence::Coder<std::optional<WebCore::NetworkLoadPriority>>::decode):
2855         We never encode this but this is needed for the compiler.
2856
2857         * platform/spi/cocoa/NSURLConnectionSPI.h:
2858         New SPI for NSURLSessionTaskTransactionMetrics details.
2859
2860 2017-03-09  Anders Carlsson  <andersca@apple.com>
2861
2862         Use the right conditional.
2863
2864         * Modules/applepay/ApplePayError.idl:
2865
2866 2017-03-09  Daniel Bates  <dabates@apple.com>
2867
2868         Guard Credential Management implementation behind a runtime enabled feature flag
2869         https://bugs.webkit.org/show_bug.cgi?id=169364
2870         <rdar://problem/30957425>
2871
2872         Reviewed by Brent Fulgham.
2873
2874         Add a runtime enabled feature flag for Credential Management (disabled by default).
2875         Once we are happy with this feature we can enable the feature by default or remove the
2876         the runtime enabled feature flag so as to enable it by default.
2877
2878         * Modules/credentials/BasicCredential.idl: Enable only if the runtime enabled feature flag is
2879          enabled.
2880         * Modules/credentials/PasswordCredential.idl: Ditto.
2881         * Modules/credentials/SiteBoundCredential.idl: Ditto.
2882         * page/RuntimeEnabledFeatures.h:
2883         (WebCore::RuntimeEnabledFeatures::setCredentialManagementEnabled): Added.
2884         (WebCore::RuntimeEnabledFeatures::credentialManagementEnabled): Added.
2885
2886 2017-03-09  Anders Carlsson  <andersca@apple.com>
2887
2888         Add delegate support to WebCore
2889         https://bugs.webkit.org/show_bug.cgi?id=169427
2890         Part of rdar://problem/28880714.
2891
2892         Reviewed by Geoffrey Garen.
2893
2894         * Configurations/FeatureDefines.xcconfig:
2895         Add feature define.
2896
2897         * DerivedSources.make:
2898         Add idl files.
2899
2900         * Modules/applepay/ApplePayError.cpp:
2901         (WebCore::ApplePayError::create):
2902         (WebCore::ApplePayError::ApplePayError):
2903         (WebCore::ApplePayError::~ApplePayError):
2904         * Modules/applepay/ApplePayError.h:
2905         * Modules/applepay/ApplePayError.idl:
2906         * Modules/applepay/ApplePayPaymentAuthorizationResult.h:
2907         * Modules/applepay/ApplePayPaymentAuthorizationResult.idl:
2908         * Modules/applepay/ApplePayPaymentMethodUpdate.h:
2909         * Modules/applepay/ApplePayPaymentMethodUpdate.idl:
2910         * Modules/applepay/ApplePayShippingContactUpdate.h:
2911         * Modules/applepay/ApplePayShippingContactUpdate.idl:
2912         * Modules/applepay/ApplePayShippingMethodUpdate.h:
2913         * Modules/applepay/ApplePayShippingMethodUpdate.idl:
2914         Add new files.
2915
2916         * Modules/applepay/ApplePaySession.cpp:
2917         (WebCore::toPaymentAuthorizationStatus):
2918         Move this function to the top.
2919
2920         (WebCore::convertAndValidate):
2921         Add new convertAndValidate functions.
2922
2923         (WebCore::ApplePaySession::completeShippingMethodSelection):
2924         (WebCore::ApplePaySession::completeShippingContactSelection):
2925         (WebCore::ApplePaySession::completePaymentMethodSelection):
2926         (WebCore::ApplePaySession::completePayment):
2927         * Modules/applepay/ApplePaySession.h:
2928         * Modules/applepay/ApplePaySession.idl:
2929         Implement the old functions in terms of the new functions.
2930
2931         * Modules/applepay/PaymentCoordinator.cpp:
2932         * WebCore.xcodeproj/project.pbxproj:
2933         Add new files.
2934
2935 2017-03-09  Yoav Weiss  <yoav@yoav.ws>
2936
2937         [link preload] Double downloads of preloaded CSS
2938         https://bugs.webkit.org/show_bug.cgi?id=169274
2939
2940         Reviewed by Antti Koivisto.
2941
2942         Avoid reloading link preloads in case of a charset mismatch.
2943
2944         Charset mismatch can happen for header based preloads, as they are requested before
2945         the HTML's `<meta charset>` tag is processed. This change makes sure that in those
2946         cases, we modify the resource's encoding setting instead of reloading it.
2947
2948         Test: http/tests/preload/single_download_preload_headers.php
2949
2950         * loader/cache/CachedResource.cpp:
2951         (WebCore::CachedResource::CachedResource): Initialize m_unknownCharset to be the same as the preload flag.
2952         * loader/cache/CachedResource.h:
2953         (WebCore::CachedResource::hasUnknownEncoding):
2954         (WebCore::CachedResource::setHasUnknownEncoding):
2955         * loader/cache/CachedResourceLoader.cpp:
2956         (WebCore::CachedResourceLoader::determineRevalidationPolicy): In case of a charset
2957         mismatch, set the encoding of the Resource instead of reloading it if the charset is unknown.
2958
2959 2017-03-09  Jiewen Tan  <jiewen_tan@apple.com>
2960
2961         Implement PBKDF2 in WebCrypto
2962         https://bugs.webkit.org/show_bug.cgi?id=143458
2963         <rdar://problem/27311703>
2964
2965         Reviewed by Brent Fulgham.
2966
2967         This patch implements PBKDF2 according to the spec:
2968         https://www.w3.org/TR/WebCryptoAPI/#pbkdf2. Supported
2969         operations include deriveKey, deriveBits, importKey and
2970         getKeyLength.
2971
2972         Tests: crypto/subtle/ecdh-import-key-derive-pbkdf2-key.html
2973                crypto/subtle/pbkdf2-derive-bits-malformed-parametrs.html
2974                crypto/subtle/pbkdf2-import-key-derive-bits.html
2975                crypto/subtle/pbkdf2-import-key-derive-hmac-key.html
2976                crypto/subtle/pbkdf2-import-key-malformed-parameters.html
2977                crypto/subtle/pbkdf2-import-key.html
2978                crypto/workers/subtle/pbkdf2-import-key-derive-bits.html
2979                crypto/workers/subtle/pbkdf2-import-key-derive-hmac-key.html
2980                crypto/workers/subtle/pbkdf2-import-key.html
2981
2982         * CMakeLists.txt:
2983         * DerivedSources.make:
2984         * PlatformGTK.cmake:
2985         * PlatformMac.cmake:
2986         * WebCore.xcodeproj/project.pbxproj:
2987         * bindings/js/JSCryptoKeyCustom.cpp:
2988         (WebCore::JSCryptoKey::algorithm):
2989         Added RawKeyAlgorithm.
2990         * bindings/js/JSSubtleCryptoCustom.cpp:
2991         (WebCore::normalizeCryptoAlgorithmParameters):
2992         A bit of reordering.
2993         * bindings/js/SerializedScriptValue.cpp:
2994         (WebCore::CloneSerializer::write):
2995         Faked implementation.
2996         * crypto/CryptoAlgorithmParameters.h:
2997         * crypto/CryptoKey.h:
2998         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp: Added.
2999         (WebCore::CryptoAlgorithmPBKDF2::create):
3000         (WebCore::CryptoAlgorithmPBKDF2::identifier):
3001         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
3002         (WebCore::CryptoAlgorithmPBKDF2::importKey):
3003         (WebCore::CryptoAlgorithmPBKDF2::getKeyLength):
3004         * crypto/algorithms/CryptoAlgorithmPBKDF2.h: Added.
3005         * crypto/gnutls/CryptoAlgorithmPBKDF2GnuTLS.cpp: Added.
3006         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
3007         * crypto/keys/CryptoKeyRaw.cpp: Added.
3008         (WebCore::CryptoKeyRaw::CryptoKeyRaw):
3009         (WebCore::CryptoKeyRaw::buildAlgorithm):
3010         (WebCore::CryptoKeyRaw::exportData):
3011         * crypto/keys/CryptoKeyRaw.h: Added.
3012         (WebCore::RawKeyAlgorithm::RawKeyAlgorithm):
3013         The CryptoKey class for PBKDF2 and later on HKDF.
3014         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp: Added.
3015         (WebCore::commonCryptoHMACAlgorithm):
3016         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
3017         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
3018         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
3019         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h: Added.
3020         * crypto/parameters/Pbkdf2Params.idl: Added.
3021
3022 2017-03-09  Antoine Quint  <graouts@apple.com>
3023
3024         [Modern Media Controls] iOS: long press on play button shows the Copy menu
3025         https://bugs.webkit.org/show_bug.cgi?id=169355
3026         <rdar://problem/30928998>
3027
3028         Reviewed by Dean Jackson.
3029
3030         Disable built-in UI behavior that shows a magnifier or a copy callout when pressing
3031         on an element for a long time. These do not make sense for media controls.
3032
3033         Test: media/modern-media-controls/audio/audio-controls-styles.html
3034
3035         * Modules/modern-media-controls/controls/media-controls.css:
3036         (:host):
3037
3038 2017-03-09  Alex Christensen  <achristensen@webkit.org>
3039
3040         [Content Extensions] Introduce if-top-url and unless-top-url
3041         https://bugs.webkit.org/show_bug.cgi?id=169433
3042
3043         Reviewed by Brady Eidson.
3044
3045         In r184116 I added if-domain and unless-domain to control whether a rule applies
3046         based on the domain of the main document URL.  I'm expanding this by adding if-top-url
3047         and unless-top-url that run regular expressions on the entire main document URL so that
3048         example.com/user1content can be distinguished from example.com/user2content.
3049         To not add to the number of passes we make on the URLs for each load and to maintain JSON
3050         backwards compatibility, I've made it so that if-top-url and unless-top-url can be used
3051         instead of if-domain and unless-domain (which continue to work) but the two condition types
3052         cannot be used together since running regular expressions on the entire main document URL
3053         is strictly more powerful than checking the domain and subdomains.
3054         As a minor detail, content extension regexes are by default ASCII-case-insensitive, so I've
3055         done the same with top URL regexes, adding top-url-filter-is-case-sensitive to mirror the existing
3056         url-filter-is-case-sensitive if the JSON author decides to make regexes case sensitive.
3057
3058         Covered by new API tests.
3059
3060         * contentextensions/CompiledContentExtension.h:
3061         * contentextensions/ContentExtension.cpp:
3062         (WebCore::ContentExtensions::ContentExtension::populateConditionCacheIfNeeded):
3063         (WebCore::ContentExtensions::ContentExtension::topURLActions):
3064         (WebCore::ContentExtensions::ContentExtension::cachedConditionedActions): Deleted.
3065         * contentextensions/ContentExtension.h:
3066         * contentextensions/ContentExtensionCompiler.cpp:
3067         (WebCore::ContentExtensions::addUniversalActionsToDFA):
3068         (WebCore::ContentExtensions::compileToBytecode):
3069         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.
3070         I moved them to one helper function that is called three times.
3071         (WebCore::ContentExtensions::compileRuleList):
3072         * contentextensions/ContentExtensionCompiler.h:
3073         * contentextensions/ContentExtensionError.cpp:
3074         (WebCore::ContentExtensions::contentExtensionErrorCategory):
3075         Add the new error type for JSON that tries to use if-top-url and unless-top-url with if-domain and unless-domain.
3076         * contentextensions/ContentExtensionError.h:
3077         * contentextensions/ContentExtensionParser.cpp:
3078         (WebCore::ContentExtensions::loadTrigger):
3079         Parse the new values if-top-url, unless-top-url, and top-url-filter-is-case-sensitive.
3080         * contentextensions/ContentExtensionRule.h:
3081         (WebCore::ContentExtensions::Trigger::~Trigger):
3082         * contentextensions/ContentExtensionsBackend.cpp:
3083         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
3084         * contentextensions/DFABytecodeInterpreter.cpp:
3085         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretAppendAction):
3086         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretTestFlagsAndAppendAction):
3087         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretWithConditions):
3088         * contentextensions/DFABytecodeInterpreter.h:
3089
3090 2017-03-09  Nikita Vasilyev  <nvasilyev@apple.com>
3091
3092         Web Inspector: Show individual messages in the content pane for a WebSocket
3093         https://bugs.webkit.org/show_bug.cgi?id=169011
3094
3095         Reviewed by Joseph Pecoraro.
3096
3097         Add walltime parameter.
3098
3099         No new tests. Tests will be added in a follow up patch.
3100
3101         * inspector/InspectorNetworkAgent.cpp:
3102         (WebCore::InspectorNetworkAgent::willSendWebSocketHandshakeRequest):
3103
3104 2017-03-09  Brent Fulgham  <bfulgham@apple.com>
3105
3106         Unreviewed build fix after r213628.
3107
3108         Use 'size_t' for the function definition to match the header file. If you do not,
3109         the 32-bit build fails..
3110
3111         * crypto/gnutls/CryptoAlgorithmECDHGnuTLS.cpp:
3112         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
3113
3114 2017-03-09  Wenson Hsieh  <wenson_hsieh@apple.com>
3115
3116         [WK2] Add a UI delegate hook for custom handling of data interaction operations
3117         https://bugs.webkit.org/show_bug.cgi?id=169430
3118         <rdar://problem/30954654>
3119
3120         Reviewed by Tim Horton.
3121
3122         Ensure that m_documentUnderMouse is properly cleaned up even in the case where no drag operation was performed
3123         due to the drop bailing at the client layer.
3124
3125         * page/DragController.cpp:
3126         (WebCore::DragController::dragEnded):
3127
3128 2017-03-08  Matt Rajca  <mrajca@apple.com>
3129
3130         Let clients control autoplay quirks with website policies.
3131         https://bugs.webkit.org/show_bug.cgi?id=169390
3132
3133         Reviewed by Wenson Hsieh.
3134
3135         Added API tests.
3136
3137         Many sites incorrectly assume media will start off playing and display a pause button from the
3138         start. We can trick many of these sites into updating their controls by sending a "pause"
3139         event when we prevent a media element from playing.
3140
3141         We don't want this to become standard web behavior, however, since ultimately sites should adapt
3142         to the new behavior. This patch lets clients decide which limited set of sites gets to use auto-play
3143         quirks.
3144
3145         * html/HTMLMediaElement.cpp:
3146         (WebCore::needsAutoplayPlayPauseEventsQuirk):
3147         * loader/DocumentLoader.h:
3148         (WebCore::DocumentLoader::allowsAutoplayQuirks):
3149         (WebCore::DocumentLoader::setAllowsAutoplayQuirks):
3150
3151 2017-03-09  Mark Lam  <mark.lam@apple.com>
3152
3153         Make the VM Traps mechanism non-polling for the DFG and FTL.
3154         https://bugs.webkit.org/show_bug.cgi?id=168920
3155         <rdar://problem/30738588>
3156
3157         Reviewed by Filip Pizlo.
3158
3159         No new tests needed.  This is covered by existing tests.
3160
3161         * bindings/js/WorkerScriptController.cpp:
3162         (WebCore::WorkerScriptController::WorkerScriptController):
3163         (WebCore::WorkerScriptController::scheduleExecutionTermination):
3164
3165 2017-03-08  Dean Jackson  <dino@apple.com>
3166
3167         WebGPU: Backend - Library and Functions
3168         https://bugs.webkit.org/show_bug.cgi?id=169371
3169         <rdar://problem/30928792>
3170
3171         Reviewed by Tim Horton.
3172
3173         Implement the backends for GPULibrary and GPUFunction.
3174         A GPULibrary is created from a GPUDevice, given some
3175         shader source code. You can then extract the GPUFunctions
3176         from the library.
3177
3178         WebKitAPITests: GPULibrary and GPUFunction.
3179
3180         * WebCore.xcodeproj/project.pbxproj:
3181         * platform/graphics/cocoa/GPUFunctionMetal.mm:
3182         (WebCore::GPUFunction::GPUFunction):
3183         (WebCore::GPUFunction::name):
3184         (WebCore::GPUFunction::platformFunction):
3185         * platform/graphics/cocoa/GPULibraryMetal.mm:
3186         (WebCore::GPULibrary::GPULibrary):
3187         (WebCore::GPULibrary::label):
3188         (WebCore::GPULibrary::setLabel):
3189         (WebCore::GPULibrary::functionNames):
3190         (WebCore::GPULibrary::platformLibrary):
3191         * platform/graphics/gpu/GPUDevice.cpp:
3192         (WebCore::GPUDevice::createLibrary):
3193         * platform/graphics/gpu/GPUDevice.h:
3194         * platform/graphics/gpu/GPUFunction.cpp:
3195         (WebCore::GPUFunction::create):
3196         (WebCore::GPUFunction::~GPUFunction):
3197         (WebCore::GPUFunction::GPUFunction):
3198         (WebCore::GPUFunction::name):
3199         * platform/graphics/gpu/GPUFunction.h:
3200         * platform/graphics/gpu/GPULibrary.cpp:
3201         (WebCore::GPULibrary::create):
3202         (WebCore::GPULibrary::~GPULibrary):
3203         (WebCore::GPULibrary::label):
3204         (WebCore::GPULibrary::setLabel):
3205         (WebCore::GPULibrary::functionNames):
3206         (WebCore::GPULibrary::functionWithName):
3207         * platform/graphics/gpu/GPULibrary.h:
3208
3209 2017-03-09  Chris Dumez  <cdumez@apple.com>
3210
3211         Align Document.elementFromPoint() with the CSSOM specification
3212         https://bugs.webkit.org/show_bug.cgi?id=169403
3213
3214         Reviewed by Sam Weinig.
3215
3216         Align Document.elementFromPoint() with the CSSOM specification:
3217         - https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface
3218
3219         In particular, the parameters should be mandatory and of type double.
3220
3221         The parameters are mandatory in both Firefox and Chrome already. Parameters
3222         are finite floating point in Firefox and integers in Chrome.
3223
3224         Test: fast/dom/elementFromPoint-parameters.html
3225
3226         * dom/DocumentOrShadowRoot.idl:
3227         * dom/TreeScope.cpp:
3228         (WebCore::TreeScope::elementFromPoint):
3229         * dom/TreeScope.h:
3230
3231 2017-03-09  Antoine Quint  <graouts@apple.com>
3232
3233         [Modern Media Controls] Fullscreen controls are difficult to drag around
3234         https://bugs.webkit.org/show_bug.cgi?id=169412
3235         <rdar://problem/30931892>
3236
3237         Reviewed by Eric Carlson.
3238
3239         Up until now, we would simply check that the event target when attempting to
3240         initiate a drag would be the controls bar and not any of its children. This
3241         was not so great as this would encompass also a large margin around the left,
3242         center and right button containers as well as the time labels. We now check
3243         that the event target is anything but an interactive element (<button> or <input>).
3244
3245         The existing test at media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html
3246         has been updated to initiate dragging right between the rewind and play/pause button,
3247         which would fail prior to this patch since this would have hit-tested within the center
3248         button container and thus prevent dragging.
3249
3250         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
3251         (.media-controls.mac.fullscreen button.volume-down):
3252         (.media-controls.mac.fullscreen button.volume-up):
3253         (.media-controls.mac.fullscreen button.rewind):
3254         (.media-controls.mac.fullscreen button.play-pause):
3255         (.media-controls.mac.fullscreen button.forward):
3256         (.media-controls.mac.fullscreen .buttons-container.right button):
3257         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
3258         (MacOSFullscreenMediaControls.prototype._handleMousedown):
3259         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
3260         (.media-controls.mac.inline > .controls-bar button):
3261         * Modules/modern-media-controls/controls/macos-media-controls.css:
3262         (.media-controls.mac > .controls-bar button):
3263
3264 2017-03-09  Antoine Quint  <graouts@apple.com>
3265
3266         [Modern Media Controls] Controls are not visible in fullscreen without the controls attribute
3267         https://bugs.webkit.org/show_bug.cgi?id=169411
3268         <rdar://problem/30931724>
3269
3270         Reviewed by Eric Carlson.
3271
3272         Ensure we show controls in fullscreen in the absence of the controls attribute.
3273
3274         Tests: media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element.html
3275                media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video.html
3276
3277         * Modules/modern-media-controls/media/controls-visibility-support.js:
3278         (ControlsVisibilitySupport.prototype.get mediaEvents):
3279         (ControlsVisibilitySupport.prototype._updateControls):
3280         (ControlsVisibilitySupport):
3281
3282 2017-03-09  Zalan Bujtas  <zalan@apple.com>
3283
3284         Simple line layout: Add top level pagination support.
3285         https://bugs.webkit.org/show_bug.cgi?id=169410
3286         <rdar://problem/28536227>
3287
3288         Reviewed by Antti Koivisto.
3289
3290         This patch enables top level pagination for simple line layout.
3291
3292         Covered by existing tests.
3293
3294         * rendering/RenderMultiColumnFlowThread.h:
3295         * rendering/RenderView.cpp:
3296         (WebCore::RenderView::pushLayoutStateForPagination): Pagination flag needs to be set before calling pushLayoutStateForCurrentFlowThread.
3297         * rendering/SimpleLineLayout.cpp:
3298         (WebCore::SimpleLineLayout::canUseForWithReason):
3299         * rendering/SimpleLineLayoutCoverage.cpp:
3300         (WebCore::SimpleLineLayout::printReason):
3301         * rendering/SimpleLineLayoutCoverage.h:
3302         * rendering/SimpleLineLayoutFunctions.cpp:
3303         (WebCore::SimpleLineLayout::paintFlow):
3304         * rendering/SimpleLineLayoutPagination.cpp:
3305         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow): Matching normal line layout values.
3306         (WebCore::SimpleLineLayout::setPageBreakForLine): Logic here matches RenderBlockFlow::adjustLinePositionForPagination
3307
3308 2017-03-09  Tomas Popela  <tpopela@redhat.com>
3309
3310         [GStreamer][MSE] Fix 'comparison between signed and unsigned integer
3311         expressions' warning
3312
3313         Reviewed by Žan Doberšek.
3314
3315         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
3316         (WebCore::PlaybackPipeline::flush):
3317
3318 2017-03-08  Per Arne Vollan  <pvollan@apple.com>
3319
3320         Implement stroke-width CSS property.
3321         https://bugs.webkit.org/show_bug.cgi?id=169273
3322
3323         Reviewed by Simon Fraser.
3324
3325         Support setting text stroke width using the CSS property stroke-width, see https://drafts.fxtf.org/paint/.
3326         Text stroke width can currently be set with the -webkit-text-stroke-width property. To make sure this still
3327         works, I added a check to determine if the stroke-width property has been explicitly set. If it has not been
3328         set, we fall back to the value of the -webkit-text-stroke-width property.
3329
3330         Tests: fast/css/stroke-width-percent.html
3331                fast/css/stroke-width.html
3332
3333         * css/CSSProperties.json:
3334         * css/StyleBuilderCustom.h:
3335         (WebCore::StyleBuilderCustom::applyValueStrokeWidth):
3336         (WebCore::StyleBuilderCustom::applyValueWebkitTextStrokeWidth):
3337         * rendering/InlineFlowBox.cpp:
3338         (WebCore::InlineFlowBox::addToLine):
3339         (WebCore::InlineFlowBox::addTextBoxVisualOverflow):
3340         * rendering/SimpleLineLayoutFunctions.cpp:
3341         (WebCore::SimpleLineLayout::computeOverflow):
3342         * rendering/TextDecorationPainter.cpp:
3343         (WebCore::decorationColor):
3344         * rendering/TextPaintStyle.cpp:
3345         (WebCore::computeTextPaintStyle):
3346         (WebCore::computeTextSelectionPaintStyle):
3347         * rendering/style/RenderStyle.cpp:
3348         (WebCore::RenderStyle::RenderStyle):
3349         (WebCore::RenderStyle::computedTextStrokeWidth):
3350         * rendering/style/RenderStyle.h:
3351         (WebCore::RenderStyle::setHasExplicitlySetStrokeWidth):
3352         (WebCore::RenderStyle::hasExplicitlySetStrokeWidth):
3353         (WebCore::RenderStyle::setHasExplicitlySetWebKitTextStrokeWidth):
3354         (WebCore::RenderStyle::hasExplicitlySetWebKitTextStrokeWidth):
3355         (WebCore::RenderStyle::InheritedFlags::operator==):
3356
3357 2017-03-09  Antti Koivisto  <antti@apple.com>
3358
3359         Allow the page to render before <link> stylesheet tags in body
3360         https://bugs.webkit.org/show_bug.cgi?id=149157
3361         <rdar://problem/24658830>
3362
3363         Reviewed by Simon Fraser.
3364
3365         Currently we block style and renderer building completely if document has any loading
3366         stylesheets. In case a script queries something layout dependent we construct the render
3367         tree with whatever style we have but block painting in it.
3368
3369         This patch changes behavior so that a loading stylesheet in body only blocks rendering for elements
3370         that are after it. The expectation is that such stylesheets rarely affect elements before them
3371         and the elements can be rendered without causing ugly visible styling changes.
3372
3373         The patch replaces the old flash-of-unstyled-content (FOUC) preventation mechanism with a more
3374         fine-grained one. Paint blocking is now done on per-renderer basis with based on isNonFinal flag in
3375         RenderStyle.
3376
3377         For stylesheets in head the behavior should be largely unchanged.
3378
3379         Test: http/tests/incremental/stylesheet-body-incremental-rendering.html
3380
3381         * css/StyleResolver.cpp:
3382         (WebCore::StyleResolver::pseudoStyleRulesForElement):
3383         * dom/Document.cpp:
3384         (WebCore::Document::Document):
3385         (WebCore::Document::resolveStyle):
3386         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
3387
3388             Remove the old FOUC preventation state tracking.
3389
3390         (WebCore::Document::shouldScheduleLayout):
3391         (WebCore::Document::didRemoveAllPendingStylesheet):
3392
3393             Repaints will now get triggered by the normal style mechanism.
3394
3395         * dom/Document.h:
3396         (WebCore::Document::hasNodesWithNonFinalStyle):
3397         (WebCore::Document::setHasNodesWithNonFinalStyle):
3398
3399             Track if we need to recompute the style later because non-final or unstyled elements.
3400
3401         (WebCore::Document::didLayoutWithPendingStylesheets): Deleted.
3402         (WebCore::Document::hasNodesWithPlaceholderStyle): Deleted.
3403         (WebCore::Document::setHasNodesWithPlaceholderStyle): Deleted.
3404         * html/HTMLFrameSetElement.cpp:
3405         (WebCore::HTMLFrameSetElement::rendererIsNeeded):
3406         * page/FrameView.cpp:
3407         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty):
3408
3409             Don't qualify as visually non-empty if we have loading stylesheets in head (even if there is
3410             a fouc-prevented render tree).
3411
3412         (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
3413         * rendering/RenderBlock.cpp:
3414         (WebCore::RenderBlock::paintContents):
3415
3416             Instead of a global test, block painting if isNonFinal is set in the renderer's style.
3417
3418         * rendering/RenderLayer.cpp:
3419         (WebCore::shouldSuppressPaintingLayer):
3420         * rendering/style/RenderStyle.cpp:
3421         (WebCore::RenderStyle::changeRequiresRepaint):
3422
3423             The isNonFinal flag prevents painting so we need to trigger repaint when it gets cleared.
3424
3425         * rendering/style/RenderStyle.h:
3426         (WebCore::RenderStyle::isNotFinal):
3427         (WebCore::RenderStyle::setIsNotFinal):
3428         (WebCore::RenderStyle::isPlaceholderStyle): Deleted.
3429         (WebCore::RenderStyle::setIsPlaceholderStyle): Deleted.
3430
3431             There is no need for placeholder styles anymore. Reuse the bit for isNotFinal.
3432
3433         * rendering/style/StyleRareNonInheritedData.cpp:
3434         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
3435         (WebCore::StyleRareNonInheritedData::operator==):
3436         * rendering/style/StyleRareNonInheritedData.h:
3437         * style/StyleScope.cpp:
3438         (WebCore::Style::Scope::analyzeStyleSheetChange):
3439         (WebCore::Style::Scope::updateActiveStyleSheets):
3440         * style/StyleTreeResolver.cpp:
3441         (WebCore::Style::TreeResolver::styleForElement):
3442         (WebCore::Style::TreeResolver::resolveElement):
3443
3444             If we have seens a loading stylesheet and don't have a renderer yet don't style the element.
3445             In case there is a renderer or we are ignoring pending sheets, resolve the style normally
3446             but mark it as non-final.
3447
3448         (WebCore::Style::makePlaceholderStyle): Deleted.
3449
3450 2017-03-08  Antoine Quint  <graouts@apple.com>
3451
3452         [Modern Media Controls] iOS: Live Broadcast video shows scrubber with 00:00 duration until paused
3453         https://bugs.webkit.org/show_bug.cgi?id=169374
3454         <rdar://problem/30063273>
3455
3456         Reviewed by Dean Jackson.
3457
3458         We need to make sure we update the controls layout when they come back from being hidden, so promote
3459         that functionality from MacOSInlineMediaControls to MediaControls so that iOS can pick that behavior
3460         up.
3461
3462         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-status-label-enabled-hidden-controls-bar.html
3463
3464         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
3465         (MacOSInlineMediaControls.prototype.controlsBarVisibilityDidChange): Deleted.
3466         * Modules/modern-media-controls/controls/media-controls.js:
3467         (MediaControls.prototype.controlsBarVisibilityDidChange):
3468
3469 2017-03-08  Jiewen Tan  <jiewen_tan@apple.com>
3470
3471         [WebCrypto] Implement SubtleCrypto::DeriveKey method
3472         https://bugs.webkit.org/show_bug.cgi?id=169386
3473         <rdar://problem/23789585>
3474
3475         Reviewed by Brent Fulgham.
3476
3477         This patch does following few things:
3478         1. It implements SubtleCrypto::DeriveKey method according to the spec:
3479         https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-deriveKey.
3480         2. It implements getKeyLength operations for AES-CBC, AES-KW, AES-CFB,
3481         AES-GCM, and HMAC, which is needed by the SubtleCrypto::DeriveKey method.
3482         3. It enables ECDH DeriveKey operation.
3483         4. It replaces unigned long with size_t in all the crypto codes.
3484
3485         Tests: crypto/subtle/derive-key-malformed-parameters.html
3486                crypto/subtle/ecdh-import-key-derive-aes-key.html
3487                crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length.html
3488                crypto/subtle/unwrap-key-malformed-parameters.html
3489                crypto/subtle/wrap-key-malformed-parameters.html
3490                crypto/workers/subtle/ecdh-import-key-derive-key.html
3491
3492         * CMakeLists.txt:
3493         * DerivedSources.make:
3494         * WebCore.xcodeproj/project.pbxproj:
3495         * bindings/js/JSSubtleCryptoCustom.cpp:
3496         (WebCore::normalizeCryptoAlgorithmParameters):
3497         (WebCore::jsSubtleCryptoFunctionEncryptPromise):
3498         (WebCore::jsSubtleCryptoFunctionDecryptPromise):
3499         (WebCore::jsSubtleCryptoFunctionSignPromise):
3500         (WebCore::jsSubtleCryptoFunctionVerifyPromise):
3501         (WebCore::jsSubtleCryptoFunctionDigestPromise):
3502         (WebCore::jsSubtleCryptoFunctionDeriveKeyPromise):
3503         (WebCore::jsSubtleCryptoFunctionDeriveBitsPromise):
3504         Remove unnecessary return statement from callbacks.
3505         * crypto/CryptoAlgorithm.cpp:
3506         (WebCore::CryptoAlgorithm::deriveBits):
3507         (WebCore::CryptoAlgorithm::getKeyLength):
3508         * crypto/CryptoAlgorithm.h:
3509         * crypto/CryptoAlgorithmParameters.h:
3510         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
3511         (WebCore::CryptoAlgorithmAES_CBC::generateKey):
3512         (WebCore::CryptoAlgorithmAES_CBC::getKeyLength):
3513         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
3514         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
3515         (WebCore::CryptoAlgorithmAES_CFB::generateKey):
3516         (WebCore::CryptoAlgorithmAES_CFB::getKeyLength):
3517         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
3518         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
3519         (WebCore::CryptoAlgorithmAES_GCM::generateKey):
3520         (WebCore::CryptoAlgorithmAES_GCM::getKeyLength):
3521         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
3522         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
3523         (WebCore::CryptoAlgorithmAES_KW::generateKey):
3524         (WebCore::CryptoAlgorithmAES_KW::getKeyLength):
3525         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
3526         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
3527         (WebCore::CryptoAlgorithmECDH::deriveBits):
3528         * crypto/algorithms/CryptoAlgorithmECDH.h:
3529         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
3530         (WebCore::CryptoAlgorithmHMAC::getKeyLength):
3531         * crypto/algorithms/CryptoAlgorithmHMAC.h:
3532         * crypto/keys/CryptoKeyAES.cpp:
3533         (WebCore::CryptoKeyAES::getKeyLength):
3534         * crypto/keys/CryptoKeyAES.h:
3535         * crypto/keys/CryptoKeyHMAC.cpp:
3536         (WebCore::getKeyLengthFromHash):
3537         (WebCore::CryptoKeyHMAC::generate):
3538         (WebCore::CryptoKeyHMAC::getKeyLength):
3539         * crypto/keys/CryptoKeyHMAC.h:
3540         * crypto/mac/CryptoAlgorithmECDHMac.cpp:
3541         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
3542         * crypto/parameters/AesKeyParams.idl: Renamed from Source/WebCore/crypto/parameters/AesKeyGenParams.idl.
3543         * crypto/parameters/CryptoAlgorithmAesKeyParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyGenParams.h.
3544         Rename AesKeyGenParams to AesKeyParams to represent a unified dictionary for AesKeyGenParams and AesDerivedKeyParams.
3545         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
3546         * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h:
3547
3548 2017-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>
3549
3550         Add plumbing for WebCore to notify WebKit2 when an edit drag has concluded
3551         https://bugs.webkit.org/show_bug.cgi?id=169392
3552         <rdar://problem/30882974>
3553
3554         Reviewed by Tim Horton.
3555
3556         Add DragClient::didConcludeEditDrag and invoke it after performing an edit drag in
3557         DragController::performDragOperation.
3558
3559         * page/DragClient.h:
3560         (WebCore::DragClient::didConcludeEditDrag):
3561         * page/DragController.cpp:
3562         (WebCore::DragController::performDragOperation):
3563
3564 2017-03-08  Matt Baker  <mattbaker@apple.com>
3565
3566         Web Inspector: Add DOM breakpoints UI for node/subtree modification events
3567         https://bugs.webkit.org/show_bug.cgi?id=168101
3568
3569         Reviewed by Joseph Pecoraro.
3570
3571         Test: inspector/dom-debugger/dom-breakpoints.html
3572
3573         * inspector/InspectorDOMAgent.h:
3574         Removed declarations for undefined member functions.
3575
3576         * inspector/InspectorDOMDebuggerAgent.cpp:
3577         (WebCore::InspectorDOMDebuggerAgent::disable):
3578         (WebCore::InspectorDOMDebuggerAgent::mainFrameDOMContentLoaded):
3579         (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode):
3580         (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode):
3581         (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr):
3582         Check that DebuggerAgent breakpoints are active before breaking.
3583         (WebCore::InspectorDOMDebuggerAgent::clear): Deleted.
3584         Replaced by call to discardBindings.
3585         * inspector/InspectorDOMDebuggerAgent.h:
3586
3587         * inspector/InspectorInstrumentation.cpp:
3588         (WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl):
3589         DOMDebugger agent needs to discard bindings when the main frame navigates.
3590
3591 2017-03-08  Jiewen Tan  <jiewen_tan@apple.com>
3592
3593         [WebCrypto] Implement ECDH DeriveBits operation
3594         https://bugs.webkit.org/show_bug.cgi?id=169319
3595         <rdar://problem/23789585>
3596
3597         Reviewed by Brent Fulgham.
3598
3599         This patch implements DeriveBits operation of ECDH according to the spec:
3600         https://www.w3.org/TR/WebCryptoAPI/#ecdh-operations.
3601
3602         Tests: crypto/subtle/derive-bits-malformed-parameters.html
3603                crypto/subtle/ecdh-derive-bits-malformed-parametrs.html
3604                crypto/subtle/ecdh-generate-key-derive-bits.html
3605                crypto/subtle/ecdh-import-key-derive-bits-custom-length.html
3606                crypto/subtle/ecdh-import-key-derive-bits-null-length.html
3607                crypto/workers/subtle/ecdh-import-key-derive-bits.html
3608
3609         * CMakeLists.txt:
3610         * DerivedSources.make:
3611         * PlatformGTK.cmake:
3612         * PlatformMac.cmake:
3613         * WebCore.xcodeproj/project.pbxproj:
3614         * bindings/js/JSSubtleCryptoCustom.cpp:
3615         (WebCore::normalizeCryptoAlgorithmParameters):
3616         (WebCore::jsSubtleCryptoFunctionDeriveKeyPromise):
3617         (WebCore::jsSubtleCryptoFunctionDeriveBitsPromise):
3618         (WebCore::JSSubtleCrypto::generateKey):
3619         Reorder a bit of the functions.
3620         * crypto/CommonCryptoUtilities.h:
3621         * crypto/CryptoAlgorithm.cpp:
3622         (WebCore::CryptoAlgorithm::deriveBits):
3623         * crypto/CryptoAlgorithm.h:
3624         * crypto/CryptoAlgorithmParameters.h:
3625         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
3626         (WebCore::CryptoAlgorithmECDH::deriveBits):
3627         * crypto/algorithms/CryptoAlgorithmECDH.h:
3628         * crypto/gnutls/CryptoAlgorithmECDHGnuTLS.cpp: Added.
3629         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
3630         * crypto/keys/CryptoKeyEC.h:
3631         * crypto/mac/CryptoAlgorithmECDHMac.cpp: Added.
3632         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
3633         * crypto/parameters/CryptoAlgorithmEcdhKeyDeriveParams.h: Added.
3634         * crypto/parameters/EcdhKeyDeriveParams.idl: Added.
3635
3636 2017-03-08  John Wilander  <wilander@apple.com>
3637
3638         Resource Load Statistics: Communicate to the network process which domains to partition
3639         https://bugs.webkit.org/show_bug.cgi?id=169322
3640         <rdar://problem/30768921>
3641
3642         Reviewed by Alex Christensen.
3643
3644         Test: http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html
3645
3646         * loader/ResourceLoadObserver.cpp:
3647         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3648             Now calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
3649             to tell the network process the domain has got user interaction.
3650         (WebCore::ResourceLoadObserver::logUserInteraction):
3651             Now calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
3652             to tell the network process the domain has got user interaction.
3653         (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
3654             To allow TestRunner to set a domain for which
3655             partitioning should be applied.
3656         (WebCore::ResourceLoadObserver::primaryDomain):
3657             New overloaded convenience function.
3658         * loader/ResourceLoadObserver.h:
3659         * loader/ResourceLoadStatisticsStore.cpp:
3660         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
3661             Now bootstraps the network process' set of known domains to
3662             partition cookies for.
3663         (WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback):
3664         (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
3665         (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
3666             Now tells the network process to start partitioning again
3667             when user interaction ages out.
3668         * loader/ResourceLoadStatisticsStore.h:
3669         * platform/network/NetworkStorageSession.h:
3670         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3671         (WebCore::NetworkStorageSession::shouldPartitionCookiesForHost):
3672         (WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts):
3673
3674 2017-03-08  Joseph Pecoraro  <pecoraro@apple.com>
3675
3676         Web Inspector: Should be able to see where Resources came from (Memory Cache, Disk Cache)
3677         https://bugs.webkit.org/show_bug.cgi?id=164892
3678         <rdar://problem/29320562>
3679
3680         Reviewed by Brian Burg.
3681
3682         Test: http/tests/inspector/network/resource-response-source-disk-cache.html
3683               http/tests/inspector/network/resource-response-source-memory-cache.html
3684               http/tests/inspector/network/resource-response-source-network.html
3685
3686         * platform/network/ResourceResponseBase.cpp:
3687         (WebCore::ResourceResponseBase::setSource): Deleted.
3688         * platform/network/ResourceResponseBase.h:
3689         (WebCore::ResourceResponseBase::setSource):
3690         Make Source mutable to allow it to be set in const methods.
3691
3692         * loader/SubresourceLoader.cpp:
3693         (WebCore::SubresourceLoader::didReceiveResponse):
3694         Set the Response source after a successful memory cache validation
3695         as early as possible so that future copies have up to date info.
3696
3697         * inspector/InspectorNetworkAgent.cpp:
3698         (WebCore::responseSource):
3699         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
3700         (WebCore::InspectorNetworkAgent::didLoadResourceFromMemoryCache):
3701         (WebCore::InspectorNetworkAgent::markResourceAsCached): Deleted.
3702         Eliminate this "markResourceAsCached" path.
3703         Update Response to include required source parameter instead of
3704         optional fromDiskCache parameter.
3705
3706         * inspector/InspectorInstrumentation.cpp:
3707         (WebCore::InspectorInstrumentation::markResourceAsCachedImpl): Deleted.
3708         * inspector/InspectorInstrumentation.h:
3709         (WebCore::InspectorInstrumentation::markResourceAsCached): Deleted.
3710         * inspector/InspectorNetworkAgent.h:
3711         * loader/FrameLoader.cpp:
3712         (WebCore::FrameLoader::loadedResourceFromMemoryCache):
3713         Eliminate this "markResourceAsCached" call because the later delegate
3714         messages will include this information.
3715
3716 2017-03-08  Chris Dumez  <cdumez@apple.com>
3717
3718         Drop support for non-standard document.all.tags()
3719         https://bugs.webkit.org/show_bug.cgi?id=169337
3720
3721         Reviewed by Sam Weinig.
3722
3723         Drop support for non-standard document.all.tags(). It is not part of the specification:
3724         - https://html.spec.whatwg.org/multipage/infrastructure.html#the-htmlallcollection-interface
3725
3726         It is not supported by Firefox and its support was dropped from Chrome back in early 2014:
3727         - https://src.chromium.org/viewvc/blink?view=revision&revision=166870
3728
3729         No new tests, updated existing test.
3730
3731         * html/HTMLAllCollection.cpp:
3732         * html/HTMLAllCollection.h:
3733         * html/HTMLAllCollection.idl:
3734
3735 2017-03-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
3736
3737         Enable async image decoding for large images
3738         https://bugs.webkit.org/show_bug.cgi?id=165039
3739
3740         Reviewed by Simon Fraser.
3741
3742         Once FrameView finishes flushing compositing, it will request all its
3743         images, which intersect with the tileCoverageRect (aka the futureRect)
3744         of the  TileController, to start asynchronously decoding their image frames.
3745         This should improve the image first time paint and the scrolling scenarios.
3746         It also makes the scrolling more responsive by removing the decoding step
3747         from the main thread. 
3748         
3749         For now we are going to disable the asynchronous image decoding for the
3750         webkit test runner because drawing the image does not block the page rendering
3751         anymore. An image can be repainted later when its frame is ready for painting.
3752         This can cause a test to fail because the webkit test runner may capture
3753         an image for the page before painting all the images. The asynchronous image
3754         decoding can to be explicitly enabled from the test page. Once the specs
3755         of the image 'async' attribute and 'ready' event is approved, this should
3756         be revisited. It is important to test what we ship and eventually async
3757         image decoding should be enabled in the webkit test runner.
3758
3759         * html/HTMLImageElement.cpp:
3760         (WebCore::HTMLImageElement::didAttachRenderers):
3761         (WebCore::HTMLImageElement::willDetachRenderers):
3762         Register/unregister the renderer of the HTMLImageElement for async image decoding
3763         from the RenderView. I followed what HTMLMediaElement to registerForVisibleInViewportCallback().
3764         * html/HTMLImageElement.h:
3765         
3766         * page/FrameView.cpp:
3767         (WebCore::FrameView::flushCompositingStateForThisFrame): For all the images inside
3768         the  tileCoverageRect of the TileController, request async image decoding.
3769         (WebCore::FrameView::applyRecursivelyWithAbsoluteRect): Request the async image decoding for the
3770         the images inside this FrameView and then recursively do the same thing for all sub FrameViews.
3771         (WebCore::FrameView::requestAsyncDecodingForImagesInAbsoluteRect): Calls the RenderView to
3772         make the request.
3773         (WebCore::FrameView::requestAsyncDecodingForImagesInAbsoluteRectIncludingSubframes): Calls
3774         applyRecursivelyWithAbsoluteRect giving an apply lambda which calls requestAsyncDecodingForImagesInAbsoluteRect.
3775         * page/FrameView.h:
3776
3777         * platform/graphics/BitmapImage.cpp:
3778         (WebCore::BitmapImage::destroyDecodedData): ImageSource::hasDecodingQueue() is renamed to ImageSource::hasAsyncDecodingQueue().
3779         (WebCore::BitmapImage::dataChanged): Use String::utf8().data() instead of String::characters8().
3780         (WebCore::BitmapImage::draw): If drawing the current frame is called while it is being
3781         decoded, draw the the image if the current frame was decoded but for a different size 
3782         and and will not invoke decoding while painting. If the frame is being decoded and there
3783         isn't a decoded frame, return without drawing but set a flag that that this image needs
3784         a repaint.
3785         (WebCore::BitmapImage::internalStartAnimation): Use String::utf8().data() instead of String::characters8().
3786         (WebCore::BitmapImage::advanceAnimation): Ditto.
3787         (WebCore::BitmapImage::internalAdvanceAnimation): Ditto.
3788         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Now this callback can be
3789         called form the ImageFrameCache when finishing a frame of an animated image or the
3790         frame of a large image. For large images, we need to call CachedImage::changedInRect()
3791         if this image needs a repaint. If the decoding queue is idle, we should close it.
3792         (WebCore::BitmapImage::requestAsyncDecoding): This is called form 
3793         RenderView::requestAsyncDecodingForImagesInRect().
3794         * platform/graphics/BitmapImage.h:
3795
3796         * platform/graphics/Image.h:
3797         (WebCore::Image::requestAsyncDecoding): Add the default implementation of a virtual function.
3798
3799         * platform/graphics/ImageFrameCache.cpp:
3800         (WebCore::ImageFrameCache::~ImageFrameCache): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
3801         (WebCore::ImageFrameCache::decodingQueue): Change the QNS of the decoding thread to be WorkQueue::QOS::Default.
3802         WorkQueue::QOS::UserInteractive causes the scrolling thread to preempted  which can make the scrolling choppy.
3803         (WebCore::ImageFrameCache::startAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
3804         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Ditto.
3805         (WebCore::ImageFrameCache::isAsyncDecodingQueueIdle): A helper function to tell whether the decoding thread is idle.
3806         (WebCore::ImageFrameCache::stopAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
3807         * platform/graphics/ImageFrameCache.h:
3808         (WebCore::ImageFrameCache::hasAsyncDecodingQueue): Rename this function to be consistent with the rest of the functions.
3809         (WebCore::ImageFrameCache::hasDecodingQueue): Deleted.
3810
3811         * platform/graphics/ImageSource.h:
3812         (WebCore::ImageSource::hasAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
3813         (WebCore::ImageSource::isAsyncDecodingQueueIdle): A wrapper for ImageFrameCache::isAsyncDecodingQueueIdle().
3814         (WebCore::ImageSource::hasDecodingQueue): Deleted.
3815         
3816         * platform/graphics/TiledBacking.h: Fix a comment. tileGridExtent() is the only one that is used for testing.
3817
3818         * rendering/RenderElement.cpp:
3819         (WebCore::RenderElement::~RenderElement):
3820         (WebCore::RenderElement::intersectsAbsoluteRect): Make this function does what shouldRepaintForImageAnimation()
3821         was doing expect the check for document.activeDOMObjectsAreSuspended().
3822         (WebCore::RenderElement::newImageAnimationFrameAvailable): Replace the call to
3823         shouldRepaintForImageAnimation() by checking document().activeDOMObjectsAreSuspended() then a call to
3824         RenderElement::intersectsAbsoluteRect().
3825         (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded): Ditto.
3826         (WebCore::RenderElement::registerForAsyncImageDecodingCallback): Call the RenderView to register the renderer..
3827         (WebCore::RenderElement::unregisterForAsyncImageDecodingCallback): Call the RenderView to unregister the renderer..
3828         (WebCore::shouldRepaintForImageAnimation): Deleted.
3829         * rendering/RenderElement.h:
3830
3831         * rendering/RenderObject.cpp:
3832         (WebCore::RenderObject::setIsRegisteredForAsyncImageDecodingCallback):
3833         * rendering/RenderObject.h:
3834         (WebCore::RenderObject::isRegisteredForAsyncImageDecodingCallback):
3835         (WebCore::RenderObject::RenderObjectRareData::RenderObjectRareData):
3836         Mark/unmark the renderer for being RegisteredForAsyncImageDecodingCallback.
3837
3838         * rendering/RenderReplaced.h: Make intrinsicSize() be a public function.
3839
3840         * rendering/RenderView.cpp:
3841         (WebCore::RenderView::registerForAsyncImageDecodingCallback): Register a renderer for async image decoding.
3842         (WebCore::RenderView::unregisterForAsyncImageDecodingCallback): Remove a renderer from the list of async image decoding.
3843         (WebCore::RenderView::requestAsyncDecodingForImagesInAbsoluteRect):This loops through all the registered RenderImages
3844         inside this RenderView and if any of them intersects with the rectangle, requestAsyncDecoding for it.
3845         * rendering/RenderView.h:
3846
3847 2017-03-08  Michael Catanzaro  <mcatanzaro@igalia.com>
3848
3849         Fix missing return value after r213499
3850         https://bugs.webkit.org/show_bug.cgi?id=168198
3851
3852         Reviewed by Myles C. Maxfield.
3853
3854         * platform/text/CharacterProperties.h:
3855         (WebCore::isEmojiGroupCandidate):
3856
3857 2017-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>
3858
3859         Add TextIndicator support for providing a snapshot excluding selected content
3860         https://bugs.webkit.org/show_bug.cgi?id=169309
3861         <rdar://problem/30883525>
3862
3863         Reviewed by Tim Horton.
3864
3865         Work towards <rdar://problem/30882974>. Adds support in TextIndicator to include a snapshot of all visible
3866         content, excluding nodes captured in the current selection. This comes in the form of the new
3867         TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection flag -- see per-method changes for more details.
3868
3869         No new tests, since there is no change in behavior yet.
3870
3871         * page/FrameSnapshotting.cpp:
3872         (WebCore::snapshotFrameRectWithClip):
3873         * page/FrameSnapshotting.h:
3874
3875         Introduce a new snapshot option flag, SnapshotOptionsPaintEverythingExcludingSelection.
3876
3877         (WebCore::snapshotFrameRectWithClip):
3878         * page/TextIndicator.cpp:
3879
3880         If TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection is turned on, capture and include a
3881         snapshot of the visible bounds of the frame.
3882
3883         (WebCore::takeSnapshot):
3884         (WebCore::takeSnapshots):
3885         (WebCore::initializeIndicator):
3886         * page/TextIndicator.h:
3887
3888         Introduce TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection.
3889
3890         * platform/graphics/FontCascade.cpp:
3891         (WebCore::FontCascade::widthOfTextRange):
3892         * platform/graphics/FontCascade.h:
3893
3894         Teach FontCascade to retrieve the width of a range in a TextRun, and also compute the widths of the TextRun
3895         before and after the range. This is used by InlineTextBox to compute the painting rect to clip out when skipping
3896         text decorations for the selected region of the TextRun.
3897
3898         * rendering/InlineTextBox.cpp:
3899
3900         Teach InlineTextBox to respect PaintBehaviorExcludeSelection. When painting text, if this paint behavior is
3901         used, we will not paint the portion of the text run that lies inside the range determined by selectionStartEnd().
3902         Similarly, when painting text decorations, we exclude the rect surrounding the selected content.
3903
3904         (WebCore::InlineTextBox::paint):
3905         (WebCore::InlineTextBox::paintDecoration):
3906         * rendering/InlineTextBox.h:
3907         * rendering/PaintPhase.h:
3908
3909         Introduce PaintBehaviorExcludeSelection, used to inform members of the render tree not to paint portions that
3910         lie within the current selection range.
3911
3912         * rendering/RenderLayer.cpp:
3913
3914         Propagate the PaintBehaviorExcludeSelection flag to children when painting.
3915
3916         (WebCore::RenderLayer::paintLayerContents):
3917         (WebCore::RenderLayer::paintForegroundForFragments):
3918         * rendering/RenderReplaced.cpp:
3919         (WebCore::RenderReplaced::shouldPaint):
3920
3921         Teach RenderReplaced to respect PaintBehaviorExcludeSelection by bailing from painting if it is selected and the
3922         paint behavior is enabled.
3923
3924         * rendering/TextDecorationPainter.h:
3925         * rendering/TextPaintStyle.cpp:
3926         (WebCore::computeTextSelectionPaintStyle):
3927         * rendering/TextPaintStyle.h:
3928         * rendering/TextPainter.cpp:
3929         (WebCore::TextPainter::paintText):
3930         * rendering/TextPainter.h:
3931
3932 2017-03-08  Youenn Fablet  <youenn@apple.com>
3933
3934         Support PeerConnectionStates::BundlePolicy::MaxBundle when setting rtc configuration
3935         https://bugs.webkit.org/show_bug.cgi?id=169389
3936
3937         Reviewed by Eric Carlson.
3938
3939         Temporary fix to support appr.tc web site.
3940         A future patch should allow to set MaxBundle.
3941
3942         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3943         (WebCore::configurationFromMediaEndpointConfiguration):
3944
3945 2017-03-08  Chris Dumez  <cdumez@apple.com>
3946
3947         Drop select.remove() / options.remove() overloads taking an option element in parameter
3948         https://bugs.webkit.org/show_bug.cgi?id=169339
3949
3950         Reviewed by Sam Weinig.
3951
3952         Drop select.remove() / options.remove() overloads taking an option element in parameter.
3953         It is non-standard:
3954         - https://html.spec.whatwg.org/multipage/forms.html#the-select-element
3955         - https://html.spec.whatwg.org/multipage/infrastructure.html#htmloptionscollection
3956
3957         It is not supported by Firefox and was removed from Chrome:
3958         - https://bugs.chromium.org/p/chromium/issues/detail?id=345697
3959         - https://bugs.chromium.org/p/chromium/issues/detail?id=398627
3960
3961         Chrome UseCounter data shows consistent 0% usage:
3962         - https://www.chromestatus.com/metrics/feature/timeline/popularity/398
3963
3964         Test: fast/dom/HTMLSelectElement/remove-option-element.html
3965
3966         * html/HTMLOptionsCollection.cpp:
3967         * html/HTMLOptionsCollection.h:
3968         * html