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