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