f51f144057c056620b7388ea1fbd81618f1d4113
[WebKit.git] / Source / WebCore / ChangeLog
1 2017-02-27  Antoine Quint  <graouts@apple.com>
2
3         [Modern Media Controls] Use compact mode by default on macOS
4         https://bugs.webkit.org/show_bug.cgi?id=168958
5         <rdar://problem/30748638>
6
7         Reviewed by Jon Lee.
8
9         We now use the compact layout mode by default on macOS.
10
11         * Modules/modern-media-controls/controls/layout-item.js: Remove the ReducedPadding trait.
12         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css: 
13         (.media-controls.mac.inline.compact .time-label,): Vertically align the time label with
14         the scrubber in compact mode.
15         (.media-controls.mac.inline.compact .scrubber.slider): Correctly position the scrubber in
16         compact mode so that it's vertically aligned.
17         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
18         (MacOSInlineMediaControls.prototype.layoutTraitsDidChange): Remove handling of tight and
19         reduced padding traits since these do not apply to macOS anymore. We also notify the
20         scrubber of a layout trait change so that it may adjust its height.
21         * Modules/modern-media-controls/controls/scrubber.js:
22         (Scrubber):
23         (Scrubber.prototype.layoutTraitsDidChange): Adjust the height of the scrubber to match
24         compact layout traits.
25         * Modules/modern-media-controls/controls/time-control.js:
26         (TimeControl.prototype.get isSufficientlyWide): Adjust the minimum scrubber width for
27         TimeControl visibility to match compact layout traits.
28         * Modules/modern-media-controls/media/media-controller.js:
29         (MediaController.prototype.get layoutTraits): Use the compact layout trait by default
30         on macOS and make the tight padding specific to iOS.
31
32 2017-02-27  Antoine Quint  <graouts@apple.com>
33
34         [Modern Media Controls] Adhere to tight padding on iOS
35         https://bugs.webkit.org/show_bug.cgi?id=168949
36         <rdar://problem/30746164>
37
38         Reviewed by Jon Lee.
39
40         We used to only support custom margins on macOS, to support this on iOS as
41         well, we promote the notification when the layoutTraits property is set to
42         MediaControls and expose a new protected method layoutTraitsDidChange() for
43         subclasses to implement. IOSInlineMediaControls now implements that method
44         and will use tighter margins for the TightPadding layout trait.
45
46         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-tight-padding.html
47
48         * Modules/modern-media-controls/controls/ios-inline-media-controls.js:
49         (IOSInlineMediaControls.prototype.layoutTraitsDidChange):
50         (IOSInlineMediaControls):
51         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
52         (MacOSInlineMediaControls.prototype.get layoutTraits): Deleted.
53         (MacOSInlineMediaControls.prototype.set layoutTraits): Deleted.
54         (MacOSInlineMediaControls.prototype._matchLayoutTraits): Deleted.
55         * Modules/modern-media-controls/controls/media-controls.js:
56         (MediaControls.prototype.get layoutTraits):
57         (MediaControls.prototype.set layoutTraits):
58         (MediaControls.prototype.layoutTraitsDidChange):
59
60 2017-02-27  Youenn Fablet  <youenn@apple.com>
61
62         [WebRTC] Support modern RTCStatsReport
63         https://bugs.webkit.org/show_bug.cgi?id=166916
64         <rdar://problem/30293780>
65
66         Reviewed by Alex Christensen.
67
68         Updating binding generator and IDL parser to handle maplike.
69         Covered by binding tests.
70
71         Added support for maplike binding from JS wrapper to DOM class.
72         The principle is to have the JSXX wrapper having a @backingMap slot containing a Map.
73         All maplike methods are forwarded to the corresponding Map methods.
74         The XX object is responsible to add key/value pairs using a helper routine.
75         The creation of the Map is done at creation of the JSXX wrapper.
76
77         DOM class is interacting with the map through DOMMapLike.
78         Extracted DOMGuarded from DOM promise implementation.
79         This allows reusing this code for DOMMapLike.
80
81         Covered by binding tests and manual tests.
82
83         * CMakeLists.txt:
84         * DerivedSources.make:
85         * Modules/mediastream/RTCStatsReport.h:
86         (WebCore::RTCStatsReport::InboundRTPStreamStats::InboundRTPStreamStats):
87         (WebCore::RTCStatsReport::OutboundRTPStreamStats::OutboundRTPStreamStats):
88         (WebCore::RTCStatsReport::create):
89         (WebCore::RTCStatsReport::synchronizeBackingMap):
90         (WebCore::RTCStatsReport::backingMap):
91         (WebCore::RTCStatsReport::addStats):
92         * Modules/mediastream/RTCStatsReport.idl:
93         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
94         (WebCore::fromStdString):
95         (WebCore::fillRTCStats):
96         (WebCore::fillRTCRTPStreamStats):
97         (WebCore::fillInboundRTPStreamStats):
98         (WebCore::fillOutboundRTPStreamStats):
99         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
100         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
101         * WebCore.xcodeproj/project.pbxproj:
102         * bindings/js/JSDOMBindingInternals.js: Added.
103         (mapLikeForEach):
104         * bindings/js/JSDOMGlobalObject.cpp:
105         (WebCore::JSDOMGlobalObject::visitChildren):
106         * bindings/js/JSDOMGlobalObject.h:
107         * bindings/js/JSDOMGuardedObject.cpp: Added.
108         (WebCore::DOMGuardedObject::DOMGuardedObject):
109         (WebCore::DOMGuardedObject::~DOMGuardedObject):
110         (WebCore::DOMGuardedObject::clear):
111         (WebCore::DOMGuardedObject::contextDestroyed):
112         * bindings/js/JSDOMGuardedObject.h: Added.
113         (WebCore::DOMGuardedObject::isSuspended):
114         (WebCore::DOMGuardedObject::visitAggregate):
115         (WebCore::DOMGuardedObject::guardedObject):
116         (WebCore::DOMGuardedObject::globalObject):
117         (WebCore::DOMGuardedObject::isEmpty):
118         (WebCore::DOMGuarded::DOMGuarded):
119         (WebCore::DOMGuarded::guarded):
120         * bindings/js/JSDOMMapLike.cpp: Added.
121         (WebCore::getBackingMap):
122         (WebCore::initializeBackingMap):
123         (WebCore::createBackingMap):
124         (WebCore::forwardAttributeGetterToBackingMap):
125         (WebCore::forwardFunctionCallToBackingMap):
126         (WebCore::forwardForEachCallToBackingMap):
127         * bindings/js/JSDOMMapLike.h: Added.
128         (WebCore::DOMMapLike::set):
129         (WebCore::synchronizeBackingMap):
130         (WebCore::forwardSizeToMapLike):
131         (WebCore::forwardEntriesToMapLike):
132         (WebCore::forwardKeysToMapLike):
133         (WebCore::forwardValuesToMapLike):
134         (WebCore::forwardClearToMapLike):
135         (WebCore::forwardForEachToMapLike):
136         (WebCore::forwardHasToMapLike):
137         (WebCore::forwardAddToMapLike):
138         (WebCore::forwardDeleteToMapLike):
139         * bindings/js/JSDOMPromise.cpp:
140         (WebCore::DeferredPromise::promise):
141         (WebCore::DeferredPromise::reject):
142         * bindings/js/JSDOMPromise.h:
143         (WebCore::DeferredPromise::resolve):
144         (WebCore::DeferredPromise::resolveWithNewlyCreated):
145         (WebCore::DeferredPromise::reject):
146         (WebCore::DeferredPromise::resolveWithCallback):
147         (WebCore::DeferredPromise::rejectWithCallback):
148         (WebCore::DeferredPromise::DeferredPromise):
149         (WebCore::DeferredPromise::deferred):
150         * bindings/js/WebCoreBuiltinNames.h:
151         * bindings/scripts/CodeGeneratorJS.pm:
152         (PrototypeFunctionCount):
153         (GeneratePropertiesHashTable):
154         (InterfaceNeedsIterator):
155         (GenerateImplementation):
156         (GenerateParametersCheck):
157         * bindings/scripts/IDLParser.pm:
158         (assert):
159         (parseAttributeOrOperationOrIterator):
160         (parseSerializer):
161         (parseAttributeOrOperationRest):
162         (parseAttribute):
163         (parseAttributeRest):
164         (parseOperationOrIterator):
165         (parseOptionalIterableInterface):
166         (parseMapLikeRest):
167         (parseMapLikeProperties):
168         (parseOperationRest):
169         (applyMemberList):
170         * bindings/scripts/test/JS/JSMapLike.cpp: Added.
171         * bindings/scripts/test/JS/JSMapLike.h: Added.
172         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: Added.
173         * bindings/scripts/test/JS/JSReadOnlyMapLike.h: Added.
174         * bindings/scripts/test/TestMapLike.idl: Added.
175         * bindings/scripts/test/TestReadOnlyMapLike.idl: Added.
176
177 2017-02-27  Mark Lam  <mark.lam@apple.com>
178
179         Introduce a VM Traps mechanism and refactor Watchdog to use it.
180         https://bugs.webkit.org/show_bug.cgi?id=168842
181
182         Reviewed by Filip Pizlo.
183
184         No new tests needed because this is a re-implementation of existing functionality.
185
186         * bindings/js/WorkerScriptController.cpp:
187         (WebCore::WorkerScriptController::WorkerScriptController):
188         (WebCore::WorkerScriptController::scheduleExecutionTermination):
189
190 2017-02-27  Andy Estes  <aestes@apple.com>
191
192         [Cocoa] Rename FileMac.mm to FileCocoa.mm
193         https://bugs.webkit.org/show_bug.cgi?id=168947
194
195         Reviewed by Zalan Bujtas.
196
197         * PlatformMac.cmake:
198         * WebCore.xcodeproj/project.pbxproj:
199         * fileapi/FileCocoa.mm: Renamed from Source/WebCore/fileapi/FileMac.mm.
200
201 2017-02-27  Andy Estes  <aestes@apple.com>
202
203         [iOS] Enable file replacement
204         https://bugs.webkit.org/show_bug.cgi?id=168907
205         <rdar://problem/22258242>
206
207         Reviewed by David Kilzer.
208
209         Covered by existing tests.
210
211         * fileapi/FileMac.mm:
212         (WebCore::File::shouldReplaceFile): Stop using Carbon and AppKit API for determining if a
213         file path is a file package. Use NSURL and CoreServices instead, which exist on Mac and iOS.
214
215 2017-02-27  Antoine Quint  <graouts@apple.com>
216
217         [Modern Media Controls] Use a solid background for <audio> controls on macOS
218         https://bugs.webkit.org/show_bug.cgi?id=168941
219         <rdar://problem/30744316>
220
221         Reviewed by Dean Jackson.
222
223         Use a solid background for <audio> elements on macOS, the same way we do on iOS.
224
225         Test: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-audio-background.html
226
227         * Modules/modern-media-controls/controls/macos-media-controls.css:
228         (:host(audio) .media-controls.mac.inline > .controls-bar):
229         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint):
230
231 2017-02-27  Antoine Quint  <graouts@apple.com>
232
233         [Modern Media Controls] StatusLabel should use similar properties to TimeLabel
234         https://bugs.webkit.org/show_bug.cgi?id=168938
235         <rdar://problem/30743185>
236
237         Reviewed by Dean Jackson.
238
239         Ensure we use the same styling properties for StatusLabel and TimeLabel.
240
241         Tests: media/modern-media-controls/status-label/status-label-ios.html
242                media/modern-media-controls/status-label/status-label-macos.html
243
244         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
245         (.media-controls.ios.inline .time-label,):
246         (.media-controls.ios.inline .time-label): Deleted.
247         * Modules/modern-media-controls/controls/macos-media-controls.css:
248         (.media-controls.mac > .controls-bar .time-label,):
249         (.media-controls.mac > .controls-bar .time-label): Deleted.
250         * Modules/modern-media-controls/controls/status-label.css:
251         (.status-label):
252
253 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
254
255         Rename ICU cursor iterator to caret iterator
256         https://bugs.webkit.org/show_bug.cgi?id=168206
257
258         Reviewed by Simon Fraser.
259
260         Mechanical find/replace.
261
262         No new tests because there is no behavior change.
263
264         * platform/graphics/ComplexTextController.cpp:
265         (WebCore::ComplexTextController::offsetForPosition):
266         * rendering/RenderText.cpp:
267         (WebCore::RenderText::previousOffset):
268         (WebCore::RenderText::nextOffset):
269
270 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
271
272         Unprefix -webkit-line-break
273         https://bugs.webkit.org/show_bug.cgi?id=168213
274
275         Reviewed by Darin Adler.
276
277         We support the property as specced.
278
279         Test: fast/text/line-break-unprefixed.html
280
281         * css/CSSComputedStyleDeclaration.cpp:
282         (WebCore::ComputedStyleExtractor::propertyValue):
283         * css/CSSProperties.json:
284         * css/parser/CSSParserFastPaths.cpp:
285         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
286         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
287         * editing/Editor.cpp:
288         (WebCore::Editor::applyEditingStyleToElement):
289         * html/HTMLElement.cpp:
290         (WebCore::HTMLElement::collectStyleForPresentationAttribute):
291
292 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
293
294         Use RAII for ICU breaking iterators
295         https://bugs.webkit.org/show_bug.cgi?id=168203
296
297         Reviewed by Simon Fraser.
298
299         No new tests because there is no behavior change.
300
301         * platform/graphics/ComplexTextController.cpp:
302         (WebCore::ComplexTextController::offsetForPosition):
303         * rendering/RenderText.cpp:
304         (WebCore::RenderText::previousOffset):
305         (WebCore::RenderText::nextOffset):
306
307 2017-02-27  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>
308
309         [WinCairo][MiniBrowser] Add ca-bundle to display secure pages
310         https://bugs.webkit.org/show_bug.cgi?id=168486
311
312         Reviewed by Alex Christensen.
313
314         change the order of path location search to make it possible to 
315         configure with environment variable because bundled ca-bundle is
316         always available now.
317
318         * platform/network/curl/ResourceHandleManager.cpp:
319         (WebCore::certificatePath):
320
321 2017-02-27  Antoine Quint  <graouts@apple.com>
322
323         [Modern Media Controls] Status text does not appear on iOS
324         https://bugs.webkit.org/show_bug.cgi?id=168918
325         <rdar://problem/30737644>
326
327         Reviewed by Dean Jackson.
328
329         We refactor the layout code out of MacOSInlineMediaControls and into a new
330         InlineLayoutSupport class which IOSInlineMediaControls uses as well. Now
331         both the macOS and iOS inline media controls run the same layout logic to
332         control whether the status label or scrubber should be displayed, and which
333         controls should be dropped due to space constraints.
334
335         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-status-label.html
336
337         * Modules/modern-media-controls/controls/inline-layout-support.js: Added.
338         (InlineLayoutSupport):
339         (InlineLayoutSupport.prototype.childrenAfterPerformingLayout):
340         * Modules/modern-media-controls/controls/ios-inline-media-controls.js:
341         (IOSInlineMediaControls.prototype.layout):
342         (IOSInlineMediaControls):
343         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
344         (MacOSInlineMediaControls.prototype.layout):
345         * Modules/modern-media-controls/js-files:
346
347 2017-02-27  Simon Fraser  <simon.fraser@apple.com>
348
349         Add specification and status metadata to CSSProperties.json, and validate it
350         https://bugs.webkit.org/show_bug.cgi?id=168901
351
352         Reviewed by Darin Adler.
353
354         Annotate CSS properties with data about the WebKit development status, and
355         where they are specified. A property has a canonical specification reference,
356         but individual values may have a reference to a more recent spec.
357
358         Add a list of specifications to the JSON that properties reference by key.
359
360         Enhance check-webkit-style to validate the status and spec data.
361
362         * css/CSSProperties.json:
363
364 2017-02-27  Jiewen Tan  <jiewen_tan@apple.com>
365
366         [CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential
367         https://bugs.webkit.org/show_bug.cgi?id=168616
368         <rdar://problem/30167149>
369
370         Reviewed by Daniel Bates.
371
372         This patch adds IDL definitions for:
373         1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential),
374         2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and
375         3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential).
376
377         Test: credentials/idlharness.html
378
379         * CMakeLists.txt:
380         * DerivedSources.make:
381         * Modules/credentials/BasicCredential.cpp: Added.
382         (WebCore::BasicCredential::BasicCredential):
383         (WebCore::BasicCredential::~BasicCredential):
384         (WebCore::BasicCredential::type):
385         * Modules/credentials/BasicCredential.h: Added.
386         (WebCore::BasicCredential::id):
387         * Modules/credentials/BasicCredential.idl: Added.
388         * Modules/credentials/CredentialData.h: Added.
389         * Modules/credentials/CredentialData.idl: Added.
390         * Modules/credentials/PasswordCredential.cpp: Added.
391         (WebCore::PasswordCredential::PasswordCredential):
392         (WebCore::PasswordCredential::PasswordCredential):
393         Dummy constructors for now.
394         * Modules/credentials/PasswordCredential.h: Added.
395         (WebCore::PasswordCredential::create):
396         (WebCore::PasswordCredential::create):
397         (WebCore::PasswordCredential::setIdName):
398         (WebCore::PasswordCredential::idName):
399         (WebCore::PasswordCredential::setPasswordName):
400         (WebCore::PasswordCredential::passwordName):
401         (WebCore::PasswordCredential::setAdditionalData):
402         (WebCore::PasswordCredential::additionalData):
403         * Modules/credentials/PasswordCredential.idl: Added.
404         * Modules/credentials/SiteBoundCredential.cpp: Added.
405         (WebCore::SiteBoundCredential::SiteBoundCredential):
406         (WebCore::SiteBoundCredential::~SiteBoundCredential):
407         * Modules/credentials/SiteBoundCredential.h: Added.
408         (WebCore::SiteBoundCredential::name):
409         (WebCore::SiteBoundCredential::iconURL):
410         (WebCore::SiteBoundCredential::setOrigin):
411         (WebCore::SiteBoundCredential::origin):
412         * Modules/credentials/SiteBoundCredential.idl: Added.
413         * Modules/credentials/SiteBoundCredentialData.h: Added.
414         * Modules/credentials/SiteBoundCredentialData.idl: Added.
415         * WebCore.xcodeproj/project.pbxproj:
416
417 2017-02-27  Jer Noble  <jer.noble@apple.com>
418
419         [WebRTC] Fix remote audio rendering
420         https://bugs.webkit.org/show_bug.cgi?id=168898
421
422         Reviewed by Eric Carlson.
423
424         Test: webrtc/audio-peer-connection-webaudio.html
425
426         Fix MediaStreamAudioSourceNode by not bailing out early if the input sample rate doesn't match
427         the AudioContext's sample rate; there's code in setFormat() to do the sample rate conversion
428         correctly.
429
430         * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
431         (WebCore::MediaStreamAudioSourceNode::setFormat):
432
433         Fix AudioSampleBufferList by making the AudioConverter input proc a free function, and passing
434         its refCon a struct containing only the information it needs to perform its task. Because the
435         conversion may result in a different number of output samples than input ones, just ask to
436         generate the entire capacity of the scratch buffer, and signal that the input buffer was fully
437         converted with a special return value.
438
439         * platform/audio/mac/AudioSampleBufferList.cpp:
440         (WebCore::audioConverterFromABLCallback):
441         (WebCore::AudioSampleBufferList::copyFrom):
442         (WebCore::AudioSampleBufferList::convertInput): Deleted.
443         (WebCore::AudioSampleBufferList::audioConverterCallback): Deleted.
444         * platform/audio/mac/AudioSampleBufferList.h:
445
446         Fix AudioSampleDataSource by updating both the sampleCount and the sampleTime after doing
447         a sample rate conversion to take into account that both the number of samples may have changed,
448         as well as the timeScale of the sampleTime. This may result in small off-by-one rounding errors
449         due to the sample rate conversion of sampleTime, so remember what the next expected sampleTime
450         should be, and correct sampleTime if it is indeed off-by-one. If the pull operation has gotten
451         ahead of the push operation, delay the next pull by the empty amount by rolling back the
452         m_outputSampleOffset. Introduce the same offset behavior during pull operations.
453
454         * platform/audio/mac/AudioSampleDataSource.h:
455         * platform/audio/mac/AudioSampleDataSource.mm:
456         (WebCore::AudioSampleDataSource::pushSamplesInternal):
457         (WebCore::AudioSampleDataSource::pullSamplesInternal):
458         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
459
460         Fix MediaPlayerPrivateMediaStreamAVFObjC by obeying the m_muted property.
461
462         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
463         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume):
464         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted):
465
466         Fix LibWebRTCAudioModule by sleeping for the correct amount after emitting frames. Previously,
467         LibWebRTCAudioModule would sleep for a fixed amount of time, which meant it would get slowly out
468         of sync when emitting frames took a non-zero amount of time. Now, the amount of time before the
469         next cycle starts is correctly calculated, and then LibWebRTCAudioModule sleeps for a dynamic amount
470         of time in order to wake up correctly at the beginning of the next cycle.
471
472         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
473         (WebCore::LibWebRTCAudioModule::StartPlayoutOnAudioThread):
474
475         Fix AudioTrackPrivateMediaStreamCocoa by just using the output unit's preferred format
476         description (with the current system sample rate), rather than whatever is the current
477         input description.
478
479         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
480         (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit):
481         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
482         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
483
484         Fix RealtimeIncomingAudioSource by actually creating an AudioSourceProvider when asked.
485
486         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
487         (WebCore::RealtimeIncomingAudioSource::OnData):
488         (WebCore::RealtimeIncomingAudioSource::audioSourceProvider):
489         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
490
491         Fix RealtimeOutgoingAudioSource by using the outgoing format description rather than the
492         incoming one to determine the sample rate, channel count, sample byte size, etc., to use
493         when delivering data upstream to libWebRTC.
494
495         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
496         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
497         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
498         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
499
500         Fix WebAudioSourceProviderAVFObjC by using a AudioSampleDataSource to do format and sample
501         rate conversion rather than trying to duplicate all that code and use a CARingBuffer and 
502         AudioConverter directly.
503
504         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
505         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
506         (WebCore::WebAudioSourceProviderAVFObjC::~WebAudioSourceProviderAVFObjC):
507         (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
508         (WebCore::WebAudioSourceProviderAVFObjC::prepare):
509         (WebCore::WebAudioSourceProviderAVFObjC::unprepare):
510         (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
511
512         Fix the MockLibWebRTCAudioTrack by passing along the AddSink() sink to its AudioSourceInterface,
513         allowing the RealtimeOutgoingAudioSource to push data into the libWebRTC network stack. Also,
514         make sure m_enabled is initialized to a good value.
515
516         * testing/MockLibWebRTCPeerConnection.h:
517
518 2017-02-21  Jer Noble  <jer.noble@apple.com>
519
520         AudioSampleDataSource should not exclusively lock its read and write threads.
521         https://bugs.webkit.org/show_bug.cgi?id=168646
522
523         Reviewed by Eric Carlson.
524
525         Locking the write thread causes the read thread to drop audio samples and generates audible
526         glitches, and the realtime audio thread backing the read thread should never block. There's
527         no real reason to lock these threads against one another here; they both rely on the
528         CARingBuffer to safely and simultaneously read and write data.
529
530         * platform/audio/mac/AudioSampleDataSource.cpp:
531         (WebCore::AudioSampleDataSource::setPaused):
532         (WebCore::AudioSampleDataSource::pushSamplesInternal):
533         (WebCore::AudioSampleDataSource::pushSamples):
534         (WebCore::AudioSampleDataSource::pullSamplesInternal):
535         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
536         (WebCore::AudioSampleDataSource::pullSamples):
537         * platform/audio/mac/AudioSampleDataSource.h:
538
539 2017-02-21  Jer Noble  <jer.noble@apple.com>
540
541         AudioTrackPrivateMediaStreamCocoa should not exclusively lock its read and write threads.
542         https://bugs.webkit.org/show_bug.cgi?id=168643
543
544         Reviewed by Eric Carlson.
545
546         Locking the write thread causes the read thread to drop audio samples and generates audible
547         glitches, and the realtime audio thread backing the read thread should never block. There's
548         no real reason to lock these threads against one another here; they both rely on the
549         AudioSampleDataSource and it's CARingBuffer to safely and simultaneously read and write
550         data.
551
552         The one piece which locks previously protected against unsafe access was during creation of
553         the audio unit.  Without a lock, the audio unit could begin playback after the unit was
554         created and assigned to m_remoteIOUnit but before the ring buffer was created. To protect
555         against this possibility, create the unit, set the input and output descriptions, but only
556         assign the new audio unit to m_remoteIOUnit after the ring buffer has been created and
557         initialized.
558
559         * platform/audio/mac/CAAudioStreamDescription.h:
560         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
561         (WebCore::AudioTrackPrivateMediaStreamCocoa::~AudioTrackPrivateMediaStreamCocoa):
562         (WebCore::AudioTrackPrivateMediaStreamCocoa::playInternal):
563         (WebCore::AudioTrackPrivateMediaStreamCocoa::play):
564         (WebCore::AudioTrackPrivateMediaStreamCocoa::pause):
565         (WebCore::AudioTrackPrivateMediaStreamCocoa::setVolume):
566         (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit):
567         (WebCore::AudioTrackPrivateMediaStreamCocoa::setupAudioUnit): Renamed to createAudioUnit()
568         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
569         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
570
571 2017-02-27  Youenn Fablet  <youenn@apple.com>
572
573         [WebRTC] RealtimOutgoingVideoSource should not need to do image conversion
574         https://bugs.webkit.org/show_bug.cgi?id=168802
575
576         Reviewed by Jon Lee.
577
578         Covered by manual testing as mock sources do not hit the same code path.
579
580         * platform/mediastream/mac/AVVideoCaptureSource.h:
581         * platform/mediastream/mac/AVVideoCaptureSource.mm:
582         (WebCore::AVVideoCaptureSource::currentFrameCGImage):
583         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
584         (WebCore::RealtimeOutgoingVideoSource::sendFrame):
585         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
586         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
587
588 2017-02-27  Carlos Garcia Campos  <cgarcia@igalia.com>
589
590         [GTK] Downloads attributes tests are failing
591         https://bugs.webkit.org/show_bug.cgi?id=168871
592
593         Reviewed by Michael Catanzaro.
594
595         Use libsoup to get the suggested filename from the Content-Disposition header instead of buggy
596         filenameFromHTTPContentDisposition().
597
598         Fixes: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html
599                fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html
600
601         * platform/network/soup/ResourceResponseSoup.cpp:
602         (WebCore::ResourceResponse::platformSuggestedFilename):
603
604 2017-02-27  Antoine Quint  <graouts@apple.com>
605
606         [Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls
607         https://bugs.webkit.org/show_bug.cgi?id=168820
608         <rdar://problem/30690281>
609
610         Reviewed by Jon Lee.
611
612         We broke this in https://bugs.webkit.org/show_bug.cgi?id=168755. We restore the check that the
613         event target when initiating a drag is the controls bar itself and not some of its content.
614
615         Since this wasn't caught by our existing tests, we add a test that attemps to initiate a drag
616         starting over one of the controls and notice that no dragging occurs.
617
618         We also fix an issue where we wouldn't update the layout of the left container as its icon
619         buttons would load, which would cause the layout width of the left container to be incorrect
620         and the related tests to time out.
621
622         Test: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html
623
624         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
625         (MacOSFullscreenMediaControls.prototype.layout):
626         (MacOSFullscreenMediaControls.prototype._handleMousedown):
627
628 2017-02-27  Alex Christensen  <achristensen@webkit.org>
629
630         [libwebrtc] Enable WebRTC in some Production Builds
631         https://bugs.webkit.org/show_bug.cgi?id=168858
632
633         * Configurations/FeatureDefines.xcconfig:
634
635 2017-02-27  Zan Dobersek  <zdobersek@igalia.com>
636
637         [TextureMapper] Clean up BitmapTextureGL construction
638         https://bugs.webkit.org/show_bug.cgi?id=168909
639
640         Reviewed by Carlos Garcia Campos.
641
642         Have the BitmapTextureGL constructor accept an rvalue reference pointer
643         to the GraphicsContext3D object. A static create() method is also added
644         to help with constructing these objects. Construction sites are updated
645         appropriately.
646
647         The BitmapTextureGL constructor is further cleaned up by moving default
648         member initializations together with the member declarations.
649
650         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
651         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
652         * platform/graphics/texmap/BitmapTextureGL.cpp:
653         (WebCore::BitmapTextureGL::BitmapTextureGL):
654         * platform/graphics/texmap/BitmapTextureGL.h:
655         * platform/graphics/texmap/BitmapTexturePool.cpp:
656         (WebCore::BitmapTexturePool::createTexture):
657         * platform/graphics/texmap/TextureMapperGL.cpp:
658         (WebCore::TextureMapperGL::createTexture):
659
660 2017-02-27  Zan Dobersek  <zdobersek@igalia.com>
661
662         [TextureMapper] Remove InterpolationQuality, TextDrawingModeFlags member variables
663         https://bugs.webkit.org/show_bug.cgi?id=168906
664
665         Reviewed by Carlos Garcia Campos.
666
667         Remove the InterpolationQuality and TextDrawingModeFlags member variables from the
668         TextureMapper class. These weren't modified anywhere in the code.
669
670         BitmapTexture::updateContents() still sets the image interpolation quality and
671         drawing mode on the ImageBuffer's GraphicsContext, but now uses the default
672         InterpolationDefault and TextModeFill values.
673
674         * platform/graphics/texmap/BitmapTexture.cpp:
675         (WebCore::BitmapTexture::updateContents):
676         * platform/graphics/texmap/TextureMapper.cpp:
677         (WebCore::TextureMapper::TextureMapper): Deleted.
678         (WebCore::TextureMapper::~TextureMapper): Deleted.
679         * platform/graphics/texmap/TextureMapper.h:
680         (WebCore::TextureMapper::setImageInterpolationQuality): Deleted.
681         (WebCore::TextureMapper::setTextDrawingMode): Deleted.
682         (WebCore::TextureMapper::imageInterpolationQuality): Deleted.
683         (WebCore::TextureMapper::textDrawingMode): Deleted.
684
685 2017-02-26  Zan Dobersek  <zdobersek@igalia.com>
686
687         [CoordinatedGraphics] Remove CoordinatedGraphicsScene::paintToGraphicsContext()
688         https://bugs.webkit.org/show_bug.cgi?id=168903
689
690         Reviewed by Carlos Garcia Campos.
691
692         Remove the GraphicsContext pointer member from the TextureMapper class
693         since the getter and setter methods are not used anywhere.
694
695         * platform/graphics/texmap/TextureMapper.cpp:
696         (WebCore::TextureMapper::TextureMapper):
697         * platform/graphics/texmap/TextureMapper.h:
698         (WebCore::TextureMapper::setGraphicsContext): Deleted.
699         (WebCore::TextureMapper::graphicsContext): Deleted.
700
701 2017-02-26  Myles C. Maxfield  <mmaxfield@apple.com>
702
703         Stop compiling our own cursorMovementIterator()
704         https://bugs.webkit.org/show_bug.cgi?id=168211
705
706         Reviewed by David Hyatt.
707
708         Covered by existing tests.
709
710         Hook up the caret iterator.
711
712         * platform/graphics/ComplexTextController.cpp:
713         (WebCore::ComplexTextController::offsetForPosition):
714         * rendering/RenderText.cpp:
715         (WebCore::RenderText::previousOffset):
716         (WebCore::RenderText::nextOffset):
717         * rendering/RenderText.h:
718
719 2017-02-26  Commit Queue  <commit-queue@webkit.org>
720
721         Unreviewed, rolling out r212942.
722         https://bugs.webkit.org/show_bug.cgi?id=168882
723
724         Made EWS very flaky (Requested by ap on #webkit).
725
726         Reverted changeset:
727
728         "[Modern Media Controls] Dragging controls in fullscreen on
729         macOS prevents scrubbing or interacting with controls"
730         https://bugs.webkit.org/show_bug.cgi?id=168820
731         http://trac.webkit.org/changeset/212942
732
733 2017-02-26  Chris Dumez  <cdumez@apple.com>
734
735         HitTestResult's linkSuggestedFilename should sanitize download attribute
736         https://bugs.webkit.org/show_bug.cgi?id=168856
737         <rdar://problem/30683109>
738
739         Reviewed by Antti Koivisto.
740
741         HitTestResult's linkSuggestedFilename should sanitize download attribute.
742         This is used by the context menu's "Download Linked File" & "Download Linked
743         File As..." actions.
744
745         * rendering/HitTestResult.cpp:
746         (WebCore::HitTestResult::linkSuggestedFilename):
747         * rendering/HitTestResult.h:
748
749 2017-02-25  Zalan Bujtas  <zalan@apple.com>
750
751         Simple line layout: Move coverage functions out of SimpleLineLayout.cpp
752         https://bugs.webkit.org/show_bug.cgi?id=168872
753         
754         Reviewed by Simon Fraser.
755
756         SimpleLineLayout.cpp is for core functions only.
757
758         No change in functionality.
759
760         * CMakeLists.txt:
761         * WebCore.xcodeproj/project.pbxproj:
762         * rendering/RenderingAllInOne.cpp:
763         * rendering/SimpleLineLayout.cpp:
764         (WebCore::SimpleLineLayout::canUseForWithReason):
765         (WebCore::SimpleLineLayout::printReason): Deleted.
766         (WebCore::SimpleLineLayout::printReasons): Deleted.
767         (WebCore::SimpleLineLayout::printTextForSubtree): Deleted.
768         (WebCore::SimpleLineLayout::textLengthForSubtree): Deleted.
769         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlows): Deleted.
770         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlowsForCurrentPage): Deleted.
771         (WebCore::SimpleLineLayout::toggleSimpleLineLayout): Deleted.
772         (WebCore::SimpleLineLayout::printSimpleLineLayoutBlockList): Deleted.
773         (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage): Deleted.
774         * rendering/SimpleLineLayout.h:
775         * rendering/SimpleLineLayoutCoverage.cpp: Added.
776         (WebCore::SimpleLineLayout::printReason):
777         (WebCore::SimpleLineLayout::printReasons):
778         (WebCore::SimpleLineLayout::printTextForSubtree):
779         (WebCore::SimpleLineLayout::textLengthForSubtree):
780         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlows):
781         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlowsForCurrentPage):
782         (WebCore::SimpleLineLayout::toggleSimpleLineLayout):
783         (WebCore::SimpleLineLayout::printSimpleLineLayoutBlockList):
784         (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage):
785         * rendering/SimpleLineLayoutCoverage.h: Added.
786
787 2017-02-25  Zalan Bujtas  <zalan@apple.com>
788
789         Text might wrap when its preferred logical width is used for sizing the containing block.
790         https://bugs.webkit.org/show_bug.cgi?id=168864
791         <rdar://problem/30690734>
792
793         Reviewed by Antti Koivisto.
794
795         In certain cases we end up measuring a text run in 2 different ways.
796         1. preferred width computation -> slow path FontCascade::width() 
797         2. line breaking logic -> fast path FontCascade::widthForSimpleText()
798  
799         FontCascade::width() and ::widthForSimpleText() might return different results for the same run even when
800         the individual glyph widths are measured to be the same. It's because they run diffrent set of
801         arithmetics on the float values and for certain values these arithmetics produce different results due to the floating point
802         precision.
803         Since RenderText::computePreferredLogicalWidths() currently forces us to use the slow path
804         (to retrieve fontfallback and glyph overflow information) the only alternative solution is to turn off the fast path
805         for all runs that have been already measured using the slow path (which would be just wasteful).
806
807         Test: fast/text/fast-run-width-vs-slow-run-width.html
808
809         * platform/graphics/FontCascade.cpp:
810         (WebCore::FontCascade::widthForSimpleText): Mimics WidthIterator::applyFontTransforms. Use the same set of arithmetics here.  
811
812 2017-02-24  Simon Fraser  <simon.fraser@apple.com>
813
814         Improve how multiple codegen-properties are handled in CSSProperties.json
815         https://bugs.webkit.org/show_bug.cgi?id=168867
816
817         Reviewed by Zalan Bujtas.
818
819         To make upcoming metadata storage easier, it's better if property entries in CSSProperties.json
820         are always hashes. One property (line-height) used an array, in order to represent settings for
821         two different build flags (ENABLE_TEXT_AUTOSIZING and !ENABLE_TEXT_AUTOSIZING).
822
823         Fix by making "codegen-properties" optionally be an array. The relevant item is selected in
824         removeInactiveCodegenProperties() and used to replace the array.
825
826         Sort @internalProprerties when generating code, otherwise the contents of isInternalCSSProperty()
827         are unstable (the order in @allNames is not stable because it's the keys in a hash).
828
829         * css/CSSProperties.json:
830         * css/makeprop.pl:
831         (matchEnableFlags):
832         (removeInactiveCodegenProperties):
833         (isPropertyEnabled):
834
835 2017-02-24  Joseph Pecoraro  <pecoraro@apple.com>
836
837         [Resource Timing] Media elements initiated loads should set the initiatorType to their element name (video/audio)
838         https://bugs.webkit.org/show_bug.cgi?id=168680
839
840         Reviewed by Youenn Fablet.
841
842         * html/HTMLMediaElement.cpp:
843         (WebCore::HTMLMediaElement::mediaPlayerCreateResourceLoader):
844         Pass in the element so it may be used as the initiator.
845
846         * html/HTMLVideoElement.h:
847         Export create() for TestWebKitAPI to use.
848
849         * loader/MediaResourceLoader.cpp:
850         (WebCore::MediaResourceLoader::MediaResourceLoader):
851         (WebCore::MediaResourceLoader::contextDestroyed):
852         (WebCore::MediaResourceLoader::requestResource):
853         * loader/MediaResourceLoader.h:
854         Include the HTMLMediaElement as the initiator.
855
856 2017-02-24  Joseph Pecoraro  <pecoraro@apple.com>
857
858         [Resource Timing] Gather timing information with reliable responseEnd time
859         https://bugs.webkit.org/show_bug.cgi?id=168351
860
861         Reviewed by Alex Christensen.
862
863         This patch replaces the unused `double finishTime` in ResourceLoader's
864         didFinishLoad with a complete WebCore::NetworkLoadMetrics object. This
865         allows the NetworkProcess to give complete timing information, and more
866         final metrics about the load, to WebCore. Currently this is only used
867         by ResourceTiming, but it will soon be used by Web Inspector as well.
868         We may also end up extending this to the didFail path as well, since it
869         is possible that we have some metrics for load failures.
870
871         At the same time we want to start moving away from the legacy path that
872         populated a subset of this information in ResourceResponse's NetworkLoadMetrics.
873         It doesn't make sense to store this information on the ResourceResponse
874         for a few reasons: We don't want to store the metrics in our Network Cache and
875         not all of the load timing metrics have been populated yet (responseEnd).
876         In an effort to move off of this data we've renamed the accessor to
877         "deprecatedNetworkLoadMetrics". There are a few remaining clients
878         (ResourceHandle, PerformanceTiming, InspectorNetworkAgent) which can be
879         migrated separately from this patch.
880
881         Having both the legacy and new code paths adds a little bit of complexity.
882         One advantage of the new path is that the complete load timing data
883         (fetchStart -> dns -> connect -> request -> response -> responseEnd) can
884         be packaged together. The legacy path could not include a responseEnd, so
885         WebCore faked that value with its own timestamp. Having the fake responseEnd
886         caused issues as timestamps / clocks are different between processes. In order
887         for PerformanceResponseTiming to know whether or not the NetworkLoadMetrics
888         has the complete network timing metrics it checks isComplete(). If true
889         it knows it can use the responseEnd time from NetworkLoadMetrics, otherwise
890         it must fallback to the legacy value from LoadTiming. Once all of the
891         deprecatedNetworkLoadMetrics clients go away, we should always have the
892         complete data and this can be eliminated.
893
894         Tests: imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.html
895                imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.html
896
897         * PlatformMac.cmake:
898         * WebCore.xcodeproj/project.pbxproj:
899         Rename NetworkLoadTiming -> NetworkLoadMetrics.
900
901         * page/PerformanceResourceTiming.cpp:
902         (WebCore::entryStartTime):
903         (WebCore::entryEndTime):
904         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
905         (WebCore::PerformanceResourceTiming::nextHopProtocol):
906         (WebCore::PerformanceResourceTiming::domainLookupStart):
907         (WebCore::PerformanceResourceTiming::domainLookupEnd):
908         (WebCore::PerformanceResourceTiming::connectStart):
909         (WebCore::PerformanceResourceTiming::connectEnd):
910         (WebCore::PerformanceResourceTiming::secureConnectionStart):
911         (WebCore::PerformanceResourceTiming::requestStart):
912         (WebCore::PerformanceResourceTiming::responseStart):
913         (WebCore::PerformanceResourceTiming::responseEnd):
914         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
915         * page/PerformanceResourceTiming.h:
916         Mostly just updating names and types. This does however need to get the
917         correct endTime based on whether the NetworkLoadMetrics are complete
918         (meaning includes responseEnd) or not (legacy, use LoadTiming value).
919
920         * page/PerformanceResourceTiming.idl:
921         Add nextHopProtocol.
922
923         * page/PerformanceTiming.cpp:
924         (WebCore::PerformanceTiming::domainLookupStart):
925         (WebCore::PerformanceTiming::domainLookupEnd):
926         (WebCore::PerformanceTiming::connectStart):
927         (WebCore::PerformanceTiming::connectEnd):
928         (WebCore::PerformanceTiming::secureConnectionStart):
929         (WebCore::PerformanceTiming::requestStart):
930         (WebCore::PerformanceTiming::responseStart):
931         (WebCore::PerformanceTiming::resourceLoadTimeRelativeToFetchStart):
932         * page/PerformanceTiming.h:
933         Navigation Timing values still uses the NetworkLoadTiming values stored on
934         the DocumentLoader. This should be moved off of the deprecated path separately.
935
936         * platform/network/NetworkLoadMetrics.h: Renamed from Source/WebCore/platform/network/NetworkLoadTiming.h.
937         (WebCore::NetworkLoadMetrics::NetworkLoadMetrics):
938         (WebCore::NetworkLoadMetrics::isolatedCopy):
939         (WebCore::NetworkLoadMetrics::reset):
940         (WebCore::NetworkLoadMetrics::operator==):
941         (WebCore::NetworkLoadMetrics::operator!=):
942         (WebCore::NetworkLoadMetrics::isComplete):
943         (WebCore::NetworkLoadMetrics::markComplete):
944         (WebCore::NetworkLoadMetrics::encode):
945         (WebCore::NetworkLoadMetrics::decode):
946         Re-introduce a reset() method (for NetworkLoadSoup to reset between redirects).
947         Add protocolName and "complete" boolean.
948
949         * platform/network/cocoa/NetworkLoadMetrics.mm: Renamed from Source/WebCore/platform/network/cocoa/NetworkLoadTiming.mm.
950         (WebCore::timingValue):
951         (WebCore::copyTimingData):
952         (WebCore::setCollectsTimingData):
953         Use this opportunity to convert NetworkLoadTiming timestamps to WTF::Seconds.
954         Since we already have to modify all the clients this moves us to use the more
955         strongly typed units that are less ambiguous then "double". The rest of the
956         Performance API has already moved to these units.
957
958         * inspector/InspectorNetworkAgent.cpp:
959         (WebCore::InspectorNetworkAgent::buildObjectForTiming):
960         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
961         (WebCore::InspectorNetworkAgent::didFinishLoading):
962         * inspector/InspectorNetworkAgent.h:
963         Inspector was the only client of the finishTime, and since the value was
964         erratically coming from clients in different ways it was almost certainly
965         inaccurate. Simplify this in preparation for using NetworkLoadMetrics.
966
967         * Modules/fetch/FetchLoader.cpp:
968         (WebCore::FetchLoader::didFinishLoading):
969         * Modules/fetch/FetchLoader.h:
970         * fileapi/FileReaderLoader.cpp:
971         (WebCore::FileReaderLoader::didFinishLoading):
972         * fileapi/FileReaderLoader.h:
973         * html/MediaFragmentURIParser.cpp:
974         (WebCore::MediaFragmentURIParser::parseNPTTime):
975         * inspector/InspectorInstrumentation.cpp:
976         (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
977         * inspector/InspectorInstrumentation.h:
978         (WebCore::InspectorInstrumentation::didFinishLoading):
979         * loader/CrossOriginPreflightChecker.cpp:
980         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
981         * loader/DocumentLoader.cpp:
982         (WebCore::DocumentLoader::notifyFinished):
983         (WebCore::DocumentLoader::finishedLoading):
984         (WebCore::DocumentLoader::continueAfterContentPolicy):
985         (WebCore::DocumentLoader::maybeLoadEmpty):
986         * loader/DocumentLoader.h:
987         * loader/DocumentThreadableLoader.cpp:
988         (WebCore::DocumentThreadableLoader::didReceiveResponse):
989         (WebCore::DocumentThreadableLoader::notifyFinished):
990         (WebCore::DocumentThreadableLoader::didFinishLoading):
991         (WebCore::DocumentThreadableLoader::loadRequest):
992         * loader/DocumentThreadableLoader.h:
993         * loader/NetscapePlugInStreamLoader.cpp:
994         (WebCore::NetscapePlugInStreamLoader::didFinishLoading):
995         * loader/NetscapePlugInStreamLoader.h:
996         * loader/ResourceLoadNotifier.cpp:
997         (WebCore::ResourceLoadNotifier::didFinishLoad):
998         (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
999         (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
1000         * loader/ResourceLoadNotifier.h:
1001         * loader/ResourceLoader.cpp:
1002         (WebCore::ResourceLoader::deliverResponseAndData):
1003         (WebCore::ResourceLoader::loadDataURL):
1004         (WebCore::ResourceLoader::didFinishLoading):
1005         (WebCore::ResourceLoader::didFinishLoadingOnePart):
1006         * loader/ResourceLoader.h:
1007         * loader/ResourceTiming.cpp:
1008         (WebCore::ResourceTiming::fromLoad):
1009         (WebCore::ResourceTiming::fromSynchronousLoad):
1010         (WebCore::ResourceTiming::ResourceTiming):
1011         (WebCore::ResourceTiming::isolatedCopy):
1012         * loader/ResourceTiming.h:
1013         (WebCore::ResourceTiming::networkLoadMetrics):
1014         (WebCore::ResourceTiming::ResourceTiming):
1015         (WebCore::ResourceTiming::networkLoadTiming): Deleted.
1016         * loader/SubresourceLoader.cpp:
1017         (WebCore::SubresourceLoader::SubresourceLoader):
1018         (WebCore::SubresourceLoader::willSendRequestInternal):
1019         (WebCore::SubresourceLoader::didReceiveResponse):
1020         (WebCore::SubresourceLoader::didFinishLoading):
1021         (WebCore::SubresourceLoader::reportResourceTiming):
1022         * loader/SubresourceLoader.h:
1023         * loader/ThreadableLoaderClient.h:
1024         (WebCore::ThreadableLoaderClient::didFinishLoading):
1025         * loader/ThreadableLoaderClientWrapper.h:
1026         (WebCore::ThreadableLoaderClientWrapper::didFinishLoading):
1027         * loader/WorkerThreadableLoader.cpp:
1028         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
1029         * loader/WorkerThreadableLoader.h:
1030         * loader/appcache/ApplicationCacheGroup.cpp:
1031         (WebCore::ApplicationCacheGroup::didFinishLoading):
1032         * loader/appcache/ApplicationCacheGroup.h:
1033         * loader/cache/CachedResource.h:
1034         (WebCore::CachedResource::setLoadFinishTime):
1035         * loader/ios/QuickLook.mm:
1036         (-[WebPreviewLoader connectionDidFinishLoading:]):
1037         * page/EventSource.cpp:
1038         (WebCore::EventSource::didFinishLoading):
1039         * page/EventSource.h:
1040         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1041         (ResourceHandleStreamingClient::didFinishLoading):
1042         * platform/network/BlobResourceHandle.cpp:
1043         (WebCore::doNotifyFinish):
1044         * platform/network/PingHandle.h:
1045         * platform/network/ResourceHandle.h:
1046         * platform/network/ResourceHandleClient.h:
1047         (WebCore::ResourceHandleClient::didFinishLoading):
1048         * platform/network/ResourceResponseBase.cpp:
1049         (WebCore::ResourceResponseBase::crossThreadData):
1050         (WebCore::ResourceResponseBase::fromCrossThreadData):
1051         (WebCore::ResourceResponseBase::compare):
1052         * platform/network/ResourceResponseBase.h:
1053         (WebCore::ResourceResponseBase::deprecatedNetworkLoadMetrics):
1054         (WebCore::ResourceResponseBase::encode):
1055         (WebCore::ResourceResponseBase::decode):
1056         (WebCore::ResourceResponseBase::networkLoadTiming): Deleted.
1057         * platform/network/SynchronousLoaderClient.cpp:
1058         (WebCore::SynchronousLoaderClient::didFinishLoading):
1059         * platform/network/SynchronousLoaderClient.h:
1060         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1061         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
1062         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
1063         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
1064         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
1065         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading):
1066         * platform/network/curl/ResourceHandleCurl.cpp:
1067         (WebCore::WebCoreSynchronousLoader::didFinishLoading):
1068         * platform/network/curl/ResourceHandleManager.cpp:
1069         (WebCore::calculateWebTimingInformations):
1070         (WebCore::ResourceHandleManager::downloadTimerCallback):
1071         (WebCore::handleDataURL):
1072         (WebCore::milisecondsSinceRequest): Deleted.
1073         * platform/network/mac/ResourceHandleMac.mm:
1074         (WebCore::ResourceHandle::getConnectionTimingData):
1075         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
1076         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
1077         (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]):
1078         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1079         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1080         (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
1081         * platform/network/soup/ResourceHandleSoup.cpp:
1082         (WebCore::restartedCallback):
1083         (WebCore::nextMultipartResponsePartCallback):
1084         (WebCore::sendRequestCallback):
1085         (WebCore::ResourceHandle::didStartRequest):
1086         (WebCore::networkEventCallback):
1087         (WebCore::ResourceHandle::sendPendingRequest):
1088         (WebCore::readCallback):
1089         (WebCore::milisecondsSinceRequest): Deleted.
1090         * workers/WorkerScriptLoader.cpp:
1091         (WebCore::WorkerScriptLoader::didFinishLoading):
1092         * workers/WorkerScriptLoader.h:
1093         * xml/XMLHttpRequest.cpp:
1094         (WebCore::XMLHttpRequest::didFinishLoading):
1095         * xml/XMLHttpRequest.h:
1096         Eliminate the unused finishTime double.
1097
1098 2017-02-24  Chris Dumez  <cdumez@apple.com>
1099
1100         Unreviewed GTK build fix after r212965
1101
1102         * CMakeLists.txt:
1103
1104 2017-02-24  Chris Dumez  <cdumez@apple.com>
1105
1106         Unreviewed, rolling out r212944.
1107
1108         Caused a lot of failures on the debug bots
1109
1110         Reverted changeset:
1111
1112         "[Resource Timing] Gather timing information with reliable
1113         responseEnd time"
1114         https://bugs.webkit.org/show_bug.cgi?id=168351
1115         http://trac.webkit.org/changeset/212944
1116
1117 2017-02-24  Chris Dumez  <cdumez@apple.com>
1118
1119         Unreviewed, follow-up fix after r212972.
1120
1121         Fixes a few assertions on the debug build bots.
1122         URL needs to be exactly the same as the parsed one given
1123         that we are calling the ParsedURLString constructor.
1124
1125         * platform/network/ResourceResponseBase.cpp:
1126         (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
1127
1128 2017-02-24  Zalan Bujtas  <zalan@apple.com>
1129
1130         Simple line layout: Re-adjust paginated lines when block height changes.
1131         https://bugs.webkit.org/show_bug.cgi?id=168838
1132         <rdar://problem/30701233>
1133
1134         Reviewed by Antti Koivisto.
1135
1136         When the estimated block height is wrong, we issue an additional layout on the inline children
1137         so that we get the pagination right (this layout is setChildNeedsLayout(MarkOnlyThis) only).
1138         Since the height change only affects the struts and page breaks (and again, the relayoutChildren flag is false)
1139         we don't need to re-layout the content, but instead we just need to re-adjust the pagination for the simple lines. 
1140         This patch also moves the pagination logic to SimpleLineLayoutPagination.cpp.
1141
1142         Not enabled yet.
1143
1144         * CMakeLists.txt:
1145         * WebCore.xcodeproj/project.pbxproj:
1146         * rendering/RenderBlockFlow.cpp:
1147         (WebCore::RenderBlockFlow::layoutSimpleLines):
1148         * rendering/RenderingAllInOne.cpp:
1149         * rendering/SimpleLineLayout.cpp:
1150         (WebCore::SimpleLineLayout::canUseForWithReason):
1151         (WebCore::SimpleLineLayout::create):
1152         (WebCore::SimpleLineLayout::Layout::create):
1153         (WebCore::SimpleLineLayout::Layout::Layout):
1154         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow): Deleted.
1155         (WebCore::SimpleLineLayout::computeLineBreakIndex): Deleted.
1156         (WebCore::SimpleLineLayout::computeOffsetAfterLineBreak): Deleted.
1157         (WebCore::SimpleLineLayout::setPageBreakForLine): Deleted.
1158         (WebCore::SimpleLineLayout::updateMinimumPageHeight): Deleted.
1159         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination): Deleted.
1160         * rendering/SimpleLineLayout.h:
1161         (WebCore::SimpleLineLayout::Layout::setIsPaginated):
1162         (WebCore::SimpleLineLayout::Layout::setLineStruts):
1163         * rendering/SimpleLineLayoutPagination.cpp: Added.
1164         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow):
1165         (WebCore::SimpleLineLayout::computeLineBreakIndex):
1166         (WebCore::SimpleLineLayout::computeOffsetAfterLineBreak):
1167         (WebCore::SimpleLineLayout::setPageBreakForLine):
1168         (WebCore::SimpleLineLayout::updateMinimumPageHeight):
1169         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
1170         * rendering/SimpleLineLayoutPagination.h: Added.
1171
1172 2017-02-24  Jon Lee  <jonlee@apple.com>
1173
1174         Alias "system-ui" for the System font name
1175         https://bugs.webkit.org/show_bug.cgi?id=151493
1176
1177         Reviewed by Tim Horton and Joseph Pecoraro.
1178
1179         Updated existing tests.
1180
1181         * WebCore.xcodeproj/project.pbxproj: Add WebKitFontFamilyNames.in for
1182         convenience.
1183         * css/CSSValueKeywords.in: Add system-ui as a keyword.
1184         * css/WebKitFontFamilyNames.in: Add system-ui.
1185
1186         * platform/graphics/ios/FontCacheIOS.mm:
1187         (WebCore::platformFontWithFamilySpecialCase): Include "system-ui" as an
1188         alias.
1189         * platform/graphics/mac/FontCacheMac.mm:
1190         (WebCore::platformFontWithFamilySpecialCase): Ditto.
1191
1192         * rendering/RenderThemeMac.mm:
1193         (WebCore::RenderThemeMac::updateCachedSystemFontDescription): Update
1194         serialization to "system-ui" from "-apple-system".
1195
1196         * css/CSSComputedStyleDeclaration.cpp:
1197         (WebCore::identifierForFamily):
1198         * css/CSSFontFaceSet.cpp:
1199         (WebCore::CSSFontFaceSet::familyNameFromPrimitive):
1200         * css/StyleBuilderCustom.h:
1201         (WebCore::StyleBuilderCustom::applyValueFontFamily):
1202
1203 2017-02-24  Matt Rajca  <mrajca@apple.com>
1204
1205         Media: notify clients when autoplay is denied
1206         https://bugs.webkit.org/show_bug.cgi?id=168840
1207
1208         Reviewed by Alex Christensen.
1209
1210         Added API tests.
1211
1212         * WebCore.xcodeproj/project.pbxproj:
1213         * html/HTMLMediaElement.cpp:
1214         (WebCore::HTMLMediaElement::setReadyState):
1215         (WebCore::HTMLMediaElement::play):
1216         (WebCore::HTMLMediaElement::playInternal):
1217         * page/AutoplayEvent.h: Added.
1218         * page/ChromeClient.h:
1219
1220 2017-02-24  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>
1221
1222         curl: Improve errors by including the domain
1223         https://bugs.webkit.org/show_bug.cgi?id=134340
1224
1225         Reviewed by Alex Christensen.
1226
1227         Added proper error domain to ResourceError created by
1228         Curl problem.
1229
1230         * platform/network/curl/ResourceHandleManager.cpp:
1231         (WebCore::ResourceHandleManager::downloadTimerCallback):
1232         (WebCore::ResourceHandleManager::dispatchSynchronousJob):
1233
1234 2017-02-24  Antoine Quint  <graouts@apple.com>
1235
1236         [Modern Media Controls] <audio> controls should center in their container when the page is scaled
1237         https://bugs.webkit.org/show_bug.cgi?id=168841
1238         <rdar://problem/28612794>
1239
1240         Reviewed by Eric Carlson.
1241
1242         When dealing with <audio> elements, we vertically center the controls relative to their containing
1243         media element such that if the controls visually overflow, they overflow equally above and below
1244         to minimize the likelihood of overlap with surrounding elements.
1245
1246         Test: media/modern-media-controls/media-controller/media-controller-scale-factor-audio.html
1247
1248         * Modules/modern-media-controls/controls/media-controls.js:
1249         (MediaControls.prototype.get shouldCenterControlsVertically):
1250         (MediaControls.prototype.set shouldCenterControlsVertically):
1251         (MediaControls.prototype.commitProperty):
1252         * Modules/modern-media-controls/media/media-controller.js:
1253         (MediaController.prototype.get isAudio):
1254         (MediaController.prototype.get layoutTraits):
1255         (MediaController.prototype._updateControlsSize):
1256
1257 2017-02-24  Alex Christensen  <achristensen@webkit.org>
1258
1259         Non-special relative URLs should not ignore extra slashes
1260         https://bugs.webkit.org/show_bug.cgi?id=168834
1261
1262         Reviewed by Sam Weinig.
1263
1264         Special authority ignore slashes state should, as its name implies,
1265         only be reached by special URLs.  See https://url.spec.whatwg.org/#relative-slash-state
1266
1267         Covered by newly passing web platform tests.
1268
1269         * platform/URLParser.cpp:
1270         (WebCore::URLParser::parse):
1271
1272 2017-02-24  Alexey Proskuryakov  <ap@apple.com>
1273
1274         Build fix for newer clang
1275         https://bugs.webkit.org/show_bug.cgi?id=168849
1276         rdar://problem/30638741
1277
1278         Reviewed by Ryosuke Niwa.
1279
1280         * dom/Range.cpp: (WebCore::Range::toString): std::max(0, <unsigned>) is not meaningful,
1281         and now triggers a warning.
1282
1283 2017-02-24  Chris Dumez  <cdumez@apple.com>
1284
1285         Download attribute should be sanitized before being used as suggested filename
1286         https://bugs.webkit.org/show_bug.cgi?id=168839
1287         <rdar://problem/30683109>
1288
1289         Reviewed by Darin Adler.
1290
1291         Sanitize Download attribute before using it as a suggested filename for the download.
1292         We rely on ResourceResponse's sanitizing of the suggested filename to do so, which has
1293         the benefit of being consistent with downloads without the download attribute.
1294
1295         Tests: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html
1296                fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html
1297                fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html
1298
1299         * html/HTMLAnchorElement.cpp:
1300         (WebCore::HTMLAnchorElement::handleClick):
1301         * platform/network/ResourceResponseBase.cpp:
1302         (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
1303         * platform/network/ResourceResponseBase.h:
1304
1305 2017-02-24  Miguel Gomez  <magomez@igalia.com>
1306
1307         [GTK] WebkitWebProcess crashes on exit on nvidia if threaded compositing is enabled
1308         https://bugs.webkit.org/show_bug.cgi?id=165522
1309
1310         Reviewed by Carlos Garcia Campos.
1311
1312         Before destrying a GLContextGLX we need to set the default framebufer to avoid a bug
1313         in some nvidia drivers. Ensure that we set the context as current before performing
1314         that operation, and set the appropriate current context after doing so.
1315
1316         No new tests.
1317
1318         * platform/graphics/glx/GLContextGLX.cpp:
1319         (WebCore::GLContextGLX::~GLContextGLX):
1320
1321 2017-02-24  Chris Dumez  <cdumez@apple.com>
1322
1323         [iOS][WK2] Disable network cache speculative revalidation / loading in low power mode
1324         https://bugs.webkit.org/show_bug.cgi?id=168832
1325         <rdar://problem/30697911>
1326
1327         Reviewed by Antti Koivisto.
1328
1329         Add LowPowerModeNotifier class to monitor low power mode state on iOS.
1330
1331         * WebCore.xcodeproj/project.pbxproj:
1332         * platform/LowPowerModeNotifier.cpp: Added.
1333         (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
1334         (WebCore::LowPowerModeNotifier::isLowPowerModeEnabled):
1335         * platform/LowPowerModeNotifier.h: Added.
1336         * platform/ios/LowPowerModeNotifierIOS.mm: Added.
1337         (-[WebLowPowerModeObserver initWithNotifier:]):
1338         (-[WebLowPowerModeObserver dealloc]):
1339         (-[WebLowPowerModeObserver _didReceiveLowPowerModeChange]):
1340         (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
1341         (WebCore::LowPowerModeNotifier::isLowPowerModeEnabled):
1342         (WebCore::LowPowerModeNotifier::notifyLowPowerModeChanged):
1343         (WebCore::notifyLowPowerModeChanged):
1344
1345 2017-02-24  Chris Dumez  <cdumez@apple.com>
1346
1347         [Mac] Report domains using abnormally high memory usage via enhanced privacy logging
1348         https://bugs.webkit.org/show_bug.cgi?id=168797
1349         <rdar://problem/29964017>
1350
1351         Reviewed by Andreas Kling.
1352
1353         Report domains using abnormally high memory usage (> 2GB) via enhanced privacy
1354         logging on Mac.
1355
1356         * page/DiagnosticLoggingKeys.cpp:
1357         (WebCore::DiagnosticLoggingKeys::domainCausingJetsamKey):
1358         * page/DiagnosticLoggingKeys.h:
1359         * page/PerformanceMonitor.cpp:
1360         (WebCore::reportPageOverPostLoadResourceThreshold):
1361         (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
1362         (WebCore::PerformanceMonitor::measurePostLoadMemoryUsage):
1363         (WebCore::reportPageOverPostLoadCPUUsageThreshold): Deleted.
1364
1365 2017-02-24  Alex Christensen  <achristensen@webkit.org>
1366
1367         .. should not remove windows drive letters in paths of file URLs
1368         https://bugs.webkit.org/show_bug.cgi?id=168824
1369
1370         Reviewed by Youenn Fablet.
1371
1372         It's specified in https://url.spec.whatwg.org/#shorten-a-urls-path and helps behavior for browsers on Windows.
1373         It can't hurt to pass a few more web platform tests, though.
1374
1375         * platform/URLParser.cpp:
1376         (WebCore::URLParser::copyURLPartsUntil):
1377         (WebCore::URLParser::shouldPopPath):
1378         (WebCore::URLParser::popPath):
1379         (WebCore::URLParser::parse):
1380         * platform/URLParser.h:
1381
1382 2017-02-24  Csaba Osztrogon√°c  <ossy@webkit.org>
1383
1384         [Mac][cmake] Unreviewed buildfix after r212736.
1385
1386         * PlatformMac.cmake:
1387
1388 2017-02-24  John Wilander  <wilander@apple.com>
1389
1390         Resource Load Statistics: Add alternate classification method
1391         https://bugs.webkit.org/show_bug.cgi?id=168347
1392         <rdar://problem/30352793>
1393         <rdar://problem/30646710>
1394         <rdar://problem/30660708>
1395
1396         Reviewed by Alex Christensen.
1397
1398         This patch only adds test infrastructure in WebCore.
1399
1400         Tests: http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html
1401                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html
1402                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html
1403                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html
1404                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html
1405                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html
1406                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html
1407                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html
1408
1409         * loader/ResourceLoadObserver.cpp:
1410         (WebCore::ResourceLoadObserver::setSubframeUnderTopFrameOrigin):
1411         (WebCore::ResourceLoadObserver::setSubresourceUnderTopFrameOrigin):
1412         (WebCore::ResourceLoadObserver::setSubresourceUniqueRedirectTo):
1413         * loader/ResourceLoadObserver.h:
1414
1415 2017-02-23  Antoine Quint  <graouts@apple.com>
1416
1417         [Modern Media Controls] No controls are shown for <audio preload="none">
1418         https://bugs.webkit.org/show_bug.cgi?id=168800
1419         <rdar://problem/30652142>
1420
1421         Reviewed by Eric Carlson.
1422
1423         A media element's currentSrc property will only be set when data has started
1424         to load. In the case where preload="none" is used, regardless of whether a
1425         source is specified, currentSrc would be the empty string and we wouldn't
1426         show controls at all. Identifying whether a source is specified is a little
1427         tricky because it could be specified in a variety of ways and dynamically
1428         as well.
1429
1430         So instead we optimistically show controls always provided the "controls"
1431         attribute is set.
1432
1433         * Modules/modern-media-controls/media/controls-visibility-support.js:
1434         (ControlsVisibilitySupport.prototype._updateControls):
1435         (ControlsVisibilitySupport):
1436         * Modules/modern-media-controls/media/start-support.js:
1437         (StartSupport.prototype._shouldShowStartButton):
1438         (StartSupport):
1439
1440 2017-02-23  Joseph Pecoraro  <pecoraro@apple.com>
1441
1442         [Resource Timing] Gather timing information with reliable responseEnd time
1443         https://bugs.webkit.org/show_bug.cgi?id=168351
1444
1445         Reviewed by Alex Christensen.
1446
1447         This patch replaces the unused `double finishTime` in ResourceLoader's
1448         didFinishLoad with a complete WebCore::NetworkLoadMetrics object. This
1449         allows the NetworkProcess to give complete timing information, and more
1450         final metrics about the load, to WebCore. Currently this is only used
1451         by ResourceTiming, but it will soon be used by Web Inspector as well.
1452         We may also end up extending this to the didFail path as well, since it
1453         is possible that we have some metrics for load failures.
1454
1455         At the same time we want to start moving away from the legacy path that
1456         populated a subset of this information in ResourceResponse's NetworkLoadMetrics.
1457         It doesn't make sense to store this information on the ResourceResponse
1458         for a few reasons: We don't want to store the metrics in our Network Cache and
1459         not all of the load timing metrics have been populated yet (responseEnd).
1460         In an effort to move off of this data we've renamed the accessor to
1461         "deprecatedNetworkLoadMetrics". There are a few remaining clients
1462         (ResourceHandle, PerformanceTiming, InspectorNetworkAgent) which can be
1463         migrated separately from this patch.
1464
1465         Having both the legacy and new code paths adds a little bit of complexity.
1466         One advantage of the new path is that the complete load timing data
1467         (fetchStart -> dns -> connect -> request -> response -> responseEnd) can
1468         be packaged together. The legacy path could not include a responseEnd, so
1469         WebCore faked that value with its own timestamp. Having the fake responseEnd
1470         caused issues as timestamps / clocks are different between processes. In order
1471         for PerformanceResponseTiming to know whether or not the NetworkLoadMetrics
1472         has the complete network timing metrics it checks isComplete(). If true
1473         it knows it can use the responseEnd time from NetworkLoadMetrics, otherwise
1474         it must fallback to the legacy value from LoadTiming. Once all of the
1475         deprecatedNetworkLoadMetrics clients go away, we should always have the
1476         complete data and this can be eliminated.
1477
1478         Tests: imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.html
1479                imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.html
1480
1481         * PlatformMac.cmake:
1482         * WebCore.xcodeproj/project.pbxproj:
1483         Rename NetworkLoadTiming -> NetworkLoadMetrics.
1484
1485         * page/PerformanceResourceTiming.cpp:
1486         (WebCore::entryStartTime):
1487         (WebCore::entryEndTime):
1488         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
1489         (WebCore::PerformanceResourceTiming::nextHopProtocol):
1490         (WebCore::PerformanceResourceTiming::domainLookupStart):
1491         (WebCore::PerformanceResourceTiming::domainLookupEnd):
1492         (WebCore::PerformanceResourceTiming::connectStart):
1493         (WebCore::PerformanceResourceTiming::connectEnd):
1494         (WebCore::PerformanceResourceTiming::secureConnectionStart):
1495         (WebCore::PerformanceResourceTiming::requestStart):
1496         (WebCore::PerformanceResourceTiming::responseStart):
1497         (WebCore::PerformanceResourceTiming::responseEnd):
1498         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
1499         * page/PerformanceResourceTiming.h:
1500         Mostly just updating names and types. This does however need to get the
1501         correct endTime based on whether the NetworkLoadMetrics are complete
1502         (meaning includes responseEnd) or not (legacy, use LoadTiming value).
1503
1504         * page/PerformanceResourceTiming.idl:
1505         Add nextHopProtocol.
1506
1507         * page/PerformanceTiming.cpp:
1508         (WebCore::PerformanceTiming::domainLookupStart):
1509         (WebCore::PerformanceTiming::domainLookupEnd):
1510         (WebCore::PerformanceTiming::connectStart):
1511         (WebCore::PerformanceTiming::connectEnd):
1512         (WebCore::PerformanceTiming::secureConnectionStart):
1513         (WebCore::PerformanceTiming::requestStart):
1514         (WebCore::PerformanceTiming::responseStart):
1515         (WebCore::PerformanceTiming::resourceLoadTimeRelativeToFetchStart):
1516         * page/PerformanceTiming.h:
1517         Navigation Timing values still uses the NetworkLoadTiming values stored on
1518         the DocumentLoader. This should be moved off of the deprecated path separately.
1519
1520         * platform/network/NetworkLoadMetrics.h: Renamed from Source/WebCore/platform/network/NetworkLoadTiming.h.
1521         (WebCore::NetworkLoadMetrics::NetworkLoadMetrics):
1522         (WebCore::NetworkLoadMetrics::isolatedCopy):
1523         (WebCore::NetworkLoadMetrics::reset):
1524         (WebCore::NetworkLoadMetrics::operator==):
1525         (WebCore::NetworkLoadMetrics::operator!=):
1526         (WebCore::NetworkLoadMetrics::isComplete):
1527         (WebCore::NetworkLoadMetrics::markComplete):
1528         (WebCore::NetworkLoadMetrics::encode):
1529         (WebCore::NetworkLoadMetrics::decode):
1530         Re-introduce a reset() method (for NetworkLoadSoup to reset between redirects).
1531         Add protocolName and "complete" boolean.
1532
1533         * platform/network/cocoa/NetworkLoadMetrics.mm: Renamed from Source/WebCore/platform/network/cocoa/NetworkLoadTiming.mm.
1534         (WebCore::timingValue):
1535         (WebCore::copyTimingData):
1536         (WebCore::setCollectsTimingData):
1537         Use this opportunity to convert NetworkLoadTiming timestamps to WTF::Seconds.
1538         Since we already have to modify all the clients this moves us to use the more
1539         strongly typed units that are less ambiguous then "double". The rest of the
1540         Performance API has already moved to these units.
1541
1542         * inspector/InspectorNetworkAgent.cpp:
1543         (WebCore::InspectorNetworkAgent::buildObjectForTiming):
1544         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
1545         (WebCore::InspectorNetworkAgent::didFinishLoading):
1546         * inspector/InspectorNetworkAgent.h:
1547         Inspector was the only client of the finishTime, and since the value was
1548         erratically coming from clients in different ways it was almost certainly
1549         inaccurate. Simplify this in preparation for using NetworkLoadMetrics.
1550
1551         * Modules/fetch/FetchLoader.cpp:
1552         (WebCore::FetchLoader::didFinishLoading):
1553         * Modules/fetch/FetchLoader.h:
1554         * fileapi/FileReaderLoader.cpp:
1555         (WebCore::FileReaderLoader::didFinishLoading):
1556         * fileapi/FileReaderLoader.h:
1557         * html/MediaFragmentURIParser.cpp:
1558         (WebCore::MediaFragmentURIParser::parseNPTTime):
1559         * inspector/InspectorInstrumentation.cpp:
1560         (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
1561         * inspector/InspectorInstrumentation.h:
1562         (WebCore::InspectorInstrumentation::didFinishLoading):
1563         * loader/CrossOriginPreflightChecker.cpp:
1564         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
1565         * loader/DocumentLoader.cpp:
1566         (WebCore::DocumentLoader::notifyFinished):
1567         (WebCore::DocumentLoader::finishedLoading):
1568         (WebCore::DocumentLoader::continueAfterContentPolicy):
1569         (WebCore::DocumentLoader::maybeLoadEmpty):
1570         * loader/DocumentLoader.h:
1571         * loader/DocumentThreadableLoader.cpp:
1572         (WebCore::DocumentThreadableLoader::didReceiveResponse):
1573         (WebCore::DocumentThreadableLoader::notifyFinished):
1574         (WebCore::DocumentThreadableLoader::didFinishLoading):
1575         (WebCore::DocumentThreadableLoader::loadRequest):
1576         * loader/DocumentThreadableLoader.h:
1577         * loader/NetscapePlugInStreamLoader.cpp:
1578         (WebCore::NetscapePlugInStreamLoader::didFinishLoading):
1579         * loader/NetscapePlugInStreamLoader.h:
1580         * loader/ResourceLoadNotifier.cpp:
1581         (WebCore::ResourceLoadNotifier::didFinishLoad):
1582         (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
1583         (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
1584         * loader/ResourceLoadNotifier.h:
1585         * loader/ResourceLoader.cpp:
1586         (WebCore::ResourceLoader::deliverResponseAndData):
1587         (WebCore::ResourceLoader::loadDataURL):
1588         (WebCore::ResourceLoader::didFinishLoading):
1589         (WebCore::ResourceLoader::didFinishLoadingOnePart):
1590         * loader/ResourceLoader.h:
1591         * loader/ResourceTiming.cpp:
1592         (WebCore::ResourceTiming::fromLoad):
1593         (WebCore::ResourceTiming::fromSynchronousLoad):
1594         (WebCore::ResourceTiming::ResourceTiming):
1595         (WebCore::ResourceTiming::isolatedCopy):
1596         * loader/ResourceTiming.h:
1597         (WebCore::ResourceTiming::networkLoadMetrics):
1598         (WebCore::ResourceTiming::ResourceTiming):
1599         (WebCore::ResourceTiming::networkLoadTiming): Deleted.
1600         * loader/SubresourceLoader.cpp:
1601         (WebCore::SubresourceLoader::SubresourceLoader):
1602         (WebCore::SubresourceLoader::willSendRequestInternal):
1603         (WebCore::SubresourceLoader::didReceiveResponse):
1604         (WebCore::SubresourceLoader::didFinishLoading):
1605         (WebCore::SubresourceLoader::reportResourceTiming):
1606         * loader/SubresourceLoader.h:
1607         * loader/ThreadableLoaderClient.h:
1608         (WebCore::ThreadableLoaderClient::didFinishLoading):
1609         * loader/ThreadableLoaderClientWrapper.h:
1610         (WebCore::ThreadableLoaderClientWrapper::didFinishLoading):
1611         * loader/WorkerThreadableLoader.cpp:
1612         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
1613         * loader/WorkerThreadableLoader.h:
1614         * loader/appcache/ApplicationCacheGroup.cpp:
1615         (WebCore::ApplicationCacheGroup::didFinishLoading):
1616         * loader/appcache/ApplicationCacheGroup.h:
1617         * loader/cache/CachedResource.h:
1618         (WebCore::CachedResource::setLoadFinishTime):
1619         * loader/ios/QuickLook.mm:
1620         (-[WebPreviewLoader connectionDidFinishLoading:]):
1621         * page/EventSource.cpp:
1622         (WebCore::EventSource::didFinishLoading):
1623         * page/EventSource.h:
1624         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1625         (ResourceHandleStreamingClient::didFinishLoading):
1626         * platform/network/BlobResourceHandle.cpp:
1627         (WebCore::doNotifyFinish):
1628         * platform/network/PingHandle.h:
1629         * platform/network/ResourceHandle.h:
1630         * platform/network/ResourceHandleClient.h:
1631         (WebCore::ResourceHandleClient::didFinishLoading):
1632         * platform/network/ResourceResponseBase.cpp:
1633         (WebCore::ResourceResponseBase::crossThreadData):
1634         (WebCore::ResourceResponseBase::fromCrossThreadData):
1635         (WebCore::ResourceResponseBase::compare):
1636         * platform/network/ResourceResponseBase.h:
1637         (WebCore::ResourceResponseBase::deprecatedNetworkLoadMetrics):
1638         (WebCore::ResourceResponseBase::encode):
1639         (WebCore::ResourceResponseBase::decode):
1640         (WebCore::ResourceResponseBase::networkLoadTiming): Deleted.
1641         * platform/network/SynchronousLoaderClient.cpp:
1642         (WebCore::SynchronousLoaderClient::didFinishLoading):
1643         * platform/network/SynchronousLoaderClient.h:
1644         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1645         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
1646         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
1647         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
1648         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
1649         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading):
1650         * platform/network/curl/ResourceHandleCurl.cpp:
1651         (WebCore::WebCoreSynchronousLoader::didFinishLoading):
1652         * platform/network/curl/ResourceHandleManager.cpp:
1653         (WebCore::calculateWebTimingInformations):
1654         (WebCore::ResourceHandleManager::downloadTimerCallback):
1655         (WebCore::handleDataURL):
1656         (WebCore::milisecondsSinceRequest): Deleted.
1657         * platform/network/mac/ResourceHandleMac.mm:
1658         (WebCore::ResourceHandle::getConnectionTimingData):
1659         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
1660         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
1661         (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]):
1662         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1663         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1664         (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
1665         * platform/network/soup/ResourceHandleSoup.cpp:
1666         (WebCore::restartedCallback):
1667         (WebCore::nextMultipartResponsePartCallback):
1668         (WebCore::sendRequestCallback):
1669         (WebCore::ResourceHandle::didStartRequest):
1670         (WebCore::networkEventCallback):
1671         (WebCore::ResourceHandle::sendPendingRequest):
1672         (WebCore::readCallback):
1673         (WebCore::milisecondsSinceRequest): Deleted.
1674         * workers/WorkerScriptLoader.cpp:
1675         (WebCore::WorkerScriptLoader::didFinishLoading):
1676         * workers/WorkerScriptLoader.h:
1677         * xml/XMLHttpRequest.cpp:
1678         (WebCore::XMLHttpRequest::didFinishLoading):
1679         * xml/XMLHttpRequest.h:
1680         Eliminate the unused finishTime double.
1681
1682 2017-02-23  Antoine Quint  <graouts@apple.com>
1683
1684         [Modern Media Controls] Controls overflow when media element has border or padding
1685         https://bugs.webkit.org/show_bug.cgi?id=168818
1686         <rdar://problem/30689780>
1687
1688         Reviewed by Jon Lee.
1689
1690         We used to query the media element's layout size to compute the size of the media controls,
1691         which would account for border and padding. Instead, we should use the size of the container,
1692         at the root of the ShadowRoot, which will always match the size of the media.
1693
1694         Test: media/modern-media-controls/media-controller/media-controller-controls-sizing-with-border-and-padding.html
1695
1696         * Modules/modern-media-controls/controls/media-controls.css:
1697         (.media-controls-container,):
1698         * Modules/modern-media-controls/media/media-controller.js:
1699         (MediaController.prototype._updateControlsSize):
1700         (MediaController.prototype._controlsWidth):
1701
1702 2017-02-23  Antoine Quint  <graouts@apple.com>
1703
1704         [Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls
1705         https://bugs.webkit.org/show_bug.cgi?id=168820
1706         <rdar://problem/30690281>
1707
1708         Reviewed by Jon Lee.
1709
1710         We broke this in https://bugs.webkit.org/show_bug.cgi?id=168755. We restore the check that the
1711         event target when initiating a drag is the controls bar itself and not some of its content.
1712
1713         Since this wasn't caught by our existing tests, we add a test that attemps to initiate a drag
1714         starting over one of the controls and notice that no dragging occurs.
1715
1716         Test: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html
1717
1718         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
1719         (MacOSFullscreenMediaControls.prototype._handleMousedown):
1720
1721 2017-02-23  Simon Fraser  <simon.fraser@apple.com>
1722
1723         REGRESSION (r211305): Masks on composited elements with preserve-3d broken
1724         https://bugs.webkit.org/show_bug.cgi?id=168815
1725         rdar://problem/30676846
1726
1727         Reviewed by Jon Lee.
1728
1729         r211305 moved the mask layer to be on the structural layer if there is one, to fix
1730         masking backdrops. However, with preserve-3d the structural layer can be a CATransformLayer,
1731         which doesn't take a mask, so limit the previous change to backdrops only.
1732
1733         Test: compositing/masks/mask-with-preserve-3d.html
1734
1735         * platform/graphics/ca/GraphicsLayerCA.cpp:
1736         (WebCore::GraphicsLayerCA::updateMaskLayer):
1737
1738 2017-02-23  Antoine Quint  <graouts@apple.com>
1739
1740         [Modern Media Controls] Show "Loading" until playback starts
1741         https://bugs.webkit.org/show_bug.cgi?id=168809
1742         <rdar://problem/30687468>
1743
1744         Reviewed by Jon Lee.
1745
1746         We now display the "Loading" status as soon as we've started loading and
1747         until we've obtained enough data to play. No test provided since we don't
1748         have a way to specifically set networkState and readyState to the satisfactory
1749         values.
1750
1751         * Modules/modern-media-controls/media/status-support.js:
1752         (StatusSupport.prototype.syncControl):
1753         (StatusSupport):
1754
1755 2017-02-23  Antoine Quint  <graouts@apple.com>
1756
1757         [Modern Media Controls] Enforce a minimum layout height of 50pt for <audio>
1758         https://bugs.webkit.org/show_bug.cgi?id=168801
1759         <rdar://problem/30683453>
1760
1761         Reviewed by Eric Carlson.
1762
1763         We enforce a 50pt minimum layout height for <audio> elements. There is no way
1764         for the page author to override this value since the min-height property is set
1765         as !important in a <style> element contained in a ShadowRoot.
1766
1767         * Modules/modern-media-controls/controls/media-controls.css:
1768         (:host(audio)):
1769
1770 2017-02-23  Youenn Fablet  <youenn@apple.com>
1771
1772         [WebRTC] Outgoing video quality is poor
1773         https://bugs.webkit.org/show_bug.cgi?id=168778
1774         <rdar://problem/30674673>
1775
1776         Reviewed by Eric Carlson.
1777
1778         Covered by manually ensuring the voice process thread is not spinning.
1779
1780         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: Setting the next call to max was not a good idea since the thread process is adding some value to it, making it a negative value.
1781
1782 2017-02-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1783
1784         Data interaction with a URL should navigate the page if the operation is not handled
1785         https://bugs.webkit.org/show_bug.cgi?id=168798
1786         <rdar://problem/30665969>
1787
1788         Reviewed by Tim Horton.
1789
1790         Refactors some drag and drop code on the Mac, and implements PlatformPasteboard::stringForType.
1791
1792         * page/DragController.cpp:
1793         (WebCore::DragController::performDragOperation):
1794         * platform/ios/PlatformPasteboardIOS.mm:
1795         (WebCore::PlatformPasteboard::stringForType):
1796         * platform/mac/DragDataMac.mm:
1797
1798 2017-02-23  Youenn Fablet  <youenn@apple.com>
1799
1800         [WebRTC] RealtimeOutgoingAudioSource does not need to upsample audio buffers
1801         https://bugs.webkit.org/show_bug.cgi?id=168796
1802
1803         Reviewed by Jer Noble.
1804
1805         Covered by manual testing.
1806         Limiting RealtimeOutgoingAudioSource conversion to interleaving and float-to-integer.
1807         Removed the sample rate conversion.
1808
1809         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1810         (WebCore::libwebrtcAudioFormat):
1811         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
1812         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
1813
1814 2017-02-23  Alex Christensen  <achristensen@webkit.org>
1815
1816         Re-soft-link CoreVideo after r212906
1817         https://bugs.webkit.org/show_bug.cgi?id=168803
1818
1819         Reviewed by Jer Noble.
1820
1821         CoreVideo should be soft linked to reduce startup time.
1822         Linking against the framework just for a few symbols used in one file was the wrong solution.
1823
1824         * Configurations/WebCore.xcconfig:
1825         * platform/cocoa/CoreVideoSoftLink.cpp:
1826         * platform/cocoa/CoreVideoSoftLink.h:
1827         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1828
1829 2017-02-23  Chris Dumez  <cdumez@apple.com>
1830
1831         Report domains using abnormally high CPU usage via enhanced privacy logging
1832         https://bugs.webkit.org/show_bug.cgi?id=168794
1833         <rdar://problem/29964018>
1834
1835         Reviewed by Ryosuke Niwa.
1836
1837         Report domains using abnormally high CPU usage (> 20%) via enhanced privacy
1838         logging.
1839
1840         * page/DiagnosticLoggingKeys.cpp:
1841         (WebCore::DiagnosticLoggingKeys::domainCausingEnergyDrainKey):
1842         * page/DiagnosticLoggingKeys.h:
1843         * page/PerformanceMonitor.cpp:
1844         (WebCore::reportPageOverPostLoadCPUUsageThreshold):
1845         (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
1846
1847 2017-02-23  Zalan Bujtas  <zalan@apple.com>
1848
1849         Simple line layout: Adjust RunResolver::lineIndexForHeight with line struts.
1850         https://bugs.webkit.org/show_bug.cgi?id=168783
1851         <rdar://problem/30676449>
1852
1853         Reviewed by Antti Koivisto.
1854
1855         When there's a pagination gap between lines the simple lineIndex = y / lineHeight formula does not work anymore.
1856         This patch takes the line gaps into account by offsetting the y position accordingly.
1857
1858         Not enabled yet.
1859
1860         * rendering/SimpleLineLayoutResolver.cpp:
1861         (WebCore::SimpleLineLayout::RunResolver::lineIndexForHeight):
1862
1863 2017-02-23  Alex Christensen  <achristensen@webkit.org>
1864
1865         Fix iOS WebRTC build after r212812
1866         https://bugs.webkit.org/show_bug.cgi?id=168790
1867
1868         Reviewed by Tim Horton.
1869
1870         * Configurations/WebCore.xcconfig:
1871
1872 2017-02-23  Carlos Garcia Campos  <cgarcia@igalia.com>
1873
1874         [GStreamer] Several layout tests trigger GStreamer-CRITICAL **: gst_bin_get_by_name: assertion 'GST_IS_BIN (bin)' failed
1875         https://bugs.webkit.org/show_bug.cgi?id=167016
1876
1877         Reviewed by Xabier Rodriguez-Calvar.
1878
1879         This is because we create AudioSourceProviderGStreamer objects that are never loaded. In the destructor the
1880         AudioSourceProviderGStreamer calls gst_bin_get_by_name() on its m_audioSinkBin that is nullptr. We could simply
1881         check m_audioSinkBin in the destructor, but I think it's better to simply not create
1882         AudioSourceProviderGStreamer for nothing. MediaPlayerPrivateGStreamer should create the AudioSourceProvider on demand.
1883
1884         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1885         (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): Do not create the AudioSourceProvider.
1886         (WebCore::MediaPlayerPrivateGStreamer::createAudioSink): Call ensureAudioSourceProvider() before using m_audioSourceProvider.
1887         (WebCore::MediaPlayerPrivateGStreamer::ensureAudioSourceProvider): Create the AudioSourceProvider if needed.
1888         (WebCore::MediaPlayerPrivateGStreamer::audioSourceProvider): Ensure and return the m_audioSourceProvider.
1889         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1890
1891 2017-02-23  Tomas Popela  <tpopela@redhat.com>
1892
1893         [GTK] Drag and drop is always moving the content even if copy is requested
1894         https://bugs.webkit.org/show_bug.cgi?id=168424
1895
1896         Reviewed by Carlos Garcia Campos.
1897
1898         Drag and drop is always moving the content around even if the copy is
1899         requested (i.e. by pressing the Control key).
1900
1901         Test: editing/pasteboard/drag-drop-copy-content.html
1902
1903         * page/gtk/DragControllerGtk.cpp:
1904         (WebCore::DragController::isCopyKeyDown):
1905
1906 2017-02-22  Myles C. Maxfield  <mmaxfield@apple.com>
1907
1908         [Cocoa] Remove Yosemite-specific font lookup code
1909         https://bugs.webkit.org/show_bug.cgi?id=168682
1910
1911         Reviewed by Zalan Bujtas.
1912
1913         No new tests because there is no behavior change.
1914
1915         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1916         (WebCore::platformFontLookupWithFamily):
1917         (WebCore::fontWithFamily):
1918         * platform/graphics/mac/FontCacheMac.mm:
1919         (WebCore::platformInvalidateFontCache):
1920         (WebCore::acceptableChoice): Deleted.
1921         (WebCore::betterChoice): Deleted.
1922         (WebCore::desiredFamilyToAvailableFamilyMap): Deleted.
1923         (WebCore::hasDesiredFamilyToAvailableFamilyMapping): Deleted.
1924         (WebCore::rememberDesiredFamilyToAvailableFamilyMapping): Deleted.
1925         (WebCore::toAppKitFontWeight): Deleted.
1926         (WebCore::appkitWeightToFontWeight): Deleted.
1927         (WebCore::toNSFontTraits): Deleted.
1928         (WebCore::platformFontWithFamily): Deleted.
1929
1930 2017-02-22  Antoine Quint  <graouts@apple.com>
1931
1932         [Modern Media Controls] Clicking on the video doesn't toggle playback state in fullscreen on macOS
1933         https://bugs.webkit.org/show_bug.cgi?id=168755
1934         <rdar://problem/30664484>
1935
1936         Reviewed by Dean Jackson.
1937
1938         We now call super in the handleEvent() method of MacOSFullscreenMediaControls if we're not dealing
1939         with an event type and target combination that was specifically registered in this class's scope.
1940         We had mistakenly added the call to super.handleEvent(event) in the wrong method when fixing
1941         https://bugs.webkit.org/show_bug.cgi?id=168515.
1942
1943         Test: media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-fullscreen.html
1944
1945         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
1946         (MacOSFullscreenMediaControls.prototype.handleEvent):
1947         (MacOSFullscreenMediaControls.prototype._handleMousedown):
1948         * Modules/modern-media-controls/controls/macos-media-controls.js:
1949         (MacOSMediaControls.prototype.handleEvent):
1950         (MacOSMediaControls):
1951
1952 2017-02-22  Antoine Quint  <graouts@apple.com>
1953
1954         [Modern Media Controls] Scrubber stops moving while scrubbing on macOS
1955         https://bugs.webkit.org/show_bug.cgi?id=168518
1956         <rdar://problem/30577637>
1957
1958         Reviewed by Dean Jackson.
1959
1960         As we start to scrub, controlValueWillStartChanging() is called on
1961         ScrubberSupport and pauses the media if it's not already paused. This
1962         causes the play/pause button to change icon and for layout() to be
1963         called on MacOSInlineMediaControls. This in turns sets the .children
1964         property on the .controlsBar and eventually yields a DOM manipulation
1965         which re-inserts the scrubber's DOM hierarchy, causing stutters during
1966         user interaction.
1967
1968         Our solution is to make the .children setter smarter about identifying
1969         that the children list hasn't changed and that no DOM invalidation is
1970         necessary.
1971
1972         * Modules/modern-media-controls/controls/layout-node.js:
1973         (LayoutNode.prototype.set children):
1974
1975 2017-02-22  Antoine Quint  <graouts@apple.com>
1976
1977         [Modern Media Controls] Controls bar may disappear while captions menu is visible
1978         https://bugs.webkit.org/show_bug.cgi?id=168751
1979         <rdar://problem/30663411>
1980
1981         Reviewed by Dean Jackson.
1982
1983         We now prevent the controls bar from fading out due to the auto-hide timer firing
1984         when the tracks panel is up, and wait until the track panel is hidden before fading
1985         the controls bar.
1986
1987         Test: media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading.html
1988
1989         * Modules/modern-media-controls/controls/controls-bar.js:
1990         (ControlsBar.prototype.set userInteractionEnabled):
1991         (ControlsBar.prototype._autoHideTimerFired):
1992
1993 2017-02-22  Antoine Quint  <graouts@apple.com>
1994
1995         [Modern Media Controls] Can't set the volume slider with macOS inline controls
1996         https://bugs.webkit.org/show_bug.cgi?id=168747
1997         <rdar://problem/30605528>
1998
1999         Reviewed by Dean Jackson.
2000
2001         Only call super for events we haven't registered specifically in the context
2002         of this class. Otherwise we'd invalidate the volume container visibility for
2003         a "mousedown" event registered by the MacOSMediaControls, the super class.
2004
2005         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
2006         (MacOSInlineMediaControls.prototype.handleEvent):
2007
2008 2017-02-22  Antti Koivisto  <antti@apple.com>
2009
2010         Replace SimpleLineLayout::Range by WTF::IteratorRange
2011         https://bugs.webkit.org/show_bug.cgi?id=168742
2012
2013         Reviewed by Zalan Bujtas.
2014
2015         Kill a redundant custom type.
2016
2017         * rendering/SimpleLineLayoutResolver.cpp:
2018         (WebCore::SimpleLineLayout::RunResolver::rangeForRect):
2019         (WebCore::SimpleLineLayout::RunResolver::rangeForRenderer):
2020         (WebCore::SimpleLineLayout::RunResolver::rangeForRendererWithOffsets):
2021         * rendering/SimpleLineLayoutResolver.h:
2022         (WebCore::SimpleLineLayout::LineResolver::rangeForRect):
2023         (WebCore::SimpleLineLayout::Range::Range): Deleted.
2024         (WebCore::SimpleLineLayout::Range::begin): Deleted.
2025         (WebCore::SimpleLineLayout::Range::end): Deleted.
2026
2027 2017-02-22  Simon Fraser  <simon.fraser@apple.com>
2028
2029         Add the Web Authentication API as "Under Consideration".
2030
2031         * features.json:
2032
2033 2017-02-22  Zalan Bujtas  <zalan@apple.com>
2034
2035         Simple line layout: Set the pagination strut on the flow when the first line does not fit the page.
2036         https://bugs.webkit.org/show_bug.cgi?id=168738
2037         <rdar://problem/30659469>
2038
2039         Reviewed by Antti Koivisto.
2040
2041         The pagination strut for the first line is tracked by the parent RenderBlockFlow and not by
2042         the line itself (see RenderBlockFlow::adjustLinePositionForPagination()). Also renamed *PaginationStrut* to
2043         *LineStrut* to make sure we don't confuse it with the block level strut.
2044
2045         Not enabled yet.
2046
2047         * rendering/SimpleLineLayout.cpp:
2048         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow):
2049         (WebCore::SimpleLineLayout::computeLineBreakIndex):
2050         (WebCore::SimpleLineLayout::setPageBreakForLine):
2051         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
2052         (WebCore::SimpleLineLayout::create):
2053         (WebCore::SimpleLineLayout::Layout::create):
2054         (WebCore::SimpleLineLayout::Layout::Layout):
2055         * rendering/SimpleLineLayout.h:
2056         (WebCore::SimpleLineLayout::Layout::hasLineStruts):
2057         (WebCore::SimpleLineLayout::Layout::struts):
2058         (WebCore::SimpleLineLayout::Layout::hasPaginationStruts): Deleted.
2059         * rendering/SimpleLineLayoutFunctions.cpp:
2060         (WebCore::SimpleLineLayout::paintFlow):
2061         * rendering/SimpleLineLayoutFunctions.h:
2062         (WebCore::SimpleLineLayout::computeFlowHeight):
2063         * rendering/SimpleLineLayoutResolver.h:
2064         (WebCore::SimpleLineLayout::RunResolver::Run::computeBaselinePosition):
2065
2066 2017-02-22  Youenn Fablet  <youenn@apple.com>
2067
2068         [WebRTC] Disable libwebrtc stderr logging in release mode
2069         https://bugs.webkit.org/show_bug.cgi?id=168734
2070
2071         Reviewed by Tim Horton.
2072
2073         No change of behavior.
2074
2075         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2076         (WebCore::initializePeerConnectionFactoryAndThreads):
2077
2078 2017-02-22  Jer Noble  <jer.noble@apple.com>
2079
2080         MediaStreamSourceNode never receives audio from MockRealtimeAudioSourceMac.
2081         https://bugs.webkit.org/show_bug.cgi?id=168731
2082
2083         Reviewed by Eric Carlson.
2084
2085         Test: fast/mediastream/mock-media-source-webaudio.html
2086
2087         Because the audioSourceProvider can be created before the mock source is configured, explicitly configure the
2088         source if necessary after creating the audioSourceProvider.
2089
2090         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
2091         (WebCore::MockRealtimeAudioSourceMac::audioSourceProvider):
2092
2093 2017-02-22  Chris Dumez  <cdumez@apple.com>
2094
2095         Do not aggressively throttle DOM timers until they've reached their max nesting level
2096         https://bugs.webkit.org/show_bug.cgi?id=168700
2097         <rdar://problem/29808005>
2098
2099         Reviewed by Simon Fraser.
2100
2101         Do not aggressively throttle DOM timers until they've actually areached their max
2102         nesting level (5). This overly aggressive throttling of non-nested timers is what
2103         was causing Google Maps to use 100% CPU in background tabs for several minutes.
2104
2105         Test: fast/dom/timer-throttling-hidden-page-non-nested.html
2106
2107         * dom/Document.cpp:
2108         (WebCore::Document::timerAlignmentInterval):
2109
2110 2017-02-22  Eric Carlson  <eric.carlson@apple.com>
2111
2112         [MediaStream iOS] Respond to capture interruptions and notifications
2113         https://bugs.webkit.org/show_bug.cgi?id=168610
2114
2115         Reviewed by Jer Noble.
2116
2117         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2118         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Drive-by cleanup: don't create
2119         a sample buffer display layer unless there is an active video track.
2120
2121         * platform/mediastream/mac/AVMediaCaptureSource.h:
2122         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2123         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource): Add static_asserts to ensure that
2124         WebCore::InterruptionReason values map directly to AVCaptureSessionInterruptionReason values.
2125         (WebCore::AVMediaCaptureSource::~AVMediaCaptureSource): Minor cleanup.
2126         (WebCore::AVMediaCaptureSource::startProducingData): Start listening for notifications before
2127         starting the session.
2128         (WebCore::AVMediaCaptureSource::stopProducingData): Remove the notification observers before
2129         stopping the session.
2130         (WebCore::AVMediaCaptureSource::setupSession): Minor style cleanup.
2131         (WebCore::AVMediaCaptureSource::captureSessionRuntimeError): New. When the error is AVErrorMediaServicesWereReset,
2132         sometimes caused by a mediaserverd crash, try to restart the session one time.
2133         (WebCore::AVMediaCaptureSource::captureSessionBeginInterruption): Store the interruption reason.
2134         (WebCore::AVMediaCaptureSource::captureSessionEndInterruption): Try to restart the session if
2135         it was interrupted because the app went into multi-app layout mode.
2136         (WebCore::sessionKVOProperties): Drive-by cleanup.
2137         (-[WebCoreAVMediaCaptureSourceObserver initWithCallback:]):
2138         (-[WebCoreAVMediaCaptureSourceObserver disconnect]):
2139         (-[WebCoreAVMediaCaptureSourceObserver addNotificationObservers]):
2140         (-[WebCoreAVMediaCaptureSourceObserver removeNotificationObservers]):
2141         (-[WebCoreAVMediaCaptureSourceObserver sessionRuntimeError:]):
2142         (-[WebCoreAVMediaCaptureSourceObserver beginSessionInterrupted:]):
2143         (-[WebCoreAVMediaCaptureSourceObserver endSessionInterrupted:]):
2144
2145         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2146         (WebCore::AVVideoCaptureSource::initializeCapabilities): Not all AVCaptureSession preset strings
2147         are available on all platforms so load with SOFT_LINK_POINTER_OPTIONAL and NULL check before use.
2148         (WebCore::sizeForPreset): Ditto.
2149         (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions): Ditto.
2150
2151 2017-02-22  Zalan Bujtas  <zalan@apple.com>
2152
2153         Simple line layout: ensureLineBoxes for paginated content.
2154         https://bugs.webkit.org/show_bug.cgi?id=168729
2155         <rdar://problem/30654400>
2156
2157         Reviewed by Antti Koivisto.
2158
2159         This patch sets the layout state bits for paginated subtree layout, when we are switching
2160         over from simple line runs to inline tree. 
2161
2162         Not enabled yet.
2163
2164         * rendering/RenderBlockFlow.cpp:
2165         (WebCore::RenderBlockFlow::ensureLineBoxes):
2166         * rendering/RenderView.cpp:
2167         (WebCore::RenderView::pushLayoutStateForPagination): LayoutUnit(1) is not the real height, it's just
2168         an indicator that we've got paginated content.
2169         * rendering/RenderView.h:
2170         * rendering/SimpleLineLayout.cpp:
2171         (WebCore::SimpleLineLayout::create):
2172         (WebCore::SimpleLineLayout::Layout::create):
2173         (WebCore::SimpleLineLayout::Layout::Layout):
2174         * rendering/SimpleLineLayout.h:
2175         (WebCore::SimpleLineLayout::Layout::isPaginated):
2176         (WebCore::SimpleLineLayout::Layout::hasPaginationStruts):
2177         * rendering/SimpleLineLayoutFunctions.h:
2178         (WebCore::SimpleLineLayout::computeFlowHeight):
2179         * rendering/SimpleLineLayoutResolver.h:
2180         (WebCore::SimpleLineLayout::RunResolver::Run::computeBaselinePosition):
2181
2182 2017-02-22  Per Arne Vollan  <pvollan@apple.com>
2183
2184         [Win] Compile fix.
2185         https://bugs.webkit.org/show_bug.cgi?id=168713
2186
2187         Reviewed by Brent Fulgham.
2188
2189         The include file <ANGLE/ShaderLang.h> is not found.
2190
2191         * testing/Internals.cpp:
2192
2193 2017-02-22  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2194
2195         [GStreamer][EME] Fix issue with allowed systems extraction
2196         https://bugs.webkit.org/show_bug.cgi?id=168717
2197
2198         Reviewed by Carlos Garcia Campos.
2199
2200         The allowed systems were not being extracted from the need-context
2201         message because the loop was not stopping on the right condition.
2202
2203         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2204         (WebCore::extractEventsAndSystemsFromMessage): Fix wrong
2205         condition.
2206         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
2207         Add better debug category.
2208
2209 2017-02-22  Antti Koivisto  <antti@apple.com>
2210
2211         REGRESSION(r207669): Crash after mutating selector text
2212         https://bugs.webkit.org/show_bug.cgi?id=168655
2213         <rdar://problem/30632111>
2214
2215         Reviewed by Andreas Kling.
2216
2217         Test: fast/css/selector-text-mutation-crash.html
2218
2219         * style/StyleScope.cpp:
2220         (WebCore::Style::Scope::resolver):
2221         (WebCore::Style::Scope::updateStyleResolver):
2222
2223         Protect against entering scheduleUpdate and wiping style resolver while updating it.
2224         Extension stylesheets can trigger this.
2225
2226         (WebCore::Style::Scope::scheduleUpdate):
2227
2228         Clear the style resolver immediately if style sheet content changes. The resolver may
2229         have data structures that point to the old sheet contents.
2230
2231         The resolver would get wiped anyway when the scheduled update actually occurs.
2232
2233         * style/StyleScope.h:
2234
2235 2017-02-08  Sergio Villar Senin  <svillar@igalia.com>
2236
2237         [css-grid] Move the track sizing algorithm to its own class
2238         https://bugs.webkit.org/show_bug.cgi?id=167988
2239
2240         Reviewed by Manuel Rego Casasnovas.
2241
2242         This is about moving the track sizing algorithm code out of RenderGrid to a new class
2243         GridTrackSizingAlgorithm, making RenderGrid more compact and easy to maintain. A nice side
2244         effect of this patch is the removal of the GridSizingData structure as it is no longer
2245         needed. All the data structures in that class were transferred to GridTrackSizingAlgorithm
2246         as private attribute members. The GridTrack class was also moved to the new file.
2247
2248         The algorithm execution starts with the call to run(). It's mandatory to call setup() before
2249         any call to run() in order to properly configure the behaviour of the algorithm. You can
2250         call setup() & run() multiple times for a single layout operation (normally twice, one for
2251         columns and another one for rows). The algorithm uses a state machine to verify that the
2252         client issues the calls in the proper order (i.e. first columns and then rows). After
2253         finishing the layout, the client should call reset() to allow the algorithm to perform
2254         cleanups and to prepare itself for another round of calls.
2255
2256         In order to implement the different behaviours of the algorithm depending on whether the
2257         available size is definite or not, a strategy pattern was implemented in the
2258         GridTrackSizingAlgorithmStrategy class. It has two subclasses, one for definite sizes and
2259         another one for indefinite ones.
2260
2261         We took advantage of this change to perform some renames of the track sizing algorithm
2262         methods that were still using the names from the first versions of the specs. Not only that,
2263         the original track sizing algorithm method (computeUsedBreadthOfGridTracks) was split in 4
2264         different parts representing the 4 steps of the algorithm.
2265
2266         No new tests as this is about moving code and refactoring.
2267
2268         * CMakeLists.txt:
2269         * WebCore.xcodeproj/project.pbxproj:
2270         * rendering/GridTrackSizingAlgorithm.cpp: Added.
2271         (WebCore::GridTrack::baseSize):
2272         (WebCore::GridTrack::growthLimit):
2273         (WebCore::GridTrack::setBaseSize):
2274         (WebCore::GridTrack::setGrowthLimit):
2275         (WebCore::GridTrack::growthLimitIfNotInfinite):
2276         (WebCore::GridTrack::setTempSize):
2277         (WebCore::GridTrack::growTempSize):
2278         (WebCore::GridTrack::setGrowthLimitCap):
2279         (WebCore::GridTrack::ensureGrowthLimitIsBiggerThanBaseSize):
2280         (WebCore::shouldClearOverrideContainingBlockContentSizeForChild):
2281         (WebCore::hasOverrideContainingBlockContentSizeForChild):
2282         (WebCore::setOverrideContainingBlockContentSizeForChild):
2283         (WebCore::flowAwareDirectionForChild):
2284         (WebCore::overrideContainingBlockContentSizeForChild):
2285         (WebCore::computeMarginLogicalSizeForChild):
2286         (WebCore::marginIntrinsicLogicalWidthForChild):
2287         (WebCore::GridTrackSizingAlgorithm::setFreeSpace):
2288         (WebCore::GridTrackSizingAlgorithm::rawGridTrackSize):
2289         (WebCore::GridTrackSizingAlgorithm::computeTrackBasedSize):
2290         (WebCore::GridTrackSizingAlgorithm::initialBaseSize):
2291         (WebCore::GridTrackSizingAlgorithm::initialGrowthLimit):
2292         (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem):
2293         (WebCore::GridTrackSizingAlgorithm::spanningItemCrossesFlexibleSizedTracks):
2294         (WebCore::GridItemWithSpan::GridItemWithSpan):
2295         (WebCore::GridItemWithSpan::gridItem):
2296         (WebCore::GridItemWithSpan::span):
2297         (WebCore::GridItemWithSpan::operator<):
2298         (WebCore::GridTrackSizingAlgorithm::itemSizeForTrackSizeComputationPhase):
2299         (WebCore::shouldProcessTrackForTrackSizeComputationPhase):
2300         (WebCore::trackSizeForTrackSizeComputationPhase):
2301         (WebCore::updateTrackSizeForTrackSizeComputationPhase):
2302         (WebCore::trackShouldGrowBeyondGrowthLimitsForTrackSizeComputationPhase):
2303         (WebCore::markAsInfinitelyGrowableForTrackSizeComputationPhase):
2304         (WebCore::GridTrackSizingAlgorithm::increaseSizesToAccommodateSpanningItems):
2305         (WebCore::sortByGridTrackGrowthPotential):
2306         (WebCore::clampGrowthShareIfNeeded):
2307         (WebCore::GridTrackSizingAlgorithm::distributeSpaceToTracks):
2308         (WebCore::GridTrackSizingAlgorithm::assumedRowsSizeForOrthogonalChild):
2309         (WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild):
2310         (WebCore::GridTrackSizingAlgorithm::gridTrackSize):
2311         (WebCore::GridTrackSizingAlgorithm::computeFlexFactorUnitSize):
2312         (WebCore::GridTrackSizingAlgorithm::computeFlexSizedTracksGrowth):
2313         (WebCore::GridTrackSizingAlgorithm::findFrUnitSize):
2314         (WebCore::GridTrackSizingAlgorithm::computeGridContainerIntrinsicSizes):
2315         (WebCore::GridTrackSizingAlgorithmStrategy::logicalHeightForChild):
2316         (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild):
2317         (WebCore::GridTrackSizingAlgorithmStrategy::maxContentForChild):
2318         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild):
2319         (WebCore::GridTrackSizingAlgorithmStrategy::updateOverrideContainingBlockContentSizeForChild):
2320         (WebCore::IndefiniteSizeStrategy::minLogicalWidthForChild):
2321         (WebCore::IndefiniteSizeStrategy::layoutGridItemForMinSizeComputation):
2322         (WebCore::IndefiniteSizeStrategy::maximizeTracks):
2323         (WebCore::normalizedFlexFraction):
2324         (WebCore::IndefiniteSizeStrategy::findUsedFlexFraction):
2325         (WebCore::IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
2326         (WebCore::DefiniteSizeStrategy::minLogicalWidthForChild):
2327         (WebCore::DefiniteSizeStrategy::maximizeTracks):
2328         (WebCore::DefiniteSizeStrategy::layoutGridItemForMinSizeComputation):
2329         (WebCore::DefiniteSizeStrategy::findUsedFlexFraction):
2330         (WebCore::DefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
2331         (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):
2332         (WebCore::GridTrackSizingAlgorithm::resolveIntrinsicTrackSizes):
2333         (WebCore::GridTrackSizingAlgorithm::stretchFlexibleTracks):
2334         (WebCore::GridTrackSizingAlgorithm::advanceNextState):
2335         (WebCore::GridTrackSizingAlgorithm::isValidTransition):
2336         (WebCore::GridTrackSizingAlgorithm::setup):
2337         (WebCore::GridTrackSizingAlgorithm::run):
2338         (WebCore::GridTrackSizingAlgorithm::reset):
2339         (WebCore::GridTrackSizingAlgorithm::tracksAreWiderThanMinTrackBreadth):
2340         (WebCore::GridTrackSizingAlgorithm::StateMachine::StateMachine):
2341         (WebCore::GridTrackSizingAlgorithm::StateMachine::~StateMachine):
2342         * rendering/GridTrackSizingAlgorithm.h: Added.
2343         (WebCore::GridTrack::GridTrack):
2344         (WebCore::GridTrack::infiniteGrowthPotential):
2345         (WebCore::GridTrack::plannedSize):
2346         (WebCore::GridTrack::setPlannedSize):
2347         (WebCore::GridTrack::tempSize):
2348         (WebCore::GridTrack::infinitelyGrowable):
2349         (WebCore::GridTrack::setInfinitelyGrowable):
2350         (WebCore::GridTrack::growthLimitCap):
2351         (WebCore::GridTrack::growthLimitIsInfinite):
2352         (WebCore::GridTrack::isGrowthLimitBiggerThanBaseSize):
2353         (WebCore::GridTrackSizingAlgorithmStrategy::GridTrackSizingAlgorithmStrategy):
2354         (WebCore::GridTrackSizingAlgorithmStrategy::computeTrackBasedSize):
2355         (WebCore::GridTrackSizingAlgorithmStrategy::direction):
2356         (WebCore::GridTrackSizingAlgorithmStrategy::findFrUnitSize):
2357         (WebCore::GridTrackSizingAlgorithmStrategy::distributeSpaceToTracks):
2358         (WebCore::GridTrackSizingAlgorithmStrategy::renderGrid):
2359         * rendering/RenderGrid.cpp:
2360         (WebCore::RenderGrid::RenderGrid):
2361         (WebCore::RenderGrid::computeTrackBasedLogicalHeight):
2362         (WebCore::RenderGrid::computeTrackSizesForDefiniteSize):
2363         (WebCore::RenderGrid::repeatTracksSizingIfNeeded):
2364         (WebCore::RenderGrid::layoutBlock):
2365         (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
2366         (WebCore::RenderGrid::computeTrackSizesForIndefiniteSize):
2367         (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
2368         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded):
2369         (WebCore::RenderGrid::layoutGridItems):
2370         (WebCore::RenderGrid::gridAreaBreadthForChildIncludingAlignmentOffsets):
2371         (WebCore::RenderGrid::populateGridPositionsForDirection):
2372         (WebCore::RenderGrid::columnAxisOffsetForChild):
2373         (WebCore::RenderGrid::rowAxisOffsetForChild):
2374         (WebCore::RenderGrid::findChildLogicalPosition):
2375         (WebCore::GridTrack::GridTrack): Deleted.
2376         (WebCore::GridTrack::baseSize): Deleted.
2377         (WebCore::GridTrack::growthLimit): Deleted.
2378         (WebCore::GridTrack::setBaseSize): Deleted.
2379         (WebCore::GridTrack::setGrowthLimit): Deleted.
2380         (WebCore::GridTrack::infiniteGrowthPotential): Deleted.
2381         (WebCore::GridTrack::growthLimitIfNotInfinite): Deleted.
2382         (WebCore::GridTrack::plannedSize): Deleted.
2383         (WebCore::GridTrack::setPlannedSize): Deleted.
2384         (WebCore::GridTrack::tempSize): Deleted.
2385         (WebCore::GridTrack::setTempSize): Deleted.
2386         (WebCore::GridTrack::growTempSize): Deleted.
2387         (WebCore::GridTrack::infinitelyGrowable): Deleted.
2388         (WebCore::GridTrack::setInfinitelyGrowable): Deleted.
2389         (WebCore::GridTrack::setGrowthLimitCap): Deleted.
2390         (WebCore::GridTrack::growthLimitCap): Deleted.
2391         (WebCore::GridTrack::growthLimitIsInfinite): Deleted.
2392         (WebCore::GridTrack::isGrowthLimitBiggerThanBaseSize): Deleted.
2393         (WebCore::GridTrack::ensureGrowthLimitIsBiggerThanBaseSize): Deleted.
2394         (WebCore::RenderGrid::GridSizingData::GridSizingData): Deleted.
2395         (WebCore::RenderGrid::GridSizingData::freeSpace): Deleted.
2396         (WebCore::RenderGrid::GridSizingData::availableSpace): Deleted.
2397         (WebCore::RenderGrid::GridSizingData::setAvailableSpace): Deleted.
2398         (WebCore::RenderGrid::GridSizingData::advanceNextState): Deleted.
2399         (WebCore::RenderGrid::GridSizingData::isValidTransition): Deleted.
2400         (WebCore::RenderGrid::GridSizingData::grid): Deleted.
2401         (WebCore::RenderGrid::GridSizingData::setFreeSpace): Deleted.
2402         (WebCore::RenderGrid::computeTrackSizesForDirection): Deleted.
2403         (WebCore::RenderGrid::computeIntrinsicLogicalHeight): Deleted.
2404         (WebCore::normalizedFlexFraction): Deleted.
2405         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): Deleted.
2406         (WebCore::RenderGrid::computeFlexSizedTracksGrowth): Deleted.
2407         (WebCore::RenderGrid::computeUsedBreadthOfMinLength): Deleted.
2408         (WebCore::RenderGrid::computeUsedBreadthOfMaxLength): Deleted.
2409         (WebCore::RenderGrid::computeFlexFactorUnitSize): Deleted.
2410         (WebCore::RenderGrid::findFlexFactorUnitSize): Deleted.
2411         (WebCore::hasOverrideContainingBlockContentSizeForChild): Deleted.
2412         (WebCore::setOverrideContainingBlockContentSizeForChild): Deleted.
2413         (WebCore::shouldClearOverrideContainingBlockContentSizeForChild): Deleted.
2414         (WebCore::RenderGrid::rawGridTrackSize): Deleted.
2415         (WebCore::RenderGrid::gridTrackSize): Deleted.
2416         (WebCore::RenderGrid::logicalHeightForChild): Deleted.
2417         (WebCore::RenderGrid::minSizeForChild): Deleted.
2418         (WebCore::RenderGrid::updateOverrideContainingBlockContentSizeForChild): Deleted.
2419         (WebCore::RenderGrid::minContentForChild): Deleted.
2420         (WebCore::RenderGrid::maxContentForChild): Deleted.
2421         (WebCore::GridItemWithSpan::GridItemWithSpan): Deleted.
2422         (WebCore::GridItemWithSpan::gridItem): Deleted.
2423         (WebCore::GridItemWithSpan::span): Deleted.
2424         (WebCore::GridItemWithSpan::operator<): Deleted.
2425         (WebCore::RenderGrid::spanningItemCrossesFlexibleSizedTracks): Deleted.
2426         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): Deleted.
2427         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems): Deleted.
2428         (WebCore::trackSizeForTrackSizeComputationPhase): Deleted.
2429         (WebCore::RenderGrid::shouldProcessTrackForTrackSizeComputationPhase): Deleted.
2430         (WebCore::RenderGrid::trackShouldGrowBeyondGrowthLimitsForTrackSizeComputationPhase): Deleted.
2431         (WebCore::RenderGrid::markAsInfinitelyGrowableForTrackSizeComputationPhase): Deleted.
2432         (WebCore::RenderGrid::updateTrackSizeForTrackSizeComputationPhase): Deleted.
2433         (WebCore::RenderGrid::currentItemSizeForTrackSizeComputationPhase): Deleted.
2434         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems): Deleted.
2435         (WebCore::sortByGridTrackGrowthPotential): Deleted.
2436         (WebCore::clampGrowthShareIfNeeded): Deleted.
2437         (WebCore::RenderGrid::distributeSpaceToTracks): Deleted.
2438         (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth): Deleted.
2439         (WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild): Deleted.
2440         (WebCore::RenderGrid::gridAreaBreadthForChild): Deleted.
2441         * rendering/RenderGrid.h:
2442
2443 2017-02-22  Per Arne Vollan  <pvollan@apple.com>
2444
2445         [Win] Crash under CACFLayerTreeHost::acceleratedCompositingAvailable().
2446         https://bugs.webkit.org/show_bug.cgi?id=168711
2447
2448         Reviewed by Alex Christensen.
2449
2450         Add null pointer check.
2451
2452         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
2453         (WebCore::CACFLayerTreeHost::acceleratedCompositingAvailable):
2454
2455 2017-02-22  Carlos Garcia Campos  <cgarcia@igalia.com>
2456
2457         [GStreamer] Crash in MediaPlayerPrivateGStreamerMSE::buffered() when MEDIA_STREAM is disabled
2458         https://bugs.webkit.org/show_bug.cgi?id=168662
2459
2460         Reviewed by Michael Catanzaro.
2461
2462         When MEDIA_STREAM is disabled, if MediaPlayer::loadWithNextMediaEngine is called with a current engine and
2463         there's no type specified, the next media engine that is used is the MSE one. Since there's no actually a media
2464         stream, the engine is created but never loaded. When buffered is called it tries to use its media source that is
2465         nullptr. It doesn't happen when MEDIA_STREAM is enabled, because the next media engine returned is Owr that
2466         doesn't implement buffered and always returns an empty PlatformTimeRanges.
2467
2468         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2469         (WebCore::MediaPlayerPrivateGStreamerMSE::buffered): Return an empty PlatformTimeRanges if m_mediaSource is nullptr.
2470
2471 2017-02-21  Youenn Fablet  <youenn@apple.com>
2472
2473         [WebRTC][Mac] Activate libwebrtc
2474         https://bugs.webkit.org/show_bug.cgi?id=167293
2475
2476         Reviewed by Alex Christensen.
2477
2478         * Configurations/WebCore.xcconfig:
2479         * Configurations/WebCoreTestSupport.xcconfig:
2480         * Configurations/FeatureDefines.xcconfig:
2481
2482 2017-02-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2483
2484         Unreviewed. Fix WinCairo build after r212703.
2485
2486         * platform/TextureMapper.cmake:
2487
2488 2017-02-21  Per Arne Vollan  <pvollan@apple.com>
2489
2490         Add support for CSS properties paint-order, stroke-linecap, and stroke-linejoin in text rendering.
2491         https://bugs.webkit.org/show_bug.cgi?id=168601
2492         rdar://problem/30583872
2493
2494         Reviewed by Simon Fraser.
2495
2496         Text rendering should respect the CSS properties paint-order, stroke-linecap, and stroke-linejoin,
2497         see https://drafts.fxtf.org/paint/. The text rendering changes are mainly in the TextPainter class,
2498         where text is painted in three phases (fill, stroke, markers), where the order follows the
2499         paint-order property. The linecap and linejoin properties are set on the graphics context before
2500         rendering the text.
2501
2502         Tests: fast/css/paint-order.html
2503                fast/css/paint-order-shadow.html
2504
2505         * css/CSSComputedStyleDeclaration.cpp:
2506         (WebCore::paintOrder):
2507         * css/StyleBuilderConverter.h:
2508         (WebCore::StyleBuilderConverter::convertPaintOrder):
2509         * rendering/TextPaintStyle.cpp:
2510         (WebCore::computeTextPaintStyle):
2511         (WebCore::updateGraphicsContext):
2512         * rendering/TextPaintStyle.h:
2513         * rendering/TextPainter.cpp:
2514         (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded):
2515         * rendering/style/RenderStyle.cpp:
2516         (WebCore::RenderStyle::paintTypesForPaintOrder):
2517         * rendering/style/RenderStyle.h:
2518         (WebCore::RenderStyle::setPaintOrder):
2519         (WebCore::RenderStyle::initialPaintOrder):
2520         * rendering/style/RenderStyleConstants.h:
2521         * rendering/style/SVGRenderStyleDefs.h:
2522         * rendering/style/StyleRareInheritedData.cpp:
2523         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
2524         * rendering/svg/RenderSVGShape.cpp:
2525         (WebCore::RenderSVGShape::fillStrokeMarkers):
2526         * rendering/svg/SVGInlineTextBox.cpp:
2527         (WebCore::SVGInlineTextBox::paint):
2528
2529 2017-02-21  Joseph Pecoraro  <pecoraro@apple.com>
2530
2531         [User Timing] Throw a SyntaxError for performance.measure if mark name is not found
2532         https://bugs.webkit.org/show_bug.cgi?id=168707
2533
2534         Reviewed by Ryosuke Niwa.
2535
2536         Test: performance-api/performance-measure-name.html
2537
2538         * page/PerformanceUserTiming.cpp:
2539         (WebCore::UserTiming::findExistingMarkStartTime):
2540         Instead of returning zero, throw a SyntaxError. This is more in line
2541         with User Timing Level 1 and behavior in Window. This is an issue with
2542         the Level 2 spec: https://github.com/w3c/user-timing/issues/21
2543
2544 2017-02-21  Ryan Haddad  <ryanhaddad@apple.com>
2545
2546         Unreviewed attempt to fix the Windows build.
2547
2548         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
2549         (PlatformCALayerWin::supportsSubpixelAntialiasedText):
2550
2551 2017-02-21  Ryan Haddad  <ryanhaddad@apple.com>
2552
2553         Unreviewed, rolling out r212737.
2554
2555         This change caused an existing LayoutTest to crash.
2556
2557         Reverted changeset:
2558
2559         "REGRESSION(r207669): Crash after mutating selector text"
2560         https://bugs.webkit.org/show_bug.cgi?id=168655
2561         http://trac.webkit.org/changeset/212737
2562
2563 2017-02-21  Chris Dumez  <cdumez@apple.com>
2564
2565         REGRESSION (r207720): /more/conformance/conformance/quickCheckAPI-S_V.html test fails
2566         https://bugs.webkit.org/show_bug.cgi?id=168632
2567         <rdar://problem/30620129>
2568
2569         Reviewed by Darin Adler.
2570
2571         After r207720, the following WebGL conformance tests started failing:
2572         - /more/conformance/conformance/quickCheckAPI-S_V.html
2573         - /context/context-lost.html
2574
2575         We started throwing security errors in case where we did not before.
2576         Chrome and Firefox are both passing these tests so our new behavior was not interoperable.
2577
2578         This patch reverts part of r207720 to restore our previous behavior.
2579
2580         * html/canvas/WebGLRenderingContextBase.cpp:
2581         (WebCore::WebGLRenderingContextBase::texSubImage2D):
2582         (WebCore::WebGLRenderingContextBase::texImage2D):
2583         (WebCore::WebGLRenderingContextBase::validateHTMLImageElement):
2584         (WebCore::WebGLRenderingContextBase::validateHTMLCanvasElement):
2585         (WebCore::WebGLRenderingContextBase::validateHTMLVideoElement):
2586         * html/canvas/WebGLRenderingContextBase.h:
2587
2588 2017-02-21  Dean Jackson  <dino@apple.com>
2589
2590         No need for static attributes when creating a pixel format
2591         https://bugs.webkit.org/show_bug.cgi?id=168688
2592         <rdar://problem/30642256>
2593
2594         Reviewed by Myles Maxfield.
2595
2596         Just create the attributes when needed.
2597
2598         * platform/graphics/mac/GraphicsContext3DMac.mm:
2599         (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
2600
2601 2017-02-20  Filip Pizlo  <fpizlo@apple.com>
2602
2603         The collector thread should only start when the mutator doesn't have heap access
2604         https://bugs.webkit.org/show_bug.cgi?id=167737
2605
2606         Reviewed by Keith Miller.
2607
2608         Added new tests in JSTests.
2609         
2610         The WebCore changes involve:
2611         
2612         - Refactoring around new header discipline.
2613         
2614         - Adding crazy GC APIs to window.internals to enable us to test the GC's runloop discipline.
2615
2616         * ForwardingHeaders/heap/GCFinalizationCallback.h: Added.
2617         * ForwardingHeaders/heap/IncrementalSweeper.h: Added.
2618         * ForwardingHeaders/heap/MachineStackMarker.h: Added.
2619         * ForwardingHeaders/heap/RunningScope.h: Added.
2620         * bindings/js/CommonVM.cpp:
2621         * testing/Internals.cpp:
2622         (WebCore::Internals::parserMetaData):
2623         (WebCore::Internals::isReadableStreamDisturbed):
2624         (WebCore::Internals::isGCRunning):
2625         (WebCore::Internals::addGCFinalizationCallback):
2626         (WebCore::Internals::stopSweeping):
2627         (WebCore::Internals::startSweeping):
2628         * testing/Internals.h:
2629         * testing/Internals.idl:
2630
2631 2017-02-20  Simon Fraser  <simon.fraser@apple.com>
2632
2633         Add support to PlatformCALayer/GraphicsLayerCA for subpixel-antialiased text, with a Setting and a MiniBrowser switch
2634         https://bugs.webkit.org/show_bug.cgi?id=168620
2635         <rdar://problem/30617772>
2636
2637         Reviewed by Tim Horton.
2638
2639         Add a Setting for subpixel-antialiased layer text. Plumb this through GraphicsLayerCA and
2640         PlatformCALayer, where it ultimately affects the layer contents format.
2641         
2642         TileControllers are slightly special because we communicate with them via an Obj-C
2643         WebTiledBackingLayer.
2644
2645         Test: compositing/contents-format/subpixel-antialiased-text-enabled.html
2646
2647         * page/Settings.in:
2648         * platform/graphics/GraphicsLayer.cpp:
2649         (WebCore::GraphicsLayer::GraphicsLayer):
2650         (WebCore::GraphicsLayer::dumpProperties):
2651         * platform/graphics/GraphicsLayer.h:
2652         (WebCore::GraphicsLayer::supportsSubpixelAntialiasedText):
2653         (WebCore::GraphicsLayer::setSupportsSubpixelAntialiasedText):
2654         * platform/graphics/ca/GraphicsLayerCA.cpp:
2655         (WebCore::GraphicsLayerCA::setSupportsSubpixelAntialiasedText):
2656         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
2657         (WebCore::GraphicsLayerCA::updateSupportsSubpixelAntialiasedText):
2658         * platform/graphics/ca/GraphicsLayerCA.h:
2659         * platform/graphics/ca/PlatformCALayer.cpp:
2660         (WebCore::PlatformCALayer::drawRepaintIndicator):
2661         * platform/graphics/ca/PlatformCALayer.h:
2662         * platform/graphics/ca/TileController.cpp:
2663         (WebCore::TileController::setWantsDeepColorBackingStore):
2664         (WebCore::TileController::setSupportsSubpixelAntialiasedText):
2665         (WebCore::TileController::setTilesOpaque):
2666         * platform/graphics/ca/TileController.h:
2667         * platform/graphics/ca/TileGrid.cpp:
2668         (WebCore::TileGrid::updateTileLayerProperties):
2669         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
2670         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2671         (PlatformCALayerCocoa::supportsSubpixelAntialiasedText):
2672         (PlatformCALayerCocoa::setSupportsSubpixelAntialiasedText):
2673         (layerContentsFormat):
2674         (PlatformCALayerCocoa::updateContentsFormat):
2675         (PlatformCALayer::drawLayerContents):
2676         * platform/graphics/ca/cocoa/WebTiledBackingLayer.h:
2677         * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
2678         (-[WebTiledBackingLayer drawsAsynchronously]):
2679         (-[WebTiledBackingLayer setSupportsSubpixelAntialiasedText:]):
2680         (-[WebTiledBackingLayer supportsSubpixelAntialiasedText]):
2681         * platform/spi/cocoa/QuartzCoreSPI.h:
2682         * rendering/RenderLayerBacking.cpp:
2683         (WebCore::RenderLayerBacking::createGraphicsLayer):
2684
2685 2017-02-21  Chris Dumez  <cdumez@apple.com>
2686
2687         REGRESSION (203941): iAd Producer: Clicking buttons in Preview does not work
2688         https://bugs.webkit.org/show_bug.cgi?id=168677
2689         <rdar://problem/30640101>
2690
2691         Reviewed by Ryosuke Niwa.
2692
2693         Add quirk to initMouseEvent to unbreak iAd Producer.
2694
2695         * dom/MouseEvent.cpp:
2696         (WebCore::MouseEvent::initMouseEventQuirk):
2697         * dom/MouseEvent.h:
2698         * dom/MouseEvent.idl:
2699         * platform/RuntimeApplicationChecks.h:
2700         * platform/RuntimeApplicationChecks.mm:
2701         (WebCore::MacApplication::isIADProducer):
2702
2703 2017-02-21  Jer Noble  <jer.noble@apple.com>
2704
2705         AudioSampleDataSource doesn't need to use the m_scratchBuffer on the pulling thread
2706         https://bugs.webkit.org/show_bug.cgi?id=168640
2707
2708         Reviewed by Eric Carlson.
2709
2710         Rather than copying the pulled data into a scratch buffer, applying a volume transformation
2711         and then copying back out, just do the volume transformation in-place in the destination
2712         buffer.
2713
2714         * platform/audio/mac/AudioSampleDataSource.cpp:
2715         (WebCore::AudioSampleDataSource::pullSamplesInternal):
2716
2717 2017-02-21  Youenn Fablet  <youenn@apple.com>
2718
2719         [WebRTC] Implement Incoming libwebrtc audio source support.
2720         https://bugs.webkit.org/show_bug.cgi?id=167961
2721
2722         Reviewed by Eric Carlson.
2723
2724         Hook libwebrtc incoming audio source into WebCore audio rendering path.
2725         Manually testing that muted sources produce data with zeros and unmuted sources provide data with non zeros.
2726
2727         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
2728         (WebCore::RealtimeIncomingAudioSource::create):
2729         (WebCore::streamDescription):
2730         (WebCore::RealtimeIncomingAudioSource::OnData):
2731         (WebCore::RealtimeIncomingAudioSource::audioSourceProvider):
2732         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
2733
2734 2017-02-21  Simon Fraser  <simon.fraser@apple.com>
2735
2736         Fix ImageBitmap comment to not insert a <canvas>.
2737
2738         * features.json:
2739
2740 2017-02-21  Alex Christensen  <achristensen@webkit.org>
2741
2742         Fix CMake build.
2743
2744         * PlatformMac.cmake:
2745
2746 2017-02-21  Simon Fraser  <simon.fraser@apple.com>
2747
2748         Add Media Streams and Capture to features.json.
2749
2750         * features.json:
2751
2752 2017-02-21  Jiewen Tan  <jiewen_tan@apple.com>
2753
2754         Clarify the status of 'webkitSubtle' and 'subtle' attributes on the WebCrypto API.
2755
2756         * features.json:
2757
2758 2017-02-21  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2759
2760         [Readable Streams API] Add ReadableStreamBYOBRequest view getter
2761         https://bugs.webkit.org/show_bug.cgi?id=168652
2762
2763         Reviewed by Youenn Fablet.
2764
2765         Implemented getter for ReadableStreamBYOBRequest view attribute.
2766         
2767         Added 1 test checking that view length corresponds to autoAllocateChunkSize.
2768         Also updated test expectations for W3C imported tests.
2769
2770         * Modules/streams/ReadableByteStreamInternals.js:
2771         (isReadableStreamBYOBRequest): Added.
2772         * Modules/streams/ReadableStreamBYOBRequest.js:
2773         (view): Added.
2774
2775 2017-02-21  Simon Fraser  <simon.fraser@apple.com>
2776
2777         Clarify the status of 'webkitSubtle' and 'subtle' attributes on the WebCrypto API.
2778
2779         * features.json:
2780
2781 2017-02-21  Youenn Fablet  <youenn@apple.com>
2782
2783         [WebRTC] ICE candidates should be filtered according a policy
2784         https://bugs.webkit.org/show_bug.cgi?id=168348
2785
2786         Reviewed by Alex Christensen.
2787
2788         Covered by manual tests. Should be covered in the future by layout tests with dedicated internals API.
2789
2790         Adding support for ICE candidate filtering at RTCPeerConnection level.
2791         If ICE candidate filtering is on (by default), host candidates are stored and not sent immediately.
2792         Reflexive candidates are purged from raddr information to not leak the host IP address.
2793
2794         Stored candidates may be advertised to the JS layer if RTCController is notified of a change of filtering policy.
2795         To implement that, PeerConnectionBackend stores all filtered out candidates and RTCPeerConnection register
2796         themselves to RTCController to get notifications of filtering policy changes.
2797
2798         Making RTCPeerConnection use setPendingActivity throughout its lifetime.
2799         This ensures it does not get collected until the page is off or close() is called on the object.
2800
2801         Adding support for enumerating or not all interfaces at libwebrtc level.
2802         This choice is done at creation of the peer connection.
2803
2804         * Modules/mediastream/PeerConnectionBackend.cpp:
2805         (WebCore::PeerConnectionBackend::enableICECandidateFiltering):
2806         (WebCore::PeerConnectionBackend::disableICECandidateFiltering):
2807         (WebCore::filterICECandidate):
2808         (WebCore::PeerConnectionBackend::newICECandidate):
2809         * Modules/mediastream/PeerConnectionBackend.h:
2810         * Modules/mediastream/RTCController.cpp: Added.
2811         (WebCore::RTCController::remove):
2812         (WebCore::RTCController::add):
2813         (WebCore::RTCController::disableICECandidateFiltering):
2814         (WebCore::RTCController::enableICECandidateFiltering):
2815         * Modules/mediastream/RTCController.h: Added.
2816         * Modules/mediastream/RTCPeerConnection.cpp:
2817         (WebCore::RTCPeerConnection::create):
2818         (WebCore::RTCPeerConnection::close):
2819         (WebCore::RTCPeerConnection::rtcController):
2820         (WebCore::RTCPeerConnection::registerToController):
2821         (WebCore::RTCPeerConnection::unregisterFromController):
2822         * Modules/mediastream/RTCPeerConnection.h:
2823         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2824         (WebCore::LibWebRTCMediaEndpoint::OnIceCandidate):
2825         * WebCore.xcodeproj/project.pbxproj:
2826         * page/Page.h:
2827         (WebCore::Page::rtcController):
2828         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2829         (WebCore::LibWebRTCProvider::createPeerConnection):
2830         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2831
2832 2017-02-21  Jiewen Tan  <jiewen_tan@apple.com>
2833
2834         Unreviewed, update WebCrypto API feature status.
2835
2836         * features.json:
2837
2838 2017-02-21  Simon Fraser  <simon.fraser@apple.com>
2839
2840         Fix the bad JSON.
2841
2842         * features.json:
2843
2844 2017-02-21  Andreas Kling  <akling@apple.com>
2845
2846         [iOS] WebKit1 should use shared memory pressure handler code.
2847         <https://webkit.org/b/168653>
2848
2849         Reviewed by Antti Koivisto.
2850
2851         Remove iOS WebKit1 specific members and code from MemoryPressureHandler in favor
2852         of using the same code that iOS WebKit2 and macOS WebKit uses.
2853
2854         * page/cocoa/MemoryReleaseCocoa.mm:
2855         (WebCore::platformReleaseMemory): Add two cleanup calls that were only in the iOS WebView code.
2856         * platform/MemoryPressureHandler.h:
2857         (WebCore::MemoryPressureHandler::m_releaseMemoryBlock): Deleted.
2858         * platform/cocoa/MemoryPressureHandlerCocoa.mm:
2859         (WebCore::respondToMemoryPressureCallback): Deleted.
2860         (WebCore::MemoryPressureHandler::installMemoryReleaseBlock): Deleted.
2861         (WebCore::MemoryPressureHandler::setReceivedMemoryPressure): Deleted.
2862         (WebCore::MemoryPressureHandler::clearMemoryPressure): Deleted.
2863         (WebCore::MemoryPressureHandler::shouldWaitForMemoryClearMessage): Deleted.
2864         (WebCore::MemoryPressureHandler::respondToMemoryPressureIfNeeded): Deleted.
2865
2866 2017-02-21  Anders Carlsson  <andersca@apple.com>
2867
2868         Fix two failing WebKit legacy tests
2869         https://bugs.webkit.org/show_bug.cgi?id=168667
2870
2871         Reviewed by Tim Horton.
2872
2873         Handle the NSPasteboardTypeString type.
2874
2875         * platform/mac/PasteboardMac.mm:
2876         (WebCore::Pasteboard::read):
2877         (WebCore::addHTMLClipboardTypesForCocoaType):
2878
2879 2017-02-21  Simon Fraser  <simon.fraser@apple.com>
2880
2881         Add Web Audio and Web MIDI to features.json.
2882
2883         * features.json:
2884
2885 2017-02-21  Antti Koivisto  <antti@apple.com>
2886
2887         REGRESSION(r207669): Crash after mutating selector text
2888         https://bugs.webkit.org/show_bug.cgi?id=168655
2889         <rdar://problem/30632111>
2890
2891         Reviewed by Brent Fulgham.
2892
2893         Test: fast/css/selector-text-mutation-crash.html
2894
2895         * style/StyleScope.cpp:
2896         (WebCore::Style::Scope::scheduleUpdate):
2897
2898         Clear the style resolver immediately if style sheet content changes. The resolver may
2899         have data structures that point to the old sheet contents.
2900
2901         The resolver would get wiped anyway when the scheduled update actually occurs.
2902
2903 2017-02-21  Jiewen Tan  <jiewen_tan@apple.com>
2904
2905         [WebCrypto] Add support for AES-CFB
2906         https://bugs.webkit.org/show_bug.cgi?id=168344
2907         <rdar://problem/20940221>
2908
2909         Reviewed by Brent Fulgham.
2910
2911         This patch adds support for AES-CFB. Operations of AES-CFB include: encrypt, decrypt, generateKey,
2912         importKey, exportKey, wrapKey, and unwrapKey. This implementation follows a slightly old version
2913         of WebCryptoAPI spec: https://www.w3.org/TR/2014/CR-WebCryptoAPI-20141211/#aes-cfb.
2914
2915         Tests: crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters.html
2916                crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters.html
2917                crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public.html
2918                crypto/subtle/aes-cfb-generate-export-key-jwk-length-128.html
2919                crypto/subtle/aes-cfb-generate-export-key-jwk-length-192.html
2920                crypto/subtle/aes-cfb-generate-export-key-jwk-length-256.html
2921                crypto/subtle/aes-cfb-generate-export-raw-key.html
2922                crypto/subtle/aes-cfb-generate-key-encrypt-decrypt.html
2923                crypto/subtle/aes-cfb-generate-key.html
2924                crypto/subtle/aes-cfb-import-jwk-key-length-128.html
2925                crypto/subtle/aes-cfb-import-jwk-key-length-192.html
2926                crypto/subtle/aes-cfb-import-jwk-key-length-256.html
2927                crypto/subtle/aes-cfb-import-key-decrypt.html
2928                crypto/subtle/aes-cfb-import-key-encrypt.html
2929                crypto/subtle/aes-cfb-import-key-unwrap-jwk-key.html
2930                crypto/subtle/aes-cfb-import-key-unwrap-raw-key.html
2931                crypto/subtle/aes-cfb-import-key-wrap-jwk-key.html
2932                crypto/subtle/aes-cfb-import-key-wrap-raw-key.html
2933                crypto/subtle/aes-cfb-import-raw-key.html
2934                crypto/workers/subtle/aes-cfb-import-key-decrypt.html
2935                crypto/workers/subtle/aes-cfb-import-key-encrypt.html
2936                crypto/workers/subtle/aes-cfb-import-key-unwrap-key.html
2937                crypto/workers/subtle/aes-cfb-import-key-wrap-key.html
2938
2939         * CMakeLists.txt:
2940         * DerivedSources.make:
2941         * PlatformGTK.cmake:
2942         * PlatformMac.cmake:
2943         * WebCore.xcodeproj/project.pbxproj:
2944         Add CryptoAlgorithmAES_CFB.cpp,
2945         change AesCbcParams.idl to AesCbcCfbParams.idl.
2946         * bindings/js/JSSubtleCryptoCustom.cpp:
2947         (WebCore::normalizeCryptoAlgorithmParameters):
2948         Add support for AES-CFB.
2949         * crypto/CryptoAlgorithm.h:
2950         Include <wtf/Variant.h>.
2951         * crypto/CryptoAlgorithmParameters.h:
2952         Add support for AES-CFB.
2953         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
2954         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
2955         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
2956         Rename CryptoAlgorithmAesCbcParams to CryptoAlgorithmAesCbcCfbParams.
2957         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp: Added.
2958         (WebCore::usagesAreInvalidForCryptoAlgorithmAES_CFB):
2959         (WebCore::CryptoAlgorithmAES_CFB::create):
2960         (WebCore::CryptoAlgorithmAES_CFB::identifier):
2961         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
2962         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
2963         (WebCore::CryptoAlgorithmAES_CFB::generateKey):
2964         (WebCore::CryptoAlgorithmAES_CFB::importKey):
2965         (WebCore::CryptoAlgorithmAES_CFB::exportKey):
2966         * crypto/algorithms/CryptoAlgorithmAES_CFB.h: Added.
2967         * crypto/gnutls/CryptoAlgorithmAES_CFBGnuTLS.cpp: Added.
2968         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2969         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2970         Add dummy support of AES_CFB for GTK+.
2971         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
2972         (WebCore::transformAES_CBC):
2973         Drop conditional PLATFORM(COCOA).
2974         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2975         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2976         Rename CryptoAlgorithmAesCbcParams to CryptoAlgorithmAesCbcCfbParams.
2977         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp: Added.
2978         (WebCore::transformAES_CFB):
2979         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2980         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2981         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
2982         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
2983         Add support for AES-CFB.
2984         * crypto/parameters/AesCbcCfbParams.idl: Renamed from Source/WebCore/crypto/parameters/AesCbcParams.idl.
2985         * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h.
2986         Since dictionaries AesCbcParams and AesCfbParams are essentially the same, I combine them together in our implementations.
2987
2988 2017-02-21  Wenson Hsieh  <wenson_hsieh@apple.com>
2989
2990         Unreviewed, fix the ToT iOS build
2991
2992         Adopt updated UIKit SPI and remove calls to the deprecated version.
2993
2994         * platform/ios/WebItemProviderPasteboard.mm:
2995         (-[WebItemProviderPasteboard setItems:]):
2996
2997 2017-02-21  Per Arne Vollan  <pvollan@apple.com>
2998
2999         [Win] WebView is not painting in accelerated compositing mode.
3000         https://bugs.webkit.org/show_bug.cgi?id=168654
3001
3002         Reviewed by Brent Fulgham.
3003
3004         Initializing the uncommitted layer change flags to CoverageRectChanged in GraphicsLayerCA,
3005         stops WebView painting in accelerated mode.
3006
3007         Covered by existing tests.
3008
3009         * platform/graphics/ca/GraphicsLayerCA.h:
3010
3011 2017-02-21  Jer Noble  <jer.noble@apple.com>
3012
3013         Make logging in high-priority audio threads less expensive
3014         https://bugs.webkit.org/show_bug.cgi?id=168639
3015
3016         Reviewed by Jon Lee.
3017
3018         Logging from inside a high-priority audio thread will make a number of calls to malloc, block, and
3019         therefore cause audio glitches. Make this logging less expensive by dispatching to the main thread
3020         before creating and outputting the log string.
3021
3022         * WebCore.xcodeproj/project.pbxproj:
3023         * platform/audio/mac/AudioSampleDataSource.mm: Renamed from Source/WebCore/platform/audio/mac/AudioSampleDataSource.cpp.
3024         (WebCore::AudioSampleDataSource::pushSamplesInternal):
3025         (WebCore::AudioSampleDataSource::pullSamplesInternal):
3026
3027 2017-02-21  Jer Noble  <jer.noble@apple.com>
3028
3029         Give the Mock audio input a "hum" to make drop-outs more detectable
3030         https://bugs.webkit.org/show_bug.cgi?id=168641
3031
3032         Reviewed by Eric Carlson.
3033
3034         Add two helper functions to generate waveforms: addHum() and writeHum(). Use these methods
3035         to create a bip-bop audio buffer which can be used to "blit" a portion the waveform into the
3036         destination buffer during rendering. The background hum must be seamless across multiple
3037         pull operations, so add the hum sound during rendering.
3038
3039         To ensure the waveform buffer is created, initialize the sampleRate to zero, then call
3040         applySampleRate() with the desired default rate, 44.1kHz.
3041
3042         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
3043         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
3044         (WebCore::writeHum):
3045         (WebCore::addHum):
3046         (WebCore::MockRealtimeAudioSource::create):
3047         (WebCore::MockRealtimeAudioSourceMac::render):
3048         (WebCore::MockRealtimeAudioSourceMac::applySampleRate):
3049
3050 2017-02-21  Jer Noble  <jer.noble@apple.com>
3051
3052         Make TrackPrivateBase ThreadSafeRefCounted, so that it can be retained in non-main threads
3053         https://bugs.webkit.org/show_bug.cgi?id=168642
3054
3055         Reviewed by Eric Carlson.
3056
3057         AudioTrackPrivateMediaStreamCocoa has two entry points from background threads:
3058         audioSamplesAvailable() and render(). Protect against being destroyed mid-execution by
3059         retaining this for the duration of those methods.
3060
3061         * platform/graphics/TrackPrivateBase.h:
3062         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3063         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
3064         (WebCore::AudioTrackPrivateMediaStreamCocoa::render):
3065
3066 2017-02-21  Jer Noble  <jer.noble@apple.com>
3067
3068         Pulling too quickly from an AudioSampleDataSource should increase the pre-buffer amount
3069         https://bugs.webkit.org/show_bug.cgi?id=168645
3070
3071         Reviewed by Eric Carlson.
3072
3073         If a pull operation runs past the end of the buffered range of a CARingBuffer, the underrun
3074         is zero-filled, causing an audible glitch.  In this case, bias m_outputSampleOffset by the
3075         amount of the underrun, which should keep the underrun from reoccurring.
3076
3077         * platform/audio/mac/AudioSampleDataSource.cpp:
3078         (WebCore::AudioSampleDataSource::pullSamplesInternal):
3079
3080 2017-02-21  Jer Noble  <jer.noble@apple.com>
3081
3082         AudioSampleBufferList::zeroABL() takes a byte-count, not a sample-count.
3083         https://bugs.webkit.org/show_bug.cgi?id=168635
3084
3085         Reviewed by Jon Lee.
3086
3087         * platform/audio/mac/AudioSampleDataSource.cpp:
3088         (WebCore::AudioSampleDataSource::pullSamplesInternal):
3089         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
3090
3091 2017-02-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3092
3093         REGRESSION(r212681): Crash when dragging links without a drag image
3094         https://bugs.webkit.org/show_bug.cgi?id=168648
3095
3096         Reviewed by Tim Horton.
3097
3098         This happens in GTK+ port, because we don't use a drag image for links.
3099
3100         Fixes: editing/pasteboard/drop-link.html
3101                editing/pasteboard/drop-text-without-selection.html
3102                editing/pasteboard/files-during-page-drags.html
3103                fast/events/content-changed-during-drop.html
3104                fast/events/drag-and-drop-link-fast-multiple-times-does-not-crash.html
3105                fast/events/drag-and-drop-link-into-focused-contenteditable.html
3106                fast/events/drag-and-drop-link.html
3107                fast/events/drag-in-frames.html
3108                fast/events/drag-parent-node.html
3109                fast/events/shift-drag-selection-on-link-triggers-drag-n-drop.html
3110
3111         * page/DragController.cpp:
3112         (WebCore::DragController::startDrag): Do not try to use drag image and its size when createDragImageForLink
3113         returns nullptr.
3114
3115 2017-02-21  Alex Christensen  <achristensen@webkit.org>
3116
3117         Unreviewed, rolling out r212699.
3118
3119         Internal build not ready
3120
3121         Reverted changeset:
3122
3123         "[WebRTC][Mac] Activate libwebrtc"
3124         https://bugs.webkit.org/show_bug.cgi?id=167293
3125         http://trac.webkit.org/changeset/212699
3126
3127 2017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3128
3129         Remove ENABLE_THREADED_COMPOSITOR build option
3130         https://bugs.webkit.org/show_bug.cgi?id=168606
3131
3132         Reviewed by Michael Catanzaro.
3133
3134         * platform/TextureMapper.cmake:
3135
3136 2017-02-20  Alex Christensen  <achristensen@webkit.org>
3137
3138         Fix some 32-bit builds after r212699
3139
3140         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
3141         (WebCore::RealtimeIncomingVideoSource::OnFrame):
3142         Explicitly cast OSStatus to int for logging.
3143
3144 2017-02-20  Joseph Pecoraro  <pecoraro@apple.com>
3145
3146         Remove unnecessary PerformanceEntry virtual methods
3147         https://bugs.webkit.org/show_bug.cgi?id=168633
3148
3149         Reviewed by Ryosuke Niwa.
3150
3151         * page/PerformanceEntry.h:
3152         (WebCore::PerformanceEntry::isResource):
3153         (WebCore::PerformanceEntry::isMark):
3154         (WebCore::PerformanceEntry::isMeasure):
3155         Implement based on the Type.
3156
3157         * page/PerformanceMark.h:
3158         * page/PerformanceMeasure.h:
3159         * page/PerformanceResourceTiming.h:
3160         Remove virtual overrides.
3161
3162 2017-02-20  Youenn Fablet  <youenn@apple.com>
3163
3164         [WebRTC][Mac] Activate libwebrtc
3165         https://bugs.webkit.org/show_bug.cgi?id=167293
3166
3167         Reviewed by Alex Christensen.
3168
3169         * Configurations/WebCore.xcconfig:
3170         * Configurations/WebCoreTestSupport.xcconfig:
3171
3172 2017-02-20  Joseph Pecoraro  <pecoraro@apple.com>
3173
3174         ASSERTION FAILED: m_normalWorld->hasOneRef() under WorkerThread::stop
3175         https://bugs.webkit.org/show_bug.cgi?id=168356
3176         <rdar://problem/30592486>
3177
3178         Reviewed by Ryosuke Niwa.
3179
3180         * page/DOMWindow.cpp:
3181         (WebCore::DOMWindow::removeAllEventListeners):
3182         Remove Performance object EventListeners.
3183
3184         * workers/WorkerGlobalScope.cpp:
3185         (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
3186         (WebCore::WorkerGlobalScope::removeAllEventListeners):
3187         (WebCore::WorkerGlobalScope::performance):
3188         * workers/WorkerGlobalScope.h:
3189         Remove Performance object EventListeners.
3190         Also clear Performance early in destruction since its ContextDestructionObserver
3191         destruction makes checks about the WorkerThread.
3192
3193 2017-02-20  Jer Noble  <jer.noble@apple.com>
3194
3195         Local audio-only stream will not trigger playback to begin
3196         https://bugs.webkit.org/show_bug.cgi?id=168412
3197
3198         Reviewed by Youenn Fablet.
3199
3200         Test: fast/mediastream/local-audio-playing-event.html
3201
3202         With video-bearing streams, the first video sample emitted from the stream causes the
3203         readyState to move from HAVE_NOTHING to HAVE_ENOUGH_DATA. Wire up this same behavior for
3204         audio-bearing streams. Add a MediaStreamTrackPrivate::Observer callback method
3205         audioSamplesAvailable(), which gets passed up to MediaPlayerPrivateMediaStreamAVFObjC.
3206         Because this callback may be (and probably will be) called on a background thread, run the
3207         updateReadyState() task in a scheduledDeferredTask().
3208
3209         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3210         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3211         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSamplesAvailable):
3212         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
3213         * platform/mediastream/MediaStreamTrackPrivate.cpp:
3214         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
3215         * platform/mediastream/MediaStreamTrackPrivate.h:
3216         (WebCore::MediaStreamTrackPrivate::Observer::audioSamplesAvailable):
3217
3218 2017-02-20  Zalan Bujtas  <zalan@apple.com>
3219
3220         Simple line layout: Implement absoluteQuadsForRange.
3221         https://bugs.webkit.org/show_bug.cgi?id=168613
3222         <rdar://problem/30614618>
3223
3224         Reviewed by Simon Fraser.
3225
3226         This patch ensures that the commonly used Range::getClientRects calls do not
3227         throw us off of the simple line layout path.
3228
3229         Test: fast/dom/Range/simple-line-layout-getclientrects.html
3230
3231         * rendering/RenderText.cpp:
3232         (WebCore::RenderText::absoluteQuadsForRange):
3233         * rendering/SimpleLineLayoutFunctions.cpp:
3234         (WebCore::SimpleLineLayout::collectAbsoluteQuadsForRange): Special case empty ranges with multiple empty runs.
3235         * rendering/SimpleLineLayoutFunctions.h:
3236         * rendering/SimpleLineLayoutResolver.cpp:
3237         (WebCore::SimpleLineLayout::RunResolver::rangeForRendererWithOffsets):
3238         * rendering/SimpleLineLayoutResolver.h:
3239
3240 2017-02-20  Ryan Haddad  <ryanhaddad@apple.com>
3241
3242         Unreviewed, rolling out r212685.
3243
3244         This change broke the 32-bit Sierra build.
3245
3246         Reverted changeset:
3247
3248         "Resource Load Statistics: Add alternate classification
3249         method"
3250         https://bugs.webkit.org/show_bug.cgi?id=168347
3251         http://trac.webkit.org/changeset/212685
3252
3253 2017-02-20  Sam Weinig  <sam@webkit.org>
3254
3255         [WebIDL] Add support for constructors that have variadic parameters
3256         https://bugs.webkit.org/show_bug.cgi?id=168614
3257
3258         Reviewed by Alex Christensen.
3259
3260         In preparation of removing some more custom bindings, move the constructor calling
3261         code over to using GenerateParametersCheck completely. This required
3262         - Removing special case of NamedConstructors automatically getting a Document passed
3263           to them. The three named constructors that expected this have been updated to add
3264           the required attributes.
3265         - Add a version of the GenerateCallWith prologue for constructors.
3266         - Remove now unnecessary argumentCount return value from GenerateParametersCheck.
3267
3268         * bindings/scripts/CodeGeneratorJS.pm:
3269         (GenerateImplementation):
3270         (GenerateCallWithUsingReferences):
3271         (GenerateCallWithUsingPointers):
3272         (GenerateConstructorCallWithUsingPointers):
3273         (GenerateCallWith):
3274         (GenerateParametersCheck):
3275         (GenerateConstructorDefinition):
3276
3277         * bindings/scripts/test/JS/JSTestInterface.cpp:
3278         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
3279         * bindings/scripts/test/JS/JSTestObj.cpp:
3280         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
3281         Update results for more consistent placement of ScriptExecutionContext and Document
3282         accessors, add UNLIKELY to context checks, and remove automatic Document passing
3283         for NamedConstructors.
3284
3285         * html/HTMLAudioElement.idl:
3286         * html/HTMLImageElement.idl:
3287         * html/HTMLOptionElement.idl:
3288         Add ConstructorCallWith=Document.
3289
3290 2017-02-20  John Wilander  <wilander@apple.com>
3291
3292         Resource Load Statistics: Add alternate classification method
3293         https://bugs.webkit.org/show_bug.cgi?id=168347
3294         <rdar://problem/30352793>
3295
3296         Reviewed by Alex Christensen.
3297
3298         This patch only adds test infrastructure in WebCore.
3299
3300         Tests: http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html
3301                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html
3302                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html
3303                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html
3304                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html
3305                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html
3306                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html
3307                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html
3308
3309         * loader/ResourceLoadObserver.cpp:
3310         (WebCore::ResourceLoadObserver::setSubframeUnderTopFrameOrigin):
3311         (WebCore::ResourceLoadObserver::setSubresourceUnderTopFrameOrigin):
3312         (WebCore::ResourceLoadObserver::setSubresourceUniqueRedirectTo):
3313         * loader/ResourceLoadObserver.h:
3314
3315 2017-02-20  Anders Carlsson  <andersca@apple.com>
3316
3317         Use the new drag code path when dragging links
3318         https://bugs.webkit.org/show_bug.cgi?id=168612
3319
3320         Reviewed by Tim Horton.
3321
3322         * editing/Editor.cpp:
3323         (WebCore::Editor::copyURL):
3324         Use userVisibleString instead of fillInUserVisibleForm.
3325
3326         (WebCore::Editor::pasteboardWriterURL):
3327         New function that returns a PasteboardWriterData::URL for a given URL + title.
3328
3329         * editing/Editor.h:
3330         Add new members.
3331
3332         * editing/mac/EditorMac.mm:
3333         (WebCore::Editor::userVisibleString):
3334         (WebCore::Editor::fillInUserVisibleForm): Deleted.
3335         Add a getter instead of a function that fills in a struct member.
3336
3337         * page/DragController.cpp:
3338         (WebCore::DragController::startDrag):
3339         Add the new DragItem code path when dragging links.
3340
3341         * platform/PasteboardWriterData.cpp:
3342         (WebCore::PasteboardWriterData::isEmpty):
3343         Check for m_url as well.
3344
3345         (WebCore::PasteboardWriterData::setURL):
3346         Set m_url.
3347
3348         * platform/PasteboardWriterData.h:
3349         Add new members.
3350
3351         * platform/mac/PasteboardWriter.mm:
3352         (WebCore::toUTI):
3353         New helper function that returns an UTI from a pasteboard type.
3354
3355         (WebCore::createPasteboardWriter):
3356         Handle converting URLs to the various pasteboard types.
3357
3358 2017-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>
3359
3360         Add plumbing to the UI process for TextIndicatorData when computing the drag image
3361         https://bugs.webkit.org/show_bug.cgi?id=168583
3362         Work towards <rdar://problem/30313681>
3363
3364         Reviewed by Tim Horton.
3365
3366         Adds some additional arguments to drag image creation functions to allow platforms to specify TextIndicatorData
3367         for a link or selection-based DragImage. This TextIndicatorData is an optional member of the DragImage, and is
3368         propagated to the UI process via SetDragImage in the WebDragClient.
3369
3370         Additionally renames hasDataInteractionAtPosition to hasSelectionAtPosition to better reflect its purpose.
3371
3372         No new tests, since there is no behavior change.
3373
3374         * page/DragController.cpp:
3375         (WebCore::DragController::startDrag):
3376         * page/Page.cpp:
3377         (WebCore::Page::hasSelectionAtPosition):
3378         (WebCore::Page::hasDataInteractionAtPosition): Deleted.
3379         * page/Page.h:
3380         * platform/DragImage.cpp:
3381         (WebCore::createDragImageForSelection):
3382         (WebCore::createDragImageForLink):
3383         (WebCore::DragImage::operator=):
3384         * platform/DragImage.h:
3385         * platform/gtk/DragImageGtk.cpp:
3386         (WebCore::createDragImageForLink):
3387         * platform/mac/DragImageMac.mm:
3388         (WebCore::createDragImageForLink):
3389         * platform/win/DragImageWin.cpp:
3390         (WebCore::createDragImageForLink):
3391
3392 2017-02-20  Brent Fulgham  <bfulgham@apple.com>
3393
3394         Nullptr dereferences when stopping a load
3395         https://bugs.webkit.org/show_bug.cgi?id=168608
3396         <rdar://problem/29852056>
3397
3398         Reviewed by Ryosuke Niwa.
3399
3400         Don't attempt to notify a detached frame's load client that the load is
3401         stopped.
3402
3403         * loader/DocumentLoader.cpp:
3404         (WebCore::DocumentLoader::stopLoading): Check for null frame loader and
3405         bypass dereferencing it. 
3406
3407 2017-02-17  Anders Carlsson  <andersca@apple.com>
3408
3409         Add a new drag code path and use it for dragging plain text
3410         https://bugs.webkit.org/show_bug.cgi?id=168534
3411
3412         Reviewed by Geoffrey Garen.
3413
3414         The new code path is currently only used for plain text selection dragging.
3415
3416         * WebCore.xcodeproj/project.pbxproj:
3417         * page/DragClient.h:
3418         (WebCore::DragClient::useLegacyDragClient):
3419         Add a new member function. This currently returns true everywhere except legacy WebKit on Mac.
3420
3421         (WebCore::DragClient::beginDrag):
3422         Add new empty member function.
3423
3424         * page/DragController.cpp:
3425         (WebCore::dragImageAnchorPointForSelectionDrag):
3426         Helper function that returns the anchor point for a selection drag image.
3427
3428         (WebCore::DragController::startDrag):
3429         If we can use the new code path, set up a drag item with an image and pasteboard data.
3430
3431         (WebCore::DragController::beginDrag):
3432         New function that calls out to the client.
3433
3434         * page/DragController.h:
3435         Add new members.
3436
3437         * platform/DragItem.h:
3438         Add a new class - it's essentially a tuple of a drag image, an anchor point and the pasteboard data the item represents.
3439
3440         * platform/mac/PasteboardWriter.h:
3441         Rename createPasteboardWriting to createPasteboardWriter.
3442
3443         * platform/mac/PasteboardWriter.mm:
3444         (WebCore::createPasteboardWriter):
3445         Use the UTI pasteboard type.
3446
3447 2017-02-20  Alex Christensen  <achristensen@webkit.org>
3448
3449         Fix libwebrtc build after r212644.
3450         https://bugs.webkit.org/show_bug.cgi?id=168596
3451
3452         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3453         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
3454         m_endpoint changed from a c++ reference to a WTF::Ref, so we need to use operator -> instead of .
3455
3456 2017-02-20  Romain Bellessort  <romain.bellessort@crf.canon.fr>
3457
3458         [Readable Streams API] Add ReadableByteStreamController byobRequest attribute
3459         https://bugs.webkit.org/show_bug.cgi?id=168319
3460
3461         Reviewed by Youenn Fablet.
3462
3463         Added ReadableByteStreamController byobRequest attribute.
3464
3465         Added tests related to ReadableStreamBYOBRequest as a dedicated object
3466         and also as an attribute of ReadableByteStreamController.
3467
3468         * CMakeLists.txt: Added new files.
3469         * DerivedSources.cpp: Added new files.
3470         * DerivedSources.make: Added new files.
3471         * Modules/streams/ReadableByteStreamController.idl: Added byobRequest support.
3472         * Modules/streams/ReadableByteStreamController.js: Added byobRequest support.
3473         * Modules/streams/ReadableByteStreamInternals.js:
3474         (privateInitializeReadableStreamBYOBRequest): Added constructor.
3475         * Modules/streams/ReadableStreamBYOBRequest.idl: Added.
3476         * Modules/streams/ReadableStreamBYOBRequest.js: Added.
3477         (respond): Not implemented yet.
3478         (respondWithNewView): Not implemented yet.
3479         (view): Not implemented yet.
3480         * WebCore.xcodeproj/project.pbxproj: Added new files.
3481         * bindings/js/JSDOMGlobalObject.cpp: Added ReadableStreamBYOBRequest support.
3482         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
3483         (WebCore::JSDOMGlobalObject::finishCreation):
3484         (WebCore::JSDOMGlobalObject::visitChildren):
3485         * bindings/js/JSReadableStreamPrivateConstructors.cpp: Added ReadableStreamBYOBRequest support.
3486         (WebCore::constructJSReadableByteStreamController):
3487         (WebCore::constructJSReadableStreamBYOBRequest):
3488         (WebCore::JSBuiltinReadableStreamBYOBRequestPrivateConstructor::initializeExecutable):
3489         (WebCore::createReadableStreamBYOBRequestPrivateConstructor):
3490         * bindings/js/JSReadableStreamPrivateConstructors.h: Added ReadableStreamBYOBRequest support.
3491         * bindings/js/WebCoreBuiltinNames.h: Added ReadableStreamBYOBRequest support.
3492
3493 2017-02-20  Per Arne Vollan  <pvollan@apple.com>
3494
3495         [Win] Custom scale factor is not applied in all cases.
3496         https://bugs.webkit.org/show_bug.cgi?id=168117
3497
3498         Reviewed by Brent Fulgham.
3499
3500         We should not call the function deviceScaleFactorForWindow directly, since this
3501         will return the system scale factor, and ignore the custom scale factor.
3502
3503         * platform/graphics/ca/win/CACFLayerTreeHost.h:
3504         * platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp:
3505         (WebCore::WKCACFViewLayerTreeHost::initializeContext):
3506         (WebCore::WKCACFViewLayerTreeHost::resize):
3507         (WebCore::WKCACFViewLayerTreeHost::setScaleFactor):
3508         * platform/graphics/ca/win/WKCACFViewLayerTreeHost.h:
3509         * platform/win/GDIUtilities.h:
3510         (WebCore::makeScaledPoint):
3511         * platform/win/PlatformMouseEventWin.cpp:
3512         (WebCore::positionForEvent):
3513         * platform/win/PopupMenuWin.cpp:
3514         (WebCore::PopupMenuWin::show):
3515         (WebCore::PopupMenuWin::wndProc):
3516         * platform/win/PopupMenuWin.h:
3517
3518 2017-02-20  Jon Lee  <jonlee@apple.com>
3519
3520         Fix build error for iOS. Unreviewed.
3521
3522         * platform/graphics/GraphicsContext3D.cpp: Move stub function into !PLATFORM(COCOA) instead of !PLATFORM(MAC).
3523
3524 2017-02-20  Jon Lee  <jonlee@apple.com>
3525
3526         Unreviewed, rolling out r212639.
3527
3528         Have a fix for the linker error on iOS.
3529
3530         Reverted changeset:
3531
3532         "Unreviewed, rolling out r212637."
3533         https://bugs.webkit.org/show_bug.cgi?id=168595
3534         http://trac.webkit.org/changeset/212639
3535
3536 2017-02-20  Youenn Fablet  <youenn@apple.com>
3537
3538         [WebRTC] Fix some memory leaks in libwebrtc binding code
3539         https://bugs.webkit.org/show_bug.cgi?id=168596
3540
3541         Reviewed by Eric Carlson.
3542
3543         Covered by manual testing.
3544
3545         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3546         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::StatsCollector): Using the libwebrtc way of creating such objects.
3547         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
3548         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::create):
3549         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
3550         (WebCore::PeerConnectionFactoryAndThreads::OnMessage):
3551
3552 2017-02-20  Alexey Proskuryakov  <ap@apple.com>
3553
3554         Clean up how WebKit exports _WebCreateFragment
3555         https://bugs.webkit.org/show_bug.cgi?id=168579
3556
3557         Reviewed by Dan Bernstein.
3558
3559         * editing/Editor.h: Removed the declaration of _WebCreateFragment, SOFT_LINK doesn't need it.
3560         * editing/cocoa/EditorCocoa.mm: Moved a FIXME comment here.
3561
3562 2017-02-20  Ryan Haddad  <ryanhaddad@apple.com>
3563
3564         Unreviewed, rolling out r212637.
3565
3566         This change broke iOS builds.
3567
3568         Reverted changeset:
3569
3570         "Add 'webglcontextchanged' WebGLContextEvent"
3571         https://bugs.webkit.org/show_bug.cgi?id=168595
3572         http://trac.webkit.org/changeset/212637
3573
3574 2017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3575
3576         Remove code under USE(GRAPHICS_SURFACE)
3577         https://bugs.webkit.org/show_bug.cgi?id=168592
3578
3579         Reviewed by Michael Catanzaro.
3580
3581         This was only used by EFL port.
3582
3583         * platform/TextureMapper.cmake:
3584         * platform/graphics/opengl/GLPlatformSurface.cpp: Removed.
3585         * platform/graphics/surfaces/GLTransportSurface.cpp: Removed.
3586         * platform/graphics/surfaces/GLTransportSurface.h: Removed.
3587         * platform/graphics/surfaces/GraphicsSurface.cpp: Removed.
3588         * platform/graphics/surfaces/GraphicsSurface.h: Removed.
3589         * platform/graphics/surfaces/GraphicsSurfaceToken.h: Removed.
3590         * platform/graphics/surfaces/egl/EGLConfigSelector.cpp: Removed.
3591         * platform/graphics/surfaces/egl/EGLConfigSelector.h: Removed.
3592         * platform/graphics/surfaces/egl/EGLContext.cpp: Removed.
3593         * platform/graphics/surfaces/egl/EGLContext.h: Removed.
3594         * platform/graphics/surfaces/egl/EGLHelper.cpp: Removed.
3595         * platform/graphics/surfaces/egl/EGLHelper.h: Removed.
3596         * platform/graphics/surfaces/egl/EGLSurface.cpp: Removed.
3597         * platform/graphics/surfaces/egl/EGLSurface.h: Removed.
3598         * platform/graphics/surfaces/egl/EGLXSurface.cpp: Removed.
3599         * platform/graphics/surfaces/egl/EGLXSurface.h: Removed.
3600         * platform/graphics/surfaces/glx/GLXConfigSelector.h: Removed.
3601         * platform/graphics/surfaces/glx/GLXContext.cpp: Removed.
3602         * platform/graphics/surfaces/glx/GLXContext.h: Removed.
3603         * platform/graphics/surfaces/glx/GLXSurface.cpp: Removed.
3604         * platform/graphics/surfaces/glx/GLXSurface.h: Removed.
3605         * platform/graphics/surfaces/glx/X11Helper.cpp: Removed.
3606         * platform/graphics/surfaces/glx/X11Helper.h: Removed.
3607         * platform/graphics/texmap/TextureMapperBackingStore.cpp:
3608         * platform/graphics/texmap/TextureMapperBackingStore.h:
3609         * platform/graphics/texmap/TextureMapperPlatformLayer.h:
3610         (WebCore::TextureMapperPlatformLayer::setClient):
3611         * platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp: Removed.
3612         * platform/graphics/texmap/TextureMapperSurfaceBackingStore.h: Removed.
3613         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3614         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
3615         (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay):
3616         (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer):
3617         (WebCore::CoordinatedGraphicsLayer::syncPlatformLayer):
3618         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3619         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
3620         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
3621
3622 2017-02-20  Dean Jackson  <dino@apple.com>
3623
3624         Add 'webglcontextchanged' WebGLContextEvent
3625         https://bugs.webkit.org/show_bug.cgi?id=168595
3626         <rdar://problem/30604254>
3627
3628         Reviewed by Antoine Quint.
3629
3630         Add a new event that is dispatched when the GraphicsContext3D
3631         notices that the active GPU has changed.
3632
3633         Test: fast/canvas/webgl/webglcontextchangedevent.html
3634
3635         * dom/EventNames.h: Add 'webglcontextchanged'.
3636         * html/canvas/WebGLRenderingContextBase.cpp:
3637         (WebCore::WebGLRenderingContextBase::dispatchContextChangedEvent): Dispatch the new event.
3638         (WebCore::WebGLRenderingContextBase::simulateContextChanged): Tell the GraphicsContext3D to
3639         pretend there was a GPU switch. This is called from Internals for testing.
3640         * html/canvas/WebGLRenderingContextBase.h:
3641         * html/canvas/WebGLRenderingContextBase.idl: Export the interface so Internals can see it.
3642
3643         * platform/graphics/GraphicsContext3D.cpp:
3644         (WebCore::GraphicsContext3D::simulateContextChanged): Tell the GraphicsContext3DManager
3645         that it should pretend a GPU change has happened, which causes it to notify all the
3646         active contexts.
3647         * platform/graphics/GraphicsContext3D.h:
3648
3649         * platform/graphics/mac/GraphicsContext3DMac.mm:
3650         (WebCore::GraphicsContext3DManager::updateAllContexts): Tell the GraphicsContext3Ds
3651         to tell their WebGLRenderingContexts to dispatch an event.
3652         (WebCore::GraphicsContext3D::simulateContextChanged): Fake the display change.
3653         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
3654         (WebCore::GraphicsContext3D::dispatchContextChangedNotification): Tell the WebGLRenderingContext
3655         that a change has occurred, and that it should dispatch an event. This is a layering
3656         violation which will need to be fixed (although with other communication from GC3D back
3657         to WebGL).
3658         * testing/Internals.cpp:
3659         (WebCore::Internals::simulateWebGLContextChanged):
3660         * testing/Internals.h:
3661         * testing/Internals.idl:
3662
3663 2017-02-19  Dean Jackson  <dino@apple.com>
3664
3665         Activate/deactivate high performance GPU when requested
3666         https://bugs.webkit.org/show_bug.cgi?id=168559
3667         <rdar://problem/30592266>
3668
3669         Reviewed by Jon Lee.
3670
3671         Respect the high-performance powerPreference for WebGL, by managing an
3672         object that enables the high-performance GPU. If a WebGL context wants
3673         high-performance, and it is visible, then a manager class in GraphicsContext3D
3674         creates and retains the object, causing all the WebGL contexts to move GPUs.
3675         If all the high-performance contexts are not visible, such as in a background tab,
3676         then the manager will release the object, allowing the GPU to power down.
3677
3678         The swapping back from the high-performance GPU happens on a timer, to make
3679         sure we don't churn between GPUs if the user is swapping between a lot of tabs,
3680         or windows.
3681
3682         Unfortunately testing this change properly requires hardware with
3683         multiple GPUs. I plan to write an API test that fakes most of the
3684         system interaction, such as occluding the page. An API test might
3685         also be able to verify if the system has more than one GPU. Otherwise
3686         I'll have to plumb everything through Internals.
3687
3688         * html/canvas/WebGLRenderingContextBase.cpp:
3689         (WebCore::isHighPerformanceContext): Helper to detect if the GraphicsContext3D actually
3690         used high-performance mode.
3691         (WebCore::WebGLRenderingContextBase::create): Add logging if we are
3692         actually overriding a high-performance request.
3693         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase): If we are high-performance,
3694         then register for activity state changes.
3695         (WebCore::WebGLRenderingContextBase::addActivityStateChangeObserverIfNecessary):
3696         (WebCore::WebGLRenderingContextBase::removeActivityStateChangeObserver):
3697         (WebCore::WebGLRenderingContextBase::destroyGraphicsContext3D): Call removeActivityStateChangeObserver
3698         as the GC3D is destroyed.
3699         (WebCore::WebGLRenderingContextBase::maybeRestoreContext): If the context was
3700         restored successfully, and came back in high-performance, then we need
3701         to listen for activity state changes as usual.
3702         (WebCore::WebGLRenderingContextBase::activityStateDidChange): If we changed visibility,
3703         tell the GC3D.
3704         * html/canvas/WebGLRenderingContextBase.h: Class inherits ActivityStateChangeObserver.
3705
3706         * page/Settings.in: No longer force low-power everywhere.
3707
3708         * platform/graphics/GraphicsContext3D.cpp:
3709         (WebCore::GraphicsContext3D::setContextVisibility): Empty implementation for non-Mac.
3710         * platform/graphics/GraphicsContext3D.h:
3711         (WebCore::GraphicsContext3D::powerPreferenceUsedForCreation): Tells clients what power preference
3712         was actually used during creation (e.g. a single GPU system will use default, even if
3713         they requested high-performance).
3714
3715         * platform/graphics/mac/GraphicsContext3DMac.mm:
3716         (WebCore::GraphicsContext3DManager::GraphicsContext3DManager): Helper class to
3717         look after all GraphicsContext3Ds.
3718         (WebCore::GraphicsContext3DManager::hasTooManyContexts): We have a limit on the
3719         number of contexts we can keep alive at any one time.
3720         (WebCore::manager): Helper to return the static instance.
3721         (WebCore::displayWasReconfigured): Send a message to all the contexts.
3722         (WebCore::GraphicsContext3DManager::addContext):
3723         (WebCore::GraphicsContext3DManager::removeContext):
3724         (WebCore::GraphicsContext3DManager::addContextRequiringHighPerformance):
3725         (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance):
3726         (WebCore::GraphicsContext3DManager::updateHighPerformanceState): Check if the number
3727         of contexts requiring high-performance means we need to enable/disable that GPU.
3728         (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired): Releases our
3729         object that keeps the high-performance GPU on.
3730         (WebCore::GraphicsContext3DManager::recycleContextIfNecessary): Get rid of the first (oldest)
3731         context. This code was in GC3D proper, but it made more sense here in the helper.
3732         (WebCore::setPixelFormat): All contexts are created muxable now.
3733         (WebCore::GraphicsContext3D::create): Use the manager.
3734         (WebCore::GraphicsContext3D::GraphicsContext3D): Ditto.
3735         (WebCore::GraphicsContext3D::~GraphicsContext3D): Add logging.
3736         (WebCore::GraphicsContext3D::checkGPUStatusIfNecessary): Better logging.
3737         (WebCore::GraphicsContext3D::updateCGLContext):
3738         (WebCore::GraphicsContext3D::setContextVisibility): This is the responder to the
3739         ActivityStateChanges in the WebGLRenderingContext.
3740         (WebCore::activeContexts): Deleted.
3741         (WebCore::addActiveContext): Deleted.
3742         (WebCore::removeActiveContext): Deleted.
3743
3744 2017-02-20  Manuel Rego Casasnovas  <rego@igalia.com>
3745
3746         [css-grid] Remove compilation flag ENABLE_CSS_GRID_LAYOUT
3747         https://bugs.webkit.org/show_bug.cgi?id=167693
3748
3749         Reviewed by Sergio Villar Senin.
3750
3751         * Configurations/FeatureDefines.xcconfig:
3752         * css/CSSComputedStyleDeclaration.cpp:
3753         (WebCore::valueForGridPosition):
3754         (WebCore::isLayoutDependent):
3755         (WebCore::resolveJustifySelfAuto):
3756         (WebCore::isImplicitlyInheritedGridOrFlexProperty):
3757         (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):
3758         (WebCore::ComputedStyleExtractor::propertyValue):
3759         * css/CSSGridAutoRepeatValue.cpp:
3760         * css/CSSGridAutoRepeatValue.h:
3761         * css/CSSGridLineNamesValue.cpp:
3762         * css/CSSGridLineNamesValue.h:
3763         * css/CSSGridTemplateAreasValue.cpp:
3764         * css/CSSGridTemplateAreasValue.h:
3765         * css/CSSPrimitiveValueMappings.h:
3766         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3767         * css/CSSProperties.json:
3768         * css/CSSValue.cpp:
3769         (WebCore::CSSValue::equals):
3770         (WebCore::CSSValue::cssText):
3771         (WebCore::CSSValue::destroy):
3772         * css/CSSValue.h:
3773         (WebCore::CSSValue::isContentDistributionValue):
3774         (WebCore::CSSValue::isGridLineNamesValue):
3775         * css/CSSValueKeywords.in:
3776         * css/StyleBuilderConverter.h:
3777         (WebCore::StyleBuilderConverter::convertGridAutoFlow):
3778         (WebCore::StyleBuilderConverter::convertContentAlignmentData):
3779         * css/StyleBuilderCustom.h:
3780         (WebCore::StyleBuilderCustom::applyValueGridTemplateRows):
3781         * css/StyleProperties.cpp:
3782         (WebCore::StyleProperties::getPropertyValue):
3783         * css/StyleResolver.cpp:
3784         (WebCore::equivalentBlockDisplay):
3785         * css/StyleResolver.h:
3786         * css/parser/CSSParser.cpp:
3787         (WebCore::CSSParserContext::CSSParserContext):
3788         (WebCore::operator==):
3789         * css/parser/CSSParserFastPaths.cpp:
3790         (WebCore::isSimpleLengthPropertyID):
3791         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
3792         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
3793         * css/parser/CSSParserMode.h:
3794         (WebCore::CSSParserContextHash::hash):
3795         * css/parser/CSSPropertyParser.cpp:
3796         (WebCore::consumeGridAutoFlow):
3797         (WebCore::consumeGridTemplateAreas):
3798         (WebCore::CSSPropertyParser::parseSingleValue):
3799         (WebCore::CSSPropertyParser::consumeGridShorthand):
3800         (WebCore::CSSPropertyParser::parseShorthand):
3801         * dom/Document.cpp:
3802         * dom/Document.h:
3803         * dom/Position.cpp:
3804         (WebCore::Position::isCandidate):
3805         * page/RuntimeEnabledFeatures.h:
3806         (WebCore::RuntimeEnabledFeatures::isCSSGridLayoutEnabled):
3807         * rendering/Grid.cpp:
3808         * rendering/Grid.h:
3809         * rendering/RenderBlock.cpp:
3810         (WebCore::RenderBlock::getFirstLetter):
3811         * rendering/RenderBox.cpp:
3812         (WebCore::RenderBox::~RenderBox):
3813         (WebCore::RenderBox::styleDidChange):
3814         (WebCore::RenderBox::clearExtraInlineAndBlockOffests):
3815         (WebCore::RenderBox::containingBlockLogicalWidthForContent):
3816         (WebCore::RenderBox::containingBlockLogicalHeightForContent):
3817         (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight):
3818         (WebCore::RenderBox::computeLogicalWidthInRegion):
3819         (WebCore::RenderBox::sizesLogicalWidthToFitContent):
3820         (WebCore::RenderBox::computeLogicalHeight):
3821         (WebCore::RenderBox::computePercentageLogicalHeight):
3822         (WebCore::RenderBox::containingBlockLogicalWidthForPositioned):
3823         (WebCore::RenderBox::containingBlockLogicalHeightForPositioned):
3824         (WebCore::RenderBox::computePositionedLogicalWidth):
3825         (WebCore::RenderBox::computePositionedLogicalHeight):
3826         (WebCore::RenderBox::createsNewFormattingContext):
3827         (WebCore::logicalWidthIsResolvable):
3828         (WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock):
3829         (WebCore::RenderBox::hasDefiniteLogicalHeight):
3830         * rendering/RenderBox.h:
3831         (WebCore::RenderBox::isGridItem):
3832         * rendering/RenderElement.cpp:
3833         (WebCore::RenderElement::createFor):
3834         * rendering/RenderFlexibleBox.cpp:
3835         (WebCore::RenderFlexibleBox::alignChildren):
3836         * rendering/RenderGrid.cpp:
3837         * rendering/RenderGrid.h:
3838         * rendering/RenderObject.h:
3839         (WebCore::RenderObject::isRenderGrid):
3840         * rendering/style/GridArea.h:
3841         * rendering/style/GridLength.h:
3842         * rendering/style/GridPosition.h:
3843         * rendering/style/GridPositionsResolver.cpp:
3844         * rendering/style/GridPositionsResolver.h:
3845         * rendering/style/GridTrackSize.h:
3846         * rendering/style/RenderStyle.cpp:
3847         (WebCore::RenderStyle::isCSSGridLayoutEnabled):
3848         (WebCore::RenderStyle::changeRequiresLayout):
3849         * rendering/style/RenderStyle.h:
3850         (WebCore::RenderStyle::gridItemRowEnd):
3851         (WebCore::RenderStyle::setGridRowGap):
3852         (WebCore::RenderStyle::initialGridItemRowEnd):
3853         (WebCore::RenderStyle::isDisplayReplacedType):
3854         (WebCore::RenderStyle::isDisplayGridBox):
3855         * rendering/style/RenderStyleConstants.h:
3856         * rendering/style/StyleGridData.cpp:
3857         * rendering/style/StyleGridData.h:
3858         * rendering/style/StyleGridItemData.cpp:
3859         * rendering/style/StyleGridItemData.h:
3860         * rendering/style/StyleRareNonInheritedData.cpp:
3861         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
3862         (WebCore::StyleRareNonInheritedData::operator==):
3863         * rendering/style/StyleRareNonInheritedData.h:
3864         * testing/InternalSettings.cpp:
3865         (WebCore::InternalSettings::Backup::Backup):
3866         (WebCore::InternalSettings::Backup::restoreTo):
3867         (WebCore::InternalSettings::setCSSGridLayoutEnabled):
3868
3869 2017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3870
3871         REGRESSION(r212345): [GTK] ASSERT(cookieChangeCallbackMap().contains(jar)) failed in WebCore::stopObservingCookieChanges:54
3872         https://bugs.webkit.org/show_bug.cgi?id=168375
3873
3874         Reviewed by Alex Christensen.
3875
3876         Simplify the way cookie storage is handled in NetworkStorageSessionSoup. Now we always keep a reference to the
3877         cookie jar, no matter if we have a session or not, that is always kept in sync with the one actually used by the
3878         session. We always connect to the changed signal of the current cookie jar and notify the observer if it has been
3879         set.
3880
3881         * platform/network/NetworkStorageSession.h:
3882         * platform/network/soup/CookieStorageSoup.cpp:
3883         (WebCore::startObservingCookieChanges): Remove this implementation and add an ASSERT to ensure we don't use this anymore.
3884         (WebCore::stopObservingCookieChanges): Ditto.
3885         (WebCore::cookieChangeCallbackMap): Deleted.
3886         (WebCore::soupCookiesChanged): Deleted.
3887         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3888         (WebCore::NetworkStorageSession::NetworkStorageSession): Initialize the cookie storage.
3889         (WebCore::NetworkStorageSession::~NetworkStorageSession): Disconnect the changed signal.
3890         (WebCore::NetworkStorageSession::getOrCreateSoupNetworkSession): Always pass the current cookie storage.
3891         (WebCore::NetworkStorageSession::cookiesDidChange): Notify the observer.
3892         (WebCore::NetworkStorageSession::cookieStorage): Return the current cookie storage.
3893         (WebCore::NetworkStorageSession::setCookieStorage): Update the current cookie storage and update the session if
3894         needed too. We always have a valid cookie storage so if nullptr is given we create a new one.
3895         (WebCore::NetworkStorageSession::setCookieObserverHandler): Set a cookie observer handler.
3896
3897 2017-02-19  Chris Dumez  <cdumez@apple.com>
3898
3899         onbeforeunload event return value coercion is not per-spec
3900         https://bugs.webkit.org/show_bug.cgi?id=168382
3901
3902         Reviewed by Darin Adler.
3903
3904         Update handling of value returned by onbeforeunload event listeners
3905         to match Firefox and the specification:
3906         - https://html.spec.whatwg.org/#the-event-handler-processing-algorithm (step 4)
3907
3908         Namely, the following changes were made:
3909         - Only set the event's returnValue attribute to the returned value if the attribute
3910           value is the empty string (so as to not override the attribute value if it has
3911           explicitly been set by JS).
3912         - Cancel the event when the return value is not null by calling preventDefault().
3913
3914         Additionally, the following changes were made:
3915         - Ask the user to confirm the navigation if the event was canceled, not just if the
3916           returnValue attribute was set to a non-empty string.
3917         as per:
3918         - https://html.spec.whatwg.org/#prompt-to-unload-a-document (step 8)
3919
3920         Tests: fast/events/before-unload-return-string-conversion.html
3921                imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-canceling.html
3922
3923         * bindings/js/JSEventListener.cpp:
3924         (WebCore::handleBeforeUnloadEventReturnValue):
3925         (WebCore::JSEventListener::handleEvent):
3926         * loader/FrameLoader.cpp:
3927         (WebCore::shouldAskForNavigationConfirmation):
3928         (WebCore::FrameLoader::dispatchBeforeUnloadEvent):
3929
3930 2017-02-19  Carlos Garcia Campos  <cgarcia@igalia.com>
3931
3932         [SOUP] Call SoupNetworkSession::setShouldIgnoreTLSErrors when testRunner.setAllowsAnySSLCertificate() is called
3933         https://bugs.webkit.org/show_bug.cgi?id=168571
3934
3935         Reviewed by Michael Catanzaro.
3936
3937         Fixes: http/tests/ssl/upgrade-origin-usage.html
3938
3939         * testing/InternalSettings.cpp:
3940         (WebCore::InternalSettings::setAllowsAnySSLCertificate):
3941
3942 2017-02-18  Ryosuke Niwa  <rniwa@webkit.org>
3943
3944         REGRESSION(r212218): Assertion failures in and after parserRemoveChild
3945         https://bugs.webkit.org/show_bug.cgi?id=168458
3946
3947         Reviewed by Antti Koivisto.
3948
3949         The bug was caused by parserRemoveChild not preceeding to remove oldChild even when
3950         oldChild had been inserted elsewhere during unload evnets of the disconnected frames.
3951         Fixed the bug by checking this condition and exiting early.
3952
3953         Also fixed various callers of parserRemoveChild to not call parserAppendChild when
3954         the removed node had already been inserted elsewhere by scripts.
3955
3956         Tests: fast/parser/adoption-agency-unload-iframe-3.html
3957                fast/parser/adoption-agency-unload-iframe-4.html
3958                fast/parser/xml-error-unload-iframe.html
3959
3960         * dom/ContainerNode.cpp:
3961         (WebCore::ContainerNode::parserRemoveChild): Exit early when the node had been
3962         inserted elsewhere while firing unload events. Also moved the call to
3963         notifyRemovePendingSheetIfNeeded outside NoEventDispatchAssertion since it can
3964         synchrnously fire a focus event.
3965         (WebCore::ContainerNode::parserAppendChild): Moved adoptNode call to inside
3966         NoEventDispatchAssertion since adoptNode call here should never mutate DOM.
3967         * html/parser/HTMLConstructionSite.cpp:
3968         (WebCore::executeReparentTask): Added an early exit when the node had already been
3969         inserted elsewhere.
3970         (WebCore::executeInsertAlreadyParsedChildTask): Ditto.
3971         * xml/XMLErrors.cpp:
3972         (WebCore::XMLErrors::insertErrorMessageBlock): Ditto.
3973         * xml/parser/XMLDocumentParser.cpp:
3974         (WebCore::XMLDocumentParser::end): Fixed a crash unveiled by one of the test cases.
3975         Exit early when insertErrorMessageBlock detached the parser (by author scripts).
3976         (WebCore::XMLDocumentParser::finish): Keep the parser alive until we exit.
3977
3978 2017-02-19  Chris Dumez  <cdumez@apple.com>
3979
3980         <input type=color readonly> doesn't act per spec
3981         https://bugs.webkit.org/show_bug.cgi?id=168421
3982         <rdar://problem/30593185>
3983
3984         Reviewed by Ryosuke Niwa.
3985
3986         The 'readonly' attribute should not apply to <input type=color> as per the
3987         HTML specification:
3988         - https://html.spec.whatwg.org/#the-input-element:attr-input-readonly-3
3989
3990         Chrome / Firefox and Edge already behave as per the specification.
3991
3992         Tests: fast/forms/color/input-color-disabled.html
3993                fast/forms/color/input-color-readonly.html
3994
3995         * html/ColorInputType.cpp:
3996         (WebCore::ColorInputType::handleDOMActivateEvent):
3997         (WebCore::ColorInputType::didChooseColor):
3998
3999 2017-02-19  Commit Queue  <commit-queue@webkit.org>
4000
4001         Unreviewed, rolling out r212466.
4002         https://bugs.webkit.org/show_bug.cgi?id=168577
4003
4004         causes crashes on AArch64 on linux, maybe it's causing crashes
4005         on iOS too (Requested by pizlo on #webkit).
4006
4007         Reverted changeset:
4008
4009         "The collector thread should only start when the mutator
4010         doesn't have heap access"
4011         https://bugs.webkit.org/show_bug.cgi?id=167737
4012         http://trac.webkit.org/changeset/212466
4013
4014 2017-02-19  Zalan Bujtas  <zalan@apple.com>
4015
4016         Simple line layout: Implement positionForPoint.
4017         https://bugs.webkit.org/show_bug.cgi?id=168565
4018         <rdar://problem/30593370>
4019
4020         Reviewed by Antti Koivisto.
4021
4022         With this patch, now we don't need to switch over to line box tree anymore when positionForPoint()
4023         is called on a single RenderText content (which is the majority of the simple line content).
4024         This patch also adds a new positionForPoint method which returns a Position object instead of VisiblePosition.
4025         Some of the positionForPoint() callsites are only interested in the Position object so constructing a VisiblePosition
4026         (which could potentially kick off a layout) is a waste. At this point the non-simple line layout codepath still constructs
4027         a VisiblePosition and that should be addresses as part of webkit.org/b/168566.
4028
4029         Covered by existing tests.
4030
4031         * dom/Document.cpp:
4032         (WebCore::Document::caretRangeFromPoint):
4033         * rendering/RenderBlockFlow.cpp:
4034         (WebCore::RenderBlockFlow::positionForPoint):
4035         * rendering/RenderBlockFlow.h:
4036         * rendering/RenderObject.cpp:
4037         (WebCore::RenderObject::positionForPoint):
4038         * rendering/RenderObject.h:
4039         * rendering/RenderText.cpp:
4040         (WebCore::RenderText::positionForPoint):
4041         * rendering/RenderText.h:
4042         * rendering/SimpleLineLayoutFunctions.cpp:
4043         (WebCore::SimpleLineLayout::positionForPoint):
4044         * rendering/SimpleLineLayoutFunctions.h:
4045         * rendering/SimpleLineLayoutResolver.cpp:
4046         (WebCore::SimpleLineLayout::RunResolver::runForPoint):
4047         * rendering/SimpleLineLayoutResolver.h:
4048         (WebCore::SimpleLineLayout::RunResolver::Run::logicalLeft):
4049         (WebCore::SimpleLineLayout::RunResolver::Run::logicalRight):
4050
4051 2017-02-19  Antti Koivisto  <antti@apple.com>
4052
4053         Execute pending scripts asynchronously after stylesheet loads complete
4054         https://bugs.webkit.org/show_bug.cgi?id=168367
4055         rdar://problem/30561379
4056
4057         Reviewed by Andreas Kling.
4058
4059         The current synchronous execution is fragile and creates various problems.
4060
4061         * css/StyleSheetContents.cpp:
4062         (WebCore::StyleSheetContents::checkLoaded):
4063         * dom/ContainerNode.cpp:
4064         (WebCore::ContainerNode::takeAllChildrenFrom):
4065         (WebCore::ContainerNode::notifyChildInserted):
4066         (WebCore::ContainerNode::removeChild):
4067         (WebCore::ContainerNode::parserRemoveChild):
4068         (WebCore::ContainerNode::removeChildren):
4069
4070             Remove various places where we would trigger delayed synchronous execution.
4071
4072         * dom/Document.cpp:
4073         (WebCore::Document::Document):
4074         (WebCore::Document::recalcStyle):
4075
4076             Trigger scroll to anchor at the end of style resolution instead of when style sheet load completes.
4077
4078         (WebCore::Document::didRemoveAllPendingStylesheet):
4079
4080             Call asynchronous script execution function.
4081
4082         * dom/Document.h:
4083         (WebCore::Document::setNeedsNotifyRemoveAllPendingStylesheet): Deleted.
4084         (WebCore::Document::notifyRemovePendingSheetIfNeeded): Deleted.
4085         * dom/ScriptableDocumentParser.cpp:
4086         (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
4087         (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheetsSoon):
4088         (WebCore::ScriptableDocumentParser::scriptsWaitingForStylesheetsExecutionTimerFired):
4089
4090             Add a timer for executing pending scripts.
4091
4092         (WebCore::ScriptableDocumentParser::detach):
4093         * dom/ScriptableDocumentParser.h:
4094         (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheets):
4095         * html/HTMLLinkElement.cpp: