We should prevent load of subframes inserted during FrameTree deconstruction
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-03-02  Chris Dumez  <cdumez@apple.com>
2
3         We should prevent load of subframes inserted during FrameTree deconstruction
4         https://bugs.webkit.org/show_bug.cgi?id=169095
5
6         Reviewed by Brent Fulgham.
7
8         When deconstructing the FrameTree, we fire the unload event in each subframe.
9         Such unload event handler may insert a new frame, we would previously load
10         such new frame which was unsafe as we would end up with an attached subframe
11         on a detached tree. To address the issue, we prevent new subframes from loading
12         while deconstructing the FrameTree and firing the unload events. This new
13         behavior is consistent with Chrome and should therefore be safe from a
14         compatibility standpoint.
15
16         Test: fast/frames/insert-frame-unload-handler.html
17
18         * dom/ContainerNodeAlgorithms.cpp:
19         (WebCore::disconnectSubframes):
20         Update SubframeLoadingDisabler call site now that the constructor takes in
21         a pointer instead of a reference.
22
23         * html/HTMLFrameOwnerElement.h:
24         (WebCore::SubframeLoadingDisabler::SubframeLoadingDisabler):
25         (WebCore::SubframeLoadingDisabler::~SubframeLoadingDisabler):
26         Update SubframeLoadingDisabler constructor to take in a pointer instead
27         of a reference, for convenience.
28
29         * loader/FrameLoader.cpp:
30         (WebCore::FrameLoader::detachChildren):
31         Prevent loads in subframes while detaching the subframes. It would be unsafe
32         as we copy the list of frames before iterating to fire the unload events.
33         Therefore, newly inserted frames would not get unloaded.
34
35 2017-03-02  Dave Hyatt  <hyatt@apple.com>
36
37         flex-basis should be 0% (not 0px) when omitted
38         https://bugs.webkit.org/show_bug.cgi?id=169100
39         rdar://problem/30429154
40
41         Reviewed by Dean Jackson.
42
43         Covered by existing tests.
44
45         * css/parser/CSSPropertyParser.cpp:
46         (WebCore::CSSPropertyParser::consumeFlex):
47
48 2017-02-22  Jiewen Tan  <jiewen_tan@apple.com>
49
50         WebCrypto API support for AES-GCM
51         https://bugs.webkit.org/show_bug.cgi?id=157175
52         <rdar://problem/27311691>
53
54         Reviewed by Brent Fulgham.
55
56         This patch adds support for AES-GCM. Operations of AES-GCM include: encrypt, decrypt, generateKey,
57         importKey, exportKey, wrapKey, and unwrapKey. https://www.w3.org/TR/WebCryptoAPI/#aes-gcm
58
59         Tests: crypto/subtle/aes-gcm-decrypt-malformed-parameters.html
60                crypto/subtle/aes-gcm-encrypt-malformed-parameters.html
61                crypto/subtle/aes-gcm-generate-export-key-jwk-length-128.html
62                crypto/subtle/aes-gcm-generate-export-key-jwk-length-192.html
63                crypto/subtle/aes-gcm-generate-export-key-jwk-length-256.html
64                crypto/subtle/aes-gcm-generate-export-raw-key.html
65                crypto/subtle/aes-gcm-generate-key-encrypt-decrypt.html
66                crypto/subtle/aes-gcm-generate-key.html
67                crypto/subtle/aes-gcm-import-jwk-key-length-128.html
68                crypto/subtle/aes-gcm-import-jwk-key-length-192.html
69                crypto/subtle/aes-gcm-import-jwk-key-length-256.html
70                crypto/subtle/aes-gcm-import-key-decrypt-additional-data-tag-length-32.html
71                crypto/subtle/aes-gcm-import-key-decrypt-additional-data.html
72                crypto/subtle/aes-gcm-import-key-decrypt-tagLengths.html
73                crypto/subtle/aes-gcm-import-key-decrypt.html
74                crypto/subtle/aes-gcm-import-key-encrypt-additional-data-tag-length-32.html
75                crypto/subtle/aes-gcm-import-key-encrypt-additional-data.html
76                crypto/subtle/aes-gcm-import-key-encrypt-tagLengths.html
77                crypto/subtle/aes-gcm-import-key-encrypt.html
78                crypto/subtle/aes-gcm-import-key-unwrap-jwk-key.html
79                crypto/subtle/aes-gcm-import-key-unwrap-raw-key.html
80                crypto/subtle/aes-gcm-import-key-wrap-jwk-key.html
81                crypto/subtle/aes-gcm-import-key-wrap-raw-key.html
82                crypto/subtle/aes-gcm-import-raw-key.html
83                crypto/workers/subtle/aes-gcm-import-key-decrypt.html
84                crypto/workers/subtle/aes-gcm-import-key-encrypt.html
85                crypto/workers/subtle/aes-gcm-import-key-unwrap-key.html
86                crypto/workers/subtle/aes-gcm-import-key-wrap-key.html
87
88         * CMakeLists.txt:
89         * DerivedSources.make:
90         * PlatformGTK.cmake:
91         * PlatformMac.cmake:
92         Add CryptoAlgorithmAES_CFBMac.cpp as well.
93         * WebCore.xcodeproj/project.pbxproj:
94         * bindings/js/JSSubtleCryptoCustom.cpp:
95         (WebCore::normalizeCryptoAlgorithmParameters):
96         Add support for AES-GCM.
97         * crypto/CommonCryptoUtilities.h:
98         Include SPI header for AES-GCM support.
99         * crypto/CryptoAlgorithmParameters.h:
100         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp: Added.
101         (WebCore::usagesAreInvalidForCryptoAlgorithmAES_GCM):
102         (WebCore::tagLengthIsValid):
103         (WebCore::CryptoAlgorithmAES_GCM::create):
104         (WebCore::CryptoAlgorithmAES_GCM::identifier):
105         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
106         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
107         (WebCore::CryptoAlgorithmAES_GCM::generateKey):
108         (WebCore::CryptoAlgorithmAES_GCM::importKey):
109         (WebCore::CryptoAlgorithmAES_GCM::exportKey):
110         * crypto/algorithms/CryptoAlgorithmAES_GCM.h: Added.
111         * crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp: Added.
112         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
113         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
114         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp: Added.
115         (WebCore::encryptAES_GCM):
116         (WebCore::decyptAES_GCM):
117         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
118         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
119         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
120         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
121         * crypto/parameters/AesGcmParams.idl: Added.
122         * crypto/parameters/CryptoAlgorithmAesGcmParams.h: Added.
123
124 2017-03-02  Alex Christensen  <achristensen@webkit.org>
125
126         Continue enabling WebRTC
127         https://bugs.webkit.org/show_bug.cgi?id=169056
128
129         Reviewed by Jon Lee.
130
131         * Configurations/FeatureDefines.xcconfig:
132
133 2017-03-02  Ryan Haddad  <ryanhaddad@apple.com>
134
135         Unreviewed, rolling out r213281.
136
137         This change caused API test WebKit2.UserMediaBasic to time
138         out.
139
140         Reverted changeset:
141
142         "[MediaStream] UIClient may not be notified of capture state
143         change when leaving a page"
144         https://bugs.webkit.org/show_bug.cgi?id=169014
145         http://trac.webkit.org/changeset/213281
146
147 2017-03-02  Jon Lee  <jonlee@apple.com>
148
149         Improve consistency of captions rendering on Mac
150         https://bugs.webkit.org/show_bug.cgi?id=169071
151
152         Reviewed by Eric Carlson.
153
154         * page/CaptionUserPreferencesMediaAF.h:
155         (WebCore::CaptionUserPreferencesMediaAF::captionsEdgeColorForTextColor): Deleted.
156         (WebCore::CaptionUserPreferencesMediaAF::cssPropertyWithTextEdgeColor): Deleted.
157
158         * page/CaptionUserPreferencesMediaAF.cpp:
159         (WebCore::appendCSS): Helper function to add a CSS rule with a provided StringBuilder.
160         (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS): Refactor to use
161         appendCSS.
162         (WebCore::CaptionUserPreferencesMediaAF::colorPropertyCSS): Ditto.
163         (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS): Update text edge styles.
164         - Add a blur to the shadow
165         - Drop shadow style includes 1px text border
166         - Always use black for the text edge color
167         Also convert the stroke rules to using the CSS property and values instead of straight strings.
168         (WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride): Fly-by fix of a typo.
169
170 2017-03-02  Chris Dumez  <cdumez@apple.com>
171
172         Download attribute set to "*\" save file with name "example.com"
173         https://bugs.webkit.org/show_bug.cgi?id=169066
174         <rdar://problem/30740875>
175
176         Reviewed by Alex Christensen.
177
178         The issue is that a backslash in recognized as an escaping character in
179         a quoted string as per RFC2616:
180         "
181         The backslash character ("\") MAY be used as a single-character
182         quoting mechanism only within quoted-string and comment constructs.
183         "
184
185         We therefore need to escape the backslashes in the filename before
186         using it in the Content-Disposition header, inside the quoted string.
187
188         Test: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html
189
190         * platform/network/ResourceResponseBase.cpp:
191         (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
192
193 2017-03-02  Youenn Fablet  <youenn@apple.com>
194
195         [WebRTC] Activate ICE candidate privacy policy
196         https://bugs.webkit.org/show_bug.cgi?id=168975
197
198         Reviewed by Alex Christensen.
199
200         Test: webrtc/datachannel/filter-ice-candidate.html
201
202         * testing/Internals.cpp:
203         (WebCore::Internals::Internals): Disabling ICE candidate filtering by default for rwt.
204         (WebCore::Internals::setICECandidateFiltering):
205         * testing/Internals.h:
206         * testing/Internals.idl:
207
208 2017-03-02  Eric Carlson  <eric.carlson@apple.com>
209
210         [MediaStream] UIClient may not be notified of capture state change when leaving a page
211         https://bugs.webkit.org/show_bug.cgi?id=169014
212         <rdar://problem/30632267>
213
214         Reviewed by Youenn Fablet.
215
216         Enable and update the WebKit API test WebKit2.UserMedia.
217
218         * dom/Document.cpp:
219         (WebCore::Document::prepareForDestruction): Always call page.updateIsPlayingMedia() if there
220         is active media in the document because it won't be possible when the state changes later
221         because the frame will have been cleared.
222
223 2017-03-02  Tomas Popela  <tpopela@redhat.com>
224
225         [WK2] Keyboard menu key should show context menu
226         https://bugs.webkit.org/show_bug.cgi?id=72099
227
228         Reviewed by Carlos Garcia Campos.
229
230         Show the context menu when the GtkWidget::popup-menu signal is
231         emitted. This signal is triggered by pressing a key (usually
232         the Menu key or the Shift + F10 shortcut) or it could be emitted on
233         WebKitWebView.
234
235         Test: fast/events/context-activated-by-key-event.html
236
237         Also could be tested by:
238
239         ManualTests/keyboard-menukey-event.html
240         ManualTests/win/contextmenu-key.html
241         ManualTests/win/contextmenu-key2.html
242
243         * page/EventHandler.cpp:
244         (WebCore::EventHandler::sendContextMenuEventForKey):
245         Correctly send the mouse event that used for showing the context menu.
246         Previously the event was immediately dispatched as it is, but this was
247         only the right way if some element was focused on the page. If there
248         was no focused element or non-empty text range then the event lacked
249         the right node, where it was supposed to be shown. The correct node
250         is determined and added to the event in the sendContextMenuEvent() so
251         we have to use this function to send the event.
252
253         Also use absoluteBoundingBoxRect() instead of
254         pixelSnappedAbsoluteClippedOverflowRect() when determining
255         a coordinate where to show the context menu for the currently focus
256         element. The latter is not returning a right box (it is bigger) which
257         could lead to the situation that no menu will be displayed at all,
258         because the HitTest won't contain the right element as the
259         determined coordinates could be outside of the element.
260         * page/EventHandler.h:
261
262 2017-03-02  Carlos Garcia Campos  <cgarcia@igalia.com>
263
264         [GTK] Crash in WebCore::CoordinatedGraphicsLayer::notifyFlushRequired
265         https://bugs.webkit.org/show_bug.cgi?id=166420
266
267         Reviewed by Žan Doberšek.
268
269         This is happening when closing a page that is being inspected. When CoordinatedGraphicsLayer::removeFromParent()
270         is called, the coordinator has already been invalidated, so all its layers were set a nullptr coordinator. I
271         think it's safe to simply handle m_coordinator being nullptr in notifyFlushRequired().
272
273         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
274         (WebCore::CoordinatedGraphicsLayer::notifyFlushRequired): Return early if the coordinator is nullptr.
275
276 2017-03-02  Andreas Kling  <akling@apple.com>
277
278         Don't keep dead resources in MemoryCache while under memory pressure.
279         <https://webkit.org/b/169070>
280
281         Reviewed by Antti Koivisto.
282
283         Have CachedResource::deleteIfPossible() remove the resource from the MemoryCache
284         if we're under memory pressure and that was the only thing keeping it alive.
285
286         This is consistent with the policy where dead resources are evicted from the cache
287         as we come under pressure.
288
289         * loader/cache/CachedResource.cpp:
290         (WebCore::CachedResource::deleteIfPossible):
291
292 2017-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
293
294         REGRESSION(r213062): [SOUP] UTF-8 filename in Content-Disposition header incorrectly handled since r213062
295         https://bugs.webkit.org/show_bug.cgi?id=169024
296
297         Reviewed by Youenn Fablet.
298
299         This made test http/tests/download/literal-utf-8.html to start failing. The problem is that I removed the
300         conversion made by String::fromUTF8WithLatin1Fallback that was added in r176930. I removed it because that made
301         fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html to timeout. This patch brings back
302         the String::fromUTF8WithLatin1Fallback call but only when the header string is 8 bit one.
303
304         Fixes: http/tests/download/literal-utf-8.html
305
306         * platform/network/soup/ResourceResponseSoup.cpp:
307         (WebCore::ResourceResponse::platformSuggestedFilename):
308
309 2017-03-01  Alex Christensen  <achristensen@webkit.org>
310
311         Actually fix Windows build.
312
313         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
314         Win32Handle is now in WTF namespace.
315
316 2017-03-01  Alex Christensen  <achristensen@webkit.org>
317
318         Fix WinCairo build after r213214
319         https://bugs.webkit.org/show_bug.cgi?id=168908
320
321         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
322
323 2017-03-01  Myles C. Maxfield  <mmaxfield@apple.com>
324
325         Implement font-stretch for installed fonts
326         https://bugs.webkit.org/show_bug.cgi?id=168888
327
328         Reviewed by Darin Adler and Dave Hyatt.
329
330         This patch implements the font-stretch property. Both parsing and the implementation is
331         implemented. Contrary to the name, this property doesn't actually stretch fonts; instead,
332         it provides one more input to the font selection routine.
333
334         The mapping from Core Text's [-1, 1] width values to font-stretch's percentage-based
335         values is not perfect. For now, I've implemented a piecewise linear curve mapping the
336         two. However, I expect to be able to improve this transfer function soon.
337
338         This patch does not implement the font-stretch descriptor in @font-face, and therefore
339         does not work with web fonts. I will add this support in
340         https://bugs.webkit.org/show_bug.cgi?id=168892. The reason it isn't done in this patch is
341         it requires some architectural changes to our CSSFontFace classes which are large enough
342         they should be separated into their own patch.
343
344         This patch lays the groundwork for implementing the 'wdth' variation axis. It does this
345         by adding a floating-point value to RenderStyle instead of just an enum. The font-stretch
346         keywords get converted to these floating-point numbers in accordance with the Fonts spec.
347         This patch doesn't actually implement the variations piece of font-stretch, because that
348         piece also requires some architectural changes. This patch just implements the installed
349         font selection piece.
350
351         This patch also fixes the regression introduced in r213163 with Helvetica Neue. Now that
352         our font selection algorithm has a concept of font stretch, weights 800 and 900 of
353         Helvetica Neue are rendered as expected. (And this patch updates the tests to make sure.)
354
355         Tests: fast/text/font-stretch-parse.html
356                fast/text/font-stretch-shorthand.html
357                FontCacheTest.FontLookupFromFamilyName
358
359         * css/CSSComputedStyleDeclaration.cpp:
360         (WebCore::fontStretchFromStyle): Map style values to CSS keywords.
361         (WebCore::ComputedStyleExtractor::propertyValue): Call the above function.
362         * css/CSSFontValue.cpp:
363         (WebCore::CSSFontValue::customCSSText): Used in getComputedStyle() for the "font"
364         shorthand.
365         (WebCore::CSSFontValue::equals):
366         * css/CSSFontValue.h:
367         * css/CSSProperties.json:
368         * css/StyleBuilderConverter.h:
369         (WebCore::StyleBuilderConverter::convertFontStretch): Map CSS keywords to style values.
370         * css/StyleProperties.cpp:
371         (WebCore::StyleProperties::appendFontLonghandValueIfExplicit): Used for
372         Element.style.font.
373         (WebCore::StyleProperties::fontValue):
374         * css/parser/CSSParserFastPaths.cpp:
375         (WebCore::CSSParserFastPaths::isKeywordPropertyID): Now that variation fonts are being
376         implemented, font-stretch is no longer a keyword property. Instead, it can also take a
377         number or percentage.
378         * css/parser/CSSPropertyParser.cpp:
379         (WebCore::consumeFontStretch): Parse the value.
380         (WebCore::CSSPropertyParser::parseSingleValue): Call the above function.
381         (WebCore::CSSPropertyParser::consumeFont): Ditto.
382         * platform/graphics/FontCache.h:
383         (WebCore::FontDescriptionKey::FontDescriptionKey): Caches should be sensitive to this
384         new value.
385         (WebCore::FontDescriptionKey::operator==):
386         (WebCore::FontDescriptionKey::computeHash):
387         * platform/graphics/FontDescription.h:
388         (WebCore::FontDescription::stretch): The parsed style value.
389         (WebCore::FontDescription::setStretch):
390         (WebCore::FontDescription::operator==):
391         (WebCore::FontCascadeDescription::initialStretch):
392         * platform/graphics/cocoa/FontCacheCoreText.cpp:
393         (WebCore::FontDatabase::InstalledFont::InstalledFont): Update the installed font selection
394         algorithm to understand font-stretch.
395         (WebCore::findClosestStretch):
396         (WebCore::filterStretch):
397         (WebCore::findClosestFont):
398         (WebCore::platformFontLookupWithFamily):
399         (WebCore::fontWithFamily):
400         (WebCore::FontCache::createFontPlatformData):
401
402 2017-03-01  Antti Koivisto  <antti@apple.com>
403
404         Rename recalcStyle to resolveStyle and clean up the signature
405         https://bugs.webkit.org/show_bug.cgi?id=169049
406
407         Reviewed by Sam Weinig.
408
409         Move to modern naming.
410
411         * dom/Document.cpp:
412         (WebCore::Document::resolveStyle):
413
414             Only two of the possible values are used so pass in a two-value enum.
415
416         (WebCore::Document::updateStyleIfNeeded):
417         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
418         (WebCore::Document::createRenderTree):
419         (WebCore::Document::finishedParsing):
420         (WebCore::Document::webkitWillEnterFullScreenForElement):
421         (WebCore::Document::recalcStyle): Deleted.
422         * dom/Document.h:
423         * inspector/InspectorOverlay.cpp:
424         (WebCore::InspectorOverlay::update):
425         * loader/DocumentWriter.cpp:
426         (WebCore::DocumentWriter::reportDataReceived):
427         * page/Frame.cpp:
428         (WebCore::Frame::setPageAndTextZoomFactors):
429         * page/Page.cpp:
430         (WebCore::Page::setPageScaleFactor):
431         * style/StyleTreeResolver.cpp:
432         (WebCore::Style::TreeResolver::Parent::Parent):
433         (WebCore::Style::TreeResolver::resolve):
434
435             Remove the argument, Document invalidates the document element if everything needs to be re-resolved.
436
437         * style/StyleTreeResolver.h:
438
439 2017-03-01  Alex Christensen  <achristensen@webkit.org>
440
441         Unreviewed, rolling out r213259.
442
443         Broke an internal build
444
445         Reverted changeset:
446
447         "Continue enabling WebRTC"
448         https://bugs.webkit.org/show_bug.cgi?id=169056
449         http://trac.webkit.org/changeset/213259
450
451 2017-03-01  Alex Christensen  <achristensen@webkit.org>
452
453         Continue enabling WebRTC
454         https://bugs.webkit.org/show_bug.cgi?id=169056
455
456         Reviewed by Jon Lee.
457
458         * Configurations/FeatureDefines.xcconfig:
459
460 2017-03-01  Chris Dumez  <cdumez@apple.com>
461
462         [WK2][!NETWORK_SESSION] Failure to download when using a download attribute with no value on an anchor
463         https://bugs.webkit.org/show_bug.cgi?id=169060
464         <rdar://problem/30773140>
465
466         Reviewed by Darin Adler.
467
468         Make sure we never set the suggested filename to the empty string when
469         the download attribute is present but has no value.
470
471         Test: http/tests/download/anchor-download-no-value.html
472
473         * loader/PolicyChecker.cpp:
474         (WebCore::PolicyChecker::checkNavigationPolicy):
475
476 2017-03-01  Antoine Quint  <graouts@apple.com>
477
478         [ios-simulator] Unskip media/modern-media-controls/audio/audio-controls-metrics.html
479         https://bugs.webkit.org/show_bug.cgi?id=167258
480         <rdar://problem/30282740>
481
482         We weren't enforcing the min-width to be 200px as well as the default width, and the
483         UA stylesheet would override it. Setting a default min-width that trumps the UA
484         stylesheet makes the test work correctly on iOS and we can safely unskip this test.
485
486         Reviewed by Jon Lee.
487
488         * Modules/modern-media-controls/controls/media-controls.css:
489         (:host(audio)):
490
491 2017-03-01  Javier Fernandez  <jfernandez@igalia.com>
492
493         Missing 'specification' section in the place-content shorthand
494         https://bugs.webkit.org/show_bug.cgi?id=169052
495
496         Reviewed by Darin Adler.
497
498         Added 'specification' section in the place-content shorthand.
499
500         No new tests, no new functionality.
501
502         * css/CSSProperties.json:
503
504 2017-02-28  Matt Rajca  <mrajca@apple.com>
505
506         Media: notify clients when autoplayed media is muted
507         https://bugs.webkit.org/show_bug.cgi?id=168987
508
509         Reviewed by Alex Christensen.
510
511         Added API tests.
512
513         * html/HTMLMediaElement.cpp:
514         (WebCore::HTMLMediaElement::setMuted):
515         (WebCore::HTMLMediaElement::pageMutedStateDidChange):
516         * page/AutoplayEvent.h:
517
518 2017-03-01  Commit Queue  <commit-queue@webkit.org>
519
520         Unreviewed, rolling out r213226.
521         https://bugs.webkit.org/show_bug.cgi?id=169051
522
523         Speculative rollout, might be causing several failures and
524         crashes in WebKitGTK+ (Requested by lajava on #webkit).
525
526         Reverted changeset:
527
528         "REGRESSION(r213062): [SOUP] UTF-8 filename in Content-
529         Disposition header incorrectly handled since r213062"
530         https://bugs.webkit.org/show_bug.cgi?id=169024
531         http://trac.webkit.org/changeset/213226
532
533 2017-03-01  James Craig  <jcraig@apple.com>
534
535         AX: add role aliases for ARIA DPUB module
536         https://bugs.webkit.org/show_bug.cgi?id=168978
537         <rdar://problem/30762724>
538
539         Reviewed by Chris Fleizach.
540
541         Added role aliases for ARIA DPUB module, and updated existing tests.
542
543         Test: accessibility/roles-exposed.html
544         Test: inspector/dom/getAccessibilityPropertiesForNode.html
545
546         * accessibility/AccessibilityObject.cpp:
547         (WebCore::initializeRoleMap): 
548
549 2017-03-01  Alex Christensen  <achristensen@webkit.org>
550
551         Don't call libwebrtc functions if libwebrtc.dylib doesn't exist while testing
552         https://bugs.webkit.org/show_bug.cgi?id=169045
553         <rdar://problem/30735413>
554
555         Reviewed by Youenn Fablet.
556
557         WebRTC tests fail instead of crashing now if libwebrtc.dylib is missing.
558         All other tests pass instead of crashing immediately when creating an Internals object.
559
560         * Modules/mediastream/RTCController.cpp:
561         (WebCore::RTCController::disableICECandidateFiltering):
562         (WebCore::RTCController::enableICECandidateFiltering):
563         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
564         (WebCore::createLibWebRTCPeerConnectionBackend):
565         * testing/Internals.cpp:
566         (WebCore::Internals::enableMockMediaEndpoint):
567         (WebCore::Internals::emulateRTCPeerConnectionPlatformEvent):
568         (WebCore::Internals::useMockRTCPeerConnectionFactory):
569         * testing/Internals.h:
570
571 2017-03-01  Javier Fernandez  <jfernandez@igalia.com>
572
573         [css-align] Implement the place-content shorthand
574         https://bugs.webkit.org/show_bug.cgi?id=168771
575
576         Reviewed by Manuel Rego Casasnovas.
577
578         The CSS Box Alignment specification defines a new shorthand to set the
579         Content Alignment properties (align-content and justify-content) at the
580         same time.
581
582         This patch provides the implementation of the CSS parsing logic and the
583         required regression tests.
584
585         Test: css3/parse-place-content.html
586
587         * css/CSSComputedStyleDeclaration.cpp:
588         (WebCore::ComputedStyleExtractor::propertyValue):
589         * css/CSSProperties.json:
590         * css/StyleProperties.cpp:
591         (WebCore::StyleProperties::getPropertyValue):
592         * css/parser/CSSPropertyParser.cpp:
593         (WebCore::consumeSimplifiedContentPosition):
594         (WebCore::CSSPropertyParser::consumePlaceContentShorthand):
595         (WebCore::CSSPropertyParser::parseShorthand):
596         * css/parser/CSSPropertyParser.h:
597
598 2017-03-01  Simon Fraser  <simon.fraser@apple.com>
599
600         Try to fix Windows build after r213191.
601
602         * platform/spi/win/CoreTextSPIWin.h:
603
604 2017-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
605
606         REGRESSION(r213062): [SOUP] UTF-8 filename in Content-Disposition header incorrectly handled since r213062
607         https://bugs.webkit.org/show_bug.cgi?id=169024
608
609         Reviewed by Youenn Fablet.
610
611         This made test http/tests/download/literal-utf-8.html to start failing. The problem is that I removed the
612         conversion made by String::fromUTF8WithLatin1Fallback that was added in r176930. I removed it because that made
613         fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html to timeout. This patch brings back
614         the String::fromUTF8WithLatin1Fallback call but only when the header string is 8 bit one.
615
616         Fixes: http/tests/download/literal-utf-8.html
617
618         * platform/network/soup/ResourceResponseSoup.cpp:
619         (WebCore::ResourceResponse::platformSuggestedFilename):
620
621 2017-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
622
623         [GTK] fast/canvas/canvas-createPattern-video-loading.html makes its subsequent test timeout
624         https://bugs.webkit.org/show_bug.cgi?id=169019
625
626         Reviewed by Xabier Rodriguez-Calvar.
627
628         The timeout happens normally when the media player is deleted and the pipeline state is set to NULL. The call to
629         gst_element_set_state() never returns because of different deadlocks with the video sink. Sometimes the deadlock
630         happens with the sample mutex used by VideoRenderRequestScheduler. VideoRenderRequestScheduler::requestRender()
631         calls webkitVideoSinkRepaintRequested() with the lock held, that ends up calling
632         MediaPlayerPrivateGStreamerBase::triggerRepaint(). When rendering can't be accelerated the draw timer is
633         scheduled and triggerRepaint blocks until the timer is fired. If the media player is destroyed before the timer
634         is fired, when setting the pipeline state to NULL, other VideoRenderRequestScheduler methods can be called, like
635         stop() that tries to get the sample mutex that is still held by requestRender(). So, first we need to make
636         sure that requestRender() releases the lock before calling webkitVideoSinkRepaintRequested(). But that's not
637         enough, we also need to ensure that the pipeline is set to NULL state after everyting has been properly
638         stopped. This is currently done in ~MediaPlayerPrivateGStreamer that happens before
639         ~MediaPlayerPrivateGStreamerBase, so gst_element_set_state() is hanging before allowing the
640         MediaPlayerPrivateGStreamerBase to be cleaned up. We should move the call to the end of
641         ~MediaPlayerPrivateGStreamerBase and ensure the draw timer and mutex are properly cleaned up before.
642
643         Fixes: fast/canvas/canvas-createPattern-video-loading.html
644
645         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
646         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Do not reset pipeline here.
647         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
648         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): Stop the draw mutex and notify the
649         lock to ensure we unblock. Do the pipeline reset at the end.
650         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
651         (VideoRenderRequestScheduler::requestRender): Release the mutex lock before calling webkitVideoSinkRepaintRequested().
652
653 2017-03-01  Tomas Popela  <tpopela@redhat.com>
654
655         Unreviewed compiler warning fix after r213218
656
657         * platform/gtk/PlatformKeyboardEventGtk.cpp:
658         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
659
660 2017-03-01  Tomas Popela  <tpopela@redhat.com>
661
662         [Cairo] Incorrectly determining height in GraphicsContext::roundToDevicePixels()
663         https://bugs.webkit.org/show_bug.cgi?id=169031
664
665         Reviewed by Carlos Garcia Campos.
666
667         We should compare if height is between -1 and 0 and not mixing height
668         and width together.
669
670         * platform/graphics/cairo/GraphicsContextCairo.cpp:
671         (WebCore::GraphicsContext::roundToDevicePixels):
672
673 2017-03-01  Tomas Popela  <tpopela@redhat.com>
674
675         [GTK] Fix problems found by Coverity scan in platform's keyboard and mouse events
676         https://bugs.webkit.org/show_bug.cgi?id=169028
677
678         Reviewed by Carlos Garcia Campos.
679
680         * platform/gtk/PlatformKeyboardEventGtk.cpp:
681         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): Initialize
682         the m_handledByInputMethod member.
683         * platform/gtk/PlatformMouseEventGtk.cpp:
684         (WebCore::PlatformMouseEvent::PlatformMouseEvent): Initialize the
685         m_modifierFlags member.
686
687 2017-03-01  Andreas Kling  <akling@apple.com>
688
689         Move MemoryPressureHandler to WTF
690         <https://webkit.org/b/168908>
691
692         Reviewed by Sam Weinig.
693
694         * CMakeLists.txt:
695         * PlatformMac.cmake:
696         * PlatformWin.cmake:
697         * WebCore.xcodeproj/project.pbxproj:
698         * bindings/js/ScriptController.cpp:
699         * history/PageCache.cpp:
700         * html/HTMLMediaElement.cpp:
701         * inspector/InspectorInstrumentation.h:
702         * inspector/InspectorMemoryAgent.h:
703         * page/FrameView.cpp:
704         * page/MemoryRelease.h:
705         * page/linux/ResourceUsageThreadLinux.cpp:
706         * platform/Linux.cmake:
707         * platform/graphics/FontCache.cpp:
708         * platform/graphics/WidthCache.h:
709         * platform/graphics/ca/TileController.cpp:
710         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
711         * platform/ios/LegacyTileCache.mm:
712         * platform/ios/LegacyTileGrid.mm:
713         * platform/ios/LegacyTileLayerPool.mm:
714         * platform/ios/TileControllerMemoryHandlerIOS.cpp:
715         * testing/Internals.cpp:
716
717 2017-03-01  Per Arne Vollan  <pvollan@apple.com>
718
719         [Win] Popup menus are too small in HiDPI mode.
720         https://bugs.webkit.org/show_bug.cgi?id=168965
721
722         Reviewed by Brent Fulgham.
723
724         Scale font with device scale factor.
725
726         * platform/win/PopupMenuWin.cpp:
727         (WebCore::PopupMenuWin::show):
728         (WebCore::PopupMenuWin::calculatePositionAndSize):
729         (WebCore::PopupMenuWin::paint):
730         * platform/win/PopupMenuWin.h:
731
732 2017-03-01  Joseph Pecoraro  <pecoraro@apple.com>
733
734         [WebRTC] Install libwebrtc.dylib inside of WebCore.framework
735         https://bugs.webkit.org/show_bug.cgi?id=168859
736
737         Reviewed by Dan Bernstein.
738
739         * Configurations/WebCore.xcconfig:
740         Set library search path to find the libwebrtc.dylib inside of WebCore's Frameworks
741         or in the WK_OVERRIDE_FRAMEWORKS_DIR.
742
743 2017-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
744
745         Addressing post-review comments on r213163
746         https://bugs.webkit.org/show_bug.cgi?id=168678
747
748         Unreviewed.
749
750         No new tests because there is no behavior change.
751
752         * platform/graphics/cocoa/FontCacheCoreText.cpp:
753         (WebCore::platformFontLookupWithFamily):
754
755 2017-02-28  Simon Fraser  <simon.fraser@apple.com>
756
757         Don't use the LinearGlyphMask format if accelerated drawing is disabled
758         https://bugs.webkit.org/show_bug.cgi?id=168997
759
760         Reviewed by Tim Horton.
761
762         Non-accelerated drawing doesn't work into LinearGlyphMask-format backing store,
763         so don't use that backing store format when accelerated drawing is disabled.
764
765         * platform/graphics/ca/PlatformCALayer.cpp:
766         (WebCore::PlatformCALayer::drawRepaintIndicator):
767         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
768         (layerContentsFormat):
769         (PlatformCALayerCocoa::updateContentsFormat):
770
771 2017-02-28  Simon Fraser  <simon.fraser@apple.com>
772
773         Make the repaint indicators show subpixel antialiased text indication a bit more clearly
774         https://bugs.webkit.org/show_bug.cgi?id=168988
775
776         Reviewed by Tim Horton.
777
778         Put a more obvious stroke around the repaint count when subpixel-antialiased layer text is enabled.
779
780         * platform/graphics/ca/PlatformCALayer.cpp:
781         (WebCore::PlatformCALayer::drawRepaintIndicator):
782         (WebCore::PlatformCALayer::drawTextAtPoint):
783         * platform/graphics/ca/PlatformCALayer.h:
784         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
785         (PlatformCALayerWin::drawTextAtPoint):
786         * platform/graphics/ca/win/PlatformCALayerWin.h:
787
788 2017-02-28  Alex Christensen  <achristensen@webkit.org>
789
790         LibWebRTCProvider should check existence of libwebrtc.dylib
791         https://bugs.webkit.org/show_bug.cgi?id=168986
792         <rdar://problem/30735413>
793
794         Reviewed by Youenn Fablet.
795
796         Some configurations of the webrtc tests overwrite the availability of WebRTC in order to test it
797         with MockLibWebRTCPeerConnection.  If the dylib can not be found, we can't use it, so we want to
798         fail these tests rather than crashing calling rtc::LogMessage::LogToDebug.
799
800         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
801         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
802         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
803         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
804         (WebCore::LibWebRTCProvider::factory):
805         (WebCore::LibWebRTCProvider::webRTCAvailable):
806         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
807         * testing/MockLibWebRTCPeerConnection.cpp:
808         (WebCore::useMockRTCPeerConnectionFactory):
809         (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection):
810
811 2017-02-28  Tim Horton  <timothy_horton@apple.com>
812
813         Apply a review comment that was missing in r213182
814
815         * loader/ios/QuickLook.mm:
816         (WebCore::isQuickLookPreviewURL):
817
818 2017-02-28  Tim Horton  <timothy_horton@apple.com>
819
820         [iOS] Getting QLPreviewProtocol slows down first navigation in Web process
821         https://bugs.webkit.org/show_bug.cgi?id=168940
822         <rdar://problem/29468999>
823
824         Reviewed by Simon Fraser.
825
826         No new tests, just a performance improvement.
827
828         * loader/DocumentLoader.cpp:
829         (WebCore::isRemoteWebArchive):
830         * loader/PolicyChecker.cpp:
831         (WebCore::PolicyChecker::checkNavigationPolicy):
832         * loader/ResourceLoadNotifier.cpp:
833         (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
834         Make use of isQuickLookPreviewURL.
835
836         * loader/ios/QuickLook.h:
837         * loader/ios/QuickLook.mm:
838         (WebCore::isQuickLookPreviewURL):
839         Add isQuickLookPreviewURL, which first early-returns if the protocol
840         of the URL is a well-known protocol, and then falls back to loading QuickLook.
841
842         In a microbenchmark this is a 30-40% improvement in total time spent
843         loading an empty HTML document (wall-clock time between loadHTMLString
844         and didFinishNavigation).
845
846 2017-02-28  Simon Fraser  <simon.fraser@apple.com>
847
848         Add Geolocation and DeviceOrientation to features.json 
849
850         * features.json:
851
852 2017-02-28  Wenson Hsieh  <wenson_hsieh@apple.com>
853
854         Data interaction should support attachment elements
855         https://bugs.webkit.org/show_bug.cgi?id=168916
856         <rdar://problem/30664519>
857
858         Reviewed by Ryosuke Niwa.
859
860         Teaches DragController to recognize and initiate dragging on attachment elements, and also adds a new
861         convenience method to the WebItemProviderPasteboard for block enumeration of available UIItemProviders. Covered
862         by a new API test: DataInteractionTests.AttachmentElementItemProviders.
863
864         * page/DragController.cpp:
865         (WebCore::DragController::draggableElement):
866         (WebCore::DragController::startDrag):
867         * platform/ios/WebItemProviderPasteboard.h:
868         * platform/ios/WebItemProviderPasteboard.mm:
869         (-[WebItemProviderPasteboard enumerateItemProvidersWithBlock:]):
870
871 2017-02-28  Mark Lam  <mark.lam@apple.com>
872
873         Remove setExclusiveThread() and peers from the JSLock.
874         https://bugs.webkit.org/show_bug.cgi?id=168977
875
876         Reviewed by Filip Pizlo.
877
878         No new tests because this should already be covered by existing tests.
879
880         * bindings/js/CommonVM.cpp:
881         (WebCore::commonVMSlow):
882
883 2017-02-28  Dave Hyatt  <hyatt@apple.com>
884
885         Centering text inside a button set to display flex and justify-content: center is impossible
886         https://bugs.webkit.org/show_bug.cgi?id=148872
887         <rdar://problem/22590086>
888
889         Reviewed by Simon Fraser.
890
891         Added new test in fast/forms.
892
893         * rendering/RenderButton.cpp:
894         (WebCore::RenderButton::addChild):
895         (WebCore::RenderButton::updateAnonymousChildStyle):
896         (WebCore::RenderButton::styleDidChange):
897         (WebCore::RenderButton::styleWillChange): Deleted.
898         (WebCore::RenderButton::setupInnerStyle): Deleted.
899         * rendering/RenderButton.h:
900         * rendering/RenderElement.cpp:
901         (WebCore::RenderElement::propagateStyleToAnonymousChildren):
902         * rendering/RenderElement.h:
903         (WebCore::RenderElement::updateAnonymousChildStyle):
904
905 2017-02-28  Antoine Quint  <graouts@apple.com>
906
907         [Modern Media Controls] Add missing compact mode assets for macOS
908         https://bugs.webkit.org/show_bug.cgi?id=168980
909         <rdar://problem/30763269>
910
911         Reviewed by Jon Lee.
912
913         Adding missing compact mode assets for the AirPlay, tracks, PiP and volume buttons.
914
915         * Modules/modern-media-controls/controls/icon-service.js:
916         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css:
917         (.media-controls.mac.inline.compact button.airplay):
918         (.media-controls.mac.inline.compact button.pip):
919         (.media-controls.mac.inline.compact button.tracks):
920         * Modules/modern-media-controls/images/macOS/airplay-compact@1x.png: Added.
921         * Modules/modern-media-controls/images/macOS/airplay-compact@2x.png: Added.
922         * Modules/modern-media-controls/images/macOS/media-selection-compact@1x.png: Added.
923         * Modules/modern-media-controls/images/macOS/media-selection-compact@2x.png: Added.
924         * Modules/modern-media-controls/images/macOS/pip-in-compact@1x.png: Added.
925         * Modules/modern-media-controls/images/macOS/pip-in-compact@2x.png: Added.
926         * Modules/modern-media-controls/images/macOS/volume-compact@1x.png:
927         * Modules/modern-media-controls/images/macOS/volume-compact@2x.png:
928         * Modules/modern-media-controls/images/macOS/volume-mute-compact@1x.png: Added.
929         * Modules/modern-media-controls/images/macOS/volume-mute-compact@2x.png: Added.
930
931 2017-02-28  Chris Dumez  <cdumez@apple.com>
932
933         [iOS] Throttle requestAnimationFrame to 30fps in low power mode
934         https://bugs.webkit.org/show_bug.cgi?id=168837
935         <rdar://problem/30700929>
936
937         Reviewed by Simon Fraser.
938
939         Throttle requestAnimationFrame to 30fps in low power mode on iOS to save battery.
940
941         ScriptedAnimationController now maintains an OptionSet of throttling reasons.
942         Throttling reasons for now are: OutsideViewport, VisuallyIdle, and LowPowerMode.
943         The requestAnimationFrame interval is then determined based on those throttling
944         reasons:
945         - OutsideViewport or VisuallyIdle: 10 seconds (very aggressive throttling)
946         - LowPowerMode: 30fps
947         - No reasons: 60fps
948
949         The Page now keeps track of low power mode state using a LowPowerModeNotifier.
950         Whenever low power mode changes, it updates the throttling reasons in all the
951         documents' ScriptedAnimationControllers in the frame tree.
952
953         Tests: fast/animation/request-animation-frame-throttling-detached-iframe.html
954                fast/animation/request-animation-frame-throttling-lowPowerMode.html
955
956         * dom/Document.cpp:
957         (WebCore::Document::requestAnimationFrame):
958         * dom/Document.h:
959         * dom/ScriptedAnimationController.cpp:
960         (WebCore::ScriptedAnimationController::ScriptedAnimationController):
961         (WebCore::throttlingReasonToString):
962         (WebCore::throttlingReasonsToString):
963         (WebCore::ScriptedAnimationController::addThrottlingReason):
964         (WebCore::ScriptedAnimationController::removeThrottlingReason):
965         (WebCore::ScriptedAnimationController::isThrottled):
966         (WebCore::ScriptedAnimationController::interval):
967         (WebCore::ScriptedAnimationController::page):
968         (WebCore::ScriptedAnimationController::scheduleAnimation):
969         * dom/ScriptedAnimationController.h:
970         (WebCore::ScriptedAnimationController::create):
971         * page/FrameView.cpp:
972         (WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState):
973         * page/Page.cpp:
974         (WebCore::Page::Page):
975         (WebCore::Page::isLowPowerModeEnabled):
976         (WebCore::Page::setLowPowerModeEnabledOverrideForTesting):
977         (WebCore::updateScriptedAnimationsThrottlingReason):
978         (WebCore::Page::setIsVisuallyIdleInternal):
979         (WebCore::Page::handleLowModePowerChange):
980         * page/Page.h:
981         * testing/Internals.cpp:
982         (WebCore::Internals::resetToConsistentState):
983         (WebCore::Internals::requestAnimationFrameInterval):
984         (WebCore::Internals::setLowPowerModeEnabled):
985         * testing/Internals.h:
986         * testing/Internals.idl:
987
988 2017-02-28  Youenn Fablet  <youenn@apple.com>
989
990         [WebRTC] Limit libwebrtc logging in Debug build
991         https://bugs.webkit.org/show_bug.cgi?id=168974
992
993         Reviewed by Alex Christensen.
994
995         Covered by manual testing..
996
997         * platform/Logging.h:
998         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
999         (WebCore::LibWebRTCProvider::callOnWebRTCSignalingThread):
1000
1001 2017-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
1002
1003         [macOS] Migrate off of CTFontCreateForCSS
1004         https://bugs.webkit.org/show_bug.cgi?id=168678
1005
1006         Reviewed by David Hyatt.
1007
1008         This patch implements the Font Matching Algorithm detailed in
1009         https://drafts.csswg.org/css-fonts-4/#font-matching-algorithm
1010         Previously, this was implemented inside Core Text (via
1011         CTFontCreateForCSS()), but that implementation does not understand
1012         variation fonts. Therefore it should move to WebKit (along with
1013         the general fact that CSS algorithms should be implemented in a
1014         CSS engine, not the platform's text engine).
1015
1016         This implementation is not completely divorced from the platform,
1017         however - Core Text exposes font weights on a [-1, 1] range, but
1018         CSS operates on a [1, 999] range. In order to provide the mapping
1019         to CSS weights, Core Text infrastructure is necessary. Therefore,
1020         this new implementation of the matching algorithm is only used
1021         on certain operating systems.
1022
1023         The new implementation of the algorithm is not bug-compatible with
1024         the existing implementation; this patch does represent a behavior
1025         change. However, I have reviewed the differences manually and
1026         believe this algorithm to be a progression over the previous one
1027         (except for one case with Helvetica Neue - see
1028         LayoutTests/ChangeLog for more information about that).
1029
1030         This patch also represents a 27% performance progression on our
1031         standard page load test (just measuring the performance of the font
1032         matching algorithm, and nothing else). (Because font matching is
1033         only a small part of the entire test, the overall progression is
1034         much smaller.)
1035
1036         Tests: FontCacheTest.FontLookupFromFamilyName
1037                FontCacheTest.FontLookupFromPostScriptName
1038
1039         * platform/graphics/FontCache.h:
1040         (WebCore::FontCache::createFontPlatformDataForTesting): Allow for
1041         unit testing.
1042         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1043         (WebCore::isSystemFont): Inlined.
1044         (WebCore::FontDatabase::singleton): Cache results of Core Text
1045         lookups.
1046         (WebCore::FontDatabase::Range::Range): Because of variation fonts,
1047         fonts' weights, widths, and slopes need to be represented as a range
1048         instead of an individual value.
1049         (WebCore::FontDatabase::Range::isValid):
1050         (WebCore::FontDatabase::Range::expand):
1051         (WebCore::FontDatabase::Range::includes):
1052         (WebCore::FontDatabase::InstalledFont::InstalledFont): Represents a
1053         Font Descriptor as well as some lookup information about it.
1054         (WebCore::FontDatabase::InstalledFontCollection::InstalledFontCollection):
1055         A collection of installed fonts.
1056         (WebCore::FontDatabase::InstalledFontCollection::insertInstalledFont):
1057         Cache minima and maxima.
1058         (WebCore::FontDatabase::InstalledFontCollection::isEmpty):
1059         (WebCore::FontDatabase::InstalledFontCollection::size):
1060         (WebCore::FontDatabase::lookupFamilyName): Get all the fonts in
1061         the family.
1062         (WebCore::FontDatabase::lookupPostScriptName): Get the font with
1063         the given PostScript name.
1064         (WebCore::FontDatabase::clear):
1065         (WebCore::FontDatabase::FontDatabase): Cache.
1066         (WebCore::iterateActiveFontsWithReturn): The Font Matching Algorithm
1067         works by starting with every font in the family, and the eliminating
1068         items from the set iteratively. Instead of actually removing items
1069         from a vector or linked list, we instead want to treat the collection
1070         as immutable and keep a parallel side-table of which items have been
1071         eliminated (in order to reduce copies and allocations). This makes
1072         sense because most families only have a handful of fonts in them.
1073         This function consults with the side-table to iterate only over the
1074         fonts which have not been eliminated.
1075         (WebCore::iterateActiveFonts): Ditto.
1076         (WebCore::findClosestStretch):
1077         (WebCore::filterStretch): Eliminate fonts based on their stretch
1078         value.
1079         (WebCore::findClosestStyle):
1080         (WebCore::filterStyle): Eliminate fonts based on their style value.
1081         (WebCore::findClosestWeight):
1082         (WebCore::filterWeight): Eliminate fonts based on their weight value.
1083         (WebCore::computeTargetWeight):
1084         (WebCore::findClosestFont): If we have a set of fonts in a family,
1085         select the font in the set which best matches the criteria.
1086         (WebCore::platformFontLookupWithFamily): While findClosestFont()
1087         function satisfies the spec's notion of the font matching algorithm,
1088         WebKit actually claims to be able to look up fonts by their PostScript
1089         name. Therefore, this function has a higher-level of logic to rectify
1090         the confusion that results when the PostScript name doesn't agree with
1091         the other CSS properties (like if you say "Helvetica-Bold" but also say
1092         font-weight: 100).
1093         * platform/spi/cocoa/CoreTextSPI.h: Add signature for system CSS
1094         font weight support.
1095
1096 2017-02-24  Matt Rajca  <mrajca@apple.com>
1097
1098         Media: notify clients when autoplayed media ends without being paused
1099         https://bugs.webkit.org/show_bug.cgi?id=168852
1100
1101         Reviewed by Alex Christensen.
1102
1103         Added API tests.
1104
1105         * html/HTMLMediaElement.cpp:
1106         (WebCore::HTMLMediaElement::setReadyState):
1107          Set state accordingly if we autoplayed or if playback was prevented.
1108         (WebCore::HTMLMediaElement::play):
1109          Update state if playback was prevented.
1110         (WebCore::HTMLMediaElement::playInternal):
1111          Update state if playback began without user interaction.
1112         (WebCore::HTMLMediaElement::pauseInternal):
1113          Update state.
1114         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
1115          If playback ends and it began without user interaction, send a DidPlayMediaWithoutInterference event.
1116         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto.
1117         * html/HTMLMediaElement.h:
1118         * page/AutoplayEvent.h:
1119
1120 2017-02-27  Dave Hyatt  <hyatt@apple.com>
1121
1122         Update flexbox to Blink's tip of tree
1123         https://bugs.webkit.org/show_bug.cgi?id=168657
1124
1125         Reviewed by Zalan Bujtas.
1126
1127         Added new tests in css3/flexbox.
1128
1129         * CMakeLists.txt:
1130         * WebCore.xcodeproj/project.pbxproj:
1131         * css/CSSComputedStyleDeclaration.cpp:
1132         (WebCore::ComputedStyleExtractor::propertyValue):
1133         * rendering/FlexibleBoxAlgorithm.cpp: Added.
1134         (WebCore::FlexItem::FlexItem):
1135         (WebCore::FlexLayoutAlgorithm::FlexLayoutAlgorithm):
1136         (WebCore::FlexLayoutAlgorithm::computeNextFlexLine):
1137         * rendering/FlexibleBoxAlgorithm.h: Added.
1138         (WebCore::FlexItem::hypotheticalMainAxisMarginBoxSize):
1139         (WebCore::FlexItem::flexBaseMarginBoxSize):
1140         (WebCore::FlexItem::flexedMarginBoxSize):
1141         (WebCore::FlexLayoutAlgorithm::isMultiline):
1142         * rendering/GridTrackSizingAlgorithm.cpp:
1143         (WebCore::GridTrackSizingAlgorithm::computeTrackBasedSize):
1144         (WebCore::GridTrackSizingAlgorithm::increaseSizesToAccommodateSpanningItems):
1145         (WebCore::GridTrackSizingAlgorithm::assumedRowsSizeForOrthogonalChild):
1146         (WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild):
1147         (WebCore::IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
1148         * rendering/GridTrackSizingAlgorithm.h:
1149         * rendering/OrderIterator.cpp:
1150         (WebCore::OrderIterator::next):
1151         (WebCore::OrderIterator::reset):
1152         (WebCore::OrderIteratorPopulator::~OrderIteratorPopulator):
1153         (WebCore::OrderIteratorPopulator::collectChild):
1154         (WebCore::OrderIteratorPopulator::OrderIteratorPopulator): Deleted.
1155         (WebCore::OrderIteratorPopulator::removeDuplicatedOrderValues): Deleted.
1156         * rendering/OrderIterator.h:
1157         (WebCore::OrderIteratorPopulator::OrderIteratorPopulator):
1158         * rendering/RenderBlock.cpp:
1159         (WebCore::RenderBlock::updateBlockChildDirtyBitsBeforeLayout):
1160         (WebCore::RenderBlock::layoutPositionedObject):
1161         (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
1162         (WebCore::RenderBlock::computeChildPreferredLogicalWidths):
1163         (WebCore::RenderBlock::hasDefiniteLogicalHeight):
1164         (WebCore::RenderBlock::availableLogicalHeightForPercentageComputation):
1165         * rendering/RenderBlock.h:
1166         (WebCore::RenderBlock::hasPercentHeightDescendants):
1167         * rendering/RenderBlockFlow.cpp:
1168         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths):
1169         * rendering/RenderBox.cpp:
1170         (WebCore::RenderBox::columnFlexItemHasStretchAlignment):
1171         (WebCore::RenderBox::isStretchingColumnFlexItem):
1172         (WebCore::RenderBox::hasStretchedLogicalWidth):
1173         (WebCore::RenderBox::sizesLogicalWidthToFitContent):
1174         (WebCore::RenderBox::computeInlineDirectionMargins):
1175         (WebCore::RenderBox::cacheIntrinsicContentLogicalHeightForFlexItem):
1176         (WebCore::RenderBox::updateLogicalHeight):
1177         (WebCore::RenderBox::computeLogicalHeightWithoutLayout):
1178         (WebCore::RenderBox::skipContainingBlockForPercentHeightCalculation):
1179         (WebCore::RenderBox::shouldTreatChildAsReplacedInTableCells):
1180         (WebCore::tableCellShouldHaveZeroInitialSize):
1181         (WebCore::RenderBox::computePercentageLogicalHeight):
1182         (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
1183         (WebCore::RenderBox::availableLogicalHeightUsing):
1184         (WebCore::RenderBox::percentageLogicalHeightIsResolvable):
1185         (WebCore::RenderBox::hasUnsplittableScrollingOverflow):
1186         (WebCore::flexItemHasStretchAlignment): Deleted.
1187         (WebCore::isStretchingColumnFlexItem): Deleted.
1188         (WebCore::logicalWidthIsResolvable): Deleted.
1189         (WebCore::RenderBox::hasDefiniteLogicalWidth): Deleted.
1190         (WebCore::percentageLogicalHeightIsResolvable): Deleted.
1191         (WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock): Deleted.
1192         (WebCore::RenderBox::hasDefiniteLogicalHeight): Deleted.
1193         * rendering/RenderBox.h:
1194         (WebCore::RenderBox::isGridItem):
1195         (WebCore::RenderBox::isFlexItem):
1196         (WebCore::RenderBox::selfAlignmentNormalBehavior):
1197         * rendering/RenderBoxModelObject.cpp:
1198         (WebCore::isOutOfFlowPositionedWithImplicitHeight):
1199         (WebCore::RenderBoxModelObject::containingBlockForAutoHeightDetection):
1200         (WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight):
1201         * rendering/RenderBoxModelObject.h:
1202         * rendering/RenderElement.cpp:
1203         (WebCore::RenderElement::removeChildInternal):
1204         * rendering/RenderFlexibleBox.cpp:
1205         (WebCore::RenderFlexibleBox::LineContext::LineContext):
1206         (WebCore::RenderFlexibleBox::RenderFlexibleBox):
1207         (WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths):
1208         (WebCore::contentAlignmentNormalBehavior):
1209         (WebCore::RenderFlexibleBox::styleDidChange):
1210         (WebCore::RenderFlexibleBox::layoutBlock):
1211         (WebCore::RenderFlexibleBox::repositionLogicalHeightDependentFlexItems):
1212         (WebCore::RenderFlexibleBox::clientLogicalBottomAfterRepositioning):
1213         (WebCore::RenderFlexibleBox::hasOrthogonalFlow):
1214         (WebCore::RenderFlexibleBox::flexBasisForChild):
1215         (WebCore::RenderFlexibleBox::crossAxisExtentForChild):
1216         (WebCore::RenderFlexibleBox::cachedChildIntrinsicContentLogicalHeight):
1217         (WebCore::RenderFlexibleBox::setCachedChildIntrinsicContentLogicalHeight):
1218         (WebCore::RenderFlexibleBox::clearCachedChildIntrinsicContentLogicalHeight):
1219         (WebCore::RenderFlexibleBox::childIntrinsicLogicalHeight):
1220         (WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth):
1221         (WebCore::RenderFlexibleBox::crossAxisIntrinsicExtentForChild):
1222         (WebCore::RenderFlexibleBox::mainAxisExtentForChild):
1223         (WebCore::RenderFlexibleBox::mainAxisContentExtentForChildIncludingScrollbar):
1224         (WebCore::RenderFlexibleBox::crossAxisExtent):
1225         (WebCore::RenderFlexibleBox::mainAxisExtent):
1226         (WebCore::RenderFlexibleBox::mainAxisContentExtent):
1227         (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
1228         (WebCore::RenderFlexibleBox::transformedWritingMode):
1229         (WebCore::RenderFlexibleBox::flowAwareMarginStartForChild):
1230         (WebCore::RenderFlexibleBox::flowAwareMarginEndForChild):
1231         (WebCore::RenderFlexibleBox::flowAwareMarginBeforeForChild):
1232         (WebCore::RenderFlexibleBox::crossAxisMarginExtentForChild):
1233         (WebCore::RenderFlexibleBox::flowAwareLocationForChild):
1234         (WebCore::RenderFlexibleBox::useChildAspectRatio):
1235         (WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing):
1236         (WebCore::RenderFlexibleBox::setFlowAwareLocationForChild):
1237         (WebCore::RenderFlexibleBox::mainAxisLengthIsDefinite):
1238         (WebCore::RenderFlexibleBox::crossAxisLengthIsDefinite):
1239         (WebCore::RenderFlexibleBox::cacheChildMainSize):
1240         (WebCore::RenderFlexibleBox::clearCachedMainSizeForChild):
1241         (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild):
1242         (WebCore::RenderFlexibleBox::layoutFlexItems):
1243         (WebCore::RenderFlexibleBox::autoMarginOffsetInMainAxis):
1244         (WebCore::RenderFlexibleBox::updateAutoMarginsInMainAxis):
1245         (WebCore::RenderFlexibleBox::hasAutoMarginsInCrossAxis):
1246         (WebCore::RenderFlexibleBox::availableAlignmentSpaceForChild):
1247         (WebCore::RenderFlexibleBox::updateAutoMarginsInCrossAxis):
1248         (WebCore::RenderFlexibleBox::marginBoxAscentForChild):
1249         (WebCore::RenderFlexibleBox::computeChildMarginValue):
1250         (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax):
1251         (WebCore::RenderFlexibleBox::crossSizeForPercentageResolution):
1252         (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution):
1253         (WebCore::RenderFlexibleBox::childLogicalHeightForPercentageResolution):
1254         (WebCore::RenderFlexibleBox::adjustChildSizeForAspectRatioCrossAxisMinAndMax):
1255         (WebCore::RenderFlexibleBox::constructFlexItem):
1256         (WebCore::RenderFlexibleBox::freezeViolations):
1257         (WebCore::RenderFlexibleBox::freezeInflexibleItems):
1258         (WebCore::RenderFlexibleBox::resolveFlexibleLengths):
1259         (WebCore::alignmentOffset):
1260         (WebCore::RenderFlexibleBox::setOverrideMainAxisContentSizeForChild):
1261         (WebCore::RenderFlexibleBox::staticMainAxisPositionForPositionedChild):
1262         (WebCore::RenderFlexibleBox::staticCrossAxisPositionForPositionedChild):
1263         (WebCore::RenderFlexibleBox::staticInlinePositionForPositionedChild):
1264         (WebCore::RenderFlexibleBox::staticBlockPositionForPositionedChild):
1265         (WebCore::RenderFlexibleBox::setStaticPositionForPositionedLayout):
1266         (WebCore::RenderFlexibleBox::prepareChildForPositionedLayout):
1267         (WebCore::RenderFlexibleBox::alignmentForChild):
1268         (WebCore::RenderFlexibleBox::resetAutoMarginsAndLogicalTopInCrossAxis):
1269         (WebCore::RenderFlexibleBox::needToStretchChildLogicalHeight):
1270         (WebCore::RenderFlexibleBox::childHasIntrinsicMainAxisSize):
1271         (WebCore::RenderFlexibleBox::crossAxisOverflowForChild):
1272         (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
1273         (WebCore::RenderFlexibleBox::layoutColumnReverse):
1274         (WebCore::initialAlignContentOffset):
1275         (WebCore::alignContentSpaceBetweenChildren):
1276         (WebCore::RenderFlexibleBox::alignFlexLines):
1277         (WebCore::RenderFlexibleBox::adjustAlignmentForChild):
1278         (WebCore::RenderFlexibleBox::alignChildren):
1279         (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild):
1280         (WebCore::RenderFlexibleBox::flipForRightToLeftColumn):
1281         (WebCore::RenderFlexibleBox::flipForWrapReverse):
1282         (WebCore::RenderFlexibleBox::Violation::Violation): Deleted.
1283         (WebCore::RenderFlexibleBox::setCrossAxisExtent): Deleted.
1284         (WebCore::RenderFlexibleBox::flowAwareMarginAfterForChild): Deleted.
1285         (WebCore::RenderFlexibleBox::mainAxisBorderAndPaddingExtentForChild): Deleted.
1286         (WebCore::RenderFlexibleBox::mainAxisScrollbarExtentForChild): Deleted.
1287         (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild): Deleted.
1288         (WebCore::RenderFlexibleBox::computeNextFlexLine): Deleted.
1289         (WebCore::RenderFlexibleBox::setLogicalOverrideSize): Deleted.
1290         (WebCore::RenderFlexibleBox::numberOfInFlowPositionedChildren): Deleted.
1291         (WebCore::RenderFlexibleBox::needToStretchChild): Deleted.
1292         (WebCore::contentAlignmentNormalBehaviorFlexibleBox): Deleted.
1293         * rendering/RenderFlexibleBox.h:
1294         (WebCore::RenderFlexibleBox::orderIterator):
1295         (WebCore::RenderFlexibleBox::isFlexibleBoxImpl):
1296         * rendering/RenderFullScreen.h:
1297         * rendering/RenderGrid.cpp:
1298         (WebCore::selfAlignmentChangedToStretchInRowAxis):
1299         (WebCore::selfAlignmentChangedFromStretchInRowAxis):
1300         (WebCore::selfAlignmentChangedFromStretchInColumnAxis):
1301         (WebCore::RenderGrid::styleDidChange):
1302         (WebCore::RenderGrid::computeTrackBasedLogicalHeight):
1303         (WebCore::RenderGrid::computeTrackSizesForDefiniteSize):
1304         (WebCore::RenderGrid::gridGapForDirection):
1305         (WebCore::RenderGrid::guttersSize):
1306         (WebCore::RenderGrid::computeTrackSizesForIndefiniteSize):
1307         (WebCore::RenderGrid::computeAutoRepeatTracksCount):
1308         (WebCore::RenderGrid::trackSizesForComputedStyle):
1309         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
1310         (WebCore::RenderGrid::populateGridPositionsForDirection):
1311         (WebCore::RenderGrid::alignSelfForChild):
1312         (WebCore::RenderGrid::justifySelfForChild):
1313         (WebCore::RenderGrid::columnAxisPositionForChild):
1314         (WebCore::RenderGrid::rowAxisPositionForChild):
1315         (WebCore::RenderGrid::columnAxisOffsetForChild):
1316         (WebCore::RenderGrid::rowAxisOffsetForChild):
1317         (WebCore::RenderGrid::needToStretchChildLogicalHeight): Deleted.
1318         * rendering/RenderGrid.h:
1319         * rendering/RenderLayer.cpp:
1320         (WebCore::RenderLayer::updateScrollbarsAfterLayout):
1321         * rendering/RenderListBox.cpp:
1322         (WebCore::RenderListBox::computeLogicalHeight):
1323         * rendering/RenderTable.cpp:
1324         (WebCore::RenderTable::layout):
1325         * rendering/RenderTableCell.cpp:
1326         (WebCore::RenderTableCell::layout):
1327         * rendering/RenderTableSection.cpp:
1328         (WebCore::shouldFlexCellChild):
1329         (WebCore::RenderTableSection::relayoutCellIfFlexed):
1330         (WebCore::RenderTableSection::layoutRows):
1331         * rendering/RenderTableSection.h:
1332         * rendering/RenderTextControl.cpp:
1333         (WebCore::RenderTextControl::computeLogicalHeight):
1334         * rendering/style/RenderStyle.cpp:
1335         (WebCore::resolvedSelfAlignment):
1336         (WebCore::RenderStyle::resolvedAlignSelf):
1337         (WebCore::RenderStyle::resolvedJustifySelf):
1338         * rendering/style/RenderStyle.h:
1339         * style/RenderTreeUpdater.cpp:
1340         (WebCore::textRendererIsNeeded):
1341
1342 2017-02-28  Alex Christensen  <achristensen@webkit.org>
1343
1344         Main resource requests need cachePartition
1345         https://bugs.webkit.org/show_bug.cgi?id=168806
1346         <rdar://30639764>
1347
1348         Reviewed by Brady Eidson.
1349
1350         Test: http/tests/security/credentials-main-resource.html
1351
1352         r211751 caused an unintended regression on pages whose main resource is protected
1353         by basic authentication.  We were not setting the cache partition for main resource
1354         requests, and we use the cache partition now for credentials, so the credentials for
1355         the main resource were not being put into a partition in the CredentialStorage that
1356         would not be used for subresources of the page, whose requests had the correct partition
1357         for the domain of the page.  This caused users to have to enter their credentials twice,
1358         once for the main resource and once for any subresources.  This is fixed by using the
1359         domain from the main resource request as the cache partition.  Elsewhere the Document is
1360         used to get the cache partition, but there is no Document yet when requesting the main resource.
1361
1362         * loader/DocumentLoader.cpp:
1363         (WebCore::DocumentLoader::startLoadingMainResource):
1364         Set the cache partition for the main resource loads based on the SecurityOrigin of the
1365         initial request if we are loading the main resource for a new top document.  If the main resource
1366         request is redirected, then we will still use the partition of the initial request because that is
1367         what the user requested and that is where the user entered the credentials.
1368         * loader/cache/CachedResourceLoader.h:
1369         * loader/cache/CachedResourceRequest.cpp:
1370         (WebCore::CachedResourceRequest::setDomainForCachePartition):
1371         * loader/cache/CachedResourceRequest.h:
1372
1373 2017-02-28  Alex Christensen  <achristensen@webkit.org>
1374
1375         REGRESSION: LayoutTest http/tests/security/credentials-iframes.html is failing on ios-simulator
1376         https://bugs.webkit.org/show_bug.cgi?id=167967
1377
1378         Reviewed by Brady Eidson.
1379
1380         XHR credentials have a persistence of CredentialPersistenceNone because we keep
1381         them in the WebCore::CredentialStorage.  We were storing them to CFNetwork's NSURLCredentialStorage
1382         on iOS and then they were being given as the proposedCredential in
1383         NetworkDataTaskCocoa::tryPasswordBasedAuthentication even though we set CredentialPersistenceNone.
1384
1385         This fixes http/tests/security/credentials-iframes.html
1386
1387         * platform/network/CredentialStorage.cpp:
1388         (WebCore::CredentialStorage::set):
1389         * platform/network/CredentialStorage.h:
1390         * platform/network/cf/CredentialStorageCFNet.cpp:
1391         (WebCore::CredentialStorage::saveToPersistentStorage): Deleted.
1392         * platform/network/mac/CredentialStorageMac.mm:
1393         (WebCore::CredentialStorage::saveToPersistentStorage): Deleted.
1394
1395 2017-02-27  Alex Christensen  <achristensen@webkit.org>
1396
1397         Fix WinCairo build.
1398
1399         * PlatformWinCairo.cmake:
1400
1401 2017-02-27  Alex Christensen  <achristensen@webkit.org>
1402
1403         Begin enabling WebRTC on 64-bit
1404         https://bugs.webkit.org/show_bug.cgi?id=168915
1405
1406         Reviewed by Eric Carlson.
1407
1408         * Configurations/FeatureDefines.xcconfig:
1409
1410 2017-02-27  Antoine Quint  <graouts@apple.com>
1411
1412         [Modern Media Controls] Use compact mode by default on macOS
1413         https://bugs.webkit.org/show_bug.cgi?id=168958
1414         <rdar://problem/30748638>
1415
1416         Reviewed by Jon Lee.
1417
1418         We now use the compact layout mode by default on macOS.
1419
1420         * Modules/modern-media-controls/controls/layout-item.js: Remove the ReducedPadding trait.
1421         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css: 
1422         (.media-controls.mac.inline.compact .time-label,): Vertically align the time label with
1423         the scrubber in compact mode.
1424         (.media-controls.mac.inline.compact .scrubber.slider): Correctly position the scrubber in
1425         compact mode so that it's vertically aligned.
1426         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
1427         (MacOSInlineMediaControls.prototype.layoutTraitsDidChange): Remove handling of tight and
1428         reduced padding traits since these do not apply to macOS anymore. We also notify the
1429         scrubber of a layout trait change so that it may adjust its height.
1430         * Modules/modern-media-controls/controls/scrubber.js:
1431         (Scrubber):
1432         (Scrubber.prototype.layoutTraitsDidChange): Adjust the height of the scrubber to match
1433         compact layout traits.
1434         * Modules/modern-media-controls/controls/time-control.js:
1435         (TimeControl.prototype.get isSufficientlyWide): Adjust the minimum scrubber width for
1436         TimeControl visibility to match compact layout traits.
1437         * Modules/modern-media-controls/media/media-controller.js:
1438         (MediaController.prototype.get layoutTraits): Use the compact layout trait by default
1439         on macOS and make the tight padding specific to iOS.
1440
1441 2017-02-27  Antoine Quint  <graouts@apple.com>
1442
1443         [Modern Media Controls] Adhere to tight padding on iOS
1444         https://bugs.webkit.org/show_bug.cgi?id=168949
1445         <rdar://problem/30746164>
1446
1447         Reviewed by Jon Lee.
1448
1449         We used to only support custom margins on macOS, to support this on iOS as
1450         well, we promote the notification when the layoutTraits property is set to
1451         MediaControls and expose a new protected method layoutTraitsDidChange() for
1452         subclasses to implement. IOSInlineMediaControls now implements that method
1453         and will use tighter margins for the TightPadding layout trait.
1454
1455         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-tight-padding.html
1456
1457         * Modules/modern-media-controls/controls/ios-inline-media-controls.js:
1458         (IOSInlineMediaControls.prototype.layoutTraitsDidChange):
1459         (IOSInlineMediaControls):
1460         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
1461         (MacOSInlineMediaControls.prototype.get layoutTraits): Deleted.
1462         (MacOSInlineMediaControls.prototype.set layoutTraits): Deleted.
1463         (MacOSInlineMediaControls.prototype._matchLayoutTraits): Deleted.
1464         * Modules/modern-media-controls/controls/media-controls.js:
1465         (MediaControls.prototype.get layoutTraits):
1466         (MediaControls.prototype.set layoutTraits):
1467         (MediaControls.prototype.layoutTraitsDidChange):
1468
1469 2017-02-27  Youenn Fablet  <youenn@apple.com>
1470
1471         [WebRTC] Support modern RTCStatsReport
1472         https://bugs.webkit.org/show_bug.cgi?id=166916
1473         <rdar://problem/30293780>
1474
1475         Reviewed by Alex Christensen.
1476
1477         Updating binding generator and IDL parser to handle maplike.
1478         Covered by binding tests.
1479
1480         Added support for maplike binding from JS wrapper to DOM class.
1481         The principle is to have the JSXX wrapper having a @backingMap slot containing a Map.
1482         All maplike methods are forwarded to the corresponding Map methods.
1483         The XX object is responsible to add key/value pairs using a helper routine.
1484         The creation of the Map is done at creation of the JSXX wrapper.
1485
1486         DOM class is interacting with the map through DOMMapLike.
1487         Extracted DOMGuarded from DOM promise implementation.
1488         This allows reusing this code for DOMMapLike.
1489
1490         Covered by binding tests and manual tests.
1491
1492         * CMakeLists.txt:
1493         * DerivedSources.make:
1494         * Modules/mediastream/RTCStatsReport.h:
1495         (WebCore::RTCStatsReport::InboundRTPStreamStats::InboundRTPStreamStats):
1496         (WebCore::RTCStatsReport::OutboundRTPStreamStats::OutboundRTPStreamStats):
1497         (WebCore::RTCStatsReport::create):
1498         (WebCore::RTCStatsReport::synchronizeBackingMap):
1499         (WebCore::RTCStatsReport::backingMap):
1500         (WebCore::RTCStatsReport::addStats):
1501         * Modules/mediastream/RTCStatsReport.idl:
1502         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1503         (WebCore::fromStdString):
1504         (WebCore::fillRTCStats):
1505         (WebCore::fillRTCRTPStreamStats):
1506         (WebCore::fillInboundRTPStreamStats):
1507         (WebCore::fillOutboundRTPStreamStats):
1508         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
1509         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1510         * WebCore.xcodeproj/project.pbxproj:
1511         * bindings/js/JSDOMBindingInternals.js: Added.
1512         (mapLikeForEach):
1513         * bindings/js/JSDOMGlobalObject.cpp:
1514         (WebCore::JSDOMGlobalObject::visitChildren):
1515         * bindings/js/JSDOMGlobalObject.h:
1516         * bindings/js/JSDOMGuardedObject.cpp: Added.
1517         (WebCore::DOMGuardedObject::DOMGuardedObject):
1518         (WebCore::DOMGuardedObject::~DOMGuardedObject):
1519         (WebCore::DOMGuardedObject::clear):
1520         (WebCore::DOMGuardedObject::contextDestroyed):
1521         * bindings/js/JSDOMGuardedObject.h: Added.
1522         (WebCore::DOMGuardedObject::isSuspended):
1523         (WebCore::DOMGuardedObject::visitAggregate):
1524         (WebCore::DOMGuardedObject::guardedObject):
1525         (WebCore::DOMGuardedObject::globalObject):
1526         (WebCore::DOMGuardedObject::isEmpty):
1527         (WebCore::DOMGuarded::DOMGuarded):
1528         (WebCore::DOMGuarded::guarded):
1529         * bindings/js/JSDOMMapLike.cpp: Added.
1530         (WebCore::getBackingMap):
1531         (WebCore::initializeBackingMap):
1532         (WebCore::createBackingMap):
1533         (WebCore::forwardAttributeGetterToBackingMap):
1534         (WebCore::forwardFunctionCallToBackingMap):
1535         (WebCore::forwardForEachCallToBackingMap):
1536         * bindings/js/JSDOMMapLike.h: Added.
1537         (WebCore::DOMMapLike::set):
1538         (WebCore::synchronizeBackingMap):
1539         (WebCore::forwardSizeToMapLike):
1540         (WebCore::forwardEntriesToMapLike):
1541         (WebCore::forwardKeysToMapLike):
1542         (WebCore::forwardValuesToMapLike):
1543         (WebCore::forwardClearToMapLike):
1544         (WebCore::forwardForEachToMapLike):
1545         (WebCore::forwardHasToMapLike):
1546         (WebCore::forwardAddToMapLike):
1547         (WebCore::forwardDeleteToMapLike):
1548         * bindings/js/JSDOMPromise.cpp:
1549         (WebCore::DeferredPromise::promise):
1550         (WebCore::DeferredPromise::reject):
1551         * bindings/js/JSDOMPromise.h:
1552         (WebCore::DeferredPromise::resolve):
1553         (WebCore::DeferredPromise::resolveWithNewlyCreated):
1554         (WebCore::DeferredPromise::reject):
1555         (WebCore::DeferredPromise::resolveWithCallback):
1556         (WebCore::DeferredPromise::rejectWithCallback):
1557         (WebCore::DeferredPromise::DeferredPromise):
1558         (WebCore::DeferredPromise::deferred):
1559         * bindings/js/WebCoreBuiltinNames.h:
1560         * bindings/scripts/CodeGeneratorJS.pm:
1561         (PrototypeFunctionCount):
1562         (GeneratePropertiesHashTable):
1563         (InterfaceNeedsIterator):
1564         (GenerateImplementation):
1565         (GenerateParametersCheck):
1566         * bindings/scripts/IDLParser.pm:
1567         (assert):
1568         (parseAttributeOrOperationOrIterator):
1569         (parseSerializer):
1570         (parseAttributeOrOperationRest):
1571         (parseAttribute):
1572         (parseAttributeRest):
1573         (parseOperationOrIterator):
1574         (parseOptionalIterableInterface):
1575         (parseMapLikeRest):
1576         (parseMapLikeProperties):
1577         (parseOperationRest):
1578         (applyMemberList):
1579         * bindings/scripts/test/JS/JSMapLike.cpp: Added.
1580         * bindings/scripts/test/JS/JSMapLike.h: Added.
1581         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: Added.
1582         * bindings/scripts/test/JS/JSReadOnlyMapLike.h: Added.
1583         * bindings/scripts/test/TestMapLike.idl: Added.
1584         * bindings/scripts/test/TestReadOnlyMapLike.idl: Added.
1585
1586 2017-02-27  Mark Lam  <mark.lam@apple.com>
1587
1588         Introduce a VM Traps mechanism and refactor Watchdog to use it.
1589         https://bugs.webkit.org/show_bug.cgi?id=168842
1590
1591         Reviewed by Filip Pizlo.
1592
1593         No new tests needed because this is a re-implementation of existing functionality.
1594
1595         * bindings/js/WorkerScriptController.cpp:
1596         (WebCore::WorkerScriptController::WorkerScriptController):
1597         (WebCore::WorkerScriptController::scheduleExecutionTermination):
1598
1599 2017-02-27  Andy Estes  <aestes@apple.com>
1600
1601         [Cocoa] Rename FileMac.mm to FileCocoa.mm
1602         https://bugs.webkit.org/show_bug.cgi?id=168947
1603
1604         Reviewed by Zalan Bujtas.
1605
1606         * PlatformMac.cmake:
1607         * WebCore.xcodeproj/project.pbxproj:
1608         * fileapi/FileCocoa.mm: Renamed from Source/WebCore/fileapi/FileMac.mm.
1609
1610 2017-02-27  Andy Estes  <aestes@apple.com>
1611
1612         [iOS] Enable file replacement
1613         https://bugs.webkit.org/show_bug.cgi?id=168907
1614         <rdar://problem/22258242>
1615
1616         Reviewed by David Kilzer.
1617
1618         Covered by existing tests.
1619
1620         * fileapi/FileMac.mm:
1621         (WebCore::File::shouldReplaceFile): Stop using Carbon and AppKit API for determining if a
1622         file path is a file package. Use NSURL and CoreServices instead, which exist on Mac and iOS.
1623
1624 2017-02-27  Antoine Quint  <graouts@apple.com>
1625
1626         [Modern Media Controls] Use a solid background for <audio> controls on macOS
1627         https://bugs.webkit.org/show_bug.cgi?id=168941
1628         <rdar://problem/30744316>
1629
1630         Reviewed by Dean Jackson.
1631
1632         Use a solid background for <audio> elements on macOS, the same way we do on iOS.
1633
1634         Test: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-audio-background.html
1635
1636         * Modules/modern-media-controls/controls/macos-media-controls.css:
1637         (:host(audio) .media-controls.mac.inline > .controls-bar):
1638         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint):
1639
1640 2017-02-27  Antoine Quint  <graouts@apple.com>
1641
1642         [Modern Media Controls] StatusLabel should use similar properties to TimeLabel
1643         https://bugs.webkit.org/show_bug.cgi?id=168938
1644         <rdar://problem/30743185>
1645
1646         Reviewed by Dean Jackson.
1647
1648         Ensure we use the same styling properties for StatusLabel and TimeLabel.
1649
1650         Tests: media/modern-media-controls/status-label/status-label-ios.html
1651                media/modern-media-controls/status-label/status-label-macos.html
1652
1653         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
1654         (.media-controls.ios.inline .time-label,):
1655         (.media-controls.ios.inline .time-label): Deleted.
1656         * Modules/modern-media-controls/controls/macos-media-controls.css:
1657         (.media-controls.mac > .controls-bar .time-label,):
1658         (.media-controls.mac > .controls-bar .time-label): Deleted.
1659         * Modules/modern-media-controls/controls/status-label.css:
1660         (.status-label):
1661
1662 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
1663
1664         Rename ICU cursor iterator to caret iterator
1665         https://bugs.webkit.org/show_bug.cgi?id=168206
1666
1667         Reviewed by Simon Fraser.
1668
1669         Mechanical find/replace.
1670
1671         No new tests because there is no behavior change.
1672
1673         * platform/graphics/ComplexTextController.cpp:
1674         (WebCore::ComplexTextController::offsetForPosition):
1675         * rendering/RenderText.cpp:
1676         (WebCore::RenderText::previousOffset):
1677         (WebCore::RenderText::nextOffset):
1678
1679 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
1680
1681         Unprefix -webkit-line-break
1682         https://bugs.webkit.org/show_bug.cgi?id=168213
1683
1684         Reviewed by Darin Adler.
1685
1686         We support the property as specced.
1687
1688         Test: fast/text/line-break-unprefixed.html
1689
1690         * css/CSSComputedStyleDeclaration.cpp:
1691         (WebCore::ComputedStyleExtractor::propertyValue):
1692         * css/CSSProperties.json:
1693         * css/parser/CSSParserFastPaths.cpp:
1694         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1695         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
1696         * editing/Editor.cpp:
1697         (WebCore::Editor::applyEditingStyleToElement):
1698         * html/HTMLElement.cpp:
1699         (WebCore::HTMLElement::collectStyleForPresentationAttribute):
1700
1701 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
1702
1703         Use RAII for ICU breaking iterators
1704         https://bugs.webkit.org/show_bug.cgi?id=168203
1705
1706         Reviewed by Simon Fraser.
1707
1708         No new tests because there is no behavior change.
1709
1710         * platform/graphics/ComplexTextController.cpp:
1711         (WebCore::ComplexTextController::offsetForPosition):
1712         * rendering/RenderText.cpp:
1713         (WebCore::RenderText::previousOffset):
1714         (WebCore::RenderText::nextOffset):
1715
1716 2017-02-27  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>
1717
1718         [WinCairo][MiniBrowser] Add ca-bundle to display secure pages
1719         https://bugs.webkit.org/show_bug.cgi?id=168486
1720
1721         Reviewed by Alex Christensen.
1722
1723         change the order of path location search to make it possible to 
1724         configure with environment variable because bundled ca-bundle is
1725         always available now.
1726
1727         * platform/network/curl/ResourceHandleManager.cpp:
1728         (WebCore::certificatePath):
1729
1730 2017-02-27  Antoine Quint  <graouts@apple.com>
1731
1732         [Modern Media Controls] Status text does not appear on iOS
1733         https://bugs.webkit.org/show_bug.cgi?id=168918
1734         <rdar://problem/30737644>
1735
1736         Reviewed by Dean Jackson.
1737
1738         We refactor the layout code out of MacOSInlineMediaControls and into a new
1739         InlineLayoutSupport class which IOSInlineMediaControls uses as well. Now
1740         both the macOS and iOS inline media controls run the same layout logic to
1741         control whether the status label or scrubber should be displayed, and which
1742         controls should be dropped due to space constraints.
1743
1744         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-status-label.html
1745
1746         * Modules/modern-media-controls/controls/inline-layout-support.js: Added.
1747         (InlineLayoutSupport):
1748         (InlineLayoutSupport.prototype.childrenAfterPerformingLayout):
1749         * Modules/modern-media-controls/controls/ios-inline-media-controls.js:
1750         (IOSInlineMediaControls.prototype.layout):
1751         (IOSInlineMediaControls):
1752         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
1753         (MacOSInlineMediaControls.prototype.layout):
1754         * Modules/modern-media-controls/js-files:
1755
1756 2017-02-27  Simon Fraser  <simon.fraser@apple.com>
1757
1758         Add specification and status metadata to CSSProperties.json, and validate it
1759         https://bugs.webkit.org/show_bug.cgi?id=168901
1760
1761         Reviewed by Darin Adler.
1762
1763         Annotate CSS properties with data about the WebKit development status, and
1764         where they are specified. A property has a canonical specification reference,
1765         but individual values may have a reference to a more recent spec.
1766
1767         Add a list of specifications to the JSON that properties reference by key.
1768
1769         Enhance check-webkit-style to validate the status and spec data.
1770
1771         * css/CSSProperties.json:
1772
1773 2017-02-27  Jiewen Tan  <jiewen_tan@apple.com>
1774
1775         [CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential
1776         https://bugs.webkit.org/show_bug.cgi?id=168616
1777         <rdar://problem/30167149>
1778
1779         Reviewed by Daniel Bates.
1780
1781         This patch adds IDL definitions for:
1782         1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential),
1783         2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and
1784         3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential).
1785
1786         Test: credentials/idlharness.html
1787
1788         * CMakeLists.txt:
1789         * DerivedSources.make:
1790         * Modules/credentials/BasicCredential.cpp: Added.
1791         (WebCore::BasicCredential::BasicCredential):
1792         (WebCore::BasicCredential::~BasicCredential):
1793         (WebCore::BasicCredential::type):
1794         * Modules/credentials/BasicCredential.h: Added.
1795         (WebCore::BasicCredential::id):
1796         * Modules/credentials/BasicCredential.idl: Added.
1797         * Modules/credentials/CredentialData.h: Added.
1798         * Modules/credentials/CredentialData.idl: Added.
1799         * Modules/credentials/PasswordCredential.cpp: Added.
1800         (WebCore::PasswordCredential::PasswordCredential):
1801         (WebCore::PasswordCredential::PasswordCredential):
1802         Dummy constructors for now.
1803         * Modules/credentials/PasswordCredential.h: Added.
1804         (WebCore::PasswordCredential::create):
1805         (WebCore::PasswordCredential::create):
1806         (WebCore::PasswordCredential::setIdName):
1807         (WebCore::PasswordCredential::idName):
1808         (WebCore::PasswordCredential::setPasswordName):
1809         (WebCore::PasswordCredential::passwordName):
1810         (WebCore::PasswordCredential::setAdditionalData):
1811         (WebCore::PasswordCredential::additionalData):
1812         * Modules/credentials/PasswordCredential.idl: Added.
1813         * Modules/credentials/SiteBoundCredential.cpp: Added.
1814         (WebCore::SiteBoundCredential::SiteBoundCredential):
1815         (WebCore::SiteBoundCredential::~SiteBoundCredential):
1816         * Modules/credentials/SiteBoundCredential.h: Added.
1817         (WebCore::SiteBoundCredential::name):
1818         (WebCore::SiteBoundCredential::iconURL):
1819         (WebCore::SiteBoundCredential::setOrigin):
1820         (WebCore::SiteBoundCredential::origin):
1821         * Modules/credentials/SiteBoundCredential.idl: Added.
1822         * Modules/credentials/SiteBoundCredentialData.h: Added.
1823         * Modules/credentials/SiteBoundCredentialData.idl: Added.
1824         * WebCore.xcodeproj/project.pbxproj:
1825
1826 2017-02-27  Jer Noble  <jer.noble@apple.com>
1827
1828         [WebRTC] Fix remote audio rendering
1829         https://bugs.webkit.org/show_bug.cgi?id=168898
1830
1831         Reviewed by Eric Carlson.
1832
1833         Test: webrtc/audio-peer-connection-webaudio.html
1834
1835         Fix MediaStreamAudioSourceNode by not bailing out early if the input sample rate doesn't match
1836         the AudioContext's sample rate; there's code in setFormat() to do the sample rate conversion
1837         correctly.
1838
1839         * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
1840         (WebCore::MediaStreamAudioSourceNode::setFormat):
1841
1842         Fix AudioSampleBufferList by making the AudioConverter input proc a free function, and passing
1843         its refCon a struct containing only the information it needs to perform its task. Because the
1844         conversion may result in a different number of output samples than input ones, just ask to
1845         generate the entire capacity of the scratch buffer, and signal that the input buffer was fully
1846         converted with a special return value.
1847
1848         * platform/audio/mac/AudioSampleBufferList.cpp:
1849         (WebCore::audioConverterFromABLCallback):
1850         (WebCore::AudioSampleBufferList::copyFrom):
1851         (WebCore::AudioSampleBufferList::convertInput): Deleted.
1852         (WebCore::AudioSampleBufferList::audioConverterCallback): Deleted.
1853         * platform/audio/mac/AudioSampleBufferList.h:
1854
1855         Fix AudioSampleDataSource by updating both the sampleCount and the sampleTime after doing
1856         a sample rate conversion to take into account that both the number of samples may have changed,
1857         as well as the timeScale of the sampleTime. This may result in small off-by-one rounding errors
1858         due to the sample rate conversion of sampleTime, so remember what the next expected sampleTime
1859         should be, and correct sampleTime if it is indeed off-by-one. If the pull operation has gotten
1860         ahead of the push operation, delay the next pull by the empty amount by rolling back the
1861         m_outputSampleOffset. Introduce the same offset behavior during pull operations.
1862
1863         * platform/audio/mac/AudioSampleDataSource.h:
1864         * platform/audio/mac/AudioSampleDataSource.mm:
1865         (WebCore::AudioSampleDataSource::pushSamplesInternal):
1866         (WebCore::AudioSampleDataSource::pullSamplesInternal):
1867         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
1868
1869         Fix MediaPlayerPrivateMediaStreamAVFObjC by obeying the m_muted property.
1870
1871         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1872         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume):
1873         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted):
1874
1875         Fix LibWebRTCAudioModule by sleeping for the correct amount after emitting frames. Previously,
1876         LibWebRTCAudioModule would sleep for a fixed amount of time, which meant it would get slowly out
1877         of sync when emitting frames took a non-zero amount of time. Now, the amount of time before the
1878         next cycle starts is correctly calculated, and then LibWebRTCAudioModule sleeps for a dynamic amount
1879         of time in order to wake up correctly at the beginning of the next cycle.
1880
1881         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
1882         (WebCore::LibWebRTCAudioModule::StartPlayoutOnAudioThread):
1883
1884         Fix AudioTrackPrivateMediaStreamCocoa by just using the output unit's preferred format
1885         description (with the current system sample rate), rather than whatever is the current
1886         input description.
1887
1888         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
1889         (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit):
1890         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
1891         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
1892
1893         Fix RealtimeIncomingAudioSource by actually creating an AudioSourceProvider when asked.
1894
1895         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
1896         (WebCore::RealtimeIncomingAudioSource::OnData):
1897         (WebCore::RealtimeIncomingAudioSource::audioSourceProvider):
1898         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
1899
1900         Fix RealtimeOutgoingAudioSource by using the outgoing format description rather than the
1901         incoming one to determine the sample rate, channel count, sample byte size, etc., to use
1902         when delivering data upstream to libWebRTC.
1903
1904         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1905         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
1906         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
1907         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1908
1909         Fix WebAudioSourceProviderAVFObjC by using a AudioSampleDataSource to do format and sample
1910         rate conversion rather than trying to duplicate all that code and use a CARingBuffer and 
1911         AudioConverter directly.
1912
1913         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
1914         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
1915         (WebCore::WebAudioSourceProviderAVFObjC::~WebAudioSourceProviderAVFObjC):
1916         (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
1917         (WebCore::WebAudioSourceProviderAVFObjC::prepare):
1918         (WebCore::WebAudioSourceProviderAVFObjC::unprepare):
1919         (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
1920
1921         Fix the MockLibWebRTCAudioTrack by passing along the AddSink() sink to its AudioSourceInterface,
1922         allowing the RealtimeOutgoingAudioSource to push data into the libWebRTC network stack. Also,
1923         make sure m_enabled is initialized to a good value.
1924
1925         * testing/MockLibWebRTCPeerConnection.h:
1926
1927 2017-02-21  Jer Noble  <jer.noble@apple.com>
1928
1929         AudioSampleDataSource should not exclusively lock its read and write threads.
1930         https://bugs.webkit.org/show_bug.cgi?id=168646
1931
1932         Reviewed by Eric Carlson.
1933
1934         Locking the write thread causes the read thread to drop audio samples and generates audible
1935         glitches, and the realtime audio thread backing the read thread should never block. There's
1936         no real reason to lock these threads against one another here; they both rely on the
1937         CARingBuffer to safely and simultaneously read and write data.
1938
1939         * platform/audio/mac/AudioSampleDataSource.cpp:
1940         (WebCore::AudioSampleDataSource::setPaused):
1941         (WebCore::AudioSampleDataSource::pushSamplesInternal):
1942         (WebCore::AudioSampleDataSource::pushSamples):
1943         (WebCore::AudioSampleDataSource::pullSamplesInternal):
1944         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
1945         (WebCore::AudioSampleDataSource::pullSamples):
1946         * platform/audio/mac/AudioSampleDataSource.h:
1947
1948 2017-02-21  Jer Noble  <jer.noble@apple.com>
1949
1950         AudioTrackPrivateMediaStreamCocoa should not exclusively lock its read and write threads.
1951         https://bugs.webkit.org/show_bug.cgi?id=168643
1952
1953         Reviewed by Eric Carlson.
1954
1955         Locking the write thread causes the read thread to drop audio samples and generates audible
1956         glitches, and the realtime audio thread backing the read thread should never block. There's
1957         no real reason to lock these threads against one another here; they both rely on the
1958         AudioSampleDataSource and it's CARingBuffer to safely and simultaneously read and write
1959         data.
1960
1961         The one piece which locks previously protected against unsafe access was during creation of
1962         the audio unit.  Without a lock, the audio unit could begin playback after the unit was
1963         created and assigned to m_remoteIOUnit but before the ring buffer was created. To protect
1964         against this possibility, create the unit, set the input and output descriptions, but only
1965         assign the new audio unit to m_remoteIOUnit after the ring buffer has been created and
1966         initialized.
1967
1968         * platform/audio/mac/CAAudioStreamDescription.h:
1969         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
1970         (WebCore::AudioTrackPrivateMediaStreamCocoa::~AudioTrackPrivateMediaStreamCocoa):
1971         (WebCore::AudioTrackPrivateMediaStreamCocoa::playInternal):
1972         (WebCore::AudioTrackPrivateMediaStreamCocoa::play):
1973         (WebCore::AudioTrackPrivateMediaStreamCocoa::pause):
1974         (WebCore::AudioTrackPrivateMediaStreamCocoa::setVolume):
1975         (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit):
1976         (WebCore::AudioTrackPrivateMediaStreamCocoa::setupAudioUnit): Renamed to createAudioUnit()
1977         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
1978         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
1979
1980 2017-02-27  Youenn Fablet  <youenn@apple.com>
1981
1982         [WebRTC] RealtimOutgoingVideoSource should not need to do image conversion
1983         https://bugs.webkit.org/show_bug.cgi?id=168802
1984
1985         Reviewed by Jon Lee.
1986
1987         Covered by manual testing as mock sources do not hit the same code path.
1988
1989         * platform/mediastream/mac/AVVideoCaptureSource.h:
1990         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1991         (WebCore::AVVideoCaptureSource::currentFrameCGImage):
1992         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1993         (WebCore::RealtimeOutgoingVideoSource::sendFrame):
1994         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
1995         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1996
1997 2017-02-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1998
1999         [GTK] Downloads attributes tests are failing
2000         https://bugs.webkit.org/show_bug.cgi?id=168871
2001
2002         Reviewed by Michael Catanzaro.
2003
2004         Use libsoup to get the suggested filename from the Content-Disposition header instead of buggy
2005         filenameFromHTTPContentDisposition().
2006
2007         Fixes: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html
2008                fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html
2009
2010         * platform/network/soup/ResourceResponseSoup.cpp:
2011         (WebCore::ResourceResponse::platformSuggestedFilename):
2012
2013 2017-02-27  Antoine Quint  <graouts@apple.com>
2014
2015         [Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls
2016         https://bugs.webkit.org/show_bug.cgi?id=168820
2017         <rdar://problem/30690281>
2018
2019         Reviewed by Jon Lee.
2020
2021         We broke this in https://bugs.webkit.org/show_bug.cgi?id=168755. We restore the check that the
2022         event target when initiating a drag is the controls bar itself and not some of its content.
2023
2024         Since this wasn't caught by our existing tests, we add a test that attemps to initiate a drag
2025         starting over one of the controls and notice that no dragging occurs.
2026
2027         We also fix an issue where we wouldn't update the layout of the left container as its icon
2028         buttons would load, which would cause the layout width of the left container to be incorrect
2029         and the related tests to time out.
2030
2031         Test: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html
2032
2033         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
2034         (MacOSFullscreenMediaControls.prototype.layout):
2035         (MacOSFullscreenMediaControls.prototype._handleMousedown):
2036
2037 2017-02-27  Alex Christensen  <achristensen@webkit.org>
2038
2039         [libwebrtc] Enable WebRTC in some Production Builds
2040         https://bugs.webkit.org/show_bug.cgi?id=168858
2041
2042         * Configurations/FeatureDefines.xcconfig:
2043
2044 2017-02-27  Zan Dobersek  <zdobersek@igalia.com>
2045
2046         [TextureMapper] Clean up BitmapTextureGL construction
2047         https://bugs.webkit.org/show_bug.cgi?id=168909
2048
2049         Reviewed by Carlos Garcia Campos.
2050
2051         Have the BitmapTextureGL constructor accept an rvalue reference pointer
2052         to the GraphicsContext3D object. A static create() method is also added
2053         to help with constructing these objects. Construction sites are updated
2054         appropriately.
2055
2056         The BitmapTextureGL constructor is further cleaned up by moving default
2057         member initializations together with the member declarations.
2058
2059         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2060         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
2061         * platform/graphics/texmap/BitmapTextureGL.cpp:
2062         (WebCore::BitmapTextureGL::BitmapTextureGL):
2063         * platform/graphics/texmap/BitmapTextureGL.h:
2064         * platform/graphics/texmap/BitmapTexturePool.cpp:
2065         (WebCore::BitmapTexturePool::createTexture):
2066         * platform/graphics/texmap/TextureMapperGL.cpp:
2067         (WebCore::TextureMapperGL::createTexture):
2068
2069 2017-02-27  Zan Dobersek  <zdobersek@igalia.com>
2070
2071         [TextureMapper] Remove InterpolationQuality, TextDrawingModeFlags member variables
2072         https://bugs.webkit.org/show_bug.cgi?id=168906
2073
2074         Reviewed by Carlos Garcia Campos.
2075
2076         Remove the InterpolationQuality and TextDrawingModeFlags member variables from the
2077         TextureMapper class. These weren't modified anywhere in the code.
2078
2079         BitmapTexture::updateContents() still sets the image interpolation quality and
2080         drawing mode on the ImageBuffer's GraphicsContext, but now uses the default
2081         InterpolationDefault and TextModeFill values.
2082
2083         * platform/graphics/texmap/BitmapTexture.cpp:
2084         (WebCore::BitmapTexture::updateContents):
2085         * platform/graphics/texmap/TextureMapper.cpp:
2086         (WebCore::TextureMapper::TextureMapper): Deleted.
2087         (WebCore::TextureMapper::~TextureMapper): Deleted.
2088         * platform/graphics/texmap/TextureMapper.h:
2089         (WebCore::TextureMapper::setImageInterpolationQuality): Deleted.
2090         (WebCore::TextureMapper::setTextDrawingMode): Deleted.
2091         (WebCore::TextureMapper::imageInterpolationQuality): Deleted.
2092         (WebCore::TextureMapper::textDrawingMode): Deleted.
2093
2094 2017-02-26  Zan Dobersek  <zdobersek@igalia.com>
2095
2096         [CoordinatedGraphics] Remove CoordinatedGraphicsScene::paintToGraphicsContext()
2097         https://bugs.webkit.org/show_bug.cgi?id=168903
2098
2099         Reviewed by Carlos Garcia Campos.
2100
2101         Remove the GraphicsContext pointer member from the TextureMapper class
2102         since the getter and setter methods are not used anywhere.
2103
2104         * platform/graphics/texmap/TextureMapper.cpp:
2105         (WebCore::TextureMapper::TextureMapper):
2106         * platform/graphics/texmap/TextureMapper.h:
2107         (WebCore::TextureMapper::setGraphicsContext): Deleted.
2108         (WebCore::TextureMapper::graphicsContext): Deleted.
2109
2110 2017-02-26  Myles C. Maxfield  <mmaxfield@apple.com>
2111
2112         Stop compiling our own cursorMovementIterator()
2113         https://bugs.webkit.org/show_bug.cgi?id=168211
2114
2115         Reviewed by David Hyatt.
2116
2117         Covered by existing tests.
2118
2119         Hook up the caret iterator.
2120
2121         * platform/graphics/ComplexTextController.cpp:
2122         (WebCore::ComplexTextController::offsetForPosition):
2123         * rendering/RenderText.cpp:
2124         (WebCore::RenderText::previousOffset):
2125         (WebCore::RenderText::nextOffset):
2126         * rendering/RenderText.h:
2127
2128 2017-02-26  Commit Queue  <commit-queue@webkit.org>
2129
2130         Unreviewed, rolling out r212942.
2131         https://bugs.webkit.org/show_bug.cgi?id=168882
2132
2133         Made EWS very flaky (Requested by ap on #webkit).
2134
2135         Reverted changeset:
2136
2137         "[Modern Media Controls] Dragging controls in fullscreen on
2138         macOS prevents scrubbing or interacting with controls"
2139         https://bugs.webkit.org/show_bug.cgi?id=168820
2140         http://trac.webkit.org/changeset/212942
2141
2142 2017-02-26  Chris Dumez  <cdumez@apple.com>
2143
2144         HitTestResult's linkSuggestedFilename should sanitize download attribute
2145         https://bugs.webkit.org/show_bug.cgi?id=168856
2146         <rdar://problem/30683109>
2147
2148         Reviewed by Antti Koivisto.
2149
2150         HitTestResult's linkSuggestedFilename should sanitize download attribute.
2151         This is used by the context menu's "Download Linked File" & "Download Linked
2152         File As..." actions.
2153
2154         * rendering/HitTestResult.cpp:
2155         (WebCore::HitTestResult::linkSuggestedFilename):
2156         * rendering/HitTestResult.h:
2157
2158 2017-02-25  Zalan Bujtas  <zalan@apple.com>
2159
2160         Simple line layout: Move coverage functions out of SimpleLineLayout.cpp
2161         https://bugs.webkit.org/show_bug.cgi?id=168872
2162         
2163         Reviewed by Simon Fraser.
2164
2165         SimpleLineLayout.cpp is for core functions only.
2166
2167         No change in functionality.
2168
2169         * CMakeLists.txt:
2170         * WebCore.xcodeproj/project.pbxproj:
2171         * rendering/RenderingAllInOne.cpp:
2172         * rendering/SimpleLineLayout.cpp:
2173         (WebCore::SimpleLineLayout::canUseForWithReason):
2174         (WebCore::SimpleLineLayout::printReason): Deleted.
2175         (WebCore::SimpleLineLayout::printReasons): Deleted.
2176         (WebCore::SimpleLineLayout::printTextForSubtree): Deleted.
2177         (WebCore::SimpleLineLayout::textLengthForSubtree): Deleted.
2178         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlows): Deleted.
2179         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlowsForCurrentPage): Deleted.
2180         (WebCore::SimpleLineLayout::toggleSimpleLineLayout): Deleted.
2181         (WebCore::SimpleLineLayout::printSimpleLineLayoutBlockList): Deleted.
2182         (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage): Deleted.
2183         * rendering/SimpleLineLayout.h:
2184         * rendering/SimpleLineLayoutCoverage.cpp: Added.
2185         (WebCore::SimpleLineLayout::printReason):
2186         (WebCore::SimpleLineLayout::printReasons):
2187         (WebCore::SimpleLineLayout::printTextForSubtree):
2188         (WebCore::SimpleLineLayout::textLengthForSubtree):
2189         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlows):
2190         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlowsForCurrentPage):
2191         (WebCore::SimpleLineLayout::toggleSimpleLineLayout):
2192         (WebCore::SimpleLineLayout::printSimpleLineLayoutBlockList):
2193         (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage):
2194         * rendering/SimpleLineLayoutCoverage.h: Added.
2195
2196 2017-02-25  Zalan Bujtas  <zalan@apple.com>
2197
2198         Text might wrap when its preferred logical width is used for sizing the containing block.
2199         https://bugs.webkit.org/show_bug.cgi?id=168864
2200         <rdar://problem/30690734>
2201
2202         Reviewed by Antti Koivisto.
2203
2204         In certain cases we end up measuring a text run in 2 different ways.
2205         1. preferred width computation -> slow path FontCascade::width() 
2206         2. line breaking logic -> fast path FontCascade::widthForSimpleText()
2207  
2208         FontCascade::width() and ::widthForSimpleText() might return different results for the same run even when
2209         the individual glyph widths are measured to be the same. It's because they run diffrent set of
2210         arithmetics on the float values and for certain values these arithmetics produce different results due to the floating point
2211         precision.
2212         Since RenderText::computePreferredLogicalWidths() currently forces us to use the slow path
2213         (to retrieve fontfallback and glyph overflow information) the only alternative solution is to turn off the fast path
2214         for all runs that have been already measured using the slow path (which would be just wasteful).
2215
2216         Test: fast/text/fast-run-width-vs-slow-run-width.html
2217
2218         * platform/graphics/FontCascade.cpp:
2219         (WebCore::FontCascade::widthForSimpleText): Mimics WidthIterator::applyFontTransforms. Use the same set of arithmetics here.  
2220
2221 2017-02-24  Simon Fraser  <simon.fraser@apple.com>
2222
2223         Improve how multiple codegen-properties are handled in CSSProperties.json
2224         https://bugs.webkit.org/show_bug.cgi?id=168867
2225
2226         Reviewed by Zalan Bujtas.
2227
2228         To make upcoming metadata storage easier, it's better if property entries in CSSProperties.json
2229         are always hashes. One property (line-height) used an array, in order to represent settings for
2230         two different build flags (ENABLE_TEXT_AUTOSIZING and !ENABLE_TEXT_AUTOSIZING).
2231
2232         Fix by making "codegen-properties" optionally be an array. The relevant item is selected in
2233         removeInactiveCodegenProperties() and used to replace the array.
2234
2235         Sort @internalProprerties when generating code, otherwise the contents of isInternalCSSProperty()
2236         are unstable (the order in @allNames is not stable because it's the keys in a hash).
2237
2238         * css/CSSProperties.json:
2239         * css/makeprop.pl:
2240         (matchEnableFlags):
2241         (removeInactiveCodegenProperties):
2242         (isPropertyEnabled):
2243
2244 2017-02-24  Joseph Pecoraro  <pecoraro@apple.com>
2245
2246         [Resource Timing] Media elements initiated loads should set the initiatorType to their element name (video/audio)
2247         https://bugs.webkit.org/show_bug.cgi?id=168680
2248
2249         Reviewed by Youenn Fablet.
2250
2251         * html/HTMLMediaElement.cpp:
2252         (WebCore::HTMLMediaElement::mediaPlayerCreateResourceLoader):
2253         Pass in the element so it may be used as the initiator.
2254
2255         * html/HTMLVideoElement.h:
2256         Export create() for TestWebKitAPI to use.
2257
2258         * loader/MediaResourceLoader.cpp:
2259         (WebCore::MediaResourceLoader::MediaResourceLoader):
2260         (WebCore::MediaResourceLoader::contextDestroyed):
2261         (WebCore::MediaResourceLoader::requestResource):
2262         * loader/MediaResourceLoader.h:
2263         Include the HTMLMediaElement as the initiator.
2264
2265 2017-02-24  Joseph Pecoraro  <pecoraro@apple.com>
2266
2267         [Resource Timing] Gather timing information with reliable responseEnd time
2268         https://bugs.webkit.org/show_bug.cgi?id=168351
2269
2270         Reviewed by Alex Christensen.
2271
2272         This patch replaces the unused `double finishTime` in ResourceLoader's
2273         didFinishLoad with a complete WebCore::NetworkLoadMetrics object. This
2274         allows the NetworkProcess to give complete timing information, and more
2275         final metrics about the load, to WebCore. Currently this is only used
2276         by ResourceTiming, but it will soon be used by Web Inspector as well.
2277         We may also end up extending this to the didFail path as well, since it
2278         is possible that we have some metrics for load failures.
2279
2280         At the same time we want to start moving away from the legacy path that
2281         populated a subset of this information in ResourceResponse's NetworkLoadMetrics.
2282         It doesn't make sense to store this information on the ResourceResponse
2283         for a few reasons: We don't want to store the metrics in our Network Cache and
2284         not all of the load timing metrics have been populated yet (responseEnd).
2285         In an effort to move off of this data we've renamed the accessor to
2286         "deprecatedNetworkLoadMetrics". There are a few remaining clients
2287         (ResourceHandle, PerformanceTiming, InspectorNetworkAgent) which can be
2288         migrated separately from this patch.
2289
2290         Having both the legacy and new code paths adds a little bit of complexity.
2291         One advantage of the new path is that the complete load timing data
2292         (fetchStart -> dns -> connect -> request -> response -> responseEnd) can
2293         be packaged together. The legacy path could not include a responseEnd, so
2294         WebCore faked that value with its own timestamp. Having the fake responseEnd
2295         caused issues as timestamps / clocks are different between processes. In order
2296         for PerformanceResponseTiming to know whether or not the NetworkLoadMetrics
2297         has the complete network timing metrics it checks isComplete(). If true
2298         it knows it can use the responseEnd time from NetworkLoadMetrics, otherwise
2299         it must fallback to the legacy value from LoadTiming. Once all of the
2300         deprecatedNetworkLoadMetrics clients go away, we should always have the
2301         complete data and this can be eliminated.
2302
2303         Tests: imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.html
2304                imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.html
2305
2306         * PlatformMac.cmake:
2307         * WebCore.xcodeproj/project.pbxproj:
2308         Rename NetworkLoadTiming -> NetworkLoadMetrics.
2309
2310         * page/PerformanceResourceTiming.cpp:
2311         (WebCore::entryStartTime):
2312         (WebCore::entryEndTime):
2313         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
2314         (WebCore::PerformanceResourceTiming::nextHopProtocol):
2315         (WebCore::PerformanceResourceTiming::domainLookupStart):
2316         (WebCore::PerformanceResourceTiming::domainLookupEnd):
2317         (WebCore::PerformanceResourceTiming::connectStart):
2318         (WebCore::PerformanceResourceTiming::connectEnd):
2319         (WebCore::PerformanceResourceTiming::secureConnectionStart):
2320         (WebCore::PerformanceResourceTiming::requestStart):
2321         (WebCore::PerformanceResourceTiming::responseStart):
2322         (WebCore::PerformanceResourceTiming::responseEnd):
2323         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
2324         * page/PerformanceResourceTiming.h:
2325         Mostly just updating names and types. This does however need to get the
2326         correct endTime based on whether the NetworkLoadMetrics are complete
2327         (meaning includes responseEnd) or not (legacy, use LoadTiming value).
2328
2329         * page/PerformanceResourceTiming.idl:
2330         Add nextHopProtocol.
2331
2332         * page/PerformanceTiming.cpp:
2333         (WebCore::PerformanceTiming::domainLookupStart):
2334         (WebCore::PerformanceTiming::domainLookupEnd):
2335         (WebCore::PerformanceTiming::connectStart):
2336         (WebCore::PerformanceTiming::connectEnd):
2337         (WebCore::PerformanceTiming::secureConnectionStart):
2338         (WebCore::PerformanceTiming::requestStart):
2339         (WebCore::PerformanceTiming::responseStart):
2340         (WebCore::PerformanceTiming::resourceLoadTimeRelativeToFetchStart):
2341         * page/PerformanceTiming.h:
2342         Navigation Timing values still uses the NetworkLoadTiming values stored on
2343         the DocumentLoader. This should be moved off of the deprecated path separately.
2344
2345         * platform/network/NetworkLoadMetrics.h: Renamed from Source/WebCore/platform/network/NetworkLoadTiming.h.
2346         (WebCore::NetworkLoadMetrics::NetworkLoadMetrics):
2347         (WebCore::NetworkLoadMetrics::isolatedCopy):
2348         (WebCore::NetworkLoadMetrics::reset):
2349         (WebCore::NetworkLoadMetrics::operator==):
2350         (WebCore::NetworkLoadMetrics::operator!=):
2351         (WebCore::NetworkLoadMetrics::isComplete):
2352         (WebCore::NetworkLoadMetrics::markComplete):
2353         (WebCore::NetworkLoadMetrics::encode):
2354         (WebCore::NetworkLoadMetrics::decode):
2355         Re-introduce a reset() method (for NetworkLoadSoup to reset between redirects).
2356         Add protocolName and "complete" boolean.
2357
2358         * platform/network/cocoa/NetworkLoadMetrics.mm: Renamed from Source/WebCore/platform/network/cocoa/NetworkLoadTiming.mm.
2359         (WebCore::timingValue):
2360         (WebCore::copyTimingData):
2361         (WebCore::setCollectsTimingData):
2362         Use this opportunity to convert NetworkLoadTiming timestamps to WTF::Seconds.
2363         Since we already have to modify all the clients this moves us to use the more
2364         strongly typed units that are less ambiguous then "double". The rest of the
2365         Performance API has already moved to these units.
2366
2367         * inspector/InspectorNetworkAgent.cpp:
2368         (WebCore::InspectorNetworkAgent::buildObjectForTiming):
2369         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
2370         (WebCore::InspectorNetworkAgent::didFinishLoading):
2371         * inspector/InspectorNetworkAgent.h:
2372         Inspector was the only client of the finishTime, and since the value was
2373         erratically coming from clients in different ways it was almost certainly
2374         inaccurate. Simplify this in preparation for using NetworkLoadMetrics.
2375
2376         * Modules/fetch/FetchLoader.cpp:
2377         (WebCore::FetchLoader::didFinishLoading):
2378         * Modules/fetch/FetchLoader.h:
2379         * fileapi/FileReaderLoader.cpp:
2380         (WebCore::FileReaderLoader::didFinishLoading):
2381         * fileapi/FileReaderLoader.h:
2382         * html/MediaFragmentURIParser.cpp:
2383         (WebCore::MediaFragmentURIParser::parseNPTTime):
2384         * inspector/InspectorInstrumentation.cpp:
2385         (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
2386         * inspector/InspectorInstrumentation.h:
2387         (WebCore::InspectorInstrumentation::didFinishLoading):
2388         * loader/CrossOriginPreflightChecker.cpp:
2389         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
2390         * loader/DocumentLoader.cpp:
2391         (WebCore::DocumentLoader::notifyFinished):
2392         (WebCore::DocumentLoader::finishedLoading):
2393         (WebCore::DocumentLoader::continueAfterContentPolicy):
2394         (WebCore::DocumentLoader::maybeLoadEmpty):
2395         * loader/DocumentLoader.h:
2396         * loader/DocumentThreadableLoader.cpp:
2397         (WebCore::DocumentThreadableLoader::didReceiveResponse):
2398         (WebCore::DocumentThreadableLoader::notifyFinished):
2399         (WebCore::DocumentThreadableLoader::didFinishLoading):
2400         (WebCore::DocumentThreadableLoader::loadRequest):
2401         * loader/DocumentThreadableLoader.h:
2402         * loader/NetscapePlugInStreamLoader.cpp:
2403         (WebCore::NetscapePlugInStreamLoader::didFinishLoading):
2404         * loader/NetscapePlugInStreamLoader.h:
2405         * loader/ResourceLoadNotifier.cpp:
2406         (WebCore::ResourceLoadNotifier::didFinishLoad):
2407         (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
2408         (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
2409         * loader/ResourceLoadNotifier.h:
2410         * loader/ResourceLoader.cpp:
2411         (WebCore::ResourceLoader::deliverResponseAndData):
2412         (WebCore::ResourceLoader::loadDataURL):
2413         (WebCore::ResourceLoader::didFinishLoading):
2414         (WebCore::ResourceLoader::didFinishLoadingOnePart):
2415         * loader/ResourceLoader.h:
2416         * loader/ResourceTiming.cpp:
2417         (WebCore::ResourceTiming::fromLoad):
2418         (WebCore::ResourceTiming::fromSynchronousLoad):
2419         (WebCore::ResourceTiming::ResourceTiming):
2420         (WebCore::ResourceTiming::isolatedCopy):
2421         * loader/ResourceTiming.h:
2422         (WebCore::ResourceTiming::networkLoadMetrics):
2423         (WebCore::ResourceTiming::ResourceTiming):
2424         (WebCore::ResourceTiming::networkLoadTiming): Deleted.
2425         * loader/SubresourceLoader.cpp:
2426         (WebCore::SubresourceLoader::SubresourceLoader):
2427         (WebCore::SubresourceLoader::willSendRequestInternal):
2428         (WebCore::SubresourceLoader::didReceiveResponse):
2429         (WebCore::SubresourceLoader::didFinishLoading):
2430         (WebCore::SubresourceLoader::reportResourceTiming):
2431         * loader/SubresourceLoader.h:
2432         * loader/ThreadableLoaderClient.h:
2433         (WebCore::ThreadableLoaderClient::didFinishLoading):
2434         * loader/ThreadableLoaderClientWrapper.h:
2435         (WebCore::ThreadableLoaderClientWrapper::didFinishLoading):
2436         * loader/WorkerThreadableLoader.cpp:
2437         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
2438         * loader/WorkerThreadableLoader.h:
2439         * loader/appcache/ApplicationCacheGroup.cpp:
2440         (WebCore::ApplicationCacheGroup::didFinishLoading):
2441         * loader/appcache/ApplicationCacheGroup.h:
2442         * loader/cache/CachedResource.h:
2443         (WebCore::CachedResource::setLoadFinishTime):
2444         * loader/ios/QuickLook.mm:
2445         (-[WebPreviewLoader connectionDidFinishLoading:]):
2446         * page/EventSource.cpp:
2447         (WebCore::EventSource::didFinishLoading):
2448         * page/EventSource.h:
2449         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2450         (ResourceHandleStreamingClient::didFinishLoading):
2451         * platform/network/BlobResourceHandle.cpp:
2452         (WebCore::doNotifyFinish):
2453         * platform/network/PingHandle.h:
2454         * platform/network/ResourceHandle.h:
2455         * platform/network/ResourceHandleClient.h:
2456         (WebCore::ResourceHandleClient::didFinishLoading):
2457         * platform/network/ResourceResponseBase.cpp:
2458         (WebCore::ResourceResponseBase::crossThreadData):
2459         (WebCore::ResourceResponseBase::fromCrossThreadData):
2460         (WebCore::ResourceResponseBase::compare):
2461         * platform/network/ResourceResponseBase.h:
2462         (WebCore::ResourceResponseBase::deprecatedNetworkLoadMetrics):
2463         (WebCore::ResourceResponseBase::encode):
2464         (WebCore::ResourceResponseBase::decode):
2465         (WebCore::ResourceResponseBase::networkLoadTiming): Deleted.
2466         * platform/network/SynchronousLoaderClient.cpp:
2467         (WebCore::SynchronousLoaderClient::didFinishLoading):
2468         * platform/network/SynchronousLoaderClient.h:
2469         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
2470         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
2471         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
2472         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
2473         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
2474         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading):
2475         * platform/network/curl/ResourceHandleCurl.cpp:
2476         (WebCore::WebCoreSynchronousLoader::didFinishLoading):
2477         * platform/network/curl/ResourceHandleManager.cpp:
2478         (WebCore::calculateWebTimingInformations):
2479         (WebCore::ResourceHandleManager::downloadTimerCallback):
2480         (WebCore::handleDataURL):
2481         (WebCore::milisecondsSinceRequest): Deleted.
2482         * platform/network/mac/ResourceHandleMac.mm:
2483         (WebCore::ResourceHandle::getConnectionTimingData):
2484         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
2485         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
2486         (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]):
2487         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2488         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
2489         (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
2490         * platform/network/soup/ResourceHandleSoup.cpp:
2491         (WebCore::restartedCallback):
2492         (WebCore::nextMultipartResponsePartCallback):
2493         (WebCore::sendRequestCallback):
2494         (WebCore::ResourceHandle::didStartRequest):
2495         (WebCore::networkEventCallback):
2496         (WebCore::ResourceHandle::sendPendingRequest):
2497         (WebCore::readCallback):
2498         (WebCore::milisecondsSinceRequest): Deleted.
2499         * workers/WorkerScriptLoader.cpp:
2500         (WebCore::WorkerScriptLoader::didFinishLoading):
2501         * workers/WorkerScriptLoader.h:
2502         * xml/XMLHttpRequest.cpp:
2503         (WebCore::XMLHttpRequest::didFinishLoading):
2504         * xml/XMLHttpRequest.h:
2505         Eliminate the unused finishTime double.
2506
2507 2017-02-24  Chris Dumez  <cdumez@apple.com>
2508
2509         Unreviewed GTK build fix after r212965
2510
2511         * CMakeLists.txt:
2512
2513 2017-02-24  Chris Dumez  <cdumez@apple.com>
2514
2515         Unreviewed, rolling out r212944.
2516
2517         Caused a lot of failures on the debug bots
2518
2519         Reverted changeset:
2520
2521         "[Resource Timing] Gather timing information with reliable
2522         responseEnd time"
2523         https://bugs.webkit.org/show_bug.cgi?id=168351
2524         http://trac.webkit.org/changeset/212944
2525
2526 2017-02-24  Chris Dumez  <cdumez@apple.com>
2527
2528         Unreviewed, follow-up fix after r212972.
2529
2530         Fixes a few assertions on the debug build bots.
2531         URL needs to be exactly the same as the parsed one given
2532         that we are calling the ParsedURLString constructor.
2533
2534         * platform/network/ResourceResponseBase.cpp:
2535         (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
2536
2537 2017-02-24  Zalan Bujtas  <zalan@apple.com>
2538
2539         Simple line layout: Re-adjust paginated lines when block height changes.
2540         https://bugs.webkit.org/show_bug.cgi?id=168838
2541         <rdar://problem/30701233>
2542
2543         Reviewed by Antti Koivisto.
2544
2545         When the estimated block height is wrong, we issue an additional layout on the inline children
2546         so that we get the pagination right (this layout is setChildNeedsLayout(MarkOnlyThis) only).
2547         Since the height change only affects the struts and page breaks (and again, the relayoutChildren flag is false)
2548         we don't need to re-layout the content, but instead we just need to re-adjust the pagination for the simple lines. 
2549         This patch also moves the pagination logic to SimpleLineLayoutPagination.cpp.
2550
2551         Not enabled yet.
2552
2553         * CMakeLists.txt:
2554         * WebCore.xcodeproj/project.pbxproj:
2555         * rendering/RenderBlockFlow.cpp:
2556         (WebCore::RenderBlockFlow::layoutSimpleLines):
2557         * rendering/RenderingAllInOne.cpp:
2558         * rendering/SimpleLineLayout.cpp:
2559         (WebCore::SimpleLineLayout::canUseForWithReason):
2560         (WebCore::SimpleLineLayout::create):
2561         (WebCore::SimpleLineLayout::Layout::create):
2562         (WebCore::SimpleLineLayout::Layout::Layout):
2563         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow): Deleted.
2564         (WebCore::SimpleLineLayout::computeLineBreakIndex): Deleted.
2565         (WebCore::SimpleLineLayout::computeOffsetAfterLineBreak): Deleted.
2566         (WebCore::SimpleLineLayout::setPageBreakForLine): Deleted.
2567         (WebCore::SimpleLineLayout::updateMinimumPageHeight): Deleted.
2568         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination): Deleted.
2569         * rendering/SimpleLineLayout.h:
2570         (WebCore::SimpleLineLayout::Layout::setIsPaginated):
2571         (WebCore::SimpleLineLayout::Layout::setLineStruts):
2572         * rendering/SimpleLineLayoutPagination.cpp: Added.
2573         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow):
2574         (WebCore::SimpleLineLayout::computeLineBreakIndex):
2575         (WebCore::SimpleLineLayout::computeOffsetAfterLineBreak):
2576         (WebCore::SimpleLineLayout::setPageBreakForLine):
2577         (WebCore::SimpleLineLayout::updateMinimumPageHeight):
2578         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
2579         * rendering/SimpleLineLayoutPagination.h: Added.
2580
2581 2017-02-24  Jon Lee  <jonlee@apple.com>
2582
2583         Alias "system-ui" for the System font name
2584         https://bugs.webkit.org/show_bug.cgi?id=151493
2585
2586         Reviewed by Tim Horton and Joseph Pecoraro.
2587
2588         Updated existing tests.
2589
2590         * WebCore.xcodeproj/project.pbxproj: Add WebKitFontFamilyNames.in for
2591         convenience.
2592         * css/CSSValueKeywords.in: Add system-ui as a keyword.
2593         * css/WebKitFontFamilyNames.in: Add system-ui.
2594
2595         * platform/graphics/ios/FontCacheIOS.mm:
2596         (WebCore::platformFontWithFamilySpecialCase): Include "system-ui" as an
2597         alias.
2598         * platform/graphics/mac/FontCacheMac.mm:
2599         (WebCore::platformFontWithFamilySpecialCase): Ditto.
2600
2601         * rendering/RenderThemeMac.mm:
2602         (WebCore::RenderThemeMac::updateCachedSystemFontDescription): Update
2603         serialization to "system-ui" from "-apple-system".
2604
2605         * css/CSSComputedStyleDeclaration.cpp:
2606         (WebCore::identifierForFamily):
2607         * css/CSSFontFaceSet.cpp:
2608         (WebCore::CSSFontFaceSet::familyNameFromPrimitive):
2609         * css/StyleBuilderCustom.h:
2610         (WebCore::StyleBuilderCustom::applyValueFontFamily):
2611
2612 2017-02-24  Matt Rajca  <mrajca@apple.com>
2613
2614         Media: notify clients when autoplay is denied
2615         https://bugs.webkit.org/show_bug.cgi?id=168840
2616
2617         Reviewed by Alex Christensen.
2618
2619         Added API tests.
2620
2621         * WebCore.xcodeproj/project.pbxproj:
2622         * html/HTMLMediaElement.cpp:
2623         (WebCore::HTMLMediaElement::setReadyState):
2624         (WebCore::HTMLMediaElement::play):
2625         (WebCore::HTMLMediaElement::playInternal):
2626         * page/AutoplayEvent.h: Added.
2627         * page/ChromeClient.h:
2628
2629 2017-02-24  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>
2630
2631         curl: Improve errors by including the domain
2632         https://bugs.webkit.org/show_bug.cgi?id=134340
2633
2634         Reviewed by Alex Christensen.
2635
2636         Added proper error domain to ResourceError created by
2637         Curl problem.
2638
2639         * platform/network/curl/ResourceHandleManager.cpp:
2640         (WebCore::ResourceHandleManager::downloadTimerCallback):
2641         (WebCore::ResourceHandleManager::dispatchSynchronousJob):
2642
2643 2017-02-24  Antoine Quint  <graouts@apple.com>
2644
2645         [Modern Media Controls] <audio> controls should center in their container when the page is scaled
2646         https://bugs.webkit.org/show_bug.cgi?id=168841
2647         <rdar://problem/28612794>
2648
2649         Reviewed by Eric Carlson.
2650
2651         When dealing with <audio> elements, we vertically center the controls relative to their containing
2652         media element such that if the controls visually overflow, they overflow equally above and below
2653         to minimize the likelihood of overlap with surrounding elements.
2654
2655         Test: media/modern-media-controls/media-controller/media-controller-scale-factor-audio.html
2656
2657         * Modules/modern-media-controls/controls/media-controls.js:
2658         (MediaControls.prototype.get shouldCenterControlsVertically):
2659         (MediaControls.prototype.set shouldCenterControlsVertically):
2660         (MediaControls.prototype.commitProperty):
2661         * Modules/modern-media-controls/media/media-controller.js:
2662         (MediaController.prototype.get isAudio):
2663         (MediaController.prototype.get layoutTraits):
2664         (MediaController.prototype._updateControlsSize):
2665
2666 2017-02-24  Alex Christensen  <achristensen@webkit.org>
2667
2668         Non-special relative URLs should not ignore extra slashes
2669         https://bugs.webkit.org/show_bug.cgi?id=168834
2670
2671         Reviewed by Sam Weinig.
2672
2673         Special authority ignore slashes state should, as its name implies,
2674         only be reached by special URLs.  See https://url.spec.whatwg.org/#relative-slash-state
2675
2676         Covered by newly passing web platform tests.
2677
2678         * platform/URLParser.cpp:
2679         (WebCore::URLParser::parse):
2680
2681 2017-02-24  Alexey Proskuryakov  <ap@apple.com>
2682
2683         Build fix for newer clang
2684         https://bugs.webkit.org/show_bug.cgi?id=168849
2685         rdar://problem/30638741
2686
2687         Reviewed by Ryosuke Niwa.
2688
2689         * dom/Range.cpp: (WebCore::Range::toString): std::max(0, <unsigned>) is not meaningful,
2690         and now triggers a warning.
2691
2692 2017-02-24  Chris Dumez  <cdumez@apple.com>
2693
2694         Download attribute should be sanitized before being used as suggested filename
2695         https://bugs.webkit.org/show_bug.cgi?id=168839
2696         <rdar://problem/30683109>
2697
2698         Reviewed by Darin Adler.
2699
2700         Sanitize Download attribute before using it as a suggested filename for the download.
2701         We rely on ResourceResponse's sanitizing of the suggested filename to do so, which has
2702         the benefit of being consistent with downloads without the download attribute.
2703
2704         Tests: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html
2705                fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html
2706                fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html
2707
2708         * html/HTMLAnchorElement.cpp:
2709         (WebCore::HTMLAnchorElement::handleClick):
2710         * platform/network/ResourceResponseBase.cpp:
2711         (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
2712         * platform/network/ResourceResponseBase.h:
2713
2714 2017-02-24  Miguel Gomez  <magomez@igalia.com>
2715
2716         [GTK] WebkitWebProcess crashes on exit on nvidia if threaded compositing is enabled
2717         https://bugs.webkit.org/show_bug.cgi?id=165522
2718
2719         Reviewed by Carlos Garcia Campos.
2720
2721         Before destrying a GLContextGLX we need to set the default framebufer to avoid a bug
2722         in some nvidia drivers. Ensure that we set the context as current before performing
2723         that operation, and set the appropriate current context after doing so.
2724
2725         No new tests.
2726
2727         * platform/graphics/glx/GLContextGLX.cpp:
2728         (WebCore::GLContextGLX::~GLContextGLX):
2729
2730 2017-02-24  Chris Dumez  <cdumez@apple.com>
2731
2732         [iOS][WK2] Disable network cache speculative revalidation / loading in low power mode
2733         https://bugs.webkit.org/show_bug.cgi?id=168832
2734         <rdar://problem/30697911>
2735
2736         Reviewed by Antti Koivisto.
2737
2738         Add LowPowerModeNotifier class to monitor low power mode state on iOS.
2739
2740         * WebCore.xcodeproj/project.pbxproj:
2741         * platform/LowPowerModeNotifier.cpp: Added.
2742         (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
2743         (WebCore::LowPowerModeNotifier::isLowPowerModeEnabled):
2744         * platform/LowPowerModeNotifier.h: Added.
2745         * platform/ios/LowPowerModeNotifierIOS.mm: Added.
2746         (-[WebLowPowerModeObserver initWithNotifier:]):
2747         (-[WebLowPowerModeObserver dealloc]):
2748         (-[WebLowPowerModeObserver _didReceiveLowPowerModeChange]):
2749         (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
2750         (WebCore::LowPowerModeNotifier::isLowPowerModeEnabled):
2751         (WebCore::LowPowerModeNotifier::notifyLowPowerModeChanged):
2752         (WebCore::notifyLowPowerModeChanged):
2753
2754 2017-02-24  Chris Dumez  <cdumez@apple.com>
2755
2756         [Mac] Report domains using abnormally high memory usage via enhanced privacy logging
2757         https://bugs.webkit.org/show_bug.cgi?id=168797
2758         <rdar://problem/29964017>
2759
2760         Reviewed by Andreas Kling.
2761
2762         Report domains using abnormally high memory usage (> 2GB) via enhanced privacy
2763         logging on Mac.
2764
2765         * page/DiagnosticLoggingKeys.cpp:
2766         (WebCore::DiagnosticLoggingKeys::domainCausingJetsamKey):
2767         * page/DiagnosticLoggingKeys.h:
2768         * page/PerformanceMonitor.cpp:
2769         (WebCore::reportPageOverPostLoadResourceThreshold):
2770         (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
2771         (WebCore::PerformanceMonitor::measurePostLoadMemoryUsage):
2772         (WebCore::reportPageOverPostLoadCPUUsageThreshold): Deleted.
2773
2774 2017-02-24  Alex Christensen  <achristensen@webkit.org>
2775
2776         .. should not remove windows drive letters in paths of file URLs
2777         https://bugs.webkit.org/show_bug.cgi?id=168824
2778
2779         Reviewed by Youenn Fablet.
2780
2781         It's specified in https://url.spec.whatwg.org/#shorten-a-urls-path and helps behavior for browsers on Windows.
2782         It can't hurt to pass a few more web platform tests, though.
2783
2784         * platform/URLParser.cpp:
2785         (WebCore::URLParser::copyURLPartsUntil):
2786         (WebCore::URLParser::shouldPopPath):
2787         (WebCore::URLParser::popPath):
2788         (WebCore::URLParser::parse):
2789         * platform/URLParser.h:
2790
2791 2017-02-24  Csaba Osztrogonác  <ossy@webkit.org>
2792
2793         [Mac][cmake] Unreviewed buildfix after r212736.
2794
2795         * PlatformMac.cmake:
2796
2797 2017-02-24  John Wilander  <wilander@apple.com>
2798
2799         Resource Load Statistics: Add alternate classification method
2800         https://bugs.webkit.org/show_bug.cgi?id=168347
2801         <rdar://problem/30352793>
2802         <rdar://problem/30646710>
2803         <rdar://problem/30660708>
2804
2805         Reviewed by Alex Christensen.
2806
2807         This patch only adds test infrastructure in WebCore.
2808
2809         Tests: http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html
2810                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html
2811                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html
2812                http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html
2813                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html
2814                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html
2815                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html
2816                http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html
2817
2818         * loader/ResourceLoadObserver.cpp:
2819         (WebCore::ResourceLoadObserver::setSubframeUnderTopFrameOrigin):
2820         (WebCore::ResourceLoadObserver::setSubresourceUnderTopFrameOrigin):
2821         (WebCore::ResourceLoadObserver::setSubresourceUniqueRedirectTo):
2822         * loader/ResourceLoadObserver.h:
2823
2824 2017-02-23  Antoine Quint  <graouts@apple.com>
2825
2826         [Modern Media Controls] No controls are shown for <audio preload="none">
2827         https://bugs.webkit.org/show_bug.cgi?id=168800
2828         <rdar://problem/30652142>
2829
2830         Reviewed by Eric Carlson.
2831
2832         A media element's currentSrc property will only be set when data has started
2833         to load. In the case where preload="none" is used, regardless of whether a
2834         source is specified, currentSrc would be the empty string and we wouldn't
2835         show controls at all. Identifying whether a source is specified is a little
2836         tricky because it could be specified in a variety of ways and dynamically
2837         as well.
2838
2839         So instead we optimistically show controls always provided the "controls"
2840         attribute is set.
2841
2842         * Modules/modern-media-controls/media/controls-visibility-support.js:
2843         (ControlsVisibilitySupport.prototype._updateControls):
2844         (ControlsVisibilitySupport):
2845         * Modules/modern-media-controls/media/start-support.js:
2846         (StartSupport.prototype._shouldShowStartButton):
2847         (StartSupport):
2848
2849 2017-02-23  Joseph Pecoraro  <pecoraro@apple.com>
2850
2851         [Resource Timing] Gather timing information with reliable responseEnd time
2852         https://bugs.webkit.org/show_bug.cgi?id=168351
2853
2854         Reviewed by Alex Christensen.
2855
2856         This patch replaces the unused `double finishTime` in ResourceLoader's
2857         didFinishLoad with a complete WebCore::NetworkLoadMetrics object. This
2858         allows the NetworkProcess to give complete timing information, and more
2859         final metrics about the load, to WebCore. Currently this is only used
2860         by ResourceTiming, but it will soon be used by Web Inspector as well.
2861         We may also end up extending this to the didFail path as well, since it
2862         is possible that we have some metrics for load failures.
2863
2864         At the same time we want to start moving away from the legacy path that
2865         populated a subset of this information in ResourceResponse's NetworkLoadMetrics.
2866         It doesn't make sense to store this information on the ResourceResponse
2867         for a few reasons: We don't want to store the metrics in our Network Cache and
2868         not all of the load timing metrics have been populated yet (responseEnd).
2869         In an effort to move off of this data we've renamed the accessor to
2870         "deprecatedNetworkLoadMetrics". There are a few remaining clients
2871         (ResourceHandle, PerformanceTiming, InspectorNetworkAgent) which can be
2872         migrated separately from this patch.
2873
2874         Having both the legacy and new code paths adds a little bit of complexity.
2875         One advantage of the new path is that the complete load timing data
2876         (fetchStart -> dns -> connect -> request -> response -> responseEnd) can
2877         be packaged together. The legacy path could not include a responseEnd, so
2878         WebCore faked that value with its own timestamp. Having the fake responseEnd
2879         caused issues as timestamps / clocks are different between processes. In order
2880         for PerformanceResponseTiming to know whether or not the NetworkLoadMetrics
2881         has the complete network timing metrics it checks isComplete(). If true
2882         it knows it can use the responseEnd time from NetworkLoadMetrics, otherwise
2883         it must fallback to the legacy value from LoadTiming. Once all of the
2884         deprecatedNetworkLoadMetrics clients go away, we should always have the
2885         complete data and this can be eliminated.
2886
2887         Tests: imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.html
2888                imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.html
2889
2890         * PlatformMac.cmake:
2891         * WebCore.xcodeproj/project.pbxproj:
2892         Rename NetworkLoadTiming -> NetworkLoadMetrics.
2893
2894         * page/PerformanceResourceTiming.cpp:
2895         (WebCore::entryStartTime):
2896         (WebCore::entryEndTime):
2897         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
2898         (WebCore::PerformanceResourceTiming::nextHopProtocol):
2899         (WebCore::PerformanceResourceTiming::domainLookupStart):
2900         (WebCore::PerformanceResourceTiming::domainLookupEnd):
2901         (WebCore::PerformanceResourceTiming::connectStart):
2902         (WebCore::PerformanceResourceTiming::connectEnd):
2903         (WebCore::PerformanceResourceTiming::secureConnectionStart):
2904         (WebCore::PerformanceResourceTiming::requestStart):
2905         (WebCore::PerformanceResourceTiming::responseStart):
2906         (WebCore::PerformanceResourceTiming::responseEnd):
2907         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
2908         * page/PerformanceResourceTiming.h:
2909         Mostly just updating names and types. This does however need to get the
2910         correct endTime based on whether the NetworkLoadMetrics are complete
2911         (meaning includes responseEnd) or not (legacy, use LoadTiming value).
2912
2913         * page/PerformanceResourceTiming.idl:
2914         Add nextHopProtocol.
2915
2916         * page/PerformanceTiming.cpp:
2917         (WebCore::PerformanceTiming::domainLookupStart):
2918         (WebCore::PerformanceTiming::domainLookupEnd):
2919         (WebCore::PerformanceTiming::connectStart):
2920         (WebCore::PerformanceTiming::connectEnd):
2921         (WebCore::PerformanceTiming::secureConnectionStart):
2922         (WebCore::PerformanceTiming::requestStart):
2923         (WebCore::PerformanceTiming::responseStart):
2924         (WebCore::PerformanceTiming::resourceLoadTimeRelativeToFetchStart):
2925         * page/PerformanceTiming.h:
2926         Navigation Timing values still uses the NetworkLoadTiming values stored on
2927         the DocumentLoader. This should be moved off of the deprecated path separately.
2928
2929         * platform/network/NetworkLoadMetrics.h: Renamed from Source/WebCore/platform/network/NetworkLoadTiming.h.
2930         (WebCore::NetworkLoadMetrics::NetworkLoadMetrics):
2931         (WebCore::NetworkLoadMetrics::isolatedCopy):
2932         (WebCore::NetworkLoadMetrics::reset):
2933         (WebCore::NetworkLoadMetrics::operator==):
2934         (WebCore::NetworkLoadMetrics::operator!=):
2935         (WebCore::NetworkLoadMetrics::isComplete):
2936         (WebCore::NetworkLoadMetrics::markComplete):
2937         (WebCore::NetworkLoadMetrics::encode):
2938         (WebCore::NetworkLoadMetrics::decode):
2939         Re-introduce a reset() method (for NetworkLoadSoup to reset between redirects).
2940         Add protocolName and "complete" boolean.
2941
2942         * platform/network/cocoa/NetworkLoadMetrics.mm: Renamed from Source/WebCore/platform/network/cocoa/NetworkLoadTiming.mm.
2943         (WebCore::timingValue):
2944         (WebCore::copyTimingData):
2945         (WebCore::setCollectsTimingData):
2946         Use this opportunity to convert NetworkLoadTiming timestamps to WTF::Seconds.
2947         Since we already have to modify all the clients this moves us to use the more
2948         strongly typed units that are less ambiguous then "double". The rest of the
2949         Performance API has already moved to these units.
2950
2951         * inspector/InspectorNetworkAgent.cpp:
2952         (WebCore::InspectorNetworkAgent::buildObjectForTiming):
2953         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
2954         (WebCore::InspectorNetworkAgent::didFinishLoading):
2955         * inspector/InspectorNetworkAgent.h:
2956         Inspector was the only client of the finishTime, and since the value was
2957         erratically coming from clients in different ways it was almost certainly
2958         inaccurate. Simplify this in preparation for using NetworkLoadMetrics.
2959
2960         * Modules/fetch/FetchLoader.cpp:
2961         (WebCore::FetchLoader::didFinishLoading):
2962         * Modules/fetch/FetchLoader.h:
2963         * fileapi/FileReaderLoader.cpp:
2964         (WebCore::FileReaderLoader::didFinishLoading):
2965         * fileapi/FileReaderLoader.h:
2966         * html/MediaFragmentURIParser.cpp:
2967         (WebCore::MediaFragmentURIParser::parseNPTTime):
2968         * inspector/InspectorInstrumentation.cpp:
2969         (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
2970         * inspector/InspectorInstrumentation.h:
2971         (WebCore::InspectorInstrumentation::didFinishLoading):
2972         * loader/CrossOriginPreflightChecker.cpp:
2973         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
2974         * loader/DocumentLoader.cpp:
2975         (WebCore::DocumentLoader::notifyFinished):
2976         (WebCore::DocumentLoader::finishedLoading):
2977         (WebCore::DocumentLoader::continueAfterContentPolicy):
2978         (WebCore::DocumentLoader::maybeLoadEmpty):
2979         * loader/DocumentLoader.h:
2980         * loader/DocumentThreadableLoader.cpp:
2981         (WebCore::DocumentThreadableLoader::didReceiveResponse):
2982         (WebCore::DocumentThreadableLoader::notifyFinished):
2983         (WebCore::DocumentThreadableLoader::didFinishLoading):
2984         (WebCore::DocumentThreadableLoader::loadRequest):
2985         * loader/DocumentThreadableLoader.h:
2986         * loader/NetscapePlugInStreamLoader.cpp:
2987         (WebCore::NetscapePlugInStreamLoader::didFinishLoading):
2988         * loader/NetscapePlugInStreamLoader.h:
2989         * loader/ResourceLoadNotifier.cpp:
2990         (WebCore::ResourceLoadNotifier::didFinishLoad):
2991         (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
2992         (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
2993         * loader/ResourceLoadNotifier.h:
2994         * loader/ResourceLoader.cpp:
2995         (WebCore::ResourceLoader::deliverResponseAndData):
2996         (WebCore::ResourceLoader::loadDataURL):
2997         (WebCore::ResourceLoader::didFinishLoading):
2998         (WebCore::ResourceLoader::didFinishLoadingOnePart):
2999         * loader/ResourceLoader.h:
3000         * loader/ResourceTiming.cpp:
3001         (WebCore::ResourceTiming::fromLoad):
3002         (WebCore::ResourceTiming::fromSynchronousLoad):
3003         (WebCore::ResourceTiming::ResourceTiming):
3004         (WebCore::ResourceTiming::isolatedCopy):
3005         * loader/ResourceTiming.h:
3006         (WebCore::ResourceTiming::networkLoadMetrics):
3007         (WebCore::ResourceTiming::ResourceTiming):
3008         (WebCore::ResourceTiming::networkLoadTiming): Deleted.
3009         * loader/SubresourceLoader.cpp:
3010         (WebCore::SubresourceLoader::SubresourceLoader):
3011         (WebCore::SubresourceLoader::willSendRequestInternal):
3012         (WebCore::SubresourceLoader::didReceiveResponse):
3013         (WebCore::SubresourceLoader::didFinishLoading):
3014         (WebCore::SubresourceLoader::reportResourceTiming):
3015         * loader/SubresourceLoader.h:
3016         * loader/ThreadableLoaderClient.h:
3017         (WebCore::ThreadableLoaderClient::didFinishLoading):
3018         * loader/ThreadableLoaderClientWrapper.h:
3019         (WebCore::ThreadableLoaderClientWrapper::didFinishLoading):
3020         * loader/WorkerThreadableLoader.cpp:
3021         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
3022         * loader/WorkerThreadableLoader.h:
3023         * loader/appcache/ApplicationCacheGroup.cpp:
3024         (WebCore::ApplicationCacheGroup::didFinishLoading):
3025         * loader/appcache/ApplicationCacheGroup.h:
3026         * loader/cache/CachedResource.h:
3027         (WebCore::CachedResource::setLoadFinishTime):
3028         * loader/ios/QuickLook.mm:
3029         (-[WebPreviewLoader connectionDidFinishLoading:]):
3030         * page/EventSource.cpp:
3031         (WebCore::EventSource::didFinishLoading):
3032         * page/EventSource.h:
3033         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3034         (ResourceHandleStreamingClient::didFinishLoading):
3035         * platform/network/BlobResourceHandle.cpp:
3036         (WebCore::doNotifyFinish):
3037         * platform/network/PingHandle.h:
3038         * platform/network/ResourceHandle.h:
3039         * platform/network/ResourceHandleClient.h:
3040         (WebCore::ResourceHandleClient::didFinishLoading):
3041         * platform/network/ResourceResponseBase.cpp:
3042         (WebCore::ResourceResponseBase::crossThreadData):
3043         (WebCore::ResourceResponseBase::fromCrossThreadData):
3044         (WebCore::ResourceResponseBase::compare):
3045         * platform/network/ResourceResponseBase.h:
3046         (WebCore::ResourceResponseBase::deprecatedNetworkLoadMetrics):
3047         (WebCore::ResourceResponseBase::encode):
3048         (WebCore::ResourceResponseBase::decode):
3049         (WebCore::ResourceResponseBase::networkLoadTiming): Deleted.
3050         * platform/network/SynchronousLoaderClient.cpp:
3051         (WebCore::SynchronousLoaderClient::didFinishLoading):
3052         * platform/network/SynchronousLoaderClient.h:
3053         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
3054         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
3055         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
3056         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
3057         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
3058         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading):
3059         * platform/network/curl/ResourceHandleCurl.cpp:
3060         (WebCore::WebCoreSynchronousLoader::didFinishLoading):
3061         * platform/network/curl/ResourceHandleManager.cpp:
3062         (WebCore::calculateWebTimingInformations):
3063         (WebCore::ResourceHandleManager::downloadTimerCallback):
3064         (WebCore::handleDataURL):
3065         (WebCore::milisecondsSinceRequest): Deleted.
3066         * platform/network/mac/ResourceHandleMac.mm:
3067         (WebCore::ResourceHandle::getConnectionTimingData):
3068         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
3069         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
3070         (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]):
3071         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
3072         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
3073         (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
3074         * platform/network/soup/ResourceHandleSoup.cpp:
3075         (WebCore::restartedCallback):
3076         (WebCore::nextMultipartResponsePartCallback):
3077         (WebCore::sendRequestCallback):
3078         (WebCore::ResourceHandle::didStartRequest):
3079         (WebCore::networkEventCallback):
3080         (WebCore::ResourceHandle::sendPendingRequest):
3081         (WebCore::readCallback):
3082         (WebCore::milisecondsSinceRequest): Deleted.
3083         * workers/WorkerScriptLoader.cpp:
3084         (WebCore::WorkerScriptLoader::didFinishLoading):
3085         * workers/WorkerScriptLoader.h:
3086         * xml/XMLHttpRequest.cpp:
3087         (WebCore::XMLHttpRequest::didFinishLoading):
3088         * xml/XMLHttpRequest.h:
3089         Eliminate the unused finishTime double.
3090
3091 2017-02-23  Antoine Quint  <graouts@apple.com>
3092
3093         [Modern Media Controls] Controls overflow when media element has border or padding
3094         https://bugs.webkit.org/show_bug.cgi?id=168818
3095         <rdar://problem/30689780>
3096
3097         Reviewed by Jon Lee.
3098
3099         We used to query the media element's layout size to compute the size of the media controls,
3100         which would account for border and padding. Instead, we should use the size of the container,
3101         at the root of the ShadowRoot, which will always match the size of the media.
3102
3103         Test: media/modern-media-controls/media-controller/media-controller-controls-sizing-with-border-and-padding.html
3104
3105         * Modules/modern-media-controls/controls/media-controls.css:
3106         (.media-controls-container,):
3107         * Modules/modern-media-controls/media/media-controller.js:
3108         (MediaController.prototype._updateControlsSize):
3109         (MediaController.prototype._controlsWidth):
3110
3111 2017-02-23  Antoine Quint  <graouts@apple.com>
3112
3113         [Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls
3114         https://bugs.webkit.org/show_bug.cgi?id=168820
3115         <rdar://problem/30690281>
3116
3117         Reviewed by Jon Lee.
3118
3119         We broke this in https://bugs.webkit.org/show_bug.cgi?id=168755. We restore the check that the
3120         event target when initiating a drag is the controls bar itself and not some of its content.
3121
3122         Since this wasn't caught by our existing tests, we add a test that attemps to initiate a drag
3123         starting over one of the controls and notice that no dragging occurs.
3124
3125         Test: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html
3126
3127         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
3128         (MacOSFullscreenMediaControls.prototype._handleMousedown):
3129
3130 2017-02-23  Simon Fraser  <simon.fraser@apple.com>
3131
3132         REGRESSION (r211305): Masks on composited elements with preserve-3d broken
3133         https://bugs.webkit.org/show_bug.cgi?id=168815
3134         rdar://problem/30676846
3135
3136         Reviewed by Jon Lee.
3137
3138         r211305 moved the mask layer to be on the structural layer if there is one, to fix
3139         masking backdrops. However, with preserve-3d the structural layer can be a CATransformLayer,
3140         which doesn't take a mask, so limit the previous change to backdrops only.
3141
3142         Test: compositing/masks/mask-with-preserve-3d.html
3143
3144         * platform/graphics/ca/GraphicsLayerCA.cpp:
3145         (WebCore::GraphicsLayerCA::updateMaskLayer):
3146
3147 2017-02-23  Antoine Quint  <graouts@apple.com>
3148
3149         [Modern Media Controls] Show "Loading" until playback starts
3150         https://bugs.webkit.org/show_bug.cgi?id=168809
3151         <rdar://problem/30687468>
3152
3153         Reviewed by Jon Lee.
3154
3155         We now display the "Loading" status as soon as we've started loading and
3156         until we've obtained enough data to play. No test provided since we don't
3157         have a way to specifically set networkState and readyState to the satisfactory
3158         values.
3159
3160         * Modules/modern-media-controls/media/status-support.js:
3161         (StatusSupport.prototype.syncControl):
3162         (StatusSupport):
3163
3164 2017-02-23  Antoine Quint  <graouts@apple.com>
3165
3166         [Modern Media Controls] Enforce a minimum layout height of 50pt for <audio>
3167         https://bugs.webkit.org/show_bug.cgi?id=168801
3168         <rdar://problem/30683453>
3169
3170         Reviewed by Eric Carlson.
3171
3172         We enforce a 50pt minimum layout height for <audio> elements. There is no way
3173         for the page author to override this value since the min-height property is set
3174         as !important in a <style> element contained in a ShadowRoot.
3175
3176         * Modules/modern-media-controls/controls/media-controls.css:
3177         (:host(audio)):
3178
3179 2017-02-23  Youenn Fablet  <youenn@apple.com>
3180
3181         [WebRTC] Outgoing video quality is poor
3182         https://bugs.webkit.org/show_bug.cgi?id=168778
3183         <rdar://problem/30674673>
3184
3185         Reviewed by Eric Carlson.
3186
3187         Covered by manually ensuring the voice process thread is not spinning.
3188
3189         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: Setting the next call to max was not a good idea since the thread process is adding some value to it, making it a negative value.
3190
3191 2017-02-23  Wenson Hsieh  <wenson_hsieh@apple.com>
3192
3193         Data interaction with a URL should navigate the page if the operation is not handled
3194         https://bugs.webkit.org/show_bug.cgi?id=168798
3195         <rdar://problem/30665969>
3196
3197         Reviewed by Tim Horton.
3198
3199         Refactors some drag and drop code on the Mac, and implements PlatformPasteboard::stringForType.
3200
3201         * page/DragController.cpp:
3202         (WebCore::DragController::performDragOperation):
3203         * platform/ios/PlatformPasteboardIOS.mm:
3204         (WebCore::PlatformPasteboard::stringForType):
3205         * platform/mac/DragDataMac.mm:
3206
3207 2017-02-23  Youenn Fablet  <youenn@apple.com>
3208
3209         [WebRTC] RealtimeOutgoingAudioSource does not need to upsample audio buffers
3210         https://bugs.webkit.org/show_bug.cgi?id=168796
3211
3212         Reviewed by Jer Noble.
3213
3214         Covered by manual testing.
3215         Limiting RealtimeOutgoingAudioSource conversion to interleaving and float-to-integer.
3216         Removed the sample rate conversion.
3217
3218         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
3219         (WebCore::libwebrtcAudioFormat):
3220         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
3221         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
3222
3223 2017-02-23  Alex Christensen  <achristensen@webkit.org>
3224
3225         Re-soft-link CoreVideo after r212906
3226         https://bugs.webkit.org/show_bug.cgi?id=168803
3227
3228         Reviewed by Jer Noble.
3229
3230         CoreVideo should be soft linked to reduce startup time.
3231         Linking against the framework just for a few symbols used in one file was the wrong solution.
3232
3233         * Configurations/WebCore.xcconfig:
3234         * platform/cocoa/CoreVideoSoftLink.cpp:
3235         * platform/cocoa/CoreVideoSoftLink.h:
3236         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
3237
3238 2017-02-23  Chris Dumez  <cdumez@apple.com>
3239
3240         Report domains using abnormally high CPU usage via enhanced privacy logging
3241         https://bugs.webkit.org/show_bug.cgi?id=168794
3242         <rdar://problem/29964018>
3243
3244         Reviewed by Ryosuke Niwa.
3245
3246         Report domains using abnormally high CPU usage (> 20%) via enhanced privacy
3247         logging.
3248
3249         * page/DiagnosticLoggingKeys.cpp:
3250         (WebCore::DiagnosticLoggingKeys::domainCausingEnergyDrainKey):
3251         * page/DiagnosticLoggingKeys.h:
3252         * page/PerformanceMonitor.cpp:
3253         (WebCore::reportPageOverPostLoadCPUUsageThreshold):
3254         (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
3255
3256 2017-02-23  Zalan Bujtas  <zalan@apple.com>
3257
3258         Simple line layout: Adjust RunResolver::lineIndexForHeight with line struts.
3259         https://bugs.webkit.org/show_bug.cgi?id=168783
3260         <rdar://problem/30676449>
3261
3262         Reviewed by Antti Koivisto.
3263
3264         When there's a pagination gap between lines the simple lineIndex = y / lineHeight formula does not work anymore.
3265         This patch takes the line gaps into account by offsetting the y position accordingly.
3266
3267         Not enabled yet.
3268
3269         * rendering/SimpleLineLayoutResolver.cpp:
3270         (WebCore::SimpleLineLayout::RunResolver::lineIndexForHeight):
3271
3272 2017-02-23  Alex Christensen  <achristensen@webkit.org>
3273
3274         Fix iOS WebRTC build after r212812
3275         https://bugs.webkit.org/show_bug.cgi?id=168790
3276
3277         Reviewed by Tim Horton.
3278
3279         * Configurations/WebCore.xcconfig:
3280
3281 2017-02-23  Carlos Garcia Campos  <cgarcia@igalia.com>
3282
3283         [GStreamer] Several layout tests trigger GStreamer-CRITICAL **: gst_bin_get_by_name: assertion 'GST_IS_BIN (bin)' failed
3284         https://bugs.webkit.org/show_bug.cgi?id=167016
3285
3286         Reviewed by Xabier Rodriguez-Calvar.
3287
3288         This is because we create AudioSourceProviderGStreamer objects that are never loaded. In the destructor the
3289         AudioSourceProviderGStreamer calls gst_bin_get_by_name() on its m_audioSinkBin that is nullptr. We could simply
3290         check m_audioSinkBin in the destructor, but I think it's better to simply not create
3291         AudioSourceProviderGStreamer for nothing. MediaPlayerPrivateGStreamer should create the AudioSourceProvider on demand.
3292
3293         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3294         (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): Do not create the AudioSourceProvider.
3295         (WebCore::MediaPlayerPrivateGStreamer::createAudioSink): Call ensureAudioSourceProvider() before using m_audioSourceProvider.
3296         (WebCore::MediaPlayerPrivateGStreamer::ensureAudioSourceProvider): Create the AudioSourceProvider if needed.
3297         (WebCore::MediaPlayerPrivateGStreamer::audioSourceProvider): Ensure and return the m_audioSourceProvider.
3298         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
3299
3300 2017-02-23  Tomas Popela  <tpopela@redhat.com>
3301
3302         [GTK] Drag and drop is always moving the content even if copy is requested
3303         https://bugs.webkit.org/show_bug.cgi?id=168424
3304
3305         Reviewed by Carlos Garcia Campos.
3306
3307         Drag and drop is always moving the content around even if the copy is
3308         requested (i.e. by pressing the Control key).
3309
3310         Test: editing/pasteboard/drag-drop-copy-content.html
3311
3312         * page/gtk/DragControllerGtk.cpp:
3313         (WebCore::DragController::isCopyKeyDown):
3314
3315 2017-02-22  Myles C. Maxfield  <mmaxfield@apple.com>
3316
3317         [Cocoa] Remove Yosemite-specific font lookup code
3318         https://bugs.webkit.org/show_bug.cgi?id=168682
3319
3320         Reviewed by Zalan Bujtas.
3321
3322         No new tests because there is no behavior change.
3323
3324         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3325         (WebCore::platformFontLookupWithFamily):
3326         (WebCore::fontWithFamily):
3327         * platform/graphics/mac/FontCacheMac.mm:
3328         (WebCore::platformInvalidateFontCache):
3329         (WebCore::acceptableChoice): Deleted.
3330         (WebCore::betterChoice): Deleted.
3331         (WebCore::desiredFamilyToAvailableFamilyMap): Deleted.
3332         (WebCore::hasDesiredFamilyToAvailableFamilyMapping): Deleted.
3333         (WebCore::rememberDesiredFamilyToAvailableFamilyMapping): Deleted.
3334         (WebCore::toAppKitFontWeight): Deleted.
3335         (WebCore::appkitWeightToFontWeight): Deleted.
3336         (WebCore::toNSFontTraits): Deleted.
3337         (WebCore::platformFontWithFamily): Deleted.
3338
3339 2017-02-22  Antoine Quint  <graouts@apple.com>
3340
3341         [Modern Media Controls] Clicking on the video doesn't toggle playback state in fullscreen on macOS
3342         https://bugs.webkit.org/show_bug.cgi?id=168755
3343         <rdar://problem/30664484>
3344
3345         Reviewed by Dean Jackson.
3346
3347         We now call super in the handleEvent() method of MacOSFullscreenMediaControls if we're not dealing
3348         with an event type and target combination that was specifically registered in this class's scope.
3349         We had mistakenly added the call to super.handleEvent(event) in the wrong method when fixing
3350         https://bugs.webkit.org/show_bug.cgi?id=168515.
3351
3352         Test: media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause-fullscreen.html
3353
3354         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
3355         (MacOSFullscreenMediaControls.prototype.handleEvent):
3356         (MacOSFullscreenMediaControls.prototype._handleMousedown):
3357         * Modules/modern-media-controls/controls/macos-media-controls.js:
3358         (MacOSMediaControls.prototype.handleEvent):
3359         (MacOSMediaControls):
3360
3361 2017-02-22  Antoine Quint  <graouts@apple.com>
3362
3363         [Modern Media Controls] Scrubber stops moving while scrubbing on macOS
3364         https://bugs.webkit.org/show_bug.cgi?id=168518
3365         <rdar://problem/30577637>
3366
3367         Reviewed by Dean Jackson.
3368
3369         As we start to scrub, controlValueWillStartChanging() is called on
3370         ScrubberSupport and pauses the media if it's not already paused. This
3371         causes the play/pause button to change icon and for layout() to be
3372         called on MacOSInlineMediaControls. This in turns sets the .children
3373         property on the .controlsBar and eventually yields a DOM manipulation
3374         which re-inserts the scrubber's DOM hierarchy, causing stutters during
3375         user interaction.
3376
3377         Our solution is to make the .children setter smarter about identifying
3378         that the children list hasn't changed and that no DOM invalidation is
3379         necessary.
3380
3381         * Modules/modern-media-controls/controls/layout-node.js:
3382         (LayoutNode.prototype.set children):
3383
3384 2017-02-22  Antoine Quint  <graouts@apple.com>
3385
3386         [Modern Media Controls] Controls bar may disappear while captions menu is visible
3387         https://bugs.webkit.org/show_bug.cgi?id=168751
3388         <rdar://problem/30663411>
3389
3390         Reviewed by Dean Jackson.
3391
3392         We now prevent the controls bar from fading out due to the auto-hide timer firing
3393         when the tracks panel is up, and wait until the track panel is hidden before fading
3394         the controls bar.
3395
3396         Test: media/modern-media-controls/tracks-panel/tracks-panel-prevent-controls-bar-from-fading.html
3397
3398         * Modules/modern-media-controls/controls/controls-bar.js:
3399         (ControlsBar.prototype.set userInteractionEnabled):
3400         (ControlsBar.prototype._autoHideTimerFired):
3401
3402 2017-02-22  Antoine Quint  <graouts@apple.com>
3403
3404         [Modern Media Controls] Can't set the volume slider with macOS inline controls
3405         https://bugs.webkit.org/show_bug.cgi?id=168747
3406         <rdar://problem/30605528>
3407
3408         Reviewed by Dean Jackson.
3409
3410         Only call super for events we haven't registered specifically in the context
3411         of this class. Otherwise we'd invalidate the volume container visibility for
3412         a "mousedown" event registered by the MacOSMediaControls, the super class.
3413
3414         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
3415         (MacOSInlineMediaControls.prototype.handleEvent):
3416
3417 2017-02-22  Antti Koivisto  <antti@apple.com>
3418
3419         Replace SimpleLineLayout::Range by WTF::IteratorRange
3420         https://bugs.webkit.org/show_bug.cgi?id=168742
3421
3422         Reviewed by Zalan Bujtas.
3423
3424         Kill a redundant custom type.
3425
3426         * rendering/SimpleLineLayoutResolver.cpp:
3427         (WebCore::SimpleLineLayout::RunResolver::rangeForRect):
3428         (WebCore::SimpleLineLayout::RunResolver::rangeForRenderer):
3429         (WebCore::SimpleLineLayout::RunResolver::rangeForRendererWithOffsets):
3430         * rendering/SimpleLineLayoutResolver.h:
3431         (WebCore::SimpleLineLayout::LineResolver::rangeForRect):
3432         (WebCore::SimpleLineLayout::Range::Range): Deleted.
3433         (WebCore::SimpleLineLayout::Range::begin): Deleted.
3434         (WebCore::SimpleLineLayout::Range::end): Deleted.
3435
3436 2017-02-22  Simon Fraser  <simon.fraser@apple.com>
3437
3438         Add the Web Authentication API as "Under Consideration".
3439
3440         * features.json:
3441
3442 2017-02-22  Zalan Bujtas  <zalan@apple.com>
3443
3444         Simple line layout: Set the pagination strut on the flow when the first line does not fit the page.
3445         https://bugs.webkit.org/show_bug.cgi?id=168738
3446         <rdar://problem/30659469>
3447
3448         Reviewed by Antti Koivisto.
3449
3450         The pagination strut for the first line is tracked by the parent RenderBlockFlow and not by
3451         the line itself (see RenderBlockFlow::adjustLinePositionForPagination()). Also renamed *PaginationStrut* to
3452         *LineStrut* to make sure we don't confuse it with the block level strut.
3453
3454         Not enabled yet.
3455
3456         * rendering/SimpleLineLayout.cpp:
3457         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow):
3458         (WebCore::SimpleLineLayout::computeLineBreakIndex):
3459         (WebCore::SimpleLineLayout::setPageBreakForLine):
3460         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
3461         (WebCore::SimpleLineLayout::create):
3462         (WebCore::SimpleLineLayout::Layout::create):
3463         (WebCore::SimpleLineLayout::Layout::Layout):
3464         * rendering/SimpleLineLayout.h:
3465         (WebCore::SimpleLineLayout::Layout::hasLineStruts):
3466         (WebCore::SimpleLineLayout::Layout::struts):
3467         (WebCore::SimpleLineLayout::Layout::hasPaginationStruts): Deleted.
3468         * rendering/SimpleLineLayoutFunctions.cpp:
3469         (WebCore::SimpleLineLayout::paintFlow):
3470         * rendering/SimpleLineLayoutFunctions.h:
3471         (WebCore::SimpleLineLayout::computeFlowHeight):
3472         * rendering/SimpleLineLayoutResolver.h:
3473         (WebCore::SimpleLineLayout::RunResolver::Run::computeBaselinePosition):
3474
3475 2017-02-22  Youenn Fablet  <youenn@apple.com>
3476
3477         [WebRTC] Disable libwebrtc stderr logging in release mode
3478         https://bugs.webkit.org/show_bug.cgi?id=168734
3479
3480         Reviewed by Tim Horton.
3481
3482         No change of behavior.
3483
3484         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
3485         (WebCore::initializePeerConnectionFactoryAndThreads):
3486
3487 2017-02-22  Jer Noble  <jer.noble@apple.com>
3488
3489         MediaStreamSourceNode never receives audio from MockRealtimeAudioSourceMac.
3490         https://bugs.webkit.org/show_bug.cgi?id=168731
3491
3492         Reviewed by Eric Carlson.
3493
3494         Test: fast/mediastream/mock-media-source-webaudio.html
3495
3496         Because the audioSourceProvider can be created before the mock source is configured, explicitly configure the
3497         source if necessary after creating the audioSourceProvider.
3498
3499         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
3500         (WebCore::MockRealtimeAudioSourceMac::audioSourceProvider):
3501
3502 2017-02-22  Chris Dumez  <cdumez@apple.com>
3503
3504         Do not aggressively throttle DOM timers until they've reached their max nesting level
3505         https://bugs.webkit.org/show_bug.cgi?id=168700
3506         <rdar://problem/29808005>
3507
3508         Reviewed by Simon Fraser.
3509
3510         Do not aggressively throttle DOM timers until they've actually areached their max
3511         nesting level (5). This overly aggressive throttling of non-nested timers is what
3512         was causing Google Maps to use 100% CPU in background tabs for several minutes.
3513
3514         Test: fast/dom/timer-throttling-hidden-page-non-nested.html
3515
3516         * dom/Document.cpp:
3517         (WebCore::Document::timerAlignmentInterval):
3518
3519 2017-02-22  Eric Carlson  <eric.carlson@apple.com>
3520
3521         [MediaStream iOS] Respond to capture interruptions and notifications
3522         https://bugs.webkit.org/show_bug.cgi?id=168610
3523
3524         Reviewed by Jer Noble.
3525
3526         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3527         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Drive-by cleanup: don't create
3528         a sample buffer display layer unless there is an active video track.
3529
3530         * platform/mediastream/mac/AVMediaCaptureSource.h:
3531         * platform/mediastream/mac/AVMediaCaptureSource.mm:
3532         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource): Add static_asserts to ensure that
3533         WebCore::InterruptionReason values map directly to AVCaptureSessionInterruptionReason values.
3534         (WebCore::AVMediaCaptureSource::~AVMediaCaptureSource): Minor cleanup.
3535         (WebCore::AVMediaCaptureSource::startProducingData): Start listening for notifications before
3536         starting the session.
3537         (WebCore::AVMediaCaptureSource::stopProducingData): Remove the notification observers before
3538         stopping the session.
3539         (WebCore::AVMediaCaptureSource::setupSession): Minor style cleanup.
3540         (WebCore::AVMediaCaptureSource::captureSessionRuntimeError): New. When the error is AVErrorMediaServicesWereReset,
3541         sometimes caused by a mediaserverd crash, try to restart the session one time.
3542         (WebCore::AVMediaCaptureSource::captureSessionBeginInterruption): Store the interruption reason.
3543         (WebCore::AVMediaCaptureSource::captureSessionEndInterruption): Try to restart the session if
3544         it was interrupted because the app went into multi-app layout mode.
3545         (WebCore::sessionKVOProperties): Drive-by cleanup.
3546         (-[WebCoreAVMediaCaptureSourceObserver initWithCallback:]):
3547         (-[WebCoreAVMediaCaptureSourceObserver disconnect]):
3548         (-[WebCoreAVMediaCaptureSourceObserver addNotificationObservers]):
3549         (-[WebCoreAVMediaCaptureSourceObserver removeNotificationObservers]):
3550         (-[WebCoreAVMediaCaptureSourceObserver sessionRuntimeError:]):
3551         (-[WebCoreAVMediaCaptureSourceObserver beginSessionInterrupted:]):
3552         (-[WebCoreAVMediaCaptureSourceObserver endSessionInterrupted:]):
3553
3554         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3555         (WebCore::AVVideoCaptureSource::initializeCapabilities): Not all AVCaptureSession preset strings
3556         are available on all platforms so load with SOFT_LINK_POINTER_OPTIONAL and NULL check before use.
3557         (WebCore::sizeForPreset): Ditto.
3558         (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions): Ditto.
3559
3560 2017-02-22  Zalan Bujtas  <zalan@apple.com>
3561
3562         Simple line layout: ensureLineBoxes for paginated content.
3563         https://bugs.webkit.org/show_bug.cgi?id=168729
3564         <rdar://problem/30654400>
3565
3566         Reviewed by Antti Koivisto.
3567
3568         This patch sets the layout state bits for paginated subtree layout, when we are switching
3569         over from simple line runs to inline tree. 
3570
3571         Not enabled yet.
3572
3573         * rendering/RenderBlockFlow.cpp:
3574         (WebCore::RenderBlockFlow::ensureLineBoxes):
3575         * rendering/RenderView.cpp:
3576         (WebCore::RenderView::pushLayoutStateForPagination): LayoutUnit(1) is not the real height, it's just
3577         an indicator that we've got paginated content.
3578         * rendering/RenderView.h:
3579         * rendering/SimpleLineLayout.cpp:
3580         (WebCore::SimpleLineLayout::create):
3581         (WebCore::SimpleLineLayout::Layout::create):
3582         (WebCore::SimpleLineLayout::Layout::Layout):
3583         * rendering/SimpleLineLayout.h:
3584         (WebCore::SimpleLineLayout::Layout::isPaginated):
3585         (WebCore::SimpleLineLayout::Layout::hasPaginationStruts):
3586         * rendering/SimpleLineLayoutFunctions.h:
3587         (WebCore::SimpleLineLayout::computeFlowHeight):
3588         * rendering/SimpleLineLayoutResolver.h:
3589         (WebCore::SimpleLineLayout::RunResolver::Run::computeBaselinePosition):
3590
3591 2017-02-22  Per Arne Vollan  <pvollan@apple.com>
3592
3593         [Win] Compile fix.
3594         https://bugs.webkit.org/show_bug.cgi?id=168713
3595
3596         Reviewed by Brent Fulgham.
3597
3598         The include file <ANGLE/ShaderLang.h> is not found.
3599
3600         * testing/Internals.cpp:
3601
3602 2017-02-22  Xabier Rodriguez Calvar  <calvaris@igalia.com>
3603
3604         [GStreamer][EME] Fix issue with allowed systems extraction
3605         https://bugs.webkit.org/show_bug.cgi?id=168717
3606
3607         Reviewed by Carlos Garcia Campos.
3608
3609         The allowed systems were not being extracted from the need-context
3610         message because the loop was not stopping on the right condition.
3611
3612         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3613         (WebCore::extractEventsAndSystemsFromMessage): Fix wrong
3614         condition.
3615         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
3616         Add better debug category.
3617
3618 2017-02-22  Antti Koivisto  <antti@apple.com>
3619
3620         REGRESSION(r207669): Crash after mutating selector text
3621         https://bugs.webkit.org/show_bug.cgi?id=168655
3622         <rdar://problem/30632111>
3623
3624         Reviewed by Andreas Kling.
3625
3626         Test: fast/css/selector-text-mutation-crash.html
3627
3628         * style/StyleScope.cpp:
3629         (WebCore::Style::Scope::resolver):
3630         (WebCore::Style::Scope::updateStyleResolver):
3631
3632         Protect against entering scheduleUpdate and wiping style resolver while updating it.
3633         Extension stylesheets can trigger this.
3634
3635         (WebCore::Style::Scope::scheduleUpdate):
3636
3637         Clear the style resolver immediately if style sheet content changes. The resolver may
3638         have data structures that point to the old sheet contents.
3639
3640         The resolver would get wiped anyway when the scheduled update actually occurs.
3641
3642         * style/StyleScope.h:
3643
3644 2017-02-08  Sergio Villar Senin  <svillar@igalia.com>
3645
3646         [css-grid] Move the track sizing algorithm to its own class
3647         https://bugs.webkit.org/show_bug.cgi?id=167988
3648
3649         Reviewed by Manuel Rego Casasnovas.
3650
3651         This is about moving the track sizing algorithm code out of RenderGrid to a new class
3652         GridTrackSizingAlgorithm, making RenderGrid more compact and easy to maintain. A nice side
3653         effect of this patch is the removal of the GridSizingData structure as it is no longer
3654         needed. All the data structures in that class were transferred to GridTrackSizingAlgorithm
3655         as private attribute members. The GridTrack class was also moved to the new file.
3656
3657         The algorithm execution starts with the call to run(). It's mandatory to call setup() before
3658         any call to run() in order to properly configure the behaviour of the algorithm. You can
3659         call setup() & run() multiple times for a single layout operation (normally twice, one for
3660         columns and another one for rows). The algorithm uses a state machine to verify that the
3661         client issues the calls in the proper order (i.e. first columns and then rows). After
3662         finishing the layout, the client should call reset() to allow the algorithm to perform
3663         cleanups and to prepare itself for another round of calls.
3664
3665         In order to implement the different behaviours of the algorithm depending on whether the
3666         available size is definite or not, a strategy pattern was implemented in the
3667         GridTrackSizingAlgorithmStrategy class. It has two subclasses, one for definite sizes and
3668         another one for indefinite ones.
3669
3670         We took advantage of this change to perform some renames of the track sizing algorithm
3671         methods that were still using the names from the first versions of the specs. Not only that,
3672         the original track sizing algorithm method (computeUsedBreadthOfGridTracks) was split in 4
3673         different parts representing the 4 steps of the algorithm.
3674
3675         No new tests as this is about moving code and refactoring.
3676
3677         * CMakeLists.txt:
3678         * WebCore.xcodeproj/project.pbxproj:
3679         * rendering/GridTrackSizingAlgorithm.cpp: Added.
3680         (WebCore::GridTrack::baseSize):
3681         (WebCore::GridTrack::growthLimit):
3682         (WebCore::GridTrack::setBaseSize):
3683         (WebCore::GridTrack::setGrowthLimit):
3684         (WebCore::GridTrack::growthLimitIfNotInfinite):
3685         (WebCore::GridTrack::setTempSize):
3686         (WebCore::GridTrack::growTempSize):
3687         (WebCore::GridTrack::setGrowthLimitCap):
3688         (WebCore::GridTrack::ensureGrowthLimitIsBiggerThanBaseSize):
3689         (WebCore::shouldClearOverrideContainingBlockContentSizeForChild):
3690         (WebCore::hasOverrideContainingBlockContentSizeForChild):
3691         (WebCore::setOverrideContainingBlockContentSizeForChild):
3692         (WebCore::flowAwareDirectionForChild):
3693         (WebCore::overrideContainingBlockContentSizeForChild):
3694         (WebCore::computeMarginLogicalSizeForChild):
3695         (WebCore::marginIntrinsicLogicalWidthForChild):
3696         (WebCore::GridTrackSizingAlgorithm::setFreeSpace):
3697         (WebCore::GridTrackSizingAlgorithm::rawGridTrackSize):
3698         (WebCore::GridTrackSizingAlgorithm::computeTrackBasedSize):
3699         (WebCore::GridTrackSizingAlgorithm::initialBaseSize):
3700         (WebCore::GridTrackSizingAlgorithm::initialGrowthLimit):
3701         (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem):
3702         (WebCore::GridTrackSizingAlgorithm::spanningItemCrossesFlexibleSizedTracks):
3703         (WebCore::GridItemWithSpan::GridItemWithSpan):
3704         (WebCore::GridItemWithSpan::gridItem):
3705         (WebCore::GridItemWithSpan::span):
3706         (WebCore::GridItemWithSpan::operator<):
3707         (WebCore::GridTrackSizingAlgorithm::itemSizeForTrackSizeComputationPhase):
3708         (WebCore::shouldProcessTrackForTrackSizeComputationPhase):
3709         (WebCore::trackSizeForTrackSizeComputationPhase):
3710         (WebCore::updateTrackSizeForTrackSizeComputationPhase):
3711         (WebCore::trackShouldGrowBeyondGrowthLimitsForTrackSizeComputationPhase):
3712         (WebCore::markAsInfinitelyGrowableForTrackSizeComputationPhase):
3713         (WebCore::GridTrackSizingAlgorithm::increaseSizesToAccommodateSpanningItems):
3714         (WebCore::sortByGridTrackGrowthPotential):
3715         (WebCore::clampGrowthShareIfNeeded):
3716         (WebCore::GridTrackSizingAlgorithm::distributeSpaceToTracks):
3717         (WebCore::GridTrackSizingAlgorithm::assumedRowsSizeForOrthogonalChild):
3718         (WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild):
3719         (WebCore::GridTrackSizingAlgorithm::gridTrackSize):
3720         (WebCore::GridTrackSizingAlgorithm::computeFlexFactorUnitSize):
3721         (WebCore::GridTrackSizingAlgorithm::computeFlexSizedTracksGrowth):
3722         (WebCore::GridTrackSizingAlgorithm::findFrUnitSize):
3723         (WebCore::GridTrackSizingAlgorithm::computeGridContainerIntrinsicSizes):
3724         (WebCore::GridTrackSizingAlgorithmStrategy::logicalHeightForChild):
3725         (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild):
3726         (WebCore::GridTrackSizingAlgorithmStrategy::maxContentForChild):
3727         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild):
3728         (WebCore::GridTrackSizingAlgorithmStrategy::updateOverrideContainingBlockContentSizeForChild):
3729         (WebCore::IndefiniteSizeStrategy::minLogicalWidthForChild):
3730         (WebCore::IndefiniteSizeStrategy::layoutGridItemForMinSizeComputation):
3731         (WebCore::IndefiniteSizeStrategy::maximizeTracks):
3732         (WebCore::normalizedFlexFraction):
3733         (WebCore::IndefiniteSizeStrategy::findUsedFlexFraction):
3734         (WebCore::IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
3735         (WebCore::DefiniteSizeStrategy::minLogicalWidthForChild):
3736         (WebCore::DefiniteSizeStrategy::maximizeTracks):
3737         (WebCore::DefiniteSizeStrategy::layoutGridItemForMinSizeComputation):
3738         (WebCore::DefiniteSizeStrategy::findUsedFlexFraction):
3739         (WebCore::DefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
3740         (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):
3741         (WebCore::GridTrackSizingAlgorithm::resolveIntrinsicTrackSizes):
3742         (WebCore::GridTrackSizingAlgorithm::stretchFlexibleTracks):
3743         (WebCore::GridTrackSizingAlgorithm::advanceNextState):
3744         (WebCore::GridTrackSizingAlgorithm::isValidTransition):
3745         (WebCore::GridTrackSizingAlgorithm::setup):
3746         (WebCore::GridTrackSizingAlgorithm::run):
3747         (WebCore::GridTrackSizingAlgorithm::reset):
3748         (WebCore::GridTrackSizingAlgorithm::tracksAreWiderThanMinTrackBreadth):
3749         (WebCore::GridTrackSizingAlgorithm::StateMachine::StateMachine):
3750         (WebCore::GridTrackSizingAlgorithm::StateMachine::~StateMachine):
3751         * rendering/GridTrackSizingAlgorithm.h: Added.
3752         (WebCore::GridTrack::GridTrack):
3753         (WebCore::GridTrack::infiniteGrowthPotential):
3754         (WebCore::GridTrack::plannedSize):
3755         (WebCore::GridTrack::setPlannedSize):
3756         (WebCore::GridTrack::tempSize):
3757         (WebCore::GridTrack::infinitelyGrowable):
3758         (WebCore::GridTrack::setInfinitelyGrowable):
3759         (WebCore::GridTrack::growthLimitCap):
3760         (WebCore::GridTrack::growthLimitIsInfinite):
3761         (WebCore::GridTrack::isGrowthLimitBiggerThanBaseSize):
3762         (WebCore::GridTrackSizingAlgorithmStrategy::GridTrackSizingAlgorithmStrategy):
3763         (WebCore::GridTrackSizingAlgorithmStrategy::computeTrackBasedSize):
3764         (WebCore::GridTrackSizingAlgorithmStrategy::direction):
3765         (WebCore::GridTrackSizingAlgorithmStrategy::findFrUnitSize):
3766         (WebCore::GridTrackSizingAlgorithmStrategy::distributeSpaceToTracks):
3767         (WebCore::GridTrackSizingAlgorithmStrategy::renderGrid):
3768         * rendering/RenderGrid.cpp:
3769         (WebCore::RenderGrid::RenderGrid):
3770         (WebCore::RenderGrid::computeTrackBasedLogicalHeight):
3771         (WebCore::RenderGrid::computeTrackSizesForDefiniteSize):
3772         (WebCore::RenderGrid::repeatTracksSizingIfNeeded):
3773         (WebCore::RenderGrid::layoutBlock):
3774         (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
3775         (WebCore::RenderGrid::computeTrackSizesForIndefiniteSize):
3776         (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
3777         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded):
3778         (WebCore::RenderGrid::layoutGridItems):
3779         (WebCore::RenderGrid::gridAreaBreadthForChildIncludingAlignmentOffsets):
3780         (WebCore::RenderGrid::populateGridPositionsForDirection):
3781         (WebCore::RenderGrid::columnAxisOffsetForChild):
3782         (WebCore::RenderGrid::rowAxisOffsetForChild):
3783         (WebCore::RenderGrid::findChildLogicalPosition):
3784         (WebCore::GridTrack::GridTrack): Deleted.
3785         (WebCore::GridTrack::baseSize): Deleted.
3786         (WebCore::GridTrack::growthLimit): Deleted.
3787         (WebCore::GridTrack::setBaseSize): Deleted.
3788         (WebCore::GridTrack::setGrowthLimit): Deleted.
3789         (WebCore::GridTrack::infiniteGrowthPotential): Deleted.
3790         (WebCore::GridTrack::growthLimitIfNotInfinite): Deleted.
3791         (WebCore::GridTrack::plannedSize): Deleted.
3792         (WebCore::GridTrack::setPlannedSize): Deleted.
3793         (WebCore::GridTrack::tempSize): Deleted.
3794         (WebCore::GridTrack::setTempSize): Deleted.
3795         (WebCore::GridTrack::growTempSize): Deleted.
3796         (WebCore::GridTrack::infinitelyGrowable): Deleted.
3797         (WebCore::GridTrack::setInfinitelyGrowable): Deleted.
3798         (WebCore::GridTrack::setGrowthLimitCap): Deleted.
3799         (WebCore::GridTrack::growthLimitCap): Deleted.
3800         (WebCore::GridTrack::growthLimitIsInfinite): Deleted.
3801         (WebCore::GridTrack::isGrowthLimitBiggerThanBaseSize): Deleted.
3802         (WebCore::GridTrack::ensureGrowthLimitIsBiggerThanBaseSize): Deleted.
3803         (WebCore::RenderGrid::GridSizingData::GridSizingData): Deleted.
3804         (WebCore::RenderGrid::GridSizingData::freeSpace): Deleted.
3805         (WebCore::RenderGrid::GridSizingData::availableSpace): Deleted.
3806         (WebCore::RenderGrid::GridSizingData::setAvailableSpace): Deleted.
3807         (WebCore::RenderGrid::GridSizingData::advanceNextState): Deleted.
3808         (WebCore::RenderGrid::GridSizingData::isValidTransition): Deleted.
3809         (WebCore::RenderGrid::GridSizingData::grid): Deleted.
3810         (WebCore::RenderGrid::GridSizingData::setFreeSpace): Deleted.
3811         (WebCore::RenderGrid::computeTrackSizesForDirection): Deleted.
3812         (WebCore::RenderGrid::computeIntrinsicLogicalHeight): Deleted.
3813         (WebCore::normalizedFlexFraction): Deleted.
3814         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): Deleted.
3815         (WebCore::RenderGrid::computeFlexSizedTracksGrowth): Deleted.
3816         (WebCore::RenderGrid::computeUsedBreadthOfMinLength): Deleted.
3817         (WebCore::RenderGrid::computeUsedBreadthOfMaxLength): Deleted.
3818         (WebCore::RenderGrid::computeFlexFactorUnitSize): Deleted.
3819         (WebCore::RenderGrid::findFlexFactorUnitSize): Deleted.
3820         (WebCore::hasOverrideContainingBlockContentSizeForChild): Deleted.
3821         (WebCore::setOverrideContainingBlockContentSizeForChild): Deleted.
3822         (WebCore::shouldClearOverrideContainingBlockContentSizeForChild): Deleted.
3823         (WebCore::RenderGrid::rawGridTrackSize): Deleted.
3824         (WebCore::RenderGrid::gridTrackSize): Deleted.
3825         (WebCore::RenderGrid::logicalHeightForChild): Deleted.
3826         (WebCore::RenderGrid::minSizeForChild): Deleted.
3827         (WebCore::RenderGrid::updateOverrideContainingBlockContentSizeForChild): Deleted.
3828         (WebCore::RenderGrid::minContentForChild): Deleted.
3829         (WebCore::RenderGrid::maxContentForChild): Deleted.
3830         (WebCore::GridItemWithSpan::GridItemWithSpan): Deleted.
3831         (WebCore::GridItemWithSpan::gridItem): Deleted.
3832         (WebCore::GridItemWithSpan::span): Deleted.
3833         (WebCore::GridItemWithSpan::operator<): Deleted.
3834         (WebCore::RenderGrid::spanningItemCrossesFlexibleSizedTracks): Deleted.
3835         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): Deleted.
3836         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems): Deleted.
3837         (WebCore::trackSizeForTrackSizeComputationPhase): Deleted.
3838         (WebCore::RenderGrid::shouldProcessTrackForTrackSizeComputationPhase): Deleted.
3839         (WebCore::RenderGrid::trackShouldGrowBeyondGrowthLimitsForTrackSizeComputationPhase): Deleted.
3840         (WebCore::RenderGrid::markAsInfinitelyGrowableForTrackSizeComputationPhase): Deleted.
3841         (WebCore::RenderGrid::updateTrackSizeForTrackSizeComputationPhase): Deleted.
3842         (WebCore::RenderGrid::currentItemSizeForTrackSizeComputationPhase): Deleted.
3843         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems): Deleted.
3844         (WebCore::sortByGridTrackGrowthPotential): Deleted.
3845         (WebCore::clampGrowthShareIfNeeded): Deleted.
3846         (WebCore::RenderGrid::distributeSpaceToTracks): Deleted.
3847         (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth): Deleted.
3848         (WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild): Deleted.
3849         (WebCore::RenderGrid::gridAreaBreadthForChild): Deleted.
3850         * rendering/RenderGrid.h:
3851
3852 2017-02-22  Per Arne Vollan  <pvollan@apple.com>
3853
3854         [Win] Crash under CACFLayerTreeHost::acceleratedCompositingAvailable().
3855         https://bugs.webkit.org/show_bug.cgi?id=168711
3856
3857         Reviewed by Alex Christensen.
3858
3859         Add null pointer check.
3860
3861         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
3862         (WebCore::CACFLayerTreeHost::acceleratedCompositingAvailable):
3863
3864 2017-02-22  Carlos Garcia Campos  <cgarcia@igalia.com>
3865
3866         [GStreamer] Crash in MediaPlayerPrivateGStreamerMSE::buffered() when MEDIA_STREAM is disabled
3867         https://bugs.webkit.org/show_bug.cgi?id=168662
3868
3869         Reviewed by Michael Catanzaro.
3870
3871         When MEDIA_STREAM is disabled, if MediaPlayer::loadWithNextMediaEngine is called with a current engine and
3872         there's no type specified, the next media engine that is used is the MSE one. Since there's no actually a media
3873         stream, the engine is created but never loaded. When buffered is called it tries to use its media source that is
3874         nullptr. It doesn't happen when MEDIA_STREAM is enabled, because the next media engine returned is Owr that
3875         doesn't implement buffered and always returns an empty PlatformTimeRanges.
3876
3877         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3878         (WebCore::MediaPlayerPrivateGStreamerMSE::buffered): Return an empty PlatformTimeRanges if m_mediaSource is nullptr.
3879
3880 2017-02-21  Youenn Fablet  <youenn@apple.com>
3881
3882         [WebRTC][Mac] Activate libwebrtc
3883         https://bugs.webkit.org/show_bug.cgi?id=167293
3884
3885         Reviewed by Alex Christensen.
3886
3887         * Configurations/WebCore.xcconfig:
3888         * Configurations/WebCoreTestSupport.xcconfig:
3889         * Configurations/FeatureDefines.xcconfig:
3890
3891 2017-02-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3892
3893         Unreviewed. Fix WinCairo build after r212703.
3894
3895         * platform/TextureMapper.cmake:
3896
3897 2017-02-21  Per Arne Vollan  <pvollan@apple.com>
3898
3899         Add support for CSS properties paint-order, stroke-linecap, and stroke-linejoin in text rendering.
3900         https://bugs.webkit.org/show_bug.cgi?id=168601
3901         rdar://problem/30583872
3902
3903         Reviewed by Simon Fraser.
3904
3905         Text rendering should respect the CSS properties paint-order, stroke-linecap, and stroke-linejoin,
3906         see https://drafts.fxtf.org/paint/. The text rendering changes are mainly in the TextPainter class,
3907         where text is painted in three phases (fill, stroke, markers), where the order follows the
3908         paint-order property. The linecap and linejoin properties are set on the graphics context before
3909         rendering the text.
3910
3911         Tests: fast/css/paint-order.html
3912                fast/css/paint-order-shadow.html
3913
3914         * css/CSSComputedStyleDeclaration.cpp:
3915         (WebCore::paintOrder):
3916         * css/StyleBuilderConverter.h:
3917         (WebCore::StyleBuilderConverter::convertPaintOrder):
3918         * rendering/TextPaintStyle.cpp:
3919         (WebCore::computeTextPaintStyle):
3920         (WebCore::updateGraphicsContext):
3921         * rendering/TextPaintStyle.h:
3922         * rendering/TextPainter.cpp:
3923         (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded):
3924         * rendering/style/RenderStyle.cpp:
3925         (WebCore::RenderStyle::paintTypesForPaintOrder):
3926         * rendering/style/RenderStyle.h:
3927         (WebCore::RenderStyle::setPaintOrder):
3928         (WebCore::RenderStyle::initialPaintOrder):
3929         * rendering/style/RenderStyleConstants.h:
3930         * rendering/style/SVGRenderStyleDefs.h:
3931         * rendering/style/StyleRareInheritedData.cpp:
3932         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
3933         * rendering/svg/RenderSVGShape.cpp:
3934         (WebCore::RenderSVGShape::fillStrokeMarkers):
3935         * rendering/svg/SVGInlineTextBox.cpp:
3936         (WebCore::SVGInlineTextBox::paint):
3937
3938 2017-02-21  Joseph Pecoraro  <pecoraro@apple.com>
3939
3940         [User Timing] Throw a SyntaxError for performance.measure if mark name is not found
3941         https://bugs.webkit.org/show_bug.cgi?id=168707
3942
3943         Reviewed by Ryosuke Niwa.
3944
3945         Test: performance-api/performance-measure-name.html
3946
3947         * page/PerformanceUserTiming.cpp:
3948         (WebCore::UserTiming::findExistingMarkStartTime):
3949         Instead of returning zero, throw a SyntaxError. This is more in line
3950         with User Timing Level 1 and behavior in Window. This is an issue with
3951         the Level 2 spec: https://github.com/w3c/user-timing/issues/21
3952
3953 2017-02-21  Ryan Haddad  <ryanhaddad@apple.com>
3954
3955         Unreviewed attempt to fix the Windows build.
3956
3957         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
3958         (PlatformCALayerWin::supportsSubpixelAntialiasedText):
3959
3960 2017-02-21  Ryan Haddad  <ryanhaddad@apple.com>
3961
3962         Unreviewed, rolling out r212737.
3963
3964         This change caused an existing LayoutTest to crash.
3965