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