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