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