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