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