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