Avoid a redundant scroll to 0,0 when navigating back to a url with no fragment
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-02-11  Simon Fraser  <simon.fraser@apple.com>
2
3         Avoid a redundant scroll to 0,0 when navigating back to a url with no fragment
4         https://bugs.webkit.org/show_bug.cgi?id=168177
5
6         Reviewed by Sam Weinig.
7
8         FrameView::scrollToFragment() is called from FrameLoader::scrollToFragmentWithParentBoundary()
9         when navigating within the page. If the URL had no fragment identifier, this code would
10         call into FrameView::scrollToAnchor() with an empty name, where maintainScrollPositionAtAnchor()
11         used the document as the anchor, thus scrolling to 0,0. Later, history().restoreScrollPositionAndViewState()
12         the restores the scroll position from history.
13         
14         This scroll to 0,0 happened to be not visible to the page because of scroll event
15         coalescing, but it makes implementation of history.scrollRestoration harder, so avoid it
16         by just returning early from FrameView::scrollToFragment() if there is no fragment,
17         making sure to clear the document's CSSTarget.
18
19         * dom/Document.cpp:
20         (WebCore::Document::setCSSTarget):
21         * page/FrameView.cpp:
22         (WebCore::FrameView::scrollToFragment):
23         (WebCore::FrameView::scrollToAnchor):
24
25 2017-02-11  Chris Dumez  <cdumez@apple.com>
26
27         Implement URL's toJSON()
28         https://bugs.webkit.org/show_bug.cgi?id=167979
29
30         Reviewed by Sam Weinig.
31
32         Implement URL's toJSON() as per:
33         - https://url.spec.whatwg.org/#dom-url-tojson
34
35         This is already supported by Firefox.
36
37         Also, drop URLUtils.idl as it is no longer in the specification.
38         Merge its content to DOMURL.idl as per the URL specification.
39
40         Finally, mark href attribute as stringifier and drop the toString()
41         operation to match the specification. This fixes a bug where our
42         toString property was not enumerable but should have been.
43
44         Tests: fast/url/url-tojson.html
45                imported/w3c/web-platform-tests/url/url-tojson.html
46
47         * CMakeLists.txt:
48         * DerivedSources.make:
49         * WebCore.xcodeproj/project.pbxproj:
50         * html/DOMURL.idl:
51         * html/URLUtils.h:
52         (WebCore::URLUtils<T>::toJSON):
53         * html/URLUtils.idl: Removed.
54
55 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
56
57         [GTK][EFL] Implement MIMETypeRegistry::getPreferredExtensionForMIMEType
58         https://bugs.webkit.org/show_bug.cgi?id=168163
59
60         Reviewed by Michael Catanzaro.
61
62         It's missing causing several HTML anchor download tests to fail because the suggested filename missed the
63         extension. This patch moves MIMETypeRegistry::appendFileExtensionIfNecessary() from the cocoa specific file to the
64         common file because it's not actually platform specific. MIMETypeRegistry::getPreferredExtensionForMIMEType() is
65         what platforms should implement.
66
67         Fixes: fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html
68                fast/dom/HTMLAnchorElement/anchor-download.html
69                fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
70                fast/dom/HTMLAnchorElement/anchor-nodownload-set.html
71
72         * platform/MIMETypeRegistry.cpp:
73         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
74         * platform/cocoa/MIMETypeRegistryCocoa.mm:
75         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary): Deleted.
76         * platform/efl/MIMETypeRegistryEfl.cpp:
77         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
78         * platform/gtk/MIMETypeRegistryGtk.cpp:
79         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
80
81 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
82
83         Unreviewed. Update imageTitle translatable string.
84
85         To match mac port. Fixes fast/images/imageDocument-title.html.
86
87         * platform/gtk/LocalizedStringsGtk.cpp:
88         (WebCore::imageTitle):
89
90 2017-02-10  John Wilander  <wilander@apple.com>
91
92         Updates to Resource Load Statistics: Get the right website data store and introduce timeout for user interaction
93         https://bugs.webkit.org/show_bug.cgi?id=167474
94         <rdar://problem/24681808>
95         <rdar://problem/24703286>
96         <rdar://problem/30290270>
97
98         This patch does the following:
99         1. Gets the right website data store. API::WebsiteDataStore::defaultDataStore()
100             does not provide the right data store.
101         2. Introduces timeout for user interaction. A domain needs interaction every 30
102             days to stay in that category.
103         3. Adds grandfathered to the statistics model in preparation for grandfathering of
104             existing data records.
105         4. Adds test infrastructure to allow testing of the various rules in place for
106             data records removal.
107         5. Fixes various smaller bugs that were found as part of setting up the tests.
108         6. Regresses the data records removal counting. We need to come up with a thread
109             safe way of gathering removal statistics from more than one data store now
110             that we potentially interact with multiple stores.
111         7. Adds a first set of layout tests for resource load statistics.
112
113         Reviewed by Andy Estes.
114
115         Tests: http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html
116                http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html
117                http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html
118                http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html
119                http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html
120
121         * dom/Document.cpp:
122         (WebCore::Document::updateLastHandledUserGestureTimestamp):
123             This now calls ResourceLoadObserver::logUserInteraction() every time since
124             we want to keep track of the most recent user interaction.
125         * loader/ResourceLoadObserver.cpp:
126         (WebCore::ResourceLoadObserver::statisticsStore):
127             New getter used by WebResourceLoadStatisticsManager::resetToConsistentState().
128         (WebCore::reduceTimeResolutionToOneDay):
129             Convenience function.
130         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
131             Reduces time resolution for privacy reasons.
132         (WebCore::ResourceLoadObserver::logUserInteraction):
133         (WebCore::ResourceLoadObserver::clearUserInteraction):
134         (WebCore::ResourceLoadObserver::hasHadUserInteraction):
135         (WebCore::ResourceLoadObserver::setPrevalentResource):
136         (WebCore::ResourceLoadObserver::isPrevalentResource):
137         (WebCore::ResourceLoadObserver::clearPrevalentResource):
138         (WebCore::ResourceLoadObserver::setTimeToLiveUserInteraction):
139         (WebCore::ResourceLoadObserver::fireDataModificationHandler):
140             New functions that allow WebKitTestRunner to stage exact
141             statistics, fire the handler, and test the outcome.
142         * loader/ResourceLoadObserver.h:
143         * loader/ResourceLoadStatistics.cpp:
144         (WebCore::ResourceLoadStatistics::encode):
145         (WebCore::ResourceLoadStatistics::decode):
146         (WebCore::ResourceLoadStatistics::toString):
147         (WebCore::ResourceLoadStatistics::merge):
148             Support for statistics mostRecentUserInteraction, grandfathered, and
149             dataRecordsRemoved.
150         * loader/ResourceLoadStatistics.h:
151         * loader/ResourceLoadStatisticsStore.cpp:
152         (WebCore::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
153             New function that allows WebKitTestRunner to test 
154             aging out of user interaction.
155         (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
156             Now takes into account the timestamp and ages
157             out user interaction.
158         (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction):
159             Now makes use of ResourceLoadStatisticsStore::hasHadRecentUserInteraction().
160         * loader/ResourceLoadStatisticsStore.h:
161
162 2017-02-10  Sam Weinig  <sam@webkit.org>
163
164         [WebIDL] Cleanup XMLHttpRequest's bindings
165         https://bugs.webkit.org/show_bug.cgi?id=168067
166
167         Reviewed by Chris Dumez.
168
169         * bindings/js/JSDOMBinding.cpp:
170         (WebCore::jsOwnedStringOrNull): Deleted.
171         * bindings/js/JSDOMBinding.h:
172         Remove jsOwnedStringOrNull and inline it into it's one use
173         in JSXMLHttpRequestCustom.
174
175         * bindings/js/JSXMLHttpRequestCustom.cpp:
176         (WebCore::JSXMLHttpRequest::responseText):
177         (WebCore::SendFunctor::SendFunctor): Deleted.
178         (WebCore::SendFunctor::line): Deleted.
179         (WebCore::SendFunctor::column): Deleted.
180         (WebCore::SendFunctor::url): Deleted.
181         (WebCore::SendFunctor::operator()): Deleted.
182         (WebCore::JSXMLHttpRequest::send): Deleted.
183         * xml/XMLHttpRequest.cpp:
184         (WebCore::XMLHttpRequest::send):
185         * xml/XMLHttpRequest.h:
186         Remove custom send, replacing it with a single send implementation that
187         takes a variant.
188
189         * xml/XMLHttpRequest.idl:
190         Cleanup the IDL to better match the spec. Update correct types where trivial.
191
192 2017-02-10  Chris Dumez  <cdumez@apple.com>
193
194         document.origin doesn't match spec
195         https://bugs.webkit.org/show_bug.cgi?id=168022
196
197         Reviewed by Sam Weinig.
198
199         Update document.origin to return the origin in the expected format:
200         - https://dom.spec.whatwg.org/#dom-document-origin
201
202         Change: "https_webkit.org_0 -> "https://webkit.org".
203
204         The new behavior matches Firefox and Chrome.
205
206         No new tests, updated existing tests.
207
208         * dom/Document.cpp:
209         (WebCore::Document::origin):
210
211 2017-02-10  Daniel Bates  <dabates@apple.com>
212
213         Attempt to fix the build following <https://trac.webkit.org/changeset/212173>
214         (https://bugs.webkit.org/show_bug.cgi?id=166774)
215
216         * dom/Document.cpp:
217         (WebCore::Document::detachFromCachedFrame): Use ASSER_UNUSED() instead of ASSERT() since
218         the parameter cachedFrame is unused in non-debug build.
219
220 2017-02-10  Daniel Bates  <dabates@apple.com>
221
222         Detach frame from document when entering page cache
223         https://bugs.webkit.org/show_bug.cgi?id=166774
224         <rdar://problem/29904368>
225
226         Reviewed by Chris Dumez.
227
228         When a page enters the page cache it is unnecessary for it to hold a reference to its
229         associated frame because subsequent interactions with the page do not need to make use
230         of it. Once a page exits the page cache we associate it with its frame.
231
232         * dom/Document.cpp:
233         (WebCore::Document::frameDestroyed): Update comment to reflect the renaming of disconnectFromFrame().
234         (WebCore::Document::attachToCachedFrame): Added.
235         (WebCore::Document::detachFromCachedFrame): Added.
236         (WebCore::Document::prepareForDestruction): Only call CSSAnimationController::detachFromDocument() if
237         we have a frame. Substitute detachFromFrame() for disconnectFromFrame() as the latter was renamed to
238         the former.
239         (WebCore::Document::hasEverCalledWindowOpen): Deleted.
240         (WebCore::Document::markHasCalledWindowOpen): Deleted.
241         (WebCore::Document::disconnectFromFrame): Renamed to detachFromFrame.
242         * dom/Document.h:
243         (WebCore::Document::detachFromFrame): Renamed; formerly named disconnectFromFrame(). Changed
244         visibility from public to private and made this function inline.
245         * history/CachedFrame.cpp:
246         (WebCore::CachedFrameBase::pruneDetachedChildFrames): Remove cached child frames that were
247         removed from the page when it was in the page cache as there is no need to restore such frames.
248         (WebCore::CachedFrameBase::restore): Call pruneDetachedChildFrames() before restoring the
249         frame tree.
250         (WebCore::CachedFrame::CachedFrame): Detach from the frame.
251         (WebCore::CachedFrame::open): Assert that we have a document and re-attach the frame.
252         (WebCore::CachedFrame::destroy): Update assertion as this function should only be called for a
253         frameless document. Only detach the FrameView, DocumentLoader, and Page when the cached frame is for
254         subframe and is associated with a Page object. Call CSSAnimationController::detachFromDocument() to
255         detach the animation controller from the document as it is being destroyed. We have to do this here
256         because the document does not have a frame. And Document::prepareForDestruction() only calls
257         CSSAnimationController::detachFromDocument() if the document has a frame.
258         * history/CachedFrame.h:
259         * history/PageCache.cpp:
260         (WebCore::canCachePage): Remove logic that prevents caching of a page that called window.open()
261         or has an opener as it is feasible to keep such pages in the page cache.
262         * html/HTMLFrameElementBase.cpp:
263         (WebCore::HTMLFrameElementBase::finishedInsertingSubtree): Fix style nit.
264         * loader/FrameLoader.cpp:
265         (WebCore::FrameLoader::frameDetached): Only stop all loaders and stop active DOM objects if the
266         page is not in- or about to enter- the page cache. A page in the page cache has finished loading
267         and its active DOM objects are suspended. Also fix style nit in comment.
268         (WebCore::FrameLoader::detachFromParent): Only stop all loaders if the page is not in- or about to
269         enter- the page cache. A page in the page cache has finished loading. Also added a comment to explain
270         that we protect the frame because stopAllLoaders() can cause the frame to be deallocated.
271         * page/DOMWindow.cpp:
272         (WebCore::DOMWindow::createWindow): Remove logic to call markHasCalledWindowOpen() as this
273         function will be removed.
274         * page/DiagnosticLoggingKeys.cpp:
275         (WebCore::DiagnosticLoggingKeys::hasCalledWindowOpenKey): Deleted.
276         (WebCore::DiagnosticLoggingKeys::hasOpenerKey): Deleted.
277         * page/DiagnosticLoggingKeys.h:
278         * page/Page.cpp:
279         (WebCore::Page::openedByWindowOpen): Deleted.
280         * page/Page.h:
281         * page/Settings.in: Remove setting allowsPageCacheWithWindowOpener.
282
283 2017-02-10  Simon Fraser  <simon.fraser@apple.com>
284
285         REGRESSION (r211845): [ios-simulator] LayoutTest compositing/masks/solid-color-masked.html is a flaky failure
286         https://bugs.webkit.org/show_bug.cgi?id=168054
287
288         Reviewed by Tim Horton.
289
290         When adding mask layers, there was an ordering dependency. There was a hack in GraphicsLayerCA::setVisibleAndCoverageRects()
291         to propagate m_intersectsCoverageRect to masks. However, if GraphicsLayerCA::setVisibleAndCoverageRects()
292         ran on the masked layer before the mask was added, nothing updated the "m_intersectsCoverageRect" state of the mask layer.
293
294         Fix by explicitly calling setVisibleAndCoverageRects() on the mask layer, passing the same rects and
295         viewport-constrained state as for its host layer (we already assume that their geometry matches).
296
297         Tested by compositing/masks/solid-color-masked.html
298
299         * platform/graphics/ca/GraphicsLayerCA.cpp:
300         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
301         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
302
303 2017-02-10  Commit Queue  <commit-queue@webkit.org>
304
305         Unreviewed, rolling out r212154, r212154, and r212156.
306         https://bugs.webkit.org/show_bug.cgi?id=168156
307
308         broke internal builds (Requested by smfr on #webkit).
309
310         Reverted changesets:
311
312         "Add a DragImage class that wraps a DragImageRef"
313         https://bugs.webkit.org/show_bug.cgi?id=168131
314         http://trac.webkit.org/changeset/212154
315
316         "Add a DragImage class that wraps a DragImageRef"
317         https://bugs.webkit.org/show_bug.cgi?id=168131
318         http://trac.webkit.org/changeset/212154
319
320         "Try to fix the iOS and Windows builds."
321         http://trac.webkit.org/changeset/212156
322
323 2017-02-10  Csaba Osztrogon√°c  <ossy@webkit.org>
324
325         Fix the !ENABLE(WEBGL) build
326         https://bugs.webkit.org/show_bug.cgi?id=168112
327
328         Reviewed by Alex Christensen.
329
330         * html/canvas/WebGLRenderingContextBase.h:
331
332 2017-02-10  Youenn Fablet  <youenn@apple.com>
333
334         [Fetch API] fetch fails when undefined is passed as headers
335         https://bugs.webkit.org/show_bug.cgi?id=168043
336
337         Reviewed by Geoffrey Garen.
338
339         Covered by updated test.
340
341         * Modules/fetch/FetchInternals.js:
342         (fillFetchHeaders): Exit early in case of undefined headers, since it is an optional parameter.
343
344 2017-02-10  Csaba Osztrogon√°c  <ossy@webkit.org>
345
346         Fix the !ENABLE(WEB_TIMING) build
347         https://bugs.webkit.org/show_bug.cgi?id=168113
348
349         Reviewed by Alex Christensen.
350
351         * workers/WorkerGlobalScope.cpp:
352         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
353
354 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
355
356         Update features.json for Performance Timing APIs
357         https://bugs.webkit.org/show_bug.cgi?id=168148
358
359         Reviewed by Simon Fraser.
360
361         * features.json:
362
363 2017-02-10  Anders Carlsson  <andersca@apple.com>
364
365         Try to fix the iOS and Windows builds.
366
367         * platform/ios/DragImageIOS.mm:
368         (WebCore::deleteDragImage):
369         * platform/win/PasteboardWin.cpp:
370         (WebCore::Pasteboard::setDragImage):
371
372 2017-02-10  Anders Carlsson  <andersca@apple.com>
373
374         Add a DragImage class that wraps a DragImageRef
375         https://bugs.webkit.org/show_bug.cgi?id=168131
376
377         Reviewed by Beth Dakin.
378
379         This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
380         various drag code paths possible. No functionality change.
381
382         * dom/DataTransfer.cpp:
383         (WebCore::DataTransfer::updateDragImage):
384         * page/DragController.cpp:
385         (WebCore::DragController::startDrag):
386         (WebCore::DragController::doImageDrag):
387         (WebCore::DragController::doSystemDrag):
388         * page/DragController.h:
389         * platform/DragImage.cpp:
390         (WebCore::DragImage::DragImage):
391         (WebCore::DragImage::operator=):
392         (WebCore::DragImage::~DragImage):
393         * platform/DragImage.h:
394         * platform/Pasteboard.h:
395         * platform/StaticPasteboard.h:
396         * platform/mac/PasteboardMac.mm:
397         (WebCore::Pasteboard::setDragImage):
398
399 2017-02-10  Simon Fraser  <simon.fraser@apple.com>
400
401         Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections
402         https://bugs.webkit.org/show_bug.cgi?id=168127
403         rdar://problem/30467120
404
405         Reviewed by Tim Horton.
406         
407         Replace the special-case, but wrong, GraphicsLayer traversal in setIsInWindowIncludingDescendants()
408         which forgot to hit masks and replica layers with a generic traverse() function, which
409         is then used for setting 'inWindow' as well as resetting tracked repaints.
410
411         Tests: compositing/tiling/tiled-mask-inwindow.html
412                compositing/tiling/tiled-reflection-inwindow.html
413
414         * page/PageOverlayController.cpp:
415         (WebCore::PageOverlayController::layerWithDocumentOverlays):
416         (WebCore::PageOverlayController::layerWithViewOverlays):
417         * platform/graphics/GraphicsLayer.cpp:
418         (WebCore::GraphicsLayer::setIsInWindow):
419         (WebCore::GraphicsLayer::setReplicatedByLayer):
420         (WebCore::GraphicsLayer::traverse):
421         (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): Deleted.
422         * platform/graphics/GraphicsLayer.h:
423         * rendering/RenderLayerCompositor.cpp:
424         (WebCore::RenderLayerCompositor::setIsInWindow):
425         (WebCore::RenderLayerCompositor::resetTrackedRepaintRects):
426         (WebCore::resetTrackedRepaintRectsRecursive): Deleted.
427
428 2017-02-09  Simon Fraser  <simon.fraser@apple.com>
429
430         Tiled layers are sometimes left with some tiles when outside the viewport
431         https://bugs.webkit.org/show_bug.cgi?id=168104
432         rdar://problem/30459055
433
434         Reviewed by Tim Horton.
435
436         When the coverage rect of a TiledBacking goes from a non-empty rect to an empty rect, we
437         shouldn't just early return from TileGrid::revalidateTiles(), otherwise we are left with some
438         tiles. Run through the function as normal, which will remove all the tiles for an empty coverage rect.
439         
440         Minor logging changes.
441
442         Test: tiled-drawing/tile-coverage-iframe-to-zero-coverage.html
443
444         * platform/graphics/ca/TileGrid.cpp:
445         (WebCore::TileGrid::revalidateTiles):
446
447 2017-02-10  Zalan Bujtas  <zalan@apple.com>
448
449         Mail hangs when removing multiple rows from large table.
450         https://bugs.webkit.org/show_bug.cgi?id=168103
451         <rdar://problem/30090186>
452
453         Reviewed by Ryosuke Niwa.
454
455         DeleteSelectionCommand::removeNode doesn't actually destroy table structure items,
456         but instead it removes their content. In order to be able to continue editing the table after
457         the delete, we need to ensure that its cells' width and height are > 0. Currently we issue layout on
458         each table item recursively.
459         This patch delays the layout until after we've finished with the entire subtree delete (10x progression).
460
461         Performance test added.
462
463         * editing/DeleteSelectionCommand.cpp:
464         (WebCore::DeleteSelectionCommand::insertBlockPlaceholderForTableCellIfNeeded):
465         (WebCore::DeleteSelectionCommand::removeNodeUpdatingStates):
466         (WebCore::shouldRemoveContentOnly):
467         (WebCore::DeleteSelectionCommand::removeNode):
468         * editing/DeleteSelectionCommand.h:
469
470 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
471
472         [Resource Timing] Enable Resource Timing by default in Tests
473         https://bugs.webkit.org/show_bug.cgi?id=168145
474
475         Reviewed by Ryosuke Niwa.
476
477         * loader/ResourceTimingInformation.cpp:
478         (WebCore::ResourceTimingInformation::addResourceTiming):
479         * testing/InternalSettings.cpp:
480         (WebCore::InternalSettings::Backup::Backup):
481         (WebCore::InternalSettings::Backup::restoreTo):
482         (WebCore::InternalSettings::setResourceTimingEnabled): Deleted.
483         * testing/InternalSettings.h:
484         * testing/InternalSettings.idl:
485         No longer needed for tests.
486
487 2017-02-10  Dan Bernstein  <mitz@apple.com>
488
489         [Cocoa] Add shouldChangeSelectedRange to WKWebProcessPlugInEditingDelegate
490         https://bugs.webkit.org/show_bug.cgi?id=168097
491
492         Reviewed by Tim Horton.
493
494         Added a userTriggered argument to FrameSelection::setSelectedRange so that WebKit2 can
495         indicate that changes should be agreed to by the delegate.
496
497         * editing/FrameSelection.cpp:
498         (WebCore::FrameSelection::setSelectedRange): If the change is user-triggered, check with
499           shouldChangeSelection.
500         * editing/FrameSelection.h:
501
502 2017-02-10  Jonathan Bedard  <jbedard@apple.com>
503
504         Removing LayoutTestRelay
505         https://bugs.webkit.org/show_bug.cgi?id=165927
506
507         Reviewed by Daniel Bates.
508         Part 2
509
510         LayoutTestRelay uses SPI, since recent versions of the iOS SDK allow for installing apps on
511         simulators through simctl (iOS 10 and later), use this functionality instead.
512
513         * platform/RuntimeApplicationChecks.mm:
514         (WebCore::IOSApplication::isDumpRenderTree): Update comment to reflect removal of LayoutTestRelay.
515
516 2017-02-10  Youenn Fablet  <youenn@apple.com>
517
518         [WebRTC] Implement Outgoing libwebrtc audio source support
519         https://bugs.webkit.org/show_bug.cgi?id=168118
520
521         Reviewed by Eric Carlson.
522
523         No new automated tests as we need the audio rendering to work to test the whole loop.
524
525         Using an AudioSampleDataSource to convert the captured data to libwebrtc expected format.
526         Capturing and pushing data happens in the capture thread.
527         Pulling of converted data happens in libwebrtc thread.
528
529         Introducing LibWebRTCAudioFormat.h to centralize libwbebrtc expected audio format.
530
531         * WebCore.xcodeproj/project.pbxproj:
532         * platform/audio/WebAudioBufferList.cpp:
533         (WebCore::WebAudioBufferList::WebAudioBufferList): Missing initialization leads to assertion failure.
534         * platform/audio/mac/AudioSampleBufferList.cpp:
535         (WebCore::AudioSampleBufferList::copyFrom): In case of interleaved channels, there is one buffer but two channels.
536         * platform/audio/mac/AudioSampleDataSource.cpp:
537         (WebCore::AudioSampleDataSource::pushSamples):
538         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
539         * platform/audio/mac/AudioSampleDataSource.h:
540         * platform/mediastream/libwebrtc/LibWebRTCAudioFormat.h: Added.
541         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
542         (WebCore::libwebrtcAudioFormat):
543         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
544         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
545         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
546         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
547         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
548
549 2017-02-10  Ryosuke Niwa  <rniwa@webkit.org>
550
551         HTMLConstructionSiteTask::Insert should never be called on a node with a parent
552         https://bugs.webkit.org/show_bug.cgi?id=168099
553
554         Reviewed by Sam Weinig.
555
556         insertAlreadyParsedChild always use HTMLConstructionSiteTask::InsertAlreadyParsedChild instead
557         of using HTMLConstructionSiteTask::Insert when fostering a child.
558
559         Also combine the step to take all children and re-parenting into a single task instead of
560         separately issuing TakeAllChildren and Reparent tasks.
561
562         No new tests since this is a refactoring.
563
564         * html/parser/HTMLConstructionSite.cpp:
565         (WebCore::insert): Now asserts that the child node never have a parent.
566         (WebCore::executeInsertAlreadyParsedChildTask): Moved the code to remove the parent here.
567         (WebCore::executeTakeAllChildrenAndReparentTask): Renamed from executeTakeAllChildrenTask
568         now that this function also does the reparenting.
569         (WebCore::executeTask):
570         (WebCore::HTMLConstructionSite::reparent): Removed the variant only used with takeAllChildren.
571         (WebCore::HTMLConstructionSite::insertAlreadyParsedChild): Always use InsertAlreadyParsedChild
572         instead of calling fosterParent which uses Insert when fostering parents.
573         (WebCore::HTMLConstructionSite::takeAllChildrenAndReparent): Renamed from takeAllChildren.
574         * html/parser/HTMLConstructionSite.h:
575         (WebCore::HTMLConstructionSiteTask:Operation):
576         * html/parser/HTMLTreeBuilder.cpp:
577         (WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
578
579 2017-02-10  Dave Hyatt  <hyatt@apple.com>
580
581         [CSS Parser] Make intercap property values serialize correctly
582         https://bugs.webkit.org/show_bug.cgi?id=168073
583
584         Reviewed by Zalan Bujtas.
585
586         Fix CSS value keywords to preserve case when the value contains capital
587         letters. Examples include optimizeSpeed, translateX, scaleY, etc.
588
589         * css/CSSPrimitiveValueMappings.h:
590         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
591         (WebCore::CSSPrimitiveValue::operator EPointerEvents):
592         (WebCore::CSSPrimitiveValue::operator TextRenderingMode):
593         (WebCore::CSSPrimitiveValue::operator EImageRendering):
594         (WebCore::CSSPrimitiveValue::operator EColorInterpolation):
595         (WebCore::CSSPrimitiveValue::operator EColorRendering):
596         (WebCore::CSSPrimitiveValue::operator EShapeRendering):
597         * css/MediaQueryEvaluator.cpp:
598         (WebCore::colorGamutEvaluate):
599         * css/SVGCSSValueKeywords.in:
600         * css/TransformFunctions.cpp:
601         (WebCore::transformOperationType):
602         (WebCore::transformsForValue):
603         * css/makevalues.pl:
604         * css/parser/CSSParserFastPaths.cpp:
605         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
606         (WebCore::parseTransformTranslateArguments):
607         (WebCore::parseSimpleTransformValue):
608         * css/parser/CSSPropertyParser.cpp:
609         (WebCore::consumeTransformValue):
610         * css/parser/CSSPropertyParserHelpers.cpp:
611         (WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
612
613 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
614
615         [EME] Implement MediaKeySession::load()
616         https://bugs.webkit.org/show_bug.cgi?id=168041
617
618         Reviewed by Xabier Rodriguez-Calvar.
619
620         Implement the MediaKeySession::load() method, tracing the steps as they
621         are defined in the EME specification. The only exception is step 8.3,
622         which requires additional facility that tracks currently open sessions
623         and provides information whether for a given session ID there's already
624         a MediaKeySession that's not yet been closed.
625
626         Session ID sanitization is done through the CDM::sanitizeSessionId()
627         method, which relays the task to the CDMPrivate implementation.
628
629         The CDMInstance::loadSession() virtual method is called with the session
630         type, sanitized ID, the Document's origin (in string form) and the
631         callback that's invoked upon completion of the task. The callback
632         checks whether the operation was successful, or examines the reason for
633         the load failure in case it wasn't, rejecting the promise in the latter
634         case either immediately or in the following task at the latest.
635
636         When the load was successful, the optional known keys, expiration time
637         and message are handled appropriately, and the promise is resolved.
638
639         MockCDM::sanitizeSessionId() implementation only treats
640         'valid-loaded-session' as a valid session ID.
641         MockCDMInstance::loadSession() implementation is kept slim for now, only
642         providing the 'license-renewal' message when invoking the passed-in
643         callback. Known keys and expiration time will also be tested once the
644         relevant MediaKeySession algorithms are implemented.
645
646         Test: media/encrypted-media/mock-MediaKeySession-load.html
647
648         * Modules/encryptedmedia/CDM.cpp:
649         (WebCore::CDM::sanitizeSessionId):
650         * Modules/encryptedmedia/CDM.h:
651         * Modules/encryptedmedia/CDMInstance.h:
652         * Modules/encryptedmedia/CDMPrivate.h:
653         * Modules/encryptedmedia/MediaKeySession.cpp:
654         (WebCore::MediaKeySession::load):
655         * testing/MockCDMFactory.cpp:
656         (WebCore::MockCDM::sanitizeSessionId):
657         (WebCore::MockCDMInstance::loadSession):
658         * testing/MockCDMFactory.h:
659
660 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
661
662         [EME] Implement MediaKeySession::sessionClosed()
663         https://bugs.webkit.org/show_bug.cgi?id=168039
664
665         Reviewed by Xabier Rodriguez-Calvar.
666
667         Implement the 'session closed' algorithm for MediaKeySession by
668         following the specified steps. After this algorithm is run, the
669         session should be considered closed, which we track via the m_closed
670         member variable on the class. This is set to true before the promise
671         that's accessible through the 'closed' attribute is resolved.
672
673         Because the algorithm requires the CDM instance to store any record
674         of key usage when the session's type is 'persistent-usage-record', the
675         storeRecordOfKeyUsage() virtual method is added to the CDMInstance
676         interface. MockCDMInstance implementation is left unimplemented for now.
677
678         JSMediaKeySession::closed() accessor now has a custom implementation
679         that creates a deferred promise for that object if there's none yet, and
680         shares it with the wrapped class through the registerClosedPromise()
681         method, storing a reference to the promise in the m_closedPromise
682         member variable, or resolving the promise immediately if the session was
683         already closed.
684
685         Test cases added to media/encrypted-media/mock-MediaKeySession-close.html.
686
687         * Modules/encryptedmedia/CDMInstance.h:
688         * Modules/encryptedmedia/MediaKeySession.cpp:
689         (WebCore::MediaKeySession::registerClosedPromise):
690         (WebCore::MediaKeySession::sessionClosed):
691         * Modules/encryptedmedia/MediaKeySession.h:
692         * bindings/js/JSMediaKeySessionCustom.cpp:
693         (WebCore::JSMediaKeySession::closed):
694         * testing/MockCDMFactory.cpp:
695         (WebCore::MockCDMInstance::storeRecordOfKeyUsage):
696         * testing/MockCDMFactory.h:
697
698 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
699
700         [EME] Implement MediaKeySession::updateKeyStatuses(), MediaKeyStatusMap
701         https://bugs.webkit.org/show_bug.cgi?id=167888
702
703         Reviewed by Xabier Rodriguez-Calvar.
704
705         Implement MediaKeySession::updateKeyStatuses(), transforming the passed-in
706         KeyStatusVector into a Vector mapping the key IDs to MediaKeyStatus values.
707         A keystatuseschange event is fired on the MediaKeySession object afterwards.
708         The queueing of the task that runs the 'attemp to resume playback' on the
709         related HTMLMediaElement objects isn't done yet since that algorithm isn't
710         implemented yet.
711
712         The statuses Vector is stored on the MediaKeySession object. That Vector is
713         then exposed through the MediaKeyStatusMap object, each such object being
714         unique to one MediaKeySession object. The implementation of MediaKeyStatusMap
715         thus keeps a reference to the session object as long as that object is alive,
716         and queries the MediaKeySession::statuses() getter to access the Vector that
717         contains status information for all the key IDs.
718
719         MediaKeyStatusMap::Iterator object keeps a reference to the MediaKeyStatusMap
720         object and accesses the statuses by indexing into the status Vector of the
721         related MediaKeySession object.
722
723         CDMInstance::updateLicense() now accepts the session ID string as the first
724         argument, making it possible to specify which session should be updated.
725
726         MockCDMFactory::keysForSessionWithID() returns an optional reference to the
727         Vector value in the session map that lists all the key IDs that are being
728         stored for that session.
729
730         MockCDMInstance::updateLicense() now detects the 'keys-changed' entry in the
731         passed-in response data, and upon detecting that constructs a KeyStatusVector
732         object containing all the keys for that session. KeyStatus::Usable is returned
733         for each object at the moment, but this should be adjustable in the future
734         through additional parameters passed through the response data. The Vector
735         object is then passed to the callback and is then passed to the 'update key
736         statuses' algorithm in MediaKeySession.
737
738         Covered by a test case in media/encrypted-media/mock-MediaKeySession-update.html.
739
740         * Modules/encryptedmedia/CDMInstance.h:
741         * Modules/encryptedmedia/MediaKeySession.cpp:
742         (WebCore::MediaKeySession::MediaKeySession):
743         (WebCore::MediaKeySession::~MediaKeySession):
744         (WebCore::MediaKeySession::update):
745         (WebCore::MediaKeySession::updateKeyStatuses):
746         * Modules/encryptedmedia/MediaKeySession.h:
747         * Modules/encryptedmedia/MediaKeyStatusMap.cpp:
748         (WebCore::MediaKeyStatusMap::MediaKeyStatusMap):
749         (WebCore::MediaKeyStatusMap::detachSession):
750         (WebCore::MediaKeyStatusMap::size):
751         (WebCore::keyIdsMatch):
752         (WebCore::MediaKeyStatusMap::has):
753         (WebCore::MediaKeyStatusMap::get):
754         (WebCore::MediaKeyStatusMap::Iterator::Iterator):
755         (WebCore::MediaKeyStatusMap::Iterator::next):
756         * Modules/encryptedmedia/MediaKeyStatusMap.h:
757         (WebCore::MediaKeyStatusMap::create):
758         * Modules/encryptedmedia/MediaKeyStatusMap.idl:
759         * testing/MockCDMFactory.cpp:
760         (WebCore::MockCDMFactory::keysForSessionWithID):
761         (WebCore::MockCDMInstance::updateLicense):
762         * testing/MockCDMFactory.h:
763
764 2017-02-09  Simon Fraser  <simon.fraser@apple.com>
765
766         Improve IOSurfacePool logging
767         https://bugs.webkit.org/show_bug.cgi?id=168098
768
769         Reviewed by Tim Horton.
770
771         Pass a string to DUMP_POOL_STATISTICS so we can tell what's triggering the
772         logging.
773
774         * platform/graphics/cg/IOSurfacePool.cpp:
775         (WebCore::IOSurfacePool::takeSurface):
776         (WebCore::IOSurfacePool::addSurface):
777         (WebCore::IOSurfacePool::evict):
778         (WebCore::IOSurfacePool::collectionTimerFired):
779         (WebCore::IOSurfacePool::showPoolStatistics):
780         * platform/graphics/cg/IOSurfacePool.h:
781
782 2017-02-09  Alex Christensen  <achristensen@webkit.org>
783
784         Unreviewed, rolling out r212040.
785
786         Broke build.  I'm not surprised
787
788         Reverted changeset:
789
790         "[WebRTC][Mac] Activate libwebrtc"
791         https://bugs.webkit.org/show_bug.cgi?id=167293
792         http://trac.webkit.org/changeset/212040
793
794 2017-02-09  Chris Dumez  <cdumez@apple.com>
795
796         [Mac][WK2] Use MIME type to add file extension to downloads' suggested filenames when missing
797         https://bugs.webkit.org/show_bug.cgi?id=168077
798         <rdar://problem/30412595>
799
800         Reviewed by Alex Christensen.
801
802         Add utility function to MIMETypeRegistry that appends an extension to
803         a filename if necessary, based on a provided MIME type.
804
805         Tests: fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
806                http/tests/download/anchor-download-no-extension.html
807
808         * platform/MIMETypeRegistry.cpp:
809         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
810         * platform/MIMETypeRegistry.h:
811         * platform/cocoa/MIMETypeRegistryCocoa.mm:
812         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
813
814 2017-02-09  Youenn Fablet  <youenn@apple.com>
815
816         [WebRTC][Mac] Activate libwebrtc
817         https://bugs.webkit.org/show_bug.cgi?id=167293
818
819         Reviewed by Alex Christensen.
820
821         * Configurations/WebCore.xcconfig:
822         * Configurations/WebCoreTestSupport.xcconfig:
823
824 2017-02-09  Philip Rogers  <pdr@google.com>
825
826         SVG clip-path references can clip out later content
827         https://bugs.webkit.org/show_bug.cgi?id=164181
828
829         Reviewed by Said Abou-Hallawa.
830
831         RenderSVGResourceClipper can modify the GraphicsContext state (through the path-only
832         clipping codepath) so we need to ensure RenderLayer::setupClipPath saves the context
833         and its caller restores it back so later content is not clipped as well.
834
835         This patch is based on a chromium patch by fs@opera.com:
836         https://chromium.googlesource.com/chromium/src/+/b3f7e7d2c4afb3c7e5c7eb438ff5933cbe2109b3
837
838         Test: css3/masking/clip-path-reference-restore.html
839
840         * rendering/RenderLayer.cpp:
841         (WebCore::RenderLayer::setupClipPath): Add a GC save and return true to restore. Also switch to downcast instead of static_cast.
842
843 2017-02-09  Filip Pizlo  <fpizlo@apple.com>
844
845         SharedArrayBuffer does not need to be in the transfer list
846         https://bugs.webkit.org/show_bug.cgi?id=168079
847
848         Reviewed by Geoffrey Garen and Keith Miller.
849
850         Tests: workers/sab/multi-memory-multi-buffer.html
851                workers/sab/multi-memory.html
852                workers/sab/no-transfer.html
853                workers/sab/postMessage-clones.html
854                workers/sab/sent-from-worker-no-transfer.html
855                workers/sab/sent-from-worker-transfer.html
856
857         The SAB API that we originally implemented required that SABs get put in transfer lists
858         when they are sent to workers.
859         
860         The new SAB API that everyone is converging towards requires that you do not put the
861         SAB in the transfer list. That's supposed to be an error. Instead, anytime that a SAB
862         is part of any message to or from a dedicated worker then it is automatically shared.
863         
864         The new API provides a lot more clarity about what is supposed to happen in contexts
865         that support transfering but don't support sharing.
866         
867         Right now this patch allows both styles to work, but I hope we can disable the transfer
868         list capability soon.
869
870         * bindings/js/IDBBindingUtilities.cpp:
871         (WebCore::deserializeIDBValueToJSValue):
872         * bindings/js/JSMessageEventCustom.cpp:
873         (WebCore::JSMessageEvent::data):
874         * bindings/js/SerializedScriptValue.cpp:
875         (WebCore::CloneSerializer::serialize):
876         (WebCore::CloneSerializer::CloneSerializer):
877         (WebCore::CloneSerializer::dumpIfTerminal):
878         (WebCore::CloneDeserializer::deserialize):
879         (WebCore::CloneDeserializer::CloneDeserializer):
880         (WebCore::CloneDeserializer::readTerminal):
881         (WebCore::SerializedScriptValue::SerializedScriptValue):
882         (WebCore::SerializedScriptValue::create):
883         (WebCore::SerializedScriptValue::deserialize):
884         * bindings/js/SerializedScriptValue.h:
885         (): Deleted.
886         * dom/CustomEvent.cpp:
887         (WebCore::CustomEvent::trySerializeDetail):
888         * dom/ErrorEvent.cpp:
889         (WebCore::ErrorEvent::trySerializeError):
890         * dom/MessageEvent.cpp:
891         (WebCore::MessageEvent::trySerializeData):
892         * dom/PopStateEvent.cpp:
893         (WebCore::PopStateEvent::trySerializeState):
894         * workers/DedicatedWorkerGlobalScope.cpp:
895         (WebCore::DedicatedWorkerGlobalScope::postMessage):
896         * workers/Worker.cpp:
897         (WebCore::Worker::postMessage):
898
899 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
900
901         Unreviewed build fix after r212025.
902
903         inDocument -> isConnected
904
905         * html/FormAssociatedElement.cpp:
906         (WebCore::FormAssociatedElement::didMoveToNewDocument):
907         (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver):
908         * html/HTMLFormElement.cpp:
909         (WebCore::HTMLFormElement::formElementIndex):
910
911 2017-02-09  Chris Dumez  <cdumez@apple.com>
912
913         Make sure Event keeps its current target element alive
914         https://bugs.webkit.org/show_bug.cgi?id=167885
915         <rdar://problem/30376972>
916
917         Reviewed by Brent Fulgham.
918
919         Make sure Event keeps its current target element alive to avoid
920         crashes if it is accessed by JS after it has been garbage collected.
921
922         Test: fast/events/currentTarget-gc-crash.html
923
924         * dom/Event.cpp:
925         (WebCore::Event::setCurrentTarget):
926         * dom/Event.h:
927         (WebCore::Event::currentTarget):
928
929 2017-02-09  Ryosuke Niwa  <rniwa@webkit.org>
930
931         Crash in render tree after dynamically mutating the slot value
932         https://bugs.webkit.org/show_bug.cgi?id=167502
933
934         Reviewed by Antti Koivisto.
935
936         The crash was caused by attributeChanged not destructing the render tree after an assigned element had been
937         removed from its slot. Since the style resolver can no longer find this element in the flat tree, we need to
938         delete its render object as if the element had been removed from the DOM tree.
939
940         Tests: fast/html/details-summary-slot.html
941                fast/shadow-dom/shadow-slot-attribute-change-crash.html
942
943         * dom/Element.cpp:
944         (WebCore::Element::attributeChanged):
945         * html/HTMLSummaryElement.cpp:
946         (WebCore::SummarySlotElement): Added. Always use the default slot regardless of the slot attribute's value.
947         (WebCore::HTMLSummaryElement::create): Use SummarySlotElement
948
949 2017-02-09  Antti Koivisto  <antti@apple.com>
950
951         Details element doesn't work correctly when mutating content between closing and opening
952         https://bugs.webkit.org/show_bug.cgi?id=167310
953
954         Reviewed by Ryosuke Niwa.
955
956         Tests: fast/html/details-close-modify-open.html
957                fast/shadow-dom/slot-remove-mutate-add.html
958
959         * dom/SlotAssignment.cpp:
960         (WebCore::SlotAssignment::didChangeSlot):
961
962             Always reset the slot assignment when content is mutated.
963
964 2017-02-09  Chris Dumez  <cdumez@apple.com>
965
966         Crash under FormSubmission::create()
967         https://bugs.webkit.org/show_bug.cgi?id=167200
968         <rdar://problem/30096323>
969
970         Reviewed by Darin Adler.
971
972         The issue is that FormSubmission::create() was iterating over
973         form.associatedElements() as was calling Element::appendFormData()
974         in the loop. HTMLObjectElement::appendFormData() was calling
975         pluginWidget(PluginLoadingPolicy::Load) which causes a synchronous
976         layout and can fire events (such as focus event) synchronously.
977         Firing those events synchronously allows the JS to modify the
978         form.associatedElements() vector we are currently iterating on.
979
980         To avoid this issue, we now call pluginWidget(PluginLoadingPolicy::DoNotLoad)
981         in HTMLObjectElement::appendFormData() as we are not allowed to fire
982         synchronous events at this point. I also added a security assertion
983         in FormSubmission::create() to catch cases where we fire JS events
984         while iterating over the form associated elements to more easily
985         notice these things in the future.
986
987         Test: fast/forms/formsubmission-appendFormData-crash.html
988
989         * html/HTMLObjectElement.cpp:
990         (WebCore::HTMLObjectElement::appendFormData):
991         * loader/FormSubmission.cpp:
992         (WebCore::FormSubmission::create):
993
994 2017-02-09  Chris Dumez  <cdumez@apple.com>
995
996         Crash under HTMLFormElement::registerFormElement()
997         https://bugs.webkit.org/show_bug.cgi?id=167162
998
999         Reviewed by Ryosuke Niwa.
1000
1001         didMoveToNewDocument() was re-registering FormAttributeTargetObserver
1002         even if the element's inDocument was not set yet. As a result, it was
1003         possible for FormAssociatedElement::resetFormOwner() to be called
1004         when the element was in the tree but with its inDocument still being
1005         false (because insertedInto() has not been called yet). This could
1006         end up calling HTMLFormElement::registerFormElement() even though
1007         the element is still recognized as detached. This is an issue because
1008         HTMLFormElement::m_associatedElements's order and its corresponding
1009         indexes (m_associatedElementsBeforeIndex / m_associatedElementsAfterIndex)
1010         rely on the position of the element with regards to the form element
1011         (before / inside / after).
1012
1013         To address the issue, we now only register the FormAttributeTargetObserver
1014         in didMoveToNewDocument() if the inDocument flag is set to true. This
1015         is similar to what is done at other call sites of
1016         resetFormAttributeTargetObserver(). We also ignore the form content
1017         attribute in HTMLFormElement::formElementIndex() if the element is
1018         not connected.
1019
1020         As per the HTML specification [1], the form content attribute is only
1021         taken if the element is connected (i.e. inDocument flag is true).
1022
1023         Note that FormAssociatedElement::findAssociatedForm() was already
1024         ignoring the form content attribute if the element is disconnected.
1025
1026         [1] https://html.spec.whatwg.org/#reset-the-form-owner (step 3)
1027
1028         Test: fast/forms/registerFormElement-crash.html
1029
1030         * html/FormAssociatedElement.cpp:
1031         (WebCore::FormAssociatedElement::didMoveToNewDocument):
1032         Only call resetFormAttributeTargetObserver() if inDocument flag is set,
1033         similarly to what is done at other call sites.
1034
1035         (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver):
1036         Add an assertion to make sure no one call this method on an element that
1037         is not connected.
1038
1039         * html/HTMLFormElement.cpp:
1040         (WebCore::HTMLFormElement::formElementIndex):
1041         Ignore the form content attribute if the element is not connected, as
1042         per the HTML specification [1].
1043
1044 2017-02-09  Antti Koivisto  <antti@apple.com>
1045
1046         Tear down existing renderers when adding a shadow root.
1047         https://bugs.webkit.org/show_bug.cgi?id=167117
1048
1049         Reviewed by Andreas Kling.
1050
1051         Adding a shadow root may cause children no longer be part of the flat tree. If they had renderers
1052         tear down code would no longer reach them.
1053
1054         Test: fast/shadow-dom/attach-shadow-teardown.html
1055
1056         * dom/Element.cpp:
1057         (WebCore::Element::addShadowRoot):
1058
1059             Tear down existing render tree when adding a shadow root.
1060
1061 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
1062
1063         Handle synchronous layout when setting a selection range
1064         https://bugs.webkit.org/show_bug.cgi?id=167092
1065         <rdar://problem/30041640>
1066
1067         Reviewed by Antti Koivisto.
1068
1069         The 'innerTextElement' of a form control can change during layout due
1070         to arbitrary JavaScript executing. Handle the case where the inner text
1071         element has changed so that current render box height is while setting
1072         a selection range.
1073
1074         Test: fast/forms/input-type-change-during-selection.html
1075
1076         * html/HTMLTextFormControlElement.cpp:
1077         (WebCore::HTMLTextFormControlElement::setSelectionRange):
1078
1079 2017-02-09  Alex Christensen  <achristensen@webkit.org>
1080
1081         Fix CMake build.
1082
1083         * PlatformMac.cmake:
1084
1085 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
1086
1087         Disconnect shadow children of root when detaching a frame
1088         https://bugs.webkit.org/show_bug.cgi?id=166851
1089         <rdar://problem/29930443>
1090
1091         Reviewed by Andy Estes.
1092
1093         If the root of the tree we are disconnecting has a shadow element, include it in the set of
1094         things to disconnect.
1095
1096         Tests: fast/shadow-dom/shadow-at-root-during-disconnect.html
1097
1098         * dom/ContainerNodeAlgorithms.cpp:
1099         (WebCore::disconnectSubframes):
1100
1101 2017-02-09  Alexey Proskuryakov  <ap@apple.com>
1102
1103         Remove unused WebThreadRunSync
1104         https://bugs.webkit.org/show_bug.cgi?id=168024
1105
1106         Reviewed by Tim Horton.
1107
1108         * platform/ios/wak/WebCoreThreadRun.cpp:
1109         * platform/ios/wak/WebCoreThreadRun.h:
1110         * platform/ios/wak/WebCoreThreadSystemInterface.cpp:
1111         (InitWebCoreThreadSystemInterface):
1112
1113 2017-02-09  Ryan Haddad  <ryanhaddad@apple.com>
1114
1115         Unreviewed, rolling out r211802.
1116
1117         This change caused fast/regions/inline-block-inside-anonymous-
1118         overflow-with-covered-controls.html to be a flaky failure.
1119
1120         Reverted changeset:
1121
1122         "[Modern Media Controls] Improve handling of <video> with only
1123         audio tracks"
1124         https://bugs.webkit.org/show_bug.cgi?id=167836
1125         http://trac.webkit.org/changeset/211802
1126
1127 2017-02-09  Alex Christensen  <achristensen@webkit.org>
1128
1129         Fix i386 libwebrtc build
1130         https://bugs.webkit.org/show_bug.cgi?id=168038
1131
1132         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
1133         DataChannelInterface::buffered_amount returns a uint64_t, and we want a size_t.
1134         If this overflows, then we've run out of memory and crashed a long time ago.
1135
1136 2017-02-09  Andreas Kling  <akling@apple.com>
1137
1138         Document::settings() should return a const Settings&.
1139         <https://webkit.org/b/168061>
1140
1141         Reviewed by Geoffrey Garen.
1142
1143         - Make Document::settings() return a const reference.
1144         - Added Document::mutableSettings() for all your non-const needs.
1145         - Fixed up settings generator to produce const getters.
1146         - Simplify a few settings() call sites that exposed themselves.
1147
1148         * Modules/applepay/ApplePaySession.cpp:
1149         (WebCore::shouldDiscloseApplePayCapability):
1150         * Modules/mediastream/UserMediaRequest.cpp:
1151         (WebCore::canCallGetUserMedia):
1152         * css/CSSFontFace.cpp:
1153         (WebCore::CSSFontFace::appendSources):
1154         * css/CSSFontSelector.cpp:
1155         (WebCore::resolveGenericFamily):
1156         * css/StyleResolver.h:
1157         (WebCore::StyleResolver::settings):
1158         * dom/Document.h:
1159         (WebCore::Document::settings):
1160         (WebCore::Document::mutableSettings):
1161         * html/FTPDirectoryDocument.cpp:
1162         (WebCore::createTemplateDocumentData):
1163         * html/HTMLCanvasElement.cpp:
1164         (WebCore::shouldEnableWebGL):
1165         * html/HTMLEmbedElement.cpp:
1166         (WebCore::HTMLEmbedElement::rendererIsNeeded):
1167         * html/HTMLSelectElement.cpp:
1168         (WebCore::HTMLSelectElement::menuListDefaultEventHandler):
1169         * html/ImageDocument.cpp:
1170         (WebCore::ImageDocument::updateDuringParsing):
1171         * page/csp/ContentSecurityPolicy.cpp:
1172         (WebCore::ContentSecurityPolicy::allowContentSecurityPolicySourceStarToMatchAnyProtocol):
1173         * page/make_settings.pl:
1174         (printGetterAndSetter):
1175         * rendering/SimpleLineLayout.cpp:
1176         (WebCore::SimpleLineLayout::toggleSimpleLineLayout):
1177
1178 2017-02-09  Jer Noble  <jer.noble@apple.com>
1179
1180         Make passing PlatformAudioData in audioSamplesAvaliable const-correct.
1181         https://bugs.webkit.org/show_bug.cgi?id=168051
1182
1183         Reviewed by Eric Carlson.
1184
1185         Modify all the functions which take a (conceptually) read-only audio buffer const-correct.
1186
1187         Drive-by fix: AudioSampleBufferList::copyFrom() set a ivar pointer to the passed in
1188         AudioBufferList. Ensure that the ivar is reset when copyFrom() returns by using a
1189         SetForScope.
1190
1191         * platform/audio/mac/AudioSampleBufferList.cpp:
1192         (WebCore::AudioSampleBufferList::copyFrom):
1193         * platform/audio/mac/AudioSampleBufferList.h:
1194         * platform/audio/mac/AudioSampleDataSource.cpp:
1195         (WebCore::AudioSampleDataSource::pushSamplesInternal):
1196         (WebCore::AudioSampleDataSource::pushSamples):
1197         * platform/audio/mac/AudioSampleDataSource.h:
1198         * platform/mediastream/RealtimeMediaSource.cpp:
1199         (WebCore::RealtimeMediaSource::audioSamplesAvailable):
1200         * platform/mediastream/RealtimeMediaSource.h:
1201         (WebCore::RealtimeMediaSource::Observer::audioSamplesAvailable):
1202         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
1203         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
1204         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
1205         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1206         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
1207         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1208
1209 2017-02-09  Jer Noble  <jer.noble@apple.com>
1210
1211         Fix some logging statements in MediaPlayerPrivateMediaStreamAVFObjC
1212         https://bugs.webkit.org/show_bug.cgi?id=168063
1213
1214         Reviewed by Eric Carlson.
1215
1216         Make the format string match the types passed in (i.e., floats, not strings).
1217
1218         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1219         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes):
1220
1221 2017-02-09  Eric Carlson  <eric.carlson@apple.com>
1222
1223         [MediaStream Mac] Handle NULL m_sampleBufferDisplayLayer
1224         https://bugs.webkit.org/show_bug.cgi?id=168060
1225
1226         Reviewed by Jer Noble.
1227
1228         No new tests, this avoids an occasional crash on the bots.
1229
1230         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1231         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): Don't assume
1232         m_sampleBufferDisplayLayer is valid.
1233
1234 2017-02-09  Chris Dumez  <cdumez@apple.com>
1235
1236         Object.getPrototypeOf(NodeFilter) should be Function.prototype, not Object.prototype
1237         https://bugs.webkit.org/show_bug.cgi?id=167964
1238
1239         Reviewed by Youenn Fablet.
1240
1241         Object.getPrototypeOf(NodeFilter) should be Function.prototype, not Object.prototype
1242         after the following WebIDL spec change:
1243         - https://github.com/heycam/webidl/issues/96
1244
1245         This aligns our behavior with other browsers as the spec has been updated to match
1246         the majority.
1247
1248         No new tests, rebaselined existing test.
1249
1250         * bindings/scripts/CodeGeneratorJS.pm:
1251         (GenerateConstructorHelperMethods):
1252         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
1253         (WebCore::JSTestCallbackInterfaceConstructor::prototypeForStructure):
1254
1255 2017-02-09  Miguel Gomez  <magomez@igalia.com>
1256
1257         [GTK] scroll with transparent background not repainted after scrollY >= 32768
1258         https://bugs.webkit.org/show_bug.cgi?id=154283
1259
1260         Reviewed by Carlos Garcia Campos.
1261
1262         Due to a limitation of the pixman backend, which uses 16 bits to hold signed integers, cairo is
1263         not able to draw anything when using transformation matrices with values bigger than 32768. When
1264         drawing patterns into large pages, the matrices values can overflow those 16 bits, so cairo doesn't
1265         draw anything in, which causes the reported transparent backgrounds.
1266
1267         The patch modifies the transformation matrices both from the current context and the pattern we
1268         are painting, to avoid them to hold values that cannot stored in 16 bits.
1269
1270         There's still the possibility that this happens, but it would require using a pattern with a size
1271         bigger than 32768.
1272
1273         Based on a previous patch by Gwang Yoon Hwang  <yoon@igalia.com>.
1274
1275         No new tests.
1276
1277         * platform/graphics/cairo/CairoUtilities.cpp:
1278         (WebCore::drawPatternToCairoContext):
1279
1280 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
1281
1282         Unreviewed build fix after r211965.
1283
1284         * dom/Document.cpp:
1285         (WebCore::Document::adoptNode): inDocument -> isConnected
1286
1287 2017-02-09  Ryosuke Niwa  <rniwa@webkit.org>
1288
1289         Adopting a child node of a script element can run script
1290         https://bugs.webkit.org/show_bug.cgi?id=167318
1291
1292         Reviewed by Darin Adler.
1293
1294         The bug was caused by ScriptElement::childrenChanged indiscriminately running the script.
1295         Do this only if some node has been inserted as spec'ed:
1296
1297         https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model
1298         "The script element is connected and a node or document fragment is inserted into
1299         the script element, after any script elements inserted at that time."
1300
1301         Split NonContentsChildChanged into NonContentsChildInserted and NonContentsChildRemoved to disambiguate
1302         non-contents child such as text and element being removed or inserted. New behavior matches that of
1303         Gecko and Chrome as well as the latest HTML5 specification.
1304
1305         Also deploy NoEventDispatchAssertion in more places. Unfortunately, this results in some DOM trees
1306         internal to WebKit to be mutated while there is NoEventDispatchAssertion in the stack. Added a new RAII
1307         object "EventAllowedScope" to temporarily disable this assertion within such a tree. CachedSVGFont's
1308         ensureCustomFontData used to completely disable this assertion but we no longer have to do this either.
1309
1310         To clarify the new semantics, renamed isEventDispatchForbidden to isEventAllowedInMainThread with
1311         the negated boolean value, and added a new variant isEventDispatchAllowedInSubtree, which checks
1312         isEventDispatchForbidden() is true or if the node was one of an internal DOM node or its descendent
1313         held by EventAllowedScope.
1314
1315         Inspired by https://chromium.googlesource.com/chromium/src/+/604e798ec6ee30f44d57a5c4a44ce3dab3a871ed
1316
1317         Tests: fast/html/script-must-not-run-when-child-is-adopted.html
1318                fast/html/script-must-not-run-when-child-is-removed.html
1319
1320         * dom/CharacterData.cpp:
1321         (WebCore::CharacterData::notifyParentAfterChange): Added NoEventDispatchAssertion.
1322         * dom/ContainerNode.cpp:
1323         (WebCore::ContainerNode::insertBefore): Added NoEventDispatchAssertion around TreeScope's adoptIfNeeded
1324         and insertBeforeCommon as done elsewhere.
1325         (WebCore::ContainerNode::appendChildCommon): Added NoEventDispatchAssertion.
1326         (WebCore::ContainerNode::changeForChildInsertion): Use NonContentsChildInserted here.
1327         (WebCore::ContainerNode::notifyChildRemoved): Added NoEventDispatchAssertion.
1328         (WebCore::ContainerNode::replaceChild): Moved adoptIfNeeded into NoEventDispatchAssertion.
1329         (WebCore::ContainerNode::removeChild): Added NoEventDispatchAssertion.
1330         (WebCore::ContainerNode::parserRemoveChild): Added NoEventDispatchAssertion.
1331         (WebCore::ContainerNode::removeChildren): Call childrenChanged in NoEventDispatchAssertion.
1332         (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): Moved adoptIfNeeded into
1333         NoEventDispatchAssertion.
1334         (WebCore::dispatchChildInsertionEvents): Check the forbidden-ness more precisely.
1335         (WebCore::dispatchChildRemovalEvents): Ditto.
1336         * dom/ContainerNode.h:
1337         (WebCore::ContainerNode::ChildChange::isInsertion): Added.
1338         * dom/ContainerNodeAlgorithms.cpp:
1339         (WebCore::notifyChildNodeInserted): Check the forbidden-ness more precisely. Here, we check against
1340         insertionPoint since EventAllowedScope checks against the root node.
1341         * dom/Document.cpp:
1342         (WebCore::Document::adoptNode): Assert the node to be adopted has not been inserted back, or else
1343         remove() had resulted in an exception before calling TreeScope::adoptIfNeeded.
1344         * dom/Element.cpp:
1345         (WebCore::Element::childrenChanged):
1346         * dom/NoEventDispatchAssertion.h:
1347         (WebCore::NoEventDispatchAssertion::isEventDispatchForbidden): Added a new variant that takes a node.
1348         If this node is a descendent of a node "marked as safe" by EventAllowedScope, then we don't consider
1349         the event dispatch to be forbidden.
1350         (WebCore::NoEventDispatchAssertion::dropTemporarily): Deleted.
1351         (WebCore::NoEventDispatchAssertion::restoreDropped): Deleted.
1352         (WebCore::NoEventDispatchAssertion::EventAllowedScope): Added. A RAII object which marks descendants of
1353         a given node as "safe" for the purpose of checking isEventDispatchForbidden.
1354         (WebCore::NoEventDispatchAssertion::EventAllowedScope::EventAllowedScope): Added. There can be a chain
1355         of EventAllowedScope objects in the stack. s_currentScope points to the most recently instantiated
1356         RAII object, and each instance remembers prior instance. 
1357         (WebCore::NoEventDispatchAssertion::EventAllowedScope::~EventAllowedScope): Added.
1358         (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNode): Added. Returns true if the given
1359         node is a descendent of any node held by instances of EventAllowedScope.
1360         (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNodeInternal): Added. A helper function
1361         for isAllowedNode.
1362         * dom/Node.cpp:
1363         (WebCore::Node::dispatchSubtreeModifiedEvent): Check the forbidden-ness more precisely.
1364         * dom/ScriptElement.cpp:
1365         (WebCore::ScriptElement::childrenChanged): Only prepare the script if we've inserted nodes.
1366         (WebCore::ScriptElement::executeClassicScript): Assert isEventDispatchForbidden is false since running
1367         arbitrary author scripts can, indeed, result dispatch any events.
1368         * dom/ScriptElement.h:
1369         * html/HTMLElement.cpp:
1370         (WebCore::textToFragment): Made this a static local function and not return an exception since there
1371         is no way appendChild called in this function can throw an exception.
1372         (WebCore::HTMLElement::setInnerText): Create EventAllowedScope for the fragment. It's called called by
1373         HTMLTextAreaElement's childrenChanged to update its UA shadow tree, and it's dispatching as event on
1374         a new fragment can't execute arbitrary scripts since it has never been exposed to author scripts.
1375         Because of the precise-ness of this check, this does not disable the assertion for "this" element.
1376         HTMLTextFormControlElement::setInnerTextValue explicitly creates another EventAllowedScope to mark
1377         the shadow tree into which the fragment is inserted safe.
1378         (WebCore::HTMLElement::setOuterText):
1379         * html/HTMLElement.h:
1380         * html/HTMLScriptElement.cpp:
1381         (WebCore::HTMLScriptElement::childrenChanged):
1382         * html/HTMLTextFormControlElement.cpp:
1383         (WebCore::HTMLTextFormControlElement::setInnerTextValue): See above (setInnerText).
1384         * html/track/VTTCue.cpp:
1385         (WebCore::VTTCue::createCueRenderingTree): Create EventAllowedScope for the cloned fragment here since
1386         the VTT tree is never exposed to author scripts.
1387         (WebCore::VTTCue::updateDisplayTree): Ditto.
1388         * loader/cache/CachedSVGFont.cpp:
1389         (WebCore::CachedSVGFont::ensureCustomFontData): Use EventAllowedScope to disable assertions only on
1390         the new SVG document we just created instead of disabling for all DOM trees.
1391         * svg/SVGScriptElement.cpp:
1392         (WebCore::SVGScriptElement::childrenChanged):
1393
1394 2017-02-09  Andreas Kling  <akling@apple.com>
1395
1396         Document should always have a Settings.
1397         <https://webkit.org/b/120172>
1398
1399         Reviewed by Antti Koivisto.
1400
1401         Since a Document can't move between Frames, and it's either frameless
1402         or partnered with a Frame provided at construction time, we know that
1403         it will never need to switch between different Settings objects either.
1404
1405         Give Document a Ref<Settings> that contains either the Frame's Settings
1406         or a default-constructed Settings object if frameless.
1407         Document::settings() is promoted to a reference getter.
1408
1409         The bulk of this patch is removing now-unnecessary null checks.
1410
1411         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
1412         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
1413         * Modules/plugins/PluginReplacement.h:
1414         (WebCore::ReplacementPlugin::isEnabledBySettings):
1415         * Modules/plugins/QuickTimePluginReplacement.h:
1416         * Modules/plugins/QuickTimePluginReplacement.mm:
1417         (WebCore::QuickTimePluginReplacement::isEnabledBySettings):
1418         * Modules/plugins/YouTubePluginReplacement.cpp:
1419         (WebCore::YouTubePluginReplacement::isEnabledBySettings):
1420         * Modules/plugins/YouTubePluginReplacement.h:
1421         * Modules/webaudio/AudioContext.cpp:
1422         (WebCore::AudioContext::constructCommon):
1423         * bindings/js/CachedScriptFetcher.cpp:
1424         (WebCore::CachedScriptFetcher::requestScriptWithCache):
1425         * css/CSSFontFace.cpp:
1426         (WebCore::CSSFontFace::appendSources):
1427         (WebCore::CSSFontFace::webFontsShouldAlwaysFallBack):
1428         * css/CSSFontSelector.cpp:
1429         (WebCore::CSSFontSelector::fallbackFontCount):
1430         (WebCore::CSSFontSelector::fallbackFontAt):
1431         * css/StyleBuilderConverter.h:
1432         (WebCore::StyleBuilderConverter::convertResize):
1433         * css/StyleBuilderCustom.h:
1434         (WebCore::StyleBuilderCustom::applyValueFontFamily):
1435         * css/StyleResolver.cpp:
1436         (WebCore::StyleResolver::StyleResolver):
1437         (WebCore::StyleResolver::defaultStyleForElement):
1438         (WebCore::StyleResolver::adjustRenderStyle):
1439         (WebCore::StyleResolver::checkForGenericFamilyChange):
1440         (WebCore::StyleResolver::initializeFontStyle):
1441         * css/StyleResolver.h:
1442         (WebCore::StyleResolver::settings):
1443         (WebCore::StyleResolver::documentSettings): Deleted.
1444         * css/parser/CSSParser.cpp:
1445         (WebCore::CSSParserContext::CSSParserContext):
1446         * dom/Document.cpp:
1447         (WebCore::Document::Document):
1448         (WebCore::Document::setReadyState):
1449         (WebCore::Document::setVisualUpdatesAllowed):
1450         (WebCore::Document::defaultCharsetForLegacyBindings):
1451         (WebCore::Document::recalcStyle):
1452         (WebCore::Document::implicitClose):
1453         (WebCore::Document::minimumLayoutDelay):
1454         (WebCore::Document::setDomain):
1455         (WebCore::Document::audioPlaybackRequiresUserGesture):
1456         (WebCore::Document::videoPlaybackRequiresUserGesture):
1457         (WebCore::Document::storageBlockingStateDidChange):
1458         (WebCore::Document::isTelephoneNumberParsingEnabled):
1459         (WebCore::Document::initSecurityContext):
1460         (WebCore::Document::initDNSPrefetch):
1461         (WebCore::Document::getCachedLocale):
1462         (WebCore::Document::shouldEnforceContentDispositionAttachmentSandbox):
1463         (WebCore::Document::settings): Deleted.
1464         * dom/Document.h:
1465         (WebCore::Document::settings):
1466         * dom/Element.cpp:
1467         (WebCore::subpixelMetricsEnabled):
1468         * dom/ExtensionStyleSheets.cpp:
1469         (WebCore::ExtensionStyleSheets::pageUserSheet):
1470         * dom/ScriptExecutionContext.cpp:
1471         (WebCore::ScriptExecutionContext::dispatchErrorEvent):
1472         * dom/ScriptableDocumentParser.cpp:
1473         (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
1474         * dom/ScriptedAnimationController.cpp:
1475         (WebCore::ScriptedAnimationController::requestAnimationFrameEnabled):
1476         * dom/make_names.pl:
1477         (printConstructorInterior):
1478         * editing/Editor.cpp:
1479         * editing/markup.cpp:
1480         (WebCore::createMarkupInternal):
1481         * html/FTPDirectoryDocument.cpp:
1482         (WebCore::createTemplateDocumentData):
1483         * html/HTMLAnchorElement.cpp:
1484         (WebCore::HTMLAnchorElement::setActive):
1485         (WebCore::HTMLAnchorElement::sendPings):
1486         (WebCore::HTMLAnchorElement::treatLinkAsLiveForEventType):
1487         * html/HTMLAppletElement.cpp:
1488         (WebCore::HTMLAppletElement::canEmbedJava):
1489         * html/HTMLCanvasElement.cpp:
1490         (WebCore::HTMLCanvasElement::getContext2d):
1491         (WebCore::shouldEnableWebGL):
1492         (WebCore::HTMLCanvasElement::shouldAccelerate):
1493         * html/HTMLFormElement.cpp:
1494         (WebCore::HTMLFormElement::submitImplicitly):
1495         * html/HTMLFrameElementBase.cpp:
1496         (WebCore::HTMLFrameElementBase::setLocation):
1497         * html/HTMLImageElement.cpp:
1498         (WebCore::HTMLImageElement::updateImageControls):
1499         * html/HTMLImageLoader.cpp:
1500         (WebCore::HTMLImageLoader::sourceURI):
1501         * html/HTMLInputElement.cpp:
1502         (WebCore::HTMLInputElement::setupDateTimeChooserParameters):
1503         * html/HTMLLinkElement.cpp:
1504         (WebCore::HTMLLinkElement::process):
1505         * html/HTMLMediaElement.cpp:
1506         (WebCore::HTMLMediaElement::HTMLMediaElement):
1507         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory):
1508         (WebCore::HTMLMediaElement::mediaPlayerAcceleratedCompositingEnabled):
1509         (WebCore::HTMLMediaElement::enterFullscreen):
1510         (WebCore::HTMLMediaElement::exitFullscreen):
1511         (WebCore::HTMLMediaElement::mediaPlayerNeedsSiteSpecificHacks):
1512         (WebCore::HTMLMediaElement::mediaPlayerNetworkInterfaceName):
1513         (WebCore::HTMLMediaElement::setMediaControlsDependOnPageScaleFactor):
1514         (WebCore::HTMLMediaElement::doesHaveAttribute):
1515         * html/HTMLVideoElement.cpp:
1516         (WebCore::HTMLVideoElement::HTMLVideoElement):
1517         * html/MediaElementSession.cpp:
1518         (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled):
1519         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
1520         (WebCore::MediaElementSession::allowsAutomaticMediaDataLoading):
1521         (WebCore::MediaElementSession::allowsPictureInPicture):
1522         (WebCore::MediaElementSession::maximumMediaSourceBufferSize):
1523         * html/parser/HTMLParserOptions.cpp:
1524         (WebCore::HTMLParserOptions::HTMLParserOptions):
1525         * html/shadow/MediaControlElements.cpp:
1526         (WebCore::MediaControlFullscreenButtonElement::defaultEventHandler):
1527         * loader/LinkLoader.cpp:
1528         (WebCore::LinkLoader::loadLink):
1529         * page/csp/ContentSecurityPolicy.cpp:
1530         (WebCore::ContentSecurityPolicy::allowContentSecurityPolicySourceStarToMatchAnyProtocol):
1531         * rendering/SimpleLineLayout.cpp:
1532         (WebCore::SimpleLineLayout::toggleSimpleLineLayout):
1533         * style/StyleFontSizeFunctions.cpp:
1534         (WebCore::Style::computedFontSizeFromSpecifiedSize):
1535         (WebCore::Style::fontSizeForKeyword):
1536         (WebCore::Style::legacyFontSizeForPixelSize):
1537         * style/StyleScope.cpp:
1538         (WebCore::Style::Scope::collectActiveStyleSheets):
1539         * xml/XMLHttpRequest.cpp:
1540         (WebCore::XMLHttpRequest::usesDashboardBackwardCompatibilityMode):
1541
1542 2017-02-09  Antti Koivisto  <antti@apple.com>
1543
1544         Use all cacheable speculatively loaded responses
1545         https://bugs.webkit.org/show_bug.cgi?id=168052
1546
1547         Reviewed by Andreas Kling.
1548
1549         * platform/network/CacheValidation.cpp:
1550         (WebCore::isStatusCodeCacheableByDefault):
1551         (WebCore::isStatusCodePotentiallyCacheable):
1552
1553         Moved here from WebKit2.
1554
1555         * platform/network/CacheValidation.h:
1556
1557 2017-02-09  Eric Carlson  <eric.carlson@apple.com>
1558
1559         [MediaStream] Remove legacy Navigator.webkitGetUserMedia
1560         https://bugs.webkit.org/show_bug.cgi?id=168016
1561
1562         Reviewed by Youenn Fablet.
1563
1564         No new tests, existing tests updated.
1565
1566         * WebCore.xcodeproj/project.pbxproj: NavigatorUserMedia.
1567         * DerivedSources.make: Ditto.
1568         * CMakeLists.txt: Ditto.
1569         * Modules/mediastream/NavigatorUserMedia.idl: Removed.
1570         * Modules/mediastream/NavigatorUserMedia.js: Removed.
1571         * WebCore.xcodeproj/project.pbxproj:
1572         * page/Navigator.idl: Add some whitespace to force derived sources to be rebuild correctly.
1573
1574 2017-02-09  Antoine Quint  <graouts@apple.com>
1575
1576         [Modern Media Controls] Tapping the skip back button on iOS inline media controls make the controls disappear
1577         https://bugs.webkit.org/show_bug.cgi?id=168049
1578         <rdar://problem/30442660>
1579
1580         Reviewed by Eric Carlson.
1581
1582         Calling elementAtPoint() on the Document will not return an element in the ShadowRoot,
1583         we need to call it on the ShadowRoot. So we now iterate over ancestors of the controls
1584         bar to find the ShadowRoot, if any, and check whether the tapped element is contained
1585         within the controls bar. We only fade the controls bar out if the tapped element is
1586         outside of the controls bar hierarchy.
1587
1588         Test: media/modern-media-controls/media-controller/media-controller-ios-do-not-hide-controls-when-tapping-button.html
1589
1590         * Modules/modern-media-controls/controls/controls-bar.js:
1591         (ControlsBar.prototype.gestureRecognizerStateDidChange):
1592
1593 2017-02-09  Jer Noble  <jer.noble@apple.com>
1594
1595         Configure MockRealtimeAudioSourceMac to generate stereo audio
1596         https://bugs.webkit.org/show_bug.cgi?id=168027
1597
1598         Reviewed by Eric Carlson.
1599
1600         Update MockRealtimeAudioSourceMac to generate stereo audio.
1601
1602         First, because the pattern of creating a AudioBufferList structure (with all it's quirks and
1603         weird requirements) was repeated multiple places, add a new wrapper around ABL called
1604         WebAudioBufferList which takes care of correctly initializing the ABL structure and manages
1605         the lifetime of its data members.
1606
1607         * WebCore.xcodeproj/project.pbxproj:
1608         * platform/audio/PlatformAudioData.h: Added.
1609         (WebCore::PlatformAudioData::kind):
1610         * platform/audio/WebAudioBufferList.cpp: Added.
1611         (WebCore::WebAudioBufferList::WebAudioBufferList):
1612         (WebCore::WebAudioBufferList::buffers):
1613         (WebCore::WebAudioBufferList::bufferCount):
1614         (WebCore::WebAudioBufferList::buffer):
1615         * platform/audio/WebAudioBufferList.h: Added.
1616         (WebCore::WebAudioBufferList::list):
1617         (WebCore::WebAudioBufferList::operator AudioBufferList&):
1618         (WebCore::WebAudioBufferList::kind):
1619         (isType):
1620
1621         Then update existing code to work in terms of WebAudioBufferList:
1622
1623         * platform/audio/mac/AudioSampleBufferList.cpp:
1624         (WebCore::AudioSampleBufferList::AudioSampleBufferList):
1625         (WebCore::AudioSampleBufferList::mixFrom):
1626         (WebCore::AudioSampleBufferList::copyFrom):
1627         (WebCore::AudioSampleBufferList::copyTo):
1628         (WebCore::AudioSampleBufferList::reset):
1629         (WebCore::AudioSampleBufferList::configureBufferListForStream): Deleted.
1630         * platform/audio/mac/AudioSampleBufferList.h:
1631         (WebCore::AudioSampleBufferList::bufferList):
1632         * platform/audio/mac/AudioSampleDataSource.cpp:
1633         (WebCore::AudioSampleDataSource::pushSamples):
1634         * platform/audio/mac/AudioSampleDataSource.h:
1635         * platform/mediastream/RealtimeMediaSource.cpp:
1636         (WebCore::RealtimeMediaSource::audioSamplesAvailable):
1637         * platform/mediastream/RealtimeMediaSource.h:
1638         (WebCore::RealtimeMediaSource::Observer::audioSamplesAvailable):
1639         * platform/mediastream/mac/AVAudioCaptureSource.h:
1640         * platform/mediastream/mac/AVAudioCaptureSource.mm:
1641         (WebCore::AVAudioCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
1642         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
1643         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
1644         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
1645         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1646         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
1647         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1648
1649         Finally, actually update MockRealtimeAudioSource to emit stereo samples. Importantly, set
1650         the correct values for the m_streamFormat; mBytesPerFrame and mBytesPerPacket are not
1651         multiplied by the channelCount. When generating audio, write to both channels of data.
1652
1653         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
1654         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
1655         (WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers):
1656         (WebCore::MockRealtimeAudioSourceMac::reconfigure):
1657         (WebCore::MockRealtimeAudioSourceMac::render):
1658
1659 2017-02-09  Antti Koivisto  <antti@apple.com>
1660
1661         Nullptr crash under styleForFirstLetter
1662         https://bugs.webkit.org/show_bug.cgi?id=167756
1663         rdar://problem/30029354
1664
1665         Reviewed by Zalan Bujtas.
1666
1667         Don't know how we get here. Paper over the crash.
1668
1669         * rendering/RenderBlock.cpp:
1670         (WebCore::styleForFirstLetter):
1671
1672             Use parent first line style if we compute null style for the first letter renderer.
1673
1674 2017-02-09  Antoine Quint  <graouts@apple.com>
1675
1676         [Modern Media Controls] Playing an <audio> element on iOS makes the controls disappear
1677         https://bugs.webkit.org/show_bug.cgi?id=168047
1678         <rdar://problem/30441939>
1679
1680         Reviewed by Eric Carlson.
1681
1682         The controls bar auto-hide behavior is disabled for <audio> elements, but on iOS we have
1683         a TapGestureRecognizer to identify when controls are tapped to toggle controls visibility.
1684         This gesture recognizer would be on at all times, but it should only be enabled when
1685         fadesToIdle is set to true.
1686
1687         Test: media/modern-media-controls/media-controller/media-controller-ios-only-enable-tap-gesture-recognizer-with-fades-when-idle.html
1688
1689         * Modules/modern-media-controls/controls/controls-bar.js:
1690         (ControlsBar.prototype.set fadesWhileIdle):
1691
1692 2017-02-09  Antoine Quint  <graouts@apple.com>
1693
1694         [Modern Media Controls] <audio> element does not show any background on iOS
1695         https://bugs.webkit.org/show_bug.cgi?id=168046
1696         <rdar://problem/30441872>
1697
1698         Reviewed by Eric Carlson.
1699
1700         Use a solid gray background for <audio> elements on iOS.
1701
1702         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-audio-background.html
1703
1704         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
1705         (:host(audio) .media-controls.ios.inline > .controls-bar:before):
1706
1707 2017-02-09  Antoine Quint  <graouts@apple.com>
1708
1709         [Modern Media Controls] Controls fail to instantiate in an XHTML document
1710         https://bugs.webkit.org/show_bug.cgi?id=168045
1711         <rdar://problem/30290095>
1712
1713         Reviewed by Eric Carlson.
1714
1715         Always use valid HTML and XHTML strings when creating HTML elements.
1716
1717         Test: media/modern-media-controls/media-controller/media-controller-in-xhtml.xhtml
1718
1719         * Modules/modern-media-controls/controls/button.js:
1720         (Button):
1721         * Modules/modern-media-controls/controls/buttons-container.js:
1722         * Modules/modern-media-controls/controls/controls-bar.js:
1723         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
1724         * Modules/modern-media-controls/controls/media-controls.js:
1725         * Modules/modern-media-controls/controls/slider.js:
1726         * Modules/modern-media-controls/controls/status-label.js:
1727         * Modules/modern-media-controls/controls/time-control.js:
1728         * Modules/modern-media-controls/controls/time-label.js:
1729         * Modules/modern-media-controls/controls/tracks-panel.js:
1730
1731 2017-02-09  Michael Catanzaro  <mcatanzaro@igalia.com>
1732
1733         Unreviewed, fix typo in comment
1734
1735         * loader/DocumentWriter.cpp:
1736         (WebCore::DocumentWriter::replaceDocument):
1737
1738 2017-02-09  Andreas Kling  <akling@apple.com>
1739
1740         Disallow accelerated rendering for ginormous 2D canvases.
1741         <https://webkit.org/b/167968>
1742         <rdar://problem/30119483>
1743
1744         Reviewed by Antti Koivisto.
1745
1746         Add a "maximumAccelerated2dCanvasSize" setting that defaults to 5120x2880
1747         which is the 5K resolution for 16:9.
1748
1749         Also added a way to include the "accelerates drawing" flag in layer tree dumps.
1750
1751         Test: compositing/canvas/accelerated-canvas-compositing-size-limit.html
1752
1753         * html/HTMLCanvasElement.cpp:
1754         (WebCore::HTMLCanvasElement::shouldAccelerate):
1755         * page/Frame.h:
1756         * page/Settings.in:
1757         * platform/graphics/GraphicsLayer.cpp:
1758         (WebCore::GraphicsLayer::dumpProperties):
1759         * platform/graphics/GraphicsLayerClient.h:
1760         * rendering/RenderLayerCompositor.cpp:
1761         (WebCore::RenderLayerCompositor::layerTreeAsText):
1762         * testing/Internals.cpp:
1763         (WebCore::toLayerTreeFlags):
1764         * testing/Internals.h:
1765         * testing/Internals.idl:
1766
1767 2017-02-09  Antti Koivisto  <antti@apple.com>
1768
1769         Remove most cases of #if ENABLE(CACHE_PARTITIONING)
1770         https://bugs.webkit.org/show_bug.cgi?id=167990
1771
1772         Reviewed by Sam Weinig.
1773
1774         We'll just return empty string for the partition if partitioning is not enabled.
1775
1776         * html/DOMURL.cpp:
1777         (WebCore::DOMURL::revokeObjectURL):
1778         * inspector/InspectorPageAgent.cpp:
1779         (WebCore::InspectorPageAgent::cachedResource):
1780         * loader/FrameLoader.cpp:
1781         (WebCore::FrameLoader::loadURL):
1782         * loader/archive/cf/LegacyWebArchive.cpp:
1783         (WebCore::LegacyWebArchive::create):
1784         * loader/cache/CachedResource.h:
1785         (WebCore::CachedResource::url):
1786         (WebCore::CachedResource::cachePartition):
1787         * loader/cache/CachedResourceLoader.cpp:
1788         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
1789         (WebCore::CachedResourceLoader::requestResource):
1790         * loader/cache/CachedResourceRequest.cpp:
1791         (WebCore::CachedResourceRequest::setDomainForCachePartition):
1792         * loader/cache/CachedResourceRequest.h:
1793         * loader/cache/MemoryCache.cpp:
1794         (WebCore::MemoryCache::add):
1795         (WebCore::MemoryCache::revalidationSucceeded):
1796         (WebCore::MemoryCache::resourceForRequestImpl):
1797         (WebCore::MemoryCache::addImageToCache):
1798         (WebCore::MemoryCache::removeImageFromCache):
1799         (WebCore::MemoryCache::remove):
1800         (WebCore::MemoryCache::removeResourcesWithOrigin):
1801         (WebCore::MemoryCache::removeResourcesWithOrigins):
1802         (WebCore::MemoryCache::getOriginsWithCache):
1803         (WebCore::MemoryCache::originsWithCache):
1804         * loader/cache/MemoryCache.h:
1805         * page/SecurityOrigin.cpp:
1806         (WebCore::SecurityOrigin::domainForCachePartition):
1807         * page/SecurityOrigin.h:
1808         * platform/SchemeRegistry.cpp:
1809         (WebCore::cachePartitioningSchemes):
1810         (WebCore::SchemeRegistry::shouldPartitionCacheForURLScheme):
1811         * platform/SchemeRegistry.h:
1812         * platform/ios/WebCoreSystemInterfaceIOS.mm:
1813         * platform/mac/WebCoreSystemInterface.h:
1814         * platform/mac/WebCoreSystemInterface.mm:
1815         * platform/network/ResourceRequestBase.cpp:
1816         (WebCore::ResourceRequestBase::setAsIsolatedCopy):
1817         (WebCore::ResourceRequestBase::setCachePartition):
1818         (WebCore::ResourceRequestBase::partitionName):
1819         * platform/network/ResourceRequestBase.h:
1820         (WebCore::ResourceRequestBase::cachePartition):
1821         (WebCore::ResourceRequestBase::setDomainForCachePartition):
1822         * platform/network/cf/ResourceRequest.h:
1823         (WebCore::ResourceRequest::cachePartition): Deleted.
1824         (WebCore::ResourceRequest::setCachePartition): Deleted.
1825         (WebCore::ResourceRequest::setDomainForCachePartition): Deleted.
1826         * platform/network/cf/ResourceRequestCFNet.cpp:
1827         (WebCore::ResourceRequest::doUpdatePlatformRequest):
1828         (WebCore::ResourceRequest::doUpdateResourceRequest):
1829         (WebCore::ResourceRequest::partitionName): Deleted.
1830         (WebCore::ResourceRequest::doPlatformSetAsIsolatedCopy): Deleted.
1831         * platform/network/cf/ResourceResponse.h:
1832         * platform/network/cocoa/ResourceRequestCocoa.mm:
1833         (WebCore::ResourceRequest::doUpdateResourceRequest):
1834         (WebCore::ResourceRequest::doUpdatePlatformRequest):
1835         * testing/Internals.cpp:
1836         (WebCore::Internals::isLoadingFromMemoryCache):
1837
1838 2017-02-09  Ryosuke Niwa  <rniwa@webkit.org>
1839
1840         Add Web Bluetooth as Not Considering
1841         https://bugs.webkit.org/show_bug.cgi?id=168042
1842
1843         Reviewed by Yusuke Suzuki.
1844
1845         Add Web Bluetooth as a feature not being considered to be implemented in WebKit.
1846
1847         * features.json:
1848
1849 2017-02-08  Simon Fraser  <simon.fraser@apple.com>
1850
1851         Put names on more UIViews for ease of debugging
1852         https://bugs.webkit.org/show_bug.cgi?id=168035
1853
1854         Reviewed by Tim Horton.
1855
1856         Name the page overlay layers.
1857
1858         * page/PageOverlayController.cpp:
1859         (WebCore::PageOverlayController::createRootLayersIfNeeded):
1860         (WebCore::PageOverlayController::installPageOverlay):
1861
1862 2017-02-08  Commit Queue  <commit-queue@webkit.org>
1863
1864         Unreviewed, rolling out r211912.
1865         https://bugs.webkit.org/show_bug.cgi?id=168034
1866
1867         http/tests/media/media-stream/disconnected-frame-permission-
1868         denied.html should be updated (Requested by youenn on
1869         #webkit).
1870
1871         Reverted changeset:
1872
1873         "[MediaStream] Remove legacy Navigator.webkitGetUserMedia"
1874         https://bugs.webkit.org/show_bug.cgi?id=168016
1875         http://trac.webkit.org/changeset/211912
1876
1877 2017-02-08  Youenn Fablet  <youennf@gmail.com>
1878
1879         HTML Link elements should load data URLs as same origin
1880         https://bugs.webkit.org/show_bug.cgi?id=168032
1881         <rdar://problem/30275036>
1882
1883         Reviewed by Alex Christensen.
1884
1885         Test: fast/dom/data-url-css-link-element-cors-active.html
1886
1887         Making CSS data URLs resources considered as same origin when loaded through link elements.
1888         In the future, we should consider remove the data URL same origin flag and fully align with the fetch and HTML spec.
1889
1890         * html/HTMLLinkElement.cpp:
1891         (WebCore::HTMLLinkElement::process):
1892
1893 2017-02-08  Sam Weinig  <sam@webkit.org>
1894
1895         REGRESSION (r193286): Promise chain no longer prevent UI refresh
1896         <rdar://problem/28062149>
1897         https://bugs.webkit.org/show_bug.cgi?id=161291
1898
1899         Reviewed by Geoffrey Garen.
1900
1901         Add new subtest to js/dom/Promise.html
1902
1903         * dom/Microtasks.cpp:
1904         (WebCore::MicrotaskQueue::append):
1905         (WebCore::MicrotaskQueue::remove):
1906         (WebCore::MicrotaskQueue::performMicrotaskCheckpoint):
1907         * dom/Microtasks.h:
1908         The microtask queue needs to be completely drained, even of new microtasks added while
1909         the previous task was run. Remove the m_tasksAppendedDuringMicrotaskCheckpoint as it is
1910         no longer needed.
1911
1912 2017-02-08  Eric Carlson  <eric.carlson@apple.com>
1913
1914         [MediaStream] Remove legacy Navigator.webkitGetUserMedia
1915         https://bugs.webkit.org/show_bug.cgi?id=168016
1916
1917         Reviewed by Youenn Fablet.
1918
1919         No new tests, existing tests updated.
1920
1921         * WebCore.xcodeproj/project.pbxproj: NavigatorUserMedia.
1922         * DerivedSources.make: Ditto.
1923         * CMakeLists.txt: Ditto.
1924         * Modules/mediastream/NavigatorUserMedia.idl: Removed.
1925         * Modules/mediastream/NavigatorUserMedia.js: Removed.
1926         * WebCore.xcodeproj/project.pbxproj:
1927         * page/Navigator.idl: Add some whitespace to force derived sources to be rebuild correctly.
1928
1929 2017-02-08  Chris Dumez  <cdumez@apple.com>
1930
1931         Use smaller tiles in windows that are not active to facilitate App Napping
1932         https://bugs.webkit.org/show_bug.cgi?id=167997
1933         <rdar://problem/30358835>
1934
1935         Reviewed by Simon Fraser.
1936
1937         Use smaller / non-adaptative tiles in windows that are not active to facilitate
1938         App Napping after <https://trac.webkit.org/r197594>.
1939
1940         Test: compositing/tiling/non-active-window-tiles-size.html
1941
1942         * page/FrameView.cpp:
1943         (WebCore::FrameView::contentsResized):
1944         (WebCore::FrameView::addedOrRemovedScrollbar):
1945         (WebCore::FrameView::computeScrollability):
1946         (WebCore::FrameView::updateTiledBackingAdaptiveSizing):
1947         (WebCore::FrameView::unobscuredContentSizeChanged):
1948         (WebCore::FrameView::setViewExposedRect):
1949         * page/FrameView.h:
1950         * page/Page.cpp:
1951         (WebCore::Page::setActivityState):
1952         (WebCore::Page::isWindowActive):
1953         * page/Page.h:
1954         * platform/graphics/TiledBacking.h:
1955         * platform/graphics/ca/TileController.cpp:
1956         (WebCore::TileController::setTileSizeUpdateDelayDisabledForTesting):
1957         (WebCore::TileController::notePendingTileSizeChange):
1958         * platform/graphics/ca/TileController.h:
1959         * testing/Internals.cpp:
1960         (WebCore::Internals::resetToConsistentState):
1961         (WebCore::Internals::disableTileSizeUpdateDelay):
1962         * testing/Internals.h:
1963         * testing/Internals.idl:
1964
1965 2017-02-08  Chris Dumez  <cdumez@apple.com>
1966
1967         Unreviewed, rolling out r211907.
1968
1969         Broke the build
1970
1971         Reverted changeset:
1972
1973         "[MediaStream] Remove legacy Navigator.webkitGetUserMedia"
1974         https://bugs.webkit.org/show_bug.cgi?id=168016
1975         http://trac.webkit.org/changeset/211907
1976
1977 2017-02-08  Eric Carlson  <eric.carlson@apple.com>
1978
1979         [MediaStream] Remove legacy Navigator.webkitGetUserMedia
1980         https://bugs.webkit.org/show_bug.cgi?id=168016
1981
1982         Reviewed by Youenn Fablet.
1983
1984         No new tests, existing tests updated.
1985
1986         * WebCore.xcodeproj/project.pbxproj: NavigatorUserMedia.
1987         * DerivedSources.make: Ditto.
1988         * CMakeLists.txt: Ditto.
1989         * Modules/mediastream/NavigatorUserMedia.idl: Removed.
1990         * Modules/mediastream/NavigatorUserMedia.js: Removed.
1991         * WebCore.xcodeproj/project.pbxproj:
1992
1993 2017-02-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1994
1995         Add kUTTypeUTF8PlainText and kUTTypeJPEG to the list of compatible content types in DragData
1996         https://bugs.webkit.org/show_bug.cgi?id=167942
1997         <rdar://problem/30315079>
1998
1999         Reviewed by Tim Horton.
2000
2001         Adds UTI types for dragging UTF8 plain text and JPEG images to the list of supported types in DragDataMac.mm.
2002         Also handles reading these types in PasteboardMac.mm. I verified manually with a test app that if a platform
2003         NSView vends only UTF8 plaintext or JPEG images when dragging, WebKit is able to read the contents of the
2004         pasteboard as text and an image, respectively.
2005
2006         New TestWebKitAPI tests in DragAndDropPasteboardTests.mm.
2007
2008         * platform/mac/DragDataMac.mm:
2009         (WebCore::DragData::containsCompatibleContent):
2010         * platform/mac/PasteboardMac.mm:
2011         (WebCore::Pasteboard::read):
2012
2013 2017-02-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
2014
2015         getIntersectionList always returns empty NodeList until layout is complete
2016         https://bugs.webkit.org/show_bug.cgi?id=81423
2017
2018         Reviewed by Simon Fraser.
2019
2020         Layout needs to be forced before trying to figure out which SVGElements
2021         intersect with a given SVGRect. We do the same thing in the DOM API
2022         Element::getBoundingClientRect().
2023
2024         Test: svg/custom/intersection-list-before-layout.html
2025
2026         * svg/SVGSVGElement.cpp:
2027         (WebCore::SVGSVGElement::getIntersectionList):
2028
2029 2017-02-08  Antoine Quint  <graouts@apple.com>
2030
2031         [Modern Media Controls] Implement reduced and tight padding modes
2032         https://bugs.webkit.org/show_bug.cgi?id=167933
2033         <rdar://problem/30396994>
2034
2035         Reviewed by Dean Jackson.
2036
2037         The design specs for modern media controls mandate the following for inline media controls:
2038
2039             - controls at or below 300pt width use a 12pt left margin for the left buttons container,
2040             and a 12pt right margin for the right buttons container, and 16pth button margin inside
2041             both containers ("reduced padding mode").
2042
2043             - when dropping at or below 120pt width, controls use an 8pt left margin for
2044             the left buttons container, and an 8pt right margin for the right buttons container, and
2045             12pt button margin inside both containers and a shorter bar (25pt) ("compact mode").
2046
2047             - in the case of audio controls, at 400pt or less, controls switch to 12pt margins and
2048             button margins for both buttons containers ("tight padding mode").
2049
2050         The "compact" mode was already implemented as a dedicated MacOSInlineMediaControls subclass.
2051         Since we now have a more generic need to vary the metrics used for inline media controls on
2052         macOS, we add new features to MacOSInlineMediaControls to support varying metrics based on
2053         the controls' "layoutTraits" property.
2054
2055         So MediaController is changed such that it knows to use the new TightPadding and ReducedPadding
2056         layout traits based on the conditions defined above, and _updateControlsIfNeeded() is changed
2057         to set the "layoutTraits" property on the controls whenever called, which in our case is most
2058         relevantly a "resize" event on the shadow root or a TrackEvent on the video tracks (to determine
2059         when we're possibly changing between a video and audio file).
2060
2061         As a result, the "layoutTraits" setter is called on MacOSInlineMediaControls, which updates
2062         the metrics for the various buttons containers, but also notifies the buttons contained
2063         within that layout traits may have changed, since some buttons support a "compact" appearance
2064         that is shorter and require a different image file. To that end, IconButton has been updated
2065         so that it may be notified of a layout traits change through a new layoutTraitsDidChange()
2066         method, that checks whether the current layout traits differ from those last used when loading
2067         the icon.
2068
2069         Tests: media/modern-media-controls/icon-button/icon-button-change-layout-traits.html
2070                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-compact-buttons-styles.html
2071                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-compact-controls-bar-styles.html
2072                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-compact.html
2073                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-reduced-padding.html
2074                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-tight-padding.html
2075                media/modern-media-controls/media-controller/media-controller-compact.html
2076                media/modern-media-controls/media-controller/media-controller-reduced-padding.html
2077                media/modern-media-controls/media-controller/media-controller-tight-padding.html
2078
2079         * Modules/modern-media-controls/controls/icon-button.js:
2080         (IconButton.prototype.set iconName):
2081         (IconButton.prototype.layoutTraitsDidChange):
2082         (IconButton.prototype._loadImage):
2083         * Modules/modern-media-controls/controls/layout-item.js:
2084         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.js: Removed.
2085         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
2086         (MacOSInlineMediaControls.prototype.get layoutTraits):
2087         (MacOSInlineMediaControls.prototype.set layoutTraits):
2088         (MacOSInlineMediaControls.prototype._matchLayoutTraits):
2089         * Modules/modern-media-controls/js-files:
2090         * Modules/modern-media-controls/media/media-controller.js:
2091         (MediaController):
2092         (MediaController.prototype.get layoutTraits):
2093         (MediaController.prototype.handleEvent):
2094         (MediaController.prototype._updateControlsIfNeeded):
2095         (MediaController.prototype._controlsClassForLayoutTraits):
2096         (MediaController.prototype._shouldFadeBetweenControls): Deleted.
2097         (MediaController.prototype._controlsClass): Deleted.
2098         * WebCore.xcodeproj/project.pbxproj:
2099
2100 2017-02-08  Aakash Jain  <aakash_jain@apple.com>
2101
2102         Move private methods from WKGraphics.h to a separate header file
2103         https://bugs.webkit.org/show_bug.cgi?id=167996
2104
2105         Reviewed by Alexey  Proskuryakov.
2106
2107         * platform/ios/wak/WKGraphicsInternal.h: Added.
2108         * WebCore.xcodeproj/project.pbxproj: Added WKGraphicsInternal.h
2109         * platform/ios/wak/WKGraphics.h: Moved methods to WKGraphicsInternal.h
2110         * platform/graphics/mac/GraphicsContextMac.mm: Included new header file.
2111         * platform/ios/wak/WKGraphics.mm: Same.
2112
2113 2017-02-08  Brady Eidson  <beidson@apple.com>
2114
2115         Opt-out iBooks from synchronous willSendRequest on iOS.
2116         <rdar://problem/30129966> and https://bugs.webkit.org/show_bug.cgi?id=168006
2117
2118         Reviewed by Brent Fulgham.
2119
2120         No new tests (Not a testable behavior change at this time).
2121
2122         * platform/network/mac/ResourceHandleMac.mm:
2123         (WebCore::synchronousWillSendRequestEnabled): iBooks never gets synchronous willSendRequest:
2124
2125 2017-02-08  Sam Weinig  <sam@webkit.org>
2126
2127         Split JSDOMConstructor.h/cpp up by class
2128         https://bugs.webkit.org/show_bug.cgi?id=167958
2129
2130         Reviewed by Tim Horton.
2131
2132         Splits JSDOMConstructor up by class.
2133         - Renames DOMConstructorObject to JSDOMConstructorBase.
2134         - Renames DOMConstructorWithDocument to JSDOMConstructorWithDocument.
2135         - Renames DOMConstructorJSBuiltinObject to JSDOMBuiltinConstructorBase.
2136         - Renames JSBuiltinConstructor to JSDOMBuiltinConstructor.
2137
2138         * CMakeLists.txt:
2139         * WebCore.xcodeproj/project.pbxproj:
2140         * bindings/js/JSBindingsAllInOne.cpp:
2141         Add new files.
2142
2143         * bindings/js/JSDOMBinding.h:
2144         (WebCore::propertyNameToString): Deleted.
2145         (WebCore::propertyNameToAtomicString): Deleted.
2146         * bindings/js/JSDOMBuiltinConstructor.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
2147         * bindings/js/JSDOMBuiltinConstructorBase.cpp: Copied from Source/WebCore/bindings/js/JSDOMConstructor.cpp.
2148         * bindings/js/JSDOMBuiltinConstructorBase.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
2149         * bindings/js/JSDOMConstructor.cpp: Removed.
2150         * bindings/js/JSDOMConstructor.h: Remove all classes other than JSDOMConstructor.
2151         * bindings/js/JSDOMConstructorBase.cpp: Copied from Source/WebCore/bindings/js/JSDOMConstructor.cpp.
2152         * bindings/js/JSDOMConstructorBase.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
2153         * bindings/js/JSDOMConstructorNotConstructable.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
2154         * bindings/js/JSDOMConstructorWithDocument.cpp: Copied from Source/WebCore/bindings/js/JSDOMConstructor.cpp.
2155         * bindings/js/JSDOMConstructorWithDocument.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
2156         * bindings/js/JSDOMNamedConstructor.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
2157
2158         * bindings/js/JSDOMConvertStrings.h:
2159         (WebCore::propertyNameToString):
2160         (WebCore::propertyNameToAtomicString):
2161         Move these here from JSDOMBinding.
2162
2163         * bindings/js/JSHTMLElementCustom.cpp:
2164         (WebCore::constructJSHTMLElement):
2165         * bindings/js/JSMutationObserverCustom.cpp:
2166         (WebCore::constructJSMutationObserver):
2167         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
2168         * bindings/js/JSStorageCustom.cpp:
2169         * bindings/js/JSUserMessageHandlersNamespaceCustom.cpp:
2170         (WebCore::JSUserMessageHandlersNamespace::getOwnPropertySlotDelegate):
2171         * bindings/js/JSWorkerCustom.cpp:
2172         (WebCore::constructJSWorker):
2173         * bindings/scripts/CodeGeneratorJS.pm:
2174         (GetConstructorTemplateClassName):
2175         (GenerateConstructorDeclaration):
2176         Update includes/names.
2177
2178         * dom/StaticRange.cpp:
2179         (WebCore::StaticRange::~StaticRange):
2180         * dom/StaticRange.h:
2181         Add out-of-line destructor, so Node.h does not have to be included.
2182
2183 2017-02-08  Joseph Pecoraro  <pecoraro@apple.com>
2184
2185         Initialize the main RunLoop in iOS WebKitLegacy
2186         https://bugs.webkit.org/show_bug.cgi?id=167953
2187
2188         Reviewed by Alexey Proskuryakov.
2189
2190         * platform/ios/wak/WebCoreThread.mm:
2191         (StartWebThread):
2192         Initialize the main runloop on the main thread during iOS WebKit initialization.
2193
2194 2017-02-08  Aakash Jain  <aakash_jain@apple.com>
2195
2196         Move private methods from WKContentObservation.h to a separate header file
2197         https://bugs.webkit.org/show_bug.cgi?id=167998
2198
2199         Reviewed by Alexey Proskuryakov.
2200
2201         * WebCore.xcodeproj/project.pbxproj: Added WKContentObservationInternal.h
2202         * platform/ios/wak/WKContentObservationInternal.h: Added.
2203         * platform/ios/wak/WKContentObservation.h: Moved methods to WKContentObservationInternal.h
2204         * platform/ios/wak/WKContentObservation.cpp: Included new header file.
2205         * page/DOMTimer.cpp: Same.
2206         * page/DOMWindow.cpp: Same.
2207         * style/RenderTreeUpdater.cpp: Same.
2208
2209 2017-02-08  Youenn Fablet  <youenn@apple.com>
2210
2211         RTCPeerConnection constructor can take null as input
2212         https://bugs.webkit.org/show_bug.cgi?id=167992
2213
2214         Reviewed by Chris Dumez.
2215
2216         Covered by updated test.
2217
2218         RTCPeerConnection takes an optional Dictionary as input.
2219         As per https://heycam.github.io/webidl/#es-dictionary, null is converted to an empty dictionary.
2220
2221         * Modules/mediastream/RTCPeerConnection.js:
2222         (initializeRTCPeerConnection):
2223
2224 2017-02-08  Andreas Kling  <akling@apple.com>
2225
2226         No need for CachedFrame to detach custom scrollbars.
2227         <https://webkit.org/b/167995>
2228
2229         Reviewed by Sam Weinig.
2230
2231         Custom scrollbars have already been torn down with the rest of the render tree
2232         by the time we're creating a CachedFrame.
2233
2234         * history/CachedFrame.cpp:
2235         (WebCore::CachedFrame::CachedFrame):
2236
2237 2017-02-08  Zalan Bujtas  <zalan@apple.com>
2238
2239         Simple line layout: Fix printReason for unsupported overflow values.
2240         https://bugs.webkit.org/show_bug.cgi?id=168000
2241
2242         Reviewed by Simon Fraser.
2243
2244         Not testable.
2245
2246         * rendering/SimpleLineLayout.cpp:
2247         (WebCore::SimpleLineLayout::canUseForStyle):
2248         (WebCore::SimpleLineLayout::printReason):
2249
2250 2017-02-08  Aakash Jain  <aakash_jain@apple.com>
2251
2252         Remove WebCoreObjCDeallocWithWebThreadLock from header file
2253         https://bugs.webkit.org/show_bug.cgi?id=167987
2254
2255         Reviewed by Alexey Proskuryakov.
2256
2257         * platform/ios/wak/WebCoreThread.mm: Added WebCoreObjCDeallocWithWebThreadLock.
2258         * platform/ios/wak/WebCoreThreadMessage.h: Removed WebCoreObjCDeallocWithWebThreadLock.
2259
2260 2017-02-08  Aakash Jain  <aakash_jain@apple.com>
2261
2262         Move WKMouseInRect to WAKView.mm
2263         https://bugs.webkit.org/show_bug.cgi?id=167989
2264
2265         Reviewed by Alexey Proskuryakov.
2266
2267         * platform/ios/wak/WAKAppKitStubs.h: Removed WKMouseInRect.
2268         * platform/ios/wak/WAKAppKitStubs.m:
2269         (WKMouseInRect): Deleted.
2270         * platform/ios/wak/WAKView.mm: 
2271         (-[WAKView mouse:inRect:]): Added the logic of WKMouseInRect here instead of separate function call.
2272
2273 2017-02-08  Aakash Jain  <aakash_jain@apple.com>
2274
2275         Remove unused method WebCore::PluginData::pluginNameForMimeType
2276         https://bugs.webkit.org/show_bug.cgi?id=167986
2277
2278         Reviewed by Anders Carlsson.
2279
2280         * plugins/PluginData.cpp:
2281         (WebCore::PluginData::pluginNameForWebVisibleMimeType): Deleted.
2282         * plugins/PluginData.h: Removed pluginNameForWebVisibleMimeType.
2283
2284 2017-02-08  Carlos Garcia Campos  <cgarcia@igalia.com>
2285
2286         [GTK] Fix translatable form validation messages
2287         https://bugs.webkit.org/show_bug.cgi?id=167984
2288
2289         Reviewed by Michael Catanzaro.
2290
2291         Most of them are just wrong. Use the same mesages than mac, which also makes some tests pass.
2292
2293         Fixes: fast/forms/validation-message-maxLength.html
2294                fast/forms/validationMessage.html
2295
2296         * platform/gtk/LocalizedStringsGtk.cpp:
2297         (WebCore::validationMessageValueMissingText):
2298         (WebCore::validationMessageValueMissingForCheckboxText):
2299         (WebCore::validationMessageValueMissingForFileText):
2300         (WebCore::validationMessageValueMissingForMultipleFileText):
2301         (WebCore::validationMessageValueMissingForRadioText):
2302         (WebCore::validationMessageValueMissingForSelectText):
2303         (WebCore::validationMessageTypeMismatchText):
2304         (WebCore::validationMessageTypeMismatchForEmailText):
2305         (WebCore::validationMessageTypeMismatchForMultipleEmailText):
2306         (WebCore::validationMessageTypeMismatchForURLText):
2307         (WebCore::validationMessagePatternMismatchText):
2308         (WebCore::validationMessageTooShortText):
2309         (WebCore::validationMessageTooLongText):
2310         (WebCore::validationMessageRangeUnderflowText):
2311         (WebCore::validationMessageRangeOverflowText):
2312         (WebCore::validationMessageStepMismatchText):
2313         (WebCore::validationMessageBadInputForNumberText):
2314
2315 2017-02-08  Chris Dumez  <cdumez@apple.com>
2316
2317         Add support for enhanced privacy diagnostic logging
2318         https://bugs.webkit.org/show_bug.cgi?id=167948
2319         <rdar://problem/30385112>
2320
2321         Reviewed by Antti Koivisto.
2322
2323         Add new logDiagnosticMessageWithEnhancedPrivacy() method to DiagnosticLoggingClient
2324         that is used for enhanced privacy logging. Start using this new API to log domains
2325         that are visited.
2326
2327         * loader/EmptyClients.cpp:
2328         * loader/FrameLoader.cpp:
2329         (WebCore::logNavigation):
2330         (WebCore::FrameLoader::loadWithDocumentLoader):
2331         * page/DiagnosticLoggingClient.h:
2332         * page/DiagnosticLoggingKeys.cpp:
2333         (WebCore::DiagnosticLoggingKeys::domainVisitedKey):
2334         * page/DiagnosticLoggingKeys.h:
2335
2336 2017-02-08  Carlos Garcia Campos  <cgarcia@igalia.com>
2337
2338         [GStreamer] Critical warnings when media player is destroyed
2339         https://bugs.webkit.org/show_bug.cgi?id=167981
2340
2341         Reviewed by Xabier Rodriguez-Calvar.
2342
2343         It can happen that the source doesn't have a parent when we try to disconnect the element-added signal.
2344
2345         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2346         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
2347         (WebCore::MediaPlayerPrivateGStreamer::sourceChanged):
2348
2349 2017-02-08  Miguel Gomez  <magomez@igalia.com>
2350
2351         [GTK] Reduce TiledBackingStore tile coverage when on memory pressure state
2352         https://bugs.webkit.org/show_bug.cgi?id=167980
2353
2354         Reviewed by Carlos Garcia Campos.
2355
2356         Use a smaller coverAreaMultiplier in the TiledBackingStore when in memory pressure situation, to reduce
2357         the amount of tiles created.
2358
2359         No new tests.
2360
2361         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
2362         (WebCore::TiledBackingStore::createTilesIfNeeded):
2363         (WebCore::TiledBackingStore::createTiles):
2364         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
2365
2366 2017-02-08  Zan Dobersek  <zdobersek@igalia.com>
2367
2368         [EME] Implement MediaKeySession::remove()
2369         https://bugs.webkit.org/show_bug.cgi?id=167870
2370
2371         Reviewed by Xabier Rodriguez-Calvar.
2372
2373         Implement MediaKeySession::remove() as outlined in the specification.
2374
2375         The CDMInstance::removeSessionData() virtual method is added. CDMInstance
2376         implementors should remove any session data stored for the session that's
2377         represented by the passed-in session ID and session type.
2378
2379         Once the session data is removed, the passed-in callback should be invoked
2380         by the CDMInstance object so that MediaKeySession can immediately queue a
2381         task in which it updates key statuses and expiration, reject the promise if
2382         the data removal failed, or enqueue any license-release message and finally
2383         successfully resolve the promise.
2384
2385         MockCDMFactory gains the removeKeysFromSessionWithID() method that purges
2386         the keys for a given session ID. The method is called from
2387         MockCDMInstance::removeSessionData() implementation, which passes the
2388         removed keys to the RemoveSessionDataCallback, along with a license-release
2389         message that is checked in the tests. The key removal itself isn't tested
2390         yet because the MediaKeySession's `update key statuses` algorithm isn't
2391         implemented yet.
2392
2393         Test: media/encrypted-media/mock-MediaKeySession-remove.html
2394
2395         * Modules/encryptedmedia/CDMInstance.h:
2396         * Modules/encryptedmedia/MediaKeySession.cpp:
2397         (WebCore::MediaKeySession::remove):
2398         * testing/MockCDMFactory.cpp:
2399         (WebCore::MockCDMFactory::removeKeysFromSessionWithID):
2400         (WebCore::MockCDMInstance::removeSessionData):
2401         * testing/MockCDMFactory.h:
2402
2403 2017-02-08  Zan Dobersek  <zdobersek@igalia.com>
2404
2405         [EME] Implement MediaKeySession::close()
2406         https://bugs.webkit.org/show_bug.cgi?id=167869
2407
2408         Reviewed by Xabier Rodriguez-Calvar.
2409
2410         Implement MediaKeySession::close() as outlined in the specification.
2411
2412         The CDMInstance::closeSession() virtual method, when called, should
2413         close the session that's represented by the passed-in session ID on
2414         the CDMInstance implementor object. That's the same session ID that
2415         the CDMInstance object passes to the MediaKeySession class through
2416         the callback that's provided to the updateLicense call.
2417
2418         The CloseSessionCallback, passed to CDMInstance::closeSession(),
2419         should be invoked by the CDMInstance implementor once the session
2420         is closed. When that is invoked, another task is queued for the
2421         MediaKeySession object that runs the `session closed` algorithm
2422         and resolves the promise.
2423
2424         MockCDMInstance::closeSession() is defined to remove the session
2425         from the MockCDMFactory object and invoke the CloseSessionCallback.
2426
2427         Test: media/encrypted-media/mock-MediaKeySession-close.html
2428
2429         * Modules/encryptedmedia/CDMInstance.h:
2430         * Modules/encryptedmedia/MediaKeySession.cpp:
2431         (WebCore::MediaKeySession::close):
2432         * testing/MockCDMFactory.cpp:
2433         (WebCore::MockCDMInstance::closeSession):
2434         * testing/MockCDMFactory.h:
2435
2436 2017-02-08  Zan Dobersek  <zdobersek@igalia.com>
2437
2438         [EME] Alias CDMInstance enums to the specification-defined enums
2439         https://bugs.webkit.org/show_bug.cgi?id=167896
2440
2441         Reviewed by Sam Weinig.
2442
2443         Simplify the enums in the CDMInstance class by simply aliasing them
2444         to the EME specification-defined enums. CDMInstance::KeyStatus and
2445         CDMInstance::MessageType were already direct copies of the
2446         MediaKeyStatus and MediaKeyMessageType enums, while the
2447         CDMInstance::LicenseType had the members as MediaKeySessionType,
2448         but with slightly different names.
2449
2450         No changes in behavior.
2451
2452         * Modules/encryptedmedia/CDMInstance.h:
2453         * Modules/encryptedmedia/MediaKeySession.cpp:
2454         (WebCore::MediaKeySession::generateRequest):
2455         (WebCore::MediaKeySession::update):
2456         * testing/MockCDMFactory.cpp:
2457         (WebCore::MockCDMInstance::requestLicense):
2458
2459 2017-02-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2460
2461         REGRESSION(r210740): [GTK] 2.15 broke embedded videos in GNOME's yelp app
2462         https://bugs.webkit.org/show_bug.cgi?id=167887
2463
2464         Reviewed by Michael Catanzaro.
2465
2466         Update the m_renderingCanBeAccelerated when accelerated rendering state changes.
2467
2468         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2469         (WebCore::MediaPlayerPrivateGStreamerBase::acceleratedRenderingStateChanged):
2470         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):
2471         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2472
2473 2017-02-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2474
2475         [GTK] Handle extended colors in cairo and texture mapper backends
2476         https://bugs.webkit.org/show_bug.cgi?id=167943
2477
2478         Reviewed by Michael Catanzaro.
2479
2480         Fixes: css3/color/backgrounds-and-borders.html
2481                css3/color/box-shadows.html
2482                css3/color/canvas.html
2483                css3/color/composited-solid-backgrounds.html
2484                css3/color/text.html
2485
2486         * platform/graphics/Color.cpp:
2487         (WebCore::premultipliedARGBFromColor): Handle the case of color being extended.
2488         * platform/graphics/cairo/CairoUtilities.cpp:
2489         (WebCore::setSourceRGBAFromColor): Ditto.
2490         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2491         (WebCore::fillRectWithColor): Use isVisible() instead of alpha().
2492         (WebCore::GraphicsContext::drawEllipse): Ditto.
2493         * platform/graphics/gtk/ColorGtk.cpp:
2494         (WebCore::Color::operator GdkRGBA): Handle the case of color being extended.
2495         * platform/graphics/texmap/TextureMapperGL.cpp:
2496         (WebCore::TextureMapperGL::drawNumber): Ditto.
2497         * platform/graphics/texmap/TextureMapperLayer.cpp:
2498         (WebCore::blendWithOpacity): Ditto.
2499         (WebCore::TextureMapperLayer::paintSelf): Use isVisible() instead of alpha().
2500         (WebCore::TextureMapperLayer::computeOverlapRegions): Ditto.
2501
2502 2017-02-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2503
2504         WebItemProviderPasteboard should use -registerLoadHandlersToItemProvider: when creating a new UIItemProvider
2505         https://bugs.webkit.org/show_bug.cgi?id=167918
2506         <rdar://problem/30382347>
2507
2508         Reviewed by Tim Horton.
2509
2510         Adopts SPI in WebItemProviderPasteboard for object types that the platform knows how to serialize. Since we use
2511         -createObjectOfClass: to initialize data when reading off of the pasteboard, we need to match the format that
2512         objects conforming to UIItemProviderReading will expect. Thus, for all given objects that conform to
2513         UIItemProviderWriting, we have them register themselves to the item provider.
2514
2515         We register other UTI types due to the fact that PlatformPasteboardIOS does not care about the specific
2516         pasteboard used. This should not be necessary, however, since data written to the WebItemProviderPasteboard
2517         should never need to be read by an actual UIPasteboard. This will be refactored in a future patch to add a
2518         special type of WebItemProviderPasteboard-aware PlatformPasteboard.
2519
2520         Also fixes some reference counting issues in WebItemProviderPasteboard by changing the array of _itemProviders
2521         to be a RetainPtr.
2522
2523         * platform/ios/WebItemProviderPasteboard.mm:
2524         (-[WebItemProviderPasteboard init]):
2525         (-[WebItemProviderPasteboard pasteboardTypes]):
2526         (-[WebItemProviderPasteboard itemProviders]):
2527         (-[WebItemProviderPasteboard setItemProviders:]):
2528         (-[WebItemProviderPasteboard numberOfItems]):
2529         (-[WebItemProviderPasteboard setItems:]):
2530         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
2531         (-[WebItemProviderPasteboard itemProviderAtIndex:]):
2532         (-[WebItemProviderPasteboard dealloc]): Deleted.
2533
2534 2017-02-06  Ryosuke Niwa  <rniwa@webkit.org>
2535
2536         WebContent process repeatedly jetsams on BuzzFeed's Another Round page
2537         https://bugs.webkit.org/show_bug.cgi?id=167830
2538         <rdar://problem/30187368>
2539
2540         Reviewed by Simon Fraser.
2541
2542         The jetsams on https://www.buzzfeed.com/anotherround were caused by WebKit creating the backing store
2543         for every iframe's layer on the page regardless of whether they're in the viewport or not.
2544
2545         This was caused by GraphicsLayerCA's setVisibleAndCoverageRects not setting CoverageRectChanged on
2546         m_uncommittedChanges on the very first call. Fixed the bug by initializing m_uncommittedChanges
2547         to always have CoverageRectChanged so that the coverage rect would get updated properly.
2548
2549         Unfortunately, no new tests since somehow the backing store doesn't get created inside the test runner.
2550
2551         * platform/graphics/ca/GraphicsLayerCA.h:
2552         (WebCore::GraphicsLayerCA):
2553
2554 2017-02-07  Youenn Fablet  <youennf@gmail.com>
2555
2556         [WebRTC] LibWebRTCEndpoint should not own objects that should be destroyed on the main thread
2557         https://bugs.webkit.org/show_bug.cgi?id=167816
2558
2559         Reviewed by Alex Christensen.
2560
2561         Tests: webrtc/libwebrtc/release-while-creating-offer.html
2562                webrtc/libwebrtc/release-while-getting-stats.html
2563                webrtc/libwebrtc/release-while-setting-local-description.html
2564
2565         Moving AV sources, stats promises, ICE candidates from LibWebRTCEndpoint to LibWebRTCPeerConnectionBackend.
2566         This allows ensuring these are destroyed in the main thread.
2567
2568         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2569         (WebCore::MediaEndpointPeerConnection::getStats):
2570         * Modules/mediastream/MediaEndpointPeerConnection.h:
2571         * Modules/mediastream/PeerConnectionBackend.h:
2572         * Modules/mediastream/RTCPeerConnection.cpp:
2573         (WebCore::RTCPeerConnection::getStats):
2574         * Modules/mediastream/RTCPeerConnection.h:
2575         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2576         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
2577         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
2578         (WebCore::LibWebRTCMediaEndpoint::getStats):
2579         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::StatsCollector):
2580         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
2581         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2582         (WebCore::LibWebRTCMediaEndpoint::addIceCandidate):
2583         (WebCore::LibWebRTCMediaEndpoint::isStopped):
2584         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2585         (WebCore::LibWebRTCPeerConnectionBackend::~LibWebRTCPeerConnectionBackend):
2586         (WebCore::LibWebRTCPeerConnectionBackend::getStats):
2587         (WebCore::LibWebRTCPeerConnectionBackend::iceCandidateSucceeded):
2588         (WebCore::LibWebRTCPeerConnectionBackend::iceCandidateFailed):
2589         (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription):
2590         (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription):
2591         (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate):
2592         (WebCore::LibWebRTCPeerConnectionBackend::addAudioSource):
2593         (WebCore::LibWebRTCPeerConnectionBackend::addVideoSource):
2594         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2595         * testing/MockLibWebRTCPeerConnection.cpp:
2596         (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileCreatingOffer::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileCreatingOffer):
2597         (WebCore::releaseInNetworkThread):
2598         (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileCreatingOffer::CreateOffer):
2599         (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileGettingStats::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileGettingStats):
2600         (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileGettingStats::GetStats):
2601         (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileSettingDescription::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileSettingDescription):
2602         (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileSettingDescription::SetLocalDescription):
2603         (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection):
2604         * testing/MockLibWebRTCPeerConnection.h:
2605
2606 2017-02-07  Myles C. Maxfield  <mmaxfield@apple.com>
2607
2608         [Win] [GTK] [EFL] Compile (but don't use, yet) the platform-independent piece of ComplexTextController
2609         https://bugs.webkit.org/show_bug.cgi?id=167927
2610
2611         Reviewed by Brent Fulgham.
2612
2613         This patch simply moves some functions around to enable the Win, GTK, and EFL ports to compile the
2614         platform-independent pieces of ComplexTextController. Those parts of ComplexTextController have
2615         some dependencies which were previously only available on the Cocoa ports; however, those
2616         dependencies are easily created or moved from elsewhere. The next step is to populate the
2617         ComplexTextController::collectComplexTextRunsForCharacters() function for DirectWrite and HarfBuzz.
2618         Once that is done, UniscribeController and HarfBuzzShaper can be deleted.
2619
2620         Adds ComplexTextController TestWebKitAPI tests to the Win and GTK ports.
2621
2622         * CMakeLists.txt: Everyone can compile the platform-independent piece of ComplexTextController.
2623         * PlatformEfl.cmake: Add the HarfBuzz-specific piece.
2624         * PlatformGTK.cmake: Ditto.
2625         * PlatformWin.cmake: Add the DirectWrite-specific piece.
2626         * platform/graphics/ComplexTextController.cpp:
2627         (WebCore::TextLayoutDeleter::operator()): ComplexTextController shouldn't be enabled yet for Win,
2628         GTK, or EFL.
2629         (WebCore::FontCascade::createLayout): Ditto.
2630         (WebCore::FontCascade::width): Ditto.
2631         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Moved shared code to the shared
2632         file.
2633         * platform/graphics/Font.cpp:
2634         (WebCore::Font::noSynthesizableFeaturesFont): Default implementation for other ports.
2635         (WebCore::Font::variantCapsSupportsCharacterForSynthesis): Ditto.
2636         * platform/graphics/FontCascade.cpp:
2637         (WebCore::FontCascade::fontForCombiningCharacterSequence): Ditto.
2638         (WebCore::FontCascade::drawEmphasisMarksForComplexText): Ditto.
2639         (WebCore::FontCascade::createLayout): Deleted. Moved to ComplexTextController.
2640         (WebCore::TextLayoutDeleter::operator()): Deleted. Ditto.
2641         * platform/graphics/FontCascade.h: fontForCombiningCharacterSequence() should exist on all ports.
2642         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
2643         (WebCore::FontCascade::drawEmphasisMarksForComplexText): Deleted. Shared among all ports.
2644         * platform/graphics/cocoa/FontCascadeCocoa.mm:
2645         (WebCore::FontCascade::drawEmphasisMarksForComplexText): Deleted. Ditto.
2646         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp: Added.
2647         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Empty implementation of
2648         HarfBuzz-specific piece of ComplexTextController.
2649         * platform/graphics/mac/ComplexTextControllerCoreText.mm: Moved constructors to shared file.
2650         * platform/graphics/win/ComplexTextControllerDirectWrite.cpp: Added.
2651         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Empty implementation of
2652         Direct Write-specific piece of ComplexTextController.
2653         * platform/graphics/win/FontWin.cpp:
2654         (WebCore::FontCascade::drawEmphasisMarksForComplexText): Deleted. Shared among all ports.
2655
2656 2017-02-07  Alex Christensen  <achristensen@webkit.org>
2657
2658         Revert r166597
2659         https://bugs.webkit.org/show_bug.cgi?id=167951
2660
2661         Reviewed by Andreas Kling.
2662
2663         * platform/spi/cf/CFNetworkSPI.h:
2664         Remove now-unused SPI declaration.
2665
2666 2017-02-07  Sam Weinig  <sam@webkit.org>
2667
2668         Try to fix the windows build.
2669
2670         * bindings/js/ReadableStreamDefaultController.cpp:
2671
2672 2017-02-07  Youenn Fablet  <youennf@gmail.com>
2673
2674         [WebRTC] LibWebRTC WK2 network stack is not providing correct ports for ICE candidates
2675         https://bugs.webkit.org/show_bug.cgi?id=167939
2676
2677         Reviewed by Sam Weinig.
2678
2679         Test: webrtc/no-port-zero-in-upd-candidates.html
2680
2681         * testing/MockLibWebRTCPeerConnection.cpp:
2682         (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): Adding a way to create one real PC in WTR environment.
2683
2684 2017-02-07  Sam Weinig  <sam@webkit.org>
2685
2686         Update bindings tests results for additional include.
2687
2688         * bindings/scripts/test/JS/JSTestObj.cpp:
2689         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2690
2691 2017-02-07  Sam Weinig  <sam@webkit.org>
2692
2693         Try to fix the windows build.
2694
2695         * bindings/js/JSDOMConvertNumbers.h:
2696
2697 2017-02-07  Alex Christensen  <achristensen@webkit.org>
2698
2699         Fix libwebrtc build after r211728
2700         https://bugs.webkit.org/show_bug.cgi?id=167821
2701
2702         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
2703         (WebCore::RealtimeIncomingVideoSource::processNewSample):
2704         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2705         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
2706         (WebCore::RealtimeOutgoingAudioSource::sourceHasMoreMediaData): Deleted.
2707         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
2708         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
2709         (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
2710         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
2711         (WebCore::RealtimeOutgoingVideoSource::sourceHasMoreMediaData): Deleted.
2712         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
2713
2714 2017-02-07  Tim Horton  <timothy_horton@apple.com>
2715
2716         Remove accidentally-added (in r211409) patch reject file
2717
2718         * bindings/scripts/test/JS/JSTestSerialization.cpp.rej: Removed.
2719
2720 2017-02-07  Sam Weinig  <sam@webkit.org>
2721
2722         JSDOMConvert is too big. Split it up!
2723         https://bugs.webkit.org/show_bug.cgi?id=167806
2724
2725         Rubber-stamped by Geoff Garen.
2726
2727         Split JSDOMConvert up roughly by IDL type. Some are grouped for convenience, e.g. all the
2728         string types are together, all the numeric types are together. Also moved helpers from 
2729         JSDOMBinding to their respective JSDOMConvertFoo header. For now, JSDOMConvert.h as an
2730         umbrella of all the sub headers, but it will be removed, and the code generator taught
2731         to include the right header in a subsequent patch.
2732
2733         * CMakeLists.txt:
2734         * WebCore.xcodeproj/project.pbxproj:
2735         Add new files.
2736
2737         * bindings/js/IDBBindingUtilities.cpp:
2738         * bindings/js/IDBBindingUtilities.h:
2739         Remove toJS that takes a std::optional<IDBKeyPath>, it was unused, and update date code
2740         to only call valueToDate once, and pass things by reference.
2741
2742         * bindings/js/JSDOMBinding.cpp:
2743         * bindings/js/JSDOMBinding.h:
2744         Move most of the conversion helpers into their respective JSDOMConvertFoo header.
2745
2746         * bindings/js/JSDOMConvert.h:
2747         Leave for now, just has includes of all the broken out headers.
2748
2749         * bindings/js/JSDOMConvertAny.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2750         * bindings/js/JSDOMConvertBase.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2751         * bindings/js/JSDOMConvertBoolean.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2752         * bindings/js/JSDOMConvertBufferSource.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2753         * bindings/js/JSDOMConvertCallbacks.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2754         * bindings/js/JSDOMConvertDate.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
2755         * bindings/js/JSDOMConvertDate.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2756         * bindings/js/JSDOMConvertDictionary.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2757         * bindings/js/JSDOMConvertEnumeration.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2758         * bindings/js/JSDOMConvertEventListener.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2759         * bindings/js/JSDOMConvertIndexedDB.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2760         * bindings/js/JSDOMConvertInterface.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2761         * bindings/js/JSDOMConvertJSON.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2762         * bindings/js/JSDOMConvertNull.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2763         * bindings/js/JSDOMConvertNullable.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2764         * bindings/js/JSDOMConvertNumbers.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
2765         * bindings/js/JSDOMConvertNumbers.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2766         * bindings/js/JSDOMConvertObject.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2767         * bindings/js/JSDOMConvertRecord.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2768         * bindings/js/JSDOMConvertSequences.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2769         * bindings/js/JSDOMConvertSerializedScriptValue.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2770         * bindings/js/JSDOMConvertStrings.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
2771         * bindings/js/JSDOMConvertStrings.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2772         * bindings/js/JSDOMConvertUnion.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2773         * bindings/js/JSDOMConvertVariadic.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2774         * bindings/js/JSDOMConvertWebGL.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2775         * bindings/js/JSDOMConvertXPathNSResolver.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
2776
2777         * bindings/scripts/CodeGeneratorJS.pm:
2778         (GenerateParametersCheck):
2779         Add include of JSDOMConvertVariadic.h rather than JSDOMConvert.
2780
2781         * bindings/js/JSCryptoCustom.cpp:
2782         * bindings/js/JSCryptoOperationData.cpp:
2783         * bindings/js/JSImageDataCustom.cpp:
2784         * bindings/js/ReadableStreamDefaultController.h:
2785         * bindings/js/WebCoreTypedArrayController.cpp:
2786         * html/canvas/WebGLAny.cpp:
2787         * platform/mac/SerializedPlatformRepresentationMac.mm:
2788         Add includes for specific JSDOMConvert header now that helpers have 
2789         been moved their from JSDOMBinding.h
2790
2791 2017-02-07  Sam Weinig  <sam@webkit.org>
2792
2793         Remove unnecessary exports on inline functions. They were causing build failures
2794         with some compilers.
2795
2796         * Modules/mediasource/SampleMap.h:
2797         (WebCore::PresentationOrderSampleMap::begin):
2798         (WebCore::PresentationOrderSampleMap::end):
2799         (WebCore::PresentationOrderSampleMap::rbegin):
2800         (WebCore::PresentationOrderSampleMap::rend):
2801         (WebCore::DecodeOrderSampleMap::begin):
2802         (WebCore::DecodeOrderSampleMap::end):
2803         (WebCore::DecodeOrderSampleMap::rbegin):
2804         (WebCore::DecodeOrderSampleMap::rend):
2805         (WebCore::SampleMap::sizeInBytes):
2806         (WebCore::SampleMap::decodeOrder):
2807         (WebCore::SampleMap::presentationOrder):
2808         (WebCore::SampleMap::addRange):
2809         (WebCore::SampleMap::SampleMap): Deleted.
2810
2811 2017-02-07  Yusuke Suzuki  <utatane.tea@gmail.com>
2812
2813         Unreviewed, manual roll out of r211777
2814         https://bugs.webkit.org/show_bug.cgi?id=167457
2815
2816         * bindings/js/ScriptModuleLoader.cpp:
2817         (WebCore::ScriptModuleLoader::importModule):
2818
2819 2017-02-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2820
2821         [GStreamer] Deadlock when media player is destroyed
2822         https://bugs.webkit.org/show_bug.cgi?id=167861
2823
2824         Reviewed by Michael Catanzaro.
2825
2826         The problem is that we are calling notifyOne() for the draw mutex without taking the lock.
2827
2828         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2829         (WebCore::MediaPlayerPrivateGStreamerBase::repaint):
2830
2831 2017-02-07  Zan Dobersek  <zdobersek@igalia.com>
2832
2833         MediaSourceClientGStreamerMSE: wrap FastMalloc-ed memory into pipeline-bound GstBuffers
2834         https://bugs.webkit.org/show_bug.cgi?id=167928
2835
2836         Reviewed by Xabier Rodriguez-Calvar.
2837
2838         The buffers created in MediaSourceClientGStreamerMSE can be large enough in size
2839         that repetitive allocations can cause larger heap fragmentation in different libc
2840         allocators. To avoid that occurrence, we should simply use FastMalloc to allocate
2841         memory for these buffers.
2842
2843         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
2844         (WebCore::MediaSourceClientGStreamerMSE::append):
2845
2846 2017-02-07  Antoine Quint  <graouts@apple.com>
2847
2848         [Modern Media Controls] Handle media durations of an hour or more gracefully
2849         https://bugs.webkit.org/show_bug.cgi?id=167882
2850         <rdar://problem/29601260>
2851
2852         Reviewed by Eric Carlson.
2853
2854         We add a new "labelsMayDisplayTimesOverAnHour" to TimeControl so that time labels
2855         to the left and right of the scrubber may have extra room to display to account for
2856         the extra "xx:" characters that may appear. We don't lay the time out dynamically
2857         such that we don't see layout jumps as the times shown in the labels go around
2858         the hour mark.
2859
2860         We also refactor the ElapsedTimeSupport and RemainingTimeSupport in a single
2861         TimeLabelsSupport class which updates both elapsed and remaining time labels
2862         and sets the "labelsMayDisplayTimesOverAnHour" on the TimeControl should a
2863         "durationchange" happen to make the media duration reach or go past the hour mark.
2864
2865         Tests: http/tests/media/modern-media-controls/time-labels-support/long-time.html
2866                media/modern-media-controls/time-control/time-control-labels-may-display-times-over-an-hour.html
2867                media/modern-media-controls/time-labels-support/elapsed-time.html
2868                media/modern-media-controls/time-labels-support/remaining-time.html
2869
2870         * Modules/modern-media-controls/controls/time-control.js:
2871         (TimeControl.prototype.get labelsMayDisplayTimesOverAnHour):
2872         (TimeControl.prototype.set labelsMayDisplayTimesOverAnHour):
2873         (TimeControl.prototype.set width):
2874         * Modules/modern-media-controls/controls/time-label.css:
2875         (.time-label):
2876         * Modules/modern-media-controls/js-files:
2877         * Modules/modern-media-controls/media/elapsed-time-support.js: Removed.
2878         * Modules/modern-media-controls/media/media-controller.js:
2879         (MediaController.prototype._updateControlsIfNeeded):
2880         * Modules/modern-media-controls/media/time-labels-support.js: Renamed from Source/WebCore/Modules/modern-media-controls/media/remaining-time-support.js.
2881         (TimeLabelsSupport.prototype.get control):
2882         (TimeLabelsSupport.prototype.syncControl):
2883         (TimeLabelsSupport):
2884         * WebCore.xcodeproj/project.pbxproj:
2885
2886 2017-02-06  Per Arne Vollan  <pvollan@apple.com>
2887
2888         Read stroke width of subtitles from MediaAccessibility framework.
2889         https://bugs.webkit.org/show_bug.cgi?id=167871
2890         <rdar://problem/29265906>
2891
2892         Reviewed by Brent Fulgham.
2893
2894         Read MACaptionFontAttributeStrokeWidth from CTFontDescriptorRef.
2895
2896         * page/CaptionUserPreferencesMediaAF.cpp:
2897         (WebCore::CaptionUserPreferencesMediaAF::strokeWidth):
2898         (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS):
2899         * page/CaptionUserPreferencesMediaAF.h:
2900         * platform/cf/MediaAccessibilitySoftLink.cpp:
2901         * platform/cf/MediaAccessibilitySoftLink.h:
2902
2903 2017-02-07  Antoine Quint  <graouts@apple.com>
2904
2905         [Modern Media Controls] Improve handling of <video> with only audio tracks
2906         https://bugs.webkit.org/show_bug.cgi?id=167836
2907         <rdar://problem/30255812>
2908
2909         Reviewed by Dean Jackson.
2910
2911         We now check for the availability of video tracks before considering a <video>
2912         element is displaying an actual video file and turning auto-hide on. We also
2913         check that we have video tracks before enabling the fullscreen button. This
2914         brings the behavior of a <video> pointing to a resource with no video tracks
2915         to be the same as an <audio> element.
2916
2917         Test: media/modern-media-controls/media-controller/media-controller-video-with-only-audio.html
2918
2919         * Modules/modern-media-controls/media/controls-visibility-support.js:
2920         (ControlsVisibilitySupport.prototype.get tracksToMonitor):
2921         (ControlsVisibilitySupport.prototype._updateControls):
2922         (ControlsVisibilitySupport):
2923         * Modules/modern-media-controls/media/fullscreen-support.js:
2924         (FullscreenSupport.prototype.syncControl):
2925         (FullscreenSupport):
2926
2927 2017-02-07  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2928
2929         [Readable Streams API] Implement ReadableByteStreamController enqueue()
2930         https://bugs.webkit.org/show_bug.cgi?id=167786
2931
2932         Reviewed by Youenn Fablet.
2933
2934         Implemented ReadableByteStreamController enqueue() method. Also replaced
2935         @queue by an Array instead of a dedicated queue object (said object is
2936         useful for ReadableStreamDefaultController, but not for ReadableByteStreamController).
2937
2938         Added 8 tests to cover newly added code as well as code that was previously unreachable.
2939
2940         * Modules/streams/ReadableByteStreamController.js:
2941         (enqueue): Implemented as defined by spec.
2942         * Modules/streams/ReadableByteStreamInternals.js:
2943         (privateInitializeReadableByteStreamController): Updated @queue.
2944         (readableByteStreamControllerCancel): Updated @queue.
2945         (readableByteStreamControllerError): Updated @queue.
2946         (readableByteStreamControllerPull): Updated @queue.
2947         (readableByteStreamControllerEnqueue): Added.
2948         (readableByteStreamControllerEnqueueChunkToQueue): Added.
2949         * Modules/streams/ReadableStreamInternals.js:
2950         (readableStreamFulfillReadRequest): Added (used at different places).
2951
2952 2017-02-07  Chris Dumez  <cdumez@apple.com>
2953
2954         Object.preventExtensions() on a Location object should throw a TypeError
2955         https://bugs.webkit.org/show_bug.cgi?id=167917
2956
2957         Reviewed by Alex Christensen.
2958
2959         Object.preventExtensions() on a Location object should throw a TypeError:
2960         - https://html.spec.whatwg.org/#location-preventextensions
2961         - https://www.ecma-international.org/ecma-262/7.0/index.html#sec-object.preventextensions
2962
2963         Firefox already implements this.
2964
2965         No new tests, rebaselined existing tests.
2966
2967         * bindings/js/JSLocationCustom.cpp:
2968         (WebCore::JSLocation::preventExtensions):
2969
2970 2017-02-07  Yusuke Suzuki  <utatane.tea@gmail.com>
2971
2972         Web Inspector: allow import() inside the inspector
2973         https://bugs.webkit.org/show_bug.cgi?id=167457
2974
2975         Reviewed by Ryosuke Niwa.
2976
2977         When evaluating `import("...")`, we need the caller's context to resolve
2978         the module specifier correctly. For example, if `import("./cocoa.js")` is
2979         evaluated in the script "drinks/hot.js", this module name is resolved to
2980         "drinks/cocoa.js". If the same import operator is evaluated in the script
2981         "menu/all.js", the module specifier becomes "menu/cocoa.js".
2982
2983         Previously we reject the import operator if the caller does not have such
2984         a context. These context is SourceOrigin and its ScriptFetcher. While they
2985         are offered in the script tag and other code evaluations, the inspector
2986         console does not offer that. These class are offered in the WebCore side
2987         and we should not touch these classes in the JSC's inspector code.
2988
2989         Now we relax the above restriction. If the above caller information is not
2990         offered, we fallback to the default one. In the web page, we use the page's
2991         URL as the caller's source origin. This allows us to evaluate the import
2992         operator in the inspector console.
2993
2994         And as of r167698, the console recognizes `await import("...")` form. We use
2995         this to test this `import()` in the console functionality.
2996
2997         * bindings/js/ScriptModuleLoader.cpp:
2998         (WebCore::ScriptModuleLoader::importModule):
2999
3000 2017-02-07  Myles C. Maxfield  <mmaxfield@apple.com>
3001
3002         Move platform-independent parts of ComplexTextController out of mac/ subfolder
3003         https://bugs.webkit.org/show_bug.cgi?id=167922
3004
3005         Reviewed by Jon Lee.
3006
3007         Just a mechanical git mv, and updating the Xcode projects.
3008
3009         No new tests because there is no behavior change.
3010
3011         * WebCore.xcodeproj/project.pbxproj:
3012         * platform/graphics/ComplexTextController.cpp: Renamed from Source/WebCore/platform/graphics/mac/ComplexTextController.cpp.
3013         * platform/graphics/ComplexTextController.h: Renamed from Source/WebCore/platform/graphics/mac/ComplexTextController.h.
3014
3015 2017-02-06  Carlos Garcia Campos  <cgarcia@igalia.com>
3016
3017         Overlay scrolling with iframe-s broken
3018         https://bugs.webkit.org/show_bug.cgi?id=165056
3019
3020         Reviewed by Antonio Gomes.
3021
3022         Mouse press events for overlay scrollbars are ignored if there's a subframe under the scrollbar. This doesn't
3023         happen with normal scrollbars, because the subframe is not really under the scrollbar, so events are always
3024         correctly passed to the scrollbar. With overlay scrollbars, the hit test detects the scrollbar, but events are
3025         always passed first to the subframe. Scrollbars are correctly updated on hover though, because
3026         handleMouseMoveEvent checks the presence of scrollbars before checking for subframes and move events are
3027         actually passed to both, the scrollbar and the subframe. Overlay scrollbars should always take precedence over
3028         subframes to handle mouse press events, so we should check first if mouse is over a scrollbar and never pass the
3029         event to a subframe in that case. Another problem is that the cursor is not updated either when the overlay
3030         scrollbar is hovered and there's a subframe. This is because in handleMouseMoveEvent we pass the event to both
3031         the scrollbar and subframe but we never update the cursor when a suframe was found. So, here again we need to make
3032         an exception for scrollbars and upate the cursor when mouse is over the scrollbar even if a subframe was found.
3033
3034         Test: fast/scrolling/scroll-animator-overlay-scrollbars-clicked.html
3035
3036         * page/EventHandler.cpp:
3037         (WebCore::EventHandler::handleMousePressEvent): Move the scrollbar check before the subframe check.
3038         (WebCore::EventHandler::handleMouseMoveEvent): Update the cursor when hovering a scrollbar even if a subframe
3039         was found.
3040         (WebCore::EventHandler::updateLastScrollbarUnderMouse): Use an enum instead of a boolean for setLast parameter.
3041         * page/EventHandler.h:
3042
3043 2017-02-06  Chris Dumez  <cdumez@apple.com>
3044
3045         Symbols exposed on cross-origin Window / Location objects should be configurable
3046         https://bugs.webkit.org/show_bug.cgi?id=167920
3047
3048         Reviewed by Ryosuke Niwa.
3049
3050         Symbols exposed on cross-origin Window / Location objects should be configurable:
3051         - https://html.spec.whatwg.org/#crossorigingetownpropertyhelper-(-o,-p-) (Step 1)
3052
3053         Firefox behaves as per specification.
3054
3055         No new tests, rebaselined existing test.
3056
3057         * bindings/js/JSDOMWindowCustom.cpp:
3058         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
3059         * bindings/js/JSLocationCustom.cpp:
3060         (WebCore::JSLocation::getOwnPropertySlotDelegate):
3061
3062 2017-02-06  Joseph Pecoraro  <pecoraro@apple.com>
3063
3064         Web Inspector: Do not use RunLoop when dispatching inspector GC event
3065         https://bugs.webkit.org/show_bug.cgi?id=167683
3066         <rdar://problem/30167791>
3067
3068         Reviewed by Brian Burg.
3069
3070         Covered by existing tests.
3071
3072         * CMakeLists.txt:
3073         * WebCore.xcodeproj/project.pbxproj:
3074         * inspector/InspectorAllInOne.cpp:
3075         Add new file.
3076
3077         * inspector/PageHeapAgent.cpp:
3078         (WebCore::PageHeapAgent::PageHeapAgent):
3079         (WebCore::PageHeapAgent::enable):
3080         (WebCore::PageHeapAgent::disable):
3081         * inspector/PageHeapAgent.h:
3082         Extend WebHeapAgent.
3083
3084         * inspector/WorkerInspectorController.cpp:
3085         (WebCore::WorkerInspectorController::WorkerInspectorController):
3086         Use WebHeapAgent.
3087
3088         * inspector/WebHeapAgent.cpp: Added.
3089         (WebCore::SendGarbageCollectionEventsTask::SendGarbageCollectionEventsTask):
3090         (WebCore::SendGarbageCollectionEventsTask::addGarbageCollection):
3091         (WebCore::SendGarbageCollectionEventsTask::reset):
3092         (WebCore::SendGarbageCollectionEventsTask::timerFired):
3093         (WebCore::WebHeapAgent::WebHeapAgent):
3094         (WebCore::WebHeapAgent::~WebHeapAgent):
3095         (WebCore::WebHeapAgent::disable):
3096         (WebCore::WebHeapAgent::dispatchGarbageCollectedEvent):
3097         (WebCore::WebHeapAgent::dispatchGarbageCollectionEventsAfterDelay):
3098         * inspector/WebHeapAgent.h:
3099         Move the defered event dispatch from InspectorHeapAgent here where a RunLoop is guarenteed.
3100
3101 2017-02-06  Joseph Pecoraro  <pecoraro@apple.com>
3102
3103         ExtendedColor leaks seen on leaks bot
3104         https://bugs.webkit.org/show_bug.cgi?id=167912
3105
3106         Reviewed by Alexey Proskuryakov.
3107
3108         * platform/graphics/Color.cpp:
3109         (WebCore::Color::operator=):
3110         Before overwriting m_colorData, we must deref the extended color inside it.
3111
3112 2017-02-06  Simon Fraser  <simon.fraser@apple.com>
3113
3114         Re-land r210095 (avoid a tile revalidation on scale change)
3115         https://bugs.webkit.org/show_bug.cgi?id=167866
3116
3117         Reviewed by Tim Horton.
3118         
3119         r210095 was rolled out in r211230 but now that all TileControllers unparent
3120         offscreen tiles, we can roll it back it.
3121         
3122         Also add more Tiling logging.
3123
3124         * platform/graphics/ca/TileGrid.cpp:
3125         (WebCore::validationPolicyAsString):
3126         (WebCore::TileGrid::setScale):
3127         (WebCore::TileGrid::prepopulateRect):
3128         (WebCore::TileGrid::revalidateTiles):
3129         (WebCore::TileGrid::ensureTilesForRect):
3130
3131 2017-02-06  Myles C. Maxfield  <mmaxfield@apple.com>
3132
3133         Migrate ComplexTextController to use platform-independent types
3134         https://bugs.webkit.org/show_bug.cgi?id=167833
3135
3136         Reviewed by Brent Fulgham.
3137
3138         ComplexTextController will eventually be used on all ports to perform complex text layout.
3139         This is a mechanical patch which migrates the shared parts of ComplexTextController away from
3140         using CoreGraphics and CoreFoundation types in favor of WebCore/platform types. Eventually,
3141         ComplexTextController will get moved to PAL but there is a layering violation (TextLayout) to
3142         fix first.
3143
3144         No new tests because there is no behavior change.
3145
3146         * platform/graphics/GlyphBuffer.h:
3147         (WebCore::GlyphBufferAdvance::GlyphBufferAdvance):
3148         * platform/graphics/mac/ComplexTextController.cpp:
3149         (WebCore::ComplexTextController::offsetForPosition):
3150         (WebCore::advanceByCombiningCharacterSequence):
3151         (WebCore::ComplexTextController::ComplexTextRun::indexAt):
3152         (WebCore::ComplexTextController::ComplexTextRun::setIsNonMonotonic):
3153         (WebCore::ComplexTextController::advance):
3154         (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
3155         * platform/graphics/mac/ComplexTextController.h:
3156         (WebCore::ComplexTextController::ComplexTextRun::create):
3157         (WebCore::ComplexTextController::ComplexTextRun::stringLength):
3158         (WebCore::ComplexTextController::ComplexTextRun::indexBegin):
3159         (WebCore::ComplexTextController::ComplexTextRun::indexEnd):
3160         (WebCore::ComplexTextController::ComplexTextRun::endOffsetAt):
3161         (WebCore::ComplexTextController::ComplexTextRun::glyphs):
3162         (WebCore::ComplexTextController::ComplexTextRun::growInitialAdvanceHorizontally):
3163         (WebCore::ComplexTextController::ComplexTextRun::initialAdvance):
3164         (WebCore::ComplexTextController::ComplexTextRun::baseAdvances):
3165         (WebCore::ComplexTextController::ComplexTextRun::glyphOrigins):
3166         (WebCore::ComplexTextController::glyphOrigin):
3167         (WebCore::ComplexTextController::ComplexTextRun::createForTesting): Deleted.
3168         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
3169         (SOFT_LINK):
3170         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
3171         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
3172
3173 2017-02-06  Brent Fulgham  <bfulgham@apple.com>
3174
3175         Correct File Path Handling in SecurityOrigin and FileSystem
3176         https://bugs.webkit.org/show_bug.cgi?id=167894
3177         <rdar://problem/30380080>
3178
3179         Reviewed by Alexey Proskuryakov.
3180
3181         Roll out the URL decoding being done in the FileSystem class (added in Bug 167894), and instead ensure that
3182         SecurityOrigin properly handles file URLs, and only passes valid file strings to the FileSystem interface.
3183
3184         Tested by FileSystemTests and SecurityOriginTests in TestWebKitAPI.
3185
3186         * page/SecurityOrigin.cpp:
3187         (WebCore::SecurityOrigin::SecurityOrigin): Initialize m_filePath using the url's fileSystemPath, not
3188         the %-encoded 'path' property.
3189         (WebCore::SecurityOrigin::canDisplay): Pass the 'fileSystemPath' to 'filesHaveSameVolume', rather than
3190         the %-encoded 'path' property.
3191         * page/SecurityOrigin.h:
3192         * platform/FileSystem.cpp:
3193         (WebCore::filesHaveSameVolume): Do not use 'decodeURLEscapeSequences' in 'filesHaveSameVolume'.
3194
3195 2017-02-06  Andy Estes  <aestes@apple.com>
3196
3197         [Cocoa] Split FileSystemMac.mm into Mac and Cocoa parts
3198         https://bugs.webkit.org/show_bug.cgi?id=167908
3199
3200         Reviewed by Sam Weinig.
3201
3202         Kept the Mac-only functions in FileSystemMac.mm and moved the rest into FileSystemCocoa.mm.
3203
3204         * PlatformMac.cmake:
3205         * WebCore.xcodeproj/project.pbxproj:
3206         * platform/cocoa/FileSystemCocoa.mm: Copied from Source/WebCore/platform/mac/FileSystemMac.mm.
3207         * platform/mac/FileSystemMac.mm:
3208         (-[WebFileManagerDelegate fileManager:shouldProceedAfterError:movingItemAtURL:toURL:]): Moved to FileSystemCocoa.mm.
3209         (WebCore::homeDirectoryPath): Ditto.
3210         (WebCore::openTemporaryFile): Ditto.
3211         (WebCore::moveFile): Ditto.
3212         (WebCore::getVolumeFreeSpace): Ditto.
3213
3214 2017-02-06  Eric Carlson  <eric.carlson@apple.com>
3215
3216         [MediaStream Mac] Remove some unused code
3217         https://bugs.webkit.org/show_bug.cgi?id=167913
3218
3219         Reviewed by Jer Noble.
3220
3221         No new tests, no functional change.
3222
3223         * platform/mediastream/CaptureDeviceManager.h:
3224         (WebCore::CaptureSessionInfo::~CaptureSessionInfo): Deleted.
3225         (WebCore::CaptureSessionInfo::supportsVideoSize): Deleted.
3226         (WebCore::CaptureSessionInfo::bestSessionPresetForVideoDimensions): Deleted.
3227         * platform/mediastream/mac/AVCaptureDeviceManager.h:
3228         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
3229         (WebCore::AVCaptureDeviceManager::refreshCaptureDeviceList):
3230         (WebCore::AVCaptureSessionInfo::AVCaptureSessionInfo): Deleted.
3231         (WebCore::AVCaptureSessionInfo::supportsVideoSize): Deleted.
3232         (WebCore::AVCaptureSessionInfo::bestSessionPresetForVideoDimensions): Deleted.
3233         * platform/mediastream/mac/AVMediaCaptureSource.mm:
3234         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource):
3235
3236 2017-02-06  Youenn Fablet  <youennf@gmail.com>
3237
3238         Allow some schemes to opt-out of CORS
3239         https://bugs.webkit.org/show_bug.cgi?id=167795
3240
3241         Reviewed by Alex Christensen.
3242
3243         Test: http/tests/security/bypassing-cors-checks-for-extension-urls.html
3244
3245         Adding the possibility to opt out of CORS for DocumentThreadableLoader clients (fetch and XHR).
3246         This is made specific to the case of user extension URLs for pages running user scripts.
3247         Introducing a boolean flag in Page for that purpose.
3248         Introducing a helper routine in SchemeRegistry to centralize the various user script extension schemes.
3249
3250         * loader/DocumentThreadableLoader.cpp:
3251         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
3252         * page/Frame.cpp:
3253         (WebCore::Frame::injectUserScripts):
3254         * page/Page.h:
3255         (WebCore::Page::setAsRunningUserScripts):
3256         (WebCore::Page::isRunningUserScripts):
3257         * platform/SchemeRegistry.cpp:
3258         (WebCore::SchemeRegistry::isUserExtensionScheme):
3259         * platform/SchemeRegistry.h:
3260         * testing/Internals.cpp:
3261         (WebCore::Internals::setAsRunningUserScripts):
3262         * testing/Internals.h:
3263         * testing/Internals.idl:
3264
3265 2017-02-06  Chris Dumez  <cdumez@apple.com>
3266
3267         Align [[OwnPropertyKeys]] with the HTML specification for cross-origin Window / Location objects
3268         https://bugs.webkit.org/show_bug.cgi?id=167647
3269         <rdar://problem/30339489>
3270
3271         Reviewed by Sam Weinig.
3272
3273         Align [[OwnPropertyKeys]] with the HTML specification for cross-origin Window / Location objects:
3274         - https://html.spec.whatwg.org/#windowproxy-ownpropertykeys [1]
3275         - https://html.spec.whatwg.org/#crossoriginownpropertykeys-(-o-) [2]
3276         - https://html.spec.whatwg.org/#crossoriginproperties-(-o-) [3]
3277
3278         In particular, the following changes were made:
3279         - Location:
3280           - We now return the following symbols as well: @@toStringTag, @@hasInstance,
3281             @@isConcatSpreadable as per [2].
3282         - Window:
3283           - We now return the following symbols as well: @@toStringTag, @@hasInstance,
3284             @@isConcatSpreadable as per [2].
3285           - We now return the indices of the child browsing contexts as per [1].
3286           - We now return the names of the child browsing contexts as per [3].
3287
3288         No new tests, updated / rebaselined existing tests.
3289
3290         * bindings/js/JSDOMWindowCustom.cpp:
3291         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
3292         Index properties should be configurable as per:
3293         - https://html.spec.whatwg.org/#windowproxy-getownproperty (step 2.5)
3294
3295         (WebCore::inScope):
3296         (WebCore::addScopedChildrenNames):
3297         (WebCore::addCrossOriginPropertyNames):
3298         (WebCore::addScopedChildrenIndexes):
3299         (WebCore::addCrossOriginOwnPropertyNames):
3300         (WebCore::JSDOMWindow::getOwnPropertyNames):
3301         * bindings/js/JSLocationCustom.cpp:
3302         (WebCore::addCrossOriginPropertyNames):
3303         (WebCore::addCrossOriginOwnPropertyNames):
3304         (WebCore::JSLocation::getOwnPropertyNames):
3305
3306 2017-02-06  Yoav Weiss  <yoav@yoav.ws>
3307
3308         http/tests/preload/dynamic_removing_preload.html fails to test what it should
3309         https://bugs.webkit.org/show_bug.cgi?id=167792
3310
3311         Reviewed by Ryosuke Niwa.
3312
3313         Cancel the link preload resource load when the link element is removed from the DOM.
3314
3315         No new tests, but unskipping an existing test: http/tests/preload/dynamic_removing_preload.html
3316
3317         * html/HTMLLinkElement.cpp:
3318         (WebCore::HTMLLinkElement::removedFrom): Call m_linkLoader.cancelLoad().
3319         * loader/LinkLoader.cpp:
3320         (WebCore::LinkLoader::cancelLoad): Clear m_preloadResourceClient.
3321         * loader/LinkLoader.h:
3322         * loader/LinkPreloadResourceClients.h:
3323         (WebCore::LinkPreloadResourceClient::clearResource): Call m_resource->cancelLoad().
3324         * loader/SubresourceLoader.cpp:
3325         (WebCore::LinkPreloadResourceClient::didFinishLoading): Change ASSERT to exempt cancelled loads.
3326
3327 2017-02-06  Alex Christensen  <achristensen@webkit.org>
3328
3329         More build fixes after r211751
3330         https://bugs.webkit.org/show_bug.cgi?id=166998
3331
3332         * platform/network/soup/ResourceHandleSoup.cpp:
3333         (WebCore::applyAuthenticationToRequest):
3334         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
3335         (WebCore::SocketStreamHandleImpl::create):
3336
3337 2017-02-06  Alex Christensen  <achristensen@webkit.org>
3338
3339         Fix non-cocoa builds after r211751.
3340         https://bugs.webkit.org/show_bug.cgi?id=166998
3341
3342         * platform/network/cf/ResourceHandleCFNet.cpp:
3343         (WebCore::ResourceHandle::createCFURLConnection):
3344         (WebCore::ResourceHandle::willSendRequest):
3345         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
3346         (WebCore::ResourceHandle::receivedCredential):
3347         * platform/network/curl/ResourceHandleCurl.cpp:
3348         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
3349         (WebCore::ResourceHandle::receivedCredential):
3350         * platform/network/curl/ResourceHandleManager.cpp:
3351         (WebCore::ResourceHandleManager::applyAuthenticationToRequest):
3352         * platform/network/soup/ResourceHandleSoup.cpp:
3353         (WebCore::applyAuthenticationToRequest):
3354         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
3355         (WebCore::ResourceHandle::receivedCredential):
3356
3357 2017-02-06  Alex Christensen  <achristensen@webkit.org>
3358
3359         credentials should be partitioned by main document domain
3360         https://bugs.webkit.org/show_bug.cgi?id=166998
3361         rdar://problem/22901123
3362
3363         Reviewed by Brady Eidson.
3364
3365         Covered by http/tests/security/credentials-iframes.html
3366         Also added http/tests/security/credentials-from-different-domains.html to verify existing behavior without iframes.
3367
3368         * Modules/websockets/WebSocketChannel.cpp:
3369         (WebCore::WebSocketChannel::connect):
3370         * dom/Document.h:
3371         * page/SecurityOrigin.cpp:
3372         (WebCore::SecurityOrigin::domainForCachePartition):
3373         Return emptyString instead of a null String because it is used as a key in a HashMap, and hashing null strings dereferences null.
3374         * page/SocketProvider.cpp:
3375         (WebCore::SocketProvider::createSocketStreamHandle):
3376         * page/SocketProvider.h:
3377         * platform/network/CredentialStorage.cpp:
3378         (WebCore::CredentialStorage::set):
3379         (WebCore::CredentialStorage::get):
3380         (WebCore::CredentialStorage::remove):
3381         * platform/network/CredentialStorage.h:
3382         Partition credentials.
3383         * platform/network/ResourceHandleInternal.h:
3384         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
3385         * platform/network/cf/SocketStreamHandleImpl.h:
3386         (WebCore::SocketStreamHandleImpl::create):
3387         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
3388         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
3389         (WebCore::SocketStreamHandleImpl::getStoredCONNECTProxyCredentials):
3390         * platform/network/curl/SocketStreamHandleImpl.h:
3391         (WebCore::SocketStreamHandleImpl::create):
3392         * platform/network/mac/ResourceHandleMac.mm:
3393         (WebCore::ResourceHandle::createNSURLConnection):
3394         (WebCore::ResourceHandle::willSendRequest):
3395         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
3396         (WebCore::ResourceHandle::receivedCredential):
3397         * platform/network/soup/SocketStreamHandleImpl.h:
3398
3399 2017-02-06  Simon Fraser  <simon.fraser@apple.com>
3400
3401         Safari pages are blank sometimes (missing tiles)
3402         https://bugs.webkit.org/show_bug.cgi?id=167904
3403
3404         Reviewed by Tim Horton.
3405
3406         After r211683 we failed to udpate the "inWindow" flag on the page tiled layer, because
3407         usingTiledBacking() on GraphicsLayer confusingly was false for the page tiled layer.
3408
3409         Fix by removing usingTiledBacking() entirely, and checking for tiledBacking(),
3410         looking at the layer type when necessary.
3411
3412         Tested by tiled-drawing/tiled-backing-in-window.html
3413
3414         * platform/graphics/GraphicsLayer.cpp:
3415         (WebCore::GraphicsLayer::GraphicsLayer):
3416         (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): This is the bug fix.
3417         (WebCore::GraphicsLayer::getDebugBorderInfo):
3418         (WebCore::GraphicsLayer::dumpProperties):
3419         * platform/graphics/GraphicsLayer.h:
3420         (WebCore::GraphicsLayer::usingTiledBacking): Deleted.
3421         * platform/graphics/ca/GraphicsLayerCA.cpp:
3422         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
3423         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
3424         (WebCore::GraphicsLayerCA::changeLayerTypeTo):
3425         * rendering/RenderLayerBacking.cpp:
3426         (WebCore::RenderLayerBacking::willDestroyLayer):
3427         (WebCore::RenderLayerBacking::compositingLayerType):
3428         * rendering/RenderLayerCompositor.cpp: A bit more logging.
3429         (WebCore::RenderLayerCompositor::setIsInWindow):
3430         (WebCore::RenderLayerCompositor::attachRootLayer):
3431
3432 2017-02-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
3433
3434         Change the CSS animation timer a to be little more than 60fps to ensure we hit that frame rate
3435         https://bugs.webkit.org/show_bug.cgi?id=167825
3436
3437         Reviewed by Simon Fraser.
3438
3439         The system timer fires little bit slower than 60fps. This might cause the
3440         frame to be missed and hence it can lower the frame rate significantly. The
3441         rAF timer was set to 15ms for the same reason. So set the repeated CSS
3442         animation timer also to 15ms.
3443
3444         * page/animation/CSSAnimationController.cpp:
3445
3446 2017-02-06  Jer Noble  <jer.noble@apple.com>
3447
3448         Playback stalls when a SourceBuffer append causes frame eviction
3449         https://bugs.webkit.org/show_bug.cgi?id=167834
3450
3451         Reviewed by Eric Carlson.
3452
3453         Test: PerformanceTests/Media/MSERemoveCodedFrames.html
3454
3455         Optimize searching through SampleMap by presentationTime.
3456
3457         Many of the methods exposed by PresentationOrderSampleMap used the bare  std::equal_range,
3458         lower_bound, or upper_bound methods. Unlike those methods exposed on std::map, the bare
3459         search methods perform a linear O(n) search, rather than a the binary O(log(n)) search used
3460         by std::map. Rewrite those methods using the bare methods in terms of the std::map search
3461         methods.
3462
3463         Drive-by fix: rename findSampleOnOrAfterPresentationTime to
3464         findSampleStartingOnOrAfterPresentationTime to make the behavior of the method more
3465         explicit.
3466
3467         * Modules/mediasource/SampleMap.cpp:
3468         (WebCore::PresentationOrderSampleMap::findSampleContainingPresentationTime):
3469         (WebCore::PresentationOrderSampleMap::findSampleStartingOnOrAfterPresentationTime):
3470         (WebCore::PresentationOrderSampleMap::reverseFindSampleBeforePresentationTime):
3471         (WebCore::DecodeOrderSampleMap::findSyncSampleAfterPresentationTime):
3472         (WebCore::PresentationOrderSampleMap::findSamplesBetweenPresentationTimes):
3473         (WebCore::PresentationOrderSampleMap::findSamplesWithinPresentationRange):
3474         (WebCore::PresentationOrderSampleMap::findSampleOnOrAfterPresentationTime): Deleted.
3475         * Modules/mediasource/SampleMap.h:
3476         (WebCore::PresentationOrderSampleMap::begin):
3477         (WebCore::PresentationOrderSampleMap::end):
3478         (WebCore::PresentationOrderSampleMap::rbegin):
3479         (WebCore::PresentationOrderSampleMap::rend):
3480         (WebCore::DecodeOrderSampleMap::begin):
3481         (WebCore::DecodeOrderSampleMap::end):
3482         (WebCore::DecodeOrderSampleMap::rbegin):
3483         (WebCore::DecodeOrderSampleMap::rend):
3484         (WebCore::SampleMap::SampleMap):
3485         (WebCore::SampleMap::sizeInBytes):
3486         (WebCore::SampleMap::decodeOrder):
3487         (WebCore::SampleMap::presentationOrder):
3488         * Modules/mediasource/SourceBuffer.cpp:
3489         (WebCore::removeSamplesFromTrackBuffer):
3490         (WebCore::SourceBuffer::removeCodedFrames):
3491         (WebCore::SourceBuffer::reenqueueMediaForTime):
3492         * WebCore.xcodeproj/project.pbxproj:
3493
3494 2017-02-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
3495
3496         Rename AnimationController to CSSAnimationController
3497         https://bugs.webkit.org/show_bug.cgi?id=167829
3498
3499         Reviewed by Simon Fraser.
3500
3501         AnimationController is a very generic name. The current function of this
3502         class is CSS animation.
3503
3504         * CMakeLists.txt:
3505         * WebCore.xcodeproj/project.pbxproj:
3506         * css/CSSComputedStyleDeclaration.cpp:
3507         (WebCore::computeRenderStyleForProperty):
3508         * dom/Document.cpp:
3509         * history/CachedFrame.cpp:
3510         * page/Frame.cpp:
3511         (WebCore::Frame::Frame):
3512         * page/Frame.h:
3513         (WebCore::Frame::animation):
3514         * page/FrameView.cpp:
3515         * page/Page.cpp:
3516         * page/animation/AnimationBase.cpp:
3517         * page/animation/CSSAnimationController.cpp: Renamed from Source/WebCore/page/animation/AnimationController.cpp.
3518         (WebCore::AnimationPrivateUpdateBlock::AnimationPrivateUpdateBlock):
3519         (WebCore::AnimationPrivateUpdateBlock::~AnimationPrivateUpdateBlock):
3520         (WebCore::CSSAnimationControllerPrivate::CSSAnimationControllerPrivate):
3521         (WebCore::CSSAnimationControllerPrivate::~CSSAnimationControllerPrivate):
3522         (WebCore::CSSAnimationControllerPrivate::ensureCompositeAnimation):
3523         (WebCore::CSSAnimationControllerPrivate::clear):
3524         (WebCore::CSSAnimationControllerPrivate::updateAnimations):
3525         (WebCore::CSSAnimationControllerPrivate::updateAnimationTimerForRenderer):
3526         (WebCore::CSSAnimationControllerPrivate::updateAnimationTimer):
3527         (WebCore::CSSAnimationControllerPrivate::updateStyleIfNeededDispatcherFired):
3528         (WebCore::CSSAnimationControllerPrivate::fireEventsAndUpdateStyle):
3529         (WebCore::CSSAnimationControllerPrivate::startUpdateStyleIfNeededDispatcher):
3530         (WebCore::CSSAnimationControllerPrivate::addEventToDispatch):
3531         (WebCore::CSSAnimationControllerPrivate::addElementChangeToDispatch):
3532         (WebCore::CSSAnimationControllerPrivate::animationFrameCallbackFired):
3533         (WebCore::CSSAnimationControllerPrivate::animationTimerFired):
3534         (WebCore::CSSAnimationControllerPrivate::isRunningAnimationOnRenderer):
3535         (WebCore::CSSAnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer):
3536         (WebCore::CSSAnimationControllerPrivate::suspendAnimations):
3537         (WebCore::CSSAnimationControllerPrivate::resumeAnimations):
3538         (WebCore::CSSAnimationControllerPrivate::animationsAreSuspendedForDocument):
3539         (WebCore::CSSAnimationControllerPrivate::detachFromDocument):
3540         (WebCore::CSSAnimationControllerPrivate::suspendAnimationsForDocument):
3541         (WebCore::CSSAnimationControllerPrivate::resumeAnimationsForDocument):
3542         (WebCore::CSSAnimationControllerPrivate::startAnimationsIfNotSuspended):
3543         (WebCore::CSSAnimationControllerPrivate::setAllowsNewAnimationsWhileSuspended):
3544         (WebCore::CSSAnimationControllerPrivate::pauseAnimationAtTime):
3545         (WebCore::CSSAnimationControllerPrivate::pauseTransitionAtTime):
3546         (WebCore::CSSAnimationControllerPrivate::beginAnimationUpdateTime):
3547         (WebCore::CSSAnimationControllerPrivate::beginAnimationUpdate):
3548         (WebCore::CSSAnimationControllerPrivate::endAnimationUpdate):
3549         (WebCore::CSSAnimationControllerPrivate::receivedStartTimeResponse):
3550         (WebCore::CSSAnimationControllerPrivate::getAnimatedStyleForRenderer):
3551         (WebCore::CSSAnimationControllerPrivate::computeExtentOfAnimation):
3552         (WebCore::CSSAnimationControllerPrivate::numberOfActiveAnimations):
3553         (WebCore::CSSAnimationControllerPrivate::addToAnimationsWaitingForStyle):
3554         (WebCore::CSSAnimationControllerPrivate::removeFromAnimationsWaitingForStyle):
3555         (WebCore::CSSAnimationControllerPrivate::styleAvailable):
3556         (WebCore::CSSAnimationControllerPrivate::addToAnimationsWaitingForStartTimeResponse):
3557         (WebCore::CSSAnimationControllerPrivate::removeFromAnimationsWaitingForStartTimeResponse):
3558         (WebCore::CSSAnimationControllerPrivate::startTimeResponse):
3559         (WebCore::CSSAnimationControllerPrivate::animationWillBeRemoved):
3560         (WebCore::CSSAnimationControllerPrivate::addToAnimationsDependentOnScroll):
3561         (WebCore::CSSAnimationControllerPrivate::removeFromAnimationsDependentOnScroll):
3562         (WebCore::CSSAnimationControllerPrivate::scrollWasUpdated):
3563         (WebCore::CSSAnimationController::CSSAnimationController):
3564         (WebCore::CSSAnimationController::~CSSAnimationController):
3565         (WebCore::CSSAnimationController::cancelAnimations):
3566         (WebCore::CSSAnimationController::updateAnimations):
3567         (WebCore::CSSAnimationController::getAnimatedStyleForRenderer):
3568         (WebCore::CSSAnimationController::computeExtentOfAnimation):
3569         (WebCore::CSSAnimationController::notifyAnimationStarted):
3570         (WebCore::CSSAnimationController::pauseAnimationAtTime):
3571         (WebCore::CSSAnimationController::numberOfActiveAnimations):
3572         (WebCore::CSSAnimationController::pauseTransitionAtTime):
3573         (WebCore::CSSAnimationController::isRunningAnimationOnRenderer):
3574         (WebCore::CSSAnimationController::isRunningAcceleratedAnimationOnRenderer):
3575         (WebCore::CSSAnimationController::isSuspended):
3576         (WebCore::CSSAnimationController::suspendAnimations):
3577         (WebCore::CSSAnimationController::resumeAnimations):
3578         (WebCore::CSSAnimationController::allowsNewAnimationsWhileSuspended):
3579         (WebCore::CSSAnimationController::setAllowsNewAnimationsWhileSuspended):
3580         (WebCore::CSSAnimationController::serviceAnimations):
3581         (WebCore::CSSAnimationController::animationsAreSuspendedForDocument):
3582         (WebCore::CSSAnimationController::detachFromDocument):
3583         (WebCore::CSSAnimationController::suspendAnimationsForDocument):
3584         (WebCore::CSSAnimationController::resumeAnimationsForDocument):
3585         (WebCore::CSSAnimationController::startAnimationsIfNotSuspended):
3586         (WebCore::CSSAnimationController::beginAnimationUpdate):
3587         (WebCore::CSSAnimationController::endAnimationUpdate):
3588         (WebCore::CSSAnimationController::supportsAcceleratedAnimationOfProperty):
3589         (WebCore::CSSAnimationController::wantsScrollUpdates):
3590         (WebCore::CSSAnimationController::scrollWasUpdated):
3591         (WebCore::CSSAnimationController::hasAnimations):
3592         * page/animation/CSSAnimationController.h: Renamed from Source/WebCore/page/animation/AnimationController.h.
3593         (WebCore::AnimationUpdateBlock::AnimationUpdateBlock):
3594         (WebCore::AnimationUpdateBlock::~AnimationUpdateBlock):
3595         * page/animation/CSSAnimationControllerPrivate.h: Renamed from Source/WebCore/page/animation/AnimationControllerPrivate.h.
3596         (WebCore::CSSAnimationControllerPrivate::hasAnimations):
3597         (WebCore::CSSAnimationControllerPrivate::isSuspended):
3598         (WebCore::CSSAnimationControllerPrivate::setBeginAnimationUpdateTime):
3599         (WebCore::CSSAnimationControllerPrivate::allowsNewAnimationsWhileSuspended):
3600         (WebCore::CSSAnimationControllerPrivate::wantsScrollUpdates):
3601         (WebCore::CSSAnimationControllerPrivate::scrollPosition):
3602         * page/animation/CSSPropertyAnimation.cpp:
3603         (WebCore::CSSPropertyAnimationWrapperMap::singleton):
3604         * page/animation/CompositeAnimation.cpp:
3605         (WebCore::CompositeAnimation::CompositeAnimation):
3606         * page/animation/CompositeAnimation.h:
3607         (WebCore::CompositeAnimation::create):
3608         (WebCore::CompositeAnimation::animationController):
3609         * page/animation/ImplicitAnimation.cpp:
3610         * page/animation/KeyframeAnimation.cpp:
3611         * page/ios/FrameIOS.mm:
3612         * platform/graphics/GraphicsLayer.h:
3613         * rendering/RenderElement.h:
3614         * rendering/RenderLayer.cpp:
3615         * rendering/RenderLayerBacking.cpp:
3616         * rendering/RenderLayerCompositor.cpp:
3617         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation):
3618         * rendering/RenderObject.cpp:
3619         * rendering/RenderObject.h:
3620         (WebCore::RenderObject::animation):
3621         * testing/Internals.cpp:
3622
3623 2017-02-06  Zalan Bujtas  <zalan@apple.com>
3624
3625         Simple line layout: Use simplified text measuring when possible.
3626         https://bugs.webkit.org/show_bug.cgi?id=167843
3627         <rdar://problem/30364907>
3628
3629         Reviewed by Antti Koivisto.
3630
3631         This patch adds a simplified version of text width measuring.
3632         Certain type of text runs (no spacing etc) only require a subset of what we
3633         currently do in FontCascade::width().
3634
3635         * platform/graphics/FontCascade.cpp:
3636         (WebCore::FontCascade::widthForSimpleText):
3637         * platform/graphics/FontCascade.h:
3638         * platform/graphics/WidthCache.h:
3639         (WebCore::WidthCache::add):
3640         (WebCore::WidthCache::addSlowCase):
3641         * platform/graphics/WidthIterator.cpp:
3642         (WebCore::WidthIterator::advanceInternal):
3643         * rendering/RenderText.cpp:
3644         (WebCore::RenderText::styleDidChange):
3645         (WebCore::RenderText::setRenderedText):
3646         (WebCore::RenderText::computeCanUseSimplifiedTextMeasuring):
3647         * rendering/RenderText.h:
3648         (WebCore::RenderText::canUseSimplifiedTextMeasuring):
3649         * rendering/SimpleLineLayoutFlowContents.cpp:
3650         (WebCore::SimpleLineLayout::initializeSegments):
3651         * rendering/SimpleLineLayoutFlowContents.h:
3652         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
3653         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
3654         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragmentIterator):
3655         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
3656         * rendering/SimpleLineLayoutTextFragmentIterator.h:
3657
3658 2017-02-06  Carlos Garcia Campos  <cgarcia@igalia.com>
3659
3660         Resource usage overlay should ignore mouse events outside bounds by default
3661         https://bugs.webkit.org/show_bug.cgi?id=167874
3662
3663         Reviewed by Andreas Kling.
3664
3665         It's overriding the default causing that the first click after the overlay is shown is always handled by the
3666         overlay even when clicked outside bounds. It should only be set false while dragging.
3667
3668         * page/ResourceUsageOverlay.cpp:
3669         (WebCore::ResourceUsageOverlay::initialize):
3670
3671 2017-02-06  Antti Koivisto  <antti@apple.com>
3672
3673         CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::Node::invalidateStyle
3674         https://bugs.webkit.org/show_bug.cgi?id=167878
3675         rdar://problem/30251840
3676
3677         Reviewed by Andreas Kling.
3678
3679         Speculative fix.
3680
3681         We are trying to invalidate a null node from ~PostResolutionCallbackDisabler. Looks like the only way
3682         this could happen is if HTMLFrameOwnerElement::scheduleinvalidateStyleAndLayerComposition is called
3683         with null 'this'. There is one place where this might happen.
3684
3685         * rendering/RenderLayerCompositor.cpp:
3686         (WebCore::RenderLayerCompositor::attachRootLayer): Add null check.
3687
3688 2017-02-06  Ryan Haddad  <ryanhaddad@apple.com>
3689
3690         Unreviewed, rolling out r211722.
3691
3692         This change introduced a LayoutTest failure on mac-wk2.
3693
3694         Reverted changeset:
3695
3696         "[Modern Media Controls] Improve handling of <video> with only
3697         audio tracks"
3698         https://bugs.webkit.org/show_bug.cgi?id=167836
3699         http://trac.webkit.org/changeset/211722
3700
3701 2017-02-06  Eric Carlson  <eric.carlson@apple.com>
3702
3703         [MediaStream Mac] Stop using AVSampleBufferAudioRenderer
3704         https://bugs.webkit.org/show_bug.cgi?id=167821
3705
3706         Reviewed by Jer Noble.
3707
3708         * WebCore.xcodeproj/project.pbxproj: Add new files.
3709
3710         * platform/audio/mac/AudioSampleDataSource.cpp:
3711         (WebCore::AudioSampleDataSource::pullSamplesInternal): Don't assume the first timestamp from the
3712         render proc after a pause is zero.
3713
3714         Stop using an audio renderer for each audio track. No audio renderers means we don't need to use
3715         an AVSampleBufferRenderSynchronizer.
3716         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3717         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3718         (-[WebAVSampleBufferStatusChangeListener invalidate]): No more audio renderers.
3719         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]): Ditto.
3720         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Ditto.
3721         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC): Pause
3722           audio tracks explicitly.
3723         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSourceProvider): Remove the existing code,
3724           it was incorrect and not thread safe.
3725         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::flushRenderers): No more audio renderers.
3726         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): No more render synchronizer.
3727         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Ditto.
3728         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): Start each audio track.
3729         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): Pause each audio track.
3730         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume): Pass the command to each audio track.
3731         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted): Ditto.
3732         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::streamTime): No more render synchronizer.
3733         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated): Don't handle audio samples.
3734         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks): Update for audio track class change. No
3735         more render synchronizer.
3736         (-[WebAVSampleBufferStatusChangeListener beginObservingRenderer:]): Deleted.
3737         (-[WebAVSampleBufferStatusChangeListener stopObservingRenderer:]): Deleted.
3738         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSample): Deleted.
3739         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForAudioData): Deleted.
3740         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::createAudioRenderer): Deleted.
3741         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyAudioRenderer): Deleted.
3742         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyAudioRenderers): Deleted.
3743         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rendererStatusDidChange): Deleted.
3744
3745         * platform/mediastream/AudioTrackPrivateMediaStream.h:
3746
3747         * platform/mediastream/MediaStreamTrackPrivate.cpp:
3748         (WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate): add/removeObserver takes a reference,
3749         not a pointer.
3750         (WebCore::MediaStreamTrackPrivate::~MediaStreamTrackPrivate): Ditto.
3751         (WebCore::MediaStreamTrackPrivate::videoSampleAvailable): Renamed from sourceHasMoreMediaData.
3752         (WebCore::MediaStreamTrackPrivate::sourceHasMoreMediaData): Deleted.
3753         * platform/mediastream/MediaStreamTrackPrivate.h:
3754
3755         * platform/mediastream/RealtimeMediaSource.cpp:
3756         (WebCore::RealtimeMediaSource::addObserver): Take a reference, not a pointer.
3757         (WebCore::RealtimeMediaSource::removeObserver): Ditto.
3758         (WebCore::RealtimeMediaSource::videoSampleAvailable): Renamed from mediaDataUpdated.
3759         (WebCore::RealtimeMediaSource::audioSamplesAvailable): New.
3760         (WebCore::RealtimeMediaSource::stop): Drive-by cleanup.
3761         (WebCore::RealtimeMediaSource::requestStop): Ditto.
3762         (WebCore::RealtimeMediaSource::mediaDataUpdated): Deleted.
3763         * platform/mediastream/RealtimeMediaSource.h:
3764
3765         * platform/mediastream/mac/AVAudioCaptureSource.h:
3766         * platform/mediastream/mac/AVAudioCaptureSource.mm:
3767         (WebCore::AVAudioCaptureSource::AVAudioCaptureSource):
3768         (WebCore::AVAudioCaptureSource::addObserver):
3769         (WebCore::AVAudioCaptureSource::shutdownCaptureSession):
3770         (WebCore::AVAudioCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
3771         (WebCore::operator==): Deleted.
3772         (WebCore::operator!=): Deleted.
3773
3774         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3775         (WebCore::AVVideoCaptureSource::processNewFrame): Call videoSampleAvailable, not mediaDataUpdated.
3776
3777         Render audio with a CoreAudio output unit.
3778         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp: Added.
3779         (WebCore::AudioTrackPrivateMediaStreamCocoa::AudioTrackPrivateMediaStreamCocoa):
3780         (WebCore::AudioTrackPrivateMediaStreamCocoa::~AudioTrackPrivateMediaStreamCocoa):
3781         (WebCore::AudioTrackPrivateMediaStreamCocoa::playInternal):
3782         (WebCore::AudioTrackPrivateMediaStreamCocoa::play):
3783         (WebCore::AudioTrackPrivateMediaStreamCocoa::pause):
3784         (WebCore::AudioTrackPrivateMediaStreamCocoa::setVolume):
3785         (WebCore::AudioTrackPrivateMediaStreamCocoa::setupAudioUnit):
3786         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
3787         (WebCore::AudioTrackPrivateMediaStreamCocoa::sourceStopped):
3788         (WebCore::AudioTrackPrivateMediaStreamCocoa::render):
3789         (WebCore::AudioTrackPrivateMediaStreamCocoa::inputProc):
3790         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h: Added.
3791
3792         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
3793         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
3794         (WebCore::alignTo16Bytes):
3795         (WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers):
3796         (WebCore::MockRealtimeAudioSourceMac::reconfigure): Minor cleanup.
3797         (WebCore::MockRealtimeAudioSourceMac::render): Ditto.
3798
3799         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
3800         (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer): Call videoSampleAvailable, not mediaDataUpdated.
3801
3802         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
3803         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
3804         (WebCore::WebAudioSourceProviderAVFObjC::~WebAudioSourceProviderAVFObjC):
3805         (WebCore::WebAudioSourceProviderAVFObjC::provideInput): Use a mutex. Get rid of m_writeAheadCount,
3806         it is always 0.
3807         (WebCore::WebAudioSourceProviderAVFObjC::prepare): Use a lock.
3808         (WebCore::WebAudioSourceProviderAVFObjC::unprepare): Ditto.
3809         (WebCore::WebAudioSourceProviderAVFObjC::process): Ditto.
3810         * platform/mock/MockRealtimeAudioSource.h:
3811         (WebCore::MockRealtimeAudioSource::renderInterval): Decrease the render interval.
3812
3813 2017-02-06  Antoine Quint  <graouts@apple.com>
3814
3815         [Modern Media Controls] Add a backdrop filter to the start button on macOS
3816         https://bugs.webkit.org/show_bug.cgi?id=167879
3817         <rdar://problem/30375174>
3818
3819         Reviewed by Eric Carlson.
3820
3821         Add a backdrop filter to the start button on macOS.
3822
3823         Test: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-start-button-style.html
3824
3825         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
3826         (.media-controls.mac.inline > button.start > div):
3827
3828 2017-02-06  Antoine Quint  <graouts@apple.com>
3829
3830         [Modern Media Controls] Bring fullscreen controls up to spec
3831         https://bugs.webkit.org/show_bug.cgi?id=167875
3832         <rdar://problem/29611222>
3833
3834         Reviewed by Eric Carlson.
3835
3836         We update the fullscreen PiP icon to have the correct size and add two new buttons
3837         around the volume slider, "volume-down" to bring the volume to 0 and "volume-up"
3838         to bring the volume to 1.
3839
3840         To accomodate the new volume buttons, we move the volume slider inside an additional
3841         ButtonsContainer object, along with the two new buttons.
3842
3843         Tests: media/modern-media-controls/volume-down-support/volume-down-support.html
3844                media/modern-media-controls/volume-up-support/volume-up-support.html
3845
3846         * Modules/modern-media-controls/controls/icon-service.js:
3847         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
3848         (.media-controls.mac.fullscreen button.volume-down):
3849         (.media-controls.mac.fullscreen button.volume-up):
3850         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
3851         * Modules/modern-media-controls/controls/volume-down-button.js: Added.
3852         (VolumeDownButton):
3853         * Modules/modern-media-controls/controls/volume-slider.js:
3854         (VolumeSlider):
3855         * Modules/modern-media-controls/controls/volume-up-button.js: Added.
3856         (VolumeUpButton):
3857         * Modules/modern-media-controls/images/macOS/pip-in-fullscreen@1x.png:
3858         * Modules/modern-media-controls/images/macOS/pip-in-fullscreen@2x.png:
3859         * Modules/modern-media-controls/images/macOS/volume-down-fullscreen@1x.png: Added.
3860         * Modules/modern-media-controls/images/macOS/volume-down-fullscreen@2x.png: Added.
3861         * Modules/modern-media-controls/images/macOS/volume-up-fullscreen@1x.png: Added.
3862         * Modules/modern-media-controls/images/macOS/volume-up-fullscreen@2x.png: Added.
3863         * Modules/modern-media-controls/js-files:
3864         * Modules/modern-media-controls/media/media-controller.js:
3865         (MediaController.prototype._updateControlsIfNeeded):
3866         * Modules/modern-media-controls/media/volume-down-support.js: Added.
3867         (VolumeDownSupport.prototype.get control):
3868         (VolumeDownSupport.prototype.buttonWasPressed):
3869         (VolumeDownSupport):
3870         * Modules/modern-media-controls/media/volume-up-support.js: Added.
3871         (VolumeUpSupport.prototype.get control):
3872         (VolumeUpSupport.prototype.buttonWasPressed):
3873         (VolumeUpSupport):
3874         * WebCore.xcodeproj/project.pbxproj:
3875
3876 2017-02-06  Antoine Quint  <graouts@apple.com>
3877
3878         [Modern Media Controls] Improve handling of <video> with only audio tracks
3879         https://bugs.webkit.org/show_bug.cgi?id=167836
3880         <rdar://problem/30255812>
3881
3882         Reviewed by Dean Jackson.
3883
3884         We now check for the availability of video tracks before considering a <video>
3885         element is displaying an actual video file and turning auto-hide on. We also
3886         check that we have video tracks before enabling the fullscreen button. This
3887         brings the behavior of a <video> pointing to a resource with no video tracks
3888         to be the same as an <audio> element.
3889
3890         Test: media/modern-media-controls/media-controller/media-controller-video-with-only-audio.html
3891
3892         * Modules/modern-media-controls/media/controls-visibility-support.js:
3893         (ControlsVisibilitySupport.prototype.get tracksToMonitor):
3894         (ControlsVisibilitySupport.prototype._updateControls):
3895         (ControlsVisibilitySupport):
3896         * Modules/modern-media-controls/media/fullscreen-support.js:
3897         (FullscreenSupport.prototype.syncControl):
3898         (FullscreenSupport):
3899
3900 2017-02-06  Alex Christensen  <achristensen@webkit.org>
3901
3902         Fix WinCairo build after r211681
3903         https://bugs.webkit.org/show_bug.cgi?id=167096
3904
3905         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
3906         Include some necessary GLES headers.
3907
3908 2017-02-05  Wenson Hsieh  <wenson_hsieh@apple.com>
3909
3910         Data interaction fails in Safari splitscreen mode when dropping into a contenteditable
3911         https://bugs.webkit.org/show_bug.cgi?id=167862
3912         <rdar://problem/30368405>
3913
3914         Reviewed by Tim Horton.
3915
3916         Adds a counter to WebItemProviderPasteboard that can incremented, decremented, and queried by clients.
3917
3918         * platform/ios/WebItemProviderPasteboard.h:
3919         * platform/ios/WebItemProviderPasteboard.mm:
3920         (-[WebItemProviderPasteboard init]):
3921         (-[WebItemProviderPasteboard hasPendingOperation]):
3922         (-[WebItemProviderPasteboard incrementPendingOperationCount]):
3923         (-[WebItemProviderPasteboard decrementPendingOperationCount]):
3924
3925 2017-02-05  Simon Fraser  <simon.fraser@apple.com>
3926
3927         Remove unparentsOffscreenTiles logic in TileController
3928         https://bugs.webkit.org/show_bug.cgi?id=167823
3929
3930         Reviewed by Tim Horton.
3931
3932         Give all TileGrids the "unparents offscreen tiles" behavior. This was enabled for
3933         only the page tiles in WK2 on Mac and iOS, but there's no reason to not use it for
3934         tiled composited layers also.
3935
3936         Also use more modern C++ idioms in a few places.
3937
3938         * platform/graphics/TiledBacking.h:
3939         * platform/graphics/ca/TileController.h:
3940         * platform/graphics/ca/TileGrid.cpp:
3941         (WebCore::TileGrid::revalidateTiles):
3942         (WebCore::TileGrid::ensureTilesForRect):
3943         * rendering/RenderLayerBacking.cpp:
3944         (WebCore::RenderLayerBacking::RenderLayerBacking):
3945
3946 2017-02-05  Antoine Quint  <graouts@apple.com>
3947
3948         [Modern Media Controls] PiP button is not visible with a live broadcast video
3949         https://bugs.webkit.org/show_bug.cgi?id=167794
3950         <rdar://problem/30348790>
3951
3952         Reviewed by Dean Jackson.
3953
3954         We were only listening to the "loadedmetadata", "error", "webkitpresentationmodechanged"
3955         and "webkitcurrentplaybacktargetiswirelesschanged" events to invalidate the enabled state
3956         for the PiP button. We also need to check availability of video tracks, which we already
3957         did for fullscreen, which is quite similar.
3958         
3959         So we now listen to "addtrack", "removetrack" and "change" events on the media.videoTracks
3960         property, which correctly invalidates the PiP button when the first video track becomes
3961         availabl