f904d892b62e04809724a221545bae163168151e
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-11-07  Ali Juma  <ajuma@chromium.org>
2
3         IntersectionObserverEntry doesn't keep JS wrappers of rects alive
4         https://bugs.webkit.org/show_bug.cgi?id=191330
5
6         Reviewed by Chris Dumez.
7
8         Retain wrappers of each rect in an IntersectionObserverEntry as long as the entry's wrapper
9         is alive, by adding these wrappers as opaque roots.
10
11         Test: intersection-observer/intersection-observer-entry-keeps-js-wrappers-of-rects-alive.html
12
13         * bindings/js/JSIntersectionObserverEntryCustom.cpp:
14         (WebCore::JSIntersectionObserverEntry::visitAdditionalChildren):
15         * dom/DOMRectReadOnly.idl:
16         * page/IntersectionObserverEntry.h:
17         (WebCore::IntersectionObserverEntry::rootBounds const): Make this return a raw pointer instead of a RefPtr so that it
18         can be called in JSIntersectionObserverEntry::visitAdditionalChildren, which can be called from non-main threads.
19         (WebCore::IntersectionObserverEntry::boundingClientRect const): Ditto.
20         (WebCore::IntersectionObserverEntry::intersectionRect const): Ditto.
21
22 2018-11-07  Simon Fraser  <simon.fraser@apple.com>
23
24         TileController::tileSize() should not have side effects
25         https://bugs.webkit.org/show_bug.cgi?id=191349
26
27         Reviewed by Zalan Bujtas.
28
29         Calling TileController::tileSize() would recompute a new tile size and set m_tileSizeLocked,
30         which caused test failures if logging was enabled when running tests.
31
32         * platform/graphics/ca/TileController.cpp:
33         (WebCore::TileController::tileSize const):
34         (WebCore::TileController::computeTileSize):
35         * platform/graphics/ca/TileController.h:
36         * platform/graphics/ca/TileGrid.cpp:
37         (WebCore::TileGrid::revalidateTiles):
38
39 2018-11-07  Charlie Turner  <cturner@igalia.com>
40
41         [EME][GStreamer] Ensure key id buffers are present and simplify lifetime management of ClearKey class.
42         https://bugs.webkit.org/show_bug.cgi?id=191157
43
44         Reviewed by Xabier Rodriguez-Calvar.
45
46         This is in preparation for moving the clearkey decryptor behind a
47         new decrypt API in CDMInstance, which will be sent into the
48         pipeline to handle key management and decryption. This is for a
49         later patch.
50
51         Covered by existing clear key tests in media/encrypted-media.
52
53         * platform/graphics/gstreamer/GStreamerCommon.h:
54         (WebCore::GstMappedBuffer::data const): Add a const data accessor,
55         since we are now providing operator=='s on const objects of this
56         class that need const access to the data pointer.
57         (WebCore::GstMappedBuffer::operator==): Add a swap of the new
58         equality operator so you don't have to remember to have the
59         GstBuffer on the RHS of the equality all the time.
60         (WebCore::operator==): Define an equality operator between Gst
61         buffers and WebCore's mapped buffers. Gst creates a ref and a
62         separate read view under the covers in the memcmp call, so we do
63         not need to map the buffer ourselves.
64         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
65         (webkit_media_clear_key_decrypt_class_init): Remove setup/release
66         bindings.
67         (webkit_media_clear_key_decrypt_init): Initialize gcrypt cipher
68         here once instead of for every buffer to be decrypted.
69         (webKitMediaClearKeyDecryptorFinalize): And destroy the cipher
70         context when the decryptor is destroyed.
71         (webKitMediaClearKeyDecryptorFindAndSetKey): Factor out the key
72         retrieval and context setting in this method, call it for each
73         sample.
74         (webKitMediaClearKeyDecryptorDecrypt): Base key id buffer into
75         this function, and remove cipher creation / destroy methods.
76         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
77         (webkit_media_common_encryption_decrypt_class_init): Remove
78         setup/release bindings.
79         (webkitMediaCommonEncryptionDecryptTransformInPlace): Ensure a key
80         id is present and pass it to the decrypt class method.
81         (webKitMediaCommonEncryptionDecryptDefaultSetupCipher): Deleted.
82         (webKitMediaCommonEncryptionDecryptDefaultReleaseCipher): Deleted.
83         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
84
85 2018-11-07  Frederic Wang  <fwang@igalia.com>
86
87         [Cairo] Move state change operations from GraphicsContextCairo to CairoOperations
88         https://bugs.webkit.org/show_bug.cgi?id=179610
89
90         Unreviewed build fix.
91
92         * platform/graphics/cairo/GraphicsContextCairo.cpp: Add missing include.
93
94 2018-11-06  Joseph Pecoraro  <pecoraro@apple.com>
95
96         ServiceWorker Inspector: Uncaught Exception: null is not an object (evaluating 'resource.target.addResource')
97         https://bugs.webkit.org/show_bug.cgi?id=191339
98
99         Reviewed by Matt Baker.
100
101         * workers/service/ServiceWorkerJob.cpp:
102         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
103         Use the Service Worker's identifier, not this static but otherwise unknown identifier.
104
105 2018-11-06  Youenn Fablet  <youenn@apple.com>
106
107         sender.replaceTrack() fails with InvalidStateError if the transceiver.direction is "inactive"
108         https://bugs.webkit.org/show_bug.cgi?id=191202
109
110         Reviewed by Eric Carlson.
111
112         Covered by updated test.
113
114         * Modules/mediastream/RTCPeerConnection.cpp:
115         (WebCore::RTCPeerConnection::removeTrack):
116         Update as per spec, in particular make sure to not stop the sender when removing the track.
117
118 2018-11-06  Justin Fan  <justin_fan@apple.com>
119
120         [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain
121         https://bugs.webkit.org/show_bug.cgi?id=191291
122
123         Reviewed by Myles Maxfield.
124
125         Test: webgpu/render-pipelines.html
126         Also update test webgpu/webgpu-basics.html to create a WebGPURenderPipeline.
127
128         Begin implementation of WebGPURenderPipeline and WebGPUSwapChain. A WebGPURenderPipeline is backed by a
129         GPURenderPipeline, created lazily using the properties of the passed-in WebGPURenderPipelineDescriptor.
130         On Metal-supported systems, GPURenderPipeline is an interface to a MTLRenderPipelineState.
131         The MTLRenderPipelineState is created with the WebGPUDevice currently configured on the WebGPURenderingContext.
132
133         * CMakeLists.txt:
134         * Configurations/FeatureDefines.xcconfig:
135         * DerivedSources.make:
136         * Modules/webgpu/GPUDevice.cpp:
137         (WebCore::GPUDevice::createRenderPipeline const):
138         * Modules/webgpu/GPUDevice.h:
139         * Modules/webgpu/GPUPipelineDescriptorBase.h:
140         * Modules/webgpu/GPUPipelineStageDescriptor.h:
141         * Modules/webgpu/GPURenderPipelineDescriptor.h:
142         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
143         (WebCore::GPURenderPipelineDescriptor::primitiveTopology):
144         * Modules/webgpu/WebGPUDevice.cpp:
145         (WebCore::WebGPUDevice::createRenderPipeline const):
146         * Modules/webgpu/WebGPUDevice.h:
147         (WebCore::WebGPUDevice::adapter const):
148         (WebCore::WebGPUDevice::device const):
149         * Modules/webgpu/WebGPUDevice.idl:
150         * Modules/webgpu/WebGPUPipelineDescriptorBase.h:
151         * Modules/webgpu/WebGPUPipelineDescriptorBase.idl:
152         * Modules/webgpu/WebGPUPipelineStageDescriptor.h:
153         * Modules/webgpu/WebGPUPipelineStageDescriptor.idl:
154         * Modules/webgpu/WebGPURenderPipeline.cpp:
155         (WebCore::WebGPURenderPipeline::create):
156         (WebCore::WebGPURenderPipeline::WebGPURenderPipeline):
157         * Modules/webgpu/WebGPURenderPipeline.h:
158         * Modules/webgpu/WebGPURenderPipeline.idl:
159         * Modules/webgpu/WebGPURenderPipelineDescriptor.h:
160         * Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
161         * Modules/webgpu/WebGPURenderingContext.cpp:
162         (WebCore::WebGPURenderingContext::create):
163         (WebCore::WebGPURenderingContext::WebGPURenderingContext):
164         * Modules/webgpu/WebGPURenderingContext.h:
165         * Modules/webgpu/WebGPUShaderModule.h:
166         (WebCore::WebGPUShaderModule::module const):
167         * Modules/webgpu/WebGPUShaderStage.h:
168         * Modules/webgpu/WebGPUShaderStage.idl:
169         * Modules/webgpu/WebGPUSwapChain.cpp:
170         (WebCore::WebGPUSwapChain::configure):
171         (WebCore::WebGPUSwapChain::reshape):
172         (WebCore::WebGPUSwapChain::markLayerComposited):
173         * Modules/webgpu/WebGPUSwapChain.h:
174         (WebCore::WebGPUSwapChain::WebGPUSwapChain):
175         * Modules/webgpu/WebGPUSwapChain.idl:
176         * Modules/webgpu/cocoa/GPURenderPipeline.h:
177         (WebCore::GPURenderPipeline::platformRenderPipeline const):
178         * Modules/webgpu/cocoa/GPURenderPipelineMetal.mm: Added.
179         (WebCore::setFunctionsForPipelineDescriptor):
180         (WebCore::GPURenderPipeline::create):
181         (WebCore::GPURenderPipeline::GPURenderPipeline):
182         * Modules/webgpu/cocoa/GPUSwapChain.h:
183         (WebCore::GPUSwapChain::platformLayer const):
184         * Modules/webgpu/cocoa/GPUSwapChainMetal.mm:
185         (WebCore::GPUSwapChain::create):
186         (WebCore::GPUSwapChain::GPUSwapChain):
187         (WebCore::GPUSwapChain::setDevice):
188         (WebCore::GPUSwapChain::reshape):
189         (WebCore::GPUSwapChain::present):
190         * Sources.txt:
191         * SourcesCocoa.txt:
192         * WebCore.xcodeproj/project.pbxproj:
193         * bindings/js/WebCoreBuiltinNames.h:
194
195 2018-11-06  Youenn Fablet  <youenn@apple.com>
196
197         Add support for sender/receiver getCapabilities
198         https://bugs.webkit.org/show_bug.cgi?id=191192
199
200         Reviewed by Eric Carlson.
201
202         Expose sender/receiver RTCRtpCapabilities to JS.
203         Add corresponding IDL and plumbing down to libwebrtc peer connection factory.
204         Covered by rebased tests.
205
206         * CMakeLists.txt:
207         * DerivedSources.make:
208         * Modules/mediastream/PeerConnectionBackend.cpp:
209         (WebCore::PeerConnectionBackend::receiverCapabilities):
210         (WebCore::PeerConnectionBackend::senderCapabilities):
211         * Modules/mediastream/PeerConnectionBackend.h:
212         * Modules/mediastream/RTCRtpCapabilities.idl: Added.
213         * Modules/mediastream/RTCRtpReceiver.cpp:
214         (WebCore::RTCRtpReceiver::getCapabilities):
215         * Modules/mediastream/RTCRtpReceiver.h:
216         * Modules/mediastream/RTCRtpReceiver.idl:
217         * Modules/mediastream/RTCRtpSender.cpp:
218         (WebCore::RTCRtpSender::getCapabilities):
219         * Modules/mediastream/RTCRtpSender.h:
220         * Modules/mediastream/RTCRtpSender.idl:
221         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
222         (WebCore::PeerConnectionBackend::receiverCapabilities):
223         (WebCore::PeerConnectionBackend::senderCapabilities):
224         * Sources.txt:
225         * WebCore.xcodeproj/project.pbxproj:
226         * platform/mediastream/RTCPMuxPolicy.h:
227         * platform/mediastream/RTCRtpCapabilities.h: Added.
228         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
229         (WebCore::typeFromKind):
230         (WebCore::fromStdString):
231         (WebCore::toChannels):
232         (WebCore::toRTCRtpCapabilities):
233         (WebCore::LibWebRTCProvider::receiverCapabilities):
234         (WebCore::LibWebRTCProvider::senderCapabilities):
235         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
236
237 2018-11-06  Youenn Fablet  <youenn@apple.com>
238
239         Calling sender.replaceTrack() twice produces a new transceiver and its corresponding m= section
240         https://bugs.webkit.org/show_bug.cgi?id=191261
241
242         Reviewed by Eric Carlson.
243
244         Handle the case of replacing a track in a sender that has no track.
245         In particular, do not create a new m-section as was implied by plan B implementation.
246         Instead, set the track directly on the rtc sender.
247         Covered by webrtc/video-addTransceiver.html.
248
249         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
250         (WebCore::LibWebRTCMediaEndpoint::createSourceAndRTCTrack):
251         (WebCore::LibWebRTCMediaEndpoint::addTransceiver):
252         (WebCore::LibWebRTCMediaEndpoint::setSenderSourceFromTrack):
253         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
254         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
255         (WebCore::LibWebRTCPeerConnectionBackend::setSenderSourceFromTrack):
256         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
257         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
258         (WebCore::LibWebRTCRtpSenderBackend::replaceTrack):
259
260 2018-11-06  Chris Dumez  <cdumez@apple.com>
261
262         Post too much text to iFrame could crash webkit
263         https://bugs.webkit.org/show_bug.cgi?id=190947
264         <rdar://problem/45678231>
265
266         Reviewed by Geoffrey Garen.
267
268         Optimize SuffixTree (Which is used by XSSAuditor) to stop storing each Node's
269         children as a static array of 128 pointers and use a dynamic array (vector)
270         instead. This uses way less memory. Also make SuffixTree and SuffixTree::Node
271         as fast allocated for performance. This part of the change is based on the
272         following Blink change:
273         - https://chromium.googlesource.com/chromium/src.git/+/6ca590e1c7edaa7c56cac9e3e3c39cf398ca8d4d
274
275         Also update the XSSAuditor to construct the SuffixTree lazily since there are
276         many cases (including the one in this bug) where we were spending a significant
277         amount of time building the SuffixTree and then never querying it.
278
279         * html/parser/XSSAuditor.cpp:
280         (WebCore::XSSAuditor::init):
281         (WebCore::XSSAuditor::decodedHTTPBodySuffixTree):
282         (WebCore::XSSAuditor::isContainedInRequest):
283         * html/parser/XSSAuditor.h:
284         * platform/text/SuffixTree.h:
285         (WebCore::SuffixTree::mightContain):
286         (WebCore::SuffixTree::Node::Node):
287         (WebCore::SuffixTree::Node::~Node):
288         (WebCore::SuffixTree::Node::find):
289         (WebCore::SuffixTree::Node::end):
290         (WebCore::SuffixTree::build):
291         (WebCore::SuffixTree<Codebook>::Node::childAt):
292         (WebCore::SuffixTree::Node::at): Deleted.
293
294 2018-11-06  Youenn Fablet  <youenn@apple.com>
295
296         Support onremovetrack for RTCPeerConnection removed tracks
297         https://bugs.webkit.org/show_bug.cgi?id=191299
298
299         Reviewed by Eric Carlson.
300
301         When applying SDP, LibWebRTCMediaEndpoint gets notified of a removed track.
302         In that case, make sure to remove it from its remote stream(s) so as
303         to notify the application of the changes.
304         Work around the receiver missing the list of streams by storing in a map
305         the list of the remote streams for a given remote track.
306
307         Covered by rebased test.
308
309         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
310         (WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
311         (WebCore::LibWebRTCMediaEndpoint::removeRemoteTrack):
312         (WebCore::LibWebRTCMediaEndpoint::removeRemoteStream):
313         (WebCore::LibWebRTCMediaEndpoint::stop):
314         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
315
316 2018-11-06  Timothy Hatcher  <timothy@apple.com>
317
318         REGRESSION (r237878): css-dark-mode/supported-color-schemes.html is failing on Mojave
319         https://bugs.webkit.org/show_bug.cgi?id=191338
320
321         Reviewed by Dean Jackson.
322
323         * page/Page.cpp:
324         (WebCore::Page::appearanceDidChange): Add back call to didChangeStyleSheetEnvironment().
325         It was dropped by mistake when I moved code to appearanceDidChange(). This is needed to
326         update styles for semantic colors and from controls when the media prefers-color-scheme
327         media query is not used on the page.
328
329 2018-11-06  Youenn Fablet  <youenn@apple.com>
330
331         Make mDNS ICE Candidate an experimental flag again
332         https://bugs.webkit.org/show_bug.cgi?id=191262
333
334         Reviewed by Dean Jackson.
335
336         Rename mdnsICECandidatesEnabled to webRTCICECandidatesEnabled.
337         This allows grouping the WebRTC runtime flags.
338         No change of behavior.
339
340         * Modules/mediastream/PeerConnectionBackend.cpp:
341         (WebCore::PeerConnectionBackend::newICECandidate):
342         * page/RuntimeEnabledFeatures.h:
343         (WebCore::RuntimeEnabledFeatures::webRTCMDNSICECandidatesEnabled const):
344         (WebCore::RuntimeEnabledFeatures::setWebRTCMDNSICECandidatesEnabled):
345         (WebCore::RuntimeEnabledFeatures::mdnsICECandidatesEnabled const): Deleted.
346         (WebCore::RuntimeEnabledFeatures::setMDNSICECandidatesEnabled): Deleted.
347
348 2018-11-06  Myles C. Maxfield  <mmaxfield@apple.com>
349
350         Implement text-underline-offset and text-decoration-thickness
351         https://bugs.webkit.org/show_bug.cgi?id=190774
352
353         Reviewed by Dean Jackson.
354
355         Because of our existing infrastructure for text decorations, adding support for these
356         is fairly simple. This patch updates our existing functions to handle thick & placed
357         underlines, as well as updating our repaint code to correcly handle repainting them.
358         It also handles animations.
359
360         Tests: animations/text-decoration-thickness.html
361                animations/text-underline-offset.html
362                fast/css3-text/css3-text-decoration/text-decoration-offset-2.html
363                fast/css3-text/css3-text-decoration/text-decoration-offset-3.html
364                fast/css3-text/css3-text-decoration/text-decoration-offset-auto-length.html
365                fast/css3-text/css3-text-decoration/text-decoration-offset-baseline.html
366                fast/css3-text/css3-text-decoration/text-decoration-offset-from-font-auto.html
367                fast/css3-text/css3-text-decoration/text-decoration-offset-from-font-length.html
368                fast/css3-text/css3-text-decoration/text-decoration-offset-repaint.html
369                fast/css3-text/css3-text-decoration/text-decoration-offset-under-auto.html
370                fast/css3-text/css3-text-decoration/text-decoration-offset-under-length.html
371                fast/css3-text/css3-text-decoration/text-decoration-offset.html
372                fast/css3-text/css3-text-decoration/text-decoration-thickness-length.html
373                fast/css3-text/css3-text-decoration/text-decoration-thickness-repaint.html
374
375         * page/animation/CSSPropertyAnimation.cpp:
376         (WebCore::blendFunc):
377         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
378         * platform/graphics/FontMetrics.h:
379         (WebCore::FontMetrics::underlinePosition const):
380         (WebCore::FontMetrics::setUnderlinePosition):
381         (WebCore::FontMetrics::underlineThickness const):
382         (WebCore::FontMetrics::setUnderlineThickness):
383         * platform/graphics/cocoa/FontCocoa.mm:
384         (WebCore::Font::platformInit):
385         * rendering/InlineFlowBox.cpp:
386         (WebCore::InlineFlowBox::addToLine):
387         * rendering/SimpleLineLayout.cpp:
388         (WebCore::SimpleLineLayout::canUseForStyle):
389         * rendering/TextDecorationPainter.cpp:
390         (WebCore::TextDecorationPainter::paintTextDecoration):
391         * rendering/style/RenderStyle.cpp:
392         (WebCore::RenderStyle::changeAffectsVisualOverflow const):
393         * rendering/style/TextDecorationThickness.h:
394         (WebCore::TextDecorationThickness::resolve const):
395         * style/InlineTextBoxStyle.cpp:
396         (WebCore::computeUnderlineOffset):
397         (WebCore::visualOverflowForDecorations):
398         * style/InlineTextBoxStyle.h:
399         (WebCore::textDecorationStrokeThickness): Deleted.
400
401 2018-11-06  John Wilander  <wilander@apple.com>
402
403         Resource Load Statistics: Remove cap on partitioned cache max age if it matches a network reload (redirect-only)
404         https://bugs.webkit.org/show_bug.cgi?id=189760
405         <rdar://problem/44612242>
406
407         Reviewed by Youenn Fablet and Antti Koivisto.
408
409         No new tests. Existing test fleshed out.
410
411         * platform/network/ResourceResponseBase.cpp:
412         (WebCore::ResourceResponseBase::isRedirection const):
413         * platform/network/ResourceResponseBase.h:
414         (WebCore::ResourceResponseBase::isRedirection const): Deleted.
415             Moved to the implementation file so that I can export it without warning.
416
417 2018-11-06  Myles C. Maxfield  <mmaxfield@apple.com>
418
419         Spelling dots are drawn in the wrong place
420         https://bugs.webkit.org/show_bug.cgi?id=190764
421
422         Reviewed by Dean Jackson.
423
424         - Dots should not be clipped.
425         - Dots should be horizontally centered.
426         - Dots should be drawn behind the text.
427         - Distance from the baseline to the top of the dot should be 11.035% of font size.
428         - Dot diameter should be 13.247% of the font size.
429         - Distance between the dots (right side of the left dot to left side of the right dot) should be 9.457% of the font size.
430         - The "font size" used in these calculations should be clamped so it's 10px <= font size <= 40px.
431
432         Tests: editing/spelling/spelling-dots-position-2.html
433                editing/spelling/spelling-dots-position-3.html
434                editing/spelling/spelling-dots-position.html
435                editing/spelling/spelling-dots-repaint.html
436
437         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
438         (WebCore::colorForMarkerLineStyle): Align iOS and macOS implementations.
439         (WebCore::GraphicsContext::drawDotsForDocumentMarker): Place the dots correctly.
440         * rendering/InlineFlowBox.cpp:
441         (WebCore::InlineFlowBox::addToLine): The KnownToHaveNoOverflow flag should be cleared if the element has spelling dots,
442             because there is no guarantee the spelling dots will lie inside the layout rect of the element.
443         (WebCore::InlineFlowBox::addTextBoxVisualOverflow): Update the repaint rects to include splling dot positions.
444         * rendering/InlineFlowBox.h: Comments should explain why, not say what.
445         * rendering/InlineTextBox.cpp:
446         (WebCore::InlineTextBox::paint): Draw the dots behind the text.
447         (WebCore::InlineTextBox::hasMarkers const): Convenience.
448         (WebCore::InlineTextBox::paintPlatformDocumentMarkers): Refactor bounds information into a helper function.
449         (WebCore::InlineTextBox::calculateUnionOfAllDocumentMarkerBounds const): Use for repaint rect calculation.
450         (WebCore::InlineTextBox::calculateDocumentMarkerBounds const): Place the dots correctly.
451         (WebCore::InlineTextBox::paintPlatformDocumentMarker): Call the helper method.
452         (WebCore::InlineTextBox::collectMarkedTextsForDocumentMarkers const):
453         (WebCore::InlineTextBox::collectMarkedTextsForDocumentMarkers): Deleted.
454         * rendering/InlineTextBox.h: Declare the helper methods.
455         * rendering/SimpleLineLayout.cpp: Simple line layout doesn't know how to paint spelling dots, so make the presence of
456             spelling dots opt us out of SLL.
457         (WebCore::SimpleLineLayout::canUseForWithReason):
458         * rendering/SimpleLineLayoutCoverage.cpp:
459         (WebCore::SimpleLineLayout::printReason):
460         * rendering/SimpleLineLayoutCoverage.h: Add a new opt-out reason.
461
462 2018-11-06  Per Arne Vollan  <pvollan@apple.com>
463
464         REGRESSION (r230523): Caps lock indicator not shown in password field
465         https://bugs.webkit.org/show_bug.cgi?id=190056
466
467         Reviewed by Ryosuke Niwa.
468
469         When WindowServer access is blocked, GetCurrentModifiers() always returns 0. Instead of calling
470         GetCurrentModifiers(), store the current modifiers from the key event argument in the method
471         WebKit::WebPage::keyEvent, and use the stored value to detect if Caps lock is on. Additionally,
472         the modifiers needs to be updated when the window becomes active.
473
474         Test: fast/events/detect-caps-lock.html
475
476         * Sources.txt:
477         * platform/PlatformKeyboardEvent.h:
478         * platform/graphics/FontTaggedSettings.cpp:
479         * platform/mac/KeyEventMac.mm:
480         (WebCore::PlatformKeyboardEvent::currentCapsLockState):
481         (WebCore::PlatformKeyboardEvent::getCurrentModifierState):
482         * testing/Internals.cpp:
483         (WebCore::Internals::capsLockIsOn):
484         * testing/Internals.h:
485         * testing/Internals.idl:
486
487 2018-11-06  Javier Fernandez  <jfernandez@igalia.com>
488
489         CSS grid elements with justify-content: space-around have extra whitespace, sometimes a lot
490         https://bugs.webkit.org/show_bug.cgi?id=191308
491
492         Reviewed by Dean Jackson.
493
494         The CSS WG resolved [1] that Content Alignment should account to the
495         track sizing algorithm.
496
497         The sizing algorithm has been modified so that two new steps (1.5
498         and 2.5) were added to compute the Content Alignment offsets after
499         resolving the columns' and rows' sizes respectively.
500
501         This change decouples the Content Alignment logic from the tracks
502         position, so that we can use it as part of the track sizing algorithm.
503
504         I also had to store the whole ContentAlignmentData structure in two
505         class attributes. We need both, position and distribution offsets, to
506         be used in different parts of the layout logic.
507
508         [1] https://github.com/w3c/csswg-drafts/issues/2557
509
510         Tests: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-content-distribution-must-account-for-track-sizing-001.html
511                imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-content-distribution-must-account-for-track-sizing-002.html
512                imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-content-distribution-must-account-for-track-sizing-003.html
513                imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-content-distribution-must-account-for-track-sizing-004.html
514                imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-percent-cols-filled-shrinkwrap-001.html
515                imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-percent-cols-spanned-shrinkwrap-001.html
516                imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-percent-rows-filled-shrinkwrap-001.html
517                imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-percent-rows-spanned-shrinkwrap-001.html
518
519         * rendering/GridTrackSizingAlgorithm.cpp:
520         (WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild const):
521         * rendering/RenderGrid.cpp:
522         (WebCore::RenderGrid::repeatTracksSizingIfNeeded):
523         (WebCore::RenderGrid::layoutBlock):
524         (WebCore::RenderGrid::gridItemOffset const):
525         (WebCore::RenderGrid::trackSizesForComputedStyle const):
526         (WebCore::RenderGrid::populateGridPositionsForDirection):
527         (WebCore::RenderGrid::gridAreaBreadthForOutOfFlowChild):
528         (WebCore::contentDistributionOffset):
529         (WebCore::RenderGrid::computeContentPositionAndDistributionOffset):
530         (WebCore::RenderGrid::nonCollapsedTracks const):
531         * rendering/RenderGrid.h:
532         (WebCore::ContentAlignmentData::isValid):
533         (WebCore::ContentAlignmentData::defaultOffsets):
534
535 2018-11-06  Sihui Liu  <sihui_liu@apple.com>
536
537         IndexedDB: WAL file keeps growing
538         https://bugs.webkit.org/show_bug.cgi?id=191294
539         <rdar://problem/41333493>
540
541         Reviewed by Chris Dumez.
542
543         When we quit apps, the database connection may not be shut down properly, and WAL file will be retained on disk.
544         On the next open of database connection, new logs will be appended to the original WAL file, which keeps 
545         increasing size of the WAL file. We should do a manual checkpoint when we open a IndexedDB to make sure previous
546         log is written to database and truncate WAL file.
547
548         Test: IndexedDB.IndexedDBTempFileSize
549
550         * platform/sql/SQLiteDatabase.cpp:
551         (WebCore::SQLiteDatabase::open):
552
553 2018-11-06  Ali Juma  <ajuma@chromium.org>
554
555         IntersectionObserver doesn't keep target's JS wrapper alive
556         https://bugs.webkit.org/show_bug.cgi?id=190235
557
558         Reviewed by Ryosuke Niwa.
559
560         Retain JS wrappers of targets in queued entries using a vector of GCReachableRef owned by
561         IntersectionObserver, which gets cleared after the entries have been delivered.
562
563         Make IntersectionObserver::takeRecords return a struct which has both the vector of GCReachableRefs
564         for targets and the vector of intersection observer entries, so that the GCReachableRefs survive
565         until the creation of JS wrappers for the entries.
566
567         Modify IntersectionObserver::hasPendingActivity to keep the observer alive while it has
568         entries to deliver.
569
570         Tests: intersection-observer/intersection-observer-entry-keeps-js-wrapper-of-target-alive.html
571                intersection-observer/intersection-observer-keeps-js-wrapper-of-target-alive.html
572                intersection-observer/target-deleted.html
573
574         * Sources.txt:
575         * WebCore.xcodeproj/project.pbxproj:
576         * bindings/js/JSIntersectionObserverEntryCustom.cpp:
577         (WebCore::JSIntersectionObserverEntry::visitAdditionalChildren): Keep the target element's wrapper alive while the
578         IntersectionObserverEntry's wrapper is alive.
579         * page/IntersectionObserver.cpp:
580         (WebCore::IntersectionObserver::takeRecords): Change return type to include GCReachableRefs for each record's target, so that
581         each target can be kept until a JS wrapper is constructed for its IntersectionObserverEntry.
582         (WebCore::IntersectionObserver::appendQueuedEntry):
583         (WebCore::IntersectionObserver::notify): Erase GCReachableRefs for targets after delivering the corresponding records.
584         (WebCore::IntersectionObserver::hasPendingActivity const): Keep the IntersectionObserver alive until queued entries are delivered.
585         (WebCore::IntersectionObserver::stop):
586         * page/IntersectionObserver.h:
587         * page/IntersectionObserver.idl:
588         * page/IntersectionObserverEntry.h:
589         (WebCore::IntersectionObserverEntry::target const): Make this return a raw pointer instead of a RefPtr so that it
590         can be called in JSIntersectionObserverEntry::visitAdditionalChildren, which runs on the GC thread (it's illegal to ref a Node
591         on a non-main thread).
592         * page/IntersectionObserverEntry.idl:
593
594 2018-11-06  Timothy Hatcher  <timothy@apple.com>
595
596         <picture> container doesn't update when prefers-color-scheme media query changes
597         https://bugs.webkit.org/show_bug.cgi?id=190913
598         rdar://problem/45608456
599
600         Reviewed by Dean Jackson.
601
602         Test: css-dark-mode/prefers-color-scheme-picture-element.html
603
604         * css/MediaQueryEvaluator.cpp:
605         (WebCore::isAppearanceDependent): Added.
606         (WebCore::MediaQueryEvaluator::evaluate const): Keep track of appearanceDependentResults.
607         * css/MediaQueryEvaluator.h:
608         * css/StyleResolver.cpp:
609         (WebCore::StyleResolver::addAppearanceDependentMediaQueryResult): Added.
610         (WebCore::StyleResolver::hasMediaQueriesAffectedByAppearanceChange const): Added.
611         * css/StyleResolver.h:
612         (WebCore::StyleResolver::hasAppearanceDependentMediaQueries const): Added.
613         * dom/Document.cpp:
614         (WebCore::Document::evaluateMediaQueryList): Call checkAppearanceDependentPictures.
615         (WebCore::Document::checkAppearanceDependentPictures): Added.
616         (WebCore::Document::addAppearanceDependentPicture): Added.
617         (WebCore::Document::removeAppearanceDependentPicture): Added.
618         * dom/Document.h:
619         * html/HTMLImageElement.cpp:
620         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement): Call addAppearanceDependentPicture.
621         * html/HTMLPictureElement.cpp:
622         (WebCore::HTMLPictureElement::~HTMLPictureElement): Call removeAppearanceDependentPicture.
623         (WebCore::HTMLPictureElement::didMoveToNewDocument): Ditto.
624         (WebCore::HTMLPictureElement::appearanceChangeAffectedPicture const): Added.
625         * html/HTMLPictureElement.h:
626         * page/Page.cpp:
627         (WebCore::Page::appearanceDidChange): Added.
628         (WebCore::Page::setUseSystemAppearance): Call appearanceDidChange.
629         (WebCore::Page::setUseDarkAppearance): Call appearanceDidChange.
630         * page/Page.h:
631         * style/StyleScope.cpp:
632         (WebCore::Style::Scope::evaluateMediaQueriesForAppearanceChange): Added.
633         * style/StyleScope.h:
634
635 2018-11-06  Ryan Haddad  <ryanhaddad@apple.com>
636
637         Unreviewed, rolling out r237834.
638
639         Tests for this change crash on iOS Simulator
640
641         Reverted changeset:
642
643         "Spelling dots are drawn in the wrong place"
644         https://bugs.webkit.org/show_bug.cgi?id=190764
645         https://trac.webkit.org/changeset/237834
646
647 2018-11-06  Antoine Quint  <graouts@apple.com>
648
649         [Web Animations] transitions/remove-transition-style.html crashes with GuardMalloc on
650         https://bugs.webkit.org/show_bug.cgi?id=191304
651         <rdar://problem/45819476>
652
653         Reviewed by Dean Jackson.
654
655         Ensure we remove animations from the m_allAnimations ListHashSet upon destruction.
656
657         * animation/AnimationTimeline.cpp:
658         (WebCore::AnimationTimeline::forgetAnimation):
659         (WebCore::AnimationTimeline::cancelDeclarativeAnimation):
660         * animation/AnimationTimeline.h:
661         * animation/DocumentTimeline.cpp:
662         (WebCore::DocumentTimeline::getAnimations const):
663         * animation/WebAnimation.cpp:
664         (WebCore::WebAnimation::~WebAnimation):
665
666 2018-11-06  Youenn Fablet  <youenn@apple.com>
667
668         RealtimeOutgoingAudioSourceCocoa should unobserve its source at destruction time
669         https://bugs.webkit.org/show_bug.cgi?id=191295
670
671         Reviewed by Eric Carlson.
672
673         Make RealtimeOutgoingAudioSource subclasses unobserve their source
674         inside their destructor instead of RealtimeOutgoingAudioSource.
675         This is consistent with how starting to observe works.
676         Covered by existing tests.
677
678         * platform/mediastream/RealtimeOutgoingAudioSource.cpp:
679         (WebCore::RealtimeOutgoingAudioSource::unobserveSource):
680         * platform/mediastream/RealtimeOutgoingAudioSource.h:
681         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
682         (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::~RealtimeOutgoingAudioSourceLibWebRTC):
683         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp:
684         (WebCore::RealtimeOutgoingAudioSourceCocoa::RealtimeOutgoingAudioSourceCocoa):
685         (WebCore::RealtimeOutgoingAudioSourceCocoa::~RealtimeOutgoingAudioSourceCocoa):
686         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h:
687
688 2018-11-06  Youenn Fablet  <youenn@apple.com>
689
690         Make sure RTCIceCandidateStats address is undefined for host and peer reflexive case
691         https://bugs.webkit.org/show_bug.cgi?id=191263
692
693         Reviewed by Eric Carlson.
694
695         Test: webrtc/datachannel/getStats-no-prflx-remote-candidate.html
696
697         * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp:
698         (WebCore::fillRTCIceCandidateStats):
699
700 2018-11-06  Thibault Saunier  <tsaunier@igalia.com>
701
702         [GStreamer][WebRTC] Handle setting max number of frame between keyframes
703         https://bugs.webkit.org/show_bug.cgi?id=190682
704
705         Reviewed by Philippe Normand.
706
707         That has been manually checked.
708
709         * platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:
710         (gst_webrtc_video_encoder_get_property):
711         (gst_webrtc_video_encoder_set_property):
712         (register_known_encoder):
713         (gst_webrtc_video_encoder_class_init):
714         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
715         (WebCore::GStreamerVideoEncoder::InitEncode):
716
717 2018-11-03  Alex Christensen  <achristensen@webkit.org>
718
719         [Mac] Implement safe browsing in WebKit
720         https://bugs.webkit.org/show_bug.cgi?id=188871
721
722         Reviewed by Tim Horton.
723
724         * en.lproj/Localizable.strings:
725
726 2018-11-06  Ali Juma  <ajuma@chromium.org>
727
728         [IntersectionObserver] Account for CSS zoom when computing client rects
729         https://bugs.webkit.org/show_bug.cgi?id=191282
730
731         Reviewed by Simon Fraser.
732
733         When computing rects for an IntersectionObserverEntry, account for the effective zoom when
734         converting from absolute to client coordinates.
735
736         Test: web-platform-tests/intersection-observer/bounding-box.html
737
738         * dom/Document.cpp:
739         (WebCore::Document::updateIntersectionObservations):
740
741 2018-11-06  Thibault Saunier  <tsaunier@igalia.com>
742
743         [GStreamer][WebRTC] Implement black frame generation
744         https://bugs.webkit.org/show_bug.cgi?id=190684
745
746         Reviewed by Xabier Rodriguez-Calvar.
747
748         Avoiding webrtc/video-mute-vp8.html to crash but it still fails because
749         we are missing the canvas bridging code.
750
751         * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp:
752         (WebCore::RealtimeOutgoingVideoSourceLibWebRTC::createBlackFrame):
753         * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.h:
754
755 2018-11-06  Thibault Saunier  <tsaunier@igalia.com>
756
757         [GStreamer][WebRTC] Do not try to handle framerate modulation in the encoder
758         https://bugs.webkit.org/show_bug.cgi?id=190683
759
760         Reviewed by Philippe Normand.
761
762         This has to already be handled in capturing pipeline or in libwebrtc itself.
763
764         No other encoder implementation do that, and libwebrtc is not happy with encoder that do not output the exact number of frames that have been passed in.
765
766         No regressions detected and libwebrtc is happier this way, less warning output and no more frame corruption in H264 streams found.
767
768         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
769         (WebCore::GStreamerVideoEncoder::InitEncode):
770
771 2018-11-06  Frederic Wang  <fwang@igalia.com>
772
773         Unreviewed, follow-up of previous commit.
774
775         Actually move OptionSet in the header since it's used there too.
776
777         * page/WindowFeatures.cpp:
778         * page/WindowFeatures.h:
779
780 2018-11-06  Frederic Wang  <fwang@igalia.com>
781
782         Unreviewed build fix.
783
784         * page/WindowFeatures.cpp: Add missing header for OptionSet.
785         * platform/graphics/FontTaggedSettings.cpp: Add missing header for IntegerHash.
786
787 2018-11-06  Antoine Quint  <graouts@apple.com>
788
789         [Web Animations] Don't reset pending tasks when setting a null effect
790         https://bugs.webkit.org/show_bug.cgi?id=191301
791         <rdar://problem/45838422>
792
793         Reviewed by Dean Jackson.
794
795         The issue https://github.com/w3c/csswg-drafts/issues/2077 has changed the Web Animations API such that
796         we no longer reset pending tasks when setting a null effect on an animation.
797
798         * animation/WebAnimation.cpp:
799         (WebCore::WebAnimation::setEffect):
800
801 2018-11-06  Antoine Quint  <graouts@apple.com>
802
803         [Web Animations] Update the API to allow the "auto" composite value
804         https://bugs.webkit.org/show_bug.cgi?id=191300
805         <rdar://problem/45838373>
806
807         Reviewed by Dean Jackson.
808
809         The Web Animations API has been changed such that the various "composite" properties are no longer optional and instead
810         allow an "auto" value in their enumeration.
811
812         * CMakeLists.txt:
813         * DerivedSources.make:
814         * Sources.txt:
815         * WebCore.xcodeproj/project.pbxproj:
816         * animation/CompositeOperationOrAuto.h: Copied from Source/WebCore/animation/KeyframeEffect.idl.
817         * animation/CompositeOperationOrAuto.idl: Copied from Source/WebCore/animation/KeyframeEffect.idl.
818         * animation/KeyframeEffect.cpp:
819         (WebCore::processKeyframeLikeObject):
820         (WebCore::processIterableKeyframes):
821         (WebCore::processPropertyIndexedKeyframes):
822         (WebCore::KeyframeEffect::getKeyframes):
823         * animation/KeyframeEffect.h:
824         * animation/KeyframeEffect.idl:
825
826 2018-11-06  Antoine Quint  <graouts@apple.com>
827
828         [Web Animations] Update the API to implement Animation.updatePlaybackRate()
829         https://bugs.webkit.org/show_bug.cgi?id=186510
830         <rdar://problem/41000641>
831
832         Reviewed by Dean Jackson.
833
834         The Web Animations API has been changed to allow for changes to an animation's playback rate both synchronously,
835         with the existing "playbackRate" property, and asynchronously, with the new updatePlaybackRate() method. In this
836         patch we update the various procedures to account for pending playback rate changes and the notion of an "effective
837         playback rate".
838
839         * animation/WebAnimation.cpp:
840         (WebCore::WebAnimation::setEffect):
841         (WebCore::WebAnimation::setTimeline):
842         (WebCore::WebAnimation::setStartTime):
843         (WebCore::WebAnimation::setCurrentTime):
844         (WebCore::WebAnimation::effectivePlaybackRate const):
845         (WebCore::WebAnimation::setPlaybackRate):
846         (WebCore::WebAnimation::updatePlaybackRate):
847         (WebCore::WebAnimation::applyPendingPlaybackRate):
848         (WebCore::WebAnimation::playState const):
849         (WebCore::WebAnimation::resetPendingTasks):
850         (WebCore::WebAnimation::finish):
851         (WebCore::WebAnimation::play):
852         (WebCore::WebAnimation::runPendingPlayTask):
853         (WebCore::WebAnimation::reverse):
854         (WebCore::WebAnimation::runPendingPauseTask):
855         * animation/WebAnimation.h:
856         (WebCore::WebAnimation::playbackRate const):
857         * animation/WebAnimation.idl:
858
859 2018-11-06  Antoine Quint  <graouts@apple.com>
860
861         [Web Animations] Implement getTiming() and updateTiming()
862         https://bugs.webkit.org/show_bug.cgi?id=186511
863         <rdar://problem/41000677>
864
865         Reviewed by Dean Jackson.
866
867         The Web Animations API has been further simplified by removing the AnimationEffectTiming and AnimationEffectTimingReadOnly
868         interfaces, removing the "timing" property on AnimationEffect replacing it with getTiming() and updateTiming() methods. This
869         does not change the features of the API but simply how they are exposed.
870
871         * CMakeLists.txt:
872         * DerivedSources.make:
873         * Sources.txt:
874         * WebCore.xcodeproj/project.pbxproj:
875         * animation/AnimationEffect.cpp:
876         (WebCore::AnimationEffect::AnimationEffect):
877         (WebCore::AnimationEffect::~AnimationEffect):
878         (WebCore::AnimationEffect::phase const):
879         (WebCore::AnimationEffect::activeTime const):
880         (WebCore::AnimationEffect::overallProgress const):
881         (WebCore::AnimationEffect::simpleIterationProgress const):
882         (WebCore::AnimationEffect::currentIteration const):
883         (WebCore::AnimationEffect::currentDirection const):
884         (WebCore::AnimationEffect::transformedProgress const):
885         (WebCore::AnimationEffect::getTiming):
886         (WebCore::AnimationEffect::getComputedTiming):
887         (WebCore::AnimationEffect::updateTiming):
888         (WebCore::AnimationEffect::setIterationStart):
889         (WebCore::AnimationEffect::setIterations):
890         (WebCore::AnimationEffect::endTime const):
891         (WebCore::AnimationEffect::setDelay):
892         (WebCore::AnimationEffect::setEndDelay):
893         (WebCore::AnimationEffect::setFill):
894         (WebCore::AnimationEffect::setIterationDuration):
895         (WebCore::AnimationEffect::setDirection):
896         (WebCore::AnimationEffect::setTimingFunction):
897         (WebCore::AnimationEffect::activeDuration const):
898         * animation/AnimationEffect.h:
899         (WebCore::AnimationEffect::delay const):
900         (WebCore::AnimationEffect::endDelay const):
901         (WebCore::AnimationEffect::fill const):
902         (WebCore::AnimationEffect::iterationStart const):
903         (WebCore::AnimationEffect::iterations const):
904         (WebCore::AnimationEffect::iterationDuration const):
905         (WebCore::AnimationEffect::direction const):
906         (WebCore::AnimationEffect::timingFunction const):
907         * animation/AnimationEffect.idl:
908         * animation/AnimationEffectTiming.idl: Removed.
909         * animation/AnimationEffectTimingReadOnly.cpp: Removed.
910         * animation/AnimationEffectTimingReadOnly.h: Removed.
911         * animation/AnimationEffectTimingReadOnly.idl: Removed.
912         * animation/CSSAnimation.cpp:
913         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
914         * animation/CSSTransition.cpp:
915         (WebCore::CSSTransition::setTimingProperties):
916         * animation/DeclarativeAnimation.cpp:
917         (WebCore::DeclarativeAnimation::invalidateDOMEvents):
918         * animation/DocumentTimeline.cpp:
919         * animation/EffectTiming.idl:
920         * animation/KeyframeEffect.cpp:
921         (WebCore::KeyframeEffect::create):
922         (WebCore::KeyframeEffect::KeyframeEffect):
923         (WebCore::KeyframeEffect::copyPropertiesFromSource):
924         (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle):
925         (WebCore::KeyframeEffect::applyPendingAcceleratedActions):
926         (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const):
927         * animation/KeyframeEffect.h:
928         * animation/OptionalEffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTiming.h.
929         * animation/OptionalEffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTiming.cpp.
930         * animation/WebAnimation.cpp:
931         (WebCore::WebAnimation::effectTimingDidChange):
932         (WebCore::WebAnimation::updatePlaybackRate):
933         * animation/WebAnimation.h:
934         (WebCore::WebAnimation::isRelevant const):
935         * bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp: Removed.
936         * bindings/js/WebCoreBuiltinNames.h:
937
938 2018-11-06  Antoine Quint  <graouts@apple.com>
939
940         [Web Animations] Update the Web Animations API to remove all the ReadOnly interfaces
941         https://bugs.webkit.org/show_bug.cgi?id=186512
942         <rdar://problem/41000691>
943
944         Reviewed by Dean Jackson.
945
946         The Web Animations API has been simplified by removing its various ReadOnly interfaces. In this patch,
947         we make the following changes, not adding code but merely merging and renaming files:
948
949         - AnimationEffectReadOnly and AnimationEffect are now a single AnimationEffect interface
950         - KeyframeEffectReadOnly and KeyframeEffect are now a single KeyframeEffect interface
951         - ComputedTimingProperties is now named ComputedEffectTiming
952         - AnimationEffectTimingProperties is now named EffectTiming
953
954         * CMakeLists.txt:
955         * DerivedSources.make:
956         * Sources.txt:
957         * WebCore.xcodeproj/project.pbxproj:
958         * animation/AnimationEffect.cpp: Renamed from Source/WebCore/animation/AnimationEffectReadOnly.cpp.
959         (WebCore::AnimationEffect::~AnimationEffect):
960         (WebCore::AnimationEffect::timingDidChange):
961         (WebCore::AnimationEffect::localTime const):
962         (WebCore::AnimationEffect::phase const):
963         (WebCore::AnimationEffect::activeTime const):
964         (WebCore::AnimationEffect::overallProgress const):
965         (WebCore::AnimationEffect::simpleIterationProgress const):
966         (WebCore::AnimationEffect::currentIteration const):
967         (WebCore::AnimationEffect::currentDirection const):
968         (WebCore::AnimationEffect::directedProgress const):
969         (WebCore::AnimationEffect::transformedProgress const):
970         (WebCore::AnimationEffect::iterationProgress const):
971         (WebCore::AnimationEffect::getComputedTiming):
972         * animation/AnimationEffect.h: Renamed from Source/WebCore/animation/AnimationEffectReadOnly.h.
973         (WebCore::AnimationEffect::isKeyframeEffect const):
974         * animation/AnimationEffect.idl: Renamed from Source/WebCore/animation/AnimationEffectReadOnly.idl.
975         * animation/AnimationEffectTimingReadOnly.cpp:
976         * animation/AnimationEffectTimingReadOnly.h:
977         (WebCore::AnimationEffectTimingReadOnly::setEffect):
978         * animation/AnimationTimeline.cpp:
979         (WebCore::AnimationTimeline::removeAnimation):
980         (WebCore::AnimationTimeline::cssAnimationForElementAndProperty):
981         * animation/CSSTransition.cpp:
982         * animation/ComputedEffectTiming.h: Renamed from Source/WebCore/animation/ComputedTimingProperties.h.
983         * animation/ComputedEffectTiming.idl: Renamed from Source/WebCore/animation/ComputedTimingProperties.idl.
984         * animation/DeclarativeAnimation.cpp:
985         (WebCore::DeclarativeAnimation::initialize):
986         (WebCore::DeclarativeAnimation::flushPendingStyleChanges const):
987         (WebCore::DeclarativeAnimation::phaseWithoutEffect const):
988         (WebCore::DeclarativeAnimation::invalidateDOMEvents):
989         * animation/DeclarativeAnimation.h:
990         * animation/DocumentTimeline.cpp:
991         (WebCore::DocumentTimeline::getAnimations const):
992         (WebCore::DocumentTimeline::transitionDidComplete):
993         (WebCore::DocumentTimeline::computeExtentOfAnimation const):
994         (WebCore::DocumentTimeline::isRunningAnimationOnRenderer const):
995         (WebCore::DocumentTimeline::isRunningAcceleratedAnimationOnRenderer const):
996         (WebCore::DocumentTimeline::animatedStyleForRenderer):
997         (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange):
998         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
999         (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations):
1000         (WebCore::DocumentTimeline::resolveAnimationsForElement):
1001         * animation/EffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTimingProperties.h.
1002         * animation/EffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTimingProperties.idl.
1003         * animation/KeyframeEffect.cpp:
1004         (WebCore::invalidateElement):
1005         (WebCore::CSSPropertyIDToIDLAttributeName):
1006         (WebCore::IDLAttributeNameToAnimationPropertyName):
1007         (WebCore::computeMissingKeyframeOffsets):
1008         (WebCore::processKeyframeLikeObject):
1009         (WebCore::processIterableKeyframes):
1010         (WebCore::processPropertyIndexedKeyframes):
1011         (WebCore::KeyframeEffect::create):
1012         (WebCore::KeyframeEffect::KeyframeEffect):
1013         (WebCore::KeyframeEffect::copyPropertiesFromSource):
1014         (WebCore::KeyframeEffect::getKeyframes):
1015         (WebCore::KeyframeEffect::processKeyframes):
1016         (WebCore::KeyframeEffect::updateBlendingKeyframes):
1017         (WebCore::KeyframeEffect::forceLayoutIfNeeded):
1018         (WebCore::KeyframeEffect::setBlendingKeyframes):
1019         (WebCore::KeyframeEffect::checkForMatchingTransformFunctionLists):
1020         (WebCore::KeyframeEffect::checkForMatchingFilterFunctionLists const):
1021         (WebCore::KeyframeEffect::checkForMatchingFilterFunctionLists):
1022         (WebCore::KeyframeEffect::checkForMatchingBackdropFilterFunctionLists):
1023         (WebCore::KeyframeEffect::checkForMatchingColorFilterFunctionLists):
1024         (WebCore::KeyframeEffect::computeDeclarativeAnimationBlendingKeyframes):
1025         (WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes):
1026         (WebCore::KeyframeEffect::computeCSSTransitionBlendingKeyframes):
1027         (WebCore::KeyframeEffect::computedNeedsForcedLayout):
1028         (WebCore::KeyframeEffect::computeStackingContextImpact):
1029         (WebCore::KeyframeEffect::setTarget):
1030         (WebCore::KeyframeEffect::apply):
1031         (WebCore::KeyframeEffect::invalidate):
1032         (WebCore::KeyframeEffect::computeShouldRunAccelerated):
1033         (WebCore::KeyframeEffect::getAnimatedStyle):
1034         (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle):
1035         (WebCore::KeyframeEffect::timingFunctionForKeyframeAtIndex):
1036         (WebCore::KeyframeEffect::updateAcceleratedAnimationState):
1037         (WebCore::KeyframeEffect::addPendingAcceleratedAction):
1038         (WebCore::KeyframeEffect::animationDidSeek):
1039         (WebCore::KeyframeEffect::animationSuspensionStateDidChange):
1040         (WebCore::KeyframeEffect::applyPendingAcceleratedActions):
1041         (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const):
1042         (WebCore::KeyframeEffect::renderer const):
1043         (WebCore::KeyframeEffect::currentStyle const):
1044         (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):
1045         (WebCore::containsRotation):
1046         (WebCore::KeyframeEffect::computeTransformedExtentViaTransformList const):
1047         (WebCore::KeyframeEffect::computeTransformedExtentViaMatrix const):
1048         * animation/KeyframeEffect.h:
1049         (WebCore::KeyframeEffect::ParsedKeyframe::ParsedKeyframe):
1050         (WebCore::KeyframeEffect::target const):
1051         (WebCore::KeyframeEffect::iterationComposite const):
1052         (WebCore::KeyframeEffect::composite const):
1053         (WebCore::KeyframeEffect::isRunningAccelerated const):
1054         (WebCore::KeyframeEffect::hasPendingAcceleratedAction const):
1055         (WebCore::KeyframeEffect::hasBlendingKeyframes const):
1056         (WebCore::KeyframeEffect::animatedProperties const):
1057         * animation/KeyframeEffect.idl:
1058         * animation/KeyframeEffectOptions.h:
1059         * animation/KeyframeEffectOptions.idl:
1060         * animation/KeyframeEffectReadOnly.cpp: Removed.
1061         * animation/KeyframeEffectReadOnly.h: Removed.
1062         * animation/KeyframeEffectReadOnly.idl: Removed.
1063         * animation/WebAnimation.cpp:
1064         (WebCore::WebAnimation::create):
1065         (WebCore::WebAnimation::setEffect):
1066         (WebCore::WebAnimation::setEffectInternal):
1067         (WebCore::WebAnimation::setTimeline):
1068         (WebCore::WebAnimation::applyPendingAcceleratedActions):
1069         (WebCore::WebAnimation::computeRelevance):
1070         * animation/WebAnimation.h:
1071         (WebCore::WebAnimation::effect const):
1072         * animation/WebAnimation.idl:
1073         * bindings/js/JSAnimationEffectCustom.cpp: Renamed from Source/WebCore/bindings/js/JSAnimationEffectReadOnlyCustom.cpp.
1074         (WebCore::toJSNewlyCreated):
1075         (WebCore::toJS):
1076         * bindings/js/JSWebAnimationCustom.cpp:
1077         (WebCore::constructJSWebAnimation):
1078         * bindings/js/WebCoreBuiltinNames.h:
1079         * dom/Document.cpp:
1080
1081 2018-11-06  Rob Buis  <rbuis@igalia.com>
1082
1083         Some minor X-Content-Type-Options parsing issues
1084         https://bugs.webkit.org/show_bug.cgi?id=191107
1085
1086         Reviewed by Darin Adler.
1087
1088         Implement new parsing rules for X-Content-Type-Options [1]:
1089         https://github.com/whatwg/fetch/pull/818
1090
1091         [1] https://fetch.spec.whatwg.org/#x-content-type-options-header
1092
1093         Test: web-platform-tests/fetch/nosniff/parsing-nosniff.html
1094
1095         * platform/network/HTTPParsers.cpp:
1096         (WebCore::isHTTPTabOrSpace):
1097         (WebCore::parseContentTypeOptionsHeader):
1098
1099 2018-11-06  Frederic Wang  <fwang@igalia.com>
1100
1101         Overlay with -webkit-overflow-scrolling:touch doesn't become scrollable after added text makes it taller
1102         https://bugs.webkit.org/show_bug.cgi?id=158342
1103
1104         Reviewed by Simon Fraser.
1105
1106         Resizing the content of a -webkit-overflow-scrolling:touch overflow node on iOS may make it
1107         scrollable. However, the RenderLayerBacking's scrolling layer is not properly created
1108         when RenderLayerCompositor::updateScrollCoordinatedLayer is called and hence the UIProcess
1109         receives a null UIScrollView pointer when ScrollingTreeScrollingNodeDelegateIOS performs the
1110         associated update. In debug mode this hits an ASSERT and in release mode the overflow node
1111         remains unscrollable from the user's point of view. This patch fixes this issue by ensuring
1112         the RenderLayerBacking's scrolling layer is created during updateScrollCoordinatedStatus.
1113
1114         Test: fast/scrolling/ios/update-scroll-coordinated-status.html
1115
1116         * rendering/RenderLayerCompositor.cpp:
1117         (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus): Call updateConfiguration()
1118         to ensure the scrolling layer is present and indicate whether a rebuild is necessary.
1119
1120 2018-11-05  Zan Dobersek  <zdobersek@igalia.com>
1121
1122         Place Fontconfig-specific RefPtr specializations in RefPtrFontconfig.h
1123         https://bugs.webkit.org/show_bug.cgi?id=191267
1124
1125         Reviewed by Michael Catanzaro.
1126
1127         Move the Fontconfig-specific RefPtr specialization declarations from
1128         RefPtrCairo.h to RefPtrFontconfig.h, with definitions moved to the new
1129         RefPtrFontconfig.cpp implementation file. These specializations are
1130         not tied to Cairo in any way.
1131
1132         * platform/FreeType.cmake:
1133         * platform/graphics/FontPlatformData.h:
1134         * platform/graphics/cairo/RefPtrCairo.cpp:
1135         * platform/graphics/cairo/RefPtrCairo.h:
1136         * platform/graphics/freetype/FontCacheFreeType.cpp:
1137         * platform/graphics/freetype/RefPtrFontconfig.cpp: Added.
1138         (WTF::refIfNotNull):
1139         (WTF::derefIfNotNull):
1140         * platform/graphics/freetype/RefPtrFontconfig.h: Copied from Source/WebCore/platform/graphics/cairo/RefPtrCairo.h.
1141
1142 2018-11-05  Don Olmstead  <don.olmstead@sony.com>
1143
1144         [CMake] Fix WebCore/Modules includes
1145         https://bugs.webkit.org/show_bug.cgi?id=191287
1146
1147         Reviewed by Fujii Hironori.
1148
1149         No new tests. No change in behavior.
1150
1151         Add in applicationmanifest to the list of includes and sort the
1152         modules directory.
1153
1154         * CMakeLists.txt:
1155
1156 2018-11-05  Myles C. Maxfield  <mmaxfield@apple.com>
1157
1158         Cache glyph paths and share underline skipping code between all the ports
1159         https://bugs.webkit.org/show_bug.cgi?id=191239
1160
1161         Reviewed by Alex Christensen.
1162
1163         I was hoping that caching the glyph paths was going to be a performance progression,
1164         but it turns out that the additional overhead of WebCore::Path compensated for it.
1165         In total, the performance is the same (my testing says that this patch is a 1%
1166         progression, but that's within the noise).
1167
1168         Because the ink skipping logic is now shared among all ports, Windows now gets it for
1169         free.
1170
1171         Test: PerformanceTests/Layout/underline.html
1172
1173         * platform/graphics/Font.cpp:
1174         (WebCore::Font::pathForGlyph const):
1175         * platform/graphics/Font.h:
1176         * platform/graphics/FontCascade.cpp:
1177         (WebCore::computeUnderlineType):
1178         (WebCore::GlyphIterationState::GlyphIterationState):
1179         (WebCore::findIntersectionPoint):
1180         (WebCore::updateX):
1181         (WebCore::findPathIntersections):
1182         (WebCore::GlyphToPathTranslator::GlyphToPathTranslator):
1183         (WebCore::GlyphToPathTranslator::containsMorePaths):
1184         (WebCore::GlyphToPathTranslator::path):
1185         (WebCore::GlyphToPathTranslator::extents):
1186         (WebCore::GlyphToPathTranslator::underlineType):
1187         (WebCore::GlyphToPathTranslator::advance):
1188         (WebCore::FontCascade::dashesForIntersectionsWithRect const):
1189         * platform/graphics/FontCascade.h:
1190         * platform/graphics/GlyphMetricsMap.h:
1191         (WebCore::GlyphMetricsMap::existingMetricsForGlyph):
1192         (WebCore::GlyphMetricsMap::GlyphMetricsPage::existingMetricsForGlyph const):
1193         (WebCore::GlyphMetricsMap<std::optional<Path>>::unknownMetrics):
1194         * platform/graphics/TextRun.h:
1195         * platform/graphics/cairo/FontCairo.cpp:
1196         (WebCore::Font::platformPathForGlyph const):
1197         (WebCore::GlyphIterationState::GlyphIterationState): Deleted.
1198         (WebCore::findIntersectionPoint): Deleted.
1199         (WebCore::updateX): Deleted.
1200         (WebCore::findPathIntersections): Deleted.
1201         (): Deleted.
1202         (WebCore::CairoGlyphToPathTranslator::path): Deleted.
1203         (WebCore::CairoGlyphToPathTranslator::extents): Deleted.
1204         (WebCore::CairoGlyphToPathTranslator::underlineType): Deleted.
1205         (WebCore::CairoGlyphToPathTranslator::advance): Deleted.
1206         (WebCore::FontCascade::dashesForIntersectionsWithRect const): Deleted.
1207         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1208         (WebCore::GlyphIterationState::GlyphIterationState): Deleted.
1209         (WebCore::findIntersectionPoint): Deleted.
1210         (WebCore::updateX): Deleted.
1211         (WebCore::findPathIntersections): Deleted.
1212         (): Deleted.
1213         (WebCore::MacGlyphToPathTranslator::path): Deleted.
1214         (WebCore::MacGlyphToPathTranslator::extents): Deleted.
1215         (WebCore::MacGlyphToPathTranslator::underlineType): Deleted.
1216         (WebCore::MacGlyphToPathTranslator::advance): Deleted.
1217         (WebCore::FontCascade::dashesForIntersectionsWithRect const): Deleted.
1218         * platform/graphics/cocoa/FontCocoa.mm:
1219         (WebCore::Font::platformPathForGlyph const):
1220         * rendering/TextDecorationPainter.cpp:
1221         (WebCore::drawSkipInkUnderline):
1222         (WebCore::TextDecorationPainter::paintTextDecoration):
1223
1224 2018-11-05  Myles C. Maxfield  <mmaxfield@apple.com>
1225
1226         Clean up text decoration drawing code
1227         https://bugs.webkit.org/show_bug.cgi?id=191245
1228
1229         Reviewed by Zalan Bujtas.
1230
1231         This is some general clean up of the text decorations code. There is no behavior change.
1232
1233         This patch modifies GraphicsContext::drawLineForText() & friends to accept a FloatRect instead of a FloatPoint + float width.
1234         This is helpful because it allows for easier bounding box calculations.
1235         This patch also removes some redundant computations that the skip:ink codepath was performing.
1236         This patch also refactors the wavy decoration parameters to not use out params.
1237
1238         No new tests because there is no behavior change.
1239
1240         * platform/graphics/GraphicsContext.cpp:
1241         (WebCore::GraphicsContext::computeUnderlineBoundsForText):
1242         (WebCore::GraphicsContext::computeLineBoundsAndAntialiasingModeForText):
1243         * platform/graphics/GraphicsContext.h:
1244         * platform/graphics/GraphicsContextImpl.h:
1245         * platform/graphics/cg/GraphicsContextCG.cpp:
1246         (WebCore::GraphicsContext::drawLineForText):
1247         (WebCore::GraphicsContext::drawLinesForText):
1248         * platform/graphics/displaylists/DisplayListItems.cpp:
1249         (WebCore::DisplayList::DrawLinesForText::apply const):
1250         (WebCore::DisplayList::DrawLinesForText::localBounds const):
1251         (WebCore::DisplayList::operator<<):
1252         * platform/graphics/displaylists/DisplayListItems.h:
1253         (WebCore::DisplayList::DrawLinesForText::create):
1254         (WebCore::DisplayList::DrawLinesForText::thickness const):
1255         (WebCore::DisplayList::DrawLinesForText::DrawLinesForText):
1256         * platform/graphics/displaylists/DisplayListRecorder.cpp:
1257         (WebCore::DisplayList::Recorder::drawLinesForText):
1258         * platform/graphics/displaylists/DisplayListRecorder.h:
1259         * rendering/InlineTextBox.cpp:
1260         (WebCore::InlineTextBox::paintMarkedTextDecoration):
1261         (WebCore::InlineTextBox::paintCompositionUnderline const):
1262         * rendering/SimpleLineLayoutFunctions.cpp:
1263         (WebCore::SimpleLineLayout::paintFlow):
1264         * rendering/TextDecorationPainter.cpp:
1265         (WebCore::strokeWavyTextDecoration):
1266         (WebCore::translateIntersectionPointsToSkipInkBoundaries):
1267         (WebCore::TextDecorationPainter::TextDecorationPainter):
1268         (WebCore::TextDecorationPainter::paintTextDecoration):
1269         (WebCore::drawSkipInkUnderline): Deleted.
1270         * rendering/TextDecorationPainter.h:
1271         (WebCore::TextDecorationPainter::setInlineTextBox):
1272         (WebCore::TextDecorationPainter::setWidth):
1273         (WebCore::TextDecorationPainter::setFont): Deleted.
1274         (WebCore::TextDecorationPainter::setBaseline): Deleted.
1275         * style/InlineTextBoxStyle.cpp:
1276         (WebCore::getWavyStrokeParameters):
1277         (WebCore::visualOverflowForDecorations):
1278         * style/InlineTextBoxStyle.h:
1279
1280 2018-11-05  Myles C. Maxfield  <mmaxfield@apple.com>
1281
1282         Fix the Windows build after r237835
1283         https://bugs.webkit.org/show_bug.cgi?id=191242
1284
1285         Reviewed by Simon Fraser.
1286
1287         * rendering/style/TextDecorationThickness.h:
1288         (WebCore::TextDecorationThickness::operator== const):
1289
1290 2018-11-05  Wenson Hsieh  <wenson_hsieh@apple.com>
1291
1292         [iOS] Swatch appears squished and off-center in inputs of type color
1293         https://bugs.webkit.org/show_bug.cgi?id=191279
1294         <rdar://problem/45816319>
1295
1296         Reviewed by Tim Horton.
1297
1298         This patch makes some small adjustments to color inputs on iOS to bring them closer to the intended design.
1299         See comments below for more details.
1300
1301         Tests:  fast/forms/color/color-input-uses-color-well-appearance.html
1302                 fast/forms/color/input-appearance-color.html
1303
1304         * css/html.css:
1305
1306         Adjust the UA stylesheet for color inputs on iOS.
1307
1308         * rendering/RenderTheme.cpp:
1309         (WebCore::RenderTheme::paintDecorations):
1310
1311         When painting decorations for `ColorWellPart`, treat it as a standard button instead of the square button
1312         appearance.
1313
1314         (WebCore::RenderTheme::colorInputStyleSheet const):
1315
1316         Add `-webkit-appearance: color-well;` to the stylesheet for color inputs. Previously, this was special-cased on
1317         iOS, where color input elements had appearances of `textfield`; however, this patch makes some adjustments to
1318         RenderThemeIOS, allowing us to use `color-well` on iOS.
1319
1320         * rendering/RenderTheme.h:
1321         (WebCore::RenderTheme::platformUsesColorWellAppearance const): Deleted.
1322
1323         Remove this from RenderTheme. This is no longer necessary, since all platforms now use
1324         `-webkit-appearance: color-well;`.
1325
1326         * rendering/RenderThemeIOS.h:
1327         * rendering/RenderThemeIOS.mm:
1328         (WebCore::RenderThemeIOS::adjustButtonStyle const):
1329
1330         When painting buttons for color inputs, don't add rounded corners that are present by default for regular
1331         buttons.
1332
1333 2018-11-05  Eric Carlson  <eric.carlson@apple.com>
1334
1335         [MediaStream] An audio track should be muted when capture is interrupted by the OS.
1336         https://bugs.webkit.org/show_bug.cgi?id= 191283
1337          <rdar://problem/45773103>
1338
1339         Reviewed by Jon Lee.
1340
1341         Test: fast/mediastream/media-stream-track-interrupted.html
1342
1343         * platform/mediastream/RealtimeMediaSource.cpp:
1344         (WebCore::RealtimeMediaSource::setInterruptedForTesting):
1345         * platform/mediastream/RealtimeMediaSource.h:
1346         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1347         (WebCore::CoreAudioCaptureSource::beginInterruption):
1348         (WebCore::CoreAudioCaptureSource::endInterruption):
1349         * testing/Internals.cpp:
1350         (WebCore::Internals::setMediaStreamSourceInterrupted):
1351         * testing/Internals.h:
1352         * testing/Internals.idl:
1353
1354 2018-11-05  Myles C. Maxfield  <mmaxfield@apple.com>
1355
1356         Parsing support for text-underline-offset and text-decoration-thickness
1357         https://bugs.webkit.org/show_bug.cgi?id=191242
1358
1359         Reviewed by Simon Fraser.
1360
1361         Before we can implement the properties properly, we have to parse them.
1362
1363         https://github.com/w3c/csswg-drafts/issues/3118#issuecomment-432297480 describes the grammar:
1364         text-underline-position: auto | [ [ under | from-font] || [ left | right ] ]
1365         text-underline-offset: auto | <length>
1366         text-decoration-thickness: auto | from-font | <length>
1367
1368         This patch also takes the opportunity to update the grammar of text-underline-position to match the spec,
1369         and to add an alias to the unprefixed version.
1370
1371         We still don't support the left and right values on text-underline-position. We should add those eventually.
1372
1373         Tests: fast/css3-text/css3-text-decoration/text-decoration-thickness-parse.html
1374                fast/css3-text/css3-text-decoration/text-underline-offset-parse.html
1375
1376         * WebCore.xcodeproj/project.pbxproj:
1377         * css/CSSComputedStyleDeclaration.cpp:
1378         (WebCore::textUnderlineOffsetToCSSValue):
1379         (WebCore::textDecorationThicknessToCSSValue):
1380         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
1381         * css/CSSPrimitiveValueMappings.h:
1382         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1383         (WebCore::CSSPrimitiveValue::operator TextUnderlinePosition const):
1384         (WebCore::CSSPrimitiveValue::operator OptionSet<TextUnderlinePosition> const): Deleted.
1385         * css/CSSProperties.json:
1386         * css/CSSValueKeywords.in:
1387         * css/StyleBuilderConverter.h:
1388         (WebCore::StyleBuilderConverter::convertTextUnderlinePosition):
1389         (WebCore::StyleBuilderConverter::convertTextUnderlineOffset):
1390         (WebCore::StyleBuilderConverter::convertTextDecorationThickness):
1391         * css/StyleResolver.cpp:
1392         (WebCore::shouldApplyPropertyInParseOrder):
1393         * css/parser/CSSPropertyParser.cpp:
1394         (WebCore::consumeTextUnderlineOffset):
1395         (WebCore::consumeTextDecorationThickness):
1396         (WebCore::CSSPropertyParser::parseSingleValue):
1397         * rendering/style/RenderStyle.h:
1398         (WebCore::RenderStyle::textUnderlinePosition const):
1399         (WebCore::RenderStyle::textUnderlineOffset const):
1400         (WebCore::RenderStyle::textDecorationThickness const):
1401         (WebCore::RenderStyle::setTextUnderlinePosition):
1402         (WebCore::RenderStyle::setTextUnderlineOffset):
1403         (WebCore::RenderStyle::setTextDecorationThickness):
1404         (WebCore::RenderStyle::initialTextUnderlinePosition):
1405         (WebCore::RenderStyle::initialTextUnderlineOffset):
1406         (WebCore::RenderStyle::initialTextDecorationThickness):
1407         * rendering/style/RenderStyleConstants.h:
1408         * rendering/style/StyleRareInheritedData.cpp:
1409         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
1410         (WebCore::StyleRareInheritedData::operator== const):
1411         * rendering/style/StyleRareInheritedData.h:
1412         * rendering/style/TextDecorationThickness.h: Added.
1413         (WebCore::TextDecorationThickness::createWithAuto):
1414         (WebCore::TextDecorationThickness::createFromFont):
1415         (WebCore::TextDecorationThickness::createWithLength):
1416         (WebCore::TextDecorationThickness::isAuto const):
1417         (WebCore::TextDecorationThickness::isFromFont const):
1418         (WebCore::TextDecorationThickness::isLength const):
1419         (WebCore::TextDecorationThickness::setLengthValue):
1420         (WebCore::TextDecorationThickness::lengthValue const):
1421         (WebCore::TextDecorationThickness::operator== const):
1422         (WebCore::TextDecorationThickness::operator!= const):
1423         (WebCore::TextDecorationThickness::TextDecorationThickness):
1424         (WebCore::operator<<):
1425         * rendering/style/TextUnderlineOffset.h: Added.
1426         (WebCore::TextUnderlineOffset::createWithAuto):
1427         (WebCore::TextUnderlineOffset::createWithLength):
1428         (WebCore::TextUnderlineOffset::isAuto const):
1429         (WebCore::TextUnderlineOffset::isLength const):
1430         (WebCore::TextUnderlineOffset::setLengthValue):
1431         (WebCore::TextUnderlineOffset::lengthValue const):
1432         (WebCore::TextUnderlineOffset::lengthOr const):
1433         (WebCore::TextUnderlineOffset::operator== const):
1434         (WebCore::TextUnderlineOffset::operator!= const):
1435         (WebCore::TextUnderlineOffset::TextUnderlineOffset):
1436         (WebCore::operator<<):
1437         * style/InlineTextBoxStyle.cpp:
1438         (WebCore::computeUnderlineOffset):
1439         * style/InlineTextBoxStyle.h:
1440
1441 2018-11-05  Myles C. Maxfield  <mmaxfield@apple.com>
1442
1443         Spelling dots are drawn in the wrong place
1444         https://bugs.webkit.org/show_bug.cgi?id=190764
1445
1446         Reviewed by Dean Jackson.
1447
1448         - Dots should not be clipped.
1449         - Dots should be horizontally centered.
1450         - Dots should be drawn behind the text.
1451         - Distance from the baseline to the top of the dot should be 11.035% of font size.
1452         - Dot diameter should be 13.247% of the font size.
1453         - Distance between the dots (right side of the left dot to left side of the right dot) should be 9.457% of the font size.
1454         - The "font size" used in these calculations should be clamped so it's 10px <= font size <= 40px.
1455
1456         Tests: editing/spelling/spelling-dots-position-2.html
1457                editing/spelling/spelling-dots-position-3.html
1458                editing/spelling/spelling-dots-position.html
1459                editing/spelling/spelling-dots-repaint.html
1460
1461         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1462         (WebCore::colorForMarkerLineStyle): Align iOS and macOS implementations.
1463         (WebCore::GraphicsContext::drawDotsForDocumentMarker): Place the dots correctly.
1464         * rendering/InlineFlowBox.cpp:
1465         (WebCore::InlineFlowBox::addToLine): The KnownToHaveNoOverflow flag should be cleared if the element has spelling dots,
1466             because there is no guarantee the spelling dots will lie inside the layout rect of the element.
1467         (WebCore::InlineFlowBox::addTextBoxVisualOverflow): Update the repaint rects to include splling dot positions.
1468         * rendering/InlineFlowBox.h: Comments should explain why, not say what.
1469         * rendering/InlineTextBox.cpp:
1470         (WebCore::InlineTextBox::paint): Draw the dots behind the text.
1471         (WebCore::InlineTextBox::hasMarkers const): Convenience.
1472         (WebCore::InlineTextBox::paintPlatformDocumentMarkers): Refactor bounds information into a helper function.
1473         (WebCore::InlineTextBox::calculateUnionOfAllDocumentMarkerBounds const): Use for repaint rect calculation.
1474         (WebCore::InlineTextBox::calculateDocumentMarkerBounds const): Place the dots correctly.
1475         (WebCore::InlineTextBox::paintPlatformDocumentMarker): Call the helper method.
1476         (WebCore::InlineTextBox::collectMarkedTextsForDocumentMarkers const):
1477         (WebCore::InlineTextBox::collectMarkedTextsForDocumentMarkers): Deleted.
1478         * rendering/InlineTextBox.h: Declare the helper methods.
1479         * rendering/SimpleLineLayout.cpp: Simple line layout doesn't know how to paint spelling dots, so make the presence of
1480             spelling dots opt us out of SLL.
1481         (WebCore::SimpleLineLayout::canUseForWithReason):
1482         * rendering/SimpleLineLayoutCoverage.cpp:
1483         (WebCore::SimpleLineLayout::printReason):
1484         * rendering/SimpleLineLayoutCoverage.h: Add a new opt-out reason.
1485
1486 2018-11-05  Dean Jackson  <dino@apple.com>
1487
1488         Attempted build fix.
1489
1490         * dom/messageports/MessagePortChannelRegistry.cpp:
1491
1492 2018-11-05  Chris Dumez  <cdumez@apple.com>
1493
1494         Crash under DOMWindow::postMessageTimerFired()
1495         https://bugs.webkit.org/show_bug.cgi?id=191217
1496         <rdar://problem/40888466>
1497
1498         Reviewed by Geoffrey Garen.
1499
1500         Protect the frame in DOMWindow::postMessageTimerFired() before calling dispatchEvent() as dispatching the
1501         event may cause JS to run and this JS may cause the frame to be destroyed, in which case we will crash
1502         when trying to use the frame on the next line.
1503
1504         Test: fast/dom/Window/remove-frame-in-message-event-handler.html
1505
1506         * page/DOMWindow.cpp:
1507         (WebCore::DOMWindow::postMessageTimerFired):
1508
1509 2018-11-05  Thibault Saunier  <tsaunier@igalia.com>
1510
1511         [GStreamer] Fix EncodedImage timestamps to match what libWebRTC expects
1512         https://bugs.webkit.org/show_bug.cgi?id=190035
1513
1514         Reviewed by Philippe Normand.
1515
1516         We can't rely on GStreamer timestamps to pass to EncodedImages after encoding
1517         because libWebRTC doesn't use the timestamp we fed it but does
1518         some computation on the input timestamp in the images we pass in before it passes
1519         them back to the encoder. Then internally LibWebRTC relies on those exact timestamps
1520         passed into the encoder to do checks and compute RTP timestamps so we need to carefully
1521         pass the exact timestamps to LibWebRTC (in practice we still use GStreamer timestamps in
1522         all the GStreamer processing pipelines as the WebRTC object basically wraps the "same"
1523         `GstSample` all around, but we are not synced on the clock anyway).
1524
1525         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
1526         * platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.cpp:
1527         (WebCore::LibWebRTCVideoFrameFromGStreamerSample):
1528         * platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.h:
1529         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
1530         (WebCore::GStreamerVideoDecoder::newSampleCallback):
1531         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
1532         (WebCore::GStreamerVideoEncoder::GStreamerVideoEncoder):
1533         (WebCore::GStreamerVideoEncoder::newSampleCallback):
1534
1535 2018-11-05  Wenson Hsieh  <wenson_hsieh@apple.com>
1536
1537         [iOS] Changing view scale sometimes does not zoom the page to the new initial scale when the page is zoomed in when ignoring meta viewport
1538         https://bugs.webkit.org/show_bug.cgi?id=191226
1539         <rdar://problem/45781765>
1540
1541         Reviewed by Tim Horton.
1542
1543         When `_setViewScale:` SPI is used to adjust the layout scale factor of the page, we multiply minimum, initial
1544         and maximum scales by the given layout scale factor to adjust for a larger or smaller minimum layout size.
1545         However, in the case where the layout size scale factor is greater than 1 and we're also forcing the viewport to
1546         be scalable, we override the default minimum scale with 1 (i.e. `forceAlwaysUserScalableMinimumScale`). This
1547         means that the might be off by a small margin due to rounding error when computing the content width and view
1548         width (see: r237743).
1549
1550         This means that in the case where (1) the viewport is forced to be user-scalable, and (2) we're ignoring meta
1551         viewport parameters, and (3) `_viewScale` exceeds 1, we may end up computing a slightly different minimum scale
1552         than the default minimum scale multiplied by the layout size scale factor; subsequently, the page scale factor
1553         will be slightly different from initial scale, such that we'll no longer zoom to the new initial scale when
1554         changing view scale.
1555
1556         This patch adjusts `forceAlwaysUserScalableMinimumScale` and `forceAlwaysUserScalableMaximumScale` to take the
1557         current layout scale factor into account when computing min and max scales when the viewport is forced to be
1558         always scalable.
1559
1560         Test: fast/viewport/ios/minimum-scale-after-changing-view-scale.html
1561
1562         * page/ViewportConfiguration.cpp:
1563         (WebCore::ViewportConfiguration::minimumScale const):
1564         * page/ViewportConfiguration.h:
1565         (WebCore::ViewportConfiguration::maximumScale const):
1566         (WebCore::ViewportConfiguration::forceAlwaysUserScalableMaximumScale const):
1567         (WebCore::ViewportConfiguration::forceAlwaysUserScalableMinimumScale const):
1568
1569         Turn these from constant values to const functions on ViewportConfiguration, which factor in the current
1570         viewport layout size scale factor.
1571
1572 2018-11-05  Dean Jackson  <dino@apple.com>
1573
1574         Expose a constructor for PointerEvent from PlatformTouchEvent
1575         https://bugs.webkit.org/show_bug.cgi?id=191238
1576         <rdar://problem/45795682>
1577
1578         Reviewed by Antoine Quint.
1579
1580         Implement a constructor that takes a PlatformTouchEvent to
1581         create a PointerEvent. At the moment the code to call this
1582         constructor will live in WebKitAdditions, so no new tests
1583         yet.
1584
1585         * SourcesCocoa.txt: Add PointerEventIOS.cpp.
1586         * WebCore.xcodeproj/project.pbxproj: Ditto.
1587         * dom/EventNames.h: Add macros for pointerdown, pointermove,
1588              pointerup, pointercancel.
1589         * dom/PointerEvent.cpp: Remove JSC namespace.
1590         * dom/PointerEvent.h: Add create and constructor that takes
1591              a PlatformTouchEvent.
1592         * dom/ios/PointerEventIOS.cpp: Added.
1593
1594 2018-11-05  Ryan Haddad  <ryanhaddad@apple.com>
1595
1596         Unreviewed, rolling out r237785.
1597
1598         Introduced layout test and API test failures on macOS and iOS.
1599
1600         Reverted changeset:
1601
1602         "[iOS] Issue initial paint soon after the visuallyNonEmpty
1603         milestone is fired."
1604         https://bugs.webkit.org/show_bug.cgi?id=191078
1605         https://trac.webkit.org/changeset/237785
1606
1607 2018-11-05  Thibault Saunier  <tsaunier@igalia.com>
1608
1609         [GStreamer][WebRTC] Error out when simulcast is activated
1610         https://bugs.webkit.org/show_bug.cgi?id=190678
1611
1612         Reviewed by Philippe Normand.
1613
1614         Implementing it is not for now yet.
1615
1616         Tests for simulcast have been disabled as they now fail (instead of crashing).
1617
1618         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
1619         (WebCore::GStreamerVideoEncoder::InitEncode):
1620
1621 2018-11-05  Youenn Fablet  <youenn@apple.com>
1622
1623         RealtimeOutgoingAudioSource subclasses should observe its source when fully constructed
1624         https://bugs.webkit.org/show_bug.cgi?id=191241
1625
1626         Reviewed by Eric Carlson.
1627
1628         Moving the logic to observe the audio source to the point where the
1629         RealtimeOutgoingAudioSource subclass is fully initialized.
1630         Covered by existing tests.
1631
1632         * platform/mediastream/RealtimeOutgoingAudioSource.cpp:
1633         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
1634         (WebCore::RealtimeOutgoingAudioSource::observeSource):
1635         * platform/mediastream/RealtimeOutgoingAudioSource.h:
1636         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
1637         (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::RealtimeOutgoingAudioSourceLibWebRTC):
1638         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp:
1639         (WebCore::RealtimeOutgoingAudioSourceCocoa::RealtimeOutgoingAudioSourceCocoa):
1640
1641 2018-11-05  Thibault Saunier  <tsaunier@igalia.com>
1642
1643         [GStreamer][WebRTC] Add webrtcencoder bin to cleanup and refactor the way we set encoders
1644         https://bugs.webkit.org/show_bug.cgi?id=190674
1645
1646         Reviewed by Philippe Normand.
1647
1648         webrtcencoder is a simple GstBin with a set of well known GStreamer encoders which
1649         it can use to implement encoding for different formats exposing a trimmed down unified API.
1650
1651         It also adds proper handling of H264 profiles.
1652
1653         The added files follow GStreamer coding style as we aim at upstreaming the element
1654         in the future.
1655
1656         This is a refactoring so current tests already cover it.
1657
1658         * platform/GStreamer.cmake:
1659         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1660         (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements):
1661         * platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp: Added.
1662         (gst_webrtc_video_encoder_get_property):
1663         (gst_webrtc_video_encoder_set_bitrate):
1664         (gst_webrtc_video_encoder_set_format):
1665         (gst_webrtc_video_encoder_set_property):
1666         (register_known_encoder):
1667         (setup_x264enc):
1668         (setup_vp8enc):
1669         (setup_openh264enc):
1670         (set_bitrate_kbit_per_sec):
1671         (set_bitrate_bit_per_sec):
1672         (gst_webrtc_video_encoder_class_init):
1673         (gst_webrtc_video_encoder_init):
1674         * platform/mediastream/libwebrtc/GStreamerVideoEncoder.h: Added.
1675         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
1676         (WebCore::GStreamerVideoEncoder::GStreamerVideoEncoder):
1677         (WebCore::GStreamerVideoEncoder::InitEncode):
1678         (WebCore::GStreamerVideoEncoder::createEncoder):
1679         (WebCore::GStreamerVideoEncoder::AddCodecIfSupported):
1680         (WebCore::GStreamerVideoEncoder::ImplementationName const):
1681         (WebCore::GStreamerVideoEncoder::SetRestrictionCaps):
1682
1683 2018-11-05  Thibault Saunier  <tsaunier@igalia.com>
1684
1685         [GStreamer][WebRTC] properly mark H.264 stream type in the "decoder"
1686         https://bugs.webkit.org/show_bug.cgi?id=190676
1687
1688         Reviewed by Philippe Normand.
1689
1690         Avoiding to have h264parse make assumption (which might be wrong at some
1691         point).
1692
1693         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
1694         (WebCore::GStreamerVideoDecoder::GetCapsForFrame):
1695
1696 2018-11-05  Thibault Saunier  <tsaunier@igalia.com>
1697
1698         [GStreamer] Do not sync libwerbtc stream on the clock
1699         https://bugs.webkit.org/show_bug.cgi?id=190677
1700
1701         The approach here is basically to let libwebrtc do all the
1702         synchronisation for us, and the same way as it is done in apple ports,
1703         we basically try to display what libwebrtc outputs as fast as possible.
1704
1705         Reviewed by Philippe Normand.
1706
1707         Manually tested
1708
1709         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1710         (WebCore::setSyncOnSink):
1711         (WebCore::MediaPlayerPrivateGStreamer::syncOnClock):
1712         (WebCore::MediaPlayerPrivateGStreamer::loadFull):
1713         (WebCore::MediaPlayerPrivateGStreamer::load):
1714         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1715
1716 2018-11-05  Ali Juma  <ajuma@chromium.org>
1717
1718         [IntersectionObserver] Fix isIntersecting computation when 0 is not a threshold
1719         https://bugs.webkit.org/show_bug.cgi?id=191210
1720
1721         Reviewed by Simon Fraser.
1722
1723         isIntersecting should be false if the intersection ratio is smaller than the
1724         smallest threshold value. Update the computation of isIntersecting to depend on
1725         the current thresholdIndex.
1726
1727         Test: imported/w3c/web-platform-tests/intersection-observer/initial-observation-with-threshold-expected.html
1728
1729         * dom/Document.cpp:
1730         (WebCore::Document::updateIntersectionObservations):
1731
1732 2018-11-05  Rob Buis  <rbuis@igalia.com>
1733
1734         Remove some virtual methods in CachedRawResource
1735         https://bugs.webkit.org/show_bug.cgi?id=191251
1736
1737         Reviewed by Frédéric Wang.
1738
1739         Since CachedRawResource is final no need to introduce new virtual
1740         methods in CachedRawResource. This patch also removes an outdated
1741         comment and forward declaration.
1742
1743         No new tests since no change in functionality.
1744
1745         * loader/cache/CachedRawResource.h:
1746
1747 2018-11-05  Philippe Normand  <pnormand@igalia.com>
1748
1749         [GStreamer] Move elements registration to GStreamerCommon
1750         https://bugs.webkit.org/show_bug.cgi?id=191189
1751
1752         Reviewed by Xabier Rodriguez-Calvar.
1753
1754         It was a bit odd to have this in the base player class and to have
1755         sub-classes calling a static function of the super-class.
1756
1757         Covered by existing tests.
1758
1759         * platform/graphics/gstreamer/GStreamerCommon.cpp:
1760         (WebCore::initializeGStreamerAndRegisterWebKitElements):
1761         * platform/graphics/gstreamer/GStreamerCommon.h:
1762         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1763         (WebCore::MediaPlayerPrivateGStreamer::isAvailable):
1764         (WebCore::MediaPlayerPrivateGStreamer::loadFull):
1765         (WebCore::MediaPlayerPrivateGStreamer::getSupportedTypes):
1766         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1767         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1768         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1769         (WebCore::MediaPlayerPrivateGStreamerMSE::registerMediaEngine):
1770         (WebCore::MediaPlayerPrivateGStreamerMSE::load):
1771         (WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected):
1772         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType):
1773
1774 2018-11-04  Rob Buis  <rbuis@igalia.com>
1775
1776         Remove ENABLE_OPENCL fully
1777         https://bugs.webkit.org/show_bug.cgi?id=191172
1778
1779         Reviewed by Yusuke Suzuki.
1780
1781         Forgot to simplify this, no need for applyAll anymore
1782         since it just calls apply.
1783
1784         No new tests since no change in functionality.
1785
1786         * platform/graphics/filters/FilterEffect.h:
1787         (WebCore::FilterEffect::applyAll): Deleted.
1788         * rendering/svg/RenderSVGResourceFilter.cpp:
1789         (WebCore::RenderSVGResourceFilter::postApplyResource):
1790
1791 2018-11-04  Zalan Bujtas  <zalan@apple.com>
1792
1793         [iOS] Issue initial paint soon after the visuallyNonEmpty milestone is fired.
1794         https://bugs.webkit.org/show_bug.cgi?id=191078
1795         <rdar://problem/45736178>
1796
1797         Reviewed by Antti Koivisto.
1798
1799         1. Improve visuallyNonEmpty milestone confidence level.
1800             Ignore whitespace and non visible text content.
1801             Parsing the main document should not necessarily fire the milestone. Check if there's any pending scripts/css/font loading.
1802             Check if the html/body is actually visible.
1803
1804         2. Issue initial paint soon after the milestone fires.
1805             Use a 0ms timer to flush the initial paint.
1806             Throttle additional flushes for 500ms (remove the non-initial 1.5 throttling)
1807
1808         3. Suspend optional style recalcs and layouts while painting is being throttled.
1809            When parsing yields we initiate a 0ms style recalc/layout timer.
1810            These optional layouts produce content that we have no intention to paint. 
1811
1812         * dom/Document.cpp:
1813         (WebCore::Document::scheduleStyleRecalc):
1814         (WebCore::Document::shouldScheduleLayout):
1815         * page/ChromeClient.h:
1816         * page/FrameView.cpp:
1817         (WebCore::FrameView::resetLayoutMilestones):
1818         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const):
1819         (WebCore::FrameView::updateSignificantRenderedTextMilestoneIfNeeded):
1820         (WebCore::FrameView::updateIsVisuallyNonEmpty):
1821         * page/FrameView.h:
1822         (WebCore::FrameView::incrementVisuallyNonEmptyCharacterCount): Ignore whitespace characters. Some pages start with plenty of whitespace only content.
1823         * platform/graphics/FontCascade.h:
1824         * rendering/RenderText.cpp: Check whether the text is actually visible at this point.
1825         (WebCore::RenderText::RenderText):
1826
1827 2018-11-04  Zalan Bujtas  <zalan@apple.com>
1828
1829         [LFC][BFC] Add support for percentage height in quirks mode.
1830         https://bugs.webkit.org/show_bug.cgi?id=191232
1831
1832         Reviewed by Antti Koivisto.
1833
1834         In quirks mode, we go and travers the containing block chain to find a block level
1835         box with fixed height value to resolve the percentage value.
1836
1837         Test: fast/block/basic/quirk-mode-percent-height.html
1838
1839         * layout/FormattingContextGeometry.cpp:
1840         (WebCore::Layout::FormattingContext::Geometry::computedHeightValue):
1841         * layout/Verification.cpp:
1842         (WebCore::Layout::LayoutState::verifyAndOutputMismatchingLayoutTree const):
1843
1844 2018-11-04  Zalan Bujtas  <zalan@apple.com>
1845
1846         [LFC][BCF] Add support for block level non-replaced inflow height percentage
1847         https://bugs.webkit.org/show_bug.cgi?id=191229
1848
1849         Reviewed by Antti Koivisto.
1850
1851         Test: fast/block/basic/child-block-level-box-with-height-percent.html
1852
1853         * layout/FormattingContext.h:
1854         * layout/FormattingContextGeometry.cpp:
1855         (WebCore::Layout::FormattingContext::Geometry::computedHeightValue):
1856         (WebCore::Layout::computedHeightValue): Deleted.
1857         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1858         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1859
1860 2018-11-04  Youenn Fablet  <youenn@apple.com>
1861
1862         RealtimeOutgoingAudioSource should use DestructionThread::Main
1863         https://bugs.webkit.org/show_bug.cgi?id=191230
1864
1865         Reviewed by Eric Carlson.
1866
1867         Covered by imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-replaceTrack.https.html
1868         that should no longer crash in debug.
1869
1870         * platform/mediastream/RealtimeOutgoingAudioSource.h:
1871
1872 2018-11-04  Youenn Fablet  <youenn@apple.com>
1873
1874         IDB should allow storing RTCCertificate
1875         https://bugs.webkit.org/show_bug.cgi?id=191077
1876
1877         Reviewed by Chris Dumez.
1878
1879         Add support for serialization/deserialization of RTCCertificate.
1880         Store the origin in RTCCertificate and make sure that a certificate
1881         with a different origin cannot be used to create a RTCPeerConnection.
1882
1883         Test: imported/w3c/web-platform-tests/webrtc/RTCCertificate-postMessage.html
1884
1885         * Modules/mediastream/PeerConnectionBackend.cpp:
1886         (WebCore::PeerConnectionBackend::generateCertificate):
1887         * Modules/mediastream/RTCCertificate.cpp:
1888         (WebCore::RTCCertificate::create):
1889         (WebCore::RTCCertificate::RTCCertificate):
1890         * Modules/mediastream/RTCCertificate.h:
1891         (WebCore::RTCCertificate::origin const):
1892         * Modules/mediastream/RTCPeerConnection.cpp:
1893         (WebCore::RTCPeerConnection::certificatesFromConfiguration):
1894         * Modules/mediastream/RTCPeerConnection.h:
1895         * Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp:
1896         (WebCore::LibWebRTCCertificateGenerator::RTCCertificateGeneratorCallback::RTCCertificateGeneratorCallback):
1897         (WebCore::LibWebRTCCertificateGenerator::generateCertificate):
1898         * Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.h:
1899         * bindings/js/SerializedScriptValue.cpp:
1900         (WebCore::CloneSerializer::dumpIfTerminal):
1901         (WebCore::CloneDeserializer::CachedString::takeString):
1902         (WebCore::CloneDeserializer::readRTCCertificate):
1903         (WebCore::CloneDeserializer::readTerminal):
1904
1905 2018-11-04  Youenn Fablet  <youenn@apple.com>
1906
1907         Add support for RTCMuxPolicy
1908         https://bugs.webkit.org/show_bug.cgi?id=191188
1909
1910         Reviewed by Eric Carlson.
1911
1912         Add support for RTCMuxPolicy dictionary option for both constructor and setConfiguration.
1913         Make sure setConfiguration throws if trying to change this policy.
1914         Pipe this parameter up to libwebrtc.
1915         Covered by rebased test.
1916
1917         * Modules/mediastream/RTCConfiguration.h:
1918         * Modules/mediastream/RTCConfiguration.idl:
1919         * Modules/mediastream/RTCPeerConnection.cpp:
1920         (WebCore::iceServersFromConfiguration):
1921         (WebCore::RTCPeerConnection::initializeConfiguration):
1922         (WebCore::RTCPeerConnection::setConfiguration):
1923         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1924         (WebCore::rtcpMuxPolicyfromConfiguration):
1925         (WebCore::configurationFromMediaEndpointConfiguration):
1926         * WebCore.xcodeproj/project.pbxproj:
1927         * platform/mediastream/MediaEndpointConfiguration.cpp:
1928         (WebCore::MediaEndpointConfiguration::MediaEndpointConfiguration):
1929         * platform/mediastream/MediaEndpointConfiguration.h:
1930         * platform/mediastream/RTCPMuxPolicy.h: Added.
1931
1932 2018-11-03  Devin Rousso  <drousso@apple.com>
1933
1934         Web Inspector: Canvas: capture changes to <canvas> that would affect the recorded context
1935         https://bugs.webkit.org/show_bug.cgi?id=190854
1936
1937         Reviewed by Matt Baker.
1938
1939         Updated existing tests: inspector/canvas/recording-2d.html
1940                                 inspector/canvas/recording-bitmaprenderer.html
1941                                 inspector/canvas/recording-webgl.html
1942
1943         * html/HTMLCanvasElement.idl:
1944         Apply `CallTracingCallback=recordCanvasAction` to the `width` and `height` attributes so
1945         that they are recorded through the same path as `CanvasRenderingContext`.
1946
1947         * html/CanvasBase.h:
1948         * html/CanvasBase.cpp:
1949         (WebCore::CanvasBase::callTracingActive const): Added.
1950
1951         * bindings/js/CallTracer.h:
1952         * bindings/js/CallTracer.cpp:
1953         (WebCore::CallTracer::recordCanvasAction):
1954
1955
1956 2018-11-03  Andy Estes  <aestes@apple.com>
1957
1958         [Payment Request] PaymentResponse.retry()'s errorFields should be optional
1959         https://bugs.webkit.org/show_bug.cgi?id=191212
1960
1961         Reviewed by Youenn Fablet.
1962
1963         Per WebIDL, the errorFields argument to PaymentResponse.retry() should be optional. See
1964         <https://github.com/w3c/payment-request/issues/804> for details.
1965
1966         Added test case to http/tests/paymentrequest/payment-response-retry-method.https.html.
1967
1968         * Modules/paymentrequest/PaymentResponse.idl:
1969
1970 2018-11-02  Zalan Bujtas  <zalan@apple.com>
1971
1972         [LFC][BFC] Resolve percentage height values.
1973         https://bugs.webkit.org/show_bug.cgi?id=191224
1974
1975         Reviewed by Antti Koivisto.
1976
1977         10.5 Content height: the 'height' property
1978         The percentage is calculated with respect to the height of the generated box's containing block.
1979         If the height of the containing block is not specified explicitly (i.e., it depends on content height),
1980         and this element is not absolutely positioned, the used height is calculated as if 'auto' was specified.
1981
1982         https://www.w3.org/TR/CSS22/visudet.html#propdef-height
1983
1984         Test: fast/block/basic/height-percentage-simple.html
1985
1986         * layout/FormattingContextGeometry.cpp:
1987         (WebCore::Layout::isHeightAuto):
1988         (WebCore::Layout::computedHeightValue):
1989         (WebCore::Layout::contentHeightForFormattingContextRoot):
1990         (WebCore::Layout::FormattingContext::Geometry::computedMaxHeight):
1991         (WebCore::Layout::FormattingContext::Geometry::computedMinHeight):
1992         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
1993         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
1994         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1995         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1996
1997 2018-11-03  Eric Carlson  <eric.carlson@apple.com>
1998
1999         [MediaStream] enumerateDevices should not expose devices that are not available to getUserMedia
2000         https://bugs.webkit.org/show_bug.cgi?id=191177
2001         <rdar://problem/45747873>
2002
2003         Reviewed by Jer Noble.
2004
2005         Test: http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute.html
2006
2007         * Modules/mediastream/MediaDevicesRequest.cpp:
2008         (WebCore::MediaDevicesRequest::start): Only expose devices that are available to gUM.
2009
2010         * Modules/mediastream/UserMediaController.cpp:
2011         (WebCore::isSecure): Moved from UserMediaRequest.cpp.
2012         (WebCore::isAllowedToUse): Ditto.
2013         (WebCore::UserMediaController::canCallGetUserMedia): Modified from UserMediaRequest.cpp.
2014         (WebCore::UserMediaController::logGetUserMediaDenial): Log reason for denial.
2015         * Modules/mediastream/UserMediaController.h:
2016
2017         * Modules/mediastream/UserMediaRequest.cpp:
2018         (WebCore::UserMediaRequest::start): Use UserMediaController::canCallGetUserMedia.
2019         (WebCore::isSecure): Deleted.
2020         (WebCore::isAllowedToUse): Deleted.
2021         (WebCore::canCallGetUserMedia): Deleted.
2022
2023 2018-11-02  Justin Michaud  <justin_michaud@apple.com>
2024
2025         Add new global object and preliminary Worklets support for CSS painting api
2026         https://bugs.webkit.org/show_bug.cgi?id=190979
2027
2028         Reviewed by Chris Dumez.
2029
2030         Test: fast/css-custom-paint/worklet.html
2031
2032         Add a new ScriptExecutionContext and global object to run worklets in. This is mostly copy+paste
2033         from Workers, but without any of the threading. Worklet.addModule does not yet support loading scripts
2034         or doing cross origin checking. There are quite a few parts of the ScriptExecutionContext api that are
2035         left as ASSERT_NOT_REACHED().
2036
2037         * CMakeLists.txt:
2038         * DerivedSources.make:
2039         * Sources.txt:
2040         * WebCore.xcodeproj/project.pbxproj:
2041         * bindings/js/JSDOMGlobalObject.cpp:
2042         (WebCore::JSDOMGlobalObject::scriptExecutionContext const):
2043         * bindings/js/JSPaintWorkletGlobalScopeCustom.cpp: Renamed from Source/WebCore/bindings/js/JSCSSPaintWorkletGlobalScopeCustom.cpp.
2044         (WebCore::JSPaintWorkletGlobalScope::visitAdditionalChildren):
2045         (WebCore::JSPaintWorkletGlobalScope::registerPaint):
2046         * bindings/js/JSWorkletGlobalScopeBase.cpp: Added.
2047         (WebCore::JSWorkletGlobalScopeBase::JSWorkletGlobalScopeBase):
2048         (WebCore::JSWorkletGlobalScopeBase::finishCreation):
2049         (WebCore::JSWorkletGlobalScopeBase::clearDOMGuardedObjects):
2050         (WebCore::JSWorkletGlobalScopeBase::visitChildren):
2051         (WebCore::JSWorkletGlobalScopeBase::destroy):
2052         (WebCore::JSWorkletGlobalScopeBase::scriptExecutionContext const):
2053         (WebCore::JSWorkletGlobalScopeBase::supportsRichSourceInfo):
2054         (WebCore::JSWorkletGlobalScopeBase::shouldInterruptScript):
2055         (WebCore::JSWorkletGlobalScopeBase::shouldInterruptScriptBeforeTimeout):
2056         (WebCore::JSWorkletGlobalScopeBase::javaScriptRuntimeFlags):
2057         (WebCore::toJS):
2058         (WebCore::toJSWorkletGlobalScope):
2059         * bindings/js/JSWorkletGlobalScopeBase.h: Added.
2060         (WebCore::JSWorkletGlobalScopeBase::wrapped const):
2061         (WebCore::JSWorkletGlobalScopeBase::proxy const):
2062         (WebCore::JSWorkletGlobalScopeBase::createStructure):
2063         (WebCore::toJS):
2064         * bindings/js/ScriptState.cpp:
2065         (WebCore::execStateFromWorkerGlobalScope):
2066         (WebCore::execStateFromWorkletGlobalScope):
2067         * bindings/js/ScriptState.h:
2068         * bindings/js/WebCoreBuiltinNames.h:
2069         * bindings/scripts/CodeGeneratorJS.pm:
2070         (IsDOMGlobalObject):
2071         (ShouldUseGlobalObjectPrototype):
2072         (GenerateHeader):
2073         (GenerateRuntimeEnableConditionalStringForExposed):
2074         (GenerateImplementation):
2075         * bindings/scripts/preprocess-idls.pl:
2076         * css/CSSPaintImageValue.cpp:
2077         (WebCore::CSSPaintImageValue::image):
2078         * css/DOMCSSPaintWorklet.cpp:
2079         (WebCore::DOMCSSPaintWorklet::ensurePaintWorklet):
2080         (WebCore::DOMCSSPaintWorklet::ensurePaintWorkletGlobalScope): Deleted.
2081         * css/DOMCSSPaintWorklet.h:
2082         * css/DOMCSSPaintWorklet.idl:
2083         * dom/Document.cpp:
2084         (WebCore::Document::ensureCSSPaintWorklet):
2085         (WebCore::Document::setCSSPaintWorkletGlobalScope):
2086         (WebCore::Document::ensureCSSPaintWorkletGlobalScope): Deleted.
2087         * dom/Document.h:
2088         (WebCore::Document::getCSSPaintWorkletGlobalScope):
2089         * dom/EventTargetFactory.in:
2090         * dom/ScriptExecutionContext.cpp:
2091         (WebCore::ScriptExecutionContext::vm):
2092         (WebCore::ScriptExecutionContext::execState):
2093         * dom/ScriptExecutionContext.h:
2094         (WebCore::ScriptExecutionContext::isWorkletGlobalScope const):
2095         * inspector/agents/worker/WorkerDebuggerAgent.cpp:
2096         (WebCore::WorkerDebuggerAgent::injectedScriptForEval):
2097         * inspector/agents/worker/WorkerRuntimeAgent.cpp:
2098         (WebCore::WorkerRuntimeAgent::injectedScriptForEval):
2099         * platform/graphics/CustomPaintImage.cpp:
2100         (WebCore::CustomPaintImage::CustomPaintImage):
2101         (WebCore::CustomPaintImage::doCustomPaint):
2102         * platform/graphics/CustomPaintImage.h:
2103         * worklets/PaintWorkletGlobalScope.cpp: Copied from Source/WebCore/css/CSSPaintWorkletGlobalScope.cpp.
2104         (WebCore::PaintWorkletGlobalScope::create):
2105         (WebCore::PaintWorkletGlobalScope::PaintWorkletGlobalScope):
2106         (WebCore::PaintWorkletGlobalScope::devicePixelRatio):
2107         (WebCore::PaintWorkletGlobalScope::addRegisteredPaint):
2108         * worklets/PaintWorkletGlobalScope.h: Renamed from Source/WebCore/css/CSSPaintWorkletGlobalScope.h.
2109         * worklets/PaintWorkletGlobalScope.idl: Copied from Source/WebCore/css/CSSPaintWorkletGlobalScope.idl.
2110         * worklets/Worklet.cpp: Copied from Source/WebCore/css/CSSPaintWorkletGlobalScope.cpp.
2111         (WebCore::Worklet::create):
2112         (WebCore::Worklet::Worklet):
2113         (WebCore::Worklet::addModule):
2114         * worklets/Worklet.h: Renamed from Source/WebCore/css/CSSPaintWorkletGlobalScope.cpp.
2115         * worklets/Worklet.idl: Copied from Source/WebCore/css/CSSPaintWorkletGlobalScope.idl.
2116         * worklets/WorkletConsoleClient.cpp: Copied from Source/WebCore/inspector/agents/worker/WorkerDebuggerAgent.cpp.
2117         (WebCore::WorkletConsoleClient::WorkletConsoleClient):
2118         (WebCore::WorkletConsoleClient::messageWithTypeAndLevel):
2119         (WebCore::WorkletConsoleClient::count):
2120         (WebCore::WorkletConsoleClient::time):
2121         (WebCore::WorkletConsoleClient::timeEnd):
2122         (WebCore::WorkletConsoleClient::profile):
2123         (WebCore::WorkletConsoleClient::profileEnd):
2124         (WebCore::WorkletConsoleClient::takeHeapSnapshot):
2125         (WebCore::WorkletConsoleClient::timeStamp):
2126         (WebCore::WorkletConsoleClient::record):
2127         (WebCore::WorkletConsoleClient::recordEnd):
2128         * worklets/WorkletConsoleClient.h: Added.
2129         * worklets/WorkletGlobalScope.cpp: Added.
2130         (WebCore::WorkletGlobalScope::WorkletGlobalScope):
2131         (WebCore::WorkletGlobalScope::~WorkletGlobalScope):
2132         (WebCore::WorkletGlobalScope::evaluate):
2133         (WebCore::WorkletGlobalScope::isJSExecutionForbidden const):
2134         (WebCore::WorkletGlobalScope::disableEval):
2135         (WebCore::WorkletGlobalScope::disableWebAssembly):
2136         (WebCore::WorkletGlobalScope::completeURL const):
2137         (WebCore::WorkletGlobalScope::logExceptionToConsole):
2138         (WebCore::WorkletGlobalScope::addConsoleMessage):
2139         (WebCore::WorkletGlobalScope::addMessage):
2140         * worklets/WorkletGlobalScope.h: Added.
2141         (WebCore::WorkletGlobalScope::isPaintWorkletGlobalScope const):
2142         (WebCore::WorkletGlobalScope::identifier const):
2143         (WebCore::WorkletGlobalScope::script):
2144         (WebCore::WorkletGlobalScope::jsRuntimeFlags const):
2145         (isType):
2146         * worklets/WorkletGlobalScope.idl: Renamed from Source/WebCore/css/CSSPaintWorkletGlobalScope.idl.
2147         * worklets/WorkletScriptController.cpp: Added.
2148         (WebCore::WorkletScriptController::WorkletScriptController):
2149         (WebCore::WorkletScriptController::~WorkletScriptController):
2150         (WebCore::WorkletScriptController::forbidExecution):
2151         (WebCore::WorkletScriptController::isExecutionForbidden const):
2152         (WebCore::WorkletScriptController::disableEval):
2153         (WebCore::WorkletScriptController::disableWebAssembly):
2154         (WebCore::WorkletScriptController::initScriptWithSubclass):
2155         (WebCore::WorkletScriptController::initScript):
2156         (WebCore::WorkletScriptController::evaluate):
2157         (WebCore::WorkletScriptController::setException):
2158         * worklets/WorkletScriptController.h: Added.
2159         (WebCore::WorkletScriptController::workletGlobalScopeWrapper):
2160         (WebCore::WorkletScriptController::vm):
2161         (WebCore::WorkletScriptController::initScriptIfNeeded):
2162
2163 2018-11-02  Myles C. Maxfield  <mmaxfield@apple.com>
2164
2165         Clean up drawLineForDocumentMarker()
2166         https://bugs.webkit.org/show_bug.cgi?id=191215
2167
2168         Reviewed by Zalan Bujtas.
2169
2170         In preparation for https://bugs.webkit.org/show_bug.cgi?id=190764, I need to do a little bit of refactoring.
2171         This patch has no behavior change; it just does the following:
2172
2173         1. Renames drawLineForDocumentMarker() to drawDotsForDocumentMarker(), because 2 of the 3 implementations draw dots
2174         2. Moves our implementation back into GraphicsContext, because it's simpler and  GraphicsContext is already platform-
2175                specific.
2176         3. The signature used to accept a location and a width, but without a height, it's difficult to know what the bounding
2177                box is. In particular, knowing the bounding box must be possible without a GraphicsContext. So, I've modified
2178                the signature to accept a rectangle instead. The GraphicsContext draws only within this rectangle.
2179
2180         No new tests because there is no behavior change.
2181
2182         * platform/graphics/GraphicsContext.h:
2183         * platform/graphics/GraphicsContextImpl.h:
2184         * platform/graphics/cairo/CairoOperations.cpp:
2185         (WebCore::Cairo::drawDotsForDocumentMarker):
2186         (WebCore::Cairo::drawLineForDocumentMarker): Deleted.
2187         * platform/graphics/cairo/CairoOperations.h:
2188         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2189         (WebCore::GraphicsContext::drawDotsForDocumentMarker):
2190         (WebCore::GraphicsContext::drawLineForDocumentMarker): Deleted.
2191         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
2192         (WebCore::GraphicsContextImplCairo::drawDotsForDocumentMarker):
2193         (WebCore::GraphicsContextImplCairo::drawLineForDocumentMarker): Deleted.
2194         * platform/graphics/cairo/GraphicsContextImplCairo.h:
2195         * platform/graphics/cocoa/FontCascadeCocoa.mm:
2196         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
2197         (WebCore::colorForMarkerLineStyle):
2198         (WebCore::GraphicsContext::drawDotsForDocumentMarker):
2199         (WebCore::GraphicsContext::drawLineForDocumentMarker): Deleted.
2200         * platform/graphics/displaylists/DisplayListItems.cpp:
2201         (WebCore::DisplayList::Item::sizeInBytes):
2202         (WebCore::DisplayList::DrawDotsForDocumentMarker::apply const):
2203         (WebCore::DisplayList::DrawDotsForDocumentMarker::localBounds const):
2204         (WebCore::DisplayList::operator<<):
2205         (WebCore::DisplayList::DrawLineForDocumentMarker::apply const): Deleted.
2206         (WebCore::DisplayList::DrawLineForDocumentMarker::localBounds const): Deleted.
2207         * platform/graphics/displaylists/DisplayListItems.h:
2208         (WebCore::DisplayList::DrawDotsForDocumentMarker::create):
2209         (WebCore::DisplayList::DrawDotsForDocumentMarker::rect const):
2210         (WebCore::DisplayList::DrawDotsForDocumentMarker::DrawDotsForDocumentMarker):
2211         (WebCore::DisplayList::DrawLineForDocumentMarker::create): Deleted.
2212         (WebCore::DisplayList::DrawLineForDocumentMarker::point const): Deleted.
2213         (WebCore::DisplayList::DrawLineForDocumentMarker::width const): Deleted.
2214         (WebCore::DisplayList::DrawLineForDocumentMarker::DrawLineForDocumentMarker): Deleted.
2215         * platform/graphics/displaylists/DisplayListRecorder.cpp:
2216         (WebCore::DisplayList::Recorder::drawDotsForDocumentMarker):
2217         (WebCore::DisplayList::Recorder::drawLineForDocumentMarker): Deleted.
2218         * platform/graphics/displaylists/DisplayListRecorder.h:
2219         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
2220         (Nicosia::CairoOperationRecorder::drawDotsForDocumentMarker):
2221         (Nicosia::CairoOperationRecorder::drawLineForDocumentMarker): Deleted.
2222         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
2223         * platform/graphics/win/GraphicsContextCGWin.cpp:
2224         (WebCore::GraphicsContext::drawDotsForDocumentMarker):
2225         (WebCore::GraphicsContext::drawLineForDocumentMarker): Deleted.
2226         * platform/graphics/win/GraphicsContextDirect2D.cpp:
2227         (WebCore::GraphicsContext::drawDotsForDocumentMarker):
2228         (WebCore::GraphicsContext::drawLineForDocumentMarker): Deleted.
2229         * rendering/InlineTextBox.cpp:
2230         (WebCore::InlineTextBox::paintPlatformDocumentMarker):
2231         * rendering/RenderTheme.cpp:
2232         (WebCore::RenderTheme::drawLineForDocumentMarker): Deleted.
2233         * rendering/RenderTheme.h:
2234         * rendering/RenderThemeCocoa.h:
2235         * rendering/RenderThemeCocoa.mm:
2236         (WebCore::RenderThemeCocoa::drawLineForDocumentMarker): Deleted.
2237         * rendering/RenderThemeIOS.h:
2238         * rendering/RenderThemeIOS.mm:
2239         (WebCore::RenderThemeIOS::colorForMarkerLineStyle): Deleted.
2240         * rendering/RenderThemeMac.h:
2241         * rendering/RenderThemeMac.mm:
2242         (WebCore::RenderThemeMac::colorForMarkerLineStyle): Deleted.
2243
2244 2018-11-02  Ali Juma  <ajuma@chromium.org>
2245
2246         requestAnimationFrame causes bad location of position:fixed inside overflow:auto and iframe
2247         https://bugs.webkit.org/show_bug.cgi?id=176243
2248
2249         Reviewed by Simon Fraser.
2250
2251         When a new layer tree is committed to the UIProcess, the positions of layers for fixed
2252         or sticky nodes in the newly-committed tree can be stale, because of scrolling that has
2253         happened in the UIProcess since the tree was updated in the WebProcess. To handle this,
2254         RemoteLayerTreeDrawingAreaProxy::commitLayerTree updates the positions of these layers
2255         by calling RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling, which
2256         leads to a recursive traversal of the ScrollingTree to update each such layer. However,
2257         since ScrollingTreeFrameScrollingNodeIOS didn't implement updateLayersAfterAncestorChange,
2258         this traversal never descended into scrolling nodes within an iframe, so the layers for
2259         these nodes were left with stale positions.
2260
2261         Implement ScrollingTreeFrameScrollingNodeIOS::updateLayersAfterAncestorChange so that
2262         fixed and sticky layers within an iframe do get their positions updated when a new layer
2263         tree is committed.
2264
2265         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
2266         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
2267         (WebCore::ScrollingTreeFrameScrollingNodeIOS::updateLayersAfterAncestorChange):
2268
2269 2018-11-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2270
2271         [iOS] Changing view scale sometimes does not zoom the page to the new initial scale, when the page is at initial scale
2272         https://bugs.webkit.org/show_bug.cgi?id=191180
2273         <rdar://problem/45744786>
2274
2275         Reviewed by Simon Fraser.
2276
2277         When computing the minimum scale in ViewportConfiguration::minimumScale, if our content width or height is
2278         shorter than the view width or height, then we recompute the minimum scale such that the content dimensions will
2279         fill the bounds of the view by setting the minimum scale to the view width or height divided by the content
2280         width or height.
2281
2282         Suppose the minimum scale is equal to some value `s`; additionally, let `w_c` denote the content width and `w_v`
2283         denote the view width (as integers). If `w_v / s` is not an integral value, the computed content width `w_c` may
2284         be rounded, such that `w_v / w_c` is not precisely equal to `s`. In the case that `w_v / w_c` is ever so
2285         slightly larger than `s`, we will end up overriding the minimum scale `s` with `w_v / w_c`.
2286
2287         As a result, specifying a viewport with a decimal `minimum-scale` will sometimes cause the computed minimum
2288         scale of the viewport (and platform view) to be very slightly different from the minimum scale. The new layout
2289         test below exercises this scenario, specifying a viewport with minimum and initial scales of 0.94 that results
2290         in `ViewportConfiguration::minimumScale` returning 0.94158.
2291
2292         With the `WebPage::setViewportConfigurationViewLayoutSize` check added in r237127, this means setting
2293         `_viewScale:` when the page is at initial scale sometimes doesn't zoom the page to the new initial scale when it
2294         should, since the page scale factor and the initial scale are different enough such that
2295         `areEssentiallyEqualAsFloat` returns false.
2296
2297         This patch addresses these issues by snapping to the minimum scale if the computed scale that fits content
2298         dimensions to view dimensions results in a minimum scale that is close enough to the configuration's minimum
2299         scale, such that the difference can be attributed to rounding error when computing content or view dimensions.
2300
2301         Test: fast/viewport/ios/viewport-minimum-and-initial-scale.html
2302
2303         * page/ViewportConfiguration.cpp:
2304         (WebCore::ViewportConfiguration::minimumScale const):
2305
2306 2018-11-02  Philippe Normand  <pnormand@igalia.com>
2307
2308         [GTK][WPE] Unreviewed, another --no-video --no-web-audio build fix following r237677
2309
2310         * inspector/agents/InspectorDOMAgent.cpp:
2311         (WebCore::InspectorDOMAgent::addEventListenersToNode):
2312
2313 2018-11-02  Daniel Bates  <dabates@apple.com>
2314
2315         [iOS] Normalize character string based on key code
2316         https://bugs.webkit.org/show_bug.cgi?id=191120
2317
2318         Reviewed by Tim Horton.
2319
2320         Following r236417 (https://bugs.webkit.org/show_bug.cgi?id=189604) we always have a valid key code
2321         for a special key (e.g. page up) and can simplify the character string normalization code.
2322
2323         No functionality changed. So, no new tests.
2324
2325         * platform/ios/WebEvent.mm:
2326         (normalizedStringWithAppKitCompatibilityMapping): Modified to take a key code and wrote algorithm
2327         in terms of it.
2328
2329         (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:keyCode:isTabKey:characterSet:]):
2330         (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:withInputManagerHint:keyCode:isTabKey:]):
2331         Pass the key code for the event to normalizedStringWithAppKitCompatibilityMapping().
2332
2333 2018-11-02  Daniel Bates  <dabates@apple.com>
2334
2335         [iOS] WebKit should dispatch DOM events when a modifier key is pressed
2336         https://bugs.webkit.org/show_bug.cgi?id=190487
2337
2338         Reviewed by Tim Horton.
2339
2340         Add support for modifier flags change events.
2341
2342         * platform/ios/PlatformEventFactoryIOS.mm:
2343         (WebCore::modifiersForEvent): Modifier keys do not have an associated character and do not
2344         participate in key repeat.
2345         (WebCore::keyIdentifierForKeyEvent): Identify modifier keys, returning "Unidentified" if
2346         the modifier key is unidentified. This matches the behavior on Mac.
2347         (WebCore::keyForKeyEvent): Identify modifier keys, returning the empty string if the modifier
2348         key is unidentified. This matches the behavior on Mac.
2349         (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
2350         * platform/ios/WebEvent.h:
2351
2352         * platform/ios/WebEvent.mm:
2353         (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:keyCode:isTabKey:characterSet:]):
2354         (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:withInputManagerHint:keyCode:isTabKey:]):
2355         Modifier keys do not have an associated character and do not participate in key repeat.
2356
2357         (-[WebEvent _eventDescription]): Modified to print a description for a keydown or keyup event
2358         that represents a modifier flags change.
2359         (-[WebEvent characters]): Modifier keys do not have an associated character. Assert this
2360         invariant as it is a programming error. On Mac, the same operation would result in a
2361         NSInternalInconsistencyException exception being raised.
2362         (-[WebEvent charactersIgnoringModifiers]): Ditto.
2363
2364 2018-11-02  Ali Juma  <ajuma@chromium.org>
2365
2366         Allow cross-document intersection observing
2367         https://bugs.webkit.org/show_bug.cgi?id=165746
2368
2369         Reviewed by Simon Fraser.
2370
2371         Add logic to compute the intersection between the viewport and an element in a
2372         subframe.
2373
2374         Add a FloatRect version of ScrollView::rootViewToContents, and FloatRect versions
2375         of the methods it calls.
2376
2377         Test: http/tests/intersection-observer/intermediate-frame-changes.html
2378         Also covered by rebased tests in imported/w3c/web-platform-tests/intersection-observer.
2379
2380         * dom/Document.cpp:
2381         (WebCore::computeClippedRectInRootContentsSpace):
2382         (WebCore::computeIntersectionState):
2383         (WebCore::Document::updateIntersectionObservations):
2384         * page/FrameView.cpp:
2385         (WebCore::FrameView::viewportContentsChanged):
2386         (WebCore::FrameView::convertFromContainingViewToRenderer const):
2387         (WebCore::FrameView::convertFromContainingView const):
2388         * page/FrameView.h:
2389         * platform/ScrollView.cpp:
2390         (WebCore::ScrollView::viewToContents const):
2391         (WebCore::ScrollView::contentsToView const):
2392         (WebCore::ScrollView::rootViewToContents const):
2393         * platform/ScrollView.h:
2394         * platform/Widget.cpp:
2395         (WebCore::Widget::convertFromRootView const):
2396         (WebCore::Widget::convertFromContainingView const):
2397         * platform/Widget.h:
2398
2399 2018-11-02  Rob Buis  <rbuis@igalia.com>
2400
2401         Remove ENABLE_OPENCL fully
2402         https://bugs.webkit.org/show_bug.cgi?id=191172
2403
2404         Reviewed by Yusuke Suzuki.
2405
2406         No new tests since no change in functionality.
2407
2408         * platform/graphics/filters/FilterEffect.h:
2409         (WebCore::FilterEffect::hasResult const):
2410         (WebCore::FilterEffect::applyAll):
2411         (WebCore::FilterEffect::openCLImage): Deleted.
2412         (WebCore::FilterEffect::setOpenCLImage): Deleted.
2413
2414 2018-11-02  Zalan Bujtas  <zalan@apple.com>
2415
2416         [LFC][IFC] Add support for intrinsic width calculation
2417         https://bugs.webkit.org/show_bug.cgi?id=191144
2418
2419         Reviewed by Antti Koivisto.
2420
2421         This is the inline formatting version of the shrink-to-fit computation. It generates inline runs
2422         and uses InlineLineBreaker to compute min/max width. This is very similar to ::layout.
2423
2424         Test: fast/inline/simple-shrink-to-fit-inline-block.html
2425
2426         * layout/inlineformatting/InlineFormattingContext.cpp:
2427         (WebCore::Layout::InlineFormattingContext::layout const):
2428         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
2429         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
2430         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
2431         (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForReplacedInlineBox const):
2432         (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
2433         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
2434         (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForInlineBox const): Deleted.
2435         * layout/inlineformatting/InlineFormattingContext.h:
2436
2437 2018-11-02  Zalan Bujtas  <zalan@apple.com>
2438
2439         [LFC][BFC] BlockFormattingContext::instrinsicWidthConstraints logic should look similar to ::layout
2440         https://bugs.webkit.org/show_bug.cgi?id=191181
2441
2442         Reviewed by Antti Koivisto.
2443
2444         * layout/blockformatting/BlockFormattingContext.cpp:
2445         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
2446
2447 2018-11-02  Zalan Bujtas  <zalan@apple.com>
2448
2449         [LFC] Align shrink-to-fit width computation with the layout implementation.
2450         https://bugs.webkit.org/show_bug.cgi?id=191179
2451
2452         Reviewed by Antti Koivisto.
2453
2454         There are many similarities between layout and shrink-to-fit.
2455         They both operate on formatting roots only (shrink-to-fit -> float, out-of-flow, inline-block) and in both cases
2456         the algoritm depends on what type of formatting context the element establishes.
2457
2458         This patch is in preparation for transforming the "shrink-to-fit" width computation to make it behave more like layout.
2459         With this change the instrinsicWidthConstraints() computation happens in the formatting context that the element establishes (similar to layout).
2460
2461         * layout/FormattingContext.cpp:
2462         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
2463         * layout/FormattingContext.h:
2464         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
2465         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
2466         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2467         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2468         * layout/FormattingContextGeometry.cpp:
2469         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
2470         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2471         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2472         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
2473         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
2474         * layout/blockformatting/BlockFormattingContext.cpp:
2475         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
2476         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
2477         * layout/blockformatting/BlockFormattingContext.h:
2478         * layout/inlineformatting/InlineFormattingContext.cpp:
2479         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
2480         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
2481         * layout/inlineformatting/InlineFormattingContext.h:
2482         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
2483         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
2484
2485 2018-11-01  Antoine Quint  <graouts@apple.com>
2486
2487         [Web Animations] Make document.getAnimations() return declarative animations in the correct order
2488         https://bugs.webkit.org/show_bug.cgi?id=191153
2489
2490         Reviewed by Dean Jackson.
2491
2492         The Web Animations spec has the notion of "composite order" which determines the order in which animations should
2493         be returned when document.getAnimations() is called. The CSS Transitions and CSS Animations specifications also
2494         determine the composite order of their respective animation classes, as well as the notion of "owning element",
2495         the element that was the animation target when specified through style, prior to any manipulation via the Web
2496         Animations API. We implement these two notions so that we can pass the document.getAnimations() tests for
2497         declarative animations.
2498
2499         It is important that we have the notion of an "owning element" since when a CSS Transition or CSS Animation is
2500         modified via the Web Animations API in a way that an animation created through CSS we must consider no longer
2501         as a declarative animation but as a regular Web Animation. In this patch, we remove the DeclarativeAnimation's
2502         target(), which returned a reference, to owningElement(), which returns a pointer and return nullptr once the
2503         declarative animation has been modified.
2504
2505         In order to also keep a correct count of declarative animations applied to elements, we correctly add transitions
2506         that have completed to a list of completed transitions, as specified by the CSS Transitions spec. We have had this
2507         list declared in AnimationTimeline.h for a while but never actually did the work to add items to it. Thanks to that,
2508         AnimationTimeline::updateCSSTransitionsForElement() now correctly accounts for completed transitions so that they
2509         may be canceled if overridden with a new animation, correctly removing their "owning element".
2510
2511         Finally, now that we have saner lists of animations per classes, we can apply the right sorting routines to match
2512         the composite order for CSS Transitions, CSS Animations and Web Animations, keeping a list of all animations created
2513         in order as the final criterion for sorting.
2514
2515         * animation/AnimationTimeline.cpp:
2516         (WebCore::AnimationTimeline::animationTimingDidChange): Make sure this animation is tracked on the list of all animations
2517         created for this timeline in the order in which they were created, which is needed to sort animations correctly when
2518         document.getAnimations() is called.
2519         (WebCore::AnimationTimeline::animationWasAddedToElement): We've removed the relevantMapForAnimation() method which we used
2520         to determine which map we should add an animation to based on its class and instead have code that accounts for not just
2521         the animation's class, but also whether it has an owning element since a valid owning element is required to qualify as
2522         a CSS Transition or CSS Animation, regardless of the animation's original class.
2523         (WebCore::removeAnimationFromMapForElement): Adding this helper to remove an animation from the provided animation map so
2524         that animationWasRemovedFromElement() can call this with all of the various animation maps.
2525         (WebCore::AnimationTimeline::animationWasRemovedFromElement): Check all of the various animation maps to see which may
2526         contain the animation we're trying to remove as the owning element might have been cleared by the time this function is
2527         called and looking at the animation's class would not be sufficient to determine which animation map the animation was in.
2528         (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): New function in which the logic from
2529         animationWasRemovedFromElement() that dealt with removing animations from the list of running CSS Animations/Transitions as
2530         well as completed CSS Transitions was factored out. This allowed us to also call this function from
2531         DeclarativeAnimation::disassociateFromOwningElement().
2532         (WebCore::AnimationTimeline::elementWasRemoved): We no longer need to remove an animation as canceling it will remove it
2533         correctly when DocumentTimeline::updateAnimationsAndSendEvents() is called.
2534         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Call cancelDeclarativeAnimation() instead of the removed
2535         cancelOrRemoveDeclarativeAnimation() when a CSS Animation should be canceled.
2536         (WebCore::AnimationTimeline::ensureRunningTransitionsByProperty): Now that we correctly remove transitions from the list
2537         of running transitions once they've completed or have been canceled, we need a helper to always get a valid map of running
2538         transitions for a given element as that map can be cleared while updateCSSTransitionsForElement() is running. 
2539         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Call cancelDeclarativeAnimation() instead of the removed
2540         cancelOrRemoveDeclarativeAnimation() when a CSS Transition should be canceled. Additionally we always get the list of running
2541         transitions for a given element as it can be cleared by a prior cancelation.
2542         (WebCore::AnimationTimeline::cancelDeclarativeAnimation): New function replacing cancelOrRemoveDeclarativeAnimation() in which
2543         we call the new DeclarativeAnimation::cancelFromStyle() function on the provided animation and then remove the animation from
2544         all known lists, including the new list of all animations. We do this final part so that the animation gets re-added as if it
2545         were a new animation since canceling a declarative animation via a style change removes its declarative-ness. This guarantees
2546         that a declarative animation that is canceled through style but then resumed through the Web Animations API sorts after any
2547         declarative animation with an owning element.
2548         (WebCore::AnimationTimeline::relevantMapForAnimation): Deleted.
2549         (WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation): Deleted.
2550         * animation/AnimationTimeline.h:
2551         (WebCore::AnimationTimeline::timingModelDidChange): Deleted. This was left over in the patch where we implemented the "update
2552         animations and send events" procedure.
2553         (WebCore::AnimationTimeline::animations const): Deleted.
2554         * animation/CSSAnimation.cpp:
2555         (WebCore::CSSAnimation::create): Some refactoring to make the handling of a declarative animation's owning element part of the
2556         DeclarativeAnimation constructor.
2557         * animation/CSSTransition.cpp:
2558         (WebCore::CSSTransition::create): Some refactoring to make the handling of a declarative animation's owning element part of the
2559         DeclarativeAnimation constructor.
2560         * animation/DeclarativeAnimation.cpp:
2561         (WebCore::DeclarativeAnimation::DeclarativeAnimation):
2562         (WebCore::DeclarativeAnimation::tick): Make sure we disassociate from the animation's owning element once we transition from a
2563         relevant state to an idle state. This will catch any changes made via the Web Animations API to a declarative animation when the
2564         "update animations and send events" procedure is run.
2565         (WebCore::DeclarativeAnimation::disassociateFromOwningElement): Remove this animation from the list of declarative animations on
2566         the associated timeline and make owningElement() nullptr so that document.getAnimations() will know to sort this animation with other
2567         Web Animations created via the Web Animations API.
2568         (WebCore::DeclarativeAnimation::initialize):
2569         (WebCore::DeclarativeAnimation::cancelFromStyle): New method called from AnimationTimeline::cancelDeclarativeAnimation() which
2570         cancels the animation but also disassociates it from its owning element.
2571         (WebCore::DeclarativeAnimation::invalidateDOMEvents):
2572         (WebCore::DeclarativeAnimation::enqueueDOMEvent):
2573         * animation/DeclarativeAnimation.h:
2574         (WebCore::DeclarativeAnimation::owningElement const):
2575         (WebCore::DeclarativeAnimation::target const): Deleted.
2576         * animation/DocumentTimeline.cpp:
2577         (WebCore::compareDeclarativeAnimationOwningElementPositionsInDocumentTreeOrder): Adding a new utility used when sorting both
2578         CSS Transitions and CSS Animations by tree order when their owning element differ, with special logic for pseudo-elements.
2579         (WebCore::DocumentTimeline::getAnimations const): Filter and sort animations according to their composite order.
2580         (WebCore::DocumentTimeline::updateAnimationsAndSendEvents): Compile a list of transitions that move to a finished state to
2581         the list of completed transitions so that they may be canceled correctly in AnimationTimeline::updateCSSTransitionsForElement().
2582         (WebCore::DocumentTimeline::transitionDidComplete):
2583         * animation/DocumentTimeline.h:
2584
2585 2018-11-02  Zan Dobersek  <zdobersek@igalia.com>
2586
2587         PNGImageDecoder: report no repetition for non-animated images
2588         https://bugs.webkit.org/show_bug.cgi?id=191068
2589
2590         Reviewed by Michael Catanzaro.
2591
2592         When building with APNG support enabled, the
2593         PNGImageDecoder::repetitionCount() method until now reported  infinite
2594         repetition count for all PNG images, even the ones that were not
2595         animated. This is now changed so that no repetition is reported for
2596         non-animated images.
2597
2598         * platform/image-decoders/png/PNGImageDecoder.cpp:
2599         (WebCore::PNGImageDecoder::repetitionCount const):
2600
2601 2018-11-02  Justin Fan  <justin_fan@apple.com>
2602
2603         [WebGPU] Experimental prototype for MSL shaders
2604         https://bugs.webkit.org/show_bug.cgi?id=191084
2605
2606         Reviewed by Dean Jackson.
2607
2608         Begin implementation for WebGPUDevice and WebGPUShaderModule and associated descriptor objects.
2609
2610         Test: webgpu/webgpu-basics.html
2611         Test: webgpu/shader-modules.html
2612
2613         * CMakeLists.txt:
2614         * DerivedSources.make:
2615         * Modules/webgpu/GPUDevice.cpp: 
2616         (WebCore::GPUDevice::createShaderModule const):
2617         * Modules/webgpu/GPUDevice.h: 
2618         (WebCore::GPUDevice::platformDevice const):
2619         * Modules/webgpu/GPUShaderModule.h:
2620         (WebCore::GPUShaderModule::platformShaderModule const):
2621         * Modules/webgpu/GPUShaderModuleDescriptor.h:
2622         * Modules/webgpu/WebGPU.cpp:
2623         (WebCore::WebGPU::requestAdapter const):
2624         * Modules/webgpu/WebGPUAdapter.cpp:
2625         (WebCore::WebGPUAdapter::create):
2626         (WebCore::WebGPUAdapter::createDevice):
2627         * Modules/webgpu/WebGPUAdapter.h:
2628         * Modules/webgpu/WebGPUAdapter.idl:
2629         * Modules/webgpu/WebGPUDevice.cpp:
2630         (WebCore::WebGPUDevice::create):
2631         (WebCore::WebGPUDevice::WebGPUDevice):
2632         (WebCore::WebGPUDevice::createShaderModule const):
2633         * Modules/webgpu/WebGPUDevice.h:
2634         * Modules/webgpu/WebGPUDevice.idl:
2635         * Modules/webgpu/WebGPUShaderModule.cpp:
2636         (WebCore::WebGPUShaderModule::create):
2637         (WebCore::WebGPUShaderModule::WebGPUShaderModule):
2638         * Modules/webgpu/WebGPUShaderModule.h:
2639         * Modules/webgpu/WebGPUShaderModule.idl:
2640         * Modules/webgpu/WebGPUShaderModuleDescriptor.h:
2641         * Modules/webgpu/WebGPUShaderModuleDescriptor.idl:
2642         * Modules/webgpu/WebGPUSwapChain.cpp:
2643         (WebCore::WebGPUSwapChain::configure):
2644         * Modules/webgpu/WebGPUSwapChain.h:
2645         * Modules/webgpu/WebGPUSwapChain.idl:
2646         * Modules/webgpu/cocoa/GPUDeviceMetal.mm:
2647         (WebCore::GPUDevice::create):
2648         (WebCore::GPUDevice::GPUDevice):
2649         * Modules/webgpu/cocoa/GPUShaderModuleMetal.mm:
2650         (WebCore::GPUShaderModule::create):
2651         (WebCore::GPUShaderModule::GPUShaderModule):
2652         * Sources.txt:
2653         * SourcesCocoa.txt:
2654         * WebCore.xcodeproj/project.pbxproj:
2655         * bindings/js/WebCoreBuiltinNames.h:
2656         * platform/Logging.h:
2657
2658 2018-11-01  Jiewen Tan  <jiewen_tan@apple.com>
2659
2660         Replace CommonRandom SPI with API
2661         https://bugs.webkit.org/show_bug.cgi?id=191178
2662         <rdar://problem/45722391>
2663
2664         Reviewed by Brent Fulgham.
2665
2666         The API is available since macOS 10.10 and iOS 10, and therefore it is safe to replace
2667         all SPI usages with API.
2668
2669         No change of behaviors.
2670
2671         * crypto/CommonCryptoUtilities.h:
2672         * crypto/mac/CryptoKeyMac.cpp:
2673         (WebCore::CryptoKey::randomData):
2674         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
2675         (WebCore::createAndStoreMasterKey):
2676         (WebCore::wrapSerializedCryptoKey):
2677         * page/Crypto.cpp:
2678         (WebCore::Crypto::getRandomValues):
2679
2680 2018-11-01  Chris Dumez  <cdumez@apple.com>
2681
2682         [WebIDL] Rename CallWith=ScriptState to CallWith=ExecState
2683         https://bugs.webkit.org/show_bug.cgi?id=191162
2684
2685         Reviewed by Alex Christensen.
2686
2687         Rename CallWith=ScriptState to CallWith=ExecState in our Web IDL as ScriptState is no longer a thing
2688         in modern WebKit. The implementation is actually passed an ExecState nowadays.
2689
2690         * Modules/applepay/ApplePaySession.idl:
2691         * Modules/encryptedmedia/MediaKeyStatusMap.idl:
2692         * Modules/fetch/FetchBody.idl:
2693         * Modules/indexeddb/IDBCursor.idl:
2694         * Modules/indexeddb/IDBFactory.idl:
2695         * Modules/indexeddb/IDBIndex.idl:
2696         * Modules/indexeddb/IDBKeyRange.idl:
2697         * Modules/indexeddb/IDBObjectStore.idl:
2698         * Modules/mediastream/RTCPeerConnection.idl:
2699         * animation/Animatable.idl:
2700         * animation/KeyframeEffect.idl:
2701         * animation/KeyframeEffectReadOnly.idl:
2702         * bindings/scripts/CodeGeneratorJS.pm:
2703         (GenerateCallWith):
2704         (GenerateConstructorDefinition):
2705         * bindings/scripts/IDLAttributes.json:
2706         * bindings/scripts/test/JS/JSTestObj.cpp:
2707         (WebCore::jsTestObjWithExecStateAttributeGetter):
2708         (WebCore::jsTestObjWithExecStateAttribute):
2709         (WebCore::setJSTestObjWithExecStateAttributeSetter):
2710         (WebCore::setJSTestObjWithExecStateAttribute):
2711         (WebCore::jsTestObjWithScriptExecutionContextAndExecStateAttributeGetter):
2712         (WebCore::jsTestObjWithScriptExecutionContextAndExecStateAttribute):
2713         (WebCore::setJSTestObjWithScriptExecutionContextAndExecStateAttributeSetter):
2714         (WebCore::setJSTestObjWithScriptExecutionContextAndExecStateAttribute):
2715         (WebCore::jsTestObjWithScriptExecutionContextAndExecStateWithSpacesAttributeGetter):
2716         (WebCore::jsTestObjWithScriptExecutionContextAndExecStateWithSpacesAttribute):
2717         (WebCore::setJSTestObjWithScriptExecutionContextAndExecStateWithSpacesAttributeSetter):
2718         (WebCore::setJSTestObjWithScriptExecutionContextAndExecStateWithSpacesAttribute):
2719         (WebCore::jsTestObjPrototypeFunctionWithExecStateVoidBody):
2720         (WebCore::jsTestObjPrototypeFunctionWithExecStateVoid):
2721         (WebCore::jsTestObjPrototypeFunctionWithExecStateObjBody):
2722         (WebCore::jsTestObjPrototypeFunctionWithExecStateObj):
2723         (WebCore::jsTestObjPrototypeFunctionWithExecStateVoidExceptionBody):
2724         (WebCore::jsTestObjPrototypeFunctionWithExecStateVoidException):
2725         (WebCore::jsTestObjPrototypeFunctionWithExecStateObjExceptionBody):
2726         (WebCore::jsTestObjPrototypeFunctionWithExecStateObjException):
2727         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndExecStateBody):
2728         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndExecState):
2729         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndExecStateObjExceptionBody):
2730         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndExecStateObjException):
2731         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndExecStateWithSpacesBody):
2732         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndExecStateWithSpaces):
2733         (WebCore::jsTestObjWithScriptStateAttributeGetter): Deleted.
2734         (WebCore::jsTestObjWithScriptStateAttribute): Deleted.
2735         (WebCore::setJSTestObjWithScriptStateAttributeSetter): Deleted.
2736         (WebCore::setJSTestObjWithScriptStateAttribute): Deleted.
2737         (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttributeGetter): Deleted.
2738         (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttribute): Deleted.
2739         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeSetter): Deleted.
2740         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute): Deleted.
2741         (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttributeGetter): Deleted.
2742         (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute): Deleted.
2743         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttributeSetter): Deleted.
2744         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute): Deleted.
2745         (WebCore::jsTestObjPrototypeFunctionWithScriptStateVoidBody): Deleted.
2746         (WebCore::jsTestObjPrototypeFunctionWithScriptStateVoid): Deleted.
2747         (WebCore::jsTestObjPrototypeFunctionWithScriptStateObjBody): Deleted.
2748         (WebCore::jsTestObjPrototypeFunctionWithScriptStateObj): Deleted.
2749         (WebCore::jsTestObjPrototypeFunctionWithScriptStateVoidExceptionBody): Deleted.
2750         (WebCore::jsTestObjPrototypeFunctionWithScriptStateVoidException): Deleted.
2751         (WebCore::jsTestObjPrototypeFunctionWithScriptStateObjExceptionBody): Deleted.
2752         (WebCore::jsTestObjPrototypeFunctionWithScriptStateObjException): Deleted.
2753         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateBody): Deleted.
2754         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptState): Deleted.
2755         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjExceptionBody): Deleted.
2756         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjException): Deleted.
2757         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpacesBody): Deleted.
2758         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces): Deleted.
2759         * bindings/scripts/test/TestObj.idl:
2760         * bindings/scripts/test/TestPromiseRejectionEvent.idl:
2761         * crypto/SubtleCrypto.idl:
2762         * dom/Element.idl:
2763         * dom/ErrorEvent.idl:
2764         * dom/MessagePort.idl:
2765         * dom/MouseEvent.idl:
2766         * html/HTMLCanvasElement.idl:
2767         * html/HTMLFrameElement.idl:
2768         * html/OffscreenCanvas.idl:
2769         * html/track/DataCue.idl:
2770         * inspector/CommandLineAPIHost.idl:
2771         * page/DOMWindow.idl:
2772         * page/RemoteDOMWindow.idl:
2773         * page/WindowOrWorkerGlobalScope.idl:
2774         * testing/Internals.idl:
2775         * workers/DedicatedWorkerGlobalScope.idl:
2776         * workers/Worker.idl:
2777
2778 2018-11-01  Fujii Hironori  <Hironori.Fujii@sony.com>
2779
2780         Rename <wtf/unicode/UTF8.h> to <wtf/unicode/UTF8Conversion.h> in order to avoid conflicting with ICU's unicode/utf8.h
2781         https://bugs.webkit.org/show_bug.cgi?id=189693
2782
2783         Reviewed by Yusuke Suzuki.
2784
2785         No new tests because there's no behaviro changes.
2786
2787         * platform/SharedBuffer.cpp: Replaced <wtf/unicode/UTF8.h> with <wtf/unicode/UTF8Conversion.h>.
2788         * xml/XSLTProcessorLibxslt.cpp: Ditto.
2789         * xml/parser/XMLDocumentParserLibxml2.cpp: Ditto.
2790
2791 2018-11-01  John Wilander  <wilander@apple.com>
2792
2793         In WebCore::ResourceLoadObserver, use document.sessionID().isEphemeral() when possible and check for page existence when not
2794         https://bugs.webkit.org/show_bug.cgi?id=191119
2795         <rdar://problem/44176965>
2796
2797         Reviewed by Chris Dumez.
2798
2799         New API test added.
2800
2801         * loader/ResourceLoadObserver.cpp:
2802         (WebCore::ResourceLoadObserver::logSubresourceLoading):
2803         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2804
2805 2018-11-01  Devin Rousso  <drousso@apple.com>
2806
2807         Web Inspector: Network: remove unnecessary media event tracking
2808         https://bugs.webkit.org/show_bug.cgi?id=191174
2809
2810         Reviewed by Joseph Pecoraro.
2811
2812         No new tests, as this simply removes some event listeners for the WebInspector frontend.
2813
2814         * inspector/agents/InspectorDOMAgent.cpp:
2815         (WebCore::InspectorDOMAgent::addEventListenersToNode):
2816
2817 2018-11-01  Chris Dumez  <cdumez@apple.com>
2818
2819         Location object sans browsing context
2820         https://bugs.webkit.org/show_bug.cgi?id=191060
2821
2822         Reviewed by Geoffrey Garen.
2823
2824         As per https://github.com/whatwg/html/pull/4076, a Location object's URL should be "about:blank" when
2825         it does not have a browsing context (Frame), not "".
2826
2827         No new tests, rebaselined existing tests.
2828
2829         * page/Location.cpp:
2830         (WebCore::Location::url const):
2831         (WebCore::Location::href const):
2832         (WebCore::Location::protocol const):
2833         (WebCore::Location::host const):
2834         (WebCore::Location::hostname const):
2835         (WebCore::Location::port const):
2836         (WebCore::Location::pathname const):
2837         (WebCore::Location::search const):
2838         (WebCore::Location::origin const):
2839         (WebCore::Location::hash const):
2840
2841 2018-11-01  Sihui Liu  <sihui_liu@apple.com>
2842
2843         Add a storage limit for IndexedDB
2844         https://bugs.webkit.org/show_bug.cgi?id=190598
2845         <rdar://problem/44654715>
2846
2847         Reviewed by Chris Dumez.
2848
2849         Set a storage limit in IndexedDB for each pair of mainFrameOrigin and openingOrigin. 
2850         IndexedDB will return a QuotaExceededError if limit is reached.
2851
2852         If the size of free disk space is over 1 GB, the default limit is 500 MB; otherwise it is 
2853         half the free disk space.
2854
2855         Test: storage/indexeddb/storage-limit.html
2856
2857         * Modules/indexeddb/server/IDBBackingStore.h:
2858         * Modules/indexeddb/server/IDBServer.cpp:
2859         (WebCore::IDBServer::IDBServer::createBackingStore):
2860         (WebCore::IDBServer::IDBServer::setPerOriginQuota):
2861         * Modules/indexeddb/server/IDBServer.h:
2862         (WebCore::IDBServer::IDBServer::perOriginQuota const):
2863         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
2864         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2865         (WebCore::IDBServer::SQLiteIDBBackingStore::SQLiteIDBBackingStore):
2866         (WebCore::IDBServer::SQLiteIDBBackingStore::quotaForOrigin const):
2867         (WebCore::IDBServer::SQLiteIDBBackingStore::maximumSize const):
2868         (WebCore::IDBServer::SQLiteIDBBackingStore::beginTransaction):
2869         (WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore):
2870         (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore):
2871         (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex):
2872         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexRecord):
2873         (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex):
2874         (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord):
2875         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedSetKeyGeneratorValue):
2876         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
2877         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2878         (WebCore::IDBServer::UniqueIDBDatabase::setQuota):
2879         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2880
2881 2018-11-01  Justin Michaud  <justin_michaud@apple.com>
2882
2883         CSS Custom Properties API Should Support syntax="*" and "<length>", and handle cycles properly
2884         https://bugs.webkit.org/show_bug.cgi?id=191042
2885
2886         Reviewed by Antti Koivisto.
2887
2888         Refactor code so that:
2889         - All properties applied in StyleResolver::applyMatchedProperties are only applied once. 
2890         - Custom properties are only resolved once, in StyleResolver, when they are applied to the RenderStyle. They were previously resolved
2891           every time they were referenced, and again in RenderStyle.
2892         - The font-size property is applied after its variable references, but before custom properties that depend on it.
2893         - Cycles are detected at the same time as resolution.
2894         - MutableStyleProperties' custom properties cannot be set from Javascript or WebKitLegacy if they do not parse for the property's type.
2895           If they contain var(--...) references, however, then they can be set because we cannot check if the references are valid from setProperty.
2896           This behaviour matches chrome, but is not documented in the spec. 
2897         - Custom property values have more explicit resolved/unresolved state.
2898         - RenderStyle only ever holds resolved custom properties, and StyleResolver::CascadedProperties only holds unresolved properties.
2899
2900         Tests: css-custom-properties-api/crash.html
2901                css-custom-properties-api/cycles.html
2902                css-custom-properties-api/inline.html
2903
2904         * css/CSSComputedStyleDeclaration.cpp:
2905         (WebCore::ComputedStyleExtractor::customPropertyValue):
2906         * css/CSSCustomPropertyValue.cpp:
2907         (WebCore::CSSCustomPropertyValue::equals const):
2908         (WebCore::CSSCustomPropertyValue::customCSSText const):
2909         (WebCore::CSSCustomPropertyValue::tokens const):
2910         (WebCore::CSSCustomPropertyValue::checkVariablesForCycles const): Deleted.
2911         (WebCore::CSSCustomPropertyValue::resolveVariableReferences const): Deleted.
2912         (WebCore::CSSCustomPropertyValue::setResolvedTypedValue): Deleted.
2913         * css/CSSCustomPropertyValue.h:
2914         * css/CSSRegisteredCustomProperty.cpp:
2915         (WebCore::CSSRegisteredCustomProperty::CSSRegisteredCustomProperty):
2916         * css/CSSRegisteredCustomProperty.h:
2917         * css/CSSVariableData.cpp:
2918         (WebCore::CSSVariableData::CSSVariableData):
2919         (WebCore::CSSVariableData::consumeAndUpdateTokens): Deleted.
2920         (WebCore::CSSVariableData::checkVariablesForCycles const): Deleted.
2921         (WebCore::CSSVariableData::checkVariablesForCyclesWithRange const): Deleted.
2922         (WebCore::CSSVariableData::resolveVariableFallback const): Deleted.
2923         (WebCore::CSSVariableData::resolveVariableReference const): Deleted.
2924         (WebCore::CSSVariableData::resolveVariableReferences const): Deleted.
2925         (WebCore::CSSVariableData::resolveTokenRange const): Deleted.
2926         * css/CSSVariableData.h:
2927         (WebCore::CSSVariableData::create):
2928         (WebCore::CSSVariableData::createResolved): Deleted.
2929         (WebCore::CSSVariableData::needsVariableResolution const): Deleted.
2930         (WebCore::CSSVariableData::CSSVariableData): Deleted.
2931         * css/CSSVariableReferenceValue.cpp:
2932         (WebCore::resolveVariableFallback):
2933         (WebCore::resolveVariableReference):
2934         (WebCore::resolveTokenRange):
2935         (WebCore::CSSVariableReferenceValue::resolveVariableReferences const):
2936         (WebCore::CSSVariableReferenceValue::checkVariablesForCycles const): Deleted.
2937         * css/CSSVariableReferenceValue.h:
2938         (WebCore::CSSVariableReferenceValue::create):
2939         (WebCore::CSSVariableReferenceValue::equals const):
2940         (WebCore::CSSVariableReferenceValue::variableDataValue const): Deleted.
2941         * css/DOMCSSRegisterCustomProperty.cpp:
2942         (WebCore::DOMCSSRegisterCustomProperty::registerProperty):
2943         * css/PropertySetCSSStyleDeclaration.cpp:
2944         (WebCore::PropertySetCSSStyleDeclaration::setProperty):
2945         * css/StyleBuilderCustom.h:
2946         (WebCore::StyleBuilderCustom::applyInitialCustomProperty):
2947         (WebCore::StyleBuilderCustom::applyValueCustomProperty):
2948         * css/StyleProperties.cpp:
2949         (WebCore::MutableStyleProperties::setCustomProperty):
2950         * css/StyleProperties.h:
2951         * css/StyleResolver.cpp:
2952         (WebCore::StyleResolver::State::setStyle):
2953         (WebCore::StyleResolver::styleForKeyframe):
2954         (WebCore::StyleResolver::styleForPage):
2955         (WebCore::StyleResolver::applyMatchedProperties):
2956         (WebCore::StyleResolver::applyPropertyToCurrentStyle):
2957         (WebCore::StyleResolver::applyProperty):
2958         (WebCore::StyleResolver::resolvedVariableValue const):
2959         (WebCore::StyleResolver::CascadedProperties::applyDeferredProperties):
2960         (WebCore::StyleResolver::CascadedProperties::Property::apply):
2961         (WebCore::StyleResolver::applyCascadedCustomProperty):
2962         (WebCore::StyleResolver::applyCascadedProperties):
2963         * css/StyleResolver.h:
2964         * css/parser/CSSParser.cpp:
2965         (WebCore::CSSParser::parseValueWithVariableReferences):
2966         * css/parser/CSSParser.h:
2967         * css/parser/CSSPropertyParser.cpp:
2968         (WebCore::CSSPropertyParser::CSSPropertyParser):
2969         (WebCore::CSSPropertyParser::canParseTypedCustomPropertyValue):
2970         (WebCore::CSSPropertyParser::parseTypedCustomPropertyValue):
2971         (WebCore::CSSPropertyParser::collectParsedCustomPropertyValueDependencies):
2972         (WebCore::CSSPropertyParser::parseValueStart):
2973         (WebCore::CSSPropertyParser::parseSingleValue):
2974         * css/parser/CSSPropertyParser.h:
2975         * css/parser/CSSVariableParser.cpp:
2976         (WebCore::CSSVariableParser::parseDeclarationValue):
2977         * dom/ConstantPropertyMap.cpp:
2978         (WebCore::ConstantPropertyMap::setValueForProperty):
2979         (WebCore::variableDataForPositivePixelLength):
2980         (WebCore::variableDataForPositiveDuration):
2981         * rendering/style/RenderStyle.cpp:
2982         (WebCore::RenderStyle::checkVariablesInCustomProperties): Deleted.
2983         * rendering/style/RenderStyle.h:
2984         (WebCore::RenderStyle::setInheritedCustomPropertyValue):
2985         (WebCore::RenderStyle::setNonInheritedCustomPropertyValue):
2986         * rendering/style/StyleCustomPropertyData.h:
2987         (WebCore::StyleCustomPropertyData::operator== const):
2988         (WebCore::StyleCustomPropertyData::setCustomPropertyValue):
2989         (WebCore::StyleCustomPropertyData::StyleCustomPropertyData):
2990         (): Deleted.
2991
2992 2018-11-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
2993
2994         [CG] Adopt CG SPI for non-even cornered rounded rects
2995         https://bugs.webkit.org/show_bug.cgi?id=190155
2996
2997         Reviewed by Simon Fraser.
2998
2999         Instead of creating bezier curves for the non-even corners of the rounded
3000         rects, we should use the optimized SPI provided by CG.
3001
3002         * platform/graphics/cg/PathCG.cpp:
3003         (WebCore::Path::platformAddPathForRoundedRect):
3004
3005 2018-11-01  Youenn Fablet  <youenn@apple.com>
3006
3007         RTCTrackEvent.streams should be SameObject
3008         https://bugs.webkit.org/show_bug.cgi?id=191130
3009
3010         Reviewed by Eric Carlson.
3011
3012         Mimick SameObject using CachedAttribute.
3013         Covered by rebased test.
3014
3015         * Modules/mediastream/RTCTrackEvent.idl:
3016
3017 2018-10-31  Zalan Bujtas  <zalan@apple.com>
3018
3019         [LFC][IFC] Add support for inline-block elements.
3020         https://bugs.webkit.org/show_bug.cgi?id=191143
3021
3022         Reviewed by Antti Koivisto.
3023
3024         This patch add support for laying out non-shrink-to-width inline-block elements.
3025
3026         Test: fast/inline/simple-inline-block.html
3027
3028         * layout/FormattingContext.h:
3029         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
3030         * layout/FormattingContextGeometry.cpp:
3031         (WebCore::Layout::contentHeightForFormattingContextRoot):
3032         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
3033         * layout/inlineformatting/InlineFormattingContext.cpp:
3034         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
3035         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
3036         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
3037         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin):
3038         * layout/layouttree/LayoutInlineContainer.cpp:
3039         (WebCore::Layout::InlineContainer::establishesInlineFormattingContext const):
3040         * layout/layouttree/LayoutInlineContainer.h:
3041         * layout/layouttree/LayoutTreeBuilder.cpp:
3042         (WebCore::Layout::TreeBuilder::createSubTree):
3043
3044 2018-11-01  Claudio Saavedra  <csaavedra@igalia.com>
3045
3046         Fix build with VIDEO and WEB_AUDIO disabled
3047         https://bugs.webkit.org/show_bug.cgi?id=191147
3048
3049         Reviewed by Philippe Normand.
3050
3051         Supported or not, there were a few build fixes needed
3052         to be able to build WebKit with media disabled. Mostly
3053         low-hanging fruits.
3054
3055         * Modules/mediasource/VideoPlaybackQuality.cpp:
3056         * Modules/mediasource/VideoPlaybackQuality.h:
3057         * Modules/mediasource/VideoPlaybackQuality.idl:
3058         * dom/Document.cpp:
3059         (WebCore::Document::dispatchFullScreenChangeOrErrorEvent):
3060         * inspector/agents/InspectorDOMAgent.cpp:
3061         (WebCore::InspectorDOMAgent::InspectorDOMAgent):
3062         (WebCore::InspectorDOMAgent::didCreateFrontendAndBackend):
3063         * inspector/agents/InspectorDOMAgent.h:
3064         * rendering/RenderThemeGtk.cpp:
3065
3066 2018-10-31  Devin Rousso  <drousso@apple.com>
3067
3068         Web Inspector: Canvas: create a setting for auto-recording newly created contexts
3069         https://bugs.webkit.org/show_bug.cgi?id=190856
3070
3071         Reviewed by Brian Burg.
3072
3073         Test: inspector/canvas/setRecordingAutoCaptureFrameCount.html
3074
3075         * inspector/agents/InspectorCanvasAgent.h:
3076         (WebCore::InspectorCanvasAgent::RecordingOptions): Added.
3077         * inspector/agents/InspectorCanvasAgent.cpp:
3078         (WebCore::InspectorCanvasAgent::enable):
3079         (WebCore::InspectorCanvasAgent::disable):
3080         (WebCore::InspectorCanvasAgent::setRecordingAutoCaptureFrameCount): Added.
3081         (WebCore::InspectorCanvasAgent::startRecording):
3082         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
3083         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
3084         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
3085         (WebCore::InspectorCanvasAgent::startRecording): Added.
3086         Unify the different functions that are able to start a recording to use a single path.
3087
3088         * inspector/InspectorCanvas.h:
3089         * inspector/InspectorCanvas.cpp:
3090         (WebCore::InspectorCanvas::resetRecordingData):
3091         (WebCore::InspectorCanvas::recordAction):
3092         (WebCore::InspectorCanvas::setFrameCount): Added.
3093         (WebCore::InspectorCanvas::overFrameCount const): Added.
3094
3095 2018-10-31  Devin Rousso  <drousso@apple.com>
3096
3097         Web Inspector: display low-power enter/exit events in Timelines and Network node waterfalls
3098         https://bugs.webkit.org/show_bug.cgi?id=190641
3099         <rdar://problem/45319049>
3100
3101         Reviewed by Joseph Pecoraro.
3102
3103         No new tests, as low power mode is indeterminate. Should not affect functionality.
3104
3105         * inspector/agents/InspectorDOMAgent.h:
3106         * inspector/agents/InspectorDOMAgent.cpp:
3107         (WebCore::InspectorDOMAgent::InspectorDOMAgent):
3108         (WebCore::InspectorDOMAgent::addEventListenersToNode):
3109         (WebCore::InspectorDOMAgent::mediaMetricsTimerFired): Added.
3110
3111 2018-10-31  Alicia Boya García  <aboya@igalia.com>
3112
3113         [MSE] Use tolerance when growing the coded frame group
3114         https://bugs.webkit.org/show_bug.cgi?id=190085
3115
3116         Reviewed by Jer Noble.
3117
3118         Test: media/media-source/media-source-append-acb-tolerance.html
3119
3120         This patch introduces a millisecond tolerance in the range of
3121         potential frames that should be erased frame from the track buffer
3122         when the coded frame group is growing.
3123
3124         This is necessary because some files have imprecise overlapping
3125         timestamps (especially WebM files).
3126
3127         This fixes a stall when seeking back and forth in YouTube with WebM
3128         video.
3129
3130         A test case simulating the problem with video/mock using timestamps
3131         similar to those of a typical 30 fps WebM video is also added.
3132
3133         * Modules/mediasource/SourceBuffer.cpp:
3134         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
3135
3136 2018-10-31  Jer Noble  <jer.noble@apple.com>
3137
3138         MediaSource.isTypeSupported('video/mp4; codecs="hvc1.1.6.L60.B0') is inproperly rejected
3139         https://bugs.webkit.org/show_bug.cgi?id=191129
3140
3141         Reviewed by Eric Carlson.
3142
3143         Test: media/media-source/media-source-istypesupported-case-sensitive.html
3144
3145         According to RFC 2045: "All media type values, subtype values, and parameter names as
3146         defined are case-insensitive. However, parameter values are case-sensitive unless otherwise
3147         specified for the specific parameter." So rather than fold the entire ContentType into lower-
3148         case, leave the original string intact and require clients to enforce case-insensitivity.
3149
3150         * Modules/mediasource/MediaSource.cpp:
3151         (WebCore::MediaSource::isTypeSupported):
3152
3153 2018-10-31  Jer Noble  <jer.noble@apple.com>
3154
3155         Unreivewed build fix; fix the non-HAVE_AVCONTENTKEYSESSION builds by adding guards around
3156         access of m_cdmInstance.
3157
3158         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3159         (WebCore::MediaPlayerPrivateAVFoundationObjC::attemptToDecryptWithInstance):
3160
3161 2018-10-31  YUHAN WU  <yuhan_wu@apple.com>
3162
3163         MediaRecorder should fire dataavailable event when all tracks are ended and stop() is called
3164         https://bugs.webkit.org/show_bug.cgi?id=190778
3165         <rdar://problem/45703574>
3166
3167         Reviewed by Youenn Fablet.
3168
3169         Add a include to fix the unified build error.
3170
3171         No tests since no new functionality.
3172
3173         * Modules/webgpu/WebGPUDevice.cpp:
3174
3175 2018-10-26  Jer Noble  <jer.noble@apple.com>
3176
3177         [EME][Cocoa] Cannot play unmuxed video and audio fMP4 streams encrypted with different keys via MSE
3178         https://bugs.webkit.org/show_bug.cgi?id=190946
3179
3180         Reviewed by Eric Carlson.
3181
3182         Use separate AVContentKeySessions per CDMInstanceSession (rather than one AVContentKeySession per
3183         CDMInstance).
3184
3185         - Add a mechanism for sending a message out from platform/CDMInstance to MediaKeySession without
3186           requiring MediaKeySession to send a callback first.
3187
3188         - Move all the AVContentKeySession delegate methods from CDMInstanceFairPlayStreamingAVFObjC to
3189           CDMInstanceSessionFairPlayStreamingAVFObjC.
3190
3191         - Add a mechanism for requesting the correct CDMInstanceSession for a given KeyID.
3192
3193         - Support key renewal through a "renew" message.
3194
3195         - Remember the keyID in SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID()
3196           and ask for the correct CDMInstanceSession for that keyID in attemptToDecrypt().
3197
3198         - Pass the CDMInstance down from MediaPlayerPrivateMediaSourceAVFObjC -> SourceBufferPrivateAVFObjC.
3199
3200         * Modules/encryptedmedia/MediaKeySession.cpp:
3201         (WebCore::MediaKeySession::sendMessage):
3202         * Modules/encryptedmedia/MediaKeySession.h:
3203         * platform/encryptedmedia/CDMInstanceSession.h:
3204         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
3205         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
3206         (-[WebCoreFPSContentKeySessionDelegate initWithParent:]):
3207         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::initializeWithConfiguration):
3208         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::createSession):
3209         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
3210         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionForKeyIDs const):
3211         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::CDMInstanceSessionFairPlayStreamingAVFObjC):
3212         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::~CDMInstanceSessionFairPlayStreamingAVFObjC):
3213         (WebCore::keyIDsForRequest):
3214         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyIDs):
3215         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestLicense):
3216         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
3217         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::closeSession):
3218         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData):
3219         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest):
3220         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRenewingRequest):
3221         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didFailToProvideRequest):
3222         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestDidSucceed):
3223         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::nextRequest):
3224         (WebCore::requestStatusToCDMStatus):
3225         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const):
3226         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
3227         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::ensureSession):
3228         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3229         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3230         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
3231         (WebCore::MediaPlayerPrivateAVFoundationObjC::cdmInstanceAttached):
3232         (WebCore::MediaPlayerPrivateAVFoundationObjC::cdmInstanceDetached):
3233         (WebCore::MediaPlayerPrivateAVFoundationObjC::attemptToDecryptWithInstance):
3234         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3235         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3236         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
3237         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
3238         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceDetached):
3239         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::attemptToDecryptWithInstance):
3240         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitingForKey const):
3241         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
3242         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
3243         (WebCore::MediaSourcePrivateAVFObjC::addSourceBuffer):
3244         (WebCore::MediaSourcePrivateAVFObjC::cdmInstanceAttached):
3245         (WebCore::MediaSourcePrivateAVFObjC::cdmInstanceDetached):
3246         (WebCore::MediaSourcePrivateAVFObjC::attemptToDecryptWithInstance):
3247         (WebCore::MediaSourcePrivateAVFObjC::waitingForKey const):
3248         (WebCore::MediaSourcePrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
3249         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
3250         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3251         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
3252         (WebCore::SourceBufferPrivateAVFObjC::destroyParser):
3253         (WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
3254         (WebCore::SourceBufferPrivateAVFObjC::attemptToDecrypt):
3255         (WebCore::SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
3256
3257 2018-10-31  Zach Li  <zacharyli323@gmail.com>
3258
3259         Add credit card autofill button
3260         https://bugs.webkit.org/show_bug.cgi?id=191051
3261         <rdar://problem/45657011>
3262
3263         Reviewed by Wenson Hsieh.
3264
3265         Test: fast/forms/auto-fill-button/input-credit-card-auto-fill-button.html
3266
3267         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3268         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3269         * css/html.css:
3270         (input::-webkit-credit-card-auto-fill-button):
3271         Add credit card autofill button.
3272         (input::-webkit-credit-card-auto-fill-button:hover):
3273         (input::-webkit-credit-card-auto-fill-button:active):
3274         * html/HTMLTextFormControlElement.h:
3275         * html/TextFieldInputType.cpp:
3276         (WebCore::autoFillButtonTypeToAccessibilityLabel):
3277         (WebCore::autoFillButtonTypeToAutoFillButtonText):
3278         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
3279         (WebCore::isAutoFillButtonTypeChanged):
3280         * platform/LocalizedStrings.cpp:
3281         (WebCore::AXAutoFillCreditCardLabel):
3282         * platform/LocalizedStrings.h:
3283         * testing/Internals.cpp:
3284         (WebCore::toAutoFillButtonType):
3285         (WebCore::toInternalsAutoFillButtonType):
3286         * testing/Internals.h:
3287         * testing/Internals.idl:
3288
3289 2018-10-31  Eric Carlson  <eric.carlson@apple.com>
3290
3291         [MediaStream] Don't reveal device IDs until the user has granted permission to capture
3292         https://bugs.webkit.org/show_bug.cgi?id=191112
3293         <rdar://problem/45699932>
3294
3295         Reviewed by Youenn Fablet.
3296
3297         No new tests, existing tests updated.
3298
3299         * Modules/mediastream/MediaDevicesRequest.cpp:
3300         (WebCore::MediaDevicesRequest::start): Don't reveal device ID or group ID until the user 
3301         has granted permssion to capture.
3302
3303 2018-10-31  YUHAN WU  <yuhan_wu@apple.com>
3304
3305         MediaRecorder should fire dataavailable event when all tracks are ended and stop() is called
3306         https://bugs.webkit.org/show_bug.cgi?id=190778
3307
3308         Reviewed by Youenn Fablet.
3309
3310         Implement JavaScript dispatch event dataavailable and JavaScript exposed method stop().
3311         Implement a mock string as the output buffer of MediaRecorder.
3312         Remove the declaration of timecode in BlobEvent since it has not been implemented in MediaRecorder and MediaRecorderPrivate. 
3313
3314         Tests: http/wpt/mediarecorder/MediaRecorder-dataavailable.html
3315                http/wpt/mediarecorder/MediaRecorder-mock-dataavailable.html
3316                imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-destroy-script-execution.html
3317                imported/w3c/web-platform-tests/mediacapture-record/support/MediaRecorder-iframe.html
3318
3319         * CMakeLists.txt:
3320         * Modules/mediarecorder/BlobEvent.cpp: Added.
3321         (WebCore::BlobEvent::create):
3322         (WebCore::BlobEvent::BlobEvent):
3323         (WebCore::BlobEvent::eventInterface const):
3324         * Modules/mediarecorder/BlobEvent.h:
3325         * Modules/mediarecorder/BlobEvent.idl:
3326         * Modules/mediarecorder/MediaRecorder.cpp:
3327         (WebCore::MediaRecorder::MediaRecorder):
3328         (WebCore::MediaRecorder::~MediaRecorder):
3329         (WebCore::MediaRecorder::stop):
3330         (WebCore::MediaRecorder::startRecording):
3331         (WebCore::MediaRecorder::stopRecording):
3332         (WebCore::MediaRecorder::stopRecordingInternal):
3333         (WebCore::MediaRecorder::didAddOrRemoveTrack):
3334         (WebCore::MediaRecorder::trackEnded):
3335         (WebCore::MediaRecorder::sampleBufferUpdated):
3336         (WebCore::MediaRecorder::audioSamplesAvailable):
3337         (WebCore::MediaRecorder::scheduleDeferredTask):
3338         * Modules/mediarecorder/MediaRecorder.h:
3339         * Modules/mediarecorder/MediaRecorder.idl:
3340         * Sources.txt:
3341         * WebCore.xcodeproj/project.pbxproj:
3342         * dom/EventNames.h:
3343         * dom/EventNames.in:
3344         * platform/mediarecorder/MediaRecorderPrivate.h: Added.
3345         * platform/mediarecorder/MediaRecorderPrivateMock.cpp: Added.
3346         (WebCore::MediaRecorderPrivateMock::sampleBufferUpdated):
3347         (WebCore::MediaRecorderPrivateMock::audioSamplesAvailable):
3348         (WebCore::MediaRecorderPrivateMock::generateMockString):
3349         (WebCore::MediaRecorderPrivateMock::fetchData):
3350         * platform/mediarecorder/MediaRecorderPrivateMock.h: Added.
3351
3352 2018-10-31  Claudio Saavedra  <csaavedra@igalia.com>
3353
3354         [GTK][WPE] Remaining topPrivatelyControlledDomain() fixes
3355         https://bugs.webkit.org/show_bug.cgi?id=191110
3356
3357         Reviewed by Michael Catanzaro.
3358
3359         Covered by existing tests.
3360
3361         Turns out that this method is expected to reject domains that
3362         are not registrable. Also sync with the Mac implementation in
3363         that given domains that are not all ASCII should be returned
3364         back as is. This fixes the remaining Public Suffix API tests.
3365
3366         * platform/soup/PublicSuffixSoup.cpp:
3367         (WebCore::topPrivatelyControlledDomain):
3368
3369 2018-10-31  Antti Koivisto  <antti@apple.com>
3370
3371         Remove LayerFlushScheduler
3372         https://bugs.webkit.org/show_bug.cgi?id=191103
3373
3374         Reviewed by Anders Carlsson.
3375
3376         It is only used in WK1.
3377
3378         * SourcesCocoa.txt:
3379         * WebCore.xcodeproj/project.pbxproj:
3380         * platform/graphics/ca/LayerFlushScheduler.cpp: Removed.
3381         * platform/graphics/ca/LayerFlushScheduler.h: Removed.
3382         * platform/graphics/ca/LayerFlushSchedulerClient.h: Removed.
3383         * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp: Removed.
3384
3385 2018-10-31  Zalan Bujtas  <zalan@apple.com>
3386
3387         Missing from r237634
3388
3389         * layout/inlineformatting/InlineFormattingState.cpp:
3390         (WebCore::Layout::InlineFormattingState::formattingContext):
3391
3392 2018-10-31  Zalan Bujtas  <zalan@apple.com>
3393
3394         [LFC] Do not pass LayoutState& to compute* and layout* functions
3395         https://bugs.webkit.org/show_bug.cgi?id=191100
3396
3397         Reviewed by Antti Koivisto.
3398
3399         Reduce noise by removing LayoutState& parameter where possible.
3400
3401         * layout/FormattingContext.cpp:
3402         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
3403         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
3404         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
3405         (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const):
3406         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
3407         (WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const):
3408         * layout/FormattingContext.h:
3409         * layout/FormattingContextGeometry.cpp:
3410         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
3411         * layout/LayoutFormattingState.cpp:
3412         (WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
3413         * layout/blockformatting/BlockFormattingContext.cpp:
3414         (WebCore::Layout::BlockFormattingContext::layout const):
3415         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
3416         (WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
3417         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTop const):
3418         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTopForAncestors const):
3419         (WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForFormattingRootIfNeeded const):
3420         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
3421         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
3422         (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const):
3423         (WebCore::Layout::BlockFormattingContext::computeInFlowPositionedPosition const):
3424         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
3425         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
3426         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
3427         * layout/blockformatting/BlockFormattingContext.h:
3428         * layout/inlineformatting/InlineFormattingContext.cpp:
3429         (WebCore::Layout::InlineFormattingContext::layout const):
3430         (WebCore::Layout::InlineFormattingContext::initializeNewLine const):
3431         (WebCore::Layout::InlineFormattingContext::layoutInlineContent const):
3432         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
3433         (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForInlineBox const):
3434         (WebCore::Layout::InlineFormattingContext::computeFloatPosition const):
3435         (WebCore::Layout::InlineFormattingContext::computeStaticPosition const):
3436         (WebCore::Layout::InlineFormattingContext::computeInFlowPositionedPosition const):
3437         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
3438         * layout/inlineformatting/InlineFormattingContext.h:
3439
3440 2018-10-31  Zalan Bujtas  <zalan@apple.com>
3441
3442         [LFC] FormattingContext class should take FormattingState&
3443         https://bugs.webkit.org/show_bug.cgi?id=191099
3444
3445         Reviewed by Antti Koivisto.
3446
3447         This is in preparation for not passing LayoutState& into every layout functions.
3448         FormattingContext has FormattingState now and LayoutState can be acquired through FormattingState.
3449         LayoutState <- FormattingState <- FormattingContext
3450
3451         * layout/FormattingContext.cpp:
3452         (WebCore::Layout::FormattingContext::FormattingContext):
3453         (WebCore::Layout::FormattingContext::formattingState const):
3454         (WebCore::Layout::FormattingContext::layoutState const):
3455         * layout/FormattingContext.h:
3456         * layout/FormattingState.cpp:
3457         (WebCore::Layout::FormattingState::FormattingState):
3458         * layout/FormattingState.h:
3459         (WebCore::Layout::FormattingState::layoutState const):
3460         * layout/LayoutFormattingState.h:
3461         * layout/blockformatting/BlockFormattingContext.cpp:
3462         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
3463         * layout/blockformatting/BlockFormattingContext.h:
3464         * layout/blockformatting/BlockFormattingState.cpp:
3465         (WebCore::Layout::BlockFormattingState::BlockFormattingState):
3466         (WebCore::Layout::BlockFormattingState::formattingContext):
3467         (WebCore::Layout::BlockFormattingState::formattingContext const): Deleted.
3468         * layout/blockformatting/BlockFormattingState.h:
3469         * layout/inlineformatting/InlineFormattingContext.cpp:
3470         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
3471         * layout/inlineformatting/InlineFormattingContext.h:
3472         * layout/inlineformatting/InlineFormattingState.cpp:
3473         (WebCore::Layout::InlineFormattingState::InlineFormattingState):
3474         (WebCore::Layout::InlineFormattingState::formattingContext):
3475         (WebCore::Layout::InlineFormattingState::formattingContext const): Deleted.
3476         * layout/inlineformatting/InlineFormattingState.h:
3477
3478 2018-10-31  Zalan Bujtas  <zalan@apple.com>
3479
3480         [LFC] The *FormattingState class should provide the *FormattingContext.
3481         https://bugs.webkit.org/show_bug.cgi?id=191089
3482
3483         Reviewed by Antti Koivisto.
3484
3485         BlockFormattingState provides the BlockFormattingContext object, while InlineFormattingState provides the InlineFormattingContext.
3486
3487         * layout/FormattingContext.cpp:
3488         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
3489         * layout/FormattingState.h:
3490         * layout/LayoutFormattingState.cpp:
3491         (WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
3492         (WebCore::Layout::LayoutState::formattingContext const): Deleted.
3493         * layout/LayoutFormattingState.h:
3494         * layout/blockformatting/BlockFormattingContext.cpp:
3495         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
3496         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
3497         * layout/blockformatting/BlockFormattingState.cpp:
3498         (WebCore::Layout::BlockFormattingState::formattingContext const):
3499         * layout/blockformatting/BlockFormattingState.h:
3500         * layout/inlineformatting/InlineFormattingContext.cpp:
3501         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
3502         * layout/inlineformatting/InlineFormattingState.cpp:
3503         (WebCore::Layout::InlineFormattingState::formattingContext const):
3504         * layout/inlineformatting/InlineFormattingState.h:
3505
3506 2018-10-31  Zalan Bujtas  <zalan@apple.com>
3507
3508         [LFC] Rename LayoutContext to LayoutState
3509         https://bugs.webkit.org/show_bug.cgi?id=191080
3510
3511         Reviewed by Antti Koivisto.
3512
3513         LayoutContext naming was a bit misleading since none of the other *FormattingContext classes (BlockFormattingContext etc) hold states.
3514         (LayoutContext.cpp -> LayoutFormattingState.cpp because LayoutState.cpp name is already taken.)
3515
3516         Now the current state is as follows:
3517
3518         LayoutState has
3519         1. Layout tree
3520         2. State content for each formatting subtrees
3521         3. Display tree
3522
3523         * Sources.txt:
3524         * WebCore.xcodeproj/project.pbxproj:
3525         * layout/FormattingContext.cpp:
3526         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
3527         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
3528         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
3529         (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const):
3530         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
3531         (WebCore::Layout::FormattingContext::mapBoxToAncestor):
3532         (WebCore::Layout::FormattingContext::mapTopLeftToAncestor):
3533         (WebCore::Layout::FormattingContext::mapCoordinateToAncestor):
3534         (WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const):
3535         * layout/FormattingContext.h:
3536         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
3537         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
3538         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
3539         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
3540         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
3541         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
3542         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
3543         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
3544         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
3545         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
3546         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
3547         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
3548         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
3549         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
3550         * layout/FormattingContextGeometry.cpp:
3551         (WebCore::Layout::contentHeightForFormattingContextRoot):
3552         (WebCore::Layout::FormattingContext::Geometry::computedMaxHeight):
3553         (WebCore::Layout::FormattingContext::Geometry::computedMinHeight):
3554         (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned):
3555         (WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned):
3556         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
3557         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
3558         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
3559         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
3560         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
3561         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
3562         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
3563         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
3564         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
3565         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
3566         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
3567         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
3568         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
3569         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
3570         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
3571         (WebCore::Layout::FormattingContext::Geometry::computedBorder):
3572         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
3573         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
3574         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
3575         * layout/FormattingState.cpp:
3576         (WebCore::Layout::FormattingState::FormattingState):
3577         * layout/FormattingState.h:
3578         (WebCore::Layout::FormattingState::setInstrinsicWidthConstraints):
3579         (WebCore::Layout::FormattingState::instrinsicWidthConstraints const):
3580         * layout/LayoutFormattingState.cpp: Renamed from Source/WebCore/layout/LayoutContext.cpp.
3581         (WebCore::Layout::LayoutState::LayoutState):
3582         (WebCore::Layout::LayoutState::initializeRoot):
3583         (WebCore::Layout::LayoutState::updateLayout):
3584         (WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
3585         (WebCore::Layout::LayoutState::displayBoxForLayoutBox const):
3586         (WebCore::Layout::LayoutState::styleChanged):
3587         (WebCore::Layout::LayoutState::markNeedsUpdate):
3588         (WebCore::Layout::LayoutState::formattingStateForBox const):
3589         (WebCore::Layout::LayoutState::establishedFormattingState const):
3590         (WebCore::Layout::LayoutState::createFormattingStateForFormattingRootIfNeeded):
3591         (WebCore::Layout::LayoutState::formattingContext const):
3592         * layout/LayoutFormattingState.h: Renamed from Source/WebCore/layout/LayoutContext.h.
3593         (WebCore::Layout::LayoutState::setInQuirksMode):
3594         (WebCore::Layout::LayoutState::hasDisplayBox const):
3595         (WebCore::Layout::LayoutState::inQuirksMode const):
3596         * layout/Verification.cpp:
3597         (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
3598         (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
3599         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
3600         (WebCore::Layout::verifyAndOutputSubtree):
3601         (WebCore::Layout::LayoutState::verifyAndOutputMismatchingLayoutTree const):
3602         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const): Deleted.
3603         * layout/blockformatting/BlockFormattingContext.cpp:
3604         (WebCore::Layout::BlockFormattingContext::layout const):
3605         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
3606         (WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
3607         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTop const):
3608         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTopForAncestors const):
3609         (WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForFormattingRootIfNeeded const):
3610         (WebCore::Layout::hasPrecomputedMarginTop):
3611         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
3612         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
3613         (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const):
3614         (WebCore::Layout::BlockFormattingContext::computeInFlowPositionedPosition const):
3615         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
3616         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
3617         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
3618         * layout/blockformatting/BlockFormattingContext.h:
3619         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
3620         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
3621         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
3622         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
3623         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
3624         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3625         (WebCore::Layout::isStretchedToInitialContainingBlock):
3626         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
3627         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
3628         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
3629         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
3630         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
3631         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
3632         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
3633         (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraints):
3634         (WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginTop):
3635         * layout/blockformatting/BlockFormattingState.cpp:
3636         (WebCore::Layout::BlockFormattingState::BlockFormattingState):
3637         * layout/blockformatting/BlockFormattingState.h:
3638         * layout/blockformatting/BlockInvalidation.cpp:
3639         (WebCore::Layout::computeUpdateType):
3640         (WebCore::Layout::computeUpdateTypeForAncestor):
3641         (WebCore::Layout::BlockInvalidation::invalidate):
3642         * layout/blockformatting/BlockInvalidation.h:
3643         * layout/blockformatting/BlockMarginCollapse.cpp:
3644         (WebCore::Layout::isMarginTopCollapsedWithParent):
3645         (WebCore::Layout::isMarginBottomCollapsedThrough):
3646         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginTopFromFirstChild):
3647         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginTop):
3648         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginTop):
3649         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBottom):
3650         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginTop):
3651         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBottom):
3652         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWithParent):
3653         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBottomFromLastChild):
3654         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBottom):
3655         * layout/displaytree/DisplayBox.h:
3656         * layout/floats/FloatAvoider.cpp:
3657         (WebCore::Layout::FloatAvoider::FloatAvoider):
3658         * layout/floats/FloatAvoider.h:
3659         * layout/floats/FloatBox.cpp:
3660         (WebCore::Layout::FloatBox::FloatBox):
3661         * layout/floats/FloatBox.h:
3662         * layout/floats/FloatingContext.cpp:
3663         (WebCore::Layout::FloatingContext::positionForFloat const):
3664         (WebCore::Layout::FloatingContext::positionForFloatAvoiding const):
3665         (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
3666         * layout/floats/FloatingContext.h:
3667         (WebCore::Layout::FloatingContext::layoutState const):
3668         (WebCore::Layout::FloatingContext::layoutContext const): Deleted.
3669         * layout/floats/FloatingState.cpp:
3670         (WebCore::Layout::FloatingState::FloatItem::FloatItem):
3671         (WebCore::Layout::FloatingState::FloatingState):
3672         (WebCore::Layout::FloatingState::constraints const):
3673         * layout/floats/FloatingState.h:
3674         (WebCore::Layout::FloatingState::create):
3675         (WebCore::Layout::FloatingState::layoutState const):
3676         (WebCore::Layout::FloatingState::layoutContext const): Deleted.
3677         * layout/inlineformatting/InlineFormattingContext.cpp:
3678         (WebCore::Layout::InlineFormattingContext::layout const):
3679         (WebCore::Layout::InlineFormattingContext::initializeNewLine const):
3680         (WebCore::Layout::InlineFormattingContext::layoutInlineContent const):
3681         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
3682         (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForInlineBox const):
3683         (WebCore::Layout::InlineFormattingContext::computeFloatPosition const):
3684         (WebCore::Layout::InlineFormattingContext::computeStaticPosition const):
3685         (WebCore::Layout::InlineFormattingContext::computeInFlowPositionedPosition const):
3686         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
3687         * layout/inlineformatting/InlineFormattingContext.h:
3688         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
3689         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
3690         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin):
3691         * layout/inlineformatting/InlineFormattingState.cpp:
3692         (WebCore::Layout::InlineFormattingState::InlineFormattingState):
3693         * layout/inlineformatting/InlineFormattingState.h:
3694         * layout/inlineformatting/InlineInvalidation.cpp:
3695         (WebCore::Layout::InlineInvalidation::invalidate):
3696         * layout/inlineformatting/InlineInvalidation.h:
3697         * layout/inlineformatting/InlineLineBreaker.cpp:
3698         (WebCore::Layout::InlineLineBreaker::InlineLineBreaker):
3699         (WebCore::Layout::InlineLineBreaker::runWidth const):
3700         * layout/inlineformatting/InlineLineBreaker.h:
3701         * layout/layouttree/LayoutTreeBuilder.cpp:
3702         (WebCore::Layout::outputInlineRuns):
3703         (WebCore::Layout::outputLayoutTree):
3704         (WebCore::Layout::showLayoutTree):
3705         * layout/layouttree/LayoutTreeBuilder.h:
3706         * page/FrameViewLayoutContext.cpp:
3707         (WebCore::layoutUsingFormattingContext):
3708
3709 2018-10-30  Wenson Hsieh  <wenson_hsieh@apple.com>
3710
3711         [Cocoa] Attachment dropped from one web view to another is missing its file wrapper
3712         https://bugs.webkit.org/show_bug.cgi?id=190530
3713         <rdar://problem/45232149>
3714
3715         Reviewed by Tim Horton.
3716
3717         Add support for copying and pasting attachment elements across web views by encoding and adding file wrapper
3718         data as subresources in the web archive when writing selected web content to the pasteboard, and then decoding
3719         and creating NSFileWrappers upon reading web content.
3720
3721         Test: WKAttachmentTests.CopyAndPasteBetweenWebViews
3722
3723         * WebCore.xcodeproj/project.pbxproj:
3724         * editing/Editor.cpp:
3725         (WebCore::Editor::registerAttachments):
3726         * editing/Editor.h:
3727
3728         Add registerAttachments(), which registers _WKAttachments in the UI process given a list of
3729         SerializedAttachmentData. This behaves similarly to registerAttachmentIdentifiers(), but differs in that (1) it
3730         sends serialized file wrapper data, and (2) it sends a list of serialized attachments, rather than information
3731         about just a single attachment.
3732
3733         * editing/SerializedAttachmentData.h:
3734
3735         Introduce SerializedAttachmentData, a struct containing information needed to serialize and deserialize an
3736         attachment. These are used both when writing attachment data to the pasteboard, and when consuming attachment
3737         data upon paste.
3738
3739         * editing/cocoa/WebContentReaderCocoa.mm:
3740         (WebCore::replaceRichContentWithAttachments):
3741
3742         Add a step when pasting rich content with attachments, to collect and send serialized attachments to the client.
3743         Also, drive-by fix: don't WTFMove() the Ref here if it's still going to be used below.
3744
3745         * html/HTMLAttachmentElement.cpp:
3746         (WebCore::HTMLAttachmentElement::archiveResourceURL):
3747         * html/HTMLAttachmentElement.h:
3748
3749         Add a static helper function to compute a URL that represents the data for the given attachment identifier, for
3750         use in a web archive resource.
3751
3752         * loader/archive/cf/LegacyWebArchive.cpp:
3753         (WebCore::addSubresourcesForAttachmentElementsIfNecessary):
3754
3755         Add a helper function to create and append ArchiveResources representing attachment element data when writing
3756         attachments to the pasteboard via web archive data.
3757
3758         (WebCore::LegacyWebArchive::create):
3759         * page/EditorClient.h:
3760         (WebCore::EditorClient::registerAttachments):
3761         (WebCore::EditorClient::serializedAttachmentDataForIdentifiers):
3762
3763 2018-10-30  David Kilzer  <ddkilzer@apple.com>
3764
3765         XSLTProcessor should limit max transform depth
3766         <https://webkit.org/b/191075>
3767         <rdar://problem/45531453>
3768
3769         Reviewed by Alex Christensen.
3770
3771         Test: fast/xsl/xslt-max-depth.html
3772
3773         * xml/SoftLinkLibxslt.cpp: Add macro for `xsltMaxDepth` global.
3774         * xml/SoftLinkLibxslt.h: Ditto.
3775         * xml/XSLTProcessorLibxslt.cpp:
3776         (WebCore::XSLTProcessor::transformToString): Set `xsltMaxDepth`
3777         to 1000.  Default in libxslt.dylib is 3000.
3778
3779 2018-10-30  Jim Mason  <jmason@ibinx.com>
3780
3781         [GTK] Scrollbars not following gtk-primary-button-warps-slider setting
3782         https://bugs.webkit.org/show_bug.cgi?id=191067
3783
3784         Reviewed by Michael Catanzaro.
3785
3786         * platform/gtk/ScrollbarThemeGtk.cpp:
3787         (WebCore::ScrollbarThemeGtk::handleMousePressEvent):
3788
3789 2018-10-30  Alexey Proskuryakov  <ap@apple.com>
3790
3791         Clean up some obsolete MAX_ALLOWED macros
3792         https://bugs.webkit.org/show_bug.cgi?id=190916
3793
3794         Reviewed by Tim Horton.
3795
3796         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3797         (WebCore::exernalDeviceDisplayNameForPlayer):
3798         * platform/mac/PlatformEventFactoryMac.mm:
3799         (WebCore::globalPointForEvent):
3800         (WebCore::pointForEvent):
3801         (WebCore::mouseButtonForEvent):
3802         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
3803
3804 2018-10-30  Ali Juma  <ajuma@chromium.org>
3805
3806         Calling window.open("", "_self") allows working around restrictions on window.close()
3807         https://bugs.webkit.org/show_bug.cgi?id=191073
3808
3809         Reviewed by Chris Dumez.
3810
3811         Do not treat a re-used frame in DOMWindow::createWindow as having been opened by DOM.
3812
3813         Test: fast/dom/Window/window-open-self-disallow-close.html
3814
3815         * page/DOMWindow.cpp:
3816         (WebCore::DOMWindow::createWindow):
3817
3818 2018-10-30  Andy Estes  <aestes@apple.com>
3819
3820         [Payment Request] Implement PaymentResponse.retry()
3821         https://bugs.webkit.org/show_bug.cgi?id=190985
3822
3823         Reviewed by Daniel Bates.
3824
3825         Implemented the retry() method on PaymentResponse as specified in the Payment Request API
3826         W3C Editor's Draft of 24 October 2018.
3827
3828         See https://w3c.github.io/payment-request/#retry-method for details.
3829
3830         Tests: http/tests/paymentrequest/payment-response-rejects-if-not-active.https.html
3831                http/tests/paymentrequest/payment-response-retry-method.https.html
3832
3833         * Modules/applepay/PaymentCoordinator.h:
3834         (WebCore::PaymentCoordinator::client): Added. Returns m_client.
3835         * Modules/applepay/PaymentCoordinatorClient.h:
3836         (WebCore::PaymentCoordinatorClient::isMockPaymentCoordinator const): Added. Used to downcast
3837         a PaymentCoordinatorClient to a MockPaymentCoordinator.
3838         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
3839         (WebCore::ApplePayPaymentHandler::computeTotalAndLineItems const): Made const.
3840         (WebCore::ApplePayPaymentHandler::computeErrors const): Broke this function into
3841         computeAddressErrors, computePayerErrors, and computePaymentMethodErrors, then modified this
3842         function to call those functions. Exceptions thrown by computePaymentMethodErrors are ignored.
3843         (WebCore::ApplePayPaymentHandler::computeAddressErrors const): Added.
3844         (WebCore::ApplePayPaymentHandler::computePayerErrors const): Added.
3845         (WebCore::ApplePayPaymentHandler::computePaymentMethodErrors const): Added.
3846         (WebCore::ApplePayPaymentHandler::complete): Added ASSERTs to verify whether result is a
3847         final result.
3848         (WebCore::ApplePayPaymentHandler::retry): Computed PaymentErrors from PaymentValidationErrors,
3849         ensured the PaymentAuthorizationResult was non-final by adding an unknown error if necessary,
3850         and called PaymentCoordinator::completePaymentSession.
3851         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
3852         * Modules/paymentrequest/PaymentHandler.h:
3853         * Modules/paymentrequest/PaymentRequest.cpp:
3854         (WebCore::PaymentRequest::show): Changed to call settleShowPromise.
3855         (WebCore::PaymentRequest::abortWithException): Changed to abort PaymentResponse's retry
3856         promise, if present, instead of PaymentResponse's show promise.
3857         (WebCore::PaymentRequest::settleShowPromise): Added. Settles m_showPromise then sets it to
3858         std::nullopt.
3859         (WebCore::PaymentRequest::closeActivePaymentHandler): Added. Hides the active payment
3860         handler then sets it to std::nullopt.
3861         (WebCore::PaymentRequest::stop): Stopped calling abortWithException, since that function
3862         might settle PaymentResponse's retry promise. PaymentResponse is now an ActiveDOMObject and
3863         will settle its own promise in its implementation of stop.
3864         (WebCore::PaymentRequest::abort): Changed to throw an InvalidStateError if there is a
3865         pending retry promise and to call abortWithException instead of stop.
3866         (WebCore::PaymentRequest::completeMerchantValidation): Changed to call abortWithException
3867         instead of stop.
3868         (WebCore::PaymentRequest::settleDetailsPromise): Ditto.
3869         (WebCore::PaymentRequest::accept): Updated the existing PaymentResponse, if present, rather
3870         than creating a new one. Settled the existing PaymentResponse's retry promise, if present,
3871         rather than the show promise.
3872         (WebCore::PaymentRequest::complete): Changed to throw an AbortError if there is no longer an
3873         active payment handler.
3874         (WebCore::PaymentRequest::retry): Changed to throw an AbortError if there is no longer an
3875         active payment handler, and to call PaymentHandler::retry if there is.
3876         (WebCore::PaymentRequest::cancel): Changed to call abortWithException instead of stop.
3877         * Modules/paymentrequest/PaymentRequest.h:
3878         * Modules/paymentrequest/PaymentRequest.idl:
3879         * Modules/paymentrequest/PaymentResponse.cpp:
3880         (WebCore::PaymentResponse::PaymentResponse):
3881         (WebCore::PaymentResponse::finishConstruction): Pending activities create strong references
3882         to |this|, so they cannot be created in constructors without relaxing adoption requirements.
3883         Added this function so that the pending activity can be created after the PaymentResponse is
3884         created and adopted.
3885         (WebCore::PaymentResponse::~PaymentResponse):
3886         (WebCore::PaymentResponse::complete): Updated to throw an AbortError or InvalidStateError
3887         when necessary.
3888         (WebCore::PaymentResponse::retry): Implemented. Throws an AbortError or InvalidStateError
3889         when necessary, otherwise calls PaymentRequest::retry and stores the retry promise in
3890         m_retryPromise.
3891         (WebCore::PaymentResponse::abortWithException): Added. Rejects the retry promise with
3892         |exception|, clears the pending activity, and sets m_state to Completed.
3893         (WebCore::PaymentResponse::settleRetryPromise): Added. Settles the retry promise and sets it
3894         to std::nullopt.
3895         (WebCore::PaymentResponse::canSuspendForDocumentSuspension const): Added. Returns true if
3896         there is no pending activity.
3897         (WebCore::PaymentResponse::stop): Added. Rejects the retry promise with AbortError, clears
3898         the pending activity, and sets m_state to Stopped.
3899         * Modules/paymentrequest/PaymentResponse.h: Changed create to call finishConstruction and
3900         made PaymentResponse an ActiveDOMObject instead of a ContextDestructionObserver.
3901         * testing/Internals.cpp:
3902     &nb