Newly added float should trigger full layout on the block.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-07-12  Zalan Bujtas  <zalan@apple.com>
2
3         Newly added float should trigger full layout on the block.
4         https://bugs.webkit.org/show_bug.cgi?id=187251
5         <rdar://problem/41726137>
6
7         Reviewed by David Kilzer.
8
9         RenderBlockFlow::determineStartPosition() is one of the places where we decide the extent of the line layout for the current block.
10         In here we try to figure out the first line in the block that requires layout. In certain cases when floats are present,
11         (due to their intrusive behavior) we just trigger a full layout on the entire block.
12         One of the special cases is when a new float is added to the block. determineStartPosition() checks for such floats (floats inserted
13         after the "last known float") and marks the block for full layout. However it missed the case when other, unrelated mutations happened
14         in addition to this newly inserted float. This patch fixes this case by checking if the floats after the "last know float" actually need layout.
15
16         Test: fast/inline/new-float-needs-layout-when-line-is-dirty.html
17
18         * rendering/RenderBlockLineLayout.cpp:
19         (WebCore::RenderBlockFlow::determineStartPosition):
20
21 2018-07-12  Thibault Saunier  <tsaunier@igalia.com>
22
23         [GStreamer] Add pads to the GstFlowCombiner in MediaStreamSrc
24         https://bugs.webkit.org/show_bug.cgi?id=187552
25
26         Reviewed by Alejandro G. Castro.
27
28         This was overlooked and it is the way the API is supposed to be used.
29
30         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
31         (WebCore::webkitMediaStreamSrcAddPad):
32
33 2018-07-12  Yusuke Suzuki  <utatane.tea@gmail.com>
34
35         [JSC] Thread VM& to JSCell::methodTable(VM&)
36         https://bugs.webkit.org/show_bug.cgi?id=187548
37
38         Reviewed by Saam Barati.
39
40         * bindings/js/JSDOMConstructorBase.h:
41         (WebCore::JSDOMConstructorBase::className):
42         * bindings/js/JSPluginElementFunctions.cpp:
43         (WebCore::pluginElementCustomGetCallData):
44         * bindings/scripts/CodeGeneratorJS.pm:
45         (GenerateHeader):
46         (GenerateImplementation):
47         * bindings/scripts/test/JS/JSInterfaceName.cpp:
48         (WebCore::JSInterfaceName::estimatedSize):
49         * bindings/scripts/test/JS/JSInterfaceName.h:
50
51 2018-07-11  Youenn Fablet  <youenn@apple.com>
52
53         MediaDevices should derive from EventTarget in its IDL
54         https://bugs.webkit.org/show_bug.cgi?id=187575
55
56         Reviewed by Chris Dumez.
57
58         Test: fast/mediastream/MediaDevices-addEventListener.html
59
60         * Modules/mediastream/MediaDevices.idl:
61
62 2018-07-11  Jon Lee  <jonlee@apple.com>
63
64         Update iOS fullscreen alert text
65         https://bugs.webkit.org/show_bug.cgi?id=187576
66         rdar://problem/42052284
67
68         Reviewed by Ryosuke Niwa.
69
70         * English.lproj/Localizable.strings:
71
72 2018-07-11  Commit Queue  <commit-queue@webkit.org>
73
74         Unreviewed, rolling out r233742.
75         https://bugs.webkit.org/show_bug.cgi?id=187577
76
77         Binary incompatible change with respect to Service Worker
78         registration map (Requested by dydz on #webkit).
79
80         Reverted changeset:
81
82         "Reduce size of WebCore::URL"
83         https://bugs.webkit.org/show_bug.cgi?id=186820
84         https://trac.webkit.org/changeset/233742
85
86 2018-07-11  Aditya Keerthi  <akeerthi@apple.com>
87
88         REGRESSION (231276): Attempting to copy an image fails
89         https://bugs.webkit.org/show_bug.cgi?id=187212
90         <rdar://problem/41540074>
91
92         Reviewed by Ryosuke Niwa.
93
94         Renamed methods to make it clear that one URL and one title are being passed in.
95
96         Test: editing/mac/pasteboard/can-copy-url-without-title.html
97
98         * platform/PasteboardStrategy.h:
99         * platform/PlatformPasteboard.h:
100         * platform/ios/PlatformPasteboardIOS.mm:
101         (WebCore::PlatformPasteboard::setURL):
102         * platform/mac/PasteboardMac.mm:
103         (WebCore::writeURLForTypes):
104         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
105         * platform/mac/PlatformPasteboardMac.mm:
106         (WebCore::PlatformPasteboard::setURL):
107
108 2018-07-11  Alex Christensen  <achristensen@webkit.org>
109
110         Add SPI for immediate injection of user scripts
111         https://bugs.webkit.org/show_bug.cgi?id=173342
112         <rdar://problem/29202285>
113
114         Reviewed by Brady Eidson, Youenn Fablet, and Geoff Garen.
115
116         The new SPI is WKUserContentController._addUserScriptImmediately.
117         It is covered by new API tests.
118         Existing functionality remains unchanged unless the new SPI is adopted.
119
120         * page/Frame.cpp:
121         (WebCore::Frame::injectUserScripts):
122         (WebCore::Frame::injectUserScriptImmediately):
123         Move injection functionality to allow us to call it directly from the new SPI.
124         * page/Frame.h:
125         * page/Page.cpp:
126         (WebCore::Page::forEachPage):
127         * page/Page.h:
128
129 2018-07-11  Alex Christensen  <achristensen@webkit.org>
130
131         Reduce size of WebCore::URL
132         https://bugs.webkit.org/show_bug.cgi?id=186820
133
134         Reviewed by Yusuke Suzuki.
135
136         We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive
137         because port numbers are missing or between 0 and 65535.  Let's just use 3 bits here.
138         We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be
139         longer for some custom schemes, but I've never seen one more than 20 characters.  If we assume
140         schemes are always less than 64MB, we can save 8 bytes per URL!
141
142         No change in behavior, just less memory use!
143
144         * platform/URL.cpp:
145         (WebCore::URL::invalidate):
146         (WebCore::URL::lastPathComponent const):
147         (WebCore::URL::port const):
148         (WebCore::URL::protocolHostAndPort const):
149         (WebCore::URL::path const):
150         (WebCore::URL::removePort):
151         (WebCore::URL::setPort):
152         (WebCore::URL::setHostAndPort):
153         (WebCore::URL::setPath):
154         * platform/URL.h:
155         (WebCore::URL::encode const):
156         (WebCore::URL::decode):
157         (WebCore::URL::hasPath const):
158         (WebCore::URL::pathStart const):
159         * platform/URLParser.cpp:
160         (WebCore::URLParser::copyBaseWindowsDriveLetter):
161         (WebCore::URLParser::urlLengthUntilPart):
162         (WebCore::URLParser::copyURLPartsUntil):
163         (WebCore::URLParser::shouldPopPath):
164         (WebCore::URLParser::popPath):
165         (WebCore::URLParser::parse):
166         (WebCore::URLParser::parsePort):
167         (WebCore::URLParser::parseHostAndPort):
168         (WebCore::URLParser::allValuesEqual):
169         (WebCore::URLParser::internalValuesConsistent):
170
171 2018-07-11  Youenn Fablet  <youenn@apple.com>
172
173         Fix remaining Cross-Origin-Resource-Policy failures, if any
174         https://bugs.webkit.org/show_bug.cgi?id=186761
175         <rdar://problem/41209829>
176
177         Reviewed by Alex Christensen.
178
179         Add case-sensitive check for CORP header value, as per fetch specification.
180         Add HTTP->HTTPS check for same-site case, as per fetch specification.
181         https://fetch.spec.whatwg.org/#cross-origin-resource-policy-check
182
183         Test: imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window.html
184
185         * loader/CrossOriginAccessControl.cpp:
186         (WebCore::shouldCrossOriginResourcePolicyCancelLoad):
187         * platform/network/HTTPParsers.cpp:
188         (WebCore::parseCrossOriginResourcePolicyHeader):
189
190 2018-07-11  Ross Kirsling  <ross.kirsling@sony.com>
191
192         [WinCairo] MIME type registry doesn't explicitly recognize *.xht
193         https://bugs.webkit.org/show_bug.cgi?id=187555
194
195         Reviewed by Konstantin Tokarev.
196
197         Follow-up to r233715 -- WinCairo bots are failing on *.xht layout tests as they lack a registry key for this filetype.
198         (Hopefully this is the last one to add.)
199
200         * platform/win/MIMETypeRegistryWin.cpp:
201         (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
202         Add *.xht to the list of recognized filetypes.
203
204 2018-07-11  Antoine Quint  <graouts@apple.com>
205
206         [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html pass reliably
207         https://bugs.webkit.org/show_bug.cgi?id=186501
208         <rdar://problem/41000224>
209
210         Unreviewed build fix after r233729 and r233730.
211
212         * animation/KeyframeEffectReadOnly.cpp:
213         (WebCore::processIterableKeyframes):
214
215 2018-07-11  Antoine Quint  <graouts@apple.com>
216
217         [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html pass reliably
218         https://bugs.webkit.org/show_bug.cgi?id=186501
219         <rdar://problem/41000224>
220
221         Unreviewed build fix after r233729.
222
223         * animation/KeyframeEffectReadOnly.cpp:
224         (WebCore::processIterableKeyframes):
225
226 2018-07-10  Antoine Quint  <graouts@apple.com>
227
228         [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html pass reliably
229         https://bugs.webkit.org/show_bug.cgi?id=186501
230         <rdar://problem/41000224>
231
232         Reviewed by Dean Jackson.
233
234         There were two remaining assertions that we were failing in this WPT test file, both related to processing iterable keyframes.
235         The first one was failing because didn't correctly propagate the TypeError exception in the forEachInIterable() callback. The
236         second one was failing because we didn't use the "process a keyframe-like object" procedure when processing iterable keyframes
237         and, as such, we didn't correctly sort property alphabetically before reading their values.
238
239         To fix this second issue, we make processIterableKeyframes() use processKeyframeLikeObject(). To do so, we update processKeyframeLikeObject()
240         to accept a new boolean flag to match the "allow lists" flag from the specification. We also ensure we sort the properties *before*
241         reading from them which we didn't use to do previously.
242
243         * animation/KeyframeEffectReadOnly.cpp:
244         (WebCore::processKeyframeLikeObject):
245         (WebCore::processIterableKeyframes):
246         (WebCore::processPropertyIndexedKeyframes):
247         * animation/KeyframeEffectReadOnly.h:
248         * animation/KeyframeEffectReadOnly.idl:
249
250 2018-07-11  Zalan Bujtas  <zalan@apple.com>
251
252         SimpleLineLayout::FlowContents wastes 54KB of Vector capacity on nytimes.com
253         https://bugs.webkit.org/show_bug.cgi?id=186709
254         <rdar://problem/41173793>
255
256         Reviewed by Simon Fraser.
257
258         The size of the m_segments vector in SimpleLineLayoutFlowContents is alway pre-computed and don't change after the initial append.  
259
260         Not testable.
261
262         * rendering/SimpleLineLayoutFlowContents.h:
263
264 2018-07-10  Youenn Fablet  <youenn@apple.com>
265
266         Make fetch() use "same-origin" credentials by default
267         https://bugs.webkit.org/show_bug.cgi?id=176023
268
269         Reviewed by Chris Dumez.
270
271         Covered by updated tests.
272
273         * Modules/fetch/FetchRequest.cpp:
274         (WebCore::FetchRequest::initializeWith):
275         Setting credentials mode to same-origin for FetchRequest by default.
276         * loader/DocumentThreadableLoader.cpp:
277         (WebCore::DocumentThreadableLoader::redirectReceived):
278         Handle correctly referrer in case we restart a load.
279         * page/PerformanceResourceTiming.cpp:
280         (WebCore::entryStartTime):
281         (WebCore::entryEndTime):
282         In case it is not allowed to disclose resource timing info, update as
283         https://www.w3.org/TR/resource-timing-1/#performanceresourcetiming
284
285 2018-07-10  Chris Dumez  <cdumez@apple.com>
286
287         "serviceworker.js" is fetched several times in a row
288         https://bugs.webkit.org/show_bug.cgi?id=187435
289         <rdar://problem/41940569>
290
291         Reviewed by Youenn Fablet.
292
293         Soft updates happen every time a fetch event is sent to a service worker for a main resource request.
294         This can happen many times during a page load and will cause us to spam the HTTP server with update
295         requests, especially considering that the default behavior is to bypass the HTTP cache. To address
296         the issue, we now do soft updates on a 1 second delay and we keep rescheduling this timer was long as
297         soft update requests keep coming. Based on my understanding of the Chromium code, this seems to be
298         what they are doing so this should align our behavior with them.
299
300         * workers/service/ServiceWorkerRegistration.cpp:
301         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
302         (WebCore::ServiceWorkerRegistration::scheduleSoftUpdate):
303         * workers/service/ServiceWorkerRegistration.h:
304         * workers/service/context/ServiceWorkerFetch.cpp:
305         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
306
307 2018-07-10  Ross Kirsling  <ross.kirsling@sony.com>
308
309         [WinCairo] MIME type registry doesn't explicitly recognize *.css
310         https://bugs.webkit.org/show_bug.cgi?id=187538
311
312         Reviewed by Yusuke Suzuki.
313
314         MIMETypeRegistryWin doesn't explicitly recognize *.css; it instead falls back to the registry key "Content Type"
315         under HKEY_CLASSES_ROOT\.css. This key doesn't exist on Windows Server unless an application actually registers
316         it -- as a result, WinCairo bots are currently viewing it as an unrecognized filetype!
317
318         * platform/win/MIMETypeRegistryWin.cpp:
319         (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
320         Add *.css to the list of recognized filetypes.
321
322 2018-07-10  Timothy Hatcher  <timothy@apple.com>
323
324         REGRESSION (r233552): Find highlight has white text on yellow background
325         https://bugs.webkit.org/show_bug.cgi?id=187535
326         rdar://problem/42043371
327
328         Reviewed by Tim Horton.
329
330         Fixes existing image tests:
331         - fast/text/mark-matches-rendering.html
332         - fast/text/mark-matches-broken-line-rendering.html
333
334         * rendering/InlineTextBox.cpp:
335         (WebCore::InlineTextBox::resolveStyleForMarkedText): Remove incorect UseDarkAppearance.
336
337 2018-07-10  Chris Fleizach  <cfleizach@apple.com>
338
339         AX: Crash in accessing AXObjectCache in textMarkerDataForVisiblePosition
340         https://bugs.webkit.org/show_bug.cgi?id=187528
341         <rdar://problem/37231941>
342
343         Reviewed by Joanmarie Diggs.
344
345         Occasional crashes reported when running accessibility/mac/search-field-cancel-button.html.
346         Looks like the cache object retrieved was not valid and we weren't checking for it.
347
348         * accessibility/AXObjectCache.cpp:
349         (WebCore::AXObjectCache::visiblePositionForTextMarkerData):
350         (WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
351         (WebCore::AXObjectCache::textMarkerDataForFirstPositionInTextControl):
352
353 2018-07-10  Zalan Bujtas  <zalan@apple.com>
354
355         FragmentInterval, FragmentIntervalTree and FragmentSearchAdapter should hold not hold raw pointers to renderers.
356         https://bugs.webkit.org/show_bug.cgi?id=187249
357         <rdar://problem/41725869>
358
359         Reviewed by Simon Fraser.
360
361         Test: fast/multicol/crash-in-vertical-writing-mode.html
362
363         * rendering/RenderFragmentedFlow.cpp:
364         (WebCore::RenderFragmentedFlow::updateFragmentsFragmentedFlowPortionRect):
365         * rendering/RenderFragmentedFlow.h:
366         (WTF::ValueToString<WeakPtr<WebCore::RenderFragmentContainer>>::string):
367
368 2018-07-10  Ryosuke Niwa  <rniwa@webkit.org>
369
370         Disable cross-origin-window-policy by default
371         https://bugs.webkit.org/show_bug.cgi?id=187509
372
373         Reviewed by Chris Dumez.
374
375         Disabled the feature by default.
376
377         * page/Settings.yaml:
378
379 2018-07-10  Alejandro G. Castro  <alex@igalia.com>
380
381         [GTK][WPE] The LibWebRTCProvider object in RealtimeMediaSourceCenterLibWebRTC is not needed anymore
382         https://bugs.webkit.org/show_bug.cgi?id=187513
383
384         Reviewed by Youenn Fablet.
385
386         We used the factory of the LibWebRTCProvider in
387         RealtimeMediaSourceCenterLibWebRTC as a singleton to make sure the
388         devices were correctly listed and used, we needed this when using
389         libwebrtc media devices management. We are now using GStreamer to handle
390         the media devices so this is not needed anymore.
391
392         No new tests, this change removed unused code.
393
394         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp:
395         (WebCore::RealtimeMediaSourceCenterLibWebRTC::RealtimeMediaSourceCenterLibWebRTC):
396         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h:
397
398 2018-07-10  Zalan Bujtas  <zalan@apple.com>
399
400         Rollout r233530: Candidate for Speedometer regression.
401         https://bugs.webkit.org/show_bug.cgi?id=187518
402
403         * rendering/SimpleLineLayoutFlowContents.h:
404
405 2018-07-09  Antoine Quint  <graouts@apple.com>
406
407         [Web Animations] Correct handle repetition of composite and easing values
408         https://bugs.webkit.org/show_bug.cgi?id=187498
409         <rdar://problem/41999183>
410
411         Reviewed by Dean Jackson.
412
413         If there are fewer values for "easing" and "composite" than there are keyframes, we are supposed to
414         fill in missing values by repeating the pattern of specified values. We were starting our iteration
415         to fill those missing values on the second missing value rather than the first missing value.
416
417         * animation/KeyframeEffectReadOnly.cpp:
418         (WebCore::processPropertyIndexedKeyframes):
419
420 2018-07-09  Youenn Fablet  <youenn@apple.com>
421
422         Add the possibility to run unsandboxed plug-ins
423         https://bugs.webkit.org/show_bug.cgi?id=187310
424         <rdar://problem/41798808>
425
426         Reviewed by Alexey Proskuryakov.
427
428         Add a runtime flag to enforce plugin sandboxing.
429         Covered by manual testing.
430
431         * page/RuntimeEnabledFeatures.h:
432         (WebCore::RuntimeEnabledFeatures::setSandboxPlugInEnabled):
433         (WebCore::RuntimeEnabledFeatures::sandboxPlugInEnabled const):
434
435 2018-07-09  Dean Jackson  <dino@apple.com>
436
437         Remove fullscreen-auto-hide-delay
438         https://bugs.webkit.org/show_bug.cgi?id=187493
439         <rdar://problem/41830852>
440
441         Reviewed by Antoine Quint.
442
443         Remove the env() value for fullscreen-auto-hide-delay.
444
445         * dom/ConstantPropertyMap.cpp:
446         (WebCore::ConstantPropertyMap::nameForProperty const):
447         (WebCore::ConstantPropertyMap::setFullscreenAutoHideDelay): Deleted.
448         * dom/ConstantPropertyMap.h:
449         * page/Page.cpp:
450         (WebCore::Page::setFullscreenAutoHideDelay): Deleted.
451         * page/Page.h:
452         * testing/Internals.cpp:
453         (WebCore::Internals::resetToConsistentState): No need to reset delay.
454         (WebCore::Internals::setFullscreenAutoHideDelay): Deleted.
455         * testing/Internals.h: Remove the delay setter/getter.
456         * testing/Internals.idl:
457
458 2018-07-09  Timothy Hatcher  <timothy@apple.com>
459
460         Semantic colors don't update when accessibility Increase Contrast mode is enabled.
461         https://bugs.webkit.org/show_bug.cgi?id=187425
462         rdar://problem/39948240
463
464         Reviewed by Tim Horton.
465
466         Added a listener for the accessibility change notification to invalidate our color caches.
467
468         Removed calls to RenderTheme::singleton().platformColorsDidChange() in Page, since that
469         ended up calling Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment multiple times.
470         Instead, changed the functions to use the new instance version instead.
471
472         * page/Page.cpp:
473         (WebCore::Page::updateStyleAfterChangeInEnvironment): Added. Gives Page a direct way to do this work
474         per instance instead of on all pages (since appearance can be difference per view).
475         (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment): Call updateStyleAfterChangeInEnvironment.
476         (WebCore::Page::setUseSystemAppearance): Call updateStyleAfterChangeInEnvironment.
477         (WebCore::Page::setUseDarkAppearance): Added. Call updateStyleAfterChangeInEnvironment.
478         * page/Page.h:
479         (WebCore::Page::setUseDarkAppearance): Moved to the implementation file.
480         * platform/mac/LocalDefaultSystemAppearance.mm:
481         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): Removed recursive check since it was interfering
482         with the setting of m_usingDarkAppearance and causing the wrong color cache to be used.
483         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): Ditto.
484         * rendering/RenderThemeMac.mm:
485         (-[WebCoreRenderThemeNotificationObserver init]): Listen for NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification.
486         (-[WebCoreRenderThemeNotificationObserver systemColorsDidChange:]): Removed assert since multiple notifications are used now.
487         (WebCore::RenderThemeMac::systemColor): Change how system link colors are cached. Don't store useSystemAppearance link colors in the
488         ColorCache, since that special bool isn't considered in the cache after the first time.
489
490 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
491
492         Shrink various loading-related enums to shrink CachedResource
493         https://bugs.webkit.org/show_bug.cgi?id=187443
494
495         Reviewed by Chris Dumez.
496         
497         ResourceRequestBase, ResourceResponseBase, ResourceLoaderOptions, FetchOptions and
498         CachedResource have a lot of enum members variables most of which took 4 bytes each.
499         These can be packed much more efficiently if the enums are declared with an 8-bit size.
500         This requires turning enums into enum classes in some cases.
501         
502         This reduces the size of CachedResource from 1464 to 1384 bytes, which saves about 49KB
503         over the ~600 CachedResources on nytimes.com.
504
505         * Modules/fetch/FetchLoader.cpp:
506         (WebCore::FetchLoader::startLoadingBlobURL):
507         (WebCore::FetchLoader::start):
508         * css/StyleRuleImport.cpp:
509         (WebCore::StyleRuleImport::requestStyleSheet):
510         * fileapi/FileReaderLoader.cpp:
511         (WebCore::FileReaderLoader::start):
512         * html/MediaDocument.cpp:
513         (WebCore::MediaDocumentParser::createDocumentStructure):
514         * html/PluginDocument.cpp:
515         (WebCore::PluginDocumentParser::appendBytes):
516         * html/parser/CSSPreloadScanner.cpp:
517         (WebCore::CSSPreloadScanner::emitRule):
518         * html/parser/HTMLPreloadScanner.cpp:
519         (WebCore::TokenPreloadScanner::StartTagScanner::resourceType const):
520         * inspector/NetworkResourcesData.cpp:
521         (WebCore::shouldBufferResourceData):
522         * inspector/agents/InspectorNetworkAgent.cpp:
523         (WebCore::InspectorNetworkAgent::didReceiveResponse):
524         (WebCore::InspectorNetworkAgent::loadResource):
525         (WebCore::InspectorNetworkAgent::cachedResourceContent):
526         * inspector/agents/InspectorPageAgent.cpp:
527         (WebCore::InspectorPageAgent::sourceMapURLForResource):
528         (WebCore::InspectorPageAgent::inspectorResourceType):
529         * loader/ApplicationManifestLoader.cpp:
530         (WebCore::ApplicationManifestLoader::startLoading):
531         * loader/ContentFilter.cpp:
532         (WebCore::ContentFilter::deliverResourceData):
533         * loader/DocumentLoader.cpp:
534         (WebCore::DocumentLoader::notifyFinished):
535         (WebCore::DocumentLoader::willSendRequest):
536         (WebCore::DocumentLoader::tryLoadingRedirectRequestFromApplicationCache):
537         (WebCore::DocumentLoader::subresource const):
538         (WebCore::DocumentLoader::loadMainResource):
539         * loader/DocumentThreadableLoader.cpp:
540         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
541         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
542         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
543         (WebCore::DocumentThreadableLoader::preflightSuccess):
544         (WebCore::DocumentThreadableLoader::loadRequest):
545         * loader/FetchOptions.h:
546         (WebCore::FetchOptions::FetchOptions):
547         * loader/FrameLoader.cpp:
548         (WebCore::FrameLoader::loadFrameRequest):
549         (WebCore::FrameLoader::loadURL):
550         (WebCore::FrameLoader::load):
551         (WebCore::FrameLoader::reloadWithOverrideEncoding):
552         (WebCore::FrameLoader::reload):
553         (WebCore::FrameLoader::defaultRequestCachingPolicy):
554         (WebCore::FrameLoader::addExtraFieldsToRequest):
555         (WebCore::FrameLoader::loadedResourceFromMemoryCache):
556         (WebCore::FrameLoader::loadDifferentDocumentItem):
557         * loader/LinkLoader.cpp:
558         (WebCore::LinkLoader::resourceTypeFromAsAttribute):
559         (WebCore::createLinkPreloadResourceClient):
560         (WebCore::LinkLoader::isSupportedType):
561         (WebCore::LinkLoader::prefetchIfNeeded):
562         * loader/MediaResourceLoader.cpp:
563         (WebCore::MediaResourceLoader::requestResource):
564         * loader/NavigationScheduler.cpp:
565         (WebCore::NavigationScheduler::scheduleLocationChange):
566         * loader/NetscapePlugInStreamLoader.cpp:
567         (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
568         * loader/ResourceLoadInfo.cpp:
569         (WebCore::toResourceType):
570         * loader/ResourceLoader.cpp:
571         (WebCore::ResourceLoader::init):
572         (WebCore::ResourceLoader::start):
573         (WebCore::ResourceLoader::setDataBufferingPolicy):
574         (WebCore::ResourceLoader::addDataOrBuffer):
575         (WebCore::ResourceLoader::willSendRequestInternal):
576         (WebCore::ResourceLoader::didReceiveResponse):
577         (WebCore::ResourceLoader::didReceiveDataOrBuffer):
578         (WebCore::ResourceLoader::didFinishLoadingOnePart):
579         (WebCore::ResourceLoader::cleanupForError):
580         * loader/ResourceLoader.h:
581         (WebCore::ResourceLoader::shouldSendResourceLoadCallbacks const):
582         (WebCore::ResourceLoader::shouldSniffContent const):
583         (WebCore::ResourceLoader::shouldIncludeCertificateInfo const):
584         * loader/ResourceLoaderOptions.h:
585         * loader/ResourceTimingInformation.cpp:
586         (WebCore::ResourceTimingInformation::addResourceTiming):
587         (WebCore::ResourceTimingInformation::storeResourceTimingInitiatorInformation):
588         * loader/SubresourceLoader.cpp:
589         (WebCore::SubresourceLoader::SubresourceLoader):
590         (WebCore::SubresourceLoader::willSendRequestInternal):
591         (WebCore::SubresourceLoader::shouldCreatePreviewLoaderForResponse const):
592         (WebCore::SubresourceLoader::didReceiveResponse):
593         (WebCore::logResourceLoaded):
594         (WebCore::SubresourceLoader::didFinishLoading):
595         (WebCore::SubresourceLoader::didFail):
596         (WebCore::SubresourceLoader::didCancel):
597         * loader/cache/CachedApplicationManifest.cpp:
598         (WebCore::CachedApplicationManifest::CachedApplicationManifest):
599         * loader/cache/CachedApplicationManifest.h:
600         * loader/cache/CachedCSSStyleSheet.cpp:
601         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
602         * loader/cache/CachedCSSStyleSheet.h:
603         * loader/cache/CachedFont.h:
604         * loader/cache/CachedImage.cpp:
605         (WebCore::CachedImage::CachedImage):
606         (WebCore::CachedImage::updateBuffer):
607         (WebCore::CachedImage::updateData):
608         * loader/cache/CachedImage.h:
609         * loader/cache/CachedRawResource.cpp:
610         (WebCore::CachedRawResource::updateBuffer):
611         (WebCore::CachedRawResource::updateData):
612         (WebCore::CachedRawResource::finishLoading):
613         (WebCore::CachedRawResource::canReuse const):
614         * loader/cache/CachedResource.cpp:
615         (WebCore::CachedResource::defaultPriorityForResourceType):
616         (WebCore::deadDecodedDataDeletionIntervalForResourceType):
617         (WebCore::CachedResource::CachedResource):
618         (WebCore::CachedResource::load):
619         (WebCore::CachedResource::updateBuffer):
620         (WebCore::CachedResource::updateData):
621         (WebCore::CachedResource::isCORSSameOrigin const):
622         (WebCore::CachedResource::freshnessLifetime const):
623         (WebCore::CachedResource::setResponse):
624         (WebCore::CachedResource::addClientToSet):
625         (WebCore::CachedResource::areAllClientsXMLHttpRequests const):
626         * loader/cache/CachedResource.h:
627         (WebCore::CachedResource::isImage const):
628         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const):
629         (WebCore::CachedResource::ignoreForRequestCount const):
630         (WebCore::CachedResource::shouldSendResourceLoadCallbacks const):
631         * loader/cache/CachedResourceLoader.cpp:
632         (WebCore::createResource):
633         (WebCore::CachedResourceLoader::requestImage):
634         (WebCore::CachedResourceLoader::requestFont):
635         (WebCore::CachedResourceLoader::requestTextTrack):
636         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
637         (WebCore::CachedResourceLoader::requestScript):
638         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
639         (WebCore::CachedResourceLoader::requestSVGDocument):
640         (WebCore::CachedResourceLoader::requestLinkResource):
641         (WebCore::CachedResourceLoader::requestMedia):
642         (WebCore::CachedResourceLoader::requestIcon):
643         (WebCore::CachedResourceLoader::requestRawResource):
644         (WebCore::CachedResourceLoader::requestBeaconResource):
645         (WebCore::CachedResourceLoader::requestMainResource):
646         (WebCore::CachedResourceLoader::requestApplicationManifest):
647         (WebCore::contentTypeFromResourceType):
648         (WebCore::CachedResourceLoader::checkInsecureContent const):
649         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy const):
650         (WebCore::CachedResourceLoader::canRequest):
651         (WebCore::CachedResourceLoader::canRequestInContentDispositionAttachmentSandbox const):
652         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
653         (WebCore::isResourceSuitableForDirectReuse):
654         (WebCore::destinationForType):
655         (WebCore::CachedResourceLoader::loadResource):
656         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
657         (WebCore::CachedResourceLoader::cachePolicy const):
658         (WebCore::CachedResourceLoader::preload):
659         (WebCore::CachedResourceLoader::warnUnusedPreloads):
660         (WebCore::CachedResourceLoader::clearPreloads):
661         (WebCore::CachedResourceLoader::defaultCachedResourceOptions):
662         * loader/cache/CachedResourceRequest.cpp:
663         (WebCore::CachedResourceRequest::updateAccordingCacheMode):
664         * loader/cache/CachedResourceRequest.h:
665         * loader/cache/CachedSVGDocument.cpp:
666         (WebCore::CachedSVGDocument::CachedSVGDocument):
667         * loader/cache/CachedSVGDocument.h:
668         * loader/cache/CachedSVGFont.cpp:
669         (WebCore::CachedSVGFont::CachedSVGFont):
670         * loader/cache/CachedSVGFont.h:
671         * loader/cache/CachedScript.cpp:
672         (WebCore::CachedScript::CachedScript):
673         * loader/cache/CachedScript.h:
674         * loader/cache/CachedTextTrack.cpp:
675         (WebCore::CachedTextTrack::CachedTextTrack):
676         (WebCore::CachedTextTrack::doUpdateBuffer):
677         * loader/cache/CachedTextTrack.h:
678         * loader/cache/CachedXSLStyleSheet.cpp:
679         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
680         * loader/cache/CachedXSLStyleSheet.h:
681         * loader/cache/MemoryCache.cpp:
682         (WebCore::MemoryCache::getStatistics):
683         * loader/icon/IconLoader.cpp:
684         (WebCore::IconLoader::startLoading):
685         * loader/mac/ResourceLoaderMac.mm:
686         (WebCore::ResourceLoader::willCacheResponseAsync):
687         * page/DOMWindow.cpp:
688         (WebCore::DOMWindow::createWindow):
689         * page/EventSource.cpp:
690         (WebCore::EventSource::connect):
691         * platform/ReferrerPolicy.h:
692         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
693         (WebCore::WebCoreAVFResourceLoader::startLoading):
694         * platform/ios/QuickLook.mm:
695         (WebCore::registerQLPreviewConverterIfNeeded):
696         * platform/network/CacheValidation.cpp:
697         (WebCore::updateRedirectChainStatus):
698         (WebCore::redirectChainAllowsReuse):
699         * platform/network/CacheValidation.h:
700         (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus):
701         * platform/network/ResourceErrorBase.h:
702         * platform/network/ResourceLoadPriority.h:
703         * platform/network/ResourceRequestBase.cpp:
704         (WebCore::ResourceRequestBase::httpBody const):
705         (WebCore::ResourceRequestBase::updatePlatformRequest const):
706         (WebCore::ResourceRequestBase::updateResourceRequest const):
707         * platform/network/ResourceRequestBase.h:
708         * platform/network/ResourceResponseBase.h:
709         * platform/network/StoredCredentialsPolicy.h:
710         * platform/network/cf/ResourceRequest.h:
711         (WebCore::ResourceRequest::ResourceRequest):
712         * platform/network/cf/ResourceRequestCFNet.cpp:
713         (WebCore::toPlatformRequestCachePolicy):
714         (WebCore::fromPlatformRequestCachePolicy):
715         (WebCore::ResourceRequest::doUpdateResourceRequest):
716         * platform/network/cocoa/ResourceRequestCocoa.mm:
717         (WebCore::fromPlatformRequestCachePolicy):
718         (WebCore::toPlatformRequestCachePolicy):
719         (WebCore::ResourceRequest::doUpdateResourceRequest):
720         * platform/network/cocoa/WebCoreNSURLSession.mm:
721         (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:completionHandler:]):
722         * platform/network/ios/PreviewConverter.mm:
723         (WebCore::PreviewConverter::safeRequest const):
724         * platform/network/mac/ResourceHandleMac.mm:
725         (WebCore::ResourceHandle::createNSURLConnection):
726         (WebCore::ResourceHandle::start):
727         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
728         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
729         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
730         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
731         * testing/Internals.cpp:
732         (WebCore::toResourceRequestCachePolicy):
733         * workers/WorkerScriptLoader.cpp:
734         (WebCore::WorkerScriptLoader::loadSynchronously):
735         (WebCore::WorkerScriptLoader::loadAsynchronously):
736         * xml/XMLHttpRequest.cpp:
737         (WebCore::XMLHttpRequest::createRequest):
738
739 2018-07-09  Antoine Quint  <graouts@apple.com>
740
741         [Web Animations] Make WPT test at interfaces/DocumentTimeline/constructor.html pass reliably
742         https://bugs.webkit.org/show_bug.cgi?id=186498
743         <rdar://problem/41000205>
744         
745         Reviewed by Dean Jackson.
746
747         Add a Constructor to the DocumentTimeline IDL to match the spec and ensure we respect the provided
748         origin time. To ensure all DocumentTimeline instances report matching current times, we read the
749         current time from the "main" document timeline, the one created by the Document automatically.
750
751         * CMakeLists.txt:
752         * DerivedSources.make:
753         * Sources.txt:
754         * WebCore.xcodeproj/project.pbxproj:
755         * animation/DocumentTimeline.cpp:
756         (WebCore::DocumentTimeline::create):
757         (WebCore::DocumentTimeline::DocumentTimeline):
758         (WebCore::DocumentTimeline::currentTime):
759         * animation/DocumentTimeline.h:
760         * animation/DocumentTimeline.idl:
761         * animation/DocumentTimelineOptions.h:
762         * animation/DocumentTimelineOptions.idl:
763
764 2018-07-09  Antoine Quint  <graouts@apple.com>
765
766         [Web Animations] Support overlapping keyframes
767         https://bugs.webkit.org/show_bug.cgi?id=187481
768         <rdar://problem/41988674>
769
770         Reviewed by Dean Jackson.
771
772         We now support parsing of multiple keyframes for the same offset.
773
774         * animation/KeyframeEffectReadOnly.cpp:
775         (WebCore::computeMissingKeyframeOffsets): Keyframes with a null offset that don't yet have a non-zero
776         computed offset are keyframes with an offset that needs to be computed.
777         (WebCore::KeyframeEffectReadOnly::processKeyframes): Only file an exception if an offset is found that
778         is lower than a previously-parsed one, allowing offsets with the same value.
779         * rendering/style/KeyframeList.cpp:
780         (WebCore::KeyframeList::insert): Remove the assertion that prevented an offset to be found more than once.
781
782 2018-07-09  Youenn Fablet  <youenn@apple.com>
783
784         StringView operator==(char*) should check the length of the string
785         https://bugs.webkit.org/show_bug.cgi?id=187422
786
787         Reviewed by Chris Dumez.
788
789         Covered by existing tests.
790
791         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
792         (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameFromEncodedFilename):
793
794 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
795
796         Shrink WebCore::Pair
797         https://bugs.webkit.org/show_bug.cgi?id=187450
798
799         Reviewed by Sam Weinig.
800
801         Move m_encoding to pack in with m_refCount and remove the virtual destructor,
802         shrinking the class from 40 to 24 bytes.
803         Also make the enum take only a byte, in case it gets used elsewhere
804         
805         There are about 500 Pairs on nytimes.com, so this memory saving is non-trivial.
806
807         * css/Pair.h:
808
809 2018-07-09  Yusuke Suzuki  <utatane.tea@gmail.com>
810
811         [WebCore] Annotate classes with WTF_MAKE_FAST_ALLOCATED as much as possible
812         https://bugs.webkit.org/show_bug.cgi?id=187474
813
814         Reviewed by Mark Lam.
815
816         When opening cnn.com, debugger says that so many objects in WebCore are allocated
817         from system allocator. This patch attempts to annotate these found classes with
818         WTF_MAKE_FAST_ALLOCATED.
819
820         We also annotate WebAudio classes with `final` to make WebAudio class hierarchy solid.
821
822         No behavior change.
823
824         * Modules/indexeddb/IDBIndex.h:
825         * Modules/indexeddb/IDBObjectStore.h:
826         * Modules/indexeddb/client/IDBConnectionProxy.h:
827         * Modules/mediastream/UserMediaController.h:
828         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
829         * Modules/webaudio/AsyncAudioDecoder.h:
830         * Modules/webaudio/AudioListener.h:
831         (WebCore::AudioListener::create): Deleted.
832         (WebCore::AudioListener::setPosition): Deleted.
833         (WebCore::AudioListener::position const): Deleted.
834         (WebCore::AudioListener::setOrientation): Deleted.
835         (WebCore::AudioListener::orientation const): Deleted.
836         (WebCore::AudioListener::setUpVector): Deleted.
837         (WebCore::AudioListener::upVector const): Deleted.
838         (WebCore::AudioListener::setVelocity): Deleted.
839         (WebCore::AudioListener::velocity const): Deleted.
840         (WebCore::AudioListener::setDopplerFactor): Deleted.
841         (WebCore::AudioListener::dopplerFactor const): Deleted.
842         (WebCore::AudioListener::setSpeedOfSound): Deleted.
843         (WebCore::AudioListener::speedOfSound const): Deleted.
844         * Modules/webaudio/AudioNode.h:
845         * Modules/webaudio/AudioNodeInput.h:
846         (WebCore::AudioNodeInput::node const): Deleted.
847         * Modules/webaudio/AudioNodeOutput.h:
848         * Modules/webaudio/AudioParam.h:
849         (WebCore::AudioParam::create): Deleted.
850         (WebCore::AudioParam::name const): Deleted.
851         (WebCore::AudioParam::minValue const): Deleted.
852         (WebCore::AudioParam::maxValue const): Deleted.
853         (WebCore::AudioParam::defaultValue const): Deleted.
854         (WebCore::AudioParam::units const): Deleted.
855         (WebCore::AudioParam::resetSmoothedValue): Deleted.
856         (WebCore::AudioParam::setSmoothingConstant): Deleted.
857         (WebCore::AudioParam::setValueAtTime): Deleted.
858         (WebCore::AudioParam::linearRampToValueAtTime): Deleted.
859         (WebCore::AudioParam::exponentialRampToValueAtTime): Deleted.
860         (WebCore::AudioParam::setTargetAtTime): Deleted.
861         (WebCore::AudioParam::setValueCurveAtTime): Deleted.
862         (WebCore::AudioParam::cancelScheduledValues): Deleted.
863         (WebCore::AudioParam::hasSampleAccurateValues): Deleted.
864         (WebCore::AudioParam::AudioParam): Deleted.
865         * Modules/webaudio/AudioParamTimeline.h:
866         * Modules/webaudio/AudioProcessingEvent.h:
867         (WebCore::AudioProcessingEvent::create): Deleted.
868         (WebCore::AudioProcessingEvent::createForBindings): Deleted.
869         (WebCore::AudioProcessingEvent::inputBuffer): Deleted.
870         (WebCore::AudioProcessingEvent::outputBuffer): Deleted.
871         (WebCore::AudioProcessingEvent::playbackTime const): Deleted.
872         * Modules/webaudio/BiquadDSPKernel.h:
873         (WebCore::BiquadDSPKernel::BiquadDSPKernel): Deleted.
874         (WebCore::BiquadDSPKernel::biquadProcessor): Deleted.
875         * Modules/webaudio/BiquadFilterNode.h:
876         (WebCore::BiquadFilterNode::create): Deleted.
877         (WebCore::BiquadFilterNode::frequency): Deleted.
878         (WebCore::BiquadFilterNode::q): Deleted.
879         (WebCore::BiquadFilterNode::gain): Deleted.
880         (WebCore::BiquadFilterNode::detune): Deleted.
881         (WebCore::BiquadFilterNode::biquadProcessor): Deleted.
882         * Modules/webaudio/BiquadProcessor.h:
883         (WebCore::BiquadProcessor::filterCoefficientsDirty const): Deleted.
884         (WebCore::BiquadProcessor::hasSampleAccurateValues const): Deleted.
885         (WebCore::BiquadProcessor::parameter1): Deleted.
886         (WebCore::BiquadProcessor::parameter2): Deleted.
887         (WebCore::BiquadProcessor::parameter3): Deleted.
888         (WebCore::BiquadProcessor::parameter4): Deleted.
889         (WebCore::BiquadProcessor::type const): Deleted.
890         * Modules/webaudio/ChannelMergerNode.h:
891         * Modules/webaudio/ChannelSplitterNode.h:
892         * Modules/webaudio/DelayDSPKernel.h:
893         (WebCore::DelayDSPKernel::maxDelayTime const): Deleted.
894         (WebCore::DelayDSPKernel::setDelayFrames): Deleted.
895         (WebCore::DelayDSPKernel::delayProcessor): Deleted.
896         * Modules/webaudio/DelayNode.h:
897         * Modules/webaudio/DelayProcessor.h:
898         (WebCore::DelayProcessor::delayTime const): Deleted.
899         (WebCore::DelayProcessor::maxDelayTime): Deleted.
900         * Modules/webaudio/DynamicsCompressorNode.h:
901         (WebCore::DynamicsCompressorNode::create): Deleted.
902         (WebCore::DynamicsCompressorNode::threshold): Deleted.
903         (WebCore::DynamicsCompressorNode::knee): Deleted.
904         (WebCore::DynamicsCompressorNode::ratio): Deleted.
905         (WebCore::DynamicsCompressorNode::attack): Deleted.
906         (WebCore::DynamicsCompressorNode::release): Deleted.
907         (WebCore::DynamicsCompressorNode::reduction): Deleted.
908         * Modules/webaudio/GainNode.h:
909         (WebCore::GainNode::create): Deleted.
910         (WebCore::GainNode::gain): Deleted.
911         * Modules/webaudio/MediaElementAudioSourceNode.h:
912         (WebCore::MediaElementAudioSourceNode::mediaElement): Deleted.
913         * Modules/webaudio/MediaStreamAudioDestinationNode.h:
914         (WebCore::MediaStreamAudioDestinationNode::stream): Deleted.
915         * Modules/webaudio/MediaStreamAudioSourceNode.h:
916         (WebCore::MediaStreamAudioSourceNode::mediaStream): Deleted.
917         * Modules/webaudio/OfflineAudioCompletionEvent.h:
918         (WebCore::OfflineAudioCompletionEvent::renderedBuffer): Deleted.
919         * Modules/webaudio/OfflineAudioDestinationNode.h:
920         (WebCore::OfflineAudioDestinationNode::create): Deleted.
921         * Modules/webaudio/PannerNode.h:
922         (WebCore::PannerNode::create): Deleted.
923         (WebCore::PannerNode::panningModel const): Deleted.
924         (WebCore::PannerNode::position const): Deleted.
925         (WebCore::PannerNode::setPosition): Deleted.
926         (WebCore::PannerNode::orientation const): Deleted.
927         (WebCore::PannerNode::setOrientation): Deleted.
928         (WebCore::PannerNode::velocity const): Deleted.
929         (WebCore::PannerNode::setVelocity): Deleted.
930         (WebCore::PannerNode::refDistance): Deleted.
931         (WebCore::PannerNode::setRefDistance): Deleted.
932         (WebCore::PannerNode::maxDistance): Deleted.
933         (WebCore::PannerNode::setMaxDistance): Deleted.
934         (WebCore::PannerNode::rolloffFactor): Deleted.
935         (WebCore::PannerNode::setRolloffFactor): Deleted.
936         (WebCore::PannerNode::coneInnerAngle const): Deleted.
937         (WebCore::PannerNode::setConeInnerAngle): Deleted.
938         (WebCore::PannerNode::coneOuterAngle const): Deleted.
939         (WebCore::PannerNode::setConeOuterAngle): Deleted.
940         (WebCore::PannerNode::coneOuterGain const): Deleted.
941         (WebCore::PannerNode::setConeOuterGain): Deleted.
942         (WebCore::PannerNode::distanceGain): Deleted.
943         (WebCore::PannerNode::coneGain): Deleted.
944         * Modules/webaudio/PeriodicWave.h:
945         (WebCore::PeriodicWave::rateScale const): Deleted.
946         (WebCore::PeriodicWave::periodicWaveSize const): Deleted.
947         (WebCore::PeriodicWave::sampleRate const): Deleted.
948         (WebCore::PeriodicWave::numberOfRanges const): Deleted.
949         * Modules/webaudio/RealtimeAnalyser.h:
950         * Modules/webaudio/ScriptProcessorNode.h:
951         (WebCore::ScriptProcessorNode::bufferSize const): Deleted.
952         (WebCore::ScriptProcessorNode::doubleBufferIndex const): Deleted.
953         (WebCore::ScriptProcessorNode::swapBuffers): Deleted.
954         * Modules/webaudio/WaveShaperDSPKernel.h:
955         (WebCore::WaveShaperDSPKernel::waveShaperProcessor): Deleted.
956         * Modules/webaudio/WaveShaperProcessor.h:
957         (WebCore::WaveShaperProcessor::curve): Deleted.
958         (WebCore::WaveShaperProcessor::oversample const): Deleted.
959         * dom/MessagePort.h:
960         * html/FormAssociatedElement.h:
961         * loader/LinkPreloadResourceClients.h:
962         * page/WheelEventDeltaFilter.h:
963         * page/mac/WheelEventDeltaFilterMac.h:
964         * platform/RemoteCommandListener.h:
965         * platform/audio/AudioDSPKernel.h:
966         * platform/audio/AudioProcessor.h:
967         * platform/audio/PlatformMediaSession.h:
968         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h:
969         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
970         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
971         * workers/service/ServiceWorkerContainer.h:
972
973 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
974
975         Shrink RenderSVGShape
976         https://bugs.webkit.org/show_bug.cgi?id=187459
977
978         Reviewed by Zalan Bujtas.
979
980         Shrink RenderSVGShape from 328 to 320 bytes by moving the bits before the AffineTransform,
981         which is 16-byte aligned. This saves 9.6KB on nytimes.com.
982
983         * rendering/svg/RenderSVGShape.h:
984
985 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
986
987         Shrink CSSFontFace
988         https://bugs.webkit.org/show_bug.cgi?id=187456
989
990         Reviewed by Anders Carlsson.
991
992         Shrink CSSFontFace by 56 bytes, from 288 to 256 bytes, mostly by defining enums as 8-bit,
993         but also re-ordering the member variables. There are over 400 of these objects on nytimes.com,
994         so this saves about 22KB.
995
996         * css/CSSFontFace.cpp:
997         (WebCore::CSSFontFace::CSSFontFace):
998         * css/CSSFontFace.h:
999         * platform/text/TextFlags.h:
1000         * rendering/style/RenderStyleConstants.h:
1001
1002 2018-07-09  Commit Queue  <commit-queue@webkit.org>
1003
1004         Unreviewed, rolling out r233612.
1005         https://bugs.webkit.org/show_bug.cgi?id=187475
1006
1007         Revision caused the api test LinkColorWithSystemAppearance to
1008         fail on all systems. (Requested by Truitt on #webkit).
1009
1010         Reverted changeset:
1011
1012         "Semantic colors don't update when accessibility Increase
1013         Contrast mode is enabled."
1014         https://bugs.webkit.org/show_bug.cgi?id=187425
1015         https://trac.webkit.org/changeset/233612
1016
1017 2018-07-09  Philippe Normand  <pnormand@igalia.com>
1018
1019         [GStreamer] Remove useless workaround
1020         https://bugs.webkit.org/show_bug.cgi?id=186921
1021
1022         Reviewed by Xabier Rodriguez-Calvar.
1023
1024         In bug 67407 a workaround was added for GStreamer 0.10. With 1.x
1025         the media/video-reverse-play-duration.html test passes without any
1026         workaround needed. The other test mentioned in that bug was
1027         removed, it seems.
1028
1029         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1030         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
1031         Removed early return, position queries shouldn't be avoided on EOS
1032         because the pipeline is in READY state, not NULL.
1033         (WebCore::MediaPlayerPrivateGStreamer::currentMediaTime const):
1034
1035 2018-07-08  Simon Fraser  <simon.fraser@apple.com>
1036
1037         Optimize packing of RenderSVGViewportContainer
1038         https://bugs.webkit.org/show_bug.cgi?id=187458
1039
1040         Reviewed by Zalan Bujtas.
1041
1042         Shrink RenderSVGViewportContainer from 296 bytes to 280 bytes, saving about 6KB on nytimes.com.
1043
1044         * rendering/svg/RenderSVGContainer.cpp:
1045         (WebCore::RenderSVGContainer::RenderSVGContainer):
1046         * rendering/svg/RenderSVGContainer.h:
1047         * rendering/svg/RenderSVGViewportContainer.h:
1048
1049 2018-07-08  Simon Fraser  <simon.fraser@apple.com>
1050
1051         Shrink RenderTableSection
1052         https://bugs.webkit.org/show_bug.cgi?id=187457
1053
1054         Reviewed by Zalan Bujtas.
1055
1056         Shrink RenderTableSection from 344 to 336 bytes, saving about 3.6KB on nytimes.com.
1057
1058         * rendering/RenderTableSection.h:
1059
1060 2018-07-08  Simon Fraser  <simon.fraser@apple.com>
1061
1062         Optimize packing of RootInlineBox
1063         https://bugs.webkit.org/show_bug.cgi?id=187430
1064
1065         Reviewed by Zalan Bujtas.
1066
1067         In InlineBox, move the m_logicalWidth float up next to the m_expansion float with m_topLeft next; this
1068         avoids padding of 4 bytes after this float.
1069         
1070         In InlineFlowBox, move the bitfields before the pointers so they can snug up into the
1071         4 bytes after m_expansion in the base class.
1072         
1073         The comment about m_lineBreakPos's padding in RootInlineBox is wrong; just move it to the end
1074         to avoid padding before the m_lineBreakObj pointer.
1075         
1076         Make m_logicalWidth private and have derived classes use the accessor.
1077         
1078         Make EllipsisBox 4 bytes smaller too.
1079
1080         * rendering/EllipsisBox.cpp:
1081         (WebCore::EllipsisBox::EllipsisBox):
1082         (WebCore::EllipsisBox::paintMarkupBox):
1083         (WebCore::EllipsisBox::nodeAtPoint):
1084         * rendering/EllipsisBox.h:
1085         * rendering/InlineBox.h:
1086         (WebCore::InlineBox::InlineBox):
1087         * rendering/InlineFlowBox.cpp:
1088         * rendering/InlineFlowBox.h:
1089         (WebCore::InlineFlowBox::InlineFlowBox):
1090         (WebCore::InlineFlowBox::frameRectIncludingLineHeight const):
1091         * rendering/InlineTextBox.cpp:
1092         (WebCore::InlineTextBox::localSelectionRect const):
1093         (WebCore::InlineTextBox::paint):
1094         (WebCore::InlineTextBox::paintPlatformDocumentMarker):
1095         (WebCore::InlineTextBox::paintMarkedTextBackground):
1096         (WebCore::InlineTextBox::paintCompositionUnderline const):
1097         * rendering/RootInlineBox.cpp:
1098         (WebCore::RootInlineBox::RootInlineBox):
1099         * rendering/RootInlineBox.h:
1100
1101 2018-07-08  Antoine Quint  <graouts@apple.com>
1102
1103         [Web Animations] A number of tests report an incorrect computed offset
1104         https://bugs.webkit.org/show_bug.cgi?id=187410
1105         <rdar://problem/41905790>
1106
1107         Reviewed by Dean Jackson.
1108
1109         While we would correctly avoid computing missing offsets when processing the first keyframe following the last
1110         keyframes with a specified offset, we were forgetting to update the index of the last keyframe with a specified
1111         offset which meant we would accidentally override a specified offset with an automically-computed one.
1112
1113         * animation/KeyframeEffectReadOnly.cpp:
1114         (WebCore::computeMissingKeyframeOffsets):
1115
1116 2018-07-08  David Kilzer  <ddkilzer@apple.com>
1117
1118         DOMMatrix.invertSelf() returns garbage values for a non-invertible matrix
1119         <https://webkit.org/b/187446>
1120         <rdar://problem/41853187>
1121
1122         Reviewed by Daniel Bates.
1123
1124         Test: http/wpt/css/geometry/DOMMatrix-invertSelf.html
1125
1126         * css/DOMMatrix.cpp:
1127         (WebCore::DOMMatrix::invertSelf): Add missing `else`, and
1128         restructure to use positive logic.
1129
1130 2018-07-07  Wenson Hsieh  <wenson_hsieh@apple.com>
1131
1132         Introduce a layout milestone to track when the document contains a large number of rendered characters
1133         https://bugs.webkit.org/show_bug.cgi?id=187412
1134         <rdar://problem/41744338>
1135
1136         Reviewed by Ryosuke Niwa.
1137
1138         Implements a new layout milestone: `DidRenderSignificantAmountOfText`. This is similar to the existing
1139         `DidFirstVisuallyNonEmptyLayout` milestone, but with a few important additional constraints:
1140
1141         • The minimum threshold of rendered characters is much larger (3000 instead of 200).
1142         • The mean length of a text node must be large (at least 50).
1143
1144         This is a (computationally) lightweight heuristic intended to estimate the likelihood that a page is capable of
1145         being presented in Reader mode. In many article-like pages, the average length of a text node is significantly
1146         longer than other types of pages; thus, on pages where the average length of a text node is very large *and*
1147         there is a large quantity of text, we can use this as a cue to opportunistically detect and enter Safari reader
1148         mode on watchOS.
1149
1150         Test: RenderingProgressTests.DidRenderSignificantAmountOfText
1151
1152         * page/FrameView.cpp:
1153         (WebCore::FrameView::reset):
1154
1155         Clear out new state members that keep track of whether the significant rendered text milestone has been met.
1156
1157         (WebCore::elementOverflowRectIsLargerThanThreshold):
1158
1159         Factor out logic to grab the overflow height of an element into a separate helper function.
1160
1161         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const):
1162         (WebCore::FrameView::updateSignificantRenderedTextMilestoneIfNeeded):
1163
1164         Determines whether to fire this new milestone after the next layout pass is finished. The logic here is similar
1165         to the logic in qualifiesAsVisuallyNonEmpty, requiring that there are not still pending stylesheets in the head
1166         and that the document height is at least a minimum threshold. However, unlike the first visually non-empty
1167         layout, this milestone is never guaranteed to fire.
1168
1169         (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
1170         * page/FrameView.h:
1171         (WebCore::FrameView::incrementVisuallyNonEmptyCharacterCount):
1172         * page/LayoutMilestones.h:
1173
1174 2018-07-06  Timothy Hatcher  <timothy@apple.com>
1175
1176         Semantic colors don't update when accessibility Increase Contrast mode is enabled.
1177         https://bugs.webkit.org/show_bug.cgi?id=187425
1178         rdar://problem/39948240
1179
1180         Reviewed by Tim Horton.
1181
1182         Added a listener for the accessibility change notification to invalidate our color caches.
1183
1184         Removed calls to RenderTheme::singleton().platformColorsDidChange() in Page, since that
1185         ended up calling Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment multiple times.
1186         Instead, changed the functions to use the new instance version instead.
1187
1188         * page/Page.cpp:
1189         (WebCore::Page::updateStyleAfterChangeInEnvironment): Added. Gives Page a direct way to do this work
1190         per instance instead of on all pages (since appearance can be difference per view).
1191         (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment): Call updateStyleAfterChangeInEnvironment.
1192         (WebCore::Page::setUseSystemAppearance): Call updateStyleAfterChangeInEnvironment.
1193         (WebCore::Page::setUseDarkAppearance): Added. Call updateStyleAfterChangeInEnvironment.
1194         * page/Page.h:
1195         (WebCore::Page::setUseDarkAppearance): Moved to the implementation file.
1196         * platform/mac/LocalDefaultSystemAppearance.mm:
1197         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): Removed recursive check since it was interfering
1198         with the setting of m_usingDarkAppearance and causing the wrong color cache to be used.
1199         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): Ditto.
1200         * rendering/RenderThemeMac.mm:
1201         (-[WebCoreRenderThemeNotificationObserver init]): Listen for NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification.
1202         (-[WebCoreRenderThemeNotificationObserver systemColorsDidChange:]): Removed assert since multiple notifications are used now.
1203
1204 2018-07-06  Ryosuke Niwa  <rniwa@webkit.org>
1205
1206         Make ReasonForSuspension enum class
1207         https://bugs.webkit.org/show_bug.cgi?id=187405
1208
1209         Reviewed by Zalan Bujtas.
1210
1211         Made ReasonForSuspension an enum class instead of enum and moved out of ActiveDOMObject.
1212
1213         * Modules/geolocation/Geolocation.cpp:
1214         (WebCore::Geolocation::suspend):
1215         * Modules/websockets/WebSocket.cpp:
1216         (WebCore::WebSocket::suspend):
1217         * dom/ActiveDOMObject.h:
1218         * dom/Document.cpp:
1219         (WebCore::Document::didBecomeCurrentDocumentInFrame):
1220         (WebCore::Document::suspendActiveDOMObjects):
1221         (WebCore::Document::resumeActiveDOMObjects):
1222         (WebCore::Document::suspend):
1223         (WebCore::Document::resume):
1224         (WebCore::Document::suspendScheduledTasks):
1225         (WebCore::Document::resumeScheduledTasks):
1226         * dom/Document.h:
1227         * dom/ScriptExecutionContext.cpp:
1228         (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
1229         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
1230         * dom/ScriptExecutionContext.h:
1231         (WebCore::ScriptExecutionContext::reasonForSuspendingActiveDOMObjects const):
1232         * history/CachedFrame.cpp:
1233         (WebCore::CachedFrameBase::restore):
1234         (WebCore::CachedFrame::CachedFrame):
1235         * html/HTMLMediaElement.cpp:
1236         (WebCore::HTMLMediaElement::suspend):
1237         * html/HTMLSourceElement.cpp:
1238         (WebCore::HTMLSourceElement::suspend):
1239         * inspector/PageScriptDebugServer.cpp:
1240         (WebCore::PageScriptDebugServer::setJavaScriptPaused):
1241         * loader/FrameLoader.cpp:
1242         (WebCore::FrameLoader::commitProvisionalLoad):
1243         * page/Frame.cpp:
1244         (WebCore::Frame::suspendActiveDOMObjectsAndAnimations):
1245         (WebCore::Frame::resumeActiveDOMObjectsAndAnimations):
1246         * page/PageGroupLoadDeferrer.cpp:
1247         (WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer):
1248         (WebCore::PageGroupLoadDeferrer::~PageGroupLoadDeferrer):
1249         * xml/XMLHttpRequest.cpp:
1250         (WebCore::XMLHttpRequest::suspend):
1251
1252 2018-07-06  Nan Wang  <n_wang@apple.com>
1253
1254         AX: add a subrole for meter elements on macOS
1255         https://bugs.webkit.org/show_bug.cgi?id=187409
1256         <rdar://problem/41905702>
1257
1258         Reviewed by Chris Fleizach.
1259
1260         Test: accessibility/mac/meter-subrole.html
1261
1262         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1263         (-[WebAccessibilityObjectWrapper subrole]):
1264
1265 2018-07-06  Jeremy Jones  <jeremyj@apple.com>
1266
1267         For <video> element, use video fullscreen instead of element fullscreen.
1268         https://bugs.webkit.org/show_bug.cgi?id=186093
1269         rdar://problem/40144751
1270
1271         Reviewed by Jer Noble.
1272
1273         Some pages use webkitRequestFullscreen directly on the video element, without any custom controls.
1274         This will prevent native fullscreeen presentation mode conrols from being used.
1275
1276         This change makes webkitRequestFullscreen on a video element call webKitSetPresentationMode.
1277
1278         * dom/Element.h:
1279         * html/HTMLVideoElement.cpp:
1280         (WebCore::HTMLVideoElement::webkitRequestFullscreen):
1281         * html/HTMLVideoElement.h:
1282
1283 2018-07-06  Youenn Fablet  <youenn@apple.com>
1284
1285         WebRTC MediaStreamTrack Enable / Disable causes video delay / lag
1286         https://bugs.webkit.org/show_bug.cgi?id=186889
1287         <rdar://problem/41370285>
1288
1289         Reviewed by Eric Carlson.
1290
1291         Libwebrtc expects a continuous flow of calls for audio data since the API
1292         does not provide any possiblity to give timestamps.
1293
1294         We were optimizing previously when a source is muted so that we would not transmit audio data.
1295         This breaks synchronization between audio and video frames (which are timestamped).
1296
1297         This patch reverts the optimization and instead makes sure to send zeros for silenced audio tracks.
1298
1299         This requires MediaStreamTrackPrivate to send audio data even if disabled,
1300         so that RealtimeOutgoingAudioSource will continue sending zeros at the correct pace.
1301         This also requires WebAudioSourceProviderAVFObjC to exit early if its track is disabled.
1302
1303         Covered by existing tests.
1304         Manual testing shows that synchronization is kept.
1305
1306         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1307         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
1308         * platform/mediastream/RealtimeOutgoingAudioSource.cpp:
1309         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
1310         (WebCore::RealtimeOutgoingAudioSource::initializeConverter):
1311         (WebCore::RealtimeOutgoingAudioSource::stop):
1312         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
1313         (WebCore::RealtimeOutgoingAudioSource::sourceEnabledChanged):
1314         (WebCore::RealtimeOutgoingAudioSource::handleMutedIfNeeded): Deleted.
1315         * platform/mediastream/RealtimeOutgoingAudioSource.h:
1316         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
1317         (WebCore::RealtimeOutgoingAudioSource::isSilenced const):
1318         (WebCore::RealtimeOutgoingAudioSource::sendSilence): Deleted.
1319         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp:
1320         (WebCore::RealtimeOutgoingAudioSourceCocoa::pullAudioData):
1321         (WebCore::RealtimeOutgoingAudioSourceCocoa::handleMutedIfNeeded): Deleted.
1322         (WebCore::RealtimeOutgoingAudioSourceCocoa::sendSilence): Deleted.
1323         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h:
1324         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
1325         (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
1326
1327 2018-07-06  Youenn Fablet  <youenn@apple.com>
1328
1329         Make RealtimeOutgoingVideoSource use DestructionThread::Main
1330         https://bugs.webkit.org/show_bug.cgi?id=187402
1331
1332         Reviewed by Chris Dumez.
1333
1334         No change of behavior.
1335
1336         * platform/mediastream/RealtimeOutgoingVideoSource.h:
1337
1338 2018-07-06  Ryosuke Niwa  <rniwa@webkit.org>
1339
1340         Make HTMLMediaElement::remove*Track take a Ref<>&&
1341         https://bugs.webkit.org/show_bug.cgi?id=187407
1342
1343         Reviewed by Zalan Bujtas.
1344
1345         Make these functions take Ref<>&& since they can delete track objects.
1346
1347         * html/HTMLMediaElement.cpp:
1348         (WebCore::HTMLMediaElement::removeAudioTrack):
1349         (WebCore::HTMLMediaElement::removeTextTrack):
1350         (WebCore::HTMLMediaElement::removeVideoTrack):
1351         (WebCore::HTMLMediaElement::forgetResourceSpecificTracks):
1352         * html/HTMLMediaElement.h:
1353
1354 2018-07-06  Antoine Quint  <graouts@apple.com>
1355
1356         [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-002.html pass reliably
1357         https://bugs.webkit.org/show_bug.cgi?id=186502
1358         <rdar://problem/41000229>l
1359
1360         Reviewed by Dean Jackson.
1361
1362         Ensure we only attempt to convert defined objects or we risk to throw errors in valid situations.
1363
1364         * animation/KeyframeEffectReadOnly.cpp:
1365         (WebCore::processKeyframeLikeObject):
1366
1367 2018-07-05  Antoine Quint  <graouts@apple.com>
1368
1369         [Web Animations] Make WPT test at interfaces/Animation/finish.html pass reliably
1370         https://bugs.webkit.org/show_bug.cgi?id=186496
1371         <rdar://problem/41000179>
1372
1373         Reviewed by Dean Jackson.
1374
1375         We used to only resolve animations that had a target element, but animations need not have a target and their
1376         current time should still advance so that their finished promise may resolve. We now maintain a list of animations
1377         without targets and we iterate through them as well as animations with targets in DocumentTimeline::updateAnimations().
1378
1379         * animation/AnimationTimeline.cpp:
1380         (WebCore::AnimationTimeline::addAnimation):
1381         (WebCore::AnimationTimeline::removeAnimation):
1382         (WebCore::AnimationTimeline::animationWasAddedToElement):
1383         (WebCore::AnimationTimeline::animationWasRemovedFromElement):
1384         * animation/AnimationTimeline.h:
1385         (WebCore::AnimationTimeline:: const):
1386         * animation/DocumentTimeline.cpp:
1387         (WebCore::DocumentTimeline::updateAnimations):
1388         * animation/WebAnimation.cpp:
1389         (WebCore::WebAnimation::resolve):
1390         * animation/WebAnimation.h:
1391
1392 2018-07-05  Antoine Quint  <graouts@apple.com>
1393
1394         [Web Animations] Make WPT test at interfaces/Animation/finished.html pass reliably
1395         https://bugs.webkit.org/show_bug.cgi?id=186497
1396         <rdar://problem/41000193>
1397
1398         Reviewed by Dean Jackson.
1399
1400         We need to ensure the finished state is updated as a result of any timing property changing.
1401
1402         * animation/AnimationEffectReadOnly.cpp:
1403         (WebCore::AnimationEffectReadOnly::timingDidChange):
1404         * animation/WebAnimation.cpp:
1405         (WebCore::WebAnimation::effectTimingPropertiesDidChange):
1406         * animation/WebAnimation.h:
1407
1408 2018-07-06  Antoine Quint  <graouts@apple.com>
1409
1410         [Web Animations] Using a Web Animation leaks the Document
1411         https://bugs.webkit.org/show_bug.cgi?id=187088
1412         <rdar://problem/41392046>
1413
1414         Reviewed by Darin Adler.
1415
1416         Test: webanimations/leak-document-with-web-animation.html
1417
1418         We need to ensure that any remaining animation is cleared when the DocumentTimeline is detached from its Document.
1419         We rename WebAnimation::prepareAnimationForRemoval() to WebAnimation::remove() since it really actively disassociates
1420         the animation from its timeline.
1421
1422         An earlier version of this patch (r233349) was rolled out due to crashes caught in the ASan configuration. The following
1423         changes were made to make it safe:
1424
1425         - We protect the DocumentAnimationScheduler instance in displayRefreshFired() against code that might run in a
1426         requestAnimationFrame() callback that would trigger the object to be deleted.
1427
1428         - We protect the WebAnimation instance in remove() against setEffectInternal() or setTimelineInternal() potentially
1429         causing the object to be deleted. Similar protections were addede to setEffect() and setTimeline().
1430
1431         - We changed ~DocumentTimeline() to a default implementation to ensure it calls ~DisplayRefreshMonitorClient()
1432         to avoid callbacks after the object has been marked for deletion.
1433
1434
1435         * animation/AnimationTimeline.cpp:
1436         (WebCore::AnimationTimeline::removeAnimationsForElement): We no longer need the call to removeAnimation()
1437         since the new WebAnimation::remove() method will also set the timeline to null which will eventually call
1438         removeAnimation() on the disassociated timeline.
1439         * animation/DeclarativeAnimation.cpp:
1440         (WebCore::DeclarativeAnimation::remove):
1441         (WebCore::DeclarativeAnimation::prepareAnimationForRemoval): Deleted.
1442         * animation/DeclarativeAnimation.h:
1443         * animation/DocumentAnimationScheduler.cpp:
1444         (WebCore::DocumentAnimationScheduler::displayRefreshFired):
1445         * animation/DocumentTimeline.cpp:
1446         (WebCore::DocumentTimeline::detachFromDocument): Call remove() on all known animations.
1447         (WebCore::DocumentTimeline::~DocumentTimeline): Deleted.
1448         * animation/WebAnimation.cpp:
1449         (WebCore::WebAnimation::remove): Set the timeline to null to fully disassociate this animation from its timeline.
1450         (WebCore::WebAnimation::setEffect):
1451         (WebCore::WebAnimation::setEffectInternal):
1452         (WebCore::WebAnimation::setTimeline): Factor the internal timeline-association code out of this JS API method so
1453         that we can call this code without any JS-facing implications.
1454         (WebCore::WebAnimation::setTimelineInternal):
1455         (WebCore::WebAnimation::prepareAnimationForRemoval): Deleted.
1456         * animation/WebAnimation.h:
1457
1458 2018-07-06  Daniel Bates  <dabates@apple.com>
1459
1460         Remove Strong Confirmation Password button
1461         https://bugs.webkit.org/show_bug.cgi?id=187306
1462         <rdar://problem/41795185>
1463
1464         Reviewed by Sam Weinig.
1465
1466         Remove support for the Strong Confirmation Password button because we never made use of it.
1467
1468         * English.lproj/Localizable.strings:
1469         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1470         (-[WebAccessibilityObjectWrapper _accessibilityIsStrongPasswordField]):
1471         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1472         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1473         * html/HTMLInputElement.h:
1474         (WebCore::HTMLInputElement::hasAutoFillStrongPasswordButton const):
1475         * html/HTMLTextFormControlElement.h:
1476         * html/TextFieldInputType.cpp:
1477         (WebCore::autoFillButtonTypeToAccessibilityLabel):
1478         (WebCore::autoFillButtonTypeToAutoFillButtonText):
1479         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
1480         (WebCore::isAutoFillButtonTypeChanged):
1481         * platform/LocalizedStrings.cpp:
1482         (WebCore::AXAutoFillStrongConfirmationPasswordLabel): Deleted.
1483         * platform/LocalizedStrings.h:
1484         * rendering/RenderTextControlSingleLine.cpp:
1485         (WebCore::RenderTextControlSingleLine::layout):
1486         * testing/Internals.cpp:
1487         (WebCore::toAutoFillButtonType):
1488         (WebCore::toInternalsAutoFillButtonType):
1489         * testing/Internals.h:
1490         * testing/Internals.idl:
1491
1492 2018-07-06  Carlos Garcia Campos  <cgarcia@igalia.com>
1493
1494         [GTK][WPE] REGRESSION(r233239): proxy settings not applied after r233239
1495         https://bugs.webkit.org/show_bug.cgi?id=187381
1496
1497         Reviewed by Yusuke Suzuki.
1498
1499         This is because the static variable for proxy settings was replaced by a NeverDestroyed, but the function is not
1500         returning a reference, but a copy. This is causing several unit tests to fail.
1501
1502         * platform/network/soup/SoupNetworkSession.cpp:
1503         (WebCore::proxySettings):
1504
1505 2018-07-06  Frederic Wang  <fwang@igalia.com>
1506
1507         [Crash] Illegal use of uninitialized std::optional value in WebCore::AnimationBase::updateStateMachine
1508         https://bugs.webkit.org/show_bug.cgi?id=187382
1509
1510         Reviewed by Carlos Garcia Campos.
1511
1512         WebCore::AnimationBase::updateStateMachine has two potential places where the use of an
1513         uninitialized std:optional value is possible and one of them is hit when using Google drive.
1514         Since that old animation code is going to be removed soon, we just quickly patch this issue
1515         via value_or() so that we can restore the ASSERT added in bug 186536.
1516
1517         No new tests, code is going to be removed soon.
1518
1519         * page/animation/AnimationBase.cpp:
1520         (WebCore::AnimationBase::updateStateMachine): Use value_or(0) to avoid potential crashes.
1521
1522 2018-07-06  Frederic Wang  <fwang@igalia.com>
1523
1524         Rename HTMLTreeBuilder::didCreateCustomOrCallbackElement
1525         https://bugs.webkit.org/show_bug.cgi?id=187317
1526
1527         Reviewed by Ryosuke Niwa.
1528
1529         This function is called with a new custom element or the fallback HTMLUnknownElement element
1530         so we rename it didCreateCustomOrFallbackElement.
1531
1532         No new tests, behavior unchanged.
1533
1534         * html/parser/HTMLDocumentParser.cpp:
1535         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder):
1536         * html/parser/HTMLTreeBuilder.cpp:
1537         (WebCore::HTMLTreeBuilder::didCreateCustomOrFallbackElement):
1538         (WebCore::HTMLTreeBuilder::didCreateCustomOrCallbackElement): Deleted.
1539         * html/parser/HTMLTreeBuilder.h:
1540
1541 2018-07-05  Ryosuke Niwa  <rniwa@webkit.org>
1542
1543         REGRESSION(r233496): macOS Sierra hits debug assertions in TrackListBase::suspend
1544         https://bugs.webkit.org/show_bug.cgi?id=187378
1545         <rdar://problem/41878885>
1546
1547         Reviewed by Eric Carlson.
1548
1549         These assertions were wrong since inline debugger, alert, etc... can suspend active DOM objects without
1550         calling canSuspendForDocumentSuspension. Fixed the bug by removing the assertion and instead suspending
1551         and resuming the generic event queue.
1552
1553         * Modules/mediasource/MediaSource.cpp:
1554         (WebCore::MediaSource::suspend):
1555         (WebCore::MediaSource::resume):
1556         * Modules/mediasource/SourceBuffer.cpp:
1557         (WebCore::SourceBuffer::suspend):
1558         (WebCore::SourceBuffer::resume):
1559         * Modules/mediasource/SourceBufferList.cpp:
1560         (WebCore::SourceBufferList::suspend):
1561         (WebCore::SourceBufferList::resume):
1562         * html/track/TrackListBase.cpp:
1563         (WebCore::TrackListBase::suspend):
1564         (WebCore::TrackListBase::resume):
1565
1566 2018-07-05  Youenn Fablet  <youenn@apple.com>
1567
1568         REGRESSION (r230843): Flash doesn't work; Produces blue box on page
1569         https://bugs.webkit.org/show_bug.cgi?id=187346
1570         <rdar://problem/41773974>
1571
1572         Reviewed by Ryosuke Niwa.
1573
1574         Introduce clearPagesPluginData used by WebProcess when a plugin policy changes.
1575         Add a new internals API to get the plugin count as navigator.plugin is filtering plugins.
1576
1577         Test: http/tests/plugins/plugin-allow-then-reload.html
1578
1579         * plugins/PluginData.h:
1580         * plugins/PluginInfoProvider.cpp:
1581         (WebCore::PluginInfoProvider::clearPagesPluginData):
1582         * plugins/PluginInfoProvider.h:
1583         * testing/Internals.cpp:
1584         (WebCore::Internals::pluginCount):
1585         * testing/Internals.h:
1586         * testing/Internals.idl:
1587
1588 2018-07-05  Brady Eidson  <beidson@apple.com>
1589
1590         IndexedDB operations in a Page fail after a StorageProcess crash.
1591         <rdar://problem/41626526> and https://bugs.webkit.org/show_bug.cgi?id=187123
1592
1593         Reviewed by Alex Christensen.
1594
1595         Test: storage/indexeddb/modern/opendatabase-after-storage-crash.html
1596
1597         When the connection to a StorageProcess goes away, explicitly tell all of the WebPages
1598         in the WebProcess about it.
1599         
1600         This puts Documents/Workers in an error mode where requests fail instead of timeout.
1601         It also clears the Page's connection so *new* Documents and Workers will get a fresh 
1602         new connection that works.
1603         
1604         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
1605         (WebCore::IDBClient::IDBConnectionToServer::callResultFunctionLater):
1606         (WebCore::IDBClient::IDBConnectionToServer::deleteDatabase):
1607         (WebCore::IDBClient::IDBConnectionToServer::openDatabase):
1608         (WebCore::IDBClient::IDBConnectionToServer::createObjectStore):
1609         (WebCore::IDBClient::IDBConnectionToServer::deleteObjectStore):
1610         (WebCore::IDBClient::IDBConnectionToServer::renameObjectStore):
1611         (WebCore::IDBClient::IDBConnectionToServer::clearObjectStore):
1612         (WebCore::IDBClient::IDBConnectionToServer::createIndex):
1613         (WebCore::IDBClient::IDBConnectionToServer::deleteIndex):
1614         (WebCore::IDBClient::IDBConnectionToServer::renameIndex):
1615         (WebCore::IDBClient::IDBConnectionToServer::putOrAdd):
1616         (WebCore::IDBClient::IDBConnectionToServer::getRecord):
1617         (WebCore::IDBClient::IDBConnectionToServer::getAllRecords):
1618         (WebCore::IDBClient::IDBConnectionToServer::getCount):
1619         (WebCore::IDBClient::IDBConnectionToServer::deleteRecord):
1620         (WebCore::IDBClient::IDBConnectionToServer::openCursor):
1621         (WebCore::IDBClient::IDBConnectionToServer::iterateCursor):
1622         (WebCore::IDBClient::IDBConnectionToServer::establishTransaction):
1623         (WebCore::IDBClient::IDBConnectionToServer::commitTransaction):
1624         (WebCore::IDBClient::IDBConnectionToServer::didFinishHandlingVersionChangeTransaction):
1625         (WebCore::IDBClient::IDBConnectionToServer::abortTransaction):
1626         (WebCore::IDBClient::IDBConnectionToServer::didFireVersionChangeEvent):
1627         (WebCore::IDBClient::IDBConnectionToServer::confirmDidCloseFromServer):
1628         (WebCore::IDBClient::IDBConnectionToServer::connectionToServerLost):
1629         (WebCore::IDBClient::IDBConnectionToServer::openDBRequestCancelled):
1630         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionPendingClose):
1631         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionClosed):
1632         (WebCore::IDBClient::IDBConnectionToServer::abortOpenAndUpgradeNeeded):
1633         (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
1634         * Modules/indexeddb/client/IDBConnectionToServer.h:
1635
1636         * Modules/indexeddb/shared/IDBError.h:
1637         (WebCore::IDBError::serverConnectionLostError):
1638
1639         * page/Page.cpp:
1640         (WebCore::Page::setSessionID):
1641         (WebCore::Page::idbConnection):
1642         (WebCore::Page::optionalIDBConnection):
1643         (WebCore::Page::clearIDBConnection):
1644         * page/Page.h:
1645
1646 2018-07-05  Ryosuke Niwa  <rniwa@webkit.org>
1647
1648         Youtube video pages crash after a couple of minutes
1649         https://bugs.webkit.org/show_bug.cgi?id=187316
1650
1651         Reviewed by Antti Koivisto.
1652
1653         The crash was caused by HTMLMediaElement::stopWithoutDestroyingMediaPlayer invoking updatePlaybackControlsManager,
1654         which traverses all media players across different documents including the one in the main frame while its iframe
1655         is getting removed (to update the Touch Bar's media control).
1656
1657         Fixed the bug by making this code async in both stopWithoutDestroyingMediaPlayer and ~HTMLMediaElement. To do this,
1658         this patch moves the timer to update the playback controls manager from HTMLMediaElement to Page since scheduling
1659         a timer owned by HTMLMediaElement in its destructor wouldn't work as the timer would get destructed immediately.
1660
1661         Also replaced the call to clientWillPausePlayback by a call to stopSession in stopWithoutDestroyingMediaPlayer
1662         since the former also updates the layout synchronously via updateNowPlayingInfo; the latter function schedules
1663         a timer via scheduleUpdateNowPlayingInfo instead.
1664
1665         Test: media/remove-video-best-media-element-in-main-frame-crash.html
1666
1667         * html/HTMLMediaElement.cpp:
1668         (WebCore::HTMLMediaElement::~HTMLMediaElement): Call scheduleUpdatePlaybackControlsManager now that timer has been
1669         moved to Page.
1670         (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager): Made this return a RefPtr instead of
1671         a raw pointer while we're at it.
1672         (WebCore::HTMLMediaElement::clearMediaPlayer): Call scheduleUpdatePlaybackControlsManager.
1673         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto. Also invoke stopSession instead of
1674         clientWillPausePlayback on MediaSession since clientWillPausePlayback will synchronously try to update the layout.
1675         (WebCore::HTMLMediaElement::contextDestroyed):
1676         (WebCore::HTMLMediaElement::stop):
1677         (WebCore::HTMLMediaElement::schedulePlaybackControlsManagerUpdate): Renamed from scheduleUpdatePlaybackControlsManager.
1678         (WebCore::HTMLMediaElement::updatePlaybackControlsManager): Moved to Page::playbackControlsManagerUpdateTimerFired.
1679         * html/HTMLMediaElement.h:
1680         * page/Page.cpp:
1681         (WebCore::Page::Page):
1682         (WebCore::Page::schedulePlaybackControlsManagerUpdate): Added.
1683         (WebCore::Page::playbackControlsManagerUpdateTimerFired): Moved from HTMLMediaElement::updatePlaybackControlsManager.
1684         * page/Page.h:
1685         * testing/Internals.cpp:
1686         (WebCore::Internals::bestMediaElementForShowingPlaybackControlsManager):
1687         * testing/Internals.h:
1688
1689 2018-07-05  Ryosuke Niwa  <rniwa@webkit.org>
1690
1691         REGRESSION(r233496): Crash in WebCore::VideoTrack::clearClient()
1692         https://bugs.webkit.org/show_bug.cgi?id=187377
1693
1694         Reviewed by Simon Fraser.
1695
1696         Clear m_client of an audio track or a video track before removing it from the list
1697         since TrackListBase::m_inbandTracks may hold the last ref to the track.
1698
1699         * html/HTMLMediaElement.cpp:
1700         (WebCore::HTMLMediaElement::removeAudioTrack):
1701         (WebCore::HTMLMediaElement::removeVideoTrack):
1702
1703 2018-07-05  Fujii Hironori  <Hironori.Fujii@sony.com>
1704
1705         REGRESSION(r233495) [cairo] drawGlyphsShadow should use the fast path for zero blur-radius
1706         https://bugs.webkit.org/show_bug.cgi?id=187336
1707
1708         Reviewed by Carlos Garcia Campos.
1709
1710         drawGlyphsShadow has a fast path to draw a shadow without a shadow
1711         layer. Since r233495, it is not used for zero blur-radius shadow.
1712
1713         In Bug 187244, I changed ShadowState::isRequired not to check
1714         blur-radius is zero. This is not a right fix.
1715
1716         This change reverts r233495.
1717
1718         No new tests (Covered by existing tests).
1719
1720         * platform/graphics/cairo/CairoOperations.cpp:
1721         (WebCore::Cairo::ShadowState::isRequired const): Return false if
1722         'blur' is zero.
1723         (WebCore::Cairo::fillRectWithRoundedHole): Use
1724         ShadowState::isVisible instead of ShadowState::isRequired to check
1725         a shadow should be drawn.
1726
1727 2018-07-05  Timothy Hatcher  <timothy@apple.com>
1728
1729         Rename and flip the meaning of defaultAppearance to be useDarkAppearance.
1730         https://bugs.webkit.org/show_bug.cgi?id=187369
1731         rdar://problem/41870420
1732
1733         Reviewed by Tim Horton.
1734
1735         * Modules/mediasession/WebMediaSessionManager.cpp:
1736         (WebCore::WebMediaSessionManager::showPlaybackTargetPicker):
1737         * css/MediaQueryEvaluator.cpp:
1738         (WebCore::prefersDarkInterfaceEvaluate):
1739         * css/StyleColor.h:
1740         * dom/Document.cpp:
1741         (WebCore::Document::useDarkAppearance const):
1742         (WebCore::Document::styleColorOptions const):
1743         (WebCore::Document::useDefaultAppearance const): Deleted.
1744         * dom/Document.h:
1745         * inspector/InspectorOverlay.cpp:
1746         (WebCore::InspectorOverlay::paint):
1747         * page/Page.cpp:
1748         (WebCore::Page::useDarkAppearance const):
1749         (WebCore::Page::defaultAppearance const): Deleted.
1750         * page/Page.h:
1751         (WebCore::Page::setUseDarkAppearance):
1752         (WebCore::Page::setDefaultAppearance): Deleted.
1753         * platform/Theme.h:
1754         * platform/graphics/MediaPlaybackTargetPicker.h:
1755         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
1756         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
1757         (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker):
1758         * platform/mac/DragImageMac.mm:
1759         (WebCore::createDragImageForLink):
1760         * platform/mac/LocalDefaultSystemAppearance.h:
1761         * platform/mac/LocalDefaultSystemAppearance.mm:
1762         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
1763         * platform/mac/ThemeMac.h:
1764         * platform/mac/ThemeMac.mm:
1765         (WebCore::ThemeMac::paint):
1766         * platform/mock/MediaPlaybackTargetPickerMock.cpp:
1767         (WebCore::MediaPlaybackTargetPickerMock::showPlaybackTargetPicker):
1768         * platform/mock/MediaPlaybackTargetPickerMock.h:
1769         * rendering/InlineTextBox.cpp:
1770         (WebCore::InlineTextBox::resolveStyleForMarkedText):
1771         * rendering/RenderLayerBacking.cpp:
1772         (WebCore::RenderLayerBacking::paintContents):
1773         * rendering/RenderLayerCompositor.cpp:
1774         (WebCore::RenderLayerCompositor::paintContents):
1775         * rendering/RenderTheme.cpp:
1776         (WebCore::RenderTheme::paint):
1777         * rendering/RenderThemeMac.mm:
1778         (WebCore::RenderThemeMac::documentViewFor const):
1779         (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const):
1780         (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
1781         (WebCore::RenderThemeMac::supportsSelectionForegroundColors const):
1782         (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
1783         (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
1784         (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
1785         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
1786         (WebCore::RenderThemeMac::platformActiveListBoxSelectionForegroundColor const):
1787         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const):
1788         (WebCore::RenderThemeMac::platformActiveTextSearchHighlightColor const):
1789         (WebCore::RenderThemeMac::colorCache const):
1790         (WebCore::RenderThemeMac::systemColor const):
1791         (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
1792         (WebCore::RenderThemeMac::paintSliderThumb):
1793         * svg/graphics/SVGImage.cpp:
1794         (WebCore::SVGImage::draw):
1795
1796 2018-07-05  Commit Queue  <commit-queue@webkit.org>
1797
1798         Unreviewed, rolling out r233539.
1799         https://bugs.webkit.org/show_bug.cgi?id=187368
1800
1801         Changes made for youtube crashes has caused 15 api failures
1802         (Requested by Truitt on #webkit).
1803
1804         Reverted changeset:
1805
1806         "Youtube video pages crash after a couple of minutes"
1807         https://bugs.webkit.org/show_bug.cgi?id=187316
1808         https://trac.webkit.org/changeset/233539
1809
1810 2018-07-05  Chris Dumez  <cdumez@apple.com>
1811
1812         Update Element API to use qualifiedName instead of name/localName where applicable
1813         https://bugs.webkit.org/show_bug.cgi?id=187347
1814
1815         Reviewed by Darin Adler.
1816
1817         Update Element API to use qualifiedName instead of name/localName where applicable. Naming
1818         is now consistent with the IDL and the specification:
1819         - https://dom.spec.whatwg.org/#element
1820
1821         Our implementation properly deals with qualified names already, even though the parameters
1822         were named localName.
1823
1824         * dom/Element.cpp:
1825         (WebCore::Element::getAttribute const):
1826         (WebCore::Element::toggleAttribute):
1827         (WebCore::Element::setAttribute):
1828         (WebCore::Element::removeAttribute):
1829         (WebCore::Element::getAttributeNode):
1830         (WebCore::Element::hasAttribute const):
1831         * dom/Element.h:
1832
1833 2018-07-04  Ryosuke Niwa  <rniwa@webkit.org>
1834
1835         Youtube video pages crash after a couple of minutes
1836         https://bugs.webkit.org/show_bug.cgi?id=187316
1837
1838         Reviewed by Antti Koivisto.
1839
1840         The crash was caused by HTMLMediaElement::stopWithoutDestroyingMediaPlayer invoking updatePlaybackControlsManager,
1841         which traverses all media players across different documents including the one in the main frame while its iframe
1842         is getting removed (to update the Touch Bar's media control).
1843
1844         Fixed the bug by making this code async in both stopWithoutDestroyingMediaPlayer and ~HTMLMediaElement. To do this,
1845         this patch moves the timer to update the playback controls manager from HTMLMediaElement to Page since scheduling
1846         a timer owned by HTMLMediaElement in its destructor wouldn't work as the timer would get destructed immediately.
1847
1848         Also replaced the call to clientWillPausePlayback by a call to stopSession in stopWithoutDestroyingMediaPlayer
1849         since the former also updates the layout synchronously via updateNowPlayingInfo; the latter function schedules
1850         a timer via scheduleUpdateNowPlayingInfo instead.
1851
1852         Test: media/remove-video-best-media-element-in-main-frame-crash.html
1853
1854         * html/HTMLMediaElement.cpp:
1855         (WebCore::HTMLMediaElement::~HTMLMediaElement): Call scheduleUpdatePlaybackControlsManager now that timer has been
1856         moved to Page.
1857         (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager): Made this return a RefPtr instead of
1858         a raw pointer while we're at it.
1859         (WebCore::HTMLMediaElement::clearMediaPlayer): Call scheduleUpdatePlaybackControlsManager.
1860         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto. Also invoke stopSession instead of
1861         clientWillPausePlayback on MediaSession since clientWillPausePlayback will synchronously try to update the layout.
1862         (WebCore::HTMLMediaElement::contextDestroyed):
1863         (WebCore::HTMLMediaElement::stop):
1864         (WebCore::HTMLMediaElement::scheduleUpdatePlaybackControlsManager):
1865         (WebCore::HTMLMediaElement::updatePlaybackControlsManager): Moved to Page::schedulePlaybackControlsManagerUpdate.
1866         * html/HTMLMediaElement.h:
1867         * page/Page.cpp:
1868         (WebCore::Page::schedulePlaybackControlsManagerUpdate): Added.
1869         * page/Page.h:
1870         * testing/Internals.cpp:
1871         (WebCore::Internals::bestMediaElementForShowingPlaybackControlsManager):
1872         * testing/Internals.h:
1873
1874 2018-07-05  Zalan Bujtas  <zalan@apple.com>
1875
1876         Do not assume that hypen's width can be computed using the simplified text measure codepath.
1877         https://bugs.webkit.org/show_bug.cgi?id=187352
1878         <rdar://problem/40821283>
1879
1880         Reviewed by Simon Fraser.
1881
1882         Just because the text content is qualified for simplified text measure, it does not necessarily mean the hyphen is simple enough as well.
1883
1884         Test: fast/text/hyphen-is-complex-crash.html
1885
1886         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
1887         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
1888         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragmentIterator):
1889         * rendering/SimpleLineLayoutTextFragmentIterator.h:
1890
1891 2018-07-05  Eric Carlson  <eric.carlson@apple.com>
1892
1893         Video sometimes flickers when playing to AppleTV
1894         https://bugs.webkit.org/show_bug.cgi?id=187193
1895         <rdar://problem/40153865>
1896
1897         Unreviewed, fix a broken API test.
1898
1899         * platform/audio/ios/AudioSessionIOS.mm:
1900         (WebCore::AudioSession::setCategory): None should set the category to AVAudioSessionCategoryAmbient, 
1901         because it signals that WebKit is not playing audio so we want allow other apps to play.
1902
1903 2018-07-05  Per Arne Vollan  <pvollan@apple.com>
1904
1905         Use ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) in ScrollAnimatorMac.mm
1906         https://bugs.webkit.org/show_bug.cgi?id=187334
1907
1908         Reviewed by Alex Christensen.
1909
1910         Use ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) instead of __MAC_OS_X_VERSION_MIN_REQUIRED when deciding
1911         to use NSTimer or NSAnimation for scrollbar animation.
1912
1913         No new tests. No change in behavior.
1914
1915         * platform/mac/ScrollAnimatorMac.mm:
1916         (-[WebScrollbarPartAnimation initWithScrollbar:featureToAnimate:animateFrom:animateTo:duration:]):
1917         (-[WebScrollbarPartAnimation startAnimation]):
1918         (-[WebScrollbarPartAnimation setCurrentProgress:setCurrentProgress:]):
1919
1920 2018-07-05  Timothy Hatcher  <timothy@apple.com>
1921
1922         Don't invert text color for selections in light mode.
1923         https://bugs.webkit.org/show_bug.cgi?id=187349
1924         rdar://problem/41297946
1925
1926         Reviewed by Tim Horton.
1927
1928         Fix color caching in RenderTheme so we don't cache a dark mode color
1929         for a light appearance, or vise versa. Use the new color caching
1930         in RenderThemeMac, and clear the color caches in purgeCaches.
1931
1932         Allow supportsSelectionForegroundColors to conditionalize on StyleColor::Options.
1933         Return true only in dark mode.
1934
1935         * rendering/RenderTheme.cpp:
1936         (WebCore::RenderTheme::activeSelectionBackgroundColor const):
1937         (WebCore::RenderTheme::inactiveSelectionBackgroundColor const):
1938         (WebCore::RenderTheme::activeSelectionForegroundColor const):
1939         (WebCore::RenderTheme::inactiveSelectionForegroundColor const):
1940         (WebCore::RenderTheme::activeListBoxSelectionBackgroundColor const):
1941         (WebCore::RenderTheme::inactiveListBoxSelectionBackgroundColor const):
1942         (WebCore::RenderTheme::activeListBoxSelectionForegroundColor const):
1943         (WebCore::RenderTheme::inactiveListBoxSelectionForegroundColor const):
1944         (WebCore::RenderTheme::purgeCaches):
1945         (WebCore::RenderTheme::platformColorsDidChange):
1946         (WebCore::RenderTheme::activeTextSearchHighlightColor const):
1947         (WebCore::RenderTheme::inactiveTextSearchHighlightColor const):
1948         * rendering/RenderTheme.h:
1949         (WebCore::RenderTheme::supportsSelectionForegroundColors const):
1950         (WebCore::RenderTheme::supportsListBoxSelectionForegroundColors const):
1951         (WebCore::RenderTheme::colorCache const):
1952         (WebCore::RenderTheme::purgeCaches): Deleted.
1953         * rendering/RenderThemeMac.h:
1954         * rendering/RenderThemeMac.mm:
1955         (WebCore::RenderThemeMac::purgeCaches):
1956         (WebCore::RenderThemeMac::supportsSelectionForegroundColors const):
1957         (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
1958         (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
1959         (WebCore::RenderThemeMac::platformColorsDidChange):
1960         (WebCore::RenderThemeMac::colorCache const):
1961         (WebCore::RenderThemeMac::systemColor const):
1962
1963 2018-07-05  Zalan Bujtas  <zalan@apple.com>
1964
1965         SimpleLineLayout::FlowContents wastes 54KB of Vector capacity on nytimes.com
1966         https://bugs.webkit.org/show_bug.cgi?id=186709
1967         <rdar://problem/41173793>
1968
1969         Reviewed by Simon Fraser.
1970
1971         The size of the m_segments vector in SimpleLineLayoutFlowContents is alway pre-computed and don't change after the initial append.  
1972
1973         Not testable.
1974
1975         * rendering/SimpleLineLayoutFlowContents.h:
1976
1977 2018-07-05  Nan Wang  <n_wang@apple.com>
1978
1979         AX: setValue on text controls should send out key events
1980         https://bugs.webkit.org/show_bug.cgi?id=186690
1981         <rdar://problem/41169985>
1982
1983         Reviewed by Chris Fleizach.
1984
1985         Use Editor's insertText function when the text control element is being
1986         focused, so that the InputEvent will be dispatched properly.
1987
1988         Test: accessibility/mac/set-value-editable-dispatch-events.html
1989
1990         * accessibility/AccessibilityRenderObject.cpp:
1991         (WebCore::AccessibilityRenderObject::setValue):
1992
1993 2018-07-05  Chris Dumez  <cdumez@apple.com>
1994
1995         ASSERT(m_dictionaryStack.size() == 1) assertion hit in ~KeyedDecoderCF() when decoding fails
1996         https://bugs.webkit.org/show_bug.cgi?id=187152
1997
1998         Reviewed by Brent Fulgham.
1999
2000         Whenever a call to KeyedDecoderCF::beginArrayElement() succeeds (returns true), it
2001         appends an item to m_dictionaryStack which is expected to get popped later on via
2002         a matching call to KeyedDecoderCF::endArrayElement(). The ASSERT(m_dictionaryStack.size() == 1)
2003         assertion in the destructor protects against a begin / end mismatch.
2004
2005         However, there was a bug in KeyedDecoder::decodeObjects(), which would cause us to return early
2006         after a call to beginArrayElement() when the lambda function call returns false, causing us
2007         not to call the matching endArrayElement() in this case. This patch addresses the issue by
2008         calling endArrayElement() before returning early.
2009
2010         This bug was uncovered by r233309 which slightly changed the ITP encoding / decoding format.
2011         Because empty HashCountedSets are now expected to be encoded as empty array, decoding of old
2012         data fails and we hit the buggy code path.
2013
2014         * platform/KeyedCoding.h:
2015         (WebCore::KeyedDecoder::decodeObjects):
2016
2017 2018-07-05  Antti Koivisto  <antti@apple.com>
2018
2019         Move CSSParserContext to a file of its own
2020         https://bugs.webkit.org/show_bug.cgi?id=187342
2021
2022         Reviewed by Zalan Bujtas.
2023
2024         Move it out from CSSParserMode.h and CSSParser.cpp.
2025
2026         * Sources.txt:
2027         * WebCore.xcodeproj/project.pbxproj:
2028         * contentextensions/ContentExtensionParser.cpp:
2029         * css/PropertySetCSSStyleDeclaration.h:
2030         * css/StyleProperties.h:
2031         * css/StyleSheetContents.h:
2032         * css/parser/CSSDeferredParser.h:
2033         * css/parser/CSSParser.cpp:
2034         (WebCore::strictCSSParserContext): Deleted.
2035         (WebCore::CSSParserContext::CSSParserContext): Deleted.
2036         (WebCore::operator==): Deleted.
2037         * css/parser/CSSParser.h:
2038         * css/parser/CSSParserContext.cpp: Added.
2039         (WebCore::strictCSSParserContext):
2040         (WebCore::CSSParserContext::CSSParserContext):
2041         (WebCore::operator==):
2042
2043         Also add the missing textAutosizingEnabled bit.
2044
2045         * css/parser/CSSParserContext.h: Copied from Source/WebCore/css/parser/CSSParserMode.h.
2046         (WebCore::CSSParserContextHash::hash):
2047
2048         Also add the missing bits to the hash function.
2049         
2050         (WebCore::isQuirksModeBehavior): Deleted.
2051         (WebCore::isUASheetBehavior): Deleted.
2052         (WebCore::isUnitLessValueParsingEnabledForMode): Deleted.
2053         (WebCore::isCSSViewportParsingEnabledForMode): Deleted.
2054         (WebCore::strictToCSSParserMode): Deleted.
2055         (WebCore::isStrictParserMode): Deleted.
2056         * css/parser/CSSParserIdioms.h:
2057         * css/parser/CSSParserImpl.h:
2058         * css/parser/CSSParserMode.h:
2059         (WebCore::CSSParserContext::completeURL const): Deleted.
2060         (WebCore::operator!=): Deleted.
2061         (WebCore::CSSParserContextHash::hash): Deleted.
2062         (WebCore::CSSParserContextHash::equal): Deleted.
2063         (WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue): Deleted.
2064         (WTF::HashTraits<WebCore::CSSParserContext>::isDeletedValue): Deleted.
2065         (WTF::HashTraits<WebCore::CSSParserContext>::emptyValue): Deleted.
2066         * css/parser/CSSPropertyParserHelpers.h:
2067         * css/parser/CSSSelectorParser.cpp:
2068         * css/parser/CSSVariableParser.cpp:
2069
2070 2018-07-05  Antoine Quint  <graouts@apple.com>
2071
2072         [Web Animations] The ready promise should initially be resolved
2073         https://bugs.webkit.org/show_bug.cgi?id=187341
2074         <rdar://problem/41844711>
2075
2076         Reviewed by Dean Jackson.
2077
2078         The Web Animations spec mandates that the ready promise is initially resolved.
2079
2080         * animation/WebAnimation.cpp:
2081         (WebCore::WebAnimation::WebAnimation):
2082
2083 2018-07-05  Sergio Villar Senin  <svillar@igalia.com>
2084
2085         [WebVR] Fix VRDisplayEvent implementation
2086         https://bugs.webkit.org/show_bug.cgi?id=187337
2087
2088         Reviewed by Žan Doberšek.
2089
2090         VRDisplayEvent implementation had two issues. First there were no attributes storing the
2091         VRDisplay the event refers to. Secondly the VRDisplayEventReason is not mandatory so it
2092         should be handled via an optional.
2093
2094         * Modules/webvr/VRDisplayEvent.cpp:
2095         (WebCore::VRDisplayEvent::VRDisplayEvent):
2096         (WebCore::VRDisplayEvent::display const): Deleted.
2097         (WebCore::VRDisplayEvent::reason const): Deleted.
2098         * Modules/webvr/VRDisplayEvent.h:
2099
2100 2018-07-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2101
2102         REGRESSION(r233325): [GTK] Broke 40 animations tests
2103         https://bugs.webkit.org/show_bug.cgi?id=187264
2104
2105         Reviewed by Žan Doberšek.
2106
2107         This is because DocumentAnimationScheduler uses DisplayRefreshMonitor, that is only used by GTK port when
2108         accelerated compositing is enabled. Add a GTK display refresh monitor implementation to be used as the default.
2109
2110         * PlatformGTK.cmake: Add new file to compilation.
2111         * platform/graphics/DisplayRefreshMonitor.cpp:
2112         (WebCore::DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor): Create DisplayRefreshMonitorGtk in GTK.
2113         * platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp: Added.
2114         (WebCore::DisplayRefreshMonitorGtk::DisplayRefreshMonitorGtk):
2115         (WebCore::DisplayRefreshMonitorGtk::~DisplayRefreshMonitorGtk):
2116         (WebCore::onFrameClockUpdate):
2117         (WebCore::DisplayRefreshMonitorGtk::requestRefreshCallback):
2118         (WebCore::DisplayRefreshMonitorGtk::displayLinkFired):
2119         * platform/graphics/gtk/DisplayRefreshMonitorGtk.h: Added.
2120         (WebCore::DisplayRefreshMonitorGtk::create):
2121
2122 2018-07-04  Antti Koivisto  <antti@apple.com>
2123
2124         Reparse user stylesheets when _useSystemAppearance changes
2125         https://bugs.webkit.org/show_bug.cgi?id=187312
2126         <rdar://problem/38565834>
2127
2128         Reviewed by Tim Horton.
2129
2130         This setting may affect user stylesheet parsing. Reparse if it changes.
2131
2132         Test: fast/media/use-system-appearance-user-stylesheet-parsing.html
2133
2134         * page/Page.cpp:
2135         (WebCore::Page::setUseSystemAppearance):
2136         * page/Page.h:
2137         (WebCore::Page::setUseSystemAppearance): Deleted.
2138         * testing/Internals.cpp:
2139         (WebCore::Internals::setUseSystemAppearance):
2140         * testing/Internals.h:
2141         * testing/Internals.idl:
2142
2143 2018-07-04  Thibault Saunier  <tsaunier@igalia.com>
2144
2145         RealtimeIncomingVideoSources: Call stop() directly in the destructor
2146         https://bugs.webkit.org/show_bug.cgi?id=187303
2147
2148         Reviewed by Youenn Fablet.
2149
2150         Avoiding to call stopProducingData when we are not actually producing data.
2151
2152         This fixes tests that will run once the WPE/GTK PeerConnection implementation is merged.
2153
2154         * platform/mediastream/RealtimeIncomingVideoSource.h:
2155         (WebCore::RealtimeIncomingVideoSource::~RealtimeIncomingVideoSource):
2156
2157 2018-07-04  Thibault Saunier  <tsaunier@igalia.com>
2158
2159         [GTK][WPE] Stop pushing the StreamCollection as event in GStreamerMediaStreamSource
2160         https://bugs.webkit.org/show_bug.cgi?id=187304
2161
2162         Reviewed by Philippe Normand.
2163
2164         We let parsebin build the StreamCollection for us and pass extra metadata through the
2165         `TAG_EVENT` pushing the collection ourself is not bringing anything but adds extra work in the
2166         MediaPlayerGStreamer duplicating the STREAM_COLLECTION message for no good reason.
2167
2168         MediaStream layout tests already test that code path.
2169
2170         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
2171         (WebCore::webkitMediaStreamSrcPadProbeCb):
2172
2173 2018-07-04  Frederic Wang  <fwang@igalia.com>
2174
2175         [WebIDL] Remove custom bindings for HTMLDocument
2176         https://bugs.webkit.org/show_bug.cgi?id=173444
2177
2178         Unreviewed, add missing bugzilla link for FIXME comments.
2179
2180         * dom/Document.cpp:
2181         (WebCore::Document::closeForBindings):
2182         (WebCore::Document::write):
2183         (WebCore::Document::writeln):
2184
2185 2018-07-04  Tim Horton  <timothy_horton@apple.com>
2186
2187         Introduce PLATFORM(IOSMAC)
2188         https://bugs.webkit.org/show_bug.cgi?id=187315
2189
2190         Reviewed by Dan Bernstein.
2191
2192         * Configurations/Base.xcconfig:
2193         * Configurations/FeatureDefines.xcconfig:
2194         * Configurations/WebCore.xcconfig:
2195         * Modules/geolocation/ios/GeolocationPositionIOS.mm:
2196         (WebCore::GeolocationPosition::GeolocationPosition):
2197         * page/cocoa/MemoryReleaseCocoa.mm:
2198         (WebCore::platformReleaseMemory):
2199         * platform/audio/ios/AudioSessionIOS.mm:
2200         (WebCore::AudioSession::setCategory):
2201         (WebCore::AudioSession::routingContextUID const):
2202         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2203         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
2204         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
2205         * platform/ios/PlatformPasteboardIOS.mm:
2206         (WebCore::registerItemToPasteboard):
2207         * platform/ios/WebItemProviderPasteboard.mm:
2208         (-[WebItemProviderRegistrationInfoList itemProvider]):
2209
2210 2018-07-03  Antoine Quint  <graouts@apple.com>
2211
2212         [Web Animations] Make WPT test at timing-model/timelines/timelines.html pass reliably
2213         https://bugs.webkit.org/show_bug.cgi?id=186508
2214         <rdar://problem/41000260>
2215
2216         Reviewed by Dean Jackson.
2217
2218         The remaining failing assertion in this test assumes that the ready promise for an animation is fired
2219         prior to requestAnimationFrame callbacks being fired in the current event loop such that registering
2220         the requestAnimationFrame() call within the ready promise has its callback fired with the same timeline
2221         time. To ensure that is true, we perform a microtask checkpoint as soon as we're done running pending
2222         tasks, which will resolve the ready promise for any play-pending animations.
2223
2224         * animation/DocumentTimeline.cpp:
2225         (WebCore::DocumentTimeline::updateAnimations):
2226
2227 2018-07-03  Ryosuke Niwa  <rniwa@webkit.org>
2228
2229         Nullptr crash accessing Document in GenericEventQueue::dispatchOneEvent()
2230         https://bugs.webkit.org/show_bug.cgi?id=187284
2231
2232         Reviewed by Eric Carlson.
2233
2234         The null pointer crash was caused by some GenericEventQueue dispatching an event in a stopped document,
2235         which does not have a valid script execution context because some uses of GenericEventQueue in media code
2236         was not closing the queue upon stopping of all active DOM objects.
2237
2238         Fixed all uses of GenericEventQueue which did not suspend or stop the queue with active DOM objects.
2239         Made SourceBufferList and TrackListBase (along with AudioTrackList, TextTrackList, and VideoTrackList)
2240         inherit from ActiveDOMObject instead of ContextDestructionObserver to do this.
2241
2242         Also fixed a bug that media elements inside a template element (and other cases where the document doesn't
2243         have a browsing context) were scheduling events since this would hit the newly added debug assertion in
2244         GenericEventQueue::dispatchOneEvent.
2245
2246         Test: media/track/video-track-addition-and-frame-removal.html
2247
2248         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
2249         (WebCore::WebKitMediaKeySession::suspend): Assert that we never try to suspend when the document has
2250         this object alive since canSuspendForDocumentSuspension always returns false.
2251         (WebCore::WebKitMediaKeySession::resume): Ditto.
2252         (WebCore::WebKitMediaKeySession::stop): Stop the event queue to avoid the crash.
2253         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
2254         * Modules/mediasource/MediaSource.cpp:
2255         (WebCore::MediaSource::removeSourceBuffer): Don't do any work to update tracks when the active DOM
2256         objects are stopped since this MediaSource and the related media objects are about to be destructed.
2257         (WebCore::MediaSource::suspend): Assert that m_asyncEventQueue is empty as canSuspendForDocumentSuspension
2258         returns false whenever the queue is not empty.
2259         (WebCore::MediaSource::resume): Ditto.
2260         * Modules/mediasource/MediaSource.h:
2261         * Modules/mediasource/SourceBuffer.cpp:
2262         (WebCore::SourceBuffer::suspend): Ditto.
2263         (WebCore::SourceBuffer::resume): Ditto.
2264         (WebCore::SourceBuffer::stop): Stop the event queue to avoid the crash.
2265         * Modules/mediasource/SourceBuffer.h:
2266         * Modules/mediasource/SourceBufferList.cpp:
2267         (WebCore::SourceBufferList): Made this an active DOM object.
2268         (WebCore::SourceBufferList::SourceBufferList):
2269         (WebCore::SourceBufferList::canSuspendForDocumentSuspension const): Added. Return false when there are
2270         pending events to match other media code.
2271         (WebCore::SourceBufferList::suspend): Added. Assert that the event queue is empty here.
2272         (WebCore::SourceBufferList::resume): Ditto.
2273         (WebCore::SourceBufferList::stop): Added. Stop the event queue to avoid the crash.
2274         (WebCore::SourceBufferList::activeDOMObjectName const): Added.
2275         * Modules/mediasource/SourceBufferList.h:
2276         (WebCore::SourceBufferList): Made this an active DOM object.
2277         * Modules/mediasource/SourceBufferList.idl:
2278         * dom/Document.h:
2279         (WebCore::Document::hasBrowsingContext const): Added.
2280         * dom/GenericEventQueue.cpp:
2281         (WebCore::GenericEventQueue::dispatchOneEvent): Added an assertion to catch when an event is dispatched
2282         inside a stopped document, which is never correct and causes this crash down the line.
2283         * html/HTMLMediaElement.cpp:
2284         (WebCore::HTMLMediaElement::playInternal): Exit early when the document doesn't have a browsing context;
2285         e.g. when the media element is inside a template element.
2286         (WebCore::HTMLMediaElement::pauseInternal): Ditto.
2287         (WebCore::HTMLMediaElement::sourceWasAdded): Ditto.
2288         * html/track/AudioTrackList.cpp:
2289         (AudioTrackList::activeDOMObjectName const): Added.
2290         * html/track/AudioTrackList.h:
2291         * html/track/AudioTrackList.idl:
2292         * html/track/TextTrackList.cpp::
2293         (TextTrackList::activeDOMObjectName const): Added.
2294         * html/track/TextTrackList.h:
2295         * html/track/TextTrackList.idl:
2296         * html/track/TrackListBase.cpp:
2297         (WebCore::TrackListBase): Made this an active DOM object.
2298         (WebCore::TrackListBase::TrackListBase): 
2299         (WebCore::TrackListBase::canSuspendForDocumentSuspension const): Added. Return false when there are pending events
2300         to match other media code.
2301         (WebCore::TrackListBase::suspend): Added. Assert that the event queue is empty here.
2302         (WebCore::TrackListBase::resume): Ditto.
2303         (WebCore::TrackListBase::stop): Added. Stop the event queue to avoid the crash.
2304         * html/track/TrackListBase.h:
2305         * html/track/VideoTrackList.cpp:
2306         (VideoTrackList::activeDOMObjectName const): Added.
2307         * html/track/VideoTrackList.h:
2308         * html/track/VideoTrackList.idl:
2309
2310 2018-07-03  Fujii Hironori  <Hironori.Fujii@sony.com>
2311
2312         [cairo] Doesn't paint box-shadow with zero blur-radius
2313         https://bugs.webkit.org/show_bug.cgi?id=187244
2314
2315         Reviewed by Žan Doberšek.
2316
2317         Cairo::ShadowState::isRequired() returned false if blur-radius is
2318         zero.
2319
2320         No new tests (Covered by existing tests).
2321
2322         * platform/graphics/cairo/CairoOperations.cpp:
2323         (WebCore::Cairo::ShadowState::isRequired const): Do not check blur
2324         is zero.
2325
2326 2018-07-03  Ryosuke Niwa  <rniwa@webkit.org>
2327
2328         Add a release assert to diagnose infinite recursions in removeAllEventListeners()
2329         https://bugs.webkit.org/show_bug.cgi?id=187287
2330
2331         Reviewed by Keith Miller.
2332
2333         Assert that we never re-enter removeAllEventListeners per thread.
2334
2335         * dom/EventTarget.cpp:
2336         (WebCore::EventTarget::removeAllEventListeners):
2337         * platform/ThreadGlobalData.h:
2338         (WebCore::ThreadGlobalData::ThreadGlobalData::isInRemoveAllEventListeners const):
2339         (WebCore::ThreadGlobalData::ThreadGlobalData::setIsInRemoveAllEventListeners):
2340
2341 2018-07-03  Chris Dumez  <cdumez@apple.com>
2342
2343         performance-api/performance-observer-no-document-leak.html is flaky
2344         https://bugs.webkit.org/show_bug.cgi?id=186938
2345         <rdar://problem/41379336>
2346
2347         Reviewed by Simon Fraser.
2348
2349         Add internals API to get the identifier of a document and to ask if the document with
2350         a given identifier is still alive. This is helpful to write tests for document leaking
2351         fixes.
2352
2353         * testing/Internals.cpp:
2354         (WebCore::Internals::documentIdentifier const):
2355         (WebCore::Internals::isDocumentAlive const):
2356         * testing/Internals.h:
2357         * testing/Internals.idl:
2358
2359 2018-07-03  Chris Dumez  <cdumez@apple.com>
2360
2361         Improve window.event compliance: Should not be set when target is in shadow tree
2362         https://bugs.webkit.org/show_bug.cgi?id=186266
2363
2364         Reviewed by Ryosuke Niwa.
2365
2366         Stop exposing window.event to Shadow DOM by not setting window.event if the event's target
2367         is a Node inside a shadow tree. This is as per the latest DOM specification:
2368         - https://github.com/whatwg/dom/pull/407
2369
2370         This aligns our behavior with Blink as well:
2371         - https://bugs.chromium.org/p/chromium/issues/detail?id=779461
2372
2373         Tests: imported/w3c/web-platform-tests/dom/events/event-global.html
2374                imported/w3c/web-platform-tests/dom/events/event-global.worker.html
2375
2376         * bindings/js/JSEventListener.cpp:
2377         (WebCore::JSEventListener::handleEvent):
2378
2379 2018-07-03  Chris Dumez  <cdumez@apple.com>
2380
2381         [Cocoa] Disable vnode guard related simulated crashes for WKTR / DRT and WebSQL
2382         https://bugs.webkit.org/show_bug.cgi?id=187270
2383         <rdar://problem/40674034>
2384
2385         Reviewed by Geoffrey Garen.
2386
2387         Disable vnode guard related simulated crashes for WebSQL by setting the expected
2388         environment variable, if not already set by WKTR / DRT.
2389
2390         * Modules/webdatabase/DatabaseManager.cpp:
2391         (WebCore::DatabaseManager::initialize):
2392         (WebCore::DatabaseManager::platformInitialize):
2393         * Modules/webdatabase/DatabaseManager.h:
2394         * Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm: Added.
2395         (WebCore::DatabaseManager::paltformInitialize):
2396         * SourcesCocoa.txt:
2397         * WebCore.xcodeproj/project.pbxproj:
2398         * platform/FileSystem.h:
2399         * platform/posix/FileSystemPOSIX.cpp:
2400         (WebCore::FileSystem::realPath):
2401         * platform/win/FileSystemWin.cpp:
2402         (WebCore::FileSystem::realPath):
2403
2404 2018-07-03  Eric Carlson  <eric.carlson@apple.com>
2405
2406         Don't allow autoplay when the element is suspended
2407         https://bugs.webkit.org/show_bug.cgi?id=187299
2408         <rdar://problem/41044691>
2409
2410         Reviewed by Youenn Fablet.
2411         
2412         Block autoplay when a media element is suspended. Add more release logging to the methods
2413         that handle autoplay attempts to help diagnose future media playback problems.
2414
2415         * html/HTMLMediaElement.cpp:
2416         (WebCore::convertEnumerationToString): Convert PlaybackWithoutUserGesture to a string.
2417         (WebCore::HTMLMediaElement::dispatchPlayPauseEventsIfNeedsQuirks): Add logging.
2418         (WebCore::HTMLMediaElement::hardwareMutedStateDidChange): Ditto.
2419         (WebCore::HTMLMediaElement::handleAutoplayEvent): Ditto.
2420         (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay): Ditto.
2421         (WebCore::HTMLMediaElement::setPlaybackWithoutUserGesture): Ditto.
2422         * html/HTMLMediaElement.h:
2423         (WTF::LogArgument<WebCore::HTMLMediaElement::PlaybackWithoutUserGesture>::toString):
2424
2425         * html/MediaElementSession.cpp:
2426         (WebCore::MediaElementSession::playbackPermitted const): Playback is not permitted when the
2427         element is suspended.
2428         * html/MediaElementSession.h:
2429
2430 2018-07-03  Zalan Bujtas  <zalan@apple.com>
2431
2432         [LFC] Generate anonymous inline box for text content.
2433         https://bugs.webkit.org/show_bug.cgi?id=187301
2434
2435         Reviewed by Antti Koivisto.
2436
2437         Always have a inline container for text content (and no dedicated text renderer).
2438
2439         * layout/layouttree/LayoutInlineBox.cpp:
2440         (WebCore::Layout::InlineBox::InlineBox):
2441         * layout/layouttree/LayoutInlineBox.h:
2442         (WebCore::Layout::InlineBox::setContent):
2443         * layout/layouttree/LayoutTreeBuilder.cpp:
2444         (WebCore::Layout::TreeBuilder::createSubTree):
2445
2446 2018-07-03  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2447
2448         [Curl] Embed certificate information into ResourceResponse.
2449         https://bugs.webkit.org/show_bug.cgi?id=187102
2450
2451         Reviewed by Youenn Fablet.
2452
2453         No new tests but tested internally.
2454
2455         Collect certificate information from the communication and put them into
2456         ResourceResponse for the sake of advanced security checking and information
2457         providing to the user.
2458
2459         * platform/Curl.cmake:
2460         * platform/network/curl/CertificateInfo.cpp: Copied from Source/WebCore/platform/network/curl/CertificateInfo.h.
2461         (WebCore::CertificateInfo::CertificateInfo):
2462         (WebCore::CertificateInfo::isolatedCopy const):
2463         (WebCore::CertificateInfo::makeCertificate):
2464         * platform/network/curl/CertificateInfo.h:
2465         (WebCore::CertificateInfo::verificationError const):
2466         (WebCore::CertificateInfo::certificateChain const):
2467         (WebCore::operator==):
2468         (WebCore::CertificateInfo::CertificateInfo): Deleted.
2469         * platform/network/curl/CurlRequest.cpp:
2470         (WebCore::CurlRequest::didReceiveHeader):
2471         (WebCore::CurlRequest::didCompleteTransfer):
2472         * platform/network/curl/CurlRequest.h:
2473         (WebCore::CurlRequest::getCertificateInfo const):
2474         (WebCore::CurlRequest::getNetworkLoadMetrics const):
2475         (WebCore::CurlRequest::getNetworkLoadMetrics): Deleted.
2476         * platform/network/curl/CurlResourceHandleDelegate.cpp:
2477         (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse):
2478         (WebCore::CurlResourceHandleDelegate::curlDidComplete):
2479         * platform/network/curl/CurlSSLHandle.cpp:
2480         (WebCore::CurlSSLHandle::setHostAllowsAnyHTTPSCertificate):
2481         (WebCore::CurlSSLHandle::canIgnoredHTTPSCertificate):
2482         * platform/network/curl/CurlSSLHandle.h:
2483         * platform/network/curl/CurlSSLVerifier.cpp:
2484         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
2485         (WebCore::CurlSSLVerifier::verifyCallback):
2486         (WebCore::StackOfX509::StackOfX509): For RAII. Used in pemDataFromCtx().
2487         (WebCore::StackOfX509::~StackOfX509): Ditto.
2488         (WebCore::StackOfX509::count): Ditto.
2489         (WebCore::StackOfX509::item): Ditto.
2490         (WebCore::BIOHolder::BIOHolder): Ditto.
2491         (WebCore::BIOHolder::~BIOHolder): Ditto.
2492         (WebCore::BIOHolder::write): Ditto.
2493         (WebCore::BIOHolder::asCertificate): Ditto.
2494         (WebCore::pemDataFromCtx): Become simple static function.
2495         (WebCore::convertToSSLCertificateFlags): Ditto.
2496         (WebCore::CurlSSLVerifier::certVerifyCallback): Deleted.
2497         (WebCore::CurlSSLVerifier::getPemDataFromCtx): Deleted.
2498         (WebCore::CurlSSLVerifier::convertToSSLCertificateFlags): Deleted.
2499         * platform/network/curl/CurlSSLVerifier.h:
2500         (WebCore::CurlSSLVerifier::verificationError):
2501         (WebCore::CurlSSLVerifier::certificateChain const):
2502         * platform/network/curl/ResourceError.h:
2503         * platform/network/curl/ResourceErrorCurl.cpp:
2504         (WebCore::ResourceError::isSSLConnectError const):
2505         (WebCore::ResourceError::isSSLCertVerificationError const):
2506         (WebCore::ResourceError::hasSSLConnectError const): Deleted.
2507         * platform/network/curl/ResourceResponse.h:
2508         * platform/network/curl/ResourceResponseCurl.cpp:
2509         (WebCore::ResourceResponse::setCertificateInfo):
2510         (WebCore::ResourceResponse::setDeprecatedNetworkLoadMetrics):
2511
2512 2018-07-02  Simon Fraser  <simon.fraser@apple.com>
2513
2514         Clean up the layer volatility code and logging
2515         https://bugs.webkit.org/show_bug.cgi?id=187286
2516
2517         Reviewed by Tim Horton.
2518
2519         Export a function.
2520
2521         * platform/graphics/cocoa/IOSurface.h:
2522
2523 2018-07-03  Commit Queue  <commit-queue@webkit.org>
2524
2525         Unreviewed, rolling out r233112.
2526         https://bugs.webkit.org/show_bug.cgi?id=187300
2527
2528         this revision is causing crashes on iOS 11 simulator
2529         (Requested by Truitt on #webkit).
2530
2531         Reverted changeset:
2532
2533         "[Fullscreen] Restore ASSERT_NOT_REACHED() checks in exit
2534         fullscreen handler after r231924"
2535         https://bugs.webkit.org/show_bug.cgi?id=186945
2536         https://trac.webkit.org/changeset/233112
2537
2538 2018-07-03  Chris Dumez  <cdumez@apple.com>
2539
2540         Implement support for Element.toggleAttribute
2541         https://bugs.webkit.org/show_bug.cgi?id=186883
2542
2543         Reviewed by Sam Weinig.
2544
2545         Implement support for Element.toggleAttribute as per:
2546         - https://github.com/whatwg/dom/issues/461
2547         - https://dom.spec.whatwg.org/#dom-element-toggleattribute
2548
2549         This was already implemented in Blink:
2550         - https://bugs.chromium.org/p/chromium/issues/detail?id=854960
2551
2552         Edge expressed public support:
2553         - https://github.com/whatwg/dom/issues/461#issuecomment-398206390
2554
2555         Gecko is working on it:
2556         - https://bugzilla.mozilla.org/show_bug.cgi?id=1469592
2557
2558         * dom/Element.cpp:
2559         (WebCore::Element::toggleAttribute):
2560         * dom/Element.h:
2561         * dom/Element.idl:
2562
2563 2018-07-03  Zalan Bujtas  <zalan@apple.com>
2564
2565         [LFC] Implement minimum/maximum content width logic.
2566         https://bugs.webkit.org/show_bug.cgi?id=187241
2567
2568         Reviewed by Antti Koivisto.
2569
2570         Compute the minimum/maximum content width if needed and cache the values on the formatting state.
2571
2572         * layout/FormattingContext.cpp:
2573         (WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const):
2574         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
2575         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
2576         * layout/FormattingContext.h:
2577         * layout/FormattingContextGeometry.cpp:
2578         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
2579         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2580         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2581         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
2582         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
2583         (WebCore::Layout::shrinkToFitWidth): Deleted.
2584         * layout/FormattingState.cpp:
2585         (WebCore::Layout::FormattingState::FormattingState):
2586         * layout/FormattingState.h:
2587         (WebCore::Layout::FormattingState::setMinimumMaximumContentWidth):
2588         (WebCore::Layout::FormattingState::clearMinimumMaximumContentWidth):
2589         (WebCore::Layout::FormattingState::minimumMaximumContentWidth const):
2590         * layout/LayoutContext.cpp:
2591         (WebCore::Layout::LayoutContext::establishedFormattingState):
2592         * layout/LayoutContext.h:
2593         * layout/Verification.cpp:
2594         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
2595         * layout/blockformatting/BlockFormattingContext.cpp:
2596         (WebCore::Layout::BlockFormattingContext::createFormattingState const):
2597         (WebCore::Layout::BlockFormattingContext::minimumMaximumContentWidth const):
2598         * layout/blockformatting/BlockFormattingContext.h:
2599         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2600         (WebCore::Layout::BlockFormattingContext::Geometry::minimumMaximumContentWidthNeedsChildrenWidth):
2601         (WebCore::Layout::BlockFormattingContext::Geometry::minimumMaximumContentWidth):
2602         * layout/blockformatting/BlockFormattingState.cpp:
2603         (WebCore::Layout::BlockFormattingState::BlockFormattingState):
2604         * layout/blockformatting/BlockFormattingState.h:
2605         * layout/inlineformatting/InlineFormattingContext.cpp:
2606         (WebCore::Layout::InlineFormattingContext::createFormattingState const):
2607         (WebCore::Layout::InlineFormattingContext::minimumMaximumContentWidth const):
2608         * layout/inlineformatting/InlineFormattingContext.h:
2609         * layout/inlineformatting/InlineFormattingState.cpp:
2610         (WebCore::Layout::InlineFormattingState::InlineFormattingState):
2611         * layout/inlineformatting/InlineFormattingState.h:
2612         * page/FrameViewLayoutContext.cpp:
2613
2614 2018-07-03  Jonathan Bedard  <jbedard@apple.com>
2615
2616         Unreviewed, rolling out r233461.
2617
2618         Assertions triggered during iOS 11 debug layout and API tests
2619
2620         Reverted changeset:
2621
2622         "[iOS] Add assert to catch improper use of WebCore::Timer in
2623         UI Process"
2624         https://bugs.webkit.org/show_bug.cgi?id=185330
2625         https://trac.webkit.org/changeset/233461
2626
2627 2018-07-03  Jer Noble  <jer.noble@apple.com>
2628
2629         Update Fullscreen anti-phishing alert text
2630         https://bugs.webkit.org/show_bug.cgi?id=187199
2631         <rdar://problem/41162543>
2632
2633         Reviewed by Brent Fulgham.
2634
2635         * English.lproj/Localizable.strings:
2636
2637 2018-07-03  Frederic Wang  <fwang@igalia.com>
2638
2639         REGRESSION (r232186): Hardware-accelerated CSS animations using steps() timing function no longer work
2640         https://bugs.webkit.org/show_bug.cgi?id=186129
2641
2642         Reviewed by Antoine Quint.
2643
2644         When the WebAnimationsCSSIntegration flag is enabled, animating the transform property with
2645         a steps() timing function no longer works. This is because the WebAnimation code wrongly
2646         assumes that the transform property can always be accelerated (for counterexamples, see
2647         GraphicsLayerCA::animationCanBeAccelerated). For consistency with AnimationBase, we make
2648         WebAnimation fallback to non-accelerated mode when RenderBoxModelObject::startAnimation
2649         fails. This addresses the regression previously mentioned.
2650
2651         Test: http/wpt/css/css-animations/start-animation-001.html
2652
2653         * animation/KeyframeEffectReadOnly.cpp:
2654         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Fallback to
2655         non-accelerated mode if startAnimation failed.
2656
2657 2018-07-03  David Kilzer  <ddkilzer@apple.com>
2658
2659         [iOS] Add assert to catch improper use of WebCore::Timer in UI Process
2660         <https://webkit.org/b/185330>
2661         <rdar://problem/32816079>
2662
2663         Reviewed by Darin Adler.
2664
2665         * platform/RuntimeApplicationChecks.cpp:
2666         (WebCore::s_webKitProcessType): Add. Global to track process
2667         type.
2668         (WebCore::setWebKitProcessType): Implement new function that is
2669         called when initializing Web, Network, and Storage processes.
2670         (WebCore::isInNetworkProcess): Add.
2671         (WebCore::isInStorageProcess): Add.
2672         (WebCore::isInWebProcess): Add.
2673         - Check value in s_webKitProcessType to determine which process
2674           is currently running.
2675         * platform/RuntimeApplicationChecks.h:
2676         (WebCore::isInNetworkProcess): Add.
2677         (WebCore::isInStorageProcess): Add.
2678         (WebCore::isInWebProcess):
2679         - Make available for all platforms.
2680
2681         * platform/Timer.cpp:
2682         (WebCore::TimerBase::TimerBase): Add assert and os_log_fault.
2683         This catches the unwanted behavior on iOS using isAllowed().
2684         (WebCore::TimerBase::isAllowed): Add implementation.
2685         * platform/Timer.h:
2686         (WebCore::TimerBase::isAllowed): Add declaration.
2687
2688         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2689         (WebCore::isInWebProcess): Delete.  Replace with method in
2690         RuntimeApplicationChecks.cpp.
2691
2692 2018-07-02  Antti Koivisto  <antti@apple.com>
2693
2694         Tighter limit for canvas memory use on iOS
2695         https://bugs.webkit.org/show_bug.cgi?id=187279
2696         <rdar://problem/38420562>
2697
2698         Reviewed by Simon Fraser.
2699
2700         We allowed 448MB of canvas buffer memory. This is still too much in some cases. Painting a large
2701         canvas may also requires several other temporary canvas sized buffers getting us easily over
2702         the process size limit.
2703
2704         * html/HTMLCanvasElement.cpp:
2705         (WebCore::maxActivePixelMemory):
2706
2707         Drop to (ramSize() / 4) which computes to 224MB on 2GB devices.
2708
2709 2018-07-02  Myles C. Maxfield  <mmaxfield@apple.com>
2710
2711         [Cocoa] Google Fonts doesn't work if the user has the requested font locally-installed
2712         https://bugs.webkit.org/show_bug.cgi?id=187228
2713         <rdar://problem/40967280>
2714
2715         Reviewed by Brent Fulgham.
2716
2717         This is due to the local() items in the src: descriptor in the @font-family blocks.
2718
2719         This is because of a behavior difference between CSSFontFaceSource::load() and CSSFontFaceSource::font().
2720         load() is supposed to set the status() to Success iff the font can be used, and then CSSFontFaceSource::font()
2721         is supposed to return the font itself to use. load() works by constructing a dummy FontDescription and
2722         performing a system lookup (to see if the local font really exists). However, this dummy FontDescription
2723         doesn't set the ShouldAllowUserInstalledFonts flag. Then, in CSSFontFaceSource::font(), a similar lookup is
2724         performed, except this one has the original FontDescription (with the correct value of the
2725         ShouldAllowUserInstalledFonts flag set. Therefore, the two functions disagree about the state of the flag.
2726
2727         When the CSSFontFaceSource's status gets set to Success, that means "this is the font face source that
2728         represents the @font-face block" but when CSSFontFaceSource::font() returns nullptr, that means "The font face
2729         source can't be used for some reason" so we then continue searching down the font-family list (and render the
2730         text in Helvetica or whatever comes next).
2731
2732         The solution is simple - just set the ShouldAllowUserInstalledFonts flag correctly in the dummy
2733         FontDescription.
2734
2735         Test: fast/text/user-installed-fonts/local.html
2736
2737         * css/CSSFontFace.cpp:
2738         (WebCore::CSSFontFace::allowUserInstalledFonts const):
2739         * css/CSSFontFace.h:
2740         * css/CSSFontFaceSet.cpp:
2741         (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
2742         * css/CSSFontFaceSource.cpp:
2743         (WebCore::CSSFontFaceSource::load):
2744
2745 2018-06-29  Ryosuke Niwa  <rniwa@webkit.org>
2746
2747         Generate event and event target interface types directly instead of via macros
2748         https://bugs.webkit.org/show_bug.cgi?id=187215
2749
2750         Reviewed by Chris Dumez.
2751
2752         Made make_event_factory.pl directly generate EventInterface enum values and toJSNewlyCreated for Event,
2753         and EventTargetInterface enum values and toJS for EventTarget. Removed the code to generate EventFactory::create
2754         since it was never even compiled or used anywhere.
2755
2756         This patch faithfully replicates what the macro used to generate but we should consider always generating either
2757         toJS or toJSNewlyCreated for both interfaces in the future.
2758
2759         No new tests since there should be no observable behavioral changes.
2760
2761         * DerivedSources.make: Generate EventTargetFactory.cpp, which is used to generate toJS function for EventTarget.
2762         * Sources.txt:
2763         * WebCore.xcodeproj/project.pbxproj:
2764         * bindings/js/JSEventCustom.cpp:
2765         (WebCore::toJSNewlyCreated): Deleted. Now generated directly in EventFactory.cpp.
2766         * bindings/js/JSEventTargetCustom.cpp:
2767         (WebCore::JSEventTarget::toWrapped): Removed the use of TRY_TO_UNWRAP_WITH_INTERFACE.
2768         (WebCore::toJS): Deleted. Now generated directly in EventFactory.cpp.
2769         * bindings/scripts/InFilesCompiler.pm:
2770         (generateInterfacesHeader): Use #pragma once. Generate enum values directly. Added the support for suffixing
2771         each type name with namespace for EventTarget.
2772         * dom/Event.h: Removed the declaration of EventInterface enum. It's now directly generated in EventInterfaces.h
2773         * dom/EventNames.in: Generate toJSNewlyCreated.
2774         * dom/EventTarget.h: Removed the declaration of EventTargetInterface as it's now done in EventTargetInterfaces.h.
2775         * dom/EventTargetFactory.in: Generate toJS.
2776         * dom/make_event_factory.pl:
2777         (defaultParameters): Added two new options. factoryFunction specifies whether toJS or toJSNewlyCreated is generated,
2778         and useNamespaceAsSuffix specifies whether each entry should be suffixed by the namespace (used by EventTarget).
2779         (generateCode): Added a missing semicolon.
2780         (generateImplementation): Removed the early exit for EventTarget since we now need to generate its toJS function.
2781         Replaced the code to generate EventFactory::create by the one to generate toJS / toJSNewlyCreated.
2782
2783 2018-07-02  Zalan Bujtas  <zalan@apple.com>
2784
2785         HTML widget displays blank when playing on page
2786         https://bugs.webkit.org/show_bug.cgi?id=187272
2787         <rdar://problem/39317899>
2788
2789         Reviewed by Simon Fraser.
2790
2791         When a composited layer gains content (in this particular case, going from NoContentsLayer to ContentsLayerForMedia),
2792         we need to size the associated graphics layer accordingly (NoContentsLayer means zero sized graphics layer).  
2793
2794         Not testable on iOS.
2795
2796         * rendering/RenderLayerBacking.cpp:
2797         (WebCore::RenderLayerBacking::updateConfiguration):
2798
2799 2018-07-02  David Kilzer  <ddkilzer@apple.com>
2800
2801         Refactor InlineTextBox::emphasisMarkExistsAndIsAbove()
2802         <https://webkit.org/b/187204>
2803
2804         Reviewed by Darin Adler.
2805
2806         No new tests since there is no change in behavior.
2807
2808         Refactor emphasisMarkExistsAndIsAbove() to return a
2809         std::optional<bool> instead of returning a bool and taking a
2810         std::optional<bool> argument.  The state returned is now:
2811         - std::nullopt => emphasis mark doesn't exist or is suppressed.
2812         - false => emphasis mark exists and is not suppressed, but is not above.
2813         - true => emphasis mark exists and is not suppressed, and is above.
2814
2815         * rendering/InlineFlowBox.cpp:
2816         (WebCore::InlineFlowBox::placeBoxesInBlockDirection):
2817         (WebCore::InlineFlowBox::addTextBoxVisualOverflow):
2818         (WebCore::InlineFlowBox::computeOverAnnotationAdjustment const):
2819         (WebCore::InlineFlowBox::computeUnderAnnotationAdjustment const):
2820         - Update for refactored method.  Remove some redundant checks
2821           for TextEmphasisMark::None that already happen in
2822           emphasisMarkExistsAndIsAbove().
2823         * rendering/InlineTextBox.cpp:
2824         (WebCore::emphasisPositionHasNeitherLeftNorRight): Delete.
2825         - Replaced by an OptionSet<TextEmphasisPosition>.
2826         (WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const):
2827         - Refactor as described above.
2828         (WebCore::InlineTextBox::paintMarkedTextForeground):
2829         - Update for refactored method.
2830         * rendering/InlineTextBox.h:
2831         (WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const):
2832         - Update for new method signature.
2833
2834 2018-07-02  Megan Gardner  <megan_gardner@apple.com>
2835
2836         Enable copy paste on iOS apps for Mac
2837         https://bugs.webkit.org/show_bug.cgi?id=187194
2838         <rdar://problem/41451148>
2839
2840         Reviewed by Darin Adler.
2841
2842         Difficult to test this platform.
2843
2844         UIKit doesn't support itemProviders for iOS apps for Mac, so we need to revert to the
2845         older way of setting a dictionary of objects and keys for items. Not everything is
2846         availble in this form, and we haven't cleaned up our itemProvider code yet, so we 
2847         need to case some things out for now. Hopefully in the future, this will be implmented
2848         and can just work as expected, but for now, this is the best workaround.
2849
2850         * platform/ios/PlatformPasteboardIOS.mm:
2851         (WebCore::registerItemToPasteboard):
2852         (WebCore::PlatformPasteboard::write):
2853         (WebCore::PlatformPasteboard::readURL):
2854         * platform/ios/WebItemProviderPasteboard.h:
2855         * platform/ios/WebItemProviderPasteboard.mm:
2856         (-[WebItemProviderRegistrationInfoList itemProvider]):
2857
2858 2018-07-02  Eric Carlson  <eric.carlson@apple.com>
2859
2860         Video sometimes flickers when playing to AppleTV
2861         https://bugs.webkit.org/show_bug.cgi?id=187193
2862         <rdar://problem/40153865>
2863
2864         Reviewed by Jer Noble and Youenn Fablet.
2865         
2866         No new tests, existing test updated.
2867
2868         Delay 100ms before changing the iOS audio session category because it is an expensive and
2869         potentially disruptive operation, and changing an audio or video element configuration
2870         can result in several quick, ultimately unnecessary, category changes.
2871
2872         * platform/audio/PlatformMediaSession.cpp:
2873         (WebCore::PlatformMediaSession::clientWillBeginPlayback): Add logging.
2874
2875         * platform/audio/PlatformMediaSessionManager.cpp:
2876         (WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager): Initialize timer.
2877         (WebCore::PlatformMediaSessionManager::removeSession): Deactivate audio session when there
2878         are no sessions.
2879         (WebCore::PlatformMediaSessionManager::updateSessionStateTimerFired): New, update session now.
2880         (WebCore::PlatformMediaSessionManager::updateSessionState): Add parameter.
2881         * platform/audio/PlatformMediaSessionManager.h:
2882
2883         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
2884         (PlatformMediaSessionManager::updateSessionState): Defer update if it isn't supposed to happen
2885         immediately.
2886
2887         * platform/audio/ios/AudioSessionIOS.mm:
2888         (WebCore::AudioSession::setCategory): Drive-by: setting the audio category to nil is a noop,
2889         so don't waste time doing it.
2890         (WebCore::AudioSession::tryToSetActive): Allow other apps to resume playback when we deactivate
2891         the audio session.
2892
2893         * platform/Timer.h:
2894         (WebCore::DeferrableOneShotTimer): Add WTF_MAKE_FAST_ALLOCATED so it can be used in a unique_ptr.
2895
2896 2018-07-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2897
2898         Clean up some spellchecking code
2899         https://bugs.webkit.org/show_bug.cgi?id=187238
2900
2901         Reviewed by Tim Horton.
2902
2903         A few minor tweaks to modernize some spellchecking code. No change in behavior.
2904
2905         * editing/AlternativeTextController.cpp:
2906         (WebCore::AlternativeTextController::timerFired):
2907         * editing/Editor.cpp:
2908         (WebCore::Editor::markMisspellingsAfterTypingToWord):
2909
2910         Use move semantics when passing Ranges to markAllMisspellingsAndBadGrammarInRanges.
2911
2912         (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
2913
2914         Change this to take RefPtr<Range>&& instead of Range*.
2915
2916         (WebCore::Editor::markMisspellingsAndBadGrammar):
2917
2918         Remove an unnecessary call to `RefPtr::get()`.
2919
2920         * editing/Editor.h:
2921         * editing/TextCheckingHelper.cpp:
2922         (WebCore::TextCheckingParagraph::invalidateParagraphRangeValues):
2923         (WebCore::TextCheckingParagraph::checkingStart const):
2924         (WebCore::TextCheckingParagraph::checkingEnd const):
2925         (WebCore::TextCheckingParagraph::checkingLength const):
2926         (WebCore::TextCheckingParagraph::automaticReplacementStart const):
2927         (WebCore::TextCheckingParagraph::automaticReplacementLength const):
2928
2929         Currently, all of these cached range offsets are `int`s, and use a value of -1 to denote that their values are
2930         missing and must be recomputed. Instead, make these `std::optional`s and let `std::nullopt` represent the
2931         missing value.
2932
2933         * editing/TextCheckingHelper.h:
2934
2935 2018-07-02  Antoine Quint  <graouts@apple.com>
2936
2937         Crash in WebCore::WebAnimation::timeToNextRequiredTick when running imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/animate-no-browsing-context.html
2938         https://bugs.webkit.org/show_bug.cgi?id=187145
2939
2940         Reviewed by Dean Jackson.
2941
2942         Ensure we have a resolved time value before trying to use it.
2943
2944         * animation/WebAnimation.cpp:
2945         (WebCore::WebAnimation::timeToNextRequiredTick const):
2946
2947 2018-07-02  Antoine Quint  <graouts@apple.com>
2948
2949         [Web Animations] Crash in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
2950         https://bugs.webkit.org/show_bug.cgi?id=187139
2951
2952         Reviewed by Dean Jackson.
2953
2954         Ensure we have a resolved time value before trying to use it.
2955
2956         * animation/KeyframeEffectReadOnly.cpp:
2957         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
2958
2959 2018-07-02  Youenn Fablet  <youenn@apple.com>
2960
2961         Reject getUserMedia promise if capture fails
2962         https://bugs.webkit.org/show_bug.cgi?id=187190
2963
2964         Reviewed by Eric Carlson.
2965
2966         In case PendingActivationMediaStream is notified of a change,
2967         Check whether any track failed to capture.
2968         If so, reject the promise.
2969         Add more release logging in error case.
2970
2971         Covered by manual testing.
2972
2973         * Modules/mediastream/UserMediaRequest.cpp:
2974         (WebCore::UserMediaRequest::PendingActivationMediaStream::~PendingActivationMediaStream):
2975         (WebCore::UserMediaRequest::PendingActivationMediaStream::characteristicsChanged):
2976         (WebCore::UserMediaRequest::mediaStreamIsReady):
2977         (WebCore::UserMediaRequest::mediaStreamDidFail):
2978         * Modules/mediastream/UserMediaRequest.h:
2979         * platform/mediastream/MediaStreamPrivate.h:
2980         * platform/mediastream/RealtimeMediaSource.cpp:
2981         (WebCore::RealtimeMediaSource::captureFailed):
2982         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2983         (WebCore::AVVideoCaptureSource::setupCaptureSession):
2984
2985 2018-07-01  Fujii Hironori  <Hironori.Fujii@sony.com>
2986
2987         [WK2] fast/parser/document-open-in-unload.html makes the following test crash
2988         https://bugs.webkit.org/show_bug.cgi?id=98345
2989         <rdar://problem/12474923>
2990
2991         Reviewed by Ryosuke Niwa.
2992
2993         m_documentLoader can become null in the middle of
2994         FrameLoader::commitProvisionalLoad by stopping the loading.
2995
2996         No new tests (Covered by existing tests).
2997
2998         * loader/FrameLoader.cpp:
2999         (WebCore::FrameLoader::commitProvisionalLoad): Do null check of m_documentLoader.
3000
3001 2018-07-01  Myles C. Maxfield  <mmaxfield@apple.com>
3002
3003         [Cocoa] LastResort in the font family list causes emoji with joiners to be rendered as multiple .notdef characters
3004         https://bugs.webkit.org/show_bug.cgi?id=187209
3005         <rdar://problem/40920785>
3006
3007         Reviewed by Darin Adler.
3008
3009         Inside our complex text codepath, we perform our own font fallback, which
3010         includes a function that asks "can this font support this grapheme cluster?"
3011         Because of the mechanics of how fonts work, the implementation of this
3012         function is "Does the font's cmap table support every character of the
3013         cluster?" We were using Font::glyphForCharacter() to determine this; however,
3014         this function maps certain control characters to the zero width space
3015         character (with the intention that these control characters shouldn't be
3016         visible in the fast text codepath). That replacement, however, was causing
3017         us to get false negatives, because Apple Color Emoji doesn't support zero
3018         width space. Therefore, Apple Color Emoji was looking like it didn't support
3019         emoji combining sequences.
3020
3021         The best solution to this would be to get Font::glyphForCharacter() to stop
3022         performing these replacements (see https://bugs.webkit.org/show_bug.cgi?id=187166).
3023         However, that is too risky of a change to be making right now. Instead,
3024         a more localized solution is to implement a version of "Does the font's cmap
3025         table support every character of the cluster" that doesn't perform the
3026         substitutions. This patch does exactly that, and uses a bit vector to cache
3027         the results. In order to not have a giant bit vector, we take the old code
3028         path if we know the substitutions won't affect us (and uses ASSERT()s to 
3029         validate this) so the bit vector only holds at maximum 3 words of storage.
3030
3031         Test: fast/text/emoji-with-joiner.html
3032
3033         * platform/graphics/Font.cpp:
3034         (WebCore::codePointSupportIndex):
3035         (WebCore::createAndFillGlyphPage):
3036         (WebCore::Font::platformSupportsCodePoint const):
3037         (WebCore::Font::supportsCodePoint const):
3038         (WebCore::Font::canRenderCombiningCharacterSequence const):
3039         * platform/graphics/Font.h:
3040         * platform/graphics/cocoa/FontCocoa.mm:
3041         (WebCore::Font::platformSupportsCodePoint const):
3042
3043 2018-07-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3044
3045         [macOS] Text replacements that end with symbols are expanded immediately
3046         https://bugs.webkit.org/show_bug.cgi?id=187225
3047         <rdar://problem/41112433>
3048
3049         Reviewed by Darin Adler.
3050
3051         In shipping Safari, enabling grammar correction causes text shortcuts that end with symbols or punctuation marks
3052         to immediately trigger when typing; normally, when grammar correction is off, this is only triggered after the
3053         user has additionally inserted a punctuation mark or whitespace character after the replaced text.
3054
3055         This bug happens because enabling grammar checking causes the spell checking range to expand to the range of the
3056         full sentence, so any text checking results that replace an existing range are triggered as long as they end
3057         anywhere in the sentence. In contrast, when grammar checking is disabled, the spell checking range is limited to
3058         the nearest adjacent word, which prevents text replacement from occurring elsewhere in the sentence.
3059
3060         However, after r232530, we now always expand the spell checking range to the extent of the sentence when a word
3061         is typed regardless of whether grammar checking is enabled, which means that the issue described above now
3062         happens everywhere. To fix this recent regression and the existing bug, we:
3063
3064         -   Augment our spellchecking codepaths to include a new automatic text replacement range, alongside
3065             spellchecking and paragraph ranges.
3066         -   Let this automatic text replacement range be the range of the adjacent word in the case where the user has
3067             finished typing a word.
3068         -   When marking and replacing text checking results, consult this new automatic text replacement instead of the
3069             spellchecking range.
3070
3071         This keeps the behavior grammar and sentence retro correction results intact, while limiting the scope in which
3072         text replacement results are applied.
3073
3074         Test: editing/spelling/text-replacement-after-typing-to-word.html
3075
3076         * editing/AlternativeTextController.cpp:
3077         (WebCore::AlternativeTextController::timerFired):
3078         * editing/Editor.cpp:
3079         (WebCore::Editor::replaceSelectionWithFragment):
3080         (WebCore::Editor::markMisspellingsAfterTypingToWord):
3081
3082         Pass in the adjacent word range for the `automaticReplacementRange`, instead of the spell checking range (which
3083         may be extended to the full range of the sentence).
3084
3085         (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
3086
3087         Add an `automaticReplacementRange` argument to markAllMisspellingsAndBadGrammarInRanges, and adjust call sites
3088         to pass in a range (generally the same as the spell checking range, but in the case where a word has been typed,
3089         this is a narrower range).
3090
3091         (WebCore::correctSpellcheckingPreservingTextCheckingParagraph):
3092         (WebCore::Editor::markAndReplaceFor):
3093
3094         When replacing text, only allow text replacement in the automatic replacement range rather than the spell
3095         checking range.
3096
3097         (WebCore::Editor::markMisspellingsAndBadGrammar):
3098         * editing/Editor.h:
3099         * editing/SpellChecker.cpp:
3100         (WebCore::SpellCheckRequest::SpellCheckRequest):
3101
3102         Add a new version of this constructor that takes a single Range representing both the spellchecking range and
3103         the automatic text replacement range, for convenience.
3104
3105         (WebCore::SpellCheckRequest::create):
3106         * editing/SpellChecker.h:
3107
3108         Add plumbing for the automatic replacement range.
3109
3110         (WebCore::SpellCheckRequest::automaticReplacementRange const):
3111         * editing/TextCheckingHelper.cpp:
3112
3113         Add plumbing for the automatic replacement range, and new helpers to locate the range as offsets within the
3114         text checking paragraph range.
3115
3116         (WebCore::TextCheckingParagraph::TextCheckingParagraph):
3117         (WebCore::TextCheckingParagraph::invalidateParagraphRangeValues):
3118         (WebCore::TextCheckingParagraph::automaticReplacementStart const):
3119         (WebCore::TextCheckingParagraph::automaticReplacementLength const):
3120         * editing/TextCheckingHelper.h:
3121
3122 2018-06-30  David Kilzer  <ddkilzer@apple.com>
3123
3124         Follow-up: Fix clang static analyzer warnings: Garbage return value
3125         <https://webkit.org/b/187224>
3126
3127         Address review feedback from Eric Carlson.
3128
3129         * platform/mediastream/MediaConstraints.h:
3130         (WebCore::NumericConstraint::valueForCapabilityRange const):
3131         - Use brace initialization for more local variables.
3132
3133 2018-06-30  Michael Catanzaro  <mcatanzaro@igalia.com>
3134
3135         Asan false positive: stack use after scope under WebCore::ApplyPropertyBorderImageModifier in WebCore::Length::Length(WebCore::Length&&)
3136         https://bugs.webkit.org/show_bug.cgi?id=186980
3137         <rdar://problem/41409838>
3138
3139         Reviewed by Oliver Hunt.
3140
3141         We believe that we have found a bug in GCC's address sanitizer. It is blocking work on other
3142         issues, so work around it by changing a temporary into a local variable.
3143
3144         * css/StyleBuilderCustom.h:
3145         (WebCore::ApplyPropertyBorderImageModifier::applyInitialValue):
3146
3147 2018-06-30  David Kilzer  <ddkilzer@apple.com>
3148
3149         Fix clang static analyzer warnings: Garbage return value
3150         <https://webkit.org/b/187224>
3151
3152         Reviewed by Eric Carlson.
3153
3154         * platform/mediastream/MediaConstraints.h:
3155         (WebCore::NumericConstraint::valueForCapabilityRange const):
3156         - Use brace initialization for local variables.
3157
3158 2018-06-30  Zalan Bujtas  <zalan@apple.com>
3159
3160         [LFC] Do not add the containing block's offset while computing the out-of-flow static position.
3161         https://bugs.webkit.org/show_bug.cgi?id=187202
3162
3163         Reviewed by Antti Koivisto.
3164
3165         The static position for an out-of-flow elements is
3166         1. the distance from the parent's border box.
3167         2. climbing up on the containing block chain and offset the containers until we reach the out-of-flow element's containing block.
3168
3169         * layout/FormattingContextGeometry.cpp:
3170         (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned):
3171         (WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned):
3172
3173 2018-06-30  Zalan Bujtas  <zalan@apple.com>
3174
3175         [LFC] If the top and bottom margins of a box are adjoining, then it is possible for margins to collapse through it.
3176         https://bugs.webkit.org/show_bug.cgi?id=187220
3177
3178         Reviewed by Antti Koivisto.
3179
3180         * layout/blockformatting/BlockMarginCollapse.cpp:
3181         (WebCore::Layout::isMarginBottomCollapsedThrough):
3182         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild):
3183         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
3184         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
3185         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
3186         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild):
3187
3188 2018-06-30  Zalan Bujtas  <zalan@apple.com>
3189
3190         [LFC] Adjust final out-of-flow position with the computed margin value.
3191         https://bugs.webkit.org/show_bug.cgi?id=187219
3192
3193         Reviewed by Antti Koivisto.
3194
3195         * layout/FormattingContext.cpp:
3196         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
3197         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
3198
3199 2018-06-29  Antoine Quint  <graouts@apple.com>
3200
3201         [Web Animations] Make WPT test at timing-model/timelines/document-timelines.html pass reliably
3202         https://bugs.webkit.org/show_bug.cgi?id=186507
3203         <rdar://problem/41000257>
3204
3205         Reviewed by Dean Jackson.
3206
3207         The Web Animations spec, along with the HTML5 event loop spec, specify some assumptions on the time reported by
3208         document.timeline.currentTime:
3209
3210         - it should only increase once per frame
3211         - it should have the same value as the timestamp passed to requestAnimationFrame() callbacks
3212
3213         The WPT test at web-platform-tests/web-animations/timing-model/timelines/document-timelines.html relies on these
3214         assumptions to be true so that we check that the start time of a new animation is not the same as the timeline time
3215         when it was created, since it will be in the "play-pending" state for a frame.
3216
3217         In order to support this, we add two new methods on DocumentAnimationScheduler. First, when a scheduled display update
3218         fires, we record the timestamp and expose it via lastTimestamp() such that DocumentTimeline and ScriptedAnimationController
3219         can use the same value when updating animations. Then, to know whether code is run as a result of a display update, we
3220         expose isFiring().
3221
3222         Now, within DocumentTimeline::currentTime(), we can cache the current time this way:
3223
3224         - if we're in the middle of a display update, use the value returned by lastTimestamp().
3225         - otherwise, compute what would have been the ideal number of frames (at 60fps or less if throttled) and add those to
3226         the lastTimestamp() value.
3227
3228         Then, we remove this cached current time when both currently-running JavaScript has completed and all animation update
3229         code has completed by waiting on the invalidation task to run.
3230
3231         * animation/DocumentAnimationScheduler.cpp:
3232         (WebCore::DocumentAnimationScheduler::displayRefreshFired):
3233         * animation/DocumentAnimationScheduler.h:
3234         (WebCore::DocumentAnimationScheduler::lastTimestamp):
3235         (WebCore::DocumentAnimationScheduler::isFiring const):
3236         * animation/DocumentTimeline.cpp:
3237         (WebCore::DocumentTimeline::currentTime):
3238         (WebCore::DocumentTimeline::performInvalidationTask):
3239         (WebCore::DocumentTimeline::maybeClearCachedCurrentTime):
3240         * animation/DocumentTimeline.h:
3241         * dom/ScriptedAnimationController.cpp:
3242         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
3243         (WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire):
3244
3245 2018-06-29  Nan Wang  <n_wang@apple.com>
3246
3247         Crash under WebCore::AXObjectCache::handleMenuItemSelected
3248         https://bugs.webkit.org/show_bug.cgi?id=186918
3249         <rdar://problem/41365984>
3250
3251         Reviewed by Chris Fleizach.
3252
3253         When a node is being destroyed, we deregister it from the AX cache through the Node's destructor.
3254         But we did not remove the corresponding entry from the m_deferredFocusedNodeChange list. It would
3255         then lead to a crash if we try to access the deleted node from m_deferredFocusedNodeChange.
3256         Fixed it by removing the entry if the newly focused node is being destroyed.
3257
3258         Test: accessibility/accessibility-crash-focused-element-change.html
3259
3260         * accessibility/AXObjectCache.cpp:
3261         (WebCore::AXObjectCache::remove):
3262
3263 2018-06-29  Antti Koivisto  <antti@apple.com>
3264
3265         REGRESSION (r232806): Facebook login fields have blue fill background instead of white
3266         https://bugs.webkit.org/show_bug.cgi?id=187207
3267         <rdar://problem/41606349>
3268
3269         Reviewed by Tim Horton.
3270
3271         This happens because a 'prefers-dark-interface' media query on UA sheet always evaluates to true in dark mode.
3272
3273         Tests: fast/forms/input-background-ua-media-query.html
3274
3275         * css/MediaQueryEvaluator.cpp:
3276         (WebCore::prefersDarkInterfaceEvaluate):
3277
3278         Make prefers-dark-interface media query match only when using system appearance.
3279
3280 2018-06-29  Daniel Bates  <dabates@apple.com>
3281
3282         REGRESSION (r230921): Cannot log in to forums.swift.org using GitHub account
3283         https://bugs.webkit.org/show_bug.cgi?id=187197
3284         <rdar://problem/40420821>
3285
3286         Reviewed by Brent Fulgham.
3287
3288         Fixes an issue where a Same-Site cookies are not sent with any child window load if the
3289         load is cross-origin with respect to the window's opener. One example where this issue
3290         manifest itself was in the GitHub sign in flow on forums.swift.org.
3291
3292         Currently we always consider the origin of the window's opener (if we have one) when
3293         determining whether a frame load request is same-origin and hence should send Same-Site
3294         cookies when performing the request. So, when page A.com opens a child window to B.com and
3295         then a person clicks a hyperlink or submits a form to B.com/b2 then we do not send Same-
3296         Site cookies with the request to B.com/b2 (because its origin, B.com, is cross-origin
3297         with its opener, A.com). But we should send Same-Site cookies with the request to B.com/b2
3298         because it is same-origin with the page that initiated the request, B.com. Instead of
3299         always considering the origin the window's opener for every frame load we should only
3300         consider it for the first non-empty document load.
3301
3302         Tests: http/tests/cookies/same-site/fetch-in-about-blank-popup.html
3303                http/tests/cookies/same-site/post-from-cross-site-popup.html
3304
3305         * loader/FrameLoader.cpp:
3306         (WebCore::FrameLoader::addExtraFieldsToRequest):
3307
3308 2018-06-29  Nan Wang  <n_wang@apple.com>
3309
3310         AX: [iOS] VoiceOver scroll position is jumpy in frames
3311         https://bugs.webkit.org/show_bug.cgi?id=186956
3312
3313         Reviewed by Simon Fraser.
3314
3315         iOS is using delegate scrolling and we should not take into account
3316         the scroll offset when converting rects.
3317
3318         Also fixed a issue where we want to scroll the element into view even
3319         if it's partially visible.
3320
3321         Test: fast/scrolling/ios/iframe-scroll-into-view.html
3322
3323         * accessibility/AccessibilityObject.cpp:
3324         (WebCore::AccessibilityObject::scrollToMakeVisible const):
3325         * platform/ScrollView.cpp:
3326         (WebCore::ScrollView::contentsToContainingViewContents const):
3327
3328 2018-06-29  Chris Dumez  <cdumez@apple.com>
3329
3330         WebKitLegacy: Can trigger recursive loads triggering debug assertions
3331         https://bugs.webkit.org/show_bug.cgi?id=187121
3332         <rdar://problem/41259430>
3333
3334         Reviewed by Brent Fulgham.
3335
3336         In order to support asynchronous policy delegates, r229722 added a call to
3337         FrameLoader::clearProvisionalLoadForPolicyCheck() when starting a navigation
3338         policy decision in PolicyChecker::checkNavigationPolicy(). This calls
3339         stopLoading() on the current provisional loader if there is one, and potentially
3340         calls the didFailProvisionalLoadWithError cleint delegate. This delegate call
3341         is synchronous on WebKit1, so the client may start a new load from this delegate
3342         and re-enter Webcore. This happens in practive with Quickens 2017 / 2018 on Mac.
3343
3344         Before r229722, this was not an issue because pending loads were canceled after
3345         the (asynchronous) navigation policy decision, via FrameLoader::stopAllLoaders().
3346         FrameLoader::stopAllLoaders() sets a m_inStopAllLoaders flag and we return early
3347         in FrameLoader::loadRequest() when this flag is set to prevent recursive loads.
3348
3349         To maintain shipping behavior as much as possible, this patch introduces a similar
3350         inClearProvisionalLoadForPolicyCheck which gets set during
3351         FrameLoader::clearProvisionalLoadForPolicyCheck() and we prevent new loads while
3352         this flag is set.
3353
3354         I have verified that Quickens 2017 / 2018 works again after this change and I added
3355         API test coverage for this behavior.
3356
3357         * loader/FrameLoader.cpp:
3358         (WebCore::FrameLoader::loadURL):
3359         (WebCore::FrameLoader::load):
3360         (WebCore::FrameLoader::clearProvisionalLoadForPolicyCheck):
3361         * loader/FrameLoader.h:
3362
3363 2018-06-25  Said Abou-Hallawa  <sabouhallawa@apple.com>
3364
3365         Infinite loop if a <use> element references its ancestor and the DOMNodeInserted event handler of one its ancestor's descents updates the document style
3366         https://bugs.webkit.org/show_bug.cgi?id=186925
3367
3368         Reviewed by Antti Koivisto.
3369
3370         This patches fixes two issues:
3371         -- SVGTRefTargetEventListener should not assume it has to be attached to
3372         target when its handleEvent() is called.
3373         Because SVGTRefTargetEventListener::handleEvent() references the target
3374         element, we just return if the listener is detached.
3375
3376         -- The <use> element should not clone its shadow tree if it references one
3377         of its ancestors. The DOMNodeInserted of any node in the target element
3378         tree may issue a document command. This document command will cause the 
3379         shadow tree to be re-cloned so this will cause infinite loop to happen.
3380
3381         Test: svg/dom/svg-use-infinite-loop-cloning.html
3382
3383         * svg/SVGTRefElement.cpp:
3384         (WebCore::SVGTRefTargetEventListener::handleEvent):
3385         * svg/SVGUseElement.cpp:
3386         (WebCore::SVGUseElement::updateShadowTree):
3387
3388 2018-06-29  Manuel Rego Casasnovas  <rego@igalia.com>
3389
3390         [WPE] Three CSS Grid Layout tests crash due to valueless std::optional access
3391         https://bugs.webkit.org/show_bug.cgi?id=186752
3392
3393         Reviewed by Frédéric Wang.
3394
3395         This is a simple fix for the crash we're getting on WPE
3396         in IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep().
3397
3398         Covered by existent tests, just remove them from TestExpectations file.
3399
3400         * rendering/GridTrackSizingAlgorithm.cpp:
3401         (WebCore::IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const):
3402         Check if minSize is null before trying to access it's value.
3403
3404 2018-06-29  David Fenton  <david_fenton@apple.com>
3405
3406         Unreviewed, rolling out r233349.
3407
3408         caused 42 crashes on iOS GuardMalloc and iOS ASan tests
3409
3410         Reverted changeset:
3411
3412         "[Web Animations] Using a Web Animation leaks the Document"
3413         https://bugs.webkit.org/show_bug.cgi?id=187088
3414