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