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