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