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