566c17509ad0d2093431e0eaeaee9d60fe7c00c8
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-01-16  Joseph Pecoraro  <pecoraro@apple.com>
2
3         Remove the REQUEST_ANIMATION_FRAME flag
4         https://bugs.webkit.org/show_bug.cgi?id=156980
5         <rdar://problem/25906849>
6
7         Reviewed by Simon Fraser.
8
9         * Configurations/FeatureDefines.xcconfig:
10         * dom/Document.cpp:
11         * dom/Document.h:
12         * dom/RequestAnimationFrameCallback.idl:
13         * dom/ScriptedAnimationController.cpp:
14         * dom/ScriptedAnimationController.h:
15         * loader/EmptyClients.h:
16         * page/Chrome.cpp:
17         * page/Chrome.h:
18         * page/ChromeClient.h:
19         * page/DOMWindow.cpp:
20         * page/DOMWindow.h:
21         * page/DOMWindow.idl:
22         * page/FrameView.cpp:
23         * page/FrameView.h:
24         * page/animation/AnimationController.cpp:
25         * page/animation/AnimationController.h:
26         * page/animation/AnimationControllerPrivate.h:
27         * platform/HostWindow.h:
28         * platform/ScrollAnimationSmooth.h:
29         * testing/Internals.cpp:
30
31 2017-01-16  Andy Estes  <aestes@apple.com>
32
33         [QuickLook] QLPreviewConverter should be owned by its delegate
34         https://bugs.webkit.org/show_bug.cgi?id=167104
35
36         Reviewed by Andreas Kling.
37         
38         Instead of having QuickLookHandle own both the QLPreviewConverter and its delegate, have it
39         just own the delegate and have the delegate own the QLPreviewConverter.
40
41         No change in behavior. Covered by existing tests.
42
43         * loader/ios/QuickLook.h:
44         (WebCore::QuickLookHandle::converter): Moved out-of-line.
45         * loader/ios/QuickLook.mm: Renamed WebPreviewConverterDelegate to WebPreviewConverter, and
46         gave it ownership of the QLPreviewConverter, QuickLookHandleClient, and preview response.
47         (-[WebPreviewConverter initWithResourceLoader:resourceResponse:quickLookHandle:]):
48         Added a ResourceResponse parameter.
49         (-[WebPreviewConverter setClient:]): Moved from QuickLookHandle::setClient().
50         (-[WebPreviewConverter appendDataArray:]): Moved from QuickLookHandle::didReceiveDataArray().
51         (-[WebPreviewConverter finishedAppending]): Moved from QuickLookHandle::didFinishLoading().
52         (-[WebPreviewConverter failed]): Moved from QuickLookHandle::didFail().
53         (-[WebPreviewConverter platformConverter]): Added to return the QLPreviewConverter.
54         (-[WebPreviewConverter _sendDidReceiveResponseIfNecessary]): Used _previewResponse directly.
55         (WebCore::QuickLookHandle::~QuickLookHandle): Removed unneeded logging.
56         (WebCore::QuickLookHandle::didReceiveData): Called -[WebPreviewConverter appendDataArray:].
57         (WebCore::QuickLookHandle::didReceiveBuffer): Ditto.
58         (WebCore::QuickLookHandle::didFinishLoading): Called -[WebPreviewConverter finishedAppending].
59         (WebCore::QuickLookHandle::didFail): Called -[WebPreviewConverter failed].
60         (WebCore::QuickLookHandle::setClient): Called -[WebPreviewConverter setClient:].
61         (WebCore::QuickLookHandle::previewFileName): Retrieved the QLPreviewConverter via
62         -[WebPreviewConverter platformConverter].
63         (WebCore::QuickLookHandle::previewUTI): Ditto.
64         (WebCore::QuickLookHandle::previewRequestURL): Ditto.
65         (WebCore::QuickLookHandle::converter): Ditto.
66         (WebCore::QuickLookHandle::didReceiveDataArray): Deleted.
67         (WebCore::QuickLookHandle::previewResponse): Deleted.
68
69 2017-01-16  Antti Koivisto  <antti@apple.com>
70
71         CrashTracer: com.apple.WebKit.WebContent at JavaScriptCore: WTF::StringImpl::containsOnlyWhitespace
72         https://bugs.webkit.org/show_bug.cgi?id=167106
73         <rdar://problem/24457632>
74
75         Reviewed by Tim Horton.
76
77         Speculative fix.
78
79         * editing/cocoa/DataDetection.mm:
80         (WebCore::DataDetection::detectContentInRange):
81
82             Test before casting to Text.
83
84 2017-01-16  Javier Fernandez  <jfernandez@igalia.com>
85
86         [css-grid] Implementing baseline positioning for grid containers
87         https://bugs.webkit.org/show_bug.cgi?id=165063
88
89         Reviewed by Darin Adler and Sergio Villar Senin.
90
91         Implementation of the 'first-line' baseline for Grid containers,
92         according to the CSS Grid Layout spec.
93         https://drafts.csswg.org/css-grid/#grid-baselines
94
95         The self-baseline and content-baseline alignment logic is still
96         not implemented, hence some cases will be implemented in
97         future patches.
98
99         Tests: fast/css-grid-layout/grid-baseline-margins.html
100                fast/css-grid-layout/grid-baseline-must-respect-grid-order.html
101                fast/css-grid-layout/grid-baseline.html
102
103         * rendering/RenderGrid.cpp:
104         (WebCore::synthesizedBaselineFromBorderBox):
105         (WebCore::RenderGrid::isInlineBaselineAlignedChild):
106         (WebCore::RenderGrid::baselinePosition):
107         (WebCore::RenderGrid::firstLineBaseline):
108         (WebCore::RenderGrid::inlineBlockBaseline):
109         * rendering/RenderGrid.h:
110
111 2017-01-16  Andy Estes  <aestes@apple.com>
112
113         [QuickLook] Do some cleanup in QuickLookHandle
114         https://bugs.webkit.org/show_bug.cgi?id=166864
115
116         Reviewed by Darin Adler.
117
118         * loader/ios/QuickLook.h: Stopped including QuickLookHandleClient.h and forward-declared
119         instead; changed setClient() to take a Ref<QuickLookHandleClient>&&; renamed nsResponse() to
120         previewResponse(); changed QuickLookHandle() to take a ResourceLoader& and const
121         ResourceResponse&; gave m_delegate a stronger type; removed unused m_quicklookFileHandle;
122         initialized m_finishedLoadingDataIntoConverter to false.
123         (WebCore::QuickLookHandle::firstRequestURL): Stopped exporting.
124         (WebCore::QuickLookHandle::setClient): Moved definition out-of-line.
125         * loader/ios/QuickLook.mm: Renamed WebResourceLoaderQuickLookDelegate to
126         WebPreviewConverterDelegate and stopped conforming to NSURLConnectionDelegate and
127         WebCoreResourceLoaderDelegate; removed @property quickLookHandle and initialized
128         _quickLookHandle in the initializer instead.
129         (-[WebPreviewConverter initWithResourceLoader:quickLookHandle:]): Changed to take references
130         to resourceLoader and quickLookHandle.
131         (-[WebPreviewConverter _sendDidReceiveResponseIfNecessary]): Stopped checking for a nil
132         _quickLookHandle, since it is never nil.
133         (-[WebResourceLoaderQuickLookDelegate connection:didReceiveDataArray:]): Deleted.
134         QLPreviewConverter never calls this method.
135         (-[WebPreviewConverter connection:didReceiveData:lengthReceived:]): Stopped checking for a
136         nil _resourceLoader, since it is never nil.
137         (-[WebPreviewConverter connectionDidFinishLoading:]): Ditto.
138         (-[WebPreviewConverter connection:didFailWithError:]): Ditto.
139         (WebCore::emptyClient): Changed to return a reference.
140         (WebCore::QuickLookHandle::QuickLookHandle): Moved creation of the delegate,
141         firstRequestURL, and response to here from QuickLookHandle::create(). Called
142         ResourceLoader::didCreateQuickLookHandle() here instead of in QuickLookHandle::create().
143         (WebCore::QuickLookHandle::create): Used std::make_unique to create the QuickLookHandle.
144         (WebCore::QuickLookHandle::didFinishLoading): Set m_finishedLoadingDataIntoConverter to true
145         instead of YES.
146         (WebCore::QuickLookHandle::setClient): Moved the client rvalue reference into m_client.
147         (WebCore::QuickLookHandle::~QuickLookHandle): Stopped clearing m_converter and calling
148         -detachHandle.
149         (WebCore::QuickLookHandle::previewRequestURL): Used dot syntax.
150         (WebCore::QuickLookHandle::previewResponse): Renamed from nsResponse().
151
152 2017-01-16  Simon Fraser  <simon.fraser@apple.com>
153
154         Remove CSSPropertyNames.in from the project. It's not used any more,
155         now that we generate files from CSSProperties.json.
156
157         * WebCore.xcodeproj/project.pbxproj:
158
159 2017-01-16  Carlos Garcia Campos  <cgarcia@igalia.com>
160
161         [SOUP] Accept-language could be set twice in a row for the default context
162         https://bugs.webkit.org/show_bug.cgi?id=167089
163
164         Reviewed by Žan Doberšek.
165
166         If NetworkStorageSession doesn't have a SoupNetworkSession yet, we are creating it only to set the
167         languages. Since we already set the global value, the languages will be set when the SoupNetworkSession is
168         created later. This is not a big deal for the language property, but it will be for proxies after bug #128674.
169         Since NetworkStorageSession::soupNetworkSession() it's actually getting or creating the SoupNetworkSession, this
170         patch renames it as NetworkStorageSession::getOrCreateSoupNetworkSession() and now
171         NetworkStorageSession::soupNetworkSession() returns a pointer without creating the SoupNetworkSession, so it can
172         be nullptr. This can now be used to only use the default SoupNetworkSession when it has already been created.
173
174         * platform/network/NetworkStorageSession.h:
175         (WebCore::NetworkStorageSession::soupNetworkSession): Use NetworkStorageSession::getOrCreateSoupNetworkSession().
176         * platform/network/soup/DNSSoup.cpp:
177         (WebCore::DNSResolveQueue::updateIsUsingProxy): Ditto.
178         (WebCore::DNSResolveQueue::platformResolve): Ditto.
179         * platform/network/soup/NetworkStorageSessionSoup.cpp:
180         (WebCore::NetworkStorageSession::getOrCreateSoupNetworkSession): This is the old soupNetworkSession(), now renamed.
181         (WebCore::NetworkStorageSession::soupNetworkSession): Return a pointer with the current value of m_session that
182         now can be nullptr.
183         * platform/network/soup/ResourceHandleSoup.cpp:
184         (WebCore::sessionFromContext): Use NetworkStorageSession::getOrCreateSoupNetworkSession().
185
186 2017-01-16  Carlos Garcia Campos  <cgarcia@igalia.com>
187
188         [SOUP] Fix handling of accept language property
189         https://bugs.webkit.org/show_bug.cgi?id=166969
190
191         Reviewed by Michael Catanzaro.
192
193         Add SoupNetworkSession::setInitialAcceptLanguages() static method and update setAcceptLanguages to receive the
194         string already built from the languages vector. Now the SoupNetworkSession saves that value globally that
195         is always used when creating new sessions.
196
197         * platform/network/soup/NetworkStorageSessionSoup.cpp:
198         (WebCore::NetworkStorageSession::switchToNewTestingSession): Remove workaround.
199         * platform/network/soup/SoupNetworkSession.cpp:
200         (WebCore::SoupNetworkSession::SoupNetworkSession): If initial accept languages were set, apply them to the newly created context.
201         (WebCore::SoupNetworkSession::setInitialAcceptLanguages): Just save the given value globally.
202         (WebCore::SoupNetworkSession::setAcceptLanguages): It receives now the string, so just set it to the session.
203         * platform/network/soup/SoupNetworkSession.h:
204
205 2017-01-15  Michael Catanzaro  <mcatanzaro@igalia.com>
206
207         [SOUP] SoupNetworkSession constructor should be explicit
208         https://bugs.webkit.org/show_bug.cgi?id=167069
209
210         Reviewed by Darin Adler.
211
212         * platform/network/soup/SoupNetworkSession.h:
213
214 2017-01-15  Sam Weinig  <sam@webkit.org>
215
216         [WebIDL] Remove custom bindings for HTMLInputElement, HTMLFrameElement, HTMLMediaElement and HTMLOptionsCollection
217         https://bugs.webkit.org/show_bug.cgi?id=167039
218
219         Reviewed by Darin Adler.
220
221         * CMakeLists.txt:
222         * WebCore.xcodeproj/project.pbxproj:
223         * bindings/js/JSBindingsAllInOne.cpp:
224         * bindings/js/JSHTMLFrameElementCustom.cpp: Removed.
225         * bindings/js/JSHTMLInputElementCustom.cpp: Removed.
226         * bindings/js/JSHTMLMediaElementCustom.cpp: Removed.
227         Remove files.
228
229         * html/HTMLOptionsCollection.idl:
230         * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
231         (WebCore::JSHTMLOptionsCollection::setLength): Deleted.
232         Remove custom setLength. The bindings generator can handle this now.
233
234         * html/HTMLFrameElement.idl:
235         Resort to match spec. Replace custom annotation for location with SetterCallWith=ScriptState.
236
237         * html/HTMLFrameElementBase.cpp:
238         (WebCore::HTMLFrameElementBase::setLocation):
239         * html/HTMLFrameElementBase.h:
240         Add implementation of setLocation.
241
242         * html/HTMLInputElement.cpp:
243         (WebCore::HTMLInputElement::selectionStartForBindings):
244         (WebCore::HTMLInputElement::setSelectionStartForBindings):
245         (WebCore::HTMLInputElement::selectionEndForBindings):
246         (WebCore::HTMLInputElement::setSelectionEndForBindings):
247         (WebCore::HTMLInputElement::selectionDirectionForBindings):
248         (WebCore::HTMLInputElement::setSelectionDirectionForBindings):
249         (WebCore::HTMLInputElement::setSelectionRangeForBindings):
250         * html/HTMLInputElement.h:
251         * html/HTMLInputElement.idl:
252         Add variants of the selection properties that throw using the 'forBindings' suffix to differentiate.
253
254         * html/HTMLMediaElement.cpp:
255         (WebCore::HTMLMediaElement::setControllerForBindings):
256         * html/HTMLMediaElement.h:
257         (WebCore::HTMLMediaElement::controllerForBindings):
258         * html/HTMLMediaElement.idl:
259         Add a variant of the controller property that unsets the media group, using the 'forBindings' suffix to differentiate.
260
261         * html/HTMLSelectElement.cpp:
262         (WebCore::HTMLSelectElement::setLength):
263         Match other implementations by ignoring attempts to set large lengths (> 10000) rather than clamping.
264
265 2017-01-15  Tim Horton  <timothy_horton@apple.com>
266
267         De-duplicate more (nearly) identical code in Editor(Mac|IOS).mm
268         https://bugs.webkit.org/show_bug.cgi?id=167063
269
270         Reviewed by Dan Bernstein.
271
272         No new tests, just refactoring.
273
274         * editing/Editor.h:
275         Adjust to fontAttributesForSelectionStart returning a RetainPtr.
276
277         * editing/cocoa/EditorCocoa.mm:
278         (WebCore::Editor::getTextDecorationAttributesRespectingTypingStyle):
279         Make use of more Obj-C literals (for NSNumber).
280
281         (WebCore::Editor::fontAttributesForSelectionStart):
282         Merge this from EditorMac and EditorIOS. There are a number of attributes
283         that are currently only extracted on Mac, and it's not clear why (and
284         probably should be shared).
285
286         (WebCore::Editor::stringSelectionForPasteboard):
287         (WebCore::Editor::stringSelectionForPasteboardWithImageAltText):
288         Merge these functions from EditorMac and EditorIOS. The iOS implementation
289         was missing a reasonable bug fix from r161925.
290
291         (WebCore::Editor::createFragmentAndAddResources):
292         Merge this from EditorMac and EditorIOS. The Mac implementation was missing
293         a reasonable bug fix from r203482.
294
295         * editing/ios/EditorIOS.mm:
296         (WebCore::Editor::fontAttributesForSelectionStart): Deleted.
297         (WebCore::Editor::stringSelectionForPasteboardWithImageAltText): Deleted.
298         (WebCore::Editor::createFragmentAndAddResources): Deleted.
299         * editing/mac/EditorMac.mm:
300         (WebCore::Editor::fontAttributesForSelectionStart): Deleted.
301         (WebCore::Editor::stringSelectionForPasteboard): Deleted.
302         (WebCore::Editor::stringSelectionForPasteboardWithImageAltText): Deleted.
303         (WebCore::Editor::createFragmentAndAddResources): Deleted.
304
305 2017-01-15  Myles C. Maxfield  <mmaxfield@apple.com>
306
307         [Cocoa] Unify FontPlatformData's hashing and equality operators
308         https://bugs.webkit.org/show_bug.cgi?id=167061
309
310         Reviewed by Darin Adler.
311
312         On iOS, we were using CFEqual() and CFHash(), while on macOS
313         we were using pointer hashing and pointer equality. Instead,
314         we should be consistent about these operators.
315
316         Right now, FontPlatformData holds two internal CTFontRefs, and
317         switching to these higher-level CFEqual() and CFHash()
318         functions is required for eliminating one of these two
319         internal font objects.
320
321         No new tests because there is no behavior change.
322
323         * platform/graphics/FontPlatformData.h:
324         (WebCore::FontPlatformData::hash): Deleted.
325         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
326         (WebCore::FontPlatformData::hash):
327         (WebCore::FontPlatformData::platformIsEqual):
328         (WebCore::cascadeToLastResortAttributesDictionary):
329         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
330         (WebCore::FontPlatformData::hash):
331         * platform/graphics/win/FontPlatformDataCGWin.cpp:
332         (WebCore::FontPlatformData::hash):
333         * platform/graphics/win/FontPlatformDataCairoWin.cpp:
334         (WebCore::FontPlatformData::hash):
335         * platform/graphics/win/FontPlatformDataDirect2D.cpp:
336         (WebCore::FontPlatformData::hash):
337
338 2017-01-15  Andreas Kling  <akling@apple.com>
339
340         FrameView shouldn't keep dangling pointers into dead render trees.
341         <https://webkit.org/b/167011>
342
343         Reviewed by Antti Koivisto.
344
345         Added some pretty paranoid assertions to FrameView that verify all of its raw pointers
346         into the render tree are gone after the render tree has been destroyed.
347         They immediately caught two bugs, also fixed in this patch.
348
349         * page/FrameView.h:
350         * page/FrameView.cpp:
351         (WebCore::FrameView::willDestroyRenderTree):
352         (WebCore::FrameView::didDestroyRenderTree): Added these two callbacks for before/after
353         Document tears down its render tree. The former clears the layout root, and detaches
354         custom scrollbars. The latter contains a bunch of sanity assertions that pointers into
355         the now-destroyed render tree are gone.
356
357         * dom/Document.cpp:
358         (WebCore::Document::destroyRenderTree): Notify FrameView before/after teardown.
359
360         * page/animation/AnimationController.h:
361         * page/animation/AnimationController.cpp:
362         (WebCore::AnimationController::hasAnimations): Added a helper to check if there are
363         any composite animations around, as these contain raw pointers to renderers.
364
365         * rendering/RenderElement.cpp:
366         (WebCore::RenderElement::willBeRemovedFromTree):
367         (WebCore::RenderElement::willBeDestroyed): Moved slow repaint object unregistration
368         from willBeRemovedFromTree() to willBeDestroyed(). The willBeRemovedFromTree() callback
369         is skipped as an optimization during full tree teardown, but willBeDestroyed() always
370         gets called. This fixes a bug where we'd fail to remove dangling pointers.
371
372 2017-01-15  Myles C. Maxfield  <mmaxfield@apple.com>
373
374         [Cocoa] Unify font fallback between macOS and iOS for when the font-family list is exhausted
375         https://bugs.webkit.org/show_bug.cgi?id=167056
376
377         Reviewed by Darin Adler.
378
379         When performing font fallback, each item in the font-family list is examined.
380         If no appropriate fonts are found, WebKit asks the system for an appropriate
381         font. As of a few years ago, both macOS and iOS used platform calls to
382         produce a font; however, each platform used a different platform call. This
383         patch migrates both platforms to use a shared function which uses only
384         one of the platform calls (which means the other platform call is never used). 
385
386         There are still some behavior differences between macOS and iOS (which are now
387         hidden behind a PLATFORM() guard), but I'd like to minimize and eliminate these
388         in the future. Using a shared function is a step toward this goal. 
389
390         No new tests because there is no behavior change.
391
392         * platform/graphics/FontCache.h:
393         * platform/graphics/cocoa/FontCacheCoreText.cpp:
394         (WebCore::lookupFallbackFont):
395         (WebCore::FontCache::systemFallbackForCharacters):
396         * platform/graphics/ios/FontCacheIOS.mm:
397         (WebCore::getSystemFontFallbackForCharacters): Deleted.
398         (WebCore::platformLookupFallbackFont): Deleted.
399         * platform/graphics/mac/FontCacheMac.mm:
400         (WebCore::platformLookupFallbackFont): Deleted.
401
402 2017-01-14  Chris Dumez  <cdumez@apple.com>
403
404         Report CPU usage of tabs after they become non-visible using diagnostic logging
405         https://bugs.webkit.org/show_bug.cgi?id=167019
406         <rdar://problem/30019773>
407
408         Reviewed by Darin Adler.
409
410         Report CPU usage of tabs after they become non-visible using diagnostic logging.
411         We start measure CPU usage 5 seconds after a tab goes to the background, for 5
412         minutes and report how much CPU the tab used during those 5 minutes. We will
413         not log if the tab gets closed or moved to the foreground during those 5
414         minutes.
415
416         * page/DiagnosticLoggingKeys.cpp:
417         (WebCore::DiagnosticLoggingKeys::postPageBackgroundingKey):
418         * page/DiagnosticLoggingKeys.h:
419         * page/Page.cpp:
420         (WebCore::Page::Page):
421         (WebCore::Page::didStartProvisionalLoad):
422         (WebCore::Page::didFinishLoad):
423         (WebCore::foregroundCPUUsageToDiagnosticLogginKey):
424         (WebCore::Page::measurePostLoadCPUUsage):
425         (WebCore::backgroundCPUUsageToDiagnosticLogginKey):
426         (WebCore::Page::measurePostBackgroundingCPUUsage):
427         (WebCore::Page::setIsVisibleInternal):
428         * page/Page.h:
429         * page/Settings.cpp:
430         (WebCore::Settings::isPostBackgroundingCPUUsageMeasurementEnabled):
431         * page/Settings.h:
432
433 2017-01-14  Tim Horton  <timothy_horton@apple.com>
434
435         De-duplicate some (nearly) identical code in Editor(Mac|IOS).mm
436         https://bugs.webkit.org/show_bug.cgi?id=167062
437
438         Reviewed by Dan Bernstein.
439
440         No new tests, just refactoring.
441
442         * editing/Editor.cpp:
443         (WebCore::Editor::fontForSelection):
444         (WebCore::Editor::styleForSelectionStart):
445         (WebCore::Editor::adjustedSelectionRange):
446         * editing/Editor.h:
447         Move these three functions to Editor and unguard them, because they're
448         not Cocoa specific.
449
450         * platform/spi/cocoa/NSAttributedStringSPI.h:
451         Move some iOS-only NSAttributedString IPI (so no Internal SDK switch)
452         to NSAttributedStringSPI.h.
453
454         * editing/cocoa/EditorCocoa.mm:
455         (WebCore::Editor::writeSelectionToPasteboard):
456         (WebCore::Editor::selectionInWebArchiveFormat):
457         (WebCore::Editor::replaceSelectionWithAttributedString):
458         (WebCore::Editor::createFragmentForImageResourceAndAddResource):
459         (WebCore::Editor::dataInRTFDFormat):
460         (WebCore::Editor::dataInRTFFormat):
461         Move these six functions here.
462         selectionInWebArchiveFormat and replaceSelectionWithAttributedString are
463         entirely identical; writeSelectionToPasteboard and createFragment...
464         both have slightly suspicious-looking differences that I left intact
465         and wrote comments about (especially createFragment..., the other one
466         is somewhat explicable). The two dataInRTF(D)Format functions used to
467         be static functions, but for now are required from both EditorCocoa
468         and Editor(Mac|IOS), so we'll make them static member functions.
469
470         * editing/ios/EditorIOS.mm:
471         (WebCore::Editor::fontForSelection): Deleted.
472         (WebCore::Editor::selectionInWebArchiveFormat): Deleted.
473         (WebCore::dataInRTFDFormat): Deleted.
474         (WebCore::dataInRTFFormat): Deleted.
475         (WebCore::Editor::writeSelectionToPasteboard): Deleted.
476         (WebCore::Editor::createFragmentForImageResourceAndAddResource): Deleted.
477         (WebCore::Editor::replaceSelectionWithAttributedString): Deleted.
478         * editing/mac/EditorMac.mm:
479         (WebCore::Editor::fontForSelection): Deleted.
480         (WebCore::Editor::selectionInWebArchiveFormat): Deleted.
481         (WebCore::dataInRTFDFormat): Deleted.
482         (WebCore::dataInRTFFormat): Deleted.
483         (WebCore::Editor::writeSelectionToPasteboard): Deleted.
484         (WebCore::Editor::createFragmentForImageResourceAndAddResource): Deleted.
485         (WebCore::Editor::replaceSelectionWithAttributedString): Deleted.
486
487 2017-01-14  Zalan Bujtas  <zalan@apple.com>
488
489         Small code cleanup after r210760
490         https://bugs.webkit.org/show_bug.cgi?id=167047
491
492         Reviewed by Sam Weinig.
493
494         No change in functionality.
495
496         * rendering/RenderLayer.cpp:
497         (WebCore::RenderLayer::updateLayerPosition):
498
499 2017-01-14  Zalan Bujtas  <zalan@apple.com>
500
501         Renderers should have a simple way to access Settings.
502         https://bugs.webkit.org/show_bug.cgi?id=167048
503
504         Now that RenderObjects can never outlive the Page, we can just access the Settings
505         through Page instead of Document::settings/Frame::settings.  
506
507         Reviewed by Andreas Kling.
508
509         No change in functionality.
510
511         * rendering/RenderBlock.cpp:
512         (WebCore::RenderBlock::paintCaret):
513         (WebCore::RenderBlock::shouldPaintSelectionGaps):
514         * rendering/RenderBlockFlow.cpp:
515         (WebCore::needsAppleMailPaginationQuirk):
516         * rendering/RenderBlockLineLayout.cpp:
517         (WebCore::RenderBlockFlow::startAlignedOffsetForLine):
518         * rendering/RenderBox.cpp:
519         (WebCore::RenderBox::layoutOverflowRectForPropagation):
520         * rendering/RenderBoxModelObject.cpp:
521         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
522         (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
523         * rendering/RenderElement.cpp:
524         (WebCore::RenderElement::styleWillChange):
525         (WebCore::RenderElement::willBeRemovedFromTree):
526         (WebCore::RenderElement::shouldRespectImageOrientation):
527         * rendering/RenderEmbeddedObject.cpp:
528         (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
529         * rendering/RenderFrameSet.cpp:
530         (WebCore::RenderFrameSet::flattenFrameSet):
531         * rendering/RenderIFrame.cpp:
532         (WebCore::RenderIFrame::flattenFrame):
533         * rendering/RenderImage.cpp:
534         (WebCore::RenderImage::paintIntoRect):
535         * rendering/RenderInline.cpp:
536         (WebCore::RenderInline::addChildIgnoringContinuation):
537         * rendering/RenderLayer.cpp:
538         (WebCore::RenderLayer::acceleratedCompositingForOverflowScrollEnabled):
539         (WebCore::RenderLayer::forceUpdateScrollbarsOnMainThreadForPerformanceTesting):
540         (WebCore::RenderLayer::hasAcceleratedTouchScrolling):
541         (WebCore::RenderLayer::getRectToExpose):
542         (WebCore::RenderLayer::overhangAmount):
543         (WebCore::RenderLayer::setHasHorizontalScrollbar):
544         (WebCore::RenderLayer::setHasVerticalScrollbar):
545         (WebCore::RenderLayer::calculateClipRects):
546         * rendering/RenderLayerBacking.cpp:
547         (WebCore::RenderLayerBacking::RenderLayerBacking):
548         (WebCore::RenderLayerBacking::shouldAggressivelyRetainTiles):
549         (WebCore::RenderLayerBacking::shouldTemporarilyRetainTileCohorts):
550         (WebCore::RenderLayerBacking::useGiantTiles):
551         (WebCore::RenderLayerBacking::startAnimation):
552         * rendering/RenderLayerCompositor.cpp:
553         (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
554         (WebCore::RenderLayerCompositor::updateBacking):
555         (WebCore::RenderLayerCompositor::addToOverlapMap):
556         (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
557         (WebCore::RenderLayerCompositor::needsFixedRootBackgroundLayer):
558         (WebCore::RenderLayerCompositor::requiresContentShadowLayer):
559         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
560         * rendering/RenderLayerModelObject.cpp:
561         (WebCore::RenderLayerModelObject::shouldPlaceBlockDirectionScrollbarOnLeft):
562         * rendering/RenderListBox.cpp:
563         (WebCore::RenderListBox::forceUpdateScrollbarsOnMainThreadForPerformanceTesting):
564         * rendering/RenderObject.h:
565         (WebCore::RenderObject::settings):
566         * rendering/RenderText.cpp:
567         (WebCore::SecureTextTimer::restart):
568         * rendering/RenderView.cpp:
569         (WebCore::RenderView::clientLogicalWidthForFixedPosition):
570         (WebCore::RenderView::clientLogicalHeightForFixedPosition):
571         (WebCore::RenderView::paintBoxDecorations):
572         * rendering/SimpleLineLayout.cpp:
573         (WebCore::SimpleLineLayout::canUseForWithReason):
574         * rendering/SimpleLineLayoutFunctions.cpp:
575         (WebCore::SimpleLineLayout::paintFlow):
576         * rendering/svg/RenderSVGResourceFilter.cpp:
577         (WebCore::RenderSVGResourceFilter::applyResource):
578
579 2017-01-14  Chris Dumez  <cdumez@apple.com>
580
581         Align the innerText setter with the HTML spec and Gecko
582         https://bugs.webkit.org/show_bug.cgi?id=160971
583
584         Reviewed by Alex Christensen.
585
586         Align the innerText setter and createContextualFragment() with the
587         HTML specification and Gecko. In particular, they no longer throw
588         when the context element is a void element. This behavior was there
589         to match an old IE behavior but Edge dropped this behavior.
590
591         Test: fast/dom/br-set-outerText.html
592
593         * dom/Element.cpp:
594         * dom/Element.h:
595         * editing/markup.cpp:
596         (WebCore::createContextualFragment):
597         * html/HTMLElement.cpp:
598         (WebCore::HTMLElement::setInnerText):
599         (WebCore::HTMLElement::setOuterText):
600
601 2017-01-13  Joseph Pecoraro  <pecoraro@apple.com>
602
603         Remove ENABLE(DETAILS_ELEMENT) guards
604         https://bugs.webkit.org/show_bug.cgi?id=167042
605
606         Reviewed by Alex Christensen.
607
608         * Configurations/FeatureDefines.xcconfig:
609         * DerivedSources.make:
610         * accessibility/AccessibilityNodeObject.cpp:
611         (WebCore::AccessibilityNodeObject::setIsExpanded):
612         * html/HTMLDetailsElement.cpp:
613         * html/HTMLDetailsElement.idl:
614         * html/HTMLSummaryElement.cpp:
615         * html/HTMLTagNames.in:
616         * html/shadow/DetailsMarkerControl.cpp:
617         * rendering/RenderDetailsMarker.cpp:
618         * rendering/RenderDetailsMarker.h:
619         * rendering/RenderObject.h:
620         (WebCore::RenderObject::isDetailsMarker):
621         * rendering/RenderTreeAsText.cpp:
622         (WebCore::RenderTreeAsText::writeRenderObject):
623
624 2017-01-13  Alex Christensen  <achristensen@webkit.org>
625
626         Fix WinCairo build after r210753.
627         https://bugs.webkit.org/show_bug.cgi?id=166730
628
629         * platform/WebGLStateTracker.h:
630         WTF::Function apparently needs to explicitly be differentiated from JSC::Attribute Function in PropertySlot.h.
631
632 2017-01-13  Brent Fulgham  <bfulgham@apple.com>
633
634         Potential nullptr dereference in RenderLayer::updateLayerPosition()
635         https://bugs.webkit.org/show_bug.cgi?id=167036
636         <rdar://problem/30023019>
637
638         Reviewed by Dean Jackson.
639
640         A value was being used without nullptr checking, even though it had been checked for null a
641         few lines prior.
642
643         * rendering/RenderLayer.cpp:
644         (WebCore::RenderLayer::updateLayerPosition): Add missing nullptr check.
645
646 2017-01-11  Darin Adler  <darin@apple.com>
647
648         Remove PassRefPtr from more of "platform"
649         https://bugs.webkit.org/show_bug.cgi?id=166809
650
651         Reviewed by Sam Weinig.
652
653         * CMakeLists.txt: Removed DeviceMotionClientMock.cpp.
654
655         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.h:
656         Added now-needed include.
657
658         * Modules/speech/SpeechSynthesisUtterance.cpp:
659         (WebCore::SpeechSynthesisUtterance::SpeechSynthesisUtterance):
660         Pass a reference instead of a pointer.
661
662         * Modules/speech/SpeechSynthesisUtterance.h: Tweaks, msade a few things
663         more private and final.
664
665         * bindings/js/JSDOMConvert.h:
666         (WebCore::Detail::getPtrOrRef): Removed no-longer-needed const_cast.
667         * bindings/js/JSDOMWrapper.h:
668         (WebCore::JSDOMWrapper::wrapped): Ditto.
669         * bindings/js/ScriptModuleLoader.cpp:
670         (WebCore::ScriptModuleLoader::~ScriptModuleLoader): Ditto.
671
672         * css/BasicShapeFunctions.cpp:
673         (WebCore::convertToLengthSize): Updated for LengthSize struct.
674         (WebCore::convertToCenterCoordinate): Ditto.
675
676         * css/CSSComputedStyleDeclaration.cpp:
677         (WebCore::createPositionListForLayer): Take a reference.
678         (WebCore::getBorderRadiusCornerValues): Updated for LengthSize struct.
679         (WebCore::getBorderRadiusCornerValue): Ditto.
680         (WebCore::getBorderRadiusShorthandValue): Ditto.
681         (WebCore::fillSizeToCSSValue): Ditto.
682         (WebCore::ComputedStyleExtractor::propertyValue): Updated many properties
683         since the layer properties now return references rather than pointers.
684
685         * css/CSSImageGeneratorValue.cpp:
686         (WebCore::CSSImageGeneratorValue::CachedGeneratedImage::image): Removed
687         no-longer-needed const_cast.
688         * css/CSSKeyframesRule.cpp:
689         (WebCore::CSSKeyframesRule::item): Ditto.
690
691         * css/CSSPrimitiveValue.cpp:
692         (WebCore::CSSPrimitiveValue::init): Updated for LengthSize struct.
693
694         * css/CSSStyleRule.h: Removed no-longer-needed const_cast.
695
696         * css/CSSToStyleMap.cpp:
697         (WebCore::convertToLengthSize): Updated for LengthSize struct.
698
699         * css/FontFace.cpp:
700         (WebCore::FontFace::family): Removed no-longer-needed const_cast.
701         (WebCore::FontFace::style): Ditto.
702         (WebCore::FontFace::weight): Ditto.
703         (WebCore::FontFace::unicodeRange): Ditto.
704         (WebCore::FontFace::variant): Ditto.
705         (WebCore::FontFace::featureSettings): Ditto.
706
707         * css/LengthFunctions.cpp:
708         (WebCore::sizeForLengthSize): Added.
709         (WebCore::floatSizeForLengthSize): Updated for LengthSize struct.
710         * css/LengthFunctions.h: Added sizeForLengthSize.
711
712         * css/SVGCSSComputedStyleDeclaration.cpp:
713         (WebCore::paintOrder): Cut down on creation of unused objects.
714         We now create only what we actually use.
715
716         * css/StyleBuilderConverter.h:
717         (WebCore::StyleBuilderConverter::convertRadius): Updated for
718         LengthSize struct.
719         (WebCore::StyleBuilderConverter::convertShapeValue): Pass references
720         when creating ShapeValue.
721
722         * css/StyleBuilderCustom.h:
723         (WebCore::forwardInheritedValue): Added. This set of overloaded
724         functions allows us to use move semantics for some types, but copy
725         them when inheriting. Doing it with special cases here allows us to
726         resolve this without adding overloads someone might be tempted to
727         call outside the style builder, and without adding special cases to
728         the JSON file for each property.
729         (WebCore::StyleBuilderCustom::applyValueWebkitDashboardRegion):
730         Add WTFMove as needed to work with rvalue references.
731         (WebCore::StyleBuilderCustom::applyValueSize): Ditto.
732         (WebCore::StyleBuilderCustom::applyInheritTextIndent): Ditto.
733         (WebCore::StyleBuilderCustom::applyValueTextIndent): Ditto.
734         (WebCore::StyleBuilderCustom::applyInheritLineHeight): Ditto.
735         (WebCore::StyleBuilderCustom::applyValueLineHeight): Ditto.
736         (WebCore::StyleBuilderCustom::applyInheritClip): Ditto.
737         (WebCore::StyleBuilderCustom::applyValueClip): Ditto.
738
739         * css/StyleResolver.cpp:
740         (WebCore::StyleResolver::State::cacheBorderAndBackground): Use
741         references instead of pointers.
742         (WebCore::StyleResolver::applyMatchedProperties): Ditto.
743         (WebCore::StyleResolver::applyProperty): Update for changes to the
744         custom property data in RenderStyle.
745
746         * css/makeprop.pl: Use auto quite a bit more in the generated code.
747         Updated special cases for layers to expect references. Added a WTFMove
748         so we can get move semantics for converted values that come out in
749         an optional. Added call to forwardInheritedValue (see above).
750
751         * dom/Document.cpp:
752         (WebCore::Document::pageSizeAndMarginsInPixels): Use auto and update
753         since LengthSize is a struct.
754
755         * dom/EventPath.cpp:
756         (WebCore::EventPath::computePathUnclosedToTarget): Use auto.
757
758         * dom/LiveNodeList.h:
759         (WebCore::LiveNodeList::ownerNode): Removed no-longer-needed const_cast.
760
761         * dom/MessageEvent.cpp:
762         (WebCore::MessageEvent::source): Removed unneeded static_cast.
763
764         * dom/Node.cpp:
765         (WebCore::nodeSetPreTransformedFromNodeOrStringVector): Tweaked formatting.
766
767         * dom/Range.h:
768         (WebCore::Range::ownerDocument): Removed no-longer-needed const_cast.
769         * dom/RegisteredEventListener.h:
770         (WebCore::RegisteredEventListener::callback): Ditto.
771         * dom/ScriptRunner.cpp:
772         (WebCore::ScriptRunner::~ScriptRunner): Ditto.
773         * html/HTMLCollection.h:
774         (WebCore::HTMLCollection::ownerNode): Ditto.
775         * html/parser/HTMLStackItem.h:
776         (WebCore::HTMLStackItem::node): Ditto.
777
778         * inspector/PageScriptDebugServer.cpp:
779         (WebCore::PageScriptDebugServer::setJavaScriptPaused): Cut down on the number
780         of different functions here. Also use reference rather than pointer.
781         * inspector/PageScriptDebugServer.h: Updated for above change.
782
783         * loader/HistoryController.cpp:
784         (WebCore::HistoryController::recursiveSetProvisionalItem): Removed
785         no-longer-needed const_cast.
786         (WebCore::HistoryController::recursiveGoToItem): Ditto.
787
788         * page/Frame.cpp:
789         (WebCore::Frame::ownerRenderer): Use auto. Let the is<> function do null
790         checking for us.
791         (WebCore::Frame::frameForWidget): Take a reference rather than a pointer.
792         * page/Frame.h: Updated for the above.
793
794         * page/FrameView.cpp:
795         (WebCore::FrameView::invalidateRect): Use Chrome directly instead of using
796         HostWindow. HostWindow is an abstraction for the platform layer, and there
797         is no good reason to use it here.
798         (WebCore::FrameView::scheduleAnimation): Ditto.
799         (WebCore::FrameView::graphicsLayerForPlatformWidget): Updated to use reference
800         when calling RenderWidget::find.
801         (WebCore::FrameView::scrollContentsFastPath): Use Chrome instead of HostWindow.
802         (WebCore::FrameView::hostWindow): Use early return.
803         (WebCore::FrameView::updateScrollCorner): Removed unneeded call through to base
804         class function, which was empty.
805         (WebCore::FrameView::hasCustomScrollbars): Updated since the children set now
806         contains Ref rather than RefPtr.
807         (WebCore::FrameView::parentFrameView): Use early return.
808         (WebCore::FrameView::updateWidgetPositions): Use reference instead of pointer.
809         * page/FrameView.h: Use final instead of override. Remove now-unneeded const_cast.
810
811         * page/Page.cpp:
812         (WebCore::Page::pluginViews): Updated since the children set now contains
813         Ref rather than RefPtr.
814
815         * page/PrintContext.cpp:
816         (WebCore::PrintContext::pageProperty): Updated for LengthSize struct.
817
818         * page/animation/AnimationBase.cpp:
819         (WebCore::AnimationBase::fireAnimationEventsIfNeeded): Updated for changes to
820         the types in animation function members.
821         (WebCore::AnimationBase::timeToNextService): Ditto.
822         (WebCore::AnimationBase::progress): Ditto.
823         (WebCore::AnimationBase::getElapsedTime): Ditto.
824
825         * page/animation/CSSPropertyAnimation.cpp:
826         (WebCore::blendFunc): Updated for LengthSize struct.
827         (WebCore::LengthPropertyWrapper::LengthPropertyWrapper): Updated since we now
828         use rvalue references and move semantics when setting length properties.
829
830         * page/scrolling/ScrollingCoordinator.cpp:
831         (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame): Tweaked to
832         use auto, pass references.
833
834         * platform/KeyedCoding.h: Return RefPtr instead of PassRefPtr.
835
836         * platform/LengthBox.h: Added a constructor that moves the lengths in, rather
837         than always copying them.
838
839         * platform/LengthSize.cpp:
840         (WebCore::operator<<): Updated since LengthSize is a struct.
841         * platform/LengthSize.h: Turned LengthSize into a struct and removed all the
842         getter and setter code.
843
844         * platform/PlatformSpeechSynthesis.h: Removed. Unused.
845
846         * platform/PlatformSpeechSynthesisUtterance.cpp:
847         (WebCore::PlatformSpeechSynthesisUtterance::create): Return Ref rather than PassRefPtr.
848         (WebCore::PlatformSpeechSynthesisUtterance::PlatformSpeechSynthesisUtterance): Take
849         a reference. Initialize data members in class definition.
850         * platform/PlatformSpeechSynthesisUtterance.h: Updated for the above.
851
852         * platform/PlatformSpeechSynthesisVoice.cpp:
853         (WebCore::PlatformSpeechSynthesisVoice::create): Return Ref rather than PassRefPtr.
854         * platform/PlatformSpeechSynthesisVoice.h: Updated for the above.
855
856         * platform/ScrollView.cpp:
857         (WebCore::ScrollView::addChild): Take a reference rather than a PassRefPtr.
858         (WebCore::ScrollView::setHasScrollbarInternal): Updated for change to addChild
859         (WebCore::ScrollView::scrollContentsFastPath): Deleted. This was never called,
860         so made it pure virtual.
861         (WebCore::ScrollView::frameRectsChanged): Use a modern for loop.
862         (WebCore::ScrollView::clipRectChanged): Ditto.
863         (WebCore::ScrollView::updateScrollCorner): Deleted. This was empty so made it pure
864         virtual and changed FrameView to not call it.
865         (WebCore::ScrollView::setParentVisible): Use a modern for loop.
866         (WebCore::ScrollView::show): Ditto.
867         (WebCore::ScrollView::hide): Ditto.
868         * platform/ScrollView.h: Changed the children set to contain Ref instead of RefPtr.
869         Changed functions that were never overridden to either be final or non-virtual,
870         Changed functions that were never called to be pure virtual.
871
872         * platform/Theme.h:
873         (WebCore::Theme::minimumControlSize): Updated for LengthSize struct.
874
875         * platform/animation/Animation.h: Changed timingFunction and trigger to return
876         raw pointers instead of PassRefPtr. Changed setTimingFunction and setTrigger to
877         take RefPtr&& and Ref&& instead of PassRefPtr. CHanged initialTimingfunction and
878         initialTrigger to return Ref.
879
880         * platform/animation/AnimationList.cpp: Removed redundant check in FILL_UNSET_PROPERTY.
881         (WebCore::AnimationList::AnimationList): Use modern for loop, reserveInitialCapacity,
882         and uncheckedAppend.
883         * platform/animation/AnimationList.h: Changed append to take Ref&& instead of PassRefPtr.
884         changed vecto to contain Ref instead of RefPtr. Added move constructor and assignment
885         operator.
886
887         * platform/animation/AnimationTrigger.h:
888         (WebCore::AutoAnimationTrigger::clone): Return Ref instead of PassRefPtr.
889         (WebCore::AutoAnimationTrigger::create): Ditto.
890         (WebCore::AutoAnimationTrigger::clone): Ditto.
891         (WebCore::ScrollAnimationTrigger::create): Ditto.
892         (WebCore::ScrollAnimationTrigger::clone): Ditto.
893
894         * platform/animation/TimingFunction.h:
895         (WebCore::LinearTimingFunction::create): Return Ref instead of PassRefPtr.
896         (WebCore::CubicBezierTimingFunction::create): Ditto.
897         (WebCore::CubicBezierTimingFunction::defaultTimingFunction): Return a reference
898         instead of a pointer.
899         (WebCore::CubicBezierTimingFunction::createReversed): Return Ref instead of PassRefPtr.
900         (WebCore::CubicBezierTimingFunction::clone): Ditto.
901         (WebCore::StepsTimingFunction::create): Ditto.
902         (WebCore::StepsTimingFunction::clone): Ditto.
903         (WebCore::SpringTimingFunction::create): Ditto.
904         (WebCore::SpringTimingFunction::clone): Ditto.
905
906         * platform/audio/AudioBus.h:
907         (WebCore::AudioBus::channel): Removed no-longer-needed const_cast.
908
909         * platform/cf/KeyedEncoderCF.cpp:
910         (WebCore::KeyedEncoderCF::finishEncoding): Return RefPtr instead of PassRefPtr.
911         * platform/cf/KeyedEncoderCF.h: Use final instead of override. Made even more
912         private. Changed return value of finishEncoding to Ref instead of PassRefPtr.
913
914         * platform/efl/PlatformSpeechSynthesisProviderEfl.h: Removed include of PassRefPtr.h.
915
916         * platform/glib/KeyedEncoderGlib.cpp:
917         (WebCore::KeyedEncoderGlib::finishEncoding): Return RefPtr instead of PassRefPtr.
918         * platform/glib/KeyedEncoderGlib.h: Use final instead of override. Made even more
919         private. Changed return value of finishEncoding to Ref instead of PassRefPtr.
920
921         * platform/graphics/filters/FilterOperations.cpp:
922         (WebCore::outsetSizeForBlur): Simplified, removing unnecessary floating point math.
923         (WebCore::FilterOperations::FilterOperations): Deleted. Let the compiler generate this.
924         (WebCore::FilterOperations::operator=): Deleted. Let the compiler generate this.
925         (WebCore::FilterOperations::operator==): Streamlined.
926         (WebCore::FilterOperations::operationsMatch): Ditto.
927         (WebCore::FilterOperations::hasReferenceFilter): Ditto.
928         (WebCore::FilterOperations::hasOutsets): Ditto.
929         (WebCore::FilterOperations::outsets): Ditto.
930         (WebCore::FilterOperations::hasFilterThatAffectsOpacity): Ditto.
931         (WebCore::FilterOperations::hasFilterThatMovesPixels): Ditto.
932         * platform/graphics/filters/FilterOperations.h: Updated for above changes.
933
934         * platform/graphics/FontCache.h: Removed included of PassRefPtr.h.
935
936         * platform/graphics/FontPlatformData.h: Tweaked formatting. Removed nesting
937         from #if since our formatting makes it hard to see nesting. Let the compiler
938         generate the default move and copy constructors and assignemnt operators except
939         in the USE(FREETYPE) case.
940
941         * platform/graphics/GraphicsLayer.h:
942         (WebCore::AnimationValue::AnimationValue): Updated since clone now returns a Ref
943         rather than a RefPtr.
944         (WebCore::FloatAnimationValue::FloatAnimationValue): Deleted. Let the compiler
945         generate the copy constructor without defining it explicitly.
946         (WebCore::TransformAnimationValue::TransformAnimationValue): Use a modern for
947         loop, reserveInitialCapacity, and unchecked append. Also tell the compiler to
948         generate the move constructor, since the special work is only needed for the
949         copy constructor.
950         (WebCore::FilterAnimationValue::FilterAnimationValue): Ditto.
951         (WebCore::KeyframeValueList::KeyframeValueList): Ditto.
952
953         * platform/graphics/LegacyCDMSession.h: Removed include of PassRefPtr.h.
954
955         * platform/graphics/PathUtilities.cpp:
956         (WebCore::PathUtilities::pathWithShrinkWrappedRectsForOutline): Updated
957         for LengthSize struct.
958
959         * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
960         (WebCore::CDMSessionAVFoundationCF::CDMSessionAVFoundationCF): Take a reference.
961         Don't bother setting m_client since we never use it.
962         (WebCore::CDMSessionAVFoundationCF::generateKeyRequest): Clean up code a bit
963         by using auto a lot more.
964         * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h: Added include
965         that is now needed since it was removed from the base class. Tidied the class
966         up a bit, marking it final, making everything private, taking a reference, and
967         removing an unused data member, m_client.
968
969         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
970         (WebCore::MediaPlayerPrivateAVFoundationCF::createSession): Pass a reference.
971
972         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
973         added include of WTFString.h, now needed because of removing an unneeded
974         include from another header file.
975
976         * platform/graphics/ca/GraphicsLayerCA.cpp:
977         (WebCore::GraphicsLayerCA::animationCanBeAccelerated): Updated since trigger
978         is a raw pointer now.
979         (WebCore::GraphicsLayerCA::timingFunctionForAnimationValue): Updated to
980         return a reference rather than a pointer.
981         (WebCore::GraphicsLayerCA::setAnimationEndpoints): Updated for the above change.
982         (WebCore::GraphicsLayerCA::setAnimationKeyframes): Ditto.
983         (WebCore::GraphicsLayerCA::setTransformAnimationEndpoints): Ditto.
984         (WebCore::GraphicsLayerCA::setTransformAnimationKeyframes): Ditto.
985         (WebCore::GraphicsLayerCA::setFilterAnimationEndpoints): Ditto.
986         (WebCore::GraphicsLayerCA::setFilterAnimationKeyframes): Ditto.
987         * platform/graphics/ca/GraphicsLayerCA.h: Ditto.
988
989         * platform/ios/PlatformSpeechSynthesizerIOS.mm:
990         (-[WebSpeechSynthesisWrapper speakUtterance:]): CHanged argument to be a
991         RefPtr&& instead of a PassRefPtr.
992
993         * platform/mac/ThemeMac.mm:
994         (WebCore::sizeFromNSControlSize): Updated for LenghtSize struct.
995         (WebCore::checkboxSize): Ditto.
996         (WebCore::radioSize): Ditto.
997         (WebCore::ThemeMac::controlSize): Ditto.
998         (WebCore::ThemeMac::minimumControlSize): Ditto.
999
1000         * platform/mac/WidgetMac.mm:
1001         (WebCore::Widget::setFocus): Updated to pass a reference.
1002
1003         * platform/mock/DeviceMotionClientMock.cpp: Removed. Unused.
1004         * platform/mock/DeviceMotionClientMock.h: Removed. Unused.
1005
1006         * platform/win/CursorWin.cpp:
1007         (WebCore::createSharedCursor): Return a Ref instead of a PassRefPtr.
1008         (WebCore::loadSharedCursor): Ditto.
1009         (WebCore::loadCursorByName): Ditto.
1010
1011         * rendering/FilterEffectRenderer.cpp:
1012         (WebCore::FilterEffectRenderer::output): Removed a no-longer-needed const_cast.
1013         (WebCore::FilterEffectRenderer::outputRect): Ditto.
1014
1015         * rendering/ImageQualityController.cpp:
1016         (WebCore::ImageQualityController::chooseInterpolationQuality): Tweaked formatting.
1017
1018         * rendering/InlineFlowBox.cpp:
1019         (WebCore::InlineFlowBox::paintFillLayers): Updated to take a reference. Also
1020         used a vector to iterate the linked list in reverse order instead of recursion.
1021         (WebCore::InlineFlowBox::paintFillLayer): Take a reference.
1022         (WebCore::InlineFlowBox::paintMask):
1023         * rendering/InlineFlowBox.h: Updated for the above.
1024
1025         * rendering/RenderBox.cpp:
1026         (WebCore::RenderBox::paintRootBoxFillLayers): Use auto a bit.
1027         (WebCore::RenderBox::getBackgroundPaintedExtent): Use reference for the layers.
1028         (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect): Ditto.
1029         (WebCore::RenderBox::backgroundHasOpaqueTopLayer): Ditto.
1030         (WebCore::RenderBox::paintMaskImages): Ditto.
1031         (WebCore::RenderBox::maskClipRect): Ditto.
1032         (WebCore::RenderBox::paintFillLayers): Ditto.
1033         (WebCore::RenderBox::paintFillLayer): Ditto.
1034         (WebCore::layersUseImage): Ditto.
1035         (WebCore::RenderBox::repaintLayerRectsForImage): Ditto.
1036         * rendering/RenderBox.h: Updated for the above.
1037
1038         * rendering/RenderBoxModelObject.cpp:
1039         (WebCore::RenderBoxModelObject::paintFillLayerExtended): Use reference for
1040         the layers.
1041         (WebCore::RenderBoxModelObject::calculateFillTileSize): Ditto.
1042         (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): Ditto.
1043         (WebCore::RenderBoxModelObject::getGeometryForBackgroundImage): Ditto.
1044         (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground): Ditto.
1045         * rendering/RenderBoxModelObject.h: Updated for the above.
1046
1047         * rendering/RenderElement.cpp:
1048         (WebCore::RenderElement::~RenderElement): Use references for the layers.
1049         (WebCore::RenderElement::adjustStyleDifference): Ditto.
1050         (WebCore::RenderElement::updateFillImages): Ditto.
1051         (WebCore::RenderElement::setStyle): Use RenderStyle::replace to replace the
1052         old style with the new style, and get the old one out at the same time.
1053         (WebCore::RenderElement::styleDidChange): Use references for the layers.
1054         (WebCore::mustRepaintFillLayers): Ditto.
1055         (WebCore::RenderElement::repaintAfterLayoutIfNeeded): Ditto.
1056         * rendering/RenderElement.h: Updated for the above.
1057
1058         * rendering/RenderGrid.cpp:
1059         (WebCore::RenderGrid::computeContentPositionAndDistributionOffset):
1060         Refactor so we don't need so many functions in RenderStyle.
1061         * rendering/RenderMenuList.cpp:
1062         (WebCore::RenderMenuList::adjustInnerStyle): Ditto.
1063
1064         * rendering/RenderLayer.cpp:
1065         (WebCore::RenderLayer::createScrollbar): Pass widget as reference to addChild.
1066         Also did a few other tweaks and used more specific types.
1067
1068         * rendering/RenderLayerBacking.cpp:
1069         (WebCore::canCreateTiledImage): Updated since layers are references.
1070         (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage): Ditto.
1071
1072         * rendering/RenderListBox.cpp:
1073         (WebCore::RenderListBox::createScrollbar): Pass widget as reference to addChild.
1074
1075         * rendering/RenderTableCell.cpp:
1076         (WebCore::RenderTableCell::paintBackgroundsBehindCell): Updated to use
1077         references for layers.
1078
1079         * rendering/RenderTheme.cpp:
1080         (WebCore::RenderTheme::adjustStyle): Use WTFMove to pass a LengthBox.
1081         (WebCore::RenderTheme::isControlStyled): Updated since LengthSize is a struct,
1082         more WTFMove, change since layers are ferences.
1083
1084         * rendering/RenderThemeEfl.cpp:
1085         (WebCore::RenderThemeEfl::adjustSizeConstraints): Update for Length and
1086         LengthSize changes.
1087         (WebCore::RenderThemeEfl::paintThemePart): Use reference instead of pointer.
1088         (WebCore::RenderThemeEfl::applyPartDescriptionFallback): Update for Length and
1089         LengthSize changes.
1090         (WebCore::RenderThemeEfl::applyPartDescription): Ditto.
1091         (WebCore::RenderThemeEfl::adjustCheckboxStyle): Ditto.
1092         (WebCore::RenderThemeEfl::adjustRadioStyle): Ditto.
1093
1094         * rendering/RenderThemeGtk.cpp:
1095         (WebCore::borderRadiiFromStyle): Update for Length and LengthSize changes.
1096
1097         * rendering/RenderThemeIOS.mm:
1098         (WebCore::RenderThemeIOS::adjustCheckboxStyle): Update for Length and
1099         LengthSize changes.
1100         (WebCore::RenderThemeIOS::isControlStyled): Ditto.
1101         (WebCore::RenderThemeIOS::adjustRadioStyle): Ditto.
1102         (WebCore::RenderThemeIOS::adjustRoundBorderRadius): Ditto.
1103         (WebCore::RenderThemeIOS::paintMenuListButtonDecorations): Ditto.
1104         (WebCore::RenderThemeIOS::adjustSliderTrackStyle): Ditto.
1105         (WebCore::RenderThemeIOS::adjustSliderThumbSize): Ditto.
1106
1107         * rendering/RenderWidget.cpp:
1108         (WebCore::WidgetHierarchyUpdatesSuspensionScope::moveWidgets): Use move
1109         insteead of swap and modern for loop instead of iterators.
1110         (WebCore::moveWidgetToParentSoon): Take a reference instead of a pointer.
1111         (WebCore::RenderWidget::setWidget): Update for above change.
1112         (WebCore::RenderWidget::find): Take a reference instead of a pointer.
1113         * rendering/RenderWidget.h: Updated for above changes.
1114
1115         * rendering/TextAutoSizing.cpp:
1116         (WebCore::TextAutoSizingValue::reset): Updated since Length is passed as
1117         rvalue reference now.
1118
1119         * rendering/mathml/MathMLStyle.cpp:
1120         (WebCore::MathMLStyle::getMathMLStyle): Updated since mathMLStyle returns
1121         a reference.
1122         (WebCore::MathMLStyle::resolveMathMLStyleTree): Ditto.
1123
1124         * rendering/mathml/RenderMathMLBlock.h:
1125         (WebCore::RenderMathMLBlock::mathMLStyle): Removed no-longer needed const_cast,
1126         changed to return a reference rather than a pointer.
1127         (WebCore::RenderMathMLTable::mathMLStyle): Ditto.
1128
1129         * rendering/mathml/RenderMathMLFraction.cpp:
1130         (WebCore::RenderMathMLFraction::fractionParameters): Updated since mathMLStyle
1131         returns a reference.
1132         (WebCore::RenderMathMLFraction::stackParameters): Ditto.
1133         * rendering/mathml/RenderMathMLOperator.h:
1134         (WebCore::RenderMathMLOperator::isLargeOperatorInDisplayStyle): Ditto.
1135         (WebCore::RenderMathMLOperator::shouldMoveLimits): Ditto.
1136         * rendering/mathml/RenderMathMLRoot.cpp:
1137         (WebCore::RenderMathMLRoot::verticalParameters): Ditto.
1138         * rendering/mathml/RenderMathMLToken.cpp:
1139         (WebCore::RenderMathMLToken::updateMathVariantGlyph): Ditto.
1140
1141         * rendering/style/BasicShapes.cpp:
1142         (WebCore::floatSizeForLengthSize): Updated for LengthSize struct.
1143         * rendering/style/BorderData.h:
1144         (WebCore::BorderData::BorderData): Ditto.
1145         (WebCore::BorderData::hasBorderRadius): Ditto.
1146
1147         * rendering/style/ContentData.cpp:
1148         (WebCore::ContentData::clone): Updated member names.
1149         * rendering/style/ContentData.h: Ditto.
1150
1151         * rendering/style/NinePieceImage.cpp:
1152         (WebCore::NinePieceImage::computeSlices): Use initializer lists so we get
1153         move optimization without requiring explicit WTFMove.
1154
1155         * rendering/style/DataRef.h:
1156         (WebCore::DataRef::DataRef): Removed no-longer needed const_cast.
1157         (WebCore::DataRef::replace): Added. This function is like Ref::replace, and
1158         can be used to put a new value in and get an old value out without running into
1159         the rule Ref has about not being reused once it becomes null because of being
1160         moved out of. This function is a lot like std::exchange.
1161         (WebCore::DataRef::operator const T&): Added operator so we can use these
1162         as references without any function call in read-only contexts.
1163         (WebCore::DataRef::get): Changed to return a reference rather than pointer.
1164         (WebCore::DataRef::access): Ditto.
1165
1166         * rendering/style/KeyframeList.cpp:
1167         (WebCore::KeyframeValue::timingFunction): Updated since timingFunction
1168         returns a raw pointer.
1169         (WebCore::KeyframeList::~KeyframeList): Removed unneeded call to clear,
1170         which does things that are redundant since we are about to destroy all the
1171         data members.
1172         (WebCore::KeyframeList::operator==): Tweaked codign style a bit.
1173
1174         * rendering/style/NinePieceImage.h: Updated most functions in this class
1175         for the changes to DataRef.
1176
1177         * rendering/style/RenderStyle.cpp: Updated nearly every function in this
1178         class for the changes to DataRef, to eliminate the peculiar naming and use
1179         our standard data member naming, m_memberName in a class, and memberName in a
1180         struct or struct-like class for publicly accessible members, to pass, take,
1181         and return more references and rvalue references, and to use modern for loops.
1182         Other changes listed below function by function.
1183         (WebCore::RenderStyle::defaultStyle): Use NeverDestroyed instead of allocating
1184         on the heap.
1185         (WebCore::RenderStyle::RenderStyle): Added a new constructor that performs
1186         the replace operation, using a combination of DataRef::replace and std::exchange.
1187         (WebCore::RenderStyle::replace): Added. Calls the above constructor.
1188         (WebCore::RenderStyle::setScrollSnapType): Use SET_NESTED_VAR so we get equality
1189         checks on this property, for the normal efficiency benefit.
1190         (WebCore::RenderStyle::setDashboardRegion): Moved this here from the header.
1191         (WebCore::RenderStyle::appendContent): Deleted.
1192         (WebCore::RenderStyle::setContent): Refactored this set of functions to simplify.
1193
1194         * rendering/style/RenderStyle.h: Updated most functions as mentioned above.
1195         Also updated macros to use the do/while(0) technique. Removed the long list of
1196         friend classes with the elaborate comments; turned out none needed friendship
1197         despite the comments. Made more things private. Moved large functions out of the
1198         class definition.
1199         (WebCore::RenderStyle::getTextShadowExtent): Deleted.
1200         (WebCore::RenderStyle::getTextShadowHorizontalExtent): Deleted.
1201         (WebCore::RenderStyle::getTextShadowVerticalExtent): Deleted.
1202         (WebCore::RenderStyle::aspectRatio): Deleted.
1203         (WebCore::RenderStyle::alignContentPosition): Deleted.
1204         (WebCore::RenderStyle::alignContentDistribution): Deleted.
1205         (WebCore::RenderStyle::alignContentOverflowAlignment): Deleted.
1206         (WebCore::RenderStyle::alignItemsPosition): Deleted.
1207         (WebCore::RenderStyle::alignItemsOverflowAlignment): Deleted.
1208         (WebCore::RenderStyle::alignSelfPosition): Deleted.
1209         (WebCore::RenderStyle::alignSelfOverflowAlignment): Deleted.
1210         (WebCore::RenderStyle::justifyContentPosition): Deleted.
1211         (WebCore::RenderStyle::justifyContentDistribution): Deleted.
1212         (WebCore::RenderStyle::justifyContentOverflowAlignment): Deleted.
1213         (WebCore::RenderStyle::justifyItemsPosition): Deleted.
1214         (WebCore::RenderStyle::justifyItemsOverflowAlignment): Deleted.
1215         (WebCore::RenderStyle::justifyItemsPositionType): Deleted.
1216         (WebCore::RenderStyle::justifySelfPosition): Deleted.
1217         (WebCore::RenderStyle::justifySelfOverflowAlignment): Deleted.
1218         (WebCore::RenderStyle::setAlignContentPosition): Deleted.
1219         (WebCore::RenderStyle::setAlignContentOverflow): Deleted.
1220         (WebCore::RenderStyle::setAlignContentDistribution): Deleted.
1221         (WebCore::RenderStyle::setAlignItemsOverflow): Deleted.
1222         (WebCore::RenderStyle::setAlignSelfOverflow): Deleted.
1223         (WebCore::RenderStyle::setJustifyContentOverflow): Deleted.
1224         (WebCore::RenderStyle::setJustifyContentDistribution): Deleted.
1225         (WebCore::RenderStyle::setJustifyItemsPosition): Deleted.
1226         (WebCore::RenderStyle::setJustifyItemsOverflow): Deleted.
1227         (WebCore::RenderStyle::setJustifyItemsPositionType): Deleted.
1228         (WebCore::RenderStyle::setJustifySelfPosition): Deleted.
1229         (WebCore::RenderStyle::setJustifySelfOverflow): Deleted.
1230         (WebCore::RenderStyle::noninheritedFlagsMemoryOffset): Deleted.
1231
1232         * rendering/style/SVGRenderStyle.cpp: Similar changes to RenderStyle.cpp above.
1233         * rendering/style/SVGRenderStyle.h: Ditto.
1234
1235         * rendering/style/ShapeValue.h:
1236         (WebCore::ShapeValue::create): Take a Ref&& instead of a RefPtr.
1237         (WebCore::ShapeValue::ShapeValue): Ditto.
1238
1239         * rendering/style/StyleBackgroundData.cpp: Update data member names.
1240         * rendering/style/StyleBackgroundData.h: Ditto; make them public and remove the
1241         getter functions.
1242
1243         * rendering/style/StyleCachedImage.cpp:
1244         (WebCore::StyleCachedImage::cssValue): Removed no-longer-needed const_cast.
1245
1246         * rendering/style/StyleCustomPropertyData.h: Update data member names.
1247         (WebCore::StyleCustomPropertyData::operator==): Removed unnecessary reference
1248         count churn.
1249         (WebCore::StyleCustomPropertyData::setCustomPropertyValue): Take an rvalue
1250         reference.
1251         (WebCore::StyleCustomPropertyData::getCustomPropertyValue): Deleted.
1252         (WebCore::StyleCustomPropertyData::values): Deleted.
1253         (WebCore::StyleCustomPropertyData::hasCustomProperty): Deleted.
1254         (WebCore::StyleCustomPropertyData::containsVariables): Deleted.
1255         (WebCore::StyleCustomPropertyData::setContainsVariables): Deleted.
1256
1257         * rendering/style/StyleFilterData.cpp: Update data member names.
1258         * rendering/style/StyleFilterData.h: Ditto.
1259         * rendering/style/StyleFlexibleBoxData.cpp: Ditto.
1260         * rendering/style/StyleFlexibleBoxData.h: Ditto.
1261         * rendering/style/StyleGridData.cpp: Ditto.
1262         * rendering/style/StyleGridData.h: Ditto.
1263         * rendering/style/StyleGridItemData.cpp: Ditto.
1264         * rendering/style/StyleGridItemData.h: Ditto.
1265
1266         * rendering/style/StyleGeneratedImage.cpp:
1267         (WebCore::StyleGeneratedImage::cssValue): Removed no-longer-needed const_cast.
1268         (WebCore::StyleGeneratedImage::imageSize): Ditto.
1269         (WebCore::StyleGeneratedImage::image): Ditto.
1270
1271         * rendering/style/StyleInheritedData.cpp: Update data member names.
1272         * rendering/style/StyleInheritedData.h: Ditto.
1273         * rendering/style/StyleRareInheritedData.cpp: Ditto.
1274         * rendering/style/StyleRareInheritedData.h: Ditto.
1275         * rendering/style/StyleMultiColData.cpp: Ditto.
1276         * rendering/style/StyleMultiColData.h: Ditto.
1277         * rendering/style/StyleRareNonInheritedData.cpp: Ditto.
1278         * rendering/style/StyleRareNonInheritedData.h: Ditto.
1279         * rendering/style/StyleTransformData.cpp: Ditto.
1280         * rendering/style/StyleTransformData.h: Ditto.
1281         * rendering/style/StyleVisualData.cpp: Ditto.
1282         * rendering/style/StyleVisualData.h: Ditto.
1283
1284         * style/StylePendingResources.cpp:
1285         (WebCore::Style::loadPendingResources): Update since layers are references.
1286
1287
1288 2017-01-13  Chris Dumez  <cdumez@apple.com>
1289
1290         [WK2] Add diagnostic logging to measure WebGL usage
1291         https://bugs.webkit.org/show_bug.cgi?id=166730
1292         <rdar://problem/29883469>
1293
1294         Reviewed by Alex Christensen.
1295
1296         Add diagnostic logging to measure high performance WebGL usage. We report
1297         at regular intervals in which WebGL state Safari is:
1298         - Inactive
1299         - ActiveInForegroundTab
1300         - ActiveInBackgroundTabOnly
1301
1302         This should give us an estimate of:
1303         - What % of the time is Safari using high performance graphics
1304         - What % of this time is only due to background tabs
1305
1306         No new tests, no Web-facing behavior change.
1307
1308         * WebCore.xcodeproj/project.pbxproj:
1309         * html/canvas/WebGLRenderingContextBase.cpp:
1310         (WebCore::WebGLRenderingContextBase::create):
1311         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
1312         (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
1313         * html/canvas/WebGLRenderingContextBase.h:
1314         * page/DiagnosticLoggingKeys.cpp:
1315         (WebCore::DiagnosticLoggingKeys::inactiveKey):
1316         (WebCore::DiagnosticLoggingKeys::activeInForegroundTabKey):
1317         (WebCore::DiagnosticLoggingKeys::activeInBackgroundTabOnlyKey):
1318         (WebCore::DiagnosticLoggingKeys::stateKey):
1319         (WebCore::WebCore::DiagnosticLoggingKeys::webGLKey):
1320         * page/DiagnosticLoggingKeys.h:
1321         * page/Page.cpp:
1322         (WebCore::Page::Page):
1323         * page/Page.h:
1324         (WebCore::Page::webGLStateTracker):
1325         * page/PageConfiguration.cpp:
1326         * page/PageConfiguration.h:
1327         * platform/WebGLStateTracker.cpp: Copied from Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h.
1328         (WebCore::WebGLStateTracker::WebGLStateTracker):
1329         (WebCore::m_stateChangeHandler):
1330         (WebCore::WebGLStateTracker::updateWebGLState):
1331         * platform/WebGLStateTracker.h: Copied from Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h.
1332         * platform/graphics/GraphicsContext3DAttributes.h:
1333
1334 2017-01-13  Brent Fulgham  <bfulgham@apple.com>
1335
1336         Avoid nullptr frame dereference when scrollTo is called on a disconnected DOMWindow
1337         https://bugs.webkit.org/show_bug.cgi?id=167030
1338         <rdar://problem/29995070>
1339
1340         Reviewed by Dean Jackson.
1341
1342         Correct DOMWindow::scrollTo to match all other functions in the class so that the it
1343         checks that the current frame is valid before attempting to use it.
1344
1345         * page/DOMWindow.cpp:
1346         (WebCore::DOMWindow::scrollTo):
1347
1348 2017-01-13  Jer Noble  <jer.noble@apple.com>
1349
1350         Use a strong reference when calling callOnMainThread to schedule events in AudioScheduledSourceNode.
1351         https://bugs.webkit.org/show_bug.cgi?id=166983
1352
1353         Reviewed by Brent Fulgham.
1354
1355         * Modules/webaudio/AudioScheduledSourceNode.cpp:
1356         (WebCore::AudioScheduledSourceNode::finish):
1357         * Modules/webaudio/AudioScheduledSourceNode.h:
1358
1359 2017-01-12  Jer Noble  <jer.noble@apple.com>
1360
1361         Protect MediaPlayer from being destroyed mid-load()
1362         https://bugs.webkit.org/show_bug.cgi?id=166976
1363
1364         Reviewed by Eric Carlson.
1365
1366         It's possible for a message sent by MediaPlayer to HTMLMediaElement to cause
1367         MediaPlayer to be destroyed before MediaPlayer::load() completes. We have
1368         previously protected against this same problem in HTMLMediaElement::loadResource()
1369         by ref'ing at the beginning of the function and deref'ing on exit. To do the
1370         same in MediaPlayer, it must become RefCounted.
1371
1372         To keep the same semantics about m_client in MediaPlayer (always available without
1373         requiring a null-check), make a new static MediaPlayerClient object which can
1374         replace the real (HTMLMediaElement) client when the MediaPlayer is invalidated.
1375
1376         * html/HTMLMediaElement.cpp:
1377         (WebCore::HTMLMediaElement::~HTMLMediaElement):
1378         (WebCore::HTMLMediaElement::clearMediaPlayer):
1379         (WebCore::HTMLMediaElement::createMediaPlayer):
1380         * html/HTMLMediaElement.h:
1381         * platform/graphics/MediaPlayer.cpp:
1382         (WebCore::nullMediaPlayerClient):
1383         (WebCore::MediaPlayer::create):
1384         (WebCore::MediaPlayer::MediaPlayer):
1385         (WebCore::MediaPlayer::invalidate):
1386         (WebCore::MediaPlayer::load):
1387         (WebCore::MediaPlayer::loadWithNextMediaEngine):
1388         (WebCore::MediaPlayer::inMediaDocument):
1389         (WebCore::MediaPlayer::fullscreenMode):
1390         (WebCore::MediaPlayer::requestedRate):
1391         (WebCore::MediaPlayer::currentPlaybackTargetIsWirelessChanged):
1392         (WebCore::MediaPlayer::networkStateChanged):
1393         (WebCore::MediaPlayer::readyStateChanged):
1394         (WebCore::MediaPlayer::volumeChanged):
1395         (WebCore::MediaPlayer::muteChanged):
1396         (WebCore::MediaPlayer::timeChanged):
1397         (WebCore::MediaPlayer::sizeChanged):
1398         (WebCore::MediaPlayer::repaint):
1399         (WebCore::MediaPlayer::durationChanged):
1400         (WebCore::MediaPlayer::rateChanged):
1401         (WebCore::MediaPlayer::playbackStateChanged):
1402         (WebCore::MediaPlayer::firstVideoFrameAvailable):
1403         (WebCore::MediaPlayer::characteristicChanged):
1404         (WebCore::MediaPlayer::cachedKeyForKeyId):
1405         (WebCore::MediaPlayer::keyNeeded):
1406         (WebCore::MediaPlayer::mediaKeysStorageDirectory):
1407         (WebCore::MediaPlayer::referrer):
1408         (WebCore::MediaPlayer::userAgent):
1409         (WebCore::MediaPlayer::graphicsDeviceAdapter):
1410         (WebCore::MediaPlayer::cachedResourceLoader):
1411         (WebCore::MediaPlayer::createResourceLoader):
1412         (WebCore::MediaPlayer::addAudioTrack):
1413         (WebCore::MediaPlayer::removeAudioTrack):
1414         (WebCore::MediaPlayer::addTextTrack):
1415         (WebCore::MediaPlayer::removeTextTrack):
1416         (WebCore::MediaPlayer::addVideoTrack):
1417         (WebCore::MediaPlayer::removeVideoTrack):
1418         (WebCore::MediaPlayer::outOfBandTrackSources):
1419         (WebCore::MediaPlayer::shouldWaitForResponseToAuthenticationChallenge):
1420         (WebCore::MediaPlayer::handlePlaybackCommand):
1421         (WebCore::MediaPlayer::sourceApplicationIdentifier):
1422         (WebCore::MediaPlayer::preferredAudioCharacteristics):
1423         (WebCore::MediaPlayer::doesHaveAttribute):
1424         (WebCore::MediaPlayer::mediaPlayerNetworkInterfaceName):
1425         (WebCore::MediaPlayer::getRawCookies):
1426         (WebCore::MediaPlayer::shouldDisableSleep):
1427         * platform/graphics/MediaPlayer.h:
1428         (WebCore::MediaPlayer::platformVolumeConfigurationRequired):
1429         (WebCore::MediaPlayer::client):
1430
1431 2017-01-13  Eric Carlson  <eric.carlson@apple.com>
1432
1433         [MediaStream, Mac] Add mock audio source
1434         https://bugs.webkit.org/show_bug.cgi?id=166974
1435
1436         Reviewed by Jer Noble.
1437         
1438         Add a mock audio source for testing media streams.
1439
1440         No new tests, updated webaudio/mediastreamaudiosourcenode.html.
1441
1442         * WebCore.xcodeproj/project.pbxproj:
1443         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1444         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSample):
1445         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
1446
1447         * platform/mediastream/mac/AVAudioCaptureSource.h:
1448         (WebCore::AVAudioCaptureSource::Observer::~Observer): Deleted.
1449
1450         * platform/mediastream/mac/AVAudioCaptureSource.mm:
1451         (WebCore::AVAudioCaptureSource::addObserver):
1452         (WebCore::AVAudioCaptureSource::removeObserver):
1453         (WebCore::AVAudioCaptureSource::start):
1454
1455         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h: Added.
1456         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm: Added.
1457         (WebCore::MockRealtimeAudioSource::create):
1458         (WebCore::MockRealtimeAudioSourceMac::MockRealtimeAudioSourceMac):
1459         (WebCore::MockRealtimeAudioSource::createMuted):
1460         (WebCore::MockRealtimeAudioSourceMac::addObserver):
1461         (WebCore::MockRealtimeAudioSourceMac::removeObserver):
1462         (WebCore::MockRealtimeAudioSourceMac::start):
1463         (WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers):
1464         (WebCore::MockRealtimeAudioSourceMac::reconfigure):
1465         (WebCore::MockRealtimeAudioSourceMac::render):
1466         (WebCore::MockRealtimeAudioSourceMac::applySampleRate):
1467         (WebCore::MockRealtimeAudioSourceMac::audioSourceProvider):
1468
1469         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
1470         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
1471         (WebCore::WebAudioSourceProviderAVFObjC::create):
1472         (WebCore::WebAudioSourceProviderAVFObjC::WebAudioSourceProviderAVFObjC):
1473         (WebCore::WebAudioSourceProviderAVFObjC::~WebAudioSourceProviderAVFObjC):
1474         (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
1475         (WebCore::WebAudioSourceProviderAVFObjC::setClient):
1476         (WebCore::WebAudioSourceProviderAVFObjC::startProducingData): Deleted.
1477         (WebCore::WebAudioSourceProviderAVFObjC::stopProducingData): Deleted.
1478
1479         * platform/mock/MockRealtimeAudioSource.cpp:
1480         (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource):
1481         (WebCore::MockRealtimeAudioSource::startProducingData):
1482         (WebCore::MockRealtimeAudioSource::stopProducingData):
1483         (WebCore::MockRealtimeAudioSource::elapsedTime):
1484         (WebCore::MockRealtimeAudioSource::tick):
1485
1486         * platform/mock/MockRealtimeAudioSource.h:
1487         (WebCore::MockRealtimeAudioSource::render):
1488         (WebCore::MockRealtimeAudioSource::renderInterval):
1489         (WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource): Deleted.
1490
1491 2017-01-13  Sam Weinig  <sam@webkit.org>
1492
1493         [WebIDL] Remove custom bindings for DeviceMotionEvent and DeviceOrientationEvent
1494         https://bugs.webkit.org/show_bug.cgi?id=167006
1495
1496         Reviewed by Geoffrey Garen.
1497
1498         * CMakeLists.txt:
1499         * WebCore.xcodeproj/project.pbxproj:
1500         * bindings/js/JSBindingsAllInOne.cpp:
1501         * bindings/js/JSDeviceMotionEventCustom.cpp: Removed.
1502         * bindings/js/JSDeviceOrientationEventCustom.cpp: Removed.
1503         Remove Custom bindings files.
1504
1505         * dom/DeviceMotionData.cpp:
1506         (WebCore::DeviceMotionData::create):
1507         (WebCore::DeviceMotionData::DeviceMotionData):
1508         (WebCore::DeviceMotionData::Acceleration::create): Deleted.
1509         (WebCore::DeviceMotionData::Acceleration::Acceleration): Deleted.
1510         (WebCore::DeviceMotionData::RotationRate::create): Deleted.
1511         (WebCore::DeviceMotionData::RotationRate::RotationRate): Deleted.
1512         * dom/DeviceMotionData.h:
1513         (WebCore::DeviceMotionData::Acceleration::create):
1514         (WebCore::DeviceMotionData::Acceleration::x):
1515         (WebCore::DeviceMotionData::Acceleration::y):
1516         (WebCore::DeviceMotionData::Acceleration::z):
1517         (WebCore::DeviceMotionData::Acceleration::Acceleration):
1518         (WebCore::DeviceMotionData::RotationRate::create):
1519         (WebCore::DeviceMotionData::RotationRate::alpha):
1520         (WebCore::DeviceMotionData::RotationRate::beta):
1521         (WebCore::DeviceMotionData::RotationRate::gamma):
1522         (WebCore::DeviceMotionData::RotationRate::RotationRate):
1523         (WebCore::DeviceMotionData::interval):
1524         (WebCore::DeviceMotionData::Acceleration::canProvideX): Deleted.
1525         (WebCore::DeviceMotionData::Acceleration::canProvideY): Deleted.
1526         (WebCore::DeviceMotionData::Acceleration::canProvideZ): Deleted.
1527         (WebCore::DeviceMotionData::RotationRate::canProvideAlpha): Deleted.
1528         (WebCore::DeviceMotionData::RotationRate::canProvideBeta): Deleted.
1529         (WebCore::DeviceMotionData::RotationRate::canProvideGamma): Deleted.
1530         (WebCore::DeviceMotionData::canProvideInterval): Deleted.
1531         Re-work using std::optional rather than an explicit bool/value pair.
1532
1533         * dom/DeviceMotionEvent.cpp:
1534         (WebCore::convert):
1535         (WebCore::DeviceMotionEvent::acceleration):
1536         (WebCore::DeviceMotionEvent::accelerationIncludingGravity):
1537         (WebCore::DeviceMotionEvent::rotationRate):
1538         (WebCore::DeviceMotionEvent::interval):
1539         (WebCore::DeviceMotionEvent::initDeviceMotionEvent):
1540         * dom/DeviceMotionEvent.h:
1541         Implement IDL interface. For now, we have duplicate structs for
1542         Acceleration and RotationRate (one here, one in DeviceMotionData)
1543         which can be consolidated in the future.
1544
1545         * dom/DeviceMotionEvent.idl:
1546         Add dictionaries for Acceleration and RotationRate, and update IDL to
1547         specify the correct nullability of attributes and arguments.
1548
1549         * dom/DeviceOrientationData.cpp:
1550         (WebCore::DeviceOrientationData::create):
1551         (WebCore::DeviceOrientationData::DeviceOrientationData):
1552         (WebCore::DeviceOrientationData::alpha): Deleted.
1553         (WebCore::DeviceOrientationData::beta): Deleted.
1554         (WebCore::DeviceOrientationData::gamma): Deleted.
1555         (WebCore::DeviceOrientationData::absolute): Deleted.
1556         (WebCore::DeviceOrientationData::canProvideAlpha): Deleted.
1557         (WebCore::DeviceOrientationData::canProvideBeta): Deleted.
1558         (WebCore::DeviceOrientationData::canProvideGamma): Deleted.
1559         (WebCore::DeviceOrientationData::compassHeading): Deleted.
1560         (WebCore::DeviceOrientationData::compassAccuracy): Deleted.
1561         (WebCore::DeviceOrientationData::canProvideCompassHeading): Deleted.
1562         (WebCore::DeviceOrientationData::canProvideCompassAccuracy): Deleted.
1563         (WebCore::DeviceOrientationData::canProvideAbsolute): Deleted.
1564         * dom/DeviceOrientationData.h:
1565         (WebCore::DeviceOrientationData::create):
1566         (WebCore::DeviceOrientationData::alpha):
1567         (WebCore::DeviceOrientationData::beta):
1568         (WebCore::DeviceOrientationData::gamma):
1569         (WebCore::DeviceOrientationData::compassHeading):
1570         (WebCore::DeviceOrientationData::compassAccuracy):
1571         (WebCore::DeviceOrientationData::absolute):
1572         Re-work using std::optional rather than an explicit bool/value pair.
1573
1574         * dom/DeviceOrientationEvent.cpp:
1575         (WebCore::DeviceOrientationEvent::alpha):
1576         (WebCore::DeviceOrientationEvent::beta):
1577         (WebCore::DeviceOrientationEvent::gamma):
1578         (WebCore::DeviceOrientationEvent::compassHeading):
1579         (WebCore::DeviceOrientationEvent::compassAccuracy):
1580         (WebCore::DeviceOrientationEvent::initDeviceOrientationEvent):
1581         (WebCore::DeviceOrientationEvent::absolute):
1582         * dom/DeviceOrientationEvent.h:
1583         Implement IDL interface.
1584
1585         * dom/DeviceOrientationEvent.idl:
1586         Update IDL to specify the correct nullability of attributes and arguments.
1587
1588         * platform/ios/DeviceMotionClientIOS.mm:
1589         (WebCore::DeviceMotionClientIOS::motionChanged):
1590         * platform/ios/DeviceOrientationClientIOS.mm:
1591         (WebCore::DeviceOrientationClientIOS::orientationChanged):
1592         Update for use of std:optional.
1593
1594 2017-01-13  Zan Dobersek  <zdobersek@igalia.com>
1595
1596         [GStreamer] Cache the accelerated capability of MediaPlayerClient in MediaPlayerPrivateGStreamerBase
1597         https://bugs.webkit.org/show_bug.cgi?id=167015
1598
1599         Reviewed by Jer Noble.
1600
1601         In MediaPlayerPrivateGStreamerBase, avoid continuously querying the MediaPlayerClient
1602         object about the accelerated compositing capabilities. Instead, cache this information
1603         when creating the video sink (which is most affected by this information anyway), storing
1604         it in a new protected boolean member variable in the MediaPlayerPrivateGStreamerBase class.
1605
1606         All calls to MediaPlayerClient::mediaPlayerRenderingCanBeAccelerated() and
1607         MediaPlayerClient::mediaPlayerAcceleratedCompositingEnabled() are replaced by tests
1608         on the value of this new member variable.
1609
1610         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1611         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
1612         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1613         (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize):
1614         (WebCore::MediaPlayerPrivateGStreamerBase::repaint):
1615         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
1616         (WebCore::MediaPlayerPrivateGStreamerBase::paint):
1617         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):
1618         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1619
1620 2017-01-13  Chris Dumez  <cdumez@apple.com>
1621
1622         Report post-page load CPU usage using diagnostic logging
1623         https://bugs.webkit.org/show_bug.cgi?id=166950
1624         <rdar://problem/30014496>
1625
1626         Reviewed by Alex Christensen.
1627
1628         Shortly after page load (5 seconds), we measure the WebContent process'
1629         CPU usage over 10 seconds and report the percentage back via release
1630         logging. We also log the percentage using diagnostic logging using the
1631         following buckets:
1632         - Below 10%
1633         - 10 to 20%
1634         - 20 to 40%
1635         - 60 to 80%
1636         - Over 80%
1637
1638         The logging works on both Mac and iOS. I verified that I get results
1639         consistent with Activity Monitor or top.
1640
1641         No new tests, no Web-facing behavior change, only extra logging.
1642
1643         * CMakeLists.txt:
1644         * WebCore.xcodeproj/project.pbxproj:
1645         * loader/FrameLoader.cpp:
1646         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
1647         * page/DiagnosticLoggingKeys.cpp:
1648         (WebCore::DiagnosticLoggingKeys::postPageLoadKey):
1649         (WebCore::DiagnosticLoggingKeys::cpuUsageKey):
1650         * page/DiagnosticLoggingKeys.h:
1651         * page/Page.cpp:
1652         (WebCore::Page::Page):
1653         (WebCore::Page::didFinishLoad):
1654         (WebCore::cpuUsageToDiagnosticLogginKey):
1655         (WebCore::Page::measurePostLoadCPUUsage):
1656         * page/Page.h:
1657         * page/Settings.cpp:
1658         (WebCore::Settings::isPostLoadCPUUsageMeasurementEnabled):
1659         * page/Settings.h:
1660         * platform/CPUTime.cpp: Added.
1661         (WebCore::getCPUTime):
1662         (WebCore::CPUTime::percentageCPUUsageSince):
1663         * platform/CPUTime.h: Added.
1664         * platform/cocoa/CPUTimeCocoa.mm: Added.
1665         (WebCore::timeValueToMicroseconds):
1666         (WebCore::getCPUTime):
1667
1668 2017-01-13  Michael Catanzaro  <mcatanzaro@igalia.com>
1669
1670         Unreviewed, rolling out r210677.
1671         https://bugs.webkit.org/show_bug.cgi?id=167007
1672
1673         Caused many layout test timeouts on GTK+ bots
1674
1675         Reverted changeset:
1676
1677         "Protect MediaPlayer from being destroyed mid-load()"
1678         https://bugs.webkit.org/show_bug.cgi?id=166976
1679         http://trac.webkit.org/changeset/210677
1680
1681 2017-01-13  Konstantin Tokarev  <annulen@yandex.ru>
1682
1683         Added preprocessor guard for iOS-specific piece of code in GraphicsContext3DOpenGL
1684         https://bugs.webkit.org/show_bug.cgi?id=167005
1685
1686         Reviewed by Alex Christensen.
1687
1688         Variable "boundFrameBuffer" is used only in iOS-specific code
1689
1690         No new tests needed.
1691
1692         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
1693         (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary):
1694
1695 2017-01-13  Eric Carlson  <eric.carlson@apple.com>
1696
1697         REGRESSION (r210621): [mac-wk2] LayoutTest fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html timing out
1698         https://bugs.webkit.org/show_bug.cgi?id=166980
1699
1700         Unreviewed, fix test broken by r210621.
1701
1702         No new tests, updated fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html
1703         and results.
1704
1705         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1706         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
1707           Drive-by fix: null-check parent.
1708         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): Do nothing if the layer
1709           has changed since the KVO notification.
1710
1711 2017-01-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1712
1713         [SOUP] Simplify cookie storage handling
1714         https://bugs.webkit.org/show_bug.cgi?id=166967
1715
1716         Reviewed by Sergio Villar Senin.
1717
1718         We currently have a global cookie storage, and several create() methods in SoupNetworkSession to create sessions
1719         with different cookie jars. This could be simplified by moving the cookie storage handling to
1720         NetworkStorageSession and removing all create() methods from SoupNetworkSession. This patch also removes the
1721         default SoupNetworkSession in favor of using the default NetworkStorageSession.
1722
1723         * platform/network/NetworkStorageSession.h: Add a default cookie storage to be used when the
1724         NetworkStorageSession doesn't have a platform soup session.
1725         * platform/network/soup/CookieJarSoup.cpp: Remove the global cookie storage handling.
1726         (WebCore::setCookiesFromDOM): Use NetworkStorageSession::cookieStorage() instead.
1727         (WebCore::cookiesForSession): Ditto.
1728         (WebCore::cookiesEnabled): Check the policy instead like all other ports do, since now we will always have a
1729         default shared cookie jar.
1730         (WebCore::getRawCookies): Use NetworkStorageSession::cookieStorage() instead.
1731         (WebCore::deleteCookie): Ditto.
1732         (WebCore::addCookie): Ditto.
1733         (WebCore::getHostnamesWithCookies): Ditto.
1734         (WebCore::deleteCookiesForHostnames): Ditto.
1735         (WebCore::deleteAllCookies): Ditto.
1736         * platform/network/soup/CookieJarSoup.h: Removed.
1737         * platform/network/soup/CookieStorageSoup.cpp:
1738         (WebCore::soupCookiesChanged): Use the cookie storage from the NetworkStorageSession::defaultStorageSession().
1739         (WebCore::startObservingCookieChanges): Ditto.
1740         (WebCore::stopObservingCookieChanges): Ditto.
1741         * platform/network/soup/DNSSoup.cpp:
1742         (WebCore::DNSResolveQueue::updateIsUsingProxy): Get the SoupSession from the NetworkStorageSession::defaultStorageSession().
1743         (WebCore::DNSResolveQueue::platformResolve): Ditto.
1744         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1745         (WebCore::NetworkStorageSession::NetworkStorageSession):
1746         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession): Create a new SoupNetworkSession without
1747         providing a cookie storage to ensure it creates its own private one.
1748         (WebCore::NetworkStorageSession::switchToNewTestingSession): Ditto.
1749         (WebCore::NetworkStorageSession::soupNetworkSession): Create the SoupNetworkSession on demand passing the global
1750         shared cookie storage.
1751         (WebCore::NetworkStorageSession::cookieStorage): Return the cookie storage from the SoupNetworkSession if we
1752         have one, otherwise create the global shared one and return it.
1753         * platform/network/soup/ResourceHandleSoup.cpp:
1754         (WebCore::sessionFromContext): Get the SoupSession from the NetworkStorageSession::defaultStorageSession().
1755         * platform/network/soup/SoupNetworkSession.cpp:
1756         (WebCore::SoupNetworkSession::SoupNetworkSession): Remove all create methods and the unused constructor that
1757         receives a SoupSession. Allow to pass a nullptr SoupCookieJar and create one in such case.
1758         * platform/network/soup/SoupNetworkSession.h:
1759
1760 2017-01-12  Tim Horton  <timothy_horton@apple.com>
1761
1762         Keyboard accessory bar can appear on top of full-screen video
1763         https://bugs.webkit.org/show_bug.cgi?id=166902
1764         <rdar://problem/29668223>
1765
1766         Reviewed by Darin Adler.
1767
1768         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1769         (WebVideoFullscreenInterfaceAVKit::setupFullscreen):
1770         Increase the full-screen video window level to one above the keyboard,
1771         to ensure that the video is never obscured by the keyboard or its
1772         accessory views.
1773
1774 2017-01-12  Joseph Pecoraro  <pecoraro@apple.com>
1775
1776         Remove unnecessary includes of Page.h
1777         https://bugs.webkit.org/show_bug.cgi?id=166996
1778
1779         Reviewed by Yusuke Suzuki.
1780
1781         * Modules/plugins/QuickTimePluginReplacement.mm:
1782         * Modules/plugins/YouTubePluginReplacement.cpp:
1783         * Modules/webdatabase/Database.cpp:
1784         * Modules/webdatabase/DatabaseTracker.cpp:
1785         * Modules/webdriver/NavigatorWebDriver.cpp:
1786         * accessibility/AccessibilityNodeObject.cpp:
1787         * dom/Range.cpp:
1788         * dom/ScriptElement.cpp:
1789         * dom/ViewportArguments.cpp:
1790         * html/HTMLBodyElement.cpp:
1791         * html/HTMLCanvasElement.cpp:
1792         * html/HTMLDocument.cpp:
1793         * html/HTMLFormControlElementWithState.cpp:
1794         * html/HTMLImageElement.cpp:
1795         * html/HTMLLinkElement.cpp:
1796         * html/PluginDocument.cpp:
1797         * inspector/InspectorApplicationCacheAgent.cpp:
1798         * loader/LoadTiming.cpp:
1799         * loader/cache/CachedImage.cpp:
1800         * loader/cache/CachedResource.cpp:
1801         * page/DeviceController.cpp:
1802         * page/TextIndicator.cpp:
1803         * page/efl/DragControllerEfl.cpp:
1804         * platform/audio/ios/AudioDestinationIOS.cpp:
1805         * platform/ios/PasteboardIOS.mm:
1806         * platform/ios/ScrollAnimatorIOS.mm:
1807         * platform/ios/WidgetIOS.mm:
1808         * platform/mac/PasteboardMac.mm:
1809         * platform/network/mac/ResourceHandleMac.mm:
1810         * platform/win/MainThreadSharedTimerWin.cpp:
1811         * platform/win/PasteboardWin.cpp:
1812         * platform/win/PlatformScreenWin.cpp:
1813         * platform/win/WidgetWin.cpp:
1814         * rendering/InlineBox.cpp:
1815         * rendering/RenderAttachment.cpp:
1816         * rendering/RenderBoxModelObject.cpp:
1817         * rendering/RenderIFrame.cpp:
1818         * rendering/RenderInline.cpp:
1819         * rendering/RenderReplaced.cpp:
1820         * rendering/RenderTextControlSingleLine.cpp:
1821         * rendering/RootInlineBox.cpp:
1822         * rendering/svg/RenderSVGResourceFilter.cpp:
1823         * rendering/svg/SVGRenderingContext.cpp:
1824         * style/StyleScope.cpp:
1825         * svg/SVGDocumentExtensions.cpp:
1826         * svg/graphics/SVGImageCache.cpp:
1827         * xml/XSLTProcessor.cpp:
1828         * xml/parser/XMLDocumentParserLibxml2.cpp:
1829
1830 2017-01-12  Chris Dumez  <cdumez@apple.com>
1831
1832         Add KEYBOARD_KEY_ATTRIBUTE / KEYBOARD_CODE_ATTRIBUTE to FeatureDefines.xcconfig
1833         https://bugs.webkit.org/show_bug.cgi?id=166995
1834
1835         Reviewed by Jer Noble.
1836
1837         Add KEYBOARD_KEY_ATTRIBUTE / KEYBOARD_CODE_ATTRIBUTE to FeatureDefines.xcconfig
1838         as some people are having trouble building without it.
1839
1840         * Configurations/FeatureDefines.xcconfig:
1841
1842 2017-01-12  Ryan Haddad  <ryanhaddad@apple.com>
1843
1844         Unreviewed, rolling out r210680.
1845
1846         This change caused LayoutTest timeouts and assertion failures.
1847
1848         Reverted changeset:
1849
1850         "Use GenericEventQueue rather than callOnMainThread to
1851         schedule events in AudioScheduledSourceNode."
1852         https://bugs.webkit.org/show_bug.cgi?id=166983
1853         http://trac.webkit.org/changeset/210680
1854
1855 2017-01-12  Chris Dumez  <cdumez@apple.com>
1856
1857         [iOS] HTML form validation popover sometimes does not go away
1858         https://bugs.webkit.org/show_bug.cgi?id=166990
1859         <rdar://problem/29985957>
1860
1861         Reviewed by Tim Horton.
1862
1863         The issue was that [UIViewController presentViewController:] is asynchronous
1864         and that we sometimes tried to call [m_popoverController dismissViewControllerAnimated:]
1865         before presentViewController had completed. This is something that UIKit does
1866         not handle nicely and the popover just stays visible even though we have
1867         asked for the controller to be dismissed and destroyed the ValidationBubble
1868         object.
1869
1870         To address the issue, I made ValidationBubble RefCounted and make sure the
1871         ValidationBubble object stays alive at least until the completion handler for
1872         [UIViewController presentViewController:] has been called. This is done via
1873         protecting the object using a RefPtr<> and capturing it in the lambda.
1874         Because dismissViewControllerAnimated is called in the destructor, it is no
1875         longer possible to call dismissViewControllerAnimated before the call to
1876         presentViewController has completed.
1877
1878         No new tests, no easily testable since the popover was staying visible
1879         after being destroyed (held on by UIKit).
1880
1881         * platform/ValidationBubble.h:
1882         (WebCore::ValidationBubble::create):
1883         * platform/ios/ValidationBubbleIOS.mm:
1884         (WebCore::ValidationBubble::show):
1885
1886 2017-01-12  Andreas Kling  <akling@apple.com>
1887
1888         [iOS] Purge GraphicsServices font cache on memory warning.
1889         <https://webkit.org/b/154343>
1890
1891         Reviewed by Antti Koivisto.
1892
1893         The GS font cache was retaining CSS fonts after we stopped using them.
1894         Call SPI to release them on memory pressure. This is one of multiple
1895         steps necessary to actually free the fonts.
1896
1897         * Configurations/WebCore.xcconfig:
1898         * page/cocoa/MemoryReleaseCocoa.mm:
1899         (WebCore::platformReleaseMemory):
1900         * platform/cocoa/MemoryPressureHandlerCocoa.mm:
1901         * platform/spi/ios/GraphicsServicesSPI.h:
1902
1903 2017-01-12  Chris Dumez  <cdumez@apple.com>
1904
1905         Unreviewed EFL/GTK build fix after r210684.
1906
1907         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1908         (WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor):
1909
1910 2017-01-12  Brady Eidson  <beidson@apple.com>
1911
1912         REGRESSION (r209977): Crash in UniqueIDBDatabase::executeNextDatabaseTask.
1913         https://bugs.webkit.org/show_bug.cgi?id=166984
1914
1915         Reviewed by Alex Christensen.
1916
1917         No new tests (Unable to reproduce, speculative fix).
1918
1919         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1920         (WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor): If we're not already prefetching for this cursor,
1921           starting doing so after holding a protector ref.
1922         (WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor): If we're now done prefetching for this cursor,
1923           schedule the protector ref to be destroyed on the main thread.
1924         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1925
1926 2017-01-12  Youenn Fablet  <youenn@apple.com>
1927
1928         Make ApplicationCacheHost::maybeLoadSynchronously more robust
1929         https://bugs.webkit.org/show_bug.cgi?id=165192
1930
1931         Reviewed by Alex Christensen.
1932
1933         No change of behavior.
1934         Currently, in case out parameter "data" is not null and shouldLoadResourceFromApplicationCache returns false and resource is null, we might dereference a null pointer when calling maybeLoadSynchronously.
1935         We refactor the code to ensure that this case cannot happen anymore.
1936
1937         * loader/appcache/ApplicationCacheHost.cpp:
1938         (WebCore::bufferFromResource):
1939         (WebCore::ApplicationCacheHost::maybeLoadSynchronously):
1940
1941 2017-01-12  Alex Christensen  <achristensen@webkit.org>
1942
1943         Update style of ResourceHandleInternal
1944         https://bugs.webkit.org/show_bug.cgi?id=166952
1945
1946         Reviewed by Andreas Kling.
1947
1948         No change in behavior.  Just un-indent and use initializer lists.
1949
1950         * platform/network/ResourceHandleInternal.h:
1951         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
1952         (WebCore::ResourceHandleInternal::client):
1953
1954 2017-01-12  Jer Noble  <jer.noble@apple.com>
1955
1956         Use GenericEventQueue rather than callOnMainThread to schedule events in AudioScheduledSourceNode.
1957         https://bugs.webkit.org/show_bug.cgi?id=166983
1958
1959         Reviewed by Brent Fulgham.
1960
1961         * Modules/webaudio/AudioScheduledSourceNode.cpp:
1962         (WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode):
1963         (WebCore::AudioScheduledSourceNode::finish):
1964         * Modules/webaudio/AudioScheduledSourceNode.h:
1965
1966 2017-01-12  Youenn Fablet  <youenn@apple.com>
1967
1968         OneDrive application crashes upon launch
1969         https://bugs.webkit.org/show_bug.cgi?id=166975
1970
1971         Reviewed by Brady Eidson.
1972
1973         Checking whether load is terminated just after calling ResourceLoader::willSendRequestInternal.
1974         The reason is that delegate call may actually cancel the load at that point.
1975
1976         * loader/SubresourceLoader.cpp:
1977         (WebCore::SubresourceLoader::willSendRequestInternal):
1978
1979 2017-01-12  Jer Noble  <jer.noble@apple.com>
1980
1981         Protect MediaPlayer from being destroyed mid-load()
1982         https://bugs.webkit.org/show_bug.cgi?id=166976
1983
1984         Reviewed by Eric Carlson.
1985
1986         It's possible for a message sent by MediaPlayer to HTMLMediaElement to cause
1987         MediaPlayer to be destroyed before MediaPlayer::load() completes. We have
1988         previously protected against this same problem in HTMLMediaElement::loadResource()
1989         by ref'ing at the beginning of the function and deref'ing on exit. To do the
1990         same in MediaPlayer, it must become RefCounted.
1991
1992         To keep the same semantics about m_client in MediaPlayer (always available without
1993         requiring a null-check), make a new static MediaPlayerClient object which can
1994         replace the real (HTMLMediaElement) client when the MediaPlayer is invalidated.
1995
1996         * html/HTMLMediaElement.cpp:
1997         (WebCore::HTMLMediaElement::~HTMLMediaElement):
1998         (WebCore::HTMLMediaElement::clearMediaPlayer):
1999         (WebCore::HTMLMediaElement::createMediaPlayer):
2000         * html/HTMLMediaElement.h:
2001         * platform/graphics/MediaPlayer.cpp:
2002         (WebCore::nullMediaPlayerClient):
2003         (WebCore::MediaPlayer::create):
2004         (WebCore::MediaPlayer::MediaPlayer):
2005         (WebCore::MediaPlayer::invalidate):
2006         (WebCore::MediaPlayer::load):
2007         (WebCore::MediaPlayer::loadWithNextMediaEngine):
2008         (WebCore::MediaPlayer::inMediaDocument):
2009         (WebCore::MediaPlayer::fullscreenMode):
2010         (WebCore::MediaPlayer::requestedRate):
2011         (WebCore::MediaPlayer::currentPlaybackTargetIsWirelessChanged):
2012         (WebCore::MediaPlayer::networkStateChanged):
2013         (WebCore::MediaPlayer::readyStateChanged):
2014         (WebCore::MediaPlayer::volumeChanged):
2015         (WebCore::MediaPlayer::muteChanged):
2016         (WebCore::MediaPlayer::timeChanged):
2017         (WebCore::MediaPlayer::sizeChanged):
2018         (WebCore::MediaPlayer::repaint):
2019         (WebCore::MediaPlayer::durationChanged):
2020         (WebCore::MediaPlayer::rateChanged):
2021         (WebCore::MediaPlayer::playbackStateChanged):
2022         (WebCore::MediaPlayer::firstVideoFrameAvailable):
2023         (WebCore::MediaPlayer::characteristicChanged):
2024         (WebCore::MediaPlayer::cachedKeyForKeyId):
2025         (WebCore::MediaPlayer::keyNeeded):
2026         (WebCore::MediaPlayer::mediaKeysStorageDirectory):
2027         (WebCore::MediaPlayer::referrer):
2028         (WebCore::MediaPlayer::userAgent):
2029         (WebCore::MediaPlayer::graphicsDeviceAdapter):
2030         (WebCore::MediaPlayer::cachedResourceLoader):
2031         (WebCore::MediaPlayer::createResourceLoader):
2032         (WebCore::MediaPlayer::addAudioTrack):
2033         (WebCore::MediaPlayer::removeAudioTrack):
2034         (WebCore::MediaPlayer::addTextTrack):
2035         (WebCore::MediaPlayer::removeTextTrack):
2036         (WebCore::MediaPlayer::addVideoTrack):
2037         (WebCore::MediaPlayer::removeVideoTrack):
2038         (WebCore::MediaPlayer::outOfBandTrackSources):
2039         (WebCore::MediaPlayer::shouldWaitForResponseToAuthenticationChallenge):
2040         (WebCore::MediaPlayer::handlePlaybackCommand):
2041         (WebCore::MediaPlayer::sourceApplicationIdentifier):
2042         (WebCore::MediaPlayer::preferredAudioCharacteristics):
2043         (WebCore::MediaPlayer::doesHaveAttribute):
2044         (WebCore::MediaPlayer::mediaPlayerNetworkInterfaceName):
2045         (WebCore::MediaPlayer::getRawCookies):
2046         (WebCore::MediaPlayer::shouldDisableSleep):
2047         * platform/graphics/MediaPlayer.h:
2048         (WebCore::MediaPlayer::platformVolumeConfigurationRequired):
2049         (WebCore::MediaPlayer::client):
2050
2051 2017-01-12  Sam Weinig  <sam@webkit.org>
2052
2053         Update bindings test results.
2054
2055         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
2056         (WebCore::JSTestCustomNamedGetter::getOwnPropertySlot):
2057         (WebCore::JSTestCustomNamedGetter::getOwnPropertySlotByIndex):
2058         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
2059         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2060         (WebCore::JSTestEventTarget::getOwnPropertySlot):
2061         (WebCore::JSTestEventTarget::getOwnPropertySlotByIndex):
2062         (WebCore::JSTestEventTarget::getOwnPropertyNames):
2063         * bindings/scripts/test/JS/JSTestEventTarget.h:
2064         * bindings/scripts/test/JS/JSTestInterface.cpp:
2065         (WebCore::JSTestInterface::put):
2066         (WebCore::JSTestInterface::putByIndex):
2067         * bindings/scripts/test/JS/JSTestInterface.h:
2068         * bindings/scripts/test/JS/JSTestObj.cpp:
2069         (WebCore::JSTestObj::getOwnPropertySlot):
2070         (WebCore::JSTestObj::getOwnPropertySlotByIndex):
2071         (WebCore::JSTestObj::getOwnPropertyNames):
2072         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2073         (WebCore::JSTestOverrideBuiltins::getOwnPropertySlot):
2074         (WebCore::JSTestOverrideBuiltins::getOwnPropertySlotByIndex):
2075         (WebCore::JSTestOverrideBuiltins::getOwnPropertyNames):
2076         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
2077
2078 2017-01-12  Zan Dobersek  <zdobersek@igalia.com>
2079
2080         [GTK] WebKitWebProcess at 100% CPU loading hyphenation dictionaries
2081         https://bugs.webkit.org/show_bug.cgi?id=165601
2082
2083         Reviewed by Carlos Garcia Campos.
2084
2085         In HyphenationLibHyphen, retrieve the canonicalized absolute pathname of the dictionary file
2086         in order to avoid storing symbolic links as the target files for specific locales. libhyphen
2087         distributes its dictionary files by linking a set of similar locales files to a single file.
2088         Not resolving those symbolic links means we'll be opening a single file via multiple
2089         HyphenationDictionary objects, which is far from optimal.
2090
2091         To add insult to injury, these HyphenationDictionary objects were stored in a TinyLRUCache
2092         with a slim capacity of 4. This meant that while already loading one single file through
2093         multiple symlinks, because of continuous eviciton from this LRU cache the same symlinks
2094         continued to be processed, in some cases resulting in opening the same dictionary file
2095         hundreds or thousands of times. The capacity of this TinyLRUCache is increased to 32
2096         to keep the amount of open libhyphen dictionaries capped at some reasonable number.
2097
2098         * platform/text/hyphen/HyphenationLibHyphen.cpp:
2099         (WebCore::scanDirectoryForDicionaries):
2100
2101 2017-01-12  Javier Fernandez  <jfernandez@igalia.com>
2102
2103         [css-grid] Make the grid sizing data persistent through layouts
2104         https://bugs.webkit.org/show_bug.cgi?id=166883
2105
2106         Reviewed by Darin Adler and Manuel Rego Casasnovas.
2107
2108         We want to keep the grid sizing data structures through different
2109         layouts. This will allow to optimize some operations, reusing
2110         these data while still valid. Additionally, operations like
2111         determining the baseline position when the grid container is under
2112         an inline formatting context need these data once the grid has
2113         been laid out.
2114
2115         This patch controls the sizing data validity and make the data
2116         structures persistent after layout.
2117
2118         Tests: fast/css-grid-layout/grid-add-item-with-positioned-items.html
2119                fast/css-grid-layout/grid-add-positioned-block-item-after-inline-item.html
2120                fast/css-grid-layout/grid-container-change-explicit-grid-recompute-child.html
2121                fast/css-grid-layout/grid-item-change-order-auto-flow.html
2122
2123         * rendering/RenderBox.cpp:
2124         (WebCore::RenderBox::styleDidChange): Evaluate if the style change made the grid data invalid.
2125         (WebCore::RenderBox::updateGridPositionAfterStyleChange): Evaluate if the style change made the grid data invalid.
2126         * rendering/RenderBox.h:
2127         * rendering/RenderGrid.cpp:
2128         (WebCore::RenderGrid::Grid::setNeedsItemsPlacement): The grid must execute the items placement logic before continue processing the layout.
2129         (WebCore::RenderGrid::addChild): Mark the grid data as dirty.
2130         (WebCore::RenderGrid::removeChild): Mark the grid data as dirty.
2131         (WebCore::RenderGrid::styleDidChange): Evaluate grid data validity.
2132         (WebCore::RenderGrid::explicitGridDidResize): Mark the grid data as dirty.
2133         (WebCore::RenderGrid::namedGridLinesDefinitionDidChange): Mark the grid data as dirty.
2134         (WebCore::RenderGrid::layoutBlock): We don't need to clear the grid data anymore.
2135         (WebCore::RenderGrid::dirtyGrid): Clearing the grid data and mark is as needing to execute the items placement logic.
2136         (WebCore::RenderGrid::trackSizesForComputedStyle): Assert we don't need to perform the items placement logic.
2137         (WebCore::RenderGrid::paintChildren): Assert we don't need to perform the items placement logic.
2138         * rendering/RenderGrid.h:
2139         (WebCore::RenderGrid::clear): Deleted.
2140
2141 2017-01-12  Chris Dumez  <cdumez@apple.com>
2142
2143         [iOS] Implement support for KeyboardEvent.code
2144         https://bugs.webkit.org/show_bug.cgi?id=166932
2145         <rdar://problem/29972518>
2146
2147         Reviewed by Darin Adler.
2148
2149         Implement support for KeyboardEvent.code on iOS.
2150
2151         No new tests, updated existing test.
2152
2153         * platform/ios/PlatformEventFactoryIOS.h:
2154         * platform/ios/PlatformEventFactoryIOS.mm:
2155         (WebCore::codeForKeyEvent):
2156         (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
2157
2158 2017-01-12  Sam Weinig  <sam@webkit.org>
2159
2160         [WebIDL] Autogenerate named getters
2161         https://bugs.webkit.org/show_bug.cgi?id=166835
2162
2163         Reviewed by Alex Christensen.
2164
2165         * Modules/mediastream/RTCStatsResponse.idl:
2166         Update type to be nullable, since generator expects that for now.
2167
2168         * WebCore.xcodeproj/project.pbxproj:
2169         * bindings/js/JSCustomSQLStatementErrorCallback.cpp: Removed.
2170         * bindings/js/JSDOMMimeTypeArrayCustom.cpp: Removed.
2171         * bindings/js/JSDOMNamedFlowCollectionCustom.cpp: Removed.
2172         * bindings/js/JSDOMPluginArrayCustom.cpp: Removed.
2173         * bindings/js/JSDOMPluginCustom.cpp: Removed.
2174         * bindings/js/JSNamedNodeMapCustom.cpp: Removed.
2175         * bindings/js/JSRTCStatsResponseCustom.cpp: Removed.
2176         * bindings/js/JSStyleSheetListCustom.cpp: Removed.
2177         Remove deleted files.
2178
2179         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp: 
2180         Renamed from Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp for consistency.
2181
2182         * bindings/IDLTypes.h:
2183         (WebCore::IDLNullable::nullValue):
2184         (WebCore::IDLNullable::isNullValue):
2185         (WebCore::IDLNullable::extractValueFromNullable):
2186         Add Nullable traits for IDLNullable, that call down to the underlying type. This allows
2187         us to more easily tests for nullability without stripping the IDLNullable off.
2188
2189         * bindings/js/JSDOMStringMapCustom.cpp:
2190         (WebCore::JSDOMStringMap::getOwnPropertySlotDelegate): Deleted.
2191         (WebCore::JSDOMStringMap::getOwnPropertyNames): Deleted.
2192         Remove overriden getOwnPropertySlot and getOwnPropertyNames.
2193
2194         * bindings/js/JSHTMLCollectionCustom.cpp:
2195         (WebCore::JSHTMLCollection::nameGetter): Deleted.
2196         * bindings/js/JSHTMLFormElementCustom.cpp:
2197         (WebCore::JSHTMLFormElement::nameGetter): Deleted.
2198         * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
2199         (WebCore::JSHTMLOptionsCollection::nameGetter): Deleted.
2200         * bindings/js/JSStorageCustom.cpp:
2201         (WebCore::JSStorage::nameGetter): Deleted.
2202         Remove custom name getters.
2203
2204         * bindings/js/JSHTMLSelectElementCustom.cpp:
2205         (WebCore::selectElementIndexSetter):
2206         * html/HTMLSelectElement.cpp:
2207         (WebCore::HTMLSelectElement::setItem):
2208         (WebCore::HTMLSelectElement::setLength):
2209         (WebCore::HTMLSelectElement::setOption): Deleted.
2210         * html/HTMLSelectElement.h:
2211         Add implementation of HTMLSelectElement::setItem() that does properly
2212         removes if the option is null. Re-implement selectElementIndexSetter to
2213         use it and switch conversion code to use JSDOMConvert.
2214
2215         * bindings/scripts/CodeGeneratorJS.pm:
2216         (GenerateIndexedGetter):
2217         (GenerateNamedGetter):
2218         Extract typed getter generation into their own functions.
2219
2220         (GenerateGetOwnPropertySlotBody):
2221         (GenerateGetOwnPropertySlotBodyByIndex):
2222         Extract getOwnPropertySlotBody / getOwnPropertySlotBodyByIndex generation
2223         into their own functions. Add support for generating name getters.
2224
2225         (GenerateGetOwnPropertyNames):
2226         Extract getOwnPropertyNames generation into its own function, adding support
2227         for respecting the LegacyUnenumerableNamedProperties attribute and switching
2228         the default to not include named properties in the enumerated names.
2229
2230         (GeneratePut):
2231         (GeneratePutByIndex):
2232         Extract put / putByIndex generators into their own functions in preparation
2233         of supporting namedSetters in the future.
2234
2235         (GetIndexedSetterFunction):
2236         (GetNamedSetterFunction):
2237         (GetNamedDeleterFunction):
2238         Add helper getter functions to extract named/index setter/deleters.
2239
2240         (InstanceOverridesPut):
2241         Add helper predicate to determine if an interface needs an implementation
2242         of put.
2243
2244         (GenerateHeader):
2245         Place custom helper functions (e.g. nameGetter/putDelegate/etc.) together
2246         in the generated header.
2247
2248         (GenerateImplementation):
2249         (GenerateCallbackImplementationContent):
2250         Replace inline generation with calls to the new helper generator functions.
2251
2252         (NativeToJSValueUsingReferences):
2253         (NativeToJSValueUsingPointers):
2254         (NativeToJSValue):
2255         Remove unused inFunctionCall parameter, and add new suppressExceptionCheck
2256         parameter, which is used for nameGetters.
2257
2258         * bindings/scripts/IDLAttributes.txt:
2259         Add LegacyUnenumerableNamedProperties.
2260     
2261         * css/StyleSheetList.cpp:
2262         (WebCore::StyleSheetList::namedItem):
2263         (WebCore::StyleSheetList::getNamedItem): Deleted.
2264         * css/StyleSheetList.h:
2265         * css/StyleSheetList.idl:
2266         Rename getNamedItem to namedItem, and make it return a CSSStyleSheet*
2267         which is what the bindings specify.
2268
2269         * dom/DOMNamedFlowCollection.idl:
2270         Add LegacyUnenumerableNamedProperties to match existing behavior.
2271
2272         * dom/DOMStringMap.h:
2273         Switch from typedef to type alias.
2274
2275         * dom/DOMStringMap.idl:
2276         Remove CustomEnumerateProperty and JSCustomGetOwnPropertySlotAndDescriptor
2277         and add the getter. Also add the missing setter and deleter commented out.
2278
2279         * dom/DatasetDOMStringMap.h:
2280         * dom/DatasetDOMStringMap.cpp:
2281         (WebCore::DatasetDOMStringMap::supportedPropertyNames):
2282         (WebCore::DatasetDOMStringMap::names): Deleted.
2283         Rename names to supportedPropertyNames to support the bindings.
2284
2285         (WebCore::DatasetDOMStringMap::item):
2286         (WebCore::DatasetDOMStringMap::namedItem):
2287         Add namedItems (to support the bindings), and rework item to return
2288         an optional rather than using a bool out parameter.
2289
2290         * dom/NamedNodeMap.idl:
2291         Add LegacyUnenumerableNamedProperties matching the spec.
2292
2293         * html/HTMLAllCollection.idl:
2294         Add CustomNamedGetter and LegacyUnenumerableNamedProperties. Update signatures
2295         to match the spec. Commenting out ones not implemented yet.
2296
2297         * html/HTMLCollection.idl:
2298         Add LegacyUnenumerableNamedProperties matching the spec.
2299
2300         * html/HTMLFormControlsCollection.idl:
2301         Add CustomNamedGetter. Update signature of the getter to match the spec.
2302         The reason this can't be generated yet is that we don't have a good strategy
2303         for functions with differing return types that shadow each other.
2304
2305         * html/HTMLFormElement.h:
2306         * html/HTMLFormElement.cpp:
2307         (WebCore::HTMLFormElement::namedItem):
2308         (WebCore::HTMLFormElement::supportedPropertyNames):
2309         Add implementation of namedItem and stub of supportedPropertyNames.
2310
2311         * html/HTMLFormElement.idl:
2312         Add LegacyUnenumerableNamedProperties and remove CustomNamedGetter. Update
2313         the signatures to match the spec.
2314
2315         * page/DOMWindow.idl:
2316         Add LegacyUnenumerableNamedProperties matching the spec.
2317
2318         * plugins/DOMMimeTypeArray.idl:
2319         * plugins/DOMPlugin.idl:
2320         * plugins/DOMPluginArray.idl:
2321         Add LegacyUnenumerableNamedProperties and add nullability to return types.
2322
2323 2017-01-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
2324
2325         [iOS][WK1] Fix initialization of CADisplayLink::preferredFramesPerSecond
2326         https://bugs.webkit.org/show_bug.cgi?id=166956
2327
2328         Reviewed by Tim Horton.
2329         
2330         Set this option to 60fps instead of leaving set to the default.
2331
2332         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
2333         (-[WebDisplayLinkHandler initWithMonitor:]):
2334
2335 2017-01-12  Yusuke Suzuki  <utatane.tea@gmail.com>
2336
2337         Unreviewed, build fix for macOS ports
2338         https://bugs.webkit.org/show_bug.cgi?id=166925
2339
2340         * WebCore.xcodeproj/project.pbxproj:
2341
2342 2017-01-12  Yusuke Suzuki  <utatane.tea@gmail.com>
2343
2344         Implement InlineClassicScript
2345         https://bugs.webkit.org/show_bug.cgi?id=166925
2346
2347         Reviewed by Ryosuke Niwa.
2348
2349         As of r210585, ScriptFetcher functionality is decoupled from ScriptElement.
2350         This patch is a further cleanup. We introduce InlineClassicScript, which is
2351         similar to LoadableClassicScript / LoadableModuleScript. And we move ScriptFetcher
2352         functionality from LoadableScript to CachedScriptFetcher, which is the base
2353         class of InlineClassicScript and LoadableScript.
2354
2355         And we start setting this CachedScriptFetcher to the member of JSC::SourceOrigin.
2356         This allows us to examine the ScriptFetcher from the SourceOrigin.
2357         When dynamic-import operator is called, we need to get the ScriptFetcher from the
2358         caller script SourceOrigin since the subsequent module loading needs to know the
2359         metadata about fetching and ScriptFetcher delivers it.
2360
2361         No behavior change.
2362
2363         * CMakeLists.txt:
2364         * bindings/js/CachedModuleScript.cpp:
2365         (WebCore::CachedModuleScript::load):
2366         * bindings/js/CachedModuleScript.h:
2367         * bindings/js/CachedModuleScriptLoader.cpp:
2368         (WebCore::CachedModuleScriptLoader::create):
2369         (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader):
2370         (WebCore::CachedModuleScriptLoader::load):
2371         * bindings/js/CachedModuleScriptLoader.h:
2372         * bindings/js/CachedScriptFetcher.cpp: Copied from Source/WebCore/dom/LoadableScript.cpp.
2373         (WebCore::CachedScriptFetcher::requestScriptWithCache):
2374         * bindings/js/CachedScriptFetcher.h: Copied from Source/JavaScriptCore/runtime/SourceOrigin.h.
2375         (WebCore::CachedScriptFetcher::CachedScriptFetcher):
2376         * bindings/js/CachedScriptSourceProvider.h:
2377         (WebCore::CachedScriptSourceProvider::create):
2378         (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
2379         (WebCore::makeSource): Deleted.
2380         * bindings/js/ScriptController.cpp:
2381         (WebCore::ScriptController::loadModuleScriptInWorld):
2382         (WebCore::ScriptController::loadModuleScript):
2383         * bindings/js/ScriptController.h:
2384         * bindings/js/ScriptModuleLoader.cpp:
2385         (WebCore::ScriptModuleLoader::fetch):
2386         (WebCore::ScriptModuleLoader::notifyFinished):
2387         * bindings/js/ScriptSourceCode.h:
2388         (WebCore::ScriptSourceCode::ScriptSourceCode):
2389         (WebCore::ScriptSourceCode::m_url):
2390         * dom/InlineClassicScript.cpp: Added.
2391         (WebCore::InlineClassicScript::create):
2392         * dom/InlineClassicScript.h: Added.
2393         * dom/LoadableClassicScript.cpp:
2394         (WebCore::LoadableClassicScript::execute):
2395         * dom/LoadableScript.cpp:
2396         (WebCore::LoadableScript::requestScriptWithCache): Deleted.
2397         * dom/LoadableScript.h:
2398         (WebCore::LoadableScript::LoadableScript):
2399         (): Deleted.
2400         * dom/ScriptElement.cpp:
2401         (WebCore::ScriptElement::prepareScript):
2402         (WebCore::ScriptElement::requestModuleScript):
2403         (WebCore::ScriptElement::executePendingScript):
2404         * html/parser/HTMLScriptRunner.cpp:
2405         (WebCore::HTMLScriptRunner::runScript):
2406         * xml/parser/XMLDocumentParserLibxml2.cpp:
2407         (WebCore::XMLDocumentParser::endElementNs):
2408
2409 2017-01-11  Eric Carlson  <eric.carlson@apple.com>
2410
2411         [MediaStream, Mac] Render media stream audio buffers
2412         https://bugs.webkit.org/show_bug.cgi?id=159836
2413         <rdar://problem/27380390>
2414
2415         Reviewed by Jer Noble.
2416
2417         No new tests, it isn't possible to test audio rendering directly. A follow-up patch will
2418         add a mock audio source that will enable audio testing.
2419
2420         * platform/cf/CoreMediaSoftLink.cpp: Include new functions used.
2421         * platform/cf/CoreMediaSoftLink.h:
2422
2423         * WebCore.xcodeproj/project.pbxproj: Remove references to the deleted previews.
2424
2425         * platform/Logging.h: Add MediaCaptureSamples.
2426
2427         * platform/MediaSample.h: Add outputPresentationTime and outputDuration.
2428
2429         * platform/cf/CoreMediaSoftLink.cpp: Add CMSampleBufferGetOutputDuration, CMSampleBufferGetOutputPresentationTimeStamp,
2430         CMTimeConvertScale, CMTimebaseGetEffectiveRate, CMAudioSampleBufferCreateWithPacketDescriptions, 
2431         CMSampleBufferSetDataBufferFromAudioBufferList, CMSampleBufferSetDataReady, 
2432         CMAudioFormatDescriptionCreate, CMClockGetHostTimeClock, and CMClockGetTime.
2433         * platform/cf/CoreMediaSoftLink.h:
2434
2435         Create and use an AVSampleBufferAudioRenderer each audio stream track, when it is available,
2436         to render for audio samples. Store the offset between the first sample received from a track's
2437         output presentation and the synchronizer time so we can adjust sample timestamps to be 
2438         relative to the synchronizer's timeline regardless of their source. Remove the use of source
2439         previews because not all sources will have them.
2440
2441         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
2442         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2443         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2444         
2445         Add an ObjC helper to catch renderer status changes.
2446         (-[WebAVSampleBufferStatusChangeListener initWithParent:]): 
2447         (-[WebAVSampleBufferStatusChangeListener dealloc]):
2448         (-[WebAVSampleBufferStatusChangeListener invalidate]):
2449         (-[WebAVSampleBufferStatusChangeListener beginObservingLayer:]):
2450         (-[WebAVSampleBufferStatusChangeListener stopObservingLayer:]):
2451         (-[WebAVSampleBufferStatusChangeListener beginObservingRenderer:]):
2452         (-[WebAVSampleBufferStatusChangeListener stopObservingRenderer:]):
2453         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
2454         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
2455         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC):
2456         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::removeOldSamplesFromPendingQueue):
2457         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::addSampleToPendingQueue):
2458         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes):
2459         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSample):
2460         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
2461         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData):
2462         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForAudioData):
2463         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::createAudioRenderer):
2464         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyAudioRenderer):
2465         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyAudioRenderers):
2466         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSourceProvider):
2467         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rendererStatusDidChange):
2468         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange):
2469         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::flushRenderers):
2470         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer):
2471         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer):
2472         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer):
2473         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode):
2474         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play):
2475         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSampleBufferFromTrack): Deleted.
2476         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForMediaData): Deleted.
2477         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBuffer): Deleted.
2478         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareVideoSampleBufferFromTrack): Deleted.
2479         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::internalSetVolume): Deleted.
2480
2481         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
2482         (WebCore::MediaSampleAVFObjC::outputPresentationTime): New.
2483         (WebCore::MediaSampleAVFObjC::outputDuration): New.
2484         (WebCore::MediaSampleAVFObjC::dump): Log outputPresentationTime.
2485
2486         * platform/mediastream/AudioTrackPrivateMediaStream.h: Add timelineOffset.
2487
2488         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2489         (WebCore::MediaStreamTrackPrivate::setEnabled): No more m_preview.
2490         (WebCore::MediaStreamTrackPrivate::endTrack): Ditto.
2491         (WebCore::MediaStreamTrackPrivate::preview): Deleted.
2492         * platform/mediastream/MediaStreamTrackPrivate.h:
2493
2494         * platform/mediastream/RealtimeMediaSource.h:
2495         (WebCore::RealtimeMediaSource::preview): Deleted.
2496
2497         * platform/mediastream/RealtimeMediaSourcePreview.h: Removed.
2498
2499         * platform/mediastream/VideoTrackPrivateMediaStream.h: Add timelineOffset.
2500
2501         * platform/mediastream/mac/AVAudioCaptureSource.h:
2502         * platform/mediastream/mac/AVAudioCaptureSource.mm:
2503         (WebCore::AVAudioCaptureSource::updateSettings):
2504         (WebCore::AVAudioCaptureSource::captureOutputDidOutputSampleBufferFromConnection): Pass the
2505         sample buffer up the chain.
2506         (WebCore::AVAudioSourcePreview::create): Deleted.
2507         (WebCore::AVAudioSourcePreview::AVAudioSourcePreview): Deleted.
2508         (WebCore::AVAudioSourcePreview::invalidate): Deleted.
2509         (WebCore::AVAudioSourcePreview::play): Deleted.
2510         (WebCore::AVAudioSourcePreview::pause): Deleted.
2511         (WebCore::AVAudioSourcePreview::setEnabled): Deleted.
2512         (WebCore::AVAudioSourcePreview::setVolume): Deleted.
2513         (WebCore::AVAudioSourcePreview::updateState): Deleted.
2514         (WebCore::AVAudioCaptureSource::createPreview): Deleted.
2515
2516         * platform/mediastream/mac/AVMediaCaptureSource.h:
2517         (WebCore::AVMediaSourcePreview): Deleted.
2518         (WebCore::AVMediaCaptureSource::createWeakPtr): Deleted.
2519
2520         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2521         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource): No more preview.
2522         (WebCore::AVMediaCaptureSource::reset):
2523         (WebCore::AVMediaCaptureSource::preview): Deleted.
2524         (WebCore::AVMediaCaptureSource::removePreview): Deleted.
2525         (WebCore::AVMediaSourcePreview::AVMediaSourcePreview): Deleted.
2526         (WebCore::AVMediaSourcePreview::~AVMediaSourcePreview): Deleted.
2527         (WebCore::AVMediaSourcePreview::invalidate): Deleted.
2528
2529         * platform/mediastream/mac/AVVideoCaptureSource.h:
2530         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2531         (WebCore::AVVideoCaptureSource::processNewFrame): Don't set the "display immediately" attachment.
2532         (WebCore::AVVideoSourcePreview::create): Deleted.
2533         (WebCore::AVVideoSourcePreview::AVVideoSourcePreview): Deleted.
2534         (WebCore::AVVideoSourcePreview::backgroundLayerBoundsChanged): Deleted.
2535         (WebCore::AVVideoSourcePreview::invalidate): Deleted.
2536         (WebCore::AVVideoSourcePreview::play): Deleted.
2537         (WebCore::AVVideoSourcePreview::pause): Deleted.
2538         (WebCore::AVVideoSourcePreview::setPaused): Deleted.
2539         (WebCore::AVVideoSourcePreview::setEnabled): Deleted.
2540         (WebCore::AVVideoCaptureSource::createPreview): Deleted.
2541         (-[WebCoreAVVideoCaptureSourceObserver setParent:]): Deleted.
2542         (-[WebCoreAVVideoCaptureSourceObserver observeValueForKeyPath:ofObject:change:context:]): Deleted.
2543
2544         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2545         (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer): Use a more typical video
2546         time scale. Set the sample decode time.
2547         (WebCore::MockRealtimeVideoSourceMac::pixelBufferFromCGImage): Use a static for colorspace
2548         instead of fetching it for every frame.
2549
2550         * platform/mock/mediasource/MockSourceBufferPrivate.cpp: Add outputPresentationTime and outputDuration.
2551
2552 2017-01-11  Youenn Fablet  <youenn@apple.com>
2553
2554         Remove request.formData property until it gets implemented
2555         https://bugs.webkit.org/show_bug.cgi?id=166920
2556         <rdar://problem/29971105>
2557
2558         Reviewed by Chris Dumez.
2559
2560         Covered by rebased tests.
2561
2562         * Modules/fetch/FetchBody.idl:
2563
2564 2017-01-11  Ryan Haddad  <ryanhaddad@apple.com>
2565
2566         Reverting r210598, r210597, and r210591 to fix the iOS simulator build.
2567         https://bugs.webkit.org/show_bug.cgi?id=166672
2568
2569         Unreviewed build fix.
2570
2571         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2572         (WebCore::preparePlatformFont):
2573         (WebCore::fontIsSystemFont): Deleted.
2574
2575 2017-01-11  Andreas Kling  <akling@apple.com>
2576
2577         Crash when WebCore's GC heap grows way too large.
2578         <https://webkit.org/b/166875>
2579         <rdar://problem/27896585>
2580
2581         Reviewed by Mark Lam.
2582
2583         Cap the common WebCore VM at 4 GB of live JavaScript heap objects.
2584
2585         * bindings/js/CommonVM.cpp:
2586         (WebCore::commonVMSlow):
2587
2588 2017-01-11  Nan Wang  <n_wang@apple.com>
2589
2590         AX: role=treeitem accessible name not spoken to VoiceOver macOS when using string contained inside element
2591         https://bugs.webkit.org/show_bug.cgi?id=164950
2592         <rdar://problem/29337573>
2593
2594         Reviewed by Chris Fleizach.
2595
2596         From the spec: https://www.w3.org/TR/wai-aria-practices/#TreeView
2597         The element with role treeitem missing a label is labeled by its child elements.
2598
2599         Test: accessibility/mac/aria-tree-item-name.html
2600
2601         * accessibility/AccessibilityNodeObject.cpp:
2602         (WebCore::AccessibilityNodeObject::alternativeText):
2603
2604 2017-01-11  Brent Fulgham  <bfulgham@apple.com>
2605
2606         [GTK] Unreviewed build fix after r210600.
2607
2608         * platform/glib/FileSystemGlib.cpp:
2609         (WebCore::getFileDeviceId): Attempting to use proper API here.
2610
2611 2017-01-11  Brent Fulgham  <bfulgham@apple.com>
2612
2613         [GTK] Unreviewed build fix after r210599.
2614
2615         * platform/glib/FileSystemGlib.cpp:
2616         (WebCore::getFileDeviceId): Revise for new signature.
2617
2618 2017-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
2619
2620         ASSERTION FAILED: run->m_stop > 0 in *WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment
2621         https://bugs.webkit.org/show_bug.cgi?id=166030
2622
2623         Reviewed by Ryosuke Niwa.
2624
2625         Ordinarily, we don't process empty BiDi runs (because we filter them out).
2626         However, when using isolates, we invoke extra machinery to create a
2627         placeholder BiDi run, and replace it with the runs for the isolate. The
2628         isolate's runs, though, can be empty, and rather than just deleting the
2629         placeholder run, we will keep it around so that the m_logicallyLastRun is
2630         still valid. This means that it is possible when all is said and done to
2631         have empty runs, and computeInlineDirectionPositionsForSegment() needs to
2632         not ASSERT() in this case.
2633
2634         Test: fast/text/bidi-isolate-empty-run.html
2635
2636         * rendering/RenderBlockLineLayout.cpp:
2637         (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
2638
2639 2017-01-11  Brent Fulgham  <bfulgham@apple.com>
2640
2641         File scheme should not allow access of a resource on a different volume.
2642         https://bugs.webkit.org/show_bug.cgi?id=158552
2643         <rdar://problem/15307582>
2644
2645         Reviewed by Alex Christensen.
2646
2647         Revise SecurityOrigin to prevent files from one storage device (volume) from accessing content
2648         on a different storage device (volume) unless universal access is enabled.
2649
2650         Pass the current file device as part of the NSURLRequest so that CFNetwork can reject loads
2651         where the device changes in the midst of a load.
2652
2653         Also properly reflect that SecurityOrigin is never null by passing as a reference,
2654         rather than as a pointer.
2655
2656         Tests: Tools/TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm
2657
2658         * page/SecurityOrigin.cpp:
2659         (WebCore::SecurityOrigin::canAccess): Pass argument as reference.
2660         (WebCore::SecurityOrigin::canDisplay): Add check that files share the same volume.
2661         (WebCore::SecurityOrigin::isSameSchemeHostPort): Pass argument as reference.
2662         * page/SecurityOrigin.h:
2663         * platform/FileSystem.cpp:
2664         (WebCore::filesHaveSameVolume): Added.
2665         * platform/FileSystem.h:
2666         * platform/network/cocoa/ResourceRequestCocoa.mm:
2667         (WebCore::ResourceRequest::doUpdatePlatformRequest): If loading a file URL, tell CFNetwork
2668         the storage device at the time of the start of the load so we can trigger a failure if this
2669         changes during the load operation.
2670         * platform/posix/FileSystemPOSIX.cpp:
2671         (WebCore::getFileDeviceId): Added.
2672         * platform/win/FileSystemWin.cpp:
2673         (WebCore::getFileDeviceId): Added.
2674
2675 2017-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
2676
2677         [Cocoa] Testing fix after r210597
2678         https://bugs.webkit.org/show_bug.cgi?id=166672
2679
2680         Unreviewed.
2681
2682         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2683         (WebCore::preparePlatformFont):
2684
2685 2017-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
2686
2687         [Cocoa] Testing fix after r210591
2688         https://bugs.webkit.org/show_bug.cgi?id=166672
2689
2690         Unreviewed.
2691
2692         Fixes fast/text/trak-optimizeLegibility.html and
2693         fast/text/system-font-features.html
2694
2695         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2696         (WebCore::fontIsSystemFont):
2697         (WebCore::preparePlatformFont):
2698
2699 2017-01-11  Chris Dumez  <cdumez@apple.com>
2700
2701         Iterating over URLSearchParams does not work
2702         https://bugs.webkit.org/show_bug.cgi?id=166921
2703         <rdar://problem/29970907>
2704
2705         Reviewed by Alex Christensen.
2706
2707         Make URLSearchParams iterable, as per:
2708         - https://url.spec.whatwg.org/#urlsearchparams
2709
2710         Test: fast/dom/DOMURL/searchparams-iterable.html
2711
2712         * html/URLSearchParams.cpp:
2713         (WebCore::URLSearchParams::Iterator::next):
2714         (WebCore::URLSearchParams::Iterator::Iterator):
2715         * html/URLSearchParams.h:
2716         (WebCore::URLSearchParams::createIterator):
2717         * html/URLSearchParams.idl:
2718
2719 2017-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
2720
2721         [Cocoa] Variation fonts without variations specified are not rendered as if the default variations were specified
2722         https://bugs.webkit.org/show_bug.cgi?id=166672
2723         <rdar://problem/29779119>
2724         <rdar://problem/29848883>
2725
2726         Reviewed by Simon Fraser.
2727
2728         CoreText has a bug (<rdar://problem/29859207>) where variation fonts without
2729         a specified variation value are rendered as if the minimum value is specified,
2730         rather than the default value. The solution is to apply default values where
2731         they are omitted.
2732
2733         Test: fast/text/variations/advances.html
2734
2735         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2736         (WebCore::preparePlatformFont):
2737
2738 2017-01-11  Ryan Haddad  <ryanhaddad@apple.com>
2739
2740         Attempt to fix the Windows build after r210588.
2741
2742         Unreviewed build fix.
2743
2744         * bindings/js/JSBindingsAllInOne.cpp:
2745
2746 2017-01-11  Sam Weinig  <sam@webkit.org>
2747
2748         Address some feedback from r210567.
2749
2750         * bindings/scripts/CodeGeneratorJS.pm:
2751         (NativeToJSValueDOMConvertNeedsState):
2752         (NativeToJSValueDOMConvertNeedsGlobalObject):
2753         Fix typo. robost -> robust.
2754
2755 2017-01-10  Sam Weinig  <sam@webkit.org>
2756
2757         Rename JSCustomSQLStatementErrorCallback.cpp to JSSQLStatementErrorCallbackCustom.cpp
2758         https://bugs.webkit.org/show_bug.cgi?id=166913
2759
2760         Reviewed by Alex Christensen.
2761
2762         * CMakeLists.txt:
2763         * WebCore.xcodeproj/project.pbxproj:
2764         * bindings/js/JSCustomSQLStatementErrorCallback.cpp: Removed.
2765         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp: Copied from Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp.
2766         Rename to match conventions.
2767
2768 2017-01-11  Ryan Haddad  <ryanhaddad@apple.com>
2769
2770         Unreviewed, rolling out r210571.
2771
2772         This change broke the 32-bit macOS build and caused LayoutTest
2773         failures.
2774
2775         Reverted changeset:
2776
2777         "File scheme should not allow access of a resource on a
2778         different volume."
2779         https://bugs.webkit.org/show_bug.cgi?id=158552
2780         http://trac.webkit.org/changeset/210571
2781
2782 2017-01-11  Yusuke Suzuki  <utatane.tea@gmail.com>
2783
2784         Decouple module loading initiator from ScriptElement
2785         https://bugs.webkit.org/show_bug.cgi?id=166888
2786
2787         Reviewed by Saam Barati and Ryosuke Niwa.
2788
2789         Previously, we use ScriptElement (JSElement for ScriptElement) as the module loading initiator.
2790         This element is used to transfer the metadata like charset throughout the module pipeline.
2791         As a result, our module loader in the browser side is tightly coupled with ScriptElement.
2792         It is not good since it prevent us from using the module loader in the non-DOM environment like
2793         Web Workers.
2794
2795         So we decouple the necessary informations from ScriptElement. We move these information to
2796         LoadableScript. And we use JSScriptFetcher to transfer LoadableScript through the JS implemented
2797         module loader pipeline. We select LoadableScript instead of LoadableModuleScript since this initiator
2798         information will be leveraged even in classic scripts once we implement the dynamic import.
2799
2800         No behavior change.
2801
2802         * ForwardingHeaders/runtime/JSScriptFetcher.h: Copied from Source/WebCore/dom/LoadableScript.cpp.
2803         * ForwardingHeaders/runtime/ScriptFetcher.h: Copied from Source/WebCore/dom/LoadableScript.cpp.
2804         * bindings/js/CachedModuleScript.cpp:
2805         (WebCore::CachedModuleScript::create):
2806         (WebCore::CachedModuleScript::load):
2807         (WebCore::CachedModuleScript::CachedModuleScript): Deleted.
2808         * bindings/js/CachedModuleScript.h:
2809         Now we can merge CachedModuleScript to LoadableScript. But we do not do this in this patch since
2810         we focus on decoupling the initiator information from ScriptElement.
2811
2812         (WebCore::CachedModuleScript::nonce): Deleted.
2813         (WebCore::CachedModuleScript::crossOriginMode): Deleted.
2814         * bindings/js/CachedModuleScriptLoader.cpp:
2815         (WebCore::CachedModuleScriptLoader::load):
2816         * bindings/js/CachedModuleScriptLoader.h:
2817         * bindings/js/JSDOMWindowBase.cpp:
2818         (WebCore::JSDOMWindowBase::moduleLoaderResolve):
2819         (WebCore::JSDOMWindowBase::moduleLoaderFetch):
2820         (WebCore::JSDOMWindowBase::moduleLoaderEvaluate):
2821         * bindings/js/JSMainThreadExecState.h:
2822         (WebCore::JSMainThreadExecState::loadModule):
2823         (WebCore::JSMainThreadExecState::linkAndEvaluateModule):
2824         * bindings/js/ScriptController.cpp:
2825         (WebCore::ScriptController::loadModuleScriptInWorld):
2826         (WebCore::ScriptController::loadModuleScript):
2827         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
2828         (WebCore::ScriptController::linkAndEvaluateModuleScript):
2829         * bindings/js/ScriptController.h:
2830         * bindings/js/ScriptModuleLoader.cpp:
2831         (WebCore::ScriptModuleLoader::fetch):
2832         * bindings/js/ScriptModuleLoader.h:
2833         * dom/LoadableClassicScript.cpp:
2834         (WebCore::LoadableClassicScript::create):
2835         (WebCore::LoadableClassicScript::~LoadableClassicScript):
2836         (WebCore::LoadableClassicScript::isLoaded):
2837         (WebCore::LoadableClassicScript::error):
2838         (WebCore::LoadableClassicScript::wasCanceled):
2839         (WebCore::LoadableClassicScript::notifyFinished):
2840         (WebCore::LoadableClassicScript::load):
2841         * dom/LoadableClassicScript.h:
2842         * dom/LoadableModuleScript.cpp:
2843         (WebCore::LoadableModuleScript::create):
2844         (WebCore::LoadableModuleScript::LoadableModuleScript):
2845         (WebCore::LoadableModuleScript::load):
2846         * dom/LoadableModuleScript.h:
2847         * dom/LoadableScript.cpp:
2848         (WebCore::LoadableScript::requestScriptWithCache):
2849         * dom/LoadableScript.h:
2850         (WebCore::LoadableScript::LoadableScript):
2851         * dom/ScriptElement.cpp:
2852         (WebCore::ScriptElement::requestClassicScript):
2853         (WebCore::ScriptElement::requestModuleScript):
2854         (WebCore::ScriptElement::executeModuleScript):
2855         (WebCore::ScriptElement::requestScriptWithCacheForModuleScript): Deleted.
2856         (WebCore::ScriptElement::requestScriptWithCache): Deleted.
2857         * dom/ScriptElement.h:
2858
2859 2017-01-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2860
2861         [GStreamer] Use smart pointers and modernize code in WebKitWebAudioSourceGStreamer
2862         https://bugs.webkit.org/show_bug.cgi?id=166886
2863
2864         Reviewed by Xabier Rodriguez-Calvar.
2865
2866         This patch doesn't change the behavior, so it's covered by existing Web Audio tests. It replaces pointers with
2867         smart pointers, uses WTF::Vector instead of GSList and simplifies the code to map/unmap GstBuffers.
2868
2869         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
2870         (webKitWebAudioSrcConstructed):
2871         (webKitWebAudioSrcFinalize):
2872         (webKitWebAudioSrcLoop):
2873         (webKitWebAudioSrcChangeState):
2874         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
2875         (WTF::derefGPtr<GstBufferList>):
2876         (WTF::adoptGRef):
2877         (WTF::refGPtr<GstBufferPool>):
2878         (WTF::derefGPtr<GstBufferPool>):
2879         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
2880         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
2881         (WebCore::mapGstBuffer):
2882         * platform/graphics/gstreamer/GStreamerUtilities.h:
2883         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2884         (StreamingClient::createReadBuffer):
2885
2886 2017-01-11  Commit Queue  <commit-queue@webkit.org>
2887
2888         Unreviewed, rolling out r182947.
2889         https://bugs.webkit.org/show_bug.cgi?id=166922
2890
2891         Caused huge memory leak see https://webkit.org/b/166884
2892         (Requested by KaL on #webkit).
2893
2894         Reverted changeset:
2895
2896         "[GStreamer] Silent WebAudio buffers support"
2897         https://bugs.webkit.org/show_bug.cgi?id=143869
2898         http://trac.webkit.org/changeset/182947
2899
2900 2017-01-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2901
2902         Unreviewed, rolling out r210579.
2903
2904         That was not the right fix
2905
2906         Reverted changeset:
2907
2908         "Unreviewed GTK buildfix after r210571."
2909         http://trac.webkit.org/changeset/210579
2910
2911 2017-01-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2912
2913         Unreviewed. Fix GTK+ build after r210571.
2914
2915         Add getFileDeviceId implementation to FileSystemGlib.cpp.
2916
2917         * platform/glib/FileSystemGlib.cpp:
2918         (WebCore::getFileDeviceId):
2919
2920 2017-01-11  Csaba Osztrogonác  <ossy@webkit.org>
2921
2922         Unreviewed GTK buildfix after r210571.
2923
2924         * PlatformGTK.cmake:
2925
2926 2017-01-10  Yusuke Suzuki  <utatane.tea@gmail.com>
2927
2928         Implement JSSourceCode to propagate SourceCode in module pipeline
2929         https://bugs.webkit.org/show_bug.cgi?id=166861
2930
2931         Reviewed by Saam Barati.
2932
2933         Now SourceOrigin is correctly propagated through the module pipeline.
2934         So the error reported by http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.html
2935         is updated.
2936
2937         * ForwardingHeaders/runtime/JSSourceCode.h: Added.
2938         * bindings/js/JSDOMPromise.h:
2939         (WebCore::DeferredPromise::resolveWithCallback):
2940         * bindings/js/ScriptModuleLoader.cpp:
2941         (WebCore::ScriptModuleLoader::notifyFinished):
2942
2943 2017-01-10  Brent Fulgham  <bfulgham@apple.com>
2944
2945         File scheme should not allow access of a resource on a different volume.
2946         https://bugs.webkit.org/show_bug.cgi?id=158552
2947         <rdar://problem/15307582>
2948
2949         Reviewed by Alex Christensen.
2950
2951         Revise SecurityOrigin to prevent files from one storage device (volume) from accessing content
2952         on a different storage device (volume) unless universal access is enabled.
2953
2954         Pass the current file device as part of the NSURLRequest so that CFNetwork can reject loads
2955         where the device changes in the midst of a load.
2956
2957         Also properly reflect that SecurityOrigin is never null by passing as a reference,
2958         rather than as a pointer.
2959
2960         Tests: Tools/TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm
2961
2962         * page/SecurityOrigin.cpp:
2963         (WebCore::SecurityOrigin::canAccess): Pass argument as reference.
2964         (WebCore::SecurityOrigin::passesFileCheck): Add check that file URLs refer to files in
2965         the same storage volume.
2966         (WebCore::SecurityOrigin::canDisplay): Add check that files share the same volume.
2967         (WebCore::SecurityOrigin::isSameSchemeHostPort): Pass argument as reference.
2968         * page/SecurityOrigin.h:
2969         * platform/FileSystem.cpp:
2970         (WebCore::filesHaveSameVolume): Added.
2971         * platform/FileSystem.h:
2972         * platform/network/cocoa/ResourceRequestCocoa.mm:
2973         (WebCore::ResourceRequest::doUpdatePlatformRequest): If loading a file URL, tell CFNetwork
2974         the storage device at the time of the start of the load so we can trigger a failure if this
2975         changes during the load operation.
2976         * platform/posix/FileSystemPOSIX.cpp:
2977         (WebCore::getFileDeviceId): Added.
2978         * platform/win/FileSystemWin.cpp:
2979         (WebCore::getFileDeviceId): Added.
2980
2981 2017-01-10  Sam Weinig  <sam@webkit.org>
2982
2983         [WebIDL] Remove most of the custom bindings for the WebGL code
2984         https://bugs.webkit.org/show_bug.cgi?id=166834
2985
2986         Reviewed by Alex Christensen.
2987
2988         Removes all but one custom getter (getExtension) from the WebGL code.
2989
2990         * Modules/indexeddb/IDBKeyRange.idl:
2991         Replace use of non-standard type, with new OverrideIDLType extended attribute, allowing us
2992         to stay more consistent with the IDL files spec's provide.
2993
2994         * WebCore.xcodeproj/project.pbxproj:
2995         Move JSWebGL2RenderingContextCustom to the GC/Wrapping only group.
2996
2997         * bindings/IDLTypes.h:
2998         Add IDLWebGLAny, and simplify IDLIDBKey to not be templatized.
2999
3000         * bindings/js/JSDOMConvert.h:
3001         (WebCore::Converter<IDLLong>::convert):
3002         (WebCore::Converter<IDLFloat>::convert):
3003         (WebCore::Converter<IDLUnrestrictedFloat>::convert):
3004         (WebCore::Converter<IDLDouble>::convert):
3005         (WebCore::Converter<IDLUnrestrictedDouble>::convert):
3006         Add overloads of convert that convert a double to the numeric type.
3007
3008         (WebCore::Detail::GenericSequenceConverter::convert):
3009         Add optimized specialization for JSArrays that does not use the iterator protocol.
3010
3011         (WebCore::Detail::NumericSequenceConverter::convert):
3012         Add an even more optimized specialization for numeric types, which checks to see
3013         if the array's butterfly has an optimized shape, and extracts the numeric values
3014         from that.
3015
3016         (WebCore::Detail::SequenceConverter::convert):
3017         (WebCore::Detail::SequenceConverter<IDLLong>::convert):
3018         (WebCore::Detail::SequenceConverter<IDLFloat>::convert):
3019         (WebCore::Detail::SequenceConverter<IDLUnrestrictedFloat>::convert):
3020         (WebCore::Detail::SequenceConverter<IDLDouble>::convert):
3021         (WebCore::Detail::SequenceConverter<IDLUnrestrictedDouble>::convert):
3022         Select the right specialization based on type.
3023
3024         (WebCore::Converter<IDLSequence<T>>::convert):
3025         (WebCore::Converter<IDLFrozenArray<T>>::convert):
3026         Rename converter to be more accurate.
3027
3028         (WebCore::JSConverter<IDLWebGLAny>::convert):
3029         Added. Calls through to converter in WebGLAny.h. We should replace this with a
3030         call to the IDLUnion JSConverter when feasible.
3031
3032         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
3033         (WebCore::JSWebGL2RenderingContext::getInternalformatParameter): Deleted.
3034         (WebCore::JSWebGL2RenderingContext::getQueryParameter): Deleted.
3035         (WebCore::JSWebGL2RenderingContext::getSamplerParameter): Deleted.
3036         (WebCore::JSWebGL2RenderingContext::getSyncParameter): Deleted.
3037         (WebCore::JSWebGL2RenderingContext::getIndexedParameter): Deleted.
3038         (WebCore::JSWebGL2RenderingContext::getActiveUniformBlockParameter): Deleted.
3039         (WebCore::JSWebGL2RenderingContext::getActiveUniformBlockName): Deleted.
3040         Remove unnecessary custom functions.
3041
3042         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
3043         (WebCore::objectParameter): Deleted.
3044         (WebCore::JSWebGLRenderingContextBase::getAttachedShaders): Deleted.
3045         (WebCore::JSWebGLRenderingContextBase::getBufferParameter): Deleted.
3046         (WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter): Deleted.
3047         (WebCore::JSWebGLRenderingContextBase::getParameter): Deleted.
3048         (WebCore::JSWebGLRenderingContextBase::getProgramParameter): Deleted.
3049         (WebCore::JSWebGLRenderingContextBase::getRenderbufferParameter): Deleted.
3050         (WebCore::JSWebGLRenderingContextBase::getShaderParameter): Deleted.
3051         (WebCore::JSWebGLRenderingContextBase::getSupportedExtensions): Deleted.
3052         (WebCore::JSWebGLRenderingContextBase::getTexParameter): Deleted.
3053         (WebCore::JSWebGLRenderingContextBase::getUniform): Deleted.
3054         (WebCore::JSWebGLRenderingContextBase::getVertexAttrib): Deleted.
3055         (WebCore::toNumberVector): Deleted.
3056         (WebCore::functionForUniform): Deleted.
3057         (WebCore::dataFunctionf): Deleted.
3058         (WebCore::dataFunctioni): Deleted.
3059         (WebCore::dataFunctionMatrix): Deleted.
3060         (WebCore::JSWebGLRenderingContextBase::uniform1fv): Deleted.
3061         (WebCore::JSWebGLRenderingContextBase::uniform1iv): Deleted.
3062         (WebCore::JSWebGLRenderingContextBase::uniform2fv): Deleted.
3063         (WebCore::JSWebGLRenderingContextBase::uniform2iv): Deleted.
3064         (WebCore::JSWebGLRenderingContextBase::uniform3fv): Deleted.
3065         (WebCore::JSWebGLRenderingContextBase::uniform3iv): Deleted.
3066         (WebCore::JSWebGLRenderingContextBase::uniform4fv): Deleted.
3067         (WebCore::JSWebGLRenderingContextBase::uniform4iv): Deleted.
3068         (WebCore::JSWebGLRenderingContextBase::uniformMatrix2fv): Deleted.
3069         (WebCore::JSWebGLRenderingContextBase::uniformMatrix3fv): Deleted.
3070         (WebCore::JSWebGLRenderingContextBase::uniformMatrix4fv): Deleted.
3071         (WebCore::JSWebGLRenderingContextBase::vertexAttrib1fv): Deleted.
3072         (WebCore::JSWebGLRenderingContextBase::vertexAttrib2fv): Deleted.
3073         (WebCore::JSWebGLRenderingContextBase::vertexAttrib3fv): Deleted.
3074         (WebCore::JSWebGLRenderingContextBase::vertexAttrib4fv): Deleted.
3075         Remove unnecessary custom functions.
3076
3077         * bindings/scripts/CodeGenerator.pm:
3078         (IsBuiltinType):
3079         Remove specialization of IDBKey.
3080
3081         * bindings/scripts/CodeGeneratorJS.pm:
3082         (GetBaseIDLType):
3083         (GetIDLType):
3084         (NativeToJSValueDOMConvertNeedsState):
3085         (NativeToJSValueDOMConvertNeedsGlobalObject):
3086         (NativeToJSValue):
3087         Allow IDL files to override the type of signature using a new OverrideIDLType
3088         extended attribute. Currently this only works conversion to JS, but could be
3089         extended to support more.
3090
3091         * bindings/scripts/IDLAttributes.txt:
3092         Add OverrideIDLType.
3093
3094         * html/canvas/WebGL2RenderingContext.idl:
3095         Add OverrideIDLType=IDLWebGLAny annotations to remove the need for custom functions.
3096
3097         * html/canvas/WebGLAny.cpp:
3098         (WebCore::convertToJSValue):
3099         (WebCore::toJS): Deleted.
3100         * html/canvas/WebGLAny.h:
3101         Rename the toJS function to convertToJSValue to avoid a template specialization issue.
3102
3103         * html/canvas/WebGLRenderingContextBase.cpp:
3104         (WebCore::WebGLRenderingContextBase::getAttachedShaders):
3105         Update signature to match IDL, replacing bool return value plus out parameter with an
3106         optional return value. Modernize the code a bit.
3107
3108         (WebCore::WebGLRenderingContextBase::uniform2f):
3109         (WebCore::WebGLRenderingContextBase::uniform3f):
3110         (WebCore::WebGLRenderingContextBase::uniform4f):
3111         (WebCore::WebGLRenderingContextBase::uniform1i):
3112         (WebCore::WebGLRenderingContextBase::uniform3i):
3113         (WebCore::WebGLRenderingContextBase::uniform4i):
3114         (WebCore::WebGLRenderingContextBase::uniform1fv):
3115         (WebCore::WebGLRenderingContextBase::uniform2fv):
3116         (WebCore::WebGLRenderingContextBase::uniform3fv):
3117         (WebCore::WebGLRenderingContextBase::uniform4fv):
3118         (WebCore::WebGLRenderingContextBase::uniform1iv):
3119         (WebCore::WebGLRenderingContextBase::uniform2iv):
3120         (WebCore::WebGLRenderingContextBase::uniform3iv):
3121         (WebCore::WebGLRenderingContextBase::uniform4iv):
3122         (WebCore::WebGLRenderingContextBase::uniformMatrix2fv):
3123         (WebCore::WebGLRenderingContextBase::uniformMatrix3fv):
3124         (WebCore::WebGLRenderingContextBase::uniformMatrix4fv):
3125         (WebCore::WebGLRenderingContextBase::vertexAttrib4f):
3126         (WebCore::WebGLRenderingContextBase::vertexAttrib1fv):
3127         (WebCore::WebGLRenderingContextBase::vertexAttrib2fv):
3128         (WebCore::WebGLRenderingContextBase::vertexAttrib3fv):
3129         (WebCore::WebGLRenderingContextBase::vertexAttrib4fv):
3130         (WebCore::WebGLRenderingContextBase::validateUniformParameters):
3131         (WebCore::WebGLRenderingContextBase::validateUniformMatrixParameters):
3132         (WebCore::WebGLRenderingContextBase::vertexAttribfvImpl):
3133         * html/canvas/WebGLRenderingContextBase.h:
3134         (WebCore::WebGLRenderingContextBase::TypedList::TypedList):
3135         (WebCore::WebGLRenderingContextBase::TypedList::data):
3136         (WebCore::WebGLRenderingContextBase::TypedList::length):
3137         Re-order/group to match order in the IDL file. Remove overloads taking a pointer and 
3138         length, and replace it by having the main function take a specialized TypedList. TypedList
3139         allows the bindings to pass the correct Variant type, but then the code to only think in
3140         terms of the data() and length() functions.
3141
3142         * html/canvas/WebGLRenderingContextBase.idl:
3143         Remove [Custom] annotations and re-order/group to match the spec. Update types of uniform*fv/iv
3144         functions to take typedef'd unions.
3145
3146 2017-01-10  Ryosuke Niwa  <rniwa@webkit.org>
3147
3148         :active and :hover states may not be updated across slots
3149         https://bugs.webkit.org/show_bug.cgi?id=166881
3150         <rdar://problem/29944582>
3151
3152         Reviewed by Antti Koivisto.
3153
3154         The bug was caused by updateHoverActiveState not updating :hover and :active states on elements
3155         when nodes are assigned to slots because they were walking up the tree using parentOrShadowHostElement
3156         and parentNode. Fixed the bug by using parentElementInComposedTree instead since :hover and :active
3157         states need to be updated in accordance with the render tree, which is created from the "flat tree"
3158         or the "composed tree" in WebKit's terminology (this is old terminology in the spec).
3159
3160         Tests: fast/shadow-dom/clear-active-state-in-shadow.html
3161                fast/shadow-dom/hover-over-nested-slotted-content.html
3162
3163         * dom/Document.cpp:
3164         (WebCore::Document::updateHoverActiveState): Fixed the bug.
3165         * dom/Node.cpp:
3166         (WebCore::Node::parentElementInComposedTree): Added.
3167         * dom/Node.h:
3168
3169 2017-01-10  Keith Rollin  <krollin@apple.com>
3170
3171         Missing logging in IconLoader::startLoading
3172         https://bugs.webkit.org/show_bug.cgi?id=166904
3173
3174         Reviewed by Sam Weinig.
3175
3176         The LOG_ERROR in startLoading references 'resourceRequest', which has
3177         been WTF::Moved as part of a preceding function call. As such, the
3178         logging statement doesn't print out a possibly useful URL. Fix this by
3179         making a copy of the URL before it's affected by the Move.
3180
3181         No new tests -- change only affects logging code.
3182
3183         * loader/icon/IconLoader.cpp:
3184         (WebCore::IconLoader::startLoading):
3185
3186 2017-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
3187
3188         Implement "proximity" scroll snapping
3189         https://bugs.webkit.org/show_bug.cgi?id=135994
3190         <rdar://problem/18162418>
3191
3192         Reviewed by Dean Jackson.
3193
3194         Adds support for proximity scroll snapping. To do this, we introduce scroll offset ranges, a list of scroll
3195         offset ranges that are plumbed alongside the list of scroll snap offsets. Similar to a snap offset, a snap
3196         offset range contains scroll offsets on which scrolling is allowed to come to a rest within a scroll snapping
3197         container. However, unlike normal snap offsets, scrolling may only come to rest within a snap offset range if
3198         the predicted scroll offset already lies within the range. The new algorithm for selecting a target scroll snap
3199         position given a destination offset is now:
3200
3201         -   If the scroll destination lies within a snap offset range, return the scroll destination
3202         -   Otherwise, compute the nearest lower/upper snap offsets and lower/upper snap offset ranges
3203         -   If scrolling ended with no velocity, return the nearest snap offset
3204         -   If scrolling ended with positive velocity, choose the upper snap offset only if there is no snap offset
3205             range in between the scroll destination and the snap offset; else, choose the lower snap offset
3206         -   If scrolling ended with negative velocity, choose the lower snap offset only if there is no snap offset
3207             range in between the scroll destination and the snap offset; else, choose the upper snap offset
3208
3209         The extra rule accounting for scroll offset ranges in between the scroll destination and a potential snap offset
3210         handles the corner case where the user scrolls with momentum very lightly away from a snap offset, such that the
3211         predicted scroll destination is still within proximity of the snap offset. In this case, the regular (mandatory
3212         scroll snapping) behavior would be to snap to the next offset in the direction of momentum scrolling, but
3213         instead, it is more intuitive to return to the original snap position.
3214
3215         We also move scrolling prediction logic into ScrollingMomentumCalculator and adopt the platform
3216         _NSScrollingMomentumCalculator's destinationOrigin property when computing the predicted scroll destination.
3217         Previously, we were simply multiplying by an empirically-derived constant to approximate the scroll destination,
3218         but now that we are supporting proximity scroll snapping, we need more exact scroll destinaton prediction in
3219         order to make sure that scrolling to a snap offset range feels natural.
3220
3221         Tests: tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-then-proximity.html
3222                tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe.html
3223                tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-overflow.html
3224
3225         * WebCore.xcodeproj/project.pbxproj:
3226         * page/scrolling/AsyncScrollingCoordinator.cpp:
3227         (WebCore::setStateScrollingNodeSnapOffsetsAsFloat):
3228         (WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode):
3229         (WebCore::AsyncScrollingCoordinator::updateScrollSnapPropertiesWithFrameView):
3230
3231         Make boilerplate changes to plumb lists of horizontal and vertical snap offset ranges alongside the lists of
3232         horizontal and vertical snap offsets.
3233
3234         * page/scrolling/AxisScrollSnapOffsets.cpp:
3235         (WebCore::snapOffsetRangesToString):
3236         (WebCore::indicesOfNearestSnapOffsetRanges):
3237         (WebCore::indicesOfNearestSnapOffsets):
3238         (WebCore::adjustAxisSnapOffsetsForScrollExtent):
3239         (WebCore::computeAxisProximitySnapOffsetRanges):
3240         (WebCore::updateSnapOffsetsForScrollableArea):
3241         (WebCore::closestSnapOffset):
3242
3243         Adjust the snap offset selection algorithm to take snap offset ranges into account. See above for more details.
3244         Additionally, augment snap offset update logic to emit snap offset ranges for proximity scroll snapping. To do
3245         this, we run the following steps on the final list of processed snap offsets:
3246         -   Compute the proximity distance, which (for now) is arbitrarily 0.3 * the length or width of the scroll snap
3247             port, depending on whether scroll snapping is taking place in the X or Y axis.
3248         -   For each pair of adjacent snap offsets, if they are more than 2 * proximity distance away from each other,
3249             emit a snap offset range starting from (lower snap offset + proximity distance) and ending on (upper snap
3250             offset + proximity distance).
3251
3252         * page/scrolling/AxisScrollSnapOffsets.h:
3253         (WebCore::closestSnapOffset): Deleted.
3254         * page/scrolling/ScrollSnapOffsetsInfo.h:
3255
3256         Introduce ScrollSnapOffsetsInfo, a struct which contains data relevant to scroll snapping. This includes
3257         vertical and horizontal snap offsets, as well as vertical and horizontal snap offset ranges. Snap offset ranges
3258         consist of a vector of ranges of scroll offsets.
3259
3260         * page/scrolling/ScrollingCoordinator.h:
3261         * page/scrolling/ScrollingMomentumCalculator.cpp:
3262         (WebCore::projectedInertialScrollDistance):
3263         (WebCore::ScrollingMomentumCalculator::ScrollingMomentumCalculator):
3264         (WebCore::ScrollingMomentumCalculator::setRetargetedScrollOffset):
3265         (WebCore::ScrollingMomentumCalculator::predictedDestinationOffset):
3266         (WebCore::ScrollingMomentumCalculator::create):
3267         (WebCore::ScrollingMomentumCalculator::setPlatformMomentumScrollingPredictionEnabled):
3268         (WebCore::BasicScrollingMomentumCalculator::BasicScrollingMomentumCalculator):
3269         (WebCore::BasicScrollingMomentumCalculator::linearlyInterpolatedOffsetAtProgress):
3270         (WebCore::BasicScrollingMomentumCalculator::initializeInterpolationCoefficientsIfNecessary):
3271         (WebCore::BasicScrollingMomentumCalculator::initializeSnapProgressCurve):
3272         * page/scrolling/ScrollingMomentumCalculator.h:
3273         (WebCore::ScrollingMomentumCalculator::retargetedScrollOffset):
3274         (WebCore::ScrollingMomentumCalculator::retargetedScrollOffsetDidChange):
3275
3276         Currently, the ScrollingMomentumCalculator is responsible for taking an initial position, initial velocity, and
3277         target position and animating the scroll offset from the initial to target position. Now, we refactor the
3278         ScrollingMomentumCalculator interface to no longer take a target offset upon initialization, and instead compute
3279         the predicted scroll destination given initial position and velocity; clients of the ScrollingMomentumCalculator
3280         then use this predicted scroll destination to compute a retargeted scroll offset and then call
3281         setRetargetedScrollOffset on the calculator, which sets up an animation curve to the new retargeted offset. This
3282         allows both the AppKit-based scrolling momentum calculator and platform-invariant momentum calculator to be used
3283         interchangeably, while still allowing them to compute a destination offset from initial parameters of the
3284         scroll.
3285
3286         * page/scrolling/ScrollingStateScrollingNode.cpp:
3287         (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
3288         (WebCore::ScrollingStateScrollingNode::setHorizontalSnapOffsets):
3289         (WebCore::ScrollingStateScrollingNode::setVerticalSnapOffsets):
3290         (WebCore::ScrollingStateScrollingNode::setHorizontalSnapOffsetRanges):
3291         (WebCore::ScrollingStateScrollingNode::setVerticalSnapOffsetRanges):
3292         * page/scrolling/ScrollingStateScrollingNode.h:
3293         (WebCore::ScrollingStateScrollingNode::horizontalSnapOffsets):
3294         (WebCore::ScrollingStateScrollingNode::verticalSnapOffsets):
3295         (WebCore::ScrollingStateScrollingNode::horizontalSnapOffsetRanges):
3296         (WebCore::ScrollingStateScrollingNode::verticalSnapOffsetRanges):
3297         * page/scrolling/ScrollingTreeScrollingNode.cpp:
3298         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
3299         (WebCore::ScrollingTreeScrollingNode::dumpProperties):
3300         * page/scrolling/ScrollingTreeScrollingNode.h:
3301         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsets):
3302         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsets):
3303         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsetRanges):
3304         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsetRanges):
3305
3306         Add more boilerplate support for snap offset ranges.
3307
3308         * page/scrolling/mac/ScrollingMomentumCalculatorMac.h:
3309         * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm:
3310         (WebCore::ScrollingMomentumCalculator::create):
3311         (WebCore::ScrollingMomentumCalculator::setPlatformMomentumScrollingPredictionEnabled):
3312         (WebCore::ScrollingMomentumCalculatorMac::ScrollingMomentumCalculatorMac):
3313         (WebCore::ScrollingMomentumCalculatorMac::scrollOffsetAfterElapsedTime):
3314         (WebCore::ScrollingMomentumCalculatorMac::predictedDestinationOffset):
3315         (WebCore::ScrollingMomentumCalculatorMac::retargetedScrollOffsetDidChange):
3316         (WebCore::ScrollingMomentumCalculatorMac::animationDuration):
3317         (WebCore::ScrollingMomentumCalculatorMac::requiresMomentumScrolling):
3318         (WebCore::ScrollingMomentumCalculatorMac::ensurePlatformMomentumCalculator):
3319
3320         Hook into AppKit momentum scroll offset prediction.
3321
3322         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3323         (WebCore::convertToLayoutUnits):
3324         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
3325         * platform/ScrollableArea.cpp:
3326         (WebCore::ScrollableArea::ensureSnapOffsetsInfo):
3327         (WebCore::ScrollableArea::horizontalSnapOffsets):
3328         (WebCore::ScrollableArea::horizontalSnapOffsetRanges):
3329         (WebCore::ScrollableArea::verticalSnapOffsetRanges):
3330         (WebCore::ScrollableArea::verticalSnapOffsets):
3331         (WebCore::ScrollableArea::setHorizontalSnapOffsets):
3332         (WebCore::ScrollableArea::setVerticalSnapOffsets):
3333         (WebCore::ScrollableArea::setHorizontalSnapOffsetRanges):
3334         (WebCore::ScrollableArea::setVerticalSnapOffsetRanges):
3335         (WebCore::ScrollableArea::clearHorizontalSnapOffsets):
3336         (WebCore::ScrollableArea::clearVerticalSnapOffsets):
3337         * platform/ScrollableArea.h:
3338         (WebCore::ScrollableArea::horizontalSnapOffsets): Deleted.
3339         (WebCore::ScrollableArea::verticalSnapOffsets): Deleted.
3340         * platform/cocoa/ScrollController.h:
3341         * platform/cocoa/ScrollController.mm:
3342         (WebCore::ScrollController::processWheelEventForScrollSnap):
3343
3344         Fix an issue where initial scrolling velocity would be set to zero at the end of a drag gesture.
3345
3346         (WebCore::ScrollController::updateScrollSnapState):
3347         (WebCore::ScrollController::updateScrollSnapPoints):
3348         (WebCore::ScrollController::setNearestScrollSnapIndexForAxisAndOffset):
3349         * platform/cocoa/ScrollSnapAnimatorState.h:
3350         (WebCore::ScrollSnapAnimatorState::snapOffsetsForAxis):
3351         (WebCore::ScrollSnapAnimatorState::snapOffsetRangesForAxis):
3352         (WebCore::ScrollSnapAnimatorState::setSnapOffsetsAndPositionRangesForAxis):
3353         (WebCore::ScrollSnapAnimatorState::setSnapOffsetsForAxis): Deleted.
3354         * platform/cocoa/ScrollSnapAnimatorState.mm:
3355         (WebCore::ScrollSnapAnimatorState::setupAnimationForState):
3356         (WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset):
3357         (WebCore::projectedInertialScrollDistance): Deleted.
3358         * rendering/RenderLayerCompositor.cpp:
3359         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
3360         * testing/Internals.cpp:
3361         (WebCore::Internals::setPlatformMomentumScrollingPredictionEnabled):
3362
3363         Add a new hook for layout tests to force scrolling momentum calculators to use the platform-invariant momentum
3364         scrolling prediction heuristic instead of the platform-dependent one.
3365
3366         (WebCore::Internals::scrollSnapOffsets):
3367         * testing/Internals.h:
3368         * testing/Internals.idl:
3369
3370 2017-01-10  Chris Dumez  <cdumez@apple.com>
3371
3372         Make Event.initEvent()'s first parameter mandatory
3373         https://bugs.webkit.org/show_bug.cgi?id=166894
3374
3375         Reviewed by Alex Christensen.
3376
3377         Make Event.initEvent()'s first parameter mandatory. As per the
3378         specification, all parameters should be mandatory and we are
3379         currently dicussing the possibility of making them optional in
3380         the specification. However, having the first parameter optional
3381         makes little sense as it would set the event's type to the string
3382         "undefined".
3383
3384         Test: fast/events/initEvent-parameters.html
3385
3386         * dom/Event.idl:
3387
3388 2017-01-10  Commit Queue  <commit-queue@webkit.org>
3389
3390         Unreviewed, rolling out r210537.
3391         https://bugs.webkit.org/show_bug.cgi?id=166903
3392
3393         This change introduced JSC test failures (Requested by
3394         ryanhaddad on #webkit).
3395
3396         Reverted changeset:
3397
3398         "Implement JSSourceCode to propagate SourceCode in module
3399         pipeline"
3400         https://bugs.webkit.org/show_bug.cgi?id=166861
3401         http://trac.webkit.org/changeset/210537
3402
3403 2017-01-10  Chris Dumez  <cdumez@apple.com>
3404
3405         REGRESSION(r189555): ImageDocument title no longer includes the size of the image
3406         https://bugs.webkit.org/show_bug.cgi?id=166876
3407         <rdar://problem/29939970>
3408
3409         Reviewed by Ryosuke Niwa.
3410
3411         Add a code comment to clarify fix that was made in r210536.
3412
3413         * html/ImageDocument.cpp:
3414         (WebCore::ImageDocument::createDocumentStructure):
3415
3416 2017-01-10  Jer Noble  <jer.noble@apple.com>
3417
3418         Add support for MediaKeys.generateRequest().
3419         https://bugs.webkit.org/show_bug.cgi?id=166880
3420
3421         Reviewed by Xabier Rodriguez-Calvar.
3422
3423         Test: media/encrypted-media/mock-MediaKeySession-generateRequest.html
3424
3425         Implement MediaKeySession::generateRequest(). This requires some additions
3426         to CDM, CDMPrivate, and CDMInstance to support platform adoption and to
3427         implement mock support for testing. Additionally, add an InitDataRegistry
3428         object which can sanitize and extract key data from various initData types.
3429         (At the moment, only the "keyids" initData type is implemented.)
3430
3431         Drive-by fixes: Change all instances of initDataType from String -> AtomicString.
3432         Add "const" flags to all CDMPrivate methods that might be called from a const
3433         reference.
3434
3435         * CMakeLists.txt:
3436         * Modules/encryptedmedia/CDM.cpp:
3437         (WebCore::CDM::supportsInitDataType):
3438         (WebCore::CDM::sanitizeInitData):
3439         (WebCore::CDM::supportsInitData):
3440         * Modules/encryptedmedia/CDM.h:
3441         * Modules/encryptedmedia/CDMInstance.h:
3442         * Modules/encryptedmedia/CDMPrivate.h:
3443         * Modules/encryptedmedia/InitDataRegistry.cpp: Added.
3444         (WebCore::extractKeyIDsKeyids):
3445         (WebCore::sanitizeKeyids):
3446         (WebCore::sanitizeCenc):
3447         (WebCore::extractKeyIDsCenc):
3448         (WebCore::sanitizeWebM):
3449         (WebCore::extractKeyIDsWebM):
3450         (WebCore::InitDataRegistry::shared):
3451         (WebCore::InitDataRegistry::InitDataRegistry):
3452         (WebCore::InitDataRegistry::sanitizeInitData):
3453         (WebCore::InitDataRegistry::extractKeyIDs):
3454         (WebCore::InitDataRegistry::registerInitDataType):
3455         * Modules/encryptedmedia/InitDataRegistry.h:
3456         * Modules/encryptedmedia/MediaKeySession.cpp:
3457         (WebCore::messageEventName):
3458         (WebCore::MediaKeySession::MediaKeySession):
3459         (WebCore::MediaKeySession::generateRequest):
3460         (WebCore::MediaKeySession::enqueueMessage):
3461         * Modules/encryptedmedia/MediaKeySession.h:
3462         * Modules/encryptedmedia/MediaKeys.cpp:
3463         (WebCore::MediaKeys::setServerCertificate):
3464         * WebCore.xcodeproj/project.pbxproj:
3465         * testing/MockCDMFactory.cpp:
3466         (WebCore::MockCDMFactory::addKeysToSessionWithID):
3467         (WebCore::MockCDMFactory::setSupportedDataTypes):
3468         (WebCore::MockCDM::supportsInitDataType):
3469         (WebCore::MockCDM::supportsConfiguration):
3470         (WebCore::MockCDM::supportsConfigurationWithRestrictions):
3471         (WebCore::MockCDM::supportsSessionTypeWithConfiguration):
3472         (WebCore::MockCDM::supportsRobustness):
3473         (WebCore::MockCDM::distinctiveIdentifiersRequirement):
3474         (WebCore::MockCDM::persistentStateRequirement):
3475         (WebCore::MockCDM::distinctiveIdentifiersAreUniquePerOriginAndClearable):
3476         (WebCore::MockCDM::supportsInitData):
3477         (WebCore::MockCDMInstance::setServerCertificate):
3478         (WebCore::MockCDMInstance::requestLicense):
3479         * testing/MockCDMFactory.h:
3480         (WebCore::MockCDMFactory::supportedDataTypes):
3481         (WebCore::MockCDMFactory::hasSessionWithID):
3482         (WebCore::MockCDMFactory::removeSessionWithID):
3483         (WebCore::MockCDMFactory::setSupportedDataTypes): Deleted.
3484
3485 2017-01-10  Jer Noble  <jer.noble@apple.com>
3486
3487         Add support for MediaKeys.createSession().
3488         https://bugs.webkit.org/show_bug.cgi?id=166796
3489
3490         Reviewed by Eric Carlson.
3491
3492         Test: media/encrypted-media/mock-MediaKeys-createSession.html
3493
3494         Implement MediaKeys::createSession(). This requires some additions to
3495         CDM, CDMPrivate, and CDMInstance to support platform adoption and to
3496         implement mock support for testing. Because the CDMInstance will now
3497         be shared between MediaKeys and MediaKeySession, it cannot be a unique_ptr.
3498         Make CDMInterface ref-counted and store it as a Ref.
3499
3500         * Modules/encryptedmedia/CDM.cpp:
3501         (WebCore::CDM::createInstance):
3502         (WebCore::CDM::supportsSessions):
3503         * Modules/encryptedmedia/CDM.h:
3504         * Modules/encryptedmedia/CDMInstance.h:
3505         * Modules/encryptedmedia/CDMPrivate.h:
3506         * Modules/encryptedmedia/MediaKeySession.cpp:
3507         (WebCore::MediaKeySession::create):
3508         (WebCore::MediaKeySession::MediaKeySession):
3509         (WebCore::MediaKeySession::sessionId):
3510         (WebCore::MediaKeySession::expiration):
3511         (WebCore::MediaKeySession::keyStatuses):
3512         * Modules/encryptedmedia/MediaKeySession.h:
3513         * Modules/encryptedmedia/MediaKeySessionType.idl:
3514         * Modules/encryptedmedia/MediaKeySystemAccess.cpp:
3515         (WebCore::MediaKeySystemAccess::createMediaKeys):
3516         * Modules/encryptedmedia/MediaKeys.cpp:
3517         (WebCore::MediaKeys::MediaKeys):
3518         (WebCore::MediaKeys::createSession):
3519         * Modules/encryptedmedia/MediaKeys.h:
3520         (WebCore::MediaKeys::create):
3521         * Modules/encryptedmedia/MediaKeys.idl:
3522
3523 2017-01-10  Jer Noble  <jer.noble@apple.com>
3524
3525         Add support for MediaKeys.setServerCertificate()
3526         https://bugs.webkit.org/show_bug.cgi?id=166772
3527
3528         Reviewed by Darin Adler.
3529
3530         Test: media/encrypted-media/mock-MediaKeys-setServerCertificate.html
3531
3532         Implement MediaKeys::setServerCertificate(). This requires some additions
3533         to CDM, CDMPrivate, and CDMInstance to support platform adoption and to
3534         implement mock support for testing.
3535
3536         * Modules/encryptedmedia/CDM.cpp:
3537         (WebCore::CDM::supportsServerCertificates):
3538         * Modules/encryptedmedia/CDM.h:
3539         * Modules/encryptedmedia/CDMInstance.h:
3540         * Modules/encryptedmedia/CDMPrivate.h:
3541         * Modules/encryptedmedia/MediaKeys.cpp:
3542         (WebCore::MediaKeys::setServerCertificate):
3543         * Modules/encryptedmedia/MediaKeys.h:
3544         * testing/MockCDMFactory.cpp:
3545         (WebCore::MockCDM::supportsServerCertificates):
3546         (WebCore::MockCDMInstance::setServerCertificate):
3547         * testing/MockCDMFactory.h:
3548         (WebCore::MockCDMFactory::supportsServerCertificates):
3549         (WebCore::MockCDMFactory::setSupportsServerCertificates):
3550         * testing/MockCDMFactory.idl:
3551
3552 2017-01-10  Youenn Fablet  <youenn@apple.com>
3553
3554         CachedScript cloning does not clone encodedSize
3555         https://bugs.webkit.org/show_bug.cgi?id=166865
3556
3557         Reviewed by Darin Adler.
3558
3559         Covered by updated test.
3560
3561         * loader/cache/CachedResource.cpp:
3562         (WebCore::CachedResource::setBodyDataFrom): set encoded size based on being cloned resource.
3563         * loader/cache/CachedScript.cpp:
3564         (WebCore::CachedScript::script):
3565         (WebCore::CachedScript::setBodyDataFrom): Making use of CachedResource::setBodyDataFrom for complete cloning.
3566
3567 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
3568
3569         Unreviewed. Remove the unused gReadyStateTimerInterval global from
3570         the MediaPlayerPrivateGStreamerMSE implementation file as it's only
3571         springing up a compiler warning.
3572
3573         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3574
3575 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
3576
3577         [CoordinatedGraphics] TextureMapperPlatformLayerProxy is constantly getting activated
3578         https://bugs.webkit.org/show_bug.cgi?id=166856
3579
3580         Reviewed by Michael Catanzaro.
3581
3582         When CoordinatedGraphicsLayer::setContentsNeedsDisplay() is called, currently with
3583         the threaded CoordinatedGraphics mode the platform layer is marked for synchronizing.
3584         This means that at flush-time this layer swaps the buffer of the wrapped platform
3585         layer and updates the layer state to indicate that the underlying
3586         TextureMapperPlatformLayerProxy object has to be activated on the composition thread.
3587
3588         This current logic results in the TextureMapperPlatformLayerProxy object being
3589         reactivated for every display request that arrives via setContentsNeedsDisplay().
3590         This is pretty wasteful since this activation heap-allocates a RunLoop::Timer object
3591         which internally also locks up the GLib main context to attach a new source, and
3592         that's only after the source on the previous RunLoop::Timer was detached before
3593         that RunLoop::Timer was destroyed.
3594
3595         To avoid this, CoordinatedGraphicsLayer::setContentsNeedsDisplay() sets a new flag,
3596         m_shouldUpdatePlatformLayer. During flush, this flag is checked in
3597         CoordinatedGraphicsLayer::updatePlatformLayer(), with the buffer swap performed in
3598         case it's set. CoordinatedGraphicsLayer::syncPlatformLayer() now only sets the
3599         platform layer proxy object for that layer's state.
3600
3601         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3602         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
3603         (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay):
3604         (WebCore::CoordinatedGraphicsLayer::syncPlatformLayer):
3605         (WebCore::CoordinatedGraphicsLayer::updatePlatformLayer):
3606         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
3607         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3608
3609 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
3610
3611         [TexMap] Use WTF::Function in TextureMapperPlatformLayerProxy
3612         https://bugs.webkit.org/show_bug.cgi?id=166853
3613
3614         Reviewed by Michael Catanzaro.
3615
3616         Use WTF::Function in the TextureMapperPlatformLayerProxy, instead of
3617         the std::function bloat.
3618
3619         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
3620         (WebCore::TextureMapperPlatformLayerProxy::scheduleUpdateOnCompositorThread):
3621         (WebCore::TextureMapperPlatformLayerProxy::compositorThreadUpdateTimerFired):
3622         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
3623
3624 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
3625
3626         [TextureMapper] TextureMapperPlatformLayerProxy::swapBuffers() should hold the lock throughout invocation
3627         https://bugs.webkit.org/show_bug.cgi?id=166852
3628
3629         Reviewed by Michael Catanzaro.
3630
3631         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
3632         (WebCore::TextureMapperPlatformLayerProxy::swapBuffer): Append to previous buffer
3633         to the m_usedBuffers Vector while the object's lock is held. Everywhere else the
3634         m_usedBuffers Vector is used under the lock, no reason to not do the same here.
3635
3636 2017-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
3637
3638         Implement JSSourceCode to propagate SourceCode in module pipeline
3639         https://bugs.webkit.org/show_bug.cgi?id=166861
3640
3641         Reviewed by Saam Barati.
3642
3643         Now SourceOrigin is correctly propagated through the module pipeline.
3644         So the error reported by http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.html
3645         is updated.
3646
3647         * ForwardingHeaders/runtime/JSSourceCode.h: Added.
3648         * bindings/js/JSDOMPromise.h:
3649         (WebCore::DeferredPromise::resolveWithCallback):
3650         * bindings/js/ScriptModuleLoader.cpp:
3651         (WebCore::ScriptModuleLoader::notifyFinished):
3652
3653 2017-01-09  Chris Dumez  <cdumez@apple.com>
3654
3655         REGRESSION(r189555): ImageDocument title no longer includes the size of the image
3656         https://bugs.webkit.org/show_bug.cgi?id=166876
3657         <rdar://problem/29939970>
3658
3659         Reviewed by Tim Horton.
3660
3661         ImageDocument title no longer included the size of the image after r189555.
3662         This is because Document::setTitle() is a no-op if the document does not
3663         have a <head> element. To address the issue, we now include a <head>
3664         element in ImageDocuments so that their title element properly gets added
3665         to it.
3666
3667         Test: fast/images/imageDocument-title.html
3668
3669         * html/ImageDocument.cpp:
3670         (WebCore::ImageDocument::createDocumentStructure):
3671
3672 2017-01-09  Zalan Bujtas  <zalan@apple.com>
3673
3674         ASSERTION FAILED: newLogicalTop >= logicalTop in WebCore::RenderBlockFlow::getClearDelta
3675         https://bugs.webkit.org/show_bug.cgi?id=151202
3676         <rdar://problem/27711822>
3677
3678         Reviewed by Myles C. Maxfield.
3679
3680         FindNextFloatLogicalBottomAdapter uses LayoutUnit::max() to flag m_nextLogicalBottom uninitialized.        
3681         However LayoutUnit::max() can also be a valid value for m_nextLogicalBottom.
3682         FindNextFloatLogicalBottomAdapter::nextLogicalBottom() returns 0 instead of the actual value when
3683         it sees m_nextLogicalBottom uninitialized. In certain cases, it confuses the caller and we end up
3684         with a runaway loop.
3685
3686         Test: fast/block/float/assert-when-line-has-not-enough-space-left.html
3687
3688         * rendering/FloatingObjects.cpp:
3689         (WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
3690         (WebCore::FindNextFloatLogicalBottomAdapter::highValue):
3691         (WebCore::FindNextFloatLogicalBottomAdapter::nextLogicalBottom):
3692         (WebCore::FindNextFloatLogicalBottomAdapter::nextShapeLogicalBottom):
3693         (WebCore::FindNextFloatLogicalBottomAdapter::collectIfNeeded):
3694
3695 2017-01-09  Ryan Haddad  <ryanhaddad@apple.com>
3696
3697         Unreviewed, rolling out r210531.
3698
3699         This change broke the 32-bit macOS build and caused LayoutTest
3700         failures.
3701
3702         Reverted changeset:
3703
3704         "File scheme should not allow access of a resource on a
3705         different volume."
3706         https://bugs.webkit.org/show_bug.cgi?id=158552
3707         http://trac.webkit.org/changeset/210531
3708
3709 2017-01-09  Chris Dumez  <cdumez@apple.com>
3710
3711         [iOS] Drop VNodeTracker
3712         https://bugs.webkit.org/show_bug.cgi?id=166868
3713         <rdar://problem/29937587>
3714
3715         Reviewed by Andreas Kling.
3716
3717         Drop VNodeTracker on iOS. This was introduced a while back to try and
3718         address vnode exhaustion issues in long running page load tests.
3719         However, there was no evidence that the VNodeTracker functionality
3720         helped so there is little point in keeping the extra code complexity.
3721
3722         * WebCore.xcodeproj/project.pbxproj:
3723         * platform/SharedBuffer.h:
3724         * platform/VNodeTracker.cpp: Removed.
3725         * platform/VNodeTracker.h: Removed.
3726         * platform/cf/SharedBufferCF.cpp:
3727         (WebCore::SharedBuffer::SharedBuffer):
3728         * platform/cocoa/VNodeTrackerCocoa.cpp: Removed.
3729
3730 2017-01-09  Brent Fulgham  <bfulgham@apple.com>
3731
3732         File scheme should not allow access of a resource on a different volume.
3733         https://bugs.webkit.org/show_bug.cgi?id=158552
3734         <rdar://problem/15307582>
3735
3736         Reviewed by Alex Christensen.
3737
3738         Revise SecurityOrigin to prevent files from one storage device (volume) from accessing content
3739         on a different storage device (volume) unless universal access is enabled.
3740
3741         Pass the current file device as part of the NSURLRequest so that CFNetwork can reject loads
3742         where the device changes in the midst of a load.
3743
3744         Also properly reflect that SecurityOrigin is never null by passing as a reference,
3745         rather than as a pointer.
3746
3747         Tests: Tools/TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm
3748
3749         * page/SecurityOrigin.cpp:
3750         (WebCore::SecurityOrigin::canAccess): Pass argument as reference.
3751         (WebCore::SecurityOrigin::passesFileCheck): Add check that file URLs refer to files in
3752         the same storage volume.
3753         (WebCore::SecurityOrigin::canDisplay): Add check that files share the same volume.
3754         (WebCore::SecurityOrigin::isSameSchemeHostPort): Pass argument as reference.
3755         * page/SecurityOrigin.h:
3756         * platform/FileSystem.cpp:
3757         (WebCore::filesHaveSameVolume): Added.
3758         * platform/FileSystem.h:
3759         * platform/network/cocoa/ResourceRequestCocoa.mm:
3760         (WebCore::ResourceRequest::doUpdatePlatformRequest): If loading a file URL, tell CFNetwork
3761         the storage device at the time of the start of the load so we can trigger a failure if this
3762         changes during the load operation.
3763         * platform/posix/FileSystemPOSIX.cpp:
3764         (WebCore::getFileDeviceId): Added.
3765         * platform/win/FileSystemWin.cpp:
3766         (WebCore::getFileDeviceId): Added.
3767
3768 2017-01-09  Tim Horton  <timothy_horton@apple.com>
3769
3770         Unindenting text inside a blockquote can result in the text being reordered
3771         https://bugs.webkit.org/show_bug.cgi?id=166813
3772
3773         Reviewed by Darin Adler and Ryosuke Niwa.
3774
3775         Test: editing/execCommand/unindent-nested-blockquote-with-inner-div.html
3776
3777         * editing/IndentOutdentCommand.cpp:
3778         (WebCore::IndentOutdentCommand::outdentParagraph):
3779         Start splitting the tree at the beginning of the content being unindented,
3780         not at the containing block flow element, which could e.g. contain other
3781         elements (or even other blockquotes).
3782
3783 2017-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
3784
3785         [JSC] Prototype dynamic-import
3786         https://bugs.webkit.org/show_bug.cgi?id=165724
3787
3788         Reviewed by Saam Barati.
3789
3790         We do not set a handler for import for now.
3791         So dynamic import feature is only enabled in the JSC shell right now.
3792
3793         * bindings/js/JSDOMWindowBase.cpp:
3794         * bindings/js/JSWorkerGlobalScopeBase.cpp:
3795
3796 2017-01-09  Youenn Fablet  <youennf@gmail.com>
3797
3798         Merging ThreadableLoader redundant options on filtering responses
3799
3800         Merge OpaqueResponseBodyPolicy and ResponseFilteringPolicy ThreadableLoader options
3801         https://bugs.webkit.org/show_bug.cgi?id=166843
3802
3803         Reviewed by Darin Adler.
3804
3805         Covered by existing tests.
3806
3807         Removing OpaqueResponseBodyPolicy option.
3808         When ResponseFilteringPolicy is set to Enable, the body is filtered out in DocumentThreadableLoader.
3809
3810         * Modules/fetch/FetchLoader.cpp:
3811         (WebCore::FetchLoader::start):
3812         * loader/DocumentThreadableLoader.cpp:
3813         (WebCore::DocumentThreadableLoader::didReceiveResponse): Implementing body filtering based on ResponseFilteringPolicy option.
3814         * loader/ThreadableLoader.cpp:
3815         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
3816         * loader/ThreadableLoader.h:
3817         * loader/WorkerThreadableLoader.cpp:
3818         (WebCore::LoaderTaskOptions::LoaderTaskOptions):
3819         * workers/WorkerScriptLoader.cpp:
3820         (WebCore::WorkerScriptLoader::loadSynchronously):
3821         (WebCore::WorkerScriptLoader::loadAsynchronously):
3822         * xml/XMLHttpRequest.cpp:
3823         (WebCore::XMLHttpRequest::createRequest):
3824
3825 2017-01-09  Daniel Bates  <dabates@apple.com>
3826
3827         Evaluating window named element may return wrong result
3828         https://bugs.webkit.org/show_bug.cgi?id=166792
3829         <rdar://problem/29801059>
3830
3831         Reviewed by Chris Dumez.
3832
3833         * bindings/js/JSDOMWindowProperties.cpp:
3834         (WebCore::jsDOMWindowPropertiesGetOwnPropertySlotNamedItemGetter):
3835
3836 2017-01-09  Chris Dumez  <cdumez@apple.com>
3837
3838         REGRESSION(r178955): Touching Settings.in doesn't cause JSInternalSettingsGenerated.cpp to be updated on first build
3839         https://bugs.webkit.org/show_bug.cgi?id=166814
3840
3841         Reviewed by Darin Adler.
3842
3843         Stop using .INTERMEDIATE in DerivedSources.make was it seems to break dependency
3844         chains for some reason. We started using .INTERMEDIATE for scripts that generate
3845         several targets when run a single time. It avoided running the script several
3846         times (once per target) unnecessarily, and fixed issues with parallel builds.
3847
3848         To address the same issue without using .INTERMEDIATE, we now use pattern rules
3849         (i.e. rules that have '%'). As per the documentation [1]:
3850         "Pattern rules may have more than one target. Unlike normal rules, this does not
3851          act as many different rules with the same prerequisites and recipe. If a pattern
3852          rule has multiple targets, make knows that the rule’s recipe is responsible for
3853          making all of the targets. The recipe is executed only once to make all the
3854          targets".
3855
3856          We are therefore solving the same problem as with .INTERMEDIATE. However, I have
3857          confirmed that using pattern rules does not break dependency chains. For example,
3858          modifying Settings.in re-generates both InternalSettingsGenerated.idl *and*
3859          JSInternalSettingsGenerated.cpp.
3860
3861          [1] https://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html#Pattern-Intro
3862
3863         * DerivedSources.make:
3864
3865 2017-01-09  Commit Queue  <commit-queue@webkit.org>
3866
3867         Unreviewed, rolling out r210493 and r210495.
3868         https://bugs.webkit.org/show_bug.cgi?id=166842
3869
3870         Causes makeprops.pl to run on every build (Requested by smfr
3871         on #webkit).
3872
3873         Reverted changesets:
3874
3875         "Avoid triggering rebuilds for minor changes of
3876         CSSProperties.json"
3877         https://bugs.webkit.org/show_bug.cgi?id=166810
3878         http://trac.webkit.org/changeset/210493
3879
3880         "Avoid triggering rebuilds for minor changes of
3881         CSSProperties.json"
3882         https://bugs.webkit.org/show_bug.cgi?id=166810
3883         http://trac.webkit.org/changeset/210495
3884
3885 2017-01-06  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
3886
3887         [GTK] Should support key and code properties on keyboard events
3888         https://bugs.webkit.org/show_bug.cgi?id=166759
3889
3890         Reviewed by Carlos Garcia Campos.
3891
3892         This change fixes a bunch of tests which are currently failing, such as:
3893         - fast/events/arrow-keys-on-body.html
3894         - fast/events/constructors/keyboard-event-constructor.html
3895         - fast/events/key-events-in-input-button.html
3896         - fast/events/key-events-in-input-text.html
3897         - fast/events/keyboardevent-code.html
3898         - fast/events/keyboardevent-key.html
3899
3900         * platform/PlatformKeyboardEvent.h:
3901         * platform/gtk/PlatformKeyboardEventGtk.cpp:
3902         (WebCore::PlatformKeyboardEvent::keyValueForGdkKeyCode): match web key value
3903         to GDK key symbol.
3904         (WebCore::PlatformKeyboardEvent::keyCodeForHardwareKeyCode): match web key code
3905         to hardware code as reported by GDK.
3906         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): add web key value and
3907         code to the keyboard event upon creation.
3908
3909 2017-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
3910
3911         [GTK] WebProcess from WebKitGtk+ 2.15.2 SIGSEGVs in std::unique_ptr<SoupBuffer, WTF::GPtrDeleter<SoupBuffer> >::get() const () at /usr/include/c++/6/bits/unique_ptr.h:305
3912         https://bugs.webkit.org/show_bug.cgi?id=165848
3913
3914         Reviewed by Michael Catanzaro.
3915
3916         In r208881 several locks were added to ImageDecoder to prevent frameBufferAtIndex() from being called by multiple
3917         threads at the same time, but I forgot isSizeAvailable() also calls frameBufferAtIndex(). However, what we
3918         really need to protect is the GIFImageDecoder, to never allow decoding from more than one thread at the same
3919         time. This patch reverts r208881 and adds a lock to GIFImageDecoder::decode() instead.
3920
3921         * platform/image-decoders/ImageDecoder.cpp:
3922         (WebCore::ImageDecoder::frameIsCompleteAtIndex):
3923         (WebCore::ImageDecoder::frameDurationAtIndex):
3924         (WebCore::ImageDecoder::createFrameImageAtIndex):
3925         * platform/image-decoders/ImageDecoder.h:
3926         * platform/image-decoders/gif/GIFImageDecoder.cpp:
3927         (WebCore::GIFImageDecoder::decode):
3928         * platform/image-decoders/gif/GIFImageDecoder.h:
3929
3930 2017-01-09  Alejandro G. Castro  <alex@igalia.com>
3931
3932         [OWR] Unskip fast/mediastream/MediaStream-video-element-track-stop.html
3933         https://bugs.webkit.org/show_bug.cgi?id=165316
3934
3935         Reviewed by Philippe Normand.
3936
3937         Fixed the ended support of the video element in the OWR player and
3938         fixed the videoTracks support. Now the OW player properly adds and
3939         removes the audio and video tracks. Added the getSettings support
3940         to the mediastream interface. Solved also the size handling in
3941         some of the enable/muted situations.
3942
3943         Unskipping fast/mediastream/MediaStream-video-element-track-stop.html.
3944
3945         * platform/GStreamer.cmake: Added the new
3946         RealtimeMediaSourceOwr.cpp with the new code handling the
3947         settings.
3948         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
3949         (WebCore::MediaPlayerPrivateGStreamerOwr::~MediaPlayerPrivateGStreamerOwr):
3950         Release the new video and audio maps that creates a relationship
3951         of the mediastream tracks with the mediatracks of the video element.
3952         (WebCore::MediaPlayerPrivateGStreamerOwr::play): Set ended to
3953         false when we start playing.
3954         (WebCore::MediaPlayerPrivateGStreamerOwr::load): Create the media
3955         tracks to the player so that the videoTracks API returns it, and
3956         add an entry in the map to be able to restore it using the
3957         mediastream track.
3958         (WebCore::MediaPlayerPrivateGStreamerOwr::disableMediaTracks):
3959         Move some part of the stop function to this one in order to use it
3960