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