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