Web Inspector: allow import() inside the inspector
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-02-07  Yusuke Suzuki  <utatane.tea@gmail.com>
2
3         Web Inspector: allow import() inside the inspector
4         https://bugs.webkit.org/show_bug.cgi?id=167457
5
6         Reviewed by Ryosuke Niwa.
7
8         When evaluating `import("...")`, we need the caller's context to resolve
9         the module specifier correctly. For example, if `import("./cocoa.js")` is
10         evaluated in the script "drinks/hot.js", this module name is resolved to
11         "drinks/cocoa.js". If the same import operator is evaluated in the script
12         "menu/all.js", the module specifier becomes "menu/cocoa.js".
13
14         Previously we reject the import operator if the caller does not have such
15         a context. These context is SourceOrigin and its ScriptFetcher. While they
16         are offered in the script tag and other code evaluations, the inspector
17         console does not offer that. These class are offered in the WebCore side
18         and we should not touch these classes in the JSC's inspector code.
19
20         Now we relax the above restriction. If the above caller information is not
21         offered, we fallback to the default one. In the web page, we use the page's
22         URL as the caller's source origin. This allows us to evaluate the import
23         operator in the inspector console.
24
25         And as of r167698, the console recognizes `await import("...")` form. We use
26         this to test this `import()` in the console functionality.
27
28         * bindings/js/ScriptModuleLoader.cpp:
29         (WebCore::ScriptModuleLoader::importModule):
30
31 2017-02-07  Myles C. Maxfield  <mmaxfield@apple.com>
32
33         Move platform-independent parts of ComplexTextController out of mac/ subfolder
34         https://bugs.webkit.org/show_bug.cgi?id=167922
35
36         Reviewed by Jon Lee.
37
38         Just a mechanical git mv, and updating the Xcode projects.
39
40         No new tests because there is no behavior change.
41
42         * WebCore.xcodeproj/project.pbxproj:
43         * platform/graphics/ComplexTextController.cpp: Renamed from Source/WebCore/platform/graphics/mac/ComplexTextController.cpp.
44         * platform/graphics/ComplexTextController.h: Renamed from Source/WebCore/platform/graphics/mac/ComplexTextController.h.
45
46 2017-02-06  Carlos Garcia Campos  <cgarcia@igalia.com>
47
48         Overlay scrolling with iframe-s broken
49         https://bugs.webkit.org/show_bug.cgi?id=165056
50
51         Reviewed by Antonio Gomes.
52
53         Mouse press events for overlay scrollbars are ignored if there's a subframe under the scrollbar. This doesn't
54         happen with normal scrollbars, because the subframe is not really under the scrollbar, so events are always
55         correctly passed to the scrollbar. With overlay scrollbars, the hit test detects the scrollbar, but events are
56         always passed first to the subframe. Scrollbars are correctly updated on hover though, because
57         handleMouseMoveEvent checks the presence of scrollbars before checking for subframes and move events are
58         actually passed to both, the scrollbar and the subframe. Overlay scrollbars should always take precedence over
59         subframes to handle mouse press events, so we should check first if mouse is over a scrollbar and never pass the
60         event to a subframe in that case. Another problem is that the cursor is not updated either when the overlay
61         scrollbar is hovered and there's a subframe. This is because in handleMouseMoveEvent we pass the event to both
62         the scrollbar and subframe but we never update the cursor when a suframe was found. So, here again we need to make
63         an exception for scrollbars and upate the cursor when mouse is over the scrollbar even if a subframe was found.
64
65         Test: fast/scrolling/scroll-animator-overlay-scrollbars-clicked.html
66
67         * page/EventHandler.cpp:
68         (WebCore::EventHandler::handleMousePressEvent): Move the scrollbar check before the subframe check.
69         (WebCore::EventHandler::handleMouseMoveEvent): Update the cursor when hovering a scrollbar even if a subframe
70         was found.
71         (WebCore::EventHandler::updateLastScrollbarUnderMouse): Use an enum instead of a boolean for setLast parameter.
72         * page/EventHandler.h:
73
74 2017-02-06  Chris Dumez  <cdumez@apple.com>
75
76         Symbols exposed on cross-origin Window / Location objects should be configurable
77         https://bugs.webkit.org/show_bug.cgi?id=167920
78
79         Reviewed by Ryosuke Niwa.
80
81         Symbols exposed on cross-origin Window / Location objects should be configurable:
82         - https://html.spec.whatwg.org/#crossorigingetownpropertyhelper-(-o,-p-) (Step 1)
83
84         Firefox behaves as per specification.
85
86         No new tests, rebaselined existing test.
87
88         * bindings/js/JSDOMWindowCustom.cpp:
89         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
90         * bindings/js/JSLocationCustom.cpp:
91         (WebCore::JSLocation::getOwnPropertySlotDelegate):
92
93 2017-02-06  Joseph Pecoraro  <pecoraro@apple.com>
94
95         Web Inspector: Do not use RunLoop when dispatching inspector GC event
96         https://bugs.webkit.org/show_bug.cgi?id=167683
97         <rdar://problem/30167791>
98
99         Reviewed by Brian Burg.
100
101         Covered by existing tests.
102
103         * CMakeLists.txt:
104         * WebCore.xcodeproj/project.pbxproj:
105         * inspector/InspectorAllInOne.cpp:
106         Add new file.
107
108         * inspector/PageHeapAgent.cpp:
109         (WebCore::PageHeapAgent::PageHeapAgent):
110         (WebCore::PageHeapAgent::enable):
111         (WebCore::PageHeapAgent::disable):
112         * inspector/PageHeapAgent.h:
113         Extend WebHeapAgent.
114
115         * inspector/WorkerInspectorController.cpp:
116         (WebCore::WorkerInspectorController::WorkerInspectorController):
117         Use WebHeapAgent.
118
119         * inspector/WebHeapAgent.cpp: Added.
120         (WebCore::SendGarbageCollectionEventsTask::SendGarbageCollectionEventsTask):
121         (WebCore::SendGarbageCollectionEventsTask::addGarbageCollection):
122         (WebCore::SendGarbageCollectionEventsTask::reset):
123         (WebCore::SendGarbageCollectionEventsTask::timerFired):
124         (WebCore::WebHeapAgent::WebHeapAgent):
125         (WebCore::WebHeapAgent::~WebHeapAgent):
126         (WebCore::WebHeapAgent::disable):
127         (WebCore::WebHeapAgent::dispatchGarbageCollectedEvent):
128         (WebCore::WebHeapAgent::dispatchGarbageCollectionEventsAfterDelay):
129         * inspector/WebHeapAgent.h:
130         Move the defered event dispatch from InspectorHeapAgent here where a RunLoop is guarenteed.
131
132 2017-02-06  Joseph Pecoraro  <pecoraro@apple.com>
133
134         ExtendedColor leaks seen on leaks bot
135         https://bugs.webkit.org/show_bug.cgi?id=167912
136
137         Reviewed by Alexey Proskuryakov.
138
139         * platform/graphics/Color.cpp:
140         (WebCore::Color::operator=):
141         Before overwriting m_colorData, we must deref the extended color inside it.
142
143 2017-02-06  Simon Fraser  <simon.fraser@apple.com>
144
145         Re-land r210095 (avoid a tile revalidation on scale change)
146         https://bugs.webkit.org/show_bug.cgi?id=167866
147
148         Reviewed by Tim Horton.
149         
150         r210095 was rolled out in r211230 but now that all TileControllers unparent
151         offscreen tiles, we can roll it back it.
152         
153         Also add more Tiling logging.
154
155         * platform/graphics/ca/TileGrid.cpp:
156         (WebCore::validationPolicyAsString):
157         (WebCore::TileGrid::setScale):
158         (WebCore::TileGrid::prepopulateRect):
159         (WebCore::TileGrid::revalidateTiles):
160         (WebCore::TileGrid::ensureTilesForRect):
161
162 2017-02-06  Myles C. Maxfield  <mmaxfield@apple.com>
163
164         Migrate ComplexTextController to use platform-independent types
165         https://bugs.webkit.org/show_bug.cgi?id=167833
166
167         Reviewed by Brent Fulgham.
168
169         ComplexTextController will eventually be used on all ports to perform complex text layout.
170         This is a mechanical patch which migrates the shared parts of ComplexTextController away from
171         using CoreGraphics and CoreFoundation types in favor of WebCore/platform types. Eventually,
172         ComplexTextController will get moved to PAL but there is a layering violation (TextLayout) to
173         fix first.
174
175         No new tests because there is no behavior change.
176
177         * platform/graphics/GlyphBuffer.h:
178         (WebCore::GlyphBufferAdvance::GlyphBufferAdvance):
179         * platform/graphics/mac/ComplexTextController.cpp:
180         (WebCore::ComplexTextController::offsetForPosition):
181         (WebCore::advanceByCombiningCharacterSequence):
182         (WebCore::ComplexTextController::ComplexTextRun::indexAt):
183         (WebCore::ComplexTextController::ComplexTextRun::setIsNonMonotonic):
184         (WebCore::ComplexTextController::advance):
185         (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
186         * platform/graphics/mac/ComplexTextController.h:
187         (WebCore::ComplexTextController::ComplexTextRun::create):
188         (WebCore::ComplexTextController::ComplexTextRun::stringLength):
189         (WebCore::ComplexTextController::ComplexTextRun::indexBegin):
190         (WebCore::ComplexTextController::ComplexTextRun::indexEnd):
191         (WebCore::ComplexTextController::ComplexTextRun::endOffsetAt):
192         (WebCore::ComplexTextController::ComplexTextRun::glyphs):
193         (WebCore::ComplexTextController::ComplexTextRun::growInitialAdvanceHorizontally):
194         (WebCore::ComplexTextController::ComplexTextRun::initialAdvance):
195         (WebCore::ComplexTextController::ComplexTextRun::baseAdvances):
196         (WebCore::ComplexTextController::ComplexTextRun::glyphOrigins):
197         (WebCore::ComplexTextController::glyphOrigin):
198         (WebCore::ComplexTextController::ComplexTextRun::createForTesting): Deleted.
199         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
200         (SOFT_LINK):
201         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
202         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
203
204 2017-02-06  Brent Fulgham  <bfulgham@apple.com>
205
206         Correct File Path Handling in SecurityOrigin and FileSystem
207         https://bugs.webkit.org/show_bug.cgi?id=167894
208         <rdar://problem/30380080>
209
210         Reviewed by Alexey Proskuryakov.
211
212         Roll out the URL decoding being done in the FileSystem class (added in Bug 167894), and instead ensure that
213         SecurityOrigin properly handles file URLs, and only passes valid file strings to the FileSystem interface.
214
215         Tested by FileSystemTests and SecurityOriginTests in TestWebKitAPI.
216
217         * page/SecurityOrigin.cpp:
218         (WebCore::SecurityOrigin::SecurityOrigin): Initialize m_filePath using the url's fileSystemPath, not
219         the %-encoded 'path' property.
220         (WebCore::SecurityOrigin::canDisplay): Pass the 'fileSystemPath' to 'filesHaveSameVolume', rather than
221         the %-encoded 'path' property.
222         * page/SecurityOrigin.h:
223         * platform/FileSystem.cpp:
224         (WebCore::filesHaveSameVolume): Do not use 'decodeURLEscapeSequences' in 'filesHaveSameVolume'.
225
226 2017-02-06  Andy Estes  <aestes@apple.com>
227
228         [Cocoa] Split FileSystemMac.mm into Mac and Cocoa parts
229         https://bugs.webkit.org/show_bug.cgi?id=167908
230
231         Reviewed by Sam Weinig.
232
233         Kept the Mac-only functions in FileSystemMac.mm and moved the rest into FileSystemCocoa.mm.
234
235         * PlatformMac.cmake:
236         * WebCore.xcodeproj/project.pbxproj:
237         * platform/cocoa/FileSystemCocoa.mm: Copied from Source/WebCore/platform/mac/FileSystemMac.mm.
238         * platform/mac/FileSystemMac.mm:
239         (-[WebFileManagerDelegate fileManager:shouldProceedAfterError:movingItemAtURL:toURL:]): Moved to FileSystemCocoa.mm.
240         (WebCore::homeDirectoryPath): Ditto.
241         (WebCore::openTemporaryFile): Ditto.
242         (WebCore::moveFile): Ditto.
243         (WebCore::getVolumeFreeSpace): Ditto.
244
245 2017-02-06  Eric Carlson  <eric.carlson@apple.com>
246
247         [MediaStream Mac] Remove some unused code
248         https://bugs.webkit.org/show_bug.cgi?id=167913
249
250         Reviewed by Jer Noble.
251
252         No new tests, no functional change.
253
254         * platform/mediastream/CaptureDeviceManager.h:
255         (WebCore::CaptureSessionInfo::~CaptureSessionInfo): Deleted.
256         (WebCore::CaptureSessionInfo::supportsVideoSize): Deleted.
257         (WebCore::CaptureSessionInfo::bestSessionPresetForVideoDimensions): Deleted.
258         * platform/mediastream/mac/AVCaptureDeviceManager.h:
259         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
260         (WebCore::AVCaptureDeviceManager::refreshCaptureDeviceList):
261         (WebCore::AVCaptureSessionInfo::AVCaptureSessionInfo): Deleted.
262         (WebCore::AVCaptureSessionInfo::supportsVideoSize): Deleted.
263         (WebCore::AVCaptureSessionInfo::bestSessionPresetForVideoDimensions): Deleted.
264         * platform/mediastream/mac/AVMediaCaptureSource.mm:
265         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource):
266
267 2017-02-06  Youenn Fablet  <youennf@gmail.com>
268
269         Allow some schemes to opt-out of CORS
270         https://bugs.webkit.org/show_bug.cgi?id=167795
271
272         Reviewed by Alex Christensen.
273
274         Test: http/tests/security/bypassing-cors-checks-for-extension-urls.html
275
276         Adding the possibility to opt out of CORS for DocumentThreadableLoader clients (fetch and XHR).
277         This is made specific to the case of user extension URLs for pages running user scripts.
278         Introducing a boolean flag in Page for that purpose.
279         Introducing a helper routine in SchemeRegistry to centralize the various user script extension schemes.
280
281         * loader/DocumentThreadableLoader.cpp:
282         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
283         * page/Frame.cpp:
284         (WebCore::Frame::injectUserScripts):
285         * page/Page.h:
286         (WebCore::Page::setAsRunningUserScripts):
287         (WebCore::Page::isRunningUserScripts):
288         * platform/SchemeRegistry.cpp:
289         (WebCore::SchemeRegistry::isUserExtensionScheme):
290         * platform/SchemeRegistry.h:
291         * testing/Internals.cpp:
292         (WebCore::Internals::setAsRunningUserScripts):
293         * testing/Internals.h:
294         * testing/Internals.idl:
295
296 2017-02-06  Chris Dumez  <cdumez@apple.com>
297
298         Align [[OwnPropertyKeys]] with the HTML specification for cross-origin Window / Location objects
299         https://bugs.webkit.org/show_bug.cgi?id=167647
300         <rdar://problem/30339489>
301
302         Reviewed by Sam Weinig.
303
304         Align [[OwnPropertyKeys]] with the HTML specification for cross-origin Window / Location objects:
305         - https://html.spec.whatwg.org/#windowproxy-ownpropertykeys [1]
306         - https://html.spec.whatwg.org/#crossoriginownpropertykeys-(-o-) [2]
307         - https://html.spec.whatwg.org/#crossoriginproperties-(-o-) [3]
308
309         In particular, the following changes were made:
310         - Location:
311           - We now return the following symbols as well: @@toStringTag, @@hasInstance,
312             @@isConcatSpreadable as per [2].
313         - Window:
314           - We now return the following symbols as well: @@toStringTag, @@hasInstance,
315             @@isConcatSpreadable as per [2].
316           - We now return the indices of the child browsing contexts as per [1].
317           - We now return the names of the child browsing contexts as per [3].
318
319         No new tests, updated / rebaselined existing tests.
320
321         * bindings/js/JSDOMWindowCustom.cpp:
322         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
323         Index properties should be configurable as per:
324         - https://html.spec.whatwg.org/#windowproxy-getownproperty (step 2.5)
325
326         (WebCore::inScope):
327         (WebCore::addScopedChildrenNames):
328         (WebCore::addCrossOriginPropertyNames):
329         (WebCore::addScopedChildrenIndexes):
330         (WebCore::addCrossOriginOwnPropertyNames):
331         (WebCore::JSDOMWindow::getOwnPropertyNames):
332         * bindings/js/JSLocationCustom.cpp:
333         (WebCore::addCrossOriginPropertyNames):
334         (WebCore::addCrossOriginOwnPropertyNames):
335         (WebCore::JSLocation::getOwnPropertyNames):
336
337 2017-02-06  Yoav Weiss  <yoav@yoav.ws>
338
339         http/tests/preload/dynamic_removing_preload.html fails to test what it should
340         https://bugs.webkit.org/show_bug.cgi?id=167792
341
342         Reviewed by Ryosuke Niwa.
343
344         Cancel the link preload resource load when the link element is removed from the DOM.
345
346         No new tests, but unskipping an existing test: http/tests/preload/dynamic_removing_preload.html
347
348         * html/HTMLLinkElement.cpp:
349         (WebCore::HTMLLinkElement::removedFrom): Call m_linkLoader.cancelLoad().
350         * loader/LinkLoader.cpp:
351         (WebCore::LinkLoader::cancelLoad): Clear m_preloadResourceClient.
352         * loader/LinkLoader.h:
353         * loader/LinkPreloadResourceClients.h:
354         (WebCore::LinkPreloadResourceClient::clearResource): Call m_resource->cancelLoad().
355         * loader/SubresourceLoader.cpp:
356         (WebCore::LinkPreloadResourceClient::didFinishLoading): Change ASSERT to exempt cancelled loads.
357
358 2017-02-06  Alex Christensen  <achristensen@webkit.org>
359
360         More build fixes after r211751
361         https://bugs.webkit.org/show_bug.cgi?id=166998
362
363         * platform/network/soup/ResourceHandleSoup.cpp:
364         (WebCore::applyAuthenticationToRequest):
365         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
366         (WebCore::SocketStreamHandleImpl::create):
367
368 2017-02-06  Alex Christensen  <achristensen@webkit.org>
369
370         Fix non-cocoa builds after r211751.
371         https://bugs.webkit.org/show_bug.cgi?id=166998
372
373         * platform/network/cf/ResourceHandleCFNet.cpp:
374         (WebCore::ResourceHandle::createCFURLConnection):
375         (WebCore::ResourceHandle::willSendRequest):
376         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
377         (WebCore::ResourceHandle::receivedCredential):
378         * platform/network/curl/ResourceHandleCurl.cpp:
379         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
380         (WebCore::ResourceHandle::receivedCredential):
381         * platform/network/curl/ResourceHandleManager.cpp:
382         (WebCore::ResourceHandleManager::applyAuthenticationToRequest):
383         * platform/network/soup/ResourceHandleSoup.cpp:
384         (WebCore::applyAuthenticationToRequest):
385         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
386         (WebCore::ResourceHandle::receivedCredential):
387
388 2017-02-06  Alex Christensen  <achristensen@webkit.org>
389
390         credentials should be partitioned by main document domain
391         https://bugs.webkit.org/show_bug.cgi?id=166998
392         rdar://problem/22901123
393
394         Reviewed by Brady Eidson.
395
396         Covered by http/tests/security/credentials-iframes.html
397         Also added http/tests/security/credentials-from-different-domains.html to verify existing behavior without iframes.
398
399         * Modules/websockets/WebSocketChannel.cpp:
400         (WebCore::WebSocketChannel::connect):
401         * dom/Document.h:
402         * page/SecurityOrigin.cpp:
403         (WebCore::SecurityOrigin::domainForCachePartition):
404         Return emptyString instead of a null String because it is used as a key in a HashMap, and hashing null strings dereferences null.
405         * page/SocketProvider.cpp:
406         (WebCore::SocketProvider::createSocketStreamHandle):
407         * page/SocketProvider.h:
408         * platform/network/CredentialStorage.cpp:
409         (WebCore::CredentialStorage::set):
410         (WebCore::CredentialStorage::get):
411         (WebCore::CredentialStorage::remove):
412         * platform/network/CredentialStorage.h:
413         Partition credentials.
414         * platform/network/ResourceHandleInternal.h:
415         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
416         * platform/network/cf/SocketStreamHandleImpl.h:
417         (WebCore::SocketStreamHandleImpl::create):
418         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
419         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
420         (WebCore::SocketStreamHandleImpl::getStoredCONNECTProxyCredentials):
421         * platform/network/curl/SocketStreamHandleImpl.h:
422         (WebCore::SocketStreamHandleImpl::create):
423         * platform/network/mac/ResourceHandleMac.mm:
424         (WebCore::ResourceHandle::createNSURLConnection):
425         (WebCore::ResourceHandle::willSendRequest):
426         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
427         (WebCore::ResourceHandle::receivedCredential):
428         * platform/network/soup/SocketStreamHandleImpl.h:
429
430 2017-02-06  Simon Fraser  <simon.fraser@apple.com>
431
432         Safari pages are blank sometimes (missing tiles)
433         https://bugs.webkit.org/show_bug.cgi?id=167904
434
435         Reviewed by Tim Horton.
436
437         After r211683 we failed to udpate the "inWindow" flag on the page tiled layer, because
438         usingTiledBacking() on GraphicsLayer confusingly was false for the page tiled layer.
439
440         Fix by removing usingTiledBacking() entirely, and checking for tiledBacking(),
441         looking at the layer type when necessary.
442
443         Tested by tiled-drawing/tiled-backing-in-window.html
444
445         * platform/graphics/GraphicsLayer.cpp:
446         (WebCore::GraphicsLayer::GraphicsLayer):
447         (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): This is the bug fix.
448         (WebCore::GraphicsLayer::getDebugBorderInfo):
449         (WebCore::GraphicsLayer::dumpProperties):
450         * platform/graphics/GraphicsLayer.h:
451         (WebCore::GraphicsLayer::usingTiledBacking): Deleted.
452         * platform/graphics/ca/GraphicsLayerCA.cpp:
453         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
454         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
455         (WebCore::GraphicsLayerCA::changeLayerTypeTo):
456         * rendering/RenderLayerBacking.cpp:
457         (WebCore::RenderLayerBacking::willDestroyLayer):
458         (WebCore::RenderLayerBacking::compositingLayerType):
459         * rendering/RenderLayerCompositor.cpp: A bit more logging.
460         (WebCore::RenderLayerCompositor::setIsInWindow):
461         (WebCore::RenderLayerCompositor::attachRootLayer):
462
463 2017-02-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
464
465         Change the CSS animation timer a to be little more than 60fps to ensure we hit that frame rate
466         https://bugs.webkit.org/show_bug.cgi?id=167825
467
468         Reviewed by Simon Fraser.
469
470         The system timer fires little bit slower than 60fps. This might cause the
471         frame to be missed and hence it can lower the frame rate significantly. The
472         rAF timer was set to 15ms for the same reason. So set the repeated CSS
473         animation timer also to 15ms.
474
475         * page/animation/CSSAnimationController.cpp:
476
477 2017-02-06  Jer Noble  <jer.noble@apple.com>
478
479         Playback stalls when a SourceBuffer append causes frame eviction
480         https://bugs.webkit.org/show_bug.cgi?id=167834
481
482         Reviewed by Eric Carlson.
483
484         Test: PerformanceTests/Media/MSERemoveCodedFrames.html
485
486         Optimize searching through SampleMap by presentationTime.
487
488         Many of the methods exposed by PresentationOrderSampleMap used the bare  std::equal_range,
489         lower_bound, or upper_bound methods. Unlike those methods exposed on std::map, the bare
490         search methods perform a linear O(n) search, rather than a the binary O(log(n)) search used
491         by std::map. Rewrite those methods using the bare methods in terms of the std::map search
492         methods.
493
494         Drive-by fix: rename findSampleOnOrAfterPresentationTime to
495         findSampleStartingOnOrAfterPresentationTime to make the behavior of the method more
496         explicit.
497
498         * Modules/mediasource/SampleMap.cpp:
499         (WebCore::PresentationOrderSampleMap::findSampleContainingPresentationTime):
500         (WebCore::PresentationOrderSampleMap::findSampleStartingOnOrAfterPresentationTime):
501         (WebCore::PresentationOrderSampleMap::reverseFindSampleBeforePresentationTime):
502         (WebCore::DecodeOrderSampleMap::findSyncSampleAfterPresentationTime):
503         (WebCore::PresentationOrderSampleMap::findSamplesBetweenPresentationTimes):
504         (WebCore::PresentationOrderSampleMap::findSamplesWithinPresentationRange):
505         (WebCore::PresentationOrderSampleMap::findSampleOnOrAfterPresentationTime): Deleted.
506         * Modules/mediasource/SampleMap.h:
507         (WebCore::PresentationOrderSampleMap::begin):
508         (WebCore::PresentationOrderSampleMap::end):
509         (WebCore::PresentationOrderSampleMap::rbegin):
510         (WebCore::PresentationOrderSampleMap::rend):
511         (WebCore::DecodeOrderSampleMap::begin):
512         (WebCore::DecodeOrderSampleMap::end):
513         (WebCore::DecodeOrderSampleMap::rbegin):
514         (WebCore::DecodeOrderSampleMap::rend):
515         (WebCore::SampleMap::SampleMap):
516         (WebCore::SampleMap::sizeInBytes):
517         (WebCore::SampleMap::decodeOrder):
518         (WebCore::SampleMap::presentationOrder):
519         * Modules/mediasource/SourceBuffer.cpp:
520         (WebCore::removeSamplesFromTrackBuffer):
521         (WebCore::SourceBuffer::removeCodedFrames):
522         (WebCore::SourceBuffer::reenqueueMediaForTime):
523         * WebCore.xcodeproj/project.pbxproj:
524
525 2017-02-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
526
527         Rename AnimationController to CSSAnimationController
528         https://bugs.webkit.org/show_bug.cgi?id=167829
529
530         Reviewed by Simon Fraser.
531
532         AnimationController is a very generic name. The current function of this
533         class is CSS animation.
534
535         * CMakeLists.txt:
536         * WebCore.xcodeproj/project.pbxproj:
537         * css/CSSComputedStyleDeclaration.cpp:
538         (WebCore::computeRenderStyleForProperty):
539         * dom/Document.cpp:
540         * history/CachedFrame.cpp:
541         * page/Frame.cpp:
542         (WebCore::Frame::Frame):
543         * page/Frame.h:
544         (WebCore::Frame::animation):
545         * page/FrameView.cpp:
546         * page/Page.cpp:
547         * page/animation/AnimationBase.cpp:
548         * page/animation/CSSAnimationController.cpp: Renamed from Source/WebCore/page/animation/AnimationController.cpp.
549         (WebCore::AnimationPrivateUpdateBlock::AnimationPrivateUpdateBlock):
550         (WebCore::AnimationPrivateUpdateBlock::~AnimationPrivateUpdateBlock):
551         (WebCore::CSSAnimationControllerPrivate::CSSAnimationControllerPrivate):
552         (WebCore::CSSAnimationControllerPrivate::~CSSAnimationControllerPrivate):
553         (WebCore::CSSAnimationControllerPrivate::ensureCompositeAnimation):
554         (WebCore::CSSAnimationControllerPrivate::clear):
555         (WebCore::CSSAnimationControllerPrivate::updateAnimations):
556         (WebCore::CSSAnimationControllerPrivate::updateAnimationTimerForRenderer):
557         (WebCore::CSSAnimationControllerPrivate::updateAnimationTimer):
558         (WebCore::CSSAnimationControllerPrivate::updateStyleIfNeededDispatcherFired):
559         (WebCore::CSSAnimationControllerPrivate::fireEventsAndUpdateStyle):
560         (WebCore::CSSAnimationControllerPrivate::startUpdateStyleIfNeededDispatcher):
561         (WebCore::CSSAnimationControllerPrivate::addEventToDispatch):
562         (WebCore::CSSAnimationControllerPrivate::addElementChangeToDispatch):
563         (WebCore::CSSAnimationControllerPrivate::animationFrameCallbackFired):
564         (WebCore::CSSAnimationControllerPrivate::animationTimerFired):
565         (WebCore::CSSAnimationControllerPrivate::isRunningAnimationOnRenderer):
566         (WebCore::CSSAnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer):
567         (WebCore::CSSAnimationControllerPrivate::suspendAnimations):
568         (WebCore::CSSAnimationControllerPrivate::resumeAnimations):
569         (WebCore::CSSAnimationControllerPrivate::animationsAreSuspendedForDocument):
570         (WebCore::CSSAnimationControllerPrivate::detachFromDocument):
571         (WebCore::CSSAnimationControllerPrivate::suspendAnimationsForDocument):
572         (WebCore::CSSAnimationControllerPrivate::resumeAnimationsForDocument):
573         (WebCore::CSSAnimationControllerPrivate::startAnimationsIfNotSuspended):
574         (WebCore::CSSAnimationControllerPrivate::setAllowsNewAnimationsWhileSuspended):
575         (WebCore::CSSAnimationControllerPrivate::pauseAnimationAtTime):
576         (WebCore::CSSAnimationControllerPrivate::pauseTransitionAtTime):
577         (WebCore::CSSAnimationControllerPrivate::beginAnimationUpdateTime):
578         (WebCore::CSSAnimationControllerPrivate::beginAnimationUpdate):
579         (WebCore::CSSAnimationControllerPrivate::endAnimationUpdate):
580         (WebCore::CSSAnimationControllerPrivate::receivedStartTimeResponse):
581         (WebCore::CSSAnimationControllerPrivate::getAnimatedStyleForRenderer):
582         (WebCore::CSSAnimationControllerPrivate::computeExtentOfAnimation):
583         (WebCore::CSSAnimationControllerPrivate::numberOfActiveAnimations):
584         (WebCore::CSSAnimationControllerPrivate::addToAnimationsWaitingForStyle):
585         (WebCore::CSSAnimationControllerPrivate::removeFromAnimationsWaitingForStyle):
586         (WebCore::CSSAnimationControllerPrivate::styleAvailable):
587         (WebCore::CSSAnimationControllerPrivate::addToAnimationsWaitingForStartTimeResponse):
588         (WebCore::CSSAnimationControllerPrivate::removeFromAnimationsWaitingForStartTimeResponse):
589         (WebCore::CSSAnimationControllerPrivate::startTimeResponse):
590         (WebCore::CSSAnimationControllerPrivate::animationWillBeRemoved):
591         (WebCore::CSSAnimationControllerPrivate::addToAnimationsDependentOnScroll):
592         (WebCore::CSSAnimationControllerPrivate::removeFromAnimationsDependentOnScroll):
593         (WebCore::CSSAnimationControllerPrivate::scrollWasUpdated):
594         (WebCore::CSSAnimationController::CSSAnimationController):
595         (WebCore::CSSAnimationController::~CSSAnimationController):
596         (WebCore::CSSAnimationController::cancelAnimations):
597         (WebCore::CSSAnimationController::updateAnimations):
598         (WebCore::CSSAnimationController::getAnimatedStyleForRenderer):
599         (WebCore::CSSAnimationController::computeExtentOfAnimation):
600         (WebCore::CSSAnimationController::notifyAnimationStarted):
601         (WebCore::CSSAnimationController::pauseAnimationAtTime):
602         (WebCore::CSSAnimationController::numberOfActiveAnimations):
603         (WebCore::CSSAnimationController::pauseTransitionAtTime):
604         (WebCore::CSSAnimationController::isRunningAnimationOnRenderer):
605         (WebCore::CSSAnimationController::isRunningAcceleratedAnimationOnRenderer):
606         (WebCore::CSSAnimationController::isSuspended):
607         (WebCore::CSSAnimationController::suspendAnimations):
608         (WebCore::CSSAnimationController::resumeAnimations):
609         (WebCore::CSSAnimationController::allowsNewAnimationsWhileSuspended):
610         (WebCore::CSSAnimationController::setAllowsNewAnimationsWhileSuspended):
611         (WebCore::CSSAnimationController::serviceAnimations):
612         (WebCore::CSSAnimationController::animationsAreSuspendedForDocument):
613         (WebCore::CSSAnimationController::detachFromDocument):
614         (WebCore::CSSAnimationController::suspendAnimationsForDocument):
615         (WebCore::CSSAnimationController::resumeAnimationsForDocument):
616         (WebCore::CSSAnimationController::startAnimationsIfNotSuspended):
617         (WebCore::CSSAnimationController::beginAnimationUpdate):
618         (WebCore::CSSAnimationController::endAnimationUpdate):
619         (WebCore::CSSAnimationController::supportsAcceleratedAnimationOfProperty):
620         (WebCore::CSSAnimationController::wantsScrollUpdates):
621         (WebCore::CSSAnimationController::scrollWasUpdated):
622         (WebCore::CSSAnimationController::hasAnimations):
623         * page/animation/CSSAnimationController.h: Renamed from Source/WebCore/page/animation/AnimationController.h.
624         (WebCore::AnimationUpdateBlock::AnimationUpdateBlock):
625         (WebCore::AnimationUpdateBlock::~AnimationUpdateBlock):
626         * page/animation/CSSAnimationControllerPrivate.h: Renamed from Source/WebCore/page/animation/AnimationControllerPrivate.h.
627         (WebCore::CSSAnimationControllerPrivate::hasAnimations):
628         (WebCore::CSSAnimationControllerPrivate::isSuspended):
629         (WebCore::CSSAnimationControllerPrivate::setBeginAnimationUpdateTime):
630         (WebCore::CSSAnimationControllerPrivate::allowsNewAnimationsWhileSuspended):
631         (WebCore::CSSAnimationControllerPrivate::wantsScrollUpdates):
632         (WebCore::CSSAnimationControllerPrivate::scrollPosition):
633         * page/animation/CSSPropertyAnimation.cpp:
634         (WebCore::CSSPropertyAnimationWrapperMap::singleton):
635         * page/animation/CompositeAnimation.cpp:
636         (WebCore::CompositeAnimation::CompositeAnimation):
637         * page/animation/CompositeAnimation.h:
638         (WebCore::CompositeAnimation::create):
639         (WebCore::CompositeAnimation::animationController):
640         * page/animation/ImplicitAnimation.cpp:
641         * page/animation/KeyframeAnimation.cpp:
642         * page/ios/FrameIOS.mm:
643         * platform/graphics/GraphicsLayer.h:
644         * rendering/RenderElement.h:
645         * rendering/RenderLayer.cpp:
646         * rendering/RenderLayerBacking.cpp:
647         * rendering/RenderLayerCompositor.cpp:
648         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation):
649         * rendering/RenderObject.cpp:
650         * rendering/RenderObject.h:
651         (WebCore::RenderObject::animation):
652         * testing/Internals.cpp:
653
654 2017-02-06  Zalan Bujtas  <zalan@apple.com>
655
656         Simple line layout: Use simplified text measuring when possible.
657         https://bugs.webkit.org/show_bug.cgi?id=167843
658         <rdar://problem/30364907>
659
660         Reviewed by Antti Koivisto.
661
662         This patch adds a simplified version of text width measuring.
663         Certain type of text runs (no spacing etc) only require a subset of what we
664         currently do in FontCascade::width().
665
666         * platform/graphics/FontCascade.cpp:
667         (WebCore::FontCascade::widthForSimpleText):
668         * platform/graphics/FontCascade.h:
669         * platform/graphics/WidthCache.h:
670         (WebCore::WidthCache::add):
671         (WebCore::WidthCache::addSlowCase):
672         * platform/graphics/WidthIterator.cpp:
673         (WebCore::WidthIterator::advanceInternal):
674         * rendering/RenderText.cpp:
675         (WebCore::RenderText::styleDidChange):
676         (WebCore::RenderText::setRenderedText):
677         (WebCore::RenderText::computeCanUseSimplifiedTextMeasuring):
678         * rendering/RenderText.h:
679         (WebCore::RenderText::canUseSimplifiedTextMeasuring):
680         * rendering/SimpleLineLayoutFlowContents.cpp:
681         (WebCore::SimpleLineLayout::initializeSegments):
682         * rendering/SimpleLineLayoutFlowContents.h:
683         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
684         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
685         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragmentIterator):
686         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
687         * rendering/SimpleLineLayoutTextFragmentIterator.h:
688
689 2017-02-06  Carlos Garcia Campos  <cgarcia@igalia.com>
690
691         Resource usage overlay should ignore mouse events outside bounds by default
692         https://bugs.webkit.org/show_bug.cgi?id=167874
693
694         Reviewed by Andreas Kling.
695
696         It's overriding the default causing that the first click after the overlay is shown is always handled by the
697         overlay even when clicked outside bounds. It should only be set false while dragging.
698
699         * page/ResourceUsageOverlay.cpp:
700         (WebCore::ResourceUsageOverlay::initialize):
701
702 2017-02-06  Antti Koivisto  <antti@apple.com>
703
704         CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::Node::invalidateStyle
705         https://bugs.webkit.org/show_bug.cgi?id=167878
706         rdar://problem/30251840
707
708         Reviewed by Andreas Kling.
709
710         Speculative fix.
711
712         We are trying to invalidate a null node from ~PostResolutionCallbackDisabler. Looks like the only way
713         this could happen is if HTMLFrameOwnerElement::scheduleinvalidateStyleAndLayerComposition is called
714         with null 'this'. There is one place where this might happen.
715
716         * rendering/RenderLayerCompositor.cpp:
717         (WebCore::RenderLayerCompositor::attachRootLayer): Add null check.
718
719 2017-02-06  Ryan Haddad  <ryanhaddad@apple.com>
720
721         Unreviewed, rolling out r211722.
722
723         This change introduced a LayoutTest failure on mac-wk2.
724
725         Reverted changeset:
726
727         "[Modern Media Controls] Improve handling of <video> with only
728         audio tracks"
729         https://bugs.webkit.org/show_bug.cgi?id=167836
730         http://trac.webkit.org/changeset/211722
731
732 2017-02-06  Eric Carlson  <eric.carlson@apple.com>
733
734         [MediaStream Mac] Stop using AVSampleBufferAudioRenderer
735         https://bugs.webkit.org/show_bug.cgi?id=167821
736
737         Reviewed by Jer Noble.
738
739         * WebCore.xcodeproj/project.pbxproj: Add new files.
740
741         * platform/audio/mac/AudioSampleDataSource.cpp:
742         (WebCore::AudioSampleDataSource::pullSamplesInternal): Don't assume the first timestamp from the
743         render proc after a pause is zero.
744
745         Stop using an audio renderer for each audio track. No audio renderers means we don't need to use
746         an AVSampleBufferRenderSynchronizer.
747         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
748         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
749         (-[WebAVSampleBufferStatusChangeListener invalidate]): No more audio renderers.
750         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]): Ditto.
751         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Ditto.
752         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC): Pause
753           audio tracks explicitly.
754         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSourceProvider): Remove the existing code,
755           it was incorrect and not thread safe.
756         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::flushRenderers): No more audio renderers.
757         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): No more render synchronizer.
758         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Ditto.
759         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): Start each audio track.
760         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): Pause each audio track.
761         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume): Pass the command to each audio track.
762         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted): Ditto.
763         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::streamTime): No more render synchronizer.
764         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated): Don't handle audio samples.
765         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks): Update for audio track class change. No
766         more render synchronizer.
767         (-[WebAVSampleBufferStatusChangeListener beginObservingRenderer:]): Deleted.
768         (-[WebAVSampleBufferStatusChangeListener stopObservingRenderer:]): Deleted.
769         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSample): Deleted.
770         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForAudioData): Deleted.
771         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::createAudioRenderer): Deleted.
772         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyAudioRenderer): Deleted.
773         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyAudioRenderers): Deleted.
774         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rendererStatusDidChange): Deleted.
775
776         * platform/mediastream/AudioTrackPrivateMediaStream.h:
777
778         * platform/mediastream/MediaStreamTrackPrivate.cpp:
779         (WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate): add/removeObserver takes a reference,
780         not a pointer.
781         (WebCore::MediaStreamTrackPrivate::~MediaStreamTrackPrivate): Ditto.
782         (WebCore::MediaStreamTrackPrivate::videoSampleAvailable): Renamed from sourceHasMoreMediaData.
783         (WebCore::MediaStreamTrackPrivate::sourceHasMoreMediaData): Deleted.
784         * platform/mediastream/MediaStreamTrackPrivate.h:
785
786         * platform/mediastream/RealtimeMediaSource.cpp:
787         (WebCore::RealtimeMediaSource::addObserver): Take a reference, not a pointer.
788         (WebCore::RealtimeMediaSource::removeObserver): Ditto.
789         (WebCore::RealtimeMediaSource::videoSampleAvailable): Renamed from mediaDataUpdated.
790         (WebCore::RealtimeMediaSource::audioSamplesAvailable): New.
791         (WebCore::RealtimeMediaSource::stop): Drive-by cleanup.
792         (WebCore::RealtimeMediaSource::requestStop): Ditto.
793         (WebCore::RealtimeMediaSource::mediaDataUpdated): Deleted.
794         * platform/mediastream/RealtimeMediaSource.h:
795
796         * platform/mediastream/mac/AVAudioCaptureSource.h:
797         * platform/mediastream/mac/AVAudioCaptureSource.mm:
798         (WebCore::AVAudioCaptureSource::AVAudioCaptureSource):
799         (WebCore::AVAudioCaptureSource::addObserver):
800         (WebCore::AVAudioCaptureSource::shutdownCaptureSession):
801         (WebCore::AVAudioCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
802         (WebCore::operator==): Deleted.
803         (WebCore::operator!=): Deleted.
804
805         * platform/mediastream/mac/AVVideoCaptureSource.mm:
806         (WebCore::AVVideoCaptureSource::processNewFrame): Call videoSampleAvailable, not mediaDataUpdated.
807
808         Render audio with a CoreAudio output unit.
809         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp: Added.
810         (WebCore::AudioTrackPrivateMediaStreamCocoa::AudioTrackPrivateMediaStreamCocoa):
811         (WebCore::AudioTrackPrivateMediaStreamCocoa::~AudioTrackPrivateMediaStreamCocoa):
812         (WebCore::AudioTrackPrivateMediaStreamCocoa::playInternal):
813         (WebCore::AudioTrackPrivateMediaStreamCocoa::play):
814         (WebCore::AudioTrackPrivateMediaStreamCocoa::pause):
815         (WebCore::AudioTrackPrivateMediaStreamCocoa::setVolume):
816         (WebCore::AudioTrackPrivateMediaStreamCocoa::setupAudioUnit):
817         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
818         (WebCore::AudioTrackPrivateMediaStreamCocoa::sourceStopped):
819         (WebCore::AudioTrackPrivateMediaStreamCocoa::render):
820         (WebCore::AudioTrackPrivateMediaStreamCocoa::inputProc):
821         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h: Added.
822
823         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
824         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
825         (WebCore::alignTo16Bytes):
826         (WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers):
827         (WebCore::MockRealtimeAudioSourceMac::reconfigure): Minor cleanup.
828         (WebCore::MockRealtimeAudioSourceMac::render): Ditto.
829
830         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
831         (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer): Call videoSampleAvailable, not mediaDataUpdated.
832
833         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
834         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
835         (WebCore::WebAudioSourceProviderAVFObjC::~WebAudioSourceProviderAVFObjC):
836         (WebCore::WebAudioSourceProviderAVFObjC::provideInput): Use a mutex. Get rid of m_writeAheadCount,
837         it is always 0.
838         (WebCore::WebAudioSourceProviderAVFObjC::prepare): Use a lock.
839         (WebCore::WebAudioSourceProviderAVFObjC::unprepare): Ditto.
840         (WebCore::WebAudioSourceProviderAVFObjC::process): Ditto.
841         * platform/mock/MockRealtimeAudioSource.h:
842         (WebCore::MockRealtimeAudioSource::renderInterval): Decrease the render interval.
843
844 2017-02-06  Antoine Quint  <graouts@apple.com>
845
846         [Modern Media Controls] Add a backdrop filter to the start button on macOS
847         https://bugs.webkit.org/show_bug.cgi?id=167879
848         <rdar://problem/30375174>
849
850         Reviewed by Eric Carlson.
851
852         Add a backdrop filter to the start button on macOS.
853
854         Test: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-start-button-style.html
855
856         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
857         (.media-controls.mac.inline > button.start > div):
858
859 2017-02-06  Antoine Quint  <graouts@apple.com>
860
861         [Modern Media Controls] Bring fullscreen controls up to spec
862         https://bugs.webkit.org/show_bug.cgi?id=167875
863         <rdar://problem/29611222>
864
865         Reviewed by Eric Carlson.
866
867         We update the fullscreen PiP icon to have the correct size and add two new buttons
868         around the volume slider, "volume-down" to bring the volume to 0 and "volume-up"
869         to bring the volume to 1.
870
871         To accomodate the new volume buttons, we move the volume slider inside an additional
872         ButtonsContainer object, along with the two new buttons.
873
874         Tests: media/modern-media-controls/volume-down-support/volume-down-support.html
875                media/modern-media-controls/volume-up-support/volume-up-support.html
876
877         * Modules/modern-media-controls/controls/icon-service.js:
878         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
879         (.media-controls.mac.fullscreen button.volume-down):
880         (.media-controls.mac.fullscreen button.volume-up):
881         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
882         * Modules/modern-media-controls/controls/volume-down-button.js: Added.
883         (VolumeDownButton):
884         * Modules/modern-media-controls/controls/volume-slider.js:
885         (VolumeSlider):
886         * Modules/modern-media-controls/controls/volume-up-button.js: Added.
887         (VolumeUpButton):
888         * Modules/modern-media-controls/images/macOS/pip-in-fullscreen@1x.png:
889         * Modules/modern-media-controls/images/macOS/pip-in-fullscreen@2x.png:
890         * Modules/modern-media-controls/images/macOS/volume-down-fullscreen@1x.png: Added.
891         * Modules/modern-media-controls/images/macOS/volume-down-fullscreen@2x.png: Added.
892         * Modules/modern-media-controls/images/macOS/volume-up-fullscreen@1x.png: Added.
893         * Modules/modern-media-controls/images/macOS/volume-up-fullscreen@2x.png: Added.
894         * Modules/modern-media-controls/js-files:
895         * Modules/modern-media-controls/media/media-controller.js:
896         (MediaController.prototype._updateControlsIfNeeded):
897         * Modules/modern-media-controls/media/volume-down-support.js: Added.
898         (VolumeDownSupport.prototype.get control):
899         (VolumeDownSupport.prototype.buttonWasPressed):
900         (VolumeDownSupport):
901         * Modules/modern-media-controls/media/volume-up-support.js: Added.
902         (VolumeUpSupport.prototype.get control):
903         (VolumeUpSupport.prototype.buttonWasPressed):
904         (VolumeUpSupport):
905         * WebCore.xcodeproj/project.pbxproj:
906
907 2017-02-06  Antoine Quint  <graouts@apple.com>
908
909         [Modern Media Controls] Improve handling of <video> with only audio tracks
910         https://bugs.webkit.org/show_bug.cgi?id=167836
911         <rdar://problem/30255812>
912
913         Reviewed by Dean Jackson.
914
915         We now check for the availability of video tracks before considering a <video>
916         element is displaying an actual video file and turning auto-hide on. We also
917         check that we have video tracks before enabling the fullscreen button. This
918         brings the behavior of a <video> pointing to a resource with no video tracks
919         to be the same as an <audio> element.
920
921         Test: media/modern-media-controls/media-controller/media-controller-video-with-only-audio.html
922
923         * Modules/modern-media-controls/media/controls-visibility-support.js:
924         (ControlsVisibilitySupport.prototype.get tracksToMonitor):
925         (ControlsVisibilitySupport.prototype._updateControls):
926         (ControlsVisibilitySupport):
927         * Modules/modern-media-controls/media/fullscreen-support.js:
928         (FullscreenSupport.prototype.syncControl):
929         (FullscreenSupport):
930
931 2017-02-06  Alex Christensen  <achristensen@webkit.org>
932
933         Fix WinCairo build after r211681
934         https://bugs.webkit.org/show_bug.cgi?id=167096
935
936         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
937         Include some necessary GLES headers.
938
939 2017-02-05  Wenson Hsieh  <wenson_hsieh@apple.com>
940
941         Data interaction fails in Safari splitscreen mode when dropping into a contenteditable
942         https://bugs.webkit.org/show_bug.cgi?id=167862
943         <rdar://problem/30368405>
944
945         Reviewed by Tim Horton.
946
947         Adds a counter to WebItemProviderPasteboard that can incremented, decremented, and queried by clients.
948
949         * platform/ios/WebItemProviderPasteboard.h:
950         * platform/ios/WebItemProviderPasteboard.mm:
951         (-[WebItemProviderPasteboard init]):
952         (-[WebItemProviderPasteboard hasPendingOperation]):
953         (-[WebItemProviderPasteboard incrementPendingOperationCount]):
954         (-[WebItemProviderPasteboard decrementPendingOperationCount]):
955
956 2017-02-05  Simon Fraser  <simon.fraser@apple.com>
957
958         Remove unparentsOffscreenTiles logic in TileController
959         https://bugs.webkit.org/show_bug.cgi?id=167823
960
961         Reviewed by Tim Horton.
962
963         Give all TileGrids the "unparents offscreen tiles" behavior. This was enabled for
964         only the page tiles in WK2 on Mac and iOS, but there's no reason to not use it for
965         tiled composited layers also.
966
967         Also use more modern C++ idioms in a few places.
968
969         * platform/graphics/TiledBacking.h:
970         * platform/graphics/ca/TileController.h:
971         * platform/graphics/ca/TileGrid.cpp:
972         (WebCore::TileGrid::revalidateTiles):
973         (WebCore::TileGrid::ensureTilesForRect):
974         * rendering/RenderLayerBacking.cpp:
975         (WebCore::RenderLayerBacking::RenderLayerBacking):
976
977 2017-02-05  Antoine Quint  <graouts@apple.com>
978
979         [Modern Media Controls] PiP button is not visible with a live broadcast video
980         https://bugs.webkit.org/show_bug.cgi?id=167794
981         <rdar://problem/30348790>
982
983         Reviewed by Dean Jackson.
984
985         We were only listening to the "loadedmetadata", "error", "webkitpresentationmodechanged"
986         and "webkitcurrentplaybacktargetiswirelesschanged" events to invalidate the enabled state
987         for the PiP button. We also need to check availability of video tracks, which we already
988         did for fullscreen, which is quite similar.
989         
990         So we now listen to "addtrack", "removetrack" and "change" events on the media.videoTracks
991         property, which correctly invalidates the PiP button when the first video track becomes
992         available or the last video track is removed.
993
994         Since a couple of other MediaControllerSupport subclasses (FullscreenSupport and TracksSupport)
995         would also listen to those events on various track types, we add a new "tracksToMonitor"
996         property on MediaControllerSupport which subclasses can override to provide a list of tracks
997         that should listen to those events. This removes the need for dedicated construction and
998         destruction time in MediaControllerSupport subclasses that need to listen to events on
999         tracks rather than the media itself.
1000
1001         Test: http/tests/media/modern-media-controls/pip-support/pip-support-live-broadcast.html
1002
1003         * Modules/modern-media-controls/media/fullscreen-support.js:
1004         (FullscreenSupport):
1005         (FullscreenSupport.prototype.get tracksToMonitor):
1006         (FullscreenSupport.prototype.destroy): Deleted.
1007         * Modules/modern-media-controls/media/media-controller-support.js:
1008         (MediaControllerSupport):
1009         (MediaControllerSupport.prototype.destroy):
1010         (MediaControllerSupport.prototype.get tracksToMonitor):
1011         * Modules/modern-media-controls/media/pip-support.js:
1012         (PiPSupport.prototype.get tracksToMonitor):
1013         * Modules/modern-media-controls/media/tracks-support.js:
1014         (TracksSupport):
1015         (TracksSupport.prototype.get tracksToMonitor):
1016         (TracksSupport.prototype.destroy): Deleted.
1017
1018 2017-02-05  Antoine Quint  <graouts@apple.com>
1019
1020         [Modern Media Controls] Time labels may wrap instead of displaying on a single line
1021         https://bugs.webkit.org/show_bug.cgi?id=167835
1022         <rdar://problem/30340534>
1023
1024         Reviewed by Dean Jackson.
1025
1026         No text in modern media controls is expected to wrap, so let's prevent any wrapping.
1027
1028         Test: media/modern-media-controls/time-label/time-label-white-space-nowrap.html
1029
1030         * Modules/modern-media-controls/controls/media-controls.css:
1031         (.media-controls):
1032
1033 2017-02-04  Simon Fraser  <simon.fraser@apple.com>
1034
1035         Clean up how GraphicsLayer's "inWindow" state is set, and fix some issues with Page Overlays
1036         https://bugs.webkit.org/show_bug.cgi?id=167850
1037
1038         Reviewed by Tim Horton.
1039         
1040         RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants() walked the RenderLayer
1041         tree to set the GraphicsLayer's "inWindow" state. This had the problem of skipping non-primary
1042         GraphicsLayers. We also never did this work for page overlay layers.
1043
1044         Fix by giving GraphicsLayers a recursive function that sets the inWindow state, and call that
1045         from RenderLayerCompositor::setIsInWindow() and PageOverlayController.
1046
1047         PageOverlayController also needs to implement tiledBackingUsageChanged so that tiled backings
1048         created dynamically get the correct in-window state.
1049
1050         Page overlays also had some serious issues in MiniBrowser, in that they disappeared on reload,
1051         and on hide/show web view. This was because the overlay root layers were re-parented, but
1052         addChild() for each overlay's layer wasn't called. Clean up by replacing willAttachRootLayer() followed
1053         by viewOverlayRootLayer()/documentOverlayRootLayer() with single calls that set up the layers,
1054         update the inWindow state, and return the layer.
1055
1056         Make it possible to dump tile caches in page overlay tests.
1057
1058         Make showGraphicsLayers() always dump page overlay layers (source of much confusion).
1059
1060         Test: pageoverlay/overlay-remove-reinsert-view.html
1061
1062         * page/PageOverlayController.cpp:
1063         (WebCore::PageOverlayController::documentOverlayRootLayer):
1064         (WebCore::PageOverlayController::viewOverlayRootLayer):
1065         (WebCore::PageOverlayController::layerWithDocumentOverlays):
1066         (WebCore::PageOverlayController::layerWithViewOverlays):
1067         (WebCore::PageOverlayController::tiledBackingUsageChanged):
1068         (WebCore::PageOverlayController::willAttachRootLayer): Deleted.
1069         * page/PageOverlayController.h:
1070         * platform/graphics/GraphicsLayer.cpp:
1071         (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants):
1072         (WebCore::dumpChildren):
1073         * platform/graphics/GraphicsLayer.h:
1074         * rendering/RenderLayerCompositor.cpp:
1075         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
1076         (WebCore::RenderLayerCompositor::setIsInWindow):
1077         (WebCore::RenderLayerCompositor::attachRootLayer):
1078         (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
1079         (WebCore::RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants): Deleted.
1080         * rendering/RenderLayerCompositor.h:
1081         * testing/Internals.cpp:
1082         (WebCore::toLayerTreeFlags):
1083         (WebCore::Internals::layerTreeAsText):
1084         (WebCore::Internals::pageOverlayLayerTreeAsText):
1085         * testing/Internals.h:
1086         * testing/Internals.idl:
1087         * testing/MockPageOverlayClient.cpp:
1088         (WebCore::MockPageOverlayClient::layerTreeAsText):
1089         * testing/MockPageOverlayClient.h:
1090
1091 2017-02-05  Zalan Bujtas  <zalan@apple.com>
1092
1093         Simple line layout: Use RenderText::canUseSimpleFontCodePath() only as a hint.
1094         https://bugs.webkit.org/show_bug.cgi?id=167853
1095         <rdar://problem/30367302>
1096
1097         Reviewed by Simon Fraser.
1098
1099         Apparently RenderText::canUseSimpleFontCodePath() only checks if the string is qualified for
1100         the simple font code path. However certain css properties could still force us to use the complex
1101         path.
1102         In most cases, we still do only one string traversal thanks to TextRun::setCharacterScanForCodePath(). 
1103
1104         Test: fast/text/simple-line-layout-simple-text-but-complex-font-path.html
1105
1106         * rendering/SimpleLineLayout.cpp:
1107         (WebCore::SimpleLineLayout::canUseForFontAndText):
1108
1109 2017-02-05  Zan Dobersek  <zdobersek@igalia.com>
1110
1111         Move TextureMapper-specific logic out of GraphicsContext3DPrivate
1112         https://bugs.webkit.org/show_bug.cgi?id=167096
1113
1114         Reviewed by Alex Christensen.
1115
1116         Move the TextureMapper-specific functionality in GraphicsContext3DPrivate into a
1117         separate class. The new TextureMapperGC3DPlatformLayer class inherits from the
1118         class that's aliased to the PlatformLayer type, like GraphicsContext3DPrivate did
1119         before.
1120
1121         In GraphicsContext3D, the new m_texmapLayer member variable of the
1122         std::unique_ptr<TextureMapperGC3DPlatformLayer> type is used for configurations
1123         that enable TextureMapper, largely the same way the GraphicsContext3DPrivate
1124         object was used before. The remaining code in GraphicsContext3DPrivate is left
1125         unchanged to keep it working for other ports.
1126
1127         No new tests -- no change in behavior.
1128
1129         * platform/TextureMapper.cmake:
1130         * platform/graphics/GraphicsContext3D.h:
1131         * platform/graphics/GraphicsContext3DPrivate.cpp:
1132         (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
1133         (WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate): Deleted.
1134         (WebCore::GraphicsContext3DPrivate::proxy): Deleted.
1135         (WebCore::GraphicsContext3DPrivate::swapBuffersIfNeeded): Deleted.
1136         (WebCore::GraphicsContext3DPrivate::paintToTextureMapper): Deleted.
1137         * platform/graphics/GraphicsContext3DPrivate.h:
1138         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
1139         (WebCore::GraphicsContext3D::GraphicsContext3D):
1140         (WebCore::GraphicsContext3D::~GraphicsContext3D):
1141         (WebCore::GraphicsContext3D::makeContextCurrent):
1142         (WebCore::GraphicsContext3D::platformGraphicsContext3D):
1143         (WebCore::GraphicsContext3D::platformLayer):
1144         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1145         (WebCore::GraphicsContext3D::createForCurrentGLContext):
1146         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp: Copied from Source/WebCore/platform/graphics/GraphicsContext3DPrivate.cpp.
1147         (WebCore::TextureMapperGC3DPlatformLayer::TextureMapperGC3DPlatformLayer):
1148         (WebCore::TextureMapperGC3DPlatformLayer::~TextureMapperGC3DPlatformLayer):
1149         (WebCore::TextureMapperGC3DPlatformLayer::makeContextCurrent):
1150         (WebCore::TextureMapperGC3DPlatformLayer::platformContext):
1151         (WebCore::TextureMapperGC3DPlatformLayer::proxy):
1152         (WebCore::TextureMapperGC3DPlatformLayer::swapBuffersIfNeeded):
1153         (WebCore::TextureMapperGC3DPlatformLayer::paintToTextureMapper):
1154         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h: Copied from Source/WebCore/platform/graphics/GraphicsContext3DPrivate.h.
1155         (WebCore::TextureMapperGC3DPlatformLayer::renderStyle):
1156
1157 2017-02-05  Zalan Bujtas  <zalan@apple.com>
1158
1159         Simple line layout: Bail out from Simple Line Layout on surrogate pairs.
1160         https://bugs.webkit.org/show_bug.cgi?id=167840
1161         <rdar://problem/30364784>
1162
1163         Reviewed by Myles C. Maxfield.
1164
1165         Surrogate pairs require special line breaking logic. 
1166
1167         Test: fast/text/simple-line-layout-no-surrogate-pairs.html
1168
1169         * rendering/SimpleLineLayout.cpp:
1170         (WebCore::SimpleLineLayout::canUseForCharacter):
1171         (WebCore::SimpleLineLayout::canUseForText): Checking against special characters is faster than
1172         checking against glyphs. Reverse their order. 
1173         (WebCore::SimpleLineLayout::printReason):
1174
1175 2017-02-04  Joseph Pecoraro  <pecoraro@apple.com>
1176
1177         Static Analyzer: WebCoreNSURLExtras.mm: Potential leak of memory pointed to by 'allBytesBuffer'
1178         https://bugs.webkit.org/show_bug.cgi?id=167849
1179
1180         Reviewed by Sam Weinig.
1181
1182         Source/WebCore/platform/mac/WebCoreNSURLExtras.mm:883:20: warning: Potential leak of memory pointed to by 'allBytesBuffer'
1183                     return nil;
1184                            ^~~
1185
1186         * platform/mac/WebCoreNSURLExtras.mm:
1187         (WebCore::dataForURLComponentType):
1188         Free the potentially malloc'd buffer before the early return.
1189
1190 2017-02-04  Chris Dumez  <cdumez@apple.com>
1191
1192         Unreviewed, fix mistake in comment added in r211569.
1193
1194         * history/PageCache.cpp:
1195         (WebCore::PageCache::removeAllItemsForPage):
1196
1197 2017-02-04  Yoav Weiss  <yoav@yoav.ws>
1198
1199         Fix memory issues related to preload eviction.
1200         https://bugs.webkit.org/show_bug.cgi?id=167838
1201
1202         Reviewed by Andreas Kling.
1203
1204         This avoids removing resources from m_preloads during the iteration
1205         by creating a second HashSetList containing the remaining link preloads.
1206
1207         No new tests but this will fix crashes on the leak bots.
1208
1209         * loader/cache/CachedResourceLoader.cpp:
1210         (WebCore::CachedResourceLoader::clearPreloads):
1211
1212 2017-02-04  Zalan Bujtas  <zalan@apple.com>
1213
1214         Simple line layout: Skip 16bit specific checks on 8bit content.
1215         https://bugs.webkit.org/show_bug.cgi?id=167831
1216         <rdar://problem/30361948>
1217
1218         Reviewed by Antti Koivisto and Myles C. Maxfield.
1219
1220         Skip various checks on 8bit content.
1221
1222         Covered by existing tests.
1223
1224         * rendering/SimpleLineLayout.cpp:
1225         (WebCore::SimpleLineLayout::canUseForCharacter):
1226         (WebCore::SimpleLineLayout::canUseForText):
1227         (WebCore::SimpleLineLayout::canUseForFontAndText):
1228
1229 2017-02-03  Zalan Bujtas  <zalan@apple.com>
1230
1231         Simple line layout: Remove redundant codepath check.
1232         https://bugs.webkit.org/show_bug.cgi?id=167827
1233         <rdar://problem/30361850>
1234
1235         Reviewed by Myles C. Maxfield.
1236
1237         FontCascade::codePath() iterates through the entire text. It's rather wasteful to do twice.
1238
1239         No change in functionality.
1240
1241         * rendering/SimpleLineLayout.cpp:
1242         (WebCore::SimpleLineLayout::canUseForFontAndText):
1243         (WebCore::SimpleLineLayout::printReason):
1244
1245 2017-02-03  Myles C. Maxfield  <mmaxfield@apple.com>
1246
1247         REGRESSION(r204858): Synthetic bold text in vertical writing mode is rotated away from original text
1248         https://bugs.webkit.org/show_bug.cgi?id=167826
1249         <rdar://problem/28193222>
1250
1251         Reviewed by Zalan Bujtas.
1252
1253         When drawing vertical text, the rotation is not reset between successive paint calls. We implement
1254         synthetic bold by drawing text twice, which means that the second draw call was getting rotated
1255         twice. This was an oversight in r204858.
1256
1257         Test: fast/text/synthetic-bold-vertical-text.html
1258
1259         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1260         (WebCore::showGlyphsWithAdvances):
1261
1262 2017-02-03  Joseph Pecoraro  <pecoraro@apple.com>
1263
1264         Performance Timing: Convert WTF::MonotonicTime and WTF::Seconds
1265         https://bugs.webkit.org/show_bug.cgi?id=167768
1266
1267         Reviewed by Geoffrey Garen.
1268
1269         The public APIs still return double (DOMHighResTimeStamp), which
1270         is milliseconds since a time origin:
1271         https://w3c.github.io/hr-time/#dom-domhighrestimestamp
1272
1273         * loader/LoadTiming.cpp:
1274         (WebCore::LoadTiming::secondsSinceStartTime):
1275         (WebCore::LoadTiming::monotonicTimeToPseudoWallTime):
1276         (WebCore::LoadTiming::markStartTime):
1277         (WebCore::LoadTiming::addRedirect):
1278         (WebCore::LoadTiming::monotonicTimeToZeroBasedDocumentTime): Deleted.
1279         * loader/LoadTiming.h:
1280         (WebCore::LoadTiming::markUnloadEventStart):
1281         (WebCore::LoadTiming::markUnloadEventEnd):
1282         (WebCore::LoadTiming::markRedirectStart):
1283         (WebCore::LoadTiming::markRedirectEnd):
1284         (WebCore::LoadTiming::markFetchStart):
1285         (WebCore::LoadTiming::setResponseEnd):
1286         (WebCore::LoadTiming::markLoadEventStart):
1287         (WebCore::LoadTiming::markLoadEventEnd):
1288         (WebCore::LoadTiming::startTime):
1289         (WebCore::LoadTiming::unloadEventStart):
1290         (WebCore::LoadTiming::unloadEventEnd):
1291         (WebCore::LoadTiming::redirectStart):
1292         (WebCore::LoadTiming::redirectEnd):
1293         (WebCore::LoadTiming::fetchStart):
1294         (WebCore::LoadTiming::responseEnd):
1295         (WebCore::LoadTiming::loadEventStart):
1296         (WebCore::LoadTiming::loadEventEnd):
1297         (WebCore::LoadTiming::redirectCount):
1298         (WebCore::LoadTiming::referenceMonotonicTime):
1299         (WebCore::LoadTiming::referenceWallTime):
1300         Use MonotonicTime and WallTime for timestamps and references.
1301
1302         * dom/Document.cpp:
1303         (WebCore::Document::setReadyState):
1304         (WebCore::Document::finishedParsing):
1305         (WebCore::Document::monotonicTimestamp):
1306         * dom/DocumentTiming.h:
1307         (WebCore::DocumentTiming::DocumentTiming): Deleted.
1308         * dom/ScriptedAnimationController.cpp:
1309         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
1310         * inspector/InspectorNetworkAgent.cpp:
1311         (WebCore::InspectorNetworkAgent::buildObjectForTiming):
1312         (WebCore::InspectorNetworkAgent::didFinishLoading):
1313         * loader/DocumentLoader.cpp:
1314         (WebCore::DocumentLoader::finishedLoading):
1315         (WebCore::DocumentLoader::dataReceived):
1316         * loader/DocumentLoader.h:
1317         * loader/SubresourceLoader.cpp:
1318         (WebCore::SubresourceLoader::didFinishLoading):
1319         * loader/cache/CachedResourceLoader.cpp:
1320         (WebCore::CachedResourceLoader::requestResource):
1321         * page/DOMWindow.cpp:
1322         (WebCore::DOMWindow::performance):
1323         Use new types instead of raw doubles.
1324
1325         * page/Performance.cpp:
1326         (WebCore::Performance::Performance):
1327         (WebCore::Performance::now):
1328         (WebCore::Performance::reduceTimeResolution):
1329         (WebCore::Performance::addResourceTiming):
1330         * page/Performance.h:
1331         Do time arithmatic with WTF::Time classes.
1332         This clarifies that we reduce our timestamps to 100us
1333         resolution instead of the maximum 5us allowed by the spec.
1334
1335         * page/PerformanceResourceTiming.cpp:
1336         (WebCore::monotonicTimeToDOMHighResTimeStamp):
1337         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
1338         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
1339         * page/PerformanceResourceTiming.h:
1340         * page/PerformanceTiming.cpp:
1341         (WebCore::PerformanceTiming::resourceLoadTimeRelativeToFetchStart):
1342         (WebCore::PerformanceTiming::monotonicTimeToIntegerMilliseconds):
1343         (WebCore::toIntegerMilliseconds): Deleted.
1344         * page/PerformanceTiming.h:
1345         Do time arithmatic with WTF::Time classes.
1346
1347         * workers/DedicatedWorkerGlobalScope.cpp:
1348         (WebCore::DedicatedWorkerGlobalScope::create):
1349         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
1350         * workers/DedicatedWorkerGlobalScope.h:
1351         * workers/DedicatedWorkerThread.cpp:
1352         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
1353         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
1354         * workers/DedicatedWorkerThread.h:
1355         * workers/WorkerGlobalScope.cpp:
1356         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
1357         * workers/WorkerGlobalScope.h:
1358         * workers/WorkerGlobalScopeProxy.h:
1359         * workers/WorkerMessagingProxy.cpp:
1360         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
1361         * workers/WorkerMessagingProxy.h:
1362         * workers/WorkerThread.cpp:
1363         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
1364         (WebCore::WorkerThread::WorkerThread):
1365         * workers/WorkerThread.h:
1366         Pass time origin as MonotonicTime.
1367
1368         * workers/Worker.cpp:
1369         (WebCore::Worker::create):
1370         (WebCore::Worker::notifyFinished):
1371         * workers/Worker.h:
1372         Rename creation timestamp member. This matches Document's m_documentCreationTime.
1373
1374 2017-02-03  Jeremy Jones  <jeremyj@apple.com>
1375
1376         WK1 mouse events are missing movementX and movementY for pointerlock.
1377         https://bugs.webkit.org/show_bug.cgi?id=167775
1378         rdar://problem/30343810
1379
1380         Reviewed by Alexey Proskuryakov.
1381
1382         pointer-lock/mouse-event-delivery.html
1383
1384         Improve mouse-event-delivery.html test to mouse move and check for valid movementX and movementY.
1385         
1386         * platform/mac/PlatformEventFactoryMac.mm:
1387         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder): WK1 plumb throuhg movementX and movementY
1388
1389 2017-02-03  Simon Fraser  <simon.fraser@apple.com>
1390
1391         Correctly set the "inWindow" flag for TileControllers that aren't the page tiles, and clarify "usingTiledBacking" logic
1392         https://bugs.webkit.org/show_bug.cgi?id=167774
1393
1394         Reviewed by Tim Horton.
1395
1396         RenderLayerBacking had some very confusing "usingTiledCacheLayer" uses.
1397
1398         Its member variable, m_usingTiledCacheLayer, really meant "m_isMainFrameLayerWithTiledBacking" so make it so.
1399         It had a usingTiledBacking(), which returned the same thing, which this patch replaces with isMainFrameLayerWithTiledBacking().
1400
1401         The fact that usingTiledBacking() was only true for the page tiled layer tripped up
1402         RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants(), which would only ever call setIsInWindow()
1403         on the page tiled layer. These changes fix that.
1404
1405         Also make a way for tests to unparent the web view via UIScriptController, and dump out the "in window"
1406         status of TileBackings when dumping tile caches.
1407
1408         Test: tiled-drawing/tiled-backing-in-window.html
1409
1410         * platform/graphics/TiledBacking.h:
1411         * platform/graphics/ca/GraphicsLayerCA.cpp:
1412         (WebCore::GraphicsLayerCA::dumpAdditionalProperties):
1413         * platform/graphics/ca/TileController.h:
1414         * rendering/RenderLayerBacking.cpp:
1415         (WebCore::RenderLayerBacking::RenderLayerBacking):
1416         (WebCore::computePageTiledBackingCoverage):
1417         (WebCore::RenderLayerBacking::adjustTiledBackingCoverage):
1418         (WebCore::RenderLayerBacking::setTiledBackingHasMargins):
1419         (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
1420         (WebCore::RenderLayerBacking::shouldClipCompositedBounds):
1421         (WebCore::RenderLayerBacking::updateDescendantClippingLayer):
1422         (WebCore::RenderLayerBacking::updateRootLayerConfiguration):
1423         (WebCore::RenderLayerBacking::paintsIntoWindow):
1424         (WebCore::computeTileCoverage): Deleted.
1425         * rendering/RenderLayerBacking.h:
1426         * rendering/RenderLayerCompositor.cpp:
1427         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
1428         (WebCore::RenderLayerCompositor::rootFixedBackgroundsChanged):
1429         (WebCore::RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants):
1430         (WebCore::RenderLayerCompositor::supportsFixedRootBackgroundCompositing):
1431         (WebCore::RenderLayerCompositor::documentUsesTiledBacking):
1432
1433 2017-02-03  Zalan Bujtas  <zalan@apple.com>
1434
1435         Simple line layout: Bail out from Simple Line Layout when the primary font is insufficient.
1436         https://bugs.webkit.org/show_bug.cgi?id=167820
1437         <rdar://problem/30359685>
1438
1439         Reviewed by Myles C. Maxfield.
1440
1441         Currently simple line layout requires the primary font to have all the glyps for the content.
1442
1443         Test: fast/text/simple-line-layout-do-not-support-unicode-range.html
1444
1445         * rendering/SimpleLineLayout.cpp:
1446         (WebCore::SimpleLineLayout::canUseForText):
1447         (WebCore::SimpleLineLayout::canUseForFontAndText):
1448         (WebCore::SimpleLineLayout::printReason):
1449
1450 2017-02-03  Jer Noble  <jer.noble@apple.com>
1451
1452         ASSERT in HTMLMediaElement::~HTMLMediaElement
1453         https://bugs.webkit.org/show_bug.cgi?id=167818
1454
1455         Reviewed by Brent Fulgham.
1456
1457         Test: media/audio-dealloc-crash.html
1458
1459         HTMLMediaElement's MediaElementSession can nominate the HTMLMediaElement itself
1460         to become the playback controls session from inside the HTMLMediaElement destructor. Protect
1461         against this by clearing out the session before calling updatePlaybackControlsManager().
1462
1463         * html/HTMLMediaElement.cpp:
1464         (WebCore::HTMLMediaElement::~HTMLMediaElement):
1465
1466 2017-02-03  Daniel Bates  <dabates@apple.com>
1467
1468         [Mac][WK2] Add SPI to override the Content Security Policy of a page
1469         https://bugs.webkit.org/show_bug.cgi?id=167810
1470         <rdar://problem/30102568>
1471
1472         Reviewed by Anders Carlsson.
1473
1474         * dom/Document.cpp:
1475         (WebCore::Document::initSecurityContext): Apply the embedding client's override Content Security
1476         Policy to the document if one exists.
1477         * loader/FrameLoaderClient.h: Add function overrideContentSecurityPolicy() that a FrameLoaderClient
1478         can override to provide a custom Content Security Policy for a document (defaults: null string - no policy).
1479         As its name implies, the policy returned by overrideContentSecurityPolicy() will define the Content
1480         Security Policy for the document, overriding any subsequently received Content Security Policy for
1481         the document.
1482         * page/csp/ContentSecurityPolicy.cpp:
1483         (WebCore::ContentSecurityPolicy::copyStateFrom): Only copy policies from the specified ContentSecurityPolicy
1484         object if our policy was not specified by the embedding client.
1485         (WebCore::ContentSecurityPolicy::didReceiveHeader): Set ContentSecurityPolicy::m_hasAPIPolicy to true
1486         when we receive an API policy from the embedding client (ContentSecurityPolicy::PolicyFrom::API). An
1487         API policy must be defined before a policy received from a document. Do not process a received header
1488         if we already have an API policy as the API policy overrides all other policies.
1489         * page/csp/ContentSecurityPolicy.h:
1490
1491 2017-02-03  Chris Dumez  <cdumez@apple.com>
1492
1493         Drop Mac App Store workaround for window.getComputedStyle()
1494         https://bugs.webkit.org/show_bug.cgi?id=166891
1495         <rdar://problem/28282452>
1496
1497         Reviewed by Sam Weinig.
1498
1499         Drop Mac App Store workaround for window.getComputedStyle() now that
1500         <rdar://problem/28020681> has been fixed.
1501
1502         * page/DOMWindow.cpp:
1503         * page/DOMWindow.h:
1504         * page/DOMWindow.idl:
1505         * platform/RuntimeApplicationChecks.h:
1506         * platform/RuntimeApplicationChecks.mm:
1507         (WebCore::MacApplication::isAppStore): Deleted.
1508
1509 2017-02-03  Chris Dumez  <cdumez@apple.com>
1510
1511         Dismiss HTML form validation popover when pressing Escape key
1512         https://bugs.webkit.org/show_bug.cgi?id=167716
1513         <rdar://problem/29872943>
1514
1515         Reviewed by Simon Fraser.
1516
1517         Dismiss any visible HTML form validation popover when pressing
1518         the Escape key.
1519
1520         Test: fast/forms/validation-bubble-escape-key-dismiss.html
1521
1522         * page/EventHandler.cpp:
1523         (WebCore::EventHandler::keyEvent):
1524         * page/ValidationMessageClient.h:
1525
1526 2017-02-03  Jeremy Jones  <jeremyj@apple.com>
1527
1528         Pointer lock events should be delivered directly to the target element
1529         https://bugs.webkit.org/show_bug.cgi?id=167134
1530         rdar://problem/30268004
1531
1532         Reviewed by Dean Jackson.
1533
1534         pointer-lock/mouse-event-delivery.html: Enabled for mac, added wheel event tests.
1535
1536         When pointer is locked on an element, route mouse events directly to the target element, instead of 
1537         doing the normal event disptach.
1538
1539         * page/EventHandler.cpp:
1540         (WebCore::EventHandler::handleMousePressEvent):
1541         (WebCore::EventHandler::handleMouseDoubleClickEvent):
1542         (WebCore::EventHandler::handleMouseMoveEvent):
1543         (WebCore::EventHandler::handleMouseReleaseEvent):
1544         (WebCore::EventHandler::handleMouseForceEvent):
1545         (WebCore::EventHandler::handleWheelEvent):
1546         * page/PointerLockController.cpp:
1547         (WebCore::PointerLockController::isLocked): Added.
1548         (WebCore::PointerLockController::dispatchLockedWheelEvent): Added.
1549         * page/PointerLockController.h:
1550
1551 2017-02-03  Yoav Weiss  <yoav@yoav.ws>
1552
1553         Avoid evicting link preload resources when parsing is done.
1554         https://bugs.webkit.org/show_bug.cgi?id=167415
1555
1556         Reviewed by Ryosuke Niwa.
1557
1558         Currently all preloads (speculative and link preload) are being cleared when the document has finished parsing.
1559         When it comes to link preloads, it can result in resources being cleared before the page had a chance to use them. (e.g. resources
1560         that are preloaded in order to be loaded through script after DOMContentLoaded)
1561
1562         This patch fixes that by marking link preload resources as such, so that they can be handled separately inside clearPreloads().
1563         As this fix also exposed an issue with load cancelation with invalid hrefs (which tests were passing before due to the preloads
1564         being cleared), said issue is also fixed by clearing previousely preloaded resources if an invalid link preload is later detected.
1565
1566         Test: http/tests/preload/not_evicting_preload_at_onload.html
1567
1568         * dom/Document.cpp:
1569         (WebCore::Document::finishedParsing): Only clear speculative preloads when parsing is finished.
1570         * loader/LinkLoader.cpp:
1571         (WebCore::LinkLoader::preloadIfNeeded): Set request flag indicating link preload.
1572         (WebCore::LinkLoader::loadLink): Clear previousely preloaded resource to cancel their load.
1573         * loader/LinkPreloadResourceClients.h:
1574         (WebCore::LinkPreloadResourceClient::clearResource): Call cancelLoad() when the client is cleared.
1575         * loader/cache/CachedResource.h:
1576         (WebCore::CachedResource::isLinkPreload):
1577         (WebCore::CachedResource::setLinkPreload):
1578         * loader/cache/CachedResource.cpp:
1579         (WebCore::CachedResource::CachedResource): Initialize m_isLinkPreload with the request's value.
1580         * loader/cache/CachedResourceLoader.cpp:
1581         (WebCore::CachedResourceLoader::~CachedResourceLoader):
1582         (WebCore::CachedResourceLoader::requestResource): Mirror the request link preload flag to the resource if it's fetched from cache.
1583         (WebCore::CachedResourceLoader::clearPreloads): Add a "speculative only" mode, which doesn't clear link preloads.
1584         * loader/cache/CachedResourceLoader.h:
1585         * loader/cache/CachedResourceRequest.cpp:
1586         (WebCore::CachedResourceRequest::CachedResourceRequest):
1587         * loader/cache/CachedResourceRequest.h:
1588         (WebCore::CachedResourceRequest::isLinkPreload):
1589         (WebCore::CachedResourceRequest::setIsLinkPreload):
1590
1591 2017-02-03  Zalan Bujtas  <zalan@apple.com>
1592
1593         Simple line layout: Removing adjacent trailing whitespace runs should not crash.
1594         https://bugs.webkit.org/show_bug.cgi?id=167803
1595         <rdar://problem/30337368>
1596
1597         Reviewed by Antti Koivisto.
1598
1599         In case of adjacent collapsed whitespace fragments, the length of these fragments (TextFragmentIterator::TextFragment)
1600         do not necessarily equal the length of the final runs (SimpleLineLayout::Run).
1601         This patch removes the dependency on the length and switches over to using the position information instead.
1602
1603         Test: fast/text/simple-line-layout-multiple-trailingwhitespace-crash.html
1604
1605         * rendering/SimpleLineLayout.cpp:
1606         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded):
1607         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace):
1608
1609 2017-02-03  Brent Fulgham  <bfulgham@apple.com>
1610
1611         Correct memory leak in MediaConstraints
1612         https://bugs.webkit.org/show_bug.cgi?id=167744
1613         <rdar://problem/30331444>
1614
1615         Reviewed by Anders Carlsson.
1616
1617         ConstraintHolder returns a reference to an object created by operator new. When the
1618         returned value is assigned or stored in Vector or other containers we leak memory.
1619         Instead, this value should just be returned as a regular object so that the return
1620         value optimization can make sure memory is properly (and efficiently) used.
1621
1622         Tested by existing mediastream tests.
1623
1624         * platform/mediastream/MediaConstraints.h:
1625         (WebCore::FlattenedConstraint::ConstraintHolder::create): Return by value.
1626         (WebCore::FlattenedConstraint::ConstraintHolder::~ConstraintHolder): Don't attempt to
1627         delete memory that was moved away.
1628         (WebCore::FlattenedConstraint::ConstraintHolder::ConstraintHolder): Add Move constructor.
1629
1630 2017-02-03  Chris Dumez  <cdumez@apple.com>
1631
1632         Fix bad assertion under HTMLTreeBuilder::processStartTagForInBody()
1633         https://bugs.webkit.org/show_bug.cgi?id=167799
1634         <rdar://problem/30237241>
1635
1636         Reviewed by Brent Fulgham.
1637
1638         Fix bad assertion under HTMLTreeBuilder::processStartTagForInBody() that was
1639         expecting the root element to be an <html> element when parsing a <frameset>.
1640         While this assertion is true in theory and as per the specification, it does
1641         not hold in WebKit when parsing a DocumentFragment. This is because WebKit
1642         has an optimization causing us to have a DocumentFragment as root element
1643         when parsing a fragment. See the following constructor:
1644         "HTMLTreeBuilder(HTMLDocumentParser&, DocumentFragment&, Element&, ParserContentPolicy, const HTMLParserOptions&)"
1645
1646         which has the following code:
1647         """
1648         // https://html.spec.whatwg.org/multipage/syntax.html#parsing-html-fragments
1649         // For efficiency, we skip step 5 ("Let root be a new html element with no attributes") and instead use the DocumentFragment as a root node.
1650         m_tree.openElements().pushRootNode(HTMLStackItem::create(fragment));
1651         """
1652
1653         Update the assertion to expect a DocumentFragment as root element when parsing
1654         a fragment, and keep expecting an <html> element otherwise.
1655
1656         Test: fast/parser/fragment-with-frameset-crash.html
1657
1658         * html/parser/HTMLTreeBuilder.cpp:
1659         (WebCore::HTMLTreeBuilder::processStartTagForInBody):
1660
1661 2017-02-03  Antoine Quint  <graouts@apple.com>
1662
1663         [Modern Media Controls] Skip back button is visible with a live broadcast video
1664         https://bugs.webkit.org/show_bug.cgi?id=167793
1665
1666         Reviewed by Eric Carlson.
1667
1668         We shouldn't be showing the skip back button when a live broadcast video is playing.
1669         We now listen to the "durationchange" event to determine when we have an inifinite-duration
1670         video and disable the skip button in that case.
1671
1672         Test: http/tests/media/modern-media-controls/skip-back-support/skip-back-support-live-broadcast.html
1673
1674         * Modules/modern-media-controls/media/skip-back-support.js:
1675         (SkipBackSupport.prototype.get mediaEvents):
1676         (SkipBackSupport.prototype.syncControl):
1677         (SkipBackSupport):
1678
1679 2017-02-03  Alex Christensen  <achristensen@webkit.org>
1680
1681         URLParser: implement forbidden host code points for non-special URLs
1682         https://bugs.webkit.org/show_bug.cgi?id=167779
1683
1684         Reviewed by Chris Dumez.
1685
1686         Covered by newly passing web platform tests.
1687
1688         * platform/URLParser.cpp:
1689         (WebCore::isC0Control):
1690         (WebCore::isForbiddenHostCodePoint):
1691         (WebCore::URLParser::parseHostAndPort):
1692         In non-special URL hosts such as customprotocol://strange%host
1693         don't accept characters that are part of the URL grammar and would be forbidden
1694         in a special URL host, like https://not[allowed
1695         This was recently added to the spec in https://github.com/whatwg/url/issues/214
1696
1697 2017-02-03  Per Arne Vollan  <pvollan@apple.com>
1698
1699         The CSS property -webkit-text-stroke is not applied on captions.
1700         https://bugs.webkit.org/show_bug.cgi?id=167687
1701
1702         Reviewed by Brent Fulgham.
1703
1704         Add style to list of valid properties for cue.
1705
1706         Test: media/track/track-css-stroke-cues.html
1707
1708         * css/StyleResolver.cpp:
1709         (WebCore::StyleResolver::isValidCueStyleProperty):
1710
1711 2017-02-03  Alex Christensen  <achristensen@webkit.org>
1712
1713         Align URL setters with spec for URLs that cannot be a base URL
1714         https://bugs.webkit.org/show_bug.cgi?id=167783
1715
1716         Reviewed by Chris Dumez.
1717
1718         Setting things like credentials on mailto URLs doesn't make sense.
1719         It's forbidden by the spec.
1720
1721         Covered by newly passing web platform tests.
1722
1723         * html/URLUtils.h:
1724         (WebCore::URLUtils<T>::setUsername):
1725         (WebCore::URLUtils<T>::setPassword):
1726         (WebCore::URLUtils<T>::setHost):
1727         (WebCore::URLUtils<T>::setHostname):
1728         (WebCore::URLUtils<T>::setPort):
1729         (WebCore::URLUtils<T>::setPathname):
1730         * platform/URL.cpp:
1731         (WebCore::URL::serialize):
1732         * platform/URL.h:
1733         (WebCore::URL::cannotBeABaseURL):
1734
1735 2017-02-03  Eric Carlson  <eric.carlson@apple.com>
1736
1737         [Mac] Add classes to manage audio samples
1738         https://bugs.webkit.org/show_bug.cgi?id=167739
1739
1740         Reviewed by Jer Noble.
1741
1742         No new tests, this code isn't used yet.
1743
1744         * WebCore.xcodeproj/project.pbxproj:
1745         * platform/audio/mac/AudioSampleBufferList.cpp: Added.
1746         (WebCore::AudioSampleBufferList::create):
1747         (WebCore::AudioSampleBufferList::AudioSampleBufferList):
1748         (WebCore::AudioSampleBufferList::~AudioSampleBufferList):
1749         (WebCore::AudioSampleBufferList::setSampleCount):
1750         (WebCore::AudioSampleBufferList::applyGain):
1751         (WebCore::AudioSampleBufferList::mixFrom):
1752         (WebCore::AudioSampleBufferList::copyFrom):
1753         (WebCore::AudioSampleBufferList::copyTo):
1754         (WebCore::AudioSampleBufferList::reset):
1755         (WebCore::AudioSampleBufferList::zero):
1756         (WebCore::AudioSampleBufferList::zeroABL):
1757         (WebCore::AudioSampleBufferList::convertInput):
1758         (WebCore::AudioSampleBufferList::audioConverterCallback):
1759         (WebCore::AudioSampleBufferList::configureBufferListForStream):
1760         * platform/audio/mac/AudioSampleBufferList.h: Added.
1761         (WebCore::AudioSampleBufferList::streamDescription):
1762         (WebCore::AudioSampleBufferList::bufferList):
1763         (WebCore::AudioSampleBufferList::sampleCapacity):
1764         (WebCore::AudioSampleBufferList::sampleCount):
1765         (WebCore::AudioSampleBufferList::timestamp):
1766         (WebCore::AudioSampleBufferList::hostTime):
1767         (WebCore::AudioSampleBufferList::setTimes):
1768         (WebCore::AudioSampleBufferList::audioBufferListSizeForStream):
1769         * platform/audio/mac/AudioSampleDataSource.cpp: Added.
1770         (WebCore::AudioSampleDataSource::create):
1771         (WebCore::AudioSampleDataSource::AudioSampleDataSource):
1772         (WebCore::AudioSampleDataSource::~AudioSampleDataSource):
1773         (WebCore::AudioSampleDataSource::setPaused):
1774         (WebCore::AudioSampleDataSource::setupConverter):
1775         (WebCore::AudioSampleDataSource::setInputFormat):
1776         (WebCore::AudioSampleDataSource::setOutputFormat):
1777         (WebCore::AudioSampleDataSource::hostTime):
1778         (WebCore::AudioSampleDataSource::pushSamplesInternal):
1779         (WebCore::AudioSampleDataSource::pushSamples):
1780         (WebCore::AudioSampleDataSource::pullSamplesInternal):
1781         (WebCore::AudioSampleDataSource::pullSamples):
1782         * platform/audio/mac/AudioSampleDataSource.h: Added.
1783         (WebCore::AudioSampleDataSource::setVolume):
1784         (WebCore::AudioSampleDataSource::volume):
1785         (WebCore::AudioSampleDataSource::setMuted):
1786         (WebCore::AudioSampleDataSource::muted):
1787
1788 2017-02-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1789
1790         Unreviewed. Fix the buidl after r211631.
1791
1792         I added the OS(LINUX) ifdef to the wrong file by mistake.
1793
1794         * page/ResourceUsageThread.h:
1795         * page/linux/ResourceUsageThreadLinux.cpp:
1796
1797 2017-02-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1798
1799         [GTK] Add initial implementation of resource usage overlay
1800         https://bugs.webkit.org/show_bug.cgi?id=167731
1801
1802         Reviewed by Michael Catanzaro.
1803
1804         Add an implementation of ResourceUsageOverlay and ResourceUsageThread for Linux systems.
1805
1806         * PlatformGTK.cmake: Add new new files to compilation.
1807         * page/Page.cpp:
1808         (WebCore::Page::setResourceUsageOverlayVisible): Do not create the page overlay if accelerated compositing is
1809         not enabled.
1810         * page/ResourceUsageOverlay.h:
1811         * page/linux/ResourceUsageOverlayLinux.cpp: Added.
1812         (WebCore::cpuUsageString):
1813         (WebCore::formatByteNumber):
1814         (WebCore::gcTimerString):
1815         (WebCore::ResourceUsageOverlay::platformInitialize):
1816         (WebCore::ResourceUsageOverlay::platformDestroy):
1817         * page/linux/ResourceUsageThreadLinux.cpp: Added.
1818         (WebCore::cpuPeriod):
1819         (WebCore::cpuUsage):
1820         (WebCore::ResourceUsageThread::platformThreadBody):
1821
1822 2017-02-03  Enrique Ocaña González  <eocanha@igalia.com>
1823
1824         [GStreamer] Store preloaded media in webkit's cache
1825         https://bugs.webkit.org/show_bug.cgi?id=119477
1826
1827         Reviewed by Xabier Rodriguez-Calvar.
1828
1829         Files cached on disk by MediaPlayerPrivateGStreamer are deleted only when the player is closed. If the
1830         WebProcess crashed, they're just left there in the cache directory. This patch changes the location
1831         of those temporary files to a proper temporary directory (/var/tmp, as those files aren't actually
1832         reusable, so they don't belong to a cache directory, and /tmp is a bad place because it's RAM-based on
1833         some distros), unlinks (deletes) them right after creation and also deletes any other stalled temporary
1834         file on the old legacy cache directory.
1835
1836         There's no API in GstPlaybin to control the temporary file location, so we do it manually by locating
1837         the GstDownloadBuffer element in the pipeline as soon as it's created, reconfiguring it with the right
1838         temporary file path and deleting the file as soon as it's created.
1839
1840         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1841         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Stop listening to element-added.
1842         (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback): Look for GstDownloadBuffer.
1843         (WebCore::MediaPlayerPrivateGStreamer::downloadBufferFileCreatedCallback): Remove the file after creation.
1844         (WebCore::MediaPlayerPrivateGStreamer::purgeOldDownloadFiles): Delete legacy files.
1845         (WebCore::MediaPlayerPrivateGStreamer::sourceChanged): Listen to element-added signals on GstUriDecodeBin.
1846         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: New reference to GstDownloadBuffer.
1847
1848 2017-02-03  Antti Koivisto  <antti@apple.com>
1849
1850         WebContent crash when pasting into input fields at com.apple.WebCore: WebCore::ResourceRequestBase::url const + 9
1851         https://bugs.webkit.org/show_bug.cgi?id=167787
1852         rdar://problem/29168795
1853
1854         Reviewed by Andreas Kling.
1855
1856         No test, don't know how to get here.
1857
1858         * page/animation/CSSPropertyAnimation.cpp:
1859         (WebCore::crossfadeBlend): Null check.
1860
1861 2017-02-03  Alberto Garcia  <berto@igalia.com>
1862
1863         JSDOMWindowBase.cpp doesn't build if the JIT is disabled
1864         https://bugs.webkit.org/show_bug.cgi?id=167785
1865
1866         Reviewed by Carlos Garcia Campos.
1867
1868         r211403 moved GetCallerGlobalObjectFunctor from JSDOMBinding.cpp
1869         to JSDOMWindowBase.cpp, but forgot to include bytecode/CodeBlock.h
1870         in the latter file.
1871
1872         This breaks the build if the JIT is disabled because the headers
1873         that would include ClodeBlock.h indirectly are guarded by
1874         ENABLE(JIT).
1875
1876         * bindings/js/JSDOMWindowBase.cpp:
1877
1878 2017-02-02  Andreas Kling  <akling@apple.com>
1879
1880         [Mac] In-process memory pressure monitor for WebContent processes AKA websam
1881         <https://webkit.org/b/167491>
1882         <rdar://problem/30116072>
1883
1884         Reviewed by Antti Koivisto.
1885
1886         Add a new timer-based memory pressure monitor that checks the process memory
1887         footprint every 30 seconds and reacts to changes by setting a MemoryUsagePolicy.
1888
1889         There are four MemoryUsagePolicy values:
1890
1891             - Unrestricted (below 1GB)
1892             - Conservative (above 1GB)
1893             - Strict (above 2GB)
1894             - Panic (above 4GB, or 3GB if 32-bit)
1895
1896         For Strict and above, the old-style "isUnderMemoryPressure()" API will return true.
1897
1898         Transitioning to a higher policy will cause memory pressure handlers to run:
1899
1900         At Strict, we run the "non-critical" memory pressure handler, then carry on.
1901
1902         At Panic, we run the "critical" memory pressure handler. If that fails to recover
1903         enough memory to bring us back below 4GB, we may kill the process:
1904
1905         A process is eligible to get killed for using too much memory if:
1906
1907             - It's not visible on screen (i.e it's a background tab.)
1908             - It's not playing audio.
1909             - It has not performed a main frame navigation in the last hour.
1910
1911         Before killing the process, an exit-time callback will run. This patch installs such
1912         a callback that prints out some time-of-death statistics about C++ and JavaScript memory
1913         usage to hopefully help understand what was soaking up all the memory.
1914
1915         * bindings/js/CommonVM.cpp:
1916         (WebCore::commonVMSlow):
1917         * loader/FrameLoader.cpp:
1918         (WebCore::FrameLoader::setState):
1919         * page/MainFrame.cpp:
1920         (WebCore::MainFrame::didCompleteLoad):
1921         * page/MainFrame.h:
1922         * page/MemoryRelease.cpp:
1923         (WebCore::pageCount):
1924         (WebCore::logMemoryStatisticsAtTimeOfDeath):
1925         (WebCore::didExceedMemoryLimitAndFailedToRecover):
1926         (WebCore::processIsEligibleForMemoryKill):
1927         * page/MemoryRelease.h:
1928         * page/ResourceUsageThread.h:
1929         * page/cocoa/ResourceUsageThreadCocoa.mm:
1930         (WebCore::vmPageSize):
1931         * platform/MemoryPressureHandler.cpp:
1932         (WebCore::MemoryPressureHandler::MemoryPressureHandler):
1933         (WebCore::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
1934         (WebCore::toString):
1935         (WebCore::thresholdForPolicy):
1936         (WebCore::policyForFootprint):
1937         (WebCore::MemoryPressureHandler::measurementTimerFired):
1938         * platform/MemoryPressureHandler.h:
1939         (WebCore::MemoryPressureHandler::setMemoryKillCallback):
1940         (WebCore::MemoryPressureHandler::setProcessIsEligibleForMemoryKillCallback):
1941         (WebCore::MemoryPressureHandler::isUnderMemoryPressure):
1942
1943 2017-02-02  Alex Christensen  <achristensen@webkit.org>
1944
1945         URLParser: Fix parsing invalid IPv4 addresses with non-ASCII characters
1946         https://bugs.webkit.org/show_bug.cgi?id=167773
1947         <rdar://problem/30221102>
1948
1949         Reviewed by Ryosuke Niwa.
1950
1951         If an invalid IPv4 address contains the first syntaxViolation (difference between input and canonicalized URL),
1952         an iterator is used to calculate how far we have parsed in the input string to copy all the syntax-violation-free
1953         characters into a Vector. If a URL contains only ASCII that doesn't contain anything percent-encoded in the host,
1954         there is a fast path to parse ASCII hosts.  All my existing invalid IPv4 tests followed this path.
1955         If there is a non-ASCII character, we need to use an iterator to the original string instead of an iterator
1956         to the string after converting the input string's host to ASCII.
1957
1958         Covered by a new API test which used to RELEASE_ASSERT.
1959
1960         * platform/URLParser.cpp:
1961         (WebCore::URLParser::parseIPv4Host):
1962         (WebCore::URLParser::parseIPv6Host):
1963         (WebCore::URLParser::parseHostAndPort):
1964         * platform/URLParser.h:
1965
1966 2017-02-02  Wenson Hsieh  <wenson_hsieh@apple.com>
1967
1968         CrashTracer: [USER] com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::URL::host const + 9
1969         https://bugs.webkit.org/show_bug.cgi?id=167766
1970         <rdar://problem/30132707>
1971
1972         Reviewed by Chris Dumez.
1973
1974         The mainframe's document pointer may be null when tearing down a page upon navigation to a page that is in the
1975         page cache. If this triggers a GC sweep, we will attempt to reload touch bar media controls, which (as a part of
1976         the media controller heuristic) checks the mainframe's document URL to see if quirks should be enabled. This
1977         assumes that the mainframe's document exists, which is not a safe assumption if page navigation is occurring. As
1978         such, we need a null check for the mainframe's document in needsPlaybackControlsManagerQuirk().
1979
1980         No test, as we were unable to reproduce this crash.
1981
1982         * html/HTMLMediaElement.cpp:
1983         (WebCore::needsPlaybackControlsManagerQuirk):
1984
1985 2017-02-02  Chris Dumez  <cdumez@apple.com>
1986
1987         Suspend SVG animations in hidden pages
1988         https://bugs.webkit.org/show_bug.cgi?id=167763
1989         <rdar://problem/29986313>
1990
1991         Reviewed by Simon Fraser.
1992
1993         Suspend SVG animations in hidden pages to save power, similarly to what
1994         we already do for another types of animations.
1995
1996         Test: svg/animations/animations-paused-page-non-visible.html
1997
1998         * page/Page.cpp:
1999         (WebCore::setSVGAnimationSuspended):
2000         (WebCore::Page::setIsVisibleInternal):
2001         * svg/SVGDocumentExtensions.cpp:
2002         (WebCore::SVGDocumentExtensions::pauseAnimations):
2003         (WebCore::SVGDocumentExtensions::unpauseAnimations):
2004         * svg/SVGDocumentExtensions.h:
2005         (WebCore::SVGDocumentExtensions::areAnimationsPaused):
2006         * testing/Internals.cpp:
2007         (WebCore::Internals::areSVGAnimationsPaused):
2008         * testing/Internals.h:
2009         * testing/Internals.idl:
2010
2011 2017-02-02  Commit Queue  <commit-queue@webkit.org>
2012
2013         Unreviewed, rolling out r211596 and r211605.
2014         https://bugs.webkit.org/show_bug.cgi?id=167767
2015
2016         This change broke certain build configurations (Requested by
2017         ryanhaddad on #webkit).
2018
2019         Reverted changesets:
2020
2021         "[Mac] Add classes to manage audio samples"
2022         https://bugs.webkit.org/show_bug.cgi?id=167739
2023         http://trac.webkit.org/changeset/211596
2024
2025         "Unreviewed speculative build fix."
2026         http://trac.webkit.org/changeset/211605
2027
2028 2017-02-02  Ryan Haddad  <ryanhaddad@apple.com>
2029
2030         Unreviewed speculative build fix.
2031
2032         * platform/audio/mac/AudioSampleDataSource.cpp:
2033         (WebCore::AudioSampleDataSource::setupConverter):
2034         (WebCore::AudioSampleDataSource::pushSamples):
2035
2036 2017-02-02  Alex Christensen  <achristensen@webkit.org>
2037
2038         Build libwebrtc and dependencies with Xcode
2039         https://bugs.webkit.org/show_bug.cgi?id=167758
2040
2041         Reviewed by Dean Jackson.
2042
2043         * WebCore.xcodeproj/project.pbxproj:
2044
2045 2017-02-02  Chris Dumez  <cdumez@apple.com>
2046
2047         {}.toString.call(crossOriginWindow) should return "[object Object]"
2048         https://bugs.webkit.org/show_bug.cgi?id=167701
2049         <rdar://problem/30330797>
2050
2051         Reviewed by Keith Miller.
2052
2053         {}.toString.call() to should "[object Object] for cross origin
2054         Window / Location objects. This new behavior is consistent with
2055         Firefox and Chrome.
2056
2057         No new tests, rebaselined existing tests.
2058
2059         * bindings/js/JSDOMWindowCustom.cpp:
2060         (WebCore::JSDOMWindow::toStringName):
2061         * bindings/js/JSLocationCustom.cpp:
2062         (WebCore::JSLocation::toStringName):
2063         * bindings/scripts/CodeGeneratorJS.pm:
2064         (GenerateHeader):
2065         * bindings/scripts/IDLAttributes.txt:
2066         * page/DOMWindow.idl:
2067         * page/Location.idl:
2068
2069 2017-02-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2070
2071         Drag images should be anchored to the mouse location
2072         https://bugs.webkit.org/show_bug.cgi?id=167690
2073         <rdar://problem/30295261>
2074
2075         Reviewed by Enrica Casucci.
2076
2077         Adds logic to compute the mouse anchor point. This is a point in the unit square indicating where the drag
2078         origin is relative to the bounds of the drag image. There is no behavior change, since this anchor point is not
2079         used by any client yet; this patch only computes and vends this information from WebCore.
2080
2081         * loader/EmptyClients.cpp:
2082         * page/DragClient.h:
2083         * page/DragController.cpp:
2084         (WebCore::DragController::startDrag):
2085         (WebCore::DragController::doImageDrag):
2086         (WebCore::DragController::doSystemDrag):
2087         * page/DragController.h:
2088         * platform/DragImage.h:
2089
2090 2017-02-02  Eric Carlson  <eric.carlson@apple.com>
2091
2092         [Mac] Add classes to manage audio samples
2093         https://bugs.webkit.org/show_bug.cgi?id=167739
2094
2095         Reviewed by Jer Noble.
2096
2097         No new tests, this code isn't used yet.
2098
2099         * WebCore.xcodeproj/project.pbxproj:
2100         * platform/audio/mac/AudioSampleBufferList.cpp: Added.
2101         (WebCore::AudioSampleBufferList::create):
2102         (WebCore::AudioSampleBufferList::AudioSampleBufferList):
2103         (WebCore::AudioSampleBufferList::~AudioSampleBufferList):
2104         (WebCore::AudioSampleBufferList::setSampleCount):
2105         (WebCore::AudioSampleBufferList::applyGain):
2106         (WebCore::AudioSampleBufferList::mixFrom):
2107         (WebCore::AudioSampleBufferList::copyFrom):
2108         (WebCore::AudioSampleBufferList::copyTo):
2109         (WebCore::AudioSampleBufferList::reset):
2110         (WebCore::AudioSampleBufferList::zero):
2111         (WebCore::AudioSampleBufferList::zeroABL):
2112         (WebCore::AudioSampleBufferList::convertInput):
2113         (WebCore::AudioSampleBufferList::audioConverterCallback):
2114         (WebCore::AudioSampleBufferList::configureBufferListForStream):
2115         * platform/audio/mac/AudioSampleBufferList.h: Added.
2116         (WebCore::AudioSampleBufferList::streamDescription):
2117         (WebCore::AudioSampleBufferList::bufferList):
2118         (WebCore::AudioSampleBufferList::sampleCapacity):
2119         (WebCore::AudioSampleBufferList::sampleCount):
2120         (WebCore::AudioSampleBufferList::timestamp):
2121         (WebCore::AudioSampleBufferList::hostTime):
2122         (WebCore::AudioSampleBufferList::setTimes):
2123         (WebCore::AudioSampleBufferList::audioBufferListSizeForStream):
2124         * platform/audio/mac/AudioSampleDataSource.cpp: Added.
2125         (WebCore::AudioSampleDataSource::create):
2126         (WebCore::AudioSampleDataSource::AudioSampleDataSource):
2127         (WebCore::AudioSampleDataSource::~AudioSampleDataSource):
2128         (WebCore::AudioSampleDataSource::setPaused):
2129         (WebCore::AudioSampleDataSource::setupConverter):
2130         (WebCore::AudioSampleDataSource::setInputFormat):
2131         (WebCore::AudioSampleDataSource::setOutputFormat):
2132         (WebCore::AudioSampleDataSource::hostTime):
2133         (WebCore::AudioSampleDataSource::pushSamplesInternal):
2134         (WebCore::AudioSampleDataSource::pushSamples):
2135         (WebCore::AudioSampleDataSource::pullSamplesInternal):
2136         (WebCore::AudioSampleDataSource::pullSamples):
2137         * platform/audio/mac/AudioSampleDataSource.h: Added.
2138         (WebCore::AudioSampleDataSource::setVolume):
2139         (WebCore::AudioSampleDataSource::volume):
2140         (WebCore::AudioSampleDataSource::setMuted):
2141         (WebCore::AudioSampleDataSource::muted):
2142
2143 2017-02-02  Joseph Pecoraro  <pecoraro@apple.com>
2144
2145         Support Performance API (performance.now(), UserTiming) in Workers
2146         https://bugs.webkit.org/show_bug.cgi?id=167717
2147
2148         Reviewed by Ryosuke Niwa.
2149
2150         Tests: performance-api/performance-mark-name.html
2151                performance-api/performance-now-api.html
2152                performance-api/performance-now-time-origin-in-worker.html
2153                performance-api/user-timing-apis.html
2154
2155         * CMakeLists.txt:
2156         * DerivedSources.make:
2157         New files.
2158
2159         * page/DOMWindow.idl:
2160         * page/GlobalPerformance.idl:
2161         * workers/WorkerGlobalScope.idl:
2162         Add partial interface for performance attribute.
2163
2164         * page/Performance.idl:
2165         * page/PerformanceEntry.idl:
2166         * page/PerformanceMark.idl:
2167         * page/PerformanceMeasure.idl:
2168         * page/PerformanceObserver.idl:
2169         * page/PerformanceObserverEntryList.idl:
2170         Expose these to Workers.
2171
2172         * page/Performance.cpp:
2173         (WebCore::Performance::Performance):
2174         (WebCore::Performance::contextDestroyed):
2175         * page/Performance.h:
2176         Use the EventQueue variant that works with any ScriptExectionContext.
2177
2178         * page/PerformanceObserver.cpp:
2179         (WebCore::PerformanceObserver::PerformanceObserver):
2180         Get the Performance base in a Worker context.
2181
2182         * page/PerformanceUserTiming.cpp:
2183         (WebCore::UserTiming::mark):
2184         Only reject legacy special mark names in a Window, not a Worker.
2185
2186         (WebCore::UserTiming::findExistingMarkStartTime):
2187         Simple implementation returns 0 as the start time in Workers. The spec
2188         is currently imprecise here, but it does not have the unusual
2189         PerformanceTiming behavior in a Window which is part of User Timing 1.
2190
2191         * workers/Worker.cpp:
2192         (WebCore::Worker::create):
2193         (WebCore::Worker::notifyFinished):
2194         * workers/Worker.h:
2195         Record the moment of Worker creation.
2196
2197         * workers/WorkerGlobalScope.cpp:
2198         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
2199         (WebCore::WorkerGlobalScope::performance):
2200         * workers/WorkerGlobalScope.h:
2201         Construct the Performance object with the moment of creation (timeOrigin).
2202
2203         * workers/DedicatedWorkerGlobalScope.cpp:
2204         (WebCore::DedicatedWorkerGlobalScope::create):
2205         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
2206         * workers/DedicatedWorkerGlobalScope.h:
2207         * workers/DedicatedWorkerThread.cpp:
2208         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
2209         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
2210         * workers/DedicatedWorkerThread.h:
2211         * workers/WorkerGlobalScopeProxy.h:
2212         * workers/WorkerMessagingProxy.cpp:
2213         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
2214         * workers/WorkerMessagingProxy.h:
2215         * workers/WorkerThread.cpp:
2216         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
2217         (WebCore::WorkerThread::WorkerThread):
2218         (WebCore::WorkerThread::workerThread):
2219         * workers/WorkerThread.h:
2220         Pass the moment of creation (timeOrigin) through to WorkerGlobalScope creation.
2221
2222 2017-02-02  Commit Queue  <commit-queue@webkit.org>
2223
2224         Unreviewed, rolling out r211579.
2225         https://bugs.webkit.org/show_bug.cgi?id=167753
2226
2227         Caused mediastream crashes. (Requested by bfulgham_ on
2228         #webkit).
2229
2230         Reverted changeset:
2231
2232         "Correct memory leak in MediaConstraints"
2233         https://bugs.webkit.org/show_bug.cgi?id=167744
2234         http://trac.webkit.org/changeset/211579
2235
2236 2017-02-02  Chris Dumez  <cdumez@apple.com>
2237
2238         Rename Node::inDocument() to isConnected()
2239         https://bugs.webkit.org/show_bug.cgi?id=167743
2240
2241         Reviewed by Sam Weinig.
2242
2243         Rename Node::inDocument() to isConnected() to match the DOM specification more closely:
2244         - https://dom.spec.whatwg.org/#connected
2245
2246 2017-02-02  Antoine Quint  <graouts@apple.com>
2247
2248         [Modern Media Controls] Provide a compact mode for when the controls are small
2249         https://bugs.webkit.org/show_bug.cgi?id=167746
2250         <rdar://problem/29565842>
2251
2252         Reviewed by Dean Jackson.
2253
2254         When the macOS inline media controls become too narrow to display both the volume and fullscreen
2255         buttons in their right container (width < 242), we switch to a compact mode where the controls bar
2256         is shorter and the buttons smaller.
2257
2258         To facilitate this, we provide a new subclass of MacOSInlineMediaControls called MacOSCompactInlineMediaControls
2259         which changes some of the layout properties of the buttons to have shorter margins around buttons.
2260
2261         We also added a new "Compact" LayoutTrait and improved IconService to provide specific icons
2262         for this mode for the buttons that can exist in compact mode. 
2263
2264         To correctly implement the design, we needed to add a way to provide different margins around the
2265         left and right edges of the container, so the "padding" property is now split between "leftMargin"
2266         and "rightMargin", and to make property naming cleaner, the "margin" property which specifies the
2267         space between each button in a container is now called "buttonMargin". We also set the default
2268         values for those properties to be 24 (instead of 0) which are the most widely used values, requiring
2269         less customization.
2270
2271         Tests: media/modern-media-controls/macos-compact-inline-media-controls/macos-compact-inline-media-controls-buttons-styles.html
2272                media/modern-media-controls/macos-compact-inline-media-controls/macos-compact-inline-media-controls-constructor.html
2273                media/modern-media-controls/macos-compact-inline-media-controls/macos-compact-inline-media-controls-controls-bar-styles.html
2274                media/modern-media-controls/macos-compact-inline-media-controls/macos-compact-inline-media-controls-layout.html
2275                media/modern-media-controls/macos-compact-inline-media-controls/macos-compact-inline-media-controls-volume-styles.html
2276                media/modern-media-controls/media-controller/media-controller-toggle-compact-mode.html
2277
2278         * Modules/modern-media-controls/controls/buttons-container.js:
2279         (ButtonsContainer.prototype.layout): Refactor the "margin" and "padding" properties into
2280         "leftMargin", "rightMargin" and "buttonMargin".
2281         * Modules/modern-media-controls/controls/icon-button.js:
2282         (IconButton.prototype._updateImage): Fix a small bug that would prevent the image source
2283         change to occur after changing the "iconName" property should the previous and new icons
2284         share the same metrics, which is the case for the "play" and "pause" icons in compact mode.
2285         * Modules/modern-media-controls/controls/icon-service.js: Add support for compact variants.
2286         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconNameAndLayoutTraits):
2287         (const.iconService.new.IconService):
2288         * Modules/modern-media-controls/controls/ios-inline-media-controls.js: Adopt new margin defaults.
2289         * Modules/modern-media-controls/controls/layout-item.js: Add the new "Compact" LayoutTrait.
2290         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css: Added.
2291         (.media-controls.mac.inline.compact > .controls-bar):
2292         (.media-controls.mac.inline.compact button.play-pause):
2293         (.media-controls.mac.inline.compact button.skip-back):
2294         (.media-controls.mac.inline.compact .scrubber.slider):
2295         (.media-controls.mac.inline.compact button.mute):
2296         (.media-controls.mac.inline.compact button.fullscreen):
2297         (.media-controls.mac.inline.compact .time-label,):
2298         (.media-controls.mac.inline.compact .volume-slider-container):
2299         (.media-controls.mac.inline.compact .volume.slider):
2300         (.media-controls.mac.inline.compact .scrubber.slider > input::-webkit-slider-thumb):
2301         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.js: Added.
2302         (MacOSCompactInlineMediaControls):
2303         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js: Adopt new margin defaults.
2304         (MacOSFullscreenMediaControls.prototype.layout):
2305         * Modules/modern-media-controls/controls/macos-inline-media-controls.js: Adopt new margin defaults
2306         and make the _leftContainer and _rightContainer properties public such that the MacOSCompactInlineMediaControls
2307         subclass may customize them without accessing a private property.
2308         (MacOSInlineMediaControls.prototype.layout):
2309         (MacOSInlineMediaControls.prototype.showTracksPanel):
2310         * Modules/modern-media-controls/images/macOS/enter-fullscreen-compact@1x.png: Added.
2311         * Modules/modern-media-controls/images/macOS/enter-fullscreen-compact@2x.png: Added.
2312         * Modules/modern-media-controls/images/macOS/interval-skip-back-compact@1x.png: Added.
2313         * Modules/modern-media-controls/images/macOS/interval-skip-back-compact@2x.png: Added.
2314         * Modules/modern-media-controls/images/macOS/pause-compact@1x.png: Added.
2315         * Modules/modern-media-controls/images/macOS/pause-compact@2x.png: Added.
2316         * Modules/modern-media-controls/images/macOS/play-compact@1x.png: Added.
2317         * Modules/modern-media-controls/images/macOS/play-compact@2x.png: Added.
2318         * Modules/modern-media-controls/images/macOS/volume-compact@1x.png: Added.
2319         * Modules/modern-media-controls/images/macOS/volume-compact@2x.png: Added.
2320         * Modules/modern-media-controls/js-files: Add the new files so they are concatenated by the build script.
2321         * Modules/modern-media-controls/media/media-controller.js: Toggle compact mode if controls
2322         are below the 242px width threshold.
2323         (MediaController.prototype.get layoutTraits):
2324         (MediaController.prototype.handleEvent):
2325         (MediaController.prototype._updateControlsIfNeeded):
2326         (MediaController.prototype._shouldFadeBetweenControls):
2327         (MediaController.prototype._updateControlsSize):
2328         (MediaController.prototype._controlsWidth):
2329         (MediaController.prototype._controlsClass):
2330         (MediaController):
2331         * WebCore.xcodeproj/project.pbxproj: Add new files and perform some cleanup so that the
2332         project accurately lists all the existing project files and remove some older ones.
2333
2334 2017-02-02  Commit Queue  <commit-queue@webkit.org>
2335
2336         Unreviewed, rolling out r211571 and r211582.
2337         https://bugs.webkit.org/show_bug.cgi?id=167751
2338
2339         This change caused API test WebKit1.MemoryPressureHandler to
2340         fail with an assertion. (Requested by ryanhaddad on #webkit).
2341
2342         Reverted changesets:
2343
2344         "[Mac] In-process memory pressure monitor for WebContent
2345         processes."
2346         https://bugs.webkit.org/show_bug.cgi?id=167491
2347         http://trac.webkit.org/changeset/211571
2348
2349         "Unreviewed attempt to fix the Windows build after r211571."
2350         http://trac.webkit.org/changeset/211582
2351
2352 2017-02-02  Chris Dumez  <cdumez@apple.com>
2353
2354         Unreviewed attempt to fix the Windows build after r211571.
2355
2356         * platform/MemoryPressureHandler.cpp:
2357         (WebCore::thresholdForPolicy):
2358         (WebCore::policyForFootprint):
2359
2360 2017-02-02  Brent Fulgham  <bfulgham@apple.com>
2361
2362         Correct memory leak in MediaConstraints
2363         https://bugs.webkit.org/show_bug.cgi?id=167744
2364         <rdar://problem/30331444>
2365
2366         Reviewed by Anders Carlsson.
2367
2368         ConstraintHolder returns a reference to an object created by operator new. When the
2369         returned value is assigned or stored in Vector or other containers we leak memory.
2370         Instead, this value should just be returned as a regular object so that the return
2371         value optimization can make sure memory is properly (and efficiently) used.
2372
2373         * platform/mediastream/MediaConstraints.h:
2374         (WebCore::FlattenedConstraint::ConstraintHolder::create): Return by value.
2375
2376 2017-02-02  Andreas Kling  <akling@apple.com>
2377
2378         [Mac] In-process memory pressure monitor for WebContent processes AKA websam
2379         <https://webkit.org/b/167491>
2380         <rdar://problem/30116072>
2381
2382         Reviewed by Antti Koivisto.
2383
2384         Add a new timer-based memory pressure monitor that checks the process memory
2385         footprint every 30 seconds and reacts to changes by setting a MemoryUsagePolicy.
2386
2387         There are four MemoryUsagePolicy values:
2388
2389             - Unrestricted (below 1GB)
2390             - Conservative (above 1GB)
2391             - Strict (above 2GB)
2392             - Panic (above 4GB, or 3GB if 32-bit)
2393
2394         For Strict and above, the old-style "isUnderMemoryPressure()" API will return true.
2395
2396         Transitioning to a higher policy will cause memory pressure handlers to run:
2397
2398         At Strict, we run the "non-critical" memory pressure handler, then carry on.
2399
2400         At Panic, we run the "critical" memory pressure handler. If that fails to recover
2401         enough memory to bring us back below 4GB, we may kill the process:
2402
2403         A process is eligible to get killed for using too much memory if:
2404
2405             - It's not visible on screen (i.e it's a background tab.)
2406             - It's not playing audio.
2407             - It has not performed a main frame navigation in the last hour.
2408
2409         Before killing the process, an exit-time callback will run. This patch installs such
2410         a callback that prints out some time-of-death statistics about C++ and JavaScript memory
2411         usage to hopefully help understand what was soaking up all the memory.
2412
2413         * bindings/js/CommonVM.cpp:
2414         (WebCore::commonVMSlow):
2415         * loader/FrameLoader.cpp:
2416         (WebCore::FrameLoader::setState):
2417         * page/MainFrame.cpp:
2418         (WebCore::MainFrame::didCompleteLoad):
2419         * page/MainFrame.h:
2420         * page/MemoryRelease.cpp:
2421         (WebCore::pageCount):
2422         (WebCore::logMemoryStatisticsAtTimeOfDeath):
2423         (WebCore::didExceedMemoryLimitAndFailedToRecover):
2424         (WebCore::processIsEligibleForMemoryKill):
2425         * page/MemoryRelease.h:
2426         * page/ResourceUsageThread.h:
2427         * page/cocoa/ResourceUsageThreadCocoa.mm:
2428         (WebCore::vmPageSize):
2429         * platform/MemoryPressureHandler.cpp:
2430         (WebCore::MemoryPressureHandler::MemoryPressureHandler):
2431         (WebCore::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
2432         (WebCore::toString):
2433         (WebCore::thresholdForPolicy):
2434         (WebCore::policyForFootprint):
2435         (WebCore::MemoryPressureHandler::measurementTimerFired):
2436         * platform/MemoryPressureHandler.h:
2437         (WebCore::MemoryPressureHandler::setMemoryKillCallback):
2438         (WebCore::MemoryPressureHandler::setProcessIsEligibleForMemoryKillCallback):
2439         (WebCore::MemoryPressureHandler::isUnderMemoryPressure):
2440
2441 2017-02-02  Chris Dumez  <cdumez@apple.com>
2442
2443         [Crash] com.apple.WebKit.WebContent at WebKit: WebKit::WebPage::fromCorePage()
2444         https://bugs.webkit.org/show_bug.cgi?id=167738
2445         <rdar://problem/30229990>
2446
2447         Reviewed by Andreas Kling.
2448
2449         Upon destruction of a Page, we destroy the BackForwardClient, which is supposed
2450         to keep track of HistoryItems associated to this particular page and remove them
2451         from the PageCache. Given the crash trace, the issue seems to be that some
2452         HistoryItems associated with the Page sometimes linger in the PageCache *after*
2453         the Page has been destroyed, which leads to crashes later on when pruning the
2454         PageCache.
2455
2456         In order to make the process more robust, this patch refactors the code so that
2457         the Page is now in charge of removing all its associated HistoryItems from the
2458         PageCache instead of relying on the BackForwardClient. Also, instead of having
2459         the Page keep track of which HistoryItems are associated with it (which is
2460         error prone), we now scan all PageCache entries instead to find which ones are
2461         associated with the Page. While this is in theory slower, this is much safer
2462         and in practice not an issue because the PageCache usually has 3-5 entries.
2463
2464         No new tests, could not reproduce.
2465
2466         * history/CachedPage.cpp:
2467         (WebCore::CachedPage::CachedPage):
2468         * history/CachedPage.h:
2469         (WebCore::CachedPage::page):
2470         * history/PageCache.cpp:
2471         (WebCore::PageCache::removeAllItemsForPage):
2472         * history/PageCache.h:
2473         * page/Page.cpp:
2474         (WebCore::Page::~Page):
2475
2476 2017-02-02  Antti Koivisto  <antti@apple.com>
2477
2478         Column progression wrong after enabling pagination on RTL document
2479         https://bugs.webkit.org/show_bug.cgi?id=167733
2480         <rdar://problem/29012252>
2481
2482         Reviewed by Zalan Bujtas.
2483
2484         Column progression depends on document direction but was not updated when direction changed.
2485
2486         Test: fast/multicol/pagination/pagination-dynamic-rtl.html
2487
2488         * rendering/RenderBox.cpp:
2489         (WebCore::RenderBox::styleDidChange):
2490
2491             Update column styles if document direction changes.
2492
2493 2017-02-02  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2494
2495         [EME][GStreamer] Fixed decryptor selection
2496         https://bugs.webkit.org/show_bug.cgi?id=167588
2497
2498         Reviewed by Žan Doberšek.
2499
2500         GStreamer selected a decryptor automatically but we need to be
2501         able to tell it which decryptor we want because one file can be
2502         encrypted with more than one system and the one we want to use can
2503         depend on what the user tells us.
2504
2505         Now when the demuxer is about to select the demuxer, it runs a
2506         GstContext query with the events, which are forwarded through the
2507         EME api to the application, which will answer the the
2508         generateKeyRequest and then we can instruct the demuxer to select
2509         the one we tell it, not the one that is selected automatically. If
2510         the demuxer has already a preferred decryptor, the codepath will
2511         be similar to the older one.
2512
2513         Something that is also fixed is the report of the keyneeded event,
2514         which will contain all pssh boxes as requested by the spec.
2515
2516         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2517         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Intercept
2518         the event and handle it.
2519         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2520         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
2521         Initialize the CDM session.
2522         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
2523         Unlock the protection condition just in case and set CDM to null.
2524         (WebCore::extractEventsAndSystemsFromMessage): Access the events
2525         and accepted key systems coming at the message from the demuxer.
2526         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
2527         Handle the protection event not as an element event but as a
2528         context request. It also concatenates all the initdatas in case
2529         there is more than one. The event is sent in the main thread and
2530         the current one blocks until a timeout is hit or the
2531         generateKeyRequest is called.
2532         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
2533         Check if the event was already handled and if not, run the need
2534         key event.
2535         (WebCore::MediaPlayerPrivateGStreamerBase::receivedGenerateKeyRequest):
2536         Notify the that the query arrived so that we can unlock the
2537         demuxer thread.
2538         (WebCore::keySystemIdToUuid): Translates ids to uuids, meaning
2539         the ones coming from JS to the ones coming from the media engine.
2540         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2541         Attributes and methods.
2542         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
2543         (webkit_media_clear_key_decrypt_class_init):
2544         (webKitMediaClearKeyDecryptorRequestDecryptionKey): Deleted.
2545         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h:
2546         Added the ui and uuid.
2547         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
2548         (webkitMediaCommonEncryptionDecryptSinkEventHandler): Do not rely
2549         on the subclass, just forward the event to the pipeline inside a message.
2550         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
2551         Remove unused function signature.
2552         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2553         (WebCore::appendPipelineNeedContextMessageCallback): Renamed from
2554         appendPipelineElementMessageCallback.
2555         (WebCore::AppendPipeline::AppendPipeline): Connect to the
2556         need-context message instead of the element one.
2557         (WebCore::AppendPipeline::dispatchPendingDecryptionKey):
2558         Dispatches the drm-cypher message if there is one pending.
2559         (WebCore::AppendPipeline::dispatchDecryptionKey): Dispatches the
2560         drm-cypher.
2561         (WebCore::AppendPipeline::handleNeedContextSyncMessage): Handles
2562         the need-context event instead of the element one.
2563         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
2564         Dispatches the key to the pipeline if there's any pending.
2565         (WebCore::appendPipelineElementMessageCallback): Deleted.
2566         (WebCore::AppendPipeline::handleElementMessage): Deleted.
2567         * platform/graphics/gstreamer/mse/AppendPipeline.h: New methods
2568         and attributes.
2569         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2570         (WebCore::MediaPlayerPrivateGStreamerMSE::dispatchDecryptionKey):
2571         Use the dispatchDecryptionKey method of the AppendPipeline.
2572
2573 2017-02-02  Joseph Pecoraro  <pecoraro@apple.com>
2574
2575         Removed unused EventHandler members
2576         https://bugs.webkit.org/show_bug.cgi?id=167723
2577
2578         Reviewed by Yusuke Suzuki.
2579
2580         * page/EventHandler.cpp:
2581         (WebCore::EventHandler::clear):
2582         (WebCore::EventHandler::handleWheelEvent):
2583         * page/EventHandler.h:
2584         Remove unused members.
2585
2586         * editing/FrameSelection.cpp:
2587         * html/HTMLTextAreaElement.cpp:
2588         * rendering/RenderObject.cpp:
2589         * rendering/RenderSlider.cpp:
2590         Remove unnecessary includes.
2591
2592 2017-02-02  Joseph Pecoraro  <pecoraro@apple.com>
2593
2594         Removed unused m_navigationStart from NavigatorGamepad
2595         https://bugs.webkit.org/show_bug.cgi?id=167722
2596
2597         Reviewed by Yusuke Suzuki.
2598
2599         * Modules/gamepad/NavigatorGamepad.cpp:
2600         (WebCore::NavigatorGamepad::NavigatorGamepad):
2601         (WebCore::NavigatorGamepad::from):
2602         * Modules/gamepad/NavigatorGamepad.h:
2603         (WebCore::NavigatorGamepad::navigationStart): Deleted.
2604
2605 2017-02-02  Yongjun Zhang  <yongjun_zhang@apple.com>
2606
2607         In iOS, we should take background assertion when accessing localstorage databases.
2608         https://bugs.webkit.org/show_bug.cgi?id=165478
2609
2610         Move WebSQLiteDatabaseTrackerClient from WebKitLegacy to WebCore so that it can be accessible from
2611         WebKit1 and WebKit2. Previously, to avoid dependencies on UIKit, WebKitLegacy introduced several
2612         global methods for UIKit to setup the start/end background task blocks on runtime (WebKitSetStartBackgroundTaskBlock,
2613         WebKitSetInvalidWebBackgroundTaskIdentifier and WebKitSetEndBackgroundTaskBlock). Since we have to
2614         move the background task handling to WebCore, to avoid adding WebCore dependencies on UIKit, this
2615         patch introdues a new WebCore class WebBackgroundTaskController which holds the start/end background
2616         task blocks. The existing WebKitSetStartBackgroundTaskBlock and WebKitSetEndBackgroundTaskBlock methods
2617         in WebKit1 will use WebBackgroundTaskController to store the blocks set by UIKit. 
2618
2619         Reviewed by Brady Eidson.
2620
2621         No new test since this is code refactoring.
2622
2623         * WebCore.xcodeproj/project.pbxproj: Add a new class WebBackgroundTaskController to the project. Also move
2624             WebSQLiteDatabaseTrackerClient from WebKitLegacy to WebCore.
2625         * platform/ios/WebBackgroundTaskController.h: Use properties to hold the blocks for starting or ending background tasks.
2626         * platform/ios/WebBackgroundTaskController.mm:
2627         (+[WebBackgroundTaskController sharedController]):
2628         (-[WebBackgroundTaskController dealloc]):
2629         (-[WebBackgroundTaskController startBackgroundTaskWithExpirationHandler:]): Start a background task with a expiration handler;
2630             to start the background task, we will use backgroundTaskStartBlock set up by UIKit.
2631         (-[WebBackgroundTaskController endBackgroundTaskWithIdentifier:]): Call backgroundTaskEndBlack to end a background task.
2632         * platform/ios/WebSQLiteDatabaseTrackerClient.h: Copied from Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.h.
2633         * platform/ios/WebSQLiteDatabaseTrackerClient.mm: Copied from Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.mm.
2634         (WebCore::WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient): Make WebSQLiteDatabaseTrackerClient a singleton.
2635         (WebCore::WebSQLiteDatabaseTrackerClient::WebSQLiteDatabaseTrackerClient): 
2636         (WebCore::WebSQLiteDatabaseTrackerClient::~WebSQLiteDatabaseTrackerClient):
2637         (WebCore::WebSQLiteDatabaseTrackerClient::willBeginFirstTransaction): Use a utility class WebDatabaseTransactionBackgroundTaskController
2638             to schedule database transaction background task.
2639         (WebCore::WebSQLiteDatabaseTrackerClient::didFinishLastTransaction): Use WebDatabaseTransactionBackgroundTaskController to stop
2640             databas transaction background task.
2641         (transactionBackgroundTaskIdentifierLock: Moved from Source/WebKit/mac/Storage/WebDatabaseManager.mm.
2642         (setTransactionBackgroundTaskIdentifier): Ditto.
2643         (getTransactionBackgroundTaskIdentifier): Ditto.
2644         (+[WebDatabaseTransactionBackgroundTaskController startBackgroundTask]): Ditto.
2645         (+[WebDatabaseTransactionBackgroundTaskController endBackgroundTask]): Ditto.
2646
2647 2017-02-01  Zan Dobersek  <zdobersek@igalia.com>
2648
2649         [EME] Implement MediaKeySession::update()
2650         https://bugs.webkit.org/show_bug.cgi?id=167636
2651
2652         Reviewed by Xabier Rodriguez-Calvar.
2653
2654         Implement the MediaKeySession::update() method by following the steps as
2655         they are described in the specification.
2656
2657         In order to sanitize the passed-in response data, CDM::sanitizeResponse()
2658         is added. It passes the SharedBuffer object by reference to the CDMPrivate
2659         interface implementor, which returns a SharedBuffer object containing
2660         sanitized response data.
2661
2662         CDMInstance::updateLicense() virtual method is added to perform the license
2663         update for some specific CDMInstance object. After the update the CDMInstance
2664         invokes the callback that's passed to updateLicense(), providing information
2665         about session being closed, changed keys or expiration value, any message
2666         that has to be enqueued, and whether the update was successful.
2667
2668         After that callback is invoked, MediaKeySession::update() goes on to handle
2669         all the provided information in a future task, finally resolving the promise
2670         (or rejecting it beforehand in case of any failure during response handling
2671         or license update).
2672
2673         Three algorithms that can be invoked from MediaKeySession::update() (key
2674         status update, expiration update and session closure) will be implemented
2675         separately. Placeholder methods are provided until then.
2676
2677         MockCDM::sanitizeResponse() and MockCDMInstance::updateLicense() are
2678         implemented for testing purposes. For now only the response sanitization
2679         and sanitized response format are checked there. Key status update,
2680         expiration update and session closure should be tested once the
2681         implementations for those algorithms are added.
2682
2683         Test: media/encrypted-media/mock-MediaKeySession-update.html
2684
2685         * Modules/encryptedmedia/CDM.cpp:
2686         (WebCore::CDM::sanitizeResponse):
2687         * Modules/encryptedmedia/CDM.h:
2688         * Modules/encryptedmedia/CDMInstance.h:
2689         * Modules/encryptedmedia/CDMPrivate.h:
2690         * Modules/encryptedmedia/MediaKeySession.cpp:
2691         (WebCore::MediaKeySession::update):
2692         (WebCore::MediaKeySession::updateKeyStatuses):
2693         (WebCore::MediaKeySession::updateExpiration):
2694         (WebCore::MediaKeySession::sessionClosed):
2695         * Modules/encryptedmedia/MediaKeySession.h:
2696         * testing/MockCDMFactory.cpp:
2697         (WebCore::MockCDM::sanitizeResponse):
2698         (WebCore::MockCDMInstance::updateLicense):
2699         * testing/MockCDMFactory.h:
2700
2701 2017-02-01  Eric Carlson  <eric.carlson@apple.com>
2702
2703         [Mac] Update CARingBuffer class
2704         https://bugs.webkit.org/show_bug.cgi?id=167656
2705         <rdar://problem/30318329>
2706
2707         Unreviewed fix the 32-bit build after r211539.
2708
2709         * platform/audio/mac/CAAudioStreamDescription.cpp:
2710         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription):
2711
2712 2017-02-01  Simon Fraser  <simon.fraser@apple.com>
2713
2714         [iOS WK2] With visual viewports, a fixed bottom bar can be clipped out when the keyboard is visible
2715         https://bugs.webkit.org/show_bug.cgi?id=167710
2716         rdar://problem/30100286
2717
2718         Reviewed by Wenson Hsieh.
2719         
2720         Add a bit of logging to show when RLC decides to not composite a fixed element which
2721         is out of bounds.
2722
2723         Test: fast/visual-viewport/ios/bottom-bar-with-keyboard.html
2724
2725         * rendering/RenderLayerCompositor.cpp:
2726         (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
2727
2728 2017-02-01  Eric Carlson  <eric.carlson@apple.com>
2729
2730         [Mac] Update CARingBuffer class
2731         https://bugs.webkit.org/show_bug.cgi?id=167656
2732
2733         Unreviewed build fix after r211539.
2734
2735         * platform/audio/mac/CAAudioStreamDescription.cpp:
2736         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription): Initialize a variable to fix
2737         release builds.
2738
2739 2017-02-01  Eric Carlson  <eric.carlson@apple.com>
2740
2741         [Mac] Update CARingBuffer class
2742         https://bugs.webkit.org/show_bug.cgi?id=167656
2743
2744         Reviewed by Jer Noble.
2745
2746         API test CARingBufferTest added.
2747
2748         * WebCore.xcodeproj/project.pbxproj: Add headers to framework so they can be used from the API test.
2749
2750         * platform/audio/AudioStreamDescription.h: Add Int32.
2751
2752         * platform/audio/mac/CAAudioStreamDescription.cpp:
2753         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription):
2754         (WebCore::CAAudioStreamDescription::~CAAudioStreamDescription):
2755         (WebCore::CAAudioStreamDescription::format): Support Int32.
2756         (WebCore::CAAudioStreamDescription::operator==): Make inline.
2757         * platform/audio/mac/CAAudioStreamDescription.h:
2758
2759         * platform/audio/mac/CARingBuffer.cpp:
2760         (WebCore::CARingBuffer::CARingBuffer): Move initializers into class declaration.
2761         (WebCore::CARingBuffer::allocate): Use flush method, get allocation info from a CAAudioStreamDescription.
2762         (WebCore::FetchABL): Add a mode parameter to allow samples to replace or mix into destination.
2763         (WebCore::CARingBuffer::flush): New.
2764         (WebCore::CARingBuffer::fetch): Add mode parameter.
2765         (WebCore::CARingBuffer::~CARingBuffer): Deleted.
2766         * platform/audio/mac/CARingBuffer.h:
2767         (WebCore::CARingBuffer::~CARingBuffer):
2768
2769         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
2770         (WebCore::AudioSourceProviderAVFObjC::prepare): Use new CARingBuffer constructor.
2771         (WebCore::operator==): Deleted.
2772         (WebCore::operator!=): Deleted.
2773
2774         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
2775         (WebCore::WebAudioSourceProviderAVFObjC::prepare): Use new CARingBuffer constructor
2776         (WebCore::operator==): Deleted.
2777         (WebCore::operator!=): Deleted.
2778
2779 2017-02-01  Zalan Bujtas  <zalan@apple.com>
2780
2781         Simple line layout: Move TextFragmentIterator::runWidth to ::textWidth.
2782         https://bugs.webkit.org/show_bug.cgi?id=167705
2783         <rdar://problem/30314393>
2784
2785         Reviewed by Antti Koivisto.
2786
2787         We also don't need to compute logicalHeight for logicalLeft/right since the
2788         cases where it matters (floating boxes) are not supported by simple line layout. 
2789
2790         Covered by existing test.
2791
2792         * rendering/SimpleLineLayout.cpp:
2793         (WebCore::SimpleLineLayout::updateLineConstrains):
2794         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2795         (WebCore::SimpleLineLayout::nextBreakablePositionInSegment):
2796         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
2797         (WebCore::SimpleLineLayout::TextFragmentIterator::runWidth): Deleted.
2798         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2799
2800 2017-02-01  Jer Noble  <jer.noble@apple.com>
2801
2802         Fix compilation error under recent clang update
2803         https://bugs.webkit.org/show_bug.cgi?id=167707
2804
2805         Reviewed by Eric Carlson.
2806
2807         Include TypedArrayInlines.h to fix a "missing symbol" link error when compiling under a recent clang update.
2808
2809         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2810
2811 2017-02-01  Joseph Pecoraro  <pecoraro@apple.com>
2812
2813         Performance Timeline: Prepare for Worker support
2814         https://bugs.webkit.org/show_bug.cgi?id=167633
2815
2816         Reviewed by Ryosuke Niwa.
2817
2818         Remove references to Document/Frame in Performance. Instead use
2819         ScriptExecutionContext and pass in the time origin / SecurityOrigin
2820         where it is relevant. No tests should change this is just refactoring.
2821
2822         * loader/ResourceTimingInformation.cpp:
2823         (WebCore::ResourceTimingInformation::addResourceTiming):
2824         * page/DOMWindow.cpp:
2825         (WebCore::DOMWindow::performance):
2826         * page/Performance.cpp:
2827         (WebCore::Performance::Performance):
2828         (WebCore::Performance::now):
2829         (WebCore::Performance::reduceTimeResolution):
2830         (WebCore::Performance::navigation):
2831         (WebCore::Performance::timing):
2832         (WebCore::Performance::addResourceTiming):
2833         (WebCore::Performance::scriptExecutionContext): Deleted.
2834         * page/Performance.h:
2835         * page/Performance.idl:
2836         * page/PerformanceResourceTiming.cpp:
2837         (WebCore::monotonicTimeToDOMHighResTimeStamp):
2838         (WebCore::passesTimingAllowCheck):
2839         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
2840         (WebCore::PerformanceResourceTiming::redirectStart):
2841         (WebCore::PerformanceResourceTiming::redirectEnd):
2842         (WebCore::PerformanceResourceTiming::fetchStart):
2843         (WebCore::PerformanceResourceTiming::domainLookupStart):
2844         (WebCore::PerformanceResourceTiming::domainLookupEnd):
2845         (WebCore::PerformanceResourceTiming::connectStart):
2846         (WebCore::PerformanceResourceTiming::connectEnd):
2847         (WebCore::PerformanceResourceTiming::secureConnectionStart):
2848         (WebCore::PerformanceResourceTiming::requestStart):
2849         (WebCore::PerformanceResourceTiming::responseStart):
2850         (WebCore::PerformanceResourceTiming::responseEnd):
2851         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
2852         (WebCore::monotonicTimeToDocumentMilliseconds): Deleted.
2853         (WebCore::PerformanceResourceTiming::initiatorType): Deleted.
2854         (WebCore::PerformanceResourceTiming::resourceTimeToDocumentMilliseconds): Deleted.
2855         * page/PerformanceResourceTiming.h:
2856         * page/PerformanceUserTiming.cpp:
2857         (WebCore::UserTiming::findExistingMarkStartTime):
2858
2859 2017-02-01  Chris Dumez  <cdumez@apple.com>
2860
2861         REGRESSION(r205136): {}.toString.call(crossOriginWindow) should not throw
2862         https://bugs.webkit.org/show_bug.cgi?id=167681
2863         <rdar://problem/30301117>
2864
2865         Reviewed by Mark Lam.
2866
2867         As per https://html.spec.whatwg.org/#crossorigingetownpropertyhelper-(-o,-p-):
2868         """
2869         If P is @@toStringTag, @@hasInstance, or @@isConcatSpreadable, then return
2870         PropertyDescriptor{ [[Value]]: undefined, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
2871         """
2872
2873         We now implement this behavior instead of throwing.
2874
2875         Test: http/tests/security/symbols-cross-origin.html
2876
2877         * bindings/js/JSDOMWindowCustom.cpp:
2878         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
2879         * bindings/js/JSLocationCustom.cpp:
2880         (WebCore::JSLocation::getOwnPropertySlotDelegate):
2881
2882 2017-02-01  Brent Fulgham  <bfulgham@apple.com>
2883
2884         Correct "filesHaveSameVolume" predicate
2885         https://bugs.webkit.org/show_bug.cgi?id=167696
2886         <rdar://problem/30298722>
2887
2888         Reviewed by David Kilzer.
2889
2890         We are passing %-encoded strings to the underlying operating system's file system APIs.
2891         This doesn't work. Instead, we need to present a decoded version of the file path
2892         that matches what the system APIs expect.
2893
2894         Tested by new TestWebKitAPI Test.
2895
2896         * platform/FileSystem.cpp:
2897         (WebCore::filesHaveSameVolume): Make sure the file paths we give to the underlying
2898         operating system are not percent encoded.
2899         * platform/FileSystem.h: Export 'filesHaveSameVolume' for use by testing system.
2900
2901 2017-02-01  Antoine Quint  <graouts@apple.com>
2902
2903         [mac-wk1] LayoutTest media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html is a flaky timeout
2904         https://bugs.webkit.org/show_bug.cgi?id=165319
2905         <rdar://problem/30284104>
2906
2907         Reviewed by Dean Jackson.
2908
2909         Running media/controls/track-menu.html before media/modern-media-controls/tracks-support/tracks-
2910         support-click-track-in-panel.html makes that test time out in all test runs. The root of the issue
2911         is that animations are suspended by media/controls/track-menu.html with a call to
2912         internals.suspendAnimations(), and that state isn't reset with a call to internals.resumeAnimations().
2913         Then, media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html fails because
2914         the selection animation for the tracks panel menu item that is clicked never completes and the delegate
2915         to notify that an item in the tracks panel was selected is never fired, which leads to the test failure.
2916
2917         We change Internals::suspendAnimations() and Internals::resumeAnimations() to only affect the current
2918         document, rather than calling into AnimationController::suspendAnimations() which would do just that,
2919         but also set a Frame-wide flag that would prevent further animations from running, even in a subsequent
2920         document load.
2921
2922         * dom/Document.cpp:
2923         (WebCore::Document::prepareForDestruction): Ensure the document that is about to be destroyed is no longer
2924         associated with an AnimationController.
2925         * page/animation/AnimationController.cpp:
2926         (WebCore::AnimationControllerPrivate::ensureCompositeAnimation): Update the animation's suspend state in case
2927         the document its renderer is associated with is suspended. This is required since previously CompositeAnimations
2928         would set their suspend state in their constructor, based on the Frame-wide suspended state, but there is no
2929         document to use as a basis to query its suspended state in that constructor.
2930         (WebCore::AnimationControllerPrivate::animationsAreSuspendedForDocument):
2931         (WebCore::AnimationControllerPrivate::detachFromDocument):
2932         (WebCore::AnimationControllerPrivate::suspendAnimationsForDocument):
2933         (WebCore::AnimationControllerPrivate::resumeAnimationsForDocument):
2934         (WebCore::AnimationControllerPrivate::startAnimationsIfNotSuspended):
2935         (WebCore::AnimationController::animationsAreSuspendedForDocument):
2936         (WebCore::AnimationController::detachFromDocument):
2937         * page/animation/AnimationController.h:
2938         * page/animation/AnimationControllerPrivate.h:
2939         * testing/Internals.cpp:
2940         (WebCore::Internals::animationsAreSuspended):
2941         (WebCore::Internals::suspendAnimations):
2942         (WebCore::Internals::resumeAnimations):
2943
2944 2017-02-01  Ryan Haddad  <ryanhaddad@apple.com>
2945
2946         Unreviewed build fix after r211488.
2947
2948         * accessibility/AXObjectCache.h: Removed property svn:executable.
2949
2950 2017-02-01  Brent Fulgham  <bfulgham@apple.com>
2951
2952         Unreviewed build fix.
2953
2954         * html/HTMLMediaElement.h: Removed property svn:executable.
2955
2956 2017-02-01  Jer Noble  <jer.noble@apple.com>
2957
2958         NULL-deref crash in TextTrack::removeCue()
2959         https://bugs.webkit.org/show_bug.cgi?id=167615
2960
2961         Reviewed by Eric Carlson.
2962
2963         Test: http/tests/media/track-in-band-hls-metadata-crash.html
2964
2965         Follow-up to r211401. When passing around a reference to an object, the assumption is that
2966         the caller is retaining the underlying object. This breaks down for
2967         InbandDataTextTrack::removeDataCue(), which releases its own ownership of the cue object,
2968         then passes the reference to that object to its superclass to do further remove steps. The
2969         retain count of the cue can thus drop to zero within the scope of
2970         InbandTextTrack::removeCue(). Use "take" semantics to remove the cue from the
2971         m_incompleteCueMap without releasing ownership, and pass a reference to that retained object
2972         on to removeCue(), guaranteeing that the cue will not be destroyed until after the
2973         romeveDataCue() method returns.
2974
2975         * html/track/InbandDataTextTrack.cpp:
2976         (WebCore::InbandDataTextTrack::removeDataCue):
2977
2978 2017-02-01  Nan Wang  <n_wang@apple.com>
2979
2980         AX: Incorrect range from index and length in text controls when there are newlines
2981         https://bugs.webkit.org/show_bug.cgi?id=167677
2982         <rdar://problem/30300099>
2983
2984         Reviewed by Chris Fleizach.
2985
2986         When there are newlines in text controls, the VisiblePosition that is created
2987         from the index could be wrong. Because the index doesn't include the information 
2988         regarding a position's affinity. Fixed it by using CharacterOffset instead, since
2989         it doesn't require that information.
2990
2991         Test: accessibility/mac/range-for-contenteditable-newline.html
2992
2993         * accessibility/AXObjectCache.cpp:
2994         (WebCore::AXObjectCache::traverseToOffsetInRange):
2995         (WebCore::AXObjectCache::nextCharacterOffset):
2996         (WebCore::AXObjectCache::characterOffsetForIndex):
2997
2998 2017-02-01  Timothy Hatcher  <timothy@hatcher.name>
2999
3000         AXObjectCache is missing two functions at link time when !HAVE(ACCESSIBILITY)
3001         https://bugs.webkit.org/show_bug.cgi?id=167691
3002
3003         Reviewed by Chris Fleizach.
3004
3005         * accessibility/AXObjectCache.h:
3006         (WebCore::AXObjectCache::recomputeDeferredIsIgnored): Added empty stub.
3007         (WebCore::AXObjectCache::performDeferredIsIgnoredChange): Added empty stub.
3008
3009 2017-02-01  Timothy Hatcher  <timothy@hatcher.name>
3010
3011         HTMLMediaElement.h fails to build when ENABLE(MEDIA_CONTROLS_SCRIPT) is false
3012         https://bugs.webkit.org/show_bug.cgi?id=167689
3013
3014         Reviewed by Joseph Pecoraro.
3015
3016         * html/HTMLMediaElement.h: Move mediaControlsHost() into the ENABLE(MEDIA_CONTROLS_SCRIPT)
3017         block that is just above it to match m_mediaControlsHost.
3018
3019 2017-02-01  Romain Bellessort  <romain.bellessort@crf.canon.fr>
3020
3021         [Readable Streams API] Implement ReadableByteStreamController pull()
3022         https://bugs.webkit.org/show_bug.cgi?id=167593
3023
3024         Reviewed by Youenn Fablet.
3025
3026         Implemented pull() method for ReadableByteStreamController. Also updated
3027         pendingPullIntos attribute, which was a more complex object than necessary
3028         (an array is enough).
3029
3030         Added 2 tests that allow covering most of new code. Code not yet tested will
3031         become reachable as the rest of the spec is implemented (new tests will then
3032         be added).
3033
3034         * Modules/streams/ReadableByteStreamInternals.js:
3035         (privateInitializeReadableByteStreamController): Updated pendingPullIntos.
3036         (readableByteStreamControllerCancel): Updated pendingPullIntos.
3037         (readableByteStreamControllerClose): Updated pendingPullIntos.
3038         (readableByteStreamControllerHandleQueueDrain): Added.
3039         (readableByteStreamControllerPull): Added.
3040
3041 2017-02-01  Enrique Ocaña González  <eocanha@igalia.com>
3042
3043         [GStreamer][MSE] qtdemux: Update the tfdt patch to the version finally accepted upstream
3044         https://bugs.webkit.org/show_bug.cgi?id=166529
3045
3046         Reviewed by Xabier Rodriguez-Calvar.
3047
3048         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3049         (WebCore::AppendPipeline::AppendPipeline): Don't use the "always-honor-tfdt" property
3050         in qtdemux anymore.
3051
3052 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
3053
3054         Unreviewed, build fix for macOS and iOS ports, part 2
3055
3056         Annotate the function with static.
3057
3058         * bindings/js/ScriptModuleLoader.cpp:
3059         (WebCore::rejectToPropagateNetworkError):
3060
3061 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
3062
3063         Unreviewed, build fix for macOS and iOS ports
3064
3065         * bindings/js/ModuleFetchFailureKind.h: Renamed from Source/ModuleFetchFailureKind.h.
3066
3067 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
3068
3069         Propagate networking errors correctly for import() operator
3070         https://bugs.webkit.org/show_bug.cgi?id=167501
3071
3072         Reviewed by Ryosuke Niwa.
3073
3074         We use the promise chain inside the module loader pipeline.
3075         The problem is that,
3076
3077         1. The errors of loading module scripts are propagated through the promise's rejection.
3078         2. Some module related errors like syntax error (when scanning module dependencies) are
3079            reported at loading time (evaluating time). These errors are propagated through the
3080            promise rejections and dumped to the console. LoadableModuleScript set catch handler
3081            for that and print these errors to the console for ScriptElement.
3082         3. Some of errors are already reported to the console. For example, networking errors
3083            are reported by the CachedModuleLoader.
3084         4. But there is no way to distinguish between (2) and (3) at the catch handler.
3085
3086         Previously, we propagate the special symbol for the already reported errors to distinguish
3087         that. This was OK because these errors cannot be catched by the user code. However,
3088         recent `import()` call needs to expose these errors to the user code. So now, accidentally,
3089         the special purpose symbol is exposed.
3090
3091         Instead of propagating the special symbol, this patch just propagates the errors. But these
3092         error objects are annotated with the private symbol. So these errors can be distinguished
3093         from the other ones.
3094
3095         Currently, we do not have the way to expose the error details to the client of the
3096         CachedScript. So we just report the error with the failed / canceled. This should be
3097         more descriptive error messages in the separate patch[1].
3098
3099         [1]: https://bugs.webkit.org/show_bug.cgi?id=167553
3100
3101         Tests: http/tests/security/mixedContent/import-insecure-script-in-iframe.html
3102                js/dom/modules/import-not-found-error.html
3103
3104         * WebCore.xcodeproj/project.pbxproj:
3105         * bindings/js/JSDOMPromise.h:
3106         (WebCore::DeferredPromise::resolveWithCallback):
3107         (WebCore::DeferredPromise::rejectWithCallback):
3108         * bindings/js/ScriptController.cpp:
3109         (WebCore::ScriptController::setupModuleScriptHandlers):
3110         * bindings/js/ScriptController.h:
3111         (WebCore::ScriptController::moduleLoaderAlreadyReportedErrorSymbol): Deleted.
3112         (WebCore::ScriptController::moduleLoaderFetchingIsCanceledSymbol): Deleted.
3113         * bindings/js/ScriptModuleLoader.cpp:
3114         (WebCore::rejectToPropagateNetworkError):
3115         (WebCore::ScriptModuleLoader::fetch):
3116         (WebCore::ScriptModuleLoader::notifyFinished):
3117         * bindings/js/WebCoreBuiltinNames.h:
3118
3119 2017-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
3120
3121         Regression (Safari 10.1): Pressing Return in a contenteditable no longer inserts a line break under certain conditions
3122         https://bugs.webkit.org/show_bug.cgi?id=167525
3123         <rdar://problem/30270210>
3124
3125         Reviewed by Ryosuke Niwa.
3126
3127         Test: fast/events/input-events-insert-newlines-after-mutation.html
3128
3129         Reverts an unintended change made while refactoring code for input events that caused input events to be
3130         dispatched immediately rather than on the scoped queue. Normally, input events are dispatched in
3131         CompositeEditCommand::apply after the end of the scope, but TypingCommands may fire input events *from within*
3132         the scope by calling typingAddedToOpenCommand.
3133
3134         Instead, TypingCommands should always dispatch events
3135         synchronously after the end of the scoped queue in CompositeEditCommand::apply, but this is a riskier change
3136         than we should currently allow, so we should revert to our old behavior for the time being.
3137
3138         * editing/Editor.cpp:
3139
3140 2017-01-31  Zalan Bujtas  <zalan@apple.com>
3141
3142         Simple line layout: Do not assert on zero length/width trailing whitespace.
3143         https://bugs.webkit.org/show_bug.cgi?id=167679
3144
3145         Reviewed by Simon Fraser.
3146
3147         It's valid to have an zero length/width trailing whitespace.
3148
3149         Covered by existing tests.
3150
3151         * rendering/SimpleLineLayout.cpp:
3152         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace): Zero length -> nothing to do.
3153         Zero width with length > 0 (font-size: 0) -> remove trailing run.
3154
3155 2017-01-31  Alex Christensen  <achristensen@webkit.org>
3156
3157         Fix debug libwebrtc build after r211439
3158         https://bugs.webkit.org/show_bug.cgi?id=167572
3159
3160         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
3161         (WebCore::LibWebRTCAudioModule::OnMessage):
3162
3163 2017-01-31  Zalan Bujtas  <zalan@apple.com>
3164
3165         Simple line layout: Collect fragments in LineState only when needed for post-processing.
3166         https://bugs.webkit.org/show_bug.cgi?id=167655
3167         <rdar://problem/30290592>
3168
3169         Reviewed by Antti Koivisto.
3170
3171         The fragments we need to keep around for basic line breaking are the last and last non-whitespace fragments.
3172         However in certain cases such as text-align: justify, we have to traverse the entire line
3173         at post-processing which requires all the fragments on the current line.
3174         This patch speeds up the basic line handling by using m_fragment list only for the special cases.
3175         It improves PerformanceTests/Layout/simple-line-layout-non-repeating-text.html by ~7% (local measurement)
3176         median: 114.25 runs/s -> median: 122.16 runs
3177
3178         Covered by existing tests.
3179
3180         * rendering/SimpleLineLayout.cpp:
3181         (WebCore::SimpleLineLayout::LineState::setNeedsAllFragments):
3182         (WebCore::SimpleLineLayout::LineState::hasTrailingWhitespace):
3183         (WebCore::SimpleLineLayout::LineState::lastFragment):
3184         (WebCore::SimpleLineLayout::LineState::expansionOpportunityCount):
3185         (WebCore::SimpleLineLayout::LineState::isEmpty):
3186         (WebCore::SimpleLineLayout::LineState::endPositionForCollapsedFragment):
3187         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded): Track uncompleted width.
3188         (WebCore::SimpleLineLayout::LineState::revertToLastCompleteFragment):
3189         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace):
3190         (WebCore::SimpleLineLayout::removeTrailingWhitespace):
3191         (WebCore::SimpleLineLayout::updateLineConstrains): Set the slow path for text-align: justify.
3192         (WebCore::SimpleLineLayout::createLineRuns):
3193         (WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns):
3194         (WebCore::SimpleLineLayout::createTextRuns):
3195         * rendering/SimpleLineLayoutTextFragmentIterator.h:
3196         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isValid):
3197         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::length):
3198
3199 2017-01-31  Chris Dumez  <cdumez@apple.com>
3200
3201         com.apple.WebKit.WebContent.Development crashed in com.apple.WebCore: WebCore::FrameView::didDestroyRenderTree
3202         https://bugs.webkit.org/show_bug.cgi?id=167665
3203         <rdar://problem/30241193>
3204
3205         Reviewed by Andreas Kling.
3206
3207         When destroying a PageCache entry, we would call Document::prepareFromDestruction()
3208         which would destroy the render tree and then call FrameView::didDestroyRenderTree().
3209         We would sometimes hit the ASSERT(m_widgetsInRenderTree.isEmpty()) assertion in
3210         didDestroyRenderTree(). This indicates that there are still RenderWidgets associated
3211         with the FrameView even though we claim we already destroyed the render tree.
3212
3213         The reason for this is that, in the PageCache context, the top document's frame is
3214         reused on navigation and may not be associated with a new document that is currently
3215         displayed, has a render tree (and possible RenderWidgets). The solution proposed is
3216         to stop calling FrameView::didDestroyRenderTree() in Document::prepareFromDestruction()
3217         if the frame's document is not |this|. This happens when the document is destroyed
3218         while in PageCache. We do not want to mess with the frame / frameview in this case
3219         since they are no longer associated to the present document anymore.
3220
3221         No new tests, already covered by existing tests which currently crash flakily.
3222
3223         * dom/Document.cpp:
3224         (WebCore::Document::destroyRenderTree):
3225
3226 2017-01-31  Sam Weinig  <sam@webkit.org>
3227
3228         Remove unused/rarely used bindings helpers
3229         https://bugs.webkit.org/show_bug.cgi?id=167648
3230
3231         Reviewed by Anders Carlsson.
3232
3233         * bindings/js/JSDOMBinding.cpp:
3234         * bindings/js/JSDOMBinding.h:
3235         (WebCore::jsString): Deleted.
3236         (WebCore::jsStringOrUndefined): Deleted.
3237         (WebCore::finiteInt32Value): Deleted.
3238         (WebCore::toJS): Deleted.
3239         Remove unused functions. The toJS overrides can be replaced with their
3240         modern JSDOMConvert counterparts.
3241         
3242         * bindings/js/JSDOMExceptionHandling.h:
3243         (WebCore::toJS): Deleted.
3244         (WebCore::toJSNewlyCreated): Deleted.
3245         Remove unused functions.
3246
3247         * bindings/js/JSDOMIterator.h:
3248         Add more specific include of JSDOMConvert.h to fix compile.
3249
3250         * bindings/js/JSDOMPromise.cpp:
3251         (WebCore::DeferredPromise::reject):
3252         Create the Symbol directly, instead of using the toJS override.
3253
3254         * bindings/js/JSWorkerCustom.cpp:
3255         (WebCore::constructJSWorker):
3256         Use JSDOMConvert toJS function.
3257
3258         * bindings/js/JSXMLHttpRequestCustom.cpp:
3259         (WebCore::JSXMLHttpRequest::retrieveResponse):
3260         Use JSDOMConvert toJS functions.
3261
3262         * bindings/js/ScriptController.h:
3263         Add missing forward declaration of URL.
3264
3265         * bindings/js/ScriptModuleLoader.cpp:
3266         (WebCore::ScriptModuleLoader::resolve):
3267         Create the Symbol directly, instead of using the toJS override.
3268
3269         * html/HTMLPlugInImageElement.cpp:
3270         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
3271         Use JSDOMConvert toJS functions.
3272
3273 2017-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
3274
3275         WebItemProviderPasteboard should be robust when UIItemProvider fails to initialize an object
3276         https://bugs.webkit.org/show_bug.cgi?id=167663
3277         <rdar://problem/30294240>
3278
3279         Reviewed by Tim Horton.
3280
3281         Adds a nil check for the result of -createObjectOfClass:error:.
3282
3283         * platform/ios/WebItemProviderPasteboard.mm:
3284         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
3285         (-[WebItemProviderPasteboard _tryToCreateAndAppendObjectOfClass:toArray:usingProvider:]):
3286
3287 2017-01-31  Keith Rollin  <krollin@apple.com>
3288
3289         Variable used after it's been WTFMove'd
3290         https://bugs.webkit.org/show_bug.cgi?id=167658
3291
3292         Reviewed by Chris Dumez.
3293
3294         Rather than WTFMoving the variable as part of passing it to a function
3295         that takes an RValue-ref, call copyRef to provide the RValue-ref. This
3296         preserves the original variable for later use in the function.
3297
3298         No new tests -- this issue was found by inspection. It's not apparent
3299         what the side-effect of this bug is or how a test would verify it.
3300
3301         * loader/SubresourceLoader.cpp:
3302         (WebCore::SubresourceLoader::didReceiveDataOrBuffer):
3303
3304 2017-01-31  Anders Carlsson  <andersca@apple.com>
3305
3306         Apple Pay button does nothing on nytimes.com
3307         https://bugs.webkit.org/show_bug.cgi?id=167664
3308         rdar://problem/30273885
3309
3310         Reviewed by Sam Weinig.
3311
3312         Separate line item validation into convertAndValidateTotal and convertAndValidate. The former
3313         works on totals (which require an amount), and the latter works on regular line items that do not require an amount
3314         if the item type is "pending".
3315
3316         * Modules/applepay/ApplePaySession.cpp:
3317         (WebCore::convertAndValidateTotal):
3318         (WebCore::convertAndValidate):
3319         Only check the amount if the type is not pending.
3320
3321         (WebCore::ApplePaySession::completeShippingMethodSelection):
3322         (WebCore::ApplePaySession::completeShippingContactSelection):
3323         (WebCore::ApplePaySession::completePaymentMethodSelection):
3324         Call convertAndValidateTotal for totals.
3325
3326 2017-01-31  Youenn Fablet  <youenn@apple.com>
3327
3328         [WebRTC] Add a libwebrtc AudioModule specific to WebKit
3329         https://bugs.webkit.org/show_bug.cgi?id=167572
3330
3331         Reviewed by Alex Christensen.
3332
3333         To be covered by webrtc audio tests.
3334         Adding an AudioModule to circumvent the default LibWebRTC Audio Module which does the audio directly.
3335         The implementation of the AudioModule is restricted to enable fueling the incoming audio tracks with incoming data.
3336         Code inspired from https://chromium.googlesource.com/chromium/src/+/master/remoting/protocol/webrtc_audio_module.h
3337
3338         * WebCore.xcodeproj/project.pbxproj:
3339         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp: Added.
3340         (WebCore::LibWebRTCAudioModule::LibWebRTCAudioModule):
3341         (WebCore::LibWebRTCAudioModule::RegisterAudioCallback):
3342         (WebCore::LibWebRTCAudioModule::OnMessage):
3343         (WebCore::LibWebRTCAudioModule::StartPlayout):
3344         (WebCore::LibWebRTCAudioModule::StopPlayout):
3345         (WebCore::LibWebRTCAudioModule::StartPlayoutOnAudioThread):
3346         (WebCore::LibWebRTCAudioModule::PollFromSource):
3347         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: Added.
3348         * platform/mediastream/libwebrtc/LibWebRTCUtils.cpp:
3349         (WebCore::ThreadMessageData::ThreadMessageData):
3350         (WebCore::initializePeerConnectionFactoryAndThreads):
3351
3352 2017-01-31  Jessie Berlin  <jberlin@webkit.org>
3353
3354         Build fix.
3355
3356         * editing/mac/EditorMac.mm:
3357         (WebCore::Editor::pasteWithPasteboard):
3358         (WebCore::Editor::takeFindStringFromSelection):
3359         (WebCore::Editor::replaceNodeFromPasteboard):
3360         * page/mac/EventHandlerMac.mm:
3361         (WebCore::EventHandler::createDraggingDataTransfer):
3362         * platform/mac/PasteboardMac.mm:
3363         (WebCore::Pasteboard::createForCopyAndPaste):
3364         (WebCore::Pasteboard::createForDragAndDrop):
3365
3366 2017-01-31  Eric Carlson  <eric.carlson@apple.com>
3367
3368         [Mac] Add an audio stream description class
3369         https://bugs.webkit.org/show_bug.cgi?id=167639
3370
3371         Reviewed by Youenn Fablet.
3372
3373         No new tests, the new class is not used yet.
3374
3375         * WebCore.xcodeproj/project.pbxproj:
3376         * platform/audio/AudioStreamDescription.h: Added.
3377         (WebCore::AudioStreamDescription::isPCM):
3378         * platform/audio/mac/CAAudioStreamDescription.cpp: Added.
3379         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription):
3380         (WebCore::CAAudioStreamDescription::platformDescription):
3381         (WebCore::CAAudioStreamDescription::format):
3382         (WebCore::toCAAudioStreamDescription):
3383         (WebCore::CAAudioStreamDescription::operator==):
3384         (WebCore::operator==):
3385         * platform/audio/mac/CAAudioStreamDescription.h: Added.
3386         (WebCore::operator!=):
3387         (WebCore::CAAudioStreamDescription::bytesPerFrame):
3388         (WebCore::CAAudioStreamDescription::bytesPerPacket):
3389         (WebCore::CAAudioStreamDescription::formatFlags):
3390         (WebCore::CAAudioStreamDescription::operator==):
3391         (WebCore::CAAudioStreamDescription::operator!=):
3392         (WebCore::CAAudioStreamDescription::streamDescription):
3393
3394 2017-01-31  Youenn Fablet  <youenn@apple.com>
3395
3396         RTCPeerConnection methods can take dictionaries as input
3397        &n