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