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