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