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