624f9c076690eb4fdf3b034bdc3306d87ed6da01
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-10-04  Oriol Brufau  <obrufau@igalia.com>
2
3         [css-grid] Preserve auto repeat() in getComputedStyle() for non-grids
4         https://bugs.webkit.org/show_bug.cgi?id=202258
5
6         Reviewed by Javier Fernandez.
7
8         Tests: imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-nogrid.html
9                imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed.html
10                imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-nogrid.html
11                imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed.html
12
13         Usually, the resolved value of grid-template-rows/columns is the used
14         value, expanding the repeat() notation. But for elements with a non-grid
15         display, the resolved value is just the computed value, with repeat(),
16         since the used value doesn't exist.
17         Before this patch, the repeat() was dropped, and line names after it
18         appeared at the wrong position or were also dropped. There was also an
19         assert failure in debug. This patch fixes the serialization for auto
20         repeat(). Integer repeat() is still expanded at computed-value time, so
21         it's not preserved in getComputedStyle().
22
23         * css/CSSComputedStyleDeclaration.cpp:
24         (WebCore::OrderedNamedLinesCollector::OrderedNamedLinesCollector):
25         (WebCore::OrderedNamedLinesCollectorInsideRepeat::OrderedNamedLinesCollectorInsideRepeat):
26         (WebCore::OrderedNamedLinesCollectorInGridLayout::OrderedNamedLinesCollectorInGridLayout):
27         (WebCore::OrderedNamedLinesCollector::collectLineNamesForIndex const):
28         (WebCore::OrderedNamedLinesCollectorInsideRepeat::collectLineNamesForIndex const):
29         (WebCore::OrderedNamedLinesCollectorInGridLayout::collectLineNamesForIndex const):
30         (WebCore::populateGridTrackList):
31         (WebCore::valueForGridTrackList):
32
33 2019-10-04  Antti Koivisto  <antti@apple.com>
34
35         [CSS Shadow Parts] Support 'exportparts' attribute
36         https://bugs.webkit.org/show_bug.cgi?id=202520
37
38         Reviewed by Ryosuke Niwa.
39
40         Support 'exportparts' attribute for exporting part mappings from subcomponents.
41
42         * css/ElementRuleCollector.cpp:
43         (WebCore::ElementRuleCollector::matchAuthorRules):
44         (WebCore::ElementRuleCollector::matchPartPseudoElementRules):
45
46         Recurse to containing scopes to collect part rules if there are exported mappings.
47
48         (WebCore::ElementRuleCollector::ruleMatches):
49         * css/ElementRuleCollector.h:
50         * css/SelectorChecker.cpp:
51         (WebCore::SelectorChecker::matchRecursively const):
52
53         Make ShadowDescendant fake combinator skip directly to the scope where the part rules are coming from.
54
55         (WebCore::SelectorChecker::checkOne const):
56
57         Resolve names via mappings if needed.
58
59         * css/SelectorChecker.h:
60         * dom/Element.cpp:
61         (WebCore::Element::attributeChanged):
62
63         Invalidate mappings as needed.
64
65         * dom/ShadowRoot.cpp:
66         (WebCore::parsePartMappings):
67
68         Parse the mappings microsyntax.
69
70         (WebCore::ShadowRoot::partMappings const):
71         (WebCore::ShadowRoot::invalidatePartMappings):
72         * dom/ShadowRoot.h:
73         * html/HTMLAttributeNames.in:
74
75 2019-10-04  Ryosuke Niwa  <rniwa@webkit.org>
76
77         A newly inserted element doesn't get assigned to a named slot if slot assignments had already happened
78         https://bugs.webkit.org/show_bug.cgi?id=199733
79
80         Reviewed by Antti Koivisto.
81
82         The bug was caused by addSlotElementByName not invalidating slot assignments when a new slot element
83         is inserted after corresponding elements with the slot content attribute had already been inserted.
84
85         Fixed the bug by always invalidating the slot assignment when a new slot element is inserted.
86
87         Tests: fast/shadow-dom/add-slotted-element-after-assignment-1.html
88                fast/shadow-dom/add-slotted-element-after-assignment-2.html
89                fast/shadow-dom/add-slotted-element-after-assignment-3.html
90
91         * dom/SlotAssignment.cpp:
92         (WebCore::SlotAssignment::addSlotElementByName):
93
94 2019-10-04  Ryosuke Niwa  <rniwa@webkit.org>
95
96         Radio button groups are not scoped by shadow boundaries
97         https://bugs.webkit.org/show_bug.cgi?id=199568
98
99         Reviewed by Antti Koivisto.
100
101         Fixed the bug that radio button groups are not scoped to each shadow tree by moving
102         RadioButtonGroups from FormController, which is a per-document object, to TreeScope.
103
104         Test: imported/w3c/web-platform-tests/shadow-dom/input-type-radio.html
105
106         * dom/RadioButtonGroups.h:
107         (WebCore::RadioButtonGroups): Made this bmalloc'ed now that it's allocated standalone.
108         * dom/TreeScope.cpp:
109         (WebCore::TreeScope::radioButtonGroups): Added.
110         * dom/TreeScope.h:
111         * html/FormController.h:
112         (WebCore::FormController::radioButtonGroups): Deleted.
113         * html/HTMLInputElement.cpp:
114         (WebCore::HTMLInputElement::~HTMLInputElement):
115         (WebCore::HTMLInputElement::removedFromAncestor): Update the radio button group here.
116         (WebCore::HTMLInputElement::didMoveToNewDocument): Removed the code to update radio
117         button group here since it's done in removedFromAncestor now. Note that insertion case
118         is alrady taken care of by HTMLInputElement::didFinishInsertingNode.
119         (WebCore::HTMLInputElement::radioButtonGroups const): Ditto.
120
121 2019-10-03  Antti Koivisto  <antti@apple.com>
122
123         [CSS Shadow Parts] Correct interaction with other pseudo elements
124         https://bugs.webkit.org/show_bug.cgi?id=202526
125
126         Reviewed by Ryosuke Niwa.
127
128         Cases like foo::part(bar)::before should work.
129
130         This patch doesn't cover ::placeholder which is implemented as PseudoElementWebKitCustom (like internal -webkit-* properties).
131
132         * css/CSSSelector.h:
133         (WebCore::isTreeStructuralPseudoClass):
134
135         Add a helper.
136
137         * css/parser/CSSSelectorParser.cpp:
138
139         Allow non-structural pseudo classes after ::part().
140         Allow other pseudo elements after ::part().
141
142         (WebCore::CSSSelectorParser::consumePseudo):
143
144         No need for DisallowPseudoElementsScope, we are just parsing identifiers.
145
146 2019-10-03  James Darpinian  <jdarpinian@chromium.org>
147
148         Fix WebGL 1 conformance regressions when USE_ANGLE=1
149         https://bugs.webkit.org/show_bug.cgi?id=202545
150
151         Prevent ANGLE from automatically using ES3 when ES2 is requested.
152
153         WEBGL_debug_shaders extension should not accept or return null.
154
155         Enable ANGLE's new support for emulating RGB on RGBA IOSurfaces.
156
157         Reviewed by Alex Christensen.
158
159         * html/canvas/WebGLDebugShaders.cpp:
160         (WebCore::WebGLDebugShaders::getTranslatedShaderSource):
161         * html/canvas/WebGLDebugShaders.h:
162         * html/canvas/WebGLDebugShaders.idl:
163         * html/canvas/WebGLRenderingContextBase.cpp:
164         (WebCore::WebGLRenderingContextBase::validateVertexAttributes):
165         * platform/graphics/angle/Extensions3DANGLE.cpp:
166         (WebCore::Extensions3DANGLE::getTranslatedShaderSourceANGLE):
167         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
168         (WebCore::GraphicsContext3D::GraphicsContext3D):
169         * platform/graphics/cocoa/WebGLLayer.mm:
170         (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
171
172 2019-10-03  Jer Noble  <jer.noble@apple.com>
173
174     [iOS] WebContent process can be interrupted during suspension; loses "Now Playing" status
175     https://bugs.webkit.org/show_bug.cgi?id=202537
176     <rdar://problem/55952707>
177
178     Reviewed by Eric Carlson.
179
180     Always deactivate the AVAudioSession when the last playing PlatformAudioSession ends playback and the application is in the background.
181
182     * platform/audio/PlatformMediaSessionManager.cpp:
183     (WebCore::PlatformMediaSessionManager::removeSession):
184     (WebCore::PlatformMediaSessionManager::processWillSuspend):
185     (WebCore::PlatformMediaSessionManager::maybeDeactivateAudioSession):
186     * platform/audio/PlatformMediaSessionManager.h:
187     (WebCore::PlatformMediaSessionManager::isApplicationInBackground const):
188     * platform/audio/ios/MediaSessionManagerIOS.h:
189     * platform/audio/ios/MediaSessionManagerIOS.mm:
190     (WebCore::MediaSessionManageriOS::sessionWillEndPlayback):
191
192 2019-10-03  Chris Dumez  <cdumez@apple.com>
193
194         Allow pages using FontFaceSet to enter the back/forward cache
195         https://bugs.webkit.org/show_bug.cgi?id=202476
196
197         Reviewed by Myles C. Maxfield.
198
199         Allow pages using FontFaceSet to enter the back/forward cache by updating its
200         implementation to queue all its tasks that run script to a SuspendableTaskQueue.
201         The SuspendableTaskQueue makes sure to properly suspend while in PageCache and
202         run the tasks when resuming from PageCache.
203
204         Test: http/tests/navigation/page-cache-fontfaceset.html
205
206         * PlatformWin.cmake:
207         * Sources.txt:
208         * WebCore.xcodeproj/project.pbxproj:
209         * css/CSSFontFace.cpp:
210         (WebCore::CSSFontFace::fontLoadEventOccurred):
211         * css/FontFaceSet.cpp:
212         (WebCore::FontFaceSet::FontFaceSet):
213         (WebCore::FontFaceSet::canSuspendForDocumentSuspension const):
214         (WebCore::FontFaceSet::didFirstLayout):
215         (WebCore::FontFaceSet::completedLoading):
216         (WebCore::FontFaceSet::faceFinished):
217         * css/FontFaceSet.h:
218
219         * platform/SuspendableTaskQueue.cpp: Added.
220         (WebCore::SuspendableTaskQueue::SuspendableTaskQueue):
221         (WebCore::SuspendableTaskQueue::close):
222         (WebCore::SuspendableTaskQueue::cancelAllTasks):
223         (WebCore::SuspendableTaskQueue::enqueueTask):
224         (WebCore::SuspendableTaskQueue::runOneTask):
225         (WebCore::SuspendableTaskQueue::activeDOMObjectName const):
226         (WebCore::SuspendableTaskQueue::canSuspendForDocumentSuspension const):
227         (WebCore::SuspendableTaskQueue::stop):
228         (WebCore::SuspendableTaskQueue::suspend):
229         (WebCore::SuspendableTaskQueue::resume):
230         * platform/SuspendableTaskQueue.h: Added.
231         (WebCore::SuspendableTaskQueue::create):
232         (WebCore::SuspendableTaskQueue::isClosed const):
233         (WebCore::SuspendableTaskQueue::hasPendingTasks const):
234         Add a SuspendableTaskQueue class which is Page-Cache aware and can be used to queue
235         generic tasks as WTF::Function<void<>> lambdas.
236
237 2019-10-03  Chris Dumez  <cdumez@apple.com>
238
239         Provisional / scheduled loads in subframes should not prevent a page from entering the back/forward cache
240         https://bugs.webkit.org/show_bug.cgi?id=202474
241
242         Reviewed by Alex Christensen.
243
244         Provisional / scheduled loads in subframes should not prevent a page from entering the back/forward cache.
245         To address the issue, we now make sure to stop all loads before checking for PageCache eligibility.
246
247         Test: fast/history/page-cache-quick-redirect-iframe.html
248
249         * history/PageCache.cpp:
250         (WebCore::PageCache::addIfCacheable):
251         * loader/FrameLoader.cpp:
252         (WebCore::FrameLoader::stopForPageCache):
253         * loader/FrameLoader.h:
254
255 2019-10-03  Chris Dumez  <cdumez@apple.com>
256
257         XMLHttpRequest sometimes prevents pages from entering the back/forward cache
258         https://bugs.webkit.org/show_bug.cgi?id=202434
259         <rdar://problem/55890340>
260
261         Reviewed by Geoffrey Garen.
262
263         XMLHttpRequest::canSuspendForDocumentSuspension() was returning false if the document has not fired
264         the window's load event, with a comment explaining that cancelling the XHR in the upon suspension
265         may cause the load event to get fired and thus run script when forbidden. However, we should only
266         return false if the XMLHttpRequest is actually loading (m_loader is not null). XHRs that are not
267         loading should never prevent page caching.
268
269         I saw failures to enter the back/forward cache on yandex.ru and taobao.com because of this.
270
271         Test: http/tests/navigation/page-cache-failed-xhr.html
272
273         * xml/XMLHttpRequest.cpp:
274         (WebCore::XMLHttpRequest::canSuspendForDocumentSuspension const):
275
276 2019-10-03  John Wilander  <wilander@apple.com>
277
278         Resource Load Statistics: Downgrade document.referrer for all third-party iframes
279         https://bugs.webkit.org/show_bug.cgi?id=202506
280         <rdar://problem/55786397>
281
282         Reviewed by Brent Fulgham.
283
284         This change downgrades document.referrer for all third-party iframes if ITP/Resource Load Statistics
285         is enabled. The behavior matches the downgrade of all HTTP referrers for third-party resources
286         which landed in https://trac.webkit.org/changeset/250413/webkit.
287
288         Tests: http/tests/resourceLoadStatistics/downgrade-document-referrer-nested-third-party-iframe.html
289                http/tests/resourceLoadStatistics/downgrade-document-referrer-third-party-iframe.html
290                http/tests/resourceLoadStatistics/leave-empty-document-referrer-alone-third-party-iframe.html
291
292         * dom/Document.cpp:
293         (WebCore::Document::referrer):
294         (WebCore::Document::referrer const): Deleted.
295             Can no longer be const since it lazily downgrades and saves the referrer on read.
296         * dom/Document.h:
297
298 2019-10-03  Devin Rousso  <drousso@apple.com>
299
300         Web Inspector: remove `InspectorInstrumentationCookie`
301         https://bugs.webkit.org/show_bug.cgi?id=202487
302
303         Reviewed by Matt Baker.
304
305         All it does is create a shallow-copy of the `InstrumentingAgents` (it copies a pointer to
306         the `InstrumentingAgents` object, so any of the pointers to the `InspectorAgent` that are
307         contained therein are shared between each instance) and save the tracking
308         `InspectorTimelineAgent`'s id (monotonically increasing integer).
309
310         All uses of `InspectorInstrumentationCookie` are local values, so there's no way that the
311         `InspectorTimelineAgent` (or the id) could change in between an
312         `InspectorInstrumentation::will*` and an `InspectorInstrumentation::did*`, as both the
313         tracking state and id are controlled by the frontend and cannot "interrupt".
314
315         Removing `InspectorInstrumentationCookie` _can_ cause issues is in situations where the
316         `ScriptExecutionContext` (or `Page`) changes between the `InspectorInstrumentation::will*`
317         and the `InspectorInstrumentation::did*`, but this can be avoided so long as a pointer to
318         the "context" used for `InspectorInstrumentation::will*` is saved.
319
320         Covered by existing tests: inspector/timeline/*
321
322         * inspector/InspectorInstrumentationCookie.h: Removed.
323         * inspector/InspectorInstrumentationCookie.cpp: Removed.
324
325         * inspector/agents/InspectorTimelineAgent.h:
326         * inspector/agents/InspectorTimelineAgent.cpp:
327         (WebCore::InspectorTimelineAgent::internalStop):
328         (WebCore::InspectorTimelineAgent::didDispatchEvent):
329         (WebCore::InspectorTimelineAgent::didPaint):
330         (WebCore::InspectorTimelineAgent::clearRecordStack): Deleted.
331
332         * bindings/js/JSCallbackData.cpp:
333         (WebCore::JSCallbackData::invokeCallback):
334         * bindings/js/JSCustomElementInterface.cpp:
335         (WebCore::constructCustomElementSynchronously):
336         (WebCore::JSCustomElementInterface::upgradeElement):
337         (WebCore::JSCustomElementInterface::invokeCallback):
338         * bindings/js/JSErrorHandler.cpp:
339         (WebCore::JSErrorHandler::handleEvent):
340         * bindings/js/JSEventListener.cpp:
341         (WebCore::JSEventListener::handleEvent):
342         * bindings/js/JSExecState.h:
343         * bindings/js/JSExecStateInstrumentation.h:
344         (WebCore::JSExecState::instrumentFunctionInternal):
345         (WebCore::JSExecState::instrumentFunctionCall):
346         (WebCore::JSExecState::instrumentFunctionConstruct):
347         * bindings/js/ScheduledAction.cpp:
348         (WebCore::ScheduledAction::executeFunctionInContext):
349         * bindings/js/ScriptController.cpp:
350         (WebCore::ScriptController::evaluateInWorld):
351         (WebCore::ScriptController::evaluateModule):
352         * dom/Document.cpp:
353         (WebCore::Document::resolveStyle):
354         * dom/EventTarget.cpp:
355         (WebCore::EventTarget::innerInvokeEventListeners):
356         * dom/MutationObserver.cpp:
357         (WebCore::MutationObserver::deliver):
358         * dom/ScriptedAnimationController.cpp:
359         (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks):
360         * page/DOMTimer.cpp:
361         (WebCore::DOMTimer::fired):
362         * page/DOMWindow.cpp:
363         (WebCore::DOMWindow::dispatchEvent):
364         * page/FrameViewLayoutContext.cpp:
365         (WebCore::FrameViewLayoutContext::layout):
366         * page/IntersectionObserver.cpp:
367         (WebCore::IntersectionObserver::notify):
368         * page/PerformanceObserver.cpp:
369         (WebCore::PerformanceObserver::deliver):
370
371         * inspector/InspectorInstrumentation.h:
372         (WebCore::InspectorInstrumentation::willCallFunction):
373         (WebCore::InspectorInstrumentation::didCallFunction):
374         (WebCore::InspectorInstrumentation::willDispatchEvent):
375         (WebCore::InspectorInstrumentation::didDispatchEvent):
376         (WebCore::InspectorInstrumentation::willDispatchEventOnWindow):
377         (WebCore::InspectorInstrumentation::didDispatchEventOnWindow):
378         (WebCore::InspectorInstrumentation::willEvaluateScript):
379         (WebCore::InspectorInstrumentation::didEvaluateScript):
380         (WebCore::InspectorInstrumentation::willFireTimer):
381         (WebCore::InspectorInstrumentation::didFireTimer):
382         (WebCore::InspectorInstrumentation::willLayout):
383         (WebCore::InspectorInstrumentation::didLayout):
384         (WebCore::InspectorInstrumentation::willRecalculateStyle):
385         (WebCore::InspectorInstrumentation::didRecalculateStyle):
386         (WebCore::InspectorInstrumentation::willFireAnimationFrame):
387         (WebCore::InspectorInstrumentation::didFireAnimationFrame):
388         (WebCore::InspectorInstrumentation::willFireObserverCallback):
389         (WebCore::InspectorInstrumentation::didFireObserverCallback):
390         * inspector/InspectorInstrumentation.cpp:
391         (WebCore::InspectorInstrumentation::willCallFunctionImpl):
392         (WebCore::InspectorInstrumentation::didCallFunctionImpl):
393         (WebCore::InspectorInstrumentation::willDispatchEventImpl):
394         (WebCore::InspectorInstrumentation::didDispatchEventImpl):
395         (WebCore::InspectorInstrumentation::willDispatchEventOnWindowImpl):
396         (WebCore::InspectorInstrumentation::didDispatchEventOnWindowImpl):
397         (WebCore::InspectorInstrumentation::willEvaluateScriptImpl):
398         (WebCore::InspectorInstrumentation::didEvaluateScriptImpl):
399         (WebCore::InspectorInstrumentation::willFireTimerImpl):
400         (WebCore::InspectorInstrumentation::didFireTimerImpl):
401         (WebCore::InspectorInstrumentation::willLayoutImpl):
402         (WebCore::InspectorInstrumentation::didLayoutImpl):
403         (WebCore::InspectorInstrumentation::willRecalculateStyleImpl):
404         (WebCore::InspectorInstrumentation::didRecalculateStyleImpl):
405         (WebCore::InspectorInstrumentation::willFireAnimationFrameImpl):
406         (WebCore::InspectorInstrumentation::didFireAnimationFrameImpl):
407         (WebCore::InspectorInstrumentation::willFireObserverCallbackImpl):
408         (WebCore::InspectorInstrumentation::didFireObserverCallbackImpl):
409         (WebCore::InspectorInstrumentation::retrieveTimelineAgent): Deleted.
410
411         * Sources.txt:
412         * WebCore.xcodeproj/project.pbxproj:
413
414 2019-10-03  Sihui Liu  <sihui_liu@apple.com>
415
416         IndexedDB: add size estimate for key path when estimate task size
417         https://bugs.webkit.org/show_bug.cgi?id=202480
418
419         Reviewed by Geoffrey Garen.
420
421         No observable behavior change.
422
423         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
424         (WebCore::IDBServer::estimateSize):
425
426 2019-10-03  youenn fablet  <youenn@apple.com>
427
428         Regression: iOS 13.1 MediaStreamTrack.enabled = false kills audio track
429         https://bugs.webkit.org/show_bug.cgi?id=202405
430         <rdar://problem/55922616>
431
432         Reviewed by Eric Carlson.
433
434         When the web page is setting enabled to false, media session might change from PlayRecord to None.
435         This might trigger CoreAudio to no longer output audio samples, thus triggering our audio capture failure timer.
436         This would end the track after 2 seconds.
437         Given audio tracks can be reenabled by a web page, we should not change the Media Session setup based on that.
438         This patch updates MediaStream::mediaType to return independently of the enabled state.
439
440         Add internals API to write a cross platform test.
441
442         Test: fast/mediastream/audio-track-enabled.html
443         Manually tested as well.
444
445         * Modules/mediastream/MediaStream.cpp:
446         (WebCore::MediaStream::mediaType const):
447         * platform/mediastream/MediaStreamPrivate.cpp:
448         (WebCore::MediaStreamPrivate::hasCaptureAudioSource const):
449         * testing/Internals.cpp:
450         (WebCore::Internals::supportsAudioSession const):
451         (WebCore::Internals::audioSessionCategory const):
452         * testing/Internals.h:
453         * testing/Internals.idl:
454
455 2019-10-03  youenn fablet  <youenn@apple.com>
456
457         http/tests/security/navigate-when-restoring-cached-page.html should not use RTCPeerConnection to not enter in page cache
458         https://bugs.webkit.org/show_bug.cgi?id=202521
459
460         Reviewed by Chris Dumez.
461
462         Introduce a dummy ActiveDOMObject which can never be suspended for document suspension.
463         Allow a page to create this dummy ActiveDOMObject through internals.
464         Covered by updated test.
465
466         * dom/ActiveDOMObject.h:
467         * testing/Internals.cpp:
468         (WebCore::Internals::preventDocumentForEnteringPageCache):
469         * testing/Internals.h:
470         * testing/Internals.idl:
471
472 2019-10-03  Tim Horton  <timothy_horton@apple.com>
473
474         WebKit doesn't build with trunk clang
475         https://bugs.webkit.org/show_bug.cgi?id=202511
476
477         Reviewed by Anders Carlsson.
478
479         * Modules/fetch/FetchLoader.h:
480         * Modules/geolocation/Geolocation.h:
481         * Modules/indexeddb/IDBTransaction.h:
482         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
483         * Modules/indexeddb/shared/InProcessIDBServer.h:
484         * Modules/notifications/Notification.cpp:
485         * Modules/notifications/Notification.h:
486         * platform/graphics/ca/TileController.h:
487         * workers/service/context/ServiceWorkerThreadProxy.h:
488         Fix the build by exporting destructors and custom delete operators.
489         I don't know why this changed, but trunk clang insists.
490         There are also some new warnings; this only fixes the hard errors.
491
492 2019-10-03  Tim Horton  <timothy_horton@apple.com>
493
494         Yet another build fix
495
496         * css/typedom/TypedOMCSSImageValue.h:
497         Forward declare Document.
498
499 2019-10-03  Jiewen Tan  <jiewen_tan@apple.com>
500
501         Support googleLegacyAppidSupport extension
502         https://bugs.webkit.org/show_bug.cgi?id=202427
503         <rdar://problem/55887473>
504
505         Reviewed by Brent Fulgham.
506
507         This patch adds support for googleLegacyAppidSupport extension, when set:
508         1) user agent should only use the U2F transport protocol,
509         2) should only communicate with roaming authenticators, and
510         3) should use a hard-coded appID of https://www.gstatic.com/securitykey/origins.json.
511         To be noticed as the name implies, this extension is exclusively for RP ID = google.com.
512
513         Implementation wise, all operations are captured in methods with name processGoogleLegacyAppIdSupportExtension.
514         1) AuthenticatorCoordinator takes care of setting the value.
515         2) U2fCommandConstructor takes care of hard coding the AppID.
516         3) AuthenticatorManager takes care of removing AuthenticatorTransport::Internal from TransportSet, so startDiscovery
517         will not poke platform authenticators.
518         4) CtapAuthenticator takes care of downgrading to U2fAuthenticator.
519         5) U2fAuthenticator takes care of setting the AppID in the response.
520
521         Partially covered by new test cases in existing tests, and remaining will be covered by manual tests.
522
523         * Modules/webauthn/AuthenticationExtensionsClientInputs.h:
524         (WebCore::AuthenticationExtensionsClientInputs::encode const):
525         (WebCore::AuthenticationExtensionsClientInputs::decode):
526         * Modules/webauthn/AuthenticationExtensionsClientInputs.idl:
527         * Modules/webauthn/AuthenticatorCoordinator.cpp:
528         (WebCore::AuthenticatorCoordinatorInternal::processGoogleLegacyAppIdSupportExtension):
529         (WebCore::AuthenticatorCoordinator::create const):
530         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
531         (WebCore::PublicKeyCredentialCreationOptions::encode const):
532         (WebCore::PublicKeyCredentialCreationOptions::decode):
533         * Modules/webauthn/fido/U2fCommandConstructor.cpp:
534         (fido::convertToU2fRegisterCommand):
535         (fido::processGoogleLegacyAppIdSupportExtension):
536         * Modules/webauthn/fido/U2fCommandConstructor.h:
537
538 2019-10-03  Yury Semikhatsky  <yurys@chromium.org>
539
540         Web Inspector: tests under LayoutTests/inspector/debugger are flaky
541         https://bugs.webkit.org/show_bug.cgi?id=137131
542         <rdar://problem/18461335>
543
544         Reviewed by Devin Rousso.
545
546         Fix debugger tests on GTK. All tests that pause on breakpoint didn't work because
547         in layout tests InspectorFrontendClientLocal was using Timer to dispatch commands
548         sent from the local front-end page to the inspected one. When paused inside a script
549         triggered by the front-end nested timer event would be scheduled but never fired
550         because in glib implementation of RunLoop::TimerBase uses event source which doesn't
551         allow recursion (g_source_set_can_recurse is not called on the source), so dispatching
552         Debugger.resume command didn't work when paused inside another inspector command (e.g.
553         eval). RunLoop itself uses event source which does allow recursion. So instead of using
554         a timer for asynchronous command dispatching with delay=0 we now schedule a task in
555         RunLoop's queue.
556
557         * inspector/InspectorFrontendClientLocal.cpp:
558         (WebCore::InspectorBackendDispatchTask::dispatch):
559         (WebCore::InspectorBackendDispatchTask::reset):
560         (WebCore::InspectorBackendDispatchTask::InspectorBackendDispatchTask):
561         (WebCore::InspectorBackendDispatchTask::scheduleOneShot): ensures that there is one inspector
562         dispatch task in the queue.
563         (WebCore::InspectorBackendDispatchTask::dispatchOneMessage): this is mostly the same behavior
564         as was with timerFired, we should be able to dispatch all accumulated messages from the queue
565         in one batch but for now I'd like to keep it one per iteration.
566
567 2019-10-03  Joonghun Park  <pjh0718@gmail.com>
568
569         CSS ellipse() doesn't accept single <shape-radius>
570         https://bugs.webkit.org/show_bug.cgi?id=181745
571
572         CSS ellipse() should only accept 0 or 2 radii.
573         The corresponding csswg discussion is
574         https://github.com/w3c/csswg-drafts/issues/2175.
575
576         Reviewed by Antti Koivisto.
577
578         Tests: imported/w3c/web-platform-tests/css/css-masking/parsing/clip-path-computed.html
579                imported/w3c/web-platform-tests/css/css-masking/parsing/clip-path-invalid.html
580                imported/w3c/web-platform-tests/css/css-masking/parsing/clip-path-valid.html
581                imported/w3c/web-platform-tests/css/css-masking/parsing/shape-outside-computed.html
582                imported/w3c/web-platform-tests/css/css-masking/parsing/shape-outside-invalid.html
583                imported/w3c/web-platform-tests/css/css-masking/parsing/shape-outside-valid.html
584
585         * css/CSSBasicShapes.cpp:
586         (WebCore::CSSBasicShapeEllipse::cssText const):
587         * css/parser/CSSPropertyParser.cpp:
588         (WebCore::consumeBasicShapeEllipse):
589
590 2019-10-03  Zan Dobersek  <zdobersek@igalia.com>
591
592         [Nicosia] Enable runtime checks and triggers for async non-main-frame scrolling
593         https://bugs.webkit.org/show_bug.cgi?id=202509
594
595         Reviewed by Carlos Garcia Campos.
596
597         Add build guards that would enable runtime checks of the asynchronous
598         frame scrolling setting in the ScrollingCoordinator and
599         RenderLayerCompositor classes for the Nicosia-using ports.
600
601         The check in ScrollingCoordinator avoids bailing on coordinating
602         scrolling for non-main frames when the setting is enabled. The check in
603         RenderLayerCompositor avoids imposing a requirement for a composition
604         layer for any non-main frame when the setting is disabled.
605
606         * page/scrolling/ScrollingCoordinator.cpp:
607         (WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView const):
608         * rendering/RenderLayerCompositor.cpp:
609         (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame const):
610
611 2019-10-02  Antti Koivisto  <antti@apple.com>
612
613         [CSS Shadow Parts] Support multiple arguments for ::part()
614         https://bugs.webkit.org/show_bug.cgi?id=202482
615
616         Reviewed by Ryosuke Niwa.
617
618         Support ::part(foo bar).
619
620         * css/CSSSelector.cpp:
621         (WebCore::CSSSelector::selectorText const):
622         (WebCore::CSSSelector::setArgumentList):
623         (WebCore::CSSSelector::setLangArgumentList): Deleted.
624
625         Give this a more generic name and use it for ::part() too.
626
627         * css/CSSSelector.h:
628         (WebCore::CSSSelector::argumentList const):
629         (WebCore::CSSSelector::langArgumentList const): Deleted.
630         * css/SelectorChecker.cpp:
631         (WebCore::SelectorChecker::checkOne const):
632
633         Match only if all parts are found from the element 'part' attribute.
634
635         * css/parser/CSSParserSelector.cpp:
636         (WebCore::CSSParserSelector::setArgumentList):
637         (WebCore::CSSParserSelector::setLangArgumentList): Deleted.
638         * css/parser/CSSParserSelector.h:
639         * css/parser/CSSSelectorParser.cpp:
640         (WebCore::CSSSelectorParser::consumePseudo):
641
642         Parse the list.
643
644         * cssjit/SelectorCompiler.cpp:
645         (WebCore::SelectorCompiler::addPseudoClassType):
646
647 2019-10-02  Andy Estes  <aestes@apple.com>
648
649         [iOS] When hit testing for a context menu interaction, do not consider whether the element is contenteditable
650         https://bugs.webkit.org/show_bug.cgi?id=202498
651         <rdar://problem/54723131>
652
653         Reviewed by Tim Horton.
654
655         When the user selects a context menu action, WebKit performs a hit test in order to find the
656         acted-on element on the page. This is separate from the hit test performed to generate the
657         context menu's targeted preview. Since an arbitrary amount of time can elapse between
658         preview generation and action selection, this second hit-tests might return a different
659         element.
660
661         One case where we know a different element can be returned is in apps that dynamically
662         enable and disable editing. If editing is disabled when the first hit test occurs but is
663         enabled when the second one occurs, different elements will be returned due to
664         Frame::qualifyingNodeAtViewportLocation preferring to return the root editable element when
665         the approximate node is contenteditable.
666
667         While the appropriate long-term fix is to only hit-test once and use that element for both
668         preview generation and action selection, this patch implements a short-term fix to address
669         the specific problem in rdar://problem/54723131 by disabling the contenteditable behavior
670         described above for context menu interaction hit testing.
671
672         The long-term fix is tracked by <https://webkit.org/b/202499>.
673
674         * page/Frame.h:
675         * page/ios/FrameIOS.mm:
676         (WebCore::Frame::qualifyingNodeAtViewportLocation):
677         (WebCore::Frame::approximateNodeAtViewportLocationLegacy):
678         (WebCore::ancestorRespondingToClickEventsNodeQualifier):
679         (WebCore::Frame::nodeRespondingToClickEvents):
680         (WebCore::Frame::nodeRespondingToDoubleClickEvent):
681         (WebCore::Frame::nodeRespondingToInteraction):
682         (WebCore::Frame::nodeRespondingToScrollWheelEvents):
683
684 2019-10-02  Antti Koivisto  <antti@apple.com>
685
686         [CSS Shadow Parts] Basic ::part() pseudo element support
687         https://bugs.webkit.org/show_bug.cgi?id=202456
688
689         Reviewed by Ryosuke Niwa.
690
691         Implement basic parsing and selector matching for ::part() pseudo element.
692
693         * css/CSSSelector.cpp:
694         (WebCore::CSSSelector::pseudoId):
695         (WebCore::CSSSelector::parsePseudoElementType):
696         (WebCore::CSSSelector::selectorText const):
697         * css/CSSSelector.h:
698         * css/ElementRuleCollector.cpp:
699         (WebCore::ElementRuleCollector::matchAuthorRules):
700         (WebCore::ElementRuleCollector::matchPartPseudoElementRules):
701         * css/ElementRuleCollector.h:
702         * css/RuleSet.cpp:
703         (WebCore::RuleSet::addRule):
704         * css/RuleSet.h:
705         (WebCore::RuleSet::partPseudoElementRules const):
706         * css/SelectorChecker.cpp:
707         (WebCore::SelectorChecker::checkOne const):
708         * css/SelectorPseudoElementTypeMap.in:
709         * css/parser/CSSParserSelector.cpp:
710         (WebCore::CSSParserSelector::parsePseudoElementSelector):
711
712         Also added ::slotted to SelectorPseudoElementTypeMap.in to resolve a FIXME here.
713
714         * css/parser/CSSParserSelector.h:
715         (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching const):
716         * css/parser/CSSSelectorParser.cpp:
717         (WebCore::isOnlyPseudoElementFunction):
718         (WebCore::CSSSelectorParser::consumePseudo):
719
720         Parse single values only, multipart ::part(foo bar) case is not yet handled.
721
722         * dom/Element.cpp:
723         (WebCore::Element::partNames const):
724
725 2019-10-02  Antoine Quint  <graouts@apple.com>
726
727         Adopt copyToVector() in AnimationTimeline::animationsForElement()
728         https://bugs.webkit.org/show_bug.cgi?id=202488
729
730         Reviewed by Wenson Hsieh.
731
732         * animation/AnimationTimeline.cpp:
733         (WebCore::AnimationTimeline::animationsForElement const):
734
735 2019-10-02  Thibault Saunier  <tsaunier@igalia.com>
736
737         [GStreamer] Let playbin handle redirects for us when appropriate
738         https://bugs.webkit.org/show_bug.cgi?id=195326
739
740         A simplified mechanism has been added in GStreamer to handle corner cases.
741
742         Reviewed by Xabier Rodriguez-Calvar.
743
744         Not easily testable at our level
745
746         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
747         (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation):
748
749 2019-10-02  Tim Horton  <timothy_horton@apple.com>
750
751         Another build fix
752
753         * css/typedom/TypedOMCSSImageValue.cpp:
754         (WebCore::TypedOMCSSImageValue::TypedOMCSSImageValue):
755         * css/typedom/TypedOMCSSImageValue.h:
756         I feel like I am actively being thwarted.
757
758 2019-10-02  Tim Horton  <timothy_horton@apple.com>
759
760         Another build fix
761
762         * css/typedom/TypedOMCSSImageValue.h:
763
764 2019-10-02  Tim Horton  <timothy_horton@apple.com>
765
766         Try to fix the Windows build
767
768         * css/typedom/TypedOMCSSImageValue.cpp:
769         (WebCore::TypedOMCSSImageValue::document const):
770         * css/typedom/TypedOMCSSImageValue.h:
771         Out-of-line this instead of including Document.h in TypedOMCSSImageValue,
772         which was an earlier build fix from r250610.
773
774         * platform/graphics/cg/GradientCG.cpp:
775         * platform/graphics/win/GlyphPageTreeNodeCGWin.cpp:
776         * platform/graphics/win/GraphicsContextCGWin.cpp:
777         Try to fix the build.
778
779 2019-10-02  Keith Rollin  <krollin@apple.com>
780
781         Unreviewed build fix after r250595.
782
783         macCatalyst appears to have triggered the the problem where the build
784         can sometimes fail if the unified sources mechanism doesn't group
785         together the right set of files.
786
787         * css/typedom/TypedOMCSSImageValue.h:
788
789 2019-10-02  Antoine Quint  <graouts@apple.com>
790
791         [Web Animations] Implement replaced animations
792         https://bugs.webkit.org/show_bug.cgi?id=202190
793         <rdar://55697719>
794
795         Reviewed by Dean Jackson.
796
797         Implementing section "5.5 Replacing Animations" (https://drafts.csswg.org/web-animations/#replacing-animations) of the Web Animations
798         specification which allows for Web Animations to be destroyed when they are superseded by another animation and the developer doesn't
799         explicitly opt into persisting them using the persist() method.
800
801         An animation is marked as replaceable (to sum up) when it's finished and another animation for the same property takes precedence.
802         As part of DocumentTimeline::internalUpdateAnimationsAndSendEvents(), we'll go through all replaceable animations, dispatch a "remove"
803         DOM event, and remove them from our list of animations.
804
805         We also make a couple of fixes in this patch that were uncovered while working on the WPT tests for replaced animations:
806         
807         - we would incorrectly parse single values for a property that allows lists (change in KeyframeEffect's processKeyframeLikeObject())
808         - we didn't account for the position in the global animation list when sorted animations by composite order (AnimationTimeline::animationsForElement())
809
810         Finally, to get more readable results, we implement a stub of commitStyles(). Its full implementation is tracked by http://wkb.ug/202193.
811
812         * animation/AnimationTimeline.cpp:
813         (WebCore::AnimationTimeline::animationTimingDidChange): Mark the position of the animation in the global animation list, to which it may only be added once.
814         (WebCore::AnimationTimeline::animationsForElement const): Account for the animation's position in the global animation when sorting.
815         * animation/DeclarativeAnimation.cpp:
816         (WebCore::DeclarativeAnimation::bindingsReplaceState const): Flush pending styles when querying the ready state for a declarative animation.
817         * animation/DeclarativeAnimation.h:
818         * animation/DocumentTimeline.cpp:
819         (WebCore::DocumentTimeline::internalUpdateAnimationsAndSendEvents): Run the "remove replaced animations" procedure as the second step in the "update animations
820         and send events" procedure.
821         (WebCore::DocumentTimeline::animationCanBeRemoved): Determine whether a given animation may be removed based on its finished state, replace state and whether
822         it is fully superseded by another animation targeting the same property on the same target element.
823         (WebCore::DocumentTimeline::removeReplacedAnimations): Remove any removable animation and dispatch a "remove" DOM event for each removed animation. 
824         * animation/DocumentTimeline.h:
825         * animation/KeyframeEffect.cpp:
826         (WebCore::processKeyframeLikeObject): Fix an issue found in a replaced animations WPT test that showed that we didn't record the value of an animation that allows lists.
827         * animation/WebAnimation.cpp:
828         (WebCore::WebAnimation::isReplaceable const):
829         (WebCore::WebAnimation::persist): Mark the replace state as "persisted" and ensure the animation is set on the animation list for its target element in case it had already
830         been removed based on its persisted state.
831         (WebCore::WebAnimation::commitStyles): Stub for a new function.
832         * animation/WebAnimation.h:
833         (WebCore::WebAnimation::replaceState const):
834         (WebCore::WebAnimation::setReplaceState):
835         (WebCore::WebAnimation::bindingsReplaceState const):
836         (WebCore::WebAnimation::globalPosition const):
837         (WebCore::WebAnimation::setGlobalPosition):
838         * animation/WebAnimation.idl:
839         * dom/EventNames.h: Add the new "remove" event so that the "onremove" DOM property is available on Animation objects. 
840
841 2019-10-02  Zan Dobersek  <zdobersek@igalia.com>
842
843         Unreviewed build fix in Nicosia's ScrollingTreePositionedNode class.
844
845         * page/scrolling/nicosia/ScrollingTreePositionedNode.cpp:
846         (WebCore::ScrollingTreePositionedNode::applyLayerPositions):
847         Fix the name of the variable included in the log call.
848
849 2019-10-02  youenn fablet  <youenn@apple.com>
850
851         Use strongly typed identifiers for webrtc sockets
852         https://bugs.webkit.org/show_bug.cgi?id=202400
853
854         Reviewed by Chris Dumez.
855
856         No observable change of behavior.
857
858         * Headers.cmake:
859         * WebCore.xcodeproj/project.pbxproj:
860         * platform/mediastream/libwebrtc/LibWebRTCSocketIdentifier.h: Copied from Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocket.h.
861
862 2019-10-02  Carlos Garcia Campos  <cgarcia@igalia.com>
863
864         [GTK][WPE] Stop using legacy custom protocol implementation
865         https://bugs.webkit.org/show_bug.cgi?id=202407
866
867         Reviewed by Žan Doberšek.
868
869         Remove the code to setup custom protocols in soup session.
870
871         * platform/network/soup/SoupNetworkSession.cpp:
872         (WebCore::SoupNetworkSession::SoupNetworkSession):
873         * platform/network/soup/SoupNetworkSession.h:
874
875 2019-10-02  Zan Dobersek  <zdobersek@igalia.com>
876
877         [Nicosia] Enable async scrolling at build-time for Nicosia-using ports
878         https://bugs.webkit.org/show_bug.cgi?id=202397
879
880         Reviewed by Carlos Garcia Campos.
881
882         * PlatformPlayStation.cmake: Add missing build targets.
883         * SourcesGTK.txt: Ditto.
884
885 2019-10-01  Tim Horton  <timothy_horton@apple.com>
886
887         Clean up some includes to make the build a bit faster
888         https://bugs.webkit.org/show_bug.cgi?id=202444
889
890         Reviewed by Geoff Garen.
891
892         No new tests, just reorganizing.
893
894         Apply some profile-guided optimizations to our headers.
895
896         * bindings/js/CallTracerTypes.h:
897         * css/typedom/TypedOMCSSImageValue.h:
898         * html/canvas/WebGLObject.h:
899         * html/canvas/WebGLVertexArrayObjectBase.h:
900         * inspector/InspectorInstrumentation.cpp:
901         (WebCore::InspectorInstrumentation::instrumentingAgentsForWebGPUDevice):
902         (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope):
903         (WebCore::InspectorInstrumentation::instrumentingAgentsForPage):
904         (WebCore::InspectorInstrumentation::instrumentingAgentsForContext):
905         * inspector/InspectorInstrumentation.h:
906         (WebCore::InspectorInstrumentation::didCreateWebGPUDevice):
907         (WebCore::InspectorInstrumentation::willDestroyWebGPUDevice):
908         (WebCore::InspectorInstrumentation::didCreateWebGPUPipeline):
909         * platform/graphics/BitmapImage.cpp:
910         * platform/graphics/Font.h:
911         * platform/graphics/cg/GraphicsContextCG.cpp:
912         (WebCore::getUserToBaseCTM):
913         * platform/graphics/cg/GraphicsContextCG.h:
914         (WebCore::getUserToBaseCTM): Deleted.
915         * platform/graphics/cg/ImageBufferCG.cpp:
916         * platform/graphics/cocoa/IOSurface.h:
917         * platform/graphics/mac/PDFDocumentImageMac.mm:
918         InspectorInstrumentation.h is one of the most expensive headers in the entire project.
919         While not included in many places (70), it is fairly straightforward to reduce
920         its per-inclusion cost by rougly 80%.
921
922 2019-10-01  Alex Christensen  <achristensen@webkit.org>
923
924         Progress towards a functioning CMake build on Mac
925         https://bugs.webkit.org/show_bug.cgi?id=202443
926
927         Rubber-stamped by Tim Horton.
928
929         * testing/Internals.mm:
930
931 2019-10-01  John Wilander  <wilander@apple.com>
932
933         Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access
934         https://bugs.webkit.org/show_bug.cgi?id=202435
935         <rdar://problem/55718526>
936
937         Reviewed by Brent Fulgham.
938
939         WebKit's Storage Access API implementation has so far only looked at whether ITP is
940         blocking cookie access or not. However, the default cookie policy is still in
941         effect underneath ITP. document.hasStorageAccess() should return true if the
942         third-party:
943         a) is not classified by ITP, and
944         b) has cookies which implies it can use cookies as third-party according to the
945         default cookie policy.
946
947         Tests: http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html
948                http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html
949                http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html
950
951         * platform/network/NetworkStorageSession.h:
952         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
953         (WebCore::NetworkStorageSession::hasCookies const):
954         * platform/network/curl/NetworkStorageSessionCurl.cpp:
955         (WebCore::NetworkStorageSession::hasCookies const):
956             Not yet implemented. Always says false.
957         * platform/network/soup/NetworkStorageSessionSoup.cpp:
958         (WebCore::NetworkStorageSession::hasCookies const):
959             Not yet implemented. Always says false.
960
961 2019-10-01  Tim Horton  <timothy_horton@apple.com>
962
963         Clean up some includes to make the build a bit faster
964         https://bugs.webkit.org/show_bug.cgi?id=202437
965
966         Reviewed by Jer Noble.
967
968         * Modules/webaudio/PannerNode.h:
969         * Modules/webaudio/RealtimeAnalyser.h:
970         * platform/audio/HRTFPanner.h:
971         FFTFrame includes Accelerate.h, which is quite expensive.
972
973 2019-10-01  Antti Koivisto  <antti@apple.com>
974
975         [CSS Shadow Parts] Parse 'part' attribute
976         https://bugs.webkit.org/show_bug.cgi?id=202409
977
978         Reviewed by Ryosuke Niwa.
979
980         Add parsing for Element 'part' attribute and the IDL interface.
981         Also add a feature flag for CSS Shadow Parts.
982
983         * dom/Element.cpp:
984         (WebCore::Element::attributeChanged):
985         (WebCore::isNonEmptyTokenList):
986         (WebCore::Element::classAttributeChanged):
987         (WebCore::Element::partAttributeChanged):
988         (WebCore::Element::partNames const):
989         (WebCore::Element::part):
990         (WebCore::classStringHasClassName): Deleted.
991         * dom/Element.h:
992         * dom/Element.idl:
993         * dom/ElementRareData.cpp:
994         * dom/ElementRareData.h:
995         (WebCore::ElementRareData::partList const):
996         (WebCore::ElementRareData::setPartList):
997         (WebCore::ElementRareData::partNames const):
998         (WebCore::ElementRareData::setPartNames):
999         * html/HTMLAttributeNames.in:
1000         * page/RuntimeEnabledFeatures.h:
1001         (WebCore::RuntimeEnabledFeatures::setCSSShadowPartsEnabled):
1002         (WebCore::RuntimeEnabledFeatures::cssShadowPartsEnabled const):
1003
1004 2019-10-01  Yusuke Suzuki  <ysuzuki@apple.com>
1005
1006         [JSC] Place VM* in TLS
1007         https://bugs.webkit.org/show_bug.cgi?id=202391
1008
1009         Reviewed by Mark Lam.
1010
1011         Use JSLockHolder instead. It automatically puts VM* in TLS.
1012
1013         * bindings/js/IDBBindingUtilities.cpp:
1014         (WebCore::toJS):
1015         (WebCore::deserializeIDBValueToJSValue):
1016
1017 2019-10-01  youenn fablet  <youenn@apple.com>
1018
1019         Queue events and promise resolution in RTCPeerConnection when suspended for page cache
1020         https://bugs.webkit.org/show_bug.cgi?id=202396
1021
1022         Reviewed by Chris Dumez.
1023
1024         This patch prepares RTCPeerConnection to be suspendable to enter page cache.
1025         For that purpose, we queue events and promise resolution/rejection tasks if the RTCPeerConnection m_shouldDelayTasks is set to true.
1026         This queueing is enabled when RTCPeerConnection is asked to suspend itself.
1027         The queued tasks are then executed at resume time.
1028         Renamed fireEvent to dispatchEventWhenFeasible.
1029         No change of behavior for now.
1030
1031         * Modules/mediastream/PeerConnectionBackend.cpp:
1032         (WebCore::PeerConnectionBackend::createOfferSucceeded):
1033         (WebCore::PeerConnectionBackend::createOfferFailed):
1034         (WebCore::PeerConnectionBackend::createAnswerSucceeded):
1035         (WebCore::PeerConnectionBackend::createAnswerFailed):
1036         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
1037         (WebCore::PeerConnectionBackend::setLocalDescriptionFailed):
1038         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
1039         (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
1040         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
1041         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
1042         * Modules/mediastream/RTCPeerConnection.cpp:
1043         (WebCore::RTCPeerConnection::doClose):
1044         (WebCore::RTCPeerConnection::suspend):
1045         (WebCore::RTCPeerConnection::resume):
1046         (WebCore::RTCPeerConnection::updateIceGatheringState):
1047         (WebCore::RTCPeerConnection::updateIceConnectionState):
1048         (WebCore::RTCPeerConnection::updateConnectionState):
1049         (WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent):
1050         (WebCore::RTCPeerConnection::doTask):
1051         (WebCore::RTCPeerConnection::fireEvent):
1052         * Modules/mediastream/RTCPeerConnection.h:
1053
1054 2019-10-01  Brent Fulgham  <bfulgham@apple.com>
1055
1056         [FTW] Correct additional canvas test failures
1057         https://bugs.webkit.org/show_bug.cgi?id=202388
1058
1059         Reviewed by Fujii Hironori.
1060
1061         This patch corrects a handful of errors in Direct2D's drawing code.
1062
1063         * platform/graphics/win/Direct2DOperations.cpp:
1064         (WebCore::Direct2D::clearRect): Use the transformed dimensions of
1065         rects to determine whether they intersect with the render target.
1066         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
1067         (WebCore::ImageBufferData::copyRectFromData const):
1068         (WebCore::ImageBufferData::loadDataToBitmapIfNeeded): It is not
1069         necessary (or correct) to 'endDraw' when loading image data to the
1070         Bitmap target.
1071         * platform/graphics/win/PathDirect2D.cpp:
1072         (WebCore::Path::strokeBoundingRect const): Provide an implementation.
1073
1074 2019-10-01  Alex Christensen  <achristensen@webkit.org>
1075
1076         Progress towards successful CMake build on Mac
1077         https://bugs.webkit.org/show_bug.cgi?id=202426
1078
1079         Rubber-stamped by Tim Horton.
1080
1081         * PlatformMac.cmake:
1082
1083 2019-10-01  Tim Horton  <timothy_horton@apple.com>
1084
1085         Clean up some includes to make the build a bit faster
1086         https://bugs.webkit.org/show_bug.cgi?id=202417
1087
1088         Reviewed by Jer Noble.
1089
1090         No new tests, just reorganizing.
1091
1092         Apply some profile-guided optimizations to our headers.
1093
1094         * Modules/mediasource/SourceBuffer.cpp:
1095         * WebCorePrefix.h:
1096         Add HashMap, which ends up included in all source files.
1097
1098         * html/HTMLImageElement.cpp:
1099         (WebCore::HTMLImageElement::HTMLImageElement):
1100         (WebCore::HTMLImageElement::selectImageSource):
1101         (WebCore::HTMLImageElement::didAttachRenderers):
1102         (WebCore::HTMLImageElement::insertedIntoAncestor):
1103         (WebCore::HTMLImageElement::width):
1104         (WebCore::HTMLImageElement::height):
1105         (WebCore::HTMLImageElement::naturalWidth const):
1106         (WebCore::HTMLImageElement::naturalHeight const):
1107         (WebCore::HTMLImageElement::complete const):
1108         (WebCore::HTMLImageElement::decode):
1109         (WebCore::HTMLImageElement::didMoveToNewDocument):
1110         (WebCore::HTMLImageElement::cachedImage const):
1111         (WebCore::HTMLImageElement::setLoadManually):
1112         (WebCore::HTMLImageElement::hasPendingActivity const):
1113         (WebCore::HTMLImageElement::pendingDecodePromisesCountForTesting const):
1114         * html/HTMLImageElement.h:
1115         (WebCore::HTMLImageElement::cachedImage const): Deleted.
1116         (WebCore::HTMLImageElement::setLoadManually): Deleted.
1117         (WebCore::HTMLImageElement::hasPendingActivity const): Deleted.
1118         (WebCore::HTMLImageElement::pendingDecodePromisesCountForTesting const): Deleted.
1119         HTMLImageLoader brings in JSDOMPromiseDeferred, which is known to be horribly expensive.
1120         Out-of-line m_imageLoader.
1121
1122         * platform/graphics/GraphicsLayer.h:
1123         Swap Animation for TimingFunction, which is much smaller.
1124
1125         * platform/graphics/MediaPlayer.h:
1126         InbandTextTrackPrivate brings in SerializedPlatformRepresentation.h,
1127         which is very expensive. MediaPlayer.h is included in many places.
1128         Break the link.
1129
1130         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1131
1132 2019-10-01  youenn fablet  <youenn@apple.com>
1133
1134         RTCDataChannel should not prevent entering page cache except if in open state
1135         https://bugs.webkit.org/show_bug.cgi?id=202395
1136
1137         Reviewed by Chris Dumez.
1138
1139         Only prevent entering page cache in open state.
1140         Enqueue message through the document event queue to handle suspension properly.
1141
1142         We cannot yet write page cache tests as a data channel requires a peer connection which
1143         currently forbids entering page cache.
1144
1145         * Modules/mediastream/RTCDataChannel.cpp:
1146         (WebCore::RTCDataChannel::RTCDataChannel):
1147         (WebCore::RTCDataChannel::didReceiveStringData):
1148         (WebCore::RTCDataChannel::didReceiveRawData):
1149         (WebCore::RTCDataChannel::didDetectError):
1150         (WebCore::RTCDataChannel::bufferedAmountIsDecreasing):
1151         (WebCore::RTCDataChannel::scheduleDispatchEvent):
1152         (WebCore::RTCDataChannel::scheduledEventTimerFired): Deleted.
1153         * Modules/mediastream/RTCDataChannel.h:
1154
1155 2019-10-01  Rob Buis  <rbuis@igalia.com>
1156
1157         [Mac] Layout Test imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.html fails
1158         https://bugs.webkit.org/show_bug.cgi?id=202350
1159
1160         Reviewed by Alex Christensen.
1161
1162         In some cases didReceiveResponse will deliver redirects (normally willSendRequestInternal will be used for redirects).
1163         When this is done in manual redirect mode make sure the response type is opaque redirect.
1164
1165         Test: imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.html
1166
1167         * loader/SubresourceLoader.cpp:
1168         (WebCore::SubresourceLoader::didReceiveResponse):
1169
1170 2019-10-01  Keith Rollin  <krollin@apple.com>
1171
1172         Remove some support for < iOS 13
1173         https://bugs.webkit.org/show_bug.cgi?id=202386
1174         <rdar://problem/55863017>
1175
1176         Reviewed by Eric Carlson.
1177
1178         Remove some support for iOS versions less than 13.0.
1179
1180         Update conditionals that reference __IPHONE_OS_VERSION_MIN_REQUIRED
1181         and __IPHONE_OS_VERSION_MAX_ALLOWED, assuming that they both have
1182         values >= 130000. This means that expressions like
1183         "__IPHONE_OS_VERSION_MIN_REQUIRED < 101300" are always False and
1184         "__IPHONE_OS_VERSION_MIN_REQUIRED >= 101300" are always True.
1185
1186         This removal is part of a series of patches effecting the removal of
1187         dead code for old versions of iOS. This particular pass involves
1188         changes in which Jer Noble was involved. These changes are isolated
1189         from other similar changes in order to facilitate the reviewing
1190         process.
1191
1192         No new tests -- no new or changed functionality.
1193
1194         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1195         (WebCore::MediaPlayerPrivateAVFoundationObjC::seekableTimeRangesLastModifiedTime const):
1196         (WebCore::MediaPlayerPrivateAVFoundationObjC::liveUpdateInterval const):
1197
1198 2019-10-01  Chris Dumez  <cdumez@apple.com>
1199
1200         Unreviewed attempt to fix Windows build after r250527.
1201
1202         * dom/GenericEventQueue.cpp:
1203         (WebCore::TaskQueueConstructor::construct):
1204         (WebCore::TaskQueueConstructor<Timer>::construct):
1205         (WebCore::GenericEventQueueBase<T>::enqueueEvent):
1206         (WebCore::GenericEventQueueBase<T>::close):
1207         (WebCore::GenericEventQueueBase<T>::cancelAllEvents):
1208         (WebCore::GenericEventQueueBase<T>::setPaused):
1209         (WebCore::GenericEventQueueBase<T>::suspend):
1210         (WebCore::GenericEventQueueBase<T>::rescheduleAllEventsIfNeeded):
1211         * dom/GenericEventQueue.h:
1212         * platform/GenericTaskQueue.h:
1213
1214 2019-10-01  Alex Christensen  <achristensen@webkit.org>
1215
1216         Fix internal build after r250549
1217         https://bugs.webkit.org/show_bug.cgi?id=202390
1218
1219         There is an internal #define confirm on some systems, so rename DOMWindow::confirm to DOMWindow::confirmForBindings.
1220
1221         * page/DOMWindow.cpp:
1222         (WebCore::DOMWindow::confirmForBindings):
1223         (WebCore::DOMWindow::confirm): Deleted.
1224         * page/DOMWindow.h:
1225         * page/DOMWindow.idl:
1226
1227 2019-10-01  Chris Dumez  <cdumez@apple.com>
1228
1229         Unreviewed attempt to fix Windows build after r250527.
1230
1231         * platform/GenericTaskQueue.h:
1232
1233 2019-10-01  Zan Dobersek  <zdobersek@igalia.com>
1234
1235         [CoordGraphics] Implement sync methods for position, bounds origin
1236         https://bugs.webkit.org/show_bug.cgi?id=202398
1237
1238         Reviewed by Carlos Garcia Campos.
1239
1240         Add the CoordinatedGraphicsLayer::syncPosition() and
1241         CoordinatedGraphicsLayer::syncBoundsOrigin() method overrides, both
1242         performing a synchronization of the given GraphicsLayer attribute.
1243
1244         These methods are used by the scrolling code to reflect changes in these
1245         attributes without causing a layer flush (which is not necessary since
1246         the changes have already been applied in an equivalent way).
1247
1248         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1249         (WebCore::CoordinatedGraphicsLayer::didChangeGeometry):
1250         (WebCore::CoordinatedGraphicsLayer::syncPosition):
1251         (WebCore::CoordinatedGraphicsLayer::syncBoundsOrigin):
1252         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1253
1254 2019-10-01  Joonghun Park  <jh718.park@samsung.com>
1255
1256         Make table's clientWidth/Height include its border sizes.
1257         https://bugs.webkit.org/show_bug.cgi?id=200974
1258
1259         WebKit doesn't have table wrapper box currently
1260         while Gecko has it,
1261         so this CL tries to mimic the behavior that
1262         clientWidth/Height refers to table wrapper box
1263         which doesn't have borders applied to itself
1264         and table grid box has the borders.
1265
1266         This CL adds table's border sizes
1267         to clientWidth/Height
1268         at |LayoutBox::PixelSnappedClientWidth/Height|.
1269
1270         As a result of this CL, table's clientWidth/Height
1271         and offsetWidth/Height are equal now, respectively.
1272
1273         The corresponding csswg discussion is
1274         https://github.com/w3c/csswg-drafts/issues/4245.
1275
1276         Reviewed by Antti Koivisto.
1277
1278         Tests: fast/table/border-collapsing/bug236727.html
1279                imported/w3c/web-platform-tests/css/cssom-view/table-border-collapse-client-width-height.html
1280                imported/w3c/web-platform-tests/css/cssom-view/table-border-separate-client-width-height.html
1281                imported/w3c/web-platform-tests/css/cssom-view/table-with-border-client-width-height.html
1282
1283         * dom/Element.cpp:
1284         (WebCore::Element::clientWidth):
1285         (WebCore::Element::clientHeight):
1286
1287 2019-10-01  youenn fablet  <youenn@apple.com>
1288
1289         Remove races condition when validating capture sandbox extension revocation
1290         https://bugs.webkit.org/show_bug.cgi?id=202133
1291         <rdar://problem/55660905>
1292
1293         Reviewed by Eric Carlson.
1294
1295         Covered by existing tests.
1296
1297         * Modules/mediastream/MediaStreamTrack.cpp:
1298         (WebCore::MediaStreamTrack::endCapture):
1299         Synchronously update document media state when capture is ended.
1300         This allows to validate the fact that no document is capturing while we revoke sandbox extensions.
1301
1302 2019-10-01  youenn fablet  <youenn@apple.com>
1303
1304         MediaDevices should be SecureContext
1305         https://bugs.webkit.org/show_bug.cgi?id=202267
1306
1307         Reviewed by Eric Carlson.
1308
1309         Manually tested since 127.0.0.1/localhost are secure contexts.
1310
1311         * Modules/mediastream/MediaDevices.idl:
1312         * bindings/js/WebCoreBuiltinNames.h:
1313
1314 2019-09-30  Alex Christensen  <achristensen@webkit.org>
1315
1316         Resurrect Mac CMake build
1317         https://bugs.webkit.org/show_bug.cgi?id=202384
1318
1319         Rubber-stamped by Tim Horton.
1320
1321         * PlatformMac.cmake:
1322
1323 2019-09-30  Chris Dumez  <cdumez@apple.com>
1324
1325         Make GenericEventQueue an ActiveDOMObject
1326         https://bugs.webkit.org/show_bug.cgi?id=202373
1327
1328         Reviewed by Eric Carlson.
1329
1330         Make GenericEventQueue an ActiveDOMObject so that it is guaranteed to never fire any events while
1331         suspended without requiring the client to explicitly suspend/resume the event queue.
1332
1333         * Modules/encryptedmedia/MediaKeySession.cpp:
1334         (WebCore::MediaKeySession::MediaKeySession):
1335         (WebCore::MediaKeySession::enqueueMessage):
1336         (WebCore::MediaKeySession::updateKeyStatuses):
1337         * Modules/encryptedmedia/MediaKeySession.h:
1338         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
1339         (WebCore::WebKitMediaKeySession::WebKitMediaKeySession):
1340         (WebCore::WebKitMediaKeySession::~WebKitMediaKeySession):
1341         (WebCore::WebKitMediaKeySession::addKeyTimerFired):
1342         (WebCore::WebKitMediaKeySession::sendMessage):
1343         (WebCore::WebKitMediaKeySession::sendError):
1344         (WebCore::WebKitMediaKeySession::hasPendingActivity const):
1345         (WebCore::WebKitMediaKeySession::stop):
1346         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
1347         * Modules/mediasource/MediaSource.cpp:
1348         (WebCore::MediaSource::MediaSource):
1349         (WebCore::MediaSource::hasPendingActivity const):
1350         (WebCore::MediaSource::stop):
1351         (WebCore::MediaSource::canSuspendForDocumentSuspension const):
1352         (WebCore::MediaSource::scheduleEvent):
1353         * Modules/mediasource/MediaSource.h:
1354         * Modules/mediasource/SourceBuffer.cpp:
1355         (WebCore::SourceBuffer::SourceBuffer):
1356         (WebCore::SourceBuffer::hasPendingActivity const):
1357         (WebCore::SourceBuffer::stop):
1358         (WebCore::SourceBuffer::scheduleEvent):
1359         * Modules/mediasource/SourceBuffer.h:
1360         * Modules/mediasource/SourceBufferList.cpp:
1361         (WebCore::SourceBufferList::SourceBufferList):
1362         (WebCore::SourceBufferList::scheduleEvent):
1363         (WebCore::SourceBufferList::canSuspendForDocumentSuspension const):
1364         * Modules/mediasource/SourceBufferList.h:
1365         * Modules/webaudio/AudioContext.cpp:
1366         (WebCore::AudioContext::AudioContext):
1367         (WebCore::AudioContext::stop):
1368         * Modules/webaudio/AudioContext.h:
1369         * animation/DeclarativeAnimation.cpp:
1370         (WebCore::DeclarativeAnimation::DeclarativeAnimation):
1371         (WebCore::DeclarativeAnimation::tick):
1372         (WebCore::DeclarativeAnimation::needsTick const):
1373         (WebCore::DeclarativeAnimation::remove):
1374         (WebCore::DeclarativeAnimation::enqueueDOMEvent):
1375         (WebCore::DeclarativeAnimation::stop):
1376         (WebCore::DeclarativeAnimation::suspend):
1377         (WebCore::DeclarativeAnimation::resume):
1378         * animation/DeclarativeAnimation.h:
1379         * dom/GenericEventQueue.cpp:
1380         (WebCore::GenericEventQueueBase<T>::GenericEventQueueBase):
1381         (WebCore::GenericEventQueueBase<T>::setPaused):
1382         (WebCore::GenericEventQueueBase<T>::canSuspendForDocumentSuspension const):
1383         (WebCore::GenericEventQueueBase<T>::suspend):
1384         (WebCore::GenericEventQueueBase<T>::resume):
1385         (WebCore::GenericEventQueueBase<T>::rescheduleAllEventsIfNeeded):
1386         (WebCore::GenericEventQueueBase<T>::stop):
1387         (WebCore::GenericEventQueueBase<T>::activeDOMObjectName const):
1388         (WebCore::GenericEventQueue::create):
1389         (WebCore::MainThreadGenericEventQueue::create):
1390         * dom/GenericEventQueue.h:
1391         * dom/MessagePort.cpp:
1392         (WebCore::MessagePort::MessagePort):
1393         (WebCore::MessagePort::close):
1394         (WebCore::MessagePort::dispatchMessages):
1395         * dom/MessagePort.h:
1396         * html/HTMLMediaElement.cpp:
1397         (WebCore::HTMLMediaElement::HTMLMediaElement):
1398         (WebCore::HTMLMediaElement::~HTMLMediaElement):
1399         (WebCore::HTMLMediaElement::scheduleEvent):
1400         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
1401         (WebCore::HTMLMediaElement::cancelPendingEventsAndCallbacks):
1402         (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
1403         (WebCore::HTMLMediaElement::mediaPlayerInitializationDataEncountered):
1404         (WebCore::HTMLMediaElement::closeTaskQueues):
1405         (WebCore::HTMLMediaElement::suspend):
1406         (WebCore::HTMLMediaElement::resume):
1407         (WebCore::HTMLMediaElement::hasPendingActivity const):
1408         (WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent):
1409         * html/HTMLMediaElement.h:
1410         * html/track/TrackListBase.cpp:
1411         (WebCore::TrackListBase::TrackListBase):
1412         (WebCore::TrackListBase::scheduleTrackEvent):
1413         (WebCore::TrackListBase::scheduleChangeEvent):
1414         (WebCore::TrackListBase::isChangeEventScheduled const):
1415         (WebCore::TrackListBase::canSuspendForDocumentSuspension const):
1416         * html/track/TrackListBase.h:
1417         * workers/Worker.cpp:
1418         (WebCore::Worker::Worker):
1419         (WebCore::Worker::terminate):
1420         (WebCore::Worker::stop):
1421         (WebCore::Worker::hasPendingActivity const):
1422         (WebCore::Worker::enqueueEvent):
1423         (WebCore::Worker::dispatchEvent):
1424         * workers/Worker.h:
1425         * workers/service/ServiceWorkerContainer.cpp:
1426         (WebCore::ServiceWorkerContainer::ServiceWorkerContainer):
1427         (WebCore::ServiceWorkerContainer::startMessages):
1428         (WebCore::ServiceWorkerContainer::postMessage):
1429         (WebCore::ServiceWorkerContainer::stop):
1430         * workers/service/ServiceWorkerContainer.h:
1431
1432 2019-09-30  Chris Dumez  <cdumez@apple.com>
1433
1434         IDBTransaction / IDBObjectStore should not prevent a page from entering the back / forward cache
1435         https://bugs.webkit.org/show_bug.cgi?id=202291
1436         <rdar://problem/55760106>
1437
1438         Reviewed by Geoffrey Garen.
1439
1440         IDBObjectStore does not fire any events and should therefore not cause any problem while in PageCache.
1441         IDBTransaction can only fire abort/complete/error events, all of which are being enqueued to the
1442         DocumentEventQueue. The DocumentEventQueue subclasses SuspendableTimer which will correctly suspend
1443         while the document is in page cache. IDBTransaction will therefore not cause events to fire (and JS
1444         to run) while in page cache.
1445
1446         Test: storage/indexeddb/IDBTransaction-page-cache.html
1447
1448         * Modules/indexeddb/IDBObjectStore.cpp:
1449         (WebCore::IDBObjectStore::canSuspendForDocumentSuspension const):
1450         * Modules/indexeddb/IDBTransaction.cpp:
1451         (WebCore::IDBTransaction::canSuspendForDocumentSuspension const):
1452
1453 2019-09-30  Chris Dumez  <cdumez@apple.com>
1454
1455         Refine restrictions for X-Temp-Tablet HTTP header experiment
1456         https://bugs.webkit.org/show_bug.cgi?id=202367
1457         <rdar://problem/55849139>
1458
1459         Reviewed by Geoffrey Garen.
1460
1461         Refine restrictions for X-Temp-Tablet HTTP header experiment:
1462         1. Only send the header if the embedding application is MobileSafari.
1463         2. Only send the header if the first party is google.com
1464         3. Only send the header if the current date is before 2/1/2020
1465         4. Send the header even if using an ephemeral session
1466
1467         * loader/cache/CachedResourceLoader.cpp:
1468         (WebCore::isXTempTabletHeaderExperimentOver):
1469         (WebCore::CachedResourceLoader::CachedResourceLoader):
1470         (WebCore::isGoogleSearch):
1471         (WebCore::CachedResourceLoader::shouldSendXTempTabletHeader const):
1472         (WebCore::CachedResourceLoader::requestResource):
1473         * loader/cache/CachedResourceLoader.h:
1474
1475 2019-09-30  Chris Dumez  <cdumez@apple.com>
1476
1477         Pages with Web Workers cannot enter the back / forward cache
1478         https://bugs.webkit.org/show_bug.cgi?id=202296
1479         <rdar://problem/55764073>
1480
1481         Reviewed by Jer Noble.
1482
1483         Allow pages that use Web Workers to enter the back / forward cache.
1484         This involves adding an EventQueue for all event firing on Woker
1485         objects and suspending this EventQueue while in the page cache.
1486
1487         This was preventing some of the pages on weather.com to enter the
1488         back / forward cache.
1489
1490         Test: fast/workers/worker-page-cache.html
1491
1492         * Modules/encryptedmedia/MediaKeySession.h:
1493         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
1494         * Modules/mediasource/MediaSource.h:
1495         * Modules/mediasource/SourceBuffer.h:
1496         * Modules/mediasource/SourceBufferList.h:
1497         * Modules/webaudio/AudioContext.cpp:
1498         (WebCore::AudioContext::AudioContext):
1499         * Modules/webaudio/AudioContext.h:
1500         * animation/DeclarativeAnimation.h:
1501
1502         * dom/GenericEventQueue.cpp:
1503         (WebCore::TaskQueueConstructor::construct):
1504         (WebCore::TaskQueueConstructor<Timer>::construct):
1505         (WebCore::GenericEventQueueBase<T>::GenericEventQueueBase):
1506         (WebCore::GenericEventQueueBase<T>::enqueueEvent):
1507         (WebCore::GenericEventQueueBase<T>::dispatchOneEvent):
1508         (WebCore::GenericEventQueueBase<T>::close):
1509         (WebCore::GenericEventQueueBase<T>::cancelAllEvents):
1510         (WebCore::GenericEventQueueBase<T>::hasPendingEvents const):
1511         (WebCore::GenericEventQueueBase<T>::hasPendingEventsOfType const):
1512         (WebCore::GenericEventQueueBase<T>::suspend):
1513         (WebCore::GenericEventQueueBase<T>::resume):
1514         * dom/GenericEventQueue.h:
1515         (WebCore::GenericEventQueueBase::isSuspended const):
1516         (WebCore::MainThreadGenericEventQueue::MainThreadGenericEventQueue):
1517         (WebCore::GenericEventQueue::GenericEventQueue):
1518         Rename GenericEventQueue to MainThreadGenericEventQueue since its implementation relies
1519         on a global shared Timer to fire events. Introduce a new GenericEventQueue which can
1520         actually be used from any thread. This is useful for MessagePort, which is used both
1521         on the main thread and on worker threads.
1522
1523         * dom/MessagePort.cpp:
1524         (WebCore::MessagePort::MessagePort):
1525         (WebCore::MessagePort::close):
1526         (WebCore::MessagePort::suspend):
1527         (WebCore::MessagePort::resume):
1528         (WebCore::MessagePort::dispatchMessages):
1529         * dom/MessagePort.h:
1530         Use an GenericEventQueue in MessagePort for consistency with Worker.
1531         MessagePort is an ActiveDOMobject which returns true in canSuspend(),
1532         we therefore need to make sure it suspends event firing while
1533         suspended.
1534
1535         * html/HTMLMediaElement.h:
1536         * html/track/TrackListBase.h:
1537         * workers/Worker.cpp:
1538         (WebCore::Worker::Worker):
1539         (WebCore::Worker::terminate):
1540         (WebCore::Worker::canSuspendForDocumentSuspension const):
1541         (WebCore::Worker::suspend):
1542         (WebCore::Worker::resume):
1543         (WebCore::Worker::stop):
1544         (WebCore::Worker::hasPendingActivity const):
1545         (WebCore::Worker::notifyFinished):
1546         (WebCore::Worker::enqueueEvent):
1547         (WebCore::Worker::dispatchEvent):
1548         * workers/Worker.h:
1549         * workers/WorkerMessagingProxy.cpp:
1550         (WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
1551         (WebCore::WorkerMessagingProxy::postExceptionToWorkerObject):
1552
1553 2019-09-27  Keith Rollin  <krollin@apple.com>
1554
1555         Coalesce or remove PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
1556         https://bugs.webkit.org/show_bug.cgi?id=202119
1557         <rdar://problem/55638792>
1558
1559         Unreviewed, address post landing review comments for r248533 from
1560         Darin Adler.
1561
1562         No new tests -- no new or changed functionality.
1563
1564         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
1565         (WebCore::convert):
1566         (WebCore::subLocality): Deleted.
1567         (WebCore::setSubLocality): Deleted.
1568         (WebCore::subAdministrativeArea): Deleted.
1569         (WebCore::setSubAdministrativeArea): Deleted.
1570
1571 2019-09-30  Antti Koivisto  <antti@apple.com>
1572
1573         RenderLineBreak should use LineLayoutTraversal
1574         https://bugs.webkit.org/show_bug.cgi?id=202316
1575
1576         Reviewed by Zalan Bujtas.
1577
1578         Replace more path specific code with LineLayoutTraversal.
1579
1580         * Headers.cmake:
1581         * rendering/RenderLineBreak.cpp:
1582         (WebCore::RenderLineBreak::linesBoundingBox const):
1583         (WebCore::RenderLineBreak::absoluteRects const):
1584         (WebCore::RenderLineBreak::absoluteQuads const):
1585         (WebCore::simpleLineLayout): Deleted.
1586         * rendering/RenderTreeAsText.cpp:
1587         (WebCore::RenderTreeAsText::writeRenderObject):
1588         (WebCore::writeTextBox):
1589         * rendering/SimpleLineLayoutFunctions.cpp:
1590         (WebCore::SimpleLineLayout::computeBoundingBox): Deleted.
1591         (WebCore::SimpleLineLayout::collectAbsoluteRects): Deleted.
1592         (WebCore::SimpleLineLayout::rendererForPosition): Deleted.
1593         * rendering/SimpleLineLayoutFunctions.h:
1594         * rendering/line/LineLayoutTraversal.cpp:
1595         (WebCore::LineLayoutTraversal::ElementBoxIterator::ElementBoxIterator):
1596         (WebCore::LineLayoutTraversal::ElementBoxIterator::atEnd const):
1597         (WebCore::LineLayoutTraversal::elementBoxFor):
1598         (WebCore::LineLayoutTraversal::TextBox::rect const): Deleted.
1599         (WebCore::LineLayoutTraversal::TextBox::logicalRect const): Deleted.
1600         (WebCore::LineLayoutTraversal::TextBox::hasHyphen const): Deleted.
1601         (WebCore::LineLayoutTraversal::TextBox::isLeftToRightDirection const): Deleted.
1602         (WebCore::LineLayoutTraversal::TextBox::dirOverride const): Deleted.
1603         (WebCore::LineLayoutTraversal::TextBox::text const): Deleted.
1604         (WebCore::LineLayoutTraversal::TextBox::isLineBreak const): Deleted.
1605         (WebCore::LineLayoutTraversal::TextBox::localStartOffset const): Deleted.
1606         (WebCore::LineLayoutTraversal::TextBox::localEndOffset const): Deleted.
1607         (WebCore::LineLayoutTraversal::TextBox::length const): Deleted.
1608         (WebCore::LineLayoutTraversal::TextBox::isLastOnLine const): Deleted.
1609         (WebCore::LineLayoutTraversal::TextBox::isLast const): Deleted.
1610         (WebCore::LineLayoutTraversal::TextBox::iterator const): Deleted.
1611
1612         Move to header as templates.
1613
1614         * rendering/line/LineLayoutTraversal.h:
1615         (WebCore::LineLayoutTraversal::ElementBoxIterator::ElementBoxIterator):
1616         (WebCore::LineLayoutTraversal::ElementBoxIterator::operator bool const):
1617         (WebCore::LineLayoutTraversal::ElementBoxIterator::operator* const):
1618         (WebCore::LineLayoutTraversal::ElementBoxIterator::operator-> const):
1619
1620         Add a new iterator type for element boxes.
1621         It doesn't currently really iterate, is just allows testing for end.
1622
1623         (WebCore::LineLayoutTraversal::Box<Iterator>::rect const):
1624         (WebCore::LineLayoutTraversal::Box<Iterator>::logicalRect const):
1625         (WebCore::LineLayoutTraversal::Box<Iterator>::isLeftToRightDirection const):
1626         (WebCore::LineLayoutTraversal::Box<Iterator>::dirOverride const):
1627         (WebCore::LineLayoutTraversal::Box<Iterator>::isLineBreak const):
1628         (WebCore::LineLayoutTraversal::Box<Iterator>::iterator const):
1629
1630         Split properties that all inline boxes have out from TextBox.
1631         Make it a template class.
1632
1633         (WebCore::LineLayoutTraversal::TextBox<Iterator>::hasHyphen const):
1634         (WebCore::LineLayoutTraversal::TextBox<Iterator>::text const):
1635         (WebCore::LineLayoutTraversal::TextBox<Iterator>::localStartOffset const):
1636         (WebCore::LineLayoutTraversal::TextBox<Iterator>::localEndOffset const):
1637         (WebCore::LineLayoutTraversal::TextBox<Iterator>::length const):
1638         (WebCore::LineLayoutTraversal::TextBox<Iterator>::isLastOnLine const):
1639         (WebCore::LineLayoutTraversal::TextBox<Iterator>::isLast const):
1640
1641         Make a template class.
1642
1643         (WebCore::LineLayoutTraversal::hasTextBoxes): Deleted.
1644
1645 2019-09-30  Rob Buis  <rbuis@igalia.com>
1646
1647         No-Cors check should take into account same-origin
1648         https://bugs.webkit.org/show_bug.cgi?id=202353
1649
1650         Reviewed by Youenn Fablet.
1651
1652         No-Cors check should take into account same-origin, in that case the
1653         check should bail out, since same-origin is already handled in
1654         the first step of [1].
1655
1656         Test: imported/web-platform-tests/fetch/api/redirect/redirect-mode.any.html
1657
1658         [1] https://fetch.spec.whatwg.org/#main-fetch Step 5
1659
1660         * loader/cache/CachedResourceLoader.cpp:
1661         (WebCore::CachedResourceLoader::canRequest):
1662
1663 2019-09-30  Zan Dobersek  <zdobersek@igalia.com>
1664
1665         [Nicosia] Complete ScrollingTreeNicosia::createScrollingTreeNode()
1666         https://bugs.webkit.org/show_bug.cgi?id=202358
1667
1668         Reviewed by Carlos Garcia Campos.
1669
1670         * page/scrolling/nicosia/ScrollingTreeNicosia.cpp:
1671         (WebCore::ScrollingTreeNicosia::createScrollingTreeNode):
1672         Return appropriate objects for the remaining node types.
1673
1674 2019-09-30  Zan Dobersek  <zdobersek@igalia.com>
1675
1676         [Nicosia] Add missing conversion casts for LayerRepresentation objects
1677         https://bugs.webkit.org/show_bug.cgi?id=202357
1678
1679         Reviewed by Carlos Garcia Campos.
1680
1681         After r250491, we have to request explicit conversion of
1682         LayerRepresentation objects to Nicosia::PlatformLayer pointers.
1683
1684         * page/scrolling/nicosia/ScrollingTreeFixedNode.cpp:
1685         (WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren):
1686         * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp:
1687         (WebCore::ScrollingTreeFrameScrollingNodeNicosia::commitStateBeforeChildren):
1688         (WebCore::ScrollingTreeFrameScrollingNodeNicosia::handleWheelEvent):
1689         (WebCore::ScrollingTreeFrameScrollingNodeNicosia::repositionScrollingLayers):
1690         * page/scrolling/nicosia/ScrollingTreeOverflowScrollProxyNode.cpp:
1691         (WebCore::ScrollingTreeOverflowScrollProxyNode::commitStateBeforeChildren):
1692         * page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp:
1693         (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::repositionScrollingLayers):
1694         (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::handleWheelEvent):
1695         * page/scrolling/nicosia/ScrollingTreePositionedNode.cpp:
1696         (WebCore::ScrollingTreePositionedNode::commitStateBeforeChildren):
1697         * page/scrolling/nicosia/ScrollingTreeStickyNode.cpp:
1698         (WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren):
1699
1700 2019-09-29  Zan Dobersek  <zdobersek@igalia.com>
1701
1702         ScrollingTreeScrollingNode: use LayerRepresentation for scroll container, scrolled contents layers
1703         https://bugs.webkit.org/show_bug.cgi?id=202256
1704         <rdar://problem/55772092>
1705
1706         Reviewed by Simon Fraser.
1707
1708         Make the scroll container and scrolled contents layer holders
1709         platform-independent by using the LayerRepresentation as the underlying
1710         type for the two member variables in ScrollingTreeScrollingNode.
1711
1712         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1713         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
1714         * page/scrolling/ScrollingTreeScrollingNode.h:
1715         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1716         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
1717         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1718         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
1719
1720 2019-09-28  Brent Fulgham  <bfulgham@apple.com>
1721
1722         [FTW] Correct compositing, shadow, and radial gradient implementations
1723         https://bugs.webkit.org/show_bug.cgi?id=202177
1724
1725         Reviewed by Fujii Hironori.
1726
1727         This patch corrects a number of implementation errors in basic Canvas
1728         drawing operations.
1729
1730         Tested by canvas/philip/tests 
1731
1732         * platform/graphics/win/Direct2DOperations.cpp:
1733         (WebCore::Direct2D::State::setCompositeOperation): Initialize blend and
1734         composite modes to correct defaults.
1735         (WebCore::Direct2D::drawWithShadowHelper): Correct value used for blur
1736         standard deviation to more closely match other browser output.
1737         * platform/graphics/win/Direct2DUtilities.cpp:
1738         (WebCore::Direct2D::createBitmapCopyFromContext): Added helper function.
1739         * platform/graphics/win/Direct2DUtilities.h:
1740         * platform/graphics/win/GradientDirect2D.cpp:
1741         (WebCore::Gradient::generateGradient): Properly handle the case of a non-zero
1742         initial gradient radius. Properly compute the final radius.
1743         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
1744         (WebCore::ImageBufferData::readDataFromBitmapIfNeeded const): Update to use ID2D1DeviceContext
1745         from platformContext, rather than searching for it each time.
1746         (WebCore::ImageBufferData::compatibleBitmap): Ditto.
1747         * platform/graphics/win/PlatformContextDirect2D.cpp:
1748         (WebCore::PlatformContextDirect2D::PlatformContextDirect2D): Grab the ID2D1DeviceContext for
1749         the RenderTarget at construction time.
1750         (WebCore::PlatformContextDirect2D::setRenderTarget): Ditto.
1751         (WebCore::PlatformContextDirect2D::endDraw): Perform compositing operations when needed.
1752         (WebCore::PlatformContextDirect2D::compositeIfNeeded): Added.
1753         (WebCore::PlatformContextDirect2D::setBlendAndCompositeMode): Update to properly set the
1754         blend and compositing mode (depending on global value set for the canvas.)
1755         * platform/graphics/win/PlatformContextDirect2D.h:
1756         (WebCore::PlatformContextDirect2D::deviceContext):
1757         (WebCore::PlatformContextDirect2D::setRenderTarget): Deleted.
1758         (WebCore::PlatformContextDirect2D::setBlendMode): Deleted.
1759         (WebCore::PlatformContextDirect2D::setCompositeMode): Deleted.
1760
1761 2019-09-29  Zan Dobersek  <zdobersek@igalia.com>
1762
1763         Tighten up LayerRepresentation operators
1764         https://bugs.webkit.org/show_bug.cgi?id=202344
1765
1766         Reviewed by Simon Fraser.
1767
1768         Make the operators on the LayerRepresentation class explicit.
1769         Additionally, the bool operator is added to the class, allowing objects
1770         of this class to be safely used in boolean contexts like null checks.
1771         Before, use in such contexts fell back to using the
1772         GraphicsLayer::PlatformLayerID operator which caused asserts when the
1773         internal representation was of different type.
1774
1775         While the explicit operators prevent misuse, they do require additional
1776         conversion casts to retrieve the internal LayerRepresentation value.
1777
1778         * page/scrolling/ScrollingStateNode.h:
1779         (WebCore::LayerRepresentation::operator GraphicsLayer* const):
1780         (WebCore::LayerRepresentation::operator PlatformLayer* const):
1781         (WebCore::LayerRepresentation::operator GraphicsLayer::PlatformLayerID const):
1782         (WebCore::LayerRepresentation::operator bool const):
1783         (WebCore::LayerRepresentation::toRepresentation const):
1784         Add a missing ASSERT_NOT_REACHED() invocation.
1785         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1786         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
1787         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
1788         (WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren):
1789         * page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNode.mm:
1790         (WebCore::ScrollingTreeOverflowScrollProxyNode::commitStateBeforeChildren):
1791         * page/scrolling/cocoa/ScrollingTreePositionedNode.mm:
1792         (WebCore::ScrollingTreePositionedNode::commitStateBeforeChildren):
1793         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
1794         (WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren):
1795         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1796         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
1797
1798 2019-09-29  Zalan Bujtas  <zalan@apple.com>
1799
1800         [LFC][IFC] Remove InlineLayout abstraction layer
1801         https://bugs.webkit.org/show_bug.cgi?id=202352
1802         <rdar://problem/55811532>
1803
1804         Reviewed by Antti Koivisto.
1805
1806         Move InlineLayout functions to InlineFormattingContext. Now inline layout has
1807         1. InlineFormattingContext -high level layout and preferred width computation, collecting inline content, constructing display boxes
1808         2. LineLayout -responsible for placing inline content on the current line (partial inline content handling, line breaking etc)
1809         3. Line -represents an actual line, turns inline content into runs.
1810
1811         * Sources.txt:
1812         * WebCore.xcodeproj/project.pbxproj:
1813         * layout/inlineformatting/InlineFormattingContext.cpp:
1814         (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
1815         (WebCore::Layout::InlineFormattingContext::lineLayout):
1816         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
1817         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthForConstraint const):
1818         (WebCore::Layout::InlineFormattingContext::initialConstraintsForLine):
1819         (WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
1820         * layout/inlineformatting/InlineFormattingContext.h:
1821         (WebCore::Layout::InlineFormattingContext::InlineLayout::layoutState const): Deleted.
1822         (WebCore::Layout::InlineFormattingContext::InlineLayout::formattingContext const): Deleted.
1823         (WebCore::Layout::InlineFormattingContext::InlineLayout::formattingRoot const): Deleted.
1824         (WebCore::Layout::InlineFormattingContext::InlineLayout::formattingState): Deleted.
1825         (WebCore::Layout::InlineFormattingContext::InlineLayout::widthConstraint const): Deleted.
1826         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp: Removed.
1827         * layout/inlineformatting/InlineFormattingState.h:
1828         (WebCore::Layout::InlineFormattingState::inlineItems const):
1829         * layout/inlineformatting/InlineLineLayout.cpp: Added.
1830         (WebCore::Layout::inlineItemWidth):
1831         (WebCore::Layout::LineLayout::LineInput::LineInput):
1832         (WebCore::Layout::LineLayout::UncommittedContent::add):
1833         (WebCore::Layout::LineLayout::UncommittedContent::reset):
1834         (WebCore::Layout::LineLayout::LineLayout):
1835         (WebCore::Layout::LineLayout::commitPendingContent):
1836         (WebCore::Layout::LineLayout::close):
1837         (WebCore::Layout::LineLayout::placeInlineItem):
1838         (WebCore::Layout::LineLayout::layout):
1839         * layout/inlineformatting/InlineLineLayout.h: Added.
1840         (WebCore::Layout::LineLayout::formattingContext const):
1841         (WebCore::Layout::LineLayout::UncommittedContent::runs):
1842         (WebCore::Layout::LineLayout::UncommittedContent::isEmpty const):
1843         (WebCore::Layout::LineLayout::UncommittedContent::size const):
1844         (WebCore::Layout::LineLayout::UncommittedContent::width const):
1845
1846 2019-09-29  Zan Dobersek  <zdobersek@igalia.com>
1847
1848         [Nicosia] Add overflow, overflow proxy node implementations
1849         https://bugs.webkit.org/show_bug.cgi?id=202306
1850
1851         Reviewed by Carlos Garcia Campos.
1852
1853         Add the ScrollingTreeOverflowScrollProxyNode and
1854         ScrollingTreeOverflowScrollingNodeNicosia classes, implementing the
1855         missing overlfow node types. Both implementations are based on the
1856         corresponsing classes for Cocoa/Mac platforms and should ideally
1857         share most of the platform-agnostic logic.
1858
1859         * SourcesWPE.txt:
1860         * page/scrolling/nicosia/ScrollingTreeOverflowScrollProxyNode.cpp: Added.
1861         (WebCore::ScrollingTreeOverflowScrollProxyNode::create):
1862         (WebCore::ScrollingTreeOverflowScrollProxyNode::ScrollingTreeOverflowScrollProxyNode):
1863         (WebCore::ScrollingTreeOverflowScrollProxyNode::commitStateBeforeChildren):
1864         (WebCore::ScrollingTreeOverflowScrollProxyNode::applyLayerPositions):
1865         (WebCore::ScrollingTreeOverflowScrollProxyNode::dumpProperties const):
1866         * page/scrolling/nicosia/ScrollingTreeOverflowScrollProxyNode.h: Added.
1867         * page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp: Added.
1868         (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::create):
1869         (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::ScrollingTreeOverflowScrollingNodeNicosia):
1870         (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::commitStateAfterChildren):
1871         (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::adjustedScrollPosition const):
1872         (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::repositionScrollingLayers):
1873         (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::handleWheelEvent):
1874         * page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h: Added.
1875
1876 2019-09-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
1877
1878         Crash when removing the target element while animating its attributes
1879         https://bugs.webkit.org/show_bug.cgi?id=202247
1880
1881         Reviewed by Darin Adler.
1882
1883         If SMIL is animating a CSS attribute, there is a chance the animation is
1884         ended while it is being started or progressed. For that reason, the member
1885         SVGAnimateElementBase::m_animator has to be made RefPtr and it has to be
1886         be protected in resetAnimatedType() and calculateAnimatedValue().
1887
1888         While SMILTimeContainer::updateAnimations() is calling progress() for the
1889         scheduled animation elements, SMILTimeContainer::unschedule() might get
1890         called if processing an animation causes events to be dispatched. For that
1891         reason we need to copy the scheduled animations Vector before processing
1892         them so we avoid changing the Vector while looping through its items.
1893
1894         Remove the guard SMILTimeContainer::m_preventScheduledAnimationsChanges
1895         which was added in r129670 for debugging purposes. In some situations, 
1896         the scheduled animations map could be modified out from under some of the
1897         functions of SMILTimeContainer.
1898
1899         Test: svg/animations/animate-and-remove-target-element.html
1900
1901         * svg/SVGAnimateElementBase.cpp:
1902         (WebCore::SVGAnimateElementBase::resetAnimatedType):
1903         (WebCore::SVGAnimateElementBase::calculateAnimatedValue):
1904         * svg/SVGAnimateElementBase.h:
1905         * svg/SVGElement.cpp:
1906         (WebCore::SVGElement::createAnimator):
1907         * svg/SVGElement.h:
1908         * svg/animation/SMILTimeContainer.cpp:
1909         (WebCore::SMILTimeContainer::schedule):
1910         (WebCore::SMILTimeContainer::unschedule):
1911         (WebCore::SMILTimeContainer::setElapsed):
1912         (WebCore::SMILTimeContainer::sortByPriority):
1913         (WebCore::SMILTimeContainer::processAnimations):
1914         (WebCore::SMILTimeContainer::processScheduledAnimations):
1915         (WebCore::SMILTimeContainer::updateAnimations):
1916         (WebCore::SMILTimeContainer::~SMILTimeContainer): Deleted.
1917         * svg/animation/SMILTimeContainer.h:
1918         * svg/animation/SVGSMILElement.cpp:
1919         (WebCore::SVGSMILElement::calculateNextProgressTime const):
1920         * svg/properties/SVGAnimatedPropertyAccessorImpl.h:
1921         * svg/properties/SVGAnimatedPropertyAnimatorImpl.h:
1922         * svg/properties/SVGAnimatedPropertyPairAccessorImpl.h:
1923         * svg/properties/SVGAnimatedPropertyPairAnimator.h:
1924         * svg/properties/SVGAnimatedPropertyPairAnimatorImpl.h:
1925         * svg/properties/SVGAttributeAnimator.h:
1926         * svg/properties/SVGMemberAccessor.h:
1927         (WebCore::SVGMemberAccessor::createAnimator const):
1928         * svg/properties/SVGPrimitivePropertyAnimator.h:
1929         (WebCore::SVGPrimitivePropertyAnimator::create):
1930         * svg/properties/SVGPropertyAnimatorFactory.h:
1931         (WebCore::SVGPropertyAnimatorFactory::createAnimator):
1932         * svg/properties/SVGPropertyOwnerRegistry.h:
1933         * svg/properties/SVGPropertyRegistry.h:
1934         * svg/properties/SVGValuePropertyAnimatorImpl.h:
1935         * svg/properties/SVGValuePropertyListAnimatorImpl.h:
1936
1937 2019-09-28  Zalan Bujtas  <zalan@apple.com>
1938
1939         [LFC][IFC] Move horizontal alignment to Line
1940         https://bugs.webkit.org/show_bug.cgi?id=202351
1941         <rdar://problem/55810139>
1942
1943         Reviewed by Antti Koivisto.
1944
1945         Line should be able to finalize the run placement including horizontal alignment.
1946
1947         * layout/Verification.cpp:
1948         (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
1949         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
1950         (WebCore::Layout::LineInput::LineInput):
1951         (WebCore::Layout::LineLayout::LineLayout):
1952         (WebCore::Layout::InlineFormattingContext::InlineLayout::layout):
1953         (WebCore::Layout::InlineFormattingContext::InlineLayout::computedIntrinsicWidth const):
1954         * layout/inlineformatting/InlineLine.cpp:
1955         (WebCore::Layout::Line::Line):
1956         (WebCore::Layout::Line::isVisuallyEmpty const):
1957         (WebCore::Layout::Line::close):
1958         (WebCore::Layout::Line::verticalAlignContent):
1959         (WebCore::Layout::Line::horizontalAlignContent):
1960         (WebCore::Layout::Line::appendInlineContainerStart):
1961         (WebCore::Layout::Line::appendTextContent):
1962         (WebCore::Layout::Line::appendNonReplacedInlineBox):
1963         (WebCore::Layout::Line::appendHardLineBreak):
1964         (WebCore::Layout::Line::inlineItemContentHeight const):
1965         * layout/inlineformatting/InlineLine.h:
1966
1967 2019-09-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1968
1969         [IDL] Support record<DOMString, *Callback> in bindings
1970         https://bugs.webkit.org/show_bug.cgi?id=202326
1971
1972         Reviewed by Sam Weinig.
1973
1974         Currently, IDLRecord's converter assumes that the value type (template argument V) can be converted by passing
1975         in only an ExecState and the JSValue, since it calls `auto typedValue = Converter<V>::convert(state, subValue)`.
1976         However, IDLCallbackFunctions additionally require the JSDOMGlobalObject (see JSDOMConverterCallbacks.h). This
1977         results in a compilation error in generated code, when attempting to convert the record.
1978
1979         To fix this, teach Converter<IDLRecord<K, V>> to accept three arguments (the ExecState, value, and global
1980         object) in the case where V requires the global object. Additionally, let the bindings generator know that
1981         JSValue to native object conversion requires the global object, by returning whether or not the value type of
1982         the IDL record requires the global object, in the case where the given type is a record.
1983
1984         * bindings/js/JSDOMConvertRecord.h:
1985         * bindings/scripts/CodeGeneratorJS.pm:
1986         (JSValueToNativeDOMConvertNeedsGlobalObject):
1987         * bindings/scripts/test/JS/JSTestObj.cpp:
1988
1989         Test this scenario by augmenting TestObj.idl with record<DOMString, VoidCallback>.
1990
1991         (WebCore::jsTestObjStringVoidCallbackRecordAttrGetter):
1992         (WebCore::jsTestObjStringVoidCallbackRecordAttr):
1993         (WebCore::setJSTestObjStringVoidCallbackRecordAttrSetter):
1994         (WebCore::setJSTestObjStringVoidCallbackRecordAttr):
1995         * bindings/scripts/test/TestObj.idl:
1996
1997 2019-09-28  Zalan Bujtas  <zalan@apple.com>
1998
1999         [LFC][IFC] Line::InitialConstraints's heightAndBaseline should be optional
2000         https://bugs.webkit.org/show_bug.cgi?id=202348
2001
2002         Reviewed by Antti Koivisto.
2003
2004         Vertical properties are undefined while computing the preferred width.
2005
2006         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
2007         (WebCore::Layout::LineInput::LineInput):
2008         (WebCore::Layout::InlineFormattingContext::InlineLayout::computedIntrinsicWidth const):
2009         * layout/inlineformatting/InlineLine.cpp:
2010         (WebCore::Layout::Line::Line):
2011         * layout/inlineformatting/InlineLine.h:
2012
2013 2019-09-28  Chris Dumez  <cdumez@apple.com>
2014
2015         [Experiment][iOS] Add temporary HTTP header to distinguish iPads for requests to Google
2016         https://bugs.webkit.org/show_bug.cgi?id=202335
2017         <rdar://problem/55790994>
2018
2019         Reviewed by Maciej Stachowiak.
2020
2021         * loader/cache/CachedResourceLoader.cpp:
2022         (WebCore::CachedResourceLoader::requestResource):
2023         * platform/network/HTTPHeaderNames.in:
2024
2025 2019-09-28  Zalan Bujtas  <zalan@apple.com>
2026
2027         [LFC][IFC] Line::Box should have a const public interface
2028         https://bugs.webkit.org/show_bug.cgi?id=202336
2029         <rdar://problem/55798628>
2030
2031         Reviewed by Antti Koivisto.
2032
2033         Clean up Line::Box interface.
2034
2035         * layout/inlineformatting/InlineLine.cpp:
2036         (WebCore::Layout::Line::close):
2037         * layout/inlineformatting/InlineLine.h:
2038         (WebCore::Layout::Line::Run::displayRun const):
2039         (WebCore::Layout::Line::Run::isVisuallyEmpty const):
2040         (WebCore::Layout::Line::Run::expand):
2041         (WebCore::Layout::Line::Run::displayRun): Deleted.
2042
2043 2019-09-27  Chris Dumez  <cdumez@apple.com>
2044
2045         Pages using WebGLRenderingContext fail to enter the back/forward cache
2046         https://bugs.webkit.org/show_bug.cgi?id=202318
2047         <rdar://problem/55783612>
2048
2049         Reviewed by Tim Horton.
2050
2051         Allow pages with a WebGLRenderingContext to enter the back/forward cache by updating the
2052         implementation to use SuspendableTimers to fire JS events. This guarantees that no events
2053         will be fired (and thus no JS will run) while in the page cache.
2054
2055         This was preventing some of the pages on weather.com and facebook.com from entering the
2056         back/forward cache.
2057
2058         Test: fast/canvas/webgl/canvas-webgl-page-cache.html
2059
2060         * dom/DocumentEventQueue.cpp:
2061         * html/canvas/WebGLRenderingContextBase.cpp:
2062         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
2063         (WebCore::WebGLRenderingContextBase::canSuspendForDocumentSuspension const):
2064         (WebCore::WebGLRenderingContextBase::suspend):
2065         (WebCore::WebGLRenderingContextBase::resume):
2066         (WebCore::WebGLRenderingContextBase::dispatchContextLostEvent):
2067         (WebCore::WebGLRenderingContextBase::maybeRestoreContext):
2068         (WebCore::WebGLRenderingContextBase::dispatchContextChangedNotification):
2069         (WebCore::WebGLRenderingContextBase::dispatchContextChangedEvent):
2070         * html/canvas/WebGLRenderingContextBase.h:
2071         * page/DOMTimer.cpp:
2072         (WebCore::DOMTimer::DOMTimer):
2073         * page/DOMTimer.h:
2074         * page/SuspendableTimer.cpp:
2075         (WebCore::SuspendableTimerBase::SuspendableTimerBase):
2076         (WebCore::SuspendableTimerBase::hasPendingActivity const):
2077         (WebCore::SuspendableTimerBase::stop):
2078         (WebCore::SuspendableTimerBase::suspend):
2079         (WebCore::SuspendableTimerBase::resume):
2080         (WebCore::SuspendableTimerBase::canSuspendForDocumentSuspension const):
2081         (WebCore::SuspendableTimerBase::didStop):
2082         (WebCore::SuspendableTimerBase::cancel):
2083         (WebCore::SuspendableTimerBase::startRepeating):
2084         (WebCore::SuspendableTimerBase::startOneShot):
2085         (WebCore::SuspendableTimerBase::repeatInterval const):
2086         (WebCore::SuspendableTimerBase::augmentFireInterval):
2087         (WebCore::SuspendableTimerBase::augmentRepeatInterval):
2088         (WebCore::SuspendableTimer::activeDOMObjectName const):
2089         * page/SuspendableTimer.h:
2090
2091 2019-09-27  Adrian Perez de Castro  <aperez@igalia.com>
2092
2093         [GTK][WPE] Fixes for non-unified builds after r249714
2094         https://bugs.webkit.org/show_bug.cgi?id=202304
2095
2096         Reviewed by Youenn Fablet.
2097
2098         No new tests needed.
2099
2100         * Modules/websockets/WorkerThreadableWebSocketChannel.cpp: Add missing inclusion of Frame.h
2101         to make the compiler stop complaining about Frame being used without being defined.
2102         * inspector/InspectorShaderProgram.h: Add missing inclusion of wtf/Variant.h, where
2103         WTF::Monostate is defined; and prefixed the usage with its namespace.
2104
2105 2019-09-27  Andres Gonzalez  <andresg_22@apple.com>
2106
2107         Support accessibility for <figure> element on iOS.
2108         https://bugs.webkit.org/show_bug.cgi?id=202272
2109         <rdar://problem/54789907>
2110
2111         Reviewed by Chris Fleizach.
2112
2113         Test: accessibility/ios-simulator/figure-element.html
2114
2115         Added a role description for the <figure> element.
2116         * accessibility/AccessibilityObject.cpp:
2117         (WebCore::AccessibilityObject::roleDescription const):
2118
2119 2019-09-27  Zalan Bujtas  <zalan@apple.com>
2120
2121         [iPadOS] Can’t use RalphLauren.com on iPad because hover menus don’t stay up
2122         https://bugs.webkit.org/show_bug.cgi?id=202331
2123         <rdar://problem/55629493>
2124
2125         Reviewed by Tim Horton.
2126
2127         Unfortunately the top level menu items now are ARIA labelled as 'buttons' and that triggers the fast path on content observation.
2128         This patch introduces a quirk on ralphLauren.com to ignore the ARIA labels when checking whether the target node should always click through.
2129
2130         * page/Quirks.cpp:
2131         (WebCore::Quirks::shouldIgnoreAriaForFastPathContentObservationCheck const):
2132         * page/Quirks.h:
2133
2134 2019-09-27  Per Arne Vollan  <pvollan@apple.com>
2135
2136         [Win] Crash under FontCache::lastResortFallbackFont
2137         https://bugs.webkit.org/show_bug.cgi?id=202325
2138         <rdar://problem/47856730>
2139
2140         Reviewed by Brent Fulgham.
2141
2142         As demonstrated by crash reports, there seems to be cases where we are not able to create a last resort fallback font  
2143         on Windows. If all attempts to create a fallback font fail, create a font from the default UI font.
2144  
2145         No new tests. I have not been able to reproduce this issue. 
2146
2147         * platform/graphics/win/FontCacheWin.cpp:
2148         (WebCore::FontCache::lastResortFallbackFont):
2149
2150 2019-09-27  Jiewen Tan  <jiewen_tan@apple.com>
2151
2152         Unreviewed, rolling out r250397.
2153
2154         caused failure on iOS 13
2155
2156         Reverted changeset:
2157
2158         "REGRESSION: [ Catalina WK2 ] http/wpt/webauthn/public-key-
2159         credential-create-success-u2f.https.html is failing"
2160         https://bugs.webkit.org/show_bug.cgi?id=201620
2161         https://trac.webkit.org/changeset/250397
2162
2163 2019-09-27  Jer Noble  <jer.noble@apple.com>
2164
2165         [iOS] Vimeo fails to AirPlay in desktop mode
2166         https://bugs.webkit.org/show_bug.cgi?id=202322
2167
2168         Reviewed by Eric Carlson.
2169
2170         Add a Quirk which opts Vimeo out of the preload=auto restriction, and allows their
2171         second video element containing a HLS stream to correctly start AirPlaying when the
2172         system route changes.
2173
2174         * html/HTMLMediaElement.cpp:
2175         (WebCore::HTMLMediaElement::finishInitialization):
2176         * page/Quirks.cpp:
2177         (WebCore::Quirks::needsPreloadAutoQuirk const):
2178         * page/Quirks.h:
2179
2180 2019-09-27  Zalan Bujtas  <zalan@apple.com>
2181
2182         [LFC][IFC] Line::close should merge the text runs.
2183         https://bugs.webkit.org/show_bug.cgi?id=202319
2184         <rdar://problem/55785949>
2185
2186         Reviewed by Antti Koivisto.
2187
2188         Now Line::close returns the final Display::Run list.
2189
2190         * layout/displaytree/DisplayRect.h:
2191         (WebCore::Display::Rect::expandHorizontally):
2192         (WebCore::Display::Rect::expandVertically):
2193         (WebCore::Display::Rect::expand):
2194         * layout/displaytree/DisplayRun.h:
2195         (WebCore::Display::Run::expandVertically):
2196         (WebCore::Display::Run::expandHorizontally):
2197         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
2198         (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns):
2199         * layout/inlineformatting/InlineLine.cpp:
2200         (WebCore::Layout::Line::close):
2201         * layout/inlineformatting/InlineLine.h:
2202         (WebCore::Layout::Line::Run::displayRun):
2203
2204 2019-09-27  Chris Dumez  <cdumez@apple.com>
2205
2206         Allow pages served over HTTPS with `Cache-Control: no-store` header to enter the back/forward cache
2207         https://bugs.webkit.org/show_bug.cgi?id=202314
2208         <rdar://problem/55783482>
2209
2210         Reviewed by Alex Christensen.
2211
2212         Allow pages served over HTTPS with `Cache-Control: no-store` header to enter the back/forward cache.
2213         This was preventing all pages on Facebook.com to enter the back/forward cache.
2214
2215         No new tests, updated existing test.
2216
2217         * history/PageCache.cpp:
2218         (WebCore::canCacheFrame):
2219
2220 2019-09-27  Devin Rousso  <drousso@apple.com>
2221
2222         Flaky Test: inspector/canvas/updateShader.html
2223         https://bugs.webkit.org/show_bug.cgi?id=202186
2224         <rdar://problem/55716053>
2225
2226         Reviewed by Joseph Pecoraro.
2227
2228         If the `WebGLProgram` outlives it's `WebGLRenderingContext`, the `ScriptExecutionContext*`
2229         that was provided in the constructor won't be invalidated leading to the bad access crash.
2230
2231         Rather than pass the `ScriptExecutionContext*` directly, have `WebGLProgram` inherit from
2232         `ContextDestructionObserver` so that it can propertly invalidate (and notify Web Inspector)
2233         when the related context is about to be destroyed.
2234
2235         Test: inspector/canvas/updateShader.html
2236
2237         * html/canvas/WebGLProgram.h:
2238         (WebCore::WebGLProgram::scriptExecutionContext const): Deleted.
2239         * html/canvas/WebGLProgram.cpp:
2240         (WebCore::WebGLProgram::WebGLProgram):
2241         (WebCore::WebGLProgram::contextDestroyed): Added.
2242
2243 2019-09-27  Zalan Bujtas  <zalan@apple.com>
2244
2245         [LFC][IFC] Replace Line::Run's logicalRect/textContext with Display::Run
2246         https://bugs.webkit.org/show_bug.cgi?id=202313
2247         <rdar://problem/55782430>
2248
2249         Reviewed by Antti Koivisto.
2250
2251         Display::Run is a container for logical rect and text context. Let's replace Line::Run's logical rect/text context with Display::Run.
2252
2253         * layout/Verification.cpp:
2254         (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
2255         (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
2256         * layout/displaytree/DisplayRun.h:
2257         (WebCore::Display::Run::logicalRect const):
2258         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
2259         (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns):
2260         (WebCore::Layout::InlineFormattingContext::InlineLayout::alignRuns const):
2261         * layout/inlineformatting/InlineFormattingContextQuirks.cpp:
2262         (WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const):
2263         * layout/inlineformatting/InlineFormattingState.h:
2264         (WebCore::Layout::InlineFormattingState::addInlineRun):
2265         * layout/inlineformatting/InlineLine.cpp:
2266         (WebCore::Layout::Line::Run::Run):
2267         (WebCore::Layout::Line::isVisuallyEmpty const):
2268         (WebCore::Layout::Line::appendNonBreakableSpace):
2269         (WebCore::Layout::Line::appendTextContent):
2270         (WebCore::Layout::Line::appendNonReplacedInlineBox):
2271         (WebCore::Layout::Line::appendHardLineBreak):
2272         * layout/inlineformatting/InlineLine.h:
2273         (WebCore::Layout::Line::Run::displayRun const):
2274         (WebCore::Layout::Line::Run::logicalRect const):
2275         (WebCore::Layout::Line::Run::adjustLogicalTop):
2276         (WebCore::Layout::Line::Run::moveVertically):
2277         (WebCore::Layout::Line::Run::moveHorizontally):
2278         (WebCore::Layout::Line::Run::textContext const): Deleted.
2279         * layout/layouttree/LayoutTreeBuilder.cpp:
2280         (WebCore::Layout::outputInlineRuns):
2281
2282 2019-09-27  Truitt Savell  <tsavell@apple.com>
2283
2284         Unreviewed, rolling out r250415.
2285
2286         Broke iOS debug testing with 50 crashes and 850 API failure
2287
2288         Reverted changeset:
2289
2290         "ScrollingTreeScrollingNode: use LayerRepresentation for
2291         scroll container, scrolled contents layers"
2292         https://bugs.webkit.org/show_bug.cgi?id=202256
2293         https://trac.webkit.org/changeset/250415
2294
2295 2019-09-27  Alex Christensen  <achristensen@webkit.org>
2296
2297         Move service worker process termination delay disabling from process pool to website data store
2298         https://bugs.webkit.org/show_bug.cgi?id=202308
2299
2300         Reviewed by Chris Dumez.
2301
2302         * workers/service/server/SWServer.cpp:
2303         (WebCore::SWServer::SWServer):
2304         (WebCore::SWServer::unregisterServiceWorkerClient):
2305         * workers/service/server/SWServer.h:
2306         (WebCore::SWServer::disableServiceWorkerProcessTerminationDelay): Deleted.
2307
2308 2019-09-27  Chris Dumez  <cdumez@apple.com>
2309
2310         IDBRequest should not prevent a page from entering the back/forward cache
2311         https://bugs.webkit.org/show_bug.cgi?id=202270
2312         <rdar://problem/55744717>
2313
2314         Reviewed by Youenn Fablet.
2315
2316         Update IDBRequest::canSuspendForDocumentSuspension() to return true instead of
2317         false. IDBRequest can only fire 2 events (error / success) and for both its
2318         merely enqueues the Event to the DocumentEventQueue. The DocumentEventQueue
2319         uses a SuspendableTimer (which will be suspended while the document is in the
2320         page cache) so there is no risk of firing the events (and thus running script)
2321         while in the page cache.
2322
2323         Test: storage/indexeddb/IDBRequest-page-cache.html
2324
2325         * Modules/indexeddb/IDBRequest.cpp:
2326         (WebCore::IDBRequest::canSuspendForDocumentSuspension const):
2327
2328 2019-09-27  Zalan Bujtas  <zalan@apple.com>
2329
2330         [LFC][IFC] Remove redundant Line::TextContext member variables
2331         https://bugs.webkit.org/show_bug.cgi?id=202300
2332         <rdar://problem/55769916>
2333
2334         Reviewed by Antti Koivisto.
2335
2336         This is in preparation for using Display::Run in Line::Run instead of Display::Rect + TextContext.
2337
2338         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
2339         (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns):
2340         * layout/inlineformatting/InlineFormattingContextQuirks.cpp:
2341         (WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const):
2342         * layout/inlineformatting/InlineLine.cpp:
2343         (WebCore::Layout::Line::Run::isWhitespace const):
2344         (WebCore::Layout::Line::Run::canBeExtended const):
2345         (WebCore::Layout::Line::isVisuallyEmpty const):
2346         (WebCore::Layout::Line::removeTrailingTrimmableContent):
2347         (WebCore::Layout::Line::trailingTrimmableWidth const):
2348         (WebCore::Layout::Line::appendTextContent):
2349         * layout/inlineformatting/InlineLine.h:
2350         (WebCore::Layout::Line::Run::isVisuallyEmpty const):
2351         (WebCore::Layout::Line::Run::setVisuallyIsEmpty):
2352         (WebCore::Layout::Line::Run::setTextIsCollapsed): Deleted.
2353
2354 2019-09-27  Zan Dobersek  <zdobersek@igalia.com>
2355
2356         [Nicosia] Implement frame scrolling functionality
2357         https://bugs.webkit.org/show_bug.cgi?id=202201
2358
2359         Reviewed by Carlos Garcia Campos.
2360
2361         Implement logic in the ScrollingTreeFrameScrollingNodeNicosia class,
2362         largely following the Mac port's implementation but skipping areas we
2363         don't support or can keep simple, like CSS scroll snap, frame pinning
2364         and more complex wheel event handling through the platform-specific
2365         delegate behavior.
2366
2367         * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp:
2368         (WebCore::ScrollingTreeFrameScrollingNodeNicosia::commitStateBeforeChildren):
2369         (WebCore::ScrollingTreeFrameScrollingNodeNicosia::commitStateAfterChildren):
2370         (WebCore::ScrollingTreeFrameScrollingNodeNicosia::handleWheelEvent):
2371         (WebCore::ScrollingTreeFrameScrollingNodeNicosia::adjustedScrollPosition const):
2372         (WebCore::ScrollingTreeFrameScrollingNodeNicosia::currentScrollPositionChanged):
2373         (WebCore::ScrollingTreeFrameScrollingNodeNicosia::repositionScrollingLayers):
2374         (WebCore::ScrollingTreeFrameScrollingNodeNicosia::repositionRelatedLayers):
2375         * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h:
2376
2377 2019-09-27  Zan Dobersek  <zdobersek@igalia.com>
2378
2379         [Nicosia] ScrollingCoordinatorNicosia should handle wheel events coming from the main thread
2380         https://bugs.webkit.org/show_bug.cgi?id=202275
2381
2382         Reviewed by Carlos Garcia Campos.
2383
2384         * page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp:
2385         (WebCore::ScrollingCoordinatorNicosia::handleWheelEvent):
2386         Handle wheel events that get rerouted through the main thread,
2387         dispatching them back to the scrolling thread so that they end up
2388         performing the desired scroll if possible.
2389
2390 2019-09-27  Zan Dobersek  <zdobersek@igalia.com>
2391
2392         [CoordinatedGraphics] support bounds origin
2393         https://bugs.webkit.org/show_bug.cgi?id=198998
2394
2395         Reviewed by Carlos Garcia Campos.
2396
2397         Add bounds-origin support to the CoordinatedGraphics stack. Currently we
2398         take the short-cut implementation of just combining the bounds origin
2399         and the position value and incorporating them into the layer transform
2400         we calculate in TextureMapperLayer.
2401
2402         Additional boilerplate code is added, as required, to relay the
2403         WebCore::GraphicsLayer change of bounds origin to the rendering system.
2404
2405         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
2406         (Nicosia::CompositionLayer::flushState):
2407         * platform/graphics/texmap/TextureMapperLayer.cpp:
2408         (WebCore::TextureMapperLayer::computeTransformsRecursive):
2409         (WebCore::TextureMapperLayer::setBoundsOrigin):
2410         * platform/graphics/texmap/TextureMapperLayer.h:
2411         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2412         (WebCore::CoordinatedGraphicsLayer::setBoundsOrigin):
2413         (WebCore::CoordinatedGraphicsLayer::computePositionRelativeToBase):
2414         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2415
2416 2019-09-26  Zan Dobersek  <zdobersek@igalia.com>
2417
2418         ScrollingTreeScrollingNode: use LayerRepresentation for scroll container, scrolled contents layers
2419         https://bugs.webkit.org/show_bug.cgi?id=202256
2420
2421         Reviewed by Simon Fraser.
2422
2423         Make the scroll container and scrolled contents layer holders
2424         platform-independent by using the LayerRepresentation as the underlying
2425         type for the two member variables in ScrollingTreeScrollingNode.
2426
2427         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2428         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
2429         * page/scrolling/ScrollingTreeScrollingNode.h:
2430         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2431         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
2432         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
2433         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
2434
2435 2019-09-26  Chris Dumez  <cdumez@apple.com>
2436
2437         Pages frequently fails to enter the back/forward cache due to pending loads
2438         https://bugs.webkit.org/show_bug.cgi?id=202289
2439         <rdar://problem/55758506>
2440
2441         Reviewed by Geoffrey Garen.
2442
2443         Allow pages to enter the back / forward cache, even if they have pending loads.
2444         Note that these pending loads get cancelled. Also note that we won't enter page
2445         cache unless the 'load' event has been fired in the main frame, since a
2446         HistoryItem would not get created otherwise. This was causing frequent transient
2447         failures to enter the back / forward cache while browsing (e.g. on weather.com).
2448
2449         Test: http/tests/navigation/page-cache-pending-load.html
2450
2451         * history/PageCache.cpp:
2452         (WebCore::canCacheFrame):
2453         * loader/CrossOriginPreflightChecker.cpp:
2454         * loader/CrossOriginPreflightChecker.h:
2455         * loader/DocumentLoader.cpp:
2456         (WebCore::DocumentLoader::setMainDocumentError):
2457         (WebCore::DocumentLoader::stopLoading):
2458         * loader/DocumentLoader.h:
2459         * loader/DocumentThreadableLoader.cpp:
2460         * loader/DocumentThreadableLoader.h:
2461         * loader/cache/CachedResource.cpp:
2462         * loader/cache/CachedResource.h:
2463         * loader/cache/CachedResourceClient.h:
2464         (WebCore::CachedResourceClient::deprecatedDidReceiveCachedResource):
2465         * page/DiagnosticLoggingKeys.cpp:
2466         (WebCore::DiagnosticLoggingKeys::mainFrameHasNotFinishedLoadingKey):
2467         * page/DiagnosticLoggingKeys.h:
2468
2469 2019-09-26  Zalan Bujtas  <zalan@apple.com>
2470
2471         [LFC][IFC] Line::Run should have a reference to the associated InlineItem
2472         https://bugs.webkit.org/show_bug.cgi?id=202288
2473         <rdar://problem/55758112>
2474
2475         Reviewed by Antti Koivisto.
2476
2477         It makes it clearer where the type and the layout box come from.
2478
2479         * layout/inlineformatting/InlineFormattingContextQuirks.cpp:
2480         (WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const):
2481         * layout/inlineformatting/InlineLine.cpp:
2482         (WebCore::Layout::Line::Run::Run):
2483         * layout/inlineformatting/InlineLine.h:
2484         (WebCore::Layout::Line::Run::layoutBox const):
2485         (WebCore::Layout::Line::Run::textContext const):
2486         (WebCore::Layout::Line::Run::isText const):
2487         (WebCore::Layout::Line::Run::isBox const):
2488         (WebCore::Layout::Line::Run::isLineBreak const):
2489         (WebCore::Layout::Line::Run::isContainerStart const):
2490         (WebCore::Layout::Line::Run::isContainerEnd const):
2491         (WebCore::Layout::Line::Run::type const): Deleted.
2492
2493 2019-09-26  Zalan Bujtas  <zalan@apple.com>
2494
2495         [LFC][IFC] Remove redundant Line::Content
2496         https://bugs.webkit.org/show_bug.cgi?id=202284
2497         <rdar://problem/55757187>
2498
2499         Reviewed by Antti Koivisto.
2500
2501         Line::Content is really just a list or runs at this point.
2502
2503         * layout/inlineformatting/InlineFormattingContext.h:
2504         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
2505         (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns):
2506         * layout/inlineformatting/InlineFormattingContextQuirks.cpp:
2507         (WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const):
2508         * layout/inlineformatting/InlineLine.cpp:
2509         (WebCore::Layout::Line::Run::Run):
2510         (WebCore::Layout::Line::Line):
2511         (WebCore::Layout::Line::isVisuallyEmpty const):
2512         (WebCore::Layout::Line::close):
2513         (WebCore::Layout::Line::appendNonBreakableSpace):
2514         (WebCore::Layout::Line::appendTextContent):
2515         (WebCore::Layout::Line::appendNonReplacedInlineBox):
2516         (WebCore::Layout::Line::appendHardLineBreak):
2517         (WebCore::Layout::Line::Content::Run::Run): Deleted.
2518         * layout/inlineformatting/InlineLine.h:
2519         (WebCore::Layout::Line::Run::layoutBox const):
2520         (WebCore::Layout::Line::Run::logicalRect const):
2521         (WebCore::Layout::Line::Run::textContext const):
2522         (WebCore::Layout::Line::Run::type const):
2523         (WebCore::Layout::Line::Run::isText const):
2524         (WebCore::Layout::Line::Run::isBox const):
2525         (WebCore::Layout::Line::Run::isLineBreak const):
2526         (WebCore::Layout::Line::Run::isContainerStart const):
2527         (WebCore::Layout::Line::Run::isContainerEnd const):
2528         (WebCore::Layout::Line::Run::adjustLogicalTop):
2529         (WebCore::Layout::Line::Run::moveVertically):
2530         (WebCore::Layout::Line::Run::moveHorizontally):
2531         (WebCore::Layout::Line::Run::setTextIsCollapsed):
2532         (WebCore::Layout::Line::Content::Run::layoutBox const): Deleted.
2533         (WebCore::Layout::Line::Content::Run::logicalRect const): Deleted.
2534         (WebCore::Layout::Line::Content::Run::textContext const): Deleted.
2535         (WebCore::Layout::Line::Content::Run::type const): Deleted.
2536         (WebCore::Layout::Line::Content::Run::isText const): Deleted.
2537         (WebCore::Layout::Line::Content::Run::isBox const): Deleted.
2538         (WebCore::Layout::Line::Content::Run::isLineBreak const): Deleted.
2539         (WebCore::Layout::Line::Content::Run::isContainerStart const): Deleted.
2540         (WebCore::Layout::Line::Content::Run::isContainerEnd const): Deleted.
2541         (WebCore::Layout::Line::Content::Run::adjustLogicalTop): Deleted.
2542         (WebCore::Layout::Line::Content::Run::moveVertically): Deleted.
2543         (WebCore::Layout::Line::Content::Run::moveHorizontally): Deleted.
2544         (WebCore::Layout::Line::Content::Run::setTextIsCollapsed): Deleted.
2545         (WebCore::Layout::Line::Content::runs const): Deleted.
2546         (WebCore::Layout::Line::Content::runs): Deleted.
2547
2548 2019-09-26  Zalan Bujtas  <zalan@apple.com>
2549
2550         [LFC][IFC] Move Line::Content::m_lineBox to Line.
2551         https://bugs.webkit.org/show_bug.cgi?id=202280
2552         <rdar://problem/55755798>
2553
2554         Reviewed by Antti Koivisto.
2555
2556         This is in preparation for Line producing Display::Runs instead of Line::Runs.
2557
2558         * layout/inlineformatting/InlineFormattingContext.h:
2559         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
2560         (WebCore::Layout::LineLayout::close):
2561         (WebCore::Layout::LineLayout::placeInlineItem):
2562         (WebCore::Layout::InlineFormattingContext::InlineLayout::layout):
2563         (WebCore::Layout::InlineFormattingContext::InlineLayout::computedIntrinsicWidth const):
2564         (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns):
2565         * layout/inlineformatting/InlineLine.cpp:
2566         (WebCore::Layout::Line::Line):
2567         (WebCore::Layout::Line::close):
2568         (WebCore::Layout::Line::removeTrailingTrimmableContent):
2569         (WebCore::Layout::Line::moveLogicalLeft):
2570         (WebCore::Layout::Line::appendNonBreakableSpace):
2571         (WebCore::Layout::Line::appendTextContent):
2572         (WebCore::Layout::Line::appendNonReplacedInlineBox):
2573         (WebCore::Layout::Line::adjustBaselineAndLineHeight):
2574         * layout/inlineformatting/InlineLine.h:
2575         (WebCore::Layout::Line::Content::runs const):
2576         (WebCore::Layout::Line::availableWidth const):
2577         (WebCore::Layout::Line::lineBox const):
2578         (WebCore::Layout::Line::logicalTop const):
2579         (WebCore::Layout::Line::logicalBottom const):
2580         (WebCore::Layout::Line::logicalLeft const):
2581         (WebCore::Layout::Line::logicalHeight const):
2582         (WebCore::Layout::Line::contentLogicalWidth const):
2583         (WebCore::Layout::Line::contentLogicalRight const):
2584         (WebCore::Layout::Line::baselineOffset const):
2585         (WebCore::Layout::Line::Content::lineBox const): Deleted.
2586         (WebCore::Layout::Line::Content::lineBox): Deleted.
2587         (WebCore::Layout::Line::Content::setLineBox): Deleted.
2588
2589 2019-09-26  Jiewen Tan  <jiewen_tan@apple.com>
2590
2591         REGRESSION: [ Catalina WK2 ] http/wpt/webauthn/public-key-credential-create-success-u2f.https.html is failing
2592         https://bugs.webkit.org/show_bug.cgi?id=201620
2593
2594         Unreviewed, roll back part of r249737 to confirm the cause.
2595
2596         * Modules/webauthn/fido/U2fResponseConverter.cpp:
2597         (fido::WebCore::createAttestedCredentialDataFromU2fRegisterResponse):
2598
2599 2019-09-26  Truitt Savell  <tsavell@apple.com>
2600
2601         Unreviewed, rolling out r250385.
2602
2603         Broke imported/w3c/web-platform-tests/svg/animations/syncbase-
2604         remove-add-while-running.html on all platforms. Which was
2605         caught by EWS
2606
2607         Reverted changeset:
2608
2609         "Non-callable "handleEvent" property is silently ignored"
2610         https://bugs.webkit.org/show_bug.cgi?id=200066
2611         https://trac.webkit.org/changeset/250385
2612
2613 2019-09-26  Kate Cheney  <katherine_cheney@apple.com>
2614
2615         Enable LayoutTests using ResourceLoadStatistics SQLite backend (195420)
2616         https://bugs.webkit.org/show_bug.cgi?id=195420
2617         <rdar://problem/54213551> 
2618
2619         Reviewed by Brent Fulgham.
2620
2621         Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect-database.html
2622                http/tests/resourceLoadStatistics/blocking-in-web-worker-script-import-database.html
2623                http/tests/resourceLoadStatistics/cap-cache-max-age-for-prevalent-resource-database.html
2624                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-database.html
2625                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site-database.html
2626                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource-database.html
2627                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource-database.html
2628                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource-database.html
2629                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource-database.html
2630                http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics-database.html
2631                http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins-database.html
2632                http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins-database.html
2633                http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to-database.html
2634                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics-database.html
2635                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins-database.html
2636                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-collusion-database.html
2637                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent-database.html
2638                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins-database.html
2639                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to-database.html
2640                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-collusion-database.html
2641                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent-database.html
2642                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-unique-redirects-to-database.html
2643                http/tests/resourceLoadStatistics/classify-as-very-prevalent-based-on-mixed-statistics-database.html
2644                http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store-database.html
2645                http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour-database.html
2646                http/tests/resourceLoadStatistics/cookie-deletion-database.html
2647                http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction-database.html
2648                http/tests/resourceLoadStatistics/delete-script-accessible-cookies-database.html
2649                http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect-database.html
2650                http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-database.html
2651                http/tests/resourceLoadStatistics/do-not-remove-blocking-in-redirect-database.html
2652                http/tests/resourceLoadStatistics/do-not-switch-session-on-navigation-to-prevalent-without-interaction-database.html
2653                http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource-database.html
2654                http/tests/resourceLoadStatistics/enable-debug-mode-database.html
2655                http/tests/resourceLoadStatistics/grandfathering-database.html
2656                http/tests/resourceLoadStatistics/non-prevalent-resource-with-user-interaction-database.html
2657                http/tests/resourceLoadStatistics/non-prevalent-resource-without-user-interaction-database.html
2658                http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-database.html
2659                http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-database.html
2660                http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-database.html
2661                http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-database.html
2662                http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-database.html
2663                http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip-database.html
2664                http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-database.html
2665                http/tests/resourceLoadStatistics/ping-to-prevalent-resource-database.html
2666                http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown-database.html
2667                http/tests/resourceLoadStatistics/prevalent-resource-unhandled-keydown-database.html
2668                http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-database.html
2669                http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout-database.html
2670                http/tests/resourceLoadStatistics/prevalent-resource-without-user-interaction-database.html
2671                http/tests/resourceLoadStatistics/prune-statistics-database.html
2672                http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip-database.html
2673                http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost-database.html
2674                http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-database.html
2675                http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-database.html
2676                http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip-database.html
2677                http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-database.html
2678                http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode-database.html
2679                http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects-database.html
2680                http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests-database.html
2681                http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction-database.html
2682                http/tests/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame-database.html
2683                http/tests/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time-database.html
2684                http/tests/resourceLoadStatistics/user-interaction-reported-after-website-data-removal-database.html
2685
2686         * platform/sql/SQLiteDatabase.h:
2687         Added WEBCORE_EXPORT prefix to 2 functions needed in the ITP Database 
2688         to clear out the database.
2689
2690 2019-09-26  Antti Koivisto  <antti@apple.com>
2691
2692         Use LineLayoutTraversal for RenderText functions
2693         https://bugs.webkit.org/show_bug.cgi?id=202266
2694
2695         Reviewed by Zalan Bujtas.
2696
2697         Replace a bunch of functions that have separate simple and complex line layout versions with
2698         shared functions that use LineLayoutTraversal.
2699
2700         * rendering/RenderText.cpp:
2701         (WebCore::RenderText::absoluteRects const):
2702         (WebCore::RenderText::firstRunLocation const):
2703         (WebCore::RenderText::linesBoundingBox const):
2704
2705         This is substantially simpler than RenderTextLineBoxes::boundingBox because it uses physical rects for all computations
2706         instead of using logical rects and flipping to physical at the end.
2707
2708         (WebCore::RenderText::caretMinOffset const):
2709         (WebCore::RenderText::caretMaxOffset const):
2710         (WebCore::RenderText::countRenderedCharacterOffsetsUntil const):
2711         (WebCore::containsOffset):
2712         (WebCore::RenderText::containsRenderedCharacterOffset const):
2713         (WebCore::RenderText::containsCaretOffset const):
2714         (WebCore::RenderText::hasRenderedText const):
2715         * rendering/RenderTextLineBoxes.cpp:
2716         (WebCore::RenderTextLineBoxes::boundingBox const): Deleted.
2717         (WebCore::RenderTextLineBoxes::firstRunLocation const): Deleted.
2718         (WebCore::RenderTextLineBoxes::hasRenderedText const): Deleted.
2719         (WebCore::RenderTextLineBoxes::caretMinOffset const): Deleted.
2720         (WebCore::RenderTextLineBoxes::caretMaxOffset const): Deleted.
2721         (WebCore::RenderTextLineBoxes::containsOffset const): Deleted.
2722         (WebCore::RenderTextLineBoxes::countCharacterOffsetsUntil const): Deleted.
2723         (WebCore::RenderTextLineBoxes::absoluteRects const): Deleted.
2724         * rendering/RenderTreeAsText.cpp:
2725         (WebCore::write):
2726         * rendering/SimpleLineLayout.cpp:
2727         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded):
2728         * rendering/SimpleLineLayout.h:
2729         (WebCore::SimpleLineLayout::Run::Run):
2730         * rendering/SimpleLineLayoutFunctions.cpp:
2731         (WebCore::SimpleLineLayout::computeFirstRunLocation): Deleted.
2732         * rendering/SimpleLineLayoutFunctions.h:
2733         (WebCore::SimpleLineLayout::findCaretMinimumOffset): Deleted.
2734         (WebCore::SimpleLineLayout::findCaretMaximumOffset): Deleted.
2735         (WebCore::SimpleLineLayout::containsOffset): Deleted.
2736         (WebCore::SimpleLineLayout::isTextRendered): Deleted.
2737         * rendering/SimpleLineLayoutResolver.h:
2738         (WebCore::SimpleLineLayout::RunResolver::Run::isLineBreak const):
2739         * rendering/line/LineLayoutTraversal.cpp:
2740         (WebCore::LineLayoutTraversal::TextBox::isLineBreak const):
2741         (WebCore::LineLayoutTraversal::firstTextBoxFor):
2742         (WebCore::LineLayoutTraversal::firstTextBoxInTextOrderFor):
2743         (WebCore::LineLayoutTraversal::textBoxesFor):
2744         (WebCore::LineLayoutTraversal::firstTextBoxInVisualOrderFor): Deleted.
2745         (WebCore::LineLayoutTraversal::textBoxRangeFor): Deleted.
2746         * rendering/line/LineLayoutTraversal.h:
2747         (WebCore::LineLayoutTraversal::hasTextBoxes):
2748
2749 2019-09-26  Truitt Savell  <tsavell@apple.com>
2750
2751         Unreviewed, rolling out r250381.
2752
2753         broke multiple webgpu/ tests on Mojave WK2
2754
2755         Reverted changeset:
2756
2757         "Flaky Test: inspector/canvas/updateShader.html"
2758         https://bugs.webkit.org/show_bug.cgi?id=202186
2759         https://trac.webkit.org/changeset/250381
2760
2761 2019-09-26  Alexey Shvayka  <shvaikalesh@gmail.com>
2762
2763         Non-callable "handleEvent" property is silently ignored
2764         https://bugs.webkit.org/show_bug.cgi?id=200066
2765
2766         Reviewed by Darin Adler.
2767
2768         Tests: imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception.html
2769                imported/w3c/web-platform-tests/IndexedDB/fire-success-event-exception.html
2770                imported/w3c/web-platform-tests/IndexedDB/fire-upgradeneeded-event-exception.html
2771                imported/w3c/web-platform-tests/dom/events/EventListener-handleEvent.html
2772
2773         * bindings/js/JSEventListener.cpp:
2774         (WebCore::JSEventListener::handleEvent): Report TypeError if "handleEvent" is not callable.
2775
2776 2019-09-26  Zalan Bujtas  <zalan@apple.com>
2777
2778         [LFC][IFC] Decouple Display::Run and Display::Box initializations.
2779         https://bugs.webkit.org/show_bug.cgi?id=202255
2780         <rdar://problem/55731445>
2781
2782         Reviewed by Antti Koivisto.
2783
2784         This is in preparation for moving Display::Run initialization to Line class.
2785
2786         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
2787         (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns):
2788
2789 2019-09-26  Devin Rousso  <drousso@apple.com>
2790
2791         Flaky Test: inspector/canvas/updateShader.html
2792         https://bugs.webkit.org/show_bug.cgi?id=202186
2793         <rdar://problem/55716053>
2794
2795         Reviewed by Joseph Pecoraro.
2796
2797         If the `WebGPUPipeline`/`WebGLProgram` outlives it's `WebGPUDevice`/`WebGLRenderingContext`,
2798         the `ScriptExecutionContext*` that was provided in the constructor won't be invalidated
2799         leading to the bad access crash.
2800
2801         Rather than pass the `ScriptExecutionContext*` directly, have `WebGPUPipeline`/`WebGLProgram`
2802         extend from `ContextDestructionObserver` so that it can propertly invalidate (and notify Web
2803         Inspector) when the related context is about to be destroyed.
2804
2805         Test: inspector/canvas/updateShader.html
2806
2807         * Modules/webgpu/WebGPUPipeline.h:
2808         (WebCore::WebGPUPipeline::scriptExecutionContext const): Deleted.
2809         * Modules/webgpu/WebGPUPipeline.cpp:
2810         (WebCore::WebGPUPipeline::WebGPUPipeline):
2811         (WebCore::WebGPUPipeline::contextDestroyed): Added.
2812
2813         * html/canvas/WebGLProgram.h:
2814         (WebCore::WebGLProgram::scriptExecutionContext const): Deleted.
2815         * html/canvas/WebGLProgram.cpp:
2816         (WebCore::WebGLProgram::WebGLProgram):
2817         (WebCore::WebGLProgram::contextDestroyed): Added.
2818
2819 2019-09-25  Chris Dumez  <cdumez@apple.com>
2820
2821         Add very basic PageCache support for RTCPeerConnection
2822         https://bugs.webkit.org/show_bug.cgi?id=202244
2823
2824         Reviewed by Geoffrey Garen.
2825
2826         RTCPeerConnection::canSuspendForDocumentSuspension() returns true if
2827         RTCPeerConnection::hasPendingActivity() return false. Previously, hasPendingActivity()
2828         would return true unless the JS has called close() on the RTCPeerConnection
2829         object.
2830
2831         On weather.com, an ad would construct an RTCPeerConnection just to do some feature
2832         checking and then let the variable go out of scope (without calling close()). Because
2833         of the previous implementation of RTCPeerConnection::hasPendingActivity(), this wrapper
2834         and its implementation object would stay alive forever AND prevent the page from
2835         entering PageCache on navigation.
2836
2837         To improve this, the implementation of hadPendingActivity() has been updated so that
2838         it keeps returning false if close() has been called, but will also return false if
2839         there are no pending Promises to be resolved and no event listeners.
2840
2841         Test: fast/mediastream/RTCPeerConnection-page-cache.html
2842
2843         * Modules/mediastream/RTCPeerConnection.cpp:
2844         WebCore::RTCPeerConnection::RTCPeerConnection:
2845         Stop taking a pending activity in the constructor, this would be NOT keep the wrapper
2846         alive since RTCPeerConnection::hasPendingActivity() was not checking
2847         ActiveDOMObject::hasPendingActivity().
2848
2849         (WebCore::RTCPeerConnection::canSuspendForDocumentSuspension const):
2850         (WebCore::RTCPeerConnection::hasPendingActivity const):
2851         
2852         * Modules/mediastream/RTCPeerConnection.h:
2853
2854         * bindings/js/JSDOMPromiseDeferred.h:
2855         (WebCore::DOMPromiseDeferredBase::whenSettled):
2856
2857 2019-09-25  Chris Dumez  <cdumez@apple.com>
2858
2859         Improve Service worker support for Page Caching
2860         https://bugs.webkit.org/show_bug.cgi?id=202221
2861
2862         Reviewed by Geoffrey Garen.
2863
2864         Allow pages using service workers to enter the back / forward cache.
2865         Update ServiceWorkerRegistration / ServiceWorker ActiveDOMObjects
2866         to properly suspend while in PageCache. Also, let documents controlled
2867         by a service worker to enter PageCache (we already unregistered it as
2868         a client of the service worker while suspended).
2869
2870         Test: http/tests/workers/service/page-caching.html
2871
2872         * dom/Document.cpp:
2873         (WebCore::Document::suspend):
2874         (WebCore::Document::resume):
2875         * history/PageCache.cpp:
2876         (WebCore::canCacheFrame):
2877         * workers/service/ServiceWorker.cpp:
2878         (WebCore::ServiceWorker::updateState):
2879         (WebCore::ServiceWorker::canSuspendForDocumentSuspension const):
2880         (WebCore::ServiceWorker::suspend):
2881         (WebCore::ServiceWorker::resume):
2882         * workers/service/ServiceWorker.h:
2883         * workers/service/ServiceWorkerRegistration.cpp:
2884         (WebCore::ServiceWorkerRegistration::fireUpdateFoundEvent):
2885         (WebCore::ServiceWorkerRegistration::canSuspendForDocumentSuspension const):
2886         (WebCore::ServiceWorkerRegistration::suspend):
2887         (WebCore::ServiceWorkerRegistration::resume):
2888         * workers/service/ServiceWorkerRegistration.h:
2889
2890 2019-09-25  Chris Dumez  <cdumez@apple.com>
2891
2892         [Cocoa] Regression(r212041) Safari adds a .dms extension automatically when downloading binaries with no extension
2893         https://bugs.webkit.org/show_bug.cgi?id=202147
2894         <rdar://problem/54886021>
2895
2896         Reviewed by Alexey Proskuryakov.
2897
2898         When getting a suggested filename without extension (either from Content-Disposition header or from the download
2899         attribute), we determine a suitable file extension based on the Content-Type header and append it. This is useful
2900         since a lot of operating systems (such as macOS) rely on the file extension to determine file type.
2901
2902         The issue is that if the Content-Type is not provided or when it is provided but is "application/octet-stream",
2903         we would append a .dms extension, which was unexpected. This patch makes it so that we no longer try to append
2904         an extension when the resolved content type is "application/octet-stream".
2905
2906         Tests: http/tests/download/anchor-download-attribute-content-disposition-no-extension-octet-stream.html
2907                http/tests/download/anchor-download-attribute-content-disposition-no-extension-text-plain.html
2908                http/tests/security/anchor-download-octet-stream-no-extension.html
2909
2910         * platform/MIMETypeRegistry.cpp:
2911         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
2912
2913 2019-09-25  Megan Gardner  <megan_gardner@apple.com>
2914
2915         Update selections after scrolling for iframes and hide selections while iframes and overflow scrolls are scrolling.
2916         https://bugs.webkit.org/show_bug.cgi?id=202125
2917
2918         Reviewed by Tim Horton.
2919
2920         Test: editing/selection/ios/update-selection-after-iframe-scroll.html
2921
2922         When we end scrolling, make sure that iframes get a final update to ensure that the 
2923         selection is in the correct position. Pipe that to WebKit/UIProcess via
2924         frame specific plath.
2925
2926         * loader/EmptyClients.cpp:
2927         * page/EditorClient.h:
2928         * page/scrolling/AsyncScrollingCoordinator.cpp:
2929         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
2930
2931 2019-09-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2932
2933         Page temporarily jumps to an excessively small viewport scale while loading usatoday.com
2934         https://bugs.webkit.org/show_bug.cgi?id=202224
2935         <rdar://problem/52906640>
2936
2937         Reviewed by Tim Horton.
2938
2939         On some pages (e.g. usatoday.com), the content width of the page temporarily becomes very large during page
2940         load. This causes a couple of viewport scaling behaviors (notably, the existing shrink-to-fit heuristic in
2941         ViewportConfiguration::initialScaleFromSize, as well as the new iPad-specific content-aware shrink-to-fit
2942         heuristic in WebPage::immediatelyShrinkToFitContent) to cause the page to shrink down excessively in an attempt
2943         to fit all the content to the viewport. This causes a very ugly flash as the page appears zoomed out initially
2944         during page load, before zooming back in.
2945
2946         To fix this, we add some sanity checks to these viewport scaling heuristics. In ViewportConfiguration's
2947         initialScaleFromSize method, in the codepath where an initial scale is not specified, we always scale to fit the
2948         contents of the page; instead, detect the case where the content width is enormous (with a threshold arbitrarily
2949         chosen to be 1920) and fall back to the scaling to fit the viewport's width, if such a width has been explicitly
2950         set. This ensures that we avoid excessive shrinking in the case where content is extremely wide, but also that
2951         we do scale the viewport down to fit all the content in the case where the content isn't extremely wide (e.g. on
2952         daringfireball.com).
2953
2954         See WebKit ChangeLog for more detail.
2955
2956         Test: fast/viewport/ios/shrink-to-fit-large-content-width.html
2957
2958         * page/ViewportConfiguration.cpp:
2959         (WebCore::ViewportConfiguration::initialScaleFromSize const):
2960
2961 2019-09-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2962
2963         [iPadOS] [DataActivation] Focus moves away after focusing input fields on www.att.com
2964         https://bugs.webkit.org/show_bug.cgi?id=202167
2965         <rdar://problem/55185021>
2966
2967         Reviewed by Tim Horton.
2968
2969         Adds a new site-specific quirk. See WebKit ChangeLog for more details.
2970
2971         * page/Quirks.cpp:
2972         (WebCore::Quirks::shouldUseLegacySelectPopoverDismissalBehaviorInDataActivation const):
2973         * page/Quirks.h:
2974         * platform/RuntimeApplicationChecks.h:
2975         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2976         (WebCore::IOSApplication::isDataActivation):
2977
2978 2019-09-25  Jonathan Bedard  <jbedard@apple.com>
2979
2980         Unreviewed, rolling out r250324.
2981
2982         Broke many mac wk2 layout tests
2983
2984         Reverted changeset:
2985
2986         "Enable LayoutTests using ResourceLoadStatistics SQLite
2987         backend (195420)"
2988         https://bugs.webkit.org/show_bug.cgi?id=195420
2989         https://trac.webkit.org/changeset/250324
2990
2991 2019-09-25  Antti Koivisto  <antti@apple.com>
2992
2993         Rename LineLayoutInterface to LineLayoutTraversal
2994         https://bugs.webkit.org/show_bug.cgi?id=202202
2995
2996         Reviewed by Zalan Bujtas.
2997
2998         Use a bit more informative namespace name.
2999
3000         * Headers.cmake:
3001         * Sources.txt:
3002         * WebCore.xcodeproj/project.pbxproj:
3003         * dom/Position.cpp:
3004         (WebCore::Position::upstream const):
3005         (WebCore::Position::downstream const):
3006         * editing/TextIterator.cpp:
3007         (WebCore::TextIterator::handleTextNode):
3008         (WebCore::TextIterator::handleTextBox):
3009         (WebCore::TextIterator::handleTextNodeFirstLetter):
3010         * editing/TextIterator.h:
3011         * rendering/RenderTreeAsText.cpp:
3012         (WebCore::RenderTreeAsText::writeRenderObject):
3013         (WebCore::writeTextBox):
3014         (WebCore::write):
3015         * rendering/line/LineLayoutTraversal.cpp: Renamed from Source/WebCore/rendering/line/LineLayoutInterfaceTextBoxes.cpp.
3016         (WebCore::LineLayoutTraversal::TextBox::rect const):
3017         (WebCore::LineLayoutTraversal::TextBox::logicalRect const):
3018         (WebCore::LineLayoutTraversal::TextBox::hasHyphen const):
3019         (WebCore::LineLayoutTraversal::TextBox::isLeftToRightDirection const):
3020         (WebCore::LineLayoutTraversal::TextBox::dirOverride const):
3021         (WebCore::LineLayoutTraversal::TextBox::text const):
3022         (WebCore::LineLayoutTraversal::TextBox::localStartOffset const):
3023         (WebCore::LineLayoutTraversal::TextBox::localEndOffset const):
3024         (WebCore::LineLayoutTraversal::TextBox::length const):
3025         (WebCore::LineLayoutTraversal::TextBox::isLastOnLine const):
3026         (WebCore::LineLayoutTraversal::TextBox::isLast const):
3027         (WebCore::LineLayoutTraversal::TextBox::iterator const):
3028         (WebCore::LineLayoutTraversal::TextBoxIterator::TextBoxIterator):
3029         (WebCore::LineLayoutTraversal::TextBoxIterator::traverseNextInVisualOrder):
3030         (WebCore::LineLayoutTraversal::TextBoxIterator::ComplexPath::nextInlineTextBoxInTextOrder const):
3031         (WebCore::LineLayoutTraversal::TextBoxIterator::traverseNextInTextOrder):
3032         (WebCore::LineLayoutTraversal::TextBoxIterator::operator== const):
3033         (WebCore::LineLayoutTraversal::TextBoxIterator::atEnd const):
3034         (WebCore::LineLayoutTraversal::firstTextBoxInVisualOrderFor):
3035         (WebCore::LineLayoutTraversal::firstTextBoxInTextOrderFor):
3036         (WebCore::LineLayoutTraversal::textBoxRangeFor):
3037         * rendering/line/LineLayoutTraversal.h: Renamed from Source/WebCore/rendering/line/LineLayoutInterfaceTextBoxes.h.
3038         (WebCore::LineLayoutTraversal::TextBoxIterator::TextBoxIterator):
3039         (WebCore::LineLayoutTraversal::TextBoxIterator::operator++):
3040         (WebCore::LineLayoutTraversal::TextBoxIterator::operator bool const):
3041         (WebCore::LineLayoutTraversal::TextBoxIterator::operator!= const):
3042         (WebCore::LineLayoutTraversal::TextBoxIterator::operator== const):
3043         (WebCore::LineLayoutTraversal::TextBoxIterator::operator* const):
3044         (WebCore::LineLayoutTraversal::TextBoxIterator::operator-> const):
3045         (WebCore::LineLayoutTraversal::TextBoxRange::TextBoxRange):
3046         (WebCore::LineLayoutTraversal::TextBoxRange::begin const):
3047         (WebCore::LineLayoutTraversal::TextBoxRange::end const):
3048         (WebCore::LineLayoutTraversal::hasTextBoxes):
3049
3050 2019-09-25  Zalan Bujtas  <zalan@apple.com>
3051
3052         [LFC][IFC] Use existing Line::Content::LineBox to track the current line geometry
3053         https://bugs.webkit.org/show_bug.cgi?id=202182
3054
3055         Reviewed by Antti Koivisto.
3056
3057         This patch removes the redundant Line::m_logicalTopLeft, m_contentLogicalWidth, m_lineLogicalHeight, m_baseline, m_baselineTop members
3058         and switches over to Line::m_content's LineBox. 
3059
3060         * layout/displaytree/DisplayRect.h:
3061         (WebCore::Display::Rect::Rect):
3062         * layout/inlineformatting/InlineLine.cpp:
3063         (WebCore::Layout::Line::Line):
3064         (WebCore::Layout::Line::close):
3065         (WebCore::Layout::Line::removeTrailingTrimmableContent):
3066         (WebCore::Layout::Line::moveLogicalLeft):
3067         (WebCore::Layout::Line::appendNonBreakableSpace):
3068         (WebCore::Layout::Line::appendTextContent):
3069         (WebCore::Layout::Line::appendNonReplacedInlineBox):
3070         (WebCore::Layout::Line::adjustBaselineAndLineHeight):
3071         (WebCore::Layout::m_skipVerticalAligment): Deleted.
3072         * layout/inlineformatting/InlineLine.h:
3073         (WebCore::Layout::Line::Content::lineBox):
3074         (WebCore::Layout::Line::contentLogicalRight const):
3075         (WebCore::Layout::Line::logicalTop const):
3076         (WebCore::Layout::Line::logicalBottom const):
3077         (WebCore::Layout::Line::logicalLeft const):
3078         (WebCore::Layout::Line::logicalHeight const):
3079         (WebCore::Layout::Line::contentLogicalWidth const):
3080         (WebCore::Layout::Line::baselineOffset const):
3081         * layout/inlineformatting/InlineLineBox.h:
3082         (WebCore::Layout::LineBox::setLogicalTopLeft):
3083         (WebCore::Layout::LineBox::setLogicalHeight):
3084         (WebCore::Layout::LineBox::setLogicalWidth):
3085         (WebCore::Layout::LineBox::moveHorizontally):
3086         (WebCore::Layout::LineBox::expandHorizontally):
3087         (WebCore::Layout::LineBox::shrinkHorizontally):
3088         (WebCore::Layout::LineBox::expandVertically):
3089         (WebCore::Layout::LineBox::shrinkVertically):
3090         (WebCore::Layout::LineBox::LineBox):
3091         (WebCore::Layout::LineBox::setLogicalHeightIfGreater):
3092         (WebCore::Layout::LineBox::setBaseline):
3093         (WebCore::Layout::LineBox::baseline const):
3094         (WebCore::Layout::LineBox::baseline):
3095         (WebCore::Layout::LineBox::setBaselineOffset):
3096         (WebCore::Layout::LineBox::Baseline::setAscentIfGreater):
3097         (WebCore::Layout::LineBox::Baseline::setDescentIfGreater):
3098
3099 2019-09-25  Antti Koivisto  <antti@apple.com>
3100
3101         Rename InlineBox::nextLeafChild to nextLeafOnLine
3102         https://bugs.webkit.org/show_bug.cgi?id=202197
3103
3104         Reviewed by Zalan Bujtas.
3105
3106         The name is confusing as it never returns a child of the inline box it is called on.
3107         Rename it and other similar functions that traverse within a line.
3108
3109         * dom/Position.cpp:
3110         (WebCore::Position::getInlineBoxAndOffset const):
3111         * editing/RenderedPosition.cpp:
3112         (WebCore::RenderedPosition::RenderedPosition):
3113         (WebCore::RenderedPosition::previousLeafOnLine const):
3114         (WebCore::RenderedPosition::nextLeafOnLine const):
3115         (WebCore::RenderedPosition::isEquivalent const):
3116         (WebCore::RenderedPosition::bidiLevelOnLeft const):
3117         (WebCore::RenderedPosition::bidiLevelOnRight const):
3118         (WebCore::RenderedPosition::leftBoundaryOfBidiRun):
3119         (WebCore::RenderedPosition::rightBoundaryOfBidiRun):
3120         (WebCore::RenderedPosition::atLeftBoundaryOfBidiRun const):
3121         (WebCore::RenderedPosition::atRightBoundaryOfBidiRun const):
3122         (WebCore::RenderedPosition::positionAtLeftBoundaryOfBiDiRun const):
3123         (WebCore::RenderedPosition::positionAtRightBoundaryOfBiDiRun const):
3124         (WebCore::RenderedPosition::prevLeafChild const): Deleted.
3125         (WebCore::RenderedPosition::nextLeafChild const): Deleted.
3126         * editing/RenderedPosition.h:
3127         (WebCore::RenderedPosition::RenderedPosition):
3128         * editing/VisiblePosition.cpp:
3129         (WebCore::VisiblePosition::leftVisuallyDistinctCandidate const):
3130         (WebCore::VisiblePosition::rightVisuallyDistinctCandidate const):
3131         * editing/VisibleUnits.cpp:
3132         (WebCore::startPositionForLine):
3133         (WebCore::endPositionForLine):
3134         (WebCore::previousLinePosition):
3135         (WebCore::nextLinePosition):
3136         * layout/Verification.cpp:
3137         (WebCore::Layout::collectFlowBoxSubtree):
3138         * rendering/ComplexLineLayout.cpp:
3139         (WebCore::ComplexLineLayout::updateRubyForJustifiedText):
3140         (WebCore::expansionBehaviorForInlineTextBox):
3141         (WebCore::ComplexLineLayout::computeInlineDirectionPositionsForSegment):
3142         (WebCore::ComplexLineLayout::layoutRunsAndFloats):
3143         * rendering/InlineBox.cpp:
3144         (WebCore::InlineBox::previousOnLineExists const):
3145         (WebCore::InlineBox::nextLeafOnLine const):
3146         (WebCore::InlineBox::previousLeafOnLine const):
3147         (WebCore::InlineBox::nextLeafOnLineIgnoringLineBreak const):
3148         (WebCore::InlineBox::previousLeafOnLineIgnoringLineBreak const):
3149         (WebCore::InlineBox::nextLeafChild const): Deleted.
3150         (WebCore::InlineBox::prevLeafChild const): Deleted.
3151         (WebCore::InlineBox::nextLeafChildIgnoringLineBreak const): Deleted.
3152         (WebCore::InlineBox::prevLeafChildIgnoringLineBreak const): Deleted.
3153         * rendering/InlineBox.h:
3154         (WebCore::InlineBox::nextOnLine const):
3155         (WebCore::InlineBox::previousOnLine const):
3156         (WebCore::InlineBox::setNextOnLine):
3157         (WebCore::InlineBox::setPreviousOnLine):
3158         (WebCore::InlineBox::InlineBox):
3159         (WebCore::InlineBox::prevOnLine const): Deleted.
3160         (WebCore::InlineBox::setPrevOnLine): Deleted.
3161         * rendering/InlineFlowBox.cpp:
3162         (WebCore::InlineFlowBox::addToLine):
3163         (WebCore::InlineFlowBox::removeChild):
3164         (WebCore::InlineFlowBox::nodeAtPoint):
3165         (WebCore::InlineFlowBox::firstLeafDescendant const):
3166         (WebCore::InlineFlowBox::lastLeafDescendant const):
3167         (WebCore::InlineFlowBox::placeEllipsisBox):
3168         (WebCore::InlineFlowBox::collectLeafBoxesInLogicalOrder const):
3169         (WebCore::InlineFlowBox::checkConsistency const):
3170         (WebCore::InlineFlowBox::firstLeafChild const): Deleted.
3171         (WebCore::InlineFlowBox::lastLeafChild const): Deleted.
3172         * rendering/InlineFlowBox.h:
3173         * rendering/InlineTextBox.cpp:
3174         (WebCore::InlineTextBox::expansionBehavior const):
3175         * rendering/RenderBlockFlow.cpp:
3176         (WebCore::RenderBlockFlow::containsNonZeroBidiLevel const):
3177         (WebCore::RenderBlockFlow::positionForPointWithInlineChildren):
3178         * rendering/RenderCounter.cpp:
3179         (WebCore::RenderCounter::rendererRemovedFromTree):
3180         * rendering/RenderTextLineBoxes.cpp:
3181         (WebCore::lineDirectionPointFitsInBox):
3182         (WebCore::createVisiblePositionAfterAdjustingOffsetForBiDi):
3183         (WebCore::RenderTextLineBoxes::positionForPoint const):
3184         * rendering/RootInlineBox.cpp:
3185         (WebCore::RootInlineBox::isHyphenated const):
3186         (WebCore::RootInlineBox::lineSelectionGap):
3187         (WebCore::RootInlineBox::selectionState):
3188         (WebCore::RootInlineBox::firstSelectedBox):
3189         (WebCore::RootInlineBox::lastSelectedBox):
3190         (WebCore::RootInlineBox::closestLeafChildForLogicalLeftPosition):
3191         * rendering/svg/SVGRootInlineBox.cpp:
3192         (WebCore::SVGRootInlineBox::closestLeafChildForPosition):
3193         (WebCore::SVGRootInlineBox::nodeAtPoint):
3194
3195 2019-09-25  Zan Dobersek  <zdobersek@igalia.com>
3196
3197         [Nicosia] Add implementations for fixed, positioned, sticky ScrollingTreeNodes
3198         https://bugs.webkit.org/show_bug.cgi?id=202100
3199
3200         Reviewed by Carlos Garcia Campos.
3201
3202         Fill in the Nicosia implementations for the ScrollingTreeFixedNode,
3203         ScrollingTreePositionedNode and ScrollingTreeStickyNode classes.
3204
3205         The implementations in majority repeat what the Cocoa implementations
3206         do, with the main difference being the Nicosia-specific layer state
3207         application. Sharing more of this logic should be investigated in the
3208         future.
3209
3210         * PlatformPlayStation.cmake: Add ScrollingTreePositionedNode to build.
3211         * SourcesGTK.txt: Ditto.
3212         * SourcesWPE.txt: Ditto.
3213         * page/scrolling/nicosia/ScrollingTreeFixedNode.cpp:
3214         (WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren):
3215         (WebCore::ScrollingTreeFixedNode::applyLayerPositions):
3216         (WebCore::ScrollingTreeFixedNode::dumpProperties const):
3217         * page/scrolling/nicosia/ScrollingTreeFixedNode.h:
3218         * page/scrolling/nicosia/ScrollingTreePositionedNode.cpp: Added.
3219         (WebCore::ScrollingTreePositionedNode::create):
3220         (WebCore::ScrollingTreePositionedNode::ScrollingTreePositionedNode):
3221         (WebCore::ScrollingTreePositionedNode::commitStateBeforeChildren):
3222         (WebCore::ScrollingTreePositionedNode::applyLayerPositions):
3223         (WebCore::ScrollingTreePositionedNode::dumpProperties const):
3224         * page/scrolling/nicosia/ScrollingTreePositionedNode.h: Added.
3225         (WebCore::ScrollingTreePositionedNode::relatedOverflowScrollingNodes const):
3226         * page/scrolling/nicosia/ScrollingTreeStickyNode.cpp:
3227         (WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren):
3228         (WebCore::ScrollingTreeStickyNode::applyLayerPositions):
3229         (WebCore::ScrollingTreeStickyNode::dumpProperties const):
3230         (WebCore::ScrollingTreeStickyNode::computeLayerPosition const):
3231         * page/scrolling/nicosia/ScrollingTreeStickyNode.h:
3232
3233 2019-09-24  Antoine Quint  <graouts@apple.com>
3234
3235         [Web Animations] Removing an element should only cancel its declarative animations
3236         https://bugs.webkit.org/show_bug.cgi?id=202165
3237
3238         Reviewed by Dean Jackson.
3239
3240         When an element is removed, an Animation created using the JS API should not be canceled.
3241         Only declarative animations should be.
3242
3243         * animation/AnimationTimeline.cpp:
3244         (WebCore::AnimationTimeline::elementWasRemoved):
3245
3246 2019-09-24  Alex Christensen  <achristensen@webkit.org>
3247
3248         Remove SchemeRegistry's list of URL schemes allowing local storage in private browsing, which is unused
3249         https://bugs.webkit.org/show_bug.cgi?id=202181
3250
3251         Reviewed by Geoffrey Garen.
3252
3253         The last use of the WebView SPI to set it is being removed in rdar://problem/55685383
3254         but it already does not do anything.  Let's remove it.
3255
3256         * platform/SchemeRegistry.cpp:
3257         (WebCore::schemesAllowingLocalStorageAccessInPrivateBrowsing): Deleted.
3258         (WebCore::SchemeRegistry::registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing): Deleted.
3259         (WebCore::SchemeRegistry::allowsLocalStorageAccessInPrivateBrowsing): Deleted.
3260         * platform/SchemeRegistry.h:
3261
3262 2019-09-24  Wenson Hsieh  <wenson_hsieh@apple.com>
3263
3264         Remove a content change observation quirk on united.com
3265         https://bugs.webkit.org/show_bug.cgi?id=202175
3266
3267         Reviewed by Tim Horton.
3268
3269         Remove a site-specific quirk that is no longer necessary.
3270
3271         * page/Quirks.cpp:
3272         (WebCore::Quirks::shouldIgnoreContentChange const): Deleted.
3273         * page/Quirks.h:
3274         * page/ios/ContentChangeObserver.cpp:
3275         (WebCore::ContentChangeObserver::shouldObserveVisibilityChangeForElement):
3276
3277 2019-09-24  Kate Cheney  <katherine_cheney@apple.com>
3278
3279         Enable LayoutTests using ResourceLoadStatistics SQLite backend (195420)
3280         https://bugs.webkit.org/show_bug.cgi?id=195420
3281         <rdar://problem/54213551> 
3282
3283         Reviewed by Brent Fulgham.
3284
3285         Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect-database.html
3286                http/tests/resourceLoadStatistics/blocking-in-web-worker-script-import-database.html
3287                http/tests/resourceLoadStatistics/cap-cache-max-age-for-prevalent-resource-database.html
3288                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-database.html
3289                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site-database.html
3290                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource-database.html
3291                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource-database.html
3292                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource-database.html
3293                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource-database.html
3294                http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics-database.html
3295                http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins-database.html
3296                http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins-database.html
3297                http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to-database.html
3298                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics-database.html
3299                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins-database.html
3300                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-collusion-database.html
3301                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent-database.html
3302                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins-database.html
3303                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to-database.html
3304                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-collusion-database.html
3305                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent-database.html
3306                http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-unique-redirects-to-database.html
3307                http/tests/resourceLoadStatistics/classify-as-very-prevalent-based-on-mixed-statistics-database.html
3308                http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store-database.html
3309                http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour-database.html
3310                http/tests/resourceLoadStatistics/cookie-deletion-database.html
3311                http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction-database.html
3312                http/tests/resourceLoadStatistics/delete-script-accessible-cookies-database.html
3313                http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect-database.html
3314                http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-database.html
3315                http/tests/resourceLoadStatistics/do-not-remove-blocking-in-redirect-database.html
3316                http/tests/resourceLoadStatistics/do-not-switch-session-on-navigation-to-prevalent-without-interaction-database.html
3317                http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource-database.html
3318                http/tests/resourceLoadStatistics/enable-debug-mode-database.html
3319                http/tests/resourceLoadStatistics/grandfathering-database.html
3320                http/tests/resourceLoadStatistics/non-prevalent-resource-with-user-interaction-database.html
3321                http/tests/resourceLoadStatistics/non-prevalent-resource-without-user-interaction-database.html
3322                http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-database.html
3323                http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-database.html
3324                http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-database.html
3325                http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-database.html
3326                http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-database.html
3327                http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip-database.html
3328                http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-database.html
3329                http/tests/resourceLoadStatistics/ping-to-prevalent-resource-database.html
3330                http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown-database.html
3331                http/tests/resourceLoadStatistics/prevalent-resource-unhandled-keydown-database.html
3332                http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-database.html
3333                http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout-database.html
3334                http/tests/resourceLoadStatistics/prevalent-resource-without-user-interaction-database.html
3335                http/tests/resourceLoadStatistics/prune-statistics-database.html
3336                http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip-database.html
3337                http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost-database.html
3338                http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-database.html
3339                http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-database.html
3340                http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip-database.html
3341                http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-database.html
3342                http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode-database.html
3343                http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects-database.html
3344                http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests-database.html
3345                http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction-database.html
3346                http/tests/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame-database.html
3347                http/tests/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time-database.html
3348                http/tests/resourceLoadStatistics/user-interaction-reported-after-website-data-removal-database.html
3349
3350         * platform/sql/SQLiteDatabase.h:
3351         Added WEBCORE_EXPORT prefix to 2 functions needed in the ITP Database 
3352         to clear out the database.
3353
3354 2019-09-24  Chris Dumez  <cdumez@apple.com>
3355
3356         Stop sampling PageCache-related AggD data
3357         https://bugs.webkit.org/show_bug.cgi?id=202161
3358
3359         Reviewed by Geoffrey Garen.
3360
3361         Stop sampling PageCache-related AggD data to make it more actionable.
3362
3363         * history/PageCache.cpp:
3364         (WebCore::logPageCacheFailureDiagnosticMessage):
3365         (WebCore::canCacheFrame):
3366         (WebCore::canCachePage):
3367
3368 2019-09-24  Sihui Liu  <sihui_liu@apple.com>
3369
3370         Stop refing UniqueIDBDatabaseTransaction in callbacks
3371         https://bugs.webkit.org/show_bug.cgi?id=202074
3372
3373         Reviewed by Youenn Fablet.
3374
3375         After quota check is introduced to IDB, callbacks that take the ref of UniqueIDBDatabaseTransaction will be 
3376         passed to StorageQuotaManager. This can make UniqueIDBDatabaseTransaction live longer than UniqueIDBDatabase.
3377
3378         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3379         (WebCore::IDBServer::UniqueIDBDatabase::requestSpace):
3380         (WebCore::IDBServer::UniqueIDBDatabase::waitForRequestSpaceCompletion):
3381         (WebCore::IDBServer::UniqueIDBDatabase::createObjectStore):
3382         (WebCore::IDBServer::UniqueIDBDatabase::deleteObjectStore):
3383         (WebCore::IDBServer::UniqueIDBDatabase::renameObjectStore):
3384         (WebCore::IDBServer::UniqueIDBDatabase::clearObjectStore):
3385         (WebCore::IDBServer::UniqueIDBDatabase::createIndex):
3386         (WebCore::IDBServer::UniqueIDBDatabase::deleteIndex):
3387         (WebCore::IDBServer::UniqueIDBDatabase::renameIndex):
3388         (WebCore::IDBServer::UniqueIDBDatabase::putOrAdd):
3389         (WebCore::IDBServer::UniqueIDBDatabase::getRecord):
3390         (WebCore::IDBServer::UniqueIDBDatabase::getAllRecords):
3391         (WebCore::IDBServer::UniqueIDBDatabase::getCount):
3392         (WebCore::IDBServer::UniqueIDBDatabase::deleteRecord):
3393         (WebCore::IDBServer::UniqueIDBDatabase::openCursor):
3394         (WebCore::IDBServer::UniqueIDBDatabase::iterateCursor):
3395         (WebCore::IDBServer::UniqueIDBDatabase::commitTransaction):
3396         (WebCore::IDBServer::UniqueIDBDatabase::abortTransaction):
3397         * Modules/indexeddb/server/UniqueIDBDatabase.h:
3398         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
3399         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::abort):
3400         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::commit):
3401         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::createObjectStore):
3402         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::deleteObjectStore):
3403         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::renameObjectStore):
3404         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::clearObjectStore):
3405         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::createIndex):
3406         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::deleteIndex):
3407         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::renameIndex):
3408         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::putOrAdd):
3409         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::getRecord):
3410         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::getAllRecords):
3411         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::getCount):
3412         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::deleteRecord):
3413         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::openCursor):
3414         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::iterateCursor):
3415
3416 2019-09-24  Keith Rollin  <krollin@apple.com>
3417
3418         Coalesce or remove PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
3419         https://bugs.webkit.org/show_bug.cgi?id=202119
3420         <rdar://problem/55638792>
3421
3422         Reviewed by Alex Christensen.
3423
3424         After refactoring and other code evolution, some platform checks have
3425         ended up looking like PLATFORM(MAC) || PLATFORM(IOS_FAMILY) (or
3426         vice-versa). These can be converted into the equivalent
3427         PLATFORM(COCOA). Where the instance occurs in a Cocoa-only file, the
3428         check can be removed altogether (along with any "#else" branches).
3429
3430         No new tests -- no new or changed functionality.
3431
3432         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
3433         (WebCore::subLocality):
3434         (WebCore::setSubLocality):
3435         (WebCore::subAdministrativeArea):
3436         (WebCore::setSubAdministrativeArea):
3437         * css/parser/CSSPropertyParser.cpp:
3438         (WebCore::isAppleLegacyCssValueKeyword):
3439         * html/HTMLMediaElement.cpp:
3440         (WebCore::HTMLMediaElement::mediaSessionTitle const):
3441         * inspector/InspectorFrontendHost.cpp:
3442         (WebCore::InspectorFrontendHost::platform):
3443         * page/FrameView.cpp:
3444         (WebCore::FrameView::updateBackgroundRecursively):
3445         * platform/Timer.cpp:
3446         * platform/cocoa/NetworkExtensionContentFilter.mm:
3447         (WebCore::NetworkExtensionContentFilter::initialize):
3448         * platform/graphics/cg/GraphicsContextCG.cpp:
3449         (WebCore::displayP3ColorSpaceRef):
3450         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
3451         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
3452         * rendering/RenderLayerCompositor.cpp:
3453         (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame const):
3454
3455 2019-09-24  Antoine Quint  <graouts@apple.com>
3456
3457         [Web Animations] Unflake web-animations/timing-model/animations/updating-the-finished-state.html WPT test
3458         https://bugs.webkit.org/show_bug.cgi?id=181121
3459
3460         Reviewed by Dean Jackson.
3461
3462         When running the "update animations and send events" steps (https://drafts.csswg.org/web-animations/#update-animations-and-send-events)
3463         we assemble a list of animations to remove after updating their relevance based on the new timeline current time. However, we wouldn't
3464         account for the fact that we would *then* dispatch events which could update the timing properties of animations that had been marked
3465         for removal at this point.
3466
3467         In this specific WPT test, there were two individual tests that would rewind animations within a "finish" event handler and we would
3468         not consider the fact that they had been rewound. We now check a second time before removing an animation that it should indeed be
3469         removed.
3470
3471         * animation/DocumentTimeline.cpp:
3472         (WebCore::DocumentTimeline::internalUpdateAnimationsAndSendEvents):
3473
3474 2019-09-24  Kate Cheney  <katherine_cheney@apple.com>
3475
3476         Mixed content blocking is bypassed for WebSockets in Workers (159726)
3477         https://bugs.webkit.org/show_bug.cgi?id=159726
3478         <rdar://problem/27326438>
3479
3480         Reviewed by Brady Eidson.
3481
3482         Tests: http/tests/websocket/tests/hybi/non-document-mixed-content-blocked-http-with-embedded-https-with-embedded-http.html
3483                http/tests/websocket/tests/hybi/non-document-mixed-content-blocked-http-with-embedded-https.html
3484                http/tests/websocket/tests/hybi/non-document-mixed-content-blocked-https-with-embedded-http-with-embedded-https.https.html
3485                http/tests/websocket/tests/hybi/non-document-mixed-content-blocked.https.html
3486         
3487         * Modules/websockets/WebSocket.cpp:
3488         (WebCore::WebSocket::connect):
3489         * Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
3490         (WebCore::WorkerThreadableWebSocketChannel::Bridge::connect):
3491         * loader/MixedContentChecker.cpp:
3492         (WebCore::MixedContentChecker::checkForMixedContentInFrameTree):
3493         * loader/MixedContentChecker.h:
3494         Patch to block insecure WebSocket URL connection attempts by Workers
3495         on secure pages. If the URL is ws, and any embedding iframe has protocol
3496         https, and the context is a Worker, the connection should be blocked.
3497
3498         I was unable to write a test case to hit the case where a document
3499         does not have a frame and tries to communicate via a worker to
3500         connect to a WebSocket because after removing the subframe from its
3501         parent, the subframe is unable to perform a postMessage to a worker
3502         even in the same script execution to tell the worker to connect
3503         to a WebSocket.
3504
3505 2019-09-24  Zalan Bujtas  <zalan@apple.com>
3506
3507         [LFC][IFC] Line::Content should use LineBox
3508         https://bugs.webkit.org/show_bug.cgi?id=202128
3509         <rdar://problem/55649079>
3510
3511         Reviewed by Antti Koivisto.
3512
3513         Replace Line::Content's m_logicalRect, m_baseline and m_baselineOffset with LineBox.
3514
3515         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
3516         (WebCore::Layout::InlineFormattingContext::InlineLayout::layout):
3517         (WebCore::Layout::InlineFormattingContext::InlineLayout::computedIntrinsicWidth const):
3518         (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns):
3519         * layout/inlineformatting/InlineFormattingContextQuirks.cpp:
3520         (WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const):
3521         (WebCore::Layout::InlineFormattingContext::Quirks::lineHeightConstraints const):
3522         * layout/inlineformatting/InlineLine.cpp:
3523         (WebCore::Layout::Line::close):
3524         (WebCore::Layout::Line::adjustBaselineAndLineHeight):
3525         * layout/inlineformatting/InlineLine.h:
3526         (WebCore::Layout::Line::Content::lineBox const):
3527         (WebCore::Layout::Line::Content::setLineBox):
3528         (WebCore::Layout::Line::baselineOffset const):
3529         (WebCore::Layout::Line::Content::isEmpty const): Deleted.
3530         (WebCore::Layout::Line::Content::logicalTop const): Deleted.
3531         (WebCore::Layout::Line::Content::logicalLeft const): Deleted.
3532         (WebCore::Layout::Line::Content::logicalRight const): Deleted.
3533         (WebCore::Layout::Line::Content::logicalBottom const): Deleted.
3534         (WebCore::Layout::Line::Content::logicalWidth const): Deleted.
3535         (WebCore::Layout::Line::Content::logicalHeight const): Deleted.
3536         (WebCore::Layout::Line::Content::baseline const): Deleted.
3537         (WebCore::Layout::Line::Content::baselineOffset const): Deleted.
3538         (WebCore::Layout::Line::Content::setLogicalRect): Deleted.
3539         (WebCore::Layout::Line::Content::setBaseline): Deleted.
3540         (WebCore::Layout::Line::Content::setBaselineOffset): Deleted.
3541         * layout/inlineformatting/InlineLineBox.h:
3542         (WebCore::Layout::LineBox::Baseline::height const):
3543         (WebCore::Layout::LineBox::LineBox):
3544         (WebCore::Layout::LineBox::baselineOffset const):
3545         (WebCore::Layout::LineBox::Baseline::Baseline):
3546         (WebCore::Layout::LineBox::Baseline::setAscent):
3547         (WebCore::Layout::LineBox::Baseline::setDescent):
3548         (WebCore::Layout::LineBox::Baseline::reset):
3549         (WebCore::Layout::LineBox::Baseline::ascent const):
3550         (WebCore::Layout::LineBox::Baseline::descent const):
3551
3552 2019-09-24  Zalan Bujtas  <zalan@apple.com>
3553
3554         [LFC][IFC] Move line constraints computation to a dedicated function
3555         https://bugs.webkit.org/show_bug.cgi?id=202121
3556         <rdar://problem/55640742>
3557
3558         Reviewed by Antti Koivisto.
3559
3560         * layout/inlineformatting/InlineFormattingContext.h:
3561         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
3562         (WebCore::Layout::LineLayout::LineLayout):
3563         (WebCore::Layout::LineLayout::close):
3564         (WebCore::Layout::LineLayout::placeInlineItem):
3565         (WebCore::Layout::InlineFormattingContext::InlineLayout::layout):
3566         (WebCore::Layout::InlineFormattingContext::InlineLayout::initialConstraintsForLine):
3567         (WebCore::Layout::InlineFormattingContext::InlineLayout::computedIntrinsicWidth const):
3568         * layout/inlineformatting/InlineLine.h:
3569
3570 2019-09-24  Youenn Fablet  <youenn@apple.com>
3571
3572         AudioTrackPrivateMediaStreamCocoa does not need to manipulate the audio unit in play/pause methods
3573         https://bugs.webkit.org/show_bug.cgi?id=202097
3574         <rdar://problem/51548144>
3575
3576         Reviewed by Eric Carlson.
3577
3578         Instead of manipulating the audio unit in play/pause methods, it is more convenient to do so in audioSamplesAvailable.
3579         play/pause methods only update boolean values that audioSamplesAvailable will read.
3580         In particular, m_autoPlay and m_isPlaying are no longer modified in the audio thread.
3581
3582         Behavior was racy so difficult to reproduce.
3583
3584         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3585         (WebCore::AudioTrackPrivateMediaStreamCocoa::playInternal):
3586         (WebCore::AudioTrackPrivateMediaStreamCocoa::pause):
3587         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
3588         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
3589
3590 2019-09-23  Youenn Fablet  <youenn@apple.com>
3591
3592         Support sync-xhr feature policy
3593         https://bugs.webkit.org/show_bug.cgi?id=202098
3594
3595         Reviewed by Alex Christensen.
3596
3597         Add support for sync-xhr feature policy parsing.
3598         Use this feature policy to control use of sync XHR in documents
3599         as per https://xhr.spec.whatwg.org/#the-send()-method step 12.
3600
3601         Covered by updated test.
3602
3603         * html/FeaturePolicy.cpp:
3604         (WebCore::FeaturePolicy::parse):
3605         (WebCore::FeaturePolicy::allows const):
3606         * html/FeaturePolicy.h:
3607         * xml/XMLHttpRequest.cpp:
3608         (WebCore::isSyncXHRAllowedByFeaturePolicy):
3609         (WebCore::XMLHttpRequest::createRequest):
3610
3611 2019-09-23  Chris Dumez  <cdumez@apple.com>
3612
3613         Drop unnecessary SessionID.h header includes
3614         https://bugs.webkit.org/show_bug.cgi?id=202129
3615
3616         Reviewed by Alex Christensen.
3617
3618         * Modules/fetch/FetchBodyConsumer.h:
3619         * Modules/indexeddb/IDBDatabaseIdentifier.h:
3620         * bindings/js/SerializedScriptValue.h:
3621         * dom/DataTransfer.h:
3622         * editing/WebCorePasteboardFileReader.h:
3623         * fileapi/FileReaderLoader.h:
3624         * fileapi/ThreadableBlobRegistry.h:
3625         * html/FileListCreator.h:
3626         * loader/CookieJar.h:
3627         * loader/EmptyFrameLoaderClient.h:
3628         * loader/FrameLoaderClient.h:
3629         * loader/LoaderStrategy.h:
3630         * page/CacheStorageProvider.h:
3631         * page/Frame.h:
3632         * page/PageGroup.h:
3633         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
3634         * platform/network/CacheValidation.h:
3635         * platform/network/FormData.h:
3636         * platform/network/NetworkStorageSession.cpp:
3637         * platform/network/StorageSessionProvider.h:
3638         * workers/WorkerGlobalScopeProxy.h:
3639         * workers/service/ServiceWorkerContainer.h:
3640         * workers/service/ServiceWorkerProvider.h:
3641         * workers/service/server/RegistrationDatabase.h:
3642         * workers/service/server/SWServer.h:
3643         * workers/service/server/SWServerToContextConnection.h:
3644         * worklets/WorkletGlobalScope.h:
3645
3646 2019-09-23  Alex Christensen  <achristensen@webkit.org>
3647
3648         Fix WPT test html/browsers/offline/application-cache-api/api_swapcache_error.https.html
3649         https://bugs.webkit.org/show_bug.cgi?id=202056
3650         <rdar://problem/55523986>
3651
3652         Reviewed by Youenn Fablet.
3653
3654         The test makes sure we throw an exception when we are in an invalid state, which we should definitely do.
3655
3656         * loader/appcache/ApplicationCache.cpp:
3657         (WebCore::ApplicationCache::setGroup):
3658         (WebCore::ApplicationCache::setManifestResource):
3659         * loader/appcache/ApplicationCache.h:
3660         (WebCore::ApplicationCache::manifestResource const):
3661         (WebCore::ApplicationCache::group const):
3662         * loader/appcache/ApplicationCacheGroup.h:
3663         * loader/appcache/ApplicationCacheHost.cpp:
3664         (WebCore::ApplicationCacheHost::candidateApplicationCacheGroup const):
3665         (WebCore::ApplicationCacheHost::failedLoadingMainResource):
3666         (WebCore::ApplicationCacheHost::setCandidateApplicationCacheGroup):
3667         (WebCore::ApplicationCacheHost::swapCache):
3668         * loader/appcache/ApplicationCacheHost.h:
3669         (WebCore::ApplicationCacheHost::candidateApplicationCacheGroup const): Deleted.
3670         * loader/appcache/ApplicationCacheResource.h:
3671
3672 2019-09-23  Chris Dumez  <cdumez@apple.com>
3673
3674         PlugInClient::didStartFromOrigin() does not need a sessionID
3675         https://bugs.webkit.org/show_bug.cgi?id=202127
3676
3677         Reviewed by Geoffrey Garen.
3678
3679         * html/HTMLPlugInImageElement.cpp:
3680         (WebCore::HTMLPlugInImageElement::userDidClickSnapshot):
3681         * page/PlugInClient.h:
3682
3683 2019-09-23  Devin Rousso  <drousso@apple.com>
3684
3685         Web Inspector: Canvas: show WebGPU shader pipelines
3686         https://bugs.webkit.org/show_bug.cgi?id=201675
3687         <rdar://problem/55543450>
3688
3689         Reviewed by Joseph Pecoraro.
3690
3691         Tests: inspector/canvas/requestShaderSource-webgpu.html
3692                inspector/canvas/shaderProgram-add-remove-webgpu.html
3693                inspector/canvas/updateShader-webgpu.html
3694
3695         Create common base classes for `WebGPUPipeline` and `GPUPipeline` so that Web Inspector can
3696         instrument both render and compute shader pipelines.
3697
3698         Refactor `InspectorShaderProgram` to support both `WebGLProgram` and `WebGPUPipeline` so
3699         that the same object can be used for all types of shader "program"s.
3700
3701         Keep a copy of each shader module's source, and allow the shader module to be updated.
3702
3703         * Modules/webgpu/WebGPUDevice.h:
3704         * Modules/webgpu/WebGPUDevice.cpp:
3705         (WebCore::WebGPUDevice::WebGPUDevice):
3706         (WebCore::WebGPUDevice::~WebGPUDevice):
3707         (WebCore::WebGPUDevice::createShaderModule const):
3708         (WebCore::WebGPUDevice::createRenderPipeline): Added.
3709         (WebCore::WebGPUDevice::createComputePipeline): Added.
3710         (WebCore::WebGPUDevice::createRenderPipeline const): Deleted.
3711         (WebCore::WebGPUDevice::createComputePipeline const): Deleted.
3712
3713         * Modules/webgpu/WebGPUPipeline.h: Added.
3714         (WebCore::WebGPUPipeline::isRenderPipeline const):
3715         (WebCore::WebGPUPipeline::isComputePipeline const):
3716         (WebCore::WebGPUPipeline::scriptExecutionContext const):
3717         * Modules/webgpu/WebGPUPipeline.cpp: Added.
3718         (WebCore::WebGPUPipeline::instancesMutex):
3719         (WebCore::WebGPUPipeline::WebGPUPipeline):
3720         (WebCore::WebGPUPipeline::~WebGPUPipeline):
3721         * platform/graphics/gpu/GPUPipeline.cpp: Added.
3722         * platform/graphics/gpu/GPUPipeline.h: Added.
3723         (WebCore::GPUPipeline::isRenderPipeline const):
3724         (WebCore::GPUPipeline::isComputePipeline const):
3725
3726         * Modules/webgpu/WebGPUComputePipeline.idl:
3727         * Modules/webgpu/WebGPUComputePipeline.h:
3728         (WebCore::WebGPUComputePipeline::computePipeline const): Deleted.
3729         * Modules/webgpu/WebGPUComputePipeline.cpp:
3730         (WebCore::WebGPUComputePipeline::create):
3731         (WebCore::WebGPUComputePipeline::WebGPUComputePipeline):
3732         (WebCore::WebGPUComputePipeline::recompile): Added.
3733         * platform/graphics/gpu/GPUComputePipeline.h:
3734         (WebCore::GPUComputePipeline::isComputePipeline): Added.
3735         * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
3736         (WebCore::GPUComputePipeline::tryCreate):
3737         (WebCore::GPUComputePipeline::GPUComputePipeline):
3738         (WebCore::GPUComputePipeline::recompile): Added.
3739
3740         * Modules/webgpu/WebGPURenderPipeline.idl:
3741         * Modules/webgpu/WebGPURenderPipeline.h:
3742         (WebCore::WebGPURenderPipeline::renderPipeline const): Deleted.
3743         * Modules/webgpu/WebGPURenderPipeline.cpp:
3744         (WebCore::WebGPURenderPipeline::create):
3745         (WebCore::WebGPURenderPipeline::WebGPURenderPipeline):
3746         (WebCore::WebGPURenderPipeline::recompile): Added.
3747         * platform/graphics/gpu/GPURenderPipeline.h:
3748         (WebCore::GPURenderPipeline::isRenderPipeline): Added.
3749         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
3750         (WebCore::tryCreateMtlRenderPipelineState):
3751         (WebCore::GPURenderPipeline::tryCreate):
3752         (WebCore::GPURenderPipeline::GPURenderPipeline):
3753         (WebCore::GPURenderPipeline::recompile): Added.
3754
3755         * Modules/webgpu/WebGPUShaderModule.h:
3756         (WebCore::WebGPUShaderModule::source const): Added.
3757         * Modules/webgpu/WebGPUShaderModule.cpp:
3758         (WebCore::WebGPUShaderModule::update): Added.
3759         * Modules/webgpu/WebGPUProgrammableStageDescriptor.h:
3760         * platform/graphics/gpu/GPUProgrammableStageDescriptor.h:
3761         (WebCore::GPUProgrammableStageDescriptor::GPUProgrammableStageDescriptor):
3762
3763         * inspector/InspectorShaderProgram.h:
3764         * inspector/InspectorShaderProgram.cpp:
3765         (WebCore::InspectorShaderProgram::create):
3766         (WebCore::InspectorShaderProgram::InspectorShaderProgram):
3767         (WebCore::InspectorShaderProgram::program const): Added.
3768         (WebCore::InspectorShaderProgram::pipeline const): Added.
3769         (WebCore::shaderForType): Added.
3770         (WebCore::InspectorShaderProgram::requestShaderSource): Added.
3771         (WebCore::InspectorShaderProgram::updateShader): Added.
3772         (WebCore::InspectorShaderProgram::context const): Deleted.
3773         (WebCore::InspectorShaderProgram::shaderForType): Deleted.
3774
3775         * inspector/agents/InspectorCanvasAgent.h:
3776         * inspector/agents/InspectorCanvasAgent.cpp:
3777         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
3778         (WebCore::InspectorCanvasAgent::discardAgent):
3779         (WebCore::InspectorCanvasAgent::enable):
3780         (WebCore::InspectorCanvasAgent::disable):
3781         (WebCore::InspectorCanvasAgent::requestShaderSource):
3782         (WebCore::InspectorCanvasAgent::updateShader):
3783         (WebCore::InspectorCanvasAgent::setShaderProgramDisabled):
3784         (WebCore::InspectorCanvasAgent::setShaderProgramHighlighted):
3785         (WebCore::InspectorCanvasAgent::frameNavigated):
3786         (WebCore::InspectorCanvasAgent::didCreateWebGLProgram): Added.
3787         (WebCore::InspectorCanvasAgent::willDestroyWebGLProgram): Added.
3788         (WebCore::InspectorCanvasAgent::isWebGLProgramDisabled): Added.
3789         (WebCore::InspectorCanvasAgent::isWebGLProgramHighlighted): Added.
3790         (WebCore::InspectorCanvasAgent::didCreateWebGPUPipeline): Added.
3791         (WebCore::InspectorCanvasAgent::willDestroyWebGPUPipeline): Added.
3792         (WebCore::InspectorCanvasAgent::programDestroyedTimerFired): Added.
3793         (WebCore::InspectorCanvasAgent::reset): Added.
3794         (WebCore::InspectorCanvasAgent::unbindProgram):
3795         (WebCore::InspectorCanvasAgent::findInspectorProgram):
3796         (WebCore::InspectorCanvasAgent::didCreateProgram): Deleted.
3797         (WebCore::InspectorCanvasAgent::willDeleteProgram): Deleted.
3798         (WebCore::InspectorCanvasAgent::isShaderProgramDisabled): Deleted.
3799         (WebCore::InspectorCanvasAgent::isShaderProgramHighlighted): Deleted.
3800         (WebCore::InspectorCanvasAgent::clearCanvasData): Deleted.
3801         * inspector/InspectorInstrumentation.h:
3802         (WebCore::InspectorInstrumentation::didCreateWebGLProgram): Added.
3803         (WebCore::InspectorInstrumentation::willDestroyWebGLProgram): Added.
3804         (WebCore::InspectorInstrumentation::isWebGLProgramDisabled): Added.
3805         (WebCore::InspectorInstrumentation::isWebGLProgramHighlighted): Added.
3806         (WebCore::InspectorInstrumentation::didCreateWebGPUPipeline): Added.
3807         (WebCore::InspectorInstrumentation::willDestroyWebGPUPipeline): Added.
3808         (WebCore::InspectorInstrumentation::didCreateProgram): Deleted.
3809         (WebCore::InspectorInstrumentation::willDeleteProgram): Deleted.
3810         (WebCore::InspectorInstrumentation::isShaderProgramDisabled): Deleted.
3811         (WebCore::InspectorInstrumentation::isShaderProgramHighlighted): Deleted.
3812         * inspector/InspectorInstrumentation.cpp:
3813         (WebCore::InspectorInstrumentation::didCreateWebGLProgramImpl): Added.
3814         (WebCore::InspectorInstrumentation::willDestroyWebGLProgramImpl): Added.
3815         (WebCore::InspectorInstrumentation::isWebGLProgramDisabledImpl): Added.
3816         (WebCore::InspectorInstrumentation::isWebGLProgramHighlightedImpl): Added.
3817         (WebCore::InspectorInstrumentation::didCreateWebGPUPipelineImpl): Added.
3818         (WebCore::InspectorInstrumentation::willDestroyWebGPUPipelineImpl): Added.
3819         (WebCore::InspectorInstrumentation::didCreateProgramImpl): Deleted.
3820         (WebCore::InspectorInstrumentation::willDeleteProgramImpl): Deleted.
3821         (WebCore::InspectorInstrumentation::isShaderProgramDisabledImpl): Deleted.
3822         (WebCore::InspectorInstrumentation::isShaderProgramHighlightedImpl): Deleted.
3823
3824         * html/canvas/WebGLProgram.h:
3825         * html/canvas/WebGLProgram.cpp:
3826         (WebCore::WebGLProgram::WebGLProgram):
3827         (WebCore::WebGLProgram::~WebGLProgram):
3828         * html/canvas/WebGLRenderingContextBase.cpp:
3829         (WebCore::InspectorScopedShaderProgramHighlight::showHightlight):
3830         (WebCore::WebGLRenderingContextBase::createProgram):
3831         (WebCore::WebGLRenderingContextBase::deleteProgram):
3832         (WebCore::WebGLRenderingContextBase::drawArrays):
3833         (WebCore::WebGLRenderingContextBase::drawElements):
3834         Rename WebGL program instrumentation points to be less ambiguous.
3835
3836         * Sources.txt:
3837         * WebCore.xcodeproj/project.pbxproj:
3838
3839 2019-09-23  Wenson Hsieh  <wenson_hsieh@apple.com>
3840
3841         [iOS] Drop animation when dragging images from Photos to WebKit2 Mail compose is incorrect
3842         https://bugs.webkit.org/show_bug.cgi?id=201674
3843         <rdar://problem/51250952>
3844
3845         Reviewed by Tim Horton.
3846
3847         Adds new helper methods on DragController to support the new image placeholder drop codepath. See WebKit
3848         ChangeLog for more details.
3849
3850         Tests:  WKAttachmentTestsIOS.TargetedPreviewsWhenDroppingImages
3851                 WKAttachmentTestsIOS.TargetedPreviewIsClippedWhenDroppingTallImage
3852
3853         * editing/WebContentReader.h:
3854
3855         Fix the Windows build after including WebContentReader.h in DragController.cpp.
3856
3857         * html/HTMLImageElement.h:
3858         (WebCore::HTMLImageElement::isDroppedImagePlaceholder const):
3859         (WebCore::HTMLImageElement::setIsDroppedImagePlaceholder):
3860
3861         Add a flag to HTMLImageElement, indicating whether it is a dropped image placeholder. If so, we have special
3862         logic to remove some temporary inline style properties from the image after it has finished loading (see
3863         finalizeDroppedImagePlaceholder).
3864
3865         Note that this doesn't increase the size of HTMLImageElement.
3866
3867         * page/DragController.cpp:
3868         (WebCore::DragController::dragEnded):
3869
3870         Clean up any stale placeholders after the drag ends.
3871
3872         (WebCore::DragController::performDragOperation):
3873         (WebCore::DragController::removeAllDroppedImagePlaceholders):
3874
3875         Add a private helper to clean up any dropped image placeholders after failing to update dropped image
3876         placeholders for any reason.
3877
3878         (WebCore::DragController::tryToUpdateDroppedImagePlaceholders):
3879
3880         Invoked when performing the drag operation, after image data has been loaded; this function attempts to update
3881         the list of image placeholder elements tracked by DragController that were previously inserted using
3882         insertDroppedImagePlaceholdersAtCaret, and updates the source attribute of each element (as well as any backed
3883         attachment element, if attachment elements are enabled). It achieves this by reading the dropped data as web
3884         content, and matching up the images in the resulting fragment against the placeholder images. If each image in
3885         the fragment can correspond to exactly one placeholder, we update the source of each placeholder image,
3886         migrate attachment elements over to the placeholder images if needed, and finally discard the fragment.
3887
3888         A return value of false indicates that this process failed, in which case we clean up the placeholders and fall
3889         back to handling the drop normally.
3890
3891         (WebCore::DragController::insertDroppedImagePlaceholdersAtCaret):
3892
3893         Invoked when handling the drop, before any image data has been loaded; this function takes a list of sizes
3894         representing the preferred presentation sizes of each item provider that will be loaded as an image, and uses
3895         ReplaceSelectionCommand to insert a list of (initially blank) placeholder images at the drop caret, sized
3896         accordingly to each item provider's preferredPresentationSize.
3897
3898         To make this compatible with Mail compose (and all other known internal clients that use the _editable SPI), we
3899         additionally enforce a max-width of 100% on each image and preserve the aspect ratio of the image by adjusting
3900         the height if needed.
3901
3902         (WebCore::DragController::finalizeDroppedImagePlaceholder):
3903         * page/DragController.h:
3904
3905         Have DragController keep track of the list of dropped image placeholders (in DOM order), as well as the dropped
3906         image placeholder range. This information is used once item provider data arrives and the drag operation is
3907         being performed, to update the source of each dropped image placeholder.
3908
3909         (WebCore::DragController::droppedImagePlaceholders const):
3910         (WebCore::DragController::droppedImagePlaceholderRange const):
3911         * platform/network/mac/UTIUtilities.h:
3912
3913         Mark an existing helper function as WEBCORE_EXPORT.
3914
3915 2019-09-23  Daniel Bates  <dabates@apple.com>
3916
3917         Improve CSP inheritance semantics
3918         https://bugs.webkit.org/show_bug.cgi?id=201884
3919         <rdar://problem/50172407>
3920
3921         Reviewed by Brent Fulgham.
3922
3923         Update the CSP inheritance semantics to more closely match the logic in section Initialize a Document's CSP list
3924         of the CSP3 spec., <https://w3c.github.io/webappsec-csp/#initialize-document-csp>.
3925
3926         Towards this, move more of the inheritance logic out of Document::initContentSecurityPolicy() and into
3927         DocumentWriter::begin() where details about the document being replaced live. This lets us remove the
3928         need to track the previous content security policy to pass it to Document::initContentSecurityPolicy().
3929         Moreover, DocumentWriter::begin() knows the owner document that will be replaced with the result of
3930         executing a JavaScript URL. This is needed in order to fix up inheritance of CSP for such documents.
3931
3932         Tests: http/tests/security/contentSecurityPolicy/iframe-allowed-when-loaded-via-javascript-url.html
3933                http/tests/security/contentSecurityPolicy/iframe-blocked-when-loaded-via-javascript-url.html
3934                http/tests/security/contentSecurityPolicy/iframe-blocked-when-loaded-via-javascript-url2.html
3935
3936         * dom/Document.cpp:
3937         (WebCore::Document::initSecurityContext): If we are inheriting the security origin from the owner
3938         document then inherit its CSP policy. We copy over both the CSP state from the owner as well as
3939         update 'self' to match the owner's origin so that CSP source expressions that include 'self' work
3940         correctly even from about:blank documents.
3941         (WebCore::Document::initContentSecurityPolicy): Move most of the logic from here into DocumentWriter::begin()
3942         to take advantage of the fact that DocumentWriter::begin() knows about the outgoing document (if there
3943