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