c7f36dce3e66f142bbfc21315d99f92e1451ee0f
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-03-30  Brent Fulgham  <bfulgham@apple.com>
2
3         Remove unused MediaControlsApple implementation
4         https://bugs.webkit.org/show_bug.cgi?id=170258
5         <rdar://problem/31331056>
6
7         Reviewed by Eric Carlson.
8
9         Remove dead code related to old media controls. We switched to HTML5-based media controls
10         several years ago.
11
12         No new tests. Removing this dead code should have no change in behavior.
13
14         * WebCore.xcodeproj/project.pbxproj: Remove unused files.
15         * dom/EventListener.h: Remove unused event type.
16         * html/shadow/MediaControlsApple.cpp: Removed.
17         * html/shadow/MediaControlsApple.h: Removed.
18
19 2017-03-30  Fujii Hironori  <Hironori.Fujii@sony.com>
20
21         [WinCairo] ImageCairoWin.cpp: error C2660: 'WebCore::BitmapImage::draw': function does not take 6 arguments
22         https://bugs.webkit.org/show_bug.cgi?id=170275
23
24         Reviewed by Said Abou-Hallawa.
25
26         Apply the similar change of ImageCGWin.cpp of r214450 to ImageCairoWin.cpp.
27
28         * platform/graphics/win/ImageCairoWin.cpp:
29         (WebCore::BitmapImage::getHBITMAPOfSize): Pass DecodingMode::Synchronous to Image::draw().
30         (WebCore::BitmapImage::drawFrameMatchingSourceSize): Ditto.
31
32 2017-03-27  Sergio Villar Senin  <svillar@igalia.com>
33
34         [css-grid] Clamp the number of autorepeat tracks
35         https://bugs.webkit.org/show_bug.cgi?id=170120
36
37         Reviewed by Manuel Rego Casasnovas.
38
39         As suggested by the specs we do clamp the maximum number of tracks per grid in order to
40         minimize potential OOM situations. However we were not considering the case of the recently
41         added auto repeat syntax. Abnormally huge values for the width/height on the grid container
42         could lead to a number of auto repeat tracks higher than the maximum.
43
44         A new API was added to Internals in order to test limits without having to create huge
45         grids. This new API allows clients to set an arbitrary limit to the number of tracks. The
46         addition of this new API forced us to add GridPosition.cpp to the project to define the
47         global variable we use for testing. We took the chance to move part of the implementation
48         from the header file to the source file.
49
50         Last but not least, several new ASSERTs were added to Grid.cpp implementation to ensure that
51         we do not surpass the grid track limits.
52
53         Test: fast/css-grid-layout/grid-auto-repeat-huge-grid.html
54
55         * CMakeLists.txt:
56         * WebCore.xcodeproj/project.pbxproj:
57         * css/parser/CSSPropertyParser.cpp:
58         (WebCore::consumeGridTrackRepeatFunction):
59         * rendering/Grid.cpp:
60         (WebCore::Grid::ensureGridSize): Added ASSERT.
61         (WebCore::Grid::setSmallestTracksStart): Ditto.
62         (WebCore::Grid::setAutoRepeatTracks): Ditto.
63         (WebCore::Grid::setAutoRepeatEmptyColumns): Ditto.
64         (WebCore::Grid::setAutoRepeatEmptyRows): Ditto.
65         * rendering/RenderGrid.cpp:
66         (WebCore::RenderGrid::clampAutoRepeatTracks): New method.
67         (WebCore::RenderGrid::placeItemsOnGrid): Clamp the number of auto repeat tracks before
68         passing them to the Grid.
69         * rendering/RenderGrid.h:
70         * rendering/style/GridArea.h:
71         (WebCore::GridSpan::GridSpan):
72         * rendering/style/GridPosition.cpp: Added.
73         (WebCore::GridPosition::setExplicitPosition):
74         (WebCore::GridPosition::setAutoPosition):
75         (WebCore::GridPosition::setSpanPosition):
76         (WebCore::GridPosition::setNamedGridArea):
77         (WebCore::GridPosition::integerPosition):
78         (WebCore::GridPosition::namedGridLine):
79         (WebCore::GridPosition::spanPosition):
80         (WebCore::GridPosition::operator==):
81         * rendering/style/GridPosition.h:
82         (WebCore::GridPosition::shouldBeResolvedAgainstOppositePosition):
83         (WebCore::GridPosition::max):
84         (WebCore::GridPosition::min):
85         (WebCore::GridPosition::setMaxPositionForTesting):
86         (WebCore::GridPosition::setExplicitPosition): Deleted.
87         (WebCore::GridPosition::setAutoPosition): Deleted.
88         (WebCore::GridPosition::setSpanPosition): Deleted.
89         (WebCore::GridPosition::setNamedGridArea): Deleted.
90         (WebCore::GridPosition::integerPosition): Deleted.
91         (WebCore::GridPosition::namedGridLine): Deleted.
92         (WebCore::GridPosition::spanPosition): Deleted.
93         (WebCore::GridPosition::operator==): Deleted.
94         * rendering/style/GridPositionsResolver.cpp:
95         (WebCore::GridPositionsResolver::explicitGridColumnCount):
96         (WebCore::GridPositionsResolver::explicitGridRowCount):
97         * testing/Internals.cpp:
98         (WebCore::Internals::setGridMaxTracksLimit):
99         * testing/Internals.h:
100         * testing/Internals.idl:
101
102 2017-03-29  Ryosuke Niwa  <rniwa@webkit.org>
103
104         Disconnecting a HTMLObjectElement does not always unload its content document
105         https://bugs.webkit.org/show_bug.cgi?id=169606
106
107         Reviewed by Andy Estes.
108
109         When removing a node, we first disconnect all subframes then update the focused element as we remove each child.
110         However, when the removed element is a focused object element with a content document, removeFocusedNodeOfSubtree
111         can update the style tree synchronously inside Document::setFocusedElement, and reload the document.
112
113         Avoid this by instantiating a SubframeLoadingDisabler on the parent of the focused element.
114
115         Test: fast/dom/removing-focused-object-element.html
116
117         * dom/Document.cpp:
118         (WebCore::Document::removeFocusedNodeOfSubtree):
119
120 2017-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
121
122         Migrate to kCTFontCSSWidthAttribute
123         https://bugs.webkit.org/show_bug.cgi?id=170265
124
125         Reviewed by Darin Adler.
126
127         Previously, we were mapping from Core Text widths to CSS widths in WebKit.
128         However, on some OSes, Core Text can directly tell us what the CSS width
129         value is.
130
131         No new tests because there is no behavior change.
132
133         * platform/graphics/cocoa/FontCacheCoreText.cpp:
134         (WebCore::getCSSAttribute):
135         (WebCore::capabilitiesForFontDescriptor):
136         * platform/spi/cocoa/CoreTextSPI.h:
137
138 2017-03-28  Simon Fraser  <simon.fraser@apple.com>
139
140         Make it possible to dump touch event regions for testing
141         https://bugs.webkit.org/show_bug.cgi?id=170209
142         <rdar://problem/31309258>
143
144         Reviewed by Tim Horton.
145
146         Expose internals.touchEventRectsForEvent() and internals.passiveTouchEventListenerRects(), which
147         fetch data via Page.
148
149         Because the regions are normally updated on a timer, we have to force an eager update via Document::updateTouchEventRegions().
150
151         Test: fast/events/touch/ios/touch-event-regions.html
152
153         * page/Page.cpp:
154         (WebCore::Page::nonFastScrollableRects):
155         (WebCore::Page::touchEventRectsForEvent):
156         (WebCore::Page::passiveTouchEventListenerRects):
157         * page/Page.h:
158         * testing/Internals.cpp:
159         (WebCore::Internals::touchEventRectsForEvent):
160         (WebCore::Internals::passiveTouchEventListenerRects):
161         * testing/Internals.h:
162         * testing/Internals.idl:
163
164 2017-03-29  Zalan Bujtas  <zalan@apple.com>
165
166         RenderBlockFlow::addFloatsToNewParent should check if float is already added to the object list.
167         https://bugs.webkit.org/show_bug.cgi?id=170259
168         <rdar://problem/31300584>
169
170         Reviewed by Simon Fraser.
171
172         r210145 assumed that m_floatingObjects would simply ignore the floating box if it was already in the list.  
173
174         Test: fast/block/float/placing-multiple-floats-crash.html
175
176         * rendering/RenderBlockFlow.cpp:
177         (WebCore::RenderBlockFlow::addFloatsToNewParent):
178
179 2017-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
180
181         Try to normalize variation ranges
182         https://bugs.webkit.org/show_bug.cgi?id=170119
183
184         Unreviewed.
185
186         Addressing post-review comment.
187
188         * platform/graphics/cocoa/FontCacheCoreText.cpp:
189         (WebCore::isGXVariableFont):
190
191 2017-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
192
193         Try to normalize variation ranges
194         https://bugs.webkit.org/show_bug.cgi?id=170119
195
196         Reviewed by Simon Fraser.
197
198         TrueType GX-style variation fonts use one particular scale for values on their
199         weight/width/slope axes - usually the values lie between -1 and 1 on that scale.
200         However, OpenType 1.8-style fonts use the CSS scale for values on these axes.
201         For the purposes of font selection, these values need to lie on the same scale.
202         However, when font selection is completed and the variation values are actually
203         being applied to the fonts, values which lie on the font's actual scale need to
204         be applied. This patch adds normalize*() and denormalize*() functions to perform
205         both of these operations. 
206
207         The conversion itself between the two scales isn't an exact mapping. Mapping
208         slope is just a linear relationship with 0deg <=> 0 and 20deg <=> 1 (as per the
209         CSS Fonts spec). Mapping widths is similar, it uses a 2-component piecewise
210         linear relationship which includes the values given in the Microsoft OpenType
211         spec for the OS/2 table's usWidthClass field. Weights are more difficult, so I
212         plotted the CSS weights and the GX-style weights for every style of San
213         Francisco, saw that the relationship appears to be linear, and ran a linear
214         regression to compute the line equation.
215
216         As for the actual discrimination of determining whether a font is a GX-style
217         font or not, we can use the presence of the 'STAT' table. This table didn't
218         exist when GX fonts were being created, and OpenType 1.8 variable fonts are
219         required to have this table.
220
221         Facebook uses the string ".SFNSText" in their @font-face blocks. This font is
222         a variation font, but uses the GX-style values. Facebook asks us to create
223         this font with a weight of 700, and because the values in the font are around
224         1.0, we were erroneously thinking that the font wasn't bold, so we were then
225         applying synthetic bold. This was causing text on facebook to look fuzzy and
226         ugly.
227
228         Test: fast/text/variations/font-selection-properties-expected.html
229
230         * platform/graphics/cocoa/FontCacheCoreText.cpp:
231         (WebCore::isGXVariableFont):
232         (WebCore::normalizeWeight):
233         (WebCore::normalizeSlope):
234         (WebCore::denormalizeWeight):
235         (WebCore::denormalizeWidth):
236         (WebCore::denormalizeSlope):
237         (WebCore::normalizeWidth):
238         (WebCore::preparePlatformFont): Instead of using FontSelectionValues for the
239         intermediate values, we should use floats instead. This is because
240         FontSelectionValues are fixed-point numbers with the denominator having 2 bits.
241         When using this data type to represent values on the GX scale, which are usually
242         between 0 and 1, you lose a lot of fidelity. Instead, our intermediate
243         calculations should be done with floats, and converted to FontSelectionValues at
244         the end when they are representative of values on the CSS scale.
245         (WebCore::stretchFromCoreTextTraits):
246         (WebCore::fontWeightFromCoreText):
247         (WebCore::extractVariationBounds):
248         (WebCore::variationCapabilitiesForFontDescriptor):
249         (WebCore::capabilitiesForFontDescriptor):
250
251 2017-03-29  Saam Barati  <sbarati@apple.com>
252
253         LinkBuffer and ExecutableAllocator shouldn't have anything to do with VM
254         https://bugs.webkit.org/show_bug.cgi?id=170210
255
256         Reviewed by Mark Lam.
257
258         * cssjit/SelectorCompiler.cpp:
259         (WebCore::SelectorCompiler::compileSelector):
260         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
261
262 2017-03-29  Javier Fernandez  <jfernandez@igalia.com>
263
264         [css-align] Adapt self-alignment properties to the new baseline syntax
265         https://bugs.webkit.org/show_bug.cgi?id=170235
266
267         Reviewed by David Hyatt.
268
269         The baseline-position syntax has changed recently, so we need to update
270         the CSS properties using the old syntax. This patch address only the
271         self-alignment (align-self and justify-self) and default-alignment
272         (align-items and justify-items).
273
274         The content-distribution properties (align-content and justify-content)
275         will be updated in a follow up patch.
276
277         The new baseline syntax is "[first | last ]? baseline" which implies
278         modifying the parsing and computed value logic.
279
280         There are several layout tests affected by this change, so I'll update
281         them accordingly.
282
283         No new tests, just added/modified some cases to the tests we already have using the new baseline values.
284
285         * css/CSSComputedStyleDeclaration.cpp:
286         (WebCore::valueForItemPositionWithOverflowAlignment):
287         * css/CSSValueKeywords.in:
288         * css/StyleBuilderConverter.h:
289         (WebCore::StyleBuilderConverter::convertSelfOrDefaultAlignmentData):
290         * css/parser/CSSPropertyParser.cpp:
291         (WebCore::consumeBaselineKeyword):
292         (WebCore::consumeSelfPositionOverflowPosition):
293
294 2017-03-29  Chris Dumez  <cdumez@apple.com>
295
296         Animated SVG images are not paused in pages loaded in the background
297         https://bugs.webkit.org/show_bug.cgi?id=170043
298         <rdar://problem/31234412>
299
300         Reviewed by Simon Fraser.
301
302         Animated SVG images are not paused in pages loaded in the background. We rely
303         on FrameView::isOffscreen() to stop images animations in background tab (See
304         logic in RenderElement's shouldRepaintForImageAnimation()). This works fine
305         if a tab is visble and then becomes hidden (i.e. by switching to another
306         tab). However, in the case where the tab gets loaded while in the background
307         (e.g. opening link in new background tab, or session restore), then the
308         animations would not be paused, due to FrameView::isOffscreen() erroneously
309         returning false in this case.
310
311         Normally, the following chain of events happens:
312         - Page is visible, we construct a main frame and its FrameView for loading
313           the page. When a FrameView is constructed, we call FrameView::show() to
314           make it visible. Then, if the page becomes non-visible, we call
315           Page::setIsVisibleInternal(false) which calls FrameView::hide(). After
316           that, FrameView::isOffscreen() correctly returns true because we properly
317           called FrameView::hide().
318
319         However, when doing a load while the Page is hidden, the following was
320         happening:
321         - Page is not visible, we call Page::setIsVisibleInternal(false) which tries
322           to call FrameView::hide() for the main frame but it does not have a FrameView
323           yet (because the load has not started). We start the load and end up creating
324           a FrameView. The FrameView constructor was calling FrameView::show()
325           unconditionally, thus making the FrameView think is visible, even though its
326           page isn't. At this point, FrameView::isOffscreen() was returning false
327           and animations would keep running, even though the page is not visible.
328
329         To address the issue, we now call FrameView::show() in FrameView::create() only
330         if the Page is actually visible, instead of calling it unconditionally. If the
331         page ever becomes visible, Page::setIsVisibleInternal(true) will be called and
332         it will take care of calling FrameView::show() then.
333
334         Tests: svg/animations/animations-paused-in-background-page-iframe.html
335                svg/animations/animations-paused-in-background-page.html
336
337         * page/FrameView.cpp:
338         (WebCore::FrameView::create):
339
340 2017-03-29  Wenson Hsieh  <wenson_hsieh@apple.com>
341
342         Links with empty hrefs should not be drag sources
343         https://bugs.webkit.org/show_bug.cgi?id=170241
344         <rdar://problem/31305505>
345
346         Reviewed by Tim Horton.
347
348         The m_dragSouceAction member of DragController represents the drag source actions that are available to the
349         document, rather than the available actions given the dragging element. Thus, it is not correct to only check
350         that (m_dragSourceAction & DragSourceActionAttachment) before proceeding down the attachment dragging codepath.
351         This should be additionally guarded with a check that the element being dragged is, in fact, an attachment
352         element.
353
354         New API test (see Tools/ChangeLog).
355
356         * page/DragController.cpp:
357         (WebCore::DragController::startDrag):
358
359 2017-03-29  Jeremy Jones  <jeremyj@apple.com>
360
361         WebVideoFullscreenInterfaceAVKit needs a strong self ref before dispatching to the main thread.
362         https://bugs.webkit.org/show_bug.cgi?id=170129
363
364         Reviewed by David Kilzer.
365
366         No new tests becuase no new behavior.
367
368         Hold a strong reference to WebVideoFullscreenInterfaceAVKit when dispatching to the main thread.
369         Make WebVideoFullscreenInterfaceAVKit safe to retain from non-main thread.
370
371         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
372         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
373         (WebVideoFullscreenInterfaceAVKit::exitFullscreen):
374
375 2017-03-29  Zan Dobersek  <zdobersek@igalia.com>
376
377         [GCrypt] Add a Handle<> class to help with GCrypt object lifetime control
378         https://bugs.webkit.org/show_bug.cgi?id=170238
379
380         Reviewed by Michael Catanzaro.
381
382         The platform-specific CryptoAlgorithmHMAC implementation is modified
383         to showcase the GCrypt::Handle<> use. HandleDeleter<gcry_mac_hd_t>
384         is added accordingly.
385
386         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
387         (WebCore::calculateSignature):
388
389 2017-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
390
391         Variation fonts: Make sure that feature detection and preprocessor macros are right
392         https://bugs.webkit.org/show_bug.cgi?id=169518
393
394         Reviewed by Simon Fraser.
395
396         When I added variable fonts support, I made all OSes parse the newly accepted values,
397         instead of just the OSes which support variable fonts.
398
399         Test: fast/text/font-variations-feature-detection.html
400
401         * css/parser/CSSPropertyParser.cpp:
402         (WebCore::consumeFontStretch):
403         (WebCore::consumeFontStyle):
404         * css/parser/CSSPropertyParserHelpers.cpp:
405         (WebCore::CSSPropertyParserHelpers::divisibleBy100):
406         (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
407
408 2017-03-29  Antoine Quint  <graouts@apple.com>
409
410         [Modern Media Controls] Controls bar may disappear while captions menu is visible (redux)
411         https://bugs.webkit.org/show_bug.cgi?id=170239
412         <rdar://problem/31320685>
413
414         Reviewed by Dean Jackson.
415
416         We did some work in webkit.org/b/168751 to prevent the controls bar from disappearing while the
417         captions menu is visible. But there were two cases where the behavior was not as intended:
418
419             1. the controls bar would hide upon exiting the video.
420             2. clicking on the controls bar while the caption panel is up would hide the controls bar
421                as well as the captions panel.
422
423         Instead of determining that the "userInteractionEnabled" property being set to "false" is indicative
424         of secondary UI, such as the tracks panel, being attached to the controls bar, we now have an
425         explicit property to specify this. Now, when "hasSecondaryUIAttached" is "true", we prevent the
426         controls bar from fading when exiting the media.
427
428         Additionally, when dismissing the tracks panel, we check whether a mouse event lead to this and check
429         if the mouse was positioned over the controls bar. If that is the case, we no longer hide the controls
430         bar and only dismiss the tracks panel.
431
432         Test: media/modern-media-controls/tracks-panel/tracks-panel-controls-bar-remains-visible-after-clicking-over-it.html
433
434         * Modules/modern-media-controls/controls/controls-bar.js:
435         (ControlsBar.prototype.set userInteractionEnabled):
436         (ControlsBar.prototype.handleEvent):
437         (ControlsBar.prototype._autoHideTimerFired):
438         * Modules/modern-media-controls/controls/macos-media-controls.js:
439         (MacOSMediaControls.prototype.showTracksPanel):
440         (MacOSMediaControls.prototype.hideTracksPanel):
441
442 2017-03-29  Antoine Quint  <graouts@apple.com>
443
444         [Modern Media Controls] Volume slider is initially empty
445         https://bugs.webkit.org/show_bug.cgi?id=170237
446         <rdar://problem/31319077>
447
448         Reviewed by Dean Jackson.
449
450         Fixing fallout from https://bugs.webkit.org/show_bug.cgi?id=167935 where we changed the behavior
451         of layout() to happen prior to a commit. In this one instance, we were overriding layout() to run
452         after a commit, so we now override commit(). Otherwise, the <canvas> that we draw the volume slider
453         into would have its "width" and "height" properties set after we drew, which would clear the <canvas>.
454
455         * Modules/modern-media-controls/controls/slider.js:
456         (Slider.prototype.commit):
457         (Slider.prototype.layout): Deleted.
458
459 2017-03-29  Zan Dobersek  <zdobersek@igalia.com>
460
461         [GCrypt] Move over empty GnuTLS-based SUBTLE_CRYPTO implementation files
462         https://bugs.webkit.org/show_bug.cgi?id=170232
463
464         Reviewed by Michael Catanzaro.
465
466         Migrate the GnuTLS SUBTLE_CRYPTO implementation files to the gcrypt/
467         directory. The implementation files themselves are no-op, so this is
468         a simple move-and-rename operation that will enable proceeding with
469         the libgcrypt-based implementation of SUBTLE_CRYPTO functionality.
470
471         No change in behavior. The SUBTLE_CRYPTO feature should build as it
472         did before, and the implementations are empty anyway.
473
474         * PlatformGTK.cmake:
475         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp.
476         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_CFBGnuTLS.cpp.
477         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp.
478         * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp.
479         * crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmECDHGnuTLS.cpp.
480         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmPBKDF2GnuTLS.cpp.
481         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp.
482         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp: This one already exists.
483         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp.
484         * crypto/gcrypt/CryptoAlgorithmRegistryGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmRegistryGnuTLS.cpp.
485         * crypto/gcrypt/CryptoKeyECGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoKeyECGnuTLS.cpp.
486         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoKeyRSAGnuTLS.cpp.
487         * crypto/gcrypt/SerializedCryptoKeyWrapGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/SerializedCryptoKeyWrapGnuTLS.cpp.
488         * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp: Removed.
489
490 2017-03-29  Zan Dobersek  <zdobersek@igalia.com>
491
492         [GnuTLS] Remove unused CryptoDigestGnuTLS, CryptoAlgorithmHMACGnuTLS implementation files
493         https://bugs.webkit.org/show_bug.cgi?id=170231
494
495         Reviewed by Michael Catanzaro.
496
497         * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp: Removed. The GCrypt counterpart
498         is already in use, and this file wasn't even being built.
499
500 2017-03-29  Youenn Fablet  <youenn@apple.com>
501
502         Move DTMF WebRTC extension behind its own compile flag
503         https://bugs.webkit.org/show_bug.cgi?id=170226
504
505         Reviewed by Eric Carlson.
506
507         Moving RTCDTMFSender and RTCDTMFToneChangeEvent behinf a WEB_RTC_DTMF compile flag.
508         This compile flag is not set on any supported platform yet.
509         Disabling related test and updated test expectations.
510
511         * Modules/mediastream/RTCDTMFSender.cpp:
512         * Modules/mediastream/RTCDTMFSender.h:
513         * Modules/mediastream/RTCDTMFSender.idl:
514         * Modules/mediastream/RTCDTMFToneChangeEvent.cpp:
515         * Modules/mediastream/RTCDTMFToneChangeEvent.h:
516         * Modules/mediastream/RTCDTMFToneChangeEvent.idl:
517         * dom/EventNames.in:
518         * dom/EventTargetFactory.in:
519         * platform/mediastream/RTCDTMFSenderHandler.h:
520         * platform/mediastream/RTCDTMFSenderHandlerClient.h:
521
522 2017-03-29  Antoine Quint  <graouts@apple.com>
523
524         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
525         https://bugs.webkit.org/show_bug.cgi?id=168409
526         <rdar://problem/30799198>
527
528         Reviewed by Dean Jackson.
529
530         Add a new internals setting to opt into ScriptedAnimationController logging through DOM events dispatched
531         through the document. This should allow this flaky test to get information as to why the frame isn't
532         firing when it times out.
533
534         * dom/ScriptedAnimationController.cpp:
535         (WebCore::ScriptedAnimationController::suspend):
536         (WebCore::ScriptedAnimationController::resume):
537         (WebCore::ScriptedAnimationController::addThrottlingReason):
538         (WebCore::ScriptedAnimationController::removeThrottlingReason):
539         (WebCore::ScriptedAnimationController::registerCallback):
540         (WebCore::ScriptedAnimationController::cancelCallback):
541         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
542         (WebCore::ScriptedAnimationController::scheduleAnimation):
543         (WebCore::ScriptedAnimationController::dispatchLoggingEventIfRequired):
544         * dom/ScriptedAnimationController.h:
545         * page/Settings.in:
546         * testing/InternalSettings.cpp:
547         (WebCore::InternalSettings::resetToConsistentState):
548         (WebCore::InternalSettings::shouldDispatchRequestAnimationFrameEvents):
549         (WebCore::InternalSettings::setShouldDispatchRequestAnimationFrameEvents):
550         * testing/InternalSettings.h:
551         * testing/InternalSettings.idl:
552
553 2017-03-28  Youenn Fablet  <youenn@apple.com>
554
555         [WebRTC] After r214441 addIceCandidate no longer accepts an RTCIceCandidateInit dictionary
556         https://bugs.webkit.org/show_bug.cgi?id=170192
557
558         Reviewed by Jon Lee.
559
560         Covered by updated tests.
561
562         * Modules/mediastream/RTCIceCandidate.idl: Candidate is no longer a required field in RTCIceCandidateInit.
563         * Modules/mediastream/RTCPeerConnectionInternals.js: Reworking defaultsToNull to handle both undefined and null cases.
564
565 2017-03-28  Youenn Fablet  <youenn@apple.com>
566
567         LibWebRTCProvider should allow setting encoder and decoder factories
568         https://bugs.webkit.org/show_bug.cgi?id=170212
569
570         Reviewed by Eric Carlson.
571
572         No change of behavior.
573         Adding the ability to set encoder/decoder libwebrtc factory getters.
574         Setting default cocoa factory getters.
575
576         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
577         (WebCore::staticFactoryAndThreads):
578         (WebCore::initializePeerConnectionFactoryAndThreads):
579         (WebCore::LibWebRTCProvider::setDecoderFactoryGetter):
580         (WebCore::LibWebRTCProvider::setEncoderFactoryGetter):
581         (WebCore::LibWebRTCProvider::setPeerConnectionFactory):
582         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
583
584 2017-03-27  Brent Fulgham  <bfulgham@apple.com>
585
586         Only attach Attributes to a given element one time
587         https://bugs.webkit.org/show_bug.cgi?id=170125
588         <rdar://problem/31279676>
589
590         Reviewed by Chris Dumez.
591
592         Attach the attribute node to the Element before calling 'setAttributeInternal', since that method may cause
593         arbitrary JavaScript events to fire. 
594
595         Test: fast/dom/Attr/only-attach-attr-once.html
596
597         * dom/Element.cpp:
598         (WebCore::Element::attachAttributeNodeIfNeeded): Added.
599         (WebCore::Element::setAttributeNode): Use new method. Revise to attach attribute before calling 'setAttributeInternal'. 
600         (WebCore::Element::setAttributeNodeNS): Ditto.
601         * dom/Element.h:
602
603 2017-03-28  Youenn Fablet  <youenn@apple.com>
604
605         Stop RTCDataChannel when closing page
606         https://bugs.webkit.org/show_bug.cgi?id=170166
607
608         Reviewed by Eric Carlson.
609
610         Test: webrtc/datachannel/datachannel-gc.html
611
612         Making RTCDataChannel an ActiveDOMObject.
613         Closing the data channel backend and freeing upon close and stop.
614
615         * Modules/mediastream/RTCDataChannel.cpp:
616         (WebCore::RTCDataChannel::create):
617         (WebCore::RTCDataChannel::RTCDataChannel):
618         (WebCore::RTCDataChannel::close):
619         (WebCore::RTCDataChannel::stop):
620         * Modules/mediastream/RTCDataChannel.h:
621         * Modules/mediastream/RTCDataChannel.idl:
622         * Modules/mediastream/RTCPeerConnection.h:
623
624 2017-03-28  Myles C. Maxfield  <mmaxfield@apple.com>
625
626         Ranges for variation font properties are not enforced
627         https://bugs.webkit.org/show_bug.cgi?id=169979
628
629         Reviewed by David Hyatt.
630
631         The spec specifies that:
632         - Font weights less than or equal to 0, or greater than or equal to 1000 are parse errors
633         - Font stretch values less than or equal to 0% are parse errors
634         - Font style values less than or equal to -90deg or greater than or equal to 90deg are parse errors
635
636         Test: fast/text/variations/out-of-bounds-selection-properties.html
637
638         * css/parser/CSSPropertyParser.cpp:
639         (WebCore::consumeFontWeightRange):
640         (WebCore::fontStretchIsWithinRange):
641         (WebCore::consumeFontStretch):
642         (WebCore::consumeFontStretchRange):
643         (WebCore::fontStyleIsWithinRange):
644         (WebCore::consumeFontStyle):
645         (WebCore::consumeFontStyleRange):
646
647 2017-03-28  Andy Estes  <aestes@apple.com>
648
649         [iOS] Crash in -[WebPreviewLoader failed] when running http/tests/multipart/policy-ignore-crash.php
650         https://bugs.webkit.org/show_bug.cgi?id=170197
651         <rdar://problem/30314067>
652
653         Reviewed by Brady Eidson.
654
655         If QuickLook conversion fails, we call ResourceLoader::didFail() with the NSError from
656         QuickLook, which will call back into PreviewLoader::didFail(). We only care about network
657         failures in PreviewLoader, not conversion failures, so check if
658         m_finishedLoadingDataIntoConverter is set before continuing (like we do in
659         PreviewLoader::didFinishLoading()).
660
661         Fixes crash in http/tests/multipart/policy-ignore-crash.php.
662
663         * loader/ios/PreviewLoader.mm:
664         (WebCore::PreviewLoader::didFail):
665
666 2017-03-28  Chris Dumez  <cdumez@apple.com>
667
668         Audio indicator is visible on uni-watch.com but there is no audible audio
669         https://bugs.webkit.org/show_bug.cgi?id=170200
670         <rdar://problem/31289132>
671
672         Reviewed by Eric Carlson.
673
674         Cherry-pick the following patch from Blink by <rtoy@chromium.org>:
675         - https://chromium.googlesource.com/chromium/src.git/+/439de5bb2a31384666db1a0e2dadb2b97d2f3ce4
676
677         When the gain of a GainNode is 0 or 1, the operation of the node can
678         be optimized.  When gain = 1, just copy the input to the output.  When
679         gain = 0; just zero out the output.  Currently, the input is
680         multiplied by the gain to produce the output.  This just optimizes the
681         multiplication away for the two special cases.
682
683         Also, have the GainNode set the silence hint if the gain is 0.
684
685         And fix a bug in processIfNecessary when unsilenceOutputs was causing the
686         silence hint to be cleared after the node's process method was finished
687         and may have set the silence hint.  The processing should come after
688         unsilenceOutputs to preserve any hints from processing the node.
689
690         * Modules/webaudio/AudioNode.cpp:
691         (WebCore::AudioNode::processIfNecessary):
692         * Modules/webaudio/GainNode.cpp:
693         (WebCore::GainNode::process):
694         * platform/audio/AudioBus.cpp:
695         (WebCore::AudioBus::copyWithGainFrom):
696
697 2017-03-28  Chris Dumez  <cdumez@apple.com>
698
699         Animated SVG images are not paused when outside viewport
700         https://bugs.webkit.org/show_bug.cgi?id=170155
701         <rdar://problem/31288893>
702
703         Reviewed by Antti Koivisto.
704
705         Make sure animated SVG images get paused when outside the viewport,
706         similarly to what was already done for animated GIF images. Also
707         make sure they are paused when they no longer have any renderers
708         using them.
709
710         Tests: svg/animations/animated-svg-image-outside-viewport-paused.html
711                svg/animations/animated-svg-image-removed-from-document-paused.html
712
713         * loader/cache/CachedImage.cpp:
714         (WebCore::CachedImage::didAddClient):
715         Restart the animation whenever a new CachedImage client is added. This
716         will cause us the re-evaluate if the animation should run. The animation
717         will pause again if the new renderer is not inside the viewport.
718
719         (WebCore::CachedImage::animationAdvanced):
720         Add a flag to newImageAnimationFrameAvailable() so that the renderers can
721         let us know if we can pause the animation. Pause the animation if all no
722         renderer requires it (i.e. they are all outside the viewport, or there
723         are no renderers).
724
725         * loader/cache/CachedImageClient.h:
726         (WebCore::CachedImageClient::newImageAnimationFrameAvailable):
727         By default, the CachedImageClients allow pausing. Only renderer will
728         potentially prevent pausing if they are inside the viewport.
729
730         * platform/graphics/BitmapImage.cpp:
731         (WebCore::BitmapImage::isAnimating):
732         * platform/graphics/BitmapImage.h:
733         * platform/graphics/Image.h:
734         (WebCore::Image::isAnimating):
735         Add isAnimating() flag on Image for layout testing purposes.
736
737         * rendering/RenderElement.cpp:
738         (WebCore::RenderElement::newImageAnimationFrameAvailable):
739         Set canPause flag to true if the renderer is not inside the viewport.
740
741         (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded):
742         Call startAnimation() if the renderer is now visible to resume SVG
743         animations. Repainting is enough for GIF animations but not for SVG
744         animations, we have to explicitly resume them.
745
746         * rendering/RenderElement.h:
747         * rendering/RenderView.cpp:
748         (WebCore::RenderView::addRendererWithPausedImageAnimations):
749         (WebCore::RenderView::removeRendererWithPausedImageAnimations):
750         (WebCore::RenderView::resumePausedImageAnimationsIfNeeded):
751         * rendering/RenderView.h:
752         Store CachedImages with the renderers that have paused animations.
753         This is required for SVG where we need to explicitly resume the
754         animation on the CachedImage when the renderer becomes visible
755         again. Having access to the Image will also allow us to do smarter
756         visibility checks in RenderElement's shouldRepaintForImageAnimation(),
757         in the future.
758
759         * svg/SVGSVGElement.cpp:
760         (WebCore::SVGSVGElement::hasActiveAnimation):
761         * svg/SVGSVGElement.h:
762         Add hasActiveAnimation() method.
763
764         * svg/graphics/SVGImage.cpp:
765         (WebCore::SVGImage::startAnimation):
766         Check that animations are paused before starting them. This avoid
767         jumping due to unnecessary calls to rootElement->setCurrentTime(0).
768
769         (WebCore::SVGImage::isAnimating):
770         Add isAnimating() method for layout tests purposes.
771
772         * svg/graphics/SVGImage.h:
773         * svg/graphics/SVGImageClients.h:
774         Call animationAdvanced() on the observer instead of the generic
775         changedInRect() when the SVGImage is animating. This way, we go
776         through the same code path as GIF animations and we end up calling
777         CachedImage::animationAdvanced() which calls newImageAnimationFrameAvailable()
778         on RenderElement, which determines if the animation should keep
779         running or not.
780
781         * testing/Internals.cpp:
782         (WebCore::Internals::isImageAnimating):
783         * testing/Internals.h:
784         * testing/Internals.idl:
785         Add layout testing infrastructure.
786
787 2017-03-28  Antti Koivisto  <antti@apple.com>
788
789         Missing render tree position invalidation when tearing down renderers for display:contents subtree
790         https://bugs.webkit.org/show_bug.cgi?id=170199
791         <rdar://problem/31260856>
792
793         Reviewed by Zalan Bujtas.
794
795         Test: fast/shadow-dom/slot-renderer-teardown.html
796
797         * style/RenderTreeUpdater.cpp:
798         (WebCore::RenderTreeUpdater::updateElementRenderer):
799
800             Invalidate the render tree position in case we do a teardown for an element without renderer.
801
802 2017-03-28  Ryan Haddad  <ryanhaddad@apple.com>
803
804         Unreviewed, rolling out r214485.
805
806         This change caused LayoutTest crashes.
807
808         Reverted changeset:
809
810         "Stop RTCDataChannel when closing page"
811         https://bugs.webkit.org/show_bug.cgi?id=170166
812         http://trac.webkit.org/changeset/214485
813
814 2017-03-28  Anders Carlsson  <andersca@apple.com>
815
816         ApplePayShippingContactUpdate.idl shouldn't have status field
817         https://bugs.webkit.org/show_bug.cgi?id=170202
818         rdar://problem/31307106
819
820         Reviewed by Beth Dakin.
821
822         * Modules/applepay/ApplePaySession.cpp:
823         (WebCore::convertAndValidate):
824         If status isn't set, infer it based on whether there are errors present or not.
825
826         * Modules/applepay/ApplePayShippingContactUpdate.h:
827         Make status optional here; it's still used by the old code path.
828
829         * Modules/applepay/ApplePayShippingContactUpdate.idl:
830         Remove status here.
831
832 2017-03-28  Brian Burg  <bburg@apple.com>
833
834         Web Inspector: Add "Disable Caches" option that only applies to the inspected page while Web Inspector is open
835         https://bugs.webkit.org/show_bug.cgi?id=169865
836         <rdar://problem/31250573>
837
838         Reviewed by Joseph Pecoraro.
839
840         Rewrite the network agent's command for disabling resource caching to use Page::setResourceCachingEnabled.
841         The old implementation was doing weird stuff like setting no-cache headers and evicting the
842         contents of the memory cache, neither of which is correct. The new approach has no side effects
843         on the network, disk, or memory cache so it can be turned on temporarily without causing problems.
844
845         New tests:
846         - http/tests/inspector/network/set-resource-caching-disabled-disk-cache.html
847         - http/tests/inspector/network/set-resource-caching-disabled-memory-cache.html
848
849         * inspector/InspectorNetworkAgent.h:
850         * inspector/InspectorNetworkAgent.cpp:
851         (WebCore::InspectorNetworkAgent::setCacheDisabled): Deleted.
852         (WebCore::InspectorNetworkAgent::setResourceCachingDisabled): Added.
853         Implement new command.
854
855         (WebCore::InspectorNetworkAgent::willSendRequest):
856         (WebCore::InspectorNetworkAgent::mainFrameNavigated):
857         Remove crufty attempts to break caches. I believe these are intended to defeat caching
858         proxies and similar middlemen, but this is just as likely to cause unusual loading behavior.
859
860         * page/Page.h:
861         (WebCore::Page::isResourceCachingDisabled):
862         (WebCore::Page::setResourceCachingDisabledOverride):
863         Add an override setting so that Web Inspector's override does not mess up the value
864         of isResourceCachingDisabled that may have been set by a WebKit API client.
865
866 2017-03-28  Youenn Fablet  <youenn@apple.com>
867
868         Fix addIceCandidate after r214441
869         https://bugs.webkit.org/show_bug.cgi?id=170146
870
871         Reviewed by Chris Dumez.
872
873         Covered by rebased test.
874
875         * Modules/mediastream/RTCPeerConnection.js:
876         (addIceCandidate): Setting function length to 1 and throwing if no parameter is passed.
877
878 2017-03-28  Youenn Fablet  <youenn@apple.com>
879
880         Stop RTCDataChannel when closing page
881         https://bugs.webkit.org/show_bug.cgi?id=170166
882
883         Reviewed by Eric Carlson.
884
885         Test: webrtc/datachannel/datachannel-gc.html
886
887         Making RTCDataChannel an ActiveDOMObject.
888         Closing the data channel backend and freeing upon close and stop.
889
890         * Modules/mediastream/RTCDataChannel.cpp:
891         (WebCore::RTCDataChannel::create):
892         (WebCore::RTCDataChannel::RTCDataChannel):
893         (WebCore::RTCDataChannel::close):
894         (WebCore::RTCDataChannel::stop):
895         * Modules/mediastream/RTCDataChannel.h:
896         * Modules/mediastream/RTCDataChannel.idl:
897         * Modules/mediastream/RTCPeerConnection.h:
898
899 2017-03-27  Simon Fraser  <simon.fraser@apple.com>
900
901         Enhance the touch region debug overlay to show regions for the different events
902         https://bugs.webkit.org/show_bug.cgi?id=170162
903
904         Reviewed by Tim Horton.
905
906         Have NonFastScrollableRegionOverlay use a different color for each region in EventTrackingRegions,
907         and to draw a legend showing what the colors mean.
908         
909         On Mac, this overlay displays the non-fast scrollable region (which we don't keep separate from the wheel event
910         region).
911
912         * page/DebugPageOverlays.cpp:
913         (WebCore::NonFastScrollableRegionOverlay::updateRegion):
914         (WebCore::touchEventRegionColors):
915         (WebCore::drawRightAlignedText):
916         (WebCore::NonFastScrollableRegionOverlay::drawRect):
917         (WebCore::RegionOverlay::drawRect):
918         (WebCore::RegionOverlay::drawRegion):
919
920 2017-03-27  Simon Fraser  <simon.fraser@apple.com>
921
922         Make sure the non-fast scrolling debug overlay is correctly updated
923         https://bugs.webkit.org/show_bug.cgi?id=170142
924
925         Reviewed by Tim Horton.
926
927         AsyncScrollingCoordinator::frameViewEventTrackingRegionsChanged() is called on a timer
928         from Document code, so the existing DebugPageOverlays::didLayout() call at the end
929         of FrameView::layout() wasn't sufficient to keep the non-fast scrollable region up-to-date
930         on iOS.
931
932         * page/scrolling/AsyncScrollingCoordinator.cpp:
933         (WebCore::AsyncScrollingCoordinator::frameViewEventTrackingRegionsChanged):
934
935 2017-03-28  Antoine Quint  <graouts@apple.com>
936
937         [Modern Media Controls] AirPlay placard text looks bad on 1x displays
938         https://bugs.webkit.org/show_bug.cgi?id=170183
939         <rdar://problem/30663416>
940
941         Reviewed by Dean Jackson.
942
943         Use subpixel antialiasing for all text in modern media controls.
944
945         * Modules/modern-media-controls/controls/media-controls.css:
946         (.media-controls-container,):
947
948 2017-03-28  Antoine Quint  <graouts@apple.com>
949
950         [Modern Media Controls] Improve appearance of tracks panel on macOS
951         https://bugs.webkit.org/show_bug.cgi?id=168929
952         <rdar://problem/30741589>
953
954         Reviewed by Eric Carlson.
955
956         We use a solid color for the focus state that matches the style used on macOS
957         and blend the titles the same way we blend other non-solid labels in the controls bar.
958
959         * Modules/modern-media-controls/controls/tracks-panel.css:
960         (.tracks-panel section):
961         (.tracks-panel section > h3):
962         (.tracks-panel section > ul > li:focus):
963
964 2017-03-28  Yoav Weiss  <yoav@yoav.ws>
965
966         Add a warning for unused link preloads.
967         https://bugs.webkit.org/show_bug.cgi?id=165670
968
969         Reviewed by Youenn Fablet.
970
971         Tests: http/tests/preload/single_download_preload_headers_charset.php
972                http/tests/preload/unused_preload_warning.html
973
974         * dom/Document.cpp:
975         (WebCore::Document::prepareForDestruction): Stop the timer once the document is destructed.
976         * loader/LinkPreloadResourceClients.h: Add shouldMarkAsReferenced overides for the LinkPreloadResourceClient classes.
977         * loader/cache/CachedResource.cpp:
978         (WebCore::CachedResource::addClientToSet): Make sure LinkPreloadResourceClients don't set resource to be referenced.
979         * loader/cache/CachedResourceClient.h:
980         (WebCore::CachedResourceClient::shouldMarkAsReferenced): Make sure that ResourceClients mark preloads as referenced by default.
981         * loader/cache/CachedResourceLoader.cpp:
982         (WebCore::CachedResourceLoader::CachedResourceLoader): Initialize timer.
983         (WebCore::CachedResourceLoader::~CachedResourceLoader): Stop timer.
984         (WebCore::CachedResourceLoader::documentDidFinishLoadEvent): Trigger a timer if preloads weren't cleared at load time.
985         (WebCore::CachedResourceLoader::stopUnusedPreloadsTimer): Stop the timer.
986         (WebCore::CachedResourceLoader::warnUnusedPreloads): Iterate over m_preloads and issue a warning for non-referenced preloads.
987         * loader/cache/CachedResourceLoader.h:
988         * page/DOMWindow.cpp:
989         (WebCore::DOMWindow::willDetachDocumentFromFrame): Clear Resource Timing buffer when document detaches, to avoid test flakiness.
990
991 2017-03-28  Antoine Quint  <graouts@apple.com>
992
993         REGRESSION: Double-clicking the captions button while the captions popover is open prevents the popover from being opened again
994         https://bugs.webkit.org/show_bug.cgi?id=170171
995         <rdar://problem/31095500>
996
997         Reviewed by Dean Jackson.
998
999         We used to consider that the tracks panel was presented as long as it had a parent, but since we were using for the animated
1000         transition to complete before actually removing the panel from the node hierarchy, consecutive calls to hide then present
1001         would fail to present the panel. We now use a private instance variable to track the presented state which is set immediately
1002         as presentInParent() and hide() are called.
1003
1004         Test: media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button.html
1005
1006         * Modules/modern-media-controls/controls/tracks-panel.js:
1007         (TracksPanel.prototype.get presented):
1008         (TracksPanel.prototype.presentInParent):
1009         (TracksPanel.prototype.hide):
1010
1011 2017-03-28  Aaron Chu  <aaron_chu@apple.com>
1012
1013         AX: Media controls should be able to be re-activated after faded away
1014         https://bugs.webkit.org/show_bug.cgi?id=170048
1015         <rdar://problem/30157179>
1016
1017         Reviewed by Antoine Quint.
1018
1019         Added a "foucsin" listener for the controls bar so that when an element
1020         within fires a "focusin" event, the controls bar reappears if it is faded.
1021
1022         Test: media/modern-media-controls/media-controls/media-controls-appear-when-focus.html
1023
1024         * Modules/modern-media-controls/controls/controls-bar.js:
1025         (ControlsBar.prototype.handleEvent):
1026
1027 2017-03-28  Antoine Quint  <graouts@apple.com>
1028
1029         [Modern Media Controls] Improve media documents across macOS, iPhone and iPad
1030         https://bugs.webkit.org/show_bug.cgi?id=169145
1031         <rdar://problem/17048858>
1032
1033         Reviewed by Dean Jackson.
1034
1035         There were a variety of issues with media documents, some longstanding, and some specifically
1036         about modern media controls.
1037
1038         One issue was that fullscreen and picture-in-picture buttons would show for audio media documents,
1039         due to using a <video> element to load the audio file. We now have additional logic in MediaController
1040         to identify if the loaded media is really an audio file, and using this information to hide the
1041         fullscreen and picture-in-picture buttons.
1042
1043         Another issue was that we would inject style in MediaDocument.cpp that was specific to modern media
1044         controls when we could have the modern-media-controls module injected CSS handle this styling. We now
1045         use the injected style in the shadow root to size media documents based on the device characteristics
1046         and ensuring that page styles are overridden.
1047
1048         We also simplify how MediaDocument.cpp sets the source of the media element to simply use the "src"
1049         attribute and not a <source> element.
1050
1051         Finally, we introduce a MediaDocumentController class that is instantiated when we're dealing with
1052         a media document to hide the controls while we determine the type of media we're loading (audio vs.
1053         video) in order to apply the appropriate styling without flashes.
1054
1055         As a result of the new styles applied by the modern-media-controls module, media documents have a
1056         similar behavior on macOS and iPad, where we only enforce a min-width for video allowing them
1057         to play at their natural size otherwise, and enforcing a fixed width for audio. On iPhone however,
1058         we want to always play the media at full width, with some padding in the case of audio.
1059
1060         Tests: media/modern-media-controls/fullscreen-support/fullscreen-support-disabled-video-with-audio-tracks-only.html
1061                media/modern-media-controls/media-documents/ipad/media-document-audio-ios-sizing.html
1062                media/modern-media-controls/media-documents/ipad/media-document-video-ios-sizing.html
1063                media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html
1064                media/modern-media-controls/media-documents/media-document-audio-mac-sizing.html
1065                media/modern-media-controls/media-documents/media-document-video-ios-sizing.html
1066                media/modern-media-controls/media-documents/media-document-video-mac-sizing.html
1067                media/modern-media-controls/pip-support/pip-support-disabled-video-with-audio-tracks-only.html
1068
1069         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
1070         (:host(audio) .media-controls.ios.inline > .controls-bar:before,):
1071         (:host(audio) .media-controls.ios.inline > .controls-bar:before): Deleted.
1072         * Modules/modern-media-controls/controls/macos-media-controls.css:
1073         (:host(audio) .media-controls.mac.inline > .controls-bar,):
1074         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint,):
1075         (:host(audio) .media-controls.mac.inline > .controls-bar): Deleted.
1076         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint): Deleted.
1077         * Modules/modern-media-controls/controls/media-document.css: Copied from Source/WebCore/Modules/modern-media-controls/controls/macos-media-controls.css.
1078         (:host(.media-document)):
1079         (:host(.media-document.ready)):
1080         (:host(.media-document.audio.mac)):
1081         (:host(.media-document.audio.ipad)):
1082         (:host(.media-document.audio.iphone)):
1083         (:host(.media-document.video.mac)):
1084         (:host(.media-document.video.ipad)):
1085         (:host(.media-document.video.iphone)):
1086         * Modules/modern-media-controls/js-files:
1087         * Modules/modern-media-controls/media/fullscreen-support.js:
1088         (FullscreenSupport.prototype.syncControl):
1089         (FullscreenSupport):
1090         * Modules/modern-media-controls/media/media-controller.js:
1091         (MediaController):
1092         (MediaController.prototype.get isAudio):
1093         * Modules/modern-media-controls/media/media-document-controller.js: Copied from Source/WebCore/Modules/modern-media-controls/media/fullscreen-support.js.
1094         (MediaDocumentController):
1095         (MediaDocumentController.prototype.handleEvent):
1096         (MediaDocumentController.prototype._mediaDocumentHasMetadata):
1097         (MediaDocumentController.prototype._mediaDocumentHasSize):
1098         * Modules/modern-media-controls/media/pip-support.js:
1099         (PiPSupport.prototype.syncControl):
1100         (PiPSupport):
1101         * html/MediaDocument.cpp:
1102         (WebCore::MediaDocumentParser::createDocumentStructure):
1103
1104 2017-03-28  Myles C. Maxfield  <mmaxfield@apple.com>
1105
1106         Follow-up patch after r214364.
1107         https://bugs.webkit.org/show_bug.cgi?id=168895
1108
1109         Unreviewed.
1110
1111         * platform/graphics/FontDescription.cpp:
1112         (WebCore::FontDescription::FontDescription):
1113
1114 2017-03-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
1115
1116         REGRESSION(213764): Large images should not be decoded asynchronously when they are drawn on a canvas
1117         https://bugs.webkit.org/show_bug.cgi?id=169771
1118
1119         Reviewed by Simon Fraser.
1120
1121         Sometimes we have to draw the image immediately like when a canvas calls  
1122         drawImage. In this case we have to decode the image synchronously to guarantee
1123         the drawing. Other times we need to decode with the native size of the image.
1124         The animated images have to be decoded with native size always. Otherwise
1125         the frame cache will be messed up if the same image is animated with different
1126         sizes. Currently we always decode asynchronously with sizeForDrawing. We need
1127         to decouple the decoding mode from the sizeForDrawing.
1128
1129         This patch introduce the DecodingOptions class which can store and compare the
1130         following four cases:
1131             -- Synchronous: The frame has be decoded with native size only.
1132             -- Asynchronous + anySize: This is passed from the Image::draw() callers.
1133             -- Asynchronous + fullSize: The image has to be decoded with its full size.
1134             -- Asynchronous + sizeForDrawing: The image can be decoded with sizeForDrawing unless
1135             it was decoded with either a full size or sizeForDrawing which is larger than the
1136             requested sizeForDrawing.
1137             
1138         A new argument of type DecodingMode will be added to Image::draw() function.
1139         Only when the drawing comes from the render tree, it will be Asynchronous.
1140         Otherwise it will be Synchronous.
1141
1142         Tests: fast/images/animated-image-different-dest-size.html
1143                fast/images/async-image-background-image.html
1144                fast/images/async-image-canvas-draw-image.html
1145
1146         * WebCore.xcodeproj/project.pbxproj:
1147         * platform/graphics/BitmapImage.cpp:
1148         (WebCore::BitmapImage::frameImageAtIndexCacheIfNeeded): Gets the frame image, cache it synchronously if
1149         the current one is invalid. frameImageAtIndex() returns whatever stored in the cache.
1150         (WebCore::BitmapImage::nativeImage): Call frameImageAtIndexCacheIfNeeded() instead of frameImageAtIndex().
1151         (WebCore::BitmapImage::nativeImageForCurrentFrame): Ditto.
1152         (WebCore::BitmapImage::nativeImageOfSize): Ditto.
1153         (WebCore::BitmapImage::framesNativeImages): Ditto.
1154         (WebCore::BitmapImage::draw): Change the logic to do the following:
1155         -- The animated image has to be decoded with its full size.
1156         -- The animated image expects the current frame to be ready for drawing.
1157         -- The large image decoding does not need to call internalStartAnimation().
1158         -- The large image has to request async image decoding but draw the current one if it exists.
1159         (WebCore::BitmapImage::drawPattern): Draw the pattern synchronously.
1160         (WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImages): Delete the call to shouldUseAsyncDecodingForTesting()
1161         since it is only applied for animated images.
1162         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages): Call shouldUseAsyncDecodingForAnimatedImageForTesting().
1163         (WebCore::BitmapImage::internalStartAnimation): Request decoding with the full size.
1164         (WebCore::BitmapImage::advanceAnimation): Call shouldUseAsyncDecodingForAnimatedImageForTesting().
1165         (WebCore::BitmapImage::internalAdvanceAnimation): Assert the current frame is not being decoding asynchronously for any size.
1166         (WebCore::BitmapImage::frameImageAtIndex): Deleted. Moved to the header file but with a new purpose: return
1167         the current frame from the frame cache as is; do not cache a new one.
1168         (WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImage): Deleted. Function was renamed to shouldUseAsyncDecodingForLargeImages.
1169         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImage): Deleted. Function was renamed to shouldUseAsyncDecodingForAnimatedImages.
1170         * platform/graphics/BitmapImage.h:
1171         * platform/graphics/CrossfadeGeneratedImage.cpp:
1172         (WebCore::CrossfadeGeneratedImage::draw): Add a new argument of type DecodingMode.
1173         * platform/graphics/CrossfadeGeneratedImage.h:
1174         * platform/graphics/DecodingOptions.h: Added.
1175         (WebCore::DecodingOptions::DecodingOptions): Default constructor: Synchronous mode.
1176         (WebCore::DecodingOptions::operator==): Compares two DecodingOptions for equality.
1177         (WebCore::DecodingOptions::isSynchronous): Is the frame decoded synchronously?
1178         (WebCore::DecodingOptions::isAsynchronous): Is the frame decoded asynchronously?
1179         (WebCore::DecodingOptions::isAsynchronousCompatibleWith): Is this DecodingOptions compatible with another one?
1180         (WebCore::DecodingOptions::hasFullSize): Is the decoding mode asynchronous but for the image full size?
1181         (WebCore::DecodingOptions::hasSizeForDrawing): Is this decoding mode asynchronous but for a sizeForDrawing?
1182         (WebCore::DecodingOptions::sizeForDrawing): Returns the sizeForDrawing. m_decodingModeOrSize has to hold an IntSize.
1183         (WebCore::DecodingOptions::maxDimension): Moved form ImageFrame.cpp.
1184         (WebCore::DecodingOptions::has): A helper function.
1185         (WebCore::DecodingOptions::hasDecodingMode): Does m_decodingModeOrSize a DecodingMode?
1186         (WebCore::DecodingOptions::hasSize): Does m_decodingModeOrSize an IntSize?
1187         * platform/graphics/GeneratedImage.h: Add a new argument of type DecodingMode.
1188         * platform/graphics/GradientImage.cpp:
1189         (WebCore::GradientImage::draw): Ditto.
1190         * platform/graphics/GradientImage.h: Ditto.
1191         * platform/graphics/GraphicsContext.cpp:
1192         (WebCore::GraphicsContext::drawImage): Pass the ImagePaintingOptions::m_DecodingMode to Image::draw().
1193         * platform/graphics/GraphicsContext.h:
1194         (WebCore::ImagePaintingOptions::ImagePaintingOptions): Add a new member of type DecodingMode to ImagePaintingOptions.
1195         * platform/graphics/Image.cpp:
1196         (WebCore::Image::drawTiled): Pass DecodingMode::Synchronous to Image::draw().
1197         * platform/graphics/Image.h: Add a new argument of type DecodingMode to Image::draw().
1198         * platform/graphics/ImageFrame.cpp:
1199         (WebCore::ImageFrame::operator=): Replace m_sizeForDrawing by m_decodingOptions.
1200         (WebCore::ImageFrame::hasNativeImage): Check if m_nativeImage is valid and the subsamplingLevels match.
1201         (WebCore::ImageFrame::hasFullSizeNativeImage): Checks hasNativeImage() and whether the image frame was
1202         decoded for the image full size.
1203         (WebCore::ImageFrame::hasDecodedNativeImageCompatibleWithOptions): Checks hasNativeImage() and the DecodingOptions match.
1204         (WebCore::maxDimension): Deleted. Moved to DecodingOptions.h.
1205         (WebCore::ImageFrame::isBeingDecoded): Deleted. The check for having an ImageFrame being decoded is
1206         moved to ImageFrameCache.
1207         (WebCore::ImageFrame::hasValidNativeImage): Deleted. No need to this function.
1208         * platform/graphics/ImageFrame.h:
1209         (WebCore::ImageFrame::hasNativeImage): Add an std::optional<SubsamplingLevel> argument.
1210         (WebCore::ImageFrame::hasFullSizeNativeImage): Checks whether the ImageFrame was decoded for the image full size.
1211         (WebCore::ImageFrame::enqueueSizeForDecoding): Deleted.
1212         (WebCore::ImageFrame::dequeueSizeForDecoding): Deleted.
1213         (WebCore::ImageFrame::clearSizeForDecoding): Deleted.
1214         (WebCore::ImageFrame::isBeingDecoded): Deleted.
1215         (WebCore::ImageFrame::sizeForDrawing): Deleted.
1216         (WebCore::ImageFrame::hasDecodedNativeImage): Deleted.
1217         The logic of knowing whether an ImageFrame is being decoded is moved to ImageFrameCache.
1218         * platform/graphics/ImageFrameCache.cpp:
1219         (WebCore::ImageFrameCache::cacheFrameMetadataAtIndex): Caches the metadata of an ImageFrame. If the NativeImage
1220         was decoded for a sizeForDrawing, the size of the ImageFrame will be the nativeImageSize(). Otherwise, the
1221         frameSizeAtIndex() will be called.
1222         (WebCore::ImageFrameCache::cacheFrameNativeImageAtIndex): Cache a new NativeImage which involves caching new
1223         metadata and updating the memory cache. No need to check if the existing native image is valid or not for the
1224         DecodingOptions. Actually it would be a bug if it happens. This is why cacheNativeImageForFrameRequest() asserts
1225         !frame.hasAsyncNativeImage() before calling cacheFrameNativeImageAtIndex().
1226         (WebCore::ImageFrameCache::cacheAsyncFrameNativeImageAtIndex): Cache new NativeImage which was decoded asynchronously.
1227         (WebCore::ImageFrameCache::startAsyncDecodingQueue): Call cacheAsyncFrameNativeImageAtIndex() instead of
1228         cacheNativeImageForFrameRequest() for clarity.
1229         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Call hasAsyncNativeImage() instead of hasValidNativeImage()
1230         Call frameIsDecodingCompatibleWithOptionsAtIndex() instead of frame.isBeingDecoded(). Replace the call to enqueueSizeForDecoding()
1231         by appending the same ImageFrameRequest to m_frameCommitQueue.
1232         (WebCore::ImageFrameCache::isAsyncDecodingQueueIdle): Use m_frameCommitQueue to answer the question whether the decodingQueue is idle.
1233         (WebCore::ImageFrameCache::stopAsyncDecodingQueue): Use m_frameCommitQueue to loop through all the ImageFrames which are currently being decoded.
1234         (WebCore::ImageFrameCache::frameAtIndexCacheIfNeeded): For getting the metadata, this function needs a valid frame. If it is requested
1235         to decode the nativeImage, it has to do it synchronously.
1236         (WebCore::ImageFrameCache::singlePixelSolidColor): Don't cache the frame if it is an animated image or the size is not a single pixel.
1237         (WebCore::ImageFrameCache::frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex): Use m_frameCommitQueue to answer the question whether an ImageFrame
1238         is being decoded and is compatible with DecodingOptions.
1239         (WebCore::ImageFrameCache::frameHasFullSizeNativeImageAtIndex): Calls ImageFrame::hasFullNativeImage() for a frame. 
1240         (WebCore::ImageFrameCache::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex): Calls ImageFrame::hasDecodedNativeImageCompatibleWithOptions() for a frame.
1241         (WebCore::ImageFrameCache::frameImageAtIndex): Returns the current NativeImage without caching.
1242         (WebCore::ImageFrameCache::frameImageAtIndexCacheIfNeeded): Returns the current NativeImage but cache it synchronously if needed.
1243         (WebCore::ImageFrameCache::setFrameNativeImageAtIndex): Deleted.
1244         (WebCore::ImageFrameCache::setFrameMetadataAtIndex): Deleted.
1245         (WebCore::ImageFrameCache::replaceFrameNativeImageAtIndex): Deleted.
1246         (WebCore::ImageFrameCache::frameIsBeingDecodedAtIndex): Deleted.
1247         (WebCore::ImageFrameCache::frameHasImageAtIndex): Deleted.
1248         (WebCore::ImageFrameCache::frameHasValidNativeImageAtIndex): Deleted.
1249         (WebCore::ImageFrameCache::frameHasDecodedNativeImage): Deleted.
1250         * platform/graphics/ImageFrameCache.h: Two ImageFrameRequest queues will be used.
1251         -- The existing one m_frameRequestQueue which is shared between the main thread and decoding thread. The requests will be
1252         dequeued from it before starting the decoding. The decoded NativeImage will be cached only on the main thread. The decoding
1253         thread is not blocked by the callOnMainThread(). This means there might be multiple ImageFrameRequests which were dequeued
1254         while their NativeImages have not been cached yet.
1255         -- A new one m_frameCommitQueue which is track all the ImageFrameRequests whose NativeImages have not been cached yet.
1256         (WebCore::ImageFrameCache::frameAtIndexCacheIfNeeded): Be explicit about caching the image frame. frameImageAtIndex()
1257         returns the current image frame without caching. frameAtIndexCacheIfNeeded(). returns the current image frame but cache
1258         it if needed.
1259         (WebCore::ImageFrameCache::ImageFrameRequest::operator==): Compares two ImageFrameRequests for equality.
1260         * platform/graphics/ImageSource.cpp:
1261         (WebCore::ImageSource::frameImageAtIndexCacheIfNeeded): 
1262         (WebCore::ImageSource::frameImageAtIndex): Deleted.
1263         * platform/graphics/ImageSource.h:
1264         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex): Change the type of the argument from IntSize to be const std::optional<IntSize>.
1265         (WebCore::ImageSource::frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex): Rename of frameIsBeingDecodedAtIndex(). Replace the argument of type
1266         std::optional<IntSize> by an argument of type DecodingOptions.
1267         (WebCore::ImageSource::frameHasFullSizeNativeImageAtIndex): A wrapper around the ImageFrameCache function.
1268         (WebCore::ImageSource::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex): Ditto.
1269         (WebCore::ImageSource::frameImageAtIndex): Ditto.
1270         (WebCore::ImageSource::frameIsBeingDecodedAtIndex): Deleted.
1271         (WebCore::ImageSource::frameHasValidNativeImageAtIndex): Deleted.
1272         (WebCore::ImageSource::frameHasDecodedNativeImage): Deleted.
1273         * platform/graphics/NamedImageGeneratedImage.cpp:
1274         (WebCore::NamedImageGeneratedImage::draw): Add a new argument of type DecodingMode.
1275         * platform/graphics/NamedImageGeneratedImage.h: Ditto.
1276         * platform/graphics/cairo/ImageBufferCairo.cpp:
1277         (WebCore::ImageBuffer::draw): Add a new argument of type DecodingMode.
1278         * platform/graphics/cg/ImageDecoderCG.cpp:
1279         (WebCore::ImageDecoder::createFrameImageAtIndex): Replace the sizeForDrawing argument by a DecodingMode argument. Add a new handling
1280         for decoding asynchronously for the image full size.
1281         * platform/graphics/cg/ImageDecoderCG.h: Change the prototype of the function.
1282         * platform/graphics/cg/PDFDocumentImage.cpp:
1283         (WebCore::PDFDocumentImage::draw): Add a new argument of type DecodingMode.
1284         * platform/graphics/cg/PDFDocumentImage.h:
1285         * platform/graphics/win/ImageCGWin.cpp:
1286         (WebCore::BitmapImage::getHBITMAPOfSize): Pass DecodingMode::Synchronous to Image::draw().
1287         (WebCore::BitmapImage::drawFrameMatchingSourceSize): Ditto.
1288         * platform/graphics/win/ImageDecoderDirect2D.cpp:
1289         (WebCore::ImageDecoder::createFrameImageAtIndex): Replace the sizeForDrawing argument by a DecodingMode argument.
1290         * platform/graphics/win/ImageDecoderDirect2D.h: Change the prototype of the function.
1291         * platform/image-decoders/ImageDecoder.cpp: 
1292         (WebCore::ImageDecoder::createFrameImageAtIndex): Replace the sizeForDrawing argument by a DecodingMode argument.
1293         * platform/image-decoders/ImageDecoder.h: Change the prototype of the function.
1294         * rendering/RenderBoxModelObject.cpp:
1295         (WebCore::RenderBoxModelObject::paintFillLayerExtended): Draw the background image asynchronously if the image size is large.
1296         * rendering/RenderImage.cpp:
1297         (WebCore::RenderImage::paintIntoRect): Draw the background image element asynchronously if the image size is large.
1298         * svg/graphics/SVGImage.cpp:
1299         (WebCore::SVGImage::drawForContainer): Pass DecodingMode::Synchronous to draw().
1300         (WebCore::SVGImage::nativeImageForCurrentFrame): Ditto.
1301         (WebCore::SVGImage::nativeImage): Ditto.
1302         (WebCore::SVGImage::draw): Add a new argument of type DecodingMode.
1303         * svg/graphics/SVGImage.h: Change the prototype of the function.
1304         * svg/graphics/SVGImageForContainer.cpp:
1305         (WebCore::SVGImageForContainer::draw): Add a new argument of type DecodingMode.
1306         * svg/graphics/SVGImageForContainer.h: Change the prototype of the function.
1307
1308 2017-03-27  Youenn Fablet  <youenn@apple.com>
1309
1310         Activate release libwebrtc logging when WebRTC log channel is on
1311         https://bugs.webkit.org/show_bug.cgi?id=169659
1312
1313         Reviewed by Alex Christensen.
1314
1315         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
1316         (WebCore::initializePeerConnectionFactoryAndThreads):
1317
1318 2017-03-27  Antti Koivisto  <antti@apple.com>
1319
1320         Move visibleInViewportStateChanged callback from Element to render tree
1321         https://bugs.webkit.org/show_bug.cgi?id=170039
1322
1323         Reviewed by Zalan Bujtas.
1324
1325         Make it easier to use from the render tree.
1326
1327         Also for simplicity move the bits from RenderObject rare data to RenderElement.
1328         There is plenty of space there.
1329
1330         * dom/Element.h:
1331         (WebCore::Element::isVisibleInViewportChanged): Deleted.
1332         * html/HTMLMediaElement.h:
1333         * rendering/RenderElement.cpp:
1334         (WebCore::RenderElement::RenderElement):
1335         (WebCore::RenderElement::willBeDestroyed):
1336         (WebCore::RenderElement::registerForVisibleInViewportCallback):
1337         (WebCore::RenderElement::unregisterForVisibleInViewportCallback):
1338         (WebCore::RenderElement::setVisibleInViewportState):
1339         (WebCore::RenderElement::visibleInViewportStateChanged):
1340         * rendering/RenderElement.h:
1341         (WebCore::RenderElement::visibleInViewportState):
1342         * rendering/RenderObject.cpp:
1343         (WebCore::RenderObject::setIsRegisteredForVisibleInViewportCallback): Deleted.
1344         (WebCore::RenderObject::setVisibleInViewportState): Deleted.
1345         * rendering/RenderObject.h:
1346         (WebCore::RenderObject::hasOutlineAutoAncestor):
1347         (WebCore::RenderObject::RenderObjectRareData::RenderObjectRareData):
1348         (WebCore::RenderObject::isRegisteredForVisibleInViewportCallback): Deleted.
1349         (WebCore::RenderObject::visibleInViewportState): Deleted.
1350         * rendering/RenderVideo.cpp:
1351         (WebCore::RenderVideo::visibleInViewportStateChanged):
1352         * rendering/RenderVideo.h:
1353         * rendering/RenderView.cpp:
1354         (WebCore::RenderView::updateVisibleViewportRect):
1355
1356 2017-03-27  Youenn Fablet  <youenn@apple.com>
1357
1358         addIceCandidate should not throw if passed null or undefined
1359         https://bugs.webkit.org/show_bug.cgi?id=170118
1360
1361         Reviewed by Eric Carlson.
1362
1363         Covered by updated test.
1364
1365         A null/undefined candidate passed to addIceCandidate means end of Ice candidate..
1366
1367         * Modules/mediastream/PeerConnectionBackend.cpp:
1368         (WebCore::PeerConnectionBackend::addIceCandidate):
1369         * Modules/mediastream/PeerConnectionBackend.h:
1370         (WebCore::PeerConnectionBackend::endOfIceCandidates):
1371         * Modules/mediastream/RTCPeerConnection.cpp:
1372         (WebCore::RTCPeerConnection::queuedAddIceCandidate):
1373         * Modules/mediastream/RTCPeerConnection.h:
1374         * Modules/mediastream/RTCPeerConnection.idl:
1375         * Modules/mediastream/RTCPeerConnection.js:
1376         (addIceCandidate):
1377
1378 2017-03-27  Antti Koivisto  <antti@apple.com>
1379
1380         Allow the page to render before <link> stylesheet tags in body
1381         https://bugs.webkit.org/show_bug.cgi?id=149157
1382         <rdar://problem/24658830>
1383
1384         Reviewed by Simon Fraser.
1385
1386         Currently we block style and renderer building completely if document has any loading
1387         stylesheets. In case a script queries something layout dependent we construct the render
1388         tree with whatever style we have but block painting in it.
1389
1390         This patch changes behavior so that a loading stylesheet in body only blocks rendering for elements
1391         that are after it. The expectation is that such stylesheets rarely affect elements before them
1392         and the elements can be rendered without causing ugly visible styling changes.
1393
1394         The patch replaces the old flash-of-unstyled-content (FOUC) preventation mechanism with a more
1395         fine-grained one. Paint blocking is now done on per-renderer basis with based on isNonFinal flag in
1396         RenderStyle.
1397
1398         For stylesheets in head the behavior should be largely unchanged.
1399
1400         Test: http/tests/incremental/stylesheet-body-incremental-rendering.html
1401
1402         * css/StyleResolver.cpp:
1403         (WebCore::StyleResolver::pseudoStyleRulesForElement):
1404         * dom/Document.cpp:
1405         (WebCore::Document::Document):
1406         (WebCore::Document::resolveStyle):
1407         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
1408
1409             Remove the old FOUC preventation state tracking.
1410
1411         (WebCore::Document::shouldScheduleLayout):
1412         (WebCore::Document::didRemoveAllPendingStylesheet):
1413
1414             Repaints will now get triggered by the normal style mechanism.
1415
1416         * dom/Document.h:
1417         (WebCore::Document::hasNodesWithNonFinalStyle):
1418         (WebCore::Document::setHasNodesWithNonFinalStyle):
1419
1420             Track if we need to recompute the style later because non-final or unstyled elements.
1421
1422         (WebCore::Document::didLayoutWithPendingStylesheets): Deleted.
1423         (WebCore::Document::hasNodesWithPlaceholderStyle): Deleted.
1424         (WebCore::Document::setHasNodesWithPlaceholderStyle): Deleted.
1425         * html/HTMLFrameSetElement.cpp:
1426         (WebCore::HTMLFrameSetElement::rendererIsNeeded):
1427         * page/FrameView.cpp:
1428         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty):
1429
1430             Don't qualify as visually non-empty if we have loading stylesheets in head (even if there is
1431             a fouc-prevented render tree).
1432
1433         (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
1434         * rendering/RenderBlock.cpp:
1435         (WebCore::RenderBlock::paintContents):
1436
1437             Instead of a global test, block painting if isNonFinal is set in the renderer's style.
1438
1439         * rendering/RenderLayer.cpp:
1440         (WebCore::shouldSuppressPaintingLayer):
1441         * rendering/style/RenderStyle.cpp:
1442         (WebCore::RenderStyle::changeRequiresRepaint):
1443
1444             The isNonFinal flag prevents painting so we need to trigger repaint when it gets cleared.
1445
1446         * rendering/style/RenderStyle.h:
1447         (WebCore::RenderStyle::isNotFinal):
1448         (WebCore::RenderStyle::setIsNotFinal):
1449         (WebCore::RenderStyle::isPlaceholderStyle): Deleted.
1450         (WebCore::RenderStyle::setIsPlaceholderStyle): Deleted.
1451
1452             There is no need for placeholder styles anymore. Reuse the bit for isNotFinal.
1453
1454         * rendering/style/StyleRareNonInheritedData.cpp:
1455         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
1456         (WebCore::StyleRareNonInheritedData::operator==):
1457         * rendering/style/StyleRareNonInheritedData.h:
1458         * style/StyleScope.cpp:
1459         (WebCore::Style::Scope::analyzeStyleSheetChange):
1460         (WebCore::Style::Scope::updateActiveStyleSheets):
1461         * style/StyleTreeResolver.cpp:
1462         (WebCore::Style::TreeResolver::styleForElement):
1463         (WebCore::Style::TreeResolver::resolveElement):
1464
1465             If we have seens a loading stylesheet and don't have a renderer yet don't style the element.
1466             In case there is a renderer or we are ignoring pending sheets, resolve the style normally
1467             but mark it as non-final.
1468
1469         (WebCore::Style::makePlaceholderStyle): Deleted.
1470
1471 2017-03-27  Myles C. Maxfield  <mmaxfield@apple.com>
1472
1473         Test variation font ranges in the CSS Font Loading API
1474         https://bugs.webkit.org/show_bug.cgi?id=170022
1475
1476         Reviewed by Dean Jackson.
1477
1478         Test: fast/text/variations/font-loading-api-parse-ranges.html
1479
1480         Don't use keywords when reporting font variation range values.
1481
1482         * css/CSSComputedStyleDeclaration.cpp:
1483         (WebCore::ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue):
1484         (WebCore::ComputedStyleExtractor::fontWeightFromStyleValue):
1485         (WebCore::ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue):
1486         (WebCore::ComputedStyleExtractor::fontStretchFromStyleValue):
1487         (WebCore::ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue):
1488         (WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
1489         * css/CSSComputedStyleDeclaration.h:
1490         * css/FontFace.cpp:
1491         (WebCore::FontFace::style):
1492         (WebCore::FontFace::weight):
1493         (WebCore::FontFace::stretch):
1494
1495 2017-03-27  Anders Carlsson  <andersca@apple.com>
1496
1497         Propagate shipping contact update errors
1498         https://bugs.webkit.org/show_bug.cgi?id=170141
1499         rdar://problem/31276576
1500
1501         Reviewed by Tim Horton.
1502
1503         * Modules/applepay/ApplePaySession.cpp:
1504         (WebCore::convertAndValidate):
1505
1506 2017-03-27  Ryan Haddad  <ryanhaddad@apple.com>
1507
1508         Unreviewed, rolling out r214411.
1509
1510         Two of the LayoutTests for this change time out on ios-
1511         simulator.
1512
1513         Reverted changeset:
1514
1515         "[Modern Media Controls] Improve media documents across macOS,
1516         iPhone and iPad"
1517         https://bugs.webkit.org/show_bug.cgi?id=169145
1518         http://trac.webkit.org/changeset/214411
1519
1520 2017-03-27  Antoine Quint  <graouts@apple.com>
1521
1522         [Modern Media Controls] Clicking on the tracks button when the tracks panel is up in a media document pauses the video
1523         https://bugs.webkit.org/show_bug.cgi?id=168517
1524         <rdar://problem/30577636>
1525
1526         Reviewed by Dean Jackson.
1527
1528         We completely turn off default event handling in MediaDocument.cpp since we're implementing the
1529         behavior we expect to pause and resume the video in the modern-media-controls module already. This
1530         gets rid of this odd case where the content would not see the "click" event while the C++ side would
1531         handle it and pause the video.
1532
1533         * Modules/modern-media-controls/media/media-controller.js:
1534         (MediaController):
1535         (MediaController.prototype.handleEvent):
1536         (MediaController.prototype._containerWasClicked): Deleted.
1537         * html/MediaDocument.cpp:
1538         (WebCore::MediaDocument::defaultEventHandler):
1539
1540 2017-03-27  Youenn Fablet  <youenn@apple.com>
1541
1542         Tighten RTCDatachannel creation and parameter getters
1543         https://bugs.webkit.org/show_bug.cgi?id=170081
1544
1545         Reviewed by Eric Carlson.
1546
1547         Covered by updated tests.
1548
1549         Adding some parameter checks when creating data channels.
1550         Making some getters nullable as per the spec.
1551
1552         * Modules/mediastream/RTCDataChannel.h:
1553         * Modules/mediastream/RTCDataChannel.idl:
1554         * Modules/mediastream/RTCPeerConnection.cpp:
1555         (WebCore::RTCPeerConnection::createDataChannel):
1556         * Modules/mediastream/RTCPeerConnection.idl:
1557         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1558         (WebCore::LibWebRTCMediaEndpoint::createDataChannel):
1559         (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
1560         * platform/mediastream/RTCDataChannelHandler.h:
1561         (): Deleted.
1562
1563 2017-03-27  Youenn Fablet  <youenn@apple.com>
1564
1565         Add support for RTCRtpReceiver/RTCRtpSender getParameters
1566         https://bugs.webkit.org/show_bug.cgi?id=170057
1567
1568         Reviewed by Alex Christensen.
1569
1570         Test: webrtc/video-getParameters.html
1571
1572         getParameters returns a dictionary of values taken from libwebrtc RtpReceiverInterface/RtpSenderInrterface objects.
1573         Added a direct link between WebCore RTCRtpReceiver and libwebrtc RtpReceiverInterface object.
1574         Making the link between WebCore RTCRtpSender and libwebrtc RtpSenderInrterface object through
1575         PeerConnectionBackend to keep the current architecture shared with OpenWebRTC.
1576         In the future, we should try to make the link more direct.
1577
1578         Added routines to support the conversion from libwebrtc to WebCore.
1579         Ensured that RTCRtpReceiver is cleaning its backend when being stopped.
1580
1581         * CMakeLists.txt:
1582         * DerivedSources.make:
1583         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1584         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
1585         * Modules/mediastream/PeerConnectionBackend.h:
1586         (WebCore::PeerConnectionBackend::getParameters):
1587         * Modules/mediastream/RTCPeerConnection.cpp:
1588         (WebCore::RTCPeerConnection::doClose):
1589         (WebCore::RTCPeerConnection::getParameters):
1590         * Modules/mediastream/RTCPeerConnection.h:
1591         * Modules/mediastream/RTCRtpParameters.h: Added.
1592         * Modules/mediastream/RTCRtpParameters.idl: Added.
1593         * Modules/mediastream/RTCRtpReceiver.cpp:
1594         (WebCore::RTCRtpReceiver::RTCRtpReceiver):
1595         * Modules/mediastream/RTCRtpReceiver.h:
1596         (WebCore::RTCRtpReceiver::Backend::~Backend):
1597         (WebCore::RTCRtpReceiver::Backend::getParameters):
1598         (WebCore::RTCRtpReceiver::create):
1599         (WebCore::RTCRtpReceiver::stop):
1600         (WebCore::RTCRtpReceiver::setBackend):
1601         (WebCore::RTCRtpReceiver::getParameters):
1602         * Modules/mediastream/RTCRtpReceiver.idl:
1603         * Modules/mediastream/RTCRtpSender.cpp:
1604         (WebCore::RTCRtpSender::create):
1605         (WebCore::RTCRtpSender::RTCRtpSender):
1606         (WebCore::RTCRtpSender::replaceTrack):
1607         (WebCore::RTCRtpSender::getParameters):
1608         * Modules/mediastream/RTCRtpSender.h:
1609         (WebCore::RTCRtpSender::Backend::~Backend):
1610         (WebCore::RTCRtpSender::isStopped):
1611         (WebCore::RTCRtpSender::stop):
1612         * Modules/mediastream/RTCRtpSender.idl:
1613         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1614         (WebCore::LibWebRTCMediaEndpoint::addTrack):
1615         (WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
1616         (WebCore::LibWebRTCMediaEndpoint::OnAddTrack):
1617         (WebCore::LibWebRTCMediaEndpoint::stop):
1618         (WebCore::fillEncodingParameters):
1619         (WebCore::fillHeaderExtensionParameters):
1620         (WebCore::fillCodecParameters):
1621         (WebCore::fillRtpParameters):
1622         (WebCore::RTCRtpReceiverBackend::getParameters):
1623         (WebCore::LibWebRTCMediaEndpoint::getRTCRtpSenderParameters):
1624         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
1625         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1626         (WebCore::LibWebRTCPeerConnectionBackend::notifyAddedTrack):
1627         (WebCore::LibWebRTCPeerConnectionBackend::getParameters):
1628         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1629         * WebCore.xcodeproj/project.pbxproj:
1630         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1631
1632 2017-03-27  Myles C. Maxfield  <mmaxfield@apple.com>
1633
1634         font variation properties don't need to accept numbers
1635         https://bugs.webkit.org/show_bug.cgi?id=169357
1636
1637         Reviewed by Antti Koivisto.
1638
1639         The CSS Fonts level 4 spec stabilized the grammar accepted by font-weight,
1640         font-style, and font-stretch. The changes are that font-style and
1641         font-stretch no longer accept raw numbers, and the @font-face descriptor
1642         ranges are now separated by spaces instead of slashes.
1643
1644         Tests: fast/text/font-selection-font-face-parse.html
1645                fast/text/font-selection-font-loading-api-parse.html
1646                fast/text/font-stretch-parse.html
1647                fast/text/font-style-parse.html
1648                fast/text/variations/font-selection-properties.html
1649
1650         * css/CSSComputedStyleDeclaration.cpp:
1651         (WebCore::ComputedStyleExtractor::fontWeightFromStyleValue):
1652         (WebCore::fontWeightFromStyle):
1653         (WebCore::ComputedStyleExtractor::fontStretchFromStyleValue):
1654         (WebCore::fontStretchFromStyle):
1655         (WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
1656         (WebCore::fontStyleFromStyle):
1657         * css/CSSComputedStyleDeclaration.h:
1658         * css/FontFace.cpp:
1659         (WebCore::FontFace::style):
1660         (WebCore::FontFace::weight):
1661         (WebCore::FontFace::stretch):
1662         (WebCore::rangeIsSingleValue): Deleted.
1663         * css/StyleBuilderConverter.h:
1664         (WebCore::StyleBuilderConverter::convertFontStretchFromValue):
1665         * css/parser/CSSPropertyParser.cpp:
1666         (WebCore::consumeFontWeightRange):
1667         (WebCore::consumeFontStretch):
1668         (WebCore::consumeFontStretchRange):
1669         (WebCore::consumeFontStyle):
1670         (WebCore::consumeFontStyleRange):
1671
1672 2017-03-27  Youenn Fablet  <youenn@apple.com>
1673
1674         Further optimize checkWebRTCAvailability
1675         https://bugs.webkit.org/show_bug.cgi?id=169147
1676
1677         Reviewed by Alex Christensen.
1678
1679         Tested locally by removing libwebrtc.dylib.
1680         Replacing dlopen check by checking an exported symbol, rtc::LogMessage::LogToDebug.
1681         This check is more efficient and accurate. It should work in more configurations than the previous one.
1682
1683         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
1684         (WebCore::isNullFunctionPointer):
1685         (WebCore::LibWebRTCProvider::webRTCAvailable):
1686
1687 2017-03-27  Myles C. Maxfield  <mmaxfield@apple.com>
1688
1689         Implement format specifier for variation fonts
1690         https://bugs.webkit.org/show_bug.cgi?id=169327
1691
1692         Reviewed by Simon Fraser.
1693
1694         Variation fonts require the format("woff-variations"), format("truetype-variations"),
1695         and format("opentype-variations") format specifies in @font-face rules.
1696
1697         Test: fast/text/variations/font-face-format.html
1698
1699         * platform/graphics/mac/FontCustomPlatformData.cpp:
1700         (WebCore::FontCustomPlatformData::supportsFormat):
1701
1702 2017-03-27  Myles C. Maxfield  <mmaxfield@apple.com>
1703
1704         Make sure animation works for font-weight, font-stretch, and font-style
1705         https://bugs.webkit.org/show_bug.cgi?id=169683
1706
1707         Reviewed by Simon Fraser.
1708
1709         Hook up animation code for FontSelectionValues.
1710
1711         Tests: animations/font-variations/font-stretch.html
1712                animations/font-variations/font-style.html
1713                animations/font-variations/font-weight.html
1714
1715         * page/animation/CSSPropertyAnimation.cpp:
1716         (WebCore::blendFunc):
1717         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
1718         * rendering/style/RenderStyle.cpp:
1719         (WebCore::RenderStyle::setFontWeight):
1720         (WebCore::RenderStyle::setFontStretch):
1721         (WebCore::RenderStyle::setFontItalic):
1722         * rendering/style/RenderStyle.h:
1723         (WebCore::RenderStyle::fontWeight):
1724         (WebCore::RenderStyle::fontStretch):
1725         (WebCore::RenderStyle::fontItalic):
1726
1727 2017-03-27  Alex Christensen  <achristensen@webkit.org>
1728
1729         Make WebSockets work in network process
1730         https://bugs.webkit.org/show_bug.cgi?id=169930
1731
1732         Reviewed by Youenn Fablet.
1733
1734         Covered by 136 existing tests in http/tests/websocket/tests/hybi
1735         This also does fine with the 544 websocket tests in the web-platform-tests which we have not yet imported.
1736         Also added http/tests/websocket/tests/hybi/network-process-crash-error.html
1737         to test a new condition that couldn't happen before this move: the NetworkProcess crashing.
1738
1739         * Modules/websockets/WebSocketChannel.cpp:
1740         (WebCore::WebSocketChannel::fail):
1741         We were asserting that didCloseSocketStream was called.  It is still called,
1742         but not synchronously like it used to.  This assertion is now invalid, but tests
1743         that would hit it still pass.
1744         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
1745         (WebCore::SocketStreamHandleImpl::platformSendInternal):
1746         CFWriteStreamCanAcceptBytes crashes if you give it a null parameter, and that can happen now.
1747         If we have no write stream, then we cannot write.  Tests that hit this pass still.
1748
1749 2017-03-27  Antoine Quint  <graouts@apple.com>
1750
1751         [Modern Media Controls] Improve media documents across macOS, iPhone and iPad
1752         https://bugs.webkit.org/show_bug.cgi?id=169145
1753         <rdar://problem/17048858>
1754
1755         Reviewed by Dean Jackson.
1756
1757         There were a variety of issues with media documents, some longstanding, and some specifically
1758         about modern media controls.
1759
1760         One issue was that fullscreen and picture-in-picture buttons would show for audio media documents,
1761         due to using a <video> element to load the audio file. We now have additional logic in MediaController
1762         to identify if the loaded media is really an audio file, and using this information to hide the
1763         fullscreen and picture-in-picture buttons.
1764
1765         Another issue was that we would inject style in MediaDocument.cpp that was specific to modern media
1766         controls when we could have the modern-media-controls module injected CSS handle this styling. We now
1767         use the injected style in the shadow root to size media documents based on the device characteristics
1768         and ensuring that page styles are overridden.
1769
1770         We also simplify how MediaDocument.cpp sets the source of the media element to simply use the "src"
1771         attribute and not a <source> element.
1772
1773         Finally, we introduce a MediaDocumentController class that is instantiated when we're dealing with
1774         a media document to hide the controls while we determine the type of media we're loading (audio vs.
1775         video) in order to apply the appropriate styling without flashes.
1776
1777         As a result of the new styles applied by the modern-media-controls module, media documents have a
1778         similar behavior on macOS and iPad, where we only enforce a min-width for video allowing them
1779         to play at their natural size otherwise, and enforcing a fixed width for audio. On iPhone however,
1780         we want to always play the media at full width, with some padding in the case of audio.
1781
1782         Tests: media/modern-media-controls/fullscreen-support/fullscreen-support-disabled-video-with-audio-tracks-only.html
1783                media/modern-media-controls/media-documents/ipad/media-document-audio-ios-sizing.html
1784                media/modern-media-controls/media-documents/ipad/media-document-video-ios-sizing.html
1785                media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html
1786                media/modern-media-controls/media-documents/media-document-audio-mac-sizing.html
1787                media/modern-media-controls/media-documents/media-document-video-ios-sizing.html
1788                media/modern-media-controls/media-documents/media-document-video-mac-sizing.html
1789                media/modern-media-controls/pip-support/pip-support-disabled-video-with-audio-tracks-only.html
1790
1791         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
1792         (:host(audio) .media-controls.ios.inline > .controls-bar:before,):
1793         (:host(audio) .media-controls.ios.inline > .controls-bar:before): Deleted.
1794         * Modules/modern-media-controls/controls/macos-media-controls.css:
1795         (:host(audio) .media-controls.mac.inline > .controls-bar,):
1796         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint,):
1797         (:host(audio) .media-controls.mac.inline > .controls-bar): Deleted.
1798         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint): Deleted.
1799         * Modules/modern-media-controls/controls/media-document.css: Added.
1800         (:host(.media-document)):
1801         (:host(.media-document.ready)):
1802         (:host(.media-document.audio.mac)):
1803         (:host(.media-document.audio.ipad)):
1804         (:host(.media-document.audio.iphone)):
1805         (:host(.media-document.video.mac)):
1806         (:host(.media-document.video.ipad)):
1807         (:host(.media-document.video.iphone)):
1808         * Modules/modern-media-controls/js-files:
1809         * Modules/modern-media-controls/media/fullscreen-support.js:
1810         (FullscreenSupport.prototype.syncControl):
1811         (FullscreenSupport):
1812         * Modules/modern-media-controls/media/media-controller.js:
1813         (MediaController):
1814         (MediaController.prototype.get isAudio):
1815         * Modules/modern-media-controls/media/media-document-controller.js: Added.
1816         (MediaDocumentController):
1817         (MediaDocumentController.prototype.handleEvent):
1818         (MediaDocumentController.prototype._mediaDocumentHasMetadata):
1819         (MediaDocumentController.prototype._mediaDocumentHasSize):
1820         * Modules/modern-media-controls/media/pip-support.js:
1821         (PiPSupport.prototype.syncControl):
1822         (PiPSupport):
1823         * html/MediaDocument.cpp:
1824         (WebCore::MediaDocumentParser::createDocumentStructure):
1825
1826 2017-03-25  Chris Dumez  <cdumez@apple.com>
1827
1828         REGRESSION(r214195): zillow.com header video doesn't resume when switching to another tab and back
1829         https://bugs.webkit.org/show_bug.cgi?id=170080
1830         <rdar://problem/31252522>
1831
1832         Reviewed by Eric Carlson.
1833
1834         The video header on zillow.com would pause when switching to another tab after r214195. On
1835         switching back to the zillow.com tab, we would resume the video but fail to take the poster
1836         away, making it look like the video is still paused.
1837
1838         We normally take the poster away when HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable()
1839         is called. However, mediaPlayerFirstVideoFrameAvailable() was only ever called once because of
1840         the m_haveReportedFirstVideoFrame flag in MediaPlayerPrivateAVFoundation::updateStates().
1841         We now reset m_haveReportedFirstVideoFrame to false in updateStates() if hasAvailableVideoFrame()
1842         return false, so that we call mediaPlayerFirstVideoFrameAvailable() again when the return
1843         value of asAvailableVideoFrame() becomes true again (e.g. after the media session interruption
1844         has ended).
1845
1846         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
1847         (WebCore::MediaPlayerPrivateAVFoundation::updateStates):
1848
1849 2017-03-24  Wenson Hsieh  <wenson_hsieh@apple.com>
1850
1851         [WK2] Add a UI delegate SPI hook to enable or disable navigation on drop
1852         https://bugs.webkit.org/show_bug.cgi?id=169168
1853         <rdar://problem/30688374>
1854
1855         Reviewed by Tim Horton.
1856
1857         Refactor client hooks for the drag destination action in WebCore to ask for the drag destination action mask
1858         upon initializing the DragData. In DragController, rather than setting m_dragDestinationAction to the result of
1859         m_client.actionMaskForDrag, we instead set it to the DragData's destination action.
1860
1861         Tests to come in a future patch.
1862
1863         * loader/EmptyClients.cpp:
1864         * page/DragClient.h:
1865
1866         Rather than pass in a DragData, pass in only the platform data that we need to hand to the delegate. This is
1867         because we now ask for drag destination actions prior to creating the DragData.
1868
1869         * page/DragController.cpp:
1870         (WebCore::DragController::dragEnteredOrUpdated):
1871
1872         Update the available drag destination actions in WebCore using the destination actions stored in DragData rather
1873         than calling out to the client delegate.
1874
1875         * loader/EmptyClients.cpp:
1876         * platform/DragData.cpp:
1877         (WebCore::DragData::DragData):
1878         * platform/DragData.h:
1879         (WebCore::DragData::dragDestinationAction):
1880         (WebCore::DragData::operator =):
1881         * platform/mac/DragDataMac.mm:
1882         (WebCore::DragData::DragData):
1883
1884 2017-03-25  Aaron Chu  <aaron_chu@apple.com>
1885
1886         AX: Media controls are unlabeled
1887         https://bugs.webkit.org/show_bug.cgi?id=169947
1888         <rdar://problem/30153323>
1889
1890         Reviewed by Antoine Quint.
1891
1892         Added a "label" property for Icons, which are used to set
1893         the aria-label for the controls in modern media controls.
1894
1895         Test: Addition to all existing modern media controls tests.
1896
1897         * English.lproj/modern-media-controls-localized-strings.js:
1898         * Modules/modern-media-controls/controls/icon-button.js:
1899         (IconButton.prototype.set iconName):
1900         (IconButton.prototype.handleEvent):
1901         (IconButton.prototype._loadImage):
1902         * Modules/modern-media-controls/controls/icon-service.js:
1903         * Modules/modern-media-controls/controls/start-button.js:
1904         (StartButton):
1905         * Modules/modern-media-controls/js-files:
1906
1907 2017-03-25  Carlos Garcia Campos  <cgarcia@igalia.com>
1908
1909         [XDG] MIMETypeRegistry::getMIMETypeForExtension should return a null/empty string when mime type is unknown
1910         https://bugs.webkit.org/show_bug.cgi?id=170050
1911
1912         Reviewed by Michael Catanzaro.
1913
1914         That's what the callers expect, but we alre always returning XDG_MIME_TYPE_UNKNOWN which is
1915         application/octet-stream.
1916
1917         Fixes: plugins/no-mime-with-valid-extension.html
1918
1919         * platform/xdg/MIMETypeRegistryXdg.cpp:
1920         (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
1921
1922 2017-03-24  Myles C. Maxfield  <mmaxfield@apple.com>
1923
1924         Add font-optical-sizing to CSSComputedStyleDeclaration
1925         https://bugs.webkit.org/show_bug.cgi?id=170083
1926
1927         Reviewed by Joseph Pecoraro.
1928
1929         Covered by existing tests.
1930
1931         * css/CSSComputedStyleDeclaration.cpp:
1932
1933 2017-03-24  Daniel Bates  <dabates@apple.com>
1934
1935         media/restore-from-page-cache.html causes NoEventDispatchAssertion::isEventAllowedInMainThread() assertion failure
1936         https://bugs.webkit.org/show_bug.cgi?id=170087
1937         <rdar://problem/31254822>
1938
1939         Reviewed by Simon Fraser.
1940
1941         Reduce the scope of code that should never dispatch DOM events so as to allow updating contents size
1942         after restoring a page from the page cache.
1943
1944         In r214014 we instantiate a NoEventDispatchAssertion in FrameLoader::commitProvisionalLoad()
1945         around the call to CachedPage::restore() to assert when a DOM event is dispatched during
1946         page restoration as such events can cause re-entrancy into the page cache. As it turns out
1947         it is sufficient to ensure that no DOM events are dispatched after restoring all cached frames
1948         as opposed to after CachedPage::restore() returns.
1949
1950         Also rename Document::enqueue{Pageshow, Popstate}Event() to dispatch{Pageshow, Popstate}Event(),
1951         respectively, since they synchronously dispatch events :(. We hope in the future to make them
1952         asynchronously dispatch events.
1953
1954         * dom/Document.cpp:
1955         (WebCore::Document::implicitClose): Update for renaming.
1956         (WebCore::Document::statePopped): Ditto.
1957         (WebCore::Document::dispatchPageshowEvent): Renamed; formerly named enqueuePageshowEvent().
1958         (WebCore::Document::dispatchPopstateEvent): Renamed; formerly named enqueuePopstateEvent().
1959         (WebCore::Document::enqueuePageshowEvent): Deleted.
1960         (WebCore::Document::enqueuePopstateEvent): Deleted.
1961         * dom/Document.h:
1962         * history/CachedPage.cpp:
1963         (WebCore::firePageShowAndPopStateEvents): Moved logic from FrameLoader::didRestoreFromCachedPage() to here.
1964         (WebCore::CachedPage::restore): Modified to call firePageShowAndPopStateEvents().
1965         * loader/FrameLoader.cpp:
1966         (WebCore::FrameLoader::commitProvisionalLoad): Removed use of NoEventDispatchAssertion RAII object. We
1967         will instantiate it in CachedPage::restore() with a smaller scope.
1968         (WebCore::FrameLoader::didRestoreFromCachedPage): Deleted; moved logic from here to WebCore::firePageShowAndPopStateEvents().
1969         * loader/FrameLoader.h:
1970
1971 2017-03-24  Ryan Haddad  <ryanhaddad@apple.com>
1972
1973         Unreviewed, rolling out r214361.
1974
1975         This change caused flakiness in http/tests/preload tests.
1976
1977         Reverted changeset:
1978
1979         "Add a warning for unused link preloads."
1980         https://bugs.webkit.org/show_bug.cgi?id=165670
1981         http://trac.webkit.org/changeset/214361
1982
1983 2017-03-24  Antoine Quint  <graouts@webkit.org>
1984
1985         [Modern Media Controls] Remove placard icon if height is compressed
1986         https://bugs.webkit.org/show_bug.cgi?id=167935
1987         <rdar://problem/30397128>
1988
1989         Reviewed by Dean Jackson.
1990
1991         We make the addition of certain Placard children conditional on the placard's metrics. Whenever the
1992         media controls metrics changes, the placard, if any, is set to have the same metrics and layout() is
1993         called where we ensure that there is enough space, per designs, to have the icon, description and even
1994         the title visible. We also make some CSS improvements to guarantee that the description is laid out on
1995         two lines at most and that both text labels are trimmed elegantly with an ellipsis shold the width be
1996         insufficient to display the whole text.
1997
1998         Since we would have needed to have more width/height setter overrides to trigger layout, we now make
1999         LayoutNode trigger layout() directly and remove the need for subclasses to do this on a per-class basis.
2000         We also make layout() a method that can be called safely anytime as it's now no longer part of the DOM
2001         commit step, a new commit() method is used instead of that.
2002
2003         Tests: media/modern-media-controls/layout-node/node-made-dirty-during-commit.html
2004                media/modern-media-controls/media-controls/media-controls-placard-compressed-metrics.html
2005
2006         * Modules/modern-media-controls/controls/layout-node.js:
2007         (LayoutNode.prototype.set width):
2008         (LayoutNode.prototype.set height):
2009         Trigger a call to layout() anytime "width" or "height" is set on any LayoutNode.
2010
2011         (LayoutNode.prototype.layout):
2012         (LayoutNode.prototype.commit):
2013         (performScheduledLayout):
2014         Make layout() an empty method that subclasses can override easily outside of the DOM commit cycle,
2015         its previous implementation is now called "commit()" which is a more accurate name.
2016
2017         * Modules/modern-media-controls/controls/media-controls.js:
2018         (MediaControls.prototype.get placard):
2019         (MediaControls.prototype.get showsPlacard):
2020         (MediaControls.prototype.showPlacard):
2021         (MediaControls.prototype.hidePlacard):
2022         (MediaControls.prototype.layout):
2023         (MediaControls.prototype.get width): Deleted.
2024         (MediaControls.prototype.set width): Deleted.
2025         Add a "placard" property to make it simpler to reference the placard instead of making assumptions in
2026         several places in that class on the children order. Anytime we run a layout or show the placard, ensure
2027         that the placard metrics are synced with the media controls metrics.
2028
2029         * Modules/modern-media-controls/controls/placard.css:
2030         (.placard .container):
2031         (.placard .title,):
2032         (.placard .description):
2033         We now ensure that both the title and description are trimmed with an ellipsis when we run out of space
2034         to display them fully.
2035
2036         * Modules/modern-media-controls/controls/placard.js:
2037         (Placard.):
2038         (Placard.prototype.layout):
2039         We add new constraints to only show the icon, title and description if the placard is tall and wide enough.
2040
2041         * Modules/modern-media-controls/controls/slider.js:
2042         (Slider.prototype.get width): Deleted.
2043         (Slider.prototype.set width): Deleted.
2044         Removed custom "width" getters and setters now we can just override layout() in case node metrics change.
2045
2046         * Modules/modern-media-controls/controls/time-control.js:
2047         (TimeControl.prototype.set useSixDigitsForTimeLabels):
2048         (TimeControl.prototype.layout):
2049         (TimeControl.prototype.get width): Deleted.
2050         (TimeControl.prototype.set width): Deleted.
2051         (TimeControl.prototype._availableWidthHasChanged): Deleted.
2052         Removed custom "width" getters and setters now we can just override layout() in case node metrics change.
2053
2054         * Modules/modern-media-controls/media/media-controller.js:
2055         (MediaController):
2056         Ensure we flush pending updates at construction time so that we match the size of the media controls right
2057         at the first media layout.
2058
2059 2017-03-24  Eric Carlson  <eric.carlson@apple.com>
2060
2061         [MediaStream] "ideal" constraints passed to getUserMedia should affect fitness score
2062         https://bugs.webkit.org/show_bug.cgi?id=170056
2063
2064         Reviewed by Youenn Fablet.
2065
2066         Include the fitness score calculated for ideal constraints in the calculation of a capture
2067         overall device fitness score. 
2068
2069         No new tests, existing tests updated.
2070
2071         * platform/mediastream/MediaConstraints.cpp:
2072         (WebCore::StringConstraint::fitnessDistance): Drive-by fix: return early if ideal is empty,
2073         not exact.
2074
2075         * platform/mediastream/RealtimeMediaSource.cpp:
2076         (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate): Return fitness distance.
2077         (WebCore::RealtimeMediaSource::selectSettings): Include the fitness distance of supported
2078         ideal constraints.
2079         (WebCore::RealtimeMediaSource::supportsConstraint): New.
2080         (WebCore::RealtimeMediaSource::applyConstraints):
2081         * platform/mediastream/RealtimeMediaSource.h:
2082
2083         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2084         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints): Sort candidate sources
2085         by their fitness score.
2086
2087         * platform/mock/MockRealtimeVideoSource.cpp:
2088         (WebCore::MockRealtimeVideoSource::initializeCapabilities): Each video source should support
2089         one facing mode, not both.
2090
2091 2017-03-24  Dean Jackson  <dino@apple.com>
2092
2093         Serialization of custom props in longhand should be "" not value of shorthand
2094         https://bugs.webkit.org/show_bug.cgi?id=167699
2095         <rdar://problem/30324200>
2096
2097         Reviewed by Sam Weinig.
2098
2099         https://www.w3.org/TR/css-variables/#variables-in-shorthands says
2100         "Pending-substitution values must be serialized as the empty string, if
2101         an API allows them to be observed."
2102
2103         We were returning the cssText instead.
2104
2105         Test: fast/css/variables/rule-property-get.html has been updated.
2106
2107         * css/StyleProperties.cpp:
2108         (WebCore::StyleProperties::getPropertyValue): Return the empty string
2109         if we're a pending substitution value.
2110
2111 2017-03-24  Wenson Hsieh  <wenson_hsieh@apple.com>
2112
2113         Unreviewed, fix the ToT build on the latest SDK.
2114
2115         Add deprecated declaration guards around two synchronous UIItemProvider methods in WebItemProviderPasteboard.
2116         <rdar://problem/30451096> tracks adoption of the asynchronous versions of these methods.
2117
2118         * platform/ios/WebItemProviderPasteboard.mm:
2119         (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
2120         (-[WebItemProviderPasteboard _tryToCreateAndAppendObjectOfClass:toArray:usingProvider:]):
2121
2122 2017-03-24  Antoine Quint  <graouts@webkit.org>
2123
2124         [Modern Media Controls] Captions don't move with the appearance of the inline controls
2125         https://bugs.webkit.org/show_bug.cgi?id=170051
2126         <rdar://problem/30754428>
2127
2128         Reviewed by Dean Jackson.
2129
2130         We now size the captions container to account for the controls bar height when visible. To do this,
2131         we use CSS variables to specify the height of the controls bar in default inline mode, compact inline
2132         mode and fullscreen mode.
2133
2134         Test: media/modern-media-controls/tracks-support/tracks-support-captions-offset-with-controls-bar.html
2135
2136         * Modules/modern-media-controls/controls/controls-bar.js:
2137         (ControlsBar.prototype.set faded):
2138         Notify the hosting MediaControls that the "faded" property changed.
2139
2140         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
2141         (.media-controls.ios.inline > .controls-bar):
2142         Use the new --inline-controls-bar-height CSS variable to specify the inline bar height.
2143
2144         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css:
2145         (.media-controls.mac.inline.compact > .controls-bar):
2146         Use the new --inline-compact-controls-bar-height CSS variable to specify the inline bar height.
2147
2148         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
2149         (.media-controls.mac.fullscreen > .controls-bar):
2150         Use the new --fullscreen-controls-bar-height CSS variable to specify the inline bar height.
2151
2152         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
2153         (.media-controls.mac.inline > .controls-bar):
2154         Use the new --inline-controls-bar-height CSS variable to specify the inline bar height.
2155
2156         * Modules/modern-media-controls/controls/media-controls.css:
2157         (*):
2158         Specify new CSS variables for the various controls bar heights.
2159
2160         * Modules/modern-media-controls/controls/media-controls.js:
2161         (MediaControls.prototype.controlsBarFadedStateDidChange):
2162         Notify the delegate of a controls bar "faded" property change. 
2163
2164         * Modules/modern-media-controls/controls/text-tracks.css:
2165         (video::-webkit-media-text-track-container):
2166         (video::-webkit-media-text-track-container.visible-controls-bar):
2167         (video::-webkit-media-text-track-container.visible-controls-bar.compact-controls-bar):
2168         (video::-webkit-media-text-track-display):
2169         Shorten the height of the captions container when the controls bar is visible. We also
2170         fix a couple of prefixed properties that didn't need to be.
2171
2172         * Modules/modern-media-controls/media/media-controller.js:
2173         (MediaController.prototype.controlsBarFadedStateDidChange):
2174         (MediaController.prototype._updateControlsIfNeeded):
2175         (MediaController.prototype._updateTextTracksClassList):
2176         (MediaController):
2177         Ensure we reflect the "faded" state of the controls bar on the captions container using
2178         a CSS class, as well as whether the controls bar mode is compact.
2179
2180 2017-03-24  Brent Fulgham  <bfulgham@apple.com>
2181
2182         Handle recursive calls to ProcessingInstruction::checkStyleSheet
2183         https://bugs.webkit.org/show_bug.cgi?id=169982
2184         <rdar://problem/31083051>
2185
2186         Reviewed by Antti Koivisto.
2187
2188        See if we triggered a recursive load of the stylesheet during the 'beforeload'
2189        event handler. If so, reset to a valid state before completing the load.
2190
2191        We should also check after 'beforeload' that we were not disconnected from (or
2192        moved to a new) document.
2193
2194        I also looked for other cases of this pattern and fixed them, too.
2195
2196        Tests: fast/dom/beforeload/image-removed-during-before-load.html
2197                fast/dom/beforeload/recursive-css-pi-before-load.html
2198                fast/dom/beforeload/recursive-link-before-load.html
2199                fast/dom/beforeload/recursive-xsl-pi-before-load.html
2200
2201         * dom/ProcessingInstruction.cpp:
2202         (WebCore::ProcessingInstruction::clearExistingCachedSheet): Added.
2203         (WebCore::ProcessingInstruction::checkStyleSheet): Prevent recursive calls into
2204         this function during 'beforeload' handling. Also, safely handle the case where
2205         the element was disconnected in the 'beforeload' handler (similar to what
2206         we do in HTMLLinkElement).
2207         (WebCore::ProcessingInstruction::setCSSStyleSheet): Drive-by Fix: Protect the
2208         current document to match what we do in setXSLStyleSheet.
2209         * dom/ProcessingInstruction.h:
2210         * html/HTMLLinkElement.cpp:
2211         (WebCore::HTMLLinkElement::process): Prevent recursive calls into
2212         this function during 'beforeload' handling.
2213         * html/HTMLLinkElement.h:
2214         * loader/ImageLoader.cpp:
2215         (WebCore::ImageLoader::dispatchPendingBeforeLoadEvent): safely handle the case where
2216         the element was disconnected in the 'beforeload' handler (similar to what
2217         we do in HTMLLinkElement).
2218         * style/StyleScope.cpp:
2219         (WebCore::Style::Scope::hasPendingSheet): Added.
2220         * style/StyleScope.h:
2221
2222 2017-03-24  Brady Eidson  <beidson@apple.com>
2223
2224         A null compound index value crashes the Databases process.
2225         <rdar://problem/30499831> and https://bugs.webkit.org/show_bug.cgi?id=170000
2226
2227         Reviewed by Alex Christensen.
2228
2229         Test: storage/indexeddb/modern/single-entry-index-invalid-key-crash.html
2230
2231         * bindings/js/IDBBindingUtilities.cpp:
2232         (WebCore::createKeyPathArray): Fix the bug by rejecting arrays with any invalid keys in them.
2233         
2234         Add some logging:
2235         * Modules/indexeddb/IDBKeyPath.cpp:
2236         (WebCore::loggingString):
2237         * Modules/indexeddb/IDBKeyPath.h:
2238         * Modules/indexeddb/IDBObjectStore.cpp:
2239         (WebCore::IDBObjectStore::createIndex):
2240         * Modules/indexeddb/shared/IDBIndexInfo.cpp:
2241         (WebCore::IDBIndexInfo::loggingString):
2242
2243 2017-03-24  Ryan Haddad  <ryanhaddad@apple.com>
2244
2245         Unreviewed, rolling out r214360.
2246
2247         This change caused 20+ LayoutTest failures.
2248
2249         Reverted changeset:
2250
2251         "Handle recursive calls to
2252         ProcessingInstruction::checkStyleSheet"
2253         https://bugs.webkit.org/show_bug.cgi?id=169982
2254         http://trac.webkit.org/changeset/214360
2255
2256 2017-03-24  Youenn Fablet  <youenn@apple.com>
2257
2258         Add support for qpSum in WebRTC stats
2259         https://bugs.webkit.org/show_bug.cgi?id=170060
2260
2261         Reviewed by Eric Carlson.
2262
2263         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2264         (WebCore::fillRTCRTPStreamStats): exposing libwebrtc qpSum value.
2265
2266 2017-03-24  Daniel Bates  <dabates@apple.com>
2267
2268         Prevent new navigations during document unload
2269         https://bugs.webkit.org/show_bug.cgi?id=169934
2270         <rdar://problem/31247584>
2271
2272         Reviewed by Chris Dumez.
2273
2274         Similar to our policy of preventing new navigations from onbeforeunload handlers
2275         we should prevent new navigations that are initiated during the document unload
2276         process.
2277
2278         The significant part of this change is the instantiation of the RAII object NavigationDisabler
2279         in Document::prepareForDestruction(). The rest of this change just renames class
2280         NavigationDisablerForBeforeUnload to NavigationDisabler now that this RAII class is
2281         used to prevent navigation from both onbeforeunload event handlers and when unloading
2282         a document.
2283
2284         Test: fast/frames/frame-unload-navigate-and-setTimeout-assert-fail.html
2285
2286         * dom/Document.cpp:
2287         (WebCore::Document::prepareForDestruction): Disable new navigations when disconnecting
2288         subframes. Also assert that the document is not in the page cache before we fall off
2289         the end of the function.
2290         * loader/FrameLoader.cpp:
2291         (WebCore::FrameLoader::isNavigationAllowed): Update for renaming below.
2292         (WebCore::FrameLoader::shouldClose): Ditto.
2293         * loader/NavigationScheduler.cpp:
2294         (WebCore::NavigationScheduler::shouldScheduleNavigation): Ditto.
2295         * loader/NavigationScheduler.h:
2296         (WebCore::NavigationDisabler::NavigationDisabler): Renamed class; formerly named NavigationDisablerForBeforeUnload.
2297         (WebCore::NavigationDisabler::~NavigationDisabler): Ditto.
2298         (WebCore::NavigationDisabler::isNavigationAllowed): Ditto.
2299         (WebCore::NavigationDisablerForBeforeUnload::NavigationDisablerForBeforeUnload): Deleted.
2300         (WebCore::NavigationDisablerForBeforeUnload::~NavigationDisablerForBeforeUnload): Deleted.
2301         (WebCore::NavigationDisablerForBeforeUnload::isNavigationAllowed): Deleted.
2302
2303 2017-03-24  Myles C. Maxfield  <mmaxfield@apple.com>
2304
2305         Implement font-optical-sizing
2306         https://bugs.webkit.org/show_bug.cgi?id=168895
2307
2308         Reviewed by Dean Jackson.
2309
2310         Upon advice from Microsoft, the only input to optical sizing is just the
2311         font-size computed value. It is implemented by setting the 'opsz' font
2312         variation axis. Because the propery has such a simple grammar, the
2313         implementation is quite straightforward.
2314
2315         Test: fast/text/variations/optical-sizing.html
2316
2317         * css/CSSComputedStyleDeclaration.cpp:
2318         (WebCore::ComputedStyleExtractor::propertyValue):
2319         * css/CSSPrimitiveValueMappings.h:
2320         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2321         (WebCore::CSSPrimitiveValue::operator FontOpticalSizing):
2322         * css/CSSProperties.json:
2323         * css/parser/CSSParserFastPaths.cpp:
2324         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2325         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
2326         * platform/graphics/FontCache.h:
2327         (WebCore::FontDescriptionKey::makeFlagsKey):
2328         * platform/graphics/FontDescription.h:
2329         (WebCore::FontDescription::opticalSizing):
2330         (WebCore::FontDescription::setOpticalSizing):
2331         (WebCore::FontDescription::operator==):
2332         (WebCore::FontCascadeDescription::initialOpticalSizing):
2333         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2334         (WebCore::preparePlatformFont):
2335         (WebCore::fontWithFamily):
2336         (WebCore::FontCache::createFontPlatformData):
2337         (WebCore::FontCache::systemFallbackForCharacters):
2338         * platform/graphics/mac/FontCustomPlatformData.cpp:
2339         (WebCore::FontCustomPlatformData::fontPlatformData):
2340         * platform/text/TextFlags.h:
2341
2342 2017-03-24  Chris Dumez  <cdumez@apple.com>
2343
2344         Unreviewed, rolling out r214329.
2345
2346         Significantly regressed Speedometer
2347
2348         Reverted changeset:
2349
2350         "window.crypto.getRandomValues() uses the insecure RC4 RNG"
2351         https://bugs.webkit.org/show_bug.cgi?id=169623
2352         http://trac.webkit.org/changeset/214329
2353
2354 2017-03-24  Yoav Weiss  <yoav@yoav.ws>
2355
2356         Add a warning for unused link preloads.
2357         https://bugs.webkit.org/show_bug.cgi?id=165670
2358
2359         Reviewed by Youenn Fablet.
2360
2361         This patch adds a warning message, to warn developers that are using
2362         link preloads in cases where the downloaded resource is likely to
2363         remain unused.
2364
2365         Test: http/tests/preload/unused_preload_warning.html
2366
2367         * dom/Document.cpp:
2368         (WebCore::Document::prepareForDestruction): Stop the timer once the document is destructed.
2369         * loader/LinkPreloadResourceClients.h: Add shouldMarkAsReferenced overides for the LinkPreloadResourceClient classes.
2370         * loader/cache/CachedResource.cpp:
2371         (WebCore::CachedResource::addClientToSet): Make sure LinkPreloadResourceClients don't set resource to be referenced.
2372         * loader/cache/CachedResourceClient.h:
2373         (WebCore::CachedResourceClient::shouldMarkAsReferenced): Make sure that ResourceClients mark preloads as referenced by default.
2374         * loader/cache/CachedResourceLoader.cpp:
2375         (WebCore::CachedResourceLoader::CachedResourceLoader): Initialize timer.
2376         (WebCore::CachedResourceLoader::~CachedResourceLoader): Stop timer.
2377         (WebCore::CachedResourceLoader::warnUnusedPreloads): Iterate over m_preloads and issue a warning for non-referenced preloads.
2378         (WebCore::CachedResourceLoader::documentDidFinishLoadEvent): Trigger a timer if preloads weren't cleared at load time.
2379         (WebCore::CachedResourceLoader::warnUnusedPreloads): Triggered by the timer, and called CachedResourceLoader::warnUnusedPreloads.
2380         (WebCore::CachedResourceLoader::stopUnusedPreloadsTimer): Stop the timer.
2381
2382 2017-03-24  Brent Fulgham  <bfulgham@apple.com>
2383
2384         Handle recursive calls to ProcessingInstruction::checkStyleSheet
2385         https://bugs.webkit.org/show_bug.cgi?id=169982
2386         <rdar://problem/31083051>
2387
2388         Reviewed by Antti Koivisto.
2389
2390         See if we triggered a recursive load of the stylesheet during the 'beforeload'
2391         event handler. If so, reset to a valid state before completing the load.
2392
2393         We should also check after 'beforeload' that we were not disconnected from (or
2394         moved to a new) document.
2395
2396         I also looked for other cases of this pattern and fixed them.
2397
2398         Tests: fast/dom/beforeload/image-removed-during-before-load.html
2399                fast/dom/beforeload/recursive-css-pi-before-load.html
2400                fast/dom/beforeload/recursive-link-before-load.html
2401                fast/dom/beforeload/recursive-xsl-pi-before-load.html
2402
2403         * dom/ProcessingInstruction.cpp:
2404         (WebCore::ProcessingInstruction::clearExistingCachedSheet): Added.
2405         (WebCore::ProcessingInstruction::checkStyleSheet): Reset to valid state
2406         if necessary after the 'beforeload' handler. Also, safely handle the case where
2407         the element was disconnected in the 'beforeload' handler (similar to what
2408         we do in HTMLLinkElement).
2409         (WebCore::ProcessingInstruction::setCSSStyleSheet): Drive-by Fix: Protect the
2410         current document to match what we do in setXSLStyleSheet.
2411         * dom/ProcessingInstruction.h:
2412         * html/HTMLMediaElement.cpp:
2413         (WebCore::HTMLMediaElement::selectMediaResource): Safely handle the case where
2414         the element was disconnected in the 'beforeload' handler.
2415         (WebCore::HTMLMediaElement::selectNextSourceChild): Ditto.
2416         * loader/ImageLoader.cpp:
2417         (WebCore::ImageLoader::dispatchPendingBeforeLoadEvent): Ditto.
2418
2419 2017-03-24  Myles C. Maxfield  <mmaxfield@apple.com>
2420
2421         font-style needs a new CSSValue to make CSSRule.cssText work correctly
2422         https://bugs.webkit.org/show_bug.cgi?id=169258
2423
2424         Reviewed by David Hyatt.
2425
2426         With variation fonts, font-style's value can't be captured in a CSSPrimitiveValue (nor any other subclass
2427         off CSSValue) any more. Instead, we need to create two new CSSValues which represent the grammar that font-
2428         style and it's associated @font-face descriptor accept.
2429
2430         The grammar of the font-style property is "normal | italic | oblique [ <<angle>> ]?"
2431         The grammar of the font-style descriptor is "normal | italic | oblique [ <<angle>> | <<angle>> <<angle>> ]?"
2432
2433         We currently still support numbers in place of the <<angle>> value (contrary to the spec). We will remove
2434         this support in https://bugs.webkit.org/show_bug.cgi?id=169357.
2435
2436         Tests: fast/text/font-selection-font-face-parse.html:
2437                fast/text/font-style-parse.html:
2438
2439         * CMakeLists.txt:
2440         * WebCore.xcodeproj/project.pbxproj:
2441         * css/CSSAllInOne.cpp:
2442         * css/CSSComputedStyleDeclaration.cpp:
2443         (WebCore::fontStyleFromStyle):
2444         (WebCore::fontShorthandValueForSelectionProperties):
2445         * css/CSSFontFace.cpp:
2446         (WebCore::calculateWeightRange):
2447         (WebCore::calculateStretchRange):
2448         (WebCore::calculateItalicRange):
2449         * css/CSSFontFaceSet.cpp:
2450         (WebCore::computeFontSelectionRequest):
2451         (WebCore::CSSFontFaceSet::matchingFaces):
2452         (WebCore::calculateWeightValue): Deleted.
2453         (WebCore::calculateStretchValue): Deleted.
2454         (WebCore::calculateStyleValue): Deleted.
2455         * css/CSSFontFaceSet.h:
2456         * css/CSSFontSelector.cpp:
2457         (WebCore::CSSFontSelector::addFontFaceRule):
2458         * css/CSSFontStyleRangeValue.cpp: Added.
2459         (WebCore::CSSFontStyleRangeValue::customCSSText):
2460         (WebCore::CSSFontStyleRangeValue::equals):
2461         * css/CSSFontStyleRangeValue.h: Added.
2462         * css/CSSFontStyleValue.cpp: Added.
2463         (WebCore::CSSFontStyleValue::customCSSText):
2464         (WebCore::CSSFontStyleValue::equals):
2465         * css/CSSFontStyleValue.h: Added.
2466         * css/CSSFontValue.cpp:
2467         (WebCore::CSSFontValue::customCSSText):
2468         * css/CSSFontValue.h:
2469         * css/CSSValue.cpp:
2470         (WebCore::CSSValue::equals):
2471         (WebCore::CSSValue::cssText):
2472         (WebCore::CSSValue::destroy):
2473         * css/CSSValue.h:
2474         (WebCore::CSSValue::isFontStyleValue):
2475         (WebCore::CSSValue::isFontStyleRangeValue):
2476         * css/FontFace.cpp:
2477         (WebCore::FontFace::style):
2478         (WebCore::FontFace::weight):
2479         (WebCore::FontFace::stretch):
2480         * css/StyleBuilderConverter.h:
2481         (WebCore::StyleBuilderConverter::convertFontWeightFromValue):
2482         (WebCore::StyleBuilderConverter::convertFontStretchFromValue):
2483         (WebCore::StyleBuilderConverter::convertFontStyleFromValue):
2484         (WebCore::StyleBuilderConverter::convertFontWeight):
2485         (WebCore::StyleBuilderConverter::convertFontStretch):
2486         (WebCore::StyleBuilderConverter::convertFontStyle):
2487         * css/parser/CSSPropertyParser.cpp:
2488         (WebCore::consumeFontStyle):
2489         (WebCore::consumeFontStyleRange):
2490         (WebCore::CSSPropertyParser::consumeSystemFont):
2491         (WebCore::CSSPropertyParser::consumeFont):
2492         * svg/SVGFontFaceElement.cpp:
2493         (WebCore::SVGFontFaceElement::parseAttribute):
2494
2495 2017-03-24  Alex Christensen  <achristensen@webkit.org>
2496
2497         REGRESSION: Content Blocker: Blocking "a[href*=randomString]" doesn't work
2498         https://bugs.webkit.org/show_bug.cgi?id=169167
2499
2500         Reviewed by Simon Fraser.
2501
2502         When testing content extensions, we have always called an API function that internally
2503         has called AtomicString::init somewhere before we start compiling the content extension.
2504         On iOS, though, we call [_WKUserContentExtensionStore compileContentExtensionForIdentifier:...]
2505         without having already called anything that calls AtomicString::init.  The new CSS parser is now
2506         failing to parse some selectors because CSSSelectorParser::defaultNamespace is returning starAtom,
2507         which is a null atomic string before AtomicString::init is called.
2508
2509         Covered by a new API test.
2510
2511         * contentextensions/ContentExtensionParser.cpp:
2512         (WebCore::ContentExtensions::isValidCSSSelector):
2513         (WebCore::ContentExtensions::loadAction):
2514         (WebCore::ContentExtensions::isValidSelector): Deleted.
2515         * contentextensions/ContentExtensionParser.h:
2516         Call AtomicString::init before checking if a css selector is valid.
2517
2518 2017-03-24  Youenn Fablet  <youenn@apple.com>
2519
2520         Add libwebrtc backend support for RTCRtpSender::replaceTrack
2521         https://bugs.webkit.org/show_bug.cgi?id=169841
2522
2523         Reviewed by Alex Christensen.
2524
2525         Tests: webrtc/audio-replace-track.html
2526                webrtc/video-replace-track.html
2527
2528         Adding support for replaceTrack for audio and video sources.
2529         Replacing tracks will always succeed for audio sources.
2530         For video tracks, it will only succeed if the video resolution is not greater.
2531         LibWebRTCPeerConnectionBackend will delegate the track replacing by replacing the source of the outgoing sources with the source wrapped in the replacing track.
2532
2533         Video test is not fully passing as size constraints for mock video sources are not providing the right video stream resolution.
2534
2535         * Modules/mediastream/RTCRtpSender.cpp:
2536         (WebCore::RTCRtpSender::replaceTrack):
2537         * Modules/mediastream/RTCRtpSender.h:
2538         * Modules/mediastream/RTCRtpSender.idl:
2539         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2540         (WebCore::LibWebRTCPeerConnectionBackend::replaceTrack):
2541         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2542         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2543         (WebCore::RealtimeOutgoingAudioSource::setSource):
2544         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
2545         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
2546         (WebCore::RealtimeOutgoingVideoSource::setSource):
2547         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
2548         * platform/mock/MockRealtimeVideoSource.cpp:
2549         (WebCore::MockRealtimeVideoSource::drawText):
2550         (WebCore::MockRealtimeVideoSource::generateFrame):
2551
2552 2017-03-24  Jon Lee  <jonlee@apple.com>
2553
2554         Remove comment from RTCStatsReport.idl to convert ssrc to DOMString.
2555         Unreviewed.
2556
2557         Latest available Editor's Draft of WebRTC Statistics API is from 14 December 2016,
2558         but since then, in https://github.com/w3c/webrtc-stats/pull/157, it was changed to become
2559         unsigned long.
2560
2561         * Modules/mediastream/RTCStatsReport.idl:
2562
2563 2017-03-24  Youenn Fablet  <youenn@apple.com>
2564
2565         Add support for DataChannel and MediaStreamTrack stats
2566         https://bugs.webkit.org/show_bug.cgi?id=170031
2567
2568         Reviewed by Eric Carlson.
2569
2570         Tests: webrtc/datachannel/datachannel-stats.html
2571                webrtc/video-mediastreamtrack-stats.html
2572
2573         Exposing libwebrtc stats through WebRTC stats API, gathered for data channel and media stream tracks.
2574
2575         * Modules/mediastream/RTCStatsReport.h:
2576         (WebCore::RTCStatsReport::MediaStreamTrackStats::MediaStreamTrackStats):
2577         (WebCore::RTCStatsReport::DataChannelStats::DataChannelStats):
2578         * Modules/mediastream/RTCStatsReport.idl:
2579         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2580         (WebCore::fillRTCMediaStreamTrackStats):
2581         (WebCore::fillRTCDataChannelStats):
2582         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
2583
2584 2017-03-24  Youenn Fablet  <youenn@apple.com>
2585
2586         Fix framesEncoded/framesDecoded RTC stats
2587         https://bugs.webkit.org/show_bug.cgi?id=170024
2588
2589         Reviewed by Eric Carlson.
2590
2591         Test: webrtc/video-stats.html
2592
2593         Adding access to these fields now that they are available.
2594
2595         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2596         (WebCore::fillInboundRTPStreamStats):
2597         (WebCore::fillOutboundRTPStreamStats):
2598
2599 2017-03-24  Carlos Garcia Campos  <cgarcia@igalia.com>
2600
2601         Unreviewed. Fix GTK+ test /webkit2/WebKitWebView/default-menu after r214244.
2602
2603         Fix mnemonic string of contextMenuItemTagOpenAudioInNewWindow() that I copy pasted from
2604         contextMenuItemTagOpenVideoInNewWindow().
2605
2606         * platform/LocalizedStrings.cpp:
2607         (WebCore::contextMenuItemTagOpenAudioInNewWindow):
2608
2609 2017-03-24  Carlos Garcia Campos  <cgarcia@igalia.com>
2610
2611         [GStreamer] MediaPlayerPrivateGStreamerOwr shouldn't be the default engine
2612         https://bugs.webkit.org/show_bug.cgi?id=170049
2613
2614         Reviewed by Žan Doberšek.
2615
2616         This is causing several media tests to fail after r214338. When trying to load something like this:
2617
2618         http://127.0.0.1:8000/media/resources/serve-video.php?name=../../../../media/content/silence.wav&type=audio/wav&content-length=no&icy-data=yes
2619
2620         since r214338, the content type is known and inferred from the extension in this case, what ends up calling
2621         nextMediaEngine() in MediaPlayer::loadWithNextMediaEngine. That returns the first registered media engine, that
2622         is Owr that doesn't know how to load that and fails.
2623
2624         Fixes: http/tests/media/media-play-stream-chunked-icy.html
2625                http/tests/media/media-seeking-no-ranges-server.html
2626                http/tests/media/video-auth.html
2627                http/tests/media/video-play-stall-before-meta-data.html
2628                http/tests/security/contentSecurityPolicy/audio-redirect-allowed.html
2629                http/tests/security/contentSecurityPolicy/audio-redirect-allowed2.html
2630                http/tests/security/contentSecurityPolicy/audio-redirect-blocked.html
2631                http/tests/security/contentSecurityPolicy/video-redirect-allowed.html
2632                http/tests/security/contentSecurityPolicy/video-redirect-allowed2.html
2633                http/tests/security/contentSecurityPolicy/video-redirect-blocked.html
2634
2635         * platform/graphics/MediaPlayer.cpp:
2636         (WebCore::buildMediaEnginesVector):
2637
2638 2017-03-24  Per Arne Vollan  <pvollan@apple.com>
2639
2640         Text stroke is sometimes clipped on video captions.
2641         https://bugs.webkit.org/show_bug.cgi?id=170006
2642
2643         Reviewed by Eric Carlson.
2644
2645         Set 'overflow' property to 'visible' on cue element to avoid clipping of text stroke.
2646
2647         Updated test media/track/track-css-stroke-cues.html.
2648
2649         * html/track/TextTrackCueGeneric.cpp:
2650         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
2651         * html/track/VTTCue.cpp:
2652         (WebCore::VTTCueBox::applyCSSProperties):
2653
2654 2017-03-24  Carlos Garcia Campos  <cgarcia@igalia.com>
2655
2656         [GTK] Add MIMETypeRegistry implementation using xdgmime and remove the GTK+ one
2657         https://bugs.webkit.org/show_bug.cgi?id=170001
2658
2659         Reviewed by Michael Catanzaro.
2660
2661         The XDG implementation could be used by any port where shared-mime-info is expected to be available. It also
2662         improves the current GTK+ implementation that is based on a very small map of mime types and extensions.
2663
2664         * CMakeLists.txt:
2665         * PlatformGTK.cmake:
2666         * platform/xdg/MIMETypeRegistryXdg.cpp: Renamed from Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp.
2667         (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
2668         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
2669
2670 2017-03-23  Jon Lee  <jonlee@apple.com>
2671
2672         Update createDataChannel on RTCPeerConnection
2673         https://bugs.webkit.org/show_bug.cgi?id=170044
2674
2675         Reviewed by Youenn Fablet.
2676
2677         * Modules/mediastream/RTCPeerConnection.idl: Change label to USVString.
2678
2679 2017-03-23  Antti Koivisto  <antti@apple.com>
2680
2681         Revert r213712, caused iPad PLT regression
2682         https://bugs.webkit.org/show_bug.cgi?id=170040
2683
2684         Unreviewed.
2685
2686         A few subtests have big regressions.
2687
2688         * css/StyleResolver.cpp:
2689         (WebCore::StyleResolver::pseudoStyleRulesForElement):
2690         * dom/Document.cpp:
2691         (WebCore::Document::resolveStyle):
2692         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
2693         (WebCore::Document::shouldScheduleLayout):
2694         (WebCore::Document::didRemoveAllPendingStylesheet):
2695         * dom/Document.h:
2696         (WebCore::Document::didLayoutWithPendingStylesheets):
2697         (WebCore::Document::hasNodesWithPlaceholderStyle):
2698         (WebCore::Document::setHasNodesWithPlaceholderStyle):
2699         (WebCore::Document::hasNodesWithNonFinalStyle): Deleted.
2700         (WebCore::Document::setHasNodesWithNonFinalStyle): Deleted.
2701         * html/HTMLFrameSetElement.cpp:
2702         (WebCore::HTMLFrameSetElement::rendererIsNeeded):
2703         * page/FrameView.cpp:
2704         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty):
2705         (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
2706         * rendering/RenderBlock.cpp:
2707         (WebCore::RenderBlock::paintContents):
2708         * rendering/RenderLayer.cpp:
2709         (WebCore::shouldSuppressPaintingLayer):
2710         * rendering/style/RenderStyle.cpp:
2711         (WebCore::RenderStyle::changeRequiresRepaint):
2712         * rendering/style/RenderStyle.h:
2713         (WebCore::RenderStyle::isPlaceholderStyle):
2714         (WebCore::RenderStyle::setIsPlaceholderStyle):
2715         (WebCore::RenderStyle::isNotFinal): Deleted.
2716         (WebCore::RenderStyle::setIsNotFinal): Deleted.
2717         * rendering/style/StyleRareNonInheritedData.cpp:
2718         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
2719         (WebCore::StyleRareNonInheritedData::operator==):
2720         * rendering/style/StyleRareNonInheritedData.h:
2721         * style/StyleScope.cpp:
2722         (WebCore::Style::Scope::analyzeStyleSheetChange):
2723         (WebCore::Style::Scope::updateActiveStyleSheets):
2724         * style/StyleTreeResolver.cpp:
2725         (WebCore::Style::makePlaceholderStyle):
2726         (WebCore::Style::TreeResolver::styleForElement):
2727         (WebCore::Style::TreeResolver::resolveElement):
2728
2729 2017-03-23  Wenson Hsieh  <wenson_hsieh@apple.com>
2730
2731         Dragging on a large image should not revert to a file icon if data interaction is enabled
2732         https://bugs.webkit.org/show_bug.cgi?id=170018
2733         <rdar://problem/31184508>
2734
2735         Reviewed by Tim Horton.
2736
2737         If data interaction is enabled, don't fall back to showing a file icon when initiating a drag on an image element.
2738
2739         New API tests:  DataInteractionTests.LargeImageToTargetDiv
2740                         DataInteractionTests.AttachmentElementItemProviders
2741
2742         * page/DragController.cpp:
2743         (WebCore::DragController::doImageDrag):
2744         (WebCore::DragController::shouldUseCachedImageForDragImage):
2745         * page/DragController.h:
2746
2747 2017-03-23  Youenn Fablet  <youenn@apple.com>
2748
2749         Rename RTCIceCandidateEvent to RTCPeerConnectionIceEvent
2750         https://bugs.webkit.org/show_bug.cgi?id=169981
2751
2752         Reviewed by Eric Carlson.
2753
2754         * CMakeLists.txt:
2755         * DerivedSources.make:
2756         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2757         * Modules/mediastream/PeerConnectionBackend.cpp:
2758         (WebCore::PeerConnectionBackend::fireICECandidateEvent):
2759         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
2760         * Modules/mediastream/RTCPeerConnection.cpp:
2761         * Modules/mediastream/RTCPeerConnectionIceEvent.cpp: Renamed from Source/WebCore/Modules/mediastream/RTCIceCandidateEvent.cpp.
2762         (WebCore::RTCPeerConnectionIceEvent::create):
2763         (WebCore::RTCPeerConnectionIceEvent::RTCPeerConnectionIceEvent):
2764         (WebCore::RTCPeerConnectionIceEvent::~RTCPeerConnectionIceEvent):
2765         (WebCore::RTCPeerConnectionIceEvent::candidate):
2766         (WebCore::RTCPeerConnectionIceEvent::eventInterface):
2767         * Modules/mediastream/RTCPeerConnectionIceEvent.h: Renamed from Source/WebCore/Modules/mediastream/RTCIceCandidateEvent.h.
2768         * Modules/mediastream/RTCPeerConnectionIceEvent.idl: Renamed from Source/WebCore/Modules/mediastream/RTCIceCandidateEvent.idl.
2769         * WebCore.xcodeproj/project.pbxproj:
2770         * dom/EventNames.in:
2771
2772 2017-03-23  Michael Catanzaro  <mcatanzaro@igalia.com>
2773
2774         window.crypto.getRandomValues() uses the insecure RC4 RNG
2775         https://bugs.webkit.org/show_bug.cgi?id=169623
2776
2777         Reviewed by Alex Christensen.
2778
2779         * PlatformMac.cmake:
2780         * WebCore.xcodeproj/project.pbxproj:
2781         * crypto/CryptoKey.cpp:
2782         (WebCore::CryptoKey::randomData): Use this on Mac now.
2783         * crypto/mac/CryptoKeyMac.cpp: Removed.
2784         * page/Crypto.cpp:
2785         (WebCore::Crypto::getRandomValues): Rollout r214188.
2786
2787 2017-03-23  Chris Dumez  <cdumez@apple.com>
2788
2789         SVG animations are not paused when their <svg> element is removed from the document
2790         https://bugs.webkit.org/show_bug.cgi?id=170030
2791         <rdar://problem/31230252>
2792
2793         Reviewed by Dean Jackson.
2794
2795         SVG animations were not paused when their <svg> element was removed from the document.
2796         This patch fixes the issue.
2797
2798         Test: svg/animations/animations-paused-when-removed-from-document.html
2799
2800         * svg/SVGSVGElement.cpp:
2801         (WebCore::SVGSVGElement::insertedInto):
2802         (WebCore::SVGSVGElement::removedFrom):
2803
2804 2017-03-22  Myles C. Maxfield  <mmaxfield@apple.com>
2805
2806         font shorthand should accept variation values
2807         https://bugs.webkit.org/show_bug.cgi?id=168998
2808
2809         Reviewed by Simon Fraser.
2810
2811         The CSS Fonts 4 spec has stabilized as to which variation values are allowed in
2812         the font shorthand property. Weights are allowed because a 0 weight is considered
2813         as a parse error, so there is no conflict with a unitless font-size of 0.
2814         font-style accepts angles, so there is no conflict there. However, font-stretch
2815         accepts percentages, which are also accepted by font-size, which means the newly
2816         extended grammar for font-stretch can't be accepted in the shorthand.
2817
2818         Tests: fast/text/font-style-parse.html
2819                fast/text/font-weight-parse.html
2820
2821         * css/parser/CSSPropertyParser.cpp:
2822         (WebCore::consumeFontWeight):
2823         (WebCore::consumeFontStyle):
2824         (WebCore::CSSPropertyParser::consumeFont):
2825         (WebCore::consumeFontWeightCSS21): Deleted.
2826         * css/parser/CSSPropertyParserHelpers.cpp:
2827         (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
2828         * css/parser/CSSPropertyParserHelpers.h:
2829
2830 2017-03-23  Chris Dumez  <cdumez@apple.com>
2831
2832         SVG animations are not paused when inserted into a hidden page
2833         https://bugs.webkit.org/show_bug.cgi?id=170026
2834         <rdar://problem/31228704>
2835
2836         Reviewed by Andreas Kling.
2837
2838         SVG animations were not paused when inserted into a hidden page. We would pause
2839         animations in a page when the page becomes hidden. However, new animations
2840         inserted in the page after this point would start, despite the page being
2841         hidden.
2842
2843         Tests:
2844         - svg/animations/animations-paused-when-inserted-in-hidden-document.html
2845         - svg/animations/animations-paused-when-inserted-in-hidden-document2.html
2846
2847         * dom/Document.cpp:
2848         (WebCore::Document::accessSVGExtensions):
2849         * svg/SVGDocumentExtensions.cpp:
2850         (WebCore::SVGDocumentExtensions::SVGDocumentExtensions):
2851         (WebCore::SVGDocumentExtensions::addTimeContainer):
2852         (WebCore::reportMessage):
2853         * svg/SVGDocumentExtensions.h:
2854         * testing/Internals.cpp:
2855         (WebCore::Internals::areSVGAnimationsPaused):
2856         * testing/Internals.h:
2857         * testing/Internals.idl:
2858
2859 == Rolled over to ChangeLog-2017-03-23 ==