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