62a7081f2e16d8bc9eec49da8c41ea667f75992f
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-09-18  Chris Dumez  <cdumez@apple.com>
2
3         WebSWServerToContextConnection::PostMessageToServiceWorkerClient IPC no longer needs to take a sessionID
4         https://bugs.webkit.org/show_bug.cgi?id=201883
5
6         Reviewed by Geoffrey Garen.
7
8         WebSWServerToContextConnection::PostMessageToServiceWorkerClient IPC no longer needs to take a sessionID,
9         now that we have a single session per WebProcess.
10
11         * workers/service/ServiceWorkerClient.cpp:
12         (WebCore::ServiceWorkerClient::postMessage):
13         * workers/service/context/SWContextManager.h:
14
15 2019-09-18  Russell Epstein  <repstein@apple.com>
16
17         Unreviewed, rolling out r250030.
18
19         Cause of Recent Build Failures.
20
21         Reverted changeset:
22
23         "Make all ScriptWrappable IsoHeap-ed"
24         https://bugs.webkit.org/show_bug.cgi?id=201846
25         https://trac.webkit.org/changeset/250030
26
27 2019-09-18  Zalan Bujtas  <zalan@apple.com>
28
29         [LFC] FormattingContext::Geometry::computedHeight* functions need containingBlockHeight only.
30         https://bugs.webkit.org/show_bug.cgi?id=201880
31         <rdar://problem/55449623>
32
33         Reviewed by Antti Koivisto.
34
35         Let's tighten the incoming vertical parameter.
36
37         * layout/FormattingContext.cpp:
38         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
39         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry):
40         * layout/FormattingContext.h:
41         * layout/FormattingContextGeometry.cpp:
42         (WebCore::Layout::FormattingContext::Geometry::computedHeightValue const):
43         (WebCore::Layout::FormattingContext::Geometry::computedMaxHeight const):
44         (WebCore::Layout::FormattingContext::Geometry::computedMinHeight const):
45         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry const):
46         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry const):
47         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
48         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin const):
49         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin const):
50
51 2019-09-18  Antti Koivisto  <antti@apple.com>
52
53         DocumentMarkerController should not invoke ensureLineBoxes during TextIterator traversal
54         https://bugs.webkit.org/show_bug.cgi?id=201911
55         <rdar://problem/55455458>
56
57         Reviewed by Zalan Bujtas.
58
59         DocumentMarkerController::addMarker may call ensureLineBoxes but TextIterator doesn't expect mutations during traversal.
60         Fix by doing range collection as a separate step.
61
62         * dom/DocumentMarkerController.cpp:
63         (WebCore::DocumentMarkerController::collectTextRanges):
64         (WebCore::DocumentMarkerController::addMarker):
65         (WebCore::DocumentMarkerController::addTextMatchMarker):
66         (WebCore::DocumentMarkerController::addDictationPhraseWithAlternativesMarker):
67         (WebCore::DocumentMarkerController::addDictationResultMarker):
68         (WebCore::DocumentMarkerController::addDraggedContentMarker):
69         (WebCore::DocumentMarkerController::addPlatformTextCheckingMarker):
70         (WebCore::DocumentMarkerController::removeMarkers):
71         (WebCore::DocumentMarkerController::filterMarkers):
72         * dom/DocumentMarkerController.h:
73
74 2019-09-18  Zalan Bujtas  <zalan@apple.com>
75
76         [LFC] Shrink-to-fit-width needs the available width constraint value only
77         https://bugs.webkit.org/show_bug.cgi?id=201896
78         <rdar://problem/55465382>
79
80         Reviewed by Antti Koivisto.
81
82         * layout/FormattingContext.h:
83         * layout/FormattingContextGeometry.cpp:
84         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
85         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
86         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
87         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
88         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
89         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
90         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
91
92 2019-09-18  David Kilzer  <ddkilzer@apple.com>
93
94         REGRESSION (r247566): Leak of UICTFontDescriptor in WebCore::FontDatabase::InstalledFont::InstalledFont()
95         <https://webkit.org/b/201893>
96         <rdar://problem/55464115>
97
98         Reviewed by Brent Fulgham.
99
100         * platform/graphics/cocoa/FontCacheCoreText.cpp:
101         (WebCore::FontDatabase::InstalledFont::InstalledFont): Use
102         adoptCF() to fix the leak.
103
104 2019-09-18  Yusuke Suzuki  <ysuzuki@apple.com>
105
106         Make all ScriptWrappable IsoHeap-ed
107         https://bugs.webkit.org/show_bug.cgi?id=201846
108         <rdar://problem/55407535>
109
110         Reviewed by Mark Lam.
111
112         This patch puts Event and derived classes under IsoHeap to make all ScriptWrappable classes IsoHeap-ed.
113
114         * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.cpp:
115         * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.h:
116         (WebCore::WebKitPlaybackTargetAvailabilityEvent::create): Deleted.
117         (WebCore::WebKitPlaybackTargetAvailabilityEvent::availability const): Deleted.
118         * Modules/applepay/ApplePayPaymentAuthorizedEvent.cpp:
119         * Modules/applepay/ApplePayPaymentAuthorizedEvent.h:
120         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.cpp:
121         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.h:
122         (WebCore::ApplePayPaymentMethodSelectedEvent::create): Deleted.
123         (WebCore::ApplePayPaymentMethodSelectedEvent::paymentMethod): Deleted.
124         * Modules/applepay/ApplePayShippingContactSelectedEvent.cpp:
125         * Modules/applepay/ApplePayShippingContactSelectedEvent.h:
126         * Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp:
127         * Modules/applepay/ApplePayShippingMethodSelectedEvent.h:
128         * Modules/applepay/ApplePayValidateMerchantEvent.cpp:
129         * Modules/applepay/ApplePayValidateMerchantEvent.h:
130         (WebCore::ApplePayValidateMerchantEvent::create): Deleted.
131         (WebCore::ApplePayValidateMerchantEvent::validationURL const): Deleted.
132         * Modules/encryptedmedia/MediaKeyMessageEvent.cpp:
133         * Modules/encryptedmedia/MediaKeyMessageEvent.h:
134         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp:
135         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.h:
136         (WebCore::WebKitMediaKeyMessageEvent::create): Deleted.
137         (WebCore::WebKitMediaKeyMessageEvent::message const): Deleted.
138         (WebCore::WebKitMediaKeyMessageEvent::destinationURL const): Deleted.
139         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp:
140         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.h:
141         (WebCore::WebKitMediaKeyNeededEvent::create): Deleted.
142         (WebCore::WebKitMediaKeyNeededEvent::initData const): Deleted.
143         * Modules/gamepad/GamepadEvent.cpp:
144         * Modules/gamepad/GamepadEvent.h:
145         (WebCore::GamepadEvent::create): Deleted.
146         (WebCore::GamepadEvent::gamepad const): Deleted.
147         * Modules/indexeddb/IDBRequestCompletionEvent.cpp:
148         * Modules/indexeddb/IDBRequestCompletionEvent.h:
149         (WebCore::IDBRequestCompletionEvent::create): Deleted.
150         * Modules/indexeddb/IDBVersionChangeEvent.cpp:
151         * Modules/indexeddb/IDBVersionChangeEvent.h:
152         * Modules/mediarecorder/BlobEvent.cpp:
153         * Modules/mediarecorder/BlobEvent.h:
154         * Modules/mediarecorder/MediaRecorderErrorEvent.cpp:
155         * Modules/mediarecorder/MediaRecorderErrorEvent.h:
156         * Modules/mediastream/MediaStreamTrackEvent.cpp:
157         * Modules/mediastream/MediaStreamTrackEvent.h:
158         * Modules/mediastream/OverconstrainedErrorEvent.cpp: Copied from Source/WebCore/Modules/mediastream/RTCDataChannelEvent.h.
159         * Modules/mediastream/OverconstrainedErrorEvent.h:
160         (WebCore::OverconstrainedErrorEvent::create): Deleted.
161         (WebCore::OverconstrainedErrorEvent::error const): Deleted.
162         (WebCore::OverconstrainedErrorEvent::OverconstrainedErrorEvent): Deleted.
163         * Modules/mediastream/RTCDTMFToneChangeEvent.cpp:
164         * Modules/mediastream/RTCDTMFToneChangeEvent.h:
165         * Modules/mediastream/RTCDataChannelEvent.cpp:
166         * Modules/mediastream/RTCDataChannelEvent.h:
167         * Modules/mediastream/RTCPeerConnectionIceEvent.cpp:
168         * Modules/mediastream/RTCPeerConnectionIceEvent.h:
169         (WebCore::RTCPeerConnectionIceEvent::url const): Deleted.
170         * Modules/mediastream/RTCTrackEvent.cpp:
171         * Modules/mediastream/RTCTrackEvent.h:
172         (WebCore::RTCTrackEvent::receiver const): Deleted.
173         (WebCore::RTCTrackEvent::track const): Deleted.
174         (WebCore::RTCTrackEvent::streams const): Deleted.
175         (WebCore::RTCTrackEvent::transceiver const): Deleted.
176         (WebCore::RTCTrackEvent::eventInterface const): Deleted.
177         * Modules/paymentrequest/MerchantValidationEvent.cpp:
178         * Modules/paymentrequest/MerchantValidationEvent.h:
179         * Modules/paymentrequest/PaymentMethodChangeEvent.cpp:
180         * Modules/paymentrequest/PaymentMethodChangeEvent.h:
181         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp:
182         * Modules/paymentrequest/PaymentRequestUpdateEvent.h:
183         * Modules/speech/SpeechSynthesisEvent.cpp:
184         * Modules/speech/SpeechSynthesisEvent.h:
185         (WebCore::SpeechSynthesisEvent::charIndex const): Deleted.
186         (WebCore::SpeechSynthesisEvent::elapsedTime const): Deleted.
187         (WebCore::SpeechSynthesisEvent::name const): Deleted.
188         (WebCore::SpeechSynthesisEvent::eventInterface const): Deleted.
189         * Modules/webaudio/AudioProcessingEvent.cpp:
190         * Modules/webaudio/AudioProcessingEvent.h:
191         * Modules/webaudio/OfflineAudioCompletionEvent.cpp:
192         * Modules/webaudio/OfflineAudioCompletionEvent.h:
193         * Modules/webgpu/GPUUncapturedErrorEvent.cpp:
194         * Modules/webgpu/GPUUncapturedErrorEvent.h:
195         * Modules/websockets/CloseEvent.cpp: Copied from Source/WebCore/dom/BeforeTextInsertedEvent.cpp.
196         * Modules/websockets/CloseEvent.h:
197         (WebCore::CloseEvent::create): Deleted.
198         (WebCore::CloseEvent::wasClean const): Deleted.
199         (WebCore::CloseEvent::code const): Deleted.
200         (WebCore::CloseEvent::reason const): Deleted.
201         (WebCore::CloseEvent::CloseEvent): Deleted.
202         * Modules/webvr/VRDisplayEvent.cpp:
203         * Modules/webvr/VRDisplayEvent.h:
204         * Sources.txt:
205         * WebCore.xcodeproj/project.pbxproj:
206         * accessibility/AccessibleSetValueEvent.cpp:
207         * accessibility/AccessibleSetValueEvent.h:
208         (WebCore::AccessibleSetValueEvent::create): Deleted.
209         (WebCore::AccessibleSetValueEvent::value const): Deleted.
210         * animation/AnimationPlaybackEvent.cpp:
211         * animation/AnimationPlaybackEvent.h:
212         * bindings/js/ScriptWrappable.cpp: Copied from Source/WebCore/html/canvas/WebGLContextEvent.cpp.
213         * bindings/js/ScriptWrappable.h:
214         * dom/AnimationEvent.cpp:
215         * dom/AnimationEvent.h:
216         * dom/BeforeLoadEvent.cpp: Copied from Source/WebCore/dom/BeforeTextInsertedEvent.cpp.
217         * dom/BeforeLoadEvent.h:
218         * dom/BeforeTextInsertedEvent.cpp:
219         * dom/BeforeTextInsertedEvent.h:
220         * dom/BeforeUnloadEvent.cpp:
221         * dom/BeforeUnloadEvent.h:
222         * dom/ClipboardEvent.cpp:
223         * dom/ClipboardEvent.h:
224         * dom/CompositionEvent.cpp:
225         * dom/CompositionEvent.h:
226         * dom/CustomEvent.cpp:
227         * dom/CustomEvent.h:
228         * dom/DeviceMotionEvent.cpp:
229         * dom/DeviceMotionEvent.h:
230         * dom/DeviceOrientationEvent.cpp:
231         * dom/DeviceOrientationEvent.h:
232         * dom/ErrorEvent.cpp:
233         * dom/ErrorEvent.h:
234         * dom/Event.cpp:
235         * dom/Event.h:
236         * dom/FocusEvent.cpp:
237         * dom/FocusEvent.h:
238         * dom/HashChangeEvent.cpp: Copied from Source/WebCore/dom/BeforeTextInsertedEvent.cpp.
239         * dom/HashChangeEvent.h:
240         * dom/InputEvent.cpp:
241         * dom/InputEvent.h:
242         * dom/KeyboardEvent.cpp:
243         * dom/KeyboardEvent.h:
244         * dom/MessageEvent.cpp:
245         * dom/MessageEvent.h:
246         * dom/MouseEvent.cpp:
247         * dom/MouseEvent.h:
248         * dom/MouseRelatedEvent.cpp:
249         * dom/MouseRelatedEvent.h:
250         * dom/MutationEvent.cpp:
251         * dom/MutationEvent.h:
252         * dom/OverflowEvent.cpp:
253         * dom/OverflowEvent.h:
254         * dom/PageTransitionEvent.cpp:
255         * dom/PageTransitionEvent.h:
256         * dom/PointerEvent.cpp:
257         * dom/PointerEvent.h:
258         * dom/PopStateEvent.cpp:
259         * dom/PopStateEvent.h:
260         * dom/ProgressEvent.cpp:
261         * dom/ProgressEvent.h:
262         * dom/PromiseRejectionEvent.cpp:
263         * dom/PromiseRejectionEvent.h:
264         * dom/SecurityPolicyViolationEvent.cpp: Copied from Source/WebCore/dom/BeforeTextInsertedEvent.cpp.
265         * dom/SecurityPolicyViolationEvent.h:
266         * dom/TextEvent.cpp:
267         * dom/TextEvent.h:
268         * dom/TouchEvent.cpp:
269         * dom/TouchEvent.h:
270         * dom/TransitionEvent.cpp:
271         * dom/TransitionEvent.h:
272         * dom/UIEvent.cpp:
273         * dom/UIEvent.h:
274         * dom/UIEventWithKeyState.cpp:
275         * dom/UIEventWithKeyState.h:
276         * dom/WebKitAnimationEvent.cpp:
277         * dom/WebKitAnimationEvent.h:
278         * dom/WebKitTransitionEvent.cpp:
279         * dom/WebKitTransitionEvent.h:
280         * dom/WheelEvent.cpp:
281         * dom/WheelEvent.h:
282         * html/MediaEncryptedEvent.cpp:
283         * html/MediaEncryptedEvent.h:
284         * html/canvas/WebGLContextEvent.cpp:
285         * html/canvas/WebGLContextEvent.h:
286         * html/shadow/ProgressShadowElement.h:
287         * html/track/TrackEvent.cpp:
288         * html/track/TrackEvent.h:
289         * storage/StorageEvent.cpp:
290         * storage/StorageEvent.h:
291         (WebCore::StorageEvent::key const): Deleted.
292         (WebCore::StorageEvent::oldValue const): Deleted.
293         (WebCore::StorageEvent::newValue const): Deleted.
294         (WebCore::StorageEvent::url const): Deleted.
295         (WebCore::StorageEvent::storageArea const): Deleted.
296         * svg/SVGFEDistantLightElement.h:
297         * svg/SVGFEFuncAElement.h:
298         * svg/SVGFEFuncBElement.h:
299         * svg/SVGFEFuncGElement.h:
300         * svg/SVGFEFuncRElement.h:
301         * svg/SVGFEPointLightElement.h:
302         * svg/SVGFESpotLightElement.h:
303         * svg/SVGZoomEvent.cpp:
304         * svg/SVGZoomEvent.h:
305         * workers/service/ExtendableEvent.cpp:
306         * workers/service/ExtendableEvent.h:
307         * workers/service/ExtendableMessageEvent.cpp:
308         * workers/service/ExtendableMessageEvent.h:
309         * workers/service/FetchEvent.cpp:
310         * workers/service/FetchEvent.h:
311         * xml/XMLHttpRequestProgressEvent.cpp: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.cpp.
312         * xml/XMLHttpRequestProgressEvent.h:
313         (WebCore::XMLHttpRequestProgressEvent::create): Deleted.
314         (WebCore::XMLHttpRequestProgressEvent::position const): Deleted.
315         (WebCore::XMLHttpRequestProgressEvent::totalSize const): Deleted.
316         (WebCore::XMLHttpRequestProgressEvent::XMLHttpRequestProgressEvent): Deleted.
317
318 2019-09-18  Loïc Yhuel  <loic.yhuel@softathome.com>  and  Fujii Hironori  <Hironori.Fujii@sony.com>
319
320         JPEGImageDecoder: use libjpeg-turbo RGBA output path even for Adobe transform=0 JPEGs
321         https://bugs.webkit.org/show_bug.cgi?id=200163
322
323         Reviewed by Carlos Garcia Campos.
324
325         Remove the workaround for old libjpeg-turbo which doesn't support
326         BGRA output for Adobe transform=0 images. The bug was fixed in
327         libjpeg-turbo 1.2.1.
328
329         No new tests, no behavior change.
330
331         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
332         (WebCore::JPEGImageReader::decode): Removed code in #if defined(TURBO_JPEG_RGB_SWIZZLE).
333         (colorSpaceHasAlpha): Removed an unused inline function.
334
335 2019-09-18  Joonghun Park  <jh718.park@samsung.com>
336
337         Unreviewed. Remove build warning since r248998.
338
339         This patch removes build warning below.
340         warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
341
342         No new tests, no behavioral change.
343
344         * platform/image-decoders/png/PNGImageDecoder.cpp:
345         (WebCore::PNGImageDecoder::rowAvailable):
346
347 2019-09-18  Fujii Hironori  <Hironori.Fujii@sony.com>
348
349         [cairo] Incorrect targetRect in BackingStoreBackendCairoImpl::scroll
350         https://bugs.webkit.org/show_bug.cgi?id=201895
351
352         Reviewed by Carlos Garcia Campos.
353
354         In BackingStoreBackendCairoImpl::scroll, targetRect is calculated
355         wrongly by shifting maxX and maxY. Bug 59655 fixed the issue by
356         removing the shifting, but only for BackingStoreBackendCairoX11::scroll.
357
358         No new tests, no behavior change.
359
360         * platform/graphics/cairo/BackingStoreBackendCairoImpl.cpp:
361         (WebCore::BackingStoreBackendCairoImpl::scroll): Take intersection of targetRect and scrollRect.
362
363 2019-09-18  Andy Estes  <aestes@apple.com>
364
365         [Cocoa] Add a WKA extension point
366         https://bugs.webkit.org/show_bug.cgi?id=201801
367         <rdar://problem/55372507>
368
369         Reviewed by Alexey Proskuryakov.
370
371         * Modules/applepay/ApplePayRequestBase.cpp:
372         (WebCore::requiresSupportedNetworks):
373         (WebCore::convertAndValidate):
374
375 2019-09-17  Chris Dumez  <cdumez@apple.com>
376
377         Unreviewed, revert change that Alex mistakenly committed at the same time as r250006 and broke the build.
378
379         * page/PerformanceObserver.idl:
380
381 2019-09-17  Chris Dumez  <cdumez@apple.com>
382
383         Stop calling Page::setSessionID() from WebKit2
384         https://bugs.webkit.org/show_bug.cgi?id=201888
385
386         Reviewed by Alex Christensen.
387
388         Stop calling Page::setSessionID() from WebKit2 since Page's sessionID can never change when
389         using WebKit2 (We process-swap and create a new Page in a new process when changing data
390         store). Instead, we now pass the sessionID ID when constructing the Page, as part of the
391         PageConfiguration structure.
392
393         * editing/markup.cpp:
394         (WebCore::createPageForSanitizingWebContent):
395         * loader/EmptyClients.cpp:
396         (WebCore::pageConfigurationWithEmptyClients):
397         * loader/EmptyClients.h:
398         * page/Page.cpp:
399         (WebCore::Page::Page):
400         (WebCore::Page::setSessionID):
401         * page/PageConfiguration.cpp:
402         (WebCore::PageConfiguration::PageConfiguration):
403         * page/PageConfiguration.h:
404         * svg/graphics/SVGImage.cpp:
405         (WebCore::SVGImage::dataChanged):
406         * workers/service/context/ServiceWorkerThreadProxy.cpp:
407         (WebCore::createPageForServiceWorker):
408         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
409
410 2019-09-17  Mark Lam  <mark.lam@apple.com>
411
412         Use constexpr instead of const in symbol definitions that are obviously constexpr.
413         https://bugs.webkit.org/show_bug.cgi?id=201879
414
415         Rubber-stamped by Joseph Pecoraro.
416
417         No new tests.  Covered by existing tests.
418
419         * bindings/js/JSDOMConstructorBase.h:
420         * bindings/js/JSDOMWindowProperties.h:
421         * bindings/scripts/CodeGeneratorJS.pm:
422         (GenerateHeader):
423         (GeneratePrototypeDeclaration):
424         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
425         * bindings/scripts/test/JS/JSTestEnabledBySetting.h:
426         * bindings/scripts/test/JS/JSTestEnabledForContext.h:
427         * bindings/scripts/test/JS/JSTestEventTarget.h:
428         * bindings/scripts/test/JS/JSTestGlobalObject.h:
429         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h:
430         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h:
431         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h:
432         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h:
433         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h:
434         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h:
435         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h:
436         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h:
437         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h:
438         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h:
439         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.h:
440         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.h:
441         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.h:
442         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h:
443         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h:
444         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h:
445         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.h:
446         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.h:
447         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.h:
448         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.h:
449         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.h:
450         * bindings/scripts/test/JS/JSTestObj.h:
451         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
452         * bindings/scripts/test/JS/JSTestPluginInterface.h:
453         * bindings/scripts/test/JS/JSTestTypedefs.h:
454         * bridge/objc/objc_runtime.h:
455         * bridge/runtime_array.h:
456         * bridge/runtime_method.h:
457         * bridge/runtime_object.h:
458
459 2019-09-17  Ross Kirsling  <ross.kirsling@sony.com>
460
461         Unreviewed restabilization of non-unified build.
462
463         * inspector/InspectorCanvas.cpp:
464         (WebCore::InspectorCanvas::resolveContext const):
465         * platform/win/BString.h:
466         * svg/PatternAttributes.h:
467         * svg/SVGLengthValue.cpp:
468         * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
469         * workers/service/ServiceWorkerJob.cpp:
470         * workers/service/WorkerSWClientConnection.cpp:
471         * workers/service/server/SWServerRegistration.cpp:
472
473 2019-09-17  Keith Rollin  <krollin@apple.com>
474
475         Remove some support for < iOS 12
476         https://bugs.webkit.org/show_bug.cgi?id=201851
477         <rdar://problem/55422044>
478
479         Reviewed by Jiewen Tan and Alexey Proskuryakov.
480
481         Remove some support for iOS versions less than 12.0.
482
483         Update conditionals that reference __IPHONE_OS_VERSION_MIN_REQUIRED
484         and __IPHONE_OS_VERSION_MAX_ALLOWED, assuming that they both have
485         values >= 120000. This means that expressions like
486         "__IPHONE_OS_VERSION_MIN_REQUIRED < 101200" are always False and
487         "__IPHONE_OS_VERSION_MIN_REQUIRED >= 101200" are always True.
488
489         This removal is part of a series of patches effecting such removal.
490
491         No new tests -- no new or changed functionality.
492
493         * crypto/mac/CryptoKeyRSAMac.cpp:
494         (WebCore::CryptoKeyRSA::create):
495         (WebCore::castDataArgumentToCCRSACryptorCreateFromDataIfNeeded): Deleted.
496
497 2019-09-17  Nikolas Zimmermann  <zimmermann@kde.org>
498
499         SVG <animateMotion> does not reset the element to its first animation frame if its fill is "remove"
500         https://bugs.webkit.org/show_bug.cgi?id=201565
501
502         Reviewed by Said Abou-Hallawa.
503
504         Fix fill="remove" support for <animateMotion>: properly trigger visual updates.
505         Motion animations are implemented by provding an additional transformation on
506         SVGGraphicsElements: the supplementalTransform().
507
508         When an <animateMotion> element specifies fill="remove" the supplemental transform is
509         correctly reset, when the animation is finished. However, nobody is notified about the
510         change of transformation matrix. Fix by marking the target elements renderer as
511         setNeedsTransformUpdate() and call markForLayoutAndParentResourceInvalidation().
512
513         <animate> elements are not affected by the bug:
514         SVGAnimateElementBase::clearAnimatedType()
515          -> invokes SVGAttributeAnimator::stop()
516             -> invokes applyAnimatedPropertyChange() [via SVGAnimatedPropertyAnimator]
517             -> invokes SVGXXXElement::svgAttributeChanged().
518
519         When animating e.g. the 'transform' attribute SVGGraphicsElement::svgAttributeChanged()
520         will use exactly the same mechanism to trigger visul updates: first call
521         setNeedsTransformUpdate() on the associated renderer, followd by a call to
522         markForLayoutAndParentResourceInvalidation().
523
524         --> Both code paths are now consistent.
525         Also fixes http://web-platform-tests.live/svg/animations/animateMotion-fill-remove.html.
526
527         Tests: svg/animations/fill-remove-support.html
528                svg/animations/animateMotion-remove-freeze-use.svg
529
530         * svg/SVGAnimateMotionElement.cpp:
531         (WebCore::SVGAnimateMotionElement::clearAnimatedType): Call applyResultsToTarget().
532         (WebCore::SVGAnimateMotionElement::calculateAnimatedValue): Stop calling
533         setNeedsTransformUpdate() on the target elements renderer, since applyResultsToTarget()
534         is responsible for modifications of the renderer state.
535         (WebCore::SVGAnimateMotionElement::applyResultsToTarget): Always mark the renderer
536         as setNeedsTransformUpdate() when applying the results, before the call to
537         RenderSVGResource::markForLayoutAndParentResourceInvalidation(). This is more consistent
538         with respect to the code path that updates the SVGElements instances (<use> support).
539
540 2019-09-17  Andy Estes  <aestes@apple.com>
541
542         [Cocoa] Add a WKA extension point
543         https://bugs.webkit.org/show_bug.cgi?id=201801
544         <rdar://problem/55372507>
545
546         Reviewed by Alexey Proskuryakov.
547
548         * Modules/applepay/ApplePayRequestBase.cpp:
549         (WebCore::requiresSupportedNetworks):
550         (WebCore::convertAndValidate):
551
552 2019-09-17  Antti Koivisto  <antti@apple.com>
553
554         TextIterator should convert tabs to spaces
555         https://bugs.webkit.org/show_bug.cgi?id=201863
556
557         Reviewed by Zalan Bujtas.
558
559         As seen in tests
560
561         imported/w3c/web-platform-tests/innerText/getter.html
562         imported/w3c/web-platform-tests/html/dom/elements/the-innertext-idl-attribute/getter.html
563
564         The old simple line layout path in TextIterator used to do this.
565
566         * editing/TextIterator.cpp:
567         (WebCore::TextIterator::handleTextBox):
568
569 2019-09-17  Zalan Bujtas  <zalan@apple.com>
570
571         [LFC[MarginCollapsing] MarginCollapse::estimatedMarginBefore should take pre-computed non-collapsed margin values.
572         https://bugs.webkit.org/show_bug.cgi?id=201848
573         <rdar://problem/55419419>
574
575         Reviewed by Antti Koivisto.
576
577         This is in preparation for using constraint values instead of querying the display tree for containing block geometry information.
578         See webkit.org/b/201795
579
580         * layout/blockformatting/BlockFormattingContext.cpp:
581         (WebCore::Layout::BlockFormattingContext::computeEstimatedVerticalPosition):
582         * layout/blockformatting/BlockFormattingContext.h:
583         * layout/blockformatting/BlockMarginCollapse.cpp:
584         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginBefore):
585         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginAfter):
586         (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
587         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeIgnoringCollapsingThrough):
588         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedVerticalValues):
589
590 2019-09-17  Zalan Bujtas  <zalan@apple.com>
591
592         [First-letter] Use WeakPtr for the first-letter insertion point.
593         https://bugs.webkit.org/show_bug.cgi?id=201842
594         <rdar://problem/51373788>
595
596         Reviewed by Antti Koivisto.
597
598         The about-to-be-removed first letter renderer's sibling could potentially be destroyed too as the result of the anonymous subtree collapsing logic (when the next sibling is a generated anonymous block and it is not needed anymore.)
599
600         Test: fast/text/first-letter-with-columns-crash.html
601
602         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
603         (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
604
605 2019-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
606
607         [GTK] Cannot create EGL window surface: EGL_BAD_ALLOC
608         https://bugs.webkit.org/show_bug.cgi?id=201505
609
610         Reviewed by Žan Doberšek.
611
612         This happens because eglCreateWindowSurface() is called twice for the same window when not using the WPE
613         renderer. New versions of Mesa fail the second time with a EGL_BAD_ALLOC.
614
615         * platform/graphics/egl/GLContextEGL.cpp:
616         (WebCore::GLContextEGL::createWindowContext): Check surface is nullptr before falling back to use
617         eglCreateWindowSurface().
618
619 2019-09-17  Jiewen Tan  <jiewen_tan@apple.com>
620
621         [WebAuthn] Use WebPreferences instead of RuntimeEnabledFeatures in UIProcess
622         https://bugs.webkit.org/show_bug.cgi?id=198176
623         <rdar://problem/55285709>
624
625         Reviewed by Youenn Fablet.
626
627         No changes of behavior.
628
629         * Modules/webauthn/PublicKeyCredential.cpp:
630         (WebCore::PublicKeyCredential::isUserVerifyingPlatformAuthenticatorAvailable):
631         Resolves the promise with false immediately when the feature flag is false.
632
633 2019-09-17  Rob Buis  <rbuis@igalia.com>
634
635         Access-Control-Expose-Headers parsed incorrectly
636         https://bugs.webkit.org/show_bug.cgi?id=172357
637
638         Reviewed by Youenn Fablet.
639
640         When parsing the list, strip HTTP spaces and verify
641         that the list items are valid HTTP tokens.
642
643         Behavior matches Firefox and Chrome.
644
645         Test: imported/w3c/web-platform-tests/cors/access-control-expose-headers-parsing.window.html
646
647         * platform/network/HTTPParsers.h:
648         (WebCore::addToAccessControlAllowList):
649         (WebCore::parseAccessControlAllowList):
650
651 2019-09-17  Youenn Fablet  <youenn@apple.com>
652
653         Content-Type should be preserved on responses created from DOMCache
654         https://bugs.webkit.org/show_bug.cgi?id=201815
655
656         Reviewed by Alex Christensen.
657
658        Covered by updated test expectations
659
660         * Modules/fetch/FetchResponse.cpp:
661         (WebCore::FetchResponse::create):
662         Update content type when creating the response from DOMCache.
663
664 2019-09-16  Antti Koivisto  <antti@apple.com>
665
666         Move code for traversing reversed text boxes from TextIterator to TextBoxIterator
667         https://bugs.webkit.org/show_bug.cgi?id=201819
668
669         Reviewed by Zalan Bujtas.
670
671         Handle traversal order in TextBoxIterator.
672
673         * editing/TextIterator.cpp:
674         (WebCore::TextIterator::handleTextNode):
675         (WebCore::TextIterator::handleTextBox):
676         (WebCore::TextIterator::handleTextNodeFirstLetter):
677         * editing/TextIterator.h:
678         * rendering/line/LineLayoutInterfaceTextBoxes.cpp:
679         (WebCore::LineLayoutInterface::TextBox::rect const):
680         (WebCore::LineLayoutInterface::TextBox::logicalRect const):
681         (WebCore::LineLayoutInterface::TextBox::hasHyphen const):
682         (WebCore::LineLayoutInterface::TextBox::isLeftToRightDirection const):
683         (WebCore::LineLayoutInterface::TextBox::dirOverride const):
684         (WebCore::LineLayoutInterface::TextBox::text const):
685         (WebCore::LineLayoutInterface::TextBox::localStartOffset const):
686         (WebCore::LineLayoutInterface::TextBox::localEndOffset const):
687         (WebCore::LineLayoutInterface::TextBox::length const):
688         (WebCore::LineLayoutInterface::TextBoxIterator::TextBoxIterator):
689         (WebCore::LineLayoutInterface::TextBoxIterator::traverseNextInVisualOrder):
690         (WebCore::LineLayoutInterface::TextBoxIterator::traverseNextInTextOrder):
691         (WebCore::LineLayoutInterface::TextBoxIterator::operator== const):
692         (WebCore::LineLayoutInterface::TextBoxIterator::atEnd const):
693         (WebCore::LineLayoutInterface::Provider::firstTextBoxInVisualOrderFor):
694         (WebCore::LineLayoutInterface::Provider::firstTextBoxInTextOrderFor):
695         (WebCore::LineLayoutInterface::Provider::textBoxRangeFor):
696         * rendering/line/LineLayoutInterfaceTextBoxes.h:
697         (WebCore::LineLayoutInterface::TextBoxIterator::TextBoxIterator):
698         (WebCore::LineLayoutInterface::TextBoxIterator::operator++):
699         (WebCore::LineLayoutInterface::Provider::firstTextBoxFor):
700
701 2019-09-16  Fujii Hironori  <Hironori.Fujii@sony.com>
702
703         [WinCairo][curl] Don't compile unused CertificateCFWin.cpp
704         https://bugs.webkit.org/show_bug.cgi?id=201860
705
706         Reviewed by Alex Christensen.
707
708         Curl port is using ResourceHandle::setClientCertificateInfo
709         instead of ResourceHandle::setClientCertificate.
710
711         * PlatformWin.cmake: Added CertificateCFWin.cpp to WebCore_SOURCES only if USE_CFURLCONNECTION.
712         * platform/network/ResourceHandle.h: Removed an unused method setClientCertificate.
713         * platform/network/curl/ResourceHandleCurl.cpp:
714         (WebCore::ResourceHandle::setClientCertificate): Deleted.
715
716 2019-09-16  Fujii Hironori  <Hironori.Fujii@sony.com>
717
718         [AppleWin] Assertion failure in defaultSupportedImageTypes in UTIRegistry.cpp
719         https://bugs.webkit.org/show_bug.cgi?id=198286
720
721         Reviewed by Brent Fulgham.
722
723         Some image types aren't supported by CG for Windows.
724
725         No new tests, covered by existing tests.
726
727         * platform/graphics/cg/ImageSourceCGWin.cpp:
728         (WebCore::MIMETypeForImageType): Return the correct MIME types for
729         com.microsoft.cur and com.microsoft.ico.
730         * platform/graphics/cg/UTIRegistry.cpp:
731         (WebCore::defaultSupportedImageTypes): Excluded public.jpeg-2000 and public.mpo-image if PLATFORM(WIN).
732
733 2019-09-16  Fujii Hironori  <Hironori.Fujii@sony.com>
734
735         [Cairo] Image::drawTiled → Cairo::drawSurface → cairo_paint_with_alpha → segfault happens in pixman
736         https://bugs.webkit.org/show_bug.cgi?id=201755
737
738         Reviewed by Don Olmstead.
739
740         Segmentation faults happened in pixman while painting a image. In
741         Cairo::drawSurface, originalSrcRect can be slightly larger than
742         the surface size because of floating number calculations.
743         Cairo::drawSurface created a subsurface which is running over the
744         parent surface boundaries.
745
746         * platform/graphics/cairo/CairoOperations.cpp:
747         (WebCore::Cairo::drawSurface): Calculated a intersection with
748         expandedSrcRect and the parent surface size for subsurface size.
749
750 2019-09-16  Eric Liang  <ericliang@apple.com>
751
752         AX: USER: VO: Messages > Message > Shift-VO-M doesn't reveal correct actions
753         https://bugs.webkit.org/show_bug.cgi?id=201840
754
755         Reviewed by Chris Fleizach.
756
757         menuForEvent: expects event-position in window's space, but we pass the position in Core's space. In this case, we need to convert core's space to window's space.
758         Tested that existing tests passed with WK1 and WK2
759
760         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
761         (-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]):
762
763 2019-09-16  Jiewen Tan  <jiewen_tan@apple.com>
764
765         [WebAuthn] Support more than two FIDO protocol versions
766         https://bugs.webkit.org/show_bug.cgi?id=198408
767         <rdar://problem/51292176>
768
769         Reviewed by Chris Dumez.
770
771         Covered by new API tests.
772
773         * Modules/webauthn/fido/DeviceResponseConverter.cpp:
774         (fido::readCTAPGetInfoResponse):
775         Remove the check for the array size.
776
777 2019-09-16  Brent Fulgham  <bfulgham@apple.com>
778
779         [FTW] Correct lifespan of other SharedBitmaps
780         https://bugs.webkit.org/show_bug.cgi?id=201800
781
782         Reviewed by Dean Jackson.
783
784         The pop-up menu code creates its own SharedBitmap in the WebContent process,
785         which needs to release its handle before destruction, otherwise the UIProcess
786         will be unable to access the GPU texture (since it will have been cleaned up).
787
788         This patch also audits other uses of SharedBitmap to make sure a similar
789         problem doesn't exist elsewhere.
790
791         * platform/graphics/win/Direct2DUtilities.cpp:
792         (WebCore::Direct2D::toDXGIDevice): Switch to IDXGIDevice1 (since that is our
793         minimum target DX).
794         (WebCore::Direct2D::factoryForDXGIDevice): Ditto.
795         (WebCore::Direct2D::swapChainOfSizeForWindowAndDevice): Added.
796         * platform/graphics/win/Direct2DUtilities.h:
797         * platform/graphics/win/GraphicsContextDirect2D.cpp:
798         (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): Correct
799         a very silly use-after-move in the implementation.
800         * platform/graphics/win/PlatformContextDirect2D.h:
801         (WebCore::PlatformContextDirect2D::d3dDevice const): Added.
802         (WebCore::PlatformContextDirect2D::setD3DDevice):
803
804 2019-09-16  Chris Dumez  <cdumez@apple.com>
805
806         Simplify WebResourceLoadObserver now that we have one WebProcess per session
807         https://bugs.webkit.org/show_bug.cgi?id=201821
808
809         Reviewed by Brent Fulgham.
810
811         * Modules/websockets/WebSocket.cpp:
812         (WebCore::WebSocket::connect):
813         * loader/ResourceLoadObserver.h:
814         (WebCore::ResourceLoadObserver::logWebSocketLoading):
815         (WebCore::ResourceLoadObserver::statisticsForURL):
816         * testing/Internals.cpp:
817         (WebCore::Internals::resourceLoadStatisticsForURL):
818
819 2019-09-16  ChangSeok Oh  <changseok@webkit.org>
820
821         [GTK] Remove GraphicsContext3D dependency from the outside of WebGL
822         https://bugs.webkit.org/show_bug.cgi?id=201748
823
824         Reviewed by Alex Christensen.
825
826         This is a preliminary change to bring ANGLE support for WebGL to GTK port.
827         GraphicsContext3DANGLE has its own egl context but we want to make ANGLE egl context
828         for WebGL and other GL contexts (i.e., glx, gles/egl) for TextureMapper live together.
829         Mixed uses of GraphicsContext3D outside of WebGL code could cause unintended behaviors.
830         We want to make sure that only WebGL code uses it.
831
832         No new tests since no functionality changed.
833
834         * platform/graphics/GLContext.cpp:
835         * platform/graphics/GLContext.h:
836         * platform/graphics/glx/GLContextGLX.cpp:
837         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
838         (WebCore::GstVideoFrameHolder::platformLayerBuffer):
839         (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
840         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
841
842 2019-09-16  Zalan Bujtas  <zalan@apple.com>
843
844         [LFC] Make the nested Geometry/MarginCollapse/Quirks c'tors private.
845         https://bugs.webkit.org/show_bug.cgi?id=201825
846         <rdar://problem/55403474>
847
848         Reviewed by Antti Koivisto.
849
850         The Geometry/MarginCollapse/Quirks objects should be constructed through the corresponding accessor functions.
851         This is also a preparation for being able to pass the layout box in to these stack objects and call geometry(layoutBox)->outOfFlowVerticalGeometry() vs. geometry()->outOfFlowVerticalGeometry(layoutBox). 
852
853         * layout/FormattingContext.h:
854         * layout/blockformatting/BlockFormattingContext.h:
855         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
856         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
857         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
858         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
859         * layout/inlineformatting/InlineFormattingContext.h:
860         * layout/tableformatting/TableFormattingContext.h:
861
862 2019-09-16  Jon Davis  <jond@apple.com>
863
864         Update feature status for Battery Status API, WebGL 2, and Dialog Element
865         https://bugs.webkit.org/show_bug.cgi?id=201469
866
867         Reviewed by Joseph Pecoraro.
868
869         * features.json:
870
871 2019-09-16  Andres Gonzalez  <andresg_22@apple.com>
872
873         Rename [WebAccessibilityObjectWrapper _accessibilityInsertText] to accessibilityInsertText to match accessibility client.
874         https://bugs.webkit.org/show_bug.cgi?id=201820
875
876         Reviewed by Chris Fleizach.
877
878         No new tests necessary since this is a method rename.
879
880         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
881         (-[WebAccessibilityObjectWrapper accessibilityInsertText:]):
882         (-[WebAccessibilityObjectWrapper _accessibilityInsertText:]): Deleted.
883         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
884         (-[WebAccessibilityObjectWrapper accessibilityInsertText:]):
885         (-[WebAccessibilityObjectWrapper _accessibilityInsertText:]): Deleted.
886
887 2019-09-16  Zalan Bujtas  <zalan@apple.com>
888
889         [LFC] Always provide a containing block width value to compute* functions.
890         https://bugs.webkit.org/show_bug.cgi?id=201809
891         <rdar://problem/55383153>
892
893         Reviewed by Antti Koivisto.
894
895         The caller can always make a more informative decision about the default value when the containing block width is not available.
896         (Currently the only case is when computing the preferred width.)
897
898         * layout/FormattingContext.cpp:
899         (WebCore::Layout::FormattingContext::computeBorderAndPadding):
900         * layout/FormattingContextGeometry.cpp:
901         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
902         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry const):
903         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
904         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry const):
905         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry const):
906         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
907         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin const):
908         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin const):
909         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin const):
910         (WebCore::Layout::FormattingContext::Geometry::inFlowPositionedPositionOffset const):
911         (WebCore::Layout::FormattingContext::Geometry::computedPadding const):
912         (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin const):
913         (WebCore::Layout::FormattingContext::Geometry::computedVerticalMargin const):
914         * layout/LayoutUnits.h:
915         (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
916         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
917         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
918         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin const):
919         * layout/inlineformatting/InlineFormattingContext.cpp:
920         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
921         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot):
922         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot):
923         (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForReplacedInlineBox):
924         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
925         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
926
927 2019-09-16  Zalan Bujtas  <zalan@apple.com>
928
929         [LFC][BFC] BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin should not read containing block's width
930         https://bugs.webkit.org/show_bug.cgi?id=201807
931         <rdar://problem/55381342>
932
933         Reviewed by Antti Koivisto.
934
935         This is in preparation for using constraint values instead of querying the display tree for containing block geometry information.
936         See webkit.org/b/201795
937
938         * layout/blockformatting/BlockFormattingContext.h:
939         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
940         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
941         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin const):
942         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
943
944 2019-09-16  Antti Koivisto  <antti@apple.com>
945
946         Eliminate separate simple line layout path from TextIterator
947         https://bugs.webkit.org/show_bug.cgi?id=201760
948
949         Reviewed by Zalan Bujtas.
950
951         Use the new line layout iterator to implement linebox traversal in TextIterator.
952
953         * WebCore.xcodeproj/project.pbxproj:
954         * editing/TextIterator.cpp:
955         (WebCore::TextIterator::advance):
956         (WebCore::TextIterator::handleTextNode):
957         (WebCore::TextIterator::handleTextBox):
958
959         InlineTextBox* -> LineLayoutInterface::TextBoxIterator
960         Delete the seperate simple line layout path.
961
962         (WebCore::TextIterator::handleTextNodeFirstLetter):
963         (WebCore::TextIterator::emitCharacter):
964         (WebCore::TextIterator::emitText):
965         * editing/TextIterator.h:
966         * rendering/RenderTreeAsText.cpp:
967         (WebCore::RenderTreeAsText::writeRenderObject):
968         (WebCore::write):
969         * rendering/SimpleLineLayoutResolver.cpp:
970         (WebCore::SimpleLineLayout::RunResolver::Iterator::Iterator):
971         (WebCore::SimpleLineLayout::RunResolver::Iterator::advanceLines):
972         * rendering/SimpleLineLayoutResolver.h:
973         (WebCore::SimpleLineLayout::RunResolver::Iterator::resolver const):
974         (WebCore::SimpleLineLayout::RunResolver::Iterator::inQuirksMode const):
975         (WebCore::SimpleLineLayout::RunResolver::Iterator::operator== const):
976         (WebCore::SimpleLineLayout::RunResolver::Iterator::simpleRun const):
977
978         Make RunResolver::Iterator copyable (so TextBoxIterator becomes copyable too).
979
980         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
981         (WebCore::SimpleLineLayout::TextFragmentIterator::findNextTextFragment):
982         * rendering/line/LineLayoutInterfaceTextBoxes.cpp:
983         (WebCore::LineLayoutInterface::TextBox::rect const):
984         (WebCore::LineLayoutInterface::TextBox::logicalRect const):
985         (WebCore::LineLayoutInterface::TextBox::hasHyphen const):
986         (WebCore::LineLayoutInterface::TextBox::isLeftToRightDirection const):
987         (WebCore::LineLayoutInterface::TextBox::dirOverride const):
988         (WebCore::LineLayoutInterface::TextBox::text const):
989         (WebCore::LineLayoutInterface::TextBox::localStartOffset const):
990         (WebCore::LineLayoutInterface::TextBox::localEndOffset const):
991         (WebCore::LineLayoutInterface::TextBox::length const):
992
993         Add offset and length functions.
994
995         (WebCore::LineLayoutInterface::TextBox::iterator const):
996         (WebCore::LineLayoutInterface::TextBoxIterator::TextBoxIterator):
997         (WebCore::LineLayoutInterface::TextBoxIterator::traverseNext):
998         (WebCore::LineLayoutInterface::TextBoxIterator::operator== const):
999         (WebCore::LineLayoutInterface::TextBoxIterator::atEnd const):
1000         (WebCore::LineLayoutInterface::Provider::firstTextBoxFor):
1001         (WebCore::LineLayoutInterface::Provider::textBoxRangeFor):
1002         (WebCore::LineLayoutInterface::Provider::iteratorForInlineTextBox):
1003
1004         Add Provider class for making iterators. It constructs and keeps SimpleLineLayout::Resolvers alive during traversal as needed.
1005
1006         * rendering/line/LineLayoutInterfaceTextBoxes.h:
1007         (WebCore::LineLayoutInterface::TextBoxIterator::TextBoxIterator):
1008         (WebCore::LineLayoutInterface::TextBoxIterator::operator bool const):
1009         (WebCore::LineLayoutInterface::TextBoxIterator::operator== const):
1010         (WebCore::LineLayoutInterface::TextBoxIterator::operator!= const):
1011         (WebCore::LineLayoutInterface::TextBoxIterator::operator* const):
1012         (WebCore::LineLayoutInterface::TextBoxIterator::operator-> const):
1013
1014         Make TextBoxIterator privately inherit TextBox. This way we don't need to construct temporaries and can easily implement operator->.
1015
1016         (WebCore::LineLayoutInterface::TextBoxRange::TextBoxRange):
1017         (WebCore::LineLayoutInterface::TextBoxRange::begin const):
1018         (WebCore::LineLayoutInterface::TextBoxRange::end const):
1019
1020         Use separate end() type of C++17 ranges.
1021
1022 2019-09-16  Andres Gonzalez  <andresg_22@apple.com>
1023
1024         Expose misspelling ranges for editable content to accessibility clients.
1025         https://bugs.webkit.org/show_bug.cgi?id=201752
1026         <rdar://problem/49556828>
1027
1028         Reviewed by Chris Fleizach.
1029
1030         Test: accessibility/misspelling-range.html
1031
1032         Added [WebAccessibilityObjectWrapper misspellingTextMarkerRange] and
1033         underlying AccessibilityObject implementation to expose misspellings to
1034         accessibility clients that provide an alternative user interface to
1035         spell checking.
1036         * accessibility/AccessibilityObject.cpp:
1037         (WebCore::AccessibilityObject::getMisspellingRange const):
1038         * accessibility/AccessibilityObject.h:
1039         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1040         (-[WebAccessibilityObjectWrapper misspellingTextMarkerRange:direction:]):
1041         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1042         (accessibilityMisspellingSearchCriteriaForParameterizedAttribute):
1043         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
1044
1045 2019-09-15  Andy Estes  <aestes@apple.com>
1046
1047         [WebIDL] Derived dictionaries should inherit their inherited dictionaries' partials
1048         https://bugs.webkit.org/show_bug.cgi?id=201802
1049
1050         Reviewed by Sam Weinig.
1051
1052         Prior to this change, a dictionary D that inherits from dictionary B would not inherit B's
1053         partial dictionaries. Fixed this by moving supplemental dependencies processing from
1054         generate-bindings.pl to CodeGenerator.pm and reusing it in GetDictionaryByType.
1055
1056         Added new bindings tests.
1057
1058         * bindings/scripts/CodeGenerator.pm:
1059         (new):
1060         (ProcessDocument):
1061         (ProcessSupplementalDependencies):
1062         (shouldPropertyBeExposed):
1063         (GetDictionaryByType):
1064         * bindings/scripts/generate-bindings.pl:
1065         (generateBindings):
1066         (shouldPropertyBeExposed): Deleted.
1067         * bindings/scripts/test/JS/JSTestDerivedDictionary.cpp: Added.
1068         (WebCore::convertDictionary<TestDerivedDictionary>):
1069         (WebCore::convertDictionaryToJS):
1070         * bindings/scripts/test/JS/JSTestDerivedDictionary.h: Added.
1071         * bindings/scripts/test/JS/JSTestInheritedDictionary.cpp: Added.
1072         (WebCore::convertDictionary<TestInheritedDictionary>):
1073         (WebCore::convertDictionaryToJS):
1074         * bindings/scripts/test/JS/JSTestInheritedDictionary.h: Added.
1075         * bindings/scripts/test/TestDerivedDictionary.idl: Added.
1076         * bindings/scripts/test/TestInheritedDictionary.idl: Added.
1077         * bindings/scripts/test/TestSupplemental.idl:
1078
1079 2019-09-15  David Kilzer  <ddkilzer@apple.com>
1080
1081         Missing call to [self init] in -[WebScrollbarPartAnimation initWithScrollbar:featureToAnimate:animateFrom:animateTo:duration:]
1082         <https://webkit.org/b/201806>
1083
1084         Reviewed by Simon Fraser.
1085
1086         * platform/mac/ScrollAnimatorMac.mm:
1087         (-[WebScrollbarPartAnimation initWithScrollbar:featureToAnimate:animateFrom:animateTo:duration:]):
1088         Call [self init] and return early if the result is nil.
1089
1090 2019-09-14  Justin Fan  <justin_fan@apple.com>
1091
1092         [WebGPU] Make WebGPURenderPipeline and WebGPUComputePipeline inherit from GPUObjectBase
1093         https://bugs.webkit.org/show_bug.cgi?id=201207
1094
1095         Reviewed by Dean Jackson.
1096
1097         Make remaining WebGPU "client" classes manage their error scopes, instead of the internal classes.
1098         Matches Web/GPUBuffer, and allows "invalid" WebGPU objects to create errors.
1099
1100         Covered by existing tests.
1101
1102         * Modules/webgpu/WebGPUComputePipeline.cpp:
1103         (WebCore::WebGPUComputePipeline::create):
1104         (WebCore::WebGPUComputePipeline::WebGPUComputePipeline):
1105         * Modules/webgpu/WebGPUComputePipeline.h:
1106         * Modules/webgpu/WebGPUDevice.cpp:
1107         (WebCore::WebGPUDevice::createRenderPipeline const):
1108         (WebCore::WebGPUDevice::createComputePipeline const):
1109         * Modules/webgpu/WebGPURenderPipeline.cpp:
1110         (WebCore::WebGPURenderPipeline::create):
1111         (WebCore::WebGPURenderPipeline::WebGPURenderPipeline):
1112         * Modules/webgpu/WebGPURenderPipeline.h:
1113         * WebCore.xcodeproj/project.pbxproj:
1114         * platform/graphics/gpu/GPUComputePipeline.h:
1115         * platform/graphics/gpu/GPURenderPipeline.h:
1116         * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
1117         (WebCore::GPUComputePipeline::tryCreate):
1118         (WebCore::GPUComputePipeline::GPUComputePipeline):
1119         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
1120         (WebCore::GPURenderPipeline::tryCreate):
1121         (WebCore::GPURenderPipeline::GPURenderPipeline):
1122
1123 2019-09-14  Yusuke Suzuki  <ysuzuki@apple.com>
1124
1125         Retire x86 32bit JIT support
1126         https://bugs.webkit.org/show_bug.cgi?id=201790
1127
1128         Reviewed by Mark Lam.
1129
1130         * cssjit/FunctionCall.h:
1131         (WebCore::FunctionCall::callAndBranchOnBooleanReturnValue):
1132         (WebCore::FunctionCall::swapArguments):
1133
1134 2019-09-14  Zalan Bujtas  <zalan@apple.com>
1135
1136         [LFC] FormattingContext::Geometry::inFlowPositionedPositionOffset should not read containing block's width
1137         https://bugs.webkit.org/show_bug.cgi?id=201797
1138         <rdar://problem/55366244>
1139
1140         Reviewed by Antti Koivisto.
1141
1142         This is in preparation for using constraint values instead of querying the display tree for containing block geometry information.
1143         See webkit.org/b/201795
1144
1145         * layout/FormattingContext.h:
1146         * layout/FormattingContextGeometry.cpp:
1147         (WebCore::Layout::FormattingContext::Geometry::inFlowPositionedPositionOffset const):
1148         * layout/blockformatting/BlockFormattingContext.cpp:
1149         (WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren):
1150         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
1151         (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns const):
1152
1153 2019-09-14  Zalan Bujtas  <zalan@apple.com>
1154
1155         [LFC] FormattingContext::Geometry::inlineReplacedHeightAndMargin should not read containing block's width
1156         https://bugs.webkit.org/show_bug.cgi?id=201796
1157         <rdar://problem/55366109>
1158
1159         Reviewed by Antti Koivisto.
1160
1161         This is in preparation for using constraint values instead of querying the display tree for containing block geometry information.
1162         See webkit.org/b/201795
1163
1164         * layout/FormattingContext.h:
1165         * layout/FormattingContextGeometry.cpp:
1166         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry const):
1167         (WebCore::Layout::FormattingContext::Geometry::complicatedCases const):
1168         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin const):
1169         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin const):
1170         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin const):
1171         * layout/blockformatting/BlockFormattingContext.cpp:
1172         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
1173         * layout/blockformatting/BlockFormattingContext.h:
1174         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1175         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1176         * layout/inlineformatting/InlineFormattingContext.cpp:
1177         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin):
1178         * layout/inlineformatting/InlineFormattingContext.h:
1179         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
1180         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin const):
1181
1182 2019-09-14  Zalan Bujtas  <zalan@apple.com>
1183
1184         [LFC] FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry should not read containing block's width.
1185         https://bugs.webkit.org/show_bug.cgi?id=201794
1186         <rdar://problem/55365669>
1187
1188         Reviewed by Antti Koivisto.
1189
1190         This is in preparation for using constraint values instead of querying the display tree for containing block geometry information.
1191         See webkit.org/b/201795
1192
1193         * layout/FormattingContext.cpp:
1194         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry):
1195         * layout/FormattingContext.h:
1196         * layout/FormattingContextGeometry.cpp:
1197         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry const):
1198         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry const):
1199         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry const):
1200
1201 2019-09-14  Chris Dumez  <cdumez@apple.com>
1202
1203         newController may be moved several times under SWClientConnection::notifyClientsOfControllerChange()
1204         https://bugs.webkit.org/show_bug.cgi?id=201792
1205         <rdar://problem/55351284>
1206
1207         Reviewed by Youenn Fablet.
1208
1209         Stop WTFMove()'ing inside the for loop.
1210
1211         * workers/service/SWClientConnection.cpp:
1212         (WebCore::SWClientConnection::notifyClientsOfControllerChange):
1213
1214 2019-09-14  Zalan Bujtas  <zalan@apple.com>
1215
1216         [LFC] FormattingContext::Geometry::computedHeightValue should not read containing block's height.
1217         https://bugs.webkit.org/show_bug.cgi?id=201791
1218         <rdar://problem/55361695>
1219
1220         Reviewed by Antti Koivisto.
1221
1222         While sizing/positioning a particular box, we oftentimes need some containing block geometry information.
1223         The idea here is that instead of calling formattingContext().geometry(containingBlock), these constraint values
1224         would be pushed in to those compute* functions. It helps controlling the access to the display box tree and
1225         prevents formatting context escaping.
1226
1227         * layout/FormattingContext.cpp:
1228         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry):
1229         * layout/FormattingContext.h:
1230         * layout/FormattingContextGeometry.cpp:
1231         (WebCore::Layout::FormattingContext::Geometry::computedHeightValue const):
1232         (WebCore::Layout::FormattingContext::Geometry::computedMaxHeight const):
1233         (WebCore::Layout::FormattingContext::Geometry::computedMinHeight const):
1234         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry const):
1235         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry const):
1236         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry const):
1237         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin const):
1238         * layout/LayoutUnits.h:
1239         * layout/blockformatting/BlockFormattingContext.cpp:
1240         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
1241
1242 2019-09-11  Dean Jackson  <dino@apple.com>
1243
1244         Provide a prototype for AR QuickLook to trigger processing in the originating page
1245         https://bugs.webkit.org/show_bug.cgi?id=201371
1246         <rdar://54904781>
1247
1248         Reviewed by Simon Fraser.
1249
1250         * dom/Document.cpp:
1251         (WebCore::Document::dispatchSystemPreviewActionEvent): Create and dispatch a MessageEvent.
1252         * dom/Document.h:
1253
1254         * html/HTMLAnchorElement.cpp: Send along the page and frame identifiers for this
1255         object to ensure that any reply goes to the correct place.
1256         (WebCore::HTMLAnchorElement::handleClick):
1257
1258         * loader/FrameLoadRequest.h: Use the new SystemPreviewInfo type.
1259         (WebCore::FrameLoadRequest::isSystemPreview const):
1260         (WebCore::FrameLoadRequest::systemPreviewInfo const):
1261         (WebCore::FrameLoadRequest::systemPreviewRect const): Deleted.
1262         * loader/FrameLoader.cpp:
1263         (WebCore::FrameLoader::loadURL):
1264
1265         * loader/FrameLoaderTypes.h: Provide encoders for the type.
1266         (WebCore::SystemPreviewInfo::encode const):
1267         (WebCore::SystemPreviewInfo::decode):
1268
1269         * platform/network/ResourceRequestBase.cpp: Use the new type.
1270         (WebCore::ResourceRequestBase::isSystemPreview const):
1271         (WebCore::ResourceRequestBase::systemPreviewInfo const):
1272         (WebCore::ResourceRequestBase::setSystemPreviewInfo):
1273         (WebCore::ResourceRequestBase::setSystemPreview): Deleted.
1274         (WebCore::ResourceRequestBase::systemPreviewRect const): Deleted.
1275         (WebCore::ResourceRequestBase::setSystemPreviewRect): Deleted.
1276         * platform/network/ResourceRequestBase.h:
1277
1278         * testing/Internals.cpp: Expose the frame and page identifiers to testing.
1279         (WebCore::Internals::frameIdentifier const):
1280         (WebCore::Internals::pageIdentifier const):
1281         * testing/Internals.h:
1282         * testing/Internals.idl:
1283
1284 2019-09-13  Chris Dumez  <cdumez@apple.com>
1285
1286         Crash under WebCore::firstPositionInNode()
1287         https://bugs.webkit.org/show_bug.cgi?id=201764
1288         <rdar://problem/54823754>
1289
1290         Reviewed by Wenson Hsieh and Geoff Garen.
1291
1292         Make sure to keep a Ref<> to the textNode when we call insertNodeAtTabSpanPosition()
1293         or insertNodeAt().
1294
1295         Test: editing/firstPositionInNode-crash.html
1296
1297         * editing/InsertTextCommand.cpp:
1298         (WebCore::InsertTextCommand::positionInsideTextNode):
1299
1300 2019-09-13  Youenn Fablet  <youenn@apple.com>
1301
1302         Partition processes running service workers by session ID
1303         https://bugs.webkit.org/show_bug.cgi?id=201643
1304
1305         Reviewed by Chris Dumez.
1306
1307         Move the creation of service worker context connection management to SWServer.
1308         This allows to partition service worker context connections by registrable domain and sessionID.
1309         WebKit2 is still responsible to create the IPC creation through a Function given to SWServer at construction
1310         time.
1311         SWServer now keeps a map of registrable domain -> context connection to use for running workers.
1312         It also keeps a map of being-created connections.
1313         In case a context connection is removed from the SWServer, the SWServer will notify all related worker instances
1314         that they are not running. The SWServer will also recreate a context connection if needed.
1315
1316         This allows removing the global server context connection map.
1317         Make SWServerToContextConnection no longer refcounted to simplify the lifetime management.
1318
1319         Covered by API test.
1320
1321         * workers/service/server/SWServer.cpp:
1322         (WebCore::SWServer::SWServer):
1323         (WebCore::SWServer::tryInstallContextData):
1324         (WebCore::SWServer::contextConnectionCreated):
1325         (WebCore::SWServer::unregisterServiceWorkerClient):
1326         (WebCore::SWServer::needsContextConnectionForRegistrableDomain const):
1327         (WebCore::SWServer::addContextConnection):
1328         (WebCore::SWServer::removeContextConnection):
1329         (WebCore::SWServer::createContextConnection):
1330         * workers/service/server/SWServer.h:
1331         (WebCore::SWServer::contextConnectionForRegistrableDomain):
1332         * workers/service/server/SWServerToContextConnection.cpp:
1333         (WebCore::SWServerToContextConnection::SWServerToContextConnection):
1334         (WebCore::SWServerToContextConnection::~SWServerToContextConnection):
1335         * workers/service/server/SWServerToContextConnection.h:
1336         * workers/service/server/SWServerWorker.cpp:
1337         (WebCore::SWServerWorker::contextConnection):
1338
1339 2019-09-13  Zalan Bujtas  <zalan@apple.com>
1340
1341         [LFC] Do not create FormattingContext unless the root has child boxes.
1342         https://bugs.webkit.org/show_bug.cgi?id=201766
1343         <rdar://problem/55344449>
1344
1345         Reviewed by Antti Koivisto.
1346
1347         Just because a box establishes a formatting context, it does not necessarily mean we need to create a formatting context object for it.
1348         The established formatting context is responsible for laying out the descendant content. The formatting context root itself is
1349         laid out in the formatting context it lives in. So if there's no descendent content, we don't need to construct the context objects.
1350
1351         <body><div style="float: left;"></div></body> <- this div establishes a block formatting context (float) but it does not have any content so laying
1352         it out simply means sizing and positioning it in the initial block formatting context.
1353
1354         * layout/FormattingContext.cpp:
1355         (WebCore::Layout::FormattingContext::FormattingContext):
1356         (WebCore::Layout::FormattingContext::layoutOutOfFlowContent):
1357         (WebCore::Layout::FormattingContext::mapTopToFormattingContextRoot const):
1358         (WebCore::Layout::FormattingContext::mapLeftToFormattingContextRoot const):
1359         (WebCore::Layout::FormattingContext::mapRightToFormattingContextRoot const):
1360         (WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const):
1361         * layout/FormattingContext.h:
1362         (WebCore::Layout::FormattingContext::root const):
1363         * layout/FormattingContextGeometry.cpp:
1364         (WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const):
1365         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
1366         * layout/LayoutState.cpp:
1367         (WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
1368         (WebCore::Layout::LayoutState::establishedFormattingState const):
1369         (WebCore::Layout::LayoutState::createFormattingStateForFormattingRootIfNeeded):
1370         (WebCore::Layout::LayoutState::createFormattingContext):
1371         * layout/LayoutState.h:
1372         (WebCore::Layout::LayoutState::hasFormattingState const):
1373         * layout/blockformatting/BlockFormattingContext.cpp:
1374         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
1375         (WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
1376         (WebCore::Layout::BlockFormattingContext::usedAvailableWidthForFloatAvoider const):
1377         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot):
1378         (WebCore::Layout::BlockFormattingContext::computedIntrinsicWidthConstraints):
1379         * layout/blockformatting/BlockFormattingContext.h:
1380         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1381         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1382         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
1383         * layout/blockformatting/BlockMarginCollapse.cpp:
1384         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough const):
1385         * layout/floats/FloatingContext.h:
1386         (WebCore::Layout::FloatingContext::root const):
1387         * layout/floats/FloatingState.cpp:
1388         (WebCore::Layout::FloatingState::FloatingState):
1389         (WebCore::Layout::FloatingState::bottom const):
1390         (WebCore::Layout::FloatingState::top const):
1391         * layout/floats/FloatingState.h:
1392         (WebCore::Layout::FloatingState::create):
1393         (WebCore::Layout::FloatingState::root const):
1394         (WebCore::Layout::FloatingState::leftBottom const):
1395         (WebCore::Layout::FloatingState::rightBottom const):
1396         (WebCore::Layout::FloatingState::bottom const):
1397         (WebCore::Layout::FloatingState::FloatItem::isDescendantOfFormattingRoot const):
1398         * layout/inlineformatting/InlineFormattingContext.cpp:
1399         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
1400         (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
1401         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
1402         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot):
1403         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot):
1404         (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
1405         * layout/inlineformatting/InlineFormattingContext.h:
1406         (WebCore::Layout::InlineFormattingContext::InlineLayout::formattingRoot const):
1407         * layout/inlineformatting/InlineFormattingContextQuirks.cpp:
1408         (WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const):
1409         * layout/inlineformatting/InlineLine.cpp:
1410         (WebCore::Layout::Line::close):
1411         (WebCore::Layout::Line::adjustBaselineAndLineHeight):
1412         * layout/tableformatting/TableFormattingContext.cpp:
1413         (WebCore::Layout::TableFormattingContext::TableFormattingContext):
1414         (WebCore::Layout::TableFormattingContext::layoutTableCellBox):
1415         (WebCore::Layout::TableFormattingContext::setComputedGeometryForSections):
1416         (WebCore::Layout::TableFormattingContext::ensureTableGrid):
1417         (WebCore::Layout::TableFormattingContext::computePreferredWidthForColumns):
1418         * layout/tableformatting/TableFormattingContext.h:
1419
1420 2019-09-13  Ali Juma  <ajuma@chromium.org>
1421
1422         IntersectionObserverEntry#intersectionRatio can be larger than 1
1423         https://bugs.webkit.org/show_bug.cgi?id=200776
1424
1425         Reviewed by Simon Fraser.
1426
1427         When computing the intersection between a target and an intersection observer's 
1428         root, RenderBox::computeVisibleRectInContainer is used to map the target rect
1429         up the containing block chain, clipping along the way. When a RenderBox has
1430         a transform, this method expands the given rect to the enclosing rect in device
1431         pixels. This is fine for the use case of computing an invalidation rect, but for
1432         the intersection observer use case it means that it is possible for the computed
1433         intersection rect to be slightly larger than the original target rect, resulting
1434         in an intersection ratio greater than 1.
1435
1436         Fix this by performing a final intersection between the intersection rect as
1437         computed above and the target rect.
1438
1439         Test: intersection-observer/intersection-clipped-to-target.html
1440
1441         * dom/Document.cpp:
1442         (WebCore::computeIntersectionState):
1443
1444 2019-09-13  Nikolas Zimmermann  <zimmermann@kde.org>
1445
1446         SMIL animations of SVG <view> element have no effect
1447         https://bugs.webkit.org/show_bug.cgi?id=94469
1448
1449         Reviewed by Said Abou-Hallawa.
1450
1451         SMIL animations of the attributes associated with SVGViewElement work fine, but without any
1452         visual effect. When loading an SVG document with a given fragment identifier
1453         (e.g. test.svg#customView) where 'customView' references to an embedded SVGViewElement, the
1454         viewBox/preserveAspectRatio settings should be taken from the SVGViewElement. Currently
1455         there is no link between the SVGViewElement and the SVGSVGElement. The settings from the
1456         SVGViewElement are only pasrsed onco in SVGSVGElement::scrollToFragment(). Dynamic updates
1457         of the 'viewBox' and 'preserveAspectRatio' attributes of the SVGViewElement thus have no
1458         visual effect, since the SVGSVGElement does not re-evaluates its viewBox.
1459
1460         Store a RefPtr to the currently used SVGViewElement in SVGSVGElement, and a WeakPtr back
1461         to the SVGSVGElement that currently references the SVGViewElement. This allows us to
1462         propagate SVGViewElement attribute changes to SVGSVGElement and re-evaluate the viewBox
1463         stored in SVGSVGElement and trigger visual updates.
1464
1465         Tests: svg/custom/animation-on-view-element.html
1466                svg/custom/multiple-view-elements.html
1467
1468         * svg/SVGSVGElement.cpp:
1469         (WebCore::SVGSVGElement::scrollToFragment):
1470         * svg/SVGSVGElement.h:
1471         * svg/SVGViewElement.cpp:
1472         (WebCore::SVGViewElement::svgAttributeChanged): Add missing implementation, tracked by
1473         webkit.org/b/196554. Correctly handle SVGFitToViewBox property changes. Update the viewBox
1474         stored in the SVGSVGElement, that references the SVGViewElement. Afterwards invalidate the
1475         renderer associated with the SVGSVGElement, which properly triggers visual updates.
1476         * svg/SVGViewElement.h:
1477
1478 2019-09-13  Brent Fulgham  <bfulgham@apple.com>
1479
1480         [FTW] ImageBuffer/ImageBufferData is highly inefficient
1481         https://bugs.webkit.org/show_bug.cgi?id=201594
1482
1483         Reviewed by Said Abou-Hallawa.
1484
1485         My initial implementation of ImageBuffer and ImageBufferData for Direct2D involves too
1486         much moving of data from GPU to CPU and back. We only need to make a renderable version
1487         of the ImageBuffer when ImageBuffer::sinkIntoNativeImage or ImageBuffer::copyNativeImage
1488         are called.
1489
1490         Currently, each ImageBuffer putData operation uploads the data to the GPU, and each
1491         ImageBuffer getData pulls the data from the GPU.
1492
1493         This patch does the following:
1494
1495         1. It makes the assumption that the ID2D1Bitmap it holds is under its control (i.e.,
1496            external draw operations do not manipulate the bitmap without marking it dirty).
1497         2. It holds a CPU copy of the data from the ID2D1Bitmap originally used to create it.
1498            It uses this data for all manipulations, and uploads to the bitmap only when
1499            an ID2D1Bitmap is requested for drawing, and before a drawing operation is performed
1500            on the associated ImageBuffer context.
1501         3. It does not read back from the ID2D1Bitmap unless it is told that it is dirty.
1502         4. It does not call 'ID2D1RenderTarget::SetTags' if ASSERTS are disabled because
1503            they are costly, and don't help in release builds.
1504  
1505         * platform/graphics/win/Direct2DOperations.cpp:
1506         (WebCore::Direct2D::fillRect): Use new 'setTags' method.
1507         (WebCore::Direct2D::fillRoundedRect): Ditto.
1508         (WebCore::Direct2D::fillRectWithRoundedHole): Ditto.
1509         (WebCore::Direct2D::fillRectWithGradient): Ditto.
1510         (WebCore::Direct2D::fillPath): Ditto.
1511         (WebCore::Direct2D::strokeRect): Ditto.
1512         (WebCore::Direct2D::strokePath): Ditto.
1513         (WebCore::Direct2D::drawPath): Ditto.
1514         (WebCore::Direct2D::drawWithShadow): Notify observers before and after we drew.
1515         (WebCore::Direct2D::drawWithoutShadow): Ditto.
1516         (WebCore::Direct2D::clearRect): Use new 'setTags' method.
1517         (WebCore::Direct2D::drawGlyphs): Ditto.
1518         (WebCore::Direct2D::drawNativeImage): Ditto.
1519         (WebCore::Direct2D::drawRect): Ditto.
1520         (WebCore::Direct2D::drawLine): Ditto.
1521         (WebCore::Direct2D::fillEllipse): Ditto.
1522         (WebCore::Direct2D::drawEllipse): Ditto.
1523         (WebCore::Direct2D::flush): Notify observer after we drew.
1524         * platform/graphics/win/GradientDirect2D.cpp:
1525         (WebCore::Gradient::fill): Don't call SetTags in non-ASSERT builds.
1526         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
1527         (WebCore::ImageBufferData::ensureBackingStore const): Added.
1528         (WebCore::ImageBufferData::getData const): Only read from the GPU if the in-memory
1529         store is empty or out-of-sync.
1530         (WebCore::ImageBufferData::putData): Mark the bitmap as out-of-sync, but don't
1531         upload the data yet.
1532         (WebCore::ImageBufferData::loadDataToBitmapIfNeeded): Helper function to upload data to the GPU.
1533         (WebCore::ImageBufferData::compatibleBitmap): Only upload data if the relevant
1534         bitmap is out of date.
1535         * platform/graphics/win/ImageBufferDataDirect2D.h:
1536         * platform/graphics/win/ImageBufferDirect2D.cpp:
1537         (WebCore::ImageBuffer::ImageBuffer): Update constructor to register the ImageBufferData
1538         lambdas as observer for draw operations.
1539         * platform/graphics/win/PlatformContextDirect2D.cpp:
1540         (WebCore::PlatformContextDirect2D::PlatformContextDirect2D): Update constructor to accept
1541         lambdas to run before and after draw operations.
1542         (WebCore::PlatformContextDirect2D::setTags): Added.
1543         (WebCore::PlatformContextDirect2D::notifyPreDrawObserver): Added.
1544         (WebCore::PlatformContextDirect2D::notifyPostDrawObserver): Added.
1545         * platform/graphics/win/PlatformContextDirect2D.h:
1546         (WebCore::PlatformContextDirect2D::PlatformContextDirect2D):
1547
1548 2019-09-13  Russell Epstein  <repstein@apple.com>
1549
1550         Unreviewed, rolling out r249709.
1551
1552         Layout test added in this patch has been consistently failing
1553         since it landed.
1554
1555         Reverted changeset:
1556
1557         "Option + arrow moves caret past whitespace on iOS"
1558         https://bugs.webkit.org/show_bug.cgi?id=201575
1559         https://trac.webkit.org/changeset/249709
1560
1561 2019-09-13  Zalan Bujtas  <zalan@apple.com>
1562
1563         [LFC] Rename FormattingContext::layout to layoutInFlowContent()
1564         https://bugs.webkit.org/show_bug.cgi?id=201763
1565         <rdar://problem/55340435>
1566
1567         Reviewed by Antti Koivisto.
1568
1569         FormattingContext::layout() only takes care of the inflow content. Out-out-flow boxes are laid out through FormattingContext::layoutOutOfFlowContent.
1570
1571         * layout/FormattingContext.cpp:
1572         (WebCore::Layout::FormattingContext::layoutOutOfFlowContent):
1573         * layout/FormattingContext.h:
1574         * layout/LayoutState.cpp:
1575         (WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
1576         * layout/blockformatting/BlockFormattingContext.cpp:
1577         (WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
1578         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot):
1579         (WebCore::Layout::BlockFormattingContext::layout): Deleted.
1580         * layout/blockformatting/BlockFormattingContext.h:
1581         * layout/inlineformatting/InlineFormattingContext.cpp:
1582         (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
1583         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot):
1584         (WebCore::Layout::InlineFormattingContext::layout): Deleted.
1585         * layout/inlineformatting/InlineFormattingContext.h:
1586         * layout/tableformatting/TableFormattingContext.cpp:
1587         (WebCore::Layout::TableFormattingContext::layoutInFlowContent):
1588         (WebCore::Layout::TableFormattingContext::layoutTableCellBox):
1589         (WebCore::Layout::TableFormattingContext::layout): Deleted.
1590         * layout/tableformatting/TableFormattingContext.h:
1591
1592 2019-09-13  Zalan Bujtas  <zalan@apple.com>
1593
1594         [LFC] FormattingContext::displayBoxForLayoutBox should be split into 2 functions
1595         https://bugs.webkit.org/show_bug.cgi?id=201754
1596         <rdar://problem/55328753>
1597
1598         Reviewed by Antti Koivisto.
1599
1600         1. FormattingContext::geometryForBox() returns a const Display::Box. Use this function to access
1601         already computed geometry such as the containing block's content box width.
1602         This function can escape the current formatting context in certain cases and read geometry from parent/ancestor formatting contexts. 
1603         2. FormattingState::displayBox() returns a non-const version of the Display::Box. Use this function to
1604         create/get the display box of a particular layout box to set computed values. This call should never escape the
1605         current formatting context (as no one should mutate ancestor boxes).
1606         
1607         Normally while laying out a particular box, we need to collect some geometry information from other boxes in the tree like previous sibling, containing block.
1608         <div style="width: 100px"><div></div></div> <- the inner div's used width is based on the outer div's width. 
1609         However we should never mutate the geometry information on those other boxes (outer div). This patch helps avoiding accidental mutation on ancestors by
1610         returning a const version of the Display::Box.  
1611
1612         * layout/FormattingContext.cpp:
1613         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
1614         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry):
1615         (WebCore::Layout::FormattingContext::computeBorderAndPadding):
1616         (WebCore::Layout::mapHorizontalPositionToAncestor):
1617         (WebCore::Layout::FormattingContext::mapTopToFormattingContextRoot const):
1618         (WebCore::Layout::FormattingContext::mapLeftToFormattingContextRoot const):
1619         (WebCore::Layout::FormattingContext::mapRightToFormattingContextRoot const):
1620         (WebCore::Layout::FormattingContext::geometryForBox const):
1621         (WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const):
1622         (WebCore::Layout::FormattingContext::displayBoxForLayoutBox const): Deleted.
1623         * layout/FormattingContext.h:
1624         (WebCore::Layout::FormattingContext::hasDisplayBox const): Deleted.
1625         * layout/FormattingContextGeometry.cpp:
1626         (WebCore::Layout::FormattingContext::Geometry::computedHeightValue const):
1627         (WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const):
1628         (WebCore::Layout::FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned const):
1629         (WebCore::Layout::FormattingContext::Geometry::staticHorizontalPositionForOutOfFlowPositioned const):
1630         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry const):
1631         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1632         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry const):
1633         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry const):
1634         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin const):
1635         (WebCore::Layout::FormattingContext::Geometry::inFlowPositionedPositionOffset const):
1636         * layout/FormattingContextQuirks.cpp:
1637         (WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight):
1638         * layout/FormattingState.cpp:
1639         (WebCore::Layout::FormattingState::displayBox const):
1640         * layout/FormattingState.h:
1641         * layout/blockformatting/BlockFormattingContext.cpp:
1642         (WebCore::Layout::BlockFormattingContext::usedAvailableWidthForFloatAvoider const):
1643         (WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren):
1644         (WebCore::Layout::BlockFormattingContext::computeStaticVerticalPosition):
1645         (WebCore::Layout::BlockFormattingContext::computeStaticHorizontalPosition):
1646         (WebCore::Layout::BlockFormattingContext::computeEstimatedVerticalPosition):
1647         (WebCore::Layout::BlockFormattingContext::computeEstimatedVerticalPositionForFloatClear):
1648         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition):
1649         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats):
1650         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin):
1651         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
1652         (WebCore::Layout::BlockFormattingContext::verticalPositionWithMargin const):
1653         * layout/blockformatting/BlockFormattingContext.h:
1654         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1655         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1656         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin const):
1657         (WebCore::Layout::BlockFormattingContext::Geometry::staticVerticalPosition const):
1658         (WebCore::Layout::BlockFormattingContext::Geometry::staticHorizontalPosition const):
1659         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1660         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
1661         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
1662         * layout/blockformatting/BlockMarginCollapse.cpp:
1663         (WebCore::Layout::BlockFormattingContext::MarginCollapse::hasClearance const):
1664         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore const):
1665         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSiblingMarginAfter const):
1666         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithFirstInFlowChildMarginBefore const):
1667         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance const):
1668         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter const):
1669         (WebCore::Layout::BlockFormattingContext::MarginCollapse::updateMarginAfterForPreviousSibling const):
1670         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues):
1671         (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
1672         (WebCore::Layout::BlockFormattingContext::MarginCollapse::updatePositiveNegativeMarginValues):
1673         (WebCore::Layout::hasClearance): Deleted.
1674         * layout/floats/FloatingContext.cpp:
1675         (WebCore::Layout::FloatingContext::positionForFloat const):
1676         (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
1677         (WebCore::Layout::FloatingContext::absoluteDisplayBoxCoordinates const):
1678         (WebCore::Layout::FloatingContext::mapToFloatingStateRoot const):
1679         (WebCore::Layout::FloatingContext::mapTopToFloatingStateRoot const):
1680         (WebCore::Layout::FloatingContext::mapPointFromFormattingContextRootToFloatingStateRoot const):
1681         * layout/inlineformatting/InlineFormattingContext.cpp:
1682         (WebCore::Layout::InlineFormattingContext::layout):
1683         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
1684         (WebCore::Layout::InlineFormattingContext::initializeMarginBorderAndPaddingForGenericInlineBox):
1685         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPaddingForInlineContainer):
1686         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot):
1687         (WebCore::Layout::InlineFormattingContext::computeHorizontalMargin):
1688         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin):
1689         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin):
1690         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot):
1691         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
1692         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin const):
1693         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
1694         (WebCore::Layout::inlineItemWidth):
1695         (WebCore::Layout::LineLayout::placeInlineItem):
1696         (WebCore::Layout::InlineFormattingContext::InlineLayout::layout const):
1697         (WebCore::Layout::InlineFormattingContext::InlineLayout::computedIntrinsicWidth const):
1698         (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns const):
1699         * layout/inlineformatting/InlineFormattingContextQuirks.cpp:
1700         (WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const):
1701         * layout/inlineformatting/InlineLine.cpp:
1702         (WebCore::Layout::isInlineContainerConsideredEmpty):
1703         (WebCore::Layout::Line::isVisuallyEmpty const):
1704         (WebCore::Layout::Line::close):
1705         (WebCore::Layout::Line::appendNonReplacedInlineBox):
1706         (WebCore::Layout::Line::inlineItemContentHeight const):
1707         * layout/tableformatting/TableFormattingContext.cpp:
1708         (WebCore::Layout::TableFormattingContext::layout):
1709         (WebCore::Layout::TableFormattingContext::layoutTableCellBox):
1710         (WebCore::Layout::TableFormattingContext::positionTableCells):
1711         (WebCore::Layout::TableFormattingContext::setComputedGeometryForRows):
1712         (WebCore::Layout::TableFormattingContext::setComputedGeometryForSections):
1713         (WebCore::Layout::TableFormattingContext::computedTableWidth):
1714
1715 2019-09-13  Youenn Fablet  <youenn@apple.com>
1716
1717         Use WebProcess processIdentifier to identify Service Worker connections
1718         https://bugs.webkit.org/show_bug.cgi?id=201459
1719
1720         Reviewed by Chris Dumez.
1721
1722         No observable change of behavior.
1723
1724         * workers/service/ServiceWorkerClient.cpp:
1725         (WebCore::ServiceWorkerClient::postMessage):
1726         Pass sessionID to ease NetworkProcess selection of the client process connection.
1727         * workers/service/ServiceWorkerTypes.h:
1728         Mark server connection identifier be process identifier based.
1729         * workers/service/context/SWContextManager.h:
1730         * workers/service/server/SWServer.cpp:
1731         (WebCore::SWServer::Connection::Connection):
1732         * workers/service/server/SWServer.h:
1733         Let connection identifier be set in constructor instead of generated.
1734
1735 2019-09-13  Adrian Perez de Castro  <aperez@igalia.com>
1736
1737         Factor out duplicated functions from HTTPParsers.cpp and HTTPHeaderField.cpp
1738         https://bugs.webkit.org/show_bug.cgi?id=201721
1739
1740         Reviewed by Don Olmstead.
1741
1742         No new tests needed.
1743
1744         * loader/HTTPHeaderField.cpp: Remove "static" from prototypes of functions needed in HTTPParsers.cpp.
1745         (WebCore::RFC7230::isDelimiter):
1746         (WebCore::RFC7230::isQuotedPairSecondOctet):
1747         (WebCore::RFC7230::isCommentText):
1748         * loader/HTTPHeaderField.h: Add prototypes of functions needed in HTTPParsers.cpp.
1749         * platform/network/HTTPParsers.cpp: Use functionality from WebCore::RFC7230 where possible.
1750         (WebCore::skipWhile): Moved to allow implementing skipWhiteSpace() in terms of skipWhile().
1751         (WebCore::skipWhiteSpace): Implement using skipWhile() and the RFC7230::isWhitespace() predicate.
1752         (WebCore::isValidAcceptHeaderValue): Replace usage of isDelimiterCharacter() with RFC7230::isDelimiter().
1753         (WebCore::isValidHTTPToken): Replace usage of isHTTPTokenCharacter() with RFC7230::isTokenCharacter().
1754         (WebCore::skipQuotedPair): Partially reimplement in terms of RFC7230::isQuotedPairSecondOctet().
1755         (WebCore::skipComment): Replace usage of isCommentTextCharacter() with RFC7230::isCommentText().
1756         (WebCore::skipHTTPToken): Replace usage of isHTTPTokenCharacter() with RFC7230::isTokenCharacter().
1757
1758 2019-09-12  Zan Dobersek  <zdobersek@igalia.com>
1759
1760         Unreviewed debug build fix for GLib-based ports.
1761
1762         * platform/glib/UserAgentGLib.cpp: Add the HTTPParsers.h header
1763         inclusion to bring in the isValidUserAgentHeaderValue() declaration as
1764         required for an assertion check.
1765
1766 2019-09-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
1767
1768         SVGLengthValue should use two enums for 'type' and 'mode' instead of one unsigned for 'units'
1769         https://bugs.webkit.org/show_bug.cgi?id=201663
1770
1771         Reviewed by Simon Fraser, Nikolas Zimmermann.
1772
1773         SVGLengthValue had one unsigned to store SVGLengthMode and SVGLengthType.
1774         It used to allocate the least significant 4 bits of this unsigned to the
1775         SVGLengthMode while it leaves the rest for SVGLengthType.
1776
1777         This will not be needed if SVGLengthMode and SVGLengthType are made of
1778         size uint_8.
1779
1780         Also in this patch:
1781
1782         -- SVGLengthNegativeValuesMode is made enum class.
1783
1784         -- SVGLengthValue::blend() is moved to SVGLengthValue.cpp so we do not
1785            need to include SVGLengthContext.h in SVGLengthValue.h.
1786
1787         -- SVGLengthType and SVGLengthMode are moved to SVGLengthValue.h. Instead
1788            of having SVGLengthValue.h includes SVGLengthConttext.h, the opposite
1789            will happen.
1790
1791         -- SVGAnimatedPropertyDescription.h is deleted. It should have been deleted
1792            with the SVG tear off objects removal.
1793
1794         -- SVGPropertyTraits<SVGAngleValue> and SVGPropertyTraits<SVGLengthValue>
1795            are deleted. They should have been deleted with SVGAnimatedType removal.
1796
1797         -- SVGLengthValue::lengthModeForAnimatedLengthAttribute() is deleted. It
1798            was only called from SVGPropertyTraits<SVGLengthValue>.
1799
1800         * WebCore.xcodeproj/project.pbxproj:
1801         * css/StyleResolver.h:
1802         * page/animation/CSSPropertyAnimation.cpp:
1803         (WebCore::blendFunc):
1804         * rendering/style/SVGRenderStyle.h:
1805         (WebCore::SVGRenderStyle::initialBaselineShiftValue):
1806         (WebCore::SVGRenderStyle::initialKerning):
1807         * rendering/svg/RenderSVGEllipse.cpp:
1808         (WebCore::RenderSVGEllipse::calculateRadiiAndCenter):
1809         * rendering/svg/RenderSVGRect.cpp:
1810         (WebCore::RenderSVGRect::updateShapeFromElement):
1811         * rendering/svg/SVGPathData.cpp:
1812         (WebCore::pathFromCircleElement):
1813         (WebCore::pathFromEllipseElement):
1814         (WebCore::pathFromRectElement):
1815         * rendering/svg/SVGTextLayoutEngineBaseline.cpp:
1816         (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift const):
1817         * rendering/svg/SVGTextLayoutEngineSpacing.cpp:
1818         (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing):
1819         * svg/LinearGradientAttributes.h:
1820         (WebCore::LinearGradientAttributes::LinearGradientAttributes):
1821         * svg/RadialGradientAttributes.h:
1822         (WebCore::RadialGradientAttributes::RadialGradientAttributes):
1823         * svg/SVGAngleValue.h:
1824         (WebCore::SVGPropertyTraits<SVGAngleValue>::initialValue): Deleted.
1825         (WebCore::SVGPropertyTraits<SVGAngleValue>::toString): Deleted.
1826         * svg/SVGCircleElement.cpp:
1827         (WebCore::SVGCircleElement::parseAttribute):
1828         * svg/SVGCircleElement.h:
1829         * svg/SVGCursorElement.cpp:
1830         (WebCore::SVGCursorElement::parseAttribute):
1831         * svg/SVGCursorElement.h:
1832         * svg/SVGEllipseElement.cpp:
1833         (WebCore::SVGEllipseElement::parseAttribute):
1834         * svg/SVGEllipseElement.h:
1835         * svg/SVGFilterElement.cpp:
1836         (WebCore::SVGFilterElement::parseAttribute):
1837         * svg/SVGFilterElement.h:
1838         * svg/SVGFilterPrimitiveStandardAttributes.cpp:
1839         (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute):
1840         * svg/SVGFilterPrimitiveStandardAttributes.h:
1841         * svg/SVGForeignObjectElement.cpp:
1842         (WebCore::SVGForeignObjectElement::parseAttribute):
1843         * svg/SVGForeignObjectElement.h:
1844         * svg/SVGImageElement.cpp:
1845         (WebCore::SVGImageElement::parseAttribute):
1846         * svg/SVGImageElement.h:
1847         * svg/SVGLength.h:
1848         (WebCore::SVGLength::unitType const):
1849         (WebCore::SVGLength::setValueForBindings):
1850         (WebCore::SVGLength::newValueSpecifiedUnits):
1851         (WebCore::SVGLength::convertToSpecifiedUnits):
1852         (WebCore::SVGLength::unitType): Deleted.
1853         * svg/SVGLengthContext.cpp:
1854         (WebCore::SVGLengthContext::valueForLength):
1855         (WebCore::SVGLengthContext::convertValueToUserUnits const):
1856         (WebCore::SVGLengthContext::convertValueFromUserUnits const):
1857         (WebCore::SVGLengthContext::convertValueFromUserUnitsToPercentage const):
1858         (WebCore::SVGLengthContext::convertValueFromPercentageToUserUnits const):
1859         * svg/SVGLengthContext.h:
1860         (): Deleted.
1861         * svg/SVGLengthList.h:
1862         (WebCore::SVGLengthList::create):
1863         * svg/SVGLengthValue.cpp:
1864         (WebCore::lengthTypeToString):
1865         (WebCore::parseLengthType):
1866         (WebCore::primitiveTypeToLengthType):
1867         (WebCore::lengthTypeToPrimitiveType):
1868         (WebCore::SVGLengthValue::SVGLengthValue):
1869         (WebCore::SVGLengthValue::construct):
1870         (WebCore::SVGLengthValue::blend):
1871         (WebCore::SVGLengthValue::fromCSSPrimitiveValue):
1872         (WebCore::SVGLengthValue::toCSSPrimitiveValue):
1873         (WebCore::SVGLengthValue::setValueAsString):
1874         (WebCore::SVGLengthValue::valueAsString const):
1875         (WebCore::SVGLengthValue::valueForBindings const):
1876         (WebCore::SVGLengthValue::setValue):
1877         (WebCore::SVGLengthValue::convertToSpecifiedUnits):
1878         (WebCore::storeUnit): Deleted.
1879         (WebCore::extractMode): Deleted.
1880         (WebCore::extractType): Deleted.
1881         (WebCore::SVGLengthValue::operator== const): Deleted.
1882         (WebCore::SVGLengthValue::operator!= const): Deleted.
1883         (WebCore::SVGLengthValue::unitType const): Deleted.
1884         (WebCore::SVGLengthValue::unitMode const): Deleted.
1885         (WebCore::SVGLengthValue::valueAsPercentage const): Deleted.
1886         (WebCore::SVGLengthValue::newValueSpecifiedUnits): Deleted.
1887         (WebCore::SVGLengthValue::lengthModeForAnimatedLengthAttribute): Deleted.
1888         * svg/SVGLengthValue.h:
1889         (WebCore::SVGLengthValue::lengthType const):
1890         (WebCore::SVGLengthValue::lengthMode const):
1891         (WebCore::SVGLengthValue::isZero const):
1892         (WebCore::SVGLengthValue::isRelative const):
1893         (WebCore::SVGLengthValue::valueAsPercentage const):
1894         (WebCore::SVGLengthValue::valueInSpecifiedUnits const):
1895         (WebCore::operator==):
1896         (WebCore::operator!=):
1897         (WebCore::SVGLengthValue::blend const): Deleted.
1898         (WebCore::SVGPropertyTraits<SVGLengthValue>::initialValue): Deleted.
1899         (WebCore::SVGPropertyTraits<SVGLengthValue>::parse): Deleted.
1900         (WebCore::SVGPropertyTraits<SVGLengthValue>::toString): Deleted.
1901         * svg/SVGLineElement.cpp:
1902         (WebCore::SVGLineElement::parseAttribute):
1903         * svg/SVGLineElement.h:
1904         * svg/SVGLinearGradientElement.cpp:
1905         (WebCore::SVGLinearGradientElement::parseAttribute):
1906         * svg/SVGLinearGradientElement.h:
1907         * svg/SVGMarkerElement.cpp:
1908         (WebCore::SVGMarkerElement::parseAttribute):
1909         * svg/SVGMarkerElement.h:
1910         * svg/SVGMaskElement.cpp:
1911         (WebCore::SVGMaskElement::parseAttribute):
1912         * svg/SVGMaskElement.h:
1913         * svg/SVGPatternElement.cpp:
1914         (WebCore::SVGPatternElement::parseAttribute):
1915         * svg/SVGPatternElement.h:
1916         * svg/SVGRadialGradientElement.cpp:
1917         (WebCore::SVGRadialGradientElement::parseAttribute):
1918         * svg/SVGRadialGradientElement.h:
1919         * svg/SVGRectElement.cpp:
1920         (WebCore::SVGRectElement::parseAttribute):
1921         * svg/SVGRectElement.h:
1922         * svg/SVGSVGElement.cpp:
1923         (WebCore::SVGSVGElement::parseAttribute):
1924         (WebCore::SVGSVGElement::hasIntrinsicWidth const):
1925         (WebCore::SVGSVGElement::hasIntrinsicHeight const):
1926         (WebCore::SVGSVGElement::intrinsicWidth const):
1927         (WebCore::SVGSVGElement::intrinsicHeight const):
1928         * svg/SVGSVGElement.h:
1929         * svg/SVGTextContentElement.cpp:
1930         (WebCore::SVGTextContentElement::parseAttribute):
1931         (WebCore::SVGTextContentElement::textLengthAnimated):
1932         * svg/SVGTextContentElement.h:
1933         * svg/SVGTextPathElement.cpp:
1934         (WebCore::SVGTextPathElement::parseAttribute):
1935         * svg/SVGTextPathElement.h:
1936         * svg/SVGTextPositioningElement.h:
1937         * svg/SVGUseElement.cpp:
1938         (WebCore::SVGUseElement::parseAttribute):
1939         * svg/SVGUseElement.h:
1940         * svg/properties/SVGAnimatedPropertyAccessorImpl.h:
1941         * svg/properties/SVGAnimatedPropertyDescription.h: Removed.
1942         * svg/properties/SVGAnimationAdditiveListFunctionImpl.h:
1943         (WebCore::SVGAnimationLengthListFunction::animate):
1944         * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
1945         (WebCore::SVGAnimationLengthFunction::animate):
1946         * svg/properties/SVGValuePropertyAnimatorImpl.h:
1947         * svg/properties/SVGValuePropertyListAnimatorImpl.h:
1948
1949 2019-09-12  Chris Dumez  <cdumez@apple.com>
1950
1951         Node.replaceChild()'s pre-replacement validations are not done in the right order
1952         https://bugs.webkit.org/show_bug.cgi?id=201741
1953
1954         Reviewed by Geoffrey Garen.
1955
1956         Node.replaceChild()'s pre-replacement validations are not done in the right order (spec order):
1957         - https://dom.spec.whatwg.org/#concept-node-replace
1958
1959         In particular, we do not do check 3 (If child’s parent is not parent, then throw a
1960         "NotFoundError" DOMException.) at the right time, because we were making this check
1961         *after* checkPreReplacementValidity(), instead of *during*.
1962
1963         No new tests, rebaselined existing test.
1964
1965         * dom/ContainerNode.cpp:
1966         (WebCore::checkAcceptChild):
1967         (WebCore::ContainerNode::ensurePreInsertionValidity):
1968         (WebCore::checkPreReplacementValidity):
1969         (WebCore::ContainerNode::replaceChild):
1970
1971 2019-09-12  Ryan Haddad  <ryanhaddad@apple.com>
1972
1973         Unreviewed, rolling out r249801.
1974
1975         Caused two servier worker layout tests to become flaky.
1976
1977         Reverted changeset:
1978
1979         "Use WebProcess processIdentifier to identify Service Worker
1980         connections"
1981         https://bugs.webkit.org/show_bug.cgi?id=201459
1982         https://trac.webkit.org/changeset/249801
1983
1984 2019-09-12  Chris Dumez  <cdumez@apple.com>
1985
1986         [WKTR] Drop TestRunner.setPrivateBrowsingEnabled_DEPRECATED()
1987         https://bugs.webkit.org/show_bug.cgi?id=201546
1988
1989         Reviewed by Alex Christensen.
1990
1991         Drop TestRunner.setPrivateBrowsingEnabled_DEPRECATED() from WebKitTestRunner as it does not do
1992         the right thing for WebKit2 and tests have been rewritten to not use it.
1993
1994         * page/PageGroup.cpp:
1995         (WebCore::PageGroup::addPage):
1996         (WebCore::PageGroup::setSessionIDForTesting): Deleted.
1997         * page/PageGroup.h:
1998         (): Deleted.
1999
2000 2019-09-12  Saam Barati  <sbarati@apple.com>
2001
2002         [WHLSL] Slim down WSLMatrix and inline constructors in native code
2003         https://bugs.webkit.org/show_bug.cgi?id=201568
2004
2005         Reviewed by Robin Morisset.
2006
2007         Before, our WSL Matrix in MSL had templates to figure out how we're 
2008         constructing it. For example, with a list of elements, or a list of
2009         columns. However, we can remove this template code since when we're
2010         emitting Metal code, we know exactly how we're constructing the WSL
2011         matrix. So the NativeFunctionWriter now inlines the proper stores
2012         into the WSLMatrix elements.
2013         
2014         This patch speeds up Metal compile times in boids by ~4ms (16%) with
2015         a p-value of 0.0001.
2016
2017         Covered by existing tests.
2018
2019         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp:
2020         (WebCore::WHLSL::Metal::metalCodePrologue):
2021         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
2022         (WebCore::WHLSL::Metal::inlineNativeFunction):
2023
2024 2019-09-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2025
2026         [Cocoa] Text indicator for an image link on the front page of apple.com looks wrong
2027         https://bugs.webkit.org/show_bug.cgi?id=201724
2028         <rdar://problem/54622894>
2029
2030         Reviewed by Tim Horton.
2031
2032         When computing the bounds of the range (<a>, 0) to (<a>, 1) for a text indicator snapshot where <a> is a link
2033         with a single non-breaking whitespace character, we currently use the text rect of the single space. This leads
2034         to a confusing text indicator, as the resulting snapshot is a tiny blank square in the top left corner of the
2035         link. This problem manifests when starting a drag or showing the system context menu on iOS, or force clicking
2036         or three-finger tapping to show a preview on macOS.
2037
2038         To address this scenario, tweak the heuristic in the case where the text indicator option
2039         TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges is specified, such that we consider a range
2040         containing only text with whitespaces to be "complex"; additionally, instead of falling back to the range's
2041         bounding rect (which in this case is still tiny), fall back to the common ancestor container's bounding rect,
2042         which encompasses not only the text inside the range but also the element containing the range (in this case,
2043         the anchor element).
2044
2045         Test: fast/text-indicator/text-indicator-empty-link.html
2046
2047         * page/TextIndicator.cpp:
2048         (WebCore::containsOnlyWhiteSpaceText):
2049
2050         Add a helper to determine whether a Range is comprised only of rendered text that only contains whitespace
2051         characters.
2052
2053         (WebCore::initializeIndicator):
2054
2055         See ChangeLog entry above for more detail.
2056
2057 2019-09-12  Brady Eidson  <beidson@apple.com>
2058
2059         PDF exporting on iOS should include URL rects.
2060         <rdar://problem/54900133> and https://bugs.webkit.org/show_bug.cgi?id=201693
2061
2062         Reviewed by Tim Horton.
2063
2064         Turns out that PDF exporting on iOS works fine.
2065
2066         Tracking back through history it was disabled at least pre-2014.
2067
2068         It was almost certainly disabled because it didn't work way back then,
2069         but it works great now.
2070
2071         * platform/graphics/cg/GraphicsContextCG.cpp:
2072         (WebCore::GraphicsContext::setURLForRect): Remove the iOS platform exclusion.
2073
2074 2019-09-12  Adrian Perez de Castro  <aperez@igalia.com>
2075
2076         [GTK][WPE] webkit_settings_set_user_agent() allows content forbidden in HTTP headers
2077         https://bugs.webkit.org/show_bug.cgi?id=201077
2078
2079         Reviewed by Carlos Garcia Campos.
2080
2081         Add a function to validate whether a string contains a valid value
2082         which can be used in a HTTP User-Agent header.
2083
2084         Covered by new WebCore API test HTTPParsers.ValidateUserAgentValues.
2085
2086         * platform/glib/UserAgentGLib.cpp:
2087         (WebCore::standardUserAgent): Assert that the returned string is a valid User-Agent.
2088         (WebCore::standardUserAgentForURL): Ditto.
2089         * platform/network/HTTPParsers.cpp: Added a series of helper functions which skip over
2090         characters of a string, which can be used to scan over the different elements of an
2091         User-Agent value; all of them receive the position from the input string where to start
2092         scanning, updating it to the position right after the scanned item (this follow the
2093         convention already in use by other functions in the source file). Each of them has
2094         been annotated with the RFC number and section which contains the definition of the
2095         scanned item, and the corresponding BNF rules to make the code easier to follow.
2096         (WebCore::skipWhile): Added.
2097         (WebCore::isVisibleCharacter): Added.
2098         (WebCore::isOctectInFieldContentCharacter): Added.
2099         (WebCore::isCommentTextCharacter): Added.
2100         (WebCore::isHTTPTokenCharacter): Added.
2101         (WebCore::isValidHTTPToken): Refactored to use the new isHTTPTokenCharacter()
2102         helper function instead of having the test inside the loop.
2103         (WebCore::skipCharacter): Added.
2104         (WebCore::skipQuotedPair): Added.
2105         (WebCore::skipComment): Added.
2106         (WebCore::skipHTTPToken): Added.
2107         (WebCore::skipUserAgentProduct): Added.
2108         (WebCore::isValidUserAgentHeaderValue): Added.
2109         * platform/network/HTTPParsers.h: Add prototype for isValidUserAgentHeaderValue().
2110
2111 2019-09-12  Mark Lam  <mark.lam@apple.com>
2112
2113         Harden JSC against the abuse of runtime options.
2114         https://bugs.webkit.org/show_bug.cgi?id=201597
2115         <rdar://problem/55167068>
2116
2117         Reviewed by Filip Pizlo.
2118
2119         No new tests.  Covered by existing tests.
2120
2121         Enable Options::useDollarVM before we tell the JSGlobalObject to exposeDollarVM().
2122         The $vm utility is now hardened to require that Options::useDollarVM be
2123         enabled in order for it to be used.
2124
2125         * testing/js/WebCoreTestSupport.cpp:
2126         (WebCoreTestSupport::injectInternalsObject):
2127
2128 2019-09-12  Youenn Fablet  <youenn@apple.com>
2129
2130         Use typed identifiers for IDB connection identifiers
2131         https://bugs.webkit.org/show_bug.cgi?id=201682
2132
2133         Reviewed by Chris Dumez.
2134
2135         Migrate from uint64_t to a typed identifier for IDB connection identifiers.
2136         The identifier is reusing the process identifier type.
2137         No change of behavior.
2138
2139         * Modules/indexeddb/client/IDBConnectionProxy.h:
2140         (WebCore::IDBClient::IDBConnectionProxy::serverConnectionIdentifier const):
2141         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2142         (WebCore::IDBClient::IDBConnectionToServer::identifier const):
2143         * Modules/indexeddb/client/IDBConnectionToServer.h:
2144         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
2145         * Modules/indexeddb/server/IDBConnectionToClient.cpp:
2146         (WebCore::IDBServer::IDBConnectionToClient::identifier const):
2147         * Modules/indexeddb/server/IDBConnectionToClient.h:
2148         * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
2149         * Modules/indexeddb/server/IDBServer.cpp:
2150         (WebCore::IDBServer::IDBServer::getAllDatabaseNames):
2151         (WebCore::IDBServer::IDBServer::performGetAllDatabaseNames):
2152         (WebCore::IDBServer::IDBServer::didGetAllDatabaseNames):
2153         * Modules/indexeddb/server/IDBServer.h:
2154         * Modules/indexeddb/shared/IDBRequestData.cpp:
2155         (WebCore::IDBRequestData::serverConnectionIdentifier const):
2156         * Modules/indexeddb/shared/IDBRequestData.h:
2157         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
2158         (WebCore::IDBResourceIdentifier::IDBResourceIdentifier):
2159         (WebCore::IDBResourceIdentifier::emptyValue):
2160         (WebCore::IDBResourceIdentifier::deletedValue):
2161         (WebCore::IDBResourceIdentifier::isHashTableDeletedValue const):
2162         (WebCore::IDBResourceIdentifier::loggingString const):
2163         * Modules/indexeddb/shared/IDBResourceIdentifier.h:
2164         (WebCore::IDBResourceIdentifier::hash const):
2165         (WebCore::IDBResourceIdentifier::connectionIdentifier const):
2166         (WTF::crossThreadCopy):
2167         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
2168         (WebCore::InProcessIDBServer::identifier const):
2169         * Modules/indexeddb/shared/InProcessIDBServer.h:
2170
2171 2019-09-12  Youenn Fablet  <youenn@apple.com>
2172
2173         Use WebProcess processIdentifier to identify Service Worker connections
2174         https://bugs.webkit.org/show_bug.cgi?id=201459
2175
2176         Reviewed by Chris Dumez.
2177
2178         No observable change of behavior.
2179
2180         * workers/service/ServiceWorkerClient.cpp:
2181         (WebCore::ServiceWorkerClient::postMessage):
2182         Pass sessionID to ease NetworkProcess selection of the client process connection.
2183         * workers/service/ServiceWorkerTypes.h:
2184         Mark server connection identifier be process identifier based.
2185         * workers/service/context/SWContextManager.h:
2186         * workers/service/server/SWServer.cpp:
2187         (WebCore::SWServer::Connection::Connection):
2188         * workers/service/server/SWServer.h:
2189         Let connection identifier be set in constructor instead of generated.
2190
2191 2019-09-11  Youenn Fablet  <youenn@apple.com>
2192
2193         Disable DTLS1.0
2194         https://bugs.webkit.org/show_bug.cgi?id=201679
2195
2196         Reviewed by Alex Christensen.
2197
2198         Add an option to force to use DTLS1.0 and nothing else.
2199         Add internals API to enter in that mode to verify that normal configurations cannot communicate with DTLS1.0.
2200
2201         Test: webrtc/datachannel/dtls10.html
2202
2203         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2204         (WebCore::LibWebRTCProvider::setEnableWebRTCEncryption):
2205         (WebCore::LibWebRTCProvider::setUseDTLS10):
2206         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2207         * testing/Internals.cpp:
2208         (WebCore::Internals::setUseDTLS10):
2209         * testing/Internals.h:
2210         * testing/Internals.idl:
2211
2212 2019-09-11  Keith Rollin  <krollin@apple.com>
2213
2214         Log timeoutValue passed on to CFNetwork
2215         https://bugs.webkit.org/show_bug.cgi?id=201701
2216         <rdar://problem/55279683>
2217
2218         Reviewed by Chris Dumez.
2219
2220         Export ResourceRequest::timeoutValue for use in WebKit.
2221
2222         No new tests -- no new or changed functionality.
2223
2224         * platform/network/ResourceRequestBase.h:
2225
2226 2019-09-11  Saam Barati  <sbarati@apple.com>
2227
2228         [WHLSL] Remove null from the standard library
2229         https://bugs.webkit.org/show_bug.cgi?id=201672
2230
2231         Reviewed by Robin Morisset.
2232
2233         I meant to remove `null` from the standard library in r249351, but
2234         I had omitted the code I wrote to do that when I rebased that patch.
2235         This patch removes it and ensures all tests pass when parsing the entire
2236         standard library.
2237
2238         * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt:
2239
2240 2019-09-11  Chris Dumez  <cdumez@apple.com>
2241
2242         Use same parser for <meta http-equiv="refresh"> and `Refresh` HTTP header
2243         https://bugs.webkit.org/show_bug.cgi?id=201694
2244
2245         Reviewed by Alex Christensen.
2246
2247         Use same parser for <meta http-equiv="refresh"> and `Refresh` HTTP header. This aligns
2248         our behavior with Blink and makes us more compliant on web-platform-tests. This also
2249         simplifies our code.
2250
2251         No new tests, rebaselined existing test.
2252
2253         * loader/FrameLoader.cpp:
2254         (WebCore::FrameLoader::receivedFirstData):
2255         * platform/network/HTTPParsers.cpp:
2256         (WebCore::parseHTTPRefresh): Deleted.
2257         * platform/network/HTTPParsers.h:
2258
2259 2019-09-11  Saam Barati  <sbarati@apple.com>
2260
2261         [WHLSL] Ensure structs/arrays with pointers as fields are disallowed
2262         https://bugs.webkit.org/show_bug.cgi?id=201525
2263
2264         Reviewed by Robin Morisset.
2265
2266         This patch adds a pass which both ensures that references are always initialized with
2267         concrete values and that we support logical mode validation by disallowing nested references.
2268         
2269         Specifically, the pass:
2270         
2271         1. Disallows structs to have fields which are references. This prevents us from having to
2272         figure out how to default initialize such a struct. We could relax this in the future if we
2273         did an analysis on which structs contain reference fields, and ensure such struct variables
2274         always have initializers. This would also require us to create constructors for structs which
2275         initialize each field.
2276         2. We also do the same for arrays.
2277         3. References can only be one level deep. So no pointers to pointers. No references to
2278         references, etc. This is to support logical mode validation rules.
2279
2280         Test: webgpu/whlsl/ensure-proper-pointer-usage.html
2281
2282         * Modules/webgpu/WHLSL/WHLSLCheckReferenceTypes.cpp: Added.
2283         (WebCore::WHLSL::checkReferenceTypes):
2284         * Modules/webgpu/WHLSL/WHLSLCheckReferenceTypes.h: Added.
2285         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
2286         (WebCore::WHLSL::Checker::visit):
2287         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
2288         (WebCore::WHLSL::prepareShared):
2289         * Sources.txt:
2290         * WebCore.xcodeproj/project.pbxproj:
2291
2292 2019-09-11  Devin Rousso  <drousso@apple.com>
2293
2294         Web Inspector: Canvas: instrument WebGPUDevice instead of GPUCanvasContext
2295         https://bugs.webkit.org/show_bug.cgi?id=201650
2296
2297         Reviewed by Joseph Pecoraro.
2298
2299         Most of the actual "work" done with Web GPU actually uses a `WebGPUDevice`.
2300
2301         A `GPUCanvasContext` is basically just a display "client" of the device, and isn't even
2302         required (e.g. compute pipeline).  We should treat the `GPUCanvasContext` almost like a
2303         `-webkit-canvas` client of a `WebGPUDevice`.
2304
2305         Tests: inspector/canvas/create-context-webgpu.html
2306                inspector/canvas/requestClientNodes-webgpu.html
2307                inspector/canvas/resolveContext-webgpu.html
2308
2309         * Modules/webgpu/WebGPUAdapter.cpp:
2310         (WebCore::WebGPUAdapter::requestDevice const):
2311         Notify web inspector after a device is created.
2312
2313         * Modules/webgpu/WebGPUDevice.idl:
2314         * Modules/webgpu/WebGPUDevice.h:
2315         * Modules/webgpu/WebGPUDevice.cpp:
2316         (WebCore::WebGPUDevice::instances): Added.
2317         (WebCore::WebGPUDevice::instancesMutex): Added.
2318         (WebCore::WebGPUDevice::~WebGPUDevice): Added.
2319         Notify web inspector when the device is about to be destructed.
2320
2321         * Modules/webgpu/GPUCanvasContext.h:
2322         * Modules/webgpu/GPUCanvasContext.cpp:
2323         (WebCore::GPUCanvasContext::create):
2324         (WebCore::GPUCanvasContext::configureSwapChain):
2325
2326         * inspector/InspectorCanvas.h:
2327         * inspector/InspectorCanvas.cpp:
2328         (WebCore::canvasIfContextMatchesDevice): Added.
2329         (WebCore::InspectorCanvas::create):
2330         (WebCore::InspectorCanvas::InspectorCanvas):
2331         (WebCore::InspectorCanvas::canvasContext const): Added.
2332         (WebCore::InspectorCanvas::canvasElement const): Added.
2333         (WebCore::InspectorCanvas::isDeviceForCanvasContext const): Added.
2334         (WebCore::InspectorCanvas::deviceContext const): Added.
2335         (WebCore::InspectorCanvas::scriptExecutionContext const): Added.
2336         (WebCore::InspectorCanvas::resolveContext const): Added.
2337         (WebCore::InspectorCanvas::clientNodes const): Added.
2338         (WebCore::InspectorCanvas::canvasChanged):
2339         (WebCore::InspectorCanvas::resetRecordingData):
2340         (WebCore::InspectorCanvas::recordAction):
2341         (WebCore::InspectorCanvas::buildObjectForCanvas):
2342         (WebCore::InspectorCanvas::releaseObjectForRecording):
2343         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
2344         (WebCore::InspectorCanvas::buildInitialState):
2345         (WebCore::InspectorCanvas::canvasElement): Deleted.
2346         * inspector/InspectorInstrumentation.cpp:
2347         (WebCore::InspectorInstrumentation::didCreateWebGPUDeviceImpl): Added.
2348         (WebCore::InspectorInstrumentation::willDestroyWebGPUDeviceImpl): Added.
2349         (WebCore::InspectorInstrumentation::willConfigureSwapChainImpl): Added.
2350         * inspector/InspectorInstrumentation.h:
2351         (WebCore::InspectorInstrumentation::didCreateWebGPUDevice): Added.
2352         (WebCore::InspectorInstrumentation::willDestroyWebGPUDevice): Added.
2353         (WebCore::InspectorInstrumentation::willConfigureSwapChain): Added.
2354
2355         * inspector/agents/InspectorCanvasAgent.h:
2356         * inspector/agents/InspectorCanvasAgent.cpp:
2357         (WebCore::InspectorCanvasAgent::enable):
2358         (WebCore::InspectorCanvasAgent::requestClientNodes): Added.
2359         (WebCore::InspectorCanvasAgent::resolveContext): Added.
2360         (WebCore::InspectorCanvasAgent::startRecording):
2361         (WebCore::InspectorCanvasAgent::stopRecording):
2362         (WebCore::InspectorCanvasAgent::frameNavigated):
2363         (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
2364         (WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
2365         (WebCore::InspectorCanvasAgent::canvasDestroyed):
2366         (WebCore::InspectorCanvasAgent::recordCanvasAction):
2367         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
2368         (WebCore::InspectorCanvasAgent::didCreateWebGPUDevice): Added.
2369         (WebCore::InspectorCanvasAgent::willDestroyWebGPUDevice): Added.
2370         (WebCore::InspectorCanvasAgent::willConfigureSwapChain): Added.
2371         (WebCore::InspectorCanvasAgent::clearCanvasData):
2372         (WebCore::InspectorCanvasAgent::bindCanvas):
2373         (WebCore::InspectorCanvasAgent::unbindCanvas):
2374         (WebCore::InspectorCanvasAgent::findInspectorCanvas):
2375         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes): Deleted.
2376         (WebCore::contextAsScriptValue): Deleted.
2377         (WebCore::InspectorCanvasAgent::resolveCanvasContext): Deleted.
2378
2379         * inspector/InspectorShaderProgram.cpp:
2380         (WebCore::InspectorShaderProgram::context const):
2381
2382 2019-09-11  Chris Dumez  <cdumez@apple.com>
2383
2384         Posting a message to a redundant service worker should fail silently instead of throwing
2385         https://bugs.webkit.org/show_bug.cgi?id=201696
2386
2387         Reviewed by Geoffrey Garen.
2388
2389         Posting a message to a redundant service worker should fail silently instead of throwing:
2390         - https://w3c.github.io/ServiceWorker/#dom-serviceworker-postmessage-message-options
2391         - https://w3c.github.io/ServiceWorker/#run-service-worker (step 2)
2392
2393         No new tests, rebaselined existing test.
2394
2395         * workers/service/ServiceWorker.cpp:
2396         (WebCore::ServiceWorker::postMessage):
2397         * workers/service/server/SWServer.cpp:
2398         (WebCore::SWServer::runServiceWorkerIfNecessary):
2399
2400 2019-09-11  Chris Dumez  <cdumez@apple.com>
2401
2402         Align our XPath API with the specification and other browsers
2403         https://bugs.webkit.org/show_bug.cgi?id=201660
2404
2405         Reviewed by Geoffrey Garen.
2406
2407         Align our XPath API with the specification and other browsers:
2408         - Document/XPathEvaluator.createExpression()'s first parameter should be mandatory
2409         - Document/XPathEvaluator.evaluate()'s first 2 parameters should be mandatory
2410         - XPathExpression.evaluate()'s first parameter should be mandatory
2411
2412         I have confirmed in the latest Chrome and Firefox that they match the specification.
2413         
2414         No new tests, rebaselined existing test.
2415
2416         * dom/Document.cpp:
2417         (WebCore::Document::evaluate):
2418         * dom/Document.h:
2419         * dom/Document.idl:
2420         * inspector/InspectorNodeFinder.cpp:
2421         (WebCore::InspectorNodeFinder::searchUsingXPath):
2422         * xml/XPathEvaluator.cpp:
2423         (WebCore::XPathEvaluator::evaluate):
2424         * xml/XPathEvaluator.h:
2425         * xml/XPathEvaluator.idl:
2426         * xml/XPathExpression.cpp:
2427         (WebCore::XPathExpression::evaluate):
2428         * xml/XPathExpression.h:
2429         * xml/XPathExpression.idl:
2430         * xml/XPathUtil.cpp:
2431         (WebCore::XPath::isValidContextNode):
2432         * xml/XPathUtil.h:
2433
2434 2019-09-11  Simon Fraser  <simon.fraser@apple.com>
2435
2436         REGRESSION (iOS 13): Top fixed element on apple.com flickers in size while pinching in
2437         https://bugs.webkit.org/show_bug.cgi?id=201668
2438         rdar://problem/51934041
2439
2440         Reviewed by Frédéric Wang.
2441
2442         When computing the new layout viewport rect in ScrollingTreeFrameScrollingNode, use
2443         "StickToDocumentBounds" mode, not "StickToViewportBounds", because otherwise we'll compute
2444         a layout viewport that has negative top/left offsets which causes fixed elements to jump outside
2445         the viewport. The only code that should be moving things outside the viewport (a temporary effect
2446         that happens when pinching) is the 'isBelowMinimumScale' path in WebPageProxy::computeCustomFixedPositionRect().
2447
2448         With this change ScrollingTreeFrameScrollingNode no longer needs m_behaviorForFixed; it can be removed later.
2449
2450         Not currently testable, since it involves pinching in past minimum zoom and transients state.
2451
2452         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
2453         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition const):
2454
2455 2019-09-11  Truitt Savell  <tsavell@apple.com>
2456
2457         Unreviewed, rolling out r249753.
2458
2459         caused inspector/canvas/shaderProgram-add-remove-webgl.html to
2460         crash on all Mac platforms.
2461
2462         Reverted changeset:
2463
2464         "Web Inspector: Canvas: instrument WebGPUDevice instead of
2465         GPUCanvasContext"
2466         https://bugs.webkit.org/show_bug.cgi?id=201650
2467         https://trac.webkit.org/changeset/249753
2468
2469 2019-09-11  Antti Koivisto  <antti@apple.com>
2470
2471         REGRESSION (245006): can't scroll in "read more" view in Eventbrite app
2472         https://bugs.webkit.org/show_bug.cgi?id=201683
2473         <rdar://problem/54582602>
2474
2475         Reviewed by Simon Fraser.
2476
2477         * platform/RuntimeApplicationChecks.h:
2478         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2479         (WebCore::IOSApplication::isEventbrite):
2480
2481 2019-09-11  Ryan Haddad  <ryanhaddad@apple.com>
2482
2483         Unreviewed, rolling out r249758.
2484
2485         Breaks the watchOS build.
2486
2487         Reverted changeset:
2488
2489         "[WHLSL] Ensure structs/arrays with pointers as fields are
2490         disallowed"
2491         https://bugs.webkit.org/show_bug.cgi?id=201525
2492         https://trac.webkit.org/changeset/249758
2493
2494 2019-09-11  Ali Juma  <ajuma@chromium.org>
2495
2496         Prevent reentrancy FrameLoader::dispatchUnloadEvents()
2497         https://bugs.webkit.org/show_bug.cgi?id=200738
2498
2499         Reviewed by Brady Eidson.
2500
2501         Reentrancy causes m_pageDismissalEventBeingDispatched to be incorrectly
2502         updated, so don't allow reentrancy.
2503
2504         Since this prevents m_pageDismissalEventBeingDispatched from being reset
2505         inside a reentrant call, it can have the unintended effect of causing
2506         FrameLoader::stopAllLoaders to early-out when called from
2507         FrameLoader::detachFromParent while a frame's unload event handler
2508         calls document.open() on a parent frame and causes itself to become
2509         detached. Allowing a load to continue in a detached frame will lead to
2510         a crash. To prevent this, add a new argument to FrameLoader::stopAllLoaders
2511         that FrameLoader::detachFromParent can use to prevent an early-out.
2512
2513         * loader/FrameLoader.cpp:
2514         (WebCore::FrameLoader::stopAllLoaders):
2515         (WebCore::FrameLoader::detachFromParent):
2516         (WebCore::FrameLoader::dispatchUnloadEvents):
2517         (WebCore::FrameLoader::dispatchBeforeUnloadEvent):
2518         Ensure that m_pageDismissalEventBeingDispatched is reset to its previous value, even if this is not None.
2519         * loader/FrameLoader.h:
2520         * loader/FrameLoaderTypes.h:
2521         Add a StopLoadingPolicy enum.
2522
2523 2019-09-11  Charlie Turner  <cturner@igalia.com>
2524
2525         [GStreamer] Do not adopt floating references.
2526         https://bugs.webkit.org/show_bug.cgi?id=201685
2527
2528         Reviewed by Carlos Garcia Campos.
2529
2530         Covered by existing tests.
2531
2532         * platform/graphics/gstreamer/GStreamerCommon.cpp:
2533         (WebCore::initializeGStreamer): gst_element_factory_make returns
2534         floating references, you do not adopt such references, rather you
2535         sink them.
2536
2537 2019-09-11  Saam Barati  <sbarati@apple.com>
2538
2539         [WHLSL] Ensure structs/arrays with pointers as fields are disallowed
2540         https://bugs.webkit.org/show_bug.cgi?id=201525
2541
2542         Reviewed by Robin Morisset.
2543
2544         This patch adds a pass which both ensures that references are always initialized with
2545         concrete values and that we support logical mode validation by disallowing nested references.
2546         
2547         Specifically, the pass:
2548         
2549         1. Disallows structs to have fields which are references. This prevents us from having to
2550         figure out how to default initialize such a struct. We could relax this in the future if we
2551         did an analysis on which structs contain reference fields, and ensure such struct variables
2552         always have initializers. This would also require us to create constructors for structs which
2553         initialize each field.
2554         2. We also do the same for arrays.
2555         3. References can only be one level deep. So no pointers to pointers. No references to
2556         references, etc. This is to support logical mode validation rules.
2557
2558         Test: webgpu/whlsl/ensure-proper-pointer-usage.html
2559
2560         * Modules/webgpu/WHLSL/WHLSLCheckReferenceTypes.cpp: Added.
2561         (WebCore::WHLSL::checkReferenceTypes):
2562         * Modules/webgpu/WHLSL/WHLSLCheckReferenceTypes.h: Added.
2563         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
2564         (WebCore::WHLSL::Checker::visit):
2565         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
2566         (WebCore::WHLSL::prepareShared):
2567         * Sources.txt:
2568         * WebCore.xcodeproj/project.pbxproj:
2569
2570 2019-09-10  Devin Rousso  <drousso@apple.com>
2571
2572         Web Inspector: Canvas: instrument WebGPUDevice instead of GPUCanvasContext
2573         https://bugs.webkit.org/show_bug.cgi?id=201650
2574
2575         Reviewed by Joseph Pecoraro.
2576
2577         Most of the actual "work" done with Web GPU actually uses a `WebGPUDevice`.
2578
2579         A `GPUCanvasContext` is basically just a display "client" of the device, and isn't even
2580         required (e.g. compute pipeline).  We should treat the `GPUCanvasContext` almost like a
2581         `-webkit-canvas` client of a `WebGPUDevice`.
2582
2583         Tests: inspector/canvas/create-context-webgpu.html
2584                inspector/canvas/requestClientNodes-webgpu.html
2585                inspector/canvas/resolveContext-webgpu.html
2586
2587         * Modules/webgpu/WebGPUAdapter.cpp:
2588         (WebCore::WebGPUAdapter::requestDevice const):
2589         Notify web inspector after a device is created.
2590
2591         * Modules/webgpu/WebGPUDevice.idl:
2592         * Modules/webgpu/WebGPUDevice.h:
2593         * Modules/webgpu/WebGPUDevice.cpp:
2594         (WebCore::WebGPUDevice::instances): Added.
2595         (WebCore::WebGPUDevice::instancesMutex): Added.
2596         (WebCore::WebGPUDevice::~WebGPUDevice): Added.
2597         Notify web inspector when the device is about to be destructed.
2598
2599         * Modules/webgpu/GPUCanvasContext.h:
2600         * Modules/webgpu/GPUCanvasContext.cpp:
2601         (WebCore::GPUCanvasContext::create):
2602         (WebCore::GPUCanvasContext::configureSwapChain):
2603
2604         * inspector/InspectorCanvas.h:
2605         * inspector/InspectorCanvas.cpp:
2606         (WebCore::canvasIfContextMatchesDevice): Added.
2607         (WebCore::InspectorCanvas::create):
2608         (WebCore::InspectorCanvas::InspectorCanvas):
2609         (WebCore::InspectorCanvas::canvasContext const): Added.
2610         (WebCore::InspectorCanvas::canvasElement const): Added.
2611         (WebCore::InspectorCanvas::isDeviceForCanvasContext const): Added.
2612         (WebCore::InspectorCanvas::deviceContext const): Added.
2613         (WebCore::InspectorCanvas::scriptExecutionContext const): Added.
2614         (WebCore::InspectorCanvas::resolveContext const): Added.
2615         (WebCore::InspectorCanvas::clientNodes const): Added.
2616         (WebCore::InspectorCanvas::canvasChanged):
2617         (WebCore::InspectorCanvas::resetRecordingData):
2618         (WebCore::InspectorCanvas::recordAction):
2619         (WebCore::InspectorCanvas::buildObjectForCanvas):
2620         (WebCore::InspectorCanvas::releaseObjectForRecording):
2621         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
2622         (WebCore::InspectorCanvas::buildInitialState):
2623         (WebCore::InspectorCanvas::canvasElement): Deleted.
2624         * inspector/InspectorInstrumentation.cpp:
2625         (WebCore::InspectorInstrumentation::didCreateWebGPUDeviceImpl): Added.
2626         (WebCore::InspectorInstrumentation::willDestroyWebGPUDeviceImpl): Added.
2627         (WebCore::InspectorInstrumentation::willConfigureSwapChainImpl): Added.
2628         * inspector/InspectorInstrumentation.h:
2629         (WebCore::InspectorInstrumentation::didCreateWebGPUDevice): Added.
2630         (WebCore::InspectorInstrumentation::willDestroyWebGPUDevice): Added.
2631         (WebCore::InspectorInstrumentation::willConfigureSwapChain): Added.
2632
2633         * inspector/agents/InspectorCanvasAgent.h:
2634         * inspector/agents/InspectorCanvasAgent.cpp:
2635         (WebCore::InspectorCanvasAgent::enable):
2636         (WebCore::InspectorCanvasAgent::requestClientNodes): Added.
2637         (WebCore::InspectorCanvasAgent::resolveContext): Added.
2638         (WebCore::InspectorCanvasAgent::startRecording):
2639         (WebCore::InspectorCanvasAgent::stopRecording):
2640         (WebCore::InspectorCanvasAgent::frameNavigated):
2641         (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
2642         (WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
2643         (WebCore::InspectorCanvasAgent::canvasDestroyed):
2644         (WebCore::InspectorCanvasAgent::recordCanvasAction):
2645         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
2646         (WebCore::InspectorCanvasAgent::didCreateWebGPUDevice): Added.
2647         (WebCore::InspectorCanvasAgent::willDestroyWebGPUDevice): Added.
2648         (WebCore::InspectorCanvasAgent::willConfigureSwapChain): Added.
2649         (WebCore::InspectorCanvasAgent::clearCanvasData):
2650         (WebCore::InspectorCanvasAgent::bindCanvas):
2651         (WebCore::InspectorCanvasAgent::unbindCanvas):
2652         (WebCore::InspectorCanvasAgent::findInspectorCanvas):
2653         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes): Deleted.
2654         (WebCore::contextAsScriptValue): Deleted.
2655         (WebCore::InspectorCanvasAgent::resolveCanvasContext): Deleted.
2656
2657         * inspector/InspectorShaderProgram.cpp:
2658         (WebCore::InspectorShaderProgram::context const):
2659
2660 2019-09-10  Chris Dumez  <cdumez@apple.com>
2661
2662         Nullptr crash in Page::sessionID() via WebKit::WebFrameLoaderClient::detachedFromParent2()
2663         https://bugs.webkit.org/show_bug.cgi?id=201625
2664
2665         Reviewed by Ryosuke Niwa.
2666
2667         This is based on a patch from Ryosuke Niwa.
2668
2669         Drop setHasFrameSpecificStorageAccess() in WebCore and call it from the WebKit layer instead.
2670
2671         * dom/DocumentStorageAccess.cpp:
2672         (WebCore::DocumentStorageAccess::requestStorageAccess):
2673         (WebCore::DocumentStorageAccess::setHasFrameSpecificStorageAccess): Deleted.
2674         * dom/DocumentStorageAccess.h:
2675         * loader/EmptyFrameLoaderClient.h:
2676         * loader/FrameLoaderClient.h:
2677
2678 2019-09-10  Brady Eidson  <beidson@apple.com>
2679
2680         Add SPI to save a PDF from the contents of a WKWebView.
2681         <rdar://problem/48955900> and https://bugs.webkit.org/show_bug.cgi?id=195765
2682
2683         Reviewed by Tim Horton.
2684
2685         Covered by API tests.
2686
2687         * page/FrameView.cpp:
2688         (WebCore::FrameView::paintContents): Don't paint the debug color outside of the FrameRect.
2689
2690         * platform/graphics/cg/GraphicsContextCG.cpp:
2691         (WebCore::GraphicsContext::setURLForRect):
2692
2693         * rendering/PaintPhase.h: Add "AnnotateLinks" option to always gather and annotation links.
2694
2695         * rendering/RenderElement.cpp:
2696         (WebCore::RenderElement::hasOutlineAnnotation const): Also return true when the PaintOptions include "AnnotateLinks"
2697
2698 2019-09-10  Jiewen Tan  <jiewen_tan@apple.com>
2699
2700         REGRESSION: [ Catalina WK2 ] http/wpt/webauthn/public-key-credential-create-success-u2f.https.html is failing
2701         https://bugs.webkit.org/show_bug.cgi?id=201620
2702         <rdar://problem/51524958>
2703
2704         Reviewed by Alex Christensen.
2705
2706         Covered by existing tests.
2707
2708         * Modules/webauthn/fido/U2fResponseConverter.cpp:
2709         (fido::WebCore::createAttestedCredentialDataFromU2fRegisterResponse):
2710         Change the way how the aaguid is initialized to see if that fixes the issue.
2711
2712 2019-09-10  Chris Dumez  <cdumez@apple.com>
2713
2714         Add missing origin check for Service-Worker-Allowed header
2715         https://bugs.webkit.org/show_bug.cgi?id=201653
2716
2717         Reviewed by Geoffrey Garen.
2718
2719         Add missing origin check for Service-Worker-Allowed header:
2720         - https://w3c.github.io/ServiceWorker/#update-algorithm (step 15. 2.)
2721
2722         * workers/service/ServiceWorkerJob.cpp:
2723         (WebCore::ServiceWorkerJob::didReceiveResponse):
2724
2725 2019-09-10  Sihui Liu  <sihui_liu@apple.com>
2726
2727         IndexedDB: cache prepared SQLiteStatement in SQLiteIDBCursor
2728         https://bugs.webkit.org/show_bug.cgi?id=201548
2729
2730         Reviewed by Alex Christensen.
2731
2732         This should be a performance improvement as we don't compile the same SQLiteStatement everytime it is used.
2733
2734         No new tests, no behavior change.
2735
2736         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
2737         (WebCore::IDBServer::SQLiteIDBCursor::internalFetchNextRecord):
2738         * Modules/indexeddb/server/SQLiteIDBCursor.h:
2739
2740 2019-09-10  Youenn Fablet  <youenn@apple.com>
2741
2742         RTCPeerConnection can only be instantiated in documents
2743         https://bugs.webkit.org/show_bug.cgi?id=201639
2744
2745         Reviewed by Alex Christensen.
2746
2747         Make it clear that RTCDataChannel expects Document since peer connections
2748         and data channels can only be instantiated in document environments.
2749         We keep one downcast in RTCPeerConnection constructor due to a limitation
2750         in binding generator for JS built-ins.
2751         No change of behavior.
2752
2753         * Modules/mediastream/RTCDataChannel.cpp:
2754         (WebCore::RTCDataChannel::create):
2755         (WebCore::RTCDataChannel::RTCDataChannel):
2756         * Modules/mediastream/RTCDataChannel.h:
2757         * Modules/mediastream/RTCPeerConnection.cpp:
2758         (WebCore::RTCPeerConnection::create):
2759         (WebCore::RTCPeerConnection::RTCPeerConnection):
2760         (WebCore::RTCPeerConnection::certificatesFromConfiguration):
2761         (WebCore::RTCPeerConnection::createDataChannel):
2762         (WebCore::RTCPeerConnection::document):
2763         * Modules/mediastream/RTCPeerConnection.h:
2764         * Modules/mediastream/RTCPeerConnection.idl:
2765         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
2766         (WebCore::LibWebRTCDataChannelHandler::channelEvent):
2767         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
2768         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2769         (WebCore::LibWebRTCMediaEndpoint::OnDataChannel):
2770
2771 2019-09-10  Youenn Fablet  <youenn@apple.com>
2772
2773         Remove MediaStreamPrivate::scheduleDeferredTask
2774         https://bugs.webkit.org/show_bug.cgi?id=200975
2775
2776         Reviewed by Eric Carlson.
2777
2778         All calls to scheduleDeferredTask are done on the main thread.
2779         This was initially done to trigger less reconfiguration.
2780         But this makes the implementation significantly more complex.
2781
2782         For instance, we have to wait for the document to update its media state
2783         and send it to UIProcess before calling the allow completion handler.
2784
2785         Covered by existing tests.
2786
2787         * Modules/mediastream/MediaStream.cpp:
2788         (WebCore::MediaStream::MediaStream):
2789         Make sure to update the document media state once the tracks have been added, similarly to the other constructor.
2790         This ensures the document media state is computed with the new MediaStreamTrack.
2791         * Modules/mediastream/UserMediaRequest.cpp:
2792         (WebCore::isMediaStreamCorrectlyStarted):
2793         (WebCore::UserMediaRequest::allow):
2794         (WebCore::UserMediaRequest::stop):
2795         (WebCore::UserMediaRequest::mediaStreamDidFail):
2796         * Modules/mediastream/UserMediaRequest.h:
2797         * page/MediaProducer.h:
2798         (WebCore::MediaProducer::isCapturing):
2799         Make sure to include getDisplayMedia as part of capture check.
2800         * platform/mediastream/MediaStreamPrivate.cpp:
2801         (WebCore::MediaStreamPrivate::trackMutedChanged):
2802         (WebCore::MediaStreamPrivate::trackEnabledChanged):
2803         (WebCore::MediaStreamPrivate::trackStarted):
2804         (WebCore::MediaStreamPrivate::trackEnded):
2805         * platform/mediastream/MediaStreamPrivate.h:
2806
2807 2019-09-10  Youenn Fablet  <youenn@apple.com>
2808
2809         Audio sometimes fail to capture in WebRTC
2810         https://bugs.webkit.org/show_bug.cgi?id=180748
2811         <rdar://problem/36032346>
2812
2813         Reviewed by Eric Carlson.
2814
2815         In some cases, Safari is not receiving unsuspend notifications.
2816         In that case, the capture unit might stay in suspend state forever.
2817         To work around that, we force to unsuspend whenever there is a new capture happening.
2818         This will make it so that reloading the page will unsuspend the page.
2819
2820         Manually tested by triggering Siri, starting to use the microphone and quickly going back to a capturing page.
2821
2822         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2823         (WebCore::CoreAudioSharedUnit::provideSpeakerData):
2824         When suspension happens, the buffer size might change.
2825         Since this is only an issue if there are some references data, we now do not fail the capture when there
2826         is no reference data.
2827         (WebCore::CoreAudioSharedUnit::resume):
2828         (WebCore::CoreAudioSharedUnit::prepareForNewCapture):
2829         Make sure to start with a clean slate by setting suspend state to false for the shared unit.
2830         And failing all previous sources in case we are going back from suspension.
2831         (WebCore::CoreAudioSharedUnit::startInternal):
2832         (WebCore::CoreAudioCaptureSourceFactory::audioCaptureDeviceManager):
2833         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
2834
2835 2019-09-10  Adrian Perez de Castro  <aperez@igalia.com>
2836
2837         [GTK][WPE] Fixes for non-unified builds after r249022
2838         https://bugs.webkit.org/show_bug.cgi?id=201610
2839
2840         Reviewed by Joseph Pecoraro.
2841
2842         No new tests needed.
2843
2844         * fileapi/NetworkSendQueue.h: Add missing inclusion of wtf/WeakPtr.h; add the namespace to WTF::WeakPtr
2845         which is needed because there is no "using" clause.
2846         * inspector/InspectorInstrumentation.cpp: Add missing inclusion of the PageDOMDebuggerAgent.h header.
2847         * inspector/agents/WebDebuggerAgent.cpp: Add missing inclusion of the ScriptExecutionContext.h header.
2848         * inspector/agents/page/PageDOMDebuggerAgent.cpp: Add missing inclusion of the InstrumentingAgents.h header.
2849
2850 2019-09-10  Youenn Fablet  <youenn@apple.com>
2851
2852         Add support to RTCDataChannel.send(Blob)
2853         https://bugs.webkit.org/show_bug.cgi?id=201377
2854
2855         Reviewed by Chris Dumez.
2856
2857         Make use of NetworkSendQueue to enqueue and send properly messages.
2858         Test: imported/w3c/web-platform-tests/webrtc/RTCDataChannel-send-blob-order.html
2859
2860         * Modules/mediastream/RTCDataChannel.cpp:
2861         (WebCore::RTCDataChannel::createMessageQueue):
2862         (WebCore::RTCDataChannel::RTCDataChannel):
2863         (WebCore::RTCDataChannel::send):
2864         (WebCore::RTCDataChannel::close):
2865         * Modules/mediastream/RTCDataChannel.h:
2866
2867 2019-09-10  Ryosuke Niwa  <rniwa@webkit.org>
2868
2869         Option + arrow moves caret past whitespace on iOS
2870         https://bugs.webkit.org/show_bug.cgi?id=201575
2871
2872         Reviewed by Wenson Hsieh.
2873
2874         The bug was caused by findNextWordFromIndex on iOS behaving differently from macOS and UIKit by skipping
2875         trailing whitespace after a word when moving forward and not skipping leading whitespace when moving backward.
2876
2877         This patch introduces a new mode (StopAfterWord) of findNextWordFromIndex in iOS that better matches
2878         the behavior of findNextWordFromIndex on macOS and UIKit, and use it in various modify* functions of
2879         FrameSelection when the selection update is triggered by user.
2880
2881         The legacy mode (LegacyStopBeforeWord) is used in all other call sites as well as when modify* functions
2882         are invoked from author scripts.
2883
2884         Test: editing/selection/ios/move-by-word-with-keyboard.html
2885
2886         * editing/FrameSelection.cpp:
2887         (WebCore::nextWordWhitespaceModeInIOS): Added. A helper to convert EUserTriggered to NextWordModeInIOS.
2888         (WebCore::FrameSelection::nextWordPositionForPlatform):
2889         (WebCore::FrameSelection::modifyExtendingRight):
2890         (WebCore::FrameSelection::modifyExtendingForward):
2891         (WebCore::FrameSelection::modifyMovingRight):
2892         (WebCore::FrameSelection::modifyMovingForward):
2893         (WebCore::FrameSelection::modifyExtendingLeft):
2894         (WebCore::FrameSelection::modifyExtendingBackward):
2895         (WebCore::FrameSelection::modifyMovingLeft):
2896         (WebCore::FrameSelection::modifyMovingBackward):
2897         (WebCore::FrameSelection::modify):
2898         (WebCore::FrameSelection::updateAppearance):
2899         * editing/FrameSelection.h:
2900         * editing/TextIterator.cpp:
2901         (WebCore::SearchBuffer::isWordStartMatch const):
2902         * editing/VisibleUnits.cpp:
2903         (WebCore::previousWordPositionBoundary):
2904         (WebCore::previousWordPosition):
2905         (WebCore::nextWordPositionBoundary):
2906         (WebCore::nextWordPosition):
2907         * editing/VisibleUnits.h:
2908         * platform/text/TextBoundaries.cpp:
2909         (WebCore::findNextWordFromIndex):
2910         * platform/text/TextBoundaries.h:
2911         * platform/text/mac/TextBoundaries.mm:
2912         (WebCore::findNextWordFromIndex): Added a new mode.
2913
2914 2019-09-09  Chris Dumez  <cdumez@apple.com>
2915
2916         REGRESSION: http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html is frequently timing out on iOS EWS bots
2917         https://bugs.webkit.org/show_bug.cgi?id=201550
2918
2919         Reviewed by Alex Christensen.
2920
2921         * loader/ResourceLoadObserver.h:
2922         (WebCore::ResourceLoadObserver::hasStatistics const):
2923
2924 2019-09-09  Timothy Hatcher  <timothy@apple.com>
2925
2926         Tap and hold on Facebook sometimes creates a tall empty selection.
2927         https://bugs.webkit.org/show_bug.cgi?id=201618
2928         rdar://53630145
2929
2930         Reviewed by Megan Gardner.
2931
2932         API Test: SelectionTests.ByWordAtEndOfDocument
2933
2934         * editing/VisibleUnits.cpp:
2935         (WebCore::wordRangeFromPosition):
2936         Remove special case code for the possibility of an empty paragraph and at the end
2937         of the document. This is no longer needed and was causing a large selection to be
2938         created on Facebook due to large areas of non-selectable content on the page.
2939
2940 2019-09-09  Joonghun Park  <jh718.park@samsung.com>
2941
2942         getComputedStyle for line-height: normal should return the keyword instead of a length
2943         https://bugs.webkit.org/show_bug.cgi?id=201296
2944
2945         Reviewed by Ryosuke Niwa.
2946
2947         Per https://github.com/w3c/csswg-drafts/issues/3749,
2948         Gecko and Blink has this behavior already.
2949
2950         This patch makes WebKit has the same behavior with them.
2951
2952         Tests: imported/w3c/web-platform-tests/css/css-inline/parsing/line-height-computed.html
2953                imported/w3c/web-platform-tests/css/cssom/getComputedStyle-line-height.html
2954                imported/w3c/web-platform-tests/html/rendering/replaced-elements/the-select-element/select-1-line-height.html
2955
2956         * css/CSSComputedStyleDeclaration.cpp:
2957         (WebCore::lineHeightFromStyle):
2958
2959 2019-09-09  Alex Christensen  <achristensen@webkit.org>
2960
2961         Disable TLS 1.0 and 1.1 in WebSockets
2962         https://bugs.webkit.org/show_bug.cgi?id=201573
2963
2964         Reviewed by Youenn Fablet.
2965
2966         This expands on what I started in r249019 when I disabled legacy TLS for our use of NSURLSession.
2967         Since our WebSocket implementation uses a different network interface, disable legacy TLS for them, too.
2968         I use the same temporary default to re-enable legacy TLS.  I also add a unit test for both WebSockets and NSURLSession use.
2969
2970         * platform/network/cf/SocketStreamHandleImpl.h:
2971         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2972         (WebCore::Function<bool):
2973         (WebCore::SocketStreamHandleImpl::setLegacyTLSEnabledCheck):
2974         (WebCore::SocketStreamHandleImpl::createStreams):
2975
2976 2019-09-09  Saam Barati  <sbarati@apple.com>
2977
2978         Unreviewed follow up to r249630. We need padding for ADDRESS32 CPUs to allow replaceWith to work on the intended types.
2979
2980         * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h:
2981
2982 2019-09-09  Zalan Bujtas  <zalan@apple.com>
2983
2984         [LFC][TFC] Introduce cell spacing.
2985         https://bugs.webkit.org/show_bug.cgi?id=201605
2986         <rdar://problem/55184009>
2987
2988         Reviewed by Antti Koivisto.
2989
2990         This patch adds support for horizontal and vertical cell spacing (border-spacing). Now LFC matches table geometry for simple table content with multiple columns and rows. 
2991
2992         * layout/FormattingContextGeometry.cpp:
2993         (WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const): Now we can use the generic, check the inflow content logic for table height.
2994         * layout/LayoutUnits.h:
2995         (WebCore::Layout::HorizontalEdges::width const):
2996         (WebCore::Layout::VerticalEdges::height const):
2997         * layout/Verification.cpp:
2998         (WebCore::Layout::verifyAndOutputSubtree):
2999         * layout/tableformatting/TableFormattingContext.cpp:
3000         (WebCore::Layout::TableFormattingContext::layout):
3001         (WebCore::Layout::TableFormattingContext::layoutTableCellBox):
3002         (WebCore::Layout::TableFormattingContext::positionTableCells):
3003         (WebCore::Layout::TableFormattingContext::setComputedGeometryForRows):
3004         (WebCore::Layout::TableFormattingContext::setComputedGeometryForSections):
3005         (WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints):
3006         (WebCore::Layout::TableFormattingContext::ensureTableGrid):
3007         (WebCore::Layout::TableFormattingContext::computePreferredWidthForColumns):
3008         (WebCore::Layout::TableFormattingContext::computedTableWidth):
3009         (WebCore::Layout::TableFormattingContext::useAsContentLogicalWidth):
3010         * layout/tableformatting/TableFormattingContext.h:
3011         * layout/tableformatting/TableFormattingContextGeometry.cpp:
3012         (WebCore::Layout::TableFormattingContext::Geometry::tableCellHeightAndMargin const):
3013         * layout/tableformatting/TableGrid.cpp:
3014         (WebCore::Layout::TableGrid::appendCell):
3015         (WebCore::Layout::TableGrid::widthConstraints const):
3016         (WebCore::Layout::TableGrid::ColumnsContext::useAsLogicalWidth): Deleted.
3017         * layout/tableformatting/TableGrid.h:
3018         (WebCore::Layout::TableGrid::setHorizontalSpacing):
3019         (WebCore::Layout::TableGrid::horizontalSpacing const):
3020         (WebCore::Layout::TableGrid::setVerticalSpacing):
3021         (WebCore::Layout::TableGrid::verticalSpacing const):
3022         (WebCore::Layout::TableGrid::ColumnsContext::logicalWidth const):
3023
3024 2019-09-09  Ryan Haddad  <ryanhaddad@apple.com>
3025
3026         Unreviewed, rolling out r249574.
3027
3028         Caused fast/mediastream/media-stream-track-source-failure.html
3029         to become flaky.
3030
3031         Reverted changeset:
3032
3033         "Remove MediaStreamPrivate::scheduleDeferredTask"
3034         https://bugs.webkit.org/show_bug.cgi?id=200975
3035         https://trac.webkit.org/changeset/249574
3036
3037 2019-09-09  Rob Buis  <rbuis@igalia.com>
3038
3039         [GTK][WPE] Remove attributes deprecated from MathML3
3040         https://bugs.webkit.org/show_bug.cgi?id=197492
3041
3042         Reviewed by Frédéric Wang.
3043
3044         Remove some MathML3 deprecated attributes:
3045         https://github.com/mathml-refresh/mathml/issues/5#issuecomment-475506856
3046
3047         This change also maps the dir attribute to direction for MathML Core.
3048
3049         Test: imported/w3c/web-platform-tests/mathml/relations/css-styling/attribute-mapping-001.html
3050
3051         * mathml/MathMLElement.cpp:
3052         (WebCore::MathMLElement::collectStyleForPresentationAttribute):
3053
3054 2019-09-09  Youenn Fablet  <youenn@apple.com>
3055
3056         Move checkProcessLocalPortForActivity from provider to registry
3057         https://bugs.webkit.org/show_bug.cgi?id=201400
3058
3059         Reviewed by Alex Christensen.
3060
3061         Update the registry to take a callback that is used to implement checkProcessLocalPortForActivity.
3062         This allows WK1 and WK2 to have their own implementation.
3063
3064         Make the call to checkProcessLocalPortForActivity directly on the registry.
3065         Remove unneeded worker checkProcessLocalPortForActivity method.
3066         No change of behavior.
3067
3068         * dom/messageports/MessagePortChannel.cpp:
3069         (WebCore::MessagePortChannel::checkRemotePortForActivity):
3070         * dom/messageports/MessagePortChannelProvider.h:
3071         * dom/messageports/MessagePortChannelProviderImpl.cpp:
3072         (WebCore::createMessagePortChannelRegistry):
3073         (WebCore::MessagePortChannelProviderImpl::MessagePortChannelProviderImpl):
3074         (WebCore::MessagePortChannelProviderImpl::checkProcessLocalPortForActivity): Deleted.
3075         * dom/messageports/MessagePortChannelProviderImpl.h:
3076         * dom/messageports/MessagePortChannelRegistry.cpp:
3077         (WebCore::MessagePortChannelRegistry::MessagePortChannelRegistry):
3078         (WebCore::MessagePortChannelRegistry::checkProcessLocalPortForActivity):
3079         * dom/messageports/MessagePortChannelRegistry.h:
3080         (WebCore::MessagePortChannelRegistry::provider): Deleted.
3081         * dom/messageports/WorkerMessagePortChannelProvider.cpp:
3082         (WebCore::WorkerMessagePortChannelProvider::checkProcessLocalPortForActivity): Deleted.
3083         * dom/messageports/WorkerMessagePortChannelProvider.h:
3084
3085 2019-09-08  Saam Barati  <sbarati@apple.com>
3086
3087         [WHLSL] Add back a version of the property resolver
3088         https://bugs.webkit.org/show_bug.cgi?id=201251
3089
3090         Reviewed by Robin Morisset.
3091
3092         This patch adds back the property resolver to aid in how we emit metal code.
3093         The goal of the new property resolver phase is to allow two things:
3094         1. For property access expressions, metal codegen should be allowed to evaluate
3095         the base, and if it's an index expression, the index, as many times as needed.
3096         So this patch ensures that if Metal evaluates such things, effects aren't performed
3097         more than once.
3098         
3099         2. For ReadModifyWrite expressions, metal codegen should be able to evaluate the
3100         leftValueExpression as many times as it'd like without performing the effects of
3101         leftValueExpression more than once.
3102         
3103         Here are a couple examples of this transformation:
3104         `a()[b()]` -> `(temp1 = a(), temp2 = b(), temp1[temp2])`
3105         `(*a())[b()] += 42;` -> `(temp1 = &*a(), temp2 = b(), (*temp1)[temp2] += 42)`
3106         
3107         The interesting rules break down like:
3108         - When the base is an lvalue, we take its address and replace the old base
3109         with a dereference of the new pointer variable.
3110         - When the base is an rvalue, we evaluate it and store it in a temporary
3111         variable, and switch the base to be a reference of that variable.
3112         - All indices are evaluated before the property access instruction and
3113         replaced with a reference to the temporary variable.
3114
3115         Test: webgpu/whlsl/property-evaluation-order.html
3116
3117         * Modules/webgpu/WHLSL/AST/WHLSLExpression.cpp:
3118         (WebCore::WHLSL::AST::Expression::mayBeEffectful const):
3119         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
3120         * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h:
3121         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
3122         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
3123         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
3124         * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp:
3125         (WebCore::WHLSL::findHighZombies):
3126         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
3127         (WebCore::WHLSL::PropertyResolver::handleLeftHandSideBase):
3128         (WebCore::WHLSL::PropertyResolver::handlePropertyAccess):
3129         (WebCore::WHLSL::resolveProperties):
3130
3131 2019-09-07  Chris Dumez  <cdumez@apple.com>
3132
3133         Add support for postMessage buffering between the service worker and window
3134         https://bugs.webkit.org/show_bug.cgi?id=201169
3135
3136         Reviewed by Youenn Fablet.
3137
3138         As per the Service Worker specification, a service worker client's message
3139         queue is initially disabled and only gets enabled after:
3140         - The DOMContentLoaded event has been fired
3141         or
3142         - The client sets the navigator.serviceWorker.onmessage event handler
3143         or
3144         - navigator.serviceWorker.startMessages() is called
3145
3146         While the message queue is disabled, messages posted by the service worker
3147         to the client simply get queued and only get processed once the queue gets
3148         enabled.
3149
3150         No new tests, rebaselined existing test.
3151
3152         * dom/Document.cpp:
3153         (WebCore::Document::finishedParsing):
3154         Call startMessages() on the ServiceWorkerContainer once the DOMContentLoaded event has
3155         been fired.
3156
3157         * dom/ScriptExecutionContext.cpp:
3158         (WebCore::ScriptExecutionContext::ensureServiceWorkerContainer):
3159         * dom/ScriptExecutionContext.h:
3160         * workers/service/SWClientConnection.cpp:
3161         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
3162         Fix a bug where a service worker would not be able to post a message to a client until
3163         that client has accessed navigator.serviceWorker (since the ServiceWorkerContainer is
3164         lazy initialized). To address the issue, we now initialize the ServiceWorkerContainer
3165         when a message is received from the service worker. Previously, messages were just
3166         getting dropped.
3167
3168         * workers/service/ServiceWorkerContainer.cpp:
3169         (WebCore::ServiceWorkerContainer::ServiceWorkerContainer):
3170         When the ServiceWorkerContainer is constructed, suspend its message queue if its context
3171         document is still parsing.
3172
3173         (WebCore::ServiceWorkerContainer::startMessages):
3174         Resume the message queue when startMessages() is called.
3175
3176         (WebCore::ServiceWorkerContainer::postMessage):
3177         Enqueue the event instead of firing it right away.
3178
3179         (WebCore::ServiceWorkerContainer::addEventListener):
3180         if navigator.serviceWorker.onmessage event handler gets set by the JavaScript, call
3181         startMessages().
3182
3183         * workers/service/ServiceWorkerContainer.h:
3184
3185 2019-09-07  Chris Dumez  <cdumez@apple.com>
3186
3187         [Service Workers] Drop support for registration resurrection
3188         https://bugs.webkit.org/show_bug.cgi?id=201584
3189
3190         Reviewed by Alex Christensen.
3191
3192         Drop support for registration resurrection (Unregistering then quickly re-registering would resurrect
3193         the original registration instead of creating a new one). This behavior is no longer in the
3194         specification (No more "isUninstalling" flag on the registration, and the registration is removed
3195         from the "scope to registration map" right away upon unregistering).
3196
3197         This resurrection behavior was causing a lot of flakiness in the tests so it is likely we will be able
3198         to unskip some tests. This is also what was causing the flakiness that caused Bug 201169 to be rolled
3199         out.
3200
3201         No new tests, updated existing tests.
3202
3203         * workers/service/server/SWServer.cpp:
3204         (WebCore::SWServer::activeWorkerFromRegistrationID):
3205         (WebCore::SWServer::getRegistration):
3206         (WebCore::SWServer::addRegistration):
3207         (WebCore::SWServer::removeRegistration):
3208         (WebCore::SWServer::getRegistrations):
3209         (WebCore::SWServer::clearAll):
3210         (WebCore::SWServer::clear):
3211         (WebCore::SWServer::terminatePreinstallationWorker):
3212         (WebCore::SWServer::didFinishActivation):
3213         (WebCore::SWServer::claim):
3214         (WebCore::SWServer::addClientServiceWorkerRegistration):
3215         (WebCore::SWServer::removeClientServiceWorkerRegistration):
3216         (WebCore::SWServer::installContextData):
3217         (WebCore::SWServer::runServiceWorker):
3218         (WebCore::SWServer::doRegistrationMatching):
3219         (WebCore::SWServer::registrationFromServiceWorkerIdentifier):
3220         (WebCore::SWServer::registerServiceWorkerClient):
3221         (WebCore::SWServer::unregisterServiceWorkerClient):
3222         (WebCore::SWServer::removeFromScopeToRegistrationMap):
3223         (WebCore::SWServer::performGetOriginsWithRegistrationsCallbacks):
3224         * workers/service/server/SWServer.h:
3225         * workers/service/server/SWServerJobQueue.cpp:
3226         (WebCore::SWServerJobQueue::runRegisterJob):
3227         (WebCore::SWServerJobQueue::runUnregisterJob):
3228         (WebCore::SWServerJobQueue::runUpdateJob):
3229         * workers/service/server/SWServerRegistration.cpp:
3230         (WebCore::SWServerRegistration::clear):
3231         (WebCore::SWServerRegistration::handleClientUnload):
3232         (WebCore::SWServerRegistration::isUnregistered const):
3233         * workers/service/server/SWServerRegistration.h:
3234         (WebCore::SWServerRegistration::scopeURLWithoutFragment const):
3235         * workers/service/server/SWServerWorker.cpp:
3236         (WebCore::SWServerWorker::SWServerWorker):
3237         (WebCore::m_scriptResourceMap):
3238         (WebCore::SWServerWorker::contextData const):
3239         (WebCore::SWServerWorker::skipWaiting):
3240         (WebCore::SWServerWorker::setHasPendingEvents):
3241         (WebCore::SWServerWorker::setState):
3242         (WebCore::SWServerWorker::registration const):
3243         * workers/service/server/SWServerWorker.h:
3244
3245 2019-09-07  Ryan Haddad  <ryanhaddad@apple.com>
3246
3247         Unreviewed, rolling out r249353.
3248
3249         The test for this change is a flaky failure.
3250
3251         Reverted changeset:
3252
3253         "Add support for postMessage buffering between the service
3254         worker and window"
3255         https://bugs.webkit.org/show_bug.cgi?id=201169
3256         https://trac.webkit.org/changeset/249353
3257
3258 2019-09-07  Alex Christensen  <achristensen@webkit.org>
3259
3260         Deprecate WKContextGetWebsiteDataStore
3261         https://bugs.webkit.org/show_bug.cgi?id=200050
3262
3263         Reviewed by Geoff Garen.
3264
3265         * platform/network/CacheValidation.cpp:
3266         (WebCore::collectVaryingRequestHeaders):
3267         (WebCore::verifyVaryingRequestHeaders):
3268         * platform/network/CacheValidation.h:
3269         Replace a few NetworkStorageSession& with NetworkStorageSession*
3270         so I can replace defaultStorageSession with the correct NetworkStorageSession in NetworkCache.cpp.
3271
3272 2019-09-06  Brent Fulgham  <bfulgham@apple.com>
3273
3274         [FTW] Minor cleanups to avoid crashes during web browsing
3275         https://bugs.webkit.org/show_bug.cgi?id=201572
3276
3277         Reviewed by Alexey Proskuryakov.
3278
3279         This patch addresses a few crashes seen when doing general web browsing using
3280         the FTW build of WebKit:
3281
3282         1. ImageBuffer::sinkIntoImage was attempting to use a render target after WTFMoving it elsewhere.
3283         2. ImageBuffer::copyNativeImage was not properly checking the type of the render
3284            target to make sure it was suitable for Bitmap operations.
3285         3. BackingStoreBackendDirect2DImpl::scroll would crash if the scroll offset was
3286            outside the bounds of the current view. In that case, it would attempt to allocate
3287            a zero-size texture, which triggered a crash.
3288
3289         * platform/graphics/win/BackingStoreBackendDirect2DImpl.cpp:
3290         (WebCore::BackingStoreBackendDirect2DImpl::scroll):
3291         * platform/graphics/win/ImageBufferDirect2D.cpp:
3292         (WebCore::ImageBuffer::sinkIntoImage):
3293         (WebCore::ImageBuffer::copyNativeImage const):
3294
3295 2019-09-06  Wenson Hsieh  <wenson_hsieh@apple.com>
3296
3297         Incorrect selection rect revealed after pasting images in a contenteditable element
3298         https://bugs.webkit.org/show_bug.cgi?id=201549
3299         <rdar://problem/50956429>
3300
3301         Reviewed by Simon Fraser.
3302
3303         Editor::replaceSelectionWithFragment currently scrolls to reveal the selection after inserting the given
3304         DocumentFragment. However, this scrolling occurs before any inserted images have loaded yet, which causes the
3305         wrong caret rect to be revealed, since all image elements inserted during paste will be empty.
3306
3307         To fix this, we defer revealing the selection after inserting the fragment until after all images that have
3308         been inserted are done loading. While waiting for images to load, if any layers which may be scrolled as a
3309         result of revealing the selection are scrolled, we additionally cancel the deferred selection reveal. See
3310         comments below for more detail.
3311
3312         Tests: editing/pasteboard/do-not-reveal-selection-after-programmatic-scroll.html
3313                editing/pasteboard/reveal-selection-after-pasting-images.html
3314                PasteImage.RevealSelectionAfterPastingImage
3315
3316         * editing/Editing.cpp:
3317         (WebCore::visibleImageElementsInRangeWithNonLoadedImages):
3318
3319         Add a new helper to iterate through a range and collect all image elements in that range, that contain cached
3320         images that have not finished loading yet.
3321
3322         * editing/Editing.h:
3323         * editing/Editor.cpp:
3324         (WebCore::Editor::replaceSelectionWithFragment):
3325
3326         Instead of always immediately revealing the selection after applying the ReplaceSelectionCommand, collect the
3327         image elements that were just inserted, and avoid immediately revealing the selection if any of these images
3328         have non-null cached images, but are not loaded yet. Instead, hold on to these images in a set, remove them once
3329         they finish loading using the new method below, and once all images are removed, reveal the selection.
3330
3331         (WebCore::Editor::revealSelectionIfNeededAfterLoadingImageForElement):
3332         (WebCore::Editor::renderLayerDidScroll):
3333
3334         Called whenever a scrollable RenderLayer is scrolled (or in the case of FrameView, the root layer). In the case
3335         where Editor is waiting to reveal the selection, we check to see if the scrolled layer is an ancestor of the
3336         layer enclosing the start of the selection.
3337
3338         (WebCore::Editor::respondToChangedSelection):
3339
3340         If the selection changes between pasting and waiting for pasted images to load, just cancel waiting to reveal
3341         the selection after pasting.
3342
3343         * editing/Editor.h:
3344         * editing/ReplaceSelectionCommand.cpp:
3345         (WebCore::ReplaceSelectionCommand::insertedContentRange const):
3346
3347         Add a helper method to grab the Range of content inserted after applying the command.
3348
3349         * editing/ReplaceSelectionCommand.h:
3350         * page/FrameView.cpp:
3351         (WebCore::FrameView::scrollPositionChanged):
3352         * page/FrameView.h:
3353         * page/Page.cpp:
3354         (WebCore::Page::didFinishLoadingImageForElement):
3355
3356         Notify Editor after an image finishes loading.
3357
3358         * rendering/RenderLayer.cpp:
3359         (WebCore::RenderLayer::scrollTo):
3360
3361 2019-09-06  Brent Fulgham  <bfulgham@apple.com>
3362
3363         PathDirect2D Cleanups
3364         https://bugs.webkit.org/show_bug.cgi?id=201534
3365
3366         Reviewed by Fujii Hironori.
3367
3368         1. Add a COMPtr<> move operator.
3369         2. Reduce copying ID2D1Geometry objects.
3370         3. Protect against using the ID2D1PathGeometry after the
3371            ID2D1GeometrySink's Close operation is used.
3372         4. Add a debug-only 'refCount' function to COMPtr to help
3373            track down memory errors.
3374
3375         * platform/graphics/Path.h:
3376         (WebCore::Path::activePath const): Deleted.
3377         * platform/graphics/win/Direct2DOperations.cpp:
3378         (WebCore::Direct2D::fillPath):
3379         (WebCore::Direct2D::drawPath):
3380         * platform/graphics/win/PathDirect2D.cpp:
3381         * platform/win/COMPtr.h:
3382         (COMPtr::COMPtr):
3383         (=):
3384         (refCount):
3385
3386 2019-09-06  Chris Dumez  <cdumez@apple.com>
3387
3388         Move the ResourceLoadObserver logic to WebKit2
3389         https://bugs.webkit.org/show_bug.cgi?id=201517
3390
3391         Reviewed by Brent Fulgham.
3392
3393         Move the ResourceLoadObserver logic to WebKit2 since it is not used by WebKit1. This allows us to simplify
3394         code.
3395
3396         In a follow-up patch, I will simplify the code even further by leveraging the fact that a WebContent process
3397         is always associated with a single WebsiteDataStore / sessionID:
3398         - No need for a HashMap of sessionIDs
3399         - No need to even allocate the ResourceLoadObserver if the WebProcess is associated with an ephemeral session.
3400
3401         * dom/Document.h:
3402         * loader/ResourceLoadObserver.cpp:
3403         (WebCore::sharedObserver):
3404         (WebCore::ResourceLoadObserver::setShared):
3405         (WebCore::ResourceLoadObserver::shared):
3406         * loader/ResourceLoadObserver.h:
3407         (WebCore::ResourceLoadObserver::~ResourceLoadObserver):
3408         (WebCore::ResourceLoadObserver::logSubresourceLoading):
3409         (WebCore::ResourceLoadObserver::logWebSocketLoading):
3410         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3411         (WebCore::ResourceLoadObserver::logFontLoad):
3412         (WebCore::ResourceLoadObserver::logCanvasRead):
3413         (WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
3414         (WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
3415         (WebCore::ResourceLoadObserver::logScreenAPIAccessed):
3416         (WebCore::ResourceLoadObserver::statisticsForURL):
3417         (WebCore::ResourceLoadObserver::updateCentralStatisticsStore):
3418         (WebCore::ResourceLoadObserver::clearState):
3419         (WebCore::ResourceLoadObserver::setShouldLogUserInteraction):
3420         * page/DeprecatedGlobalSettings.h:
3421
3422 2019-09-06  Justin Fan  <justin_fan@apple.com>
3423
3424         [WebGPU] Update several interface and enum names to match spec
3425         https://bugs.webkit.org/show_bug.cgi?id=201564
3426
3427         Reviewed by Dean Jackson.
3428
3429         Rename GPUShaderStageBit -> GPUShaderStage.
3430         Rename GPUColorWriteBits -> GPUColorWrite.
3431         Rename TRANSFER_SRC/DST -> COPY_SRC/DST.
3432         Rename GPUPipelineStageDescriptor -> GPUProgrammableStageDescriptor.
3433
3434         Existing tests trivially updated to match.
3435
3436         * CMakeLists.txt:
3437         * DerivedSources-input.xcfilelist:
3438         * DerivedSources-output.xcfilelist:
3439         * DerivedSources.make:
3440         * Modules/webgpu/GPUBindGroupLayoutBinding.h:
3441         * Modules/webgpu/GPUBufferUsage.idl:
3442         * Modules/webgpu/GPUColorStateDescriptor.idl:
3443         * Modules/webgpu/GPUColorWrite.idl: Renamed from Source/WebCore/Modules/webgpu/GPUColorWriteBits.idl.
3444         * Modules/webgpu/GPUShaderStage.h: Renamed from Source/WebCore/Modules/webgpu/GPUShaderStageBit.h.
3445         * Modules/webgpu/GPUShaderStage.idl: Renamed from Source/WebCore/Modules/webgpu/GPUShaderStageBit.idl.
3446         * Modules/webgpu/GPUTextureUsage.idl:
3447         * Modules/webgpu/WebGPUComputePipelineDescriptor.cpp:
3448         (WebCore::WebGPUComputePipelineDescriptor::tryCreateGPUComputePipelineDescriptor const):
3449         * Modules/webgpu/WebGPUComputePipelineDescriptor.h:
3450         * Modules/webgpu/WebGPUComputePipelineDescriptor.idl:
3451         * Modules/webgpu/WebGPUDevice.cpp:
3452         * Modules/webgpu/WebGPUProgrammableStageDescriptor.cpp: Renamed from Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.cpp.
3453         (WebCore::WebGPUProgrammableStageDescriptor::tryCreateGPUProgrammableStageDescriptor const):
3454         * Modules/webgpu/WebGPUProgrammableStageDescriptor.h: Renamed from Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.h.
3455         * Modules/webgpu/WebGPUProgrammableStageDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.idl.
3456         * Modules/webgpu/WebGPURenderPipelineDescriptor.cpp:
3457         (WebCore::WebGPURenderPipelineDescriptor::tryCreateGPURenderPipelineDescriptor const):
3458         * Modules/webgpu/WebGPURenderPipelineDescriptor.h:
3459         * Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
3460         * Sources.txt:
3461         * WebCore.xcodeproj/project.pbxproj:
3462         * bindings/js/WebCoreBuiltinNames.h:
3463         * platform/graphics/gpu/GPUBuffer.h:
3464         (WebCore::GPUBuffer::isCopySource const):
3465         (WebCore::GPUBuffer::isCopyDestination const):
3466         (WebCore::GPUBuffer::isTransferSource const): Deleted.
3467         (WebCore::GPUBuffer::isTransferDestination const): Deleted.
3468         * platform/graphics/gpu/GPUBufferUsage.h:
3469         * platform/graphics/gpu/GPUColorStateDescriptor.h:
3470         * platform/graphics/gpu/GPUColorWrite.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUColorWriteBits.h.
3471         * platform/graphics/gpu/GPUComputePipelineDescriptor.h:
3472         (WebCore::GPUComputePipelineDescriptor::GPUComputePipelineDescriptor):
3473         * platform/graphics/gpu/GPUPipelineDescriptorBase.h:
3474         * platform/graphics/gpu/GPUProgrammableStageDescriptor.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUPipelineStageDescriptor.h.
3475         (WebCore::GPUProgrammableStageDescriptor::GPUProgrammableStageDescriptor):
3476         * platform/graphics/gpu/GPURenderPipelineDescriptor.h:
3477         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
3478         * platform/graphics/gpu/GPUTexture.h:
3479         (WebCore::GPUTexture::isCopySource const):
3480         (WebCore::GPUTexture::isCopyDestination const):
3481         (WebCore::GPUTexture::isReadOnly const):
3482         (WebCore::GPUTexture::isTransferSource const): Deleted.
3483         (WebCore::GPUTexture::isTransferDestination const): Deleted.
3484         * platform/graphics/gpu/GPUTextureUsage.h:
3485         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
3486         (WebCore::GPUBindGroupLayout::tryCreate):
3487         * platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm:
3488         (WebCore::GPUBindGroup::tryCreate):
3489         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
3490         * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm:
3491         (WebCore::GPUCommandBuffer::copyBufferToBuffer):
3492         (WebCore::GPUCommandBuffer::copyBufferToTexture):
3493         (WebCore::GPUCommandBuffer::copyTextureToBuffer):
3494         (WebCore::GPUCommandBuffer::copyTextureToTexture):
3495         * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
3496         (WebCore::trySetFunctions):
3497         * platform/graphics/gpu/cocoa/GPUPipelineMetalConvertLayout.cpp:
3498         (WebCore::convertShaderStageFlags):
3499         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
3500         (WebCore::mtlColorWriteMaskForGPUColorWriteFlags):
3501         (WebCore::trySetFunctions):
3502         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
3503         (WebCore::mtlTextureUsageForGPUTextureUsageFlags):
3504
3505 2019-09-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
3506
3507         REGRESSION (r249367): m_decodingPromises grows indefinitely until ImageLoader destruction
3508         https://bugs.webkit.org/show_bug.cgi?id=201402
3509
3510         Reviewed by Youenn Fablet and Daniel Bates.
3511
3512         Add the static functions resolvePromises() and rejectPromises(). These 
3513         functions take an lvalue reference to a Vector of promises. Inside them,
3514         the lvalue reference argument are exchanged with an empty Vector of
3515         promises then the promises are processed. This clears m_decodingPromises
3516         and fixes the leak.
3517
3518         Add an internal API which returns the count of the pending promises of
3519         an HTMLImageElement. This internal API will be used in the attached test.
3520
3521         Test: fast/images/decode-resolve-reject-no-leak.html
3522
3523         * html/HTMLImageElement.h:
3524         (WebCore::HTMLImageElement::pendingDecodePromisesCountForTesting const):
3525         * loader/ImageLoader.cpp:
3526         (WebCore::resolvePromises):
3527         ImageLoader::decode() calls BitmapImage::decode() and moves m_decodingPromises
3528         in capture. When decoding finishes, this function is called to resolve the
3529         promises. But ImageLoader might get deleted before the image decoding
3530         finishes. So this function has to be static.
3531
3532         (WebCore::rejectPromises):
3533         (WebCore::ImageLoader::resolveDecodePromises):
3534         (WebCore::ImageLoader::rejectDecodePromises):
3535         (WebCore::ImageLoader::notifyFinished):
3536         (WebCore::ImageLoader::decode):
3537         (WebCore::resolveDecodePromises): Deleted.
3538         (WebCore::rejectDecodePromises): Deleted.
3539         * loader/ImageLoader.h:
3540         (WebCore::ImageLoader::pendingDecodePromisesCountForTesting const):
3541         * testing/Internals.cpp:
3542         (WebCore::Internals::imagePendingDecodePromisesCountForTesting):
3543         * testing/Internals.h:
3544         * testing/Internals.idl:
3545
3546 2019-09-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
3547
3548         Prefer null namespace 'href' over 'xlink:href' on SVG elements
3549         https://bugs.webkit.org/show_bug.cgi?id=195802
3550
3551         Reviewed by Youenn Fablet.
3552
3553         -- When the attribute "href" is set, its value is always reflected in
3554            SVGURIReference::m_href.
3555
3556         -- When the attribute "href" is removed, the value of the attribute
3557            "xlink:href" is always reflected in SVGURIReference::m_href.
3558
3559         -- When the "xlink:href" is set, its value is reflected in
3560            SVGURIReference::m_href only if the attribute "href" is not set.
3561
3562         Tests: svg/custom/href-xlink-href-gradient-element-expected.svg
3563                svg/custom/href-xlink-href-gradient-element.svg
3564                svg/custom/href-xlink-href-use-element-expected.svg
3565                svg/custom/href-xlink-href-use-element.svg
3566
3567         * svg/SVGURIReference.cpp:
3568         (WebCore::SVGURIReference::parseAttribute):
3569
3570 2019-09-06  Zalan Bujtas  <zalan@apple.com>
3571
3572         [LFC][TFC] Set computed row width.
3573         https://bugs.webkit.org/show_bug.cgi?id=201533
3574         <rdar://problem/55098828>
3575
3576         Reviewed by Antti Koivisto.
3577
3578         Decouple cell box layout/display box setup and set the computed row width.    
3579
3580         * layout/Verification.cpp:
3581         (WebCore::Layout::LayoutState::verifyAndOutputMismatchingLayoutTree const):
3582         * layout/tableformatting/TableFormattingContext.cpp:
3583         (WebCore::Layout::TableFormattingContext::layout):
3584
3585 2019-09-06  Zalan Bujtas  <zalan@apple.com>
3586
3587         [LFC] A formatting context root is always a containing block for relative: static boxes.
3588         https://bugs.webkit.org/show_bug.cgi?id=201554
3589         <rdar://problem/55123295>
3590
3591         Reviewed by Antti Koivisto.
3592
3593         "For other elements, if the element's position is 'relative' or 'static', the containing block is formed by the content
3594         edge of the nearest ancestor box that is a block container or which establishes a formatting context."
3595
3596         * layout/layouttree/LayoutBox.cpp:
3597         (WebCore::Layout::Box::containingBlock const):
3598         * page/FrameViewLayoutContext.cpp:
3599         (WebCore::layoutUsingFormattingContext):
3600
3601 2019-09-06  Sihui Liu  <sihui_liu@apple.com>
3602
3603         IndexedDB: use SQL COUNT statement for count operation
3604         https://bugs.webkit.org/show_bug.cgi?id=201465
3605
3606         Reviewed by Geoffrey Garen.
3607
3608         We did count operation by moving objectStore/index iterator from begin to end and counting the steps. We can
3609         utilize the SQL COUNT statement, and improve the performance further by caching the statement.
3610
3611         Tested on release build minibrowser. Without the change, the mean time to complete one iteration in 
3612         PerformanceTests/IndexedDB/basic/index-count.html and PerformanceTests/IndexedDB/basic/objectStore-count.html is
3613         about 50ms. With the change it is about 2ms.
3614
3615         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
3616         (WebCore::IDBServer::SQLiteIDBBackingStore::getCount):
3617         (WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatement):
3618         (WebCore::IDBServer::SQLiteIDBBackingStore::closeSQLiteDB):
3619         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
3620
3621 2019-09-06  Alex Christensen  <achristensen@webkit.org>
3622
3623         When disabling legacy private browsing for testing, change the SessionID back to what it was, not the defaultSessionID
3624         https://bugs.webkit.org/show_bug.cgi?id=201480
3625
3626         Reviewed by Youenn Fablet.
3627
3628         No change in behavior, but this blocks bug 200050 which will make WebKitTestRunner use a persistent, non-default session.
3629         Without this change, that change causes lots of test failures because we are switching from the legacy private browsing session
3630         to the default session instead of the session we were using.
3631
3632         * page/Page.cpp:
3633         (WebCore::Page::enableLegacyPrivateBrowsing): Deleted.
3634         * page/Page.h:
3635         * page/PageGroup.cpp:
3636         (WebCore::PageGroup::addPage):
3637         (WebCore::PageGroup::setSessionIDForTesting):
3638         (WebCore::PageGroup::enableLegacyPrivateBrowsingForTesting): Deleted.
3639         * page/PageGroup.h:
3640         * storage/StorageNamespaceProvider.cpp:
3641         (WebCore::StorageNamespaceProvider::setSessionIDForTesting):
3642         (WebCore::StorageNamespaceProvider::enableLegacyPrivateBrowsingForTesting): Deleted.
3643         * storage/StorageNamespaceProvider.h:
3644
3645 2019-09-06  Youenn Fablet  <youenn@apple.com>
3646
3647         Remove MediaStreamPrivate::scheduleDeferredTask
3648         https://bugs.webkit.org/show_bug.cgi?id=200975
3649
3650         Reviewed by Eric Carlson.
3651
3652         All calls to scheduleDeferredTask are done on the main thread.
3653         This was initially done to trigger less reconfiguration.
3654         But this makes the implementation significantly more complex.
3655
3656         For instance, we have to wait for the document to update its media state
3657         and send it to UIProcess before calling the allow completion handler.
3658
3659         Covered by existing tests.
3660
3661         * Modules/mediastream/MediaStream.cpp:
3662         (WebCore::MediaStream::MediaStream):
3663         Make sure to update the document media state once the tracks have been added, similarly to the other constructor.
3664         This ensures the document media state is computed with the new MediaStreamTrack.
3665         * Modules/mediastream/UserMediaRequest.cpp:
3666         (WebCore::isMediaStreamCorrectlyStarted):
3667         (WebCore::UserMediaRequest::allow):
3668         (WebCore::UserMediaRequest::stop):
3669         (WebCore::UserMediaRequest::mediaStreamDidFail):
3670         * Modules/mediastream/UserMediaRequest.h:
3671         * page/MediaProducer.h:
3672         (WebCore::MediaProducer::isCapturing):
3673         Make sure to include getDisplayMedia as part of capture check.
3674         * platform/mediastream/MediaStreamPrivate.cpp:
3675         (WebCore::MediaStreamPrivate::trackMutedChanged):
3676         (WebCore::MediaStreamPrivate::trackEnabledChanged):
3677         (WebCore::MediaStreamPrivate::trackStarted):
3678         (WebCore::MediaStreamPrivate::trackEnded):
3679         * platform/mediastream/MediaStreamPrivate.h:
3680
3681 2019-09-06  Rob Buis  <rbuis@igalia.com>
3682
3683         Implement MathML DOM
3684         https://bugs.webkit.org/show_bug.cgi?id=200470
3685
3686         Reviewed by Ryosuke Niwa.
3687
3688         Expose MathML DOM as specified here [1].
3689
3690         [1] https://mathml-refresh.github.io/mathml-core/#dom-mathmlelement
3691
3692         Tests: imported/w3c/web-platform-tests/mathml/relations/html5-tree/clipboard-event-handlers.tentative.html
3693                imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-dynamic.tentative.html
3694                imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-interface.tentative.html
3695                imported/w3c/web-platform-tests/mathml/relations/html5-tree/html-or-foreign-element-interfaces.tentative.html
3696                imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-4.html
3697                imported/w3c/web-platform-tests/mathml/relations/html5-tree/math-global-event-handlers.tentative.html
3698                mathml/focus-event-handling.html
3699                mathml/tabindex-order.html
3700
3701         * CMakeLists.txt:
3702         * DerivedSources-input.xcfilelist:
3703         * DerivedSources-output.xcfilelist:
3704         * DerivedSources.make:
3705         * Sources.txt:
3706         * WebCore.xcodeproj/project.pbxproj:
3707         * bindings/js/JSElementCustom.cpp:
3708         (WebCore::createNewElementWrapper):
3709         * bindings/js/JSNodeCustom.cpp:
3710         (WebCore::createWrapperInline):
3711         * mathml/MathMLElement.cpp:
3712         (WebCore::MathMLElement::parseAttribute):
3713         * mathml/MathMLElement.idl: Copied from Source/WebCore/html/HTMLOrForeignElement.idl.
3714         * mathml/MathMLMathElement.idl: Copied from Source/WebCore/html/HTMLOrForeignElement.idl.
3715         * mathml/mathtags.in:
3716
3717 2019-09-06  Zan Dobersek  <zdobersek@igalia.com>
3718
3719         [GStreamer] YUV buffers on iMX platforms have to be treated as RGBA
3720         https://bugs.webkit.org/show_bug.cgi?id=201537
3721
3722         Reviewed by Philippe Normand.
3723
3724         The imxvpudecoder element on iMX platforms decodes YUV data in a
3725         platform-specific way, gathering the YUV data in a single texture and
3726         then relying on the sampler in the Vivante graphics drivers to
3727         automagically decode that YUV data into RGBA values.
3728
3729         To correctly display such decoded data, we have to represent that
3730         single texture as an RGBA texture, even when the GStreamer buffer is
3731         crafted as containing planar YUV data.
3732
3733         * platform/graphics/gstreamer/GStreamerCommon.h:
3734         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3735         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
3736         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3737         (WebCore::GstVideoFrameHolder::GstVideoFrameHolder):
3738         (WebCore::GstVideoFrameHolder::platformLayerBuffer):
3739         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
3740         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
3741         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
3742         (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture):
3743         (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
3744         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3745
3746 2019-09-06  Andres Gonzalez  <andresg_22@apple.com>
3747
3748         AccessibilityRenderObject::setSelectedTextRange fails to set the selection passed an empty line.
3749         https://bugs.webkit.org/show_bug.cgi?id=201518
3750         <rdar://problem/54835122>
3751
3752         Reviewed by Ryosuke Niwa.
3753
3754         Test: accessibility/set-selected-text-range-after-newline.html
3755
3756         In the case of an empty line, the CharacterIterator range start and end
3757         were not equal, thus we were not advancing the iterator and returning
3758         the iterator range end, which is not correct. With this change we are
3759         always advancing the iterator if its text is just '\n'. This covers all
3760         the cases we fixed before plus empty lines.
3761
3762         * editing/Editing.cpp:
3763         (WebCore::visiblePositionForIndexUsingCharacterIterator):
3764
3765 2019-09-05  Fujii Hironori  <Hironori.Fujii@sony.com>
3766
3767         [Win] Add support for MouseEvent.buttons
3768         https://bugs.webkit.org/show_bug.cgi?id=201445
3769
3770         Reviewed by Brent Fulgham.
3771
3772         Spec: <https://www.w3.org/TR/uievents/#dom-mouseevent-buttons>
3773
3774         * platform/win/GDIUtilities.h:
3775         (buttonsForEvent): Added.
3776         * platform/win/PlatformMouseEventWin.cpp:
3777         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
3778         Set m_buttons.
3779
3780 2019-09-05  Fujii Hironori  <Hironori.Fujii@sony.com>
3781
3782         [Win] Support Per-Monitor (V2) DPI Awareness
3783         https://bugs.webkit.org/show_bug.cgi?id=201450
3784
3785         Reviewed by Don Olmstead.
3786
3787         * platform/win/GDIUtilities.cpp:
3788         (WebCore::deviceScaleFactorForWindow): Use GetDpiForWindow if available by using soft linking.
3789
3790 2019-09-05  Charlie Turner  <cturner@igalia.com>
3791
3792         [EME] Introduce a Proxy CDM for thread-safe access to CDM instances from background decryption threads
3793         https://bugs.webkit.org/show_bug.cgi?id=201339
3794
3795         Reviewed by Xabier Rodriguez-Calvar.
3796
3797         Covered by existing tests.
3798
3799         * platform/encryptedmedia/CDMInstance.h:
3800         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
3801         (WebCore::isolatedKey):
3802         (WebCore::ProxyCDMClearKey::isolatedKeys const):
3803         (WebCore::CDMInstanceClearKey::CDMInstanceClearKey):
3804         * platform/encryptedmedia/clearkey/CDMClearKey.h:
3805         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3806         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
3807         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
3808         (handleKeyResponse):
3809         (findAndSetKey):
3810         (decrypt):
3811         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
3812         (isCDMInstanceAvailable):
3813         (sinkEventHandler):
3814         (setContext):
3815         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
3816         * testing/MockCDMFactory.cpp:
3817         (WebCore::MockCDMInstance::proxyCDM const):
3818         * testing/MockCDMFactory.h:
3819
3820 2019-09-05  Zalan Bujtas  <zalan@apple.com>
3821
3822         [LFC] LayoutState should not need the initial containing block
3823         https://bugs.webkit.org/show_bug.cgi?id=201511
3824         <rdar://problem/55079241>
3825
3826         Reviewed by Antti Koivisto.
3827
3828         Throw-away layouts should just be able to initialize a dedicated LayoutState without passing in the ICB.
3829
3830         * layout/LayoutState.cpp:
3831         (WebCore::Layout::LayoutState::markNeedsUpdate):
3832         (WebCore::Layout::LayoutState::run):
3833         (WebCore::Layout::LayoutState::LayoutState): Deleted.
3834         * layout/LayoutState.h:
3835         (WebCore::Layout::LayoutState::initialContainingBlock const): Deleted.
3836         * layout/Verification.cpp:
3837         (WebCore::Layout::LayoutState::verifyAndOutputMismatchingLayoutTree const):
3838         * layout/floats/FloatingContext.cpp: Fix a (very sad)typo.
3839         (WebCore::Layout::FloatingContext::constraints const):
3840         * layout/layouttree/LayoutTreeBuilder.cpp:
3841         (WebCore::Layout::printLayoutTreeForLiveDocuments):
3842
3843 2019-09-05  Justin Fan  <justin_fan@apple.com>
3844
3845         [WebGPU] Implement GPUUncapturedErrorEvent
3846         https://bugs.webkit.org/show_bug.cgi?id=199676
3847
3848         Reviewed by Dean Jackson.
3849
3850         Implement GPUUncapturedErrorEvent and "uncapturederror" event name.
3851         Add the onuncapturederror EventHandler attribute to GPUDevice.
3852
3853         Test: webgpu/uncaptured-errors.html
3854
3855         * CMakeLists.txt:
3856         * DerivedSources-input.xcfilelist:
3857         * DerivedSources-output.xcfilelist:
3858         * DerivedSources.make:
3859         * Modules/webgpu/GPUUncapturedErrorEvent.cpp:
3860         (WebCore::GPUUncapturedErrorEvent::create):
3861         (WebCore::GPUUncapturedErrorEvent::GPUUncapturedErrorEvent):
3862         (WebCore::GPUUncapturedErrorEvent::eventInterface const):
3863         * Modules/webgpu/GPUUncapturedErrorEvent.h:
3864         * Modules/webgpu/GPUUncapturedErrorEvent.idl:
3865         * Modules/webgpu/WebGPUAdapter.cpp: Must now provide ScriptExecutionContext to any created GPUDevice.
3866         (WebCore::WebGPUAdapter::requestDevice const):
3867         * Modules/webgpu/WebGPUAdapter.h:
3868         * Modules/webgpu/WebGPUAdapter.idl:
3869         * Modules/webgpu/WebGPUDevice.cpp: Is now an EventTarget.
3870         (WebCore::WebGPUDevice::tryCreate):
3871         (WebCore::WebGPUDevice::WebGPUDevice):
3872         (WebCore::printValidationErrorToConsole):
3873         (WebCore::WebGPUDevice::dispatchUncapturedError): Events should only be fired from the main thread.
3874         * Modules/webgpu/WebGPUDevice.h:
3875         * Modules/webgpu/WebGPUDevice.idl:
3876         * Modules/webgpu/WebGPUDeviceEventHandler.idl:
3877         * Sources.txt:
3878         * WebCore.xcodeproj/project.pbxproj:
3879         * bindings/js/WebCoreBuiltinNames.h:
3880         * dom/EventNames.h:
3881         * dom/EventNames.in:
3882         * dom/EventTargetFactory.in:
3883         * platform/graphics/gpu/GPUError.cpp: GPUErrors can only be created internally; creation should never fail.
3884         (WebCore::createError):
3885         * platform/graphics/gpu/GPUError.h:
3886         * platform/graphics/gpu/GPUErrorScopes.cpp:
3887         (WebCore::GPUErrorScopes::create):
3888         (WebCore::GPUErrorScopes::GPUErrorScopes):
3889         (WebCore::GPUErrorScopes::generateError): Use a callback for now, since GPUErrorScopes is still under platform.
3890         * platform/graphics/gpu/GPUErrorScopes.h:
3891         (WebCore::GPUErrorScopes::create): Deleted.
3892
3893 2019-09-05  Antti Koivisto  <antti@apple.com>
3894
3895         Generate event region for both the main graphics layer and the scrolled contents layer
3896         https://bugs.webkit.org/show_bug.cgi?id=201487
3897
3898         Reviewed by Simon Fraser.
3899
3900         We currently generate region for one of them only. With borders both need it.
3901         
3902         Also share more code with painting paths.
3903
3904         * rendering/RenderLayerBacking.cpp:
3905         (WebCore::RenderLayerBacking::updateEventRegion):
3906
3907         Generate region for both layers.
3908
3909         (WebCore::RenderLayerBacking::paintIntoLayer):
3910
3911         Add event region context parameter so we can use this function for event region update too.
3912
3913         * rendering/RenderLayerBacking.h:
3914
3915 2019-09-05  Ryosuke Niwa  <rniwa@webkit.org>
3916
3917         REGRESSION (iOS 13): Bulleted list copied from Notes to Mail results in Times New Roman
3918         https://bugs.webkit.org/show_bug.cgi?id=201490
3919
3920         Reviewed by Daniel Bates.
3921
3922         The bug was caused by an element in the pasted content not having any explicit font name resolving
3923         to use the font-family value of `-webkit-standard`. When such an inline style is inserted into
3924         Mail's WKWebView which sets a different font family, ReplaceSelectionCommand would fail to strip away,
3925         making the pasted content using the default font family of Times New Roman.
3926
3927         Fixed the bug by stripping away font-family set to -webkit-standard in the sanitization document
3928         since that's indicative of the pasted content not having any font family being specified.
3929
3930         In the future, we should consider making regular copy (as opposed to the copy for sanitization)
3931         resolve generic font family names to concrete font names since different WKWebView might be using
3932         different concrete font names. Unfortuantely, such a change is quite involved and risky since various
3933         paste side code in EditingStyle that removes redundant inline styles (i.e. redundant `font-family`)
3934         need to be aware of this special font family resolution.
3935
3936         Tests: editing/pasteboard/paste-cocoa-writer-markup-with-webkit-standard-font-family.html
3937                PasteHTML.DoesNotAddStandardFontFamily
3938
3939         * editing/EditingStyle.cpp:
3940         (WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement):
3941         (WebCore::EditingStyle::wrappingStyleForSerialization):
3942         (WebCore::familyNameFromCSSPrimitiveValue): Added.
3943         (WebCore::loneFontFamilyName): Extracted from usesForbiddenSystemFontAsOnlyFontFamilyName. Fixed
3944         a bug that it was not handling the case when `font-family` property's value is a CSSPrimitiveValue
3945         instead of a CSSValueList.
3946         (WebCore::usesForbiddenSystemFontAsOnlyFontFamilyName): Deleted.
3947         (WebCore::EditingStyle::mergeStyleFromRulesForSerialization): Remove `font-family` property when
3948         StandardFontFamilySerializationMode::Strip is specified and its value is `-webkit-standard`.
3949         * editing/EditingStyle.h:
3950         * editing/markup.cpp:
3951         (WebCore::StyledMarkupAccumulator::StyledMarkupAccumulator): Added
3952         StandardFontFamilySerializationMode as an argument.
3953         (WebCore::StyledMarkupAccumulator::appendStartTag):
3954         (WebCore::StyledMarkupAccumulator::serializeNodes):
3955         (WebCore::serializePreservingVisualAppearanceInternal): Ditto.
3956         (WebCore::serializePreservingVisualAppearance): Use StandardFontFamilySerializationMode::Keep
3957         to preserve the pre-existing behavior.
3958         (WebCore::sanitizedMarkupForFragmentInDocument): Use StandardFontFamilySerializationMode::Strip
3959         as this is the code used by sanitization code.
3960
3961 2019-09-05  Chris Fleizach  <cfleizach@apple.com>
3962
3963         AX: children cache are not re-computed if tab index is removed
3964         https://bugs.webkit.org/show_bug.cgi?id=201502
3965
3966         Reviewed by Zalan Bujtas.
3967
3968         Test: accessibility/tabindex-removed.html
3969
3970