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