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