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