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