Allow to remove MediaStreamPrivate observers when iterating over observers
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-11-14  Youenn Fablet  <youenn@apple.com>
2
3         Allow to remove MediaStreamPrivate observers when iterating over observers
4         https://bugs.webkit.org/show_bug.cgi?id=187256
5
6         Reviewed by Eric Carlson.
7
8         Migrate the observer list from a Vector to a HashSet.
9         This is more robust to multiple observing and keeping of order of observers is not required.
10         Copy the set of observers to a vector before iterating over it.
11         This allows to remove an observer while iterating, which is now used in UserMediaRequest.
12
13         Covered by existing tests.
14
15         * Modules/mediastream/UserMediaRequest.cpp:
16         (WebCore::UserMediaRequest::mediaStreamIsReady):
17         * platform/mediastream/MediaStreamPrivate.cpp:
18         (WebCore::MediaStreamPrivate::addObserver):
19         (WebCore::MediaStreamPrivate::removeObserver):
20         (WebCore::MediaStreamPrivate::forEachObserver const):
21         (WebCore::MediaStreamPrivate::updateActiveState):
22         (WebCore::MediaStreamPrivate::addTrack):
23         (WebCore::MediaStreamPrivate::removeTrack):
24         (WebCore::MediaStreamPrivate::characteristicsChanged):
25         * platform/mediastream/MediaStreamPrivate.h:
26
27 2018-11-14  Youenn Fablet  <youenn@apple.com>
28
29         Calling removeTrack on different RTCPeerConnection should throw InvalidAccessError
30         https://bugs.webkit.org/show_bug.cgi?id=191603
31
32         Reviewed by Chris Dumez.
33
34         Make sure to check that the sender peer connection backend is matching.
35         Covered by rebased WPT test.
36
37         * Modules/mediastream/RTCPeerConnection.cpp:
38         (WebCore::RTCPeerConnection::removeTrack):
39         * Modules/mediastream/RTCRtpSender.cpp:
40         (WebCore::RTCRtpSender::isCreatedBy const):
41         * Modules/mediastream/RTCRtpSender.h:
42
43 2018-11-14  Fujii Hironori  <Hironori.Fujii@sony.com>
44
45         [curl] Unify CookieJarCurlDatabase and the abstract class CookieJarCurl
46         https://bugs.webkit.org/show_bug.cgi?id=191620
47
48         Reviewed by Alex Christensen.
49
50         Remove a abstract class CookieJarCurl which is not needed anymore.
51         And, rename CookieJarCurlDatabase to CookieJarCurl.
52
53         No new tests because there's no behaviour change in WebCore.
54
55         * platform/Curl.cmake: Replaced CookieJarCurlDatabase.cpp with CookieJarCurl.cpp.
56         * platform/network/curl/CookieJarCurl.cpp: Renamed from Source/WebCore/platform/network/curl/CookieJarCurlDatabase.cpp.
57         * platform/network/curl/CookieJarCurl.h: Merged CookieJarCurl.h and CookieJarCurlDatabase.h.
58         * platform/network/curl/CookieJarCurlDatabase.h: Removed.
59         * platform/network/curl/NetworkStorageSessionCurl.cpp:
60         (WebCore::NetworkStorageSession::NetworkStorageSession): Replaced CookieJarCurlDatabase with CookieJarCurl.
61
62 2018-11-14  Christopher Reid  <chris.reid@sony.com>
63
64         [WPE] Remove glib usage in PlatformKeyboardEventWPE.cpp
65         https://bugs.webkit.org/show_bug.cgi?id=191606
66
67         Reviewed by Michael Catanzaro.
68
69         No behavior change.
70
71         Use StringBuilder::append(UChar32) as a generic way to convert a uint32_t code point to WTFString.
72
73         * platform/wpe/PlatformKeyboardEventWPE.cpp:
74         (WebCore::PlatformKeyboardEvent::keyValueForWPEKeyCode):
75         (WebCore::PlatformKeyboardEvent::singleCharacterString):
76
77 2018-11-13  Zalan Bujtas  <zalan@apple.com>
78
79         [LFC][IFC] Construct dedicated runs when the inline element requires it (part 2)
80         https://bugs.webkit.org/show_bug.cgi?id=191623
81
82         Reviewed by Antti Koivisto.
83
84         This patch expands the breaking behaviour to support separate start/end breaks.
85
86         <span>parent </span><span style="padding: 10px;">start<span> middle </span>end</span><span> parent</span>
87
88         input to line breaking -> <parent start middle end parent>
89         output of line breaking (considering infinite constraint) -> <parent start middle end parent>
90         due to padding, final runs -> <parent><start middle end><parent>
91
92         "parent" -> n/a
93         "start" -> BreakAtStart
94         " middle " -> n/a
95         "end" -> BreakAtEnd
96         "parent" -> n/a
97
98         Another example:
99         <span>parent </span><span style="padding-right: 10px;">start<span> middle </span>end</span><span> parent</span>
100
101         line breaking -> <parent start middle end parent>
102         due to padding-right, final runs -> <parent start middle end><parent>
103
104         "parent" -> n/a
105         "start" -> n/a
106         " middle " -> n/a
107         "end" -> BreakAtEnd
108         "parent" -> n/a
109
110         * layout/inlineformatting/InlineFormattingContext.cpp:
111         (WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const):
112         (WebCore::Layout::InlineFormattingContext::collectInlineContent const): Move to a recursive algorithm (which is fine, inline contents don't tend to be too deep)
113         (WebCore::Layout::InlineFormattingContext::contentRequiresSeparateRun const): Deleted.
114         * layout/inlineformatting/InlineFormattingContext.h:
115         * layout/inlineformatting/InlineFormattingState.cpp:
116         (WebCore::Layout::InlineFormattingState::detachingRules const):
117         * layout/inlineformatting/InlineFormattingState.h:
118         (WebCore::Layout::InlineFormattingState::lastInlineItem const):
119         (WebCore::Layout::InlineFormattingState::addDetachingRule):
120
121 2018-11-14  Youenn Fablet  <youenn@apple.com>
122
123         Add support for RTCRtpCodecParameters.sdpFmtpLine
124         https://bugs.webkit.org/show_bug.cgi?id=191591
125
126         Reviewed by Eric Carlson.
127
128         Covered by rebased test.
129
130         * Modules/mediastream/RTCRtpCodecParameters.h:
131         * Modules/mediastream/RTCRtpCodecParameters.idl:
132         * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
133         (WebCore::toRTCCodecParameters):
134
135 2018-11-14  Youenn Fablet  <youenn@apple.com>
136
137         Add support for transport and peerConnection stats
138         https://bugs.webkit.org/show_bug.cgi?id=191592
139
140         Reviewed by Alex Christensen.
141
142         Covered by rebased tests.
143
144         * Modules/mediastream/RTCStatsReport.h:
145         (WebCore::RTCStatsReport::TransportStats::TransportStats):
146         (WebCore::RTCStatsReport::PeerConnectionStats::PeerConnectionStats):
147         * Modules/mediastream/RTCStatsReport.idl:
148         * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp:
149         (WebCore::fillRTCTransportStats):
150         (WebCore::fillRTCPeerConnectionStats):
151         (WebCore::LibWebRTCStatsCollector::OnStatsDelivered):
152
153 2018-11-14  Ali Juma  <ajuma@chromium.org>
154
155         Transform of composited layer not updated when layer also needs repaint
156         https://bugs.webkit.org/show_bug.cgi?id=191598
157
158         Reviewed by Simon Fraser.
159
160         Trigger a compositing geometry update whenever a RenderLayer's transform changes,
161         even when other parts of its style have changed in a way that produces a
162         StyleDifference greater than RecompositeLayer.
163
164         Test: compositing/geometry/transform-and-repaint-updates-geometry.html
165
166         * rendering/RenderLayerCompositor.cpp:
167         (WebCore::RenderLayerCompositor::layerStyleChanged):
168
169 2018-11-13  Jiewen Tan  <jiewen_tan@apple.com>
170
171         [WebAuthN] Support CTAP HID authenticators on macOS
172         https://bugs.webkit.org/show_bug.cgi?id=188623
173         <rdar://problem/43353777>
174
175         Reviewed by Brent Fulgham and Chris Dumez.
176
177         This patch removes AuthenticatorCoordinatorClient::~AuthenticatorCoordinatorClient to ignore
178         any incompleted CompletionHandlers as calling them in destructors could cause unexpected cyclic
179         dependency. Also, it adds a hack to temporarily deal with nullable userhandle.
180
181         Tests: http/wpt/webauthn/ctap-hid-failure.https.html
182                http/wpt/webauthn/ctap-hid-success.https.html
183                http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html
184                http/wpt/webauthn/public-key-credential-create-failure-hid.https.html
185                http/wpt/webauthn/public-key-credential-create-success-hid.https.html
186                http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html
187                http/wpt/webauthn/public-key-credential-get-failure-hid.https.html
188                http/wpt/webauthn/public-key-credential-get-success-hid.https.html
189
190         * Modules/webauthn/AuthenticatorCoordinatorClient.cpp:
191         (WebCore::AuthenticatorCoordinatorClient::~AuthenticatorCoordinatorClient): Deleted.
192         * Modules/webauthn/AuthenticatorCoordinatorClient.h:
193         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
194         * Modules/webauthn/fido/DeviceResponseConverter.cpp:
195         (fido::readCTAPGetAssertionResponse):
196         * Modules/webauthn/fido/FidoConstants.h:
197
198 2018-11-13  Ross Kirsling  <ross.kirsling@sony.com>
199
200         [WebRTC] Provide default implementation of LibWebRTCProvider
201         https://bugs.webkit.org/show_bug.cgi?id=191611
202
203         Reviewed by Michael Catanzaro.
204
205         Refactor LibWebRTCProvider such that platform-specific implementations need not worry about specifying defaults.
206
207         * PlatformWin.cmake:
208         * platform/GStreamer.cmake:
209         * platform/SourcesGLib.txt:
210         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
211         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
212         * platform/mediastream/libwebrtc/LibWebRTCProviderGStreamer.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp.
213         * platform/mediastream/libwebrtc/LibWebRTCProviderGStreamer.h: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderGlib.h.
214         * platform/mediastream/libwebrtc/LibWebRTCProviderWin.cpp: Removed.
215
216 2018-11-13  Timothy Hatcher  <timothy@apple.com>
217
218         Use a light scrollbar for transparent web views in dark mode.
219         https://bugs.webkit.org/show_bug.cgi?id=191559
220         rdar://problem/46000489
221
222         Reviewed by Dean Jackson.
223
224         Test: css-dark-mode/supported-color-schemes-scrollbar.html
225
226         * css/CSSProperties.json: Marked supported-color-schemes as a custom Value.
227         * css/StyleBuilderCustom.h:
228         (WebCore::StyleBuilderCustom::applyValueSupportedColorSchemes):
229         * editing/cocoa/WebContentReaderCocoa.mm: Use FrameView's useDarkAppearance().
230         (WebCore::createFragment):
231         * inspector/InspectorOverlay.cpp:
232         (WebCore::InspectorOverlay::paint): Use FrameView's useDarkAppearance().
233         * page/FrameView.cpp:
234         (WebCore::FrameView::recalculateScrollbarOverlayStyle): Use a light scrollbar for
235         transparent web views in dark mode.
236         (WebCore::FrameView::rendererForSupportedColorSchemes const): Added.
237         Return the body for document element renderer.
238         (WebCore::FrameView::useDarkAppearance const): Use rendererForSupportedColorSchemes.
239         (WebCore::FrameView::styleColorOptions const): Added. Ditto.
240         * page/FrameView.h:
241         * rendering/style/RenderStyle.cpp:
242         (WebCore::rareInheritedDataChangeRequiresRepaint): Drive-by fix. Added supportedColorSchemes.
243         * rendering/style/RenderStyle.h:
244         (WebCore::RenderStyle::setHasExplicitlySetSupportedColorSchemes): Added.
245         (WebCore::RenderStyle::hasExplicitlySetSupportedColorSchemes const): Added.
246         (WebCore::RenderStyle::NonInheritedFlags::operator== const): Added supportedColorSchemes.
247         * svg/graphics/SVGImage.cpp:
248         (WebCore::SVGImage::draw): Use FrameView's useDarkAppearance().
249         * testing/Internals.cpp:
250         (WebCore::Internals::setViewIsTransparent): Added.
251         (WebCore::Internals::scrollbarOverlayStyle const): Added.
252         * testing/Internals.h:
253         * testing/Internals.idl: Added setViewIsTransparent and scrollbarOverlayStyle.
254
255 2018-11-13  Ross Kirsling  <ross.kirsling@sony.com>
256
257         [AppleWin] Unreviewed build fix after r238108.
258
259         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
260         (printLayer):
261         (PlatformCALayerWin::embeddedViewID const):
262         * platform/graphics/ca/win/PlatformCALayerWin.h:
263
264 2018-11-13  Youenn Fablet  <youenn@apple.com>
265
266         RTCPeerConnection.getTransceivers is not always exposing all transceivers
267         https://bugs.webkit.org/show_bug.cgi?id=191589
268
269         Reviewed by Eric Carlson.
270
271         Implement the collect transceiver algorithm using libwebrtc backend.
272         Call this algorithm everytime transceivers are retrieved from JS.
273         For Plan B, make this a no-op as this is not supported.
274         Introduce senders/receivers/transceivers getters where we just look at already created transceivers.
275
276         Covered by existing and rebased tests.
277
278         * Modules/mediastream/PeerConnectionBackend.h:
279         (WebCore::PeerConnectionBackend::collectTransceivers):
280         * Modules/mediastream/RTCPeerConnection.cpp:
281         (WebCore::RTCPeerConnection::getSenders const):
282         (WebCore::RTCPeerConnection::getReceivers const):
283         (WebCore::RTCPeerConnection::getTransceivers const):
284         * Modules/mediastream/RTCPeerConnection.h:
285         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
286         (WebCore::LibWebRTCMediaEndpoint::collectTransceivers):
287         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
288         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
289         (WebCore::LibWebRTCPeerConnectionBackend::addTrack):
290         (WebCore::LibWebRTCPeerConnectionBackend::existingTransceiver):
291         (WebCore::LibWebRTCPeerConnectionBackend::collectTransceivers):
292         (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources):
293         (WebCore::LibWebRTCPeerConnectionBackend::shouldOfferAllowToReceive const):
294         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
295
296 2018-11-13  Wenson Hsieh  <wenson_hsieh@apple.com>
297
298         [iOS] Do not show selection UI for editable elements with opacity near zero
299         https://bugs.webkit.org/show_bug.cgi?id=191442
300         <rdar://problem/45958625>
301
302         Reviewed by Simon Fraser.
303
304         Tests: editing/selection/ios/do-not-zoom-to-focused-hidden-contenteditable.html
305                editing/selection/ios/hide-selection-after-hiding-contenteditable.html
306                editing/selection/ios/hide-selection-in-contenteditable-nested-transparency.html
307                editing/selection/ios/hide-selection-in-hidden-contenteditable-frame.html
308                editing/selection/ios/hide-selection-in-hidden-contenteditable.html
309
310         * rendering/RenderObject.cpp:
311         (WebCore::RenderObject::isTransparentRespectingParentFrames const):
312
313         Add a helper function to determine whether a RenderObject is contained within a transparent layer, taking parent
314         frames into account. A layer is considered transparent if its opacity is less than a small threshold (i.e. 0.01).
315         Opacity on ancestor elements is applied multiplicatively.
316
317         * rendering/RenderObject.h:
318
319 2018-11-13  Eric Carlson  <eric.carlson@apple.com>
320
321         [MediaStream] Observer AVCaptureDevice "suspended" property
322         https://bugs.webkit.org/show_bug.cgi?id=191587
323         <rdar://problem/46030598>
324
325         Reviewed by Youenn Fablet.
326
327         No new tests, AVCapture can only be tested manually.
328
329         * platform/mediastream/mac/AVCaptureDeviceManager.h:
330         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
331         (WebCore::AVCaptureDeviceManager::captureDevicesInternal): Don't notify of devices "changes"
332         the first time the device list is scanned.
333         (WebCore::deviceIsAvailable): Don't check for "isInUseByAnotherApplication", it doesn't
334         change device availability.
335         (WebCore::AVCaptureDeviceManager::beginObservingDevices): New, observe "suspended" on all 
336         devices and add them to the cached list.
337         (WebCore::AVCaptureDeviceManager::stopObservingDevices): New, opposite of above.
338         (WebCore::AVCaptureDeviceManager::refreshCaptureDevices): Watch for changes in the list of
339         devices.
340         (WebCore::AVCaptureDeviceManager::~AVCaptureDeviceManager): Stop observing all cached devices.
341         (WebCore::AVCaptureDeviceManager::registerForDeviceNotifications):
342         (-[WebCoreAVCaptureDeviceManagerObserver disconnect]):
343         (-[WebCoreAVCaptureDeviceManagerObserver deviceConnectedDidChange:]):
344         (-[WebCoreAVCaptureDeviceManagerObserver observeValueForKeyPath:ofObject:change:context:]):
345         (WebCore::AVCaptureDeviceManager::refreshAVCaptureDevicesOfType): Deleted.
346         (WebCore::AVCaptureDeviceManager::deviceConnected): Deleted.
347         (WebCore::AVCaptureDeviceManager::deviceDisconnected): Deleted.
348         (-[WebCoreAVCaptureDeviceManagerObserver deviceDisconnected:]): Deleted.
349         (-[WebCoreAVCaptureDeviceManagerObserver deviceConnected:]): Deleted.
350
351         * platform/mediastream/mac/AVVideoCaptureSource.h:
352         * platform/mediastream/mac/AVVideoCaptureSource.mm:
353         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource): Stop observing "running" (not "rate")
354         and "suspended".
355         (WebCore::AVVideoCaptureSource::setupSession): Observe "running" (not "rate"), and "suspended".
356         (WebCore::AVVideoCaptureSource::captureDeviceSuspendedDidChange):
357         (-[WebCoreAVVideoCaptureSourceObserver observeValueForKeyPath:ofObject:change:context:]):
358
359 2018-11-13  Devin Rousso  <drousso@apple.com>
360
361         Web Inspector: REGRESSION(r238122): fetching the CertificateInfo triggers an ASSERT in workers
362         https://bugs.webkit.org/show_bug.cgi?id=191597
363
364         Reviewed by Joseph Pecoraro.
365
366         When WebInspector is open, the `CertificateInfo` for every `ResourceResponse` is now fetched,
367         meaning that we may try to fetch in situations previously unexpected.
368
369         * platform/network/cocoa/ResourceResponseCocoa.mm:
370         (WebCore::ResourceResponse::platformCertificateInfo const):
371
372 2018-11-13  Timothy Hatcher  <timothy@apple.com>
373
374         Treat supported-color-schemes as the second highest priority property.
375         https://bugs.webkit.org/show_bug.cgi?id=191556
376         rdar://problem/46000076
377
378         Reviewed by Dean Jackson.
379
380         Test: css-dark-mode/supported-color-schemes-priority.html
381
382         * css/CSSProperties.json: Make supported-color-schemes high-priority and add a comment.
383         * css/StyleResolver.cpp:
384         (WebCore::StyleResolver::applyMatchedProperties): Manually handle supported-color-schemes
385         after -webkit-ruby-position, before other properties, so it can affect resolved colors.
386
387 2018-11-13  Charlie Turner  <cturner@igalia.com>
388
389         [EME][GStreamer] Make CDMInstance's available in decryptors, and factor out some EME utility classes.
390         https://bugs.webkit.org/show_bug.cgi?id=191316
391
392         Reviewed by Xabier Rodriguez-Calvar.
393
394         Another preparation in patch getting ready to move the decryption
395         logic behind the CDMInstance and out of the GStreamer decryptors
396         themselves. The first step taken here is to arrange for the
397         instances to always be available in the decryptors when they need
398         to decrypt content.
399
400         In doing so, there were a number of hairy bits of code that could
401         use some abstraction, so the opportunity was taken to do that as
402         well.
403
404         Covered by tests in media/encrypted-media and
405         imported/w3c/web-platform-tests/encrypted-media.
406
407         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
408         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Remove
409         drm-key-needed since it was not being used anywhere.
410         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
411         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
412         Factor out the parsing of decryption system information from
413         GStreamer, since it was not clear what that code was doing unless
414         you squinted pretty hard. Also remove the duplicated
415         initialization-data-encountered posting.
416         (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
417         Refactored to make it a more general method and usable in more
418         situations. It now has an optional to stop it from eliding init
419         datas for a different key system. This is required the first time
420         we post them, since if a CDM instance has already been set, and if
421         the stream init datas are for different systems, we ended up never
422         posting an encrypted event.
423         (WebCore::MediaPlayerPrivateGStreamerBase::attemptToDecryptWithLocalInstance):
424         Actually send a CDMInstance now when in regular playback mode.
425         (WebCore::MediaPlayerPrivateGStreamerBase::dispatchDecryptionKey):
426         Remove m_needToSendCredentials, it was not being used.
427         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
428         Refactored to use the new initializationDataEncountered.
429         (WebCore::MediaPlayerPrivateGStreamerBase::reportWaitingForKey):
430         Log the waiting state, since it was currently not clear what that
431         logging message was even telling you!
432         (WebCore::extractEventsAndSystemsFromMessage): Deleted.
433         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
434         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
435         (WebCore::InitData::InitData): New class that encapsulates both
436         single instantiation and streaming instantiation.
437         (WebCore::InitData::append): Used for the streaming mode, when you
438         are concatenating init datas together.
439         (WebCore::InitData::payload const):
440         (WebCore::InitData::systemId const):
441         (WebCore::InitData::payloadContainerType const):
442         (WebCore::InitData::isFromDifferentContainer):
443         (WebCore::ProtectionSystemEvents::ProtectionSystemEvents):
444         (WebCore::ProtectionSystemEvents::events const):
445         (WebCore::ProtectionSystemEvents::availableSystems const):
446         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
447         (webkitMediaCommonEncryptionDecryptTransformInPlace): If you post
448         waiting-for-key after requesting a CDM instance, it will flap back
449         to not waiting for a key almost immediately, didn't make sense
450         positing after requesting an instance. Also post key-received when
451         we receive the key.
452         (webkitMediaCommonEncryptionDecryptSinkEventHandler): It has now
453         been arranged that a CDMInstance will always be present in an OOB
454         message, so parse it out here.
455         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
456         (WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
457         As above, make sure when posting the OOB that a CDMInstance is present.
458
459 2018-11-13  Charlie Turner  <cturner@igalia.com>
460
461         Various compiler warnings/errors fixes.
462         https://bugs.webkit.org/show_bug.cgi?id=191583
463
464         Reviewed by Frédéric Wang.
465
466         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
467         (WebCore::IDBServer::MemoryIDBBackingStore::clearObjectStore):
468         ASSERT is only compiled in DEBUG mode, so guarding with
469         !LOG_DISABLED is wrong.
470         * rendering/RenderLayerCompositor.cpp:
471         (WebCore::RenderLayerCompositor::updateCompositingLayers):
472         showPaintOrderTree is only compiled in ENABLE(TREE_DEBUGGING)
473         mode, so guarding with !LOG_DISABLED was wrong.
474         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
475         Ditto, this time with member .depth.
476         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): Ditto.
477         * rendering/svg/SVGRenderSupport.cpp:
478         (WebCore::SVGRenderSupport::styleChanged): Add another unused
479         parameter.
480
481 2018-11-12  Antoine Quint  <graouts@apple.com>
482
483         [Web Animations] Don't schedule animation frames or update style while an accelerated animation is running
484         https://bugs.webkit.org/show_bug.cgi?id=191542
485         <rdar://problem/45356027>
486
487         Reviewed by Simon Fraser.
488
489         Test: animations/no-style-recalc-during-accelerated-animation.html
490
491         In order to be more power-efficient, we stop scheduling calls to updateAnimationsAndSendEvents() when running only accelerated
492         animations. To do that, we prevent scheduling further animation resolution if we're in the process of updating animations, and
493         when we are done, call the new DocumentTimeline::scheduleNextTick() method that will check whether we have only accelerated
494         animations running, and in that case check which of those animations needs an update the soonest and starts a timer scheduled
495         for that time when we'll schedule animation resolution.
496
497         By default, animations compute the time until their natural completion but in the case of CSS Animations, we want to make sure
498         we also update animations in-flight to dispatch "animationiteration" events.
499
500         * animation/AnimationEffect.h: Make the simpleIterationProgress() public so it can be called by WebAnimation::timeToNextTick().
501         * animation/DocumentTimeline.cpp:
502         (WebCore::DocumentTimeline::DocumentTimeline): Create the m_tickScheduleTimer and set it up to call scheduleAnimationResolutionIfNeeded().
503         (WebCore::DocumentTimeline::suspendAnimations): If we don't already have a cached current time, cache the current time.
504         (WebCore::DocumentTimeline::resumeAnimations): Reset the cached current time to ensure we'll get a fresh one when updating animations next.
505         (WebCore::DocumentTimeline::liveCurrentTime const): Factor the code to compute the current time out of currentTime() so that we can
506         cache the current time in suspendAnimations() without also automatically clearing the current time.
507         (WebCore::DocumentTimeline::currentTime): Use liveCurrentTime() and cacheCurrentTime() since much of the code from this function has been
508         factored out into those. Additionally, we were failing to clear the current time if called inside an animation frame, which we now do correctly
509         by virtue of using cacheCurrentTime(). This fixes some flakiness.
510         (WebCore::DocumentTimeline::cacheCurrentTime): Factor the code to cache the current time out of currentTime(). 
511         (WebCore::DocumentTimeline::maybeClearCachedCurrentTime): No need to clear the current time if we get suspended.
512         (WebCore::DocumentTimeline::scheduleAnimationResolutionIfNeeded): Prevent scheduling an animation update if we're in the middle of one already,
513         scheduleNextTick() will be called after animations are updated to see if we should schedule an animation update instead.
514         (WebCore::DocumentTimeline::unscheduleAnimationResolution): Cancel the m_tickScheduleTimer if we need to unschedule animation resolution.
515         (WebCore::DocumentTimeline::animationResolutionTimerFired): Factor the call to applyPendingAcceleratedAnimations() out of updateAnimationsAndSendEvents()
516         and call scheduleNextTick().
517         (WebCore::DocumentTimeline::updateAnimationsAndSendEvents): Set the new m_isUpdatingAnimations member variable to true while this function is running.
518         (WebCore::DocumentTimeline::scheduleNextTick): Schedule an animation update immediately if we have any relevant animation that is not accelerated.
519         Otherwise, iterate through all animations to figure out the earliest moment at which we need to update animations.
520         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement): Use the new WebAnimation::isRunningAccelerated() function.
521         * animation/DocumentTimeline.h:
522         * animation/WebAnimation.cpp:
523         (WebCore::WebAnimation::isRunningAccelerated const): Since we end up checking if an animation is running with an accelerated effect, we introduce a new
524         function to get that information directly through the WebAnimation object without bothering about its effect.
525         (WebCore::WebAnimation::resolve): We should only call updateFinishedState() here since timingDidChange() would also notify the timeline about a potential
526         change in relevance, which is not necessary and which would schedule an animation frame even for animations that are accelerated.
527         (WebCore::WebAnimation::timeToNextTick const): Compute the time until our animation completion or, in the case of CSS animations, the next iteration.
528         * animation/WebAnimation.h:
529
530 2018-11-13  Miguel Gomez  <magomez@igalia.com>
531
532         [GTK][WPE] Incorrect tile coverage when resizing a layer out of the visible area
533         https://bugs.webkit.org/show_bug.cgi?id=191545
534
535         Reviewed by Žan Doberšek.
536
537         Keep track of layer size changes even if they happen when the layer is not in the visible
538         area, so we can update edge tiles when the layer gets visible.
539
540         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
541         (WebCore::TiledBackingStore::createTiles):
542         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
543
544 2018-11-12  Rob Buis  <rbuis@igalia.com>
545
546         Content-Type parameter values should allow empty quoted strings
547         https://bugs.webkit.org/show_bug.cgi?id=191388
548
549         Reviewed by Dean Jackson.
550
551         According to RFC 2045 and https://mimesniff.spec.whatwg.org/#parsing-a-mime-type empty
552         quoted strings are acceptable for Content-Type parameter values. They
553         are accepted by Firefox and Chrome implementations as well.
554
555         Test: web-platform-tests/xhr/overridemimetype-blob.html
556
557         * platform/network/ParsedContentType.cpp:
558         (WebCore::parseToken):
559         (WebCore::parseQuotedString):
560         (WebCore::parseContentType):
561         * platform/network/ParsedContentType.h:
562
563 2018-11-12  Christopher Reid  <chris.reid@sony.com>
564
565         [Curl] Reject entire cookie if the domain fails a tailmatch.
566         https://bugs.webkit.org/show_bug.cgi?id=191406
567
568         Reviewed by Youenn Fablet.
569
570         Currently we don't put domain attribute of cookie when it fails a tailmatch. As Firefox
571         and Chrome do, we are going to reject the entire cookie if the domain fails a tailmatch instead.
572         Also cleanup Cookie database implementation to make them testable better.
573
574         Tests: TestWebKitAPI/Tests/WebCore/curl/Cookies.cpp
575
576         * platform/network/curl/CookieJarDB.cpp:
577         (WebCore::CookieJarDB::canAcceptCookie): Added.
578         (WebCore::CookieJarDB::setCookie):
579         * platform/network/curl/CookieUtil.cpp:
580         (WebCore::CookieUtil::parseCookieAttributes):
581         (WebCore::CookieUtil::parseCookieHeader):
582         * platform/network/curl/CookieUtil.h:
583
584 2018-11-12  Devin Rousso  <drousso@apple.com>
585
586         Web Inspector: Network: show secure certificate details per-request
587         https://bugs.webkit.org/show_bug.cgi?id=191447
588         <rdar://problem/30019476>
589
590         Reviewed by Joseph Pecoraro.
591
592         Test: http/tests/inspector/network/resource-response-security.html
593
594         * loader/ResourceLoader.h:
595         (WebCore::ResourceLoader::shouldIncludeCertificateInfo const):
596         * loader/ResourceLoader.cpp:
597         (WebCore::ResourceLoader::shouldIncludeCertificateInfo const): Added.
598         Always save certificate information when WebInspector is open.
599
600         * platform/network/CertificateInfoBase.h: Added.
601         (WebCore::CertificateInfoBase::containsNonRootSHA1SignedCertificate const):
602         (WebCore::CertificateInfoBase::summaryInfo const):
603         (WebCore::CertificateInfoBase::isEmpty const):
604         * platform/network/cf/CertificateInfo.h:
605         (WebCore::CertificateInfo::summaryInfo const): Added.
606         * platform/network/cf/CertificateInfoCFNet.cpp: Renamed from Source/WebCore/platform/network/mac/CertificateInfoMac.mm.
607         (WebCore::CertificateInfo::containsNonRootSHA1SignedCertificate):
608         (WebCore::CertificateInfo::summaryInfo const): Added.
609         * platform/network/curl/CertificateInfo.h:
610         (WebCore::CertificateInfo::summaryInfo const): Added.
611         (WebCore::CertificateInfo::isEmpty const): Added.
612         * platform/network/soup/CertificateInfo.h:
613         (WebCore::CertificateInfo::summaryInfo const): Added.
614         (WebCore::CertificateInfo::isEmpty const): Added.
615         Create base class for `CertificateInfo` so that `InspectorNetworkAgent` doesn't need to have
616         platform-specific code in its implementation.
617
618         * platform/network/cocoa/CertificateInfoCocoa.mm: Renamed from Source/WebCore/platform/network/mac/CertificateInfoMac.mm.
619         * platform/network/curl/CertificateInfoCFNet.cpp: Renamed from Source/WebCore/platform/network/curl/CertificateInfo.cpp.
620         * platform/network/soup/CertificateInfoSoup.cpp: Renamed from Source/WebCore/platform/network/soup/CertificateInfo.cpp.
621
622         * inspector/NetworkResourcesData.h:
623         (WebCore::NetworkResourcesData::ResourceData::certificateInfo const): Added.
624         (WebCore::NetworkResourcesData::ResourceData::setCertificateInfo): Added.
625         * inspector/NetworkResourcesData.cpp:
626         (WebCore::NetworkResourcesData::responseReceived):
627
628         * inspector/agents/InspectorNetworkAgent.cpp:
629         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
630
631         * PlatformAppleWin.cmake:
632         * PlatformMac.cmake:
633         * SourcesCocoa.txt:
634         * WebCore.xcodeproj/project.pbxproj:
635         * platform/Curl.cmake:
636         * platform/SourcesSoup.txt:
637
638 2018-11-12  Zalan Bujtas  <zalan@apple.com>
639
640         Do not collapse the soon-to-be-parent anon block when we shuffle around the marker item renderer.
641         https://bugs.webkit.org/show_bug.cgi?id=191554
642         <rdar://problem/45825265>
643
644         Reviewed by Antti Koivisto.
645
646         While moving the marker item renderer to its correct subtree, we accidentally remove the soon-to-be parent anonymous block.
647         Moving a renderer is a 2 step process:
648         1. Detach the renderer from its current parent
649         2. Attach it to its new parent.
650         During step #1, we check if there is a chance to collapse anonymous blocks. In this case the soon-to-be-parent is a sibling anonymous block which, after detaching the marker sibling
651         is not needed anymore (except we use it as the new parent).
652
653         Test: fast/inline/marker-list-item-move-should-not-crash.html
654
655         * rendering/updating/RenderTreeBuilder.cpp:
656         (WebCore::RenderTreeBuilder::detach):
657         * rendering/updating/RenderTreeBuilder.h:
658         * rendering/updating/RenderTreeBuilderBlock.cpp:
659         (WebCore::RenderTreeBuilder::Block::detach):
660         * rendering/updating/RenderTreeBuilderBlock.h:
661         * rendering/updating/RenderTreeBuilderList.cpp:
662         (WebCore::RenderTreeBuilder::List::updateItemMarker):
663
664 2018-11-12  Javier Fernandez  <jfernandez@igalia.com>
665
666         [css-grid] Refactoring to make more explicit the orthogonal items' pre-layout logic
667         https://bugs.webkit.org/show_bug.cgi?id=191358
668
669         Reviewed by Manuel Rego Casasnovas.
670
671         These changes are just a refactoring to ease the integration of the new Baseline Alignment
672         logic in a follow up patch.
673
674         We need to properly estimate the grid area size of orthogonal items so that we can perform
675         an accurate pre-layout. This is important because orthogonal items will synthesize their baseline
676         if they participate in any baseline alignment context.
677
678         No new tests, since no behavior change has been introduced in this patch.
679
680         * rendering/Grid.cpp:
681         (WebCore::Grid::setNeedsItemsPlacement):
682         * rendering/Grid.h:
683         * rendering/GridTrackSizingAlgorithm.cpp:
684         (WebCore::GridTrackSizingAlgorithm::estimatedGridAreaBreadthForChild const):
685         (WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild const):
686         (WebCore::GridTrackSizingAlgorithm::isRelativeGridLengthAsAuto const):
687         (WebCore::GridTrackSizingAlgorithm::isRelativeSizedTrackAsAuto const):
688         (WebCore::GridTrackSizingAlgorithm::gridTrackSize const):
689         (WebCore::IndefiniteSizeStrategy::findUsedFlexFraction const):
690         (WebCore::GridTrackSizingAlgorithm::run):
691         (WebCore::GridTrackSizingAlgorithm::reset):
692         * rendering/GridTrackSizingAlgorithm.h:
693         (WebCore::GridTrackSizingAlgorithmStrategy::gridTrackSize const):
694         * rendering/RenderGrid.cpp:
695         (WebCore::RenderGrid::repeatTracksSizingIfNeeded):
696         (WebCore::RenderGrid::layoutBlock):
697         (WebCore::RenderGrid::computeIntrinsicLogicalWidths const):
698         (WebCore::RenderGrid::computeTrackSizesForIndefiniteSize const):
699         (WebCore::RenderGrid::placeItemsOnGrid const):
700         (WebCore::RenderGrid::performGridItemsPreLayout const):
701         (WebCore::overrideSizeChanged):
702         (WebCore::hasRelativeBlockAxisSize):
703         (WebCore::RenderGrid::updateGridAreaLogicalSize const):
704         (WebCore::RenderGrid::layoutGridItems):
705         * rendering/RenderGrid.h:
706
707 2018-11-12  Sihui Liu  <sihui_liu@apple.com>
708
709         imported/w3c/web-platform-tests/IndexedDB/keygenerator-explicit.html crashing on iOS device
710         https://bugs.webkit.org/show_bug.cgi?id=191500
711
712         Reviewed by Dean Jackson.
713
714         When double value is bigger than maximum unsigned int, converting double to unsigned int has
715         different behaviors on macOS and iOS. On macOS, the result would be 0 while on iOS it would be
716         maximum unsigned int.
717
718         Covered by existing test.
719
720         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
721         (WebCore::IDBServer::SQLiteIDBBackingStore::generateKeyNumber):
722         (WebCore::IDBServer::SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber):
723
724 2018-11-12  Basuke Suzuki  <basuke.suzuki@sony.com>
725
726         [Curl] Add API Test for Curl cookie backend.
727         https://bugs.webkit.org/show_bug.cgi?id=191493
728
729         Reviewed by Youenn Fablet.
730
731         Refactoring for cookie backend interface.
732
733         Tests: TestWebKitAPI/Tests/WebCore/curl/Cookies.cpp
734
735         * platform/FileSystem.h:
736         * platform/network/curl/CookieJarCurlDatabase.cpp:
737         (WebCore::cookiesForSession):
738         (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const):
739         (WebCore::CookieJarCurlDatabase::setCookiesFromHTTPResponse const):
740         (WebCore::CookieJarCurlDatabase::getRawCookies const):
741         * platform/network/curl/CookieJarDB.cpp:
742         (WebCore::CookieJarDB::openDatabase):
743         (WebCore::CookieJarDB::checkSQLiteReturnCode):
744         (WebCore::CookieJarDB::isEnabled const):
745         (WebCore::CookieJarDB::searchCookies):
746         (WebCore::CookieJarDB::setCookie):
747         (WebCore::CookieJarDB::deleteCookie):
748         (WebCore::CookieJarDB::deleteCookieInternal):
749         (WebCore::CookieJarDB::deleteCookies):
750         (WebCore::CookieJarDB::deleteAllCookies):
751         (WebCore::CookieJarDB::executeSimpleSql):
752         (WebCore::CookieJarDB::isEnabled): Deleted.
753         * platform/network/curl/CookieJarDB.h:
754         * platform/network/curl/CookieUtil.cpp:
755         (WebCore::CookieUtil::parseCookieHeader):
756         * platform/network/curl/CookieUtil.h:
757         * platform/win/FileSystemWin.cpp:
758         (WebCore::FileSystem::generateTemporaryPath):
759         (WebCore::FileSystem::openTemporaryFile):
760         (WebCore::FileSystem::createTemporaryDirectory):
761         (WebCore::FileSystem::deleteNonEmptyDirectory):
762
763 2018-11-12  Tim Horton  <timothy_horton@apple.com>
764
765         Make it possible to edit images inline
766         https://bugs.webkit.org/show_bug.cgi?id=191352
767         <rdar://problem/30107985>
768
769         Reviewed by Dean Jackson.
770
771         Tests: editing/images/basic-editable-image.html
772                editing/images/reparent-editable-image-maintains-strokes.html
773
774         Add the beginnings of a mechanism to replace images with a special attribute
775         with a native drawing view in the UI process.
776
777         * page/Settings.yaml:
778         Add a setting to control whether images become natively editable when they
779         have the x-apple-editable-image attribute.
780
781         * html/HTMLImageElement.cpp:
782         (WebCore::HTMLImageElement::editableImageViewID const):
783         Lazily generate an EmbeddedViewID and persist it on the <img> element.
784
785         * html/HTMLImageElement.h:
786         Rearrange the service controls methods to sit before the members.
787         Add m_editableImageViewID and editableImageViewID().
788
789         * platform/graphics/GraphicsLayer.cpp:
790         (WebCore::GraphicsLayer::nextEmbeddedViewID):
791         * platform/graphics/GraphicsLayer.h:
792         (WebCore::GraphicsLayer::setContentsToEmbeddedView):
793         Add a new ContentsLayerPurpose, EmbeddedView, which is only supported
794         on Cocoa platforms and when using RemoteLayerTree.
795         Add ContentsLayerEmbeddedViewType, which currently only has the EditableImage type.
796         Add setContentsToEmbeddedView, which takes a ContentsLayerEmbeddedViewType
797         and an EmbeddedViewID to uniquely identify and communicate about the
798         embedded view (which may move between layers, since it is tied to an element).
799
800         * platform/graphics/ca/GraphicsLayerCA.cpp:
801         (WebCore::GraphicsLayerCA::createPlatformCALayerForEmbeddedView):
802         (WebCore::GraphicsLayerCA::setContentsToEmbeddedView):
803         When setting GraphicsLayer's contents to an embedded view, we use
804         a special PlatformCALayer factory that takes the EmbeddedViewID and type.
805         GraphicsLayerCARemote will override this and make a correctly-initialized
806         PlatformCALayerRemote that keeps track of the EmbeddedViewID.
807
808         * platform/graphics/ca/GraphicsLayerCA.h:
809         * platform/graphics/ca/PlatformCALayer.cpp:
810         (WebCore::operator<<):
811         * platform/graphics/ca/PlatformCALayer.h:
812         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
813         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
814         (WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa):
815         (WebCore::PlatformCALayerCocoa::embeddedViewID const):
816         Add stubs and logging for EmbeddedViewID on PlatformCALayer.
817         These will be overridden by PlatformCALayerRemote to do more interesting things.
818
819         * rendering/RenderImage.cpp:
820         (WebCore::RenderImage::isEditableImage const):
821         Add a getter that return true if the setting is enabled and
822         x-apple-editable-image is empty or true.
823
824         (WebCore::RenderImage::requiresLayer const):
825         RenderImage requires a layer either if RenderReplaced does, or we are an
826         editable image.
827
828         * rendering/RenderImage.h:
829         * rendering/RenderLayer.cpp:
830         (WebCore::RenderLayer::shouldBeNormalFlowOnly const):
831         (WebCore::RenderLayer::calculateClipRects const):
832         * rendering/RenderLayerBacking.cpp:
833         (WebCore::RenderLayerBacking::updateConfiguration):
834         Push the EmbeddedViewID and type down to GraphicsLayer for editable images.
835
836         * rendering/RenderLayerCompositor.cpp:
837         (WebCore::RenderLayerCompositor::requiresCompositingLayer const):
838         (WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
839         (WebCore::RenderLayerCompositor::reasonsForCompositing const):
840         (WebCore::RenderLayerCompositor::requiresCompositingForEditableImage const):
841         * rendering/RenderLayerCompositor.h:
842         Make editable images require compositing implicitly.
843
844 2018-11-12  Don Olmstead  <don.olmstead@sony.com>
845
846         Shipped PNGs include bad profiles: iCCP: known incorrect sRGB profile
847         https://bugs.webkit.org/show_bug.cgi?id=189230
848         <rdar://problem/44050379>
849
850         Reviewed by Joseph Pecoraro.
851
852         Runs all png images through zopflipng. This results in a smaller file
853         size and takes care of this issue as a byproduct.
854
855         * Modules/modern-media-controls/images/iOS/airplay-placard@1x.png:
856         * Modules/modern-media-controls/images/iOS/airplay-placard@2x.png:
857         * Modules/modern-media-controls/images/iOS/airplay-placard@3x.png:
858         * Modules/modern-media-controls/images/iOS/invalid-placard@1x.png:
859         * Modules/modern-media-controls/images/iOS/invalid-placard@2x.png:
860         * Modules/modern-media-controls/images/iOS/invalid-placard@3x.png:
861         * Modules/modern-media-controls/images/iOS/pip-placard@1x.png:
862         * Modules/modern-media-controls/images/iOS/pip-placard@2x.png:
863         * Modules/modern-media-controls/images/iOS/pip-placard@3x.png:
864         * Modules/modern-media-controls/images/macOS/airplay-placard@1x.png:
865         * Modules/modern-media-controls/images/macOS/airplay-placard@2x.png:
866         * Modules/modern-media-controls/images/macOS/invalid-placard@1x.png:
867         * Modules/modern-media-controls/images/macOS/invalid-placard@2x.png:
868         * Modules/modern-media-controls/images/macOS/pip-placard@1x.png:
869         * Modules/modern-media-controls/images/macOS/pip-placard@2x.png:
870         * Resources/AttachmentPlaceholder.png:
871         * Resources/AttachmentPlaceholder@2x.png:
872         * Resources/ListButtonArrow.png:
873         * Resources/ListButtonArrow@2x.png:
874         * Resources/missingImage.png:
875         * Resources/missingImage@2x.png:
876         * Resources/missingImage@3x.png:
877         * Resources/moveCursor.png:
878         * Resources/northEastSouthWestResizeCursor.png:
879         * Resources/northSouthResizeCursor.png:
880         * Resources/northWestSouthEastResizeCursor.png:
881         * Resources/nullPlugin.png:
882         * Resources/nullPlugin@2x.png:
883         * Resources/panIcon.png:
884         * Resources/textAreaResizeCorner.png:
885         * Resources/textAreaResizeCorner@2x.png:
886         * Resources/urlIcon.png:
887
888 2018-11-12  Youenn Fablet  <youenn@apple.com>
889
890         RealtimeOutgoing A/V sources should observe their sources only if having a sink
891         https://bugs.webkit.org/show_bug.cgi?id=191490
892
893         Reviewed by Eric Carlson.
894
895         Observe the source that generates media based on the sinks:
896         - Do not observe at creation time
897         - For first sink, start observing
898         - When no more sink, stop observing
899         Apply this principle for both outgoing audio and video sources.
900         Add locks for the sinks to ensure thread-safety.
901         Make sinks HashSet which is more robust.
902
903         Do some refactoring to better isolate generic outgoing sources from Cocoa/GTK implementations.
904
905         Covered by existing tests and updated webrtc/remove-track.html.
906
907         * platform/mediastream/RealtimeOutgoingAudioSource.cpp:
908         (WebCore::RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource):
909         (WebCore::RealtimeOutgoingAudioSource::stop):
910         (WebCore::RealtimeOutgoingAudioSource::AddSink):
911         (WebCore::RealtimeOutgoingAudioSource::RemoveSink):
912         (WebCore::RealtimeOutgoingAudioSource::sendAudioFrames):
913         * platform/mediastream/RealtimeOutgoingAudioSource.h:
914         * platform/mediastream/RealtimeOutgoingVideoSource.cpp:
915         (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
916         (WebCore::RealtimeOutgoingVideoSource::~RealtimeOutgoingVideoSource):
917         (WebCore::RealtimeOutgoingVideoSource::observeSource):
918         (WebCore::RealtimeOutgoingVideoSource::setSource):
919         (WebCore::RealtimeOutgoingVideoSource::stop):
920         (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink):
921         (WebCore::RealtimeOutgoingVideoSource::RemoveSink):
922         * platform/mediastream/RealtimeOutgoingVideoSource.h:
923         (WebCore::RealtimeOutgoingVideoSource::isSilenced const):
924         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
925         (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData):
926         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp:
927         (WebCore::RealtimeOutgoingAudioSourceCocoa::RealtimeOutgoingAudioSourceCocoa):
928         (WebCore::RealtimeOutgoingAudioSourceCocoa::audioSamplesAvailable):
929         (WebCore::RealtimeOutgoingAudioSourceCocoa::pullAudioData):
930         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h:
931         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
932         (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated):
933
934 2018-11-12  Youenn Fablet  <youenn@apple.com>
935
936         Support setting stream ids when adding a transceiver
937         https://bugs.webkit.org/show_bug.cgi?id=191307
938
939         Reviewed by Eric Carlson.
940
941         Add support for streams in RTCTransceiverInit.
942         Add plumbing down to libwebrtc.
943         Covered by rebased tests.
944
945         * Modules/mediastream/RTCPeerConnection.h:
946         * Modules/mediastream/RTCPeerConnection.idl:
947         * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
948         (WebCore::fromRtpTransceiverInit):
949
950 2018-11-12  Antti Koivisto  <antti@apple.com>
951
952         Support dynamic pseudo-classes on elements with display: contents
953         https://bugs.webkit.org/show_bug.cgi?id=181640
954         <rdar://problem/36605415>
955
956         Reviewed by Dean Jackson.
957
958         The code for :hover and :active style invalidation assumes that only elements with renderer need invalidation.
959
960         This patch fixes '.display-content-element:hover span' case but not '.display-content-element:hover' case but
961         includes tests for both. The latter is not super useful anyway (as it only affects rendering with inherited
962         text properties).
963
964         Test: fast/css/display-contents-hover-active.html
965
966         * dom/Document.cpp:
967         (WebCore::Document::updateHoverActiveState):
968
969             Traverse up in composed tree instead of render tree when invalidating. This has the same order as render tree
970             but also includes display:content elements. This also allows removing the special display:none case.
971
972         * dom/Element.cpp:
973         (WebCore::Element::setActive):
974         (WebCore::Element::setHovered):
975
976             Also look into display:contents style for invalidation checks.
977
978         (WebCore::Element::renderOrDisplayContentsStyle const):
979
980             Make this helper an Element member.
981
982         * dom/Element.h:
983         * dom/Node.cpp:
984         (WebCore::Node::parentElementInComposedTree const):
985
986             Support starting from a PseudoElement. This is consistent with ComposedTreeAncestorIterator.
987
988         * rendering/updating/RenderTreePosition.cpp:
989         (WebCore::RenderTreePosition::nextSiblingRenderer const):
990         * style/StyleTreeResolver.cpp:
991         (WebCore::Style::TreeResolver::resolveElement):
992         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
993         (WebCore::Style::shouldResolveElement):
994         (WebCore::Style::TreeResolver::resolveComposedTree):
995         (WebCore::Style::renderOrDisplayContentsStyle): Deleted.
996
997             Use the Element::renderOrDisplayContentsStyle() instead.
998
999 2018-11-12  Antoine Quint  <graouts@apple.com>
1000
1001         [Web Animations] Turn Web Animations experimental
1002         https://bugs.webkit.org/show_bug.cgi?id=191543
1003
1004         Reviewed by Dean Jackson.
1005
1006         * page/RuntimeEnabledFeatures.h:
1007
1008 2018-11-12  Simon Fraser  <simon.fraser@apple.com>
1009
1010         feFlood with alpha color doesn't work correctly
1011         https://bugs.webkit.org/show_bug.cgi?id=163666
1012
1013         Reviewed by Zalan Bujtas.
1014         
1015         FEFlood::platformApplySoftware() erroneously used colorWithOverrideAlpha()
1016         rather than multiplying the flood color with the flood opacity as other browsers do.
1017
1018         Test: svg/filters/feFlood-with-alpha-color.html
1019
1020         * platform/graphics/Color.cpp:
1021         (WebCore::Color::colorWithAlpha const): I tried using colorWithAlphaMultipliedBy() elsewhere,
1022         and it triggered a behavior change, so add a comment.
1023         * platform/graphics/filters/FEFlood.cpp:
1024         (WebCore::FEFlood::platformApplySoftware):
1025         * svg/SVGStopElement.cpp:
1026         (WebCore::SVGStopElement::stopColorIncludingOpacity const):
1027
1028 2018-11-12  Eric Carlson  <eric.carlson@apple.com>
1029
1030         Require <iframe allow="display"> for an iframe to use getDisplayMedia
1031         https://bugs.webkit.org/show_bug.cgi?id=191505
1032         <rdar://problem/45968811>
1033
1034         Reviewed by Jer Noble.
1035
1036         Test: http/tests/media/media-stream/get-display-media-iframe-allow-attribute.html
1037
1038         * Modules/mediastream/MediaDevicesRequest.cpp:
1039         (WebCore::MediaDevicesRequest::start):
1040         * Modules/mediastream/UserMediaController.cpp:
1041         (WebCore::isAllowedToUse):
1042         (WebCore::UserMediaController::canCallGetUserMedia):
1043         (WebCore::UserMediaController::logGetUserMediaDenial):
1044         * Modules/mediastream/UserMediaController.h:
1045         * Modules/mediastream/UserMediaRequest.cpp:
1046         (WebCore::UserMediaRequest::start):
1047
1048 2018-11-12  Simon Fraser  <simon.fraser@apple.com>
1049
1050         Make compositing updates incremental
1051         https://bugs.webkit.org/show_bug.cgi?id=90342
1052
1053         Reviewed by Antti Koivisto.
1054
1055         Previously, updating compositing layers required two full RenderLayer tree traversals,
1056         and all the work was done for every RenderLayer on each composting update. This could be expensive
1057         on pages with lots of RenderLayers.
1058
1059         These changes make compositing updates more incremental. Compositing updates still require
1060         two tree traversals. The first determines which RenderLayers need to be composited (of those which
1061         weren't already made composited at style-change time), because of reasons that can only be determined
1062         post-layout, and indirect reasons including overlap. The second traversal updates the configuration, geometry
1063         and GraphicsLayer tree for the composited layers. Dependencies on both descendant and ancestor state make
1064         it hard to fold these two traversals together.
1065
1066         In order to minimize the work done during these traversals, dirty bits are stored on RenderLayers,
1067         and propagated to ancestor layers in paint order. There are two sets of bits: those related to the first
1068         "compositing requirements" traversal, and those related to the second "update backing and hierarchy" traversal.
1069         When a RenderLayer gets a dirty bit set, bits are propagated to ancestors to indicate that children need
1070         to be visited.
1071
1072         Sadly entire subtrees can't be skipped during the "compositing requirements" traversal because we still have
1073         to accumulate overlap rects, but RenderLayerCompositor::traverseUnchangedSubtree() is used to minimize
1074         work in that case. Subtrees can be skipped in the "update backing and hierarchy" traversal. Entire traversals can
1075         be skipped if no change has triggered the need for that traversal.
1076         
1077         These changes fix a correctness issue where transform changes now trigger overlap re-evaluation, which causes
1078         more layer geometry updates than before. This regressed the MotionMark "Focus" test, when geometry updates
1079         triggered layer resizes as the filter blur radius changed, which then triggered repaints. This is fixed by
1080         excluding composited filters from the composited bounds (but still taking them into account for overlap).
1081
1082         Care is taken to avoid triggering traversals in non-composited documents (tested by no-updates-in-non-composited-iframe.html).
1083
1084         Code to set the dirty bits is added in various places that change properties that compositing depends on.
1085         
1086         These changes also subsume the patch in 176196; we now never consult properties that rely on layout from the
1087         style change code path, and the only call stack for geometry updates is from the "update backing and hierarchy"
1088         traversal, which is always a pre-order traversal.
1089
1090         Tests: compositing/geometry/stacking-context-change-layer-reparent.html
1091                compositing/layer-creation/change-to-overlap.html
1092                compositing/updates/no-updates-in-non-composited-iframe.html
1093
1094         * html/canvas/WebGLRenderingContextBase.cpp:
1095         (WebCore::WebGLRenderingContextBase::markContextChanged): Need to differentiate between a canvas becoming composited
1096         for the first time, and its pixels changing with a new 'CanvasPixelsChanged' value.
1097         * page/FrameView.cpp:
1098         (WebCore::FrameView::setViewportConstrainedObjectsNeedLayout):
1099         * page/Page.cpp:
1100         (WebCore::Page::setPageScaleFactor):
1101         * platform/graphics/ca/GraphicsLayerCA.cpp:
1102         (WebCore::GraphicsLayerCA::updateBackdropFilters): If we just made a layer for backdrops, we need to update sublayers.
1103         * rendering/RenderBox.cpp:
1104         (WebCore::RenderBox::styleWillChange):
1105         * rendering/RenderLayer.cpp:
1106         (WebCore::RenderLayer::RenderLayer):
1107         (WebCore::RenderLayer::~RenderLayer):
1108         (WebCore::RenderLayer::addChild):
1109         (WebCore::RenderLayer::removeChild):
1110         (WebCore::RenderLayer::shouldBeStackingContext const):
1111         (WebCore::RenderLayer::stackingContext const):
1112         (WebCore::RenderLayer::dirtyZOrderLists):
1113         (WebCore::RenderLayer::dirtyNormalFlowList):
1114         (WebCore::RenderLayer::updateNormalFlowList):
1115         (WebCore::RenderLayer::rebuildZOrderLists):
1116         (WebCore::RenderLayer::setAncestorsHaveCompositingDirtyFlag):
1117         (WebCore::RenderLayer::contentChanged):
1118         (WebCore::RenderLayer::updateLayerPositions):
1119         (WebCore::RenderLayer::updateTransform):
1120         (WebCore::RenderLayer::updateLayerPosition):
1121         (WebCore::RenderLayer::enclosingCompositingLayer const):
1122         (WebCore::RenderLayer::enclosingCompositingLayerForRepaint const):
1123         (WebCore::RenderLayer::clippingRootForPainting const):
1124         (WebCore::RenderLayer::scrollTo):
1125         (WebCore::RenderLayer::updateCompositingLayersAfterScroll):
1126         (WebCore::RenderLayer::updateScrollInfoAfterLayout):
1127         (WebCore::RenderLayer::paintLayerContents):
1128         (WebCore::RenderLayer::hitTest):
1129         (WebCore::RenderLayer::hitTestLayer):
1130         (WebCore::RenderLayer::calculateClipRects const):
1131         (WebCore::outputPaintOrderTreeLegend):
1132         (WebCore::outputPaintOrderTreeRecursive):
1133         (WebCore::compositingContainer): Deleted.
1134         * rendering/RenderLayer.h:
1135         (WebCore::RenderLayer::clearZOrderLists):
1136         (WebCore::RenderLayer::paintOrderParent const):
1137         * rendering/RenderLayerBacking.cpp:
1138         (WebCore::RenderLayerBacking::updateCompositedBounds):
1139         (WebCore::RenderLayerBacking::updateAfterWidgetResize):
1140         (WebCore::RenderLayerBacking::updateAfterLayout):
1141         (WebCore::RenderLayerBacking::updateConfigurationAfterStyleChange):
1142         (WebCore::RenderLayerBacking::updateConfiguration):
1143         (WebCore::RenderLayerBacking::updateGeometry):
1144         (WebCore::RenderLayerBacking::setRequiresBackgroundLayer):
1145         (WebCore::RenderLayerBacking::updateMaskingLayer):
1146         (WebCore::RenderLayerBacking::paintsContent const):
1147         (WebCore::RenderLayerBacking::contentChanged):
1148         (WebCore::RenderLayerBacking::setContentsNeedDisplay):
1149         (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
1150         (WebCore::RenderLayerBacking::startAnimation):
1151         (WebCore::RenderLayerBacking::animationFinished):
1152         (WebCore::RenderLayerBacking::startTransition):
1153         (WebCore::RenderLayerBacking::transitionFinished):
1154         (WebCore::RenderLayerBacking::setCompositedBounds):
1155         * rendering/RenderLayerBacking.h:
1156         * rendering/RenderLayerCompositor.cpp:
1157         (WebCore::RenderLayerCompositor::CompositingState::CompositingState):
1158         (WebCore::RenderLayerCompositor::enableCompositingMode):
1159         (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
1160         (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlagsAfterLayout):
1161         (WebCore::RenderLayerCompositor::willRecalcStyle):
1162         (WebCore::RenderLayerCompositor::didRecalcStyleWithNoPendingLayout):
1163         (WebCore::RenderLayerCompositor::updateCompositingLayers):
1164         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
1165         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
1166         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
1167         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
1168         (WebCore::RenderLayerCompositor::layerBecameNonComposited):
1169         (WebCore::RenderLayerCompositor::logLayerInfo):
1170         (WebCore::clippingChanged):
1171         (WebCore::styleAffectsLayerGeometry):
1172         (WebCore::RenderLayerCompositor::layerStyleChanged):
1173         (WebCore::RenderLayerCompositor::needsCompositingUpdateForStyleChangeOnNonCompositedLayer const):
1174         (WebCore::RenderLayerCompositor::updateBacking):
1175         (WebCore::RenderLayerCompositor::updateLayerCompositingState):
1176         (WebCore::RenderLayerCompositor::layerWasAdded):
1177         (WebCore::RenderLayerCompositor::layerWillBeRemoved):
1178         (WebCore::RenderLayerCompositor::enclosingNonStackingClippingLayer const):
1179         (WebCore::RenderLayerCompositor::computeExtent const):
1180         (WebCore::RenderLayerCompositor::addToOverlapMap):
1181         (WebCore::RenderLayerCompositor::addToOverlapMapRecursive):
1182         (WebCore::RenderLayerCompositor::rootLayerConfigurationChanged):
1183         (WebCore::RenderLayerCompositor::parentFrameContentLayers):
1184         (WebCore::RenderLayerCompositor::updateRootLayerPosition):
1185         (WebCore::RenderLayerCompositor::needsToBeComposited const):
1186         (WebCore::RenderLayerCompositor::requiresCompositingLayer const):
1187         (WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
1188         (WebCore::RenderLayerCompositor::reasonsForCompositing const):
1189         (WebCore::RenderLayerCompositor::clippedByAncestor const):
1190         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const):
1191         (WebCore::RenderLayerCompositor::requiresCompositingForTransform const):
1192         (WebCore::RenderLayerCompositor::requiresCompositingForVideo const):
1193         (WebCore::RenderLayerCompositor::requiresCompositingForFilters const):
1194         (WebCore::RenderLayerCompositor::requiresCompositingForWillChange const):
1195         (WebCore::RenderLayerCompositor::requiresCompositingForPlugin const):
1196         (WebCore::RenderLayerCompositor::requiresCompositingForFrame const):
1197         (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame const):
1198         (WebCore::RenderLayerCompositor::requiresCompositingForPosition const):
1199         (WebCore::RenderLayerCompositor::requiresCompositingForOverflowScrolling const):
1200         (WebCore::RenderLayerCompositor::styleChangeMayAffectIndirectCompositingReasons):
1201         (WebCore::RenderLayerCompositor::fixedLayerIntersectsViewport const):
1202         (WebCore::RenderLayerCompositor::useCoordinatedScrollingForLayer const):
1203         (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
1204         (WebCore::RenderLayerCompositor::rootBackgroundColorOrTransparencyChanged):
1205         (WebCore::operator<<):
1206         (WebCore::RenderLayerCompositor::setCompositingLayersNeedRebuild): Deleted.
1207         (WebCore::checkIfDescendantClippingContextNeedsUpdate): Deleted.
1208         (WebCore::isScrollableOverflow): Deleted.
1209         (WebCore::styleHasTouchScrolling): Deleted.
1210         (WebCore::styleChangeRequiresLayerRebuild): Deleted.
1211         (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): Deleted.
1212         (WebCore::RenderLayerCompositor::rootFixedBackgroundsChanged): Deleted.
1213         (WebCore::RenderLayerCompositor::updateLayerTreeGeometry): Deleted.
1214         (WebCore::RenderLayerCompositor::updateCompositingDescendantGeometry): Deleted.
1215         * rendering/RenderLayerCompositor.h:
1216         * rendering/RenderTreeAsText.cpp:
1217         (WebCore::writeLayers):
1218
1219 2018-11-12  Rob Buis  <rbuis@igalia.com>
1220
1221         CSSCalcOperation constructor wastes 6KB of Vector capacity on cnn.com
1222         https://bugs.webkit.org/show_bug.cgi?id=190839
1223
1224         Reviewed by Frédéric Wang.
1225
1226         The CSSCalcOperation ctor that takes a leftSide and rightSide parameter
1227         wastes memory since it will always have size 2 but claims the
1228         default Vector size. So make sure to reserve an initial capacity of 2.
1229
1230         * css/CSSCalculationValue.cpp:
1231
1232 2018-11-12  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
1233
1234         WTFMove(xxx) is used in arguments while other arguments touch xxx
1235         https://bugs.webkit.org/show_bug.cgi?id=191544
1236
1237         Reviewed by Alex Christensen.
1238
1239         The order of the evaluation of C++ arguments is undefined. If we use WTFMove(xxx),
1240         xxx should not be touched in the other arguments. This patch fixes such uses in
1241         IDB code.
1242
1243         * Modules/indexeddb/IDBObjectStore.cpp:
1244         (WebCore::IDBObjectStore::deleteIndex):
1245         * Modules/indexeddb/IDBTransaction.cpp:
1246         (WebCore::IDBTransaction::scheduleOperation):
1247         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
1248         (WebCore::IDBServer::MemoryIDBBackingStore::registerObjectStore):
1249         * Modules/indexeddb/server/MemoryObjectStore.cpp:
1250         (WebCore::IDBServer::MemoryObjectStore::registerIndex):
1251
1252 2018-11-12  Zalan Bujtas  <zalan@apple.com>
1253
1254         [LFC][IFC] Construct dedicated runs when the inline element requires it.
1255         https://bugs.webkit.org/show_bug.cgi?id=191509
1256
1257         Reviewed by Antti Koivisto.
1258
1259         In certain cases, a run can overlap multiple inline elements like this:
1260
1261         <span>normal text content</span><span style="position: relative; left: 10px;">but this one needs a dedicated run</span><span>end of text</span>
1262
1263         The content above generates one long run <normal text contentbut this one needs dedicated runend of text> <- input to line breaking.
1264         However, since the middle run is positioned, it needs to be moved independently from the rest of the content, hence it needs a dedicated inline run.
1265
1266         * layout/inlineformatting/InlineFormattingContext.cpp:
1267         (WebCore::Layout::InlineFormattingContext::layout const):
1268         (WebCore::Layout::contentRequiresSeparateRun):
1269         (WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const):
1270         (WebCore::Layout::InlineFormattingContext::postProcessInlineRuns const):
1271         (WebCore::Layout::InlineFormattingContext::closeLine const):
1272         (WebCore::Layout::InlineFormattingContext::appendContentToLine const):
1273         (WebCore::Layout::InlineFormattingContext::layoutInlineContent const):
1274         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
1275         * layout/inlineformatting/InlineFormattingContext.h:
1276         (WebCore::Layout::InlineFormattingContext::inlineFormattingState const):
1277         * layout/inlineformatting/InlineLineBreaker.cpp:
1278         (WebCore::Layout::InlineLineBreaker::nextRun): mid-word breaking is not implemented yet.
1279         * layout/inlineformatting/InlineRun.h:
1280         (WebCore::Layout::InlineRun::overlapsMultipleInlineItems const):
1281         * layout/inlineformatting/InlineRunProvider.cpp:
1282         (WebCore::Layout::InlineRunProvider::processInlineTextItem):
1283         * layout/inlineformatting/InlineRunProvider.h:
1284         (WebCore::Layout::InlineRunProvider::Run::TextContext::expand):
1285         (WebCore::Layout::InlineRunProvider::Run::textContext):
1286         (WebCore::Layout::InlineRunProvider::Run::TextContext::setStart): Deleted.
1287         (WebCore::Layout::InlineRunProvider::Run::TextContext::setLength): Deleted.
1288
1289 2018-11-12  Jer Noble  <jer.noble@apple.com>
1290
1291         [MSE] Frame re-ordering can cause iframes to never be enqueued
1292         https://bugs.webkit.org/show_bug.cgi?id=191485
1293
1294         Reviewed by Eric Carlson.
1295
1296         Test: media/media-source/media-source-dropped-iframe.html
1297
1298         Some frame re-ordering techniques result in files where the first frame has a
1299         decode timestamp < 0, but a presentation timestamp >= 0. When appending these
1300         samples to existing content, we can fail to enqueue the first frame because its
1301         DTS overlaps an existing sample, but the presentation timestamp does not.
1302         Rather than try to only enqueue samples whose decode timestamps are > than the
1303         greatest decode end timestamp (minus some fudge factor), allow all frames to be
1304         added to the decode queue if they are strictly ordered greater than the last
1305         enqueued frame.
1306
1307         * Modules/mediasource/SourceBuffer.cpp:
1308         (WebCore::SourceBuffer::TrackBuffer::TrackBuffer):
1309         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
1310         (WebCore::SourceBuffer::provideMediaData):
1311         (WebCore::SourceBuffer::reenqueueMediaForTime):
1312
1313 2018-11-12  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
1314
1315         IDBTransaction does not use "RefPtr<IDBTransaction> self"
1316         https://bugs.webkit.org/show_bug.cgi?id=190436
1317
1318         Reviewed by Alex Christensen.
1319
1320         It seems that `RefPtr<IDBTransaction> self;` is not effective since it does not capture anything.
1321         Use `protectedThis = makeRef(*this)` instead.
1322
1323         No behavior change.
1324
1325         * Modules/indexeddb/IDBTransaction.cpp:
1326         (WebCore::IDBTransaction::IDBTransaction):
1327
1328 2018-11-12  Alicia Boya García  <aboya@igalia.com>
1329
1330         [MSE][GStreamer] Introduce AbortableTaskQueue
1331         https://bugs.webkit.org/show_bug.cgi?id=190902
1332
1333         Reviewed by Xabier Rodriguez-Calvar.
1334
1335         A new synchronization primitive is introduced: AbortableTaskQueue,
1336         which allows to send work to the main thread from a background thread
1337         with the option to perform two-phase cancellation (startAborting() and
1338         finishAborting()).
1339
1340         This new primitive has been used to overhaul GstBus messaging in
1341         AppendPipeline. A lot of code made redundant has been deleted in the
1342         process and lots of internal functions were now able to be made
1343         private. As part of the refactor all glib signals in AppendPipeline
1344         now use lambdas. All usages of WTF::isMainThread() in AppendPipeline
1345         have been replaced by isMainThread() for consistency with the rest of
1346         WebKit.
1347
1348         Two-phase cancellation is still not used in AppendPipeline as of this
1349         patch, but it will be used in a future patch that makes use of
1350         GStreamer flushes to implement correct MSE abort semantics. There are
1351         unit tests to ensure it works correctly, even if it's still not used.
1352
1353         * WebCore.xcodeproj/project.pbxproj:
1354         * platform/AbortableTaskQueue.h: Added.
1355         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1356         (WebCore::AppendPipeline::dumpAppendState):
1357         (WebCore::AppendPipeline::AppendPipeline):
1358         (WebCore::AppendPipeline::~AppendPipeline):
1359         (WebCore::AppendPipeline::appsrcEndOfAppendCheckerProbe):
1360         (WebCore::AppendPipeline::handleAppsinkNewSampleFromAnyThread):
1361         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
1362         * platform/graphics/gstreamer/mse/AppendPipeline.h:
1363         (WebCore::AppendPipeline::sourceBufferPrivate):
1364         (WebCore::AppendPipeline::appsinkCaps):
1365         (WebCore::AppendPipeline::track):
1366         (WebCore::AppendPipeline::demuxerSrcPadCaps):
1367         (WebCore::AppendPipeline::playerPrivate):
1368
1369 2018-11-12  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1370
1371         [GStreamer][EME] waitingforkey event should consider decryptors' waiting status
1372         https://bugs.webkit.org/show_bug.cgi?id=191459
1373
1374         Reviewed by Carlos Garcia Campos.
1375
1376         The new cross platform architecture to report waitingforkey and
1377         recover from it requires a more accurate knowledge of what is
1378         going on with the decryptors because events are reported only once
1379         (per key exchange run) and crossplatform only continues if we are
1380         actually ready to continue, meaning that no decryptors are
1381         waiting.
1382
1383         * platform/graphics/gstreamer/GUniquePtrGStreamer.h: Added
1384         GstIterator deleter.
1385         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1386         (WebCore::MediaPlayerPrivateGStreamerBase::setWaitingForKey): Bail
1387         out if we are requested to not wait anymore but there are still
1388         waiting decryptors.
1389         (WebCore::MediaPlayerPrivateGStreamerBase::waitingForKey const):
1390         Query the pipeline, just a query after pipeline is built and
1391         manual inspection during build. The query is optimal but sometimes
1392         we can get this request when the pipeline is under construction so
1393         queries do not arrive at the decryptors and we have to deliver it
1394         by ourselves.
1395         (WebCore::MediaPlayerPrivateGStreamerBase::reportWaitingForKey:
1396         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1397         (WebCore::MediaPlayerPrivateGStreamerBase::reportWaitingForKey:
1398         Deleted because it is now inlined.
1399         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1400         (webKitMediaClearKeyDecryptorDecrypt): Fixed small compiler warning.
1401         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
1402         (webkit_media_common_encryption_decrypt_class_init): Override
1403         query method.
1404         (webkitMediaCommonEncryptionDecryptTransformInPlace): When the
1405         decryptor is going to block to wait, report before. When the
1406         decryptor receives the key, report it got it.
1407         (webkitMediaCommonEncryptionDecryptSinkEventHandler): Do not
1408         handle waitingforkey here.
1409         (webkitMediaCommonEncryptionDecryptorQueryHandler): Report if the
1410         decryptor is waiting.
1411
1412 2018-11-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1413
1414         [GTK] Silence ATK_XY_PARENT warnings
1415         https://bugs.webkit.org/show_bug.cgi?id=191504
1416
1417         Reviewed by Carlos Garcia Campos.
1418
1419         * accessibility/atk/WebKitAccessibleInterfaceComponent.cpp:
1420         (atkToContents):
1421         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
1422         (textExtents):
1423         * accessibility/atk/WebKitAccessibleUtil.cpp:
1424         (contentsRelativeToAtkCoordinateType):
1425
1426 2018-11-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1427
1428         Implement a new edit command to change the enclosing list type
1429         https://bugs.webkit.org/show_bug.cgi?id=191487
1430         <rdar://problem/45955922>
1431
1432         Reviewed by Ryosuke Niwa.
1433
1434         Add support for a new edit command that changes the type of the enclosing list element around the selection from
1435         unordered to ordered list and vice versa. This new edit command is exposed only to internal WebKit2 clients, via
1436         SPI on WKWebView (`-_changeListType:`).
1437
1438         This is currently intended for use in Mail compose, but may also be adopted by legacy Notes in the future. As
1439         such, the behavior of this editing command mostly matches shipping behavior in Mail compose (which is currently
1440         implemented entirely by Mail). See below for more details.
1441
1442         Test:   editing/execCommand/change-list-type.html
1443                 WKWebViewEditActions.ChangeListType
1444
1445         * Sources.txt:
1446         * WebCore.xcodeproj/project.pbxproj:
1447         * editing/ChangeListTypeCommand.cpp: Added.
1448         (WebCore::listConversionTypeForSelection):
1449         (WebCore::ChangeListTypeCommand::listConversionType):
1450
1451         Helper that returns a potential list conversion command that may be executed at the given document's selection,
1452         if any exists. We also use existing logic from Mail here to determine which list to change, by walking up the
1453         DOM from the lowest common ancestor container of the current selection until we hit the first list element.
1454
1455         (WebCore::ChangeListTypeCommand::createNewList):
1456
1457         Helper method to create a new list element to replace the given list, and then clone element data from the given
1458         list to the new list. This addresses an existing bug in Mail, wherein changing list type for an enclosing list
1459         which contains inline style properties drops the inline styles, because existing logic in Mail that implements
1460         this editing command only copies the `class` attribute of the old list to the new list.
1461
1462         (WebCore::ChangeListTypeCommand::doApply):
1463
1464         Apply the edit command by running the following steps:
1465         -   Find the enclosing list element, if any (see above).
1466         -   Create a new list element of the opposite type as the enclosing list, and clone over element data from the
1467             list element being replaced.
1468         -   Insert the new list next to the original list.
1469         -   Move all children of the original list to the new list.
1470         -   Remove the original list.
1471         -   Set the selection to the end of the new list.
1472
1473         * editing/ChangeListTypeCommand.h: Added.
1474         * editing/EditAction.h:
1475
1476         Add a pair of new edit actions for conversion from unordered list to ordered list and vice versa.
1477
1478         * editing/Editor.cpp:
1479         (WebCore::Editor::changeSelectionListType):
1480
1481         Implement this by creating and applying a new ChangeListTypeCommand.
1482
1483         (WebCore::Editor::canChangeSelectionListType): Deleted.
1484
1485         Remove this for now, since there's no need for it until full support for edit command validation is implemented.
1486
1487         * editing/Editor.h:
1488         * testing/Internals.cpp:
1489         (WebCore::Internals::changeSelectionListType):
1490         * testing/Internals.h:
1491         * testing/Internals.idl:
1492
1493         Add internal hooks to change list type from layout tests.
1494
1495 2018-11-11  Daniel Bates  <dabates@apple.com>
1496
1497         [iOS] Draw caps lock indicator in password fields
1498         https://bugs.webkit.org/show_bug.cgi?id=190565
1499         <rdar://problem/45262343>
1500
1501         Reviewed by Dean Jackson.
1502
1503         Draw the caps lock indicator in a focused password field on iOS. This makes the behavior of password
1504         fields on iOS more closely match the behavior of password fields on Mac.
1505
1506         The majority of this patch is implementing PlatformKeyboardEvent::currentCapsLockState() for iOS.
1507         In Legacy WebKit, the implementation boils down to calling call -[::WebEvent modifierFlags]. In
1508         Modern WebKit the UIProcess is responsible for -[::WebEvent modifierFlags] and passing it the
1509         WebProcess to store such that invocations of PlatformKeyboardEvent::currentCapsLockState() consult
1510         the store in the WebProcess. A smaller part of this patch is having both the legacy and modern
1511         web views listen for keyboard availability changes so as to update the the caps lock state when
1512         a hardware keyboard is detached or attached.
1513
1514         * WebCore.xcodeproj/project.pbxproj:
1515         * page/EventHandler.cpp:
1516         (WebCore::EventHandler::capsLockStateMayHaveChanged const): Extracted from EventHandler::internalKeyEvent()
1517         so that it can shared between WebCore, Modern WebKit, and Legacy WebKit code.
1518         (WebCore::EventHandler::internalKeyEvent): Modified to call capsLockStateMayHaveChanged().
1519         * page/EventHandler.h:
1520         * platform/cocoa/KeyEventCocoa.mm:
1521         (WebCore::PlatformKeyboardEvent::currentCapsLockState): Moved from KeyEventMac.mm.
1522         (WebCore::PlatformKeyboardEvent::getCurrentModifierState): Moved from KeyEventMac.mm.
1523         * platform/ios/KeyEventIOS.mm:
1524         (WebCore::PlatformKeyboardEvent::currentStateOfModifierKeys): Fetch the current modifier state.
1525         (WebCore::PlatformKeyboardEvent::currentCapsLockState): Deleted; we now use the Cocoa implementation.
1526         (WebCore::PlatformKeyboardEvent::getCurrentModifierState): Deleted; we now use the Cocoa implementation.
1527         * platform/ios/WebEvent.h:
1528         * platform/ios/WebEvent.mm:
1529         (+[WebEvent modifierFlags]): Added.
1530         * platform/mac/KeyEventMac.mm:
1531         (WebCore::PlatformKeyboardEvent::currentCapsLockState): Deleted; moved to KeyEventCocoa.mm to be shared
1532         by both Mac and iOS.
1533         (WebCore::PlatformKeyboardEvent::getCurrentModifierState): Deleted; moved to KeyEventCocoa.mm to be shared
1534         by both Mac and iOS.
1535         * rendering/RenderThemeCocoa.h:
1536         * rendering/RenderThemeCocoa.mm:
1537         (WebCore::RenderThemeCocoa::shouldHaveCapsLockIndicator const): Moved from RenderThemeMac.mm.
1538         * rendering/RenderThemeIOS.h:
1539         * rendering/RenderThemeIOS.mm:
1540         (WebCore::RenderThemeIOS::shouldHaveCapsLockIndicator const): Deleted.
1541         * rendering/RenderThemeMac.h:
1542         * rendering/RenderThemeMac.mm:
1543         (WebCore::RenderThemeMac::shouldHaveCapsLockIndicator const): Deleted; moved to RenderThemeCocoa.mm to be
1544         shared by both Mac and iOS.
1545
1546 2018-11-11  Zalan Bujtas  <zalan@apple.com>
1547
1548         [LFC][BFC] In-flow positioned logic is really formatting context dependent.
1549         https://bugs.webkit.org/show_bug.cgi?id=191512
1550
1551         Reviewed by Simon Fraser.
1552
1553         Move block formatting context specific code from FormattingContext to BlockFormattingContext.
1554
1555         * layout/FormattingContext.cpp:
1556         (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const): Deleted.
1557         * layout/FormattingContext.h:
1558         * layout/FormattingContextGeometry.cpp:
1559         (WebCore::Layout::FormattingContext::Geometry::inFlowPositionedPositionOffset):
1560         * layout/blockformatting/BlockFormattingContext.cpp:
1561         (WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren const):
1562         (WebCore::Layout::BlockFormattingContext::computeInFlowPositionedPosition const): Deleted.
1563         * layout/blockformatting/BlockFormattingContext.h:
1564         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1565         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition): Deleted.
1566         * layout/inlineformatting/InlineFormattingContext.cpp:
1567         (WebCore::Layout::InlineFormattingContext::computeInFlowPositionedPosition const): Deleted.
1568         * layout/inlineformatting/InlineFormattingContext.h:
1569
1570 2018-11-11  Myles C. Maxfield  <mmaxfield@apple.com>
1571
1572         Address post-review comments after r237955
1573         https://bugs.webkit.org/show_bug.cgi?id=191496
1574
1575         Reviewed by Darin Adler.
1576
1577         * rendering/TextDecorationPainter.cpp:
1578         (WebCore::TextDecorationPainter::paintTextDecoration):
1579         * style/InlineTextBoxStyle.cpp:
1580         (WebCore::computeUnderlineOffset):
1581         * style/InlineTextBoxStyle.h:
1582
1583 2018-11-11  Benjamin Poulain  <benjamin@webkit.org>
1584
1585         Fix a fixme: rename wtfObjcMsgSend to wtfObjCMsgSend
1586         https://bugs.webkit.org/show_bug.cgi?id=191492
1587
1588         Reviewed by Alex Christensen.
1589
1590         Rename file.
1591
1592         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1593         * page/mac/EventHandlerMac.mm:
1594         * platform/mac/URLMac.mm:
1595         * platform/mac/WebCoreNSURLExtras.mm:
1596         * platform/mac/WebCoreObjCExtras.mm:
1597         * rendering/RenderThemeMac.mm:
1598
1599 2018-11-10  Benjamin Poulain  <benjamin@webkit.org>
1600
1601         Fix a fixme: rename wtfObjcMsgSend to wtfObjCMsgSend
1602         https://bugs.webkit.org/show_bug.cgi?id=191492
1603
1604         Reviewed by Alex Christensen.
1605
1606         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1607         * page/mac/EventHandlerMac.mm:
1608         * platform/mac/URLMac.mm:
1609         * platform/mac/WebCoreNSURLExtras.mm:
1610         * platform/mac/WebCoreObjCExtras.mm:
1611         * rendering/RenderThemeMac.mm:
1612         (WebCore::RenderThemeMac::systemColor const):
1613
1614 2018-11-10  Megan Gardner  <megan_gardner@apple.com>
1615
1616         Fix build for 32bit Mac
1617         https://bugs.webkit.org/show_bug.cgi?id=191511
1618
1619         Unreviewed Build Fix.
1620
1621         Build fix, not tests needed.
1622
1623         Make the apporiate delecrations for 32-bit mac support.
1624
1625         * editing/mac/DictionaryLookup.mm:
1626
1627 2018-11-10  Simon Fraser  <simon.fraser@apple.com>
1628
1629         Remove support for -webkit-svg-shadow
1630         https://bugs.webkit.org/show_bug.cgi?id=187429
1631         <rdar://problem/41920735>
1632
1633         Reviewed by Dean Jackson.
1634         
1635         -webkit-svg-shadow was a non-standard hack for online iWork, and they no longer use it,
1636         so remove it. No other browser supports it, and chromestatus say it's used on less than
1637         0.000001% of pages.
1638
1639         * css/CSSComputedStyleDeclaration.cpp:
1640         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
1641         * css/CSSProperties.json:
1642         * css/SVGCSSComputedStyleDeclaration.cpp:
1643         (WebCore::ComputedStyleExtractor::svgPropertyValue):
1644         * css/StyleBuilderCustom.h:
1645         (WebCore::StyleBuilderCustom::applyInitialWebkitSvgShadow): Deleted.
1646         (WebCore::StyleBuilderCustom::applyInheritWebkitSvgShadow): Deleted.
1647         (WebCore::StyleBuilderCustom::applyValueWebkitSvgShadow): Deleted.
1648         * css/parser/CSSPropertyParser.cpp:
1649         (WebCore::CSSPropertyParser::parseSingleValue):
1650         * rendering/RenderElement.cpp:
1651         (WebCore::RenderElement::didAttachChild):
1652         * rendering/svg/RenderSVGImage.cpp:
1653         (WebCore::RenderSVGImage::layout):
1654         * rendering/svg/RenderSVGImage.h:
1655         * rendering/svg/RenderSVGModelObject.cpp:
1656         (WebCore::RenderSVGModelObject::RenderSVGModelObject):
1657         * rendering/svg/RenderSVGModelObject.h:
1658         (WebCore::RenderSVGModelObject::repaintRectInLocalCoordinatesExcludingSVGShadow const): Deleted.
1659         (WebCore::RenderSVGModelObject::hasSVGShadow const): Deleted.
1660         (WebCore::RenderSVGModelObject::setHasSVGShadow): Deleted.
1661         * rendering/svg/RenderSVGRoot.cpp:
1662         (WebCore::RenderSVGRoot::RenderSVGRoot):
1663         (WebCore::RenderSVGRoot::updateCachedBoundaries):
1664         * rendering/svg/RenderSVGRoot.h:
1665         * rendering/svg/RenderSVGShape.cpp:
1666         (WebCore::RenderSVGShape::updateRepaintBoundingBox):
1667         * rendering/svg/RenderSVGShape.h:
1668         * rendering/svg/SVGRenderSupport.cpp:
1669         (WebCore::SVGRenderSupport::clippedOverflowRectForRepaint):
1670         (WebCore::SVGRenderSupport::layoutChildren):
1671         (WebCore::SVGRenderSupport::styleChanged):
1672         (WebCore::SVGRenderSupport::repaintRectForRendererInLocalCoordinatesExcludingSVGShadow): Deleted.
1673         (WebCore::SVGRenderSupport::rendererHasSVGShadow): Deleted.
1674         (WebCore::SVGRenderSupport::setRendererHasSVGShadow): Deleted.
1675         (WebCore::SVGRenderSupport::intersectRepaintRectWithShadows): Deleted.
1676         (WebCore::SVGRenderSupport::childAdded): Deleted.
1677         * rendering/svg/SVGRenderSupport.h:
1678
1679 2018-11-10  Ryan Haddad  <ryanhaddad@apple.com>
1680
1681         Unreviewed, rolling out r238065.
1682
1683         Breaks internal builds.
1684
1685         Reverted changeset:
1686
1687         "Make it possible to edit images inline"
1688         https://bugs.webkit.org/show_bug.cgi?id=191352
1689         https://trac.webkit.org/changeset/238065
1690
1691 2018-11-10  Tim Horton  <timothy_horton@apple.com>
1692
1693         Make it possible to edit images inline
1694         https://bugs.webkit.org/show_bug.cgi?id=191352
1695         <rdar://problem/30107985>
1696
1697         Reviewed by Dean Jackson.
1698
1699         Tests: editing/images/basic-editable-image.html
1700                editing/images/reparent-editable-image-maintains-strokes.html
1701
1702         Add the beginnings of a mechanism to replace images with a special attribute
1703         with a native drawing view in the UI process.
1704
1705         * page/Settings.yaml:
1706         Add a setting to control whether images become natively editable when they
1707         have the x-apple-editable-image attribute.
1708
1709         * html/HTMLImageElement.cpp:
1710         (WebCore::HTMLImageElement::editableImageViewID const):
1711         Lazily generate an EmbeddedViewID and persist it on the <img> element.
1712
1713         * html/HTMLImageElement.h:
1714         Rearrange the service controls methods to sit before the members.
1715         Add m_editableImageViewID and editableImageViewID().
1716
1717         * platform/graphics/GraphicsLayer.cpp:
1718         (WebCore::GraphicsLayer::nextEmbeddedViewID):
1719         * platform/graphics/GraphicsLayer.h:
1720         (WebCore::GraphicsLayer::setContentsToEmbeddedView):
1721         Add a new ContentsLayerPurpose, EmbeddedView, which is only supported
1722         on Cocoa platforms and when using RemoteLayerTree.
1723         Add ContentsLayerEmbeddedViewType, which currently only has the EditableImage type.
1724         Add setContentsToEmbeddedView, which takes a ContentsLayerEmbeddedViewType
1725         and an EmbeddedViewID to uniquely identify and communicate about the
1726         embedded view (which may move between layers, since it is tied to an element).
1727
1728         * platform/graphics/ca/GraphicsLayerCA.cpp:
1729         (WebCore::GraphicsLayerCA::createPlatformCALayerForEmbeddedView):
1730         (WebCore::GraphicsLayerCA::setContentsToEmbeddedView):
1731         When setting GraphicsLayer's contents to an embedded view, we use
1732         a special PlatformCALayer factory that takes the EmbeddedViewID and type.
1733         GraphicsLayerCARemote will override this and make a correctly-initialized
1734         PlatformCALayerRemote that keeps track of the EmbeddedViewID.
1735
1736         * platform/graphics/ca/GraphicsLayerCA.h:
1737         * platform/graphics/ca/PlatformCALayer.cpp:
1738         (WebCore::operator<<):
1739         * platform/graphics/ca/PlatformCALayer.h:
1740         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
1741         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1742         (WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa):
1743         (WebCore::PlatformCALayerCocoa::embeddedViewID const):
1744         Add stubs and logging for EmbeddedViewID on PlatformCALayer.
1745         These will be overridden by PlatformCALayerRemote to do more interesting things.
1746
1747         * rendering/RenderImage.cpp:
1748         (WebCore::RenderImage::isEditableImage const):
1749         Add a getter that return true if the setting is enabled and
1750         x-apple-editable-image is empty or true.
1751
1752         (WebCore::RenderImage::requiresLayer const):
1753         RenderImage requires a layer either if RenderReplaced does, or we are an
1754         editable image.
1755
1756         * rendering/RenderImage.h:
1757         * rendering/RenderLayer.cpp:
1758         (WebCore::RenderLayer::shouldBeNormalFlowOnly const):
1759         (WebCore::RenderLayer::calculateClipRects const):
1760         * rendering/RenderLayerBacking.cpp:
1761         (WebCore::RenderLayerBacking::updateConfiguration):
1762         Push the EmbeddedViewID and type down to GraphicsLayer for editable images.
1763
1764         * rendering/RenderLayerCompositor.cpp:
1765         (WebCore::RenderLayerCompositor::requiresCompositingLayer const):
1766         (WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
1767         (WebCore::RenderLayerCompositor::reasonsForCompositing const):
1768         (WebCore::RenderLayerCompositor::requiresCompositingForEditableImage const):
1769         * rendering/RenderLayerCompositor.h:
1770         Make editable images require compositing implicitly.
1771
1772 2018-11-09  Zalan Bujtas  <zalan@apple.com>
1773
1774         [iOS] Issue initial paint soon after the visuallyNonEmpty milestone is fired.
1775         https://bugs.webkit.org/show_bug.cgi?id=191078
1776         <rdar://problem/45736178>
1777
1778         Reviewed by Antti Koivisto.
1779
1780         1. Improve visuallyNonEmpty milestone confidence level.
1781             Ignore whitespace and non visible text content.
1782             Parsing the main document should not necessarily fire the milestone. Check if there's any pending scripts/css/font loading.
1783             Check if the html/body is actually visible.
1784
1785         2. Issue initial paint soon after the milestone fires.
1786             Use a 0ms timer to flush the initial paint.
1787             Throttle additional flushes for 500ms and 1.5s (original behaviour).
1788
1789         3. Suspend optional style recalcs and layouts while painting is being throttled.
1790            When parsing yields we initiate a 0ms style recalc/layout timer.
1791            These optional layouts produce content that we have no intention to paint. 
1792
1793         * dom/Document.cpp:
1794         (WebCore::Document::scheduleStyleRecalc):
1795         (WebCore::Document::shouldScheduleLayout):
1796         * page/ChromeClient.h:
1797         * page/FrameView.cpp:
1798         (WebCore::FrameView::resetLayoutMilestones):
1799         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const):
1800         (WebCore::FrameView::updateSignificantRenderedTextMilestoneIfNeeded):
1801         (WebCore::FrameView::updateIsVisuallyNonEmpty):
1802         * page/FrameView.h:
1803         (WebCore::FrameView::incrementVisuallyNonEmptyCharacterCount): Ignore whitespace characters. Some pages start with plenty of whitespace only content.
1804         * platform/graphics/FontCascade.h:
1805         * rendering/RenderText.cpp: Check whether the text is actually visible at this point.
1806         (WebCore::RenderText::RenderText):
1807
1808 2018-11-09  John Wilander  <wilander@apple.com>
1809
1810         Add ability to configure document.cookie lifetime cap through user defaults
1811         https://bugs.webkit.org/show_bug.cgi?id=191480
1812         <rdar://problem/45240871>
1813
1814         Reviewed by Chris Dumez.
1815
1816         No new tests. Existing test makes sure we don't regress.
1817
1818         This change makes the capped lifetime in seconds configurable through
1819         user defaults.
1820
1821         * platform/network/NetworkStorageSession.h:
1822         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1823         (WebCore::NetworkStorageSession::setAgeCapForClientSideCookies):
1824         (WebCore::NetworkStorageSession::setShouldCapLifetimeForClientSideCookies): Deleted.
1825             Renamed setAgeCapForClientSideCookies().
1826         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1827         (WebCore::filterCookies):
1828         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
1829
1830 2018-11-09  Ryan Haddad  <ryanhaddad@apple.com>
1831
1832         Unreviewed, rolling out r238047.
1833
1834         Introduced layout test failures on iOS simulator.
1835
1836         Reverted changeset:
1837
1838         "[iOS] Draw caps lock indicator in password fields"
1839         https://bugs.webkit.org/show_bug.cgi?id=190565
1840         https://trac.webkit.org/changeset/238047
1841
1842 2018-11-09  Tim Horton  <timothy_horton@apple.com>
1843
1844         Normal-flow-only flex items don't correctly respect z-index
1845         https://bugs.webkit.org/show_bug.cgi?id=191486
1846
1847         Reviewed by Simon Fraser.
1848
1849         Test: css3/flexbox/z-index-with-normal-flow-only.html
1850
1851         * rendering/RenderLayer.cpp:
1852         (WebCore::canCreateStackingContext):
1853         r125693 did not ensure that flex items which would otherwise be
1854         normal-flow-only would be put into the z-order tree when necessary.
1855         Fix by respecting the same trigger we use to make layers for flex items;
1856         namely, not having auto z-index.
1857
1858 2018-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
1859
1860         [Cocoa] Implement SPI on WKWebView to increase and decrease list levels
1861         https://bugs.webkit.org/show_bug.cgi?id=191471
1862         <rdar://problem/45952472>
1863
1864         Reviewed by Tim Horton.
1865
1866         Add new method stubs for changing the list type for the current selection (to be implemented in a future patch).
1867
1868         * editing/Editor.cpp:
1869         (WebCore::Editor::canChangeSelectionListType):
1870         (WebCore::Editor::changeSelectionListType):
1871         * editing/Editor.h:
1872
1873 2018-11-09  Keith Rollin  <krollin@apple.com>
1874
1875         Unreviewed build fix after https://bugs.webkit.org/show_bug.cgi?id=191324
1876
1877         Remove the use of .xcfilelists until their side-effects are better
1878         understood.
1879
1880         * WebCore.xcodeproj/project.pbxproj:
1881
1882 2018-11-09  Jer Noble  <jer.noble@apple.com>
1883
1884         SourceBuffer throws an error when appending a second init segment after changeType().
1885         https://bugs.webkit.org/show_bug.cgi?id=191474
1886
1887         Reviewed by Eric Carlson.
1888
1889         Test: media/media-source/media-source-changetype-second-init.html
1890
1891         When encountering an initialization segment after changeType(), add the parsed codec types
1892         to the list of allowed codecs.
1893
1894         * Modules/mediasource/SourceBuffer.cpp:
1895         (WebCore::SourceBuffer::validateInitializationSegment):
1896         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
1897         (WebCore::MockMediaPlayerMediaSource::supportsType):
1898         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
1899         (WebCore::MockSourceBufferPrivate::canSwitchToType):
1900         * platform/mock/mediasource/MockSourceBufferPrivate.h:
1901
1902 2018-11-09  Eric Carlson  <eric.carlson@apple.com>
1903
1904         [MediaStream] AVVideoCaptureSource reports incorrect size when frames are scaled
1905         https://bugs.webkit.org/show_bug.cgi?id=191479
1906         <rdar://problem/45952201>
1907
1908         Reviewed by Jer Noble.
1909
1910         No new tests, tested manually.
1911
1912         * platform/mediastream/RealtimeVideoSource.cpp:
1913         (WebCore::RealtimeVideoSource::standardVideoSizes): Drive-by fix: add a few more standard
1914         video frame sizes, correct a typo.
1915         (WebCore::RealtimeVideoSource::bestSupportedSizeAndFrameRate): Drive-by fix: don't consider
1916         rescaled sized when we already have an exact or aspect ratio match because it won't be used.
1917
1918         * platform/mediastream/mac/AVVideoCaptureSource.h:
1919         (WebCore::AVVideoCaptureSource::width const): Deleted.
1920         (WebCore::AVVideoCaptureSource::height const): Deleted.
1921         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1922         (WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset): Delete m_requestedSize.
1923         (WebCore::AVVideoCaptureSource::shutdownCaptureSession): Delete m_width and m_height.
1924         (WebCore::AVVideoCaptureSource::processNewFrame): Don't call setSize with captured size,
1925         the frame may be resized before deliver.
1926
1927 2018-11-09  Ross Kirsling  <ross.kirsling@sony.com>
1928
1929         Unreviewed MSVC build fix after r238039 (and r238046).
1930
1931         * bindings/js/JSWorkerGlobalScopeBase.cpp:
1932         * bindings/js/JSWorkerGlobalScopeBase.h:
1933
1934 2018-11-09  Basuke Suzuki  <basuke.suzuki@sony.com>
1935
1936         [Curl][WebKit] Implement Proxy configuration API.
1937         https://bugs.webkit.org/show_bug.cgi?id=189053
1938
1939         Reviewed by Youenn Fablet.
1940
1941         Added API to set proxy from the app.
1942
1943         No new tests because there's no behaviour change in WebCore.
1944
1945         * platform/network/NetworkStorageSession.h:
1946         * platform/network/curl/CurlContext.h:
1947         (WebCore::CurlContext::setProxySettings):
1948         * platform/network/curl/CurlProxySettings.h:
1949         * platform/network/curl/NetworkStorageSessionCurl.cpp:
1950         (WebCore::NetworkStorageSession::setProxySettings const):
1951
1952 2018-11-09  Antti Koivisto  <antti@apple.com>
1953
1954         Use OptionSet for layout milestones
1955         https://bugs.webkit.org/show_bug.cgi?id=191470
1956
1957         Reviewed by Dean Jackson.
1958
1959         * WebCore.xcodeproj/project.pbxproj:
1960         * loader/EmptyFrameLoaderClient.h:
1961         * loader/FrameLoader.cpp:
1962         (WebCore::FrameLoader::didReachLayoutMilestone):
1963         * loader/FrameLoader.h:
1964         * loader/FrameLoaderClient.h:
1965         * page/FrameView.cpp:
1966         (WebCore::FrameView::FrameView):
1967         (WebCore::FrameView::addPaintPendingMilestones):
1968         (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
1969         (WebCore::FrameView::firePaintRelatedMilestonesIfNeeded):
1970         * page/FrameView.h:
1971         * page/LayoutMilestone.h: Copied from Source/WebCore/page/LayoutMilestones.h.
1972
1973         Renamed to appease WK2 IPC code generation.
1974
1975         * page/LayoutMilestones.h: Removed.
1976         * page/Page.cpp:
1977         (WebCore::Page::addLayoutMilestones):
1978         (WebCore::Page::removeLayoutMilestones):
1979         (WebCore::Page::isCountingRelevantRepaintedObjects const):
1980         * page/Page.h:
1981         (WebCore::Page::requestedLayoutMilestones const):
1982
1983 2018-11-09  Daniel Bates  <dabates@apple.com>
1984
1985         [iOS] Draw caps lock indicator in password fields
1986         https://bugs.webkit.org/show_bug.cgi?id=190565
1987         <rdar://problem/45262343>
1988
1989         Reviewed by Dean Jackson.
1990
1991         Draw the caps lock indicator in a focused password field on iOS. This makes the behavior of password
1992         fields on iOS more closely match the behavior of password fields on Mac. For now, we only draw the
1993         indicator when caps locks is enabled via the hardware keyboard. We will look to support the software
1994         keyboard in a subsequent commit (see <https://bugs.webkit.org/show_bug.cgi?id=191475>).
1995
1996         The majority of this patch is implementing PlatformKeyboardEvent::currentCapsLockState() for iOS.
1997         In Legacy WebKit, the implementation boils down to calling call -[::WebEvent modifierFlags]. In
1998         Modern WebKit the UIProcess is responsible for -[::WebEvent modifierFlags] and passing it the
1999         WebProcess to store such that invocations of PlatformKeyboardEvent::currentCapsLockState() consult
2000         the store in the WebProcess. A smaller part of this patch is having both the legacy and modern
2001         web views listen for keyboard availability changes so as to update the the caps lock state when
2002         a hardware keyboard is detached or attached.
2003
2004         * WebCore.xcodeproj/project.pbxproj:
2005         * page/EventHandler.cpp:
2006         (WebCore::EventHandler::capsLockStateMayHaveChanged const): Extracted from EventHandler::internalKeyEvent()
2007         so that it can shared between WebCore, Modern WebKit, and Legacy WebKit code.
2008         (WebCore::EventHandler::internalKeyEvent): Modified to call capsLockStateMayHaveChanged().
2009         * page/EventHandler.h:
2010         * platform/cocoa/KeyEventCocoa.mm:
2011         (WebCore::PlatformKeyboardEvent::currentCapsLockState): Moved from KeyEventMac.mm.
2012         (WebCore::PlatformKeyboardEvent::getCurrentModifierState): Moved from KeyEventMac.mm.
2013         * platform/ios/KeyEventIOS.mm:
2014         (WebCore::PlatformKeyboardEvent::currentStateOfModifierKeys): Fetch the current modifier state.
2015         (WebCore::PlatformKeyboardEvent::currentCapsLockState): Deleted; we now use the Cocoa implementation.
2016         (WebCore::PlatformKeyboardEvent::getCurrentModifierState): Deleted; we now use the Cocoa implementation.
2017         * platform/ios/WebEvent.h:
2018         * platform/ios/WebEvent.mm:
2019         (+[WebEvent modifierFlags]): Added.
2020         * platform/mac/KeyEventMac.mm:
2021         (WebCore::PlatformKeyboardEvent::currentCapsLockState): Deleted; moved to KeyEventCocoa.mm to be shared
2022         by both Mac and iOS.
2023         (WebCore::PlatformKeyboardEvent::getCurrentModifierState): Deleted; moved to KeyEventCocoa.mm to be shared
2024         by both Mac and iOS.
2025         * rendering/RenderThemeCocoa.h:
2026         * rendering/RenderThemeCocoa.mm:
2027         (WebCore::RenderThemeCocoa::shouldHaveCapsLockIndicator const): Moved from RenderThemeMac.mm.
2028         * rendering/RenderThemeIOS.h:
2029         * rendering/RenderThemeIOS.mm:
2030         (WebCore::RenderThemeIOS::shouldHaveCapsLockIndicator const): Deleted.
2031         * rendering/RenderThemeMac.h:
2032         * rendering/RenderThemeMac.mm:
2033         (WebCore::RenderThemeMac::shouldHaveCapsLockIndicator const): Deleted; moved to RenderThemeCocoa.mm to be
2034         shared by both Mac and iOS.
2035
2036 2018-11-09  Chris Dumez  <cdumez@apple.com>
2037
2038         Unreviewed attempt to fix WinCairo build after r238039.
2039
2040         * bindings/js/JSWorkerGlobalScopeBase.h:
2041
2042 2018-11-09  Fujii Hironori  <Hironori.Fujii@sony.com>
2043
2044         Extensions3DOpenGLES.h:  warning: 'blitFramebuffer' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
2045         https://bugs.webkit.org/show_bug.cgi?id=191451
2046
2047         Reviewed by Dean Jackson.
2048
2049         No new tests because there is no behavior change.
2050
2051         * platform/graphics/opengl/Extensions3DOpenGLES.cpp:
2052         (WebCore::Extensions3DOpenGLES::setEXTContextLostCallback): Deleted unused method.
2053         * platform/graphics/opengl/Extensions3DOpenGLES.h: Marked 'override'.
2054
2055 2018-11-09  Andy Estes  <aestes@apple.com>
2056
2057         [Payment Request] canMakePayment() should not consider serialized payment method data
2058         https://bugs.webkit.org/show_bug.cgi?id=191432
2059
2060         Reviewed by Dean Jackson.
2061
2062         In https://github.com/w3c/payment-request/pull/806, we're changing the specification of
2063         canMakePayment() to not consider serialized payment method data when deciding if a payment
2064         method is supported. For Apple Pay, this means we resolve to true for
2065         "https://apple.com/apple-pay", even if an ApplePayRequest is omitted or is missing required
2066         fields.
2067
2068         Added test cases to
2069         http/tests/paymentrequest/payment-request-canmakepayment-method.https.html and
2070         http/tests/paymentrequest/payment-request-show-method.https.html.
2071
2072         * Modules/paymentrequest/PaymentRequest.cpp:
2073         (WebCore::PaymentRequest::canMakePayment):
2074
2075 2018-11-09  Andy Estes  <aestes@apple.com>
2076
2077         [Payment Request] PaymentResponse.details should be updated when the user accepts a retried payment
2078         https://bugs.webkit.org/show_bug.cgi?id=191440
2079
2080         Reviewed by Dean Jackson.
2081
2082         PaymentResponse.details was being initialized in the PaymentResponse constructor and never
2083         updated when the user accepts a retried payment. We need to update it.
2084
2085         Added a test case to http/tests/paymentrequest/payment-response-retry-method.https.html.
2086
2087         * Modules/paymentrequest/PaymentRequest.cpp:
2088         (WebCore::PaymentRequest::accept):
2089         * Modules/paymentrequest/PaymentResponse.cpp:
2090         (WebCore::PaymentResponse::PaymentResponse):
2091         (WebCore::PaymentResponse::setDetailsFunction):
2092         * Modules/paymentrequest/PaymentResponse.h:
2093
2094 2018-11-09  Fujii Hironori  <Hironori.Fujii@sony.com>
2095
2096         MediaPlayerPrivateMediaFoundation.h: warning: 'GetService' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
2097         https://bugs.webkit.org/show_bug.cgi?id=191453
2098
2099         Reviewed by Per Arne Vollan.
2100
2101         No new tests because there is no behavior change.
2102
2103         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h: Marked with 'override' and removed 'virtual'.
2104
2105 2018-11-09  Chris Dumez  <cdumez@apple.com>
2106
2107         Unreviewed attempt to fix internal build on macOS.
2108
2109         'Export' is defined in several headers.
2110
2111         * bindings/js/JSDOMGlobalObject.cpp:
2112         * bindings/js/JSDOMGlobalObject.h:
2113         * bridge/jsc/BridgeJSC.cpp:
2114         * bridge/jsc/BridgeJSC.h:
2115
2116 2018-11-09  Chris Dumez  <cdumez@apple.com>
2117
2118         HTML form validation bubble disappears
2119         https://bugs.webkit.org/show_bug.cgi?id=191418
2120
2121         Reviewed by Simon Fraser.
2122
2123         If we validate a form and find an invalid form control, we'll scroll it into view and show
2124         the validation bubble. However, scrolling the element into view may be an asynchronous
2125         operation, in which case it would discard the validation bubble prematurely because scrolling
2126         hides the validation bubble. To address the issue, we now show the validation message
2127         asynchronously after focusing the element (and potentially scrolling it into view).
2128
2129         Test: fast/forms/scroll-into-view-and-show-validation-message.html
2130
2131         * html/HTMLFormControlElement.cpp:
2132         (WebCore::HTMLFormControlElement::focusAndShowValidationMessage):
2133
2134 2018-11-09  Brent Fulgham  <bfulgham@apple.com>
2135
2136         [Windows][DirectX] Be more rigors about BeginFigure/EndFigure and Close operations. 
2137         https://bugs.webkit.org/show_bug.cgi?id=191452
2138         <rdar://problem/45933964>
2139
2140         Reviewed by Zalan Bujtas.
2141
2142         Do a better job of balancing the BeginFigure/EndFigure calls in
2143         the PathDirect2D implementation. Failure to do so puts the Geometry sink
2144         into an error state that prevents it from producing drawing output.
2145       
2146
2147         * platform/graphics/Path.h:
2148         * platform/graphics/win/GraphicsContextDirect2D.cpp:
2149         (WebCore::GraphicsContext::drawPath): Flush is needed here.
2150         (WebCore::GraphicsContext::fillPath): Ditto.
2151         (WebCore::GraphicsContext::strokePath): Ditto.
2152         * platform/graphics/win/PathDirect2D.cpp:
2153         (WebCore::Path::drawDidComplete):
2154         (WebCore::Path::closeAnyOpenGeometries):
2155         (WebCore::Path::transform):
2156         (WebCore::Path::openFigureAtCurrentPointIfNecessary):
2157         (WebCore::Path::moveTo):
2158         (WebCore::Path::closeSubpath):
2159
2160 2018-11-09  Jer Noble  <jer.noble@apple.com>
2161
2162         [Cocoa] Fix failing imported/w3c/web-platform-tests/media-source/mediasource-changetype-play.html test
2163         https://bugs.webkit.org/show_bug.cgi?id=191396
2164
2165         Reviewed by Eric Carlson.
2166
2167         When changeType() is called, exempt video and text tracks (in addition to just audio tracks)
2168         from "same codec" requirements.
2169
2170         * Modules/mediasource/SourceBuffer.cpp:
2171         (WebCore::SourceBuffer::validateInitializationSegment):
2172
2173 2018-11-09  Carlos Garcia Campos  <cgarcia@igalia.com>
2174
2175         REGRESSION(r236365): [GTK] Many form-related tests are failing
2176         https://bugs.webkit.org/show_bug.cgi?id=189993
2177
2178         Reviewed by Michael Catanzaro.
2179
2180         Only the first form data element is added to the message body due to a return added by mistake in r236365.
2181
2182         * platform/network/soup/ResourceRequestSoup.cpp:
2183         (WebCore::ResourceRequest::updateSoupMessageBody const): Remove return.
2184
2185 2018-11-09  Zalan Bujtas  <zalan@apple.com>
2186
2187         [LFC][IFC] Move some code from InlineFormattingContext::Line to InlineFormattingContext/Geometry
2188         https://bugs.webkit.org/show_bug.cgi?id=191445
2189
2190         Reviewed by Antti Koivisto.
2191
2192         The idea here is that Line should not have to deal with all the post processig tasks like the runs final aligments.
2193         (The line class would eventually turn into a collection of random things).
2194
2195         * layout/inlineformatting/InlineFormattingContext.cpp:
2196         (WebCore::Layout::InlineFormattingContext::closeLine const):
2197         (WebCore::Layout::InlineFormattingContext::appendContentToLine const):
2198         (WebCore::Layout::InlineFormattingContext::layoutInlineContent const):
2199         * layout/inlineformatting/InlineFormattingContext.h:
2200         (WebCore::Layout::InlineFormattingContext::Line::contentLogicalLeft const):
2201         (WebCore::Layout::InlineFormattingContext::Line::lastRunType const):
2202         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
2203         (WebCore::Layout::InlineFormattingContext::Geometry::adjustedLineLogicalLeft):
2204         (WebCore::Layout::InlineFormattingContext::Geometry::justifyRuns):
2205         (WebCore::Layout::InlineFormattingContext::Geometry::computeExpansionOpportunities):
2206         * layout/inlineformatting/Line.cpp:
2207         (WebCore::Layout::InlineFormattingContext::Line::Line):
2208         (WebCore::Layout::InlineFormattingContext::Line::init):
2209         (WebCore::Layout::InlineFormattingContext::Line::contentLogicalRight const):
2210         (WebCore::Layout::InlineFormattingContext::Line::appendContent):
2211         (WebCore::Layout::InlineFormattingContext::Line::close):
2212         (WebCore::Layout::adjustedLineLogicalLeft): Deleted.
2213         (WebCore::Layout::InlineFormattingContext::Line::contentLogicalRight): Deleted.
2214         (WebCore::Layout::InlineFormattingContext::Line::computeExpansionOpportunities): Deleted.
2215         (WebCore::Layout::InlineFormattingContext::Line::justifyRuns): Deleted.
2216
2217 2018-11-09  Philippe Normand  <pnormand@igalia.com>
2218
2219         Unreviewed, GStreamer build warning fix
2220
2221         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
2222         (WebCore::GStreamerVideoEncoder::newSampleCallback): Timesamp()
2223         returns a uint32_t, fix format string accordingly.
2224
2225 2018-11-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
2226
2227         Add an SPI to allow WebView clients to add additional supported image formats
2228         https://bugs.webkit.org/show_bug.cgi?id=190454
2229
2230         Reviewed by Simon Fraser.
2231
2232         Add an SPI to allow additional supported image formats in WebView. These
2233         additional formats can be set in the WKWebViewConfiguration as an NSArray
2234         of NStrings. Each string represents an image source type aka UTI.
2235
2236         The ImageSourceType in the functions' names will be replaced by ImageType.
2237         ImageType in this context is the image UTI (Uniform Type Identifier).
2238
2239         * platform/MIMETypeRegistry.cpp:
2240         (WebCore::MIMETypeRegistry::supportedImageMIMETypes):
2241         (WebCore::MIMETypeRegistry::additionalSupportedImageMIMETypes):
2242         (WebCore::supportedImageMIMETypesForEncoding):
2243         (WebCore::MIMETypeRegistry::isSupportedImageMIMEType):
2244         * platform/MIMETypeRegistry.h:
2245         * platform/graphics/cg/ImageDecoderCG.cpp:
2246         (WebCore::ImageDecoderCG::filenameExtension const):
2247         (WebCore::ImageDecoderCG::encodedDataStatus const):
2248         * platform/graphics/cg/ImageSourceCG.h:
2249         * platform/graphics/cg/ImageSourceCGMac.mm:
2250         (WebCore::MIMETypeForImageType):
2251         (WebCore::preferredExtensionForImageType):
2252         (WebCore::MIMETypeForImageSourceType): Deleted.
2253         (WebCore::preferredExtensionForImageSourceType): Deleted.
2254         * platform/graphics/cg/ImageSourceCGWin.cpp:
2255         (WebCore::MIMETypeForImageType):
2256         (WebCore::preferredExtensionForImageType):
2257         (WebCore::MIMETypeForImageSourceType): Deleted.
2258         (WebCore::preferredExtensionForImageSourceType): Deleted.
2259         * platform/graphics/cg/UTIRegistry.cpp:
2260         (WebCore::defaultSupportedImageTypes):
2261         (WebCore::additionalSupportedImageTypes):
2262         (WebCore::setAdditionalSupportedImageTypes):
2263         (WebCore::isSupportedImageType):
2264         (WebCore::supportedDefaultImageSourceTypes): Deleted.
2265         (WebCore::isSupportImageSourceType): Deleted.
2266         * platform/graphics/cg/UTIRegistry.h:
2267
2268 2018-11-08  Megan Gardner  <megan_gardner@apple.com>
2269
2270         Adopt Reveal Framework to replace Lookup
2271         https://bugs.webkit.org/show_bug.cgi?id=191097
2272
2273         Reviewed by Tim Horton.
2274
2275         Reveal is not currently testable.
2276
2277         The Reveal framework does the same job as Lookup and DataDectors.
2278         In this patch we switch from using Lookup to determine what text
2279         to select and define to using Reveal and RVItems. Since this
2280         code needs to work on older systems, and Reveal is newer, we also need
2281         to keep around the old code for old systems so that they can also
2282         continue to work. Eventually we will remove this code and also likly switch
2283         to passing RVItems across from the web process rather than making them
2284         on each side.
2285
2286         * SourcesCocoa.txt:
2287         * WebCore.xcodeproj/project.pbxproj:
2288         * editing/mac/DictionaryLookup.h:
2289         * editing/mac/DictionaryLookup.mm:
2290
2291         Create a delegate to respond to Reveal and help draw the string or highlight.
2292
2293         (-[WebRevealHighlight initWithHighlightRect:useDefaultHighlight:attributedString:]):
2294         (-[WebRevealHighlight setClearTextIndicator:]):
2295         (-[WebRevealHighlight revealContext:rectsForItem:]):
2296         (-[WebRevealHighlight revealContext:drawRectsForItem:]):
2297         (-[WebRevealHighlight revealContext:shouldUseDefaultHighlightForItem:]):
2298         (-[WebRevealHighlight revealContext:stopHighlightingItem:]):
2299         (WebCore::showPopupOrCreateAnimationController):
2300
2301         Unify the code paths and utalize the Reveal framework to create and/or display the popovers.
2302
2303         (WebCore::DictionaryLookup::showPopup):
2304         (WebCore::DictionaryLookup::animationControllerForPopup):
2305
2306         Pipe the new callback through.
2307
2308         (WebCore::tokenRange): Deleted.
2309
2310         Only used with Lookup
2311
2312         (WebCore::selectionContainsPosition): Deleted.
2313
2314         Only used with Lookup.
2315
2316         * editing/mac/DictionaryLookupLegacy.mm: Copied from Source/WebCore/editing/mac/DictionaryLookup.mm.
2317
2318         Keep a copy of the previous implementation of DictionaryLookup, because Reveal not available on older
2319         system.
2320
2321         (WebCore::tokenRange):
2322         (WebCore::selectionContainsPosition):
2323         (WebCore::expandSelectionByCharacters):
2324         (WebCore::showPopupOrCreateAnimationController):
2325         (WebCore::DictionaryLookup::showPopup):
2326         (WebCore::DictionaryLookup::hidePopup):
2327         (WebCore::DictionaryLookup::animationControllerForPopup):
2328
2329 2018-11-08  Keith Rollin  <krollin@apple.com>
2330
2331         Create .xcfilelist files
2332         https://bugs.webkit.org/show_bug.cgi?id=191324
2333         <rdar://problem/45852819>
2334
2335         Reviewed by Alex Christensen.
2336
2337         As part of preparing for enabling XCBuild, create and use .xcfilelist
2338         files. These files are using during Run Script build phases in an
2339         Xcode project. If a Run Script build phase produces new files that are
2340         used later as inputs to subsequent build phases, XCBuild needs to know
2341         about these files. These files can be either specified in an "output
2342         files" section of the Run Script phase editor, or in .xcfilelist files
2343         that are associated with the Run Script build phase.
2344
2345         This patch takes the second approach. It consists of three sets of changes:
2346
2347         - Modify the DerivedSources.make files to have a
2348           'print_all_generated_files" target that produces a list of the files
2349           they create.
2350
2351         - Create a shell script that produces .xcfilelist files from the
2352           output of the previous step, as well as for the files created in the
2353           Generate Unified Sources build steps.
2354
2355         - Add the new .xcfilelist files to the associated projects.
2356
2357         Note that, with these changes, the Xcode workspace and projects can no
2358         longer be fully loaded into Xcode 9. Xcode will attempt to load the
2359         projects that have .xcfilelist files associated with them, but will
2360         fail and display a placeholder for those projects instead. It's
2361         expected that all developers are using Xcode 10 by now and that not
2362         being able to load into Xcode 9 is not a practical issue. Keep in mind
2363         that this is strictly an IDE issue, and that the projects can still be
2364         built with `xcodebuild`.
2365
2366         Also note that the shell script that creates the .xcfilelist files can
2367         also be used to verify that the set of files that's currently checked
2368         in is up-to-date. This checking can be used as part of a check-in hook
2369         or part of check-webkit-style to sooner catch cases where the
2370         .xcfilelist files need to be regenerated.
2371
2372         No new tests -- no changed functionality.
2373
2374         * DerivedSources.make:
2375         * DerivedSources.xcfilelist: Added.
2376         * UnifiedSources.xcfilelist: Added.
2377         * WebCore.xcodeproj/project.pbxproj:
2378
2379 2018-11-08  Don Olmstead  <don.olmstead@sony.com>
2380
2381         Provide generic implementation of SSLKeyGenerator functions
2382         https://bugs.webkit.org/show_bug.cgi?id=191428
2383
2384         Reviewed by Michael Catanzaro.
2385
2386         No new tests. No change in behavior.
2387
2388         Both SSLKeyGeneratorGLib and SSLKeyGeneratorIOS were stub
2389         implementations. Since <keygen> is deprecated it looks unlikely that
2390         an implementation is actually needed, however an implementation is
2391         needed until support is reomved.
2392
2393         * Sources.txt:
2394         * SourcesCocoa.txt:
2395         * WebCore.xcodeproj/project.pbxproj:
2396         * platform/SSLKeyGenerator.cpp: Added.
2397         (WebCore::getSupportedKeySizes):
2398         (WebCore::signedPublicKeyAndChallengeString):
2399         * platform/SourcesGLib.txt:
2400         * platform/glib/SSLKeyGeneratorGLib.cpp: Removed.
2401         * platform/ios/SSLKeyGeneratorIOS.cpp: Removed.
2402
2403 2018-11-07  Myles C. Maxfield  <mmaxfield@apple.com>
2404
2405         Unprefix text-decoration CSS3 properties
2406         https://bugs.webkit.org/show_bug.cgi?id=127193
2407
2408         Reviewed by Dean Jackson.
2409
2410         The properties are stable, and there is interop.
2411
2412         Test: fast/css3-text/css3-text-decoration/unprefix.html
2413
2414         * css/CSSComputedStyleDeclaration.cpp:
2415         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
2416         * css/CSSProperties.json:
2417         * css/StyleResolver.cpp:
2418         (WebCore::shouldApplyPropertyInParseOrder):
2419         (WebCore::isValidVisitedLinkProperty):
2420         * css/parser/CSSParserFastPaths.cpp:
2421         (WebCore::isColorPropertyID):
2422         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2423         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
2424         * css/parser/CSSPropertyParser.cpp:
2425         (WebCore::CSSPropertyParser::parseSingleValue):
2426         * editing/cocoa/DataDetection.mm:
2427         (WebCore::DataDetection::detectContentInRange):
2428         * rendering/TextDecorationPainter.cpp:
2429         (WebCore::decorationColor):
2430         * rendering/style/RenderStyle.cpp:
2431         (WebCore::RenderStyle::colorIncludingFallback const):
2432         (WebCore::RenderStyle::visitedDependentColor const):
2433
2434 2018-11-08  Timothy Hatcher  <timothy@apple.com>
2435
2436         Add experimental support for a `supported-color-schemes` CSS property.
2437         https://bugs.webkit.org/show_bug.cgi?id=191319
2438         rdar://problem/45852261
2439
2440         Reviewed by Dean Jackson.
2441
2442         Tests: css-dark-mode/parse-supported-color-schemes.html
2443                css-dark-mode/supported-color-schemes-css.html
2444
2445         * WebCore.xcodeproj/project.pbxproj:
2446         * css/CSSComputedStyleDeclaration.cpp:
2447         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
2448         * css/CSSProperties.json:
2449         * css/CSSValueKeywords.in:
2450         * css/StyleBuilderConverter.h:
2451         (WebCore::StyleBuilderConverter::updateSupportedColorSchemes):
2452         (WebCore::StyleBuilderConverter::convertSupportedColorSchemes):
2453         * css/StyleResolver.cpp:
2454         (WebCore::StyleResolver::colorFromPrimitiveValue const):
2455         * css/parser/CSSPropertyParser.cpp:
2456         (WebCore::consumeSupportedColorSchemes):
2457         (WebCore::CSSPropertyParser::parseSingleValue):
2458         * dom/Document.cpp:
2459         (WebCore::Document::resetLinkColor):
2460         (WebCore::Document::resetVisitedLinkColor):
2461         (WebCore::Document::resetActiveLinkColor):
2462         (WebCore::Document::processSupportedColorSchemes):
2463         (WebCore::Document::useDarkAppearance const):
2464         (WebCore::Document::styleColorOptions const):
2465         * dom/Document.h:
2466         * editing/cocoa/WebContentReaderCocoa.mm:
2467         (WebCore::createFragment):
2468         * html/canvas/CanvasRenderingContext2D.cpp:
2469         (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal):
2470         * inspector/InspectorOverlay.cpp:
2471         (WebCore::InspectorOverlay::paint):
2472         * page/FrameView.cpp:
2473         (WebCore::FrameView::useDarkAppearance const):
2474         (WebCore::FrameView::paintScrollCorner):
2475         * platform/mac/DragImageMac.mm:
2476         (WebCore::createDragImageForLink):
2477         * rendering/InlineFlowBox.cpp:
2478         (WebCore::InlineFlowBox::paintBoxDecorations):
2479         * rendering/InlineTextBox.cpp:
2480         (WebCore::InlineTextBox::paintPlatformDocumentMarker):
2481         * rendering/RenderBox.cpp:
2482         (WebCore::RenderBox::paintRootBoxFillLayers):
2483         (WebCore::RenderBox::paintBackground):
2484         * rendering/RenderElement.cpp:
2485         (WebCore::RenderElement::selectionColor const):
2486         (WebCore::RenderElement::selectionBackgroundColor const):
2487         (WebCore::RenderElement::paintFocusRing):
2488         * rendering/RenderImage.cpp:
2489         (WebCore::RenderImage::paintAreaElementFocusRing):
2490         * rendering/RenderLayerBacking.cpp:
2491         (WebCore::RenderLayerBacking::paintContents):
2492         * rendering/RenderLayerCompositor.cpp:
2493         (WebCore::RenderLayerCompositor::paintContents):
2494         * rendering/RenderListBox.cpp:
2495         (WebCore::RenderListBox::paintItemForeground):
2496         (WebCore::RenderListBox::paintItemBackground):
2497         * rendering/RenderObject.cpp:
2498         (WebCore::RenderObject::useDarkAppearance const):
2499         (WebCore::RenderObject::styleColorOptions const):
2500         * rendering/RenderObject.h:
2501         * rendering/RenderTableCell.cpp:
2502         (WebCore::RenderTableCell::paintBackgroundsBehindCell):
2503         * rendering/RenderTheme.cpp:
2504         (WebCore::RenderTheme::paint):
2505         * rendering/RenderTheme.h:
2506         (WebCore::RenderTheme::usingDarkAppearance const): Deleted.
2507         * rendering/RenderThemeMac.h:
2508         * rendering/RenderThemeMac.mm:
2509         (WebCore::RenderThemeMac::documentViewFor const):
2510         (WebCore::RenderThemeMac::adjustMenuListStyle const):
2511         (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
2512         (WebCore::RenderThemeMac::paintSliderThumb):
2513         (WebCore::RenderThemeMac::usingDarkAppearance const): Deleted.
2514         * rendering/style/RenderStyle.h:
2515         (WebCore::RenderStyle::supportedColorSchemes const):
2516         (WebCore::RenderStyle::setSupportedColorSchemes):
2517         (WebCore::RenderStyle::initialSupportedColorSchemes):
2518         * rendering/style/RenderStyleConstants.h:
2519         * rendering/style/StyleRareInheritedData.cpp:
2520         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
2521         (WebCore::StyleRareInheritedData::operator== const):
2522         * rendering/style/StyleRareInheritedData.h:
2523         * rendering/style/StyleSupportedColorSchemes.h: Added.
2524         (WebCore::StyleSupportedColorSchemes::StyleSupportedColorSchemes):
2525         (WebCore::StyleSupportedColorSchemes::operator== const):
2526         (WebCore::StyleSupportedColorSchemes::operator!= const):
2527         (WebCore::StyleSupportedColorSchemes::isAuto const):
2528         (WebCore::StyleSupportedColorSchemes::isOnly const):
2529         (WebCore::StyleSupportedColorSchemes::colorSchemes const):
2530         (WebCore::StyleSupportedColorSchemes::add):
2531         (WebCore::StyleSupportedColorSchemes::contains const):
2532         (WebCore::StyleSupportedColorSchemes::setAllowsTransformations):
2533         (WebCore::StyleSupportedColorSchemes::allowsTransformations const):
2534         * svg/graphics/SVGImage.cpp:
2535         (WebCore::SVGImage::draw):
2536
2537 2018-11-08  Joseph Pecoraro  <pecoraro@apple.com>
2538
2539         Web Inspector: Restrict domains at the target level instead of only at the window level
2540         https://bugs.webkit.org/show_bug.cgi?id=191344
2541
2542         Reviewed by Devin Rousso.
2543
2544         * inspector/WorkerInspectorController.cpp:
2545         (WebCore::WorkerInspectorController::WorkerInspectorController):
2546         Remove Inspector domain from workers. It was unused anyways.
2547
2548 2018-11-08  Dean Jackson  <dino@apple.com>
2549
2550         Add a String literal that returns a String
2551         https://bugs.webkit.org/show_bug.cgi?id=191425
2552         <rdar://problem/45914556>
2553
2554         Reviewed by Sam Weinig.
2555
2556         Use _str where possible.
2557
2558         API Test in WPT.
2559
2560         * Modules/fetch/FetchRequest.cpp:
2561         (WebCore::computeReferrer):
2562         * Modules/indexeddb/IDBKeyPath.cpp:
2563         (WebCore::loggingString):
2564         * Modules/webdatabase/OriginLock.cpp:
2565         (WebCore::OriginLock::lockFileNameForPath):
2566         * css/CSSBasicShapes.cpp:
2567         (WebCore::updateCornerRadiusWidthAndHeight):
2568         * html/canvas/WebGL2RenderingContext.cpp:
2569         (WebCore::WebGL2RenderingContext::getParameter):
2570         * html/canvas/WebGLRenderingContext.cpp:
2571         (WebCore::WebGLRenderingContext::getParameter):
2572         * loader/LinkHeader.cpp:
2573         (WebCore::parseParameterValue):
2574         * loader/LinkLoader.cpp:
2575         (WebCore::LinkLoader::preloadIfNeeded):
2576         * page/NavigatorBase.cpp:
2577         (WebCore::NavigatorBase::platform):
2578         * platform/DateComponents.cpp:
2579         (WebCore::DateComponents::toString const):
2580         * platform/mac/PlatformEventFactoryMac.mm:
2581         (WebCore::keyIdentifierForKeyEvent):
2582         * rendering/RenderListMarker.cpp:
2583         (WebCore::RenderListMarker::suffix const):
2584         * rendering/RenderMenuList.cpp:
2585         (RenderMenuList::setText):
2586         * testing/InternalSettings.cpp:
2587         (WebCore::InternalSettings::userInterfaceDirectionPolicy):
2588         (WebCore::InternalSettings::systemLayoutDirection):
2589         * testing/Internals.cpp:
2590         (WebCore::Internals::shadowRootType const):
2591         (WebCore::Internals::getCurrentCursorInfo):
2592
2593 2018-11-08  Jonathan Hammer  <jonathan@e3software.com>
2594
2595         Plain text drag in contenteditable is always DragOperationCopy, never DragOperationMove
2596         https://bugs.webkit.org/show_bug.cgi?id=191228
2597         <rdar://problem/45786830>
2598
2599         Reviewed by Wenson Hsieh.
2600
2601         DragController::beginDrag should not call cleanupAfterSystemDrag because
2602         the drag is still in progress even after the call to m_client.beginDrag()
2603         returns. This is in contrast to DragController::doSystemDrag, where the
2604         call to cleanupAfterSystemDrag is appropriate because the drag has
2605         concluded by the time m_client.startDrag() returns.
2606
2607         Test: fast/events/drag-and-drop-move-not-copy.html
2608
2609         * page/DragController.cpp:
2610         (WebCore::DragController::beginDrag):
2611
2612 2018-11-08  Zalan Bujtas  <zalan@apple.com>
2613
2614         [BFC][IFC] InlineFormattingContext::Line::alignRuns() should take care of all the alignments.
2615         https://bugs.webkit.org/show_bug.cgi?id=191414
2616
2617         Reviewed by Antti Koivisto.
2618
2619         * layout/inlineformatting/Line.cpp:
2620         (WebCore::Layout::InlineFormattingContext::Line::close):
2621
2622 2018-11-08  Jiewen Tan  <jiewen_tan@apple.com>
2623
2624         [WebAuthN] Import CTAP device request/response converters from Chromium
2625         https://bugs.webkit.org/show_bug.cgi?id=190784
2626         <rdar://problem/45460333>
2627
2628         Reviewed by Brent Fulgham.
2629
2630         This patch imports Chromium's CTAP device request/response converters:
2631         https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#message-encoding
2632         1. It directly imports the following files and suit them to WebKit's coding style:
2633         https://cs.chromium.org/chromium/src/device/fido/device_response_converter.cc?l=20&rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
2634         https://cs.chromium.org/chromium/src/device/fido/device_response_converter.h?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
2635         https://cs.chromium.org/chromium/src/device/fido/authenticator_get_info_response.cc?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
2636         https://cs.chromium.org/chromium/src/device/fido/authenticator_get_info_response.h?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
2637         https://cs.chromium.org/chromium/src/device/fido/authenticator_supported_options.cc?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
2638         https://cs.chromium.org/chromium/src/device/fido/authenticator_supported_options.h?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
2639         https://cs.chromium.org/chromium/src/device/fido/ctap_request_unittest.cc?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
2640         https://cs.chromium.org/chromium/src/device/fido/ctap_response_unittest.cc?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
2641         https://cs.chromium.org/chromium/src/device/fido/fido_test_data.h?l=1&rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
2642         2. It gathers the following methods into DeviceRequestConverter:
2643         CtapGetAssertionRequest::EncodeAsCBOR()
2644         CtapMakeCredentialRequest::EncodeAsCBOR()
2645         PublicKeyCredentialDescriptor::ConvertToCBOR()
2646         PublicKeyCredentialParams::ConvertToCBOR()
2647         PublicKeyCredentialRpEntity::ConvertToCBOR()
2648         PublicKeyCredentialUserEntity::ConvertToCBOR()
2649         3. It also apply a patch from Chromium to CBORValue:
2650         https://chromium.googlesource.com/chromium/src/+/7b6fbff35cd8e4d508f08e1cd93b4aa0a0dc402c%5E%21/
2651
2652         Besides importing things from Chromium, it also implements UserVerificationRequirement for both
2653         PublicKeyCredentialCreationOptions and PublicKeyCredentialRequestOptions such that both options
2654         can specify more dimensions of a desired authenticator.
2655
2656         Covered by API tests.
2657
2658         * CMakeLists.txt:
2659         * DerivedSources.make:
2660         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
2661         (WebCore::PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::encode const):
2662         (WebCore::PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::decode):
2663         * Modules/webauthn/PublicKeyCredentialCreationOptions.idl:
2664         * Modules/webauthn/PublicKeyCredentialRequestOptions.h:
2665         (WebCore::PublicKeyCredentialRequestOptions::encode const):
2666         (WebCore::PublicKeyCredentialRequestOptions::decode):
2667         * Modules/webauthn/PublicKeyCredentialRequestOptions.idl:
2668         * Modules/webauthn/UserVerificationRequirement.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialRequestOptions.idl.
2669         * Modules/webauthn/UserVerificationRequirement.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialRequestOptions.idl.
2670         * Modules/webauthn/cbor/CBORValue.cpp:
2671         (cbor::CBORValue::CBORValue):
2672         (cbor::CBORValue::getBool const):
2673         * Modules/webauthn/cbor/CBORValue.h:
2674         * Modules/webauthn/fido/AuthenticatorGetInfoResponse.cpp: Added.
2675         (fido::toArrayValue):
2676         (fido::AuthenticatorGetInfoResponse::AuthenticatorGetInfoResponse):
2677         (fido::AuthenticatorGetInfoResponse::setMaxMsgSize):
2678         (fido::AuthenticatorGetInfoResponse::setPinProtocols):
2679         (fido::AuthenticatorGetInfoResponse::setExtensions):
2680         (fido::AuthenticatorGetInfoResponse::setOptions):
2681         (fido::encodeAsCBOR):
2682         * Modules/webauthn/fido/AuthenticatorGetInfoResponse.h: Added.
2683         * Modules/webauthn/fido/AuthenticatorSupportedOptions.cpp: Added.
2684         (fido::AuthenticatorSupportedOptions::setSupportsResidentKey):
2685         (fido::AuthenticatorSupportedOptions::setUserVerificationAvailability):
2686         (fido::AuthenticatorSupportedOptions::setUserPresenceRequired):
2687         (fido::AuthenticatorSupportedOptions::setClientPinAvailability):
2688         (fido::AuthenticatorSupportedOptions::setIsPlatformDevice):
2689         (fido::convertToCBOR):
2690         * Modules/webauthn/fido/AuthenticatorSupportedOptions.h: Added.
2691         * Modules/webauthn/fido/DeviceRequestConverter.cpp: Added.
2692         (fido::convertRpEntityToCBOR):
2693         (fido::convertUserEntityToCBOR):
2694         (fido::convertParametersToCBOR):
2695         (fido::convertDescriptorToCBOR):
2696         (fido::encodeMakeCredenitalRequestAsCBOR):
2697         (fido::encodeGetAssertionRequestAsCBOR):
2698         (fido::encodeEmptyAuthenticatorRequest):
2699         * Modules/webauthn/fido/DeviceRequestConverter.h: Copied from Source/WebCore/Modules/webauthn/fido/FidoConstants.h.
2700         * Modules/webauthn/fido/DeviceResponseConverter.cpp: Added.
2701         (fido::convertStringToProtocolVersion):
2702         (fido::getResponseCode):
2703         (fido::getCredentialId):
2704         (fido::readCTAPMakeCredentialResponse):
2705         (fido::readCTAPGetAssertionResponse):
2706         (fido::readCTAPGetInfoResponse):
2707         * Modules/webauthn/fido/DeviceResponseConverter.h: Copied from Source/WebCore/Modules/webauthn/fido/FidoConstants.cpp.
2708         * Modules/webauthn/fido/FidoConstants.cpp:
2709         (fido::isCtapDeviceResponseCode):
2710         (fido::publicKeyCredentialTypeToString):
2711         * Modules/webauthn/fido/FidoConstants.h:
2712         * Sources.txt:
2713         * WebCore.xcodeproj/project.pbxproj:
2714
2715 2018-11-07  Justin Michaud  <justin_michaud@apple.com>
2716
2717         CSS Painting API should pass size, arguments and input properties to paint callback
2718         https://bugs.webkit.org/show_bug.cgi?id=191309
2719
2720         Reviewed by Chris Dumez.
2721
2722         Call paint() callback with input properties and arguments. This patch adds a stub for 
2723         the CSS Typed OM StylePropertyMapReadOnly, and passes all the arguments as strings without 
2724         any syntax checking to the paint callback.
2725
2726         Test: fast/css-custom-paint/properties.html
2727
2728         * CMakeLists.txt:
2729         * DerivedSources.make:
2730         * Sources.txt:
2731         * WebCore.xcodeproj/project.pbxproj:
2732         * bindings/js/JSCSSStyleValueCustom.cpp: Copied from Source/WebCore/css/CSSPaintCallback.h.
2733         (WebCore::toJSNewlyCreated):
2734         (WebCore::toJS):
2735         * bindings/js/WebCoreBuiltinNames.h:
2736         * css/CSSPaintCallback.h:
2737         * css/CSSPaintCallback.idl:
2738         * css/CSSPaintImageValue.cpp:
2739         (WebCore::CSSPaintImageValue::image):
2740         * css/CSSPaintImageValue.h:
2741         * css/CSSPaintSize.h: Copied from Source/WebCore/css/CSSPaintCallback.h.
2742         (WebCore::CSSPaintSize::create):
2743         (WebCore::CSSPaintSize::width const):
2744         (WebCore::CSSPaintSize::height const):
2745         (WebCore::CSSPaintSize::CSSPaintSize):
2746         * css/CSSPaintSize.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl.
2747         * css/parser/CSSPropertyParserHelpers.cpp:
2748         (WebCore::CSSPropertyParserHelpers::consumeCustomPaint):
2749         * css/typedom/CSSNumericValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h.
2750         * css/typedom/CSSNumericValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl.
2751         * css/typedom/CSSStyleValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h.
2752         (WebCore::CSSStyleValue::isUnitValue):
2753         (WebCore::CSSStyleValue::isUnparsedValue):
2754         * css/typedom/CSSStyleValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl.
2755         * css/typedom/CSSUnitValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h.
2756         * css/typedom/CSSUnitValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl.
2757         * css/typedom/CSSUnparsedValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h.
2758         * css/typedom/CSSUnparsedValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl.
2759         * css/typedom/StylePropertyMapReadOnly.h: Copied from Source/WebCore/css/CSSPaintCallback.h.
2760         (WebCore::StylePropertyMapReadOnly::create):
2761         (WebCore::StylePropertyMapReadOnly::get):
2762         (WebCore::StylePropertyMapReadOnly::StylePropertyMapReadOnly):
2763         * css/typedom/StylePropertyMapReadOnly.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl.
2764         * platform/graphics/CustomPaintImage.cpp:
2765         (WebCore::CustomPaintImage::CustomPaintImage):
2766         (WebCore::CustomPaintImage::doCustomPaint):
2767         * platform/graphics/CustomPaintImage.h:
2768
2769 2018-11-07  Brent Fulgham  <bfulgham@apple.com>
2770
2771         Provide better Font fallbacks for DirectX backend
2772         https://bugs.webkit.org/show_bug.cgi?id=191412
2773         <rdar://problem/45899207>
2774
2775         Reviewed by Zalan Bujtas.
2776
2777         Registration of custom fonts through GDI are not always visible
2778         through the DirectWrite/GDI bridging layer. If a font is not located,
2779         locate the closest matching avialable font rather than failing.
2780
2781         * platform/graphics/FontPlatformData.h:
2782         * platform/graphics/win/FontCustomPlatformData.cpp:
2783         (WebCore::FontCustomPlatformData::fontPlatformData): Use new font
2784         fallback logic.
2785         * platform/graphics/win/FontPlatformDataDirect2D.cpp:
2786         (WebCore::FontPlatformData::platformDataInit):
2787         (WebCore::FontPlatformData::platformIsEqual const):
2788         (WebCore::FontPlatformData::createFallbackFont): Added.
2789
2790 2018-11-07  Zalan Bujtas  <zalan@apple.com>
2791
2792         Click and touch event listeners on the body don't work
2793         https://bugs.webkit.org/show_bug.cgi?id=191392
2794         <rdar://problem/5844416>
2795
2796         Reviewed by Simon Fraser.
2797
2798         Remove the old quirk of ignoring onclick handlers on the body and beyond.
2799
2800         Test: fast/events/click-handler-on-body-simple.html
2801
2802         * page/ios/FrameIOS.mm:
2803         (WebCore::Frame::nodeRespondingToClickEvents):
2804
2805 2018-11-07  Brent Fulgham  <bfulgham@apple.com>
2806
2807         [Windows][DirectX] Update canvas code to pass more tests
2808         https://bugs.webkit.org/show_bug.cgi?id=191337
2809         <rdar://problem/45878801>
2810
2811         Reviewed by Dean Jackson.
2812
2813         Update the Direct2D code paths to comply with our canvas tests, improving the
2814         the test results scores to 579/770.
2815
2816         PathDirect2D was updated with an implementation of 'addArcTo' based on work by
2817         Dirk Schulze <vbs85@gmx.de> (see https://hg.mozilla.org/mozilla-central/rev/b116b49459f8).
2818
2819         Tests: canvas/philip/tests
2820
2821         * platform/graphics/ImageBuffer.cpp:
2822         (WebCore::ImageBuffer::createCompatibleBuffer): Direct2D needs access to the graphics
2823         context to create the buffer.
2824         * platform/graphics/ImageBuffer.h:
2825         * platform/graphics/Path.h:
2826         * platform/graphics/win/GraphicsContextDirect2D.cpp:
2827         (WebCore::GraphicsContext::drawPattern): Flush needed.
2828         (WebCore::GraphicsContext::drawRect): Ditto.
2829         (WebCore::GraphicsContextPlatformPrivate::setMiterLimit): Correct for Direct2D definition of miter limit.
2830         (WebCore::GraphicsContextPlatformPrivate::strokeStyleProperties const): Added helper function.
2831         (WebCore::GraphicsContextPlatformPrivate::recomputeStrokeStyle): Update for new helper.
2832         (WebCore::GraphicsContext::drawLine): Ditto.
2833         (WebCore::drawWithShadowHelper): Ditto.
2834         (WebCore::GraphicsContext::fillRect): Add flush.
2835         (WebCore::GraphicsContext::platformFillRoundedRect): Update for helper.
2836         (WebCore::GraphicsContext::clipPath): Add flush.
2837         (WebCore::GraphicsContext::strokeRect): Ditto.
2838         (WebCore::GraphicsContext::drawLineForText): Update for upstream changes.
2839         (WebCore::GraphicsContext::drawLinesForText): Ditto.
2840         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
2841         * platform/graphics/win/ImageBufferDirect2D.cpp:
2842         (WebCore::createCroppedImageIfNecessary): Add missing implementations.
2843         (WebCore::createBitmapImageAfterScalingIfNeeded): Ditto.
2844         (WebCore::ImageBuffer::copyImage const): Ditto.
2845         (WebCore::ImageBuffer::sinkIntoImage): Ditto.
2846         (WebCore::ImageBuffer::fastCopyImageMode): Ditto.
2847         (WebCore::ImageBuffer::sinkIntoNativeImage): Ditto.
2848         (WebCore::ImageBuffer::copyNativeImage const): Ditto.
2849         * platform/graphics/win/PathDirect2D.cpp:
2850         (WebCore::Path::operator=):
2851         (WebCore::Path::drawDidComplete): This should never have been const.
2852         It manipulates the path!
2853         (WebCore::Path::transform): Properly transform existing geometries.
2854         (WebCore::Path::openFigureAtCurrentPointIfNecessary): Added.
2855         (WebCore::Path::moveTo):
2856         (WebCore::Path::addLineTo): Make sure figure starts at a valid point.
2857         (WebCore::Path::addQuadCurveTo): Ditto.
2858         (WebCore::Path::addBezierCurveTo): Ditto.
2859         (WebCore::Path::addArcTo): Add implementation.
2860         (WebCore::Path::closeSubpath):
2861         (WebCore::drawArcSection):
2862         (WebCore::Path::addArc): Update to build large arcs out of small arc segments. If the
2863         arc is effectively a complete circle, use the ellipse drawing routines.
2864         (WebCore::Path::addRect): Make sure we start at a valid starting point.
2865         (WebCore::Path::addEllipse): Correct for definition of D2D ellipse.
2866         (WebCore::Path::drawDidComplete const): Deleted.
2867         * platform/graphics/win/SimpleFontDataDirect2D.cpp:
2868         (WebCore::Font::platformWidthForGlyph const):
2869         * rendering/svg/RenderSVGResourceClipper.cpp:
2870         (WebCore::RenderSVGResourceClipper::applyClippingToContext):
2871         * rendering/svg/RenderSVGResourceFilter.cpp:
2872         (WebCore::RenderSVGResourceFilter::applyResource):
2873         * rendering/svg/RenderSVGResourceMasker.cpp:
2874         (WebCore::RenderSVGResourceMasker::applyResource):
2875         * rendering/svg/SVGRenderingContext.cpp:
2876         (WebCore::SVGRenderingContext::createImageBuffer):
2877         * rendering/svg/SVGRenderingContext.h:
2878
2879 2018-11-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2880
2881         Add an editing command for creating and inserting child lists
2882         https://bugs.webkit.org/show_bug.cgi?id=191335
2883         <rdar://problem/45814050>
2884
2885         Reviewed by Ryosuke Niwa.
2886
2887         Currently, insertOrderedList and insertUnorderedList only toggle or change list state (i.e. if the selection is
2888         in an ordered or unordered list, reinserting the same list type removes the current list, and inserting a
2889         different list type changes the enclosing list).
2890
2891         However, for certain internal clients (e.g. Mail), if the start of the selection is enclosed by a list item, we
2892         instead create a new list item and insert it after the enclosing list item, and then create a new list within
2893         that list item. Currently, this logic is implemented in Mail for legacy-WebKit-based Mail compose. This patch
2894         brings this logic into WebKit in the form of a new editing command.
2895
2896         Tests: editing/execCommand/insert-nested-lists-in-table.html
2897                editing/execCommand/insert-nested-lists-with-pre.html
2898                editing/execCommand/insert-nested-lists.html
2899
2900         * Sources.txt:
2901         * WebCore.xcodeproj/project.pbxproj:
2902         * editing/Editor.cpp:
2903         (WebCore::Editor::insertOrderedList):
2904         (WebCore::Editor::insertUnorderedList):
2905         * editing/EditorCommand.cpp:
2906         (WebCore::executeInsertOrderedList):
2907         (WebCore::executeInsertUnorderedList):
2908         (WebCore::executeInsertNestedUnorderedList):
2909         (WebCore::executeInsertNestedOrderedList):
2910         (WebCore::createCommandMap):
2911         * editing/IndentOutdentCommand.cpp:
2912         (WebCore::IndentOutdentCommand::outdentParagraph):
2913         * editing/InsertListCommand.cpp:
2914         (WebCore::InsertListCommand::doApply):
2915         (WebCore::InsertListCommand::editingAction const):
2916         * editing/InsertListCommand.h:
2917
2918         Change a couple of `enum`s into `enum class`es.
2919
2920         * editing/InsertNestedListCommand.cpp: Added.
2921         (WebCore::InsertNestedListCommand::insertUnorderedList):
2922         (WebCore::InsertNestedListCommand::insertOrderedList):
2923         (WebCore::InsertNestedListCommand::doApply):
2924         * editing/InsertNestedListCommand.h: Added.
2925
2926         Add a new edit command to insert a new list (as a child of any containing list). If the start of the selection
2927         is in a list item, we create a new list item, move the selection into the list item, and increment its list
2928         level; otherwise, simply fall back to inserting a list.
2929
2930         * editing/ModifySelectionListLevel.cpp:
2931         (WebCore::IncreaseSelectionListLevelCommand::doApply):
2932         (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevel):
2933         (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevelOrdered):
2934         (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevelUnordered):
2935         * editing/ModifySelectionListLevel.h:
2936
2937         Expose this constructor, allowing other edit commands to change selection list level as a composite edit
2938         command. Also, change an `enum` into an `enum class`.
2939
2940         (WebCore::IncreaseSelectionListLevelCommand::create):
2941
2942 2018-11-07  Chris Dumez  <cdumez@apple.com>
2943
2944         ASSERT(renderer()) under HTMLTextAreaElement::updateValue()
2945         https://bugs.webkit.org/show_bug.cgi?id=191391
2946         <rdar://problem/34219633>
2947
2948         Reviewed by Geoffrey Garen.
2949
2950         Update HTMLTextFormControlElement::didEditInnerTextValue() to not call subtreeHasChanged()
2951         if the element has no renderer, similarly to what is already done in 
2952         HTMLTextFormControlElement::setRangeText() and HTMLInputElement::setEditingValue().
2953
2954         Test: editing/inserting/inset-html-textarea-without-renderer.html
2955
2956         * html/HTMLTextFormControlElement.cpp:
2957         (WebCore::HTMLTextFormControlElement::didEditInnerTextValue):
2958
2959 2018-11-07  Youenn Fablet  <youenn@apple.com>
2960
2961         Allow setting RTCRtpTransceiver.direction
2962         https://bugs.webkit.org/show_bug.cgi?id=191346
2963
2964         Reviewed by Eric Carlson.
2965
2966         Remove readonly from the direction attribute.
2967         Keep setDirection for now as it is in use, with an intent to remove it.
2968         Driven-by fix as in some cases, the rtc source track might be changed
2969         and current implementation is not expecting that.
2970         In such a case, stop observing the old track (which should no longer call us)
2971         before observing the new one.
2972
2973         Covered by rebased tests.
2974
2975         * Modules/mediastream/RTCRtpTransceiver.idl:
2976         * platform/mediastream/RealtimeIncomingAudioSource.cpp:
2977         (WebCore::RealtimeIncomingAudioSource::setSourceTrack):
2978         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
2979         (WebCore::RealtimeIncomingVideoSource::setSourceTrack):
2980
2981 2018-11-07  Sihui Liu  <sihui_liu@apple.com>
2982
2983         RELEASE_ASSERT(!m_hardClosedForUserDelete) fails in WebCore::IDBServer::UniqueIDBDatabase::invokeOperationAndTransactionTimer
2984         https://bugs.webkit.org/show_bug.cgi?id=191326
2985         <rdar://problem/45769269>
2986
2987         Reviewed by Geoffrey Garen.
2988
2989         UniqueIDBDatabase should ignore incoming requests or operations when it is already marked as
2990         hardClosedForUserDelete.
2991
2992         Test: IndexedDB.IndexedDBUserDelete.
2993
2994         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2995         (WebCore::IDBServer::UniqueIDBDatabase::didPerformActivateTransactionInBackingStore):
2996         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
2997         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
2998         (WebCore::IDBServer::UniqueIDBDatabaseConnection::establishTransaction):
2999         (WebCore::IDBServer::UniqueIDBDatabaseConnection::deleteTransaction):
3000         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
3001         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
3002         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::commit):
3003
3004 2018-11-07  Myles C. Maxfield  <mmaxfield@apple.com>
3005
3006         Positioned text underline can look like a strike-through
3007         https://bugs.webkit.org/show_bug.cgi?id=191341
3008
3009         Reviewed by Simon Fraser.
3010
3011         We should just clamp the value so it can't go above the baseline.
3012
3013         We shouldn't do this at parse time because it's totally reasonable for text-underline-position: under to want
3014         a negative text-underline-offset. Instead, we just do it at used value time.
3015
3016         Test: fast/css3-text/css3-text-decoration/text-underline-negative.html
3017
3018         * style/InlineTextBoxStyle.cpp:
3019         (WebCore::computeUnderlineOffset):
3020
3021 2018-11-07  Chris Dumez  <cdumez@apple.com>
3022
3023         Unreviewed, fix iOS build with recent SDKs.
3024
3025         * platform/network/cocoa/ResourceResponseCocoa.mm:
3026         (WebCore::ResourceResponse::platformCertificateInfo const):
3027
3028 2018-11-07  Chris Dumez  <cdumez@apple.com>
3029
3030         Unreviewed, fix iOS build with recent SDKs.
3031
3032         * platform/network/cocoa/ResourceResponseCocoa.mm:
3033         (WebCore::ResourceResponse::platformCertificateInfo const):
3034
3035 2018-11-07  Myles C. Maxfield  <mmaxfield@apple.com>
3036
3037         Dotted underlines that skip descenders are invisible
3038         https://bugs.webkit.org/show_bug.cgi?id=191403
3039
3040         Reviewed by Simon Fraser.
3041
3042         Turns out our underline bounding boxes had negative width. When drawing the full
3043         underline that was fine because it was handled by the 2D graphics engine, but when
3044         we try to split up the box into dots, our "for" loop was taking 0 iterations (because
3045         the end was before the start).
3046
3047         Test: fast/css3-text/css3-text-decoration/text-underline-style.html
3048
3049         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3050         (WebCore::GraphicsContext::drawLineForText):
3051         * platform/graphics/cg/GraphicsContextCG.cpp:
3052         (WebCore::GraphicsContext::drawLineForText):
3053         * platform/graphics/win/GraphicsContextDirect2D.cpp:
3054         (WebCore::GraphicsContext::drawLineForText):
3055
3056 2018-11-07  Andy Estes  <aestes@apple.com>
3057
3058         Crash in WebCore::PaymentRequest::canMakePayment when Apple Pay payment method data is missing
3059         https://bugs.webkit.org/show_bug.cgi?id=191331
3060
3061         Reviewed by Alexey Proskuryakov.
3062
3063         Apple Pay requires merchants specify an ApplePayRequest (which contains several required
3064         fields) as payment method data when constructing a new PaymentRequest. If the
3065         ApplePayRequest is missing required fields, or is missing entirely, canMakePayment() should
3066         resolve to false.
3067
3068         We would properly resolve to false when an ApplePayRequest was specified with missing
3069         required fields, but we would crash when the ApplePayRequest was missing entirely.
3070
3071         This patch fixes the crash by checking for an empty JSValue before trying to convert it to
3072         an ApplePayRequest struct. Because we stringify ApplePayRequests in the PaymentRequest
3073         constructor then parse them again in canMakePayments, an undefined or null payment method
3074         data stringifies to a null String, which then parses to an empty JSValue.
3075
3076         Added test case to http/tests/paymentrequest/payment-request-canmakepayment-method.https.html.
3077
3078         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
3079         (WebCore::ApplePayPaymentHandler::convertData):
3080         * Modules/paymentrequest/PaymentRequest.cpp:
3081         (WebCore::PaymentRequest::canMakePayment):
3082
3083 2018-11-07  Simon Fraser  <simon.fraser@apple.com>
3084
3085         Revert 237849: it breaks MotionMark
3086         https://bugs.webkit.org/show_bug.cgi?id=191398
3087
3088         Reviewed by Simon Fraser.
3089
3090         This change broke painting while the test is running.
3091
3092         * rendering/RenderLayerCompositor.cpp:
3093         (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
3094
3095 2018-11-07  Don Olmstead  <don.olmstead@sony.com>
3096
3097         Simplify macros in platform
3098         https://bugs.webkit.org/show_bug.cgi?id=191378
3099
3100         Reviewed by Michael Catanzaro.
3101
3102         No new tests. No change in behavior.
3103
3104         Modifies a few cases where a platform macro could be simplified.
3105
3106         * page/EventHandler.cpp:
3107         * platform/network/DNS.h:
3108         * platform/network/NetworkStateNotifier.h:
3109
3110 2018-11-07  Simon Fraser  <simon.fraser@apple.com>
3111
3112         Some WK1 repaint tests are flakey
3113         https://bugs.webkit.org/show_bug.cgi?id=190627
3114
3115         Reviewed by Zalan Bujtas.
3116
3117         Repaint tracking in GraphicsLayerCA was sensitive to whether there were already dirty
3118         rects on the layer, since tracking happened after checks against existing dirty rects.
3119         This caused some WK1 repaint tests to be flakey, since there's no guarantee that
3120         no repaints happen between the last layer flush and a test calling startTrackingRepaints().
3121
3122         Fix by moving the repaint tracking to before the checks against existing dirty rects.
3123         This is more similar to how repaint tracking on FrameView works.
3124
3125         * platform/graphics/ca/GraphicsLayerCA.cpp:
3126         (WebCore::GraphicsLayerCA::setNeedsDisplayInRect):
3127
3128 2018-11-07  Dean Jackson  <dino@apple.com>
3129
3130         [iOS] WebGL leaks exact GPU type
3131         https://bugs.webkit.org/show_bug.cgi?id=191393
3132
3133         Reviewed by Tim Horton.
3134
3135         The fully exposed renderer info shouldn't be necessary
3136         on iOS, where the GPUs and drivers are consistent
3137         enough that people shouldn't need to write code specifically
3138         for them. Reduce the ability to fingerprint by simply
3139         returning "Apple GPU".
3140
3141         The other option would have been to disable the extension,
3142         but I think it might still be useful to know you're on
3143         an iOS device.
3144
3145         Test: fast/canvas/webgl/hide-some-renderer-info.html
3146
3147         * html/canvas/WebGL2RenderingContext.cpp: Return "Apple GPU"
3148         on iOS.
3149         (WebCore::WebGL2RenderingContext::getParameter):
3150         * html/canvas/WebGLRenderingContext.cpp: Ditto.
3151         (WebCore::WebGLRenderingContext::getParameter):
3152
3153 2018-11-07  Daniel Bates  <dabates@apple.com>
3154
3155         Override +[UIKeyboard isInHardwareKeyboardMode] in WebKitTestRunner and DumpRenderTree
3156         https://bugs.webkit.org/show_bug.cgi?id=190141
3157
3158         Reviewed by Darin Adler.
3159
3160         Remove the runtime application check for WebKitTestRunner as we no longer need this
3161         now that WebKitTestRunner and DumpRenderTree override +[UIKeyboard isInHardwareKeyboardMode].
3162
3163         * platform/RuntimeApplicationChecks.h:
3164         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
3165         (WebCore::IOSApplication::isWebKitTestRunner): Deleted.
3166
3167 2018-11-07  Joseph Pecoraro  <pecoraro@apple.com>
3168
3169         Web Inspector: Fix "Javascript" => "JavaScript" enum in protocol generated objects
3170         https://bugs.webkit.org/show_bug.cgi?id=191340
3171
3172         Reviewed by Devin Rousso.
3173
3174         * inspector/agents/InspectorMemoryAgent.cpp:
3175         (WebCore::InspectorMemoryAgent::collectSample):
3176         Use new enum name.
3177
3178 2018-11-07  Dan Bernstein  <mitz@apple.com>
3179
3180         Add a pseudoclass that matches img elements that are backed by an attachment
3181         https://bugs.webkit.org/show_bug.cgi?id=191286
3182         <rdar://problem/45823554>
3183
3184         Reviewed by Dean Jackson.
3185
3186         Test: fast/css/has-attachment.html
3187
3188         Added a :has-attachment pseudoclass, enabled only when the attachment element is enabled at
3189         runtime, that matches elements (currently only img elements qualify) that have an attachment
3190         element in their shadow DOM.
3191
3192         * css/CSSSelector.cpp:
3193         (WebCore::CSSSelector::selectorText const): Handle the new PseudoClassHasAttachment value.
3194         * css/CSSSelector.h: Added a new value to the PseudoClassType enum.
3195
3196         * css/SelectorChecker.cpp:
3197         (WebCore::SelectorChecker::checkOne const): Check the new PseudoClassHasAttachment value
3198           using the new hasAttachment test function.
3199
3200         * css/SelectorCheckerTestFunctions.h:
3201         (WebCore::hasAttachment): Added. Tests if the element is an img element that has an
3202           attachment.
3203
3204         * css/SelectorPseudoClassAndCompatibilityElementMap.in: Added has-attachment.
3205
3206         * css/parser/CSSParserContext.cpp:
3207         (WebCore::CSSParserContext::CSSParserContext): Initialize new attachmentEnabled member based
3208           on RuntimeEnabledFeatures.
3209         (WebCore::operator==): Compare new attachmentEnabled member.
3210         * css/parser/CSSParserContext.h:
3211         (WebCore::CSSParserContextHash::hash): Include new attachmentEnabled member.
3212
3213         * css/parser/CSSSelectorParser.cpp:
3214         (WebCore::CSSSelectorParser::consumePseudo): Reject :has-attachment if the attachment
3215           element is not enabled.
3216
3217         * cssjit/SelectorCompiler.cpp:
3218         (WebCore::SelectorCompiler::addPseudoClassType): Handle PseudoClassHasAttachment.
3219
3220 2018-11-07  Don Olmstead  <don.olmstead@sony.com>
3221
3222         Make generic MainThreadSharedTimer implementation
3223         https://bugs.webkit.org/show_bug.cgi?id=191327
3224
3225         Reviewed by Michael Catanzaro.
3226
3227         No new tests. No change in behavior.
3228
3229         Moves generic implementation for MainThreadSharedTimerGlib.cpp into
3230         MainThreadSharedTimer.cpp.
3231
3232         * platform/MainThreadSharedTimer.cpp:
3233         (WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
3234         (WebCore::MainThreadSharedTimer::setFireInterval):
3235         (WebCore::MainThreadSharedTimer::stop):
3236         (WebCore::MainThreadSharedTimer::invalidate):
3237         * platform/MainThreadSharedTimer.h:
3238         * platform/SourcesGLib.txt:
3239         * platform/glib/MainThreadSharedTimerGLib.cpp: Removed.
3240
3241 2018-11-07  Ali Juma  <ajuma@chromium.org>
3242
3243         IntersectionObserverEntry doesn't keep JS wrappers of rects alive
3244         https://bugs.webkit.org/show_bug.cgi?id=191330
3245
3246         Reviewed by Chris Dumez.
3247
3248         Retain wrappers of each rect in an IntersectionObserverEntry as long as the entry's wrapper
3249         is alive, by adding these wrappers as opaque roots.
3250
3251         Test: intersection-observer/intersection-observer-entry-keeps-js-wrappers-of-rects-alive.html
3252
3253         * bindings/js/JSIntersectionObserverEntryCustom.cpp:
3254         (WebCore::JSIntersectionObserverEntry::visitAdditionalChildren):
3255         * dom/DOMRectReadOnly.idl:
3256         * page/IntersectionObserverEntry.h:
3257         (WebCore::IntersectionObserverEntry::rootBounds const): Make this return a raw pointer instead of a RefPtr so that it
3258         can be called in JSIntersectionObserverEntry::visitAdditionalChildren, which can be called from non-main threads.
3259         (WebCore::IntersectionObserverEntry::boundingClientRect const): Ditto.
3260         (WebCore::IntersectionObserverEntry::intersectionRect const): Ditto.
3261
3262 2018-11-07  Simon Fraser  <simon.fraser@apple.com>
3263
3264         TileController::tileSize() should not have side effects
3265         https://bugs.webkit.org/show_bug.cgi?id=191349
3266
3267         Reviewed by Zalan Bujtas.
3268
3269         Calling TileController::tileSize() would recompute a new tile size and set m_tileSizeLocked,
3270         which caused test failures if logging was enabled when running tests.
3271
3272         * platform/graphics/ca/TileController.cpp:
3273         (WebCore::TileController::tileSize const):
3274         (WebCore::TileController::computeTileSize):
3275         * platform/graphics/ca/TileController.h:
3276         * platform/graphics/ca/TileGrid.cpp:
3277         (WebCore::TileGrid::revalidateTiles):
3278
3279 2018-11-07  Charlie Turner  <cturner@igalia.com>
3280
3281         [EME][GStreamer] Ensure key id buffers are present and simplify lifetime management of ClearKey class.
3282         https://bugs.webkit.org/show_bug.cgi?id=191157
3283
3284         Reviewed by Xabier Rodriguez-Calvar.
3285
3286         This is in preparation for moving the clearkey decryptor behind a
3287         new decrypt API in CDMInstance, which will be sent into the
3288         pipeline to handle key management and decryption. This is for a
3289         later patch.
3290
3291         Covered by existing clear key tests in media/encrypted-media.
3292
3293         * platform/graphics/gstreamer/GStreamerCommon.h:
3294         (WebCore::GstMappedBuffer::data const): Add a const data accessor,
3295         since we are now providing operator=='s on const objects of this
3296         class that need const access to the data pointer.
3297         (WebCore::GstMappedBuffer::operator==): Add a swap of the new
3298         equality operator so you don't have to remember to have the
3299         GstBuffer on the RHS of the equality all the time.
3300         (WebCore::operator==): Define an equality operator between Gst
3301         buffers and WebCore's mapped buffers. Gst creates a ref and a
3302         separate read view under the covers in the memcmp call, so we do
3303         not need to map the buffer ourselves.
3304         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
3305         (webkit_media_clear_key_decrypt_class_init): Remove setup/release
3306         bindings.
3307         (webkit_media_clear_key_decrypt_init): Initialize gcrypt cipher
3308         here once instead of for every buffer to be decrypted.
3309         (webKitMediaClearKeyDecryptorFinalize): And destroy the cipher
3310         context when the decryptor is destroyed.
3311         (webKitMediaClearKeyDecryptorFindAndSetKey): Factor out the key
3312         retrieval and context setting in this method, call it for each
3313         sample.
3314         (webKitMediaClearKeyDecryptorDecrypt): Base key id buffer into
3315         this function, and remove cipher creation / destroy methods.
3316         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
3317         (webkit_media_common_encryption_decrypt_class_init): Remove
3318         setup/release bindings.
3319         (webkitMediaCommonEncryptionDecryptTransformInPlace): Ensure a key
3320         id is present and pass it to the decrypt class method.
3321         (webKitMediaCommonEncryptionDecryptDefaultSetupCipher): Deleted.
3322         (webKitMediaCommonEncryptionDecryptDefaultReleaseCipher): Deleted.
3323         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
3324
3325 2018-11-07  Frederic Wang  <fwang@igalia.com>
3326
3327         [Cairo] Move state change operations from GraphicsContextCairo to CairoOperations
3328         https://bugs.webkit.org/show_bug.cgi?id=179610
3329
3330         Unreviewed build fix.
3331
3332         * platform/graphics/cairo/GraphicsContextCairo.cpp: Add missing include.
3333
3334 2018-11-06  Joseph Pecoraro  <pecoraro@apple.com>
3335
3336         ServiceWorker Inspector: Uncaught Exception: null is not an object (evaluating 'resource.target.addResource')
3337         https://bugs.webkit.org/show_bug.cgi?id=191339
3338
3339         Reviewed by Matt Baker.
3340
3341         * workers/service/ServiceWorkerJob.cpp:
3342         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
3343         Use the Service Worker's identifier, not this static but otherwise unknown identifier.
3344
3345 2018-11-06  Youenn Fablet  <youenn@apple.com>
3346
3347         sender.replaceTrack() fails with InvalidStateError if the transceiver.direction is "inactive"
3348         https://bugs.webkit.org/show_bug.cgi?id=191202
3349
3350         Reviewed by Eric Carlson.
3351
3352         Covered by updated test.
3353
3354         * Modules/mediastream/RTCPeerConnection.cpp:
3355         (WebCore::RTCPeerConnection::removeTrack):
3356         Update as per spec, in particular make sure to not stop the sender when removing the track.
3357
3358 2018-11-06  Justin Fan  <justin_fan@apple.com>
3359
3360         [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain
3361         https://bugs.webkit.org/show_bug.cgi?id=191291
3362
3363         Reviewed by Myles Maxfield.
3364
3365         Test: webgpu/render-pipelines.html
3366         Also update test webgpu/webgpu-basics.html to create a WebGPURenderPipeline.
3367
3368         Begin implementation of WebGPURenderPipeline and WebGPUSwapChain. A WebGPURenderPipeline is backed by a
3369         GPURenderPipeline, created lazily using the properties of the passed-in WebGPURenderPipelineDescriptor.
3370         On Metal-supported systems, GPURenderPipeline is an interface to a MTLRenderPipelineState.
3371         The MTLRenderPipelineState is created with the WebGPUDevice currently configured on the WebGPURenderingContext.
3372
3373         * CMakeLists.txt:
3374         * Configurations/FeatureDefines.xcconfig:
3375         * DerivedSources.make:
3376         * Modules/webgpu/GPUDevice.cpp:
3377         (WebCore::GPUDevice::createRenderPipeline const):
3378         * Modules/webgpu/GPUDevice.h:
3379         * Modules/webgpu/GPUPipelineDescriptorBase.h:
3380         * Modules/webgpu/GPUPipelineStageDescriptor.h:
3381         * Modules/webgpu/GPURenderPipelineDescriptor.h:
3382         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):