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