Blob references for System Previews don't get a correct file extension
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-01-08  Dean Jackson  <dino@apple.com>
2
3         Blob references for System Previews don't get a correct file extension
4         https://bugs.webkit.org/show_bug.cgi?id=193268
5         <rdar://problem/47133037>
6
7         Reviewed by Tim Horton.
8
9         Apple platforms don't yet have a mapping from the USD MIME type to
10         file extensions (and we support some non-standard MIME types), which
11         means that downloads from Blob references don't get correctly named.
12
13         Fix this by adding an explicit mapping between System Preview types
14         and ".usdz".
15
16         WebKit API test: _WKDownload.SystemPreviewUSDZBlobNaming
17
18         * platform/MIMETypeRegistry.cpp:
19         (WebCore::MIMETypeRegistry::isSystemPreviewMIMEType): Remove USE(SYSTEM_PREVIEW) since
20         this applies to macOS and iOS now.
21         * platform/MIMETypeRegistry.h:
22         * platform/cocoa/MIMETypeRegistryCocoa.mm:
23         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): Add a mapping
24         for USDZ.
25
26 2019-01-08  Tim Horton  <timothy_horton@apple.com>
27
28         Editable images sometimes don't become focused when tapped
29         https://bugs.webkit.org/show_bug.cgi?id=193259
30         <rdar://problem/47038424>
31
32         Reviewed by Wenson Hsieh.
33
34         Often when tapping an editable image inside an editable text area, the
35         text area's selection will change instead of focusing the editable image.
36
37         No new tests; I have had no luck writing a test that reliably failed 
38         beforehand (the "sometimes" is a problem).
39
40         * html/HTMLImageElement.cpp:
41         (WebCore::HTMLImageElement::defaultEventHandler):
42         * html/HTMLImageElement.h:
43         Override mousedown on editable images, focus the image, and prevent
44         the default behavior.
45
46 2019-01-08  Jiewen Tan  <jiewen_tan@apple.com>
47
48         [WebAuthN] Support U2F HID Authenticators on macOS
49         https://bugs.webkit.org/show_bug.cgi?id=191535
50         <rdar://problem/47102027>
51
52         Reviewed by Brent Fulgham.
53
54         This patch changes U2fCommandConstructor to produce register commands with
55         enforcing test of user presence. Otherwise, authenticators would silently
56         generate credentials. It also renames readFromU2fSignResponse to
57         readU2fSignResponse.
58
59         Tests: http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html
60                http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html
61                http/wpt/webauthn/public-key-credential-create-success-u2f.https.html
62                http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html
63                http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html
64                http/wpt/webauthn/public-key-credential-get-success-u2f.https.html
65
66         * Modules/webauthn/fido/U2fCommandConstructor.cpp:
67         (fido::WebCore::constructU2fRegisterCommand):
68         * Modules/webauthn/fido/U2fResponseConverter.cpp:
69         (fido::readU2fSignResponse):
70         (fido::readFromU2fSignResponse): Deleted.
71         * Modules/webauthn/fido/U2fResponseConverter.h:
72
73 2019-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
74
75         [iOS] Dispatch a synthetic mousedown event prior to starting drags
76         https://bugs.webkit.org/show_bug.cgi?id=193229
77         <rdar://problem/46717097>
78
79         Reviewed by Tim Horton.
80
81         Tweaks some drag initiation logic on iOS to actually send a "mousedown" event to the page prior to drag start.
82         This improves drag and drop compatibility with web pages that expect a mousedown to always precede dragging.
83         Additionally, ensure that preventing the "mousedown" event also prevents "dragstart", which matches macOS
84         behavior.
85
86         Test: DragAndDropTests.PreventingMouseDownShouldPreventDragStart
87
88         * page/EventHandler.cpp:
89
90         Make the text drag delay 0 on iOS. This was introduced on iOS when originally bringing up drag and drop, and was
91         made to simply match macOS. However, it doesn't make sense to respect the delay here, since the purpose of this
92         delay is to disambiguate between making a text selection and starting a drag when pressing on text that is
93         already selected; on iOS (including iOSMac), this gesture conflict is already resolved by platform gesture
94         recognizers in the client layer, so there is always no delay between mouse down and drag here.
95
96         * page/ios/EventHandlerIOS.mm:
97
98         Dispatch a mousedown and inspect the value of `m_mouseDownMayStartDrag` when starting a drag on iOS. This brings
99         our behavior closer in line with macOS.
100
101         (WebCore::EventHandler::tryToBeginDataInteractionAtPoint):
102
103 2019-01-08  Youenn Fablet  <youenn@apple.com>
104
105         service worker fetch handler results in bad referrer
106         https://bugs.webkit.org/show_bug.cgi?id=188248
107         <rdar://problem/47050478>
108
109         Reviewed by Alex Christensen.
110
111         Response sanitization was removing the ReferrerPolicy header from opaque redirect responses.
112         Reduce sanitization of opaque redirect responses to opaque responses and allow Location header.
113         Make sure referrer policy is updated for all load redirections, not only CORS loads.
114
115         Test: http/tests/security/referrer-policy-redirect-link-downgrade.html
116
117         * loader/SubresourceLoader.cpp:
118         (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
119         * platform/network/ResourceResponseBase.cpp:
120         (WebCore::isSafeCrossOriginResponseHeader):
121         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting):
122
123 2019-01-08  Youenn Fablet  <youenn@apple.com>
124
125         IDB storage of Crypto keys does not work in private browsing mode
126         https://bugs.webkit.org/show_bug.cgi?id=193219
127
128         Reviewed by Brady Eidson.
129
130         https://trac.webkit.org/changeset/238677 moved from using a JSGlobalObject to a JSDOMGlobalObject for serialization/deserialization.
131         This does not work for crypto keys as they require not only a JSDOMGlobalObject but either a window or worker global object.
132
133         To fix the issue, revert 238677, and fix it by checking whether the dumping of an ArrayBuffer happens for a JSDOMGlobalObject or a JSGlobalObject.
134         If it is the latter, use JSC routines instead of toJS() which requires a JSDOMGlobalObject.
135
136         Covered by updated test.
137
138         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
139         (WebCore::IDBServer::UniqueIDBDatabase::databaseThreadVM):
140         (WebCore::IDBServer::UniqueIDBDatabase::databaseThreadExecState):
141         * bindings/js/JSDOMGlobalObject.cpp:
142         * bindings/js/JSDOMGlobalObject.h:
143         * bindings/js/JSDOMWrapper.cpp:
144         (WebCore::JSDOMObject::JSDOMObject):
145         * bindings/js/SerializedScriptValue.cpp:
146         (WebCore::CloneSerializer::dumpArrayBufferView):
147         (WebCore::CloneSerializer::toJSArrayBuffer):
148
149 2019-01-08  Justin Fan  <justin_fan@apple.com>
150
151         [WebGPU] Update createRenderPipeline for WebGPUPipelineLayout
152         https://bugs.webkit.org/show_bug.cgi?id=193247
153
154         Reviewed by Dean Jackson.
155
156         Add WebGPUPipelineLayout to WebGPURenderPipeline via WebGPUPipelineDescriptorBase.
157
158         Test: Updated render-pipelines.html to test new functionality.
159
160         * Modules/webgpu/WebGPUDevice.cpp:
161         (WebCore::WebGPUDevice::createRenderPipeline const): Convert WebGPUPipelineLayout to GPUPipelineLayout.
162         * Modules/webgpu/WebGPUPipelineDescriptorBase.h:
163         * Modules/webgpu/WebGPUPipelineDescriptorBase.idl: Add layout field.
164         * Modules/webgpu/WebGPUPipelineLayout.h: 
165         (WebCore::WebGPUPipelineLayout::pipelineLayout): Added. Getter.
166         * platform/graphics/gpu/GPUPipelineDescriptorBase.h: Updated from out-of-date version.
167         * platform/graphics/gpu/GPUPipelineLayout.cpp:
168         (WebCore::GPUPipelineLayout::GPUPipelineLayout): Now retains bindGroupLayouts from descriptor.
169         * platform/graphics/gpu/GPUPipelineLayout.h:
170         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Now inherits from GPUPipelineDescriptorBase.
171         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor): Custom constructor for non-aggregate struct.
172
173 2019-01-08  Chris Dumez  <cdumez@apple.com>
174
175         Prevent cross-site top-level navigations from third-party iframes
176         https://bugs.webkit.org/show_bug.cgi?id=193076
177         <rdar://problem/36074736>
178
179         Reviewed by Alex Christensen.
180
181         Prevent cross-site top-level navigations from third-party iframes if the following conditions are met:
182         1. Its tries to navigate the top-level page cross-site (different eTDL+1)
183         2. The user has never interacted with the third-party iframe or any of its subframes
184
185         This experiment's intent is to block suspicious main-frame navigations by third-party content. The feature
186         is behind a runtime experimental feature flag, on by default.
187
188         Tests: http/tests/security/allow-top-level-navigations-by-third-party-iframes-to-same-origin.html
189                http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-previous-user-activation.html
190                http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-user-activation.html
191                http/tests/security/block-top-level-navigations-by-third-party-iframes.html
192
193         * dom/Document.cpp:
194         (WebCore::printNavigationErrorMessage):
195         (WebCore::Document::canNavigate):
196         (WebCore::Document::canNavigateInternal):
197         (WebCore::Document::isNavigationBlockedByThirdPartyIFrameRedirectBlocking):
198         * dom/Document.h:
199         * dom/UserGestureIndicator.cpp:
200         * page/DOMWindow.cpp:
201         (WebCore::DOMWindow::setLocation):
202         * page/DOMWindow.h:
203         * page/Frame.h:
204         * page/Location.cpp:
205         (WebCore::Location::replace):
206         (WebCore::Location::setLocation):
207         * page/Settings.yaml:
208
209 2019-01-08  Alex Christensen  <achristensen@webkit.org>
210
211         Stop using NetworkStorageSession in WebProcess
212         https://bugs.webkit.org/show_bug.cgi?id=193236
213
214         Reviewed by Don Olmstead.
215
216         No change in behavior.  Some code was only used for ResourceHandle, which isn't used in modern WebKit,
217         and for cookies, which are handled in the NetworkProcess in modern WebKit.
218
219         * loader/CookieJar.cpp:
220         (WebCore::storageSession):
221         * loader/EmptyClients.cpp:
222         * platform/network/NetworkingContext.h:
223         * platform/network/mac/ResourceHandleMac.mm:
224         (WebCore::ResourceHandle::createNSURLConnection):
225         (WebCore::ResourceHandle::start):
226         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
227         (WebCore::ResourceHandle::willSendRequest):
228         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
229         (WebCore::ResourceHandle::receivedCredential):
230
231 2019-01-08  Alex Christensen  <achristensen@webkit.org>
232
233         Unreviewed, rolling out r239727.
234
235         Broke API tests
236
237         Reverted changeset:
238
239         "Stop using NetworkStorageSession in WebProcess"
240         https://bugs.webkit.org/show_bug.cgi?id=193236
241         https://trac.webkit.org/changeset/239727
242
243 2019-01-08  Alex Christensen  <achristensen@webkit.org>
244
245         Stop using NetworkStorageSession in WebProcess
246         https://bugs.webkit.org/show_bug.cgi?id=193236
247
248         Reviewed by Don Olmstead.
249
250         No change in behavior.  Some code was only used for ResourceHandle, which isn't used in modern WebKit,
251         and for cookies, which are handled in the NetworkProcess in modern WebKit.
252
253         * loader/CookieJar.cpp:
254         (WebCore::storageSession):
255         * loader/EmptyClients.cpp:
256         * platform/network/NetworkingContext.h:
257         * platform/network/mac/ResourceHandleMac.mm:
258         (WebCore::ResourceHandle::createNSURLConnection):
259         (WebCore::ResourceHandle::start):
260         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
261         (WebCore::ResourceHandle::willSendRequest):
262         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
263         (WebCore::ResourceHandle::receivedCredential):
264
265 2019-01-08  Chris Dumez  <cdumez@apple.com>
266
267         Regression(PSON-r239182): Blank view when navigating back and forth between google.com and stack overflow
268         https://bugs.webkit.org/show_bug.cgi?id=193224
269         <rdar://problem/47097726>
270
271         Reviewed by Alex Christensen.
272
273         Since r239182, pages get suspended in-place when we suspend the old process after a process-swap on navigation.
274         When we return to a suspended page, we load the current history item again and it normally properly restores
275         the page from PageCache, even though we load the same history item and the current one and even though the
276         page is suspended in-place (i.e. we did not navigate away, which is the usual case for page cache).
277
278         The issue is that if the page URL contains a fragment, FrameLoader::shouldPerformFragmentNavigation() would
279         return true because both the source and destination URLs (which are the same) contains a fragment. To address
280         the issue, update FrameLoader::shouldPerformFragmentNavigation() to return false if the current page is
281         suspended.
282
283         * loader/FrameLoader.cpp:
284         (WebCore::FrameLoader::shouldPerformFragmentNavigation):
285
286 2019-01-08  Alex Christensen  <achristensen@webkit.org>
287
288         Move Windows-specific code from NetworkStorageSessionCFNet.cpp to its own file
289         https://bugs.webkit.org/show_bug.cgi?id=192958
290
291         Reviewed by Yusuke Suzuki.
292
293         This makes it easier to reason about what code is used where.
294
295         * PlatformAppleWin.cmake:
296         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
297         (WebCore::createPrivateStorageSession): Deleted.
298         (WebCore::cookieDomain): Deleted.
299         (WebCore::canonicalCookieTime): Deleted.
300         (WebCore::cookieCreatedTime): Deleted.
301         (WebCore::cookieExpirationTime): Deleted.
302         (WebCore::cookieName): Deleted.
303         (WebCore::cookiePath): Deleted.
304         (WebCore::cookieValue): Deleted.
305         (WebCore::filterCookies): Deleted.
306         (WebCore::copyCookiesForURLWithFirstPartyURL): Deleted.
307         (WebCore::createCookies): Deleted.
308         (WebCore::NetworkStorageSession::setCookiesFromDOM const): Deleted.
309         (WebCore::containsSecureCookies): Deleted.
310         (WebCore::NetworkStorageSession::cookiesForDOM const): Deleted.
311         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const): Deleted.
312         (WebCore::NetworkStorageSession::cookiesEnabled const): Deleted.
313         (WebCore::NetworkStorageSession::getRawCookies const): Deleted.
314         (WebCore::NetworkStorageSession::deleteCookie const): Deleted.
315         (WebCore::NetworkStorageSession::getHostnamesWithCookies): Deleted.
316         (WebCore::NetworkStorageSession::deleteAllCookies): Deleted.
317         (WebCore::NetworkStorageSession::deleteCookiesForHostnames): Deleted.
318         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince): Deleted.
319         * platform/network/cf/NetworkStorageSessionCFNetWin.cpp: Added.
320         (WebCore::createPrivateStorageSession):
321         (WebCore::NetworkStorageSession::setCookies):
322         (WebCore::cookieDomain):
323         (WebCore::canonicalCookieTime):
324         (WebCore::cookieCreatedTime):
325         (WebCore::cookieExpirationTime):
326         (WebCore::cookieName):
327         (WebCore::cookiePath):
328         (WebCore::cookieValue):
329         (WebCore::filterCookies):
330         (WebCore::copyCookiesForURLWithFirstPartyURL):
331         (WebCore::createCookies):
332         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
333         (WebCore::containsSecureCookies):
334         (WebCore::NetworkStorageSession::cookiesForDOM const):
335         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
336         (WebCore::NetworkStorageSession::cookiesEnabled const):
337         (WebCore::NetworkStorageSession::getRawCookies const):
338         (WebCore::NetworkStorageSession::deleteCookie const):
339         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
340         (WebCore::NetworkStorageSession::deleteAllCookies):
341         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
342         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
343
344 2018-12-19  Antoine Quint  <graouts@apple.com>
345
346         [Web Animations] Compute animation effect timing properties in batch
347         https://bugs.webkit.org/show_bug.cgi?id=192850
348
349         Reviewed by Dean Jackson.
350
351         We remove a host of functions from AnimationEffect that would allow the computation of various timing properties
352         defined by the Web Animations specification: phase, progress, current iteration, etc. Indeed, a lot of these functions
353         would call each other in a chain, and we would re-compute a lot of the earlier properties in those chains several times
354         when doing something like querying the animation progress. Additionally, some functions, such as WebAnimation::computeRelevance()
355         and WebAnimation::timeToNextTick() would yield the computation of several such properties numerous times. All of those
356         functions are called during each animation frame and are ripe for optimizations.
357
358         We now compute all timing properties across two functions:
359         
360         1. the new AnimationEffect::getBasicTiming() which computes the local time, end time, active duration, active time and phase,
361         2. the existing AnimationEffect::getComputedTiming() which now also exposes the phase and simple iteration progress.
362
363         To support this we introduce a new BasicEffectTiming struct to contain the values computed in AnimationEffect::getBasicTiming()
364         and spun the AnimationEffect::Phase struct as AnimationEffectPhase so that it may be used across BasicEffectTiming and
365         ComputedEffectTiming.
366
367         No new test since there is no user-observable change.
368
369         * WebCore.xcodeproj/project.pbxproj:
370         * animation/AnimationEffect.cpp:
371         (WebCore::AnimationEffect::getTiming const):
372         (WebCore::AnimationEffect::getBasicTiming const):
373         (WebCore::AnimationEffect::getComputedTiming const):
374         (WebCore::AnimationEffect::localTime const): Deleted.
375         (WebCore::AnimationEffect::phase const): Deleted.
376         (WebCore::AnimationEffect::activeTime const): Deleted.
377         (WebCore::AnimationEffect::overallProgress const): Deleted.
378         (WebCore::AnimationEffect::simpleIterationProgress const): Deleted.
379         (WebCore::AnimationEffect::currentIteration const): Deleted.
380         (WebCore::AnimationEffect::currentDirection const): Deleted.
381         (WebCore::AnimationEffect::directedProgress const): Deleted.
382         (WebCore::AnimationEffect::transformedProgress const): Deleted.
383         (WebCore::AnimationEffect::iterationProgress const): Deleted.
384         (WebCore::AnimationEffect::getTiming): Deleted.
385         (WebCore::AnimationEffect::getComputedTiming): Deleted.
386         (WebCore::AnimationEffect::endTime const): Deleted.
387         (WebCore::AnimationEffect::activeDuration const): Deleted.
388         * animation/AnimationEffect.h:
389         * animation/AnimationEffectPhase.h: Copied from Source/WebCore/animation/ComputedEffectTiming.h.
390         * animation/AnimationTimeline.cpp:
391         (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
392         * animation/AnimationTimeline.h:
393         * animation/BasicEffectTiming.h: Copied from Source/WebCore/animation/ComputedEffectTiming.h.
394         * animation/ComputedEffectTiming.h:
395         * animation/DeclarativeAnimation.cpp:
396         (WebCore::DeclarativeAnimation::cancel):
397         (WebCore::DeclarativeAnimation::phaseWithoutEffect const):
398         (WebCore::DeclarativeAnimation::invalidateDOMEvents):
399         * animation/DeclarativeAnimation.h:
400         * animation/KeyframeEffect.cpp:
401         (WebCore::KeyframeEffect::apply):
402         (WebCore::KeyframeEffect::getAnimatedStyle):
403         * animation/WebAnimation.cpp:
404         (WebCore::WebAnimation::effectEndTime const):
405         (WebCore::WebAnimation::computeRelevance):
406         (WebCore::WebAnimation::timeToNextTick const):
407
408 2019-01-07  Youenn Fablet  <youenn@apple.com>
409
410         Crash in SWServer::Connection::resolveRegistrationReadyRequests
411         https://bugs.webkit.org/show_bug.cgi?id=193217
412
413         Reviewed by Chris Dumez.
414
415         As can be seen from the traces, SWServer might clear its connections HashMap in its destructor.
416         This might then trigger calling SWServer::resolveRegistrationReadyRequests.
417         This method is iterating on the connections HashMap which is being cleared.
418         To remove this problem, move the HashMap in a temporary variable and clear the temporary variable.
419
420         * workers/service/server/SWServer.cpp:
421         (WebCore::SWServer::~SWServer):
422
423 2019-01-07  Jer Noble  <jer.noble@apple.com>
424
425         REGRESSION (r239519): ASSERTION FAILED: !m_adoptionIsRequired in com.apple.WebCore: void WTF::refIfNotNull<WebCore::CDMSessionMediaSourceAVFObjC> + 53
426         https://bugs.webkit.org/show_bug.cgi?id=193211
427         <rdar://problem/46937412>
428
429         Reviewed by Eric Carlson.
430
431         Make CDMSessionMediaSourceAVFObjC a CanMakeWeakPtr rather than RefCounted, as CDMSessions are stored in
432         std::unique_ptrs, and not in Ref or RefPtr.
433
434         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
435         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
436         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
437         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession):
438
439 2019-01-07  David Kilzer  <ddkilzer@apple.com>
440
441         Prefer RetainPtr<NSObject> to RetainPtr<NSObject *>
442         <https://webkit.org/b/193056>
443
444         Reviewed by Alex Christensen.
445
446         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
447         (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:]):
448         (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:withDiscontinuity:]):
449         * platform/network/cf/AuthenticationChallenge.h:
450         - Remove '*' from RetainPtr<> type.
451
452         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
453         (WebCore::cookiesForURL):
454         - Once retainPtr() was changed to return RetainPtr<NSArray>
455           instead of RetainPtr<NSArray *> here, that forced the type of
456           `cookiesPtr` to change as well since
457           Optional<RetainPtr<NSArray>> is not assignable to
458           Optional<RetainPtr<NSArray *>> without further template
459           specialization, which didn't seem useful since
460           Optional<RetainPtr<>> variable types are rarely used.
461
462 2019-01-07  Devin Rousso  <drousso@apple.com>
463
464         Web Inspector: extend XHR breakpoints to work with fetch
465         https://bugs.webkit.org/show_bug.cgi?id=185843
466         <rdar://problem/40431027>
467
468         Reviewed by Matt Baker.
469
470         Test: inspector/dom-debugger/url-breakpoints.html
471
472         * Modules/fetch/FetchResponse.cpp:
473         (WebCore::FetchResponse::fetch):
474
475         * inspector/InspectorInstrumentation.h:
476         (WebCore::InspectorInstrumentation::willFetch): Added.
477         * inspector/InspectorInstrumentation.cpp:
478         (WebCore::InspectorInstrumentation::willFetchImpl): Added.
479
480         * inspector/agents/InspectorDOMDebuggerAgent.h:
481         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
482         (WebCore::InspectorDOMDebuggerAgent::disable):
483         (WebCore::InspectorDOMDebuggerAgent::discardBindings):
484         (WebCore::InspectorDOMDebuggerAgent::setURLBreakpoint): Added.
485         (WebCore::InspectorDOMDebuggerAgent::removeURLBreakpoint): Added.
486         (WebCore::InspectorDOMDebuggerAgent::breakOnURLIfNeeded): Added.
487         (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
488         (WebCore::InspectorDOMDebuggerAgent::willFetch): Added.
489         (WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint): Deleted.
490         (WebCore::InspectorDOMDebuggerAgent::removeXHRBreakpoint): Deleted.
491
492 2019-01-07  Eric Carlson  <eric.carlson@apple.com>
493
494         Cleanup AudioTrackPrivateMediaStreamCocoa
495         https://bugs.webkit.org/show_bug.cgi?id=193208
496         <rdar://problem/42225870>
497
498         Reviewed by Youenn Fablet.
499
500         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
501         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable): Clear input and
502         output format descriptions after stopping the audio unit.
503
504 2019-01-07  Devin Rousso  <drousso@apple.com>
505
506         Web Inspector: Network: show secure connection details per-request
507         https://bugs.webkit.org/show_bug.cgi?id=191539
508         <rdar://problem/45979891>
509
510         Reviewed by Joseph Pecoraro.
511
512         Test: http/tests/inspector/network/resource-security-connection.html
513
514         * platform/network/NetworkLoadMetrics.h:
515         (WebCore::NetworkLoadMetrics:isolatedCopy):
516         (WebCore::NetworkLoadMetrics:clearNonTimingData):
517         (WebCore::NetworkLoadMetrics:operator==):
518         (WebCore::NetworkLoadMetrics:encode):
519         (WebCore::NetworkLoadMetrics:decode):
520
521         * inspector/agents/InspectorNetworkAgent.cpp:
522         (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
523
524 2019-01-07  Eric Carlson  <eric.carlson@apple.com>
525
526         Deactivate audio session whenever possible
527         https://bugs.webkit.org/show_bug.cgi?id=193188
528         <rdar://problem/42678977>
529
530         Reviewed by Jer Noble.
531
532         Test: media/deactivate-audio-session.html
533
534         * platform/audio/AudioSession.cpp:
535         (WebCore::AudioSession::tryToSetActive):
536         (WebCore::AudioSession::tryToSetActiveInternal):
537         * platform/audio/AudioSession.h:
538         (WebCore::AudioSession::isActive const):
539
540         * platform/audio/PlatformMediaSessionManager.cpp:
541         (WebCore::PlatformMediaSessionManager::removeSession):
542         (WebCore::deactivateAudioSession):
543         (WebCore::PlatformMediaSessionManager::shouldDeactivateAudioSession):
544         (WebCore::PlatformMediaSessionManager::setShouldDeactivateAudioSession):
545         * platform/audio/PlatformMediaSessionManager.h:
546
547         * platform/audio/ios/AudioSessionIOS.mm:
548         (WebCore::AudioSession::tryToSetActiveInternal):
549         (WebCore::AudioSession::tryToSetActive): Deleted.
550
551         * platform/audio/mac/AudioSessionMac.cpp:
552         (WebCore::AudioSession::tryToSetActiveInternal):
553         (WebCore::AudioSession::tryToSetActive): Deleted.
554
555         * testing/Internals.cpp:
556         (WebCore::Internals::audioSessionActive const):
557         * testing/Internals.h:
558         * testing/Internals.idl:
559
560 2019-01-07  David Kilzer  <ddkilzer@apple.com>
561
562         PlatformECKey should use a std::unique_ptr
563         <https://webkit.org/b/193170>
564
565         Reviewed by Brent Fulgham.
566
567         Broadly:
568         - Switch from using raw pointers to using std::unique_ptr<> to
569           hold PlatformECKey.
570         - Introduce PlatformECKeyContainer type to handle different
571           std::unique_ptr<> types on each platform.
572         - Get rid of custom CryptoKeyEC destructors since the
573           std::unique_ptr<> handles that with a Deleter.
574         - Initialize stack variables to nullptr.
575
576         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
577         (WebCore::CryptoKeyEC::keySizeInBits const):
578         (WebCore::CryptoKeyEC::platformGeneratePair):
579         (WebCore::CryptoKeyEC::platformImportRaw):
580         (WebCore::CryptoKeyEC::platformImportJWKPublic):
581         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
582         (WebCore::CryptoKeyEC::platformImportSpki):
583         (WebCore::CryptoKeyEC::platformImportPkcs8):
584         (WebCore::CryptoKeyEC::platformExportRaw const):
585         (WebCore::CryptoKeyEC::platformAddFieldElements const):
586         (WebCore::CryptoKeyEC::platformExportSpki const):
587         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
588         (WebCore::CryptoKeyEC::~CryptoKeyEC): Deleted.
589         * crypto/keys/CryptoKeyEC.cpp:
590         (WebCore::CryptoKeyEC::CryptoKeyEC):
591         * crypto/keys/CryptoKeyEC.h:
592         (WebCore::CCECCryptorRefDeleter::operator() const):
593         * crypto/mac/CryptoKeyECMac.cpp:
594         (WebCore::CryptoKeyEC::keySizeInBits const):
595         (WebCore::CryptoKeyEC::platformGeneratePair):
596         (WebCore::CryptoKeyEC::platformImportRaw):
597         (WebCore::CryptoKeyEC::platformExportRaw const):
598         (WebCore::CryptoKeyEC::platformImportJWKPublic):
599         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
600         (WebCore::CryptoKeyEC::platformAddFieldElements const):
601         (WebCore::CryptoKeyEC::platformImportSpki):
602         (WebCore::CryptoKeyEC::platformExportSpki const):
603         (WebCore::CryptoKeyEC::platformImportPkcs8):
604         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
605         (WebCore::CryptoKeyEC::~CryptoKeyEC): Deleted.
606
607 2019-01-07  Antti Koivisto  <antti@apple.com>
608
609         UI process side scrollbars for UI side compositing on Mac
610         https://bugs.webkit.org/show_bug.cgi?id=193106
611
612         Reviewed by Tim Horton.
613
614         * page/FrameView.cpp:
615         (WebCore::FrameView::paintScrollCorner):
616         * page/scrolling/AsyncScrollingCoordinator.cpp:
617         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
618
619         Pass scrollbar host layers and the dark appearance bit to the scrolling tree.
620
621         * page/scrolling/ScrollingCoordinator.cpp:
622         (WebCore::ScrollingCoordinator::verticalScrollbarLayerForFrameView):
623         (WebCore::ScrollingCoordinator::horizontalScrollbarLayerForFrameView):
624         * page/scrolling/ScrollingCoordinator.h:
625         (WebCore::ScrollableAreaParameters::ScrollableAreaParameters):
626         (WebCore::ScrollableAreaParameters::operator== const):
627         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
628         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
629         (WebCore::ScrollingStateFrameScrollingNode::setScrollbarLayers):
630         * page/scrolling/ScrollingStateFrameScrollingNode.h:
631         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
632         * page/scrolling/ScrollingTreeScrollingNode.h:
633         (WebCore::ScrollingTreeScrollingNode::scrollableAreaSize const):
634         (WebCore::ScrollingTreeScrollingNode::totalContentsSize const):
635         (WebCore::ScrollingTreeScrollingNode::useDarkAppearanceForScrollbars const):
636         (WebCore::ScrollingTreeScrollingNode::lastCommittedScrollPosition const):
637         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
638         * platform/ScrollableArea.cpp:
639         (WebCore::ScrollableArea::useDarkAppearanceForScrollbars const):
640
641         Factor into a function as this is used in several places.
642
643         * platform/ScrollableArea.h:
644         * platform/mac/NSScrollerImpDetails.h:
645         * platform/mac/ScrollAnimatorMac.mm:
646         (-[WebScrollerImpDelegate effectiveAppearanceForScrollerImp:]):
647         * platform/mac/ScrollbarThemeMac.h:
648
649 2019-01-07  Wenson Hsieh  <wenson_hsieh@apple.com>
650
651         Native caret shows up alongside the page's caret when requesting desktop site on jsfiddle.net
652         https://bugs.webkit.org/show_bug.cgi?id=193180
653         <rdar://problem/45971041>
654
655         Reviewed by Tim Horton.
656
657         Adjust a method on RenderObject to additionally detect when the RenderObject is inside of an `overflow: hidden`
658         container that is also empty. See WebKit ChangeLog for more details.
659
660         Test:   editing/selection/ios/hide-selection-in-empty-overflow-hidden-container.html
661                 editing/selection/ios/show-selection-in-empty-overflow-hidden-document.html
662
663         * rendering/RenderObject.cpp:
664         (WebCore::RenderObject::isTransparentOrFullyClippedRespectingParentFrames const):
665         (WebCore::RenderObject::isTransparentRespectingParentFrames const): Deleted.
666         * rendering/RenderObject.h:
667
668 2019-01-07  Zalan Bujtas  <zalan@apple.com>
669
670         [LFC][BFC] Margin collapsing should not be limited to in-flow non-replaced boxes.
671         https://bugs.webkit.org/show_bug.cgi?id=193183
672
673         Reviewed by Antti Koivisto.
674
675         * layout/FormattingContext.cpp:
676         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
677         * layout/FormattingContextGeometry.cpp:
678         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
679         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
680         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
681         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
682         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
683         * layout/LayoutUnits.h:
684         * layout/blockformatting/BlockFormattingContext.cpp:
685         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
686         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
687         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
688         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
689         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
690         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedHeight):
691         * layout/inlineformatting/InlineFormattingContext.cpp:
692         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
693
694 2019-01-07  Zalan Bujtas  <zalan@apple.com>
695
696         [LFC][BFC] Move MarginCollapse from BlockFormattingContext::Geometry to BlockFormattingContext
697         https://bugs.webkit.org/show_bug.cgi?id=193181
698
699         Reviewed by Antti Koivisto.
700
701         This is in preparation to share margin collapsing across all boxes in block formatting context.
702
703         * layout/blockformatting/BlockFormattingContext.h:
704         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
705         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
706         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
707         * layout/blockformatting/BlockMarginCollapse.cpp:
708         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBefore):
709         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginAfter):
710         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBefore):
711         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginAfter):
712         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBeforeFromFirstChild):
713         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginAfterFromLastChild):
714         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter):
715         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore):
716         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance):
717         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginBefore):
718         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginAfter):
719         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSibling):
720         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSibling):
721         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
722         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBefore):
723         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfter):
724         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBefore): Deleted.
725         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginAfter): Deleted.
726         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBefore): Deleted.
727         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginAfter): Deleted.
728         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBeforeFromFirstChild): Deleted.
729         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginAfterFromLastChild): Deleted.
730         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter): Deleted.
731         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore): Deleted.
732         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance): Deleted.
733         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginBefore): Deleted.
734         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginAfter): Deleted.
735         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithPreviousSibling): Deleted.
736         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithNextSibling): Deleted.
737         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginsCollapseThrough): Deleted.
738         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBefore): Deleted.
739         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfter): Deleted.
740
741 2019-01-07  Zan Dobersek  <zdobersek@igalia.com>
742
743         [WPE] Use Widget bounds for PlatformScreen rectangle information
744         https://bugs.webkit.org/show_bug.cgi?id=193190
745
746         Reviewed by Philippe Normand.
747
748         Provide a better screen area estimate in screenRect() and
749         screenAvailableRect() return values than the current 1240x640 value by
750         using the Widget's bounds rectangle.
751
752         This approach is only factually correct when the Widget-associated view
753         is displayed in fullscreen, but it provides a better estimate even when
754         displayed in any other case as well. WPE doesn't provide specific API
755         that could enable the embedding environment to provide this information.
756
757         * platform/wpe/PlatformScreenWPE.cpp:
758         (WebCore::screenRect): Return bounds of the Widget object.
759         (WebCore::screenAvailableRect): Relay the call to screenRect().
760
761 2019-01-07  Zan Dobersek  <zdobersek@igalia.com>
762
763         Make Gradient::gradientSpaceTransform(), Pattern::patternSpaceTransform() methods const
764         https://bugs.webkit.org/show_bug.cgi?id=193189
765
766         Reviewed by Philippe Normand.
767
768         The transform getter methods on the Gradient and Pattern classes both
769         return const references to the transform objects, and don't modify any
770         internal state. They should be marked const accordingly, allowing
771         invocations of these two methods through const references to Gradient
772         and Pattern objects.
773
774         * platform/graphics/Gradient.h:
775         (WebCore::Gradient::gradientSpaceTransform): Now const.
776         * platform/graphics/Pattern.h:
777         (WebCore::Pattern::patternSpaceTransform): Now const.
778
779 2019-01-07  Zan Dobersek  <zdobersek@igalia.com>
780
781         REGRESSION(r239636): ImageDecoder::setEncodedDataStatusChangeCallback() can be called on a null decoder
782         https://bugs.webkit.org/show_bug.cgi?id=193187
783
784         Reviewed by Philippe Normand.
785
786         * platform/graphics/ImageSource.cpp:
787         (WebCore::ImageSource::ensureDecoderAvailable): Bail before calling the
788         setEncodedDataStatusChangeCallback() method when the returned
789         ImageDecoder object is null.
790
791 2019-01-06  Zan Dobersek  <zdobersek@igalia.com>
792
793         [Nicosia] Take over CoordinatedGraphics-named implementation of async scrolling classes
794         https://bugs.webkit.org/show_bug.cgi?id=193133
795
796         Reviewed by Michael Catanzaro.
797
798         Move the CoordinatedGraphics-specific files under
799         page/scrolling/coordinatedgraphics/ to page/scrolling/nicosia/, along
800         with renaming the files and classes accordingly. Implementation will
801         only depend on the Nicosia-specific layer structure and is not specific
802         to the CoordinatedGraphics system.
803
804         * PlatformPlayStation.cmake:
805         * SourcesGTK.txt:
806         * SourcesWPE.txt:
807         * page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp.
808         * page/scrolling/nicosia/ScrollingCoordinatorNicosia.h: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h.
809         * page/scrolling/nicosia/ScrollingStateNodeNicosia.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp.
810         * page/scrolling/nicosia/ScrollingTreeFixedNode.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.cpp.
811         * page/scrolling/nicosia/ScrollingTreeFixedNode.h: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.h.
812         * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.cpp.
813         * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.h.
814         * page/scrolling/nicosia/ScrollingTreeNicosia.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.cpp.
815         * page/scrolling/nicosia/ScrollingTreeNicosia.h: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.h.
816         * page/scrolling/nicosia/ScrollingTreeStickyNode.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.cpp.
817         * page/scrolling/nicosia/ScrollingTreeStickyNode.h: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.h.
818         * platform/TextureMapper.cmake:
819
820 2019-01-06  Jiewen Tan  <jiewen_tan@apple.com>
821
822         [WebAuthN] Import U2F command/response converters from Chromium
823         https://bugs.webkit.org/show_bug.cgi?id=193150
824         <rdar://problem/47054028>
825
826         Reviewed by Brent Fulgham.
827
828         This patch imports Chromium's U2F command/response converters:
829         https://fidoalliance.org/specs/fido-v2.0-id-20180227/fido-client-to-authenticator-protocol-v2.0-id-20180227.html#u2f-interoperability
830         1. It directly imports the following files and suit them to WebKit's coding style:
831         https://cs.chromium.org/chromium/src/device/fido/u2f_command_constructor.cc?l=1&rcl=db624110317d01efa78cd32e7be1524190e1beb0
832         https://cs.chromium.org/chromium/src/device/fido/u2f_command_constructor.h?rcl=db624110317d01efa78cd32e7be1524190e1beb0
833         https://cs.chromium.org/chromium/src/device/fido/u2f_command_constructor_unittest.cc?rcl=db624110317d01efa78cd32e7be1524190e1beb0
834         2. It gathers the following methods into U2fResponseConverter:
835         AuthenticatorMakeCredentialResponse::CreateFromU2fRegisterResponse()
836         AuthenticatorGetAssertionResponse::CreateFromU2fSignResponse()
837         3. It also updates FidoConstants.h, FidoTestData.h and CtapResponseTest.cpp accordingly.
838
839         Besides importing stuff from Chroimum, it also gathers a bunch of constants and helper functions into WebAuthenticationConstants.h
840         and WebAuthenticationUtils.h. It also fixes Bug 183534: 2) and 7).
841
842         Covered by API tests.
843
844         * Modules/webauthn/AuthenticatorCoordinator.cpp:
845         (WebCore::AuthenticatorCoordinatorInternal::produceClientDataJsonHash):
846         * Modules/webauthn/WebAuthenticationConstants.h: Copied from Source/WebCore/Modules/webauthn/COSEConstants.h.
847         * Modules/webauthn/WebAuthenticationUtils.cpp: Added.
848         (WebCore::convertBytesToVector):
849         (WebCore::produceRpIdHash):
850         (WebCore::encodeES256PublicKeyAsCBOR):
851         (WebCore::buildAttestedCredentialData):
852         (WebCore::buildAuthData):
853         (WebCore::buildAttestationObject):
854         * Modules/webauthn/WebAuthenticationUtils.h: Renamed from Source/WebCore/Modules/webauthn/COSEConstants.h.
855         * Modules/webauthn/fido/DeviceResponseConverter.cpp:
856         (fido::getCredentialId):
857         (fido::readCTAPGetInfoResponse):
858         * Modules/webauthn/fido/FidoConstants.h:
859         * Modules/webauthn/fido/U2fCommandConstructor.cpp: Added.
860         (fido::WebCore::constructU2fRegisterCommand):
861         (fido::WebCore::constructU2fSignCommand):
862         (fido::isConvertibleToU2fRegisterCommand):
863         (fido::isConvertibleToU2fSignCommand):
864         (fido::convertToU2fRegisterCommand):
865         (fido::convertToU2fCheckOnlySignCommand):
866         (fido::convertToU2fSignCommand):
867         (fido::constructBogusU2fRegistrationCommand):
868         * Modules/webauthn/fido/U2fCommandConstructor.h: Added.
869         * Modules/webauthn/fido/U2fResponseConverter.cpp: Added.
870         (fido::WebCore::extractECPublicKeyFromU2fRegistrationResponse):
871         (fido::WebCore::extractCredentialIdFromU2fRegistrationResponse):
872         (fido::WebCore::createAttestedCredentialDataFromU2fRegisterResponse):
873         (fido::WebCore::parseX509Length):
874         (fido::WebCore::createFidoAttestationStatementFromU2fRegisterResponse):
875         (fido::readU2fRegisterResponse):
876         (fido::readFromU2fSignResponse):
877         * Modules/webauthn/fido/U2fResponseConverter.h: Added.
878         * Modules/webgpu/WebGPUCommandBuffer.cpp:
879         * Sources.txt:
880         * WebCore.xcodeproj/project.pbxproj:
881
882 2019-01-06  David Kilzer  <ddkilzer@apple.com>
883
884         Leak of WTF::Function objects in WebCore::CryptoKeyRSA::generatePair() (64-80 bytes each) in com.apple.WebKit.WebContent running WebKit layout tests
885         <https://webkit.org/b/193177>
886         <rdar://problem/47072196>
887
888         Reviewed by Saam Barati.
889
890         * crypto/mac/CryptoKeyRSAMac.cpp:
891         (WebCore::CryptoKeyRSA::generatePair): Fix the leak by changing
892         raw pointers to heap-allocated __block variables to hold the
893         WTF::Function objects until they are consumed within the block
894         passed to dispatch_async().  The __block variables act like
895         captured variables in a C++ lambda and have the same lifetime as
896         the block that they are captured in.  Note that we would have to
897         convert the source file from C++ to Objective-C++ to use a C++
898         lambda functor with dispatch_async(), which creates its own
899         issue because the comipiler requires a copy constructor to
900         convert the C++ lambda to a block functor, but the copy
901         constructor for the C++ lambda is implicitly deleted because the
902         WTF::Function copy constructor is explicitly deleted.  Whew!
903
904 2019-01-06  Pablo Saavedra  <psaavedra@igalia.com>
905
906         [WPE][GTK] Building with ENABLE_VIDEO=OFF fails trying to use Document MediaPlayback functions.
907         https://bugs.webkit.org/show_bug.cgi?id=193174
908
909         Reviewed by Michael Catanzaro.
910
911         * page/Page.cpp:
912         (WebCore::Page::stopAllMediaPlayback):
913         (WebCore::Page::suspendAllMediaPlayback):
914         (WebCore::Page::resumeAllMediaPlayback):
915
916 2019-01-05  David Kilzer  <ddkilzer@apple.com>
917
918         Leak of two CCRSACryptorRef (4.0 Kbytes/1 page each) in com.apple.WebKit.WebContent running WebKit layout tests
919         <https://webkit.org/b/193154>
920         <rdar://problem/47052993>
921
922         Reviewed by Brent Fulgham.
923
924         Broadly:
925         - Fix leaks by switching from using raw pointers to using
926           std::unique_ptr<>.
927         - Introduce PlatformRSAKeyContainer type to handle different
928           std::unique_ptr<> on each platform.
929         - Get rid of custom CryptoKeyRSA destructors since the
930           std::unique_ptr<> handles that with a Deleter.
931         - Initialize stack variables to nullptr.
932
933         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
934         (WebCore::CryptoKeyRSA::create):
935         (WebCore::CryptoKeyRSA::CryptoKeyRSA):
936         (WebCore::CryptoKeyRSA::keySizeInBits const):
937         (WebCore::CryptoKeyRSA::generatePair):
938         (WebCore::CryptoKeyRSA::importSpki):
939         (WebCore::CryptoKeyRSA::importPkcs8):
940         (WebCore::CryptoKeyRSA::exportSpki const):
941         (WebCore::CryptoKeyRSA::exportPkcs8 const):
942         (WebCore::CryptoKeyRSA::algorithm const):
943         (WebCore::CryptoKeyRSA::exportData const):
944         (WebCore::CryptoKeyRSA::~CryptoKeyRSA): Deleted.
945         * crypto/keys/CryptoKeyRSA.h:
946         (WebCore::CCRSACryptorRefDeleter::operator() const):
947         * crypto/mac/CryptoKeyRSAMac.cpp:
948         (WebCore::getPublicKeyComponents):
949         (WebCore::getPrivateKeyComponents):
950         (WebCore::CryptoKeyRSA::CryptoKeyRSA):
951         (WebCore::CryptoKeyRSA::create):
952         (WebCore::CryptoKeyRSA::exportData const):
953         (WebCore::CryptoKeyRSA::generatePair):
954         (WebCore::CryptoKeyRSA::importSpki):
955         (WebCore::CryptoKeyRSA::importPkcs8):
956         (WebCore::CryptoKeyRSA::~CryptoKeyRSA): Deleted.
957
958 2019-01-05  Zalan Bujtas  <zalan@apple.com>
959
960         Incorrect clipping across compositing boundary.
961         https://bugs.webkit.org/show_bug.cgi?id=193172
962         <rdar://problem/44693008>
963
964         Reviewed by Simon Fraser.
965
966         Use temporary cliprect type when crossing compositing boundary to prevent cliprect caching.
967
968         The issue here is that RenderLayer::backgroundClipRect() could cross compositing boundary by calling parentClipRects() which triggers
969         clip rect update using the wrong painting root. This happens when the layer hierarchy and the compositing context do not match.
970         For clip rect computation, we need to climb up on the layer hierarchy (calling parent layer's cliprect functions)
971         but we also need to make sure that the computed cliprects on any given layer are cached only when the painting root is correct.
972         It ensures that when we paint a layer (with the painting root as entry point), the cached cliprects are always based on its onw painting root. 
973
974         Test: compositing/clipping/cached-cliprect-with-compositing-boundary.html
975
976         * rendering/RenderLayer.cpp:
977         (WebCore::RenderLayer::calculateClipRects const):
978
979 2019-01-05  Youenn Fablet  <youenn@apple.com>
980
981         Service Worker fetch should obey its referrer policy
982         https://bugs.webkit.org/show_bug.cgi?id=193152
983
984         Reviewed by Chris Dumez.
985
986         Pass referrer policy retrieved when fetching the service worker script to the SWServer.
987         The SWServer then stores it persistently and sends it to the manager creating service workers.
988         This manager will then set the referrer policy on the dummy Document of the corresponding service worker.
989
990         Covered by rebased test.
991
992         * workers/WorkerScriptLoader.cpp:
993         (WebCore::WorkerScriptLoader::didReceiveResponse):
994         * workers/WorkerScriptLoader.h:
995         (WebCore::WorkerScriptLoader::referrerPolicy const):
996         * workers/service/SWClientConnection.cpp:
997         (WebCore::SWClientConnection::failedFetchingScript):
998         * workers/service/ServiceWorkerContainer.cpp:
999         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1000         * workers/service/ServiceWorkerContainer.h:
1001         * workers/service/ServiceWorkerContextData.cpp:
1002         (WebCore::ServiceWorkerContextData::isolatedCopy const):
1003         * workers/service/ServiceWorkerContextData.h:
1004         (WebCore::ServiceWorkerContextData::encode const):
1005         (WebCore::ServiceWorkerContextData::decode):
1006         * workers/service/ServiceWorkerFetchResult.h:
1007         (WebCore::ServiceWorkerFetchResult::encode const):
1008         (WebCore::ServiceWorkerFetchResult::decode):
1009         * workers/service/ServiceWorkerJob.cpp:
1010         (WebCore::ServiceWorkerJob::notifyFinished):
1011         * workers/service/ServiceWorkerJobClient.h:
1012         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1013         (WebCore::createPageForServiceWorker):
1014         * workers/service/server/RegistrationDatabase.cpp:
1015         (WebCore::recordsTableSchema):
1016         (WebCore::RegistrationDatabase::doPushChanges):
1017         (WebCore::RegistrationDatabase::importRecords):
1018         * workers/service/server/SWServer.cpp:
1019         (WebCore::SWServer::addRegistrationFromStore):
1020         (WebCore::SWServer::updateWorker):
1021         (WebCore::SWServer::installContextData):
1022         * workers/service/server/SWServer.h:
1023         * workers/service/server/SWServerJobQueue.cpp:
1024         (WebCore::SWServerJobQueue::scriptFetchFinished):
1025         * workers/service/server/SWServerWorker.cpp:
1026         (WebCore::SWServerWorker::SWServerWorker):
1027         (WebCore::SWServerWorker::contextData const):
1028         * workers/service/server/SWServerWorker.h:
1029
1030 2019-01-04  Simon Fraser  <simon.fraser@apple.com>
1031
1032         Factor legacy WK1 code for fixed and scrolling layers into their own helper class
1033         https://bugs.webkit.org/show_bug.cgi?id=193165
1034
1035         Reviewed by Frédéric Wang.
1036
1037         RenderLayerCompositor has some code to handle registration of viewport-constrained
1038         and scrolling layers which is specific to iOS WK1. To reduce pollution, move this
1039         into its own helper class called LegacyWebKitScrollingLayerCoordinator, which is only
1040         allocated for iOS WK1.
1041         
1042         iOS WK1 never has a ScrollingCoordinator, so rather than the check for scrollingCoordinator(),
1043         we know that we only made a LegacyWebKitScrollingLayerCoordinator when there's a platform widget
1044         (i.e. WK1).
1045         
1046         * page/ChromeClient.h:
1047         * rendering/RenderLayerCompositor.cpp:
1048         (WebCore::RenderLayerCompositor::RenderLayerCompositor):
1049         (WebCore::RenderLayerCompositor::updateCustomLayersAfterFlush):
1050         (WebCore::RenderLayerCompositor::didFlushChangesForLayer):
1051         (WebCore::RenderLayerCompositor::setIsInWindow):
1052         (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking): No longer check the page cache state; now we
1053         destroy the render tree of pages in the page cache, so we should never hit this code path.
1054         (WebCore::RenderLayerCompositor::didAddScrollingLayer):
1055         (WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers):
1056         (WebCore::LegacyWebKitScrollingLayerCoordinator::unregisterAllViewportConstrainedLayers):
1057         (WebCore::scrollbarHasDisplayNone):
1058         (WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer):
1059         (WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllScrollingLayers):
1060         (WebCore::LegacyWebKitScrollingLayerCoordinator::registerScrollingLayersNeedingUpdate):
1061         (WebCore::LegacyWebKitScrollingLayerCoordinator::unregisterAllScrollingLayers):
1062         (WebCore::LegacyWebKitScrollingLayerCoordinator::addScrollingLayer):
1063         (WebCore::LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer):
1064         (WebCore::LegacyWebKitScrollingLayerCoordinator::didFlushChangesForLayer):
1065         (WebCore::updateScrollingLayerWithClient): Deleted.
1066         (WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers): Deleted.
1067         (WebCore::RenderLayerCompositor::unregisterAllViewportConstrainedLayers): Deleted.
1068         (WebCore::RenderLayerCompositor::registerAllScrollingLayers): Deleted.
1069         (WebCore::RenderLayerCompositor::unregisterAllScrollingLayers): Deleted.
1070         * rendering/RenderLayerCompositor.h:
1071         (WebCore::LegacyWebKitScrollingLayerCoordinator::LegacyWebKitScrollingLayerCoordinator):
1072         * workers/service/ServiceWorkerContainer.cpp:
1073         (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
1074
1075 2019-01-05  Zalan Bujtas  <zalan@apple.com>
1076
1077         [LFC] VerticalMargin should only have the used values.
1078         https://bugs.webkit.org/show_bug.cgi?id=193168
1079
1080         Reviewed by Antti Koivisto.
1081
1082         Split VerticalMargin into ComputedVerticalMargin and UsedVerticalMargin.
1083         ComputedVerticalMargin holds the computed (optional) values while UsedVerticalMargin holds both the
1084         collapsed (optional) and the non-collapsed values.
1085
1086         * layout/FormattingContext.cpp:
1087         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
1088         * layout/FormattingContext.h:
1089         * layout/FormattingContextGeometry.cpp:
1090         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
1091         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1092         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
1093         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1094         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1095         (WebCore::Layout::FormattingContext::Geometry::computedVerticalMargin):
1096         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue): Deleted.
1097         * layout/FormattingContextQuirks.cpp:
1098         (WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight):
1099         * layout/LayoutUnits.h:
1100         * layout/MarginTypes.h:
1101         (WebCore::Layout::UsedVerticalMargin::before const):
1102         (WebCore::Layout::UsedVerticalMargin::after const):
1103         (WebCore::Layout::UsedVerticalMargin::nonCollapsedValues const):
1104         (WebCore::Layout::UsedVerticalMargin::collapsedValues const):
1105         (WebCore::Layout::UsedVerticalMargin::hasCollapsedValues const):
1106         (WebCore::Layout::UsedVerticalMargin::setCollapsedValues):
1107         (WebCore::Layout::UsedVerticalMargin::UsedVerticalMargin):
1108         (WebCore::Layout::VerticalMargin::nonCollapsedValues const): Deleted.
1109         (WebCore::Layout::VerticalMargin::collapsedValues const): Deleted.
1110         (WebCore::Layout::VerticalMargin::setCollapsedValues): Deleted.
1111         (WebCore::Layout::VerticalMargin::VerticalMargin): Deleted.
1112         (WebCore::Layout::VerticalMargin::usedValues const): Deleted.
1113         * layout/blockformatting/BlockFormattingContext.cpp:
1114         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
1115         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1116         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1117         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1118         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
1119         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedHeight):
1120         * layout/blockformatting/BlockMarginCollapse.cpp:
1121         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBefore):
1122         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginAfter):
1123         * layout/displaytree/DisplayBox.h:
1124         (WebCore::Display::Box::setVerticalMargin):
1125         (WebCore::Display::Box::verticalMargin const):
1126         (WebCore::Display::Box::marginBefore const):
1127         (WebCore::Display::Box::marginAfter const):
1128         * layout/floats/FloatingContext.cpp:
1129         (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
1130         * layout/inlineformatting/InlineFormattingContext.cpp:
1131         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
1132
1133 2019-01-04  Daniel Bates  <dabates@apple.com>
1134
1135         REGRESSION (r238522): Erratic scrolling on Google flights search result page and vrbo.com
1136         https://bugs.webkit.org/show_bug.cgi?id=192996
1137         <rdar://problem/46573552>
1138
1139         Reviewed by Simon Fraser.
1140
1141         Only scroll a text field if its inner text size changes and it is the currently active and
1142         focused element on the page.
1143
1144         Test: fast/scrolling/page-should-not-scroll-on-unfocused-text-field-layout.html
1145
1146         * rendering/RenderTextControlSingleLine.cpp:
1147         (WebCore::RenderTextControlSingleLine::layout):
1148
1149 2019-01-04  Alex Christensen  <achristensen@webkit.org>
1150
1151         Progress towards fixing Mac CMake build
1152         https://bugs.webkit.org/show_bug.cgi?id=193105
1153
1154         Reviewed by Don Olmstead.
1155
1156         * PlatformMac.cmake:
1157         * Sources.txt:
1158         * SourcesCocoa.txt:
1159         * WebCore.xcodeproj/project.pbxproj:
1160         * platform/graphics/gpu/GPURenderPassEncoder.h:
1161
1162 2019-01-04  Zalan Bujtas  <zalan@apple.com>
1163
1164         [iOS] ERROR: post-layout: dirty renderer(s) in WebCore::RenderTreeNeedsLayoutChecker::~RenderTreeNeedsLayoutChecker()
1165         https://bugs.webkit.org/show_bug.cgi?id=189608
1166         <rdar://problem/44473299>
1167
1168         Reviewed by Simon Fraser.
1169
1170         When a frameset/iframe is hidden and we skip layout, clear the dirty flag on its subtree as well.
1171
1172         Covered by fast/frames/invalid-frameset.html.
1173
1174         * rendering/RenderFrameSet.cpp:
1175         (WebCore::clearSiblingSubtrees):
1176         (WebCore::RenderFrameSet::positionFrames):
1177         (WebCore::RenderFrameSet::positionFramesWithFlattening):
1178
1179 2019-01-04  Youenn Fablet  <youenn@apple.com>
1180
1181         [Fetch API] Implement abortable fetch
1182         https://bugs.webkit.org/show_bug.cgi?id=174980
1183         <rdar://problem/46861402>
1184
1185         Reviewed by Chris Dumez.
1186
1187         Add an AbortSignal to FetchRequest.
1188
1189         Add support for AbortSignal algorithm.
1190         The fetch request signal is added an algorithm to abort the fetch.
1191         Update clone algorithm to let signal of the cloned request be following the origin request.
1192
1193         Update ReadableStream error handling to return an exception instead of a string.
1194         This allows passing an AbortError instead of a TypeError as previously done.
1195
1196         Update FetchBodyOwner to store a loading error either as an exception or as a resource error.
1197         The latter is used for passing the error from service worker back to the page.
1198         The former is used to pass it to ReadableStream or body accessors.
1199
1200         Covered by enabled tests.
1201
1202         * Modules/cache/DOMCache.cpp:
1203         (WebCore::DOMCache::put):
1204         * Modules/fetch/FetchBody.cpp:
1205         (WebCore::FetchBody::consumeAsStream):
1206         (WebCore::FetchBody::loadingFailed):
1207         * Modules/fetch/FetchBody.h:
1208         * Modules/fetch/FetchBodyConsumer.cpp:
1209         (WebCore::FetchBodyConsumer::loadingFailed):
1210         * Modules/fetch/FetchBodyConsumer.h:
1211         * Modules/fetch/FetchBodyOwner.cpp:
1212         (WebCore::FetchBodyOwner::arrayBuffer):
1213         (WebCore::FetchBodyOwner::blob):
1214         (WebCore::FetchBodyOwner::cloneBody):
1215         (WebCore::FetchBodyOwner::formData):
1216         (WebCore::FetchBodyOwner::json):
1217         (WebCore::FetchBodyOwner::text):
1218         (WebCore::FetchBodyOwner::loadBlob):
1219         (WebCore::FetchBodyOwner::blobLoadingFailed):
1220         (WebCore::FetchBodyOwner::consumeBodyAsStream):
1221         (WebCore::FetchBodyOwner::setLoadingError):
1222         * Modules/fetch/FetchBodyOwner.h:
1223         (WebCore::FetchBodyOwner::loadingError const):
1224         (WebCore::FetchBodyOwner::loadingException const):
1225         * Modules/fetch/FetchBodySource.cpp:
1226         (WebCore::FetchBodySource::error):
1227         * Modules/fetch/FetchBodySource.h:
1228         * Modules/fetch/FetchRequest.cpp:
1229         (WebCore::FetchRequest::initializeWith):
1230         (WebCore::FetchRequest::clone):
1231         * Modules/fetch/FetchRequest.h:
1232         (WebCore::FetchRequest::FetchRequest):
1233         * Modules/fetch/FetchRequest.idl:
1234         * Modules/fetch/FetchRequestInit.h:
1235         (WebCore::FetchRequestInit::hasMembers const):
1236         * Modules/fetch/FetchRequestInit.idl:
1237         * Modules/fetch/FetchResponse.cpp:
1238         (WebCore::FetchResponse::clone):
1239         (WebCore::FetchResponse::fetch):
1240         (WebCore::FetchResponse::BodyLoader::didFail):
1241         * Modules/fetch/FetchResponse.h:
1242         * bindings/js/ReadableStreamDefaultController.h:
1243         (WebCore::ReadableStreamDefaultController::error):
1244         * dom/AbortSignal.cpp:
1245         (WebCore::AbortSignal::abort):
1246         (WebCore::AbortSignal::follow):
1247         * dom/AbortSignal.h:
1248
1249 2019-01-04  Brent Fulgham  <bfulgham@apple.com>
1250
1251         Parsed protocol of javascript URLs with embedded newlines and carriage returns do not match parsed protocol in Chrome and Firefox
1252         https://bugs.webkit.org/show_bug.cgi?id=193155
1253         <rdar://problem/40230982>
1254
1255         Reviewed by Chris Dumez.
1256
1257         Test: fast/loader/comment-only-javascript-url.html
1258
1259         Make a special case for URLs beginning with 'javascript:'. We should always
1260         treat these as JS URLs, even if the content contained within the URL
1261         string might match other parts of the URL parsing spec.
1262
1263         * html/URLUtils.h:
1264         (WebCore::URLUtils<T>::protocol const):
1265
1266 2019-01-04  Jer Noble  <jer.noble@apple.com>
1267
1268         [WebKitLegacy] Media playback pauses on scroll
1269         https://bugs.webkit.org/show_bug.cgi?id=192829
1270
1271         Reviewed by Eric Carlson.
1272
1273         New API tests:
1274             WebKitLegacy.ScrollingDoesNotPauseMedia
1275             WKWebView.StopAllMediaPlayback
1276             WKWebView.SuspendResumeAllMediaPlayback
1277
1278         Do not use suspendActiveDOMObjects(ReasonForSuspension::PageWillBeSuspended) to pause
1279         video. Roll back the changes to HTMLMediaElement, and introduce a new set of Page calls
1280         suspendAllMediaPlayback() & resumeAllMediaPlayback() which replaces the removed bahavior.
1281
1282         * dom/Document.cpp:
1283         (WebCore::Document::~Document):
1284         (WebCore::Document::stopAllMediaPlayback):
1285         (WebCore::Document::suspendAllMediaPlayback):
1286         (WebCore::Document::resumeAllMediaPlayback):
1287         * dom/Document.h:
1288         * html/HTMLMediaElement.cpp:
1289         (WebCore::HTMLMediaElement::HTMLMediaElement):
1290         (WebCore::HTMLMediaElement::parseAttribute):
1291         (WebCore::HTMLMediaElement::didFinishInsertingNode):
1292         (WebCore::HTMLMediaElement::setSrcObject):
1293         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
1294         (WebCore::HTMLMediaElement::suspend):
1295         (WebCore::HTMLMediaElement::resume):
1296         (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const):
1297         * html/HTMLMediaElement.h:
1298         (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const): Deleted.
1299         * html/MediaElementSession.cpp:
1300         (WebCore::MediaElementSession::playbackPermitted const):
1301         * page/Page.cpp:
1302         (WebCore::Page::stopAllMediaPlayback):
1303         (WebCore::Page::suspendAllMediaPlayback):
1304         (WebCore::Page::resumeAllMediaPlayback):
1305         * page/Page.h:
1306         (WebCore::Page::mediaPlaybackIsSuspended):
1307         * platform/audio/PlatformMediaSession.h:
1308         * platform/audio/PlatformMediaSessionManager.cpp:
1309         (WebCore::PlatformMediaSessionManager::suspendAllMediaPlaybackForDocument):
1310         (WebCore::PlatformMediaSessionManager::resumeAllMediaPlaybackForDocument):
1311         * platform/audio/PlatformMediaSessionManager.h:
1312
1313 2019-01-04  Chris Dumez  <cdumez@apple.com>
1314
1315         Add support for toggling device orientation API support per site
1316         https://bugs.webkit.org/show_bug.cgi?id=193143
1317         <rdar://problem/46605724>
1318
1319         Reviewed by Alex Christensen.
1320
1321         Add support for toggling device orientation API support per site via _WKWebsitePolicies.
1322
1323         * dom/Document.cpp:
1324         (WebCore::Document::simulateDeviceOrientationChange):
1325         * dom/Document.h:
1326         * loader/DocumentLoader.h:
1327         (WebCore::DocumentLoader::deviceOrientationEventEnabled const):
1328         (WebCore::DocumentLoader::setDeviceOrientationEventEnabled):
1329         * page/DOMWindow.cpp:
1330         (WebCore::DOMWindow::addEventListener):
1331
1332 2019-01-04  Jer Noble  <jer.noble@apple.com>
1333
1334         Web Content process main thread blocked beneath ImageDecoderAVFObjC::readSamples for many seconds on imgur.com
1335         https://bugs.webkit.org/show_bug.cgi?id=191806
1336         <rdar://problem/46151477>
1337
1338         Reviewed by Dean Jackson.
1339
1340         Test: http/tests/images/mp4-partial-load.html
1341
1342         Rather than use an AVAssetReaderTrackOutput, which will load both sample metadata and sample data
1343         synchronously when a sample is requested, use AVAssetReaderSampleReferenceOutput, which only loads
1344         sample metadata, including the byte offset and byte length of the sample data. By waiting until the
1345         AVAsset signals that it's own metadata is loaded, we can safely parse all the sample metadata without
1346         blocking on network loads. Once enough data is loaded, we can replace the byte reference and offset
1347         attachements in the sample with actual data, and mark the sample as "complete".
1348
1349         Because the existing ImageSource assumes that image data parsing will occur synchronously, and that
1350         synchronous parsing could cause a hang if the metadata is not loaded, add a new callback method which
1351         allows the ImageSource to be notified when the encodedDataStatus changes. The ImageSource notifies the
1352         CacheImage, which notifies the RenderImage, and thus the asynchronous parsing will kick off the
1353         renderer's animation loop.
1354
1355         * loader/cache/CachedImage.cpp:
1356         (WebCore::CachedImage::CachedImageObserver::encodedDataStatusChanged):
1357         (WebCore::CachedImage::encodedDataStatusChanged):
1358         * loader/cache/CachedImage.h:
1359         * platform/graphics/ImageDecoder.h:
1360         (WebCore::ImageDecoder::setEncodedDataStatusChangeCallback):
1361         * platform/graphics/ImageObserver.h:
1362         (WebCore::ImageObserver::encodedDataStatusChanged):
1363         * platform/graphics/ImageSource.cpp:
1364         (WebCore::ImageSource::ensureDecoderAvailable):
1365         (WebCore::ImageSource::encodedDataStatusChanged):
1366         (WebCore::ImageSource::frameDecodingStatusAtIndex):
1367         * platform/graphics/ImageSource.h:
1368         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
1369         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
1370         (-[WebCoreSharedBufferResourceLoaderDelegate data]):
1371         (WebCore::ImageDecoderAVFObjCSample::byteRange const):
1372         (WebCore::ImageDecoderAVFObjC::readSamples):
1373         (WebCore::ImageDecoderAVFObjC::setEncodedDataStatusChangeCallback):
1374         (WebCore::ImageDecoderAVFObjC::encodedDataStatus const):
1375         (WebCore::ImageDecoderAVFObjC::frameIsCompleteAtIndex const):
1376         (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex):
1377         (WebCore::ImageDecoderAVFObjC::sampleIsComplete const):
1378
1379 2019-01-04  Youenn Fablet  <youenn@apple.com>
1380
1381         CSP violation reports should bypass CSP checks
1382         https://bugs.webkit.org/show_bug.cgi?id=192857
1383         <rdar://problem/46887236>
1384
1385         Reviewed by Chris Dumez.
1386
1387         For ping loads, pass the option to do CSP checks from PingLoader to LoaderStrategy.
1388         This new option is unused by WebKit Legacy.
1389         It is used by WebKit loader strategy to only send any CSP response header to network process
1390         in case CSP checks should be done.
1391
1392         This option is used to disable CSP checks for Ping Loads that report CSP violations.
1393
1394         Test: http/wpt/fetch/csp-reports-bypass-csp-checks.html
1395
1396         * loader/LoaderStrategy.h:
1397         * loader/PingLoader.cpp:
1398         (WebCore::PingLoader::loadImage):
1399         (WebCore::PingLoader::sendPing):
1400         (WebCore::PingLoader::sendViolationReport):
1401         (WebCore::PingLoader::startPingLoad):
1402         * loader/PingLoader.h:
1403         * loader/cache/CachedResource.cpp:
1404         (WebCore::CachedResource::load):
1405
1406 2019-01-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1407
1408         [Cocoa] Merge WebEditCommandProxy::nameForEditAction and undoNameForEditAction into a single function
1409         https://bugs.webkit.org/show_bug.cgi?id=193129
1410
1411         Reviewed by Tim Horton.
1412
1413         Adds a new helper function that returns the undo/redo name for a given EditAction. No change in behavior.
1414
1415         * Sources.txt:
1416         * WebCore.xcodeproj/project.pbxproj:
1417         * editing/EditAction.cpp: Copied from Source/WebKit/UIProcess/WebEditCommandProxy.cpp.
1418         (WebCore::nameForUndoRedo):
1419         * editing/EditAction.h:
1420         * editing/Editor.cpp:
1421
1422 2019-01-03  Matt Rajca  <mrajca@apple.com>
1423
1424         Make DidPlayMediaPreventedFromPlaying autoplay event more generic.
1425         https://bugs.webkit.org/show_bug.cgi?id=193128
1426         rdar://34554231
1427
1428         Reviewed by Jer Noble.
1429
1430         Today, the "DidPlayMediaPreventedFromPlaying" autoplay event is only sent for
1431         media prevented from autoplaying. It could be generalized to a "DidPlayMediaWithUserGesture"
1432         event along with a flag that indicates whether or not autoplay was actually prevented.
1433         Moreover, we can include a flag that indicates whether the media element in question
1434         is main content. Clients will then know in more cases when media was played with a user
1435         gesture, whether or not it has audio, as well as its main content status. While the main
1436         content heuristics may not be perfect, they covered the top 20 video-centric websites that
1437         this was tested with and are meant to be used by clients for data evaluation purposes.
1438
1439         As part of this, the PlaybackWithoutUserGesture enum was renamed to AutoplayEventPlaybackState
1440         since it now also applies to cases where there is a user gesture. The
1441         `m_playbackWithoutUserGestureStartedTime` member variable was also removed in favor of
1442         `playbackStartedTime` which also covers all the cases we care about.
1443
1444         Tests: existing API tests were updated to reflect the new names. New API tests
1445         were added for the new case in which the "DidPlayMediaWithUserGesture" event is sent.
1446
1447         * html/HTMLMediaElement.cpp:
1448         (WebCore::convertEnumerationToString): Update to new enum cases.
1449         (WebCore::HTMLMediaElement::setReadyState): Ditto.
1450         (WebCore::HTMLMediaElement::play): Ditto.
1451         (WebCore::HTMLMediaElement::playInternal): Also cover the case where
1452          playback was not prevented but there was a user gesture.
1453         (WebCore::HTMLMediaElement::pauseInternal): Use new name.
1454         (WebCore::HTMLMediaElement::setVolume): Use new name.
1455         (WebCore::HTMLMediaElement::playbackProgressTimerFired): Dispatch the
1456          DidPlayMediaWithUserGesture event when playback was started with a user
1457          gesture as well.
1458         (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack): Use new name.
1459         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged): Ditto.
1460         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): Ditto.
1461         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto.
1462         (WebCore::HTMLMediaElement::handleAutoplayEvent): Pass along new media state.
1463         (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay): Use new name.
1464         (WebCore::HTMLMediaElement::setAutoplayEventPlaybackState): Stop setting
1465          m_playbackWithoutUserGestureStartedTime in favor of using playbackStartedTime.
1466         (WebCore::HTMLMediaElement::updateShouldPlay): Use new name.
1467         (WebCore::HTMLMediaElement::setPlaybackWithoutUserGesture): Renamed.
1468         * html/HTMLMediaElement.h:
1469         (WTF::LogArgument<WebCore::HTMLMediaElement::AutoplayEventPlaybackState>::toString): Renamed from...
1470         (WTF::LogArgument<WebCore::HTMLMediaElement::PlaybackWithoutUserGesture>::toString):
1471         * html/MediaElementSession.cpp:
1472         (WebCore::MediaElementSession::isMainContentForPurposesOfAutoplayEvents const): Don't
1473          do the hit testing check for the purposes of autoplay events. It seems to fail on the
1474          basic Vimeo player due to overlapping divs.
1475         (WebCore::isElementMainContentForPurposesOfAutoplay):
1476         (WebCore::MediaElementSession::updateIsMainContent const): Keep the existing behavior
1477          here of hit testing.
1478         (WebCore::isMainContentForPurposesOfAutoplay): Renamed.
1479         * html/MediaElementSession.h:
1480         * page/AutoplayEvent.h:
1481
1482 2019-01-04  Youenn Fablet  <youenn@apple.com>
1483
1484         Crash in WebCore::ServiceWorkerGlobalScope
1485         https://bugs.webkit.org/show_bug.cgi?id=192513
1486         <rdar://problem/46563880>
1487
1488         Reviewed by Alex Christensen.
1489
1490         Store the identifier in its own variable to make sure we do not use workerThread after being moved.
1491
1492         * workers/service/ServiceWorkerGlobalScope.cpp:
1493         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
1494
1495 2019-01-04  Chris Fleizach  <cfleizach@apple.com>
1496
1497         AX: String check: "Rule" does not reflect the meaning of the <hr> html tag
1498         https://bugs.webkit.org/show_bug.cgi?id=193041
1499         <rdar://problem/46954090>
1500
1501         Reviewed by Zalan Bujtas.
1502
1503         * en.lproj/Localizable.strings:
1504         * platform/cocoa/LocalizedStringsCocoa.mm:
1505         (WebCore::AXHorizontalRuleDescriptionText):
1506
1507 2019-01-04  Zalan Bujtas  <zalan@apple.com>
1508
1509         [LFC] ComputedHorizontalMargin should have optional members
1510         https://bugs.webkit.org/show_bug.cgi?id=193131
1511
1512         Reviewed by Antti Koivisto.
1513
1514         Split HorizontalMargin into UsedHorizontalMargin and ComputedHorizontalMargin. ComputedHorizontalMargin's members are optional.
1515         (see computed vs used values)
1516
1517         * layout/FormattingContext.h:
1518         * layout/FormattingContextGeometry.cpp:
1519         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1520         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1521         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1522         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
1523         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1524         (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin):
1525         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue): Deleted.
1526         * layout/LayoutUnits.h:
1527         * layout/MarginTypes.h:
1528         * layout/Verification.cpp:
1529         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
1530         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1531         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1532         * layout/displaytree/DisplayBox.h:
1533         (WebCore::Display::Box::setHorizontalMargin):
1534         (WebCore::Display::Box::setHorizontalComputedMargin):
1535         (WebCore::Display::Box::computedMarginStart const):
1536         (WebCore::Display::Box::computedMarginEnd const):
1537         * layout/floats/FloatAvoider.h:
1538         (WebCore::Layout::FloatAvoider::marginStart const):
1539         (WebCore::Layout::FloatAvoider::marginEnd const):
1540         * layout/inlineformatting/InlineFormattingContext.cpp:
1541         (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
1542         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
1543         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
1544
1545 2019-01-04  Zalan Bujtas  <zalan@apple.com>
1546
1547         [LFC][BFC] Use computedValue and usedValue consistently
1548         https://bugs.webkit.org/show_bug.cgi?id=193059
1549
1550         Reviewed by Antti Koivisto.
1551
1552         https://www.w3.org/TR/CSS22/cascade.html#value-stages
1553
1554         6.1.2 Computed values
1555         Specified values are resolved to computed values during the cascade; for example URIs are made absolute and 'em' and 'ex' units
1556         are computed to pixel or absolute lengths. Computing a value never requires the user agent to render the document...
1557
1558         6.1.3 Used values
1559         Computed values are processed as far as possible without formatting the document. Some values, however, can only be determined when the document
1560         is being laid out. For example, if the width of an element is set to be a certain percentage of its containing block, the width cannot be determined
1561         until the width of the containing block has been determined. The used value is the result of taking the computed value and resolving any remaining
1562         dependencies into an absolute value.
1563
1564         * layout/FormattingContext.cpp:
1565         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
1566         * layout/FormattingContextGeometry.cpp:
1567         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1568         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1569         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1570         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
1571         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1572         * layout/LayoutState.cpp:
1573         (WebCore::Layout::LayoutState::LayoutState):
1574         * layout/LayoutUnits.h:
1575         * layout/Verification.cpp:
1576         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
1577         * layout/blockformatting/BlockFormattingContext.cpp:
1578         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
1579         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1580         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1581         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
1582         * layout/displaytree/DisplayBox.cpp:
1583         (WebCore::Display::Box::Box):
1584         * layout/displaytree/DisplayBox.h:
1585         (WebCore::Display::Box::setHasValidHorizontalComputedMargin):
1586         (WebCore::Display::Box::setHorizontalComputedMargin):
1587         (WebCore::Display::Box::computedMarginStart const):
1588         (WebCore::Display::Box::computedMarginEnd const):
1589         (WebCore::Display::Box::setHasValidHorizontalNonComputedMargin): Deleted.
1590         (WebCore::Display::Box::setHorizontalNonComputedMargin): Deleted.
1591         (WebCore::Display::Box::nonComputedMarginStart const): Deleted.
1592         (WebCore::Display::Box::nonComputedMarginEnd const): Deleted.
1593         * layout/floats/FloatAvoider.h:
1594         (WebCore::Layout::FloatAvoider::marginStart const):
1595         (WebCore::Layout::FloatAvoider::marginEnd const):
1596         * layout/inlineformatting/InlineFormattingContext.cpp:
1597         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
1598
1599 2019-01-03  Zalan Bujtas  <zalan@apple.com>
1600
1601         REGRESSION: -webkit-appearance test case crashes
1602         https://bugs.webkit.org/show_bug.cgi?id=189302
1603         <rdar://problem/44143049>
1604
1605         Reviewed by Wenson Hsieh.
1606
1607         The painting and the layout positions of the cancel button need to match in order to be able to interact with it.
1608         This patch removes the previous position inlining attempts.
1609
1610         Test: fast/forms/webkit-appearance-searchfield-cancel-button-crash.html
1611
1612         * rendering/RenderThemeMac.mm:
1613         (WebCore::RenderThemeMac::paintSearchFieldCancelButton):
1614
1615 2019-01-03  David Kilzer  <ddkilzer@apple.com>
1616
1617         Leak of WebCore::LibWebRTCCertificateGenerator::RTCCertificateGeneratorCallback (48 bytes) in com.apple.WebKit.WebContent running WebKit layout tests
1618         <https://webkit.org/b/193122>
1619         <rdar://problem/47022987>
1620
1621         Reviewed by Youenn Fablet.
1622
1623         * Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp:
1624         (WebCore::LibWebRTCCertificateGenerator::RTCCertificateGeneratorCallback::AddRef const):
1625         (WebCore::LibWebRTCCertificateGenerator::RTCCertificateGeneratorCallback::Release const):
1626         - Remove `final` keyword so that
1627           `new rtc::RefCountedObject<RTCCertificateGeneratorCallback>()`
1628           can be called.
1629         (WebCore::LibWebRTCCertificateGenerator::generateCertificate):
1630         - To fix the leak call
1631           `new rtc::RefCountedObject<RTCCertificateGeneratorCallback>()`
1632           to create the object.
1633
1634 2019-01-03  Simon Fraser  <simon.fraser@apple.com>
1635
1636         REGRESSION (r238090): After showing the Find banner or tab bar, hit tests are vertically offset (or painting is not offset)
1637         https://bugs.webkit.org/show_bug.cgi?id=193124
1638         rdar://problem/46755409
1639
1640         Reviewed by Tim Horton.
1641
1642         Top content inset feeds into scrolling tree geometry, so when it changes we need to trigger
1643         an update of the root scrolling node, which happens via RenderLayerBacking::updateGeometry().
1644         So set a dirty bit on the root layer in frameViewDidChangeSize(), which is called from the code
1645         path that runs when top content inset changes.
1646
1647         Find banner behavior is not easily testable. platform/mac/fast/events/content-inset-hit-testing.html did not detect the regression.
1648
1649         * rendering/RenderLayerCompositor.cpp:
1650         (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
1651
1652 2019-01-03  Chris Dumez  <cdumez@apple.com>
1653
1654         Potential infinite recursion in isFrameFamiliarWith(Frame&, Frame&)
1655         https://bugs.webkit.org/show_bug.cgi?id=192997
1656         <rdar://problem/46217271>
1657
1658         Reviewed by Antti Koivisto.
1659
1660         isFrameFamiliarWith(Frame&, Frame&) was called recursively using the passed frames' openers.
1661         The issue is that a Frame can be its opener. There could also be a cycle in the opener chain.
1662
1663         To address the issue, simplify isFrameFamiliarWith() so that it is no longer recursive. We now
1664         only check if the frames belong to the same pages or if their openers do. We no longer check
1665         openers' opener and up.
1666
1667         Note that this function is used to check if a frame is allowed to target another. In practice,
1668         it is unlikely to be useful to navigate an opener's opener and an openee's openee.
1669
1670         Tests: fast/dom/Window/window-open-opener-cycle.html
1671                fast/dom/Window/window-open-self-as-opener.html
1672
1673         * page/FrameTree.cpp:
1674         (WebCore::isFrameFamiliarWith):
1675
1676 2019-01-02  Simon Fraser  <simon.fraser@apple.com>
1677
1678         REGRESSION (r239306): Don't disable font smoothing in transparent layers on macOS Mojave and later
1679         https://bugs.webkit.org/show_bug.cgi?id=193095
1680         <rdar://problem/47014944>
1681
1682         Reviewed by Zalan Bujtas.
1683         
1684         In r239306 we stopped making CALayers for font-smoothed text when not necessary on macOS Mojave
1685         and later. However, we still turned off smoothing for non-opaque layers (setShouldSmoothFonts(false)),
1686         which continues to affect the appearance of text.
1687         
1688         Fix by only calling setShouldSmoothFonts(false) when the OS supports font smoothing.
1689
1690         Test: compositing/contents-format/subpixel-antialiased-text.html
1691
1692         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1693         (WebCore::PlatformCALayer::drawLayerContents):
1694
1695 2019-01-02  David Kilzer  <ddkilzer@apple.com>
1696
1697         Leak of CMSampleBuffer (752 bytes) in com.apple.WebKit.WebContent running WebKit layout tests
1698         <https://webkit.org/b/193016>
1699         <rdar://problem/46925703>
1700
1701         Reviewed by Simon Fraser.
1702
1703         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
1704         (WebCore::copySampleBufferWithCurrentTimeStamp):
1705         - Change to return RetainPtr<CMSampleBufferRef>.
1706         - Check return value of CMSampleBufferCreateCopyWithNewTiming().
1707         (WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer):
1708         - Check return value of copySampleBufferWithCurrentTimeStamp().
1709         - Fix leak by using RetainPtr<CMSampleBufferRef> returned from
1710           copySampleBufferWithCurrentTimeStamp() instead of leaking
1711           `bufferWithCurrentTime` by using retainPtr().
1712         (WebCore::createAudioFormatDescription):
1713         - Extract method from appendAudioSampleBuffer() to return
1714           RetainPtr<CMFormatDescriptionRef> after calling
1715           CMAudioFormatDescriptionCreate().
1716         - Check return value of CMAudioFormatDescriptionCreate().
1717         (WebCore::createAudioSampleBufferWithPacketDescriptions):
1718         - Extract method from appendAudioSampleBuffer() to return
1719           RetainPtr<CMSampleBufferRef> after calling
1720           CMAudioSampleBufferCreateWithPacketDescriptions().
1721         (WebCore::MediaRecorderPrivateWriter::appendAudioSampleBuffer):
1722         - Check return values of createAudioFormatDescription() and
1723           createAudioSampleBufferWithPacketDescriptions().
1724         - Fix leaks by extracting code into helper methods that return
1725           RetainPtr<> objects instead of leaking CMFormatDescriptionRef
1726           directly or leaking `sampleBuffer` by using retainPtr().
1727
1728 2019-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
1729
1730         Add support for using the current text selection as the find string on iOS
1731         https://bugs.webkit.org/show_bug.cgi?id=193034
1732         <rdar://problem/45138739>
1733
1734         Reviewed by Tim Horton.
1735
1736         Add support for "TakeFindStringFromSelection" on iOS. Unlike macOS, iOS does not have a notion of a "find
1737         pasteboard" like macOS; instead, we handle this editing command by sending the selection string to the UI
1738         process, where it is exposed via WebKit SPI so that clients that present find-in-page UI (i.e. MobileSafari) are
1739         able to trigger find-in-page with this string.
1740
1741         Test: WebKit.UseSelectionAsFindString
1742
1743         * editing/Editor.cpp:
1744         (WebCore::Editor::canCopyExcludingStandaloneImages const):
1745
1746         Make this helper function cross-platform.
1747
1748         * editing/Editor.h:
1749         * editing/EditorCommand.cpp:
1750         (WebCore::createCommandMap):
1751         * editing/cocoa/EditorCocoa.mm:
1752         (WebCore::Editor::takeFindStringFromSelection):
1753
1754         Move this from EditorMac to EditorCocoa, and implement it on iOS by calling into the editor client to update the
1755         find string (see WebKit/ChangeLog for more details).
1756
1757         * editing/mac/EditorMac.mm:
1758         (WebCore::Editor::canCopyExcludingStandaloneImages): Deleted.
1759         (WebCore::Editor::takeFindStringFromSelection): Deleted.
1760         * loader/EmptyClients.cpp:
1761         * page/EditorClient.h:
1762
1763         Add a new editor client method to send the string for find-in-page to the UI process.
1764
1765 2019-01-02  Devin Rousso  <webkit@devinrousso.com>
1766
1767         Web Inspector: Implement `queryObjects` Command Line API
1768         https://bugs.webkit.org/show_bug.cgi?id=176766
1769         <rdar://problem/34890689>
1770
1771         Reviewed by Joseph Pecoraro.
1772
1773         Test: inspector/console/queryObjects.html
1774
1775         * inspector/CommandLineAPIModuleSource.js:
1776         (CommandLineAPI):
1777         (CommandLineAPIImpl.prototype.queryObjects): Added.
1778
1779 2019-01-02  Charles Vazac  <cvazac@gmail.com>
1780
1781         Fix resourcetimingbufferfull bubbles attribute
1782         https://bugs.webkit.org/show_bug.cgi?id=193087
1783
1784         Reviewed by Chris Dumez.
1785
1786         This change is covered by web-platform-tests [1].
1787
1788         [1] https://github.com/web-platform-tests/wpt/blob/master/resource-timing/buffer-full-when-populate-entries.html#L20
1789
1790         * page/Performance.cpp:
1791         (WebCore::Performance::resourceTimingBufferFullTimerFired):
1792
1793 2019-01-02  Simon Fraser  <simon.fraser@apple.com>
1794
1795         Rename LayerScrollCoordinationRole to ScrollCoordinationRole and make an enum class
1796         https://bugs.webkit.org/show_bug.cgi?id=193010
1797
1798         Reviewed by Zalan Bujtas.
1799
1800         Move the enum LayerScrollCoordinationRole from RenderLayer.h to RenderLayerCompositor.h,
1801         and make it an enum class.
1802
1803         * page/FrameView.cpp:
1804         (WebCore::FrameView::scrollLayerID const):
1805         * rendering/RenderLayer.h:
1806         * rendering/RenderLayerBacking.cpp:
1807         (WebCore::RenderLayerBacking::~RenderLayerBacking):
1808         (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
1809         (WebCore::operator<<):
1810         * rendering/RenderLayerBacking.h:
1811         * rendering/RenderLayerCompositor.cpp:
1812         (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
1813         (WebCore::RenderLayerCompositor::removeFromScrollCoordinatedLayers):
1814         (WebCore::scrollCoordinationRoleForNodeType):
1815         (WebCore::RenderLayerCompositor::attachScrollingNode):
1816         (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer):
1817         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
1818         (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):
1819         * rendering/RenderLayerCompositor.h:
1820
1821 2019-01-02  Simon Fraser  <simon.fraser@apple.com>
1822
1823         Don't spin up a CalcParser if the current token is not a function token
1824         https://bugs.webkit.org/show_bug.cgi?id=193067
1825
1826         Reviewed by Zalan Bujtas.
1827
1828         Various functions in CSSPropertyParserHelpers fall back to trying to parse
1829         a calc expression if the normal parsing fails. Don't do this unless the
1830         current token is a function token, which should be slightly more efficient.
1831
1832         * css/parser/CSSPropertyParserHelpers.cpp:
1833         (WebCore::CSSPropertyParserHelpers::consumeInteger):
1834         (WebCore::CSSPropertyParserHelpers::consumePositiveIntegerRaw):
1835         (WebCore::CSSPropertyParserHelpers::consumeNumberRaw):
1836         (WebCore::CSSPropertyParserHelpers::consumeNumber):
1837         (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
1838         (WebCore::CSSPropertyParserHelpers::consumeLength):
1839         (WebCore::CSSPropertyParserHelpers::consumePercent):
1840         (WebCore::CSSPropertyParserHelpers::consumeLengthOrPercent):
1841         (WebCore::CSSPropertyParserHelpers::consumeAngle):
1842         (WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
1843         (WebCore::CSSPropertyParserHelpers::consumeTime):
1844
1845 2019-01-02  Simon Fraser  <simon.fraser@apple.com>
1846
1847         Support css-color-4 rgb functions
1848         https://bugs.webkit.org/show_bug.cgi?id=192321
1849
1850         Reviewed by Zalan Bujtas.
1851         
1852         Support the new rgb()/rgba() syntax described in https://drafts.csswg.org/css-color/#rgb-functions.
1853         The differences are:
1854         1. There is a new comma-free syntax, where the optional alpha is separated by a slash:
1855             rgb(128 34 56)
1856             rgb(128 34 56 / 50%)
1857         2. Floating point values are allowed, and rounded:
1858             rgb(128.5 34.2 56.5) becomes rgb(129 34 57)
1859         3. rgba() is a pure alias for rgb(), so these are equivalent:
1860             rgb(128 34 56 / 50%)
1861             rgba(128 34 56 / 50%)
1862             
1863         hsl()/hsla() parsing was already updated to this new syntax in r230861.
1864
1865         Tested by tests in imported/w3c/web-platform-tests/css/css-color/
1866
1867         * css/parser/CSSPropertyParserHelpers.cpp:
1868         (WebCore::CSSPropertyParserHelpers::clampRGBComponent):
1869         (WebCore::CSSPropertyParserHelpers::parseRGBParameters):
1870         (WebCore::CSSPropertyParserHelpers::parseColorFunction):
1871
1872 2019-01-02  Simon Fraser  <simon.fraser@apple.com>
1873
1874         Handle calc() expressions in gradient color stops
1875         https://bugs.webkit.org/show_bug.cgi?id=193066
1876         rdar://problem/46961985
1877
1878         Reviewed by Sam Weinig.
1879         
1880         Fix two issues that prevented calc() expressions from working in conic-gradient color stops,
1881         for the angle or percent value. First, consumeAngleOrPercent() needs to look for CalculationCategory::Percent
1882         calc values as well as angle ones.
1883
1884         Second, CSSPrimitiveValue::isAngle() needs to use primitiveType() (which takes calc into account),
1885         just as isPx() etc do.
1886
1887         Test: fast/gradients/conic-calc-stop-position.html
1888
1889         * css/CSSPrimitiveValue.h:
1890         (WebCore::CSSPrimitiveValue::isAngle const):
1891         * css/parser/CSSPropertyParserHelpers.cpp:
1892         (WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
1893         (WebCore::CSSPropertyParserHelpers::consumeGradientColorStops):
1894
1895 2018-12-31  Keith Miller  <keith_miller@apple.com>
1896
1897         SourceProviders should use an actual URL instead of a string
1898         https://bugs.webkit.org/show_bug.cgi?id=192734
1899
1900         Reviewed by Yusuke Suzuki.
1901
1902         Remove ScriptSourceCode's URL member and make the url() method
1903         reference the URL on the SourceProvider. Also, avoid some
1904         ref count churn.
1905
1906         Additionally, this patch fixes an existing bug in
1907         WorkletGlobalScope() that would use a ScriptSourceCode after
1908         WTFMoving it.
1909
1910         * bindings/js/CachedScriptSourceProvider.h:
1911         (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
1912         * bindings/js/ScheduledAction.cpp:
1913         (WebCore::ScheduledAction::execute):
1914         * bindings/js/ScriptController.cpp:
1915         (WebCore::ScriptController::executeScriptInWorld):
1916         (WebCore::ScriptController::executeScript):
1917         * bindings/js/ScriptSourceCode.h:
1918         (WebCore::ScriptSourceCode::ScriptSourceCode):
1919         (WebCore::ScriptSourceCode::m_code):
1920         (WebCore::ScriptSourceCode::url const):
1921         (WebCore::ScriptSourceCode::m_url): Deleted.
1922         * dom/ScriptElement.cpp:
1923         (WebCore::ScriptElement::prepareScript):
1924         (WebCore::ScriptElement::requestModuleScript):
1925         (WebCore::ScriptElement::executePendingScript):
1926         * html/HTMLMediaElement.cpp:
1927         (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
1928         * page/Frame.cpp:
1929         (WebCore::Frame::injectUserScriptImmediately):
1930         * workers/WorkerGlobalScope.cpp:
1931         (WebCore::WorkerGlobalScope::importScripts):
1932         * workers/WorkerThread.cpp:
1933         (WebCore::WorkerThread::workerThread):
1934         * worklets/WorkletGlobalScope.cpp:
1935         (WebCore::WorkletGlobalScope::WorkletGlobalScope):
1936         * xml/parser/XMLDocumentParserLibxml2.cpp:
1937         (WebCore::XMLDocumentParser::endElementNs):
1938
1939 2019-01-01  Jeff Miller  <jeffm@apple.com>
1940
1941         Update user-visible copyright strings to include 2019
1942         https://bugs.webkit.org/show_bug.cgi?id=192811
1943
1944         Reviewed by Mark Lam.
1945
1946         * Info.plist:
1947
1948 2018-12-30  David Kilzer  <ddkilzer@apple.com>
1949
1950         clang-tidy: Save 8 padding bytes on WebCore::BorderEdge
1951         <https://webkit.org/b/193058>
1952         <rdar://problem/46979275>
1953
1954         Reviewed by Yusuke Suzuki.
1955
1956         * rendering/BorderEdge.cpp:
1957         (WebCore::BorderEdge::BorderEdge): Reorder initialization to
1958         match new instance variable order.
1959         * rendering/BorderEdge.h: Reorder instance variables to save
1960         8 padding bytes.
1961
1962 2018-12-28  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
1963
1964         [JSC] Remove one indirection in JSObject::toStringName
1965         https://bugs.webkit.org/show_bug.cgi?id=193037
1966
1967         Reviewed by Keith Miller.
1968
1969         Use old JSObject::toStringName function here.
1970
1971         * bindings/js/JSDOMConstructorBase.cpp:
1972         (WebCore::JSDOMConstructorBase::className):
1973         (WebCore::JSDOMConstructorBase::toStringName):
1974         * bindings/js/JSDOMConstructorBase.h:
1975         (WebCore::JSDOMConstructorBase::className): Deleted.
1976
1977 2018-12-27  Alex Christensen  <achristensen@webkit.org>
1978
1979         Resurrect Mac CMake build
1980         https://bugs.webkit.org/show_bug.cgi?id=192658
1981
1982         Reviewed by Yusuke Suzuki.
1983
1984         This makes it so JSC and most of WebCore builds.
1985         WebCore's use of ARC seems inconsistent, so I'll fix that later.
1986
1987         * PlatformMac.cmake:
1988         * config.h:
1989
1990 2018-12-26  Jim Mason  <jmason@ibinx.com>
1991
1992         [FreeType] Restore conditional compilation logic for recent HarfBuzz refactoring
1993         https://bugs.webkit.org/show_bug.cgi?id=193036
1994
1995         Reviewed by Michael Catanzaro.
1996
1997         * platform/graphics/FontPlatformData.h:
1998         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
1999
2000 2018-12-24  Fujii Hironori  <Hironori.Fujii@sony.com>
2001
2002         Remove "using namespace std;"
2003         https://bugs.webkit.org/show_bug.cgi?id=192973
2004         <rdar://problem/46937309>
2005
2006         Unreviewed Windows port Debug builds fix.
2007
2008         No new tests since no behavior changes.
2009
2010         * accessibility/win/AXObjectCacheWin.cpp:
2011         (WebCore::AXObjectCache::postPlatformNotification): Add "std::" prefix to numeric_limits in ASSERT macro.
2012
2013 2018-12-24  Fujii Hironori  <Hironori.Fujii@sony.com>
2014
2015         Remove "using namespace std;"
2016         https://bugs.webkit.org/show_bug.cgi?id=192973
2017
2018         Reviewed by Alex Christensen.
2019
2020         Removed "using namespace std" statement, and use std:: prefix.
2021
2022         No new tests since no behavior changes.
2023
2024         * accessibility/win/AXObjectCacheWin.cpp:
2025         * platform/graphics/GraphicsContext3DPrivate.cpp:
2026         * platform/graphics/cairo/ImageBufferCairo.cpp:
2027         * platform/graphics/win/FontPlatformDataCairoWin.cpp:
2028         * platform/graphics/win/FontWin.cpp:
2029         (WebCore::FontCascade::floatWidthForComplexText const):
2030         * platform/graphics/win/GraphicsContextCGWin.cpp:
2031         * platform/graphics/win/GraphicsContextCairoWin.cpp:
2032         * platform/graphics/win/GraphicsContextDirect2D.cpp:
2033         * platform/graphics/win/GraphicsContextWin.cpp:
2034         * platform/graphics/win/SimpleFontDataCGWin.cpp:
2035         * platform/graphics/win/UniscribeController.cpp:
2036         (WebCore::UniscribeController::UniscribeController):
2037         (WebCore::UniscribeController::shapeAndPlaceItem):
2038         * platform/image-decoders/ScalableImageDecoder.cpp:
2039         * platform/text/LocaleICU.cpp:
2040         * platform/text/win/LocaleWin.cpp:
2041         * platform/win/ScrollbarThemeWin.cpp:
2042         * rendering/RenderRubyRun.cpp:
2043         (WebCore::RenderRubyRun::layoutBlock):
2044         * rendering/RenderThemeWin.cpp:
2045         (WebCore::RenderThemeWin::adjustMenuListButtonStyle const):
2046         (WebCore::RenderThemeWin::paintSearchFieldCancelButton):
2047         (WebCore::RenderThemeWin::adjustSearchFieldCancelButtonStyle const):
2048         (WebCore::RenderThemeWin::adjustSearchFieldResultsDecorationPartStyle const):
2049         (WebCore::RenderThemeWin::paintSearchFieldResultsDecorationPart):
2050         (WebCore::RenderThemeWin::adjustSearchFieldResultsButtonStyle const):
2051         (WebCore::RenderThemeWin::paintSearchFieldResultsButton):
2052
2053 2018-12-24  Simon Fraser  <simon.fraser@apple.com>
2054
2055         Change ScrollingNodeType to an enum class
2056         https://bugs.webkit.org/show_bug.cgi?id=193009
2057
2058         Reviewed by Zalan Bujtas.
2059
2060         Change the ScrollingNodeType enum to an enum class.
2061         
2062         No behavior change.
2063
2064         * page/scrolling/AsyncScrollingCoordinator.cpp:
2065         (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
2066         * page/scrolling/ScrollingCoordinator.cpp:
2067         (WebCore::operator<<):
2068         * page/scrolling/ScrollingCoordinator.h:
2069         * page/scrolling/ScrollingStateFixedNode.cpp:
2070         (WebCore::ScrollingStateFixedNode::ScrollingStateFixedNode):
2071         * page/scrolling/ScrollingStateNode.h:
2072         (WebCore::ScrollingStateNode::isFixedNode const):
2073         (WebCore::ScrollingStateNode::isStickyNode const):
2074         (WebCore::ScrollingStateNode::isFrameScrollingNode const):
2075         (WebCore::ScrollingStateNode::isOverflowScrollingNode const):
2076         * page/scrolling/ScrollingStateOverflowScrollingNode.cpp:
2077         (WebCore::ScrollingStateOverflowScrollingNode::ScrollingStateOverflowScrollingNode):
2078         * page/scrolling/ScrollingStateStickyNode.cpp:
2079         (WebCore::ScrollingStateStickyNode::ScrollingStateStickyNode):
2080         * page/scrolling/ScrollingStateTree.cpp:
2081         (WebCore::ScrollingStateTree::createNode):
2082         (WebCore::ScrollingStateTree::attachNode):
2083         * page/scrolling/ScrollingTreeNode.h:
2084         (WebCore::ScrollingTreeNode::isFixedNode const):
2085         (WebCore::ScrollingTreeNode::isStickyNode const):
2086         (WebCore::ScrollingTreeNode::isFrameScrollingNode const):
2087         (WebCore::ScrollingTreeNode::isOverflowScrollingNode const):
2088         * page/scrolling/ScrollingTreeOverflowScrollingNode.cpp:
2089         (WebCore::ScrollingTreeOverflowScrollingNode::ScrollingTreeOverflowScrollingNode):
2090         * page/scrolling/ios/ScrollingTreeIOS.cpp:
2091         (WebCore::ScrollingTreeIOS::createScrollingTreeNode):
2092         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
2093         (WebCore::ScrollingTreeFixedNode::ScrollingTreeFixedNode):
2094         * page/scrolling/mac/ScrollingTreeMac.cpp:
2095         (ScrollingTreeMac::createScrollingTreeNode):
2096         * page/scrolling/mac/ScrollingTreeStickyNode.mm:
2097         (WebCore::ScrollingTreeStickyNode::ScrollingTreeStickyNode):
2098         * platform/graphics/GraphicsLayerClient.h:
2099         * rendering/RenderLayerCompositor.cpp:
2100         (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers):
2101         (WebCore::scrollCoordinationRoleForNodeType):
2102         (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame):
2103         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
2104
2105 2018-12-22  Carlos Garcia Campos  <cgarcia@igalia.com>
2106
2107         [HarfBuzz] Width not correctly reported as 0 for zero font size
2108         https://bugs.webkit.org/show_bug.cgi?id=192986
2109
2110         Reviewed by Michael Catanzaro.
2111
2112         Fixes test fast/text/font-size-zero.html
2113
2114         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
2115         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Use empty advances for glyphs when the font
2116         size is zero.
2117
2118 2018-12-20  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
2119
2120         Use Ref<> as much as possible
2121         https://bugs.webkit.org/show_bug.cgi?id=192808
2122
2123         Reviewed by Alex Christensen.
2124
2125         * Modules/encryptedmedia/NavigatorEME.cpp:
2126         (WebCore::NavigatorEME::requestMediaKeySystemAccess):
2127         * Modules/fetch/FetchBody.cpp:
2128         (WebCore::FetchBody::bodyAsFormData const):
2129         * Modules/geolocation/Geolocation.cpp:
2130         (WebCore::Geolocation::getCurrentPosition):
2131         (WebCore::Geolocation::watchPosition):
2132         * Modules/indexeddb/IDBDatabase.cpp:
2133         (WebCore::IDBDatabase::objectStoreNames const):
2134         * Modules/indexeddb/IDBDatabase.h:
2135         * Modules/indexeddb/IDBObjectStore.cpp:
2136         (WebCore::IDBObjectStore::indexNames const):
2137         * Modules/indexeddb/IDBObjectStore.h:
2138         * Modules/indexeddb/IDBTransaction.cpp:
2139         (WebCore::IDBTransaction::scheduleOperation):
2140         * Modules/indexeddb/IDBTransaction.h:
2141         * Modules/indexeddb/client/TransactionOperation.h:
2142         (WebCore::IDBClient::createTransactionOperation):
2143         * Modules/mediastream/MediaDevices.cpp:
2144         (WebCore::MediaDevices::getUserMedia const):
2145         (WebCore::MediaDevices::getDisplayMedia const):
2146         * Modules/mediastream/UserMediaRequest.cpp:
2147         (WebCore::UserMediaRequest::create):
2148         * Modules/mediastream/UserMediaRequest.h:
2149         * Modules/webaudio/AudioParam.cpp:
2150         (WebCore::AudioParam::calculateFinalValues):
2151         * Modules/webaudio/ScriptProcessorNode.cpp:
2152         (WebCore::ScriptProcessorNode::initialize):
2153         * Modules/webdatabase/SQLStatement.cpp:
2154         (WebCore::SQLStatement::execute):
2155         * Modules/webgpu/WebGPU.cpp:
2156         (WebCore::WebGPU::requestAdapter const):
2157         * Modules/webgpu/WebGPUAdapter.cpp:
2158         (WebCore::WebGPUAdapter::create):
2159         * Modules/webgpu/WebGPUAdapter.h:
2160         * Modules/webgpu/WebGPUBuffer.cpp:
2161         (WebCore::WebGPUBuffer::create):
2162         * Modules/webgpu/WebGPUBuffer.h:
2163         * Modules/webgpu/WebGPUCommandBuffer.cpp:
2164         (WebCore::WebGPUCommandBuffer::create):
2165         (WebCore::WebGPUCommandBuffer::beginRenderPass):
2166         * Modules/webgpu/WebGPUCommandBuffer.h:
2167         * Modules/webgpu/WebGPUDevice.cpp:
2168         (WebCore::WebGPUDevice::create):
2169         (WebCore::WebGPUDevice::createBuffer const):
2170         (WebCore::WebGPUDevice::createShaderModule const):
2171         (WebCore::WebGPUDevice::createRenderPipeline const):
2172         (WebCore::WebGPUDevice::createCommandBuffer const):
2173         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
2174         (WebCore::WebGPURenderPassEncoder::create):
2175         * Modules/webgpu/WebGPURenderPassEncoder.h:
2176         * Modules/webgpu/WebGPURenderPipeline.cpp:
2177         (WebCore::WebGPURenderPipeline::create):
2178         * Modules/webgpu/WebGPURenderPipeline.h:
2179         * Modules/webgpu/WebGPUShaderModule.cpp:
2180         (WebCore::WebGPUShaderModule::create):
2181         * Modules/webgpu/WebGPUShaderModule.h:
2182         * Modules/webgpu/WebGPUTexture.cpp:
2183         (WebCore::WebGPUTexture::createDefaultTextureView):
2184         * Modules/webgpu/WebGPUTextureView.cpp:
2185         (WebCore::WebGPUTextureView::create):
2186         * Modules/webgpu/WebGPUTextureView.h:
2187         * accessibility/AXObjectCache.cpp:
2188         (WebCore::AXObjectCache::rangeMatchesTextNearRange):
2189         * accessibility/atk/AXObjectCacheAtk.cpp:
2190         (WebCore::AXObjectCache::nodeTextChangePlatformNotification):
2191         * accessibility/atk/WebKitAccessibleHyperlink.cpp:
2192         (webkitAccessibleHyperlinkGetStartIndex):
2193         (webkitAccessibleHyperlinkGetEndIndex):
2194         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
2195         (getSelectionOffsetsForObject):
2196         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2197         (-[WebAccessibilityObjectWrapper _convertToNSRange:]):
2198         * bindings/js/JSDOMGlobalObjectTask.cpp:
2199         * bindings/js/JSDOMWindowBase.cpp:
2200         (WebCore::JSDOMWindowBase::queueTaskToEventLoop):
2201         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2202         (WebCore::JSWorkerGlobalScopeBase::queueTaskToEventLoop):
2203         * bindings/js/ScriptControllerMac.mm:
2204         (WebCore::ScriptController::createScriptInstanceForWidget):
2205         * bindings/js/SerializedScriptValue.cpp:
2206         (WebCore::CloneDeserializer::readTerminal):
2207         (WebCore::SerializedScriptValue::create):
2208         * bridge/objc/objc_instance.h:
2209         * bridge/objc/objc_instance.mm:
2210         (ObjcInstance::create):
2211         * css/CSSComputedStyleDeclaration.cpp:
2212         (WebCore::ComputedStyleExtractor::currentColorOrValidColor const):
2213         (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForShorthandProperties):
2214         (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForGridShorthand):
2215         (WebCore::ComputedStyleExtractor::getBackgroundShorthandValue):
2216         * css/CSSComputedStyleDeclaration.h:
2217         * css/CSSFontFaceSource.cpp:
2218         (WebCore::CSSFontFaceSource::load):
2219         * css/CSSStyleSheet.cpp:
2220         (WebCore::CSSStyleSheet::rules):
2221         * css/FontFace.cpp:
2222         (WebCore::FontFace::unicodeRange const):
2223         (WebCore::FontFace::featureSettings const):
2224         * css/InspectorCSSOMWrappers.cpp:
2225         (WebCore::InspectorCSSOMWrappers::collectFromStyleSheetContents):
2226         * css/SVGCSSComputedStyleDeclaration.cpp:
2227         (WebCore::strokeDashArrayToCSSValueList):
2228         (WebCore::ComputedStyleExtractor::adjustSVGPaintForCurrentColor const):
2229         * css/StyleResolver.cpp:
2230         (WebCore::StyleResolver::createFilterOperations):
2231         * css/StyleRule.cpp:
2232         (WebCore::StyleRuleBase::createCSSOMWrapper const):
2233         * css/StyleRule.h:
2234         * dom/ChildListMutationScope.cpp:
2235         (WebCore::ChildListMutationAccumulator::getOrCreate):
2236         * dom/ChildListMutationScope.h:
2237         * dom/DocumentMarkerController.cpp:
2238         (WebCore::updateRenderedRectsForMarker):
2239         * dom/InlineStyleSheetOwner.cpp:
2240         (WebCore::InlineStyleSheetOwner::createSheet):
2241         * dom/PointerEvent.h:
2242         * dom/UserGestureIndicator.h:
2243         (WebCore::UserGestureToken::create):
2244         * editing/AlternativeTextController.cpp:
2245         (WebCore::AlternativeTextController::applyAlternativeTextToRange):
2246         (WebCore::AlternativeTextController::respondToUnappliedSpellCorrection):
2247         (WebCore::AlternativeTextController::respondToUnappliedEditing):
2248         (WebCore::AlternativeTextController::markPrecedingWhitespaceForDeletedAutocorrectionAfterCommand):
2249         (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord):
2250         * editing/ApplyStyleCommand.cpp:
2251         (WebCore::ApplyStyleCommand::applyBlockStyle):
2252         (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
2253         * editing/CompositeEditCommand.cpp:
2254         (WebCore::CompositeEditCommand::targetRanges const):
2255         (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers):
2256         (WebCore::CompositeEditCommand::moveParagraphs):
2257         * editing/DeleteSelectionCommand.cpp:
2258         (WebCore::DeleteSelectionCommand::mergeParagraphs):
2259         * editing/Editing.cpp:
2260         (WebCore::visiblePositionForIndexUsingCharacterIterator):
2261         * editing/EditingStyle.cpp:
2262         (WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode):
2263         (WebCore::EditingStyle::conflictsWithInlineStyleOfElement const):
2264         (WebCore::EditingStyle::prepareToApplyAt):
2265         (WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement):
2266         (WebCore::EditingStyle::mergeStyleFromRulesForSerialization):
2267         (WebCore::EditingStyle::removeStyleFromRulesAndContext):
2268         (WebCore::extractPropertiesNotIn):
2269         * editing/Editor.cpp:
2270         (WebCore::Editor::setBaseWritingDirection):
2271         (WebCore::Editor::setComposition):
2272         * editing/EditorCommand.cpp:
2273         (WebCore::executeApplyParagraphStyle):
2274         (WebCore::executeMakeTextWritingDirectionLeftToRight):
2275         (WebCore::executeMakeTextWritingDirectionNatural):
2276         (WebCore::executeMakeTextWritingDirectionRightToLeft):
2277         * editing/FormatBlockCommand.cpp:
2278         (WebCore::FormatBlockCommand::formatRange):
2279         * editing/RemoveFormatCommand.cpp:
2280         (WebCore::RemoveFormatCommand::doApply):
2281         * editing/ReplaceRangeWithTextCommand.cpp:
2282         (WebCore::ReplaceRangeWithTextCommand::targetRanges const):
2283         * editing/ReplaceSelectionCommand.cpp:
2284         (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
2285         (WebCore::handleStyleSpansBeforeInsertion):
2286         (WebCore::ReplaceSelectionCommand::handleStyleSpans):
2287         * editing/SpellingCorrectionCommand.cpp:
2288         (WebCore::SpellingCorrectionCommand::targetRanges const):
2289         * editing/TextCheckingHelper.cpp:
2290         (WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar):
2291         * editing/TypingCommand.cpp:
2292         (WebCore::TypingCommand::insertText):
2293         (WebCore::TypingCommand::willAddTypingToOpenCommand):
2294         * editing/VisibleUnits.cpp:
2295         (WebCore::distanceBetweenPositions):
2296         * editing/cocoa/EditorCocoa.mm:
2297         (WebCore::Editor::selectionInWebArchiveFormat):
2298         * editing/ios/DictationCommandIOS.cpp:
2299         (WebCore::DictationCommandIOS::doApply):
2300         * editing/ios/EditorIOS.mm:
2301         (WebCore::Editor::setTextAlignmentForChangedBaseWritingDirection):
2302         (WebCore::Editor::removeUnchangeableStyles):
2303         (WebCore::Editor::writeImageToPasteboard):
2304         * editing/mac/EditorMac.mm:
2305         (WebCore::Editor::replaceNodeFromPasteboard):
2306         (WebCore::Editor::imageInWebArchiveFormat):
2307         * editing/markup.cpp:
2308         (WebCore::styleFromMatchedRulesAndInlineDecl):
2309         (WebCore::createFragmentForTransformToFragment):
2310         * fileapi/FileReaderLoader.cpp:
2311         (WebCore::FileReaderLoader::didFinishLoading):
2312         * html/FTPDirectoryDocument.cpp:
2313         (WebCore::createTemplateDocumentData):
2314         * html/HTMLMediaElement.cpp:
2315         (WebCore::HTMLMediaElement::scheduleEvent):
2316         (WebCore::HTMLMediaElement::createMediaControls):
2317         * html/HTMLTableElement.cpp:
2318         (WebCore::HTMLTableElement::createSharedCellStyle):
2319         * html/HTMLTableElement.h:
2320         * html/URLUtils.h:
2321         (WebCore::URLUtils<T>::origin const):
2322         * html/parser/HTMLConstructionSite.cpp:
2323         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
2324         * html/shadow/TextControlInnerElements.cpp:
2325         (WebCore::TextControlInnerElement::resolveCustomStyle):
2326         * html/track/WebVTTParser.cpp:
2327         (WebCore::WebVTTParser::createNewCue):
2328         * inspector/DOMPatchSupport.cpp:
2329         * inspector/InspectorCanvas.cpp:
2330         (WebCore::InspectorCanvas::buildInitialState):
2331         (WebCore::InspectorCanvas::buildAction):
2332         * inspector/InspectorFrontendClientLocal.cpp:
2333         (WebCore::InspectorFrontendClientLocal::openInNewTab):
2334         * inspector/InspectorStyleSheet.cpp:
2335         (WebCore::asCSSRuleList):
2336         (WebCore::InspectorStyle::styleWithProperties const):
2337         (WebCore::InspectorStyleSheet::ensureSourceData):
2338         * inspector/agents/InspectorCanvasAgent.cpp:
2339         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
2340         * inspector/agents/InspectorIndexedDBAgent.cpp:
2341         (WebCore::Inspector::keyPathFromIDBKeyPath):
2342         * inspector/agents/InspectorPageAgent.cpp:
2343         (WebCore::InspectorPageAgent::archive):
2344         * loader/EmptyClients.cpp:
2345         (WebCore::EmptyStorageNamespaceProvider::createSessionStorageNamespace):
2346         (WebCore::EmptyStorageNamespaceProvider::createLocalStorageNamespace):
2347         (WebCore::EmptyStorageNamespaceProvider::createEphemeralLocalStorageNamespace):
2348         (WebCore::EmptyStorageNamespaceProvider::createTransientLocalStorageNamespace):
2349         * loader/FrameLoader.cpp:
2350         (WebCore::FrameLoader::loadURL):
2351         (WebCore::FrameLoader::shouldInterruptLoadForXFrameOptions):
2352         (WebCore::FrameLoader::loadDifferentDocumentItem):
2353         * loader/WorkerThreadableLoader.cpp:
2354         (WebCore::WorkerThreadableLoader::loadResourceSynchronously):
2355         * loader/archive/mhtml/MHTMLParser.cpp:
2356         (WebCore::MHTMLParser::addResourceToArchive):
2357         (WebCore::MHTMLParser::parseNextPart):
2358         * loader/cache/MemoryCache.cpp:
2359         (WebCore::MemoryCache::addImageToCache):
2360         (WebCore::MemoryCache::removeResourcesWithOrigin):
2361         * page/DOMWindow.cpp:
2362         (WebCore::DOMWindow::getMatchedCSSRules const):
2363         (WebCore::DOMWindow::createWindow):
2364         * page/EventHandler.cpp:
2365         (WebCore::textDistance):
2366         * page/Page.cpp:
2367         (WebCore::Page::userStyleSheet const):
2368         * page/animation/CSSPropertyAnimation.cpp:
2369         (WebCore::blendFilterOperations):
2370         * page/ios/FrameIOS.mm:
2371         (WebCore::Frame::initWithSimpleHTMLDocument):
2372         (WebCore::Frame::interpretationsForCurrentRoot const):
2373         * page/mac/ServicesOverlayController.mm:
2374         (WebCore::ServicesOverlayController::Highlight::fadeIn):
2375         (WebCore::ServicesOverlayController::Highlight::fadeOut):
2376         * platform/SharedBuffer.cpp:
2377         (WebCore::SharedBuffer::tryCreateArrayBuffer const):
2378         * platform/audio/HRTFElevation.cpp:
2379         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
2380         * platform/audio/SincResampler.cpp:
2381         (WebCore::SincResampler::consumeSource):
2382         * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
2383         (WebCore::AudioFileReader::createBus):
2384         * platform/audio/mac/AudioFileReaderMac.cpp:
2385         (WebCore::AudioFileReader::createBus):
2386         * platform/graphics/Icon.h:
2387         (WebCore::Icon::create):
2388         * platform/graphics/InbandTextTrackPrivate.h:
2389         (WebCore::InbandTextTrackPrivate::create):
2390         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
2391         (WebCore::AVFWrapper::shouldWaitForLoadingOfResource):
2392         * platform/graphics/avfoundation/objc/AudioTrackPrivateMediaSourceAVFObjC.h:
2393         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2394         (WebCore::fulfillRequestWithKeyData):
2395         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
2396         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
2397         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
2398         (WebCore::MediaSourcePrivateAVFObjC::create):
2399         (WebCore::MediaSourcePrivateAVFObjC::addSourceBuffer):
2400         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2401         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2402         (WebCore::SourceBufferPrivateAVFObjC::create):
2403         (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):
2404         * platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.h:
2405         * platform/graphics/ca/TileController.cpp:
2406         (WebCore::TileController::createTileLayer):
2407         * platform/graphics/ca/TileController.h:
2408         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
2409         (WebCore::CACFLayerTreeHost::acceleratedCompositingAvailable):
2410         (WebCore::CACFLayerTreeHost::create):
2411         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
2412         (WebCore::GPUBuffer::create):
2413         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2414         (WebCore::MediaPlayerPrivateGStreamer::updateTracks):
2415         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
2416         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio):
2417         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText):
2418         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
2419         (WebCore::MediaPlayerPrivateGStreamer::processMpegTsSection):
2420         (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation):
2421         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2422         (WebCore::MediaPlayerPrivateGStreamerBase::paint):
2423         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2424         (WebCore::AppendPipeline::appsinkNewSample):
2425         * platform/graphics/iso/ISOProtectionSystemSpecificHeaderBox.cpp:
2426         (WebCore::ISOProtectionSystemSpecificHeaderBox::parse):
2427         * platform/graphics/iso/ISOTrackEncryptionBox.cpp:
2428         (WebCore::ISOTrackEncryptionBox::parse):
2429         * platform/graphics/texmap/TextureMapperAnimation.cpp:
2430         (WebCore::applyFilterAnimation):
2431         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
2432         (WebCore::TextureMapperPlatformLayerBuffer::clone):
2433         * platform/graphics/transforms/TransformOperations.cpp:
2434         (WebCore::TransformOperations::blendByMatchingOperations const):
2435         * platform/image-decoders/ico/ICOImageDecoder.cpp:
2436         (WebCore::ICOImageDecoder::setDataForPNGDecoderAtIndex):
2437         * platform/mock/mediasource/MockBox.cpp:
2438         (WebCore::MockInitializationBox::MockInitializationBox):
2439         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
2440         (WebCore::MockSourceBufferPrivate::create):
2441         (WebCore::MockSourceBufferPrivate::append):
2442         * platform/mock/mediasource/MockSourceBufferPrivate.h:
2443         * platform/mock/mediasource/MockTracks.h:
2444         (WebCore::MockTextTrackPrivate::create):
2445         (WebCore::MockVideoTrackPrivate::create):
2446         * platform/network/FormData.h:
2447         (WebCore::FormData::decode):
2448         * platform/network/cocoa/CookieStorageObserver.h:
2449         * platform/network/cocoa/CookieStorageObserver.mm:
2450         (WebCore::CookieStorageObserver::create):
2451         * platform/network/soup/ResourceRequestSoup.cpp:
2452         (WebCore::appendEncodedBlobItemToSoupMessageBody):
2453         (WebCore::ResourceRequest::updateSoupMessageBody const):
2454         * platform/text/hyphen/HyphenationLibHyphen.cpp:
2455         (WebCore::HyphenationDictionary::createNull):
2456         (WebCore::HyphenationDictionary::create):
2457         * platform/win/SearchPopupMenuWin.cpp:
2458         (WebCore::SearchPopupMenuWin::SearchPopupMenuWin):
2459         (WebCore::SearchPopupMenuWin::popupMenu):
2460         * platform/win/SearchPopupMenuWin.h:
2461         * rendering/RenderThemeIOS.mm:
2462         (WebCore::applyCommonButtonPaddingToStyle):
2463         (WebCore::RenderThemeIOS::paintProgressBar):
2464         (WebCore::RenderThemeIOS::adjustButtonStyle const):
2465         (WebCore::paintAttachmentIcon):
2466         * rendering/svg/SVGRenderTreeAsText.cpp:
2467         (WebCore::writeSVGResourceContainer):
2468         * storage/Storage.cpp:
2469         (WebCore::Storage::create):
2470         (WebCore::Storage::Storage):
2471         * storage/Storage.h:
2472         (WebCore::Storage::area const):
2473         * storage/StorageNamespace.h:
2474         * storage/StorageNamespaceProvider.cpp:
2475         (WebCore::StorageNamespaceProvider::localStorageArea):
2476         * storage/StorageNamespaceProvider.h:
2477         * svg/SVGElement.cpp:
2478         (WebCore::SVGElement::getPresentationAttribute):
2479         * svg/SVGFEBlendElement.cpp:
2480         (WebCore::SVGFEBlendElement::build):
2481         * svg/SVGFEColorMatrixElement.cpp:
2482         (WebCore::SVGFEColorMatrixElement::build):
2483         * svg/SVGFEComponentTransferElement.cpp:
2484         (WebCore::SVGFEComponentTransferElement::build):
2485         * svg/SVGFECompositeElement.cpp:
2486         (WebCore::SVGFECompositeElement::build):
2487         * svg/SVGFEDiffuseLightingElement.cpp:
2488         (WebCore::SVGFEDiffuseLightingElement::build):
2489         * svg/SVGFEDisplacementMapElement.cpp:
2490         (WebCore::SVGFEDisplacementMapElement::build):
2491         * svg/SVGFEDropShadowElement.cpp:
2492         (WebCore::SVGFEDropShadowElement::build):
2493         * svg/SVGFEGaussianBlurElement.cpp:
2494         (WebCore::SVGFEGaussianBlurElement::build):
2495         * svg/SVGFEMergeElement.cpp:
2496         (WebCore::SVGFEMergeElement::build):
2497         * svg/SVGFEMorphologyElement.cpp:
2498         (WebCore::SVGFEMorphologyElement::build):
2499         * svg/SVGFEOffsetElement.cpp:
2500         (WebCore::SVGFEOffsetElement::build):
2501         * svg/SVGFESpecularLightingElement.cpp:
2502         (WebCore::SVGFESpecularLightingElement::build):
2503         * svg/SVGFETileElement.cpp:
2504         (WebCore::SVGFETileElement::build):
2505         * testing/GCObservation.h:
2506         * xml/XSLTProcessor.cpp:
2507         (WebCore::XSLTProcessor::createDocumentFromSource):
2508         * xml/parser/XMLDocumentParser.cpp:
2509         (WebCore::XMLDocumentParser::parseDocumentFragment):
2510
2511 2018-12-21  Chris Dumez  <cdumez@apple.com>
2512
2513         navigator.userAgent in service workers does not reflect customUserAgent set by client
2514         https://bugs.webkit.org/show_bug.cgi?id=192951
2515
2516         Reviewed by Youenn Fablet.
2517
2518         Whenever a service worker client registers itself, also pass its effective user agent.
2519         In the network process, for each origin, we store the latest client's user agent and
2520         use it when starting the service worker.
2521
2522         * dom/Document.cpp:
2523         (WebCore::Document::setServiceWorkerConnection):
2524         * loader/DocumentLoader.cpp:
2525         (WebCore::DocumentLoader::registerTemporaryServiceWorkerClient):
2526         * workers/service/SWClientConnection.h:
2527         * workers/service/server/SWServer.cpp:
2528         (WebCore::SWServer::serviceWorkerClientUserAgent const):
2529         (WebCore::SWServer::installContextData):
2530         (WebCore::SWServer::runServiceWorker):
2531         (WebCore::SWServer::registerServiceWorkerClient):
2532         * workers/service/server/SWServer.h:
2533         * workers/service/server/SWServerToContextConnection.h:
2534         * workers/service/server/SWServerWorker.cpp:
2535         (WebCore::SWServerWorker::userAgent const):
2536         * workers/service/server/SWServerWorker.h:
2537
2538 2018-12-21  Youenn Fablet  <youenn@apple.com>
2539
2540         RTCRtpSender.setParameters() does set active parameter
2541         https://bugs.webkit.org/show_bug.cgi?id=192848
2542
2543         Reviewed by Eric Carlson.
2544
2545         Covered by updated test.
2546
2547         * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
2548         (WebCore::updateRTCRtpSendParameters):
2549         The routine was updating the local value, not the out parameter.
2550
2551 2018-12-21  Eric Carlson  <eric.carlson@apple.com>
2552
2553         'ended' Event doesn't fire on MediaStreamTrack when a USB camera is unplugged
2554         https://bugs.webkit.org/show_bug.cgi?id=187896
2555         <rdar://problem/42681445>
2556
2557         Reviewed by Jer Noble.
2558
2559         No new tests, tested manually.
2560
2561         * platform/mediastream/mac/AVVideoCaptureSource.h:
2562         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2563         (WebCore::AVVideoCaptureSource::deviceDisconnected):
2564         (-[WebCoreAVVideoCaptureSourceObserver addNotificationObservers]):
2565         (-[WebCoreAVVideoCaptureSourceObserver removeNotificationObservers]):
2566         (-[WebCoreAVVideoCaptureSourceObserver deviceConnectedDidChange:]):
2567         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
2568         (WebCore::deviceHasInputStreams):
2569         (WebCore::isValidCaptureDevice):
2570         (WebCore::CoreAudioCaptureDeviceManager::coreAudioCaptureDevices):
2571         (WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices):
2572         (WebCore::CoreAudioCaptureDeviceManager::devicesChanged): Deleted.
2573         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.h:
2574         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2575         (WebCore::CoreAudioSharedUnit::setCaptureDevice):
2576         (WebCore::CoreAudioSharedUnit::devicesChanged):
2577         (WebCore::CoreAudioSharedUnit::startProducingData):
2578         (WebCore::CoreAudioSharedUnit::startInternal):
2579         (WebCore::CoreAudioSharedUnit::verifyIsCapturing):
2580         (WebCore::CoreAudioSharedUnit::captureFailed):
2581         (WebCore::CoreAudioCaptureSourceFactory::devicesChanged):
2582         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
2583         (WebCore::CoreAudioSharedUnit::setCaptureDeviceID): Deleted.
2584         * platform/mediastream/mac/CoreAudioCaptureSource.h:
2585
2586 2018-12-20  Ryosuke Niwa  <rniwa@webkit.org>
2587
2588         REGRESSION(r239353): iOS WK1 Assertion failure in notifyChildNodeRemoved while running
2589         TestWebKitAPI.QuickLook.LegacyQuickLookContent
2590         https://bugs.webkit.org/show_bug.cgi?id=192859
2591         <rdar://problem/46887237>
2592
2593         Reviewed by Antti Koivisto.
2594
2595         After r239353, ScriptDisallowedScope::InMainThread::isScriptAllowed() may return false when the web thread
2596         is inside a delegate callback even when there is a ScriptDisallowedScope defined.
2597
2598         Replace the existign debug assertions which assert !ScriptDisallowedScope::InMainThread::isScriptAllowed()
2599         by a newly added ScriptDisallowedScope::InMainThread::hasDisallowedScope to avoid hitting this assertion.
2600
2601         Tests: TestWebKitAPI.QuickLook.LegacyQuickLookContent
2602
2603         * dom/ContainerNodeAlgorithms.cpp:
2604         (WebCore::notifyChildNodeInserted):
2605         (WebCore::notifyChildNodeRemoved):
2606         * dom/Document.cpp:
2607         (WebCore::Document::nodeChildrenWillBeRemoved):
2608         (WebCore::Document::nodeWillBeRemoved):
2609         * dom/ScriptDisallowedScope.h:
2610         (WebCore::ScriptDisallowedScope::InMainThread::hasDisallowedScope):
2611         * html/HTMLFormElement.cpp:
2612         (WebCore:: const):
2613
2614 2018-12-21  Joseph Pecoraro  <pecoraro@apple.com>
2615
2616         Update status of some WebCore features in features.json
2617         https://bugs.webkit.org/show_bug.cgi?id=192998
2618
2619         Reviewed by Tim Horton.
2620
2621         * features.json:
2622         - Variation Fonts: Supported
2623         - Conic Gradients: Supported in Preview
2624         - Web Share: Supported in Preview
2625         - <datalist>: Supported in Preview
2626         - Intersection Observers: Supported in Preview
2627
2628 2018-12-21  Zalan Bujtas  <zalan@apple.com>
2629
2630         [iOS] Using file upload can trigger a crash under RenderThemeIOS::paintFileUploadIconDecorations()
2631         https://bugs.webkit.org/show_bug.cgi?id=192357
2632         <rdar://problem/42852260>
2633
2634         Reviewed by Simon Fraser.
2635
2636         Do not try to paint the file picker when painting is disabled.
2637
2638         * rendering/RenderFileUploadControl.cpp:
2639         (WebCore::RenderFileUploadControl::paintObject):
2640
2641 2018-12-21  Jiewen Tan  <jiewen_tan@apple.com>
2642
2643         [WebAuthN] userPresence should always be true
2644         https://bugs.webkit.org/show_bug.cgi?id=192835
2645         <rdar://problem/46538788>
2646
2647         Reviewed by Brent Fulgham.
2648
2649         In the current spec as of 7 August 2018, userPresence is suggested to set to the inverse of userVerification.
2650         This doesn't comply with the CTAP spec. Details in: https://github.com/w3c/webauthn/issues/1123.
2651         After discussing with other members of the working group, we decided to make userPresence always default to true.
2652
2653         Covered by exisiting tests.
2654
2655         * Modules/webauthn/fido/DeviceRequestConverter.cpp:
2656         (fido::encodeGetAssertionRequestAsCBOR):
2657
2658 2018-12-21  Jiewen Tan  <jiewen_tan@apple.com>
2659
2660         [WebAuthN] Import an APDU coder from Chromium
2661         https://bugs.webkit.org/show_bug.cgi?id=192949
2662         <rdar://problem/46879933>
2663
2664         Reviewed by Brent Fulgham.
2665
2666         This patch imports an APDU coder from Chromium. Here is the documentation:
2667         https://fidoalliance.org/specs/fido-u2f-v1.2-ps-20170411/fido-u2f-raw-message-formats-v1.2-ps-20170411.html#u2f-message-framing
2668         APDU is a binary format to frame any U2F requests/responses into binaries. It is equivalent to CBOR in CTAP2.
2669
2670         Here is a list of files that are imported from Chromium:
2671         https://cs.chromium.org/chromium/src/components/apdu/apdu_command.cc?rcl=a2f290c10d132f53518e7f99d5635ee814ff8090
2672         https://cs.chromium.org/chromium/src/components/apdu/apdu_command.h?rcl=867b103481f6f4ccc79a69bba16c11eefac3cdb6
2673         https://cs.chromium.org/chromium/src/components/apdu/apdu_response.cc?rcl=867b103481f6f4ccc79a69bba16c11eefac3cdb6
2674         https://cs.chromium.org/chromium/src/components/apdu/apdu_response.h?rcl=867b103481f6f4ccc79a69bba16c11eefac3cdb6
2675         https://cs.chromium.org/chromium/src/components/apdu/apdu_unittest.cc?rcl=867b103481f6f4ccc79a69bba16c11eefac3cdb6
2676
2677         Covered by API tests.
2678
2679         * Modules/webauthn/apdu/ApduCommand.cpp: Added.
2680         (apdu::ApduCommand::createFromMessage):
2681         (apdu::ApduCommand::ApduCommand):
2682         (apdu::ApduCommand::getEncodedCommand const):
2683         * Modules/webauthn/apdu/ApduCommand.h: Added.
2684         * Modules/webauthn/apdu/ApduResponse.cpp: Added.
2685         (apdu::ApduResponse::createFromMessage):
2686         (apdu::ApduResponse::ApduResponse):
2687         (apdu::ApduResponse::getEncodedResponse const):
2688         * Modules/webauthn/apdu/ApduResponse.h: Added.
2689         * Sources.txt:
2690         * WebCore.xcodeproj/project.pbxproj:
2691
2692 2018-12-21  Jer Noble  <jer.noble@apple.com>
2693
2694         Convert raw CDMSessionMediaSourceAVFObjC pointer in MediaPlayerPrivateMediaSourceAVFObjC
2695         https://bugs.webkit.org/show_bug.cgi?id=192985
2696         <rdar://problem/46750743>
2697
2698         Reviewed by Eric Carlson.
2699
2700         Make m_session a RefPtr; drive-by fix: make m_mediaElement in WebKitMediaKeys a WeakPtr.
2701
2702         * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp:
2703         (WebCore::WebKitMediaKeys::setMediaElement):
2704         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h:
2705         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
2706         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2707         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2708         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
2709         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession):
2710
2711 2018-12-21  Justin Michaud  <justin_michaud@apple.com>
2712
2713         CSS variables don't work for colors in "border" property
2714         https://bugs.webkit.org/show_bug.cgi?id=192922
2715
2716         Reviewed by Simon Fraser.
2717
2718         ParseColorFunction no longer consumes anything if the color was not valid.
2719
2720         Test: css-custom-properties-api/border-variable-parsing.html
2721
2722         * css/parser/CSSPropertyParserHelpers.cpp:
2723         (WebCore::CSSPropertyParserHelpers::parseColorFunction):
2724
2725 2018-12-21  Justin Fan  <justin_fan@apple.com>
2726
2727         [WebGPU] GPUBindGroupLayout refactoring: no HashMap, and failure logging
2728         https://bugs.webkit.org/show_bug.cgi?id=192990
2729
2730         Reviewed by Myles C. Maxfield.
2731
2732         Refactor away the unnecessary HashMaps when creating MTLArgumentEncoders in GPUBindGroupLayout creation.
2733         Also update GPUBindGroupLayout::create -> tryCreate, in order to better handle Objective-C exceptions.
2734
2735         No new tests; no change in behavior.
2736
2737         * Modules/webgpu/WebGPUBindGroupLayout.cpp:
2738         (WebCore::WebGPUBindGroupLayout::create):
2739         (WebCore::WebGPUBindGroupLayout::WebGPUBindGroupLayout):
2740         * Modules/webgpu/WebGPUBindGroupLayout.h:
2741         (WebCore::WebGPUBindGroupLayout::bindGroupLayout const):
2742         * Modules/webgpu/WebGPUDevice.cpp:
2743         (WebCore::WebGPUDevice::createBindGroupLayout const):
2744         * platform/graphics/gpu/GPUBindGroupLayout.h:
2745         * platform/graphics/gpu/GPUDevice.cpp:
2746         (WebCore::GPUDevice::tryCreateBindGroupLayout const): Renamed from ::create*. Now returning a RefPtr. 
2747         (WebCore::GPUDevice::createBindGroupLayout const): Deleted.
2748         * platform/graphics/gpu/GPUDevice.h:
2749         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
2750         (WebCore::appendArgumentToArray):
2751         (WebCore::newEncoder):
2752         (WebCore::GPUBindGroupLayout::tryCreate): Renamed from ::create. Now returning a RefPtr.
2753         (WebCore::GPUBindGroupLayout::GPUBindGroupLayout):
2754         (WebCore::appendArgumentToArrayInMap): Deleted.
2755         (WebCore::GPUBindGroupLayout::create): Deleted.
2756
2757         Deleted unneeded GPUBindGroupLayout.cpp:
2758         * Sources.txt:
2759         * WebCore.xcodeproj/project.pbxproj:
2760         * platform/graphics/gpu/GPUBindGroupLayout.cpp: Removed.
2761
2762 2018-12-21  Alejandro G. Castro  <alex@igalia.com>
2763
2764         [GTK][WPE] Add DeviceIdHashSaltStorage disk persistence
2765         https://bugs.webkit.org/show_bug.cgi?id=190466
2766
2767         Reviewed by Youenn Fablet.
2768
2769         Added persistency to the DeviceIdHashSaltStorage.
2770
2771         * platform/glib/FileSystemGlib.cpp:
2772         (WebCore::FileSystem::getFileSize): Implemented this function to
2773         allow sharing code with the statistics storage class.
2774         * platform/glib/KeyedDecoderGlib.cpp:
2775         (WebCore::KeyedDecoderGlib::dictionaryFromGVariant): Added a
2776         condition to control situations where the key is empty, it can
2777         happen if the user modifies the file in the disk.
2778         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp: Add include
2779         to make work compilation with debug, unified builds.
2780
2781 2018-12-21  Zalan Bujtas  <zalan@apple.com>
2782
2783         Synchronous media query evaluation could destroy current Frame/FrameView.
2784         https://bugs.webkit.org/show_bug.cgi?id=192781
2785         <rdar://problem/34416793>
2786
2787         Reviewed by Chris Dumez.
2788
2789         Protect Frame and FrameView when coming back from printing and check if the current Frame/FrameView/FrameLoader objects are still valid.
2790
2791         Test: printing/print-with-media-query-destory.html
2792
2793         * loader/DocumentLoader.cpp:
2794         (WebCore::DocumentLoader::finishedLoading):
2795         * page/Frame.cpp:
2796         (WebCore::Frame::setPrinting):
2797         * page/FrameView.cpp:
2798         (WebCore::FrameView::forceLayoutForPagination):
2799         * page/PrintContext.cpp:
2800         (WebCore::PrintContext::PrintContext):
2801         (WebCore::PrintContext::computePageRects):
2802         (WebCore::PrintContext::computePageRectsWithPageSizeInternal):
2803         (WebCore::PrintContext::begin):
2804         (WebCore::PrintContext::computeAutomaticScaleFactor):
2805         (WebCore::PrintContext::spoolPage):
2806         (WebCore::PrintContext::spoolRect):
2807         (WebCore::PrintContext::end):
2808         * page/PrintContext.h:
2809         (WebCore::PrintContext::frame const): Deleted.
2810
2811 2018-12-21  Wenson Hsieh  <wenson_hsieh@apple.com>
2812
2813         Setting the file wrapper and content type of an attachment to a PDF should update its image
2814         https://bugs.webkit.org/show_bug.cgi?id=192984
2815         <rdar://problem/46798028>
2816
2817         Reviewed by Tim Horton.
2818
2819         Allow PDF data to be used to update enclosing image elements when setting the file wrapper for an attachment.
2820         Covered by a new API test: WKAttachmentTests.SetFileWrapperForPDFImageAttachment.
2821
2822         * html/HTMLAttachmentElement.cpp:
2823         (WebCore::mimeTypeIsSuitableForInlineImageAttachment):
2824         (WebCore::HTMLAttachmentElement::updateEnclosingImageWithData):
2825
2826 2018-12-21  Justin Michaud  <justin_michaud@apple.com>
2827
2828         Repeated background images with zero size should display the background color
2829         https://bugs.webkit.org/show_bug.cgi?id=192962
2830
2831         Reviewed by Antti Koivisto.
2832
2833         Test: fast/backgrounds/background-repeat-with-zero-size.html
2834
2835         * platform/LengthSize.h:
2836         (WebCore::LengthSize::isEmpty const):
2837         * rendering/RenderBoxModelObject.cpp:
2838         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
2839         * rendering/style/FillLayer.h:
2840         (WebCore::FillLayer::isEmpty const):
2841
2842 2018-12-21  Manuel Rego Casasnovas  <rego@igalia.com>
2843
2844         [css-grid] Fix percentages in relative offsets for grid items
2845         https://bugs.webkit.org/show_bug.cgi?id=190492
2846
2847         Reviewed by Sergio Villar Senin.
2848
2849         The method RenderBoxModelObject::relativePositionOffset() was not considering the case of grid items,
2850         where the containing block is the grid area.
2851         The patch modifies the method so the new code uses overrideContainingBlockContentWidth|Height when required.
2852
2853         Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-relative-offsets-002.html
2854
2855         * rendering/RenderBox.cpp: Implement the physical versions of the already existent methods.
2856         (WebCore::RenderBox::overrideContainingBlockContentWidth const):
2857         (WebCore::RenderBox::overrideContainingBlockContentHeight const):
2858         (WebCore::RenderBox::hasOverrideContainingBlockContentWidth const):
2859         (WebCore::RenderBox::hasOverrideContainingBlockContentHeight const):
2860         * rendering/RenderBox.h:
2861         * rendering/RenderBoxModelObject.cpp:
2862         (WebCore::RenderBoxModelObject::relativePositionOffset const): Modified method
2863         to take into account overrideContainingBlockContentWidth|Height for grid items.
2864         * rendering/RenderBoxModelObject.h: Added new headers for physical virtual methods
2865         that will be overridden in RenderBox.
2866         (WebCore::RenderBoxModelObject::overrideContainingBlockContentWidth const):
2867         (WebCore::RenderBoxModelObject::overrideContainingBlockContentHeight const):
2868         (WebCore::RenderBoxModelObject::hasOverrideContainingBlockContentWidth const):
2869         (WebCore::RenderBoxModelObject::hasOverrideContainingBlockContentHeight const):
2870
2871 2018-12-20  Justin Fan  <justin_fan@apple.com>
2872
2873         [WebGPU] Convert WebGPUBindGroups into MTLArgumentEncoders
2874         https://bugs.webkit.org/show_bug.cgi?id=192956
2875
2876         Reviewed by Myles Maxfield.
2877
2878         No testable behavior change. Existing tests cover possible crashing.
2879
2880         Add GPUBindGroupLayoutMetal.mm:
2881         * SourcesCocoa.txt:
2882         * WebCore.xcodeproj/project.pbxproj:
2883
2884         Flesh out GPUBindGroupLayout::create:
2885         * platform/graphics/gpu/GPUBindGroupLayout.cpp:
2886         * platform/graphics/gpu/GPUBindGroupLayout.h:
2887         * platform/graphics/gpu/GPUDevice.cpp:
2888         (WebCore::GPUDevice::createBindGroupLayout const):
2889         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm: Added.
2890         (WebCore::appendArgumentToArrayInMap): Added.
2891         (WebCore::GPUBindGroupLayout::create):
2892         (WebCore::GPUBindGroupLayout::GPUBindGroupLayout):
2893         (WebCore::MTLDataTypeForBindingType): Added.
2894
2895 2018-12-20  Michael Catanzaro  <mcatanzaro@igalia.com>
2896
2897         Unreviewed, remove stray #pragma once added to .cpp file
2898
2899         * svg/properties/SVGAttributeOwnerProxy.cpp:
2900
2901 2018-12-20  Justin Michaud  <justin_michaud@apple.com>
2902
2903         Adding runtime-enabled attribute to Element prevents inlining property access
2904         https://bugs.webkit.org/show_bug.cgi?id=192901
2905
2906         Add a call to flattenDictionaryObject after disabling runtime-enabled attributes.
2907
2908         Reviewed by Ryosuke Niwa.
2909
2910         * bindings/scripts/CodeGeneratorJS.pm:
2911         (GenerateImplementation):
2912         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
2913         (WebCore::JSTestEnabledBySettingPrototype::finishCreation):
2914         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2915         (WebCore::JSTestGenerateIsReachablePrototype::finishCreation):
2916         * bindings/scripts/test/JS/JSTestNode.cpp:
2917         (WebCore::JSTestNodePrototype::finishCreation):
2918         * bindings/scripts/test/JS/JSTestObj.cpp:
2919         (WebCore::JSTestObjPrototype::finishCreation):
2920
2921 2018-12-20  Chris Dumez  <cdumez@apple.com>
2922
2923         Use Optional::hasValue() instead of Optional::has_value()
2924         https://bugs.webkit.org/show_bug.cgi?id=192948
2925
2926         Reviewed by Tim Horton.
2927
2928         * bindings/js/DOMPromiseProxy.h:
2929         (WebCore::DOMPromiseProxy<IDLType>::isFulfilled const):
2930         (WebCore::DOMPromiseProxy<IDLVoid>::isFulfilled const):
2931         (WebCore::DOMPromiseProxyWithResolveCallback<IDLType>::isFulfilled const):
2932         * dom/DataTransferItemList.h:
2933         (WebCore::DataTransferItemList::hasItems const):
2934         * dom/EventTarget.cpp:
2935         (WebCore::EventTarget::addEventListener):
2936         * html/HTMLMediaElement.cpp:
2937         (WebCore::HTMLMediaElement::captionDisplayMode):
2938         * platform/graphics/MediaPlayer.cpp:
2939         (WebCore::MediaPlayer::wouldTaintOrigin const):
2940         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2941         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
2942         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2943         (WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected):
2944         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
2945         (webKitMediaSrcUpdatePresentationSize):
2946         * platform/mac/NSScrollerImpDetails.mm:
2947         (WebCore::ScrollerStyle::recommendedScrollerStyle):
2948         * rendering/RenderListItem.cpp:
2949         (WebCore::RenderListItem::setExplicitValue):
2950
2951 2018-12-20  Chris Dumez  <cdumez@apple.com>
2952
2953         Move HTTPS_UPGRADE code behind a runtime flag, off by default
2954         https://bugs.webkit.org/show_bug.cgi?id=192937
2955
2956         Reviewed by Youenn Fablet.
2957
2958         Move HTTPS_UPGRADE code behind a runtime flag, off by default and drop the build time flag.
2959
2960         * page/Settings.yaml:
2961
2962 2018-12-20  Youenn Fablet  <youenn@apple.com>
2963
2964         Remove custom constructors of ReadableStreamDefaultReader and ReadableStreamBYOBReader
2965         https://bugs.webkit.org/show_bug.cgi?id=192838
2966
2967         Reviewed by Chris Dumez.
2968
2969         Generate constructor code in case of a Private but not Public constructor.
2970         Make sure this is correctly exposed in global objects.
2971         Add JS built-in constructor implementations for those two objects.
2972
2973         Also add JS built-in constructors for controller and byob request.
2974         To keep existing behavior, JS built-ins calling these constructors need to pass
2975         an additional parameter that allows making the difference between a JS builtin caller or a JS caller.
2976         In the latter case, the constructor will throw.
2977
2978         Covered by existing tests, no observable change of behavior.
2979
2980         * Modules/streams/ReadableByteStreamController.idl:
2981         * Modules/streams/ReadableByteStreamController.js:
2982         (initializeReadableByteStreamController):
2983         (getter.byobRequest):
2984         * Modules/streams/ReadableByteStreamInternals.js:
2985         (privateInitializeReadableByteStreamController): Deleted.
2986         (privateInitializeReadableStreamBYOBRequest): Deleted.
2987         * Modules/streams/ReadableStream.js:
2988         (initializeReadableStream):
2989         * Modules/streams/ReadableStreamBYOBReader.js:
2990         (initializeReadableStreamBYOBReader):
2991         * Modules/streams/ReadableStreamBYOBRequest.idl:
2992         * Modules/streams/ReadableStreamBYOBRequest.js:
2993         (initializeReadableStreamBYOBRequest):
2994         * Modules/streams/ReadableStreamDefaultController.idl:
2995         * Modules/streams/ReadableStreamDefaultController.js:
2996         (initializeReadableStreamDefaultController):
2997         (enqueue):
2998         * Modules/streams/ReadableStreamDefaultReader.js:
2999         (initializeReadableStreamDefaultReader):
3000         * Modules/streams/ReadableStreamInternals.js:
3001         (readableStreamDefaultControllerError): Deleted.
3002         * Sources.txt:
3003         * UnifiedSources-input.xcfilelist:
3004         * WebCore.xcodeproj/project.pbxproj:
3005         * bindings/js/JSDOMBuiltinConstructor.h:
3006         * bindings/js/JSDOMGlobalObject.cpp:
3007         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
3008         * bindings/js/JSReadableStreamPrivateConstructors.cpp: Removed.
3009         * bindings/js/JSReadableStreamPrivateConstructors.h: Removed.
3010         * bindings/scripts/CodeGeneratorJS.pm:
3011         (GeneratePropertiesHashTable):
3012         * bindings/scripts/preprocess-idls.pl:
3013         (shouldExposeInterface):
3014
3015 2018-12-20  Jiewen Tan  <jiewen_tan@apple.com>
3016
3017         [WebAuthN] Remove hash from Client Data
3018         https://bugs.webkit.org/show_bug.cgi?id=192727
3019         <rdar://problem/46746673>
3020
3021         Reviewed by Brent Fulgham.
3022
3023         The hash algorithm for hashing the client data is enforced to SHA_256 in the latest spec:
3024         https://www.w3.org/TR/webauthn/#sec-client-data. Therefore, we should remove it.
3025
3026         Covered by existing tests.
3027
3028         * Modules/webauthn/AuthenticatorCoordinator.cpp:
3029         (WebCore::AuthenticatorCoordinatorInternal::produceClientDataJson):
3030
3031 2018-12-20  Jiewen Tan  <jiewen_tan@apple.com>
3032
3033         [WebAuthN] Add a runtime flag for local authenticator
3034         https://bugs.webkit.org/show_bug.cgi?id=192792
3035         <rdar://problem/46798738>
3036
3037         Reviewed by Brent Fulgham.
3038
3039         No tests.
3040
3041         This patch adds a runtime flag for local authenticator and removes ways to
3042         set the runtime flag for web authentication in LegacyWebKit.
3043
3044         * page/RuntimeEnabledFeatures.h:
3045         (WebCore::RuntimeEnabledFeatures::setWebAuthenticationLocalAuthenticatorEnabled):
3046         (WebCore::RuntimeEnabledFeatures::webAuthenticationLocalAuthenticatorEnabled const):
3047
3048 2018-12-20  Jeremy Jones  <jeremyj@apple.com>
3049
3050         Pointer lock causes abandoned documents
3051         https://bugs.webkit.org/show_bug.cgi?id=188727
3052         rdar://problem/44248197
3053         
3054         Reviewed by Simon Fraser.
3055
3056         Fixes --world-leaks in these tests:
3057
3058         pointer-lock/locked-element-removed-from-dom.html
3059         pointer-lock/mouse-event-delivery.html
3060         fast/shadow-dom/pointerlockelement-in-slot.html
3061
3062         PointerLockController now uses WeakPtr instead of RefPtr because it has no need to extend the lifetime of a document.
3063
3064         * page/PointerLockController.cpp:
3065         (WebCore::PointerLockController::elementRemoved):
3066         (WebCore::PointerLockController::documentDetached):
3067         (WebCore::PointerLockController::didAcquirePointerLock):
3068         * page/PointerLockController.h:
3069
3070 2018-12-20  Chris Dumez  <cdumez@apple.com>
3071
3072         Use Optional::valueOr() instead of Optional::value_or()
3073         https://bugs.webkit.org/show_bug.cgi?id=192933
3074
3075         Reviewed by Geoffrey Garen.
3076
3077         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
3078         (WebCore::convert):
3079         (WebCore::ApplePayPaymentHandler::didAuthorizePayment):
3080         * Modules/encryptedmedia/MediaKeySession.cpp:
3081         (WebCore::MediaKeySession::load):
3082         * Modules/indexeddb/IDBDatabaseIdentifier.h:
3083         (WebCore::IDBDatabaseIdentifier::hash const):
3084         * Modules/indexeddb/IDBFactory.cpp:
3085         (WebCore::IDBFactory::open):
3086         * Modules/mediastream/MediaStreamTrack.cpp:
3087         (WebCore::MediaStreamTrack::applyConstraints):
3088         * Modules/mediastream/RTCDTMFSender.cpp:
3089         (WebCore::RTCDTMFSender::insertDTMF):
3090         * Modules/webdatabase/SQLTransaction.cpp:
3091         (WebCore::SQLTransaction::executeSql):
3092         * Modules/webvr/VRFrameData.cpp:
3093         (WebCore::VRFrameData::update):
3094         * animation/AnimationTimeline.cpp:
3095         (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
3096         * animation/DeclarativeAnimation.cpp:
3097         (WebCore::DeclarativeAnimation::cancel):
3098         (WebCore::DeclarativeAnimation::invalidateDOMEvents):
3099         * animation/KeyframeEffect.cpp:
3100         (WebCore::computeMissingKeyframeOffsets):
3101         (WebCore::KeyframeEffect::applyPendingAcceleratedActions):
3102         * animation/WebAnimation.cpp:
3103         (WebCore::WebAnimation::runPendingPlayTask):
3104         (WebCore::WebAnimation::runPendingPauseTask):
3105         * bindings/js/SerializedScriptValue.cpp:
3106         (WebCore::CloneSerializer::write):
3107         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
3108         (WebCore::CryptoAlgorithmHMAC::generateKey):
3109         (WebCore::CryptoAlgorithmHMAC::importKey):
3110         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
3111         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
3112         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
3113         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
3114         (WebCore::CryptoKeyRSA::importSpki):
3115         (WebCore::CryptoKeyRSA::importPkcs8):
3116         * crypto/keys/CryptoKeyRSA.cpp:
3117         (WebCore::CryptoKeyRSA::importJwk):
3118         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
3119         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
3120         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
3121         * crypto/mac/CryptoKeyRSAMac.cpp:
3122         (WebCore::CryptoKeyRSA::importSpki):
3123         (WebCore::CryptoKeyRSA::importPkcs8):
3124         * css/CSSComputedStyleDeclaration.cpp:
3125         (WebCore::counterToCSSValue):
3126         * css/CSSFontFace.cpp:
3127         (WebCore::calculateItalicRange):
3128         * css/CSSPrimitiveValue.cpp:
3129         (WebCore::CSSPrimitiveValue::doubleValue const):
3130         * css/CSSStyleSheet.cpp:
3131         (WebCore::CSSStyleSheet::addRule):
3132         * css/DOMMatrix.cpp:
3133         (WebCore::DOMMatrix::rotateSelf):
3134         * css/DOMMatrixReadOnly.cpp:
3135         (WebCore::DOMMatrixReadOnly::validateAndFixup):
3136         * css/StyleBuilderCustom.h:
3137         (WebCore::StyleBuilderCustom::applyValueCounter):
3138         * css/parser/MediaQueryParser.cpp:
3139         (WebCore::MediaQueryParser::commitMediaQuery):
3140         * dom/Document.h:
3141         (WebCore::Document::referrerPolicy const):
3142         * dom/Element.cpp:
3143         (WebCore::toScrollAlignment):
3144         * dom/EventTarget.cpp:
3145         (WebCore::EventTarget::addEventListener):
3146         * dom/MutationObserver.cpp:
3147         (WebCore::MutationObserver::observe):
3148         * editing/cocoa/FontAttributeChangesCocoa.mm:
3149         (WebCore::FontChanges::platformFontFamilyNameForCSS const):
3150         * fileapi/File.cpp:
3151         (WebCore::File::File):
3152         * html/DOMTokenList.cpp:
3153         (WebCore::DOMTokenList::toggle):
3154         * html/HTMLOListElement.h:
3155         * html/ImageBitmap.cpp:
3156         (WebCore::croppedSourceRectangleWithFormatting):
3157         * html/canvas/CanvasPattern.cpp:
3158         (WebCore::CanvasPattern::setTransform):
3159         * html/canvas/CanvasRenderingContext2DBase.cpp:
3160         (WebCore::CanvasRenderingContext2DBase::setTransform):
3161         (WebCore::CanvasRenderingContext2DBase::isPointInPathInternal):
3162         (WebCore::CanvasRenderingContext2DBase::isPointInStrokeInternal):
3163         * html/canvas/Path2D.cpp:
3164         (WebCore::Path2D::addPath):
3165         * inspector/InspectorCanvas.cpp:
3166         (WebCore::InspectorCanvas::buildAction):
3167         * inspector/InspectorFrontendHost.cpp:
3168         (WebCore::populateContextMenu):
3169         * layout/FormattingContext.cpp:
3170         (WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const):
3171         * layout/FormattingContextGeometry.cpp:
3172         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
3173         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
3174         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
3175         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
3176         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
3177         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
3178         (WebCore::Layout::FormattingContext::Geometry::inFlowPositionedPositionOffset):
3179         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
3180         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
3181         * layout/FormattingContextQuirks.cpp:
3182         (WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight):
3183         * layout/MarginTypes.h:
3184         (WebCore::Layout::VerticalMargin::usedValues const):
3185         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3186         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
3187         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
3188         (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraints):
3189         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
3190         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedHeight):
3191         * layout/displaytree/DisplayBox.h:
3192         (WebCore::Display::Box::width const):
3193         (WebCore::Display::Box::height const):
3194         (WebCore::Display::Box::contentBoxTop const):
3195         (WebCore::Display::Box::contentBoxLeft const):
3196         * layout/floats/FloatingContext.cpp:
3197         (WebCore::Layout::Iterator::set):
3198         * layout/inlineformatting/InlineFormattingContext.cpp:
3199         (WebCore::Layout::InlineFormattingContext::appendContentToLine const):
3200         (WebCore::Layout::InlineFormattingContext::placeInFlowPositionedChildren const):
3201         * loader/FrameLoader.cpp:
3202         (WebCore::FrameLoader::urlSelected):
3203         * loader/NavigationAction.cpp:
3204         * page/FrameView.cpp:
3205         (WebCore::FrameView::setLayoutViewportOverrideRect):
3206         (WebCore::FrameView::documentToAbsoluteScaleFactor const):
3207         (WebCore::FrameView::viewportSizeForCSSViewportUnits const):
3208         * page/Page.cpp:
3209         (WebCore::Page::setLowPowerModeEnabledOverrideForTesting):
3210         * page/SecurityOriginData.cpp:
3211         (WebCore::SecurityOriginData::databaseIdentifier const):
3212         * page/SecurityOriginData.h:
3213         (WebCore::SecurityOriginDataHash::hash):
3214         * page/SecurityOriginHash.h:
3215         (WebCore::SecurityOriginHash::hash):
3216         * page/ViewportConfiguration.cpp:
3217         (WebCore::ViewportConfiguration::setViewLayoutSize):
3218         * page/WindowFeatures.cpp:
3219         (WebCore::parseDialogFeatures):
3220         * page/animation/AnimationBase.cpp:
3221         (WebCore::AnimationBase::updateStateMachine):
3222         (WebCore::AnimationBase::fireAnimationEventsIfNeeded):
3223         (WebCore::AnimationBase::getTimeToNextEvent const):
3224         (WebCore::AnimationBase::freezeAtTime):
3225         (WebCore::AnimationBase::getElapsedTime const):
3226         * page/animation/CSSAnimationController.cpp:
3227         (WebCore::CSSAnimationControllerPrivate::updateAnimationTimer):
3228         * page/cocoa/ResourceUsageThreadCocoa.mm:
3229         (WebCore::ResourceUsageThread::platformThreadBody):
3230         * page/linux/ResourceUsageThreadLinux.cpp:
3231         (WebCore::ResourceUsageThread::platformThreadBody):
3232         * platform/graphics/ComplexTextController.cpp:
3233         (WebCore::ComplexTextController::offsetForPosition):
3234         * platform/graphics/FontCache.h:
3235         (WebCore::FontDescriptionKey::computeHash const):
3236         * platform/graphics/FontCascade.cpp:
3237         (WebCore::FontCascade::drawText const):
3238         (WebCore::FontCascade::drawEmphasisMarks const):
3239         (WebCore::FontCascade::displayListForTextRun const):
3240         (WebCore::FontCascade::adjustSelectionRectForText const):
3241         (WebCore::FontCascade::codePath const):
3242         * platform/graphics/FontSelectionAlgorithm.cpp:
3243         (WebCore::FontSelectionAlgorithm::styleDistance const):
3244         * platform/graphics/FontSelectionAlgorithm.h:
3245         (WebCore::operator<<):
3246         (WebCore::FontSelectionSpecifiedCapabilities::computeWeight const):
3247         (WebCore::FontSelectionSpecifiedCapabilities::computeWidth const):
3248         (WebCore::FontSelectionSpecifiedCapabilities::computeSlope const):
3249         * platform/graphics/ShadowBlur.cpp:
3250         (WebCore::ShadowBlur::calculateLayerBoundingRect):
3251         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
3252         (WebCore::WebCoreAVCFResourceLoader::startLoading):
3253         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3254         (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
3255         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3256         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext):
3257         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3258         (WebCore::SourceBufferPrivateAVFObjC::naturalSize):
3259         * platform/graphics/ca/GraphicsLayerCA.cpp:
3260         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
3261         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3262         (WebCore::preparePlatformFont):
3263         * platform/graphics/filters/FETurbulence.cpp:
3264         (WebCore::FETurbulence::fillRegion const):
3265         * platform/graphics/gstreamer/GStreamerCommon.cpp:
3266         (WebCore::initializeGStreamer):
3267         * platform/graphics/texmap/TextureMapperLayer.cpp:
3268         (WebCore::TextureMapperLayer::paintSelfAndChildrenWithReplica):
3269         (WebCore::TextureMapperLayer::replicaTransform):
3270         (WebCore::TextureMapperLayer::syncAnimations):
3271         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3272         (WebCore::CoordinatedGraphicsLayer::transformedVisibleRect):
3273         (WebCore::CoordinatedGraphicsLayer::computeTransformedVisibleRect):
3274         * platform/graphics/transforms/TransformState.cpp:
3275         (WebCore::TransformState::mappedPoint const):
3276         (WebCore::TransformState::mapQuad const):
3277         (WebCore::TransformState::flattenWithTransform):
3278         * platform/network/CacheValidation.cpp:
3279         (WebCore::computeCurrentAge):
3280         (WebCore::computeFreshnessLifetimeForHTTPFamily):
3281         * platform/network/NetworkStateNotifier.cpp:
3282         (WebCore::NetworkStateNotifier::onLine):
3283         * rendering/FloatingObjects.cpp:
3284         (WebCore::FindNextFloatLogicalBottomAdapter::nextLogicalBottom const):
3285         (WebCore::FindNextFloatLogicalBottomAdapter::nextShapeLogicalBottom const):
3286         * rendering/GridBaselineAlignment.cpp:
3287         (WebCore::GridBaselineAlignment::ascentForChild const):
3288         * rendering/GridTrackSizingAlgorithm.cpp:
3289         (WebCore::GridTrack::setGrowthLimit):
3290         (WebCore::GridTrackSizingAlgorithm::initialBaseSize const):
3291         (WebCore::GridTrackSizingAlgorithm::initialGrowthLimit const):
3292         (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem):
3293         (WebCore::sortByGridTrackGrowthPotential):
3294         (WebCore::GridTrackSizingAlgorithm::estimatedGridAreaBreadthForChild const):
3295         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
3296         (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):
3297         * rendering/PaintInfo.h:
3298         (WebCore::PaintInfo::applyTransform):
3299         * rendering/RenderBox.cpp:
3300         (WebCore::RenderBox::computeLogicalHeight const):
3301         * rendering/RenderCounter.cpp:
3302         (WebCore::planCounter):
3303         * rendering/RenderDeprecatedFlexibleBox.cpp:
3304         (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
3305         * rendering/RenderFlexibleBox.cpp:
3306         (WebCore::RenderFlexibleBox::baselinePosition const):
3307         (WebCore::RenderFlexibleBox::marginBoxAscentForChild):
3308         (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax):
3309         * rendering/RenderGrid.cpp:
3310         (WebCore::RenderGrid::gridGap const):
3311         (WebCore::RenderGrid::baselinePosition const):
3312         * rendering/RenderLayer.cpp:
3313         (WebCore::RenderLayer::paintLayerByApplyingTransform):
3314         * rendering/RenderListBox.cpp:
3315         (WebCore::RenderListBox::paintItem):
3316         (WebCore::RenderListBox::listIndexIsVisible):
3317         * rendering/RenderMultiColumnSet.cpp:
3318         (WebCore::RenderMultiColumnSet::calculateMaxColumnHeight const):
3319         * rendering/RenderTable.cpp:
3320         (WebCore::RenderTable::convertStyleLogicalHeightToComputedHeight):
3321         * rendering/RenderTableCell.cpp:
3322         (WebCore::RenderTableCell::cellBaselinePosition const):
3323         * rendering/RenderTableSection.cpp:
3324         (WebCore::RenderTableSection::firstLineBaseline const):
3325         * rendering/RenderText.cpp:
3326         (WebCore::RenderText::computePreferredLogicalWidths):
3327         (WebCore::RenderText::previousOffset const):
3328         (WebCore::RenderText::previousOffsetForBackwardDeletion const):
3329         (WebCore::RenderText::nextOffset const):
3330         (WebCore::RenderText::stringView const):
3331         * rendering/RenderView.cpp:
3332         (WebCore::RenderView::layout):
3333         * rendering/mathml/RenderMathMLBlock.cpp:
3334         (WebCore::RenderMathMLBlock::baselinePosition const):
3335         * rendering/mathml/RenderMathMLBlock.h:
3336         (WebCore::RenderMathMLBlock::ascentForChild):
3337         * rendering/style/GridPosition.cpp:
3338         (WebCore::GridPosition::max):
3339         * rendering/style/TextUnderlineOffset.h:
3340         (WebCore::TextUnderlineOffset::lengthOr const):
3341         * rendering/svg/RenderSVGContainer.cpp:
3342         (WebCore::RenderSVGContainer::nodeAtFloatPoint):
3343         * rendering/svg/RenderSVGForeignObject.cpp:
3344         (WebCore::RenderSVGForeignObject::nodeAtFloatPoint):
3345         * rendering/svg/RenderSVGImage.cpp:
3346         (WebCore::RenderSVGImage::nodeAtFloatPoint):
3347         * rendering/svg/RenderSVGResourceClipper.cpp:
3348         (WebCore::RenderSVGResourceClipper::hitTestClipContent):
3349         * rendering/svg/RenderSVGResourceFilter.cpp:
3350         (WebCore::RenderSVGResourceFilter::postApplyResource):
3351         * rendering/svg/RenderSVGRoot.cpp:
3352         (WebCore::RenderSVGRoot::nodeAtPoint):
3353         * rendering/svg/RenderSVGShape.cpp:
3354         (WebCore::RenderSVGShape::nodeAtFloatPoint):
3355         * rendering/svg/RenderSVGText.cpp:
3356         (WebCore::RenderSVGText::nodeAtFloatPoint):
3357         * rendering/svg/SVGRenderingContext.cpp:
3358         (WebCore::SVGRenderingContext::clipToImageBuffer):
3359         * svg/SVGToOTFFontConversion.cpp:
3360         (WebCore::SVGToOTFFontConverter::processGlyphElement):
3361         (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter):
3362
3363 2018-12-20  Jer Noble  <jer.noble@apple.com>
3364
3365         REGRESSION (r239419): heap-use-after-free in AudioSourceProviderAVFObjC::finalizeCallback()
3366         https://bugs.webkit.org/show_bug.cgi?id=192941
3367         <rdar://problem/46874096>
3368
3369         Reviewed by Brent Fulgham.
3370
3371         Don't delete the locked lock before unlocking the lock. 
3372
3373         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
3374         (WebCore::AudioSourceProviderAVFObjC::finalizeCallback):
3375
3376 2018-12-20  Keith Rollin  <krollin@apple.com>
3377
3378         Improve release-level page-load logging
3379         https://bugs.webkit.org/show_bug.cgi?id=192872
3380         <rdar://problem/46850309>
3381
3382         Reviewed by Chris Dumez.
3383
3384         There are a number of reported bugs that are difficult or impossible
3385         to track down with our current level of logging. Additionally, some
3386         software groups lower in the page-loading stack have requested logging
3387         sufficient for tracking a user-visible error message down to the
3388         requested resource that caused the message. Add more-comprehensive
3389         logging to address these issues/requests.
3390
3391         No new tests -- no changed functionality.
3392
3393         * loader/DocumentLoader.cpp:
3394         (WebCore::DocumentLoader::setMainDocumentError):
3395         (WebCore::DocumentLoader::mainReceivedError):
3396         (WebCore::DocumentLoader::stopLoading):
3397         (WebCore::DocumentLoader::notifyFinished):
3398         (WebCore::DocumentLoader::willSendRequest):
3399         (WebCore::DocumentLoader::continueAfterContentPolicy):
3400         (WebCore::DocumentLoader::startLoadingMainResource):
3401         (WebCore::DocumentLoader::loadMainResource):
3402         (WebCore::DocumentLoader::cancelMainResourceLoad):
3403         * loader/FrameLoader.cpp:
3404         (WebCore::FrameLoader::urlSelected):
3405         (WebCore::FrameLoader::loadURLIntoChildFrame):
3406         (WebCore::FrameLoader::loadArchive):
3407         (WebCore::FrameLoader::loadInSameDocument):
3408         (WebCore::FrameLoader::loadFrameRequest):
3409         (WebCore::FrameLoader::loadURL):
3410         (WebCore::FrameLoader::load):
3411         (WebCore::FrameLoader::loadWithNavigationAction):
3412         (WebCore::FrameLoader::loadWithDocumentLoader):
3413         (WebCore::FrameLoader::reloadWithOverrideEncoding):
3414         (WebCore::FrameLoader::reload):
3415         (WebCore::FrameLoader::setState):
3416         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
3417         (WebCore::FrameLoader::loadPostRequest):
3418         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
3419         (WebCore::FrameLoader::loadDifferentDocumentItem):
3420         * loader/ProgressTracker.cpp:
3421         (WebCore::ProgressItem::ProgressItem):
3422         (WebCore::ProgressTracker::reset):
3423         (WebCore::ProgressTracker::progressStarted):
3424         (WebCore::ProgressTracker::progressCompleted):
3425         (WebCore::ProgressTracker::finalProgressComplete):
3426         (WebCore::ProgressTracker::incrementProgress):
3427         (WebCore::ProgressTracker::completeProgress):
3428         (WebCore::ProgressTracker::isAlwaysOnLoggingAllowed const):
3429         * loader/ProgressTracker.h:
3430         * loader/ResourceLoader.cpp:
3431         (WebCore::ResourceLoader::loadDataURL):
3432         (WebCore::ResourceLoader::willSendRequestInternal):
3433         (WebCore::ResourceLoader::didFinishLoading):
3434         (WebCore::ResourceLoader::didFail):
3435         (WebCore::ResourceLoader::willSendRequestAsync):
3436         (WebCore::ResourceLoader::wasBlocked):
3437         (WebCore::ResourceLoader::cannotShowURL):
3438         * loader/SubresourceLoader.cpp:
3439         (WebCore::SubresourceLoader::willSendRequestInternal):
3440         (WebCore::=):
3441         (WebCore::SubresourceLoader::didReceiveResponse):
3442         (WebCore::SubresourceLoader::didFinishLoading):
3443         (WebCore::SubresourceLoader::didFail):
3444         (WebCore::SubresourceLoader::willCancel):
3445         * loader/cache/CachedResource.cpp:
3446         (WebCore::CachedResource::load):
3447
3448 2018-12-20  Jeremy Jones  <jeremyj@apple.com>
3449
3450         Switch tabs before retuning PiP video to inline.
3451         https://bugs.webkit.org/show_bug.cgi?id=192767
3452         rdar://problem/46006046
3453
3454         Reviewed by Jer Noble.
3455
3456         No new tests because this code path only happens with a user action on system UI.
3457
3458         When exiting PiP, notify the fullscreen change observer so it can restore client UI state before exiting.
3459
3460         * platform/mac/VideoFullscreenInterfaceMac.mm:
3461         (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]):
3462
3463 2018-12-19  Michael Catanzaro  <mcatanzaro@igalia.com>
3464
3465         Unreviewed, fix GTK build after r239410
3466
3467         It added a new file to the build, breaking the unified sources magic that obscured a bug in
3468         URLSoup.h. It forward-declares URL, but this never worked unless the URL.h header was
3469         included via another source file in the unified source bundle.
3470
3471         * platform/network/soup/URLSoup.h:
3472
3473 2018-12-19  Chris Dumez  <cdumez@apple.com>
3474
3475         wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from
3476         https://bugs.webkit.org/show_bug.cgi?id=192728
3477         <rdar://problem/46746779>
3478
3479         Reviewed by Geoff Garen.
3480
3481         * Modules/*:
3482         * animation/*:
3483         * bindings/*:
3484         * crypto/*:
3485         * css/*:
3486         * dom/*:
3487         * editing/*:
3488         * fileapi/*:
3489         * html/*:
3490         * inspector/*:
3491         * layout/*:
3492         * loader/*:
3493         * mathml/*:
3494         * page/*:
3495         * platform/*:
3496         * plugins/*:
3497         * rendering/*:
3498         * testing/*:
3499         * workers/*:
3500         * xml/*:
3501
3502 2018-12-19  Jer Noble  <jer.noble@apple.com>
3503
3504         Leak of MTAudioProcessingTap (304 bytes) in com.apple.WebKit.WebContent running WebKit layout tests
3505         https://bugs.webkit.org/show_bug.cgi?id=192896
3506         <rdar://46732186>
3507
3508         Reviewed by Eric Carlson.
3509
3510         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
3511         (WebCore::AudioSourceProviderAVFObjC::initCallback):
3512
3513 2018-12-19  Timothy Hatcher  <timothy@apple.com>
3514
3515         REGRESSION (r232991): Switching to dark mode in Mail does not update the message view to be transparent
3516         https://bugs.webkit.org/show_bug.cgi?id=188891
3517         rdar://problem/42344352
3518
3519         Reviewed by Simon Fraser.
3520
3521         * rendering/RenderLayerCompositor.cpp:
3522         (WebCore::RenderLayerCompositor::rootBackgroundColorOrTransparencyChanged):
3523         Don't return early when m_layerForOverhangAreas is null to avoid skipping
3524         setRootLayerConfigurationNeedsUpdate() and scheduleCompositingLayerUpdate().
3525
3526 2018-12-19  Justin Fan  <justin_fan@apple.com>
3527
3528         [WebGPU] Add stubs for WebGPUPipelineLayout/Descriptor and device::createPipelineLayout
3529         https://bugs.webkit.org/show_bug.cgi?id=192843
3530         <rdar://problem/46820395>
3531
3532         Reviewed by Myles Maxfield.
3533
3534         Test: webgpu/pipeline-layouts.html
3535
3536         Implement the emtpy WebGPUPipelineLayout interface, and enable creation via WebGPUDevice::createPipelineLayout:
3537         * Modules/webgpu/WebGPUBindGroupLayout.cpp:
3538         (WebCore::WebGPUBindGroupLayout::WebGPUBindGroupLayout):
3539         * Modules/webgpu/WebGPUBindGroupLayout.h:
3540         (WebCore::WebGPUBindGroupLayout::bindGroupLayout const): Added getter.
3541         * Modules/webgpu/WebGPUDevice.cpp:
3542         (WebCore::WebGPUDevice::createPipelineLayout const): Added.
3543         * Modules/webgpu/WebGPUDevice.h:
3544         * Modules/webgpu/WebGPUDevice.idl: Enable createPipelineLayout.
3545         * Modules/webgpu/WebGPUPipelineLayout.cpp: Added.
3546         (WebCore::WebGPUPipelineLayout::create):
3547         (WebCore::WebGPUPipelineLayout::WebGPUPipelineLayout):
3548         * Modules/webgpu/WebGPUPipelineLayout.h: Added.
3549         * Modules/webgpu/WebGPUPipelineLayout.idl: Added.
3550         * Modules/webgpu/WebGPUPipelineLayoutDescriptor.h: Added.
3551         * Modules/webgpu/WebGPUPipelineLayoutDescriptor.idl: Added.
3552         * platform/graphics/gpu/GPUDevice.cpp:
3553         (WebCore::GPUDevice::createPipelineLayout const): Added.
3554         * platform/graphics/gpu/GPUDevice.h:
3555         * platform/graphics/gpu/GPUPipelineLayout.cpp: Added.
3556         (WebCore::GPUPipelineLayout::create):
3557         (WebCore::GPUPipelineLayout::GPUPipelineLayout):
3558         * platform/graphics/gpu/GPUPipelineLayout.h: Added.
3559         * platform/graphics/gpu/GPUPipelineLayoutDescriptor.h: Added.
3560
3561         Add files and symbols to project:
3562         * CMakeLists.txt:
3563         * DerivedSources.make:
3564         * Sources.txt:
3565         * WebCore.xcodeproj/project.pbxproj:
3566         * bindings/js/WebCoreBuiltinNames.h:
3567
3568         Add missing include:
3569         * Modules/webgpu/WebGPUQueue.h:
3570
3571 2018-12-18  Ryosuke Niwa  <rniwa@webkit.org>
3572
3573         SVGUseElement::findTarget should return nullptr when there is a cycle
3574         https://bugs.webkit.org/show_bug.cgi?id=192840
3575
3576         Reviewed by Tim Horton.
3577
3578         r233366 added an early return to updateShadowTree() when there is a cycle between an use element and its target.
3579         Consolidate this cycle detection code with the one in SVGUseElement::findTarget which detected cycles when
3580         the SVG use element itself had a corresponding element.
3581
3582         No new tests since there should be no behavioral change.
3583
3584         * svg/SVGUseElement.cpp:
3585         (WebCore::SVGUseElement::updateShadowTree):
3586         (WebCore::SVGUseElement::findTarget const):
3587
3588 2018-12-19  Myles C. Maxfield  <mmaxfield@apple.com>
3589
3590         [WHLSL] Add a handwritten lexer
3591         https://bugs.webkit.org/show_bug.cgi?id=192294
3592
3593         Reviewed by Jon Lee.
3594
3595         This is infrastructure necessary for https://bugs.webkit.org/show_bug.cgi?id=192355. The
3596         implementation matches the lexing rules in the spec (specifically, the rules that start
3597         with an uppercase letter). The spec is at
3598         https://github.com/gpuweb/WHLSL/blob/master/Spec/WHLSL.g4.
3599
3600         This patch also modifies the lexer according to https://github.com/gpuweb/WHLSL/pull/283.
3601
3602         No new tests because the lexer isn't hooked up yet; there are tests in the parser,
3603         once that gets committed.
3604
3605         * Modules/webgpu/WHLSL/WHLSLLexer.cpp: Added.
3606         (WebCore::WHLSL::Lexer::Token::typeName):
3607         (WebCore::WHLSL::Lexer::recognizeKeyword):
3608         (WebCore::WHLSL::Lexer::consumeTokenFromStream):
3609         (WebCore::WHLSL::Lexer::skipWhitespaceAndComments):
3610         (WebCore::WHLSL::isWhitespace):
3611         (WebCore::WHLSL::isNewline):
3612         (WebCore::WHLSL::Lexer::skipWhitespace):
3613         (WebCore::WHLSL::Lexer::skipLineComment):
3614         (WebCore::WHLSL::Lexer::skipLongComment):
3615         (WebCore::WHLSL::Lexer::coreDecimalIntLiteral const):
3616         (WebCore::WHLSL::Lexer::decimalIntLiteral const):
3617         (WebCore::WHLSL::Lexer::decimalUintLiteral const):
3618         (WebCore::WHLSL::isHexadecimalCharacter):
3619         (WebCore::WHLSL::Lexer::coreHexadecimalIntLiteral const):
3620         (WebCore::WHLSL::Lexer::hexadecimalIntLiteral const):
3621         (WebCore::WHLSL::Lexer::hexadecimalUintLiteral const):
3622         (WebCore::WHLSL::Lexer::intLiteral const):
3623         (WebCore::WHLSL::Lexer::uintLiteral const):
3624         (WebCore::WHLSL::Lexer::digit const):
3625         (WebCore::WHLSL::Lexer::digitStar const):
3626         (WebCore::WHLSL::Lexer::character const):
3627         (WebCore::WHLSL::Lexer::coreFloatLiteralType1 const):
3628         (WebCore::WHLSL::Lexer::coreFloatLiteral const):
3629         (WebCore::WHLSL::Lexer::floatLiteral const):
3630         (WebCore::WHLSL::Lexer::validIdentifier const):
3631         (WebCore::WHLSL::Lexer::identifier const):
3632         (WebCore::WHLSL::Lexer::operatorName const):
3633         * Modules/webgpu/WHLSL/WHLSLLexer.h: Added.
3634         (WebCore::WHLSL::Lexer::Lexer):
3635         (WebCore::WHLSL::Lexer::consumeToken):
3636         (WebCore::WHLSL::Lexer::unconsumeToken):
3637         (WebCore::WHLSL::Lexer::state const):
3638         (WebCore::WHLSL::Lexer::setState):
3639         (WebCore::WHLSL::Lexer::isFullyConsumed const):
3640         (WebCore::WHLSL::Lexer::errorString):
3641         (WebCore::WHLSL::Lexer::string const):
3642         (WebCore::WHLSL::Lexer::anyCharacter const):
3643         * Sources.txt:
3644         * WebCore.xcodeproj/project.pbxproj:
3645
3646 2018-12-18  Simon Fraser  <simon.fraser@apple.com>
3647
3648         Web Inspector: Timelines: correctly label Intersection Observer callbacks
3649         https://bugs.webkit.org/show_bug.cgi?id=192669
3650         <rdar://problem/46702490>
3651
3652         Reviewed by Joseph Pecoraro.
3653
3654         Add InspectorInstrumentation::willFireObserverCallback() and use it to wrap calls
3655         to Intersection Observer, Performance Observer and Mutation Observer callbacks so 
3656         that they get correctly labeled in the Inspector timeline.
3657
3658         * dom/MutationObserver.cpp:
3659         (WebCore::MutationObserver::deliver):
3660         * en.lproj/Localizable.strings:
3661         * inspector/InspectorInstrumentation.cpp:
3662         (WebCore::InspectorInstrumentation::willFireObserverCallbackImpl):
3663         (WebCore::InspectorInstrumentation::didFireObserverCallbackImpl):
3664         * inspector/InspectorInstrumentation.h:
3665         (WebCore::InspectorInstrumentation::willFireObserverCallback):
3666         (WebCore::InspectorInstrumentation::didFireObserverCallback):
3667         * inspector/TimelineRecordFactory.cpp:
3668         (WebCore::TimelineRecordFactory::createObserverCallbackData):
3669         * inspector/TimelineRecordFactory.h:
3670         * inspector/agents/InspectorTimelineAgent.cpp:
3671         (WebCore::InspectorTimelineAgent::willFireObserverCallback):
3672         (WebCore::InspectorTimelineAgent::didFireObserverCallback):
3673         (WebCore::toProtocol):
3674         * inspector/agents/InspectorTimelineAgent.h:
3675         * page/IntersectionObserver.cpp:
3676         (WebCore::IntersectionObserver::notify):
3677         * page/PerformanceObserver.cpp:
3678         (WebCore::PerformanceObserver::deliver):
3679
3680 2018-12-19  Claudio Saavedra  <csaavedra@igalia.com>
3681
3682         ContentExtensions: DFANode.cpp:66:44: error: narrowing conversion of '-1' from 'int' to 'char' inside { }
3683         https://bugs.webkit.org/show_bug.cgi?id=192854
3684
3685         Reviewed by Alex Christensen.
3686
3687         * contentextensions/DFANode.h: Define CharRange's chars as signed
3688
3689 2018-12-19  Youenn Fablet  <youenn@apple.com>
3690
3691         Remove RTCRtpTransceiver.setDirection
3692         https://bugs.webkit.org/show_bug.cgi?id=192869
3693
3694         Reviewed by Alex Christensen.
3695
3696         Covered by rebased test.
3697
3698         * Modules/mediastream/RTCRtpTransceiver.idl:
3699
3700 2018-12-19  Jer Noble  <jer.noble@apple.com>
3701
3702         Force synchronous decode in WebCoreDecompressionSession::decodeSampleSync()
3703         https://bugs.webkit.org/show_bug.cgi?id=192856
3704         <rdar://problem/46843245>
3705
3706         Reviewed by Alex Christensen.
3707
3708         Some decoders exposed through VideoToolbox will decode asynchronously even when 
3709         kVTDecodeInfo_Asynchronous is not set. Force synchronous behavior with a Semaphore.
3710
3711         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
3712         (WebCore::WebCoreDecompressionSession::decodeSampleSync):
3713
3714 2018-12-19  Megan Gardner  <megan_gardner@apple.com>
3715
3716         Allow clients to set the navigator platform
3717         https://bugs.webkit.org/show_bug.cgi?id=192735
3718
3719         Reviewed by Tim Horton.
3720
3721         Expanded TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm.
3722
3723         Lots of piping to allow the setting of a custom navigator platform.
3724
3725         * loader/DocumentLoader.h:
3726         (WebCore::DocumentLoader::setCustomNavigatorPlatform):
3727         (WebCore::DocumentLoader::customNavigatorPlatform const):
3728         * loader/FrameLoader.cpp:
3729         (WebCore::FrameLoader::navigatorPlatform const):
3730         * loader/FrameLoader.h:
3731         * page/Navigator.cpp:
3732         (WebCore::Navigator::platform const):
3733         * page/Navigator.h:
3734         * page/NavigatorBase.cpp:
3735         (WebCore::NavigatorBase::platform const):
3736         (WebCore::NavigatorBase::platform): Deleted.
3737         * page/NavigatorBase.h:
3738
3739 2018-12-19  Ryan Haddad  <ryanhaddad@apple.com>
3740
3741         Unreviewed, rolling out r239347.
3742
3743         Caused the leaks bot to hit an exception and the new test
3744         crashes on certain configurations.
3745
3746         Reverted changeset:
3747
3748         "Synchronous media query evaluation could destroy current
3749         Frame/FrameView."
3750         https://bugs.webkit.org/show_bug.cgi?id=192781
3751         https://trac.webkit.org/changeset/239347
3752
3753 2018-12-19  Truitt Savell  <tsavell@apple.com>
3754
3755         Unreviewed, rolling out r239358.
3756
3757         Revision caused imported/w3c/web-platform-tests/IndexedDB/ to
3758         crash on Debug bots
3759
3760         Reverted changeset:
3761
3762         "Clean up IndexedDB files between tests"
3763         https://bugs.webkit.org/show_bug.cgi?id=192796
3764         https://trac.webkit.org/changeset/239358
3765
3766 2018-12-19  Don Olmstead  <don.olmstead@sony.com>
3767
3768         Sync some include directories in WebCore
3769         https://bugs.webkit.org/show_bug.cgi?id=192819
3770
3771         Reviewed by Michael Catanzaro.
3772
3773         Added missing include directories around features that have only been enabled on
3774         Apple ports. Removes obsolete directories from list and moves harfbuzz directories
3775         into the freetype cmake file.
3776
3777         * CMakeLists.txt:
3778         * platform/FreeType.cmake:
3779
3780 2018-12-19  Alicia Boya García  <aboya@igalia.com>
3781
3782         [MSE] Remove unused method: stopAskingForMoreSamples()
3783         https://bugs.webkit.org/show_bug.cgi?id=192754
3784
3785         Reviewed by Xabier Rodriguez-Calvar.
3786
3787         The stopAskingForMoreSamples() method from SourceBufferPrivate is not
3788         being used by anyone. SourceBuffer is not calling it and no
3789         SourceBufferPrivate is implementing it. Let's remove that noise.
3790
3791         * platform/graphics/SourceBufferPrivate.h:
3792         (WebCore::SourceBufferPrivate::setActive):
3793         (WebCore::SourceBufferPrivate::stopAskingForMoreSamples): Deleted.
3794         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
3795         (WebCore::SourceBufferPrivateGStreamer::stopAskingForMoreSamples): Deleted.
3796         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
3797
3798 2018-12-19  Alicia Boya García  <aboya@igalia.com>
3799
3800         [MSE] Remove dead code: sourceBufferPrivateSeekToTime()
3801         https://bugs.webkit.org/show_bug.cgi?id=192827
3802
3803         Reviewed by Xabier Rodriguez-Calvar.
3804
3805         This patch makes two dead code removal changes in
3806         SourceBufferPrivateClient:
3807
3808         First, sourceBufferPrivateFastSeekTimeForMediaTime() is made pure
3809         virtual in SourceBufferPrivateClient. Since SourceBufferPrivateClient
3810         is only inherited by SourceBuffer, it makes no sense to have default
3811         implementations there (they will never be used), moreso it being a
3812         client interface.
3813
3814         Second, sourceBufferPrivateSeekToTime() is removed entirely. It used
3815         to had an empty implementation, which SourceBuffer did not overwrite,
3816         therefore making any calls to it useless.
3817
3818         All calls to sourceBufferPrivateSeekToTime() have been removed:
3819
3820         SourceBufferPrivateAVFObjC::seekToTime(), which was also dead code
3821         itself, used to call this method. This patch deletes it completely.
3822
3823         MockSourceBufferPrivate::seekToTime(), which only called this empty
3824         method, has also been removed along with its only usage in
3825         MockMediaSourcePrivate::seekToTime().
3826
3827         * platform/graphics/SourceBufferPrivateClient.h:
3828         (WebCore::SourceBufferPrivateClient::sourceBufferPrivateFastSeekTimeForMediaTime): Deleted.
3829         (WebCore::SourceBufferPrivateClient::sourceBufferPrivateSeekToTime): Deleted.
3830         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
3831         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3832         (WebCore::SourceBufferPrivateAVFObjC::seekToTime): Deleted.
3833         * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
3834         (WebCore::MockMediaSourcePrivate::seekToTime):
3835         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
3836         (WebCore::MockSourceBufferPrivate::seekToTime): Deleted.
3837         * platform/mock/mediasource/MockSourceBufferPrivate.h:
3838
3839 2018-12-19  Xabier Rodriguez Calvar  <calvaris@igalia.com>
3840
3841         [EME] MediaKeySystemConfiguration distinctiveIdentifier and persistentState should default to optional
3842         https://bugs.webkit.org/show_bug.cgi?id=192815
3843
3844         Reviewed by Jer Noble.
3845
3846         https://www.w3.org/TR/encrypted-media/#dom-mediakeysystemconfiguration
3847         says that distinctiveIdentifier and persistentState default to
3848         optional. Our implementation does not define a default leaving it
3849         to the first option of the enum, which currently is Required.
3850
3851         * platform/encryptedmedia/CDMKeySystemConfiguration.h:
3852
3853 2018-12-19  Rob Buis  <rbuis@igalia.com>
3854
3855         Merge parseAccessControlExposeHeadersAllowList into parseAccessControlAllowList
3856         https://bugs.webkit.org/show_bug.cgi?id=192288
3857
3858         Reviewed by Frédéric Wang.
3859
3860         Prefer return value to out parameter for parseAccessControlAllowList.
3861
3862         * loader/CrossOriginPreflightResultCache.cpp:
3863         (WebCore::CrossOriginPreflightResultCacheItem::parse):
3864         * platform/network/HTTPParsers.h:
3865         (WebCore::parseAccessControlAllowList):
3866         * platform/network/ResourceResponseBase.cpp:
3867         (WebCore::ResourceResponseBase::filter):
3868         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting):
3869
3870 2018-12-18  Zan Dobersek  <zdobersek@igalia.com>
3871
3872         REGRESSION(r235165): [GTK][WPE] Garbled rendering on GitLab
3873         https://bugs.webkit.org/show_bug.cgi?id=192230
3874
3875         Reviewed by Carlos Garcia Campos.
3876
3877         Single tile can after r235165 be assigned multiple content updates
3878         without a commit occurring between each update, whereas before these
3879         commits were done for each update.
3880
3881         To avoid repeating updates for a single tile purging information about
3882         the previous update, these updates are now accumulated inside a Vector
3883         and then iterated over during the commit phase.
3884
3885         * platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp:
3886         (WebCore::CoordinatedBackingStoreTile::addUpdate):
3887         (WebCore::CoordinatedBackingStoreTile::swapBuffers):
3888         (WebCore::CoordinatedBackingStore::updateTile):
3889         (WebCore::CoordinatedBackingStoreTile::setBackBuffer): Deleted.
3890         * platform/graphics/texmap/coordinated/CoordinatedBackingStore.h:
3891         (WebCore::CoordinatedBackingStoreTile::scale const):
3892
3893 2018-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
3894
3895         [iOS] A copied text selection is pasted as a web archive attachment in the entry view in Messages
3896         https://bugs.webkit.org/show_bug.cgi?id=192842
3897         <rdar://problem/46823586>
3898
3899         Reviewed by Tim Horton.
3900
3901         Temporarily revert a behavior change introduced by r238661, where we now add "com.apple.webarchive" as a
3902         registered UTI when dragging or copying a text selection. This broke the Messages app on iOS, which currently
3903         inserts a copied or dragged text selection from WebKit-based views as a web archive file attachment. A fix for
3904         this is internally tracked in <rdar://problem/46830277>.
3905
3906         * platform/ios/PlatformPasteboardIOS.mm:
3907         (WebCore::PlatformPasteboard::write):
3908
3909 2018-12-18  Michael Catanzaro  <mcatanzaro@igalia.com>
3910
3911         Unreviewed, add a missing UNUSED_PARAM()
3912
3913         * Modules/mediarecorder/MediaRecorder.cpp:
3914         (WebCore::MediaRecorder::getPrivateImpl):
3915
3916 2018-12-18  Justin Michaud  <justin_michaud@apple.com>
3917
3918         Update CSS Properties and Values API to use new cycle fallback behaviour
3919         https://bugs.webkit.org/show_bug.cgi?id=192800
3920
3921         Reviewed by Antti Koivisto.
3922
3923         Make CSS variables that are registered and involved in a cycle be treated as invalid. This also fixes a crash in the
3924         wpt tests where relative units and calc() in a registered property's initial value would break things instead of failing. 
3925
3926         * css/CSSCustomPropertyValue.h:
3927         * css/CSSVariableReferenceValue.cpp:
3928         (WebCore::resolveVariableReference):
3929         * css/DOMCSSRegisterCustomProperty.cpp:
3930         (WebCore::DOMCSSRegisterCustomProperty::registerProperty):
3931         * css/StyleResolver.cpp:
3932         (WebCore::StyleResolver::applyCascadedCustomProperty):
3933         * css/parser/CSSPropertyParser.cpp:
3934         (WebCore::CSSPropertyParser::parseTypedCustomPropertyValue):
3935
3936 2018-12-18  Daniel Bates  <dabates@apple.com>
3937
3938         Wrong value for key property in keydown and keyup events generated holding Control key
3939         https://bugs.webkit.org/show_bug.cgi?id=192788
3940         <rdar://problem/46795214>
3941
3942         Reviewed by Wenson Hsieh.
3943
3944         Similar to what we do on Mac, compute the DOM key property from the characters ignoring
3945         modifier keys input string when the Control key is held down.
3946
3947         * platform/ios/PlatformEventFactoryIOS.mm:
3948         (WebCore::keyForKeyEvent):
3949         * platform/mac/PlatformEventFactoryMac.mm:
3950         (WebCore::keyForKeyEvent):
3951
3952 2018-12-18  Sihui Liu  <sihui_liu@apple.com>
3953
3954         Clean up IndexedDB files between tests
3955         https://bugs.webkit.org/show_bug.cgi?id=192796
3956
3957         Reviewed by Geoffrey Garen.
3958
3959         We should clean up the IndexedDB files between tests to make sure each test is independent of others.
3960
3961         This patch also fixes some issues in IDB.
3962
3963         Covered by existing tests.
3964
3965         * Modules/indexeddb/server/IDBServer.cpp:
3966         (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince):
3967         We should shut down all open databases instead of databases from open database connections before deleting 
3968         files, because database starts accessing files before connection to database is established.
3969
3970         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3971         (WebCore::IDBServer::UniqueIDBDatabase::shutdownForClose):
3972         We should shutdown database after tasks in queue are completed, because tasks have pointer of UniqueIDBDatabase 
3973         and UniqueIDBDatabase can be destructed after shutdown.