[Web Animations] Implement more CSSPropertyBlendingClient methods
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-03-28  Antoine Quint  <graouts@apple.com>
2
3         [Web Animations] Implement more CSSPropertyBlendingClient methods
4         https://bugs.webkit.org/show_bug.cgi?id=184077
5
6         Reviewed by Dean Jackson.
7
8         We only had stubs for several of the CSSPropertyBlendingClient methods and thus always implied that we
9         were animating non-matching transform, filter and backdrop-filter properties. We now implement those using
10         the same code used in KeyframeAnimation. This allows for 31 new tests to opt into the CSS Animations and
11         CSS Transitions as Web Animations feature.
12
13         We also ensure we only run a CSSAnimationController assertion in FrameView::didDestroyRenderTree() if
14         we're not using the CSS Animations and CSS Transitions as Web Animations feature.
15
16         * animation/KeyframeEffectReadOnly.cpp:
17         (WebCore::KeyframeEffectReadOnly::copyPropertiesFromSource):
18         (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes):
19         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
20         (WebCore::KeyframeEffectReadOnly::checkForMatchingTransformFunctionLists):
21         (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists):
22         (WebCore::KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists):
23         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes):
24         (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes):
25         * animation/KeyframeEffectReadOnly.h:
26         * page/FrameView.cpp:
27         (WebCore::FrameView::didDestroyRenderTree):
28
29 2018-03-28  Chris Dumez  <cdumez@apple.com>
30
31         Align XMLHttpRequest's open() / send() / abort() with the latest specification
32         https://bugs.webkit.org/show_bug.cgi?id=184108
33
34         Reviewed by Youenn Fablet.
35
36         Align XMLHttpRequest's open() / send() / abort() with the latest specification:
37         - https://xhr.spec.whatwg.org
38
39         No new tests, rebaselined existing layout tests.
40
41         * xml/XMLHttpRequest.cpp:
42         (WebCore::XMLHttpRequest::open):
43         Align with https://xhr.spec.whatwg.org/#the-open()-method:
44         - Change the order of some steps to match the order in the spec. In particular,
45           open() no longer resets the state to UNSENT or abort any existing load when it
46           fails early due to being passed a bad method.
47
48         (WebCore::XMLHttpRequest::createRequest):
49         Align with https://xhr.spec.whatwg.org/#the-send()-method:
50         - Use the simpler "upload listener flag" logic from the spec instead of our more
51           complex m_uploadEventsAllowed flag. This avoids constructing a SecurityOrigin
52           objects on a background thread when XHR is used inside Web Workers, which was
53           not thread-safe.
54         - Set the upload complete flag when the request has no body as per step 9.
55         - After firing the loadstartEvent, return early if the state is no longer OPEN or
56           if the send flag is unset, as per step 11.3.
57
58         (WebCore::XMLHttpRequest::abort):
59         Align with https://xhr.spec.whatwg.org/#the-abort()-method:
60         - Only set the state to UNSENT if the state is still DONE after firing the error
61           events, as per step 3.
62
63         (WebCore::XMLHttpRequest::didSendData):
64         Use new "upload listener flag".
65
66         (WebCore::XMLHttpRequest::dispatchErrorEvents):
67         Align with https://xhr.spec.whatwg.org/#request-error-steps:
68         - Stop firing a progress event in case of error as this is not as per specification
69           and Firefox does not fire those either.
70
71         * xml/XMLHttpRequest.h:
72
73 2018-03-28  Timothy Hatcher  <timothy@apple.com>
74
75         Consolidate NSColor to WebCore::Color conversion and fix system colors.
76
77         https://bugs.webkit.org/show_bug.cgi?id=184096
78         rdar://problem/38918925
79
80         Reviewed by Tim Horton.
81
82         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
83         (CreateCGColorIfDifferent): Use CGColor property on NSColor, don't manually create new CGColor.
84         * platform/graphics/mac/ColorMac.h:
85         * platform/graphics/mac/ColorMac.mm:
86         (WebCore::makeRGBAFromNSColor): Move pattern code from RenderThemeMac's convertNSColorToColor.
87         Also use nextafter for proper RGBA float conversion.
88         * platform/mac/PlatformPasteboardMac.mm:
89         (WebCore::PlatformPasteboard::color): Use colorFromNSColor.
90         * rendering/RenderThemeMac.mm:
91         (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const): Use colorFromNSColor.
92         (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const): Ditto.
93         (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const): Ditto.
94         (WebCore::RenderThemeMac::systemColor const): Ditto.
95         (WebCore::paintAttachmentTitleBackground): Ditto.
96         (WebCore::convertNSColorToColor): Deleted.
97
98 2018-03-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
99
100         The SVGAnimatedProperty wrappers have to be detached from the referenced values before the SVGAnimatedType is deleted
101         https://bugs.webkit.org/show_bug.cgi?id=183972
102
103         Reviewed by Daniel Bates.
104
105         If the SVGAnimatedType is a list type, e.g. SVGLengthListValues, the wrappers
106         of the animated properties have to be detached from the items in the list
107         before it's deleted.
108
109         * svg/SVGAnimateElementBase.cpp:
110         (WebCore::SVGAnimateElementBase::clearAnimatedType):
111
112 2018-03-28  Ross Kirsling  <ross.kirsling@sony.com>
113
114         MSVC __forceinline slows down JSC release build fivefold after r229391
115         https://bugs.webkit.org/show_bug.cgi?id=184062
116
117         Reviewed by Alex Christensen.
118
119         * platform/graphics/FormatConverter.cpp:
120         Factor ALWAYS_INLINE_EXCEPT_MSVC out to WTF.
121
122 2018-03-28  Zalan Bujtas  <zalan@apple.com>
123
124         Make it possible to override the screen size
125         https://bugs.webkit.org/show_bug.cgi?id=184111
126         <rdar://problem/38972181>
127
128         Reviewed by Tim Horton.
129
130         We just call screenSize() atm.
131
132         * page/Chrome.cpp:
133         (WebCore::Chrome::overrideScreenSize const):
134         * page/Chrome.h:
135         * page/ChromeClient.h:
136         * platform/HostWindow.h:
137         * platform/PlatformScreen.h:
138         * platform/ios/PlatformScreenIOS.mm:
139         (WebCore::screenRect):
140         (WebCore::overrideScreenSize):
141
142 2018-03-28  Timothy Hatcher  <timothy@apple.com>
143
144         Include the 'text' color keyword as a system color.
145
146         https://bugs.webkit.org/show_bug.cgi?id=184113
147         rdar://problem/38779267
148
149         Reviewed by Tim Horton.
150
151         * css/StyleColor.cpp:
152         (WebCore::StyleColor::isColorKeyword): Don't check CSSValueMenu, it is a system color and is included.
153         (WebCore::StyleColor::isSystemColor): Include CSSValueText. Check CSSValueWebkitFocusRingColor in the range,
154         since it is immediately after CSSValueAppleSystemYellow.
155
156 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
157
158         [iOS] Multiple select appearance doesn't update when selecting or deselecting rows in the picker view
159         https://bugs.webkit.org/show_bug.cgi?id=184110
160         <rdar://problem/38796648>
161
162         Reviewed by Tim Horton.
163
164         HTMLSelectElement::optionSelectedByUser is invoked upon user interaction with a select menu. This currently
165         takes two separate codepaths, depending on whether or not the menu list appearance is being used to render the
166         select. If a menu list appearance is used, we call selectOption(), which updates validity, updates the element
167         renderer, and then dispatches a `change` event if needed.
168
169         However, if updateSelectedState() is used, we only update form validity and then dispatch the `change` event
170         without updating the renderer, leaving it stale.
171
172         Test: fast/forms/ios/ipad/multiple-select-updates-renderer.html
173
174         * html/HTMLSelectElement.cpp:
175         (WebCore::HTMLSelectElement::optionSelectedByUser):
176
177         Update the renderer after updating the DOM to reflect the selected option.
178
179 2018-03-28  Daniel Bates  <dabates@apple.com>
180
181         Substitute "strong password confirmation auto fill" for "strong confirmation password auto fill"
182         <rdar://problem/36518856>
183
184         * English.lproj/Localizable.strings:
185         * platform/LocalizedStrings.cpp:
186         (WebCore::AXAutoFillStrongConfirmationPasswordLabel):
187
188 2018-03-28  Daniel Bates  <dabates@apple.com>
189
190         WebSocket cookie incorrectly stored
191         https://bugs.webkit.org/show_bug.cgi?id=184100
192         <rdar://problem/37928715>
193
194         Reviewed by Brent Fulgham.
195
196         A cookie received in a WebSocket response should be stored with respect to the
197         origin of the WebSocket server in order for it to be sent in a subsequent request.
198
199         Also removed a FIXME about implementing support for the long since
200         deprecated Set-Cookie2 header.
201
202         Test: http/tests/websocket/tests/hybi/websocket-cookie-overwrite-behavior.html
203
204         * Modules/websockets/WebSocketChannel.cpp:
205         (WebCore::WebSocketChannel::processBuffer):
206         * Modules/websockets/WebSocketHandshake.h:
207
208 2018-03-28  Chris Dumez  <cdumez@apple.com>
209
210         Do process swap when opening a cross-origin URL via window.open(url, '_blank', 'noopener')
211         https://bugs.webkit.org/show_bug.cgi?id=183962
212         <rdar://problem/38817833>
213
214         Reviewed by Brady Eidson.
215
216         Pass extra bits of information to the UIProcess via NavigationAction:
217         - Is it a cross origin navigation caused by window.open()
218         - Does the navigated frame have an opener
219
220         This information is useful to determine on UIProcess side if we want
221         to swap WebProcess.
222
223         * loader/FrameLoadRequest.h:
224         (WebCore::FrameLoadRequest::setIsCrossOriginWindowOpenNavigation):
225         (WebCore::FrameLoadRequest::isCrossOriginWindowOpenNavigation const):
226         * loader/FrameLoader.cpp:
227         (WebCore::FrameLoader::loadURL):
228         * loader/NavigationAction.h:
229         (WebCore::NavigationAction::setIsCrossOriginWindowOpenNavigation):
230         (WebCore::NavigationAction::isCrossOriginWindowOpenNavigation const):
231         (WebCore::NavigationAction::setOpener):
232         (WebCore::NavigationAction::opener const):
233         * page/DOMWindow.cpp:
234         (WebCore::DOMWindow::createWindow):
235
236 2018-03-28  Chris Dumez  <cdumez@apple.com>
237
238         Thread safety issue in IDBFactory' shouldThrowSecurityException()
239         https://bugs.webkit.org/show_bug.cgi?id=184064
240
241         Reviewed by Ryosuke Niwa.
242
243         shouldThrowSecurityException() gets called on a non-main thread but
244         it ended up using the SchemeRegistry via SecurityOrigin::canAccessDatabase()
245         which calls SecurityOrigin::isLocal().
246
247         Since using the SchemeRegistry from the background thread is not safe
248         (we recently added locks which we're trying to remove), and since SecurityOrigin
249         methods are often called from background threads, this patch make SecurityOrigin::isLocal()
250         safe to call from a background thread. To achieve this, we now query the SchemeRegistry
251         in the SecurityOrigin constructor instead as SecurityOrigin objects are expected to be
252         constructed on the main thread.
253
254         * page/SecurityOrigin.cpp:
255         (WebCore::SecurityOrigin::SecurityOrigin):
256         (WebCore::SecurityOrigin::isLocal const): Deleted.
257         * page/SecurityOrigin.h:
258         (WebCore::SecurityOrigin::isLocal const):
259
260 2018-03-28  Ryan Haddad  <ryanhaddad@apple.com>
261
262         Unreviewed, rolling out r230033.
263
264         The LayoutTests modified in this change fail an assertion on
265         WK1.
266
267         Reverted changeset:
268
269         "[Web Animations] Implement more CSSPropertyBlendingClient
270         methods"
271         https://bugs.webkit.org/show_bug.cgi?id=184077
272         https://trac.webkit.org/changeset/230033
273
274 2018-03-28  Chris Dumez  <cdumez@apple.com>
275
276         WebSocket::didReceiveMessage() may construct a SecurityOrigin object on a non-main thread
277         https://bugs.webkit.org/show_bug.cgi?id=184068
278
279         Reviewed by Youenn Fablet.
280
281         WebSocket::didReceiveMessage() may construct a SecurityOrigin object on a non-main thread,
282         which is not safe. We now use SecurityOriginData since we only need an origin String and
283         it is safe to construct a SecurityOriginData on any thread.
284
285         * Modules/websockets/WebSocket.cpp:
286         (WebCore::WebSocket::didReceiveMessage):
287
288 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
289
290         [Extra zoom mode] Make boosted text autosizing values switchable at runtime
291         https://bugs.webkit.org/show_bug.cgi?id=184092
292         <rdar://problem/38939917>
293
294         Reviewed by Tim Horton.
295
296         In r228697, we introduced a new set of boosted text autosizing constants tuned for extra zoom mode, which are
297         currently hard-coded as default values in SettingsBase. However, we've since identified cases where clients may
298         want to opt in or out of boosted text autosizing values and just use the existing values.
299
300         This replaces settings to adjust text autosizing constants with a flag to enable or disable boosted text
301         autosizing; when changed, we update all three text autosizing parameters to their default or boosted values, and
302         then trigger style recalculation.
303
304         Test: TextAutosizingBoost.ChangeAutosizingBoostAtRuntime
305
306         * page/Settings.yaml:
307         * page/SettingsBase.cpp:
308         (WebCore::SettingsBase::shouldEnableTextAutosizingBoostChanged):
309         (WebCore::SettingsBase::defaultOneLineTextMultiplierCoefficient): Deleted.
310         (WebCore::SettingsBase::defaultMultiLineTextMultiplierCoefficient): Deleted.
311         (WebCore::SettingsBase::defaultMaxTextAutosizingScaleIncrease): Deleted.
312
313         Changed these to constant values instead of helper functions, and also introduced boosted text autosizing
314         constants for use in extra zoom mode.
315
316         * page/SettingsBase.h:
317         (WebCore::SettingsBase::oneLineTextMultiplierCoefficient const):
318         (WebCore::SettingsBase::multiLineTextMultiplierCoefficient const):
319         (WebCore::SettingsBase::maxTextAutosizingScaleIncrease const):
320         * rendering/RenderThemeIOS.mm:
321         (WebCore::RenderThemeIOS::extraDefaultStyleSheet):
322
323         Tweak the stylesheet to make `-webkit-text-size-adjust: auto` overridable by web content. Adding the !important
324         is breaking many websites that positioned text such that it is positioned within layout viewport bounds without
325         text autosizing.
326
327 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
328
329         Avoid uninitialized mach ports
330         https://bugs.webkit.org/show_bug.cgi?id=184090
331         <rdar://problem/37261129>
332
333         Reviewed by Chris Dumez.
334
335         It is possible for mach_port_allocate to return an error, but we rarely check its return value. The value
336         of the argument passed to mach_port_allocate is not guaranteed to be valid when it returns an error, so
337         there is a potential for us to try to use invalid ports.
338
339         We should always check return values, and ensure that the mach port variables we seek to initialize are
340         kept in a valid state.
341
342         No new tests, no Web-facing behavior change.
343
344         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
345         (WebCore::attachToAppleGraphicsControl): Initialize masterPort to a default value.
346
347 2018-03-28  Antoine Quint  <graouts@apple.com>
348
349         [Web Animations] Implement more CSSPropertyBlendingClient methods
350         https://bugs.webkit.org/show_bug.cgi?id=184077
351
352         Reviewed by Dean Jackson.
353
354         We only had stubs for several of the CSSPropertyBlendingClient methods and thus always implied that we
355         were animating non-matching transform, filter and backdrop-filter properties. We now implement those using
356         the same code used in KeyframeAnimation. This allows for 31 new tests to opt into the CSS Animations and
357         CSS Transitions as Web Animations feature.
358
359         * animation/KeyframeEffectReadOnly.cpp:
360         (WebCore::KeyframeEffectReadOnly::copyPropertiesFromSource):
361         (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes):
362         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
363         (WebCore::KeyframeEffectReadOnly::checkForMatchingTransformFunctionLists):
364         (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists):
365         (WebCore::KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists):
366         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes):
367         (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes):
368         * animation/KeyframeEffectReadOnly.h:
369
370 2018-03-28  Antoine Quint  <graouts@apple.com>
371
372         [Web Animations] Comparing two matching FramesTimingFunction objects fails
373         https://bugs.webkit.org/show_bug.cgi?id=184078
374
375         Reviewed by Jon Lee.
376
377         Fix a stupid mistake in the == operator for FramesTimingFunction. Without a correct check, we would mistakenly interrupt and
378         restart any transition with a frames() timing function when we check that the Animation objects are similar.
379
380         * platform/animation/TimingFunction.h:
381
382 2018-03-28  Miguel Gomez  <magomez@igalia.com>
383
384         [GTK][WPE] Remove UpdateAtlas
385         https://bugs.webkit.org/show_bug.cgi?id=184042
386
387         Reviewed by Žan Doberšek.
388
389         Remove UpdateAtlas and AreaAllocator classes. Instead of using UpdateAtlas as a cache
390         of buffers to render tiles with cairo, allocate a new buffer for each tile instead.
391
392         Covered by existent tests.
393
394         * loader/EmptyClients.h:
395         * page/ChromeClient.h:
396         * platform/TextureMapper.cmake:
397         * platform/graphics/texmap/coordinated/AreaAllocator.cpp: Removed.
398         * platform/graphics/texmap/coordinated/AreaAllocator.h: Removed.
399         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
400         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
401         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
402         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
403         * platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h:
404         (): Deleted.
405         * platform/graphics/texmap/coordinated/UpdateAtlas.cpp: Removed.
406         * platform/graphics/texmap/coordinated/UpdateAtlas.h: Removed.
407         * testing/Internals.cpp:
408         (WebCore::Internals::resetToConsistentState):
409
410 2018-03-27  Michael Catanzaro  <mcatanzaro@igalia.com>
411
412         Unreviewed, rolling out r230008.
413
414         Lots of HTTP test failures
415
416         Reverted changeset:
417
418         "Remove unused libsoup ResourceHandle implementation"
419         https://bugs.webkit.org/show_bug.cgi?id=184048
420         https://trac.webkit.org/changeset/230008
421
422 2018-03-27  Chris Dumez  <cdumez@apple.com>
423
424         Make it possible to call ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() from non-main threads
425         https://bugs.webkit.org/show_bug.cgi?id=184029
426
427         Reviewed by Youenn Fablet.
428
429         Make it possible to call ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() from non-main threads
430         by having it use SecurityOriginData (which is safe to construct on non-main threads) instead of
431         SecurityOrigin (which isn't).
432
433         ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() is already called from non-main thread in
434         FetchLoader, XHR and WebSocket when used in workers. This wasn't safe.
435
436         * loader/DocumentWriter.cpp:
437         (WebCore::DocumentWriter::begin):
438         * page/csp/ContentSecurityPolicy.cpp:
439         (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded const):
440         (WebCore::ContentSecurityPolicy::setUpgradeInsecureRequests):
441         (WebCore::ContentSecurityPolicy::takeNavigationRequestsToUpgrade):
442         (WebCore::ContentSecurityPolicy::setInsecureNavigationRequestsToUpgrade):
443         * page/csp/ContentSecurityPolicy.h:
444
445 2018-03-27  Daniel Bates  <dabates@apple.com>
446
447         Attempt to fix media control layout tests after <https://trac.webkit.org/changeset/230006/>
448         (https://bugs.webkit.org/show_bug.cgi?id=179983)
449
450         Exempt elements in user agent shadow DOM from having to perform a potentially CORS-
451         enabled fetch for a mask image to try to fix the following tests from timing out:
452             media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline.html
453             media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline.html
454
455         * style/StylePendingResources.cpp:
456         (WebCore::Style::loadPendingImage):
457
458 2018-03-27  Per Arne Vollan  <pvollan@apple.com>
459
460         The layout test fast/canvas/webgl/read-pixels-test.html is timing out.
461         https://bugs.webkit.org/show_bug.cgi?id=183923
462         <rdar://problem/38756869>
463
464         Reviewed by Brent Fulgham.
465
466         The test is timing out when we do not interact directly with the WindowServer, causing
467         OpenGL to fall back to software rendering. In this mode, any call to CGLChoosePixelFormat
468         requesting an accelerated pixel format will fail because it cannot determine which GPU is
469         connected to the display.
470
471         OpenGL treats all GPUs as if they were offline when used in a process (like the WebContent
472         process) that does not directly control the display.
473
474         We can get correct behavior if we tell OpenGL which GPU is currently connected to the
475         display, and if we instruct CGLChoosePixelFormat to create an offline renderer pixel format
476         by including the 'kCGLPFAAllowOfflineRenderers' flag in its arguments.
477
478         We can use CGLSetVirtualScreen with an OpenGL display mask that tells the OpenGL framework
479         which GPU it should use.
480
481         See https://developer.apple.com/library/content/technotes/tn2229/_index.html#//apple_ref/doc/uid/DTS40008924-CH1-SUBSECTION7
482         for details on how the virtual screen is found from the OpenGL display mask.
483
484         No new tests, covered by existing tests.
485
486         * WebCore.xcodeproj/project.pbxproj:
487         * platform/graphics/GraphicsContext3D.h:
488         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
489         (WebCore::setPixelFormat):
490         (WebCore::identifyAndSetCurrentGPU):
491         (WebCore::GraphicsContext3D::GraphicsContext3D):
492         (WebCore::GraphicsContext3D::setOpenGLDisplayMask):
493         (WebCore::GraphicsContext3D::allowOfflineRenderers):
494
495 2018-03-27  Jiewen Tan  <jiewen_tan@apple.com>
496
497         [WebAuthN] Implement authenticatorGetAssertion
498         https://bugs.webkit.org/show_bug.cgi?id=183881
499         <rdar://problem/37258628>
500
501         Reviewed by Brent Fulgham.
502
503         This patch does the following few things:
504         1) It implements the spec: https://www.w3.org/TR/webauthn/#op-get-assertion as of 5 December 2017.
505         2) It tweaks encoding/decoding of PublicKeyCredentialRequestOptions such that options can be passed
506         between UI and Web processes.
507         3) It refines the way how LocalAuthenticator::makeCredential find intersection between
508         excludeCredentialDescriptorList and existing credentials in the authenticator, such that it is faster.
509         Basically, it takes the CredentialID from the list and treat it as an ASCII string and put it into a
510         HashSet<String>. It should not matter if a duplicated CredentialID is added. If the hash set is not
511         empty, the algorithm then queries Keychain for all CredentialIDs related to the current RP ID once.
512         For every queried CredentialID, the algorithm then treats it as an ASCII string as well and look for
513         a match in the hash set to produce the intersetction. The new way is also employed in
514         LocalAuthenticator::getAssertion as well.
515         4) It abstracts the way to produce authData and thus reorders a bit of code in
516         LocalAuthenticator::makeCredential.
517
518         Covered by API tests.
519
520         * Modules/webauthn/AuthenticatorManager.cpp:
521         (WebCore::AuthenticatorManager::create const):
522         (WebCore::AuthenticatorManager::discoverFromExternalSource const):
523         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
524         * Modules/webauthn/PublicKeyCredentialRequestOptions.h:
525         (WebCore::PublicKeyCredentialRequestOptions::encode const):
526         (WebCore::PublicKeyCredentialRequestOptions::decode):
527         * Modules/webauthn/cocoa/LocalAuthenticator.h:
528         * Modules/webauthn/cocoa/LocalAuthenticator.mm:
529         (WebCore::LocalAuthenticatorInternal::buildAuthData):
530         (WebCore::LocalAuthenticatorInternal::produceHashSet):
531         (WebCore::LocalAuthenticator::makeCredential):
532         (WebCore::LocalAuthenticator::getAssertion):
533         (WebCore::LocalAuthenticator::issueClientCertificate const):
534         * WebCore.xcodeproj/project.pbxproj:
535
536 2018-03-27  Chris Dumez  <cdumez@apple.com>
537
538         Avoid constructing SecurityOrigin objects from non-main threads
539         https://bugs.webkit.org/show_bug.cgi?id=184024
540
541         Reviewed by Youenn Fablet.
542
543         Avoid constructing SecurityOrigin objects from non-main threads as much as possible
544         as it is not safe. This patch gets rid of most offending cases but not all of them
545         yet, which is why I haven't added a ASSERT(isMainThread()) to the SecurityOrigin
546         constructor yet.
547
548         For example, ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() currently
549         gets called from non-main threads and construct a SecurityOrigin. Fixing this
550         will require some refactoring that would have made this patch much larger.
551
552         * loader/DocumentLoader.cpp:
553         (WebCore::DocumentLoader::matchRegistration):
554         * page/EventSource.cpp:
555         (WebCore::EventSource::didReceiveResponse):
556         * page/SecurityOrigin.cpp:
557         (WebCore::SecurityOrigin::SecurityOrigin):
558         * page/SecurityOrigin.h:
559         (WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
560         * testing/Internals.cpp:
561         (WebCore::Internals::hasServiceWorkerRegistration):
562         * workers/DedicatedWorkerGlobalScope.cpp:
563         (WebCore::DedicatedWorkerGlobalScope::create):
564         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
565         * workers/DedicatedWorkerGlobalScope.h:
566         * workers/DedicatedWorkerThread.cpp:
567         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
568         * workers/DedicatedWorkerThread.h:
569         * workers/WorkerGlobalScope.cpp:
570         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
571         * workers/WorkerGlobalScope.h:
572         * workers/WorkerLocation.cpp:
573         (WebCore::WorkerLocation::origin const):
574         * workers/WorkerThread.cpp:
575         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
576         (WebCore::WorkerThread::workerThread):
577         * workers/WorkerThread.h:
578         * workers/service/SWClientConnection.h:
579         * workers/service/ServiceWorkerContainer.cpp:
580         (WebCore::ServiceWorkerContainer::getRegistration):
581         (WebCore::ServiceWorkerContainer::getRegistrations):
582         * workers/service/ServiceWorkerGlobalScope.cpp:
583         (WebCore::ServiceWorkerGlobalScope::create):
584         (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
585         * workers/service/ServiceWorkerGlobalScope.h:
586         * workers/service/ServiceWorkerProvider.cpp:
587         (WebCore::ServiceWorkerProvider::mayHaveServiceWorkerRegisteredForOrigin):
588         * workers/service/ServiceWorkerProvider.h:
589         * workers/service/context/ServiceWorkerThread.cpp:
590         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
591         (WebCore::fireMessageEvent):
592         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
593         * workers/service/context/ServiceWorkerThread.h:
594
595 2018-03-27  Alex Christensen  <achristensen@webkit.org>
596
597         Remove unused libsoup ResourceHandle implementation
598         https://bugs.webkit.org/show_bug.cgi?id=184048
599
600         Reviewed by Michael Catanzaro.
601
602         This code is unused since r228901 so let's remove it!
603
604         * platform/network/ResourceHandle.h:
605         * platform/network/ResourceHandleInternal.h:
606         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
607         * platform/network/soup/ResourceHandleSoup.cpp:
608         (WebCore::ResourceHandle::~ResourceHandle):
609         (WebCore::ResourceHandleInternal::soupSession):
610         (WebCore::ResourceHandle::cancelledOrClientless):
611         (WebCore::ResourceHandle::ensureReadBuffer):
612         (WebCore::ResourceHandle::currentStreamPosition const):
613         (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse):
614         (WebCore::ResourceHandle::didStartRequest):
615         (WebCore::ResourceHandle::start):
616         (WebCore::ResourceHandle::releaseForDownload):
617         (WebCore::ResourceHandle::sendPendingRequest):
618         (WebCore::ResourceHandle::cancel):
619         (WebCore::ResourceHandle::shouldUseCredentialStorage):
620         (WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge):
621         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
622         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
623         (WebCore::ResourceHandle::receivedCredential):
624         (WebCore::ResourceHandle::receivedCancellation):
625         (WebCore::ResourceHandle::receivedChallengeRejection):
626         (WebCore::ResourceHandle::platformSetDefersLoading):
627         (WebCore::sessionFromContext): Deleted.
628         (WebCore::ResourceHandle::create): Deleted.
629         (WebCore::ResourceHandle::ResourceHandle): Deleted.
630         (WebCore::isAuthenticationFailureStatusCode): Deleted.
631         (WebCore::tlsErrorsChangedCallback): Deleted.
632         (WebCore::gotHeadersCallback): Deleted.
633         (WebCore::applyAuthenticationToRequest): Deleted.
634         (WebCore::restartedCallback): Deleted.
635         (WebCore::shouldRedirect): Deleted.
636         (WebCore::shouldRedirectAsGET): Deleted.
637         (WebCore::continueAfterWillSendRequest): Deleted.
638         (WebCore::doRedirect): Deleted.
639         (WebCore::redirectSkipCallback): Deleted.
640         (WebCore::wroteBodyDataCallback): Deleted.
641         (WebCore::cleanupSoupRequestOperation): Deleted.
642         (WebCore::nextMultipartResponsePartCallback): Deleted.
643         (WebCore::sendRequestCallback): Deleted.
644         (WebCore::continueAfterDidReceiveResponse): Deleted.
645         (WebCore::startingCallback): Deleted.
646         (WebCore::networkEventCallback): Deleted.
647         (WebCore::createSoupMessageForHandleAndRequest): Deleted.
648         (WebCore::createSoupRequestAndMessageForHandle): Deleted.
649         (WebCore::ResourceHandle::timeoutFired): Deleted.
650         (WebCore::waitingToSendRequest): Deleted.
651         (WebCore::readCallback): Deleted.
652
653 2018-03-27  Chris Dumez  <cdumez@apple.com>
654
655         Move online state detection from the WebProcess to the NetworkProcess
656         https://bugs.webkit.org/show_bug.cgi?id=183989
657         <rdar://problem/37093299>
658
659         Reviewed by Youenn Fablet.
660
661         Move online state detection from the WebProcess to the NetworkProcess. This avoid executing the same (expensive) code in
662         EACH web process whenever a network interface's state changes. Now, the Network Process monitors network interfaces
663         and determines the online state whenever an interface's state changes. If the onLine state changes, it notifies all
664         its connected WebProcesses via IPC.
665
666         * inspector/agents/InspectorApplicationCacheAgent.cpp:
667         (WebCore::InspectorApplicationCacheAgent::networkStateChanged):
668         * loader/LoaderStrategy.h:
669         * page/Navigator.cpp:
670         (WebCore::Navigator::onLine const):
671         * page/Page.cpp:
672         * platform/network/NetworkStateNotifier.h:
673         * workers/Worker.cpp:
674         (WebCore::Worker::Worker):
675         (WebCore::Worker::notifyFinished):
676         * workers/service/context/ServiceWorkerThread.cpp:
677         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
678         * workers/service/context/ServiceWorkerThreadProxy.cpp:
679         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
680
681 2018-03-27  Daniel Bates  <dabates@apple.com>
682
683         CSS mask images should be retrieved using potentially CORS-enabled fetch
684         https://bugs.webkit.org/show_bug.cgi?id=179983
685         <rdar://problem/35678149>
686
687         Reviewed by Brent Fulgham.
688
689         As per <https://drafts.fxtf.org/css-masking-1/#priv-sec> (Editor’s Draft, 23 December 2017)
690         we should fetch CSS mask images using a potentially CORS-enabled fetch.
691
692         Both cross-origin CSS shape-outside images and CSS mask images may be sensitive to timing
693         attacks that can be used to reveal their pixel data when retrieved without regard to CORS.
694         For the same reason that we fetch CSS shape-outside images using a potentially CORS-enabled
695         fetch we should fetch CSS mask the same way. This also makes the behavior of WebKit more
696         closely align with the behavior in the spec.
697
698         Test: http/tests/security/css-mask-image.html
699
700         * page/Settings.yaml: Add a setting for toggle "Anonymous" mode fetching of mask images (defaults: true).
701         We need this setting to avoid breaking the developer convenience feature that some modern media controls
702         layout tests employ to load assets from the filesystem as opposed to using the hardcoded data URLs baked
703         into the WebKit binary.
704         * style/StylePendingResources.cpp: Substitute LoadPolicy::NoCORS and LoadPolicy::Anonymous for
705         LoadPolicy::Normal and LoadPolicy::ShapeOutside, respectively, to match the terminology used
706         in the HTML, CSS Shapes Module Level 1, and CSS Masking Module Level 1 specs.
707         (WebCore::Style::loadPendingImage): Ditto.
708         (WebCore::Style::loadPendingResources): Use load policy LoadPolicy::Anonymous when fetching
709         a mask image or shape-outside image.
710
711 2018-03-27  Zalan Bujtas  <zalan@apple.com>
712
713         RenderBox::parent/firstChild/nextSibling/previousSiblingBox() functions should type check.
714         https://bugs.webkit.org/show_bug.cgi?id=184032
715         <rdar://problem/38384984>
716
717         Reviewed by Antti Koivisto.
718
719         We cannot rely on the correctness of the render tree structure when querying for parent/child/next and previous
720         sibling since some features (multicolumn/spanners) move subtrees out of their original position (which is highly
721         undesired and should not be encouraged at all though).
722         It should also be noted that these functions are not equivalent of typeOfChildren<RenderBox> and the following usage
723             for (auto* boxChild = firstChildBox(); boxChild; boxChild = boxChild->nextSiblingBox())
724         can lead to unexpected result.
725  
726         Test: fast/multicol/parent-box-when-spanner-is-present.html
727
728         * rendering/RenderBox.h:
729         (WebCore::RenderBox::parentBox const):
730         (WebCore::RenderBox::firstChildBox const):
731         (WebCore::RenderBox::lastChildBox const):
732         (WebCore::RenderBox::previousSiblingBox const):
733         (WebCore::RenderBox::nextSiblingBox const):
734         * rendering/RenderListItem.cpp:
735         (WebCore::RenderListItem::positionListMarker):
736         * rendering/RenderListMarker.cpp:
737         (WebCore::RenderListMarker::layout):
738         * rendering/RenderMultiColumnSet.cpp:
739         (WebCore::RenderMultiColumnSet::updateLogicalWidth):
740
741 2018-03-27  Brent Fulgham  <bfulgham@apple.com>
742
743         Further refine cookie read/write logging
744         https://bugs.webkit.org/show_bug.cgi?id=184044
745         <rdar://problem/38915610>
746
747         Reviewed by Chris Dumez.
748
749         Export 'shouldBlockCookies' so that it can be accessed by the WebKit framework.
750
751         * platform/network/NetworkStorageSession.h:
752
753 2018-03-27  Antoine Quint  <graouts@apple.com>
754
755         [Web Animations] Stop using internals.pauseAnimationAtTimeOnElement() in favor of Web Animations API for animations tests
756         https://bugs.webkit.org/show_bug.cgi?id=184038
757
758         Reviewed by Dean Jackson.
759
760         Expose a new method to indicate that the runtime flag for CSS Animations and CSS Transitions as Web Animations is enabled.
761
762         * testing/InternalSettings.cpp:
763         (WebCore::InternalSettings::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
764         * testing/InternalSettings.h:
765         * testing/InternalSettings.idl:
766
767 2018-03-27  Thibault Saunier  <tsaunier@igalia.com>
768
769         [GStreamer] Enhance debugging in the BasePlayer
770         https://bugs.webkit.org/show_bug.cgi?id=184035
771
772         Reviewed by Philippe Normand.
773
774         No behaviour changes so no test were added/enabled.
775
776         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
777         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
778         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
779         (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const):
780         (WebCore::MediaPlayerPrivateGStreamerBase::setVolume):
781         (WebCore::MediaPlayerPrivateGStreamerBase::volumeChangedCallback):
782         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted):
783         (WebCore::MediaPlayerPrivateGStreamerBase::muted const):
784         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
785         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
786         (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement):
787         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
788         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached):
789         (WebCore::MediaPlayerPrivateGStreamerBase::dispatchDecryptionKey):
790         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
791
792 2018-03-27  Eric Carlson  <eric.carlson@apple.com>
793
794         Make AVFoundationEnabled preference available on iOS
795         https://bugs.webkit.org/show_bug.cgi?id=183876
796         <rdar://problem/38726459>
797
798         Reviewed by Youenn Fablet.
799
800         Test: AVFoundationPref API test.
801
802         * html/HTMLAudioElement.idl: There is no need for a runtime setting to enable/disable audio,
803         there is already settings.mediaEnabled.
804         * html/HTMLMediaElement.cpp:
805         (WebCore::HTMLMediaElement::prepareForLoad): Fail if there are no media engines registered.
806         (WebCore::HTMLMediaElement::noneSupported): Return early if m_error has already been set.
807         (WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture): Remove a typo.
808
809         * page/RuntimeEnabledFeatures.cpp:
810         (WebCore::RuntimeEnabledFeatures::audioEnabled const): Deleted.
811         * page/RuntimeEnabledFeatures.h:
812
813 2018-03-27  Fujii Hironori  <Hironori.Fujii@sony.com>
814
815         [GTK] Layout test editing/deleting/delete-surrogatepair.html crashing with CRITICAL **: enchant_dict_check: assertion 'g_utf8_validate(word, len, NULL)' failed
816         https://bugs.webkit.org/show_bug.cgi?id=176799
817
818         Reviewed by Carlos Garcia Campos.
819
820         The length of a surrogate-pair UTF-16 character is 2 even though
821         the number of characters is 1. An incorrect string length was
822         passed to enchant_dict_check if the string contains a
823         surrogate-pair character because the length was calculated by
824         applying UTF-16 character position to UTF-8 string.
825
826         No new tests (Covered by existing tests).
827
828         * platform/text/enchant/TextCheckerEnchant.cpp:
829         (WebCore::TextCheckerEnchant::checkSpellingOfWord): Changed the
830         type of an argument `word` from CString to String. Convert a
831         substring of the argument into UTF-8.
832         (WebCore::TextCheckerEnchant::checkSpellingOfString): Pass the
833         original UTF-16 string to checkSpellingOfWord instead of a
834         converted UTF-8 string.
835         * platform/text/enchant/TextCheckerEnchant.h: Changed the type of
836         an argument `word` from CString to String.
837
838 2018-03-26  Ms2ger  <Ms2ger@igalia.com>
839
840         Remove an unnecessary const_cast from BitmapTextureGL::updateContents().
841         https://bugs.webkit.org/show_bug.cgi?id=184007
842
843         Reviewed by Žan Doberšek.
844
845         No new tests.
846
847         * platform/graphics/texmap/BitmapTextureGL.cpp:
848         (WebCore::BitmapTextureGL::updateContents):
849
850 2018-03-23  Antoine Quint  <graouts@apple.com>
851
852         [Web Animations] Make imported/mozilla/css-animations/test_animation-currenttime.html pass reliably
853         https://bugs.webkit.org/show_bug.cgi?id=183819
854
855         Reviewed by Dean Jackson.
856
857         The current time for a CSS Animation exposed via the API should be clamped between 0 and the animation duration.
858
859         * animation/CSSAnimation.cpp:
860         (WebCore::CSSAnimation::bindingsCurrentTime const):
861         * animation/CSSAnimation.h:
862         * animation/WebAnimation.h:
863
864 2018-03-23  Antoine Quint  <graouts@apple.com>
865
866         [Web Animations] Correctly handle timing functions specified by CSS Animations and CSS Transitions
867         https://bugs.webkit.org/show_bug.cgi?id=183935
868
869         Reviewed by Dean Jackson.
870
871         We were incorrectly reflecting the animation-timing-function and transition-timing-function values on the generated
872         DeclarativeAnimation effect timing "easing" property. In fact, those values should only be represented on the keyframes.
873
874         In the case of a CSS Animation, the animation-timing-function property set on the element's style serves as the default
875         value used for all keyframes, and individual keyframes can specify an overriding animation-timing-function. For a CSS
876         Transition, the transition-timing-function property set on the element's style serves as the timing function of the
877         from keyframe.
878
879         To correctly reflect this, we provide a new timingFunctionForKeyframeAtIndex() function on KeyframeEffectReadOnly
880         which will return the right TimingFunction object at a given index, regardless of the animation type. In the case
881         of getKeyframes(), we manually return "linear" for the "to" keyframe since timingFunctionForKeyframeAtIndex()
882         would otherwise return the same timing function as the "from" keyframe. This avoids creating an extra
883         LinearTimingFunction object.
884
885         As a result, a number of Mozilla imported tests progress since we have correct information on the "easing" property
886         of objects returned by getKeyframes() and the "progress" reported by getComputedTiming() now always uses a linear
887         timing function.
888
889         * animation/DeclarativeAnimation.cpp:
890         (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): The timing function of the backing Animation should
891         not be reflected on the effect's timing object.
892         * animation/KeyframeEffectReadOnly.cpp:
893         (WebCore::KeyframeEffectReadOnly::getKeyframes): Return the correct timing function for a keyframe, and use a "linear"
894         value for the "to" keyframe of a CSS Transition.
895         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle):
896         (WebCore::KeyframeEffectReadOnly::timingFunctionForKeyframeAtIndex):
897         * animation/KeyframeEffectReadOnly.h:
898
899 2018-03-26  Chris Dumez  <cdumez@apple.com>
900
901         Use SecurityOriginData more consistently in Service Worker code
902         https://bugs.webkit.org/show_bug.cgi?id=183969
903
904         Reviewed by Darin Adler.
905
906         Use SecurityOriginData more consistently in Service Worker code to avoid constructing
907         SecurityOrigin objects unnecessarily.
908
909         I also updated SecurityOrigin to use SecurityOriginData as a data member. This reduces
910         code duplication a bit. This also avoids constructing SecurityOriginData unnecessarily
911         in some cases as callers can now use SecurityOrigin::data() instead of
912         SecurityOriginData::fromSecurityOrigin().
913
914         No new tests, no Web-facing behavior change.
915
916         * Modules/cache/DOMCacheStorage.cpp:
917         (WebCore::DOMCacheStorage::origin const):
918         * Modules/encryptedmedia/CDM.cpp:
919         (WebCore::CDM::storageDirectory const):
920         * Modules/encryptedmedia/MediaKeySession.cpp:
921         (WebCore::MediaKeySession::mediaKeysStorageDirectory const):
922         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
923         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory const):
924         * Modules/indexeddb/IDBFactory.cpp:
925         (WebCore::IDBFactory::openInternal):
926         (WebCore::IDBFactory::deleteDatabase):
927         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
928         (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
929         * Modules/webdatabase/Database.cpp:
930         (WebCore::Database::securityOrigin):
931         * Modules/webdatabase/DatabaseContext.cpp:
932         (WebCore::DatabaseContext::securityOrigin const):
933         * Modules/webdatabase/DatabaseContext.h:
934         * Modules/webdatabase/DatabaseManager.cpp:
935         (WebCore::DatabaseManager::fullPathForDatabase):
936         (WebCore::DatabaseManager::detailsForNameAndOrigin):
937         * html/HTMLMediaElement.cpp:
938         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const):
939         * inspector/agents/InspectorDOMStorageAgent.cpp:
940         (WebCore::InspectorDOMStorageAgent::findStorageArea):
941         * loader/appcache/ApplicationCacheStorage.cpp:
942         (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
943         (WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
944         (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
945         (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
946         (WebCore::ApplicationCacheStorage::store):
947         (WebCore::ApplicationCacheStorage::ensureOriginRecord):
948         * page/DOMWindow.cpp:
949         (WebCore:: const):
950         * page/SecurityOrigin.cpp:
951         (WebCore::SecurityOrigin::SecurityOrigin):
952         (WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
953         (WebCore::SecurityOrigin::canAccess const):
954         (WebCore::SecurityOrigin::canDisplay const):
955         (WebCore::SecurityOrigin::domainForCachePartition const):
956         (WebCore::SecurityOrigin::isLocal const):
957         (WebCore::SecurityOrigin::toString const):
958         (WebCore::SecurityOrigin::toRawString const):
959         (WebCore::SecurityOrigin::create):
960         (WebCore::SecurityOrigin::isSameSchemeHostPort const):
961         * page/SecurityOrigin.h:
962         (WebCore::SecurityOrigin::protocol const):
963         (WebCore::SecurityOrigin::host const):
964         (WebCore::SecurityOrigin::port const):
965         (WebCore::SecurityOrigin::data const):
966         (WebCore::SecurityOrigin::isHTTPFamily const):
967         * page/SecurityOriginData.cpp:
968         (WebCore::SecurityOriginData::toString const):
969         (WebCore::SecurityOriginData::fromFrame):
970         * page/SecurityOriginData.h:
971         (WebCore::SecurityOriginData::fromURL):
972         * storage/StorageNamespaceProvider.cpp:
973         (WebCore::StorageNamespaceProvider::localStorageArea):
974         * testing/Internals.cpp:
975         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
976         * workers/service/ServiceWorkerContainer.cpp:
977         (WebCore::ServiceWorkerContainer::addRegistration):
978         (WebCore::ServiceWorkerContainer::removeRegistration):
979         (WebCore::ServiceWorkerContainer::updateRegistration):
980         * workers/service/ServiceWorkerRegistrationKey.cpp:
981         (WebCore::ServiceWorkerRegistrationKey::relatesToOrigin const):
982         * workers/service/ServiceWorkerRegistrationKey.h:
983         * workers/service/server/SWOriginStore.cpp:
984         (WebCore::SWOriginStore::add):
985         (WebCore::SWOriginStore::remove):
986         (WebCore::SWOriginStore::clear):
987         * workers/service/server/SWOriginStore.h:
988         * workers/service/server/SWServer.cpp:
989         (WebCore::SWServer::addRegistration):
990         (WebCore::SWServer::removeRegistration):
991         (WebCore::SWServer::clear):
992         (WebCore::SWServer::tryInstallContextData):
993         (WebCore::SWServer::serverToContextConnectionCreated):
994         (WebCore::SWServer::markAllWorkersForOriginAsTerminated):
995         (WebCore::SWServer::unregisterServiceWorkerClient):
996         (WebCore::SWServer::needsServerToContextConnectionForOrigin const):
997         * workers/service/server/SWServer.h:
998         * workers/service/server/SWServerToContextConnection.cpp:
999         (WebCore::SWServerToContextConnection::SWServerToContextConnection):
1000         (WebCore::SWServerToContextConnection::~SWServerToContextConnection):
1001         (WebCore::SWServerToContextConnection::connectionForOrigin):
1002         * workers/service/server/SWServerToContextConnection.h:
1003         (WebCore::SWServerToContextConnection::securityOrigin const):
1004         * workers/service/server/SWServerWorker.cpp:
1005         (WebCore::SWServerWorker::origin const):
1006         (WebCore::SWServerWorker::securityOrigin const):
1007         * workers/service/server/SWServerWorker.h:
1008
1009 2018-03-26  Brent Fulgham  <bfulgham@apple.com>
1010
1011         Warn against cookie access in the WebContent process using ProcessPrivilege assertions
1012         https://bugs.webkit.org/show_bug.cgi?id=183911
1013         <rdar://problem/38762306>
1014
1015         Reviewed by Youenn Fablet.
1016
1017         Add a set of ProcessPrivilege assertions to enforce the rule that the WebContent process
1018         should never call Cookie API directly. That should only happen in the Networking or
1019         UIProcess. 
1020
1021         Add a new static flag to NetworkStorageSession that indicates if the current process has
1022         permission to interact with the Cookie API.
1023
1024         No new tests since there is no change in behavior.
1025
1026         * platform/network/NetworkStorageSession.cpp:
1027         (WebCore::NetworkStorageSession::NetworkStorageSession):
1028         (WebCore::NetworkStorageSession::processMayUseCookieAPI): Added.
1029         (WebCore::NetworkStorageSession::permitProcessToUseCookieAPI): Added. This also adds
1030         the appropriate flag to the ProcessPrivileges data for the current process.
1031         * platform/network/NetworkStorageSession.h:
1032         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1033         (WebCore::createCFStorageSessionForIdentifier): Do not create cookie storage if the current
1034         process is prohibited from interacting with the Cookie API.
1035         (WebCore::NetworkStorageSession::NetworkStorageSession): Add assertions.
1036         (WebCore::NetworkStorageSession::switchToNewTestingSession): Do not create cookie storage if
1037         the current process is prohibited from interacting with the Cookie API.
1038         (WebCore::NetworkStorageSession::defaultStorageSession): Ditto.
1039         (WebCore::NetworkStorageSession::ensureSession): Ditto.
1040         (WebCore::NetworkStorageSession::cookieStorage const): Ditto.
1041         * platform/network/cocoa/CookieStorageObserver.mm:
1042         (WebCore::CookieStorageObserver::CookieStorageObserver): Assert if accessed from untrusted process.
1043         (WebCore::CookieStorageObserver::startObserving): Ditto.
1044         (WebCore::CookieStorageObserver::stopObserving): Ditto.
1045         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1046         (WebCore::NetworkStorageSession::setCookie):
1047         (WebCore::NetworkStorageSession::setCookies):
1048         (WebCore::NetworkStorageSession::deleteCookie):
1049         (WebCore::nsCookiesToCookieVector):
1050         (WebCore::NetworkStorageSession::getAllCookies):
1051         (WebCore::NetworkStorageSession::getCookies):
1052         (WebCore::NetworkStorageSession::flushCookieStore):
1053         (WebCore::NetworkStorageSession::nsCookieStorage const):
1054         (WebCore::createPrivateStorageSession):
1055         * platform/network/mac/CookieJarMac.mm:
1056         (WebCore::httpCookies):
1057         (WebCore::deleteHTTPCookie):
1058         (WebCore::httpCookiesForURL):
1059         (WebCore::filterCookies):
1060         (WebCore::applyPartitionToCookies):
1061         (WebCore::cookiesInPartitionForURL):
1062         (WebCore::cookiesForSession):
1063         (WebCore::setHTTPCookiesForURL):
1064         (WebCore::deleteAllHTTPCookies):
1065         (WebCore::setCookiesFromDOM):
1066         (WebCore::httpCookieAcceptPolicy):
1067         (WebCore::deleteCookie):
1068         (WebCore::deleteCookiesForHostnames):
1069         (WebCore::deleteAllCookiesModifiedSince):
1070
1071 2018-03-26  Alex Christensen  <achristensen@webkit.org>
1072
1073         Merge ResourceHandleClient::willCacheResponseAsync with ResourceHandleClient::willCacheResponse
1074         https://bugs.webkit.org/show_bug.cgi?id=183965
1075
1076         Reviewed by Chris Dumez.
1077
1078         It turns out that ResourceHandleClient::willCacheResponseAsync didn't do anything and the logic in
1079         ResourceHandleClient::willCacheResponse was not being called.  This makes it so there is one code
1080         path and it executes the logic in ResourceHandleClient::willCacheResponse.
1081
1082         * loader/EmptyFrameLoaderClient.h:
1083         * loader/FrameLoaderClient.h:
1084         * loader/ResourceLoader.h:
1085         * loader/SubresourceLoader.h:
1086         * loader/cocoa/SubresourceLoaderCocoa.mm:
1087         (WebCore::SubresourceLoader::willCacheResponseAsync):
1088         (WebCore::SubresourceLoader::willCacheResponse): Deleted.
1089         * loader/mac/ResourceLoaderMac.mm:
1090         (WebCore::ResourceLoader::willCacheResponseAsync):
1091         (WebCore::ResourceLoader::willCacheResponse): Deleted.
1092         * platform/network/ResourceHandle.h:
1093         * platform/network/ResourceHandleClient.cpp:
1094         (WebCore::ResourceHandleClient::willCacheResponseAsync): Deleted.
1095         * platform/network/ResourceHandleClient.h:
1096         (WebCore::ResourceHandleClient::willCacheResponseAsync):
1097         (WebCore::ResourceHandleClient::shouldCacheResponse):
1098         (WebCore::ResourceHandleClient::willCacheResponse): Deleted.
1099         * platform/network/cf/ResourceHandleCFNet.cpp:
1100         (WebCore::ResourceHandle::continueWillCacheResponse): Deleted.
1101         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
1102         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1103         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
1104         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillCacheResponse): Deleted.
1105         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
1106         * platform/network/mac/ResourceHandleMac.mm:
1107         (WebCore::ResourceHandle::continueWillCacheResponse): Deleted.
1108         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
1109         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1110         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
1111         (-[WebCoreResourceHandleAsOperationQueueDelegate continueWillCacheResponse:]): Deleted.
1112
1113 2018-03-26  Miguel Gomez  <magomez@igalia.com>
1114
1115         [GTK][WPE] Upload correct buffer in BitmapTextureGL::updateContents()
1116         https://bugs.webkit.org/show_bug.cgi?id=184004
1117
1118         Reviewed by Žan Doberšek.
1119
1120         Do not upload the original buffer. Upload the result of creating a subImage buffer
1121         if it was required.
1122
1123         Covered by existent tests.
1124
1125         * platform/graphics/texmap/BitmapTextureGL.cpp:
1126         (WebCore::BitmapTextureGL::updateContents):
1127
1128 2018-03-25  Zan Dobersek  <zdobersek@igalia.com>
1129
1130         [TexMap] Clean up TextureMapperPlatformLayer, TextureMapperBackingStore code
1131         https://bugs.webkit.org/show_bug.cgi?id=183985
1132
1133         Reviewed by Michael Catanzaro.
1134
1135         Clean up TextureMapperPlatformLayer and TextureMapperBackingStore
1136         headers and implementation files. Remove dubious whitespace, use #pragma
1137         once, clean up constructors, destructors, method definitions and remove
1138         unnecessary includes in favor of forward declarations where possible.
1139
1140         The TextureMapperPlatformLayer::swapBuffers() method is removed as it
1141         wasn't called or overridden anywhere.
1142
1143         No new tests -- no change in functionality.
1144
1145         * platform/graphics/texmap/TextureMapperBackingStore.cpp:
1146         * platform/graphics/texmap/TextureMapperBackingStore.h:
1147         (WebCore::TextureMapperBackingStore::drawRepaintCounter):
1148         * platform/graphics/texmap/TextureMapperPlatformLayer.h:
1149         (WebCore::TextureMapperPlatformLayer::setClient):
1150         (WebCore::TextureMapperPlatformLayer::TextureMapperPlatformLayer): Deleted.
1151         (WebCore::TextureMapperPlatformLayer::swapBuffers): Deleted.
1152
1153 2018-03-25  Dan Bernstein  <mitz@apple.com>
1154
1155         [Xcode] Remove workaround only needed for deploying to iOS 10.0 and earlier
1156         https://bugs.webkit.org/show_bug.cgi?id=183999
1157
1158         Reviewed by Sam Weinig.
1159
1160         * Configurations/WebCore.xcconfig: Removed build settings.
1161         * Configurations/WebCoreTestSupport.xcconfig: Removed location of phony WebKitLegacy from
1162           frameworks search path.
1163         * Configurations/WebKitLegacyStub.iOS.tbd: Removed.
1164         * WebCore.xcodeproj/project.pbxproj: Removed script build phase from the Derived Sources target.
1165
1166 2018-03-25  Commit Queue  <commit-queue@webkit.org>
1167
1168         Unreviewed, rolling out r229954.
1169         https://bugs.webkit.org/show_bug.cgi?id=184000
1170
1171         Caused many layout tests to crash on Apple High Sierra,
1172         Sierra, iOS Simulator and GTK Linux Debug test bots (Requested
1173         by dydz on #webkit).
1174
1175         Reverted changeset:
1176
1177         "Use SecurityOriginData more consistently in Service Worker
1178         code"
1179         https://bugs.webkit.org/show_bug.cgi?id=183969
1180         https://trac.webkit.org/changeset/229954
1181
1182 2018-03-23  Alex Christensen  <achristensen@webkit.org>
1183
1184         Use completion handlers for ResourceHandleClient::canAuthenticateAgainstProtectionSpaceAsync
1185         https://bugs.webkit.org/show_bug.cgi?id=183966
1186
1187         Reviewed by Chris Dumez.
1188
1189         No change in behavior.
1190
1191         * loader/ResourceLoader.cpp:
1192         (WebCore::ResourceLoader::canAuthenticateAgainstProtectionSpaceAsync):
1193         * loader/ResourceLoader.h:
1194         * platform/network/BlobResourceHandle.cpp:
1195         * platform/network/PingHandle.h:
1196         * platform/network/ResourceHandle.h:
1197         * platform/network/ResourceHandleClient.h:
1198         * platform/network/SynchronousLoaderClient.cpp:
1199         (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpaceAsync):
1200         * platform/network/SynchronousLoaderClient.h:
1201         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
1202         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1203         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
1204         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
1205         * platform/network/mac/ResourceHandleMac.mm:
1206         (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
1207         (WebCore::ResourceHandle::continueCanAuthenticateAgainstProtectionSpace): Deleted.
1208         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
1209         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1210         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
1211         (-[WebCoreResourceHandleAsOperationQueueDelegate continueCanAuthenticateAgainstProtectionSpace:]): Deleted.
1212
1213 2018-03-24  Chris Dumez  <cdumez@apple.com>
1214
1215         Use SecurityOriginData more consistently in Service Worker code
1216         https://bugs.webkit.org/show_bug.cgi?id=183969
1217
1218         Reviewed by Darin Adler.
1219
1220         Use SecurityOriginData more consistently in Service Worker code to avoid constructing
1221         SecurityOrigin objects unnecessarily.
1222
1223         I also updated SecurityOrigin to use SecurityOriginData as a data member. This reduces
1224         code duplication a bit. This also avoids constructing SecurityOriginData unnecessarily
1225         in some cases as callers can now use SecurityOrigin::data() instead of
1226         SecurityOriginData::fromSecurityOrigin().
1227
1228         No new tests, no Web-facing behavior change.
1229
1230         * Modules/cache/DOMCacheStorage.cpp:
1231         (WebCore::DOMCacheStorage::origin const):
1232         * Modules/encryptedmedia/CDM.cpp:
1233         (WebCore::CDM::storageDirectory const):
1234         * Modules/encryptedmedia/MediaKeySession.cpp:
1235         (WebCore::MediaKeySession::mediaKeysStorageDirectory const):
1236         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
1237         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory const):
1238         * Modules/indexeddb/IDBFactory.cpp:
1239         (WebCore::IDBFactory::openInternal):
1240         (WebCore::IDBFactory::deleteDatabase):
1241         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
1242         (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
1243         * Modules/webdatabase/Database.cpp:
1244         (WebCore::Database::securityOrigin):
1245         * Modules/webdatabase/DatabaseContext.cpp:
1246         (WebCore::DatabaseContext::securityOrigin const):
1247         * Modules/webdatabase/DatabaseContext.h:
1248         * Modules/webdatabase/DatabaseManager.cpp:
1249         (WebCore::DatabaseManager::fullPathForDatabase):
1250         (WebCore::DatabaseManager::detailsForNameAndOrigin):
1251         * html/HTMLMediaElement.cpp:
1252         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const):
1253         * inspector/agents/InspectorDOMStorageAgent.cpp:
1254         (WebCore::InspectorDOMStorageAgent::findStorageArea):
1255         * loader/appcache/ApplicationCacheStorage.cpp:
1256         (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
1257         (WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
1258         (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
1259         (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
1260         (WebCore::ApplicationCacheStorage::store):
1261         (WebCore::ApplicationCacheStorage::ensureOriginRecord):
1262         * page/DOMWindow.cpp:
1263         (WebCore:: const):
1264         * page/SecurityOrigin.cpp:
1265         (WebCore::SecurityOrigin::SecurityOrigin):
1266         (WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
1267         (WebCore::SecurityOrigin::canAccess const):
1268         (WebCore::SecurityOrigin::canDisplay const):
1269         (WebCore::SecurityOrigin::domainForCachePartition const):
1270         (WebCore::SecurityOrigin::isLocal const):
1271         (WebCore::SecurityOrigin::toString const):
1272         (WebCore::SecurityOrigin::toRawString const):
1273         (WebCore::SecurityOrigin::create):
1274         (WebCore::SecurityOrigin::isSameSchemeHostPort const):
1275         * page/SecurityOrigin.h:
1276         (WebCore::SecurityOrigin::protocol const):
1277         (WebCore::SecurityOrigin::host const):
1278         (WebCore::SecurityOrigin::port const):
1279         (WebCore::SecurityOrigin::data const):
1280         (WebCore::SecurityOrigin::isHTTPFamily const):
1281         * page/SecurityOriginData.cpp:
1282         (WebCore::SecurityOriginData::toString const):
1283         (WebCore::SecurityOriginData::fromFrame):
1284         * page/SecurityOriginData.h:
1285         (WebCore::SecurityOriginData::fromURL):
1286         * storage/StorageNamespaceProvider.cpp:
1287         (WebCore::StorageNamespaceProvider::localStorageArea):
1288         * testing/Internals.cpp:
1289         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
1290         * workers/service/ServiceWorkerContainer.cpp:
1291         (WebCore::ServiceWorkerContainer::addRegistration):
1292         (WebCore::ServiceWorkerContainer::removeRegistration):
1293         (WebCore::ServiceWorkerContainer::updateRegistration):
1294         * workers/service/ServiceWorkerRegistrationKey.cpp:
1295         (WebCore::ServiceWorkerRegistrationKey::relatesToOrigin const):
1296         * workers/service/ServiceWorkerRegistrationKey.h:
1297         * workers/service/server/SWOriginStore.cpp:
1298         (WebCore::SWOriginStore::add):
1299         (WebCore::SWOriginStore::remove):
1300         (WebCore::SWOriginStore::clear):
1301         * workers/service/server/SWOriginStore.h:
1302         * workers/service/server/SWServer.cpp:
1303         (WebCore::SWServer::addRegistration):
1304         (WebCore::SWServer::removeRegistration):
1305         (WebCore::SWServer::clear):
1306         (WebCore::SWServer::tryInstallContextData):
1307         (WebCore::SWServer::serverToContextConnectionCreated):
1308         (WebCore::SWServer::markAllWorkersForOriginAsTerminated):
1309         (WebCore::SWServer::unregisterServiceWorkerClient):
1310         (WebCore::SWServer::needsServerToContextConnectionForOrigin const):
1311         * workers/service/server/SWServer.h:
1312         * workers/service/server/SWServerToContextConnection.cpp:
1313         (WebCore::SWServerToContextConnection::SWServerToContextConnection):
1314         (WebCore::SWServerToContextConnection::~SWServerToContextConnection):
1315         (WebCore::SWServerToContextConnection::connectionForOrigin):
1316         * workers/service/server/SWServerToContextConnection.h:
1317         (WebCore::SWServerToContextConnection::securityOrigin const):
1318         * workers/service/server/SWServerWorker.cpp:
1319         (WebCore::SWServerWorker::origin const):
1320         (WebCore::SWServerWorker::securityOrigin const):
1321         * workers/service/server/SWServerWorker.h:
1322
1323 2018-03-24  Commit Queue  <commit-queue@webkit.org>
1324
1325         Unreviewed, rolling out r229792.
1326         https://bugs.webkit.org/show_bug.cgi?id=183980
1327
1328         not actually necessary (Requested by thorton on #webkit).
1329
1330         Reverted changeset:
1331
1332         "Fix the build"
1333         https://trac.webkit.org/changeset/229792
1334
1335 2018-03-23  Tim Horton  <timothy_horton@apple.com>
1336
1337         Fix the geolocation build
1338         https://bugs.webkit.org/show_bug.cgi?id=183975
1339
1340         * Modules/geolocation/ios/GeolocationPositionIOS.mm:
1341         (WebCore::GeolocationPosition::GeolocationPosition):
1342
1343 2018-03-23  Tim Horton  <timothy_horton@apple.com>
1344
1345         Fix the build with no pasteboard
1346         https://bugs.webkit.org/show_bug.cgi?id=183973
1347
1348         Reviewed by Dan Bernstein.
1349
1350         * Configurations/FeatureDefines.xcconfig:
1351         * platform/ios/PlatformPasteboardIOS.mm:
1352
1353 2018-03-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1354
1355         [Extra zoom mode] Fix some localizable strings after r229878
1356         https://bugs.webkit.org/show_bug.cgi?id=183963
1357
1358         Reviewed by Tim Horton.
1359
1360         The WEB_UI_STRING macro was incorrectly used for certain localized strings pertaining to extra zoom mode. To
1361         correct this, make the "Done" string use WEB_UI_STRING with actual UI-facing text; since day, year and month
1362         labels in the date picker are less generalizable to other UI, leave these as unique keys, but change them to
1363         use WEB_UI_STRING_KEY instead.
1364
1365         Additionally, remove now-unused localizable strings for the text input view controller.
1366
1367         * English.lproj/Localizable.strings:
1368         * platform/LocalizedStrings.cpp:
1369         (WebCore::formControlDoneButtonTitle):
1370         (WebCore::datePickerDayLabelTitle):
1371         (WebCore::datePickerMonthLabelTitle):
1372         (WebCore::datePickerYearLabelTitle):
1373
1374 2018-03-23  Chris Dumez  <cdumez@apple.com>
1375
1376         NetworkStateNotifier::updateStateWithoutNotifying() is inefficient
1377         https://bugs.webkit.org/show_bug.cgi?id=183760
1378         <rdar://problem/37093299>
1379
1380         Reviewed by Ryosuke Niwa.
1381
1382         Update NetworkStateNotifier::updateStateWithoutNotifying() to stop calling
1383         SCDynamicStoreCopyKeyList(). SCDynamicStoreCopyKeyList() is expensive as it
1384         expects its key parameter to be a regular expression and it can match several
1385         keys. It is also unnecessary in our case since we already have an exact key.
1386         We now call the more efficient SCDynamicStoreCopyValue() instead, which is
1387         the right thing to call when we have an exact key.
1388
1389         This change was suggested by the SC team.
1390
1391         This was tested manually as there is no easy way to write an automated test
1392         for this.
1393
1394         In a follow-up, I also plan to call this code in the UIProcess (or NetworkProcess)
1395         to avoid calling it once per WebProcess.
1396
1397         * platform/network/mac/NetworkStateNotifierMac.cpp:
1398         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying):
1399
1400 2018-03-23  Daniel Bates  <dabates@apple.com>
1401
1402         Unreviewed, rolling out r229868.
1403
1404         Caused media controls tests to timeout. Will investigate
1405         offline.
1406
1407         Reverted changeset:
1408
1409         "CSS mask images should be retrieved using potentially CORS-
1410         enabled fetch"
1411         https://bugs.webkit.org/show_bug.cgi?id=179983
1412         https://trac.webkit.org/changeset/229868
1413
1414 2018-03-23  Mark Lam  <mark.lam@apple.com>
1415
1416         Add pointer profiling hooks to the CSS JIT.
1417         https://bugs.webkit.org/show_bug.cgi?id=183947
1418         <rdar://problem/38803593>
1419
1420         Reviewed by JF Bastien.
1421
1422         No new tests needed.  Covered by existing tests.
1423
1424         * bindings/scripts/CodeGeneratorJS.pm:
1425         (GenerateImplementation):
1426         - Added a missing application of WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION().
1427
1428         * bindings/scripts/test/JS/JSInterfaceName.cpp:
1429         (WebCore::toJSNewlyCreated):
1430         * bindings/scripts/test/JS/JSMapLike.cpp:
1431         (WebCore::toJSNewlyCreated):
1432         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
1433         (WebCore::toJSNewlyCreated):
1434         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1435         (WebCore::toJSNewlyCreated):
1436         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
1437         (WebCore::toJSNewlyCreated):
1438         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
1439         (WebCore::toJSNewlyCreated):
1440         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
1441         (WebCore::toJSNewlyCreated):
1442         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
1443         (WebCore::toJSNewlyCreated):
1444         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
1445         (WebCore::toJSNewlyCreated):
1446         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
1447         (WebCore::toJSNewlyCreated):
1448         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1449         (WebCore::toJSNewlyCreated):
1450         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1451         (WebCore::toJSNewlyCreated):
1452         * bindings/scripts/test/JS/JSTestException.cpp:
1453         (WebCore::toJSNewlyCreated):
1454         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
1455         (WebCore::toJSNewlyCreated):
1456         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1457         (WebCore::toJSNewlyCreated):
1458         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
1459         (WebCore::toJSNewlyCreated):
1460         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
1461         (WebCore::toJSNewlyCreated):
1462         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
1463         (WebCore::toJSNewlyCreated):
1464         * bindings/scripts/test/JS/JSTestIterable.cpp:
1465         (WebCore::toJSNewlyCreated):
1466         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
1467         (WebCore::toJSNewlyCreated):
1468         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
1469         (WebCore::toJSNewlyCreated):
1470         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
1471         (WebCore::toJSNewlyCreated):
1472         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
1473         (WebCore::toJSNewlyCreated):
1474         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1475         (WebCore::toJSNewlyCreated):
1476         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
1477         (WebCore::toJSNewlyCreated):
1478         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
1479         (WebCore::toJSNewlyCreated):
1480         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
1481         (WebCore::toJSNewlyCreated):
1482         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
1483         (WebCore::toJSNewlyCreated):
1484         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
1485         (WebCore::toJSNewlyCreated):
1486         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
1487         (WebCore::toJSNewlyCreated):
1488         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
1489         (WebCore::toJSNewlyCreated):
1490         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
1491         (WebCore::toJSNewlyCreated):
1492         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
1493         (WebCore::toJSNewlyCreated):
1494         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
1495         (WebCore::toJSNewlyCreated):
1496         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
1497         (WebCore::toJSNewlyCreated):
1498         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
1499         (WebCore::toJSNewlyCreated):
1500         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
1501         (WebCore::toJSNewlyCreated):
1502         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
1503         (WebCore::toJSNewlyCreated):
1504         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
1505         (WebCore::toJSNewlyCreated):
1506         * bindings/scripts/test/JS/JSTestNode.cpp:
1507         (WebCore::toJSNewlyCreated):
1508         * bindings/scripts/test/JS/JSTestObj.cpp:
1509         (WebCore::toJSNewlyCreated):
1510         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1511         (WebCore::toJSNewlyCreated):
1512         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1513         (WebCore::toJSNewlyCreated):
1514         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1515         (WebCore::toJSNewlyCreated):
1516         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
1517         (WebCore::toJSNewlyCreated):
1518         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
1519         (WebCore::toJSNewlyCreated):
1520         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1521         (WebCore::toJSNewlyCreated):
1522         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1523         (WebCore::toJSNewlyCreated):
1524         * bindings/scripts/test/JS/JSTestStringifier.cpp:
1525         (WebCore::toJSNewlyCreated):
1526         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
1527         (WebCore::toJSNewlyCreated):
1528         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
1529         (WebCore::toJSNewlyCreated):
1530         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
1531         (WebCore::toJSNewlyCreated):
1532         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
1533         (WebCore::toJSNewlyCreated):
1534         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
1535         (WebCore::toJSNewlyCreated):
1536         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
1537         (WebCore::toJSNewlyCreated):
1538         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1539         (WebCore::toJSNewlyCreated):
1540         * css/ElementRuleCollector.cpp:
1541         (WebCore::ElementRuleCollector::ruleMatches):
1542         * cssjit/SelectorCompiler.cpp:
1543         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
1544         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker):
1545         * cssjit/SelectorCompiler.h:
1546         (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction):
1547         (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction):
1548         (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext):
1549         (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext):
1550         * dom/SelectorQuery.cpp:
1551         (WebCore::SelectorDataList::executeCompiledSingleMultiSelectorData const):
1552         (WebCore::SelectorDataList::execute const):
1553
1554 2018-03-23  Sihui Liu  <sihui_liu@apple.com>
1555
1556         Local storage getItem() for an empty string returned UNDEFINED value.
1557         https://bugs.webkit.org/show_bug.cgi?id=69138
1558         <rdar://problem/13410974>
1559
1560         Reviewed by Brady Eidson.
1561
1562         * platform/sql/SQLiteStatement.cpp:
1563         (WebCore::SQLiteStatement::getColumnBlobAsString):
1564
1565 2018-03-23  Chris Dumez  <cdumez@apple.com>
1566
1567         Promptly terminate service worker processes when they are no longer needed
1568         https://bugs.webkit.org/show_bug.cgi?id=183873
1569         <rdar://problem/38676995>
1570
1571         Reviewed by Youenn Fablet.
1572
1573         The StorageProcess now keeps track of service worker clients for each security
1574         origin. When there is no longer any clients for a given security origin, the
1575         StorageProcess asks the service worker process for the given origin to terminate
1576         and severs its connection to it.
1577
1578         Change is covered by API test.
1579
1580         * workers/service/server/SWServer.cpp:
1581         (WebCore::SWServer::markAllWorkersForOriginAsTerminated):
1582         Pass the security origin since this is called when a service worker process
1583         crashes. When a service worker process for origin A crashes, we only want
1584         to mark service workers in origin A as terminated, not ALL of them.
1585
1586         (WebCore::SWServer::registerServiceWorkerClient):
1587         (WebCore::SWServer::unregisterServiceWorkerClient):
1588         (WebCore::SWServer::needsServerToContextConnectionForOrigin const):
1589         Tweak logic so that we only relaunch a service worker process if we still
1590         have clients for its security origin.
1591
1592         * workers/service/server/SWServer.h:
1593         (WebCore::SWServer::disableServiceWorkerProcessTerminationDelay):
1594         Add a way to disable the service worker termination delay to facilitate
1595         testing.
1596
1597         * workers/service/server/SWServerToContextConnection.h:
1598
1599 2018-03-23  Brady Eidson  <beidson@apple.com>
1600
1601         Go to back/forward list items after a process-swapped navigation.
1602         <rdar://problem/38690544> and https://bugs.webkit.org/show_bug.cgi?id=183920
1603
1604         Reviewed by Andy Estes.
1605
1606         Covered by new API test.
1607
1608         Most of the changes to WebCore are teaching HistoryItem navigations to know when they should
1609         do a policy check or not.
1610
1611         * WebCore.xcodeproj/project.pbxproj:
1612
1613         * history/BackForwardController.cpp:
1614         (WebCore::BackForwardController::goBackOrForward):
1615         (WebCore::BackForwardController::goBack):
1616         (WebCore::BackForwardController::goForward):
1617
1618         * history/HistoryItem.cpp:
1619         (WebCore::HistoryItem::setStateObject): Actually push state object changes to the UIProcess.
1620           This was a long standing bug that made it difficult to effectively test this change.
1621
1622         * loader/FrameLoader.cpp:
1623         (WebCore::FrameLoader::loadURLIntoChildFrame):
1624         (WebCore::FrameLoader::loadDifferentDocumentItem):
1625         (WebCore::FrameLoader::loadItem):
1626         (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad):
1627         * loader/FrameLoader.h:
1628         * loader/FrameLoaderTypes.h:
1629
1630         * loader/HistoryController.cpp:
1631         (WebCore::HistoryController::goToItem):
1632         (WebCore::HistoryController::setDefersLoading):
1633         (WebCore::HistoryController::recursiveGoToItem):
1634         * loader/HistoryController.h:
1635
1636         * loader/NavigationPolicyCheck.h:
1637
1638         * page/Page.cpp:
1639         (WebCore::Page::goToItem):
1640         * page/Page.h:
1641
1642 2018-03-23  John Wilander  <wilander@apple.com>
1643
1644         Resource Load Statistics: Fix decoder key isPrevalentResource->isVeryPrevalentResource
1645         https://bugs.webkit.org/show_bug.cgi?id=183950
1646         <rdar://problem/38806275>
1647
1648         Reviewed by Brent Fulgham.
1649
1650         * loader/ResourceLoadStatistics.cpp:
1651         (WebCore::ResourceLoadStatistics::decode):
1652             Now isVeryPrevalentResource is decoded to the correct field.
1653
1654 2018-03-23  Youenn Fablet  <youenn@apple.com>
1655
1656         WebProcessPool should not ask to register all clients for each service worker process creation
1657         https://bugs.webkit.org/show_bug.cgi?id=183941
1658
1659         Reviewed by Chris Dumez.
1660
1661         Covered by existing unit tests.
1662         Register all Documents of a process no matter its session ID when asked to.
1663         Make sure that whenever a WebProcess is asked to do so, any further Document will be registered
1664         by calling setMayHaveRegisteredServiceWorkers().
1665         This ensures that a WebProcess created before any service worker but empty at the time a service worker is created
1666         will actually register all its future clients.
1667
1668         Add some assertions to ensure that a client is not registered twice.
1669
1670         * workers/service/ServiceWorkerProvider.cpp:
1671         (WebCore::ServiceWorkerProvider::registerServiceWorkerClients):
1672         * workers/service/ServiceWorkerProvider.h:
1673         * workers/service/server/SWServer.cpp:
1674         (WebCore::SWServer::registerServiceWorkerClient):
1675
1676 2018-03-23  Eric Carlson  <eric.carlson@apple.com>
1677
1678         HTMLElement factory doesn't need to call MediaPlayer::isAvailable
1679         https://bugs.webkit.org/show_bug.cgi?id=183946
1680         <rdar://problem/38802687>
1681
1682         Reviewed by Youenn Fablet.
1683
1684         Test: media/media-disabled.html
1685
1686         * dom/make_names.pl:
1687         (printConstructorInterior):
1688         * page/Settings.yaml:
1689         * page/SettingsDefaultValues.h:
1690
1691 2018-03-23  David Kilzer  <ddkilzer@apple.com>
1692
1693         Stop using dispatch_set_target_queue()
1694         <https://webkit.org/b/183908>
1695         <rdar://problem/33553533>
1696
1697         Reviewed by Daniel Bates.
1698
1699         No new tests since no change in behavior.
1700
1701         * platform/mediastream/mac/AVMediaCaptureSource.mm:
1702         (WebCore::globaVideoCaptureSerialQueue): Remove use of
1703         dispatch_set_target_queue() by changing dispatch_queue_create()
1704         to dispatch_queue_create_with_target().
1705
1706 2018-03-23  Youenn Fablet  <youenn@apple.com>
1707
1708         Use libwebrtc ObjectiveC H264 encoder and decoder
1709         https://bugs.webkit.org/show_bug.cgi?id=183912
1710
1711         Reviewed by Eric Carlson.
1712
1713         No observable change of behavior.
1714         Made use of libwebrtc WebKit utilities.
1715         Updated RealtimeINcomingVideoSourceCocoa as it now receives ObjcVideoFrame.
1716
1717         * Configurations/WebCore.xcconfig:
1718         * SourcesCocoa.txt:
1719         * WebCore.xcodeproj/project.pbxproj:
1720         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
1721         (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa):
1722         (WebCore::LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed):
1723         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
1724         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
1725         (WebCore::LibWebRTCProviderCocoa::setActive):
1726         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
1727         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: Renamed from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp.
1728         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
1729         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
1730         * testing/Internals.cpp: Removed commented out include.
1731
1732 2018-03-23  Youenn Fablet  <youenn@apple.com>
1733
1734         DocumentThreadableLoader should send credentials after redirections and preflight if fetch option credentials is include
1735         https://bugs.webkit.org/show_bug.cgi?id=183928
1736
1737         Reviewed by Chris Dumez.
1738
1739         Tests: imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-redirect.any.html
1740                imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-redirect.any.worker.html
1741
1742         In case mode is include, keep sending credentials even after redirection with preflight.
1743
1744         * loader/DocumentThreadableLoader.cpp:
1745         (WebCore::DocumentThreadableLoader::redirectReceived):
1746
1747 2018-03-23  Tim Horton  <timothy_horton@apple.com>
1748
1749         Fix the build after r229858
1750
1751         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
1752
1753 2018-03-23  Youenn Fablet  <youenn@apple.com>
1754
1755         Allow fully whitelisted plug-ins to match non HTTP URLs
1756         https://bugs.webkit.org/show_bug.cgi?id=183938
1757         rdar://problem/38534312
1758
1759         Reviewed by Chris Dumez.
1760
1761         Covered by manual testing and unit testing.
1762
1763         * platform/URL.cpp:
1764         (WebCore::URL::isMatchingDomain const):
1765
1766 2018-03-23  Youenn Fablet  <youenn@apple.com>
1767
1768         ActiveDOMObject should assert that they are destroyed in the thread they are created
1769         https://bugs.webkit.org/show_bug.cgi?id=183671
1770
1771         Reviewed by Chris Dumez.
1772
1773         No change of behavior.
1774         Moved MessagePort assertion to ActiveDOMObject.
1775
1776         * dom/ActiveDOMObject.cpp:
1777         (WebCore::ActiveDOMObject::~ActiveDOMObject):
1778         * dom/ActiveDOMObject.h:
1779         * dom/MessagePort.cpp:
1780         (WebCore::MessagePort::~MessagePort):
1781         * dom/MessagePort.h:
1782
1783 2018-03-23  Youenn Fablet  <youenn@apple.com>
1784
1785         Safari WebKitWebRTCAudioModule crash during <video> tag update when audio track present in MediaStream
1786         https://bugs.webkit.org/show_bug.cgi?id=181180
1787         <rdar://problem/36302375>
1788
1789         Reviewed by Eric Carlson.
1790
1791         Test: webrtc/video-update-often.html
1792
1793         AudioTrackPrivateMediaStreamCocoa needs to be destroyed in the main thread since it owns a Ref to its MediaStreamTrackPrivate.
1794         We can still ref it on a background thread but we always deref it on the main thread.
1795
1796         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
1797         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
1798         (WebCore::AudioTrackPrivateMediaStreamCocoa::render):
1799
1800 2018-03-23  Sergio Villar Senin  <svillar@igalia.com>
1801
1802         [css-grid] Fix auto repeat tracks computation with definite min sizes
1803         https://bugs.webkit.org/show_bug.cgi?id=183933
1804
1805         Reviewed by Javier Fernandez.
1806
1807         Indefinitely sized containers use the specified definite min-size (if any) as available
1808         space in order to compute the number of auto repeat tracks to create. A bug in that code was
1809         causing the grid to be one track larger than expected. That was only happening in the case
1810         of the free space being a multiple of the total size of the autorepeat tracks.
1811
1812         Test: imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-inline-auto-repeat-001.html
1813
1814         * rendering/RenderGrid.cpp:
1815         (WebCore::RenderGrid::computeAutoRepeatTracksCount const):
1816
1817 2018-03-23  Miguel Gomez  <magomez@igalia.com>
1818
1819         [GTK][WPE] Avoid software color conversion inside BitmapTextureGL
1820         https://bugs.webkit.org/show_bug.cgi?id=183892
1821
1822         Reviewed by Žan Doberšek.
1823
1824         Always use RGBA format on BitmapTextureGL (when no other format is specifically requested). When
1825         the texture is updated from BGRA content, use a flag to indicate the shader to perform a color
1826         conversion during the painting. This way we don't need to swap the R and B components on the CPU.
1827         Also, remove one of the lists in BitmapTexturePool as now all of them have the same format, and
1828         remove the UpdateContentsFlag as we never need to modify the original image data.
1829
1830         Covered by existent tests.
1831
1832         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1833         (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture):
1834         * platform/graphics/texmap/BitmapTexture.cpp:
1835         (WebCore::BitmapTexture::updateContents):
1836         * platform/graphics/texmap/BitmapTexture.h:
1837         * platform/graphics/texmap/BitmapTextureGL.cpp:
1838         (WebCore::BitmapTextureGL::BitmapTextureGL):
1839         (WebCore::BitmapTextureGL::didReset):
1840         (WebCore::BitmapTextureGL::updateContents):
1841         (WebCore::BitmapTextureGL::applyFilters):
1842         (WebCore::swizzleBGRAToRGBA): Deleted.
1843         (WebCore::BitmapTextureGL::updateContentsNoSwizzle): Deleted.
1844         * platform/graphics/texmap/BitmapTextureGL.h:
1845         (WebCore::BitmapTextureGL::colorConvertFlags const):
1846         * platform/graphics/texmap/BitmapTexturePool.cpp:
1847         (WebCore::BitmapTexturePool::acquireTexture):
1848         (WebCore::BitmapTexturePool::releaseUnusedTexturesTimerFired):
1849         * platform/graphics/texmap/BitmapTexturePool.h:
1850         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
1851         (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
1852         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
1853         (WebCore::TextureMapperContextAttributes::get):
1854         * platform/graphics/texmap/TextureMapperContextAttributes.h:
1855         * platform/graphics/texmap/TextureMapperGL.cpp:
1856         (WebCore::TextureMapperGL::drawNumber):
1857         (WebCore::TextureMapperGL::drawTexture):
1858         * platform/graphics/texmap/TextureMapperGL.h:
1859         * platform/graphics/texmap/TextureMapperLayer.cpp:
1860         (WebCore::TextureMapperLayer::paintIntoSurface):
1861         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
1862         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
1863         * platform/graphics/texmap/TextureMapperTile.cpp:
1864         (WebCore::TextureMapperTile::updateContents):
1865         * platform/graphics/texmap/TextureMapperTile.h:
1866         * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
1867         (WebCore::TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded):
1868         (WebCore::TextureMapperTiledBackingStore::updateContents):
1869         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
1870
1871 2018-03-23  Yusuke Suzuki  <utatane.tea@gmail.com>
1872
1873         [WTF] Add standard containers with FastAllocator specialization
1874         https://bugs.webkit.org/show_bug.cgi?id=183789
1875
1876         Reviewed by Darin Adler.
1877
1878         * Modules/indexeddb/IDBKeyData.h:
1879         * Modules/mediasource/SampleMap.h:
1880         * Modules/mediasource/SourceBuffer.cpp:
1881         * Modules/webauthn/cbor/CBORValue.h:
1882         It did not use FastAllocator for its container.
1883
1884         * page/WheelEventTestTrigger.h:
1885         * platform/audio/PlatformMediaSessionManager.h:
1886         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
1887         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
1888         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1889         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1890         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1891         (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction):
1892         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
1893         * platform/wpe/PlatformPasteboardWPE.cpp:
1894         * rendering/OrderIterator.h:
1895
1896 2018-03-23  Antoine Quint  <graouts@apple.com>
1897
1898         [Web Animations] infinite repeat counts aren't reflected for CSS Animations
1899         https://bugs.webkit.org/show_bug.cgi?id=183932
1900
1901         Reviewed by Dean Jackson.
1902
1903         The "infinite" value for animation-repeat-count is reflected as a special value which resolves to -1. We need to check
1904         for this special value before setting the iterations count on the AnimationEffectTimingReadOnly object.
1905
1906         * animation/CSSAnimation.cpp:
1907         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
1908
1909 2018-03-22  Antoine Quint  <graouts@apple.com>
1910
1911         [Web Animations] Correctly cancel animations when a parent gets a "display: none" style or when an element is removed
1912         https://bugs.webkit.org/show_bug.cgi?id=183919
1913
1914         Reviewed by Dean Jackson.
1915
1916         The old CSSAnimationController provided a cancelAnimations(Element&) method that allowed for animations for a given element
1917         to be canceled when a parent element in the hierarchy gets a "display: none" style or if an element with animations is removed.
1918         We add a similar cancelAnimationsForElement(Element&) method on AnimationTimeline and update CSSAnimationController::cancelAnimations()
1919         call sites to use AnimationTimeline::cancelAnimationsForElement() when the flag to use Web Animations is on.
1920
1921         * animation/AnimationTimeline.cpp:
1922         (WebCore::AnimationTimeline::cancelAnimationsForElement): Iterate over all animations for the provided element and call cancel() on them.
1923         * animation/AnimationTimeline.h:
1924         * animation/DocumentTimeline.cpp:
1925         (WebCore::DocumentTimeline::animatedStyleForRenderer): Drive-by fix while I was reviewed call sites to animationsForElement() to make
1926         sure we don't create extra RefPtr<> objects.
1927         * dom/Element.cpp:
1928         (WebCore::Element::removedFromAncestor): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on when an
1929         element is removed.
1930         * dom/PseudoElement.cpp:
1931         (WebCore::PseudoElement::clearHostElement): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on when
1932         a pseudo-element is removed.
1933         * rendering/updating/RenderTreeUpdater.cpp:
1934         (WebCore::RenderTreeUpdater::tearDownRenderers): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on
1935         for all children elements when an element gets a "display: none" style.
1936
1937 2018-03-23  Antoine Quint  <graouts@apple.com>
1938
1939         [Web Animations] Animated transform styles are ignored when calling getComputedStyle()
1940         https://bugs.webkit.org/show_bug.cgi?id=183918
1941
1942         Reviewed by Dean Jackson.
1943
1944         Strictly looking at whether the renderer has a transform is a bad idea when determining whether a
1945         transform is applied for an element. Looking at the RenderStyle is preferable because in the case
1946         of animations running on the compositor, such as a transform-only animation or transition, the
1947         renderer doesn't necessarily have a transform style on it, since we don't blend properties in
1948         software as the animation progresses. Instead, all of the blending is performed by the compositor,
1949         and only the computed style object has the software-blended transform style on it.
1950
1951         We do need to account for inline renderers though as these do not support transforms.
1952
1953         * css/CSSComputedStyleDeclaration.cpp:
1954         (WebCore::computedTransform):
1955
1956 2018-03-22  Antoine Quint  <graouts@apple.com>
1957
1958         [Web Animations] Support "transition: all" for CSS Transitions as Web Animations
1959         https://bugs.webkit.org/show_bug.cgi?id=183917
1960
1961         Reviewed by Dean Jackson.
1962
1963         We now support "transition: all" CSS Transitions by iterating over all known CSS properties should the mode
1964         of the backing animation be AnimateAll. Any property that we find to have a different value in the previous
1965         and current style will have a backing CSSTransition object created for it. To support this, we now explicitly
1966         provide a CSSPropertyID when creating a CSSTransition since we can no longer infer the transition property
1967         from the backing animation, as Animation objects with mode AnimateAll report CSSPropertyInvalid as their
1968         property.
1969
1970         * animation/AnimationTimeline.cpp:
1971         (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): New method that checks whether a given backing
1972         Animation object is suitable for consideration as a CSSTransition, where the mode must not be either AnimateNone
1973         or AnimateUnknownProperty, and should the mode be AnimateSingleProperty, the property must not be CSSPropertyInvalid.
1974         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): We now assemble the list of previously animated
1975         properties by looking at the m_elementToCSSTransitionByCSSPropertyID map and getting its keys. Then we compile
1976         all backing Animation objects found in the old style that match the conditions enforced by the new method
1977         shouldBackingAnimationBeConsideredForCSSTransition(). Then as we iterate over backing Animation objects found
1978         in the new style, we iterate over all known CSS properties if the mode is AnimateAll, indicating that we're dealing
1979         with a "transition: all" style. If we're dealing with a single property, we only process that single property.
1980         * animation/CSSTransition.cpp:
1981         (WebCore::CSSTransition::create): Expect a new CSSPropertyID parameter when creating a new CSSTransition since
1982         we can no longer infer it from the backing Animation object.
1983         (WebCore::CSSTransition::CSSTransition): Expect a new CSSPropertyID parameter when creating a new CSSTransition
1984         since we can no longer infer it from the backing Animation object.
1985         (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): We can no longer use the == overloaded operator
1986         for backing Animation objects to determine whether their respective properties match since this would compare the
1987         "property" member of both Animation objects and when going from a "transition: all" style to one targeting a single
1988         property, we would falsely identify mis-matching Animation objects. Instead, we pass a false flag to animationsMatch()
1989         which indicates that we don't care about matching the transition property itself.
1990         * animation/CSSTransition.h: Expose a new property() accessor which returns the CSSPropertyID passed at construction.
1991         * animation/KeyframeEffectReadOnly.cpp:
1992         (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes): Use the new property() accessor on
1993         CSSTransition to get at the transition property.
1994         * platform/animation/Animation.cpp:
1995         (WebCore::Animation::animationsMatch const): Replace the boolean parameter, which was not in use in WebCore, to indicate
1996         whether we should match the property-related fields. We need this in CSSTransition::matchesBackingAnimationAndStyles().
1997         * platform/animation/Animation.h:
1998
1999 2018-03-22  Tim Horton  <timothy_horton@apple.com>
2000
2001         Adopt WK_ALTERNATE_FRAMEWORKS_DIR in WebCore
2002         https://bugs.webkit.org/show_bug.cgi?id=183930
2003         <rdar://problem/38782249>
2004
2005         Reviewed by Dan Bernstein.
2006
2007         * Configurations/Base.xcconfig:
2008         * Configurations/WebCore.xcconfig:
2009         * Configurations/WebCoreTestSupport.xcconfig:
2010
2011 2018-03-22  Commit Queue  <commit-queue@webkit.org>
2012
2013         Unreviewed, rolling out r229876.
2014         https://bugs.webkit.org/show_bug.cgi?id=183929
2015
2016         Some webrtc tests are timing out on iOS simulator (Requested
2017         by youenn on #webkit).
2018
2019         Reverted changeset:
2020
2021         "Use libwebrtc ObjectiveC H264 encoder and decoder"
2022         https://bugs.webkit.org/show_bug.cgi?id=183912
2023         https://trac.webkit.org/changeset/229876
2024
2025 2018-03-22  Megan Gardner  <megan_gardner@apple.com>
2026
2027         Expose more system colors via CSS
2028         https://bugs.webkit.org/show_bug.cgi?id=183764
2029         <rdar://problem/36975898>
2030
2031         Reviewed by Tim Horton.
2032
2033         Test: fast/css/apple-system-control-colors.html
2034
2035         Expose Apple specific system colors via CSS.
2036
2037         * rendering/RenderThemeMac.mm:
2038         (WebCore::RenderThemeMac::systemColor const):
2039
2040 2018-03-22  Nan Wang  <n_wang@apple.com>
2041
2042         AX: Web table row count is incorrect when role row is added to <tr> in DOM
2043         https://bugs.webkit.org/show_bug.cgi?id=183922
2044
2045         Reviewed by Chris Fleizach.
2046
2047         Although the parent table for an ARIA grid row should be an ARIA table, we
2048         should return the native table if the row is native <tr>.
2049
2050         Test: accessibility/row-with-aria-role-in-native-table.html
2051
2052         * accessibility/AccessibilityARIAGridRow.cpp:
2053         (WebCore::AccessibilityARIAGridRow::parentTable const):
2054
2055 2018-03-22  Chris Dumez  <cdumez@apple.com>
2056
2057         Include security origin in the service worker process name
2058         https://bugs.webkit.org/show_bug.cgi?id=183913
2059
2060         Reviewed by Youenn Fablet.
2061
2062         Updated localizable strings.
2063
2064         * English.lproj/Localizable.strings:
2065
2066 2018-03-22  Youenn Fablet  <youenn@apple.com>
2067
2068         Use libwebrtc ObjectiveC H264 encoder and decoder
2069         https://bugs.webkit.org/show_bug.cgi?id=183912
2070
2071         Reviewed by Eric Carlson.
2072
2073         No observable change of behavior.
2074         Made use of libwebrtc WebKit utilities.
2075         Updated RealtimeINcomingVideoSourceCocoa as it now receives ObjcVideoFrame.
2076
2077         * Configurations/WebCore.xcconfig:
2078         * SourcesCocoa.txt:
2079         * WebCore.xcodeproj/project.pbxproj:
2080         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
2081         (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa):
2082         (WebCore::LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed):
2083         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
2084         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
2085         (WebCore::LibWebRTCProviderCocoa::setActive):
2086         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
2087         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: Renamed from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp.
2088         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
2089         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
2090         * testing/Internals.cpp: Removed commented out include.
2091
2092 2018-03-22  Michael Catanzaro  <mcatanzaro@gnome.org>
2093
2094         Unreviewed, fix format string warnings in service worker code
2095
2096         On Linux x86_64, uint64_t is unsigned long, not unsigned long long.
2097
2098         * workers/service/ServiceWorkerContainer.cpp:
2099         (WebCore::ServiceWorkerContainer::addRegistration):
2100         (WebCore::ServiceWorkerContainer::removeRegistration):
2101         (WebCore::ServiceWorkerContainer::updateRegistration):
2102         (WebCore::ServiceWorkerContainer::jobFailedWithException):
2103         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2104         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
2105         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
2106         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
2107         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
2108
2109 2018-03-22  Daniel Bates  <dabates@apple.com>
2110
2111         Expose SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() as WebKit SPI
2112         https://bugs.webkit.org/show_bug.cgi?id=183907
2113         <rdar://problem/38759127>
2114
2115         Reviewed by Alex Christensen.
2116
2117         Exports SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() so that we can use it from WebKit.
2118
2119         * platform/SchemeRegistry.h:
2120
2121 2018-03-22  Daniel Bates  <dabates@apple.com>
2122
2123         CSS mask images should be retrieved using potentially CORS-enabled fetch
2124         https://bugs.webkit.org/show_bug.cgi?id=179983
2125         <rdar://problem/35678149>
2126
2127         Reviewed by Brent Fulgham.
2128
2129         As per <https://drafts.fxtf.org/css-masking-1/#priv-sec> (Editor's Draft, 23 December 2017)
2130         we should fetch CSS mask images using a potentially CORS-enabled fetch.
2131
2132         Both cross-origin CSS shape-outside images and CSS mask images may be sensitive to timing
2133         attacks that can be used to reveal their pixel data when retrieved without regard to CORS.
2134         For the same reason that we fetch CSS shape-outside images using a potentially CORS-enabled
2135         fetch we should fetch CSS mask the same way. This also makes the behavior of WebKit more
2136         closely align with the behavior in the spec.
2137
2138         Test: http/tests/security/css-mask-image.html
2139
2140         * style/StylePendingResources.cpp: Substitute LoadPolicy::NoCORS and LoadPolicy::Anonymous for
2141         LoadPolicy::Normal and LoadPolicy::ShapeOutside, respectively, to match the terminology used
2142         in the HTML, CSS Shapes Module Level 1, and CSS Masking Module Level 1 specs.
2143         (WebCore::Style::loadPendingImage): Ditto.
2144         (WebCore::Style::loadPendingResources): Use load policy LoadPolicy::Anonymous when fetching
2145         a mask image or shape-outside image.
2146
2147 2018-03-22  Zalan Bujtas  <zalan@apple.com>
2148
2149         [Simple line layout] Text with letter spacing is not positioned properly.
2150         https://bugs.webkit.org/show_bug.cgi?id=183079
2151         <rdar://problem/38762569>
2152
2153         Reviewed by Antti Koivisto.
2154
2155         We need to recompute RenderText::m_canUseSimplifiedTextMeasuring when the font cascade changes
2156         since we might not be able to use the fast path anymore.
2157
2158         Test: fast/text/simple-line-layout-dynamic-letter-word-spacing.html
2159
2160         * rendering/RenderText.cpp:
2161         (WebCore::RenderText::styleDidChange):
2162
2163 2018-03-21  Antoine Quint  <graouts@apple.com>
2164
2165         [Web Animations] Make imported/mozilla/css-animations/test_event-dispatch.html pass reliably
2166         https://bugs.webkit.org/show_bug.cgi?id=183845
2167
2168         Reviewed by Dean Jackson.
2169
2170         Finish the work to get DOM events for CSS Animations and CSS Transitions dispatching as specified.
2171
2172         * animation/AnimationEffectReadOnly.cpp: Move timeEpsilon to be shared as part of WebAnimationUtilities.h since we now need it in
2173         WebAnimation::timeToNextRequiredTick().
2174         * animation/AnimationTimeline.cpp:
2175         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We add a pre-emptive return clause when we know that the AnimationList
2176         for previous and current styles are a match.
2177         * animation/CSSTransition.cpp:
2178         (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Ensure we have a valid effect before downcasting it.
2179         * animation/DeclarativeAnimation.cpp:
2180         (WebCore::DeclarativeAnimation::initialize): We need to call pause() for declarative animations that aren't playing so that the animation's
2181         playState is set correctly and the animation is not idle.
2182         * animation/DocumentTimeline.cpp:
2183         (WebCore::DocumentTimeline::updateAnimationSchedule): We no longer need to pass the current time to timeToNextRequiredTick() since the method has
2184         been reworked to use the animation's current time, which is based on the timeline's current time.
2185         (WebCore::DocumentTimeline::updateAnimations): Avoid creating a copy when iterating over pending hardware animations.
2186         * animation/KeyframeEffectReadOnly.cpp:
2187         (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): We should never generate new blending keyframes if the
2188         old and new styles contain the same value, since there would be no transition between two equal values, and we should only look at whether the new
2189         style value and the recorded target value differ to determine if new blending keyframes are necessary.
2190         * animation/WebAnimation.cpp:
2191         (WebCore::WebAnimation::timeToNextRequiredTick const): We correct our scheduling code which was shown to be broken in several of the newly-imported
2192         Mozilla tests. Any running animation is now scheduled to invalidate again on the next tick, and we use timeEpsilon from WebAnimationUtilities.h to
2193         correctly check if we're right at the active threshold, when we also invalidate on the next tick. If our current time is negative, in other words
2194         when the animation has not yet started, we schedule this animation's next tick to be the negative of that value. In all other cases, no invalidation
2195         needs to be scheduled.
2196         * animation/WebAnimation.h: We move updateFinishedState() to private since this method is not actually used outside of WebAnimation.cpp.
2197         * animation/WebAnimationUtilities.h: Move timeEpsilon to be shared as part of WebAnimationUtilities.h.
2198
2199 2018-03-22  Tim Horton  <timothy_horton@apple.com>
2200
2201         Improve readability of WebCore's OTHER_LDFLAGS
2202         https://bugs.webkit.org/show_bug.cgi?id=183909
2203         <rdar://problem/38760992>
2204
2205         Reviewed by Dan Bernstein.
2206
2207         * Configurations/Base.xcconfig:
2208         * Configurations/FeatureDefines.xcconfig:
2209         * Configurations/WebCore.xcconfig:
2210
2211 2018-03-22  Tim Horton  <timothy_horton@apple.com>
2212
2213         Adopt USE(OPENGL[_ES]) in more places
2214         https://bugs.webkit.org/show_bug.cgi?id=183882
2215         <rdar://problem/37912195>
2216
2217         Reviewed by Dan Bernstein.
2218
2219         * platform/graphics/GraphicsContext3D.h:
2220         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
2221         (WebCore::hasMuxableGPU):
2222         (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
2223         (WebCore::GraphicsContext3D::GraphicsContext3D):
2224         (WebCore::GraphicsContext3D::~GraphicsContext3D):
2225         (WebCore::GraphicsContext3D::makeContextCurrent):
2226         (WebCore::GraphicsContext3D::checkGPUStatus):
2227         (WebCore::GraphicsContext3D::texImageIOSurface2D):
2228         * platform/graphics/cocoa/WebGLLayer.h:
2229         * platform/graphics/cocoa/WebGLLayer.mm:
2230         (-[WebGLLayer initWithGraphicsContext3D:]):
2231         (-[WebGLLayer copyImageSnapshotWithColorSpace:]):
2232         (-[WebGLLayer display]):
2233         * platform/graphics/ios/GraphicsContext3DIOS.h:
2234         * platform/graphics/opengl/Extensions3DOpenGL.cpp:
2235         (WebCore::Extensions3DOpenGL::blitFramebuffer):
2236         (WebCore::Extensions3DOpenGL::createVertexArrayOES):
2237         (WebCore::Extensions3DOpenGL::deleteVertexArrayOES):
2238         (WebCore::Extensions3DOpenGL::isVertexArrayOES):
2239         (WebCore::Extensions3DOpenGL::bindVertexArrayOES):
2240         * platform/graphics/opengl/Extensions3DOpenGL.h:
2241         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
2242         (WebCore::GraphicsContext3D::reshapeFBOs):
2243         (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary):
2244         (WebCore::GraphicsContext3D::renderbufferStorage):
2245         (WebCore::GraphicsContext3D::getIntegerv):
2246         (WebCore::GraphicsContext3D::texImage2D):
2247         (WebCore::GraphicsContext3D::depthRange):
2248         (WebCore::GraphicsContext3D::clearDepth):
2249         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2250         (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
2251         Make it a bit more clear which code is platform-dependent and which code is GL/GLES-dependent.
2252
2253 2018-03-22  Zan Dobersek  <zdobersek@igalia.com>
2254
2255         [TexMap] Make TextureMapperContextAttributes thread-specific
2256         https://bugs.webkit.org/show_bug.cgi?id=183895
2257
2258         Reviewed by Carlos Garcia Campos.
2259
2260         Store the TextureMapperContextAttributes in a thread-specific manner.
2261         The TextureMapperContextAttributes::get() method is now used to retrieve
2262         a reference to that thread-specific object. If it's not been initialized
2263         yet, then the current GL context is used for the initialization, as it
2264         used to be done in the now-removed initialize() method.
2265
2266         TextureMapperPlatformLayerBuffer::clone() method now doesn't need to
2267         be passed a TextureMapperGL object, since the texture can be created
2268         directly by calling BitmapTextureGL::create(), passing the
2269         TextureMapperContextAttributes object that's retrieved from the
2270         thread-specific storage. This further simplifies the
2271         TextureMapperPlatformLayerProxy::Compositor interface, removing the
2272         texmapGL() getter from it.
2273
2274         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2275         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
2276         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
2277         (WebCore::threadSpecificAttributes):
2278         (WebCore::TextureMapperContextAttributes::get):
2279         (WebCore::TextureMapperContextAttributes::initialize): Deleted.
2280         * platform/graphics/texmap/TextureMapperContextAttributes.h:
2281         * platform/graphics/texmap/TextureMapperGL.cpp:
2282         (WebCore::TextureMapperGL::TextureMapperGL):
2283         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
2284         (WebCore::TextureMapperPlatformLayerBuffer::clone):
2285         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
2286         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
2287         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
2288         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
2289
2290 2018-03-22  Zalan Bujtas  <zalan@apple.com>
2291
2292         SVG root is skipped while marking percentage height descendants dirty.
2293         https://bugs.webkit.org/show_bug.cgi?id=183877
2294
2295         Reviewed by Antti Koivisto.
2296
2297         Calling continingBlock() to get to the correct container works as long as the ancestor inline element
2298         renderers are wrapped in anonymous blocks (continuation for example).
2299
2300         While the SVG root renderer is an inline renderer, it is not wrapped or normalized in any way,
2301         so containingBlock() will elegantly skip it and return an SVG root ancestor.
2302         dirtyForLayoutFromPercentageHeightDescendants calls containingBlock() to walk up
2303         on the ancestor chain to mark elements dirty. This fails when there's an SVG subtree in the block chain.
2304         This patch marks the SVG subtree chain dirty to ensure that layout will get to all the dirty leaf renderers 
2305         (note that the SVG subtree is supposed to have only statically positioned elements so parent == containing block).
2306
2307         Covered by existing tests.
2308
2309         * rendering/RenderBlock.cpp:
2310         (WebCore::RenderBlock::dirtyForLayoutFromPercentageHeightDescendants):
2311
2312 2018-03-22  Adrian Perez de Castro  <aperez@igalia.com>
2313
2314         [WPE][GTK] Build failure when ENABLE_VIDEO, ENABLE_WEB_AUDIO and ENABLE_XSLT are disabled
2315         https://bugs.webkit.org/show_bug.cgi?id=183896
2316
2317         Reviewed by Yusuke Suzuki.
2318
2319         No new tests needed.
2320
2321         * bindings/js/JSWebAnimationCustom.cpp: Add missing #include of Document.h
2322
2323 2018-03-21  Chris Dumez  <cdumez@apple.com>
2324
2325         Regression(r229828): WebKit.NoHistoryItemScrollToFragment API test is failing on iOS
2326         https://bugs.webkit.org/show_bug.cgi?id=183886
2327
2328         Reviewed by Wenson Hsieh.
2329
2330         Since r229828, the FrameLoader needs to call FrameLoaderClient::didDecidePolicyForNavigationAction()
2331         whenever a navigation policy decision is made. I added such a call r229828 to
2332         FrameLoader::continueLoadAfterNavigationPolicy() but forgot to add one to
2333         FrameLoader::continueFragmentScrollAfterNavigationPolicy(), which is the equivalent
2334         for fragment navigations.
2335
2336         * loader/FrameLoader.cpp:
2337         (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy):
2338
2339 2018-03-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
2340
2341         Disconnect the SVGPathSegList items from their SVGPathElement before rebuilding a new list
2342         https://bugs.webkit.org/show_bug.cgi?id=183723
2343         <rdar://problem/38517871>
2344
2345         Reviewed by Daniel Bates.
2346
2347         When setting the "d" attribute directly on a path, we rebuild the list
2348         of path segments held for creating the property tear off. The old path
2349         segments need to get disconnected from the path element. We already do 
2350         that when a path segment is replaced or removed.
2351
2352         Test: svg/dom/reuse-pathseg-after-changing-d.html
2353
2354         * svg/SVGPathElement.cpp:
2355         (WebCore::SVGPathElement::svgAttributeChanged):
2356         * svg/SVGPathSegList.cpp:
2357         (WebCore::SVGPathSegList::clear): SVGPathSegListValues::clearContextAndRoles()
2358         will now be called from SVGPathSegListValues::clear() via SVGListProperty::clearValues().
2359         (WebCore::SVGPathSegList::replaceItem):
2360         (WebCore::SVGPathSegList::removeItem):
2361         (WebCore::SVGPathSegList::clearContextAndRoles): Deleted.
2362         * svg/SVGPathSegList.h: SVGPathSegListValues::clearContextAndRoles() will
2363         now be called from SVGPathSegListValues::clear() via SVGListProperty::initializeValues().
2364         * svg/SVGPathSegListValues.cpp:
2365         (WebCore::SVGPathSegListValues::clearItemContextAndRole):
2366         (WebCore::SVGPathSegListValues::clearContextAndRoles):
2367         * svg/SVGPathSegListValues.h:
2368         (WebCore::SVGPathSegListValues::operator=):
2369         (WebCore::SVGPathSegListValues::clear):
2370
2371 2018-03-21  Antoine Quint  <graouts@apple.com>
2372
2373         [Web Animations] Ensure animationcancel and transitioncancel events are dispatched
2374         https://bugs.webkit.org/show_bug.cgi?id=183864
2375
2376         Reviewed by Dean Jackson.
2377
2378         In order to correctly dispatch animationcancel and transitioncancel events, we must call cancel() on CSSAnimation and CSSTransitions
2379         objects that are removed while in a play or pause phase. Additionally, we cancel declarative animations that are moving from a valid
2380         to a null timeline. Finally, when cancel() is called on a declarative animation, we record the timestamp and manually call
2381         invalidateDOMEvents() passing that timestamp in to ensure that the right phase change is recorded and results in the queuing of
2382         animationcancel and transitioncancel events.
2383
2384         * animation/AnimationTimeline.cpp:
2385         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Make sure we cancel all recorded CSS Animations when we newly get a
2386         "display: none" style. We also call the new cancelOrRemoveDeclarativeAnimation() method, instead of removing animations outright,
2387         for all animations that previously existed but are no longer listed in the current style.
2388         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Like in updateCSSAnimationsForElement(), we cancel all recorded CSS
2389         Transitions when we newly get a "display: none" style. We now use the refactored removeDeclarativeAnimation() method to remove an
2390         a transition for a property that was already transitioned in the previous style but has a new backing Animation object. Finally,
2391         like in updateCSSAnimationsForElement(), we call the new cancelOrRemoveDeclarativeAnimation() method, instead of removing transitions
2392         outright, for all transitions that previously existed but are no longer listed in the current style.
2393         (WebCore::AnimationTimeline::removeDeclarativeAnimation): Refactor code into this new method to remove a declarative animation.
2394         (WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation): Cancels a DeclarativeAnimation if it's active or removes it right away.
2395         * animation/AnimationTimeline.h:
2396         * animation/DeclarativeAnimation.cpp:
2397         (WebCore::DeclarativeAnimation::setTimeline): If we're moving from a valid timeline to a null timeline, call cancel() on this animation
2398         such that an animationcancel or transitioncancel event can be dispatched.
2399         (WebCore::DeclarativeAnimation::cancel): Cancelations require the computation of the time at which a declarative animation was canceled,
2400         so we record the animation's active time as it's canceled and manually call invalidateDOMEvents() with that time after the general cancel()
2401         code has run.
2402         (WebCore::DeclarativeAnimation::invalidateDOMEvents): Accept an explicit timestamp for cancel events.
2403         * animation/DeclarativeAnimation.h:
2404         * animation/WebAnimation.h:
2405
2406 2018-03-21  Chris Dumez  <cdumez@apple.com>
2407
2408         ScrollViewInsetTests.RestoreInitialContentOffsetAfterCrash API test is failing with async delegates
2409         https://bugs.webkit.org/show_bug.cgi?id=183787
2410
2411         Reviewed by Wenson Hsieh.
2412
2413         * loader/FrameLoader.cpp:
2414         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
2415         * loader/FrameLoaderClient.h:
2416
2417 2018-03-21  Eric Carlson  <eric.carlson@apple.com>
2418
2419         Clean up platform VideoFullscreenLayerManager
2420         https://bugs.webkit.org/show_bug.cgi?id=183859
2421         <rdar://problem/38715419>
2422
2423         Reviewed by Jer Noble.
2424
2425         No new tests, no functional change.
2426
2427         * WebCore.xcodeproj/project.pbxproj:
2428         * platform/graphics/VideoFullscreenLayerManager.h: Copied from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h.
2429         (WebCore::VideoFullscreenLayerManager::~VideoFullscreenLayerManager):
2430         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2431         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2432         (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
2433         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
2434         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer):
2435         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformLayer const):
2436         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
2437         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame):
2438         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity):
2439         (WebCore::MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation const):
2440         (WebCore::MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds):
2441         (WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation):
2442         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2443         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2444         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
2445         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformLayer const):
2446         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
2447         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer):
2448         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
2449         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame):
2450         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation const):
2451         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds):
2452         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation):
2453         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2454         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2455         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
2456         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
2457         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
2458         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer const):
2459         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer):
2460         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenFrame):
2461         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h.
2462         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm.
2463         (-[WebVideoContainerLayer setBounds:]):
2464         (-[WebVideoContainerLayer setPosition:]):
2465         (WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC):
2466         (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer):
2467         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
2468         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame):
2469         (WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer):
2470         (WebCore::VideoFullscreenLayerManagerObjC::requiresTextTrackRepresentation const):
2471         (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds):
2472         (WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation):
2473
2474 2018-03-21  Antoine Quint  <graouts@apple.com>
2475
2476         [Web Animations] Dispatch DOM events for CSS Transitions and CSS Animations implemented as Web Animations
2477         https://bugs.webkit.org/show_bug.cgi?id=183781
2478
2479         Reviewed by Dean Jackson.
2480
2481         Now that we've implemented CSS Animations and CSS Transitions as Web Animations (webkit.org/b/183504) we can dispatch DOM events
2482         for targets of DeclarativeAnimation objects. To do that, we add a new invalidateDOMEvents() method on DeclarativeAnimations which
2483         is called when the timer scheduled after the timing model has been invalidated fires in DocumentTimeline::performInvalidationTask().
2484         When we check for DOM events to dispatch, we look at the last recorded phase and iteration and determine whether the state of the
2485         animation has changed. We use a GenericEventQueue to enqueue the events such that they are dispatched asynchronously at a moment
2486         when it is safe to evaluate script.
2487
2488         * animation/AnimationEffectReadOnly.h: Make currentIteration() public since we now need it in DeclarativeAnimation::invalidateDOMEvents().
2489         * animation/CSSAnimation.cpp:
2490         (WebCore::CSSAnimation::create): Pass the animation target to the constructor instead of its document.
2491         (WebCore::CSSAnimation::CSSAnimation): Pass the animation target to the superclass instead of its document.
2492         * animation/CSSAnimation.h:
2493         * animation/CSSTransition.cpp:
2494         (WebCore::CSSTransition::create): Pass the animation target to the constructor instead of its document.
2495         (WebCore::CSSTransition::CSSTransition): Pass the animation target to the superclass instead of its document.
2496         * animation/CSSTransition.h:
2497         * animation/DeclarativeAnimation.cpp:
2498         (WebCore::DeclarativeAnimation::DeclarativeAnimation): Expect an Element instead of a Document and use that element as the target of the
2499         GenericEventQueue that we initialize. We also register this element as our m_target.
2500         (WebCore::DeclarativeAnimation::~DeclarativeAnimation): Close the GenericEventQueue member upon destruction.
2501         (WebCore::DeclarativeAnimation::initialize): We need to call pause() for declarative animations that aren't playing so that the animation's
2502         playState is set correctly and the animation is not idle.
2503         (WebCore::DeclarativeAnimation::phaseWithoutEffect const): Because we may need to get an animation's current phase in invalidateDOMEvents()
2504         after an animation's effect has been removed, we provide an alternate way to compute the phase just by looking at the animation's current time.
2505         (WebCore::DeclarativeAnimation::invalidateDOMEvents): Based on the previous and current pending state, iteration and phase, we enqueue animation
2506         and transition DOM events as specified by the CSS Animations Level 2 and CSS Transitions Level 2 specifications.
2507         (WebCore::DeclarativeAnimation::enqueueDOMEvent): Enqueue an event on the GenericEventQueue based on the animation type.
2508         * animation/DeclarativeAnimation.h:
2509         * animation/DocumentTimeline.cpp:
2510         (WebCore::DocumentTimeline::performInvalidationTask): We call invalidateDOMEvents() on all declarative animations registered with this timeline
2511         now that the timing model has been invalidated.
2512         * dom/EventNames.h: Add the names of newly-implemented events (animationcancel, transitioncancel, transitionrun and transitionstart).
2513         * dom/GlobalEventHandlers.idl: Add new attribute-based event handlers for the newly-implemented events.
2514         * html/HTMLAttributeNames.in: Add new attribute-based event handlers for the newly-implemented events.
2515         * html/HTMLElement.cpp:
2516         (WebCore::HTMLElement::createEventHandlerNameMap): Add new attribute-based event handlers for the newly-implemented events.
2517
2518 2018-03-21  Per Arne Vollan  <pvollan@apple.com>
2519
2520         Compile error when not using IOSurface canvas backing store.
2521         https://bugs.webkit.org/show_bug.cgi?id=183855
2522
2523         Reviewed by Brent Fulgham.
2524
2525         The method IOSurface::createFromImageBuffer is only referenced when IOSurface
2526         is used as canvas backing store.
2527
2528         * platform/graphics/cocoa/IOSurface.h:
2529         * platform/graphics/cocoa/IOSurface.mm:
2530
2531 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
2532
2533         [CoordGraphics] Track dirty rects that need update in CoordinatedGraphicsLayer
2534         https://bugs.webkit.org/show_bug.cgi?id=175376
2535
2536         Reviewed by Carlos Garcia Campos.
2537
2538         Follow the GraphicsLayerCA class and track rectangles in need of display
2539         in a Vector object. In case the whole layer needs updating, it's marked
2540         separately, and further rects are ignored.
2541
2542         During layer flush, all the rects are used to invalidate the backing
2543         store, or a single layer-sized rect is used in case the whole layer has
2544         to be updated. We can also bail early from updateContentBuffers() if
2545         there are no dirty rects recorded and there's no pending visible rect
2546         adjustment.
2547
2548         At the end of updateContentBuffers() we now test for an existing
2549         previous backing store before inquiring the backing store if the visible
2550         area is already covered, enabling deletion of this backing store.
2551
2552         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2553         (WebCore::CoordinatedGraphicsLayer::setNeedsDisplay):
2554         (WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect):
2555         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
2556         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2557
2558 2018-03-21  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2559
2560         [WPE] Build failure with ENABLE_VIDEO=OFF when GStreamer is not available
2561         https://bugs.webkit.org/show_bug.cgi?id=183811
2562
2563         Reviewed by Philippe Normand.
2564
2565         Add build guards for USE_GSTREAMER.
2566
2567         No new tests, it is a build fix.
2568
2569         * platform/graphics/gstreamer/GStreamerUtilities.h:
2570
2571 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
2572
2573         [Cairo] Draw Cairo patterns with cairo_paint_with_alpha()
2574         https://bugs.webkit.org/show_bug.cgi?id=183774
2575
2576         Reviewed by Carlos Garcia Campos.
2577
2578         In the drawPatternToCairoContext() helper in CairoOperations.cpp source
2579         file, always clip the painting region to the specified rectangle and
2580         then use cairo_paint_with_alpha() to paint the passed-in pattern object,
2581         not relaying rasterization to cairo_fill() when using opaque alpha. We
2582         still clamp the alpha value to the 0.0 - 1.0 range.
2583
2584         No new tests -- no change in behavior.
2585
2586         * platform/graphics/cairo/CairoOperations.cpp:
2587         (WebCore::Cairo::drawPatternToCairoContext):
2588
2589 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
2590
2591         [TexMap] Have TextureMapperLayer::applyAnimationsRecursively() return running animation status
2592         https://bugs.webkit.org/show_bug.cgi?id=183771
2593
2594         Reviewed by Carlos Garcia Campos.
2595
2596         TextureMapperLayer::applyAnimationsRecursively() should return true when
2597         the TextureMapperLayer tree has currently-running animations that
2598         require continuous scene update.
2599
2600         TextureMapperAnimation::ApplicationResult gains the hasRunningAnimation
2601         member that's set to true if any of the applied animations are still in
2602         playing state. That information is then returned in syncAnimations(),
2603         and the result is accumulated in the top applyAnimationsRecursively()
2604         call and returned there to the caller.
2605
2606         No new tests -- no change in behavior.
2607
2608         * platform/graphics/texmap/TextureMapperAnimation.cpp:
2609         (WebCore::TextureMapperAnimation::apply):
2610         * platform/graphics/texmap/TextureMapperAnimation.h:
2611         * platform/graphics/texmap/TextureMapperLayer.cpp:
2612         (WebCore::TextureMapperLayer::applyAnimationsRecursively):
2613         (WebCore::TextureMapperLayer::syncAnimations):
2614         * platform/graphics/texmap/TextureMapperLayer.h:
2615
2616 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
2617
2618         Use-after-move in SWContextManager::terminateWorker() with Linux x86_64 calling convention
2619         https://bugs.webkit.org/show_bug.cgi?id=183783
2620
2621         Reviewed by Chris Dumez.
2622
2623         In SWContextManager::terminateWorker(), some calling conventions can
2624         end up moving the ServiceWorkerThreadProxy RefPtr into the lambda struct
2625         before that proxy's thread (on which the lambda is bound to execute) is
2626         retrieved.
2627
2628         Avoid this by taking a reference to the thread in a separate earlier
2629         expression, before the RefPtr is moved into the lambda in the following
2630         one.
2631
2632         * workers/service/context/SWContextManager.cpp:
2633         (WebCore::SWContextManager::terminateWorker):
2634
2635 2018-03-21  Timothy Horton  <timothy_horton@apple.com>
2636
2637         Fix the build
2638
2639         * platform/network/cf/FormDataStreamCFNet.cpp:
2640
2641 2018-03-20  Tim Horton  <timothy_horton@apple.com>
2642
2643         Introduce HAVE_MEDIA_PLAYER and HAVE_CORE_VIDEO
2644         https://bugs.webkit.org/show_bug.cgi?id=183803
2645         <rdar://problem/38690487>
2646
2647         Reviewed by Sam Weinig.
2648
2649         * platform/audio/ios/MediaSessionManagerIOS.mm:
2650         (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
2651         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo):
2652         (-[WebMediaSessionHelper initWithCallback:]):
2653         (-[WebMediaSessionHelper dealloc]):
2654         (-[WebMediaSessionHelper hasWirelessTargetsAvailable]):
2655         * platform/cocoa/CoreVideoSoftLink.cpp:
2656         * platform/cocoa/CoreVideoSoftLink.h:
2657         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2658         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2659         (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer):
2660         (WebCore::MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame const):
2661         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
2662         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
2663         (WebCore::MediaSampleAVFObjC::getRGBAImageData const):
2664         * platform/graphics/cv/PixelBufferConformerCV.cpp:
2665         * platform/graphics/cv/PixelBufferConformerCV.h:
2666         * platform/graphics/cv/TextureCacheCV.h:
2667         * platform/graphics/cv/TextureCacheCV.mm:
2668         * platform/graphics/cv/VideoTextureCopierCV.cpp:
2669         * platform/graphics/cv/VideoTextureCopierCV.h:
2670         Make it possible to disable our dependency on MediaPlayer and CoreVideo.
2671
2672 2018-03-20  Tim Horton  <timothy_horton@apple.com>
2673
2674         Enable the minimal simulator feature flag when appropriate
2675         https://bugs.webkit.org/show_bug.cgi?id=183807
2676
2677         Reviewed by Dan Bernstein.
2678
2679         * Configurations/FeatureDefines.xcconfig:
2680
2681 2018-03-19  Ryosuke Niwa  <rniwa@webkit.org>
2682
2683         Expose content attributes on _WKLinkIconParameters
2684         https://bugs.webkit.org/show_bug.cgi?id=183768
2685
2686         Reviewed by Alex Christensen.
2687
2688         Collect a vector of content attributes upon finding touch and fav-icons in order to expose it in a WebKit API.
2689
2690         Tests: IconLoading.DefaultFavicon
2691
2692         * html/LinkIconCollector.cpp:
2693         (WebCore::LinkIconCollector::iconsOfTypes): Collect attributes.
2694         * loader/DocumentLoader.cpp:
2695         (WebCore::DocumentLoader::startIconLoading): Use an empty vector for /favicon.ico.
2696         * platform/LinkIcon.h:
2697         (WebCore::LinkIcon::encode const): Encode the vector of content attributes.
2698         (WebCore::LinkIcon::decode): Ditto for decoding.
2699
2700 2018-03-20  Zalan Bujtas  <zalan@apple.com>
2701
2702         RenderTreeNeedsLayoutChecker fails with absolutely positioned svg and <use>
2703         https://bugs.webkit.org/show_bug.cgi?id=183718
2704
2705         Reviewed by Antti Koivisto.
2706
2707         This patch ensures after resolving the style for an SVG element with a corresponding element (<use>),
2708         we adjust this style for the cloned SVG element too.
2709
2710         Test: svg/in-html/path-with-absolute-positioned-svg-and-use-crash.html
2711
2712         * css/StyleResolver.cpp:
2713         (WebCore::StyleResolver::adjustSVGElementStyle):
2714         (WebCore::StyleResolver::adjustRenderStyle):
2715         * css/StyleResolver.h:
2716         * svg/SVGElement.cpp:
2717         (WebCore::SVGElement::resolveCustomStyle):
2718
2719 2018-03-20  Brady Eidson  <beidson@apple.com>
2720
2721         First piece of process swapping on navigation.
2722         https://bugs.webkit.org/show_bug.cgi?id=183665
2723
2724         Reviewed by Andy Estes.
2725
2726         Covered by API test(s)
2727
2728         This patch:
2729         - A new PolicyAction::Suspend for future use in this feature
2730         - Makes sure that loads triggered as part of a process swap do *not* re-consult the policy delegate
2731
2732         * loader/DocumentLoader.cpp:
2733         (WebCore::DocumentLoader::continueAfterContentPolicy):
2734
2735         * loader/FrameLoadRequest.h:
2736         (WebCore::FrameLoadRequest::setShouldCheckNavigationPolicy):
2737         (WebCore::FrameLoadRequest::shouldCheckNavigationPolicy const):
2738
2739         * loader/FrameLoader.cpp:
2740         (WebCore::FrameLoader::load):
2741         (WebCore::FrameLoader::loadWithDocumentLoader):
2742         * loader/FrameLoader.h:
2743
2744         * loader/FrameLoaderTypes.h: Add a new Policy type "Suspend" to be used in the future
2745           by the process-swap-on-navigation mechanism.
2746
2747         * loader/PolicyChecker.cpp:
2748         (WebCore::PolicyChecker::checkNavigationPolicy):
2749         (WebCore::PolicyChecker::checkNewWindowPolicy):
2750
2751 2018-03-20  Chris Dumez  <cdumez@apple.com>
2752
2753         QuickLook.NavigationDelegate API test is failing on iOS with async policy delegates
2754         https://bugs.webkit.org/show_bug.cgi?id=183791
2755
2756         Reviewed by Alex Christensen.
2757
2758         Update PreviewLoader to not send data (or call finishFinishLoading) until
2759         the resource response has been processed.
2760
2761         * loader/ios/PreviewLoader.mm:
2762         (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]):
2763         (-[WebPreviewLoader connection:didReceiveData:lengthReceived:]):
2764         (-[WebPreviewLoader connectionDidFinishLoading:]):
2765
2766 2018-03-20  Antoine Quint  <graouts@apple.com>
2767
2768         [Web Animations] Update the timing model when pending tasks schedule changes
2769         https://bugs.webkit.org/show_bug.cgi?id=183785
2770
2771         Reviewed by Dean Jackson.
2772
2773         Changing the time at which a pending play or pause task is scheduled changes the pending
2774         state of the animation and thus should notify that the timing model has changed and invalidate
2775         the effect.
2776
2777         * animation/WebAnimation.cpp:
2778         (WebCore::WebAnimation::setTimeToRunPendingPlayTask):
2779         (WebCore::WebAnimation::setTimeToRunPendingPauseTask):
2780         (WebCore::WebAnimation::updatePendingTasks):
2781
2782 2018-03-20  Tim Horton  <timothy_horton@apple.com>
2783
2784         Add and adopt WK_PLATFORM_NAME and adjust default feature defines
2785         https://bugs.webkit.org/show_bug.cgi?id=183758
2786         <rdar://problem/38017644>
2787
2788         Reviewed by Dan Bernstein.
2789
2790         * Configurations/Base.xcconfig:
2791         * Configurations/FeatureDefines.xcconfig:
2792         * WebCore.xcodeproj/project.pbxproj:
2793
2794 2018-03-19  Tim Horton  <timothy_horton@apple.com>
2795
2796         Apply some SDK checks in LocalDefaultSystemAppearance
2797         https://bugs.webkit.org/show_bug.cgi?id=183767
2798         <rdar://problem/38649611>
2799
2800         Reviewed by Zalan Bujtas.
2801
2802         * platform/mac/LocalDefaultSystemAppearance.h:
2803         * platform/mac/LocalDefaultSystemAppearance.mm:
2804         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
2805         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
2806
2807 2018-03-19  Chris Dumez  <cdumez@apple.com>
2808
2809         Have one service worker process per security origin
2810         https://bugs.webkit.org/show_bug.cgi?id=183600
2811         <rdar://problem/35280128>
2812
2813         Reviewed by Brady Eidson.
2814
2815         Split service workers from different origins into their own processes
2816         for security reasons.
2817
2818         * workers/service/server/SWServer.cpp:
2819         (WebCore::SWServer::addRegistrationFromStore):
2820         (WebCore::SWServer::clear):
2821         (WebCore::SWServer::tryInstallContextData):
2822         (WebCore::SWServer::serverToContextConnectionCreated):
2823         (WebCore::SWServer::installContextData):
2824         (WebCore::SWServer::runServiceWorkerIfNecessary):
2825         (WebCore::SWServer::markAllWorkersAsTerminated):
2826         * workers/service/server/SWServer.h:
2827         * workers/service/server/SWServerToContextConnection.cpp:
2828         (WebCore::SWServerToContextConnection::SWServerToContextConnection):
2829         (WebCore::SWServerToContextConnection::~SWServerToContextConnection):
2830         (WebCore::SWServerToContextConnection::connectionForOrigin):
2831         * workers/service/server/SWServerToContextConnection.h:
2832         (WebCore::SWServerToContextConnection::origin):
2833         * workers/service/server/SWServerWorker.cpp:
2834         (WebCore::SWServerWorker::SWServerWorker):
2835         (WebCore::SWServerWorker::securityOrigin const):
2836         (WebCore::SWServerWorker::contextConnection):
2837         * workers/service/server/SWServerWorker.h:
2838
2839 2018-03-19  Megan Gardner  <megan_gardner@apple.com>
2840
2841         Have select element respect current appearance
2842         https://bugs.webkit.org/show_bug.cgi?id=183753
2843
2844         Reviewed by Tim Horton.
2845
2846         Not currently testable, will add tests in a later patch.
2847
2848         Have the menu lists/select elements follow the system colors.
2849
2850         * rendering/RenderThemeMac.mm:
2851         (WebCore::RenderThemeMac::adjustMenuListStyle const):
2852
2853 2018-03-19  Nan Wang  <n_wang@apple.com>
2854
2855         AX: embedded attachments do not work correctly with text marker APIs on macOS
2856         https://bugs.webkit.org/show_bug.cgi?id=183751
2857
2858         Reviewed by Chris Fleizach.
2859
2860         In WebKit1, embedded attachments are not working well with text marker APIs.
2861         We should use the corresponding attachment view in the following cases:
2862         1. Hit testing on an attachment object.
2863         2. Getting the attachment object at a text marker position.
2864         3. Asking for the associated element with NSAccessibilityAttachmentTextAttribute. 
2865
2866         Not able to construct a layout test because it relies on embedded attachments.
2867
2868         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2869         (AXAttributeStringSetElement):
2870         (-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
2871         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
2872
2873 2018-03-19  Jiewen Tan  <jiewen_tan@apple.com>
2874
2875         Unreviewed, another quick fix for r229699
2876
2877         Restricts ENABLE_WEB_AUTHN to only macOS and iOS.
2878
2879         * Configurations/FeatureDefines.xcconfig:
2880
2881 2018-03-19  Daniel Bates  <dabates@apple.com>
2882
2883         Fix case of Strong Password localized string
2884
2885         * English.lproj/Localizable.strings:
2886         * platform/LocalizedStrings.cpp:
2887         (WebCore::autoFillStrongPasswordLabel):
2888
2889 2018-03-19  Chris Dumez  <cdumez@apple.com>
2890
2891         WebKit.WebsitePoliciesAutoplayQuirks API test times out with async policy delegates
2892         https://bugs.webkit.org/show_bug.cgi?id=183702
2893         <rdar://problem/38566060>
2894
2895         Reviewed by Alex Christensen.
2896
2897         The issue is that the test calls loadHTMLString then loadRequest right after, without
2898         waiting for the first load to complete first. loadHTMLString is special as it relies
2899         on substitute data and which schedules a timer to commit the data. When doing the
2900         navigation policy check for the following loadRequest(), the substitute data timer
2901         would fire and commit its data and load. This would in turn cancel the pending
2902         navigation policy check for the loadRequest().
2903
2904         With sync policy delegates, this is not an issue because we take care of stopping
2905         all loaders when receiving the policy decision, which happens synchronously. However,
2906         when the policy decision happens asynchronously, the pending substitute data load
2907         does not get cancelled in time and it gets committed.
2908
2909         To address the issue, we now cancel any pending provisional load before doing the
2910         navigation policy check.
2911
2912         Test: fast/loader/inner-iframe-loads-data-url-into-parent-on-unload-crash-async-delegate.html
2913
2914         * loader/FrameLoader.cpp:
2915         (WebCore::FrameLoader::clearProvisionalLoadForPolicyCheck):
2916         * loader/FrameLoader.h:
2917         * loader/PolicyChecker.cpp:
2918         (WebCore::PolicyChecker::checkNavigationPolicy):
2919         Cancel any pending provisional load before starting the navigation policy check. This call
2920         needs to be here rather than in the call site of policyChecker().checkNavigationPolicy()
2921         because there is code in PolicyChecker::checkNavigationPolicy() which relies on
2922         FrameLoader::activeDocumentLoader().
2923         Also, we only cancel the provisional load if there is a policy document loader. In some
2924         rare cases (when we receive a redirect after navigation policy has been decided for the
2925         initial request), the provisional document loader needs to receive navigation policy
2926         decisions so we cannot clear the provisional document loader in such case.
2927
2928 2018-03-19  Eric Carlson  <eric.carlson@apple.com>
2929
2930         [Extra zoom mode] Require fullscreen for video playback
2931         https://bugs.webkit.org/show_bug.cgi?id=183742
2932         <rdar://problem/38235862>
2933
2934         Reviewed by Jer Noble.
2935
2936         * Modules/modern-media-controls/media/playback-support.js:
2937         (PlaybackSupport.prototype.syncControl): Always show the play button.
2938         * html/HTMLMediaElement.cpp:
2939         (WebCore::HTMLMediaElement::updatePlayState): Return immediately if playback requires fullscreen
2940         (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Call updatePlayState in case 
2941         playback is pending.
2942         * html/HTMLMediaElement.h:
2943         * platform/cocoa/VideoFullscreenModel.h:
2944         (WebCore::VideoFullscreenModel::presentingViewController): New.
2945         (WebCore::VideoFullscreenModel::createVideoFullscreenViewController): New.
2946         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2947         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
2948         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode):
2949         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
2950         (WebCore::PlaybackSessionInterfaceAVKit::seekableRangesChanged):
2951
2952         * platform/ios/VideoFullscreenInterfaceAVKit.h:
2953         * platform/ios/VideoFullscreenInterfaceAVKit.mm: Wrap AVPlayerLayerView so we can change its
2954         behavior.
2955         (WebAVPlayerLayerView_playerLayer):
2956         (WebAVPlayerLayerView_videoView):
2957         (allocWebAVPlayerLayerViewInstance):
2958         (-[WebAVPlayerViewController initWithFullscreenInterface:]):
2959         (-[WebAVPlayerViewController playerViewControllerShouldHandleDoneButtonTap:]):
2960         (-[WebAVPlayerViewController enterFullScreenAnimated:completionHandler:]):
2961         (-[WebAVPlayerViewController exitFullScreenAnimated:completionHandler:]):
2962         (-[WebAVPlayerViewController NO_RETURN_DUE_TO_ASSERT]):
2963         (-[WebAVPlayerViewController isPictureInPicturePossible]):
2964         (-[WebAVPlayerViewController isPictureInPictureActive]):
2965         (-[WebAVPlayerViewController isPictureInPictureSuspended]):
2966         (-[WebAVPlayerViewController pictureInPictureActive]):
2967         (-[WebAVPlayerViewController pictureInPictureWasStartedWhenEnteringBackground]):
2968         (-[WebAVPlayerViewController view]):
2969         (-[WebAVPlayerViewController showsPlaybackControls]):
2970         (-[WebAVPlayerViewController setShowsPlaybackControls:]):
2971         (-[WebAVPlayerViewController setAllowsPictureInPicturePlayback:]):
2972         (-[WebAVPlayerViewController setDelegate:]):
2973         (-[WebAVPlayerViewController setPlayerController:]):
2974         (-[WebAVPlayerViewController avPlayerViewController]):
2975         (-[WebAVPlayerViewController removeFromParentViewController]):
2976         (VideoFullscreenInterfaceAVKit::setupFullscreen):
2977         (fallbackViewController):
2978         (VideoFullscreenInterfaceAVKit::presentingViewController):
2979         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
2980         (VideoFullscreenInterfaceAVKit::doSetup):
2981         (WebCore::supportsPictureInPicture):
2982
2983 2018-03-19  Per Arne Vollan  <pvollan@apple.com>
2984
2985         When the WebContent process is blocked from accessing the WindowServer, the call CVDisplayLinkCreateWithCGDisplay will fail.
2986         https://bugs.webkit.org/show_bug.cgi?id=183604
2987         <rdar://problem/38305109>
2988
2989         Reviewed by Brent Fulgham.
2990
2991         The call to CVDisplayLinkCreateWithCGDisplay can instead be made in the UIProcess. Notify the WebContent process
2992         about display updates by sending a message from the UIProcess on each screen update. This patch adds an extra
2993         IPC step when notifying the WebContent process about display updates. However, the MotionMark benchmark shows no
2994         performance regression when running it with this patch. A possible explanation for this is that the high priority
2995         display link thread is now running in the UIProcess instead of the WebContent process, which means there will be
2996         more available CPU resources for the WebContent process. A run loop observer is added to make sure that only one
2997         display callback (for each display observer) is executed in a single iteration of the run loop. This will make
2998         sure we are not filling the IPC message queue with unhandled display link messages.
2999
3000         No new tests, covered by existing tests. 
3001
3002         * platform/graphics/DisplayRefreshMonitor.h:
3003         (WebCore::DisplayRefreshMonitor::displayLinkFired):
3004         * platform/graphics/DisplayRefreshMonitorManager.cpp:
3005         (WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
3006         * platform/graphics/DisplayRefreshMonitorManager.h:
3007         * platform/graphics/mac/DisplayRefreshMonitorMac.h:
3008
3009 2018-03-19  Megan Gardner  <megan_gardner@apple.com>
3010
3011         Ensure local appearance actually mirrors the app's appearance
3012         https://bugs.webkit.org/show_bug.cgi?id=183743
3013
3014         Reviewed by Tim Horton.
3015
3016         Not currently testable, will add tests in a later patch.
3017
3018         Current appearance isn't always accurate by default and needs to be set manually.
3019
3020         * platform/mac/LocalDefaultSystemAppearance.mm:
3021         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
3022
3023 2018-03-19  Zan Dobersek  <zdobersek@igalia.com>
3024
3025         Unreviewed GCC 4.9 build-fix after r229672.
3026
3027         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
3028         (Nicosia::createCommand): Don't depend on implicit conversion of the
3029         returning std::unique_ptr<> object, and instead only wrap the
3030         heap-allocated PaintingOperation-derived in a std::unique_ptr<> at the
3031         point of return.
3032
3033 2018-03-18  Commit Queue  <commit-queue@webkit.org>
3034
3035         Unreviewed, rolling out r229689.
3036         https://bugs.webkit.org/show_bug.cgi?id=183735
3037
3038         Causes fast/loader/inner-iframe-loads-data-url-into-parent-on-
3039         unload-crash.html to fail with async delegates (Requested by
3040         cdumez_ on #webkit).
3041
3042         Reverted changeset:
3043
3044         "WebKit.WebsitePoliciesAutoplayQuirks API test times out with
3045         async policy delegates"
3046         https://bugs.webkit.org/show_bug.cgi?id=183702
3047         https://trac.webkit.org/changeset/229689
3048
3049 2018-03-17  Tim Horton  <timothy_horton@apple.com>
3050
3051         Correct redefined fnfErr type
3052         https://bugs.webkit.org/show_bug.cgi?id=183728
3053         <rdar://problem/38590063>
3054
3055         Reviewed by Dan Bernstein.
3056
3057         * platform/network/cf/FormDataStreamCFNet.cpp:
3058         CFStreamError's error parameter takes a SInt32, not an int.
3059         Make sure our redefinition has a compatible type.
3060
3061 2018-03-17  Jiewen Tan  <jiewen_tan@apple.com>
3062
3063         [WebAuthN] Implement authenticatorMakeCredential
3064         https://bugs.webkit.org/show_bug.cgi?id=183527
3065         <rdar://problem/35275886>
3066
3067         Reviewed by Brent Fulgham.
3068
3069         This patch does the following few things:
3070         1) It implements the authenticatorMakeCredential logic from the spec: https://www.w3.org/TR/webauthn/#op-make-cred.
3071         2) It tweaks enocding and deocding of PublicKeyCredentialCreationOptions between UIProccess and WebProcess.
3072         3) It soft links LocalAuthentication.Framework to WebCore, which was linked to WebKit.
3073         4) It creates SPI header for DeviceIdentity.Framework, and provides stubs to link it to WebCore.
3074
3075         Here is a detailed explanantion of 1):
3076         1. A helper class called LocalAuthenticator is crafted to represent Apple platform attached authenticator, i.e.
3077         the devices themselves. All operations are currently restricted to iOS at this moment as macOS lacks attestation
3078         support.
3079         2. To do testing, this helper class is then moved from WebKit to WebCore even though all operations can only happens
3080         in the UIProcess. We currently lack the ability to pretend a https environment in TestWebKitAPI which is required by
3081         the WebAuthN API, and thus it is moved to WebCore to perform unit tesing flavor API tests. This is not enough as it
3082         can't test message exchange between the UI and Web processes. We will address this in a subsequent patch.
3083         3. More on testing: The attestation process is abstracted into a protected method such that the testing enviroment can
3084         override it with self attestation as network access is restricted in the WebKit testing enviroment. Also, swizzlers of
3085         LocalAuthentication API are provided to override the behavoir of LAContext.
3086         4. More on testing: The actual Apple attestation can only happen in real device and with network access, therefore
3087         it can only be covered by manual tests at this moment.
3088         5. Back to LocalAuthenticator, it currently has two public methods:
3089                 5.1. makeCredential(): This method is the one does all the magic.
3090                 + It first checks some parameters.
3091                 + It then invokes LAContext to get user consent.
3092                 + It then talks to Apple Attestation Privacy CA to do attestations.
3093                 + It then stores necessary information into the Keychain.
3094                 + Finally it generates the attestation object.
3095                 5.2 isAvailable():
3096                 To check if a LocalAuthenticator is available or not.
3097         6. Even though files are of .mm format, they are written in a way that mixes NS, CF and C++ types. Here is the rule:
3098                 6.1 Use CF type only if it is requested by APIs.
3099                 6.2 Use NS type to manipulate all Objc objects.
3100                 6.3 Use C++ otherwise.
3101
3102         Covered by API tests.
3103
3104         * Configurations/WebCore.xcconfig:
3105         * Modules/credentialmanagement/CredentialsMessenger.cpp:
3106         (WebCore::getIdFromAttestationObject): Deleted.
3107         Decoding attestation object is tedious. UIProcess will instead return credential ID and attestation object
3108         at the same time. Therefore, this method is removed.
3109         * Modules/credentialmanagement/CredentialsMessenger.h:
3110         (WebCore::CreationReturnBundle::CreationReturnBundle): Deleted.
3111         (WebCore::AssertionReturnBundle::AssertionReturnBundle): Deleted.
3112         * Modules/webauthn/COSEConstants.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialType.h.
3113         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
3114         (WebCore::PublicKeyCredentialCreationOptions::isolatedPartialCopyPtr const):
3115         (WebCore::PublicKeyCredentialCreationOptions::Parameters::encode const):
3116         (WebCore::PublicKeyCredentialCreationOptions::Parameters::decode):
3117         (WebCore::PublicKeyCredentialCreationOptions::encode const):
3118         (WebCore::PublicKeyCredentialCreationOptions::decode):
3119         * Modules/webauthn/PublicKeyCredentialDescriptor.h:
3120         (WebCore::PublicKeyCredentialDescriptor::encode const):
3121         (WebCore::PublicKeyCredentialDescriptor::decode):
3122         * Modules/webauthn/PublicKeyCredentialType.h:
3123         * Modules/webauthn/cocoa/LocalAuthenticator.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h.
3124         * Modules/webauthn/cocoa/LocalAuthenticator.mm: Added.
3125         (WebCore::LocalAuthenticatorInternal::freePtrs):
3126         (WebCore::LocalAuthenticator::makeCredential const):
3127         (WebCore::LocalAuthenticator::isAvailable const):
3128         (WebCore::LocalAuthenticator::issueClientCertificate const):
3129         * SourcesCocoa.txt:
3130         * WebCore.xcodeproj/project.pbxproj:
3131         * platform/cocoa/LocalAuthenticationSoftLink.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialType.h.
3132         * platform/cocoa/LocalAuthenticationSoftLink.mm: Added.
3133         * testing/MockCredentialsMessenger.cpp:
3134         (WebCore::MockCredentialsMessenger::setCreationReturnBundle):
3135         (WebCore::MockCredentialsMessenger::makeCredential):
3136         (WebCore::MockCredentialsMessenger::makeCredentialReply):
3137         (WebCore::MockCredentialsMessenger::setAttestationObject): Deleted.
3138         * testing/MockCredentialsMessenger.h:
3139         * testing/MockCredentialsMessenger.idl:
3140
3141 2018-03-16  Brent Fulgham  <bfulgham@apple.com>
3142
3143         Correct debug assertion in Range::borderAndTextRects
3144         https://bugs.webkit.org/show_bug.cgi?id=183710
3145         <rdar://problem/38466976>
3146
3147         Reviewed by Ryosuke Niwa.
3148
3149         A debug assertion will fire if Range::borderAndTextRects is asked to evaluate a set of selected elements, where one of the elements does not have a parent.
3150
3151         We should consider a nullptr parent as satisfying the condition of a parent not being present in the selection set.
3152
3153         Tests: fast/dom/range/range-selection-empty-body.html
3154
3155         * dom/Range.cpp:
3156         (WebCore::Range::borderAndTextRects const):
3157
3158 2018-03-15  Filip Pizlo  <fpizlo@apple.com>
3159
3160         Put the DOM in IsoHeaps
3161         https://bugs.webkit.org/show_bug.cgi?id=183546
3162
3163         Reviewed by Daniel Bates.
3164
3165         No new tests because no change in behavior.
3166         
3167         This puts all descendants of WebCore::Node in isoheaps, so that UAFs on the DOM cannot be
3168         used for RCE attacks. This probably also makes it harder to use UAFs for UXSS, since it means
3169         that DOM UAFs cannot be used for universal read gadgets.
3170         
3171         This looks neutral on Speedometer and membuster, though I did have one round of testing
3172         that led me to believe that membuster was regressed - I just wasn't able to reproduce that
3173         result on subsequent testing.
3174
3175         * Sources.txt:
3176         * WebCore.xcodeproj/project.pbxproj:
3177         * dom/Attr.cpp:
3178         * dom/Attr.h:
3179         * dom/CDATASection.cpp:
3180         * dom/CDATASection.h:
3181         * dom/CharacterData.cpp:
3182         * dom/CharacterData.h:
3183         * dom/Comment.cpp:
3184         * dom/Comment.h:
3185         * dom/ContainerNode.cpp:
3186         * dom/ContainerNode.h:
3187         * dom/Document.cpp:
3188         * dom/Document.h:
3189         * dom/DocumentFragment.cpp:
3190         * dom/DocumentFragment.h:
3191         * dom/DocumentType.cpp:
3192         * dom/DocumentType.h:
3193         * dom/Node.cpp:
3194         * dom/Node.h:
3195         * dom/ProcessingInstruction.cpp:
3196         * dom/ProcessingInstruction.h:
3197         * dom/PseudoElement.cpp:
3198         * dom/PseudoElement.h:
3199         * dom/ShadowRoot.cpp:
3200         * dom/ShadowRoot.h:
3201         * dom/StyledElement.cpp:
3202         * dom/StyledElement.h:
3203         * dom/TemplateContentDocumentFragment.cpp: Added.
3204         * dom/TemplateContentDocumentFragment.h:
3205         * dom/Text.cpp:
3206         * dom/Text.h:
3207         * dom/XMLDocument.cpp: Added.
3208         * dom/XMLDocument.h:
3209         * html/FTPDirectoryDocument.cpp:
3210         * html/FTPDirectoryDocument.h:
3211         * html/FileInputType.cpp:
3212         * html/HTMLAnchorElement.cpp:
3213         * html/HTMLAnchorElement.h:
3214         * html/HTMLAppletElement.cpp:
3215         * html/HTMLAppletElement.h:
3216         * html/HTMLAreaElement.cpp:
3217         * html/HTMLAreaElement.h:
3218         * html/HTMLAttachmentElement.cpp:
3219         * html/HTMLAttachmentElement.h:
3220         * html/HTMLBDIElement.cpp: Added.
3221         * html/HTMLBDIElement.h:
3222         * html/HTMLBRElement.cpp:
3223         * html/HTMLBRElement.h:
3224         * html/HTMLBaseElement.cpp:
3225         * html/HTMLBaseElement.h:
3226         * html/HTMLBodyElement.cpp:
3227         * html/HTMLBodyElement.h:
3228         * html/HTMLButtonElement.cpp:
3229         * html/HTMLButtonElement.h:
3230         * html/HTMLCanvasElement.cpp:
3231         * html/HTMLCanvasElement.h:
3232         * html/HTMLDListElement.cpp:
3233         * html/HTMLDListElement.h:
3234         * html/HTMLDataElement.cpp:
3235         * html/HTMLDataElement.h:
3236         * html/HTMLDataListElement.cpp:
3237         * html/HTMLDataListElement.h:
3238         * html/HTMLDetailsElement.cpp:
3239         * html/HTMLDetailsElement.h:
3240         * html/HTMLDirectoryElement.cpp:
3241         * html/HTMLDirectoryElement.h:
3242         * html/HTMLDivElement.cpp:
3243         * html/HTMLDivElement.h:
3244         * html/HTMLDocument.cpp:
3245         * html/HTMLDocument.h:
3246         * html/HTMLElement.cpp:
3247         * html/HTMLElement.h:
3248         * html/HTMLEmbedElement.cpp:
3249         * html/HTMLEmbedElement.h:
3250         * html/HTMLFieldSetElement.cpp:
3251         * html/HTMLFieldSetElement.h:
3252         * html/HTMLFontElement.cpp:
3253         * html/HTMLFontElement.h:
3254         * html/HTMLFormControlElement.cpp:
3255         * html/HTMLFormControlElement.h:
3256         * html/HTMLFormControlElementWithState.cpp:
3257         * html/HTMLFormControlElementWithState.h:
3258         * html/HTMLFormElement.cpp:
3259         * html/HTMLFormElement.h:
3260         * html/HTMLFrameElement.cpp:
3261         * html/HTMLFrameElement.h:
3262         * html/HTMLFrameElementBase.cpp:
3263         * html/HTMLFrameElementBase.h:
3264         * html/HTMLFrameOwnerElement.cpp:
3265         * html/HTMLFrameOwnerElement.h:
3266         * html/HTMLFrameSetElement.cpp:
3267         * html/HTMLFrameSetElement.h:
3268         * html/HTMLHRElement.cpp:
3269         * html/HTMLHRElement.h:
3270         * html/HTMLHeadElement.cpp:
3271         * html/HTMLHeadElement.h:
3272         * html/HTMLHeadingElement.cpp:
3273         * html/HTMLHeadingElement.h:
3274         * html/HTMLHtmlElement.cpp:
3275         * html/HTMLHtmlElement.h:
3276         * html/HTMLIFrameElement.cpp:
3277         * html/HTMLIFrameElement.h:
3278         * html/HTMLImageElement.cpp:
3279         * html/HTMLImageElement.h:
3280         * html/HTMLInputElement.cpp:
3281         * html/HTMLInputElement.h:
3282         * html/HTMLKeygenElement.cpp:
3283         * html/HTMLKeygenElement.h:
3284         * html/HTMLLIElement.cpp:
3285         * html/HTMLLIElement.h:
3286         * html/HTMLLabelElement.cpp:
3287         * html/HTMLLabelElement.h:
3288         * html/HTMLLegendElement.cpp:
3289         * html/HTMLLegendElement.h:
3290         * html/HTMLLinkElement.cpp:
3291         * html/HTMLLinkElement.h:
3292         * html/HTMLMapElement.cpp:
3293         * html/HTMLMapElement.h:
3294         * html/HTMLMarqueeElement.cpp:
3295         * html/HTMLMarqueeElement.h:
3296         * html/HTMLMenuElement.cpp:
3297         * html/HTMLMenuElement.h:
3298         * html/HTMLMenuItemElement.cpp:
3299         * html/HTMLMenuItemElement.h:
3300         * html/HTMLMetaElement.cpp:
3301         * html/HTMLMetaElement.h:
3302         * html/HTMLMeterElement.cpp:
3303         * html/HTMLMeterElement.h:
3304         * html/HTMLModElement.cpp:
3305         * html/HTMLModElement.h:
3306         * html/HTMLOListElement.cpp:
3307         * html/HTMLOListElement.h:
3308         * html/HTMLObjectElement.cpp:
3309         * html/HTMLObjectElement.h:
3310         * html/HTMLOptGroupElement.cpp:
3311         * html/HTMLOptGroupElement.h:
3312         * html/HTMLOptionElement.cpp:
3313         * html/HTMLOptionElement.h:
3314         * html/HTMLOutputElement.cpp:
3315         * html/HTMLOutputElement.h:
3316         * html/HTMLParagraphElement.cpp:
3317         * html/HTMLParagraphElement.h:
3318         * html/HTMLParamElement.cpp:
3319         * html/HTMLParamElement.h:
3320         * html/HTMLPictureElement.cpp:
3321         * html/HTMLPictureElement.h:
3322         * html/HTMLPlugInElement.cpp:
3323         * html/HTMLPlugInElement.h:
3324         * html/HTMLPlugInImageElement.cpp:
3325         * html/HTMLPlugInImageElement.h:
3326         * html/HTMLPreElement.cpp:
3327         * html/HTMLPreElement.h:
3328         * html/HTMLProgressElement.cpp:
3329         * html/HTMLProgressElement.h:
3330         * html/HTMLQuoteElement.cpp:
3331         * html/HTMLQuoteElement.h:
3332         * html/HTMLScriptElement.cpp:
3333         * html/HTMLScriptElement.h:
3334         * html/HTMLSelectElement.cpp:
3335         * html/HTMLSelectElement.h:
3336         * html/HTMLSlotElement.cpp:
3337         * html/HTMLSlotElement.h:
3338         * html/HTMLSourceElement.cpp:
3339         * html/HTMLSourceElement.h:
3340         * html/HTMLSpanElement.cpp:
3341         * html/HTMLSpanElement.h:
3342         * html/HTMLStyleElement.cpp:
3343         * html/HTMLStyleElement.h:
3344         * html/HTMLSummaryElement.cpp:
3345         * html/HTMLSummaryElement.h:
3346         * html/HTMLTableCaptionElement.cpp:
3347         * html/HTMLTableCaptionElement.h:
3348         * html/HTMLTableCellElement.cpp:
3349         * html/HTMLTableCellElement.h:
3350         * html/HTMLTableColElement.cpp:
3351         * html/HTMLTableColElement.h:
3352         * html/HTMLTableElement.cpp:
3353         * html/HTMLTableElement.h:
3354         * html/HTMLTablePartElement.cpp:
3355         * html/HTMLTablePartElement.h:
3356         * html/HTMLTableRowElement.cpp:
3357         * html/HTMLTableRowElement.h:
3358         * html/HTMLTableSectionElement.cpp:
3359         * html/HTMLTableSectionElement.h:
3360         * html/HTMLTemplateElement.cpp:
3361         * html/HTMLTemplateElement.h:
3362         * html/HTMLTextAreaElement.cpp:
3363         * html/HTMLTextAreaElement.h:
3364         * html/HTMLTextFormControlElement.cpp:
3365         * html/HTMLTextFormControlElement.h:
3366         * html/HTMLTimeElement.cpp:
3367         * html/HTMLTimeElement.h:
3368         * html/HTMLTitleElement.cpp:
3369         * html/HTMLTitleElement.h:
3370         * html/HTMLTrackElement.cpp:
3371         * html/HTMLTrackElement.h:
3372         * html/HTMLUListElement.cpp:
3373         * html/HTMLUListElement.h:
3374         * html/HTMLUnknownElement.cpp: Added.
3375         * html/HTMLUnknownElement.h:
3376         * html/HTMLWBRElement.cpp: