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