091667524382a8a9f0717348a29fe1d01184a90a
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-06-04  Zan Dobersek  <zdobersek@igalia.com>
2
3         [GCrypt] Improve comments in AES, PBKDF2, RSA-SSA algorithm implementations
4         https://bugs.webkit.org/show_bug.cgi?id=172894
5
6         Reviewed by Michael Catanzaro.
7
8         Add or improve code comments in libgcrypt implementations for the AES_CBC,
9         AES_GCM, AES_KW, PBKDF2 and RSA-SSA algorithms.
10
11         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp: Add generic comments that
12         describe each operation that's performed.
13         (WebCore::gcryptEncrypt):
14         (WebCore::gcryptDecrypt):
15         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp: Ditto.
16         (WebCore::gcryptEncrypt):
17         (WebCore::gcryptDecrypt):
18         * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp: Ditto.
19         (WebCore::gcryptWrapKey):
20         (WebCore::gcryptUnwrapKey):
21         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp: Ditto.
22         (WebCore::gcryptDeriveBits):
23         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
24         (WebCore::gcryptVerify): Align the verification results comment with the
25         one that's used in the ECDSA implementation.
26
27 2017-06-03  Chris Dumez  <cdumez@apple.com>
28
29         Implement DOMMatrix's fromFloat32Array / fromFloat64Array & toFloat32Array / toFloat64Array
30         https://bugs.webkit.org/show_bug.cgi?id=172898
31
32         Reviewed by Sam Weinig.
33
34         Implement DOMMatrix's fromFloat32Array / fromFloat64Array & toFloat32Array / toFloat64Array
35         as per:
36         - https://drafts.fxtf.org/geometry/#dommatrixreadonly
37
38         Test: http/wpt/geometry/DOMMatrix-from-to-typed-arrays.html
39
40         * css/DOMMatrix.cpp:
41         (WebCore::DOMMatrix::fromFloat32Array):
42         (WebCore::DOMMatrix::fromFloat64Array):
43         * css/DOMMatrix.h:
44         * css/DOMMatrix.idl:
45         * css/DOMMatrixReadOnly.cpp:
46         (WebCore::DOMMatrixReadOnly::fromFloat32Array):
47         (WebCore::DOMMatrixReadOnly::fromFloat64Array):
48         (WebCore::DOMMatrixReadOnly::toFloat32Array):
49         (WebCore::DOMMatrixReadOnly::toFloat64Array):
50         * css/DOMMatrixReadOnly.h:
51         * css/DOMMatrixReadOnly.idl:
52
53 2017-06-03  Simon Fraser  <simon.fraser@apple.com>
54
55         Implement DOMPointReadOnly.matrixTransform()
56         https://bugs.webkit.org/show_bug.cgi?id=172896
57
58         Reviewed by Chris Dumez.
59
60         DOMPointReadOnly.matrixTransform() creates the matrix or throws, then uses
61         a new function in TransformationMatrix to map x,y,z,w through the matrix.
62
63         Test: http/wpt/geometry/DOMPoint-003.html
64
65         * CMakeLists.txt:
66         * WebCore.xcodeproj/project.pbxproj:
67         * css/DOMMatrixReadOnly.h:
68         (WebCore::DOMMatrixReadOnly::transformationMatrix):
69         * dom/DOMPointReadOnly.cpp: Copied from Source/WebCore/dom/DOMPointReadOnly.idl.
70         (WebCore::DOMPointReadOnly::matrixTransform):
71         * dom/DOMPointReadOnly.h:
72         * dom/DOMPointReadOnly.idl:
73         * platform/graphics/transforms/TransformationMatrix.cpp:
74         (WebCore::TransformationMatrix::map4ComponentPoint):
75         * platform/graphics/transforms/TransformationMatrix.h:
76
77 2017-06-03  Myles C. Maxfield  <mmaxfield@apple.com>
78
79         Cleanup arguments to preparePlatformFont() and fontWithFamily() in FontCacheCoreText.cpp
80         https://bugs.webkit.org/show_bug.cgi?id=172886
81
82         Reviewed by Simon Fraser.
83
84         The number of arguments is getting out of control.
85
86         No new tests because there is no behavior change.
87
88         * platform/graphics/FontCache.h:
89         * platform/graphics/cocoa/FontCacheCoreText.cpp:
90         (WebCore::preparePlatformFont):
91         (WebCore::fontWithFamily):
92         (WebCore::FontCache::createFontPlatformData):
93         (WebCore::FontCache::systemFallbackForCharacters):
94         * platform/graphics/mac/FontCacheMac.mm:
95         (WebCore::platformFontWithFamilySpecialCase):
96         * platform/graphics/mac/FontCustomPlatformData.cpp:
97         (WebCore::FontCustomPlatformData::fontPlatformData):
98         * platform/spi/cocoa/CoreTextSPI.h:
99
100 2017-06-03  Yusuke Suzuki  <utatane.tea@gmail.com>
101
102         Script modules should be able to import data urls
103         https://bugs.webkit.org/show_bug.cgi?id=171594
104
105         Reviewed by Youenn Fablet.
106
107         Tests: js/dom/classic-script-with-data-url.html
108                js/dom/modules/module-script-with-data-url.html
109
110         Script tag resources should have SameOriginDataURLFlag::Set to load data URLs
111         since script tags should treat data URLs as same origin.
112
113         * bindings/js/CachedScriptFetcher.cpp:
114         (WebCore::CachedScriptFetcher::requestScriptWithCache):
115
116 2017-06-03  Simon Fraser  <simon.fraser@apple.com>
117
118         Sort the project file.
119
120         * WebCore.xcodeproj/project.pbxproj:
121
122 2017-06-03  Zan Dobersek  <zdobersek@igalia.com>
123
124         [GCrypt] Gather SUBTLE_CRYPTO utility functions in a single header
125         https://bugs.webkit.org/show_bug.cgi?id=172870
126
127         Reviewed by Jiewen Tan.
128
129         Gather the helper functions used across different source files
130         for libgcrypt-backed SUBTLE_CRYPTO implementations in a single
131         header file.
132
133         * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
134         (WebCore::hashCryptoDigestAlgorithm): Deleted.
135         (WebCore::hashAlgorithmName): Deleted.
136         (WebCore::mpiData): Deleted.
137         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
138         (WebCore::gcryptDeriveBits):
139         (WebCore::macAlgorithmForHashFunction): Deleted.
140         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
141         (WebCore::gcryptDeriveBits):
142         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
143         (WebCore::mpiData): Deleted.
144         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
145         (WebCore::hashCryptoDigestAlgorithm): Deleted.
146         (WebCore::hashAlgorithmName): Deleted.
147         (WebCore::mpiData): Deleted.
148         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
149         (WebCore::hashAlgorithmName): Deleted.
150         (WebCore::mpiData): Deleted.
151         * crypto/gcrypt/GCryptUtilities.h: Added.
152         (WebCore::hashAlgorithmName):
153         (WebCore::hmacAlgorithm):
154         (WebCore::digestAlgorithm):
155         (WebCore::hashCryptoDigestAlgorithm):
156         (WebCore::mpiData):
157
158 2017-06-03  Zan Dobersek  <zdobersek@igalia.com>
159
160         [GCrypt] Fix PK verification for ECDSA
161         https://bugs.webkit.org/show_bug.cgi?id=172857
162
163         Reviewed by Michael Catanzaro.
164
165         No new tests -- covered by existing tests.
166
167         * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
168         (WebCore::gcryptVerify): Return `true` if the verification succeeded or `false`
169         in any other case, avoiding spilling information about the exact cause of
170         verification failure.
171
172 2017-06-02  Zalan Bujtas  <zalan@apple.com>
173
174         Cleanup FrameView::autoSizeIfEnabled.
175         https://bugs.webkit.org/show_bug.cgi?id=172889
176         <rdar://problem/32550783>
177
178         Reviewed by Tim Horton.
179
180         This patch ensures that we always have a clean tree (and a valid and current document size) when
181         setting m_autoSizeContentSize. 
182
183         * page/FrameView.cpp:
184         (WebCore::FrameView::autoSizeIfEnabled):
185
186 2017-06-02  Wenson Hsieh  <wenson_hsieh@apple.com>
187
188         REGRESSION(r216212): RenderReplaced::paint() should not save and restore the context unless it has to
189         https://bugs.webkit.org/show_bug.cgi?id=172883
190         <rdar://problem/32548614>
191
192         Reviewed by Tim Horton.
193
194         After implementing dragged content fading, RenderReplace::paint is now always guarded by unnecessary calls to
195         GraphicsContext::save and GraphicsContext::restore, even when there is no dragged content being rendered. To
196         address this, we initialize our GraphicsContextStateSaver with saveAndRestore = false, indicating that we don't
197         want to immediately try and save the context.
198
199         If we are in a dragged content range, we will then call GraphicsContextStateSaver::save, which saves the
200         graphics context and also causes the GraphicsContextStateSaver to eventually try and restore() when it is
201         destroyed. Otherwise, in the common codepath where the renderer is not in a dragged content range, the
202         constructor and destructor of GraphicsContextStateSaver will be no-ops with respect to saving and restoring the
203         graphics context.
204
205         * rendering/RenderReplaced.cpp:
206         (WebCore::RenderReplaced::paint):
207
208 2017-06-02  Myles C. Maxfield  <mmaxfield@apple.com>
209
210         REGRESSION(r213464): [iOS] Fonts get too bold when the "Bold Text" accessibility setting is enabled
211         https://bugs.webkit.org/show_bug.cgi?id=172737
212
213         Reviewed by Simon Fraser.
214
215         Revert the part of r213464 which changed how we calculate the weights of system fonts.
216
217         Add an InternalSetting to trigger our mock of the accessbility "Bold Text" setting. We can't
218         use the real setting, so instead we just ask for bold fonts instead of regular fonts when this
219         setting is true.
220
221         Tests: fast/text/accessibility-bold-system-font.html
222                fast/text/accessibility-bold-system-font-2.html
223
224         * platform/graphics/FontCache.h:
225         (WebCore::FontCache::shouldMockBoldSystemFontForAccessibility):
226         (WebCore::FontCache::setShouldMockBoldSystemFontForAccessibility):
227         * platform/graphics/ios/FontCacheIOS.mm:
228         (WebCore::platformFontWithFamilySpecialCase):
229         * rendering/RenderTheme.h:
230         (WebCore::RenderTheme::shouldMockBoldSystemFontForAccessibility):
231         (WebCore::RenderTheme::setShouldMockBoldSystemFontForAccessibility):
232         * rendering/RenderThemeIOS.h:
233         * rendering/RenderThemeIOS.mm:
234         (WebCore::cssWeightOfSystemFont):
235         (WebCore::RenderThemeIOS::updateCachedSystemFontDescription):
236         * testing/InternalSettings.cpp:
237         (WebCore::InternalSettings::Backup::Backup):
238         (WebCore::InternalSettings::Backup::restoreTo):
239         (WebCore::InternalSettings::setShouldMockBoldSystemFontForAccessibility):
240         * testing/InternalSettings.h:
241         * testing/InternalSettings.idl:
242
243 2017-06-02  Brady Eidson  <beidson@apple.com>
244
245         Prevent scheme handlers from handling all built-in URL schemes.
246         <rdar://problem/32404790> and https://bugs.webkit.org/show_bug.cgi?id=172869
247
248         Reviewed by Andy Estes.
249
250         Covered by API test.
251
252         This patch refactors SchemeRegistry to keep a base, constant set of each of the special
253         URL schemes that WebKit knows about by default.
254         
255         It then exposes that list through a new method to support WK2 API.
256
257         * platform/SchemeRegistry.cpp:
258         (WebCore::allBuiltinSchemes):
259         (WebCore::builtinLocalURLSchemes):
260         (WebCore::localURLSchemes):
261         (WebCore::builtinSecureSchemes):
262         (WebCore::secureSchemes):
263         (WebCore::builtinSchemesWithUniqueOrigins):
264         (WebCore::schemesWithUniqueOrigins):
265         (WebCore::builtinEmptyDocumentSchemes):
266         (WebCore::emptyDocumentSchemes):
267         (WebCore::builtinCanDisplayOnlyIfCanRequestSchemes):
268         (WebCore::canDisplayOnlyIfCanRequestSchemes):
269         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsLocal):
270         (WebCore::builtinCORSEnabledSchemes):
271         (WebCore::CORSEnabledSchemes):
272         (WebCore::SchemeRegistry::isBuiltinScheme):
273         * platform/SchemeRegistry.h:
274
275 2017-06-02  Simon Fraser  <simon.fraser@apple.com>
276
277         All scroll peformance logging should happen in the UI process
278         https://bugs.webkit.org/show_bug.cgi?id=172874
279         rdar://problem/24474830
280
281         Reviewed by Tim Horton.
282
283         Printing to stdout from the WebProcess doesn't show up anywhere in non-development builds,
284         so we have to log from the UI process.
285
286         Achieve this by adding a PerformanceLoggingClient to Page which forwards messages to
287         WebPageProxy, which prints them with the same format they had before. Some plumbing through
288         PlatformCALayerClient and GraphicsLayerClient is required to get messages from TileControllers
289         through to something that can get to Page.
290
291         * WebCore.xcodeproj/project.pbxproj:
292         * page/Page.cpp:
293         (WebCore::Page::Page):
294         (WebCore::Page::~Page):
295         * page/Page.h:
296         (WebCore::Page::performanceLoggingClient):
297         * page/PageConfiguration.cpp:
298         * page/PageConfiguration.h:
299         * page/PerformanceLoggingClient.cpp: Added.
300         (WebCore::PerformanceLoggingClient::synchronousScrollingReasonsAsString):
301         * page/PerformanceLoggingClient.h: Added.
302         (WebCore::PerformanceLoggingClient::~PerformanceLoggingClient):
303         * page/scrolling/AsyncScrollingCoordinator.cpp:
304         (WebCore::AsyncScrollingCoordinator::reportExposedUnfilledArea):
305         (WebCore::AsyncScrollingCoordinator::reportSynchronousScrollingReasonsChanged):
306         * page/scrolling/AsyncScrollingCoordinator.h:
307         * page/scrolling/ScrollingTree.h:
308         (WebCore::ScrollingTree::reportSynchronousScrollingReasonsChanged):
309         (WebCore::ScrollingTree::reportExposedUnfilledArea):
310         * page/scrolling/ThreadedScrollingTree.cpp:
311         (WebCore::ThreadedScrollingTree::reportSynchronousScrollingReasonsChanged):
312         (WebCore::ThreadedScrollingTree::reportExposedUnfilledArea):
313         * page/scrolling/ThreadedScrollingTree.h:
314         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
315         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
316         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
317         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
318         (WebCore::ScrollingTreeFrameScrollingNodeMac::exposedUnfilledArea):
319         (WebCore::ScrollingTreeFrameScrollingNodeMac::logExposedUnfilledArea): Deleted.
320         (WebCore::logThreadedScrollingMode): Deleted.
321         * platform/graphics/GraphicsLayerClient.h:
322         (WebCore::GraphicsLayerClient::logFilledVisibleFreshTile):
323         * platform/graphics/ca/GraphicsLayerCA.cpp:
324         (WebCore::GraphicsLayerCA::platformCALayerLogFilledVisibleFreshTile):
325         * platform/graphics/ca/GraphicsLayerCA.h:
326         * platform/graphics/ca/PlatformCALayerClient.h:
327         (WebCore::PlatformCALayerClient::platformCALayerLogFilledVisibleFreshTile):
328         * platform/graphics/ca/TileController.cpp:
329         (WebCore::TileController::logFilledVisibleFreshTile):
330         * platform/graphics/ca/TileController.h:
331         * platform/graphics/ca/TileGrid.cpp:
332         (WebCore::TileGrid::platformCALayerPaintContents):
333         * platform/graphics/ca/TileGrid.h:
334         * rendering/RenderLayerBacking.cpp:
335         (WebCore::RenderLayerBacking::logFilledVisibleFreshTile):
336         * rendering/RenderLayerBacking.h:
337
338 2017-06-02  Eric Carlson  <eric.carlson@apple.com>
339
340         [MediaStream iOS] Cleanup video muting/unmuting when tab visibility changes
341         https://bugs.webkit.org/show_bug.cgi?id=172858
342
343         Reviewed by Youenn Fablet.
344
345         Test: platform/ios/mediastream/video-muted-in-background-tab.html
346
347         * dom/Document.cpp:
348         (WebCore::Document::visibilityStateChanged): Call notifyMediaCaptureOfVisibilityChanged.
349         (WebCore::Document::notifyMediaCaptureOfVisibilityChanged): Renamed from notifyVisibilityChangedToMediaCapture.
350         Set m_videoCaptureMutedForVisibilityChange when capture is muted because the document is hidden,
351         and clear it when visibility changes when capture is disabled. Don't unmute when the document
352         becomes visible unless this m_videoCaptureMutedForVisibilityChange is still true.
353         (WebCore::Document::notifyVisibilityChangedToMediaCapture): Deleted.
354         * dom/Document.h:
355
356         * platform/mediastream/RealtimeMediaSource.h:
357         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
358         (WebCore::RealtimeMediaSourceCenter::setVideoCaptureMutedForPageVisibility): Renamed from
359         setVisibility.
360         (WebCore::RealtimeMediaSourceCenter::setVisibility): Deleted.
361         * platform/mediastream/RealtimeMediaSourceCenter.h:
362
363         * platform/mediastream/mac/AVVideoCaptureSource.mm:
364         (WebCore::AVVideoCaptureSourceFactory::setVideoCaptureMutedForPageVisibility): Ditto.
365         (WebCore::AVVideoCaptureSourceFactory::setVisibility): Deleted.
366
367         * platform/mock/MockRealtimeVideoSource.cpp:
368         (WebCore::MockRealtimeVideoSourceFactory::setVideoCaptureMutedForPageVisibility): Ditto.
369         (WebCore::MockRealtimeVideoSourceFactory::setVisibility): Deleted.
370
371 2017-06-02  Frederic Wang  <fwang@igalia.com>
372
373         [Mac] Include frames in the scrolling tree when ScrollingTreeIncludesFrames=true
374         https://bugs.webkit.org/show_bug.cgi?id=172825
375
376         Reviewed by Simon Fraser.
377
378         This commit generalizes RenderLayerCompositor/ScrollingCoordinator so that it handles the
379         case of non-main frames. When ScrollingTreeIncludesFrames=true, all the frames will appear
380         in the scrolling tree on Mac WK2.
381
382         Test: fast/scrolling/scrolling-tree-includes-frame.html
383
384         * page/scrolling/ScrollingCoordinator.cpp:
385         (WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView): Do not to restrict to the
386         main frame.
387         * rendering/RenderLayerCompositor.cpp:
388         (WebCore::RenderLayerCompositor::updateBacking): Do not to restrict to the main frame.
389         (WebCore::RenderLayerCompositor::useCoordinatedScrollingForLayer): Make this function a class
390         member so it can call hasCoordinatedScrolling and no longer needs a RenderView parameter.
391         (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus): Do not to restrict to the
392         main frame.
393         * rendering/RenderLayerCompositor.h: Introduce useCoordinatedScrollingForLayer.
394
395 2017-06-02  Don Olmstead  <don.olmstead@am.sony.com>
396
397         [WebCore] DragImageRef should correspond to USE(CAIRO)
398         https://bugs.webkit.org/show_bug.cgi?id=172863
399
400         Reviewed by Carlos Alberto Lopez Perez.
401
402         No new tests. No change in behavior.
403
404         * platform/DragImage.h:
405
406 2017-06-02  Frederic Wang  <fwang@igalia.com>
407
408         [Mac] Use compositing for frames when ScrollingTreeIncludesFrames=true
409         https://bugs.webkit.org/show_bug.cgi?id=172851
410
411         Reviewed by Simon Fraser.
412
413         When fast frame scrolling is supported on mac (bug 171667), scrollable frames will require
414         special composited layer. This commit enables that on mac but only when
415         ScrollingTreeIncludesFrames=true, so that the default behavior is unchanged.
416
417         Test: compositing/iframes/compositing-for-scrollable-iframe.html
418
419         * rendering/RenderLayerCompositor.cpp:
420         (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame): Do not enable frame
421         compositing when ScrollingTreeIncludesFrames=false.
422         Rename ScrollableInnerFrameTrigger to ScrollableNonMainFrameTrigger.
423         * page/ChromeClient.h: Rename ScrollableInnerFrameTrigger.
424
425 2017-06-02  Simon Fraser  <simon.fraser@apple.com>
426
427         Get <chrono> out of StdLibExtras.h
428         https://bugs.webkit.org/show_bug.cgi?id=172744
429
430         Reviewed by Zalan Bujtas.
431
432         Only bring in <chrono> and namespace std::literals::chrono_literals when necessary.
433
434         * fileapi/FileReader.cpp:
435         * inspector/InspectorOverlay.cpp:
436         * loader/CrossOriginPreflightResultCache.cpp:
437         * loader/cache/CachedResource.cpp:
438         (WebCore::CachedResource::freshnessLifetime):
439         * page/ResourceUsageThread.cpp:
440         (WebCore::ResourceUsageThread::threadBody):
441         * page/cocoa/MemoryReleaseCocoa.mm:
442         (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
443         * platform/network/CacheValidation.cpp:
444         (WebCore::computeFreshnessLifetimeForHTTPFamily):
445         * platform/network/CacheValidation.h:
446
447 2017-06-02  Andy Estes  <aestes@apple.com>
448
449         [Cocoa] Add a "supportedCountries" property to ApplePayPaymentRequest
450         https://bugs.webkit.org/show_bug.cgi?id=172832
451         <rdar://problem/30735544>
452
453         Reviewed by Alex Christensen.
454
455         Test: http/tests/ssl/applepay/ApplePaySessionV3.html
456
457         * Modules/applepay/ApplePayPaymentRequest.h:
458         * Modules/applepay/ApplePayPaymentRequest.idl:
459         * Modules/applepay/ApplePaySession.cpp:
460         (WebCore::convertAndValidate):
461         * Modules/applepay/PaymentRequest.h:
462         (WebCore::PaymentRequest::supportedCountries):
463         (WebCore::PaymentRequest::setSupportedCountries):
464         * Modules/applepay/PaymentRequestValidator.cpp:
465         (WebCore::PaymentRequestValidator::validate):
466         * platform/spi/cocoa/PassKitSPI.h:
467
468 2017-06-02  Devin Rousso  <drousso@apple.com>
469
470         Web Inspector: Should see active Web Sockets when opening Web Inspector
471         https://bugs.webkit.org/show_bug.cgi?id=172312
472
473         Reviewed by Joseph Pecoraro.
474
475         Test: http/tests/websocket/tests/hybi/inspector/before-load.html
476
477         * Modules/websockets/WebSocket.h:
478         * Modules/websockets/WebSocket.cpp:
479         (WebCore::WebSocket::WebSocket):
480         (WebCore::WebSocket::~WebSocket):
481         (WebCore::WebSocket::allActiveWebSockets):
482         (WebCore::WebSocket::allActiveWebSocketsMutex):
483         (WebCore::WebSocket::channel):
484         (WebCore::WebSocket::eventTargetInterface):
485         Add a static set of all WebSocket objects and provide getters to access web socket metadata.
486
487         * Modules/websockets/ThreadableWebSocketChannel.h:
488         (WebCore::ThreadableWebSocketChannel::isWebSocketChannel):
489         * Modules/websockets/WebSocketChannel.h:
490         * Modules/websockets/WebSocketChannel.cpp:
491         (WebCore::WebSocketChannel::isWebSocketChannel):
492         (WebCore::WebSocketChannel::identifier):
493         (WebCore::WebSocketChannel::clientHandshakeRequest):
494         (WebCore::WebSocketChannel::serverHandshakeResponse):
495         (WebCore::WebSocketChannel::handshakeMode):
496         (WebCore::WebSocketChannel::isType):
497         Provide getters to access web socket metadata.
498
499         * inspector/InspectorNetworkAgent.cpp:
500         (WebCore::InspectorNetworkAgent::enable):
501         Loops over the static set of all WebSocket objects and sends events for each to the frontend.
502
503 2017-06-02  Chris Dumez  <cdumez@apple.com>
504
505         Unreviewed, fix linking errors on iOS after r217712.
506
507         * platform/OrientationNotifer.h:
508         (WebCore::OrientationNotifier::Observer::setNotifier):
509
510 2017-06-02  Chris Dumez  <cdumez@apple.com>
511
512         Crash under OrientationNotifier::Observer::setNotifier()
513         https://bugs.webkit.org/show_bug.cgi?id=172847
514         <rdar://problem/32519127>
515
516         Reviewed by Youenn Fablet.
517
518         Update OrientationNotifier::Observer::setNotifier() to unregister itself from
519         its current notifier if it already has one. This is needed because
520         Internals::setCameraMediaStreamTrackOrientation() may be used to override the
521         notifier of an observer. If we override the notifier without unregistering
522         the observer from its previous notifier, then the previous notifier will not
523         get notified when the observer gets destroyed.
524
525         No new tests, already covered by webrtc/video-rotation.html that is currently
526         failing on some bots.
527
528         * platform/OrientationNotifer.h:
529         (WebCore::OrientationNotifier::Observer::setNotifier):
530
531 2017-06-02  Javier Fernandez  <jfernandez@igalia.com>
532
533         [css-grid] Logical margin incorrectly applied during the tracks sizing algorithm of auto tracks
534         https://bugs.webkit.org/show_bug.cgi?id=172836
535
536         Reviewed by Manuel Rego Casasnovas.
537
538         When computing min-content and max-content of the content-sized tracks
539         we are using the marginIntrinsicLogicalWidthForChild function, which
540         uses the grid's writing-mode to determine wether to use the child's
541         margin width or height. This is not correct when the grid item is
542         orthogonal.
543
544         This patch changes how we compute the tracks width so we use always
545         the item's marginLogicalWidth, which depends only on its own writing
546         mode.
547
548         Test: fast/css-grid-layout/grid-track-sizing-with-margins-and-orthogonal-flows.html
549
550         * rendering/GridTrackSizingAlgorithm.cpp:
551         (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild):
552         (WebCore::GridTrackSizingAlgorithmStrategy::maxContentForChild):
553
554 2017-06-02  Emilio Cobos Álvarez  <ecobos@igalia.com>
555
556         Invalidate the shadow subtree style when slotted pseudo rules are present.
557         https://bugs.webkit.org/show_bug.cgi?id=172822
558
559         Reviewed by Antti Koivisto.
560
561         No new tests, this is tested by
562         fast/shadow-dom/css-scoping-slot-with-id.html, once we don't force an
563         Inherit style change for slots. I could add some more tests for stuff
564         with descendant combinators and similar I guess, though.
565
566         * style/AttributeChangeInvalidation.cpp:
567         (WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
568         * style/ClassChangeInvalidation.cpp:
569         (WebCore::Style::ClassChangeInvalidation::invalidateStyle):
570         * style/IdChangeInvalidation.cpp:
571         (WebCore::Style::IdChangeInvalidation::invalidateStyle):
572
573 2017-06-02  Miguel Gomez  <magomez@igalia.com>
574
575         [GTK+][WPE] Allow TextureMapperShaderProgram to perform colorspace conversions with the source texture pixels
576         https://bugs.webkit.org/show_bug.cgi?id=172749
577
578         Reviewed by Žan Doberšek.
579
580         Currently TextureMapperGL is only able to paint properly textures that are in RGBA format. There are
581         situations where we will want it to be able to handle other formats (for example BGRA for gstreamer-gl).
582         To make this possible without having to perform the color conversion in the CPU, we add a new color
583         conversion matrix to TextureMapperShaderProgram. This matrix will perform the color space conversion
584         in the GPU, just after sampling the source texture.
585
586         Also, add a new flag to TextureMapperGL to indicate that a color conversion is required to handle a
587         texture. This flag will be set to the TextureMapperPlatformLayerBuffers as required, and TextureMapperGL
588         will set the appropriate color space matrix to the shader. Initially only the flag for BGRA->RGBA conversion
589         is defined, but support for new transformations can be added as needed.
590
591         VideoTextureCopierGStreamer also uses the TextureMapperShaderProgram to perform texture sampling, but for
592         the moment it just sets an identity matrix because when using gstreamer-gl, the format of the video frames
593         is RGBA. This will be changed soon to use BGRA.
594
595         No new tests.
596
597         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
598         (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
599         * platform/graphics/texmap/TextureMapperGL.cpp:
600         (WebCore::colorSpaceMatrixForFlags):
601         (WebCore::TextureMapperGL::drawTexturedQuadWithProgram):
602         * platform/graphics/texmap/TextureMapperGL.h:
603         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
604         * platform/graphics/texmap/TextureMapperShaderProgram.h:
605
606 2017-06-02  Javier Fernandez  <jfernandez@igalia.com>
607
608         [css-grid] Margin wrong applied when stretching an orthogonal item in fixed size track
609         https://bugs.webkit.org/show_bug.cgi?id=172590
610
611         Reviewed by Sergio Villar Senin.
612
613         We need to consider orthogonality when using the item's logical margin to
614         compute the available space for stretching.
615
616         The issue this patch fixes is only reproducible when the grid layout logic
617         is executed several times, since probably the item doesn't need to be
618         laid out again. In such cases, we just get the cached logical margins
619         but we were not taking orthogonality into account.
620
621         Test: fast/css-grid-layout/grid-item-stretching-must-not-depend-on-previous-layouts.html
622
623         * rendering/RenderGrid.cpp:
624         (WebCore::RenderGrid::layoutBlock):
625         (WebCore::RenderGrid::marginLogicalSizeForChild):
626         (WebCore::RenderGrid::availableAlignmentSpaceForChildBeforeStretching):
627         * rendering/RenderGrid.h:
628
629 2017-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
630
631         [GTK] Cache RenderThemeGadget hierarchies for rendering themed elements with GTK+ 3.20+
632         https://bugs.webkit.org/show_bug.cgi?id=162673
633
634         Reviewed by Michael Catanzaro.
635
636         Because of the way the new theming system works in GTK+ >= 3.20 we are currently creating a gadget hierarchy
637         every time we need to render a styled element or get layout information about it. That's happening on every
638         repaint, and it's specially problematic for overlay scrollbar indicators that fade in/out when shown/hidden. We
639         need to cache the gadgets and simply apply the state before every paint or layout query. When using GtkWidgetPath,
640         calling gtk_style_context_save() breaks the gadget hierarchy, and style classes need to be set when building the
641         GtkWidgetPath. That means we can't cache RenderThemeGadgets, call save, apply style classes and state, and then
642         call restore. We need to cache gadget hierarchies with fixed style classes. Fortunately, setting the state does
643         work, so we don't need to also cache a different hierarchy for every possible state. For example, for the
644         particular case of scrollbars we would cache VerticalScrollbarRight, VerticalScrollbarLeft, HorizontalScrollbar,
645         VerticalScrollIndicatorRight, VerticalScrollIndicatorLeft and HorizontalScrollIndicator. In practice, we will
646         only have 4 of those at the same time in the cache.
647         This patch adds RenderThemeWidget to represent a hierarchy of gadgets with fixed style classes that can be
648         cached and reused to render or query style of those "widgets". It also simplifies the RenderThemeGtk and
649         ScrollbarThemeGtk code by removing a lot of duplicated code to build the gadget hierarchies.
650
651         * PlatformGTK.cmake:
652         * platform/gtk/RenderThemeGadget.cpp:
653         (WebCore::createStyleContext):
654         (WebCore::appendElementToPath):
655         (WebCore::RenderThemeGadget::state):
656         (WebCore::RenderThemeGadget::setState):
657         * platform/gtk/RenderThemeGadget.h:
658         * platform/gtk/RenderThemeWidget.cpp: Added.
659         (WebCore::widgetMap):
660         (WebCore::RenderThemeWidget::getOrCreate):
661         (WebCore::RenderThemeWidget::clearCache):
662         (WebCore::RenderThemeWidget::~RenderThemeWidget):
663         (WebCore::RenderThemeScrollbar::RenderThemeScrollbar):
664         (WebCore::RenderThemeScrollbar::stepper):
665         (WebCore::RenderThemeToggleButton::RenderThemeToggleButton):
666         (WebCore::RenderThemeButton::RenderThemeButton):
667         (WebCore::RenderThemeComboBox::RenderThemeComboBox):
668         (WebCore::RenderThemeEntry::RenderThemeEntry):
669         (WebCore::RenderThemeSearchEntry::RenderThemeSearchEntry):
670         (WebCore::RenderThemeSpinButton::RenderThemeSpinButton):
671         (WebCore::RenderThemeSlider::RenderThemeSlider):
672         (WebCore::RenderThemeProgressBar::RenderThemeProgressBar):
673         (WebCore::RenderThemeListView::RenderThemeListView):
674         (WebCore::RenderThemeIcon::RenderThemeIcon):
675         * platform/gtk/RenderThemeWidget.h: Added.
676         (WebCore::RenderThemeEntry::entry):
677         (WebCore::RenderThemeEntry::selection):
678         * platform/gtk/ScrollbarThemeGtk.cpp:
679         (WebCore::ScrollbarThemeGtk::themeChanged):
680         (WebCore::ScrollbarThemeGtk::updateThemeProperties):
681         (WebCore::widgetTypeForScrollbar):
682         (WebCore::contentsRectangle):
683         (WebCore::ScrollbarThemeGtk::trackRect):
684         (WebCore::ScrollbarThemeGtk::backButtonRect):
685         (WebCore::ScrollbarThemeGtk::forwardButtonRect):
686         (WebCore::ScrollbarThemeGtk::paint):
687         (WebCore::ScrollbarThemeGtk::scrollbarThickness):
688         (WebCore::ScrollbarThemeGtk::minimumThumbLength):
689         * rendering/RenderThemeGtk.cpp:
690         (WebCore::createStyleContext):
691         (WebCore::setToggleSize):
692         (WebCore::paintToggle):
693         (WebCore::RenderThemeGtk::paintButton):
694         (WebCore::menuListColor):
695         (WebCore::RenderThemeGtk::popupInternalPaddingBox):
696         (WebCore::RenderThemeGtk::paintMenuList):
697         (WebCore::RenderThemeGtk::adjustTextFieldStyle):
698         (WebCore::RenderThemeGtk::paintTextField):
699         (WebCore::adjustSearchFieldIconStyle):
700         (WebCore::paintSearchFieldIcon):
701         (WebCore::RenderThemeGtk::paintSliderTrack):
702         (WebCore::RenderThemeGtk::adjustSliderThumbSize):
703         (WebCore::RenderThemeGtk::paintSliderThumb):
704         (WebCore::RenderThemeGtk::progressBarRectForBounds):
705         (WebCore::RenderThemeGtk::paintProgressBar):
706         (WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle):
707         (WebCore::RenderThemeGtk::paintInnerSpinButton):
708         (WebCore::styleColor):
709         (WebCore::RenderThemeGtk::platformActiveSelectionBackgroundColor):
710         (WebCore::RenderThemeGtk::platformInactiveSelectionBackgroundColor):
711         (WebCore::RenderThemeGtk::platformActiveSelectionForegroundColor):
712         (WebCore::RenderThemeGtk::platformInactiveSelectionForegroundColor):
713         (WebCore::RenderThemeGtk::paintMediaButton):
714
715 2017-06-01  Andreas Kling  <akling@apple.com>
716
717         [Mac] Remove backing store for layers that are outside the viewport
718         https://bugs.webkit.org/show_bug.cgi?id=170082
719         <rdar://problem/31245009>
720
721         Reviewed by Simon Fraser.
722
723         Implement the backingStoreAttached flag in PlatformCALayerCocoa. This means that
724         compositing layers outside the tiling coverage rect will no longer have backing
725         stores, saving large amounts of memory.
726
727         Also added a canDetachBackingStore flag that is set to false for scroll control
728         layers, to avoid complicating coverage rect computations.
729
730         Test: compositing/backing-store-attachment-1.html
731
732         * page/Frame.h:
733         * platform/graphics/GraphicsLayer.cpp:
734         (WebCore::GraphicsLayer::GraphicsLayer):
735         (WebCore::GraphicsLayer::dumpProperties):
736         * platform/graphics/GraphicsLayer.h:
737         (WebCore::GraphicsLayer::backingStoreAttached):
738         (WebCore::GraphicsLayer::setCanDetachBackingStore):
739         (WebCore::GraphicsLayer::canDetachBackingStore):
740         * platform/graphics/GraphicsLayerClient.h:
741         * platform/graphics/ca/GraphicsLayerCA.cpp:
742         (WebCore::GraphicsLayerCA::backingStoreAttached):
743         (WebCore::GraphicsLayerCA::setNeedsDisplay):
744         (WebCore::GraphicsLayerCA::updateCoverage):
745         * platform/graphics/ca/GraphicsLayerCA.h:
746         * platform/graphics/ca/PlatformCALayer.h:
747         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
748         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
749         (PlatformCALayerCocoa::setBackingStoreAttached):
750         (PlatformCALayerCocoa::backingStoreAttached):
751         * rendering/RenderLayerBacking.cpp:
752         (WebCore::RenderLayerBacking::updateOverflowControlsLayers):
753         * rendering/RenderLayerCompositor.cpp:
754         (WebCore::RenderLayerCompositor::layerTreeAsText):
755         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
756         * testing/Internals.cpp:
757         (WebCore::toLayerTreeFlags):
758         * testing/Internals.h:
759         * testing/Internals.idl:
760
761 2017-06-01  Ryan Haddad  <ryanhaddad@apple.com>
762
763         Unreviewed, rolling out r217691.
764
765         This change broke the Windows build.
766
767         Reverted changeset:
768
769         "Web Inspector: Should see active Web Sockets when opening Web
770         Inspector"
771         https://bugs.webkit.org/show_bug.cgi?id=172312
772         http://trac.webkit.org/changeset/217691
773
774 2017-06-01  Joseph Pecoraro  <pecoraro@apple.com>
775
776         Unreviewed Windows build fix after r217691.
777
778         * Modules/websockets/WebSocketChannel.cpp:
779         (WebCore::WebSocketChannel::sendFrame):
780         * Modules/websockets/WebSocketChannel.h:
781         Disambiguate the Function being used.
782
783 2017-06-01  Youenn Fablet  <youenn@apple.com>
784
785         LibWebRTC might crash with frames having a null width or height
786         https://bugs.webkit.org/show_bug.cgi?id=172842
787         <rdar://problem/32514813>
788
789         Reviewed by Jon Lee.
790
791         Do not send black frames in case the video width or height is zero.
792         Also ensure that even if a null buffer is returned by the pool, no crash might actually happen.
793
794         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
795         (WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded):
796         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
797
798 2017-06-01  Devin Rousso  <drousso@apple.com>
799
800         Web Inspector: Should see active Web Sockets when opening Web Inspector
801         https://bugs.webkit.org/show_bug.cgi?id=172312
802
803         Reviewed by Joseph Pecoraro.
804
805         Test: http/tests/websocket/tests/hybi/inspector/before-load.html
806
807         * Modules/websockets/WebSocket.h:
808         * Modules/websockets/WebSocket.cpp:
809         (WebCore::WebSocket::WebSocket):
810         (WebCore::WebSocket::~WebSocket):
811         (WebCore::WebSocket::allActiveWebSockets):
812         (WebCore::WebSocket::allActiveWebSocketsMutex):
813         (WebCore::WebSocket::channel):
814         (WebCore::WebSocket::eventTargetInterface):
815         Add a static set of all WebSocket objects and provide getters to access web socket metadata.
816
817         * Modules/websockets/ThreadableWebSocketChannel.h:
818         (WebCore::ThreadableWebSocketChannel::isWebSocketChannel):
819         * Modules/websockets/WebSocketChannel.h:
820         * Modules/websockets/WebSocketChannel.cpp:
821         (WebCore::WebSocketChannel::isWebSocketChannel):
822         (WebCore::WebSocketChannel::identifier):
823         (WebCore::WebSocketChannel::clientHandshakeRequest):
824         (WebCore::WebSocketChannel::serverHandshakeResponse):
825         (WebCore::WebSocketChannel::handshakeMode):
826         (WebCore::WebSocketChannel::isType):
827         Provide getters to access web socket metadata.
828
829         * inspector/InspectorNetworkAgent.cpp:
830         (WebCore::InspectorNetworkAgent::enable):
831         Loops over the static set of all WebSocket objects and sends events for each to the frontend.
832
833 2017-06-01  Simon Fraser  <simon.fraser@apple.com>
834
835         REGRESSION (r217296): Dragging a video only shows controls during drag event
836         https://bugs.webkit.org/show_bug.cgi?id=172837
837         rdar://problem/32434661
838
839         Reviewed by Zalan Bujtas.
840
841         r217296 changed RenderVideo::paintReplaced() from checking paintBehavior() flags on the FrameView
842         to paintInfo.paintBehavior flags. However, RenderLayer was stripping the PaintBehaviorFlattenCompositingLayers
843         flag from the paintInfo.paintBehavior flags, so fix that.
844
845         Not easily testable.
846
847         * rendering/RenderLayer.cpp:
848         (WebCore::RenderLayer::paintLayerContents):
849
850 2017-06-01  Simon Fraser  <simon.fraser@apple.com>
851
852         Remove the redundant selectionOnly argument from RenderLayer::paintForegroundForFragments()
853         https://bugs.webkit.org/show_bug.cgi?id=172835
854
855         Reviewed by Zalan Bujtas.
856
857         The 'selectionOnly' state is already encoded in localPaintingInfo.paintBehavior so there's
858         no need to pass it separately.
859
860         * rendering/RenderLayer.cpp:
861         (WebCore::RenderLayer::paintLayerContents):
862         (WebCore::RenderLayer::paintForegroundForFragments):
863         * rendering/RenderLayer.h:
864
865 2017-06-01  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
866
867         Fix compilation errors in LocalizedStrings.cpp on platform not USE(CF) nor USE(GLIB)
868         https://bugs.webkit.org/show_bug.cgi?id=172796
869
870         Reviewed by Alex Christensen.
871
872         No new tests needed. Fixing compilation errors.
873
874         * platform/LocalizedStrings.cpp:
875         (WebCore::contextMenuItemTagLookUpInDictionary):
876         (WebCore::imageTitle):
877         (WebCore::validationMessageRangeUnderflowText):
878         (WebCore::validationMessageRangeOverflowText):
879
880 2017-06-01  Chris Dumez  <cdumez@apple.com>
881
882         Unreviewed, rolling out r217647.
883
884         No longer needed after r217682
885
886         Reverted changeset:
887
888         "Avoid iterator invalidation bug in
889         WebCore::defaultPortForProtocol"
890         https://bugs.webkit.org/show_bug.cgi?id=172786
891         http://trac.webkit.org/changeset/217647
892
893 2017-06-01  Chris Dumez  <cdumez@apple.com>
894
895         Make WebCore::defaultPortForProtocol() thread-safe
896         https://bugs.webkit.org/show_bug.cgi?id=172797
897
898         Reviewed by Brent Fulgham.
899
900         Make WebCore::defaultPortForProtocol() thread-safe since it is called from the SecurityOrigin
901         constructor and SecurityOrigin objects are constructed from various threads.
902
903         This should not regress the non-testing code paths since we only pay locking costs if
904         a default port override has been set by the tests.
905
906         * platform/URL.cpp:
907         (WebCore::defaultPortForProtocolMapLock):
908         (WebCore::defaultPortForProtocolMapForTesting):
909         (WebCore::ensureDefaultPortForProtocolMapForTesting):
910         (WebCore::registerDefaultPortForProtocolForTesting):
911         (WebCore::clearDefaultPortForProtocolMapForTesting):
912         (WebCore::defaultPortForProtocol):
913
914 2017-06-01  Andy Estes  <aestes@apple.com>
915
916         REGRESSION (r217626): ENABLE_APPLE_PAY_SESSION_V3 was disabled by mistake
917         https://bugs.webkit.org/show_bug.cgi?id=172828
918
919         Reviewed by Beth Dakin.
920
921         * Configurations/FeatureDefines.xcconfig:
922
923 2017-06-01  Frederic Wang  <fwang@igalia.com>
924
925         ScrollingCoordinator::updateSynchronousScrollingReasons should consider non-main frames
926         https://bugs.webkit.org/show_bug.cgi?id=172806
927
928         Reviewed by Simon Fraser.
929
930         Currently, the scrolling coordinator does not manage scrolling of frames other than the main
931         one (bugs 171667 and 149264) and so ScrollingCoordinator::updateSynchronousScrollingReasons
932         is only relevant for the main frame. This commit refactors a bit ScrollingCoordinator so that
933         updateSynchronousScrollingReasons is considered for all the frames whose scrolling is
934         coordinated by the ScrollingCoordinator so non-main frames will be considered in the future.
935
936         No new tests, behavior is unchanged for now.
937
938         * page/scrolling/ScrollingCoordinator.cpp:
939         (WebCore::ScrollingCoordinator::updateSynchronousScrollingReasons): Add an ASSERT to ensure
940         that this function is only called for frame whose scrolling is coordinated by this class.
941         (WebCore::ScrollingCoordinator::updateSynchronousScrollingReasonsForAllFrames): Introduce a
942         new function to update synchronous scrolling for subframes whose scrolling is coordinated by
943         this class.
944         (WebCore::ScrollingCoordinator::setForceSynchronousScrollLayerPositionUpdates): Update
945         synchronous scrolling reason for non-main frames too.
946         (WebCore::ScrollingCoordinator::replaySessionStateDidChange): Update synchronous scrolling
947         reason for non-main frames too.
948         * page/scrolling/ScrollingCoordinator.h: Define updateSynchronousScrollingReasonsForAllFrames
949
950 2017-06-01  Andy Estes  <aestes@apple.com>
951
952         [Cocoa] Upstream support for JCB as a supported payment network
953         https://bugs.webkit.org/show_bug.cgi?id=172819
954
955         Reviewed by Tim Horton.
956
957         * Modules/applepay/PaymentRequest.cpp:
958         (WebCore::PaymentRequest::isValidSupportedNetwork):
959         (WebCore::isAdditionalValidSupportedNetwork): Deleted.
960
961 2017-06-01  Chris Dumez  <cdumez@apple.com>
962
963         Unreviewed, rolling out r217660.
964
965         This should not have landed given that the new assertion is
966         hit on debug EWS bots
967
968         Reverted changeset:
969
970         "Make sure we don't access WebCore::defaultPortForProtocol
971         from non-main thread"
972         https://bugs.webkit.org/show_bug.cgi?id=172797
973         http://trac.webkit.org/changeset/217660
974
975 2017-06-01  Brent Fulgham  <bfulgham@apple.com>
976
977         Make sure we don't access WebCore::defaultPortForProtocol from non-main thread
978         https://bugs.webkit.org/show_bug.cgi?id=172797
979
980         Reviewed by Alex Christensen.
981
982         * platform/URL.cpp:
983         (WebCore::defaultPortForProtocol): Add an assertion to make sure we don't access the
984         DefaultPortForProtocolMapForTesting from multiple threads.
985
986 2017-06-01  Konstantin Tokarev  <annulen@yandex.ru>
987
988         Get rid of more HIGH_DPI_CANVAS leftovers
989         https://bugs.webkit.org/show_bug.cgi?id=172751
990
991         Reviewed by Simon Fraser.
992
993         Get rid of HTMLCanvasElement::convertLogicalToDevice() and
994         HTMLCanvasElement::convertDeviceToLogical() that are no longer needed,
995         as canvas doesn't use device scale factor anymore.
996
997         No new tests needed.
998
999         * html/HTMLCanvasElement.cpp:
1000         (WebCore::HTMLCanvasElement::createImageBuffer): Use integer width()
1001         and height() instead of floating-point temporary deviceSize variable.
1002         (WebCore::HTMLCanvasElement::baseTransform): Return unmodified
1003         baseTransform of underlying ImageBuffer.
1004         * html/HTMLCanvasElement.h: Removed declarations of unused methods.
1005
1006 2017-05-31  Brent Fulgham  <bfulgham@apple.com>
1007
1008         Avoid iterator invalidation bug in WebCore::defaultPortForProtocol
1009         https://bugs.webkit.org/show_bug.cgi?id=172786
1010         <rdar://problem/32499586>
1011
1012         Reviewed by Chris Dumez.
1013
1014         Create the SecurityOrigin objects on the main thread (rather than the worker queues)
1015         since defaultPortForProtocol is not threadsafe.
1016
1017         * loader/ResourceLoadObserver.cpp:
1018         (WebCore::ResourceLoadObserver::logFrameNavigation):
1019         (WebCore::ResourceLoadObserver::logSubresourceLoading):
1020         (WebCore::ResourceLoadObserver::logWebSocketLoading):
1021
1022 2017-05-31  Mark Lam  <mark.lam@apple.com>
1023
1024         Remove overrides of visitChildren() that do not add any functionality.
1025         https://bugs.webkit.org/show_bug.cgi?id=172789
1026         <rdar://problem/32500865>
1027
1028         Reviewed by Andreas Kling.
1029
1030         No new tests needed.  Just deleting unneeded code.
1031
1032         * bindings/js/JSDOMWindowBase.cpp:
1033         (WebCore::JSDOMWindowBase::visitChildren): Deleted.
1034         * bindings/js/JSDOMWindowBase.h:
1035
1036 2017-05-31  Don Olmstead  <don.olmstead@am.sony.com>
1037
1038         [WebCore] Update AXObjectCache::startOrEndCharacterOffsetForRange signature for !HAVE(ACCESSIBILITY)
1039         https://bugs.webkit.org/show_bug.cgi?id=172769
1040
1041         Reviewed by Yusuke Suzuki.
1042
1043         No new tests. No change in behavior.
1044
1045         * accessibility/AXObjectCache.h:
1046         (WebCore::AXObjectCache::startOrEndCharacterOffsetForRange):
1047         * platform/Curl.cmake: Added.
1048
1049 2017-05-31  Mark Lam  <mark.lam@apple.com>
1050
1051         CodeGeneratorJS's InstanceNeedsVisitChildren should not return true just because a class is / extends EventTarget.
1052         https://bugs.webkit.org/show_bug.cgi?id=172782
1053         <rdar://problem/32498266>
1054
1055         Reviewed by Chris Dumez.
1056
1057         No new tests needed.  This change is covered by existing binding tests.
1058
1059         InstanceNeedsVisitChildren should also not check the IsJSBuiltinConstructor
1060         condition, which is not used to emit any additional code in the visitChildren
1061         override.
1062
1063         The other conditions for generating visitChildren() are adequate if the class
1064         needs to override visitChildren.  Currently, we're generating some visitChildren()
1065         methods that only call its Base::visitChildren().  Removing the "is / extends
1066         EventTarget" conditions removes those unneeded visitChildren overrides.
1067
1068         * bindings/scripts/CodeGeneratorJS.pm:
1069         (InstanceNeedsVisitChildren):
1070         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
1071         (WebCore::JSTestClassWithJSBuiltinConstructor::visitChildren): Deleted.
1072         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
1073         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
1074         (WebCore::JSTestDOMJIT::visitChildren): Deleted.
1075         * bindings/scripts/test/JS/JSTestDOMJIT.h:
1076         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1077         (WebCore::JSTestEventTarget::visitChildren): Deleted.
1078         * bindings/scripts/test/JS/JSTestEventTarget.h:
1079         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1080         (WebCore::JSTestJSBuiltinConstructor::visitChildren): Deleted.
1081         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
1082         * bindings/scripts/test/JS/JSTestNode.cpp:
1083         (WebCore::JSTestNode::visitChildren): Deleted.
1084         * bindings/scripts/test/JS/JSTestNode.h:
1085
1086 2017-05-31  Chris Dumez  <cdumez@apple.com>
1087
1088         Make QualifiedName cache per thread
1089         https://bugs.webkit.org/show_bug.cgi?id=172778
1090         <rdar://problem/32490942>
1091
1092         Reviewed by Geoffrey Garen.
1093
1094         Make QualifiedName cache per thread since it is currently used from multiple threads,
1095         in an unsafe fashion. We started using QualifiedName objects in background threads
1096         after r190602 which started using a CSSSelectorParser in the ContentExtensionParser.
1097
1098         * WebCore.xcodeproj/project.pbxproj:
1099         * dom/QualifiedName.cpp:
1100         (WebCore::QualifiedName::QualifiedName):
1101         (WebCore::QualifiedName::QualifiedNameImpl::~QualifiedNameImpl):
1102         * dom/QualifiedNameCache.cpp: Added.
1103         (WebCore::QNameComponentsTranslator::hash):
1104         (WebCore::QNameComponentsTranslator::equal):
1105         (WebCore::QNameComponentsTranslator::translate):
1106         (WebCore::QualifiedNameCache::getOrCreate):
1107         (WebCore::QualifiedNameCache::remove):
1108         * dom/QualifiedNameCache.h: Added.
1109         * platform/ThreadGlobalData.cpp:
1110         (WebCore::ThreadGlobalData::ThreadGlobalData):
1111         (WebCore::ThreadGlobalData::destroy):
1112         * platform/ThreadGlobalData.h:
1113         (WebCore::ThreadGlobalData::qualifiedNameCache):
1114
1115 2017-05-31  Andy Estes  <aestes@apple.com>
1116
1117         Rename ENABLE_APPLE_PAY_DELEGATE to ENABLE_APPLE_PAY_SESSION_V3 and bump the supported version number
1118         https://bugs.webkit.org/show_bug.cgi?id=172366
1119
1120         Reviewed by Daniel Bates.
1121
1122         * Configurations/FeatureDefines.xcconfig:
1123         * Modules/applepay/ApplePayError.idl:
1124         * Modules/applepay/ApplePayPaymentAuthorizationResult.idl:
1125         * Modules/applepay/ApplePayPaymentMethodUpdate.idl:
1126         * Modules/applepay/ApplePaySession.idl:
1127         * Modules/applepay/ApplePayShippingContactUpdate.idl:
1128         * Modules/applepay/ApplePayShippingMethodUpdate.idl:
1129
1130 2017-05-31  Youenn Fablet  <youenn@apple.com>
1131
1132         PeerConnection should respect tracks that are muted at the time they are added
1133         https://bugs.webkit.org/show_bug.cgi?id=172771
1134
1135         Reviewed by Eric Carlson.
1136
1137         Tests: webrtc/peer-connection-audio-unmute.html
1138                webrtc/video-unmute.html
1139
1140         Making sure that muted/enabled state of sources are correctly handled at creation time of the outgoing webrtc sources.
1141         This should trigger silent audio and black frames.
1142
1143         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1144         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
1145         (WebCore::RealtimeOutgoingAudioSource::setSource):
1146         (WebCore::RealtimeOutgoingAudioSource::initializeConverter):
1147         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1148         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1149         (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
1150         (WebCore::RealtimeOutgoingVideoSource::setSource):
1151         (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
1152         (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
1153         (WebCore::RealtimeOutgoingVideoSource::initializeFromSource):
1154         (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink):
1155         (WebCore::RealtimeOutgoingVideoSource::RemoveSink):
1156         (WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded):
1157         (WebCore::RealtimeOutgoingVideoSource::setSizeFromSource): Deleted.
1158         (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): Deleted.
1159         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1160
1161 2017-05-31  Antti Koivisto  <antti@apple.com>
1162
1163         CrashTracer: Regression : com.apple.WebKit.WebContent at STP responsible :: com.apple.WebCore: WebCore::SharedBuffer::data const + 11
1164         https://bugs.webkit.org/show_bug.cgi?id=172747
1165         <rdar://problem/32275314>
1166
1167         Reviewed by Andreas Kling.
1168
1169         Test: http/tests/subresource-integrity/empty-stylesheet-integrity-crash.html
1170
1171         * loader/SubresourceIntegrity.cpp:
1172         (WebCore::matchIntegrityMetadata):
1173
1174             If the resource body is empty CachedResource::resourceBuffer() may be null.
1175
1176 2017-05-31  Frederic Wang  <fwang@igalia.com>
1177
1178         ScrollingStateScrollingNode::ChangedProperty::NumScrollingStateNodeBits is wrongly set
1179         https://bugs.webkit.org/show_bug.cgi?id=172349
1180
1181         Reviewed by Simon Fraser.
1182
1183         ScrollingStateScrollingNode::ChangedProperty::NumScrollingStateNodeBits was introduced in
1184         r133022 so that ScrollingStateFrameScrollingNode and ScrollingStateOverflowScrollingNode
1185         know the number of bits use for properties in their parent class.
1186
1187         In r172649, r210560, r185762 and r183702 new properties were added to
1188         ScrollingStateScrollingNode but NumScrollingStateNodeBits was not increased accordingly. This
1189         means that there are potential conflicts between these new properties and those of derived
1190         classes ScrollingStateFrameScrollingNode and ScrollingStateOverflowScrollingNode. It is not
1191         clear how to write a test case reproducing such conflict, though.
1192
1193         No new tests, this is a coding mistake but its effect is unclear.
1194
1195         * page/scrolling/ScrollingStateNode.cpp:
1196         (WebCore::ScrollingStateNode::setPropertyChanged): Use hasChangedProperty and cast to
1197         64-bits integer before shifting.
1198         * page/scrolling/ScrollingStateNode.h: Add a comment to make clear NumStateNodeBits must
1199         remain at the last position. Ensure we have enough bits available.
1200         (WebCore::ScrollingStateNode::hasChangedProperty): Cast to 64-bits integer before shifting.
1201         * page/scrolling/ScrollingStateScrollingNode.h: Fix position of NumScrollingStateNodeBits and
1202         also add a similar comment.
1203
1204 2017-05-31  Matt Lewis  <jlewis3@apple.com>
1205
1206         Unreviewed, rolling out r217603.
1207
1208         This patch broke the internal builds.
1209
1210         Reverted changeset:
1211
1212         "Get <chrono> out of StdLibExtras.h"
1213         https://bugs.webkit.org/show_bug.cgi?id=172744
1214         http://trac.webkit.org/changeset/217603
1215
1216 2017-05-31  Simon Fraser  <simon.fraser@apple.com>
1217
1218         Get <chrono> out of StdLibExtras.h
1219         https://bugs.webkit.org/show_bug.cgi?id=172744
1220
1221         Reviewed by Saam Barati.
1222
1223         Only bring in <chrono> and namespace std::literals::chrono_literals when necessary.
1224
1225         * fileapi/FileReader.cpp:
1226         * inspector/InspectorOverlay.cpp:
1227         * loader/CrossOriginPreflightResultCache.cpp:
1228         * loader/cache/CachedResource.cpp:
1229         (WebCore::CachedResource::freshnessLifetime):
1230         * page/ResourceUsageThread.cpp:
1231         (WebCore::ResourceUsageThread::threadBody):
1232         * page/cocoa/MemoryReleaseCocoa.mm:
1233         (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
1234         * platform/network/CacheValidation.cpp:
1235         (WebCore::computeFreshnessLifetimeForHTTPFamily):
1236         * platform/network/CacheValidation.h:
1237
1238 2017-05-31  Emilio Cobos Álvarez  <ecobos@igalia.com>
1239
1240         Use the rare data's RenderStyle for display: contents.
1241         https://bugs.webkit.org/show_bug.cgi?id=172721
1242
1243         Reviewed by Antti Koivisto.
1244
1245         No new tests, no behavior change.
1246
1247         * dom/Element.cpp:
1248         (WebCore::Element::hasDisplayContents):
1249         (WebCore::Element::storeDisplayContentsStyle):
1250         * dom/Element.h:
1251         * dom/ElementRareData.h:
1252         (WebCore::ElementRareData::ElementRareData):
1253         * style/RenderTreeUpdater.cpp:
1254         (WebCore::RenderTreeUpdater::updateElementRenderer):
1255         * style/StyleTreeResolver.cpp:
1256         (WebCore::Style::TreeResolver::resolveComposedTree):
1257
1258 2017-05-31  Per Arne Vollan  <pvollan@apple.com>
1259
1260         LayoutTest media/video-orientation.html is failing
1261         https://bugs.webkit.org/show_bug.cgi?id=172648
1262         <rdar://problem/31322425>
1263
1264         Reviewed by Eric Carlson.
1265
1266         For videos with rotation tag set, the transform AVAssetTrack.preferredTransform applied to
1267         AVAssetTrack.naturalSize might return a CGSize instance with negative width or height.
1268
1269         Covered by existing tests.
1270
1271         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1272         (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged):
1273
1274 2017-05-30  Frederic Wang  <fwang@igalia.com>
1275
1276         Include ScrollingTreeScrollingNode properties in ScrollingTreeFrameScrollingNode::dumpProperties
1277         https://bugs.webkit.org/show_bug.cgi?id=172287
1278
1279         Reviewed by Simon Fraser.
1280
1281         No new tests, only changes in dumped tree.
1282
1283         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1284         (WebCore::ScrollingTreeFrameScrollingNode::dumpProperties): Print properties of the parent class.
1285
1286 2017-05-30  Sam Weinig  <sam@webkit.org>
1287
1288         Update test result after r217585.
1289
1290         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
1291         (WebCore::JSTestNamedDeleterWithIndexedGetter::deleteProperty):
1292         (WebCore::JSTestNamedDeleterWithIndexedGetter::deletePropertyByIndex):
1293
1294 2017-05-30  Dan Bernstein  <mitz@apple.com>
1295
1296         Fixed the build after r217588.
1297
1298         * page/FrameView.h: Stopped exporting a function defined inline.
1299
1300 2017-05-30  Zalan Bujtas  <zalan@apple.com>
1301
1302         ASSERTION FAILED: m_layoutPhase == InPostLayerPositionsUpdatedAfterLayout || m_layoutPhase == OutsideLayout
1303         https://bugs.webkit.org/show_bug.cgi?id=171501
1304         <rdar://problem/31977453>
1305
1306         Reviewed by Simon Fraser.
1307
1308         We should be able to paint as long as the tree is clean and we are in paintable state.
1309
1310         * page/FrameView.cpp:
1311         (WebCore::FrameView::paintContents):
1312
1313 2017-05-30  Sam Weinig  <sam@webkit.org>
1314
1315         Revert accidentally checked in change.
1316
1317         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
1318         * crypto/mac/CryptoDigestAlgorithm.h:
1319
1320 2017-05-30  Sam Weinig  <sam@webkit.org>
1321
1322         [WebIDL] Generate named property deleters
1323         https://bugs.webkit.org/show_bug.cgi?id=172688
1324
1325         Reviewed by Chris Dumez.
1326
1327         Test: js/dom/named-property-deleter.html
1328
1329         * WebCore.xcodeproj/project.pbxproj:
1330         Add new file, JSDOMAbstractOperations.h
1331
1332         * bindings/js/JSDOMAbstractOperations.h: Added.
1333         (WebCore::isVisibleNamedProperty):
1334         Add an implementation of the abstract operation WebIDL calls the 'named property visibility algorithm'.
1335         It is used by many WebIDL algorithms, but currently I am only using this implementation for deleters.
1336         In the future, we should try and move the other property access generators to use it as well.
1337
1338         * bindings/js/JSDOMStringMapCustom.cpp:
1339         (WebCore::JSDOMStringMap::deleteProperty): Deleted.
1340         (WebCore::JSDOMStringMap::deletePropertyByIndex): Deleted.
1341         * bindings/js/JSStorageCustom.cpp:
1342         (WebCore::JSStorage::deleteProperty): Deleted.
1343         (WebCore::JSStorage::deletePropertyByIndex): Deleted.
1344         Remove now generated deleteProperty and deletePropertyByIndex implementations.
1345
1346         * bindings/scripts/CodeGeneratorJS.pm:
1347         (GenerateDeletePropertyCommon):
1348         (GenerateDeletePropertyDefinition):
1349         (GenerateDeletePropertyByIndexDefinition):
1350         (GenerateNamedDeleterDefinition):
1351         Added generation for named deleters. We generate both deleteProperty and deletePropertyByIndex.
1352
1353         (InstanceOverridesDelete):
1354         Add predicate for whether the header should declare deleteProperty and deletePropertyByIndex.
1355
1356         (GenerateHeader):
1357         Move property access hook declarations closer to each other. Use new InstanceOverridesDelete
1358         predicate for deleteProperty and deletePropertyByIndex.
1359  
1360         (GenerateImplementation):
1361         Add call to generate named deleter if one exists.
1362
1363         (GenerateConstructorHelperMethods):
1364         Remove an old FIXME that that was no longer true, there are no more interfaces that inherit from
1365         an interface with [NoInterfaceObject].
1366
1367         * dom/DOMStringMap.idl:
1368         Removes CustomDeleteProperty and sorts extended attributes.
1369
1370         * dom/DatasetDOMStringMap.h:
1371         * dom/DatasetDOMStringMap.cpp:
1372         (WebCore::DatasetDOMStringMap::isSupportedPropertyName):
1373         Added. This is a bindings support function (much like supportedPropertyNames()) that is
1374         used JSDOMAbstractOperations.h's isVisibleNamedProperty.
1375
1376         (WebCore::DatasetDOMStringMap::supportedPropertyNames):
1377         Convert to an early return.
1378
1379         (WebCore::DatasetDOMStringMap::deleteNamedProperty):
1380         (WebCore::DatasetDOMStringMap::deleteItem): Deleted.
1381         Renamed deleteItem to deleteNamedProperty, which is the name the bindings use for deleter
1382         operations without an identifier.
1383
1384         * page/DOMWindow.cpp:
1385         (WebCore::DOMWindow::sessionStorage):
1386         Fix incorrect indentation that bothered me.
1387
1388         * storage/Storage.cpp:
1389         * storage/Storage.h:
1390         - Remove isDisabledByPrivateBrowsing(), which had no definition.
1391         - Add isSupportedPropertyName(), which the deleter code (via the isVisibleNamedProperty algorithm)
1392           needs.
1393         
1394         * storage/Storage.idl:
1395         Removes CustomDeleteProperty, sorts the extended attributes, adds 'deleter' special 
1396         to the removeItem operation and adds a commented out 'setter' special to the 'setItem'
1397         operation.
1398
1399         * bindings/scripts/test/JS/JSTestObj.h:
1400         Update result for declarations moving around.
1401
1402         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: Added.
1403         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h: Added.
1404         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: Added.
1405         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h: Added.
1406         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: Added.
1407         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h: Added.
1408         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: Added.
1409         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h: Added.
1410         * bindings/scripts/test/TestNamedDeleterNoIdentifier.idl: Added.
1411         * bindings/scripts/test/TestNamedDeleterThrowingException.idl: Added.
1412         * bindings/scripts/test/TestNamedDeleterWithIdentifier.idl: Added.
1413         * bindings/scripts/test/TestNamedDeleterWithIndexedGetter.idl: Added.
1414         Add new tests for named deleters.
1415
1416 2017-05-30  Joseph Pecoraro  <pecoraro@apple.com>
1417
1418         Web Inspector: images dragged from Inspector to Desktop are named "Unknown.png"
1419         https://bugs.webkit.org/show_bug.cgi?id=141515
1420         <rdar://problem/9251308>
1421
1422         Reviewed by Wenson Hsieh.
1423
1424         * html/HTMLAttributeNames.in:
1425
1426 2017-05-30  Youenn Fablet  <youenn@apple.com>
1427
1428         Add support for Certificate and IceCandidatePair stats
1429         https://bugs.webkit.org/show_bug.cgi?id=172734
1430
1431         Reviewed by Geoff Garen.
1432
1433         Covered by updated test.
1434
1435         Adding support for these two stats in the IDL and in the libwebrtc binding code.
1436
1437         * Modules/mediastream/RTCStatsReport.h:
1438         (WebCore::RTCStatsReport::IceCandidatePairStats::IceCandidatePairStats):
1439         (WebCore::RTCStatsReport::CertificateStats::CertificateStats):
1440         * Modules/mediastream/RTCStatsReport.idl:
1441         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1442         (WebCore::iceCandidatePairState):
1443         (WebCore::fillRTCIceCandidatePairStats):
1444         (WebCore::fillRTCCertificateStats):
1445         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
1446
1447 2017-05-30  Jiewen Tan  <jiewen_tan@apple.com>
1448
1449         Unreviewed, add some comments to HKDF/PBKDF2 Mac implementations
1450
1451         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
1452         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
1453         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
1454         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
1455
1456 2017-05-30  Jeremy Jones  <jeremyj@apple.com>
1457
1458         m_resourceSelectionTaskQueue tasks should be cleared when player is destroyed to prevent invalid state.
1459         https://bugs.webkit.org/show_bug.cgi?id=172726
1460         rdar://problem/30867764
1461
1462         Reviewed by Eric Carlson.
1463
1464         I haven't found a reproducible way to make a test case for this race condition.
1465
1466         If m_player is cleared while there is an outstanding task in m_resourceSelectionTaskQueue,
1467         that task may assume m_player is not null and crash. It is better to cancel that task than
1468         to perform it part way with null checks.
1469
1470         * html/HTMLMediaElement.cpp:
1471         (WebCore::HTMLMediaElement::~HTMLMediaElement):
1472         (WebCore::HTMLMediaElement::clearMediaPlayer):
1473
1474 2017-05-30  Ryosuke Niwa  <rniwa@webkit.org>
1475
1476         Only include DataDetectorsUI headers in iOS
1477         https://bugs.webkit.org/show_bug.cgi?id=172633
1478
1479         Reviewed by David Kilzer.
1480
1481         Enable data detectors only on iOS and not other variants of iOS.
1482
1483         * editing/cocoa/DataDetection.h:
1484         * editing/cocoa/DataDetection.mm:
1485         * page/DragController.cpp:
1486         (WebCore::isDraggableLink):
1487         * platform/cocoa/DataDetectorsCoreSoftLink.h:
1488         * platform/cocoa/DataDetectorsCoreSoftLink.mm:
1489         * platform/spi/cocoa/DataDetectorsCoreSPI.h:
1490         * platform/spi/ios/DataDetectorsUISPI.h:
1491         * platform/spi/mac/DataDetectorsSPI.h:
1492
1493 2017-05-30  Chris Dumez  <cdumez@apple.com>
1494
1495         REGRESSION(r215946): Can't reference a table cell in Google spreadsheet
1496         https://bugs.webkit.org/show_bug.cgi?id=172703
1497         <rdar://problem/32458086>
1498
1499         Reviewed by Ryosuke Niwa.
1500
1501         We updated getClientRects() to return an array of DOMRect objects instead of
1502         a ClientRectList type, to match the latest specification. As it turns out, this
1503         is not Web-compatible as some content (as Google Spreadsheet) relies on the
1504         return type having an item() operation.
1505
1506         This patch re-introduces a DOMRectList type, with an item() operation. The
1507         DOMRectList name is currently not exposed to the Web as we do not know what's
1508         going to get specified yet (https://github.com/w3c/csswg-drafts/issues/1479).
1509
1510         No new tests, updated existing tests.
1511
1512         * CMakeLists.txt:
1513         * DerivedSources.make:
1514         * WebCore.xcodeproj/project.pbxproj:
1515         * dom/DOMRect.h:
1516         * dom/DOMRectList.cpp: Copied from Source/WebCore/dom/DOMRect.cpp.
1517         (WebCore::DOMRectList::DOMRectList):
1518         (WebCore::DOMRectList::~DOMRectList):
1519         * dom/DOMRectList.h: Copied from Source/WebCore/dom/DOMRect.cpp.
1520         (WebCore::DOMRectList::create):
1521         (WebCore::DOMRectList::length):
1522         (WebCore::DOMRectList::item):
1523         * dom/DOMRectList.idl: Renamed from Source/WebCore/dom/DOMRect.cpp.
1524         * dom/Element.cpp:
1525         (WebCore::Element::getClientRects):
1526         * dom/Element.h:
1527         * dom/Element.idl:
1528         * dom/Range.cpp:
1529         (WebCore::Range::getClientRects):
1530         * dom/Range.h:
1531         * dom/Range.idl:
1532         * page/Page.cpp:
1533         (WebCore::Page::nonFastScrollableRects):
1534         (WebCore::Page::touchEventRectsForEvent):
1535         (WebCore::Page::passiveTouchEventListenerRects):
1536         * page/Page.h:
1537         * testing/Internals.cpp:
1538         (WebCore::Internals::inspectorHighlightRects):
1539         (WebCore::Internals::touchEventRectsForEvent):
1540         (WebCore::Internals::passiveTouchEventListenerRects):
1541         (WebCore::Internals::nonFastScrollableRects):
1542         * testing/Internals.h:
1543         * testing/Internals.idl:
1544
1545 2017-05-30  Ali Juma  <ajuma@chromium.org>
1546
1547         [CredentialManagement] Incorporate IDL updates from latest spec
1548         https://bugs.webkit.org/show_bug.cgi?id=172011
1549
1550         Reviewed by Daniel Bates.
1551
1552         This patch adds IDL definitions for the CredentialsContainer, CredentialsUserData and
1553         FederatedCredentials interfaces, the NavigatorCredentials partial interface, and the
1554         CredentialCreationOptions, CredentialRequestOptions, FederatedCredentialRequestOptions,
1555         and PasswordCredentialData dictionaries. It also deletes IDL definitions for the
1556         SiteBoundCredential interface and the SiteBoundCredentialData dictionary.
1557
1558         Test: credentials/idlharness.html
1559
1560         * CMakeLists.txt:
1561         * DerivedSources.make:
1562         * Modules/credentials/BasicCredential.idl:
1563         * Modules/credentials/CredentialCreationOptions.h: Copied from Source/WebCore/Modules/credentials/PasswordCredential.cpp.
1564         * Modules/credentials/CredentialCreationOptions.idl: Copied from Source/WebCore/Modules/credentials/SiteBoundCredentialData.h.
1565         * Modules/credentials/CredentialRequestOptions.h: Copied from Source/WebCore/Modules/credentials/SiteBoundCredentialData.h.
1566         * Modules/credentials/CredentialRequestOptions.idl: Copied from Source/WebCore/Modules/credentials/SiteBoundCredentialData.h.
1567         * Modules/credentials/CredentialUserData.h: Copied from Source/WebCore/Modules/credentials/SiteBoundCredentialData.h.
1568         (WebCore::CredentialUserData::~CredentialUserData):
1569         * Modules/credentials/CredentialUserData.idl: Copied from Source/WebCore/Modules/credentials/SiteBoundCredential.idl.
1570         * Modules/credentials/CredentialsContainer.cpp: Copied from Source/WebCore/Modules/credentials/PasswordCredential.cpp.
1571         (WebCore::CredentialsContainer::get):
1572         (WebCore::CredentialsContainer::store):
1573         (WebCore::CredentialsContainer::isCreate):
1574         (WebCore::CredentialsContainer::preventSilentAccess):
1575         * Modules/credentials/CredentialsContainer.h: Copied from Source/WebCore/Modules/credentials/SiteBoundCredential.h.
1576         (WebCore::CredentialsContainer::create):
1577         (WebCore::CredentialsContainer::CredentialsContainer):
1578         * Modules/credentials/CredentialsContainer.idl: Copied from Source/WebCore/Modules/credentials/SiteBoundCredential.idl.
1579         * Modules/credentials/FederatedCredential.cpp: Copied from Source/WebCore/Modules/credentials/SiteBoundCredential.cpp.
1580         (WebCore::FederatedCredential::FederatedCredential):
1581         (WebCore::FederatedCredential::~FederatedCredential):
1582         * Modules/credentials/FederatedCredential.h: Renamed from Source/WebCore/Modules/credentials/SiteBoundCredential.h.
1583         (WebCore::FederatedCredential::create):
1584         (WebCore::FederatedCredential::provider):
1585         (WebCore::FederatedCredential::protocol):
1586         * Modules/credentials/FederatedCredential.idl: Copied from Source/WebCore/Modules/credentials/BasicCredential.idl.
1587         * Modules/credentials/FederatedCredentialInit.h: Copied from Source/WebCore/Modules/credentials/SiteBoundCredentialData.h.
1588         * Modules/credentials/FederatedCredentialInit.idl: Copied from Source/WebCore/Modules/credentials/SiteBoundCredentialData.idl.
1589         * Modules/credentials/FederatedCredentialRequestOptions.h: Copied from Source/WebCore/Modules/credentials/SiteBoundCredentialData.h.
1590         * Modules/credentials/FederatedCredentialRequestOptions.idl: Added.
1591         * Modules/credentials/NavigatorCredentials.cpp: Renamed from Source/WebCore/Modules/credentials/SiteBoundCredential.cpp.
1592         (WebCore::NavigatorCredentials::NavigatorCredentials):
1593         (WebCore::NavigatorCredentials::~NavigatorCredentials):
1594         (WebCore::NavigatorCredentials::supplementName):
1595         (WebCore::NavigatorCredentials::credentials):
1596         (WebCore::NavigatorCredentials::from):
1597         * Modules/credentials/NavigatorCredentials.h: Copied from Source/WebCore/Modules/credentials/SiteBoundCredentialData.h.
1598         * Modules/credentials/NavigatorCredentials.idl: Renamed from Source/WebCore/Modules/credentials/SiteBoundCredential.idl.
1599         * Modules/credentials/PasswordCredential.cpp:
1600         (WebCore::PasswordCredential::PasswordCredential):
1601         (WebCore::PasswordCredential::~PasswordCredential):
1602         * Modules/credentials/PasswordCredential.h:
1603         (WebCore::PasswordCredential::create):
1604         (WebCore::PasswordCredential::password):
1605         (WebCore::PasswordCredential::setIdName): Deleted.
1606         (WebCore::PasswordCredential::idName): Deleted.
1607         (WebCore::PasswordCredential::setPasswordName): Deleted.
1608         (WebCore::PasswordCredential::passwordName): Deleted.
1609         (WebCore::PasswordCredential::setAdditionalData): Deleted.
1610         (WebCore::PasswordCredential::additionalData): Deleted.
1611         * Modules/credentials/PasswordCredential.idl:
1612         * Modules/credentials/PasswordCredentialData.h: Renamed from Source/WebCore/Modules/credentials/SiteBoundCredentialData.h.
1613         * Modules/credentials/PasswordCredentialData.idl: Renamed from Source/WebCore/Modules/credentials/SiteBoundCredentialData.idl.
1614         * WebCore.xcodeproj/project.pbxproj:
1615
1616 2017-05-30  Alex Christensen  <achristensen@webkit.org>
1617
1618         Update libwebrtc configuration
1619         https://bugs.webkit.org/show_bug.cgi?id=172727
1620
1621         Reviewed by Geoffrey Garen.
1622
1623         * Configurations/FeatureDefines.xcconfig:
1624
1625 2017-05-30  Mark Lam  <mark.lam@apple.com>
1626
1627         convertEnumerationToJS() should not stash ASCIILiteral strings in NeverDestroyed arrays.
1628         https://bugs.webkit.org/show_bug.cgi?id=172724
1629         <rdar://problem/31193201>
1630
1631         Reviewed by Chris Dumez.
1632
1633         Use MAKE_STATIC_STRING_IMPL instead, which is guaranteed to be thread-safe and
1634         satisfies the promise of immortality promised by NeverDestroyed (while ASCIILiteral
1635         does not always satisfy this promise).
1636
1637         Also converted the ASSERT in convertEnumerationToJS() to a RELEASE_ASSERT as a
1638         debugging aid to check if it is ever passed an invalid enumerationValue.
1639
1640         No new tests because this is a speculative fix for an issue observed in the wild
1641         whose root cause is not known yet.  This patch also adds a release assert to
1642         gather more info about the nature of the issue.
1643
1644         * bindings/scripts/CodeGeneratorJS.pm:
1645         (GenerateEnumerationImplementationContent):
1646
1647         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
1648         (WebCore::convertEnumerationToJS):
1649         * bindings/scripts/test/JS/JSTestObj.cpp:
1650         (WebCore::convertEnumerationToJS):
1651         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
1652         (WebCore::convertEnumerationToJS):
1653         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp:
1654         (WebCore::convertEnumerationToJS):
1655         - re-baselined these test results.
1656
1657 2017-05-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
1658
1659         REGRESSION(r216882): No image decoding is needed if the BitmapImage is created with a NativeImage
1660         https://bugs.webkit.org/show_bug.cgi?id=172670
1661
1662         Reviewed by Tim Horton.
1663
1664         Test: fast/images/large-image-webkit-canvas.html
1665
1666         Check whether the BitmapImage has created an ImageDecoder before trying 
1667         to decode its image frame.
1668
1669         * platform/graphics/ImageSource.cpp:
1670         (WebCore::ImageSource::shouldUseAsyncDecoding):
1671
1672 2017-05-30  Youenn Fablet  <youenn@apple.com>
1673
1674         RealtimeOutgoingVideoSource should not rotate muted frames
1675         https://bugs.webkit.org/show_bug.cgi?id=172659
1676
1677         Reviewed by Eric Carlson.
1678
1679         Test: webrtc/video-rotation.html
1680
1681         When sending black frames, it is unnecessary to rotate frames.
1682         Instead, it is better to create frame with the expected width and height.
1683         Making sure libwebrtc rotated images are not null, as only YUV rotation is supported.
1684
1685         Adding internals API to test part of that code path.
1686         Full coverage should be added when mock source is producing YUV images.
1687
1688         * Modules/mediastream/PeerConnectionBackend.h:
1689         (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources):
1690         * Modules/mediastream/RTCPeerConnection.h:
1691         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1692         (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources):
1693         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1694         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1695         (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames):
1696         (WebCore::RealtimeOutgoingVideoSource::sendFrame):
1697         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1698         * testing/Internals.cpp:
1699         (WebCore::Internals::Internals):
1700         (WebCore::Internals::applyRotationForOutgoingVideoSources):
1701         (WebCore::Internals::setCameraMediaStreamTrackOrientation):
1702         * testing/Internals.h:
1703         * testing/Internals.idl:
1704
1705 2017-05-30  Brent Fulgham  <bfulgham@apple.com>
1706
1707         Unreviewed typo correction.
1708
1709         * loader/ResourceLoadObserver.cpp:
1710         (WebCore::ResourceLoadObserver::logFrameNavigation): I used an extra colon in my comment.
1711
1712 2017-05-30  Brent Fulgham  <bfulgham@apple.com>
1713
1714         REGRESSION(r217515): Correct iterator invalidation bug (AGAIN)
1715         https://bugs.webkit.org/show_bug.cgi?id=172722
1716         <rdar://problem/32462876>
1717
1718         Reviewed by Zalan Bujtas.
1719
1720         Over-enthusiastic clean-up during r217515 re-introduced a bug caused by holding a reference
1721         to an iterator that gets invalidated while handling the frame navigation. This patch returns
1722         to the copy/set behavior used prior to r217515. 
1723
1724         * loader/ResourceLoadObserver.cpp:
1725         (WebCore::ResourceLoadObserver::logFrameNavigation): Make a copy of the returned value, since
1726         the iterator will be invalidated during the function call. Then set the copy back in the data
1727         store with the updated counts.
1728
1729 2017-05-30  Fujii Hironori  <Hironori.Fujii@sony.com>
1730
1731         [WinCairo] TestWebKitAPI: SHOULD NEVER BE REACHED in WebCore::cairoSurfaceSize
1732         https://bugs.webkit.org/show_bug.cgi?id=172699
1733
1734         Reviewed by Brent Fulgham.
1735
1736         Tests: WebCore.BitmapImageEmptyFrameTest in TestWebKitAPI
1737
1738         * platform/graphics/cairo/CairoUtilities.cpp:
1739         (WebCore::cairoSurfaceSize): Added a case for win32 surface type.
1740
1741 2017-05-30  Miguel Gomez  <magomez@igalia.com>
1742
1743         [GTK][WPE][GSTREAMER_GL] Do not use cairo to copy video textures to an accelerated canvas
1744         https://bugs.webkit.org/show_bug.cgi?id=172542
1745
1746         Reviewed by Žan Doberšek.
1747
1748         When drawing gstreamer-gl video frames into an accelerated canvas, we are currently using cairo to copy
1749         the video textures into a new texture that will be painted into de destination canvas. While this eases
1750         the code, it doesn't allow us to control the copy process. This is a problem because in order to use
1751         gstreamer-gl properly, we will need to perform colorspace transformations during the copy. So, remove
1752         this cairo copy and use VideoTextureCopierGStreamer instead.
1753
1754         The usage of VideoTextureCopierGStreamer is pretty much the same than in the webgl case, except that
1755         no destination texture is provided. For that case, add a custom texture to hold the result that can
1756         be requested after the copy.
1757
1758         Covered by existent tests.
1759
1760         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1761         (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture):
1762         (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
1763         (WebCore::MediaPlayerPrivateGStreamerBase::prepareContextForCairoPaint): Deleted.
1764         (WebCore::MediaPlayerPrivateGStreamerBase::paintToCairoSurface): Deleted.
1765         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1766         (WebCore::MediaPlayerPrivateGStreamerBase::gstGLDisplay):
1767         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
1768         (WebCore::VideoTextureCopierGStreamer::VideoTextureCopierGStreamer):
1769         (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer):
1770         (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
1771         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h:
1772         (WebCore::VideoTextureCopierGStreamer::resultTexture):
1773
1774 2017-05-29  Antti Koivisto  <antti@apple.com>
1775
1776         Crash on display-contents-replaced-001.html
1777         https://bugs.webkit.org/show_bug.cgi?id=172596
1778
1779         Reviewed by Andreas Kling.
1780
1781         This is crashing because some code can't handle display:contents on form controls. Turns
1782         out the draft specification tell us to disable it for them in any case.
1783
1784         See https://drafts.csswg.org/css-display-3/#unbox
1785
1786         * css/StyleResolver.cpp:
1787         (WebCore::hasEffectiveDisplayNoneForDisplayContents):
1788
1789             For certain HTML elements (replaced elements, form controls) display:contents should
1790             behave like display:none.
1791             Also disable it for SVG and MathML elements.
1792
1793         (WebCore::StyleResolver::adjustRenderStyle):
1794
1795             Also compute to display:none when there is no associated element (pseudos etc).
1796
1797 2017-05-30  Zan Dobersek  <zdobersek@igalia.com>
1798
1799         [GCrypt] RSA-OAEP support
1800         https://bugs.webkit.org/show_bug.cgi?id=171222
1801
1802         Reviewed by Michael Catanzaro.
1803
1804         Add RSA-OAEP support for configurations that use libgcrypt.
1805
1806         The encryption operation embeds the plain-text data into a data s-expression,
1807         specifying OAEP as the padding method of choice and also adding information
1808         about the hash algorithm and any label data. This is then passed to the
1809         gcry_pk_encrypt() call together with the provided key, returning the enc-val
1810         s-expression containing the resulting cipher text. That's retrieved from the
1811         relevant MPI and returned to the caller.
1812
1813         The decryption operation embeds the cipher-text data into an enc-val
1814         s-expression, again specifying the hash algorithm and also filling in any
1815         label data. This is then passed, along with the key, to the gcry_pk_decrypt()
1816         call. The returned data s-expression contains the decrypted plain-text data
1817         inside the 'value' MPI, from which this data is extracted and returned to the
1818         caller.
1819
1820         No new tests -- the revelant tests are passing and are unskipped, apart from
1821         the ones using PKSC#8 and SPKI formats.
1822
1823         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
1824         (WebCore::hashAlgorithmName):
1825         (WebCore::mpiData):
1826         (WebCore::gcryptEncrypt):
1827         (WebCore::gcryptDecrypt):
1828         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
1829         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
1830
1831 2017-05-30  Zan Dobersek  <zdobersek@igalia.com>
1832
1833         Unreviewed follow-up to r217546. Address some review comments that I forgot about.
1834
1835         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
1836         (WebCore::gcryptEncrypt): Use quotations when referencing s-expression names in
1837         comments to avoid confusion.
1838         (WebCore::gcryptDecrypt): Ditto.
1839
1840 2017-05-30  Zan Dobersek  <zdobersek@igalia.com>
1841
1842         [GCrypt] RSAES-PKCS1-v1_5 support
1843         https://bugs.webkit.org/show_bug.cgi?id=171219
1844
1845         Reviewed by Michael Catanzaro.
1846
1847         Add RSAES-PKCS1-v1_5 support for configurations that use libgcrypt.
1848
1849         The encryption operation embeds the plain-text data into a data s-expression,
1850         specifying PKCS#1 as the padding method of choice. That's passed to the
1851         gcry_pk_encrypt() call together with the specified key. The returned enc-val
1852         expression contains the 'a' MPI from which the data is extracted and returned.
1853
1854         The decryption operation goes in reverse -- the cipher-text data is embedded
1855         into an enc-val s-expression that again also specifies PKCS#1 as the padding
1856         method. The s-expression is passed to gcry_pk_decrypt() together with the
1857         specified key. The returned data s-expression contains the decrypted text
1858         inside the 'value' parameter, so the data is extracted from that and returned
1859         to the caller.
1860
1861         No new tests -- the revelant tests are passing and are unskipped, apart from
1862         the ones using PKCS#8 and SPKI formats.
1863
1864         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
1865         (WebCore::mpiData):
1866         (WebCore::gcryptEncrypt):
1867         (WebCore::gcryptDecrypt):
1868         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
1869         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
1870
1871 2017-05-30  Zan Dobersek  <zdobersek@igalia.com>
1872
1873         [GCrypt] RSASSA-PKCS1-v1_5 support
1874         https://bugs.webkit.org/show_bug.cgi?id=171220
1875
1876         Reviewed by Michael Catanzaro.
1877
1878         Add RSASSA-PKSC1-V_15 support for configurations that use libgcrypt.
1879
1880         The signing operation first digests data with the specified hash algorithm.
1881         That's then embedded in the data s-expression. That's then passed to the
1882         gcry_pk_sign() call together with the specified key, returning a sig-val
1883         s-expression containing the signature. The signature data is then retrieved
1884         from the relevant MPI and returned to the caller.
1885
1886         The verification operation first digests data with the specified hash
1887         algorithm. That's then embedded in the data s-expression. A sig-val
1888         s-expression is constructed, embedding the signature data. The data and
1889         sig-val s-expressions are passed to the gcry_sexp_verify() call which returns
1890         the resulting error code. The verification succeeds if the returned value is
1891         GPG_ERR_NO_ERROR, fails if it's GPG_ERR_BAD_SIGNATURE, or errors out with an
1892         OperationError otherwise.
1893
1894         No new tests -- the revelant tests are passing and are unskipped, apart from
1895         the ones using PKCS#8 and SPKI formats.
1896
1897         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
1898         (WebCore::hashCryptoDigestAlgorithm):
1899         (WebCore::hashAlgorithmName):
1900         (WebCore::mpiData):
1901         (WebCore::gcryptSign):
1902         (WebCore::gcryptVerify):
1903         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
1904         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
1905
1906 2017-05-29  Emilio Cobos Álvarez  <ecobos@igalia.com>
1907
1908         Use the parent box style to adjust RenderStyle for alignment.
1909         https://bugs.webkit.org/show_bug.cgi?id=172215
1910
1911         Reviewed by Antti Koivisto.
1912
1913         The css-flexbox spec defined align-self in terms of the parent
1914         element, which is what this code did.
1915
1916         The css-align spec defines these properties in terms of the style of
1917         the containing box instead, which means display: contents styles
1918         should not be used for this adjustment, but the parent box style
1919         instead.
1920
1921         For example, align-items is defined as:
1922
1923         > This property specifies the default align-self for all of the boxes
1924         > (including anonymous boxes) participating in this box’s formatting
1925         > context.
1926
1927         Note that the css-align spec was recently updated to align (no pun
1928         intended) with Gecko, and make the |auto| value compute to itself.
1929         This patch puts us in a more recent spec than before, but not totally
1930         up-to-date.
1931
1932         Tests: imported/w3c/web-platform-tests/css/css-display-3/display-contents-alignment-001.html
1933                imported/w3c/web-platform-tests/css/css-display-3/display-contents-alignment-002.html
1934
1935         * css/StyleResolver.cpp:
1936         (WebCore::StyleResolver::adjustRenderStyle):
1937         (WebCore::StyleResolver::adjustStyleForAlignment):
1938
1939 2017-05-28  Dan Bernstein  <mitz@apple.com>
1940
1941         [Xcode] ALWAYS_SEARCH_USER_PATHS is set to YES
1942         https://bugs.webkit.org/show_bug.cgi?id=172691
1943
1944         Reviewed by Tim Horton.
1945
1946         * Configurations/Base.xcconfig: Set ALWAYS_SEARCH_USER_PATHS to NO.
1947         * WebCore.xcodeproj/project.pbxproj: Added DateTimeChooser.h, DateTimeChooserClient.h,
1948           PerformanceMark.h, PerformanceMeasure.h, SVGUnknownElement.h, and MathMLUnknownElement.h
1949           to the WebCore target.
1950
1951 2017-05-28  Sam Weinig  <sam@webkit.org>
1952
1953         [WebIDL] @@iterator should only be accessed once when disambiguating a union type
1954         https://bugs.webkit.org/show_bug.cgi?id=172684
1955
1956         Reviewed by Yusuke Suzuki.
1957
1958         WebIDL specifies that when determining if the value you are converting to a union
1959         is a sequence, you must get the @@iterator property and, should it exist, use it
1960         to iterate the sequence. While we correctly accessing the property to make the 
1961         determination, we were not passing it into the sequence conversion code, and thus
1962         the sequence conversion code re-accessed it, which is observable and wrong.
1963
1964         This patch pipes the @@iterator method through the sequence conversion code to avoid
1965         this.
1966
1967         Test: js/dom/sequence-in-union-iterator-access.html
1968
1969         * bindings/js/JSDOMConvertSequences.h:
1970         (WebCore::Detail::GenericSequenceConverter::convert):
1971         (WebCore::Detail::NumericSequenceConverter::convertArray):
1972         (WebCore::Detail::NumericSequenceConverter::convert):
1973         (WebCore::Detail::SequenceConverter::convertArray):
1974         (WebCore::Detail::SequenceConverter::convert):
1975         (WebCore::Detail::SequenceConverter<IDLLong>::convert):
1976         (WebCore::Detail::SequenceConverter<IDLFloat>::convert):
1977         (WebCore::Detail::SequenceConverter<IDLUnrestrictedFloat>::convert):
1978         (WebCore::Detail::SequenceConverter<IDLDouble>::convert):
1979         (WebCore::Detail::SequenceConverter<IDLUnrestrictedDouble>::convert):
1980         (WebCore::Converter<IDLSequence<T>>::convert):
1981         (WebCore::Converter<IDLFrozenArray<T>>::convert):
1982         Add variants of convert that take a JSObject* (sequence) / JSValue (iterator method)
1983         rather than just the JSValue (sequence). To avoid too much duplication, split some
1984         parts of SequenceConverter and NumericSequenceConverter up so they could be reused.
1985
1986         * bindings/js/JSDOMConvertUnion.h:
1987         - Fix incorrect step 3 (WebIDL got updated at some point and we didn't notice) to remove
1988           records.
1989         - Update sequence and FrozenArray checking/conversion to get the iterator method and pass
1990           it along, using the new ConditionalSequenceConverter helper which forwards to the new
1991           sequence converters that accept the iterator method.
1992
1993 2017-05-27  Chris Dumez  <cdumez@apple.com>
1994
1995         imported/w3c/web-platform-tests/html/semantics/forms/form-control-infrastructure/form_attribute.html is crashing
1996         https://bugs.webkit.org/show_bug.cgi?id=172472
1997         <rdar://problem/32334831>
1998
1999         Reviewed by Ryosuke Niwa.
2000
2001         Fix assertion hit when running imported/w3c/web-platform-tests/html/semantics/forms/form-control-infrastructure/form_attribute.html.
2002
2003         When the form was removed from the document, A descendant would try to find a new form owner in the document. If the descendant had 
2004         a form content attribute and there was another form in the document with this ID, then we would erroneously associate the descendant with
2005         that other form, even though that descendant is being disconnected. This is because when the form with the given id is removed, we
2006         notify the IdTargetObservers of the change. In this case, the form control is an IdTargetObserver and gets notified after
2007         removedFrom() has been called on the form but *before* removedFrom() has been called on its descendant form control. As a result, the
2008         form control still thinks it is in the tree (i.e. isConnected() wrongly returns true) and we make the wrong decision and try to
2009         associate it with another form in the document.
2010
2011         To address the problem, we leverage the fact that when a form element is being removed, it already notifies its associated form
2012         controls that it is being removed. When it does, we make sure to clear the control's id observer if the form is its ancestor.
2013         The ID observer is no longer needed beyond this point since the control is now disconnected from the document, and the ID observer
2014         callback would erroneously associate it with another form element in the document of the same ID because isConnected() still returns
2015         true at that point.
2016         As a result, the control's form owner is kept unchanged, which is the right thing to do here, since it is its ancestor, even
2017         though both are detached.
2018
2019         Test: fast/dom/HTMLFormElement/form-removal-duplicate-id-crash.html
2020
2021         * dom/ContainerNode.h:
2022         (WebCore::Node::rootNode):
2023         Inline rootNode to avoid an extra function call in the fast path case. For the slow path, we now
2024         call traverseToRootNode() to avoid duolicating logic.
2025
2026         * dom/Node.cpp:
2027         (WebCore::Node::traverseToRootNode):
2028         Add a traverseToRootNode() method which gets the root node by traversing the ancestors. This logic was duplicated in 3 places:
2029         - Slow path in Node::rootNode()
2030         - computeRootNode() in FormAssociatedElement.cpp
2031         - findRoot() in HTMLFormElement.cpp
2032         They are now consolidated in a single place to avoid duplication.
2033
2034         * dom/Node.h:
2035         * html/FormAssociatedElement.cpp:
2036         (WebCore::FormAssociatedElement::removedFrom):
2037         Just simplify the logic a bit:
2038         - Clear the id observer (i.e. m_formAttributeTargetObserver) no matter what. Since the element is no longer part of the document,
2039           it is no longer needed. We would previously have checks that would basically avoid resetting m_formAttributeTargetObserver to
2040           null if it is already null. Settign m_formAttributeTargetObserver to null is cheap so there is no reason for those checks. Those
2041           checks were also confusing because they made it look like we would sometimes keep on id observer after being removed from the
2042           document.
2043         - Use new traverseToRootNode() utility function (no behavior change)
2044         - Drop unnecessary |element| local variable
2045
2046         (WebCore::FormAssociatedElement::formOwnerRemovedFromTree):
2047         - Rename to formOwnerRemovedFromTree() to make it clear that it is the element's form owner that is removed, and not just any form.
2048         - As we traverse the tree up to find the root, also check if we find the form owner. If we do, clear the id observer since we are
2049           effectively detached from the document and return early since there is no need to reset our form owner in this case.
2050
2051         * html/FormAssociatedElement.h:
2052         * html/HTMLFormElement.cpp:
2053         (WebCore::HTMLFormElement::removedFrom):
2054         - Use new traverseToRootNode() utility function (no behavior change)
2055
2056 2017-05-27  Yusuke Suzuki  <utatane.tea@gmail.com>
2057
2058         [DOMJIT] Move DOMJIT patchpoint infrastructure out of domjit
2059         https://bugs.webkit.org/show_bug.cgi?id=172260
2060
2061         Reviewed by Filip Pizlo.
2062
2063         * ForwardingHeaders/jit/Snippet.h: Renamed from Source/WebCore/ForwardingHeaders/domjit/DOMJITPatchpoint.h.
2064         * ForwardingHeaders/jit/SnippetParams.h: Renamed from Source/WebCore/ForwardingHeaders/domjit/DOMJITPatchpointParams.h.
2065         * bindings/scripts/CodeGeneratorJS.pm:
2066         (GenerateHeader):
2067         (GenerateImplementation):
2068         * bindings/scripts/test/JS/JSTestDOMJIT.h:
2069         * domjit/DOMJITCheckDOM.h:
2070         (WebCore::DOMJIT::checkDOM):
2071         * domjit/DOMJITHelpers.h:
2072         (WebCore::DOMJIT::toWrapper):
2073         * domjit/JSDocumentDOMJIT.cpp:
2074         (WebCore::checkSubClassSnippetForJSDocument):
2075         (WebCore::DocumentDocumentElementDOMJIT::callDOMGetter):
2076         (WebCore::DocumentBodyDOMJIT::callDOMGetter):
2077         (WebCore::checkSubClassPatchpointForJSDocument): Deleted.
2078         * domjit/JSDocumentFragmentDOMJIT.cpp:
2079         (WebCore::checkSubClassSnippetForJSDocumentFragment):
2080         (WebCore::checkSubClassPatchpointForJSDocumentFragment): Deleted.
2081         * domjit/JSElementDOMJIT.cpp:
2082         (WebCore::checkSubClassSnippetForJSElement):
2083         (WebCore::checkSubClassPatchpointForJSElement): Deleted.
2084         * domjit/JSEventDOMJIT.cpp:
2085         (WebCore::checkSubClassSnippetForJSEvent):
2086         (WebCore::checkSubClassPatchpointForJSEvent): Deleted.
2087         * domjit/JSNodeDOMJIT.cpp:
2088         (WebCore::checkSubClassSnippetForJSNode):
2089         (WebCore::createCallDOMGetterForOffsetAccess):
2090         (WebCore::NodeFirstChildDOMJIT::callDOMGetter):
2091         (WebCore::NodeLastChildDOMJIT::callDOMGetter):
2092         (WebCore::NodeNextSiblingDOMJIT::callDOMGetter):
2093         (WebCore::NodePreviousSiblingDOMJIT::callDOMGetter):
2094         (WebCore::NodeParentNodeDOMJIT::callDOMGetter):
2095         (WebCore::NodeNodeTypeDOMJIT::callDOMGetter):
2096         (WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter):
2097         (WebCore::checkSubClassPatchpointForJSNode): Deleted.
2098
2099 2017-05-26  Simon Fraser  <simon.fraser@apple.com>
2100
2101         getComputedStyle returns percentage values for left / right / top / bottom
2102         https://bugs.webkit.org/show_bug.cgi?id=29084
2103
2104         Reviewed by Zalan Bujtas.
2105         
2106         Fix getComputedStyle() to return pixel values for left / right / top / bottom, per spec.
2107
2108         This is mostly a merge of https://codereview.chromium.org/13871003/.
2109
2110         Behavior now matches Chrome and Firefox.
2111
2112         Test: fast/css/getComputedStyle/getComputedStyle-offsets.html
2113
2114         * css/CSSComputedStyleDeclaration.cpp:
2115         (WebCore::getOffsetComputedLength):
2116         (WebCore::getOffsetUsedStyleRelative):
2117         (WebCore::getOffsetUsedStyleAbsolute):
2118         (WebCore::positionOffsetValue):
2119         (WebCore::positionOffsetValueIsRendererDependent):
2120         (WebCore::isNonReplacedInline):
2121         (WebCore::isLayoutDependent):
2122         (WebCore::ComputedStyleExtractor::propertyValue):
2123
2124 2017-05-27  Zalan Bujtas  <zalan@apple.com>
2125
2126         enclosingIntRect returns a rect with -1 width/height when the input FloatRect overflows integer.
2127         https://bugs.webkit.org/show_bug.cgi?id=172676
2128
2129         Reviewed by Simon Fraser.
2130
2131         Clamp integer values soon after the enclosing rectangle is resolved.
2132
2133         * platform/graphics/FloatRect.cpp:
2134         (WebCore::enclosingIntRect):
2135
2136 2017-05-26  Joseph Pecoraro  <pecoraro@apple.com>
2137
2138         Simply some NSNumber usage
2139         https://bugs.webkit.org/show_bug.cgi?id=172677
2140
2141         Reviewed by Sam Weinig.
2142
2143         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2144         (-[WebAccessibilityObjectWrapper _addAccessibilityObject:toTextMarkerArray:]):
2145         (AXAttributeStringSetFont):
2146         (AXAttributeStringSetStyle):
2147         * accessibility/mac/AXObjectCacheMac.mm:
2148         (WebCore::AXObjectCache::postTextStateChangePlatformNotification):
2149         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2150         (AXAttributeStringSetStyle):
2151         (AXAttributeStringSetSpelling):
2152         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2153         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
2154         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
2155         * rendering/RenderThemeMac.mm:
2156         (WebCore::RenderThemeMac::levelIndicatorFor):
2157
2158 2017-05-26  Youenn Fablet  <youenn@apple.com>
2159
2160         WebRTC stats should be in milliseconds
2161         https://bugs.webkit.org/show_bug.cgi?id=172644
2162
2163         Reviewed by Eric Carlson.
2164
2165         Covered by updated tests.
2166
2167         * Modules/mediastream/RTCStatsReport.h:
2168         * Modules/mediastream/RTCStatsReport.idl:
2169         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2170         (WebCore::fillRTCStats):
2171
2172 2017-05-26  Sam Weinig  <sam@webkit.org>
2173
2174         [WebIDL] Overloaded functions should throw this object check exception before argument check exception
2175         https://bugs.webkit.org/show_bug.cgi?id=172480
2176
2177         Reviewed by Chris Dumez.
2178
2179         - Codifies naming for both parts of the operation/attribute function implementation:
2180           - The 'trampoline' which is the actual host function and simply calls IDLOperation,
2181             IDLOperationReturningPromise or IDLAttribute.
2182           - The 'body' which is where argument checking and calling into the implementation
2183             takes place.
2184         - Made it so all operations, including static ones, use the trampoline / body model,
2185           simplifying code generation. The one exception is for overloaded operations, which
2186           now have a trampoline and body for the dispatcher, and only bodies for all the 
2187           overloads. This is what fixes the bug, since now that the dispatcher has a trampoline,
2188           it can do the correct this object checking via IDLOperation / IDLOperationReturningPromise.
2189         - Split out code generation for trampoline and body into separate subroutines and 
2190           simplified their implementations.
2191         - Changed GenerateOverloadDispatcher to only generate the body of the function, leaving it
2192           up to the caller to generate the signature, braces and conditionals if needed.
2193         - Made more subroutines take an output array and indent, in support of future endeavors
2194           that will need that support.
2195         - Remove unnecessary #includes of <runtime/Error.h>, which gets included already by virtue
2196           of JSDOMExceptionHandling.h
2197
2198         Test: js/dom/overloaded-operation-exception-order.html
2199
2200         * bindings/js/JSDOMOperation.h:
2201         * bindings/js/JSDOMOperationReturningPromise.h:
2202         Add no-op static versions of the bouncer functions.
2203
2204         * bindings/scripts/CodeGeneratorJS.pm:
2205         (GenerateOverloadDispatcher):
2206         (GenerateOperationTrampolineDefinition):
2207         (GenerateOperationBodyDefinition):
2208         (GenerateOperationDefinition):
2209         (GenerateSerializerDefinition):
2210         (GenerateLegacyCallerDefinitions):
2211         (GenerateLegacyCallerDefinition):
2212         (GenerateArgumentsCountCheck):
2213         (GenerateParametersCheck):
2214         (GenerateImplementationFunctionCall):
2215         (GenerateImplementationCustomFunctionCall):
2216         (GenerateConstructorDefinitions):
2217         (GenerateConstructorDefinition):
2218
2219         * bindings/scripts/test/JS/JSInterfaceName.cpp:
2220         * bindings/scripts/test/JS/JSMapLike.cpp:
2221         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
2222         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2223         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
2224         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
2225         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2226         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2227         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
2228         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2229         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2230         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2231         * bindings/scripts/test/JS/JSTestException.cpp:
2232         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2233         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2234         * bindings/scripts/test/JS/JSTestInterface.cpp:
2235         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
2236         * bindings/scripts/test/JS/JSTestIterable.cpp:
2237         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2238         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2239         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2240         * bindings/scripts/test/JS/JSTestNode.cpp:
2241         * bindings/scripts/test/JS/JSTestObj.cpp:
2242         * bindings/scripts/test/JS/JSTestObj.h:
2243         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2244         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2245         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2246         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
2247         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2248         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
2249         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
2250         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2251         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2252         Update test results.
2253
2254 2017-05-26  Brent Fulgham  <bfulgham@apple.com>
2255
2256         [WK2] Address thread safety issues with ResourceLoadStatistics
2257         https://bugs.webkit.org/show_bug.cgi?id=172519
2258         <rdar://problem/31707642>
2259
2260         Reviewed by Chris Dumez.
2261
2262         * loader/ResourceLoadObserver.cpp:
2263         (WebCore::ResourceLoadObserver::setStatisticsQueue): Added.
2264         (WebCore::ResourceLoadObserver::clearInMemoryStore): Only interact with the HashTable on the statistics queue.
2265         (WebCore::ResourceLoadObserver::clearInMemoryAndPersistentStore): Ditto.
2266         (WebCore::ResourceLoadObserver::logFrameNavigation): Ditto.
2267         (WebCore::ResourceLoadObserver::logSubresourceLoading): Ditto.
2268         (WebCore::ResourceLoadObserver::logWebSocketLoading): Ditto.
2269         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution): Ditto.
2270         (WebCore::ResourceLoadObserver::logUserInteraction): Ditto.
2271         (WebCore::ResourceLoadObserver::clearUserInteraction): Protect HashTable while reading.
2272         (WebCore::ResourceLoadObserver::hasHadUserInteraction): Ditto.
2273         (WebCore::ResourceLoadObserver::setPrevalentResource): Ditto.
2274         (WebCore::ResourceLoadObserver::isPrevalentResource): Ditto.
2275         (WebCore::ResourceLoadObserver::clearPrevalentResource): Ditto.
2276         (WebCore::ResourceLoadObserver::setGrandfathered): Ditto.
2277         (WebCore::ResourceLoadObserver::isGrandfathered): Ditto.
2278         (WebCore::ResourceLoadObserver::setSubframeUnderTopFrameOrigin): Only interact with the HashTable on the statistics queue.
2279         (WebCore::ResourceLoadObserver::setSubresourceUnderTopFrameOrigin): Ditto.
2280         (WebCore::ResourceLoadObserver::setSubresourceUniqueRedirectTo): Ditto.
2281         (WebCore::ResourceLoadObserver::fireDataModificationHandler): ASSERT this is only called from the main thread, since this is
2282         only meant to be used as part of the testing harness.
2283         (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler): Ditto.
2284         (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler): Ditto.
2285         * loader/ResourceLoadObserver.h:
2286         * loader/ResourceLoadStatisticsStore.cpp:
2287         (WebCore::ResourceLoadStatisticsStore::isPrevalentResource): Protect HashTable while using it.
2288         (WebCore::ResourceLoadStatisticsStore::ensureResourceStatisticsForPrimaryDomain): Ditto.
2289         (WebCore::ResourceLoadStatisticsStore::setResourceStatisticsForPrimaryDomain): Ditto.
2290         (WebCore::ResourceLoadStatisticsStore::createEncoderFromData): ASSERT this isn't being done on the main thread, and
2291         protect HashTable while using it.
2292         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder): Ditto.
2293         (WebCore::ResourceLoadStatisticsStore::clearInMemory): Ditto.
2294         (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent): Ditto.
2295         (WebCore::ResourceLoadStatisticsStore::statisticsForOrigin): Protect HashTable while using it.
2296         (WebCore::ResourceLoadStatisticsStore::takeStatistics): Ditto.
2297         (WebCore::ResourceLoadStatisticsStore::mergeStatistics): Ditto.
2298         (WebCore::ResourceLoadStatisticsStore::setNotificationCallback): Use WTF::Function.
2299         (WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback): Ditto.
2300         (WebCore::ResourceLoadStatisticsStore::setWritePersistentStoreCallback): Ditto.
2301         (WebCore::ResourceLoadStatisticsStore::setGrandfatherExistingWebsiteDataCallback): Ditto.
2302         (WebCore::ResourceLoadStatisticsStore::fireDataModificationHandler): ASSERT this is not called on the main thread,
2303         but dispatch the registered handler on the main thread.
2304         (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler): Ditto.
2305         (WebCore::ResourceLoadStatisticsStore::processStatistics): ASSERT this isn't being done on the main thread, and
2306         protect the HashTable while using it. Also switch to WTF::Function.
2307         (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction): Make const correct.
2308         (WebCore::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor): Protect HashTable while using it.
2309         (WebCore::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords): Ditto.
2310         (WebCore::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore): Ditto.
2311         (WebCore::ResourceLoadStatisticsStore::shouldRemoveDataRecords): Make const correct. ASSERT this is not being called
2312         on the main thread.
2313         (WebCore::ResourceLoadStatisticsStore::dataRecordsBeingRemoved): ASSERT this is not being called on the main thread.
2314         (WebCore::ResourceLoadStatisticsStore::dataRecordsWereRemoved): Ditto.
2315         (WebCore::ResourceLoadStatisticsStore::statisticsLock): Added.
2316         * loader/ResourceLoadStatisticsStore.h:
2317
2318 2017-05-26  Joseph Pecoraro  <pecoraro@apple.com>
2319
2320         JSContext Inspector: Improve the reliability of automatically pausing in auto-attach
2321         https://bugs.webkit.org/show_bug.cgi?id=172664
2322         <rdar://problem/32362933>
2323
2324         Reviewed by Matt Baker.
2325
2326         * inspector/InspectorController.h:
2327         * page/PageDebuggable.cpp:
2328         (WebCore::PageDebuggable::connect):
2329         * page/PageDebuggable.h:
2330         Pass an immediatelyPause boolean on to the controller.
2331
2332         * inspector/InspectorController.cpp:
2333         (WebCore::InspectorController::connectFrontend):
2334         (WebCore::InspectorController::disconnectFrontend):
2335         (WebCore::InspectorController::disconnectAllFrontends):
2336         Manage should immediately pause state.
2337
2338         (WebCore::InspectorController::frontendInitialized):
2339         When initialized, trigger a pause if requested.
2340
2341 2017-05-26  Don Olmstead  <don.olmstead@am.sony.com>
2342
2343         [CMake] Consolidate CMake code related to FreeType
2344         https://bugs.webkit.org/show_bug.cgi?id=172656
2345
2346         Reviewed by Michael Catanzaro.
2347
2348         No new tests. No change in behavior.
2349
2350         * PlatformGTK.cmake:
2351         * PlatformWPE.cmake:
2352         * platform/FreeType.cmake: Added.
2353
2354 2017-05-26  Sam Weinig  <sam@webkit.org>
2355
2356         [WebIDL] Another bindings cleanup pass, this time focusing on attributes
2357         https://bugs.webkit.org/show_bug.cgi?id=172619
2358
2359         Reviewed by Chris Dumez.
2360
2361         - Moved attribute getter / setter generation into their own subroutines.
2362         - As was done for operations, moved trampoline functions for attributes
2363           below their implementation functions to avoid unseemly forward declaration.
2364         - Changed to place the getter and setter for an attribute next to each other,
2365           rather than having all the getters and then all the setters.
2366         - Moved JSFoo::getConstructor and JSFoo::getNamedConstructor up to be with other
2367           member functions.
2368         - Fix an issue where we were generating a setJSFooConstructor function and not
2369           installing it anywhere. Now we always generate either both the getter and setter
2370           or neither for the constructor property. Also moved their definition to just above
2371           all the attributes, rather than the odd placements of between the getters and
2372           setters which is where they had been.
2373         - Made InstanceNeedsVisitChildren a complete answer, rather than relying on some
2374           loop of the attributes to update needsVisitChildren bit.
2375         - Move use of passing conditionals when adding headers.
2376
2377         * bindings/scripts/CodeGeneratorJS.pm:
2378         (InstanceNeedsVisitChildren):
2379         (GenerateHeader):
2380         (GenerateImplementation):
2381         (GenerateAttributeGetterDefinition):
2382         (GenerateAttributeSetterDefinition):
2383         (NeedsConstructorProperty):
2384
2385         * bindings/scripts/test/JS/JSInterfaceName.cpp:
2386         * bindings/scripts/test/JS/JSMapLike.cpp:
2387         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
2388         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2389         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
2390         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
2391         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2392         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2393         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
2394         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2395         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2396         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2397         * bindings/scripts/test/JS/JSTestException.cpp:
2398         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2399         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2400         * bindings/scripts/test/JS/JSTestInterface.cpp:
2401         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
2402         * bindings/scripts/test/JS/JSTestIterable.cpp:
2403         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2404         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2405         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2406         * bindings/scripts/test/JS/JSTestNode.cpp:
2407         * bindings/scripts/test/JS/JSTestObj.cpp:
2408         * bindings/scripts/test/JS/JSTestObj.h:
2409         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2410         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2411         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2412         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
2413         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2414         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
2415         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
2416         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2417         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2418         Update test results.
2419
2420 2017-05-26  Don Olmstead  <don.olmstead@am.sony.com>
2421
2422         [CMake] Wrap CODE_GENERATOR_PREPROCESSOR_EXECUTABLE on Windows hosts
2423         https://bugs.webkit.org/show_bug.cgi?id=172553
2424
2425         Reviewed by Brent Fulgham.
2426
2427         No new tests. No change in behavior.
2428
2429         * bindings/scripts/preprocessor.pm:
2430         (applyPreprocessor): Use shellwords() instead of splitting
2431         preprocessor command by space. Combine it back in open3() call on
2432         Windows to work around Cygwin-specific issue.
2433
2434 2017-05-26  Wenson Hsieh  <wenson_hsieh@apple.com>
2435
2436         Unreviewed, fix the build using the latest SDK
2437
2438         Add deprecation guards around newly introduced (and deprecated) SPI.
2439
2440         * platform/ios/WebItemProviderPasteboard.mm:
2441         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]):
2442
2443 2017-05-26  Beth Dakin  <bdakin@apple.com>
2444
2445         Media documents inside iframes should not get controls in the TouchBar unless the 
2446         video is playing
2447         https://bugs.webkit.org/show_bug.cgi?id=172620
2448         -and corresponding-
2449         rdar://problem/32165477
2450
2451         Reviewed by Jon Lee.
2452
2453         Media documents get to return early with true, but that should only apply to 
2454         mainframe media documents. 
2455         * html/MediaElementSession.cpp:
2456         (WebCore::MediaElementSession::canShowControlsManager):
2457
2458 2017-05-26  Youenn Fablet  <youenn@apple.com>
2459
2460         Minor clean-up related to DocumentThreadableLoader redirections
2461         https://bugs.webkit.org/show_bug.cgi?id=172647
2462
2463         Reviewed by Chris Dumez.
2464
2465         No change of behavior.
2466
2467         Decrementing m_options redirect count directly instead of using an
2468         additional counter.
2469
2470         To compare whether two URLs are same-origin, use scheme+host+port check
2471         as per the spec.
2472         This is fine as only the initial origin may have specific rules and we
2473         are using the scheme+host+port checks when already being gone to
2474         another origin.
2475
2476         * loader/DocumentThreadableLoader.cpp:
2477         (WebCore::DocumentThreadableLoader::redirectReceived):
2478         * loader/DocumentThreadableLoader.h:
2479         * loader/SubresourceLoader.cpp:
2480         (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
2481
2482 2017-05-26  Youenn Fablet  <youenn@apple.com>
2483
2484         Fix memory leaks in MediaSampleAVFObjC::create
2485         https://bugs.webkit.org/show_bug.cgi?id=172600
2486
2487         Reviewed by Eric Carlson.
2488
2489         No change of behavior.
2490
2491         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
2492         (WebCore::MediaSampleAVFObjC::createImageSample):
2493
2494 2017-05-26  Manuel Rego Casasnovas  <rego@igalia.com>
2495
2496         [css-grid] Add support for orthogonal positioned grid items
2497         https://bugs.webkit.org/show_bug.cgi?id=172591
2498
2499         Reviewed by Sergio Villar Senin.
2500
2501         This patch adds support for positioned grid items with orthogonal flows.
2502         Basically it just needs to check if the item is orthogonal to use
2503         the column or row offset as logical left or top depending on the case.
2504
2505         Tests: imported/w3c/web-platform-tests/css/css-grid-1/abspos/orthogonal-positioned-grid-items-***.html
2506
2507         * rendering/RenderGrid.cpp:
2508         (WebCore::RenderGrid::layoutPositionedObject):
2509
2510 2017-05-25  Emilio Cobos Álvarez  <ecobos@igalia.com>
2511
2512         Don't reset m_hasDisplayContents on ElementRareData::resetComputedStyle.
2513         https://bugs.webkit.org/show_bug.cgi?id=172503
2514
2515         Reviewed by Antti Koivisto.
2516
2517         We use that bit of information to determine whether we need to tear
2518         down the renderers of a display: contents subtree, so better for it to
2519         not change until the render tree is updated.
2520
2521         In practice, we may want to remove that bit and use ElementRareData's
2522         RenderStyle instead (keeping it around as appropriate), to ensure they
2523         don't go out of sync, but that's out of scope of this patch for now.
2524
2525         Tests: imported/w3c/web-platform-tests/css/css-display-3
2526
2527         * dom/ElementRareData.h:
2528         (WebCore::ElementRareData::resetComputedStyle):
2529
2530 2017-05-25  Sam Weinig  <sam@webkit.org>
2531
2532         Fix MediaDeviceInfo's extended attributes so they make sense
2533         https://bugs.webkit.org/show_bug.cgi?id=172629
2534
2535         Reviewed by Daniel Bates.
2536
2537         MediaDeviceInfo.idl had both a Constructor and NoInterfaceObject, which
2538         doesn't really make sense. Either way, the spec says it should have 
2539         neither, so remove both. And, while were there, add missing serializer.
2540
2541         Test: fast/mediastream/media-device-info.html
2542
2543         * Modules/mediastream/MediaDeviceInfo.idl:
2544
2545 2017-05-25  Chris Dumez  <cdumez@apple.com>
2546
2547         imported/w3c/web-platform-tests/html/semantics/forms/form-control-infrastructure/form_owner_and_table_2.html is crashing
2548         https://bugs.webkit.org/show_bug.cgi?id=172628
2549         <rdar://problem/32418707>
2550
2551         Reviewed by Sam Weinig.
2552
2553         In the event where a form is removed synchronously by a script during parsing,
2554         FormAssociatedElement::m_formSetByParser may end up referring to a form that
2555         is no longer in the document. As a result, we should make sure m_formSetByParser
2556         is still connected in FormAssociatedElement::insertedInto() before we call
2557         FormAssociatedElement::setForm(m_formSetByParser).
2558
2559         Test: fast/dom/HTMLFormElement/form-removed-during-parsing-crash.html
2560
2561         * html/FormAssociatedElement.cpp:
2562         (WebCore::FormAssociatedElement::insertedInto):
2563
2564 2017-05-25  Zalan Bujtas  <zalan@apple.com>
2565
2566         Frame's composited content is visible when the frame has visibility: hidden.
2567         https://bugs.webkit.org/show_bug.cgi?id=125565
2568         <rdar://problem/32196849>
2569
2570         Reviewed by Simon Fraser.
2571
2572         Do not construct composited layers for hidden RenderWidgets (frameset, iframe, object).
2573         Note that we still construct layers for the associated renderers as usual. 
2574
2575         Tests: compositing/visibility/frameset-visibility-hidden.html
2576                compositing/visibility/iframe-visibility-hidden.html
2577                compositing/visibility/object-visibility-hidden.html
2578
2579         * rendering/RenderLayerCompositor.cpp:
2580         (WebCore::RenderLayerCompositor::requiresCompositingForPlugin):
2581         (WebCore::RenderLayerCompositor::requiresCompositingForFrame):
2582
2583 2017-05-25  Yusuke Suzuki  <utatane.tea@gmail.com>
2584
2585         Unreviewed, build fix in GTK and WPE ports
2586         https://bugs.webkit.org/show_bug.cgi?id=172580
2587
2588         Missing RenderSVGResourceMode declaration in SVGInlineTextBox.h.
2589
2590         * rendering/svg/SVGInlineTextBox.h:
2591
2592 2017-05-25  Simon Fraser  <simon.fraser@apple.com>
2593
2594         Use a typedef for SVG resource mode flags union
2595         https://bugs.webkit.org/show_bug.cgi?id=172580
2596
2597         Reviewed by Sam Weinig.
2598
2599         Use an OptionSet<> for RenderSVGResourceModes flags, and use it in render
2600         SVG resource classes.
2601
2602         * rendering/svg/RenderSVGResource.cpp:
2603         (WebCore::requestPaintingResource):
2604         (WebCore::RenderSVGResource::fillPaintingResource):
2605         (WebCore::RenderSVGResource::strokePaintingResource):
2606         * rendering/svg/RenderSVGResource.h:
2607         (WebCore::RenderSVGResource::postApplyResource):
2608         * rendering/svg/RenderSVGResourceClipper.cpp:
2609         (WebCore::RenderSVGResourceClipper::applyResource):
2610         * rendering/svg/RenderSVGResourceClipper.h:
2611         * rendering/svg/RenderSVGResourceFilter.cpp:
2612         (WebCore::RenderSVGResourceFilter::applyResource):
2613         (WebCore::RenderSVGResourceFilter::postApplyResource):
2614         * rendering/svg/RenderSVGResourceFilter.h:
2615         * rendering/svg/RenderSVGResourceGradient.cpp:
2616         (WebCore::RenderSVGResourceGradient::applyResource):
2617         * rendering/svg/RenderSVGResourceGradient.h:
2618         * rendering/svg/RenderSVGResourceMarker.h:
2619         * rendering/svg/RenderSVGResourceMasker.cpp:
2620         (WebCore::RenderSVGResourceMasker::applyResource):
2621         * rendering/svg/RenderSVGResourceMasker.h:
2622         * rendering/svg/RenderSVGResourcePattern.cpp:
2623         (WebCore::RenderSVGResourcePattern::buildPattern):
2624         (WebCore::RenderSVGResourcePattern::applyResource):
2625         (WebCore::RenderSVGResourcePattern::postApplyResource):
2626         * rendering/svg/RenderSVGResourcePattern.h:
2627         * rendering/svg/RenderSVGResourceSolidColor.cpp:
2628         (WebCore::RenderSVGResourceSolidColor::applyResource):
2629         (WebCore::RenderSVGResourceSolidColor::postApplyResource):
2630         * rendering/svg/RenderSVGResourceSolidColor.h:
2631         * rendering/svg/RenderSVGShape.cpp:
2632         (WebCore::RenderSVGShape::fillShape):
2633         (WebCore::RenderSVGShape::strokeShape):
2634         * rendering/svg/SVGInlineTextBox.cpp:
2635         (WebCore::SVGInlineTextBox::SVGInlineTextBox):
2636         (WebCore::SVGInlineTextBox::paintSelectionBackground):
2637         (WebCore::SVGInlineTextBox::paint):
2638         (WebCore::SVGInlineTextBox::acquirePaintingResource):
2639         (WebCore::SVGInlineTextBox::releasePaintingResource):
2640         (WebCore::SVGInlineTextBox::paintDecoration):
2641         (WebCore::SVGInlineTextBox::paintDecorationWithStyle):
2642         * rendering/svg/SVGInlineTextBox.h:
2643         * rendering/svg/SVGRenderingContext.cpp:
2644         (WebCore::SVGRenderingContext::~SVGRenderingContext):
2645         (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
2646         (WebCore::SVGRenderingContext::renderSubtreeToImageBuffer): Avoid needless IntPoint -> LayoutPoint
2647         conversion.
2648
2649 2017-05-25  Chris Dumez  <cdumez@apple.com>
2650
2651         Regression(r215686): Videos sometimes do not load in iBooks
2652         https://bugs.webkit.org/show_bug.cgi?id=172604
2653         <rdar://problem/32003717>
2654
2655         Reviewed by Geoffrey Garen.
2656
2657         Before r215686, the loop would have a check at the beginning to check if the
2658         dataRequest's currentOffset was greater than the buffer length and would
2659         cause the function to return early.
2660
2661         This check was dropped in r215686, which caused us in some cases to call
2662         finishLoading / stopLoading() after the loop, even though we did not have
2663         enough data in the buffer to satisfy the data request.
2664
2665         To address the issue, we now return early after the loop if remainingLength
2666         is greater than 0, meaning that we could not satisfy the request. This makes
2667         sure we do not call finishLoading / stopLoading() prematurely.
2668
2669         Note that before r215686, the condition of the while loop was 
2670         "while (remainingLength)" so the only way to get out of the loop was to:
2671         1. Get remainingLength to 0, in which case we would fall through and
2672            potentially call finishLoading / stopLoading() after the loop.
2673         2. Fail the "(data->size() <= [dataRequest currentOffset] - responseOffset)"
2674            check at the beginning of the loop, meaning that we ran out of data in
2675            the buffer. This would cause us to return from the function, not fall
2676            through, so we would not call finishLoading / stopLoading().
2677
2678         No new tests, I do not know how to write a test for this.
2679
2680         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2681         (WebCore::WebCoreAVFResourceLoader::fulfillRequestWithResource):
2682
2683 2017-05-25  Sam Weinig  <sam@webkit.org>
2684
2685         [WebIDL] Use the term 'operation' more consistently
2686         https://bugs.webkit.org/show_bug.cgi?id=172601
2687
2688         Reviewed by Chris Dumez.
2689
2690         We were using the term 'operation', a WebIDL term for function-like
2691         constructs, inconsistently in the code generator. Now, when we use
2692         'operation' when referring to the IDL concept (usually the object the
2693         parser produces) and 'function' when referring to code being generated.
2694
2695         * bindings/scripts/CodeGenerator.pm:
2696         * bindings/scripts/IDLParser.pm:
2697         * bindings/scripts/generate-bindings.pl:
2698
2699 2017-05-25  Jer Noble  <jer.noble@apple.com>
2700
2701         System sleeps while playing to wireless target, ending stream.
2702         https://bugs.webkit.org/show_bug.cgi?id=172541
2703
2704         Reviewed by Eric Carlson.
2705
2706         API test: Tests/mac/MediaPlaybackSleepAssertion.mm
2707
2708         Keep the system from sleeping (but allow the display to sleep) while playing media to a wireless target.
2709
2710         Give the SleepDisabler a Type, either System or Display, which indicates what kind of sleep to disable.
2711         Update HTMLMediaElement::shouldDisableSleep() to differentiate between a video which is playing locally,
2712         one that is playing but not visible, and one that is playing remotely.
2713
2714         * html/HTMLMediaElement.cpp:
2715         (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged):
2716         (WebCore::HTMLMediaElement::updateSleepDisabling):
2717         (WebCore::HTMLMediaElement::shouldDisableSleep):
2718         * html/HTMLMediaElement.h:
2719         * platform/SleepDisabler.cpp:
2720         (WebCore::SleepDisabler::create):
2721         (WebCore::SleepDisabler::SleepDisabler):
2722         * platform/SleepDisabler.h:
2723         (WebCore::SleepDisabler::type):
2724         * platform/cocoa/SleepDisablerCocoa.cpp:
2725         (WebCore::SleepDisabler::create):
2726         (WebCore::SleepDisablerCocoa::SleepDisablerCocoa):
2727         (WebCore::SleepDisablerCocoa::~SleepDisablerCocoa):
2728         * platform/cocoa/SleepDisablerCocoa.h:
2729         * platform/mac/WebVideoFullscreenController.mm:
2730         (-[WebVideoFullscreenController updatePowerAssertions]):
2731         * platform/spi/cocoa/IOPMLibSPI.h:
2732
2733 2017-05-25  Chris Dumez  <cdumez@apple.com>
2734
2735         DocumentThreadableLoader::redirectReceived() should not rely on the resource's loader
2736         https://bugs.webkit.org/show_bug.cgi?id=172578
2737         <rdar://problem/30754582>
2738
2739         Reviewed by Youenn Fablet.
2740
2741         DocumentThreadableLoader::redirectReceived() should not rely on the resource's loader. The rest of the methods do not.
2742         It is unsafe for it to rely on the resource's loader because it gets cleared when the load completes. A CachedRawresource
2743         may be reused from the memory cache once its load has completed.
2744
2745         This would cause crashes in CachedRawResource::didAddClient() when replaying the redirects because it would call
2746         DocumentThreadableLoader::redirectReceived() and potentially not have a loader anymore. To hit this exact code path,
2747         you would need to make repeated XHR to a cacheable simple cross-origin resource that has cacheable redirect.
2748
2749         Test: http/tests/xmlhttprequest/cacheable-cross-origin-redirect-crash.html
2750
2751         * loader/DocumentThreadableLoader.cpp:
2752         (WebCore::DocumentThreadableLoader::redirectReceived):
2753         * loader/DocumentThreadableLoader.h:
2754
2755 2017-05-25  Zalan Bujtas  <zalan@apple.com>
2756
2757         ASSERTION FAILED: !needsStyleRecalc() || !document().childNeedsStyleRecalc()
2758         https://bugs.webkit.org/show_bug.cgi?id=172576
2759         <rdar://problem/32181979>
2760
2761         Reviewed by Brent Fulgham.
2762
2763         Ensure that we clean the subframe's document before start searching for a focusable element.
2764
2765         Covered by existing test.
2766
2767         * page/FocusController.cpp:
2768         (WebCore::FocusController::findFocusableElementDescendingDownIntoFrameDocument):
2769
2770 2017-05-24  Jiewen Tan  <jiewen_tan@apple.com>
2771
2772         Crash on WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance + 1195
2773         https://bugs.webkit.org/show_bug.cgi?id=172555
2774         <rdar://problem/32004724>
2775
2776         Reviewed by Ryosuke Niwa.
2777
2778         setSelectionWithoutUpdatingAppearance could dispatch a synchronous focusin event,
2779         which could invoke an event handler that deteles the frame. Therefore, add a
2780         protector before the call.
2781
2782         Test: editing/selection/select-iframe-focusin-document-crash.html
2783
2784         * editing/FrameSelection.cpp:
2785         (WebCore::FrameSelection::setSelection):
2786
2787 2017-05-25  Said Abou-Hallawa  <sabouhallawa@apple.com>
2788
2789         Ensure ImageFrameCache does not access its BitmapImage after it is deleted
2790         https://bugs.webkit.org/show_bug.cgi?id=172563
2791
2792         Reviewed by Simon Fraser.
2793
2794         A crash may happen if the BitmapImage is deleted while the decoding thread
2795         is still active. Once the current frame finishes decoding, the decoding
2796         thread will make a callOnMainThread() which will access the deleted BitmapImage.
2797
2798         We need to ensure if BitmapImage is deleted, the raw pointer which references
2799         it in ImageFrameCache is cleared. If this is done, nothing else is needed.
2800         All all the accesses to container BitmapImage in ImageFrameCache are guarded
2801         by checking m_image is not null.
2802
2803         * platform/graphics/BitmapImage.cpp:
2804         (WebCore::BitmapImage::~BitmapImage): Make sure the decoding thread will
2805         not have access to the deleted BitmapImage when it finishes decoding and
2806         make its callOnMainThread().
2807         (WebCore::BitmapImage::destroyDecodedData): Use the function new name.
2808         (WebCore::BitmapImage::internalStartAnimation): Ditto.
2809         * platform/graphics/ImageFrameCache.cpp:
2810         (WebCore::ImageFrameCache::startAsyncDecodingQueue): Protect the sourceURL
2811         for the decoding thread. ImageFrameCache::sourceURL() checks for the value
2812         of m_image which now may change from the main thread.
2813         * platform/graphics/ImageFrameCache.h:
2814         (WebCore::ImageFrameCache::clearImage): Add a new function to clear the 
2815         raw pointer m_image when its is deleted.
2816         * platform/graphics/ImageSource.cpp:
2817         (WebCore::ImageSource::resetData): Rename clear() to resetData() for better
2818         code readability. This function deletes the ImageDecoder and creates a new
2819         one if data is not null. The purpose is to delete the decoder raster data.
2820         (WebCore::ImageSource::clear): Deleted.
2821         * platform/graphics/ImageSource.h:
2822         (WebCore::ImageSource::clearImage): Wrapper for the ImageFrameCache function.
2823
2824 2017-05-25  youenn fablet  <youenn@apple.com>
2825
2826         Add some release logging for media elements
2827         https://bugs.webkit.org/show_bug.cgi?id=172581
2828
2829         Reviewed by Eric Carlson.
2830
2831         No change of behavior.
2832
2833          Adding logging for getUserMedia, video autoplay and incoming/outgoing webrtc video tracks.
2834
2835         * Modules/mediastream/UserMediaRequest.cpp:
2836         (WebCore::UserMediaRequest::allow):
2837         (WebCore::UserMediaRequest::deny):
2838         * html/HTMLMediaElement.cpp:
2839         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay):
2840         * html/MediaElementSession.cpp:
2841         (WebCore::MediaElementSession::playbackPermitted):
2842         * platform/Logging.h:
2843         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
2844         (WebCore::RealtimeIncomingVideoSource::OnFrame):
2845         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
2846         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
2847         (WebCore::RealtimeOutgoingVideoSource::sendOneBlackFrame):
2848         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
2849         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
2850
2851 2017-05-25  Sam Weinig  <sam@webkit.org>
2852
2853         [WebIDL] Do a pass of cleanup in the bindings generator
2854         https://bugs.webkit.org/show_bug.cgi?id=172566
2855
2856         Reviewed by Chris Dumez.
2857
2858         - Split JSDOMBindingCaller.h into four new files to allow for less 
2859           header inclusion (one includes a bunch of promise stuff that usually
2860           isn't needed): 
2861             - JSDOMCastedThisErrorBehavior (with shared casting enum)
2862             - JSDOMAttribute (for attribute getting / setting)
2863             - JSDOMOperation (for normal operations)
2864             - JSDOMOperationReturningPromise (for operations returning promises, obviously).
2865
2866           In addition to separating the files, rename to be more consistent with modern
2867           bindings conventions (new classes are IDLAttribute, IDLOperation, and 
2868           IDLOperationReturningPromise) and simplify function names
2869             - 'callOperation' becomes 'call'
2870             - 'attribute' becomes 'get'
2871             - 'setAttribute' becomes 'set'
2872
2873         - Remove extra generated trampoline function for operations returning promises
2874           by making JSDOMOperationReturningPromise handle all the promise related overhead.
2875
2876         - Make [Custom] operations returning promises go through the normal IDLOperationReturningPromise
2877           code path (simplifying JSReadableStreamSource and JSSubtleCrypto). Added [ReturnsOwnPromise]
2878           extended attribute to allow some functions that want to retain specialized behavior to do so
2879
2880         - Swap order of trampoline and implementation of operation, to avoid the need for
2881           a forward declaration and make reading more straightforward.
2882
2883         * WebCore.xcodeproj/project.pbxproj:
2884         Add / remove files.
2885
2886         * bindings/js/JSDOMBindingCaller.h: Removed.
2887
2888         * bindings/js/JSDOMCastedThisErrorBehavior.h: Added.
2889         Shared header for enum needed by JSDOMAttribute, JSDOMOperation and JSDOMOperationReturningPromise.
2890
2891         * bindings/js/JSDOMAttribute.h: Added.
2892         * bindings/js/JSDOMOperation.h: Added.
2893         * bindings/js/JSDOMOperationReturningPromise.h: Added.
2894         Split out JSDOMBindingCaller implementations into own classes / files. Simplify
2895         naming.
2896     
2897         * bindings/js/JSDOMPromiseDeferred.h:
2898         (WebCore::callPromiseFunction):
2899         Add a variant of callPromiseFunction that takes a lambda.
2900
2901         * bindings/js/JSEventTargetCustom.h:
2902         (WebCore::IDLOperation<JSEventTarget>::call):
2903         Update operation specialization to use new class.
2904
2905         * bindings/js/JSReadableStreamSourceCustom.cpp:
2906         * bindings/js/JSSubtleCryptoCustom.cpp:
2907         Simplify now that the callPromiseFunction is called for us.
2908
2909         * crypto/WebKitSubtleCrypto.idl:
2910         * css/FontFace.idl:
2911         * dom/CustomElementRegistry.idl:
2912         Add [ReturnsOwnPromise] to retain custom promise behavior.
2913
2914         * bindings/scripts/CodeGeneratorJS.pm:
2915         (GenerateHeader):
2916         Update header generation to account for custom functions that return promises now
2917         having a Ref<DeferredPromise>&& parameter.
2918
2919         (GenerateImplementation):
2920         - Update for new naming of cast functions.
2921         - Use AddToImplIncludes (and pass in conditional) rather than using $implIncludes
2922           directly, #includes to be grouped correctly.
2923         - Remove dead $inAppleCopyright code (it was moved to GenerateOperationDefinition 
2924           earlier).
2925
2926         (GenerateOperationDefinition):
2927         - Use $codeGenerator->IsPromiseType() rather than directly comparing to "Promise" string.
2928         - Restructure code to allow trampoline (the code that calls IDLOperation) to come after
2929           the main operation implementation (the part that calls into the impl).
2930         - Support custom functions returning promises (and the [ReturnsOwnPromise] variant).
2931
2932         (GenerateImplementationIterableFunctions):
2933         Update for name change to IDLOperation.
2934
2935         * bindings/scripts/IDLAttributes.json:
2936         Add [ReturnsOwnPromise].
2937
2938         * bindings/scripts/test/JS/JSInterfaceName.cpp:
2939         * bindings/scripts/test/JS/JSMapLike.cpp:
2940         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
2941         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2942         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
2943         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
2944         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2945         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2946         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
2947         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2948         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2949         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2950         * bindings/scripts/test/JS/JSTestException.cpp:
2951         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2952         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2953         * bindings/scripts/test/JS/JSTestInterface.cpp:
2954         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
2955         * bindings/scripts/test/JS/JSTestIterable.cpp:
2956         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2957         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2958         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2959         * bindings/scripts/test/JS/JSTestNode.cpp:
2960         * bindings/scripts/test/JS/JSTestObj.cpp:
2961         * bindings/scripts/test/JS/JSTestObj.h:
2962         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2963         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2964         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2965         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
2966         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2967         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
2968         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
2969         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2970         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2971         Update test results.
2972
2973         * bindings/scripts/test/TestObj.idl:
2974         Add additional test cases for operations returning promises.
2975
2976 2017-05-25  Simon Fraser  <simon.fraser@apple.com>
2977
2978         Some <chrono> and ProgressTracker cleanup
2979         https://bugs.webkit.org/show_bug.cgi?id=172582
2980
2981         Reviewed by Sam Weinig.
2982
2983         Remove some unnecessary <chrono> includes.
2984         Convert some std::chrono to use MonotonicTime/Seconds.
2985         Clean up ProgressTracker.
2986         Some #pragma once.
2987
2988         * dom/Document.h:
2989         * loader/ProgressTracker.cpp:
2990         (WebCore::ProgressTracker::ProgressTracker):
2991         (WebCore::ProgressTracker::reset):
2992         (WebCore::ProgressTracker::progressStarted):
2993         (WebCore::ProgressTracker::finalProgressComplete):
2994         (WebCore::ProgressTracker::incrementProgress):
2995         * loader/ProgressTracker.h:
2996         * page/Settings.h:
2997         * platform/SearchPopupMenu.h:
2998         * platform/Timer.h:
2999         * platform/graphics/cg/IOSurfacePool.cpp:
3000         (WebCore::IOSurfacePool::markOlderSurfacesPurgeable):
3001         * platform/graphics/cg/IOSurfacePool.h:
3002         (WebCore::IOSurfacePool::CachedSurfaceDetails::resetLastUseTime):
3003         * platform/network/PlatformCookieJar.h:
3004
3005 2017-05-25  Joanmarie Diggs  <jdiggs@igalia.com>
3006
3007         [ATK] Expose doc-footnote ARIA role with ATK_ROLE_FOOTNOTE
3008         https://bugs.webkit.org/show_bug.cgi?id=172355
3009
3010         Reviewed by Chris Fleizach.
3011
3012         Add a new FootnoteRole accessibility role to WebCore and map it to
3013         ATK_ROLE_FOOTNOTE for WebKitGtk and NSAccessibilityGroupRole with
3014         a subrole of AXApplicationGroup for the Mac port.
3015
3016         No new tests because we already have coverage for this role.
3017         The existing test expectations were updated to reflect the
3018         new mapping of doc-footnote to ATK_ROLE_FOOTNOTE.
3019
3020         * accessibility/AccessibilityObject.cpp:
3021         (WebCore::initializeRoleMap):
3022         (WebCore::AccessibilityObject::computedRoleString):
3023         * accessibility/AccessibilityObject.h:
3024         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
3025         (atkRole):
3026         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3027         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
3028         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3029         (createAccessibilityRoleMap):
3030         (-[WebAccessibilityObjectWrapper subrole]):
3031
3032 2017-05-25  youenn fablet  <youenn@apple.com>
3033
3034         [macOS WK2 Debug] Layout Test webrtc/video.html is crashing.
3035         https://bugs.webkit.org/show_bug.cgi?id=172560
3036         <rdar://problem/32392611>
3037
3038         Reviewed by Eric Carlson.
3039
3040         webrtc/multiple-video.html is no longer crashing.
3041
3042         Allow autoplay only from going to not capture to capture, and not the reverse.
3043         Renamed HTMLMediaElement::mediaStreamCaptureStateChanged to mediaStreamCaptureStarted.
3044
3045         * dom/Document.cpp:
3046         (WebCore::Document::mediaStreamCaptureStateChanged):
3047         * html/HTMLMediaElement.cpp:
3048         (WebCore::HTMLMediaElement::mediaStreamCaptureStateChanged): Deleted.
3049         * html/HTMLMediaElement.h:
3050         (WebCore::HTMLMediaElement::mediaStreamCaptureStarted):
3051
3052 2017-05-25  Dave Hyatt  <hyatt@apple.com>
3053
3054         Baseline of number inputs not right.
3055         https://bugs.webkit.org/show_bug.cgi?id=172237
3056
3057         Reviewed by Dean Jackson.
3058
3059         Added fast/forms/baseline-of-number-inputs.html
3060
3061         * css/html.css:
3062         (input::-webkit-inner-spin-button):
3063         * rendering/RenderSearchField.cpp:
3064         (WebCore::RenderSearchField::computeLogicalHeightLimit): Deleted.
3065         (WebCore::RenderSearchField::centerContainerIfNeeded): Deleted.
3066         * rendering/RenderSearchField.h:
3067         * rendering/RenderTextControlSingleLine.cpp:
3068         (WebCore::RenderTextControlSingleLine::centerRenderer):
3069         (WebCore::RenderTextControlSingleLine::layout):
3070         (WebCore::RenderTextControlSingleLine::computeLogicalHeightLimit): Deleted.
3071         * rendering/RenderTextControlSingleLine.h:
3072         (WebCore::RenderTextControlSingleLine::centerContainerIfNeeded): Deleted.
3073
3074 2017-05-25  Manuel Rego Casasnovas  <rego@igalia.com>
3075
3076         [css-grid] Fix behavior of positioned items without specific dimensions
3077         https://bugs.webkit.org/show_bug.cgi?id=172117
3078
3079         Reviewed by Sergio Villar Senin.
3080
3081         Currently positioned items that doesn't have specific dimensions
3082         are not properly sized. This patch fixes the issues with them.
3083
3084         The patch removes the extraInline|BlockOffsets from RenderBox,
3085         so now RenderGrid is responsible of setting the location of the positioned item.
3086         This will be useful to add alignment support for positioned items later.
3087         It also removes grid specific logic from RenderBox.
3088
3089         RenderBox::computeInlineStaticDistance() was modified too.
3090         The problem here was that the containing block of the positioned gird items
3091         is the grid area (and not the grid container). The method didn't know
3092         anything about grid, so it was using the grid container causing wrong values
3093         when resolving "auto" in both left and right offset properties.
3094
3095         Note that after this patch we match Chrome and Firefox behavior on these cases.
3096
3097         Test: fast/css-grid-layout/positioned-grid-items-sizing.html
3098
3099         * rendering/RenderBox.cpp:
3100         (WebCore::RenderBox::willBeDestroyed):
3101         (WebCore::computeInlineStaticDistance):
3102         (WebCore::RenderBox::computePositionedLogicalWidth):
3103         (WebCore::RenderBox::computePositionedLogicalHeight):
3104         * rendering/RenderBox.h:
3105         * rendering/RenderGrid.cpp:
3106         (WebCore::RenderGrid::layoutPositionedObject):
3107         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
3108
3109 2017-05-25  Claudio Saavedra  <csaavedra@igalia.com>
3110
3111         [WPE] Build fix after r217404
3112
3113         Unreviewed
3114
3115         * PlatformWPE.cmake: Include missing cairo cmake file.
3116
3117 2017-05-24  Chris Dumez  <cdumez@apple.com>
3118
3119         ResourceResponses for data URLs have their Source marked as Unknown
3120         https://bugs.webkit.org/show_bug.cgi?id=172573
3121         <rdar://problem/31786198>
3122
3123         Reviewed by Geoffrey Garen.
3124
3125         ResourceResponses for data URLs have their Source marked as Unknown.
3126
3127         Now set their source to Network to maintain previous behavior when
3128         we used to decode those data URLs on Network process side.
3129
3130         Test: fast/url/data-url-source.html
3131
3132         * loader/ResourceLoader.cpp:
3133         (WebCore::ResourceLoader::loadDataURL):
3134
3135 2017-05-24  Fujii Hironori  <Hironori.Fujii@sony.com>
3136
3137         [Win] An assertion fails if the custom cursor image isn't loaded yet
3138         https://bugs.webkit.org/show_bug.cgi?id=172209
3139
3140         Reviewed by Said Abou-Hallawa.
3141
3142         Test: fast/css/crash-on-custom-cursor-when-loading.html
3143
3144         A custom cursor image can be zero dimension if it is loading or
3145         decoding. Cursor::ensurePlatformCursor of Windows port should
3146         handle such case properly.
3147
3148         * platform/win/CursorWin.cpp:
3149         (WebCore::Cursor::ensurePlatformCursor): Load a stock cursor if
3150         the custom cursor image has zero dimension. Do not do null-check
3151         of the return value of createSharedCursor() because it never
3152         returns null.
3153
3154 2017-05-24  Don Olmstead  <don.olmstead@am.sony.com>
3155
3156         [CMake] Consolidate CMake code related to Cairo
3157         https://bugs.webkit.org/show_bug.cgi?id=172568
3158
3159         Reviewed by Alex Christensen.
3160
3161         No new tests. No change in behavior.
3162
3163         * PlatformGTK.cmake:
3164         * PlatformWPE.cmake:
3165         * PlatformWinCairo.cmake:
3166         * config.h:
3167         * platform/Cairo.cmake: Added.
3168         * platform/GStreamer.cmake:
3169         * platform/ImageDecoders.cmake:
3170
3171 2017-05-24  Said Abou-Hallawa  <sabouhallawa@apple.com>
3172
3173         REGRESSION (r206481): Don't assume frameCount() is larger than or equal to the size of the image frame cache
3174         https://bugs.webkit.org/show_bug.cgi?id=172552
3175
3176         Reviewed by Geoffrey Garen.
3177
3178         If an image with many cached ImageFrames is cached but its encoded data is
3179         freed, then the same image is reused, the encoded data will be fetched.
3180         But the initial frameCount() might be less than the current size of the
3181         ImageFrames cache.
3182
3183         This was causing an assertion in the debug build and crash in the release
3184         build. Vector::grow() does not handle the case where the new size is smaller
3185         than the current size safely.
3186
3187         * platform/graphics/ImageFrameCache.cpp:
3188         (WebCore::ImageFrameCache::growFrames):
3189
3190 2017-05-24  Sergey Shekyan  <shekyan@gmail.com>
3191
3192         navigator.webdriver should return false if the page is not controlled by automation
3193         https://bugs.webkit.org/show_bug.cgi?id=171997
3194
3195         Reviewed by Chris Dumez.
3196
3197         Per WebDriver Specification at https://www.w3.org/TR/webdriver/#interface
3198
3199         Test: js/dom/navigator-webdriver.html
3200         Rebaseled fast/dom/navigator-detached-no-crash.html
3201
3202         * Modules/webdriver/NavigatorWebDriver.cpp:
3203         (WebCore::NavigatorWebDriver::NavigatorWebDriver):
3204         (WebCore::NavigatorWebDriver::isControlledByAutomation):
3205         (WebCore::NavigatorWebDriver::from):
3206         (WebCore::NavigatorWebDriver::webdriver):
3207         (WebCore::JSNavigator::webdriver): Deleted.
3208         * Modules/webdriver/NavigatorWebDriver.h:
3209         * Modules/webdriver/NavigatorWebDriver.idl:
3210
3211 2017-05-24  Ryan Haddad  <ryanhaddad@apple.com>
3212
3213         Unreviewed, suppress deprecation warnings to fix the build.
3214
3215         * platform/graphics/mac/GraphicsContextMac.mm:
3216         (WebCore::linearRGBColorSpaceRef):
3217
3218 2017-05-24  Wenson Hsieh  <wenson_hsieh@apple.com>
3219
3220         Plumb additional image metadata to item providers when beginning data interaction on an image
3221         https://bugs.webkit.org/show_bug.cgi?id=172536
3222         <rdar://problem/32371300>
3223
3224         Reviewed by Beth Dakin.
3225
3226         Plumb suggestedName (the last path component of the image's source URL) and size (the actual size of the image)
3227         to item providers when beginning data interaction on an image.
3228
3229         Augments existing unit tests to cover these changes -- see DataInteractionTests.
3230
3231         * editing/ios/EditorIOS.mm:
3232         (WebCore::Editor::writeImageToPasteboard):
3233         * platform/Pasteboard.h:
3234         * platform/ios/PlatformPasteboardIOS.mm:
3235         (WebCore::PlatformPasteboard::writeObjectRepresentations):
3236         * platform/ios/WebItemProviderPasteboard.h:
3237         * platform/ios/WebItemProviderPasteboard.mm:
3238         (-[WebItemProviderRegistrationInfoList init]):
3239         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]):
3240         (temporaryFileURLForDataInteractionContent):
3241
3242 2017-05-24  Eric Carlson  <eric.carlson@apple.com>
3243
3244         CoreAudioCaptureSource is ducking system sound
3245         https://bugs.webkit.org/show_bug.cgi?id=172512
3246
3247         Reviewed by Youenn Fablet.
3248
3249         Manual testing.
3250
3251         * Configurations/WebCore.xcconfig: Adding CoreAudio as framework for iOS.
3252         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
3253         (WebCore::CoreAudioSharedUnit::setupAudioUnit):
3254         (WebCore::CoreAudioSharedUnit::defaultOutputDevice):
3255         * platform/spi/cf/CoreAudioSPI.h: Added.
3256
3257 2017-05-24  John Wilander  <wilander@apple.com>
3258
3259         Resource Load Statistics: Change grandfathering default to one hour
3260         https://bugs.webkit.org/show_bug.cgi?id=172524
3261         <rdar://problem/32360462>
3262
3263         Reviewed by Brent Fulgham.
3264
3265         Covered by existing test.
3266
3267         * loader/ResourceLoadStatisticsStore.cpp:
3268
3269 2017-05-24  Jer Noble  <jer.noble@apple.com>
3270
3271         Rename DisplaySleepDisabler -> SleepDisabler
3272         https://bugs.webkit.org/show_bug.cgi?id=172478
3273
3274         Reviewed by Sam Weinig.
3275
3276         Rename DisplaySleepDisabler to SleepDisabler so that different (i.e., non-Display) sleep types can be
3277         added in a future change.
3278
3279         * WebCore.xcodeproj/project.pbxproj:
3280         * html/HTMLMediaElement.cpp:
3281         (WebCore::HTMLMediaElement::updateSleepDisabling):
3282         * html/HTMLMediaElement.h:
3283         * platform/SleepDisabler.cpp: Renamed from Source/WebCore/platform/DisplaySleepDisabler.cpp.
3284         (WebCore::SleepDisabler::create):
3285         (WebCore::SleepDisabler::SleepDisabler):
3286         (WebCore::SleepDisabler::~SleepDisabler):
3287         * platform/SleepDisabler.h: Renamed from Source/WebCore/platform/DisplaySleepDisabler.h.
3288         * platform/cocoa/SleepDisablerCocoa.cpp: Renamed from Source/WebCore/platform/cocoa/DisplaySleepDisablerCocoa.cpp.
3289         (WebCore::SleepDisabler::create):
3290         (WebCore::SleepDisablerCocoa::SleepDisablerCocoa):
3291         (WebCore::SleepDisablerCocoa::~SleepDisablerCocoa):
3292         * platform/cocoa/SleepDisablerCocoa.h: Renamed from Source/WebCore/platform/cocoa/DisplaySleepDisablerCocoa.h.
3293         * platform/mac/WebVideoFullscreenController.h:
3294         * platform/mac/WebVideoFullscreenController.mm:
3295         (-[WebVideoFullscreenController updatePowerAssertions]):
3296         * CMakeLists.txt:
3297         * PlatformMac.cmake:
3298         * WebCore.order:
3299
3300 2017-05-24  Per Arne Vollan  <pvollan@apple.com>
3301
3302         [Win] Create unique network storage session for each DRT.
3303         https://bugs.webkit.org/show_bug.cgi?id=172540
3304
3305         Reviewed by Brent Fulgham.
3306
3307         During layout testing, each DRT instance should have its own network storage session.
3308
3309         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3310         (WebCore::NetworkStorageSession::switchToNewTestingSession):
3311
3312 2017-05-24  Sam Weinig  <sam@webkit.org>
3313
3314         [WebIDL] Overloaded functions unnecessarily duplicate argument checks
3315         https://bugs.webkit.org/show_bug.cgi?id=172481
3316
3317         Reviewed by Chris Dumez.
3318
3319         * bindings/scripts/CodeGeneratorJS.pm:
3320         (GenerateHeader):
3321         (GeneratePropertiesHashTable):
3322         Update for rename of GetConditionalForFunctionConsideringOverloads.
3323
3324         (AreTypesDistinguishableForOverloadResolution):
3325         Remove unnecessary subroutine isDictionary that can be replaced by
3326         a direct call to $codeGenerator->IsDictionaryType().
3327
3328         (GetConditionalForFunctionConsideringOverloads):
3329         Renamed from getConditionalForFunctionConsideringOverloads.
3330
3331         (GenerateOverloadDispatcher):
3332         Renamed from GenerateOverloadedFunctionOrConstructor. Moved Constructor/Operation/LegacyCaller
3333         specific code out, and into parameters.
3334
3335         (GenerateImplementation):
3336         Moved operation generation out into its own subroutine.
3337
3338         (GenerateOperationDefinition): Added.
3339         Moved from GenerateImplementation.
3340
3341         (GenerateLegacyCallerDefinitions):
3342         Pass function name and signature to GenerateOverloadDispatcher.
3343
3344         (GenerateArgumentsCountCheck):
3345         Don't generate an argument check if this is an overloaded function. The argument
3346         checks happen in the overload dispatcher.
3347
3348         (NeedsExplicitPropagateExceptionCall):
3349         (GenerateParametersCheck):
3350         (GenerateImplementationFunctionCall):
3351         Replace IsReturningPromise with more direct check.
3352
3353         (GenerateConstructorDefinitions):
3354         Pass function name and signature to GenerateOverloadDispatcher.
3355
3356         (getConditionalForFunctionConsideringOverloads): Renamed to GetConditionalForFunctionConsideringOverloads.
3357         (GenerateOverloadedFunctionOrConstructor): Renamed to GenerateOverloadDispatcher.
3358         (IsReturningPromise): Deleted.
3359
3360         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3361         * bindings/scripts/test/JS/JSTestInterface.cpp:
3362         * bindings/scripts/test/JS/JSTestObj.cpp:
3363         * bindings/scripts/test/TestInterface.idl:
3364         Update test results.
3365
3366 2017-05-24  Commit Queue  <commit-queue@webkit.org>
3367
3368         Unreviewed, rolling out r217319.
3369         https://bugs.webkit.org/show_bug.cgi?id=172538
3370
3371         This patch broke iOS Simulator Debug build (Requested by fredw
3372         on #webkit).
3373
3374         Reverted changeset:
3375
3376         "CoreAudioCaptureSource is ducking system sound"
3377         https://bugs.webkit.org/show_bug.cgi?id=172512
3378         http://trac.webkit.org/changeset/217319
3379
3380 2017-05-24  Antoine Quint  <graouts@apple.com>
3381
3382         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
3383         https://bugs.webkit.org/show_bug.cgi?id=168409
3384
3385         Unreviewed.
3386
3387         Remove temporary logging which prevents performance bots from reporting useful data.
3388
3389         * page/Page.cpp:
3390         (WebCore::Page::suspendScriptedAnimations):
3391
3392 2017-05-24  Javier Fernandez  <jfernandez@igalia.com>
3393
3394         [css-grid] Ignore collapsed tracks on content-distribution alignment
3395         https://bugs.webkit.org/show_bug.cgi?id=172493
3396
3397         Reviewed by Manuel Rego Casasnovas.
3398
3399         The CSS Box Alignment spec states that we should ignore the collapsed
3400         tracks when computing the Distribution Alignment space to assign to the
3401         different grid tracks.
3402
3403         No new tests, just unskipping the web-platform-tests imported to verify this use case.
3404
3405         * rendering/RenderGrid.cpp:
3406         (WebCore::RenderGrid::populateGridPositionsForDirection):
3407
3408 2017-05-24  Wenson Hsieh  <wenson_hsieh@apple.com>
3409
3410         Respect image UTIs when writing to item providers when beginning data interaction on an image
3411         https://bugs.webkit.org/show_bug.cgi?id=172436
3412         <rdar://problem/31786569>
3413
3414         Reviewed by Beth Dakin.
3415
3416         Previously, when beginning writing images to the WebItemProviderPasteboard, we would create a new UIImage and
3417         use standard UIImage UIItemProviderWriting utilities to register the image to the pasteboard. This is lossy for
3418         gifs, since UIImage doesn't inherently know how to represent gifs. Instead, register the raw image data directly
3419         to the UTI type corresponding to the MIME type of the image, and use UIImage's item provider writing capability
3420         as a fallback when the raw resourceData is unavailable.
3421
3422         Augments existing unit tests, and also adds a new unit test:
3423         DataInteractionTests.ImageDoesNotUseElementSizeAsEstimatedSize
3424
3425         * platform/ios/PlatformPasteboardIOS.mm:
3426         (WebCore::PlatformPasteboard::writeObjectRepresentations):
3427
3428 2017-05-23  Eric Carlson  <eric.carlson@apple.com>
3429
3430         CoreAudioCaptureSource is ducking system sound
3431         https://bugs.webkit.org/show_bug.cgi?id=172512
3432
3433         Reviewed by Youenn Fablet.
3434
3435         Manual testing.
3436
3437         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
3438         (WebCore::CoreAudioSharedUnit::setupAudioUnit):
3439         (WebCore::CoreAudioSharedUnit::defaultOutputDevice):
3440
3441 2017-05-23  Said Abou-Hallawa  <sabouhallawa@apple.com>
3442
3443         [iOS] Speculative fix for a PLT regression
3444         <rdar://problem/32361890>
3445
3446         Unreviewed.
3447
3448         Make sure CGImageSourceGetTypeWithData() is called with a buffer which is
3449         32 bytes or more.
3450
3451         * platform/graphics/cg/ImageDecoderCG.cpp:
3452         (WebCore::ImageDecoder::ImageDecoder):
3453
3454 2017-05-22  Jiewen Tan  <jiewen_tan@apple.com>
3455
3456         [WebCrypto] Support RSA-PSS
3457         https://bugs.webkit.org/show_bug.cgi?id=170869
3458         <rdar://problem/31640672>
3459
3460         Reviewed by Brent Fulgham.
3461
3462         This patch implements RSA-PSS according to the spec: https://www.w3.org/TR/WebCryptoAPI/#rsa-pss.
3463         Supported operations include sign, verify, generateKey, importKey and exportKey.
3464
3465         Tests: crypto/subtle/rsa-pss-generate-export-key-jwk-sha1.html
3466                crypto/subtle/rsa-pss-generate-export-key-jwk-sha224.html
3467                crypto/subtle/rsa-pss-generate-export-key-jwk-sha256.html
3468                crypto/subtle/rsa-pss-generate-export-key-jwk-sha384.html
3469                crypto/subtle/rsa-pss-generate-export-key-jwk-sha512.html
3470                crypto/subtle/rsa-pss-generate-export-key-pkcs8.html
3471                crypto/subtle/rsa-pss-generate-export-key-spki.html
3472                crypto/subtle/rsa-pss-generate-key.html
3473                crypto/subtle/rsa-pss-import-jwk-private-key.html
3474                crypto/subtle/rsa-pss-import-jwk-public-key-empty-usages.html
3475                crypto/subtle/rsa-pss-import-jwk-public-key-sha1.html
3476                crypto/subtle/rsa-pss-import-jwk-public-key-sha224.html
3477                crypto/subtle/rsa-pss-import-jwk-public-key-sha256.html
3478                crypto/subtle/rsa-pss-import-jwk-public-key-sha384.html
3479                crypto/subtle/rsa-pss-import-jwk-public-key-sha512.html
3480                crypto/subtle/rsa-pss-import-key-sign-large-salt.html
3481                crypto/subtle/rsa-pss-import-key-sign.html
3482                crypto/subtle/rsa-pss-import-key-verify.html
3483                crypto/subtle/rsa-pss-import-pkcs8-key.html
3484                crypto/subtle/rsa-pss-import-spki-key-empty-usages.html
3485                crypto/subtle/rsa-pss-import-spki-key.html
3486                crypto/workers/subtle/rsa-pss-import-key-sign.html
3487                crypto/workers/subtle/rsa-pss-import-key-verify.html
3488
3489         * CMakeLists.txt:
3490         * DerivedSources.make:
3491         * PlatformGTK.cmake:
3492         * WebCore.xcodeproj/project.pbxproj:
3493         * bindings/js/JSSubtleCryptoCustom.cpp:
3494         (WebCore::normalizeCryptoAlgorithmParameters):
3495         * crypto/CryptoAlgorithmParameters.h:
3496         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp: Added.
3497         (WebCore::CryptoAlgorithmRSA_PSS::create):
3498         (WebCore::CryptoAlgorithmRSA_PSS::identifier):
3499         (WebCore::CryptoAlgorithmRSA_PSS::sign):
3500         (WebCore::CryptoAlgorithmRSA_PSS::verify):
3501         (WebCore::CryptoAlgorithmRSA_PSS::generateKey):
3502         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
3503         (WebCore::CryptoAlgorithmRSA_PSS::exportKey):
3504         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h: Added.
3505         * crypto/mac/CryptoAlgorithmECDSAMac.cpp:
3506         (WebCore::cryptoDigestAlgorithm): Deleted.
3507         Extract function cryptoDigestAlgorithm to a separate file.
3508         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
3509         (WebCore::cryptoDigestAlgorithm): Deleted.
3510         Extract function cryptoDigestAlgorithm to a separate file.
3511         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp: Added.
3512         (WebCore::signRSA_PSS):
3513         (WebCore::verifyRSA_PSS):
3514         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
3515         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
3516         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
3517         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
3518         * crypto/mac/CryptoDigestAlgorithm.h: Added.
3519         (WebCore::cryptoDigestAlgorithm):
3520         Have cryptoDigestAlgorithm in a separate file.
3521         * crypto/parameters/CryptoAlgorithmRsaPssParams.h: Added.
3522         * crypto/parameters/RsaPssParams.idl: Added.
3523
3524 2017-05-23  Eric Carlson  <eric.carlson@apple.com>
3525
3526         [MediaStream] Allow transition from autoplay to play when a capture stream begins.
3527         https://bugs.webkit.org/show_bug.cgi?id=172391
3528         <rdar://problem/32304934>
3529
3530         Reviewed by Youenn Fablet.
3531
3532         Manual testing. Regression testing to be added as a follow-up.
3533
3534         * dom/Document.cpp:
3535         (WebCore::Document::updateIsPlayingMedia): Call mediaStreamCaptureStateChanged when capture
3536         state changes.
3537         (WebCore::Document::registerForMediaStreamStateChangeCallbacks):
3538         (WebCore::Document::unregisterForMediaStreamStateChangeCallbacks):
3539         (WebCore::Document::mediaStreamCaptureStateChanged): Call all registered elements.
3540         * dom/Document.h:
3541         * html/HTMLMediaElement.cpp:
3542         (WebCore::HTMLMediaElement::registerWithDocument): Register for capture state changes.
3543         (WebCore::HTMLMediaElement::unregisterWithDocument): Unregister for capture state changes.
3544         (WebCore::HTMLMediaElement::mediaStreamCaptureStateChanged): Attempt autoplay as necessary.
3545         * html/HTMLMediaElement.h:
3546
3547 2017-05-15  Matt Rajca  <mrajca@apple.com>
3548
3549         Replace autoplay events that fire at navigation with a DidAutoplayMediaPastThreshold event.
3550         https://bugs.webkit.org/show_bug.cgi?id=172138
3551
3552         Reviewed by Alex Christensen.
3553
3554         The current autoplay signals that are fired at navigation may not get delivered to the UIProcess if the WebPage is close()'ed around
3555         this time. This patch simplifies this and just notifies clients if a media element has played past a threshold.
3556
3557         Updated API tests.
3558
3559         * html/HTMLMediaElement.cpp:
3560         (WebCore::HTMLMediaElement::playbackProgressTimerFired):
3561         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
3562         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
3563         (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay):
3564         * page/AutoplayEvent.h:
3565
3566 2017-05-23  Dean Jackson  <dino@apple.com>
3567
3568         checkGPUStatus needs to exercise instancing calls
3569         https://bugs.webkit.org/show_bug.cgi?id=172520
3570         <rdar://problem/23118395>
3571
3572         Reviewed by Brent Fulgham.
3573
3574         The checkGPUStatus method (formerly checkGPUStatusIfNecessary) was
3575         not being called after the drawArrays/Elements instancing calls.
3576
3577         I also added a test case to exercise the recovery logic.
3578
3579         Test: fast/canvas/webgl/lose-context-on-status-failure.html
3580
3581         * html/canvas/WebGLRenderingContextBase.cpp:
3582         (WebCore::WebGLRenderingContextBase::setFailNextGPUStatusCheck): Force
3583         the next checkGPUStatus on the GC3D to fail.
3584         * html/canvas/WebGLRenderingContextBase.h:
3585         * platform/graphics/GraphicsContext3D.h: Rename a function, and make
3586         the number of calls we wait before checking per instance, rather than
3587         static (which might have meant we're only ever checking after one canvas on
3588         a page with multiple contexts).
3589         (WebCore::GraphicsContext3D::setFailNextGPUStatusCheck):
3590         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
3591         (WebCore::GraphicsContext3D::checkGPUStatus): Renamed.
3592         (WebCore::GraphicsContext3D::checkGPUStatusIfNecessary): Deleted.
3593         * platform/graphics/mac/GraphicsContext3DMac.mm:
3594         (WebCore::GraphicsContext3D::checkGPUStatus): Improve the logic.
3595         (WebCore::GraphicsContext3D::checkGPUStatusIfNecessary): Deleted.
3596         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
3597         (WebCore::GraphicsContext3D::clear):
3598         (WebCore::GraphicsContext3D::drawArrays):
3599         (WebCore::GraphicsContext3D::drawElements):
3600         (WebCore::GraphicsContext3D::drawArraysInstanced): Add a call to checkGPUStatus.
3601         (WebCore::GraphicsContext3D::drawElementsInstanced): Ditto.
3602         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
3603         (WebCore::GraphicsContext3D::checkGPUStatus):
3604         (WebCore::GraphicsContext3D::checkGPUStatusIfNecessary): Deleted.
3605         * testing/Internals.cpp: Implement the internal call to cause the next
3606         check to fail.
3607         (WebCore::Internals::failNextGPUStatusCheck):
3608         * testing/Internals.h:
3609         * testing/Internals.idl:
3610
3611 2017-05-23  Sam Weinig  <sam@webkit.org>
3612
3613         [WebIDL] Further cleanup enumeration handling
3614         https://bugs.webkit.org/show_bug.cgi?id=172516
3615
3616         Reviewed by Chris Dumez.
3617
3618         * bindings/scripts/CodeGeneratorJS.pm:
3619         (GeneratePut):
3620         (GeneratePutByIndex):
3621         (GenerateDictionaryImplementationContent):
3622         (GenerateParametersCheck):
3623         (GenerateCallbackImplementationContent):
3624         Update now that JSValueToNative doesn't have a second return value.
3625
3626         (GenerateImplementation):
3627         Add enumeration special casing to attribute setting code, where it is special
3628         cased in the standard
3629
3630         (PassArgumentExpression):
3631         Stop special casing enumerations.
3632         
3633         (IsValidContextForJSValueToNative):
3634         Assert that enums are never passed to JSValueToNative in an attribute context.
3635
3636         (JSValueToNative):
3637         Remove enumeration special case and second return value (which was always 1).
3638
3639         * bindings/scripts/test/JS/JSTestObj.cpp:
3640         (WebCore::setJSTestObjEnumAttrFunction):
3641         (WebCore::setJSTestObjImplementationEnumAttrFunction):
3642         (WebCore::setJSTestObjAttributeWithReservedEnumTypeFunction):
3643         Update results.
3644
3645 2017-05-22  Simon Fraser  <simon.fraser@apple.com>
3646
3647         Snapshotting via -renderInContext: should do synchronous image decodes
3648         https://bugs.webkit.org/show_bug.cgi?id=172485
3649         rdar://problem/32276146
3650
3651         Reviewed by Tim Horton.
3652
3653         When UIWebView clients snapshot the view via -renderInContext: on the UIView's layer,
3654         WebKit should do synchronous image decodes so that the images show in the snapshot.
3655
3656         Fix by plumbing through a "snapshotting" paint behavior flag from two source locations:
3657         WebSimpleLayer, used by compositing layers, and LegacyTileLayer, used for the WK1 tile cache.
3658         On WebSimpleLayer the flag propagates through PlatformCALayer to GraphicsLayer, and on LegacyTileLayer
3659         it sets some state on the WAKWindow, which is detected by -[WebFrame _paintBehaviorForDestinationContext:].
3660         In both cases, the flag becomes PaintBehaviorSnapshotting which is passed down through painting
3661         in PaintInfo.paintBehavior.
3662
3663         Fix code that was checking paintBehavior on the FrameView to just looking at PaintInfo.paintBehavior,
3664         which required passing PaintInfo along in RenderImage::paintIntoRect().
3665
3666         We can't just use the PaintBehaviorFlattenCompositingLayers flag, because that triggers
3667         a flattening paint of compositing layers, and we don't want that behavior for -renderInContext:,
3668         since CoreAnimation calls -renderInContext: on each of our layers and we need to avoid double-painting.
3669         So PaintBehaviorSnapshotting is now added to the call sites that also set PaintBehaviorFlattenCompositingLayers
3670         in most cases.
3671
3672         Tested by SnapshotViaRenderInContext API test.
3673
3674         * html/shadow/MediaControlElements.cpp:
3675         (WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
3676         * page/FrameView.cpp:
3677         (WebCore::FrameView::willPaintContents):
3678         (WebCore::FrameView::paintContentsForSnapshot):
3679         * page/PageOverlayController.cpp:
3680         (WebCore::PageOverlayController::paintContents):
3681         * page/PageOverlayController.h:
3682         * page/mac/ServicesOverlayController.h:
3683         * page/mac/ServicesOverlayController.mm:
3684         (WebCore::ServicesOverlayController::Highlight::paintContents):
3685         * platform/graphics/GraphicsLayer.cpp:
3686         (WebCore::GraphicsLayer::paintGraphicsLayerContents):
3687         * platform/graphics/GraphicsLayer.h:
3688         * platform/graphics/GraphicsLayerClient.h:
3689         (WebCore::GraphicsLayerClient::paintContents):
3690         * platform/graphics/ca/GraphicsLayerCA.cpp:
3691         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
3692         (WebCore::GraphicsLayerCA::platformCALayerPaintContents):
3693         * platform/graphics/ca/GraphicsLayerCA.h:
3694         * platform/graphics/ca/PlatformCALayer.h:
3695         * platform/graphics/ca/PlatformCALayerClient.h:
3696         * platform/graphics/ca/TileCoverageMap.cpp:
3697         (WebCore::TileCoverageMap::platformCALayerPaintContents):
3698         * platform/graphics/ca/TileCoverageMap.h:
3699         * platform/graphics/ca/TileGrid.cpp:
3700         (WebCore::TileGrid::platformCALayerPaintContents):
3701         * platform/graphics/ca/TileGrid.h:
3702         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
3703         (PlatformCALayer::drawLayerContents):
3704         * platform/graphics/mac/WebLayer.mm:
3705         (-[WebLayer drawInContext:]):
3706         (-[WebSimpleLayer renderInContext:]):
3707         (-[WebSimpleLayer drawInContext:]):
3708         * platform/ios/LegacyTileCache.h: Use initializers.
3709         * platform/ios/LegacyTileCache.mm:
3710         (WebCore::LegacyTileCache::LegacyTileCache):
3711         (WebCore::LegacyTileCache::drawWindowContent):
3712         (WebCore::LegacyTileCache::drawLayer):
3713         * platform/ios/LegacyTileLayer.h:
3714         * platform/ios/LegacyTileLayer.mm:
3715         (-[LegacyTileHostLayer renderInContext:]):
3716         (-[LegacyTileLayer renderInContext:]):
3717         (-[LegacyTileLayer drawInContext:]):
3718         (+[LegacyTileLayer layerBeingPainted]): Deleted. There were no callers.
3719         * platform/ios/wak/WAKView.mm:
3720         (-[WAKView _drawRect:context:lockFocus:]): bool -> BOOL
3721         * platform/ios/wak/WAKWindow.h:
3722         * platform/ios/wak/WAKWindow.mm:
3723         (-[WAKWindow setIsInSnapshottingPaint:]):
3724         (-[WAKWindow isInSnapshottingPaint]):
3725         * rendering/PaintPhase.h:
3726         * rendering/RenderBox.cpp:
3727         (WebCore::RenderBox::paintMaskImages):
3728         * rendering/RenderBoxModelObject.cpp:
3729         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
3730         * rendering/RenderImage.cpp:
3731         (WebCore::RenderImage::paintReplaced):
3732         (WebCore::RenderImage::paintIntoRect):
3733         * rendering/RenderImage.h:
3734         * rendering/RenderLayer.cpp:
3735         (WebCore::RenderLayer::paintLayerContents):
3736         (WebCore::RenderLayer::paintForegroundForFragments):
3737         * rendering/RenderLayerBacking.cpp:
3738         (WebCore::RenderLayerBacking::paintContents):
3739         * rendering/RenderLayerBacking.h:
3740         * rendering/RenderLayerCompositor.cpp:
3741         (WebCore::RenderLayerCompositor::paintContents):
3742         * rendering/RenderLayerCompositor.h:
3743         * rendering/RenderVideo.cpp:
3744         (WebCore::RenderVideo::paintReplaced):
3745
3746 2017-05-23  Myles C. Maxfield  <mmaxfield@apple.com>
3747
3748         Remove dead ENABLE(FONT_LOAD_EVENTS) code
3749         https://bugs.webkit.org/show_bug.cgi?id=172517
3750
3751         Rubber-stamped by Simon Fraser.
3752
3753         No new tests because there is no behavior change.
3754
3755         * CMakeLists.txt:
3756         * Configurations/FeatureDefines.xcconfig:
3757         * DerivedSources.cpp:
3758         * DerivedSources.make:
3759         * WebCore.xcodeproj/project.pbxproj:
3760         * css/CSSAllInOne.cpp:
3761         * css/CSSFontFaceLoadEvent.cpp: Removed.
3762         * css/CSSFontFaceLoadEvent.h: Removed.
3763         * css/CSSFontFaceLoadEvent.idl: Removed.
3764         * dom/EventNames.in:
3765         * page/FrameView.cpp:
3766         (WebCore::FrameView::performPostLayoutTasks):
3767         * page/RuntimeEnabledFeatures.h:
3768         (WebCore::RuntimeEnabledFeatures::setFontLoadEventsEnabled): Deleted.
3769         (WebCore::RuntimeEnabledFeatures::fontLoadEventsEnabled): Deleted.
3770
3771 2017-05-23  Chris Dumez  <cdumez@apple.com>
3772
3773         Unreviewed, roll out r215229
3774
3775         It caused CachedScripts in MemoryCache to be reused with different encodings
3776         even though CachedScript potentially has already decoded data or cached hash
3777         with a previous encoding.
3778
3779         * loader/TextResourceDecoder.cpp:
3780         (WebCore::TextResourceDecoder::setEncoding):
3781         * loader/TextResourceDecoder.h:
3782         (WebCore::TextResourceDecoder::sawError):
3783         (WebCore::TextResourceDecoder::encodingSet): Deleted.
3784         * loader/cache/CachedCSSStyleSheet.cpp:
3785         (WebCore::CachedCSSStyleSheet::setEncoding):
3786         * loader/cache/CachedResource.cpp:
3787         (WebCore::CachedResource::CachedResource):
3788         * loader/cache/CachedResource.h:
3789         (WebCore::CachedResource::hasUnknownEncoding):
3790         (WebCore::CachedResource::setHasUnknownEncoding):
3791         * loader/cache/CachedResourceLoader.cpp:
3792         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
3793
3794 2017-05-23  Zalan Bujtas  <zalan@apple.com>
3795
3796         ASSERTION FAILED: !renderer().view().needsLayout() while running media/video-main-content-autoplay.html
3797         https://bugs.webkit.org/show_bug.cgi?id=172476
3798
3799         Reviewed by Simon Fraser.
3800
3801         This patch decouples the layout call logic from the post layout task timer setup.
3802         Just because we are switching over to asynchronous performPostLayoutTasks() it should not stop us from
3803         running layout on a dirty tree (we could encounter a forced layout (which sets m_postLayoutTasksTimer active)
3804         and a subsequent tree mutation during performPostLayoutTasks()). 
3805
3806         There are a few different ways to end up here:
3807         root layout is done -> call performPostLayoutTasks() synchronously -> 
3808         1. tree stays clean -> no action needed.
3809         2. tree gets dirty -> setup performPostLayoutTasks timer -> run nested layout -> since m_postLayoutTasksTimer is active()
3810         we don't try to run performPostLayoutTasks() while in the nested layout and we return with a clean tree.         
3811
3812         * page/FrameView.cpp:
3813         (WebCore::FrameView::layout):
3814
3815 2017-05-23  Wenson Hsieh  <wenson_hsieh@apple.com>
3816
3817         Multiple links should be inserted separately when performing data interaction
3818         https://bugs.webkit.org/show_bug.cgi?id=172489
3819         <rdar://problem/31510832>
3820
3821         Reviewed by Dan Bernstein.
3822
3823         In WebContentReader, URLs are currently always inserted inline. When inserting multiple items, this causes
3824         adjacent links to be inserted on a single line with no break, which is undesirable. To address this, when
3825         appending links from additional items to the existing document fragment in WebContentReader, insert a new space
3826         prior to inserting the anchor element.
3827
3828         New unit test: DataInteractionTests.ExternalSourceMultipleURLsToContentEditable
3829
3830         * editing/ios/EditorIOS.mm:
3831         (WebCore::Editor::WebContentReader::addFragment):
3832
3833         Tweak to add all children of the new fragment, rather than just the first child.
3834
3835         (WebCore::Editor::WebContentReader::readURL):
3836
3837 2017-05-23  Sam Weinig  <sam@webkit.org>
3838
3839         [WebIDL] Remove some unnecessary specialization for enum types
3840         https://bugs.webkit.org/show_bug.cgi?id=172482
3841
3842         Reviewed by Chris Dumez.
3843
3844         - Removes convertEnumeration template function and generated specialization.
3845           convert<IDLEnumeration<T>> now does the entire check, and can have specialized
3846           exceptions.
3847         - Treats enums more like all other types, removing enum specific code in the
3848           generator.
3849
3850         Also fixes some order of exception bugs as the convertEnumeration<T> implementations
3851         were not correctly catching exceptions thrown in parseEnumeration<T>.
3852
3853         * bindings/js/JSDOMConvertEnumeration.h:
3854         (WebCore::Converter<IDLEnumeration<T>>::convert):
3855         Remove convertEnumeration and move implementation to convert. Add ExceptionThrower
3856         parameter to retain argument conversion exception specialization and allow future
3857         specialization for other contexts.
3858
3859         * bindings/js/JSSubtleCryptoCustom.cpp:
3860         (WebCore::jsSubtleCryptoFunctionImportKeyPromise):
3861         (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
3862         (WebCore::jsSubtleCryptoFunctionWrapKeyPromise):
3863         (WebCore::jsSubtleCryptoFunctionUnwrapKeyPromise):
3864         Switch from convertEnumeration<T> to convert<IDLEnumeration<T>>.
3865
3866         * bindings/scripts/CodeGeneratorJS.pm:
3867         (GetArgumentExceptionFunction):
3868         Add (really move from GenerateParametersCheck) enum specific argument conversion exception.
3869
3870         (PassArgumentExpression):
3871         Allow the enum specific code for attributes to remain by explicitly checking the context.
3872         Attribute setters use parseEnumeration<T> explicitly, as WebIDL mandates slightly different
3873         behavior, specially that they don't throw.
3874
3875         (GenerateEnumerationImplementationContent):
3876         (GenerateEnumerationHeaderContent):
3877         Remove convertEnumeration<T>.
3878
3879         (GenerateParametersCheck):
3880         Remove entire branch devoted to enums. The main parameter check is now mature enough
3881         to handle them.
3882
3883         (JSValueToNative):
3884         Like in PassArgumentExpression, we need to retain the specialize behavior for attributes.
3885         Before, JSValueToNative was only called for enums with a context of IDLAttribute or IDLDictionaryMember,
3886         but now that we use if IDLArguments as well, it makes more sense to make this check in terms
3887         of the odd man out, IDLAttribute.
3888
3889         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
3890         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
3891         * bindings/scripts/test/JS/JSTestObj.cpp:
3892         * bindings/scripts/test/JS/JSTestObj.h:
3893         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
3894         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
3895         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp:
3896         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.h:
3897         Update test results.
3898
3899 2017-05-23  Romain Bellessort  <romain.bellessort@crf.canon.fr>
3900
3901         [Readable Streams API] Align respondInClosedState with spec
3902         https://bugs.webkit.org/show_bug.cgi?id=172288
3903
3904         Reviewed by Chris Dumez.
3905
3906         Two changes are implemented in this patch:
3907         - Change #1: An issue was reported to GH [1] while working on respondInClosedState 
3908         implementation. This issue has now been fixed, and this patch aligns implementation 
3909         with spec [2].
3910         - Change #2: In addition, this patch also fixes a bug that went unnoticed as code 
3911         is not yet reachable (usage of controller.@reader is not valid and is therefore 
3912         replaced by controller.@controlledReadableStream.@reader).
3913
3914         [1] https://github.com/whatwg/streams/issues/686
3915         [2] https://streams.spec.whatwg.org/#readable-byte-stream-controller-respond-in-closed-state
3916
3917         No added test as:
3918         - Change #1 does not change behavior;
3919         - Change #2 is not testable as the code is not yet reachable.
3920
3921         * Modules/streams/ReadableByteStreamInternals.js:
3922         (readableByteStreamControllerRespondInClosedState): Aligned with spec.
3923
3924 2017-05-22 Emilio Cobos Álvarez  <ecobos@igalia.com>
3925
3926         Add a RuntimeEnabledFeature for display: contents, defaulted to false.
3927         https://bugs.webkit.org/show_bug.cgi?id=171984
3928
3929         Reviewed by Antti Koivisto.
3930
3931         The "defaulted to false" is not only because there are spec issues,
3932         but because I ran the WPT suite, and there was a fair amount of
3933         crashes and messed render trees.
3934
3935         Tests: imported/w3c/web-platform-tests/innerText/getter.html
3936
3937         * css/StyleResolver.cpp:
3938         (WebCore::StyleResolver::adjustRenderStyle):
3939         * page/RuntimeEnabledFeatures.h:
3940         (WebCore::RuntimeEnabledFeatures::setDisplayContentsEnabled):
3941         (WebCore::RuntimeEnabledFeatures::displayContentsEnabled):
3942
3943 2017-05-22  Myles C. Maxfield  <mmaxfield@apple.com>
3944
3945         Update font-style's implementation in the font selection algorithm
3946         https://bugs.webkit.org/show_bug.cgi?id=169453
3947
3948         Reviewed by Simon Fraser.
3949
3950         Previously, we were treating "font-style: oblique" exactly the same as "font-style: italic".
3951         These values were parsed to the same internal data type. However, variation fonts may have two
3952         distinct axes: 'slnt' and 'ital'. Therefore, we need to keep a bool of state which represents
3953         which of these two axes we should be setting when we apply font variations. We can do this by
3954         making the "font-style" parser a "custom" parser. The implementation of these custom functions
3955         will set both the italic value on the FontDescription as well as this extra bool.
3956
3957         We don't, however, want to treat these values as distinct for the purposese of font selection.
3958         The fact that we treat oblique fonts the same as italic fonts is a feature, not a bug. Therefore,
3959         the font selection algorithm is not made aware of this distinction. This is why we don't want to
3960         package up the bool and FontSelectionValue into a class: font selection only cares about the
3961         FontSelectionValue, so conceptually they shouldn't be joined. (The FontSelectionValue already
3962         exists within a collection of all the things font selection needs to know about.)
3963
3964         Now that there is this extra bit of state on the FontDescription, we can do a little better when
3965         computing the result of getComputedStyle(). Previously, we were always returning "italic" even
3966         when "oblique" was specified. Now, we can return the correct one. However, this extra bit of
3967         state is not kept on the CSSFontFace (because it doesn't need to be), which means we can only
3968         improve the computed style of an element, rather than the cssText of an @font-face rule.
3969
3970         Test: fast/text/font-style-parse.html
3971
3972         * css/CSSComputedStyleDeclaration.cpp:
3973         (WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
3974         (WebCore::fontStyleFromStyle):
3975         (WebCore::fontShorthandValueForSelectionProperties):
3976         * css/CSSComputedStyleDeclaration.h:
3977         * css/CSSFontFaceSet.h:
3978         * css/CSSProperties.json:
3979         * css/FontFace.cpp:
3980         (WebCore::FontFace::style):
3981         * css/FontSelectionValueInlines.h:
3982         (WebCore::fontStyleKeyword):
3983         * css/StyleBuilderConverter.h:
3984         (WebCore::StyleBuilderConverter::convertFontStyle): Deleted.
3985         * css/StyleBuilderCustom.h:
3986         (WebCore::StyleBuilderCustom::applyInitialFontStyle):
3987         (WebCore::StyleBuilderCustom::applyInheritFontStyle):
3988         (WebCore::StyleBuilderCustom::applyValueFontStyle):
3989         * platform/graphics/FontCache.h:
3990         (WebCore::FontDescriptionKey::makeFlagsKey):
3991         * platform/graphics/FontDescription.cpp:
3992         (WebCore::FontDescription::FontDescription):
3993         * platform/graphics/FontDescription.h:
3994         (WebCore::FontDescription::shouldUseItalicVariationAxis):
3995         (WebCore::FontDescription::setShouldUseItalicVariationAxis):
3996         (WebCore::FontDescription::operator==):
3997         (WebCore::FontCascadeDescription::initialShouldUseItalicVariationAxis):
3998         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3999         (WebCore::preparePlatformFont):
4000 &n