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