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