Loosen audio playback restrictions when the volume is 0.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-03-20  Matt Rajca  <mrajca@apple.com>
2
3         Loosen audio playback restrictions when the volume is 0.
4         https://bugs.webkit.org/show_bug.cgi?id=169897
5
6         Reviewed by Eric Carlson.
7
8         Added API tests.
9
10         * html/MediaElementSession.cpp:
11         (WebCore::MediaElementSession::playbackPermitted):
12
13 2017-03-21  Brady Eidson  <beidson@apple.com>
14
15         Disable all virtual tables.
16         <rdar://problem/31081972> and https://bugs.webkit.org/show_bug.cgi?id=169928
17         
18         Reviewed by Jer Noble.
19
20         No new tests (Covered by changes to existing test).
21
22         * Modules/webdatabase/DatabaseAuthorizer.cpp:
23         (WebCore::DatabaseAuthorizer::createVTable):
24         (WebCore::DatabaseAuthorizer::dropVTable):
25
26 2017-03-21  Anders Carlsson  <andersca@apple.com>
27
28         Remove bogus availability annotations from DOM SPI headers.
29         rdar://problem/31015675
30
31         Rubber-stamped by Dan Bernstein.
32
33         * platform/cocoa/WebKitAvailability.h:
34         Remove __NSi_9876_5 #define.
35
36 2017-03-21  Zalan Bujtas  <zalan@apple.com>
37
38         Tear down descendant renderers when <slot>'s display value is set to no "contents".
39         https://bugs.webkit.org/show_bug.cgi?id=169921
40         <rdar://problem/30336417>
41
42         Reviewed by Antti Koivisto.
43
44         Since "display: contents" does not generate a renderer, when an element's display value is
45         changed to something other than "contents", we not only create a renderer but also reparent its descendant
46         subtree (e.g from slot's parent to the newly constructed slot renderer). During this reparenting, we
47         need to tear down the descendant subtree tree and build it up again to reflect the new rendering context.
48
49         Test: fast/shadow-dom/slot-with-continuation-descendants.html
50
51         * style/RenderTreeUpdater.cpp:
52         (WebCore::RenderTreeUpdater::updateElementRenderer):
53
54 2017-03-19  Wenson Hsieh  <wenson_hsieh@apple.com>
55
56         Teach TextIndicator to estimate the background color of the given Range
57         https://bugs.webkit.org/show_bug.cgi?id=169869
58         <rdar://problem/31127272>
59
60         Reviewed by Anders Carlsson and Simon Fraser.
61
62         Introduces a simple heuristic to compute a background color that is appropriate to use as a border surrounding
63         the snapshot of the given Range. This work is only carried out if TextIndicatorOptionComputeEstimatedBackgroundColor
64         is specified. The details of how this background color is estimated (as well as when to fall back) can be improved
65         in several ways (one idea is to sample colors along the edge of the snapshot). For the time being, this patch
66         naively walks up the render tree in search of enclosing parent renderers that have background colors. If any
67         renderers have a style that is deemed too complex to capture in a single background color, then fall back to the
68         base document background color; otherwise, the estimated background color is the result of blending these
69         background colors together.
70
71         * page/TextIndicator.cpp:
72         (WebCore::styleContainsComplexBackground):
73
74         Bail out of the background color codepath if the renderer has backdrop filters, has a background image, or uses
75         a non-normal blend mode.
76
77         (WebCore::fallbackBackgroundColorForTextSelection):
78         (WebCore::estimatedBackgroundColorForRange):
79         (WebCore::initializeIndicator):
80         * page/TextIndicator.h:
81
82 2017-03-20  Jer Noble  <jer.noble@apple.com>
83
84         Crash in WebCore: WebCore::CARingBuffer::getCurrentFrameBounds + 28
85         https://bugs.webkit.org/show_bug.cgi?id=169887
86         <rdar://problem/23648082>
87
88         Reviewed by Eric Carlson.
89
90         Because AudioSourceProviderAVFObjC::prepareCallback() can concievably be called after the AudioSourceProviderAVFObjC
91         it refers to has been destroyed, add an extra layer of indirection between the tap and the provider, and invalidate
92         that level of indirection before the AudioSourceProviderAVFObjC is destroyed.
93
94         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
95         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
96         (WebCore::AudioSourceProviderAVFObjC::initCallback):
97         (WebCore::AudioSourceProviderAVFObjC::finalizeCallback):
98         (WebCore::AudioSourceProviderAVFObjC::prepareCallback):
99         (WebCore::AudioSourceProviderAVFObjC::unprepareCallback):
100         (WebCore::AudioSourceProviderAVFObjC::processCallback):
101
102 2017-03-21  Simon Fraser  <simon.fraser@apple.com>
103
104         Remove logging left in by mistake.
105
106         * rendering/RenderNamedFlowThread.cpp:
107         (WebCore::RenderNamedFlowThread::willBeDestroyed):
108
109 2017-03-21  Jon Lee  <jonlee@apple.com>
110
111         Clean up RTCSdpType, RTC enums and headers
112         https://bugs.webkit.org/show_bug.cgi?id=169741
113
114         Reviewed by Youenn Fablet.
115
116         Convert to RTCSdpType.
117         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
118         * Modules/mediastream/MediaEndpointPeerConnection.h:
119         * Modules/mediastream/MediaEndpointSessionDescription.cpp:
120         * Modules/mediastream/MediaEndpointSessionDescription.h:
121         * Modules/mediastream/PeerConnectionBackend.cpp:
122         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
123
124         Convert SDP argument to lvalue.
125         * Modules/mediastream/RTCSessionDescription.cpp:
126         * Modules/mediastream/RTCSessionDescription.h:
127         * Modules/mediastream/RTCSessionDescription.idl:
128
129         Keep RTC enum IDLs above platform. Move the C++ enum headers into platform.
130         * Modules/mediastream/RTCEnums.h: Removed.
131         * Modules/mediastream/RTCIceConnectionState.h: Removed.
132         * Modules/mediastream/RTCIceGatheringState.h: Removed.
133         * Modules/mediastream/RTCIceTransportState.h: Removed.
134         * Modules/mediastream/RTCSignalingState.h: Removed.
135         * platform/mediastream/PeerConnectionStates.h: Remove from .xcodeproj. Move enums to separate headers.
136         * platform/mediastream/RTCBundlePolicy.h:
137         * platform/mediastream/RTCIceConnectionState.h:
138         * platform/mediastream/RTCIceGatheringState.h:
139         * platform/mediastream/RTCIceTransportPolicy.h:
140         * platform/mediastream/RTCIceTransportState.h:
141         * platform/mediastream/RTCRtpTransceiverDirection.h: Renamed from Source/WebCore/Modules/mediastream/RTCRtpTransceiverDirection.h.
142         * platform/mediastream/RTCSdpType.h:
143         * platform/mediastream/RTCSignalingState.h:
144
145         Move RtpTransceiverDirection out to a separate IDL.
146         * Modules/mediastream/RTCPeerConnection.idl:
147         * Modules/mediastream/RTCRtpTransceiver.cpp:
148         * Modules/mediastream/RTCRtpTransceiver.h:
149         * WebCore.xcodeproj/project.pbxproj:
150
151         Replace RTCEnums include with specific headers per enum.
152         * Modules/mediastream/PeerConnectionBackend.h:
153         * Modules/mediastream/RTCConfiguration.h:
154         * Modules/mediastream/RTCIceTransport.h:
155         * Modules/mediastream/RTCPeerConnection.cpp:
156         (WebCore::RTCPeerConnection::completeAddTransceiver): Remove unneeded static_cast.
157         * Modules/mediastream/RTCPeerConnection.h:
158         * Modules/mediastream/RTCRtpTransceiver.h:
159         * platform/mediastream/MediaEndpoint.h:
160         * platform/mediastream/MediaEndpointConfiguration.h:
161         * platform/mock/MockMediaEndpoint.h:
162
163         Clean up license.
164         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
165         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
166         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
167
168         Modernize header to use #pragma once.
169         * platform/mediastream/RTCDTMFSenderHandler.h:
170         * platform/mediastream/RTCDTMFSenderHandlerClient.h:
171         * platform/mediastream/RTCIceCandidateDescriptor.h:
172         * platform/mediastream/RTCPeerConnectionHandlerClient.h:
173         * platform/mediastream/RTCSessionDescriptionDescriptor.h:
174         * platform/mediastream/RTCSessionDescriptionRequest.h:
175         * platform/mediastream/RTCVoidRequest.h:
176         * platform/mock/RTCNotifiersMock.h:
177
178 2017-03-20  Jon Lee  <jonlee@apple.com>
179
180         Add iceCandidatePoolSize to RTCConfiguration
181         https://bugs.webkit.org/show_bug.cgi?id=169866
182
183         Reviewed by Youenn Fablet.
184
185         Test: webrtc/rtcconfiguration-icecandidatepoolsize.html
186
187         * Modules/mediastream/RTCConfiguration.h:
188         * Modules/mediastream/RTCConfiguration.idl: Add iceCandidatePoolSize.
189         * Modules/mediastream/RTCPeerConnection.cpp:
190         (WebCore::RTCPeerConnection::setConfiguration):
191         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
192         (WebCore::configurationFromMediaEndpointConfiguration): Set the size in libwebrtc.
193         * platform/mediastream/MediaEndpointConfiguration.cpp:
194         (WebCore::MediaEndpointConfiguration::MediaEndpointConfiguration):
195         * platform/mediastream/MediaEndpointConfiguration.h:
196
197 2017-03-20  Jon Lee  <jonlee@apple.com>
198
199         Follow-up on comments for bug 169664
200         https://bugs.webkit.org/show_bug.cgi?id=169709
201
202         Reviewed by Youenn Fablet.
203
204         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
205         (WebCore::deriveAggregatedIceConnectionState): Update deriveAggregatedIceConnectionState.
206         (WebCore::MediaEndpointPeerConnection::iceTransportStateChanged): Set a capacity and used
207         uncheckedAppend.
208
209 2017-03-20  Simon Fraser  <simon.fraser@apple.com>
210
211         Add a system trace point for memory warning handling
212         https://bugs.webkit.org/show_bug.cgi?id=169893
213
214         Reviewed by Zalan Bujtas.
215
216         Add a TraceScope for low memory handling, which logs 'critical' and 'synchronous'.
217
218         * page/MemoryRelease.cpp:
219         (WebCore::releaseMemory):
220
221 2017-03-20  Simon Fraser  <simon.fraser@apple.com>
222
223         Optimize packing of Document and superclass data members
224         https://bugs.webkit.org/show_bug.cgi?id=169880
225
226         Reviewed by Antti Koivisto.
227
228         Move data members around to optimize packing in SecurityContext, SuspendableTimer and Document.
229         This saves as few hundred bytes on Document.
230         
231         Padding detected via Tools/Scripts/dump-class-layout
232
233         * dom/Document.cpp:
234         (WebCore::Document::Document):
235         * dom/Document.h:
236         * dom/ScriptExecutionContext.h:
237         * dom/SecurityContext.cpp:
238         (WebCore::SecurityContext::SecurityContext):
239         * dom/SecurityContext.h:
240         * page/SuspendableTimer.cpp:
241         (WebCore::SuspendableTimer::SuspendableTimer):
242         * page/SuspendableTimer.h:
243
244 2017-03-20  Chris Dumez  <cdumez@apple.com>
245
246         Suspend media playback in background tabs
247         https://bugs.webkit.org/show_bug.cgi?id=169883
248         <rdar://problem/28056151>
249
250         Reviewed by Eric Carlson.
251
252         Suspend media playback in background tabs to save battery
253         except in cases where we cannot (e.g. PiP, AirPlay).
254
255         Test: media/media-playback-page-visibility.html
256
257         * html/HTMLMediaElement.cpp:
258         (WebCore::HTMLMediaElement::visibilityStateChanged):
259         When page visibility state changes, begin / end media session
260         interruption with reason PlatformMediaSession::EnteringBackground.
261         This reason was already used on iOS when the application enters
262         or exist background. HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction()
263         takes care of preventing interruption in case of AirPlay or PiP.
264
265 2017-03-20  Daniel Bates  <dabates@apple.com>
266
267         Prevent new navigations from onbeforeunload handler
268         https://bugs.webkit.org/show_bug.cgi?id=169891
269         <rdar://problem/31155736>
270
271         Reviewed by Ryosuke Niwa.
272
273         Ensure that all navigations initiated from an onbeforeunload handler are disallowed
274         regardless of how they were scheduled. Such navigations go against the expectation
275         of a user.
276
277         * loader/FrameLoader.cpp:
278         (WebCore::FrameLoader::isNavigationAllowed): Added.
279         (WebCore::FrameLoader::loadURL): Modified code to call FrameLoader::isNavigationAllowed().
280         (WebCore::FrameLoader::loadWithDocumentLoader): Ditto.
281         (WebCore::FrameLoader::stopAllLoaders): Ditto.
282         * loader/FrameLoader.h:
283
284 2017-03-20  Alex Christensen  <achristensen@webkit.org>
285
286         Prepare SocketStreamHandle for being created from WK2
287         https://bugs.webkit.org/show_bug.cgi?id=169885
288
289         Reviewed by Andy Estes.
290
291         No change in behavior.
292
293         * Modules/websockets/WebSocketChannel.cpp:
294         (WebCore::WebSocketChannel::didOpenSocketStream):
295         (WebCore::WebSocketChannel::sendFrame):
296         Rename send to sendData to prevent name collisions with IPC::MessageSender::send.
297         * platform/network/SocketStreamHandle.cpp:
298         (WebCore::SocketStreamHandle::sendData):
299         (WebCore::SocketStreamHandle::send): Deleted.
300         * platform/network/SocketStreamHandle.h:
301         * platform/network/cf/SocketStreamHandleImpl.h:
302         * platform/network/curl/SocketStreamHandleImpl.h:
303         * platform/network/soup/SocketStreamHandleImpl.h:
304         Make platformSend and platformClose public so I can call them from IPC proxies.
305
306 2017-03-20  Andy Estes  <aestes@apple.com>
307
308         [QuickLook] Subresources should be in the same origin as the main document
309         https://bugs.webkit.org/show_bug.cgi?id=169868
310         <rdar://problem/29898214>
311
312         Reviewed by Daniel Bates.
313
314         Prior to this change, QuickLook documents were placed in a unique origin, which meant all
315         subresources were loaded as cross-origin requests. This prevented XMLHttpRequests to the
316         QuickLook custom protocol, since cross-origin XHRs must be made to a protocol that
317         understands CORS.
318
319         Instead of a unique origin, we now create an origin for QuickLook documents from the preview
320         response URL (an x-apple-ql-id: URL), which will allow QuickLook to make same-origin XHRs by
321         using a URL with the same scheme and host as the preview response URL.
322
323         Test: http/tests/quicklook/same-origin-xmlhttprequest-allowed.html
324
325         * dom/Document.cpp:
326         (WebCore::Document::applyQuickLookSandbox):
327
328 2017-03-17  Jiewen Tan  <jiewen_tan@apple.com>
329
330         window.crypto.getRandomValues() uses the insecure RC4 RNG
331         https://bugs.webkit.org/show_bug.cgi?id=169623
332         <rdar://problem/31044229>
333
334         Reviewed by Brent Fulgham.
335
336         This patch replaces the RC4 RNG with one based on AES-CTR.
337
338         No change of behavior.
339
340         * page/Crypto.cpp:
341         (WebCore::Crypto::getRandomValues):
342
343 2017-03-20  Eric Carlson  <eric.carlson@apple.com>
344
345         [MediaStream] Respect constraints passed to getUserMedia
346         https://bugs.webkit.org/show_bug.cgi?id=169870
347         <rdar://problem/31138936>
348
349         Reviewed by Youenn Fablet and Jer Noble.
350         
351         Remember the fitness score calculated when evaluating constraints passed to getUserMedia, so
352         the best device is chosen when more than one device supports the constraints. Register two
353         mock video and two mock audio devices with different capabilities so these changes can 
354         be tested.
355
356         No new tests, existing tests updated.
357
358         * platform/mediastream/RealtimeMediaSource.cpp:
359         (WebCore::RealtimeMediaSource::selectSettings): Store fitness score in m_fitnessScore.
360         * platform/mediastream/RealtimeMediaSource.h:
361
362         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
363         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
364         (WebCore::MockRealtimeAudioSource::create): Don't assume sampleRate is 44.1K
365         (WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers): Use sampleRate() instead of m_sampleRate.
366         (WebCore::MockRealtimeAudioSourceMac::reconfigure): Ditto.
367         (WebCore::MockRealtimeAudioSourceMac::render): Ditto.
368         (WebCore::MockRealtimeAudioSourceMac::applySampleRate): Ditto.
369
370         * platform/mock/MockRealtimeAudioSource.cpp:
371         (WebCore::MockRealtimeAudioSource::updateSettings): Don't assume sampleRate is 44.1K
372         (WebCore::MockRealtimeAudioSource::initializeCapabilities): Support a range of sample rates.
373         (WebCore::MockRealtimeAudioSource::startProducingData): Initialize sampleRate if it hasn't
374         already been set.
375
376         * platform/mock/MockRealtimeMediaSource.cpp:
377         (WebCore::MockRealtimeMediaSource::audioDevices): Return an array of devices.
378         (WebCore::MockRealtimeMediaSource::videoDevices): Ditto.
379         (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource):
380         (WebCore::MockRealtimeMediaSource::mockAudioSourcePersistentID): Deleted.
381         (WebCore::MockRealtimeMediaSource::mockVideoSourcePersistentID): Deleted.
382         (WebCore::MockRealtimeMediaSource::mockAudioSourceName): Deleted.
383         (WebCore::MockRealtimeMediaSource::mockVideoSourceName): Deleted.
384         (WebCore::MockRealtimeMediaSource::audioDeviceInfo): Deleted.
385         (WebCore::MockRealtimeMediaSource::videoDeviceInfo): Deleted.
386         * platform/mock/MockRealtimeMediaSource.h:
387
388         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
389         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
390         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
391         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamDevices):
392         * platform/mock/MockRealtimeVideoSource.cpp:
393         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
394
395 2017-03-20  Wenson Hsieh  <wenson_hsieh@apple.com>
396
397         TextIndicator should support a mode where selection rects are used to size the snapshot
398         https://bugs.webkit.org/show_bug.cgi?id=169845
399         <rdar://problem/31127818>
400
401         Reviewed by Beth Dakin.
402
403         Adds TextIndicator support in iOS for using the would-be selection rects of a given range to determine
404         snapshotting bounds. See below changes for more details.
405
406         * dom/Range.cpp:
407         (WebCore::Range::collectSelectionRectsWithoutUnionInteriorLines):
408         (WebCore::Range::collectSelectionRects):
409
410         Mark these helper methods as const.
411
412         * dom/Range.h:
413         * page/TextIndicator.cpp:
414         (WebCore::getSelectionRectsForRange):
415         (WebCore::initializeIndicator):
416
417         If TextIndicatorOptionUseSelectionRectForSizing is enabled, then compute selection rects and set the text rects
418         to be the resulting selection rects. These are in document coordinates.
419
420         * page/TextIndicator.h:
421
422 2017-03-20  Simon Fraser  <simon.fraser@apple.com>
423
424         Move code out of renderer destructors into willBeDestroyed()
425         https://bugs.webkit.org/show_bug.cgi?id=169650
426
427         Reviewed by Antti Koivisto.
428
429         This is done for four reasons. First, code in willBeDestroyed() is able to call
430         virtual functions on derived classes. Second, this code will run before we've destroyed
431         the renderer's rareData, so can safely access it. Third, RenderWidget is special, and can have
432         its lifetime extended via manual ref-counting, and we want all cleanup to complete
433         before it goes into this weird zombie state. Fourth, in a shiny future where we have
434         ref-counted RenderObjects, we want cleanup code to be run explicitly and not tied
435         to object lifetime, and this is a step in that direction.
436
437         For all classes that derive from RenderObject, move code from the destructor into
438         willBeDestroyed(). New willBeDestroyed() implementations must call the base class.
439
440         RenderBlock and RenderBlockFlow are special; RenderBlockFlow::willBeDestroyed()
441         skips over RenderBlock::willBeDestroyed(), but they both need to run some code, which
442         I moved into RenderBlock::blockWillBeDestroyed().
443
444         * rendering/RenderBlock.cpp:
445         (WebCore::RenderBlock::~RenderBlock):
446         (WebCore::RenderBlock::willBeDestroyed):
447         (WebCore::RenderBlock::blockWillBeDestroyed):
448         * rendering/RenderBlock.h:
449         * rendering/RenderBlockFlow.cpp:
450         (WebCore::RenderBlockFlow::~RenderBlockFlow):
451         (WebCore::RenderBlockFlow::willBeDestroyed):
452         * rendering/RenderBox.cpp:
453         (WebCore::RenderBox::~RenderBox):
454         (WebCore::RenderBox::willBeDestroyed):
455         * rendering/RenderBox.h:
456         * rendering/RenderBoxModelObject.cpp:
457         (WebCore::RenderBoxModelObject::~RenderBoxModelObject):
458         * rendering/RenderCounter.cpp:
459         (WebCore::RenderCounter::~RenderCounter):
460         (WebCore::RenderCounter::willBeDestroyed):
461         * rendering/RenderCounter.h:
462         * rendering/RenderElement.cpp:
463         (WebCore::RenderElement::~RenderElement):
464         (WebCore::RenderElement::willBeDestroyed):
465         * rendering/RenderEmbeddedObject.cpp:
466         (WebCore::RenderEmbeddedObject::~RenderEmbeddedObject):
467         (WebCore::RenderEmbeddedObject::willBeDestroyed):
468         * rendering/RenderEmbeddedObject.h:
469         * rendering/RenderImage.cpp:
470         (WebCore::RenderImage::~RenderImage):
471         (WebCore::RenderImage::willBeDestroyed):
472         * rendering/RenderImage.h:
473         * rendering/RenderLayerModelObject.cpp:
474         (WebCore::RenderLayerModelObject::~RenderLayerModelObject):
475         (WebCore::RenderLayerModelObject::willBeDestroyed):
476         * rendering/RenderLayerModelObject.h:
477         * rendering/RenderLineBreak.cpp:
478         (WebCore::RenderLineBreak::~RenderLineBreak):
479         (WebCore::RenderLineBreak::willBeDestroyed):
480         * rendering/RenderLineBreak.h:
481         * rendering/RenderListBox.cpp:
482         (WebCore::RenderListBox::~RenderListBox):
483         (WebCore::RenderListBox::willBeDestroyed):
484         * rendering/RenderListBox.h:
485         * rendering/RenderListItem.cpp:
486         (WebCore::RenderListItem::~RenderListItem):
487         (WebCore::RenderListItem::willBeDestroyed):
488         * rendering/RenderListItem.h:
489         * rendering/RenderListMarker.cpp:
490         (WebCore::RenderListMarker::~RenderListMarker):
491         (WebCore::RenderListMarker::willBeDestroyed):
492         * rendering/RenderListMarker.h:
493         * rendering/RenderMenuList.cpp:
494         (WebCore::RenderMenuList::~RenderMenuList):
495         (WebCore::RenderMenuList::willBeDestroyed):
496         * rendering/RenderMenuList.h:
497         * rendering/RenderNamedFlowThread.cpp:
498         (WebCore::RenderNamedFlowThread::~RenderNamedFlowThread):
499         (WebCore::RenderNamedFlowThread::willBeDestroyed):
500         * rendering/RenderNamedFlowThread.h:
501         * rendering/RenderObject.cpp:
502         (WebCore::RenderObject::willBeDestroyed):
503         * rendering/RenderQuote.cpp:
504         (WebCore::RenderQuote::~RenderQuote):
505         (WebCore::RenderQuote::willBeDestroyed):
506         * rendering/RenderQuote.h:
507         * rendering/RenderSearchField.cpp:
508         (WebCore::RenderSearchField::~RenderSearchField):
509         (WebCore::RenderSearchField::willBeDestroyed):
510         * rendering/RenderSearchField.h:
511         * rendering/RenderSnapshottedPlugIn.cpp:
512         (WebCore::RenderSnapshottedPlugIn::~RenderSnapshottedPlugIn):
513         (WebCore::RenderSnapshottedPlugIn::willBeDestroyed):
514         * rendering/RenderSnapshottedPlugIn.h:
515         * rendering/RenderText.cpp:
516         (WebCore::RenderText::~RenderText):
517         (WebCore::RenderText::willBeDestroyed):
518         * rendering/RenderTextControlMultiLine.cpp:
519         (WebCore::RenderTextControlMultiLine::~RenderTextControlMultiLine):
520         (WebCore::RenderTextControlMultiLine::willBeDestroyed):
521         * rendering/RenderTextControlMultiLine.h:
522         * rendering/RenderVideo.cpp:
523         (WebCore::RenderVideo::~RenderVideo):
524         (WebCore::RenderVideo::willBeDestroyed):
525         * rendering/RenderVideo.h:
526         * rendering/RenderWidget.h:
527         * rendering/svg/RenderSVGImage.cpp:
528         (WebCore::RenderSVGImage::~RenderSVGImage):
529         (WebCore::RenderSVGImage::willBeDestroyed):
530         * rendering/svg/RenderSVGImage.h:
531         * rendering/svg/RenderSVGResourceContainer.cpp:
532         (WebCore::RenderSVGResourceContainer::~RenderSVGResourceContainer):
533         (WebCore::RenderSVGResourceContainer::willBeDestroyed):
534
535 2017-03-20  Jon Lee  <jonlee@apple.com>
536
537         Mark differences in media stream implementation
538         https://bugs.webkit.org/show_bug.cgi?id=169873
539
540         Reviewed by Eric Carlson.
541
542         Rearrange IDL and add comments based on 05 February 2017 Editor's Draft of Media
543         Capture and Streams spec.
544         * Modules/mediastream/DOMURLMediaStream.idl:
545         * Modules/mediastream/MediaDeviceInfo.idl:
546         * Modules/mediastream/MediaDevices.idl:
547         * Modules/mediastream/MediaStream.idl:
548         * Modules/mediastream/MediaStreamEvent.idl:
549         * Modules/mediastream/MediaStreamTrack.idl:
550         * Modules/mediastream/MediaStreamTrackEvent.idl:
551         * Modules/mediastream/MediaTrackConstraints.idl:
552         * Modules/mediastream/MediaTrackSupportedConstraints.idl:
553         * Modules/mediastream/NavigatorMediaDevices.idl:
554         * Modules/mediastream/NavigatorUserMedia.idl:
555
556 2017-03-20  Per Arne Vollan  <pvollan@apple.com>
557
558         Use CopyFontDescriptorWithStrokeForStyle to get correct stroke width for captions.
559         https://bugs.webkit.org/show_bug.cgi?id=169674
560
561         Reviewed by Eric Carlson.
562
563         Use the MediaAccessibility function MACopyFontDescriptorWithStrokeForStyle to get
564         correct video captions stroke width from a given font size.
565
566         * html/shadow/MediaControlElements.cpp:
567         (WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
568         (WebCore::MediaControlTextTrackContainerElement::updateTimerFired):
569         * html/shadow/MediaControlElements.h:
570         * page/CaptionUserPreferences.h:
571         (WebCore::CaptionUserPreferences::captionStrokeWidth):
572         * page/CaptionUserPreferencesMediaAF.cpp:
573         (WebCore::CaptionUserPreferencesMediaAF::captionStrokeWidth):
574         (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS):
575         (WebCore::CaptionUserPreferencesMediaAF::strokeWidth): Deleted.
576         * page/CaptionUserPreferencesMediaAF.h:
577         * platform/cf/MediaAccessibilitySoftLink.cpp:
578         * platform/cf/MediaAccessibilitySoftLink.h:
579
580 2017-03-20  Emanuele Aina  <emanuele.aina@collabora.com>
581
582         [Cairo] Ensure depth and stencil renderbuffers are created on GLESv2
583         https://bugs.webkit.org/show_bug.cgi?id=166643
584
585         Reviewed by Darin Adler.
586
587         If the gfx device doesn't support GL_OES_packed_depth_stencil, the
588         separate depth and stencil buffers are not generated.
589
590         Copy what GraphicsContext3DEfl used to do and apply it in
591         GraphicsContext3DCairo.
592
593         The Intel gfx driver seem to tolerate unbound renderbuffers, but
594         enabling debugging in Mesa yields an error:
595
596         $ MESA_DEBUG=1 \
597           MESA_EXTENSION_OVERRIDE=-GL_OES_packed_depth_stencil
598           ./bin/MiniBrowser http://webglsamples.org/aquarium/aquarium.html
599         Mesa: User error: GL_INVALID_OPERATION in glRenderbufferStorage(no renderbuffer bound)
600
601         * platform/graphics/GraphicsContext3D.h:
602         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
603         (WebCore::GraphicsContext3D::GraphicsContext3D):
604         Ensure separate depth and stencil renderbuffers are created.
605         (WebCore::GraphicsContext3D::~GraphicsContext3D):
606         Ensure separate depth and stencil renderbuffers are released.
607
608 2017-03-19  Chris Dumez  <cdumez@apple.com>
609
610         Implement self.origin
611         https://bugs.webkit.org/show_bug.cgi?id=168023
612
613         Reviewed by Sam Weinig.
614
615         Implement self.origin:
616         - https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope
617
618         Firefox and Chrome already support this.
619
620         Test: imported/w3c/web-platform-tests/html/webappapis/the-windoworworkerglobalscope-mixin/Worker_Self_Origin.html
621
622         * page/DOMWindow.cpp:
623         (WebCore::DOMWindow::origin):
624         * page/DOMWindow.h:
625         * page/WindowOrWorkerGlobalScope.idl:
626         * workers/WorkerGlobalScope.cpp:
627         (WebCore::WorkerGlobalScope::origin):
628         * workers/WorkerGlobalScope.h:
629
630 2017-03-18  Jon Lee  <jonlee@apple.com>
631
632         Add support for ImplementedAs, Clamp, EnforceRange, TreatNullAs for dictionary members
633         https://bugs.webkit.org/show_bug.cgi?id=169731
634
635         Reviewed by Alex Christensen.
636
637         * bindings/scripts/CodeGeneratorJS.pm:
638         (GenerateDictionaryImplementationContent): Create a new $implementationAsKey. Look for
639         ImplementedAs, and if it exists, override the value with the alias. Set the parameters of
640         convert<>() using JSValueToNative.
641         (IsValidContextForJSValueToNative): Update to include IDLDictionaryMembers.
642         (JSValueToNative): Bypass parseEnumeration serialization for enums if the context is an
643         IDLDictionaryMember. Dictionary members need convert<IDLEnumeration> which throw a TypeError
644         or return the enum (and utilizes parseEnumeration). parseEnumeration, in contrast, returns
645         an optional.
646
647         * bindings/scripts/test/TestObj.idl: Add test cases in TestDictionary.
648
649         Update test results.
650         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
651         * bindings/scripts/test/JS/JSTestObj.cpp:
652         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
653
654 2017-03-18  Simon Fraser  <simon.fraser@apple.com>
655
656         Use initializers for Document member variables
657         https://bugs.webkit.org/show_bug.cgi?id=169848
658
659         Reviewed by Chris Dumez.
660
661         Move Document to use C++11 brace initializers.
662
663         No behavior change.
664
665         * dom/Document.cpp:
666         (WebCore::Document::Document):
667         * dom/Document.h:
668         (WebCore::Document::xmlStandaloneStatus):
669         (WebCore::Document::setHasXMLDeclaration):
670
671 2017-03-18  Chris Dumez  <cdumez@apple.com>
672
673         innerText setter inserts empty text node if value starts with newline
674         https://bugs.webkit.org/show_bug.cgi?id=169600
675
676         Reviewed by Ryosuke Niwa.
677
678         innerText setter should not create empty text nodes as per:
679         - https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute (step 6.2)
680
681         No new tests, updated existing test.
682
683         * html/HTMLElement.cpp:
684         (WebCore::textToFragment):
685
686 2017-03-18  Chris Dumez  <cdumez@apple.com>
687
688         Allow setting the prototype of cross-origin objects, as long as they don't change
689         https://bugs.webkit.org/show_bug.cgi?id=169787
690
691         Reviewed by Mark Lam.
692
693         Allow setting the prototype of cross-origin objects, as long as they don't change:
694         - https://html.spec.whatwg.org/multipage/browsers.html#windowproxy-setprototypeof
695         - https://html.spec.whatwg.org/multipage/browsers.html#location-setprototypeof
696         - https://tc39.github.io/ecma262/#sec-set-immutable-prototype
697
698         Tests: imported/w3c/web-platform-tests/common/domain-setter.sub.html
699                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin-domain.sub.html
700                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-goes-cross-origin-domain.sub.html
701                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-same-origin-domain.sub.html
702                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-same-origin.html
703                imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin-domain.sub.html
704                imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-goes-cross-origin-domain.sub.html
705                imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin-domain.sub.html
706                imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin.html
707
708         * bindings/js/JSLocationCustom.cpp:
709         * page/Location.idl:
710         Drop custom setPrototype() implementation for Location and mark Location as an immutable
711         prototype exotic object now that JSC does the right thing for those.
712
713 2017-03-17  Youenn Fablet  <youenn@apple.com>
714
715         Stop sending media data as soon as peer connection is closed
716         https://bugs.webkit.org/show_bug.cgi?id=169813
717
718         Reviewed by Eric Carlson.
719
720         Stopping sending of media data as soon as the peer connection is closed.
721         By stopping sending at source level, this may stop by a few frames/chunks earlier than before.
722         Making sure RealtimeOutgoingVideoSource is stopping observing the media source when being stopped and deleted.
723
724         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
725         (WebCore::LibWebRTCPeerConnectionBackend::doStop):
726         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
727         (WebCore::RealtimeOutgoingAudioSource::stop):
728         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
729         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
730         (WebCore::RealtimeOutgoingVideoSource::stop):
731         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
732
733 2017-03-17  Youenn Fablet  <youenn@apple.com>
734
735         Implement incoming webrtc data based on tracksCurr
736         https://bugs.webkit.org/show_bug.cgi?id=169836
737
738         Reviewed by Eric Carlson.
739
740         Test: webrtc/video-with-receiver.html
741
742         Constructing incoming tracks based on libwebrtc OnAddTrack.
743         Constructing incoming media streams based on libwebrtc OnAddStream.
744         Firing only addstream if legacy API flag is on.
745
746         Ensuring that media stream and media stream tracks relationship is still correctly implemented.
747         For that, we keep a map that relates libwebrtc media streams with WebCore media streams.
748         Adding the ability to get a receiver related to the track on the track event.
749
750         Implementing the possibility to create a transceiver ahead of track arrival time.
751         Created transceivers that are not related to any real source are kept in the peer connection back end.
752         When a libwebrtc track is appearing, it is associated with the track source of the corresponding transceiver based on track type.
753
754         Added the ability to create empty real time sources and set their data libwebrtc track when being available.
755
756         * Modules/mediastream/MediaStream.cpp:
757         (WebCore::MediaStream::addTrackFromPlatform):
758         * Modules/mediastream/MediaStream.h:
759         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
760         (WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
761         (WebCore::LibWebRTCMediaEndpoint::addRemoteStream):
762         (WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
763         (WebCore::LibWebRTCMediaEndpoint::removeRemoteStream):
764         (WebCore::LibWebRTCMediaEndpoint::OnAddStream):
765         (WebCore::LibWebRTCMediaEndpoint::OnRemoveStream):
766         (WebCore::LibWebRTCMediaEndpoint::OnAddTrack):
767         (WebCore::LibWebRTCMediaEndpoint::stop):
768         (WebCore::createMediaStreamTrack): Deleted.
769         (WebCore::LibWebRTCMediaEndpoint::addStream): Deleted.
770         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
771         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
772         (WebCore::LibWebRTCPeerConnectionBackend::doStop):
773         (WebCore::createReceiverForSource):
774         (WebCore::createEmptySource):
775         (WebCore::LibWebRTCPeerConnectionBackend::createReceiver):
776         (WebCore::LibWebRTCPeerConnectionBackend::videoReceiver):
777         (WebCore::LibWebRTCPeerConnectionBackend::audioReceiver):
778         (WebCore::LibWebRTCPeerConnectionBackend::removeRemoteStream):
779         (WebCore::LibWebRTCPeerConnectionBackend::addRemoteStream):
780         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
781         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
782         (WebCore::RealtimeIncomingAudioSource::setSourceTrack):
783         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
784         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
785         (WebCore::RealtimeIncomingVideoSource::setSourceTrack):
786         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
787
788 2017-03-17  Eric Carlson  <eric.carlson@apple.com>
789
790         [MediaStream] Compensate for video capture orientation
791         https://bugs.webkit.org/show_bug.cgi?id=169313
792         <rdar://problem/30994785>
793
794         Unreviewed, fix a crash in r214120 found by the bots.
795
796         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
797         (-[WebAVSampleBufferStatusChangeListener invalidate]): Drive-by removal of unnecessary code.
798         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
799         Actually retain self before callOnMainThread.
800         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC): 
801         Invalidate the change listener first.
802
803 2017-03-17  Dean Jackson  <dino@apple.com>
804
805         MediaQueryList instances do not update for `prefers-reduced-motion`
806         https://bugs.webkit.org/show_bug.cgi?id=169835
807         <rdar://problem/30339378>
808
809         Reviewed by Anders Carlsson.
810
811         Tell the document it needs to evaluate the MediaQueryLists
812         if accessibility settings change.
813
814         Test: fast/media/mq-prefers-reduced-motion-matchMedia.html
815
816         * page/Page.cpp:
817         (WebCore::Page::accessibilitySettingsDidChange):
818
819 2017-03-17  Brady Eidson  <beidson@apple.com>
820
821         Make HTTPCookieStorage operate in the UIProcess in absence of a WebProcessPool.
822         <rdar://problem/31102330> and https://bugs.webkit.org/show_bug.cgi?id=169797
823
824         Reviewed by Alex Christensen.
825
826         No new tests (No behavior change).
827
828         * platform/network/NetworkStorageSession.h:
829         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
830         (WebCore::NetworkStorageSession::flushCookieStore):
831
832         * platform/network/soup/NetworkStorageSessionSoup.cpp:
833         (WebCore::NetworkStorageSession::flushCookieStore):
834
835 2017-03-17  Dave Hyatt  <hyatt@apple.com>
836
837         Disable per-region boxes for multicolumn
838         https://bugs.webkit.org/show_bug.cgi?id=169830
839
840         Reviewed by Zalan Bujtas.
841
842         Test: fast/multicol/float-adjacent-to-overflow-block.html
843
844         * rendering/RenderBlockFlow.cpp:
845         (WebCore::RenderBlockFlow::determineLogicalLeftPositionForChild):
846         * rendering/RenderBox.cpp:
847         (WebCore::RenderBox::borderBoxRectInRegion):
848         (WebCore::RenderBox::renderBoxRegionInfo):
849         Limit all of the per-region box code to RenderNamedFlowThreads.
850         This code should never be used by multicolumn layout.
851
852 2017-03-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
853
854         Time channel attack on SVG Filters
855         https://bugs.webkit.org/show_bug.cgi?id=118689
856
857         Reviewed by Simon Fraser.
858
859         The time channel attack can happen if the attacker applies FEColorMatrix
860         or FEConvolveMatrix and provides a matrix which is filled with subnormal
861         floating point values. Performing floating-point operations on subnormals
862         is very expensive unless the pixel in the source graphics is black (or
863         zero). By measuring the time a filter takes to be applied, the attacker
864         can know whether the pixel he wants to steal from  an iframe is black or
865         white. By repeating the same process on all the pixels in the iframe, the
866         attacker can reconstruct the whole page of the iframe.
867
868         To fix this issue, the values in the matrices of these filters will clamped
869         to FLT_MIN. We do not want to consume too much time calculating filtered
870         pixels because of such tiny values. The difference between applying FLT_MIN
871         and applying a subnormal should not be even noticeable. Normalizing the
872         floating-point matrices should happen only at the beginning of the filter
873         platformApplySoftware().
874
875         * platform/graphics/filters/FEColorMatrix.cpp:
876         (WebCore::FEColorMatrix::platformApplySoftware):
877         * platform/graphics/filters/FEConvolveMatrix.cpp:
878         (WebCore::FEConvolveMatrix::fastSetInteriorPixels):
879         (WebCore::FEConvolveMatrix::fastSetOuterPixels):
880         (WebCore::FEConvolveMatrix::platformApplySoftware):
881         * platform/graphics/filters/FEConvolveMatrix.h:
882         * platform/graphics/filters/FilterEffect.h:
883         (WebCore::FilterEffect::normalizedFloats):
884
885 2017-03-17  Jer Noble  <jer.noble@apple.com>
886
887         Explicitly resize the audio buffer in RealtimeOutgoingAudioSource.
888         https://bugs.webkit.org/show_bug.cgi?id=169814
889         <rdar://problem/30975496>
890
891         Reviewed by Eric Carlson.
892
893         Rather than just reserving sufficient capacity, actually change the buffer's underlying size to match.
894
895         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
896         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
897
898 2017-03-17  Jiewen Tan  <jiewen_tan@apple.com>
899
900         [WebCrypto] Make sure all CryptoKey classes are structured clonable
901         https://bugs.webkit.org/show_bug.cgi?id=169232
902         <rdar://problem/31106660>
903
904         Reviewed by Brent Fulgham.
905
906         This patch does the following few things: 1) It makes CryptoKeyEC and CryptoKeyRaw
907         structured clonable; 2) It makes CryptoKeyAES and CryptoKeyHMAC to use a move importer
908         during deserialization; 3) It adds some tests to make sure CryptoKeyAES, CryptoKeyHMAC
909         and CryptoKeyRSA won't lose their internal data during serialization/deserialization.
910
911         Tests: crypto/workers/subtle/ec-postMessage-worker.html
912                crypto/workers/subtle/raw-postMessage-worker.html
913
914         * bindings/js/SerializedScriptValue.cpp:
915         (WebCore::CloneSerializer::write):
916         (WebCore::CloneDeserializer::readHMACKey):
917         (WebCore::CloneDeserializer::readAESKey):
918         (WebCore::CloneDeserializer::readECKey):
919         (WebCore::CloneDeserializer::readRawKey):
920         (WebCore::CloneDeserializer::readCryptoKey):
921         * crypto/keys/CryptoKeyEC.cpp:
922         (WebCore::CryptoKeyEC::namedCurveString):
923         (WebCore::CryptoKeyEC::isValidECAlgorithm):
924         * crypto/keys/CryptoKeyEC.h:
925
926 2017-03-17  Michael Saboff  <msaboff@apple.com>
927
928         Use USE_INTERNAL_SDK to compute ENABLE_FAST_JIT_PERMISSIONS instead of HAVE_INTERNAL_SDK
929         https://bugs.webkit.org/show_bug.cgi?id=169817
930
931         Reviewed by Filip Pizlo.
932
933         * Configurations/FeatureDefines.xcconfig:
934
935 2017-03-17  Eric Carlson  <eric.carlson@apple.com>
936
937         [MediaStream] Compensate for video capture orientation
938         https://bugs.webkit.org/show_bug.cgi?id=169313
939         <rdar://problem/30994785>
940
941         Reviewed by Jer Noble.
942
943         No new tests, the mock video source doesn't support rotation. Test will be added when this
944         is fixed in https://bugs.webkit.org/show_bug.cgi?id=169822.
945
946         Add 'orientation' and 'mirrored' attributes to MediaSample
947         * platform/MediaSample.h:
948         (WebCore::MediaSample::videoOrientation):
949         (WebCore::MediaSample::videoMirrored):
950         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
951
952         A video sample can be rotated and/or mirrored, so the video layer may need to be rotated
953         and resized for display. We don't want expose this information to the renderer, so allocate
954         return a generic CALayer as the player's platforLayer, and add the video layer as a sublayer
955         so we can adjust it to display correctly. Add an enum for playback state as well as display
956         mode so we correctly display a black frame when video frames are available but playback has
957         not yet started.
958
959         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
960         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
961         (-[WebAVSampleBufferStatusChangeListener initWithParent:]):
962         (-[WebAVSampleBufferStatusChangeListener invalidate]):
963         (-[WebAVSampleBufferStatusChangeListener beginObservingLayers]):
964         (-[WebAVSampleBufferStatusChangeListener stopObservingLayers]): Ditto.
965         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
966         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoTransformationMatrix):
967         (WebCore::runWithoutAnimations):
968         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
969         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerErrorDidChange):
970         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
971         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
972         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::cancelLoad):
973         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer):
974         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::displayLayer):
975         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::backgroundLayer):
976         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode):
977         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode):
978         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play):
979         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause):
980         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentMediaTime):
981         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::activeStatusChanged):
982         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateRenderingMode):
983         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
984         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext):
985         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::acceleratedRenderingStateChanged):
986         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setShouldBufferData):
987         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::backgroundLayerBoundsChanged):
988         (-[WebAVSampleBufferStatusChangeListener beginObservingLayer:]): Deleted.
989         (-[WebAVSampleBufferStatusChangeListener stopObservingLayer:]): Deleted.
990         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Deleted.
991         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Deleted.
992         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paused): Deleted.
993         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::shouldBePlaying): Deleted.
994
995         * platform/mediastream/mac/AVVideoCaptureSource.h:
996         * platform/mediastream/mac/AVVideoCaptureSource.mm:
997         (WebCore::AVVideoCaptureSource::processNewFrame): Add connection parameter so we can get the
998         video orientation.
999         (WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
1000
1001         Pass sample orientation to libwebrtc.
1002         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1003         (WebCore::RealtimeOutgoingVideoSource::sendFrame):
1004         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
1005         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1006
1007 2017-03-17  Zalan Bujtas  <zalan@apple.com>
1008
1009         Fix the flow thread state on the descendants of out of flow positioned replaced elements.
1010         https://bugs.webkit.org/show_bug.cgi?id=169821
1011         <rdar://problem/30964017>
1012
1013         Reviewed by Simon Fraser.
1014
1015         Descendants of a replaced out of flow elmement should inherit the flowthread state
1016         from the replaced element and not from the replaced element's parent.
1017
1018         Test: fast/multicol/fix-inherit-when-container-is-replaced.html
1019
1020         * rendering/RenderObject.cpp:
1021         (WebCore::RenderObject::computedFlowThreadState):
1022
1023 2017-03-17  Jon Davis  <jond@apple.com>
1024
1025         Update feature status for outdated entries: CSS Shapes, Force Click Events
1026         https://bugs.webkit.org/show_bug.cgi?id=169829
1027
1028         Reviewed by Matt Baker.
1029
1030         * features.json:
1031
1032 2017-03-17  Alex Christensen  <achristensen@webkit.org>
1033
1034         Make SocketStreamError a private header.
1035         https://bugs.webkit.org/show_bug.cgi?id=169831
1036
1037         * WebCore.xcodeproj/project.pbxproj:
1038         I'll need this from WebKit2.
1039
1040 2017-03-17  Alex Christensen  <achristensen@webkit.org>
1041
1042         Add encoder for SocketStreamError
1043         https://bugs.webkit.org/show_bug.cgi?id=169831
1044
1045         Reviewed by Andy Estes.
1046
1047         This isn't used yet, but we'll soon need to send these across IPC.
1048
1049         * platform/network/SocketStreamError.h:
1050         (WebCore::SocketStreamError::encode):
1051         (WebCore::SocketStreamError::decode):
1052
1053 2017-03-17  Alex Christensen  <achristensen@webkit.org>
1054
1055         Make SocketStreamHandle virtual functions asynchronous
1056         https://bugs.webkit.org/show_bug.cgi?id=169818
1057
1058         Reviewed by Andy Estes.
1059
1060         No change in behavior.  Instead of returning immediately, call a completion handler.
1061         This is in preparation for making them truly asynchronous.
1062
1063         I still need to be able to synchronously get the number of buffered bytes, but the
1064         buffer itself will soon be in the NetworkProcess with a new subclass of SocketStreamHandle
1065         that messages across IPC.  The number of buffered bytes will still be stored in the WebProcess,
1066         and when it updates, the message from SocketStreamHandleClient::didUpdateBufferedAmount will update it.
1067
1068         * CMakeLists.txt:
1069         * WebCore.xcodeproj/project.pbxproj:
1070         * platform/network/SocketStreamHandle.cpp:
1071         (WebCore::SocketStreamHandle::send):
1072         (WebCore::SocketStreamHandle::close):
1073         (WebCore::SocketStreamHandle::sendPendingData): Deleted.
1074         * platform/network/SocketStreamHandle.h:
1075         (WebCore::SocketStreamHandle::bufferedAmount): Deleted.
1076         * platform/network/SocketStreamHandleImpl.cpp: Added.
1077         (WebCore::SocketStreamHandleImpl::platformSend):
1078         (WebCore::SocketStreamHandleImpl::sendPendingData):
1079         (WebCore::SocketStreamHandleImpl::bufferedAmount):
1080         m_buffer was moved from SocketStreamHandle to SocketStreamHandleImpl, so some of the logic must move with it.
1081         I moved as much logic that was shared in the superclass to a new shared location for code shared among the subclass implementations.
1082         * platform/network/cf/SocketStreamHandleImpl.h:
1083         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
1084         (WebCore::SocketStreamHandleImpl::platformSendInternal):
1085         (WebCore::SocketStreamHandleImpl::platformSend): Deleted.
1086         * platform/network/curl/SocketStreamHandleImpl.h:
1087         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
1088         (WebCore::SocketStreamHandleImpl::platformSendInternal):
1089         (WebCore::SocketStreamHandleImpl::platformSend): Deleted.
1090         * platform/network/soup/SocketStreamHandleImpl.h:
1091         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
1092         (WebCore::SocketStreamHandleImpl::platformSendInternal):
1093         (WebCore::SocketStreamHandleImpl::platformSend): Deleted.
1094
1095 2017-03-17  Antti Koivisto  <antti@apple.com>
1096
1097         Add a reload policy where only expired subresources are revalidated
1098         https://bugs.webkit.org/show_bug.cgi?id=169756
1099
1100         Reviewed by Andreas Kling.
1101
1102         Test: http/tests/cache/reload-expired-only.html
1103
1104         The default reload behavior revalidates all resources on the page. This patch adds
1105         a new policy that revalidates expired (and uncacheable) resources only. Using this
1106         policy can speed up reloads significantly and also reduce network traffic and server
1107         load.
1108
1109         * history/PageCache.cpp:
1110         (WebCore::canCachePage):
1111         * inspector/InspectorPageAgent.cpp:
1112         (WebCore::InspectorPageAgent::reload):
1113         * loader/FrameLoader.cpp:
1114         (WebCore::isBackForwardLoadType):
1115         (WebCore::isReload):
1116
1117             Add a helper function.
1118
1119         (WebCore::FrameLoader::loadURL):
1120         (WebCore::logNavigation):
1121         (WebCore::FrameLoader::reload):
1122
1123             Replace bool arguments with OptionSet<ReloadOption>. Most of the patch is about adapting to this.
1124
1125         (WebCore::FrameLoader::transitionToCommitted):
1126         (WebCore::FrameLoader::subresourceCachePolicy):
1127
1128             Return CachePolicyVerify for 'ReloadExpiredOnly' frame load type. This is the substantive
1129             change that causes the behavior difference.
1130
1131         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
1132         (WebCore::FrameLoader::defaultRequestCachingPolicy):
1133
1134             Flip the isMainResource condition for better readability.
1135
1136         (WebCore::FrameLoader::shouldPerformFragmentNavigation):
1137         (WebCore::FrameLoader::loadDifferentDocumentItem):
1138         * loader/FrameLoader.h:
1139         (WebCore::FrameLoader::reload):
1140         * loader/FrameLoaderTypes.h:
1141         * loader/HistoryController.cpp:
1142         (WebCore::HistoryController::restoreDocumentState):
1143         * page/DiagnosticLoggingKeys.cpp:
1144         (WebCore::DiagnosticLoggingKeys::reloadRevalidatingExpiredKey):
1145         * page/DiagnosticLoggingKeys.h:
1146         * replay/UserInputBridge.cpp:
1147         (WebCore::UserInputBridge::reloadFrame):
1148         * replay/UserInputBridge.h:
1149         * testing/Internals.cpp:
1150         (WebCore::Internals::forceReload):
1151         (WebCore::Internals::reloadExpiredOnly):
1152
1153             Testing support.
1154
1155         * testing/Internals.h:
1156         * testing/Internals.idl:
1157
1158 2017-03-17  Nan Wang  <n_wang@apple.com>
1159
1160         AX: VoiceOver no longer works corectly with editable text in the web
1161         https://bugs.webkit.org/show_bug.cgi?id=169801
1162
1163         Reviewed by Chris Fleizach.
1164
1165         The issue is that since we are entering text controls when getting the text marker,
1166         the end text marker of the input tag might associate to the placeholder div instead of 
1167         the input tag itself. 
1168         Fixed the issue by checking the shadow elements using shadowHost() instead of isShadowRoot().
1169         Also, only enter text controls when navigating by characters/indexes, so that both Mac and
1170         iOS will get the correct text marker ranges for shadow host elements.
1171
1172         Tests: accessibility/ios-simulator/element-text-range-for-text-control.html
1173                accessibility/mac/text-markers-for-input-with-placeholder.html
1174
1175         * accessibility/AXObjectCache.cpp:
1176         (WebCore::AXObjectCache::traverseToOffsetInRange):
1177         (WebCore::AXObjectCache::startOrEndCharacterOffsetForRange):
1178         (WebCore::AXObjectCache::characterOffsetForIndex):
1179         * accessibility/AXObjectCache.h:
1180
1181 2017-03-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1182
1183         [WK1] Support animated transitions when performing a data interaction operation
1184         https://bugs.webkit.org/show_bug.cgi?id=169805
1185         <rdar://problem/31045767>
1186
1187         Reviewed by Beth Dakin and Megan Gardner.
1188
1189         When performing a snapshot excluding the current selection, use ScrollableArea::visibleContentRect to compute
1190         the visible content rect rather than FrameView::visualViewportRect. In WebKit1, the latter will return the
1191         entire content view's bounds.
1192
1193         * page/TextIndicator.cpp:
1194         (WebCore::takeSnapshots):
1195
1196 2017-03-17  Dave Hyatt  <hyatt@apple.com>
1197
1198         Initial letter does not paginate properly.
1199         https://bugs.webkit.org/show_bug.cgi?id=169795
1200         <rdar://problem/23715770>
1201
1202         Reviewed by Zalan Bujtas.
1203
1204         Tests: fast/css-generated-content/initial-letter-pagination-raised.html
1205                fast/css-generated-content/initial-letter-pagination-raised-rl.html
1206                fast/css-generated-content/initial-letter-pagination-sunken.html
1207                fast/css-generated-content/initial-letter-pagination-sunken-rl.html
1208
1209         * rendering/FloatingObjects.cpp:
1210         (WebCore::FloatingObject::FloatingObject):
1211         (WebCore::FloatingObject::copyToNewContainer):
1212         (WebCore::FloatingObject::cloneForNewParent):
1213         (WebCore::FloatingObject::translationOffsetToAncestor):
1214         * rendering/FloatingObjects.h:
1215         (WebCore::FloatingObject::setMarginOffset):
1216         (WebCore::FloatingObject::locationOffsetOfBorderBox):
1217         (WebCore::FloatingObject::marginOffset):
1218         Add the margin offset to the FloatingObject so that we can control the
1219         placement of the border box relative to the margin box without relying
1220         on only the CSS-specified margins. This allows for sunken initial letter
1221         FloatingObjects to be created and propagated out to ancestor blocks for painting
1222         without altering the CSS margins of the sunken letter.
1223
1224         * rendering/RenderBlockFlow.cpp:
1225         (WebCore::RenderBlockFlow::adjustForUnsplittableChild):
1226         Update the logical height for initial letter containers after the initial
1227         letter shifts to the next page, since the lines that follow need to lay out
1228         relative to the initial letter, i.e., they shift down if it shifts down.
1229
1230         (WebCore::RenderBlockFlow::addOverflowFromFloats):
1231         (WebCore::RenderBlockFlow::paintFloats):
1232         (WebCore::RenderBlockFlow::clipOutFloatingObjects):
1233         Patched to use the new helpers on FloatingObject rather than
1234         xPositionForFloatIncludingMargins and yPositionForFloatIncludingMargins.
1235
1236         (WebCore::RenderBlockFlow::computeLogicalLocationForFloat):
1237         Updated to set the placement and margins of the floating object before
1238         returning. The initial letter adjustments have been factored out into their
1239         own function.
1240
1241         (WebCore::RenderBlockFlow::adjustInitialLetterPosition):
1242         A helper function called by computeLogicalLocationForFloat that handles
1243         the placement and margin adjustments for initial letters. Note that sunken
1244         letters no longer "hack" the top margin of the child but instead rely on
1245         the fact that the FloatingObject has its own independent margin offset now
1246         that can be set to a value that is distinct from the CSS supplied margin.
1247
1248         (WebCore::RenderBlockFlow::positionNewFloats):
1249         Revised to no longer do the placement, but to let computeLogicalLocationForFloat
1250         do it. The height is still set here however, since we don't know that until after
1251         the child has received a layout.
1252
1253         (WebCore::RenderBlockFlow::addOverhangingFloats):
1254         (WebCore::RenderBlockFlow::flipFloatForWritingModeForChild):
1255         (WebCore::RenderBlockFlow::hitTestFloats):
1256         (WebCore::RenderBlockFlow::adjustForBorderFit):
1257         Patched to use the new FloatingObject helpers rather than
1258         xPositionForFloatIncludingMargins and yPositionForFloatIncludingMargins.
1259
1260         * rendering/RenderBlockFlow.h:
1261         (WebCore::RenderBlockFlow::setLogicalMarginsForFloat):
1262         New helper function for setting the margin offsets on a FloatingObject.
1263
1264         (WebCore::RenderBlockFlow::xPositionForFloatIncludingMargin): Deleted.
1265         (WebCore::RenderBlockFlow::yPositionForFloatIncludingMargin): Deleted.
1266         Deleted in favor of new FloatingObject helpers.
1267
1268         * rendering/RenderBox.cpp:
1269         (WebCore::RenderBox::isUnsplittableForPagination):
1270         Make initial letter unsplittable as far as pagination is concerned.
1271
1272         * rendering/RootInlineBox.cpp:
1273         (WebCore::RootInlineBox::ascentAndDescentForBox):
1274         (WebCore::RootInlineBox::includeFontForBox):
1275         (WebCore::RootInlineBox::includeGlyphsForBox):
1276         (WebCore::RootInlineBox::fitsToGlyphs):
1277         Turn off the restriction that you can't fit to vertical glyphs. The numbers returned
1278         are fine now. This allows vertical initial letters to work.
1279
1280 2017-03-17  Youenn Fablet  <youenn@apple.com>
1281
1282         RealtimeIncomingAudioSource is not stopping properly
1283         https://bugs.webkit.org/show_bug.cgi?id=169807
1284
1285         Reviewed by Eric Carlson.
1286
1287         Test: webrtc/release-after-getting-track.html
1288
1289         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
1290         (WebCore::RealtimeIncomingAudioSource::~RealtimeIncomingAudioSource):
1291         (WebCore::RealtimeIncomingAudioSource::stopProducingData):
1292
1293 2017-03-16  Alex Christensen  <achristensen@webkit.org>
1294
1295         Use completion handlers instead of return values for sending websocket data
1296         https://bugs.webkit.org/show_bug.cgi?id=169802
1297
1298         Reviewed by Carlos Garcia Campos.
1299
1300         No change in behavior, but this is a baby step towards making things more asynchronous.
1301
1302         * Modules/websockets/WebSocketChannel.cpp:
1303         (WebCore::WebSocketChannel::didOpenSocketStream):
1304         (WebCore::WebSocketChannel::processOutgoingFrameQueue):
1305         (WebCore::WebSocketChannel::sendFrame):
1306         * Modules/websockets/WebSocketChannel.h:
1307         * platform/network/SocketStreamHandle.cpp:
1308         (WebCore::SocketStreamHandle::send):
1309         * platform/network/SocketStreamHandle.h:
1310         * platform/network/cf/SocketStreamHandleImpl.h:
1311
1312 2017-03-17  Zan Dobersek  <zdobersek@igalia.com>
1313
1314         WebGPU: build fixes for non-Cocoa platforms
1315         https://bugs.webkit.org/show_bug.cgi?id=169781
1316
1317         Reviewed by Alex Christensen.
1318
1319         Enable building WebGPU code for other ports and fix various build
1320         failures. This still leaves the GPUDevice::platformLayer() method
1321         missing for other ports, as well as the general implementation of
1322         the WebGPU platform abstractions under platform/graphics/gpu/.
1323
1324         * CMakeLists.txt: Move the WebGPU build targets here.
1325         * PlatformMac.cmake:
1326         * html/canvas/WebGPULibrary.h: Explicitly include the WTFString.h
1327         header to suppress missing WTF::String definition errors.
1328         * platform/graphics/gpu/GPUBuffer.cpp:
1329         (WebCore::GPUBuffer::contents): Avoid ambiguous calls to
1330         ArrayBuffer::create() by passing nullptr as the first argument.
1331         * platform/graphics/gpu/GPUDevice.h: Include the Forward.h header
1332         to forward-declare the WTF::String class. Also remove the unused
1333         PlatformGPUDevice typedef for non-Cocoa platforms.
1334         (WebCore::GPUDevice::layer): Move this and the related m_layer
1335         member variable under the PLATFORM(COCOA) guard.
1336         * platform/graphics/gpu/GPUFunction.cpp:
1337         (WebCore::GPUFunction::GPUFunction): Remove the GPULibrary
1338         parameter checks in this no-op constructor that's used on
1339         non-Cocoa platforms.
1340
1341 2017-03-17  Miguel Gomez  <magomez@igalia.com>
1342
1343         Follow-up (r213833): write a layout test for 169199
1344         https://bugs.webkit.org/show_bug.cgi?id=169576
1345         <rdar://problem/31024766>
1346
1347         Reviewed by Said Abou-Hallawa.
1348
1349         Add a function to Internals to force the deletion of the ImageDecoder just after
1350         requesting the async decoding of a frame, and implement that behaviour in BitmapImage.
1351
1352         Test: fast/images/clear-animation-decoder.html
1353
1354         * platform/graphics/BitmapImage.cpp:
1355         (WebCore::BitmapImage::internalStartAnimation):
1356         * platform/graphics/BitmapImage.h:
1357         * testing/Internals.cpp:
1358         (WebCore::Internals::setClearDecoderAfterAsyncFrameRequestForTesting):
1359         * testing/Internals.h:
1360         * testing/Internals.idl:
1361
1362 2017-03-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1363
1364         [Cairo] Handle the blend mode in GraphicsContext::drawPattern
1365         https://bugs.webkit.org/show_bug.cgi?id=169746
1366
1367         Reviewed by Žan Doberšek.
1368
1369         We are not taking into account the blend mode when passing the cairo operator to drawPatternToCairoContext().
1370         This is based on patch by Žan Doberšek, just adding the toCairoOperator changes to make it easier to handle
1371         it. Instead of checking everywhere if blend mode is Normal to decide whether to use toCairoOperator with
1372         CompositeOperator or BlendMode, there's no a single toCairoOperator that receives both parameters, but BlendMode
1373         is optional and defaults to Normal.
1374
1375         * platform/graphics/cairo/CairoUtilities.cpp:
1376         (WebCore::toCairoCompositeOperator):
1377         (WebCore::toCairoOperator):
1378         * platform/graphics/cairo/CairoUtilities.h:
1379         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1380         (WebCore::GraphicsContext::setPlatformCompositeOperation):
1381         (WebCore::GraphicsContext::drawPattern):
1382
1383 2017-03-16  Alex Christensen  <achristensen@webkit.org>
1384
1385         Fix GTK build.
1386
1387         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
1388         (WebCore::SocketStreamHandleImpl::readBytes):
1389         Changing RefPtr to Ref broke something.
1390         For the record, EWS was orange so I couldn't see these build failures.
1391
1392 2017-03-16  Alex Christensen  <achristensen@webkit.org>
1393
1394         Fix GTK build.
1395
1396         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
1397         (WebCore::SocketStreamHandleImpl::readBytes):
1398         didFailToReceiveSocketStreamData needs a parameter.
1399
1400 2017-03-16  Dean Jackson  <dino@apple.com>
1401
1402         WebGL: Improve index validation when using uint index values
1403         https://bugs.webkit.org/show_bug.cgi?id=169798
1404
1405         Reviewed by Simon Fraser.
1406
1407         Make sure that we test index validation with the correct type.
1408         Also stop using -1 in WebGLBuffer to indicate non-existant values.
1409
1410         Test: fast/canvas/webgl/draw-elements-out-of-bounds-uint-index.html
1411
1412         * html/canvas/WebGL2RenderingContext.cpp:
1413         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Use optional<> and
1414         unsigned values.
1415         * html/canvas/WebGLBuffer.cpp: Use unsigned for maxIndex (they can't be negative)
1416         and optional<> to indicate unknown value.
1417         (WebCore::WebGLBuffer::getCachedMaxIndex):
1418         (WebCore::WebGLBuffer::setCachedMaxIndex):
1419         * html/canvas/WebGLBuffer.h:
1420         * html/canvas/WebGLRenderingContext.cpp:
1421         (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Use optional<> and
1422         unsigned values.
1423         * html/canvas/WebGLRenderingContextBase.cpp:
1424         (WebCore::WebGLRenderingContextBase::validateVertexAttributes): No need to check if
1425         an unsigned value is less than zero.
1426
1427 2017-03-16  Simon Fraser  <simon.fraser@apple.com>
1428
1429         Improve the system tracing points
1430         https://bugs.webkit.org/show_bug.cgi?id=169790
1431
1432         Reviewed by Zalan Bujtas.
1433
1434         Use a more cohesive set of system trace points that give a good overview of what
1435         WebKit is doing. Added points for resource loading, render tree building, sync messages
1436         to the web process, async image decode, WASM and fetching cookies.
1437
1438         * loader/CookieJar.cpp:
1439         (WebCore::cookies):
1440         * loader/FrameLoader.cpp:
1441         (WebCore::FrameLoader::provisionalLoadStarted):
1442         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
1443         * loader/SubresourceLoader.cpp:
1444         (WebCore::SubresourceLoader::willSendRequestInternal):
1445         (WebCore::logResourceLoaded):
1446         (WebCore::SubresourceLoader::didFinishLoading):
1447         (WebCore::SubresourceLoader::didFail):
1448         (WebCore::SubresourceLoader::didCancel):
1449         * page/FrameView.cpp:
1450         (WebCore::FrameView::paintContents):
1451         * platform/graphics/ImageFrameCache.cpp:
1452         (WebCore::ImageFrameCache::startAsyncDecodingQueue):
1453         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
1454         (WebCore::DisplayRefreshMonitorIOS::requestRefreshCallback):
1455         (WebCore::DisplayRefreshMonitorIOS::displayLinkFired):
1456         * style/RenderTreeUpdater.cpp:
1457         (WebCore::RenderTreeUpdater::commit):
1458
1459 2017-03-16  Simon Fraser  <simon.fraser@apple.com>
1460
1461         RenderView::documentBeingDestroyed() needs a new name.
1462         https://bugs.webkit.org/show_bug.cgi?id=166727
1463
1464         Reviewed by Andreas Kling.
1465
1466         Now that we destroy the render tree for documents going into the page cache, RenderView::documentBeingDestroyed()
1467         is misleadingly named. Rename it to renderTreeBeingDestroyed() and fix all callers.
1468
1469         * page/FrameView.cpp:
1470         (WebCore::FrameView::scheduleRelayoutOfSubtree):
1471         * page/scrolling/ScrollingCoordinator.cpp:
1472         (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame):
1473         * rendering/CounterNode.cpp:
1474         (WebCore::CounterNode::resetRenderers):
1475         * rendering/ImageQualityController.cpp:
1476         (WebCore::ImageQualityController::highQualityRepaintTimerFired):
1477         * rendering/RenderBlock.cpp:
1478         (WebCore::RenderBlock::willBeDestroyed):
1479         (WebCore::canMergeContiguousAnonymousBlocks):
1480         (WebCore::RenderBlock::removeChild):
1481         * rendering/RenderBlockFlow.cpp:
1482         (WebCore::RenderBlockFlow::willBeDestroyed):
1483         (WebCore::RenderBlockFlow::removeChild):
1484         * rendering/RenderBox.cpp:
1485         (WebCore::RenderBox::removeFloatingOrPositionedChildFromBlockLists):
1486         (WebCore::RenderBox::deleteLineBoxWrapper):
1487         * rendering/RenderBoxModelObject.cpp:
1488         (WebCore::RenderBoxModelObject::willBeDestroyed):
1489         * rendering/RenderElement.cpp:
1490         (WebCore::RenderElement::insertChildInternal):
1491         (WebCore::RenderElement::removeChildInternal):
1492         (WebCore::RenderElement::clearLayoutRootIfNeeded):
1493         (WebCore::RenderElement::willBeDestroyed):
1494         * rendering/RenderImage.cpp:
1495         (WebCore::RenderImage::imageChanged):
1496         (WebCore::RenderImage::notifyFinished):
1497         * rendering/RenderInline.cpp:
1498         (WebCore::RenderInline::willBeDestroyed):
1499         * rendering/RenderLayer.cpp:
1500         (WebCore::RenderLayer::removeChild):
1501         (WebCore::RenderLayer::calculateClipRects):
1502         * rendering/RenderLayerBacking.cpp:
1503         (WebCore::RenderLayerBacking::notifyFlushRequired):
1504         * rendering/RenderLayerCompositor.cpp:
1505         (WebCore::RenderLayerCompositor::layerWillBeRemoved):
1506         (WebCore::RenderLayerCompositor::fixedRootBackgroundLayerChanged):
1507         * rendering/RenderLineBreak.cpp:
1508         (WebCore::RenderLineBreak::deleteInlineBoxWrapper):
1509         * rendering/RenderNamedFlowFragment.cpp:
1510         (WebCore::RenderNamedFlowFragment::attachRegion):
1511         * rendering/RenderObject.cpp:
1512         (WebCore::RenderObject::resetFlowThreadStateOnRemoval):
1513         (WebCore::RenderObject::willBeDestroyed):
1514         (WebCore::RenderObject::destroyAndCleanupAnonymousWrappers):
1515         * rendering/RenderObject.h:
1516         (WebCore::RenderObject::renderTreeBeingDestroyed):
1517         (WebCore::RenderObject::documentBeingDestroyed): Deleted.
1518         * rendering/RenderQuote.cpp:
1519         (WebCore::RenderQuote::detachQuote):
1520         * rendering/RenderRegion.cpp:
1521         (WebCore::RenderRegion::attachRegion):
1522         * rendering/RenderReplaced.cpp:
1523         (WebCore::RenderReplaced::willBeDestroyed):
1524         * rendering/RenderRubyRun.cpp:
1525         (WebCore::RenderRubyRun::removeChild):
1526         * rendering/RenderTable.h:
1527         (WebCore::RenderTable::setNeedsSectionRecalc):
1528         * rendering/RenderText.cpp:
1529         (WebCore::RenderText::removeAndDestroyTextBoxes):
1530         * rendering/RenderVideo.cpp:
1531         (WebCore::RenderVideo::updatePlayer):
1532         * rendering/svg/RenderSVGResource.cpp:
1533         (WebCore::RenderSVGResource::markForLayoutAndParentResourceInvalidation):
1534         * rendering/svg/RenderSVGResourceContainer.cpp:
1535         (WebCore::RenderSVGResourceContainer::markClientForInvalidation):
1536         * rendering/svg/RenderSVGText.cpp:
1537         (WebCore::RenderSVGText::subtreeChildWasAdded):
1538         (WebCore::RenderSVGText::subtreeChildWillBeRemoved):
1539         (WebCore::RenderSVGText::subtreeChildWasRemoved):
1540         (WebCore::RenderSVGText::subtreeStyleDidChange):
1541
1542 2017-03-16  Youenn Fablet  <youenn@apple.com>
1543
1544         Wrap legacy WebRTC API in runtime flag
1545         https://bugs.webkit.org/show_bug.cgi?id=169646
1546
1547         Reviewed by Alex Christensen.
1548
1549         Test: webrtc/legacy-api.html
1550
1551         Adding a runtime flag for legacy API.
1552         Making some WebIDL peer connection members runtime-enabled.
1553         Adding a JS private getter on this flag so that overloaded operations behave as promise-based only if flag is turned off.
1554
1555         * Modules/mediastream/RTCPeerConnection.idl:
1556         * Modules/mediastream/RTCPeerConnectionInternals.js:
1557         * bindings/js/JSDOMGlobalObject.cpp:
1558         (WebCore::isWebRTCLegacyAPIEnabled):
1559         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
1560         * bindings/js/WebCoreBuiltinNames.h:
1561         * page/RuntimeEnabledFeatures.h:
1562         (WebCore::RuntimeEnabledFeatures::webRTCLegacyAPIEnabled):
1563         (WebCore::RuntimeEnabledFeatures::setWebRTCLegacyAPIEnabled):
1564
1565 2017-03-16  Jiewen Tan  <jiewen_tan@apple.com>
1566
1567         [WebCrypto] Support SPKI/PKCS8 for Elliptic Curve
1568         https://bugs.webkit.org/show_bug.cgi?id=169318
1569         <rdar://problem/31081956>
1570
1571         Reviewed by Brent Fulgham.
1572
1573         This patch adds SPKI/PKCS8 support for Elliptic Curve cryptos. We can now import/export
1574         SPKI/PKCS8 Elliptic Curve keys after this change. Few things to note: 1) This patch
1575         implements a loose DER encoder/decoder for hacking the underlying CommonCrypto library.
1576         2) It only permits id-ecPublicKey as the AlgorithmIdentifier following OpenSSL/Chrome(BoringSSL).
1577         3) It follows OpenSSL/Chrome(BoringSSL) to replace ECParameters in ECPrivateKey with custom
1578         tags. Hence, we should fully comply with OpenSSL/Chrome(BoringSSL).
1579
1580         Tests: crypto/subtle/ec-import-jwk-key-export-pkcs8-key.html
1581                crypto/subtle/ec-import-jwk-key-export-spki-key.html
1582                crypto/subtle/ec-import-pkcs8-key-export-jwk-key.html
1583                crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p256.html
1584                crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p384.html
1585                crypto/subtle/ec-import-raw-key-export-spki-key.html
1586                crypto/subtle/ec-import-spki-key-export-jwk-key.html
1587                crypto/subtle/ec-import-spki-key-export-raw-key.html
1588                crypto/subtle/ec-import-spki-key-export-spki-key-p256.html
1589                crypto/subtle/ec-import-spki-key-export-spki-key-p384.html
1590                crypto/subtle/ecdh-generate-export-key-spki-p256.html
1591                crypto/subtle/ecdh-generate-export-key-spki-p384.html
1592                crypto/subtle/ecdh-generate-export-pkcs8-p256.html
1593                crypto/subtle/ecdh-generate-export-pkcs8-p384.html
1594                crypto/subtle/ecdh-import-pkcs8-key-p256.html
1595                crypto/subtle/ecdh-import-pkcs8-key-p384.html
1596                crypto/subtle/ecdh-import-spki-key-p256.html
1597                crypto/subtle/ecdh-import-spki-key-p384.html
1598                crypto/workers/subtle/ec-generate-export-pkcs8-key.html
1599                crypto/workers/subtle/ec-generate-export-spki-key.html
1600                crypto/workers/subtle/ec-import-pkcs8-key.html
1601                crypto/workers/subtle/ec-import-spki-key.html
1602
1603         * WebCore.xcodeproj/project.pbxproj:
1604         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
1605         (WebCore::CryptoAlgorithmECDH::importKey):
1606         (WebCore::CryptoAlgorithmECDH::exportKey):
1607         * crypto/gnutls/CryptoKeyECGnuTLS.cpp:
1608         (WebCore::CryptoKeyEC::platformExportRaw):
1609         (WebCore::CryptoKeyEC::platformImportSpki):
1610         (WebCore::CryptoKeyEC::platformExportSpki):
1611         (WebCore::CryptoKeyEC::platformImportPkcs8):
1612         (WebCore::CryptoKeyEC::platformExportPkcs8):
1613         (WebCore::CryptoKeyEC::exportRaw): Deleted.
1614         * crypto/keys/CryptoKeyEC.cpp:
1615         (WebCore::CryptoKeyEC::importSpki):
1616         (WebCore::CryptoKeyEC::importPkcs8):
1617         (WebCore::CryptoKeyEC::exportRaw):
1618         (WebCore::CryptoKeyEC::exportSpki):
1619         (WebCore::CryptoKeyEC::exportPkcs8):
1620         * crypto/keys/CryptoKeyEC.h:
1621         * crypto/mac/CommonCryptoDERUtilities.h: Added.
1622         (WebCore::bytesUsedToEncodedLength):
1623         (WebCore::extraBytesNeededForEncodedLength):
1624         (WebCore::addEncodedASN1Length):
1625         (WebCore::bytesNeededForEncodedLength):
1626         * crypto/mac/CryptoKeyECMac.cpp:
1627         (WebCore::compareBytes):
1628         (WebCore::CryptoKeyEC::platformExportRaw):
1629         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
1630         (WebCore::getOID):
1631         (WebCore::CryptoKeyEC::platformImportSpki):
1632         (WebCore::CryptoKeyEC::platformExportSpki):
1633         (WebCore::CryptoKeyEC::platformImportPkcs8):
1634         (WebCore::CryptoKeyEC::platformExportPkcs8):
1635         (WebCore::CryptoKeyEC::exportRaw): Deleted.
1636         Enlarge the robust of exportRaw.
1637         * crypto/mac/CryptoKeyRSAMac.cpp:
1638         (WebCore::CryptoKeyRSA::exportSpki):
1639         (WebCore::CryptoKeyRSA::exportPkcs8):
1640         Enhance the implementation.
1641         (WebCore::bytesUsedToEncodedLength): Deleted.
1642         (WebCore::bytesNeededForEncodedLength): Deleted.
1643         (WebCore::addEncodedASN1Length): Deleted.
1644         Moved to CommonCryptoDERUtilities.h.
1645
1646 2017-03-16  Alex Christensen  <achristensen@webkit.org>
1647
1648         Don't use an optional for didReceiveSocketStreamData's length
1649         https://bugs.webkit.org/show_bug.cgi?id=169699
1650
1651         Reviewed by Brady Eidson.
1652
1653         Rather than sending a message with an optional length, send a message with a length
1654         and send a different message if the receiving of bytes failed.
1655
1656         No new tests (no behavior change).
1657
1658         * Modules/websockets/WebSocketChannel.cpp:
1659         (WebCore::WebSocketChannel::didReceiveSocketStreamData):
1660         * Modules/websockets/WebSocketChannel.h:
1661         * platform/network/SocketStreamHandleClient.h:
1662         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
1663         (WebCore::SocketStreamHandleImpl::readStreamCallback):
1664         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
1665         (WebCore::SocketStreamHandleImpl::readBytes):
1666
1667 2017-03-16  Zalan Bujtas  <zalan@apple.com>
1668
1669         Simple line layout: Extend webkit-hyphenate-limit-lines to cover subsequent words.
1670         https://bugs.webkit.org/show_bug.cgi?id=169631
1671
1672         Reviewed by Antti Koivisto.
1673
1674         This patch extends webkit-hyphenate-limit-lines to cover separate words across multiple lines.
1675         Example:
1676           webkit-hyphenate-limit-lines: 1;
1677           "if this line wraps at foo-
1678           bar, the next line should
1679           not hyphenate at all. How-
1680           ever the line after that
1681           could."
1682
1683         Test: fast/text/simple-line-layout-hyphenation-limit-lines-accross-words.html
1684
1685         * rendering/SimpleLineLayout.cpp:
1686         (WebCore::SimpleLineLayout::LineState::setHyphenationDisabled):
1687         (WebCore::SimpleLineLayout::LineState::isHyphenationDisabled):
1688         (WebCore::SimpleLineLayout::updateLineConstrains):
1689         (WebCore::SimpleLineLayout::hyphenPositionForFragment):
1690         (WebCore::SimpleLineLayout::splitFragmentToFitLine):
1691         (WebCore::SimpleLineLayout::createLineRuns):
1692         (WebCore::SimpleLineLayout::createTextRuns):
1693         * rendering/SimpleLineLayoutTextFragmentIterator.h:
1694         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::hasHyphen):
1695         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::splitWithHyphen):
1696         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::wrappingWithHyphenCounter): Deleted.
1697
1698 2017-03-16  Zan Dobersek  <zdobersek@igalia.com>
1699
1700         [GLib] Add SSLKeyGeneratorGLib.cpp
1701         https://bugs.webkit.org/show_bug.cgi?id=169740
1702
1703         Reviewed by Sergio Villar Senin.
1704
1705         Move the getSupportedKeySizes() and signedPublicKeyAndChallengeString()
1706         functions from TemporaryLinkStubs.cpp to SSLKeyGeneratorGLib.cpp. The
1707         userIdleTime() function can be removed in this process since it's not
1708         used anywhere anymore.
1709
1710         * PlatformGTK.cmake:
1711         * platform/glib/SSLKeyGeneratorGLib.cpp: Renamed from Source/WebCore/platform/gtk/TemporaryLinkStubs.cpp.
1712         (WebCore::getSupportedKeySizes):
1713         (WebCore::signedPublicKeyAndChallengeString):
1714
1715 2017-03-16  Zalan Bujtas  <zalan@apple.com>
1716
1717         Stay inside the continuation while searching for a candidate ancestor for insertion.
1718         https://bugs.webkit.org/show_bug.cgi?id=169768
1719         <rdar://problem/30959936>
1720
1721         Reviewed by David Hyatt.
1722
1723         Test: fast/inline/continuation-crash-with-anon-ancestors.html
1724
1725         * rendering/RenderInline.cpp:
1726         (WebCore::RenderInline::addChildToContinuation):
1727
1728 2017-03-16  Jon Lee  <jonlee@apple.com>
1729
1730         Add FIXMEs to update WebRTC
1731         https://bugs.webkit.org/show_bug.cgi?id=169735
1732
1733         Reviewed by Youenn Fablet.
1734
1735         Rearrange order of methods and properties based on the 13 March 2017
1736         version of the WebRTC spec.
1737
1738         * CMakeLists.txt: Add RTCIceTransport and RTCIceTransportState.
1739         * DerivedSources.make:
1740         * Modules/mediastream/RTCDTMFSender.idl:
1741         * Modules/mediastream/RTCDTMFToneChangeEvent.idl:
1742         * Modules/mediastream/RTCDataChannelEvent.idl:
1743         * Modules/mediastream/RTCIceCandidate.idl:
1744         * Modules/mediastream/RTCIceCandidateEvent.idl:
1745         * Modules/mediastream/RTCIceServer.idl:
1746         * Modules/mediastream/RTCIceTransport.cpp: Added.
1747         * Modules/mediastream/RTCIceTransport.idl: Added.
1748         * Modules/mediastream/RTCIceTransport.h: Minor update to rename state to transportState.
1749         (WebCore::RTCIceTransport::state):
1750         (WebCore::RTCIceTransport::setState):
1751         (WebCore::RTCIceTransport::transportState): Deleted.
1752         (WebCore::RTCIceTransport::setTransportState): Deleted.
1753         * Modules/mediastream/RTCIceTransportState.h: Added.
1754         * Modules/mediastream/RTCIceTransportState.idl: Added.
1755         * Modules/mediastream/RTCPeerConnection.h:
1756         * Modules/mediastream/RTCPeerConnection.idl:
1757         * Modules/mediastream/RTCRtpReceiver.idl:
1758         * Modules/mediastream/RTCRtpSender.idl:
1759         * Modules/mediastream/RTCRtpTransceiver.idl:
1760         * Modules/mediastream/RTCStatsReport.idl:
1761         * WebCore.xcodeproj/project.pbxproj:
1762         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1763         (WebCore::MediaEndpointPeerConnection::iceTransportStateChanged): Refactor.
1764
1765 2017-03-16  Youenn Fablet  <youenn@apple.com>
1766
1767         Improve WebRTC track enabled support
1768         https://bugs.webkit.org/show_bug.cgi?id=169727
1769
1770         Reviewed by Alex Christensen.
1771
1772         Tests: webrtc/peer-connection-audio-mute2.html
1773                webrtc/peer-connection-remote-audio-mute.html
1774                webrtc/video-remote-mute.html
1775
1776         Making sure muted/disabled sources produce silence/black frames.
1777         For outgoing audio/video sources, this should be done by the actual a/v providers.
1778         We keep this filtering here until we are sure they implement that.
1779
1780         * platform/audio/mac/AudioSampleDataSource.mm:
1781         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks): Ensuring disabled audio tracks send silence.
1782         Used for outgoing webrtc tracks.
1783         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
1784         (WebCore::MockRealtimeAudioSourceMac::render): Ditto.
1785         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
1786         (WebCore::RealtimeIncomingAudioSource::OnData): Ditto.
1787         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
1788         (WebCore::RealtimeIncomingVideoSource::pixelBufferFromVideoFrame): Generating black frames if muted.
1789         (WebCore::RealtimeIncomingVideoSource::OnFrame):
1790         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
1791         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1792         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable): Ensuring we quit after sending black frame.
1793
1794 2017-03-16  Youenn Fablet  <youenn@apple.com>
1795
1796         LibWebRTC outgoing source should be thread safe refcounted
1797         https://bugs.webkit.org/show_bug.cgi?id=169726
1798
1799         Reviewed by Alex Christensen.
1800
1801         Preventive fix.
1802         Also fixing the size of the buffer for the audio source as its reserved size is byte count.
1803
1804         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1805         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1806
1807 2017-03-16  Youenn Fablet  <youenn@apple.com>
1808
1809         MediaStreamTrack remote() no longer exists
1810         https://bugs.webkit.org/show_bug.cgi?id=169734
1811
1812         Reviewed by Alex Christensen.
1813
1814         Removing MediaStreamTrack remote.
1815         Removing RealtimeMediaSource::remote as isCaptureSource which is closer to its use in MediaStreamPrivate to
1816         detect whether sources are capture sources or not.
1817
1818         * Modules/mediastream/MediaStream.cpp:
1819         (WebCore::MediaStream::mediaState):
1820         * platform/mediastream/MediaStreamPrivate.cpp:
1821         (WebCore::MediaStreamPrivate::hasCaptureVideoSource):
1822         (WebCore::MediaStreamPrivate::hasCaptureAudioSource):
1823         (WebCore::MediaStreamPrivate::hasLocalVideoSource): Deleted.
1824         (WebCore::MediaStreamPrivate::hasLocalAudioSource): Deleted.
1825         * platform/mediastream/MediaStreamPrivate.h:
1826         * Modules/mediastream/MediaStreamTrack.cpp:
1827         (WebCore::MediaStreamTrack::stopProducingData):
1828         (WebCore::MediaStreamTrack::remote): Deleted.
1829         * Modules/mediastream/MediaStreamTrack.h:
1830         * Modules/mediastream/MediaStreamTrack.idl:
1831         * Modules/webaudio/MediaStreamAudioSource.h:
1832         * platform/mediastream/MediaStreamPrivate.cpp:
1833         (WebCore::MediaStreamPrivate::hasLocalVideoSource):
1834         (WebCore::MediaStreamPrivate::hasLocalAudioSource):
1835         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1836         (WebCore::MediaStreamTrackPrivate::isCaptureTrack):
1837         (WebCore::MediaStreamTrackPrivate::remote): Deleted.
1838         * platform/mediastream/MediaStreamTrackPrivate.h:
1839         * platform/mediastream/RealtimeMediaSource.cpp:
1840         (WebCore::RealtimeMediaSource::reset):
1841         * platform/mediastream/RealtimeMediaSource.h:
1842         (WebCore::RealtimeMediaSource::isCaptureSource):
1843         (WebCore::RealtimeMediaSource::remote): Deleted.
1844         (WebCore::RealtimeMediaSource::setRemote): Deleted.
1845         * platform/mediastream/mac/AVMediaCaptureSource.h:
1846         * platform/mock/MockRealtimeAudioSource.h:
1847         * platform/mock/MockRealtimeVideoSource.h:
1848
1849 2017-03-16  Manuel Rego Casasnovas  <rego@igalia.com>
1850
1851         [css-grid] Crash on debug removing a positioned child
1852         https://bugs.webkit.org/show_bug.cgi?id=169739
1853
1854         Reviewed by Sergio Villar Senin.
1855
1856         When we add or remove a positioned item we don't need to mark
1857         the grid as dirty, because positioned items do not affect the layout
1858         of the grid at all.
1859
1860         This was causing a crash when a positioned item was removed
1861         after a layout. As after the positioned item was removed,
1862         the method RenderGrid::layoutBlock() was not called,
1863         so when the grid was repainted we got a crash.
1864
1865         Test: fast/css-grid-layout/grid-crash-remove-positioned-item.html
1866
1867         * rendering/RenderGrid.cpp:
1868         (WebCore::RenderGrid::addChild): Add early return to avoid marking
1869         the grid as dirty for positioned grid items.
1870         (WebCore::RenderGrid::removeChild): Ditto.
1871
1872 2017-03-16  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1873
1874         [WebRTC] SDP sess-id in the "o=" line should be a value between 0 and LLONG_MAX.
1875         https://bugs.webkit.org/show_bug.cgi?id=169681
1876
1877         Reviewed by Alejandro G. Castro.
1878
1879         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).
1880         To the JS world (sdp.js) we pass and read this value as a string type.
1881
1882         The JS world (sdp.js) was already using a string type for sess-id.
1883         This caused a bug when reading the sess-id value at configurationFromJSON(): no value was obtained because a numeric type was expected.
1884
1885         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.
1886         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,
1887         and that could cause that we end passing a number bigger than LLONG_MAX to sdp.js.
1888
1889         * Modules/mediastream/SDPProcessor.cpp:
1890         (WebCore::configurationFromJSON):
1891         (WebCore::configurationToJSON):
1892         * platform/mediastream/MediaEndpointSessionConfiguration.h:
1893         (WebCore::MediaEndpointSessionConfiguration::sessionId):
1894         (WebCore::MediaEndpointSessionConfiguration::setSessionId):
1895         (WebCore::MediaEndpointSessionConfiguration::MediaEndpointSessionConfiguration):
1896
1897 2017-03-15  Jon Lee  <jonlee@apple.com>
1898
1899         Flatten RTC enum naming
1900         https://bugs.webkit.org/show_bug.cgi?id=169664
1901
1902         Reviewed by Youenn Fablet.
1903
1904         Use consistent names of RTC enums throughout WebCore. This means surfacing
1905         ICE enums out of PeerConnectionState. Keep the old names around for other
1906         ports.
1907
1908         Add RTCIceConnectionState, RTCIceGatheringState, and RTCSignalingState enums.
1909         * CMakeLists.txt:
1910         * DerivedSources.make:
1911         * Modules/mediastream/RTCIceConnectionState.h: Added. The enum is defined in
1912         PeerConnectionStates.h, so just include that file.
1913         * Modules/mediastream/RTCIceConnectionState.idl: Added.
1914         * Modules/mediastream/RTCIceGatheringState.h: Added.
1915         * Modules/mediastream/RTCIceGatheringState.idl: Added.
1916         * Modules/mediastream/RTCSignalingState.h: Added.
1917         * Modules/mediastream/RTCSignalingState.idl: Added.
1918         * WebCore.xcodeproj/project.pbxproj:
1919
1920         * platform/mediastream/PeerConnectionStates.h: Move the existing enums into
1921         WebCore, but keep aliases to the old names within the PeerConnectionStates
1922         namespace.
1923
1924         Refactor to use the new enum names.
1925         * Modules/mediastream/MediaEndpointPeerConnection.cpp: Refactor.
1926         * Modules/mediastream/MediaEndpointPeerConnection.h:
1927         * Modules/mediastream/PeerConnectionBackend.cpp:
1928         * Modules/mediastream/PeerConnectionBackend.h:
1929         * Modules/mediastream/RTCConfiguration.h:
1930         * Modules/mediastream/RTCConfiguration.idl: Add FIXMEs for bringing this up
1931         to spec.
1932         * Modules/mediastream/RTCIceTransport.h:
1933         * Modules/mediastream/RTCPeerConnection.cpp: Refactor the three functions
1934         below to using the enum instead of returning strings. This allows remove of
1935         the internal* versions of these functions.
1936         (WebCore::RTCPeerConnection::signalingState): Deleted.
1937         (WebCore::RTCPeerConnection::iceGatheringState): Deleted.
1938         (WebCore::RTCPeerConnection::iceConnectionState): Deleted.
1939         * Modules/mediastream/RTCPeerConnection.h: Replace internalSignalingState,
1940         internalIceGatheringState, and internalIceConnectionState.
1941         * Modules/mediastream/RTCPeerConnection.idl:
1942         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1943         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1944         * platform/mediastream/MediaEndpoint.h:
1945         * platform/mediastream/MediaEndpointConfiguration.cpp:
1946         * platform/mediastream/MediaEndpointConfiguration.h:
1947         * platform/mock/MockMediaEndpoint.cpp:
1948         * platform/mock/MockMediaEndpoint.h:
1949         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
1950         (WebCore::MediaEndpointOwr::processIceTransportStateChange):
1951
1952 2017-03-15  Jer Noble  <jer.noble@apple.com>
1953
1954         Optionally capture audio in the UIProcess
1955         https://bugs.webkit.org/show_bug.cgi?id=169609
1956
1957         Reviewed by Alex Christensen.
1958
1959         Export some previously un-exported symbols from WebCore for use in WebKit2.
1960
1961         * WebCore.xcodeproj/project.pbxproj:
1962         * platform/audio/WebAudioBufferList.h:
1963         * platform/mediastream/RealtimeMediaSource.h:
1964
1965 2017-03-15  Zalan Bujtas  <zalan@apple.com>
1966
1967         Do not reparent floating object until after intruding/overhanging dependency is cleared.
1968         https://bugs.webkit.org/show_bug.cgi?id=169711
1969         <rdar://problem/30959743>
1970
1971         Reviewed by Simon Fraser.
1972
1973         This patch ensures that we cleanup the m_floatingObjects for siblings before reparenting the fresh float.  
1974
1975         Test: fast/block/float/inline-becomes-float-and-moves-around.html
1976
1977         * rendering/RenderBlockFlow.cpp:
1978         (WebCore::RenderBlockFlow::styleDidChange):
1979         * rendering/RenderElement.cpp:
1980         (WebCore::RenderElement::styleDidChange):
1981         * rendering/RenderElement.h:
1982         (WebCore::RenderElement::noLongerAffectsParentBlock):
1983
1984 2017-03-15  Dean Jackson  <dino@apple.com>
1985
1986         Make a base class for WebGL and WebGPU contexts
1987         https://bugs.webkit.org/show_bug.cgi?id=169651
1988         <rdar://problem/31053489>
1989
1990         Reviewed by Simon Fraser.
1991
1992         Add a new pure virtual base class, GPUBasedCanvasRenderingContext, that
1993         will be used by WebGL and WebGPU rendering contexts. This allows us
1994         to avoid some code duplication, since many places treat the two
1995         as the same.
1996
1997         Also rename is3d() -> isWebGL() and isGPU() -> isWebGPU().
1998
1999         * WebCore.xcodeproj/project.pbxproj: New file.
2000         * html/HTMLCanvasElement.cpp:
2001         (WebCore::HTMLCanvasElement::getContextWebGL):
2002         (WebCore::HTMLCanvasElement::getContextWebGPU):
2003         (WebCore::HTMLCanvasElement::reset):
2004         (WebCore::HTMLCanvasElement::paint):
2005         (WebCore::HTMLCanvasElement::isGPUBased):
2006         (WebCore::HTMLCanvasElement::getImageData):
2007         (WebCore::HTMLCanvasElement::isGPU): Deleted.
2008         (WebCore::HTMLCanvasElement::is3D): Deleted.
2009         * html/HTMLCanvasElement.h:
2010         * html/canvas/CanvasRenderingContext.h:
2011         (WebCore::CanvasRenderingContext::isWebGL):
2012         (WebCore::CanvasRenderingContext::isWebGPU):
2013         (WebCore::CanvasRenderingContext::isGPUBased):
2014         (WebCore::CanvasRenderingContext::is3d): Deleted.
2015         (WebCore::CanvasRenderingContext::isGPU): Deleted.
2016         * html/canvas/GPUBasedCanvasRenderingContext.h: Added.
2017         (WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):
2018         * html/canvas/WebGLRenderingContextBase.cpp:
2019         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
2020         * html/canvas/WebGLRenderingContextBase.h:
2021         * html/canvas/WebGPURenderingContext.cpp:
2022         (WebCore::WebGPURenderingContext::WebGPURenderingContext):
2023         * html/canvas/WebGPURenderingContext.h:
2024         * rendering/RenderLayerBacking.cpp:
2025         (WebCore::canvasCompositingStrategy):
2026
2027 2017-03-15  Daniel Bates  <dabates@apple.com>
2028
2029         Iteratively dispatch DOM events after restoring a cached page
2030         https://bugs.webkit.org/show_bug.cgi?id=169703
2031         <rdar://problem/31075903>
2032
2033         Reviewed by Brady Eidson.
2034
2035         Make dispatching of DOM events when restoring a page from the page cache symmetric with
2036         dispatching of events when saving a page to the page cache.
2037
2038         * history/CachedFrame.cpp:
2039         (WebCore::CachedFrameBase::restore): Move code to dispatch events from here to FrameLoader::didRestoreFromCachedPage().
2040         * loader/FrameLoader.cpp:
2041         (WebCore::FrameLoader::commitProvisionalLoad): Ensure that no DOM events are dispatched during
2042         restoration of a cached page. Call didRestoreFromCachedPage() after restoring the page to
2043         dispatch DOM events on the restored frames.
2044         (WebCore::FrameLoader::willRestoreFromCachedPage): Renamed; formerly named prepareForCachedPageRestore().
2045         (WebCore::FrameLoader::didRestoreFromCachedPage): Added.
2046         (WebCore::FrameLoader::prepareForCachedPageRestore): Renamed to willRestoreFromCachedPage().
2047         * loader/FrameLoader.h:
2048         * page/FrameTree.cpp:
2049         (WebCore::FrameTree::traverseNextInPostOrderWithWrap): Returns the next Frame* in a post-order
2050         traversal of the frame tree optionally wrapping around to the deepest first child in the tree.
2051         (WebCore::FrameTree::deepFirstChild): Added.
2052         * page/FrameTree.h:
2053
2054 2017-03-15  Dave Hyatt  <hyatt@apple.com>
2055
2056         Positioned SVG not sized correctly
2057         https://bugs.webkit.org/show_bug.cgi?id=169693
2058         <rdar://problem/30996893>
2059
2060         Reviewed by Zalan Bujtas.
2061
2062         Test: svg/in-html/rect-positioned.html
2063
2064         Change computeReplacedLogicalHeight to take an estimatedUsedWidth. This
2065         value is used instead of the available logical width to resolve replaced
2066         elements without intrinsic sizes but with aspect ratios set.
2067
2068         * rendering/RenderBox.cpp:
2069         (WebCore::RenderBox::computeReplacedLogicalHeight):
2070         * rendering/RenderBox.h:
2071         * rendering/RenderReplaced.cpp:
2072         (WebCore::RenderReplaced::computeConstrainedLogicalWidth):
2073         (WebCore::RenderReplaced::computeReplacedLogicalWidth):
2074         (WebCore::RenderReplaced::computeReplacedLogicalHeight):
2075         * rendering/RenderReplaced.h:
2076         * rendering/RenderVideo.cpp:
2077         (WebCore::RenderVideo::computeReplacedLogicalHeight): Deleted.
2078         * rendering/RenderVideo.h:
2079         * rendering/svg/RenderSVGRoot.cpp:
2080         (WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
2081         (WebCore::RenderSVGRoot::computeReplacedLogicalHeight):
2082         * rendering/svg/RenderSVGRoot.h:
2083
2084 2017-03-15  Antoine Quint  <graouts@apple.com>
2085
2086         [Modern Media Controls] Using the arrow keys to navigate in the tracks menu also scrolls the page
2087         https://bugs.webkit.org/show_bug.cgi?id=169671
2088         <rdar://problem/31060091>
2089
2090         Reviewed by Eric Carlson.
2091
2092         We need to call preventDefault() when handling a "keydown" event that we recognize.
2093
2094         Test: media/modern-media-controls/tracks-panel/tracks-panel-prevent-default-on-keydown.html
2095
2096         * Modules/modern-media-controls/controls/tracks-panel.js:
2097         (TracksPanel.prototype._handleKeydown):
2098
2099 2017-03-15  Antoine Quint  <graouts@apple.com>
2100
2101         [Modern Media Controls] Tracks menu overlaps controls bar in fullscreen
2102         https://bugs.webkit.org/show_bug.cgi?id=169670
2103         <rdar://problem/31060086>
2104         
2105         Reviewed by Eric Carlson.
2106
2107         It used to be that the top of the tracks button was the same as the top of the controls
2108         bar, but that changed when we fixed https://bugs.webkit.org/show_bug.cgi?id=169412. We
2109         now use the top of the controls bar to computed the y-position for the tracks panel.
2110
2111         We are not adding a new test, instead we're unflaking a test that started failing
2112         reliably once we fixed https://bugs.webkit.org/show_bug.cgi?id=169412.
2113
2114         * Modules/modern-media-controls/controls/macos-media-controls.js:
2115         (MacOSMediaControls.prototype.showTracksPanel):
2116
2117 2017-03-14  Jon Lee  <jonlee@apple.com>
2118
2119         Clean up RTCPeerConnection IDL
2120         https://bugs.webkit.org/show_bug.cgi?id=169660
2121
2122         Reviewed by Youenn Fablet.
2123
2124         * Modules/mediastream/RTCPeerConnection.cpp:
2125         (WebCore::RTCPeerConnection::addTransceiver): Refactor to use RTCRtpTransceiverInit.
2126         (WebCore::RTCPeerConnection::completeAddTransceiver):
2127         * Modules/mediastream/RTCPeerConnection.h: Remove redundant definitions.
2128         * Modules/mediastream/RTCPeerConnection.idl: Using 13 March 2017 Editor's Draft of
2129         WebRTC spec. Move RTCOfferAnswerOptions out to separate IDLs. Keep RTCDataChannelInit and
2130         RTCRtpTransceiverInit since they appear to be used only in RTCPeerConnection.
2131             Reorder the properties, functions, and events based on their appearance in the spec.
2132         Legacy MediaStream calls are placed at the end. I tried to use "partial interface" in the
2133         same file, but in the end nothing was generated, so everything is contained in one interface
2134         block.
2135
2136         * Modules/mediastream/RTCEnums.h: Added. This will be an all-in-one header to hold the
2137         enums.
2138
2139         Move RTCAnswerOptions, RTCOfferAnswerOptions, RTCOfferOptions, RTCRtpTransceiverDirection
2140         out to their own IDL's.
2141         * CMakeLists.txt:
2142         * DerivedSources.make:
2143         * Modules/mediastream/RTCAnswerOptions.h: Added.
2144         * Modules/mediastream/RTCAnswerOptions.idl: Added.
2145         * Modules/mediastream/RTCOfferAnswerOptions.h:
2146         * Modules/mediastream/RTCOfferAnswerOptions.idl: Added.
2147         * Modules/mediastream/RTCOfferOptions.h: Added. Remove |offerToReceiveVideo| and
2148         |offerToReceiveAudio|, which are not used.
2149         * Modules/mediastream/RTCOfferOptions.idl: Added.
2150         * Modules/mediastream/RTCRtpTransceiverDirection.h: Added.
2151         * Modules/mediastream/RTCRtpTransceiverDirection.idl: Added. Use a typedef for
2152         RTCRtpTransceiverDirection to prevent the code generator from prefixing RTCRtpTransceiver.
2153         * Modules/mediastream/RTCRtpTransceiver.idl: Move RTCRtpTransceiverDirection.
2154         * WebCore.xcodeproj/project.pbxproj: Add IDLs and derived sources. Remove unused
2155         HTMLMediaElementMediaStream.h. Reorder.
2156
2157         Refactor.
2158         * Modules/mediastream/RTCRtpTransceiver.h: Use RTCRtpTransceiverDirection.
2159         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2160
2161 2017-03-15  Zan Dobersek  <zdobersek@igalia.com>
2162
2163         [GTK] Initialize m_button, m_clickCount members in PlatformMouseEvent constructors
2164         https://bugs.webkit.org/show_bug.cgi?id=169666
2165
2166         Reviewed by Michael Catanzaro.
2167
2168         Initialize the m_button and m_clickCount class members in the GTK+-specific
2169         implementation of PlatformMouseEvent constructors to NoButton and 0,
2170         respectively. The constructors expect to operate on passed-in GTK+ events
2171         that will be able to initialize those two members to some valid values, but
2172         this is not guaranteed.
2173
2174         * platform/gtk/PlatformMouseEventGtk.cpp:
2175         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
2176
2177 2017-03-15  Zan Dobersek  <zdobersek@igalia.com>
2178
2179         [TexMap] Add missing class member initializations
2180         https://bugs.webkit.org/show_bug.cgi?id=169665
2181
2182         Reviewed by Michael Catanzaro.
2183
2184         Zero-initialize the members in various TextureMapper classes
2185         that are missing the proper initialization, as reported by
2186         the Coverity tool.
2187
2188         * platform/graphics/texmap/BitmapTexturePool.h:
2189         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2190         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
2191         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
2192         * platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h:
2193
2194 2017-03-15  Alex Christensen  <achristensen@webkit.org>
2195
2196         Compiled content extensions should include the JSON source
2197         https://bugs.webkit.org/show_bug.cgi?id=169643
2198
2199         Reviewed by Geoffrey Garen.
2200
2201         Serializing the JSON string from which a content extension was compiled
2202         to disk with the compiled content extension will allow us to validate content
2203         extensions and automatically migrate older content extensions to new versions.
2204         It less than doubles the size of the compiled content extension on disk, and when
2205         interpreting the bytecode that memory is never read, so it doesn't increase our
2206         dirty memory usage.
2207
2208         Covered by new API tests.
2209
2210         * contentextensions/ContentExtensionCompiler.cpp:
2211         (WebCore::ContentExtensions::compileRuleList):
2212         * contentextensions/ContentExtensionCompiler.h:
2213
2214 2017-03-15  Antoine Quint  <graouts@apple.com>
2215
2216         [Modern Media Controls] Captions do not default to Auto when language is changed
2217         https://bugs.webkit.org/show_bug.cgi?id=169675
2218         <rdar://problem/30423369>
2219
2220         Reviewed by Eric Carlson.
2221
2222         Ensure we correctly mark the Off and Auto items as selected when we are using the
2223         Off and Auto tracks.
2224
2225         Tests: media/modern-media-controls/tracks-support/tracks-support-auto-text-track.html
2226                media/modern-media-controls/tracks-support/tracks-support-off-text-track.html
2227
2228         * Modules/modern-media-controls/media/tracks-support.js:
2229         (TracksSupport.prototype.tracksPanelIsTrackInSectionSelected):
2230         (TracksSupport.prototype.tracksPanelSelectionDidChange):
2231
2232 2017-03-15  Ryan Haddad  <ryanhaddad@apple.com>
2233
2234         Unreviewed, rolling out r213977.
2235
2236         This change broke the Windows build.
2237
2238         Reverted changeset:
2239
2240         "Make a base class for WebGL and WebGPU contexts"
2241         https://bugs.webkit.org/show_bug.cgi?id=169651
2242         http://trac.webkit.org/changeset/213977
2243
2244 2017-03-15  Youenn Fablet  <youenn@apple.com>
2245
2246         run-webkit-tests is always creating mock libwebrtc tracks
2247         https://bugs.webkit.org/show_bug.cgi?id=169658
2248
2249         Reviewed by Alex Christensen.
2250
2251         Tests: webrtc/peer-connection-audio-mute.html
2252                webrtc/video-mute.html
2253
2254         Creating real libwebrtc av tracks in case of RealTwoPeerConnections mock factory.
2255
2256         * testing/MockLibWebRTCPeerConnection.cpp:
2257         (WebCore::MockLibWebRTCPeerConnectionFactory::CreateVideoTrack):
2258         (WebCore::MockLibWebRTCPeerConnectionFactory::CreateAudioTrack):
2259         * testing/MockLibWebRTCPeerConnection.h:
2260
2261 2017-03-15  Youenn Fablet  <youenn@apple.com>
2262
2263         Preventive clean-up: ensure RTCPeerConnection stays valid when calling postTask
2264         https://bugs.webkit.org/show_bug.cgi?id=169661
2265
2266         Reviewed by Alex Christensen.
2267
2268         Protecting the RTCPeerConnection object when calling postTask since it might get collected between the task post
2269         and task run. Also do not send negotiationNeeded event if RTCPeerConnection is closed (covered by added test).
2270
2271         * Modules/mediastream/RTCPeerConnection.cpp:
2272         (WebCore::RTCPeerConnection::updateIceGatheringState):
2273         (WebCore::RTCPeerConnection::updateIceConnectionState):
2274         (WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent):
2275
2276 2017-03-15  Antoine Quint  <graouts@apple.com>
2277
2278         [Modern Media Controls] Always use six digits to display time when overall media duration is an hour or more
2279         https://bugs.webkit.org/show_bug.cgi?id=169668
2280         <rdar://problem/31059699>
2281
2282         Reviewed by Dean Jackson.
2283
2284         Always use six digits to display times when the overall media duration is an hour or more. This
2285         ensures that we don't display too much white space around labels when we know we will eventually
2286         need six digits to display the full time, but the current time to display is under an hour.
2287
2288         Test: media/modern-media-controls/time-control/time-control-use-six-digits-for-time-labels.html
2289
2290         * Modules/modern-media-controls/controls/time-control.js:
2291         (TimeControl.prototype.get useSixDigitsForTimeLabels):
2292         (TimeControl.prototype.set useSixDigitsForTimeLabels):
2293         (TimeControl.prototype.set width):
2294         (TimeControl.prototype.get isSufficientlyWide):
2295         (TimeControl.prototype._availableWidthHasChanged):
2296         (TimeControl.prototype.get labelsMayDisplayTimesOverAnHour): Deleted.
2297         (TimeControl.prototype.set labelsMayDisplayTimesOverAnHour): Deleted.
2298         * Modules/modern-media-controls/controls/time-label.js:
2299         (TimeLabel.prototype._formattedTime):
2300         * Modules/modern-media-controls/media/time-labels-support.js:
2301         (TimeLabelsSupport.prototype.syncControl):
2302         (TimeLabelsSupport):
2303
2304 2017-03-15  Dean Jackson  <dino@apple.com>
2305
2306         Sort Xcode project files
2307         https://bugs.webkit.org/show_bug.cgi?id=169669
2308
2309         Reviewed by Antoine Quint.
2310
2311         * WebCore.xcodeproj/project.pbxproj:
2312
2313 2017-03-14  Dean Jackson  <dino@apple.com>
2314
2315         Make a base class for WebGL and WebGPU contexts
2316         https://bugs.webkit.org/show_bug.cgi?id=169651
2317         <rdar://problem/31053489>
2318
2319         Reviewed by Simon Fraser.
2320
2321         Add a new pure virtual base class, GPUBasedCanvasRenderingContext, that
2322         will be used by WebGL and WebGPU rendering contexts. This allows us
2323         to avoid some code duplication, since many places treat the two
2324         as the same.
2325
2326         Also rename is3d() -> isWebGL() and isGPU() -> isWebGPU().
2327
2328         * WebCore.xcodeproj/project.pbxproj: New file.
2329         * html/HTMLCanvasElement.cpp:
2330         (WebCore::HTMLCanvasElement::getContextWebGL):
2331         (WebCore::HTMLCanvasElement::getContextWebGPU):
2332         (WebCore::HTMLCanvasElement::reset):
2333         (WebCore::HTMLCanvasElement::paint):
2334         (WebCore::HTMLCanvasElement::isGPUBased):
2335         (WebCore::HTMLCanvasElement::getImageData):
2336         (WebCore::HTMLCanvasElement::isGPU): Deleted.
2337         (WebCore::HTMLCanvasElement::is3D): Deleted.
2338         * html/HTMLCanvasElement.h:
2339         * html/canvas/CanvasRenderingContext.h:
2340         (WebCore::CanvasRenderingContext::isWebGL):
2341         (WebCore::CanvasRenderingContext::isWebGPU):
2342         (WebCore::CanvasRenderingContext::isGPUBased):
2343         (WebCore::CanvasRenderingContext::is3d): Deleted.
2344         (WebCore::CanvasRenderingContext::isGPU): Deleted.
2345         * html/canvas/GPUBasedCanvasRenderingContext.h: Added.
2346         (WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):
2347         * html/canvas/WebGLRenderingContextBase.cpp:
2348         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
2349         * html/canvas/WebGLRenderingContextBase.h:
2350         * html/canvas/WebGPURenderingContext.cpp:
2351         (WebCore::WebGPURenderingContext::WebGPURenderingContext):
2352         * html/canvas/WebGPURenderingContext.h:
2353         * rendering/RenderLayerBacking.cpp:
2354         (WebCore::canvasCompositingStrategy):
2355
2356 2017-03-15  Zan Dobersek  <zdobersek@igalia.com>
2357
2358         Unreviewed GTK+ build fix. Sprinkle ENABLE(MEDIA_STREAM) build guards
2359         in the Internals class to avoid compilation failures when building
2360         with this feature disabled.
2361
2362         * testing/Internals.cpp:
2363         (WebCore::Internals::~Internals):
2364         * testing/Internals.h:
2365         * testing/Internals.idl:
2366
2367 2017-03-14  Youenn Fablet  <youenn@apple.com>
2368
2369         CanvasCapture should not generate a frame per each canvas draw command
2370         https://bugs.webkit.org/show_bug.cgi?id=169498
2371
2372         Reviewed by Simon Fraser & Eric Carlson.
2373
2374         Test: fast/mediastream/captureStream/canvas2d-heavy-drawing.html
2375
2376         Making Canvas capture be asynchronous.
2377         This ensures that one frame will be created for a set of synchronous draw commands.
2378         In the future, we should find a better approach, like aligning with requestAnimationFrame.
2379         Adding internals observer API for media stream tracks.
2380
2381         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
2382         (WebCore::CanvasCaptureMediaStreamTrack::Source::Source):
2383         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged):
2384         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
2385         * Modules/mediastream/MediaStreamTrack.idl:
2386         * platform/mediastream/RealtimeMediaSource.h:
2387         * testing/Internals.cpp:
2388         (WebCore::Internals::~Internals):
2389         (WebCore::Internals::observeMediaStreamTrack):
2390         * testing/Internals.h:
2391         * testing/Internals.idl:
2392
2393 2017-03-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2394
2395         RenderElements should unregister for viewport visibility callbacks when they are destroyed
2396         https://bugs.webkit.org/show_bug.cgi?id=169521
2397         <rdar://problem/30959545>
2398
2399         Reviewed by Simon Fraser.
2400
2401         When registering a RenderElement for viewport visibility callbacks, we always need to make sure that it is unregistered
2402         before it is destroyed. While we account for this in the destructor of RenderElement, we only unregister in the destructor
2403         if we are already registered for visibility callbacks. In the call to RenderObject::willBeDestroyed(), we clear out rare
2404         data, which holds RenderElement's viewport callback registration state, so upon entering the destructor of RenderElement,
2405         we skip unregistration because RenderElement thinks that it is not registered.
2406
2407         We can mitigate this by unregistering the RenderElement earlier, in RenderElement::willBeDestroyed, prior to clearing out
2408         the rare data. However, we'd ideally want to move the cleanup logic out of the destructor altogether and into willBeDestroyed
2409         (see https://bugs.webkit.org/show_bug.cgi?id=169650).
2410
2411         Test: fast/media/video-element-in-details-collapse.html
2412
2413         * rendering/RenderElement.cpp:
2414         (WebCore::RenderElement::willBeDestroyed):
2415
2416 2017-03-14  Dean Jackson  <dino@apple.com>
2417
2418         Rename LayerTypeWebGLLayer and use it for both WebGL and WebGPU
2419         https://bugs.webkit.org/show_bug.cgi?id=169628
2420         <rdar://problems/31047025>
2421
2422         Fix Windows build.
2423
2424         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
2425         (printLayer):
2426
2427 2017-03-14  Andy Estes  <aestes@apple.com>
2428
2429         REGRESSION (r209760): Apple Pay doesn't work on sites that specify empty contact fields
2430         https://bugs.webkit.org/show_bug.cgi?id=169639
2431         <rdar://problem/30957789>
2432
2433         Reviewed by Anders Carlsson.
2434
2435         Shipping and billing contact fields are allowed to be empty.
2436
2437         * Modules/applepay/ApplePaySession.cpp:
2438         (WebCore::convertAndValidate):
2439
2440 2017-03-14  Anders Carlsson  <andersca@apple.com>
2441
2442         Propagate PassKit errors
2443         https://bugs.webkit.org/show_bug.cgi?id=169633
2444         rdar://problem/31043392
2445
2446         Reviewed by Dean Jackson.
2447
2448         * Modules/applepay/ApplePayError.idl:
2449         * Modules/applepay/ApplePaySession.cpp:
2450         (WebCore::convert):
2451         (WebCore::convertAndValidate):
2452         * Modules/applepay/PaymentRequest.h:
2453
2454 2017-03-14  Alan Kinsley  <zalan@apple.com>
2455
2456         Simple line layout: Adjust hyphenation constrains based on the normal line layout line-breaking logic.
2457         https://bugs.webkit.org/show_bug.cgi?id=169617
2458
2459         Reviewed by Antti Koivisto.
2460
2461         This patch ensures that simple line layout ends up with the same hyphenation context as normal line layout. 
2462
2463         Test: fast/text/simple-line-layout-hyphenation-constrains.html
2464
2465         * rendering/SimpleLineLayout.cpp:
2466         (WebCore::SimpleLineLayout::hyphenPositionForFragment): see webkit.org/b/169613
2467         (WebCore::SimpleLineLayout::splitFragmentToFitLine):
2468         * rendering/line/BreakingContext.h: Integral -> fractional.
2469         (WebCore::tryHyphenating):
2470
2471 2017-03-06  Jer Noble  <jer.noble@apple.com>
2472
2473         Refactor: Allow WebKit2 to override the creation of RealtimeMediaSources
2474         https://bugs.webkit.org/show_bug.cgi?id=169227
2475
2476         Reviewed by Eric Carlson.
2477
2478         Allow clients of RealtimeMediaSourceCenter to specify a factory for creating
2479         RealtimeMediaSources, to be used by subclasess of RealtimeMediaSourceCenter. Add virtual
2480         methods to retrieve the "default" factories for the RealtimeMediaSourceCenter subclass. The
2481         requires moving the creation of sources up from CaptureDeviceManager into
2482         RealtimeMediaSourceCenterMac, and the addition of factory methods to AVAudioCaptureSource
2483         and AVVideoCaptureSource.
2484
2485         * platform/mediastream/CaptureDeviceManager.cpp:
2486         (CaptureDeviceManager::deviceWithUID):
2487         (CaptureDeviceManager::bestSourcesForTypeAndConstraints): Deleted.
2488         (CaptureDeviceManager::sourceWithUID): Deleted.
2489         * platform/mediastream/CaptureDeviceManager.h:
2490         * platform/mediastream/RealtimeMediaSource.h:
2491         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2492         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
2493         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
2494         (WebCore::RealtimeMediaSourceCenter::setVideoFactory):
2495         (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory):
2496         * platform/mediastream/RealtimeMediaSourceCenter.h:
2497         (WebCore::RealtimeMediaSourceCenter::audioFactory):
2498         (WebCore::RealtimeMediaSourceCenter::videoFactory):
2499         * platform/mediastream/mac/AVAudioCaptureSource.h:
2500         * platform/mediastream/mac/AVAudioCaptureSource.mm:
2501         (WebCore::AVAudioCaptureSource::factory):
2502         * platform/mediastream/mac/AVCaptureDeviceManager.h:
2503         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
2504         (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints): Deleted.
2505         * platform/mediastream/mac/AVMediaCaptureSource.h:
2506         * platform/mediastream/mac/AVVideoCaptureSource.h:
2507         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2508         (WebCore::AVVideoCaptureSource::factory):
2509         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2510         (WebCore::RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac):
2511         (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints):
2512         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
2513         (WebCore::RealtimeMediaSourceCenterMac::bestSourcesForTypeAndConstraints):
2514         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory):
2515         (WebCore::RealtimeMediaSourceCenterMac::defaultVideoFactory):
2516         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
2517         * platform/mock/MockRealtimeAudioSource.cpp:
2518         (WebCore::MockRealtimeAudioSource::factory):
2519         * platform/mock/MockRealtimeAudioSource.h:
2520         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2521         (WebCore::MockRealtimeMediaSourceCenter::defaultAudioFactory):
2522         (WebCore::MockRealtimeMediaSourceCenter::defaultVideoFactory):
2523         * platform/mock/MockRealtimeMediaSourceCenter.h:
2524         * platform/mock/MockRealtimeVideoSource.cpp:
2525         (WebCore::MockRealtimeVideoSource::factory):
2526         * platform/mock/MockRealtimeVideoSource.h:
2527
2528 2017-03-14  Dean Jackson  <dino@apple.com>
2529
2530         Rename LayerTypeWebGLLayer and use it for both WebGL and WebGPU
2531         https://bugs.webkit.org/show_bug.cgi?id=169628
2532         <rdar://problems/31047025>
2533
2534         Reviewed by Simon Fraser.
2535
2536         Rename LayerTypeWebGLLayer to LayerTypeContentsProvidedLayer
2537         and use it for both WebGLLayer and WebGPULayer, to avoid
2538         code duplication.
2539
2540         * platform/graphics/ca/PlatformCALayer.cpp:
2541         (WebCore::operator<<):
2542         * platform/graphics/ca/PlatformCALayer.h:
2543         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2544         (PlatformCALayerCocoa::layerTypeForPlatformLayer):
2545         (PlatformCALayerCocoa::PlatformCALayerCocoa):
2546         (PlatformCALayerCocoa::commonInit):
2547
2548 2017-03-13  Jer Noble  <jer.noble@apple.com>
2549
2550         Make classes used by Media Stream encode/decode friendly
2551         https://bugs.webkit.org/show_bug.cgi?id=169567
2552
2553         Reviewed by Eric Carlson.
2554
2555         Add encode() and decode() methods and implementations to a variety of media stream related classes.
2556
2557         * platform/audio/mac/CAAudioStreamDescription.h:
2558         (WebCore::CAAudioStreamDescription::encode):
2559         (WebCore::CAAudioStreamDescription::decode):
2560         * platform/mediastream/RealtimeMediaSourceSettings.h:
2561         (WebCore::RealtimeMediaSourceSettings::width):
2562         (WebCore::RealtimeMediaSourceSettings::setWidth):
2563         (WebCore::RealtimeMediaSourceSettings::height):
2564         (WebCore::RealtimeMediaSourceSettings::setHeight):
2565         (WebCore::RealtimeMediaSourceSettings::sampleRate):
2566         (WebCore::RealtimeMediaSourceSettings::setSampleRate):
2567         (WebCore::RealtimeMediaSourceSettings::sampleSize):
2568         (WebCore::RealtimeMediaSourceSettings::setSampleSize):
2569         (WebCore::RealtimeMediaSourceSettings::encode):
2570         (WebCore::RealtimeMediaSourceSettings::decode):
2571         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h:
2572         (WebCore::RealtimeMediaSourceSupportedConstraints::encode):
2573         (WebCore::RealtimeMediaSourceSupportedConstraints::decode):
2574
2575 2017-03-14  Jer Noble  <jer.noble@apple.com>
2576
2577         Adapt CARingBuffer to be usable across processes
2578         https://bugs.webkit.org/show_bug.cgi?id=169591
2579
2580         Reviewed by Alex Christensen.
2581
2582         When used with a SharedMemory backing store, storing the pointers to channel data at the beginning
2583         of the channel data itself is problematic: when the SharedMemory is mapped on the far side of the
2584         process boundary, it will not exist at the same memory location as it did on the near side. Instead
2585         of storing these pointers inside the channel data, store them in a small (usually 1 or 2 entry) vector
2586         recreated when the backing store is (re-)allocated.
2587
2588         * platform/audio/mac/CARingBuffer.cpp:
2589         (WebCore::CARingBuffer::CARingBuffer):
2590         (WebCore::CARingBuffer::allocate):
2591         (WebCore::CARingBuffer::deallocate):
2592         (WebCore::ZeroRange):
2593         (WebCore::StoreABL):
2594         (WebCore::FetchABL):
2595         (WebCore::CARingBuffer::store):
2596         (WebCore::CARingBuffer::getCurrentFrameBounds):
2597         (WebCore::CARingBuffer::fetch):
2598         * platform/audio/mac/CARingBuffer.h:
2599
2600 2017-03-14  Jer Noble  <jer.noble@apple.com>
2601
2602         Pulling more frames from AudioSampleDataSource than the last push added will always fail.
2603         https://bugs.webkit.org/show_bug.cgi?id=168644
2604
2605         Reviewed by Eric Carlson.
2606
2607         Rather than use the delta between the ring buffer's end time and the last pushed timestamp
2608         (or what is effectively the number of samples in the last push operation) to determine if
2609         there is enough buffered data to satisfy a pull operation, use the ring buffer's actual
2610         buffered duration.
2611
2612         Then, instead of saving the last pushed timestamp, explicitly save the last push count, and
2613         use that data to inform how much to offset the output timestamps (or what is effectively how
2614         much to allow the source to pre-buffer).
2615
2616         * platform/audio/mac/AudioSampleDataSource.cpp:
2617         (WebCore::AudioSampleDataSource::pushSamplesInternal):
2618         (WebCore::AudioSampleDataSource::pullSamplesInternal):
2619         * platform/audio/mac/AudioSampleDataSource.h:
2620
2621 2017-03-14  Megan Gardner  <megan_gardner@apple.com>
2622
2623         Correctly export WebItemProviderPasteboard
2624         https://bugs.webkit.org/show_bug.cgi?id=169578
2625
2626         Reviewed by Tim Horton.
2627
2628         * platform/ios/WebItemProviderPasteboard.h:
2629
2630 2017-03-14  Adrian Perez de Castro  <aperez@igalia.com>
2631
2632         Remove redundant check for "firstLine" in RenderBlock::lineHeight()
2633         https://bugs.webkit.org/show_bug.cgi?id=169610
2634
2635         Reviewed by Michael Catanzaro.
2636
2637         * rendering/RenderBlock.cpp:
2638         (WebCore::RenderBlock::lineHeight): Remove test of "firstLine" that
2639         was already checked in the condition for the enclosing if-clause.
2640
2641 2017-03-14  Antoine Quint  <graouts@apple.com>
2642
2643         [Modern Media Controls] Fullscreen controls during Live Broadcast is completely broken
2644         https://bugs.webkit.org/show_bug.cgi?id=169354
2645         <rdar://problem/30636370>
2646
2647         Reviewed by Dean Jackson.
2648
2649         When playing a Live Broadcast video in fullscreen, we should not show any scrubbing-related
2650         piece of UI and ensure that we show the status label.
2651
2652         Test: http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html
2653
2654         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
2655         (.media-controls.mac.fullscreen > .controls-bar .status-label):
2656         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
2657         (MacOSFullscreenMediaControls.prototype.layout):
2658         * Modules/modern-media-controls/media/seek-support.js:
2659         (SeekSupport.prototype.get mediaEvents):
2660         (SeekSupport.prototype.syncControl):
2661
2662 2017-03-14  Joseph Pecoraro  <pecoraro@apple.com>
2663
2664         Web Inspector: More accurate Resource Timing data in Web Inspector
2665         https://bugs.webkit.org/show_bug.cgi?id=169577
2666
2667         Reviewed by Youenn Fablet.
2668
2669         * inspector/InspectorNetworkAgent.h:
2670         * inspector/InspectorNetworkAgent.cpp:
2671         (WebCore::InspectorNetworkAgent::didFinishLoading):
2672         Use the ResourceLoader to get the start time that responseEnd is relative to
2673         so we can send the more accurate responseEnd when available.
2674
2675         * inspector/InspectorInstrumentation.cpp:
2676         (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
2677         * inspector/InspectorInstrumentation.h:
2678         (WebCore::InspectorInstrumentation::didFinishLoading):
2679         * loader/CrossOriginPreflightChecker.cpp:
2680         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
2681         * loader/DocumentLoader.cpp:
2682         (WebCore::DocumentLoader::finishedLoading):
2683         * loader/ResourceLoadNotifier.cpp:
2684         (WebCore::ResourceLoadNotifier::didFinishLoad):
2685         (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
2686         (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
2687         * loader/ResourceLoadNotifier.h:
2688         * loader/appcache/ApplicationCacheGroup.cpp:
2689         (WebCore::ApplicationCacheGroup::didFinishLoading):
2690         Pass ResourceLoader through to Web Inspector in didFinishLoading.
2691
2692         * platform/network/cocoa/NetworkLoadMetrics.mm:
2693         (WebCore::copyTimingData):
2694         The differences from the reference start are in Seconds, not milliseconds.
2695
2696 2017-03-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2697
2698         [WK2] Data interaction tests occasionally hit assertions in debug builds
2699         https://bugs.webkit.org/show_bug.cgi?id=169002
2700         <rdar://problem/30994806>
2701
2702         Reviewed by Tim Horton.
2703
2704         Data interaction unit tests occasionally fail due to the UI process expecting the latest received EditorState to
2705         contain post layout data, but finding that it does not in -[WKContentView selectedTextRange]. The incomplete
2706         EditorStates in question are sent while performing a data interaction operation, due to transient changes in the
2707         frame selection. The UI process does not need to (and should not) be informed of these selection changes at all.
2708
2709         We can fix this by preventing the editor client from responding to selection changes during data interaction
2710         operation. This patch also renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges to better
2711         reflect the fact that it is used outside of the context of holding selection change updates during IME. We
2712         already use this affordance in various places, such as TextIndicator (while taking a snapshot on iOS), in
2713         FindController on iOS, and when replacing selected or dictated text. Additionally, there is no logic in
2714         setIgnoreCompositionSelectionChange that limits its use to composition.
2715
2716         * editing/Editor.cpp:
2717         (WebCore::Editor::cancelCompositionIfSelectionIsInvalid):
2718         (WebCore::Editor::setComposition):
2719         (WebCore::Editor::revealSelectionAfterEditingOperation):
2720         (WebCore::Editor::setIgnoreSelectionChanges):
2721         (WebCore::Editor::changeSelectionAfterCommand):
2722         (WebCore::Editor::respondToChangedSelection):
2723         (WebCore::Editor::setIgnoreCompositionSelectionChange): Deleted.
2724         * editing/Editor.h:
2725         (WebCore::Editor::ignoreSelectionChanges):
2726         (WebCore::Editor::ignoreCompositionSelectionChange): Deleted.
2727         * editing/mac/EditorMac.mm:
2728         (WebCore::Editor::selectionWillChange):
2729         * page/TextIndicator.cpp:
2730         (WebCore::TextIndicator::createWithRange):
2731
2732 2017-03-14  Antoine Quint  <graouts@apple.com>
2733
2734         [Modern Media Controls] iOS may attempt to load fullscreen icon variants
2735         https://bugs.webkit.org/show_bug.cgi?id=169608
2736         <rdar://problem/31037369>
2737
2738         Reviewed by Eric Carlson.
2739
2740         Only return fullscreen or compact variants for macOS.
2741
2742         * Modules/modern-media-controls/controls/icon-service.js:
2743         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconNameAndLayoutTraits):
2744         (const.iconService.new.IconService):
2745
2746 2017-03-14  Antoine Quint  <graouts@apple.com>
2747
2748         [Modern Media Controls] Controls are laid out incorrectly with RTL languages
2749         https://bugs.webkit.org/show_bug.cgi?id=169605
2750         <rdar://problem/30975709>
2751
2752         Reviewed by Eric Carlson.
2753
2754         Encorce "direction: ltr" on the controls since the controls layout should not be changed
2755         by the host page's direction.
2756
2757         Test: media/modern-media-controls/media-controls/media-controls-controls-bar-always-ltr.html
2758
2759         * Modules/modern-media-controls/controls/controls-bar.css:
2760         (.controls-bar):
2761
2762 2017-03-13  Wenson Hsieh  <wenson_hsieh@apple.com>
2763
2764         Make RepaintRegionAccumulator hold a WeakPtr to its root RenderView
2765         https://bugs.webkit.org/show_bug.cgi?id=168480
2766         <rdar://problem/30566976>
2767
2768         Reviewed by Antti Koivisto.
2769
2770         Implements two mitigations to prevent the symptoms of the bug from occurring (see the bugzilla for more details).
2771
2772         Test: editing/execCommand/show-modal-dialog-during-execCommand.html
2773
2774         * editing/EditorCommand.cpp:
2775         (WebCore::Editor::Command::execute):
2776
2777         Do not allow edit commands to execute if the frame's document before and after layout differ (that is, edit commands
2778         triggered by a certain document should not run on a different document).
2779
2780         * rendering/RenderView.cpp:
2781         (WebCore::RenderView::RenderView):
2782         (WebCore::RenderView::RepaintRegionAccumulator::RepaintRegionAccumulator):
2783
2784         Turns RepaintRegionAccumulator's reference to its root RenderView into a WeakPtr to gracefully handle the case
2785         where its RenderView is destroyed before RepaintRegionAccumulator's destructor gets a chance to flush the
2786         RenderView's repaint regions.
2787
2788         * rendering/RenderView.h:
2789
2790 2017-03-14  Zan Dobersek  <zdobersek@igalia.com>
2791
2792         [GLib] Use USE(GLIB) guards in WebCore/workers/
2793         https://bugs.webkit.org/show_bug.cgi?id=169595
2794
2795         Reviewed by Carlos Garcia Campos.
2796
2797         Utilize the USE(GLIB) build guards in the WorkerRunLoop and WorkerThread
2798         class implementations to guard GLib-specific header inclusions and GLib
2799         API invocations, instead of the more specific PLATFORM(GTK) guards.
2800
2801         * workers/WorkerRunLoop.cpp:
2802         (WebCore::WorkerRunLoop::runInMode):
2803         * workers/WorkerThread.cpp:
2804         (WebCore::WorkerThread::workerThread):
2805
2806 2017-03-14  Zan Dobersek  <zdobersek@igalia.com>
2807
2808         [Soup] Suppress compiler warnings in NetworkStorageSession
2809         https://bugs.webkit.org/show_bug.cgi?id=169593
2810
2811         Reviewed by Carlos Garcia Campos.
2812
2813         Return default-constructed Vector objects in the NetworkStorageSession's
2814         getAllCookies() and getCookies() methods, avoiding compiler warnings.
2815
2816         * platform/network/soup/NetworkStorageSessionSoup.cpp:
2817         (WebCore::NetworkStorageSession::getAllCookies):
2818         (WebCore::NetworkStorageSession::getCookies):
2819
2820 2017-03-13  Joseph Pecoraro  <pecoraro@apple.com>
2821
2822         Remove unused methods of ResourceRequestBase
2823         https://bugs.webkit.org/show_bug.cgi?id=169579
2824
2825         Reviewed by Youenn Fablet.
2826
2827         * platform/network/ResourceRequestBase.h:
2828         (WebCore::ResourceRequestBase::reportUploadProgress): Deleted.
2829         (WebCore::ResourceRequestBase::setReportUploadProgress): Deleted.
2830         (WebCore::ResourceRequestBase::reportLoadTiming): Deleted.
2831         (WebCore::ResourceRequestBase::setReportLoadTiming): Deleted.
2832         (WebCore::ResourceRequestBase::reportRawHeaders): Deleted.
2833         (WebCore::ResourceRequestBase::setReportRawHeaders): Deleted.
2834         Remove unused code.
2835
2836         * inspector/InspectorNetworkAgent.cpp:
2837         (WebCore::InspectorNetworkAgent::willSendRequest):
2838         * loader/ResourceLoadNotifier.cpp:
2839         (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
2840         * xml/XMLHttpRequest.cpp:
2841         (WebCore::XMLHttpRequest::createRequest):
2842         Remove callers of setters that did nothing.
2843
2844 2017-03-13  Youenn Fablet  <youenn@apple.com>
2845
2846         Make RealtimeMediaSource::type an enum class
2847         https://bugs.webkit.org/show_bug.cgi?id=169491
2848
2849         Reviewed by Sam Weinig.
2850
2851         No change of behavior.
2852
2853         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
2854         (WebCore::CanvasCaptureMediaStreamTrack::Source::Source):
2855         * Modules/mediastream/MediaStream.cpp:
2856         (WebCore::MediaStream::getAudioTracks):
2857         (WebCore::MediaStream::getVideoTracks):
2858         * Modules/mediastream/MediaStreamTrack.cpp:
2859         (WebCore::MediaStreamTrack::kind):
2860         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2861         (WebCore::LibWebRTCMediaEndpoint::addTrack):
2862         * Modules/webaudio/MediaStreamAudioSource.cpp:
2863         (WebCore::MediaStreamAudioSource::MediaStreamAudioSource):
2864         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2865         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated):
2866         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
2867         * platform/mediastream/CaptureDeviceManager.cpp:
2868         (CaptureDeviceManager::bestSourcesForTypeAndConstraints):
2869         (CaptureDeviceManager::sourceWithUID):
2870         * platform/mediastream/MediaEndpoint.cpp:
2871         * platform/mediastream/RealtimeMediaSource.h:
2872         * platform/mediastream/mac/AVAudioCaptureSource.mm:
2873         (WebCore::AVAudioCaptureSource::AVAudioCaptureSource):
2874         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2875         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
2876         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2877         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
2878         * platform/mock/MockMediaEndpoint.cpp:
2879         (WebCore::MockMediaEndpoint::createMutedRemoteSource):
2880         * platform/mock/MockRealtimeAudioSource.cpp:
2881         (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource):
2882         * platform/mock/MockRealtimeMediaSource.cpp:
2883         (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource):
2884         * platform/mock/MockRealtimeVideoSource.cpp:
2885         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
2886
2887 2017-03-13  Eric Carlson  <eric.carlson@apple.com>
2888
2889         [MediaStream] Move paintCurrentFrameInContext from RealtimeMediaSources to MediaPlayer
2890         https://bugs.webkit.org/show_bug.cgi?id=169474
2891         <rdar://problem/30976747>
2892
2893         Reviewed by Youenn Fablet.
2894
2895         Every video capture source has extremely similar code to render the current frame to
2896         a graphics context. Because the media player gets every video sample buffer, have it
2897         hang onto the most recent frame so it can implement paintCurrentFrameInContext directly.
2898         Fix an existing race condition that occasionally caused the readyState to advance to 
2899         "have enough data" before a video was ready to paint by defining a MediaStreamTrackPrivate
2900         readyState and observing that.
2901
2902         No new tests, covered by existing tests. These changes uncovered a bug in 
2903         fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html, which 
2904         was updated.
2905
2906         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
2907         (WebCore::CanvasCaptureMediaStreamTrack::Source::captureCanvas):
2908         (WebCore::CanvasCaptureMediaStreamTrack::Source::paintCurrentFrameInContext): Deleted.
2909         (WebCore::CanvasCaptureMediaStreamTrack::Source::currentFrameImage): Deleted.
2910         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
2911
2912         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2913         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2914         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
2915         Drive-by change - don't pass status to parent callback, it is a property of the layer.
2916         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable): Drive-by cleanup - we don't
2917         use AVSampleBufferRenderSynchronizer so don't fail if it isn't available.
2918         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): Hang onto new frame,
2919         invalidate cached image, update readyState.
2920         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): No more "updatePausedImage".
2921         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Drive-by cleanup - Add an early
2922          return if there is no need for a layer.
2923         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): renderingModeChanged -> updateRenderingMode.
2924         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode): Minor cleanup.
2925         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode): Renamed from renderingModeChanged,
2926         add a bool return to signal when the mode changes.
2927         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): No more m_haveEverPlayed. Update display
2928         mode immediately.
2929         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): No more paused image.
2930         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentReadyState): Only return HaveNothing, HaveMetadata,
2931         or HaveEnoughData. Don't return HaveEnoughData until all enabled tracks are providing data and never
2932         drop back to HaveMetadata.
2933         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateRenderingMode): Renamed from renderingModeChanged.
2934         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::characteristicsChanged): Update intrinsic
2935         size directly.
2936         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated): No more m_hasReceivedMedia.
2937         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::readyStateChanged): Ditto.
2938         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack): Reset imagePainter
2939         when active video track changes.
2940         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateCurrentFrameImage): Deleted.
2941         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext): Paint current
2942         frame image.
2943         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::CurrentFramePainter::reset): New.
2944         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::shouldEnqueueVideoSampleBuffer): Deleted.
2945         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updatePausedImage): Deleted.
2946         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateIntrinsicSize): Deleted.
2947         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::renderingModeChanged): Deleted.
2948         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSamplesAvailable): Deleted.
2949
2950         * platform/mediastream/MediaStreamPrivate.cpp:
2951         (WebCore::MediaStreamPrivate::paintCurrentFrameInContext): Deleted.
2952         (WebCore::MediaStreamPrivate::currentFrameImage): Deleted.
2953         * platform/mediastream/MediaStreamPrivate.h:
2954
2955         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2956         (WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate):
2957         (WebCore::MediaStreamTrackPrivate::endTrack): Update readyState.
2958         (WebCore::MediaStreamTrackPrivate::clone): Clone readyState.
2959         (WebCore::MediaStreamTrackPrivate::sourceStopped): Update readyState.
2960         (WebCore::MediaStreamTrackPrivate::videoSampleAvailable): Ditto.
2961         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable): Ditto.
2962         (WebCore::MediaStreamTrackPrivate::updateReadyState): New, update readyState and notify observers.
2963         (WebCore::MediaStreamTrackPrivate::paintCurrentFrameInContext): Deleted.
2964         * platform/mediastream/MediaStreamTrackPrivate.h:
2965
2966         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2967         (WebCore::MediaStreamTrackPrivate::paintCurrentFrameInContext): Deleted.
2968         * platform/mediastream/RealtimeMediaSource.h:
2969         (WebCore::RealtimeMediaSource::currentFrameImage): Deleted.
2970         (WebCore::RealtimeMediaSource::paintCurrentFrameInContext): Deleted.
2971
2972         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2973         (-[WebCoreAVMediaCaptureSourceObserver disconnect]): Drive-by fix - clear m_callback
2974         after calling removeNotificationObservers.
2975         (-[WebCoreAVMediaCaptureSourceObserver removeNotificationObservers]): Drive-by fix - remove 
2976         the correct listener.
2977         (-[WebCoreAVMediaCaptureSourceObserver endSessionInterrupted:]):
2978
2979         * platform/mediastream/mac/AVVideoCaptureSource.h:
2980         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2981         (WebCore::AVVideoCaptureSource::currentFrameImage): Deleted.
2982         (WebCore::AVVideoCaptureSource::currentFrameCGImage): Deleted.
2983         (WebCore::AVVideoCaptureSource::paintCurrentFrameInContext): Deleted.
2984
2985         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
2986         (WebCore::drawImage): Deleted.
2987         (WebCore::RealtimeIncomingVideoSource::currentFrameImage): Deleted.
2988         (WebCore::RealtimeIncomingVideoSource::paintCurrentFrameInContext): Deleted.
2989         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
2990
2991         * platform/mock/MockRealtimeVideoSource.cpp:
2992         (WebCore::MockRealtimeVideoSource::paintCurrentFrameInContext): Deleted.
2993         (WebCore::MockRealtimeVideoSource::currentFrameImage): Deleted.
2994         * platform/mock/MockRealtimeVideoSource.h:
2995
2996 2017-03-13  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2997
2998         [GTK][SOUP] Fix build after r213877
2999         https://bugs.webkit.org/show_bug.cgi?id=140191
3000
3001         Unreviewed build fix.
3002
3003         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3004         (WebCore::NetworkStorageSession::setCookie): Add missing setCookie() declaration.
3005
3006 2017-03-13  Brady Eidson  <beidson@apple.com>
3007
3008         WKWebView provides no access to cookies.
3009         https://bugs.webkit.org/show_bug.cgi?id=140191
3010
3011         Reviewed by Tim Horton.
3012
3013         Covered by API tests.
3014
3015         * platform/Cookie.h:
3016
3017         * platform/network/NetworkStorageSession.h:
3018         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
3019         (WebCore::NetworkStorageSession::setCookie):
3020         (WebCore::NetworkStorageSession::deleteCookie):
3021         (WebCore::nsCookiesToCookieVector):
3022         (WebCore::NetworkStorageSession::getAllCookies):
3023         (WebCore::NetworkStorageSession::getCookies):
3024
3025         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3026         (WebCore::NetworkStorageSession::deleteCookie):
3027         (WebCore::NetworkStorageSession::getAllCookies):
3028         (WebCore::NetworkStorageSession::getCookies):
3029
3030 2017-03-13  Devin Rousso  <webkit@devinrousso.com>
3031
3032         Web Inspector: Event Listeners section is missing 'once', 'passive' event listener flags
3033         https://bugs.webkit.org/show_bug.cgi?id=167080
3034
3035         Reviewed by Joseph Pecoraro.
3036
3037         Test: inspector/dom/getEventListenersForNode.html
3038
3039         * inspector/InspectorDOMAgent.cpp:
3040         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
3041         Add "passive" and "once" values to the EventListener protocol object when applicable.
3042
3043 2017-03-13  John Wilander  <wilander@apple.com>
3044
3045         Resource Load Statistics: More efficient network process messaging + Fix bug in user interaction reporting
3046         https://bugs.webkit.org/show_bug.cgi?id=169506
3047
3048         Reviewed by Alex Christensen.
3049
3050         Covered by previous test which now follows the code path more closely to when reporting
3051         happens in the web process.
3052
3053         * loader/ResourceLoadObserver.cpp:
3054         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3055             No longer explicitly calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
3056             Instead just calls ResourceLoadStatisticsStore::fireDataModificationHandler().
3057         (WebCore::ResourceLoadObserver::logUserInteraction):
3058             Updated to call the new ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
3059         (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
3060             Now takes two vectors – domainsToRemove and domainsToAdd.
3061         * loader/ResourceLoadObserver.h:
3062         * loader/ResourceLoadStatistics.cpp:
3063         (WebCore::ResourceLoadStatistics::toString):
3064             Added boolean field isMarkedForCookiePartitioning.
3065         (WebCore::ResourceLoadStatistics::merge):
3066             Added boolean field isMarkedForCookiePartitioning.
3067         * loader/ResourceLoadStatistics.h:
3068             Added boolean field isMarkedForCookiePartitioning.
3069         * loader/ResourceLoadStatisticsStore.cpp:
3070         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
3071             Now marks statistics with isMarkedForCookiePartitioning before sending them off to
3072             ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
3073         (WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback):
3074             Now accepts a handler with two vectors.
3075         (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
3076             Now the only exported version of this function is the one without arguments.
3077             The one internal to WebCore accepts two vectors – domainsToRemove and domainsToAdd.
3078             The exported one generates the two vectors and then calls the internal one.
3079         (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
3080             No longer explicitly calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
3081         * loader/ResourceLoadStatisticsStore.h:
3082         * platform/network/NetworkStorageSession.h:
3083         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3084         (WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts):
3085             Now takes two vectors – domainsToRemove and domainsToAdd.
3086
3087 2017-03-13  Dean Jackson  <dino@apple.com>
3088
3089         Respect the runtime flag for WebGPU, default feature to off.
3090         https://bugs.webkit.org/show_bug.cgi?id=169564
3091         <rdar://problems/31018864>
3092
3093         Reviewed by Tim Horton.
3094
3095         Make sure WebGPU respects its runtime feature flag. Also, since
3096         this implementation doesn't validate content, it should default
3097         to being disabled.
3098
3099         Test: fast/canvas/webgpu/webgpu-runtime-flag.html
3100
3101         * html/HTMLCanvasElement.cpp:
3102         (WebCore::HTMLCanvasElement::getContext):
3103         (WebCore::HTMLCanvasElement::getContextWebGPU):
3104
3105 2017-03-13  Alex Christensen  <achristensen@webkit.org>
3106
3107         Fix CMake build.
3108
3109         * PlatformMac.cmake:
3110         Add new files.
3111
3112 2017-03-13  Chris Dumez  <cdumez@apple.com>
3113
3114         Allow termination of background WebProcesses that go over a given CPU usage threshold
3115         https://bugs.webkit.org/show_bug.cgi?id=169456
3116         <rdar://problem/30960968>
3117
3118         Reviewed by Andreas Kling.
3119
3120         Add CPUMonitor utility class to monitor CPU usage and call a provided lambda
3121         whenever the process exceeds the provided CPU limit over a given period of
3122         time.
3123
3124         * WebCore.xcodeproj/project.pbxproj:
3125         * platform/CPUMonitor.cpp: Added.
3126         (WebCore::CPUMonitor::CPUMonitor):
3127         (WebCore::CPUMonitor::setCPULimit):
3128         (WebCore::CPUMonitor::timerFired):
3129         * platform/CPUMonitor.h: Added.
3130
3131 2017-03-13  Antoine Quint  <graouts@apple.com>
3132
3133         [Modern Media Controls] Volume icon doesn't turn to mute when the knob is set to 0
3134         https://bugs.webkit.org/show_bug.cgi?id=169553
3135         <rdar://problem/30754543>
3136
3137         Reviewed by Eric Carlson.
3138
3139         When we start changing the volume using the mouse, we record the volume at that point
3140         and as we drag the volume slider, we set the mute button to show that the media is
3141         muted if the volume is 0, and set the actual media volume to be the initial volume
3142         prior to dragging. This way, when we toggle the "muted" property by pressing the
3143         mute button, the original volume is restored.
3144
3145         To function correctly, this required some changed to Slider. The volume slider would
3146         fail to update if the value set was the same as the initial value since we would use
3147         only the "change" event to identify the end of a slider drag interaction. This was
3148         incorrect since if the initial value and the final value while dragging the slider
3149         were the same, no "change" event would be fired. So we now use mouse events to
3150         identify when the slider is being dragged.
3151
3152         Test: media/modern-media-controls/volume-support/volume-support-drag-to-mute.html
3153
3154         * Modules/modern-media-controls/controls/slider.js:
3155         (Slider.prototype.set value):
3156         (Slider.prototype.handleEvent):
3157         (Slider.prototype._handleMousedownEvent):
3158         (Slider.prototype._handleInputEvent):
3159         (Slider.prototype._handleMouseupEvent):
3160         (Slider.prototype._handleChangeEvent): Deleted.
3161         * Modules/modern-media-controls/controls/volume-slider.js:
3162         (VolumeSlider):
3163         (VolumeSlider.prototype.draw):
3164         (VolumeSlider.prototype.handleEvent): Deleted.
3165         * Modules/modern-media-controls/media/volume-support.js:
3166         (VolumeSupport.prototype.controlValueWillStartChanging):
3167         (VolumeSupport.prototype.controlValueDidChange):
3168
3169 2017-03-13  Per Arne Vollan  <pvollan@apple.com>
3170
3171         [Win] Compile error.
3172         https://bugs.webkit.org/show_bug.cgi?id=169546
3173
3174         Reviewed by Brent Fulgham.
3175
3176         There is no matching constructor in the Cookie class.
3177
3178         * platform/network/cf/CookieJarCFNet.cpp:
3179         (WebCore::getRawCookies):
3180
3181 2017-03-13  Miguel Gomez  <magomez@igalia.com>
3182
3183         ImageDecoder can be deleted while the async decoder thread is still using it
3184         https://bugs.webkit.org/show_bug.cgi?id=169199
3185
3186         Reviewed by Carlos Garcia Campos.
3187
3188         Make the image decoder used by ImageSource and ImageFrameCache into a RefPtr instead of
3189         and unique_ptr, and pass a reference to the decoder thread. This ensures that the decoder
3190         will stay alive as long as the decoding thread is processing frames. Also, stop the async
3191         decoding queue if a new decoder is set to ImageFrameCache.
3192
3193         No new tests.
3194
3195         * platform/graphics/ImageFrameCache.cpp:
3196         (WebCore::ImageFrameCache::setDecoder):
3197         (WebCore::ImageFrameCache::decoder):
3198         (WebCore::ImageFrameCache::startAsyncDecodingQueue):
3199         (WebCore::ImageFrameCache::metadata):
3200         * platform/graphics/ImageFrameCache.h:
3201         (WebCore::ImageFrameCache::setDecoder): Deleted.
3202         Moved to source file so we can keep the ImageDecoder forward declaration.
3203         (WebCore::ImageFrameCache::decoder): Deleted.
3204         Moved to source file so we can keep the ImageDecoder forward declaration.
3205         * platform/graphics/ImageSource.h:
3206         * platform/graphics/cg/ImageDecoderCG.h:
3207         (WebCore::ImageDecoder::create):
3208         * platform/graphics/win/ImageDecoderDirect2D.h:
3209         (WebCore::ImageDecoder::create):
3210         * platform/image-decoders/ImageDecoder.cpp:
3211         (WebCore::ImageDecoder::create):
3212         * platform/image-decoders/ImageDecoder.h:
3213
3214 2017-03-13  Manuel Rego Casasnovas  <rego@igalia.com>
3215
3216         Unprefix -webkit-min-content, -webkit-max-content and -webkit-fit-content
3217         https://bugs.webkit.org/show_bug.cgi?id=169195
3218
3219         Reviewed by Sergio Villar Senin.
3220
3221         Based on Blink r200846 by <cbiesinger@chromium.org>.
3222         https://src.chromium.org/viewvc/blink?revision=200846&view=revision
3223
3224         This patch adds support for the unprefixed version of these properties,
3225         while it keeps the prefixed ones working too.
3226         -webkit-fill-available is left out of this change, as the CSS WG
3227         is still defining the final keyword and behavior.
3228
3229         With this patch WebKit will be in the same situation than Blink
3230         regarding these intrinsic sizing keywords (see http://crbug.com/245157).
3231
3232         Test: fast/css-intrinsic-dimensions/height-property-value.html
3233               fast/css-intrinsic-dimensions/width-property-value.html
3234
3235         * css/CSSPrimitiveValue.cpp:
3236         (WebCore::CSSPrimitiveValue::init):
3237         * css/CSSValueKeywords.in:
3238         * css/StyleBuilderConverter.h:
3239         (WebCore::StyleBuilderConverter::convertLengthSizing):
3240         (WebCore::StyleBuilderConverter::createGridTrackBreadth):
3241         * css/html.css:
3242         (fieldset):
3243         * css/parser/CSSPropertyParser.cpp:
3244         (WebCore::validWidthOrHeightKeyword):
3245         (WebCore::isGridTrackFixedSized):
3246         (WebCore::consumeGridBreadth):
3247         * html/track/TextTrackCueGeneric.cpp:
3248         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
3249         * html/track/VTTCue.cpp:
3250         (WebCore::VTTCueBox::applyCSSProperties):
3251
3252 2017-03-13  Dean Jackson  <dino@apple.com>
3253
3254         WebGPU remote layer hosting
3255         https://bugs.webkit.org/show_bug.cgi?id=169539
3256         <rdar://problem/31005380>
3257
3258         Reviewed by Jon Lee.
3259
3260         Implement the WebProcess side of WebGPULayer hosting,
3261         via LayerTypeWebGPULayer.
3262
3263         * platform/graphics/ca/PlatformCALayer.cpp:
3264         (WebCore::operator<<): Provide nice pretty printing.
3265         * platform/graphics/ca/PlatformCALayer.h: Add LayerTypeWebGPULayer.
3266         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: Support LayerTypeWebGPULayer.
3267         (PlatformCALayerCocoa::layerTypeForPlatformLayer):
3268         (PlatformCALayerCocoa::PlatformCALayerCocoa):
3269         (PlatformCALayerCocoa::commonInit):
3270
3271 2017-03-13  Zan Dobersek  <zdobersek@igalia.com>
3272
3273         Unreviewed GTK+ build fix. Adjust the Cookie constructor
3274         invocation in CookieJarSoup, using empty values for the
3275         newly-added parameters. This should probably be revised
3276         to determine whether meaningful values can be passed in.
3277
3278         * platform/network/soup/CookieJarSoup.cpp:
3279         (WebCore::getRawCookies):
3280
3281 2017-03-13  Jon Lee  <jonlee@apple.com>
3282
3283         WebGPU: Backend - hosting WebGPU layers
3284         https://bugs.webkit.org/show_bug.cgi?id=169366
3285         <rdar://problem/30928735>
3286
3287         Reviewed by Dean Jackson.
3288
3289         * html/canvas/WebGPURenderingContext.cpp:
3290         (WebCore::WebGPURenderingContext::create): Create the device and the
3291         rendering context.
3292         * platform/graphics/cocoa/GPUCommandBufferMetal.mm:
3293         (WebCore::GPUCommandBuffer::commit):
3294         * platform/graphics/cocoa/GPUDrawableMetal.mm:
3295         (WebCore::GPUDrawable::release): Fix a log message
3296         * platform/graphics/gpu/GPUCommandBuffer.cpp:
3297         (WebCore::GPUCommandBuffer::commit): Deleted. Moved to GPUCommandBufferMetal.
3298         * rendering/RenderLayerBacking.cpp:
3299         (WebCore::canvasCompositingStrategy): WebGPU canvas should return CanvasAsLayerContents.
3300
3301 2017-03-12  Jon Lee  <jonlee@apple.com>
3302
3303         Remove stubs from WebGPU front end
3304         https://bugs.webkit.org/show_bug.cgi?id=169375
3305
3306         Reviewed by Dean Jackson.
3307
3308         Remove stubs and use the back end.
3309         * html/canvas/WebGPUCommandBuffer.cpp:
3310         * html/canvas/WebGPUCommandBuffer.h:
3311         * html/canvas/WebGPUCommandQueue.cpp:
3312         * html/canvas/WebGPUCommandQueue.h:
3313         * html/canvas/WebGPUDepthStencilDescriptor.cpp:
3314         (WebCore::WebGPUDepthStencilDescriptor::setDepthCompareFunction): Remove redundant clause.
3315         * html/canvas/WebGPUDepthStencilDescriptor.h:
3316         * html/canvas/WebGPUDepthStencilDescriptor.idl: Remove label property. Not needed yet.
3317         * html/canvas/WebGPUDepthStencilState.cpp:
3318         * html/canvas/WebGPUDepthStencilState.h:
3319         * html/canvas/WebGPUEnums.cpp:
3320         * html/canvas/WebGPUEnums.h:
3321         * html/canvas/WebGPURenderCommandEncoder.cpp:
3322         * html/canvas/WebGPURenderCommandEncoder.h:
3323         * html/canvas/WebGPURenderPassAttachmentDescriptor.cpp:
3324         * html/canvas/WebGPURenderPassAttachmentDescriptor.h:
3325         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
3326         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.h:
3327         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
3328         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h:
3329         * html/canvas/WebGPURenderPassDescriptor.cpp:
3330         (WebCore::WebGPURenderPassDescriptor::colorAttachments): Uncomment code with GPURenderPassColorAttachmentDescriptor available.
3331         * html/canvas/WebGPURenderPassDescriptor.h:
3332         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp:
3333         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h:
3334         * html/canvas/WebGPURenderPipelineDescriptor.cpp:
3335         * html/canvas/WebGPURenderPipelineDescriptor.h:
3336         * html/canvas/WebGPURenderPipelineDescriptor.idl: Remove label property. Not needed yet.
3337         * html/canvas/WebGPURenderPipelineState.cpp:
3338         * html/canvas/WebGPURenderPipelineState.h:
3339
3340 2017-03-12  Dean Jackson  <dino@apple.com>
3341
3342         WebGPU Backend
3343         https://bugs.webkit.org/show_bug.cgi?id=169535
3344         <rdar://problem/31002364>
3345
3346         Reviewed by Jon Lee.
3347
3348         Fill in the remainder of the WebGPU backend. This is effectively
3349         a C++ representation of the Metal API.
3350
3351         * WebCore.xcodeproj/project.pbxproj:
3352         * html/canvas/WebGPUDrawable.cpp:
3353         (WebCore::WebGPUDrawable::WebGPUDrawable):
3354         * html/canvas/WebGPUDrawable.h:
3355         (WebCore::GPUDrawable::texture): Deleted.
3356         * platform/graphics/cocoa/GPUBufferMetal.mm:
3357         (WebCore::GPUBuffer::GPUBuffer):
3358         (WebCore::GPUBuffer::platformBuffer):
3359         * platform/graphics/cocoa/GPUCommandBufferMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
3360         (WebCore::GPUCommandBuffer::GPUCommandBuffer):
3361         (WebCore::GPUCommandBuffer::platformCommandBuffer):
3362         (WebCore::GPUCommandBuffer::presentDrawable):
3363         * platform/graphics/cocoa/GPUCommandQueueMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
3364         (WebCore::GPUCommandQueue::GPUCommandQueue):
3365         (WebCore::GPUCommandQueue::label):
3366         (WebCore::GPUCommandQueue::setLabel):
3367         (WebCore::GPUCommandQueue::platformCommandQueue):
3368         * platform/graphics/cocoa/GPUDepthStencilDescriptorMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUTextureMetal.mm.
3369         (WebCore::GPUDepthStencilDescriptor::GPUDepthStencilDescriptor):
3370         (WebCore::GPUDepthStencilDescriptor::depthWriteEnabled):
3371         (WebCore::GPUDepthStencilDescriptor::setDepthWriteEnabled):
3372         (WebCore::GPUDepthStencilDescriptor::depthCompareFunction):
3373         (WebCore::GPUDepthStencilDescriptor::setDepthCompareFunction):
3374         (WebCore::GPUDepthStencilDescriptor::platformDepthStencilDescriptor):
3375         * platform/graphics/cocoa/GPUDepthStencilStateMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
3376         (WebCore::GPUDepthStencilState::GPUDepthStencilState):
3377         (WebCore::GPUDepthStencilState::label):
3378         (WebCore::GPUDepthStencilState::setLabel):
3379         (WebCore::GPUDepthStencilState::platformDepthStencilState):
3380         * platform/graphics/cocoa/GPUDrawableMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
3381         (WebCore::GPUDrawable::GPUDrawable):
3382         (WebCore::GPUDrawable::release):
3383         (WebCore::GPUDrawable::platformDrawable):
3384         (WebCore::GPUDrawable::platformTexture):
3385         * platform/graphics/cocoa/GPUFunctionMetal.mm:
3386         (WebCore::GPUFunction::GPUFunction):
3387         (WebCore::GPUFunction::platformFunction):
3388         * platform/graphics/cocoa/GPULibraryMetal.mm:
3389         (WebCore::GPULibrary::GPULibrary):
3390         (WebCore::GPULibrary::setLabel):
3391         (WebCore::GPULibrary::platformLibrary):
3392         * platform/graphics/cocoa/GPURenderCommandEncoderMetal.mm: Added.
3393         (WebCore::GPURenderCommandEncoder::GPURenderCommandEncoder):
3394         (WebCore::GPURenderCommandEncoder::setRenderPipelineState):
3395         (WebCore::GPURenderCommandEncoder::setDepthStencilState):
3396         (WebCore::GPURenderCommandEncoder::setVertexBuffer):
3397         (WebCore::GPURenderCommandEncoder::setFragmentBuffer):
3398         (WebCore::GPURenderCommandEncoder::drawPrimitives):
3399         (WebCore::GPURenderCommandEncoder::endEncoding):
3400         (WebCore::GPURenderCommandEncoder::platformRenderCommandEncoder):
3401         * platform/graphics/cocoa/GPURenderPassAttachmentDescriptorMetal.mm: Added.
3402         (WebCore::GPURenderPassAttachmentDescriptor::GPURenderPassAttachmentDescriptor):
3403         (WebCore::GPURenderPassAttachmentDescriptor::loadAction):
3404         (WebCore::GPURenderPassAttachmentDescriptor::setLoadAction):
3405         (WebCore::GPURenderPassAttachmentDescriptor::storeAction):
3406         (WebCore::GPURenderPassAttachmentDescriptor::setStoreAction):
3407         (WebCore::GPURenderPassAttachmentDescriptor::setTexture):
3408         (WebCore::GPURenderPassAttachmentDescriptor::platformRenderPassAttachmentDescriptor):
3409         * platform/graphics/cocoa/GPURenderPassColorAttachmentDescriptorMetal.mm: Added.
3410         (WebCore::GPURenderPassColorAttachmentDescriptor::create):
3411         (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor):
3412         (WebCore::GPURenderPassColorAttachmentDescriptor::clearColor):
3413         (WebCore::GPURenderPassColorAttachmentDescriptor::setClearColor):
3414         (WebCore::GPURenderPassColorAttachmentDescriptor::platformRenderPassColorAttachmentDescriptor):
3415         * platform/graphics/cocoa/GPURenderPassDepthAttachmentDescriptorMetal.mm: Added.
3416         (WebCore::GPURenderPassDepthAttachmentDescriptor::create):
3417         (WebCore::GPURenderPassDepthAttachmentDescriptor::GPURenderPassDepthAttachmentDescriptor):
3418         (WebCore::GPURenderPassDepthAttachmentDescriptor::clearDepth):
3419   &