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