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