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