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