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