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