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