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