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