REGRESSION (Safari 10.1): When 'transition' contains -ms-transform, transform-origin...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-05-04  Antti Koivisto  <antti@apple.com>
2
3         REGRESSION (Safari 10.1): When 'transition' contains -ms-transform, transform-origin is also transitioned
4         https://bugs.webkit.org/show_bug.cgi?id=171250
5         <rdar://problem/31827243>
6
7         Reviewed by Geoffrey Garen.
8
9         We were mapping unknown properties to 'all' animation. With this patch we ignore them instead.
10         The patch also implements roundtripping of unknown properties via CSSOM, matching Blink and Gecko.
11
12         Test: transitions/transition-unknown-property-ignore.html
13
14         * css/CSSComputedStyleDeclaration.cpp:
15         (WebCore::createTransitionPropertyValue):
16
17             Return the correct name for unknown properties.
18
19         * css/CSSToStyleMap.cpp:
20         (WebCore::CSSToStyleMap::mapAnimationProperty):
21
22             Map any unknown property to AnimateUnknownProperty mode instead of falling back to the default of AnimateAll.
23             Save the unknown property name so we can roundtrip it properly.
24
25         * page/animation/CompositeAnimation.cpp:
26         (WebCore::CompositeAnimation::updateTransitions):
27
28             Ignore AnimateUnknownProperty like AnimateNone.
29
30         * platform/animation/Animation.h:
31         (WebCore::Animation::unknownProperty):
32         (WebCore::Animation::setUnknownProperty):
33
34 2017-05-04  Chris Dumez  <cdumez@apple.com>
35
36         Clean up MutationRecord.idl
37         https://bugs.webkit.org/show_bug.cgi?id=171685
38
39         Reviewed by Sam Weinig.
40
41         Clean up MutationRecord.idl to match the specification:
42         - https://dom.spec.whatwg.org/#mutationrecord
43
44         There is no Web-facing behavior change.
45
46         * dom/MutationRecord.idl:
47
48 2017-05-04  Chris Dumez  <cdumez@apple.com>
49
50         Reformat / clean up Event.idl
51         https://bugs.webkit.org/show_bug.cgi?id=171675
52
53         Reviewed by Sam Weinig.
54
55         Reformat / clean up Event.idl to match the latest spec more closely:
56         - https://dom.spec.whatwg.org/#interface-event
57
58         There is no web-facing behavior change, except for properties being
59         enumerated in a slightly different order.
60
61         * dom/Event.idl:
62
63 2017-05-04  Daniel Bates  <dabates@apple.com>
64
65         Cleanup: Extract CachedScript::mimeTypeAllowedByNosniff() into a common function
66         https://bugs.webkit.org/show_bug.cgi?id=171678
67
68         Reviewed by Andy Estes.
69
70         Extract CachedScript::mimeTypeAllowedByNosniff() into a common function that can
71         be shared by LoadableClassicScript and WorkerScriptLoader.
72
73         No functionality was changed. So, no new tests.
74
75         * dom/LoadableClassicScript.cpp:
76         (WebCore::LoadableClassicScript::notifyFinished): Modified to use WebCore::isScriptAllowedByNosniff().
77         * loader/cache/CachedScript.cpp:
78         (WebCore::CachedScript::mimeType): Deleted; incorporated into WebCore::isScriptAllowedByNosniff().
79         (WebCore::CachedScript::mimeTypeAllowedByNosniff): Deleted; incorporated into WebCore::isScriptAllowedByNosniff().
80         * loader/cache/CachedScript.h:
81         * platform/network/ResourceResponseBase.cpp:
82         (WebCore::isScriptAllowedByNosniff): Added. Note that it is sufficient to extract the MIME type
83         as-is and query the MIME type registry because the MIME type registry performs look ups case-insensitively.
84         * platform/network/ResourceResponseBase.h:
85         * workers/WorkerScriptLoader.cpp:
86         (WebCore::WorkerScriptLoader::didReceiveResponse): Modified to use WebCore::isScriptAllowedByNosniff().
87         (WebCore::mimeTypeAllowedByNosniff): Deleted.
88
89 2017-05-04  Sam Weinig  <sam@webkit.org>
90
91         Make the [EnabledBySetting] extended attribute work for any attribute or operation on a prototype
92         https://bugs.webkit.org/show_bug.cgi?id=171588
93
94         Reviewed by Dean Jackson.
95
96         * bindings/js/JSDOMIterator.h:
97         (WebCore::JSDOMIterator::createPrototype):
98         * bindings/js/JSDOMWindowShell.cpp:
99         (WebCore::JSDOMWindowShell::setWindow):
100         * bindings/js/JSDOMWrapperCache.h:
101         (WebCore::getDOMStructure):
102         (WebCore::getDOMPrototype):
103         * bindings/js/WorkerScriptController.cpp:
104         (WebCore::WorkerScriptController::initScript):
105         Update to account for createPrototype and prototype taking the global object by reference.
106         
107         * bindings/scripts/CodeGeneratorJS.pm:
108         (NeedsSettingsCheckForPrototypeProperty):
109         Add predicate to determine if an interface has any settings enabled properties on the prototype,
110         needed to determine if we should pass the global object to finishCreation.
111
112         (GenerateHeader):
113         Update signature of both createPrototype and prototype to take JSDOMGlobalObject& rather than
114         a JSC::JSGlobalObject*, this allows us to pass the more specific type to the prototype constructor,
115         and access the ScriptExecutionContext for the Settings.
116
117         (GeneratePropertiesHashTable):
118         Update to return, via out parameter, arrays with the attributes and operations that specify EnabledBySetting. This
119         mimics the model used for RuntimeEnabledFeatures.
120
121         (GenerateImplementation):
122         In {Class}Prototype::finishCreation, add code to check settings to see if an attribute or operation should be enabled,
123         and if it shouldn't remove it from the object. This, again, is modeled on RuntimeEnabledFeatures.
124
125         (GeneratePrototypeDeclaration):
126         Update signatures to take JSDOMGlobalObject& and specialize finishCreation to take one if there are any properties
127         that require settings to enable.
128
129         (GenerateConstructorHelperMethods):
130         Update for new signature of prototype(...).
131
132         * bindings/scripts/test/JS/JSInterfaceName.cpp:
133         * bindings/scripts/test/JS/JSInterfaceName.h:
134         * bindings/scripts/test/JS/JSMapLike.cpp:
135         * bindings/scripts/test/JS/JSMapLike.h:
136         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
137         * bindings/scripts/test/JS/JSReadOnlyMapLike.h:
138         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
139         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
140         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
141         * bindings/scripts/test/JS/JSTestCEReactions.h:
142         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
143         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h:
144         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
145         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
146         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
147         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
148         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
149         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
150         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
151         * bindings/scripts/test/JS/JSTestDOMJIT.h:
152         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
153         * bindings/scripts/test/JS/JSTestEventConstructor.h:
154         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
155         * bindings/scripts/test/JS/JSTestEventTarget.h:
156         * bindings/scripts/test/JS/JSTestException.cpp:
157         * bindings/scripts/test/JS/JSTestException.h:
158         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
159         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
160         * bindings/scripts/test/JS/JSTestGlobalObject.h:
161         * bindings/scripts/test/JS/JSTestInterface.cpp:
162         * bindings/scripts/test/JS/JSTestInterface.h:
163         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
164         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h:
165         * bindings/scripts/test/JS/JSTestIterable.cpp:
166         * bindings/scripts/test/JS/JSTestIterable.h:
167         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
168         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
169         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
170         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
171         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
172         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
173         * bindings/scripts/test/JS/JSTestNode.cpp:
174         * bindings/scripts/test/JS/JSTestNode.h:
175         * bindings/scripts/test/JS/JSTestObj.cpp:
176         * bindings/scripts/test/JS/JSTestObj.h:
177         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
178         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
179         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
180         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
181         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
182         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
183         * bindings/scripts/test/JS/JSTestSerialization.cpp:
184         * bindings/scripts/test/JS/JSTestSerialization.h:
185         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
186         * bindings/scripts/test/JS/JSTestSerializationInherit.h:
187         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
188         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
189         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
190         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
191         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
192         * bindings/scripts/test/JS/JSTestTypedefs.h:
193         Update test results for new test values and changes in signatures to pass JSDOMGlobalObject.
194
195         * bindings/scripts/test/TestObj.idl:
196         Add tests for [EnableBySetting] for attributes and operations.
197
198         * bridge/objc/objc_runtime.h:
199         * bridge/runtime_array.h:
200         * bridge/runtime_method.h:
201         * bridge/runtime_object.h:
202         * inspector/CommandLineAPIHost.cpp:
203         Update createPrototype function to take the global object by reference.
204
205 2017-05-04  Eric Carlson  <eric.carlson@apple.com>
206
207         [MediaStream] Allow host application to enable/disable media capture
208         https://bugs.webkit.org/show_bug.cgi?id=171292
209         <rdar://problem/31821492>
210
211         Reviewed by Jer Noble.
212
213         No new layout tests, added an API test instead.
214
215         * Modules/mediastream/MediaStream.cpp:
216         (WebCore::MediaStream::endStream): New, stop all tracks.
217         * Modules/mediastream/MediaStream.h:
218
219         * Modules/mediastream/MediaStreamRegistry.cpp:
220         (WebCore::MediaStreamRegistry::unregisterStream): Minor cleanup.
221         (WebCore::MediaStreamRegistry::forEach): New, call the lambda with each stream.
222         (WebCore::MediaStreamRegistry::MediaStreamRegistry): Deleted, unused.
223         * Modules/mediastream/MediaStreamRegistry.h:
224
225         * Modules/mediastream/MediaStreamTrack.cpp:
226         (WebCore::MediaStreamTrack::stopTrack): Add parameter so caller can specify if an 'ended' 
227         event should be sent or not.
228         (WebCore::MediaStreamTrack::trackMutedChanged): Don't post an event if the track has ended.
229         * Modules/mediastream/MediaStreamTrack.h:
230
231         * dom/Document.cpp:
232         (WebCore::Document::stopMediaCapture): Stop all streams in the document.
233         * dom/Document.h:
234
235         * page/Page.cpp:
236         (WebCore::Page::stopMediaCapture): Stop all streams.
237         * page/Page.h:
238
239         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
240         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode): Display a black frame
241         when the stream ends.
242         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::activeStatusChanged): Signal a characteristics
243         change to HTMLMediaElement refresh state.
244         * platform/mediastream/MediaStreamPrivate.h:
245
246         * platform/mediastream/mac/AVMediaCaptureSource.mm:
247         (WebCore::AVMediaCaptureSource::stopProducingData): Don't return early if the session isn't 
248         running, we always need to clear m_session on iOS.
249
250 2017-05-04  Zalan Bujtas  <zalan@apple.com>
251
252         Should never hit layout while updating the render tree.
253         https://bugs.webkit.org/show_bug.cgi?id=171643
254
255         Reviewed by Antti Koivisto.
256
257         Laying out a half-baked render tree is not a great idea. Especially considering
258         that layout (sadly) can mutate the render tree.  
259
260         * page/FrameView.cpp:
261         (WebCore::FrameView::layout):
262
263 2017-05-04  Daniel Bates  <dabates@apple.com>
264
265         importScripts() should respect X-Content-Type-Options: nosniff
266         https://bugs.webkit.org/show_bug.cgi?id=171248
267         <rdar://problem/31819023>
268
269         Reviewed by Andy Estes.
270
271         Do not load a worker script if it has the HTTP response header "X-Content-Type-Options: nosniff"
272         and its Content-type header is not an allowed JavaScript script mime type. This behavior follows
273         from <https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-worker-imported-script> (3 May 2017),
274         <https://fetch.spec.whatwg.org/#concept-fetch> (2 May 2017), and <https://fetch.spec.whatwg.org/#concept-main-fetch>.
275
276         * workers/WorkerScriptLoader.cpp:
277         (WebCore::mimeTypeAllowedByNosniff): Added.
278         (WebCore::WorkerScriptLoader::didReceiveResponse): Mark the load as failed if the response
279         is not allowed by X-Content-Type-Options: nosniff.
280
281 2017-05-04  Dave Hyatt  <hyatt@apple.com>
282
283         REGRESSION(STP): rgb() with calc() containing variables doesn't work
284         https://bugs.webkit.org/show_bug.cgi?id=169939
285
286         Reviewed by Zalan Bujtas.
287
288         Added new test in fast/css/variables.
289
290         * css/CSSCalculationValue.cpp:
291         (WebCore::CSSCalcExpressionNodeParser::parseValue):
292         Treat floats in calcs as integers when we can.
293
294 2017-05-04  Commit Queue  <commit-queue@webkit.org>
295
296         Unreviewed, rolling out r216172.
297         https://bugs.webkit.org/show_bug.cgi?id=171654
298
299         FTBFS for iOS due to missing WebPageProxy::stopMediaCapture()
300         implementation. (Requested by ddkilzer on #webkit).
301
302         Reverted changeset:
303
304         "[MediaStream] Allow host application to enable/disable media
305         capture"
306         https://bugs.webkit.org/show_bug.cgi?id=171292
307         http://trac.webkit.org/changeset/216172
308
309 2017-05-03  Carlos Garcia Campos  <cgarcia@igalia.com>
310
311         REGRESSION(r215686): Incremental reads from SharedBuffer are wrong after r215686
312         https://bugs.webkit.org/show_bug.cgi?id=171602
313
314         Reviewed by Michael Catanzaro.
315
316         In TextTrackLoader::processNewCueData() and PNGImageReader::decode() we changed the patter to read data from a
317         SharedBuffer at a given offset. The new pattern is not correct, because it assumes the whole segment is always
318         read, and the new offset is not correct when that's not the case. This has broken the rendering of png images in
319         the GTK+ port, only the first bytes are correctly decoded and drawn, but not the rest of the image.
320
321         Fixes: editing/pasteboard/paste-image-using-image-data.html
322
323         * loader/TextTrackLoader.cpp:
324         (WebCore::TextTrackLoader::processNewCueData):
325         * platform/image-decoders/png/PNGImageDecoder.cpp:
326         (WebCore::PNGImageReader::decode):
327
328 2017-05-03  Eric Carlson  <eric.carlson@apple.com>
329
330         [MediaStream] Allow host application to enable/disable media capture
331         https://bugs.webkit.org/show_bug.cgi?id=171292
332         <rdar://problem/31821492>
333
334         Reviewed by Jer Noble.
335
336         No new layout tests, added an API test instead.
337
338         * Modules/mediastream/MediaStream.cpp:
339         (WebCore::MediaStream::endStream): New, stop all tracks.
340         * Modules/mediastream/MediaStream.h:
341
342         * Modules/mediastream/MediaStreamRegistry.cpp:
343         (WebCore::MediaStreamRegistry::unregisterStream): Minor cleanup.
344         (WebCore::MediaStreamRegistry::forEach): New, call the lambda with each stream.
345         (WebCore::MediaStreamRegistry::MediaStreamRegistry): Deleted, unused.
346         * Modules/mediastream/MediaStreamRegistry.h:
347
348         * Modules/mediastream/MediaStreamTrack.cpp:
349         (WebCore::MediaStreamTrack::stopTrack): Add parameter so caller can specify if an 'ended' 
350         event should be sent or not.
351         (WebCore::MediaStreamTrack::trackMutedChanged): Don't post an event if the track has ended.
352         * Modules/mediastream/MediaStreamTrack.h:
353
354         * dom/Document.cpp:
355         (WebCore::Document::stopMediaCapture): Stop all streams in the document.
356         * dom/Document.h:
357
358         * page/Page.cpp:
359         (WebCore::Page::stopMediaCapture): Stop all streams.
360         * page/Page.h:
361
362         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
363         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode): Display a black frame
364         when the stream ends.
365         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::activeStatusChanged): Signal a characteristics
366         change to HTMLMediaElement refresh state.
367         * platform/mediastream/MediaStreamPrivate.h:
368
369         * platform/mediastream/mac/AVMediaCaptureSource.mm:
370         (WebCore::AVMediaCaptureSource::stopProducingData): Don't return early if the session isn't 
371         running, we always need to clear m_session on iOS.
372
373 2017-05-03  John Wilander  <wilander@apple.com>
374
375         Resource Load Statistics: Remove all statistics for modifiedSince website data removals
376         https://bugs.webkit.org/show_bug.cgi?id=171584
377         <rdar://problem/24702576>
378
379         Reviewed by Brent Fulgham.
380
381         Test: http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html
382
383         * loader/ResourceLoadObserver.cpp:
384         (WebCore::ResourceLoadObserver::clearInMemoryAndPersistentStore):
385             Now clears all regardless of the modifiedSince parameter's value.
386
387 2017-05-03  Andy Estes  <aestes@apple.com>
388
389         Try to fix the macOS Public SDK build
390         https://bugs.webkit.org/show_bug.cgi?id=171635
391         <rdar://problem/31812751>
392
393         Unreviewed because the commit queue told me to say this.
394
395         * platform/spi/cocoa/AVKitSPI.h:
396
397 2017-05-03  Joanmarie Diggs  <jdiggs@igalia.com>
398
399         AX: aria-rowspan value should be ignored if td/th rowspan value is provided
400         https://bugs.webkit.org/show_bug.cgi?id=171214
401
402         Reviewed by Chris Fleizach.
403
404         Return -1 in AccessibilityTableCell::ariaColumnSpan() and ariaRowSpan() if the
405         cell element has an explicit value for the native host language's span attribute.
406         Add checks to AccessibilityTableCell::columnIndexRange() and rowIndexRange() so
407         that we prefer an author-provided ARIA span value over an implicit host-language
408         span value. Similarly, add checks to AccessibilityARIAGridCell::columnIndexRange()
409         and rowIndexRange() so that we fall back on implicit host-language span values
410         when there is no author-provided ARIA span value and the ARIA cell is associated
411         with a cell element.
412
413         Test: accessibility/aria-cellspans-with-native-cellspans.html
414
415         * accessibility/AccessibilityARIAGridCell.cpp:
416         (WebCore::AccessibilityARIAGridCell::ariaRowSpanWithRowIndex):
417         (WebCore::AccessibilityARIAGridCell::columnIndexRange):
418         * accessibility/AccessibilityTableCell.cpp:
419         (WebCore::AccessibilityTableCell::rowIndexRange):
420         (WebCore::AccessibilityTableCell::columnIndexRange):
421         (WebCore::AccessibilityTableCell::ariaColumnSpan):
422         (WebCore::AccessibilityTableCell::ariaRowSpan):
423
424 2017-05-03  Commit Queue  <commit-queue@webkit.org>
425
426         Unreviewed, rolling out r216160 and r216161.
427         https://bugs.webkit.org/show_bug.cgi?id=171640
428
429         These changes broke the iOS build. (Requested by mlewis13 on
430         #webkit).
431
432         Reverted changesets:
433
434         "[MediaStream] Allow host application to enable/disable media
435         capture"
436         https://bugs.webkit.org/show_bug.cgi?id=171292
437         http://trac.webkit.org/changeset/216160
438
439         "[MediaStream] Allow host application to enable/disable media
440         capture"
441         https://bugs.webkit.org/show_bug.cgi?id=171292
442         http://trac.webkit.org/changeset/216161
443
444 2017-05-03  Eric Carlson  <eric.carlson@apple.com>
445
446         [MediaStream] Allow host application to enable/disable media capture
447         https://bugs.webkit.org/show_bug.cgi?id=171292
448         <rdar://problem/31821492>
449
450         Reviewed by Jer Noble.
451
452         No new layout tests, added an API test instead.
453
454         * Modules/mediastream/MediaStream.cpp:
455         (WebCore::MediaStream::endStream): New, stop all tracks.
456         * Modules/mediastream/MediaStream.h:
457
458         * Modules/mediastream/MediaStreamRegistry.cpp:
459         (WebCore::MediaStreamRegistry::unregisterStream): Minor cleanup.
460         (WebCore::MediaStreamRegistry::forEach): New, call the lambda with each stream.
461         (WebCore::MediaStreamRegistry::MediaStreamRegistry): Deleted, unused.
462         * Modules/mediastream/MediaStreamRegistry.h:
463
464         * Modules/mediastream/MediaStreamTrack.cpp:
465         (WebCore::MediaStreamTrack::stopTrack): Add parameter so caller can specify if an 'ended' 
466         event should be sent or not.
467         (WebCore::MediaStreamTrack::trackMutedChanged): Don't post an event if the track has ended.
468         * Modules/mediastream/MediaStreamTrack.h:
469
470         * dom/Document.cpp:
471         (WebCore::Document::stopMediaCapture): Stop all streams in the document.
472         * dom/Document.h:
473
474         * page/Page.cpp:
475         (WebCore::Page::stopMediaCapture): Stop all streams.
476         * page/Page.h:
477
478         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
479         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode): Display a black frame
480         when the stream ends.
481         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::activeStatusChanged): Signal a characteristics
482         change to HTMLMediaElement refresh state.
483         * platform/mediastream/MediaStreamPrivate.h:
484
485         * platform/mediastream/mac/AVMediaCaptureSource.mm:
486         (WebCore::AVMediaCaptureSource::stopProducingData): Don't return early if the session isn't 
487         running, we always need to clear m_session on iOS.
488
489 2017-05-03  Zalan Bujtas  <zalan@apple.com>
490
491         SearchInputType could end up with a mismatched renderer.
492         https://bugs.webkit.org/show_bug.cgi?id=171547
493         <rdar://problem/31935047>
494
495         Reviewed by Antti Koivisto.
496
497         Normally we've got the correct renderer by the time we call into SearchInputType.
498         However, since HTMLInputElement::updateType() eagerly updates the type while the associated renderers are done lazily
499         (so we don't get them updated until after the next tree update), we could actually end up
500         with a mismatched renderer (e.g. through form submission).
501
502         Test: fast/forms/change-input-type-and-submit-form-crash.html
503
504         * html/SearchInputType.cpp:
505         (WebCore::SearchInputType::addSearchResult):
506         (WebCore::SearchInputType::didSetValueByUserEdit):
507
508 2017-05-03  Jer Noble  <jer.noble@apple.com>
509
510         Make the VPIO audio unit a singleton, shared between multiple CaptureSources
511         https://bugs.webkit.org/show_bug.cgi?id=171622
512
513         Reviewed by Eric Carlson.
514
515         Move the implemnetation of CoreAudioCaptureSource into a shared singleton class, CoreAudioSharedUnit,
516         which will send audio to each of it's client CoreAudioCaptureSources. The first registered client will
517         define the settings used by the shared unit.
518
519         Drive-by fixes: Fix up setUseAVFoundationAudioCapture() to always accept the first value set.
520
521         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
522         (WebCore::CoreAudioSharedUnit::isProducingData):
523         (WebCore::CoreAudioSharedUnit::microphoneFormat):
524         (WebCore::CoreAudioSharedUnit::singleton):
525         (WebCore::CoreAudioSharedUnit::addClient):
526         (WebCore::CoreAudioSharedUnit::removeClient):
527         (WebCore::CoreAudioSharedUnit::addEchoCancellationSource):
528         (WebCore::CoreAudioSharedUnit::removeEchoCancellationSource):
529         (WebCore::CoreAudioSharedUnit::preferredIOBufferSize):
530         (WebCore::CoreAudioSharedUnit::setupAudioUnits):
531         (WebCore::CoreAudioSharedUnit::configureMicrophoneProc):
532         (WebCore::CoreAudioSharedUnit::configureSpeakerProc):
533         (WebCore::CoreAudioSharedUnit::checkTimestamps):
534         (WebCore::CoreAudioSharedUnit::provideSpeakerData):
535         (WebCore::CoreAudioSharedUnit::speakerCallback):
536         (WebCore::CoreAudioSharedUnit::processMicrophoneSamples):
537         (WebCore::CoreAudioSharedUnit::microphoneCallback):
538         (WebCore::CoreAudioSharedUnit::cleanupAudioUnits):
539         (WebCore::CoreAudioSharedUnit::startProducingData):
540         (WebCore::CoreAudioSharedUnit::stopProducingData):
541         (WebCore::CoreAudioSharedUnit::suspend):
542         (WebCore::CoreAudioSharedUnit::defaultInputDevice):
543         (WebCore::CoreAudioCaptureSource::create):
544         (WebCore::CoreAudioCaptureSource::factory):
545         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
546         (WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource):
547         (WebCore::CoreAudioCaptureSource::addEchoCancellationSource):
548         (WebCore::CoreAudioCaptureSource::removeEchoCancellationSource):
549         (WebCore::CoreAudioCaptureSource::startProducingData):
550         (WebCore::CoreAudioCaptureSource::stopProducingData):
551         (WebCore::CoreAudioCaptureSource::audioSourceProvider):
552         (WebCore::CoreAudioCaptureSource::preferredSampleRate): Deleted.
553         (WebCore::CoreAudioCaptureSource::preferredIOBufferSize): Deleted.
554         (WebCore::CoreAudioCaptureSource::configureMicrophoneProc): Deleted.
555         (WebCore::CoreAudioCaptureSource::configureSpeakerProc): Deleted.
556         (WebCore::CoreAudioCaptureSource::checkTimestamps): Deleted.
557         (WebCore::CoreAudioCaptureSource::provideSpeakerData): Deleted.
558         (WebCore::CoreAudioCaptureSource::speakerCallback): Deleted.
559         (WebCore::CoreAudioCaptureSource::processMicrophoneSamples): Deleted.
560         (WebCore::CoreAudioCaptureSource::microphoneCallback): Deleted.
561         (WebCore::CoreAudioCaptureSource::cleanupAudioUnits): Deleted.
562         (WebCore::CoreAudioCaptureSource::defaultInputDevice): Deleted.
563         (WebCore::CoreAudioCaptureSource::setupAudioUnits): Deleted.
564         (WebCore::CoreAudioCaptureSource::suspend): Deleted.
565         (WebCore::CoreAudioCaptureSource::resume): Deleted.
566         * platform/mediastream/mac/CoreAudioCaptureSource.h:
567         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
568         (WebCore::RealtimeMediaSourceCenterMac::setUseAVFoundationAudioCapture):
569
570 2017-05-03  Jer Noble  <jer.noble@apple.com>
571
572         getUserMedia() fails because devices list is empty / inactive
573         https://bugs.webkit.org/show_bug.cgi?id=171626
574
575         Reviewed by Eric Carlson.
576
577         When creating a AVAudioSessionCaptureDevice, set the device's enabled state to true if the port description
578         has any items in its dataSources property (which is the best analogue to "isActive" we have in AVAudioSession).
579
580         Also, when creating the generic list of CaptureDevices, use the copy constructor to ensure the enabled state
581         gets copied to the new generic device.
582
583         * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
584         (WebCore::AVAudioSessionCaptureDevice::create):
585         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
586         (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices):
587
588 2017-05-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
589
590         Implement the imageready event to reliably test the async image decoding
591         https://bugs.webkit.org/show_bug.cgi?id=171016
592
593         Reviewed by Simon Fraser.
594
595         The event will be fired for each client of the image. Firing the event
596         will happen after finishing the decoding and repainting the client.
597
598         Existing tests will be modified in a separate patch to use this event.
599
600         * dom/Element.cpp:
601         (WebCore::Element::dispatchWebKitImageReadyEventForTesting):
602         * dom/Element.h:
603         * page/Settings.in:
604         * rendering/RenderElement.cpp:
605         (WebCore::RenderElement::imageFrameAvailable):
606
607 2017-05-03  Tim Horton  <timothy_horton@apple.com>
608
609         Maintain interaction information URL as a URL, not a string
610         https://bugs.webkit.org/show_bug.cgi?id=171623
611
612         Reviewed by Simon Fraser.
613
614         No new tests, not a behavior change.
615
616         * platform/URL.h:
617
618 2017-05-03  Yoav Weiss  <yoav@yoav.ws>
619
620         Link preload HTMLPreloadScanner support
621         https://bugs.webkit.org/show_bug.cgi?id=170747
622
623         Reviewed by Youenn Fablet.
624
625         Test: http/tests/preload/preloadscanner_download_resources.html
626
627         * html/parser/HTMLPreloadScanner.cpp:
628         (WebCore::TokenPreloadScanner::StartTagScanner::StartTagScanner): Initialize link preload flag.
629         (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest): Create a request only if the type is known (so ignore
630         preloads with unknown type).
631         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): Add handling for link preload and the `as` attribute.
632         (WebCore::TokenPreloadScanner::StartTagScanner::relAttributeIsStyleSheet): Get LinkRelAttribute as input.
633         (WebCore::TokenPreloadScanner::StartTagScanner::resourceType): Return an std::optional, in case the preload type is unknown.
634         (WebCore::TokenPreloadScanner::StartTagScanner::shouldPreload): Return true for the link preload case.
635         * loader/cache/CachedResourceLoader.cpp:
636         (WebCore::CachedResourceLoader::preload): Return the resource rather than a nullptr if it's already in m_preloads.
637
638 2017-05-03  Michael Catanzaro  <mcatanzaro@igalia.com>
639
640         YouTube user agent quirk breaks new YouTube
641         https://bugs.webkit.org/show_bug.cgi?id=171603
642
643         Reviewed by Carlos Garcia Campos.
644
645         Our user agent quirk to make YouTube 360 work breaks the new YouTube UI, causing it to
646         attempt to use the obsolete custom elements v0 API. WebKit only supports the v1 API. We
647         have to remove this quirk.
648
649         Note this does not affect Safari as Apple ports don't use our user agent quirks.
650
651         * platform/UserAgentQuirks.cpp:
652         (WebCore::urlRequiresChromeBrowser):
653
654 2017-05-03  Joseph Pecoraro  <pecoraro@apple.com>
655
656         Web Inspector: 404 Image Load does not appear as a failure in Web Inspector
657         https://bugs.webkit.org/show_bug.cgi?id=171587
658         <rdar://problem/13222846>
659
660         Reviewed by Matt Baker.
661
662         * inspector/InspectorPageAgent.h:
663         * inspector/InspectorPageAgent.cpp:
664         (WebCore::InspectorPageAgent::cachedResourceContent):
665         (WebCore::prepareCachedResourceBuffer): Deleted.
666         Inline the function to make this less confusing.
667
668         (WebCore::InspectorPageAgent::buildObjectForFrameTree):
669         Treat a DecodeError as a failure.
670
671 2017-05-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
672
673         Async image decoding should be disabled for snapshots, printing and preview
674         https://bugs.webkit.org/show_bug.cgi?id=171467
675  
676         Reviewed by Simon Fraser.
677  
678         Asynchronous image decoding should only be used for window display where
679         RenderElements can be repainted and painted. For cases where there is only
680         one chance to draw the image, synchronous decoding should be used. 
681
682         * rendering/RenderBoxModelObject.cpp:
683         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
684         * rendering/RenderImage.cpp:
685         (WebCore::RenderImage::paintIntoRect):
686
687 2017-05-03  Nan Wang  <n_wang@apple.com>
688
689         AX: VO skips cells after cell with aria-colspan
690         https://bugs.webkit.org/show_bug.cgi?id=171579
691
692         Reviewed by Chris Fleizach.
693
694         We should consider the previous cells' column span value when
695         calculating the column index.
696
697         Test: accessibility/mac/aria-grid-column-span.html
698
699         * accessibility/AccessibilityARIAGridCell.cpp:
700         (WebCore::AccessibilityARIAGridCell::columnIndexRange):
701
702 2017-05-03  Jiewen Tan  <jiewen_tan@apple.com>
703
704         ASSERTION FAILED: m_scriptExecutionContext->isContextThread() seen with LayoutTest crypto/workers/crypto-random-values-limits-worker.html
705         https://bugs.webkit.org/show_bug.cgi?id=171462
706         <rdar://problem/31906859>
707
708         Reviewed by Brent Fulgham.
709
710         Covered by existing tests.
711
712         * workers/WorkerGlobalScope.cpp:
713         (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
714         Clear Crypto early in destruction since its ContextDestructionObserver
715         destruction makes checks about the WorkerThread.
716
717 2017-05-03  Zalan Bujtas  <zalan@apple.com>
718
719         RenderSearchField should not use isTextField() in SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT
720         https://bugs.webkit.org/show_bug.cgi?id=171608
721
722         Reviewed by Simon Fraser.
723
724         isTextField() is true for any generic single line text control.
725
726         * rendering/RenderObject.h:
727         (WebCore::RenderObject::isSearchField):
728         * rendering/RenderSearchField.h:
729
730 2017-05-03  Frederic Wang  <fwang@igalia.com>
731
732         Remove ScrollingCoordinator::supportsFixedPositionLayers()
733         https://bugs.webkit.org/show_bug.cgi?id=171557
734
735         Reviewed by Simon Fraser.
736
737         No new tests, behavior is not changed.
738
739         * page/FrameView.cpp:
740         (WebCore::FrameView::shouldUpdateCompositingLayersAfterScrolling):
741         * page/scrolling/AsyncScrollingCoordinator.cpp:
742         (WebCore::AsyncScrollingCoordinator::updateViewportConstrainedNode):
743         * page/scrolling/AsyncScrollingCoordinator.h:
744         * page/scrolling/ScrollingCoordinator.cpp:
745         (WebCore::ScrollingCoordinator::synchronousScrollingReasons):
746         * page/scrolling/ScrollingCoordinator.h:
747         (WebCore::ScrollingCoordinator::supportsFixedPositionLayers): Deleted.
748         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
749         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateViewportConstrainedNode):
750         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h:
751         (): Deleted.
752         * rendering/RenderLayerCompositor.cpp:
753         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
754
755 2017-05-03  Chris Dumez  <cdumez@apple.com>
756
757         Use PassRefPtr less in CompositeEditCommand
758         https://bugs.webkit.org/show_bug.cgi?id=171590
759
760         Reviewed by Sam Weinig.
761
762         Use PassRefPtr less in CompositeEditCommand.
763
764         * CMakeLists.txt:
765         * WebCore.xcodeproj/project.pbxproj:
766         * editing/ApplyStyleCommand.cpp:
767         (WebCore::hasNoAttributeOrOnlyStyleAttribute):
768         (WebCore::isStyleSpanOrSpanWithOnlyStyleAttribute):
769         (WebCore::isSpanWithoutAttributesOrUnstyledStyleSpan):
770         (WebCore::isEmptyFontTag):
771         (WebCore::ApplyStyleCommand::doApply):
772         (WebCore::ApplyStyleCommand::applyBlockStyle):
773         (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
774         (WebCore::dummySpanAncestorForNode):
775         (WebCore::ApplyStyleCommand::cleanupUnstyledAppleStyleSpans):
776         (WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
777         (WebCore::ApplyStyleCommand::applyInlineStyle):
778         (WebCore::ApplyStyleCommand::fixRangeAndApplyInlineStyle):
779         (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
780         (WebCore::ApplyStyleCommand::shouldApplyInlineStyleToRun):
781         (WebCore::ApplyStyleCommand::removeConflictingInlineStyleFromRun):
782         (WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
783         (WebCore::ApplyStyleCommand::replaceWithSpanOrRemoveIfWithoutAttributes):
784         (WebCore::ApplyStyleCommand::removeImplicitlyStyledElement):
785         (WebCore::ApplyStyleCommand::removeCSSStyle):
786         (WebCore::ApplyStyleCommand::highestAncestorWithConflictingInlineStyle):
787         (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
788         (WebCore::ApplyStyleCommand::removeInlineStyle):
789         (WebCore::ApplyStyleCommand::shouldSplitTextElement):
790         (WebCore::ApplyStyleCommand::mergeStartWithPreviousIfIdentical):
791         (WebCore::ApplyStyleCommand::mergeEndWithNextIfIdentical):
792         (WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
793         (WebCore::ApplyStyleCommand::addBlockStyle):
794         (WebCore::ApplyStyleCommand::joinChildTextNodes):
795         * editing/ApplyStyleCommand.h:
796         (WebCore::ApplyStyleCommand::shouldRemoveInlineStyleFromElement):
797         * editing/CompositeEditCommand.cpp:
798         (WebCore::CompositeEditCommand::removeChildrenInRange):
799         (WebCore::CompositeEditCommand::mergeIdenticalElements):
800         (WebCore::CompositeEditCommand::insertTextIntoNode):
801         (WebCore::CompositeEditCommand::deleteTextFromNode):
802         (WebCore::CompositeEditCommand::replaceTextInNode):
803         (WebCore::CompositeEditCommand::replaceSelectedTextInNode):
804         (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers):
805         (WebCore::CompositeEditCommand::removeNodeAttribute):
806         (WebCore::CompositeEditCommand::rebalanceWhitespaceAt):
807         (WebCore::CompositeEditCommand::rebalanceWhitespaceOnTextSubstring):
808         (WebCore::CompositeEditCommand::prepareWhitespaceAtPositionForSplit):
809         (WebCore::CompositeEditCommand::deleteInsignificantText):
810         (WebCore::CompositeEditCommand::removePlaceholderAt):
811         (WebCore::CompositeEditCommand::cleanupAfterDeletion):
812         (WebCore::CompositeEditCommand::moveParagraphs):
813         * editing/CompositeEditCommand.h:
814         * editing/DeleteFromTextNodeCommand.cpp:
815         (WebCore::DeleteFromTextNodeCommand::DeleteFromTextNodeCommand):
816         (WebCore::DeleteFromTextNodeCommand::doApply):
817         (WebCore::DeleteFromTextNodeCommand::doUnapply):
818         (WebCore::DeleteFromTextNodeCommand::getNodesInCommand):
819         * editing/DeleteFromTextNodeCommand.h:
820         (WebCore::DeleteFromTextNodeCommand::create):
821         * editing/DeleteSelectionCommand.cpp:
822         (WebCore::DeleteSelectionCommand::deleteTextFromNode):
823         (WebCore::DeleteSelectionCommand::handleGeneralDelete):
824         (WebCore::DeleteSelectionCommand::fixupWhitespace):
825         * editing/DeleteSelectionCommand.h:
826         * editing/EditingAllInOne.cpp:
827         * editing/EditingStyle.cpp:
828         (WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode):
829         (WebCore::elementMatchesAndPropertyIsNotInInlineStyleDecl):
830         (WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement):
831         (WebCore::EditingStyle::wrappingStyleForSerialization):
832         (WebCore::styleFromMatchedRulesForElement):
833         (WebCore::EditingStyle::mergeStyleFromRules):
834         (WebCore::EditingStyle::mergeStyleFromRulesForSerialization):
835         (WebCore::EditingStyle::removeStyleFromRulesAndContext):
836         (WebCore::EditingStyle::removePropertiesInElementDefaultStyle):
837         * editing/EditingStyle.h:
838         * editing/IndentOutdentCommand.cpp:
839         (WebCore::IndentOutdentCommand::tryIndentingAsListItem):
840         * editing/InsertIntoTextNodeCommand.cpp:
841         (WebCore::InsertIntoTextNodeCommand::InsertIntoTextNodeCommand):
842         (WebCore::InsertIntoTextNodeCommand::getNodesInCommand):
843         * editing/InsertIntoTextNodeCommand.h:
844         (WebCore::InsertIntoTextNodeCommand::create):
845         * editing/InsertLineBreakCommand.cpp:
846         (WebCore::InsertLineBreakCommand::doApply):
847         * editing/InsertListCommand.cpp:
848         (WebCore::InsertListCommand::mergeWithNeighboringLists):
849         (WebCore::InsertListCommand::listifyParagraph):
850         * editing/InsertParagraphSeparatorCommand.cpp:
851         (WebCore::InsertParagraphSeparatorCommand::doApply):
852         * editing/InsertTextCommand.cpp:
853         (WebCore::InsertTextCommand::performOverwrite):
854         (WebCore::InsertTextCommand::doApply):
855         (WebCore::InsertTextCommand::insertTab):
856         * editing/MergeIdenticalElementsCommand.cpp:
857         (WebCore::MergeIdenticalElementsCommand::MergeIdenticalElementsCommand):
858         (WebCore::MergeIdenticalElementsCommand::doApply):
859         (WebCore::MergeIdenticalElementsCommand::doUnapply):
860         (WebCore::MergeIdenticalElementsCommand::getNodesInCommand):
861         * editing/MergeIdenticalElementsCommand.h:
862         (WebCore::MergeIdenticalElementsCommand::create):
863         * editing/RemoveCSSPropertyCommand.cpp: Removed.
864         * editing/RemoveCSSPropertyCommand.h: Removed.
865         * editing/ReplaceSelectionCommand.cpp:
866         (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
867         (WebCore::ReplaceSelectionCommand::doApply):
868         (WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace):
869         (WebCore::ReplaceSelectionCommand::mergeTextNodesAroundPosition):
870         * editing/markup.cpp:
871         (WebCore::StyledMarkupAccumulator::appendElement):
872         (WebCore::styleFromMatchedRulesAndInlineDecl):
873         (WebCore::createMarkupInternal):
874
875 2017-05-03  Joanmarie Diggs  <jdiggs@igalia.com>
876
877         AX: Treat cells with ARIA table cell properties as cells
878         https://bugs.webkit.org/show_bug.cgi?id=171178
879
880         Reviewed by Chris Fleizach.
881
882         Add the following checks to heuristics in AccessibilityTable::isDataTable():
883         1. If the author has provided a valid aria-rowcount or aria-colcount value on
884            the table element, expose it as a data table.
885         2. If the author has provided a valid aria-colindex or aria-rowindex on the
886            cell element, expose it as a data table.
887         3. If the author has provided a valid aria-rowindex on the row element, expose
888            it as a data table.
889         4. If the author has provided a value for aria-colspan or aria-rowspan on a cell,
890            expose it as a data table (even though we are supposed to ignore the value for
891            the purpose of exposing the span via platform accessibility APIs)
892
893         Remove the heuristic that a table with only one cell is "not a good AXTable candidate."
894         It prevents us from ever doing the above checks.
895
896         Test: accessibility/minimal-table-with-aria-is-data-table.html
897
898         * accessibility/AccessibilityTable.cpp:
899         (WebCore::AccessibilityTable::isDataTable):
900
901 2017-05-03  Carlos Garcia Campos  <cgarcia@igalia.com>
902
903         [Cairo] Handle extended colors in gradients
904         https://bugs.webkit.org/show_bug.cgi?id=171596
905
906         Reviewed by Michael Catanzaro.
907
908         Check if every gradient color step is an extended color and use asExtended() instead of getRGBA() in such case.
909
910         Fixes: css3/color/gradients.html
911
912         * platform/graphics/cairo/GradientCairo.cpp:
913         (WebCore::Gradient::platformGradient):
914
915 2017-05-03  Daniel Bates  <dabates@apple.com>
916
917         Abandon the current load once the provisional loader detaches from the frame
918         https://bugs.webkit.org/show_bug.cgi?id=171577
919         <rdar://problem/31581227>
920
921         Reviewed by Brent Fulgham and Brady Eidson.
922
923         We detach all child frames as part of setting our document loader to the provisional
924         document loader when committing a load for a frame. Detaching child frames invokes
925         the unload event handler on the child frames that can run arbitrary JavaScript script.
926         Among other things, such script can initiate a new load in the frame whose current
927         load is being committed. We should stop processing the current load as soon as we
928         detect that updating our document loader has started a new provisional load.
929
930         Test: fast/loader/inner-iframe-loads-data-url-into-parent-on-unload-crash.html
931
932         * loader/FrameLoader.cpp:
933         (WebCore::FrameLoader::transitionToCommitted):
934
935 2017-05-03  Daniel Bates  <dabates@apple.com>
936
937         Cleanup: Remove out-of-date comment and null check from DocumentLoader::detachFromFrame()
938         https://bugs.webkit.org/show_bug.cgi?id=171604
939
940         Reviewed by Brady Eidson.
941
942         We no longer want to passively allow DocumentLoader::detachFromFrame() to be called twice.
943         It does not make sense to be called twice and should never be called twice. A release assert
944         in DocumentLoader::cancelPolicyCheckIfNeeded() (added in r187558) called by DocumentLoader::detachFromFrame()
945         enforces this invariant. Therefore we can remove the null check of DocumentLoader::m_frame
946         and the comment that explains the purpose of this null check from DocumentLoader::detachFromFrame().
947
948         * loader/DocumentLoader.cpp:
949         (WebCore::DocumentLoader::detachFromFrame):
950
951 2017-05-03  Ryan Haddad  <ryanhaddad@apple.com>
952
953         Unreviewed attempt to fix the Windows build after r216117.
954         https://bugs.webkit.org/show_bug.cgi?id=171601
955
956         * css/CSSAllInOne.cpp:
957
958 2017-05-03  Antti Koivisto  <antti@apple.com>
959
960         Rename StyleInvalidationAnalysis to Style::Invalidator
961         https://bugs.webkit.org/show_bug.cgi?id=171601
962
963         Reviewed by Žan Doberšek.
964
965         Also move it to the 'style' directory.
966
967         * CMakeLists.txt:
968         * WebCore.xcodeproj/project.pbxproj:
969         * css/StyleInvalidationAnalysis.cpp: Removed.
970         * css/StyleInvalidationAnalysis.h: Removed.
971         * dom/ExtensionStyleSheets.cpp:
972         * style/AttributeChangeInvalidation.cpp:
973         (WebCore::Style::AttributeChangeInvalidation::invalidateDescendants):
974         * style/ClassChangeInvalidation.cpp:
975         (WebCore::Style::ClassChangeInvalidation::invalidateDescendantStyle):
976         * style/StyleInvalidator.cpp: Copied from Source/WebCore/css/StyleInvalidationAnalysis.cpp.
977         (WebCore::Style::Invalidator::Invalidator):
978         (WebCore::Style::Invalidator::invalidateIfNeeded):
979         (WebCore::Style::Invalidator::invalidateStyleForTree):
980         (WebCore::Style::Invalidator::invalidateStyle):
981         (WebCore::shouldDirtyAllStyle): Deleted.
982         (WebCore::StyleInvalidationAnalysis::StyleInvalidationAnalysis): Deleted.
983         (WebCore::StyleInvalidationAnalysis::invalidateIfNeeded): Deleted.
984         (WebCore::StyleInvalidationAnalysis::invalidateStyleForTree): Deleted.
985         (WebCore::StyleInvalidationAnalysis::invalidateStyle): Deleted.
986         * style/StyleInvalidator.h: Copied from Source/WebCore/css/StyleInvalidationAnalysis.h.
987         (WebCore::StyleInvalidationAnalysis::dirtiesAllStyle): Deleted.
988         (WebCore::StyleInvalidationAnalysis::hasShadowPseudoElementRulesInAuthorSheet): Deleted.
989         * style/StyleScope.cpp:
990         (WebCore::Style::Scope::resolver):
991         (WebCore::Style::Scope::analyzeStyleSheetChange):
992
993 2017-05-02  Andrew Gold  <agold@apple.com>
994
995         Typo in AVAudioSessionCaptureDeviceManager.mm
996         https://bugs.webkit.org/show_bug.cgi?id=171572
997
998         Reviewed by Jer Noble.
999
1000         We attempt to call +[AVAudioSession sharedSession], but the actual method is 
1001         called +[AVAudioSession sharedInstance].
1002
1003         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
1004         (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices):
1005
1006 2017-05-02  Simon Fraser  <simon.fraser@apple.com>
1007
1008         Improve scrolling tree logging
1009         https://bugs.webkit.org/show_bug.cgi?id=171574
1010
1011         Reviewed by Tim Horton.
1012
1013         Make a call to showScrollingStateTree() print debugging-related information like node and layer IDs.
1014         Required fixing scrolling state tree nodes to respect ScrollingStateTreeAsTextBehavior, and fixing
1015         fixed and sticky nodes to call super.
1016
1017         Also enhance compositing logging to show layer IDs, and to log for layer scrolling tree registration.
1018
1019         * page/scrolling/AsyncScrollingCoordinator.cpp:
1020         (WebCore::AsyncScrollingCoordinator::scrollingStateTreeAsText):
1021         * page/scrolling/AsyncScrollingCoordinator.h:
1022         * page/scrolling/ScrollingCoordinator.cpp:
1023         (WebCore::ScrollingCoordinator::scrollingStateTreeAsText):
1024         * page/scrolling/ScrollingCoordinator.h:
1025         * page/scrolling/ScrollingStateFixedNode.cpp:
1026         (WebCore::ScrollingStateFixedNode::dumpProperties):
1027         * page/scrolling/ScrollingStateNode.cpp:
1028         (WebCore::ScrollingStateNode::dumpProperties):
1029         (WebCore::ScrollingStateNode::scrollingStateTreeAsText):
1030         * page/scrolling/ScrollingStateNode.h:
1031         * page/scrolling/ScrollingStateScrollingNode.cpp:
1032         (WebCore::ScrollingStateScrollingNode::dumpProperties):
1033         * page/scrolling/ScrollingStateStickyNode.cpp:
1034         (WebCore::ScrollingStateStickyNode::dumpProperties):
1035         * page/scrolling/ScrollingStateTree.cpp:
1036         (showScrollingStateTree):
1037         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
1038         (WebCore::ScrollingCoordinatorMac::commitTreeState):
1039         * rendering/RenderLayerBacking.cpp:
1040         (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
1041         * rendering/RenderLayerCompositor.cpp:
1042         (WebCore::RenderLayerCompositor::logLayerInfo):
1043         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
1044
1045 2017-05-02  Daniel Bates  <dabates@apple.com>
1046
1047         Using StringView.split() instead of String.split() in some places
1048         https://bugs.webkit.org/show_bug.cgi?id=170925
1049
1050         Reviewed by Darin Adler and Sam Weinig.
1051
1052         Replace some uses of String.split() with StringView.split() (added in r211087) as the latter
1053         avoids the need to allocate an intermediary Vector of substrings. Instead StringView.split()
1054         returns an iterator for traversing the substrings.
1055
1056         No functionality changed. So, no new tests.
1057
1058         * accessibility/AccessibilityObject.cpp: Convert some typedefs to modern C++ using declarations.
1059         (WebCore::AccessibilityObject::ariaRoleToWebCoreRole): Modified code to use StringView.split().
1060         (WebCore::AccessibilityObject::elementsFromAttribute): Ditto.
1061         * dom/TreeScope.cpp:
1062         (WebCore::TreeScope::getElementById): Added.
1063         * dom/TreeScope.h:
1064         * html/LinkRelAttribute.cpp:
1065         (WebCore::LinkRelAttribute::LinkRelAttribute): Modified code to use StringView.split().
1066         * html/parser/XSSAuditor.cpp:
1067         (WebCore::semicolonSeparatedValueContainsJavaScriptURL): Ditto.
1068         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
1069         (WebCore::CDMPrivateMediaSourceAVFObjC::createSession): Ditto.
1070         * platform/network/CacheValidation.cpp:
1071         (WebCore::collectVaryingRequestHeaders): Simplify code by using the String.split(UChar, Vector<String>&) overload.
1072         * svg/SVGAnimationElement.cpp:
1073         (WebCore::parseKeyTimes): Modified code to use StringView.split().
1074         * svg/SVGToOTFFontConversion.cpp:
1075         (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Ditto.
1076         * testing/Internals.cpp:
1077         (WebCore::Internals::setMediaSessionRestrictions): Ditto.
1078         (WebCore::Internals::setMediaElementRestrictions): Ditto.
1079         (WebCore::Internals::setAudioContextRestrictions): Ditto.
1080         (WebCore::Internals::setPageMuted): Ditto.
1081         * testing/Internals.h:
1082
1083 2017-05-02  Gwang Yoon Hwang  <yoon@igalia.com>
1084
1085         [GTK] Drop coordinated surfaces from the compositing thread as soon as possible
1086         https://bugs.webkit.org/show_bug.cgi?id=171544
1087
1088         Reviewed by Žan Doberšek.
1089
1090         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
1091         Remove atlasesToRemove from the GraphicsState. It is not a commit
1092         state anymore.
1093
1094 2017-05-02  Gwang Yoon Hwang  <yoon@igalia.com>
1095
1096         [GTK] Recycle textures while handling tiles
1097         https://bugs.webkit.org/show_bug.cgi?id=171541
1098
1099         Reviewed by Žan Doberšek.
1100
1101         * platform/graphics/texmap/TextureMapperTile.h:
1102         Modified m_texture as a protected member to avoid unnessary
1103         refcountings from the CoordinatedBackingStore.
1104         * platform/graphics/texmap/coordinated/CoordinatedSurface.h:
1105         Use reference instead of RefPtr to pass BitmapTexture
1106
1107         No new tests since there should be no change in behavior.
1108
1109 2017-05-02  Zalan Bujtas  <zalan@apple.com>
1110
1111         Defer AX cache update when text content changes until after layout is finished.
1112         https://bugs.webkit.org/show_bug.cgi?id=171429
1113         <rdar://problem/31885984>
1114
1115         Reviewed by Simon Fraser.
1116
1117         When the content of the RenderText changes (even as the result of a text-transform change)
1118         instead of updating the AX cache eagerly (and trigger layout on a half-backed render tree)
1119         we should just defer it until after the subsequent layout is done. 
1120
1121         Test: accessibility/crash-while-adding-text-child-with-transform.html
1122
1123         * accessibility/AXObjectCache.cpp:
1124         (WebCore::AXObjectCache::remove):
1125         (WebCore::AXObjectCache::performDeferredCacheUpdate):
1126         (WebCore::AXObjectCache::recomputeDeferredIsIgnored):
1127         (WebCore::AXObjectCache::deferTextChanged):
1128         (WebCore::AXObjectCache::performDeferredIsIgnoredChange): Deleted.
1129         * accessibility/AXObjectCache.h:
1130         (WebCore::AXObjectCache::deferTextChanged):
1131         (WebCore::AXObjectCache::performDeferredCacheUpdate):
1132         (WebCore::AXObjectCache::performDeferredIsIgnoredChange): Deleted.
1133         * page/FrameView.cpp:
1134         (WebCore::FrameView::performPostLayoutTasks):
1135         * rendering/RenderText.cpp:
1136         (WebCore::RenderText::setText):
1137
1138 2017-05-02  Wenson Hsieh  <wenson_hsieh@apple.com>
1139
1140         Remove an extraneous call to dispatch_group_async in WebItemProviderPasteboard.mm
1141         https://bugs.webkit.org/show_bug.cgi?id=171561
1142
1143         Reviewed by Tim Horton.
1144
1145         In -[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:], the lifetime of the dispatch group
1146         `fileLoadingGroup` is already guarded by dispatch_group_enter/leave calls when beginning and concluding an
1147         item provider load, respectively. As such, the call to dispatch_group_async serves no purpose and should be removed.
1148
1149         No new tests, since there is no change in behavior.
1150
1151         * platform/ios/WebItemProviderPasteboard.mm:
1152         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):
1153
1154 2017-05-02  Youenn Fablet  <youenn@apple.com>
1155
1156         [LibWebRTC] Set explicitly logging level in debug mode
1157         https://bugs.webkit.org/show_bug.cgi?id=171562
1158
1159         Reviewed by Eric Carlson.
1160
1161         No change of behavior.
1162
1163         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
1164         (WebCore::initializePeerConnectionFactoryAndThreads): Setting explictly LibWebRTC logging to Info level for
1165         debug builds if WebRTC channel is on.
1166
1167 2017-05-02  Joanmarie Diggs  <jdiggs@igalia.com>
1168
1169         AX: Update implementation of aria-orientation
1170         https://bugs.webkit.org/show_bug.cgi?id=171166
1171
1172         Reviewed by Chris Fleizach.
1173
1174         Update AccessibilityRenderObject::orientation() to be consistent with what is
1175         in the ARIA 1.1 spec. Also add an isTreeGrid() convenience method to be consistent
1176         with what we do for other roles.
1177
1178         Test: accessibility/aria-orientation.html
1179
1180         * accessibility/AccessibilityARIAGridRow.cpp:
1181         (WebCore::AccessibilityARIAGridRow::isARIATreeGridRow):
1182         * accessibility/AccessibilityObject.h:
1183         (WebCore::AccessibilityObject::isTreeGrid):
1184         * accessibility/AccessibilityRenderObject.cpp:
1185         (WebCore::AccessibilityRenderObject::orientation):
1186
1187 2017-05-02  Myles C. Maxfield  <mmaxfield@apple.com>
1188
1189         REGRESSION (r211382): Partial right-to-left text runs are painted at an offset (breaks Find indicators, Look Up, and custom ::selection style)
1190         https://bugs.webkit.org/show_bug.cgi?id=169517
1191         <rdar://problem/30652443>
1192
1193         Reviewed by Dean Jackson.
1194
1195         FontCascade::getGlyphsAndAdvancesForComplexText() is tasked with calculating paint advances for a
1196         subrange of RTL text. It does this by creating a ComplexTextController, telling it to iterate to
1197         the beginning of the subrange (outputting to a GlyphBuffer), then telling it to iterate to the end
1198         of the subrange (outputting to another GlyphBuffer). Because the text is RTL, the sum of the
1199         advances gathered so far is the distance from the right edge of the text to the left edge of the
1200         subrange (because we advance in logical order). Therefore, the x-coordinate we are at now is the
1201         total width minus the sum of both of the GlyphBuffers. For some reason, when I wrote this code I
1202         forgot to add in the contribution from the first GlyphBuffer. Unfortunately, this particular
1203         codepath is rarely hit in practice and completely untested, which made me miss it when I wrote it.
1204
1205         Test: fast/text/complex-text-selection.html
1206
1207         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1208         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
1209
1210 2017-05-02  Chris Dumez  <cdumez@apple.com>
1211
1212         [macOS] Flaky Crash under EventTarget::fireEventListeners on imported/blink/paint/deprecatedpaintlayer/non-self-painting-layer-overrides-visibility.html
1213         https://bugs.webkit.org/show_bug.cgi?id=171406
1214         <rdar://problem/30945281>
1215
1216         Reviewed by Eric Carlson.
1217
1218         I was unfortunately unable to reproduce the flaky crash locally. However, the crash trace
1219         indicates that one of the EventTarget::scriptExecutionContext() overrides is returning a
1220         stale ScriptExecutionContext pointer. Since a GenericEventQueue is involved, the EventTarget
1221         is likely a media-related object. I therefore audited media classes that override
1222         EventTarget::scriptExecutionContext() and found several that look unsafe. I am fixing those
1223         by having them override ContextDestructionObserver, instead of having a raw
1224         ScriptExecutionContext pointer member. This makes sure the pointer gets nulled out whenever
1225         the scriptexecutioncontext gets destroyed, ensuring that those classes's
1226         EventTarget::scriptExecutionContext() overrides can never return a stale pointer.
1227
1228         * Modules/mediasource/SourceBufferList.cpp:
1229         (WebCore::SourceBufferList::SourceBufferList):
1230         * Modules/mediasource/SourceBufferList.h:
1231         * html/track/TextTrack.cpp:
1232         (WebCore::TextTrack::TextTrack):
1233         * html/track/TextTrack.h:
1234         * html/track/TrackListBase.cpp:
1235         (TrackListBase::TrackListBase):
1236         * html/track/TrackListBase.h:
1237
1238 2017-05-02  Antti Koivisto  <antti@apple.com>
1239
1240         Document style resolvers should share user rulesets
1241         https://bugs.webkit.org/show_bug.cgi?id=171549
1242
1243         Reviewed by Andreas Kling.
1244
1245         Large user stylesheets (like those used by ad blockers) can end up using lots of memory if
1246         a document uses large number of shadow trees. User style is inherently per-document and
1247         the resulting rulesets can be shared between the document and the shadow trees.
1248
1249         * css/DocumentRuleSets.cpp:
1250         (WebCore::DocumentRuleSets::DocumentRuleSets):
1251         (WebCore::DocumentRuleSets::userStyle):
1252
1253             Return per-document user style for shadow trees.
1254
1255         (WebCore::DocumentRuleSets::collectFeatures):
1256         * css/DocumentRuleSets.h:
1257         (WebCore::DocumentRuleSets::setUsesSharedUserStyle):
1258         (WebCore::DocumentRuleSets::userStyle): Deleted.
1259         * css/StyleResolver.cpp:
1260         (WebCore::StyleResolver::StyleResolver):
1261         (WebCore::StyleResolver::initializeUserStyle):
1262
1263             Separate user style initialization from construction.
1264
1265         * css/StyleResolver.h:
1266         * style/StyleScope.cpp:
1267         (WebCore::Style::Scope::resolver):
1268
1269             Don't initialize user style for user agents shadow trees.
1270
1271 2017-05-02  Myles C. Maxfield  <mmaxfield@apple.com>
1272
1273         Font Loading API specifies font is loaded but sizing of font after load reports inconsistent values
1274         https://bugs.webkit.org/show_bug.cgi?id=168533
1275
1276         Reviewed by Zalan Bujtas.
1277
1278         Previously, we were marking all local() fonts as immediately successful,
1279         regardless of whether or not they were present on the system. Instead, we
1280         should use the load() function to make this determination and mark the font
1281         as failed if it doesn't exist. (This is, after all, the whole point of the
1282         load() function). This brings us in-line with Firefox's and Chrome's
1283         behavior.
1284
1285         Test: fast/text/font-loading-local.html
1286
1287         * css/CSSFontFace.cpp:
1288         (WebCore::CSSFontFace::pump): Remote loading requires the FontSelector,
1289         but it isn't available for local fonts. Now that load() is called for both
1290         local and remote fonts, the ASSERT() should be lowered into the load()
1291         function and scoped to just the case where we have a remote font.
1292         (WebCore::CSSFontFace::font): Ditto.
1293         * css/CSSFontFaceSource.cpp:
1294         (WebCore::CSSFontFaceSource::CSSFontFaceSource): Don't immediatley set
1295         the success/failure state for local fonts.
1296         (WebCore::CSSFontFaceSource::load): Move loading logic from font() to
1297         load(). None of this code is new; it just is moved.
1298         (WebCore::CSSFontFaceSource::font): Delete code moved to load().
1299         * css/CSSFontFaceSource.h:
1300         * css/FontFace.cpp:
1301         (WebCore::FontFace::create):
1302
1303 2017-05-02  Youenn Fablet  <youenn@apple.com>
1304
1305         Allow media stream based videos with sound to autoplay if the page is already playing sound
1306         https://bugs.webkit.org/show_bug.cgi?id=171447
1307
1308         Reviewed by Eric Carlson.
1309
1310         Test: http/tests/media/autoplay-if-audio-is-playing.html for ensuring non-mediastream based video will not autoplay.
1311         Manual testing for the autoplay of media stream based videos since such a test should happen without using getUserMedia.
1312
1313         * html/MediaElementSession.cpp:
1314         (WebCore::MediaElementSession::playbackPermitted):
1315
1316 2017-05-02  Chris Dumez  <cdumez@apple.com>
1317
1318         Use PassRefPtr less in editing code
1319         https://bugs.webkit.org/show_bug.cgi?id=171534
1320
1321         Reviewed by Geoffrey Garen.
1322
1323         Use PassRefPtr less in editing code.
1324
1325         * editing/AppendNodeCommand.cpp:
1326         (WebCore::AppendNodeCommand::AppendNodeCommand):
1327         (WebCore::AppendNodeCommand::getNodesInCommand):
1328         * editing/AppendNodeCommand.h:
1329         (WebCore::AppendNodeCommand::create):
1330         * editing/ApplyStyleCommand.cpp:
1331         (WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
1332         (WebCore::ApplyStyleCommand::positionToComputeInlineStyleChange):
1333         * editing/BreakBlockquoteCommand.cpp:
1334         (WebCore::BreakBlockquoteCommand::doApply):
1335         * editing/CompositeEditCommand.cpp:
1336         (WebCore::CompositeEditCommand::insertNodeBefore):
1337         (WebCore::CompositeEditCommand::insertNodeAfter):
1338         (WebCore::CompositeEditCommand::insertNodeAt):
1339         (WebCore::CompositeEditCommand::appendNode):
1340         (WebCore::CompositeEditCommand::moveRemainingSiblingsToNewParent):
1341         (WebCore::CompositeEditCommand::mergeIdenticalElements):
1342         (WebCore::CompositeEditCommand::insertNodeAtTabSpanPosition):
1343         (WebCore::CompositeEditCommand::appendBlockPlaceholder):
1344         (WebCore::CompositeEditCommand::insertBlockPlaceholder):
1345         (WebCore::CompositeEditCommand::addBlockPlaceholderIfNeeded):
1346         (WebCore::CompositeEditCommand::insertNewDefaultParagraphElementAt):
1347         (WebCore::CompositeEditCommand::cloneParagraphUnderNewElement):
1348         (WebCore::CompositeEditCommand::moveParagraphs):
1349         * editing/CompositeEditCommand.h:
1350         * editing/CreateLinkCommand.cpp:
1351         (WebCore::CreateLinkCommand::doApply):
1352         * editing/DeleteSelectionCommand.cpp:
1353         (WebCore::DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss):
1354         (WebCore::DeleteSelectionCommand::mergeParagraphs):
1355         * editing/FormatBlockCommand.cpp:
1356         (WebCore::FormatBlockCommand::formatRange):
1357         * editing/IndentOutdentCommand.cpp:
1358         (WebCore::IndentOutdentCommand::tryIndentingAsListItem):
1359         (WebCore::IndentOutdentCommand::indentIntoBlockquote):
1360         (WebCore::IndentOutdentCommand::outdentParagraph):
1361         * editing/InsertLineBreakCommand.cpp:
1362         (WebCore::InsertLineBreakCommand::doApply):
1363         * editing/InsertLineBreakCommand.h:
1364         * editing/InsertListCommand.cpp:
1365         (WebCore::InsertListCommand::fixOrphanedListChild):
1366         (WebCore::InsertListCommand::doApplyForSingleParagraph):
1367         (WebCore::InsertListCommand::unlistifyParagraph):
1368         (WebCore::InsertListCommand::listifyParagraph):
1369         * editing/InsertListCommand.h:
1370         * editing/InsertNodeBeforeCommand.cpp:
1371         (WebCore::InsertNodeBeforeCommand::InsertNodeBeforeCommand):
1372         (WebCore::InsertNodeBeforeCommand::doApply):
1373         (WebCore::InsertNodeBeforeCommand::doUnapply):
1374         (WebCore::InsertNodeBeforeCommand::getNodesInCommand):
1375         * editing/InsertNodeBeforeCommand.h:
1376         (WebCore::InsertNodeBeforeCommand::create):
1377         * editing/InsertParagraphSeparatorCommand.cpp:
1378         (WebCore::InsertParagraphSeparatorCommand::cloneHierarchyUnderNewBlock):
1379         (WebCore::InsertParagraphSeparatorCommand::doApply):
1380         * editing/InsertParagraphSeparatorCommand.h:
1381         * editing/InsertTextCommand.cpp:
1382         (WebCore::InsertTextCommand::positionInsideTextNode):
1383         (WebCore::InsertTextCommand::insertTab):
1384         * editing/ModifySelectionListLevel.cpp:
1385         (WebCore::ModifySelectionListLevelCommand::insertSiblingNodeRangeBefore):
1386         (WebCore::ModifySelectionListLevelCommand::insertSiblingNodeRangeAfter):
1387         (WebCore::ModifySelectionListLevelCommand::appendSiblingNodeRange):
1388         (WebCore::IncreaseSelectionListLevelCommand::doApply):
1389         * editing/RemoveNodePreservingChildrenCommand.cpp:
1390         (WebCore::RemoveNodePreservingChildrenCommand::doApply):
1391         * editing/ReplaceSelectionCommand.cpp:
1392         (WebCore::ReplaceSelectionCommand::moveNodeOutOfAncestor):
1393         (WebCore::ReplaceSelectionCommand::mergeEndIfNeeded):
1394         (WebCore::ReplaceSelectionCommand::doApply):
1395         (WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace):
1396         (WebCore::ReplaceSelectionCommand::insertAsListItems):
1397         * editing/SimplifyMarkupCommand.cpp:
1398         (WebCore::SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove):
1399
1400 2017-05-02  Ben Kelly <ben@wanderview.com>
1401
1402         Set Response.blob() type correctly when body is a ReadableStream.
1403         https://bugs.webkit.org/show_bug.cgi?id=171489
1404
1405         Reviewed by Youenn Fablet
1406
1407         The Fetch API specification requires setting the blob contentType
1408         using the Content-Type header value, if present.  Currently WebKit
1409         only sets the type on the FetchBodyConsumer when FetchBody::blob()
1410         is called.  Unfortunately, this is never called if the body is
1411         actually a ReadableStream.
1412
1413         This change allows WebKit to pass the "Consume response's body: from
1414         stream to blob" case in the WPT response-consume.html test.
1415
1416         Test: http://w3c-test.org/fetch/api/response/response-consume.html
1417
1418         * Modules/fetch/FetchResponse.cpp:
1419         (WebCore::FetchResponse::startConsumingStream): Modified to call
1420         FetchBodyConsumer::setContentType() before processing the stream.
1421
1422 2017-05-02  Ryan Haddad  <ryanhaddad@apple.com>
1423
1424         Unreviewed, rolling out r216069.
1425
1426         This change broke the build.
1427
1428         Reverted changeset:
1429
1430         "Document style resolvers should share user rulesets"
1431         https://bugs.webkit.org/show_bug.cgi?id=171549
1432         http://trac.webkit.org/changeset/216069
1433
1434 2017-05-02  Antti Koivisto  <antti@apple.com>
1435
1436         Document style resolvers should share user rulesets
1437         https://bugs.webkit.org/show_bug.cgi?id=171549
1438
1439         Reviewed by Andreas Kling.
1440
1441         Large user stylesheets (like those used by ad blockers) can end up using lots of memory if
1442         a document uses large number of shadow trees. User style is inherently per-document and
1443         the resulting rulesets can be shared between the document and the shadow trees.
1444
1445         * css/DocumentRuleSets.cpp:
1446         (WebCore::DocumentRuleSets::DocumentRuleSets):
1447         (WebCore::DocumentRuleSets::userStyle):
1448
1449             Return per-document user style for shadow trees.
1450
1451         (WebCore::DocumentRuleSets::collectFeatures):
1452         * css/DocumentRuleSets.h:
1453         (WebCore::DocumentRuleSets::setUsesSharedUserStyle):
1454         (WebCore::DocumentRuleSets::userStyle): Deleted.
1455         * css/StyleResolver.cpp:
1456         (WebCore::StyleResolver::StyleResolver):
1457         (WebCore::StyleResolver::initializeUserStyle):
1458
1459             Separate user style initialization from construction.
1460
1461         * css/StyleResolver.h:
1462         * style/StyleScope.cpp:
1463         (WebCore::Style::Scope::resolver):
1464
1465             Don't initialize user style for user agents shadow trees.
1466
1467 2017-05-02  Gwang Yoon Hwang  <yoon@igalia.com>
1468
1469         [GTK] Remove undefined nativeImage method from the ImageBuffer's header
1470         https://bugs.webkit.org/show_bug.cgi?id=171502
1471
1472         Unreviewed, remove a dead code accidentally committed in r194630.
1473
1474         * platform/graphics/ImageBuffer.h: Remove nativeImage method.
1475         It is accidentally added during a refectorying at r194630, and there is
1476         no definition for this method.
1477
1478 2017-05-02  Carlos Garcia Campos  <cgarcia@igalia.com>
1479
1480         [GStreamer] Dailymotion live stream videos don't play
1481         https://bugs.webkit.org/show_bug.cgi?id=170767
1482
1483         Reviewed by Sergio Villar Senin.
1484
1485         The video shows a message saying that an error occurred and nothing is played. There are actually several
1486         problems with dailymotion. The main issue is that URLs are redirected by the server, and GStreamer needs to
1487         know the redirected URL. Once GStreamer knows the redirected URL the error message no longer appears, the video
1488         starts but it always stops after a few seconds. This is because the source receives an early EOS while still
1489         downloading the fragments. The reason of the early EOS is because dailymotion sends a wrong Content-Length header,
1490         something that is expected to happen and we correctly handle that case when receiving the data, by updating the
1491         size accordingly if the bytes received are longer than the expected content length. This particular case
1492         doesn't work well with GStreamer automatic EOS handling, which is the default. At some point, GStreamer detects
1493         that the bytes received are at least the expected ones and emits a GST_EVENT_EOS that the GstUriDownloader
1494         handles finishing the download early. We should always disable automatic EOS, since we know when EOS actually
1495         happens and we already call gst_app_src_end_of_stream(). This patch also emits a GST_EVENT_CUSTOM_DOWNSTREAM_STICKY
1496         event to let GStreamer know about the HTTP headers sent and received.
1497
1498         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1499         (webkit_web_src_init): Disable automatic EOS.
1500         (webKitWebSrcGetProperty): Return the redirected URL in case of redirection.
1501         (webKitWebSrcStart): Pass the ResourceRequest to the stream clients.
1502         (webKitWebSrcQueryWithParent): Set the redirected URL in the query in case of redirection.
1503         (webKitWebSrcSetUri): Clear also the redirected URL when setting a new URI.
1504         (StreamingClient::StreamingClient): Use GRefPtr for the source and initialize the request too.
1505         (StreamingClient::~StreamingClient): Remove explicit unref.
1506         (StreamingClient::createReadBuffer):
1507         (StreamingClient::handleResponseReceived): Initialize the redirected URL in case of redirection. Create and push
1508         the HTTP headers event.
1509         (StreamingClient::handleDataReceived):
1510         (StreamingClient::handleNotifyFinished):
1511         (CachedResourceStreamingClient::CachedResourceStreamingClient):
1512         (CachedResourceStreamingClient::responseReceived):
1513         (CachedResourceStreamingClient::accessControlCheckFailed):
1514         (CachedResourceStreamingClient::loadFailed):
1515         (ResourceHandleStreamingClient::ResourceHandleStreamingClient):
1516         (ResourceHandleStreamingClient::didFail):
1517         (ResourceHandleStreamingClient::wasBlocked):
1518         (ResourceHandleStreamingClient::cannotShowURL):
1519
1520 2017-05-02  Youenn Fablet  <youenn@apple.com>
1521
1522         Adding logging to RTCPeerConnection to allow WebRTC application debugging
1523         https://bugs.webkit.org/show_bug.cgi?id=171531
1524
1525         Reviewed by Jon Lee.
1526
1527         No change of behavior.
1528         This allows easier debugging of webrtc-enabled web pages.
1529
1530         * Modules/mediastream/PeerConnectionBackend.cpp:
1531         (WebCore::PeerConnectionBackend::createOfferSucceeded):
1532         (WebCore::PeerConnectionBackend::createOfferFailed):
1533         (WebCore::PeerConnectionBackend::createAnswerSucceeded):
1534         (WebCore::PeerConnectionBackend::createAnswerFailed):
1535         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
1536         (WebCore::PeerConnectionBackend::setLocalDescriptionFailed):
1537         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
1538         (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
1539         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
1540         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
1541         (WebCore::PeerConnectionBackend::newICECandidate):
1542         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
1543         * Modules/mediastream/RTCPeerConnection.cpp:
1544         (WebCore::RTCPeerConnection::queuedCreateOffer):
1545         (WebCore::RTCPeerConnection::queuedCreateAnswer):
1546         (WebCore::RTCPeerConnection::queuedSetLocalDescription):
1547         (WebCore::RTCPeerConnection::queuedSetRemoteDescription):
1548         (WebCore::RTCPeerConnection::queuedAddIceCandidate):
1549
1550 2017-04-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1551
1552         [GTK] Crash at WebCore::ResourceHandle::clearClient() when streaming live video from dailymotion
1553         https://bugs.webkit.org/show_bug.cgi?id=169725
1554
1555         Reviewed by Michael Catanzaro.
1556
1557         Make ResourceHandleStreamingClient refcounted and add an invalidate method to do the cleanup in the networking
1558         thread while keeping a reference.
1559
1560         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1561         (webKitWebSrcStop): Call invalidate before reseting client pointer.
1562         (webKitWebSrcStart): Ditto.
1563         (ResourceHandleStreamingClient::ResourceHandleStreamingClient): Remove all cleanup code after the run loop run call.
1564         (ResourceHandleStreamingClient::~ResourceHandleStreamingClient): Just detach the thread.
1565         (ResourceHandleStreamingClient::invalidate): Schedule a task on the networking thread to clean up and fiish the
1566         run loop, protecting this.
1567         (ResourceHandleStreamingClient::setDefersLoading): Protect this.
1568         (ResourceHandleStreamingClient::didReceiveResponse): Do nothing if client was invalidated.
1569         (ResourceHandleStreamingClient::didReceiveBuffer): Ditto.
1570         (ResourceHandleStreamingClient::didFinishLoading): Ditto.
1571
1572 2017-05-01  Zan Dobersek  <zdobersek@igalia.com>
1573
1574         [GCrypt] ECDSA signing and verification support
1575         https://bugs.webkit.org/show_bug.cgi?id=171103
1576
1577         Reviewed by Carlos Garcia Campos.
1578
1579         Implement WebCrypto ECDSA support for configurations that
1580         are using libgcrypt.
1581
1582         For signing, the provided data is first hashed with the specified
1583         digest algorithm and embedded into a data s-expression. It's then
1584         passed to gcry_pk_sign() along with the private key, returning a
1585         sig-val s-expression. The r and s parameters are then retrieved from
1586         that sig-val and their data extracted and concatenated in the output
1587         Vector<>.
1588
1589         For verification, the data is again hashed and embedded into a data
1590         s-expression. The r and s parameters are extracted from the passed-in
1591         signature Vector<> and embedded into a sig-val s-expression. The data
1592         and sig-val s-expressions are then passed to gcry_pk_verify() along
1593         with the public key. The verification succeeds if no error is returned
1594         and fails if the returned error code is GPG_ERR_BAD_SIGNATURE.
1595
1596         * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
1597         (WebCore::hashCryptoDigestAlgorithm):
1598         (WebCore::hashAlgorithmName):
1599         (WebCore::mpiData):
1600         (WebCore::gcryptSign):
1601         (WebCore::gcryptVerify):
1602         (WebCore::CryptoAlgorithmECDSA::platformSign):
1603         (WebCore::CryptoAlgorithmECDSA::platformVerify):
1604
1605 2017-05-01  Zan Dobersek  <zdobersek@igalia.com>
1606
1607         [GCrypt] HKDF bit derivation support
1608         https://bugs.webkit.org/show_bug.cgi?id=171074
1609
1610         Reviewed by Michael Catanzaro.
1611
1612         Implement bit derivation support for the HKDF algorithm for configurations
1613         that use libgcrypt.
1614
1615         libgcrypt doesn't provide HKDF support out of the box, so we have to
1616         implement the two steps manually. In the first one, we retrieve the
1617         pseudo-random key by using the specified MAC algorithm with the salt data
1618         as the key and the key data as the input keying material.
1619
1620         In the expand step, we do the required amount of iterations to derive
1621         a sufficient amount of data, using the same MAC algorithm with the
1622         pseudo-random key from the previous step on the data we compose from the
1623         previous block data, the info data, and the current iteration value. The
1624         resulting blocks are appended together until they can be clipped to the
1625         desired output length.
1626
1627         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
1628         (WebCore::macAlgorithmForHashFunction):
1629         (WebCore::gcryptDeriveBits):
1630         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
1631
1632 2017-05-01  Zan Dobersek  <zdobersek@igalia.com>
1633
1634         [GCrypt] ECDH bit derivation support
1635         https://bugs.webkit.org/show_bug.cgi?id=171070
1636
1637         Reviewed by Michael Catanzaro.
1638
1639         Implement bit derivation support for the ECDH algorithm for configurations
1640         that use libgcrypt.
1641
1642         This is done by retrieving the private key data and wrapping it in a new
1643         data s-expression. That's then encrypted with the public key, and the
1644         returned s-expression contains the shared point data. That data is then
1645         decoded into an EC point, from which the x-coordinate is retrieved. This
1646         coordinate data is finally our bit derivation result.
1647
1648         * crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp:
1649         (WebCore::gcryptDerive):
1650         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
1651
1652 2017-05-01  Youenn Fablet  <youenn@apple.com>
1653
1654         Ensure RealtimeOutgoingVideoSource sends a black frame when its related source is muted
1655         https://bugs.webkit.org/show_bug.cgi?id=171497
1656
1657         Reviewed by Eric Carlson.
1658
1659         Covered by updated test.
1660
1661         When the track is being muted or disabled, send a black frame explicitly.
1662         VideoToolBox sometimes does not output a frame until it receives the other.
1663         That is why we end up sending two frames, the second asynchronously so that libwebrtc will not skip it.
1664         Also storing the rotation so that we keep the same rotation for black frames.
1665         Storing width and height for consistency as well.
1666
1667         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1668         (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
1669         (WebCore::RealtimeOutgoingVideoSource::setSource):
1670         (WebCore::RealtimeOutgoingVideoSource::stop):
1671         (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
1672         (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
1673         (WebCore::RealtimeOutgoingVideoSource::setSizeFromSource):
1674         (WebCore::RealtimeOutgoingVideoSource::sendBlackFrame):
1675         (WebCore::RealtimeOutgoingVideoSource::sendFrame):
1676         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
1677         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1678
1679 2017-05-01  Joseph Pecoraro  <pecoraro@apple.com>
1680
1681         Simplify Resource Timing handling of cached resource
1682         https://bugs.webkit.org/show_bug.cgi?id=171526
1683
1684         Reviewed by Youenn Fablet.
1685
1686         * loader/DocumentThreadableLoader.cpp:
1687         (WebCore::DocumentThreadableLoader::loadRequest):
1688         * loader/SubresourceLoader.cpp:
1689         (WebCore::SubresourceLoader::init):
1690         (WebCore::SubresourceLoader::reportResourceTiming):
1691         Use auto in ResourceTiming construction.
1692         Eliminate an outdated comment.
1693
1694         * loader/cache/CachedResourceLoader.cpp:
1695         (WebCore::CachedResourceLoader::requestResource):
1696         We can avoid the checks around the request.origin. It should already
1697         be the cases we were checking and asserting because of login in
1698         CachedResourceLoader::prepareFetch.
1699
1700 2017-05-01  Ryan Haddad  <ryanhaddad@apple.com>
1701
1702         Unreviewed, rolling out r216024.
1703
1704         This change caused ios-simulator LayoutTests to exit early
1705         with assertion failures.
1706
1707         Reverted changeset:
1708
1709         "Add audio device change notifications to AudioSession."
1710         https://bugs.webkit.org/show_bug.cgi?id=171403
1711         http://trac.webkit.org/changeset/216024
1712
1713 2017-05-01  Timothy Horton  <timothy_horton@apple.com>
1714
1715         Expose viewport-fit instead of clip-to-safe-area
1716         https://bugs.webkit.org/show_bug.cgi?id=171503
1717         <rdar://problem/31918249>
1718
1719         Reviewed by Simon Fraser.
1720
1721         Tests: fast/viewport/ios/viewport-fit-auto.html
1722                fast/viewport/ios/viewport-fit-contain.html
1723                fast/viewport/ios/viewport-fit-cover.html
1724
1725         * dom/ConstantPropertyMap.cpp:
1726         (WebCore::ConstantPropertyMap::buildValues):
1727         (WebCore::ConstantPropertyMap::updateConstantsForUnobscuredSafeAreaInsets):
1728         (WebCore::ConstantPropertyMap::didChangeSafeAreaInsets):
1729         (WebCore::ConstantPropertyMap::updateConstantsForObscuredInsets): Deleted.
1730         (WebCore::ConstantPropertyMap::didChangeObscuredInsets): Deleted.
1731         * dom/ConstantPropertyMap.h:
1732         Retrieve the safe area insets from page, instead of assuming that we should
1733         just expose the entire obscured inset. Also, do some renames.
1734
1735         * dom/ViewportArguments.cpp:
1736         (WebCore::ViewportArguments::resolve):
1737         (WebCore::parseViewportFitValue):
1738         (WebCore::setViewportFeature):
1739         * dom/ViewportArguments.h:
1740         (WebCore::ViewportArguments::operator==):
1741         * page/ChromeClient.h:
1742         * page/FrameView.cpp:
1743         (WebCore::FrameView::enableSpeculativeTilingIfNeeded):
1744         (WebCore::FrameView::calculateExtendedBackgroundMode):
1745         (WebCore::FrameView::setClipToSafeArea): Deleted.
1746         * page/FrameView.h:
1747         * page/ViewportConfiguration.cpp:
1748         (WebCore::ViewportConfiguration::updateConfiguration):
1749         (WebCore::operator<<):
1750         (WebCore::ViewportConfiguration::description):
1751         (WebCore::ViewportConfiguration::dump):
1752         * page/ViewportConfiguration.h:
1753         (WebCore::ViewportConfiguration::avoidsUnsafeArea):
1754         (WebCore::ViewportConfiguration::Parameters::Parameters):
1755         (WebCore::ViewportConfiguration::clipToSafeArea): Deleted.
1756         * rendering/RenderLayerCompositor.cpp:
1757         (WebCore::RenderLayerCompositor::updateRootContentLayerClipping):
1758         * rendering/RenderObject.cpp:
1759         (WebCore::RenderObject::repaintUsingContainer):
1760         Un-do changes to support clip-to-safe-area, and instead implement
1761         a new viewport-fit argument in the viewport meta tag, which takes
1762         "auto", "contain", and "cover". "auto" and "contain" cause web content
1763         to lay out excluding the safe area inset from the layout size, while
1764         "cover" causes web content to expand into the unsafe area.
1765
1766         * page/Page.cpp:
1767         (WebCore::Page::setUnobscuredSafeAreaInsets):
1768         (WebCore::Page::setObscuredInsets): Deleted.
1769         * page/Page.h:
1770         (WebCore::Page::setObscuredInsets):
1771         (WebCore::Page::unobscuredSafeAreaInsets):
1772         Keep safe area and obscured insets separately.
1773
1774 2017-05-01  Chris Dumez  <cdumez@apple.com>
1775
1776         Documents created using DOMParser.parseFromString should inherit their context document's origin / URL
1777         https://bugs.webkit.org/show_bug.cgi?id=171499
1778
1779         Reviewed by Sam Weinig.
1780
1781         Documents created using DOMParser.parseFromString should inherit their context document's
1782         origin / URL:
1783         - https://w3c.github.io/DOM-Parsing/#dom-domparser-parsefromstring
1784
1785         Test: fast/dom/domparser-parsefromstring-origin.html
1786
1787         * xml/DOMParser.cpp:
1788         (WebCore::DOMParser::parseFromString):
1789
1790 2017-05-01  Ross Kirsling  <ross.kirsling@sony.com>
1791
1792         Web Inspector: ASSERT(!m_startedComposite) fails when recording on non-Cocoa Timeline
1793         https://bugs.webkit.org/show_bug.cgi?id=171363
1794
1795         Reviewed by Matt Baker.
1796
1797         * page/FrameView.cpp:
1798         (WebCore::FrameView::flushCompositingStateIncludingSubframes): Add PLATFORM(COCOA) guard.
1799
1800 2017-05-01  David Kilzer  <ddkilzer@apple.com>
1801
1802         Stop using strcpy() in fullyQualifiedInfoTableName() from Database.cpp
1803         <https://webkit.org/b/171517>
1804
1805         Reviewed by Brady Eidson.
1806
1807         * Modules/webdatabase/Database.cpp:
1808         (WebCore::fullyQualifiedInfoTableName): Switch from strcpy() to
1809         snprintf().
1810
1811 2017-05-01  Chris Fleizach  <cfleizach@apple.com>
1812
1813         AX: Support time@datetime for verbosity clarification of dates, times, and durations
1814         https://bugs.webkit.org/show_bug.cgi?id=171498
1815         <rdar://problem/12985540>
1816
1817         Reviewed by Joanmarie Diggs.
1818
1819         Expose the datetime attribute value.
1820
1821         Test: accessibility/datetime-attribute.html
1822
1823         * accessibility/AccessibilityObject.cpp:
1824         (WebCore::AccessibilityObject::datetimeAttributeValue):
1825         * accessibility/AccessibilityObject.h:
1826         * accessibility/AccessibilityRenderObject.cpp:
1827         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
1828         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
1829         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1830         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
1831         (-[WebAccessibilityObjectWrapper accessibilityDatetimeValue]):
1832         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1833         (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
1834         (createAccessibilityRoleMap):
1835         (-[WebAccessibilityObjectWrapper subrole]):
1836         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1837
1838 2017-05-01  Joseph Pecoraro  <pecoraro@apple.com>
1839
1840         RejectedPromiseTracker should produce better callstacks and avoid capturing callstacks unless there is a debugger/inspector
1841         https://bugs.webkit.org/show_bug.cgi?id=171416
1842         <rdar://problem/31899425>
1843
1844         Reviewed by Saam Barati and Brian Burg.
1845
1846         Test: inspector/console/message-stack-trace.html
1847
1848         * dom/RejectedPromiseTracker.cpp:
1849         (WebCore::UnhandledPromise::UnhandledPromise):
1850         (WebCore::UnhandledPromise::callStack):
1851         Switch to RefPtr to allow not capturing the stack.
1852
1853         (WebCore::createScriptCallStackFromReason):
1854         Use the VM's lastException if the value in the exception is the
1855         rejected promise value. Using the Exception call stack is important
1856         because uncaught exceptions in promise rejections trigger a built-in
1857         try/catch and re-enter JavaScript before passing the Error through
1858         to the RejectionTracker. When possible, we don't want to capture the
1859         new stack originating from the try/catch. Instead, we want the stack
1860         from before the try/catch when the error was created.
1861
1862         * dom/ScriptExecutionContext.h:
1863         * dom/ScriptExecutionContext.cpp:
1864         (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection):
1865         Switch to a pointer since the stack could be empty.
1866
1867 2017-05-01  Jer Noble  <jer.noble@apple.com>
1868
1869         Unreviewed build fix after r216033.
1870
1871         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1872         (WebCore::CoreAudioCaptureSource::create):
1873
1874 2017-05-01  Jer Noble  <jer.noble@apple.com>
1875
1876         Use AVAudioSession to enumerate audio capture devices on iOS
1877         https://bugs.webkit.org/show_bug.cgi?id=170861
1878         <rdar://problem/31653658>
1879
1880         Reviewed by Eric Carlson.
1881
1882         Hook up the new AVAudioSessionCaptureDeviceManager class to CoreAudioCaptureSource and to the (increasingly ill-named)
1883         RealtimeMediaSourceCenterMac.
1884
1885         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1886         (WebCore::CoreAudioCaptureSource::create):
1887         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1888         (WebCore::RealtimeMediaSourceCenterMac::setUseAVFoundationAudioCapture):
1889
1890 2017-05-01  Joanmarie Diggs  <jdiggs@igalia.com>
1891
1892         [ATK] Expose values of aria-rowcount, aria-colcount, aria-rowindex, aria-colindex, aria-rowspan, and aria-colspan as object attributes
1893         https://bugs.webkit.org/show_bug.cgi?id=171496
1894
1895         Reviewed by Chris Fleizach.
1896
1897         Expose valid, author-provided values as an object attribute. In order to distinguish
1898         author-provided values from the default returned by WebCore Accessibility (1), change
1899         the default return value to -1. We cannot return 0 because the ARIA spec states that
1900         0 is a valid value for authors to provide to indicate that the cell spans the remaining
1901         rows in the row group.
1902
1903         Also removed some legacy code. The "layout-guess" attribute was needed and expected
1904         as a way for AT-SPI2-based assistive technologies to identify layout tables. WebCore
1905         Accessibility does not expose tables which are purely for layout as accessible tables,
1906         and WebKitGtk uses that implementation, thus this attribute is no longer relevant.
1907
1908         No new tests. Unskipped existing test which is now passing.
1909
1910         * accessibility/AccessibilityARIAGridCell.cpp:
1911         (WebCore::AccessibilityARIAGridCell::ariaRowSpanWithRowIndex):
1912         (WebCore::AccessibilityARIAGridCell::columnIndexRange):
1913         * accessibility/AccessibilityTableCell.cpp:
1914         (WebCore::AccessibilityTableCell::ariaColumnSpan):
1915         (WebCore::AccessibilityTableCell::ariaRowSpan):
1916         * accessibility/AccessibilityTableCell.h:
1917         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1918         (webkitAccessibleGetAttributes):
1919
1920 2017-05-01  Jer Noble  <jer.noble@apple.com>
1921
1922         Add audio device change notifications to AudioSession.
1923         https://bugs.webkit.org/show_bug.cgi?id=171403
1924
1925         Reviewed by Eric Carlson.
1926
1927         Add notifications to AudioSession which fire when the current input and output audio devices
1928         change. Also add a notification when audio services are lost (which will only fire on iOS).
1929         Take this opportunity to make the existing hardwareMutedStateDidChange() notification be
1930         platform agnostic, to move the outputDeviceSupportsLowPowerMode() code from AudioHardwareListener,
1931         and to do a few more clean-ups of the AudioSession code.
1932
1933         * WebCore.xcodeproj/project.pbxproj:
1934         * html/HTMLMediaElement.cpp:
1935         (WebCore::HTMLMediaElement::HTMLMediaElement):
1936         (WebCore::HTMLMediaElement::~HTMLMediaElement):
1937         * html/HTMLMediaElement.h:
1938         * platform/audio/AudioSession.cpp:
1939         (WebCore::AudioSession::AudioSession):
1940         * platform/audio/AudioSession.h:
1941         (WebCore::AudioSession::Observer::hardwareMutedStateDidChange):
1942         (WebCore::AudioSession::Observer::audioInputDeviceChanged):
1943         (WebCore::AudioSession::Observer::audioOutputDeviceChanged):
1944         (WebCore::AudioSession::Observer::audioServicesLost):
1945         (WebCore::AudioSession::Observer::audioServicesReset):
1946         (WebCore::AudioSession::MutedStateObserver::~MutedStateObserver): Deleted.
1947         * platform/audio/ios/AudioSessionIOS.mm:
1948         (WebCore::AudioSessionPrivate::AudioSessionPrivate):
1949         (WebCore::AudioSession::AudioSession):
1950         (WebCore::AudioSession::setCategoryOverride):
1951         (WebCore::AudioSession::categoryOverride):
1952         (WebCore::AudioSession::isMuted):
1953         (WebCore::AudioSession::outputDeviceSupportsLowPowerMode):
1954         (WebCore::AudioSession::addObserver):
1955         (WebCore::AudioSession::removeObserver):
1956         * platform/audio/mac/AudioSessionMac.mm: Renamed from Source/WebCore/platform/audio/mac/AudioSessionMac.cpp.
1957         (WebCore::defaultDevice):
1958         (WebCore::AudioSessionPrivate::AudioSessionPrivate):
1959         (WebCore::AudioSession::AudioSession):
1960         (WebCore::AudioSession::~AudioSession):
1961         (WebCore::AudioSession::category):
1962         (WebCore::AudioSession::setCategory):
1963         (WebCore::AudioSession::categoryOverride):
1964         (WebCore::AudioSession::setCategoryOverride):
1965         (WebCore::AudioSession::sampleRate):
1966         (WebCore::AudioSession::bufferSize):
1967         (WebCore::AudioSession::numberOfOutputChannels):
1968         (WebCore::AudioSession::tryToSetActive):
1969         (WebCore::AudioSession::preferredBufferSize):
1970         (WebCore::AudioSession::setPreferredBufferSize):
1971         (WebCore::AudioSession::isMuted):
1972         (WebCore::currentDeviceSupportsLowPowerBufferSize):
1973         (WebCore::AudioSession::outputDeviceSupportsLowPowerMode):
1974         (WebCore::AudioSession::addObserver):
1975         (WebCore::AudioSession::removeObserver):
1976
1977 2017-05-01  Chris Dumez  <cdumez@apple.com>
1978
1979         Do not dispatch SVG load event in frameless documents
1980         https://bugs.webkit.org/show_bug.cgi?id=171505
1981         <rdar://problem/31799776>
1982
1983         Reviewed by Andreas Kling.
1984
1985         We should not dispatch SVG load events in frameless documents. <https://trac.webkit.org/changeset/173028/webkit>
1986         took care of most load events but forgot the SVG load event.
1987
1988         Test: fast/dom/domparser-parsefromstring-svg-load-event.html
1989
1990         * dom/Document.cpp:
1991         (WebCore::Document::implicitClose):
1992
1993 2017-05-01  Chris Dumez  <cdumez@apple.com>
1994
1995         Remove some usage of PassRefPtr in editing code
1996         https://bugs.webkit.org/show_bug.cgi?id=171490
1997
1998         Reviewed by Darin Adler.
1999
2000         Remove some usage of PassRefPtr in editing code.
2001
2002         * dom/DocumentMarkerController.cpp:
2003         (WebCore::DocumentMarkerController::markersInRange):
2004         (DocumentMarkerController::hasMarkers):
2005         (DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange):
2006         * dom/DocumentMarkerController.h:
2007         * editing/AlternativeTextController.cpp:
2008         (WebCore::AlternativeTextController::isSpellingMarkerAllowed):
2009         (WebCore::AlternativeTextController::show):
2010         (WebCore::AlternativeTextController::applyAlternativeTextToRange):
2011         (WebCore::AlternativeTextController::timerFired):
2012         (WebCore::AlternativeTextController::handleAlternativeTextUIResult):
2013         (WebCore::AlternativeTextController::recordAutocorrectionResponse):
2014         (WebCore::AlternativeTextController::markReversed):
2015         (WebCore::AlternativeTextController::markCorrection):
2016         (WebCore::AlternativeTextController::recordSpellcheckerResponseForModifiedCorrection):
2017         (WebCore::AlternativeTextController::processMarkersOnTextToBeReplacedByResult):
2018         (WebCore::AlternativeTextController::applyDictationAlternative):
2019         * editing/AlternativeTextController.h:
2020         (WebCore::AlternativeTextController::UNLESS_ENABLED):
2021         * editing/ApplyStyleCommand.cpp:
2022         (WebCore::createFontElement):
2023         (WebCore::createStyleSpanElement):
2024         (WebCore::ApplyStyleCommand::ApplyStyleCommand):
2025         (WebCore::copyStyleOrCreateEmpty):
2026         (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
2027         (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
2028         (WebCore::ApplyStyleCommand::removeConflictingInlineStyleFromRun):
2029         (WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
2030         (WebCore::ApplyStyleCommand::highestAncestorWithConflictingInlineStyle):
2031         (WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
2032         (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
2033         (WebCore::ApplyStyleCommand::removeInlineStyle):
2034         (WebCore::ApplyStyleCommand::shouldSplitTextElement):
2035         (WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
2036         (WebCore::ApplyStyleCommand::addInlineStyleIfNeeded):
2037         (WebCore::ApplyStyleCommand::positionToComputeInlineStyleChange):
2038         (WebCore::ApplyStyleCommand::applyInlineStyleChange):
2039         * editing/ApplyStyleCommand.h:
2040         (WebCore::ApplyStyleCommand::create):
2041         (WebCore::ApplyStyleCommand::shouldRemoveInlineStyleFromElement):
2042         * editing/CompositeEditCommand.cpp:
2043         (WebCore::CompositeEditCommand::applyCommandToComposite):
2044         (WebCore::CompositeEditCommand::applyStyledElement):
2045         (WebCore::CompositeEditCommand::removeStyledElement):
2046         (WebCore::CompositeEditCommand::replaceElementWithSpanPreservingChildrenAndAttributes):
2047         (WebCore::CompositeEditCommand::inputText):
2048         (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers):
2049         (WebCore::CompositeEditCommand::pushAnchorElementDown):
2050         * editing/CompositeEditCommand.h:
2051         * editing/DeleteSelectionCommand.cpp:
2052         (WebCore::DeleteSelectionCommand::originalStringForAutocorrectionAtBeginningOfSelection):
2053         * editing/DictationCommand.cpp:
2054         (WebCore::DictationCommand::insertTextRunWithoutNewlines):
2055         * editing/EditingStyle.cpp:
2056         (WebCore::copyEditingProperties):
2057         (WebCore::copyPropertiesFromComputedStyle):
2058         (WebCore::extractPropertyValue):
2059         (WebCore::HTMLAttributeEquivalent::attributeValueAsCSSValue):
2060         (WebCore::HTMLFontSizeEquivalent::attributeValueAsCSSValue):
2061         (WebCore::EditingStyle::setStyle):
2062         (WebCore::EditingStyle::copy):
2063         (WebCore::EditingStyle::extractAndRemoveBlockProperties):
2064         (WebCore::EditingStyle::extractAndRemoveTextDirection):
2065         (WebCore::EditingStyle::mergeInlineStyleOfElement):
2066         (WebCore::extractEditingProperties):
2067         (WebCore::EditingStyle::styleAtSelectionStart):
2068         (WebCore::getPropertiesNotIn):
2069         * editing/EditingStyle.h:
2070         * editing/Editor.cpp:
2071         (WebCore::Editor::handleTextEvent):
2072         (WebCore::Editor::replaceSelectionWithFragment):
2073         (WebCore::Editor::insertOrderedList):
2074         (WebCore::Editor::insertUnorderedList):
2075         (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
2076         (WebCore::correctSpellcheckingPreservingTextCheckingParagraph):
2077         (WebCore::Editor::markAndReplaceFor):
2078         (WebCore::Editor::changeBackToReplacedString):
2079         (WebCore::Editor::updateMarkersForWordsAffectedByEditing):
2080         (WebCore::Editor::rangeForPoint):
2081         * editing/Editor.h:
2082         * editing/ModifySelectionListLevel.cpp:
2083         (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevel):
2084         (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevelOrdered):
2085         (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevelUnordered):
2086         * editing/ModifySelectionListLevel.h:
2087         * editing/SpellChecker.cpp:
2088         (WebCore::SpellChecker::requestCheckingFor):
2089         (WebCore::SpellChecker::didCheckSucceed):
2090         * editing/SpellChecker.h:
2091         (WebCore::SpellCheckRequest::checkingRange):
2092         (WebCore::SpellCheckRequest::paragraphRange):
2093         (WebCore::SpellCheckRequest::rootEditableElement):
2094         * editing/SpellingCorrectionCommand.cpp:
2095         (WebCore::SpellingCorrectionCommand::SpellingCorrectionCommand):
2096         (WebCore::SpellingCorrectionCommand::willApplyCommand):
2097         (WebCore::SpellingCorrectionCommand::doApply):
2098         (WebCore::SpellingCorrectionCommand::targetRanges):
2099         * editing/SpellingCorrectionCommand.h:
2100         (WebCore::SpellingCorrectionCommand::create):
2101         * editing/SurroundingText.h:
2102         * editing/TextCheckingHelper.cpp:
2103         (WebCore::TextCheckingParagraph::expandRangeToNextEnd):
2104         (WebCore::TextCheckingParagraph::rangeLength):
2105         (WebCore::TextCheckingParagraph::paragraphRange):
2106         (WebCore::TextCheckingParagraph::subrange):
2107         (WebCore::TextCheckingParagraph::offsetTo):
2108         (WebCore::TextCheckingParagraph::offsetAsRange):
2109         (WebCore::TextCheckingParagraph::text):
2110         (WebCore::TextCheckingParagraph::checkingStart):
2111         * editing/TextCheckingHelper.h:
2112         * editing/TypingCommand.cpp:
2113         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
2114         * editing/cocoa/HTMLConverter.mm:
2115         (HTMLConverterCaches::computedStylePropertyForElement):
2116         (HTMLConverterCaches::inlineStylePropertyForElement):
2117         * page/ios/FrameIOS.mm:
2118         (WebCore::Frame::interpretationsForCurrentRoot):
2119
2120 2017-05-01  Jer Noble  <jer.noble@apple.com>
2121
2122         Add notifications from CaptureDeviceManager (and subclasses) when device lists change
2123         https://bugs.webkit.org/show_bug.cgi?id=171442
2124
2125         Reviewed by Youenn Fablet.
2126
2127         Add a new callback-based notification to CaptureDeviceManager which fires when the underlying list
2128         of devices changes. Add support for enumerating AVAudioSession capture devices.
2129
2130         * WebCore.xcodeproj/project.pbxproj:
2131         * platform/mediastream/CaptureDeviceManager.cpp:
2132         (nextObserverToken):
2133         (CaptureDeviceManager::addCaptureDeviceChangedObserver):
2134         (CaptureDeviceManager::removeCaptureDeviceChangedObserver):
2135         * platform/mediastream/CaptureDeviceManager.h:
2136         * platform/mediastream/ios/AVAudioSessionCaptureDevice.h: Added.
2137         * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm: Added.
2138         (WebCore::AVAudioSessionCaptureDevice::create):
2139         (WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice):
2140         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h: Added.
2141         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm: Added.
2142         (-[WebAVAudioSessionAvailableInputsListener initWithCallback:]):
2143         (-[WebAVAudioSessionAvailableInputsListener invalidate]):
2144         (-[WebAVAudioSessionAvailableInputsListener observeValueForKeyPath:ofObject:change:context:]):
2145         (WebCore::AVAudioSessionCaptureDeviceManager::singleton):
2146         (WebCore::AVAudioSessionCaptureDeviceManager::captureDevices):
2147         (WebCore::AVAudioSessionCaptureDeviceManager::audioSessionCaptureDevices):
2148         (WebCore::AVAudioSessionCaptureDeviceManager::audioSessionDeviceWithUID):
2149         (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices):
2150         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
2151         (WebCore::AVCaptureDeviceManager::deviceConnected):
2152         (WebCore::AVCaptureDeviceManager::deviceDisconnected):
2153         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
2154         (WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices):
2155         (WebCore::CoreAudioCaptureDeviceManager::devicesChanged):
2156
2157 2017-05-01  Joanmarie Diggs  <jdiggs@igalia.com>
2158
2159         AX: AccessibilityTable::ariaRowCount() and ariaColumnCount() should not return -1 unless that is the author-provided value
2160         https://bugs.webkit.org/show_bug.cgi?id=171475
2161
2162         Reviewed by Chris Fleizach.
2163
2164         If the author has provided a valid value, return it. Otherwise, return 0.
2165
2166         No new tests needed. Update existing test expectations to reflect the change.
2167
2168         * accessibility/AccessibilityTable.cpp:
2169         (WebCore::AccessibilityTable::ariaColumnCount):
2170         (WebCore::AccessibilityTable::ariaRowCount):
2171
2172 2017-05-01  Joanmarie Diggs  <jdiggs@igalia.com>
2173
2174         AX: Implement support for ARIA "figure" and "term" roles; update AXRoleDescription mapping for "feed" role
2175         https://bugs.webkit.org/show_bug.cgi?id=171183
2176
2177         Reviewed by Chris Fleizach.
2178
2179         Create FeedRole, FigureRole, and TermRole and map them on the Mac and Gtk
2180         ports. Also rename AccessibilityObject::isFigure() to isFigureElement()
2181         for clarity as this method is specific to the HTML element and not the role.
2182
2183         No new tests needed: We have existing tests that cover mappings. Add new test cases
2184         to roles-exposed.html, xml-roles-exposed.html, and roles-computedRoleString.html.
2185
2186         * English.lproj/Localizable.strings:
2187         * accessibility/AccessibilityNodeObject.cpp:
2188         (WebCore::AccessibilityNodeObject::captionForFigure):
2189         (WebCore::AccessibilityNodeObject::alternativeText):
2190         * accessibility/AccessibilityObject.cpp:
2191         (WebCore::initializeRoleMap):
2192         (WebCore::AccessibilityObject::isFigureElement): Added.
2193         (WebCore::AccessibilityObject::isFigure): Deleted.
2194         * accessibility/AccessibilityObject.h:
2195         * accessibility/AccessibilityRenderObject.cpp:
2196         (WebCore::AccessibilityRenderObject::exposesTitleUIElement):
2197         (WebCore::AccessibilityRenderObject::titleUIElement):
2198         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
2199         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
2200         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2201         (atkRole):
2202         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2203         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
2204         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2205         (createAccessibilityRoleMap):
2206         (-[WebAccessibilityObjectWrapper subrole]):
2207         (-[WebAccessibilityObjectWrapper roleDescription]):
2208         * platform/LocalizedStrings.cpp:
2209         (WebCore::AXFeedText):
2210         * platform/LocalizedStrings.h:
2211
2212 2017-04-30  Chris Dumez  <cdumez@apple.com>
2213
2214         Drop support for legacy ClientRect / ClientRectList
2215         https://bugs.webkit.org/show_bug.cgi?id=171418
2216
2217         Reviewed by Sam Weinig.
2218
2219         Drop support for legacy ClientRect / ClientRectList types now we use
2220         DOMRect everywhere.
2221
2222         * CMakeLists.txt:
2223         * DerivedSources.cpp:
2224         * DerivedSources.make:
2225         * WebCore.xcodeproj/project.pbxproj:
2226         * dom/ClientRect.cpp: Removed.
2227         * dom/ClientRect.h: Removed.
2228         * dom/ClientRect.idl: Removed.
2229         * dom/ClientRectList.cpp: Removed.
2230         * dom/ClientRectList.h: Removed.
2231         * dom/ClientRectList.idl: Removed.
2232         * dom/DOMAllInOne.cpp:
2233         * dom/Element.cpp:
2234         * html/HTMLMediaElement.cpp:
2235         * html/track/VTTRegion.cpp:
2236         * page/DragController.cpp:
2237
2238 2017-04-30  Zalan Bujtas  <zalan@apple.com>
2239
2240         Initialize a new layout state while bailing out of simple line layout only when needed.
2241         https://bugs.webkit.org/show_bug.cgi?id=171481
2242         <rdar://problem/31906382>
2243
2244         '-webkit-border-fit: lines' requires inline box tree.
2245         We normally bail out of simple line layout early when we see this property. 
2246         When this property is dynamically set and we already have a simple line layout context,
2247         RenderBlockFlow::ensureLineBoxes() takes care of the switch by calling layoutLineBoxes().
2248         This patch makes sure that we create the layout state for this (forced)line layout only when
2249         we don't yet have one.
2250
2251         Reviewed by Antti Koivisto.
2252
2253         Test: fast/multicol/simple-line-layout-switch-to-normal-layout-while-inside-layout.html
2254
2255         * rendering/RenderBlockFlow.cpp:
2256         (WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer):
2257         (WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer):
2258         (WebCore::RenderBlockFlow::ensureLineBoxes):
2259         * rendering/RenderView.cpp:
2260         (WebCore::RenderView::pushLayoutStateForPaginationIfNeeded):
2261         (WebCore::RenderView::pushLayoutStateForPagination): Deleted.
2262         * rendering/RenderView.h:
2263
2264 2017-04-30  Dan Bernstein  <mitz@apple.com>
2265
2266         Tried to fix the iOS build after r215992
2267
2268         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2269
2270 2017-04-30  Brady Eidson  <beidson@apple.com>
2271
2272         Fix r215991
2273         https://bugs.webkit.org/show_bug.cgi?id=171483
2274
2275         Unreviewed.
2276
2277         * platform/spi/cf/CFNetworkSPI.h:
2278
2279 2017-04-30  Dan Bernstein  <mitz@apple.com>
2280
2281         Tried to fix the iOS build after r215992
2282
2283         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
2284         (WebAVPlayerLayerView_pictureInPicturePlayerLayerView):
2285         (WebVideoFullscreenInterfaceAVKit::setupFullscreen):
2286
2287 2017-04-30  Dan Bernstein  <mitz@apple.com>
2288
2289         [Cocoa] Replaces uses of [get…() alloc] with alloc…Instance()
2290         https://bugs.webkit.org/show_bug.cgi?id=171485
2291
2292         Reviewed by Geoffrey Garen.
2293
2294         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
2295         (WebCore::CDMSessionAVContentKeySession::contentKeySession):
2296         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
2297         (WebCore::MediaPlaybackTargetPickerMac::devicePicker):
2298         * platform/ios/ValidationBubbleIOS.mm:
2299         (-[WebValidationBubbleTapRecognizer initWithPopoverController:]):
2300         (WebCore::ValidationBubble::ValidationBubble):
2301         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2302         (WebVideoFullscreenControllerContext::setUpFullscreen):
2303         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
2304         (WebAVPlayerLayerView_pictureInPicturePlayerLayerView):
2305         (WebVideoFullscreenInterfaceAVKit::setupFullscreen):
2306         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
2307         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]):
2308         * platform/network/ios/PreviewConverter.mm:
2309         (WebCore::PreviewConverter::PreviewConverter):
2310         * rendering/RenderThemeIOS.mm:
2311         (WebCore::iconForAttachment):
2312
2313 2017-04-30  Brady Eidson  <beidson@apple.com>
2314
2315         Updates to _WKWebsiteDataStoreConfiguration cookie storage location SPI.
2316         <rdar://problem/31906397> and https://bugs.webkit.org/show_bug.cgi?id=171483
2317
2318         Reviewed by Geoff Garen (and kind of Andy Estes).
2319
2320         No new tests (Covered by API test).
2321
2322         * platform/spi/cf/CFNetworkSPI.h:
2323
2324 2017-04-30  Dan Bernstein  <mitz@apple.com>
2325
2326         <rdar://problem/31906525> WebCore-7604.1.19 has failed to build
2327
2328         * platform/ios/WebItemProviderPasteboard.mm:
2329         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]): Resolved type ambiguity
2330           by using allocUIItemProviderInstance() instead of [getUIItemProviderClass() alloc].
2331
2332 2017-04-30  Joanmarie Diggs  <jdiggs@igalia.com>
2333
2334         [ATK] Implement support for aria-autocomplete
2335         https://bugs.webkit.org/show_bug.cgi?id=171167
2336
2337         Reviewed by Chris Fleizach.
2338
2339         Expose ATK_STATE_SUPPORTS_AUTOCOMPLETION in the state set, and the value
2340         of aria-autocomplete as an object attribute, for elements which indicate
2341         they support autocompletion.
2342
2343         Test: accessibility/gtk/aria-autocomplete.html
2344
2345         * accessibility/AccessibilityObject.cpp:
2346         (WebCore::AccessibilityObject::supportsARIAAutoComplete):
2347         (WebCore::AccessibilityObject::ariaAutoCompleteValue):
2348         * accessibility/AccessibilityObject.h:
2349         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2350         (webkitAccessibleGetAttributes):
2351         (setAtkStateSetFromCoreObject):
2352         * html/HTMLAttributeNames.in:
2353
2354 2017-04-30  Joanmarie Diggs  <jdiggs@igalia.com>
2355
2356         [ATK] ARIA treegrid role should be exposed as ATK_ROLE_TREE_TABLE; not ATK_ROLE_TABLE
2357         https://bugs.webkit.org/show_bug.cgi?id=171170
2358
2359         Reviewed by Chris Fleizach.
2360
2361         AccessibilityTable::roleValue() was returning GridRole for both grid and treegrid.
2362         Change this so that GridRole is returned for grid and TreeGridRole is returned for
2363         treegrid. Add TreeGridRole to, or call isTable() in, methods where the behavior
2364         should be the same as GridRole.
2365
2366         Test: accessibility/gtk/interface-table.html
2367
2368         * accessibility/AccessibilityRenderObject.cpp:
2369         (WebCore::AccessibilityRenderObject::selectedChildren):
2370         * accessibility/AccessibilityTable.cpp:
2371         (WebCore::AccessibilityTable::roleValue):
2372         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2373         (atkRole):
2374         (getInterfaceMaskFromObject):
2375         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2376         (-[WebAccessibilityObjectWrapper _accessibilityTableAncestor]):
2377         (-[WebAccessibilityObjectWrapper _accessibilityTraitsFromAncestors]):
2378         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2379         (createAccessibilityRoleMap):
2380
2381 2017-04-30  Joanmarie Diggs  <jdiggs@igalia.com>
2382
2383         [ATK] Emit object:state-changed:busy event when aria-busy value changes
2384         https://bugs.webkit.org/show_bug.cgi?id=171181
2385
2386         Reviewed by Chris Fleizach.
2387
2388         Emit object:state-changed:busy for AXElementBusyChanged notifications.
2389
2390         Test: accessibility/gtk/aria-busy-changed-notification.html
2391
2392         * accessibility/atk/AXObjectCacheAtk.cpp:
2393         (WebCore::AXObjectCache::postPlatformNotification):
2394
2395 2017-04-29  Joseph Pecoraro  <pecoraro@apple.com>
2396
2397         Zero out PerformanceResourceTiming properties for cached cross-origin responses without Timing-Allow-Origin
2398         https://bugs.webkit.org/show_bug.cgi?id=171394
2399
2400         Reviewed by Youenn Fablet.
2401
2402         * loader/ResourceTiming.cpp:
2403         (WebCore::ResourceTiming::fromCache):
2404         (WebCore::ResourceTiming::ResourceTiming):
2405         * loader/ResourceTiming.h:
2406         * loader/cache/CachedResourceLoader.cpp:
2407         (WebCore::CachedResourceLoader::requestResource):
2408         Include the timing-allow-origin check for cached responses.
2409         Also, avoid including an extra entry for an ongoing cached resource
2410         load, since when that load completes it should be reported.
2411
2412 2017-04-29  Youenn Fablet  <youenn@apple.com>
2413
2414         Readd assertion removed accidentally in r215955
2415         https://bugs.webkit.org/show_bug.cgi?id=171466
2416
2417         Reviewed by Eric Carlson.
2418
2419         Unreviewed.
2420
2421         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2422         (WebCore::MockRealtimeVideoSourceMac::orientationChanged): Improved FIXME after review.
2423
2424 2017-04-29  Andy Estes  <aestes@apple.com>
2425
2426         [macOS] Picture-in-picture should be disabled in WebPlaybackControlsManager during external media playback
2427         https://bugs.webkit.org/show_bug.cgi?id=171468
2428         <rdar://problem/31900349>
2429
2430         Reviewed by Eric Carlson.
2431
2432         * platform/mac/WebPlaybackControlsManager.h: Declared canTogglePictureInPicture as a
2433         readwrite property.
2434         * platform/mac/WebPlaybackControlsManager.mm: Synthesize canTogglePictureInPicture.
2435         (-[WebPlaybackControlsManager canTogglePictureInPicture]): Deleted.
2436         * platform/mac/WebPlaybackSessionInterfaceMac.h:
2437         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2438         (WebCore::WebPlaybackSessionInterfaceMac::externalPlaybackChanged): Called
2439         -[WebPlaybackControlsManager setCanTogglePictureInPicture:].
2440
2441 2017-04-29  Simon Fraser  <simon.fraser@apple.com>
2442
2443         Fix tests broken by r215964.
2444
2445         Fix copy-paste error that caused the wrong paint phase to get passed to the fire writeLayerRenderers()
2446         call, causing extra renderer dumping.
2447
2448         Also remove unused default arguments.
2449
2450         * rendering/RenderTreeAsText.cpp:
2451         (WebCore::writeLayerRenderers):
2452         (WebCore::writeLayers):
2453
2454 2017-04-28  Zalan Bujtas  <zalan@apple.com>
2455
2456         iBooks text can overlap, sometimes columns are shifted splitting words.
2457         https://bugs.webkit.org/show_bug.cgi?id=171472
2458         <rdar://problem/31096037>
2459
2460         Reviewed by Antti Koivisto.
2461
2462         Instead of just checking if the glyph is taller than the line, we need to ensure that both the
2463         ascent and the descent have enough space (this is for -webkit-line-box-contain: glyph).
2464
2465         Test: fast/text/simple-line-layout-glyph-overflows-line.html
2466
2467         * rendering/SimpleLineLayout.cpp:
2468         (WebCore::SimpleLineLayout::canUseForText): compute the available space for the ascent/descent
2469         and check them against the ceil-ed(see FontCascade::floatWidthForSimpleText) glyph min/max y.
2470
2471 2017-04-29  Nan Wang  <n_wang@apple.com>
2472
2473         AX: Improve performance of addChildren()/childrenChanged()
2474         https://bugs.webkit.org/show_bug.cgi?id=171443
2475
2476         Reviewed by Chris Fleizach.
2477
2478         There's a lot of unnecessary work happening when childrenChanged() is being called.
2479         Some of the improvements here:
2480         1. When childrenChanged() is being called on some element, we are marking its parent
2481            chain dirty. However, in the addChild() method we are then clearing each child of
2482            that 'dirty' parent, eventually making the entire tree dirty. 
2483            Added a m_subTreeDirty flag and using the needsToUpdateChildren() check to make sure
2484            we are only clearing the right chain without updating the unchanged siblings.
2485         2. In the addChild() method we are calling accessibilityIsIgnored() on each child and that 
2486            might lead to going up the parent chain again to get necessary information. 
2487            Since we are already traversing the tree from top to bottom to add children, added a 
2488            struct to store the information and pass it to the child so to avoid unnecessary traversal.
2489         3. Reduced the amount work of ARIA text controls perform when updating its parents in childrenChanged() 
2490            so that we don't update a big portion of the tree while typing.
2491
2492         No new tests since this didn't change any functionality. 
2493
2494         * accessibility/AccessibilityNodeObject.cpp:
2495         (WebCore::AccessibilityNodeObject::AccessibilityNodeObject):
2496         (WebCore::AccessibilityNodeObject::childrenChanged):
2497         (WebCore::AccessibilityNodeObject::insertChild):
2498         (WebCore::AccessibilityNodeObject::addChildren):
2499         (WebCore::AccessibilityNodeObject::isDescendantOfBarrenParent):
2500         * accessibility/AccessibilityNodeObject.h:
2501         * accessibility/AccessibilityObject.cpp:
2502         (WebCore::AccessibilityObject::AccessibilityObject):
2503         (WebCore::AccessibilityObject::defaultObjectInclusion):
2504         (WebCore::AccessibilityObject::setIsIgnoredFromParentDataForChild):
2505         * accessibility/AccessibilityObject.h:
2506         (WebCore::AccessibilityIsIgnoredFromParentData::AccessibilityIsIgnoredFromParentData):
2507         (WebCore::AccessibilityIsIgnoredFromParentData::isNull):
2508         (WebCore::AccessibilityObject::setNeedsToUpdateSubTree):
2509         (WebCore::AccessibilityObject::needsToUpdateChildren):
2510         (WebCore::AccessibilityObject::setIsIgnoredFromParentData):
2511         * accessibility/AccessibilityRenderObject.cpp:
2512         (WebCore::AccessibilityRenderObject::updateChildrenIfNecessary):
2513         (WebCore::AccessibilityRenderObject::addChildren):
2514         * accessibility/AccessibilityRenderObject.h:
2515         (WebCore::AccessibilityRenderObject::setRenderObject):
2516         (WebCore::AccessibilityRenderObject::needsToUpdateChildren): Deleted.
2517
2518 2017-04-29  Yusuke Suzuki  <utatane.tea@gmail.com>
2519
2520         Move WebCore CPUTime to WTF and implement it in all the platforms
2521         https://bugs.webkit.org/show_bug.cgi?id=171477
2522
2523         Reviewed by Chris Dumez.
2524
2525         Move CPUTime to WTF. And rename getCPUTime to CPUTime::get().
2526
2527         * CMakeLists.txt:
2528         * PlatformMac.cmake:
2529         * WebCore.xcodeproj/project.pbxproj:
2530         * page/ChromeClient.h:
2531         * page/PerformanceMonitor.cpp:
2532         (WebCore::PerformanceMonitor::PerformanceMonitor):
2533         (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
2534         (WebCore::PerformanceMonitor::measurePostBackgroundingCPUUsage):
2535         (WebCore::PerformanceMonitor::measureCPUUsageInActivityState):
2536         * page/PerformanceMonitor.h:
2537         * platform/CPUMonitor.cpp:
2538         (WebCore::CPUMonitor::setCPULimit):
2539         (WebCore::CPUMonitor::timerFired):
2540         * platform/CPUMonitor.h:
2541
2542 2017-04-28  Per Arne Vollan  <pvollan@apple.com>
2543
2544         Crash under WebCore::AccessibilityRenderObject::handleAriaExpandedChanged().
2545         https://bugs.webkit.org/show_bug.cgi?id=171427
2546         rdar://problem/31863417
2547
2548         Reviewed by Brent Fulgham.
2549
2550         The AccessibilityRenderObject object might delete itself in handleAriaExpandedChanged() under the call
2551         to the parentObject() method. This will cause a crash when accessing the object later in this method.
2552         Protect the current object while executing arbitrary event code.
2553
2554         Test: accessibility/accessibility-crash-setattribute.html
2555
2556         * accessibility/AccessibilityRenderObject.cpp:
2557         (WebCore::AccessibilityRenderObject::handleAriaExpandedChanged):
2558
2559 2017-04-28  Chris Dumez  <cdumez@apple.com>
2560
2561         Diagnostic logging of navigations is too verbose
2562         https://bugs.webkit.org/show_bug.cgi?id=171455
2563         <rdar://problem/31543815>
2564
2565         Reviewed by Andreas Kling.
2566
2567         Diagnostic logging of navigation is too verbose. We log things that are not actually user
2568         navigations (e.g. speculative loads, bookmark icon fetches, ...). To address the issue,
2569         we now only log *observable* loads. We do so by only logging if the page is visible or
2570         if it becomes visible.
2571
2572         * loader/FrameLoader.cpp:
2573         (WebCore::FrameLoader::loadWithDocumentLoader):
2574         (WebCore::logNavigation): Deleted.
2575         * page/Page.cpp:
2576         (WebCore::Page::setIsVisibleInternal):
2577         (WebCore::Page::logNavigation):
2578         (WebCore::Page::mainFrameLoadStarted):
2579         * page/Page.h:
2580
2581 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
2582
2583         AX: ARIA "region" role which lacks an accessible name should not be treated as a landmark
2584         https://bugs.webkit.org/show_bug.cgi?id=171180
2585
2586         Reviewed by Chris Fleizach.
2587
2588         Remove mapping of LandmarkRegionRole for regions which lack an accessible name.
2589         Doing so had a side effect of causing a number of DPub ARIA roles to stop being
2590         mapped as ARIA landmarks. This is due to our internal role mappings, namely
2591         treating the DPub ARIA landmark roles as if they were regions. Because DPub's
2592         landmarks do not subclass region, and do not have the same name-from-author
2593         requirement as region, create a new LandmarkDocRegionRole AccessibilityRole and
2594         map DPub ARIA's generic landmarks to it.
2595
2596         No new tests because we already have sufficient coverage. Several existing
2597         tests were given additional test cases to cover named and unnamed regions,
2598         and test expectations updated accordingly.
2599
2600         * accessibility/AccessibilityNodeObject.cpp:
2601         (WebCore::AccessibilityNodeObject::determineAriaRoleAttribute):
2602         * accessibility/AccessibilityObject.cpp:
2603         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent):
2604         (WebCore::AccessibilityObject::isLandmark):
2605         (WebCore::initializeRoleMap):
2606         (WebCore::AccessibilityObject::computedRoleString):
2607         * accessibility/AccessibilityObject.h:
2608         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2609         (atkRole):
2610         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2611         (-[WebAccessibilityObjectWrapper _accessibilityIsLandmarkRole:]):
2612         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
2613         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
2614         (-[WebAccessibilityObjectWrapperBase ariaLandmarkRoleDescription]):
2615         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2616         (createAccessibilityRoleMap):
2617         (-[WebAccessibilityObjectWrapper subrole]):
2618
2619 2017-04-28  Simon Fraser  <simon.fraser@apple.com>
2620
2621         Enhance showLayerTree() to show fragments
2622         https://bugs.webkit.org/show_bug.cgi?id=171469
2623
2624         Reviewed by Zalan Bujtas.
2625
2626         Have showLayerTree() dump fragments, like:
2627
2628              normal flow list(1)
2629               layer 0x11c1879c0 at (0,0) size 700x1858 backgroundClip at (0,0) size 2120x779 clip at (0,0) size 2120x779
2630                    fragment 0: bounds in layer at (0,0) size 700x1858 fragment bounds at (0,0) size 700x779
2631                    fragment 1: bounds in layer at (710,-779) size 700x1858 fragment bounds at (710,0) size 700x779
2632                    fragment 2: bounds in layer at (1420,-1558) size 700x1858 fragment bounds at (1420,0) size 700x300
2633                 RenderMultiColumnFlowThread 0x11f1f3340 at (0,0) size 700x1858
2634
2635         We want these to show before the child renderers, so factor that code into writeLayerRenderers().
2636         
2637         Overloading of write() for layers doesn't help anyone, so call it writeLayer() for searchability.
2638
2639         * rendering/RenderLayer.cpp:
2640         (WebCore::showLayerTree):
2641         * rendering/RenderLayer.h:
2642         * rendering/RenderTreeAsText.cpp:
2643         (WebCore::writeLayer):
2644         (WebCore::writeLayerRenderers):
2645         (WebCore::writeLayers):
2646         * rendering/RenderTreeAsText.h:
2647
2648 2017-04-28  Simon Fraser  <simon.fraser@apple.com>
2649
2650         Modernize RenderTreeAsText code
2651         https://bugs.webkit.org/show_bug.cgi?id=171458
2652
2653         Reviewed by Zalan Bujtas.
2654
2655         Use modern loops. More references to render objects and layers.
2656
2657         * rendering/RenderTreeAsText.cpp:
2658         (WebCore::write):
2659         (WebCore::writeRenderNamedFlowThreads):
2660         (WebCore::writeLayers):
2661         (WebCore::writeSelection):
2662         (WebCore::externalRepresentation):
2663
2664 2017-04-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2665
2666         Fix and re-enable data interaction unit tests
2667         https://bugs.webkit.org/show_bug.cgi?id=171446
2668         <rdar://problem/31820646>
2669
2670         Reviewed by Tim Horton.
2671
2672         Three small tweaks to get all data interaction tests passing again (changes detailed below).
2673         Fixes a failing unit test: DataInteractionTests.RespectsExternalSourceFidelityRankings.
2674
2675         * page/mac/DragControllerMac.mm:
2676
2677         When dropping in a plain text editable area, don't consider kUTTypeText to be a UTI supported by the destination.
2678         This is because doing so would cause rich text UTIs, such as kUTTypeHTML, to match, so that the plain text area
2679         would report HTML as a preferred UTI type to load when dropping rich content over it. What we want to check for
2680         conformance here is really kUTTypePlainText.
2681
2682         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod):
2683         * platform/Pasteboard.h:
2684         * platform/ios/PasteboardIOS.mm:
2685
2686         The default Pasteboard constructor no longer makes a sync call to the UI process to get the change count.
2687         Instead, we introduce a new constructor that takes and sets the change count. This default constructor was used
2688         from three places: Pasteboard::createForCopyAndPaste, Pasteboard::createPrivate and StaticPasteboard::create.
2689
2690         The first two call sites have been refactored to first fetch the change count from the UI process and then pass
2691         it in to the constructor.
2692
2693         (WebCore::changeCountForPasteboard):
2694         (WebCore::Pasteboard::Pasteboard):
2695         (WebCore::Pasteboard::createForCopyAndPaste):
2696         (WebCore::Pasteboard::createPrivate):
2697         (WebCore::Pasteboard::readString):
2698         (WebCore::Pasteboard::types):
2699         * platform/mac/DragDataMac.mm:
2700         (WebCore::typeIsAppropriateForSupportedTypes):
2701         (WebCore::DragData::updatePreferredTypeIdentifiers):
2702
2703         Remove the two-pass heuristic. Instead, we should follow this policy: "select the highest fidelity UTI that
2704         conforms to one of the destination's supported types".
2705
2706         * platform/mac/PasteboardMac.mm:
2707         (WebCore::Pasteboard::Pasteboard):
2708
2709 2017-04-28  Dean Jackson  <dino@apple.com>
2710
2711         App crashing: Dispatch queue: com.apple.root.user-interactive-qos / vBoxConvolve / WebCore::FEGaussianBlur::platformApplySoftware()
2712         https://bugs.webkit.org/show_bug.cgi?id=171461
2713         <rdar://problem/30534722>
2714
2715         Reviewed by Eric Carlson.
2716
2717         We're getting reports of crashes in this function, caused by null or empty data being
2718         passed to vImage. Guard against this, in a way that will ASSERT in debug builds if
2719         anyone comes across it.
2720
2721         Test: css3/filters/blur-various-radii.html
2722
2723         * platform/graphics/filters/FEGaussianBlur.cpp:
2724         (WebCore::accelerateBoxBlur): Return early if things don't look good.
2725
2726 2017-04-28  Chris Dumez  <cdumez@apple.com>
2727
2728         Stop using legacy ClientRect / ClientRectList in Internals
2729         https://bugs.webkit.org/show_bug.cgi?id=171412
2730
2731         Reviewed by Simon Fraser.
2732
2733         Stop using legacy ClientRect / ClientRectList in Internals amd use the
2734         newer DOMRect instead.
2735
2736         * dom/DOMRect.idl:
2737         * page/Page.cpp:
2738         (WebCore::Page::nonFastScrollableRects):
2739         (WebCore::Page::touchEventRectsForEvent):
2740         (WebCore::Page::passiveTouchEventListenerRects):
2741         * page/Page.h:
2742         * testing/Internals.cpp:
2743         (WebCore::Internals::absoluteCaretBounds):
2744         (WebCore::Internals::boundingBox):
2745         (WebCore::Internals::inspectorHighlightRects):
2746         (WebCore::Internals::layoutViewportRect):
2747         (WebCore::Internals::visualViewportRect):
2748         (WebCore::Internals::touchEventRectsForEvent):
2749         (WebCore::Internals::passiveTouchEventListenerRects):
2750         (WebCore::Internals::nonFastScrollableRects):
2751         (WebCore::Internals::selectionBounds):
2752         * testing/Internals.h:
2753         * testing/Internals.idl:
2754
2755 2017-04-28  Youenn Fablet  <youenn@apple.com>
2756
2757         getUserMedia video streams should follow device orientation
2758         https://bugs.webkit.org/show_bug.cgi?id=171284
2759
2760         Reviewed by Eric Carlson.
2761
2762         Only really affects AVVideoCaptureSource on iOS. Manually testing the following cases:
2763         - Mac: no change of behavior
2764         - iOS: page loaded in portrait, video is portrait. page loaded in landscape, video is landscape
2765         - iOS: changing the device orientation makes the video samples to be moved to landscape/portrait.
2766         - Same tests as above with peer connection.
2767
2768         Making Document having an OrientationNotifier that AVVideoCaptureSources get registered to.
2769         Making AVVideoCaptureSource an OrientationNotifier::Observer so that it can changes width/height if needed.
2770
2771         Refactoring to specialize CaptureFactory in VideoCaptureFactory and AudioCaptureFactory.
2772         Refactoring to return a CaptureSourceOrError instead of passing an out parameter plus returning a RefPtr.
2773
2774         * Modules/mediastream/UserMediaRequest.cpp:
2775         (WebCore::UserMediaRequest::allow):
2776         * WebCore.xcodeproj/project.pbxproj:
2777         * dom/Document.cpp:
2778         (WebCore::Document::orientationChanged):
2779         * dom/Document.h:
2780         * page/Frame.cpp:
2781         (WebCore::Frame::orientationChanged):
2782         * platform/OrientationNotifer.h: Copied from Source/WebKit2/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h.
2783         (WebCore::OrientationNotifier::Observer::setNotifier):
2784         (WebCore::OrientationNotifier::Observer::~Observer):
2785         (WebCore::OrientationNotifier::orientationChanged):
2786         (WebCore::OrientationNotifier::addObserver):
2787         (WebCore::OrientationNotifier::removeObserver):
2788         * platform/mediastream/MediaStreamPrivate.cpp:
2789         (WebCore::MediaStreamPrivate::monitorOrientation):
2790         * platform/mediastream/MediaStreamPrivate.h:
2791         * platform/mediastream/RealtimeMediaSource.h:
2792         (WebCore::CaptureSourceOrError::CaptureSourceOrError):
2793         (WebCore::CaptureSourceOrError::operator bool):
2794         (WebCore::CaptureSourceOrError::source):
2795         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2796         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
2797         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
2798         (WebCore::RealtimeMediaSourceCenter::setVideoFactory):
2799         (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory):
2800         * platform/mediastream/RealtimeMediaSourceCenter.h:
2801         (WebCore::RealtimeMediaSourceCenter::defaultAudioFactory):
2802         (WebCore::RealtimeMediaSourceCenter::defaultVideoFactory):
2803         (WebCore::RealtimeMediaSourceCenter::audioFactory):
2804         (WebCore::RealtimeMediaSourceCenter::videoFactory):
2805         * platform/mediastream/mac/AVAudioCaptureSource.h:
2806         * platform/mediastream/mac/AVAudioCaptureSource.mm:
2807         (WebCore::AVAudioCaptureSource::create):
2808         (WebCore::AVAudioCaptureSource::factory):
2809         * platform/mediastream/mac/AVVideoCaptureSource.h:
2810         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2811         (WebCore::AVVideoCaptureSource::create):
2812         (WebCore::AVVideoCaptureSource::factory):
2813         (WebCore::AVVideoCaptureSource::monitorOrientation):
2814         (WebCore::AVVideoCaptureSource::orientationChanged):
2815         (WebCore::AVVideoCaptureSource::processNewFrame):
2816         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2817         (WebCore::CoreAudioCaptureSource::create):
2818         (WebCore::CoreAudioCaptureSource::factory):
2819         * platform/mediastream/mac/CoreAudioCaptureSource.h:
2820         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
2821         (WebCore::MockRealtimeAudioSource::create):
2822         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
2823         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2824         (WebCore::MockRealtimeVideoSource::create):
2825         (WebCore::MockRealtimeVideoSourceMac::orientationChanged):
2826         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2827         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
2828         (WebCore::RealtimeMediaSourceCenterMac::bestSourcesForTypeAndConstraints):
2829         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory):
2830         (WebCore::RealtimeMediaSourceCenterMac::defaultVideoFactory):
2831         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
2832         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
2833         (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream):
2834         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
2835         * platform/mock/MockRealtimeAudioSource.cpp:
2836         (WebCore::MockRealtimeAudioSource::create):
2837         (WebCore::MockRealtimeAudioSource::factory):
2838         * platform/mock/MockRealtimeAudioSource.h:
2839         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2840         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
2841         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
2842         (WebCore::MockRealtimeMediaSourceCenter::defaultAudioFactory):
2843         (WebCore::MockRealtimeMediaSourceCenter::defaultVideoFactory):
2844         * platform/mock/MockRealtimeMediaSourceCenter.h:
2845         * platform/mock/MockRealtimeVideoSource.cpp:
2846         (WebCore::MockRealtimeVideoSource::create):
2847         (WebCore::MockRealtimeVideoSource::factory):
2848         * platform/mock/MockRealtimeVideoSource.h:
2849
2850 2017-04-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
2851
2852         Unify how BitmapImage handles the availability of a decoded for large and animated images
2853         https://bugs.webkit.org/show_bug.cgi?id=171410
2854
2855         Reviewed by Simon Fraser.
2856
2857         Rename some functions which are related to animation frame availability.
2858         Make BitmapImage call ImageObserver::imageFrameAvailable() whenever a 
2859         frame is available regardless it is for an animated or for a large image.
2860
2861         * html/HTMLMediaElement.cpp:
2862         (WebCore::HTMLMediaElement::isVisibleInViewport):
2863         * html/MediaElementSession.cpp:
2864         (WebCore::MediaElementSession::autoplayPermitted):
2865         (WebCore::isMainContentForPurposesOfAutoplay):
2866         * loader/cache/CachedImage.cpp:
2867         (WebCore::CachedImage::CachedImageObserver::imageFrameAvailable):
2868         (WebCore::CachedImage::imageFrameAvailable):
2869         (WebCore::CachedImage::usesImageContainerSize): Deleted.
2870         (WebCore::CachedImage::imageHasRelativeWidth): Deleted.
2871         (WebCore::CachedImage::imageHasRelativeHeight): Deleted.
2872         (WebCore::CachedImage::CachedImageObserver::animationAdvanced): Deleted.
2873         (WebCore::CachedImage::animationAdvanced): Deleted.
2874         * loader/cache/CachedImage.h:
2875         * loader/cache/CachedImageClient.h:
2876         (WebCore::CachedImageClient::imageFrameAvailable):
2877         (WebCore::CachedImageClient::newImageAnimationFrameAvailable): Deleted.
2878         * platform/graphics/BitmapImage.cpp:
2879         (WebCore::BitmapImage::internalAdvanceAnimation):
2880         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
2881         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Deleted.
2882         * platform/graphics/BitmapImage.h:
2883         * platform/graphics/Image.h:
2884         (WebCore::Image::imageFrameAvailableAtIndex):
2885         (WebCore::Image::newFrameNativeImageAvailableAtIndex): Deleted.
2886         * platform/graphics/ImageFrameCache.cpp:
2887         (WebCore::ImageFrameCache::cacheAsyncFrameNativeImageAtIndex):
2888         * platform/graphics/ImageObserver.h:
2889         * platform/graphics/ImageTypes.h:
2890         * rendering/RenderElement.cpp:
2891         (WebCore::RenderElement::RenderElement):
2892         (WebCore::RenderElement::shouldRepaintInVisibleRect):
2893         (WebCore::RenderElement::imageFrameAvailable):
2894         (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded):
2895         (WebCore::shouldRepaintForImageAnimation): Deleted.
2896         (WebCore::RenderElement::newImageAnimationFrameAvailable): Deleted.
2897         * rendering/RenderElement.h:
2898         * rendering/RenderView.cpp:
2899         (WebCore::RenderView::updateVisibleViewportRect):
2900         * svg/graphics/SVGImageClients.h:
2901
2902 2017-04-28  Jeremy Jones  <jeremyj@apple.com>
2903
2904         ARGUMENT BAD: time, time >= 0
2905         https://bugs.webkit.org/show_bug.cgi?id=164336
2906         rdar://problem/29314891
2907
2908         Reviewed by Eric Carlson.
2909
2910         Handle invalid duration and current time when calculating remaining time.
2911
2912         Test media/modern-media-controls/pip-support/pip-support-click.html now works without a workaround
2913         in media/modern-media-controls/pip-support/pip-support-enabled.html
2914
2915         * platform/mac/WebVideoFullscreenHUDWindowController.mm:
2916         (-[WebVideoFullscreenHUDWindowController remainingTimeText]):
2917
2918 2017-04-28  Daniel Bates  <dabates@apple.com>
2919
2920         Add WebCore::protocolIsJavaScript(StringView)
2921         https://bugs.webkit.org/show_bug.cgi?id=171396
2922
2923         Reviewed by Alex Christensen.
2924
2925         Add an overload of WebCore::protocolIsJavaScript() that takes a StringView to
2926         avoid the need for a caller to allocate a new String object when converting
2927         from a StringView to a String. We are not using this functionality at the moment,
2928         but we will in the patch for <https://bugs.webkit.org/show_bug.cgi?id=170925>.
2929
2930         No functionality has changed. So, no new tests.
2931
2932         * platform/URL.cpp: Remove an outdated comment about protocolIs(StringView, const char*).
2933         This overload was removed in r212508.
2934         (WebCore::protocolIsInternal): Added.
2935         (WebCore::protocolIs): Implemented in terms of WebCore::protocolIsInternal().
2936         (WebCore::URL::protocolIs): Ditto.
2937         (WebCore::protocolIsJavaScript): Added; overload that takes a StringView.
2938         (WebCore::mimeTypeFromDataURL): Modified to use WebCore::protocolIsInternal().
2939         * platform/URL.h:
2940
2941 2017-04-28  Andy Estes  <aestes@apple.com>
2942
2943         [macOS] WebPlaybackControlsManager needs to know when the selected text or audio track changes
2944         https://bugs.webkit.org/show_bug.cgi?id=171434
2945         <rdar://problem/31887922>
2946
2947         Reviewed by Eric Carlson.
2948
2949         * dom/GenericEventQueue.cpp:
2950         (WebCore::GenericEventQueue::hasPendingEventsOfType): Added to check if a pending event
2951         exists of a certain type.
2952         * dom/GenericEventQueue.h:
2953         * html/HTMLMediaElement.cpp:
2954         (WebCore::HTMLMediaElement::setSelectedTextTrack): Even if no track modes change, fire a
2955         change event when the track to select is off or automatic so that
2956         WebPlaybackSessionModelMediaElement detects the change.
2957         * html/track/TrackListBase.cpp:
2958         (TrackListBase::isChangeEventScheduled): Returns true if m_asyncEventQueue has a pending
2959         change event.
2960         * html/track/TrackListBase.h:
2961         * platform/cocoa/WebPlaybackSessionModel.h:
2962         (WebCore::WebPlaybackSessionModelClient::audioMediaSelectionIndexChanged):
2963         (WebCore::WebPlaybackSessionModelClient::legibleMediaSelectionIndexChanged):
2964         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
2965         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
2966         (WebCore::WebPlaybackSessionModelMediaElement::setMediaElement): Registered/unregistered for
2967         the change event on the audio and text tracks.
2968         (WebCore::WebPlaybackSessionModelMediaElement::updateForEventName): Called
2969         updateMediaSelectionIndices() when the change event fires.
2970         (WebCore::WebPlaybackSessionModelMediaElement::updateMediaSelectionOptions): Renamed from
2971         updateLegibleOptions().
2972         (WebCore::WebPlaybackSessionModelMediaElement::updateMediaSelectionIndices): Called
2973         audioMediaSelectionIndexChanged() and legibleMediaSelectionIndexChanged() on m_clients with
2974         the updated indices.
2975         (WebCore::WebPlaybackSessionModelMediaElement::legibleMediaSelectedIndex): Fixed a bug
2976         where selectedIndex would never be set to offIndex if offIndex is 0 (which it usually is).
2977         (WebCore::WebPlaybackSessionModelMediaElement::updateLegibleOptions): Renamed to
2978         updateMediaSelectionOptions().
2979         * platform/mac/WebPlaybackControlsManager.h:
2980         * platform/mac/WebPlaybackControlsManager.mm:
2981         (-[WebPlaybackControlsManager setAudioMediaSelectionIndex:]): Set
2982         _currentAudioTouchBarMediaSelectionOption to the object at selectedIndex and manually
2983         triggered a KVO notification. We can't call -setCurrentAudioTouchBarMediaSelectionOption:
2984         here since that will send a message back to the Web process.
2985         (-[WebPlaybackControlsManager setLegibleMediaSelectionIndex:]): Ditto for
2986         _currentLegibleTouchBarMediaSelectionOption.
2987         * platform/mac/WebPlaybackSessionInterfaceMac.h:
2988         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2989         (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionIndexChanged): Called
2990         -[WebPlaybackControlsManager setAudioMediaSelectionIndex:].
2991         (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionIndexChanged): Called
2992         -[WebPlaybackControlsManager setLegibleMediaSelectionIndex:].
2993
2994 2017-04-28  Chris Dumez  <cdumez@apple.com>
2995
2996         Range.getClientRects() / getBoundingClientRect() should return DOMRect types
2997         https://bugs.webkit.org/show_bug.cgi?id=171393
2998
2999         Reviewed by Simon Fraser.
3000
3001         Range.getClientRects() / getBoundingClientRect() should return DOMRect types:
3002         - https://drafts.csswg.org/cssom-view/#extensions-to-the-range-interface
3003
3004         Test: fast/dom/Range/getBoundingClientRect-getClientRects-return-type.html
3005
3006         * CMakeLists.txt:
3007         * WebCore.xcodeproj/project.pbxproj:
3008         * dom/DOMRect.cpp: Copied from Source/WebCore/dom/DOMRect.h.
3009         (WebCore::createDOMRectVector):
3010         * dom/DOMRect.h:
3011         * dom/Element.cpp:
3012         (WebCore::Element::getClientRects):
3013         * dom/Range.cpp:
3014         (WebCore::Range::getClientRects):
3015         (WebCore::Range::getBoundingClientRect):
3016         * dom/Range.h:
3017         * dom/Range.idl:
3018
3019 2017-04-28  Chris Dumez  <cdumez@apple.com>
3020
3021         Tweak window.open features argument tokenizer to match HTML standard and Edge
3022         https://bugs.webkit.org/show_bug.cgi?id=170548
3023
3024         Reviewed by Geoffrey Garen.
3025
3026         Update window.open() features argument tokenizer to match HTML standard:
3027         - https://html.spec.whatwg.org/#concept-window-open-features-tokenize
3028
3029         Also update window.open() to return null instead of the window when
3030         the 'noopener' feature is activated, as per:
3031         - https://html.spec.whatwg.org/#dom-open (Step 10)
3032
3033         No new tests, rebaselined existing test.
3034
3035         * page/DOMWindow.cpp:
3036         (WebCore::DOMWindow::createWindow):
3037         Update window.open() to return null instead of the window when
3038         the 'noopener' feature is activated, as per:
3039         - https://html.spec.whatwg.org/#dom-open (Step 10)
3040
3041         * page/WindowFeatures.cpp:
3042         (WebCore::isSeparator):
3043         Treat all ASCII spaces as feature separators, as per:
3044         - https://html.spec.whatwg.org/#feature-separator
3045         This has the effect of adding U+000C (FormFeed) as a separator.
3046
3047         (WebCore::processFeaturesString):
3048         Align tokenizing code with the specification:
3049         - https://html.spec.whatwg.org/#concept-window-open-features-tokenize
3050         In particular, the following changes were made:
3051         - After the key, skip to first '=', but don't skip past a ',' or a non-separator.
3052           The "or a non-separator" part is new in the spec (step 3.6.1) and is now implemented.
3053         - After looking for the '=', only treat what follows as a value if the current character
3054           is a separator. This is as per step 7 in the spec.
3055         These changes now cause us to parse 'foo noopener=1' as ('foo', ''), ('noopener', '1').
3056
3057 2017-04-28  Eric Carlson  <eric.carlson@apple.com>
3058
3059         Implement ondevicechange
3060         https://bugs.webkit.org/show_bug.cgi?id=169872
3061
3062         Unreviewed, remove some dead code accidentally committed in r215929.
3063
3064         * platform/mediastream/CaptureDeviceManager.cpp:
3065
3066 2017-04-28  Chris Dumez  <cdumez@apple.com>
3067
3068         Update DOMTokenList.replace() to match the latest DOM specification
3069         https://bugs.webkit.org/show_bug.cgi?id=171388
3070
3071         Reviewed by Alex Christensen.
3072
3073         Update DOMTokenList.replace() to match the latest DOM specification after:
3074         - https://github.com/whatwg/dom/issues/442
3075         - https://github.com/whatwg/infra/pull/126
3076
3077         The latest spec text is at:
3078         - https://dom.spec.whatwg.org/#dom-domtokenlist-replace
3079         - https://infra.spec.whatwg.org/#set-replace
3080
3081         The behavior change in this patch causes (a, b, c).replace(a, c) to return
3082         (c, b) instead of (b, c). This new behavior is aligned with Firefox as well.
3083
3084         No new tests, updated existing test.
3085
3086         * html/DOMTokenList.cpp:
3087         (WebCore::DOMTokenList::replace):
3088
3089 2017-04-28  Brady Eidson  <beidson@apple.com>
3090
3091         Start of support for multiple WebsiteDataStore/SessionIDs per process
3092         https://bugs.webkit.org/show_bug.cgi?id=171422
3093
3094         Reviewed by Geoffrey Garen.
3095
3096         Covered by API tests.
3097
3098         * platform/network/NetworkStorageSession.h:
3099         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3100         (WebCore::NetworkStorageSession::ensureSession):
3101         * platform/spi/cf/CFNetworkSPI.h:
3102
3103 2017-04-28  Chris Dumez  <cdumez@apple.com>
3104
3105         URLSearchParams should be reflective
3106         https://bugs.webkit.org/show_bug.cgi?id=171345
3107
3108         Reviewed by Alex Christensen.
3109
3110         There was a bug in our implementation of [1] where we would replace
3111         '+' with 0x20 *after* URL-decoding the string, instead of *before*.
3112         This was causing us to replace URL-encoded '+' characters with 0x20.
3113
3114         [1] https://url.spec.whatwg.org/#concept-urlencoded-parser
3115
3116         No new tests, updated existing test.
3117
3118         * platform/URLParser.cpp:
3119
3120 2017-04-28  Youenn Fablet  <youenn@apple.com>
3121
3122         Adding a runtime flag specific to MediaDevices
3123         https://bugs.webkit.org/show_bug.cgi?id=171433
3124
3125         Reviewed by Geoffrey Garen.
3126
3127         Covered by existing tests.
3128
3129         Adding a preference for MediaDevices.
3130         Setting media devices runtime flag to false by default.
3131         Setting peer connection and media stream flags to true by default.
3132         Activating mediaDevices and getUserMedia Navigator properties based on media devices flag.
3133
3134         * Modules/mediastream/NavigatorMediaDevices.idl:
3135         * Modules/mediastream/NavigatorUserMedia.idl:
3136         * page/RuntimeEnabledFeatures.cpp:
3137         (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
3138         * page/RuntimeEnabledFeatures.h:
3139         (WebCore::RuntimeEnabledFeatures::mediaDevicesEnabled):
3140         (WebCore::RuntimeEnabledFeatures::setMediaDevicesEnabled):
3141
3142 2017-04-28  Eric Carlson  <eric.carlson@apple.com>
3143
3144         Implement ondevicechange
3145         https://bugs.webkit.org/show_bug.cgi?id=169872
3146
3147         Unreviewed, fix test crash.
3148
3149         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3150         (WebCore::RealtimeMediaSourceCenter::addDevicesChangedObserver): "nextToken" must be static.
3151
3152 2017-04-28  Dean Jackson  <dino@apple.com>
3153
3154         [WebGPU] Label MTLCommandQueues with a prefix for internal telemetry
3155         https://bugs.webkit.org/show_bug.cgi?id=171441
3156         <rdar://problem/31826915>
3157
3158         Reviewed by Tim Horton.
3159
3160         Prefix any label that is set by the WebGPU API so that
3161         our telemetry can identify the use. Don't expose that
3162         prefix to the API though.
3163
3164         New API Test: GPUCommandQueue
3165
3166         * platform/graphics/cocoa/GPUCommandQueueMetal.mm:
3167         (WebCore::GPUCommandQueue::GPUCommandQueue):
3168         (WebCore::GPUCommandQueue::label):
3169         (WebCore::GPUCommandQueue::setLabel):
3170
3171 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
3172
3173         [ATK] aria-modal="true" should be exposed via ATK_STATE_MODAL
3174         https://bugs.webkit.org/show_bug.cgi?id=171188
3175
3176         Reviewed by Chris Fleizach.
3177
3178         Include ATK_STATE_MODAL in the AtkObject's state set if the accessible
3179         element's node is the current ARIA modal node.
3180
3181         Test: accessibility/gtk/aria-modal-state-exposed.html
3182
3183         * accessibility/AccessibilityObject.cpp:
3184         (WebCore::AccessibilityObject::isAriaModalNode):
3185         * accessibility/AccessibilityObject.h:
3186         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
3187         (setAtkStateSetFromCoreObject):
3188
3189 2017-04-28  Eric Carlson  <eric.carlson@apple.com>
3190
3191         Implement ondevicechange
3192         https://bugs.webkit.org/show_bug.cgi?id=169872
3193         <rdar://problem/28945035>
3194
3195         Reviewed by Jer Noble.
3196
3197         Test: fast/mediastream/device-change-event.html
3198
3199         * Modules/mediastream/MediaDevices.cpp:
3200         (WebCore::MediaDevices::MediaDevices): Register for devicechange callbacks.
3201         (WebCore::MediaDevices::~MediaDevices): Unregister.
3202         (WebCore::MediaDevices::scheduledEventTimerFired):
3203         * Modules/mediastream/MediaDevices.h:
3204         * Modules/mediastream/MediaDevices.idl:
3205
3206         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
3207         (WebCore::MediaDevicesEnumerationRequest::setDeviceInfo): Remove unnecessary instance variables.
3208         * Modules/mediastream/MediaDevicesEnumerationRequest.h:
3209
3210         * Modules/mediastream/MediaDevicesRequest.cpp:
3211         (WebCore::MediaDevicesRequest::start): Remove m_idHashSalt, it isn't used. RealtimeMediaSourceCenter
3212         now has the method to hash ids and group IDs.
3213         (WebCore::hashString): Deleted.
3214         (WebCore::MediaDevicesRequest::hashID): Deleted.
3215         * Modules/mediastream/MediaDevicesRequest.h:
3216
3217         * dom/Document.h:
3218         (WebCore::Document::setDeviceIDHashSalt):
3219         (WebCore::Document::deviceIDHashSalt):
3220
3221         * dom/EventNames.h: Add devicechange.
3222
3223         * dom/EventTargetFactory.in: Add MediaDevices.
3224
3225         * html/HTMLAttributeNames.in: Add ondevicechange.
3226
3227         * platform/mediastream/CaptureDeviceManager.cpp:
3228         (WebCore::CaptureDeviceManager::captureDeviceFromPersistentID): Renamed from captureDeviceFromDeviceID
3229         and changed to return a std::optional<CaptureDevice>.
3230         (WebCore::CaptureDeviceManager::captureDeviceFromDeviceID): Deleted.
3231
3232         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3233         (WebCore::addStringToSHA): New, add string bytes to SHA1. Moved from MediaDevicesRequest
3234         so we can use for in testing.
3235         (WebCore::RealtimeMediaSourceCenter::hashStringWithSalt): Generate hash for a string with a
3236         salt. Moved from MediaDevicesRequest so we can use for in testing.
3237         (WebCore::RealtimeMediaSourceCenter::captureDeviceWithUniqueID): Find a CaptureDevice given 
3238         a unique ID and the process hash salt.
3239         (WebCore::RealtimeMediaSourceCenter::setDeviceEnabled): Enable/disable a device. Used for
3240         layout tests only.
3241         (WebCore::RealtimeMediaSourceCenter::addDevicesChangedObserver): Add a devices changed listener.
3242         (WebCore::RealtimeMediaSourceCenter::removeDevicesChangedObserver): Remove a listener.
3243         (WebCore::RealtimeMediaSourceCenter::captureDevicesChanged): Notify listeners.
3244         * platform/mediastream/RealtimeMediaSourceCenter.h:
3245
3246         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
3247         (WebCore::AVCaptureDeviceManager::addDevicesChangedObserver): Update for change to captureDeviceFromDeviceID.
3248
3249         * platform/mock/MockRealtimeMediaSource.cpp:
3250         (WebCore::MockRealtimeMediaSource::audioDevices): All devices are enabled by default.
3251         (WebCore::MockRealtimeMediaSource::videoDevices): Ditto.
3252
3253         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
3254         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream): Drive-by cleanup: use the vector
3255         of devices instead of making assumptions about the number.
3256         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamDevices): Only include enabled devices.
3257         (WebCore::MockRealtimeMediaSourceCenter::setDeviceEnabled): Enable or disable a device.
3258         * platform/mock/MockRealtimeMediaSourceCenter.h:
3259
3260         * testing/Internals.cpp:
3261         (WebCore::Internals::setMediaDeviceState): Enable or disable a mock capture device.
3262         * testing/Internals.h:
3263         * testing/Internals.idl:
3264
3265 2017-04-28  Alex Christensen  <achristensen@webkit.org>
3266
3267         Fix memory corruption issue after r215883.
3268         https://bugs.webkit.org/show_bug.cgi?id=171365
3269
3270         Reviewed by Brady Eidson.
3271
3272         This fixes a crash when starting WebKit2.
3273
3274         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3275         (WebCore::NetworkStorageSession::NetworkStorageSession):
3276         Initialize m_platformCookieStorage with the default constructor of RetainPtr,
3277         then call NetworkStorageSession::cookieStorage which checks m_platformCookieStorage
3278         for null.  It was checking uninitialized memory when we had m_platformCookieStorage
3279         in the initializer list.
3280
3281 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
3282
3283         AX: Implement aria-value support for focusable separators
3284         https://bugs.webkit.org/show_bug.cgi?id=171169
3285
3286         Reviewed by Chris Fleizach.
3287
3288         Add SplitterRole to the roles which support range value and are considered a range
3289         control, as long as the SplitterRole element is focusable. Also replace ATK's role-
3290         based check with a call to supportsRangeValue() when determining if the AtkValue
3291         interface should be implemented.
3292
3293         Test: accessibility/separator-values.html
3294
3295         * accessibility/AccessibilityObject.cpp:
3296         (WebCore::AccessibilityObject::isRangeControl):
3297         (WebCore::AccessibilityObject::supportsRangeValue):
3298         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
3299         (getInterfaceMaskFromObject):
3300
3301 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
3302
3303         [ATK] GridCellRole should implement AtkTableCell (regression?)
3304         https://bugs.webkit.org/show_bug.cgi?id=171179
3305
3306         Reviewed by Chris Fleizach.
3307
3308         Add GridCellRole to the group of roles which should implement AtkTableCell.
3309
3310         Test: accessibility/gtk/interface-table-cell.html
3311
3312         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
3313         (getInterfaceMaskFromObject):
3314
3315 2017-04-28  Miguel Gomez  <magomez@igalia.com>
3316
3317         REGRESSION(r215211): [GTK] Several webgl related tests are failing
3318         https://bugs.webkit.org/show_bug.cgi?id=170730
3319
3320         Reviewed by Said Abou-Hallawa.
3321
3322         There is a wrong situation in the image decoders where the complete data has been assigned
3323         to them but the size of the image hasn't been decoded yet. This is causing rendering
3324         issues in webgl when decoding the images used as textures. To fix this, we refactor how the
3325         encoded data status is stored to avoid that situation: the status is handled completely
3326         by ImageDecoder.h, and it's the one forcing the decode of the size when data gets assigned
3327         to the decoders.
3328
3329         Covered by existent tests.
3330
3331         * platform/image-decoders/ImageDecoder.h:
3332         (WebCore::ImageDecoder::isAllDataReceived):
3333         (WebCore::ImageDecoder::setData):
3334         (WebCore::ImageDecoder::encodedDataStatus):
3335         (WebCore::ImageDecoder::isSizeAvailable):
3336         (WebCore::ImageDecoder::setSize):
3337         (WebCore::ImageDecoder::setFailed):
3338         (WebCore::ImageDecoder::failed):
3339         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
3340         (WebCore::BMPImageDecoder::frameBufferAtIndex):
3341         (WebCore::BMPImageDecoder::decode):
3342         (WebCore::BMPImageDecoder::encodedDataStatus): Deleted.
3343         * platform/image-decoders/bmp/BMPImageDecoder.h:
3344         * platform/image-decoders/gif/GIFImageDecoder.cpp:
3345         (WebCore::GIFImageDecoder::frameCount):
3346         (WebCore::GIFImageDecoder::frameBufferAtIndex):
3347         (WebCore::GIFImageDecoder::decode):
3348         (WebCore::GIFImageDecoder::encodedDataStatus): Deleted.
3349         * platform/image-decoders/gif/GIFImageDecoder.h:
3350         * platform/image-decoders/ico/ICOImageDecoder.cpp:
3351         (WebCore::ICOImageDecoder::setData):
3352         (WebCore::ICOImageDecoder::frameCount):
3353         (WebCore::ICOImageDecoder::frameBufferAtIndex):
3354         (WebCore::ICOImageDecoder::setDataForPNGDecoderAtIndex):
3355         (WebCore::ICOImageDecoder::decode):
3356         (WebCore::ICOImageDecoder::decodeAtIndex):
3357         (WebCore::ICOImageDecoder::encodedDataStatus): Deleted.
3358         * platform/image-decoders/ico/ICOImageDecoder.h:
3359         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
3360         (WebCore::JPEGImageDecoder::frameBufferAtIndex):
3361         (WebCore::JPEGImageDecoder::decode):
3362         (WebCore::JPEGImageDecoder::encodedDataStatus): Deleted.
3363         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
3364         * platform/image-decoders/png/PNGImageDecoder.cpp:
3365         (WebCore::PNGImageDecoder::frameBufferAtIndex):
3366         (WebCore::PNGImageDecoder::decode):
3367         (WebCore::PNGImageDecoder::encodedDataStatus): Deleted.
3368         * platform/image-decoders/png/PNGImageDecoder.h:
3369         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
3370         (WebCore::WEBPImageDecoder::frameBufferAtIndex):
3371         (WebCore::WEBPImageDecoder::decode):
3372         (WebCore::WEBPImageDecoder::encodedDataStatus): Deleted.
3373         * platform/image-decoders/webp/WEBPImageDecoder.h:
3374
3375 2017-04-27  Carlos Garcia Campos  <cgarcia@igalia.com>
3376
3377         Move UUID from WebCore/platform to WTF
3378         https://bugs.webkit.org/show_bug.cgi?id=171372
3379
3380         Reviewed by Michael Catanzaro.
3381
3382         UUID only contains createCanonicalUUIDString() that is platform independent and doesn't depend on anything from
3383         WebCore, only from WTF.
3384
3385         * CMakeLists.txt:
3386         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
3387         * Modules/mediacontrols/MediaControlsHost.cpp:
3388         * Modules/mediastream/RTCPeerConnection.cpp:
3389         * Modules/webaudio/MediaStreamAudioSource.cpp:
3390         * Modules/webdatabase/DatabaseTracker.cpp:
3391         * WebCore.order:
3392         * WebCore.xcodeproj/project.pbxproj:
3393         * editing/mac/EditorMac.mm:
3394         * fileapi/BlobURL.cpp:
3395         * loader/appcache/ApplicationCacheHost.cpp:
3396         * loader/appcache/ApplicationCacheStorage.cpp:
3397         * platform/URL.cpp:
3398         * platform/glib/FileSystemGlib.cpp:
3399         * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
3400         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
3401         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
3402         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
3403         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3404         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3405         * platform/mediastream/CaptureDeviceManager.cpp:
3406         * platform/mediastream/MediaStreamPrivate.h:
3407         * platform/mediastream/MediaStreamTrackPrivate.cpp:
3408         * platform/mediastream/RealtimeMediaSource.cpp:
3409         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
3410         * platform/mediastream/mac/AVMediaCaptureSource.mm:
3411         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
3412         * platform/mock/MockRealtimeAudioSource.cpp:
3413         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
3414         * platform/mock/MockRealtimeVideoSource.cpp:
3415         * testing/MockCDMFactory.cpp:
3416
3417 2017-04-27  Alex Christensen  <achristensen@webkit.org>
3418
3419         Make navigation policy checking more robust
3420         https://bugs.webkit.org/show_bug.cgi?id=171409
3421         <rdar://problem/31489248>