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