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