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