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