Disable NetworkStateNotifier::singleton()'s isMainThread() assertion when the WebThre...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-03-01  Chris Dumez  <cdumez@apple.com>
2
3         Disable NetworkStateNotifier::singleton()'s isMainThread() assertion when the WebThread is enabled
4         https://bugs.webkit.org/show_bug.cgi?id=195230
5         <rdar://problem/47925359>
6
7         Reviewed by Ryosuke Niwa.
8
9         Disable NetworkStateNotifier::singleton()'s isMainThread() assertion when the WebThread is enabled
10         to address crashes on iOS WK1.
11
12         * platform/network/NetworkStateNotifier.cpp:
13         (WebCore::shouldSuppressThreadSafetyCheck):
14         (WebCore::NetworkStateNotifier::singleton):
15
16 2019-03-01  Simon Fraser  <simon.fraser@apple.com>
17
18         Show mouse event regions in the overlay
19         https://bugs.webkit.org/show_bug.cgi?id=195227
20
21         Reviewed by Tim Horton.
22
23         Enhance event region overlays to show more kinds of events.
24
25         * page/DebugPageOverlays.cpp:
26         (WebCore::touchEventRegionColors):
27         (WebCore::NonFastScrollableRegionOverlay::drawRect):
28
29 2019-03-01  Zalan Bujtas  <zalan@apple.com>
30
31         [ContentChangeObserver] Check for pending style recalcs at the end of each timer run.
32         https://bugs.webkit.org/show_bug.cgi?id=195220
33         <rdar://problem/48518979>
34
35         Reviewed by Simon Fraser.
36
37         didScheduleStyleRecalc callback was introduced to see if a style recalc is scheduled while firing the DOM timer. However it does not handle the case
38         when in addition to this style recalc scheduling, something later (though during the same timer firing) triggers a sync style recalc.
39         Let's just check if we've got a pending style recalc when the DOM timer comes back.
40
41         Test: fast/events/touch/ios/style-recalc-schedule-and-force-relalc.html
42
43         * dom/Document.cpp:
44         (WebCore::Document::scheduleStyleRecalc):
45         * page/ios/ContentChangeObserver.cpp:
46         (WebCore::hasPendingStyleRecalc):
47         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
48         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
49         (WebCore::ContentChangeObserver::startObservingContentChanges):
50         (WebCore::ContentChangeObserver::didScheduleStyleRecalc): Deleted.
51         * page/ios/ContentChangeObserver.h:
52         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling): Deleted.
53         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling): Deleted.
54         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling const): Deleted.
55
56 2019-03-01  John Wilander  <wilander@apple.com>
57
58         Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration
59         https://bugs.webkit.org/show_bug.cgi?id=195196
60         <rdar://problem/48006419>
61
62         Reviewed by Brent Fulgham.
63
64         Tests: http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html
65                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html
66                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html
67                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html
68                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html
69
70         Trackers abuse link query parameters to transport user identifiers cross-site.
71         This patch detects such navigations and applies further restrictions to
72         client-site cookies on the destination page.
73
74         * platform/network/NetworkStorageSession.cpp:
75         (WebCore::NetworkStorageSession::setAgeCapForClientSideCookies):
76             Now sets the regular 7-day cap and a reduced 1-day cap.
77         (WebCore::NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics):
78             Renamed NetworkStorageSession::removeStorageAccessForAllFramesOnPage() to
79             NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics since
80             it now clears out two types of page-specific data.
81         (WebCore::NetworkStorageSession::committedCrossSiteLoadWithLinkDecoration):
82             This function receives a cross-site navigation and checks if the originating
83             site is a prevalent resource. If so, it marks the page or stricter cookie
84             rules.
85         (WebCore::NetworkStorageSession::resetCrossSiteLoadsWithLinkDecorationForTesting):
86             Test infrastructure. This sets a state that overrides the regular per-page
87             clear of data. The reason is that the double clear was racy and caused test
88             failures.
89         (WebCore::NetworkStorageSession::clientSideCookieCap const):
90             New function that returns the current cookie lifetime cap.
91         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage): Deleted.
92             Renamed to NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics().
93         * platform/network/NetworkStorageSession.h:
94         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
95         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
96             Now calls NetworkStorageSession::clientSideCookieCap() to set the cap.
97
98 2019-03-01  Rob Buis  <rbuis@igalia.com>
99
100         Adjust XMLHttpRequest Content-Type handling
101         https://bugs.webkit.org/show_bug.cgi?id=184645
102
103         Reviewed by Youenn Fablet.
104
105         Implement steps 4.4.1.2 and 4.4.1.3 of send() [1].
106
107         Test: web-platform-tests/xhr/send-content-type-charset.htm
108
109         [1] https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send
110
111         * platform/network/ParsedContentType.cpp:
112         (WebCore::ParsedContentType::setCharset):
113         * platform/network/ParsedContentType.h:
114         * xml/XMLHttpRequest.cpp:
115         (WebCore::replaceCharsetInMediaTypeIfNeeded):
116         (WebCore::XMLHttpRequest::send):
117         (WebCore::replaceCharsetInMediaType): Deleted.
118
119 2019-03-01  Youenn Fablet  <youenn@apple.com>
120
121         Update originsMatch to handle the case of file origins which enforce file path separation
122         https://bugs.webkit.org/show_bug.cgi?id=195216
123
124         Reviewed by Brady Eidson.
125
126         Covered by the assertion and existing tests like fast/xmlhttprequest/xmlhttprequest-no-file-access.html.
127         Make sure originsMatch returns true if either compared origins are the same object
128         or they have the same file path separation behavior.
129
130         * page/SecurityOrigin.cpp:
131         (WebCore::areOriginsMatching):
132         (WebCore::originsMatch):
133
134 2019-03-01  Youenn Fablet  <youenn@apple.com>
135
136         Serialize IndexedDB::ObjectStoreOverwriteMode as an enum
137         https://bugs.webkit.org/show_bug.cgi?id=195213
138
139         Reviewed by Alex Christensen.
140
141         Add traits to enable enum IPC encoding.
142         No change of behavior.
143
144         * Modules/indexeddb/IndexedDB.h:
145
146 2019-03-01  Don Olmstead  <don.olmstead@sony.com>
147
148         [WinCairo] Enable service worker
149         https://bugs.webkit.org/show_bug.cgi?id=188318
150
151         Reviewed by Youenn Fablet.
152
153         * WebCorePrefix.h:
154         * testing/ServiceWorkerInternals.h:
155         * workers/service/context/SWContextManager.cpp:
156         (WebCore::SWContextManager::serviceWorkerFailedToTerminate):
157         * workers/service/context/SWContextManager.h:
158
159 2019-03-01  Sihui Liu  <sihui_liu@apple.com>
160
161         Add a quirk for bostongloble.com and latimes.com
162         https://bugs.webkit.org/show_bug.cgi?id=195155
163
164         Reviewed by Geoffrey Garen.
165
166         Covered by manual testing.
167
168         * Modules/webdatabase/DOMWindowWebDatabase.idl:
169         * bindings/scripts/CodeGeneratorJS.pm:
170         (GenerateRuntimeEnableConditionalString):
171         * bindings/scripts/IDLAttributes.json:
172         * bindings/scripts/preprocess-idls.pl:
173         (GenerateConstructorAttributes):
174         * page/Quirks.cpp:
175         (WebCore::Quirks::hasWebSQLSupportQuirk const):
176         * page/Quirks.h:
177
178 2019-03-01  Zalan Bujtas  <zalan@apple.com>
179
180         [ContentChangeObserver] Rename members and move implementation to header.
181         https://bugs.webkit.org/show_bug.cgi?id=195198
182         <rdar://problem/48499967>
183
184         Reviewed by Simon Fraser.
185
186         * page/ios/ContentChangeObserver.cpp:
187         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
188         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
189         (WebCore::ContentChangeObserver::startObservingStyleRecalc):
190         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
191         (WebCore::ContentChangeObserver::startObservingContentChanges):
192         (WebCore::ContentChangeObserver::stopObservingContentChanges):
193         (WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope):
194         (WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope):
195         (WebCore::ContentChangeObserver::startObservingStyleResolve): Deleted.
196         (WebCore::ContentChangeObserver::stopObservingStyleResolve): Deleted.
197         (WebCore::ContentChangeObserver::isObservingContentChanges): Deleted.
198         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling): Deleted.
199         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling): Deleted.
200         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling): Deleted.
201         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling): Deleted.
202         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling): Deleted.
203         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling): Deleted.
204         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc): Deleted.
205         (WebCore::ContentChangeObserver::shouldObserveNextStyleRecalc): Deleted.
206         (WebCore::ContentChangeObserver::countOfObservedDOMTimers): Deleted.
207         (WebCore::ContentChangeObserver::clearObservedDOMTimers): Deleted.
208         (WebCore::ContentChangeObserver::containsObservedDOMTimer): Deleted.
209         * page/ios/ContentChangeObserver.h:
210         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling):
211         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling):
212         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling const):
213         (WebCore::ContentChangeObserver::containsObservedDOMTimer const):
214         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling):
215         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling):
216         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling const):
217         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc):
218         (WebCore::ContentChangeObserver::shouldObserveStyleRecalc const):
219         (WebCore::ContentChangeObserver::isObservingContentChanges const):
220         (WebCore::ContentChangeObserver::countOfObservedDOMTimers const):
221         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
222
223 2019-03-01  Zalan Bujtas  <zalan@apple.com>
224
225         [ContentChangeObserver] ContentChangeObserver::StyleChangeScope should not set WKContentVisibilityChange directly
226         https://bugs.webkit.org/show_bug.cgi?id=195197
227         <rdar://problem/48498332>
228
229         Reviewed by Simon Fraser.
230
231         Add didContentVisibilityChange to hide WKContentVisibilityChange value. We might also want to add some logic to didContentVisibilityChange at some point.
232
233         * page/ios/ContentChangeObserver.cpp:
234         (WebCore::ContentChangeObserver::didContentVisibilityChange):
235         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
236         * page/ios/ContentChangeObserver.h:
237
238 2019-03-01  Jer Noble  <jer.noble@apple.com>
239
240         [EME] Make sure the hasSessionSemaphore is set even if HAVE(AVSTREAMSESSION) is false
241         https://bugs.webkit.org/show_bug.cgi?id=195217
242
243         Reviewed by Eric Carlson.
244
245         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
246         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
247
248 2019-03-01  Justin Fan  <justin_fan@apple.com>
249
250         [Web GPU] 32-bit builds broken by attempt to disable WebGPU on 32-bit
251         https://bugs.webkit.org/show_bug.cgi?id=195191
252
253         Rubber-stamped by Dean Jackson.
254
255         Dropping support for 32-bit entirely, so I'm intentionally leaving 32-bit broken.
256
257         * Configurations/FeatureDefines.xcconfig:
258
259 2019-02-28  Fujii Hironori  <Hironori.Fujii@sony.com>
260
261         HTTPSUpgradeList.db database should be opened in readonly mode
262         https://bugs.webkit.org/show_bug.cgi?id=195194
263         <rdar://problem/47103889>
264
265         Unreviewed build fix for curl.
266
267         * platform/network/curl/CookieJarDB.cpp:
268         (WebCore::CookieJarDB::openDatabase): Removed the second arguemnt of SQLiteDatabase::open.
269
270 2019-02-28  Chris Dumez  <cdumez@apple.com>
271
272         Unreviewed Windows build fix after r242251.
273
274         * platform/win/SearchPopupMenuDB.cpp:
275         (WebCore::SearchPopupMenuDB::openDatabase):
276
277 2019-02-28  Zalan Bujtas  <zalan@apple.com>
278
279         [ContentChangeObserver] Move timer removal code from DOMWindow::clearTimeout to DOMTimer::removeById
280         https://bugs.webkit.org/show_bug.cgi?id=195143
281         <rdar://problem/48462351>
282
283         Reviewed by Simon Fraser.
284
285         Currently DOMWindow::clearTimeout() is the only callsite that we are interested in, but this is more future-proof.
286
287         * page/DOMTimer.cpp:
288         (WebCore::DOMTimer::removeById):
289         * page/DOMWindow.cpp:
290         (WebCore::DOMWindow::clearTimeout):
291         * page/ios/ContentChangeObserver.cpp:
292         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
293         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
294         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
295         (WebCore::ContentChangeObserver::removeDOMTimer): Deleted.
296         * page/ios/ContentChangeObserver.h:
297
298 2019-02-28  Chris Dumez  <cdumez@apple.com>
299
300         HTTPSUpgradeList.db database should be opened in readonly mode
301         https://bugs.webkit.org/show_bug.cgi?id=195194
302         <rdar://problem/47103889>
303
304         Reviewed by Youenn Fablet.
305
306         Add parameter to SQLiteDatabase::open() to specific the open flags.
307
308         * Modules/webdatabase/Database.cpp:
309         (WebCore::Database::performOpenAndVerify):
310         * platform/sql/SQLiteDatabase.cpp:
311         (WebCore::SQLiteDatabase::open):
312         * platform/sql/SQLiteDatabase.h:
313         * platform/sql/SQLiteFileSystem.cpp:
314         * platform/sql/SQLiteFileSystem.h:
315
316 2019-02-28  Brady Eidson  <beidson@apple.com>
317
318         Followup to:
319         Universal links from Google search results pages don't open the app
320         https://bugs.webkit.org/show_bug.cgi?id=195126
321
322         Unreviewed.
323
324         * page/SecurityOrigin.cpp:
325         (WebCore::originsMatch): Remove a bogus assertion (reasoning in bugzilla)
326
327 2019-02-28  Simon Fraser  <simon.fraser@apple.com>
328
329         [iOS] Dark flash when opening Google AMP pages
330         https://bugs.webkit.org/show_bug.cgi?id=195193
331         rdar://problem/48326442
332
333         Reviewed by Zalan Bujtas.
334
335         After the incremental compositing updates changes, it was possible for a change in the size
336         of an overflow:hidden element to fail to update the "ancestor clipping layer" geometry on
337         a composited descendant that is not a descendant in z-order. When Google search results
338         create the <iframe> that contain AMP contents, we'd fail to update a zero-sized clipping layer,
339         leaving the #222 background of an intermediate element visible.
340
341         Fix by setting a flag in RenderLayer::updateLayerPosition() (which is called in containing block order)
342         that sets the "needs geometry update" dirty bit on containing-block-descendant layers. Currently
343         this flag affects all descendants; in future, we might be able to clear it for grand-children.
344
345         Tests: compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html
346                compositing/geometry/ancestor-clip-change.html
347
348         * rendering/RenderLayer.cpp:
349         (WebCore::RenderLayer::updateLayerPositions):
350         (WebCore::RenderLayer::updateLayerPosition):
351         * rendering/RenderLayer.h:
352         * rendering/RenderLayerBacking.cpp:
353         (WebCore::RenderLayerBacking::updateAfterLayout):
354         * rendering/RenderLayerBacking.h:
355
356 2019-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
357
358         Use-after-move in RenderCombineText::combineTextIfNeeded()
359         https://bugs.webkit.org/show_bug.cgi?id=195188
360
361         Reviewed by Zalan Bujtas.
362
363         r241288 uncovered an existing problem with our text-combine code. r242204 alleviated the
364         symptom, but this patch fixes the source of the problem (and reverts r242204).
365
366         The code in RenderCombineText::combineTextIfNeeded() has a bit that’s like:
367
368         FontDescription bestFitDescription;
369         while (...) {
370             FontCascade compressedFont(WTFMove(bestFitDescription), ...);
371             ...
372         }
373
374         Clearly this is wrong.
375
376         Test: fast/text/text-combine-crash-2.html
377
378         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
379         (WebCore::FontDescription::platformResolveGenericFamily):
380         * rendering/RenderCombineText.cpp:
381         (WebCore::RenderCombineText::combineTextIfNeeded):
382
383 2019-02-28  Zalan Bujtas  <zalan@apple.com>
384
385         [ContentChangeObserver] Introduce observer subclasses to scope content change observing.
386         https://bugs.webkit.org/show_bug.cgi?id=195172
387         <rdar://problem/48479259>
388
389         Reviewed by Simon Fraser.
390
391         Let's scope start/stopObserving call pairs.
392
393         * dom/Document.cpp:
394         (WebCore::Document::updateStyleIfNeeded):
395         * page/DOMTimer.cpp:
396         (WebCore::DOMTimer::fired):
397         * page/ios/ContentChangeObserver.cpp:
398         (WebCore::ContentChangeObserver::StyleChangeObserver::StyleChangeObserver):
399         (WebCore::ContentChangeObserver::StyleChangeObserver::~StyleChangeObserver):
400         (WebCore::ContentChangeObserver::StyleRecalcObserver::StyleRecalcObserver):
401         (WebCore::ContentChangeObserver::StyleRecalcObserver::~StyleRecalcObserver):
402         (WebCore::ContentChangeObserver::DOMTimerObserver::DOMTimerObserver):
403         (WebCore::ContentChangeObserver::DOMTimerObserver::~DOMTimerObserver):
404         (WebCore::ContentChangeObserver::StyleChange::StyleChange): Deleted.
405         (WebCore::ContentChangeObserver::StyleChange::~StyleChange): Deleted.
406         * page/ios/ContentChangeObserver.h:
407         * rendering/updating/RenderTreeUpdater.cpp:
408         (WebCore::RenderTreeUpdater::updateElementRenderer):
409
410 2019-02-28  Antoine Quint  <graouts@apple.com>
411
412         Enable the Pointer Events runtime flag by default
413         https://bugs.webkit.org/show_bug.cgi?id=195156
414
415         Reviewed by Dean Jackson.
416
417         * page/RuntimeEnabledFeatures.h:
418
419 2019-02-28  Zalan Bujtas  <zalan@apple.com>
420
421         [ContentChangeObserver] Make observed state reset explicit.
422         https://bugs.webkit.org/show_bug.cgi?id=195185
423         <rdar://problem/48488342>
424
425         Reviewed by Simon Fraser.
426
427         Use setObservedContentChange only for setting the observed change while observing.
428
429         * page/ios/ContentChangeObserver.cpp:
430         (WebCore::ContentChangeObserver::startObservingContentChanges):
431         (WebCore::ContentChangeObserver::resetObservedContentChange):
432         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
433         * page/ios/ContentChangeObserver.h:
434
435 2019-02-28  Commit Queue  <commit-queue@webkit.org>
436
437         Unreviewed, rolling out r242210.
438         https://bugs.webkit.org/show_bug.cgi?id=195179
439
440         it broke hover menus on losaltosonline.com (Requested by zalan
441         on #webkit).
442
443         Reverted changeset:
444
445         "[ContentChangeObserver] Move timer removal code from
446         DOMWindow::clearTimeout to DOMTimer::removeById"
447         https://bugs.webkit.org/show_bug.cgi?id=195143
448         https://trac.webkit.org/changeset/242210
449
450 2019-02-28  Zalan Bujtas  <zalan@apple.com>
451
452         [ContentChangeObserver] Move timer removal code from DOMWindow::clearTimeout to DOMTimer::removeById
453         https://bugs.webkit.org/show_bug.cgi?id=195143
454         <rdar://problem/48462351>
455
456         Reviewed by Simon Fraser.
457
458         Currently DOMWindow::clearTimeout() is the only callsite that we are interested in, but this is more future-proof.
459
460         * page/DOMTimer.cpp:
461         (WebCore::DOMTimer::removeById):
462         * page/DOMWindow.cpp:
463         (WebCore::DOMWindow::clearTimeout):
464         * page/ios/ContentChangeObserver.cpp:
465         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
466         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
467         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
468         (WebCore::ContentChangeObserver::removeDOMTimer): Deleted.
469         * page/ios/ContentChangeObserver.h:
470
471 2019-02-28  Charles Vazac  <cvazac@akamai.com>
472
473         Fix Resource Timing buffer edge cases for WPT
474         https://bugs.webkit.org/show_bug.cgi?id=193213
475
476         Reviewed by Youenn Fablet.
477
478         Test coverage by LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer*.html
479
480         * page/Performance.cpp:
481         (WebCore::Performance::resourceTimingBufferFullTimerFired): Only dispatch the
482         resourcetimingbufferfull event if the buffer is still full (as it may have been cleared or
483         expanded). Also, avoid infinite loops if we aren't able to decrease the number of entries in
484         the secondary buffer.
485
486 2019-02-28  Takashi Komori  <Takashi.Komori@sony.com>
487
488         [Curl] HTTP Body is missing with redirection.
489         https://bugs.webkit.org/show_bug.cgi?id=191651
490
491         Reviewed by Don Olmstead.
492
493         Implement updateFromDelegatePreservingOldProperties for curl port.
494
495         Tests: http/tests/navigation/post-301-response.html
496                http/tests/navigation/post-302-response.html
497                http/tests/navigation/post-303-response.html
498                http/tests/navigation/post-307-response.html
499                http/tests/navigation/post-308-response.html
500
501         * platform/Curl.cmake:
502         * platform/network/curl/ResourceRequest.h:
503         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties): Deleted.
504         * platform/network/curl/ResourceRequestCurl.cpp: Added.
505         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties):
506
507 2019-02-28  Carlos Garcia Campos  <cgarcia@igalia.com>
508
509         [CoordinatedGraphics] Remove COORDINATED_GRAPHICS_THREADED option
510         https://bugs.webkit.org/show_bug.cgi?id=195159
511
512         Reviewed by Don Olmstead.
513
514         Use COORDINATED_GRAPHICS instead.
515
516         * platform/graphics/GraphicsContext3D.h:
517         * platform/graphics/PlatformLayer.h:
518         * platform/graphics/cairo/ImageBufferCairo.cpp:
519         (WebCore::ImageBufferData::ImageBufferData):
520         (WebCore::ImageBufferData::~ImageBufferData):
521         * platform/graphics/cairo/ImageBufferDataCairo.h:
522         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp:
523         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h:
524         * platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp:
525         (Nicosia::GC3DLayer::swapBuffersIfNeeded):
526         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
527         (WebCore::GraphicsContext3D::reshapeFBOs):
528         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
529         (WebCore::GraphicsContext3D::prepareTexture):
530         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
531         (WebCore::GraphicsContext3D::reshapeFBOs):
532         * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp:
533         (WebCore::GraphicsContext3D::GraphicsContext3D):
534         (WebCore::GraphicsContext3D::~GraphicsContext3D):
535         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
536         (WebCore::TextureMapperGC3DPlatformLayer::TextureMapperGC3DPlatformLayer):
537         (WebCore::TextureMapperGC3DPlatformLayer::~TextureMapperGC3DPlatformLayer):
538         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
539         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
540         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
541         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
542         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
543         * platform/graphics/texmap/TextureMapperPlatformLayerProxyProvider.h:
544         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
545         (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay):
546         (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer):
547         (WebCore::CoordinatedGraphicsLayer::updatePlatformLayer):
548         * rendering/RenderLayerBacking.cpp:
549         (WebCore::RenderLayerBacking::paintsIntoWindow const):
550         * rendering/RenderLayerCompositor.cpp:
551         (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls const):
552
553 2019-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
554
555         Locale names can be nullptr
556         https://bugs.webkit.org/show_bug.cgi?id=195171
557         <rdar://problem/48262376>
558
559         Reviewed by Dean Jackson.
560
561         Nullptr can't be used in keys to HashMaps, so take an early out in this case.
562
563         This is a partial revert of r241288.
564
565         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
566         (WebCore::FontDescription::platformResolveGenericFamily):
567
568 2019-02-28  Justin Fan  <justin_fan@apple.com>
569
570         [Web GPU] Enable Web GPU only on 64-bit
571         https://bugs.webkit.org/show_bug.cgi?id=195139
572
573         Because Metal is only supported on 64 bit apps.
574
575         Unreviewed build fix.
576
577         * Configurations/FeatureDefines.xcconfig:
578
579 2019-02-27  Zalan Bujtas  <zalan@apple.com>
580
581         [ContentChangeObserver] Move WKSetObservedContentChange logic to ContentChangeObserver class.
582         https://bugs.webkit.org/show_bug.cgi?id=195128
583         <rdar://problem/48456752>
584
585         Reviewed by Simon Fraser.
586
587         Move the final bits over to ContentChangeObserver and delete WKContentObservationInternal.h.
588
589         * WebCore.xcodeproj/project.pbxproj:
590         * page/ios/ContentChangeObserver.mm:
591         (WebCore::ContentChangeObserver::setObservedContentChange):
592         * platform/ios/wak/WKContentObservation.cpp:
593         (WKSetObservedContentChange):
594         * platform/ios/wak/WKContentObservation.h:
595         * platform/ios/wak/WKContentObservationInternal.h: Removed.
596
597 2019-02-27  Simon Fraser  <simon.fraser@apple.com>
598
599         Roll out r242014; it caused crashes in compositing logging (webkit.org/b/195141)
600
601         * dom/Document.cpp:
602         (WebCore::Document::lastModified const):
603         * html/FTPDirectoryDocument.cpp:
604         (WebCore::processFileDateString):
605         * mathml/MathMLElement.cpp:
606         (WebCore::convertToPercentageIfNeeded):
607         (WebCore::MathMLElement::collectStyleForPresentationAttribute):
608         * page/cocoa/ResourceUsageOverlayCocoa.mm:
609         (WebCore::ResourceUsageOverlay::platformDraw):
610         * page/linux/ResourceUsageOverlayLinux.cpp:
611         (WebCore::cpuUsageString):
612         (WebCore::gcTimerString):
613         * platform/DateComponents.cpp:
614         (WebCore::DateComponents::toStringForTime const):
615         (WebCore::DateComponents::toString const):
616         * platform/LocalizedStrings.cpp:
617         (WebCore::localizedString):
618         * platform/audio/HRTFElevation.cpp:
619         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
620         * platform/mock/MockRealtimeVideoSource.cpp:
621         (WebCore::MockRealtimeVideoSource::drawText):
622         * rendering/RenderLayerCompositor.cpp:
623         (WebCore::RenderLayerCompositor::logLayerInfo):
624         * rendering/RenderTheme.cpp:
625         (WebCore::RenderTheme::formatMediaControlsTime const):
626
627 2019-02-27  Zalan Bujtas  <zalan@apple.com>
628
629         [ContentChangeObserver] Move _WKObservingContentChanges from global to ContentChangeObserver class
630         https://bugs.webkit.org/show_bug.cgi?id=195091
631         <rdar://problem/48427271>
632
633         Reviewed by Tim Horton.
634
635         * page/ios/ContentChangeObserver.h:
636         * page/ios/ContentChangeObserver.mm:
637         (WebCore::ContentChangeObserver::startObservingContentChanges):
638         (WebCore::ContentChangeObserver::stopObservingContentChanges):
639         (WebCore::ContentChangeObserver::isObservingContentChanges):
640         * platform/ios/wak/WKContentObservation.cpp:
641         (WKObservingContentChanges): Deleted.
642         (WKStartObservingContentChanges): Deleted.
643         (WKStopObservingContentChanges): Deleted.
644         * platform/ios/wak/WKContentObservation.h:
645         * platform/ios/wak/WKContentObservationInternal.h:
646
647 2019-02-27  Brady Eidson  <beidson@apple.com>
648
649         Universal links from Google search results pages don't open the app.
650         <rdar://problem/46887179> and https://bugs.webkit.org/show_bug.cgi?id=195126
651
652         Reviewed by Geoffrey Garen.
653
654         Covered by new API tests.
655
656         * loader/DocumentLoader.cpp:
657         (WebCore::DocumentLoader::shouldOpenExternalURLsPolicyToPropagate const): Propagate the external URL policy from
658           an iframe if it is from the same security origin as the main frame.
659
660 2019-02-27  Zalan Bujtas  <zalan@apple.com>
661
662         [ContentChangeObserver] Move DOMTimer schedule handling from global to ContentChangeObserver class
663         https://bugs.webkit.org/show_bug.cgi?id=195090
664         <rdar://problem/48426771>
665
666         Reviewed by Tim Horton.
667
668         Also remove some unused functions from WKContentObservationInternal.
669
670         * page/ios/ContentChangeObserver.h:
671         * page/ios/ContentChangeObserver.mm:
672         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling):
673         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling):
674         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling):
675         * platform/ios/wak/WKContentObservation.cpp:
676         (WKStartObservingDOMTimerScheduling): Deleted.
677         (WKStopObservingDOMTimerScheduling): Deleted.
678         (WKIsObservingDOMTimerScheduling): Deleted.
679         * platform/ios/wak/WKContentObservation.h:
680         * platform/ios/wak/WKContentObservationInternal.h:
681
682 2019-02-27  Zalan Bujtas  <zalan@apple.com>
683
684         [ContentChangeObserver] Move style recalc handling from global to ContentChangeObserver class
685         https://bugs.webkit.org/show_bug.cgi?id=195087
686
687         Reviewed by Simon Fraser.
688
689         Add m_observingNextStyleRecalc/m_observingStyleRecalcScheduling to ContentChangeObserver and move the related code over from WK functions.
690
691         * page/ios/ContentChangeObserver.h:
692         * page/ios/ContentChangeObserver.mm:
693         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling):
694         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling):
695         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling):
696         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
697         (WebCore::ContentChangeObserver::shouldObserveNextStyleRecalc):
698         (WebCore::ContentChangeObserver::setObservedContentChange):
699         * platform/ios/wak/WKContentObservation.cpp:
700         (WKSetObservedContentChange):
701         (WKStartObservingStyleRecalcScheduling): Deleted.
702         (WKStopObservingStyleRecalcScheduling): Deleted.
703         (WKIsObservingStyleRecalcScheduling): Deleted.
704         (WKSetShouldObserveNextStyleRecalc): Deleted.
705         (WKShouldObserveNextStyleRecalc): Deleted.
706         * platform/ios/wak/WKContentObservation.h:
707
708 2019-02-27  Zalan Bujtas  <zalan@apple.com>
709
710         [ContentChangeObserver] Move DOM timer handling from global to ContentChangeObserver class
711         https://bugs.webkit.org/show_bug.cgi?id=195070
712         <rdar://problem/48417650>
713
714         Reviewed by Tim Horton.
715
716         Add DOM timer list to ContentChangeObserver and move the related code over from WK functions.
717
718         * page/ios/ContentChangeObserver.h:
719         * page/ios/ContentChangeObserver.mm:
720         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling):
721         (WebCore::ContentChangeObserver::countOfObservedDOMTimers):
722         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
723         (WebCore::ContentChangeObserver::setObservedContentChange):
724         (WebCore::ContentChangeObserver::containsObservedDOMTimer):
725         (WebCore::ContentChangeObserver::addObservedDOMTimer):
726         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
727         * platform/ios/wak/WKContentObservation.cpp:
728         (WKStartObservingDOMTimerScheduling):
729         (WKSetObservedContentChange):
730         (WebThreadGetObservedDOMTimers): Deleted.
731         (WebThreadCountOfObservedDOMTimers): Deleted.
732         (WebThreadClearObservedDOMTimers): Deleted.
733         (WebThreadContainsObservedDOMTimer): Deleted.
734         (WebThreadAddObservedDOMTimer): Deleted.
735         (WebThreadRemoveObservedDOMTimer): Deleted.
736         * platform/ios/wak/WKContentObservation.h:
737
738 2019-02-27  Justin Fan  <justin_fan@apple.com>
739         Fix build errors after Web GPU buffer updates changed some IDL fields from unsigned long to unsigned long long.
740
741         Unreviewed build fix.
742
743         * Modules/webgpu/WebGPUBuffer.cpp:
744         (WebCore::WebGPUBuffer::setSubData):
745         * Modules/webgpu/WebGPUBuffer.h:
746         * Modules/webgpu/WebGPUBufferBinding.h:
747         * Modules/webgpu/WebGPURenderPassEncoder.idl:
748         * platform/graphics/gpu/GPUBufferBinding.h:
749         * platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
750         * platform/graphics/gpu/GPUVertexInputDescriptor.h:
751
752 2019-02-27  John Wilander  <wilander@apple.com>
753
754         Adopt WebCore::RegistrableDomain in WebCore::ResourceLoadStatistics and WebKit::NetworkProcessProxy
755         https://bugs.webkit.org/show_bug.cgi?id=195071
756         <rdar://problem/48417690>
757
758         Reviewed by Alex Christensen and Brent Fulgham.
759
760         No new tests. This patch maintains functionality covered by plenty of layout
761         tests under http/tests/resourceLoadStatistics/ and http/tests/storageAccess.
762
763         This patch adopts WebCore::RegistrableDomain in WebCore::ResourceLoadStatistics
764         and makes the necessary infrastructure changes to support that.
765
766         The previous HashCountedSets in WebCore::ResourceLoadStatistics are now just
767         HashSets since we never used the counts for anything. This change simplified
768         encoding and decoding for IPC and will eventually simplify encoding and
769         decoding in loader/ResourceLoadStatistics.cpp when we obsolete statistics
770         model version 14 and below.
771
772         The patch also makes WebCore::RegistrableDomain's String constructor private.
773         A new create function WebCore::RegistrableDomain::uncheckedCreateFromString()
774         is introduced to better signal to users that creating a registrable domain
775         object with a string may create an object that doesn't match a registrable
776         domain in a valid HTTP-family URL. This change (private String constructor)
777         motivated a change in WebCore::AdClickAttribution where the Source and
778         Destination structs now take a URL as parameter instead of a String.
779
780         Finally, this patch harmonizes parameter and variable naming, going from
781         "origin" to "domain" and "mainFrame" to "topFrame."
782
783         * html/HTMLAnchorElement.cpp:
784         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
785         * html/HTMLMediaElement.cpp:
786         (WebCore::HTMLMediaElement::mediaSessionTitle const):
787         * loader/AdClickAttribution.h:
788         (WebCore::AdClickAttribution::Source::Source):
789         (WebCore::AdClickAttribution::Source::deletedValue):
790         (WebCore::AdClickAttribution::Destination::Destination):
791         (WebCore::AdClickAttribution::Destination::deletedValue):
792         (WebCore::AdClickAttribution::decode):
793         * loader/ResourceLoadObserver.cpp:
794         (WebCore::ResourceLoadObserver::logSubresourceLoading):
795         (WebCore::ResourceLoadObserver::logWebSocketLoading):
796         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
797         (WebCore::ResourceLoadObserver::statisticsForURL):
798         (WebCore::ResourceLoadObserver::statisticsForOrigin): Deleted.
799         * loader/ResourceLoadObserver.h:
800         * loader/ResourceLoadStatistics.cpp:
801         (WebCore::encodeHashSet):
802         (WebCore::ResourceLoadStatistics::encode const):
803         (WebCore::decodeHashCountedSet):
804         (WebCore::decodeHashSet):
805         (WebCore::ResourceLoadStatistics::decode):
806         (WebCore::appendHashSet):
807         (WebCore::ResourceLoadStatistics::toString const):
808         (WebCore::ResourceLoadStatistics::merge):
809         (WebCore::encodeHashCountedSet): Deleted.
810         (WebCore::encodeOriginHashSet): Deleted.
811         (WebCore::decodeOriginHashSet): Deleted.
812         (WebCore::appendHashCountedSet): Deleted.
813         * loader/ResourceLoadStatistics.h:
814         * platform/RegistrableDomain.h:
815         (WebCore::RegistrableDomain::uncheckedCreateFromString):
816         (WebCore::RegistrableDomain::RegistrableDomain):
817         * testing/Internals.cpp:
818         (WebCore::Internals::resourceLoadStatisticsForURL):
819         (WebCore::Internals::resourceLoadStatisticsForOrigin): Deleted.
820         * testing/Internals.h:
821         * testing/Internals.idl:
822
823 2019-02-27  Justin Fan  <justin_fan@apple.com>
824
825         [Web GPU] Buffer updates part 2: setSubData, GPU/CPU synchronization
826         https://bugs.webkit.org/show_bug.cgi?id=195077
827         <rdar://problem/47805229>
828
829         Reviewed by Dean Jackson.
830
831         Implement GPUBuffer.setSubData and prevent the resolving of mapping promises if the buffer is scheduled to be 
832         used on the GPU, and add handlers to resolve such promises after command buffer execution completes. In addition,
833         update buffer sizes to u64 (unsigned long in C++) as per the updated Web GPU API.
834
835         Tests: webgpu/buffer-command-buffer-races.html
836                webgpu/map-read-buffers.html
837
838         * Modules/webgpu/WebGPUBindGroup.h:
839         (WebCore::WebGPUBindGroup::bindGroup const):
840         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
841         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Rename binding -> bufferBinding to reduce confusion.
842         * Modules/webgpu/WebGPUBuffer.cpp: Small tweaks.
843         (WebCore::WebGPUBuffer::setSubData):
844         (WebCore::WebGPUBuffer::unmap): Correctly fail if buffer is destroyed.
845         (WebCore::WebGPUBuffer::destroy):
846         (WebCore::WebGPUBuffer::rejectOrRegisterPromiseCallback):
847         * Modules/webgpu/WebGPUBuffer.h:
848         (WebCore::WebGPUBuffer::buffer const): Returned buffer is no longer const so that it can be used in completed handler callbacks.
849         * Modules/webgpu/WebGPUBuffer.idl: Enable setSubData.
850         * Modules/webgpu/WebGPUCommandBuffer.cpp:
851         (WebCore::WebGPUCommandBuffer::beginRenderPass):
852         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
853         (WebCore::WebGPUProgrammablePassEncoder::setBindGroup const):
854         * Modules/webgpu/WebGPUProgrammablePassEncoder.h:
855         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
856         (WebCore::WebGPURenderPassEncoder::setVertexBuffers):
857         * Sources.txt:
858         * WebCore.xcodeproj/project.pbxproj:
859         * platform/graphics/gpu/GPUBuffer.h:
860         (WebCore::GPUBuffer::isTransferDst const): Added various state and flag getters.
861         (WebCore::GPUBuffer::isVertex const):
862         (WebCore::GPUBuffer::isUniform const):
863         (WebCore::GPUBuffer::isStorage const):
864         (WebCore::GPUBuffer::isReadOnly const):
865         (WebCore::GPUBuffer::isMappable const):
866         (WebCore::GPUBuffer::isMapWrite const):
867         (WebCore::GPUBuffer::isMapRead const):
868         (WebCore::GPUBuffer::isMapWriteable const):
869         (WebCore::GPUBuffer::isMapReadable const):
870         * platform/graphics/gpu/GPUBufferBinding.h:
871         * platform/graphics/gpu/GPUCommandBuffer.h:
872         (WebCore::GPUCommandBuffer::usedBuffers const):
873         (WebCore::GPUCommandBuffer::useBuffer):
874         * platform/graphics/gpu/GPUDevice.cpp:
875         (WebCore::GPUDevice::tryCreateBuffer): Pass Ref of itself for Buffer to request the Queue later, if needed.
876         (WebCore::GPUDevice::tryCreateBuffer const): Deleted.
877         * platform/graphics/gpu/GPUDevice.h:
878         * platform/graphics/gpu/GPUProgrammablePassEncoder.cpp: Retain the encoder's commandBuffer to reference its used resource buffers.
879         (WebCore::GPUProgrammablePassEncoder::GPUProgrammablePassEncoder):
880         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
881         (WebCore::GPUProgrammablePassEncoder::commandBuffer const):
882         * platform/graphics/gpu/GPURenderPassEncoder.h:
883         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
884         (WebCore::GPUBuffer::validateBufferCreate): Move validation out of tryCreate.
885         (WebCore::GPUBuffer::tryCreate): Create both shared and private buffers, depending on usage.
886         (WebCore::GPUBuffer::GPUBuffer):
887         (WebCore::GPUBuffer::~GPUBuffer): Call destroy instead of just unmap.
888         (WebCore::GPUBuffer::state const):
889         (WebCore::GPUBuffer::setSubData): Uses a cached collection of staging MTLBuffers to encode data copies to the implementation MTLBuffer.
890         (WebCore::GPUBuffer::commandBufferCommitted): Register on the GPUBuffer that the provided MTLCommandBuffer uses it, and is about to be committed.
891         (WebCore::GPUBuffer::commandBufferCompleted): MTLCommandBuffer's onCompletedHandler calls this.
892         (WebCore::GPUBuffer::reuseSubDataBuffer): SetSubData's blit command buffers call this to return a staging buffer to the pool.
893         (WebCore::GPUBuffer::registerMappingCallback):
894         (WebCore::GPUBuffer::runMappingCallback):
895         (WebCore::GPUBuffer::unmap):
896         (WebCore::GPUBuffer::destroy):
897         (WebCore::GPUBuffer::tryCreateSharedBuffer): Deleted.
898         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
899         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder):
900         (WebCore::GPUProgrammablePassEncoder::setBindGroup):
901         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
902         (WebCore::GPUQueue::submit): Ensure submitted buffers are in the correct state, and add completed handlers for synchronization.
903         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
904         (WebCore::GPURenderPassEncoder::tryCreate):
905         (WebCore::GPURenderPassEncoder::GPURenderPassEncoder): Retain the commandBuffer for later reference.
906         (WebCore::GPURenderPassEncoder::setVertexBuffers): Mark vertex buffers as used before submission.
907         (WebCore::GPURenderPassEncoder::create): Deleted.
908
909         Buffer size updates in the IDL:
910         * Modules/webgpu/GPUBufferDescriptor.idl:
911         * Modules/webgpu/WebGPUBuffer.idl:
912         * Modules/webgpu/WebGPUBufferBinding.idl:
913         * Modules/webgpu/WebGPUCommandBuffer.idl:
914         * Modules/webgpu/WebGPURenderPassEncoder.idl:
915         * Modules/webgpu/WebGPUVertexAttributeDescriptor.idl:
916         * Modules/webgpu/WebGPUVertexInputDescriptor.idl:
917
918 2019-02-27  Youenn Fablet  <youenn@apple.com>
919
920         Remove LeetCode FetchRequest quirk
921         https://bugs.webkit.org/show_bug.cgi?id=195100
922
923         Reviewed by Alex Christensen.
924
925         Covered by manual testing.
926
927         * Modules/fetch/FetchRequest.cpp:
928         (WebCore::needsSignalQuirk):
929
930 2019-02-27  Chris Dumez  <cdumez@apple.com>
931
932         Unable to log into chase.com on iPad when DeviceMotionEvent API is disabled
933         https://bugs.webkit.org/show_bug.cgi?id=195101
934         <rdar://problem/48423023>
935
936         Reviewed by Geoffrey Garen.
937
938         Add site-specific quirk for chase.com on iOS where we fire a dummy DeviceMotionEvent if the page
939         tries to register a "devicemotion" event listener and fails because the API is disabled. This is
940         needed to unblock the site and proceed with the login flow.
941
942         Unfortunately, document()->settings().needsSiteSpecificQuirks() is false on iOS so I could not
943         guard the quirk behind this flag.
944
945         * page/DOMWindow.cpp:
946         (WebCore::DOMWindow::addEventListener):
947         (WebCore::DOMWindow::failedToRegisterDeviceMotionEventListener):
948         * page/DOMWindow.h:
949
950 2019-02-27  Antoine Quint  <graouts@apple.com>
951
952         Support Pointer Events on macOS
953         https://bugs.webkit.org/show_bug.cgi?id=195008
954         <rdar://problem/47454419>
955
956         Reviewed by Dean Jackson.
957
958         We now dispatch relevant pointer events as we prepare to dispatch mouse events. In most cases, this means we dispatch
959         a pointer event of the same type, with "mouse" being substituted by "pointer", and with the same properties with the
960         exception that if preventDefault() is called for a "pointerdown" event, the matching "mousedown" will not be dispatched,
961         and the same behavior also extends to "pointerup".
962
963         Tests: pointerevents/mouse/over-enter-out-leave.html
964                pointerevents/mouse/pointer-capture.html
965                pointerevents/mouse/pointer-event-basic-properties.html
966                pointerevents/mouse/pointer-events-before-mouse-events.html
967                pointerevents/mouse/pointerdown-prevent-default.html
968
969         * Configurations/FeatureDefines.xcconfig:
970         * dom/Document.cpp: All of the touch-action related members and functions should be iOS-specific since the touch-action
971         property does not have any effect on macOS.
972         (WebCore::Document::invalidateRenderingDependentRegions):
973         (WebCore::Document::nodeWillBeRemoved):
974         (WebCore::Document::updateTouchActionElements):
975         * dom/Document.h:
976         * dom/Element.cpp:
977         (WebCore::Element::dispatchMouseEvent): Dispatch a pointer event matching the mouse event that is about to be dispatched.
978         If preventDefault() is called in the event handler for either "pointerdown" or "pointerup", do not proceed with dispatching
979         the mouse event.
980         * dom/PointerEvent.cpp:
981         (WebCore::pointerEventType):
982         (WebCore::PointerEvent::create):
983         * dom/PointerEvent.h:
984         * page/EventHandler.cpp: Check both the pointer and mouse events to see if we need to dispatch "enter" and "leave" events.
985         (WebCore::hierarchyHasCapturingEventListeners):
986         (WebCore::EventHandler::updateMouseEventTargetNode):
987         * page/PointerCaptureController.cpp: Fix a build error which only happened on macOS.
988         (WebCore::PointerCaptureController::PointerCaptureController): Create the CapturingData for the unique mouse pointer.
989         (WebCore::PointerCaptureController::hasPointerCapture): The code did not match the spec cited in the comment, only the
990         pending target override needs to be considered to determine whether a given element has pointer capture enabled.
991         (WebCore::PointerCaptureController::dispatchEvent): Dispatch the provided pointer event, accounting for pointer capture if
992         it is set.
993         * page/PointerLockController.cpp: Fix a build error which only happened on macOS.
994         * style/StyleTreeResolver.cpp:
995         (WebCore::Style::TreeResolver::resolveElement): Code related to touch-action is only relevant to iOS.
996
997 2019-02-27  Sihui Liu  <sihui_liu@apple.com>
998
999         Network Process is put to suspended when holding locked IndexedDB files
1000         https://bugs.webkit.org/show_bug.cgi?id=195024
1001         <rdar://problem/45194169>
1002
1003         Reviewed by Geoffrey Garen.
1004
1005         We found network process was suspended when IDBDatabase was being closed in the background database thread, 
1006         holding locks to its database file. To avoid starvation or deadlock, we need to keep network process alive by 
1007         taking background assertion in UI process until the closes are done and locks are released.
1008
1009         * Modules/indexeddb/server/IDBServer.cpp:
1010         (WebCore::IDBServer::IDBServer::create):
1011         (WebCore::IDBServer::IDBServer::IDBServer):
1012         (WebCore::IDBServer::IDBServer::createBackingStore):
1013         (WebCore::IDBServer::IDBServer::closeDatabase):
1014         (WebCore::IDBServer::IDBServer::didCloseDatabase):
1015         * Modules/indexeddb/server/IDBServer.h:
1016         (WebCore::IDBServer::IDBServer::create):
1017         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1018         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentDeleteOperation):
1019         (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose):
1020         (WebCore::IDBServer::UniqueIDBDatabase::didShutdownForClose):
1021         (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
1022         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
1023         (WebCore::IDBServer::UniqueIDBDatabase::notifyServerAboutClose):
1024         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1025
1026 2019-02-26  Simon Fraser  <simon.fraser@apple.com>
1027
1028         Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
1029         https://bugs.webkit.org/show_bug.cgi?id=194973
1030
1031         Reviewed by Antti Koivisto.
1032
1033         This patch cleans up how the scrolling tree responds to scrolls.
1034
1035         First, ScrollingTreeScrollingNode::m_currentScrollPosition is "truth" for scrolling thread/
1036         UI process scroll position.
1037
1038         On macOS where handleWheelEvent on the scrolling thread changes scroll position, the
1039         bottleneck is ScrollingTreeScrollingNode::scrollTo() which sets the new scroll position,
1040         update the visual viewport (for frame scrolls) updates the scrolledContentsLayer position,
1041         updates related layers on this node (counter-scrolling layers etc), and then tells the
1042         scrolling tree, which recurses through descendant nodes so they can adjust their layer
1043         positions.
1044
1045         On iOS, the bottleneck is ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling(),
1046         which does the above other than setting scrolledContentsLayer (since we're reacting to
1047         layer state changes, not producing them).
1048
1049         updateLayersAfterAncestorChange() is renamed to relatedNodeScrollPositionDidChange(), and
1050         ScrollingTree does the tree walk so classes don't have to implement
1051         updateLayersAfterAncestorChange() just to talk children. The ScrollingTree tree walk knows
1052         how to get the correct layoutViewport and to stop at frame boundaries (layer updates never
1053         need to cross frame boundaries).
1054
1055         We preserve 'cumulativeDelta'; it's necessary for things like fixed inside overflow:scroll,
1056         since the fixed state was computed with the "layout" scroll position, so we have to account
1057         for the scroll delta since the last committed position. It's possible we could improve this
1058         in future.
1059
1060         * page/scrolling/ScrollingTree.cpp:
1061         (WebCore::ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling):
1062         (WebCore::ScrollingTree::notifyRelatedNodesAfterScrollPositionChange):
1063         (WebCore::ScrollingTree::notifyRelatedNodesRecursive):
1064         (WebCore::ScrollingTree::mainFrameLayoutViewport):
1065         (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling): Deleted.
1066         * page/scrolling/ScrollingTree.h:
1067         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
1068         (WebCore::ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange): Deleted.
1069         * page/scrolling/ScrollingTreeFrameHostingNode.h:
1070         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1071         (WebCore::ScrollingTreeFrameScrollingNode::updateViewportForCurrentScrollPosition):
1072         (WebCore::ScrollingTreeFrameScrollingNode::localToContentsPoint const):
1073         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1074         * page/scrolling/ScrollingTreeNode.cpp:
1075         (WebCore::ScrollingTreeNode::relatedNodeScrollPositionDidChange):
1076         (WebCore::ScrollingTreeNode::enclosingScrollingNodeIncludingSelf):
1077         * page/scrolling/ScrollingTreeNode.h:
1078         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1079         (WebCore::ScrollingTreeScrollingNode::minimumScrollPosition const):
1080         (WebCore::ScrollingTreeScrollingNode::scrollLimitReached const):
1081         (WebCore::ScrollingTreeScrollingNode::adjustedScrollPosition const):
1082         (WebCore::ScrollingTreeScrollingNode::scrollBy):
1083         (WebCore::ScrollingTreeScrollingNode::scrollTo):
1084         (WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged):
1085         (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
1086         (WebCore::ScrollingTreeScrollingNode::localToContentsPoint const):
1087         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterAncestorChange): Deleted.
1088         (WebCore::ScrollingTreeScrollingNode::setScrollPosition): Deleted.
1089         * page/scrolling/ScrollingTreeScrollingNode.h:
1090         * page/scrolling/ScrollingTreeScrollingNodeDelegate.h:
1091         (WebCore::ScrollingTreeScrollingNodeDelegate::currentScrollPosition const):
1092         (WebCore::ScrollingTreeScrollingNodeDelegate::scrollPosition const): Deleted.
1093         * page/scrolling/ThreadedScrollingTree.cpp:
1094         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
1095         * page/scrolling/ThreadedScrollingTree.h:
1096         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
1097         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
1098         (WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
1099         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange): Deleted.
1100         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
1101         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
1102         (WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
1103         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange): Deleted.
1104         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1105         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1106         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
1107         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
1108         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
1109         (WebCore::ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition const):
1110         (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged):
1111         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
1112         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers):
1113         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState):
1114         (WebCore::ScrollingTreeFrameScrollingNodeMac::exposedUnfilledArea const):
1115         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): Deleted.
1116         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition): Deleted.
1117         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition): Deleted.
1118         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateLayersAfterViewportChange): Deleted.
1119         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
1120         (): Deleted.
1121         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1122         (WebCore::ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition const):
1123         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
1124         (WebCore::ScrollingTreeOverflowScrollingNodeMac::~ScrollingTreeOverflowScrollingNodeMac): Deleted.
1125         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange): Deleted.
1126         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): Deleted.
1127         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition): Deleted.
1128         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): Deleted.
1129         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterDelegatedScroll): Deleted.
1130         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
1131         (WebCore::ScrollingTreeScrollingNodeDelegateMac::isAlreadyPinnedInDirectionOfGesture):
1132         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount):
1133         (WebCore::ScrollingTreeScrollingNodeDelegateMac::pinnedInDirection):
1134         (WebCore::ScrollingTreeScrollingNodeDelegateMac::adjustScrollPositionToBoundsIfNecessary):
1135         (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollOffset const):
1136         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollOnAxis):
1137
1138 2019-02-22  Simon Fraser  <simon.fraser@apple.com>
1139
1140         Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
1141         https://bugs.webkit.org/show_bug.cgi?id=194973
1142
1143         Reviewed by Antti Koivisto.
1144
1145         The "master" value for the scroll position of a ScrollingTreeScrollingNode is now its m_scrollPosition member;
1146         layout viewports and layer positions will be set from this. This allows scrollPosition() to no longer be virtual
1147         and require different code for each scrolling node subclass, and adds a choke point that we can use to update
1148         the layout viewport.
1149         
1150         We can remove m_probableMainThreadScrollPosition on ScrollingTreeFrameScrollingNodeMac because this was really just
1151         an alias for the scroll position.
1152
1153         Add some isRootNode() checks for things that should only affect the main frame.
1154
1155         * page/scrolling/ScrollingTree.h: Remove fixedPositionRect() which was unused, and is a per-frame thing so makes
1156         no sense here.
1157         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1158         (WebCore::ScrollingTreeFrameScrollingNode::didChangeScrollPosition):
1159         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1160         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewport const):
1161         (WebCore::ScrollingTreeFrameScrollingNode::setLayoutViewport):
1162         (WebCore::ScrollingTreeFrameScrollingNode::fixedPositionRect): Deleted.
1163         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1164         (WebCore::ScrollingTreeScrollingNode::setScrollPosition):
1165         (WebCore::ScrollingTreeScrollingNode::setScrollPositionInternal):
1166         (WebCore::ScrollingTreeScrollingNode::didChangeScrollPosition):
1167         * page/scrolling/ScrollingTreeScrollingNode.h:
1168         (WebCore::ScrollingTreeScrollingNode::scrollPosition const):
1169         * page/scrolling/ios/ScrollingTreeIOS.cpp:
1170         (WebCore::ScrollingTreeIOS::fixedPositionRect): Deleted.
1171         * page/scrolling/ios/ScrollingTreeIOS.h:
1172         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1173         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1174         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
1175         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
1176         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
1177         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
1178         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState):
1179         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): Deleted.
1180         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
1181         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1182         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): Deleted.
1183
1184 2019-02-27  Ulrich Pflueger  <up@nanocosmos.de>
1185
1186         [MSE] SourceBuffer sample time increment vs. last frame duration check is broken
1187         https://bugs.webkit.org/show_bug.cgi?id=194747
1188         <rdar://problem/48148469>
1189
1190         Reviewed by Jer Noble.
1191
1192         Prevent unintended frame drops by including last frame duration in discontinuity check. 
1193
1194         Test: media/media-source/media-source-append-variable-frame-lengths-with-matching-durations.html
1195
1196         * Modules/mediasource/SourceBuffer.cpp:
1197         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
1198
1199 2019-02-27  Timothy Hatcher  <timothy@apple.com>
1200
1201         REGRESSION: WebKit content crash in Base System (because NSAppearance is NULL).
1202         https://bugs.webkit.org/show_bug.cgi?id=195086
1203         rdar://problem/48419124
1204
1205         Reviewed by Tim Horton.
1206
1207         * platform/mac/ScrollAnimatorMac.mm:
1208         (-[WebScrollerImpDelegate effectiveAppearanceForScrollerImp:]): Always return a valid NSAppearance.
1209
1210 2019-02-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1211
1212         Remove conditional compile guard for InsertIntoTextNodeCommand::doReapply
1213         https://bugs.webkit.org/show_bug.cgi?id=195067
1214         <rdar://problem/44812080>
1215
1216         Reviewed by Tim Horton.
1217
1218         This iOS-specific override was introduced to fix <rdar://problem/7114425>, in which the last typed character
1219         would be revealed when redoing text input on iOS inside a password field. The associated change fixed this bug
1220         by overriding doReapply on iOS to only insert text (instead of additionally handling password echo); however, it
1221         really makes sense to skip password echo when redoing on all platforms, so we can just remove the platform-
1222         specific guards around this logic.
1223
1224         Doing this allows us to add the `hasEditableStyle()` check on iOS when redoing text insertion, which results in
1225         a very subtle behavior change covered by the new layout test below.
1226
1227         Test: editing/undo/redo-text-insertion-in-non-editable-node.html
1228
1229         * editing/InsertIntoTextNodeCommand.cpp:
1230         (WebCore::InsertIntoTextNodeCommand::doReapply):
1231         * editing/InsertIntoTextNodeCommand.h:
1232
1233 2019-02-26  Keith Miller  <keith_miller@apple.com>
1234
1235         Code quality cleanup in NeverDestroyed
1236         https://bugs.webkit.org/show_bug.cgi?id=194824
1237
1238         Reviewed by Mark Lam.
1239
1240         name_names.pl should not just assume the layout of LazyNeverDestroyed.
1241
1242         * dom/make_names.pl:
1243         (printNamesCppFile):
1244
1245 2019-02-26  Zalan Bujtas  <zalan@apple.com>
1246
1247         Do not try to observe the timer when Page is nullptr
1248         https://bugs.webkit.org/show_bug.cgi?id=195076
1249
1250         Reviewed by Tim Horton.
1251
1252         Covered by fast/dom/Window/timer-null-script-execution-context.html.
1253
1254         * page/DOMTimer.cpp:
1255         (WebCore::DOMTimer::install):
1256
1257 2019-02-20  Jer Noble  <jer.noble@apple.com>
1258
1259         [Cocoa] Media elements will restart network buffering just before suspending
1260         https://bugs.webkit.org/show_bug.cgi?id=193691
1261
1262         Reviewed by Eric Carlson.
1263
1264         API Test: WebKit.ProcessSuspendMediaBuffering
1265
1266         Allow the Page to suspend all media buffering in its child Documents.
1267
1268         * dom/Document.cpp:
1269         (WebCore::Document::suspendAllMediaBuffering):
1270         (WebCore::Document::resumeAllMediaBuffering):
1271         * dom/Document.h:
1272         * html/MediaElementSession.cpp:
1273         (WebCore::MediaElementSession::dataBufferingPermitted const):
1274         (WebCore::MediaElementSession::suspendBuffering):
1275         (WebCore::MediaElementSession::resumeBuffering):
1276         (WebCore::MediaElementSession::bufferingSuspended const):
1277         * html/MediaElementSession.h:
1278         * page/Page.cpp:
1279         (WebCore::Page::suspendAllMediaBuffering):
1280         (WebCore::Page::resumeAllMediaBuffering):
1281         * page/Page.h:
1282         (WebCore::Page::mediaPlaybackIsSuspended const):
1283         (WebCore::Page::mediaBufferingIsSuspended const):
1284         (WebCore::Page::mediaPlaybackIsSuspended): Deleted.
1285         * platform/audio/PlatformMediaSession.h:
1286         (WebCore::PlatformMediaSession::suspendBuffering):
1287         (WebCore::PlatformMediaSession::resumeBuffering):
1288         * platform/audio/PlatformMediaSessionManager.cpp:
1289         (WebCore::PlatformMediaSessionManager::suspendAllMediaBufferingForDocument):
1290         (WebCore::PlatformMediaSessionManager::resumeAllMediaBufferingForDocument):
1291         * platform/audio/PlatformMediaSessionManager.h:
1292
1293 2019-02-26  Youenn Fablet  <youenn@apple.com>
1294
1295         Move service worker response validation from the service worker client to the service worker itself
1296         https://bugs.webkit.org/show_bug.cgi?id=194716
1297
1298         Reviewed by Geoffrey Garen.
1299
1300         Added response validation at service worker side.
1301
1302         No change of behavior except for now logging validation error messages in the console.
1303         Covered by rebased tests.
1304
1305         * workers/service/context/ServiceWorkerFetch.cpp:
1306         (WebCore::ServiceWorkerFetch::validateResponse):
1307         (WebCore::ServiceWorkerFetch::processResponse):
1308         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
1309
1310 2019-02-26  Sihui Liu  <sihui_liu@apple.com>
1311
1312         [Mac WK2] storage/indexeddb/IDBObject-leak.html is flaky
1313         https://bugs.webkit.org/show_bug.cgi?id=195036
1314
1315         Reviewed by Geoffrey Garen.
1316
1317         When connection to IDBServer is lost, IDBDatabase in web process should not only stop active transactions, but 
1318         also transactions in committing process.
1319
1320         Also, TransactionOpration should clear its perform function when the operation is being completed, otherwise 
1321         there is a reference cycle of TransactionOpration.
1322
1323         Covered by existing tests storage/indexeddb/IDBObject-leak.html.
1324
1325         * Modules/indexeddb/IDBDatabase.cpp:
1326         (WebCore::IDBDatabase::connectionToServerLost): notify committing transasctions that connection is lost.
1327         * Modules/indexeddb/IDBTransaction.cpp:
1328         (WebCore::IDBTransaction::connectionClosedFromServer): notify IDBConnectionProxy that transaction ends.
1329         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
1330         (WebCore::IDBClient::IDBConnectionProxy::forgetTransaction): clear finished transactions.
1331         * Modules/indexeddb/client/IDBConnectionProxy.h:
1332         * Modules/indexeddb/client/TransactionOperation.h:
1333         (WebCore::IDBClient::TransactionOperation::doComplete): clear perform function unconditionally when the 
1334         operation is in completion process. 
1335
1336 2019-02-26  Zalan Bujtas  <zalan@apple.com>
1337
1338         [ContentChangeObserver] clearContentChangeObservers should be internal to ContentChangeObserver class
1339         https://bugs.webkit.org/show_bug.cgi?id=195066
1340         <rdar://problem/48411682>
1341
1342         Reviewed by Tim Horton.
1343
1344         Now all the empty clearContentChangeObservers() implementations can be removed.
1345
1346         * dom/Document.cpp:
1347         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
1348         * loader/EmptyClients.h:
1349         * page/ChromeClient.h:
1350         * page/Frame.cpp:
1351         (WebCore::Frame::willDetachPage):
1352         * page/ios/ContentChangeObserver.h:
1353         * page/ios/ContentChangeObserver.mm:
1354         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
1355         (WebCore::ContentChangeObserver::didSuspendActiveDOMObjects): Might need to merge them.
1356         (WebCore::ContentChangeObserver::willDetachPage):
1357
1358 2019-02-26  Zalan Bujtas  <zalan@apple.com>
1359
1360         [ContentChangeObserver] Move style recalc schedule observation logic to ContentChangeObserver
1361         https://bugs.webkit.org/show_bug.cgi?id=195062
1362         <rdar://problem/48409258>
1363
1364         Reviewed by Tim Horton.
1365
1366         Also rename registerDOMTimerForContentObservationIfNeeded to be consistent with the did* naming style.
1367
1368         * dom/Document.cpp:
1369         (WebCore::Document::scheduleStyleRecalc):
1370         * page/DOMTimer.cpp:
1371         (WebCore::DOMTimer::install):
1372         * page/ios/ContentChangeObserver.h:
1373         * page/ios/ContentChangeObserver.mm:
1374         (WebCore::ContentChangeObserver::didInstallDOMTimer):
1375         (WebCore::ContentChangeObserver::didScheduleStyleRecalc):
1376         (WebCore::ContentChangeObserver::registerDOMTimerForContentObservationIfNeeded): Deleted.
1377
1378 2019-02-26  Chris Dumez  <cdumez@apple.com>
1379
1380         [iOS] Regression(PSON) Scroll position is no longer restored when navigating back to reddit.com
1381         https://bugs.webkit.org/show_bug.cgi?id=195054
1382         <rdar://problem/48330549>
1383
1384         Reviewed by Geoff Garen.
1385
1386         Add MaintainMemoryCache flag to indicate that the memory cache should not get purged.
1387
1388         * page/MemoryRelease.cpp:
1389         (WebCore::releaseNoncriticalMemory):
1390         (WebCore::releaseCriticalMemory):
1391         (WebCore::releaseMemory):
1392         * page/MemoryRelease.h:
1393
1394 2019-02-26  Commit Queue  <commit-queue@webkit.org>
1395
1396         Unreviewed, rolling out r241970.
1397         https://bugs.webkit.org/show_bug.cgi?id=195057
1398
1399         made the QuickLook.LegacyQuickLookContent API test flakey
1400         (Requested by estes on #webkit).
1401
1402         Reverted changeset:
1403
1404         "[iOS] Break a reference cycle between PreviewLoader and
1405         ResourceLoader"
1406         https://bugs.webkit.org/show_bug.cgi?id=194964
1407         https://trac.webkit.org/changeset/241970
1408
1409 2019-02-26  Zalan Bujtas  <zalan@apple.com>
1410
1411         [ContentChangeObserver] Simplify content observation API by removing explicit DOMTimer observation.
1412         https://bugs.webkit.org/show_bug.cgi?id=195023
1413         <rdar://problem/48381885>
1414
1415         Reviewed by Tim Horton.
1416
1417         In the future we might decide that certain activities don't require DOMTimer observation, but that should
1418         be internal to ContentChangeObserver.
1419
1420         * page/ios/ContentChangeObserver.h:
1421         * page/ios/ContentChangeObserver.mm:
1422         (WebCore::ContentChangeObserver::startObservingContentChanges):
1423         (WebCore::ContentChangeObserver::stopObservingContentChanges):
1424         * page/ios/EventHandlerIOS.mm:
1425         (WebCore::EventHandler::mouseMoved):
1426
1427 2019-02-26  Zalan Bujtas  <zalan@apple.com>
1428
1429         [ContentChangeObserver] Move observing logic from Document::updateStyleIfNeeded to ContentChangeObserver
1430         https://bugs.webkit.org/show_bug.cgi?id=195032
1431         <rdar://problem/48388063>
1432
1433         Reviewed by Tim Horton.
1434
1435         This might eventually turn into a regular start/stop content observing call.
1436
1437         * dom/Document.cpp:
1438         (WebCore::Document::updateStyleIfNeeded):
1439         * page/ios/ContentChangeObserver.h:
1440         * page/ios/ContentChangeObserver.mm:
1441         (WebCore::ContentChangeObserver::startObservingStyleResolve):
1442         (WebCore::ContentChangeObserver::stopObservingStyleResolve):
1443
1444 2019-02-26  Zalan Bujtas  <zalan@apple.com>
1445
1446         [ContentChangeObserver] Move CheckForVisibilityChange to ContentChangeObserver class
1447         https://bugs.webkit.org/show_bug.cgi?id=195035
1448         <rdar://problem/48389123>
1449
1450         Reviewed by Tim Horton.
1451
1452         Visibility checking logic belongs to ContentChangeObserver.
1453
1454         * page/ios/ContentChangeObserver.h:
1455         * page/ios/ContentChangeObserver.mm:
1456         (WebCore::elementImplicitVisibility):
1457         (WebCore::ContentChangeObserver::StyleChange::StyleChange):
1458         (WebCore::ContentChangeObserver::StyleChange::~StyleChange):
1459         * rendering/updating/RenderTreeUpdater.cpp:
1460         (WebCore::RenderTreeUpdater::updateElementRenderer):
1461         (WebCore::elementImplicitVisibility): Deleted.
1462         (WebCore::CheckForVisibilityChange::CheckForVisibilityChange): Deleted.
1463         (WebCore::CheckForVisibilityChange::~CheckForVisibilityChange): Deleted.
1464
1465 2019-02-26  Philippe Normand  <pnormand@igalia.com>
1466
1467         [EGL] Runtime support for RGB565 pixel layout
1468         https://bugs.webkit.org/show_bug.cgi?id=194817
1469
1470         Reviewed by Carlos Garcia Campos.
1471
1472         Currently our graphics pipeline always relies on a ARGB8888 (32
1473         bpp) pixel configuration. On some low-end (old) embedded platforms
1474         the graphics driver is sometimes optimized for 16 bpp
1475         configurations, such as RGB565. On those platforms the application
1476         can now set the WEBKIT_EGL_PIXEL_LAYOUT environment variable to
1477         "RGB565" to adjust to the best pixel configuration supported by
1478         the screen and graphics driver.
1479
1480         * platform/graphics/egl/GLContextEGL.cpp:
1481         (WebCore::GLContextEGL::getEGLConfig):
1482
1483 2019-02-26  Philippe Normand  <pnormand@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
1484
1485         [WPE] Add API for webview background color configuration
1486         https://bugs.webkit.org/show_bug.cgi?id=192305
1487
1488         Reviewed by Michael Catanzaro.
1489
1490         Adapt the FrameView API to allow a default non-white background color.
1491
1492         * page/Frame.cpp:
1493         (WebCore::Frame::createView): Replace isTransparent argument with a background color one.
1494         * page/Frame.h:
1495         * page/FrameView.cpp:
1496         (WebCore::FrameView::recalculateBaseBackgroundColor): Use Color::transparent if m_isTransparent is true.
1497         (WebCore::FrameView::updateBackgroundRecursively): Allow the fallback background color to be non-white, this is
1498         used only in non-dark-mode-css build configurations.
1499         * page/FrameView.h:
1500         * testing/Internals.cpp:
1501         (WebCore::Internals::setViewIsTransparent): Use Color::transparent if transparent is true.
1502
1503 2019-02-25  Yongjun Zhang  <yongjun_zhang@apple.com>
1504
1505         scalableNativeWebpageParameters() is not preserved on new page navigation.
1506         https://bugs.webkit.org/show_bug.cgi?id=194892
1507         <rdar://problem/47538280>
1508
1509         If a page's current default viewport configuration is scalableNativeWebpageParameters due to
1510         the fact that m_canIgnoreScalingConstraints is true, loading a new page should preserve this
1511         configuration until we derive the right values from viewport meta-tag.
1512
1513         Reviewed by Wenson Hsieh.
1514
1515         Test: fast/viewport/ios/viewport-shrink-to-fit-on-new-navigation.html
1516
1517         * page/ViewportConfiguration.cpp:
1518         (WebCore::ViewportConfiguration::canOverrideConfigurationParameters const): Use fixedNativeWebpageParameters().
1519         (WebCore::ViewportConfiguration::updateDefaultConfiguration): Use nativeWebpageParameters.
1520         (WebCore::ViewportConfiguration::nativeWebpageParameters): Return the appropriate default configuration
1521             based on m_canIgnoreScalingConstraints and shouldIgnoreMinimumEffectiveDeviceWidth().
1522         (WebCore::ViewportConfiguration::fixedNativeWebpageParameters): Renamed from nativeWebpageParameters()
1523         (WebCore::ViewportConfiguration::scalableNativeWebpageParameters): Use fixedNativeWebpageParameters.
1524         * page/ViewportConfiguration.h: Make nativeWebpageParameters() an instance method and change the old
1525             static method to fixedNativeWebpageParameters which better reflects the actual behavior.
1526
1527 2019-02-25  Zalan Bujtas  <zalan@apple.com>
1528
1529         [ContentChangeObserver] Move observing logic from DOMWindow::clearTimeout to ContentChangeObserver
1530         https://bugs.webkit.org/show_bug.cgi?id=194988
1531         <rdar://problem/48343040>
1532
1533         Reviewed by Tim Horton.
1534
1535         ContentChangeObserver::removeDOMTimer takes care of the canceled timer removal.
1536
1537         * page/DOMWindow.cpp:
1538         (WebCore::DOMWindow::clearTimeout):
1539         * page/ios/ContentChangeObserver.h:
1540         * page/ios/ContentChangeObserver.mm:
1541         (WebCore::ContentChangeObserver::startObservingDOMTimer):
1542         (WebCore::ContentChangeObserver::stopObservingDOMTimer):
1543         (WebCore::ContentChangeObserver::removeDOMTimer):
1544
1545 2019-02-25  Zalan Bujtas  <zalan@apple.com>
1546
1547         [ContentChangeObserver] Move observing logic from DOMTimer to ContentChangeObserver
1548         https://bugs.webkit.org/show_bug.cgi?id=194987
1549         <rdar://problem/48342910>
1550
1551         Reviewed by Tim Horton.
1552
1553         Content obvservation logic should all move to the ContentChangeObserver class.
1554
1555         * page/DOMTimer.cpp:
1556         (WebCore::DOMTimer::install):
1557         (WebCore::DOMTimer::fired):
1558         * page/Page.cpp:
1559         (WebCore::Page::Page):
1560         * page/Page.h:
1561         (WebCore::Page::contentChangeObserver):
1562         * page/ios/ContentChangeObserver.h:
1563         * page/ios/ContentChangeObserver.mm:
1564         (WebCore::ContentChangeObserver::ContentChangeObserver):
1565         (WebCore::ContentChangeObserver::registerDOMTimerForContentObservationIfNeeded):
1566         (WebCore::ContentChangeObserver::startObservingDOMTimer):
1567         (WebCore::ContentChangeObserver::stopObservingDOMTimer):
1568         (WebCore::ContentChangeObserver::containsObservedDOMTimer):
1569         (WebCore::ContentChangeObserver::addObservedDOMTimer):
1570         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
1571
1572 2019-02-25  John Wilander  <wilander@apple.com>
1573
1574         Introduce and adopt new class RegistrableDomain for eTLD+1
1575         https://bugs.webkit.org/show_bug.cgi?id=194791
1576         <rdar://problem/48179240>
1577
1578         Reviewed by Alex Christensen, Fujii Hironori, and Brent Fulgham.
1579
1580         A new API test was added. Plenty of existing layout tests under
1581         http/tests/resourceLoadStatistics/ and http/tests/storageAccess/ test the code.
1582
1583         This patch introduces and adopts a new class called WebCore::RegistrableDomain
1584         which represents a domain's eTLD+1 (effective top level domain plus one) and is
1585         the basis for the term "site," as in same-site. Other popular names include
1586         high-level domain, primary domain, and top privately controlled/owned domain.
1587         Effective top level domains are enumerated on the Public Suffix List
1588         (https://publicsuffix.org).
1589
1590         This class just uses the full domain for when the Public Suffix List cannot help
1591         finding the registrable domain and for WebKit ports that haven't enabled
1592         PUBLIC_SUFFIX_LIST. It also uses the string "nullOrigin" as a representation
1593         for the null or unique origin (this matches how these origins were handled
1594         before).
1595
1596         The implementation is a wrapper around a String and the functions and class
1597         members that now make use of this new class used to handle regular String
1598         objects which didn't help much in terms of type safety or guarantees that the
1599         string had already been converted to an eTLD+1.
1600
1601         We've at least two bad bugs in the Storage Access API because of confusion
1602         between a URL's eTLD+1 and its host. The usage of WebCore::RegistrableDomain
1603         will prohibit such bugs in the future.
1604
1605         Partitioning in WebKit also uses eTLD+1 to a large extent. I plan to adopt
1606         WebCore::RegistrableDomain for partitioning in a later patch.
1607
1608         This patch also enhances parameter naming by:
1609         - Removing parts that refer to "primary" as in primaryDomain.
1610         - Replacing references to "TopPrivatelyControlledDomain" with "RegistrableDomain."
1611         - Replacing references to "TopPrivatelyOwnedDomain" with "RegistrableDomain."
1612         - Using the term "domain" consistently instead of e.g. "host."
1613
1614         * WebCore.xcodeproj/project.pbxproj:
1615         * dom/Document.cpp:
1616         (WebCore::Document::hasRequestedPageSpecificStorageAccessWithUserInteraction):
1617         (WebCore::Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction):
1618         * dom/Document.h:
1619         * html/HTMLAnchorElement.cpp:
1620         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
1621         * html/HTMLMediaElement.cpp:
1622         (WebCore::HTMLMediaElement::mediaSessionTitle const):
1623         * loader/AdClickAttribution.cpp:
1624         (WebCore::AdClickAttribution::url const):
1625         (WebCore::AdClickAttribution::referrer const):
1626         (WebCore::AdClickAttribution::toString const):
1627         * loader/AdClickAttribution.h:
1628         (WebCore::AdClickAttribution::Source::Source):
1629         (WebCore::AdClickAttribution::Source::matches const):
1630         (WebCore::AdClickAttribution::Source::deleteValue):
1631         (WebCore::AdClickAttribution::Destination::Destination):
1632         (WebCore::AdClickAttribution::Destination::matches const):
1633         (WebCore::AdClickAttribution::Destination::deleteValue):
1634         * loader/ResourceLoadObserver.cpp:
1635         (WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
1636         (WebCore::ResourceLoadObserver::setLogUserInteractionNotificationCallback):
1637         (WebCore::ResourceLoadObserver::setLogWebSocketLoadingNotificationCallback):
1638         (WebCore::ResourceLoadObserver::setLogSubresourceLoadingNotificationCallback):
1639         (WebCore::ResourceLoadObserver::setLogSubresourceRedirectNotificationCallback):
1640         (WebCore::ResourceLoadObserver::logSubresourceLoading):
1641         (WebCore::ResourceLoadObserver::logWebSocketLoading):
1642         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1643         (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
1644         (WebCore::ResourceLoadObserver::logFontLoad):
1645         (WebCore::ResourceLoadObserver::logCanvasRead):
1646         (WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
1647         (WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
1648         (WebCore::ResourceLoadObserver::logScreenAPIAccessed):
1649         (WebCore::ResourceLoadObserver::ensureResourceStatisticsForRegistrableDomain):
1650         (WebCore::ResourceLoadObserver::statisticsForOrigin):
1651         (WebCore::primaryDomain): Deleted.
1652         (WebCore::ResourceLoadObserver::ensureResourceStatisticsForPrimaryDomain): Deleted.
1653         * loader/ResourceLoadObserver.h:
1654         * loader/ResourceLoadStatistics.cpp:
1655         (WebCore::ResourceLoadStatistics::encode const):
1656         (WebCore::ResourceLoadStatistics::decode):
1657         (WebCore::ResourceLoadStatistics::toString const):
1658         (WebCore::ResourceLoadStatistics::merge):
1659         (WebCore::ResourceLoadStatistics::primaryDomain): Deleted.
1660         * loader/ResourceLoadStatistics.h:
1661         (WebCore::ResourceLoadStatistics::ResourceLoadStatistics):
1662         * page/Page.cpp:
1663         (WebCore::Page::logNavigation):
1664         (WebCore::Page::mainFrameLoadStarted):
1665         * page/Page.h:
1666         * page/PerformanceMonitor.cpp:
1667         (WebCore::reportPageOverPostLoadResourceThreshold):
1668         * platform/RegistrableDomain.h: Added.
1669         (WebCore::RegistrableDomain::RegistrableDomain):
1670         (WebCore::RegistrableDomain::isEmpty const):
1671         (WebCore::RegistrableDomain::string const):
1672         (WebCore::RegistrableDomain::operator!= const):
1673         (WebCore::RegistrableDomain::operator== const):
1674         (WebCore::RegistrableDomain::matches const):
1675         (WebCore::RegistrableDomain::isolatedCopy const):
1676         (WebCore::RegistrableDomain::isHashTableDeletedValue const):
1677         (WebCore::RegistrableDomain::hash const):
1678         (WebCore::RegistrableDomain::RegistrableDomainHash::hash):
1679         (WebCore::RegistrableDomain::RegistrableDomainHash::equal):
1680         (WebCore::RegistrableDomain::encode const):
1681         (WebCore::RegistrableDomain::decode):
1682         * platform/network/NetworkStorageSession.cpp:
1683         (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const):
1684         (WebCore::NetworkStorageSession::shouldBlockCookies const):
1685         (WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor):
1686         (WebCore::NetworkStorageSession::removePrevalentDomains):
1687         (WebCore::NetworkStorageSession::hasStorageAccess const):
1688         (WebCore::NetworkStorageSession::getAllStorageAccessEntries const):
1689         (WebCore::NetworkStorageSession::grantStorageAccess):
1690         (WebCore::getPartitioningDomain): Deleted.
1691         * platform/network/NetworkStorageSession.h:
1692
1693 2019-02-25  Chris Fleizach  <cfleizach@apple.com>
1694
1695         AX: <footer> HTML5 tag not reading as ARIA Landmark to VoiceOver
1696         https://bugs.webkit.org/show_bug.cgi?id=190138
1697         <rdar://problem/44907695>
1698
1699         Reviewed by Joanmarie Diggs.
1700
1701         Make sure that footer elements use the right role depending on their context.
1702         If scoped to body, they become contentinfo. Otherwise they are just delineated by
1703         a footer subrole.
1704
1705         * accessibility/AccessibilityObject.cpp:
1706         (WebCore::AccessibilityObject::isLandmark const):
1707         * accessibility/AccessibilityRenderObject.cpp:
1708         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
1709         (WebCore::AccessibilityRenderObject::isDescendantOfElementType const):
1710         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
1711         * accessibility/AccessibilityRenderObject.h:
1712         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1713         (-[WebAccessibilityObjectWrapper _accessibilityIsLandmarkRole:]):
1714         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1715         (-[WebAccessibilityObjectWrapper subrole]):
1716
1717 2019-02-25  Sihui Liu  <sihui_liu@apple.com>
1718
1719         IndexedDB: IDBDatabase and IDBTransaction are leaked in layout tests
1720         https://bugs.webkit.org/show_bug.cgi?id=194709
1721
1722         Reviewed by Geoffrey Garen.
1723
1724         When connection to IDB server is closed, IDBTransaction would abort without notifying IDBDatabase, so 
1725         IDBDatabase didn't clear its reference to IDBTransaction which created a reference cycle. 
1726  
1727         Also IDBTransaction didn't clear its reference to IDBRequest in this case and it led to another reference cycle
1728         between IDBOpenDBRequest and IDBTransaction.
1729
1730         Test: storage/indexeddb/IDBObject-leak.html
1731
1732         * Modules/indexeddb/IDBDatabase.cpp:
1733         (WebCore::IDBDatabase::connectionToServerLost):
1734         * Modules/indexeddb/IDBTransaction.cpp:
1735         (WebCore::IDBTransaction::IDBTransaction):
1736         (WebCore::IDBTransaction::~IDBTransaction):
1737         (WebCore::IDBTransaction::connectionClosedFromServer):
1738         * Modules/indexeddb/IDBTransaction.h:
1739         * testing/Internals.cpp:
1740         (WebCore::Internals::numberOfIDBTransactions const):
1741         * testing/Internals.h:
1742         * testing/Internals.idl:
1743
1744 2019-02-25  Zalan Bujtas  <zalan@apple.com>
1745
1746         Add missing stream parameter. Unreviewed.
1747
1748         * page/DOMTimer.cpp:
1749         (WebCore::DOMTimer::fired):
1750
1751 2019-02-25  Zalan Bujtas  <zalan@apple.com>
1752
1753         Unreviewed build fix after r242032.
1754
1755         * page/DOMTimer.cpp:
1756         (WebCore::DOMTimer::install):
1757
1758 2019-02-20  Darin Adler  <darin@apple.com>
1759
1760         Incorrect use of String::foldCase for font family names
1761         https://bugs.webkit.org/show_bug.cgi?id=194895
1762
1763         Reviewed by Myles C. Maxfield.
1764
1765         * platform/graphics/FontCascadeDescription.cpp:
1766         (WebCore::FontCascadeDescription::familiesEqualForTextAutoSizing): Use
1767         familyNamesAreEqual instead of calling convertToASCIILowercase directly.
1768         (WebCore::FontCascadeDescription::familyNamesAreEqual): Use AtomicString's
1769         operator== when we want case sensitive family name comparisons. This is a special
1770         case to accomodate CoreText, which uses "."-prefix names for internal fonts that
1771         are treated case sensitively. (Ideally webpages would not use these fonts at all.)
1772         (WebCore::FontCascadeDescription::familyNameHash): Use AtomicString's existingHash
1773         when we want case sensitive family name hashing.
1774         (WebCore::FontCascadeDescription::foldedFamilyName): Take a String instead of an
1775         AtomicString so we can use this at an additional call site. Converting from an
1776         AtomicString to a String if free and automatic at the existing call sites. Use
1777         convertToASCIILowercase instead of foldCase for three reasons: 1) Other functions
1778         here are folding only ASCII case by using ASCIICaseInsensitiveHash, and this one
1779         must be consistent. 2) this is considerably faster, and 3) font family names don't
1780         need arbitrary Unicode case folding, it's only A-Z that should be folded.
1781         * platform/graphics/FontCascadeDescription.h: Take a String instead of AtomicString
1782         in the foldedFamilyName function.
1783
1784         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1785         (WebCore::FontDatabase::collectionForFamily): Instead of calling foldCase, use
1786         FontCascadeDescription::foldedFamilyName to correctly fold font family names.
1787
1788 2019-02-25  Charlie Turner  <cturner@igalia.com>
1789
1790         [EME][GStreamer] Replace caps field loop with gst_structure_remove_fields
1791         https://bugs.webkit.org/show_bug.cgi?id=194992
1792
1793         Reviewed by Xabier Rodriguez-Calvar.
1794
1795         Refactoring, no new tests.
1796
1797         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
1798         (transformCaps): Simplify the code a little. The idea to use this
1799         utility function came from a review upstream here:
1800         https://gitlab.freedesktop.org/gstreamer/gst-devtools/merge_requests/67
1801
1802 2019-02-25  Alicia Boya García  <aboya@igalia.com>
1803
1804         [MSE][GStreamer] Batch player duration updates
1805         https://bugs.webkit.org/show_bug.cgi?id=194220
1806
1807         Reviewed by Xabier Rodriguez-Calvar.
1808
1809         This saves up a ton of CPU cycles doing layout unnecessarily when all
1810         the appended frames extend the duration of the movie, like in
1811         YTTV 2018 59.DASHLatencyVP9.
1812
1813         This patch is an optimization that introduces no new behavior.
1814
1815         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1816         (WebCore::AppendPipeline::consumeAppsinkAvailableSamples):
1817         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1818         (WebCore::MediaPlayerPrivateGStreamerMSE::blockDurationChanges):
1819         (WebCore::MediaPlayerPrivateGStreamerMSE::unblockDurationChanges):
1820         (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
1821         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
1822
1823 2019-02-25  Miguel Gomez  <magomez@igalia.com>
1824
1825         [WPE] Add support for holepunch using an external video player
1826         https://bugs.webkit.org/show_bug.cgi?id=194899
1827
1828         Reviewed by Xabier Rodriguez-Calvar.
1829
1830         Implement the holepunch feature to allow playback using an external player. This creates
1831         a new dummy MediaPlayerPrivateHolePunch that accepts only the type "video/holepunch", and
1832         whose goal is to just draw a transparent rectangle in the position where the video should be.
1833         This can be used to allow a player placed on a lower plane than the browser to become visible.
1834
1835         Added ManualTest wpe/video-player-holepunch-external.html to test the feature.
1836
1837         * PlatformWPE.cmake:
1838         * platform/HolePunch.cmake: Added.
1839         * platform/graphics/MediaPlayer.cpp:
1840         (WebCore::buildMediaEnginesVector):
1841         * platform/graphics/holepunch/MediaPlayerPrivateHolePunch.cpp: Added.
1842         (WebCore::MediaPlayerPrivateHolePunch::MediaPlayerPrivateHolePunch):
1843         (WebCore::MediaPlayerPrivateHolePunch::~MediaPlayerPrivateHolePunch):
1844         (WebCore::MediaPlayerPrivateHolePunch::platformLayer const):
1845         (WebCore::MediaPlayerPrivateHolePunch::naturalSize const):
1846         (WebCore::MediaPlayerPrivateHolePunch::pushNextHolePunchBuffer):
1847         (WebCore::MediaPlayerPrivateHolePunch::swapBuffersIfNeeded):
1848         (WebCore::MediaPlayerPrivateHolePunch::proxy const):
1849         (WebCore::mimeTypeCache):
1850         (WebCore::MediaPlayerPrivateHolePunch::getSupportedTypes):
1851         (WebCore::MediaPlayerPrivateHolePunch::supportsType):
1852         (WebCore::MediaPlayerPrivateHolePunch::registerMediaEngine):
1853         (WebCore::MediaPlayerPrivateHolePunch::notifyReadyState):
1854         * platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h: Added.
1855         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
1856         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
1857
1858 2019-02-24  Zalan Bujtas  <zalan@apple.com>
1859
1860         Introduce ContentChangeObserver class
1861         https://bugs.webkit.org/show_bug.cgi?id=194977
1862         <rdar://problem/48338115>
1863
1864         Reviewed by Simon Fraser.
1865
1866         This patch is about piping through all the related WK* calls. 
1867
1868         * SourcesCocoa.txt:
1869         * WebCore.xcodeproj/project.pbxproj:
1870         * dom/Document.cpp:
1871         (WebCore::Document::scheduleStyleRecalc):
1872         (WebCore::Document::updateStyleIfNeeded):
1873         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
1874         * loader/FrameLoader.cpp:
1875         * page/DOMTimer.cpp:
1876         (WebCore::DOMTimer::install):
1877         (WebCore::DOMTimer::fired):
1878         * page/DOMWindow.cpp:
1879         (WebCore::DOMWindow::clearTimeout):
1880         * page/Frame.cpp:
1881         (WebCore::Frame::willDetachPage):
1882         * page/Page.h:
1883         (WebCore::Page::contentChangeObserver):
1884         * page/ios/EventHandlerIOS.mm:
1885         (WebCore::EventHandler::mouseMoved):
1886         * rendering/updating/RenderTreeUpdater.cpp:
1887         (WebCore::RenderTreeUpdater::updateElementRenderer):
1888         (WebCore::CheckForVisibilityChange::CheckForVisibilityChange):
1889         (WebCore::CheckForVisibilityChange::~CheckForVisibilityChange):
1890
1891 2019-02-24  Simon Fraser  <simon.fraser@apple.com>
1892
1893         Migrate from "fixedPositionRect" to "layoutViewport" in the scrolling tree
1894         https://bugs.webkit.org/show_bug.cgi?id=194984
1895
1896         Reviewed by Sam Weinig.
1897
1898         Rename "fixedPositionRect" to "layoutViewport" in scrolling tree code.
1899
1900         Remove ScrollingTree::fixedPositionRect() which was only used on iOS, to fetch the
1901         current layout viewport rect. Instead, set the layout viewport on the root
1902         node in ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling().
1903
1904         * page/scrolling/ScrollingTree.cpp:
1905         (WebCore::ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling):
1906         (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling): Deleted.
1907         * page/scrolling/ScrollingTree.h:
1908         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
1909         (WebCore::ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange):
1910         * page/scrolling/ScrollingTreeFrameHostingNode.h:
1911         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1912         * page/scrolling/ScrollingTreeNode.h:
1913         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1914         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterAncestorChange):
1915         * page/scrolling/ScrollingTreeScrollingNode.h:
1916         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
1917         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
1918         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
1919         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
1920         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
1921         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):
1922         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1923         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
1924         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1925         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange):
1926         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition):
1927
1928 2019-02-24  Devin Rousso  <drousso@apple.com>
1929
1930         Web Inspector: Change the InspectorOverlay to use native rather than canvas
1931         https://bugs.webkit.org/show_bug.cgi?id=105023
1932         <rdar://problem/13443692>
1933
1934         Reviewed by Brian Burg.
1935
1936         Should be no change in observed functionality.
1937
1938         * inspector/InspectorOverlay.h:
1939         * inspector/InspectorOverlay.cpp:
1940         (WebCore::truncateWithEllipsis): Added.
1941         (WebCore::localPointToRootPoint): Added.
1942         (WebCore::contentsQuadToCoordinateSystem):
1943         (WebCore::effectiveElementForNode): Added.
1944         (WebCore::quadToPath): Added.
1945         (WebCore::drawOutlinedQuadWithClip): Added.
1946         (WebCore::drawOutlinedQuad): Added.
1947         (WebCore::drawFragmentHighlight): Added.
1948         (WebCore::drawShapeHighlight): Added.
1949         (WebCore::InspectorOverlay::paint):
1950         (WebCore::InspectorOverlay::setIndicating):
1951         (WebCore::InspectorOverlay::shouldShowOverlay const):
1952         (WebCore::InspectorOverlay::update):
1953         (WebCore::InspectorOverlay::setShowPaintRects): Added.
1954         (WebCore::InspectorOverlay::showPaintRect):
1955         (WebCore::InspectorOverlay::updatePaintRectsTimerFired):
1956         (WebCore::InspectorOverlay::drawNodeHighlight):
1957         (WebCore::InspectorOverlay::drawQuadHighlight):
1958         (WebCore::InspectorOverlay::drawPaintRects):
1959         (WebCore::InspectorOverlay::drawBounds): Added.
1960         (WebCore::InspectorOverlay::drawRulers):
1961         (WebCore::InspectorOverlay::drawElementTitle): Added.
1962         (WebCore::contentsQuadToPage): Deleted.
1963         (WebCore::InspectorOverlay::setPausedInDebuggerMessage): Deleted.
1964         (WebCore::buildObjectForPoint): Deleted.
1965         (WebCore::buildObjectForRect): Deleted.
1966         (WebCore::buildArrayForQuad): Deleted.
1967         (WebCore::buildObjectForHighlight): Deleted.
1968         (WebCore::buildObjectForSize): Deleted.
1969         (WebCore::InspectorOverlay::setShowingPaintRects): Deleted.
1970         (WebCore::buildArrayForRendererFragments): Deleted.
1971         (WebCore::localPointToRoot): Deleted.
1972         (WebCore::appendPathCommandAndPoints): Deleted.
1973         (WebCore::appendPathSegment): Deleted.
1974         (WebCore::buildObjectForShapeOutside): Deleted.
1975         (WebCore::buildObjectForElementData): Deleted.
1976         (WebCore::InspectorOverlay::buildHighlightObjectForNode const): Deleted.
1977         (WebCore::InspectorOverlay::buildObjectForHighlightedNodes const): Deleted.
1978         (WebCore::InspectorOverlay::drawPausedInDebuggerMessage): Deleted.
1979         (WebCore::InspectorOverlay::overlayPage): Deleted.
1980         (WebCore::InspectorOverlay::forcePaint): Deleted.
1981         (WebCore::InspectorOverlay::reset): Deleted.
1982         (WebCore::evaluateCommandInOverlay): Deleted.
1983         (WebCore::InspectorOverlay::evaluateInOverlay): Deleted.
1984         (WebCore::InspectorOverlay::freePage): Deleted.
1985
1986         * inspector/agents/InspectorPageAgent.cpp:
1987         (WebCore::InspectorPageAgent::disable):
1988         (WebCore::InspectorPageAgent::setShowPaintRects):
1989         Drive-by: rename `setShowingPaintRects` to better match the protocol.
1990
1991         * inspector/agents/page/PageDebuggerAgent.h:
1992         * inspector/agents/page/PageDebuggerAgent.cpp:
1993         (WebCore::PageDebuggerAgent::PageDebuggerAgent):
1994         (WebCore::PageDebuggerAgent::setOverlayMessage): Deleted.
1995         Remove `Debugger.setOverlayMessage` command as it hasn't been used and is no longer supported.
1996
1997         * inspector/InspectorController.h:
1998         * inspector/InspectorController.cpp:
1999         (WebCore::InspectorController::createLazyAgents):
2000         (WebCore::InspectorController::disconnectFrontend):
2001         (WebCore::InspectorController::disconnectAllFrontends):
2002         (WebCore::InspectorController::buildObjectForHighlightedNodes const): Deleted.
2003
2004         * testing/Internals.h:
2005         * testing/Internals.idl:
2006         * testing/Internals.cpp:
2007         (WebCore::Internals::inspectorHighlightObject): Deleted.
2008
2009         * inspector/InspectorOverlayPage.css: Removed.
2010         * inspector/InspectorOverlayPage.html: Removed.
2011         * inspector/InspectorOverlayPage.js: Removed.
2012
2013         * CMakeLists.txt:
2014         * DerivedSources-input.xcfilelist:
2015         * DerivedSources-output.xcfilelist:
2016         * DerivedSources.make:
2017         * WebCore.xcodeproj/project.pbxproj:
2018
2019 2019-02-20  Darin Adler  <darin@apple.com>
2020
2021         Finish removing String::format
2022         https://bugs.webkit.org/show_bug.cgi?id=194893
2023
2024         Reviewed by Daniel Bates.
2025
2026         * dom/Document.cpp:
2027         (WebCore::Document::lastModified const): Use makeString and pad.
2028         * html/FTPDirectoryDocument.cpp:
2029         (WebCore::processFileDateString): Ditto.
2030
2031         * mathml/MathMLElement.cpp:
2032         (WebCore::convertToPercentageIfNeeded): Use makeString and FormattedNumber.
2033
2034         * page/cocoa/ResourceUsageOverlayCocoa.mm:
2035         (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and pad.
2036
2037         * page/linux/ResourceUsageOverlayLinux.cpp:
2038         (WebCore::cpuUsageString): Use makeString, FormattedNumber, and pad.
2039         (WebCore::gcTimerString): Use String::number.
2040
2041         * platform/DateComponents.cpp:
2042         (WebCore::DateComponents::toStringForTime const): Use makeString and pad.
2043         (WebCore::DateComponents::toString const): Ditto.
2044
2045         * platform/LocalizedStrings.cpp: Removed comment that mentioned String::format,
2046         and that was also inaccurate.
2047
2048         * platform/audio/HRTFElevation.cpp:
2049         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
2050         Use makeString and pad.
2051         * platform/mock/MockRealtimeVideoSource.cpp:
2052         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
2053         * rendering/RenderLayerCompositor.cpp:
2054         (WebCore::RenderLayerCompositor::logLayerInfo): Ditto.
2055         * rendering/RenderTheme.cpp:
2056         (WebCore::RenderTheme::formatMediaControlsTime const): Ditto.
2057
2058 2019-02-24  Michael Catanzaro  <mcatanzaro@igalia.com>
2059
2060         [WPE][GTK] Remove user agent quirk for washingtonpost.com
2061         https://bugs.webkit.org/show_bug.cgi?id=194981
2062
2063         Reviewed by Žan Doberšek.
2064
2065         Remove user agent quirk for washingtonpost.com because we support JPEG 2000 now.
2066
2067         * platform/UserAgentQuirks.cpp:
2068         (WebCore::urlRequiresChromeBrowser):
2069
2070 2019-02-23  Simon Fraser  <simon.fraser@apple.com>
2071
2072         Remove remnants of iOS WK1 scrolling tree code
2073         https://bugs.webkit.org/show_bug.cgi?id=194980
2074
2075         Reviewed by Sam Weinig.
2076
2077         Remove ScrollingTreeIOS and ScrollingCoordinatorIOS which were never instantiated,
2078         to reduce maintenance costs and simplify.
2079
2080         Merge ScrollingTreeFrameScrollingNodeIOS into ScrollingTreeFrameScrollingNodeRemoteIOS
2081         since that was the only concrete subclass, removing code which never applies to iOS WK2
2082         (e.g. the synchronous scrolling code path).
2083
2084         * SourcesCocoa.txt:
2085         * WebCore.xcodeproj/project.pbxproj:
2086         * page/FrameView.h:
2087         * page/scrolling/ScrollingCoordinator.cpp:
2088         * page/scrolling/ScrollingTree.h:
2089         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
2090         * page/scrolling/ScrollingTreeNode.h:
2091         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2092         (WebCore::ScrollingTreeScrollingNode::handleWheelEvent):
2093         * page/scrolling/ScrollingTreeScrollingNode.h:
2094         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterDelegatedScroll): Deleted.
2095         (WebCore::ScrollingTreeScrollingNode::scrollableAreaSize const): Deleted.
2096         (WebCore::ScrollingTreeScrollingNode::totalContentsSize const): Deleted.
2097         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsets const): Deleted.
2098         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsets const): Deleted.
2099         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsetRanges const): Deleted.
2100         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsetRanges const): Deleted.
2101         (WebCore::ScrollingTreeScrollingNode::currentHorizontalSnapPointIndex const): Deleted.
2102         (WebCore::ScrollingTreeScrollingNode::currentVerticalSnapPointIndex const): Deleted.
2103         (WebCore::ScrollingTreeScrollingNode::setCurrentHorizontalSnapPointIndex): Deleted.
2104         (WebCore::ScrollingTreeScrollingNode::setCurrentVerticalSnapPointIndex): Deleted.
2105         (WebCore::ScrollingTreeScrollingNode::useDarkAppearanceForScrollbars const): Deleted.
2106         (WebCore::ScrollingTreeScrollingNode::lastCommittedScrollPosition const): Deleted.
2107         (WebCore::ScrollingTreeScrollingNode::reachableContentsSize const): Deleted.
2108         (WebCore::ScrollingTreeScrollingNode::parentRelativeScrollableRect const): Deleted.
2109         (WebCore::ScrollingTreeScrollingNode::scrollOrigin const): Deleted.
2110         (WebCore::ScrollingTreeScrollingNode::totalContentsSizeForRubberBand const): Deleted.
2111         (WebCore::ScrollingTreeScrollingNode::setTotalContentsSizeForRubberBand): Deleted.
2112         (WebCore::ScrollingTreeScrollingNode::horizontalScrollElasticity const): Deleted.
2113         (WebCore::ScrollingTreeScrollingNode::verticalScrollElasticity const): Deleted.
2114         (WebCore::ScrollingTreeScrollingNode::hasEnabledHorizontalScrollbar const): Deleted.
2115         (WebCore::ScrollingTreeScrollingNode::hasEnabledVerticalScrollbar const): Deleted.
2116         (WebCore::ScrollingTreeScrollingNode::canHaveScrollbars const): Deleted.
2117         (WebCore::ScrollingTreeScrollingNode::expectsWheelEventTestTrigger const): Deleted.
2118         (WebCore::ScrollingTreeScrollingNode::scrollContainerLayer const): Deleted.
2119         (WebCore::ScrollingTreeScrollingNode::scrolledContentsLayer const): Deleted.
2120         * page/scrolling/ios/ScrollingCoordinatorIOS.h: Removed.
2121         * page/scrolling/ios/ScrollingCoordinatorIOS.mm: Removed.
2122         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h: Removed.
2123         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: Removed.
2124         * page/scrolling/ios/ScrollingTreeIOS.cpp: Removed.
2125         * page/scrolling/ios/ScrollingTreeIOS.h: Removed.
2126         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2127         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
2128
2129 2019-02-23  Justin Fan  <justin_fan@apple.com>
2130
2131         [WebGPU] Buffer updates part 1: async mapping functions, unmap, and destroy
2132         https://bugs.webkit.org/show_bug.cgi?id=194665
2133
2134         Reviewed by Dean Jackson.
2135
2136         Test: map-write-buffers.html. Other tests updated to match new API.
2137
2138         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp: Added.
2139         (WebCore::validateBufferBindingType): Ensure buffer binding usages match the binding type.
2140         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Logic moved out from WebGPUDevice.cpp.
2141         * Modules/webgpu/WebGPUBindGroupDescriptor.h:
2142         * Modules/webgpu/WebGPUBuffer.cpp: Added GPUBuffer functionality.
2143         (WebCore::WebGPUBuffer::create):
2144         (WebCore::WebGPUBuffer::WebGPUBuffer):
2145         (WebCore::WebGPUBuffer::mapReadAsync):
2146         (WebCore::WebGPUBuffer::mapWriteAsync):
2147         (WebCore::WebGPUBuffer::unmap):
2148         (WebCore::WebGPUBuffer::destroy):
2149         (WebCore::WebGPUBuffer::rejectOrRegisterPromiseCallback): Register a mapping request on the GPUBuffer, if valid.
2150         * Modules/webgpu/WebGPUBuffer.h:
2151         (WebCore::WebGPUBuffer::buffer const):
2152         (WebCore::WebGPUBuffer::mapping const): Deleted.
2153         * Modules/webgpu/WebGPUBuffer.idl: Update to latest API and enable every function except setSubData.
2154         * Modules/webgpu/WebGPUCommandBuffer.cpp:
2155         (WebCore::WebGPUCommandBuffer::beginRenderPass): Renamed descriptor conversion method.
2156         * Modules/webgpu/WebGPUDevice.cpp:
2157         (WebCore::WebGPUDevice::createBuffer const): Update to non-nullable return type.
2158         (WebCore::WebGPUDevice::createBindGroup const): Move descriptor validation logic to descriptor implementation.
2159         * Modules/webgpu/WebGPUDevice.h:
2160         * Modules/webgpu/WebGPURenderPassDescriptor.cpp:
2161         (WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const): Renamed from validateAndConvertToGPUVersion.
2162         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
2163         (WebCore::WebGPURenderPassEncoder::setVertexBuffers): Add validation for submitted buffers.
2164         * platform/graphics/gpu/GPUBuffer.cpp: Added.
2165         (WebCore::GPUBuffer::PendingMappingCallback::PendingMappingCallback): New struct for retaining a reference to mapping callbacks.
2166         * platform/graphics/gpu/GPUBuffer.h: Add functionality to retain callbacks and usage bits.
2167         (WebCore::GPUBuffer::isVertex const):
2168         (WebCore::GPUBuffer::isUniform const):
2169         (WebCore::GPUBuffer::isStorage const):
2170         (WebCore::GPUBuffer::isReadOnly const):
2171         (WebCore::GPUBuffer::PendingMapPromise::create):
2172         (WebCore::GPUBuffer::isMappable const):
2173         (WebCore::GPUBuffer::isMapWriteable const):
2174         (WebCore::GPUBuffer::isMapReadable const):
2175         (WebCore::GPUBuffer::mapping const): Deleted.
2176         * platform/graphics/gpu/GPUBufferUsage.h: enum class cannot be logical ORed together.
2177         * platform/graphics/gpu/GPUDevice.cpp:
2178         (WebCore::GPUDevice::tryCreateBuffer const): Renamed from createBuffer. 
2179         (WebCore::GPUDevice::createBuffer const): Deleted.
2180         * platform/graphics/gpu/GPUDevice.h:
2181         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
2182         (WebCore::GPUBuffer::tryCreateSharedBuffer): Attempt to create a MTLBuffer with shared memory.
2183         (WebCore::GPUBuffer::tryCreate): No longer use Gigacage-allocated memory for MTLBuffer.
2184         (WebCore::GPUBuffer::GPUBuffer):
2185         (WebCore::GPUBuffer::~GPUBuffer):
2186         (WebCore::GPUBuffer::registerMappingCallback): Register the provided callback to be executed when the staging buffer can be safely exposed.
2187         (WebCore::GPUBuffer::stagingBufferForRead): Prepare the arrayBuffer for reading and run the mapping callback.
2188         (WebCore::GPUBuffer::stagingBufferForWrite): Ditto, but for writing.
2189         (WebCore::GPUBuffer::unmap): If needed, copy the staging ArrayBuffer to the MTLBuffer. Unregister any mapping callback.
2190         (WebCore::GPUBuffer::destroy): Stub implementation for now. Frees the MTLBuffer as soon as possible.
2191         (WebCore::GPUBuffer::create): Deleted.
2192         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
2193         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder): Ensure only read-only GPUBuffers are used as read-only on the GPU.
2194
2195         Add symbols for new files:
2196         * Sources.txt:
2197         * WebCore.xcodeproj/project.pbxproj:
2198
2199 2019-02-23  Keith Miller  <keith_miller@apple.com>
2200
2201         Add new mac target numbers
2202         https://bugs.webkit.org/show_bug.cgi?id=194955
2203
2204         Reviewed by Tim Horton.
2205
2206         * Configurations/Base.xcconfig:
2207         * Configurations/DebugRelease.xcconfig:
2208
2209 2019-02-23  chris fleizach  <cfleizach@apple.com>
2210
2211         AX: WebKit is incorrectly mapping the <meter> element to progressbar
2212         https://bugs.webkit.org/show_bug.cgi?id=164051
2213         <rdar://problem/29055615>
2214
2215         Reviewed by Joanmarie Diggs.
2216
2217         Add a specific role for meter and map that to the appropriate mac role. 
2218
2219         * accessibility/AccessibilityNodeObject.cpp:
2220         (WebCore::AccessibilityNodeObject::canHaveChildren const):
2221         (WebCore::AccessibilityNodeObject::isProgressIndicator const):
2222         * accessibility/AccessibilityObject.cpp:
2223         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent const):
2224         (WebCore::AccessibilityObject::isRangeControl const):
2225         (WebCore::AccessibilityObject::computedRoleString const):
2226         * accessibility/AccessibilityObjectInterface.h:
2227         * accessibility/AccessibilityProgressIndicator.cpp:
2228         (WebCore::AccessibilityProgressIndicator::roleValue const):
2229         * accessibility/AccessibilityProgressIndicator.h:
2230         * accessibility/AccessibilityRenderObject.cpp:
2231         (WebCore::AccessibilityRenderObject::shouldFocusActiveDescendant const):
2232         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2233         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
2234         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2235         (createAccessibilityRoleMap):
2236
2237 2019-02-22  Ryosuke Niwa  <rniwa@webkit.org>
2238
2239         Crash in SWServerJobQueue::runNextJobSynchronously
2240         https://bugs.webkit.org/show_bug.cgi?id=194974
2241
2242         Reviewed by Geoffrey Garen.
2243
2244         We suspect the crash is happening due to m_jobQueue being empty in runNextJobSynchronously
2245         or there is a timer heap corruption again :(
2246
2247         Exit early when m_jobQueue is empty. Also add a debug assert that this should never happen
2248         but convert an existing release assert to a debug assert since this appears to be hitting
2249         too frequently in wild.
2250
2251         * workers/service/server/SWServerJobQueue.cpp:
2252         (WebCore::SWServerJobQueue::runNextJobSynchronously):
2253
2254 2019-02-22  Simon Fraser  <simon.fraser@apple.com>
2255
2256         Clean up the setScrollPosition/setScrollPositionWithoutContentEdgeConstraints confusion in the scrolling tree nodes
2257         https://bugs.webkit.org/show_bug.cgi?id=194968
2258
2259         Reviewed by Antti Koivisto.
2260
2261         Having both setScrollPosition() and setScrollPositionWithoutContentEdgeConstraints() is confusing because
2262         you can't tell which is the bottleneck. So add a 'clamp' parameter to setScrollPosition() and merge them.
2263
2264         ScrollingTreeFrameScrollingNodeMac::setScrollPosition() replicates a bit of code but future cleanups will
2265         reduce that.
2266
2267         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
2268         (WebCore::ScrollingTreeFrameScrollingNode::setScrollPosition): Deleted. This was the same as the base class method.
2269         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
2270         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2271         (WebCore::ScrollingTreeScrollingNode::setScrollPosition):
2272         (WebCore::ScrollingTreeScrollingNode::clampScrollPosition const):
2273         (WebCore::ScrollingTreeScrollingNode::scrollBy):
2274         (WebCore::ScrollingTreeScrollingNode::setScrollPositionWithoutContentEdgeConstraints): Deleted.
2275         (WebCore::ScrollingTreeScrollingNode::scrollByWithoutContentEdgeConstraints): Deleted.
2276         * page/scrolling/ScrollingTreeScrollingNode.h:
2277         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
2278         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
2279         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPosition):
2280         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints): Deleted. Did nothing.
2281         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
2282         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2283         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
2284         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
2285         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
2286         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): Deleted.
2287         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
2288         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
2289         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition):
2290         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): Deleted.
2291         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
2292         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollByWithoutContentEdgeConstraints):
2293         * platform/PlatformWheelEvent.h:
2294         (WebCore::PlatformWheelEvent::delta const):
2295         * platform/ScrollTypes.h:
2296
2297 2019-02-22  Eric Liang  <ericliang@apple.com>
2298
2299         AX: Treat AXChildrenInNavigationOrder as AXChildren before adding support for aria-flowto
2300         https://bugs.webkit.org/show_bug.cgi?id=194923
2301
2302         Reviewed by Chris Fleizach.
2303
2304         Added AXChildrenInNavigationOrder attribute that returns the same array as from AXChildren. It prevents AppKit from reordering elements from the fallback AXChildren attribute.
2305
2306         Test: accessibility/mac/children-in-navigation-order-returns-children.html
2307
2308         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2309         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2310
2311 2019-02-22  Tim Horton  <timothy_horton@apple.com>
2312
2313         ProcessSwap.PageOverlayLayerPersistence fails on iOS and in debug builds
2314         https://bugs.webkit.org/show_bug.cgi?id=194963
2315
2316         Reviewed by Dean Jackson.
2317
2318         Tested by existing failing API test.
2319
2320         * page/Page.cpp:
2321         (WebCore::Page::installedPageOverlaysChanged): Deleted.
2322         * page/Page.h:
2323         (WebCore::Page::pageOverlayController):
2324         * page/PageOverlayController.cpp:
2325         (WebCore::PageOverlayController::installedPageOverlaysChanged):
2326         (WebCore::PageOverlayController::detachViewOverlayLayers):
2327         (WebCore::PageOverlayController::installPageOverlay):
2328         (WebCore::PageOverlayController::uninstallPageOverlay):
2329         (WebCore::PageOverlayController::willDetachRootLayer): Deleted.
2330         * page/PageOverlayController.h:
2331         As intended by r240940, move installedPageOverlaysChanged to PageOverlayController.
2332         Also, make it ignore isInWindow state; otherwise, if you install a overlay
2333         and then come into window, nothing installs the root layer. There is no
2334         need for this code to follow in-window state manually anymore since
2335         the DrawingArea and RenderLayerCompositor just hook the layers up when needed.
2336
2337         Make some methods private, and make detachViewOverlayLayers only touch
2338         *view* overlays, so that we don't detach the document-relative root
2339         layer when you drop to having no view overlays. This maintains
2340         existing behavior because nothing was calling PageOverlayController::detachViewOverlayLayers.
2341
2342         Now there are no callers of willDetachRootLayer, so remove it.
2343
2344 2019-02-22  Andy Estes  <aestes@apple.com>
2345
2346         [iOS] Break a reference cycle between PreviewLoader and ResourceLoader
2347         https://bugs.webkit.org/show_bug.cgi?id=194964
2348         <rdar://problem/48279441>
2349
2350         Reviewed by Alex Christensen.
2351
2352         When a document's QuickLook preview is loaded, a reference cycle is created between
2353         PreviewLoader and ResourceLoader. Break the cycle by clearing m_previewLoader in
2354         ResourceLoader::releaseResources().
2355
2356         Fixes leaks detected by `run-webkit-tests --leaks LayoutTests/quicklook`.
2357
2358         * loader/ResourceLoader.cpp:
2359         (WebCore::ResourceLoader::releaseResources):
2360
2361 2019-02-22  Sihui Liu  <sihui_liu@apple.com>
2362
2363         Crash under IDBServer::IDBConnectionToClient::identifier() const
2364         https://bugs.webkit.org/show_bug.cgi?id=194843
2365         <rdar://problem/48203102>
2366
2367         Reviewed by Geoffrey Garen.
2368
2369         UniqueIDBDatabase should ignore requests from connections that are already closed.
2370
2371         Tests are hard to create without some tricks on UniqueIDBDatabase so this fix is verified manually. 
2372         One test is created by adding delay to UniqueIDBDatabase::openBackingStore on the background thread to make sure
2373         disconnection of web process happens before UniqueIDBDatabase::didOpenBackingStore, because didOpenBackingStore
2374         may start a version change transaction and ask for identifier from the connection that is already gone.
2375
2376         * Modules/indexeddb/server/IDBConnectionToClient.cpp:
2377         (WebCore::IDBServer::IDBConnectionToClient::connectionToClientClosed):
2378         * Modules/indexeddb/server/IDBConnectionToClient.h:
2379         (WebCore::IDBServer::IDBConnectionToClient::isClosed):
2380         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2381         (WebCore::IDBServer::UniqueIDBDatabase::clearStalePendingOpenDBRequests):
2382         (WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations):
2383         (WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired):
2384         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2385
2386 2019-02-22  Wenson Hsieh  <wenson_hsieh@apple.com>
2387
2388         Input type "formatSetInlineTextDirection" is dispatched when changing paragraph-level text direction
2389         https://bugs.webkit.org/show_bug.cgi?id=194703
2390         <rdar://problem/48111775>
2391
2392         Reviewed by Ryosuke Niwa.
2393
2394         Currently, when changing text direction, WebKit always sends input events of type formatSetInlineTextDirection,
2395         even when changing paragraph text direction. Instead, we should be emitting formatSetBlockTextDirection in this
2396         scenario. This is problematic when using the context menus on macOS to change writing direction, since changing
2397         "Selection Direction" is currently indistinguishable from changing "Paragraph Direction".
2398
2399         To fix this, we split EditAction::SetWritingDirection into EditAction::SetInlineWritingDirection and
2400         EditAction::SetBlockWritingDirection, which emit inline and block text direction input events, respectively.
2401
2402         Tests: fast/events/before-input-events-prevent-block-text-direction.html
2403                fast/events/before-input-events-prevent-inline-text-direction.html
2404
2405         * editing/CompositeEditCommand.cpp:
2406         (WebCore::CompositeEditCommand::apply):
2407         * editing/EditAction.cpp:
2408         (WebCore::undoRedoLabel):
2409         * editing/EditAction.h:
2410         * editing/EditCommand.cpp:
2411         (WebCore::inputTypeNameForEditingAction):
2412         * editing/Editor.cpp:
2413         (WebCore::inputEventDataForEditingStyleAndAction):
2414         (WebCore::Editor::setBaseWritingDirection):
2415         * editing/EditorCommand.cpp:
2416         (WebCore::executeMakeTextWritingDirectionLeftToRight):
2417         (WebCore::executeMakeTextWritingDirectionNatural):
2418         (WebCore::executeMakeTextWritingDirectionRightToLeft):
2419
2420 2019-02-22  Rob Buis  <rbuis@igalia.com>
2421
2422         Remove stripLeadingAndTrailingWhitespace from MathMLElement.cpp
2423         https://bugs.webkit.org/show_bug.cgi?id=160172
2424
2425         Reviewed by Frédéric Wang.
2426
2427         Remove stripLeadingAndTrailingWhitespace and use stripLeadingAndTrailingHTTPSpaces
2428         from HTTPParsers instead.
2429
2430         No new tests, already covered by MathML tests.
2431
2432         * mathml/MathMLElement.cpp:
2433         (WebCore::MathMLElement::stripLeadingAndTrailingWhitespace): Deleted.
2434         * mathml/MathMLElement.h:
2435         * mathml/MathMLPresentationElement.cpp:
2436         (WebCore::MathMLPresentationElement::parseMathMLLength):
2437         * mathml/MathMLTokenElement.cpp:
2438         (WebCore::MathMLTokenElement::convertToSingleCodePoint):
2439
2440 2019-02-22  Eric Carlson  <eric.carlson@apple.com>
2441
2442         Update some media logging
2443         https://bugs.webkit.org/show_bug.cgi?id=194915
2444
2445         Reviewed by Jer Noble.
2446
2447         No new tests, no functional change.
2448
2449         * Modules/mediasource/SourceBuffer.cpp:
2450         (WebCore::SourceBuffer::evictCodedFrames):
2451         (WebCore::SourceBuffer::provideMediaData):
2452         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
2453
2454         * html/HTMLMediaElement.cpp:
2455         (WebCore::HTMLMediaElement::checkPlaybackTargetCompatablity):
2456         (WebCore::HTMLMediaElement::loadResource):
2457         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
2458         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
2459         (WebCore::HTMLMediaElement::seekTask):
2460         (WebCore::HTMLMediaElement::playInternal):
2461         (WebCore::HTMLMediaElement::pauseInternal):
2462         (WebCore::HTMLMediaElement::setLoop):
2463         (WebCore::HTMLMediaElement::setControls):
2464         (WebCore::HTMLMediaElement::sourceWasRemoved):
2465
2466         * html/MediaElementSession.cpp:
2467         (WebCore::convertEnumerationToString):
2468
2469         * html/MediaElementSession.h:
2470         (WTF::LogArgument<WebCore::MediaPlaybackDenialReason>::toString):
2471
2472         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2473         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
2474
2475 2019-02-22  Rob Buis  <rbuis@igalia.com>
2476
2477         Fix unitless usage of mathsize
2478         https://bugs.webkit.org/show_bug.cgi?id=194940
2479
2480         Reviewed by Frédéric Wang.
2481
2482         Convert unitless lengths to percentage values to correct the computed
2483         font size.
2484
2485         * mathml/MathMLElement.cpp:
2486         (WebCore::convertToPercentageIfNeeded):
2487         (WebCore::MathMLElement::collectStyleForPresentationAttribute):
2488
2489 2019-02-21  Simon Fraser  <simon.fraser@apple.com>
2490
2491         Hardcode Visual Viewports on everywhere except iOS WK1
2492         https://bugs.webkit.org/show_bug.cgi?id=194928
2493
2494         Reviewed by Zalan Bujtas.
2495
2496         Remove the WK1 and WK2 preferences and MiniBrowser menu item for "visual viewports",
2497         change the default value of the Setting to 'true', and hardcode WebView on iOS to
2498         set it to false. The setting has shipped for several years and there's no need to turn
2499         it off now.
2500
2501         Similarly, disable the "Visual Viewport API" on iOS WK1, since it makes no sense if
2502         Visual Viewports are not enabled.
2503         
2504         Remove the "visualViewportEnabled" flag and unused code paths from scrolling tree code
2505         that only runs in WK2
2506
2507         * page/Settings.yaml:
2508         * page/scrolling/AsyncScrollingCoordinator.cpp:
2509         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
2510         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
2511         (WebCore::AsyncScrollingCoordinator::visualViewportEnabled const): Deleted.
2512         * page/scrolling/AsyncScrollingCoordinator.h:
2513         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
2514         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
2515         (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged):
2516         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
2517         (WebCore::ScrollingStateFrameScrollingNode::setVisualViewportEnabled): Deleted.
2518         * page/scrolling/ScrollingStateFrameScrollingNode.h:
2519         * page/scrolling/ScrollingTree.cpp:
2520         (WebCore::ScrollingTree::commitTreeState):
2521         * page/scrolling/ScrollingTree.h:
2522         (WebCore::ScrollingTree::visualViewportEnabled const): Deleted.
2523         (WebCore::ScrollingTree::setVisualViewportEnabled): Deleted.
2524         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
2525         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition const):
2526         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2527         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
2528         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
2529
2530 2019-02-21  Darin Adler  <darin@apple.com>
2531
2532         Some refinements for Node and Document
2533         https://bugs.webkit.org/show_bug.cgi?id=194764
2534
2535         Reviewed by Ryosuke Niwa.
2536
2537         * accessibility/AccessibilityObject.cpp:
2538         (WebCore::AccessibilityObject::press): Use shadowHost instead of
2539         deprecatedShadowAncestorNode.
2540         (WebCore::AccessibilityObject::axObjectCache const): Tweak coding style.
2541         (WebCore::AccessibilityObject::focusedUIElement const): Use existing page
2542         function to streamline.
2543
2544         * accessibility/AccessibilityRenderObject.cpp:
2545         (WebCore::AccessibilityRenderObject::accessKey const): Use
2546         attributeWithoutSynchronization for efficiency and consistency with other
2547         code working with the accesskey attribute.
2548
2549         * dom/ContainerNode.cpp:
2550         (WebCore::ContainerNode::childrenChanged): Added call to
2551         invalidateAccessKeyCache, replacing old scheme tied to style recalculation.
2552
2553         * dom/DecodedDataDocumentParser.cpp:
2554         (WebCore::DecodedDataDocumentParser::appendBytes): Update for name and return
2555         type change of createDecoderIfNeeded to decoder.
2556         (WebCore::DecodedDataDocumentParser::flush): Ditto.
2557
2558         * dom/Document.cpp:
2559         (WebCore::Document::elementForAccessKey): Renamed from getElementForAccessKey
2560         to match WebKit coding style. Changed to use unique_ptr instead of separate
2561         boolean to keep track of map validity status.
2562         (WebCore::Document::buildAccessKeyCache): Renamed from buildAccessKeyMap to
2563         clarify that this is a cache. Changed to use composedTreeDescendants rather
2564         than explicit calls to shadowRoot. Use add instead of set so that first element
2565         in document order wins, instead of last element in document order. Updated
2566         to make a new map in a new unique_ptr instead of populating a map.
2567         (WebCore::Document::invalidateAccessKeyCacheSlowCase): Renamed from
2568         invalidateAccessKeyMap, and left an inline part in the header so the fast case
2569         of quickly checking for a null pointer can be inlined.
2570         (WebCore::Document::doctype const): Use downcast instead of static_cast.
2571         (WebCore::Document::scheduleStyleRecalc): Moved call to invalidateAccessKeyMap
2572         from here to childrenChanged and accesskey attribute change handling.
2573         (WebCore::Document::processFormatDetection): Set m_isTelephoneNumberParsingAllowed
2574         directly since this is the only place that does it and we don't need to factor
2575         that one line of code into a function.
2576         (WebCore::Document::getOverrideStyle): Moved to header since it's just a stub
2577         that always returns nullptr and can be inlined.
2578         (WebCore::Document::setIsTelephoneNumberParsingAllowed): Deleted.
2579         (WebCore::Document::ensureTemplateDocument): Removed nullptr frame argument to
2580         the create function, since Document::create now always involves no frame.
2581         (WebCore::Document::didAssociateFormControl): Changed argument type to a reference
2582         and simplified the logic with a local variable.
2583         (WebCore::Document::didAssociateFormControlsTimerFired): Simplified the null
2584         checks and rearranged things so that m_associatedFormControls will always
2585         get cleared even if the document is no longer associated with a page.
2586
2587         * dom/Document.h: Removed unnnecessary explicit values for enumerations (first
2588         value is always zero, etc.) and formatted simple enumerations in a single line
2589         for easier reading. Moved Document::create fucntion bodies out of line, removed
2590         the frame argument from the simple "create with URL" overload and made the frame
2591         argument for createNonRenderedPlaceholder be a reference rather than a pointer.
2592         Renamed getElementByAccessKey to elementForAccessKey, invalidateAccessKeyMap to
2593         invalidateAccessKeyCache, buildAccessKeyMap to buildAccessKeCache,
2594         m_elementsByAccessKey to m_accessKeyCache and changed its type.
2595         Removed bogus "DOM methods" comment, unused setParserFeature friend declaration,
2596         setIsTelephoneNumberParsingAllowed function, and m_accessKeyMapValid flag.
2597
2598         * dom/Document.idl: Added comment highlighting that getOverrideStyle is just a
2599         placeholder returning null.
2600
2601         * dom/Element.cpp:
2602         (WebCore::Element::attributeChanged): Call invalidateAccessKeyCache when the
2603         value of the accesskey attribute is changed. Also moved the class attribute code
2604         so the attributes here are in alphabetical order (only class and id were out of
2605         alphabetical order).
2606
2607         * dom/Node.cpp:
2608         (WebCore::Node::isDescendantOrShadowDescendantOf const): Rewrote to no longer
2609         use deprecatedShadowAncestorNode and used boolean operators to make it a
2610         single line and easier to understand. Also added a FIXME since the
2611         containsIncludingShadowDOM function is so similar, yet differently written.
2612         (WebCore::Node::contains const): Rewrote as a single line to make this easier
2613         to read and to *slightly* improve the speed in the "this == node" case.
2614         (WebCore::Node::containsIncludingHostElements const): Use downcast.
2615         (WebCore::Node::deprecatedShadowAncestorNode const): Deleted.
2616
2617         * dom/Node.h: Deleted now-unused deprecatedShadowAncestorNode.
2618
2619         * editing/ReplaceSelectionCommand.cpp:
2620         (WebCore::ReplacementFragment::ReplacementFragment): Rewrote to use shadowHost
2621         instead of deprecatedShadowAncestorNode.
2622
2623         * html/FormAssociatedElement.cpp:
2624         (WebCore::FormAssociatedElement::resetFormOwner): Pass reference to
2625         didAssociateFormControl.
2626         (WebCore::FormAssociatedElement::formAttributeChanged): Ditto.
2627
2628         * html/HTMLAreaElement.cpp:
2629         (WebCore::HTMLAreaElement::parseAttribute): Removed special case for accesskey
2630         attribute, because we want to call the base class parseAttribute in that case.
2631
2632         * html/HTMLFormElement.cpp:
2633         (WebCore::HTMLFormElement::insertedIntoAncestor): Pass reference to
2634         didAssociateFormControl.
2635
2636         * html/HTMLSelectElement.cpp:
2637         (WebCore::HTMLSelectElement::parseAttribute): Removed special case for accesskey
2638         attribute with mysterious FIXME, because we want to call the base class
2639         parseAttribute in that case. The old code had no effect before; the access key
2640         logic would still find the attribute; if the goal is to ignore the attribute
2641         for these elements we will need a different solution.
2642         * html/HTMLTextAreaElement.cpp:
2643         (WebCore::HTMLTextAreaElement::parseAttribute): Ditto.
2644
2645         * loader/DocumentLoader.cpp:
2646         (WebCore::DocumentLoader::DocumentLoader): Removed code that was always passing
2647         nullptr as the frame for the newly created DocumentWriter. It used m_frame, but
2648         m_frame was always null.
2649         (WebCore::DocumentLoader::attachToFrame): Pass reference to DocumentWriter::setFrame.
2650
2651         * loader/DocumentWriter.cpp:
2652         (WebCore::DocumentWriter::DocumentWriter): Deleted. The old version set m_frame to
2653         the passed in frame, which was always nullptr, and initialized some booleans and an
2654         enumeration, which are now initialized in the class definition.
2655         (WebCore::DocumentWriter::createDocument): Pass a reference for the frame.
2656         (WebCore::DocumentWriter::begin): Updated now that State is an enum class.
2657         (WebCore::DocumentWriter::decoder): Renamed from createDecoderIfNeeded and changed
2658         to return a reference.
2659         (WebCore::DocumentWriter::addData): Use RELEASE_ASSERT instead of if/CRASH and
2660         updated now that State is an enum class.
2661         (WebCore::DocumentWriter::insertDataSynchronously): Updated now that State is an
2662         enum class.
2663         (WebCore::DocumentWriter::end): Ditto.
2664
2665         * loader/DocumentWriter.h: Removed unneeded include and forward declaration.
2666         Removed the frame pointer argument to the constructor, caller was always passing a
2667         nullptr. Changed argument to setFrame to be a reference. Renamed createDecoderIfNeeded
2668         to decoder and changed it to return a reference. Initialized m_frame,
2669         m_hasReceivedSomeData, m_encodingWasChosenByUser, and m_state here so we don't need
2670         to initialize them in a constructor. Renamed the enum from WriterState to State since
2671         it's a member of DocumentWriter already, and made it an enum class rather than ending
2672         each enumeration value with WritingState.
2673
2674         * page/DragController.cpp:
2675         (WebCore::isEnabledColorInput): Removed boolean argument setToShadowAncestor. The
2676         one caller that formerly passed true now calls the new hasEnabledColorInputAsShadowHost
2677         function instead.
2678         (WebCore::hasEnabledColorInputAsShadowHost): Added.
2679         (WebCore::elementUnderMouse): Use shadowHost instead of deprecatedShadowAncestorNode.
2680         Also added FIXME since it seems this should instead be using parentElementInComposedTree.
2681         (WebCore::DragController::concludeEditDrag): Removed "false" argument to isEnabledColorInput.
2682         (WebCore::DragController::canProcessDrag): Removed "true" argument to isEnabledColorInput
2683         and added call to hasEnabledColorInputAsShadowHost. Also put the value of the node to drag
2684         into a local variable to simplify code.
2685         (WebCore::DragController::draggableElement const): Removed "false" argument to isEnabledColorInput.
2686
2687         * page/EventHandler.cpp:
2688         (WebCore::EventHandler::handleAccessKey): Update name of elementForAccessKey.
2689
2690         * page/FocusController.cpp:
2691         (WebCore::clearSelectionIfNeeded): Use shadowHost instead of deprecatedShadowAncestorNode.
2692
2693         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2694         (WebCore::createPageForServiceWorker): Pass reference instead of pointer for frame to
2695         Document::createNonRenderedPlaceholder.
2696
2697 2019-02-21  Daniel Bates  <dabates@apple.com>
2698
2699         Same Site Lax cookies are not sent with cross-site redirect from client-initiated load
2700         https://bugs.webkit.org/show_bug.cgi?id=194906
2701         <rdar://problem/44305947>
2702
2703         Reviewed by Brent Fulgham.
2704
2705         Ensure that a request for a top-level navigation is annotated as such regardless of whether
2706         the request has a computed Same Site policy.
2707
2708         "New loads" initiated by a the client (Safari) either by API or a human either explicitly
2709         typing a URL in the address bar or Command + clicking a hyperlink to open it in a new window/tab
2710         are always considered Same Site. This is by definition from the spec. [1] as we aren't navigating
2711         from an existing page. (Command + click should be thought of as a convenience to the user from
2712         having to copy the hyperlink's URL, create a new window, and paste the URL into the address bar).
2713         Currently the frame loader marks a request as a top-level navigation if and only if the request
2714         does not have a pre-computed Same Site policy. However, "New loads" have a pre-computed Same Site
2715         policy. So, these loads would never be marked as a top-level navigation by the frame loading code.
2716         Therefore, if the "new load" turned out to be a cross-site redirect then WebKit would incorrectly
2717         tell the networking stack that the load was a cross-site, non-top-level navigation, and per the
2718         Same Site spec [2], the networking stack would not send Same Site Lax cookies. Instead,
2719         WebKit should unconditionally ensure that requests are marked as a top-level navigation, if applicable.
2720
2721         [1] See Note for (1) in  <https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-5.2>
2722         [2] <https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-5.3.7.1>
2723
2724         Test: http/tests/cookies/same-site/user-load-cross-site-redirect.php
2725
2726         * loader/FrameLoader.cpp:
2727         (WebCore::FrameLoader::addExtraFieldsToRequest): Unconditionally update the request's top-
2728         level navigation bit.
2729         * platform/network/ResourceRequestBase.cpp:
2730         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Unconditionally copy a request's top-
2731         level navigation bit.
2732
2733 2019-02-21  Per Arne Vollan  <pvollan@apple.com>
2734
2735         Layout Test fast/text/international/khmer-selection.html is crashing
2736         https://bugs.webkit.org/show_bug.cgi?id=191368
2737
2738         Reviewed by Brent Fulgham.
2739
2740         GlyphBuffer's offset array wasn't getting filled by UniscribeController.
2741         Our underlining code requires this array.
2742
2743         Uniscribe gives us a character -> glyph mapping, so we just have to compute
2744         the inverse and give it to the GlyphBuffer.
2745
2746         This patch is written by Myles C. Maxfield.
2747
2748         Test: fast/text/international/khmer-selection.html.
2749
2750         * platform/graphics/GlyphBuffer.h:
2751         (WebCore::GlyphBuffer::add):
2752         * platform/graphics/displaylists/DisplayListItems.cpp:
2753         (WebCore::DisplayList::DrawGlyphs::generateGlyphBuffer const):
2754         * platform/graphics/win/UniscribeController.cpp:
2755         (WebCore::UniscribeController::advance):
2756         (WebCore::UniscribeController::itemizeShapeAndPlace):
2757         (WebCore::UniscribeController::shapeAndPlaceItem):
2758         * platform/graphics/win/UniscribeController.h:
2759
2760 2019-02-21  Sihui Liu  <sihui_liu@apple.com>
2761
2762         IndexedDB: leak UniqueIDBDatabase in layout tests
2763         https://bugs.webkit.org/show_bug.cgi?id=194870
2764         <rdar://problem/48163812>
2765
2766         Reviewed by Geoffrey Garen.
2767
2768         UniqueIDBDatabase owns a pointer to itself after it is hard closed. It should release the pointer when it 
2769         receives confirmation from clients and all pending tasks are done. UniqueIDBDatabase already checks whether the
2770         pointer should be released when a database task finishes, but it didn't perform a check when a confirm message 
2771         is received. 
2772
2773         No new test as the order of task completion and confirmation arrival is uncertain.
2774
2775         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2776         (WebCore::IDBServer::UniqueIDBDatabase::confirmDidCloseFromServer):
2777
2778 2019-02-21  Andy Estes  <aestes@apple.com>
2779
2780         contentfiltering tests leak documents
2781         https://bugs.webkit.org/show_bug.cgi?id=189434
2782         <rdar://44239943>
2783
2784         Reviewed by Simon Fraser.
2785
2786         Changed ContentFilter to capture the blocked Frame as a WeakPtr to break a reference cycle.
2787
2788         This fixes world leaks in several tests in LayoutTests/contentfiltering/.
2789
2790         * bindings/js/ScriptController.h:
2791         * loader/ContentFilter.cpp:
2792         (WebCore::ContentFilter::didDecide):
2793
2794 2019-02-21  Don Olmstead  <don.olmstead@sony.com>
2795
2796         [CMake][Win] Fix !USE(CF) build of WebCore
2797         https://bugs.webkit.org/show_bug.cgi?id=194879
2798
2799         Reviewed by Konstantin Tokarev.
2800
2801         * PlatformAppleWin.cmake:
2802         * PlatformWin.cmake:
2803         * PlatformWinCairo.cmake:
2804
2805 2019-02-21  Zalan Bujtas  <zalan@apple.com>
2806
2807         [LFC][Floats] Add support for placing formatting roots in-between floats.
2808         https://bugs.webkit.org/show_bug.cgi?id=194902
2809
2810         Reviewed by Antti Koivisto.
2811
2812         This patch add support for placing a formatting root box in-between existing floats.
2813         The initial vertical position of a formatting root is its static position which can make the box
2814         placed above exsiting floats (whereas we can never place a regular float above existing floats.)
2815
2816         Test: fast/block/block-only/floats-and-block-formatting-roots.html
2817
2818         * layout/blockformatting/BlockFormattingContext.cpp:
2819         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
2820         * layout/floats/FloatingContext.cpp:
2821         (WebCore::Layout::FloatPair::LeftRightIndex::isEmpty const):
2822         (WebCore::Layout::FloatPair::isEmpty const):
2823         (WebCore::Layout::FloatPair::operator* const):
2824         (WebCore::Layout::Iterator::operator* const):
2825         (WebCore::Layout::begin):
2826         (WebCore::Layout::end):
2827         (WebCore::Layout::FloatingContext::positionForFloat const):
2828         (WebCore::Layout::FloatingContext::positionForFormattingContextRoot const):
2829         (WebCore::Layout::findAvailablePosition):
2830         (WebCore::Layout::FloatingContext::findPositionForFloatBox const):
2831         (WebCore::Layout::FloatingContext::findPositionForFormattingContextRoot const):
2832         (WebCore::Layout::FloatPair::FloatPair):
2833         (WebCore::Layout::FloatPair::left const):
2834         (WebCore::Layout::FloatPair::right const):
2835         (WebCore::Layout::FloatPair::intersects const):
2836         (WebCore::Layout::FloatPair::operator == const):
2837         (WebCore::Layout::FloatPair::horizontalConstraints const):
2838         (WebCore::Layout::FloatPair::bottom const):
2839         (WebCore::Layout::Iterator::operator++):
2840         (WebCore::Layout::Iterator::set):
2841         (WebCore::Layout::FloatingPair::isEmpty const): Deleted.
2842         (WebCore::Layout::FloatingPair::verticalConstraint const): Deleted.
2843         (WebCore::Layout::FloatingContext::positionForFloatAvoiding const): Deleted.
2844         (WebCore::Layout::FloatingContext::floatingPosition const): Deleted.
2845         (WebCore::Layout::FloatingPair::FloatingPair): Deleted.
2846         (WebCore::Layout::FloatingPair::left const): Deleted.
2847         (WebCore::Layout::FloatingPair::right const): Deleted.
2848         (WebCore::Layout::FloatingPair::intersects const): Deleted.
2849         (WebCore::Layout::FloatingPair::operator == const): Deleted.
2850         (WebCore::Layout::FloatingPair::horizontalConstraints const): Deleted.
2851         (WebCore::Layout::FloatingPair::bottom const): Deleted.
2852         * layout/floats/FloatingContext.h:
2853
2854 2019-02-21  Rob Buis  <rbuis@igalia.com>
2855
2856         Update MIME type parser
2857         https://bugs.webkit.org/show_bug.cgi?id=180526
2858
2859         Reviewed by Darin Adler.
2860
2861         Further testing showed the MIME parser needs these fixes:
2862         - stripWhitespace is wrong for removing HTTP whitespace, use
2863           stripLeadingAndTrailingHTTPSpaces instead.
2864         - HTTP Token code points checking for Rfc2045 and Mimesniff were
2865           mixed up, use the dedicated isValidHTTPToken for Mimesniff mode.
2866         - Quoted Strings were not unescaped/escaped, this seems ok for
2867           serializing but is wrong when gettings individual parameter values.
2868           Implement [1] and [2] Step 2.4 to properly unescape and escape.
2869
2870         This change also tries to avoid hard to read uses of find.
2871
2872         Test: ParsedContentType.Serialize
2873
2874         [1] https://fetch.spec.whatwg.org/#collect-an-http-quoted-string
2875         [2] https://mimesniff.spec.whatwg.org/#serializing-a-mime-type
2876
2877         * platform/network/ParsedContentType.cpp:
2878         (WebCore::skipSpaces):
2879         (WebCore::parseToken):
2880         (WebCore::isNotQuoteOrBackslash):
2881         (WebCore::collectHTTPQuotedString):
2882         (WebCore::containsNonTokenCharacters):
2883         (WebCore::parseQuotedString):
2884         (WebCore::ParsedContentType::parseContentType):
2885         (WebCore::ParsedContentType::create):
2886         (WebCore::ParsedContentType::setContentType):
2887         (WebCore::containsNonQuoteStringTokenCharacters):
2888         (WebCore::ParsedContentType::setContentTypeParameter):
2889         (WebCore::ParsedContentType::serialize const):
2890         (WebCore::substringForRange): Deleted.
2891         (WebCore::isNonTokenCharacter): Deleted.
2892         (WebCore::isNonQuotedStringTokenCharacter): Deleted.
2893         * platform/network/ParsedContentType.h:
2894
2895 2019-02-20  Simon Fraser  <simon.fraser@apple.com>
2896
2897         REGRESSION (240698): Fixed position banners flicker and move when scrolling on iOS
2898         https://bugs.webkit.org/show_bug.cgi?id=194889
2899         rdar://problem/47755552
2900
2901         Reviewed by Tim Horton.
2902         
2903         After r240698 we could commit scrolling changes for a fixed node where the "viewportRectAtLastLayout" and the layer
2904         position were mismatched; this happened when AsyncScrollingCoordinator::reconcileScrollingState() came back from the UI process
2905         with an unstable update and set a new layoutViewport, then some other layout triggered a compositing tree update. During the tree
2906         update, we'd update the fixed scrolling node with the new viewport, and an old layer position.
2907         
2908         Fix by ensuring that we only update the geometry info for a scrolling tree node when we update layer geometry for the corresponding
2909         layer.
2910
2911         Not currently testable.
2912
2913         * rendering/RenderLayerCompositor.cpp:
2914         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
2915
2916 2019-02-20  Dean Jackson  <dino@apple.com>
2917
2918         Rotation animations sometimes use the wrong origin (affects apple.com)
2919         https://bugs.webkit.org/show_bug.cgi?id=194878
2920         <rdar://problem/43908047>
2921
2922         Reviewed by Simon Fraser.
2923
2924         Some versions of CoreAnimation apply additive animations in reverse
2925         order. Detect this and reverse the list of animations we provide.
2926
2927         Update the existing animations/additive-transform-animations.html test to
2928         be a ref-test that would identify this failure. Previously it relied on
2929         a pixel test.
2930
2931         * platform/graphics/ca/GraphicsLayerCA.cpp: Use 
2932             HAVE_CA_WHERE_ADDITIVE_TRANSFORMS_ARE_REVERSED to decide whether or
2933             not to flip the list of animations (and mark the correct ones as
2934             additive).
2935         (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
2936         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
2937
2938 2019-02-20  Don Olmstead  <don.olmstead@sony.com>
2939
2940         [Win] Guard CF usage in RenderThemeWin
2941         https://bugs.webkit.org/show_bug.cgi?id=194875
2942
2943         Reviewed by Alex Christensen.
2944
2945         No new tests. No change in behavior.
2946
2947         Add #if USE(CF) checks to RenderThemeWin so it can compile without CF support.
2948
2949         * rendering/RenderThemeWin.cpp:
2950         (WebCore::RenderThemeWin::stringWithContentsOfFile):
2951         (WebCore::RenderThemeWin::mediaControlsStyleSheet):
2952         (WebCore::RenderThemeWin::mediaControlsScript):
2953         * rendering/RenderThemeWin.h:
2954
2955 2019-02-20  Ryosuke Niwa  <rniwa@webkit.org>
2956
2957         Crash in DOMWindowExtension::suspendForPageCache
2958         https://bugs.webkit.org/show_bug.cgi?id=194871
2959
2960         Reviewed by Chris Dumez.
2961
2962         This is a speculative fix for a crash in DOMWindowExtension::suspendForPageCache.
2963
2964         We think it's possible for DOMWindowExtension::suspendForPageCache notifying the clients via
2965         dispatchWillDisconnectDOMWindowExtensionFromGlobalObject to remove other DOMWindowExtension's.
2966         Check that each DOMWindowProperty is still in m_properties before invoking suspendForPageCache
2967         to avoid the crash.
2968
2969         * page/DOMWindow.cpp:
2970         (WebCore::DOMWindow::willDestroyCachedFrame):
2971         (WebCore::DOMWindow::willDestroyDocumentInFrame):
2972         (WebCore::DOMWindow::willDetachDocumentFromFrame):
2973         (WebCore::DOMWindow::suspendForPageCache):
2974         (WebCore::DOMWindow::resumeFromPageCache):
2975         * page/DOMWindowExtension.cpp:
2976         (WebCore::DOMWindowExtension::suspendForPageCache):
2977
2978 2019-02-20  Alex Christensen  <achristensen@webkit.org>
2979
2980         Always call CompletionHandlers after r240909
2981         https://bugs.webkit.org/show_bug.cgi?id=194823
2982
2983         Reviewed by Ryosuke Niwa.
2984
2985         * loader/PolicyChecker.cpp:
2986         (WebCore::PolicyChecker::checkNavigationPolicy):
2987         (WebCore::PolicyChecker::checkNewWindowPolicy):
2988
2989 2019-02-20  Andy Estes  <aestes@apple.com>
2990
2991         [Xcode] Add SDKVariant.xcconfig to various Xcode projects
2992         https://bugs.webkit.org/show_bug.cgi?id=194869
2993
2994         Rubber-stamped by Jer Noble.
2995
2996         * WebCore.xcodeproj/project.pbxproj:
2997
2998 2019-02-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
2999
3000         drawImage() clears the canvas if it's the source of the image and globalCompositeOperation is "copy"
3001         https://bugs.webkit.org/show_bug.cgi?id=194746
3002
3003         Reviewed by Dean Jackson.
3004
3005         Test: fast/canvas/canvas-drawImage-composite-copy.html
3006
3007         If the source canvas of drawImage() is the same as the destination and
3008         globalCompositeOperation is set to "copy", copy the srcRect from the 
3009         canvas to a temporary buffer before calling clearCanvas() then drawImage
3010         from this temporary buffer.
3011
3012         * html/canvas/CanvasRenderingContext2DBase.cpp:
3013         (WebCore::CanvasRenderingContext2DBase::drawImage):
3014         * platform/graphics/ImageBuffer.cpp:
3015         (WebCore::ImageBuffer::copyRectToBuffer):
3016         * platform/graphics/ImageBuffer.h:
3017
3018 2019-02-20  Simon Fraser  <simon.fraser@apple.com>
3019
3020         REGRESSION (r241788>): ASSERTION FAILED: !m_normalFlowListDirty in TestWebKitAPI.WebKit.ResizeReversePaginatedWebView test
3021         https://bugs.webkit.org/show_bug.cgi?id=194866
3022
3023         Reviewed by Antti Koivisto.
3024
3025         r241788 removed some calls that updated layer lists (normal flow and z-order) during compositing updates, causing
3026         a later call to RenderLayerCompositor::recursiveRepaintLayer() to assert when the lists were dirty. Fix by updating
3027         the lists in RenderLayerCompositor::recursiveRepaintLayer(), as we do in various other places.
3028
3029         * rendering/RenderLayerCompositor.cpp:
3030         (WebCore::RenderLayerCompositor::recursiveRepaintLayer):
3031
3032 2019-02-20  Daniel Bates  <dabates@apple.com>
3033
3034         [iOS] Tweak UI for focus rings
3035         https://bugs.webkit.org/show_bug.cgi?id=194864
3036         <rdar://problem/47831886>
3037
3038         Reviewed by Brent Fulgham.
3039
3040         Make use of UIKit constants to make focus rings pretty.
3041
3042         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
3043         (WebCore::drawFocusRingAtTime):
3044
3045 2019-02-20  Timothy Hatcher  <timothy@apple.com>
3046
3047         RenderThemeIOS should use RenderTheme's color cache instead of its own.
3048         https://bugs.webkit.org/show_bug.cgi?id=194822
3049         rdar://problem/48208296
3050
3051         Reviewed by Tim Horton.
3052
3053         Tested by fast/css/apple-system-colors.html.
3054
3055         * css/CSSValueKeywords.in:
3056         * css/parser/CSSPropertyParser.cpp:
3057         (WebCore::isAppleLegacyCssValueKeyword):
3058         * platform/graphics/Color.h:
3059         * platform/graphics/cg/ColorCG.cpp:
3060         (WebCore::makeRGBAFromCGColor):
3061         (WebCore::Color::Color):
3062         * rendering/RenderThemeIOS.h:
3063         * rendering/RenderThemeIOS.mm:
3064         (WebCore::RenderThemeIOS::systemColor const):
3065         * rendering/RenderThemeMac.mm:
3066         (WebCore::RenderThemeMac::systemColor const):
3067
3068 2019-02-20  Loïc Yhuel  <loic.yhuel@softathome.com>
3069
3070         Fix crash when opening Web Inspector after a WebSocket was blocked by content extensions
3071         https://bugs.webkit.org/show_bug.cgi?id=194819
3072
3073         Reviewed by Joseph Pecoraro.
3074
3075         Test: http/tests/inspector/network/contentextensions/blocked-websocket-crash.html
3076
3077         * Modules/websockets/WebSocketChannel.h:
3078         (WebCore::WebSocketChannel::hasCreatedHandshake):
3079         * inspector/agents/page/PageNetworkAgent.cpp:
3080         Ignore WebSocketChannel without an WebSocketHandshake, which would crash in InspectorNetworkAgent::enable.
3081
3082 2019-02-20  Zalan Bujtas  <zalan@apple.com>
3083
3084         [LFC][Floats] Make FloatAvoider::resetPosition implicit
3085         https://bugs.webkit.org/show_bug.cgi?id=194855
3086
3087         Reviewed by Antti Koivisto.
3088
3089         Let's compute the initial top/left position during c'tor time.
3090         This is in preparation for fixing formatting root box placement in a float context.
3091
3092         * layout/floats/FloatAvoider.cpp:
3093         (WebCore::Layout::FloatAvoider::resetPosition): Deleted.
3094         * layout/floats/FloatAvoider.h:
3095         (WebCore::Layout::FloatAvoider::displayBox):
3096         (WebCore::Layout::FloatAvoider::initialVerticalPosition const): Deleted.
3097         * layout/floats/FloatBox.cpp:
3098         (WebCore::Layout::FloatBox::FloatBox):
3099         (WebCore::Layout::FloatBox::initialVerticalPosition const):
3100         * layout/floats/FloatBox.h:
3101         * layout/floats/FloatingContext.cpp:
3102         (WebCore::Layout::FloatingContext::floatingPosition const):
3103
3104 2019-02-20  Don Olmstead  <don.olmstead@sony.com>
3105
3106         [MSVC] Fix compilation errors with lambdas in Service Workers
3107         https://bugs.webkit.org/show_bug.cgi?id=194841
3108
3109         Reviewed by Alex Christensen.
3110
3111         No new tests. No change in behavior.
3112
3113         MSVC has problems with the scoping of `this` within a nested lambda. In these cases `this` is
3114         referring to the enclosing lambda according to MSVC. This patch works around this behavior
3115         through by using the `protectedThis` pattern in WebKit code.
3116
3117         * workers/service/server/RegistrationDatabase.cpp:
3118         (WebCore::RegistrationDatabase::openSQLiteDatabase):
3119
3120 2019-02-20  Adrian Perez de Castro  <aperez@igalia.com>
3121
3122         [WPE][GTK] Enable support for CONTENT_EXTENSIONS
3123         https://bugs.webkit.org/show_bug.cgi?id=167941
3124
3125         Reviewed by Carlos Garcia Campos.
3126
3127         * platform/gtk/po/POTFILES.in: Added WebKitUserContentFilterStore.cpp
3128         to the list of files with translatable strings.
3129
3130 2019-02-19  Simon Fraser  <simon.fraser@apple.com>
3131
3132         REGRESSION (r238090): Toggling visibility on the <html> element can result in a blank web view
3133         https://bugs.webkit.org/show_bug.cgi?id=194827
3134         rdar://problem/47620594
3135
3136         Reviewed by Antti Koivisto.
3137
3138         Incremental compositing updates, added in rr238090, use repaints as a trigger for re-evaluating
3139         layer configurations, since a repaint implies that a layer gains painted content. This is done
3140         via the call to setNeedsCompositingConfigurationUpdate() in RenderLayerBacking::setContentsNeedDisplay{InRect}.
3141         The RenderView's layer is opted out of this to avoid doing lots of redundant layer config recomputation
3142         for the root. The configuration state that matters here is whether the layer contains painted content,
3143         and therefore needs backing store; this is computed by RenderLayerBacking::isSimpleContainerCompositingLayer(),
3144         and feeds into GraphicsLayer::drawsContent().
3145
3146         However, if <html> starts as "visibility:hidden" or "opacity:0", as some sites do to hide incremental loading,
3147         then we'll fail to recompute 'drawsContent' for the root and leave the root with drawsContent=false, which
3148         causes RenderLayerBacking::setContentsNeedDisplay{InRect} to short-circuit, and then we paint nothing.
3149
3150         Ironically, 'drawsContent' doesn't actually save any backing store for the root, since it has no affect on
3151         the root tile caches; we always make tiles. So the simple fix here is to change RenderLayerBacking::isSimpleContainerCompositingLayer()
3152         to always return false for the RenderView's layer (the root).
3153         
3154         Testing this was tricky; ref testing doesn't work because we force repaint, and we normally skip
3155         properties of the root in layer tree dumps to hide WK1/WK2 differences. Therefore I had to add
3156         LAYER_TREE_INCLUDES_ROOT_LAYER_PROPERTIES and fix RenderLayerBacking::shouldDumpPropertyForLayer to
3157         respect it.
3158
3159         Test: compositing/visibility/root-visibility-toggle.html
3160
3161         * page/Frame.h:
3162         * platform/graphics/GraphicsLayer.cpp:
3163         (WebCore::GraphicsLayer::dumpProperties const):
3164         * platform/graphics/GraphicsLayerClient.h:
3165         (WebCore::GraphicsLayerClient::shouldDumpPropertyForLayer const):
3166         * rendering/RenderLayerBacking.cpp:
3167         (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer const):
3168         (WebCore::RenderLayerBacking::shouldDumpPropertyForLayer const):
3169         * rendering/RenderLayerBacking.h:
3170         * rendering/RenderLayerCompositor.cpp:
3171         (WebCore::RenderLayerCompositor::layerTreeAsText):
3172         * testing/Internals.cpp:
3173         (WebCore::toLayerTreeFlags):
3174         * testing/Internals.h:
3175         * testing/Internals.idl:
3176
3177 2019-02-19  Ryosuke Niwa  <rniwa@webkit.org>
3178
3179         REGRESSION(r240909): Release assertion in FrameLoader::loadPostRequest when opening new window
3180         https://bugs.webkit.org/show_bug.cgi?id=194820
3181
3182         Reviewed by Geoffrey Garen.
3183
3184         This release assertion was wrong. The invocation of PolicyChecker::checkNewWindowPolicy in FrameLoader
3185         doesn’t require PolicyChecker's load type to be set in PolicyChecker because FrameLoader's
3186         continueLoadAfterNewWindowPolicy invokes loadWithNavigationAction which sets the load type later,
3187         and we don't rely on PolicyChecker's load type until then.
3188
3189         Fixed the crash by removing relese asserts before invoking checkNewWindowPolicy accordingly.
3190
3191         This patch reverts r241015 since it too was asserting that PolicyChecker's load type is set before
3192         invoking checkNewWindowPolicy which is not the right assumption.
3193
3194         Test: fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation.html
3195
3196         * loader/FrameLoader.cpp:
3197         (WebCore::FrameLoader::loadURL):
3198         (WebCore::FrameLoader::load):
3199         (WebCore::FrameLoader::loadPostRequest):
3200
3201 2019-02-19  Zalan Bujtas  <zalan@apple.com>
3202
3203         Fix post-commit feedback.
3204
3205         Unreviewed. 
3206
3207         * layout/floats/FloatingContext.cpp:
3208         (WebCore::Layout::FloatingPair::intersects const):
3209
3210 2019-02-19  Zalan Bujtas  <zalan@apple.com>
3211
3212         [LFC][Floats] Remove redundant intersecting logic
3213         https://bugs.webkit.org/show_bug.cgi?id=194804
3214
3215         Reviewed by Antti Koivisto.
3216
3217         floatAvoider.overflowsContainingBlock() check already (and properly) takes care of the far left/right case (see comment).
3218
3219         * layout/floats/FloatingContext.cpp:
3220         (WebCore::Layout::FloatingContext::floatingPosition const):
3221         (WebCore::Layout::FloatingPair::intersects const):
3222
3223 2019-02-19  Commit Queue  <commit-queue@webkit.org>
3224
3225         Unreviewed, rolling out r241722.
3226         https://bugs.webkit.org/show_bug.cgi?id=194801
3227
3228         Causing time outs and EWS failures after expectation file was
3229         added. (Requested by ShawnRoberts on #webkit).
3230
3231         Reverted changeset:
3232
3233         "IndexedDB: leak IDBDatabase and IDBTransacstion in layout
3234         tests"
3235         https://bugs.webkit.org/show_bug.cgi?id=194709
3236         https://trac.webkit.org/changeset/241722
3237
3238 2019-02-16  Darin Adler  <darin@apple.com>
3239
3240         Continue reducing use of String::format, now focusing on hex: "%p", "%x", etc.
3241         https://bugs.webkit.org/show_bug.cgi?id=194752
3242
3243         Reviewed by Daniel Bates.
3244
3245         * Modules/websockets/WebSocket.cpp: Added an include of HexNumber.h. This previously
3246         got included because of Logger.h, but that no longer pulls in HexNumber.h.
3247
3248         * css/CSSMarkup.cpp: Removed unneeded include of StringBuffer.h.
3249         * css/CSSPrimitiveValue.cpp: Ditto.
3250
3251         * css/CSSUnicodeRangeValue.cpp:
3252         (WebCore::CSSUnicodeRangeValue::customCSSText const): Use makeString and hex instead
3253         of String::format and "%x".
3254
3255         * html/HTMLMediaElement.h:
3256         (WTF::ValueToString<WebCore::TextTrackCue::string): Use a non-template function,
3257         TextTrackCure::debugString, so we don't need to use HextNumber.h in a header.
3258
3259         * html/canvas/WebGLRenderingContextBase.cpp:
3260         (GetErrorString): Use makeString and hex instead of String::format and "%04x".
3261
3262         * html/track/TextTrackCue.cpp:
3263         (WebCore::TextTrackCue::debugString const): Added. Moved string conversion here
3264         from HTMLMediaElement.h and use makeString instead of String::format. Also use
3265         the word "debug" to make it clear that it's not OK to use this string, with a
3266         pointer value serialized into it, outside of debugging.
3267         * html/track/TextTrackCue.h: Added TextTrackCue::debugString.
3268
3269         * page/linux/ResourceUsageOverlayLinux.cpp:
3270         (WebCore::formatByteNumber): Use makeString and FormattedNumber::fixedWidth
3271         instead of String::format and "%.1f" etc.
3272
3273         * platform/cocoa/KeyEventCocoa.mm:
3274         (WebCore::keyIdentifierForCharCode): Use the new hex function here instead of
3275         the old code that did each of the four characters explicitly.
3276
3277         * platform/gamepad/mac/HIDGamepad.cpp:
3278         (WebCore::HIDGamepad::HIDGamepad): Use makeString instead of String::format.
3279
3280         * platform/graphics/Color.cpp:
3281         (WebCore::Color::nameForRenderTreeAsText const): Use hex instead of doing each
3282         digit separately.
3283
3284         * platform/graphics/FloatPolygon.cpp:
3285         (WebCore::FloatPolygonEdge::debugString const): Added. Moved string conversion here
3286         from the header and use makeString instead of String::format. Also use
3287         the word "debug" to make it clear that it's not OK to use this string, with a
3288         pointer value serialized into it, outside of debugging.
3289         * platform/graphics/FloatPolygon.h: Updated for the above.
3290
3291         * platform/graphics/ca/GraphicsLayerCA.cpp:
3292         (WebCore::GraphicsLayerCA::setName): Use makeString instead of String::format.
3293         (WebCore::GraphicsLayerCA::recursiveCommitChanges): DItto.
3294         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3295         (WebCore::MediaPlayerPrivateGStreamer::load): Ditto.
3296         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Ditto.
3297         * platform/gtk/PlatformKeyboardEventGtk.cpp:
3298         (WebCore::PlatformKeyboardEvent::keyIdentifierForGdkKeyCode): Ditto.
3299         * platform/libwpe/PlatformKeyboardEventLibWPE.cpp:
3300         (WebCore::PlatformKeyboardEvent::keyIdentifierForWPEKeyCode): Ditto.
3301         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
3302         (WebCore::GStreamerVideoEncoder::makeElement): Ditto.
3303         (WebCore::GStreamerVideoEncoder::InitEncode): Ditto.
3304
3305         * platform/text/TextCodecLatin1.cpp: Removed unneeded include of StringBuffer.h
3306         and "using namespace WTF".
3307
3308         * platform/win/GDIObjectCounter.cpp:
3309         (WebCore::GDIObjectCounter::GDIObjectCounter): Use makeString instead of String::format.
3310         * platform/win/KeyEventWin.cpp:
3311         (WebCore::keyIdentifierForWindowsKeyCode): Ditto.
3312
3313         * rendering/FloatingObjects.cpp:
3314         (WebCore::FloatingObject::debugString const): Added. Moved string conversion here
3315         from the header and use makeString instead of String::format. Also use
3316         the word "debug" to make it clear that it's not OK to use this string, with a
3317         pointer value serialized into it, outside of debugging.
3318         * rendering/FloatingObjects.h: Updated for the above.
3319
3320         * rendering/RenderFragmentContainer.cpp:
3321         (WebCore::RenderFragmentContainer::debugString const): Added. Moved string
3322         conversion here from the header and use makeString instead of String::format.
3323         Also use the word "debug" to make it clear that it's not OK to use this string,
3324         with a pointer value serialized into it, outside of debugging.
3325         * rendering/RenderFragmentContainer.h: Updated for the above.
3326         * rendering/RenderFragmentedFlow.h: Ditto.
3327
3328         * testing/Internals.cpp:
3329         (WebCore::Internals::address): Use makeString instead of String::format.
3330
3331 2019-02-18  Wenson Hsieh  <wenson_hsieh@apple.com>
3332
3333         [iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements
3334         https://bugs.webkit.org/show_bug.cgi?id=194670
3335         <rdar://problem/39066529>
3336
3337         Reviewed by Tim Horton.
3338
3339         Adds support for pasting files on the pasteboard as attachment elements, if the attachment element runtime
3340         switch is enabled. Currently, the only types of data that can be pasted as attachments are images, which take a
3341         special codepath in WebContentReader::readImage.
3342
3343         This patch adds a readDataBuffer method that converts a given blob of data from the pasteboard into an
3344         attachment-element-backed representation in the DOM (i.e. either an attachment element or image element that
3345         contains an attachment element). In the case where the given pasteboard item has been explicitly marked as an
3346         attachment (via the preferredPresentationStyle hint) and the item has at least one type representation that
3347         conforms to "public.content", we take this codepath instead of first attempting the web content reading types
3348         supported by default in WebKit.
3349
3350         See below for more detail.
3351
3352         Test: WKAttachmentTestsIOS.InsertPastedFilesAsAttachments
3353
3354         * editing/Editor.cpp:
3355         (WebCore::Editor::clientReplacementURLForResource): Deleted.
3356         * editing/Editor.h:
3357         * editing/WebContentReader.h:
3358         * editing/cocoa/WebContentReaderCocoa.mm:
3359         (WebCore::mimeTypeFromContentType):
3360         (WebCore::contentTypeIsSuitableForInlineImageRepresentation):
3361         (WebCore::createFragmentAndAddResources):
3362         (WebCore::sanitizeMarkupWithArchive):
3363
3364         Remove all logic for handling subresource URL replacement. See WebKit ChangeLog for more details on this.
3365
3366         (WebCore::WebContentReader::readImage):
3367         (WebCore::attachmentForFilePath):
3368         (WebCore::attachmentForData):
3369
3370         Add a helper that creates an attachment element for a given blob of data and content type. The logic here is
3371         quite similar to that of attachmentForFilePath, and we should find a way to either merge them, or pull out more
3372         of their similarities into helper functions.
3373
3374         (WebCore::WebContentReader::readDataBuffer):
3375         (WebCore::replaceSubresourceURLsWithURLsFromClient): Deleted.
3376
3377         Remove more logic for handling subresource URL replacement. See WebKit ChangeLog for more details on this.
3378
3379         * loader/EmptyClients.cpp:
3380         * page/EditorClient.h:
3381         * platform/Pasteboard.h:
3382         * platform/PasteboardItemInfo.h:
3383         (WebCore::PasteboardItemInfo::contentTypeForHighestFidelityItem const):
3384         (WebCore::PasteboardItemInfo::pathForHighestFidelityItem const):
3385         (WebCore::PasteboardItemInfo::encode const):
3386         (WebCore::PasteboardItemInfo::decode):
3387
3388         Add contentTypesByFidelity to PasteboardItemInfo, instead of requesting this information using a separate IPC
3389         message. This means we can also remove getTypesByFidelityForItemAtIndex, and just use the item's types in
3390         fidelity order instead.
3391
3392         * platform/PasteboardStrategy.h:
3393         * platform/PlatformPasteboard.h:
3394         * platform/ios/AbstractPasteboard.h:
3395         * platform/ios/PasteboardIOS.mm:
3396         (WebCore::Pasteboard::read):
3397
3398         Shave off (potentially many) sync IPC messages to the UI process by pulling each call to
3399         informationForItemAtIndex out of the inner loop when reading web content.
3400
3401         (WebCore::Pasteboard::readRespectingUTIFidelities):
3402
3403         Shave off one extraneous sync IPC message by rolling the types in fidelity order into the request for
3404         PasteboardItemInfo, instead of being sent in a separate message.
3405
3406         * platform/ios/PlatformPasteboardIOS.mm:
3407         (WebCore::PlatformPasteboard::informationForItemAtIndex):
3408
3409         Populate contentTypesForFileUpload in the case where UIPasteboard is used (i.e. copy and paste).
3410
3411         (WebCore::PlatformPasteboard::getTypesByFidelityForItemAtIndex): Deleted.
3412         * platform/ios/WebItemProviderPasteboard.h:
3413         * platform/ios/WebItemProviderPasteboard.mm:
3414         (-[WebItemProviderPasteboard pasteboardTypesByFidelityForItemAtIndex:]): Deleted.
3415
3416 2019-02-18  Daniel Bates  <dabates@apple.com>
3417
3418         Clean up and modernize RenderThemeIOS::paintCheckboxDecorations()
3419         https://bugs.webkit.org/show_bug.cgi?id=194785
3420
3421         Reviewed by Simon Fraser.
3422
3423         Change from early return to else-clause to make the states clearer and make it more straightforward
3424         to share more common code. Use constexpr, allocate temporary vectors with inline capacity, and
3425         switch to uniform initializer syntax.
3426
3427         * rendering/RenderThemeIOS.mm:
3428         (WebCore::RenderThemeIOS::paintCheckboxDecorations):
3429
3430 2019-02-18  Daniel Bates  <dabates@apple.com>
3431
3432         [iOS] Focus ring for checkboxes, radio buttons, buttons and search fields should hug tighter to the contour
3433         https://bugs.webkit.org/show_bug.cgi?id=193599
3434         <rdar://problem/47399602>
3435
3436         Reviewed by Simon Fraser.
3437
3438         For now, iOS uses a 3px outline width for its focus rings. Do not inset the focus ring on iOS
3439         for text fields, textareas, keygens, and selects so as to match the visual appearance of all
3440         the other controls.
3441
3442         Tests: fast/forms/ios/focus-button.html
3443                fast/forms/ios/focus-checkbox.html
3444                fast/forms/ios/focus-checked-checkbox.html
3445                fast/forms/ios/focus-checked-radio.html
3446                fast/forms/ios/focus-radio.html
3447                fast/forms/ios/focus-reset-button.html
3448                fast/forms/ios/focus-search-field.html
3449                fast/forms/ios/focus-submit-button.html
3450                fast/forms/ios/focus-text-field.html
3451                fast/forms/ios/focus-textarea.html
3452
3453         * css/html.css:
3454         (:focus): Use 3px outline width.
3455         (input:focus, textarea:focus, keygen:focus, select:focus): Guard this code to exclude it when building for iOS.
3456         * rendering/RenderBox.cpp:
3457         (WebCore::RenderBox::paintBoxDecorations): Add FIXME comment.
3458         * rendering/RenderElement.cpp:
3459         (WebCore::RenderElement::paintOutline): Call RenderTheme::adjustPaintRect() to adjust the paint rect.
3460         Otherwise, the focus rings for radios and checkboxes are drawn at the wrong y-coordinate and are not snug.
3461
3462 2019-02-18  Oriol Brufau  <obrufau@igalia.com>
3463
3464         [css-grid] Handle indefinite percentages in fit-content()
3465         https://bugs.webkit.org/show_bug.cgi?id=194509
3466
3467         Reviewed by Javier Fernandez.
3468
3469         Test: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-fit-content-percentage.html
3470
3471         If the size of the grid container depends on the size of its tracks,
3472         a percentage in fit-content() is indefinite. Without this patch, some
3473         places treated this case as fit-content(0), which prevented the grid
3474         container from growing enough to contain the max-content contribution
3475         of its grid items.
3476
3477         This patch treats such fit-content() as minmax(auto, max-content),
3478         but once the size of the grid container is known and it is laid out
3479         "for real", then the percentage is definite and it's used.
3480
3481         * rendering/GridTrackSizingAlgorithm.cpp:
3482         (WebCore::GridTrackSizingAlgorithm::gridTrackSize const):
3483         (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):
3484
3485 2019-02-18  John Wilander  <wilander@apple.com>
3486
3487         Check the existence of the frame in Document::hasFrameSpecificStorageAccess() and Document::setHasFrameSpecificStorageAccess()
3488         https://bugs.webkit.org/show_bug.cgi?id=194777
3489         <rdar://problem/47731945>
3490
3491         Reviewed by Geoffrey Garen and Chris Dumez.
3492
3493         Test: http/tests/storageAccess/remove-requesting-iframe.html
3494
3495         * dom/Document.cpp:
3496         (WebCore::Document::hasFrameSpecificStorageAccess const):
3497             Now checks for the existence of the frame.
3498         (WebCore::Document::setHasFrameSpecificStorageAccess):
3499             Now checks for the existence of the frame.
3500         * loader/ResourceLoadObserver.cpp:
3501         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3502             Now checks that the session ID is valid.
3503
3504 2019-02-18  Jer Noble  <jer.noble@apple.com>
3505
3506         -[AVSampleBufferDisplayLayer player]: Unrecognized selector crash
3507         https://bugs.webkit.org/show_bug.cgi?id=194790
3508         <rdar://problem/33866742>
3509
3510         Reviewed by Jon Lee.
3511
3512         Ensure that a WebVideoContainerLayer's sole sublayer is actually an AVPlayerLayer (and not
3513         an AVSampleBufferDisplayLayer) before reporting that the layer type is LayerTypeAVPlayerLayer.
3514
3515         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
3516         (WebCore::PlatformCALayerCocoa::layerTypeForPlatformLayer):
3517
3518 2019-02-18  Joseph Pecoraro  <pecoraro@apple.com>
3519
3520         Web Inspector: Better categorize CPU usage per-thread / worker
3521         https://bugs.webkit.org/show_bug.cgi?id=194564
3522
3523         Reviewed by Devin Rousso.
3524
3525         Test: inspector/cpu-profiler/threads.html
3526
3527         * workers/WorkerThread.cpp:
3528         (WebCore::WorkerThread::workerThreadsMutex):
3529         (WebCore::WorkerThread::workerThreadCount):
3530         (WebCore::WorkerThread::WorkerThread):
3531         (WebCore::WorkerThread::~WorkerThread):
3532         (WebCore::WorkerThread::workerThread):
3533         (WebCore::WorkerThread::releaseFastMallocFreeMemoryInAllThreads):
3534         * workers/WorkerThread.h:
3535         (WebCore::WorkerThread::identifier const):
3536         Expose the set of all WorkerThreads.
3537
3538         * inspector/agents/InspectorCPUProfilerAgent.cpp:
3539         (WebCore::InspectorCPUProfilerAgent::collectSample):
3540         Send inspector additional per-thread data.
3541
3542         * page/ResourceUsageData.h:
3543         (WebCore::WorkerCPUInfo::WorkerCPUInfo):
3544         * page/cocoa/ResourceUsageThreadCocoa.mm:
3545         (WebCore::ThreadInfo::ThreadInfo):
3546         (WebCore::threadInfos):
3547         (WebCore::ResourceUsageThread::platformCollectCPUData):
3548         (WebCore::threadSendRights): Deleted.
3549         (WebCore::cpuUsage): Deleted.
3550         Compute per-thread values on cocoa ports.
3551
3552         * page/linux/ResourceUsageThreadLinux.cpp:
3553         (WebCore::ResourceUsageThread::platformCollectCPUData):
3554         Stub per-thread values on linux ports.
3555
3556 2019-02-18  Jer Noble  <jer.noble@apple.com>
3557
3558         Uncaught Exception crash in MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeControlStatus()
3559         https://bugs.webkit.org/show_bug.cgi?id=194786
3560
3561         Reviewed by Eric Carlson.
3562
3563         Convert a runtime crash to a debug assert by wrapping the call to -[AVPlayer removeObserver:forKeyPath:]
3564         in an exception handler.
3565
3566         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3567         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeControlStatus):
3568
3569 2019-02-18  Daniel Bates  <dabates@apple.com>
3570
3571         [iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element
3572         https://bugs.webkit.org/show_bug.cgi?id=192824
3573         <rdar://problem/47100332>
3574
3575         Reviewed by Wenson Hsieh.
3576
3577         When building with USE(UIKIT_KEYBOARD_ADDITIONS) enabled, normalize input strings for some more key codes
3578         now that hardware key events to non-editable elements use the same code path as for editable elements. 
3579
3580         * platform/ios/KeyEventIOS.mm:
3581         (WebCore::windowsKeyCodeForCharCode): Demarcate mappings that are only needed when building with
3582         !USE(UIKIT_KEYBOARD_ADDITIONS) in the hope that one day we can remove this code.
3583         (WebCore::isFunctionKey): Ditto.
3584         * platform/ios/WebEvent.mm:
3585         (normalizedStringWithAppKitCompatibilityMapping): Normalize some more input strings when building with
3586         USE(UIKIT_KEYBOARD_ADDITIONS) enabled.
3587
3588 2019-02-18  Eric Carlson  <eric.carlson@apple.com>
3589
3590         Add MSE logging configuration
3591         https://bugs.webkit.org/show_bug.cgi?id=194719
3592         <rdar://problem/48122151>
3593
3594         Reviewed by Joseph Pecoraro.
3595
3596         No new tests, updated inspector/console/webcore-logging.html.
3597
3598         * dom/Document.cpp:
3599         (WebCore::messageSourceForWTFLogChannel): Recognize the MSE logging channel.
3600
3601         * inspector/agents/WebConsoleAgent.cpp:
3602         (WebCore::WebConsoleAgent::getLoggingChannels): Ditto.
3603
3604 2019-02-18  Antoine Quint  <graouts@apple.com>
3605
3606         [iOS] Dispatch additional events along with pointerdown and pointerup
3607         https://bugs.webkit.org/show_bug.cgi?id=194776
3608         <rdar://problem/48164284>
3609
3610         Reviewed by Brent Fulgham.
3611
3612         The Pointer Events specification mandates that "pointerover" and "pointerenter" events precede a "pointerdown" event and that "pointerout"
3613         and "pointerleave" events follow a "pointerup" event. We remove the EventHandler::dispatchPointerEventForTouchAtIndex() method and replace
3614         it with a PointerCaptureController::dispatchEventForTouchAtIndex() that can handle the dispatch of such additional events correctly, also
3615         allowing for two PointerCaptureController methods (pointerEventWillBeDispatched and pointerEventWasDispatched) to become private.
3616
3617         Test: pointerevents/ios/over-enter-out-leave.html
3618
3619         * dom/EventNames.h: Add the new "pointerover", "pointerenter", "pointerout" and "pointerleave" event types.
3620         * dom/PointerEvent.h:
3621         * dom/ios/PointerEventIOS.cpp:
3622         (WebCore::PointerEvent::create):
3623         * page/EventHandler.cpp:
3624         (WebCore::EventHandler::dispatchPointerEventForTouchAtIndex): Deleted.
3625         * page/EventHandler.h:
3626         * page/PointerCaptureController.cpp:
3627         (WebCore::PointerCaptureController::dispatchEventForTouchAtIndex): Take the existing code from EventHandler::dispatchPointerEventForTouchAtIndex()
3628         and extend it to dispatch additional events as mandated. Since several events may be dispatched we check whether the dispatch of any of those events
3629         had defaultPrevented() or defaultHanded() return true and return those values as a pair.
3630         (WebCore::PointerCaptureController::pointerEventWasDispatched):
3631         * page/PointerCaptureController.h:
3632
3633 2019-02-18  Sihui Liu  <sihui_liu@apple.com>
3634
3635         IndexedDB: leak IDBDatabase and IDBTransacstion in layout tests
3636         https://bugs.webkit.org/show_bug.cgi?id=194709
3637
3638         Reviewed by Geoffrey Garen.
3639
3640         When connection to IDB server is closed, IDBTransaction would abort without notifying IDBDatabase, so 
3641         IDBDatabase didn't clear its reference to IDBTransaction which created a reference cycle. 
3642
3643         Also IDBTransaction didn't clear its reference to IDBRequest in this case and it led to another reference cycle
3644         between IDBOpenDBRequest and IDBTransaction.
3645
3646         Test: storage/indexeddb/IDBObject-leak.html
3647
3648         * Modules/indexeddb/IDBDatabase.cpp:
3649         (WebCore::IDBDatabase::connectionToServerLost):
3650         * Modules/indexeddb/IDBTransaction.cpp:
3651         (WebCore::IDBTransaction::IDBTransaction):
3652         (WebCore::IDBTransaction::~IDBTransaction):
3653         (WebCore::IDBTransaction::finishedDispatchEventForRequest):
3654         (WebCore::IDBTransaction::connectionClosedFromServer):
3655         * Modules/indexeddb/IDBTransaction.h:
3656         * testing/Internals.cpp:
3657         (WebCore::Internals::numberOfIDBTransactions const):
3658         * testing/Internals.h:
3659         * testing/Internals.idl:
3660
3661 2019-02-18  Chris Fleizach  <cfleizach@apple.com>
3662
3663         AX: PSON: Going back from apple.com to search results, cannot interact with HTML content. Disabling Swap Processes on Cross-Site Navigation resolves the issue.
3664         https://bugs.webkit.org/show_bug.cgi?id=194742
3665
3666         Reviewed by Chris Dumez.
3667
3668         With the new process model, WebProcess hits a case where it tries to send the "page loaded" notification before VoiceOver
3669         had a chance to register for any notifications. This leads to those notifications being dropped (and thus this bug).
3670
3671         This change instead asks the UIProcess to send the notification, which we know VoiceOver has registered for, and can reliably
3672         receive notifications.
3673
3674         It also sends the notification for "load failures," which to the VO users' perspective amounts to the same thing as a successful
3675         page load.
3676
3677         * accessibility/mac/AXObjectCacheMac.mm:
3678         (WebCore::AXObjectCache::frameLoadingEventPlatformNotification):
3679
3680 2019-02-18  Megan Gardner  <megan_gardner@apple.com>
3681
3682         Turn On Smart Delete
3683         https://bugs.webkit.org/show_bug.cgi?id=194320
3684
3685         Reviewed by Ryosuke Niwa.
3686
3687         Updated the following tests to work with iOS:
3688         * editing/deleting/smart-delete-001.html:
3689         * editing/deleting/smart-delete-002.html:
3690         * editing/deleting/smart-delete-003.html:
3691         * editing/deleting/smart-delete-004.html:
3692         * editing/deleting/smart-delete-across-editable-boundaries-2.html:
3693         * editing/selection/delete-word-granularity-text-control.html:
3694
3695         Turn on Smart delete for iOS at all times. Modify checks to allow Mac and iOS and other 
3696         platforms to turn on smart delete when desired.
3697
3698         * editing/Editor.cpp:
3699         (WebCore::Editor::shouldSmartDelete):
3700         Allow platfroms to determine if smart delete should be on.
3701         On mac, this is via word granularity, on iOS this is just on all the time.
3702         (WebCore::Editor::canSmartCopyOrDelete):
3703         (WebCore::Editor::performCutOrCopy):
3704         * editing/Editor.h:
3705         * editing/EditorCommand.cpp:
3706         (WebCore::executeDelete):
3707         * editing/ios/EditorIOS.mm:
3708         (WebCore::Editor::shouldSmartDelete):
3709         * editing/mac/EditorMac.mm:
3710         (WebCore::Editor::shouldSmartDelete):
3711
3712 2019-02-17  David Kilzer  <ddkilzer@apple.com>
3713
3714         Unreviewed, rolling out r241620.
3715
3716         "Causes use-after-free crashes running layout tests with ASan and GuardMalloc."
3717         (Requested by ddkilzer on #webkit.)
3718
3719         Reverted changeset:
3720
3721         "[WTF] Add environment variable helpers"
3722         https://bugs.webkit.org/show_bug.cgi?id=192405
3723         https://trac.webkit.org/changeset/241620
3724
3725 2019-02-16  Zalan Bujtas  <zalan@apple.com>
3726
3727         [LFC] RenderImage's default intrinsic size is 0.
3728         https://bugs.webkit.org/show_bug.cgi?id=194745
3729
3730         Reviewed by Antti Koivisto.
3731
3732         While the images are being loaded, their intrinsic size is set to 0 (RenderImage c'tor). Note that this code is temporary.
3733         * layout/layouttree/LayoutTreeBuilder.cpp:
3734         (WebCore::Layout::TreeBuilder::createSubTree):
3735
3736 2019-02-16  Zalan Bujtas  <zalan@apple.com>
3737
3738         [LFC][BFC] Add support for block replaced intrinsic width.
3739         https://bugs.webkit.org/show_bug.cgi?id=194705
3740
3741         Reviewed by Simon Fraser.
3742
3743         Replaced boxes should report their intrinsic width as preferred widths.
3744
3745         Test: fast/block/block-only/replaced-intrinsic-width-simple.html
3746
3747         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3748         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
3749
3750 2019-02-16  Zalan Bujtas  <zalan@apple.com>
3751
3752         [LFC] Apply min/max width constraints to preferred width computation
3753         https://bugs.webkit.org/show_bug.cgi?id=194739
3754
3755         Reviewed by Simon Fraser.
3756
3757         Ensure that both min-height and max-height are taken into account while computing the preferred width.
3758
3759         Test: fast/block/block-only/min-max-and-preferred-width-simple.html
3760
3761         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3762         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
3763
3764 2019-02-15  Yusuke Suzuki  <ysuzuki@apple.com>
3765
3766         [JSC] Make builtin objects more lazily initialized under non-JIT mode
3767         https://bugs.webkit.org/show_bug.cgi?id=194727
3768
3769         Reviewed by Saam Barati.
3770
3771         * Modules/streams/ReadableByteStreamInternals.js:
3772         (privateInitializeReadableByteStreamController):
3773         (readableByteStreamControllerRespond):
3774
3775 2019-02-15  Dean Jackson  <dino@apple.com>
3776
3777         Allow emulation of user gestures from Web Inspector console
3778         https://bugs.webkit.org/show_bug.cgi?id=194725
3779         <rdar://problem/48126604>
3780
3781         Reviewed by Joseph Pecoraro and Devin Rousso.
3782
3783         Test: inspector/runtime/evaluate-userGestureEmulation.html
3784
3785         * inspector/agents/page/PageRuntimeAgent.cpp: Override the emulate method and create
3786         a UserGestureIndicator based on the emulateUserGesture option.
3787         (WebCore::PageRuntimeAgent::evaluate):
3788         * inspector/agents/page/PageRuntimeAgent.h:
3789
3790 2019-02-15  Chris Dumez  <cdumez@apple.com>
3791
3792         Sample domainsVisited diagnostic logging
3793         https://bugs.webkit.org/show_bug.cgi?id=194657
3794
3795         Reviewed by Ryosuke Niwa.
3796
3797         Sample domainsVisited diagnostic logging, we are getting a lot of data from
3798         this key and this is hurting our other keys.
3799
3800         * page/Page.cpp:
3801         (WebCore::Page::logNavigation):
3802
3803 2019-02-15  Ryosuke Niwa  <rniwa@webkit.org>
3804
3805         Crash in the hit testing code via HTMLPlugInElement::isReplacementObscured()
3806         https://bugs.webkit.org/show_bug.cgi?id=194691
3807
3808         Reviewed by Simon Fraser.
3809
3810         The crash was caused by HTMLPlugInElement::isReplacementObscured updating the document
3811         without updating the layout of ancestor documents (i.e. documents in which frame owner
3812         elements appear) even though it hit-tests against the top-level document's RenderView.
3813
3814         Fixed the bug by updating the layout of the top-level document as needed.
3815
3816         Test: plugins/unsupported-plugin-with-replacement-in-iframe-crash.html
3817
3818         * html/HTMLPlugInElement.cpp:
3819         (WebCore::HTMLPlugInElement::isReplacementObscured):
3820
3821 2019-02-15  Ross Kirsling  <ross.kirsling@sony.com>
3822
3823         [WTF] Add environment variable helpers
3824         https://bugs.webkit.org/show_bug.cgi?id=192405
3825
3826         Reviewed by Michael Catanzaro.
3827
3828         * platform/NotImplemented.h:
3829         * platform/cocoa/SystemVersion.mm:
3830         (WebCore::createSystemMarketingVersion):
3831         * platform/graphics/gstreamer/GStreamerCommon.cpp:
3832         (WebCore::initializeGStreamer):
3833         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3834         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
3835         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
3836         (Nicosia::PaintingEngine::create):
3837         * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
3838         (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
3839         * platform/graphics/x11/PlatformDisplayX11.cpp:
3840         (WebCore::PlatformDisplayX11::create):
3841         * platform/gtk/RenderThemeWidget.cpp:
3842         (WebCore::RenderThemeScrollbar::RenderThemeScrollbar):
3843         * platform/gtk/ScrollbarThemeGtk.cpp:
3844         (WebCore::ScrollbarThemeGtk::ScrollbarThemeGtk):
3845         * platform/network/curl/CurlContext.cpp:
3846         (WebCore::CurlContext::CurlContext):
3847         (WebCore::EnvironmentVariableReader::read): Deleted.
3848         (WebCore::EnvironmentVariableReader::defined): Deleted.
3849         (WebCore::EnvironmentVariableReader::readAs): Deleted.
3850         (WebCore::EnvironmentVariableReader::sscanTemplate): Deleted.
3851         (WebCore::EnvironmentVariableReader::sscanTemplate<signed>): Deleted.
3852         (WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>): Deleted.
3853         * platform/network/curl/NetworkStorageSessionCurl.cpp:
3854         (WebCore::defaultCookieJarPath):
3855         * platform/network/playstation/CurlSSLHandlePlayStation.cpp:
3856         (WebCore::getCACertPathEnv):
3857         * platform/network/win/CurlSSLHandleWin.cpp:
3858         (WebCore::getCACertPathEnv):
3859         * platform/text/hyphen/HyphenationLibHyphen.cpp:
3860         (WebCore::topLevelPath):
3861         (WebCore::webkitBuildDirectory):
3862         * platform/unix/LoggingUnix.cpp:
3863         (WebCore::logLevelString):
3864         * platform/win/LoggingWin.cpp:
3865         (WebCore::logLevelString):
3866         Utilize WTF::Environment where possible.
3867
3868 2019-02-15  Antoine Quint  <graouts@apple.com>
3869
3870         Add a method to dispatch a PointerEvent based on a PlatformTouchEvent
3871         https://bugs.webkit.org/show_bug.cgi?id=194702
3872         <rdar://problem/48109355>
3873
3874         Reviewed by Dean Jackson.
3875
3876         * page/EventHandler.cpp:
3877         (WebCore::EventHandler::dispatchPointerEventForTouchAtIndex):
3878         * page/EventHandler.h:
3879
3880 2019-02-15  Per Arne Vollan  <pvollan@apple.com>
3881
3882         [WebVTT] Inline WebVTT styles should start with '::cue'
3883         https://bugs.webkit.org/show_bug.cgi?id=194227
3884
3885         Reviewed by Eric Carlson.
3886
3887         The original fix in r241203 is not sufficient, since it only checks if the CSS string starts
3888         with '::cue'. Before accepting a CSS string from a WebVTT file, it should be checked that
3889         all selectors starts with '::cue'.
3890
3891         Test: media/track/track-cue-css.html
3892
3893         * html/track/WebVTTParser.cpp:
3894         (WebCore::WebVTTParser::checkAndStoreStyleSheet):
3895
3896 2019-02-15  Youenn Fablet  <youenn@apple.com>
3897
3898         Add binding tests for ContextAllowsMediaDevices and ContextHasServiceWorkerScheme
3899         https://bugs.webkit.org/show_bug.cgi?id=194713
3900
3901         Reviewed by Eric Carlson.
3902
3903         Binding tests covering mediaDevices and serviceWorker attributes.
3904
3905         * bindings/scripts/test/JS/JSTestObj.cpp:
3906         (WebCore::JSTestObjPrototype::finishCreation):
3907         (WebCore::jsTestObjMediaDevices1Getter):
3908         (WebCore::jsTestObjMediaDevices1):
3909         (WebCore::jsTestObjMediaDevices2Getter):
3910         (WebCore::jsTestObjMediaDevices2):
3911         (WebCore::jsTestObjServiceWorkers1Getter):
3912         (WebCore::jsTestObjServiceWorkers1):
3913         (WebCore::jsTestObjServiceWorkers2Getter):
3914         (WebCore::jsTestObjServiceWorkers2):
3915         * bindings/scripts/test/TestObj.idl:
3916
3917 2019-02-15  Beth Dakin  <bdakin@apple.com>
3918
3919         Build fix.
3920
3921         * rendering/RenderThemeIOS.mm:
3922         (WebCore::iconForAttachment):
3923
3924 2019-02-15  Youenn Fablet  <youenn@apple.com>
3925
3926         Make ServiceWorkerClientFetch closer to WebResourceLoader
3927         https://bugs.webkit.org/show_bug.cgi?id=194651
3928
3929         Reviewed by Alex Christensen.
3930
3931         Check for redirection response and if so call a specific client API.
3932         Ensure ServiceWorkerFetch::Client gets called in the service worker thread proxy
3933         so that its m_connection is only accessed on that thread.
3934
3935         Covered by existing tests.
3936
3937         * platform/network/FormData.h:
3938         * platform/network/ResourceErrorBase.h:
3939         * workers/service/context/ServiceWorkerFetch.cpp:
3940         (WebCore::ServiceWorkerFetch::processResponse):
3941         * workers/service/context/ServiceWorkerFetch.h:
3942         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3943         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
3944         (WebCore::ServiceWorkerThreadProxy::continueDidReceiveFetchResponse):
3945         * workers/service/context/ServiceWorkerThreadProxy.h:
3946
3947 2019-02-15  Youenn Fablet  <youenn@apple.com>
3948
3949         Make navigator.mediaDevices SecureContext
3950         https://bugs.webkit.org/show_bug.cgi?id=194666
3951
3952         Reviewed by E