REGRESSION(r207669): Crash after mutating selector text
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-02-21  Antti Koivisto  <antti@apple.com>
2
3         REGRESSION(r207669): Crash after mutating selector text
4         https://bugs.webkit.org/show_bug.cgi?id=168655
5         <rdar://problem/30632111>
6
7         Reviewed by Brent Fulgham.
8
9         Test: fast/css/selector-text-mutation-crash.html
10
11         * style/StyleScope.cpp:
12         (WebCore::Style::Scope::scheduleUpdate):
13
14         Clear the style resolver immediately if style sheet content changes. The resolver may
15         have data structures that point to the old sheet contents.
16
17         The resolver would get wiped anyway when the scheduled update actually occurs.
18
19 2017-02-21  Jiewen Tan  <jiewen_tan@apple.com>
20
21         [WebCrypto] Add support for AES-CFB
22         https://bugs.webkit.org/show_bug.cgi?id=168344
23         <rdar://problem/20940221>
24
25         Reviewed by Brent Fulgham.
26
27         This patch adds support for AES-CFB. Operations of AES-CFB include: encrypt, decrypt, generateKey,
28         importKey, exportKey, wrapKey, and unwrapKey. This implementation follows a slightly old version
29         of WebCryptoAPI spec: https://www.w3.org/TR/2014/CR-WebCryptoAPI-20141211/#aes-cfb.
30
31         Tests: crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters.html
32                crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters.html
33                crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public.html
34                crypto/subtle/aes-cfb-generate-export-key-jwk-length-128.html
35                crypto/subtle/aes-cfb-generate-export-key-jwk-length-192.html
36                crypto/subtle/aes-cfb-generate-export-key-jwk-length-256.html
37                crypto/subtle/aes-cfb-generate-export-raw-key.html
38                crypto/subtle/aes-cfb-generate-key-encrypt-decrypt.html
39                crypto/subtle/aes-cfb-generate-key.html
40                crypto/subtle/aes-cfb-import-jwk-key-length-128.html
41                crypto/subtle/aes-cfb-import-jwk-key-length-192.html
42                crypto/subtle/aes-cfb-import-jwk-key-length-256.html
43                crypto/subtle/aes-cfb-import-key-decrypt.html
44                crypto/subtle/aes-cfb-import-key-encrypt.html
45                crypto/subtle/aes-cfb-import-key-unwrap-jwk-key.html
46                crypto/subtle/aes-cfb-import-key-unwrap-raw-key.html
47                crypto/subtle/aes-cfb-import-key-wrap-jwk-key.html
48                crypto/subtle/aes-cfb-import-key-wrap-raw-key.html
49                crypto/subtle/aes-cfb-import-raw-key.html
50                crypto/workers/subtle/aes-cfb-import-key-decrypt.html
51                crypto/workers/subtle/aes-cfb-import-key-encrypt.html
52                crypto/workers/subtle/aes-cfb-import-key-unwrap-key.html
53                crypto/workers/subtle/aes-cfb-import-key-wrap-key.html
54
55         * CMakeLists.txt:
56         * DerivedSources.make:
57         * PlatformGTK.cmake:
58         * PlatformMac.cmake:
59         * WebCore.xcodeproj/project.pbxproj:
60         Add CryptoAlgorithmAES_CFB.cpp,
61         change AesCbcParams.idl to AesCbcCfbParams.idl.
62         * bindings/js/JSSubtleCryptoCustom.cpp:
63         (WebCore::normalizeCryptoAlgorithmParameters):
64         Add support for AES-CFB.
65         * crypto/CryptoAlgorithm.h:
66         Include <wtf/Variant.h>.
67         * crypto/CryptoAlgorithmParameters.h:
68         Add support for AES-CFB.
69         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
70         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
71         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
72         Rename CryptoAlgorithmAesCbcParams to CryptoAlgorithmAesCbcCfbParams.
73         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp: Added.
74         (WebCore::usagesAreInvalidForCryptoAlgorithmAES_CFB):
75         (WebCore::CryptoAlgorithmAES_CFB::create):
76         (WebCore::CryptoAlgorithmAES_CFB::identifier):
77         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
78         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
79         (WebCore::CryptoAlgorithmAES_CFB::generateKey):
80         (WebCore::CryptoAlgorithmAES_CFB::importKey):
81         (WebCore::CryptoAlgorithmAES_CFB::exportKey):
82         * crypto/algorithms/CryptoAlgorithmAES_CFB.h: Added.
83         * crypto/gnutls/CryptoAlgorithmAES_CFBGnuTLS.cpp: Added.
84         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
85         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
86         Add dummy support of AES_CFB for GTK+.
87         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
88         (WebCore::transformAES_CBC):
89         Drop conditional PLATFORM(COCOA).
90         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
91         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
92         Rename CryptoAlgorithmAesCbcParams to CryptoAlgorithmAesCbcCfbParams.
93         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp: Added.
94         (WebCore::transformAES_CFB):
95         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
96         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
97         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
98         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
99         Add support for AES-CFB.
100         * crypto/parameters/AesCbcCfbParams.idl: Renamed from Source/WebCore/crypto/parameters/AesCbcParams.idl.
101         * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h.
102         Since dictionaries AesCbcParams and AesCfbParams are essentially the same, I combine them together in our implementations.
103
104 2017-02-21  Wenson Hsieh  <wenson_hsieh@apple.com>
105
106         Unreviewed, fix the ToT iOS build
107
108         Adopt updated UIKit SPI and remove calls to the deprecated version.
109
110         * platform/ios/WebItemProviderPasteboard.mm:
111         (-[WebItemProviderPasteboard setItems:]):
112
113 2017-02-21  Per Arne Vollan  <pvollan@apple.com>
114
115         [Win] WebView is not painting in accelerated compositing mode.
116         https://bugs.webkit.org/show_bug.cgi?id=168654
117
118         Reviewed by Brent Fulgham.
119
120         Initializing the uncommitted layer change flags to CoverageRectChanged in GraphicsLayerCA,
121         stops WebView painting in accelerated mode.
122
123         Covered by existing tests.
124
125         * platform/graphics/ca/GraphicsLayerCA.h:
126
127 2017-02-21  Jer Noble  <jer.noble@apple.com>
128
129         Make logging in high-priority audio threads less expensive
130         https://bugs.webkit.org/show_bug.cgi?id=168639
131
132         Reviewed by Jon Lee.
133
134         Logging from inside a high-priority audio thread will make a number of calls to malloc, block, and
135         therefore cause audio glitches. Make this logging less expensive by dispatching to the main thread
136         before creating and outputting the log string.
137
138         * WebCore.xcodeproj/project.pbxproj:
139         * platform/audio/mac/AudioSampleDataSource.mm: Renamed from Source/WebCore/platform/audio/mac/AudioSampleDataSource.cpp.
140         (WebCore::AudioSampleDataSource::pushSamplesInternal):
141         (WebCore::AudioSampleDataSource::pullSamplesInternal):
142
143 2017-02-21  Jer Noble  <jer.noble@apple.com>
144
145         Give the Mock audio input a "hum" to make drop-outs more detectable
146         https://bugs.webkit.org/show_bug.cgi?id=168641
147
148         Reviewed by Eric Carlson.
149
150         Add two helper functions to generate waveforms: addHum() and writeHum(). Use these methods
151         to create a bip-bop audio buffer which can be used to "blit" a portion the waveform into the
152         destination buffer during rendering. The background hum must be seamless across multiple
153         pull operations, so add the hum sound during rendering.
154
155         To ensure the waveform buffer is created, initialize the sampleRate to zero, then call
156         applySampleRate() with the desired default rate, 44.1kHz.
157
158         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
159         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
160         (WebCore::writeHum):
161         (WebCore::addHum):
162         (WebCore::MockRealtimeAudioSource::create):
163         (WebCore::MockRealtimeAudioSourceMac::render):
164         (WebCore::MockRealtimeAudioSourceMac::applySampleRate):
165
166 2017-02-21  Jer Noble  <jer.noble@apple.com>
167
168         Make TrackPrivateBase ThreadSafeRefCounted, so that it can be retained in non-main threads
169         https://bugs.webkit.org/show_bug.cgi?id=168642
170
171         Reviewed by Eric Carlson.
172
173         AudioTrackPrivateMediaStreamCocoa has two entry points from background threads:
174         audioSamplesAvailable() and render(). Protect against being destroyed mid-execution by
175         retaining this for the duration of those methods.
176
177         * platform/graphics/TrackPrivateBase.h:
178         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
179         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
180         (WebCore::AudioTrackPrivateMediaStreamCocoa::render):
181
182 2017-02-21  Jer Noble  <jer.noble@apple.com>
183
184         Pulling too quickly from an AudioSampleDataSource should increase the pre-buffer amount
185         https://bugs.webkit.org/show_bug.cgi?id=168645
186
187         Reviewed by Eric Carlson.
188
189         If a pull operation runs past the end of the buffered range of a CARingBuffer, the underrun
190         is zero-filled, causing an audible glitch.  In this case, bias m_outputSampleOffset by the
191         amount of the underrun, which should keep the underrun from reoccurring.
192
193         * platform/audio/mac/AudioSampleDataSource.cpp:
194         (WebCore::AudioSampleDataSource::pullSamplesInternal):
195
196 2017-02-21  Jer Noble  <jer.noble@apple.com>
197
198         AudioSampleBufferList::zeroABL() takes a byte-count, not a sample-count.
199         https://bugs.webkit.org/show_bug.cgi?id=168635
200
201         Reviewed by Jon Lee.
202
203         * platform/audio/mac/AudioSampleDataSource.cpp:
204         (WebCore::AudioSampleDataSource::pullSamplesInternal):
205         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
206
207 2017-02-21  Carlos Garcia Campos  <cgarcia@igalia.com>
208
209         REGRESSION(r212681): Crash when dragging links without a drag image
210         https://bugs.webkit.org/show_bug.cgi?id=168648
211
212         Reviewed by Tim Horton.
213
214         This happens in GTK+ port, because we don't use a drag image for links.
215
216         Fixes: editing/pasteboard/drop-link.html
217                editing/pasteboard/drop-text-without-selection.html
218                editing/pasteboard/files-during-page-drags.html
219                fast/events/content-changed-during-drop.html
220                fast/events/drag-and-drop-link-fast-multiple-times-does-not-crash.html
221                fast/events/drag-and-drop-link-into-focused-contenteditable.html
222                fast/events/drag-and-drop-link.html
223                fast/events/drag-in-frames.html
224                fast/events/drag-parent-node.html
225                fast/events/shift-drag-selection-on-link-triggers-drag-n-drop.html
226
227         * page/DragController.cpp:
228         (WebCore::DragController::startDrag): Do not try to use drag image and its size when createDragImageForLink
229         returns nullptr.
230
231 2017-02-21  Alex Christensen  <achristensen@webkit.org>
232
233         Unreviewed, rolling out r212699.
234
235         Internal build not ready
236
237         Reverted changeset:
238
239         "[WebRTC][Mac] Activate libwebrtc"
240         https://bugs.webkit.org/show_bug.cgi?id=167293
241         http://trac.webkit.org/changeset/212699
242
243 2017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
244
245         Remove ENABLE_THREADED_COMPOSITOR build option
246         https://bugs.webkit.org/show_bug.cgi?id=168606
247
248         Reviewed by Michael Catanzaro.
249
250         * platform/TextureMapper.cmake:
251
252 2017-02-20  Alex Christensen  <achristensen@webkit.org>
253
254         Fix some 32-bit builds after r212699
255
256         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
257         (WebCore::RealtimeIncomingVideoSource::OnFrame):
258         Explicitly cast OSStatus to int for logging.
259
260 2017-02-20  Joseph Pecoraro  <pecoraro@apple.com>
261
262         Remove unnecessary PerformanceEntry virtual methods
263         https://bugs.webkit.org/show_bug.cgi?id=168633
264
265         Reviewed by Ryosuke Niwa.
266
267         * page/PerformanceEntry.h:
268         (WebCore::PerformanceEntry::isResource):
269         (WebCore::PerformanceEntry::isMark):
270         (WebCore::PerformanceEntry::isMeasure):
271         Implement based on the Type.
272
273         * page/PerformanceMark.h:
274         * page/PerformanceMeasure.h:
275         * page/PerformanceResourceTiming.h:
276         Remove virtual overrides.
277
278 2017-02-20  Youenn Fablet  <youenn@apple.com>
279
280         [WebRTC][Mac] Activate libwebrtc
281         https://bugs.webkit.org/show_bug.cgi?id=167293
282
283         Reviewed by Alex Christensen.
284
285         * Configurations/WebCore.xcconfig:
286         * Configurations/WebCoreTestSupport.xcconfig:
287
288 2017-02-20  Joseph Pecoraro  <pecoraro@apple.com>
289
290         ASSERTION FAILED: m_normalWorld->hasOneRef() under WorkerThread::stop
291         https://bugs.webkit.org/show_bug.cgi?id=168356
292         <rdar://problem/30592486>
293
294         Reviewed by Ryosuke Niwa.
295
296         * page/DOMWindow.cpp:
297         (WebCore::DOMWindow::removeAllEventListeners):
298         Remove Performance object EventListeners.
299
300         * workers/WorkerGlobalScope.cpp:
301         (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
302         (WebCore::WorkerGlobalScope::removeAllEventListeners):
303         (WebCore::WorkerGlobalScope::performance):
304         * workers/WorkerGlobalScope.h:
305         Remove Performance object EventListeners.
306         Also clear Performance early in destruction since its ContextDestructionObserver
307         destruction makes checks about the WorkerThread.
308
309 2017-02-20  Jer Noble  <jer.noble@apple.com>
310
311         Local audio-only stream will not trigger playback to begin
312         https://bugs.webkit.org/show_bug.cgi?id=168412
313
314         Reviewed by Youenn Fablet.
315
316         Test: fast/mediastream/local-audio-playing-event.html
317
318         With video-bearing streams, the first video sample emitted from the stream causes the
319         readyState to move from HAVE_NOTHING to HAVE_ENOUGH_DATA. Wire up this same behavior for
320         audio-bearing streams. Add a MediaStreamTrackPrivate::Observer callback method
321         audioSamplesAvailable(), which gets passed up to MediaPlayerPrivateMediaStreamAVFObjC.
322         Because this callback may be (and probably will be) called on a background thread, run the
323         updateReadyState() task in a scheduledDeferredTask().
324
325         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
326         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
327         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSamplesAvailable):
328         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
329         * platform/mediastream/MediaStreamTrackPrivate.cpp:
330         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
331         * platform/mediastream/MediaStreamTrackPrivate.h:
332         (WebCore::MediaStreamTrackPrivate::Observer::audioSamplesAvailable):
333
334 2017-02-20  Zalan Bujtas  <zalan@apple.com>
335
336         Simple line layout: Implement absoluteQuadsForRange.
337         https://bugs.webkit.org/show_bug.cgi?id=168613
338         <rdar://problem/30614618>
339
340         Reviewed by Simon Fraser.
341
342         This patch ensures that the commonly used Range::getClientRects calls do not
343         throw us off of the simple line layout path.
344
345         Test: fast/dom/Range/simple-line-layout-getclientrects.html
346
347         * rendering/RenderText.cpp:
348         (WebCore::RenderText::absoluteQuadsForRange):
349         * rendering/SimpleLineLayoutFunctions.cpp:
350         (WebCore::SimpleLineLayout::collectAbsoluteQuadsForRange): Special case empty ranges with multiple empty runs.
351         * rendering/SimpleLineLayoutFunctions.h:
352         * rendering/SimpleLineLayoutResolver.cpp:
353         (WebCore::SimpleLineLayout::RunResolver::rangeForRendererWithOffsets):
354         * rendering/SimpleLineLayoutResolver.h:
355
356 2017-02-20  Ryan Haddad  <ryanhaddad@apple.com>
357
358         Unreviewed, rolling out r212685.
359
360         This change broke the 32-bit Sierra build.
361
362         Reverted changeset:
363
364         "Resource Load Statistics: Add alternate classification
365         method"
366         https://bugs.webkit.org/show_bug.cgi?id=168347
367         http://trac.webkit.org/changeset/212685
368
369 2017-02-20  Sam Weinig  <sam@webkit.org>
370
371         [WebIDL] Add support for constructors that have variadic parameters
372         https://bugs.webkit.org/show_bug.cgi?id=168614
373
374         Reviewed by Alex Christensen.
375
376         In preparation of removing some more custom bindings, move the constructor calling
377         code over to using GenerateParametersCheck completely. This required
378         - Removing special case of NamedConstructors automatically getting a Document passed
379           to them. The three named constructors that expected this have been updated to add
380           the required attributes.
381         - Add a version of the GenerateCallWith prologue for constructors.
382         - Remove now unnecessary argumentCount return value from GenerateParametersCheck.
383
384         * bindings/scripts/CodeGeneratorJS.pm:
385         (GenerateImplementation):
386         (GenerateCallWithUsingReferences):
387         (GenerateCallWithUsingPointers):
388         (GenerateConstructorCallWithUsingPointers):
389         (GenerateCallWith):
390         (GenerateParametersCheck):
391         (GenerateConstructorDefinition):
392
393         * bindings/scripts/test/JS/JSTestInterface.cpp:
394         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
395         * bindings/scripts/test/JS/JSTestObj.cpp:
396         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
397         Update results for more consistent placement of ScriptExecutionContext and Document
398         accessors, add UNLIKELY to context checks, and remove automatic Document passing
399         for NamedConstructors.
400
401         * html/HTMLAudioElement.idl:
402         * html/HTMLImageElement.idl:
403         * html/HTMLOptionElement.idl:
404         Add ConstructorCallWith=Document.
405
406 2017-02-20  John Wilander  <wilander@apple.com>
407
408         Resource Load Statistics: Add alternate classification method
409         https://bugs.webkit.org/show_bug.cgi?id=168347
410         <rdar://problem/30352793>
411
412         Reviewed by Alex Christensen.
413
414         This patch only adds test infrastructure in WebCore.
415
416         Tests: http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html
417                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html
418                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html
419                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html
420                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html
421                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html
422                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html
423                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html
424
425         * loader/ResourceLoadObserver.cpp:
426         (WebCore::ResourceLoadObserver::setSubframeUnderTopFrameOrigin):
427         (WebCore::ResourceLoadObserver::setSubresourceUnderTopFrameOrigin):
428         (WebCore::ResourceLoadObserver::setSubresourceUniqueRedirectTo):
429         * loader/ResourceLoadObserver.h:
430
431 2017-02-20  Anders Carlsson  <andersca@apple.com>
432
433         Use the new drag code path when dragging links
434         https://bugs.webkit.org/show_bug.cgi?id=168612
435
436         Reviewed by Tim Horton.
437
438         * editing/Editor.cpp:
439         (WebCore::Editor::copyURL):
440         Use userVisibleString instead of fillInUserVisibleForm.
441
442         (WebCore::Editor::pasteboardWriterURL):
443         New function that returns a PasteboardWriterData::URL for a given URL + title.
444
445         * editing/Editor.h:
446         Add new members.
447
448         * editing/mac/EditorMac.mm:
449         (WebCore::Editor::userVisibleString):
450         (WebCore::Editor::fillInUserVisibleForm): Deleted.
451         Add a getter instead of a function that fills in a struct member.
452
453         * page/DragController.cpp:
454         (WebCore::DragController::startDrag):
455         Add the new DragItem code path when dragging links.
456
457         * platform/PasteboardWriterData.cpp:
458         (WebCore::PasteboardWriterData::isEmpty):
459         Check for m_url as well.
460
461         (WebCore::PasteboardWriterData::setURL):
462         Set m_url.
463
464         * platform/PasteboardWriterData.h:
465         Add new members.
466
467         * platform/mac/PasteboardWriter.mm:
468         (WebCore::toUTI):
469         New helper function that returns an UTI from a pasteboard type.
470
471         (WebCore::createPasteboardWriter):
472         Handle converting URLs to the various pasteboard types.
473
474 2017-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>
475
476         Add plumbing to the UI process for TextIndicatorData when computing the drag image
477         https://bugs.webkit.org/show_bug.cgi?id=168583
478         Work towards <rdar://problem/30313681>
479
480         Reviewed by Tim Horton.
481
482         Adds some additional arguments to drag image creation functions to allow platforms to specify TextIndicatorData
483         for a link or selection-based DragImage. This TextIndicatorData is an optional member of the DragImage, and is
484         propagated to the UI process via SetDragImage in the WebDragClient.
485
486         Additionally renames hasDataInteractionAtPosition to hasSelectionAtPosition to better reflect its purpose.
487
488         No new tests, since there is no behavior change.
489
490         * page/DragController.cpp:
491         (WebCore::DragController::startDrag):
492         * page/Page.cpp:
493         (WebCore::Page::hasSelectionAtPosition):
494         (WebCore::Page::hasDataInteractionAtPosition): Deleted.
495         * page/Page.h:
496         * platform/DragImage.cpp:
497         (WebCore::createDragImageForSelection):
498         (WebCore::createDragImageForLink):
499         (WebCore::DragImage::operator=):
500         * platform/DragImage.h:
501         * platform/gtk/DragImageGtk.cpp:
502         (WebCore::createDragImageForLink):
503         * platform/mac/DragImageMac.mm:
504         (WebCore::createDragImageForLink):
505         * platform/win/DragImageWin.cpp:
506         (WebCore::createDragImageForLink):
507
508 2017-02-20  Brent Fulgham  <bfulgham@apple.com>
509
510         Nullptr dereferences when stopping a load
511         https://bugs.webkit.org/show_bug.cgi?id=168608
512         <rdar://problem/29852056>
513
514         Reviewed by Ryosuke Niwa.
515
516         Don't attempt to notify a detached frame's load client that the load is
517         stopped.
518
519         * loader/DocumentLoader.cpp:
520         (WebCore::DocumentLoader::stopLoading): Check for null frame loader and
521         bypass dereferencing it. 
522
523 2017-02-17  Anders Carlsson  <andersca@apple.com>
524
525         Add a new drag code path and use it for dragging plain text
526         https://bugs.webkit.org/show_bug.cgi?id=168534
527
528         Reviewed by Geoffrey Garen.
529
530         The new code path is currently only used for plain text selection dragging.
531
532         * WebCore.xcodeproj/project.pbxproj:
533         * page/DragClient.h:
534         (WebCore::DragClient::useLegacyDragClient):
535         Add a new member function. This currently returns true everywhere except legacy WebKit on Mac.
536
537         (WebCore::DragClient::beginDrag):
538         Add new empty member function.
539
540         * page/DragController.cpp:
541         (WebCore::dragImageAnchorPointForSelectionDrag):
542         Helper function that returns the anchor point for a selection drag image.
543
544         (WebCore::DragController::startDrag):
545         If we can use the new code path, set up a drag item with an image and pasteboard data.
546
547         (WebCore::DragController::beginDrag):
548         New function that calls out to the client.
549
550         * page/DragController.h:
551         Add new members.
552
553         * platform/DragItem.h:
554         Add a new class - it's essentially a tuple of a drag image, an anchor point and the pasteboard data the item represents.
555
556         * platform/mac/PasteboardWriter.h:
557         Rename createPasteboardWriting to createPasteboardWriter.
558
559         * platform/mac/PasteboardWriter.mm:
560         (WebCore::createPasteboardWriter):
561         Use the UTI pasteboard type.
562
563 2017-02-20  Alex Christensen  <achristensen@webkit.org>
564
565         Fix libwebrtc build after r212644.
566         https://bugs.webkit.org/show_bug.cgi?id=168596
567
568         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
569         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
570         m_endpoint changed from a c++ reference to a WTF::Ref, so we need to use operator -> instead of .
571
572 2017-02-20  Romain Bellessort  <romain.bellessort@crf.canon.fr>
573
574         [Readable Streams API] Add ReadableByteStreamController byobRequest attribute
575         https://bugs.webkit.org/show_bug.cgi?id=168319
576
577         Reviewed by Youenn Fablet.
578
579         Added ReadableByteStreamController byobRequest attribute.
580
581         Added tests related to ReadableStreamBYOBRequest as a dedicated object
582         and also as an attribute of ReadableByteStreamController.
583
584         * CMakeLists.txt: Added new files.
585         * DerivedSources.cpp: Added new files.
586         * DerivedSources.make: Added new files.
587         * Modules/streams/ReadableByteStreamController.idl: Added byobRequest support.
588         * Modules/streams/ReadableByteStreamController.js: Added byobRequest support.
589         * Modules/streams/ReadableByteStreamInternals.js:
590         (privateInitializeReadableStreamBYOBRequest): Added constructor.
591         * Modules/streams/ReadableStreamBYOBRequest.idl: Added.
592         * Modules/streams/ReadableStreamBYOBRequest.js: Added.
593         (respond): Not implemented yet.
594         (respondWithNewView): Not implemented yet.
595         (view): Not implemented yet.
596         * WebCore.xcodeproj/project.pbxproj: Added new files.
597         * bindings/js/JSDOMGlobalObject.cpp: Added ReadableStreamBYOBRequest support.
598         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
599         (WebCore::JSDOMGlobalObject::finishCreation):
600         (WebCore::JSDOMGlobalObject::visitChildren):
601         * bindings/js/JSReadableStreamPrivateConstructors.cpp: Added ReadableStreamBYOBRequest support.
602         (WebCore::constructJSReadableByteStreamController):
603         (WebCore::constructJSReadableStreamBYOBRequest):
604         (WebCore::JSBuiltinReadableStreamBYOBRequestPrivateConstructor::initializeExecutable):
605         (WebCore::createReadableStreamBYOBRequestPrivateConstructor):
606         * bindings/js/JSReadableStreamPrivateConstructors.h: Added ReadableStreamBYOBRequest support.
607         * bindings/js/WebCoreBuiltinNames.h: Added ReadableStreamBYOBRequest support.
608
609 2017-02-20  Per Arne Vollan  <pvollan@apple.com>
610
611         [Win] Custom scale factor is not applied in all cases.
612         https://bugs.webkit.org/show_bug.cgi?id=168117
613
614         Reviewed by Brent Fulgham.
615
616         We should not call the function deviceScaleFactorForWindow directly, since this
617         will return the system scale factor, and ignore the custom scale factor.
618
619         * platform/graphics/ca/win/CACFLayerTreeHost.h:
620         * platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp:
621         (WebCore::WKCACFViewLayerTreeHost::initializeContext):
622         (WebCore::WKCACFViewLayerTreeHost::resize):
623         (WebCore::WKCACFViewLayerTreeHost::setScaleFactor):
624         * platform/graphics/ca/win/WKCACFViewLayerTreeHost.h:
625         * platform/win/GDIUtilities.h:
626         (WebCore::makeScaledPoint):
627         * platform/win/PlatformMouseEventWin.cpp:
628         (WebCore::positionForEvent):
629         * platform/win/PopupMenuWin.cpp:
630         (WebCore::PopupMenuWin::show):
631         (WebCore::PopupMenuWin::wndProc):
632         * platform/win/PopupMenuWin.h:
633
634 2017-02-20  Jon Lee  <jonlee@apple.com>
635
636         Fix build error for iOS. Unreviewed.
637
638         * platform/graphics/GraphicsContext3D.cpp: Move stub function into !PLATFORM(COCOA) instead of !PLATFORM(MAC).
639
640 2017-02-20  Jon Lee  <jonlee@apple.com>
641
642         Unreviewed, rolling out r212639.
643
644         Have a fix for the linker error on iOS.
645
646         Reverted changeset:
647
648         "Unreviewed, rolling out r212637."
649         https://bugs.webkit.org/show_bug.cgi?id=168595
650         http://trac.webkit.org/changeset/212639
651
652 2017-02-20  Youenn Fablet  <youenn@apple.com>
653
654         [WebRTC] Fix some memory leaks in libwebrtc binding code
655         https://bugs.webkit.org/show_bug.cgi?id=168596
656
657         Reviewed by Eric Carlson.
658
659         Covered by manual testing.
660
661         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
662         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::StatsCollector): Using the libwebrtc way of creating such objects.
663         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
664         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::create):
665         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
666         (WebCore::PeerConnectionFactoryAndThreads::OnMessage):
667
668 2017-02-20  Alexey Proskuryakov  <ap@apple.com>
669
670         Clean up how WebKit exports _WebCreateFragment
671         https://bugs.webkit.org/show_bug.cgi?id=168579
672
673         Reviewed by Dan Bernstein.
674
675         * editing/Editor.h: Removed the declaration of _WebCreateFragment, SOFT_LINK doesn't need it.
676         * editing/cocoa/EditorCocoa.mm: Moved a FIXME comment here.
677
678 2017-02-20  Ryan Haddad  <ryanhaddad@apple.com>
679
680         Unreviewed, rolling out r212637.
681
682         This change broke iOS builds.
683
684         Reverted changeset:
685
686         "Add 'webglcontextchanged' WebGLContextEvent"
687         https://bugs.webkit.org/show_bug.cgi?id=168595
688         http://trac.webkit.org/changeset/212637
689
690 2017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
691
692         Remove code under USE(GRAPHICS_SURFACE)
693         https://bugs.webkit.org/show_bug.cgi?id=168592
694
695         Reviewed by Michael Catanzaro.
696
697         This was only used by EFL port.
698
699         * platform/TextureMapper.cmake:
700         * platform/graphics/opengl/GLPlatformSurface.cpp: Removed.
701         * platform/graphics/surfaces/GLTransportSurface.cpp: Removed.
702         * platform/graphics/surfaces/GLTransportSurface.h: Removed.
703         * platform/graphics/surfaces/GraphicsSurface.cpp: Removed.
704         * platform/graphics/surfaces/GraphicsSurface.h: Removed.
705         * platform/graphics/surfaces/GraphicsSurfaceToken.h: Removed.
706         * platform/graphics/surfaces/egl/EGLConfigSelector.cpp: Removed.
707         * platform/graphics/surfaces/egl/EGLConfigSelector.h: Removed.
708         * platform/graphics/surfaces/egl/EGLContext.cpp: Removed.
709         * platform/graphics/surfaces/egl/EGLContext.h: Removed.
710         * platform/graphics/surfaces/egl/EGLHelper.cpp: Removed.
711         * platform/graphics/surfaces/egl/EGLHelper.h: Removed.
712         * platform/graphics/surfaces/egl/EGLSurface.cpp: Removed.
713         * platform/graphics/surfaces/egl/EGLSurface.h: Removed.
714         * platform/graphics/surfaces/egl/EGLXSurface.cpp: Removed.
715         * platform/graphics/surfaces/egl/EGLXSurface.h: Removed.
716         * platform/graphics/surfaces/glx/GLXConfigSelector.h: Removed.
717         * platform/graphics/surfaces/glx/GLXContext.cpp: Removed.
718         * platform/graphics/surfaces/glx/GLXContext.h: Removed.
719         * platform/graphics/surfaces/glx/GLXSurface.cpp: Removed.
720         * platform/graphics/surfaces/glx/GLXSurface.h: Removed.
721         * platform/graphics/surfaces/glx/X11Helper.cpp: Removed.
722         * platform/graphics/surfaces/glx/X11Helper.h: Removed.
723         * platform/graphics/texmap/TextureMapperBackingStore.cpp:
724         * platform/graphics/texmap/TextureMapperBackingStore.h:
725         * platform/graphics/texmap/TextureMapperPlatformLayer.h:
726         (WebCore::TextureMapperPlatformLayer::setClient):
727         * platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp: Removed.
728         * platform/graphics/texmap/TextureMapperSurfaceBackingStore.h: Removed.
729         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
730         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
731         (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay):
732         (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer):
733         (WebCore::CoordinatedGraphicsLayer::syncPlatformLayer):
734         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
735         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
736         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
737
738 2017-02-20  Dean Jackson  <dino@apple.com>
739
740         Add 'webglcontextchanged' WebGLContextEvent
741         https://bugs.webkit.org/show_bug.cgi?id=168595
742         <rdar://problem/30604254>
743
744         Reviewed by Antoine Quint.
745
746         Add a new event that is dispatched when the GraphicsContext3D
747         notices that the active GPU has changed.
748
749         Test: fast/canvas/webgl/webglcontextchangedevent.html
750
751         * dom/EventNames.h: Add 'webglcontextchanged'.
752         * html/canvas/WebGLRenderingContextBase.cpp:
753         (WebCore::WebGLRenderingContextBase::dispatchContextChangedEvent): Dispatch the new event.
754         (WebCore::WebGLRenderingContextBase::simulateContextChanged): Tell the GraphicsContext3D to
755         pretend there was a GPU switch. This is called from Internals for testing.
756         * html/canvas/WebGLRenderingContextBase.h:
757         * html/canvas/WebGLRenderingContextBase.idl: Export the interface so Internals can see it.
758
759         * platform/graphics/GraphicsContext3D.cpp:
760         (WebCore::GraphicsContext3D::simulateContextChanged): Tell the GraphicsContext3DManager
761         that it should pretend a GPU change has happened, which causes it to notify all the
762         active contexts.
763         * platform/graphics/GraphicsContext3D.h:
764
765         * platform/graphics/mac/GraphicsContext3DMac.mm:
766         (WebCore::GraphicsContext3DManager::updateAllContexts): Tell the GraphicsContext3Ds
767         to tell their WebGLRenderingContexts to dispatch an event.
768         (WebCore::GraphicsContext3D::simulateContextChanged): Fake the display change.
769         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
770         (WebCore::GraphicsContext3D::dispatchContextChangedNotification): Tell the WebGLRenderingContext
771         that a change has occurred, and that it should dispatch an event. This is a layering
772         violation which will need to be fixed (although with other communication from GC3D back
773         to WebGL).
774         * testing/Internals.cpp:
775         (WebCore::Internals::simulateWebGLContextChanged):
776         * testing/Internals.h:
777         * testing/Internals.idl:
778
779 2017-02-19  Dean Jackson  <dino@apple.com>
780
781         Activate/deactivate high performance GPU when requested
782         https://bugs.webkit.org/show_bug.cgi?id=168559
783         <rdar://problem/30592266>
784
785         Reviewed by Jon Lee.
786
787         Respect the high-performance powerPreference for WebGL, by managing an
788         object that enables the high-performance GPU. If a WebGL context wants
789         high-performance, and it is visible, then a manager class in GraphicsContext3D
790         creates and retains the object, causing all the WebGL contexts to move GPUs.
791         If all the high-performance contexts are not visible, such as in a background tab,
792         then the manager will release the object, allowing the GPU to power down.
793
794         The swapping back from the high-performance GPU happens on a timer, to make
795         sure we don't churn between GPUs if the user is swapping between a lot of tabs,
796         or windows.
797
798         Unfortunately testing this change properly requires hardware with
799         multiple GPUs. I plan to write an API test that fakes most of the
800         system interaction, such as occluding the page. An API test might
801         also be able to verify if the system has more than one GPU. Otherwise
802         I'll have to plumb everything through Internals.
803
804         * html/canvas/WebGLRenderingContextBase.cpp:
805         (WebCore::isHighPerformanceContext): Helper to detect if the GraphicsContext3D actually
806         used high-performance mode.
807         (WebCore::WebGLRenderingContextBase::create): Add logging if we are
808         actually overriding a high-performance request.
809         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase): If we are high-performance,
810         then register for activity state changes.
811         (WebCore::WebGLRenderingContextBase::addActivityStateChangeObserverIfNecessary):
812         (WebCore::WebGLRenderingContextBase::removeActivityStateChangeObserver):
813         (WebCore::WebGLRenderingContextBase::destroyGraphicsContext3D): Call removeActivityStateChangeObserver
814         as the GC3D is destroyed.
815         (WebCore::WebGLRenderingContextBase::maybeRestoreContext): If the context was
816         restored successfully, and came back in high-performance, then we need
817         to listen for activity state changes as usual.
818         (WebCore::WebGLRenderingContextBase::activityStateDidChange): If we changed visibility,
819         tell the GC3D.
820         * html/canvas/WebGLRenderingContextBase.h: Class inherits ActivityStateChangeObserver.
821
822         * page/Settings.in: No longer force low-power everywhere.
823
824         * platform/graphics/GraphicsContext3D.cpp:
825         (WebCore::GraphicsContext3D::setContextVisibility): Empty implementation for non-Mac.
826         * platform/graphics/GraphicsContext3D.h:
827         (WebCore::GraphicsContext3D::powerPreferenceUsedForCreation): Tells clients what power preference
828         was actually used during creation (e.g. a single GPU system will use default, even if
829         they requested high-performance).
830
831         * platform/graphics/mac/GraphicsContext3DMac.mm:
832         (WebCore::GraphicsContext3DManager::GraphicsContext3DManager): Helper class to
833         look after all GraphicsContext3Ds.
834         (WebCore::GraphicsContext3DManager::hasTooManyContexts): We have a limit on the
835         number of contexts we can keep alive at any one time.
836         (WebCore::manager): Helper to return the static instance.
837         (WebCore::displayWasReconfigured): Send a message to all the contexts.
838         (WebCore::GraphicsContext3DManager::addContext):
839         (WebCore::GraphicsContext3DManager::removeContext):
840         (WebCore::GraphicsContext3DManager::addContextRequiringHighPerformance):
841         (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance):
842         (WebCore::GraphicsContext3DManager::updateHighPerformanceState): Check if the number
843         of contexts requiring high-performance means we need to enable/disable that GPU.
844         (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired): Releases our
845         object that keeps the high-performance GPU on.
846         (WebCore::GraphicsContext3DManager::recycleContextIfNecessary): Get rid of the first (oldest)
847         context. This code was in GC3D proper, but it made more sense here in the helper.
848         (WebCore::setPixelFormat): All contexts are created muxable now.
849         (WebCore::GraphicsContext3D::create): Use the manager.
850         (WebCore::GraphicsContext3D::GraphicsContext3D): Ditto.
851         (WebCore::GraphicsContext3D::~GraphicsContext3D): Add logging.
852         (WebCore::GraphicsContext3D::checkGPUStatusIfNecessary): Better logging.
853         (WebCore::GraphicsContext3D::updateCGLContext):
854         (WebCore::GraphicsContext3D::setContextVisibility): This is the responder to the
855         ActivityStateChanges in the WebGLRenderingContext.
856         (WebCore::activeContexts): Deleted.
857         (WebCore::addActiveContext): Deleted.
858         (WebCore::removeActiveContext): Deleted.
859
860 2017-02-20  Manuel Rego Casasnovas  <rego@igalia.com>
861
862         [css-grid] Remove compilation flag ENABLE_CSS_GRID_LAYOUT
863         https://bugs.webkit.org/show_bug.cgi?id=167693
864
865         Reviewed by Sergio Villar Senin.
866
867         * Configurations/FeatureDefines.xcconfig:
868         * css/CSSComputedStyleDeclaration.cpp:
869         (WebCore::valueForGridPosition):
870         (WebCore::isLayoutDependent):
871         (WebCore::resolveJustifySelfAuto):
872         (WebCore::isImplicitlyInheritedGridOrFlexProperty):
873         (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):
874         (WebCore::ComputedStyleExtractor::propertyValue):
875         * css/CSSGridAutoRepeatValue.cpp:
876         * css/CSSGridAutoRepeatValue.h:
877         * css/CSSGridLineNamesValue.cpp:
878         * css/CSSGridLineNamesValue.h:
879         * css/CSSGridTemplateAreasValue.cpp:
880         * css/CSSGridTemplateAreasValue.h:
881         * css/CSSPrimitiveValueMappings.h:
882         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
883         * css/CSSProperties.json:
884         * css/CSSValue.cpp:
885         (WebCore::CSSValue::equals):
886         (WebCore::CSSValue::cssText):
887         (WebCore::CSSValue::destroy):
888         * css/CSSValue.h:
889         (WebCore::CSSValue::isContentDistributionValue):
890         (WebCore::CSSValue::isGridLineNamesValue):
891         * css/CSSValueKeywords.in:
892         * css/StyleBuilderConverter.h:
893         (WebCore::StyleBuilderConverter::convertGridAutoFlow):
894         (WebCore::StyleBuilderConverter::convertContentAlignmentData):
895         * css/StyleBuilderCustom.h:
896         (WebCore::StyleBuilderCustom::applyValueGridTemplateRows):
897         * css/StyleProperties.cpp:
898         (WebCore::StyleProperties::getPropertyValue):
899         * css/StyleResolver.cpp:
900         (WebCore::equivalentBlockDisplay):
901         * css/StyleResolver.h:
902         * css/parser/CSSParser.cpp:
903         (WebCore::CSSParserContext::CSSParserContext):
904         (WebCore::operator==):
905         * css/parser/CSSParserFastPaths.cpp:
906         (WebCore::isSimpleLengthPropertyID):
907         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
908         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
909         * css/parser/CSSParserMode.h:
910         (WebCore::CSSParserContextHash::hash):
911         * css/parser/CSSPropertyParser.cpp:
912         (WebCore::consumeGridAutoFlow):
913         (WebCore::consumeGridTemplateAreas):
914         (WebCore::CSSPropertyParser::parseSingleValue):
915         (WebCore::CSSPropertyParser::consumeGridShorthand):
916         (WebCore::CSSPropertyParser::parseShorthand):
917         * dom/Document.cpp:
918         * dom/Document.h:
919         * dom/Position.cpp:
920         (WebCore::Position::isCandidate):
921         * page/RuntimeEnabledFeatures.h:
922         (WebCore::RuntimeEnabledFeatures::isCSSGridLayoutEnabled):
923         * rendering/Grid.cpp:
924         * rendering/Grid.h:
925         * rendering/RenderBlock.cpp:
926         (WebCore::RenderBlock::getFirstLetter):
927         * rendering/RenderBox.cpp:
928         (WebCore::RenderBox::~RenderBox):
929         (WebCore::RenderBox::styleDidChange):
930         (WebCore::RenderBox::clearExtraInlineAndBlockOffests):
931         (WebCore::RenderBox::containingBlockLogicalWidthForContent):
932         (WebCore::RenderBox::containingBlockLogicalHeightForContent):
933         (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight):
934         (WebCore::RenderBox::computeLogicalWidthInRegion):
935         (WebCore::RenderBox::sizesLogicalWidthToFitContent):
936         (WebCore::RenderBox::computeLogicalHeight):
937         (WebCore::RenderBox::computePercentageLogicalHeight):
938         (WebCore::RenderBox::containingBlockLogicalWidthForPositioned):
939         (WebCore::RenderBox::containingBlockLogicalHeightForPositioned):
940         (WebCore::RenderBox::computePositionedLogicalWidth):
941         (WebCore::RenderBox::computePositionedLogicalHeight):
942         (WebCore::RenderBox::createsNewFormattingContext):
943         (WebCore::logicalWidthIsResolvable):
944         (WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock):
945         (WebCore::RenderBox::hasDefiniteLogicalHeight):
946         * rendering/RenderBox.h:
947         (WebCore::RenderBox::isGridItem):
948         * rendering/RenderElement.cpp:
949         (WebCore::RenderElement::createFor):
950         * rendering/RenderFlexibleBox.cpp:
951         (WebCore::RenderFlexibleBox::alignChildren):
952         * rendering/RenderGrid.cpp:
953         * rendering/RenderGrid.h:
954         * rendering/RenderObject.h:
955         (WebCore::RenderObject::isRenderGrid):
956         * rendering/style/GridArea.h:
957         * rendering/style/GridLength.h:
958         * rendering/style/GridPosition.h:
959         * rendering/style/GridPositionsResolver.cpp:
960         * rendering/style/GridPositionsResolver.h:
961         * rendering/style/GridTrackSize.h:
962         * rendering/style/RenderStyle.cpp:
963         (WebCore::RenderStyle::isCSSGridLayoutEnabled):
964         (WebCore::RenderStyle::changeRequiresLayout):
965         * rendering/style/RenderStyle.h:
966         (WebCore::RenderStyle::gridItemRowEnd):
967         (WebCore::RenderStyle::setGridRowGap):
968         (WebCore::RenderStyle::initialGridItemRowEnd):
969         (WebCore::RenderStyle::isDisplayReplacedType):
970         (WebCore::RenderStyle::isDisplayGridBox):
971         * rendering/style/RenderStyleConstants.h:
972         * rendering/style/StyleGridData.cpp:
973         * rendering/style/StyleGridData.h:
974         * rendering/style/StyleGridItemData.cpp:
975         * rendering/style/StyleGridItemData.h:
976         * rendering/style/StyleRareNonInheritedData.cpp:
977         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
978         (WebCore::StyleRareNonInheritedData::operator==):
979         * rendering/style/StyleRareNonInheritedData.h:
980         * testing/InternalSettings.cpp:
981         (WebCore::InternalSettings::Backup::Backup):
982         (WebCore::InternalSettings::Backup::restoreTo):
983         (WebCore::InternalSettings::setCSSGridLayoutEnabled):
984
985 2017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
986
987         REGRESSION(r212345): [GTK] ASSERT(cookieChangeCallbackMap().contains(jar)) failed in WebCore::stopObservingCookieChanges:54
988         https://bugs.webkit.org/show_bug.cgi?id=168375
989
990         Reviewed by Alex Christensen.
991
992         Simplify the way cookie storage is handled in NetworkStorageSessionSoup. Now we always keep a reference to the
993         cookie jar, no matter if we have a session or not, that is always kept in sync with the one actually used by the
994         session. We always connect to the changed signal of the current cookie jar and notify the observer if it has been
995         set.
996
997         * platform/network/NetworkStorageSession.h:
998         * platform/network/soup/CookieStorageSoup.cpp:
999         (WebCore::startObservingCookieChanges): Remove this implementation and add an ASSERT to ensure we don't use this anymore.
1000         (WebCore::stopObservingCookieChanges): Ditto.
1001         (WebCore::cookieChangeCallbackMap): Deleted.
1002         (WebCore::soupCookiesChanged): Deleted.
1003         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1004         (WebCore::NetworkStorageSession::NetworkStorageSession): Initialize the cookie storage.
1005         (WebCore::NetworkStorageSession::~NetworkStorageSession): Disconnect the changed signal.
1006         (WebCore::NetworkStorageSession::getOrCreateSoupNetworkSession): Always pass the current cookie storage.
1007         (WebCore::NetworkStorageSession::cookiesDidChange): Notify the observer.
1008         (WebCore::NetworkStorageSession::cookieStorage): Return the current cookie storage.
1009         (WebCore::NetworkStorageSession::setCookieStorage): Update the current cookie storage and update the session if
1010         needed too. We always have a valid cookie storage so if nullptr is given we create a new one.
1011         (WebCore::NetworkStorageSession::setCookieObserverHandler): Set a cookie observer handler.
1012
1013 2017-02-19  Chris Dumez  <cdumez@apple.com>
1014
1015         onbeforeunload event return value coercion is not per-spec
1016         https://bugs.webkit.org/show_bug.cgi?id=168382
1017
1018         Reviewed by Darin Adler.
1019
1020         Update handling of value returned by onbeforeunload event listeners
1021         to match Firefox and the specification:
1022         - https://html.spec.whatwg.org/#the-event-handler-processing-algorithm (step 4)
1023
1024         Namely, the following changes were made:
1025         - Only set the event's returnValue attribute to the returned value if the attribute
1026           value is the empty string (so as to not override the attribute value if it has
1027           explicitly been set by JS).
1028         - Cancel the event when the return value is not null by calling preventDefault().
1029
1030         Additionally, the following changes were made:
1031         - Ask the user to confirm the navigation if the event was canceled, not just if the
1032           returnValue attribute was set to a non-empty string.
1033         as per:
1034         - https://html.spec.whatwg.org/#prompt-to-unload-a-document (step 8)
1035
1036         Tests: fast/events/before-unload-return-string-conversion.html
1037                imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-canceling.html
1038
1039         * bindings/js/JSEventListener.cpp:
1040         (WebCore::handleBeforeUnloadEventReturnValue):
1041         (WebCore::JSEventListener::handleEvent):
1042         * loader/FrameLoader.cpp:
1043         (WebCore::shouldAskForNavigationConfirmation):
1044         (WebCore::FrameLoader::dispatchBeforeUnloadEvent):
1045
1046 2017-02-19  Carlos Garcia Campos  <cgarcia@igalia.com>
1047
1048         [SOUP] Call SoupNetworkSession::setShouldIgnoreTLSErrors when testRunner.setAllowsAnySSLCertificate() is called
1049         https://bugs.webkit.org/show_bug.cgi?id=168571
1050
1051         Reviewed by Michael Catanzaro.
1052
1053         Fixes: http/tests/ssl/upgrade-origin-usage.html
1054
1055         * testing/InternalSettings.cpp:
1056         (WebCore::InternalSettings::setAllowsAnySSLCertificate):
1057
1058 2017-02-18  Ryosuke Niwa  <rniwa@webkit.org>
1059
1060         REGRESSION(r212218): Assertion failures in and after parserRemoveChild
1061         https://bugs.webkit.org/show_bug.cgi?id=168458
1062
1063         Reviewed by Antti Koivisto.
1064
1065         The bug was caused by parserRemoveChild not preceeding to remove oldChild even when
1066         oldChild had been inserted elsewhere during unload evnets of the disconnected frames.
1067         Fixed the bug by checking this condition and exiting early.
1068
1069         Also fixed various callers of parserRemoveChild to not call parserAppendChild when
1070         the removed node had already been inserted elsewhere by scripts.
1071
1072         Tests: fast/parser/adoption-agency-unload-iframe-3.html
1073                fast/parser/adoption-agency-unload-iframe-4.html
1074                fast/parser/xml-error-unload-iframe.html
1075
1076         * dom/ContainerNode.cpp:
1077         (WebCore::ContainerNode::parserRemoveChild): Exit early when the node had been
1078         inserted elsewhere while firing unload events. Also moved the call to
1079         notifyRemovePendingSheetIfNeeded outside NoEventDispatchAssertion since it can
1080         synchrnously fire a focus event.
1081         (WebCore::ContainerNode::parserAppendChild): Moved adoptNode call to inside
1082         NoEventDispatchAssertion since adoptNode call here should never mutate DOM.
1083         * html/parser/HTMLConstructionSite.cpp:
1084         (WebCore::executeReparentTask): Added an early exit when the node had already been
1085         inserted elsewhere.
1086         (WebCore::executeInsertAlreadyParsedChildTask): Ditto.
1087         * xml/XMLErrors.cpp:
1088         (WebCore::XMLErrors::insertErrorMessageBlock): Ditto.
1089         * xml/parser/XMLDocumentParser.cpp:
1090         (WebCore::XMLDocumentParser::end): Fixed a crash unveiled by one of the test cases.
1091         Exit early when insertErrorMessageBlock detached the parser (by author scripts).
1092         (WebCore::XMLDocumentParser::finish): Keep the parser alive until we exit.
1093
1094 2017-02-19  Chris Dumez  <cdumez@apple.com>
1095
1096         <input type=color readonly> doesn't act per spec
1097         https://bugs.webkit.org/show_bug.cgi?id=168421
1098         <rdar://problem/30593185>
1099
1100         Reviewed by Ryosuke Niwa.
1101
1102         The 'readonly' attribute should not apply to <input type=color> as per the
1103         HTML specification:
1104         - https://html.spec.whatwg.org/#the-input-element:attr-input-readonly-3
1105
1106         Chrome / Firefox and Edge already behave as per the specification.
1107
1108         Tests: fast/forms/color/input-color-disabled.html
1109                fast/forms/color/input-color-readonly.html
1110
1111         * html/ColorInputType.cpp:
1112         (WebCore::ColorInputType::handleDOMActivateEvent):
1113         (WebCore::ColorInputType::didChooseColor):
1114
1115 2017-02-19  Commit Queue  <commit-queue@webkit.org>
1116
1117         Unreviewed, rolling out r212466.
1118         https://bugs.webkit.org/show_bug.cgi?id=168577
1119
1120         causes crashes on AArch64 on linux, maybe it's causing crashes
1121         on iOS too (Requested by pizlo on #webkit).
1122
1123         Reverted changeset:
1124
1125         "The collector thread should only start when the mutator
1126         doesn't have heap access"
1127         https://bugs.webkit.org/show_bug.cgi?id=167737
1128         http://trac.webkit.org/changeset/212466
1129
1130 2017-02-19  Zalan Bujtas  <zalan@apple.com>
1131
1132         Simple line layout: Implement positionForPoint.
1133         https://bugs.webkit.org/show_bug.cgi?id=168565
1134         <rdar://problem/30593370>
1135
1136         Reviewed by Antti Koivisto.
1137
1138         With this patch, now we don't need to switch over to line box tree anymore when positionForPoint()
1139         is called on a single RenderText content (which is the majority of the simple line content).
1140         This patch also adds a new positionForPoint method which returns a Position object instead of VisiblePosition.
1141         Some of the positionForPoint() callsites are only interested in the Position object so constructing a VisiblePosition
1142         (which could potentially kick off a layout) is a waste. At this point the non-simple line layout codepath still constructs
1143         a VisiblePosition and that should be addresses as part of webkit.org/b/168566.
1144
1145         Covered by existing tests.
1146
1147         * dom/Document.cpp:
1148         (WebCore::Document::caretRangeFromPoint):
1149         * rendering/RenderBlockFlow.cpp:
1150         (WebCore::RenderBlockFlow::positionForPoint):
1151         * rendering/RenderBlockFlow.h:
1152         * rendering/RenderObject.cpp:
1153         (WebCore::RenderObject::positionForPoint):
1154         * rendering/RenderObject.h:
1155         * rendering/RenderText.cpp:
1156         (WebCore::RenderText::positionForPoint):
1157         * rendering/RenderText.h:
1158         * rendering/SimpleLineLayoutFunctions.cpp:
1159         (WebCore::SimpleLineLayout::positionForPoint):
1160         * rendering/SimpleLineLayoutFunctions.h:
1161         * rendering/SimpleLineLayoutResolver.cpp:
1162         (WebCore::SimpleLineLayout::RunResolver::runForPoint):
1163         * rendering/SimpleLineLayoutResolver.h:
1164         (WebCore::SimpleLineLayout::RunResolver::Run::logicalLeft):
1165         (WebCore::SimpleLineLayout::RunResolver::Run::logicalRight):
1166
1167 2017-02-19  Antti Koivisto  <antti@apple.com>
1168
1169         Execute pending scripts asynchronously after stylesheet loads complete
1170         https://bugs.webkit.org/show_bug.cgi?id=168367
1171         rdar://problem/30561379
1172
1173         Reviewed by Andreas Kling.
1174
1175         The current synchronous execution is fragile and creates various problems.
1176
1177         * css/StyleSheetContents.cpp:
1178         (WebCore::StyleSheetContents::checkLoaded):
1179         * dom/ContainerNode.cpp:
1180         (WebCore::ContainerNode::takeAllChildrenFrom):
1181         (WebCore::ContainerNode::notifyChildInserted):
1182         (WebCore::ContainerNode::removeChild):
1183         (WebCore::ContainerNode::parserRemoveChild):
1184         (WebCore::ContainerNode::removeChildren):
1185
1186             Remove various places where we would trigger delayed synchronous execution.
1187
1188         * dom/Document.cpp:
1189         (WebCore::Document::Document):
1190         (WebCore::Document::recalcStyle):
1191
1192             Trigger scroll to anchor at the end of style resolution instead of when style sheet load completes.
1193
1194         (WebCore::Document::didRemoveAllPendingStylesheet):
1195
1196             Call asynchronous script execution function.
1197
1198         * dom/Document.h:
1199         (WebCore::Document::setNeedsNotifyRemoveAllPendingStylesheet): Deleted.
1200         (WebCore::Document::notifyRemovePendingSheetIfNeeded): Deleted.
1201         * dom/ScriptableDocumentParser.cpp:
1202         (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
1203         (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheetsSoon):
1204         (WebCore::ScriptableDocumentParser::scriptsWaitingForStylesheetsExecutionTimerFired):
1205
1206             Add a timer for executing pending scripts.
1207
1208         (WebCore::ScriptableDocumentParser::detach):
1209         * dom/ScriptableDocumentParser.h:
1210         (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheets):
1211         * html/HTMLLinkElement.cpp:
1212         (WebCore::HTMLLinkElement::removedFrom):
1213         (WebCore::HTMLLinkElement::removePendingSheet):
1214         * html/HTMLLinkElement.h:
1215         * html/parser/HTMLDocumentParser.cpp:
1216         (WebCore::HTMLDocumentParser::detach):
1217         * loader/DocumentLoader.cpp:
1218         (WebCore::DocumentLoader::isLoadingInAPISense):
1219
1220             Stay in loading state if we have a pending script. This matches existing behavior.
1221
1222         * style/StyleScope.cpp:
1223         (WebCore::Style::Scope::removePendingSheet):
1224         * style/StyleScope.h:
1225
1226 2017-02-18  Chris Dumez  <cdumez@apple.com>
1227
1228         <input type=range readonly> doesn't act per spec
1229         https://bugs.webkit.org/show_bug.cgi?id=168422
1230         <rdar://problem/30593189>
1231
1232         Reviewed by Ryosuke Niwa.
1233
1234         'readonly' attribute should not apply to <input type=range> as per the HTML
1235         specification:
1236         - https://html.spec.whatwg.org/#the-input-element:attr-input-readonly-3
1237
1238         Firefox and Edge already behave as per the specification.
1239
1240         No new tests, updated existing tests.
1241
1242         * html/RangeInputType.cpp:
1243         (WebCore::RangeInputType::handleMouseDownEvent):
1244         (WebCore::RangeInputType::handleTouchEvent):
1245         (WebCore::RangeInputType::handleKeydownEvent):
1246         * html/shadow/SliderThumbElement.cpp:
1247         (WebCore::SliderThumbElement::defaultEventHandler):
1248         (WebCore::SliderThumbElement::willRespondToMouseMoveEvents):
1249         (WebCore::SliderThumbElement::willRespondToMouseClickEvents):
1250
1251 2017-02-18  Chris Dumez  <cdumez@apple.com>
1252
1253         Recursive MessagePort.postMessage() calls causes tab to become unresponsive
1254         https://bugs.webkit.org/show_bug.cgi?id=168548
1255         <rdar://problem/29808005>
1256
1257         Reviewed by Darin Adler.
1258
1259         MessagePort::dispatchMessages() was getting messages one by one of the
1260         channel's MessageQueue and firing the MessageEvent for each of them.
1261         The issue is that we can get stuck in an infinite loop if the
1262         MessageEvent handler posts a message on the same post.
1263
1264         To address the issue, we now takes all messages from the queue before
1265         iterating over them to fire the event. This way, if new messages are
1266         added to the queue in one of the MessageEvent handlers, they will not
1267         be processed until the next event loop iteration, as is expected.
1268
1269         Test: fast/events/message-port-postMessage-recursive.html
1270
1271         * dom/MessagePort.cpp:
1272         (WebCore::MessagePort::dispatchMessages):
1273         * dom/MessagePortChannel.h:
1274         (WebCore::MessagePortChannel::EventData::EventData):
1275         * dom/default/PlatformMessagePortChannel.cpp:
1276         (WebCore::MessagePortChannel::postMessageToRemote):
1277         * dom/default/PlatformMessagePortChannel.h:
1278         (WebCore::PlatformMessagePortChannel::MessagePortQueue::takeMessage):
1279         (WebCore::PlatformMessagePortChannel::MessagePortQueue::takeAllMessages):
1280         (WebCore::PlatformMessagePortChannel::MessagePortQueue::appendAndCheckEmpty):
1281
1282 2017-02-18  Michael Catanzaro  <mcatanzaro@igalia.com>
1283
1284         Remove COORDINATED_GRAPHICS_MULTIPROCESS
1285         https://bugs.webkit.org/show_bug.cgi?id=168514
1286
1287         Reviewed by Darin Adler.
1288
1289         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1290         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1291
1292 2017-02-17  Simon Fraser  <simon.fraser@apple.com>
1293
1294         Allow properties in CSSProperties.json that don't trigger code generation
1295         https://bugs.webkit.org/show_bug.cgi?id=168535
1296
1297         Reviewed by Sam Weinig.
1298         
1299         In order to track the development of CSS properties that we have not yet implemented,
1300         support '"skip-codegen" : true' in "codegen-properties".
1301
1302         Test by adding a few fill-related properties with this attribute.
1303
1304         * css/CSSProperties.json:
1305         * css/makeprop.pl:
1306         (isPropertyEnabled):
1307         (addProperty):
1308
1309 2017-02-17  Brian Burg  <bburg@apple.com>
1310
1311         Web Inspector: RTL: Inspector window should dock to the left when using RTL layout direction
1312         https://bugs.webkit.org/show_bug.cgi?id=168273
1313         <rdar://problem/29949325>
1314
1315         Reviewed by Matt Baker.
1316
1317         Add the ability to dock Web Inspector to the left of the inspected view.
1318         The frontend decides whether the Dock to Side button docks left or right
1319         based on the current layout direction.
1320
1321         * inspector/InspectorFrontendClient.h:
1322         * inspector/InspectorFrontendClientLocal.cpp:
1323         (WebCore::InspectorFrontendClientLocal::setAttachedWindow):
1324         * inspector/InspectorFrontendHost.cpp:
1325         (WebCore::InspectorFrontendHost::requestSetDockSide):
1326
1327 2017-02-16  Simon Fraser  <simon.fraser@apple.com>
1328
1329         Allow PlatformCALayers to specify that they want deep color backing store
1330         https://bugs.webkit.org/show_bug.cgi?id=168495
1331
1332         Reviewed by Tim Horton.
1333         
1334         Currently capable iOS devices get deep color backing store by virtue of a supports
1335         check in PlatformCALayerCocoa::PlatformCALayerCocoa(), and LegacyTileGridTile.
1336
1337         Future work will make layer contents format selection more complex, so express the need
1338         for deep color on PlatformCALayer, and have the creators of PlatformCALayer (mainly the
1339         flavors of GraphicsLayerCA) choose for them to support deep color. A bit of special-casing
1340         is needed to propagte the state to TileControllers.
1341         
1342         The deep-colorness now propagates from PlatformCALayerRemote to RemoteLayerBackingStore,
1343         instead of RemoteLayerBackingStore looking at the properties of the screen directly.
1344
1345         Remove PlatformCALayer::LayerTypeWebTiledLayer which was only used for the old CATiledLayers
1346         that we no longer use.
1347
1348         An iphone7 test verifies that page tiles, normal layers and tiled layers get the deep
1349         color state set on them.
1350
1351         Test: tiled-drawing/ios/iphone7/compositing-layers-deep-color.html
1352
1353         * platform/graphics/ca/GraphicsLayerCA.cpp:
1354         (WebCore::GraphicsLayerCA::createPlatformCALayer):
1355         (WebCore::GraphicsLayerCA::dumpAdditionalProperties):
1356         * platform/graphics/ca/GraphicsLayerCA.h:
1357         * platform/graphics/ca/PlatformCALayer.cpp:
1358         (WebCore::PlatformCALayer::canHaveBackingStore):
1359         (WebCore::operator<<):
1360         * platform/graphics/ca/PlatformCALayer.h:
1361         * platform/graphics/ca/TileController.cpp:
1362         (WebCore::TileController::setZoomedOutContentsScale):
1363         (WebCore::TileController::setAcceleratesDrawing):
1364         (WebCore::TileController::setWantsDeepColorBackingStore):
1365         (WebCore::TileController::createTileLayer):
1366         * platform/graphics/ca/TileController.h:
1367         * platform/graphics/ca/TileGrid.cpp:
1368         (WebCore::TileGrid::updateTileLayerProperties):
1369         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
1370         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1371         (PlatformCALayerCocoa::PlatformCALayerCocoa):
1372         (PlatformCALayerCocoa::commonInit):
1373         (PlatformCALayerCocoa::wantsDeepColorBackingStore):
1374         (PlatformCALayerCocoa::setWantsDeepColorBackingStore):
1375         (layerContentsFormat):
1376         (PlatformCALayerCocoa::updateContentsFormat):
1377         * platform/graphics/ca/cocoa/WebTiledBackingLayer.h:
1378         * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
1379         (-[WebTiledBackingLayer setWantsDeepColorBackingStore:]):
1380         (-[WebTiledBackingLayer wantsDeepColorBackingStore]):
1381         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
1382         (PlatformCALayerWin::wantsDeepColorBackingStore):
1383         (PlatformCALayerWin::setWantsDeepColorBackingStore):
1384         (printLayer):
1385         * platform/graphics/ca/win/PlatformCALayerWin.h:
1386         * platform/spi/cocoa/QuartzCoreSPI.h:
1387
1388 2017-02-17  Jer Noble  <jer.noble@apple.com>
1389
1390         Refactoring: Make sure to unprepare WebAudioSourceProviderAVFObjC when its owner is destroyed.
1391         https://bugs.webkit.org/show_bug.cgi?id=168532
1392
1393         Reviewed by Youenn Fablet.
1394
1395         Because WebAudioSourceProviderAVFObjC has a back-pointer to the object which creted it, make
1396         sure that back-pointer is invalidated once the creating object is destroyed by calling
1397         WebAudioSOurceProviderAVFObjC::unprepare().
1398
1399         Drive-by Fix: In WebAudioSourceProviderAVFObjC::audioSamplesAvailable(), PlatformAudioData will
1400         always be of the WebAudioBufferList type. If this ever becomes untrue, an invalid downcast will
1401         be caught by downcast<>, so just remove the is<> check.
1402
1403         * platform/mediastream/mac/AVAudioCaptureSource.mm:
1404         (WebCore::AVAudioCaptureSource::~AVAudioCaptureSource):
1405         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
1406         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
1407         (WebCore::MockRealtimeAudioSourceMac::~MockRealtimeAudioSourceMac):
1408         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
1409         (WebCore::RealtimeIncomingAudioSource::~RealtimeIncomingAudioSource):
1410         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
1411         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
1412         (WebCore::WebAudioSourceProviderAVFObjC::~WebAudioSourceProviderAVFObjC):
1413         (WebCore::WebAudioSourceProviderAVFObjC::setClient):
1414         (WebCore::WebAudioSourceProviderAVFObjC::unprepare):
1415         (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
1416
1417 2017-02-17  Antoine Quint  <graouts@apple.com>
1418
1419         [Modern Media Controls] Improve handling of <video> with only audio tracks
1420         https://bugs.webkit.org/show_bug.cgi?id=167836
1421         <rdar://problem/30255812>
1422
1423         Reviewed by Dean Jackson.
1424
1425         We now check for the availability of video tracks before considering a <video>
1426         element is displaying an actual video file and turning auto-hide on. We also
1427         check that we have video tracks before enabling the fullscreen button. This
1428         brings the behavior of a <video> pointing to a resource with no video tracks
1429         to be the same as an <audio> element.
1430
1431         Test: media/modern-media-controls/media-controller/media-controller-video-with-only-audio.html
1432
1433         * Modules/modern-media-controls/media/controls-visibility-support.js:
1434         (ControlsVisibilitySupport.prototype.get tracksToMonitor):
1435         (ControlsVisibilitySupport.prototype._updateControls):
1436         (ControlsVisibilitySupport):
1437         * Modules/modern-media-controls/media/fullscreen-support.js:
1438         (FullscreenSupport.prototype.syncControl):
1439         (FullscreenSupport):
1440
1441 2017-02-17  Antoine Quint  <graouts@apple.com>
1442
1443         [Modern Media Controls] Toggle playback when clicking on the video on macOS
1444         https://bugs.webkit.org/show_bug.cgi?id=168515
1445         <rdar://problem/30577441>
1446
1447         Reviewed by Dean Jackson.
1448
1449         Listen to click events on the macOS media controls. Detect any clicks that were on the
1450         background instead of the controls widgets themselves, and tell the delegate (MediaController)
1451         about them.
1452
1453         Tests: media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause.html
1454                media/modern-media-controls/media-controller/media-controller-click-on-video-background-to-dismiss-tracks-panel-should-not-toggle-playback.html
1455                media/modern-media-controls/media-controller/media-controller-click-on-video-controls-should-not-pause.html
1456
1457         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
1458         (MacOSFullscreenMediaControls.prototype._handleMousedown):
1459         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
1460         (MacOSInlineMediaControls.prototype.handleEvent):
1461         * Modules/modern-media-controls/controls/macos-media-controls.js:
1462         (MacOSMediaControls.prototype.handleEvent):
1463         (MacOSMediaControls):
1464         * Modules/modern-media-controls/media/media-controller.js:
1465         (MediaController.prototype.togglePlayback):
1466         (MediaController.prototype.macOSControlsBackgroundWasClicked):
1467         (MediaController.prototype._updateControlsIfNeeded):
1468         * Modules/modern-media-controls/media/playback-support.js:
1469         (PlaybackSupport.prototype.buttonWasPressed):
1470
1471 2017-02-17  Jer Noble  <jer.noble@apple.com>
1472
1473         Refactoring: Remove AudioSourceObserverObjC and AudioCaptureSourceProviderObjC
1474         https://bugs.webkit.org/show_bug.cgi?id=168520
1475
1476         Reviewed by Youenn Fablet.
1477
1478         Having AudioCaptureSourceProviderObjC as the type provided to WebAudioSourceProviderAVFObjC
1479         (and only ever to WebAudioSourceProviderAVFObjC) makes it impossible for that class to add
1480         an observer on RealtimeMediaSource, of which all classes inheriting from
1481         WebAudioSourceProviderAVFObjC are subclasses. There is no need to treat
1482         WebAudioSourceProviderAVFObjC as an "observer", since the only thing it will ever observe is
1483         the object which created it and hold an explicit reference to it. So replace all instances
1484         of the "observer" pattern with direct calls to the necessary (newly non-virtual) methods.
1485         This allows WebAudioSourceProviderAVFObjC to register as an observer directly on
1486         RealtimeMediaSource, to listen for audioSamplesAvailable() instead of process(), and remove
1487         a lot of unnecessary conversion code and observer duplication.
1488
1489         * WebCore.xcodeproj/project.pbxproj:
1490         * platform/mediastream/RealtimeMediaSource.h:
1491         (WebCore::RealtimeMediaSource::Observer::sourceStopped):
1492         (WebCore::RealtimeMediaSource::Observer::sourceMutedChanged):
1493         (WebCore::RealtimeMediaSource::Observer::sourceEnabledChanged):
1494         (WebCore::RealtimeMediaSource::Observer::sourceSettingsChanged):
1495         (WebCore::RealtimeMediaSource::Observer::preventSourceFromStopping):
1496         * platform/mediastream/mac/AVAudioCaptureSource.h:
1497         * platform/mediastream/mac/AVAudioCaptureSource.mm:
1498         (WebCore::AVAudioCaptureSource::shutdownCaptureSession):
1499         (WebCore::AVAudioCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
1500         (WebCore::AVAudioCaptureSource::addObserver): Deleted.
1501         (WebCore::AVAudioCaptureSource::removeObserver): Deleted.
1502         (WebCore::AVAudioCaptureSource::start): Deleted.
1503         * platform/mediastream/mac/AudioCaptureSourceProviderObjC.h: Removed.
1504         * platform/mediastream/mac/AudioSourceObserverObjC.h: Removed.
1505         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
1506         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
1507         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
1508         (WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers):
1509         (WebCore::MockRealtimeAudioSourceMac::reconfigure):
1510         (WebCore::MockRealtimeAudioSourceMac::audioSourceProvider):
1511         (WebCore::MockRealtimeAudioSourceMac::addObserver): Deleted.
1512         (WebCore::MockRealtimeAudioSourceMac::removeObserver): Deleted.
1513         (WebCore::MockRealtimeAudioSourceMac::start): Deleted.
1514         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
1515         (WebCore::RealtimeIncomingAudioSource::audioSourceProvider):
1516         (WebCore::RealtimeIncomingAudioSource::addObserver): Deleted.
1517         (WebCore::RealtimeIncomingAudioSource::removeObserver): Deleted.
1518         (WebCore::RealtimeIncomingAudioSource::start): Deleted.
1519         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
1520         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1521         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1522         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
1523         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
1524         (WebCore::WebAudioSourceProviderAVFObjC::create):
1525         (WebCore::WebAudioSourceProviderAVFObjC::WebAudioSourceProviderAVFObjC):
1526         (WebCore::WebAudioSourceProviderAVFObjC::setClient):
1527         (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
1528         (WebCore::WebAudioSourceProviderAVFObjC::process): Deleted.
1529
1530 2017-02-17  Antoine Quint  <graouts@apple.com>
1531
1532         REGRESSION: Subtitles menu in media controls allows multiple items to be selected
1533         https://bugs.webkit.org/show_bug.cgi?id=168168
1534         <rdar://problem/30488605>
1535
1536         Reviewed by Dean Jackson.
1537
1538         Ensure that only a single audio track and a single text track can be selected
1539         in the tracks panel at any given point.
1540
1541         * Modules/modern-media-controls/media/tracks-support.js:
1542         (TracksSupport.prototype.tracksPanelSelectionDidChange):
1543         (TracksSupport.prototype._sortedTrackList):
1544         (TracksSupport):
1545
1546 2017-02-17  Jeremy Jones  <jeremyj@apple.com>
1547
1548         Invalidate WebAVSampleBufferStatusChangeListener when MediaPlayerPrivateMediaStreamAVFObjC is deallocated.
1549         https://bugs.webkit.org/show_bug.cgi?id=168488
1550
1551         Reviewed by Jer Noble.
1552
1553         Fixes periodically crashing test: fast/mediastream/MediaStream-video-element-track-stop.html
1554
1555         WebAVSampleBufferStatusChangeListener has an unretained referecne to MediaPlayerPrivateMediaStreamAVFObjC
1556         that must be invaldated when MediaPlayerPrivateMediaStreamAVFObjC is deallocated.
1557
1558         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1559         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC):
1560
1561 2017-02-17  Antoine Quint  <graouts@apple.com>
1562
1563         [Modern Media Controls] Improve handling of live broadcast video
1564         https://bugs.webkit.org/show_bug.cgi?id=168506
1565         <rdar://problem/30432094>
1566
1567         Reviewed by Dean Jackson.
1568
1569         We improve the handling of live broadcast video by:
1570         
1571             - checking that we have a media source before deciding to show the controls
1572               bar and start button
1573             - support a mode where neither the status text nor the scrubber is visible
1574               in case we're still waiting on sufficient data to determine the video
1575               time and we haven't really started loading data yet
1576             - not showing time labels when we have an infinite duration
1577             - ensuring the status label is left-aligned
1578
1579         Test: media/modern-media-controls/status-label/status-label-text-align.html
1580
1581         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
1582         (MacOSInlineMediaControls.prototype.layout):
1583         * Modules/modern-media-controls/controls/status-label.css:
1584         (.status-label):
1585         * Modules/modern-media-controls/controls/status-label.js:
1586         (StatusLabel.prototype.get enabled):
1587         (StatusLabel.prototype.set enabled):
1588         * Modules/modern-media-controls/media/controls-visibility-support.js:
1589         (ControlsVisibilitySupport.prototype._updateControls):
1590         (ControlsVisibilitySupport):
1591         * Modules/modern-media-controls/media/status-support.js:
1592         (StatusSupport.prototype.syncControl):
1593         (StatusSupport):
1594         * Modules/modern-media-controls/media/time-labels-support.js:
1595         (TimeLabelsSupport.prototype.syncControl):
1596         (TimeLabelsSupport):
1597
1598 2017-02-17  Anders Carlsson  <andersca@apple.com>
1599
1600         Begin overhauling the pasteboard implementation
1601         https://bugs.webkit.org/show_bug.cgi?id=168525
1602
1603         Reviewed by Tim Horton.
1604
1605         Add a new PasteboardWriterData object. This object will hold data that is going
1606         to be written to the pasteboard at some point. Currently it only supports plain text.
1607
1608         Also add a Mac-only PasteboardWriter class which can convert a PasteboardWriterDataObject
1609         into an object that conforms to NSPasteboardWriting.
1610
1611         The basic idea is that instead of doing a bunch of pasteboard operations,
1612         we'll just package all the pasteboard data up into an object and ship it over to WebKit.
1613
1614         This code is currently unused but will be adopted by a new drag implementation (in an upcoming patch).
1615
1616         * WebCore.xcodeproj/project.pbxproj:
1617         * platform/PasteboardWriterData.cpp: Added.
1618         (WebCore::PasteboardWriterData::PasteboardWriterData):
1619         (WebCore::PasteboardWriterData::~PasteboardWriterData):
1620         (WebCore::PasteboardWriterData::isEmpty):
1621         (WebCore::PasteboardWriterData::setPlainText):
1622         * platform/PasteboardWriterData.h: Added.
1623         * platform/mac/PasteboardWriter.h: Added.
1624         * platform/mac/PasteboardWriter.mm: Added.
1625         (WebCore::createPasteboardWriting):
1626         * platform/spi/mac/NSPasteboardSPI.h: Added.
1627
1628 2017-02-17  Per Arne Vollan  <pvollan@apple.com>
1629
1630         Apply SVG styles paint-order, stroke-linejoin, and stroke-linecap on DOM text.
1631         https://bugs.webkit.org/show_bug.cgi?id=168044
1632         rdar://problem/30165746
1633
1634         Reviewed by Simon Fraser.
1635
1636         This patch moves these styles out of svg, and sets the properties on video cues.
1637
1638         Tests: fast/css/parsing-paint-order.html
1639                fast/css/parsing-stroke-linecap.html
1640                fast/css/parsing-stroke-linejoin.html
1641                fast/css/parsing-stroke-width.html
1642
1643         * css/CSSComputedStyleDeclaration.cpp:
1644         (WebCore::paintOrder):
1645         (WebCore::ComputedStyleExtractor::propertyValue):
1646         * css/CSSProperties.json:
1647         * css/SVGCSSComputedStyleDeclaration.cpp:
1648         (WebCore::ComputedStyleExtractor::svgPropertyValue):
1649         (WebCore::paintOrder): Deleted.
1650         * css/StyleResolver.cpp:
1651         (WebCore::StyleResolver::isValidCueStyleProperty):
1652         * page/CaptionUserPreferencesMediaAF.cpp:
1653         (WebCore::CaptionUserPreferencesMediaAF::cssPropertyWithTextEdgeColor):
1654         * rendering/style/RenderStyle.cpp:
1655         (WebCore::RenderStyle::diff):
1656         (WebCore::RenderStyle::paintTypesForPaintOrder):
1657         * rendering/style/RenderStyle.h:
1658         (WebCore::RenderStyle::setPaintOrder):
1659         (WebCore::RenderStyle::paintOrder):
1660         (WebCore::RenderStyle::initialPaintOrder):
1661         (WebCore::RenderStyle::setCapStyle):
1662         (WebCore::RenderStyle::capStyle):
1663         (WebCore::RenderStyle::initialCapStyle):
1664         (WebCore::RenderStyle::setJoinStyle):
1665         (WebCore::RenderStyle::joinStyle):
1666         (WebCore::RenderStyle::initialJoinStyle):
1667         (WebCore::RenderStyle::strokeWidth):
1668         (WebCore::RenderStyle::setStrokeWidth):
1669         (WebCore::RenderStyle::hasVisibleStroke):
1670         (WebCore::RenderStyle::setStrokeOpacity):
1671         * rendering/style/SVGRenderStyle.cpp:
1672         (WebCore::SVGRenderStyle::diff):
1673         (WebCore::SVGRenderStyle::paintTypesForPaintOrder): Deleted.
1674         * rendering/style/SVGRenderStyle.h:
1675         (WebCore::SVGRenderStyle::initialBufferedRendering):
1676         (WebCore::SVGRenderStyle::initialFillRule):
1677         (WebCore::SVGRenderStyle::initialMaskType):
1678         (WebCore::SVGRenderStyle::setBufferedRendering):
1679         (WebCore::SVGRenderStyle::setFillRule):
1680         (WebCore::SVGRenderStyle::setMaskType):
1681         (WebCore::SVGRenderStyle::bufferedRendering):
1682         (WebCore::SVGRenderStyle::fillRule):
1683         (WebCore::SVGRenderStyle::strokeMiterLimit):
1684         (WebCore::SVGRenderStyle::maskType):
1685         (WebCore::SVGRenderStyle::hasStroke):
1686         (WebCore::SVGRenderStyle::setBitDefaults):
1687         (WebCore::SVGRenderStyle::InheritedFlags::operator==):
1688         (WebCore::SVGRenderStyle::initialCapStyle): Deleted.
1689         (WebCore::SVGRenderStyle::initialJoinStyle): Deleted.
1690         (WebCore::SVGRenderStyle::initialPaintOrder): Deleted.
1691         (WebCore::SVGRenderStyle::setCapStyle): Deleted.
1692         (WebCore::SVGRenderStyle::setJoinStyle): Deleted.
1693         (WebCore::SVGRenderStyle::setPaintOrder): Deleted.
1694         (WebCore::SVGRenderStyle::capStyle): Deleted.
1695         (WebCore::SVGRenderStyle::joinStyle): Deleted.
1696         (WebCore::SVGRenderStyle::strokeWidth): Deleted.
1697         (WebCore::SVGRenderStyle::paintOrder): Deleted.
1698         (WebCore::SVGRenderStyle::hasVisibleStroke): Deleted.
1699         (WebCore::SVGRenderStyle::setStrokeWidth): Deleted.
1700         * rendering/style/SVGRenderStyleDefs.cpp:
1701         (WebCore::StyleStrokeData::StyleStrokeData):
1702         (WebCore::StyleStrokeData::operator==):
1703         * rendering/style/SVGRenderStyleDefs.h:
1704         * rendering/style/StyleRareInheritedData.cpp:
1705         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
1706         (WebCore::StyleRareInheritedData::operator==):
1707         * rendering/style/StyleRareInheritedData.h:
1708         * rendering/svg/RenderSVGEllipse.cpp:
1709         (WebCore::RenderSVGEllipse::strokeShape):
1710         * rendering/svg/RenderSVGPath.cpp:
1711         (WebCore::RenderSVGPath::strokeShape):
1712         (WebCore::RenderSVGPath::shapeDependentStrokeContains):
1713         (WebCore::RenderSVGPath::shouldStrokeZeroLengthSubpath):
1714         (WebCore::RenderSVGPath::zeroLengthLinecapPath):
1715         * rendering/svg/RenderSVGRect.cpp:
1716         (WebCore::RenderSVGRect::strokeShape):
1717         * rendering/svg/RenderSVGShape.cpp:
1718         (WebCore::RenderSVGShape::strokeShape):
1719         (WebCore::RenderSVGShape::fillStrokeMarkers):
1720         (WebCore::RenderSVGShape::strokeWidth):
1721         (WebCore::RenderSVGShape::hasSmoothStroke):
1722         * rendering/svg/RenderSVGText.cpp:
1723         (WebCore::RenderSVGText::strokeBoundingBox):
1724         * rendering/svg/SVGInlineTextBox.cpp:
1725         (WebCore::SVGInlineTextBox::paint):
1726         (WebCore::SVGInlineTextBox::paintDecoration):
1727         * rendering/svg/SVGRenderSupport.cpp:
1728         (WebCore::SVGRenderSupport::applyStrokeStyleToContext):
1729         * rendering/svg/SVGRenderTreeAsText.cpp:
1730         (WebCore::writeStyle):
1731
1732 2017-02-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1733
1734         [SOUP] Handle Settings::allowsAnySSLCertificate() in SSL sockets
1735         https://bugs.webkit.org/show_bug.cgi?id=168521
1736
1737         Reviewed by Michael Catanzaro.
1738
1739         When Settings::allowsAnySSLCertificate() is enabled, connect to accept-certificate signal of the GTlsConnection
1740         to always accept the certificates.
1741
1742         Fixes: http/tests/websocket/tests/hybi/simple-wss.html
1743
1744         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
1745         (WebCore::wssConnectionAcceptCertificateCallback):
1746         (WebCore::wssSocketClientEventCallback):
1747         (WebCore::SocketStreamHandleImpl::create):
1748
1749 2017-02-17  Simon Fraser  <simon.fraser@apple.com>
1750
1751         Fixed elements bounce when rubber-banding at the bottom of the page
1752         https://bugs.webkit.org/show_bug.cgi?id=168493
1753         rdar://problem/30567713
1754
1755         Reviewed by Tim Horton.
1756
1757         FrameView::visibleDocumentRect() was computing a bad visible rect when bottom-rubber-banding,
1758         by adding rubberBandBottom which is negative, rather than subtracting.
1759
1760         Log some more scrolling stuff.
1761
1762         Ironically, the existing test didn't test stick-to-viewport fixed position because
1763         backgroundShouldExtendBeyondPage() is off by default in WTR, so clone it to a test
1764         that sets this, to test both behaviors.
1765
1766         This also revealed that dynamic changes to backgroundShouldExtendBeyondPage() need
1767         to be propagated to the scrolling tree, which is fixed in AsyncScrollingCoordinator::frameViewLayoutUpdated().
1768
1769         Test: fast/visual-viewport/rubberbanding-viewport-rects-extended-background.html
1770
1771         * page/FrameView.cpp:
1772         (WebCore::FrameView::updateLayoutViewport):
1773         (WebCore::FrameView::visibleDocumentRect):
1774         * page/scrolling/AsyncScrollingCoordinator.cpp:
1775         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
1776         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
1777         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
1778         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1779         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
1780         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
1781         (WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit):
1782         (WebCore::ScrollingCoordinatorMac::commitTreeState):
1783
1784 2017-02-17  Simon Fraser  <simon.fraser@apple.com>
1785
1786         REGRESSION (209396): Apple Pay buttons do not render
1787         https://bugs.webkit.org/show_bug.cgi?id=168523
1788         rdar://problem/30451563
1789
1790         Reviewed by Geoffrey Garen.
1791
1792         The new CSS parser mistakenly converted -apple-pay-button values to
1793         -webkit-pay-button, breaking -webkit-appearance: -apple-pay-button.
1794
1795         Fix by excluding "-apple-pay" prefixed values from the conversion.
1796
1797         Test: fast/css/appearance-apple-pay-button.html
1798
1799         * css/parser/CSSPropertyParser.cpp:
1800         (WebCore::isAppleLegacyCssValueKeyword):
1801
1802 2017-02-17  Commit Queue  <commit-queue@webkit.org>
1803
1804         Unreviewed, rolling out r212463.
1805         https://bugs.webkit.org/show_bug.cgi?id=168526
1806
1807         Some crashes with GuardMalloc (Requested by anttik on
1808         #webkit).
1809
1810         Reverted changeset:
1811
1812         "Execute pending scripts asynchronously after stylesheet loads
1813         complete"
1814         https://bugs.webkit.org/show_bug.cgi?id=168367
1815         http://trac.webkit.org/changeset/212463
1816
1817 2017-02-16  Brent Fulgham  <bfulgham@apple.com>
1818
1819         RenderView needs to be updated when FrameView changes
1820         https://bugs.webkit.org/show_bug.cgi?id=168481
1821         <rdar://problem/30339638>
1822
1823         Reviewed by Andreas Kling.
1824
1825         The state of the Document's RenderView can get out of sync with the Frame's FrameView.
1826         We need a notification mechanism so that modifications to the Frame's view are properly
1827         relayed to Document so that it can have a correct RenderView.
1828
1829         * dom/Document.cpp:
1830         (WebCore::Document::didBecomeCurrentDocumentInView): Create an updated render tree (if
1831         one does not already exist).
1832         (WebCore::Document::destroyRenderTree): Remove an incorrect ASSERT. We may enter this
1833         code when the Frame uses 'setView(nullptr)', which happens during certain  updates.
1834         * dom/Document.h:
1835         * page/Frame.cpp:
1836         (WebCore::Frame::setView): Destroy the old render tree (if present) before switching to
1837         the new view. Then notify the document that it is now the current document in the new view.
1838
1839 2017-02-17  Enrique Ocaña González  <eocanha@igalia.com>
1840
1841         [GStreamer] Fast replay on video hide/unhide on platforms with limited video buffer pools
1842         https://bugs.webkit.org/show_bug.cgi?id=168505
1843
1844         Reviewed by Žan Doberšek.
1845
1846         The WebKit code isn't consuming the video samples when the video layer is hidden,
1847         so the buffers aren't being returned to the pool and starve the decoder when the
1848         buffer pool runs out of buffers (on platforms using a buffer pool and a custom
1849         allocator, such as OMX on the Raspberry Pi 2). When the video layer is restored,
1850         the pipeline tries to catch up and the user sees the video "going fast forward".
1851
1852         The added code "consumes" (removes and unrefs) the buffer in that case. However,
1853         the sample isn't completely removed because it still holds important info (eg:
1854         caps) needed for the proper operation of the video element.
1855
1856         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1857         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
1858
1859 2017-02-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1860
1861         [SOUP] Stop removing the fragment identifier from resource requests
1862         https://bugs.webkit.org/show_bug.cgi?id=168509
1863
1864         Reviewed by Sergio Villar Senin.
1865
1866         I don't know why, but have always removed the fragment identifier from the URL when creating the SoupURI that
1867         is passed to libsoup. Maybe it was a bug in a very old version of libsoup, but it doesn't look necessary anymore
1868         and it's causing several layout test failures.
1869
1870         Fixes: http/tests/svg/svg-use-external.html
1871                imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/compile-error-same-origin-with-hash.html
1872                imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/runtime-error-same-origin-with-hash.html
1873
1874         * platform/network/soup/ResourceRequestSoup.cpp:
1875         (WebCore::ResourceRequest::createSoupURI): Do not remove the fragment identifier from the URL.
1876
1877 2017-02-16  Yusuke Suzuki  <utatane.tea@gmail.com>
1878
1879         [JSC] Drop PassRefPtr from ArrayBuffer
1880         https://bugs.webkit.org/show_bug.cgi?id=168455
1881
1882         Reviewed by Geoffrey Garen.
1883
1884         * bindings/js/SerializedScriptValue.cpp:
1885         (WebCore::CloneDeserializer::readArrayBufferView):
1886         * css/FontFace.cpp:
1887         (WebCore::FontFace::create):
1888         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
1889         (WebCore::MediaPlayerPrivateAVFoundation::extractKeyURIKeyIDAndCertificateFromInitData):
1890         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
1891         (WebCore::AVFWrapper::shouldWaitForLoadingOfResource):
1892         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
1893         (WebCore::CDMSessionAVFoundationObjC::generateKeyRequest):
1894         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1895         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
1896
1897 2017-02-16  Simon Fraser  <simon.fraser@apple.com>
1898
1899         REGRESSION(r212439): Web Inspector Toolbar / Window appears broken
1900         https://bugs.webkit.org/show_bug.cgi?id=168494
1901
1902         Reviewed by Joseph Pecoraro.
1903
1904         Missed one conversion from acceleratesDrawing to drawsAsynchronously, which
1905         caused non-Whippet GrpahicsContext shadow drawing to happen unexpectedly.
1906
1907         * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
1908         (-[WebTiledBackingLayer drawsAsynchronously]):
1909         (-[WebTiledBackingLayer acceleratesDrawing]): Deleted.
1910
1911 2017-02-16  Chris Dumez  <cdumez@apple.com>
1912
1913         <input>.labels is empty if type changes from text->hidden->checkbox
1914         https://bugs.webkit.org/show_bug.cgi?id=168358
1915
1916         Reviewed by Ryosuke Niwa.
1917
1918         We were invalidating LabelsNodeLists on 'for' attribute change.
1919         We now also invalidate them of 'type' attribute change since
1920         HTMLInputElements whose type is 'hidden' do not support labels.
1921
1922         No new tests, updated existing test.
1923
1924         * dom/Document.h:
1925         * dom/LiveNodeList.h:
1926         (WebCore::shouldInvalidateTypeOnAttributeChange):
1927         * html/LabelsNodeList.cpp:
1928         (WebCore::LabelsNodeList::LabelsNodeList):
1929
1930 2017-02-16  Michael Catanzaro  <mcatanzaro@igalia.com>
1931
1932         Remove even more EFL from WebCore
1933         https://bugs.webkit.org/show_bug.cgi?id=168485
1934
1935         Reviewed by Alex Christensen.
1936
1937         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1938         (webkitAccessibleGetAttributes):
1939         (atkRole):
1940         * css/StyleRule.cpp:
1941         (WebCore::StyleRuleBase::copy):
1942         * platform/ContextMenuItem.h:
1943         * platform/graphics/OpenGLESShims.h:
1944         * platform/graphics/PlatformDisplay.cpp:
1945         (WebCore::PlatformDisplay::createPlatformDisplay):
1946         * platform/graphics/PlatformDisplay.h:
1947         * platform/graphics/cairo/ImageBufferCairo.cpp:
1948         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
1949         (WebCore::Font::platformInit):
1950         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1951         (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
1952         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
1953         (WebCore::GraphicsLayerTextureMapper::setContentsToImage):
1954         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
1955         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
1956         * platform/network/soup/ResourceErrorSoup.cpp:
1957         (WebCore::ResourceError::timeoutError):
1958         * platform/network/soup/SoupNetworkSession.cpp:
1959         (WebCore::SoupNetworkSession::setProxySettingsFromEnvironment): Deleted.
1960         * platform/network/soup/SoupNetworkSession.h:
1961
1962 2017-02-16  Daniel Bates  <dabates@apple.com>
1963
1964         Remove Chromium-specific code to call FrameLoaderClient::redirectDataToPlugin(nullptr)
1965         https://bugs.webkit.org/show_bug.cgi?id=168417
1966         <rdar://problem/30541748>
1967
1968         Reviewed by Brent Fulgham.
1969
1970         Remove Chromium-specific code that was added in r125500 to call FrameLoaderClient::redirectDataToPlugin(nullptr)
1971         in PluginDocument::detachFromPluginElement(). Calling redirectDataToPlugin() with nullptr was used by the
1972         Chromium port to signify that the plugin document was being destroyed so that they could tear down their
1973         plugin widget. And PluginDocument::detachFromPluginElement() is the only place that calls redirectDataToPlugin()
1974         passing nullptr. No other port made use of this machinery and the Chromium port has long since been removed
1975         from the Open Source WebKit Project. We should remove this code.
1976
1977         * html/PluginDocument.cpp:
1978         (WebCore::PluginDocumentParser::appendBytes): Pass the plugin widget by reference.
1979         (WebCore::PluginDocument::detachFromPluginElement): Remove call to FrameLoaderClient::redirectDataToPlugin().
1980         This call was only used by the Chromium port as means to be notified when the plugin document was being
1981         destroyed. No other port made use of this notification or needed such a notification.
1982         * loader/EmptyClients.cpp: Change argument of redirectDataToPlugin() from Widget* to Widget& to convey
1983         that this function always takes a valid Widget. Also remove unnecessary argument name as the data type
1984         of the argument and the name of the function sufficiently describes the purpose of the argument.
1985         * loader/FrameLoaderClient.h: Ditto.
1986
1987 2017-02-16  Myles C. Maxfield  <mmaxfield@apple.com>
1988
1989         font-weight in @font-face can cause a font to be downloaded even when it's not used
1990         https://bugs.webkit.org/show_bug.cgi?id=168114
1991         <rdar://problem/30301317>
1992
1993         Reviewed by Darin Adler.
1994
1995         There were two problems with our font loading code.
1996
1997         When we are in the middle of a download, we will use a special interstitial font,
1998         and this special font has a flag set which will cause it to be invisible when it is
1999         drawn. However, when we start using this font during the load, we give it a
2000         unicode-range of U+0-0 which means that it will never be used, and fallback will
2001         happen to other weights immediately. 
2002
2003         The second problem with the font loading code is that this interstital font is just
2004         Times. Times doesn't support every character, which means that if we are trying
2005         to render some exotic character, we fall back to other weights. The solution here
2006         is to use LastResort as the interstitial font, because it supports all characters.
2007         Because its metrics are reasonable and we don't ever actually paint this
2008         interstitial font, this choice is no worse than Times.
2009
2010         Tests: fast/text/font-style-download.html
2011                fast/text/font-weight-download-2.html
2012                fast/text/font-weight-download.html
2013                fast/text/font-weight-fallback.html
2014
2015         * css/CSSFontFace.cpp:
2016         (WebCore::CSSFontFace::font):
2017         * css/CSSSegmentedFontFace.cpp:
2018         (WebCore::appendFont):
2019         (WebCore::CSSSegmentedFontFace::fontRanges):
2020         (WebCore::appendFontWithInvalidUnicodeRangeIfLoading): Deleted.
2021         * platform/graphics/Font.h:
2022         (WebCore::Font::widthForGlyph):
2023         * platform/graphics/FontCache.h:
2024         * platform/graphics/freetype/FontCacheFreeType.cpp:
2025         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter):
2026         * platform/graphics/mac/FontCacheMac.mm:
2027         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter):
2028         * platform/graphics/win/FontCacheWin.cpp:
2029         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter):
2030
2031 2017-02-16  Alex Christensen  <achristensen@webkit.org>
2032
2033         Remove EFL-specific files in Source.
2034
2035         Rubber-stamped by Anders Carlsson.
2036
2037         * editing/efl: Removed.
2038         * page/efl: Removed.
2039         * platform/audio/efl: Removed.
2040         * platform/efl: Removed.
2041         * platform/efl/DefaultTheme: Removed.
2042         * platform/efl/DefaultTheme/widget: Removed.
2043         * platform/efl/DefaultTheme/widget/button: Removed.
2044         * platform/efl/DefaultTheme/widget/check: Removed.
2045         * platform/efl/DefaultTheme/widget/combo: Removed.
2046         * platform/efl/DefaultTheme/widget/entry: Removed.
2047         * platform/efl/DefaultTheme/widget/progressbar: Removed.
2048         * platform/efl/DefaultTheme/widget/radio: Removed.
2049         * platform/efl/DefaultTheme/widget/scrollbar: Removed.
2050         * platform/efl/DefaultTheme/widget/search: Removed.
2051         * platform/efl/DefaultTheme/widget/search/cancel: Removed.
2052         * platform/efl/DefaultTheme/widget/search/decoration: Removed.
2053         * platform/efl/DefaultTheme/widget/search/field: Removed.
2054         * platform/efl/DefaultTheme/widget/slider: Removed.
2055         * platform/efl/DefaultTheme/widget/spinner: Removed.
2056         * platform/gamepad/efl: Removed.
2057         * platform/graphics/efl: Removed.
2058         * platform/graphics/surfaces/efl: Removed.
2059         * platform/network/efl: Removed.
2060
2061 2017-02-16  Simon Fraser  <simon.fraser@apple.com>
2062
2063         Add WebUSB to features.json as a "Not Considering".
2064
2065         * features.json:
2066
2067 2017-02-16  Alex Christensen  <achristensen@webkit.org>
2068
2069         Remove old URL parser
2070         https://bugs.webkit.org/show_bug.cgi?id=168483
2071
2072         Reviewed by Tim Horton.
2073
2074         * platform/URL.cpp:
2075         (WebCore::isSchemeFirstChar):
2076         (WebCore::isSchemeChar):
2077         (WebCore::URL::URL):
2078         (WebCore::URL::setProtocol):
2079         (WebCore::URL::setHost):
2080         (WebCore::URL::removePort):
2081         (WebCore::URL::setPort):
2082         (WebCore::URL::setHostAndPort):
2083         (WebCore::URL::setUser):
2084         (WebCore::URL::setPass):
2085         (WebCore::URL::setFragmentIdentifier):
2086         (WebCore::URL::setQuery):
2087         (WebCore::URL::setPath):
2088         (WebCore::URL::serialize):
2089         (WebCore::isUserInfoChar): Deleted.
2090         (WebCore::isHostnameChar): Deleted.
2091         (WebCore::isIPv6Char): Deleted.
2092         (WebCore::isPathSegmentEndChar): Deleted.
2093         (WebCore::appendASCII): Deleted.
2094         (WebCore::findFirstOf): Deleted.
2095         (WebCore::checkEncodedString): Deleted.
2096         (WebCore::URL::init): Deleted.
2097         (WebCore::appendEscapingBadChars): Deleted.
2098         (WebCore::escapeAndAppendNonHierarchicalPart): Deleted.
2099         (WebCore::copyPathRemovingDots): Deleted.
2100         (WebCore::hasSlashDotOrDotDot): Deleted.
2101         (WebCore::URL::parse): Deleted.
2102         (WebCore::cannotBeABaseURL): Deleted.
2103         (WebCore::isDefaultPortForScheme): Deleted.
2104         (WebCore::hostPortIsEmptyButCredentialsArePresent): Deleted.
2105         (WebCore::isNonFileHierarchicalScheme): Deleted.
2106         (WebCore::isCanonicalHostnameLowercaseForScheme): Deleted.
2107         (WebCore::findHostnamesInMailToURL): Deleted.
2108         (WebCore::findHostnameInHierarchicalURL): Deleted.
2109         (WebCore::encodeHostnames): Deleted.
2110         (WebCore::encodeRelativeString): Deleted.
2111         (WebCore::substituteBackslashes): Deleted.
2112         * platform/URLParser.cpp:
2113         (WebCore::URLParser::URLParser):
2114         (WebCore::URLParser::setEnabled): Deleted.
2115         (WebCore::URLParser::enabled): Deleted.
2116         * platform/URLParser.h:
2117         * platform/cf/URLCF.cpp:
2118         (WebCore::URL::URL):
2119         * platform/mac/URLMac.mm:
2120         (WebCore::URL::URL):
2121
2122 2017-02-16  Anders Carlsson  <andersca@apple.com>
2123
2124         Build fixes.
2125
2126         * page/gtk/EventHandlerGtk.cpp:
2127         (WebCore::EventHandler::createDraggingDataTransfer):
2128         * page/win/EventHandlerWin.cpp:
2129         (WebCore::EventHandler::createDraggingDataTransfer):
2130
2131 2017-02-16  Anders Carlsson  <andersca@apple.com>
2132
2133         Remove EFL from WebCore
2134         https://bugs.webkit.org/show_bug.cgi?id=168477
2135
2136         Reviewed by Brian Burg.
2137
2138         * accessibility/AccessibilityList.cpp:
2139         (WebCore::AccessibilityList::childHasPseudoVisibleListItemMarkers):
2140         * accessibility/AccessibilityNodeObject.cpp:
2141         (WebCore::AccessibilityNodeObject::canSetValueAttribute):
2142         * accessibility/AccessibilityObject.cpp:
2143         (WebCore::AccessibilityObject::AccessibilityObject):
2144         (WebCore::AccessibilityObject::textIteratorBehaviorForTextRange):
2145         * accessibility/AccessibilityObject.h:
2146         * accessibility/AccessibilityRenderObject.cpp:
2147         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
2148         * accessibility/AccessibilityTableColumn.cpp:
2149         (WebCore::AccessibilityTableColumn::computeAccessibilityIsIgnored):
2150         * accessibility/AccessibilityTableHeaderContainer.cpp:
2151         (WebCore::AccessibilityTableHeaderContainer::computeAccessibilityIsIgnored):
2152         * crypto/CryptoKey.cpp:
2153         * crypto/keys/CryptoKeyRSA.h:
2154         * dom/Document.cpp:
2155         (WebCore::Document::implicitClose):
2156         * editing/Editor.cpp:
2157         (WebCore::Editor::performCutOrCopy):
2158         (WebCore::Editor::copyImage):
2159         * editing/Editor.h:
2160         * editing/FrameSelection.h:
2161         * html/HTMLCanvasElement.cpp:
2162         (WebCore::requiresAcceleratedCompositingForWebGL):
2163         * inspector/InspectorFrontendHost.cpp:
2164         (WebCore::InspectorFrontendHost::port):
2165         * loader/HistoryController.cpp:
2166         (WebCore::HistoryController::restoreScrollPositionAndViewState):
2167         * loader/icon/IconDatabase.cpp:
2168         (WebCore::IconDatabase::performURLImport):
2169         * page/ContextMenuController.cpp:
2170         (WebCore::ContextMenuController::contextMenuItemSelected):
2171         (WebCore::ContextMenuController::populate):
2172         (WebCore::ContextMenuController::checkOrEnableIfNeeded):
2173         * page/DragController.cpp:
2174         (WebCore::DragController::startDrag):
2175         * page/EventHandler.cpp:
2176         (WebCore::EventHandler::eventInvertsTabsToLinksClientCallResult):
2177         * page/FrameView.cpp:
2178         (WebCore::FrameView::layout):
2179         * platform/ContextMenuItem.h:
2180         * platform/Cursor.h:
2181         * platform/DragData.h:
2182         * platform/DragImage.h:
2183         * platform/FileSystem.h:
2184         * platform/LocalizedStrings.h:
2185         * platform/MIMETypeRegistry.cpp:
2186         (WebCore::initializeSupportedImageMIMETypesForEncoding):
2187         * platform/NotImplemented.h:
2188         * platform/Pasteboard.h:
2189         * platform/PlatformKeyboardEvent.h:
2190         * platform/PlatformMouseEvent.h:
2191         * platform/PlatformSpeechSynthesizer.h:
2192         * platform/PlatformWheelEvent.h:
2193         * platform/Widget.h:
2194         * platform/graphics/ANGLEWebKitBridge.h:
2195         * platform/graphics/BitmapImage.h:
2196         * platform/graphics/GraphicsContext3D.h:
2197         * platform/graphics/Icon.h:
2198         * platform/graphics/Image.h:
2199         (WebCore::Image::getEvasObject): Deleted.
2200         * platform/graphics/IntPoint.h:
2201         * platform/graphics/IntRect.h:
2202         * platform/graphics/opengl/Extensions3DOpenGL.cpp:
2203         (WebCore::Extensions3DOpenGL::createVertexArrayOES):
2204         (WebCore::Extensions3DOpenGL::deleteVertexArrayOES):
2205         (WebCore::Extensions3DOpenGL::isVertexArrayOES):
2206         (WebCore::Extensions3DOpenGL::bindVertexArrayOES):
2207         (WebCore::Extensions3DOpenGL::supportsExtension):
2208         * platform/graphics/opengl/Extensions3DOpenGL.h:
2209         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
2210         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
2211         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2212         (WebCore::GraphicsContext3D::createForCurrentGLContext):
2213         (WebCore::GraphicsContext3D::reshape):
2214         (WebCore::GraphicsContext3D::createVertexArray):
2215         (WebCore::GraphicsContext3D::deleteVertexArray):
2216         (WebCore::GraphicsContext3D::isVertexArray):
2217         (WebCore::GraphicsContext3D::bindVertexArray):
2218         * platform/graphics/opengl/TemporaryOpenGLSetting.cpp:
2219         * platform/network/NetworkStateNotifier.h:
2220         * platform/posix/FileSystemPOSIX.cpp:
2221         * rendering/RenderLayerCompositor.cpp:
2222         (WebCore::RenderLayerCompositor::ensureRootLayer):
2223         * rendering/RenderText.cpp:
2224         (WebCore::RenderText::previousOffsetForBackwardDeletion):
2225         * xml/XSLStyleSheetLibxslt.cpp:
2226         * xml/XSLTExtensions.cpp:
2227         * xml/XSLTProcessorLibxslt.cpp:
2228         * xml/XSLTUnicodeSort.cpp:
2229
2230 2017-02-16  Zalan Bujtas  <zalan@apple.com>
2231
2232         Simple line layout: Add forced line layout info to coverage print.
2233         https://bugs.webkit.org/show_bug.cgi?id=168470
2234
2235         Reviewed by Simon Fraser.
2236
2237         This is about potential vs. actual coverage:
2238
2239         Simple line layout potential coverage: 65.05%
2240         Simple line layout actual coverage: 46.60%
2241         Forced line layout blocks: 4 content length: 57(18.45%)
2242
2243         Not testable.
2244
2245         * rendering/SimpleLineLayout.cpp:
2246         (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage):
2247
2248 2017-02-16  Anders Carlsson  <andersca@apple.com>
2249
2250         Rename DataTransfer functions to indicate whether they are for dragging or dropping
2251         https://bugs.webkit.org/show_bug.cgi?id=168478
2252
2253         Reviewed by Tim Horton.
2254
2255         * dom/DataTransfer.cpp:
2256         (WebCore::DataTransfer::createForDrag):
2257         (WebCore::DataTransfer::createForDrop):
2258         (WebCore::DataTransfer::createForDragAndDrop): Deleted.
2259         * dom/DataTransfer.h:
2260         * page/DragController.cpp:
2261         (WebCore::DragController::dragExited):
2262         (WebCore::DragController::performDragOperation):
2263         (WebCore::DragController::tryDHTMLDrag):
2264         * page/mac/EventHandlerMac.mm:
2265         (WebCore::EventHandler::createDraggingDataTransfer):
2266
2267 2017-02-16  Anders Carlsson  <andersca@apple.com>
2268
2269         Rename EventHandler::freeDataTransfer to invalidateDataTransfer
2270         https://bugs.webkit.org/show_bug.cgi?id=168472
2271
2272         Reviewed by Tim Horton.
2273
2274         The code doesn't necessarily free the data transfer object, so rename the member function
2275         to reflect that. Also, get rid of a goto.
2276
2277         * page/EventHandler.cpp:
2278         (WebCore::EventHandler::invalidateDataTransfer):
2279         (WebCore::EventHandler::dragSourceEndedAt):
2280         (WebCore::EventHandler::handleDrag):
2281         (WebCore::EventHandler::freeDataTransfer): Deleted.
2282         * page/EventHandler.h:
2283
2284 2017-02-16  Alex Christensen  <achristensen@webkit.org>
2285
2286         Special URLs without a host are invalid
2287         https://bugs.webkit.org/show_bug.cgi?id=168461
2288
2289         Reviewed by Tim Horton.
2290
2291         http://? should be invalid.  This matches Chrome and the spec and the intent of my implementation
2292         of URLParser which already fails with urls like http:// and this was just an oversight.
2293         Covered by newly passing web platform tests.  Updated API tests.
2294
2295         * platform/URLParser.cpp:
2296         (WebCore::URLParser::parse):
2297
2298 2017-02-16  Zalan Bujtas  <zalan@apple.com>
2299
2300         Simple line layout: Add support for pagination.
2301         https://bugs.webkit.org/show_bug.cgi?id=168355
2302         <rdar://problem/30119769>
2303
2304         Reviewed by David Hyatt.
2305
2306         This patch adds basic support for paginated content including widows and orphans.
2307
2308         This is based on the normal line layout pagination logic. However there are 2 major
2309         advantages here (and they allow us to have a much simpler logic):
2310         1. all the lines are positioned by the time we start paginating them and
2311         2. lines always have uniform heights. 
2312
2313         This is not enabled yet.
2314
2315         * rendering/RenderBlockFlow.h:
2316         * rendering/SimpleLineLayout.cpp:
2317         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow):
2318         (WebCore::SimpleLineLayout::computeLineBreakIndex):
2319         (WebCore::SimpleLineLayout::setPageBreakForLine):
2320         (WebCore::SimpleLineLayout::computeOffsetAfterLineBreak):
2321         (WebCore::SimpleLineLayout::updateMinimumPageHeight):
2322         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
2323         (WebCore::SimpleLineLayout::create):
2324         (WebCore::SimpleLineLayout::Layout::create):
2325         (WebCore::SimpleLineLayout::Layout::Layout):
2326         * rendering/SimpleLineLayout.h:
2327         (WebCore::SimpleLineLayout::Layout::isPaginated):
2328         (WebCore::SimpleLineLayout::Layout::struts):
2329         * rendering/SimpleLineLayoutFunctions.h:
2330         (WebCore::SimpleLineLayout::computeFlowHeight):
2331         * rendering/SimpleLineLayoutResolver.h:
2332         (WebCore::SimpleLineLayout::RunResolver::Run::computeBaselinePosition):
2333
2334 2017-02-11  Filip Pizlo  <fpizlo@apple.com>
2335
2336         The collector thread should only start when the mutator doesn't have heap access
2337         https://bugs.webkit.org/show_bug.cgi?id=167737
2338
2339         Reviewed by Keith Miller.
2340
2341         Added new tests in JSTests and LayoutTests.
2342         
2343         The WebCore changes involve:
2344         
2345         - Refactoring around new header discipline.
2346         
2347         - Adding crazy GC APIs to window.internals to enable us to test the GC's runloop discipline.
2348
2349         * ForwardingHeaders/heap/GCFinalizationCallback.h: Added.
2350         * ForwardingHeaders/heap/IncrementalSweeper.h: Added.
2351         * ForwardingHeaders/heap/MachineStackMarker.h: Added.
2352         * ForwardingHeaders/heap/RunningScope.h: Added.
2353         * bindings/js/CommonVM.cpp:
2354         * testing/Internals.cpp:
2355         (WebCore::Internals::parserMetaData):
2356         (WebCore::Internals::isReadableStreamDisturbed):
2357         (WebCore::Internals::isGCRunning):
2358         (WebCore::Internals::addGCFinalizationCallback):
2359         (WebCore::Internals::stopSweeping):
2360         (WebCore::Internals::startSweeping):
2361         * testing/Internals.h:
2362         * testing/Internals.idl:
2363
2364 2017-02-16  Jiewen Tan  <jiewen_tan@apple.com>
2365
2366         [WebCrypto] remove toJSValueFromJsonWebKey from custom SubtleCrypto binding codes
2367         https://bugs.webkit.org/show_bug.cgi?id=167026
2368
2369         Reviewed by Chris Dumez.
2370
2371         Covered by existing tests.
2372
2373         * bindings/js/JSSubtleCryptoCustom.cpp:
2374         (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
2375         (WebCore::jsSubtleCryptoFunctionWrapKeyPromise):
2376         (WebCore::toJSValueFromJsonWebKey): Deleted.
2377         * crypto/JsonWebKey.h:
2378         * crypto/JsonWebKey.idl:
2379         * crypto/RsaOtherPrimesInfo.idl:
2380         Change std::optional<String> to String in order to use toJS<IDLDictionary<JsonWebKey>>.
2381         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
2382         (WebCore::CryptoAlgorithmAES_CBC::importKey):
2383         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
2384         (WebCore::CryptoAlgorithmAES_KW::importKey):
2385         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
2386         (WebCore::CryptoAlgorithmHMAC::importKey):
2387         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
2388         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
2389         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2390         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
2391         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
2392         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
2393         * crypto/keys/CryptoKeyAES.cpp:
2394         (WebCore::CryptoKeyAES::importJwk):
2395         Only check if key_ops contains all of the specified usages when key_ops field of jwk is present,
2396         as per the specification: https://www.w3.org/TR/WebCryptoAPI/#aes-cbc-operations
2397         * crypto/keys/CryptoKeyAES.h:
2398         * crypto/keys/CryptoKeyHMAC.cpp:
2399         (WebCore::CryptoKeyHMAC::importJwk):
2400         * crypto/keys/CryptoKeyHMAC.h:
2401         * crypto/keys/CryptoKeyRSA.cpp:
2402         (WebCore::CryptoKeyRSA::importJwk):
2403         Accommodate the change from std::optional<String> to String.
2404         * crypto/mac/CryptoKeyRSAMac.cpp:
2405         (WebCore::CryptoKeyRSA::create):
2406         Add a null check for p.
2407
2408 2017-02-16  Antti Koivisto  <antti@apple.com>
2409
2410         Execute pending scripts asynchronously after stylesheet loads complete
2411         https://bugs.webkit.org/show_bug.cgi?id=168367
2412         rdar://problem/30561379
2413
2414         Reviewed by Andreas Kling.
2415
2416         The current synchronous execution is fragile and creates various problems.
2417
2418         * css/StyleSheetContents.cpp:
2419         (WebCore::StyleSheetContents::checkLoaded):
2420         * dom/ContainerNode.cpp:
2421         (WebCore::ContainerNode::takeAllChildrenFrom):
2422         (WebCore::ContainerNode::notifyChildInserted):
2423         (WebCore::ContainerNode::removeChild):
2424         (WebCore::ContainerNode::parserRemoveChild):
2425         (WebCore::ContainerNode::removeChildren):
2426
2427             Remove various places where we would trigger delayed synchronous execution.
2428
2429         * dom/Document.cpp:
2430         (WebCore::Document::Document):
2431         (WebCore::Document::recalcStyle):
2432
2433             Trigger scroll to anchor at the end of style resolution instead of when style sheet load completes.
2434
2435         (WebCore::Document::didRemoveAllPendingStylesheet):
2436
2437             Call asynchronous script execution function.
2438
2439         * dom/Document.h:
2440         (WebCore::Document::setNeedsNotifyRemoveAllPendingStylesheet): Deleted.
2441         (WebCore::Document::notifyRemovePendingSheetIfNeeded): Deleted.
2442         * dom/ScriptableDocumentParser.cpp:
2443         (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
2444         (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheetsSoon):
2445         (WebCore::ScriptableDocumentParser::scriptsWaitingForStylesheetsExecutionTimerFired):
2446
2447             Add a timer for executing pending scripts.
2448
2449         (WebCore::ScriptableDocumentParser::detach):
2450         * dom/ScriptableDocumentParser.h:
2451         (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheets):
2452         * html/HTMLLinkElement.cpp:
2453         (WebCore::HTMLLinkElement::removedFrom):
2454         (WebCore::HTMLLinkElement::removePendingSheet):
2455         * html/HTMLLinkElement.h:
2456         * html/parser/HTMLDocumentParser.cpp:
2457         (WebCore::HTMLDocumentParser::detach):
2458         * loader/DocumentLoader.cpp:
2459         (WebCore::DocumentLoader::isLoadingInAPISense):
2460
2461             Stay in loading state if we have a pending script. This matches existing behavior.
2462
2463         * style/StyleScope.cpp:
2464         (WebCore::Style::Scope::removePendingSheet):
2465         * style/StyleScope.h:
2466
2467 2017-02-16  Anders Carlsson  <andersca@apple.com>
2468
2469         Set the DHTML drag image in the DHTML type check
2470         https://bugs.webkit.org/show_bug.cgi?id=168451
2471
2472         Reviewed by Wenson Hsieh.
2473
2474         * page/DragController.cpp:
2475         (WebCore::DragController::startDrag):
2476
2477 2017-02-16  Anders Carlsson  <andersca@apple.com>
2478
2479         Begin removing EFL code from WebCore.
2480
2481         Rubber-stamped by Alex Christensen.
2482
2483         * PlatformEfl.cmake: Removed.
2484         * editing/efl/EditorEfl.cpp: Removed.
2485         * page/efl/DragControllerEfl.cpp: Removed.
2486         * page/efl/EventHandlerEfl.cpp: Removed.
2487         * platform/audio/efl/AudioBusEfl.cpp: Removed.
2488         * platform/efl/CursorEfl.cpp: Removed.
2489         * platform/efl/DefaultTheme/CMakeLists.txt: Removed.
2490         * platform/efl/DefaultTheme/default.edc: Removed.
2491         * platform/efl/DefaultTheme/widget/button/button.edc: Removed.
2492         * platform/efl/DefaultTheme/widget/button/img_button_focus.png: Removed.
2493         * platform/efl/DefaultTheme/widget/button/img_button_hover.png: Removed.
2494         * platform/efl/DefaultTheme/widget/button/img_button_normal.png: Removed.
2495         * platform/efl/DefaultTheme/widget/button/img_button_press.png: Removed.
2496         * platform/efl/DefaultTheme/widget/check/check.edc: Removed.
2497         * platform/efl/DefaultTheme/widget/check/img_check_bg_disabled.png: Removed.
2498         * platform/efl/DefaultTheme/widget/check/img_check_bg_enabled.png: Removed.
2499         * platform/efl/DefaultTheme/widget/check/img_check_off.png: Removed.
2500         * platform/efl/DefaultTheme/widget/check/img_check_off_focus.png: Removed.
2501         * platform/efl/DefaultTheme/widget/check/img_check_off_hover.png: Removed.
2502         * platform/efl/DefaultTheme/widget/check/img_check_on.png: Removed.
2503         * platform/efl/DefaultTheme/widget/check/img_check_on_focus.png: Removed.
2504         * platform/efl/DefaultTheme/widget/check/img_check_on_hover.png: Removed.
2505         * platform/efl/DefaultTheme/widget/combo/combo.edc: Removed.
2506         * platform/efl/DefaultTheme/widget/combo/combo_focus.png: Removed.
2507         * platform/efl/DefaultTheme/widget/combo/combo_focus_button.png: Removed.
2508         * platform/efl/DefaultTheme/widget/combo/combo_focus_button_transparent.png: Removed.
2509         * platform/efl/DefaultTheme/widget/combo/combo_focus_transparent.png: Removed.
2510         * platform/efl/DefaultTheme/widget/combo/combo_hover.png: Removed.
2511         * platform/efl/DefaultTheme/widget/combo/combo_hover_button.png: Removed.
2512         * platform/efl/DefaultTheme/widget/combo/combo_hover_button_transparent.png: Removed.
2513         * platform/efl/DefaultTheme/widget/combo/combo_hover_transparent.png: Removed.
2514         * platform/efl/DefaultTheme/widget/combo/combo_normal.png: Removed.
2515         * platform/efl/DefaultTheme/widget/combo/combo_normal_button.png: Removed.
2516         * platform/efl/DefaultTheme/widget/combo/combo_normal_button_transparent.png: Removed.
2517         * platform/efl/DefaultTheme/widget/combo/combo_normal_transparent.png: Removed.
2518         * platform/efl/DefaultTheme/widget/combo/combo_press.png: Removed.
2519         * platform/efl/DefaultTheme/widget/combo/combo_press_button.png: Removed.
2520         * platform/efl/DefaultTheme/widget/combo/combo_press_button_transparent.png: Removed.
2521         * platform/efl/DefaultTheme/widget/combo/combo_press_transparent.png: Removed.
2522         * platform/efl/DefaultTheme/widget/combo/icon.png: Removed.
2523         * platform/efl/DefaultTheme/widget/entry/entry.edc: Removed.
2524         * platform/efl/DefaultTheme/widget/entry/img_focused.png: Removed.
2525         * platform/efl/DefaultTheme/widget/entry/img_hovered.png: Removed.
2526         * platform/efl/DefaultTheme/widget/entry/img_normal.png: Removed.
2527         * platform/efl/DefaultTheme/widget/progressbar/bt_base.png: Removed.
2528         * platform/efl/DefaultTheme/widget/progressbar/progressbar.edc: Removed.
2529         * platform/efl/DefaultTheme/widget/progressbar/shelf_inset.png: Removed.
2530         * platform/efl/DefaultTheme/widget/radio/img_radio_bg_disabled.png: Removed.
2531         * platform/efl/DefaultTheme/widget/radio/img_radio_bg_enabled.png: Removed.
2532         * platform/efl/DefaultTheme/widget/radio/img_radio_off.png: Removed.
2533         * platform/efl/DefaultTheme/widget/radio/img_radio_off_focus.png: Removed.
2534         * platform/efl/DefaultTheme/widget/radio/img_radio_off_hover.png: Removed.
2535         * platform/efl/DefaultTheme/widget/radio/img_radio_on.png: Removed.
2536         * platform/efl/DefaultTheme/widget/radio/img_radio_on_focus.png: Removed.
2537         * platform/efl/DefaultTheme/widget/radio/img_radio_on_hover.png: Removed.
2538         * platform/efl/DefaultTheme/widget/radio/radio.edc: Removed.
2539         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar.edc: Removed.
2540         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_bg_horizontal.png: Removed.
2541         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_bg_vertical.png: Removed.
2542         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_thumb_horizontal.png: Removed.
2543         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_thumb_vertical.png: Removed.
2544         * platform/efl/DefaultTheme/widget/search/cancel/cancel_normal_button.png: Removed.
2545         * platform/efl/DefaultTheme/widget/search/cancel/cancel_normal_button2.png: Removed.
2546         * platform/efl/DefaultTheme/widget/search/cancel/search_cancel.edc: Removed.
2547         * platform/efl/DefaultTheme/widget/search/decoration/decoration_normal_button.png: Removed.
2548         * platform/efl/DefaultTheme/widget/search/decoration/search_decoration.edc: Removed.
2549         * platform/efl/DefaultTheme/widget/search/field/field_focused.png: Removed.
2550         * platform/efl/DefaultTheme/widget/search/field/field_hovered.png: Removed.
2551         * platform/efl/DefaultTheme/widget/search/field/field_normal.png: Removed.
2552         * platform/efl/DefaultTheme/widget/search/field/search_field.edc: Removed.
2553         * platform/efl/DefaultTheme/widget/slider/slider.edc: Removed.
2554         * platform/efl/DefaultTheme/widget/slider/slider_fill_h.png: Removed.
2555         * platform/efl/DefaultTheme/widget/slider/slider_fill_v.png: Removed.
2556         * platform/efl/DefaultTheme/widget/slider/slider_h.png: Removed.
2557         * platform/efl/DefaultTheme/widget/slider/slider_thumb_h.png: Removed.
2558         * platform/efl/DefaultTheme/widget/slider/slider_thumb_press_h.png: Removed.
2559         * platform/efl/DefaultTheme/widget/slider/slider_thumb_press_v.png: Removed.
2560         * platform/efl/DefaultTheme/widget/slider/slider_thumb_v.png: Removed.
2561         * platform/efl/DefaultTheme/widget/slider/slider_v.png: Removed.
2562         * platform/efl/DefaultTheme/widget/spinner/sp_bg.png: Removed.
2563         * platform/efl/DefaultTheme/widget/spinner/sp_down_default.png: Removed.
2564         * platform/efl/DefaultTheme/widget/spinner/sp_down_hover.png: Removed.
2565         * platform/efl/DefaultTheme/widget/spinner/sp_down_pressed.png: Removed.
2566         * platform/efl/DefaultTheme/widget/spinner/sp_up_default.png: Removed.
2567         * platform/efl/DefaultTheme/widget/spinner/sp_up_hover.png: Removed.
2568         * platform/efl/DefaultTheme/widget/spinner/sp_up_pressed.png: Removed.
2569         * platform/efl/DefaultTheme/widget/spinner/spinner.edc: Removed.
2570         * platform/efl/DragDataEfl.cpp: Removed.
2571         * platform/efl/DragImageEfl.cpp: Removed.
2572         * platform/efl/EflInspectorUtilities.cpp: Removed.
2573         * platform/efl/EflInspectorUtilities.h: Removed.
2574         * platform/efl/EflKeyboardUtilities.cpp: Removed.
2575         * platform/efl/EflKeyboardUtilities.h: Removed.
2576         * platform/efl/EflScreenUtilities.cpp: Removed.
2577         * platform/efl/EflScreenUtilities.h: Removed.
2578         * platform/efl/ErrorsEfl.cpp: Removed.
2579         * platform/efl/ErrorsEfl.h: Removed.
2580         * platform/efl/EventLoopEfl.cpp: Removed.
2581         * platform/efl/FileSystemEfl.cpp: Removed.
2582         * platform/efl/LocalizedStringsEfl.cpp: Removed.
2583         * platform/efl/MIMETypeRegistryEfl.cpp: Removed.
2584         * platform/efl/MainThreadSharedTimerEfl.cpp: Removed.
2585         * platform/efl/PasteboardEfl.cpp: Removed.
2586         * platform/efl/PlatformKeyboardEventEfl.cpp: Removed.
2587         * platform/efl/PlatformMouseEventEfl.cpp: Removed.
2588         * platform/efl/PlatformScreenEfl.cpp: Removed.
2589         * platform/efl/PlatformSpeechSynthesisProviderEfl.cpp: Removed.
2590         * platform/efl/PlatformSpeechSynthesisProviderEfl.h: Removed.
2591         * platform/efl/PlatformSpeechSynthesizerEfl.cpp: Removed.
2592         * platform/efl/PlatformWheelEventEfl.cpp: Removed.
2593         * platform/efl/ScrollbarThemeEfl.cpp: Removed.
2594         * platform/efl/ScrollbarThemeEfl.h: Removed.
2595         * platform/efl/SoundEfl.cpp: Removed.
2596         * platform/efl/TemporaryLinkStubs.cpp: Removed.
2597         * platform/efl/UserAgentEfl.cpp: Removed.
2598         * platform/efl/WidgetEfl.cpp: Removed.
2599         * platform/gamepad/efl/GamepadsEfl.cpp: Removed.
2600         * platform/graphics/efl/CairoUtilitiesEfl.cpp: Removed.
2601         * platform/graphics/efl/CairoUtilitiesEfl.h: Removed.
2602         * platform/graphics/efl/EvasGLContext.cpp: Removed.
2603         * platform/graphics/efl/EvasGLContext.h: Removed.
2604         * platform/graphics/efl/EvasGLSurface.cpp: Removed.
2605         * platform/graphics/efl/EvasGLSurface.h: Removed.
2606         * platform/graphics/efl/GraphicsContext3DEfl.cpp: Removed.
2607         * platform/graphics/efl/GraphicsContext3DPrivate.cpp: Removed.
2608         * platform/graphics/efl/GraphicsContext3DPrivate.h: Removed.
2609         * platform/graphics/efl/IconEfl.cpp: Removed.
2610         * platform/graphics/efl/ImageBufferEfl.cpp: Removed.
2611         * platform/graphics/efl/ImageEfl.cpp: Removed.
2612         * platform/graphics/efl/IntPointEfl.cpp: Removed.
2613         * platform/graphics/efl/IntRectEfl.cpp: Removed.
2614         * platform/graphics/surfaces/efl/GraphicsSurfaceCommon.cpp: Removed.
2615         * platform/network/efl/NetworkStateNotifierEfl.cpp: Removed.
2616         * rendering/RenderThemeEfl.cpp: Removed.
2617         * rendering/RenderThemeEfl.h: Removed.
2618
2619 2017-02-16  Joseph Pecoraro  <pecoraro@apple.com>
2620
2621         [Resource Timing] Support Resource Timing in Workers
2622         https://bugs.webkit.org/show_bug.cgi?id=168086
2623         <rdar://problem/30430117>
2624
2625         Reviewed by Alex Christensen.
2626
2627         Worker's load resources through the Document that loaded them. However,
2628         their PerformanceResourceTiming entries should be added to the Performance
2629         object inside the Worker context, not the Document's context.
2630
2631         This change adds an InitiatorContext to ResourceLoadOptions so that loaders
2632         can determine if the load was initiated by the Document or a Worker. This
2633         allows loaders to then know if the ResourceTiming data they collect should
2634         be added to the Document's Performance object or forwarded on to the Worker's.
2635
2636         This adds a new ThreadableLoaderClient method intended only for the purpose
2637         of adding the ResourceTiming information to the Worker's Performance object.
2638         Unlike other ThreadableLoaderClient methods that are bridged and forwarded
2639         on to a client inside the worker (e.g. XMLHttpRequest or FetchLoader) this
2640         method never needs to be handled by clients and can be uniformly handled by
2641         the WorkerThreadableLoader itself.
2642
2643         We also add a new ResourceTiming object that encapsulates all of the data
2644         ultimately needed for a PerformanceResourceTimingEntry object. This allows
2645         for all of the information to be gathered while loading on the Document
2646         before serializing across to the Worker. That includes the Timing-Allow-Origin
2647         check which uses the SecurityOrigin of the Worker.
2648
2649         This also modernizes and addresses issues in the Resource Timing implementation.
2650         Better handling cases like loading from the Cache, Synchronous Loads, and
2651         improving initiatorType information.
2652
2653         Tests: imported/w3c/web-platform-tests/resource-timing/rt-cors.html
2654                imported/w3c/web-platform-tests/resource-timing/rt-cors.worker.html
2655                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-css.html
2656                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-element.html
2657                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-fetch.html
2658                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-media.html
2659                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-other.html
2660                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-script-module.html
2661                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-xmlhttprequest.html
2662                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType.worker.html
2663                imported/w3c/web-platform-tests/resource-timing/rt-performance-extensions.html
2664                imported/w3c/web-platform-tests/resource-timing/rt-performance-extensions.worker.html
2665                imported/w3c/web-platform-tests/resource-timing/rt-resource-errors.html
2666                imported/w3c/web-platform-tests/resource-timing/rt-resource-ignored.html
2667                imported/w3c/web-platform-tests/resource-timing/rt-resources-per-frame.html
2668                imported/w3c/web-platform-tests/resource-timing/rt-resources-per-worker.html
2669                imported/w3c/web-platform-tests/resource-timing/rt-serialization.html
2670                imported/w3c/web-platform-tests/resource-timing/rt-shared-resource-in-frames.html
2671                imported/w3c/web-platform-tests/resource-timing/rt-shared-resource-in-workers.html
2672                performance-api/resource-timing-apis.html
2673
2674         * CMakeLists.txt:
2675         * WebCore.xcodeproj/project.pbxproj:
2676         New files.
2677
2678         * platform/network/NetworkLoadTiming.h:
2679         (WebCore::NetworkLoadTiming::reset): Deleted.
2680         We no longer need to reset.
2681
2682         * loader/ResourceTiming.cpp: Added.
2683         (WebCore::passesTimingAllowCheck):
2684         (WebCore::ResourceTiming::fromCache):
2685         (WebCore::ResourceTiming::fromLoad):
2686         (WebCore::ResourceTiming::fromSynchronousLoad):
2687         (WebCore::ResourceTiming::ResourceTiming):
2688         (WebCore::ResourceTiming::isolatedCopy):
2689         * loader/ResourceTiming.h: Added.
2690         (WebCore::ResourceTiming::url):
2691         (WebCore::ResourceTiming::initiator):
2692         (WebCore::ResourceTiming::loadTiming):
2693         (WebCore::ResourceTiming::networkLoadTiming):
2694         (WebCore::ResourceTiming::allowTimingDetails):
2695         (WebCore::ResourceTiming::overrideInitiatorName):
2696         (WebCore::ResourceTiming::ResourceTiming):
2697         Class that encapsulates all of the data needed for a PerformanceResourceTiming entry.
2698         There are three static constructors indicating the different ways this object can
2699         be constructed and the different data available at the time of construction.
2700
2701         * loader/ResourceLoaderOptions.h:
2702         Add the new InitiatorContext, default to Document.
2703
2704         * loader/ThreadableLoaderClient.h:
2705         (WebCore::ThreadableLoaderClient::didFinishTiming):
2706         New client method only used by WorkerThreadableLoader.
2707
2708         * loader/WorkerThreadableLoader.h:
2709         * loader/WorkerThreadableLoader.cpp:
2710         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
2711         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishTiming):
2712         All loads initiated in a WorkerThreadableLoader get identified as InitiatorContext::Worker.
2713         Add timing information to the Performance object when received. No need to inform clients.
2714
2715         * loader/DocumentThreadableLoader.h:
2716         * loader/DocumentThreadableLoader.cpp:
2717         (WebCore::DocumentThreadableLoader::finishedTimingForWorkerLoad):
2718         (WebCore::DocumentThreadableLoader::loadRequest):
2719         Provide APIs to pass timing data on to a WorkerThreadableLoader.
2720         Create ResourceTiming data for synchronous loads.
2721
2722         * loader/LoadTiming.h:
2723         * loader/LoadTiming.cpp:
2724         (WebCore::LoadTiming::isolatedCopy):
2725         Add isolatedCopy to allow this data to be passed across to a Worker.
2726
2727         * loader/ResourceTimingInformation.h:
2728         * loader/ResourceTimingInformation.cpp:
2729         (WebCore::ResourceTimingInformation::shouldAddResourceTiming):
2730         (WebCore::ResourceTimingInformation::addResourceTiming):
2731         (WebCore::ResourceTimingInformation::storeResourceTimingInitiatorInformation):
2732         Refactor to remove unused / unnecessary bits. Extract out some helpful code.
2733         Changed this to match when Blink decides when to add or ignore entries, however
2734         this may change over time.
2735
2736         * loader/SubresourceLoader.cpp:
2737         (WebCore::SubresourceLoader::didFinishLoading):
2738         (WebCore::SubresourceLoader::notifyDone):
2739         (WebCore::SubresourceLoader::reportResourceTiming):
2740         * loader/SubresourceLoader.h:
2741         * loader/cache/CachedRawResource.cpp:
2742         (WebCore::CachedRawResource::finishedTimingForWorkerLoad):
2743         * loader/cache/CachedRawResource.h:
2744         * loader/cache/CachedRawResourceClient.h:
2745         (WebCore::CachedRawResourceClient::finishedTimingForWorkerLoad):
2746         Plumbing to report timing information to Worker if this resource was loaded for a Worker.
2747
2748         * loader/cache/CachedResource.cpp:
2749         (WebCore::CachedResource::CachedResource):
2750         * loader/cache/CachedResource.h:
2751         (WebCore::CachedResource::initiatorName):
2752         Store the initiator name on the CachedResource like other data added to the original
2753         CachedResourceRequest. This is a bit of a hack but follows an existing pattern, and
2754         cleans up other hacks that worked around this later on.
2755
2756         * loader/cache/CachedResourceLoader.h:
2757         * loader/cache/CachedResourceLoader.cpp:
2758         (WebCore::CachedResourceLoader::requestResource):
2759         (WebCore::CachedResourceLoader::revalidateResource):
2760         (WebCore::CachedResourceLoader::loadResource):
2761         Simply the creation of a ResourceTiming object for cache hits.
2762         Report timing information to Worker if this resource was loaded for a Worker.
2763
2764         (WebCore::CachedResourceLoader::loadDone):
2765         Eliminate this redundant point attempting to add a ResourceTiming entry.
2766
2767         * loader/cache/CachedResourceRequest.cpp:
2768         (WebCore::CachedResourceRequest::initiatorName):
2769         Update to match the spec. The fallback is "other".
2770
2771         * page/Performance.h:
2772         * page/Performance.cpp:
2773         (WebCore::Performance::setResourceTimingBufferSize):
2774         (WebCore::Performance::addResourceTiming):
2775         Update to support PerformanceObservers.
2776         Update to match spec (event should bubble).
2777
2778         * page/PerformanceResourceTiming.h:
2779         * page/PerformanceResourceTiming.cpp:
2780         (WebCore::PerformanceResourceTiming::create):
2781         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
2782         (WebCore::PerformanceResourceTiming::fetchStart):
2783         (WebCore::PerformanceResourceTiming::domainLookupStart):
2784         (WebCore::PerformanceResourceTiming::domainLookupEnd):
2785         (WebCore::PerformanceResourceTiming::connectStart):
2786         (WebCore::PerformanceResourceTiming::connectEnd):
2787         (WebCore::PerformanceResourceTiming::secureConnectionStart):
2788         (WebCore::PerformanceResourceTiming::requestStart):
2789         (WebCore::PerformanceResourceTiming::responseStart):
2790         (WebCore::PerformanceResourceTiming::responseEnd):
2791         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
2792         Construct with a ResourceTiming object containing all the data we need for the entry.
2793         Update to match spec for what is required, should fallback, should be zero, etc.
2794
2795         (WebCore::passesTimingAllowCheck): Deleted.
2796         Extracted this to ResourceTiming creation time in the loading context,
2797         since this can't be determined on the Worker context without also having
2798         all of the header information from each resource response.
2799
2800         * page/PerformanceResourceTiming.idl:
2801         Expose to Workers!
2802
2803 2017-02-16  Yusuke Suzuki  <utatane.tea@gmail.com>
2804
2805         [JSC] Drop PassRefPtr in inspector/
2806         https://bugs.webkit.org/show_bug.cgi?id=168420
2807
2808         Reviewed by Alex Christensen.
2809
2810         Use Ref<Inspector::ScriptArguments> and Ref<ScriptCallStack> as much as possible.
2811         It drops some unnecessary null checks.
2812
2813         * bindings/scripts/CodeGeneratorJS.pm:
2814         (GenerateCallWith):
2815         * bindings/scripts/test/JS/JSTestObj.cpp:
2816         (WebCore::jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStackCaller):
2817         * dom/ScriptExecutionContext.cpp:
2818         (WebCore::ScriptExecutionContext::PendingException::PendingException):
2819         * inspector/InspectorInstrumentation.cpp:
2820         (WebCore::InspectorInstrumentation::consoleCountImpl):
2821         (WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
2822         (WebCore::InspectorInstrumentation::consoleTimeStampImpl):
2823         * inspector/InspectorInstrumentation.h:
2824         (WebCore::InspectorInstrumentation::consoleCount):
2825         (WebCore::InspectorInstrumentation::stopConsoleTiming):
2826         (WebCore::InspectorInstrumentation::consoleTimeStamp):
2827         * inspector/InspectorNetworkAgent.cpp:
2828         (WebCore::InspectorNetworkAgent::buildInitiatorObject):
2829         * inspector/TimelineRecordFactory.cpp:
2830         (WebCore::TimelineRecordFactory::createGenericRecord):
2831         * inspector/WebInjectedScriptManager.cpp:
2832         (WebCore::WebInjectedScriptManager::WebInjectedScriptManager):
2833         * inspector/WebInjectedScriptManager.h:
2834         * page/DOMWindow.cpp:
2835         (WebCore::DOMWindow::postMessageTimerFired):
2836         We dispatch appropriate addMessage function according to whether
2837         `timer.stackTrace()` is nullptr.
2838
2839         * page/PageConsoleClient.cpp:
2840         (WebCore::PageConsoleClient::addMessage):
2841         (WebCore::PageConsoleClient::messageWithTypeAndLevel):
2842         (WebCore::PageConsoleClient::count):
2843         (WebCore::PageConsoleClient::timeEnd):
2844         (WebCore::PageConsoleClient::timeStamp):
2845         * page/PageConsoleClient.h:
2846         * workers/WorkerConsoleClient.cpp:
2847         (WebCore::WorkerConsoleClient::messageWithTypeAndLevel):
2848         (WebCore::WorkerConsoleClient::count):
2849         (WebCore::WorkerConsoleClient::timeEnd):
2850         (WebCore::WorkerConsoleClient::timeStamp):
2851         * workers/WorkerConsoleClient.h:
2852         * workers/WorkerGlobalScope.cpp:
2853         (WebCore::WorkerGlobalScope::addMessage):
2854
2855 2017-02-16  Chris Fleizach  <cfleizach@apple.com>
2856
2857         AX: Make form validation accessible on iOS
2858         https://bugs.webkit.org/show_bug.cgi?id=168400
2859
2860         Reviewed by Chris Dumez.
2861
2862         Hide the popover content of form validation from accessibility (since its not interactable)
2863         and instead announce the message.
2864
2865         * platform/ios/ValidationBubbleIOS.mm:
2866         (WebCore::ValidationBubble::show):
2867
2868 2017-02-16  Simon Fraser  <simon.fraser@apple.com>
2869
2870         Clean up use of some CALayer-related SPI
2871         https://bugs.webkit.org/show_bug.cgi?id=168401
2872
2873         Reviewed by Tim Horton.
2874
2875         Use -setDrawsAsynchronously: rather than the old -setAcceleratesDrawing: SPI.
2876
2877         Remove CATiledLayer-related stuff from QuartzCoreSPI.h, since we don't use it any more.
2878
2879         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2880         (PlatformCALayerCocoa::acceleratesDrawing):
2881         (PlatformCALayerCocoa::setAcceleratesDrawing):
2882         * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
2883         (-[WebTiledBackingLayer setDrawsAsynchronously:]): This override passes the state
2884         onto the TileController.
2885         (-[WebTiledBackingLayer setAcceleratesDrawing:]): Deleted.
2886         * platform/ios/LegacyTileGridTile.mm:
2887         (WebCore::LegacyTileGridTile::LegacyTileGridTile):
2888         * platform/spi/cocoa/QuartzCoreSPI.h:
2889
2890 2017-02-16  Yusuke Suzuki  <utatane.tea@gmail.com>
2891
2892         Web Inspector: allow import() inside the inspector
2893         https://bugs.webkit.org/show_bug.cgi?id=167457
2894
2895         Reviewed by Ryosuke Niwa.
2896
2897         When evaluating `import("...")`, we need the caller's context to resolve
2898         the module specifier correctly. For example, if `import("./cocoa.js")` is
2899         evaluated in the script "drinks/hot.js", this module name is resolved to
2900         "drinks/cocoa.js". If the same import operator is evaluated in the script
2901         "menu/all.js", the module specifier becomes "menu/cocoa.js".
2902
2903         Previously we reject the import operator if the caller does not have such
2904         a context. These context is SourceOrigin and its ScriptFetcher. While they
2905         are offered in the script tag and other code evaluations, the inspector
2906         console does not offer that. These class are offered in the WebCore side
2907         and we should not touch these classes in the JSC's inspector code.
2908
2909         Now we relax the above restriction. If the above caller information is not
2910         offered, we fallback to the default one. In the web page, we use the page's
2911         URL as the caller's source origin. This allows us to evaluate the import
2912         operator in the inspector console.
2913
2914         And as of r167698, the console recognizes `await import("...")` form. We use
2915         this to test this `import()` in the console functionality.
2916
2917         Test: inspector/controller/runtime-controller-import.html
2918
2919         * bindings/js/ScriptModuleLoader.cpp:
2920         (WebCore::ScriptModuleLoader::importModule):
2921
2922 2017-02-16  Miguel Gomez  <magomez@igalia.com>
2923
2924         [GTK] scroll with transparent background not repainted after scrollY >= 32768
2925         https://bugs.webkit.org/show_bug.cgi?id=154283
2926
2927         Reviewed by Carlos Garcia Campos.
2928
2929         Due to a limitation of the pixman backend, which uses 16 bits to hold signed integers, cairo is
2930         not able to draw anything when using transformation matrices with values bigger than 32768. When
2931         drawing patterns into large pages, the matrices values can overflow those 16 bits, so cairo doesn't
2932         draw anything in, which causes the reported transparent backgrounds.
2933
2934         The patch modifies the transformation matrices both from the current context and the pattern we
2935         are painting, to avoid them to hold values that cannot stored in 16 bits.
2936
2937         There's still the possibility that this happens, but it would require using a pattern with a size
2938         bigger than 32768.
2939
2940         Based on a previous patch by Gwang Yoon Hwang  <yoon@igalia.com>.
2941
2942         Test: fast/backgrounds/background-repeat-long-scroll.html
2943
2944         * platform/graphics/cairo/CairoUtilities.cpp:
2945         (WebCore::drawPatternToCairoContext):
2946
2947 2017-02-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2948
2949         [GTK] Images are never read from the clipboard
2950         https://bugs.webkit.org/show_bug.cgi?id=168419
2951
2952         Reviewed by Sergio Villar Senin.
2953
2954         We write images in the clipboard, but we don't read them.
2955
2956         Fixes: editing/pasteboard/paste-image-using-image-data.html
2957
2958         * editing/Editor.cpp:
2959         (WebCore::Editor::createFragmentForImageAndURL): Moved from EditorMac.mm since it's cross-platform code.
2960         * editing/Editor.h:
2961         * editing/gtk/EditorGtk.cpp:
2962         (WebCore::createFragmentFromPasteboardData): Check if there's an image in the selection, and use
2963         Editor::createFragmentForImageAndURL in that case.
2964         * editing/mac/EditorMac.mm:
2965         (WebCore::Editor::createFragmentForImageAndURL): Deleted.
2966         * platform/gtk/PasteboardHelper.cpp:
2967         (WebCore::PasteboardHelper::getClipboardContents): Check also if there's an image in the clipboard.
2968
2969 2017-02-15  Jer Noble  <jer.noble@apple.com>
2970
2971         REGRESSION (r212311): NULL-dereference in HTMLMediaElement::prepareToPlay()
2972         https://bugs.webkit.org/show_bug.cgi?id=168404
2973         <rdar://problem/30547188>
2974
2975         Reviewed by Brian Weinstein.
2976
2977         Prior to r212311, m_player was always guaranteed to be initialized when calling
2978         prepareToPlay(). r212311 began calling prepareToPlay() on a subsequent run-loop iteration
2979         after creating m_player. So now check whether m_player is NULL before calling methods on it.
2980
2981         * html/HTMLMediaElement.cpp:
2982         (WebCore::HTMLMediaElement::prepareToPlay):
2983
2984 2017-02-15  Eric Carlson  <eric.carlson@apple.com>
2985
2986         [MediaStream] delete CaptureDeviceInfo struct
2987         https://bugs.webkit.org/show_bug.cgi?id=168395
2988
2989         The CaptureDeviceInfo struct and CaptureDevice class were almost identical, so
2990         add an "enabled" field to the later, delete the former, and switch all uses of
2991         CaptureDeviceInfo to CaptureDevice.
2992
2993         Do some minor drive-by cleanup of AVCaptureDeviceManager::refreshCaptureDevices
2994         and CaptureDeviceManager::captureDeviceFromDeviceID.
2995         
2996         Reviewed by Sam Weinig.
2997
2998         No new tests, no behavior change.
2999
3000         * Modules/mediastream/MediaDevicesRequest.cpp:
3001         (WebCore::MediaDevicesRequest::start): SourceKind -> DeviceType
3002         * platform/mediastream/CaptureDevice.h:
3003         (WebCore::CaptureDevice::CaptureDevice):
3004         (WebCore::CaptureDevice::type): Renamed from kind.
3005         (WebCore::CaptureDevice::setType):
3006         (WebCore::CaptureDevice::enabled): Added.
3007         (WebCore::CaptureDevice::setEnabled):
3008         (WebCore::CaptureDevice::kind): Deleted.
3009         (WebCore::CaptureDevice::setKind): Deleted.
3010
3011         * platform/mediastream/CaptureDeviceManager.cpp:
3012         (CaptureDeviceManager::getSourcesInfo):
3013         (CaptureDeviceManager::captureDeviceFromDeviceID): Don't call sourceWithUID.
3014         (CaptureDeviceManager::bestSourcesForTypeAndConstraints):
3015         (CaptureDeviceManager::sourceWithUID):
3016         * platform/mediastream/CaptureDeviceManager.h:
3017         (WebCore::CaptureDeviceManager::refreshCaptureDevices):
3018         (WebCore::CaptureDeviceManager::refreshCaptureDeviceList): Deleted.
3019
3020         * platform/mediastream/mac/AVCaptureDeviceManager.h:
3021         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
3022         (WebCore::AVCaptureDeviceManager::captureDevices):
3023         (WebCore::deviceIsAvailable):
3024         (WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
3025         (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
3026         (WebCore::AVCaptureDeviceManager::deviceConnected):
3027         (WebCore::AVCaptureDeviceManager::deviceDisconnected):
3028         (WebCore::AVCaptureDeviceManager::captureDeviceList): Deleted.
3029         (WebCore::shouldConsiderDeviceInDeviceList): Deleted.
3030         (WebCore::AVCaptureDeviceManager::refreshCaptureDeviceList): Deleted.
3031         * platform/mock/MockRealtimeMediaSource.cpp:
3032         (WebCore::MockRealtimeMediaSource::audioDeviceInfo):
3033         (WebCore::MockRealtimeMediaSource::videoDeviceInfo):
3034
3035 2017-02-15  Sam Weinig  <sam@webkit.org>
3036
3037         [WebIDL] Remove custom conversion from FontFace code by using a Variant
3038         https://bugs.webkit.org/show_bug.cgi?id=168384
3039
3040         Reviewed by Alex Christensen.
3041
3042         Match the font face spec and use a union rather than any in the FontFace constructor.
3043
3044         Test: Added additional cases to fast/text/font-face-javascript.html.
3045
3046         * css/FontFace.cpp:
3047         (WebCore::FontFace::create):
3048         * css/FontFace.h:
3049         * css/FontFace.idl:
3050
3051 2017-02-15  Jer Noble  <jer.noble@apple.com>
3052
3053         Disabled Media Sources should render black/silence
3054         https://bugs.webkit.org/show_bug.cgi?id=168281
3055
3056         Reviewed by Eric Carlson.
3057
3058         Test: webrtc/video-disabled-black.html
3059
3060         Pass the enabled flag setting down from the MediaStreamTrackPrivate to its underlying
3061         source, including RealtimeMediaSource and RealtimeOutgoingAudio/VideoSource. When either
3062         enabled is cleared or muted is set, generate empty (black or silent) media, as opposed to
3063         pausing media or (worse) continuing to send generated media.
3064
3065         * platform/mediastream/MediaStreamTrackPrivate.cpp:
3066         (WebCore::MediaStreamTrackPrivate::setEnabled):
3067         (WebCore::MediaStreamTrackPrivate::sourceEnabledChanged):
3068         * platform/mediastream/MediaStreamTrackPrivate.h:
3069         * platform/mediastream/RealtimeMediaSource.cpp:
3070         (WebCore::RealtimeMediaSource::setEnabled):
3071         * platform/mediastream/RealtimeMediaSource.h:
3072         (WebCore::RealtimeMediaSource::enabled):
3073         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
3074         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
3075         (WebCore::MockRealtimeAudioSourceMac::render):
3076         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
3077         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
3078         (WebCore::RealtimeOutgoingAudioSource::sourceEnabledChanged):
3079         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
3080         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
3081         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
3082         (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
3083         (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
3084         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
3085         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
3086         * platform/mock/MockRealtimeVideoSource.cpp:
3087         (WebCore::MockRealtimeVideoSource::generateFrame):
3088
3089 2017-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>
3090
3091         Editing history scripts should not add the contenteditable attribute or override key events
3092         https://bugs.webkit.org/show_bug.cgi?id=168389
3093         <rdar://problem/30529945>
3094
3095         Reviewed by Dan Bernstein.
3096
3097         Clients that hook into editing history tracking should handle setting the contenteditable attribute on the body
3098         rather than have the script add it to the body. Additionally, this script should NOT be overriding any keydown
3099         events. These were initially added for compatibility with a test harness early on, and should have been removed
3100         earlier.
3101
3102         * Scripts/DumpEditingHistory.js:
3103
3104 2017-02-15  Jer Noble  <jer.noble@apple.com>
3105
3106         Pass "RequiresCustomURLLoading" in AVURLAsset options dictionary
3107         https://bugs.webkit.org/show_bug.cgi?id=168381
3108
3109         Reviewed by Eric Carlson.
3110
3111         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3112         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
3113
3114 2017-02-15  Anders Carlsson  <andersca@apple.com>
3115
3116         Fix build.
3117
3118         * page/DragController.cpp:
3119         (WebCore::DragController::doSystemDrag):
3120
3121 2017-02-15  Anders Carlsson  <andersca@apple.com>
3122
3123         Modernize DragClient::startDrag somewhat
3124         https://bugs.webkit.org/show_bug.cgi?id=168379
3125
3126         Reviewed by Tim Horton.
3127
3128         Change DragClient::startDrag to take a DragImage instead of a DragImageRef, and to pass along the source action
3129         instead of whether it's a link or not.
3130
3131         * loader/EmptyClients.cpp:
3132         * page/DragClient.h:
3133         * page/DragController.cpp:
3134         (WebCore::DragController::startDrag):
3135         (WebCore::DragController::doImageDrag):
3136         (WebCore::DragController::doSystemDrag):
3137         * page/DragController.h:
3138
3139 2017-02-15  Chris Dumez  <cdumez@apple.com>
3140
3141         Expose Symbol.toPrimitive / valueOf on Location instances
3142         https://bugs.webkit.org/show_bug.cgi?id=168295
3143
3144         Reviewed by Geoffrey Garen, Keith Miller and Mark Lam.
3145
3146         Expose Symbol.toPrimitive / valueOf on Location instances as per:
3147         - https://html.spec.whatwg.org/#the-location-interface
3148
3149         Firefox and Chrome already comply with the specification.
3150
3151         Tests: fast/dom/location-valueOf-after-object-prototype-update.html
3152                fast/dom/location-valueOf-after-object-prototype-update2.html
3153                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html
3154                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html
3155
3156         * bindings/scripts/CodeGeneratorJS.pm:
3157         (GenerateImplementation):
3158
3159 2017-02-15  Aakash Jain  <aakash_jain@apple.com>
3160
3161         Remove WebIOSEvent interface
3162         https://bugs.webkit.org/show_bug.cgi?id=168368
3163
3164         Reviewed by Tim Horton.
3165
3166         * platform/ios/WebEvent.h: Removed WebIOSEvent.
3167
3168 2017-02-15  Chris Dumez  <cdumez@apple.com>
3169
3170         [iOS] Form Validation Bubble should be sensitive to Dynamic Type
3171         https://bugs.webkit.org/show_bug.cgi?id=168291
3172         <rdar://problem/30508593>
3173
3174         Reviewed by Tim Horton.
3175
3176         Update ValidationBubble implementation on iOS to stop obeying the
3177         minimum font size setting, given that this setting is not exposed
3178         on iOS. Instead, we now rely on
3179         [UIFont preferredFontForTextStyle:UIFontTextStyleCallout], which
3180         will give us a font whose size obeys Dynamic Type [1] setting on iOS.
3181
3182         [1] https://developer.apple.com/ios/human-interface-guidelines/visual-design/typography/
3183
3184         No new tests, no easily testable.
3185
3186         * platform/ios/ValidationBubbleIOS.mm:
3187         (WebCore::ValidationBubble::ValidationBubble):
3188
3189 2017-02-15  Yusuke Suzuki  <utatane.tea@gmail.com>
3190
3191         [JSC] Drop PassRefPtr
3192         https://bugs.webkit.org/show_bug.cgi?id=168320
3193
3194         Reviewed by Saam Barati.
3195
3196         * bindings/js/ScriptSourceCode.h:
3197         (WebCore::ScriptSourceCode::ScriptSourceCode):
3198         Use Ref and pass it to SourceCode.
3199
3200         * replay/ReplayController.cpp:
3201         (WebCore::ReplayController::frameNavigated):
3202         Pass reference.
3203
3204 2017-02-15  Xabier Rodriguez Calvar  <calvaris@igalia.com>
3205
3206         [GStreamer][MSE][EME] Handle protection event also at decryptor level
3207         https://bugs.webkit.org/show_bug.cgi?id=168316
3208
3209         Reviewed by Žan Doberšek.
3210
3211         So far in MSE pipeline we were handling the encryption events
3212         only when they arrived at the demuxer but this won't work in any
3213         kind of key renegotiation as the event will never arrive. Now we
3214         connect to the element messages, check for the drm id and send it
3215         to the private player for processing.
3216
3217         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3218         (WebCore::appendPipelineElementMessageCallback):
3219         (WebCore::AppendPipeline::AppendPipeline):
3220         (WebCore::AppendPipeline::handleElementMessage):
3221         * platform/graphics/gstreamer/mse/AppendPipeline.h:
3222
3223 2017-02-15  Zan Dobersek  <zdobersek@igalia.com>
3224
3225         [EME] MediaKeys::setServerCertificate() must resolve with 'false' when certificates aren't supported
3226         https://bugs.webkit.org/show_bug.cgi?id=168362
3227
3228         Reviewed by Xabier Rodriguez-Calvar.
3229
3230         In MediaKeys::setServerCertificate(), when the CDM implementation
3231         doesn't support server certificates, it should resolve the promise
3232         with the 'false' value, as mandated by the specification, and not
3233         reject it.
3234
3235         A test case in mock-MediaKeys-setServerCertificate.html is updated.
3236
3237         * Modules/encryptedmedia/MediaKeys.cpp:
3238         (WebCore::MediaKeys::setServerCertificate):
3239
3240 2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
3241
3242         REGRESSION (r206014): HTTPHeaderMap does not consistently use comma without space to separate values of header fields
3243         https://bugs.webkit.org/show_bug.cgi?id=168115
3244
3245         Reviewed by Darin Adler.
3246
3247         In r206014 HTTPHeaderMap::add() was updated to combine common headers with ',' instead of ", " to match the
3248         fetch specification, but the uncommon headers are still combined with ", ".
3249
3250         * platform/network/HTTPHeaderMap.cpp:
3251         (WebCore::HTTPHeaderMap::add):
3252
3253 2017-02-14  Ryosuke Niwa  <rniwa@webkit.org>
3254
3255         An assertion failure inside removeChildren
3256         https://bugs.webkit.org/show_bug.cgi?id=168069
3257
3258         Reviewed by Brent Fulgham.
3259
3260         The bug was caused by notifyRemovePendingSheet executing scripts synchronously where it shouldn't.
3261
3262         Removed the call to notifyRemovePendingSheetIfNeeded in notifyChildNodeRemoved. Instead, invoke it
3263         in its call sites when they're safe.
3264
3265         Test: http/tests/security/move-iframe-within-focus-handler-inside-removal.html
3266
3267         * dom/ContainerNode.cpp:
3268         (WebCore::ContainerNode::takeAllChildrenFrom):
3269         (WebCore::ContainerNode::notifyChildInserted):
3270         (WebCore::ContainerNode::removeChild):
3271         (WebCore::ContainerNode::parserRemoveChild):
3272         (WebCore::ContainerNode::replaceAllChildren):
3273         (WebCore::ContainerNode::removeChildren):
3274         * dom/ContainerNodeAlgorithms.cpp:
3275         (WebCore::notifyChildNodeRemoved):
3276
3277 2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
3278
3279         [GStreamer] Several tests are timing out after r212349
3280         https://bugs.webkit.org/show_bug.cgi?id=168359
3281
3282         Reviewed by Žan Doberšek.
3283
3284         This is because they are failing the cross origin check. Those tests are not using WebKitWebSrc, but
3285         GstFileSrc. I didn't consider the case of source not being a WebKitWebSrc.
3286
3287         Fixes several timeout instroduced in r212349.
3288
3289         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3290         (WebCore::MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin): Split the source check in two. First check if
3291         it's nullptr, and return false. Then check if it's a WebKitWebSrc and return true if it isn't.
3292
3293 2017-02-14  Brent Fulgham  <bfulgham@apple.com>
3294
3295         Revalidate URL after events that could trigger navigations
3296         https://bugs.webkit.org/show_bug.cgi?id=168071
3297         <rdar://problem/30450379>
3298
3299         Reviewed by Ryosuke Niwa.
3300
3301         When arbitary javascript runs during a load, we should revalidate
3302         the URLs involved to make sure they are still valid.
3303
3304         Tests: http/tests/plugins/navigation-during-load-embed.html
3305                http/tests/plugins/navigation-during-load.html
3306
3307         * html/HTMLEmbedElement.cpp:
3308         (WebCore::HTMLEmbedElement::updateWidget): Confirm we are still allowed to
3309         load the URL after executing JS callbacks.
3310         * html/HTMLFrameElementBase.cpp:
3311         (WebCore::HTMLFrameElementBase::isURLAllowed): Split existing function into
3312         existing protected method, and a new public method that checks a passed URL
3313         for validity.
3314         * html/HTMLFrameElementBase.h:
3315         * html/HTMLFrameOwnerElement.h:
3316         (WebCore::HTMLFrameOwnerElement::isURLAllowed):
3317         * html/HTMLObjectElement.cpp:
3318         (WebCore::HTMLObjectElement::updateWidget): Confirm we are still allowed to
3319         load the URL after executing JS callbacks.
3320         * loader/SubframeLoader.cpp:
3321         (WebCore::SubframeLoader::requestFrame): Ditto.
3322
3323 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
3324
3325         [GStreamer] Implement MediaPlayerPrivate::hasSingleSecurityOrigin()
3326         https://bugs.webkit.org/show_bug.cgi?id=168322
3327
3328         Reviewed by Žan Doberšek.
3329
3330         It currently returns true unconditionally. Add resolved-location property to WebKitWebSourceGStreamer to track
3331         the resolved url returned by the server and use that from MediaPlayerPrivate to check if there was a cross
3332         origin redirection.
3333
3334         Fixes: http/tests/security/canvas-remote-read-remote-video-redirect.html
3335
3336         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3337         (WebCore::MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin):
3338         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
3339         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3340         (webKitWebSrcFinalize):
3341         (webKitWebSrcGetProperty):
3342         (webKitWebSrcStart):
3343         (webKitWebSrcQueryWithParent):
3344         (webKitWebSrcGetUri):
3345         (webKitWebSrcSetUri):
3346         (StreamingClient::handleResponseReceived):
3347         (ResourceHandleStreamingClient::wasBlocked):
3348         (ResourceHandleStreamingClient::cannotShowURL):
3349
3350 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
3351
3352         Unreviewed, rolling out r211967.
3353
3354         Caused rendering issues in HiDPI
3355
3356         Reverted changeset:
3357
3358         "[GTK] scroll with transparent background not repainted after
3359         scrollY >= 32768"
3360         https://bugs.webkit.org/show_bug.cgi?id=154283
3361         http://trac.webkit.org/changeset/211967
3362
3363 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
3364
3365         [GTK] Update cookie manager API to properly work with ephemeral sessions
3366         https://bugs.webkit.org/show_bug.cgi?id=168230
3367
3368         Reviewed by Michael Catanzaro.
3369
3370         Add implementation for deleteAllCookiesModifiedSince. Note that this only works when the timespan is 0, we need
3371         new libsoup API to support removing recently modified cookies.
3372
3373         * platform/network/soup/CookieJarSoup.cpp:
3374         (WebCore::deleteAllCookiesModifiedSince):
3375
3376 2017-02-14  Joseph Pecoraro  <pecoraro@apple.com>
3377
3378         [WebIDL] Improve serializer = { inherit }
3379         https://bugs.webkit.org/show_bug.cgi?id=168293
3380
3381         Reviewed by Youenn Fablet.
3382
3383         * bindings/scripts/CodeGeneratorJS.pm:
3384         (GenerateHeader):
3385         Expose a serialize() method on the interface.
3386
3387         (GenerateSerializerFunction):
3388         (GenerateSerializerAttributesForInterface): Deleted.
3389         Subclasses that have `serializer = { inherit }` can use
3390         their parent's serialize() method to get the initial object.
3391         We can now collapse everything back into a single function
3392         because we only generate code for our own attributes.
3393
3394         * bindings/scripts/test/JS/JSTestNode.cpp:
3395         (WebCore::JSTestNode::serialize):
3396         (WebCore::jsTestNodePrototypeFunctionToJSONCaller):
3397         * bindings/scripts/test/JS/JSTestNode.h:
3398         * bindings/scripts/test/JS/JSTestObj.cpp:
3399         (WebCore::JSTestObj::serialize):
3400         (WebCore::jsTestObjPrototypeFunctionToJSONCaller):
3401         * bindings/scripts/test/JS/JSTestObj.h:
3402         * bindings/scripts/test/JS/JSTestSerialization.cpp:
3403         (WebCore::JSTestSerialization::serialize):
3404         (WebCore::jsTestSerializationPrototypeFunctionToJSONCaller):
3405         * bindings/scripts/test/JS/JSTestSerialization.h:
3406         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
3407         (WebCore::JSTestSerializationInherit::serialize):
3408         (WebCore::jsTestSerializationInheritPrototypeFunctionToJSONCaller):
3409         * bindings/scripts/test/JS/JSTestSerializationInherit.h:
3410         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
3411         (WebCore::JSTestSerializationInheritFinal::serialize):
3412         (WebCore::jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller):
3413         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
3414         Updated results.
3415
3416 2017-02-14  Aakash Jain  <aakash_jain@apple.com>
3417
3418         Move methods from WebCoreThread.h to WebCoreThreadInternal.h
3419         https://bugs.webkit.org/show_bug.cgi?id=168326
3420
3421         Reviewed by Alexey Proskuryakov.
3422
3423         * platform/ios/wak/WebCoreThread.h: Move methods WebThreadRunLoop and WebThreadCurrentContext to WebCoreThreadInternal.h
3424         * platform/ios/wak/WebCoreThreadInternal.h: Ditto.
3425         * platform/ios/wak/WebCoreThreadRun.cpp: Removed WebCoreThread.h as it is already included by WebCoreThreadInternal.h
3426         * platform/ios/wak/WKGraphics.mm: Included WebCoreThreadInternal.h, it subsequently includes WebCoreThread.h
3427         * inspector/InspectorTimelineAgent.cpp: Ditto.
3428         * page/mac/PageMac.mm: Ditto.
3429         * platform/cf/MainThreadSharedTimerCF.cpp: Ditto.
3430         * platform/cocoa/MemoryPressureHandlerCocoa.mm: Ditto.
3431         * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp: Ditto.
3432         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: Ditto.
3433         * bindings/js/CommonVM.cpp: included WebCoreThreadInternal.h
3434
3435 2017-02-14  Wenson Hsieh  <wenson_hsieh@apple.com>
3436
3437         [WK2] Support data interaction on links
3438         https://bugs.webkit.org/show_bug.cgi?id=168331
3439         <rdar://problem/30200837>
3440
3441         Reviewed by Tim Horton.
3442
3443         Adds support for data interaction on links at the WebCore layer, refactoring some drag-and-drop code on the Mac
3444         along the way. Also adds two new TestWebKitAPI unit tests in DataInteractionTests.mm: LinkToInput and
3445         BackgroundImageLinkToInput (see Tools/ChangeLog for more information).
3446
3447         * page/DragController.cpp:
3448         (WebCore::DragController::startDrag):
3449         (WebCore::DragController::doImageDrag):
3450         (WebCore::DragController::doSystemDrag):
3451
3452         Introduce platformAdjustDragImageForDeviceScaleFactor, and special-case drag images for links to anchor at the
3453         bottom center.
3454
3455         * platform/DragImage.cpp:
3456         (WebCore::platformAdjustDragImageForDeviceScaleFactor):
3457
3458         Scale the drag image up by the device scale factor. In WebDragClient, we scale the image back down to the
3459         original size. It seems the reason we do this extra dance is because the image sizing heuristic in between
3460         assumes that the image dimensions are for a non-retina device, but this work should really not be necessary if
3461         we tweak the heuristic to account for deviceScaleFactor. We should address this in a separate patch.
3462
3463         * platform/DragImage.h:
3464         * platform/graphics/Path.h:
3465
3466 2017-02-14  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>
3467
3468         [CURL] ResourceError created with error information should have default type Type::General
3469         https://bugs.webkit.org/show_bug.cgi?id=168345
3470
3471         Reviewed by Alex Christensen.
3472
3473         ResourceError has separate implementaion for each platform
3474         so that the interface should be same.
3475         On CURL port, the constructor with error information has
3476         different default value on `type` parameter. It is Type::Null but other implementaitons have Type::General.
3477         This causes some ResourceError is created inconsistent. 
3478
3479         * platform/network/curl/ResourceError.h:
3480         (WebCore::ResourceError::ResourceError):
3481
3482 2017-02-14  Youenn Fablet  <youennf@gmail.com>
3483
3484         [WebRTC] Add support for libwebrtc negotiation needed event
3485         https://bugs.webkit.org/show_bug.cgi?id=168267
3486
3487         Reviewed by Eric Carlson.
3488
3489         Test: webrtc/negotiatedneeded-event-addStream.html
3490
3491         Moving generic code (markAsNeedingNegotiation) from MediaEndpointPeerConnection to PeerConnectionBackend.
3492         This code handles the control of sending or not the negotiationneeded event.
3493
3494         Updating mock to use markAsNeedingNegotiation when streams are changed.
3495         Updating libwebrtc backend to call markAsNeedingNegotiation when required by libwebrtc implementation.
3496
3497         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3498         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
3499         * Modules/mediastream/MediaEndpointPeerConnection.h:
3500         * Modules/mediastream/PeerConnectionBackend.cpp:
3501         (WebCore::PeerConnectionBackend::markAsNeedingNegotiation):
3502         * Modules/mediastream/PeerConnectionBackend.h:
3503         (WebCore::PeerConnectionBackend::isNegotiationNeeded):
3504         (WebCore::PeerConnectionBackend::clearNegotiationNeededState):
3505         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3506         (WebCore::LibWebRTCMediaEndpoint::OnRenegotiationNeeded):
3507         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3508         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
3509         * testing/MockLibWebRTCPeerConnection.cpp:
3510         (WebCore::MockLibWebRTCPeerConnection::AddStream):
3511         (WebCore::MockLibWebRTCPeerConnection::RemoveStream):
3512
3513 2017-02-14  Brady Eidson  <beidson@apple.com>
3514
3515         Unreviewed followup to r212330 to fix Debug builds
3516
3517         * loader/DocumentThreadableLoader.cpp:
3518         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Add call to relaxAdoptionRequirement().
3519
3520 2017-02-14  Matt Rajca  <mrajca@apple.com>
3521
3522         Website policies: iframes should respect the autoplay policy of the top-level document
3523         https://bugs.webkit.org/show_bug.cgi?id=168333
3524
3525         Reviewed by Alex Christensen.
3526
3527         API tests were added.
3528
3529         * html/HTMLMediaElement.cpp:
3530         (WebCore::HTMLMediaElement::HTMLMediaElement):
3531
3532 2017-02-14  Dean Jackson  <dino@apple.com>
3533
3534         Rename preferLowPowerWebGLRendering setting to forceWebGLUsesLowPower
3535         https://bugs.webkit.org/show_bug.cgi?id=168339
3536         <rdar://problem/30522092>
3537
3538         Reviewed by Simon Fraser.
3539
3540         Use a setting name that more clearly reflects what it is doing. It's not
3541         preferring to use the low-power GPU, it's forcing it.
3542
3543         * html/canvas/WebGLRenderingContextBase.cpp:
3544         (WebCore::WebGLRenderingContextBase::create):
3545         * page/Settings.in:
3546
3547 2017-02-14  Brady Eidson  <beidson@apple.com>
3548
3549         Speculative fix for: Crash in DocumentThreadableLoader::redirectReceived.
3550         <rdar://problem/29899473> and https://bugs.webkit.org/show_bug.cgi?id=168337
3551
3552         Reviewed by Geoffrey Garen.
3553
3554         No new tests (Unable to find a reproduction).
3555
3556         * loader/DocumentThreadableLoader.cpp:
3557         (WebCore::DocumentThreadableLoader::loadRequest):
3558
3559 2017-02-14  Youenn Fablet  <youenn@apple.com>
3560
3561         [WebRTC] Remove obsolete WebRTC stats API
3562         https://bugs.webkit.org/show_bug.cgi?id=167910
3563
3564         Reviewed by Alex Christensen.
3565
3566         No change of behavior as removed constructs are not functional.
3567         Removing RTCStatsResponse which no longer exists and made RTCStatsReport an empty container for now.
3568
3569         * CMakeLists.txt:
3570         * DerivedSources.cpp:
3571         * DerivedSources.make:
3572         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3573         (WebCore::MediaEndpointPeerConnection::getStats):
3574         * Modules/mediastream/MediaEndpointPeerConnection.h:
3575         * Modules/mediastream/PeerConnectionBackend.h:
3576         * Modules/mediastream/RTCPeerConnection.cpp:
3577         (WebCore::RTCPeerConnection::getStats):
3578         * Modules/mediastream/RTCStatsReport.cpp:
3579         (WebCore::RTCStatsReport::create): Deleted.
3580         (WebCore::RTCStatsReport::RTCStatsReport): Deleted.
3581         (WebCore::RTCStatsReport::names): Deleted.
3582         (WebCore::RTCStatsReport::local): Deleted.
3583         (WebCore::RTCStatsReport::remote): Deleted.
3584         (WebCore::RTCStatsReport::addStatistic): Deleted.
3585         * Modules/mediastream/RTCStatsReport.h:
3586         (WebCore::RTCStatsReport::create):
3587         (WebCore::RTCStatsReport::timestamp): Deleted.
3588         (WebCore::RTCStatsReport::id): Deleted.
3589         (WebCore::RTCStatsReport::type): Deleted.
3590         (WebCore::RTCStatsReport::stat): Deleted.
3591         * Modules/mediastream/RTCStatsReport.idl:
3592         * Modules/mediastream/RTCStatsResponse.cpp: Removed.
3593         * Modules/mediastream/RTCStatsResponse.h: Removed.
3594         * Modules/mediastream/RTCStatsResponse.idl: Removed.
3595         * WebCore.xcodeproj/project.pbxproj:
3596         * platform/mediastream/MediaEndpoint.h:
3597         (WebCore::MediaEndpoint::getStats):
3598         * platform/mediastream/RTCStatsRequest.h: Removed.
3599         * platform/mediastream/RTCStatsResponseBase.h: Removed.
3600
3601 2017-02-14  Karim H  <karim@karhm.com>
3602
3603         Removed unused methods of WebCore::FileStream
3604         https://bugs.webkit.org/show_bug.cgi?id=168025
3605
3606         Reviewed by Michael Catanzaro.
3607
3608         * fileapi/AsyncFileStream.cpp:
3609         (WebCore::AsyncFileStream::openForWrite): Deleted.
3610         (WebCore::AsyncFileStream::write): Deleted.
3611         (WebCore::AsyncFileStream::truncate): Deleted.
3612         * fileapi/AsyncFileStream.h:
3613         * platform/FileStream.cpp:
3614         (WebCore::FileStream::openForWrite): Deleted.
3615         (WebCore::FileStream::write): Deleted.
3616         (WebCore::FileStream::truncate): Deleted.
3617         * platform/FileStream.h:
3618
3619 2017-02-14  Chris Dumez  <cdumez@apple.com>
3620
3621         HTML Form Validation bubble should take minimum font size setting into consideration
3622         https://bugs.webkit.org/show_bug.cgi?id=168271
3623         <rdar://problem/29869869>
3624
3625         Reviewed by Simon Fraser.
3626
3627         HTML Form Validation bubble should take minimum font size setting into consideration
3628         for better accessibility.
3629
3630         Test: fast/forms/validation-message-minimum-font-size.html
3631
3632         * platform/ValidationBubble.h:
3633         (WebCore::ValidationBubble::create):
3634         (WebCore::ValidationBubble::fontSize):
3635         * platform/ios/ValidationBubbleIOS.mm:
3636         (WebCore::ValidationBubble::ValidationBubble):
3637         * platform/mac/ValidationBubbleMac.mm:
3638         (WebCore::ValidationBubble::ValidationBubble):
3639         Update the ValidationBubble constructor to take in Settings. For now, there is a
3640         single setting that is the minimum font size and that is taken into account when
3641         setting the font size of the validation bubble text.
3642
3643 2017-02-14  Eric Carlson  <eric.carlson@apple.com>
3644
3645         [MediaStream] add navigator.getUserMedia for compatibility with legacy content
3646         https://bugs.webkit.org/show_bug.cgi?id=168324
3647         <rdar://problem/30513125>
3648
3649         Reviewed by Youenn Fablet.
3650
3651         Tests: fast/mediastream/argument-types.html
3652                fast/mediastream/getusermedia.html
3653                fast/mediastream/webkitGetUserMedia-shadowing-then.html
3654
3655         * CMakeLists.txt:
3656         * DerivedSources.cpp:
3657         * DerivedSources.make:
3658         * Modules/mediastream/MediaDevices.idl:
3659         * Modules/mediastream/NavigatorUserMedia.idl: Added.
3660         * Modules/mediastream/NavigatorUserMedia.js: Added.
3661         * WebCore.xcodeproj/project.pbxproj:
3662         * bindings/js/WebCoreBuiltinNames.h:
3663         * page/Navigator.idl:
3664
3665 2017-02-14  Chris Dumez  <cdumez@apple.com>
3666
3667         Fallback to legacy type only when event is trusted
3668         https://bugs.webkit.org/show_bug.cgi?id=168301
3669
3670         Reviewed by Ryosuke Niwa.
3671
3672         Fallback to legacy type only when event is trusted as per a recent
3673         DOM specification change:
3674         - https://github.com/whatwg/dom/issues/404
3675         - https://github.com/whatwg/dom/pull/406
3676
3677         No new tests, rebaselined existing test.
3678
3679         * dom/EventTarget.cpp:
3680         (WebCore::legacyType):
3681         (WebCore::EventTarget::fireEventListeners):
3682
3683 2017-02-13  Dean Jackson  <dino@apple.com>
3684
3685         Rename preferLowPowerToHighPerformance to powerPreference
3686         https://bugs.webkit.org/show_bug.cgi?id=168269
3687         <rdar://problem/30504444>
3688
3689         Reviewed by Chris Dumez.
3690
3691         Based on the discussion in https://github.com/KhronosGroup/WebGL/pull/2283.
3692
3693         Change WebGLContextAttributes's preferLowPowerToHighPerformance boolean
3694         into a powerPreference enum taking three values. The implementation
3695         of the enum is in GraphicsContext3DAttributes.
3696
3697         While the name and values have changed, there should be no change in
3698         behaviour caused by this patch.
3699
3700         * html/canvas/WebGLContextAttributes.h: Use GraphicsContext3DAttributes
3701         enum GraphicsContext3DPowerPreference.
3702         * html/canvas/WebGLContextAttributes.idl: Rename and add the WebIDL enum.
3703         * html/canvas/WebGLRenderingContextBase.cpp: Use the new values.
3704         (WebCore::WebGLRenderingContextBase::create):
3705         (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
3706         * platform/WebGLStateTracker.cpp:
3707         * platform/WebGLStateTracker.h: Update the state tracker to use the new
3708         values.
3709         * platform/graphics/GraphicsContext3DAttributes.h:
3710         * platform/graphics/mac/GraphicsContext3DMac.mm:
3711         (WebCore::setPixelFormat): Accept GraphicsContext3DPowerPreference as a parameter.
3712         (WebCore::GraphicsContext3D::GraphicsContext3D):
3713
3714 2017-02-14  Youenn Fablet  <youennf@gmail.com>
3715
3716         [WebRTC] Implement description getters for libwebrtc RTCPeerConnection
3717         https://bugs.webkit.org/show_bug.cgi?id=168234
3718
3719         Reviewed by Alex Christensen.
3720
3721         Allows passing W3C webrtc tests.
3722
3723         Implementing localDescription/remoteDescription using libwebrtc backend.
3724         current and pending description getters are made the same as local/remote getters for the moment.
3725         This should be fixed when upgrading to latest libwebrtc revision.
3726
3727         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3728         (WebCore::toSessionDescriptionType):
3729         (WebCore::fromSessionDescriptionType):
3730         (WebCore::fromSessionDescription):
3731         (WebCore::LibWebRTCMediaEndpoint::localDescription):
3732         (WebCore::LibWebRTCMediaEndpoint::remoteDescription):
3733         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
3734         (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
3735         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
3736         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3737         (WebCore::LibWebRTCPeerConnectionBackend::localDescription):
3738         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
3739
3740 2017-02-14  Jeremy Jones  <jeremyj@apple.com>
3741
3742         When playing inline after fullscreen, set a flag instead of adding attribute plays inline, and use in requiresFullscreenForVideoPlayback.
3743         https://bugs.webkit.org/show_bug.cgi?id=167815
3744         rdar://problem/27685077
3745
3746         Reviewed by Jer Noble.
3747
3748         Test: media/media-fullscreen-loop-inline.html
3749
3750         When video is allowed to play inline after fullscreen. Looped video causes play state to update, which can send video back to fullscreen when
3751         allowsInline is false. This change will set a new flag when allowsInlineMediaPlaybackAfterFullscreen allows inline playback that can be tested
3752         in requiresFullscreenForVideoPlayback to prevent sending video back into fullscreen when video loops.
3753
3754         * html/HTMLMediaElement.cpp:
3755         (WebCore::HTMLMediaElement::enterFullscreen):
3756         (WebCore::HTMLMediaElement::exitFullscreen):
3757         * html/HTMLMediaElement.h:
3758         (WebCore::HTMLMediaElement::isTemporarilyAllowingInlinePlaybackAfterFullscreen): Added.
3759         * html/MediaElementSession.cpp:
3760         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
3761
3762 2017-02-14  Jer Noble  <jer.noble@apple.com>
3763
3764         Video elements with MediaSource objects set by srcObject are not cleared when srcObject is set to null
3765         https://bugs.webkit.org/show_bug.cgi?id=168268
3766
3767         Reviewed by Eric Carlson.
3768
3769         Test: fast/mediastream/MediaStream-MediaElement-setObject-null.html
3770
3771         Make the setSrcObject() operation compliant with the HTML spec. Since the specification defines
3772         srcObject in terms of either a MediaSource, MediaStream, or Blob object, add the variant typedef
3773         to HTMLMediaElement and move the definition out of the Modules/mediastream extension IDL and into
3774         HTMLMediaElement.idl. Then bring the "media elements load" and "resource selection" algorithms up
3775         to their most recent definitions in the HTML5 spec.
3776
3777         Drive-by fix: Allow the (admittedly weird) single-element-union type in IDL.
3778
3779         * CMakeLists.txt:
3780         * DerivedSources.cpp:
3781         * DerivedSources.make:
3782         * Modules/mediastream/HTMLMediaElementMediaStream.cpp: Removed.
3783         * Modules/mediastream/HTMLMediaElementMediaStream.h: Removed.
3784         * Modules/mediastream/HTMLMediaElementMediaStream.idl: Removed.
3785         * WebCore.xcodeproj/project.pbxproj:
3786         * bindings/scripts/IDLParser.pm:
3787         (parseUnionType):
3788         * html/HTMLAudioElement.cpp:
3789         (WebCore::HTMLAudioElement::createForJSConstructor):
3790         * html/HTMLMediaElement.cpp:
3791         (WebCore::actionName):
3792         (WebCore::HTMLMediaElement::parseAttribute):
3793         (WebCore::HTMLMediaElement::insertedInto):
3794         (WebCore::HTMLMediaElement::scheduleDelayedAction):
3795         (WebCore::HTMLMediaElement::scheduleNextSourceChild):
3796         (WebCore::HTMLMediaElement::pendingActionTimerFired):
3797         (WebCore::HTMLMediaElement::setSrcObject):
3798         (WebCore::HTMLMediaElement::load):
3799         (WebCore::HTMLMediaElement::prepareForLoad):
3800         (WebCore::HTMLMediaElement::selectMediaResource):
3801         (WebCore::HTMLMediaElement::loadResource):
3802         (WebCore::HTMLMediaElement::playInternal):
3803         (WebCore::HTMLMediaElement::pauseInternal):
3804         (WebCore::HTMLMediaElement::sourceWasAdded):
3805         (WebCore::HTMLMediaElement::clearMediaPlayer):
3806         (WebCore::HTMLMediaElement::resume):
3807         (WebCore::HTMLMediaElement::mediaCanStart):
3808         (WebCore::HTMLMediaElement::createMediaPlayer):
3809         (WebCore::HTMLMediaElement::loadInternal): Deleted.
3810         * html/HTMLMediaElement.h:
3811         (WebCore::HTMLMediaElement::srcObject):
3812         * html/HTMLMediaElement.idl:
3813         * platform/ContentType.h:
3814
3815 2017-02-14  Aakash Jain  <aakash_jain@apple.com>
3816
3817         Remove unused WebThreadContextIsCurrent method from WebCoreThread.h
3818         https://bugs.webkit.org/show_bug.cgi?id=168254
3819
3820         Reviewed by Dan Bernstein.
3821
3822         * platform/ios/wak/WebCoreThread.h: Removed unused WebThreadContextIsCurrent.
3823         * platform/ios/wak/WebCoreThread.mm:
3824         (WebThreadContextIsCurrent): Deleted.
3825
3826 2017-02-14  Alexey Proskuryakov  <ap@apple.com>
3827
3828         WebCore shouldn't export SystemMemory.h
3829         https://bugs.webkit.org/show_bug.cgi?id=168285
3830
3831         Reviewed by Alex Christensen.
3832
3833         * WebCore.xcodeproj/project.pbxproj:
3834
3835 2017-02-13  Filip Pizlo  <fpizlo@apple.com>
3836
3837         worker.postMessage should throw a TypeError if a SharedArrayBuffer is in the transfer list
3838         https://bugs.webkit.org/show_bug.cgi?id=168277
3839
3840         Reviewed by Mark Lam.
3841
3842         Test: workers/sab/postMessage-transfer-type-error.html
3843         
3844         This is a simple spec compliance change. The title says it all.
3845
3846         * bindings/js/SerializedScriptValue.cpp:
3847         (WebCore::SerializedScriptValue::create):
3848
3849 2017-02-14  Zan Dobersek  <zdobersek@igalia.com>
3850
3851         HTMLMediaElement: WebKitMediaKeys member name should be prefixed
3852         https://bugs.webkit.org/show_bug.cgi?id=168297
3853
3854         Reviewed by Xabier Rodriguez-Calvar.
3855
3856         Rename the LEGACY_ENCRYPTED_MEDIA m_mediaKeys variable to m_webkitMediaKeys
3857         so that it contains the legacy prefix, just like the API. This will make
3858         room for the MediaKeys member variable that will be implemented under
3859         the ENCRYPTED_MEDIA guards.
3860
3861         * html/HTMLMediaElement.cpp:
3862         (WebCore::HTMLMediaElement::mediaPlayerCachedKeyForKeyId):
3863         (WebCore::HTMLMediaElement::webkitSetMediaKeys):
3864         * html/HTMLMediaElement.h:
3865         (WebCore::HTMLMediaElement::webkitKeys):
3866
3867 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
3868
3869         [GTK] Make DragImageRef a RefPtr instead of a plain pointer
3870         https://bugs.webkit.org/show_bug.cgi?id=168296
3871
3872         Reviewed by Sergio Villar Senin.
3873
3874         Use RefPtr<cairo_surface_t> as DragImageRef for GTK+ port to avoid memory leaks.
3875
3876         * platform/DragImage.h:
3877         * platform/gtk/DragImageGtk.cpp:
3878         (WebCore::dragImageSize):
3879         (WebCore::deleteDragImage):
3880         (WebCore::scaleDragImage):
3881         (WebCore::dissolveDragImageToFraction):
3882         (WebCore::createDragImageFromImage):
3883         (WebCore::createDragImageIconForCachedImageFilename):
3884
3885 2017-02-14  Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
3886
3887         [GStreamer][MSE] Some GStreamer log messages are generated with the 'default' category
3888         https://bugs.webkit.org/show_bug.cgi?id=168015
3889
3890         Reviewed by Xabier Rodriguez-Calvar.
3891
3892         The elements AppendPipeline, PlaybackPipeline, MediaSourceClientGstreamerMSE do not have
3893         a defined Gstreamer log category, then the webkitmse category has been added to them.
3894         WebKitMediaSourceGstreamer has its own category but was not declared at the beginning of
3895         the .cpp file.
3896
3897         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Added webkitmse category.
3898         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
3899         Added webkitmse category and gst header.
3900         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: Added webkitmse category.
3901         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
3902         Added webkitmediasrc category.
3903
3904 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
3905
3906         CookieManager only works with the default session
3907         https://bugs.webkit.org/show_bug.cgi?id=168229
3908
3909         Reviewed by Alex Christensen.
3910
3911         Update cookie observer API to use a std::function instead of a function pointer and make it work with multiple
3912         sessions in the backends that support it.
3913
3914         * platform/network/CookieStorage.h:
3915         * platform/network/cf/CookieStorageCFNet.cpp:
3916         (WebCore::cookieChangeCallbackMap):
3917         (WebCore::notifyCookiesChanged):
3918         (WebCore::startObservingCookieChanges):
3919         (WebCore::stopObservingCookieChanges):
3920         * platform/network/mac/CookieStorageMac.mm:
3921         (-[WebCookieStorageObjCAdapter startListeningForCookieChangeNotificationsWithCallback:]):
3922         (-[WebCookieStorageObjCAdapter stopListeningForCookieChangeNotifications]):
3923         (WebCore::startObservingCookieChanges):
3924         (WebCore::stopObservingCookieChanges):
3925         * platform/network/soup/CookieStorageSoup.cpp:
3926         (WebCore::cookieChangeCallbackMap):
3927         (WebCore::soupCookiesChanged):
3928         (WebCore::startObservingCookieChanges):
3929         (WebCore::stopObservingCookieChanges):
3930
3931 2017-02-13  Antoine Quint  <graouts@apple.com>
3932
3933         REGRESSION: Update volume and scrubbing slider to match HI designs
3934         https://bugs.webkit.org/show_bug.cgi?id=168170
3935         <rdar://problem/28095266>
3936
3937         Reviewed by Dean Jackson.
3938
3939         We bring the designs of the control's background materials, scrubber and
3940         volume slider up to spec.
3941
3942         The first important set of changes is that, on macOS, the materials and colors
3943         were incorrect. Buttons and time labels now set a mix-blend-mode to correctly
3944         appear vibrant against the media, and the controls bar, volume container
3945         and tracks menu now use a new BackgroundTint node to correctly apply both
3946         a backdrop-filter and blended tint above it.
3947
3948         The second important set of changes is the rendering of the sliders. Up to now
3949         we would simply style the <input type="range"> track and thumb, applying solid
3950         fills and strokes. We now draw sliders in two ways depending on the platform.
3951         
3952         On macOS, we draw the whole slider with a <canvas> element with "mix-blend-mode"
3953         set to "plus-lighter". On iOS, we draw the track as a <div> with "mix-blend-mode"
3954         set to "plus-darker" and draw the fill (up to the thumb) in the <canvas> with
3955         no blend mode to obtain a pure white color, finally the thumb is rendered by the
3956         <input> element. We couldn't draw the pure white color with the track in the
3957         same <canvas> due to the "plus-darker" blend mode.
3958
3959         Test: media/modern-media-controls/background-tint/background-tint.html
3960
3961         * Modules/modern-media-controls/controls/airplay-button.css:
3962         (button.airplay.on):
3963         * Modules/modern-media-controls/controls/background-tint.css: Added.
3964         (.background-tint):
3965         (.background-tint,):
3966         (.background-tint > .blur):
3967         (.background-tint > .tint):
3968         * Modules/modern-media-controls/controls/background-tint.js: Added.
3969         (BackgroundTint):
3970         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
3971         (.media-controls.ios.inline .scrubber.slider):
3972         (.media-controls.ios.inline .scrubber.slider > div):
3973         (.media-controls.ios.inline .scrubber.slider > input::-webkit-slider-thumb):
3974         (.media-controls.ios.inline .scrubber.slider > .fill): Deleted.
3975         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css:
3976         (.media-controls.mac.inline.compact .volume-slider-container):
3977         (.media-controls.mac.inline.compact .volume.slider):
3978         (.media-controls.mac.inline.compact .scrubber.slider > input::-webkit-slider-thumb): Deleted.