Unreviewed, rolling out r216069.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-05-02  Ryan Haddad  <ryanhaddad@apple.com>
2
3         Unreviewed, rolling out r216069.
4
5         This change broke the build.
6
7         Reverted changeset:
8
9         "Document style resolvers should share user rulesets"
10         https://bugs.webkit.org/show_bug.cgi?id=171549
11         http://trac.webkit.org/changeset/216069
12
13 2017-05-02  Antti Koivisto  <antti@apple.com>
14
15         Document style resolvers should share user rulesets
16         https://bugs.webkit.org/show_bug.cgi?id=171549
17
18         Reviewed by Andreas Kling.
19
20         Large user stylesheets (like those used by ad blockers) can end up using lots of memory if
21         a document uses large number of shadow trees. User style is inherently per-document and
22         the resulting rulesets can be shared between the document and the shadow trees.
23
24         * css/DocumentRuleSets.cpp:
25         (WebCore::DocumentRuleSets::DocumentRuleSets):
26         (WebCore::DocumentRuleSets::userStyle):
27
28             Return per-document user style for shadow trees.
29
30         (WebCore::DocumentRuleSets::collectFeatures):
31         * css/DocumentRuleSets.h:
32         (WebCore::DocumentRuleSets::setUsesSharedUserStyle):
33         (WebCore::DocumentRuleSets::userStyle): Deleted.
34         * css/StyleResolver.cpp:
35         (WebCore::StyleResolver::StyleResolver):
36         (WebCore::StyleResolver::initializeUserStyle):
37
38             Separate user style initialization from construction.
39
40         * css/StyleResolver.h:
41         * style/StyleScope.cpp:
42         (WebCore::Style::Scope::resolver):
43
44             Don't initialize user style for user agents shadow trees.
45
46 2017-05-02  Gwang Yoon Hwang  <yoon@igalia.com>
47
48         [GTK] Remove undefined nativeImage method from the ImageBuffer's header
49         https://bugs.webkit.org/show_bug.cgi?id=171502
50
51         Unreviewed, remove a dead code accidentally committed in r194630.
52
53         * platform/graphics/ImageBuffer.h: Remove nativeImage method.
54         It is accidentally added during a refectorying at r194630, and there is
55         no definition for this method.
56
57 2017-05-02  Carlos Garcia Campos  <cgarcia@igalia.com>
58
59         [GStreamer] Dailymotion live stream videos don't play
60         https://bugs.webkit.org/show_bug.cgi?id=170767
61
62         Reviewed by Sergio Villar Senin.
63
64         The video shows a message saying that an error occurred and nothing is played. There are actually several
65         problems with dailymotion. The main issue is that URLs are redirected by the server, and GStreamer needs to
66         know the redirected URL. Once GStreamer knows the redirected URL the error message no longer appears, the video
67         starts but it always stops after a few seconds. This is because the source receives an early EOS while still
68         downloading the fragments. The reason of the early EOS is because dailymotion sends a wrong Content-Length header,
69         something that is expected to happen and we correctly handle that case when receiving the data, by updating the
70         size accordingly if the bytes received are longer than the expected content length. This particular case
71         doesn't work well with GStreamer automatic EOS handling, which is the default. At some point, GStreamer detects
72         that the bytes received are at least the expected ones and emits a GST_EVENT_EOS that the GstUriDownloader
73         handles finishing the download early. We should always disable automatic EOS, since we know when EOS actually
74         happens and we already call gst_app_src_end_of_stream(). This patch also emits a GST_EVENT_CUSTOM_DOWNSTREAM_STICKY
75         event to let GStreamer know about the HTTP headers sent and received.
76
77         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
78         (webkit_web_src_init): Disable automatic EOS.
79         (webKitWebSrcGetProperty): Return the redirected URL in case of redirection.
80         (webKitWebSrcStart): Pass the ResourceRequest to the stream clients.
81         (webKitWebSrcQueryWithParent): Set the redirected URL in the query in case of redirection.
82         (webKitWebSrcSetUri): Clear also the redirected URL when setting a new URI.
83         (StreamingClient::StreamingClient): Use GRefPtr for the source and initialize the request too.
84         (StreamingClient::~StreamingClient): Remove explicit unref.
85         (StreamingClient::createReadBuffer):
86         (StreamingClient::handleResponseReceived): Initialize the redirected URL in case of redirection. Create and push
87         the HTTP headers event.
88         (StreamingClient::handleDataReceived):
89         (StreamingClient::handleNotifyFinished):
90         (CachedResourceStreamingClient::CachedResourceStreamingClient):
91         (CachedResourceStreamingClient::responseReceived):
92         (CachedResourceStreamingClient::accessControlCheckFailed):
93         (CachedResourceStreamingClient::loadFailed):
94         (ResourceHandleStreamingClient::ResourceHandleStreamingClient):
95         (ResourceHandleStreamingClient::didFail):
96         (ResourceHandleStreamingClient::wasBlocked):
97         (ResourceHandleStreamingClient::cannotShowURL):
98
99 2017-05-02  Youenn Fablet  <youenn@apple.com>
100
101         Adding logging to RTCPeerConnection to allow WebRTC application debugging
102         https://bugs.webkit.org/show_bug.cgi?id=171531
103
104         Reviewed by Jon Lee.
105
106         No change of behavior.
107         This allows easier debugging of webrtc-enabled web pages.
108
109         * Modules/mediastream/PeerConnectionBackend.cpp:
110         (WebCore::PeerConnectionBackend::createOfferSucceeded):
111         (WebCore::PeerConnectionBackend::createOfferFailed):
112         (WebCore::PeerConnectionBackend::createAnswerSucceeded):
113         (WebCore::PeerConnectionBackend::createAnswerFailed):
114         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
115         (WebCore::PeerConnectionBackend::setLocalDescriptionFailed):
116         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
117         (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
118         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
119         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
120         (WebCore::PeerConnectionBackend::newICECandidate):
121         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
122         * Modules/mediastream/RTCPeerConnection.cpp:
123         (WebCore::RTCPeerConnection::queuedCreateOffer):
124         (WebCore::RTCPeerConnection::queuedCreateAnswer):
125         (WebCore::RTCPeerConnection::queuedSetLocalDescription):
126         (WebCore::RTCPeerConnection::queuedSetRemoteDescription):
127         (WebCore::RTCPeerConnection::queuedAddIceCandidate):
128
129 2017-04-12  Carlos Garcia Campos  <cgarcia@igalia.com>
130
131         [GTK] Crash at WebCore::ResourceHandle::clearClient() when streaming live video from dailymotion
132         https://bugs.webkit.org/show_bug.cgi?id=169725
133
134         Reviewed by Michael Catanzaro.
135
136         Make ResourceHandleStreamingClient refcounted and add an invalidate method to do the cleanup in the networking
137         thread while keeping a reference.
138
139         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
140         (webKitWebSrcStop): Call invalidate before reseting client pointer.
141         (webKitWebSrcStart): Ditto.
142         (ResourceHandleStreamingClient::ResourceHandleStreamingClient): Remove all cleanup code after the run loop run call.
143         (ResourceHandleStreamingClient::~ResourceHandleStreamingClient): Just detach the thread.
144         (ResourceHandleStreamingClient::invalidate): Schedule a task on the networking thread to clean up and fiish the
145         run loop, protecting this.
146         (ResourceHandleStreamingClient::setDefersLoading): Protect this.
147         (ResourceHandleStreamingClient::didReceiveResponse): Do nothing if client was invalidated.
148         (ResourceHandleStreamingClient::didReceiveBuffer): Ditto.
149         (ResourceHandleStreamingClient::didFinishLoading): Ditto.
150
151 2017-05-01  Zan Dobersek  <zdobersek@igalia.com>
152
153         [GCrypt] ECDSA signing and verification support
154         https://bugs.webkit.org/show_bug.cgi?id=171103
155
156         Reviewed by Carlos Garcia Campos.
157
158         Implement WebCrypto ECDSA support for configurations that
159         are using libgcrypt.
160
161         For signing, the provided data is first hashed with the specified
162         digest algorithm and embedded into a data s-expression. It's then
163         passed to gcry_pk_sign() along with the private key, returning a
164         sig-val s-expression. The r and s parameters are then retrieved from
165         that sig-val and their data extracted and concatenated in the output
166         Vector<>.
167
168         For verification, the data is again hashed and embedded into a data
169         s-expression. The r and s parameters are extracted from the passed-in
170         signature Vector<> and embedded into a sig-val s-expression. The data
171         and sig-val s-expressions are then passed to gcry_pk_verify() along
172         with the public key. The verification succeeds if no error is returned
173         and fails if the returned error code is GPG_ERR_BAD_SIGNATURE.
174
175         * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
176         (WebCore::hashCryptoDigestAlgorithm):
177         (WebCore::hashAlgorithmName):
178         (WebCore::mpiData):
179         (WebCore::gcryptSign):
180         (WebCore::gcryptVerify):
181         (WebCore::CryptoAlgorithmECDSA::platformSign):
182         (WebCore::CryptoAlgorithmECDSA::platformVerify):
183
184 2017-05-01  Zan Dobersek  <zdobersek@igalia.com>
185
186         [GCrypt] HKDF bit derivation support
187         https://bugs.webkit.org/show_bug.cgi?id=171074
188
189         Reviewed by Michael Catanzaro.
190
191         Implement bit derivation support for the HKDF algorithm for configurations
192         that use libgcrypt.
193
194         libgcrypt doesn't provide HKDF support out of the box, so we have to
195         implement the two steps manually. In the first one, we retrieve the
196         pseudo-random key by using the specified MAC algorithm with the salt data
197         as the key and the key data as the input keying material.
198
199         In the expand step, we do the required amount of iterations to derive
200         a sufficient amount of data, using the same MAC algorithm with the
201         pseudo-random key from the previous step on the data we compose from the
202         previous block data, the info data, and the current iteration value. The
203         resulting blocks are appended together until they can be clipped to the
204         desired output length.
205
206         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
207         (WebCore::macAlgorithmForHashFunction):
208         (WebCore::gcryptDeriveBits):
209         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
210
211 2017-05-01  Zan Dobersek  <zdobersek@igalia.com>
212
213         [GCrypt] ECDH bit derivation support
214         https://bugs.webkit.org/show_bug.cgi?id=171070
215
216         Reviewed by Michael Catanzaro.
217
218         Implement bit derivation support for the ECDH algorithm for configurations
219         that use libgcrypt.
220
221         This is done by retrieving the private key data and wrapping it in a new
222         data s-expression. That's then encrypted with the public key, and the
223         returned s-expression contains the shared point data. That data is then
224         decoded into an EC point, from which the x-coordinate is retrieved. This
225         coordinate data is finally our bit derivation result.
226
227         * crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp:
228         (WebCore::gcryptDerive):
229         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
230
231 2017-05-01  Youenn Fablet  <youenn@apple.com>
232
233         Ensure RealtimeOutgoingVideoSource sends a black frame when its related source is muted
234         https://bugs.webkit.org/show_bug.cgi?id=171497
235
236         Reviewed by Eric Carlson.
237
238         Covered by updated test.
239
240         When the track is being muted or disabled, send a black frame explicitly.
241         VideoToolBox sometimes does not output a frame until it receives the other.
242         That is why we end up sending two frames, the second asynchronously so that libwebrtc will not skip it.
243         Also storing the rotation so that we keep the same rotation for black frames.
244         Storing width and height for consistency as well.
245
246         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
247         (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
248         (WebCore::RealtimeOutgoingVideoSource::setSource):
249         (WebCore::RealtimeOutgoingVideoSource::stop):
250         (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
251         (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
252         (WebCore::RealtimeOutgoingVideoSource::setSizeFromSource):
253         (WebCore::RealtimeOutgoingVideoSource::sendBlackFrame):
254         (WebCore::RealtimeOutgoingVideoSource::sendFrame):
255         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
256         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
257
258 2017-05-01  Joseph Pecoraro  <pecoraro@apple.com>
259
260         Simplify Resource Timing handling of cached resource
261         https://bugs.webkit.org/show_bug.cgi?id=171526
262
263         Reviewed by Youenn Fablet.
264
265         * loader/DocumentThreadableLoader.cpp:
266         (WebCore::DocumentThreadableLoader::loadRequest):
267         * loader/SubresourceLoader.cpp:
268         (WebCore::SubresourceLoader::init):
269         (WebCore::SubresourceLoader::reportResourceTiming):
270         Use auto in ResourceTiming construction.
271         Eliminate an outdated comment.
272
273         * loader/cache/CachedResourceLoader.cpp:
274         (WebCore::CachedResourceLoader::requestResource):
275         We can avoid the checks around the request.origin. It should already
276         be the cases we were checking and asserting because of login in
277         CachedResourceLoader::prepareFetch.
278
279 2017-05-01  Ryan Haddad  <ryanhaddad@apple.com>
280
281         Unreviewed, rolling out r216024.
282
283         This change caused ios-simulator LayoutTests to exit early
284         with assertion failures.
285
286         Reverted changeset:
287
288         "Add audio device change notifications to AudioSession."
289         https://bugs.webkit.org/show_bug.cgi?id=171403
290         http://trac.webkit.org/changeset/216024
291
292 2017-05-01  Timothy Horton  <timothy_horton@apple.com>
293
294         Expose viewport-fit instead of clip-to-safe-area
295         https://bugs.webkit.org/show_bug.cgi?id=171503
296         <rdar://problem/31918249>
297
298         Reviewed by Simon Fraser.
299
300         Tests: fast/viewport/ios/viewport-fit-auto.html
301                fast/viewport/ios/viewport-fit-contain.html
302                fast/viewport/ios/viewport-fit-cover.html
303
304         * dom/ConstantPropertyMap.cpp:
305         (WebCore::ConstantPropertyMap::buildValues):
306         (WebCore::ConstantPropertyMap::updateConstantsForUnobscuredSafeAreaInsets):
307         (WebCore::ConstantPropertyMap::didChangeSafeAreaInsets):
308         (WebCore::ConstantPropertyMap::updateConstantsForObscuredInsets): Deleted.
309         (WebCore::ConstantPropertyMap::didChangeObscuredInsets): Deleted.
310         * dom/ConstantPropertyMap.h:
311         Retrieve the safe area insets from page, instead of assuming that we should
312         just expose the entire obscured inset. Also, do some renames.
313
314         * dom/ViewportArguments.cpp:
315         (WebCore::ViewportArguments::resolve):
316         (WebCore::parseViewportFitValue):
317         (WebCore::setViewportFeature):
318         * dom/ViewportArguments.h:
319         (WebCore::ViewportArguments::operator==):
320         * page/ChromeClient.h:
321         * page/FrameView.cpp:
322         (WebCore::FrameView::enableSpeculativeTilingIfNeeded):
323         (WebCore::FrameView::calculateExtendedBackgroundMode):
324         (WebCore::FrameView::setClipToSafeArea): Deleted.
325         * page/FrameView.h:
326         * page/ViewportConfiguration.cpp:
327         (WebCore::ViewportConfiguration::updateConfiguration):
328         (WebCore::operator<<):
329         (WebCore::ViewportConfiguration::description):
330         (WebCore::ViewportConfiguration::dump):
331         * page/ViewportConfiguration.h:
332         (WebCore::ViewportConfiguration::avoidsUnsafeArea):
333         (WebCore::ViewportConfiguration::Parameters::Parameters):
334         (WebCore::ViewportConfiguration::clipToSafeArea): Deleted.
335         * rendering/RenderLayerCompositor.cpp:
336         (WebCore::RenderLayerCompositor::updateRootContentLayerClipping):
337         * rendering/RenderObject.cpp:
338         (WebCore::RenderObject::repaintUsingContainer):
339         Un-do changes to support clip-to-safe-area, and instead implement
340         a new viewport-fit argument in the viewport meta tag, which takes
341         "auto", "contain", and "cover". "auto" and "contain" cause web content
342         to lay out excluding the safe area inset from the layout size, while
343         "cover" causes web content to expand into the unsafe area.
344
345         * page/Page.cpp:
346         (WebCore::Page::setUnobscuredSafeAreaInsets):
347         (WebCore::Page::setObscuredInsets): Deleted.
348         * page/Page.h:
349         (WebCore::Page::setObscuredInsets):
350         (WebCore::Page::unobscuredSafeAreaInsets):
351         Keep safe area and obscured insets separately.
352
353 2017-05-01  Chris Dumez  <cdumez@apple.com>
354
355         Documents created using DOMParser.parseFromString should inherit their context document's origin / URL
356         https://bugs.webkit.org/show_bug.cgi?id=171499
357
358         Reviewed by Sam Weinig.
359
360         Documents created using DOMParser.parseFromString should inherit their context document's
361         origin / URL:
362         - https://w3c.github.io/DOM-Parsing/#dom-domparser-parsefromstring
363
364         Test: fast/dom/domparser-parsefromstring-origin.html
365
366         * xml/DOMParser.cpp:
367         (WebCore::DOMParser::parseFromString):
368
369 2017-05-01  Ross Kirsling  <ross.kirsling@sony.com>
370
371         Web Inspector: ASSERT(!m_startedComposite) fails when recording on non-Cocoa Timeline
372         https://bugs.webkit.org/show_bug.cgi?id=171363
373
374         Reviewed by Matt Baker.
375
376         * page/FrameView.cpp:
377         (WebCore::FrameView::flushCompositingStateIncludingSubframes): Add PLATFORM(COCOA) guard.
378
379 2017-05-01  David Kilzer  <ddkilzer@apple.com>
380
381         Stop using strcpy() in fullyQualifiedInfoTableName() from Database.cpp
382         <https://webkit.org/b/171517>
383
384         Reviewed by Brady Eidson.
385
386         * Modules/webdatabase/Database.cpp:
387         (WebCore::fullyQualifiedInfoTableName): Switch from strcpy() to
388         snprintf().
389
390 2017-05-01  Chris Fleizach  <cfleizach@apple.com>
391
392         AX: Support time@datetime for verbosity clarification of dates, times, and durations
393         https://bugs.webkit.org/show_bug.cgi?id=171498
394         <rdar://problem/12985540>
395
396         Reviewed by Joanmarie Diggs.
397
398         Expose the datetime attribute value.
399
400         Test: accessibility/datetime-attribute.html
401
402         * accessibility/AccessibilityObject.cpp:
403         (WebCore::AccessibilityObject::datetimeAttributeValue):
404         * accessibility/AccessibilityObject.h:
405         * accessibility/AccessibilityRenderObject.cpp:
406         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
407         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
408         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
409         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
410         (-[WebAccessibilityObjectWrapper accessibilityDatetimeValue]):
411         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
412         (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
413         (createAccessibilityRoleMap):
414         (-[WebAccessibilityObjectWrapper subrole]):
415         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
416
417 2017-05-01  Joseph Pecoraro  <pecoraro@apple.com>
418
419         RejectedPromiseTracker should produce better callstacks and avoid capturing callstacks unless there is a debugger/inspector
420         https://bugs.webkit.org/show_bug.cgi?id=171416
421         <rdar://problem/31899425>
422
423         Reviewed by Saam Barati and Brian Burg.
424
425         Test: inspector/console/message-stack-trace.html
426
427         * dom/RejectedPromiseTracker.cpp:
428         (WebCore::UnhandledPromise::UnhandledPromise):
429         (WebCore::UnhandledPromise::callStack):
430         Switch to RefPtr to allow not capturing the stack.
431
432         (WebCore::createScriptCallStackFromReason):
433         Use the VM's lastException if the value in the exception is the
434         rejected promise value. Using the Exception call stack is important
435         because uncaught exceptions in promise rejections trigger a built-in
436         try/catch and re-enter JavaScript before passing the Error through
437         to the RejectionTracker. When possible, we don't want to capture the
438         new stack originating from the try/catch. Instead, we want the stack
439         from before the try/catch when the error was created.
440
441         * dom/ScriptExecutionContext.h:
442         * dom/ScriptExecutionContext.cpp:
443         (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection):
444         Switch to a pointer since the stack could be empty.
445
446 2017-05-01  Jer Noble  <jer.noble@apple.com>
447
448         Unreviewed build fix after r216033.
449
450         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
451         (WebCore::CoreAudioCaptureSource::create):
452
453 2017-05-01  Jer Noble  <jer.noble@apple.com>
454
455         Use AVAudioSession to enumerate audio capture devices on iOS
456         https://bugs.webkit.org/show_bug.cgi?id=170861
457         <rdar://problem/31653658>
458
459         Reviewed by Eric Carlson.
460
461         Hook up the new AVAudioSessionCaptureDeviceManager class to CoreAudioCaptureSource and to the (increasingly ill-named)
462         RealtimeMediaSourceCenterMac.
463
464         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
465         (WebCore::CoreAudioCaptureSource::create):
466         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
467         (WebCore::RealtimeMediaSourceCenterMac::setUseAVFoundationAudioCapture):
468
469 2017-05-01  Joanmarie Diggs  <jdiggs@igalia.com>
470
471         [ATK] Expose values of aria-rowcount, aria-colcount, aria-rowindex, aria-colindex, aria-rowspan, and aria-colspan as object attributes
472         https://bugs.webkit.org/show_bug.cgi?id=171496
473
474         Reviewed by Chris Fleizach.
475
476         Expose valid, author-provided values as an object attribute. In order to distinguish
477         author-provided values from the default returned by WebCore Accessibility (1), change
478         the default return value to -1. We cannot return 0 because the ARIA spec states that
479         0 is a valid value for authors to provide to indicate that the cell spans the remaining
480         rows in the row group.
481
482         Also removed some legacy code. The "layout-guess" attribute was needed and expected
483         as a way for AT-SPI2-based assistive technologies to identify layout tables. WebCore
484         Accessibility does not expose tables which are purely for layout as accessible tables,
485         and WebKitGtk uses that implementation, thus this attribute is no longer relevant.
486
487         No new tests. Unskipped existing test which is now passing.
488
489         * accessibility/AccessibilityARIAGridCell.cpp:
490         (WebCore::AccessibilityARIAGridCell::ariaRowSpanWithRowIndex):
491         (WebCore::AccessibilityARIAGridCell::columnIndexRange):
492         * accessibility/AccessibilityTableCell.cpp:
493         (WebCore::AccessibilityTableCell::ariaColumnSpan):
494         (WebCore::AccessibilityTableCell::ariaRowSpan):
495         * accessibility/AccessibilityTableCell.h:
496         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
497         (webkitAccessibleGetAttributes):
498
499 2017-05-01  Jer Noble  <jer.noble@apple.com>
500
501         Add audio device change notifications to AudioSession.
502         https://bugs.webkit.org/show_bug.cgi?id=171403
503
504         Reviewed by Eric Carlson.
505
506         Add notifications to AudioSession which fire when the current input and output audio devices
507         change. Also add a notification when audio services are lost (which will only fire on iOS).
508         Take this opportunity to make the existing hardwareMutedStateDidChange() notification be
509         platform agnostic, to move the outputDeviceSupportsLowPowerMode() code from AudioHardwareListener,
510         and to do a few more clean-ups of the AudioSession code.
511
512         * WebCore.xcodeproj/project.pbxproj:
513         * html/HTMLMediaElement.cpp:
514         (WebCore::HTMLMediaElement::HTMLMediaElement):
515         (WebCore::HTMLMediaElement::~HTMLMediaElement):
516         * html/HTMLMediaElement.h:
517         * platform/audio/AudioSession.cpp:
518         (WebCore::AudioSession::AudioSession):
519         * platform/audio/AudioSession.h:
520         (WebCore::AudioSession::Observer::hardwareMutedStateDidChange):
521         (WebCore::AudioSession::Observer::audioInputDeviceChanged):
522         (WebCore::AudioSession::Observer::audioOutputDeviceChanged):
523         (WebCore::AudioSession::Observer::audioServicesLost):
524         (WebCore::AudioSession::Observer::audioServicesReset):
525         (WebCore::AudioSession::MutedStateObserver::~MutedStateObserver): Deleted.
526         * platform/audio/ios/AudioSessionIOS.mm:
527         (WebCore::AudioSessionPrivate::AudioSessionPrivate):
528         (WebCore::AudioSession::AudioSession):
529         (WebCore::AudioSession::setCategoryOverride):
530         (WebCore::AudioSession::categoryOverride):
531         (WebCore::AudioSession::isMuted):
532         (WebCore::AudioSession::outputDeviceSupportsLowPowerMode):
533         (WebCore::AudioSession::addObserver):
534         (WebCore::AudioSession::removeObserver):
535         * platform/audio/mac/AudioSessionMac.mm: Renamed from Source/WebCore/platform/audio/mac/AudioSessionMac.cpp.
536         (WebCore::defaultDevice):
537         (WebCore::AudioSessionPrivate::AudioSessionPrivate):
538         (WebCore::AudioSession::AudioSession):
539         (WebCore::AudioSession::~AudioSession):
540         (WebCore::AudioSession::category):
541         (WebCore::AudioSession::setCategory):
542         (WebCore::AudioSession::categoryOverride):
543         (WebCore::AudioSession::setCategoryOverride):
544         (WebCore::AudioSession::sampleRate):
545         (WebCore::AudioSession::bufferSize):
546         (WebCore::AudioSession::numberOfOutputChannels):
547         (WebCore::AudioSession::tryToSetActive):
548         (WebCore::AudioSession::preferredBufferSize):
549         (WebCore::AudioSession::setPreferredBufferSize):
550         (WebCore::AudioSession::isMuted):
551         (WebCore::currentDeviceSupportsLowPowerBufferSize):
552         (WebCore::AudioSession::outputDeviceSupportsLowPowerMode):
553         (WebCore::AudioSession::addObserver):
554         (WebCore::AudioSession::removeObserver):
555
556 2017-05-01  Chris Dumez  <cdumez@apple.com>
557
558         Do not dispatch SVG load event in frameless documents
559         https://bugs.webkit.org/show_bug.cgi?id=171505
560         <rdar://problem/31799776>
561
562         Reviewed by Andreas Kling.
563
564         We should not dispatch SVG load events in frameless documents. <https://trac.webkit.org/changeset/173028/webkit>
565         took care of most load events but forgot the SVG load event.
566
567         Test: fast/dom/domparser-parsefromstring-svg-load-event.html
568
569         * dom/Document.cpp:
570         (WebCore::Document::implicitClose):
571
572 2017-05-01  Chris Dumez  <cdumez@apple.com>
573
574         Remove some usage of PassRefPtr in editing code
575         https://bugs.webkit.org/show_bug.cgi?id=171490
576
577         Reviewed by Darin Adler.
578
579         Remove some usage of PassRefPtr in editing code.
580
581         * dom/DocumentMarkerController.cpp:
582         (WebCore::DocumentMarkerController::markersInRange):
583         (DocumentMarkerController::hasMarkers):
584         (DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange):
585         * dom/DocumentMarkerController.h:
586         * editing/AlternativeTextController.cpp:
587         (WebCore::AlternativeTextController::isSpellingMarkerAllowed):
588         (WebCore::AlternativeTextController::show):
589         (WebCore::AlternativeTextController::applyAlternativeTextToRange):
590         (WebCore::AlternativeTextController::timerFired):
591         (WebCore::AlternativeTextController::handleAlternativeTextUIResult):
592         (WebCore::AlternativeTextController::recordAutocorrectionResponse):
593         (WebCore::AlternativeTextController::markReversed):
594         (WebCore::AlternativeTextController::markCorrection):
595         (WebCore::AlternativeTextController::recordSpellcheckerResponseForModifiedCorrection):
596         (WebCore::AlternativeTextController::processMarkersOnTextToBeReplacedByResult):
597         (WebCore::AlternativeTextController::applyDictationAlternative):
598         * editing/AlternativeTextController.h:
599         (WebCore::AlternativeTextController::UNLESS_ENABLED):
600         * editing/ApplyStyleCommand.cpp:
601         (WebCore::createFontElement):
602         (WebCore::createStyleSpanElement):
603         (WebCore::ApplyStyleCommand::ApplyStyleCommand):
604         (WebCore::copyStyleOrCreateEmpty):
605         (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
606         (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
607         (WebCore::ApplyStyleCommand::removeConflictingInlineStyleFromRun):
608         (WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
609         (WebCore::ApplyStyleCommand::highestAncestorWithConflictingInlineStyle):
610         (WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
611         (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
612         (WebCore::ApplyStyleCommand::removeInlineStyle):
613         (WebCore::ApplyStyleCommand::shouldSplitTextElement):
614         (WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
615         (WebCore::ApplyStyleCommand::addInlineStyleIfNeeded):
616         (WebCore::ApplyStyleCommand::positionToComputeInlineStyleChange):
617         (WebCore::ApplyStyleCommand::applyInlineStyleChange):
618         * editing/ApplyStyleCommand.h:
619         (WebCore::ApplyStyleCommand::create):
620         (WebCore::ApplyStyleCommand::shouldRemoveInlineStyleFromElement):
621         * editing/CompositeEditCommand.cpp:
622         (WebCore::CompositeEditCommand::applyCommandToComposite):
623         (WebCore::CompositeEditCommand::applyStyledElement):
624         (WebCore::CompositeEditCommand::removeStyledElement):
625         (WebCore::CompositeEditCommand::replaceElementWithSpanPreservingChildrenAndAttributes):
626         (WebCore::CompositeEditCommand::inputText):
627         (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers):
628         (WebCore::CompositeEditCommand::pushAnchorElementDown):
629         * editing/CompositeEditCommand.h:
630         * editing/DeleteSelectionCommand.cpp:
631         (WebCore::DeleteSelectionCommand::originalStringForAutocorrectionAtBeginningOfSelection):
632         * editing/DictationCommand.cpp:
633         (WebCore::DictationCommand::insertTextRunWithoutNewlines):
634         * editing/EditingStyle.cpp:
635         (WebCore::copyEditingProperties):
636         (WebCore::copyPropertiesFromComputedStyle):
637         (WebCore::extractPropertyValue):
638         (WebCore::HTMLAttributeEquivalent::attributeValueAsCSSValue):
639         (WebCore::HTMLFontSizeEquivalent::attributeValueAsCSSValue):
640         (WebCore::EditingStyle::setStyle):
641         (WebCore::EditingStyle::copy):
642         (WebCore::EditingStyle::extractAndRemoveBlockProperties):
643         (WebCore::EditingStyle::extractAndRemoveTextDirection):
644         (WebCore::EditingStyle::mergeInlineStyleOfElement):
645         (WebCore::extractEditingProperties):
646         (WebCore::EditingStyle::styleAtSelectionStart):
647         (WebCore::getPropertiesNotIn):
648         * editing/EditingStyle.h:
649         * editing/Editor.cpp:
650         (WebCore::Editor::handleTextEvent):
651         (WebCore::Editor::replaceSelectionWithFragment):
652         (WebCore::Editor::insertOrderedList):
653         (WebCore::Editor::insertUnorderedList):
654         (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
655         (WebCore::correctSpellcheckingPreservingTextCheckingParagraph):
656         (WebCore::Editor::markAndReplaceFor):
657         (WebCore::Editor::changeBackToReplacedString):
658         (WebCore::Editor::updateMarkersForWordsAffectedByEditing):
659         (WebCore::Editor::rangeForPoint):
660         * editing/Editor.h:
661         * editing/ModifySelectionListLevel.cpp:
662         (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevel):
663         (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevelOrdered):
664         (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevelUnordered):
665         * editing/ModifySelectionListLevel.h:
666         * editing/SpellChecker.cpp:
667         (WebCore::SpellChecker::requestCheckingFor):
668         (WebCore::SpellChecker::didCheckSucceed):
669         * editing/SpellChecker.h:
670         (WebCore::SpellCheckRequest::checkingRange):
671         (WebCore::SpellCheckRequest::paragraphRange):
672         (WebCore::SpellCheckRequest::rootEditableElement):
673         * editing/SpellingCorrectionCommand.cpp:
674         (WebCore::SpellingCorrectionCommand::SpellingCorrectionCommand):
675         (WebCore::SpellingCorrectionCommand::willApplyCommand):
676         (WebCore::SpellingCorrectionCommand::doApply):
677         (WebCore::SpellingCorrectionCommand::targetRanges):
678         * editing/SpellingCorrectionCommand.h:
679         (WebCore::SpellingCorrectionCommand::create):
680         * editing/SurroundingText.h:
681         * editing/TextCheckingHelper.cpp:
682         (WebCore::TextCheckingParagraph::expandRangeToNextEnd):
683         (WebCore::TextCheckingParagraph::rangeLength):
684         (WebCore::TextCheckingParagraph::paragraphRange):
685         (WebCore::TextCheckingParagraph::subrange):
686         (WebCore::TextCheckingParagraph::offsetTo):
687         (WebCore::TextCheckingParagraph::offsetAsRange):
688         (WebCore::TextCheckingParagraph::text):
689         (WebCore::TextCheckingParagraph::checkingStart):
690         * editing/TextCheckingHelper.h:
691         * editing/TypingCommand.cpp:
692         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
693         * editing/cocoa/HTMLConverter.mm:
694         (HTMLConverterCaches::computedStylePropertyForElement):
695         (HTMLConverterCaches::inlineStylePropertyForElement):
696         * page/ios/FrameIOS.mm:
697         (WebCore::Frame::interpretationsForCurrentRoot):
698
699 2017-05-01  Jer Noble  <jer.noble@apple.com>
700
701         Add notifications from CaptureDeviceManager (and subclasses) when device lists change
702         https://bugs.webkit.org/show_bug.cgi?id=171442
703
704         Reviewed by Youenn Fablet.
705
706         Add a new callback-based notification to CaptureDeviceManager which fires when the underlying list
707         of devices changes. Add support for enumerating AVAudioSession capture devices.
708
709         * WebCore.xcodeproj/project.pbxproj:
710         * platform/mediastream/CaptureDeviceManager.cpp:
711         (nextObserverToken):
712         (CaptureDeviceManager::addCaptureDeviceChangedObserver):
713         (CaptureDeviceManager::removeCaptureDeviceChangedObserver):
714         * platform/mediastream/CaptureDeviceManager.h:
715         * platform/mediastream/ios/AVAudioSessionCaptureDevice.h: Added.
716         * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm: Added.
717         (WebCore::AVAudioSessionCaptureDevice::create):
718         (WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice):
719         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h: Added.
720         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm: Added.
721         (-[WebAVAudioSessionAvailableInputsListener initWithCallback:]):
722         (-[WebAVAudioSessionAvailableInputsListener invalidate]):
723         (-[WebAVAudioSessionAvailableInputsListener observeValueForKeyPath:ofObject:change:context:]):
724         (WebCore::AVAudioSessionCaptureDeviceManager::singleton):
725         (WebCore::AVAudioSessionCaptureDeviceManager::captureDevices):
726         (WebCore::AVAudioSessionCaptureDeviceManager::audioSessionCaptureDevices):
727         (WebCore::AVAudioSessionCaptureDeviceManager::audioSessionDeviceWithUID):
728         (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices):
729         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
730         (WebCore::AVCaptureDeviceManager::deviceConnected):
731         (WebCore::AVCaptureDeviceManager::deviceDisconnected):
732         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
733         (WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices):
734         (WebCore::CoreAudioCaptureDeviceManager::devicesChanged):
735
736 2017-05-01  Joanmarie Diggs  <jdiggs@igalia.com>
737
738         AX: AccessibilityTable::ariaRowCount() and ariaColumnCount() should not return -1 unless that is the author-provided value
739         https://bugs.webkit.org/show_bug.cgi?id=171475
740
741         Reviewed by Chris Fleizach.
742
743         If the author has provided a valid value, return it. Otherwise, return 0.
744
745         No new tests needed. Update existing test expectations to reflect the change.
746
747         * accessibility/AccessibilityTable.cpp:
748         (WebCore::AccessibilityTable::ariaColumnCount):
749         (WebCore::AccessibilityTable::ariaRowCount):
750
751 2017-05-01  Joanmarie Diggs  <jdiggs@igalia.com>
752
753         AX: Implement support for ARIA "figure" and "term" roles; update AXRoleDescription mapping for "feed" role
754         https://bugs.webkit.org/show_bug.cgi?id=171183
755
756         Reviewed by Chris Fleizach.
757
758         Create FeedRole, FigureRole, and TermRole and map them on the Mac and Gtk
759         ports. Also rename AccessibilityObject::isFigure() to isFigureElement()
760         for clarity as this method is specific to the HTML element and not the role.
761
762         No new tests needed: We have existing tests that cover mappings. Add new test cases
763         to roles-exposed.html, xml-roles-exposed.html, and roles-computedRoleString.html.
764
765         * English.lproj/Localizable.strings:
766         * accessibility/AccessibilityNodeObject.cpp:
767         (WebCore::AccessibilityNodeObject::captionForFigure):
768         (WebCore::AccessibilityNodeObject::alternativeText):
769         * accessibility/AccessibilityObject.cpp:
770         (WebCore::initializeRoleMap):
771         (WebCore::AccessibilityObject::isFigureElement): Added.
772         (WebCore::AccessibilityObject::isFigure): Deleted.
773         * accessibility/AccessibilityObject.h:
774         * accessibility/AccessibilityRenderObject.cpp:
775         (WebCore::AccessibilityRenderObject::exposesTitleUIElement):
776         (WebCore::AccessibilityRenderObject::titleUIElement):
777         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
778         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
779         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
780         (atkRole):
781         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
782         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
783         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
784         (createAccessibilityRoleMap):
785         (-[WebAccessibilityObjectWrapper subrole]):
786         (-[WebAccessibilityObjectWrapper roleDescription]):
787         * platform/LocalizedStrings.cpp:
788         (WebCore::AXFeedText):
789         * platform/LocalizedStrings.h:
790
791 2017-04-30  Chris Dumez  <cdumez@apple.com>
792
793         Drop support for legacy ClientRect / ClientRectList
794         https://bugs.webkit.org/show_bug.cgi?id=171418
795
796         Reviewed by Sam Weinig.
797
798         Drop support for legacy ClientRect / ClientRectList types now we use
799         DOMRect everywhere.
800
801         * CMakeLists.txt:
802         * DerivedSources.cpp:
803         * DerivedSources.make:
804         * WebCore.xcodeproj/project.pbxproj:
805         * dom/ClientRect.cpp: Removed.
806         * dom/ClientRect.h: Removed.
807         * dom/ClientRect.idl: Removed.
808         * dom/ClientRectList.cpp: Removed.
809         * dom/ClientRectList.h: Removed.
810         * dom/ClientRectList.idl: Removed.
811         * dom/DOMAllInOne.cpp:
812         * dom/Element.cpp:
813         * html/HTMLMediaElement.cpp:
814         * html/track/VTTRegion.cpp:
815         * page/DragController.cpp:
816
817 2017-04-30  Zalan Bujtas  <zalan@apple.com>
818
819         Initialize a new layout state while bailing out of simple line layout only when needed.
820         https://bugs.webkit.org/show_bug.cgi?id=171481
821         <rdar://problem/31906382>
822
823         '-webkit-border-fit: lines' requires inline box tree.
824         We normally bail out of simple line layout early when we see this property. 
825         When this property is dynamically set and we already have a simple line layout context,
826         RenderBlockFlow::ensureLineBoxes() takes care of the switch by calling layoutLineBoxes().
827         This patch makes sure that we create the layout state for this (forced)line layout only when
828         we don't yet have one.
829
830         Reviewed by Antti Koivisto.
831
832         Test: fast/multicol/simple-line-layout-switch-to-normal-layout-while-inside-layout.html
833
834         * rendering/RenderBlockFlow.cpp:
835         (WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer):
836         (WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer):
837         (WebCore::RenderBlockFlow::ensureLineBoxes):
838         * rendering/RenderView.cpp:
839         (WebCore::RenderView::pushLayoutStateForPaginationIfNeeded):
840         (WebCore::RenderView::pushLayoutStateForPagination): Deleted.
841         * rendering/RenderView.h:
842
843 2017-04-30  Dan Bernstein  <mitz@apple.com>
844
845         Tried to fix the iOS build after r215992
846
847         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
848
849 2017-04-30  Brady Eidson  <beidson@apple.com>
850
851         Fix r215991
852         https://bugs.webkit.org/show_bug.cgi?id=171483
853
854         Unreviewed.
855
856         * platform/spi/cf/CFNetworkSPI.h:
857
858 2017-04-30  Dan Bernstein  <mitz@apple.com>
859
860         Tried to fix the iOS build after r215992
861
862         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
863         (WebAVPlayerLayerView_pictureInPicturePlayerLayerView):
864         (WebVideoFullscreenInterfaceAVKit::setupFullscreen):
865
866 2017-04-30  Dan Bernstein  <mitz@apple.com>
867
868         [Cocoa] Replaces uses of [get…() alloc] with alloc…Instance()
869         https://bugs.webkit.org/show_bug.cgi?id=171485
870
871         Reviewed by Geoffrey Garen.
872
873         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
874         (WebCore::CDMSessionAVContentKeySession::contentKeySession):
875         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
876         (WebCore::MediaPlaybackTargetPickerMac::devicePicker):
877         * platform/ios/ValidationBubbleIOS.mm:
878         (-[WebValidationBubbleTapRecognizer initWithPopoverController:]):
879         (WebCore::ValidationBubble::ValidationBubble):
880         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
881         (WebVideoFullscreenControllerContext::setUpFullscreen):
882         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
883         (WebAVPlayerLayerView_pictureInPicturePlayerLayerView):
884         (WebVideoFullscreenInterfaceAVKit::setupFullscreen):
885         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
886         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]):
887         * platform/network/ios/PreviewConverter.mm:
888         (WebCore::PreviewConverter::PreviewConverter):
889         * rendering/RenderThemeIOS.mm:
890         (WebCore::iconForAttachment):
891
892 2017-04-30  Brady Eidson  <beidson@apple.com>
893
894         Updates to _WKWebsiteDataStoreConfiguration cookie storage location SPI.
895         <rdar://problem/31906397> and https://bugs.webkit.org/show_bug.cgi?id=171483
896
897         Reviewed by Geoff Garen (and kind of Andy Estes).
898
899         No new tests (Covered by API test).
900
901         * platform/spi/cf/CFNetworkSPI.h:
902
903 2017-04-30  Dan Bernstein  <mitz@apple.com>
904
905         <rdar://problem/31906525> WebCore-7604.1.19 has failed to build
906
907         * platform/ios/WebItemProviderPasteboard.mm:
908         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]): Resolved type ambiguity
909           by using allocUIItemProviderInstance() instead of [getUIItemProviderClass() alloc].
910
911 2017-04-30  Joanmarie Diggs  <jdiggs@igalia.com>
912
913         [ATK] Implement support for aria-autocomplete
914         https://bugs.webkit.org/show_bug.cgi?id=171167
915
916         Reviewed by Chris Fleizach.
917
918         Expose ATK_STATE_SUPPORTS_AUTOCOMPLETION in the state set, and the value
919         of aria-autocomplete as an object attribute, for elements which indicate
920         they support autocompletion.
921
922         Test: accessibility/gtk/aria-autocomplete.html
923
924         * accessibility/AccessibilityObject.cpp:
925         (WebCore::AccessibilityObject::supportsARIAAutoComplete):
926         (WebCore::AccessibilityObject::ariaAutoCompleteValue):
927         * accessibility/AccessibilityObject.h:
928         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
929         (webkitAccessibleGetAttributes):
930         (setAtkStateSetFromCoreObject):
931         * html/HTMLAttributeNames.in:
932
933 2017-04-30  Joanmarie Diggs  <jdiggs@igalia.com>
934
935         [ATK] ARIA treegrid role should be exposed as ATK_ROLE_TREE_TABLE; not ATK_ROLE_TABLE
936         https://bugs.webkit.org/show_bug.cgi?id=171170
937
938         Reviewed by Chris Fleizach.
939
940         AccessibilityTable::roleValue() was returning GridRole for both grid and treegrid.
941         Change this so that GridRole is returned for grid and TreeGridRole is returned for
942         treegrid. Add TreeGridRole to, or call isTable() in, methods where the behavior
943         should be the same as GridRole.
944
945         Test: accessibility/gtk/interface-table.html
946
947         * accessibility/AccessibilityRenderObject.cpp:
948         (WebCore::AccessibilityRenderObject::selectedChildren):
949         * accessibility/AccessibilityTable.cpp:
950         (WebCore::AccessibilityTable::roleValue):
951         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
952         (atkRole):
953         (getInterfaceMaskFromObject):
954         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
955         (-[WebAccessibilityObjectWrapper _accessibilityTableAncestor]):
956         (-[WebAccessibilityObjectWrapper _accessibilityTraitsFromAncestors]):
957         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
958         (createAccessibilityRoleMap):
959
960 2017-04-30  Joanmarie Diggs  <jdiggs@igalia.com>
961
962         [ATK] Emit object:state-changed:busy event when aria-busy value changes
963         https://bugs.webkit.org/show_bug.cgi?id=171181
964
965         Reviewed by Chris Fleizach.
966
967         Emit object:state-changed:busy for AXElementBusyChanged notifications.
968
969         Test: accessibility/gtk/aria-busy-changed-notification.html
970
971         * accessibility/atk/AXObjectCacheAtk.cpp:
972         (WebCore::AXObjectCache::postPlatformNotification):
973
974 2017-04-29  Joseph Pecoraro  <pecoraro@apple.com>
975
976         Zero out PerformanceResourceTiming properties for cached cross-origin responses without Timing-Allow-Origin
977         https://bugs.webkit.org/show_bug.cgi?id=171394
978
979         Reviewed by Youenn Fablet.
980
981         * loader/ResourceTiming.cpp:
982         (WebCore::ResourceTiming::fromCache):
983         (WebCore::ResourceTiming::ResourceTiming):
984         * loader/ResourceTiming.h:
985         * loader/cache/CachedResourceLoader.cpp:
986         (WebCore::CachedResourceLoader::requestResource):
987         Include the timing-allow-origin check for cached responses.
988         Also, avoid including an extra entry for an ongoing cached resource
989         load, since when that load completes it should be reported.
990
991 2017-04-29  Youenn Fablet  <youenn@apple.com>
992
993         Readd assertion removed accidentally in r215955
994         https://bugs.webkit.org/show_bug.cgi?id=171466
995
996         Reviewed by Eric Carlson.
997
998         Unreviewed.
999
1000         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1001         (WebCore::MockRealtimeVideoSourceMac::orientationChanged): Improved FIXME after review.
1002
1003 2017-04-29  Andy Estes  <aestes@apple.com>
1004
1005         [macOS] Picture-in-picture should be disabled in WebPlaybackControlsManager during external media playback
1006         https://bugs.webkit.org/show_bug.cgi?id=171468
1007         <rdar://problem/31900349>
1008
1009         Reviewed by Eric Carlson.
1010
1011         * platform/mac/WebPlaybackControlsManager.h: Declared canTogglePictureInPicture as a
1012         readwrite property.
1013         * platform/mac/WebPlaybackControlsManager.mm: Synthesize canTogglePictureInPicture.
1014         (-[WebPlaybackControlsManager canTogglePictureInPicture]): Deleted.
1015         * platform/mac/WebPlaybackSessionInterfaceMac.h:
1016         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
1017         (WebCore::WebPlaybackSessionInterfaceMac::externalPlaybackChanged): Called
1018         -[WebPlaybackControlsManager setCanTogglePictureInPicture:].
1019
1020 2017-04-29  Simon Fraser  <simon.fraser@apple.com>
1021
1022         Fix tests broken by r215964.
1023
1024         Fix copy-paste error that caused the wrong paint phase to get passed to the fire writeLayerRenderers()
1025         call, causing extra renderer dumping.
1026
1027         Also remove unused default arguments.
1028
1029         * rendering/RenderTreeAsText.cpp:
1030         (WebCore::writeLayerRenderers):
1031         (WebCore::writeLayers):
1032
1033 2017-04-28  Zalan Bujtas  <zalan@apple.com>
1034
1035         iBooks text can overlap, sometimes columns are shifted splitting words.
1036         https://bugs.webkit.org/show_bug.cgi?id=171472
1037         <rdar://problem/31096037>
1038
1039         Reviewed by Antti Koivisto.
1040
1041         Instead of just checking if the glyph is taller than the line, we need to ensure that both the
1042         ascent and the descent have enough space (this is for -webkit-line-box-contain: glyph).
1043
1044         Test: fast/text/simple-line-layout-glyph-overflows-line.html
1045
1046         * rendering/SimpleLineLayout.cpp:
1047         (WebCore::SimpleLineLayout::canUseForText): compute the available space for the ascent/descent
1048         and check them against the ceil-ed(see FontCascade::floatWidthForSimpleText) glyph min/max y.
1049
1050 2017-04-29  Nan Wang  <n_wang@apple.com>
1051
1052         AX: Improve performance of addChildren()/childrenChanged()
1053         https://bugs.webkit.org/show_bug.cgi?id=171443
1054
1055         Reviewed by Chris Fleizach.
1056
1057         There's a lot of unnecessary work happening when childrenChanged() is being called.
1058         Some of the improvements here:
1059         1. When childrenChanged() is being called on some element, we are marking its parent
1060            chain dirty. However, in the addChild() method we are then clearing each child of
1061            that 'dirty' parent, eventually making the entire tree dirty. 
1062            Added a m_subTreeDirty flag and using the needsToUpdateChildren() check to make sure
1063            we are only clearing the right chain without updating the unchanged siblings.
1064         2. In the addChild() method we are calling accessibilityIsIgnored() on each child and that 
1065            might lead to going up the parent chain again to get necessary information. 
1066            Since we are already traversing the tree from top to bottom to add children, added a 
1067            struct to store the information and pass it to the child so to avoid unnecessary traversal.
1068         3. Reduced the amount work of ARIA text controls perform when updating its parents in childrenChanged() 
1069            so that we don't update a big portion of the tree while typing.
1070
1071         No new tests since this didn't change any functionality. 
1072
1073         * accessibility/AccessibilityNodeObject.cpp:
1074         (WebCore::AccessibilityNodeObject::AccessibilityNodeObject):
1075         (WebCore::AccessibilityNodeObject::childrenChanged):
1076         (WebCore::AccessibilityNodeObject::insertChild):
1077         (WebCore::AccessibilityNodeObject::addChildren):
1078         (WebCore::AccessibilityNodeObject::isDescendantOfBarrenParent):
1079         * accessibility/AccessibilityNodeObject.h:
1080         * accessibility/AccessibilityObject.cpp:
1081         (WebCore::AccessibilityObject::AccessibilityObject):
1082         (WebCore::AccessibilityObject::defaultObjectInclusion):
1083         (WebCore::AccessibilityObject::setIsIgnoredFromParentDataForChild):
1084         * accessibility/AccessibilityObject.h:
1085         (WebCore::AccessibilityIsIgnoredFromParentData::AccessibilityIsIgnoredFromParentData):
1086         (WebCore::AccessibilityIsIgnoredFromParentData::isNull):
1087         (WebCore::AccessibilityObject::setNeedsToUpdateSubTree):
1088         (WebCore::AccessibilityObject::needsToUpdateChildren):
1089         (WebCore::AccessibilityObject::setIsIgnoredFromParentData):
1090         * accessibility/AccessibilityRenderObject.cpp:
1091         (WebCore::AccessibilityRenderObject::updateChildrenIfNecessary):
1092         (WebCore::AccessibilityRenderObject::addChildren):
1093         * accessibility/AccessibilityRenderObject.h:
1094         (WebCore::AccessibilityRenderObject::setRenderObject):
1095         (WebCore::AccessibilityRenderObject::needsToUpdateChildren): Deleted.
1096
1097 2017-04-29  Yusuke Suzuki  <utatane.tea@gmail.com>
1098
1099         Move WebCore CPUTime to WTF and implement it in all the platforms
1100         https://bugs.webkit.org/show_bug.cgi?id=171477
1101
1102         Reviewed by Chris Dumez.
1103
1104         Move CPUTime to WTF. And rename getCPUTime to CPUTime::get().
1105
1106         * CMakeLists.txt:
1107         * PlatformMac.cmake:
1108         * WebCore.xcodeproj/project.pbxproj:
1109         * page/ChromeClient.h:
1110         * page/PerformanceMonitor.cpp:
1111         (WebCore::PerformanceMonitor::PerformanceMonitor):
1112         (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
1113         (WebCore::PerformanceMonitor::measurePostBackgroundingCPUUsage):
1114         (WebCore::PerformanceMonitor::measureCPUUsageInActivityState):
1115         * page/PerformanceMonitor.h:
1116         * platform/CPUMonitor.cpp:
1117         (WebCore::CPUMonitor::setCPULimit):
1118         (WebCore::CPUMonitor::timerFired):
1119         * platform/CPUMonitor.h:
1120
1121 2017-04-28  Per Arne Vollan  <pvollan@apple.com>
1122
1123         Crash under WebCore::AccessibilityRenderObject::handleAriaExpandedChanged().
1124         https://bugs.webkit.org/show_bug.cgi?id=171427
1125         rdar://problem/31863417
1126
1127         Reviewed by Brent Fulgham.
1128
1129         The AccessibilityRenderObject object might delete itself in handleAriaExpandedChanged() under the call
1130         to the parentObject() method. This will cause a crash when accessing the object later in this method.
1131         Protect the current object while executing arbitrary event code.
1132
1133         Test: accessibility/accessibility-crash-setattribute.html
1134
1135         * accessibility/AccessibilityRenderObject.cpp:
1136         (WebCore::AccessibilityRenderObject::handleAriaExpandedChanged):
1137
1138 2017-04-28  Chris Dumez  <cdumez@apple.com>
1139
1140         Diagnostic logging of navigations is too verbose
1141         https://bugs.webkit.org/show_bug.cgi?id=171455
1142         <rdar://problem/31543815>
1143
1144         Reviewed by Andreas Kling.
1145
1146         Diagnostic logging of navigation is too verbose. We log things that are not actually user
1147         navigations (e.g. speculative loads, bookmark icon fetches, ...). To address the issue,
1148         we now only log *observable* loads. We do so by only logging if the page is visible or
1149         if it becomes visible.
1150
1151         * loader/FrameLoader.cpp:
1152         (WebCore::FrameLoader::loadWithDocumentLoader):
1153         (WebCore::logNavigation): Deleted.
1154         * page/Page.cpp:
1155         (WebCore::Page::setIsVisibleInternal):
1156         (WebCore::Page::logNavigation):
1157         (WebCore::Page::mainFrameLoadStarted):
1158         * page/Page.h:
1159
1160 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
1161
1162         AX: ARIA "region" role which lacks an accessible name should not be treated as a landmark
1163         https://bugs.webkit.org/show_bug.cgi?id=171180
1164
1165         Reviewed by Chris Fleizach.
1166
1167         Remove mapping of LandmarkRegionRole for regions which lack an accessible name.
1168         Doing so had a side effect of causing a number of DPub ARIA roles to stop being
1169         mapped as ARIA landmarks. This is due to our internal role mappings, namely
1170         treating the DPub ARIA landmark roles as if they were regions. Because DPub's
1171         landmarks do not subclass region, and do not have the same name-from-author
1172         requirement as region, create a new LandmarkDocRegionRole AccessibilityRole and
1173         map DPub ARIA's generic landmarks to it.
1174
1175         No new tests because we already have sufficient coverage. Several existing
1176         tests were given additional test cases to cover named and unnamed regions,
1177         and test expectations updated accordingly.
1178
1179         * accessibility/AccessibilityNodeObject.cpp:
1180         (WebCore::AccessibilityNodeObject::determineAriaRoleAttribute):
1181         * accessibility/AccessibilityObject.cpp:
1182         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent):
1183         (WebCore::AccessibilityObject::isLandmark):
1184         (WebCore::initializeRoleMap):
1185         (WebCore::AccessibilityObject::computedRoleString):
1186         * accessibility/AccessibilityObject.h:
1187         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1188         (atkRole):
1189         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1190         (-[WebAccessibilityObjectWrapper _accessibilityIsLandmarkRole:]):
1191         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
1192         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
1193         (-[WebAccessibilityObjectWrapperBase ariaLandmarkRoleDescription]):
1194         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1195         (createAccessibilityRoleMap):
1196         (-[WebAccessibilityObjectWrapper subrole]):
1197
1198 2017-04-28  Simon Fraser  <simon.fraser@apple.com>
1199
1200         Enhance showLayerTree() to show fragments
1201         https://bugs.webkit.org/show_bug.cgi?id=171469
1202
1203         Reviewed by Zalan Bujtas.
1204
1205         Have showLayerTree() dump fragments, like:
1206
1207              normal flow list(1)
1208               layer 0x11c1879c0 at (0,0) size 700x1858 backgroundClip at (0,0) size 2120x779 clip at (0,0) size 2120x779
1209                    fragment 0: bounds in layer at (0,0) size 700x1858 fragment bounds at (0,0) size 700x779
1210                    fragment 1: bounds in layer at (710,-779) size 700x1858 fragment bounds at (710,0) size 700x779
1211                    fragment 2: bounds in layer at (1420,-1558) size 700x1858 fragment bounds at (1420,0) size 700x300
1212                 RenderMultiColumnFlowThread 0x11f1f3340 at (0,0) size 700x1858
1213
1214         We want these to show before the child renderers, so factor that code into writeLayerRenderers().
1215         
1216         Overloading of write() for layers doesn't help anyone, so call it writeLayer() for searchability.
1217
1218         * rendering/RenderLayer.cpp:
1219         (WebCore::showLayerTree):
1220         * rendering/RenderLayer.h:
1221         * rendering/RenderTreeAsText.cpp:
1222         (WebCore::writeLayer):
1223         (WebCore::writeLayerRenderers):
1224         (WebCore::writeLayers):
1225         * rendering/RenderTreeAsText.h:
1226
1227 2017-04-28  Simon Fraser  <simon.fraser@apple.com>
1228
1229         Modernize RenderTreeAsText code
1230         https://bugs.webkit.org/show_bug.cgi?id=171458
1231
1232         Reviewed by Zalan Bujtas.
1233
1234         Use modern loops. More references to render objects and layers.
1235
1236         * rendering/RenderTreeAsText.cpp:
1237         (WebCore::write):
1238         (WebCore::writeRenderNamedFlowThreads):
1239         (WebCore::writeLayers):
1240         (WebCore::writeSelection):
1241         (WebCore::externalRepresentation):
1242
1243 2017-04-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1244
1245         Fix and re-enable data interaction unit tests
1246         https://bugs.webkit.org/show_bug.cgi?id=171446
1247         <rdar://problem/31820646>
1248
1249         Reviewed by Tim Horton.
1250
1251         Three small tweaks to get all data interaction tests passing again (changes detailed below).
1252         Fixes a failing unit test: DataInteractionTests.RespectsExternalSourceFidelityRankings.
1253
1254         * page/mac/DragControllerMac.mm:
1255
1256         When dropping in a plain text editable area, don't consider kUTTypeText to be a UTI supported by the destination.
1257         This is because doing so would cause rich text UTIs, such as kUTTypeHTML, to match, so that the plain text area
1258         would report HTML as a preferred UTI type to load when dropping rich content over it. What we want to check for
1259         conformance here is really kUTTypePlainText.
1260
1261         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod):
1262         * platform/Pasteboard.h:
1263         * platform/ios/PasteboardIOS.mm:
1264
1265         The default Pasteboard constructor no longer makes a sync call to the UI process to get the change count.
1266         Instead, we introduce a new constructor that takes and sets the change count. This default constructor was used
1267         from three places: Pasteboard::createForCopyAndPaste, Pasteboard::createPrivate and StaticPasteboard::create.
1268
1269         The first two call sites have been refactored to first fetch the change count from the UI process and then pass
1270         it in to the constructor.
1271
1272         (WebCore::changeCountForPasteboard):
1273         (WebCore::Pasteboard::Pasteboard):
1274         (WebCore::Pasteboard::createForCopyAndPaste):
1275         (WebCore::Pasteboard::createPrivate):
1276         (WebCore::Pasteboard::readString):
1277         (WebCore::Pasteboard::types):
1278         * platform/mac/DragDataMac.mm:
1279         (WebCore::typeIsAppropriateForSupportedTypes):
1280         (WebCore::DragData::updatePreferredTypeIdentifiers):
1281
1282         Remove the two-pass heuristic. Instead, we should follow this policy: "select the highest fidelity UTI that
1283         conforms to one of the destination's supported types".
1284
1285         * platform/mac/PasteboardMac.mm:
1286         (WebCore::Pasteboard::Pasteboard):
1287
1288 2017-04-28  Dean Jackson  <dino@apple.com>
1289
1290         App crashing: Dispatch queue: com.apple.root.user-interactive-qos / vBoxConvolve / WebCore::FEGaussianBlur::platformApplySoftware()
1291         https://bugs.webkit.org/show_bug.cgi?id=171461
1292         <rdar://problem/30534722>
1293
1294         Reviewed by Eric Carlson.
1295
1296         We're getting reports of crashes in this function, caused by null or empty data being
1297         passed to vImage. Guard against this, in a way that will ASSERT in debug builds if
1298         anyone comes across it.
1299
1300         Test: css3/filters/blur-various-radii.html
1301
1302         * platform/graphics/filters/FEGaussianBlur.cpp:
1303         (WebCore::accelerateBoxBlur): Return early if things don't look good.
1304
1305 2017-04-28  Chris Dumez  <cdumez@apple.com>
1306
1307         Stop using legacy ClientRect / ClientRectList in Internals
1308         https://bugs.webkit.org/show_bug.cgi?id=171412
1309
1310         Reviewed by Simon Fraser.
1311
1312         Stop using legacy ClientRect / ClientRectList in Internals amd use the
1313         newer DOMRect instead.
1314
1315         * dom/DOMRect.idl:
1316         * page/Page.cpp:
1317         (WebCore::Page::nonFastScrollableRects):
1318         (WebCore::Page::touchEventRectsForEvent):
1319         (WebCore::Page::passiveTouchEventListenerRects):
1320         * page/Page.h:
1321         * testing/Internals.cpp:
1322         (WebCore::Internals::absoluteCaretBounds):
1323         (WebCore::Internals::boundingBox):
1324         (WebCore::Internals::inspectorHighlightRects):
1325         (WebCore::Internals::layoutViewportRect):
1326         (WebCore::Internals::visualViewportRect):
1327         (WebCore::Internals::touchEventRectsForEvent):
1328         (WebCore::Internals::passiveTouchEventListenerRects):
1329         (WebCore::Internals::nonFastScrollableRects):
1330         (WebCore::Internals::selectionBounds):
1331         * testing/Internals.h:
1332         * testing/Internals.idl:
1333
1334 2017-04-28  Youenn Fablet  <youenn@apple.com>
1335
1336         getUserMedia video streams should follow device orientation
1337         https://bugs.webkit.org/show_bug.cgi?id=171284
1338
1339         Reviewed by Eric Carlson.
1340
1341         Only really affects AVVideoCaptureSource on iOS. Manually testing the following cases:
1342         - Mac: no change of behavior
1343         - iOS: page loaded in portrait, video is portrait. page loaded in landscape, video is landscape
1344         - iOS: changing the device orientation makes the video samples to be moved to landscape/portrait.
1345         - Same tests as above with peer connection.
1346
1347         Making Document having an OrientationNotifier that AVVideoCaptureSources get registered to.
1348         Making AVVideoCaptureSource an OrientationNotifier::Observer so that it can changes width/height if needed.
1349
1350         Refactoring to specialize CaptureFactory in VideoCaptureFactory and AudioCaptureFactory.
1351         Refactoring to return a CaptureSourceOrError instead of passing an out parameter plus returning a RefPtr.
1352
1353         * Modules/mediastream/UserMediaRequest.cpp:
1354         (WebCore::UserMediaRequest::allow):
1355         * WebCore.xcodeproj/project.pbxproj:
1356         * dom/Document.cpp:
1357         (WebCore::Document::orientationChanged):
1358         * dom/Document.h:
1359         * page/Frame.cpp:
1360         (WebCore::Frame::orientationChanged):
1361         * platform/OrientationNotifer.h: Copied from Source/WebKit2/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h.
1362         (WebCore::OrientationNotifier::Observer::setNotifier):
1363         (WebCore::OrientationNotifier::Observer::~Observer):
1364         (WebCore::OrientationNotifier::orientationChanged):
1365         (WebCore::OrientationNotifier::addObserver):
1366         (WebCore::OrientationNotifier::removeObserver):
1367         * platform/mediastream/MediaStreamPrivate.cpp:
1368         (WebCore::MediaStreamPrivate::monitorOrientation):
1369         * platform/mediastream/MediaStreamPrivate.h:
1370         * platform/mediastream/RealtimeMediaSource.h:
1371         (WebCore::CaptureSourceOrError::CaptureSourceOrError):
1372         (WebCore::CaptureSourceOrError::operator bool):
1373         (WebCore::CaptureSourceOrError::source):
1374         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1375         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
1376         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
1377         (WebCore::RealtimeMediaSourceCenter::setVideoFactory):
1378         (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory):
1379         * platform/mediastream/RealtimeMediaSourceCenter.h:
1380         (WebCore::RealtimeMediaSourceCenter::defaultAudioFactory):
1381         (WebCore::RealtimeMediaSourceCenter::defaultVideoFactory):
1382         (WebCore::RealtimeMediaSourceCenter::audioFactory):
1383         (WebCore::RealtimeMediaSourceCenter::videoFactory):
1384         * platform/mediastream/mac/AVAudioCaptureSource.h:
1385         * platform/mediastream/mac/AVAudioCaptureSource.mm:
1386         (WebCore::AVAudioCaptureSource::create):
1387         (WebCore::AVAudioCaptureSource::factory):
1388         * platform/mediastream/mac/AVVideoCaptureSource.h:
1389         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1390         (WebCore::AVVideoCaptureSource::create):
1391         (WebCore::AVVideoCaptureSource::factory):
1392         (WebCore::AVVideoCaptureSource::monitorOrientation):
1393         (WebCore::AVVideoCaptureSource::orientationChanged):
1394         (WebCore::AVVideoCaptureSource::processNewFrame):
1395         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1396         (WebCore::CoreAudioCaptureSource::create):
1397         (WebCore::CoreAudioCaptureSource::factory):
1398         * platform/mediastream/mac/CoreAudioCaptureSource.h:
1399         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
1400         (WebCore::MockRealtimeAudioSource::create):
1401         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
1402         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1403         (WebCore::MockRealtimeVideoSource::create):
1404         (WebCore::MockRealtimeVideoSourceMac::orientationChanged):
1405         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1406         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
1407         (WebCore::RealtimeMediaSourceCenterMac::bestSourcesForTypeAndConstraints):
1408         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory):
1409         (WebCore::RealtimeMediaSourceCenterMac::defaultVideoFactory):
1410         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
1411         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
1412         (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream):
1413         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
1414         * platform/mock/MockRealtimeAudioSource.cpp:
1415         (WebCore::MockRealtimeAudioSource::create):
1416         (WebCore::MockRealtimeAudioSource::factory):
1417         * platform/mock/MockRealtimeAudioSource.h:
1418         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1419         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
1420         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
1421         (WebCore::MockRealtimeMediaSourceCenter::defaultAudioFactory):
1422         (WebCore::MockRealtimeMediaSourceCenter::defaultVideoFactory):
1423         * platform/mock/MockRealtimeMediaSourceCenter.h:
1424         * platform/mock/MockRealtimeVideoSource.cpp:
1425         (WebCore::MockRealtimeVideoSource::create):
1426         (WebCore::MockRealtimeVideoSource::factory):
1427         * platform/mock/MockRealtimeVideoSource.h:
1428
1429 2017-04-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
1430
1431         Unify how BitmapImage handles the availability of a decoded for large and animated images
1432         https://bugs.webkit.org/show_bug.cgi?id=171410
1433
1434         Reviewed by Simon Fraser.
1435
1436         Rename some functions which are related to animation frame availability.
1437         Make BitmapImage call ImageObserver::imageFrameAvailable() whenever a 
1438         frame is available regardless it is for an animated or for a large image.
1439
1440         * html/HTMLMediaElement.cpp:
1441         (WebCore::HTMLMediaElement::isVisibleInViewport):
1442         * html/MediaElementSession.cpp:
1443         (WebCore::MediaElementSession::autoplayPermitted):
1444         (WebCore::isMainContentForPurposesOfAutoplay):
1445         * loader/cache/CachedImage.cpp:
1446         (WebCore::CachedImage::CachedImageObserver::imageFrameAvailable):
1447         (WebCore::CachedImage::imageFrameAvailable):
1448         (WebCore::CachedImage::usesImageContainerSize): Deleted.
1449         (WebCore::CachedImage::imageHasRelativeWidth): Deleted.
1450         (WebCore::CachedImage::imageHasRelativeHeight): Deleted.
1451         (WebCore::CachedImage::CachedImageObserver::animationAdvanced): Deleted.
1452         (WebCore::CachedImage::animationAdvanced): Deleted.
1453         * loader/cache/CachedImage.h:
1454         * loader/cache/CachedImageClient.h:
1455         (WebCore::CachedImageClient::imageFrameAvailable):
1456         (WebCore::CachedImageClient::newImageAnimationFrameAvailable): Deleted.
1457         * platform/graphics/BitmapImage.cpp:
1458         (WebCore::BitmapImage::internalAdvanceAnimation):
1459         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
1460         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Deleted.
1461         * platform/graphics/BitmapImage.h:
1462         * platform/graphics/Image.h:
1463         (WebCore::Image::imageFrameAvailableAtIndex):
1464         (WebCore::Image::newFrameNativeImageAvailableAtIndex): Deleted.
1465         * platform/graphics/ImageFrameCache.cpp:
1466         (WebCore::ImageFrameCache::cacheAsyncFrameNativeImageAtIndex):
1467         * platform/graphics/ImageObserver.h:
1468         * platform/graphics/ImageTypes.h:
1469         * rendering/RenderElement.cpp:
1470         (WebCore::RenderElement::RenderElement):
1471         (WebCore::RenderElement::shouldRepaintInVisibleRect):
1472         (WebCore::RenderElement::imageFrameAvailable):
1473         (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded):
1474         (WebCore::shouldRepaintForImageAnimation): Deleted.
1475         (WebCore::RenderElement::newImageAnimationFrameAvailable): Deleted.
1476         * rendering/RenderElement.h:
1477         * rendering/RenderView.cpp:
1478         (WebCore::RenderView::updateVisibleViewportRect):
1479         * svg/graphics/SVGImageClients.h:
1480
1481 2017-04-28  Jeremy Jones  <jeremyj@apple.com>
1482
1483         ARGUMENT BAD: time, time >= 0
1484         https://bugs.webkit.org/show_bug.cgi?id=164336
1485         rdar://problem/29314891
1486
1487         Reviewed by Eric Carlson.
1488
1489         Handle invalid duration and current time when calculating remaining time.
1490
1491         Test media/modern-media-controls/pip-support/pip-support-click.html now works without a workaround
1492         in media/modern-media-controls/pip-support/pip-support-enabled.html
1493
1494         * platform/mac/WebVideoFullscreenHUDWindowController.mm:
1495         (-[WebVideoFullscreenHUDWindowController remainingTimeText]):
1496
1497 2017-04-28  Daniel Bates  <dabates@apple.com>
1498
1499         Add WebCore::protocolIsJavaScript(StringView)
1500         https://bugs.webkit.org/show_bug.cgi?id=171396
1501
1502         Reviewed by Alex Christensen.
1503
1504         Add an overload of WebCore::protocolIsJavaScript() that takes a StringView to
1505         avoid the need for a caller to allocate a new String object when converting
1506         from a StringView to a String. We are not using this functionality at the moment,
1507         but we will in the patch for <https://bugs.webkit.org/show_bug.cgi?id=170925>.
1508
1509         No functionality has changed. So, no new tests.
1510
1511         * platform/URL.cpp: Remove an outdated comment about protocolIs(StringView, const char*).
1512         This overload was removed in r212508.
1513         (WebCore::protocolIsInternal): Added.
1514         (WebCore::protocolIs): Implemented in terms of WebCore::protocolIsInternal().
1515         (WebCore::URL::protocolIs): Ditto.
1516         (WebCore::protocolIsJavaScript): Added; overload that takes a StringView.
1517         (WebCore::mimeTypeFromDataURL): Modified to use WebCore::protocolIsInternal().
1518         * platform/URL.h:
1519
1520 2017-04-28  Andy Estes  <aestes@apple.com>
1521
1522         [macOS] WebPlaybackControlsManager needs to know when the selected text or audio track changes
1523         https://bugs.webkit.org/show_bug.cgi?id=171434
1524         <rdar://problem/31887922>
1525
1526         Reviewed by Eric Carlson.
1527
1528         * dom/GenericEventQueue.cpp:
1529         (WebCore::GenericEventQueue::hasPendingEventsOfType): Added to check if a pending event
1530         exists of a certain type.
1531         * dom/GenericEventQueue.h:
1532         * html/HTMLMediaElement.cpp:
1533         (WebCore::HTMLMediaElement::setSelectedTextTrack): Even if no track modes change, fire a
1534         change event when the track to select is off or automatic so that
1535         WebPlaybackSessionModelMediaElement detects the change.
1536         * html/track/TrackListBase.cpp:
1537         (TrackListBase::isChangeEventScheduled): Returns true if m_asyncEventQueue has a pending
1538         change event.
1539         * html/track/TrackListBase.h:
1540         * platform/cocoa/WebPlaybackSessionModel.h:
1541         (WebCore::WebPlaybackSessionModelClient::audioMediaSelectionIndexChanged):
1542         (WebCore::WebPlaybackSessionModelClient::legibleMediaSelectionIndexChanged):
1543         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
1544         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
1545         (WebCore::WebPlaybackSessionModelMediaElement::setMediaElement): Registered/unregistered for
1546         the change event on the audio and text tracks.
1547         (WebCore::WebPlaybackSessionModelMediaElement::updateForEventName): Called
1548         updateMediaSelectionIndices() when the change event fires.
1549         (WebCore::WebPlaybackSessionModelMediaElement::updateMediaSelectionOptions): Renamed from
1550         updateLegibleOptions().
1551         (WebCore::WebPlaybackSessionModelMediaElement::updateMediaSelectionIndices): Called
1552         audioMediaSelectionIndexChanged() and legibleMediaSelectionIndexChanged() on m_clients with
1553         the updated indices.
1554         (WebCore::WebPlaybackSessionModelMediaElement::legibleMediaSelectedIndex): Fixed a bug
1555         where selectedIndex would never be set to offIndex if offIndex is 0 (which it usually is).
1556         (WebCore::WebPlaybackSessionModelMediaElement::updateLegibleOptions): Renamed to
1557         updateMediaSelectionOptions().
1558         * platform/mac/WebPlaybackControlsManager.h:
1559         * platform/mac/WebPlaybackControlsManager.mm:
1560         (-[WebPlaybackControlsManager setAudioMediaSelectionIndex:]): Set
1561         _currentAudioTouchBarMediaSelectionOption to the object at selectedIndex and manually
1562         triggered a KVO notification. We can't call -setCurrentAudioTouchBarMediaSelectionOption:
1563         here since that will send a message back to the Web process.
1564         (-[WebPlaybackControlsManager setLegibleMediaSelectionIndex:]): Ditto for
1565         _currentLegibleTouchBarMediaSelectionOption.
1566         * platform/mac/WebPlaybackSessionInterfaceMac.h:
1567         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
1568         (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionIndexChanged): Called
1569         -[WebPlaybackControlsManager setAudioMediaSelectionIndex:].
1570         (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionIndexChanged): Called
1571         -[WebPlaybackControlsManager setLegibleMediaSelectionIndex:].
1572
1573 2017-04-28  Chris Dumez  <cdumez@apple.com>
1574
1575         Range.getClientRects() / getBoundingClientRect() should return DOMRect types
1576         https://bugs.webkit.org/show_bug.cgi?id=171393
1577
1578         Reviewed by Simon Fraser.
1579
1580         Range.getClientRects() / getBoundingClientRect() should return DOMRect types:
1581         - https://drafts.csswg.org/cssom-view/#extensions-to-the-range-interface
1582
1583         Test: fast/dom/Range/getBoundingClientRect-getClientRects-return-type.html
1584
1585         * CMakeLists.txt:
1586         * WebCore.xcodeproj/project.pbxproj:
1587         * dom/DOMRect.cpp: Copied from Source/WebCore/dom/DOMRect.h.
1588         (WebCore::createDOMRectVector):
1589         * dom/DOMRect.h:
1590         * dom/Element.cpp:
1591         (WebCore::Element::getClientRects):
1592         * dom/Range.cpp:
1593         (WebCore::Range::getClientRects):
1594         (WebCore::Range::getBoundingClientRect):
1595         * dom/Range.h:
1596         * dom/Range.idl:
1597
1598 2017-04-28  Chris Dumez  <cdumez@apple.com>
1599
1600         Tweak window.open features argument tokenizer to match HTML standard and Edge
1601         https://bugs.webkit.org/show_bug.cgi?id=170548
1602
1603         Reviewed by Geoffrey Garen.
1604
1605         Update window.open() features argument tokenizer to match HTML standard:
1606         - https://html.spec.whatwg.org/#concept-window-open-features-tokenize
1607
1608         Also update window.open() to return null instead of the window when
1609         the 'noopener' feature is activated, as per:
1610         - https://html.spec.whatwg.org/#dom-open (Step 10)
1611
1612         No new tests, rebaselined existing test.
1613
1614         * page/DOMWindow.cpp:
1615         (WebCore::DOMWindow::createWindow):
1616         Update window.open() to return null instead of the window when
1617         the 'noopener' feature is activated, as per:
1618         - https://html.spec.whatwg.org/#dom-open (Step 10)
1619
1620         * page/WindowFeatures.cpp:
1621         (WebCore::isSeparator):
1622         Treat all ASCII spaces as feature separators, as per:
1623         - https://html.spec.whatwg.org/#feature-separator
1624         This has the effect of adding U+000C (FormFeed) as a separator.
1625
1626         (WebCore::processFeaturesString):
1627         Align tokenizing code with the specification:
1628         - https://html.spec.whatwg.org/#concept-window-open-features-tokenize
1629         In particular, the following changes were made:
1630         - After the key, skip to first '=', but don't skip past a ',' or a non-separator.
1631           The "or a non-separator" part is new in the spec (step 3.6.1) and is now implemented.
1632         - After looking for the '=', only treat what follows as a value if the current character
1633           is a separator. This is as per step 7 in the spec.
1634         These changes now cause us to parse 'foo noopener=1' as ('foo', ''), ('noopener', '1').
1635
1636 2017-04-28  Eric Carlson  <eric.carlson@apple.com>
1637
1638         Implement ondevicechange
1639         https://bugs.webkit.org/show_bug.cgi?id=169872
1640
1641         Unreviewed, remove some dead code accidentally committed in r215929.
1642
1643         * platform/mediastream/CaptureDeviceManager.cpp:
1644
1645 2017-04-28  Chris Dumez  <cdumez@apple.com>
1646
1647         Update DOMTokenList.replace() to match the latest DOM specification
1648         https://bugs.webkit.org/show_bug.cgi?id=171388
1649
1650         Reviewed by Alex Christensen.
1651
1652         Update DOMTokenList.replace() to match the latest DOM specification after:
1653         - https://github.com/whatwg/dom/issues/442
1654         - https://github.com/whatwg/infra/pull/126
1655
1656         The latest spec text is at:
1657         - https://dom.spec.whatwg.org/#dom-domtokenlist-replace
1658         - https://infra.spec.whatwg.org/#set-replace
1659
1660         The behavior change in this patch causes (a, b, c).replace(a, c) to return
1661         (c, b) instead of (b, c). This new behavior is aligned with Firefox as well.
1662
1663         No new tests, updated existing test.
1664
1665         * html/DOMTokenList.cpp:
1666         (WebCore::DOMTokenList::replace):
1667
1668 2017-04-28  Brady Eidson  <beidson@apple.com>
1669
1670         Start of support for multiple WebsiteDataStore/SessionIDs per process
1671         https://bugs.webkit.org/show_bug.cgi?id=171422
1672
1673         Reviewed by Geoffrey Garen.
1674
1675         Covered by API tests.
1676
1677         * platform/network/NetworkStorageSession.h:
1678         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1679         (WebCore::NetworkStorageSession::ensureSession):
1680         * platform/spi/cf/CFNetworkSPI.h:
1681
1682 2017-04-28  Chris Dumez  <cdumez@apple.com>
1683
1684         URLSearchParams should be reflective
1685         https://bugs.webkit.org/show_bug.cgi?id=171345
1686
1687         Reviewed by Alex Christensen.
1688
1689         There was a bug in our implementation of [1] where we would replace
1690         '+' with 0x20 *after* URL-decoding the string, instead of *before*.
1691         This was causing us to replace URL-encoded '+' characters with 0x20.
1692
1693         [1] https://url.spec.whatwg.org/#concept-urlencoded-parser
1694
1695         No new tests, updated existing test.
1696
1697         * platform/URLParser.cpp:
1698
1699 2017-04-28  Youenn Fablet  <youenn@apple.com>
1700
1701         Adding a runtime flag specific to MediaDevices
1702         https://bugs.webkit.org/show_bug.cgi?id=171433
1703
1704         Reviewed by Geoffrey Garen.
1705
1706         Covered by existing tests.
1707
1708         Adding a preference for MediaDevices.
1709         Setting media devices runtime flag to false by default.
1710         Setting peer connection and media stream flags to true by default.
1711         Activating mediaDevices and getUserMedia Navigator properties based on media devices flag.
1712
1713         * Modules/mediastream/NavigatorMediaDevices.idl:
1714         * Modules/mediastream/NavigatorUserMedia.idl:
1715         * page/RuntimeEnabledFeatures.cpp:
1716         (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
1717         * page/RuntimeEnabledFeatures.h:
1718         (WebCore::RuntimeEnabledFeatures::mediaDevicesEnabled):
1719         (WebCore::RuntimeEnabledFeatures::setMediaDevicesEnabled):
1720
1721 2017-04-28  Eric Carlson  <eric.carlson@apple.com>
1722
1723         Implement ondevicechange
1724         https://bugs.webkit.org/show_bug.cgi?id=169872
1725
1726         Unreviewed, fix test crash.
1727
1728         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1729         (WebCore::RealtimeMediaSourceCenter::addDevicesChangedObserver): "nextToken" must be static.
1730
1731 2017-04-28  Dean Jackson  <dino@apple.com>
1732
1733         [WebGPU] Label MTLCommandQueues with a prefix for internal telemetry
1734         https://bugs.webkit.org/show_bug.cgi?id=171441
1735         <rdar://problem/31826915>
1736
1737         Reviewed by Tim Horton.
1738
1739         Prefix any label that is set by the WebGPU API so that
1740         our telemetry can identify the use. Don't expose that
1741         prefix to the API though.
1742
1743         New API Test: GPUCommandQueue
1744
1745         * platform/graphics/cocoa/GPUCommandQueueMetal.mm:
1746         (WebCore::GPUCommandQueue::GPUCommandQueue):
1747         (WebCore::GPUCommandQueue::label):
1748         (WebCore::GPUCommandQueue::setLabel):
1749
1750 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
1751
1752         [ATK] aria-modal="true" should be exposed via ATK_STATE_MODAL
1753         https://bugs.webkit.org/show_bug.cgi?id=171188
1754
1755         Reviewed by Chris Fleizach.
1756
1757         Include ATK_STATE_MODAL in the AtkObject's state set if the accessible
1758         element's node is the current ARIA modal node.
1759
1760         Test: accessibility/gtk/aria-modal-state-exposed.html
1761
1762         * accessibility/AccessibilityObject.cpp:
1763         (WebCore::AccessibilityObject::isAriaModalNode):
1764         * accessibility/AccessibilityObject.h:
1765         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1766         (setAtkStateSetFromCoreObject):
1767
1768 2017-04-28  Eric Carlson  <eric.carlson@apple.com>
1769
1770         Implement ondevicechange
1771         https://bugs.webkit.org/show_bug.cgi?id=169872
1772         <rdar://problem/28945035>
1773
1774         Reviewed by Jer Noble.
1775
1776         Test: fast/mediastream/device-change-event.html
1777
1778         * Modules/mediastream/MediaDevices.cpp:
1779         (WebCore::MediaDevices::MediaDevices): Register for devicechange callbacks.
1780         (WebCore::MediaDevices::~MediaDevices): Unregister.
1781         (WebCore::MediaDevices::scheduledEventTimerFired):
1782         * Modules/mediastream/MediaDevices.h:
1783         * Modules/mediastream/MediaDevices.idl:
1784
1785         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
1786         (WebCore::MediaDevicesEnumerationRequest::setDeviceInfo): Remove unnecessary instance variables.
1787         * Modules/mediastream/MediaDevicesEnumerationRequest.h:
1788
1789         * Modules/mediastream/MediaDevicesRequest.cpp:
1790         (WebCore::MediaDevicesRequest::start): Remove m_idHashSalt, it isn't used. RealtimeMediaSourceCenter
1791         now has the method to hash ids and group IDs.
1792         (WebCore::hashString): Deleted.
1793         (WebCore::MediaDevicesRequest::hashID): Deleted.
1794         * Modules/mediastream/MediaDevicesRequest.h:
1795
1796         * dom/Document.h:
1797         (WebCore::Document::setDeviceIDHashSalt):
1798         (WebCore::Document::deviceIDHashSalt):
1799
1800         * dom/EventNames.h: Add devicechange.
1801
1802         * dom/EventTargetFactory.in: Add MediaDevices.
1803
1804         * html/HTMLAttributeNames.in: Add ondevicechange.
1805
1806         * platform/mediastream/CaptureDeviceManager.cpp:
1807         (WebCore::CaptureDeviceManager::captureDeviceFromPersistentID): Renamed from captureDeviceFromDeviceID
1808         and changed to return a std::optional<CaptureDevice>.
1809         (WebCore::CaptureDeviceManager::captureDeviceFromDeviceID): Deleted.
1810
1811         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1812         (WebCore::addStringToSHA): New, add string bytes to SHA1. Moved from MediaDevicesRequest
1813         so we can use for in testing.
1814         (WebCore::RealtimeMediaSourceCenter::hashStringWithSalt): Generate hash for a string with a
1815         salt. Moved from MediaDevicesRequest so we can use for in testing.
1816         (WebCore::RealtimeMediaSourceCenter::captureDeviceWithUniqueID): Find a CaptureDevice given 
1817         a unique ID and the process hash salt.
1818         (WebCore::RealtimeMediaSourceCenter::setDeviceEnabled): Enable/disable a device. Used for
1819         layout tests only.
1820         (WebCore::RealtimeMediaSourceCenter::addDevicesChangedObserver): Add a devices changed listener.
1821         (WebCore::RealtimeMediaSourceCenter::removeDevicesChangedObserver): Remove a listener.
1822         (WebCore::RealtimeMediaSourceCenter::captureDevicesChanged): Notify listeners.
1823         * platform/mediastream/RealtimeMediaSourceCenter.h:
1824
1825         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
1826         (WebCore::AVCaptureDeviceManager::addDevicesChangedObserver): Update for change to captureDeviceFromDeviceID.
1827
1828         * platform/mock/MockRealtimeMediaSource.cpp:
1829         (WebCore::MockRealtimeMediaSource::audioDevices): All devices are enabled by default.
1830         (WebCore::MockRealtimeMediaSource::videoDevices): Ditto.
1831
1832         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1833         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream): Drive-by cleanup: use the vector
1834         of devices instead of making assumptions about the number.
1835         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamDevices): Only include enabled devices.
1836         (WebCore::MockRealtimeMediaSourceCenter::setDeviceEnabled): Enable or disable a device.
1837         * platform/mock/MockRealtimeMediaSourceCenter.h:
1838
1839         * testing/Internals.cpp:
1840         (WebCore::Internals::setMediaDeviceState): Enable or disable a mock capture device.
1841         * testing/Internals.h:
1842         * testing/Internals.idl:
1843
1844 2017-04-28  Alex Christensen  <achristensen@webkit.org>
1845
1846         Fix memory corruption issue after r215883.
1847         https://bugs.webkit.org/show_bug.cgi?id=171365
1848
1849         Reviewed by Brady Eidson.
1850
1851         This fixes a crash when starting WebKit2.
1852
1853         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1854         (WebCore::NetworkStorageSession::NetworkStorageSession):
1855         Initialize m_platformCookieStorage with the default constructor of RetainPtr,
1856         then call NetworkStorageSession::cookieStorage which checks m_platformCookieStorage
1857         for null.  It was checking uninitialized memory when we had m_platformCookieStorage
1858         in the initializer list.
1859
1860 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
1861
1862         AX: Implement aria-value support for focusable separators
1863         https://bugs.webkit.org/show_bug.cgi?id=171169
1864
1865         Reviewed by Chris Fleizach.
1866
1867         Add SplitterRole to the roles which support range value and are considered a range
1868         control, as long as the SplitterRole element is focusable. Also replace ATK's role-
1869         based check with a call to supportsRangeValue() when determining if the AtkValue
1870         interface should be implemented.
1871
1872         Test: accessibility/separator-values.html
1873
1874         * accessibility/AccessibilityObject.cpp:
1875         (WebCore::AccessibilityObject::isRangeControl):
1876         (WebCore::AccessibilityObject::supportsRangeValue):
1877         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1878         (getInterfaceMaskFromObject):
1879
1880 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
1881
1882         [ATK] GridCellRole should implement AtkTableCell (regression?)
1883         https://bugs.webkit.org/show_bug.cgi?id=171179
1884
1885         Reviewed by Chris Fleizach.
1886
1887         Add GridCellRole to the group of roles which should implement AtkTableCell.
1888
1889         Test: accessibility/gtk/interface-table-cell.html
1890
1891         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1892         (getInterfaceMaskFromObject):
1893
1894 2017-04-28  Miguel Gomez  <magomez@igalia.com>
1895
1896         REGRESSION(r215211): [GTK] Several webgl related tests are failing
1897         https://bugs.webkit.org/show_bug.cgi?id=170730
1898
1899         Reviewed by Said Abou-Hallawa.
1900
1901         There is a wrong situation in the image decoders where the complete data has been assigned
1902         to them but the size of the image hasn't been decoded yet. This is causing rendering
1903         issues in webgl when decoding the images used as textures. To fix this, we refactor how the
1904         encoded data status is stored to avoid that situation: the status is handled completely
1905         by ImageDecoder.h, and it's the one forcing the decode of the size when data gets assigned
1906         to the decoders.
1907
1908         Covered by existent tests.
1909
1910         * platform/image-decoders/ImageDecoder.h:
1911         (WebCore::ImageDecoder::isAllDataReceived):
1912         (WebCore::ImageDecoder::setData):
1913         (WebCore::ImageDecoder::encodedDataStatus):
1914         (WebCore::ImageDecoder::isSizeAvailable):
1915         (WebCore::ImageDecoder::setSize):
1916         (WebCore::ImageDecoder::setFailed):
1917         (WebCore::ImageDecoder::failed):
1918         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
1919         (WebCore::BMPImageDecoder::frameBufferAtIndex):
1920         (WebCore::BMPImageDecoder::decode):
1921         (WebCore::BMPImageDecoder::encodedDataStatus): Deleted.
1922         * platform/image-decoders/bmp/BMPImageDecoder.h:
1923         * platform/image-decoders/gif/GIFImageDecoder.cpp:
1924         (WebCore::GIFImageDecoder::frameCount):
1925         (WebCore::GIFImageDecoder::frameBufferAtIndex):
1926         (WebCore::GIFImageDecoder::decode):
1927         (WebCore::GIFImageDecoder::encodedDataStatus): Deleted.
1928         * platform/image-decoders/gif/GIFImageDecoder.h:
1929         * platform/image-decoders/ico/ICOImageDecoder.cpp:
1930         (WebCore::ICOImageDecoder::setData):
1931         (WebCore::ICOImageDecoder::frameCount):
1932         (WebCore::ICOImageDecoder::frameBufferAtIndex):
1933         (WebCore::ICOImageDecoder::setDataForPNGDecoderAtIndex):
1934         (WebCore::ICOImageDecoder::decode):
1935         (WebCore::ICOImageDecoder::decodeAtIndex):
1936         (WebCore::ICOImageDecoder::encodedDataStatus): Deleted.
1937         * platform/image-decoders/ico/ICOImageDecoder.h:
1938         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
1939         (WebCore::JPEGImageDecoder::frameBufferAtIndex):
1940         (WebCore::JPEGImageDecoder::decode):
1941         (WebCore::JPEGImageDecoder::encodedDataStatus): Deleted.
1942         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
1943         * platform/image-decoders/png/PNGImageDecoder.cpp:
1944         (WebCore::PNGImageDecoder::frameBufferAtIndex):
1945         (WebCore::PNGImageDecoder::decode):
1946         (WebCore::PNGImageDecoder::encodedDataStatus): Deleted.
1947         * platform/image-decoders/png/PNGImageDecoder.h:
1948         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
1949         (WebCore::WEBPImageDecoder::frameBufferAtIndex):
1950         (WebCore::WEBPImageDecoder::decode):
1951         (WebCore::WEBPImageDecoder::encodedDataStatus): Deleted.
1952         * platform/image-decoders/webp/WEBPImageDecoder.h:
1953
1954 2017-04-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1955
1956         Move UUID from WebCore/platform to WTF
1957         https://bugs.webkit.org/show_bug.cgi?id=171372
1958
1959         Reviewed by Michael Catanzaro.
1960
1961         UUID only contains createCanonicalUUIDString() that is platform independent and doesn't depend on anything from
1962         WebCore, only from WTF.
1963
1964         * CMakeLists.txt:
1965         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
1966         * Modules/mediacontrols/MediaControlsHost.cpp:
1967         * Modules/mediastream/RTCPeerConnection.cpp:
1968         * Modules/webaudio/MediaStreamAudioSource.cpp:
1969         * Modules/webdatabase/DatabaseTracker.cpp:
1970         * WebCore.order:
1971         * WebCore.xcodeproj/project.pbxproj:
1972         * editing/mac/EditorMac.mm:
1973         * fileapi/BlobURL.cpp:
1974         * loader/appcache/ApplicationCacheHost.cpp:
1975         * loader/appcache/ApplicationCacheStorage.cpp:
1976         * platform/URL.cpp:
1977         * platform/glib/FileSystemGlib.cpp:
1978         * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
1979         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
1980         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
1981         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
1982         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1983         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1984         * platform/mediastream/CaptureDeviceManager.cpp:
1985         * platform/mediastream/MediaStreamPrivate.h:
1986         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1987         * platform/mediastream/RealtimeMediaSource.cpp:
1988         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
1989         * platform/mediastream/mac/AVMediaCaptureSource.mm:
1990         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
1991         * platform/mock/MockRealtimeAudioSource.cpp:
1992         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1993         * platform/mock/MockRealtimeVideoSource.cpp:
1994         * testing/MockCDMFactory.cpp:
1995
1996 2017-04-27  Alex Christensen  <achristensen@webkit.org>
1997
1998         Make navigation policy checking more robust
1999         https://bugs.webkit.org/show_bug.cgi?id=171409
2000         <rdar://problem/31489248>
2001
2002         Reviewed by Geoffrey Garen.
2003
2004         No change in behavior.  Just added a protectedThis to a lambda and made the functions non-copyable.
2005
2006         * loader/DocumentLoader.cpp:
2007         (WebCore::DocumentLoader::willSendRequest):
2008         * loader/PolicyCallback.cpp:
2009         (WebCore::PolicyCallback::set):
2010         (WebCore::PolicyCallback::clear): Deleted.
2011         * loader/PolicyCallback.h:
2012         * loader/PolicyChecker.cpp:
2013         (WebCore::PolicyChecker::cancelCheck):
2014         (WebCore::PolicyChecker::stopCheck):
2015         (WebCore::PolicyChecker::continueAfterNavigationPolicy):
2016         (WebCore::PolicyChecker::continueAfterNewWindowPolicy):
2017         (WebCore::PolicyChecker::continueAfterContentPolicy):
2018
2019 2017-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2020
2021         Data interaction should not load pasteboard content before performing the data operation
2022         https://bugs.webkit.org/show_bug.cgi?id=171414
2023         <rdar://problem/31878197>
2024
2025         Reviewed by Tim Horton.
2026
2027         When interacting with a link, we should not try to fetch pasteboard contents for the URL UTI type before
2028         performing the data operation. Teaches DragController to know whether it is allowed to load data from the
2029         dragging pasteboard, and uses this information in DragController::dragOperation to determine whether to use
2030         DragData::containsURLTypeIdentifier or DragData::containsURL.
2031
2032         * page/DragController.cpp:
2033         (WebCore::DragController::DragController):
2034         (WebCore::DragController::performDragOperation):
2035         * page/DragController.h:
2036         (WebCore::DragController::canLoadDataFromDraggingPasteboard):
2037         * page/mac/DragControllerMac.mm:
2038         (WebCore::DragController::dragOperation):
2039         * platform/DragData.h:
2040         * platform/ios/WebItemProviderPasteboard.mm:
2041         (-[WebItemProviderPasteboard _preLoadedDataConformingToType:forItemProviderAtIndex:]):
2042         * platform/mac/DragDataMac.mm:
2043         (WebCore::DragData::containsURLTypeIdentifier):
2044
2045 2017-04-27  Joseph Pecoraro  <pecoraro@apple.com>
2046
2047         Support for promise rejection events (unhandledrejection)
2048         https://bugs.webkit.org/show_bug.cgi?id=150358
2049         <rdar://problem/28441651>
2050
2051         Reviewed by Saam Barati.
2052
2053         Patch by Joseph Pecoraro and Yusuke Suzuki.
2054
2055         Implement support for the `onunhandledrejection` and `rejectionhandled` events.
2056         They dispatch a new PromiseRejectionEvent using the ES6 HostPromiseRejectionTracker hook:
2057         https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker
2058         https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections
2059
2060         This is currently implemented only for Documents and not yet Web Workers.
2061
2062         Tests: js/dom/unhandled-promise-rejection-basic.html
2063                js/dom/unhandled-promise-rejection-bindings-type-error.html
2064                js/dom/unhandled-promise-rejection-console-no-report.html
2065                js/dom/unhandled-promise-rejection-console-report.html
2066                js/dom/unhandled-promise-rejection-handle-during-event.html
2067                js/dom/unhandled-promise-rejection-handle-in-handler.html
2068                js/dom/unhandled-promise-rejection-handle.html
2069                js/dom/unhandled-promise-rejection-order.html
2070
2071         * CMakeLists.txt:
2072         * DerivedSources.cpp:
2073         * DerivedSources.make:
2074         * WebCore.xcodeproj/project.pbxproj:
2075         * dom/DOMAllInOne.cpp:
2076         New files.
2077
2078         * bindings/scripts/CodeGenerator.pm:
2079         (IsPromiseType):
2080         * bindings/scripts/CodeGeneratorJS.pm:
2081         (AddToIncludesForIDLType):
2082         (GetBaseIDLType):
2083         Binding support for Promise<T> attributes.
2084
2085         * bindings/js/JSDOMConvert.h:
2086         * bindings/js/JSDOMConvertPromise.h: Copied from Source/JavaScriptCore/runtime/JSPromise.h.
2087         (WebCore::Converter<IDLPromise<T>>::convert):
2088         (WebCore::JSConverter<IDLPromise<T>>::convert):
2089         Promise<T> binding conversion is currently unimplemented, which only means
2090         web developers creating their own PromiseRejectionEvent will not get
2091         autowrapping of values assigned to `promise` in event initialization.
2092         Engine generated events will have expected behavior.
2093
2094         * bindings/js/JSDOMWindowBase.cpp:
2095         (WebCore::JSDOMWindowBase::promiseRejectionTracker):
2096         * bindings/js/JSDOMWindowBase.h:
2097         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2098         Implement HostPromiseRejectionTracker hook for Document but not Worker.
2099         Passes through to the ScriptExecutionContext's tracker.
2100
2101         * bindings/js/JSMainThreadExecState.cpp:
2102         (WebCore::JSMainThreadExecState::didLeaveScriptContext):
2103         * bindings/js/JSMainThreadExecState.h:
2104         (WebCore::JSMainThreadExecState::~JSMainThreadExecState):
2105         When completing script execution and performing microtasks notify
2106         about rejected promises. Technically this should go inside of
2107         performing a microtask checkpoint, except lacking EventLoop
2108         concepts we use ScriptExecutionState.
2109
2110         * dom/EventNames.h:
2111         * dom/EventNames.in:
2112         * dom/PromiseRejectionEvent.cpp: Added.
2113         (WebCore::PromiseRejectionEvent::PromiseRejectionEvent):
2114         (WebCore::PromiseRejectionEvent::~PromiseRejectionEvent):
2115         * dom/PromiseRejectionEvent.h: Added.
2116         * dom/PromiseRejectionEvent.idl: Added.
2117         New PromiseRejectionEvent event interface.
2118
2119         * dom/GlobalEventHandlers.idl:
2120         New onunhandledrejection and onrejectionhandled.
2121
2122         * dom/RejectedPromiseTracker.cpp: Added.
2123         (WebCore::RejectedPromise::RejectedPromise):
2124         (WebCore::RejectedPromise::globalObject):
2125         (WebCore::RejectedPromise::promise):
2126         (WebCore::UnhandledPromise::UnhandledPromise):
2127         (WebCore::UnhandledPromise::callStack):
2128         (WebCore::RejectedPromiseTracker::RejectedPromiseTracker):
2129         (WebCore::RejectedPromiseTracker::~RejectedPromiseTracker):
2130         (WebCore::createScriptCallStackFromReason):
2131         (WebCore::RejectedPromiseTracker::promiseRejected):
2132         (WebCore::RejectedPromiseTracker::promiseHandled):
2133         (WebCore::RejectedPromiseTracker::processQueueSoon):
2134         (WebCore::RejectedPromiseTracker::reportUnhandledRejections):
2135         (WebCore::RejectedPromiseTracker::reportRejectionHandled):
2136         * dom/RejectedPromiseTracker.h: Added.
2137         Track and report rejected promises. The promises are tracked weakly
2138         allowing them to be collected before they are reported. When reporting
2139         we dispatch PromiseRejectionEvent events, and if the default is not
2140         prevented we log a message to the console.
2141
2142         * dom/ScriptExecutionContext.cpp:
2143         (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection):
2144         (WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow):
2145         * dom/ScriptExecutionContext.h:
2146         (WebCore::ScriptExecutionContext::ensureRejectedPromiseTracker):
2147         Each ScriptExecutionContext can own a rejected promise tracker.
2148
2149         * html/HTMLMediaElement.cpp:
2150         (WebCore::HTMLMediaElement::pauseInternal):
2151         https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps
2152         Internal pause steps say to timeupdate, pause, and rejecting pending play promises
2153         should all happen in a queued task. Here the first two actions are already scheduled
2154         on tasks, but rejecting play promises was not being done in a task, so this makes
2155         that change.
2156
2157         * Modules/streams/ReadableStream.js:
2158         (pipeThrough):
2159         * Modules/streams/ReadableStreamInternals.js:
2160         (readableStreamReaderGenericInitialize):
2161         (readableStreamError):
2162         (readableStreamReaderGenericRelease):
2163         Satisfy parts of the Streams specification which state to set the
2164         [[PromiseIsHandled]] internal state of promises created internally
2165         by the Streams APIs. This prevents some internal promises from
2166         appearing as unhandled promise rejections.
2167
2168 2017-04-27  Chris Dumez  <cdumez@apple.com>
2169
2170         Align colspan/rowspan limits with the latest HTML specification
2171         https://bugs.webkit.org/show_bug.cgi?id=171322
2172
2173         Reviewed by Darin Adler.
2174
2175         Align colspan/rowspan limits with the latest HTML specification after:
2176         - https://github.com/whatwg/html/pull/1993
2177
2178         The following changes were made:
2179         - Our rowspan limit was raised from 8190 to 65534
2180         - A colspan limit of 1000 was introduced. Blink has UseCounter data showing that
2181           colspans over 1000 are extremely rare and Gecko has data showing that when we
2182           get a colspan greater than 1000, it is usually a bug. Therefore, this change
2183           should be fine.
2184         - The limits are now properly reflected via the IDL attributes instead of lying
2185           to the Web about the colspan / rowspan we are using internally.
2186
2187         Test: imported/w3c/web-platform-tests/html/semantics/tabular-data/processing-model-1/span-limits.html
2188
2189         * html/HTMLTableCellElement.cpp:
2190         (WebCore::HTMLTableCellElement::colSpan):
2191         (WebCore::HTMLTableCellElement::rowSpan):
2192         (WebCore::HTMLTableCellElement::rowSpanForBindings):
2193         (WebCore::HTMLTableCellElement::setColSpan):
2194         * html/HTMLTableCellElement.h:
2195         * html/HTMLTableCellElement.idl:
2196         * html/parser/HTMLParserIdioms.cpp:
2197         (WebCore::parseHTMLIntegerInternal):
2198         (WebCore::parseHTMLInteger):
2199         (WebCore::parseHTMLNonNegativeInteger):
2200         (WebCore::parseValidHTMLNonNegativeIntegerInternal):
2201         (WebCore::parseHTTPRefreshInternal):
2202         * html/parser/HTMLParserIdioms.h:
2203         (WebCore::parseHTMLInteger):
2204         (WebCore::parseHTMLNonNegativeInteger):
2205
2206         (WebCore::clampHTMLNonNegativeIntegerToRange):
2207         Add utility function to implement:
2208         - https://html.spec.whatwg.org/#clamped-to-the-range
2209
2210 2017-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2211
2212         WKUIDelegatePrivate needs a hook to vend data used to initialize item providers for data interaction
2213         https://bugs.webkit.org/show_bug.cgi?id=171386
2214         <rdar://problem/31557237>
2215
2216         Reviewed by Beth Dakin.
2217
2218         Teach WebItemProviderPasteboard to remember what WebItemProviderRegistrationInfoList it was initialized with
2219         when beginning a drag. This information is cleared out the next time the list of item providers is set to
2220         something different, which happens when the data interaction session concludes.
2221
2222         * platform/ios/WebItemProviderPasteboard.h:
2223         * platform/ios/WebItemProviderPasteboard.mm:
2224         (-[WebItemProviderPasteboard init]):
2225         (-[WebItemProviderPasteboard setItemProviders:]):
2226         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]):
2227         (-[WebItemProviderPasteboard registrationInfoAtIndex:]):
2228         (-[WebItemProviderPasteboard itemProviderAtIndex:]):
2229
2230 2017-04-27  Brady Eidson  <beidson@apple.com>
2231
2232         Refactor SessionID to support multiple non-ephemeral (persistent) sessions.
2233         https://bugs.webkit.org/show_bug.cgi?id=171367
2234
2235         Reviewed by Andy Estes.
2236
2237         This is also a nice general cleanup of SessionID, including privatizing the "arbitrary number" constructor
2238         and moving encode/decode into the class.
2239
2240         No new tests (Refactor, no behavior change yet).
2241
2242         * CMakeLists.txt:
2243         * WebCore.xcodeproj/project.pbxproj:
2244         
2245         * page/SessionID.cpp: Added.
2246         (WebCore::SessionID::generatePersistentSessionID):
2247         (WebCore::SessionID::generateEphemeralSessionID):
2248         (WebCore::SessionID::enableGenerationProtection):
2249         
2250         * page/SessionID.h:
2251         (WebCore::SessionID::SessionID):
2252         (WebCore::SessionID::emptySessionID):
2253         (WebCore::SessionID::hashTableDeletedValue):
2254         (WebCore::SessionID::defaultSessionID):
2255         (WebCore::SessionID::legacyPrivateSessionID):
2256         (WebCore::SessionID::isValid):
2257         (WebCore::SessionID::isEphemeral):
2258         (WebCore::SessionID::encode):
2259         (WebCore::SessionID::decode):
2260         (WTF::HashTraits<WebCore::SessionID>::constructDeletedValue):
2261         (WTF::HashTraits<WebCore::SessionID>::isDeletedValue):
2262
2263 2017-04-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
2264
2265         Attempt to fix a PLT regression on Mac
2266         <rdar://problem/31826998>
2267
2268         Unreviewed.
2269
2270         Disable passing the TypeIdentifierHint to CGImageSourceCreateIncremental()
2271         on Mac for now.
2272
2273         * platform/graphics/cg/ImageDecoderCG.cpp:
2274         (WebCore::ImageDecoder::ImageDecoder):
2275
2276 2017-04-27  Daniel Bates  <dabates@apple.com>
2277
2278         Rename callerDOMWindow()/CallerDocument to incumbentDOMWindow()/IncumbentDocument
2279         https://bugs.webkit.org/show_bug.cgi?id=171145
2280
2281         Reviewed by Saam Barati.
2282
2283         Standardize on the terminology "incumbent" to refer to "most-recently-entered author
2284         function or script on the stack, or the author function or script that originally
2285         scheduled the currently-running callback" (1).
2286
2287         [1] <https://html.spec.whatwg.org/multipage/webappapis.html#realms-settings-objects-global-objects> (27 April 2017)
2288
2289         * bindings/js/JSDOMWindowBase.cpp:
2290         (WebCore::incumbentDOMWindow):
2291         (WebCore::callerDOMWindow): Deleted.
2292         * bindings/js/JSDOMWindowBase.h:
2293         * bindings/scripts/CodeGeneratorJS.pm:
2294         (GenerateCallWith):
2295         * bindings/scripts/test/JS/JSTestObj.cpp:
2296         (WebCore::jsTestObjPrototypeFunctionWithCallerDocumentArgumentCaller):
2297         (WebCore::jsTestObjPrototypeFunctionWithCallerWindowArgumentCaller):
2298         * bindings/scripts/test/TestObj.idl:
2299         * page/DOMWindow.idl:
2300
2301 2017-04-27  Youenn Fablet  <youenn@apple.com>
2302
2303         LayoutTest webrtc/datachannel/datachannel-event.html is a flaky crash
2304         https://bugs.webkit.org/show_bug.cgi?id=171092
2305         <rdar://problem/31748066>
2306
2307         Reviewed by Eric Carlson.
2308
2309         Covered by manual testing on iterating on the crashing tests.
2310         With the patch, they appear to no longer crash.
2311
2312         The current RTCPeerConnection/RTCController was expecting that peer connections would be stopped before the controller.
2313         This assumption is sometimes wrong.
2314         Adding clean-up on both sides so that if controller goes away, it notifies its peer connections that they are unregistered.
2315
2316         * Modules/mediastream/RTCController.cpp:
2317         (WebCore::RTCController::~RTCController):
2318         * Modules/mediastream/RTCController.h:
2319         * Modules/mediastream/RTCPeerConnection.cpp:
2320         (WebCore::RTCPeerConnection::create):
2321         (WebCore::RTCPeerConnection::~RTCPeerConnection):
2322         (WebCore::RTCPeerConnection::doStop):
2323         (WebCore::RTCPeerConnection::registerToController):
2324         (WebCore::RTCPeerConnection::unregisterFromController):
2325         (WebCore::RTCPeerConnection::rtcController): Deleted.
2326         * Modules/mediastream/RTCPeerConnection.h:
2327
2328 2017-04-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
2329
2330         REGRESSION(r213764): Async decoding of animated images is disabled for ImageDocument
2331         https://bugs.webkit.org/show_bug.cgi?id=170333
2332
2333         Reviewed by Simon Fraser.
2334
2335         The way the image drawing settings are transfered from the Settings to
2336         BitmapImage is problematic. The drawing settings are retrieved from the
2337         CachedImageObserver which store them in the constructor only if the
2338         CachedImage as a loader. In the case of ImageDocument, there isn't loader
2339         set in CachedImage so the settings of ImageDocument are not set. Also
2340         the CachedImage can be used after loading by another document which may
2341         have a different drawing settings.
2342
2343         The fix is to make BitmapImage reads the drawing settings every time it 
2344         is drawn as a foreground or background image in a RenderElement.
2345
2346         * html/canvas/CanvasRenderingContext2D.cpp:
2347         (WebCore::CanvasRenderingContext2D::drawImage):
2348         * loader/cache/CachedImage.cpp:
2349         (WebCore::CachedImage::CachedImageObserver::CachedImageObserver):
2350         * loader/cache/CachedImage.h:
2351         * platform/graphics/BitmapImage.cpp:
2352         (WebCore::BitmapImage::setDrawingSettings):
2353         (WebCore::BitmapImage::draw):
2354         (WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImages): I was
2355         trying to disable the async image decoding temporarily but this way will
2356         even prevent testing it until it is enabled. Disable it through WK1 and
2357         WK2 preferences.
2358         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages):
2359         (WebCore::BitmapImage::advanceAnimation):
2360         * platform/graphics/BitmapImage.h:
2361         * platform/graphics/ImageObserver.h:
2362         * rendering/RenderBoxModelObject.cpp:
2363         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
2364         * rendering/RenderImage.cpp:
2365         (WebCore::RenderImage::paintIntoRect):
2366
2367 2017-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2368
2369         Performing data interaction with plain text into a contenteditable does not insert any content
2370         https://bugs.webkit.org/show_bug.cgi?id=171381
2371
2372         Reviewed by Tim Horton.
2373
2374         Attempt to read plain-text-conformant UTI types as kUTTypePlainText before reading them as kUTTypeText.
2375         This allows WebItemProviderPasteboard to properly materialize an NSString in -valuesForPasteboardType:
2376         inItemSet: using a pre-loaded NSData blob.
2377
2378         This scenario is covered by DataInteractionTests.ExternalSourceUTF8PlainTextOnly, but DataInteractionTests
2379         are temporarily disabled due to incompatibilities with the current internal SDK.
2380
2381         * platform/ios/PasteboardIOS.mm:
2382         (WebCore::readPasteboardWebContentDataForType):
2383
2384 2017-04-27  Chris Dumez  <cdumez@apple.com>
2385
2386         Element.getBoundingClientRect() / getClientRects() should return a DOMRect types
2387         https://bugs.webkit.org/show_bug.cgi?id=171226
2388
2389         Reviewed by Simon Fraser.
2390
2391         Element.getBoundingClientRect() / getClientRects() should return a DOMRect types
2392         as per:
2393         - https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface
2394
2395         DOMRect is compatible with ClientRect, which we used to return so the risk should
2396         be low.
2397
2398         Tests: fast/css/DOMRect-attributes-prototype.html
2399                fast/css/DOMRect-serialization.html
2400                fast/dom/Element/getClientRects-return-type.html
2401
2402         * dom/ClientRectList.cpp:
2403         (WebCore::ClientRectList::ClientRectList):
2404         * dom/ClientRectList.h:
2405         (WebCore::ClientRectList::create):
2406         * dom/DOMRect.h:
2407         (WebCore::DOMRect::create):
2408         * dom/DOMRectReadOnly.h:
2409         * dom/Element.cpp:
2410         (WebCore::toDOMRectVector):
2411         (WebCore::Element::getClientRects):
2412         (WebCore::Element::getBoundingClientRect):
2413         * dom/Element.h:
2414         * dom/Element.idl:
2415         * html/track/VTTRegion.cpp:
2416         (WebCore::VTTRegion::displayLastTextTrackCueBox):
2417
2418 2017-04-27  Joanmarie Diggs  <jdiggs@igalia.com>
2419
2420         AX: Expose elements with the ARIA "feed" role
2421         https://bugs.webkit.org/show_bug.cgi?id=171184
2422
2423         Reviewed by Chris Fleizach.
2424
2425         Map elements with the "feed" role to the internal ApplicationGroupRole
2426         AccessibilityRole. This prevents them from being unexpectedly pruned from
2427         the accessibility tree, and causes them to be exposed with ATK_ROLE_PANEL
2428         in WebKitGtk and AXGroup in Safari.
2429
2430         No new tests needed. Instead, add the "feed" role to roles-exposed.html,
2431         xml-roles-exposed.html, and roles-computedRoleString.html.
2432
2433         * accessibility/AccessibilityObject.cpp:
2434         (WebCore::initializeRoleMap):
2435
2436 2017-04-27  Brady Eidson  <beidson@apple.com>
2437
2438         Update NetworkStorageSession to support multiple persistent sessions and explicitly set cookie storages.
2439         https://bugs.webkit.org/show_bug.cgi?id=171365
2440
2441         Reviewed by Andy Estes.
2442
2443         No new tests (No testable behavior change yet).
2444
2445         * platform/network/NetworkStorageSession.cpp:
2446         (WebCore::NetworkStorageSession::destroySession):
2447         * platform/network/NetworkStorageSession.h:
2448         
2449         * platform/network/NetworkStorageSessionStub.cpp:
2450         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
2451         (WebCore::NetworkStorageSession::ensureSession):
2452         
2453         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2454         (WebCore::createCFStorageSessionForIdentifier):
2455         (WebCore::NetworkStorageSession::NetworkStorageSession):
2456         (WebCore::NetworkStorageSession::switchToNewTestingSession):
2457         (WebCore::NetworkStorageSession::defaultStorageSession):
2458         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
2459         (WebCore::NetworkStorageSession::ensureSession):
2460         (WebCore::NetworkStorageSession::cookieStorage):
2461         
2462         * platform/network/soup/NetworkStorageSessionSoup.cpp:
2463         (WebCore::NetworkStorageSession::ensureSession):
2464         
2465         * platform/spi/cf/CFNetworkSPI.h:
2466
2467 2017-04-27  Zalan Bujtas  <zalan@apple.com>
2468
2469         Use text-shadow to visualize simple line layout coverage.
2470         https://bugs.webkit.org/show_bug.cgi?id=171379
2471
2472         Reviewed by Antti Koivisto.
2473
2474         It's more subtle (for everyday use).
2475
2476         * rendering/SimpleLineLayoutFunctions.cpp:
2477         (WebCore::SimpleLineLayout::paintFlow):
2478         (WebCore::SimpleLineLayout::paintDebugBorders): Deleted.
2479
2480 2017-04-27  Joanmarie Diggs  <jdiggs@igalia.com>
2481
2482         [ATK] ARIA alertdialogs should be exposed with ROLE_DIALOG
2483         https://bugs.webkit.org/show_bug.cgi?id=171187
2484
2485         Reviewed by Chris Fleizach.
2486
2487         Map ApplicationAlertDialogRole to ATK_ROLE_DIALOG. While ATK_ROLE_ALERT is
2488         appropriate as far as ATK is concerned, the Core Accessibility API Mappings
2489         map ARIA's alertdialog role to ATK_ROLE_DIALOG. We should be consistent
2490         with the spec. The fact that this is an alert dialog can still be obtained
2491         via the AtkObject attributes.
2492
2493         No new tests needed. Update the expectations for roles-exposed.html,
2494         xml-roles-exposed.html, and aria-mappings.html to reflect the change.
2495
2496         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2497         (atkRole):
2498
2499 2017-04-27  Antti Koivisto  <antti@apple.com>
2500
2501         Repeated layouts in Mail due to viewport units being used with auto-sizing
2502         https://bugs.webkit.org/show_bug.cgi?id=171371
2503         <rdar://problem/28780084>
2504
2505         Reviewed by Zalan Bujtas.
2506
2507         Test: css3/viewport-percentage-lengths/vh-auto-size.html
2508
2509         Auto-sizing code would adjust the size of the view in the beginning of layout(). This would
2510         end up invalidating style for elements that use vh units and we would perform main layout
2511         with unclean style. This would result in endless layout loops and hit assert on debug.
2512
2513         * page/FrameView.cpp:
2514         (WebCore::FrameView::availableContentSizeChanged):
2515
2516             Ensure we heve clean style after resize if we are in pre-layout.
2517
2518 2017-04-27  Alex Christensen  <achristensen@webkit.org>
2519
2520         Modernize Frame.h
2521         https://bugs.webkit.org/show_bug.cgi?id=171357
2522
2523         Reviewed by Andy Estes.
2524
2525         Frame.h has several std::unique_ptrs that are created in the constructor, never null,
2526         and destroyed in the destructor.  This is what WTF::UniqueRef is for, and using UniqueRef
2527         allows us to not check for null values because a UniqueRef can never be null.
2528         An interesting case was the EventHandler, which we explicitly set to nullptr in the destructor
2529         of MainFrame, a subclass of Frame.  We added this in r199181 to fix a crash tested by
2530         fast/events/wheel-event-destroys-frame.html and this improved lifetime also does not crash
2531         or assert in that test.
2532
2533         Using UniqueRef also requires const correctness, which this patch adds when necessary.
2534
2535         * accessibility/AccessibilityObject.cpp:
2536         (WebCore::AccessibilityObject::dispatchTouchEvent):
2537         * editing/DeleteSelectionCommand.cpp:
2538         (WebCore::DeleteSelectionCommand::calculateTypingStyleAfterDelete):
2539         * editing/Editor.cpp:
2540         (WebCore::Editor::isSelectTrailingWhitespaceEnabled):
2541         (WebCore::Editor::computeAndSetTypingStyle):
2542         * editing/Editor.h:
2543         * editing/FrameSelection.cpp:
2544         (WebCore::FrameSelection::contains):
2545         (WebCore::FrameSelection::copyTypingStyle):
2546         * editing/FrameSelection.h:
2547         (WebCore::FrameSelection::setTypingStyle):
2548         * loader/EmptyClients.cpp:
2549         * loader/FrameLoader.cpp:
2550         (WebCore::FrameLoader::clear):
2551         * page/EditorClient.h:
2552         * page/EventHandler.cpp:
2553         (WebCore::EventHandler::hitTestResultAtPoint):
2554         * page/EventHandler.h:
2555         * page/Frame.cpp:
2556         (WebCore::Frame::Frame):
2557         (WebCore::Frame::setView):
2558         (WebCore::Frame::injectUserScripts):
2559         * page/Frame.h:
2560         (WebCore::Frame::editor):
2561         (WebCore::Frame::eventHandler):
2562         (WebCore::Frame::selection):
2563         (WebCore::Frame::animation):
2564         (WebCore::Frame::script):
2565         (WebCore::Frame::eventHandlerPtr): Deleted.
2566         * page/MainFrame.cpp:
2567         (WebCore::MainFrame::~MainFrame):
2568         * replay/UserInputBridge.cpp:
2569         (WebCore::UserInputBridge::handleContextMenuEvent):
2570         * replay/UserInputBridge.h:
2571
2572 2017-04-27  Andy Estes  <aestes@apple.com>
2573
2574         Fix the macOS build.
2575
2576         * platform/mac/WebPlaybackControlsManager.h:
2577
2578 2017-04-27  Zalan Bujtas  <zalan@apple.com>
2579
2580         Text gets cut off when bailing out of simple line layout with widows.
2581         https://bugs.webkit.org/show_bug.cgi?id=171370
2582         <rdar://problem/31563414>
2583
2584         Reviewed by Antti Koivisto.
2585
2586         Normal line layout requires an extra layout to handle widows. See RenderBlockFlow::relayoutToAvoidWidows. 
2587
2588         Test: fast/multicol/simple-line-layout-widows-when-switching-over-to-normal-line-layout.html
2589
2590         * rendering/RenderBlockFlow.cpp:
2591         (WebCore::RenderBlockFlow::ensureLineBoxes):
2592
2593 2017-04-27  Dean Jackson  <dino@apple.com>
2594
2595         Use the correct modern-media-controls
2596         https://bugs.webkit.org/show_bug.cgi?id=171358
2597
2598         Reviewed by Antoine Quint.
2599
2600         * WebCore.xcodeproj/project.pbxproj:
2601
2602 2017-04-26  Dan Bernstein  <mitz@apple.com>
2603
2604         Reverted r215774.
2605
2606         That change wasn’t doing what it was intended to do and was inappropriate for WebCore.
2607
2608         * WebCore.xcodeproj/project.pbxproj:
2609
2610 2017-04-26  Said Abou-Hallawa  <sabouhallawa@apple.com>
2611
2612         Attempt to fix a PLT regression.
2613         <rdar://problem/31826998>
2614
2615         Unreviewed.
2616
2617         Disable passing the TypeIdentifierHint to CGImageSourceCreateIncremental()
2618         on iOS for now.
2619
2620         * platform/graphics/cg/ImageDecoderCG.cpp:
2621         (WebCore::ImageDecoder::ImageDecoder):
2622
2623 2017-04-26  Joanmarie Diggs  <jdiggs@igalia.com>
2624
2625         [ATK] ARIA buttons which have a popup should be ATK_ROLE_PUSH_BUTTON; not ATK_ROLE_COMBO_BOX
2626         https://bugs.webkit.org/show_bug.cgi?id=171182
2627
2628         Reviewed by Chris Fleizach.
2629
2630         Test: accessibility/gtk/button-with-aria-haspopup-is-not-a-combobox.html
2631
2632         WebCore Accessibility assigns PopUpButtonRole to collapsed select elements,
2633         which the ATK code correctly maps to ATK_ROLE_COMBO_BOX. It turns out that
2634         WebCore Accessibility also maps the ARIA button role to PopUpButtonRole if
2635         it also has aria-haspopup. Add a check to atkRole() so that the latter case
2636         is mapped to ATK_ROLE_PUSH_BUTTON.
2637
2638         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2639         (atkRole):
2640
2641 2017-04-26  Tim Horton  <timothy_horton@apple.com>
2642
2643         Should not drag x-apple-data-detectors links
2644         https://bugs.webkit.org/show_bug.cgi?id=171352
2645         <rdar://problem/31309081>
2646
2647         Reviewed by Beth Dakin.
2648
2649         Test: fast/events/do-not-drag-and-drop-data-detectors-link.html
2650
2651         These links are only meaningful in the context of the original document,
2652         so they should not be draggable.
2653
2654         * editing/cocoa/DataDetection.h:
2655         * editing/cocoa/DataDetection.mm:
2656         (WebCore::DataDetection::dataDetectorURLProtocol):
2657         (WebCore::DataDetection::isDataDetectorURL):
2658         * page/DragController.cpp:
2659         (WebCore::isDraggableLink):
2660         Disallow dragging of <a href="x-apple-data-detectors://..."> links.
2661
2662 2017-04-26  Tim Horton  <timothy_horton@apple.com>
2663
2664         Revert accidentally smushed commit.
2665
2666         * editing/cocoa/DataDetection.h:
2667         * editing/cocoa/DataDetection.mm:
2668         (WebCore::DataDetection::dataDetectorURLProtocol): Deleted.
2669         (WebCore::DataDetection::isDataDetectorURL): Deleted.
2670         * page/DragController.cpp:
2671         (WebCore::isDraggableLink):
2672         * platform/mac/DragImageMac.mm:
2673         (WebCore::createDragImageForLink):
2674
2675 2017-04-26  Alex Christensen  <achristensen@webkit.org>
2676
2677         REGRESSION (r215686): ASSERTION FAILED: data seen with webarchive/loading tests
2678         https://bugs.webkit.org/show_bug.cgi?id=171340
2679
2680         Reviewed by Brady Eidson.
2681
2682         This fixes a flaky assertion in webarchive/loading/missing-data.html
2683
2684         * platform/cf/SharedBufferCF.cpp:
2685         (WebCore::SharedBuffer::append):
2686         If there's no CFDataRef, there's no need to append data.
2687         This happens sometimes.
2688
2689 2017-04-26  Ryan Haddad  <ryanhaddad@apple.com>
2690
2691         Unreviewed, rolling out r215814.
2692
2693         The LayoutTest for this change is failing on ios-simulator and
2694         is flaky on macOS.
2695
2696         Reverted changeset:
2697
2698         "Response.blob() does not set the content-type based on the
2699         header value."
2700         https://bugs.webkit.org/show_bug.cgi?id=170849
2701         http://trac.webkit.org/changeset/215814
2702
2703 2017-04-26  Wenson Hsieh  <wenson_hsieh@apple.com>
2704
2705         WebItemProviderPasteboard should not synchronously load provided data
2706         https://bugs.webkit.org/show_bug.cgi?id=171341
2707         <rdar://problem/31614010>
2708
2709         Reviewed by Tim Horton.
2710
2711         Refactors WebItemProviderPasteboard to not require asynchronously loading item provider data. To accomplish this,
2712         we ensure that before performing data interaction, the UTI type that the data operation target should consume is
2713         propagated to the UI process prior to the web process receiving the signal from the UI process to begin the
2714         data operation itself. This information is sent via WebPlatformStrategies::updatePreferredTypeIdentifiers, a new
2715         pasteboard helper function.
2716
2717         * page/DragController.cpp:
2718         (WebCore::DragController::DragController):
2719         (WebCore::dragIsHandledByDocument):
2720         (WebCore::DragController::performDragOperation):
2721         (WebCore::DragController::dragEnteredOrUpdated):
2722         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod):
2723         (WebCore::DragController::tryDocumentDrag):
2724
2725         Give DragHandlingMethod a richer representation of what type of action will be performed. DragController::
2726         updatePreferredTypeIdentifiersForDragHandlingMethod uses this to determine what kinds of UTIs are acceptable for
2727         the current drop session.
2728
2729         * page/DragController.h:
2730         (WebCore::DragController::documentIsHandlingNonDefaultDrag):
2731         * page/mac/DragControllerMac.mm:
2732         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod):
2733
2734         Updates the data interaction pasteboard's list of preferred type identifiers it should load upon data operation.
2735
2736         * platform/DragData.h:
2737         * platform/PasteboardStrategy.h:
2738         * platform/PlatformPasteboard.h:
2739         * platform/ios/AbstractPasteboard.h:
2740         * platform/ios/PlatformPasteboardIOS.mm:
2741         (WebCore::PlatformPasteboard::updatePreferredTypeIdentifiers):
2742         * platform/ios/WebItemProviderPasteboard.mm:
2743
2744         Introduce _preferredTypeIdentifiers, which -doAfterLoadingProvidedContentIntoFileURLs: uses as a hint when
2745         determining which UTI to load for an item provider. In the absence of preferred type identifiers, the default
2746         behavior is to use the highest fidelity type adhering to "public.content".
2747
2748         (-[WebItemProviderPasteboard init]):
2749         (-[WebItemProviderPasteboard updatePreferredTypeIdentifiers:]):
2750         (-[WebItemProviderPasteboard setItemProviders:]):
2751         (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
2752         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
2753
2754         Remove calls to -createObjectOfClass: and -copyDataRepresentation:. Instead, rely solely on the loaded file URL
2755         to read and initialize data and objects from the pasteboard.
2756
2757         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):
2758         (-[WebItemProviderPasteboard _tryToCreateObjectOfClass:usingProvider:]): Deleted.
2759         * platform/mac/DragDataMac.mm:
2760         (WebCore::DragData::updatePreferredTypeIdentifiers):
2761
2762 2017-04-26  Joanmarie Diggs  <jdiggs@igalia.com>
2763
2764         [ATK] Elements with a defined, non-false value for aria-current should expose ATK_STATE_ACTIVE
2765         https://bugs.webkit.org/show_bug.cgi?id=171163
2766
2767         Reviewed by Chris Fleizach.
2768
2769         Add ATK_STATE_ACTIVE to the state set of elements which have a valid, non-false
2770         value for aria-current, expose the value of via the "current" AtkObject attribute,
2771         and emit state-change notifications when the value of aria-current changes from
2772         non-false to false, or vice versa.
2773
2774         Tests: accessibility/gtk/aria-current-changed-notification.html
2775                accessibility/gtk/aria-current.html
2776
2777         * accessibility/AXObjectCache.cpp:
2778         (WebCore::AXObjectCache::handleAttributeChanged):
2779         * accessibility/AXObjectCache.h:
2780         * accessibility/AccessibilityObject.cpp:
2781         (WebCore::AccessibilityObject::supportsARIACurrent):
2782         (WebCore::AccessibilityObject::ariaCurrentValue):
2783         * accessibility/AccessibilityObject.h:
2784         * accessibility/atk/AXObjectCacheAtk.cpp:
2785         (WebCore::AXObjectCache::postPlatformNotification):
2786         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2787         (webkitAccessibleGetAttributes):
2788         (setAtkStateSetFromCoreObject):
2789         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2790         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): Moved code returning
2791         string value for aria-current into AccessibilityObject:ariaCurrentValue().
2792
2793 2017-04-26  Wenson Hsieh  <wenson_hsieh@apple.com>
2794
2795         WebItemProviderPasteboard should fetch preloaded assets from disk when possible
2796         https://bugs.webkit.org/show_bug.cgi?id=171320
2797         <rdar://problem/31614010>
2798
2799         Reviewed by Tim Horton.
2800
2801         Adds a mechanism to WebItemProviderPasteboard to remember the temporary file URLs of assets it has loaded using
2802         doAfterLoadingProvidedContentIntoFileURLs:. When retrieving data from the pasteboard, we then see if we can
2803         first fetch serialized data straight from disk instead of having to go through the item provider in both
2804         -dataForPasteboardType:inItemSet: and -valuesForPasteboardType:inItemSet:.
2805
2806         See below annotations for more detail.
2807
2808         * platform/ios/AbstractPasteboard.h:
2809         * platform/ios/PlatformPasteboardIOS.mm:
2810         (WebCore::PlatformPasteboard::filenamesForDataInteraction):
2811         * platform/ios/WebItemProviderPasteboard.h:
2812         * platform/ios/WebItemProviderPasteboard.mm:
2813
2814         Introduces _typeToFileURLMaps, an array of dictionaries. A dictionary at the ith index of this array represents
2815         a mapping of UTIs to loaded temo file URLs for the ith UIItemProvider in the _itemProviders array. Before data
2816         interaction is performed, all entries in this array will be empty.
2817
2818         (-[WebItemProviderPasteboard init]):
2819         (-[WebItemProviderPasteboard setItemProviders:]):
2820         (-[WebItemProviderPasteboard _preLoadedDataConformingToType:forItemProviderAtIndex:]):
2821         (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
2822         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
2823
2824         Consult any loaded assets on disk before hitting UIItemProviders via the new
2825         -_preLoadedDataConformingToType:forItemProviderAtIndex: helper method.
2826
2827         (-[WebItemProviderPasteboard _tryToCreateObjectOfClass:usingProvider:]):
2828         (-[WebItemProviderPasteboard fileURLsForDataInteraction]):
2829
2830         Traverse _typeToFileURLMaps to collect all file URLs.
2831
2832         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):
2833
2834         Refactored to populate and set _typeToFileURLMaps when loading completes, rather than an array of file URLs.
2835
2836         (-[WebItemProviderPasteboard _tryToCreateAndAppendObjectOfClass:toArray:usingProvider:]): Deleted.
2837         (-[WebItemProviderPasteboard filenamesForDataInteraction]): Deleted.
2838
2839         Correct an erroneously named method (replaces filenames with fileURLs).
2840
2841 2017-04-26  Youenn Fablet  <youenn@apple.com>
2842
2843         LayoutTest webrtc/datachannel/basic.html is a flaky crash
2844         https://bugs.webkit.org/show_bug.cgi?id=170154
2845         <rdar://problem/31288423>
2846
2847         Reviewed by Geoffrey Garen.
2848
2849         Before the patch, we are setting the channel handler client to null and then unregistering from observer to
2850         libwebrtc data channel. Since this happens in two different threads, there might be a timing issue.
2851
2852         Removing this risk by first unregistering (done synchronously on the other thread), before setting client to null.
2853         Made some clean-up related refactoring.
2854
2855         * Modules/mediastream/RTCDataChannel.cpp:
2856         (WebCore::RTCDataChannel::create):
2857         (WebCore::RTCDataChannel::close):
2858         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
2859         (WebCore::LibWebRTCDataChannelHandler::setClient):
2860         (WebCore::LibWebRTCDataChannelHandler::close):
2861         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
2862         * platform/mediastream/RTCDataChannelHandler.h:
2863         * platform/mock/RTCDataChannelHandlerMock.cpp:
2864         (WebCore::RTCDataChannelHandlerMock::setClient):
2865         * platform/mock/RTCDataChannelHandlerMock.h:
2866
2867 2017-04-26  Alex Christensen  <achristensen@webkit.org>
2868
2869         Make user script injection more robust
2870         https://bugs.webkit.org/show_bug.cgi?id=171339
2871         <rdar://problem/30643691>
2872
2873         Reviewed by Geoffrey Garen.
2874
2875         * loader/EmptyClients.cpp:
2876         * page/Frame.cpp:
2877         (WebCore::Frame::injectUserScripts):
2878         * page/UserContentController.cpp:
2879         (WebCore::UserContentController::forEachUserScript):
2880         (WebCore::UserContentController::forEachUserStyleSheet):
2881         (WebCore::UserContentController::forEachUserMessageHandler):
2882         * page/UserContentController.h:
2883         * page/UserContentProvider.h:
2884
2885 2017-04-26  Zalan Bujtas  <zalan@apple.com>
2886
2887         RTL: recent searches popover is displayed in incorrect location
2888         https://bugs.webkit.org/show_bug.cgi?id=171338
2889         <rdar://problem/31377807>
2890
2891         Reviewed by Dean Jackson.
2892
2893         Compute the absolute coordinates for the popup the same way we do for the select dropdown.
2894
2895         * rendering/RenderSearchField.cpp:
2896         (WebCore::RenderSearchField::showPopup):
2897
2898 2017-04-26  Said Abou-Hallawa  <sabouhallawa@apple.com>
2899
2900         Restrict WebKit image formats to a known whitelist
2901         https://bugs.webkit.org/show_bug.cgi?id=170700
2902
2903         Reviewed by Tim Horton.
2904
2905         If the image format is not supported, the load should be canceled and the
2906         image is marked a broken image.
2907
2908         Test: fast/images/image-formats-support.html
2909
2910         * loader/cache/CachedImage.cpp:
2911         (WebCore::CachedImage::addIncrementalDataBuffer):
2912         (WebCore::CachedImage::setImageDataBuffer):
2913         (WebCore::CachedImage::finishLoading):
2914         * loader/cache/CachedImage.h:
2915
2916 2017-04-26  Joanmarie Diggs  <jdiggs@igalia.com>
2917
2918         [ATK] Implement support for new ARIA 1.1 values of aria-haspopup
2919         https://bugs.webkit.org/show_bug.cgi?id=171164
2920
2921         Reviewed by Chris Fleizach.
2922
2923         In ARIA 1.1, aria-haspopup's value type changed from true/false to a token.
2924         Values: true, false (default, unless it's a combobox), dialog, grid, listbox
2925         (default for combobox), menu, and tree. Any value of aria-haspopup that is
2926         not included in the list of allowed values, including an empty string, must
2927         be treated as if the value false had been provided.
2928
2929         Add AccessibilityObject::ariaPopupValue() to validate the value, handle implicit
2930         values, and give platform assistive technologies a means to access that value.
2931
2932         If there is a valid, non-false value of aria-haspopup, include ATK_STATE_HAS_POPUP
2933         in the AtkStateSet. Lastly, expose the value (rather than true/false) via the "haspop"
2934         AtkObject attribute.
2935
2936         Test: accessibility/gtk/aria-haspopup.html
2937
2938         * accessibility/AccessibilityObject.h:
2939         (WebCore::AccessibilityObject::ariaPopupValue):
2940         (WebCore::AccessibilityObject::supportsARIAHasPopup):
2941         * accessibility/AccessibilityRenderObject.cpp:
2942         (WebCore::AccessibilityRenderObject::ariaHasPopup):
2943         * accessibility/AccessibilityRenderObject.h:
2944         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2945         (webkitAccessibleGetAttributes):
2946         (setAtkStateSetFromCoreObject):
2947
2948 2017-04-26  Alex Christensen  <achristensen@webkit.org>
2949
2950         Fix CMake build.
2951
2952         * PlatformMac.cmake:
2953
2954 2017-04-26  Antti Koivisto  <antti@apple.com>
2955
2956         Enable expired-only reload policy on Mac and iOS
2957         https://bugs.webkit.org/show_bug.cgi?id=171264
2958         <rdar://problem/31807637>
2959
2960         Reviewed by Andreas Kling.
2961
2962         Limit the behavior to http and data URLs (where we explicitly know about expiration).
2963
2964         * html/HTMLLinkElement.cpp:
2965         (WebCore::HTMLLinkElement::setCSSStyleSheet):
2966         * loader/FrameLoader.cpp:
2967         (WebCore::FrameLoader::subresourceCachePolicy):
2968
2969             Pass the URL so we can test for protocol.
2970
2971         * loader/FrameLoader.h:
2972         * loader/NavigationAction.cpp:
2973         (WebCore::navigationType):
2974
2975             Test for reload navigation type correctly.
2976
2977         * loader/cache/CachedResource.cpp:
2978         (WebCore::CachedResource::load):
2979         * loader/cache/CachedResourceLoader.cpp:
2980         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
2981         (WebCore::CachedResourceLoader::cachePolicy):
2982         * loader/cache/CachedResourceLoader.h:
2983
2984 2017-04-26  WebKit Contributor  <webkitcontrib@gmail.com>
2985
2986         Response.blob() does not set the content-type based on the header value.
2987         https://bugs.webkit.org/show_bug.cgi?id=170849
2988
2989         Reviewed by Alex Christensen.
2990
2991         The Fetch API specification requires setting the blob contentType
2992         using the Content-Type header value, if present.  Previously the
2993         FetchResponse class only called updateContentType() when first
2994         created even though all the headers were not available.  Call
2995         updateContentType() again after the headers are populated.
2996
2997         This change allows WebKit to pass the "Consume response's body: from
2998         fetch to blob" case in the WPT response-consume.html test.
2999
3000         Test: http://w3c-test.org/fetch/api/response/response-consume.html
3001
3002         * Modules/fetch/FetchResponse.cpp:
3003         (WebCore::FetchResponse::BodyLoader::didReceiveResponse): Modified to
3004         call FetchBodyOwner::updateContentType() after filling m_headers.
3005
3006 2017-04-26  Andy Estes  <aestes@apple.com>
3007
3008         Try to fix the macOS Sierra build.
3009
3010         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
3011
3012 2017-04-26  Andy Estes  <aestes@apple.com>
3013
3014         [macOS] Add picture-in-picture support to WebPlaybackControlsManager
3015         https://bugs.webkit.org/show_bug.cgi?id=171328
3016         <rdar://problem/29875010>
3017
3018         Reviewed by Jer Noble.
3019
3020         * platform/cocoa/WebPlaybackSessionModel.h:
3021         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
3022         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
3023         (WebCore::WebPlaybackSessionModelMediaElement::togglePictureInPicture): If the media element
3024         is currently in PiP fullscreen mode, exit fullscreen. Otherwise, enter PiP fullscreen mode.
3025         * platform/mac/WebPlaybackControlsManager.h:
3026         * platform/mac/WebPlaybackControlsManager.mm:
3027         (-[WebPlaybackControlsManager canTogglePictureInPicture]): Added. Returns YES if
3028         -allowsPictureInPicturePlayback returns YES.
3029         (-[WebPlaybackControlsManager togglePictureInPicture]): Added. Calls
3030         WebPlaybackSessionModel::togglePictureInPicture().
3031         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
3032         (WebCore::WebVideoFullscreenInterfaceMac::enterFullscreen): Added a call to
3033         -[WebPlaybackControlsManager setPictureInPictureActive:YES].
3034         (WebCore::WebVideoFullscreenInterfaceMac::exitFullscreen): Added a call to
3035         -[WebPlaybackControlsManager setPictureInPictureActive:NO].
3036         (WebCore::WebVideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode): Ditto.
3037         * platform/spi/cocoa/AVKitSPI.h: Declared new SPI on AVTouchBarPlaybackControlsControlling.
3038
3039 2017-04-25  Dean Jackson  <dino@apple.com>
3040
3041         [Color] Make gradients work with ExtendedColors
3042         https://bugs.webkit.org/show_bug.cgi?id=171315
3043         <rdar://problems/31830177>
3044
3045         Reviewed by Antoine Quint.
3046
3047         Allow gradients to hold Color objects, and thus
3048         handle ExtendedColor. Implement the backend for
3049         CoreGraphics.
3050
3051         Test: css3/color/gradients.html
3052
3053         * platform/graphics/Gradient.cpp:
3054         (WebCore::Gradient::addColorStop): Just copy the Color now.
3055         (WebCore::compareStops): Handle rename of stop to offset.
3056         (WebCore::Gradient::hasAlpha): Use Color's helper.
3057         * platform/graphics/Gradient.h:
3058         (WebCore::Gradient::ColorStop::ColorStop): Rename stop
3059         to offset, and store a Color rather than four floating
3060         point values.
3061         * platform/graphics/cairo/GradientCairo.cpp:
3062         (WebCore::Gradient::platformGradient):
3063         * platform/graphics/cg/GradientCG.cpp:
3064         (WebCore::Gradient::platformGradient): Use the CG method
3065         that can handle CGColorRefs with ColorSpace values, and
3066         pass the Extended sRGB space which should be no change for
3067         all existing gradients but also handle ColorSpaces like
3068         Display P3.
3069         * platform/graphics/win/GradientDirect2D.cpp:
3070         (WebCore::Gradient::generateGradient):
3071         * svg/SVGGradientElement.cpp:
3072         (WebCore::SVGGradientElement::buildStops):
3073
3074 2017-04-25  Alex Christensen  <achristensen@webkit.org>
3075
3076         Encoded filename should be decoded for WKContentExtension.identifier
3077         https://bugs.webkit.org/show_bug.cgi?id=171316
3078
3079         Reviewed by Andy Estes.
3080
3081         * platform/FileSystem.h:
3082
3083 2017-04-26  Frederic Wang  <fwang@igalia.com>
3084
3085         Fix typo in RenderFrameBase
3086         https://bugs.webkit.org/show_bug.cgi?id=171324
3087
3088         Reviewed by Zalan Bujtas.
3089
3090         No new tests, behavior unchanged.
3091
3092         * rendering/RenderFrameBase.cpp:
3093         (WebCore::RenderFrameBase::layoutWithFlattening):
3094         (WebCore::RenderFrameBase::performLayoutWithFlattening):
3095         (WebCore::RenderFrameBase::peformLayoutWithFlattening): Deleted.
3096         * rendering/RenderFrameBase.h:
3097
3098 2017-04-26  Zalan Bujtas  <zalan@apple.com>
3099
3100         Forced page break on :after triggers infinite loop in column balancing
3101         https://bugs.webkit.org/show_bug.cgi?id=171309
3102         rdar://problem/26285884
3103
3104         Reviewed by David Hyatt.
3105
3106         Stop trying to balance the columns when the forced page breaks >= the number of
3107         columns even when this number is 1. Content will always overflow to the next page.
3108         see https://chromium.googlesource.com/chromium/src/+/fbbebf38cefb2712c912581eccb046ef363ec84e%5E%21/#F2 
3109
3110         Test: fast/multicol/infinite-loop-when-forced-break.html
3111
3112         * rendering/RenderMultiColumnSet.cpp:
3113         (WebCore::RenderMultiColumnSet::calculateBalancedHeight):
3114
3115 2017-04-26  Said Abou-Hallawa  <sabouhallawa@apple.com>
3116
3117         Attempt to fix a JetStream regression.
3118         <rdar://problem/31742414>
3119
3120         Unreviewed.
3121
3122         Disable async decoding for large images till the flickering bug wk170640
3123         is fixed.
3124
3125         * platform/graphics/BitmapImage.cpp:
3126         (WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImages):
3127
3128 2017-04-26  Ryan Haddad  <ryanhaddad@apple.com>
3129
3130         Unreviewed, rolling out r215767.
3131
3132         The LayoutTest for this change is a flaky failure.
3133
3134         Reverted changeset:
3135
3136         "Restrict WebKit image formats to a known whitelist"
3137         https://bugs.webkit.org/show_bug.cgi?id=170700
3138         http://trac.webkit.org/changeset/215767
3139
3140 2017-04-26  Dave Hyatt  <hyatt@apple.com>
3141
3142         Improve wavy underline rendering
3143         https://bugs.webkit.org/show_bug.cgi?id=171281
3144
3145         Reviewed by Sam Weinig.
3146
3147         Change wavy underline rendering to use font size instead of stroke
3148         thickness as a way to tune it. Cut the extra offset from 2 to 1.
3149         Change the parameters to make the line flatter and to make the proportion
3150         of the wave that renders underneath a glyph the same.
3151
3152         * rendering/TextDecorationPainter.cpp:
3153         (WebCore::strokeWavyTextDecoration):
3154         (WebCore::TextDecorationPainter::paintTextDecoration):
3155         * style/InlineTextBoxStyle.cpp:
3156         (WebCore::getWavyStrokeParameters):
3157         (WebCore::visualOverflowForDecorations):
3158         * style/InlineTextBoxStyle.h:
3159         (WebCore::wavyOffsetFromDecoration):
3160
3161 2017-04-24  Sergio Villar Senin  <svillar@igalia.com>
3162
3163         [css-grid] Remove most of the usage of SizingOperation
3164         https://bugs.webkit.org/show_bug.cgi?id=171225
3165
3166         Reviewed by Darin Adler.
3167
3168         SizingOperation was added as a way to modify the behaviour of the track sizing algorithm
3169         with the specifics for intrinsic size computations. The problem is that although intrinsic
3170         size computation does imply indefinite sizes, the opposite is not always true. For example,
3171         a grid container with height:auto would compute the row sizes with an indefinite size but is
3172         not part of the intrinsic size (preferred widths) computation.
3173
3174         That's why it was wrongly used in some parts of the current code, in most of the cases is
3175         more than enough to check whether the available space is indefinite or not. In order to do
3176         that we have to keep both available sizes (height & width) around all the time to properly
3177         support orthogonal flows.
3178
3179         This change does not imply any change in behaviour.
3180
3181         * rendering/GridTrackSizingAlgorithm.cpp:
3182         (WebCore::GridTrackSizingAlgorithm::setAvailableSpace):
3183         (WebCore::GridTrackSizingAlgorithm::computeTrackBasedSize):
3184         (WebCore::GridTrackSizingAlgorithm::initialBaseSize):
3185         (WebCore::GridTrackSizingAlgorithm::initialGrowthLimit):
3186         (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem):
3187         (WebCore::GridTrackSizingAlgorithm::increaseSizesToAccommodateSpanningItems):
3188         (WebCore::GridTrackSizingAlgorithm::assumedRowsSizeForOrthogonalChild):
3189         (WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild):
3190         (WebCore::GridTrackSizingAlgorithm::gridTrackSize):
3191         (WebCore::IndefiniteSizeStrategy::findUsedFlexFraction):
3192         (WebCore::IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
3193         (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):
3194         (WebCore::GridTrackSizingAlgorithm::setup):
3195         (WebCore::GridTrackSizingAlgorithm::reset):
3196         * rendering/GridTrackSizingAlgorithm.h:
3197         (WebCore::GridTrackSizingAlgorithmStrategy::availableSpace):
3198         * rendering/RenderGrid.cpp:
3199         (WebCore::RenderGrid::availableSpaceForGutters):
3200         (WebCore::RenderGrid::computeTrackBasedLogicalHeight):
3201         (WebCore::RenderGrid::computeTrackSizesForDefiniteSize):
3202         (WebCore::RenderGrid::layoutBlock):
3203         (WebCore::RenderGrid::gridGap):
3204         (WebCore::RenderGrid::guttersSize):
3205         (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
3206         (WebCore::RenderGrid::computeTrackSizesForIndefiniteSize):
3207         (WebCore::RenderGrid::computeAutoRepeatTracksCount):
3208         (WebCore::RenderGrid::placeItemsOnGrid):
3209         (WebCore::RenderGrid::trackSizesForComputedStyle):
3210         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded):
3211         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
3212         (WebCore::RenderGrid::populateGridPositionsForDirection):
3213         (WebCore::RenderGrid::columnAxisOffsetForChild):
3214         (WebCore::RenderGrid::rowAxisOffsetForChild):
3215         (WebCore::RenderGrid::gridGapForDirection): Deleted.
3216         * rendering/RenderGrid.h:
3217
3218 2017-04-26  Frederic Wang  <fwang@igalia.com>
3219
3220         Remove Document::*FrameElementsShouldIgnoreScrolling
3221         https://bugs.webkit.org/show_bug.cgi?id=171271
3222
3223         Reviewed by Chris Dumez.
3224
3225         setFrameElementsShouldIgnoreScrolling and frameElementsShouldIgnoreScrolling were
3226         introduced bug 23072 in order to work around a bug in the Dictionary application.
3227         However, this was removed in bug 132095 and hence the functions are no longer necessary.
3228
3229         No new tests.
3230
3231         * dom/Document.h:
3232         (WebCore::Document::setFrameElementsShouldIgnoreScrolling): Deleted.
3233         (WebCore::Document::frameElementsShouldIgnoreScrolling): Deleted.
3234         * html/HTMLFrameElementBase.cpp:
3235         (WebCore::HTMLFrameElementBase::parseAttribute):
3236
3237 2017-04-26  Zan Dobersek  <zdobersek@igalia.com>
3238
3239         [GCrypt] CryptoKeyRSA: implement create(), keySizeInBits(), buildAlgorithm(), exportData()
3240         https://bugs.webkit.org/show_bug.cgi?id=171213
3241
3242         Reviewed by Michael Catanzaro.
3243
3244         CryptoKeyRSA::create() validates the specified key type along with the
3245         provided data. If everything is OK, it then proceeds to build the key
3246         of the appropriate type through an s-expression that is constructed with
3247         the necessary data. We don't currently support creating private keys
3248         with any additional prime information (apart from p and q).
3249
3250         CryptoKeyRSA::keySizeInBits() calls the helper getRSAModulusLength()
3251         function that find the modulus MPI in the key s-expression and returns
3252         the modulus data length in bits.
3253
3254         CryptoKeyRSA::buildAlgorithm() returns KeyAlgorithm that's constructed
3255         from the appropriate name, this key's modulus length, and this key's
3256         public exponent data. It also specifies the hash if there is such a
3257         restriction for this key.
3258
3259         CryptoKeyRSA::exportData() returns a properly-constructed
3260         CryptoKeyDataRSAComponents object. The public modulus and exponent are
3261         used in case the key is public. If the key is private, the secret
3262         exponent and the p and q prime numbers are retrieved in MPI format.
3263         They're then used to calculate the dp, dq and qi parameters that are
3264         exported in the JWK format. Note that libgcrypt internally switches
3265         the p and q prime numbers such that p < q, but the Web Crypto
3266         specification and the dependant RFCs expect that q < p. We address
3267         this by simply switching the roles of the two primes and follow the
3268         usual q < p assumption when exporting the primes and computing the
3269         dependant exponents and coefficients.
3270
3271         No new tests -- existing ones cover this but don't work yet due to missing
3272         RSA-related CryptoAlgorithm implementations.
3273
3274         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
3275         (WebCore::getRSAModulusLength):
3276         (WebCore::getParameterMPIData):
3277         (WebCore::getRSAKeyParameter):
3278         (WebCore::CryptoKeyRSA::create):
3279         (WebCore::CryptoKeyRSA::keySizeInBits):
3280         (WebCore::CryptoKeyRSA::buildAlgorithm):
3281         (WebCore::CryptoKeyRSA::exportData):
3282
3283 2017-04-25  Jiewen Tan  <jiewen_tan@apple.com>
3284
3285         [WebCrypto] Enhance ways to convert an ECDSA signature binary into DER format
3286         https://bugs.webkit.org/show_bug.cgi?id=171287
3287         <rdar://problem/31735332>
3288
3289         Reviewed by Brent Fulgham.
3290
3291         Covered by existing tests.
3292
3293         * crypto/mac/CryptoAlgorithmECDSAMac.cpp:
3294         (WebCore::verifyECDSA):
3295
3296 2017-04-25  Brent Fulgham  <bfulgham@apple.com>
3297
3298         Relax the event firing ASSERT for Attr changes
3299         https://bugs.webkit.org/show_bug.cgi?id=171236
3300         <rdar://problem/30516349>
3301
3302         Reviewed by Dean Jackson.
3303
3304         The assertions added in Bug 167318 were overly strict, and trigger for valid behavior.
3305         Relax the assertion preventing event dispatch for the case of Attr elements at the
3306         end of childrenChanged.
3307
3308         Test: fast/dom/HTMLLinkElement/event-while-removing-attribute.html
3309
3310         * dom/Attr.cpp:
3311         (WebCore::Attr::childrenChanged):
3312
3313 2017-04-25  John Wilander  <wilander@apple.com>
3314
3315         Resource Load Statistics: Introduce shorter time-to-live for cookie partition whitelisting
3316         https://bugs.webkit.org/show_bug.cgi?id=171295
3317         <rdar://problem/31823818>
3318
3319         Reviewed by Brent Fulgham.
3320
3321         Test: http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html
3322
3323         * loader/ResourceLoadObserver.cpp:
3324         (WebCore::reduceTimeResolutionToOneDay): Deleted.
3325         (WebCore::reduceTimeResolution):
3326             Changed name to no longer lock this to a specific resolution.
3327         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3328             Now calls WebCore::reduceTimeResolution().
3329         (WebCore::ResourceLoadObserver::setTimeToLiveCookiePartitionFree):
3330             Added for testing purposes.
3331         (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
3332             Added for testing purposes.
3333         * loader/ResourceLoadObserver.h:
3334         * loader/ResourceLoadStatisticsStore.cpp:
3335         (WebCore::shouldPartitionCookies):
3336             Static inline convenience function.
3337         (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
3338             Now decides whether a domain should get partitioned cookies
3339             based on timeToLiveCookiePartitionFree.
3340             Removed clearFirst parameter since it's not needed here
3341             and it introduced complexity in keeping the store and the
3342             network process cache in sync.
3343         (WebCore::ResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
3344             Added for testing purposes.
3345         * loader/ResourceLoadStatisticsStore.h:
3346
3347 2017-04-25  Saam Barati  <sbarati@apple.com>
3348
3349         JSArray::isArrayPrototypeIteratorProtocolFastAndNonObservable is wrong because it does not do the necessary checks on the base object
3350         https://bugs.webkit.org/show_bug.cgi?id=171150
3351         <rdar://problem/31771880>
3352
3353         Reviewed by Sam Weinig.
3354
3355         This patch moves the sequence converters to use the now fixed
3356         JSArray::isArrayPrototypeIteratorProtocolFastAndNonObservable test
3357         inside JSC.
3358         
3359         This patch also fixes a few bugs:
3360         1. Converting to a sequence of numbers must prove that the JSArray
3361         is filled only with Int32/Double. If there is a chance the array
3362         contains objects, the conversion to a numeric IDLType can be observable
3363         (via valueOf()), and can change the iterator protocol.
3364         2. There are other conversions that can have side effects a-la valueOf().
3365         This patch introduces a new static constant in the various Converter
3366         classes that tell the sequence converter if the conversion operation
3367         can have JS side effects. If it does have side effects, we fall back to
3368         the generic conversion that uses the iterator protocol. If not, we can
3369         do a faster version that iterates over each element of the array,
3370         reading it directly, and converting it.
3371
3372         Tests: js/sequence-iterator-protocol-2.html
3373                js/sequence-iterator-protocol.html
3374
3375         * bindings/js/JSDOMConvertAny.h: Does not have side effects.
3376         * bindings/js/JSDOMConvertBase.h: We pessimistically assume inside DefaultConverter that converions have side effects.
3377         * bindings/js/JSDOMConvertBoolean.h: Does not have side effects.
3378         * bindings/js/JSDOMConvertCallbacks.h: Does not have side effects.
3379         * bindings/js/JSDOMConvertObject.h: Does not have side effects.
3380         * bindings/js/JSDOMConvertSequences.h:
3381         (WebCore::Detail::NumericSequenceConverter::convert):
3382         (WebCore::Detail::SequenceConverter::convert):
3383
3384 2017-04-25  Michael Saboff  <msaboff@apple.com>
3385
3386         Call bmalloc scavenger first when handling a memory pressure event
3387         https://bugs.webkit.org/show_bug.cgi?id=171289
3388
3389         Reviewed by Geoffrey Garen.
3390
3391         Let bmalloc free any pages to the OS that it can before doing anything else.
3392
3393         * page/MemoryRelease.cpp:
3394         (WebCore::releaseMemory):
3395
3396 2017-04-25  Dean Jackson  <dino@apple.com>
3397
3398         Skip WebKitAdditions for Safari Technology Preview media controls
3399         https://bugs.webkit.org/show_bug.cgi?id=171302
3400         <rdar://problem/31823256>
3401
3402         Reviewed by Simon Fraser.
3403
3404         Safari Technology Preview should use the same controls
3405         as OpenSource.
3406
3407         * WebCore.xcodeproj/project.pbxproj:
3408
3409 2017-04-25  Ryan Haddad  <ryanhaddad@apple.com>
3410
3411         Unreviewed, rolling out r215730.
3412
3413         The LayoutTest for this change is a flaky timeout on mac-wk1
3414         debug.
3415
3416         Reverted changeset:
3417
3418         "Enable expired-only reload policy on Mac and iOS"
3419         https://bugs.webkit.org/show_bug.cgi?id=171264
3420         http://trac.webkit.org/changeset/215730
3421
3422 2017-04-24  Matt Rajca  <mrajca@apple.com>
3423
3424         Indicate presence of audio when handling autoplay events.
3425         https://bugs.webkit.org/show_bug.cgi?id=171227
3426
3427         Reviewed by Alex Christensen.
3428
3429         Added API tests.
3430
3431         * html/HTMLMediaElement.cpp:
3432         (WebCore::HTMLMediaElement::handleAutoplayEvent):
3433         (WebCore::HTMLMediaElement::playInternal):
3434         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
3435         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
3436         (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay):
3437         (WebCore::HTMLMediaElement::setPlaybackWithoutUserGesture):
3438         * html/HTMLMediaElement.h:
3439