63a1ccdced5e8574b391832cdd4a40297a8ec061
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-07-24  Antoine Quint  <graouts@apple.com>
2
3         [Web Animations] Crash when setting an animation style on an existing animation that had its effect set to null
4         https://bugs.webkit.org/show_bug.cgi?id=187953
5
6         Reviewed by Dean Jackson.
7
8         Test: webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect.html
9
10         Ensure that we have a valid effect before proceeding to update its timing. 
11
12         * animation/CSSAnimation.cpp:
13         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
14
15 2018-07-24  Eric Carlson  <eric.carlson@apple.com>
16
17         [MediaStream] Restructure getDisplayMedia classes
18         https://bugs.webkit.org/show_bug.cgi?id=187905
19         <rdar://problem/42500215>
20
21         Unreviewed build fix.
22
23         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: 
24
25 2018-07-24  Antoine Quint  <graouts@apple.com>
26
27         [Web Animations] Crash when setting "animation: none" after clearing an animation's effect
28         https://bugs.webkit.org/show_bug.cgi?id=187952
29
30         Reviewed by Dean Jackson.
31
32         Test: webanimations/setting-css-animation-none-after-clearing-effect.html
33
34         We need to ensure that the animation we're trying to remove has not had its effect cleared via the
35         Web Animations API since its creation before trying to check its phase.
36
37         * animation/AnimationTimeline.cpp:
38         (WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation):
39
40 2018-07-24  Antoine Quint  <graouts@apple.com>
41
42         [Web Animations] Crash accessing CSSAnimation::bindingsCurrentTime when effect has been set to null
43         https://bugs.webkit.org/show_bug.cgi?id=187950
44         <rdar://problem/42515747>
45
46         Reviewed by Dean Jackson.
47
48         Test: webanimations/accessing-current-time-after-clearing-css-animation-effect.html
49
50         While a CSSAnimation has an effect created for it by the implementation, the developer may yet manipulate
51         its effect via the Web Animations API and set it to null. As such, we must not assume it's always non-null.
52
53         * animation/CSSAnimation.cpp:
54         (WebCore::CSSAnimation::bindingsCurrentTime const):
55
56 2018-07-24  Zalan Bujtas  <zalan@apple.com>
57
58         [LFC][IFC] BlockContainer::establishesInlineFormattingContext should only check the first inflow child.
59         https://bugs.webkit.org/show_bug.cgi?id=187965
60
61         Reviewed by Antti Koivisto.
62
63         * layout/layouttree/LayoutBlockContainer.cpp:
64         (WebCore::Layout::BlockContainer::establishesInlineFormattingContext const):
65
66 2018-07-24  Myles C. Maxfield  <mmaxfield@apple.com>
67
68         [Cocoa] Stop crashing in lastResortFallbackFont()
69         https://bugs.webkit.org/show_bug.cgi?id=187936
70
71         Reviewed by Jon Lee.
72
73         CoreText can get into a state where both Times and Lucida Grande are inaccessible.
74         Instead of crashing, we should use the real LastResort, which is backed by a section
75         in the .rodata of the CoreText dylib, and as such should always exist.
76
77         * platform/graphics/FontCache.cpp:
78         (WebCore::FontCache::fontForFamily):
79         * platform/graphics/cocoa/FontCacheCoreText.cpp:
80         (WebCore::FontCache::lastResortFallbackFont):
81
82 2018-07-24  Daniel Bates  <dabates@apple.com>
83
84         Cannot view PDF's on my.gov.au: "Refused to load https://my.gov.au/attachment/viewAttachment because it
85         appears in neither the object-src directive nor the default-src directive of the Content Security Policy"
86         https://bugs.webkit.org/show_bug.cgi?id=187870
87         <rdar://problem/41190880>
88
89         Reviewed by Dean Jackson.
90
91         Fixes an issue where opening attachments on my.gov.au would show a "Blocked Plug-in" message.
92
93         Opening an attachment on my.gov.au opens a same-origin plugin document in a child window. Currently
94         same-origin plugin documents inherit their CSP policy from their opener. If the opener's CSP policy
95         disallows embedding plugins then the plugin document would be blocked from loading a plugin. For now
96         we relax the inheritance model such that we only inherit the plugin-types and report-uri directives
97         from the opener.
98
99         Developers that want to block plugin content from being loaded in a same-origin child window must now
100         serve such plugin content with a CSP policy that includes "object-src 'none'". This matches the behavior
101         described in the second Note in section object-src of the CSP 3 spec: <https://w3c.github.io/webappsec-csp/#directive-object-src>
102         (Editor's Draft, 10 July 2018). It also makes the behavior in WebKit more closely aligned with the
103         behavior of Chrome and Firefox.
104
105         Tests: http/tests/security/contentSecurityPolicy/same-origin-plugin-document-allowed-in-child-window.html
106                http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window-report.php
107                http/tests/security/contentSecurityPolicy/same-origin-plugin-document-with-csp-blocked-in-child-window.html
108
109         * dom/Document.cpp:
110         (WebCore::Document::initContentSecurityPolicy): For plugin documents that have an opener call ContentSecurityPolicy::createPolicyForPluginDocumentFrom()
111         to only inherit the plugin-types and report-uri directives from its opener's CSP policy. Otherwise, call ContentSecurityPolicy::copyStateFrom()
112         to inherit all directives from the owner frame as we do now.
113         * page/csp/ContentSecurityPolicy.cpp:
114         (WebCore::ContentSecurityPolicy::createPolicyForPluginDocumentFrom): Create a new policy from the specified policy
115         inheriting only the plugin-types and report-uri directives.
116         * page/csp/ContentSecurityPolicy.h: Define a new PolicyFrom enumerator, InheritedForPluginDocument, for plugin documents
117         loaded in a child window.
118         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
119         (WebCore::ContentSecurityPolicyDirectiveList::parse): When policyFrom is InheritedForPluginDocument then only
120         recognize the plugin-types and report-uri directives when parsing the policy.
121
122 2018-07-24  Daniel Bates  <dabates@apple.com>
123
124         Rename Document::firstPartyForSameSiteCookies() to siteForCookies()
125         https://bugs.webkit.org/show_bug.cgi?id=187892
126
127         Reviewed by Dean Jackson.
128
129         Standardize on the spec. language "site for cookies" for the names of the setter and getter
130         on Document. The latest description of Same-Site cookies is in <https://httpwg.org/http-extensions/rfc6265bis.html>.
131
132         No functionality changed. So, no new tests.
133
134         * dom/Document.h:
135         (WebCore::Document::siteForCookies const):
136         (WebCore::Document::setSiteForCookies):
137         (WebCore::Document::firstPartyForSameSiteCookies const): Deleted.
138         (WebCore::Document::setFirstPartyForSameSiteCookies): Deleted.
139         * loader/FrameLoader.cpp:
140         (WebCore::FrameLoader::setFirstPartyForCookies):
141         (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded):
142         * workers/service/context/ServiceWorkerThreadProxy.cpp:
143         (WebCore::createPageForServiceWorker):
144         * xml/XSLTProcessor.cpp:
145         (WebCore::XSLTProcessor::createDocumentFromSource):
146
147 2018-07-24  Ross Kirsling  <ross.kirsling@sony.com>
148
149         WebCore::URL::hostIsIPAddress needs a Windows implementation
150         https://bugs.webkit.org/show_bug.cgi?id=187859
151
152         Reviewed by Fujii Hironori.
153
154         * platform/URL.cpp:
155         (WebCore::isIPv4Address): Added.
156         (WebCore::isIPv6Address): Added.
157         (WebCore::URL::hostIsIPAddress):
158         Turn this stub into a platform-agnostic default implementation.
159
160 2018-07-24  Eric Carlson  <eric.carlson@apple.com>
161
162         [MediaStream] Restructure getDisplayMedia classes
163         https://bugs.webkit.org/show_bug.cgi?id=187905
164
165         Reviewed by Dean Jackson.
166
167         No new tests, no functional changes.
168
169         * platform/mediastream/CaptureDeviceManager.h:
170         (WebCore::CaptureDeviceManager::refreshCaptureDevices): Deleted, no need for it to be a 
171         virtual method.
172         * platform/mediastream/mac/AVCaptureDeviceManager.h:
173
174         * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h: refreshCaptureDevices is
175         no longer virtual.
176
177         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
178         (WebCore::DisplayCaptureManagerCocoa::captureDevices):
179         (WebCore::DisplayCaptureManagerCocoa::updateDisplayCaptureDevices): Moved functionality 
180         to ScreenDisplayCaptureSourceMac.
181         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): Ditto.
182         (WebCore::displayReconfigurationCallBack): Deleted, moved to ScreenDisplayCaptureSourceMac.
183         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa): Deleted.
184         (WebCore::DisplayCaptureManagerCocoa::refreshCaptureDevices): Deleted.
185         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
186
187         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
188         (WebCore::roundUpToMacroblockMultiple): Moved from ScreenDisplayCaptureSourceMac.
189         (WebCore::DisplayCaptureSourceCocoa::applySize): Ditto.
190         (WebCore::DisplayCaptureSourceCocoa::sampleBufferFromPixelBuffer): Ditto.
191         (WebCore::DisplayCaptureSourceCocoa::pixelBufferFromIOSurface): Ditto.
192         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
193
194         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
195         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
196         (WebCore::updateDisplayID):
197         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Fix log message.
198         (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream): Ditto.
199         (WebCore::ScreenDisplayCaptureSourceMac::applySize): Update for base class changes.
200         (WebCore::ScreenDisplayCaptureSourceMac::applyFrameRate): Ditto.
201         (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable): Ditto.
202         (WebCore::ScreenDisplayCaptureSourceMac::screenCaptureDeviceWithPersistentID): Moved from
203         DisplayCaptureManagerCocoa.
204         (WebCore::ScreenDisplayCaptureSourceMac::screenCaptureDevices): Ditto.
205         (WebCore::roundUpToMacroblockMultiple): Moved to DisplayCaptureSourceCocoa.
206         (WebCore::ScreenDisplayCaptureSourceMac::updateDisplayID): Ditto.
207         (WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer): Ditto.
208         (WebCore::ScreenDisplayCaptureSourceMac::pixelBufferFromIOSurface): Ditto.
209
210 2018-07-24  Zalan Bujtas  <zalan@apple.com>
211
212         [LFC] Move geometry data structures to a dedicated file
213         https://bugs.webkit.org/show_bug.cgi?id=187939
214
215         Reviewed by Antti Koivisto.
216
217         * WebCore.xcodeproj/project.pbxproj:
218         * layout/FormattingContext.h:
219         (WebCore::Layout::FormattingContext::Geometry::Position::operator LayoutPoint const): Deleted.
220         * layout/FormattingContextGeometry.cpp:
221         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
222         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
223         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
224         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
225         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
226         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
227         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
228         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
229         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
230         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
231         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
232         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
233         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
234         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
235         (WebCore::Layout::FormattingContext::Geometry::computedBorder):
236         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
237         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
238         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
239         * layout/blockformatting/BlockFormattingContext.h:
240         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
241         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
242         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
243         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
244         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
245         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
246         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
247         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
248         * layout/displaytree/DisplayBox.h:
249         (WebCore::Display::Box::setHorizontalMargin):
250         (WebCore::Display::Box::setVerticalMargin):
251         (WebCore::Display::Box::setVerticalNonCollapsedMargin):
252         (WebCore::Display::Box::setBorder):
253         (WebCore::Display::Box::setPadding):
254
255 2018-07-24  Thibault Saunier  <tsaunier@igalia.com>
256
257         [GStreamer] Implement bitrate modulation support in GStreamer based libwebrtc Encoders
258         https://bugs.webkit.org/show_bug.cgi?id=187643
259
260         Reviewed by Philippe Normand.
261
262         Problem being that we do not have a proper unified encoder API in GStreamer, some work
263         started at https://bugzilla.gnome.org/show_bug.cgi?id=796716 but it is quite controversial
264         and meanwhile we should just move forward working around that limitation.
265
266         Source/WebCore:
267         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
268         (WebCore::GStreamerVideoEncoder::GStreamerVideoEncoder):
269         (WebCore::GStreamerVideoEncoder::InitEncode):
270         (WebCore::GStreamerVideoEncoder::getBitrateSetter):
271         (WebCore::GStreamerVideoEncoder::createEncoder):
272         (WebCore::GStreamerVideoEncoder::AddCodecIfSupported):
273         (WebCore::GStreamerVideoEncoder::SetRestrictionCaps):
274         (WebCore::GStreamerVideoEncoder::CreateEncoder): Deleted.
275
276 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
277
278         REGRESSION(r234055): inverted return values in MediaPlayer::wouldTaintOrigin()
279         https://bugs.webkit.org/show_bug.cgi?id=187944
280
281         Reviewed by Carlos Garcia Campos.
282
283         The MediaPlayer::wouldTaintOrigin(), as introduced in r234055, should
284         return false when the URL protocol is `data:`, and should return true
285         when the given SecurityOrigin cannot access the media URL.
286
287         This matches behavior of CanvasRenderingContext::wouldTaintOrigin()
288         which the new method falls back to when the MediaPlayerPrivate
289         implementation doesn't or can't determine the would-taint result.
290
291         This fixes a bunch of failing and timing-out WebGL test cases on ports
292         using GStreamer (on which the MediaPlayerPrivate derivate doesn't
293         implement the wouldTaintOrigin() method).
294
295         * platform/graphics/MediaPlayer.cpp:
296         (WebCore::MediaPlayer::wouldTaintOrigin const):
297
298 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
299
300         [TextureMapper] Separate repaint counter state from debug visuals
301         https://bugs.webkit.org/show_bug.cgi?id=187946
302
303         Reviewed by Carlos Garcia Campos.
304
305         Instead of managing the repaint counter visibility along with the
306         debug border visuals, do that together with the repaint count value.
307
308         TextureMapperLayer::setRepaintCount() is renamed to setRepaintCounter()
309         and now also sets the repaint counter visibility state instead of the
310         setDebugVisuals() method.
311
312         GraphicsLayerTextureMapper implementation is adjusted appropriately.
313         The unused setRepaintCount() method is also removed.
314
315         CoordinatedGraphicsLayerState now holds repaint counter state (both
316         visibility and count value) in a struct that's separate from debug
317         border state. CoordinatedGraphicsLayer implementation now updates
318         that state accordingly.
319
320         No new tests -- no change in behavior.
321
322         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
323         (WebCore::GraphicsLayerTextureMapper::setShowRepaintCounter):
324         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
325         (WebCore::GraphicsLayerTextureMapper::setRepaintCount): Deleted.
326         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
327         * platform/graphics/texmap/TextureMapperLayer.cpp:
328         (WebCore::TextureMapperLayer::setDebugVisuals):
329         (WebCore::TextureMapperLayer::setRepaintCounter):
330         (WebCore::TextureMapperLayer::setRepaintCount): Deleted.
331         * platform/graphics/texmap/TextureMapperLayer.h:
332         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
333         (WebCore::CoordinatedGraphicsLayer::didUpdateTileBuffers):
334         (WebCore::CoordinatedGraphicsLayer::setShowRepaintCounter):
335         (WebCore::CoordinatedGraphicsLayer::syncLayerState):
336         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
337         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
338         (WebCore::DebugVisuals::DebugVisuals): Deleted.
339
340 2018-07-24  Thibault Saunier  <tsaunier@igalia.com>
341
342         [WPE][GTK] Implement PeerConnection API on top of libwebrtc
343         https://bugs.webkit.org/show_bug.cgi?id=186932
344
345         Reviewed by Philippe Normand.
346
347         Enabled many webrtc tests.
348
349         * platform/GStreamer.cmake: Build new files
350         * platform/graphics/gstreamer/GStreamerCommon.cpp: Fix minor style issues
351         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: Add a way to give precise name to pipelines
352         and give useful names to pipelines with sources comming from a PeerConnection
353         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Ditto.
354         * platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.cpp: Added. Implement a subclass of webrtc::VideoFrame
355         to represent a kNative GStreamer video frame.
356         * platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.h: Added. Ditto.
357         * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp: Handle incoming audio samples from libwebrtc.
358         * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.h: Ditto.
359         * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp: Handle incoming video frames from libwebrtc.
360         * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h: Ditto.
361         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp: Handle passing locally captured audio sample to libwebrtc.
362         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h: Ditto.
363         * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp: Handle passing locally captured vidoe frames to libwebrtc.
364         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp: Added. Implement a video decoder factory and LibWebRTC Video decoders based on GStreamer.
365         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.h: Added. Ditto.
366         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp: Added. Implement a video encoder factory and LibWebRTC H264/VP8 Video encoders based on GStreamer.
367         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.h: Added. Ditto.
368         * platform/mediastream/libwebrtc/LibWebRTCAudioFormat.h: Add information about signness of the LibWebRTC audio format.
369         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp: Add support for newly added Encoder/Decoder factories.
370         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.h: Ditto.
371
372 2018-07-24  Dirk Schulze  <krit@webkit.org>
373
374         [css-masking] Black backdrop on -webkit-clip-path on SVG root
375         https://bugs.webkit.org/show_bug.cgi?id=187880
376
377         Reviewed by Simon Fraser.
378
379         For SVG document root elements, we currently clip twice:
380         In RenderLayer and SVGRenderSupport.
381         Avoid clipping in RenderLayer which currently clips before we established a
382         backdrop for an SVG document.
383
384         Tests: svg/clip-path/clip-path-on-svg-005-expected.svg
385                svg/clip-path/clip-path-on-svg-005.svg
386
387         * rendering/RenderLayer.cpp:
388         (WebCore::RenderLayer::setupClipPath): Skip actual clipping.
389
390 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
391
392         [Nicosia] Add TextureMapperAnimations member to CompositingLayer::LayerState
393         https://bugs.webkit.org/show_bug.cgi?id=187941
394
395         Reviewed by Carlos Garcia Campos.
396
397         Nicosia::CompositingLayer::LayerState gains a TextureMapperAnimations
398         member that will be assigned a list of all active animations during each
399         layer flush. Despite the name, TextureMapperAnimations doesn't depend on
400         any other TextureMapper class. It might be renamed and moved in the
401         future, but for now it's used as-is.
402
403         In CoordinatedGraphicsLayer, the syncAnimations() method now flips on
404         the animationsChanged flag in the LayerState::Delta struct. This causes
405         all the active animations to be copied over into the layer state in
406         flushCompositingStateForThisLayerOnly().
407
408         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
409         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
410         (WebCore::CoordinatedGraphicsLayer::syncAnimations):
411         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
412
413 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
414
415         [Nicosia] Add FilterOperations member to CompositionLayer::LayerState
416         https://bugs.webkit.org/show_bug.cgi?id=187901
417
418         Reviewed by Carlos Garcia Campos.
419
420         Nicosia::CompositionLayer::LayerState gains a FilterOperations member
421         that can be assigned the list of filter operations for a given layer.
422         The corresponding filtersChanged boolean is added to LayerState::Delta.
423
424         CoordinatedGraphicsLayer::syncFilters() flips on that delta member,
425         which in turn causes the FilterOperations value to be updated during
426         the layer flush, in flushCompositingStateForThisLayerOnly().
427
428         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
429         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
430         (WebCore::CoordinatedGraphicsLayer::syncFilters):
431         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
432
433 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
434
435         [CoordGraphics] Use adjusted position, anchor point, size values for Nicosia::CompositionLayer state
436         https://bugs.webkit.org/show_bug.cgi?id=187899
437
438         Reviewed by Carlos Garcia Campos.
439
440         As is done for the CoordinatedGraphicsLayerState, the scale-adjusted
441         position, anchor point and size values should be used when updating the
442         corresponding Nicosia::CompositionLayer::LayerState members.
443
444         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
445         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
446
447 2018-07-23  Manuel Rego Casasnovas  <rego@igalia.com>
448
449         [css-grid] Add support for calc() in gutter properties
450         https://bugs.webkit.org/show_bug.cgi?id=187902
451
452         Reviewed by Simon Fraser.
453
454         The parsing was already accepting calc() in grid row and column gaps,
455         however the code was not taking that into account properly.
456         If the calc() had a percentage it was ignored and that's wrong.
457
458         The fix is just a change in the ceck at RenderGrid::availableSpaceForGutters().
459
460         Tests: imported/w3c/web-platform-tests/css/css-grid/abspos/grid-positioned-items-gaps-002-rtl.html
461                imported/w3c/web-platform-tests/css/css-grid/abspos/grid-positioned-items-gaps-002.html
462                imported/w3c/web-platform-tests/css/css-grid/alignment/grid-gutters-011.html
463                imported/w3c/web-platform-tests/css/css-grid/alignment/grid-gutters-012.html
464
465         * rendering/RenderGrid.cpp:
466         (WebCore::RenderGrid::availableSpaceForGutters const):
467
468 2018-07-23  Aditya Keerthi  <akeerthi@apple.com>
469
470         Remove extraneous #endif in html.css
471         https://bugs.webkit.org/show_bug.cgi?id=187934
472
473         Reviewed by Tim Horton.
474
475         * css/html.css: Remove extraneous #endif.
476
477 2018-07-23  Sihui Liu  <sihui_liu@apple.com>
478
479         CrashTracer: com.apple.WebKit.Storage at WebCore: WebCore::encodeKey
480         https://bugs.webkit.org/show_bug.cgi?id=187927
481
482         Reviewed by Chris Dumez.
483
484         IDBKeyData is valid only when each key of it is valid.
485
486         Test: LayoutTests/storage/indexeddb/index-multientry.html
487
488         * Modules/indexeddb/IDBKeyData.cpp:
489         (WebCore::IDBKeyData::isValid const):
490         * Modules/indexeddb/IDBKeyData.h:
491         (WebCore::IDBKeyData::isValid const): Deleted.
492
493 2018-07-23  Ben Richards  <benton_richards@apple.com>
494
495         We should cache the compiled sandbox profile in a data vault
496         https://bugs.webkit.org/show_bug.cgi?id=184991
497
498         Reviewed by Ryosuke Niwa.
499
500         Added functionality to FileHandle so that it can lock a file while open.
501         Added a function to FileSystem to delete non empty directories.
502
503         * platform/FileHandle.cpp:
504         (WebCore::FileHandle::FileHandle):
505         (WebCore::FileHandle::open):
506         (WebCore::FileHandle::close):
507         * platform/FileHandle.h:
508         * platform/FileSystem.h:
509         * platform/cocoa/FileSystemCocoa.mm:
510         (WebCore::FileSystem::deleteNonEmptyDirectory):
511
512 2018-07-23  Justin Fan  <justin_fan@apple.com>
513
514         [macOS] Ensure that WebGL contexts are always set to an accelerated virtual screen
515         https://bugs.webkit.org/show_bug.cgi?id=187923
516
517         Reviewed by Dean Jackson.
518
519         On eGPU displays, it is possible that CGL does not match the preferred renderer. 
520         In this case, and when the web process is blocked from accessing the window server, 
521         3D contexts *may* default to the software renderer. Ensure that even if this occurs,
522         we set the context to use a hardware-accelerated renderer/virtual screen.
523
524         No new tests. Existing behavior covered by existing tests.
525         Requires multiple screens, at least one attached to an eGPU, to stress. 
526
527         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
528         (WebCore::identifyAndSetCurrentGPU):
529
530 2018-07-23  Sam Weinig  <sam@webkit.org>
531
532         Convert some obvious never-null pointers to references in the editing code
533         https://bugs.webkit.org/show_bug.cgi?id=187914
534
535         Reviewed by Dean Jackson.
536
537         Fixup trivial cases of never-null pointers that really should be references.
538
539         * editing/ApplyStyleCommand.cpp:
540         (WebCore::ApplyStyleCommand::shouldApplyInlineStyleToRun):
541         (WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
542         (WebCore::ApplyStyleCommand::removeImplicitlyStyledElement):
543         (WebCore::ApplyStyleCommand::removeCSSStyle):
544         (WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
545         (WebCore::ApplyStyleCommand::applyInlineStyleChange):
546         * editing/EditingStyle.cpp:
547         (WebCore::EditingStyle::overrideWithStyle):
548         (WebCore::EditingStyle::conflictsWithInlineStyleOfElement const):
549         (WebCore::EditingStyle::conflictsWithImplicitStyleOfElement const):
550         (WebCore::EditingStyle::conflictsWithImplicitStyleOfAttributes const):
551         (WebCore::EditingStyle::extractConflictingImplicitStyleOfAttributes const):
552         (WebCore::EditingStyle::styleIsPresentInComputedStyleOfNode const):
553         (WebCore::EditingStyle::elementIsStyledSpanOrHTMLEquivalent):
554         (WebCore::EditingStyle::mergeInlineStyleOfElement):
555         (WebCore::EditingStyle::wrappingStyleForSerialization):
556         (WebCore::EditingStyle::legacyFontSize const):
557         (WebCore::StyleChange::StyleChange):
558         (WebCore::StyleChange::extractTextStyles):
559         (WebCore::legacyFontSizeFromCSSValue):
560         * editing/EditingStyle.h:
561         (WebCore::EditingStyle::conflictsWithInlineStyleOfElement const):
562         * editing/Editor.cpp:
563         (WebCore::Editor::selectionStartCSSPropertyValue):
564         * editing/ReplaceSelectionCommand.cpp:
565         (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
566         (WebCore::isInlineNodeWithStyle):
567         * editing/markup.cpp:
568         (WebCore::StyledMarkupAccumulator::appendElement):
569         (WebCore::StyledMarkupAccumulator::serializeNodes):
570
571 2018-07-23  Per Arne Vollan  <pvollan@apple.com>
572
573         WebCore::primaryScreenDisplayID() always return 0
574         https://bugs.webkit.org/show_bug.cgi?id=187922
575         <rdar://problem/42286933>
576
577         Reviewed by Geoffrey Garen.
578
579         This function should return a valid display ID.
580
581         No new tests. Testing this requires a dual monitor setup.
582
583         * platform/mac/PlatformScreenMac.mm:
584         (WebCore::primaryScreenDisplayID):
585
586 2018-07-23  Nan Wang  <n_wang@apple.com>
587
588         AX: Press tab to highlight items on a webpage is not working with voiceover enabled
589         https://bugs.webkit.org/show_bug.cgi?id=187824
590
591         Reviewed by Zalan Bujtas.
592
593         We are deferring posting focused element change notification when the document needs a
594         style recalculation. However, we only perform the cache update after a layout is completed.
595         Added a timer to perform the cache update in the next runloop when non-layout type of mutation
596         happens.
597         
598         Test: accessibility/mac/tab-focus-post-notification.html
599
600         * accessibility/AXObjectCache.cpp:
601         (WebCore::AXObjectCache::AXObjectCache):
602         (WebCore::AXObjectCache::~AXObjectCache):
603         (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded):
604         (WebCore::AXObjectCache::performCacheUpdateTimerFired):
605         * accessibility/AXObjectCache.h:
606         (WebCore::AXObjectCache::AXObjectCache):
607         (WebCore::AXObjectCache::performCacheUpdateTimerFired):
608
609 2018-07-23  Chris Dumez  <cdumez@apple.com>
610
611         WebResourceLoadStatisticsStore fails to unregister itself as a MessageReceiver in its destructor
612         https://bugs.webkit.org/show_bug.cgi?id=187910
613         <rdar://problem/42356526>
614
615         Reviewed by Brent Fulgham.
616
617         Add internals API that causes the ResourceLoadObserver to notify its observer, and avoid waiting
618         for the 5 second delay.
619
620         * testing/Internals.cpp:
621         (WebCore::Internals::notifyResourceLoadObserver):
622         * testing/Internals.h:
623         * testing/Internals.idl:
624
625 2018-07-23  Zalan Bujtas  <zalan@apple.com>
626
627         [LCF][IFC] Add support for hyphenation.
628         https://bugs.webkit.org/show_bug.cgi?id=187913
629
630         Reviewed by Antti Koivisto.
631
632         Move the hyphenation logic over from SimpleLineLayout::TextFragmentIterator.
633
634         * layout/inlineformatting/textlayout/Runs.h:
635         (WebCore::Layout::TextRun::hasHyphen const):
636         (WebCore::Layout::LayoutRun::setHasHyphen):
637         (WebCore::Layout::LayoutRun::hasHyphen const):
638         (WebCore::Layout::LayoutRun::LayoutRun):
639         (WebCore::Layout::TextRun::createNonWhitespaceRunWithHyphen):
640         (WebCore::Layout::TextRun::TextRun):
641         * layout/inlineformatting/textlayout/TextContentProvider.cpp:
642         (WebCore::Layout::TextContentProvider::findTextItemSlow const):
643         (WebCore::Layout::TextContentProvider::width const):
644         (WebCore::Layout::TextContentProvider::hyphenPositionBefore const):
645         * layout/inlineformatting/textlayout/TextContentProvider.h:
646         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp:
647         (WebCore::Layout::SimpleLineBreaker::Line::setTextAlign):
648         (WebCore::Layout::SimpleLineBreaker::Line::justifyRuns):
649         (WebCore::Layout::SimpleLineBreaker::Line::adjustRunsForTextAlign):
650         (WebCore::Layout::SimpleLineBreaker::Line::collectExpansionOpportunities):
651         (WebCore::Layout::SimpleLineBreaker::Line::closeLastRun):
652         (WebCore::Layout::SimpleLineBreaker::Line::append):
653         (WebCore::Layout::SimpleLineBreaker::Line::reset):
654         (WebCore::Layout::SimpleLineBreaker::Style::Style):
655         (WebCore::Layout::SimpleLineBreaker::handleLineEnd):
656         (WebCore::Layout::SimpleLineBreaker::createRunsForLine):
657         (WebCore::Layout::SimpleLineBreaker::hyphenPositionBefore const):
658         (WebCore::Layout::SimpleLineBreaker::adjustSplitPositionWithHyphenation const):
659         (WebCore::Layout::SimpleLineBreaker::split const):
660         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.h:
661
662 2018-07-23  Antoine Quint  <graouts@apple.com>
663
664         [Web Animations] Querying the current time of a finished CSSAnimation after removing its target leads to a crash
665         https://bugs.webkit.org/show_bug.cgi?id=187906
666
667         Reviewed by Dean Jackson.
668
669         Test: webanimations/accessing-current-time-after-finished-css-animation-target-removal.html
670
671         Because we carelessly look at a CSSAnimation's effect's timing in DeclarativeAnimation::bindingsCurrentTime
672         without checking that the effect is non-null, we can crash in the case where the animation is finished and
673         its target element has been removed, which caused the effect to be set to null.
674
675         We do not actually fix the lack of a null check, which will be the scope of a different patch, but instead
676         ensure that we do _not_ set the animation's effect to null when its target is removed, which used to be
677         performed via a call to WebAnimation::remove(). Instead, we introduce AnimationTimeline::elementWasRemoved()
678         which notifies the timeline of an element being removed such that we may stop referencing any animation
679         targeting this element from the various data structures holding strong references to the animation in question,
680         and we then cancel the animation silently, which is a new option that ensures promises aren't resolved or
681         rejected as a result.
682
683         Finally, the WebAnimation and AnimationEffectReadOnly classes established a ref-cycle as WebAnimation has
684         `RefPtr<AnimationEffectReadOnly> m_effect` and AnimationEffectReadOnly has `RefPtr<WebAnimation> m_animation`.
685         While it is correct that WebAnimation owns its effect, which is established by the DOM API, the
686         reverse is not correct since we only hold the reverse internally for the benefit of our implementation.
687         As such, we change AnimationEffectReadOnly's m_animation to be a WeakPtr<WebAnimation>. This means not
688         calling WebAnimation::remove() and simply removing the animation from the animation maps on the timeline
689         is sufficient to guarantee that the document timeline will not leak (and with it the document).
690
691         * animation/AnimationEffectReadOnly.h:
692         (WebCore::AnimationEffectReadOnly::setAnimation):
693         * animation/AnimationTimeline.cpp:
694         (WebCore::AnimationTimeline::elementWasRemoved):
695         * animation/AnimationTimeline.h:
696         * animation/WebAnimation.cpp:
697         (WebCore::WebAnimation::cancel):
698         (WebCore::WebAnimation::resetPendingTasks):
699         * animation/WebAnimation.h:
700         * dom/Element.cpp:
701         (WebCore::Element::removedFromAncestor):
702         * rendering/updating/RenderTreeUpdater.cpp:
703         (WebCore::RenderTreeUpdater::tearDownRenderers):
704
705 2018-07-23  Aditya Keerthi  <akeerthi@apple.com>
706
707         [iOS] Add support for input[type=color]
708         https://bugs.webkit.org/show_bug.cgi?id=187871
709
710         Reviewed by Tim Horton.
711
712         * css/html.css: Remove unwanted styling for color inputs with a list attribute.
713         * html/ColorInputType.cpp: Make the element focusable.
714         (WebCore::ColorInputType::isMouseFocusable const):
715         (WebCore::ColorInputType::isKeyboardFocusable const):
716         * html/ColorInputType.h:
717         * html/HTMLInputElement.h: Expose isColorControl() to WebKit.
718         * page/Chrome.cpp:
719         (WebCore::Chrome::createColorChooser):
720
721 2018-07-22  Dean Jackson  <dino@apple.com>
722
723         fullscreen env() variables should have initial values
724         https://bugs.webkit.org/show_bug.cgi?id=187897
725         <rdar://problem/42485682>
726
727         Reviewed by Sam Weinig.
728
729         The env() values for fullscreen properties need to be
730         initialized, rather than wait for values to be set from WebKit.
731         Without this, feature detection doesn't work, and properties
732         won't parse correctly.
733
734         Test: fullscreen/fullscreen-env-initial.html
735
736         * dom/ConstantPropertyMap.cpp:
737         (WebCore::ConstantPropertyMap::buildValues): Initialize the fullscreen values.
738         (WebCore::ConstantPropertyMap::updateConstantsForFullscreen): Renamed function, because it
739         also updates the duration value.
740         (WebCore::ConstantPropertyMap::didChangeFullscreenInsets): Call new name.
741         (WebCore::ConstantPropertyMap::updateConstantsForFullscreenInsets): Deleted.
742         * dom/ConstantPropertyMap.h:
743         * page/Page.cpp:
744         (WebCore::Page::setFullscreenAutoHideDuration): Don't change the value if it doesn't need it.
745         * page/Page.h: Add accessor for fullscreenAutoHideDuration. Also add a member variable.
746         (WebCore::Page::fullscreenAutoHideDuration const):
747
748 2018-07-22  Zalan Bujtas  <zalan@apple.com>
749
750         [LFC][IFC] Add center/right/justify line alignment support.
751         https://bugs.webkit.org/show_bug.cgi?id=187890
752
753         Reviewed by Antti Koivisto.
754
755         Move over some more code from simple line layout.
756         (though text-align: justify is more preformant as now expansion opportunities are added as we process the text runs
757         -as opposed to iterting through the runs again when we reach the end of the line.) 
758
759         * layout/inlineformatting/textlayout/Runs.h:
760         (WebCore::Layout::LayoutRun::setLeft):
761         (WebCore::Layout::LayoutRun::setExpansion):
762         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp:
763         (WebCore::Layout::SimpleLineBreaker::Line::Line):
764         (WebCore::Layout::SimpleLineBreaker::Line::setTextAlign):
765         (WebCore::Layout::SimpleLineBreaker::Line::adjustedLeftForTextAlign const):
766         (WebCore::Layout::SimpleLineBreaker::Line::justifyRuns):
767         (WebCore::Layout::SimpleLineBreaker::Line::adjustRunsForTextAlign):
768         (WebCore::Layout::expansionOpportunity):
769         (WebCore::Layout::expansionBehavior):
770         (WebCore::Layout::SimpleLineBreaker::Line::collectExpansionOpportunities):
771         (WebCore::Layout::SimpleLineBreaker::Line::closeLastRun):
772         (WebCore::Layout::SimpleLineBreaker::Line::append):
773         (WebCore::Layout::SimpleLineBreaker::Line::collapseTrailingWhitespace):
774         (WebCore::Layout::SimpleLineBreaker::Line::reset):
775         (WebCore::Layout::SimpleLineBreaker::Style::Style):
776         (WebCore::Layout::SimpleLineBreaker::handleLineEnd):
777         (WebCore::Layout::SimpleLineBreaker::handleLineStart):
778         (WebCore::Layout::isTextAlignRight):
779         (WebCore::Layout::SimpleLineBreaker::createRunsForLine):
780         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.h:
781         (WebCore::Layout::SimpleLineBreaker::Line::setAvailableWidth):
782         (WebCore::Layout::SimpleLineBreaker::Line::setCollapseWhitespace):
783
784 2018-07-21  Zalan Bujtas  <zalan@apple.com>
785
786         [LFC][IFC] Add verification for inline text runs.
787         https://bugs.webkit.org/show_bug.cgi?id=187879
788
789         Reviewed by Antti Koivisto.
790
791         * layout/Verification.cpp:
792         (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
793         (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
794         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
795         (WebCore::Layout::verifyAndOutputSubtree):
796         (WebCore::Layout::outputMismatchingBoxInformationIfNeeded): Deleted.
797         * layout/inlineformatting/InlineFormattingContext.cpp:
798         (WebCore::Layout::InlineFormattingContext::layout const):
799         * layout/inlineformatting/InlineFormattingState.h:
800         (WebCore::Layout::InlineFormattingState::addLayoutRuns):
801         (WebCore::Layout::InlineFormattingState::layoutRuns const):
802         * layout/layouttree/LayoutTreeBuilder.cpp:
803         (WebCore::Layout::outputLayoutBox):
804         (WebCore::Layout::outputLayoutTree):
805         (WebCore::Layout::TreeBuilder::showLayoutTree):
806
807 2018-07-21  Zalan Bujtas  <zalan@apple.com>
808
809         [LFC] Do not use virtual methods to construct floating/formatting states.
810         https://bugs.webkit.org/show_bug.cgi?id=187875
811
812         Reviewed by Antti Koivisto.
813
814         LayoutContext::establishedFormattingState() does not require FormattingContext anymore only the root of the context.
815
816         * layout/FormattingContext.cpp:
817         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
818         * layout/FormattingContext.h:
819         * layout/LayoutContext.cpp:
820         (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
821         (WebCore::Layout::LayoutContext::formattingStateForBox const):
822         (WebCore::Layout::LayoutContext::establishedFormattingState):
823         * layout/LayoutContext.h:
824         * layout/blockformatting/BlockFormattingContext.cpp:
825         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
826         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
827         (WebCore::Layout::BlockFormattingContext::createFormattingState const): Deleted.
828         (WebCore::Layout::BlockFormattingContext::createOrFindFloatingState const): Deleted.
829         * layout/blockformatting/BlockFormattingContext.h:
830         * layout/inlineformatting/InlineFormattingContext.cpp:
831         (WebCore::Layout::InlineFormattingContext::createFormattingState const): Deleted.
832         (WebCore::Layout::InlineFormattingContext::createOrFindFloatingState const): Deleted.
833         * layout/inlineformatting/InlineFormattingContext.h:
834
835 2018-07-21  Zalan Bujtas  <zalan@apple.com>
836
837         [LFC][BFC] Do not collapse top/bottom margin with first/last inflow child from a non-block formatting context.
838         https://bugs.webkit.org/show_bug.cgi?id=187867
839
840         Reviewed by Antti Koivisto.
841
842         The box's top/bottom margin never collapses with a non-block inflow child.
843
844         * layout/blockformatting/BlockMarginCollapse.cpp:
845         (WebCore::Layout::isMarginTopCollapsedWithSibling):
846         (WebCore::Layout::isMarginBottomCollapsedWithSibling):
847         (WebCore::Layout::isMarginTopCollapsedWithParent):
848         (WebCore::Layout::isMarginBottomCollapsedThrough):
849         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild):
850         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginTop):
851         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginTop):
852         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBottom):
853         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
854         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
855         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
856         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild):
857         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBottom):
858         * layout/layouttree/LayoutBox.cpp:
859         (WebCore::Layout::Box::establishesBlockFormattingContextOnly const): <div style="overflow: hidden">foobar</div> establishes both inline and block formatting context (inline wins though).
860         * layout/layouttree/LayoutBox.h: establishesBlockFormattingContext() does not need to be virtual since we can determine it by looking at the box's style. -while in case
861         of inline formatting context, it is about the content.
862
863 2018-07-20  Jer Noble  <jer.noble@apple.com>
864
865         REGRESSION (r233974): Cannot close pip'd video; pops back into PiP.
866         https://bugs.webkit.org/show_bug.cgi?id=187873
867
868         Reviewed by Jon Lee.
869
870         When the PIP machinery on Mac wants to close the PIP window (due to the close button being clicked), it does
871         not consult our -shouldClosePiP handler; it just tells us that we're going to close. So we never setup the 
872         necessary state on the WebProcess side and still think that our "targetIsFullscreen". When we get the "stop"
873         action, just request exit fullscreen, but set up the _pipState to think we're already exiting (because we are).
874
875         * platform/mac/VideoFullscreenInterfaceMac.mm:
876         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]):
877
878 2018-07-20  Justin Fan  <justin_fan@apple.com>
879
880         Safari WebGL does not consistently provide correct GPU context on eGPU systems
881         https://bugs.webkit.org/show_bug.cgi?id=187750
882         <rdar://problem/39531436>
883
884         Reviewed by Dean Jackson.
885
886         Move GraphicsContext3DManager into its own class, and notify it when page/Chrome receives a 
887         windowScreenDidChange message. Add a private data struct to track which hostWindow created each context.
888         Upon notification, Manager updates the contexts that match the hostWindow with the
889         provided displayID. Each context matches displayID to rendererID (set during process creation 
890         if window server is blocked), which is matched to a virtual screen, and updates its GPU accordingly.
891
892         No new tests. This requires multiple GPUs or eGPUs, each with attached display(s), to test.
893
894         * WebCore.xcodeproj/project.pbxproj:
895         * page/Chrome.cpp:
896         (WebCore::Chrome::windowScreenDidChange): Now calls GraphicsContext3DManager::screenDidChange().
897         * platform/PlatformScreen.h:
898         * platform/ScreenProperties.h: Add rendererID to struct.
899         (WebCore::ScreenData::encode const):
900         (WebCore::ScreenData::decode):
901         * platform/graphics/GraphicsContext3D.h:
902         * platform/graphics/GraphicsContext3DManager.cpp: Added (copied out of GraphicsContext3DCocoa.mm).
903         (WebCore::attachToAppleGraphicsControl):
904         (WebCore::hasMuxCapability):
905         (WebCore::hasMuxableGPU):
906         (WebCore::GraphicsContext3DManager::sharedManager):
907         (WebCore::displayWasReconfigured):
908         (WebCore::GraphicsContext3DManager::updateAllContexts):
909         (WebCore::GraphicsContext3DManager::screenDidChange):
910         (WebCore::GraphicsContext3DManager::addContext):
911         (WebCore::GraphicsContext3DManager::removeContext):
912         (WebCore::GraphicsContext3DManager::hostWindowForContext const):
913         (WebCore::GraphicsContext3DManager::addContextRequiringHighPerformance):
914         (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance):
915         (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
916         (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired):
917         (WebCore::GraphicsContext3DManager::recycleContextIfNecessary):
918         * platform/graphics/GraphicsContext3DManager.h: Added (copied out of GraphicsContext3DCocoa.mm).
919         (WebCore::GraphicsContext3DManager::hasTooManyContexts const):
920         (WebCore::GraphicsContext3DManager::GraphicsContext3DManager):
921         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
922         (WebCore::GraphicsContext3D::create):
923         (WebCore::GraphicsContext3D::createShared):
924         (WebCore::identifyAndSetCurrentGPU): Now matches rendererIDs to determine virtual screen. 
925         (WebCore::GraphicsContext3D::GraphicsContext3D):
926         (WebCore::GraphicsContext3D::~GraphicsContext3D):
927         (WebCore::GraphicsContext3D::setContextVisibility):
928         (WebCore::GraphicsContext3D::simulateContextChanged):
929         (WebCore::GraphicsContext3D::screenDidChange):
930         (WebCore::attachToAppleGraphicsControl): Deleted.
931         (WebCore::hasMuxCapability): Deleted.
932         (WebCore::hasMuxableGPU): Deleted.
933         (WebCore::GraphicsContext3DManager::GraphicsContext3DManager): Deleted.
934         (WebCore::GraphicsContext3DManager::hasTooManyContexts const): Deleted.
935         (WebCore::manager): Deleted.
936         (WebCore::displayWasReconfigured): Deleted.
937         (WebCore::GraphicsContext3DManager::updateAllContexts): Deleted.
938         (WebCore::GraphicsContext3DManager::addContext): Deleted.
939         (WebCore::GraphicsContext3DManager::removeContext): Deleted.
940         (WebCore::GraphicsContext3DManager::addContextRequiringHighPerformance): Deleted.
941         (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance): Deleted.
942         (WebCore::GraphicsContext3DManager::updateHighPerformanceState): Deleted.
943         (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired): Deleted.
944         (WebCore::GraphicsContext3DManager::recycleContextIfNecessary): Deleted.
945         * platform/mac/PlatformScreenMac.mm: Provide a display's rendererID.
946         (WebCore::rendererIDForDisplayMask):
947         (WebCore::collectScreenProperties):
948         (WebCore::rendererIDForDisplay):
949         (WebCore::primaryRendererID):
950
951 2018-07-19  Simon Fraser  <simon.fraser@apple.com>
952
953         Remove completed animations from GraphicsLayer, thus avoiding excessive backing store allocation
954         https://bugs.webkit.org/show_bug.cgi?id=187844
955         rdar://problem/40387294
956
957         Reviewed by Dean Jackson.
958         
959         A keyframe animation which animates 3D transforms, and is fill-forwards, currently
960         leaves the GraphicsLayer in a state where it has a "running" animation. However, the
961         logic that computes animation extent in RenderLayerBacking::updateGeometry() only does
962         so for running or paused animations. GraphicsLayer then thinks that it has an active
963         transform animation with unknown extent, and refuses to detach its backing store.
964         
965         This triggers excessive layer creation on some sites (e.g. https://www.kqed.org).
966         
967         Fix by always removing animations from the GraphicsLayer when they finish, whether
968         or not they fill forwards. This is done by having KeyframeAnimation::onAnimationEnd()
969         always call endAnimation().
970         
971         This change only fixes the non-Web Animation code path. webkit.org/b/187845 exists
972         to fix the other code path.
973         
974         Also improve some logging that would have revealed this problem sooner.
975
976         Test: compositing/backing/backing-store-attachment-fill-forwards-animation.html
977
978         * page/animation/AnimationBase.h:
979         (WebCore::AnimationBase::endAnimation):
980         * page/animation/ImplicitAnimation.cpp:
981         (WebCore::ImplicitAnimation::endAnimation):
982         * page/animation/ImplicitAnimation.h:
983         * page/animation/KeyframeAnimation.cpp:
984         (WebCore::KeyframeAnimation::endAnimation):
985         (WebCore::KeyframeAnimation::onAnimationEnd):
986         * page/animation/KeyframeAnimation.h:
987         * platform/graphics/ca/GraphicsLayerCA.cpp:
988         (WebCore::GraphicsLayerCA::addAnimation):
989         (WebCore::GraphicsLayerCA::updateCoverage):
990
991 2018-07-20  Ryosuke Niwa  <rniwa@apple.com>
992
993         Picking a color from the color panel for typing attributes needs to inverse transform through color-filter
994         https://bugs.webkit.org/show_bug.cgi?id=187846
995
996         Reviewed by Simon Fraser.
997
998         This patch refines the color inversion for editing introduced in r234005 so that font panels and WebKit embedders
999         can get and set inverted colors using attributed strings for a selected text in an editable region.
1000
1001         More specifically, when font panels or WebKit embedders set a font color or a background color via WebView's
1002         _applyStyleToSelection and _applyEditingStyleToSelection, WebKit would automatically invert the color before inserting
1003         into DOM so that the color visible to the user matches that's given to WebKit. Conversely,
1004         [WebView attributedSubstringFromRange:nsRange] now return the color visible to the user, i.e. the color after
1005         the color filter had been applied, so that some WebKit embedders can present the visually identical color to the user.
1006
1007         Because DOM never sees the color filter's effect in the computed style, etc... this patch reverts the change made to
1008         StyleChange in r234005 to avoid inverting the color passed to execCommand. This makes editing apps which is unaware
1009         of the dark mode or -apple-color-filter continue to function (because the color picker implemented in DOM will be
1010         applied of the same color filter before being presented to the user).
1011
1012         Finally, this patch introduces a testing hook in applyCommandToFrame so that executing foreColor or backColor with
1013         the soruce of CommandFromMenuOrKeyBinding would trigger the same code path as the one taken by Objective-C 
1014
1015         Tests: editing/execCommand/set-backColor-with-color-filter-from-scripts.html
1016                editing/execCommand/set-foreColor-with-color-filter-from-scripts.html
1017                editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html
1018                editing/style/set-backColor-with-color-filter.html
1019                editing/style/set-foreColor-with-color-filter.html
1020
1021         * editing/EditingStyle.cpp:
1022         (WebCore::EditingStyle::inverseTransformColorIfNeeded): Added.
1023         (WebCore::StyleChange::StyleChange): Revert the change made in r234005 since this code is also used by execCommand
1024         which is not desirable, and won't work for background color.
1025         (WebCore::StyleChange::extractTextStyles): Ditto.
1026         * editing/EditingStyle.h:
1027         * editing/Editor.cpp:
1028         (WebCore::Editor::applyStyle):
1029         (WebCore::Editor::applyStyleToSelection): Call EditingStyle::inverseTransformColorIfNeeded when ColorFilterMode is
1030         set to InvertColor.
1031         * editing/Editor.h:
1032         * editing/EditorCommand.cpp:
1033         (WebCore::applyCommandToFrame): Added the aforementioned testing hook.
1034         * editing/cocoa/HTMLConverter.mm:
1035         (WebCore::editingAttributedStringFromRange): Take the color filtr into account. Some WebKit embedders use this
1036         function to compute the font color in the selected text. Note that this function is mostly used for input methods
1037         so the color doesn't really matter, and its implementation is distinct from that of HTMLConverter.
1038
1039 2018-07-19  Jer Noble  <jer.noble@apple.com>
1040
1041         HLS resources with remote subresources will not taint canvasses.
1042         https://bugs.webkit.org/show_bug.cgi?id=187731
1043         <rdar://problem/42290703>
1044
1045         Reviewed by Brady Eidson.
1046
1047         Test: http/tests/security/canvas-remote-read-remote-video-hls.html
1048
1049         Most media sources are single-resource; they are accessed from a single origin. HLS manifests can contain many
1050         subresources from arbitrary origins, and canvases should be tainted when painted from media elements whose
1051         subresources were retrieved from tainting origins.
1052
1053         Add a new method to HTMLMediaElement, wouldTaintOrigin(), taking a SecurityOrigin, and returning whether the
1054         media element would taint that origin. This gets piped all the way down to MediaPlayerPrivateAVFoundationObjC
1055         which uses WebCoreNSURLSession to track all the origins of all the responses which resulted from the media
1056         element's load.
1057
1058         Drive-by fix: also fix this issue for media elements which render to an AudioContext.
1059
1060         Drive-by fix #2: CanvasRenderingContext2DBase::createPattern() needs to check the return value of
1061         ImageBuffer::create() before using it.
1062
1063         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
1064         (WebCore::MediaElementAudioSourceNode::wouldTaintOrigin):
1065         * html/HTMLMediaElement.cpp:
1066         (WebCore::HTMLMediaElement::didAttachRenderers):
1067         (WebCore::HTMLMediaElement::didDetachRenderers):
1068         (WebCore::HTMLMediaElement::scheduleUpdateShouldAutoplay):
1069         * html/HTMLMediaElement.h:
1070         (WebCore::HTMLMediaElement::wouldTaintOrigin const):
1071         * html/canvas/CanvasRenderingContext.cpp:
1072         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
1073         * html/canvas/CanvasRenderingContext2DBase.cpp:
1074         (WebCore::CanvasRenderingContext2DBase::createPattern):
1075         * platform/graphics/MediaPlayer.cpp:
1076         (WebCore::MediaPlayer::wouldTaintOrigin const):
1077         * platform/graphics/MediaPlayer.h:
1078         * platform/graphics/MediaPlayerPrivate.h:
1079         (WebCore::MediaPlayerPrivateInterface::hasSingleSecurityOrigin const):
1080         (WebCore::MediaPlayerPrivateInterface::wouldTaintOrigin const):
1081         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
1082         (WebCore::CDMSessionAVContentKeySession::update):
1083         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1084         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1085         (WebCore::MediaPlayerPrivateAVFoundationObjC::wouldTaintOrigin const):
1086         * platform/network/cocoa/WebCoreNSURLSession.h:
1087         * platform/network/cocoa/WebCoreNSURLSession.mm:
1088         (-[WebCoreNSURLSession task:didReceiveResponseFromOrigin:]):
1089         (-[WebCoreNSURLSession wouldTaintOrigin:]):
1090         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
1091
1092 2018-07-20  Zalan Bujtas  <zalan@apple.com>
1093
1094         Update FrameView::paintContents to use release logging.
1095         https://bugs.webkit.org/show_bug.cgi?id=187854
1096         <rdar://problem/42432371>
1097
1098         Reviewed by Simon Fraser.
1099
1100         Adding release logging helps identifying blank content cases. 
1101
1102         * page/FrameView.cpp:
1103         (WebCore::FrameView::paintContents):
1104
1105 2018-07-20  Jer Noble  <jer.noble@apple.com>
1106
1107         First Auto-PiP from Fullscreen too small & animation blocks
1108         https://bugs.webkit.org/show_bug.cgi?id=187745
1109         <rdar://problem/42316583>
1110
1111         Reviewed by Jon Lee.
1112
1113         1) When Auto-PiPing, we don't have the luxury of setting up the fullscreen state
1114         ahead of time; we get notified that PiP has already started. The area of the code
1115         which does this just-in-time setup needs to set the video layer's frame so that the
1116         transform within the PiP window is correct.
1117
1118         2) We generate a placeholder image when going into fullscreen, but we need to do
1119         so synchronously. Create the AVPlayerItemVideoOutput up front at AVPlayerItem creation
1120         time wherever AVPIVO is available.
1121
1122         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1123         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
1124         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1125         (VideoFullscreenInterfaceAVKit::doSetup):
1126
1127 2018-07-20  Antoine Quint  <graouts@apple.com>
1128
1129         DeclarativeAnimation should suspend, resume, & stop m_eventQueue
1130         https://bugs.webkit.org/show_bug.cgi?id=187216
1131         <rdar://problem/41669739>
1132
1133         Reviewed by Ryosuke Niwa.
1134
1135         Suspend, resume and close the GenericEventQueue for DeclarativeAnimation as instructed through the DOMActiveObject protocol.
1136
1137         * animation/DeclarativeAnimation.cpp:
1138         (WebCore::DeclarativeAnimation::stop):
1139         (WebCore::DeclarativeAnimation::suspend):
1140         (WebCore::DeclarativeAnimation::resume):
1141         * animation/DeclarativeAnimation.h:
1142         * animation/WebAnimation.h:
1143
1144 2018-07-20  Zalan Bujtas  <zalan@apple.com>
1145
1146         [LFC][Inline formatting context] Add basic text content handling.
1147         https://bugs.webkit.org/show_bug.cgi?id=187860
1148
1149         Reviewed by Antti Koivisto.
1150
1151         InlineFormattingContext::layout() walks through the formatting root's descendant list in a post-order fashion and
1152         feeds the TextContentProvider.
1153         Eventually this would turn into a more generic loop where we stop and process the text content when finding a non-text content box (float, inline-box etc), but right now
1154         this is about text content only.
1155
1156         * layout/displaytree/DisplayBox.h:
1157         (WebCore::Display::Box::contentBoxBottom const):
1158         (WebCore::Display::Box::contentBoxRight const):
1159         * layout/inlineformatting/InlineFormattingContext.cpp:
1160         (WebCore::Layout::InlineFormattingContext::layout const):
1161         * layout/inlineformatting/textlayout/TextContentProvider.cpp:
1162         (WebCore::Layout::TextContentProvider::textRuns): Add a helper function to support the case when all we need is just the run list in one go.
1163         * layout/inlineformatting/textlayout/TextContentProvider.h:
1164         * layout/layouttree/LayoutBox.cpp:
1165         (WebCore::Layout::Box::isDescendantOf const):
1166         * layout/layouttree/LayoutBox.h:
1167         * layout/layouttree/LayoutInlineBox.h:
1168         (WebCore::Layout::InlineBox::textContent const):
1169
1170 2018-07-20  Youenn Fablet  <youenn@apple.com>
1171
1172         FetchResponse should close its stream when loading finishes
1173         https://bugs.webkit.org/show_bug.cgi?id=187790
1174
1175         Reviewed by Chris Dumez.
1176
1177         It simplifies for a FetchResponse to push all its data into its stream if already created at end of load time.
1178         Did some refactoring in FetchBodyOwner to have a cleaner relationship with the stream source.
1179         Did a minor refactoring to expose the error description when loading fails as part of the rejected promise.
1180         This is consistent to errors sent back through callbacks.
1181
1182         Covered by existing tests.
1183
1184         * Modules/fetch/FetchBodyOwner.cpp:
1185         (WebCore::FetchBodyOwner::~FetchBodyOwner):
1186         * Modules/fetch/FetchBodyOwner.h:
1187         * Modules/fetch/FetchBodySource.cpp:
1188         (WebCore::FetchBodySource::FetchBodySource):
1189         (WebCore::FetchBodySource::setActive):
1190         (WebCore::FetchBodySource::setInactive):
1191         (WebCore::FetchBodySource::doStart):
1192         (WebCore::FetchBodySource::doPull):
1193         (WebCore::FetchBodySource::doCancel):
1194         (WebCore::FetchBodySource::cleanBodyOwner):
1195         * Modules/fetch/FetchBodySource.h:
1196         * Modules/fetch/FetchResponse.cpp:
1197         (WebCore::FetchResponse::BodyLoader::didSucceed):
1198         (WebCore::FetchResponse::BodyLoader::didFail):
1199
1200 2018-07-20  Jer Noble  <jer.noble@apple.com>
1201
1202         REGRESSION(r233969): ASSERT in -[WebAVPlayerLayer setVideoGravity:]
1203         https://bugs.webkit.org/show_bug.cgi?id=187814
1204         <rdar://problem/42391869>
1205
1206         Reviewed by Eric Carlson.
1207
1208         After r233969 caused models to disassociate themselves from interfaces, it is now possible that an
1209         VideoFullscreenInterfaceAVKit can have a nil model. We should null-check, not ASSERT, now that the
1210         assertion no longer holds true.
1211
1212         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1213         (-[WebAVPlayerLayer layoutSublayers]):
1214         (-[WebAVPlayerLayer resolveBounds]):
1215         (-[WebAVPlayerLayer setVideoGravity:]):
1216
1217 2018-07-19  Antoine Quint  <graouts@apple.com>
1218
1219         Flaky crash in AnimationTimeline::cancelOrRemoveDeclarativeAnimation
1220         https://bugs.webkit.org/show_bug.cgi?id=187530
1221         <rdar://problem/42095186>
1222
1223         Reviewed by Dean Jackson.
1224
1225         We would crash in cancelOrRemoveDeclarativeAnimation() because updateCSSAnimationsForElement() would pass
1226         nullptr values due to the return value of cssAnimationsByName.take(nameOfAnimationToRemove). This is because
1227         we would create animations for animation names that may be empty or not match an existing @keyframes rule.
1228         Not only was that wasteful, but it was also non-compliant, and as a result of fixing this we're actually
1229         seeing a progression in the CSS Animations WPT tests.
1230
1231         * animation/AnimationTimeline.cpp:
1232         (WebCore::shouldConsiderAnimation): New function that performs all required steps to see if a provided animation
1233         is valid and has a name that is not "none", not the empty string and matches the name of a @keyframes rule.
1234         (WebCore::AnimationTimeline::updateCSSAnimationsForElement):
1235         * animation/KeyframeEffectReadOnly.cpp:
1236         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): We no longer need to check whether we have
1237         an empty animation name since we're no longer creating CSSAnimation objects in that circumstance.
1238         * css/StyleResolver.cpp:
1239         (WebCore::StyleResolver::isAnimationNameValid): Add a new method that checks whether the provided animation name
1240         a known @keyframes rule.
1241         * css/StyleResolver.h:
1242
1243 2018-07-19  Chris Dumez  <cdumez@apple.com>
1244
1245         Crash under WebCore::DocumentWriter::addData()
1246         https://bugs.webkit.org/show_bug.cgi?id=187819
1247         <rdar://problem/41328743>
1248
1249         Reviewed by Brady Eidson.
1250
1251         When AppCache is used a DocumentLoader may start a NetworkLoad even though it has substitute data.
1252         In DocumentLoader::continueAfterContentPolicy(), if we have substitute data we commit this data
1253         and call finishLoad(). However, if the case where there was a NetworkLoad started, we'll send the
1254         ContinueDidReceiveResponse IPC back to the network process and it will start sending us data for
1255         the load. This could lead to crashes such as <rdar://problem/41328743> since the DocumentLoader
1256         has already committed data and finished loading when it gets the data from the network process.
1257
1258         To address the issue, we now call clearMainResource() in continueAfterContentPolicy(), after we've
1259         decided to commit the substitute data. This effectively removes the DocumentLoader as a client of
1260         the CachedResource so that its will not be notified of following load progress. We do not cancel
1261         the load as other CachedResourceClients may be interested in the load (ApplicationCacheResourceLoader
1262         in particular, in order to update its cached data).
1263
1264         * loader/DocumentLoader.cpp:
1265         (WebCore::DocumentLoader::continueAfterContentPolicy):
1266
1267 2018-07-19  Dean Jackson  <dino@apple.com>
1268
1269         CrashTracer: com.apple.WebKit.WebContent.Development at com.apple.WebCore: std::optional<WTF::Vector<WebCore::PluginInfo, 0ul, WTF::CrashOnOverflow, 16ul> >::operator* & + 73
1270         https://bugs.webkit.org/show_bug.cgi?id=187820
1271         <rdar://problem/42017759>
1272
1273         Reviewed by Antoine Quint.
1274
1275         Speculative fix for this crash, which is accessing an optional without checking
1276         if it exists. The crash logs didn't point to a reproducible test case.
1277
1278         * plugins/PluginData.cpp:
1279         (WebCore::PluginData::supportsWebVisibleMimeTypeForURL const): Return false if
1280         the optional doesn't exist.
1281
1282 2018-07-19  Antoine Quint  <graouts@apple.com>
1283
1284         Ensure DocumentTimeline is kept alive until the VM::whenIdle callback is called
1285         https://bugs.webkit.org/show_bug.cgi?id=187692
1286
1287         Reviewed by Ryosuke Niwa.
1288
1289         Ensure we keep the DocumentTimeline alive until the VM::whenIdle callback is called.
1290
1291         * animation/DocumentTimeline.cpp:
1292         (WebCore::DocumentTimeline::currentTime):
1293
1294 2018-07-18  Simon Fraser  <simon.fraser@apple.com>
1295
1296         Setting foreground color when editing should take color-filter into account, and report the correct foreground color for collapsed selections
1297         https://bugs.webkit.org/show_bug.cgi?id=187778
1298
1299         Reviewed by Ryosuke Niwa.
1300         
1301         Fix two aspects of editing with color-filter:
1302
1303         1. When setting foreground color, inverse-transform the color through -apple-color-filter so that the user gets the color
1304            they chose when in Dark Mode. Tested by editing/style/exec-command-foreColor-with-color-filter.html.
1305
1306         2. When retrieving the style of the collapsed selection, take color filter into account so that color picker
1307            reflects the color the users sees, instead of the content color. Tested by editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html
1308
1309         Add two additional tests that ensure that -apple-color-filter does not impact the NSAttributedString code
1310         path, since -apple-color-filter should not affect the behavior of Copy.
1311
1312         Tests: editing/mac/attributed-string/attrib-string-colors-with-color-filter.html
1313                editing/mac/attributed-string/attrib-string-range-with-color-filter.html
1314                editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html
1315                editing/style/exec-command-foreColor-with-color-filter.html
1316
1317         * editing/EditingStyle.cpp:
1318         (WebCore::StyleChange::StyleChange):
1319         (WebCore::StyleChange::extractTextStyles):
1320         * editing/EditingStyle.h:
1321         * editing/cocoa/EditorCocoa.mm:
1322         (WebCore::Editor::fontAttributesForSelectionStart const):
1323         * platform/graphics/filters/FilterOperation.cpp:
1324         (WebCore::InvertLightnessFilterOperation::inverseTransformColor const):
1325         * platform/graphics/filters/FilterOperation.h:
1326         (WebCore::FilterOperation::inverseTransformColor const):
1327         * platform/graphics/filters/FilterOperations.cpp:
1328         (WebCore::FilterOperations::transformColor const):
1329         (WebCore::FilterOperations::inverseTransformColor const):
1330         * platform/graphics/filters/FilterOperations.h:
1331
1332 2018-07-19  David Fenton  <david_fenton@apple.com>
1333
1334         Unreviewed, rolling out r233994.
1335
1336         Caused EWS and bot failures due to assertions added
1337
1338         Reverted changeset:
1339
1340         "FetchResponse should close its stream when loading finishes"
1341         https://bugs.webkit.org/show_bug.cgi?id=187790
1342         https://trac.webkit.org/changeset/233994
1343
1344 2018-07-19  Jer Noble  <jer.noble@apple.com>
1345
1346         REGRESSION(r233926): media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline.html is a TIMEOUT failure
1347         https://bugs.webkit.org/show_bug.cgi?id=187813
1348
1349         Reviewed by Jon Lee.
1350
1351         In r233926, we changed the behavior of entering PiP to exit fullscreen only after entering PiP completes. The
1352         test in question will immediately request "inline" presentation mode once the PiP animation begins, and thus
1353         it's asking to "exit fullscreen" when both in standard fullscreen and also in PiP. The fix is not to bail out
1354         early if we're in standard (element) fullscreen, but to allow the remaining steps to complete and exit PiP as
1355         well.
1356
1357         * html/HTMLMediaElement.cpp:
1358         (WebCore::HTMLMediaElement::exitFullscreen):
1359
1360 2018-07-19  Zalan Bujtas  <zalan@apple.com>
1361
1362         [LFC] Introduce simple line breaker.
1363         https://bugs.webkit.org/show_bug.cgi?id=187688
1364
1365         Reviewed by Antti Koivisto.
1366
1367         This patch takes the simple line layout implementation and refactors it in a way it is no longer requires a RenderBlockFlow object to run on.
1368         Also this patch decouples text run generation and line breaking (and this implementation is going to replace the current simple line layout codebase)
1369
1370         TextContentProvider: Acts both as the container for all the text content (including hard line breaks) and as an iterator for the generated text runs.
1371         SimpleTextRunGenerator: TextContentProvider uses it as the text run generator for simple content (in the future we'll have a ComplexTextRunGenerator).
1372         SimpleLineBreaker: Input -> text runs + line constraints; Output -> layout runs after line breaking.
1373
1374         * Sources.txt:
1375         * WebCore.xcodeproj/project.pbxproj:
1376         * layout/inlineformatting/textlayout/ContentProvider.cpp: Added.
1377         (WebCore::Layout::TextContentProvider::TextItem::Style::Style):
1378         (WebCore::Layout::TextContentProvider::ContentProvider):
1379         (WebCore::Layout::TextContentProvider::~ContentProvider):
1380         (WebCore::Layout::TextContentProvider::appendText):
1381         (WebCore::Layout::TextContentProvider::appendLineBreak):
1382         (WebCore::Layout::TextContentProvider::width const):
1383         (WebCore::Layout::TextContentProvider::textWidth const):
1384         (WebCore::Layout::TextContentProvider::fixedPitchWidth const):
1385         (WebCore::Layout::TextContentProvider::toTextItemIndex const):
1386         (WebCore::Layout::TextContentProvider::length const):
1387         (WebCore::Layout::TextContentProvider::iterator):
1388         (WebCore::Layout::TextContentProvider::findNextRun):
1389         (WebCore::Layout::TextContentProvider::current const):
1390         * layout/inlineformatting/textlayout/ContentProvider.h: Added.
1391         (WebCore::Layout::TextContentProvider::textContent const):
1392         (WebCore::Layout::TextContentProvider::hardLineBreaks const):
1393         (WebCore::Layout::TextContentProvider::Iterator::current const):
1394         (WebCore::Layout::TextContentProvider::contains const):
1395         (WebCore::Layout::TextContentProvider::Iterator::Iterator):
1396         (WebCore::Layout::TextContentProvider::Iterator::operator++):
1397         * layout/inlineformatting/textlayout/Runs.h: Added.
1398         (WebCore::Layout::TextRun::isWhitespace const):
1399         (WebCore::Layout::TextRun::isNonWhitespace const):
1400         (WebCore::Layout::TextRun::isLineBreak const):
1401         (WebCore::Layout::TextRun::isSoftLineBreak const):
1402         (WebCore::Layout::TextRun::isHardLineBreak const):
1403         (WebCore::Layout::TextRun::isValid const):
1404         (WebCore::Layout::TextRun::isCollapsed const):
1405         (WebCore::Layout::TextRun::type const):
1406         (WebCore::Layout::TextRun::setIsCollapsed):
1407         (WebCore::Layout::TextRun::setWidth):
1408         (WebCore::Layout::LayoutRun::start const):
1409         (WebCore::Layout::LayoutRun::end const):
1410         (WebCore::Layout::LayoutRun::length const):
1411         (WebCore::Layout::LayoutRun::left const):
1412         (WebCore::Layout::LayoutRun::right const):
1413         (WebCore::Layout::LayoutRun::width const):
1414         (WebCore::Layout::LayoutRun::isEndOfLine const):
1415         (WebCore::Layout::LayoutRun::setEnd):
1416         (WebCore::Layout::LayoutRun::setRight):
1417         (WebCore::Layout::LayoutRun::setIsEndOfLine):
1418         (WebCore::Layout::LayoutRun::LayoutRun):
1419         (WebCore::Layout::TextRun::createWhitespaceRun):
1420         (WebCore::Layout::TextRun::createNonWhitespaceRun):
1421         (WebCore::Layout::TextRun::createSoftLineBreakRun):
1422         (WebCore::Layout::TextRun::createHardLineBreakRun):
1423         (WebCore::Layout::TextRun::TextRun):
1424         (WebCore::Layout::TextRun::start const):
1425         (WebCore::Layout::TextRun::end const):
1426         (WebCore::Layout::TextRun::length const):
1427         (WebCore::Layout::TextRun::width const):
1428         * layout/inlineformatting/textlayout/simple/SimpleContentProvider.cpp: Added.
1429         (WebCore::Layout::SimpleContentProvider::SimpleContentProvider):
1430         (WebCore::Layout::SimpleContentProvider::current const):
1431         (WebCore::Layout::SimpleContentProvider::reset):
1432         (WebCore::Layout::SimpleContentProvider::findNextRun):
1433         (WebCore::Layout::SimpleContentProvider::moveToNextBreakablePosition):
1434         (WebCore::Layout::SimpleContentProvider::moveToNextNonWhitespacePosition):
1435         (WebCore::Layout::SimpleContentProvider::isAtLineBreak const):
1436         (WebCore::Layout::SimpleContentProvider::isAtSoftLineBreak const):
1437         * layout/inlineformatting/textlayout/simple/SimpleContentProvider.h: Added.
1438         (WebCore::Layout::SimpleContentProvider::Iterator::reset):
1439         (WebCore::Layout::SimpleContentProvider::Position::operator== const):
1440         (WebCore::Layout::SimpleContentProvider::Position::operator< const):
1441         (WebCore::Layout::SimpleContentProvider::Position::operator ContentPosition const):
1442         (WebCore::Layout::SimpleContentProvider::Position::resetItemPosition):
1443         (WebCore::Layout::SimpleContentProvider::Position::contentPosition const):
1444         (WebCore::Layout::SimpleContentProvider::Position::itemPosition const):
1445         (WebCore::Layout::SimpleContentProvider::Iterator<T>::Iterator):
1446         (WebCore::Layout::SimpleContentProvider::Iterator<T>::current const):
1447         (WebCore::Layout::SimpleContentProvider::Iterator<T>::operator):
1448         (WebCore::Layout::SimpleContentProvider::Position::operator++):
1449         (WebCore::Layout::SimpleContentProvider::Position::operator+=):
1450         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp: Added.
1451         (WebCore::Layout::SimpleLineBreaker::TextRunList::TextRunList):
1452         (WebCore::Layout::SimpleLineBreaker::Line::Line):
1453         (WebCore::Layout::adjustedEndPosition):
1454         (WebCore::Layout::SimpleLineBreaker::Line::append):
1455         (WebCore::Layout::SimpleLineBreaker::Line::collapseTrailingWhitespace):
1456         (WebCore::Layout::SimpleLineBreaker::Line::reset):
1457         (WebCore::Layout::SimpleLineBreaker::Style::Style):
1458         (WebCore::Layout::SimpleLineBreaker::SimpleLineBreaker):
1459         (WebCore::Layout::SimpleLineBreaker::runs):
1460         (WebCore::Layout::SimpleLineBreaker::createRunsForLine):
1461         (WebCore::Layout::SimpleLineBreaker::handleOverflownRun):
1462         (WebCore::Layout::SimpleLineBreaker::collapseLeadingWhitespace):
1463         (WebCore::Layout::SimpleLineBreaker::collapseTrailingWhitespace):
1464         (WebCore::Layout::SimpleLineBreaker::splitTextRun):
1465         (WebCore::Layout::SimpleLineBreaker::split const):
1466         (WebCore::Layout::SimpleLineBreaker::availableWidth const):
1467         (WebCore::Layout::SimpleLineBreaker::verticalPosition const):
1468         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.h: Added.
1469         (WebCore::Layout::SimpleLineBreaker::TextRunList::overrideCurrent):
1470         (WebCore::Layout::SimpleLineBreaker::TextRunList::isCurrentOverridden const):
1471         (WebCore::Layout::SimpleLineBreaker::Line::availableWidth const):
1472         (WebCore::Layout::SimpleLineBreaker::Line::hasContent const):
1473         (WebCore::Layout::SimpleLineBreaker::Line::setAvailableWidth):
1474         (WebCore::Layout::SimpleLineBreaker::Line::hasTrailingWhitespace const):
1475         (WebCore::Layout::SimpleLineBreaker::Line::isWhitespaceOnly const):
1476         (WebCore::Layout::SimpleLineBreaker::wrapContentOnOverflow const):
1477         (WebCore::Layout::SimpleLineBreaker::TextRunList::current const):
1478         (WebCore::Layout::SimpleLineBreaker::TextRunList::operator++):
1479
1480 2018-07-19  Keith Rollin  <krollin@apple.com>
1481
1482         Remove duplicate compilation of WebKitNSImageExtras.mm
1483         https://bugs.webkit.org/show_bug.cgi?id=187782
1484
1485         Reviewed by Alex Christensen.
1486
1487         WebKitNSImageExtras.mm gets compiled twice, once because it's in
1488         WebCore.xcodeproj/project.pbxproj and once because it's in
1489         Webcore/SourcesCocoa.txt. This can lead to duplicate definition
1490         errors, particularly when building with LTO enabled. Fix this by
1491         removing the entry from the Xcode project.
1492
1493         No new tests -- no change in WebKit functionality.
1494
1495         * WebCore.xcodeproj/project.pbxproj:
1496
1497 2018-07-19  Youenn Fablet  <youenn@apple.com>
1498
1499         FetchResponse should close its stream when loading finishes
1500         https://bugs.webkit.org/show_bug.cgi?id=187790
1501
1502         Reviewed by Chris Dumez.
1503
1504         It simplifies for a FetchResponse to push all its data into its stream if already created at end of load time.
1505         Did some refactoring in FetchBodyOwner to have a cleaner relationship with the stream source.
1506         Did a minor refactoring to expose the error description when loading fails as part of the rejected promise.
1507         This is consistent to errors sent back through callbacks.
1508
1509         Covered by existing tests.
1510
1511         * Modules/fetch/FetchBodyOwner.cpp:
1512         (WebCore::FetchBodyOwner::~FetchBodyOwner):
1513         * Modules/fetch/FetchBodyOwner.h:
1514         * Modules/fetch/FetchBodySource.cpp:
1515         (WebCore::FetchBodySource::FetchBodySource):
1516         (WebCore::FetchBodySource::setActive):
1517         (WebCore::FetchBodySource::setInactive):
1518         (WebCore::FetchBodySource::doStart):
1519         (WebCore::FetchBodySource::doPull):
1520         (WebCore::FetchBodySource::doCancel):
1521         (WebCore::FetchBodySource::cleanBodyOwner):
1522         * Modules/fetch/FetchBodySource.h:
1523         * Modules/fetch/FetchResponse.cpp:
1524         (WebCore::FetchResponse::BodyLoader::didSucceed):
1525         (WebCore::FetchResponse::BodyLoader::didFail):
1526
1527 2018-07-19  Jon Lee  <jonlee@apple.com>
1528
1529         Update iOS fullscreen alert text again
1530         https://bugs.webkit.org/show_bug.cgi?id=187797
1531         rdar://problem/42373783
1532
1533         Reviewed by Jer Noble.
1534
1535         * English.lproj/Localizable.strings:
1536
1537 2018-07-19  Keith Rollin  <krollin@apple.com>
1538
1539         Adjust WEBCORE_EXPORT annotations for LTO
1540         https://bugs.webkit.org/show_bug.cgi?id=187781
1541         <rdar://problem/42351124>
1542
1543         Reviewed by Alex Christensen.
1544
1545         Continuation of Bug 186944. This bug addresses issues not caught
1546         during the first pass of adjustments. The initial work focussed on
1547         macOS; this one addresses issues found when building for iOS. From
1548         186944:
1549
1550         Adjust a number of places that result in WebKit's
1551         'check-for-weak-vtables-and-externals' script reporting weak external
1552         symbols:
1553
1554             ERROR: WebCore has a weak external symbol in it (/Volumes/Data/dev/webkit/OpenSource/WebKitBuild/Release/WebCore.framework/Versions/A/WebCore)
1555             ERROR: A weak external symbol is generated when a symbol is defined in multiple compilation units and is also marked as being exported from the library.
1556             ERROR: A common cause of weak external symbols is when an inline function is listed in the linker export file.
1557             ...
1558
1559         These cases are caused by inline methods being marked with WTF_EXPORT
1560         (or related macro) or with an inline function being in a class marked
1561         as such, and when enabling LTO builds.
1562
1563         For the most part, address these by removing the WEBCORE_EXPORT
1564         annotation from inline methods. In some cases, move the implementation
1565         out-of-line because it's the class that has the WEBCORE_EXPORT on it
1566         and removing the annotation from the class would be too disruptive.
1567         Finally, in other cases, move the implementation out-of-line because
1568         check-for-weak-vtables-and-externals still complains when keeping the
1569         implementation inline and removing the annotation; this seems to
1570         typically (but not always) happen with destructors.
1571
1572         No new tests. There is no changed functionality. Only the annotation
1573         and treatment of inline methods are altered.
1574
1575         * platform/graphics/FourCC.h:
1576         (WebCore::FourCC::FourCC):
1577         * platform/graphics/IntPoint.h:
1578         (WebCore::IntPoint::IntPoint):
1579         * platform/mediastream/RealtimeMediaSource.cpp:
1580         (WebCore::RealtimeMediaSource::Observer::~Observer):
1581         (WebCore::RealtimeMediaSource::AudioCaptureFactory::~AudioCaptureFactory):
1582         (WebCore::RealtimeMediaSource::VideoCaptureFactory::~VideoCaptureFactory):
1583         * platform/mediastream/RealtimeMediaSource.h:
1584         * workers/service/ServiceWorkerProvider.cpp:
1585         (WebCore::ServiceWorkerProvider::~ServiceWorkerProvider):
1586         * workers/service/ServiceWorkerProvider.h:
1587
1588 2018-07-19  Charlie Turner  <cturner@igalia.com>
1589
1590         [GStreamer] Return a valid time values in unprerolled states
1591         https://bugs.webkit.org/show_bug.cgi?id=187111
1592
1593         Reviewed by Xabier Rodriguez-Calvar.
1594
1595         After r230584 in bug 180253, asserts were added in
1596         PlatformTimeRanges::add to check that both ends of the range were
1597         valid times. In the non-MSE GStreamer player, this assert was
1598         firing on https://www.w3.org/2010/05/video/mediaevents.html due to
1599         seekable being called in nonprerolled states. In this case
1600         MediaPlayerPrivateInterface::seekable was calling GStreamer's
1601         maxTimeSeekable, which calls in durationMediaTime. The guard
1602         against calling gst_element_query_duration when not prerolled was
1603         returning a different time value than when the duration query
1604         itself failed. Hence the assert firing.
1605
1606         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1607         (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime const):
1608
1609 2018-07-19  Antoine Quint  <graouts@apple.com>
1610
1611         Hitting RELEASE_ASSERT(!m_activeDOMObjectAdditionForbidden) under HTMLMediaElement::resume()
1612         https://bugs.webkit.org/show_bug.cgi?id=187793
1613         <rdar://problem/42308469>
1614
1615         Reviewed by Chris Dumez.
1616
1617         Ensure we do not call JS under resume(), which would happen as a result of calling configureMediaControls() in prepareForLoad().
1618
1619         * html/HTMLMediaElement.cpp:
1620         (WebCore::HTMLMediaElement::~HTMLMediaElement):
1621         (WebCore::HTMLMediaElement::contextDestroyed):
1622         (WebCore::HTMLMediaElement::stop):
1623         (WebCore::HTMLMediaElement::suspend):
1624         (WebCore::HTMLMediaElement::resume):
1625         * html/HTMLMediaElement.h:
1626
1627 2018-07-19  Philippe Normand  <pnormand@igalia.com>
1628
1629         [GStreamer][MSE] imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported.html crashes
1630         https://bugs.webkit.org/show_bug.cgi?id=187469
1631
1632         Reviewed by Žan Doberšek.
1633
1634         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
1635         (webKitMediaSrcFreeStream): Fix critical warning. The appsrc
1636         element is created only when a valid sourcebuffer is in use.
1637
1638 2018-07-19  Frederic Wang  <fwang@igalia.com>
1639
1640         Fix message of NotSupportedError exception thrown during custom element creation
1641         https://bugs.webkit.org/show_bug.cgi?id=187757
1642
1643         Reviewed by Yusuke Suzuki.
1644
1645         In bug 161528, some new exceptions were introduced for custom element creation [1] but the
1646         actual text has some issues. This patch fixes one typo and one wrong message.
1647
1648         [1] https://dom.spec.whatwg.org/#concept-create-element
1649
1650         Test: fast/custom-elements/exceptions-for-synchronous-custom-element-creation.html
1651
1652         * bindings/js/JSCustomElementInterface.cpp:
1653         (WebCore::constructCustomElementSynchronously):
1654
1655 2018-07-18  Jer Noble  <jer.noble@apple.com>
1656
1657         Unreviewed API Test fix; restored a line inadventantly removed in r233926.
1658
1659         * platform/mac/VideoFullscreenInterfaceMac.mm:
1660         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
1661
1662 2018-07-18  Antoine Quint  <graouts@apple.com>
1663
1664         [Web Animations] Interpolation between font-styles with a keyword value should be discrete
1665         https://bugs.webkit.org/show_bug.cgi?id=187722
1666
1667         Reviewed by Myles Maxfield.
1668
1669         Animating between "font-style: normal" or "font-style: oblique" and any another value should yield a discrete
1670         interpolation where the from-value is used from 0 and up to (but excluding) 0.5, and the to-value from 0.5 to 1.
1671
1672         In order to be able to detect the "normal" value, we make the "slope" of a FontSelectionRequest an optional type
1673         where the std::nullopt value indicates "normal" and other values an "oblique" value. Since we also need to
1674         distinguish the "italic" value from an "oblique" value, we implement a custom PropertyWrapper for the "font-style"
1675         property where we ensure the fontStyleAxis property of the font description matches the value we're blending to.
1676         Indeed, in the case where we may animate from "normal" to "italic", the fontStyleAxis on the blended style would
1677         remain "slnt" since it is the base value for "normal".
1678
1679         * accessibility/AccessibilityRenderObject.cpp:
1680         (WebCore::AccessibilityRenderObject::hasPlainText const):
1681         * css/CSSComputedStyleDeclaration.cpp:
1682         (WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
1683         * css/CSSComputedStyleDeclaration.h:
1684         * css/CSSFontFace.cpp:
1685         (WebCore::calculateItalicRange):
1686         * css/CSSFontFaceSet.cpp:
1687         (WebCore::computeFontSelectionRequest):
1688         * css/FontSelectionValueInlines.h:
1689         (WebCore::fontStyleKeyword):
1690         (WebCore::fontStyleValue): Deleted.
1691         * css/StyleBuilderConverter.h:
1692         (WebCore::StyleBuilderConverter::convertFontStyleFromValue):
1693         * page/animation/CSSPropertyAnimation.cpp:
1694         (WebCore::blendFunc):
1695         (WebCore::PropertyWrapperFontStyle::PropertyWrapperFontStyle):
1696         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
1697         * platform/graphics/FontCache.h:
1698         (WebCore::FontDescriptionKey::computeHash const):
1699         * platform/graphics/FontCascade.h:
1700         (WebCore::FontCascade::italic const):
1701         * platform/graphics/FontDescription.h:
1702         (WebCore::FontDescription::italic const):
1703         (WebCore::FontDescription::setItalic):
1704         (WebCore::FontDescription::setIsItalic):
1705         (WebCore::FontCascadeDescription::initialItalic):
1706         * platform/graphics/FontSelectionAlgorithm.cpp:
1707         (WebCore::FontSelectionAlgorithm::styleDistance const):
1708         * platform/graphics/FontSelectionAlgorithm.h:
1709         (WebCore::isItalic):
1710         (WebCore::FontSelectionRequest::tied const):
1711         (WebCore::operator<<): Implement the required stream operator.
1712         (WebCore::operator==): Mark this function as inline instead of constexpr since tied() is no longer constexpr
1713         due to taking an std::optional<>.
1714         (WebCore::operator!=):
1715         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1716         (WebCore::preparePlatformFont):
1717         * platform/graphics/win/FontCacheWin.cpp:
1718         (WebCore::FontCache::createFontPlatformData):
1719         * rendering/style/RenderStyle.cpp:
1720         (WebCore::RenderStyle::setFontItalic):
1721         * rendering/style/RenderStyle.h:
1722         (WebCore::RenderStyle::fontItalic const):
1723
1724 2018-07-18  Jer Noble  <jer.noble@apple.com>
1725
1726         Unreviewed build fix after r233926; BOOL !== bool.
1727
1728         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1729         (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const):
1730
1731 2018-07-18  Jer Noble  <jer.noble@apple.com>
1732
1733         PiP from Element Fullscreen should match AVKit's behavior
1734         https://bugs.webkit.org/show_bug.cgi?id=187623
1735
1736         Reviewed by Jon Lee.
1737
1738         PiP behavior should be defined at the WebKit2 level, and not in HTMLMediaElement:
1739
1740         * html/HTMLMediaElement.cpp:
1741         (WebCore::HTMLMediaElement::enterFullscreen):
1742
1743         Add an accessor for pictureInPictureWasStartedWhenEnteringBackground():
1744
1745         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
1746         (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const):
1747
1748         Add VideoFullscreenModelClient virutal methods for PiP change notifications:
1749
1750         * platform/cocoa/VideoFullscreenModel.h:
1751         (WebCore::VideoFullscreenModelClient::hasVideoChanged):
1752         (WebCore::VideoFullscreenModelClient::videoDimensionsChanged):
1753         (WebCore::VideoFullscreenModelClient::willEnterPictureInPicture):
1754         (WebCore::VideoFullscreenModelClient::didEnterPictureInPicture):
1755         (WebCore::VideoFullscreenModelClient::failedToEnterPictureInPicture):
1756         (WebCore::VideoFullscreenModelClient::willExitPictureInPicture):
1757         (WebCore::VideoFullscreenModelClient::didExitPictureInPicture):
1758         (WebCore::VideoFullscreenModelClient::failedToExitPictureInPicture):
1759         * platform/cocoa/VideoFullscreenModelVideoElement.h:
1760         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
1761         (VideoFullscreenModelVideoElement::willEnterPictureInPicture):
1762         (VideoFullscreenModelVideoElement::didEnterPictureInPicture):
1763         (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture):
1764         (VideoFullscreenModelVideoElement::willExitPictureInPicture):
1765         (VideoFullscreenModelVideoElement::didExitPictureInPicture):
1766         (VideoFullscreenModelVideoElement::failedToExitPictureInPicture):
1767         * platform/ios/VideoFullscreenInterfaceAVKit.h:
1768         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1769         (-[WebAVPlayerLayer layoutSublayers]):
1770         (-[WebAVPlayerLayer resolveBounds]):
1771         (-[WebAVPlayerLayer setVideoGravity:]):
1772         (VideoFullscreenInterfaceAVKit::setupFullscreen):
1773         (VideoFullscreenInterfaceAVKit::presentingViewController):
1774         (VideoFullscreenInterfaceAVKit::willStartPictureInPicture):
1775         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
1776         (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture):
1777         (VideoFullscreenInterfaceAVKit::willStopPictureInPicture):
1778         (VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
1779         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
1780         (VideoFullscreenInterfaceAVKit::doSetup):
1781         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1782         (VideoFullscreenControllerContext::willEnterPictureInPicture):
1783         (VideoFullscreenControllerContext::didEnterPictureInPicture):
1784         (VideoFullscreenControllerContext::failedToEnterPictureInPicture):
1785         (VideoFullscreenControllerContext::willExitPictureInPicture):
1786         (VideoFullscreenControllerContext::didExitPictureInPicture):
1787         (VideoFullscreenControllerContext::failedToExitPictureInPicture):
1788         * platform/mac/VideoFullscreenInterfaceMac.h:
1789         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Deleted.
1790         * platform/mac/VideoFullscreenInterfaceMac.mm:
1791         (-[WebVideoFullscreenInterfaceMacObjC invalidateFullscreenState]):
1792         (-[WebVideoFullscreenInterfaceMacObjC exitPIP]):
1793         (-[WebVideoFullscreenInterfaceMacObjC exitPIPAnimatingToRect:inWindow:]):
1794         (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]):
1795         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
1796         (WebCore::VideoFullscreenInterfaceMac::enterFullscreen):
1797         (WebCore::VideoFullscreenInterfaceMac::exitFullscreen):
1798         (WebCore::VideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode):
1799         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen):
1800
1801 2018-07-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1802
1803         [Curl] Disable CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST specified by setAllowsAnyHTTPSCertificate.
1804         https://bugs.webkit.org/show_bug.cgi?id=187611
1805
1806         Reviewed by Fujii Hironori.
1807
1808         Current interface for TLS certificate validation for Curl port are as follows:
1809
1810         - WEBCORE_EXPORT void setHostAllowsAnyHTTPSCertificate(const String&);
1811         - bool isAllowedHTTPSCertificateHost(const String&);
1812         - bool canIgnoredHTTPSCertificate(const String&, const Vector<CertificateInfo::Certificate>&);
1813
1814         First one registers a host to be ignored for any certificate check. Once it is registered, no
1815         further certificate validation check is executed.
1816         Second one checks the host is registered in the list above.
1817         Third one is weird. The method signature implies it checks the certificate for the host and detect
1818         whether we can ignore this certificate for the host, but actually it  just check only the host and
1819         register the certificate into the vector. Then in the next request for the host, the certificate
1820         will be checked with the previously stored certificate.
1821
1822         It's hard to understand, but in short,
1823         - We can register a host as an exception for any TLS certificate validation.
1824         - But only certificate arrived first is ignored, not any certificates for the host
1825           (which is rare, but possible for mis configured web cluster).
1826
1827         This behavior is incomplete. To ignore any certificates of the host, these two methods are enough:
1828
1829         - void allowAnyHTTPSCertificatesForHost(const String&)
1830         - bool canIgnoreAnyHTTPSCertificatesForHost(const String&)
1831
1832         No new tests. Covered by existing tests.
1833
1834         * platform/network/curl/CertificateInfo.h:
1835         * platform/network/curl/CurlContext.cpp:
1836         (WebCore::CurlHandle::enableSSLForHost): Ignore TLS verification for registered host.
1837         * platform/network/curl/CurlSSLHandle.cpp:
1838         (WebCore::CurlSSLHandle::allowAnyHTTPSCertificatesForHost): Added.
1839         (WebCore::CurlSSLHandle::canIgnoreAnyHTTPSCertificatesForHost const): Ditto.
1840         (WebCore::CurlSSLHandle::setClientCertificateInfo): Separate lock.
1841         (WebCore::CurlSSLHandle::getSSLClientCertificate const): Ditto and add const.
1842         (WebCore::CurlSSLHandle::setHostAllowsAnyHTTPSCertificate): Deleted.
1843         (WebCore::CurlSSLHandle::isAllowedHTTPSCertificateHost): Deleted.
1844         (WebCore::CurlSSLHandle::canIgnoredHTTPSCertificate): Deleted.
1845         (WebCore::CurlSSLHandle::getSSLClientCertificate): Deleted.
1846         * platform/network/curl/CurlSSLHandle.h:
1847         * platform/network/curl/CurlSSLVerifier.cpp:
1848         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
1849         (WebCore::CurlSSLVerifier::collectInfo): Renamed from verify.
1850         (WebCore::CurlSSLVerifier::verifyCallback):
1851         (WebCore::CurlSSLVerifier::verify): Renamed to collectInfo.
1852         * platform/network/curl/CurlSSLVerifier.h:
1853         * platform/network/curl/ResourceHandleCurl.cpp:
1854         (WebCore::ResourceHandle::setHostAllowsAnyHTTPSCertificate): Rename calling method.
1855
1856 2018-07-18  Myles C. Maxfield  <mmaxfield@apple.com>
1857
1858         Rename WordBreak::Break to WordBreak::BreakWord
1859         https://bugs.webkit.org/show_bug.cgi?id=187767
1860
1861         Reviewed by Simon Fraser.
1862
1863         These breaking properties are very confusing. There are:
1864
1865         1. word-break: break-all, a standard value that allows breaking after every
1866         character.
1867         2. word-break: break-word, a non-standard value which allows for breaking after
1868         every character, but only if the word is too long for the available width (otherwise
1869         it works the same as word-break: normal). This affects the min-content-size of the
1870         text (and makes it equal to what it would be if word-break: break-all was
1871         specified).
1872         3. word-wrap: break-word, which is the same as word-break: break-word, but doesn't
1873         affect the min-content-size of the text.
1874         4. overflow-wrap: break-word, which is the same as word-wrap: break-word.
1875
1876         Because this is so confusing it's valuable for our internal enums to match the names
1877         of the official CSS properties/values.
1878
1879         No new tests because there is no behavior change.
1880
1881         * css/CSSPrimitiveValueMappings.h:
1882         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1883         (WebCore::CSSPrimitiveValue::operator WordBreak const):
1884         * rendering/RenderText.cpp:
1885         (WebCore::RenderText::computePreferredLogicalWidths):
1886         * rendering/style/RenderStyle.h:
1887         (WebCore::RenderStyle::breakWords const):
1888         * rendering/style/RenderStyleConstants.h:
1889
1890 2018-07-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1891
1892         Add SPI to defer running async script until after document load
1893         https://bugs.webkit.org/show_bug.cgi?id=187748
1894         <rdar://problem/42317378>
1895
1896         Reviewed by Ryosuke Niwa and Tim Horton.
1897
1898         On watchOS, we currently observe that time-consuming async scripts can block the first paint of Reader, leaving
1899         the user with a blank screen for tens of seconds. One way to mitigate this is to defer async script execution
1900         until after document load (i.e. the same timing as DOMContentLoaded).
1901
1902         This patch introduces an SPI configuration allowing internal clients to defer execution of asynchronous script
1903         until after document load; this, in combination with the parser yielding token introduced in r233891, allows
1904         Safari on watchOS to avoid being blocked on slow script execution before the first paint of the Reader page on
1905         most article-like pages. See below for more details.
1906
1907         Test: RunScriptAfterDocumentLoad.ExecutionOrderOfScriptsInDocument
1908
1909         * dom/Document.cpp:
1910         (WebCore::Document::shouldDeferAsynchronousScriptsUntilParsingFinishes const):
1911         (WebCore::Document::finishedParsing):
1912
1913         Notify ScriptRunner when the Document has finished parsing, and is about to fire DOMContentLoaded.
1914
1915         * dom/Document.h:
1916         * dom/ScriptRunner.cpp:
1917         (WebCore::ScriptRunner::documentFinishedParsing):
1918
1919         When the document is finished parsing, kick off the script execution timer if needed to run any async script
1920         that has been deferred.
1921
1922         (WebCore::ScriptRunner::notifyFinished):
1923         (WebCore::ScriptRunner::timerFired):
1924
1925         Instead of always taking from the list of async scripts to execute, check our document to see whether we should
1926         defer this until after document load. If so, ignore `m_scriptsToExecuteSoon`.
1927
1928         * dom/ScriptRunner.h:
1929         * page/Settings.yaml:
1930
1931         Add a WebCore setting for this behavior.
1932
1933 2018-07-18  Zan Dobersek  <zdobersek@igalia.com>
1934
1935         [Nicosia] Add debug border, repaint counter state tracking to Nicosia::CompositionLayer
1936         https://bugs.webkit.org/show_bug.cgi?id=187749
1937
1938         Reviewed by Carlos Garcia Campos.
1939
1940         Add the RepaintCounter and DebugBorder structs to
1941         Nicosia::CompositionLayer::LayerState, tracking visibility as well as
1942         repaint count or debug color and width.
1943
1944         Instances of RepaintCounter and DebugBorder types are kept in each
1945         CoordinatedGraphicsLayer object, updating the relevant data as it is
1946         changed (since the GraphicsLayer object isn't tracking these values on
1947         its own). During layer flush these values (if changed) are then copied
1948         over into the CompositionLayer state.
1949
1950         * platform/graphics/nicosia/NicosiaPlatformLayer.cpp:
1951         Also fix the year in the license header.
1952         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
1953         Also fix the year in the license header.
1954         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1955         (WebCore::CoordinatedGraphicsLayer::didUpdateTileBuffers):
1956         (WebCore::CoordinatedGraphicsLayer::setShowDebugBorder):
1957         (WebCore::CoordinatedGraphicsLayer::setShowRepaintCounter):
1958         (WebCore::CoordinatedGraphicsLayer::setDebugBorder):
1959         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
1960         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1961
1962 2018-07-18  Zan Dobersek  <zdobersek@igalia.com>
1963
1964         [CoordGraphics] Start tracking Nicosia layers in CoordinatedGraphicsState
1965         https://bugs.webkit.org/show_bug.cgi?id=187751
1966
1967         Reviewed by Carlos Garcia Campos.
1968
1969         Start including the Nicosia::CompositionLayer objects in the
1970         CoordinatedGraphicsState struct, under a separate NicosiaState struct.
1971         References to all the layers in a given scene are kept in a HashSet,
1972         and a separate reference to the root layer kept in a separate member
1973         variable.
1974
1975         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1976         (WebCore::CoordinatedGraphicsLayer::compositionLayer const):
1977         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1978         Add the getter method that returns internal Nicosia::CompositionLayer
1979         object. This can't be defined in the class definition because of
1980         WEBCORE_EXPORT used on the CoordinatedGraphicsLayer class.
1981         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
1982
1983 2018-07-18  Simon Fraser  <simon.fraser@apple.com>
1984
1985         Shrink CompositeAnimation and AnimationBase
1986         https://bugs.webkit.org/show_bug.cgi?id=187683
1987
1988         Reviewed by Daniel Bates.
1989
1990         Reduce the size of CompositeAnimation and AnimationBase.
1991
1992         * page/animation/AnimationBase.h:
1993         * page/animation/CompositeAnimation.h:
1994
1995 2018-07-17  Antoine Quint  <graouts@apple.com>
1996
1997         Ensure timingFunctionForKeyframeAtIndex() can be used from setAnimatedPropertiesInStyle().
1998         https://bugs.webkit.org/show_bug.cgi?id=187637
1999         <rdar://problem/42157915>
2000
2001         Reviewed by Dean Jackson.
2002
2003         Test: webanimations/empty-keyframes-crash.html
2004
2005         Unlike what we assumed, it is possible to have a non-declarative animation without any parsed keyframes.
2006         This can happen as a result of calling `Element.animate({}, …)`. In this case, we want to return a null
2007         value in timingFunctionForKeyframeAtIndex() so we update the call site in setAnimatedPropertiesInStyle()
2008         which is the only place where we didn't check for a null value and didn't know for sure that there would
2009         be parsed keyframes to rely on in the case of a WebAnimation instance.
2010
2011         * animation/KeyframeEffectReadOnly.cpp:
2012         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle):
2013         (WebCore::KeyframeEffectReadOnly::timingFunctionForKeyframeAtIndex):
2014
2015 2018-07-15  Jiewen Tan  <jiewen_tan@apple.com>
2016
2017         [WebCrypto] Crypto operations should copy their parameters before hoping to another thread
2018         https://bugs.webkit.org/show_bug.cgi?id=187501
2019         <rdar://problem/41438160>
2020
2021         Reviewed by Youenn Fablet.
2022
2023         This patch aims at making all captured variables in all crypto lambdas that need to be passed
2024         to a worker thread thread safe, which includes:
2025         1) changing ref counted objects to thread safe ref counted object.
2026         2) adding isolatedCopy methods to non ref counted classes, so they can be called by CrossThreadCopy().
2027
2028         In addition to above changes, this patch also does the following things:
2029         1) change the name CryptoAlgorithm::dispatchOperation => CryptoAlgorithm::dispatchOperationInWorkQueue
2030         to make it clear that lambdas will be passed to a secondary thread.
2031         2) make CryptoAlgorithmParameters as const parameters for all methods.
2032         3) add null checks on BufferSource.length() and .data().
2033
2034         Tests: crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html
2035                http/wpt/crypto/aes-cbc-crash.any.html
2036                http/wpt/crypto/aes-cbc-crash.any.worker.html
2037                http/wpt/crypto/aes-ctr-crash.any.html
2038                http/wpt/crypto/aes-ctr-crash.any.worker.html
2039                http/wpt/crypto/aes-gcm-crash.any.html
2040                http/wpt/crypto/aes-gcm-crash.any.worker.html
2041                http/wpt/crypto/derive-hmac-key-crash.any.html
2042                http/wpt/crypto/derive-hmac-key-crash.any.worker.html
2043                http/wpt/crypto/ecdsa-crash.any.html
2044                http/wpt/crypto/ecdsa-crash.any.worker.html
2045                http/wpt/crypto/hkdf-crash.any.html
2046                http/wpt/crypto/hkdf-crash.any.worker.html
2047                http/wpt/crypto/pbkdf2-crash.any.html
2048                http/wpt/crypto/pbkdf2-crash.any.worker.html
2049                http/wpt/crypto/rsa-oaep-crash.any.html
2050                http/wpt/crypto/rsa-oaep-crash.any.worker.html
2051                http/wpt/crypto/rsa-pss-crash.any.html
2052                http/wpt/crypto/rsa-pss-crash.any.worker.html
2053                http/wpt/crypto/unwrap-ec-key-crash.any.html
2054                http/wpt/crypto/unwrap-ec-key-crash.any.worker.html
2055                http/wpt/crypto/unwrap-rsa-key-crash.any.html
2056                http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html
2057
2058         * bindings/js/BufferSource.h:
2059         (WebCore::BufferSource::data const):
2060         (WebCore::BufferSource::length const):
2061         * crypto/CryptoAlgorithm.cpp:
2062         (WebCore::CryptoAlgorithm::encrypt):
2063         (WebCore::CryptoAlgorithm::decrypt):
2064         (WebCore::CryptoAlgorithm::sign):
2065         (WebCore::CryptoAlgorithm::verify):
2066         (WebCore::CryptoAlgorithm::deriveBits):
2067         (WebCore::CryptoAlgorithm::importKey):
2068         (WebCore::dispatchAlgorithmOperation):
2069         (WebCore::CryptoAlgorithm::dispatchOperationInWorkQueue):
2070         (WebCore::CryptoAlgorithm::dispatchOperation): Deleted.
2071         * crypto/CryptoAlgorithm.h:
2072         * crypto/SubtleCrypto.cpp:
2073         (WebCore::crossThreadCopyImportParams):
2074         (WebCore::SubtleCrypto::encrypt):
2075         (WebCore::SubtleCrypto::decrypt):
2076         (WebCore::SubtleCrypto::sign):
2077         (WebCore::SubtleCrypto::verify):
2078         (WebCore::SubtleCrypto::deriveKey):
2079         (WebCore::SubtleCrypto::deriveBits):
2080         (WebCore::SubtleCrypto::importKey):
2081         (WebCore::SubtleCrypto::wrapKey):
2082         (WebCore::SubtleCrypto::unwrapKey):
2083         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
2084         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
2085         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
2086         (WebCore::CryptoAlgorithmAES_CBC::importKey):
2087         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
2088         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
2089         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
2090         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
2091         (WebCore::CryptoAlgorithmAES_CFB::importKey):
2092         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
2093         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
2094         (WebCore::parametersAreValid):
2095         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
2096         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
2097         (WebCore::CryptoAlgorithmAES_CTR::importKey):
2098         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
2099         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
2100         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
2101         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
2102         (WebCore::CryptoAlgorithmAES_GCM::importKey):
2103         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
2104         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
2105         (WebCore::CryptoAlgorithmAES_KW::importKey):
2106         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
2107         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
2108         (WebCore::CryptoAlgorithmECDH::deriveBits):
2109         (WebCore::CryptoAlgorithmECDH::importKey):
2110         * crypto/algorithms/CryptoAlgorithmECDH.h:
2111         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
2112         (WebCore::CryptoAlgorithmECDSA::sign):
2113         (WebCore::CryptoAlgorithmECDSA::verify):
2114         (WebCore::CryptoAlgorithmECDSA::importKey):
2115         * crypto/algorithms/CryptoAlgorithmECDSA.h:
2116         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
2117         (WebCore::CryptoAlgorithmHKDF::deriveBits):
2118         (WebCore::CryptoAlgorithmHKDF::importKey):
2119         * crypto/algorithms/CryptoAlgorithmHKDF.h:
2120         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
2121         (WebCore::CryptoAlgorithmHMAC::sign):
2122         (WebCore::CryptoAlgorithmHMAC::verify):
2123         (WebCore::CryptoAlgorithmHMAC::importKey):
2124         * crypto/algorithms/CryptoAlgorithmHMAC.h:
2125         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
2126         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
2127         (WebCore::CryptoAlgorithmPBKDF2::importKey):
2128         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
2129         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
2130         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
2131         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
2132         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
2133         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
2134         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2135         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
2136         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
2137         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
2138         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
2139         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
2140         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
2141         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
2142         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
2143         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
2144         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
2145         (WebCore::CryptoAlgorithmRSA_PSS::sign):
2146         (WebCore::CryptoAlgorithmRSA_PSS::verify):
2147         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
2148         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
2149         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
2150         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2151         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2152         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
2153         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2154         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2155         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
2156         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2157         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2158         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
2159         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2160         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2161         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
2162         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
2163         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
2164         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2165         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
2166         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2167         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2168         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
2169         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2170         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2171         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
2172         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2173         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2174         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
2175         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2176         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2177         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
2178         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2179         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2180         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
2181         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2182         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2183         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
2184         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
2185         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
2186         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2187         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
2188         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2189         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2190         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
2191         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2192         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2193         * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h:
2194         * crypto/parameters/CryptoAlgorithmAesCtrParams.h:
2195         * crypto/parameters/CryptoAlgorithmAesGcmParams.h:
2196         * crypto/parameters/CryptoAlgorithmEcKeyParams.h:
2197         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
2198         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
2199         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
2200         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
2201         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
2202         * crypto/parameters/CryptoAlgorithmRsaOaepParams.h:
2203         * crypto/parameters/CryptoAlgorithmRsaPssParams.h:
2204
2205 2018-07-17  Antoine Quint  <graouts@apple.com>
2206
2207         [Web Animations] Interpolation between lengths with an "auto" value should be discrete
2208         https://bugs.webkit.org/show_bug.cgi?id=187721
2209
2210         Reviewed by Dean Jackson.
2211
2212         When interpolating between two Length values, if one is "auto", we should use the from-value
2213         from 0 and up to (but excluding) 0.5, and use the to-value from 0.5 to 1.
2214
2215         This change caused a regression in the legacy animation engine since it would create a CSS
2216         transition even when the underlying and target values were non-interpolable. As such, the
2217         underlying value would be used until the transition's mid-point and the tests at 
2218         legacy-animation-engine/imported/blink/transitions/transition-not-interpolable.html and
2219         legacy-animation-engine/fast/animation/height-auto-transition-computed-value.html would fail
2220         expecting the target value to be used immediately. We now ensure that no transition is actually
2221         started if two values for a given property cannot be interpolated.
2222
2223         * page/animation/CompositeAnimation.cpp:
2224         (WebCore::CompositeAnimation::updateTransitions):
2225         * platform/Length.cpp:
2226         (WebCore::blend):
2227
2228 2018-07-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2229
2230         Add an SPI hook to allow clients to yield document parsing and script execution
2231         https://bugs.webkit.org/show_bug.cgi?id=187682
2232         <rdar://problem/42207453>
2233
2234         Reviewed by Ryosuke Niwa.
2235
2236         Using a single web process for both the Reader page and original web page on watchOS has multiple benefits,
2237         including: (1) allowing the user to bail out of Reader and view the original web page without having to load it
2238         again, and (2) improving the bringup time of the Reader page, since subresources are already cached in process
2239         and we don't eat the additional cost of a web process launch if prewarming fails.
2240
2241         However, this has some drawbacks as well, one of which is that main thread work being done on behalf of the
2242         original page may contend with work being done to load and render the Reader page. This is especially bad when
2243         the page is in the middle of executing heavy script after Safari has already detected that the Reader version of
2244         the page is available, but before it has finished loading the Reader page. The result is that script on the
2245         original page may block the first paint of the Reader page (on New York Times articles, this often leads to an
2246         apparent page load time of 25-35 seconds before the user sees anything besides a blank screen).
2247
2248         To mitigate this, we introduce a way for injected bundle clients to yield parsing and async script execution on
2249         a document. This capability is surfaced in the form of an opaque token which clients may request from a
2250         WKDOMDocument. Construction of the token causes the document to begin yielding and defer execution of previously
2251         scheduled scripts, only if there were no active tokens on the document already. Similarly, destruction of all
2252         active tokens on the document causes it to stop yielding and resume execution of scripts if needed.
2253
2254         Tests:  ParserYieldTokenTests.PreventDocumentLoadByTakingParserYieldToken
2255                 ParserYieldTokenTests.TakeMultipleParserYieldTokens
2256                 ParserYieldTokenTests.DeferredScriptExecutesBeforeDocumentLoadWhenTakingParserYieldToken
2257                 ParserYieldTokenTests.AsyncScriptRunsWhenFetched
2258
2259         * dom/Document.cpp:
2260         (WebCore::Document::implicitOpen):
2261
2262         If the parser yield token was taken before the document's parser was created, tell the parser's scheduler to
2263         start yielding immediately after creation.
2264
2265         (WebCore::DocumentParserYieldToken::DocumentParserYieldToken):
2266         (WebCore::DocumentParserYieldToken::~DocumentParserYieldToken):
2267         * dom/Document.h:
2268
2269         Introduce a parser yield count to Document; as long as this count is greater than 0, we consider the Document to
2270         have active yield tokens. When constructing or destroying a ParserYieldToken, we increment and decrement the
2271         parser yield count (respectively).
2272
2273         (WebCore::Document::createParserYieldToken):
2274         (WebCore::Document::hasActiveParserYieldToken const):
2275         * dom/DocumentParser.h:
2276         (WebCore::DocumentParser::didBeginYieldingParser):
2277         (WebCore::DocumentParser::didEndYieldingParser):
2278
2279         Hooks for Document to tell its parser that we've started or finished yielding. This updates a flag on the
2280         parser's scheduler which is consulted when we determine whether to yield before a pumping token or executing
2281         script.
2282
2283         * dom/ScriptRunner.cpp:
2284         (WebCore::ScriptRunner::resume):
2285         (WebCore::ScriptRunner::notifyFinished):
2286         * dom/ScriptRunner.h:
2287         (WebCore::ScriptRunner::didBeginYieldingParser):
2288         (WebCore::ScriptRunner::didEndYieldingParser):
2289
2290         Hooks for Document to tell its ScriptRunner that we've started or finished yielding. These wrap calls to suspend
2291         and resume.
2292
2293         * html/parser/HTMLDocumentParser.cpp:
2294         (WebCore::HTMLDocumentParser::didBeginYieldingParser):
2295         (WebCore::HTMLDocumentParser::didEndYieldingParser):
2296
2297         Plumb to didBegin/didEnd calls to the HTMLParserScheduler.
2298
2299         * html/parser/HTMLDocumentParser.h:
2300         * html/parser/HTMLParserScheduler.cpp:
2301         (WebCore::HTMLParserScheduler::shouldYieldBeforeExecutingScript):
2302         * html/parser/HTMLParserScheduler.h:
2303         (WebCore::HTMLParserScheduler::shouldYieldBeforeToken):
2304
2305         Consult a flag when determining whether to yield. This flag is set to true only while the document has an active
2306         parser yield token.
2307
2308         (WebCore::HTMLParserScheduler::isScheduledForResume const):
2309
2310         Consider the parser scheduler to be scheduled for resume if there are active tokens. Without this change, we
2311         incorrectly consider the document to be finished loading when we have yield tokens, since it appears that the
2312         parser is no longer scheduled to pump its tokenizer.
2313
2314         (WebCore::HTMLParserScheduler::didBeginYieldingParser):
2315         (WebCore::HTMLParserScheduler::didEndYieldingParser):
2316
2317         When the Document begins yielding due to the documet having active tokens or ends yielding after the document
2318         loses all of its yield tokens, update a flag on the parser scheduler. After we finish yielding, additionally
2319         reschedule the parser if needed to ensure that we continue parsing the document; without this additional change
2320         to resume, we'll never get the document load or load events after relinquishing the yield token.
2321
2322 2018-07-17  Dirk Schulze  <krit@webkit.org>
2323
2324         [clip-path] Implement support for margin-box as reference box and box shape
2325         https://bugs.webkit.org/show_bug.cgi?id=127984
2326
2327         Reviewed by Simon Fraser.
2328
2329         Compute the margin-box rectangle as needed for clip-path based on the actual
2330         computed values for the margin-top, *-left, *-bottom, *-right properties.
2331
2332         Test: css3/masking/clip-path-margin-box.html
2333
2334         * rendering/RenderBox.h:
2335         (WebCore::RenderBox::marginBoxRect const):
2336         * rendering/RenderBoxModelObject.h:
2337         * rendering/RenderLayer.cpp:
2338         (WebCore::computeReferenceBox):
2339
2340 2018-07-17  Javier Fernandez  <jfernandez@igalia.com>
2341
2342         Delete content of a single cell table should not delete the whole table
2343         https://bugs.webkit.org/show_bug.cgi?id=173117
2344
2345         Reviewed by Ryosuke Niwa.
2346
2347         We should not extend selection looking for special elements if the
2348         delete operation has been triggered by a caret based selection.
2349
2350         This change is based on a recent [1] resolution of the Editing TF,
2351         which acknowledges that behavior of single-cell tables must be the
2352         same that multi-cell tables and even if the last character is
2353         deleted, we should not delete the whole table structure.
2354
2355         A different case would be when the user actively selects the whole
2356         content of a table; in this case, as we do in multi-cell tables,
2357         the structure of single-cell tables should be deleted together
2358         with the content.
2359
2360         [1] https://github.com/w3c/editing/issues/163
2361
2362         Tests: editing/deleting/backspace-delete-last-char-in-table.html
2363                editing/deleting/forward-delete-last-char-in-table.html
2364                editing/deleting/select-and-delete-last-char-in-table.html
2365
2366         * editing/TypingCommand.cpp:
2367         (WebCore::TypingCommand::deleteKeyPressed):
2368         (WebCore::TypingCommand::forwardDeleteKeyPressed):
2369
2370 2018-07-16  Megan Gardner  <megan_gardner@apple.com>
2371
2372         Correctly adjust scroll offsets when a page is zoomed
2373         https://bugs.webkit.org/show_bug.cgi?id=187673
2374         <rdar://problem/41712829>
2375
2376         Reviewed by Wenson Hsieh.
2377
2378         Will add test later.
2379
2380         Make sure that distance is scaled by the pageScaleFactor, to 
2381         make sure that we scroll correctly when we are zoomed in.
2382
2383         * page/ios/EventHandlerIOS.mm:
2384         (WebCore::autoscrollAdjustmentFactorForScreenBoundaries):
2385         
2386 2018-07-16  Simon Fraser  <simon.fraser@apple.com>
2387
2388         Roll out r233873 and r233875 since they caused 8 new layout test crashes.
2389
2390         * crypto/CryptoAlgorithm.cpp:
2391         (WebCore::CryptoAlgorithm::encrypt):
2392         (WebCore::CryptoAlgorithm::decrypt):
2393         (WebCore::CryptoAlgorithm::sign):
2394         (WebCore::CryptoAlgorithm::verify):
2395         (WebCore::CryptoAlgorithm::deriveBits):
2396         (WebCore::CryptoAlgorithm::importKey):
2397         (WebCore::dispatchAlgorithmOperation):
2398         (WebCore::CryptoAlgorithm::dispatchOperation):
2399         (WebCore::CryptoAlgorithm::dispatchOperationInWorkQueue): Deleted.
2400         * crypto/CryptoAlgorithm.h:
2401         * crypto/SubtleCrypto.cpp:
2402         (WebCore::SubtleCrypto::encrypt):
2403         (WebCore::SubtleCrypto::decrypt):
2404         (WebCore::SubtleCrypto::sign):
2405         (WebCore::SubtleCrypto::verify):
2406         (WebCore::SubtleCrypto::deriveKey):
2407         (WebCore::SubtleCrypto::deriveBits):
2408         (WebCore::SubtleCrypto::importKey):
2409         (WebCore::SubtleCrypto::wrapKey):
2410         (WebCore::SubtleCrypto::unwrapKey):
2411         (WebCore::crossThreadCopyImportParams): Deleted.
2412         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
2413         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
2414         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
2415         (WebCore::CryptoAlgorithmAES_CBC::importKey):
2416         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
2417         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
2418         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
2419         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
2420         (WebCore::CryptoAlgorithmAES_CFB::importKey):
2421         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
2422         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
2423         (WebCore::parametersAreValid):
2424         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
2425         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
2426         (WebCore::CryptoAlgorithmAES_CTR::importKey):
2427         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
2428         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
2429         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
2430         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
2431         (WebCore::CryptoAlgorithmAES_GCM::importKey):
2432         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
2433         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
2434         (WebCore::CryptoAlgorithmAES_KW::importKey):
2435         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
2436         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
2437         (WebCore::CryptoAlgorithmECDH::deriveBits):
2438         (WebCore::CryptoAlgorithmECDH::importKey):
2439         * crypto/algorithms/CryptoAlgorithmECDH.h:
2440         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
2441         (WebCore::CryptoAlgorithmECDSA::sign):
2442         (WebCore::CryptoAlgorithmECDSA::verify):
2443         (WebCore::CryptoAlgorithmECDSA::importKey):
2444         * crypto/algorithms/CryptoAlgorithmECDSA.h:
2445         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
2446         (WebCore::CryptoAlgorithmHKDF::deriveBits):
2447         (WebCore::CryptoAlgorithmHKDF::importKey):
2448         * crypto/algorithms/CryptoAlgorithmHKDF.h:
2449         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
2450         (WebCore::CryptoAlgorithmHMAC::sign):
2451         (WebCore::CryptoAlgorithmHMAC::verify):
2452         (WebCore::CryptoAlgorithmHMAC::importKey):
2453         * crypto/algorithms/CryptoAlgorithmHMAC.h:
2454         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
2455         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
2456         (WebCore::CryptoAlgorithmPBKDF2::importKey):
2457         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
2458         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
2459         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
2460         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
2461         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
2462         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
2463         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2464         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
2465         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
2466         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
2467         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
2468         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
2469         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
2470         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
2471         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
2472         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
2473         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
2474         (WebCore::CryptoAlgorithmRSA_PSS::sign):
2475         (WebCore::CryptoAlgorithmRSA_PSS::verify):
2476         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
2477         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
2478         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
2479         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2480         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2481         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
2482         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2483         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2484         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
2485         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2486         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2487         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
2488         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2489         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2490         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
2491         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
2492         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
2493         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2494         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
2495         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2496         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2497         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
2498         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2499         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2500         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
2501         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2502         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2503         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
2504         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2505         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2506         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
2507         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2508         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2509         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
2510         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2511         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2512         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
2513         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
2514         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
2515         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2516         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
2517         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2518         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2519         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
2520         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2521         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2522         * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h:
2523         * crypto/parameters/CryptoAlgorithmAesCtrParams.h:
2524         * crypto/parameters/CryptoAlgorithmAesGcmParams.h:
2525         * crypto/parameters/CryptoAlgorithmEcKeyParams.h:
2526         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
2527         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
2528         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
2529         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
2530         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
2531         * crypto/parameters/CryptoAlgorithmRsaOaepParams.h:
2532         * crypto/parameters/CryptoAlgorithmRsaPssParams.h:
2533
2534 2018-07-16  Ryosuke Niwa  <rniwa@webkit.org>
2535
2536         Release assert in ~TimerBase is getting hit in WK1 apps which uses JSC API directly
2537         https://bugs.webkit.org/show_bug.cgi?id=187713
2538         <rdar://problem/41759548>
2539
2540         Reviewed by Simon Fraser.
2541
2542         Turn this into a debug assertion in WebKit1 on iOS since JSC API doesn't grab the web thread lock,
2543         which means that Timer can get destroyed without the web thread lock in the main thread.
2544
2545         * platform/Timer.cpp:
2546         (WebCore::TimerBase::~TimerBase):
2547         (WebCore::TimerBase::setNextFireTime):
2548
2549 2018-07-16  Simon Fraser  <simon.fraser@apple.com>
2550
2551         Add color filter for transforming colors in Dark Mode
2552         https://bugs.webkit.org/show_bug.cgi?id=187717
2553         rdar://problem/41146650
2554
2555         Reviewed by Dean Jackson.
2556         
2557         Add a new filter function for use in -apple-color-filter for transforming colors
2558         when in Dark Mode. The filter is called apple-invert-lightness(), and takes no parameters.
2559         It's based on a lightness invert in HSL space, with some adjustments to improve the contrast
2560         of some colors on dark backgrounds, so does a much better job that using invert() with hue-rotate().
2561
2562         Test: css3/color-filters/color-filter-apple-invert-lightness.html
2563
2564         * css/CSSComputedStyleDeclaration.cpp:
2565         (WebCore::ComputedStyleExtractor::valueForFilter):
2566         * css/CSSValueKeywords.in:
2567         * css/StyleResolver.cpp:
2568         (WebCore::filterOperationForType):
2569         (WebCore::StyleResolver::createFilterOperations):
2570         * css/parser/CSSPropertyParser.cpp:
2571         (WebCore::CSSPropertyParser::parseSingleValue):
2572         * css/parser/CSSPropertyParserHelpers.cpp:
2573         (WebCore::CSSPropertyParserHelpers::consumeFilterImage):
2574         (WebCore::CSSPropertyParserHelpers::isPixelFilterFunction):
2575         (WebCore::CSSPropertyParserHelpers::isColorFilterFunction):
2576         (WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
2577         (WebCore::CSSPropertyParserHelpers::consumeFilter):
2578         (WebCore::CSSPropertyParserHelpers::isValidPrimitiveFilterFunction): Deleted.
2579         * css/parser/CSSPropertyParserHelpers.h:
2580         * page/FrameView.cpp:
2581         (WebCore::FrameView::paintContents):
2582         * platform/graphics/Color.cpp:
2583         * platform/graphics/ColorUtilities.cpp:
2584         (WebCore::sRGBToLinearComponents):
2585         (WebCore::linearToSRGBComponents):
2586         (WebCore::sRGBToLinearColorComponentForLuminance):
2587         (WebCore::luminance):
2588         (WebCore::sRGBToHSL):
2589         (WebCore::calcHue):
2590         (WebCore::HSLToSRGB):
2591         (WebCore::ColorMatrix::ColorMatrix):
2592         * platform/graphics/ColorUtilities.h:
2593         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
2594         (PlatformCAFilters::filterValueForOperation):
2595         (PlatformCAFilters::colorMatrixValueForFilter):
2596         * platform/graphics/filters/FEColorMatrix.cpp:
2597         * platform/graphics/filters/FilterOperation.cpp:
2598         (WebCore::InvertLightnessFilterOperation::operator== const):
2599         (WebCore::InvertLightnessFilterOperation::blend):
2600         (WebCore::InvertLightnessFilterOperation::transformColor const):
2601         (WebCore::operator<<):
2602         * platform/graphics/filters/FilterOperation.h:
2603         * rendering/FilterEffectRenderer.cpp:
2604         (WebCore::FilterEffectRenderer::build):
2605
2606 2018-07-16  Jiewen Tan  <jiewen_tan@apple.com>
2607
2608         Unreviewed, build fix for r233873.
2609
2610         * crypto/SubtleCrypto.cpp:
2611         (WebCore::crossThreadCopyImportParams):
2612
2613 2018-07-15  Jiewen Tan  <jiewen_tan@apple.com>
2614
2615         [WebCrypto] Crypto operations should copy their parameters before hoping to another thread
2616         https://bugs.webkit.org/show_bug.cgi?id=187501
2617         <rdar://problem/41438160>
2618
2619         Reviewed by Youenn Fablet.
2620
2621         This patch aims at making all captured variables in all crypto lambdas that need to be passed
2622         to a worker thread thread safe, which includes:
2623         1) changing ref counted objects to thread safe ref counted object.
2624         2) adding isolatedCopy methods to non ref counted classes, so they can be called by CrossThreadCopy().
2625
2626         In addition to above changes, this patch also does the following things:
2627         1) change the name CryptoAlgorithm::dispatchOperation => CryptoAlgorithm::dispatchOperationInWorkQueue
2628         to make it clear that lambdas will be passed to a secondary thread.
2629         2) make CryptoAlgorithmParameters as const parameters for all methods.
2630
2631         Tests: crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html
2632                http/wpt/crypto/aes-cbc-crash.any.html
2633                http/wpt/crypto/aes-cbc-crash.any.worker.html
2634                http/wpt/crypto/aes-ctr-crash.any.html
2635                http/wpt/crypto/aes-ctr-crash.any.worker.html
2636                http/wpt/crypto/aes-gcm-crash.any.html
2637                http/wpt/crypto/aes-gcm-crash.any.worker.html
2638                http/wpt/crypto/derive-hmac-key-crash.any.html
2639                http/wpt/crypto/derive-hmac-key-crash.any.worker.html
2640                http/wpt/crypto/ecdsa-crash.any.html
2641                http/wpt/crypto/ecdsa-crash.any.worker.html
2642                http/wpt/crypto/hkdf-crash.any.html
2643                http/wpt/crypto/hkdf-crash.any.worker.html
2644                http/wpt/crypto/pbkdf2-crash.any.html
2645                http/wpt/crypto/pbkdf2-crash.any.worker.html
2646                http/wpt/crypto/rsa-oaep-crash.any.html
2647                http/wpt/crypto/rsa-oaep-crash.any.worker.html
2648                http/wpt/crypto/rsa-pss-crash.any.html
2649                http/wpt/crypto/rsa-pss-crash.any.worker.html
2650                http/wpt/crypto/unwrap-ec-key-crash.any.html
2651                http/wpt/crypto/unwrap-ec-key-crash.any.worker.html
2652                http/wpt/crypto/unwrap-rsa-key-crash.any.html
2653                http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html
2654
2655         * crypto/CryptoAlgorithm.cpp:
2656         (WebCore::CryptoAlgorithm::encrypt):
2657         (WebCore::CryptoAlgorithm::decrypt):
2658         (WebCore::CryptoAlgorithm::sign):
2659         (WebCore::CryptoAlgorithm::verify):
2660         (WebCore::CryptoAlgorithm::deriveBits):
2661         (WebCore::CryptoAlgorithm::importKey):
2662         (WebCore::dispatchAlgorithmOperation):
2663         (WebCore::CryptoAlgorithm::dispatchOperationInWorkQueue):
2664         (WebCore::CryptoAlgorithm::dispatchOperation): Deleted.
2665         * crypto/CryptoAlgorithm.h:
2666         * crypto/SubtleCrypto.cpp:
2667         (WebCore::crossThreadCopyImportParams):
2668         (WebCore::SubtleCrypto::encrypt):
2669         (WebCore::SubtleCrypto::decrypt):
2670         (WebCore::SubtleCrypto::sign):
2671         (WebCore::SubtleCrypto::verify):
2672         (WebCore::SubtleCrypto::deriveKey):
2673         (WebCore::SubtleCrypto::deriveBits):
2674         (WebCore::SubtleCrypto::importKey):
2675         (WebCore::SubtleCrypto::wrapKey):
2676         (WebCore::SubtleCrypto::unwrapKey):
2677         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
2678         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
2679         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
2680         (WebCore::CryptoAlgorithmAES_CBC::importKey):
2681         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
2682         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
2683         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
2684         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
2685         (WebCore::CryptoAlgorithmAES_CFB::importKey):
2686         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
2687         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
2688         (WebCore::parametersAreValid):
2689         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
2690         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
2691         (WebCore::CryptoAlgorithmAES_CTR::importKey):
2692         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
2693         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
2694         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
2695         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
2696         (WebCore::CryptoAlgorithmAES_GCM::importKey):
2697         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
2698         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
2699         (WebCore::CryptoAlgorithmAES_KW::importKey):
2700         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
2701         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
2702         (WebCore::CryptoAlgorithmECDH::deriveBits):
2703         (WebCore::CryptoAlgorithmECDH::importKey):
2704         * crypto/algorithms/CryptoAlgorithmECDH.h:
2705         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
2706         (WebCore::CryptoAlgorithmECDSA::sign):
2707         (WebCore::CryptoAlgorithmECDSA::verify):
2708         (WebCore::CryptoAlgorithmECDSA::importKey):
2709         * crypto/algorithms/CryptoAlgorithmECDSA.h:
2710         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
2711         (WebCore::CryptoAlgorithmHKDF::deriveBits):
2712         (WebCore::CryptoAlgorithmHKDF::importKey):
2713         * crypto/algorithms/CryptoAlgorithmHKDF.h:
2714         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
2715         (WebCore::CryptoAlgorithmHMAC::sign):
2716         (WebCore::CryptoAlgorithmHMAC::verify):
2717         (WebCore::CryptoAlgorithmHMAC::importKey):
2718         * crypto/algorithms/CryptoAlgorithmHMAC.h:
2719         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
2720         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
2721         (WebCore::CryptoAlgorithmPBKDF2::importKey):
2722         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
2723         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
2724         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
2725         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
2726         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
2727         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
2728         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2729         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
2730         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
2731         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
2732         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
2733         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
2734         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
2735         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
2736         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
2737         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
2738         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
2739         (WebCore::CryptoAlgorithmRSA_PSS::sign):
2740         (WebCore::CryptoAlgorithmRSA_PSS::verify):
2741         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
2742         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
2743         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
2744         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2745         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2746         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
2747         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2748         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2749         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
2750         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2751         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2752         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
2753         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2754         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2755         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
2756         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
2757         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
2758         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2759         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
2760         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2761         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2762         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
2763         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2764         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2765         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
2766         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2767         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2768         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
2769         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2770         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2771         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
2772         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2773         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2774         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
2775         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2776         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2777         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
2778         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
2779         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
2780         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2781         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
2782         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2783         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2784         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
2785         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2786         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2787         * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h:
2788         * crypto/parameters/CryptoAlgorithmAesCtrParams.h:
2789         * crypto/parameters/CryptoAlgorithmAesGcmParams.h:
2790         * crypto/parameters/CryptoAlgorithmEcKeyParams.h:
2791         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
2792         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
2793         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
2794         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
2795         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
2796         * crypto/parameters/CryptoAlgorithmRsaOaepParams.h:
2797         * crypto/parameters/CryptoAlgorithmRsaPssParams.h:
2798
2799 2018-07-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
2800
2801         [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the flush immediate transaction
2802         https://bugs.webkit.org/show_bug.cgi?id=187375
2803
2804         Reviewed by Simon Fraser.
2805
2806         An immediate-paint transaction should force all the images which are pending
2807         decoding to be repainted.
2808
2809         To do that, FrameView::paintControlTints() will be re-factored to a new
2810         generic function such that it takes PaintInvalidationReasons. The new function
2811         which is named 'traverseForPaintInvalidation' will traverse the render tree
2812         for a specific PaintInvalidationReasons.
2813
2814         invalidateImagesWithAsyncDecodes() will stop the asynchronous decoding for
2815         the underlying image and repaint all the clients which are waiting for the
2816         decoding to finish.
2817
2818         * loader/cache/CachedImage.cpp:
2819         (WebCore::CachedImage::didRemoveClient):
2820         (WebCore::CachedImage::isClientWaitingForAsyncDecoding const):
2821         (WebCore::CachedImage::addClientWaitingForAsyncDecoding):
2822         (WebCore::CachedImage::removeAllClientsWaitingForAsyncDecoding):
2823         (WebCore::CachedImage::allClientsRemoved):
2824         (WebCore::CachedImage::clear):
2825         (WebCore::CachedImage::createImage):
2826         (WebCore::CachedImage::imageFrameAvailable):
2827         (WebCore::CachedImage::addPendingImageDrawingClient): Deleted.
2828         * loader/cache/CachedImage.h:
2829         * page/FrameView.cpp:
2830         (WebCore::FrameView::paintScrollCorner):
2831         (WebCore::FrameView::updateControlTints):
2832         (WebCore::FrameView::traverseForPaintInvalidation):
2833         (WebCore::FrameView::adjustPageHeightDeprecated):
2834         (WebCore::FrameView::paintControlTints): Deleted.
2835         * page/FrameView.h:
2836         * platform/ScrollView.cpp:
2837         (WebCore::ScrollView::paint):
2838         * platform/Scrollbar.cpp:
2839         (WebCore::Scrollbar::paint):
2840         * platform/graphics/BitmapImage.h:
2841         * platform/graphics/GraphicsContext.cpp:
2842         (WebCore::GraphicsContext::GraphicsContext):
2843         * platform/graphics/GraphicsContext.h:
2844         (WebCore::GraphicsContext::performingPaintInvalidation const):
2845         (WebCore::GraphicsContext::invalidatingControlTints const):
2846         (WebCore::GraphicsContext::invalidatingImagesWithAsyncDecodes const):
2847         (WebCore::GraphicsContext::updatingControlTints const): Deleted.
2848         * rendering/RenderBoxModelObject.cpp:
2849         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
2850         * rendering/RenderImage.cpp:
2851         (WebCore::RenderImage::paintReplaced):
2852         (WebCore::RenderImage::paintAreaElementFocusRing):
2853         (WebCore::RenderImage::paintIntoRect):
2854         * rendering/RenderLayer.cpp:
2855         (WebCore::RenderLayer::paintScrollCorner):
2856         (WebCore::RenderLayer::paintResizer):
2857         (WebCore::RenderLayer::paintLayer):
2858         * rendering/RenderScrollbar.cpp:
2859         (WebCore::RenderScrollbar::paint):
2860         * rendering/RenderTheme.cpp:
2861         (WebCore::RenderTheme::paint):
2862         * testing/Internals.cpp:
2863         (WebCore::Internals::invalidateControlTints):
2864         (WebCore::Internals::paintControlTints): Deleted.
2865         * testing/Internals.h:
2866         * testing/Internals.idl:
2867
2868 2018-07-16  Ryan Haddad  <ryanhaddad@apple.com>
2869
2870         Unreviewed attempt to fix the build.
2871
2872         * rendering/RenderThemeMac.mm:
2873
2874 2018-07-11  Dean Jackson  <dino@apple.com>
2875
2876         Allow removal of white backgrounds
2877         https://bugs.webkit.org/show_bug.cgi?id=187574
2878         <rdar://problem/41146792>
2879
2880         Reviewed by Simon Fraser.
2881
2882         Add a drawing mode that turns white backgrounds into transparent
2883         regions, such that a hosting app can see through to its window.
2884
2885         Test: css3/color-filters/punch-out-white-backgrounds.html
2886
2887         * page/Settings.yaml: New Setting.
2888
2889         * rendering/InlineFlowBox.cpp: Draw with a destination out blend mode
2890         if the background is white and we are punching out backgrounds, which means
2891         that it will erase the destination.
2892         (WebCore::InlineFlowBox::paintBoxDecorations):
2893         * rendering/RenderBox.cpp:
2894         (WebCore::RenderBox::paintBackground): Ditto.
2895         * rendering/RenderTableCell.cpp:
2896         (WebCore::RenderTableCell::paintBackgroundsBehindCell): Ditto.
2897
2898         * rendering/RenderBoxModelObject.cpp:
2899         (WebCore::RenderBoxModelObject::paintFillLayerExtended): Save and restore
2900         the composition mode if necessary.
2901
2902 2018-07-16  David Fenton  <david_fenton@apple.com>
2903
2904         Unreviewed, rolling out r233867.
2905
2906         caused build failures on High Sierra, Sierra and iOS
2907
2908         Reverted changeset:
2909
2910         "[WebCrypto] Crypto operations should copy their parameters
2911         before hoping to another thread"
2912         https://bugs.webkit.org/show_bug.cgi?id=187501
2913         https://trac.webkit.org/changeset/233867
2914
2915 2018-07-15  Jiewen Tan  <jiewen_tan@apple.com>
2916
2917         [WebCrypto] Crypto operations should copy their parameters before hoping to another thread
2918         https://bugs.webkit.org/show_bug.cgi?id=187501
2919         <rdar://problem/41438160>
2920
2921         Reviewed by Youenn Fablet.
2922
2923         This patch aims at making all captured variables in all crypto lambdas that need to be passed
2924         to a worker thread thread safe, which includes:
2925         1) changing ref counted objects to thread safe ref counted object.
2926         2) adding isolatedCopy methods to non ref counted classes, so they can be called by CrossThreadCopy().
2927
2928         In addition to above changes, this patch also does the following things:
2929         1) change the name CryptoAlgorithm::dispatchOperation => CryptoAlgorithm::dispatchOperationInWorkQueue
2930         to make it clear that lambdas will be passed to a secondary thread.
2931         2) make CryptoAlgorithmParameters as const parameters for all methods.
2932
2933         Tests: crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html
2934                http/wpt/crypto/aes-cbc-crash.any.html
2935                http/wpt/crypto/aes-cbc-crash.any.worker.html
2936                http/wpt/crypto/aes-ctr-crash.any.html
2937                http/wpt/crypto/aes-ctr-crash.any.worker.html
2938                http/wpt/crypto/aes-gcm-crash.any.html
2939                http/wpt/crypto/aes-gcm-crash.any.worker.html
2940                http/wpt/crypto/derive-hmac-key-crash.any.html
2941                http/wpt/crypto/derive-hmac-key-crash.any.worker.html
2942                http/wpt/crypto/ecdsa-crash.any.html
2943                http/wpt/crypto/ecdsa-crash.any.worker.html
2944                http/wpt/crypto/hkdf-crash.any.html
2945                http/wpt/crypto/hkdf-crash.any.worker.html
2946                http/wpt/crypto/pbkdf2-crash.any.html
2947                http/wpt/crypto/pbkdf2-crash.any.worker.html
2948                http/wpt/crypto/rsa-oaep-crash.any.html
2949                http/wpt/crypto/rsa-oaep-crash.any.worker.html
2950                http/wpt/crypto/rsa-pss-crash.any.html
2951                http/wpt/crypto/rsa-pss-crash.any.worker.html
2952                http/wpt/crypto/unwrap-ec-key-crash.any.html
2953                http/wpt/crypto/unwrap-ec-key-crash.any.worker.html
2954                http/wpt/crypto/unwrap-rsa-key-crash.any.html
2955                http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html
2956
2957         * crypto/CryptoAlgorithm.cpp:
2958         (WebCore::CryptoAlgorithm::encrypt):
2959         (WebCore::CryptoAlgorithm::decrypt):
2960         (WebCore::CryptoAlgorithm::sign):
2961         (WebCore::CryptoAlgorithm::verify):
2962         (WebCore::CryptoAlgorithm::deriveBits):
2963         (WebCore::CryptoAlgorithm::importKey):
2964         (WebCore::dispatchAlgorithmOperation):
2965         (WebCore::CryptoAlgorithm::dispatchOperationInWorkQueue):
2966         (WebCore::CryptoAlgorithm::dispatchOperation): Deleted.
2967         * crypto/CryptoAlgorithm.h:
2968         * crypto/SubtleCrypto.cpp:
2969         (WebCore::crossThreadCopyImportParams):
2970         (WebCore::SubtleCrypto::encrypt):
2971         (WebCore::SubtleCrypto::decrypt):
2972         (WebCore::SubtleCrypto::sign):
2973         (WebCore::SubtleCrypto::verify):
2974         (WebCore::SubtleCrypto::deriveKey):
2975         (WebCore::SubtleCrypto::deriveBits):
2976         (WebCore::SubtleCrypto::importKey):
2977         (WebCore::SubtleCrypto::wrapKey):
2978         (WebCore::SubtleCrypto::unwrapKey):
2979         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
2980         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
2981         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
2982         (WebCore::CryptoAlgorithmAES_CBC::importKey):
2983         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
2984         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
2985         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
2986         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
2987         (WebCore::CryptoAlgorithmAES_CFB::importKey):
2988         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
2989         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
2990         (WebCore::parametersAreValid):
2991         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
2992         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
2993         (WebCore::CryptoAlgorithmAES_CTR::importKey):
2994         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
2995         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
2996         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
2997         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
2998         (WebCore::CryptoAlgorithmAES_GCM::importKey):
2999         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
3000         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
3001         (WebCore::CryptoAlgorithmAES_KW::importKey):
3002         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
3003         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
3004         (WebCore::CryptoAlgorithmECDH::deriveBits):
3005         (WebCore::CryptoAlgorithmECDH::importKey):
3006         * crypto/algorithms/CryptoAlgorithmECDH.h:
3007         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
3008         (WebCore::CryptoAlgorithmECDSA::sign):
3009         (WebCore::CryptoAlgorithmECDSA::verify):
3010         (WebCore::CryptoAlgorithmECDSA::importKey):
3011         * crypto/algorithms/CryptoAlgorithmECDSA.h:
3012         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
3013         (WebCore::CryptoAlgorithmHKDF::deriveBits):
3014         (WebCore::CryptoAlgorithmHKDF::importKey):
3015         * crypto/algorithms/CryptoAlgorithmHKDF.h:
3016         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
3017         (WebCore::CryptoAlgorithmHMAC::sign):
3018         (WebCore::CryptoAlgorithmHMAC::verify):
3019         (WebCore::CryptoAlgorithmHMAC::importKey):
3020         * crypto/algorithms/CryptoAlgorithmHMAC.h:
3021         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
3022         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
3023         (WebCore::CryptoAlgorithmPBKDF2::importKey):
3024         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
3025         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
3026         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
3027         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
3028         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
3029         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
3030         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
3031         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
3032         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
3033         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
3034         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
3035         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
3036         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
3037         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
3038         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
3039         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
3040         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
3041         (WebCore::CryptoAlgorithmRSA_PSS::sign):
3042         (WebCore::CryptoAlgorithmRSA_PSS::verify):
3043         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
3044         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
3045         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
3046         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
3047         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
3048         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
3049         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
3050         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
3051         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
3052         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
3053         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
3054         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
3055         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
3056         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
3057         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
3058         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
3059         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
3060         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
3061         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
3062         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
3063         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
3064         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
3065         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
3066         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
3067         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
3068         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
3069         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
3070         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
3071         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
3072         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
3073         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
3074         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
3075         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
3076         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
3077         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
3078         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
3079         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
3080         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
3081         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
3082         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
3083         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
3084         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
3085         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
3086         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
3087         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
3088         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
3089         * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h:
3090         * crypto/parameters/CryptoAlgorithmAesCtrParams.h:
3091         * crypto/parameters/CryptoAlgorithmAesGcmParams.h:
3092         * crypto/parameters/CryptoAlgorithmEcKeyParams.h:
3093         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
3094         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
3095         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
3096         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
3097         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
3098         * crypto/parameters/CryptoAlgorithmRsaOaepParams.h:
3099         * crypto/parameters/CryptoAlgorithmRsaPssParams.h:
3100
3101 2018-07-16  Aditya Keerthi  <akeerthi@apple.com>
3102
3103         [Datalist][macOS] Add suggestions UI for TextFieldInputTypes
3104         https://bugs.webkit.org/show_bug.cgi?id=186531
3105
3106         Reviewed by Tim Horton.
3107
3108         Tests: fast/forms/datalist/datalist-show-hide.html
3109                fast/forms/datalist/datalist-textinput-keydown.html
3110
3111         * html/TextFieldInputType.cpp:
3112         (WebCore::TextFieldInputType::handleKeydownEvent):
3113         (WebCore::TextFieldInputType::handleKeydownEventForSpinButton): The suggestions view takes precedence when handling arrow key events.
3114
3115 2018-07-16  Jeremy Jones  <jeremyj@apple.com>
3116
3117         Fullscreen requires active document.
3118         https://bugs.webkit.org/show_bug.cgi?id=186226
3119         rdar://problem/36187413
3120
3121         Reviewed by Jer Noble.
3122
3123         Test: media/no-fullscreen-when-hidden.html
3124
3125         This change guarantees the document to be visible for both element fullscreen and video fullscreen.
3126
3127         User gesture is not enough to guarantee that the document is visible when fullscreen is initiated
3128         because JavaScript can spin wait before initiating fullscreen. During that spin the page or window might
3129         be hidden.
3130
3131         Document::hidden() can't be relied upon because it won't update while JavaScript spins.
3132
3133         This change adds a sync call to the UI process to get the current UI visibility state.
3134
3135         * dom/Document.cpp:
3136         (WebCore::Document::requestFullScreenForElement):
3137         * html/HTMLMediaElement.cpp:
3138         (WebCore::HTMLMediaElement::enterFullscreen):
3139         * page/ChromeClient.h:
3140
3141 2018-07-16  Alex Christensen  <achristensen@webkit.org>
3142
3143         Reduce size of NetworkLoadMetrics and therefore ResourceResponse
3144         https://bugs.webkit.org/show_bug.cgi?id=187671
3145
3146         Reviewed by Darin Adler.
3147
3148         * inspector/agents/InspectorNetworkAgent.cpp:
3149         (WebCore::toProtocol):
3150         (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
3151         * platform/network/NetworkLoadMetrics.h:
3152         (WebCore::NetworkLoadMetrics::isolatedCopy const):
3153         (WebCore::NetworkLoadMetrics::reset):
3154         (WebCore::NetworkLoadMetrics::clearNonTimingData):
3155
3156 2018-07-16  Chris Dumez  <cdumez@apple.com>
3157
3158         Make sure LibWebRTCMediaEndpoint is always destroyed on the main thread
3159         https://bugs.webkit.org/show_bug.cgi?id=187702
3160
3161         Reviewed by Youenn Fablet.
3162
3163         Make sure LibWebRTCMediaEndpoint is always constructed and destructed on the main thread since
3164         it has a Timer data member and it would not be safe otherwise. LibWebRTCMediaEndpoint is
3165         ThreadSafeRefCounted and frequently passed to other threads.
3166
3167         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3168         (WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint):
3169         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
3170
3171 2018-07-16  Sihui Liu  <sihui_liu@apple.com>
3172
3173         IndexedDB: closeAndDeleteDatabasesForOrigins should remove all databases for those origins
3174         https://bugs.webkit.org/show_bug.cgi?id=187631
3175         <rdar://problem/42164227>
3176
3177         Reviewed by Brady Eidson.
3178
3179         When asked to delete database for an origin, we deleted the databases whose mainFrameOrigin 
3180         is that origin. Given that the origin may create IndexedDB from subframes, we should delete 
3181         databases whose openingOrigin is that origin too.
3182
3183         Covered by modified API test: WebKit.WebsiteDataStoreCustomPaths. 
3184
3185         * Modules/indexeddb/server/IDBServer.cpp:
3186         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
3187
3188 2018-07-16  Simon Fraser  <simon.fraser@apple.com>
3189
3190         Shrink some font-related classes and enums
3191         https://bugs.webkit.org/show_bug.cgi?id=187686
3192
3193         Reviewed by Myles Maxfield.
3194         
3195         Use enum class for enums in TextFlags.h and make them one byte big.
3196
3197         Re-order members of Font to shrink it from 360 to 328 bytes.
3198
3199         * css/CSSPrimitiveValueMappings.h:
3200         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3201         (WebCore::CSSPrimitiveValue::operator FontSmoothingMode const):
3202         (WebCore::CSSPrimitiveValue::operator FontSmallCaps const):
3203         (WebCore::CSSPrimitiveValue::operator TextRenderingMode const):
3204         * platform/graphics/Font.cpp:
3205         (WebCore::Font::Font):
3206         (WebCore::Font::verticalRightOrientationFont const):
3207         * platform/graphics/Font.h:
3208         * platform/graphics/FontCascade.cpp:
3209         (WebCore::offsetToMiddleOfGlyph):
3210         * platform/graphics/FontCascade.h:
3211         (WebCore::FontCascade::advancedTextRenderingMode const):
3212         * platform/graphics/FontCascadeFonts.cpp:
3213         (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
3214         (WebCore::FontCascadeFonts::glyphDataForVariant):
3215         (WebCore::glyphPageFromFontRanges):
3216         * platform/graphics/FontDescription.cpp:
3217         (WebCore::FontCascadeDescription::FontCascadeDescription):
3218         * platform/graphics/FontDescription.h:
3219         (WebCore::FontDescription::setTextRenderingMode):
3220         (WebCore::FontDescription::setOrientation):
3221         (WebCore::FontDescription::setWidthVariant):
3222         (WebCore::FontCascadeDescription::setFontSmoothing):
3223         (WebCore::FontCascadeDescription::initialSmallCaps):
3224         (WebCore::FontCascadeDescription::initialFontSmoothing):
3225         (WebCore::FontCascadeDescription::initialTextRenderingMode):
3226         * platform/graphics/FontPlatformData.h:
3227         (WebCore::FontPlatformData::isForTextCombine const):
3228         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3229         (WebCore::preparePlatformFont):
3230         * platform/graphics/cocoa/FontCascadeCocoa.mm:
3231         (WebCore::showLetterpressedGlyphsWithAdvances):
3232         (WebCore::showGlyphsWithAdvances):
3233         (WebCore::FontCascade::drawGlyphs):
3234         (WebCore::FontCascade::fontForCombiningCharacterSequence const):
3235         * platform/graphics/cocoa/FontCocoa.mm:
3236         (WebCore::Font::platformInit):
3237         (WebCore::Font::platformBoundsForGlyph const):
3238         (WebCore::Font::platformWidthForGlyph const):
3239         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
3240         (WebCore::FontPlatformData::hash const):
3241         (WebCore::mapFontWidthVariantToCTFeatureSelector):
3242         (WebCore::FontPlatformData::ctFont const):
3243         (WebCore::FontPlatformData::description const):
3244         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
3245         (WebCore::FontPlatformData::buildScaledFont):
3246         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
3247         (WebCore::Font::platformInit):
3248         (WebCore::Font::platformWidthForGlyph const):
3249         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
3250         (WebCore::fontFeatures):
3251         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
3252         * platform/graphics/mac/SimpleFontDataCoreText.cpp:
3253         (WebCore::Font::getCFStringAttributes const):
3254         * platform/graphics/win/FontCGWin.cpp:
3255         (WebCore::FontCascade::drawGlyphs):
3256         * platform/graphics/win/FontCascadeDirect2D.cpp:
3257         (WebCore::FontCascade::drawGlyphs):
3258         * platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp:
3259         (WebCore::GlyphPage::fill):
3260         * platform/graphics/win/SimpleFontDataDirect2D.cpp:
3261         (WebCore::Font::platformInit):
3262         (WebCore::Font::platformBoundsForGlyph const):
3263         (WebCore::Font::platformWidthForGlyph const):
3264         * platform/text/TextFlags.h:
3265         * rendering/RenderCombineText.cpp:
3266         (WebCore::RenderCombineText::combineTextIfNeeded):
3267         * rendering/RenderLayer.cpp:
3268         (WebCore::RenderLayer::calculateClipRects const):
3269         * rendering/TextPainter.cpp:
3270         (WebCore::TextPainter::paintTextWithShadows):
3271         * rendering/TextPainter.h:
3272         * rendering/style/RenderStyle.cpp:
3273         (WebCore::RenderStyle::fontAndGlyphOrientation):
3274         * rendering/svg/RenderSVGInlineText.cpp:
3275         (WebCore::RenderSVGInlineText::computeNewScaledFontForStyle):
3276
3277 2018-07-16  Sergio Villar Senin  <svillar@igalia.com>
3278
3279         [WebVR] Add support for connect/disconnect and mount/unmount device events
3280         https://bugs.webkit.org/show_bug.cgi?id=187343
3281
3282         Reviewed by Žan Doberšek.
3283
3284         WebVR specs define a series of events as part of the Window Interface Extension. We're
3285         adding support for the connect/disconnect and mount/unmount events both at the module level
3286         and the platform level using OpenVR.
3287
3288         In order to do that we need to keep lists of VRPlatformDisplays at platform level and
3289         VRDisplays at bindings level. We then update those lists accordingly to detect potential
3290         additions/removals, and emit the corresponding signals. A new client interface
3291         VRPlatformDisplayClient was also defined so that VRPlatformDisplay implementations could
3292         notify their clients (typically a VRDisplay).
3293
3294         Last but not least, NavigatorWebVR was updated so it supplements Navigator instead of
3295         supplementing Page.
3296
3297         * Modules/webvr/NavigatorWebVR.cpp: Supplement Navigator not Page.
3298         (WebCore::NavigatorWebVR::getVRDisplays): Keep a list of VRDisplays and update them
3299         conveniently, also emitting the required events under certain conditions (like device
3300         disconnection).
3301         (WebCore::NavigatorWebVR::supplementName): New method.
3302         (WebCore::NavigatorWebVR::from): Ditto.
3303         * Modules/webvr/NavigatorWebVR.h: Supplement Navigator not Page.
3304         * Modules/webvr/VRDisplay.cpp:
3305         (WebCore::VRDisplay::create): Moved suspendIfNeeded() to constructor.
3306         (WebCore::VRDisplay::VRDisplay): Set itself as VRPlatformDisplay client.
3307         (WebCore::VRDisplay::~VRDisplay): Unset as  VRPlatformDisplay client.
3308         (WebCore::VRDisplay::VRPlatformDisplayConnected): Dispatch event on DOM window.
3309         (WebCore::VRDisplay::VRPlatformDisplayDisconnected): Ditto.
3310         (WebCore::VRDisplay::VRPlatformDisplayMounted): Ditto.
3311         (WebCore::VRDisplay::VRPlatformDisplayUnmounted): Ditto.
3312         * Modules/webvr/VRDisplay.h: Extend from VRPlatformDisplayClient.
3313         (WebCore::VRDisplay::document):
3314         * Modules/webvr/VRDisplayEvent.cpp: Updated Copyright.
3315         * Modules/webvr/VRDisplayEvent.h: Ditto.
3316         * Sources.txt: Added the two new files.
3317         * WebCore.xcodeproj/project.pbxproj: Ditto.
3318         * platform/vr/VRManager.cpp:
3319         (WebCore::VRManager::getVRDisplays): Keep a list of VRPlatformDisplays and update them conveniently,
3320         also emitting the required events under certain conditions (like device disconnection).
3321         * platform/vr/VRManager.h:
3322         * platform/vr/VRPlatformDisplay.cpp: New file with common implementations for VRPlatformDisplays.
3323         (WebCore::VRPlatformDisplay::setClient):
3324         (WebCore::VRPlatformDisplay::notifyVRPlatformDisplayEvent):
3325         * platform/vr/VRPlatformDisplay.h: Added a generic method to notify about different
3326         events. Added the client pointer.
3327         * platform/vr/VRPlatformDisplayClient.h: New file. VRPlatformDisplay implementations will
3328         call the client methods in the event of some circumstances happening.
3329         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayConnected):
3330         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayDisconnected):
3331         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayMounted):
3332         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayUnmounted):
3333         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
3334         (WebCore::VRPlatformDisplayOpenVR::updateDisplayInfo): Poll the device for new events to
3335         detect connection/disconnections or device activations/deactivations (HMD
3336         mounted/unmounted).
3337         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
3338
3339 2018-07-16  Zan Dobersek  <zdobersek@igalia.com>