Purge PassRefPtr in Modules/webdatabase
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-06-30  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
2
3         Purge PassRefPtr in Modules/webdatabase
4         https://bugs.webkit.org/show_bug.cgi?id=159255
5
6         Reviewed by Benjamin Poulain.
7
8         As a step to remove PassRefPtr use, this patch cleans it up in Modules/webdatabase.
9
10         Additionally unnecessary spaces and tabs are removed too.
11
12         * Modules/webdatabase/ChangeVersionWrapper.cpp:
13         * Modules/webdatabase/DOMWindowWebDatabase.h:
14         * Modules/webdatabase/Database.cpp:
15         (WebCore::Database::Database):
16         (WebCore::Database::~Database):
17         (WebCore::Database::scheduleTransaction):
18         (WebCore::Database::runTransaction):
19         * Modules/webdatabase/Database.h:
20         * Modules/webdatabase/DatabaseAuthorizer.cpp:
21         (WebCore::DatabaseAuthorizer::allowRead):
22         * Modules/webdatabase/DatabaseManager.cpp:
23         (WebCore::DatabaseManager::openDatabase):
24         (WebCore::DatabaseManager::fullPathForDatabase):
25         (WebCore::DatabaseManager::detailsForNameAndOrigin):
26         * Modules/webdatabase/DatabaseManager.h:
27         * Modules/webdatabase/DatabaseTask.cpp:
28         (WebCore::DatabaseTransactionTask::DatabaseTransactionTask):
29         * Modules/webdatabase/DatabaseTask.h:
30         * Modules/webdatabase/SQLCallbackWrapper.h:
31         (WebCore::SQLCallbackWrapper::SQLCallbackWrapper):
32         * Modules/webdatabase/SQLResultSetRowList.h:
33         * Modules/webdatabase/SQLStatement.cpp:
34         (WebCore::SQLStatement::SQLStatement):
35         (WebCore::SQLStatement::sqlError):
36         (WebCore::SQLStatement::sqlResultSet):
37         * Modules/webdatabase/SQLStatement.h:
38         * Modules/webdatabase/SQLTransaction.h:
39         * Modules/webdatabase/SQLTransactionBackend.cpp:
40         (WebCore::SQLTransactionBackend::create):
41         (WebCore::SQLTransactionBackend::SQLTransactionBackend):
42         (WebCore::SQLTransactionBackend::transactionError):
43         * Modules/webdatabase/SQLTransactionBackend.h:
44
45 2016-06-30  Carlos Garcia Campos  <cgarcia@igalia.com>
46
47         [Coordinated Graphics] Move CompositingCoordinator from platform to WebKit2 layer
48         https://bugs.webkit.org/show_bug.cgi?id=159209
49
50         Reviewed by Žan Doberšek.
51
52         Remove CompositingCoordinator and its helper classes from the platform layer.
53
54         * platform/TextureMapper.cmake:
55
56 2016-06-29  Youenn Fablet  <youenn@apple.com>
57
58         Pass SecurityOrigin as references in CORS check code
59         https://bugs.webkit.org/show_bug.cgi?id=159263
60
61         Reviewed by Alex Christensen.
62
63         No change of behavior.
64
65         * css/CSSImageSetValue.cpp:
66         (WebCore::CSSImageSetValue::cachedImageSet):
67         * css/CSSImageValue.cpp:
68         (WebCore::CSSImageValue::cachedImage):
69         * dom/ScriptElement.cpp:
70         (WebCore::ScriptElement::requestScript):
71         * loader/CrossOriginAccessControl.cpp:
72         (WebCore::updateRequestForAccessControl):
73         (WebCore::createAccessControlPreflightRequest):
74         (WebCore::passesAccessControlCheck):
75         * loader/CrossOriginAccessControl.h:
76         * loader/CrossOriginPreflightChecker.cpp:
77         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
78         * loader/DocumentThreadableLoader.cpp:
79         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
80         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
81         (WebCore::DocumentThreadableLoader::preflightSuccess):
82         (WebCore::DocumentThreadableLoader::isAllowedRedirect):
83         (WebCore::DocumentThreadableLoader::securityOrigin):
84         * loader/DocumentThreadableLoader.h:
85         * loader/ImageLoader.cpp:
86         (WebCore::ImageLoader::updateFromElement):
87         * loader/LinkLoader.cpp:
88         (WebCore::preloadIfNeeded):
89         * loader/MediaResourceLoader.cpp:
90         (WebCore::MediaResourceLoader::requestResource):
91         * loader/SubresourceLoader.cpp:
92         (WebCore::SubresourceLoader::checkCrossOriginAccessControl):
93         * loader/TextTrackLoader.cpp:
94         (WebCore::TextTrackLoader::load):
95         * loader/cache/CachedResource.cpp:
96         (WebCore::CachedResource::passesAccessControlCheck):
97         * loader/cache/CachedResourceRequest.cpp:
98         (WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin):
99
100 2016-06-29  Adam Bergkvist  <adam.bergkvist@ericsson.com>
101
102         WebRTC: Implement MediaEndpointPeerConnection::setConfiguration()
103         https://bugs.webkit.org/show_bug.cgi?id=159254
104
105         Reviewed by Eric Carlson.
106
107         Implement MediaEndpointPeerConnection::setConfiguration() which is the
108         MediaEndpointPeerConnection implementation of RTCPeerConnection.setConfiguration() [1].
109
110         [1] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#dom-rtcpeerconnection-setconfiguration
111
112         Testing: Updated existing test.
113
114         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
115         (WebCore::MediaEndpointPeerConnection::setConfiguration):
116         Implemented.
117         * Modules/mediastream/RTCConfiguration.cpp:
118         (WebCore::RTCConfiguration::initialize):
119         * Modules/mediastream/RTCConfiguration.h:
120         Use shared enums.
121         * Modules/mediastream/RTCConfiguration.idl:
122         Remove 'None'/'Public' IceTransportPolicy enum value (removed from WebRTC 1.0).
123         * platform/mediastream/MediaEndpointConfiguration.cpp:
124         (WebCore::MediaEndpointConfiguration::MediaEndpointConfiguration):
125         * platform/mediastream/MediaEndpointConfiguration.h:
126         Use shared enums.
127         (WebCore::MediaEndpointConfiguration::create):
128         * platform/mediastream/PeerConnectionStates.h: Renamed from Source/WebCore/Modules/mediastream/PeerConnectionStates.h.
129         Make shared enums accessible to platform objects (currently MediaEndpointConfiguration).
130
131 2016-06-29  Hunseop Jeong  <hs85.jeong@samsung.com>
132
133         Unreviewed, CMake build fix - 2.
134
135         * PlatformMac.cmake:
136
137 2016-06-29  Hunseop Jeong  <hs85.jeong@samsung.com>
138
139         Unreviewed, CMake build fix. 
140
141         * PlatformMac.cmake:
142
143 2016-06-29  Jer Noble  <jer.noble@apple.com>
144
145         Unprefix webkit-playsinline.
146         https://bugs.webkit.org/show_bug.cgi?id=159283
147
148         Reviewed by Eric Carlson.
149
150         Tests: media/video-playsinline.html
151                media/video-webkit-playsinline.html
152
153         Unprefix the webkit-playsinline content attribute, as an unprefixed version
154         was added to the HTML spec by <https://github.com/whatwg/html/pull/1444>.
155         The new 'playsinline' content attribute reflects to a new DOM property of
156         the same name.
157
158         * html/HTMLAttributeNames.in:
159         * html/HTMLVideoElement.idl:
160         * html/MediaElementSession.cpp:
161         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
162
163 2016-06-29  Alex Christensen  <achristensen@webkit.org>
164
165         Fix null dereferencing after r201441
166         https://bugs.webkit.org/show_bug.cgi?id=159282
167         rdar://problem/27082559
168
169         Reviewed by Andreas Kling.
170
171         No new tests.  This is reproducible when dragging from regular to high-DPI displays, 
172         and we don't have testing infrastructure for simulating that.
173
174         * css/MediaQueryMatcher.cpp:
175         (WebCore::MediaQueryMatcher::styleResolverChanged):
176         MediaQueryListListener::queryChanged can mutate the Vector of listeners while we are iterating it.
177         Copy the Vector of listeners and iterate the copy so we don't go out of bounds.
178
179 2016-06-29  Antti Koivisto  <antti@apple.com>
180
181         Factor pending CSS resources into a struct
182         https://bugs.webkit.org/show_bug.cgi?id=159268
183
184         Reviewed by Andreas Kling.
185
186         To fix resource loading related re-entrancy issues in StyleResolver we should move the triggering of
187         resource loads outside the style resolver. The first step for that is to capture pending resources to a struct.
188
189         * CMakeLists.txt:
190         * WebCore.xcodeproj/project.pbxproj:
191         * css/CSSCursorImageValue.cpp:
192         (WebCore::CSSCursorImageValue::cachedImage):
193         (WebCore::CSSCursorImageValue::cachedOrPendingImage):
194         * css/CSSCursorImageValue.h:
195         * css/CSSGradientValue.cpp:
196         (WebCore::GradientStop::GradientStop):
197         (WebCore::CSSGradientValue::gradientWithStylesResolved):
198         * css/CSSGradientValue.h:
199         (WebCore::CSSGradientValue::loadSubimages):
200         (WebCore::CSSGradientValue::CSSGradientValue):
201         * css/CSSImageSetValue.cpp:
202         (WebCore::CSSImageSetValue::cachedImageSet):
203         (WebCore::CSSImageSetValue::cachedOrPendingImageSet):
204         * css/CSSImageSetValue.h:
205         * css/StyleResolver.cpp:
206         (WebCore::StyleResolver::State::clear):
207         (WebCore::StyleResolver::State::setParentStyle):
208         (WebCore::StyleResolver::State::ensurePendingResources):
209         (WebCore::isAtShadowBoundary):
210         (WebCore::StyleResolver::cachedOrPendingFromValue):
211         (WebCore::StyleResolver::generatedOrPendingFromValue):
212         (WebCore::StyleResolver::setOrPendingFromValue):
213         (WebCore::StyleResolver::cursorOrPendingFromValue):
214         (WebCore::filterOperationForType):
215         (WebCore::StyleResolver::createFilterOperations):
216         (WebCore::StyleResolver::loadPendingResources):
217         (WebCore::StyleResolver::MatchedProperties::MatchedProperties):
218         (WebCore::StyleResolver::loadPendingSVGDocuments): Deleted.
219         (WebCore::StyleResolver::loadPendingImage): Deleted.
220         (WebCore::StyleResolver::loadPendingShapeImage): Deleted.
221         (WebCore::StyleResolver::loadPendingImages): Deleted.
222         * css/StyleResolver.h:
223         (WebCore::StyleResolver::rootElementStyle):
224         (WebCore::StyleResolver::element):
225         (WebCore::StyleResolver::document):
226         (WebCore::StyleResolver::documentSettings):
227         (WebCore::StyleResolver::State::setApplyPropertyToVisitedLinkStyle):
228         (WebCore::StyleResolver::State::applyPropertyToRegularStyle):
229         (WebCore::StyleResolver::State::applyPropertyToVisitedLinkStyle):
230         (WebCore::StyleResolver::State::setFontDirty):
231         (WebCore::StyleResolver::State::fontDirty):
232         (WebCore::StyleResolver::State::useSVGZoomRules):
233         (WebCore::StyleResolver::State::takePendingResources):
234         (WebCore::StyleResolver::State::cssToLengthConversionData):
235         (WebCore::StyleResolver::State::cascadeLevel):
236         (WebCore::StyleResolver::State::setCascadeLevel):
237         (WebCore::StyleResolver::state):
238         (WebCore::StyleResolver::State::pendingImageProperties): Deleted.
239         (WebCore::StyleResolver::State::filtersWithPendingSVGDocuments): Deleted.
240         * style/StylePendingResources.cpp: Added.
241         (WebCore::Style::loadPendingImage):
242         (WebCore::Style::loadPendingImages):
243         (WebCore::Style::loadPendingSVGFilters):
244         (WebCore::Style::loadPendingResources):
245
246             Move the functions for triggering the resource loads from StyleResolver.
247
248         * style/StylePendingResources.h: Added.
249
250             Add struct for pending resources.
251
252 2016-06-29  Anders Carlsson  <andersca@apple.com>
253
254         Add "type" and "paymentPass" properties in PaymentMethod
255         https://bugs.webkit.org/show_bug.cgi?id=159278
256         rdar://problem/26999112
257
258         Reviewed by Dean Jackson.
259
260         * Modules/applepay/cocoa/PaymentMethodCocoa.mm:
261         (WebCore::toString):
262         (WebCore::toDictionary):
263
264 2016-06-29  Nan Wang  <n_wang@apple.com>
265
266         AX: Crash in WebCore::Document::focusNavigationStartingNode(WebCore::FocusDirection) const + 128
267         https://bugs.webkit.org/show_bug.cgi?id=159240
268
269         Reviewed by Ryosuke Niwa.
270
271         This crash is caused by passing an empty node to ElementTraversal::previous(Node&). When the
272         focusNavigationStartingNode has been removed and it has no next sibling, we should fallback
273         to itself for calculating the next focused element.
274
275         Test: fast/events/remove-focus-navigation-starting-point-crash.html
276
277         * dom/Document.cpp:
278         (WebCore::Document::focusNavigationStartingNode):
279
280 2016-06-29  Ryan Haddad  <ryanhaddad@apple.com>
281
282         Unreviewed, rolling out r202617.
283
284         The LayoutTest from this change crashes under GuardMalloc
285
286         Reverted changeset:
287
288         "Throw exceptions for invalid number of channels for
289         ConvolverNode"
290         https://bugs.webkit.org/show_bug.cgi?id=159238
291         http://trac.webkit.org/changeset/202617
292
293 2016-06-29  Anders Carlsson  <andersca@apple.com>
294
295         Rename addressFields to contactFields
296         https://bugs.webkit.org/show_bug.cgi?id=159271
297         rdar://problem/27086955
298
299         Reviewed by Beth Dakin.
300
301         * Modules/applepay/ApplePaySession.cpp:
302         (WebCore::createContactFields):
303         (WebCore::isValidPaymentRequestPropertyName):
304         (WebCore::createPaymentRequest):
305         (WebCore::createAddressFields): Deleted.
306         * Modules/applepay/PaymentRequest.h:
307         (WebCore::PaymentRequest::requiredBillingContactFields):
308         (WebCore::PaymentRequest::setRequiredBillingContactFields):
309         (WebCore::PaymentRequest::requiredShippingContactFields):
310         (WebCore::PaymentRequest::setRequiredShippingContactFields):
311         (WebCore::PaymentRequest::requiredBillingAddressFields): Deleted.
312         (WebCore::PaymentRequest::setRequiredBillingAddressFields): Deleted.
313         (WebCore::PaymentRequest::requiredShippingAddressFields): Deleted.
314         (WebCore::PaymentRequest::setRequiredShippingAddressFields): Deleted.
315
316 2016-06-29  Jiewen Tan  <jiewen_tan@apple.com>
317
318         Unreviewed, third attempt to fix ASAN build for r202599
319
320         * platform/text/TextCodecReplacement.cpp:
321         (WebCore::TextCodecReplacement::decode):
322
323 2016-06-29  Jer Noble  <jer.noble@apple.com>
324
325         Adopt MediaRemote.
326         https://bugs.webkit.org/show_bug.cgi?id=159250
327
328         Reviewed by Eric Carlson.
329
330         Adopt MediaRemote and use the framework to implement MediaSessionManageMac
331         and RemoteCommandListenerMac.
332
333         * WebCore.xcodeproj/project.pbxproj:
334         * platform/RemoteCommandListener.cpp:
335         * platform/audio/PlatformMediaSessionManager.cpp:
336         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: Renamed from Source/WebCore/platform/audio/mac/MediaSessionManagerMac.cpp.
337         (PlatformMediaSessionManager::updateSessionState):
338         * platform/audio/mac/MediaSessionManagerMac.h: Added.
339         * platform/audio/mac/MediaSessionManagerMac.mm: Added.
340         (WebCore::PlatformMediaSessionManager::sharedManager):
341         (WebCore::PlatformMediaSessionManager::sharedManagerIfExists):
342         (WebCore::MediaSessionManagerMac::MediaSessionManagerMac):
343         (WebCore::MediaSessionManagerMac::~MediaSessionManagerMac):
344         (WebCore::MediaSessionManagerMac::sessionWillBeginPlayback):
345         (WebCore::MediaSessionManagerMac::removeSession):
346         (WebCore::MediaSessionManagerMac::sessionWillEndPlayback):
347         (WebCore::MediaSessionManagerMac::clientCharacteristicsChanged):
348         (WebCore::MediaSessionManagerMac::nowPlayingEligibleSession):
349         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo):
350         * platform/cocoa/SoftLinking.h:
351         * platform/mac/MediaRemoteSoftLink.cpp: Added.
352         * platform/mac/MediaRemoteSoftLink.h: Added.
353         * platform/mac/RemoteCommandListenerMac.h: Added.
354         (WebCore::RemoteCommandListenerMac::createWeakPtr):
355         * platform/mac/RemoteCommandListenerMac.mm: Added.
356         (WebCore::RemoteCommandListener::create):
357         (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac):
358         (WebCore::RemoteCommandListenerMac::~RemoteCommandListenerMac):
359         * platform/spi/mac/MediaRemoteSPI.h: Added.
360
361 2016-06-29  Jer Noble  <jer.noble@apple.com>
362
363         Cannot clear a MediaSource SourceBuffer in Safari 9 and WebKit nightly
364         https://bugs.webkit.org/show_bug.cgi?id=159230
365
366         Reviewed by Eric Carlson.
367
368         Test: media/media-source/media-source-remove.html (modified)
369
370         Move to using a MediaTime directly (rather than as a double) to add
371         and removed buffered ranges. Also, drop the use of the "microsecond"
372         fudge factor when adding buffered ranges.
373
374         * Modules/mediasource/SourceBuffer.cpp:
375         (WebCore::removeSamplesFromTrackBuffer):
376         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
377
378 2016-06-29  Jiewen Tan  <jiewen_tan@apple.com>
379
380         Unreviewed, second attempt to fix ASAN build for r202599
381
382         * platform/text/TextCodecReplacement.cpp:
383
384 2016-06-29  Jiewen Tan  <jiewen_tan@apple.com>
385
386         Unreviewed, first attempt to fix ASAN build for r202599
387
388         * platform/text/TextCodecReplacement.cpp:
389
390 2016-06-29  Joseph Pecoraro  <pecoraro@apple.com>
391
392         Web Inspector: Show Shadow Root type in DOM Tree
393         https://bugs.webkit.org/show_bug.cgi?id=159236
394         <rdar://problem/27068521>
395
396         Reviewed by Timothy Hatcher.
397
398         Test: inspector/dom/shadowRootType.html
399
400         * inspector/InspectorDOMAgent.cpp:
401         (WebCore::shadowRootType):
402         (WebCore::InspectorDOMAgent::buildObjectForNode):
403         Set the shadowRootType property when a node is a ShadowRoot.
404
405 2016-06-29  Jeremy Jones  <jeremyj@apple.com>
406
407         Replace MPAudioVideoRoutingActionSheet with MPAVRoutingSheet.
408         https://bugs.webkit.org/show_bug.cgi?id=159161
409         <rdar://problem/26017691>
410
411         Reviewed by Sam Weinig.
412
413         Replace MPAudioVideoRoutingActionSheet SPI with MPAVRoutingSheet SPI.
414
415         * platform/spi/ios/MediaPlayerSPI.h:
416
417 2016-06-29  Alejandro G. Castro  <alex@igalia.com>
418
419         WebRTC: ice-char can not contain '=' characters for credentials
420         https://bugs.webkit.org/show_bug.cgi?id=159207
421
422         Reviewed by Eric Carlson.
423
424         Avoid a general calculation to get a base64 without padding which
425         was wrong in the randomString function. Because each parameter
426         using the function requires a different setup depending of the
427         specification and this is not a general API, it is a better
428         solution to calculate and store the sizes we want to use, comment
429         them and test them, considering we use base64 to generate the
430         strings we just need to avoid padding.
431
432         Existing test modified to match the correct behavior.
433
434         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
435         (WebCore::randomString): Now the size is the one passed.
436         (WebCore::MediaEndpointPeerConnection::MediaEndpointPeerConnection):
437         Used different valid values following the sdp parser in each case.
438
439 2016-06-29  David Kilzer  <ddkilzer@apple.com>
440
441         Crash when 'input' event handler for input[type=color] changes the input type
442         <https://webkit.org/b/159262>
443         <rdar://problem/27020404>
444
445         Reviewed by Daniel Bates.
446
447         Fix based on a Blink change (patch by <tkent@chromium.org>):
448         <https://chromium.googlesource.com/chromium/src.git/+/a17cb3ecef49a078657524cdeaba33ad2083646c>
449
450         Test: fast/forms/color/color-type-change-on-input-crash.html
451
452         * html/ColorInputType.cpp:
453         (WebCore::ColorInputType::didChooseColor): Add EventQueueScope
454         before setValueFromRenderer() to fix the bug.
455         * html/HTMLInputElement.h:
456         (WebCore::HTMLInputElement::setValueFromRenderer): Add comment
457         about how to use this method.
458
459 2016-06-29  Adam Bergkvist  <adam.bergkvist@ericsson.com>
460
461         WebRTC: Misc MediaStreamEvent fixes: Update build flag and remove PassRefPtr usage
462         https://bugs.webkit.org/show_bug.cgi?id=159132
463
464         Reviewed by Eric Carlson.
465
466         Use the WEB_RTC build flag instead of MEDIA_STREAM since this event is related to
467         RTCPeerConnection. Also remove PassRefPtr usage.
468
469         Updated existing expected results.
470
471         * Modules/mediastream/MediaStreamEvent.cpp:
472         (WebCore::MediaStreamEvent::create):
473         (WebCore::MediaStreamEvent::MediaStreamEvent):
474         * Modules/mediastream/MediaStreamEvent.h:
475         * Modules/mediastream/MediaStreamEvent.idl:
476         * dom/EventNames.in:
477
478 2016-06-29  Adam Bergkvist  <adam.bergkvist@ericsson.com>
479
480         REGRESSION(r202337) [WebRTC] Crash when loading html5test.com
481         https://bugs.webkit.org/show_bug.cgi?id=159145
482
483         Reviewed by Eric Carlson.
484
485         MediaEndpointPeerConnection uses an implementation of the MediaEndpoint interface to
486         interact with the port's WebRTC backend. A mock (MockMediaEndpoint) is used for testing.
487         This change adds an "empty" MediaEndpoint implementation that simplifies the case when a
488         port builds and tests with MediaEndpointPeerConnection/MockMediaEndpoint, but doesn't have
489         a "real" MediaEndpoint implementation yet (to use with MiniBrowser).
490
491         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
492         (WebCore::MediaEndpointPeerConnection::MediaEndpointPeerConnection):
493         * platform/mediastream/MediaEndpoint.cpp:
494         (WebCore::EmptyRealtimeMediaSource::create):
495         (WebCore::EmptyRealtimeMediaSource::EmptyRealtimeMediaSource):
496         (WebCore::EmptyMediaEndpoint::EmptyMediaEndpoint):
497         (WebCore::createMediaEndpoint):
498
499 2016-06-29  Alejandro G. Castro  <alex@igalia.com>
500
501         Fix assertion in debug build when creating the SocketStreamHandle object.
502
503         We have to call relaxAdoptionRequirement to avoid the assertion
504         when protecting the non-adopted SocketStreamHandle we are
505         creating. Update to r202370.
506
507         Rubber-stamped by Carlos Garcia Campos.
508
509         * platform/network/soup/SocketStreamHandleSoup.cpp:
510         (WebCore::SocketStreamHandle::SocketStreamHandle):
511
512 2016-06-29  David Kilzer  <ddkilzer@apple.com>
513
514         Throw exceptions for invalid number of channels for ConvolverNode
515         <https://webkit.org/b/159238>
516         <rdar://problem/27020410>
517
518         Reviewed by Brent Fulgham.
519
520         Fix based on a Blink change (patch by <rtoy@chromium.org>):
521         <https://chromium.googlesource.com/chromium/src.git/+/0cc26bbb7175aec77910d0b47faf9f8c8a640fe5>
522
523         Test: webaudio/convolver-channels.html
524
525         * Modules/webaudio/ConvolverNode.cpp:
526         (WebCore::ConvolverNode::setBuffer): Throw an exception for
527         anything but 1, 2 or 4 channels.
528
529 2016-06-29  Carlos Garcia Campos  <cgarcia@igalia.com>
530
531         REGRESSION(r198782, r201043): [image-decoders] Flickering with some animated gif
532         https://bugs.webkit.org/show_bug.cgi?id=159089
533
534         Reviewed by Antonio Gomes.
535
536         There's some flickering when loading big enough animated gifs running the animation in a loop. The first time it
537         loads everything is fine, but after the first loop iteration there are several flickering effects, once every
538         time the animation finishes and some others happening in the middle of the animation loop. The flickering
539         happens because we fail to render some of the frames, and it has two diferent causes:
540
541          - In r198782, ImageDecoder::createFrameImageAtIndex(), was modified to check first if the image is empty to
542         return early, and then try to get the frame image from the decoder. This is the aone causing the flickering
543         always on the first frame after one iteration. It happens because ImageDecoder::size() is always empty at that
544         point. The first time doesn't happen because the gif is loaded and BitmapImage calls isSizeAvailable() from
545         BitmapImage::dataChanged(). The isSizeAvailable call makes the gif decoder calculate the size. But for the next
546         iterations, frames are cached and BitmapImage already has the decoded data so isSizeAvailable is not called
547         again. When createFrameImageAtIndex() is called again for the first frame, size is empty until the gif decoder
548         creates the reader again, which happens when frameBufferAtIndex() is called, so after that the size is
549         available. So, we could call isSizeAvailable before checking the size, or simply do the check after the
550         frameBufferAtIndex() call as we used to do.
551
552          - In r201043 BitmapImage::destroyDecodedDataIfNecessary() was fixed to use the actual bytes used by the frame
553         in order to decide whether to destroy decoded data or not. This actually revealed a bug, it didn't happen before
554         because we were never destroying frames before. The bug is in the gif decoder that doesn't correctly handle the
555         case of destroying only some of the frames from the buffer cache. The gif decoder is designed to always process the
556         frames in order, the reader keeps an index of the currently processed frame, so when some frames are read from the
557         cache, and then we ask the decoder for a not cached frame, the currently processed frame is not in sync with the
558         actual frame we are asking for, and we end do not processing any frame at all.
559
560         * platform/image-decoders/ImageDecoder.cpp:
561         (WebCore::ImageDecoder::createFrameImageAtIndex): Check the size after calling frameBufferAtIndex().
562         * platform/image-decoders/gif/GIFImageDecoder.cpp:
563         (WebCore::GIFImageDecoder::clearFrameBufferCache): Delete the reader when clearing the cache since it's out of sync.
564
565 2016-06-28  Carlos Garcia Campos  <cgarcia@igalia.com>
566
567         [GStreamer] Adaptive streaming issues
568         https://bugs.webkit.org/show_bug.cgi?id=144040
569
570         Reviewed by Philippe Normand.
571
572         There are multiple deadlocks in the web process when HLS content is loaded by GStreamer. It happens because gst
573         is using several threads to download manifest, fragments, monitor the downloads, etc. To download the fragments
574         and manifest it always creates the source element in a separate thread, something that is not actually expected
575         to happen in WebKit source element. Our source element is always scheduling tasks (start, stop, need-data,
576         enough-data and seek) to the main thread, and those downloads that use the ResourceHandleStreamingClient
577         (there's no player associated) also happen in the main thread, because libsoup calls all its async callbacks in
578         the main thread. So, the result is that it can happen that we end up blocking the main thread in a lock until
579         the download finishes, but the download never finishes because tasks are scheduled in the main thread that is
580         blocked in a lock. This can be prevented by always using a secondary thread for downloads made by
581         ResourceHandleStreamingClient, using its own run loop with a different GMainContext so that libsoup sends
582         callbacks to the right thread. We also had to refactor the tasks a bit, leaving the thread safe parts to be run
583         in the calling thread always, and only scheduling to the main thread in case of not using
584         ResourceHandleStreamingClient and only for the non thread safe parts.
585         This patch also includes r200455 that was rolled out, but it was a perfectly valid workaround for GST bug.
586
587         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
588         (WTF::ensureGRef): Consume the floating ref if needed.
589         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
590         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
591         (webkit_web_src_init): Check if object is being created in the main thread.
592         (webKitWebSrcStop): Stop the media resource loader in the main thread and the resource handle streaming in the
593         current thread.
594         (webKitWebSrcStart): Start the media resource loader in the main thread and the resource handle streaming in
595         the current thread.
596         (webKitWebSrcChangeState): Call webKitWebSrcStart and webKitWebSrcStop in the current thread.
597         (webKitWebSrcNeedData): Update status in the current thread and notify the media resource loader in the main thread.
598         (webKitWebSrcEnoughData): Ditto.
599         (webKitWebSrcSeek): Ditto.
600         (webKitWebSrcSetMediaPlayer): Add an assert to ensure that source elements used by WebKit are always created in
601         the main thread.
602         (ResourceHandleStreamingClient::ResourceHandleStreamingClient): Use a secondary thread to do the download.
603         (ResourceHandleStreamingClient::~ResourceHandleStreamingClient): Stop the secondary thread.
604         (ResourceHandleStreamingClient::setDefersLoading): Notify the secondary thread.
605
606 2016-06-28  Youenn Fablet  <youennf@gmail.com>
607
608         Remove ThreadableLoaderOptions origin
609         https://bugs.webkit.org/show_bug.cgi?id=159221
610
611         Reviewed by Sam Weinig.
612
613         No change of behavior.
614
615         * loader/DocumentThreadableLoader.cpp:
616         (WebCore::DocumentThreadableLoader::loadResourceSynchronously): Adding origing parameter.
617         (WebCore::DocumentThreadableLoader::create): Ditto.
618         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Ditto.
619         (WebCore::DocumentThreadableLoader::redirectReceived): Setting m_origin.
620         (WebCore::DocumentThreadableLoader::securityOrigin): Checking m_origin.
621         * loader/DocumentThreadableLoader.h: Adding m_origin member.
622         * loader/ThreadableLoader.cpp:
623         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions): Removing origin.
624         (WebCore::ThreadableLoaderOption::isolatedCopy): Deleted.
625         * loader/ThreadableLoader.h: Removing origin parameter and isolatedCopy function.
626         * loader/WorkerThreadableLoader.cpp:
627         (WebCore::LoaderTaskOptions::LoaderTaskOptions): Structure to pass loader task options from one thread to another.
628         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
629         * page/EventSource.cpp:
630         (WebCore::EventSource::connect): Removing setting of the origin.
631         * workers/WorkerScriptLoader.cpp:
632         (WebCore::WorkerScriptLoader::loadSynchronously): Ditto.
633         (WebCore::WorkerScriptLoader::loadAsynchronously): Ditto.
634         * xml/XMLHttpRequest.cpp:
635         (WebCore::XMLHttpRequest::createRequest): Ditto.
636
637 2016-06-28  Commit Queue  <commit-queue@webkit.org>
638
639         Unreviewed, rolling out r202580.
640         https://bugs.webkit.org/show_bug.cgi?id=159245
641
642         Caused all WKTR tests to fail on GuardMalloc and Production
643         only for unknown reasons, investigating offline. (Requested by
644         brrian on #webkit).
645
646         Reverted changeset:
647
648         "RunLoop::Timer should use constructor templates instead of
649         class templates"
650         https://bugs.webkit.org/show_bug.cgi?id=159153
651         http://trac.webkit.org/changeset/202580
652
653 2016-06-28  Benjamin Poulain  <benjamin@webkit.org>
654
655         Rename ChildrenAffectedByActive to StyleAffectedByActive
656         https://bugs.webkit.org/show_bug.cgi?id=159187
657
658         Reviewed by Antti Koivisto.
659
660         Flags named "ChildrenAffectedBy" are used when the invalidation
661         of children is so crazy that we invalidate the whole parent subtree instead.
662
663         That's not the case for :active. It is a straightforward element invalidation.
664         Consequently, the property is renamed to StyleAffectedByActive.
665
666         * dom/Element.cpp:
667         (WebCore::Element::setActive):
668         (WebCore::Element::setStyleAffectedByActive):
669         (WebCore::Element::hasFlagsSetDuringStylingOfChildren):
670         (WebCore::Element::rareDataStyleAffectedByActive):
671         (WebCore::Element::setChildrenAffectedByActive): Deleted.
672         (WebCore::Element::rareDataChildrenAffectedByActive): Deleted.
673         * dom/Element.h:
674         (WebCore::Element::styleAffectedByActive):
675         (WebCore::Element::childrenAffectedByActive): Deleted.
676         * dom/ElementRareData.h:
677         (WebCore::ElementRareData::styleAffectedByActive):
678         (WebCore::ElementRareData::setStyleAffectedByActive):
679         (WebCore::ElementRareData::ElementRareData):
680         (WebCore::ElementRareData::resetDynamicRestyleObservations):
681         (WebCore::ElementRareData::childrenAffectedByActive): Deleted.
682         (WebCore::ElementRareData::setChildrenAffectedByActive): Deleted.
683         * style/StyleRelations.cpp:
684         (WebCore::Style::commitRelations):
685
686 2016-06-28  Jiewen Tan  <jiewen_tan@apple.com>
687
688         Implement "replacement" codec
689         https://bugs.webkit.org/show_bug.cgi?id=159180
690         <rdar://problem/26015178>
691
692         Reviewed by Brent Fulgham.
693
694         Test: fast/encoding/charset-replacement.html
695
696         Add support for "replacement" codec according to the spec:
697         https://encoding.spec.whatwg.org/#replacement
698         According to the spec, encoding labels {"csiso2022kr", "hz-gb-2312", "iso-2022-cn",
699         "iso-2022-cn-ext", "iso-2022-kr"} are used to conduct certain attacks that abuse
700         a mismatch between encodings supported on the server and the client. Therefore,
701         they are grouped under the "replacement" codec, which does the following things
702         to prevent those attacks.
703         1) Decode: terminates with a single U+FFFD.
704         2) Encode: treated as UTF-8.
705
706         Furthermore, the "replacement" codec is a specification convenience to group those
707         vulnerable encoding labels. Therefore, it should not be able to use directly.
708
709         This change is based on the following Blink changes:
710         https://codereview.chromium.org/265973003, and
711         https://codereview.chromium.org/261013007.
712
713         * CMakeLists.txt:
714         * WebCore.xcodeproj/project.pbxproj:
715         * platform/text/TextAllInOne.cpp:
716         * platform/text/TextCodecReplacement.cpp: Added.
717         (WebCore::TextCodecReplacement::create):
718         (WebCore::TextCodecReplacement::TextCodecReplacement):
719         (WebCore::TextCodecReplacement::registerEncodingNames):
720         (WebCore::TextCodecReplacement::registerCodecs):
721         (WebCore::TextCodecReplacement::decode):
722         * platform/text/TextCodecReplacement.h: Added.
723         * platform/text/TextEncoding.cpp:
724         (WebCore::TextEncoding::TextEncoding):
725         * platform/text/TextEncodingRegistry.cpp:
726         (WebCore::isReplacementEncoding):
727         (WebCore::extendTextCodecMaps):
728         * platform/text/TextEncodingRegistry.h:
729
730 2016-06-28  Dean Jackson  <dino@apple.com>
731
732         Remove incorrect comments in HTMLCanvasElement
733         https://bugs.webkit.org/show_bug.cgi?id=159229
734
735         Reviewed by Sam Weinig.
736
737         These comments are wrong.
738
739         * html/HTMLCanvasElement.cpp:
740         (WebCore::HTMLCanvasElement::probablySupportsContext):
741         (WebCore::HTMLCanvasElement::getContext): Deleted.
742
743 2016-06-28  Geoffrey Garen  <ggaren@apple.com>
744
745         CrashTracer beneath JSC::MarkedBlock::specializedSweep
746         https://bugs.webkit.org/show_bug.cgi?id=159223
747
748         Reviewed by Saam Barati.
749
750         This crash is caused by a media element re-entering JS during the GC
751         sweep phase.
752
753         In theory, other CachedResourceClients in the DOM might also trigger
754         similar bugs, but our data only implicates the media elements, so this
755         fix targets them.
756
757         * html/HTMLDocument.h: Document has no reason to inherit from
758         CachedResourceClient. I found this becuase I had to search for all
759         CachedResourceClients in researching this patch.
760
761         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
762         (WebCore::WebCoreAVCFResourceLoader::invalidate): Delay our call to
763         stopLoading because it might re-enter JS, and we might have been called
764         by the GC sweep phase destroying a media element.
765
766         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
767         (WebCore::WebCoreAVFResourceLoader::invalidate): Ditto.
768
769 2016-06-28  Saam Barati  <sbarati@apple.com>
770
771         some Watchpoints' ::fireInternal method will call operations that might GC where the GC will cause the watchpoint itself to destruct
772         https://bugs.webkit.org/show_bug.cgi?id=159198
773         <rdar://problem/26302360>
774
775         Reviewed by Filip Pizlo.
776
777         * bindings/js/JSDOMWindowBase.cpp:
778         (WebCore::JSDOMWindowBase::fireFrameClearedWatchpointsForWindow):
779         * bindings/scripts/CodeGeneratorJS.pm:
780         (GenerateHeader):
781         * bindings/scripts/test/JS/JSTestEventTarget.h:
782         (WebCore::JSTestEventTarget::create):
783
784 2016-06-28  Anders Carlsson  <andersca@apple.com>
785
786         Move the user gesture requirement to the ApplePaySession constructor
787         https://bugs.webkit.org/show_bug.cgi?id=159225
788         rdar://problem/26507267
789
790         Reviewed by Tim Horton.
791
792         By doing this, clients can do pre-validation before showing the sheet, while we still maintain the user gesture requirement.
793
794         * Modules/applepay/ApplePaySession.cpp:
795         (WebCore::ApplePaySession::create):
796         (WebCore::ApplePaySession::begin): Deleted.
797
798 2016-06-28  Youenn Fablet  <youenn@apple.com>
799
800         Iterable interfaces should have their related prototype @@iterator property writable
801         https://bugs.webkit.org/show_bug.cgi?id=159211
802         <rdar://problem/26950766>
803
804         Reviewed by Chris Dumez.
805
806         Updating @@iterator property according  http://heycam.github.io/webidl/#es-iterator.
807
808         Covered by updated test.
809
810         * bindings/scripts/CodeGeneratorJS.pm:
811         (GenerateImplementation): Removing ReadOnly flag from @@iterator property of iterable interfaces.
812         * bindings/scripts/test/JS/JSTestNode.cpp:
813         (WebCore::JSTestNodePrototype::finishCreation): Rebasing expectation.
814         * bindings/scripts/test/JS/JSTestObj.cpp:
815         (WebCore::JSTestObjPrototype::finishCreation): Ditto.
816
817 2016-06-28  Anders Carlsson  <andersca@apple.com>
818
819         "Total amount is too big" error message is displaying on clicking Pay button
820         https://bugs.webkit.org/show_bug.cgi?id=159219
821         rdar://problem/26722110
822
823         Reviewed by Tim Horton.
824
825         Match the PassKit max amount.
826
827         * Modules/applepay/PaymentRequestValidator.cpp:
828         (WebCore::PaymentRequestValidator::validateTotal):
829
830 2016-06-28  Anders Carlsson  <andersca@apple.com>
831
832         PaymentMerchantSession should wrap a PKPaymentMerchantSession
833         https://bugs.webkit.org/show_bug.cgi?id=159218
834         rdar://problem/26872118
835
836         Reviewed by Tim Horton.
837
838         * Modules/applepay/ApplePaySession.cpp:
839         (WebCore::ApplePaySession::completeMerchantValidation):
840         Use PaymentMerchantSession::fromJS.
841
842         (WebCore::createMerchantSession): Deleted.
843
844         * Modules/applepay/PaymentCoordinator.h:
845         PaymentMerchantSession is now a class.
846
847         * Modules/applepay/PaymentCoordinatorClient.h:
848         PaymentMerchantSession is now a class.
849
850         * Modules/applepay/PaymentMerchantSession.h:
851         (WebCore::PaymentMerchantSession::PaymentMerchantSession):
852         (WebCore::PaymentMerchantSession::~PaymentMerchantSession):
853         (WebCore::PaymentMerchantSession::pkPaymentMerchantSession):
854         Store a PKPaymentMerchantSession in a RetainPtr inside the PaymentMerchantSession object.
855
856         * Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm:
857         (WebCore::PaymentMerchantSession::fromJS):
858         Convert the JS object to a PKPaymentMerchantSession and return a PaymentMerchantSession that wraps it.
859
860         * WebCore.xcodeproj/project.pbxproj:
861         Add new files.
862
863         * bindings/js/Dictionary.h:
864         (WebCore::Dictionary::initializerObject):
865         Add new getter.
866
867 2016-06-28  Brian Burg  <bburg@apple.com>
868
869         RunLoop::Timer should use constructor templates instead of class templates
870         https://bugs.webkit.org/show_bug.cgi?id=159153
871
872         Reviewed by Alex Christensen.
873
874         Remove the RunLoop::Timer class template argument, and pass its constructor
875         a reference to `this` instead of a pointer to `this`.
876
877         * Modules/mediasession/WebMediaSessionManager.cpp:
878         (WebCore::WebMediaSessionManager::WebMediaSessionManager):
879         * Modules/mediasession/WebMediaSessionManager.h:
880         * page/WheelEventTestTrigger.cpp:
881         (WebCore::WheelEventTestTrigger::WheelEventTestTrigger):
882         * page/WheelEventTestTrigger.h:
883         * page/mac/TextIndicatorWindow.h:
884         * page/mac/TextIndicatorWindow.mm:
885         (WebCore::TextIndicatorWindow::TextIndicatorWindow):
886         * platform/MainThreadSharedTimer.h:
887         * platform/cocoa/ScrollController.h:
888         * platform/cocoa/ScrollController.mm:
889         (WebCore::ScrollController::ScrollController):
890         * platform/glib/MainThreadSharedTimerGLib.cpp:
891         (WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
892         * platform/graphics/MediaPlaybackTargetPicker.cpp:
893         (WebCore::MediaPlaybackTargetPicker::MediaPlaybackTargetPicker):
894         * platform/graphics/MediaPlaybackTargetPicker.h:
895         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
896         (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
897         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
898         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
899         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
900         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
901         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
902         (VideoRenderRequestScheduler::VideoRenderRequestScheduler):
903         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
904         (WebCore::TextureMapperPlatformLayerProxy::TextureMapperPlatformLayerProxy):
905         (WebCore::TextureMapperPlatformLayerProxy::activateOnCompositingThread):
906         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
907         * platform/mock/MediaPlaybackTargetPickerMock.cpp:
908         (WebCore::MediaPlaybackTargetPickerMock::MediaPlaybackTargetPickerMock):
909         * platform/mock/MediaPlaybackTargetPickerMock.h:
910         * platform/mock/MockRealtimeVideoSource.cpp:
911         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
912         * platform/mock/MockRealtimeVideoSource.h:
913         * platform/network/ResourceHandleInternal.h:
914         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
915
916 2016-06-27  Jer Noble  <jer.noble@apple.com>
917
918         Cross-domain video loads do not prompt for authorization.
919         https://bugs.webkit.org/show_bug.cgi?id=159195
920         <rdar://problem/26234612>
921
922         Reviewed by Brent Fulgham.
923
924         Test: http/tests/media/video-auth.html (modified)
925
926         We should prompt for authorization when a cross-origin <video> is embedded
927         in a web page.
928
929         * loader/MediaResourceLoader.cpp:
930         (WebCore::MediaResourceLoader::requestResource):
931
932 2016-06-28  Ryosuke Niwa  <rniwa@webkit.org>
933
934         REGRESSION(r201471): FormClient.textFieldDidEndEditing is no longer called when a text field is removed
935         https://bugs.webkit.org/show_bug.cgi?id=159199
936         <rdar://problem/26748189>
937
938         Reviewed by Alexey Proskuryakov.
939
940         The bug was caused by HTMLInputElement's endEditing no longer getting called due to the behavior change.
941         Preserve the WebKit2 API semantics by manually calling HTMLInputElement::endEditing in setFocusedElement.
942
943         Tests: WebKit2TextFieldDidBeginAndEndEditing
944
945         * dom/Document.cpp:
946         (WebCore::Document::setFocusedElement):
947
948 2016-06-28  Frederic Wang  <fwang@igalia.com>
949
950         Phrasing content should be accepted in <mo> elements
951         https://bugs.webkit.org/show_bug.cgi?id=130245
952
953         Reviewed by Brent Fulgham.
954
955         After r202420, the RenderMathMLOperator element no longer messes with anonymous block and
956         text nodes. Hence it is now safe to allow foreign content inside <mo>.
957
958         We extend foreign-element-in-token.html to cover the mo case.
959
960         * mathml/MathMLTextElement.cpp:
961         (WebCore::MathMLTextElement::childShouldCreateRenderer): Remove the early return for <mo> so
962         that it accepts phrasing content children.
963
964 2016-06-27  Anders Carlsson  <andersca@apple.com>
965
966         WebKit::WebPaymentCoordinator leak
967         https://bugs.webkit.org/show_bug.cgi?id=159168
968         rdar://problem/26929772
969
970         Reviewed by Beth Dakin.
971
972         * Modules/applepay/PaymentCoordinator.cpp:
973         (WebCore::PaymentCoordinator::~PaymentCoordinator):
974         Call paymentCoordinatorDestroyed().
975
976         * Modules/applepay/PaymentCoordinatorClient.h:
977         Rename mainFrameDestroyed to paymentCoordinatorDestroyed().
978
979         * loader/EmptyClients.cpp:
980
981 2016-06-28  Frederic Wang  <fwang@igalia.com>
982
983         Remove anonymous in renderName for all MathML renderers but RenderMathMLOperator
984         https://bugs.webkit.org/show_bug.cgi?id=159114
985
986         Reviewed by Martin Robinson.
987
988         After r202420, the only anonymous MathML renderers are the RenderMathMLOperators created by
989         the mfenced element. Hence we remove the special case for anonymous in the renderName
990         implementation of most MathML renderers.
991
992         No new tests, behavior unchanged.
993
994         * rendering/mathml/RenderMathMLRow.h:
995         * rendering/mathml/RenderMathMLSpace.h:
996         * rendering/mathml/RenderMathMLToken.h:
997
998 2016-06-28  Adam Bergkvist  <adam.bergkvist@ericsson.com>
999
1000         WebRTC: Robustify 'this' type check in RTCPeerConnection JS built-ins
1001         https://bugs.webkit.org/show_bug.cgi?id=158831
1002
1003         Reviewed by Youenn Fablet.
1004
1005         Use @operations slot in RTCPeerConnection type check.
1006
1007         Updated results of existing test.
1008
1009         * Modules/mediastream/RTCPeerConnection.js:
1010         (initializeRTCPeerConnection):
1011         Initialize @operations slot in constructor.
1012         * Modules/mediastream/RTCPeerConnectionInternals.js:
1013         (isRTCPeerConnection):
1014         Use @operations slot in type check.
1015
1016 2016-06-28  Frederic Wang  <fwang@igalia.com>
1017
1018         AX: Remove dead code in AccessibilityRenderObject::textUnderElement
1019         https://bugs.webkit.org/show_bug.cgi?id=159205
1020
1021         Reviewed by Joanmarie Diggs.
1022
1023         RenderMathMLOperator used to destroy its descendants and to replace them with an anonymous
1024         text node wrapped inside anonymous blocks. After r202420, it just behaves as any other token
1025         elements. Hence we remove the code in AccessibilityRenderObject::textUnderElement that was
1026         used to handle this specific render tree structure.
1027
1028         No new tests, already covered by accessibility/math-text.html.
1029
1030         * accessibility/AccessibilityRenderObject.cpp:
1031         (WebCore::AccessibilityRenderObject::textUnderElement): Remove dead code for RenderText and RenderMathMLOperator.
1032
1033 2016-06-28  Per Arne Vollan  <pvollan@apple.com>
1034
1035         [Win] Custom elements tests are failing.
1036         https://bugs.webkit.org/show_bug.cgi?id=159139
1037
1038         Reviewed by Alex Christensen.
1039
1040         Fix compile errors after enabling custom element API.
1041
1042         * bindings/js/JSHTMLElementCustom.cpp:
1043         (WebCore::constructJSHTMLElement):
1044         * dom/CustomElementDefinitions.cpp:
1045         (WebCore::CustomElementDefinitions::addElementDefinition):
1046         * dom/Document.cpp:
1047         (WebCore::createHTMLElementWithNameValidation):
1048         (WebCore::createFallbackHTMLElement):
1049         * dom/Element.cpp:
1050         (WebCore::Element::attributeChanged):
1051         * dom/LifecycleCallbackQueue.cpp:
1052         (WebCore::LifecycleQueueItem::LifecycleQueueItem):
1053         (WebCore::LifecycleCallbackQueue::enqueueElementUpgrade):
1054         (WebCore::LifecycleCallbackQueue::enqueueAttributeChangedCallback):
1055         * html/parser/HTMLConstructionSite.cpp:
1056         (WebCore::HTMLConstructionSite::insertHTMLElementOrFindCustomElementInterface):
1057         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
1058         * html/parser/HTMLDocumentParser.cpp:
1059         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder):
1060         * html/parser/HTMLTreeBuilder.cpp:
1061         (WebCore::CustomElementConstructionData::CustomElementConstructionData):
1062         (WebCore::HTMLTreeBuilder::insertGenericHTMLElement):
1063         * html/parser/HTMLTreeBuilder.h:
1064
1065 2016-06-28  Philippe Normand  <pnormand@igalia.com>
1066
1067         [GStreamer] usec rounding is wrong during accurate seeking
1068         https://bugs.webkit.org/show_bug.cgi?id=90734
1069
1070         Reviewed by Carlos Garcia Campos.
1071
1072         Use floor() to round the microseconds value, this is more robust
1073         than roundf.
1074
1075         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
1076         (WebCore::toGstClockTime):
1077         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1078         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition):
1079
1080 2016-06-28  Philippe Normand  <pnormand@igalia.com>
1081
1082         [GStreamer] improved duration query support in the HTTP source element
1083         https://bugs.webkit.org/show_bug.cgi?id=159204
1084
1085         Reviewed by Carlos Garcia Campos.
1086
1087         When we have the Content-Length value it is possible to infer the TIME
1088         duration in most cases by performing a convert query in the downstream
1089         elements. This is especially useful when the duration query wasn't
1090         managed by the sinks and thus reached the source element.
1091
1092         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1093         (webKitWebSrcQueryWithParent):
1094
1095 2016-06-28  Youenn Fablet  <youenn@apple.com>
1096
1097         Binding generator should generate accessors for constructors safely accessed from JS builtin
1098         https://bugs.webkit.org/show_bug.cgi?id=159087
1099
1100         Reviewed by Alex Christensen.
1101
1102         Removed constructor private slots direct additions in JSDOMGlobalObject.
1103         Added support for generating the code that will do that.
1104         Advantage of the implementation:
1105         - Private slots will expose constructors that are also publically visible (previously workers had some private slots filled with WebRTC constructors).
1106         - Private slots no longer require the creation of the constructors at window creation time.
1107
1108         Although PublicIdentifier and PrivateIdentifier are both added where needed, the binding generator does not
1109         support the case of a constructor accessible only privately.
1110
1111         Covered by existing test set and adding binding test.
1112
1113         * Modules/mediastream/MediaStream.idl: Marked as PublicIdentifier/PrivateIdentifier.
1114         * Modules/mediastream/MediaStreamTrack.idl: Ditto.
1115         * Modules/mediastream/RTCIceCandidate.idl: Ditto.
1116         * Modules/mediastream/RTCSessionDescription.idl: Ditto.
1117         * Modules/streams/ReadableStream.idl: Ditto.
1118         * bindings/js/JSDOMGlobalObject.cpp:
1119         (WebCore::JSDOMGlobalObject::addBuiltinGlobals): Removed unneeded additions.
1120         * bindings/scripts/CodeGeneratorJS.pm:
1121         (GenerateImplementation): Added support for private slots for interface constructors marked as
1122         PrivateIdentifier.
1123         * bindings/scripts/preprocess-idls.pl:
1124         (GenerateConstructorAttribute): Make PublicIdentifier/PrivateIdentifier copied interface attributes.
1125         * bindings/scripts/test/GObject/WebKitDOMTestGlobalObject.cpp:
1126         (webkit_dom_test_global_object_set_property):
1127         (webkit_dom_test_global_object_get_property):
1128         (webkit_dom_test_global_object_class_init):
1129         (webkit_dom_test_global_object_get_public_and_private_attribute):
1130         (webkit_dom_test_global_object_set_public_and_private_attribute):
1131         * bindings/scripts/test/GObject/WebKitDOMTestGlobalObject.h:
1132         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1133         (WebCore::JSTestGlobalObject::finishCreation):
1134         (WebCore::jsTestGlobalObjectPublicAndPrivateAttribute):
1135         (WebCore::setJSTestGlobalObjectPublicAndPrivateAttribute):
1136         * bindings/scripts/test/ObjC/DOMTestGlobalObject.h:
1137         * bindings/scripts/test/ObjC/DOMTestGlobalObject.mm:
1138         (-[DOMTestGlobalObject publicAndPrivateAttribute]):
1139         (-[DOMTestGlobalObject setPublicAndPrivateAttribute:]):
1140         * bindings/scripts/test/TestGlobalObject.idl:
1141
1142
1143 2016-06-27  Jer Noble  <jer.noble@apple.com>
1144
1145         REGRESSION?(r202466): http/tests/security/canvas-remote-read-remote-video-redirect.html failing on Sierra
1146         https://bugs.webkit.org/show_bug.cgi?id=159172
1147         <rdar://problem/27030025>
1148
1149         Reviewed by Brent Fulgham.
1150
1151         Add a hasSingleSecurityOrigin property to WebCoreNSURLSession that gets updated each time one of that
1152         sessions' tasks receieves a response or a redirect request. Check that property from the MediaPlayerPrivate.
1153
1154         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1155         (WebCore::MediaPlayerPrivateAVFoundationObjC::hasSingleSecurityOrigin):
1156         * platform/network/cocoa/WebCoreNSURLSession.h:
1157         * platform/network/cocoa/WebCoreNSURLSession.mm:
1158         (-[WebCoreNSURLSession updateHasSingleSecurityOrigin:]):
1159         (-[WebCoreNSURLSession dataTaskWithRequest:]):
1160         (-[WebCoreNSURLSession dataTaskWithURL:]):
1161         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
1162         (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:]):
1163
1164 2016-06-27  Alex Christensen  <achristensen@webkit.org>
1165
1166         CMake build fix.
1167
1168         * PlatformMac.cmake:
1169
1170 2016-06-27  Youenn Fablet  <youenn@apple.com>
1171
1172         Remove didFailAccessControlCheck ThreadableLoaderClient callback
1173         https://bugs.webkit.org/show_bug.cgi?id=159149
1174
1175         Reviewed by Daniel Bates.
1176
1177         Adding an AccessControl ResourceError type.
1178         Replacing didFailAccessControlCheck callback by a direct call to didFail with an error of type AccessControl.
1179
1180         Making CrossOriginPreflightChecker always return an AccessControl error. Previously some errors created below
1181         were passed directly to threadable loader clients.
1182
1183         When doing preflight on unauthorized web sites, WTR/DRT will trigger a cancellation error which was translating into an abort event in XMLHttpRequest.
1184         This patch is changing the error type to AccessControl, which translates into an error event in XMLHttpReauest.
1185
1186         This change of behavior is seen in imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred.htm.
1187         No other observable change of behavior should be expected.
1188
1189         * inspector/InspectorNetworkAgent.cpp: Computing error message in didFail according the error type.
1190         * loader/CrossOriginPreflightChecker.cpp:
1191         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse): Setting preflightFailure error type to AccessControl.
1192         (WebCore::CrossOriginPreflightChecker::notifyFinished): Ditto.
1193         (WebCore::CrossOriginPreflightChecker::doPreflight): Ditto.
1194         * loader/DocumentThreadableLoader.cpp:
1195         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): Replacing didFailAccessControlCheck
1196         callback by a direct call to didFail with an error of type AccessControl.
1197         (WebCore::reportContentSecurityPolicyError): Ditto.
1198         (WebCore::reportCrossOriginResourceSharingError): Ditto.
1199         (WebCore::DocumentThreadableLoader::didReceiveResponse): Ditto.
1200         (WebCore::DocumentThreadableLoader::preflightFailure): Calling didFail directly.
1201         * loader/ThreadableLoaderClient.h: Removing didFailAccessControlCheck.
1202         * loader/ThreadableLoaderClientWrapper.h: Ditto.
1203         * loader/WorkerThreadableLoader.cpp: Ditto.
1204         * loader/WorkerThreadableLoader.h: Ditto.
1205         * page/EventSource.cpp:
1206         (WebCore::EventSource::didFail): Removing didFailAccessControlCheck and putting handling code in didFail.
1207         * page/EventSource.h:
1208         * platform/network/ResourceErrorBase.cpp:
1209         (WebCore::ResourceErrorBase::setType): Softening the assertion to cover the case of migration to AccessControl.
1210         * platform/network/ResourceErrorBase.h: Adding AccessControl error type.
1211         (WebCore::ResourceErrorBase::isAccessControl):
1212
1213 2016-06-27  Chris Dumez  <cdumez@apple.com>
1214
1215         HTMLElement / SVGElement should implement GlobalEventHandlers, not Element
1216         https://bugs.webkit.org/show_bug.cgi?id=159191
1217         <rdar://problem/27019299>
1218
1219         Reviewed by Ryosuke Niwa.
1220
1221         HTMLElement / SVGElement should implement GlobalEventHandlers, not Element:
1222         - https://html.spec.whatwg.org/multipage/dom.html#htmlelement
1223         - https://www.w3.org/TR/SVG2/types.html#InterfaceSVGElement
1224
1225         Firefox and Chrome behave as per the specification.
1226
1227         Fixing this also fixes rendering on http://survey123.arcgis.com/.
1228
1229         No new tests, covered by existing tests that were rebaselined.
1230
1231         * dom/Element.idl:
1232         * html/HTMLElement.idl:
1233         * svg/SVGElement.idl:
1234
1235 2016-06-27  Myles C. Maxfield  <mmaxfield@apple.com>
1236
1237         [macOS] Test gardening: Generic font families should not map to fonts which aren't installed
1238         https://bugs.webkit.org/show_bug.cgi?id=159111
1239         <rdar://problem/25807529>
1240
1241         Unreviewed.
1242
1243         Osaka-Mono does not come preinstalled on macOS Sierra. However, many Japanese users
1244         will have the font installed. Before setting the generic font family, we should check
1245         to see if the font is present.
1246
1247         * page/cocoa/SettingsCocoa.mm:
1248         (WebCore::osakaMonoIsInstalled):
1249         (WebCore::Settings::initializeDefaultFontFamilies):
1250
1251 2016-06-24  Ryosuke Niwa  <rniwa@webkit.org>
1252
1253         Don't keep all newly created potential custom elements alive when the feature is disabled
1254         https://bugs.webkit.org/show_bug.cgi?id=159113
1255
1256         Reviewed by Daniel Bates.
1257
1258         Don't keep all HTML unknown elements which has a valid custom element alive when the feature is turned off.
1259
1260         Ideally we want to conform to the behavior in the Custom Elements specification and only upgrade an element
1261         that is inserted into the document. We'll implement that later.
1262
1263         * dom/Document.cpp:
1264         (WebCore::createHTMLElementWithNameValidation):
1265
1266 2016-06-27  Simon Fraser  <simon.fraser@apple.com>
1267
1268         [iOS] -webkit-overflow-scrolling: touch prevents repaint with RTL
1269         https://bugs.webkit.org/show_bug.cgi?id=159186
1270         rdar://problem/26659341
1271
1272         Reviewed by Zalan Bujtas.
1273         
1274         There were two issues with repaints in -webkit-overflow-scrolling:touch scrolling
1275         layers.
1276
1277         First, if the scrolled contents were inline (e.g. a <span>), then repaints were
1278         broken because RenderInline didn't call shouldApplyClipAndScrollPositionForRepaint().
1279         Fix by making shouldApplyClipAndScrollPositionForRepaint() a member function of RenderBox
1280         and calling it from RenderBox::computeRectForRepaint() and RenderInline::clippedOverflowRectForRepaint().
1281
1282         Second, repaints were broken in RTL because RenderLayerBacking::setContentsNeedDisplayInRect()
1283         confused scroll offset and scroll position; it needs to subtract scrollPosition.
1284         
1285         Finally renamed to applyCachedClipAndScrollOffsetForRepaint() to applyCachedClipAndScrollPositionForRepaint()
1286         to make it clear that it uses scrollPosition, not scrollOffset.
1287
1288         Tests: compositing/scrolling/touch-scrolling-repaint-spans.html
1289                compositing/scrolling/touch-scrolling-repaint.html
1290
1291         * rendering/RenderBox.cpp:
1292         (WebCore::RenderBox::applyCachedClipAndScrollPositionForRepaint):
1293         (WebCore::RenderBox::shouldApplyClipAndScrollPositionForRepaint):
1294         (WebCore::RenderBox::computeRectForRepaint):
1295         (WebCore::RenderBox::applyCachedClipAndScrollOffsetForRepaint): Deleted.
1296         (WebCore::shouldApplyContainersClipAndOffset): Deleted.
1297         * rendering/RenderBox.h:
1298         * rendering/RenderInline.cpp:
1299         (WebCore::RenderInline::clippedOverflowRectForRepaint):
1300         (WebCore::RenderInline::computeRectForRepaint):
1301         * rendering/RenderLayerBacking.cpp:
1302         (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
1303         * rendering/RenderObject.cpp:
1304         (WebCore::RenderObject::computeRectForRepaint):
1305
1306 2016-06-27  Commit Queue  <commit-queue@webkit.org>
1307
1308         Unreviewed, rolling out r202436.
1309         https://bugs.webkit.org/show_bug.cgi?id=159190
1310
1311         We don't need to make this change. (Requested by thorton on
1312         #webkit).
1313
1314         Reverted changeset:
1315
1316         "Do not use iOS specific telephone detection on macOS."
1317         https://bugs.webkit.org/show_bug.cgi?id=159096
1318         http://trac.webkit.org/changeset/202436
1319
1320 2016-06-27  Benjamin Poulain  <benjamin@webkit.org>
1321
1322         Adopt the iOS TouchEventHandler API for cases that must have synchronous dispatch
1323         https://bugs.webkit.org/show_bug.cgi?id=159179
1324         rdar://problem/27006387
1325
1326         Reviewed by Simon Fraser.
1327
1328         Tests: fast/events/touch/ios/block-without-overflow-scroll-and-passive-observer-on-block-scrolling-state.html
1329                fast/events/touch/ios/block-without-overflow-scroll-and-passive-observer-on-document-scrolling-state.html
1330                fast/events/touch/ios/block-without-overflow-scroll-scrolling-state.html
1331                fast/events/touch/ios/drag-block-without-overflow-scroll-and-passive-observer-on-block.html
1332                fast/events/touch/ios/drag-block-without-overflow-scroll-and-passive-observer-on-document.html
1333                fast/events/touch/ios/drag-block-without-overflow-scroll.html
1334
1335         * dom/Document.cpp:
1336         (WebCore::Document::prepareForDestruction):
1337         (WebCore::Document::removeAllEventListeners):
1338         * dom/Node.cpp:
1339         (WebCore::Node::willBeDeletedFrom):
1340         (WebCore::tryAddEventListener):
1341         (WebCore::tryRemoveEventListener):
1342         * html/shadow/SliderThumbElement.cpp:
1343         (WebCore::SliderThumbElement::registerForTouchEvents):
1344         (WebCore::SliderThumbElement::unregisterForTouchEvents):
1345         * rendering/RenderLayer.cpp:
1346         (WebCore::RenderLayer::registerAsTouchEventListenerForScrolling):
1347         (WebCore::RenderLayer::unregisterAsTouchEventListenerForScrolling):
1348
1349 2016-06-27  Alex Christensen  <achristensen@webkit.org>
1350
1351         Fix Windows build.
1352
1353         * bindings/js/SerializedScriptValue.h:
1354         WTF
1355
1356 2016-06-27  Commit Queue  <commit-queue@webkit.org>
1357
1358         Unreviewed, rolling out r202520.
1359         https://bugs.webkit.org/show_bug.cgi?id=159185
1360
1361         This change broke the 32-bit El Capitan build (Requested by
1362         ryanhaddad on #webkit).
1363
1364         Reverted changeset:
1365
1366         "REGRESSION?(r202466): http/tests/security/canvas-remote-read-
1367         remote-video-redirect.html failing on Sierra"
1368         https://bugs.webkit.org/show_bug.cgi?id=159172
1369         http://trac.webkit.org/changeset/202520
1370
1371 2016-06-27  Jer Noble  <jer.noble@apple.com>
1372
1373         REGRESSION?(r202466): http/tests/security/canvas-remote-read-remote-video-redirect.html failing on Sierra
1374         https://bugs.webkit.org/show_bug.cgi?id=159172
1375         <rdar://problem/27030025>
1376
1377         Reviewed by Brent Fulgham.
1378
1379         Add a hasSingleSecurityOrigin property to WebCoreNSURLSession that gets updated each time one of that
1380         sessions' tasks receieves a response or a redirect request. Check that property from the MediaPlayerPrivate.
1381
1382         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1383         (WebCore::MediaPlayerPrivateAVFoundationObjC::hasSingleSecurityOrigin):
1384         * platform/network/cocoa/WebCoreNSURLSession.h:
1385         * platform/network/cocoa/WebCoreNSURLSession.mm:
1386         (-[WebCoreNSURLSession updateHasSingleSecurityOrigin:]):
1387         (-[WebCoreNSURLSession dataTaskWithRequest:]):
1388         (-[WebCoreNSURLSession dataTaskWithURL:]):
1389         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
1390         (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:]):
1391
1392 2016-06-27  Benjamin Poulain  <benjamin@webkit.org>
1393
1394         Fix style invalidation for :active when the activated node has no renderer
1395         https://bugs.webkit.org/show_bug.cgi?id=159125
1396
1397         Reviewed by Antti Koivisto.
1398
1399         Same old bug: a style invalidation path was depending
1400         on the style.
1401
1402         Here we really need both flags. An element can have
1403         childrenAffectedByActive() false and renderStyle->affectedByActive() true
1404         if it was subject to style sharing.
1405
1406         The element state "childrenAffectedByActive" should be renamed
1407         "styleAffectedByActive" since it is not a parent invalidation flag.
1408         That will be done separately.
1409
1410         Tests: fast/css/pseudo-active-on-labeled-control-without-renderer.html
1411                fast/css/pseudo-active-style-sharing-1.html
1412                fast/css/pseudo-active-style-sharing-2.html
1413                fast/css/pseudo-active-style-sharing-3.html
1414                fast/css/pseudo-active-style-sharing-4.html
1415                fast/css/pseudo-active-style-sharing-5.html
1416                fast/css/pseudo-active-style-sharing-6.html
1417
1418         * dom/Element.cpp:
1419         (WebCore::Element::setActive):
1420         * style/StyleRelations.cpp:
1421         (WebCore::Style::commitRelationsToRenderStyle):
1422
1423 2016-06-27  Joanmarie Diggs  <jdiggs@igalia.com>
1424
1425         AX: REGRESSION (r202063): ARIA role attribute is being ignored for label element
1426         https://bugs.webkit.org/show_bug.cgi?id=159162
1427
1428         Reviewed by Chris Fleizach.
1429
1430         createFromRenderer() was creating an AccessibilityLabel for any HTMLLabelElement which
1431         lacked an explicitly-handled ARIA role. We should instead create an AccessibilityLabel
1432         when there is no ARIA role.
1433
1434         Test: accessibility/aria-role-on-label.html
1435
1436         * accessibility/AXObjectCache.cpp:
1437         (WebCore::createFromRenderer):
1438
1439 2016-06-27  Commit Queue  <commit-queue@webkit.org>
1440
1441         Unreviewed, rolling out r202505.
1442         https://bugs.webkit.org/show_bug.cgi?id=159169
1443
1444         The test added with this change is flaky and it caused an
1445         existing test to time out on El Capitan. (Requested by
1446         ryanhaddad on #webkit).
1447
1448         Reverted changeset:
1449
1450         "[iOS] Media controls are too cramped with small video"
1451         https://bugs.webkit.org/show_bug.cgi?id=158815
1452         http://trac.webkit.org/changeset/202505
1453
1454 2016-06-27  Benjamin Poulain  <bpoulain@apple.com>
1455
1456         Add :focus-within to the status page
1457
1458         * features.json:
1459         I forgot to update the json file when landing the feature.
1460
1461 2016-06-27  Eric Carlson  <eric.carlson@apple.com>
1462
1463         [Mac] PiP placeholder should remain visible when 'controls' attribute is removed
1464         https://bugs.webkit.org/show_bug.cgi?id=159158
1465         <rdar://problem/26727435>
1466
1467         Reviewed by Jer Noble.
1468
1469         No new tests, existing test updated.
1470
1471         * Modules/mediacontrols/mediaControlsApple.js:
1472         (Controller.prototype.shouldHaveControls): Always return true when in PiP or AirPlay mode.
1473
1474 2016-06-27  Oliver Hunt  <oliver@apple.com>
1475
1476         Update ATS WebContent exception for more robust framework information
1477         https://bugs.webkit.org/show_bug.cgi?id=159151
1478
1479         Reviewed by Alex Christensen.
1480
1481         We found some unexpected poor interaction with AVFoundation in the existing
1482         CFNetwork SPI. This new SPI is more solid and let's us provide more useful
1483         information while also being more future proof against new frameworks and
1484         ATS modes.
1485
1486         * platform/network/mac/ResourceHandleMac.mm:
1487         (WebCore::ResourceHandle::createNSURLConnection):
1488
1489 2016-06-27  Antoine Quint  <graouts@apple.com>
1490
1491         [iOS] Media controls are too cramped with small video
1492         https://bugs.webkit.org/show_bug.cgi?id=158815
1493         <rdar://problem/26824238>
1494
1495         Reviewed by Dean Jackson.
1496
1497         In updateLayoutForDisplayedWidth(), we try to ensure a minimum width is guaranteed
1498         for the progress indicator. However, we were not accounting for the width used by
1499         the current and remaining time labels on either side of it, so we would incorrectly
1500         conclude that we were guaranteeing the minimum time and yield incorrect layouts since
1501         we were trying to fit more buttons than we had room for.
1502
1503         In order to correctly compute the available width for the progress indicator, we now
1504         have clones of the current and remaining time labels, hidden from video and VoiceOver,
1505         that we update along with the originals. The same styles apply to both clones and
1506         originals, so we may measure the clones to determine the space used by the time labels.
1507         The reason we need to use clones is that if the time labels had previously been hidden
1508         from view, precisely because there was not enough space to display them along with the
1509         progress indicator, then trying to obtain metrics from them would yield 0 since they had
1510         "display: none" styles applied. In order to avoid extra layouts and possible flashing, we
1511         use the clones so that we never have to toggle the "display" property of the originals
1512         just to obtain their measurements.
1513
1514         As a result of this change, we adjust the constant used to set the minimum required
1515         width available to display the progress indicator after all other essential controls
1516         and labels have been measured. That constant used to account for the width of the
1517         time labels, and this is no longer correct.
1518
1519         Test: media/video-controls-drop-and-restore-timeline.html
1520
1521         * Modules/mediacontrols/mediaControlsApple.css:
1522         (::-webkit-media-controls-time-remaining-display.clone):
1523         * Modules/mediacontrols/mediaControlsApple.js:
1524         (Controller):
1525         (Controller.prototype.createTimeClones):
1526         (Controller.prototype.removeTimeClass):
1527         (Controller.prototype.addTimeClass):
1528         (Controller.prototype.updateDuration):
1529         (Controller.prototype.updateLayoutForDisplayedWidth):
1530         (Controller.prototype.updateTime):
1531         (Controller.prototype.updateControlsWhileScrubbing):
1532         * Modules/mediacontrols/mediaControlsiOS.css:
1533         (::-webkit-media-controls-time-remaining-display.clone):
1534         * Modules/mediacontrols/mediaControlsiOS.js:
1535
1536 2016-06-27  Anders Carlsson  <andersca@apple.com>
1537
1538         No error message when passing an invalid API version to ApplePaySession constructor
1539         https://bugs.webkit.org/show_bug.cgi?id=159154
1540
1541         Reviewed by Tim Horton.
1542
1543         Log an error message if the version is not supported. Also, check for version 0 since that is also not supported.
1544
1545         * Modules/applepay/ApplePaySession.cpp:
1546         (WebCore::ApplePaySession::create):
1547
1548 2016-06-27  Joanmarie Diggs  <jdiggs@igalia.com>
1549
1550         AX: Anonymous RenderMathMLOperators are not exposed to the accessibility tree
1551         https://bugs.webkit.org/show_bug.cgi?id=139582
1552         <rdar://problem/26938849>
1553
1554         Reviewed by Chris Fleizach.
1555
1556         This is based on a patch by Frederic Wang <fwang@igalia.com>.
1557
1558         WebCore assigns the generic MathElementRole AccessibilityRole to elements
1559         which are expected to be included in the accessibility tree. This assignment
1560         is based on the AccessibilityRenderObject's node being a MathMLElement. The
1561         anonymous RenderMathMLOperators fail that test.
1562
1563         From the perspective of accessibility support, these operators function
1564         like MathMLElements. Furthermore, both WebCore and the platforms rely
1565         upon MathElementRole to identify accessible MathML objects. The simplest
1566         fix is to have AccessibilityRenderObject::isMathElement() treat anonymous
1567         MathML operators as if they were MathMLElements.
1568
1569         Now that these operators are being exposed, we need to handle them in
1570         AccessibilityRenderObject::textUnderElement() which assumes that anonymous
1571         objects either have nodes or have children with nodes. And crashes when
1572         that fails to be the case. Making RenderMathMLOperator::textContent()
1573         public and then using it to get the text under anonymous operators solves
1574         this problem. We also assign StaticTextRole to these operators on the Mac
1575         because the default platform mapping of MathElementRole is GroupRole, which
1576         made sense when we had a child RenderText object holding the operator.
1577
1578         Lastly, AccessibilityRenderObject::isIgnoredElementWithinMathTree() no
1579         longer needs to special-case anonymous operators because they now have
1580         MathElementRole.
1581
1582         Tests: accessibility/math-fenced.html
1583                accessibility/math-foreign-content.html
1584
1585         * accessibility/AccessibilityObject.h:
1586         (WebCore::AccessibilityObject::isAnonymousMathOperator):
1587         * accessibility/AccessibilityRenderObject.cpp:
1588         (WebCore::AccessibilityRenderObject::textUnderElement):
1589         (WebCore::AccessibilityRenderObject::stringValue):
1590         (WebCore::AccessibilityRenderObject::isMathElement):
1591         (WebCore::AccessibilityRenderObject::isAnonymousMathOperator):
1592         (WebCore::AccessibilityRenderObject::isIgnoredElementWithinMathTree):
1593         * accessibility/AccessibilityRenderObject.h:
1594         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1595         (-[WebAccessibilityObjectWrapper role]):
1596         * rendering/mathml/RenderMathMLMath.h:
1597         * rendering/mathml/RenderMathMLOperator.h:
1598         (WebCore::RenderMathMLOperator::textContent):
1599
1600 2016-06-27  Adam Bergkvist  <adam.bergkvist@ericsson.com>
1601
1602         WebRTC: Remove unused RTCOfferAnswerOptionsPrivate.h
1603         https://bugs.webkit.org/show_bug.cgi?id=159130
1604
1605         Reviewed by Eric Carlson.
1606
1607         Remove unused RTCOfferAnswerOptionsPrivate.h file.
1608
1609         * platform/mediastream/RTCOfferAnswerOptionsPrivate.h: Removed.
1610
1611 2016-06-27  Jer Noble  <jer.noble@apple.com>
1612
1613         Crash in layout test /media/video-buffered-range-contains-currentTime.html
1614         https://bugs.webkit.org/show_bug.cgi?id=159109
1615         <rdar://problem/26535750>
1616
1617         Reviewed by Alex Christensen.
1618
1619         Guard against a dealloc race condition by holding a retain on the session
1620         until the task's _resource:loadFinishedWithError: completes, including
1621         main thread callbacks.
1622         
1623         * platform/network/cocoa/WebCoreNSURLSession.mm:
1624         (-[WebCoreNSURLSessionDataTask _resource:loadFinishedWithError:]):
1625
1626 2016-06-27  Frederic Wang  <fwang@igalia.com>
1627
1628         Set an upper limit for the size or number of pieces of stretchy operators
1629         https://bugs.webkit.org/show_bug.cgi?id=155434
1630
1631         Reviewed by Brent Fulgham.
1632
1633         Stretchy MathML operators can currently use an arbitrary number of extension glyphs to cover
1634         a target size. This may result in hangs if large stretch sizes are requested. This change
1635         only allow at most the 128 first extensions to be painted by the MathOperator class, which
1636         should really be enough for mathematical formulas used in practice.
1637
1638         No new tests, already tested by very-large-stretchy-operators.
1639
1640         * rendering/mathml/MathOperator.cpp: Add a new kMaximumExtensionCount constant.
1641         (WebCore::MathOperator::fillWithVerticalExtensionGlyph): Limit the number of step in this loop to kMaximumExtensionCount.
1642         (WebCore::MathOperator::fillWithHorizontalExtensionGlyph): Ditto.
1643
1644 2016-06-27  Frederic Wang  <fred.wang@free.fr>
1645
1646         Small refactoring MathMLInlineContainerElement::createElementRenderer
1647         https://bugs.webkit.org/show_bug.cgi?id=159131
1648
1649         Reviewed by Brent Fulgham.
1650
1651         Many of the MathML renderer classes have been merged during the MathML refactoring. We
1652         simplify how instances are created in MathMLInlineContainerElement::createElementRenderer
1653         by removing duplicate createRenderer calls.
1654
1655         No new tests, behavior unchanged.
1656
1657         * mathml/MathMLInlineContainerElement.cpp:
1658         (WebCore::MathMLInlineContainerElement::createElementRenderer):
1659
1660 2016-06-27  Miguel Gomez  <magomez@igalia.com>
1661
1662         [GTK][EFL] Build with threaded compositor enabled is broken
1663         https://bugs.webkit.org/show_bug.cgi?id=159138
1664
1665         Reviewed by Carlos Garcia Campos.
1666
1667         No need to set the device scale. The compositor buffer is only used for the accelerated
1668         canvas scenario, and the device scale is always 1 there.
1669         This change was introduced in r202421.
1670
1671         Covered by existing tests.
1672
1673         * platform/graphics/cairo/ImageBufferCairo.cpp:
1674         (WebCore::ImageBufferData::createCompositorBuffer):
1675
1676 2016-06-27  Philippe Normand  <philn@igalia.com>
1677
1678         [GStreamer] top/bottom black bars added needlessly in fullscreen
1679         https://bugs.webkit.org/show_bug.cgi?id=158980
1680
1681         Reviewed by Carlos Garcia Campos.
1682
1683         The natural video size calculation depends on the validity of the
1684         current sample, so whenever the first sample reached the sink it's a
1685         good idea to reflect this on the player which will update its natural
1686         size accordingly.
1687
1688         Fixes an issue where black borders were added on top and bottom of
1689         fullscreen video.
1690
1691         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1692         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
1693
1694 2016-06-27  Youenn Fablet  <youenn@apple.com>
1695
1696         Remove didFailRedirectCheck ThreadableLoaderClient callback
1697         https://bugs.webkit.org/show_bug.cgi?id=159085
1698
1699         Reviewed by Daniel Bates.
1700
1701         Removing didFailRedirectCheck and using didFailAccessControlCheck instead.
1702         The change in behavior is that additional error messages are outputted in the console.
1703         These messages give additional debugging information.
1704
1705         Covered by rebased tests.
1706
1707         * Modules/fetch/FetchLoader.cpp: Removing didFailRedirectCheck.
1708         * Modules/fetch/FetchLoader.h: Ditto.
1709         * inspector/InspectorNetworkAgent.cpp: Ditto.
1710         * loader/DocumentThreadableLoader.cpp:
1711         (WebCore::DocumentThreadableLoader::redirectReceived): Calling didFailAccessControlCheck with information on failing
1712         URL.
1713         (WebCore::DocumentThreadableLoader::loadRequest): Ditto.
1714         * loader/ThreadableLoaderClient.h: Removing didFailRedirectCheck.
1715         * loader/ThreadableLoaderClientWrapper.h: Ditto.
1716         * loader/WorkerThreadableLoader.cpp: Ditto.
1717         * loader/WorkerThreadableLoader.h: Ditto.
1718         * page/EventSource.cpp: Ditto.
1719         * page/EventSource.h: Ditto.
1720         * workers/WorkerScriptLoader.cpp: Ditto.
1721         * workers/WorkerScriptLoader.h: Ditto.
1722         * xml/XMLHttpRequest.cpp: Ditto.
1723         * xml/XMLHttpRequest.h: Ditto.
1724
1725 2016-06-26  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
1726
1727         [EFL] Fix build warning when using geoclue2
1728         https://bugs.webkit.org/show_bug.cgi?id=159128
1729
1730         Reviewed by Antonio Gomes.
1731
1732         EFL port has handled build warning as error. So EFL port
1733         hasn't been built when we use geoclue2 library because a generated geoclue2 file
1734         has unused-parameter build warning. To fix it this patch set to ignore the build warning
1735         in the generated geoclue2 file.
1736
1737         * PlatformEfl.cmake:
1738
1739 2016-06-26  Chris Dumez  <cdumez@apple.com>
1740
1741         Regression: HTMLOptionsCollection's named properties have precedence over indexed properties
1742         https://bugs.webkit.org/show_bug.cgi?id=159058
1743         <rdar://problem/26988542>
1744
1745         Reviewed by Ryosuke Niwa.
1746
1747         HTMLOptionsCollection's named properties had precedence over indexed properties,
1748         which is wrong as per:
1749         http://heycam.github.io/webidl/#getownproperty-guts
1750
1751         The reason is that there was a named property getter defined on HTMLOptionsCollection
1752         but no indexed property getter. As a result, HTMLOptionsCollection would fall back to
1753         using HTMLCollection's indexed property getter but HTMLOptionsCollection's named getter
1754         would take precedence. This patch defines an indexed property getter on
1755         HTMLOptionsCollection to fix the problem.
1756
1757         Ideally, HTMLOptionsCollection would have no indexed / named property getters and would
1758         entirely rely on the ones from HTMLCollection. However, our bindings generator currently
1759         has trouble with this and requires HTMLOptionsCollection to have a named getter.
1760
1761         Test: fast/dom/HTMLSelectElement/options-indexed-getter-precedence.html
1762
1763         * html/HTMLOptionsCollection.idl:
1764
1765 2016-06-26  Chris Dumez  <cdumez@apple.com>
1766
1767         Regression(r202262): Infinite loop under searchForLinkRemovingExistingDDLinks()
1768         https://bugs.webkit.org/show_bug.cgi?id=159122
1769         <rdar://problem/27014649>
1770
1771         Reviewed by Ryosuke Niwa.
1772
1773         Infinite loop under searchForLinkRemovingExistingDDLinks() because the
1774         value returned by NodeTraversal::next() was ignored and the node iterator
1775         was never updated.
1776
1777         * editing/cocoa/DataDetection.mm:
1778         (WebCore::searchForLinkRemovingExistingDDLinks):
1779
1780 2016-06-25  Benjamin Poulain  <bpoulain@apple.com>
1781
1782         The active state of elements can break when focus changes
1783         https://bugs.webkit.org/show_bug.cgi?id=159112
1784
1785         Reviewed by Antti Koivisto.
1786
1787         The pseudo class :active was behaving weirdly when used
1788         with label elements with an associated form element.
1789         The form element would get the :active state on the first click
1790         then no longer get the state until the focus changes.
1791
1792         What was happenning is setFocusedElement() was clearing active
1793         for some unknown reason. When you really do that on an active element,
1794         you end up in an inconsistent state where no invalidation works.
1795
1796         The two tests illustrates 2 ways this breaks.
1797
1798         The test "pseudo-active-on-labeled-element-not-canceled-by-focus" clicks
1799         several time on a lable element. The first time, the input element gets
1800         the focus. The second time, it already has the focus, setFocusedElement()
1801         clears :active before finding the focusable element and end up clearing
1802         the active state on a target in the active chain.
1803
1804         The test "pseudo-active-with-programmatic-focus.html" shows how to invalidate
1805         arbitrary elements using JavaScript. This can cause severely broken active
1806         chains where invalidation never cleans some ancestors.
1807
1808         Tests: fast/css/pseudo-active-on-labeled-element-not-canceled-by-focus.html
1809                fast/css/pseudo-active-with-programmatic-focus.html
1810
1811         * dom/Document.cpp:
1812         (WebCore::Document::setFocusedElement): Deleted.
1813
1814         * page/EventHandler.cpp:
1815         (WebCore::EventHandler::handleMouseDoubleClickEvent):
1816         This is WebKit1 specific. The double click event was dispatching
1817         the mouseUp and Click with after doing an Active hit test.
1818         This causes us to have :active state in and after mouseUp in WebKit1.
1819
1820 2016-06-24  Jer Noble  <jer.noble@apple.com>
1821
1822         Consider exposing or hiding knowledge of a redirect from clients of WebCoreNSURLSession
1823         https://bugs.webkit.org/show_bug.cgi?id=156722
1824         <rdar://problem/25780035>
1825
1826         Reviewed by Alex Christensen.
1827
1828         Fixes tests: http/tests/security/contentSecurityPolicy/audio-redirect-allowed2.html
1829                      http/tests/security/contentSecurityPolicy/video-redirect-allowed2.html
1830
1831         When receieving a NSURLResponse containing a redirected URL, AVFoundadtion will use the
1832         URL in the response for subsequent requests. This violates the HTTP specification if the
1833         redirect was temporary, and it also breaks two CSP tests by bypassing the redirect step
1834         for subsequent requests.
1835
1836         Work around this behavior in AVFoundation by recreating the NSURLResponse with the original
1837         request URL in the case of a temporary redirect.
1838
1839         * platform/network/cocoa/WebCoreNSURLSession.mm:
1840         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
1841         (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:]):
1842
1843 2016-06-24  Jer Noble  <jer.noble@apple.com>
1844
1845         MSE gets confused by in-band text tracks
1846         https://bugs.webkit.org/show_bug.cgi?id=159107
1847         <rdar://problem/26871330>
1848
1849         Reviewed by Eric Carlson.
1850
1851         We can't currently handle text track samples in SourceBufferPrivateAVFObjC,
1852         so don't pass them up to SourceBuffer.
1853
1854         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1855         (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):
1856         (WebCore::SourceBufferPrivateAVFObjC::processCodedFrame):
1857
1858 2016-06-24  Mark Lam  <mark.lam@apple.com>
1859
1860         [JSC] Error prototypes are called on remote scripts.
1861         https://bugs.webkit.org/show_bug.cgi?id=52192
1862
1863         Reviewed by Keith Miller.
1864
1865         Test: http/tests/security/regress-52192.html
1866
1867         Parsing errors are reported to the main script's window.onerror function.  AFAIK,
1868         both Chrome and Firefox have the error reporting mechanism use an internal
1869         sanitized version of Error.prototype.toString() that will not invoke any getters
1870         or proxies instead.
1871
1872         This patch fixes this issue by matching Chrome and Firefox's behavior.
1873
1874         Note: we did not choose to make error objects and prototypes read-only because
1875         that was observed to have broken the web.
1876         See https://bugs.chromium.org/p/chromium/issues/detail?id=69187#c73
1877
1878         Credit for reporting this issue goes to Daniel Divricean (http://divricean.ro).
1879
1880         * bindings/js/JSDOMBinding.cpp:
1881         (WebCore::reportException):
1882         * ForwardingHeaders/runtime/ErrorInstance.h: Added.
1883
1884 2016-06-24  Jer Noble  <jer.noble@apple.com>
1885
1886         Media elements should not lose playback controls when muted by a user gesture
1887         https://bugs.webkit.org/show_bug.cgi?id=159078
1888         <rdar://problem/26925904>
1889
1890         Reviewed by Beth Dakin.
1891
1892         Rearrange canControlControlsManager() so that the muted check only occurs if
1893         a user gesture is required.
1894
1895         * html/MediaElementSession.cpp:
1896         (WebCore::MediaElementSession::canControlControlsManager):
1897
1898 2016-06-24  Beth Dakin  <bdakin@apple.com>
1899
1900         Include enclosingListType in EditorState
1901         https://bugs.webkit.org/show_bug.cgi?id=159102
1902         -and corresponding-
1903         rdar://problem/26932490
1904
1905         Reviewed by Enrica Casucci.
1906
1907         Make HTMLOListElement.h and HTMLUListElement.h Private instead of Project.
1908         * WebCore.xcodeproj/project.pbxproj:
1909
1910         Export enclosingList(Node*)
1911         * editing/htmlediting.h:
1912
1913 2016-06-24  Anders Carlsson  <andersca@apple.com>
1914
1915         Another Windows build fix.
1916
1917         * platform/network/BlobRegistry.h:
1918
1919 2016-06-24  Anders Carlsson  <andersca@apple.com>
1920
1921         Yet another Windows build fix.
1922
1923         * dom/ActiveDOMCallbackMicrotask.h:
1924
1925 2016-06-24  Anders Carlsson  <andersca@apple.com>
1926
1927         Another Windows build fix.
1928
1929         * page/FrameView.h:
1930
1931 2016-06-24  Anders Carlsson  <andersca@apple.com>
1932
1933         Inline more of the Apple Pay source code
1934         https://bugs.webkit.org/show_bug.cgi?id=159099
1935
1936         Reviewed by Andreas Kling.
1937
1938         * page/Settings.h:
1939         (WebCore::Settings::applePayEnabled):
1940         (WebCore::Settings::setApplePayEnabled):
1941         (WebCore::Settings::applePayCapabilityDisclosureAllowed):
1942         (WebCore::Settings::setApplePayCapabilityDisclosureAllowed):
1943
1944 2016-06-24  Anders Carlsson  <andersca@apple.com>
1945
1946         Windows build fix.
1947
1948         * platform/GenericTaskQueue.h:
1949         (WebCore::TaskDispatcher::postTask):
1950
1951 2016-06-24  Frederic Wang  <fwang@igalia.com>
1952
1953         Use auto* for MathML elements and renderers when possible
1954         https://bugs.webkit.org/show_bug.cgi?id=159090
1955
1956         Reviewed by Alex Christensen.
1957
1958         No new tests, behavior is unchanged.
1959
1960         * mathml/MathMLElement.cpp:
1961         (WebCore::MathMLElement::attributeChanged):
1962         * mathml/MathMLSelectElement.cpp:
1963         (WebCore::MathMLSelectElement::getSelectedActionChildAndIndex):
1964         (WebCore::MathMLSelectElement::getSelectedActionChild):
1965         (WebCore::MathMLSelectElement::getSelectedSemanticsChild):
1966         (WebCore::MathMLSelectElement::updateSelectedChild):
1967         * rendering/mathml/RenderMathMLFraction.cpp:
1968         (WebCore::RenderMathMLFraction::isValid):
1969         * rendering/mathml/RenderMathMLMenclose.cpp:
1970         (WebCore::RenderMathMLMenclose::layoutBlock):
1971         * rendering/mathml/RenderMathMLRoot.cpp:
1972         (WebCore::RenderMathMLRoot::isValid):
1973         * rendering/mathml/RenderMathMLRow.cpp:
1974         (WebCore::RenderMathMLRow::firstLineBaseline):
1975         (WebCore::RenderMathMLRow::computeLineVerticalStretch):
1976         (WebCore::RenderMathMLRow::computePreferredLogicalWidths):
1977         (WebCore::RenderMathMLRow::layoutRowItems):
1978         * rendering/mathml/RenderMathMLScripts.cpp:
1979         (WebCore::RenderMathMLScripts::unembellishedOperator):
1980         (WebCore::RenderMathMLScripts::getBaseAndScripts):
1981         (WebCore::RenderMathMLScripts::computePreferredLogicalWidths):
1982         (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded):
1983         (WebCore::RenderMathMLScripts::layoutBlock):
1984         (WebCore::RenderMathMLScripts::firstLineBaseline):
1985         * rendering/mathml/RenderMathMLUnderOver.cpp:
1986         (WebCore::RenderMathMLUnderOver::firstLineBaseline):
1987         (WebCore::RenderMathMLUnderOver::isValid):
1988         (WebCore::RenderMathMLUnderOver::over):
1989
1990 2016-06-24  Joseph Pecoraro  <pecoraro@apple.com>
1991
1992         Remove unused and static return value from InspectorStyle::populateAllProperties
1993         https://bugs.webkit.org/show_bug.cgi?id=159069
1994
1995         Reviewed by Andreas Kling.
1996
1997         * inspector/InspectorStyleSheet.cpp:
1998         (WebCore::InspectorStyle::populateAllProperties):
1999         * inspector/InspectorStyleSheet.h:
2000
2001 2016-06-21  Anders Carlsson  <andersca@apple.com>
2002
2003         Rename NoncopyableFunction to Function
2004         https://bugs.webkit.org/show_bug.cgi?id=158354
2005
2006         Reviewed by Chris Dumez.
2007
2008         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2009         (WebCore::MediaEndpointPeerConnection::runTask):
2010         * Modules/mediastream/MediaEndpointPeerConnection.h:
2011         * Modules/webaudio/AudioDestinationNode.h:
2012         (WebCore::AudioDestinationNode::resume):
2013         (WebCore::AudioDestinationNode::suspend):
2014         (WebCore::AudioDestinationNode::close):
2015         * Modules/webaudio/DefaultAudioDestinationNode.cpp:
2016         (WebCore::DefaultAudioDestinationNode::resume):
2017         (WebCore::DefaultAudioDestinationNode::suspend):
2018         (WebCore::DefaultAudioDestinationNode::close):
2019         * Modules/webaudio/DefaultAudioDestinationNode.h:
2020         * dom/ActiveDOMCallbackMicrotask.cpp:
2021         (WebCore::ActiveDOMCallbackMicrotask::ActiveDOMCallbackMicrotask):
2022         * dom/ActiveDOMCallbackMicrotask.h:
2023         * dom/ScriptExecutionContext.h:
2024         (WebCore::ScriptExecutionContext::Task::Task):
2025         * fileapi/AsyncFileStream.cpp:
2026         (WebCore::callOnFileThread):
2027         (WebCore::AsyncFileStream::perform):
2028         * fileapi/AsyncFileStream.h:
2029         * page/FrameView.cpp:
2030         (WebCore::FrameView::queuePostLayoutCallback):
2031         (WebCore::FrameView::flushPostLayoutTasksQueue):
2032         * page/FrameView.h:
2033         * page/scrolling/ScrollingThread.cpp:
2034         (WebCore::ScrollingThread::dispatch):
2035         (WebCore::ScrollingThread::dispatchBarrier):
2036         (WebCore::ScrollingThread::dispatchFunctionsFromScrollingThread):
2037         * page/scrolling/ScrollingThread.h:
2038         * platform/GenericTaskQueue.cpp:
2039         (WebCore::TaskDispatcher<Timer>::postTask):
2040         * platform/GenericTaskQueue.h:
2041         (WebCore::TaskDispatcher::postTask):
2042         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2043         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2044         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::scheduleDeferredTask):
2045         * platform/mediastream/MediaStreamPrivate.cpp:
2046         (WebCore::MediaStreamPrivate::scheduleDeferredTask):
2047         * platform/mediastream/MediaStreamPrivate.h:
2048         * platform/mediastream/mac/AVMediaCaptureSource.h:
2049         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2050         (WebCore::AVMediaCaptureSource::scheduleDeferredTask):
2051         * style/StyleTreeResolver.cpp:
2052         (WebCore::Style::postResolutionCallbackQueue):
2053         (WebCore::Style::queuePostResolutionCallback):
2054         * style/StyleTreeResolver.h:
2055
2056 2016-06-24  Amir Alavi  <aalavi@apple.com>
2057
2058         Use _CFHTTPCookieStorageGetDefault directly instead of NSHTTPCookieStorage to get default cookie storage
2059         https://bugs.webkit.org/show_bug.cgi?id=159095
2060         rdar://problem/26630073
2061
2062         Reviewed by Brent Fulgham.
2063
2064         No new tests, it isn't possible to test this in a LayoutTest.
2065
2066         * platform/network/mac/CookieJarMac.mm:
2067         (WebCore::httpCookiesForURL): Get a CFHTTPCookieStorageRef when no cookie storage is provided to match the case when cookie storage is provided.
2068
2069 2016-06-24  Enrica Casucci  <enrica@apple.com>
2070
2071         Do not use iOS specific telephone detection on macOS.
2072         https://bugs.webkit.org/show_bug.cgi?id=159096
2073         rdar://problem/25870571
2074
2075         Reviewed by Anders Carlsson.
2076
2077         Adding platform guard.
2078
2079         * platform/cocoa/TelephoneNumberDetectorCocoa.cpp:
2080         (WebCore::TelephoneNumberDetector::phoneNumbersScanner):
2081
2082 2016-06-24  Jer Noble  <jer.noble@apple.com>
2083
2084         Unreviewed build fix after r202429; AVStreamDataParser does not exist on iOS.
2085
2086         * platform/spi/mac/AVFoundationSPI.h:
2087
2088 2016-06-24  Jer Noble  <jer.noble@apple.com>
2089
2090         Unreviewed build fix after r202429; Fix the type of the delegate property on AVStreamDataParser.
2091
2092         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2093         * platform/spi/mac/AVFoundationSPI.h:
2094
2095 2016-06-02  Jer Noble  <jer.noble@apple.com>
2096
2097         [MSE] Adopt +[AVStreamDataParser outputMIMECodecParameterForInputMIMECodecParameter:]
2098         https://bugs.webkit.org/show_bug.cgi?id=158312
2099
2100         Reviewed by Eric Carlson.
2101
2102         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2103         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsType):
2104
2105         Move the declaration of AVStreamDataParser into AVFoundationSPI.h:
2106
2107         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
2108         (WebCore::CDMSessionAVStreamSession::update):
2109         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2110         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2111         (-[WebAVStreamDataParserListener streamDataParser:didProvideMediaData:forTrackID:mediaType:flags:]):
2112         * platform/spi/mac/AVFoundationSPI.h:
2113
2114 2016-06-24  Eric Carlson  <eric.carlson@apple.com>
2115
2116         [iOS, Mac] Assume a media file has audio during AirPlay
2117         https://bugs.webkit.org/show_bug.cgi?id=159088
2118         <rdar://problem/24616592>
2119
2120         Reviewed by Jer Noble.
2121
2122         No new tests, it isn't possible to test this in a LayoutTest.
2123
2124         * html/HTMLMediaElement.cpp:
2125         (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged): Call 
2126           mediaSession->setCanProduceAudio(true) when AirPlay becomes active.
2127
2128 2016-06-24  Jer Noble  <jer.noble@apple.com>
2129
2130         Playback controls refer to wrong element when playing multiple items in a page.
2131         https://bugs.webkit.org/show_bug.cgi?id=159076
2132         <rdar://problem/26953532>
2133
2134         Reviewed by Beth Dakin.
2135
2136         Use a new method PlatformMediaSessionManager::currentSessionMatching() to get
2137         the most recently active media element which qualifies for playback controls.
2138
2139         * html/HTMLMediaElement.cpp:
2140         (WebCore::HTMLMediaElement::updatePlaybackControlsManager): Get the most recently active session.
2141         * html/MediaElementSession.cpp:
2142         (WebCore::MediaElementSession::canControlControlsManager): Make virtual; no longer takes an element.
2143         * html/MediaElementSession.h:
2144         (isType): Allow downcasting from PlatformMediaSession -> MediaElementSession.
2145         * page/ChromeClient.h:
2146         * platform/audio/PlatformMediaSession.h:
2147         (WebCore::PlatformMediaSession::canControlControlsManager): Defaults to false;
2148         * platform/audio/PlatformMediaSessionManager.cpp:
2149         (WebCore::PlatformMediaSessionManager::currentSessionMatching): Added.
2150         * platform/audio/PlatformMediaSessionManager.h:
2151
2152 2016-06-24  Dan Bernstein  <mitz@apple.com>
2153
2154         Fixed the macOS build.
2155
2156         * platform/spi/cocoa/DataDetectorsCoreSPI.h:
2157
2158 2016-06-24  Dan Bernstein  <mitz@apple.com>
2159
2160         [iOS] Inline DataDetectorsAdditions.h
2161         https://bugs.webkit.org/show_bug.cgi?id=159093
2162
2163         Reviewed by Anders Carlsson.
2164
2165         * editing/cocoa/DataDetection.mm:
2166         (WebCore::constructURLStringForResult): Use soft-linked constant directly.
2167
2168         * platform/cocoa/DataDetectorsCoreSoftLink.h: Declare soft-linked constant.
2169         * platform/cocoa/DataDetectorsCoreSoftLink.mm: Define soft-linked constant.
2170         * platform/spi/cocoa/DataDetectorsCoreSPI.h: Declare constant.
2171
2172 2016-06-24  Yusuke Suzuki  <utatane.tea@gmail.com>
2173
2174         [GTK][EFL] ImageBufferCairo should accept resolution factor
2175         https://bugs.webkit.org/show_bug.cgi?id=157848
2176
2177         Reviewed by Martin Robinson.
2178
2179         ImageBufferCairo ignored the resolution factor passed in its constructor.
2180         This resolution factor is originally introduced for HiDPI Canvas,
2181         and since HiDPI canvas is not enabled in the ports using Cairo,
2182         the lack of this implementation does not cause any problems.
2183         And now, HiDPI Canvas is removed from the tree.
2184
2185         However, WebKit CSS filter uses this path.
2186         The missing implementation is required under the HiDPI environment.
2187
2188         Since Cairo surface can have the device scale factor transparently,
2189         the operations onto the surface is correctly done in the logical coordinate system.
2190         So all we need to handle carefully is the direct surface modification done
2191         in filter effects.
2192
2193         In this patch, we extend the image buffer size according to the resolution factor,
2194         as the same to the CoreGraphics' implementation (ImageBufferCG). And by setting the
2195         device scale factor of the surface correctly, we ensure that the rest of the Cairo
2196         painting stack works with the existing logical coordinate system. And in ImageBufferCairo,
2197         we carefully handle the logical and backing store coordinate system.
2198
2199         The attached test applies the CSS filter onto the svg image. And we resize the image size,
2200         and perform scrolling. It incurs the paint, and filter effect recalcuation.
2201         In that path, the filter effect side assumes that the image buffer size is scaled with the
2202         resolution factor. So without this patch, it incurs buffer overflow and leads WebProcess crash.
2203
2204         * platform/graphics/IntPoint.h:
2205         (WebCore::IntPoint::scale):
2206         * platform/graphics/cairo/ImageBufferCairo.cpp:
2207         (WebCore::ImageBufferData::createCompositorBuffer):
2208         (WebCore::ImageBuffer::ImageBuffer):
2209         (WebCore::ImageBuffer::copyImage):
2210         (WebCore::ImageBuffer::platformTransformColorSpace):
2211         (WebCore::getImageData):
2212         (WebCore::logicalUnit):
2213         (WebCore::backingStoreUnit):
2214         (WebCore::ImageBuffer::getUnmultipliedImageData):
2215         (WebCore::ImageBuffer::getPremultipliedImageData):
2216         (WebCore::ImageBuffer::putByteArray):
2217         (WebCore::ImageBuffer::copyToPlatformTexture):
2218
2219 2016-06-24  Frederic Wang  <fwang@igalia.com>
2220
2221         Refactor RenderMathMLOperator and RenderMathMLToken to avoid using anonymous renderers.
2222         https://bugs.webkit.org/show_bug.cgi?id=155018
2223
2224         Reviewed by Martin Robinson.
2225
2226         No new tests, already covered by existing tests.
2227
2228         We use MathOperator for RenderMathMLOperator to avoid creating anonymous text nodes again
2229         and again. We reimplement implicit mathvariant="italic" on single-char mi in a way that does
2230         not rely on creating anonymous text nodes. Finally, we improve the determination/update of
2231         when mathvariant is italic to avoid breaking foreign-mi-dynamic test.
2232         The change in the render tree structure breaks mfenced accessibility support but that will
2233         be fixed in follow-up patches. The simplifications made here will also allow to simplify the
2234         accessibility code.
2235
2236         * css/mathml.css:
2237         (mo): Deleted. This flexbox rule is no longer needed.
2238         * rendering/mathml/RenderMathMLBlock.cpp:
2239         (WebCore::RenderMathMLBlock::createAnonymousMathMLBlock): Deleted. We no longer need to
2240         create anonymous renderer with this function.
2241         * rendering/mathml/RenderMathMLBlock.h: Delete createAnonymousMathMLBlock.
2242         * rendering/mathml/RenderMathMLOperator.cpp: Implement layout functions without relying on
2243         flexbox or anonymous.
2244         (WebCore::RenderMathMLOperator::computePreferredLogicalWidths): Handle the case of !useMathOperator()
2245         for which we need to add extra operator spacing after the RenderMathMLToken layout.
2246         (WebCore::RenderMathMLOperator::layoutBlock): Ditto.
2247         (WebCore::RenderMathMLOperator::isChildAllowed): Deleted. We allow the non-anonymous text.
2248         (WebCore::RenderMathMLOperator::rebuildTokenContent): No longer destroy and rebuild
2249         anonymous wrapper. Remove updateStyle call.
2250         (WebCore::RenderMathMLOperator::updateStyle): Deleted. We no longer need anonymous style for the spacing.
2251         * rendering/mathml/RenderMathMLOperator.h: Remove updateStyle() and isChildAllowed().
2252         Make textContent() public so that it can be accessed from the accessibility code.
2253         * rendering/mathml/RenderMathMLToken.cpp: Reimplement implicit mathvariant="italic" by
2254         painting MATHEMATICAL ITALIC characters instead of styling an anonymous wrapper.
2255         (WebCore::RenderMathMLToken::RenderMathMLToken): Init m_mathVariantGlyph and m_mathVariantGlyphDirty
2256         (WebCore::RenderMathMLToken::updateTokenContent): Set mathvariant glyph dirty when the content changes.
2257         (WebCore::transformToItalic): Helper function to map latin and greek alphabets to their
2258         MATHEMATICAL ITALIC counterpart.
2259         (WebCore::RenderMathMLToken::computePreferredLogicalWidths): Implement this function to
2260         handle the case where the mathvariant glyph is used.
2261         (WebCore::RenderMathMLToken::updateMathVariantGlyph): Helper function to update the mathvariant glyph.
2262         For now, we try and keep with the old (and limited) implementation: a mathvariant glyph may
2263         only used for single-char <mi> without mathvariant attribute attached to it.
2264         (WebCore::RenderMathMLToken::styleDidChange): Set the mathvariant glyph dirty when the style
2265         changes.
2266         (WebCore::RenderMathMLToken::updateFromElement): Remove updateStyle call and set mathvariant
2267         glyph dirty.
2268         (WebCore::RenderMathMLToken::firstLineBaseline): Implement this function to handle the case
2269          where the mathvariant glyph is used.
2270         (WebCore::RenderMathMLToken::layoutBlock): Ditto.
2271         (WebCore::RenderMathMLToken::paint): Ditto.
2272         (WebCore::RenderMathMLToken::paintChildren): Ditto.
2273         (WebCore::RenderMathMLToken::addChild): Deleted. No need to bother with anonymous renderer
2274         or style.
2275         (WebCore::RenderMathMLToken::createWrapperIfNeeded): Deleted. Ditto.
2276         (WebCore::RenderMathMLToken::updateStyle): Deleted. Ditto.
2277         * rendering/mathml/RenderMathMLToken.h: Update declarations of functions.
2278         (WebCore::RenderMathMLToken::setMathVariantGlyphDirty): Helper function to indicate that the
2279         mathvariant glyph will need to be updated.
2280
2281 2016-06-24  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
2282
2283         Unreviewed EFL build fix.
2284
2285         There is forward declaration build error on EFL port.
2286
2287         * platform/graphics/texmap/coordinated/CompositingCoordinator.cpp: Include DOMWindow.h and Document.h.
2288
2289 2016-06-23  Brady Eidson  <beidson@apple.com>
2290
2291         Retrieving Blobs from IndexedDB using cursors fails in WK2 (Sandboxing)
2292         https://bugs.webkit.org/show_bug.cgi?id=158991
2293
2294         Reviewed by Alex Christensen.
2295
2296         Test: storage/indexeddb/modern/blob-cursor.html
2297
2298         * platform/network/BlobDataFileReference.cpp:
2299         (WebCore::BlobDataFileReference::startTrackingModifications): Deleted.
2300
2301 2016-06-23  Alex Christensen  <achristensen@webkit.org>
2302
2303         Remove unused didCancelAuthenticationChallenge
2304         https://bugs.webkit.org/show_bug.cgi?id=158819
2305
2306         Reviewed by David Kilzer.
2307
2308         No change in behavior.  This callback was deprecated in Yosemite.  It is never called.
2309
2310         * loader/EmptyClients.h:
2311         * loader/FrameLoaderClient.h:
2312         * loader/ResourceLoadNotifier.cpp:
2313         (WebCore::ResourceLoadNotifier::didCancelAuthenticationChallenge): Deleted.
2314         * loader/ResourceLoadNotifier.h:
2315         * loader/ResourceLoader.cpp:
2316         (WebCore::ResourceLoader::didCancelAuthenticationChallenge): Deleted.
2317         * loader/ResourceLoader.h:
2318         * platform/network/ResourceHandle.h:
2319         * platform/network/ResourceHandleClient.h:
2320         (WebCore::ResourceHandleClient::didCancelAuthenticationChallenge): Deleted.
2321         * platform/network/mac/ResourceHandleMac.mm:
2322         (WebCore::ResourceHandle::didCancelAuthenticationChallenge): Deleted.
2323         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
2324         (-[WebCoreResourceHandleAsDelegate connection:didCancelAuthenticationChallenge:]): Deleted.
2325         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2326         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didCancelAuthenticationChallenge:]): Deleted.
2327         * platform/spi/cocoa/NSURLDownloadSPI.h:
2328
2329 2016-06-23  Anders Carlsson  <andersca@apple.com>
2330
2331         Add "shippingType" to the list of valid payment request properties
2332         https://bugs.webkit.org/show_bug.cgi?id=159079
2333         <rdar://problem/26988429>
2334
2335         Reviewed by Dean Jackson.
2336
2337         * Modules/applepay/ApplePaySession.cpp:
2338         (WebCore::isValidPaymentRequestPropertyName):
2339
2340 2016-06-23  Benjamin Poulain  <benjamin@webkit.org>
2341
2342         Specialize synchronous event tracking per event type
2343         https://bugs.webkit.org/show_bug.cgi?id=158826
2344
2345         Reviewed by Simon Fraser.
2346
2347         First, kudos to Rick Byers for all his helps on passive event dispatch.
2348         The specs are pretty damn good and his help reviewing patches is very useful.
2349
2350         This patch change synchronous event dispatch to happen per event
2351         instead of per sequence touchstart->touchend.
2352
2353         The big advantage of this is we can dispatch more events asynchronously.
2354         For example, to handle a tap programmatically, you can limit the active listener
2355         to the touchend event. The touchstart and touchmove are now dispatched asynchronously.
2356
2357         The implementation is a simple extension to EventTrackingRegions.
2358         Instead of a single synchronous region, we have one region per event type.
2359         When processing the events, we only need to send the events synchronously
2360         if that particular event type has a synchronous region.
2361
2362         Note that EventDispatcher's touch event support already supports
2363         mixing synchronous and asynchronous events. The events are always processed
2364         in order even if asynchronous events are pending when a synchronous dispatch
2365         happens.
2366
2367         Tests: fast/events/touch/ios/tap-with-active-listener-inside-document-with-passive-listener.html
2368                fast/events/touch/ios/tap-with-active-listener-inside-window-with-passive-listener.html
2369                fast/events/touch/ios/tap-with-active-touch-end-listener.html
2370                fast/events/touch/ios/tap-with-passive-listener-inside-active-listener.html
2371                fast/events/touch/ios/tap-with-passive-touch-end-listener.html
2372                fast/events/touch/ios/tap-with-passive-touch-start-active-touch-end-listeners-on-elements.html
2373                fast/events/touch/ios/tap-with-passive-touch-start-active-touch-move-listeners-on-elements.html
2374
2375         * CMakeLists.txt:
2376         * WebCore.xcodeproj/project.pbxproj:
2377         * dom/EventTarget.cpp:
2378         (WebCore::EventTarget::hasActiveTouchEventListeners): Deleted.
2379         * dom/EventTarget.h:
2380         * page/DebugPageOverlays.cpp:
2381         (WebCore::NonFastScrollableRegionOverlay::updateRegion):
2382         * page/Page.cpp:
2383         (WebCore::Page::nonFastScrollableRects):
2384         * page/scrolling/ScrollingCoordinator.cpp:
2385         (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame):
2386         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
2387         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
2388         * page/scrolling/ScrollingTree.cpp:
2389         (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously):
2390         (WebCore::ScrollingTree::eventTrackingTypeForPoint):
2391         * page/scrolling/ScrollingTree.h:
2392         * platform/EventTrackingRegions.cpp: Added.
2393         (WebCore::EventTrackingRegions::trackingTypeForPoint):
2394         (WebCore::EventTrackingRegions::isEmpty):
2395         (WebCore::EventTrackingRegions::translate):
2396         (WebCore::EventTrackingRegions::uniteSynchronousRegion):
2397         (WebCore::EventTrackingRegions::unite):
2398         (WebCore::operator==):
2399         * platform/EventTrackingRegions.h:
2400         (WebCore::EventTrackingRegions::isEmpty): Deleted.
2401         (WebCore::EventTrackingRegions::trackingTypeForPoint): Deleted.
2402         (WebCore::operator==): Deleted.
2403
2404 2016-06-23  Simon Fraser  <simon.fraser@apple.com>
2405
2406         More attempting to fix external iOS builds.
2407
2408         * platform/spi/cocoa/QuartzCoreSPI.h:
2409
2410 2016-06-23  Simon Fraser  <simon.fraser@apple.com>
2411
2412         Try to fix the non-internal builds by defining CARenderServerBufferRef.
2413
2414         * platform/spi/cocoa/QuartzCoreSPI.h:
2415
2416 2016-06-23  Simon Fraser  <simon.fraser@apple.com>
2417
2418         [iOS] Make DumpRenderTree and WebKitTestRunner in the simulator use render server snapshotting
2419         https://bugs.webkit.org/show_bug.cgi?id=159077
2420
2421         Reviewed by Tim Horton.
2422
2423         Add CARenderServer SPIs.
2424
2425         Test: fast/harness/snapshot-captures-compositing.html
2426
2427         * platform/spi/cocoa/QuartzCoreSPI.h:
2428
2429 2016-06-23  Brian Burg  <bburg@apple.com>
2430
2431         Web Inspector: add assertions to catch dangling frontends that persist between tests
2432         https://bugs.webkit.org/show_bug.cgi?id=159073
2433
2434         Reviewed by Joseph Pecoraro.
2435
2436         Based on the analysis in https://webkit.org/b/159070, we suspect that some test
2437         flakiness might be caused by dangling frontends from previous test cases. Add an
2438         assertion that should catch any frontends that are attached to the inspected page's
2439         backend. There should never be any frontends connected when a test first starts.
2440
2441         * inspector/InspectorController.cpp:
2442         (WebCore::InspectorController::setIsUnderTest):
2443         * inspector/InspectorController.h:
2444
2445 2016-06-23  Said Abou-Hallawa  <sabouhallawa@apple.com>
2446
2447         requestFrameAnimation() callback timestamp should be very close to Performance.now() 
2448         https://bugs.webkit.org/show_bug.cgi?id=159038
2449
2450         Reviewed by Simon Fraser.
2451
2452         Pass the Performance.now() to requestFrameAnimation() callback. Do not add
2453         the timeUntilOutput which is the difference between outputTime and now since
2454         this addition makes us report a timestamp ahead in the future by almost 33ms.
2455
2456         A new function named "nowTimestamp()" is added to the DOMWindow class. It
2457         calls Performance.now() if WEB_TIMING is enabled, otherwise it calls
2458         monotonicallyIncreasingTime(). The returned timestamp is seconds and it is
2459         relative to the document loading time.
2460
2461         The timestamp passing will be removed all the down till the callers of
2462         ScriptedAnimationController::serviceScriptedAnimations(). The callers will
2463         getting the now timestamp by calling DOMWindow::nowTimestamp().
2464
2465         Tests: animations/animation-callback-timestamp.html
2466                animations/animation-multiple-callbacks-timestamp.html
2467
2468         * dom/Document.cpp:
2469         (WebCore::Document::monotonicTimestamp):
2470         (WebCore::Document::serviceScriptedAnimations):
2471         * dom/Document.h:
2472         * dom/ScriptedAnimationController.cpp:
2473         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
2474         (WebCore::ScriptedAnimationController::animationTimerFired):
2475         (WebCore::ScriptedAnimationController::displayRefreshFired):
2476         * dom/ScriptedAnimationController.h:
2477         * html/HTMLMediaElement.cpp:
2478         (WebCore::HTMLMediaElement::getVideoPlaybackQuality):
2479         * loader/DocumentLoadTiming.h:
2480         (WebCore::DocumentLoadTiming::referenceWallTime):
2481         * page/DOMWindow.cpp:
2482         (WebCore::DOMWindow::nowTimestamp):
2483         * page/DOMWindow.h:
2484         * page/FrameView.cpp:
2485         (WebCore::FrameView::serviceScriptedAnimations):
2486         * page/FrameView.h:
2487         * platform/graphics/DisplayRefreshMonitor.cpp:
2488         (WebCore::DisplayRefreshMonitor::DisplayRefreshMonitor):
2489         (WebCore::DisplayRefreshMonitor::displayDidRefresh):
2490         * platform/graphics/DisplayRefreshMonitor.h:
2491         (WebCore::DisplayRefreshMonitor::setMonotonicAnimationStartTime): Deleted.
2492         * platform/graphics/DisplayRefreshMonitorClient.cpp:
2493         (WebCore::DisplayRefreshMonitorClient::fireDisplayRefreshIfNeeded):
2494         * platform/graphics/DisplayRefreshMonitorClient.h:
2495         * platform/graphics/GraphicsLayerUpdater.cpp:
2496         (WebCore::GraphicsLayerUpdater::displayRefreshFired):
2497         * platform/graphics/GraphicsLayerUpdater.h:
2498         * platform/graphics/ios/DisplayRefreshMonitorIOS.h:
2499         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
2500         (-[WebDisplayLinkHandler handleDisplayLink:]):
2501         (WebCore::DisplayRefreshMonitorIOS::displayLinkFired):
2502         (WebCore::mediaTimeToCurrentTime): Deleted.
2503         * platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
2504         (WebCore::displayLinkCallback):
2505         (WebCore::DisplayRefreshMonitorMac::displayLinkFired):
2506         * platform/graphics/mac/DisplayRefreshMonitorMac.h:
2507         * platform/graphics/texmap/coordinated/CompositingCoordinator.cpp:
2508         (WebCore::CompositingCoordinator::syncDisplayState):
2509         (WebCore::CompositingCoordinator::nextAnimationServiceTime):
2510
2511 2016-06-23  David Kilzer  <ddkilzer@apple.com>
2512
2513         Remove unused HarfBuzzFaceCoreText.cpp
2514         <https://webkit.org/b/159065>
2515
2516         Reviewed by Myles C. Maxfield.
2517
2518         * platform/graphics/harfbuzz/HarfBuzzFaceCoreText.cpp: Removed.
2519
2520 2016-06-23  Joseph Pecoraro  <pecoraro@apple.com>
2521
2522         Web Inspector: Memory Timeline sometimes shows impossible value for bmalloc size (underflowed)
2523         https://bugs.webkit.org/show_bug.cgi?id=158110
2524         <rdar://problem/26498584>
2525
2526         Reviewed by Andreas Kling.
2527
2528         IOSurface memory backing Canvas element buffers should be classified as "GC Owned",
2529         but should not be considered a part of bmalloc. In fact, the actual memory cost is
2530         external to the Web Content Process. The majority of extra memory reporters tend
2531         to report extra memory that is also allocated in bmalloc. However, some report
2532         non-bmalloc memory, such as the IOSurfaces here.
2533         
2534         Continue to report the memory cost without changes to inform the Heap for garbage
2535         collection. However, also keep better accounting of GCOwned memory that is external
2536         to the process for better accounting for the Resource Usage overlay and Web Inspector
2537         Memory timeline.
2538         
2539         This is a bit of a game where we want to display the best possible number for
2540         "GCOwned memory" in the tools, but some of that memory shows up in the other
2541         regions (bmalloc, system malloc, etc). Already many sizes are estimates
2542         (ReportExtraMemory, reportExtraMemory ignores small allocations), so we just focus
2543         on getting the largest sources of allocations, such as Canvas IOSurfaces here,
2544         into the right bucket. ResourceUsageThreadCocoa continues to subtract the "extra"
2545         memory from bmalloc. So, we should address other large sources of "extra memory"
2546         not in bmalloc. A likely candidate is HTMLMediaElement which uses the deprecated
2547         reporting right now.
2548
2549         * bindings/scripts/CodeGeneratorJS.pm:
2550         (GenerateImplementation):
2551         * bindings/scripts/IDLAttributes.txt:
2552         Add a way to report External memory, dependent on reporting Extra memory.
2553
2554         * html/HTMLCanvasElement.cpp:
2555         (WebCore::HTMLCanvasElement::externalMemoryCost):
2556         * html/HTMLCanvasElement.h:
2557         * html/HTMLCanvasElement.idl:
2558         Report external memory cost just like extra memory.
2559
2560         * page/ResourceUsageData.cpp:
2561         (WebCore::ResourceUsageData::ResourceUsageData):
2562         * page/ResourceUsageData.h:
2563         (WebCore::MemoryCategoryInfo::totalSize):
2564         * page/cocoa/ResourceUsageOverlayCocoa.mm:
2565         (WebCore::RingBuffer::at):
2566         (WebCore::appendDataToHistory):
2567         (WebCore::ResourceUsageOverlay::platformDraw):
2568         * page/cocoa/ResourceUsageThreadCocoa.mm:
2569         (WebCore::categoryForVMTag):
2570         (WebCore::ResourceUsageThread::platformThreadBody):
2571         Do not count the GCOwned External memory as dirty memory.
2572         Include External memory output in the overlay.
2573
2574         * inspector/InspectorMemoryAgent.cpp:
2575         (WebCore::InspectorMemoryAgent::collectSample):
2576         When sizing the JavaScript portion, include both the GC Owned
2577         category's dirty and external memory. Ultimately we will
2578         want this everywhere in case things change.
2579
2580         * platform/graphics/ImageBuffer.cpp:
2581         (WebCore::memoryCost):
2582         (WebCore::externalMemoryCost):
2583         * platform/graphics/ImageBuffer.h:
2584         * platform/graphics/cg/ImageBufferCG.cpp:
2585         (WebCore::ImageBuffer::memoryCost):
2586         (WebCore::ImageBuffer::externalMemoryCost):
2587         Report IOSurface total bytes as extra memory and external memory
2588         so that it can be tracked as GC Owned memory that is separate from
2589         regular (bmalloc/other) in process memory.
2590
2591 2016-06-23  Alexey Proskuryakov  <ap@apple.com>
2592
2593         Handle (0, 0) ranges from Lookup
2594         https://bugs.webkit.org/show_bug.cgi?id=159062
2595         rdar://problem/26960385
2596
2597         Reviewed by Tim Horton.
2598
2599         * editing/mac/DictionaryLookup.mm: (WebCore::DictionaryLookup::rangeAtHitTestResult):
2600         Paper over <https://bugs.webkit.org/show_bug.cgi?id=159063>, which seems too involved
2601         to fix now.
2602
2603 2016-06-23  Joseph Pecoraro  <pecoraro@apple.com>
2604
2605         Web Inspector: first heap snapshot taken when a page is reloaded happens before the reload navigation
2606         https://bugs.webkit.org/show_bug.cgi?id=158995
2607         <rdar://problem/26923778>
2608
2609         Reviewed by Brian Burg.
2610
2611         When the "Heap" instrument is included in the Timeline list
2612         of instruments, defer starting it in an auto-capture scenario
2613         until after the page does its first navigation.
2614
2615         AutoCapture on the backend happens when it is enabled at
2616         the main resource starts loading. In that case it proceeds
2617         through the following phases:
2618
2619             No Auto Capture:
2620                 None
2621
2622             Auto Capture:
2623                 BeforeLoad -> FirstNavigation -> AfterFirstNavigation
2624
2625         When toggling instruments for backend initiated capture
2626         most instruments do not care and will just start/stop.
2627
2628         * inspector/InspectorInstrumentation.cpp:
2629         (WebCore::InspectorInstrumentation::didCommitLoadImpl):
2630         Inform the TimelineAgent that the main frame navigated.
2631         Do this after informing the HeapAgent (so any potential
2632         snapshot does not get cleared) and PageAgent (so the
2633         frontend knows the page navigated before the agent starts).
2634
2635         * inspector/InspectorTimelineAgent.h:
2636         * inspector/InspectorTimelineAgent.cpp:
2637         (WebCore::InspectorTimelineAgent::internalStop):
2638         (WebCore::InspectorTimelineAgent::mainFrameStartedLoading):
2639         (WebCore::InspectorTimelineAgent::mainFrameNavigated):
2640         Update the auto capture phase transitions.
2641
2642         (WebCore::InspectorTimelineAgent::toggleHeapInstrument):
2643         Only start the heap agent during the None phase (console.profile)
2644         or with the first navigation (auto capture page navigation).
2645
2646 2016-06-23  Joseph Pecoraro  <pecoraro@apple.com>
2647
2648         Web Inspector: Snapshots should be cleared at some point
2649         https://bugs.webkit.org/show_bug.cgi?id=157907
2650         <rdar://problem/26373610>
2651
2652         Reviewed by Timothy Hatcher.
2653
2654         * CMakeLists.txt:
2655         * WebCore.xcodeproj/project.pbxproj:
2656         * inspector/InspectorAllInOne.cpp:
2657         New specialized agent.
2658
2659         * inspector/InspectorController.cpp:
2660         (WebCore::InspectorController::InspectorController):
2661         Construct a specialized HeapAgent.
2662
2663         * inspector/PageHeapAgent.h:
2664         * inspector/PageHeapAgent.cpp:
2665         (WebCore::PageHeapAgent::PageHeapAgent):
2666         (WebCore::PageHeapAgent::enable):
2667         (WebCore::PageHeapAgent::disable):
2668         (WebCore::PageHeapAgent::mainFrameNavigated):
2669         Clear backend snapshots on page navigations.
2670         Set the PageHeapAgent instrumenting agent on enable/disable.
2671
2672         * inspector/InstrumentingAgents.cpp:
2673         (WebCore::InstrumentingAgents::reset):
2674         * inspector/InstrumentingAgents.h:
2675         (WebCore::InstrumentingAgents::pageHeapAgent):
2676         (WebCore::InstrumentingAgents::setPageHeapAgent):
2677         Active PageHeapAgent.
2678
2679         * inspector/InspectorInstrumentation.cpp:
2680         (WebCore::InspectorInstrumentation::didCommitLoadImpl):
2681         Inform the PageHeapAgent when the mainframe navigates.
2682
2683 2016-06-23  Joseph Pecoraro  <pecoraro@apple.com>
2684
2685         CSSComputedStyleDeclaration::length should recalculate styles if needed to provide the correct value
2686         https://bugs.webkit.org/show_bug.cgi?id=159053
2687         <rdar://problem/26638119>
2688
2689         Reviewed by Simon Fraser.
2690
2691         Test: fast/css/variables/custom-property-computed-style-length-update.html
2692
2693         * css/CSSComputedStyleDeclaration.cpp:
2694         (WebCore::CSSComputedStyleDeclaration::length):
2695
2696 2016-06-23  John Wilander  <wilander@apple.com>
2697
2698         Enable window.open() for existing versions of Secret Society
2699         https://bugs.webkit.org/show_bug.cgi?id=159049
2700         <rdar://problem/26528349>
2701
2702         Reviewed by Andy Estes.
2703
2704         The Secret Society Hidden Mystery app has a broken version check treating iOS 10
2705         as iOS 1 on iPads. Therefore it believes it can use window.open() in a tap
2706         handler. We should allow the existing versions of the app to do this to not break
2707         them.
2708
2709         No new tests. Tested manually in the app.
2710
2711         * page/DOMWindow.cpp:
2712         (WebCore::DOMWindow::allowPopUp):
2713             Now checks with Settings whether it should allow a popup even though it is
2714             not processing a user gesture.
2715         * page/Settings.in:
2716             Added setting allowWindowOpenWithoutUserGesture.
2717         * platform/RuntimeApplicationChecks.h:
2718         * platform/RuntimeApplicationChecks.mm:
2719         (WebCore::IOSApplication::isTheSecretSocietyHiddenMystery):
2720             Added.
2721
2722 2016-06-23  Chris Dumez  <cdumez@apple.com>
2723
2724         Only call sqlite3_initialize() when a SQLite database is actually being opened
2725         https://bugs.webkit.org/show_bug.cgi?id=159033
2726
2727         Reviewed by Brady Eidson.
2728
2729         Only call sqlite3_initialize() when a SQLite database is actually being opened
2730         instead of doing it unconditionally. sqlite3_initialize() was previously called
2731         in the SQLiteDatabase constructor which gets called on WebContent process
2732         initialization because a DatabaseTracker is constructed on initialization and
2733         DatabaseTracker has a SQLiteDatabase data member.
2734
2735         * platform/sql/SQLiteDatabase.cpp:
2736         (WebCore::initializeSQLiteIfNecessary):
2737         (WebCore::SQLiteDatabase::open):
2738         (WebCore::SQLiteDatabase::SQLiteDatabase): Deleted.
2739         * platform/sql/SQLiteDatabase.h:
2740
2741 2016-06-23  Adam Bergkvist  <adam.bergkvist@ericsson.com>
2742
2743         WebRTC: Align 'update ICE connection/gathering state' steps with the WebRTC 1.0 specification
2744         https://bugs.webkit.org/show_bug.cgi?id=159054
2745
2746         Reviewed by Eric Carlson.
2747
2748         Add checks for same state and closed RTCPeerConnection in the 'update ICE connection state'
2749         and 'update ICE gathering state' routines as described in [1].
2750
2751         [1] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#update-ice-gathering-state
2752
2753         No change in current behavior.
2754
2755         * Modules/mediastream/RTCPeerConnection.cpp:
2756         (WebCore::RTCPeerConnection::updateIceGatheringState):
2757         (WebCore::RTCPeerConnection::updateIceConnectionState):
2758
2759 2016-06-23  Adam Bergkvist  <adam.bergkvist@ericsson.com>
2760
2761         WebRTC: Add support for RTCPeerConnection legacy MediaStream-based API
2762         https://bugs.webkit.org/show_bug.cgi?id=158940
2763
2764         Reviewed by Eric Carlson.
2765
2766         Implement the legacy MediaStream-based RTCPeerConnection API as JS built-ins. The
2767         getRemoteStreams() function and the 'addstream' event are partly implemented with native
2768         code.
2769
2770         Test: fast/mediastream/RTCPeerConnection-legacy-stream-based-api.html
2771
2772         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2773         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
2774         (WebCore::MediaEndpointPeerConnection::getRemoteStreams):
2775         The getRemoteStreams() function and the 'addstream' event is backed up by native code.
2776         * Modules/mediastream/MediaEndpointPeerConnection.h:
2777         * Modules/mediastream/MediaStream.idl:
2778         * Modules/mediastream/PeerConnectionBackend.h:
2779         * Modules/mediastream/RTCPeerConnection.h:
2780         * Modules/mediastream/RTCPeerConnection.idl:
2781         * Modules/mediastream/RTCPeerConnection.js:
2782         (initializeRTCPeerConnection):
2783         (getLocalStreams):
2784         (getRemoteStreams):
2785         (getStreamById):
2786         (addStream):
2787         (removeStream):
2788         Legacy API implemented as JS built-ins.
2789         * bindings/js/JSDOMGlobalObject.cpp:
2790         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
2791         * bindings/js/WebCoreBuiltinNames.h:
2792
2793 2016-06-23  Carlos Garcia Campos  <cgarcia@igalia.com>
2794
2795         Unreviewed. Fix the build with CSS Shapes disabled.
2796
2797         * css/StyleBuilderConverter.h:
2798
2799 2016-06-23  Carlos Garcia Campos  <cgarcia@igalia.com>
2800
2801         [Soup] Clean up SocketStreamHandle soup implementation
2802         https://bugs.webkit.org/show_bug.cgi?id=159024
2803
2804         Reviewed by Žan Doberšek.
2805
2806         Stop using a global HashMap to "acivate"/"deactivate" handles, and just take a reference of the handle and
2807         pass the ownership to the callbacks, using a GCancellable to cancel all async operations.
2808
2809         * platform/network/soup/SocketStreamHandle.h:
2810         (WebCore::SocketStreamHandle::create):
2811         (WebCore::SocketStreamHandle::id): Deleted.
2812         * platform/network/soup/SocketStreamHandleSoup.cpp:
2813         (WebCore::SocketStreamHandle::SocketStreamHandle):
2814         (WebCore::SocketStreamHandle::connected):
2815         (WebCore::SocketStreamHandle::connectedCallback):
2816         (WebCore::SocketStreamHandle::readBytes):
2817         (WebCore::SocketStreamHandle::readReadyCallback):
2818         (WebCore::SocketStreamHandle::didFail):
2819         (WebCore::SocketStreamHandle::platformSend):
2820         (WebCore::SocketStreamHandle::platformClose):
2821         (WebCore::SocketStreamHandle::beginWaitingForSocketWritability):
2822         (WebCore::SocketStreamHandle::writeReadyCallback):
2823         (WebCore::getHandleFromId): Deleted.
2824         (WebCore::deactivateHandle): Deleted.
2825         (WebCore::activateHandle): Deleted.
2826         (WebCore::SocketStreamHandle::~SocketStreamHandle): Deleted.
2827         (WebCore::connectedCallback): Deleted.
2828         (WebCore::readReadyCallback): Deleted.
2829         (WebCore::writeReadyCallback): Deleted.
2830
2831 2016-06-22  Brady Eidson  <beidson@apple.com>
2832
2833         DatabaseProcess doesn't handle WebProcesses going away uncleanly.
2834         https://bugs.webkit.org/show_bug.cgi?id=158894
2835
2836         Reviewed by Alex Christensen.
2837
2838         No new tests (Covered by additions to existing API test).
2839
2840         * Modules/indexeddb/server/IDBConnectionToClient.cpp:
2841         (WebCore::IDBServer::IDBConnectionToClient::registerDatabaseConnection):
2842         (WebCore::IDBServer::IDBConnectionToClient::unregisterDatabaseConnection):
2843         (WebCore::IDBServer::IDBConnectionToClient::connectionToClientClosed):
2844         * Modules/indexeddb/server/IDBConnectionToClient.h:
2845         
2846         * Modules/indexeddb/server/IDBServer.cpp:
2847         (WebCore::IDBServer::IDBServer::unregisterConnection): Call connectionToClientClosed() on
2848           the connection, which cleans up after it in the server.
2849         
2850         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
2851         (WebCore::IDBServer::UniqueIDBDatabaseConnection::UniqueIDBDatabaseConnection):
2852         (WebCore::IDBServer::UniqueIDBDatabaseConnection::~UniqueIDBDatabaseConnection):
2853
2854 2016-06-22  Benjamin Poulain  <bpoulain@apple.com>
2855
2856         AX: Add support for CSS4 :focus-within pseudo
2857         https://bugs.webkit.org/show_bug.cgi?id=140144
2858
2859         Reviewed by Antti Koivisto.
2860
2861         Tests: fast/css/pseudo-focus-within-basics.html
2862                fast/css/pseudo-focus-within-inside-shadow-dom.html
2863                fast/css/pseudo-focus-within-style-sharing-1.html
2864                fast/css/pseudo-focus-within-style-sharing-2.html
2865                fast/selectors/focus-within-style-update.html
2866
2867         * css/CSSSelector.cpp:
2868         (WebCore::CSSSelector::selectorText):
2869         * css/CSSSelector.h:
2870         * css/SelectorChecker.cpp:
2871         (WebCore::SelectorChecker::checkOne):
2872         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
2873         * cssjit/SelectorCompiler.cpp:
2874         (WebCore::SelectorCompiler::addPseudoClassType):
2875         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching):
2876         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasFocusWithin):
2877         * dom/ContainerNode.cpp:
2878         (WebCore::destroyRenderTreeIfNeeded):
2879         * dom/Element.cpp:
2880         (WebCore::Element::~Element):
2881         (WebCore::Element::setFocus):
2882         (WebCore::Element::unregisterNamedFlowContentElement):
2883         (WebCore::Element::setIsNamedFlowContentElement):
2884         (WebCore::Element::clearIsNamedFlowContentElement):
2885         (WebCore::Element::setStyleAffectedByFocusWithin):
2886         (WebCore::Element::rareDataStyleAffectedByFocusWithin):
2887         (WebCore::Element::rareDataIsNamedFlowContentElement):
2888         * dom/Element.h:
2889         (WebCore::Element::hasFocusWithin):
2890         (WebCore::Element::styleAffectedByFocusWithin):
2891         (WebCore::Element::isNamedFlowContentElement):
2892         (WebCore::Element::setHasFocusWithin):
2893         * dom/ElementRareData.h:
2894         (WebCore::ElementRareData::styleAffectedByFocusWithin):
2895         (WebCore::ElementRareData::setStyleAffectedByFocusWithin):
2896         (WebCore::ElementRareData::isNamedFlowContentElement):
2897         (WebCore::ElementRareData::setIsNamedFlowContentElement):
2898         (WebCore::ElementRareData::ElementRareData):
2899         (WebCore::ElementRareData::resetComputedStyle):
2900         * dom/Node.h:
2901         (WebCore::Node::flagHasFocusWithin):
2902         (WebCore::Node::isNamedFlowContentNode): Deleted.
2903         (WebCore::Node::setIsNamedFlowContentNode): Deleted.
2904         (WebCore::Node::clearIsNamedFlowContentNode): Deleted.
2905         * rendering/RenderNamedFlowThread.cpp:
2906         (WebCore::RenderNamedFlowThread::clearContentElements):
2907         (WebCore::RenderNamedFlowThread::registerNamedFlowContentElement):
2908         (WebCore::RenderNamedFlowThread::unregisterNamedFlowContentElement):
2909         (WebCore::nextNodeInsideContentElement):
2910         * style/RenderTreeUpdater.cpp:
2911         (WebCore::RenderTreeUpdater::updateElementRenderer):
2912         * style/StyleRelations.cpp:
2913         (WebCore::Style::commitRelationsToRenderStyle):
2914         (WebCore::Style::commitRelations):
2915         * style/StyleRelations.h:
2916         * style/StyleSharingResolver.cpp:
2917         (WebCore::Style::SharingResolver::canShareStyleWithElement):
2918
2919 2016-06-22  Oliver Hunt  <oliver@apple.com>
2920
2921         Integrate WebKit's CFURLConnection with App Transport Security
2922         https://bugs.webkit.org/show_bug.cgi?id=159039
2923         <rdar://problem/26953685>
2924
2925         Reviewed by Alex Christensen.
2926
2927         Pass additional options to NSURLConnect initialiser to identify that
2928         this connection is for WebKit content loading.
2929
2930         * platform/network/mac/ResourceHandleMac.mm:
2931         (WebCore::ResourceHandle::createNSURLConnection):
2932
2933 2016-06-20  Jeremy Jones  <jeremyj@apple.com>
2934
2935         Adopt commitPriority to get rid of the 2 AVPL solution for PiP
2936         https://bugs.webkit.org/show_bug.cgi?id=158949
2937         rdar://problem/26867866
2938
2939         Reviewed by Simon Fraser.
2940
2941         No new tests because there is no behavior change. This reverts changes from 
2942         https://bugs.webkit.org/show_bug.cgi?id=158148 and instead uses -[CAContext commitPriority:]
2943         to prevent flicker when moving a layer between contexts. 
2944         commitPriority allows the layer to be added to the destination context before it is 
2945         removed from the source context.
2946
2947         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: remove m_secondaryVideoLayer.
2948         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: ditto
2949         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenGravity): ditto.
2950         (WebCore::MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds): ditto.
2951         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer): ditto.
2952         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity): ditto.
2953         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: ditto
2954         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer): ditto
2955         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: ditto
2956         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::createPreviewLayers):ditto
2957         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h: ditto
2958         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm: ditto
2959         (WebCore::VideoFullscreenLayerManager::setVideoLayer): ditto
2960         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer): ditto and adopt commitPriority.
2961         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenFrame): ditto
2962         (WebCore::VideoFullscreenLayerManager::setVideoLayers): Deleted. 
2963         (WebCore::VideoFullscreenLayerManager::didDestroyVideoLayer): remove m_secondaryVideoLayer.
2964         * platform/spi/cocoa/QuartzCoreSPI.h: Add commitPriority.
2965
2966 2016-06-22  Simon Fraser  <simon.fraser@apple.com>
2967
2968         REGRESSION (r201629): Weird button glitching on github.com
2969         https://bugs.webkit.org/show_bug.cgi?id=159031
2970         rdar://problem/26880332
2971
2972         Reviewed by Tim Horton.
2973
2974         r201629 changed the logic slightly when creating an image buffer for a scaled context;
2975         it set the buffer context's scale to the scale in the source context, but this failed
2976         to take into account the rounding up of the buffer size, which the old code did.
2977
2978         Fix by reverting to the old behavior.
2979
2980         Since buffer sizes can only be integral, changed compatibleBufferSize() to return
2981         an IntSize.
2982
2983         Test: fast/backgrounds/scaled-gradient-background.html
2984
2985         * platform/graphics/ImageBuffer.cpp:
2986         (WebCore::ImageBuffer::createCompatibleBuffer):
2987         (WebCore::ImageBuffer::compatibleBufferSize):
2988         * platform/graphics/ImageBuffer.h:
2989         * platform/graphics/IntRect.h:
2990         (WebCore::IntRect::area):
2991         * platform/graphics/IntSize.h:
2992         (WebCore::IntSize::area): Make this return an unsigned.
2993
2994 2016-06-22  Anders Carlsson  <andersca@apple.com>
2995
2996         Inline the last of the Apple Pay WebCore code
2997         https://bugs.webkit.org/show_bug.cgi?id=159032
2998
2999         Reviewed by Tim Horton.
3000
3001         * loader/EmptyClients.cpp:
3002         (WebCore::fillWithEmptyClients):
3003         * page/MainFrame.cpp:
3004         (WebCore::MainFrame::MainFrame):
3005         * page/MainFrame.h:
3006         * page/PageConfiguration.h:
3007         * platform/cocoa/ThemeCocoa.mm:
3008         (WebCore::passKitBundle):
3009         (WebCore::loadPassKitPDFPage):
3010         (WebCore::applePayButtonLogoBlack):
3011         (WebCore::applePayButtonLogoWhite):
3012         (WebCore::drawApplePayButton):
3013         (WebCore::ThemeCocoa::drawNamedImage):
3014
3015 2016-06-22  Anders Carlsson  <andersca@apple.com>
3016
3017         Exception is not thrown when shipping method is an invalid amount
3018         https://bugs.webkit.org/show_bug.cgi?id=159030
3019         rdar://problem/26700413
3020
3021         Reviewed by Tim Horton.
3022
3023         * Modules/applepay/ApplePaySession.cpp:
3024         (WebCore::createShippingMethods):
3025         Bail if createShippingMethod returns Nullopt.
3026
3027         (WebCore::createPaymentRequest):
3028         Bail if createShippingMethods returns Nullopt.
3029
3030 2016-06-22  Anders Carlsson  <andersca@apple.com>
3031
3032         Exception is not thrown when shipping method is an invalid amount
3033         https://bugs.webkit.org/show_bug.cgi?id=159029
3034         rdar://problem/26700413
3035
3036         Reviewed by Tim Horton.
3037
3038         * Modules/applepay/PaymentRequest.h:
3039         Change ShippingMethod::amount to be a signed 64-bit integer.
3040
3041         * Modules/applepay/PaymentRequestValidator.cpp:
3042         (WebCore::PaymentRequestValidator::validate):
3043         Call validateShippingMethods.
3044
3045         (WebCore::PaymentRequestValidator::validateShippingMethods):
3046         Validate all the shipping methods.
3047
3048         (WebCore::PaymentRequestValidator::validateShippingMethod):
3049         Check that the amount is >= 0.
3050
3051         * Modules/applepay/PaymentRequestValidator.h:
3052         Add new members.
3053
3054 2016-06-22  Adam Bergkvist  <adam.bergkvist@ericsson.com>
3055
3056         WebRTC: Add support for the negotiationneeded event in MediaEndpointPeerConnection
3057         https://bugs.webkit.org/show_bug.cgi?id=158985
3058
3059         Reviewed by Eric Carlson.
3060
3061         Implement MediaEndpointPeerConnection's isNegotiationNeeded, markAsNeedingNegotiation and
3062         clearNegotiationNeededState functions. The calls to these functions are already up-to-date.
3063
3064         Test: fast/mediastream/RTCPeerConnection-more-media-to-negotiate.html
3065
3066         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3067         (WebCore::MediaEndpointPeerConnection::markAsNeedingNegotiation):
3068         * Modules/mediastream/MediaEndpointPeerConnection.h:
3069         * Modules/mediastream/RTCPeerConnection.cpp:
3070         (WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent):
3071
3072 2016-06-22  Adam Bergkvist  <adam.bergkvist@ericsson.com>
3073
3074         WebRTC: Replace RTCPeerConnection custom constructor with a JS built-in constructor
3075         https://bugs.webkit.org/show_bug.cgi?id=158832
3076
3077         Reviewed by Eric Carlson and Youenn Fablet.
3078
3079         Use a JS built-in constructor instead of a custom constructor. This makes it easier to
3080         initialize private fields for functions implemented as JS built-ins. The constructor
3081         behavior is in need of updating, but that is left to a follow-up change [1].
3082
3083         [1] http://webkit.org/b/158936
3084         No change in behavior.
3085
3086         * CMakeLists.txt:
3087         * Modules/mediastream/RTCPeerConnection.cpp:
3088         (WebCore::RTCPeerConnection::create):
3089         (WebCore::RTCPeerConnection::RTCPeerConnection):
3090         (WebCore::RTCPeerConnection::~RTCPeerConnection):
3091         (WebCore::RTCPeerConnection::initializeWith):
3092         * Modules/mediastream/RTCPeerConnection.h:
3093         * Modules/mediastream/RTCPeerConnection.idl:
3094         * Modules/mediastream/RTCPeerConnection.js:
3095         (initializeRTCPeerConnection):
3096         Add JS built-in constructor function.
3097         * WebCore.xcodeproj/project.pbxproj:
3098         * bindings/js/JSRTCPeerConnectionCustom.cpp: Removed.
3099         (WebCore::constructJSRTCPeerConnection): Deleted.
3100
3101 2016-06-22  Youenn Fablet  <youenn@apple.com>
3102
3103         CrossOriginPreflightChecker should call DocumentThreadableLoader preflightFailure instead of didFailLoading
3104         https://bugs.webkit.org/show_bug.cgi?id=158984
3105
3106         Reviewed by Darin Adler.
3107
3108         No change of behavior.
3109
3110         Calling DocumentThreadableLoader preflightFailure instead of didFailLoading for any preflight error case.
3111
3112         * loader/CrossOriginPreflightChecker.cpp:
3113         (WebCore::CrossOriginPreflightChecker::notifyFinished): Directly calling preflightFailure callback.
3114         (WebCore::CrossOriginPreflightChecker::doPreflight): Ditto.
3115         (WebCore::CrossOriginPreflightChecker::handleLoadingFailure): Deleted.
3116         (WebCore::CrossOriginPreflightChecker::redirectReceived): Deleted (should have been removed as part of
3117         https://bugs.webkit.org/show_bug.cgi?id=111008).
3118         * loader/CrossOriginPreflightChecker.h:
3119
3120 2016-06-22  Youenn Fablet  <youennf@gmail.com>
3121
3122         JSDOMIterator forEach should support second optional parameter
3123         https://bugs.webkit.org/show_bug.cgi?id=159020
3124
3125         Reviewed by Chris Dumez.
3126
3127         Covered by beefed up test.
3128
3129         * bindings/js/JSDOMIterator.h:
3130         (WebCore::iteratorForEach): Setting callback thisValue to the second argument passed to forEach.
3131
3132 2016-06-22  Jer Noble  <jer.noble@apple.com>
3133
3134         Media controls stop working after exiting PiP
3135         https://bugs.webkit.org/show_bug.cgi?id=159026
3136         <rdar://problem/26753579>
3137
3138         Reviewed by Eric Carlson.
3139
3140         Do not slave setting WebVideoFullscreenModelVideoElement::setVideoElement() to
3141         WebPlaybackSessionModelVideoElement::setMediaElement(). After all, someone else
3142         (i.e., the media controls) may still be using it.
3143
3144         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
3145         (WebVideoFullscreenModelVideoElement::setVideoElement): Deleted.
3146         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3147         (WebVideoFullscreenControllerContext::didCleanupFullscreen):
3148         (WebVideoFullscreenControllerContext::setUpFullscreen):
3149
3150 2016-06-22  Jer Noble  <jer.noble@apple.com>
3151
3152         Update document's isPlayingMedia() state whenever media element's media state changes
3153         https://bugs.webkit.org/show_bug.cgi?id=159018
3154         <rdar://problem/26586630>
3155
3156         Reviewed by Beth Dakin.
3157
3158         The Document can end up with a stale m_mediaState if its own value isn't updated when
3159         its constituent HTMLMediaElement's m_mediaStates change.
3160
3161         * html/HTMLMediaElement.cpp:
3162         (WebCore::HTMLMediaElement::updateMediaState):
3163
3164 2016-06-22  Simon Fraser  <simon.fraser@apple.com>
3165
3166         Crash under GraphicsLayerCA::recursiveCommitChanges() with deep layer trees
3167         https://bugs.webkit.org/show_bug.cgi?id=159023
3168         rdar://problem/25377842
3169
3170         Reviewed by Tim Horton.
3171
3172         Having an on-stack DisplayList::Recorder increased the stack frame size significantly,
3173         causing stack exhaustion with deep layer trees, despite the existing depth check.
3174
3175         Make the Recorder heap-allocated to fix this.
3176
3177         Tested by LayoutTests/compositing//layer-creation/deep-tree.html.
3178
3179         * platform/graphics/ca/GraphicsLayerCA.cpp:
3180         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
3181
3182 2016-06-22  Carlos Garcia Campos  <cgarcia@igalia.com>
3183
3184         [GTK] Add support for variadic parameters to GObject DOM bindings
3185         https://bugs.webkit.org/show_bug.cgi?id=158942
3186
3187         Reviewed by Michael Catanzaro.
3188
3189         Generate code for functions having variadic parameters.
3190
3191         * bindings/scripts/CodeGeneratorGObject.pm:
3192         (GenerateFunction):
3193         (SkipFunction):
3194         * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
3195         (webkit_dom_test_obj_variadic_string_method):
3196         * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
3197
3198 2016-06-21  Benjamin Poulain  <bpoulain@apple.com>
3199
3200         :hover CSS pseudo-class sometimes keeps matching ever after mouse has left the element
3201         https://bugs.webkit.org/show_bug.cgi?id=158340
3202
3203         Reviewed by Simon Fraser.
3204
3205         When removing a hovered subtree from the document, we were getting
3206         into an inconsistent state where m_hoveredElement is in the detached
3207         subtree and we have no way of clearing the existing IsHovered flags.
3208
3209         What happens is:
3210         -The root "a" has an child "b" that is hovered.
3211         -"a" starts being removed from the tree, its renderer is destroyed.
3212         -RenderTreeUpdater::tearDownRenderers() pushes "a" on the teardownStack
3213          and calls hoveredElementDidDetach().
3214         -hoveredElementDidDetach() is called with "a". "a" is not the hovered
3215          element, the function does nothing.
3216         -RenderTreeUpdater::tearDownRenderers() pushes "b" on the teardownStack
3217          and calls hoveredElementDidDetach().
3218         -hoveredElementDidDetach() is called with "b". The next parent with a renderer
3219          is "a", m_hoveredElement is set to "a".
3220         -"a"'s parent is set to nullptr.
3221
3222         -> We have a m_hoveredElement on the root of a detached tree, making
3223            it impossible to clear the real dirty tree.
3224
3225         This patch changes the order in which we clear the flags.
3226         It is done in the order in which we clear the renderers to ensure
3227         the last element with a dead renderer is the last to update m_hoveredElement.
3228
3229         Tests: fast/css/ancestor-of-hovered-element-detached.html
3230                fast/css/ancestor-of-hovered-element-removed.html
3231
3232         * Source/WebCore/style/RenderTreeUpdater.cpp:
3233
3234 2016-06-21  Youenn Fablet  <youennf@gmail.com>
3235
3236         [Fetch API] Rename 'origin-only' referrer policy to 'origin'
3237         https://bugs.webkit.org/show_bug.cgi?id=158982
3238
3239         Reviewed by Alex Christensen.
3240
3241         Covered by updated tests.
3242
3243         * Modules/fetch/FetchRequest.cpp:
3244         (WebCore::setReferrerPolicy): Renaming origin-only to origin.
3245         * Modules/fetch/FetchRequest.idl: Ditto.
3246         * loader/FetchOptions.h: Ditto.
3247
3248 2016-06-21  Chris Dumez  <cdumez@apple.com>
3249
3250         Let the compiler generate the move constructor and assignment operator for ScriptExecutionContext::Task
3251         https://bugs.webkit.org/show_bug.cgi?id=159013
3252
3253         Reviewed by Brady Eidson.
3254
3255         Let the compiler generate the move constructor and assignment operator for
3256         ScriptExecutionContext::Task. We previously manually defined the move
3257         constructor but there is no need as it doesn't do anything special.
3258
3259         * dom/ScriptExecutionContext.h:
3260
3261 2016-06-21  Dean Jackson  <dino@apple.com>
3262
3263         DumpRenderTree crashed in com.apple.WebCore: WebCore::HTMLSelectElement::updateSelectedState
3264         https://bugs.webkit.org/show_bug.cgi?id=159009
3265         <rdar://problem/23454623>
3266
3267         Reviewed by Jon Lee.
3268
3269         It seems we can get bogus indices from UIKit's implementation
3270         of UIWebSelectMultiplePicker. Guard against this situation.
3271
3272         Covered by running the existing tests in WebKit1 with Guard Malloc,
3273         such as fast/spatial-navigation/snav-multiple-select-optgroup.html
3274
3275         * html/HTMLSelectElement.cpp:
3276         (WebCore::HTMLSelectElement::updateSelectedState): Early return
3277         if we get an index out of range.
3278
3279 2016-06-21  Chris Dumez  <cdumez@apple.com>
3280
3281         Pass ScriptExecutionContext::Task as rvalue reference
3282         https://bugs.webkit.org/show_bug.cgi?id=159007
3283
3284         Reviewed by Anders Carlsson.
3285
3286         Pass ScriptExecutionContext::Task as rvalue reference since its non-copyable
3287         and has to be moved in.
3288
3289         * workers/WorkerLoaderProxy.h:
3290         * workers/WorkerMessagingProxy.cpp:
3291         (WebCore::WorkerMessagingProxy::postTaskToLoader):
3292         (WebCore::WorkerMessagingProxy::postTaskForModeToWorkerGlobalScope):
3293         * workers/WorkerMessagingProxy.h:
3294         * workers/WorkerRunLoop.cpp:
3295         (WebCore::WorkerRunLoop::postTask):
3296         (WebCore::WorkerRunLoop::postTaskAndTerminate):
3297         (WebCore::WorkerRunLoop::postTaskForMode):
3298         (WebCore::WorkerRunLoop::Task::Task):
3299         * workers/WorkerRunLoop.h:
3300
3301 2016-06-21  Anders Carlsson  <andersca@apple.com>
3302
3303         Include IdentifierInlines.h.
3304
3305         * bindings/js/JSApplePayShippingMethodSelectedEventCustom.cpp:
3306
3307 2016-06-21  Anders Carlsson  <andersca@apple.com>
3308
3309         Add PaymentHeaders.h file.
3310
3311         * Modules/applepay/PaymentHeaders.h: Added.
3312         * WebCore.xcodeproj/project.pbxproj:
3313
3314 2016-06-21  Anders Carlsson  <andersca@apple.com>
3315
3316         Make a bunch of Apple Pay headers private instead of project.
3317
3318         * WebCore.xcodeproj/project.pbxproj:
3319
3320 2016-06-21  Anders Carlsson  <andersca@apple.com>
3321
3322         Move the last Apple Pay WebCore files to the open source repository
3323         https://bugs.webkit.org/show_bug.cgi?id=159005
3324
3325         Reviewed by Tim Horton.
3326
3327         * DerivedSources.make:
3328         * Modules/applepay/ApplePayPaymentAuthorizedEvent.cpp: Added.
3329         * Modules/applepay/ApplePayPaymentAuthorizedEvent.h: Added.
3330         * Modules/applepay/ApplePayPaymentAuthorizedEvent.idl: Added.
3331         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.cpp: Added.
3332         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.h: Added.
3333         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.idl: Added.
3334         * Modules/applepay/ApplePaySession.cpp: Added.
3335         * Modules/applepay/ApplePaySession.h: Added.
3336         * Modules/applepay/ApplePaySession.idl: Added.
3337         * Modules/applepay/ApplePayShippingContactSelectedEvent.cpp: Added.
3338         * Modules/applepay/ApplePayShippingContactSelectedEvent.h: Added.
3339         * Modules/applepay/ApplePayShippingContactSelectedEvent.idl: Added.
3340         * Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp: Added.
3341         * Modules/applepay/ApplePayShippingMethodSelectedEvent.h: Added.
3342         * Modules/applepay/ApplePayShippingMethodSelectedEvent.idl: Added.
3343         * Modules/applepay/ApplePayValidateMerchantEvent.cpp: Added.
3344         * Modules/applepay/ApplePayValidateMerchantEvent.h: Added.
3345         * Modules/applepay/ApplePayValidateMerchantEvent.idl: Added.
3346         * Modules/applepay/Payment.h: Added.
3347         * Modules/applepay/PaymentAuthorizationStatus.h: Added.
3348         * Modules/applepay/PaymentContact.h: Added.
3349         * Modules/applepay/PaymentMerchantSession.h: Added.
3350         * Modules/applepay/PaymentMethod.h: Added.
3351         * Modules/applepay/PaymentRequestValidator.cpp: Added.
3352         * Modules/applepay/PaymentRequestValidator.h: Added.
3353         * Modules/applepay/cocoa/PaymentContactCocoa.mm: Added.
3354         * Modules/applepay/cocoa/PaymentMethodCocoa.mm: Added.
3355         * WebCore.xcodeproj/project.pbxproj:
3356         * bindings/js/JSApplePayPaymentAuthorizedEventCustom.cpp: Added.
3357         * bindings/js/JSApplePayPaymentMethodSelectedEventCustom.cpp: Added.
3358         * bindings/js/JSApplePaySessionCustom.cpp: Added.
3359         * bindings/js/JSApplePayShippingContactSelectedEventCustom.cpp: Added.
3360         * bindings/js/JSApplePayShippingMethodSelectedEventCustom.cpp: Added.
3361         * dom/EventNames.in:
3362         * dom/EventTargetFactory.in:
3363
3364 2016-06-21  Anders Carlsson  <andersca@apple.com>
3365
3366         Fix build.
3367
3368         * Configurations/FeatureDefines.xcconfig:
3369
3370 2016-06-21  Jiewen Tan  <jiewen_tan@apple.com>
3371
3372         Unreviewed, rolling out r202302, r202303, r202305, and
3373         r202306.
3374
3375         Roll out the rollouts because of breaking the build.
3376
3377         Reverted changesets:
3378
3379         "Unreviewed, rolling out r200678."
3380         https://bugs.webkit.org/show_bug.cgi?id=157453
3381         http://trac.webkit.org/changeset/202302
3382
3383         "Unreviewed, rolling out r200619."
3384         https://bugs.webkit.org/show_bug.cgi?id=131443
3385         http://trac.webkit.org/changeset/202303
3386
3387         "Unreviewed, attempt to fix the build after r202303."
3388         http://trac.webkit.org/changeset/202305
3389
3390         "Unreviewed, attempt to fix the build after r202303."
3391         http://trac.webkit.org/changeset/202306
3392
3393 2016-06-21  Chris Dumez  <cdumez@apple.com>
3394
3395         Unreviewed, attempt to fix the build after r202303.
3396
3397         * bindings/js/JSDOMIterator.h:
3398         (WebCore::IteratorInspector::decltype):
3399         (WebCore::IteratorInspector::test):
3400
3401 2016-06-21  Chris Dumez  <cdumez@apple.com>
3402
3403         Unreviewed, attempt to fix the build after r202303.
3404
3405         * bindings/js/JSDOMIterator.h:
3406         (WebCore::toJS):
3407
3408 2016-06-21  Jiewen Tan  <jiewen_tan@apple.com>
3409
3410         Unreviewed, rolling out r200619.
3411
3412         This incompleted feature broke http://m.yahoo.co.jp. Roll it
3413         out together with r200678.
3414
3415         Reverted changeset:
3416
3417         "NodeList should be iterable"
3418         https://bugs.webkit.org/show_bug.cgi?id=131443
3419         http://trac.webkit.org/changeset/200619
3420
3421 2016-06-21  Jiewen Tan  <jiewen_tan@apple.com>
3422
3423         Unreviewed, rolling out r200678.
3424
3425         This incompleted feature broke http://m.yahoo.co.jp. Roll it
3426         out together with r200619.
3427
3428         Reverted changeset:
3429
3430         "Ensure DOM iterators remain done"
3431         https://bugs.webkit.org/show_bug.cgi?id=157453
3432         http://trac.webkit.org/changeset/200678
3433
3434 2016-06-21  Anders Carlsson  <andersca@apple.com>
3435
3436         Begin moving the Apple Pay code to the open source repository
3437         https://bugs.webkit.org/show_bug.cgi?id=158998
3438
3439         Reviewed by Tim Horton.
3440
3441         * Configurations/FeatureDefines.xcconfig:
3442         Add ENABLE_APPLE_PAY.
3443
3444         * Modules/applepay/PaymentCoordinator.cpp: Added.
3445         * Modules/applepay/PaymentCoordinator.h: Added.
3446         * Modules/applepay/PaymentCoordinatorClient.h: Added.
3447         * Modules/applepay/PaymentRequest.cpp: Added.
3448         * Modules/applepay/PaymentRequest.h: Added.
3449         * Modules/applepay/cocoa/PaymentCocoa.mm: Added.
3450         * WebCore.xcodeproj/project.pbxproj:
3451         Add new files.
3452
3453         * dom/EventNames.h:
3454         Add new event names.
3455
3456         * page/MainFrame.h:
3457         Use a forward declaration.
3458
3459 2016-06-21  Said Abou-Hallawa  <sabouhallawa@apple,com>
3460