4a0544dbee9130839ba348fe2366a51a3dc38a42
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2020-06-04  Sihui Liu  <sihui_liu@apple.com>
2
3         Text manipulation: first and last unit in a paragraph should not contain only excluded tokens
4         https://bugs.webkit.org/show_bug.cgi?id=212759
5
6         Reviewed by Wenson Hsieh.
7
8         In r262398, we literally made text of one Node as the minimum unit for text manipulation. This patches introduce
9         a struct ManipulationUnit for that. Now a paragraph can be represented as multiple ManipulationUnits. When all 
10         tokens in a ManipulationUnit are excluded, it means the ManipulationUnit is excluded and should not be 
11         manipulated. To record ManipulationUnits in a paragraph based on our current implementation, we need to keep the
12         excluded ManipulationUnits surrounded by non-excluded ManipulationUnits, but we can safely remove the leading 
13         and trailing excluded ManipulationUnits. In this case, we can limit the range of paragraph further and thus less
14         text replacement work.
15
16         Covered by existing test.
17
18         * editing/TextManipulationController.cpp:
19         (WebCore::TextManipulationController::parse):
20         (WebCore::TextManipulationController::addItemIfPossible):
21         (WebCore::TextManipulationController::observeParagraphs):
22         * editing/TextManipulationController.h:
23
24 2020-06-04  Peng Liu  <peng.liu6@apple.com>
25
26         A YouTube video gets stuck after rapidly tapping on touchbar’s PIP button
27         https://bugs.webkit.org/show_bug.cgi?id=212729
28
29         Reviewed by Darin Adler.
30
31         Call HTMLVideoElement::setFullscreenMode() instead of HTMLMediaElement::enterFullscreen()
32         and HTMLMediaElement::exitFullscreen() to toggle picture-in-picture mode.
33         HTMLVideoElement::setFullscreenMode() is robust under stress test after r262456.
34
35         Manually tested.
36
37         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
38         (WebCore::PlaybackSessionModelMediaElement::togglePictureInPicture):
39
40 2020-06-04  Commit Queue  <commit-queue@webkit.org>
41
42         Unreviewed, reverting r262583.
43         https://bugs.webkit.org/show_bug.cgi?id=212799
44
45         Internal source code has the same bug, needs to be landed
46         after fixing internal source
47
48         Reverted changeset:
49
50         "DOM constructor should only accept Ref<> / ExceptionOr<Ref<>>
51         for creation to ensure toJSNewlyCreated is always returning
52         object"
53         https://bugs.webkit.org/show_bug.cgi?id=212767
54         https://trac.webkit.org/changeset/262583
55
56 2020-06-04  Zalan Bujtas  <zalan@apple.com>
57
58         HTMLAppletElement::updateWidget should check for renderer after the overlapping test.
59         https://bugs.webkit.org/show_bug.cgi?id=212789
60         <rdar://problem/61854614>
61
62         Reviewed by Simon Fraser.
63
64         createJavaAppletWidget needs to check if the plugin(replacement) is obscured.
65         Since the overlapping test requires up-to-date geometry, it initiates a top level style recalc/layout.
66         We need to check if the apple element still has a renderer after the style recalc.
67
68         * html/HTMLAppletElement.cpp:
69         (WebCore::HTMLAppletElement::updateWidget):
70
71 2020-06-04  Jack Lee  <shihchieh_lee@apple.com>
72
73         Nullptr crash in DeleteSelectionCommand::doApply() when ending position is disconnected.
74         https://bugs.webkit.org/show_bug.cgi?id=212723
75         <rdar://problem/63866653>
76
77         Reviewed by Geoffrey Garen.
78
79         In this test case, while merging paragraphs after deleting a text element, we need call removeNodeAndPruneAncestors()
80         to remove a BR node. However, the ancestor of BR is also removed. Later we try to insert a node at the parent of the
81         removed ancestor in function DeleteSelectionCommand::doApply().
82
83         For now we just check the parentless inserting position and bail out. The proper fix should be re-designing 
84         removeNodeAndPruneAncestors() or select a different inserting position after removeNodeAndPruneAncestors() is called.
85
86         Test: editing/deleting/delete-txt-in-dl-crash.html
87
88         * editing/DeleteSelectionCommand.cpp:
89         (WebCore::DeleteSelectionCommand::doApply):
90
91 2020-06-04  Ross Kirsling  <ross.kirsling@sony.com>
92
93         [PlayStation] Unreviewed revert of build fix. Missing include was not the cause.
94
95         * platform/graphics/ColorUtilities.cpp:
96
97 2020-06-04  Sihui Liu  <sihui_liu@apple.com>
98
99         REGRESSION:(r262398) Text manipulation crashes when content is added
100         https://bugs.webkit.org/show_bug.cgi?id=212785
101
102         Reviewed by Ryosuke Niwa.
103
104         r262398 accidentally removed the bound check on array index and was not caught by existing tests.
105
106         Test: TextManipulation.CompleteTextManipulationFailWhenContentIsAdded
107
108         * editing/TextManipulationController.cpp:
109         (WebCore::TextManipulationController::replace):
110
111 2020-06-04  Ross Kirsling  <ross.kirsling@sony.com>
112
113         [PlayStation] Unreviewed build fix following r262352.
114
115         * platform/graphics/ColorUtilities.cpp:
116
117 2020-06-04  Yusuke Suzuki  <ysuzuki@apple.com>
118
119         DOM constructor should only accept Ref<> / ExceptionOr<Ref<>> for creation to ensure toJSNewlyCreated is always returning object
120         https://bugs.webkit.org/show_bug.cgi?id=212767
121
122         Reviewed by Darin Adler.
123
124         When using toJSNewlyCreated in DOM constructor, we should ensure that this only returns JSObject* (if exception is not happening) to
125         avoid `isObject()` check after that. However AudioContext and ImageData is not following this and can return nullptr from `create` factory
126         function. We should not allow this.
127
128         In this patch,
129
130         1. AudioContext should throw an error instead of returning null. AudioContext had a limit derived from OS, but this limit is reasonable only
131            in Windows. We should insert `OS(WINDOWS)` around this check, and throw an error instead of returning null.
132
133         2. ImageData::create can return nullptr potentially, and it can be converted to null. This is not acceptable for DOM constructor. We should throw
134            an error if we failed to create ImageData.
135
136         3. We inserted static_asserts in CodeGeneratorJS.pm to ensure that XXX::create only returns Ref<> or ExceptionOr<Ref<>>. This ensures that toJSNewlyCreated
137            will return JSObject*.
138
139         * Modules/webaudio/AudioContext.cpp:
140         (WebCore::AudioContext::create):
141         * Modules/webaudio/AudioContext.h:
142         * Modules/webaudio/AudioContext.idl:
143         * bindings/scripts/CodeGeneratorJS.pm:
144         (GenerateConstructorDefinition):
145         * dom/ExceptionOr.h:
146         * html/ImageData.cpp:
147         (WebCore::ImageData::create):
148         * html/ImageData.h:
149         * testing/Internals.cpp:
150         (WebCore::Internals::videoSampleAvailable):
151
152 2020-06-04  Kate Cheney  <katherine_cheney@apple.com>
153
154         REGRESSION (r262212): [ iOS Debug wk2 ] ASSERTION FAILED: !isSynchronous() || !m_synchronousLoadData->delayedReply in WebKit::NetworkResourceLoader
155         https://bugs.webkit.org/show_bug.cgi?id=212678
156         <rdar://problem/63797758>
157
158         Reviewed by Chris Dumez.
159
160         No new tests, this will fix http/tests/xmlhttprequest/access-control-preflight-credential-sync.html.
161
162         Refactor the bundle identifier setters and getters in
163         RuntimeApplicationChecksCocoa.mm so that a separate function sets
164         an override bundle identifier, and clearing the override identifier
165         does not clear the UI process bundle identifier as well. 
166
167         * platform/RuntimeApplicationChecks.h:
168         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
169         (WebCore::bundleIdentifierOverride):
170         (WebCore::bundleIdentifier):
171         (WebCore::applicationBundleIdentifier):
172         (WebCore::setApplicationBundleIdentifier):
173         (WebCore::setApplicationBundleIdentifierOverride):
174         (WebCore::clearApplicationBundleIdentifierTestingOverride):
175         (WebCore::applicationBundleIdentifierOverride): Deleted.
176
177 2020-06-04  Yusuke Suzuki  <ysuzuki@apple.com>
178
179         MessageEvent should tell its memory cost to GC
180         https://bugs.webkit.org/show_bug.cgi?id=203990
181
182         Reviewed by Mark Lam.
183
184         This patch fixes two issues to make MessageEvent's memoryCost working.
185
186         1. MessageEvent does not have memoryCost function. So even if ArrayBuffer etc. is held as a SerializedScriptValue,
187            it does not communicate memory pressure to GC. This patch adds ReportExtraMemoryCost to MessageEvent.idl and memoryCost
188            function to MessageEvent. And we implement SerializedScriptValue::memoryCost function to obtain rough memory cost
189            for SerializedScriptValue.
190
191         2. IDL code generator puts `reportExtraMemoryAllocated` function call in `toJSNewlyCreated`. However, `toJSNewlyCreated`
192            is not always used when creating JS wrapper. For example, JSMessageEvent can be created from toJSNewlyCreated for MessageEvent.
193            But it can be also be created from toJSNewlyCreated for Event through EventFactory. If the latter path is taken, we won't properly
194            report memory cost even if IDL has ReportExtraMemoryCost. In JSC, we put `reportExtraMemoryAllocated` at the end of JSXXX::finishCreation.
195            IDL code should follow this convention.
196
197         * bindings/js/SerializedScriptValue.cpp:
198         (WebCore::SerializedScriptValue::SerializedScriptValue):
199         (WebCore::SerializedScriptValue::computeMemoryCost const):
200         * bindings/js/SerializedScriptValue.h:
201         (WebCore::SerializedScriptValue::memoryCost const):
202         * bindings/scripts/CodeGeneratorJS.pm:
203         (GenerateImplementation):
204         * bindings/scripts/test/JS/JSInterfaceName.cpp:
205         (WebCore::JSInterfaceName::finishCreation):
206         (WebCore::toJSNewlyCreated):
207         * dom/MessageEvent.cpp:
208         (WebCore::MessageEvent::memoryCost const):
209         * dom/MessageEvent.h:
210         * dom/MessageEvent.idl:
211         * html/OffscreenCanvas.h:
212         (WebCore::DetachedOffscreenCanvas::memoryCost const):
213
214 2020-06-04  Wenson Hsieh  <wenson_hsieh@apple.com>
215
216         [macOS] Add a way to override the contact AutoFill button image
217         https://bugs.webkit.org/show_bug.cgi?id=212775
218         <rdar://problem/60381452>
219
220         Reviewed by Tim Horton.
221
222         Rename `SYSTEM_ATTACHMENT_PLACEHOLDER_ICON` to `ALTERNATE_ICONS`, and use it to additionally guard an alternate
223         appearance for the contact AutoFill button icon.
224
225         * css/html.css:
226         (input::-webkit-contacts-auto-fill-button):
227         * rendering/RenderThemeMac.h:
228         * rendering/RenderThemeMac.mm:
229         (WebCore::RenderThemeMac::extraDefaultStyleSheet):
230
231 2020-06-04  Tetsuharu Ohzeki  <tetsuharu.ohzeki@gmail.com>
232
233         Rename BlobLineEndings to EndingType to match the latest spec
234         https://bugs.webkit.org/show_bug.cgi?id=212644
235
236         Reviewed by Sam Weinig.
237
238         By the latest File API spec, the role of `BlobLineEndings` is named as `EndingType`.
239         https://w3c.github.io/FileAPI/#enumdef-endingtype
240
241         * CMakeLists.txt:
242         * DerivedSources-input.xcfilelist:
243         * DerivedSources-output.xcfilelist:
244         * DerivedSources.make:
245         * Headers.cmake:
246         * Sources.txt:
247         * WebCore.xcodeproj/project.pbxproj:
248         * fileapi/BlobBuilder.cpp:
249         (WebCore::BlobBuilder::BlobBuilder):
250         (WebCore::BlobBuilder::append):
251         * fileapi/BlobBuilder.h:
252         * fileapi/BlobPropertyBag.h:
253         * fileapi/BlobPropertyBag.idl:
254         * fileapi/EndingType.h: Renamed from Source/WebCore/fileapi/BlobLineEndings.h.
255         * fileapi/EndingType.idl: Renamed from Source/WebCore/fileapi/BlobLineEndings.idl.
256
257 2020-06-04  Chris Dumez  <cdumez@apple.com>
258
259         [iOS] Validate index parameter in PlatformPasteboard
260         https://bugs.webkit.org/show_bug.cgi?id=212713
261         <rdar://problem/60068765>
262
263         Reviewed by Alex Christensen.
264
265         Follow-up to r262529 to also make sure that the index is not negative after
266         casting to NSInteger.
267
268         * platform/ios/PlatformPasteboardIOS.mm:
269         (WebCore::PlatformPasteboard::readBuffer const):
270         (WebCore::PlatformPasteboard::readString const):
271         (WebCore::PlatformPasteboard::readURL const):
272
273 2020-06-04  Xabier Rodriguez Calvar  <calvaris@igalia.com>
274
275         [EME][GStreamer] cdmProxyAttached does not need to force a bump ref in the signature
276         https://bugs.webkit.org/show_bug.cgi?id=212754
277
278         Reviewed by Philippe Normand.
279
280         cdmProxyAttached is currently receiving a RefPtr<CDMProxy> in the
281         signature, what causes a ref bump when the function is called. A
282         const RefPtr<CDMProxy>& is more suitable cause the reference is
283         already bumped when the CDMProxy assigned in the decryptor
284         attribute.
285
286         No new tests, just a rework.
287
288         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
289         (cdmProxyAttached):
290         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
291
292 2020-06-04  Tim Horton  <timothy_horton@apple.com>
293
294         Work around broken system version macro
295         https://bugs.webkit.org/show_bug.cgi?id=212726
296
297         Reviewed by Dan Bernstein.
298
299         * Configurations/DebugRelease.xcconfig:
300
301 2020-06-04  Andy Estes  <aestes@apple.com>
302
303         [watchOS] Re-enable content filtering in the simulator build
304         https://bugs.webkit.org/show_bug.cgi?id=212711
305         <rdar://problem/63938350>
306
307         Reviewed by Wenson Hsieh.
308
309         * Configurations/FeatureDefines.xcconfig:
310
311 2020-06-04  Zalan Bujtas  <zalan@apple.com>
312
313         Reset fragment line info when the relatively positioned inline box becomes static with block child.
314         https://bugs.webkit.org/show_bug.cgi?id=212724
315         <rdar://problem/62847534>
316
317         Reviewed by Simon Fraser.
318
319         adjustFragmentedFlowStateOnContainingBlockChangeIfNeeded was missing the case when the
320         block container was inside an inline box. It happens when the inline box is relatively positioned while the
321         child block box is absolutely positioned.
322         RenderFragmentedFlow keeps track of the associated root lineboxes in m_lineToFragmentMap.
323         In adjustFragmentedFlowStateOnContainingBlockChangeIfNeeded, when the block is no longer part of the fragment
324         we remove these cached lineboxes from the m_lineToFragmentMap.
325         This patch fixes the case when the cached lineboxes are generated by a child block box.
326
327         * rendering/RenderElement.cpp:
328         (WebCore::RenderElement::adjustFragmentedFlowStateOnContainingBlockChangeIfNeeded):
329
330 2020-06-04  Youenn Fablet  <youenn@apple.com>
331
332         Read MediaPlayerPrivateMediaStreamAVFObjC::m_canEnqueueDisplayLayer after the lock
333         https://bugs.webkit.org/show_bug.cgi?id=212693
334
335         Reviewed by Eric Carlson.
336
337         In case destroyLayers is called and shortly after ensureLayers is also called, the m_canEnqueueDisplayLayer check in enqueueVideoSample
338         might be bypassed. Make sure to lock before checking m_canEnqueueDisplayLayer in enqueueVideoSample.
339         For good measure, set m_canEnqueueDisplayLayer to false after locking in destroyLayers.
340
341         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
342         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
343         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
344
345 2020-06-03  Chris Dumez  <cdumez@apple.com>
346
347         [iOS] Validate index parameter in PlatformPasteboard
348         https://bugs.webkit.org/show_bug.cgi?id=212713
349         <rdar://problem/60068765>
350
351         Reviewed by Wenson Hsieh.
352
353         Validate index parameter in PlatformPasteboard, before calling [NSIndexSet indexSetWithIndex:].
354         Per documentation, index needs to be in the range [0 .. NSNotFound-1].
355
356         * platform/ios/PlatformPasteboardIOS.mm:
357         (WebCore::PlatformPasteboard::readBuffer const):
358         (WebCore::PlatformPasteboard::readString const):
359         (WebCore::PlatformPasteboard::readURL const):
360
361 2020-06-03  Andy Estes  <aestes@apple.com>
362
363         [Apple Pay] Add new values for -apple-pay-button-type
364         https://bugs.webkit.org/show_bug.cgi?id=212684
365         <rdar://problem/63908535>
366
367         Reviewed by Anders Carlsson.
368
369         Where available, added new values for -apple-pay-button-type and introduced ApplePaySession v10.
370
371         New test: http/tests/ssl/applepay/ApplePayButton.html
372
373         * Modules/applepay/PaymentCoordinatorClient.cpp:
374         (WebCore::PaymentCoordinatorClient::supportsVersion):
375         * accessibility/AccessibilityRenderObject.cpp:
376         (WebCore::AccessibilityRenderObject::applePayButtonDescription const):
377         * css/CSSPrimitiveValueMappings.h:
378         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
379         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const):
380         * css/CSSValueKeywords.in:
381         * css/parser/CSSParserFastPaths.cpp:
382         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
383         * en.lproj/Localizable.strings:
384         * platform/LocalizedStrings.cpp:
385         (WebCore::AXApplePayReloadLabel):
386         (WebCore::AXApplePayAddMoneyLabel):
387         (WebCore::AXApplePayTopUpLabel):
388         (WebCore::AXApplePayOrderLabel):
389         (WebCore::AXApplePayRentLabel):
390         (WebCore::AXApplePaySupportLabel):
391         (WebCore::AXApplePayContributeLabel):
392         (WebCore::AXApplePayTipLabel):
393         * platform/LocalizedStrings.h:
394         * rendering/RenderThemeCocoa.mm:
395         (WebCore::toPKPaymentButtonType):
396         * rendering/style/RenderStyleConstants.cpp:
397         (WebCore::operator<<):
398         * rendering/style/RenderStyleConstants.h:
399         * rendering/style/StyleRareNonInheritedData.h:
400
401 2020-06-03  Daniel Bates  <dabates@apple.com>
402
403         Inserted text placeholder should vertically align to top and behave like block-level element when it has 0 width
404         https://bugs.webkit.org/show_bug.cgi?id=212716
405         <rdar://problem/62672479>
406
407         Reviewed by Darin Adler.
408
409         Refine the appearance of a text placeholder based on feedback:
410             1. If the width of the placeholder is 0 then put it on its own line. This is accomplished by making it
411                CSS "display: block".
412             2. Vertically align the placeholder with the top of the line.
413
414         Both of these refinements are to make the rendering more like TextKit's rendering.
415
416         Tests: editing/text-placeholder/insert-into-content-editable-non-zero-width-and-height.html
417                editing/text-placeholder/insert-into-content-editable-zero-width.html
418
419         * html/shadow/TextPlaceholderElement.cpp:
420
421 2020-06-03  Pinki Gyanchandani  <pgyanchandani@apple.com>
422
423         Release Assert @ WebCore::RenderTreeBuilder::RenderTreeBuilder
424         https://bugs.webkit.org/show_bug.cgi?id=212714
425
426         Reviewed by Geoffrey Garen.
427
428         Widget removal in the middle of building a Render Tree causes side effects, leading to Release Assert. Moved the scope for suspension of widgets
429         update to RenderTreeBuilder instead of having it in RenderTreeUpdater.
430
431         Also made sure that the WidgetHierarchyUpdatesSuspensionScope::moveWidgets() should handle all widgets scheduled to move, including new widgets
432         scheduled during moveWidgets().
433
434         Test: fast/rendering/widget-removal-in-render-tree-builder-crash.html
435
436         * rendering/RenderWidget.cpp:
437         (WebCore::WidgetHierarchyUpdatesSuspensionScope::moveWidgets):
438         * rendering/updating/RenderTreeBuilder.h:
439         * rendering/updating/RenderTreeUpdater.cpp:
440         (WebCore::RenderTreeUpdater::tearDownRenderers):
441
442 2020-06-03  Wenson Hsieh  <wenson_hsieh@apple.com>
443
444         [Text manipulation] Extract the value attribute in inputs of type "text" and "search"
445         https://bugs.webkit.org/show_bug.cgi?id=212706
446         <rdar://problem/63876969>
447
448         Reviewed by Tim Horton.
449
450         Allow text manipulation to extract text for the value of text fields that were not last modified by user input.
451         Aside from button types, it generally doesn't make sense to perform text manipulation over arbitrary input
452         element values, especially for text field types such as passwords, URLs, emails, and numbers. However, some
453         webpages set the `value` of inputs to implement `placeholder`-like behavior in text fields, and we need to be
454         compatible with this.
455
456         Tests:  TextManipulation.StartTextManipulationExtractsValuesFromTextInputs
457                 TextManipulation.CompleteTextManipulationInButtonsAndTextFields
458
459         * editing/TextManipulationController.cpp:
460         (WebCore::shouldExtractValueForTextManipulation):
461
462         Unfortunately, we need to check the type attribute here against "text", since inputs of type "date" and "time"
463         fall back to text fields on macOS, and we still want to avoid extracting values for these.
464
465         (WebCore::isAttributeForTextManipulation):
466
467         Pull the `value` attribute of this out into a separate method, above.
468
469         (WebCore::TextManipulationController::observeParagraphs):
470         (WebCore::TextManipulationController::replace):
471
472         Treat the text field value separately from other attributes by calling `HTMLInputElement::value()` upon
473         extraction, and `HTMLInputElement::setValue()` upon replacement.
474
475 2020-06-03  Rob Buis  <rbuis@igalia.com>
476
477         Disallow responses when a response contains invalid header values
478         https://bugs.webkit.org/show_bug.cgi?id=184493
479
480         Reviewed by Darin Adler.
481
482         From the Fetch specification [1]:
483         "A value is a byte sequence that matches the following conditions:
484         "- Contains no 0x00 (NUL) or HTTP newline bytes."
485
486         [1] https://fetch.spec.whatwg.org/#concept-header-value
487
488         Tests: imported/w3c/web-platform-tests/fetch/h1-parsing/resources-with-0x00-in-header.window.html
489                imported/web-platform-tests/fetch/api/basic/header-value-combining.any.html
490                imported/web-platform-tests/fetch/api/basic/header-value-combining.any.worker.html
491                imported/web-platform-tests/fetch/api/basic/header-value-null-byte.any.html
492                imported/web-platform-tests/fetch/api/basic/header-value-null-byte.any.worker.html
493                imported/web-platform-tests/xhr/headers-normalize-response.htm
494
495         * Modules/fetch/FetchHeaders.cpp:
496         (WebCore::canWriteHeader):
497         (WebCore::appendToHeaderMap):
498         (WebCore::FetchHeaders::filterAndFill):
499         * loader/DocumentThreadableLoader.cpp:
500         (WebCore::DocumentThreadableLoader::loadRequest):
501         * loader/SubresourceLoader.cpp:
502         (WebCore::SubresourceLoader::didReceiveResponse):
503         * platform/network/HTTPParsers.cpp:
504         (WebCore::isValidHTTPHeaderValue):
505         * platform/network/ResourceResponseBase.cpp:
506         (WebCore::ResourceResponseBase::containsInvalidHTTPHeaders const):
507         * platform/network/ResourceResponseBase.h:
508
509 2020-06-03  Wenson Hsieh  <wenson_hsieh@apple.com>
510
511         dataTransfer.types is empty when handling the "dragstart" event
512         https://bugs.webkit.org/show_bug.cgi?id=212685
513         <rdar://problem/61368402>
514
515         Reviewed by Andy Estes.
516
517         Implements several currently stubbed methods on StaticPasteboard, so that the DataTransfer provided to the page
518         on the "dragstart" event contains the DOM-exposed data types that will be written to the system pasteboard. This
519         includes "text/html", "text/plain", and "text/uri-list".
520
521         Tests:  DragAndDropTests.DataTransferTypesOnDragStartForTextSelection
522                 DragAndDropTests.DataTransferTypesOnDragStartForImage
523                 DragAndDropTests.DataTransferTypesOnDragStartForLink
524
525         ...as well as several existing tests in DragAndDropTestsIOS.mm that attempt to set pasteboard data during the
526         dragstart event:
527
528                 DragAndDropTests.DataTransferSanitizeHTML
529                 DragAndDropTests.DataTransferSetDataCannotWritePlatformTypes
530                 DragAndDropTests.DataTransferSetDataInvalidURL
531                 DragAndDropTests.DataTransferSetDataUnescapedURL
532                 DragAndDropTests.DataTransferSetDataValidURL
533
534         * dom/DataTransfer.cpp:
535         (WebCore::DataTransfer::commitToPasteboard):
536
537         Only commit data to the native pasteboard if the page actually tried to write or modify the data. This allows us
538         to preserve existing behavior by allowing DragController to write dragged data to the pasteboard normally in the
539         case where the page didn't specify any custom data. In the case where the page does specify custom data, we will
540         write this custom data *in addition* to any default data that was written to the static pasteboard. While this
541         is a departure from our current behavior (which is to treat the pasteboard as a blank slate that contains only
542         whatever custom data was provided by the page), it matches behavior in both Chrome and Firefox, and is likely
543         more compatible with webpages that don't have UA-specific logic targeting WebKit.
544
545         * editing/cocoa/EditorCocoa.mm:
546         (WebCore::Editor::writeSelectionToPasteboard):
547
548         Avoid calling into the injected bundle (as well as writing a few particular non-web-exposed types, such as web
549         archive data) in the case where we're writing to a static pasteboard (there's no point in doing this for the
550         static pasteboard, and in the worst case, it could confuse some internal clients).
551
552         * editing/ios/EditorIOS.mm:
553         (WebCore::Editor::writeImageToPasteboard): Ditto.
554         * editing/mac/EditorMac.mm:
555         (WebCore::Editor::writeImageToPasteboard):
556
557         Ditto. But additionally, introduce a markup string to PasteboardImage, so that we will expose the "text/html"
558         type when starting a drag on an image element.
559
560         * page/DragController.cpp:
561         (WebCore::DragController::startDrag):
562
563         Only attempt to call into `Pasteboard::writeTrustworthyWebURLsPboardType` in the case where the pasteboard
564         supports this type (i.e. on macOS). This fixes an existing assertion that was hit by my new API test, which
565         attempts to override the contents of the pasteboard with custom data while starting a drag on a link.
566
567         * page/EventHandler.cpp:
568         (WebCore::EventHandler::handleDrag):
569
570         Since the StaticPasteboard contains data before the page has written anything, don't use `Pasteboard::hasData()`
571         to determine whether there's custom data; instead, use the new `hasNonDefaultData()` method on
572         `StaticPasteboard` (see below).
573
574         * platform/Pasteboard.cpp:
575         (WebCore::Pasteboard::canWriteTrustworthyWebURLsPboardType):
576
577         On non-macOS ports, return false.
578
579         * platform/Pasteboard.h:
580         * platform/StaticPasteboard.cpp:
581         (WebCore::StaticPasteboard::hasNonDefaultData const):
582
583         Keep track of whether the page attempted to stage any custom data during "dragstart" by maintaining the set of
584         types written by the page, via calls to `writeString()` and similar. I'm using a set of types here instead of a
585         simple `bool` flag to ensure correctness in the case where the page adds a type, and then later removes that
586         same custom type, such that there is no longer non-default data.
587
588         (WebCore::StaticPasteboard::writeString):
589         (WebCore::StaticPasteboard::writeData):
590         (WebCore::StaticPasteboard::writeStringInCustomData):
591         (WebCore::StaticPasteboard::clear):
592
593         See above.
594
595         (WebCore::StaticPasteboard::writeMarkup):
596         (WebCore::StaticPasteboard::writePlainText):
597         (WebCore::StaticPasteboard::write):
598
599         Implement these methods by writing to the `PasteboardCustomData`. These methods are invoked by our own code
600         rather than the bindings, and should only be used to stage default data types when starting a drag.
601
602         * platform/StaticPasteboard.h:
603         * platform/mac/PasteboardMac.mm:
604         (WebCore::Pasteboard::write):
605         (WebCore::Pasteboard::canWriteTrustworthyWebURLsPboardType):
606
607 2020-06-03  Jer Noble  <jer.noble@apple.com>
608
609         Crash with uncaught exception: *** -[AVSampleBufferAudioRenderer enqueueSampleBuffer:] Sample buffer has media type 'vide' instead of 'soun'
610         https://bugs.webkit.org/show_bug.cgi?id=212646
611         <rdar://problem/63040834>
612
613         Reviewed by Eric Carlson.
614
615         Protect against the possibility of AVStreamDataParser generating non-video or -audio samples in an otherwise
616         video- or audio-track. Check the format description attached to the sample before appending, and ASSERT in
617         debug builds and ERROR_LOG in release builds, as this is an exceptional condition.
618
619         * platform/graphics/FourCC.h:
620         (WTF::LogArgument<WebCore::FourCC>::toString):
621         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
622         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
623
624 2020-06-03  Kate Cheney  <katherine_cheney@apple.com>
625
626         Any active sqlite transactions for the ITP database should be aborted when the network process suspends.
627         https://bugs.webkit.org/show_bug.cgi?id=212608
628         <rdar://problem/60540768>
629
630         Reviewed by Chris Dumez.
631
632         Add WEBCORE_EXPORT macro to use interrupt() function in
633         ResourceLoadStatisticsDatabaseStore.
634
635         * platform/sql/SQLiteDatabase.h:
636
637 2020-06-03  Andres Gonzalez  <andresg_22@apple.com>
638
639         AX: SVG text node with content is described as "empty group" even if it's not empty
640         https://bugs.webkit.org/show_bug.cgi?id=210315
641
642         Reviewed by Darin Adler.
643
644         Test: accessibility/svg-text.html
645
646         SVGText elements are conveyed as AXGroups and cannot have a description
647         or help property, but instead the content of the element is exposed as
648         static text.
649
650         * accessibility/AccessibilitySVGElement.cpp:
651         (WebCore::AccessibilitySVGElement::accessibilityDescription const):
652         (WebCore::AccessibilitySVGElement::helpText const):
653         * accessibility/AccessibilitySVGElement.h:
654
655 2020-06-03  Sihui Liu  <sihui_liu@apple.com>
656
657         Text manipulation sometimes fails to replace text in attributes
658         https://bugs.webkit.org/show_bug.cgi?id=212701
659
660         Reviewed by Wenson Hsieh.
661
662         Concatenate replacement tokens of same identifier for attribute like we do for title and option element in 
663         r260393.
664
665         Covered by test: TextManipulation.CompleteTextManipulationShouldReplaceTextContentWithMultipleTokens
666
667         * editing/TextManipulationController.cpp:
668         (WebCore::TextManipulationController::replace):
669
670 2020-06-02  Dean Jackson  <dino@apple.com>
671
672         [ macOS ] REGRESSION(r262366): webgl/1.0.3/conformance/canvas/buffer-offscreen-test.html & webgl/2.0.0/conformance/canvas/buffer-offscreen-test.html are constant failures
673         https://bugs.webkit.org/show_bug.cgi?id=212594
674         <rdar://problem/63828783>
675
676         Reviewed by Eric Carlson.
677
678         The change in r262366 split the OpenGL work to prepare a canvas for rendering from the actual painting
679         (or compositing in this case). Canvas elements were being "prepared" at the end of the HTML run loop
680         if they'd done anything that would change pixels. The problem is that canvas elements that are not in
681         the document body are never composited, and thus should never be prepared, otherwise they will clear
682         their drawing buffer. In other words, a canvas in this state must keep the same buffer through
683         each rendering frame.
684
685         The solution is to check if the canvas is in the tree scope at the time we consider preparing
686         it for display.
687
688         * dom/Document.cpp:
689         (WebCore::Document::prepareCanvasesForDisplayIfNeeded):
690
691 2020-06-03  John Wilander  <wilander@apple.com>
692
693         Storage Access API: Add setting for per-page storage access scope
694         https://bugs.webkit.org/show_bug.cgi?id=212682
695         <rdar://problem/63904824>
696
697         Reviewed by Brent Fulgham.
698
699         This is a follow-up patch to https://bugs.webkit.org/show_bug.cgi?id=212114,
700         adding an off-by-default setting and a test case for per-page storage access.
701
702         Test: http/tests/storageAccess/request-and-grant-access-with-per-page-scope-access-from-another-frame.html
703
704         * dom/DocumentStorageAccess.cpp:
705         (WebCore::DocumentStorageAccess::requestStorageAccess):
706         * page/Settings.yaml:
707         * testing/InternalSettings.cpp:
708         (WebCore::InternalSettings::setStorageAccessAPIPerPageScopeEnabled):
709         * testing/InternalSettings.h:
710         * testing/InternalSettings.idl:
711
712 2020-06-03  Rob Buis  <rbuis@igalia.com>
713
714         Make generated C++ code use modern C++
715         https://bugs.webkit.org/show_bug.cgi?id=190714
716
717         Reviewed by Jonathan Bedard.
718
719         Replace typedef usage by alias-declaration.
720
721         No new tests. No change in behavior.
722
723         * css/makeprop.pl:
724         * dom/make_names.pl:
725         (printHeaderHead):
726         (printInit):
727         (printTypeHelpersHeaderFile):
728         (printFactoryCppFile):
729         (printFactoryHeaderFile):
730         (printWrapperFactoryCppFile):
731         (printWrapperFactoryHeaderFile):
732
733 2020-06-03  Javier Fernandez  <jfernandez@igalia.com>
734
735         [css-grid] Dynamically setting "position: absolute" in a grid item doesn't trigger a relayout of that element
736         https://bugs.webkit.org/show_bug.cgi?id=191465
737
738         Reviewed by Manuel Rego Casasnovas.
739
740         From Blink r484620 by Sergio Villar <svillar@igalia.com>
741
742         Containing block overrides not cleared for position:absolute
743
744         Whenever a position:absolute block gets a new containing block the
745         previously set containing block overrides are not cleared. This causes the
746         block not to be properly layout for its new containing block (for example
747         when using relative sizes).
748
749         In particular this affects grid items which always get a containing block
750         override size (which represent the grid areas) in case their
751         containing block switches from the grid container to a grid ancestor.
752
753         No new tests, as this change is covered by current web platform tests.
754
755         * rendering/RenderBlock.cpp:
756         (WebCore::RenderBlock::insertPositionedObject): Clear the containing block's override width and height.
757
758 2020-06-03  Youenn Fablet  <youenn@apple.com>
759
760         Add more logging related to service worker fetch event handling
761         https://bugs.webkit.org/show_bug.cgi?id=212632
762
763         Reviewed by Chris Dumez.
764
765         Add logging related to creating/canceling/deleting fetch event handler related client.
766         No change of behavior.
767
768         * workers/service/context/ServiceWorkerThreadProxy.cpp:
769         (WebCore::ServiceWorkerThreadProxy::startFetch):
770         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
771         (WebCore::ServiceWorkerThreadProxy::removeFetch):
772
773 2020-06-02  Yusuke Suzuki  <ysuzuki@apple.com>
774
775         ASSERTION FAILED: isCell() under WebCore::JSDOMConstructor seen with webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html
776         https://bugs.webkit.org/show_bug.cgi?id=212650
777
778         Reviewed by Mark Lam.
779
780         Some DOM constructor can return jsNull. For example, AudioContext constructor can return jsNull when it exceeds # of hardware audio contexts.
781         However CodeGeneratorJS assumes that DOM constructor always returns an object, or throws an exception.
782         This patch adds object check after DOM constructor call to handle the jsNull case while it does not change the existing semantics.
783
784         * bindings/scripts/CodeGeneratorJS.pm:
785         (GenerateConstructorDefinition):
786
787 2020-06-02  Simon Fraser  <simon.fraser@apple.com>
788
789         EventRegion::translate() needs to offset the wheel event regions
790         https://bugs.webkit.org/show_bug.cgi?id=212683
791
792         Reviewed by Zalan Bujtas.
793
794         EventRegion::translate() failed to offset the wheel event regions, which resulted 
795         in wrong reasons for GraphicsLayers with a non-zero offsetFromRenderer.
796
797         Test: fast/scrolling/mac/wheel-event-listener-region-layer-offset.html
798
799         * rendering/EventRegion.cpp:
800         (WebCore::EventRegion::translate):
801
802 2020-06-02  Wenson Hsieh  <wenson_hsieh@apple.com>
803
804         Add a helper method to populate a DataTransfer before dispatching a "dragstart" event
805         https://bugs.webkit.org/show_bug.cgi?id=212614
806         Work towards <rdar://problem/61368402>
807
808         Reviewed by Tim Horton.
809
810         Add a helper method in DragController to pre-populate the StaticPasteboard-backed DataTransfer before
811         dispatching the "dragstart" event. There should be no change in behavior yet, since StaticPasteboard doesn't
812         implement methods for writing data to the pasteboard, which this new method uses.
813
814         * page/DragController.cpp:
815         (WebCore::DragController::prepareForDragStart const):
816         (WebCore::DragController::hitTestResultForDragStart const):
817         (WebCore::DragController::startDrag):
818         * page/DragController.h:
819         * page/EventHandler.cpp:
820         (WebCore::EventHandler::dispatchDragStartEventOnSourceElement):
821
822 2020-06-02  Andres Gonzalez  <andresg_22@apple.com>
823
824         AXIsolatedTree::updateNode should not call nodeForID.
825         https://bugs.webkit.org/show_bug.cgi?id=212662
826
827         Reviewed by Chris Fleizach.
828
829         In isolated tree mode AXIsolatedTree::nodeForID should be called only
830         on the secondary AX thread. So removing the need to call nodeForID in
831         updateNode by using AXCoreObject::childrenIDs() instead of retrieving
832         the isolated node to access its children IDs.
833
834         * accessibility/isolatedtree/AXIsolatedTree.cpp:
835         (WebCore::AXIsolatedTree::updateNode):
836
837 2020-06-02  Keith Rollin  <krollin@apple.com>
838
839         Revert FEATURES_DEFINES related changes
840         https://bugs.webkit.org/show_bug.cgi?id=212664
841         <rdar://problem/63893033>
842
843         Reviewed by Andy Estes.
844
845         Bug 262310, Bug 262311, Bug 262318, and Bug 262331 involve changes to
846         FEATURE_DEFINES and how the values there relate to those found in the
847         Platform*.h files. Those changes break XCBuild (by removing the
848         .xcfilelist related to UnifiedSources and the process for generating
849         them), and so are being reverted.
850
851         No new tests -- build changes.
852
853         * Configurations/FeatureDefines.xcconfig:
854         * Configurations/GenerateUnifiedSources.xcconfig: Added.
855         * DerivedSources-input.xcfilelist:
856         * DerivedSources-output.xcfilelist:
857         * DerivedSources.make:
858         * Modules/applepay/ApplePayError.idl:
859         * Modules/applepay/ApplePayPaymentAuthorizationResult.idl:
860         * Modules/applepay/ApplePayPaymentContact.idl:
861         * Modules/applepay/ApplePayPaymentMethodUpdate.idl:
862         * Modules/applepay/ApplePayRequestBase.idl:
863         * Modules/applepay/ApplePaySession.idl:
864         * Modules/applepay/ApplePayShippingContactUpdate.idl:
865         * Modules/applepay/ApplePayShippingMethodUpdate.idl:
866         * Modules/applepay/PaymentCoordinatorClient.cpp:
867         (WebCore::PaymentCoordinatorClient::supportsVersion):
868         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
869         (WebCore::ApplePayPaymentHandler::computePaymentMethodErrors const):
870         * Scripts/generate-unified-sources.sh:
871         * UnifiedSources-output.xcfilelist: Added.
872         * WebCore.xcodeproj/project.pbxproj:
873         * accessibility/AccessibilityRenderObject.cpp:
874         (WebCore::AccessibilityRenderObject::applePayButtonDescription const):
875         * css/CSSPrimitiveValueMappings.h:
876         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
877         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const):
878         * css/CSSValueKeywords.in:
879         * css/parser/CSSParserFastPaths.cpp:
880         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
881         * rendering/RenderThemeCocoa.mm:
882         (WebCore::toPKPaymentButtonType):
883         * rendering/style/RenderStyleConstants.cpp:
884         (WebCore::operator<<):
885         * rendering/style/RenderStyleConstants.h:
886
887 2020-06-02  Ryan Haddad  <ryanhaddad@apple.com>
888
889         Unreviewed, reverting r262424.
890
891         Caused webkitpy test failure
892
893         Reverted changeset:
894
895         "Make generated C++ code use modern C++"
896         https://bugs.webkit.org/show_bug.cgi?id=190714
897         https://trac.webkit.org/changeset/262424
898
899 2020-06-02  Peng Liu  <peng.liu6@apple.com>
900
901         Stressing webkitSetPresentationMode leads to wrong inline video dimensions
902         https://bugs.webkit.org/show_bug.cgi?id=202425
903
904         Reviewed by Eric Carlson.
905
906         Make the HTMLVideoElement::setFullscreenMode() robust under stress tests
907         by ignoring a request when the video element is not ready yet.
908
909         Manually tested.
910
911         * dom/Element.h:
912         (WebCore::Element::didStopBeingFullscreenElement):
913         Add a callback to indicate that the element has exited fullscreen.
914         * dom/FullscreenManager.cpp:
915         (WebCore::FullscreenManager::didExitFullscreen):
916         Call Element::didStopBeingFullscreenElement() when the element has exited fullscreen.
917
918         * html/HTMLMediaElement.cpp:
919         (WebCore::HTMLMediaElement::enterFullscreen):
920         * html/HTMLMediaElement.h:
921
922         * html/HTMLVideoElement.cpp:
923         (WebCore::HTMLVideoElement::webkitDisplayingFullscreen):
924         This function will return true when a video element is in the process to exit
925         fullscreen/picture-in-picture until it has completed the process. Therefore, a page
926         can safely request the video element to enter fullscreen/picture-in-picture when
927         this function returns false.
928
929         (WebCore::HTMLVideoElement::setFullscreenMode):
930         (WebCore::HTMLVideoElement::didBecomeFullscreenElement):
931         (WebCore::HTMLVideoElement::didStopBeingFullscreenElement):
932         (WebCore::HTMLVideoElement::didEnterFullscreen): Deleted.
933         (WebCore::HTMLVideoElement::didExitFullscreen): Deleted.
934         * html/HTMLVideoElement.h:
935         Add a flag m_isChangingPresentationMode. webkitSetPresentationMode() will only
936         change the presentation mode when the flag is false.
937
938 2020-06-01  Simon Fraser  <simon.fraser@apple.com>
939
940         Add ENABLE(WHEEL_EVENT_REGIONS), enabled on macOS which is the only platform that needs wheel event regions for scrolling thread hit-testing
941         https://bugs.webkit.org/show_bug.cgi?id=212620
942
943         Reviewed by Tim Horton.
944
945         Surround code related to wheel event regions with ENABLE(WHEEL_EVENT_REGIONS).
946
947         Eventually we'll use this same code for touch event regions, and when we do, we
948         can rejigger the #ifdefs.
949
950         * rendering/EventRegion.cpp:
951         (WebCore::EventRegion::operator== const):
952         (WebCore::EventRegion::unite):
953         (WebCore::EventRegion::containsEditableElementsInRect const):
954         (WebCore::EventRegion::dump const):
955         * rendering/EventRegion.h:
956         * rendering/RenderLayerBacking.cpp:
957         (WebCore::RenderLayerBacking::paintDebugOverlays):
958
959 2020-06-02  Andres Gonzalez  <andresg_22@apple.com>
960
961         Avoid calling axBackingObject multiple times in [WebAccessibilityObjectWrapper roleDescription].
962         https://bugs.webkit.org/show_bug.cgi?id=212643
963
964         Reviewed by Chris Fleizach.
965
966         No new functionality.
967
968         Avoid unnecessary overhead of calling axBackingObject multiple times in
969         roleDescription. axBackingObject is not just a getter but involves
970         checking whether isolated tree mode is enabled.
971
972         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
973         (-[WebAccessibilityObjectWrapper subrole]):
974         (-[WebAccessibilityObjectWrapper roleDescription]):
975
976 2020-06-02  Tetsuharu Ohzeki  <tetsuharu.ohzeki@gmail.com>
977
978         Pass nullptr for the 2nd argument of FileReaderLoader 
979         https://bugs.webkit.org/show_bug.cgi?id=212642
980
981         Reviewed by Darin Adler.
982
983         Instead of passing `0`, `nullptr` is better
984         because `FileReaderLoader` takes a pointer.
985
986         * fileapi/FileReaderSync.cpp:
987         (WebCore::FileReaderSync::readAsArrayBuffer):
988         (WebCore::FileReaderSync::readAsBinaryString):
989         (WebCore::FileReaderSync::readAsText):
990         (WebCore::FileReaderSync::readAsDataURL):
991
992 2020-06-02  Tim Horton  <timothy_horton@apple.com>
993
994         UIColor and NSColor WebCore::Color factories should return invalid colors for nil input colors
995         https://bugs.webkit.org/show_bug.cgi?id=212631
996
997         Reviewed by Anders Carlsson.
998
999         * platform/graphics/mac/ColorMac.mm:
1000         (WebCore::colorFromNSColor):
1001         (WebCore::semanticColorFromNSColor):
1002         * platform/ios/ColorIOS.mm:
1003         (WebCore::colorFromUIColor):
1004         This doesn't affect any code currently in WebKit, but it is very, very surprising
1005         that these functions happily accept a null color, assert in debug, but in release
1006         do crazy things like try to paint the null color into a small bitmap to figure out
1007         what it really is.
1008
1009         Also, this matches the behavior of the Color constructors that take CGColorRef.
1010
1011 2020-06-02  Rob Buis  <rbuis@igalia.com>
1012
1013         Make generated C++ code use modern C++
1014         https://bugs.webkit.org/show_bug.cgi?id=190714
1015
1016         Reviewed by Sam Weinig.
1017
1018         Replace typedef usage by alias-declaration.
1019
1020         No new tests. No change in behavior.
1021
1022         * css/makeprop.pl:
1023         * dom/make_names.pl:
1024         (printHeaderHead):
1025         (printInit):
1026         (printTypeHelpersHeaderFile):
1027         (printFactoryCppFile):
1028         (printFactoryHeaderFile):
1029         (printWrapperFactoryCppFile):
1030         (printWrapperFactoryHeaderFile):
1031
1032 2020-06-02  Tetsuharu Ohzeki  <tetsuharu.ohzeki@gmail.com>
1033
1034         Remove unused BlobURL::getIdentifier
1035         https://bugs.webkit.org/show_bug.cgi?id=212635
1036
1037         Reviewed by Youenn Fablet.
1038
1039         * fileapi/BlobURL.cpp:
1040         * fileapi/BlobURL.h:
1041
1042 2020-06-02  Mark Lam  <mark.lam@apple.com>
1043
1044         Fix broken Windows build.
1045         https://bugs.webkit.org/show_bug.cgi?id=212633
1046
1047         Reviewed by Yusuke Suzuki.
1048
1049         * html/HTMLCanvasElement.cpp:
1050         (WebCore::HTMLCanvasElement::needsPreparationForDisplay):
1051         (WebCore::HTMLCanvasElement::prepareForDisplay):
1052
1053 2020-06-02  Youenn Fablet  <youenn@apple.com>
1054
1055         Add some logging to ServiceWorkerThread to track install/activate event handling
1056         https://bugs.webkit.org/show_bug.cgi?id=212523
1057
1058         Reviewed by Chris Dumez.
1059
1060         Add some logging for firing install/activate events and when these events are handled.
1061         No change of behavior.
1062
1063         * workers/service/context/ServiceWorkerThread.cpp:
1064         (WebCore::ServiceWorkerThread::queueTaskToFireInstallEvent):
1065         (WebCore::ServiceWorkerThread::queueTaskToFireActivateEvent):
1066
1067 2020-06-02  Carlos Garcia Campos  <cgarcia@igalia.com>
1068
1069         [GTK4] Make popup menus work
1070         https://bugs.webkit.org/show_bug.cgi?id=211178
1071
1072         Reviewed by Adrian Perez de Castro.
1073
1074         * platform/gtk/GtkVersioning.h:
1075         (gtk_tree_view_column_cell_get_size):
1076
1077 2020-06-01  Sergio Villar Senin  <svillar@igalia.com>
1078
1079         [css-flexbox] ChildIntrinsicLogicalWidth should use fit-content, not max-content
1080         https://bugs.webkit.org/show_bug.cgi?id=210465
1081
1082         Reviewed by Javier Fernandez.
1083
1084         When computing the hypothetical cross size of each item in the flexbox algorithm
1085         the current code was using the max-size. However the specs state clearly that we
1086         should use fit-content instead, i.e., the shrink-to-fit size.
1087         See https://drafts.csswg.org/css-flexbox/#algo-cross-item.
1088
1089         Based on Blink's crrev.com/1327746 by <cbiesinger@chromium.org>
1090
1091         * rendering/RenderFlexibleBox.cpp:
1092         (WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth const): Use the shrink-to-fit
1093         size instead just the max-size.
1094
1095 2020-06-02  Youenn Fablet  <youenn@apple.com>
1096
1097         MediaPlayerPrivateMediaStreamAVFObjC should enqueue samples in a background thread
1098         https://bugs.webkit.org/show_bug.cgi?id=212073
1099
1100         Reviewed by Eric Carlson.
1101
1102         Do not hop to the main thread when rendering video samples anymore.
1103         Instead, we enqueue to the display layer in the background thread but still hop to the main thread for two things:
1104         - Update of various states of the player
1105         - keep a ref to the video sample if canvas rendering is needed.
1106
1107         Most display layer operations stay in the main thread (creation, flushing...).
1108         Deletion of the display layer and access from a background are covered by a lock.
1109         The m_canEnqueueDisplayLayer boolean ensures we do not enqueue too early when the display layer is not yet properly initialized.
1110
1111         LocalSampleBufferDisplayLayer needs to handle the fact that enqueueing might be done in a background thread.
1112         Instead of introducing a lock, we introduce a work queue and we hop to this queue whenever we need to enqueue/mutate the pending samples.
1113
1114         Covered by existing tests and manual testing.
1115
1116         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h:
1117         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
1118         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
1119         (WebCore::LocalSampleBufferDisplayLayer::enqueueSample):
1120         (WebCore::LocalSampleBufferDisplayLayer::enqueueSampleBuffer):
1121         (WebCore::LocalSampleBufferDisplayLayer::requestNotificationWhenReadyForVideoData):
1122         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1123         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1124         (WebCore::videoTransformationMatrix):
1125         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::processNewVideoSampleAvailable):
1126         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable):
1127         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive):
1128         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::flushRenderers):
1129         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
1130         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
1131         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateRenderingMode):
1132         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
1133         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext):
1134         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setBufferingPolicy):
1135         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rootLayerBoundsDidChange):
1136         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoTransformationMatrix): Deleted.
1137         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueCorrectedVideoSample): Deleted.
1138         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayLayer): Deleted.
1139
1140 2020-06-02  Youenn Fablet  <youenn@apple.com>
1141
1142         [ Mac wk2 ] http/wpt/service-workers/service-worker-spinning-fetch.https.html is flaky failing.
1143         https://bugs.webkit.org/show_bug.cgi?id=207515
1144         <rdar://problem/59329307>
1145
1146         Reviewed by Chris Dumez.
1147
1148         When a service worker is terminated, we remove it from the map in SWContextManager.
1149         Shortly after a new service worker may be added to the map.
1150         In that case, previously, we were potentially trying to decrement the message count of the old service worker thread, which is confusing the new service worker thread.
1151         Instead, use WeakPtr to decrement if the service worker thread is still valid.
1152         Covered by existing tests.
1153
1154         * workers/service/context/ServiceWorkerThread.cpp:
1155         (WebCore::ServiceWorkerThread::queueTaskToPostMessage):
1156         (WebCore::ServiceWorkerThread::queueTaskToFireInstallEvent):
1157         (WebCore::ServiceWorkerThread::queueTaskToFireActivateEvent):
1158         (WebCore::ServiceWorkerThread::start):
1159         * workers/service/context/ServiceWorkerThread.h:
1160
1161 2020-06-01  Myles C. Maxfield  <mmaxfield@apple.com>
1162
1163         [WebGPU] Update texture creation validation according to the discussion at https://github.com/gpuweb/gpuweb/pull/799/files
1164         https://bugs.webkit.org/show_bug.cgi?id=212390
1165
1166         Reviewed by Dean Jackson.
1167
1168         Two new rules: Multisampled textures can't have the STORAGE flag, and sampleCount must be either 1 or 4.
1169
1170         Test: webgpu/texture-creation.html
1171
1172         * platform/graphics/gpu/GPUDevice.cpp:
1173         (WebCore::GPUDevice::tryCreateTexture const):
1174
1175 2020-06-01  Noam Rosenthal  <noam@webkit.org>
1176
1177         Make unicode-bidi:isolate the default for an element with a dir attribute (instead of unicode-bidi:embed)
1178         https://bugs.webkit.org/show_bug.cgi?id=134630
1179
1180         Reviewed by Simon Fraser.
1181
1182         Unskipped 11 dir-isolation w3c tests.
1183
1184         * html/HTMLElement.cpp:
1185         (WebCore::HTMLElement::collectStyleForPresentationAttribute):
1186                 Use isolate instead of embed for unicode-bidi when dir attribute is present.
1187
1188 2020-06-01  Devin Rousso  <drousso@apple.com>
1189
1190         Web Inspector: Graphics: should use the `id` (name) of the animation if it exists
1191         https://bugs.webkit.org/show_bug.cgi?id=212618
1192
1193         Reviewed by Timothy Hatcher.
1194
1195         Test: inspector/animation/lifecycle-css-animation.html:
1196               inspector/animation/lifecycle-css-transition.html:
1197               inspector/animation/lifecycle-web-animation.html:
1198               inspector/animation/nameChanged.html
1199
1200         * animation/WebAnimation.h:
1201         (WebCore::WebAnimation::setId): Deleted.
1202         * animation/WebAnimation.cpp:
1203         (WebCore::WebAnimation::setId): Added.
1204
1205         * inspector/InspectorInstrumentation.h:
1206         (WebCore::InspectorInstrumentation::didChangeWebAnimationName): Added.
1207         * inspector/InspectorInstrumentation.cpp:
1208         (WebCore::InspectorInstrumentation::didChangeWebAnimationNameImpl): Added.
1209
1210         * inspector/agents/InspectorAnimationAgent.h:
1211         * inspector/agents/InspectorAnimationAgent.cpp:
1212         (WebCore::InspectorAnimationAgent::didChangeWebAnimationName): Added.
1213         (WebCore::InspectorAnimationAgent::bindAnimation):
1214
1215 2020-06-01  Andres Gonzalez  <andresg_22@apple.com>
1216
1217         [WebAccessibilityObjectWrapper subrole] should check for the nullity of the underlying AXCoreObject before dereferencing.
1218         https://bugs.webkit.org/show_bug.cgi?id=212607
1219
1220         Reviewed by Chris Fleizach.
1221
1222         Covered by existing tests.
1223
1224         - Check for nullity of the backingObject before dereferencing.
1225         - self.axBackingObject is now called only once, instead of many times unnecessarily.
1226
1227         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1228         (-[WebAccessibilityObjectWrapper subrole]):
1229
1230 2020-06-01  Sihui Liu  <sihui_liu@apple.com>
1231
1232         TextManipulationController should put one Node in only one paragraph
1233         https://bugs.webkit.org/show_bug.cgi?id=212548
1234
1235         Reviewed by Wenson Hsieh.
1236
1237         TextManipulationController mainly uses line break as delimiter to split paragraphs. In our current 
1238         implementation, if text of a Node has line break, the part before the line break is in one paragraph and the
1239         part after the line break is in another paragraph, which means the Node is in the ranges of two paragraphs.
1240         In this case, when TextManipulationController manipulates the first paragraph, it replaces all the Nodes in the 
1241         range of first paragraph with new Nodes. Then when it manipulates the second paragraph, if will find Node in the
1242         range of second paragraph does not exist and fail (because the Node is removed when handling the first 
1243         paragraph.). Also, TextManipulationController currently does not preserve line breaks in text, which can be an
1244         issue if these line breaks are visible. 
1245
1246         This patch makes the ParagraphContentIterator iterate over Nodes instead of text, so a Node can only be in the 
1247         range of one paragraph. To do this, it makes line break and spaces around it as a special excluded token.
1248         Here are the rules for splitting paragraphs by line break now:
1249         1. If the special token is the first token in a Node, text in Nodes before the Node will make a paragraph. 
1250         2. If the special token is the last token in a Node, text in Nodes before the Node and in the Node will make a 
1251         paragraph.
1252         3. If the special token in the middle of tokens in a Node, then we don't make a new paragraph until next special
1253         token meets condition 1 or 2.
1254
1255         This patch also fixes the issue that Nodes out of the paragraph range can be removed due to the preorder Node
1256         traversal, by finding and adding those Nodes back.
1257
1258         * editing/TextManipulationController.cpp:
1259         (WebCore::ParagraphContentIterator::m_pastEndNode):
1260         (WebCore::ParagraphContentIterator::advance):
1261         (WebCore::ParagraphContentIterator::currentContent):
1262         (WebCore::ParagraphContentIterator::atEnd const):
1263         (WebCore::ParagraphContentIterator::advanceNode):
1264         (WebCore::ParagraphContentIterator::advanceIteratorNodeAndUpdateText):
1265         (WebCore::isEnclosingItemBoundaryElement):
1266         (WebCore::TextManipulationController::parse):
1267         (WebCore::TextManipulationController::observeParagraphs):
1268         (WebCore::TextManipulationController::addItem):
1269         (WebCore::TextManipulationController::getPath):
1270         (WebCore::TextManipulationController::updateInsertions):
1271         (WebCore::TextManipulationController::replace):
1272         (WebCore::ParagraphContentIterator::startPosition): Deleted.
1273         (WebCore::ParagraphContentIterator::endPosition): Deleted.
1274         (WebCore::ParagraphContentIterator::moveCurrentNodeForward): Deleted.
1275         (WebCore::containsOnlyHTMLSpaces): Deleted.
1276         * editing/TextManipulationController.h:
1277
1278 2020-06-01  David Kilzer  <ddkilzer@apple.com>
1279
1280         Don't use casts to convert between WebCore::DragDestinationAction and {Web,WK}DragDestinationAction types
1281         <https://webkit.org/b/212507>
1282
1283         Reviewed by Darin Adler.
1284
1285         * page/DragActions.h:
1286         (WebCore::anyDragDestinationAction): Add.
1287         (WebCore::DragDestinationActionAny): Delete.
1288         - Rename DragDestinationActionAny() to
1289           anyDragDestinationAction() to match WebKit style.
1290         * platform/DragData.h:
1291         - Update to use anyDragDestinationAction().
1292
1293 2020-06-01  Simon Fraser  <simon.fraser@apple.com>
1294
1295         Add ENABLE(TOUCH_ACTION_REGIONS) to wrap code that's only relevant for platforms that consult touch-action for event handling
1296         https://bugs.webkit.org/show_bug.cgi?id=212572
1297
1298         Reviewed by Andy Estes.
1299
1300         This will allow for optimizations in event region painting without ambiguity.
1301
1302         * dom/Document.h:
1303         * page/Frame.cpp:
1304         (WebCore::Frame::invalidateContentEventRegionsIfNeeded):
1305         * page/scrolling/ScrollingTreeNode.h:
1306         * rendering/EventRegion.cpp:
1307         (WebCore::EventRegion::operator== const):
1308         (WebCore::EventRegion::unite):
1309         (WebCore::EventRegion::translate):
1310         (WebCore::EventRegion::dump const):
1311         * rendering/EventRegion.h:
1312         (WebCore::EventRegion::encode const):
1313         (WebCore::EventRegion::decode):
1314         * rendering/RenderBlock.cpp:
1315         (WebCore::RenderBlock::paintObject):
1316         * rendering/RenderElement.cpp:
1317         (WebCore::RenderElement::styleWillChange):
1318         * rendering/RenderLayerBacking.cpp:
1319         (WebCore::RenderLayerBacking::maintainsEventRegion const):
1320         (WebCore::RenderLayerBacking::paintDebugOverlays):
1321         * style/StyleTreeResolver.cpp:
1322         (WebCore::Style::TreeResolver::resolveElement):
1323
1324 2020-06-01  Tetsuharu Ohzeki  <tetsuharu.ohzeki@gmail.com>
1325
1326         Implement ParentNode.prototype.replaceChildren
1327         https://bugs.webkit.org/show_bug.cgi?id=198578
1328
1329         Reviewed by Darin Adler.
1330
1331         Ideally, we can use `ContainerNode::replaceAllChildren` to implement
1332         this simply but the current of it does not have a path to support
1333         `DocumentFragment`.
1334
1335         Hence, we call related methods from `ParentNode.prototype.replaceChildren` directly.
1336
1337         * dom/ContainerNode.cpp:
1338         (WebCore::ContainerNode::replaceChildren):
1339         * dom/ContainerNode.h:
1340         * dom/ParentNode.idl:
1341
1342 2020-05-25  Sergio Villar Senin  <svillar@igalia.com>
1343
1344         [css-flexbox] Tables as flex items should obey the flex container sizing
1345         https://bugs.webkit.org/show_bug.cgi?id=212355
1346
1347         Reviewed by Manuel Rego Casasnovas.
1348
1349         For most of the boxes, "width:auto" means use all the available space from your container in the inline
1350         direction. This means that a flex container does not need to do anything in particular to stretch them
1351         in the inline axis. However that is not true for tables because their width mostly depend on the sum of
1352         the sizes of their columns (whichever algorithm is used). That's why the layout code of tables should
1353         check whether or not it has an override for the content logical width which is the way flexbox uses to
1354         stretch flex items (and use that override width).
1355
1356         * rendering/RenderTable.cpp:
1357         (WebCore::RenderTable::updateLogicalWidth): Stretch till overrideContentLogicalWidth() if needed.
1358
1359 2020-06-01  Sam Weinig  <weinig@apple.com>
1360
1361         Extended Color: Replace Color constructors taking numeric values with type specific factory functions
1362         https://bugs.webkit.org/show_bug.cgi?id=212576
1363
1364         Reviewed by Tim Horton.
1365
1366         Replaces all remaining implicit and explicit uses of the Color constructors taking numeric
1367         values with explicit calls to makeSimpleColor/makeSimpleColorFromFloats/makeExtendedColor,
1368         giving us a consistent way to create colors. Also addes use constexpr SimpleColors where possible.
1369
1370         * accessibility/isolatedtree/AXIsolatedObject.cpp:
1371         (WebCore::AXIsolatedObject::initializeAttributeData):
1372         * css/CSSValuePool.cpp:
1373         (WebCore::StaticCSSValuePool::StaticCSSValuePool):
1374         * css/parser/CSSPropertyParserHelpers.cpp:
1375         (WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
1376         * html/HTMLInputElement.cpp:
1377         (WebCore::HTMLInputElement::createInnerTextStyle):
1378         * html/canvas/CanvasRenderingContext2DBase.cpp:
1379         (WebCore::CanvasRenderingContext2DBase::shadowColor const):
1380         (WebCore::CanvasRenderingContext2DBase::setShadow):
1381         * html/canvas/CanvasStyle.cpp:
1382         (WebCore::CanvasStyle::CanvasStyle):
1383         (WebCore::CanvasStyle::isEquivalentRGBA const):
1384         * inspector/InspectorOverlay.cpp:
1385         (WebCore::drawOutlinedQuadWithClip):
1386         (WebCore::drawShapeHighlight):
1387         (WebCore::InspectorOverlay::paint):
1388         (WebCore::InspectorOverlay::drawPaintRects):
1389         (WebCore::InspectorOverlay::drawBounds):
1390         (WebCore::InspectorOverlay::drawRulers):
1391         (WebCore::InspectorOverlay::drawElementTitle):
1392         * inspector/agents/InspectorDOMAgent.cpp:
1393         (WebCore::parseColor):
1394         * layout/integration/LayoutIntegrationLineLayout.cpp:
1395         (WebCore::LayoutIntegration::LineLayout::debugTextShadow):
1396         * page/CaptionUserPreferencesMediaAF.cpp:
1397         (WebCore::CaptionUserPreferencesMediaAF::captionsBackgroundCSS const):
1398         * page/DebugPageOverlays.cpp:
1399         (WebCore::touchEventRegionColors):
1400         (WebCore::NonFastScrollableRegionOverlay::drawRect):
1401         * page/FrameView.cpp:
1402         (WebCore::FrameView::paintContents):
1403         * page/PrintContext.cpp:
1404         (WebCore::PrintContext::spoolAllPagesWithBoundaries):
1405         * page/linux/ResourceUsageOverlayLinux.cpp:
1406         (WebCore::ResourceUsageOverlay::platformInitialize):
1407         * platform/graphics/BitmapImage.cpp:
1408         (WebCore::BitmapImage::draw):
1409         * platform/graphics/Color.cpp:
1410         (WebCore::Color::light const):
1411         (WebCore::Color::dark const):
1412         (WebCore::Color::blendWithWhite const):
1413         (WebCore::Color::colorWithAlphaMultipliedBy const):
1414         (WebCore::Color::colorWithAlphaMultipliedByUsingAlternativeRounding const):
1415         (WebCore::Color::colorWithAlpha const):
1416         (WebCore::Color::colorWithAlphaUsingAlternativeRounding const):
1417         (WebCore::blendWithoutPremultiply):
1418         (WebCore::extendedColorsEqual): Deleted.
1419         (WebCore::Color::tagAsValid): Deleted.
1420         * platform/graphics/Color.h:
1421         (WebCore::Color::Color):
1422         (WebCore::Color::tagAsSemantic):
1423         (WebCore::Color::tagAsValid):
1424         (WebCore::extendedColorsEqual):
1425         (WebCore::Color::decode):
1426         (WebCore::Color::setIsSemantic): Deleted.
1427         * platform/graphics/ExtendedColor.cpp:
1428         (WebCore::makeExtendedColor):
1429         * platform/graphics/ExtendedColor.h:
1430         (WebCore::ExtendedColor::ExtendedColor):
1431         (): Deleted.
1432         * platform/graphics/GraphicsLayer.cpp:
1433         (WebCore::GraphicsLayer::getDebugBorderInfo const):
1434         * platform/graphics/ca/GraphicsLayerCA.cpp:
1435         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
1436         (WebCore::contentsLayerDebugBorderColor):
1437         (WebCore::cloneLayerDebugBorderColor):
1438         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
1439         * platform/graphics/ca/PlatformCALayer.cpp:
1440         (WebCore::PlatformCALayer::drawRepaintIndicator):
1441         * platform/graphics/ca/TileCoverageMap.cpp:
1442         (WebCore::TileCoverageMap::TileCoverageMap):
1443         (WebCore::TileCoverageMap::update):
1444         * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
1445         (PlatformCALayerWinInternal::drawRepaintCounters):
1446         * platform/graphics/cairo/GradientCairo.cpp:
1447         (WebCore::interpolateColorStop):
1448         * platform/graphics/cg/ColorCG.cpp:
1449         (WebCore::Color::Color):
1450         * platform/graphics/cg/NativeImageCG.cpp:
1451         (WebCore::nativeImageSinglePixelSolidColor):
1452         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1453         (WebCore::colorForMarkerLineStyle):
1454         * platform/graphics/filters/FilterOperation.cpp:
1455         (WebCore::DropShadowFilterOperation::blend):
1456         * platform/graphics/mac/ColorMac.mm:
1457         (WebCore::colorFromNSColor):
1458         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
1459         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
1460         * platform/ios/DragImageIOS.mm:
1461         (WebCore::createDragImageForLink):
1462         * platform/ios/LegacyTileCache.mm:
1463         (WebCore::LegacyTileCache::colorForGridTileBorder const):
1464         * platform/win/DragImageWin.cpp:
1465         (WebCore::createDragImageForLink):
1466         * rendering/PaintInfo.h:
1467         (WebCore::PaintInfo::forcedTextColor const):
1468         * rendering/RenderEmbeddedObject.cpp:
1469         (WebCore::RenderEmbeddedObject::paintReplaced):
1470         (WebCore::replacementTextRoundedRectPressedColor): Deleted.
1471         (WebCore::replacementTextRoundedRectColor): Deleted.
1472         (WebCore::replacementTextColor): Deleted.
1473         (WebCore::unavailablePluginBorderColor): Deleted.
1474         * rendering/RenderFrameSet.cpp:
1475         (WebCore::RenderFrameSet::paintColumnBorder):
1476         (WebCore::RenderFrameSet::paintRowBorder):
1477         (WebCore::borderStartEdgeColor): Deleted.
1478         (WebCore::borderEndEdgeColor): Deleted.
1479         (WebCore::borderFillColor): Deleted.
1480         * rendering/RenderLayer.cpp:
1481         (WebCore::RenderLayer::beginTransparencyLayers):
1482         * rendering/RenderLayerBacking.cpp:
1483         (WebCore::RenderLayerBacking::paintDebugOverlays):
1484         * rendering/RenderTheme.cpp:
1485         (WebCore::RenderTheme::platformActiveSelectionBackgroundColor const):
1486         (WebCore::RenderTheme::platformInactiveSelectionBackgroundColor const):
1487         (WebCore::RenderTheme::platformTextSearchHighlightColor const):
1488         (WebCore::RenderTheme::paintSystemPreviewBadge):
1489         (WebCore::RenderTheme::platformTapHighlightColor const):
1490         * rendering/RenderTheme.h:
1491         (WebCore::RenderTheme::platformFocusRingColor const):
1492         * rendering/RenderThemeIOS.h:
1493         * rendering/RenderThemeIOS.mm:
1494         (WebCore::RenderThemeIOS::paintCheckboxDecorations):
1495         (WebCore::RenderThemeIOS::paintRadioDecorations):
1496         (WebCore::RenderThemeIOS::paintMenuListButtonDecorations):
1497         (WebCore::RenderThemeIOS::paintSliderTrack):
1498         (WebCore::RenderThemeIOS::paintProgressBar):
1499         (WebCore::paintAttachmentProgress):
1500         (WebCore::paintAttachmentBorder):
1501         (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
1502         (WebCore::RenderThemeIOS::shadowColor const): Deleted.
1503         (WebCore::attachmentBorderColor): Deleted.
1504         (WebCore::attachmentProgressColor): Deleted.
1505         * rendering/RenderThemeMac.mm:
1506         (WebCore::RenderThemeMac::paintMenuListButtonDecorations):
1507         (WebCore::titleTextColorForAttachment):
1508         (WebCore::AttachmentLayout::layOutSubtitle):
1509         (WebCore::paintAttachmentIconBackground):
1510         (WebCore::paintAttachmentTitleBackground):
1511         (WebCore::paintAttachmentProgress):
1512         (WebCore::paintAttachmentPlaceholderBorder):
1513         (WebCore::attachmentIconBackgroundColor): Deleted.
1514         (WebCore::attachmentIconBorderColor): Deleted.
1515         (WebCore::attachmentTitleInactiveBackgroundColor): Deleted.
1516         (WebCore::attachmentTitleInactiveTextColor): Deleted.
1517         (WebCore::attachmentSubtitleTextColor): Deleted.
1518         (WebCore::attachmentProgressBarBackgroundColor): Deleted.
1519         (WebCore::attachmentProgressBarFillColor): Deleted.
1520         (WebCore::attachmentProgressBarBorderColor): Deleted.
1521         (WebCore::attachmentPlaceholderBorderColor): Deleted.
1522         * rendering/RenderThemeWin.cpp:
1523         (WebCore::RenderThemeWin::platformActiveSelectionBackgroundColor const):
1524         (WebCore::RenderThemeWin::platformInactiveSelectionBackgroundColor const):
1525         (WebCore::RenderThemeWin::platformActiveSelectionForegroundColor const):
1526         (WebCore::RenderThemeWin::systemColor const):
1527         * rendering/SimpleLineLayoutFunctions.cpp:
1528         (WebCore::SimpleLineLayout::paintFlow):
1529         * rendering/mathml/RenderMathMLBlock.cpp:
1530         (WebCore::RenderMathMLBlock::paint):
1531         * rendering/style/RenderStyle.cpp:
1532         (WebCore::RenderStyle::colorResolvingCurrentColor const):
1533         * rendering/style/RenderStyle.h:
1534         (WebCore::RenderStyle::initialStrokeColor):
1535         * rendering/style/SVGRenderStyle.h:
1536         (WebCore::SVGRenderStyle::initialStopColor):
1537         (WebCore::SVGRenderStyle::initialFloodColor):
1538         (WebCore::SVGRenderStyle::initialLightingColor):
1539         * svg/SVGStopElement.cpp:
1540         (WebCore::SVGStopElement::stopColorIncludingOpacity const):
1541         * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
1542         (WebCore::SVGAnimationColorFunction::animate):
1543         * testing/MockPageOverlayClient.cpp:
1544         (WebCore::MockPageOverlayClient::drawRect):
1545         * testing/cocoa/WebViewVisualIdentificationOverlay.mm:
1546         (-[WebViewVisualIdentificationOverlay initWithWebView:kind:deprecated:]):
1547
1548 2020-06-01  Per Arne Vollan  <pvollan@apple.com>
1549
1550         [Win] When GraphicsLayerCA::m_uncommittedChanges is initialized with a non-zero value, nothing is painted.
1551         https://bugs.webkit.org/show_bug.cgi?id=168666
1552
1553         Reviewed by Maciej Stachowiak.
1554
1555         When m_uncommittedChanges is initialized with a non-zero value, client().notifyFlushRequired() will not be
1556         called in the first call to noteLayerPropertyChanged(), see https://bugs.webkit.org/show_bug.cgi?id=64808.
1557
1558         Covered by existing tests.
1559
1560         * platform/graphics/ca/GraphicsLayerCA.cpp:
1561         (WebCore::GraphicsLayerCA::initialize):
1562         * platform/graphics/ca/GraphicsLayerCA.h:
1563
1564 2020-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1565
1566         [GTK4] Add printing support
1567         https://bugs.webkit.org/show_bug.cgi?id=212320
1568
1569         Reviewed by Adrian Perez de Castro.
1570
1571         Add gtk_dialog_run() to GTK4.
1572
1573         * platform/gtk/GtkVersioning.h:
1574         (gtk_dialog_run):
1575
1576 2020-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1577
1578         [GTK4] Make inspector work
1579         https://bugs.webkit.org/show_bug.cgi?id=212321
1580
1581         Reviewed by Adrian Perez de Castro.
1582
1583         Add gtk_native_dialog_run() for GTK4.
1584
1585         * platform/gtk/GtkVersioning.h:
1586         (gtk_native_dialog_run):
1587
1588 2020-06-01  Rob Buis  <rbuis@igalia.com>
1589
1590         Rename ResourceResponseBase::isHTTP to isInHTTPFamily
1591         https://bugs.webkit.org/show_bug.cgi?id=208782
1592
1593         Reviewed by Sam Weinig.
1594
1595         As the comment says, the method name is misleading and the method
1596         is inconsistent with the API of ResourceRequestBase, so rename it
1597         to make it clear the method can be used for both http and https
1598         protocols.
1599
1600         No tests since no change in behavior.
1601
1602         * loader/DocumentLoader.cpp:
1603         (WebCore::DocumentLoader::continueAfterContentPolicy):
1604         * loader/NetscapePlugInStreamLoader.cpp:
1605         (WebCore::NetscapePlugInStreamLoader::didReceiveResponse):
1606         * platform/network/ResourceResponseBase.cpp:
1607         (WebCore::ResourceResponseBase::isInHTTPFamily const):
1608         (WebCore::ResourceResponseBase::isHTTP const): Deleted.
1609         * platform/network/ResourceResponseBase.h:
1610         * xml/XMLHttpRequest.cpp:
1611         (WebCore::XMLHttpRequest::responseMIMEType const):
1612         * xml/parser/XMLDocumentParserLibxml2.cpp:
1613         (WebCore::externalEntityMimeTypeAllowed):
1614
1615 2020-05-31  Wenson Hsieh  <wenson_hsieh@apple.com>
1616
1617         Tidy up Source/WebCore/page/DragController.h
1618         https://bugs.webkit.org/show_bug.cgi?id=212584
1619
1620         Reviewed by Anders Carlsson.
1621
1622         Unindent the `DragController` class by 1 indentation level, to adhere with
1623         <https://webkit.org/code-style-guidelines/#indentation-namespace>. Also, remove
1624         some stray trailing whitespace.
1625
1626         No change in behavior.
1627
1628         * page/DragController.h:
1629         (WebCore::DragController::mouseIsOverFileInput const):
1630         (WebCore::DragController::numberOfItemsToBeAccepted const):
1631         (WebCore::DragController::setDidInitiateDrag):
1632         (WebCore::DragController::didInitiateDrag const):
1633         (WebCore::DragController::sourceDragOperation const):
1634         (WebCore::DragController::draggingImageURL const):
1635         (WebCore::DragController::setDragOffset):
1636         (WebCore::DragController::dragOffset const):
1637         (WebCore::DragController::dragSourceAction const):
1638         (WebCore::DragController::dragHandlingMethod const):
1639         (WebCore::DragController::documentUnderMouse const):
1640         (WebCore::DragController::dragDestinationActionMask const):
1641         (WebCore::DragController::droppedImagePlaceholders const):
1642         (WebCore::DragController::droppedImagePlaceholderRange const):
1643         (WebCore::DragController::canLoadDataFromDraggingPasteboard const):
1644         (WebCore::DragController::client const):
1645
1646 2020-05-31  Dean Jackson  <dino@apple.com>
1647
1648         AutoTrader crashed while browsing search results
1649         https://bugs.webkit.org/show_bug.cgi?id=212461
1650         rdar://60733185
1651
1652         Reviewed by Sam Weinig.
1653
1654         On iOS, when using WebKit1 (UIWebView), CoreAnimation would
1655         call WebGLLayer's display method from a thread that is not
1656         the Web Thread. That method was performing some GL work using
1657         ANGLE, causing a crash.
1658
1659         Since all the WebGLLayer's display method really needs to do
1660         is swap buffers for compositing, the fix is to separate all
1661         the GL operations into a method that can be called after
1662         painting but before compositing. This should also have the added
1663         benefit that by the time CoreAnimation comes to call display
1664         on all the dirty layers, we will have already executed our
1665         expensive GPU work. The total amount of work done on the GPU
1666         is the same, but hopefully it is now all done in WebKit's
1667         paint cycle, rather than when the Window Server is trying
1668         to get CA to composite things.
1669
1670         Covered by a new API test: WebGLPrepareDisplayOnWebThread
1671
1672         * html/HTMLCanvasElement.h:
1673         * html/HTMLCanvasElement.cpp:
1674         (WebCore::HTMLCanvasElement::HTMLCanvasElement):
1675         (WebCore::HTMLCanvasElement::~HTMLCanvasElement):
1676         (WebCore::HTMLCanvasElement::didMoveToNewDocument):
1677         (WebCore::HTMLCanvasElement::removedFromAncestor):
1678             Add or remove the document as a CanvasObserver.
1679         (WebCore::HTMLCanvasElement::needsPreparationForDisplay):
1680             Signals whether this element is the type that needs preparation.
1681         (WebCore::HTMLCanvasElement::prepareForDisplay):
1682             Tell the WebGLRenderingContext it must prepare.
1683
1684         * html/canvas/WebGLRenderingContextBase.h:
1685         * html/canvas/WebGLRenderingContextBase.cpp:
1686         (WebCore::WebGLRenderingContextBase::prepareForDisplay):
1687             The WebGLRenderingContext must forward the call
1688             to prepare down to the GraphicsContextGLOpenGL.
1689
1690         * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
1691         * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
1692         * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
1693         (WebCore::GraphicsContextGLOpenGL::prepareForDisplay):
1694             And the GraphicsContextGLOpenGL forwards the call
1695             into the WebGLLayer.
1696
1697         * platform/graphics/cocoa/WebGLLayer.h:
1698         * platform/graphics/cocoa/WebGLLayer.mm:
1699         (-[WebGLLayer prepareForDisplay]):
1700         (-[WebGLLayer display]):
1701             Split the parts of the `display` method that deal
1702             with flushing the GL commands, preparing the framebuffer texture,
1703             and swapping the IOSurfaces into a new `prepareForDisplay`. This
1704             method is invoked at the end of the rendering/layout tasks, leaving
1705             the `display` method to only tell CoreAnimation about a new buffer
1706             to composite.
1707
1708         * dom/Document.cpp:
1709         * dom/Document.h:
1710         (WebCore::Document::prepareCanvasesForDisplayIfNeeded):
1711         (WebCore::Document::canvasChanged):
1712         (WebCore::Document::canvasDestroyed):
1713             Keep a set of HTMLCanvasElements that need to
1714             be prepared so we can tell them when they need to prepare.
1715             Do this by becoming a CanvasObserver, thus getting
1716             notified when a canvas has done something that
1717             would cause painting.
1718
1719         * page/Page.cpp:
1720         (WebCore::Page::doAfterUpdateRendering):
1721             Add a new task that asks the Document to notify
1722             all relevant canvas objects that they should prepare
1723             for display.
1724
1725 2020-05-31  Jer Noble  <jer.noble@apple.com>
1726
1727         [Cocoa] EME should return more helpful error code during key exchange
1728         https://bugs.webkit.org/show_bug.cgi?id=212535
1729         <rdar://problem/60439979>
1730
1731         Reviewed by Eric Carlson.
1732
1733         Clients have requested that the EME API provide more helpful information when the FairPlay CDM is unable
1734         to provide the requested level of key security. Currently, we reject the update() promise with a generic
1735         "failed" error code. Instead, resolve the promise, but mark the key as "output-restricted" in the key
1736         status map, indicating that the key cannot be used with required level of security.
1737
1738         Drive-by fix: We currently ASSERT() that the callback from removeSessionData() isn't called if the session
1739         is not a PUR session. When calling removeSessionData() on a non-PUR session, call the callback with a generic
1740         "failed" error.
1741
1742         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1743         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData):
1744         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didFailToProvideRequest):
1745         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const):
1746
1747 2020-05-31  Jer Noble  <jer.noble@apple.com>
1748
1749         [Cocoa] Transition between encrypted and clear codecs throws error from SourceBuffer.appendBuffer()
1750         https://bugs.webkit.org/show_bug.cgi?id=212550
1751         <rdar://problem/62207260>
1752
1753         Reviewed by Eric Carlson.
1754
1755         CoreMedia returns a different codec 4CC code for "encrypted AVC" than it does for "clear AVC", though
1756         the underlying codec used for both is the same. While CoreMedia does use different codec implementations
1757         for each, it is capable of freely switching between the two, and the codec string used by web developers
1758         for encrypted vs. clear content is identical. So we will treat these two codecs as "the same" as it pertains
1759         to the MSE requirement that codecs contained in new initialization segments are "the same" as previous
1760         ones. Adopt kCMFormatDescriptionExtension_ProtectedContentOriginalFormat, which can query the "original"
1761         codec used for encrypted codec playback.
1762
1763         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1764
1765 2020-05-31  Zalan Bujtas  <zalan@apple.com>
1766
1767         [iBooks] Empty pages appear in book
1768         https://bugs.webkit.org/show_bug.cgi?id=212573
1769         <rdar://problem/62912623>
1770
1771         Reviewed by Antti Koivisto.
1772
1773         Do not add a page break for orphan content unless the line does not fit anymore.
1774
1775         Test: fast/multicol/orphans-ignored.html
1776
1777         * rendering/SimpleLineLayoutPagination.cpp:
1778         (WebCore::SimpleLineLayout::setPageBreakForLine):
1779         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
1780
1781 2020-05-31  Rob Buis  <rbuis@igalia.com>
1782
1783         Implement named item condition for images
1784         https://bugs.webkit.org/show_bug.cgi?id=212473
1785
1786         Reviewed by Maciej Stachowiak.
1787
1788         Implement named item condition for images, not only should we
1789         check there are both an id and a name attribute, but also that
1790         the name attribute is non-empty [1].
1791
1792         Behavior matches Chrome and Firefox.
1793
1794         [1] https://html.spec.whatwg.org/multipage/dom.html#dom-document-nameditem-filter
1795
1796         Test: imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/nameditem-06.html
1797
1798         * html/HTMLNameCollection.cpp:
1799         (WebCore::DocumentNameCollection::elementMatchesIfIdAttributeMatch):
1800
1801 2020-05-31  Rob Buis  <rbuis@igalia.com>
1802
1803         <area> needs to be connected in order to navigate
1804         https://bugs.webkit.org/show_bug.cgi?id=177357
1805
1806         Reviewed by Maciej Stachowiak.
1807
1808         Implement second step of cannot navigate algorithm:
1809         https://html.spec.whatwg.org/#cannot-navigate
1810
1811         Test: web-platform-tests/html/semantics/links/following-hyperlinks/activation-behavior.window.html
1812
1813         * html/HTMLAnchorElement.cpp:
1814         (WebCore::HTMLAnchorElement::handleClick):
1815
1816 2020-05-30  Sam Weinig  <weinig@apple.com>
1817
1818         Extended Color: Additional color cleanups
1819         https://bugs.webkit.org/show_bug.cgi?id=212567
1820
1821         Reviewed by Simon Fraser.
1822
1823         A few unrelated quality-of-life cleanups to Color and related classes:
1824         - Rename Color::asSimpleColor() to Color::asSimple() for parity with Color::asExtended().
1825         - Move SimpleColor implementations of invertedColorWithAlpha() and asSRGBFloatComponents()
1826           to SimpleColor for parity with ExtenedColor.
1827         - Rename ExtendedColor::channels() to ExtendedColor::components() to consistency.
1828         - Adds operator[] to ColorComponents to allow direct access to components rather than
1829           requiring and additional .components[]
1830         - Using std::minmax() where possible.
1831         - Renaming colorFloatToSimpleColorByte to scaleRoundAndClampColorChannel to have a consistent 
1832           naming and location of conversion to 8-bit color channels.
1833
1834         * platform/graphics/Color.cpp:
1835         (WebCore::Color::serialized const):
1836         (WebCore::Color::cssText const):
1837         (WebCore::Color::nameForRenderTreeAsText const):
1838         (WebCore::Color::light const):
1839         (WebCore::Color::dark const):
1840         (WebCore::Color::colorWithAlpha const):
1841         (WebCore::Color::colorWithAlphaUsingAlternativeRounding const):
1842         (WebCore::Color::invertedColorWithAlpha const):
1843         (WebCore::Color::colorSpaceAndComponents const):
1844         (WebCore::Color::toSRGBASimpleColorLossy const):
1845         (WebCore::Color::toSRGBAComponentsLossy const):
1846         * platform/graphics/Color.h:
1847         (WebCore::Color::isOpaque const):
1848         (WebCore::Color::isVisible const):
1849         (WebCore::Color::alpha const):
1850         (WebCore::Color::alphaAsFloat const):
1851         (WebCore::Color::asSimple const):
1852         (WebCore::Color::isBlackColor):
1853         (WebCore::Color::isWhiteColor):
1854         (WebCore::Color::encode const):
1855         (WebCore::Color::asSimpleColor const): Deleted.
1856         * platform/graphics/ColorComponents.h:
1857         (WebCore::ColorComponents::operator[]):
1858         (WebCore::ColorComponents::operator[] const):
1859         (WebCore::=):
1860         (WebCore::perComponentMax):
1861         (WebCore::perComponentMin):
1862         * platform/graphics/ColorMatrix.h:
1863         (WebCore::Rows>::transformedColorComponents const):
1864         * platform/graphics/ColorUtilities.cpp:
1865         (WebCore::areEssentiallyEqual):
1866         (WebCore::rgbToLinearComponents):
1867         (WebCore::linearToRGBComponents):
1868         (WebCore::lightness):
1869         (WebCore::luminance):
1870         (WebCore::sRGBToHSL):
1871         (WebCore::hslToSRGB):
1872         * platform/graphics/ColorUtilities.h:
1873         (WebCore::scaleRoundAndClampColorChannel):
1874         (WebCore::scaleRoundAndClampColorChannelUsingAlternativeRounding):
1875         (WebCore::colorFloatToSimpleColorByte): Deleted.
1876         * platform/graphics/ExtendedColor.cpp:
1877         (WebCore::ExtendedColor::hash const):
1878         (WebCore::ExtendedColor::cssText const):
1879         (WebCore::ExtendedColor::colorWithAlpha const):
1880         (WebCore::ExtendedColor::invertedColorWithAlpha const):
1881         (WebCore::ExtendedColor::toSRGBAComponentsLossy const):
1882         (WebCore::ExtendedColor::isWhite const):
1883         (WebCore::ExtendedColor::isBlack const):
1884         * platform/graphics/ExtendedColor.h:
1885         (WebCore::ExtendedColor::alpha const):
1886         (WebCore::ExtendedColor::components const):
1887         (WebCore::ExtendedColor::ExtendedColor):
1888         (WebCore::operator==):
1889         (WebCore::ExtendedColor::channels const): Deleted.
1890         * platform/graphics/SimpleColor.cpp:
1891         (WebCore::makeSimpleColorFromFloats):
1892         (WebCore::makeSimpleColorFromHSLA):
1893         * platform/graphics/SimpleColor.h:
1894         (WebCore::SimpleColor::SimpleColor):
1895         (WebCore::SimpleColor::valueAsARGB const):
1896         (WebCore::SimpleColor::colorWithAlpha const):
1897         (WebCore::SimpleColor::invertedColorWithAlpha const):
1898         (WebCore::SimpleColor::asSRGBFloatComponents const):
1899         (WebCore::makeSimpleColor):
1900         * platform/graphics/cg/ColorCG.cpp:
1901         (WebCore::cachedCGColor):
1902         * platform/graphics/filters/FELighting.cpp:
1903         (WebCore::FELighting::drawLighting):
1904         * platform/graphics/filters/FETurbulence.cpp:
1905         (WebCore::toIntBasedColorComponents):
1906         * platform/graphics/filters/FilterOperation.cpp:
1907         (WebCore::BasicComponentTransferFilterOperation::transformColor const):
1908         (WebCore::InvertLightnessFilterOperation::transformColor const):
1909         (WebCore::InvertLightnessFilterOperation::inverseTransformColor const):
1910         * platform/graphics/filters/FilterOperations.cpp:
1911         (WebCore::FilterOperations::transformColor const):
1912         (WebCore::FilterOperations::inverseTransformColor const):
1913
1914 2020-05-30  Commit Queue  <commit-queue@webkit.org>
1915
1916         Unreviewed, reverting r262335.
1917         https://bugs.webkit.org/show_bug.cgi?id=212571
1918
1919         Triggered assertions in WebKit1
1920
1921         Reverted changeset:
1922
1923         "Disallow responses when a response contains invalid header
1924         values"
1925         https://bugs.webkit.org/show_bug.cgi?id=184493
1926         https://trac.webkit.org/changeset/262335
1927
1928 2020-05-30  Simon Fraser  <simon.fraser@apple.com>
1929
1930         For scroll container and scrolled contents layers, use the renderer style to set up the event regions
1931         https://bugs.webkit.org/show_bug.cgi?id=212570
1932
1933         Reviewed by Antti Koivisto.
1934
1935         RenderLayerBacking::updateEventRegion() sets up event regions on the scroll container and scrolled contents
1936         layer using the default style, in order to fill up the m_region part of EventRegion, but we might as well
1937         pass the renderer style so that it fills up the touch-action and wheel event regions as well.
1938
1939         Also re-use the existing event region trace points for region building.
1940
1941         * rendering/RenderLayerBacking.cpp:
1942         (WebCore::RenderLayerBacking::updateEventRegion):
1943
1944 2020-05-30  Andy Estes  <aestes@apple.com>
1945
1946         [Apple Pay] Support percentage border-radius values in -apple-pay-button
1947         https://bugs.webkit.org/show_bug.cgi?id=212559
1948         <rdar://problem/63781881>
1949
1950         Reviewed by Antti Koivisto.
1951
1952         Added test cases to fast/css/appearance-apple-pay-button-border-radius.html.
1953
1954         * rendering/RenderThemeCocoa.mm:
1955         (WebCore::RenderThemeCocoa::paintApplePayButton): Used floatValueForLength() to ensure
1956         percentage lengths are resolved before passing a corner radius to PassKit.
1957
1958 2020-05-29  Yusuke Suzuki  <ysuzuki@apple.com>
1959
1960         [JSC] JSBigInt allocation should be graceful for OOM
1961         https://bugs.webkit.org/show_bug.cgi?id=212512
1962
1963         Reviewed by Mark Lam.
1964
1965         * bindings/js/SerializedScriptValue.cpp:
1966         (WebCore::CloneDeserializer::readBigInt):
1967
1968 2020-05-29  Simon Fraser  <simon.fraser@apple.com>
1969
1970         Event region painting should use the same paint flags as normal painting
1971         https://bugs.webkit.org/show_bug.cgi?id=212547
1972
1973         Reviewed by Sam Weinig.
1974
1975         There are cases (see r260118) where we need to send down the correct paint flags when
1976         painting the scrolled contents layer to avoid unwanted clipping. We need to send down
1977         the one paint flag relevant for event region paints, CompositedOverflowScrollContent,
1978         for the same reasons.
1979
1980         I could not make a testcase that shows a behavior change, but I did copy the testcase
1981         from r260118 and adapt it for event-region generation to detect future behavior changes.
1982
1983         Test: fast/scrolling/mac/wheel-event-listener-region-inside-overflow-scroll-clipped-out.html
1984
1985         * rendering/RenderLayer.cpp:
1986         (WebCore::RenderLayer::paintLayerContents):
1987         (WebCore::RenderLayer::collectEventRegionForFragments):
1988         * rendering/RenderLayer.h:
1989
1990 2020-05-29  Simon Fraser  <simon.fraser@apple.com>
1991
1992         Elements with wheel event handlers inside overflow:scroll are missing from the event region
1993         https://bugs.webkit.org/show_bug.cgi?id=212545
1994
1995         Reviewed by Zalan Bujtas.
1996
1997         RenderBlock::paintObject() needs to traverse into descendants if there are are
1998         wheel event handlers on the document, just as it does for elements with touch-action.
1999
2000         Test: fast/scrolling/mac/wheel-event-listener-region-inside-overflow-scroll.html
2001
2002         * dom/Document.h:
2003         (WebCore::Document::hasTouchEventHandlers const):
2004         (WebCore::Document::hasWheelEventHandlers const):
2005         * rendering/RenderBlock.cpp:
2006         (WebCore::RenderBlock::paintObject):
2007
2008 2020-05-29  Rob Buis  <rbuis@igalia.com>
2009
2010         Disallow responses when a response contains invalid header values
2011         https://bugs.webkit.org/show_bug.cgi?id=184493
2012
2013         Reviewed by Youenn Fablet.
2014
2015         From the Fetch specification [1]:
2016         "A value is a byte sequence that matches the following conditions:
2017         "- Contains no 0x00 (NUL) or HTTP newline bytes."
2018
2019         [1] https://fetch.spec.whatwg.org/#concept-header-value
2020
2021         Tests: imported/w3c/web-platform-tests/fetch/h1-parsing/resources-with-0x00-in-header.window.html
2022                imported/web-platform-tests/fetch/api/basic/header-value-combining.any.html
2023                imported/web-platform-tests/fetch/api/basic/header-value-combining.any.worker.html
2024                imported/web-platform-tests/fetch/api/basic/header-value-null-byte.any.html
2025                imported/web-platform-tests/fetch/api/basic/header-value-null-byte.any.worker.html
2026                imported/web-platform-tests/xhr/headers-normalize-response.htm
2027
2028         * Modules/fetch/FetchHeaders.cpp:
2029         (WebCore::canWriteHeader):
2030         (WebCore::appendToHeaderMap):
2031         (WebCore::FetchHeaders::filterAndFill):
2032         * loader/DocumentThreadableLoader.cpp:
2033         (WebCore::DocumentThreadableLoader::loadRequest):
2034         * loader/SubresourceLoader.cpp:
2035         (WebCore::SubresourceLoader::didReceiveResponse):
2036         * platform/network/ResourceResponseBase.cpp:
2037         (WebCore::ResourceResponseBase::containsInvalidHTTPHeaders const):
2038         * platform/network/ResourceResponseBase.h:
2039
2040 2020-05-29  Andy Estes  <aestes@apple.com>
2041
2042         [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4)
2043         https://bugs.webkit.org/show_bug.cgi?id=212541
2044
2045         Reviewed by Darin Adler.
2046
2047         APPLE_PAY_SESSION_V(3|4) is now enabled whenever APPLE_PAY itself is enabled.
2048
2049         * Configurations/FeatureDefines.xcconfig:
2050         * Modules/applepay/ApplePayError.idl:
2051         * Modules/applepay/ApplePayPaymentAuthorizationResult.idl:
2052         * Modules/applepay/ApplePayPaymentContact.idl:
2053         * Modules/applepay/ApplePayPaymentMethodUpdate.idl:
2054         * Modules/applepay/ApplePayRequestBase.idl:
2055         * Modules/applepay/ApplePaySession.idl:
2056         * Modules/applepay/ApplePayShippingContactUpdate.idl:
2057         * Modules/applepay/ApplePayShippingMethodUpdate.idl:
2058         * Modules/applepay/PaymentCoordinatorClient.cpp:
2059         (WebCore::PaymentCoordinatorClient::supportsVersion):
2060         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
2061         (WebCore::ApplePayPaymentHandler::computePaymentMethodErrors const):
2062         * accessibility/AccessibilityRenderObject.cpp:
2063         (WebCore::AccessibilityRenderObject::applePayButtonDescription const):
2064         * css/CSSPrimitiveValueMappings.h:
2065         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2066         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const):
2067         * css/CSSValueKeywords.in:
2068         * css/parser/CSSParserFastPaths.cpp:
2069         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2070         * rendering/RenderThemeCocoa.mm:
2071         (WebCore::toPKPaymentButtonType):
2072         * rendering/style/RenderStyleConstants.cpp:
2073         (WebCore::operator<<):
2074         * rendering/style/RenderStyleConstants.h:
2075
2076 2020-05-29  Jer Noble  <jer.noble@apple.com>
2077
2078         [EME] navigator.requestMediaKeySystemAccess() should reject PUR sessionTypes in private browsing mode.
2079         https://bugs.webkit.org/show_bug.cgi?id=212540
2080         <rdar://problem/61125757>
2081
2082         Reviewed by Eric Carlson.
2083
2084         A MediaKeySystemAccess with a PUR session type will never be able to create media keys when created in
2085         private browsing mode. Allow clients to fail over to non-PUR session by rejecting the promise returned by
2086         requestMediaKeySystemAccess() when in private browsing mode.
2087
2088         Test: platform/mac/media/encrypted-media/fps-ephemeral-requestMediaKeySystemAccess.html
2089
2090         * Modules/encryptedmedia/CDM.cpp:
2091         (WebCore::CDM::getSupportedConfiguration):
2092
2093 2020-05-29  Wenson Hsieh  <wenson_hsieh@apple.com>
2094
2095         [iOS] Unable to paste images when composing mail at yahoo.com
2096         https://bugs.webkit.org/show_bug.cgi?id=212544
2097         <rdar://problem/63511613>
2098
2099         Reviewed by Megan Gardner and Andy Estes.
2100
2101         When pasting images in the mobile version of the mail compose editor on mail.yahoo.com, mail.yahoo.com's script
2102         handles the paste by allowing images to be inserted into the DOM (i.e. by not preventing the "paste" event), and
2103         then stripping away the `src` attribute of the pasted image afterwards. This leaves behind a blank space in the
2104         email.
2105
2106         Work around this by avoiding images when converting the contents of the pasteboard into web content on iOS.
2107         Instead, we fall back to inserting (sanitized) text, or nothing at all if there is no other representation
2108         suitable for converting into web content.
2109
2110         Unfortunately, the mobile version of the website is loaded on iPad as well, even when the desktop website has
2111         been requested (through sending the macOS user agent and "MacIntel" navigator platform).
2112
2113         * editing/cocoa/WebContentReaderCocoa.mm:
2114         (WebCore::WebContentReader::readImage):
2115         * page/Quirks.cpp:
2116         (WebCore::Quirks::shouldAvoidPastingImagesAsWebContent const):
2117         * page/Quirks.h:
2118
2119 2020-05-29  Darin Adler  <darin@apple.com>
2120
2121         Remove things from FeatureDefines.xcconfig that are covered by PlatformEnableCocoa.h
2122         https://bugs.webkit.org/show_bug.cgi?id=212418
2123
2124         Rubber-stamped by Simon Fraser.
2125
2126         * Configurations/FeatureDefines.xcconfig: Add back ENABLE_CSS_CONIC_GRADIENTS, removed
2127         by accident.
2128
2129 2020-05-29  Jacob Uphoff  <jacob_uphoff@apple.com>
2130
2131         Unreviewed, reverting r262289.
2132
2133         This commit caused a test to crash internally
2134
2135         Reverted changeset:
2136
2137         "MediaPlayerPrivateMediaStreamAVFObjC should enqueue samples
2138         in a background thread"
2139         https://bugs.webkit.org/show_bug.cgi?id=212073
2140         https://trac.webkit.org/changeset/262289
2141
2142 2020-05-27  Darin Adler  <darin@apple.com>
2143
2144         Remove things from FeatureDefines.xcconfig that are covered by PlatformEnableCocoa.h
2145         https://bugs.webkit.org/show_bug.cgi?id=212418
2146
2147         Reviewed by Andy Estes.
2148
2149         * Configurations/FeatureDefines.xcconfig: Removed 83 of the 119 things defined in
2150         this file. There are 36 more that are slightly more complex that we can remove
2151         carefully later.
2152
2153 2020-05-29  Darin Adler  <darin@apple.com>
2154
2155         Make generate-unified-sources.sh not depend on features being listed in FEATURE_DEFINES environment variable
2156         https://bugs.webkit.org/show_bug.cgi?id=212420
2157
2158         Currently any #if in the Sources.txt and SourcesCocoa.txt files can check only features
2159         defined in the FeatureDefines.xcconfig file, which sets up the FEATURE_DEFINES environment
2160         variable. Instead, we'd like to pass in all the things defined in the Platform.h headers
2161         as well. We accomplish that using the FEATURE_AND_PLATFORM_DEFINES variable from the
2162         DerivedSources.make file. This was the last place using FEATURE_DEFINES directly, so it
2163         frees us up to reduce FeatureDefines.xcconfig and move feature definitions to
2164         PlatformEnableCocoa.h instead, which will be less repetitive.
2165
2166         Reviewed by Andy Estes.
2167
2168         * Configurations/GenerateUnifiedSources.xcconfig: Deleted.
2169         * DerivedSources-input.xcfilelist: Updated.
2170         * DerivedSources-output.xcfilelist: Updated.
2171         * DerivedSources.make: Added a rule to invoke generate-unified-sources.sh, passing
2172         FEATURE_AND_PLATFORM_DEFINES.
2173         * Scripts/generate-unified-sources.sh: Removed hard-coded use of FEATURE_DEFINES.
2174         * UnifiedSources-output.xcfilelist: Deleted.
2175         * WebCore.xcodeproj/project.pbxproj: Removed Generate Unified Sources build step,
2176         since it's now part of Generate Derived Sources.
2177
2178 2020-05-29  Darin Adler  <darin@apple.com>
2179
2180         [Cocoa] Pass all defines from Platform.h to various scripts, not just the ones from .xcconfig
2181         https://bugs.webkit.org/show_bug.cgi?id=212451
2182
2183         Reviewed by Sam Weinig.
2184
2185         * DerivedSources.make: Run the preprocessor on Platform.h and parse the output into
2186         FEATURE_AND_PLATFORM_DEFINES. Use that and FEATURE_AND_PLATFORM_DEFINE_DEPENDENCIES
2187         whenever we need a list of defines. Also took out some Windows-specific stuff since
2188         this is now only used on Mac platforms. Use ":=" when calling $(shell) to make sure
2189         the same shell command is not invoked over and over again.
2190
2191 2020-05-29  Keith Rollin  <krollin@apple.com>
2192
2193         Revert switch to XCBuild
2194         https://bugs.webkit.org/show_bug.cgi?id=212530
2195         <rdar://problem/63764632>
2196
2197         Unreviewed build fix.
2198
2199         Bug 209890 enabled the use of XCBuild by default. Since then, some
2200         build issues have shown up. While addressing them, temporarily turn
2201         off the use of XCBuild by default.
2202
2203         No new tests -- build fix.
2204
2205         * WebCore.xcodeproj/project.pbxproj:
2206
2207 2020-05-29  Myles C. Maxfield  <mmaxfield@apple.com>
2208
2209         REGRESSION(r261940): PLT5 is 2% regressed
2210         https://bugs.webkit.org/show_bug.cgi?id=212504
2211         <rdar://problem/63685637>
2212
2213         Reviewed by Wenson Hsieh.
2214
2215         We were causing spurious style recalcs on every main frame load.
2216
2217         No new tests because there is no behavior change.
2218
2219         * page/Settings.yaml:
2220
2221 2020-05-29  Sam Weinig  <weinig@apple.com>
2222
2223         Extended Color: ColorMatrix should support smaller matrices and be constexpr
2224         https://bugs.webkit.org/show_bug.cgi?id=212477
2225
2226         Reviewed by Simon Fraser.
2227
2228         - Adds the ability to specify a ColorMatrix with any number of rows or columns,
2229           useful as most of the uses ColorMatrix did not need the full 5x4. Transformation
2230           act as-if the the ColorMatrix is the identify matrix for any rows or columns
2231           not present. For example, when transforming a ColorComponents, which is 4x1, a 
2232           3x3 ColorMatrix of the form:
2233
2234               [ a, b, c ]
2235               [ d, e, f ]
2236               [ g, h, i ]
2237               
2238           will behave as-if it looks like:
2239           
2240               [ a, b, c, 0 ]
2241               [ d, e, f, 0 ]
2242               [ g, h, i, 0 ]
2243               [ 0, 0, 0, 1 ]
2244         
2245           In practice, this means that the last component of the input vector is left
2246           unmodified.
2247
2248         - Adds ability to use ColorMatrix in constexpr statements, which will be useful
2249           for compile time concatenation of colorspace conversion matrices in a future
2250           change but is also useful for improved space efficiency of constant matrices
2251           already used.
2252
2253         * Sources.txt:
2254         * WebCore.xcodeproj/project.pbxproj:
2255         Remove ColorMatrix.cpp
2256
2257         * platform/graphics/ColorComponents.h:
2258         (WebCore::ColorComponents::ColorComponents):
2259         (WebCore::ColorComponents::operator+=):
2260         (WebCore::ColorComponents::operator+ const):
2261         (WebCore::ColorComponents::operator/ const):
2262         (WebCore::ColorComponents::operator* const):
2263         (WebCore::ColorComponents::abs const):
2264         (WebCore::ColorComponents::get const):
2265         (WebCore::perComponentMax):
2266         (WebCore::perComponentMin):
2267         (WebCore::operator==):
2268         (WebCore::operator!=):
2269         Make everything constexpr and move implementations out of the declarations for clarity.
2270
2271         * platform/graphics/ColorMatrix.cpp: Removed.
2272         * platform/graphics/ColorMatrix.h:
2273         (WebCore::ColorMatrix::ColorMatrix):
2274         (WebCore::ColorMatrix::at const):
2275         (WebCore::grayscaleColorMatrix):
2276         (WebCore::sepiaColorMatrix):
2277         (WebCore::saturationColorMatrix):
2278         (WebCore::hueRotateColorMatrix):
2279         (WebCore::ColorMatrix::transformColorComponents):
2280         (WebCore::ColorMatrix::transformedColorComponents):
2281         Re-write as a class templatized on the number of rows and columns. Moves factory functions
2282         out of the class to avoid awkwardness of having to specify a dummy size when calling them 
2283         (e.g. we wouldn't want you to have to write ColorMatrix<3, 3>::grayscaleMatrix(), instead
2284         just grayscaleColorMatrix() is much nicer).
2285
2286         * platform/graphics/ColorUtilities.cpp:
2287         (WebCore::xyzToLinearSRGB):
2288         (WebCore::linearSRGBToXYZ):
2289         (WebCore::XYZToLinearP3):
2290         (WebCore::linearP3ToXYZ):
2291         * platform/graphics/filters/FilterOperation.cpp:
2292         (WebCore::BasicColorMatrixFilterOperation::transformColor const):
2293         (WebCore::InvertLightnessFilterOperation::transformColor const):
2294         (WebCore::InvertLightnessFilterOperation::inverseTransformColor const):
2295         Adopt new ColorMatrix interface.
2296
2297         * platform/graphics/filters/FilterOperation.h:
2298         Remove unnecessary T in forward declaration.
2299
2300         * platform/graphics/ColorUtilities.h:
2301         (WebCore::fastMultiplyBy255):
2302         (WebCore::fastDivideBy255):
2303         Add some missing constexprs.
2304
2305 2020-05-29  Commit Queue  <commit-queue@webkit.org>
2306
2307         Unreviewed, reverting r262245.
2308         https://bugs.webkit.org/show_bug.cgi?id=212531
2309
2310         "Caused WebCore's 'Check .xcfilelists' build phase to be ~100x
2311         slower"
2312
2313         Reverted changeset:
2314
2315         "[Cocoa] Pass all defines from Platform.h to various scripts,
2316         not just the ones from .xcconfig"
2317         https://bugs.webkit.org/show_bug.cgi?id=212451
2318         https://trac.webkit.org/changeset/262245
2319
2320 2020-05-29  Sergio Villar Senin  <svillar@igalia.com>
2321
2322         Unreviewed build fix after r262299
2323
2324         We replaced ScriptExecutionContext* by Document& in WebXRSpace hierarchy, so the
2325         failing ASSERT() was:
2326         1. Invalid, there is no "context" parameter but "document"
2327         2. Not needed anymore, as we're passing a reference
2328
2329         * Modules/webxr/WebXRSpace.cpp:
2330         (WebCore::WebXRSpace::WebXRSpace): Removed invalid ASSERT().
2331
2332 2020-05-27  Sergio Villar Senin  <svillar@igalia.com>
2333
2334         [WebXR] Implement XRSession::requestReferenceSpace()
2335         https://bugs.webkit.org/show_bug.cgi?id=212407
2336
2337         Reviewed by Youenn Fablet.
2338
2339         This patch implements the requestReferenceSpace() method of the XRSession which is used to
2340         create reference spaces. A reference space establishes a space where pose data will be defined
2341         and thus is mandatory to retrieve that pose information.
2342
2343         There are still some bits that have to implementated in follow up patches using platform code.
2344
2345         * Modules/webxr/WebXRBoundedReferenceSpace.cpp:
2346         (WebCore::WebXRBoundedReferenceSpace::create): Added.
2347         (WebCore::WebXRBoundedReferenceSpace::WebXRBoundedReferenceSpace): Ditto.
2348         * Modules/webxr/WebXRBoundedReferenceSpace.h:
2349         * Modules/webxr/WebXRReferenceSpace.cpp:
2350         (WebCore::WebXRReferenceSpace::create): Added.
2351         (WebCore::WebXRReferenceSpace::WebXRReferenceSpace): Ditto.
2352         (WebCore::WebXRReferenceSpace::getOffsetReferenceSpace): Use the create() method.
2353         * Modules/webxr/WebXRReferenceSpace.h:
2354         * Modules/webxr/WebXRSession.cpp:
2355         (WebCore::WebXRSession::referenceSpaceIsSupported const): New method to check whether a reference.
2356         space is supported by session and device.
2357         (WebCore::WebXRSession::requestReferenceSpace): New method that creates reference spaces for pose data.
2358         * Modules/webxr/WebXRSession.h:
2359         * Modules/webxr/WebXRSpace.cpp:
2360         (WebCore::WebXRSpace::WebXRSpace): Store a reference to the session creating the space.
2361         * Modules/webxr/WebXRSpace.h:
2362
2363 2020-05-29  Simon Fraser  <simon.fraser@apple.com>
2364
2365         Update debug overlays at rendering update time
2366         https://bugs.webkit.org/show_bug.cgi?id=212510
2367
2368         Reviewed by Antoine Quint.
2369
2370         Don't eagerly update the regions in debug overlays when things change; this triggers
2371         assertions for touch event overlays.
2372
2373         Instead, just mark them dirty and update the regions at "update the rendering" time.
2374
2375         * page/DebugPageOverlays.cpp:
2376         (WebCore::RegionOverlay::setRegionChanged):
2377         (WebCore::RegionOverlay::didMoveToPage):
2378         (WebCore::RegionOverlay::recomputeRegion):
2379         (WebCore::DebugPageOverlays::regionChanged):
2380         (WebCore::DebugPageOverlays::updateRegionIfNecessary):
2381         * page/DebugPageOverlays.h:
2382         (WebCore::DebugPageOverlays::doAfterUpdateRendering):
2383         * page/Page.cpp:
2384         (WebCore::Page::doAfterUpdateRendering):
2385
2386 2020-05-29  Simon Fraser  <simon.fraser@apple.com>
2387
2388         Prepare for async scrolling in passive wheel event handler regions
2389         https://bugs.webkit.org/show_bug.cgi?id=212455
2390
2391         Reviewed by Tim Horton.
2392
2393         Clarify the processing for wheel events by adding OptionSet<WheelEventProcessingSteps>,
2394         which will, in future, allow us to describe the processing for an event in the passive
2395         event handler region which does scrolling on the scrolling thread, and is then sent
2396         to the main thread for DOM event dispatch.
2397         
2398         Removed ScrollingEventResult, which conflated "handled" with "send to another thread".
2399         The thread sending behavior is now encoded in the WheelEventProcessingSteps, and we can just
2400         use a bool for handled.
2401         
2402         Scrolling tree and node handleWheelEvent() functions return a WheelEventHandlingResult, which
2403         is a tuple of OptionSet<WheelEventProcessingSteps> and 'handled', allowing for a node with
2404         background-attachment:fixed to add the "send to main thread" processing step.
2405
2406         * page/FrameView.cpp:
2407         (WebCore::FrameView::wheelEvent):
2408         * page/scrolling/ScrollingCoordinator.h:
2409         (WebCore::ScrollingCoordinator::handleWheelEvent):
2410         * page/scrolling/ScrollingCoordinatorTypes.h:
2411         * page/scrolling/ScrollingTree.cpp:
2412         (WebCore::ScrollingTree::determineWheelEventProcessing):
2413         (WebCore::ScrollingTree::handleWheelEvent):
2414         (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously): Deleted.
2415         * page/scrolling/ScrollingTree.h:
2416         (WebCore::WheelEventHandlingResult::needsMainThreadProcessing const):
2417         (WebCore::WheelEventHandlingResult::handled):
2418         (WebCore::WheelEventHandlingResult::unhandled):
2419         (WebCore::WheelEventHandlingResult::result):
2420         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2421         (WebCore::ScrollingTreeScrollingNode::handleWheelEvent):
2422         * page/scrolling/ScrollingTreeScrollingNode.h:
2423         * page/scrolling/ThreadedScrollingTree.cpp:
2424         (WebCore::ThreadedScrollingTree::handleWheelEvent):
2425         (WebCore::ThreadedScrollingTree::handleWheelEventAfterMainThread):
2426         * page/scrolling/ThreadedScrollingTree.h:
2427         * page/scrolling/mac/ScrollingCoordinatorMac.h:
2428         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
2429         (WebCore::ScrollingCoordinatorMac::handleWheelEvent):
2430         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
2431         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2432         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
2433         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
2434         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
2435         (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent):
2436         * platform/PlatformWheelEvent.cpp:
2437         (WebCore::operator<<):
2438         * platform/PlatformWheelEvent.h:
2439
2440 2020-05-29  Sergio Villar Senin  <svillar@igalia.com>
2441
2442         [WebXR] ActiveDOMObjects must call suspendIfNeeded() upon creation
2443         https://bugs.webkit.org/show_bug.cgi?id=212517
2444
2445         Reviewed by Žan Doberšek.
2446
2447         We weren't calling suspendIfNeeded() upon ActiveDOMObjects creation (XRSession and XRSystem)
2448         and that was triggering ASSERTION FAILED: m_suspendIfNeededWasCalled.
2449
2450         No new tests required as this was already detected by existing tests.
2451
2452         * Modules/webxr/WebXRSession.cpp:
2453         (WebCore::WebXRSession::WebXRSession): Call suspendIfNeeded().
2454         * Modules/webxr/WebXRSystem.cpp:
2455         (WebCore::WebXRSystem::WebXRSystem): Call suspendIfNeeded().
2456
2457 2020-05-29  Sergio Villar Senin  <svillar@igalia.com>
2458
2459         [WebXR] WebXRSystem::unregisterSimulatedXRDeviceForTesting() ASSERTs in m_immersiveDevices.contains(device)
2460         https://bugs.webkit.org/show_bug.cgi?id=212516
2461
2462         Reviewed by Žan Doberšek.
2463
2464         The ASSERT that was failing was wrong. It was assuming that every simulated device should be part of the list
2465         of immersive devices. That's wrong, as devices only supporting inline sessions are not in that list.
2466
2467         Apart from that, fake devices were not removed from the list of available devices in WebXRTest after
2468         disconnecting them all. That could potentially cause flakiness in the tests.
2469
2470         No new test required as the current tests were properly detecting the issue.
2471
2472         * Modules/webxr/WebXRSystem.cpp:
2473         (WebCore::WebXRSystem::registerSimulatedXRDeviceForTesting): Use XRSessionMode directly.
2474         (WebCore::WebXRSystem::unregisterSimulatedXRDeviceForTesting): Fixed the ASSERT. A simulated device
2475         might not be in the list of immersive devices if only supports inline sessions.
2476         * testing/WebXRTest.cpp:
2477         (WebCore::WebXRTest::disconnectAllDevices): Clear the list of devices after disconnecting.
2478
2479 2020-05-29  Youenn Fablet  <youenn@apple.com>
2480
2481         MediaPlayerPrivateMediaStreamAVFObjC should enqueue samples in a background thread
2482         https://bugs.webkit.org/show_bug.cgi?id=212073
2483
2484         Reviewed by Eric Carlson.
2485
2486         Do not hop to the main thread when rendering video samples anymore.
2487         Instead, we enqueue to the display layer in the background thread but still hop to the main thread for two things:
2488         - Update of various states of the player
2489         - keep a ref to the video sample if canvas rendering is needed.
2490
2491         Most display layer operations stay in the main thread (creation, flushing...).
2492         Deletion of the display layer and access from a background are covered by a lock.
2493         The m_canEnqueueDisplayLayer boolean ensures we do not enqueue too early when the display layer is not yet properly initialized.
2494
2495         LocalSampleBufferDisplayLayer needs to handle the fact that enqueueing might be done in a background thread.
2496         Instead of introducing a lock, we introduce a work queue and we hop to this queue whenever we need to enqueue/mutate the pending samples.
2497
2498         Covered by existing tests and manual testing.
2499
2500         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h:
2501         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
2502         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
2503         (WebCore::LocalSampleBufferDisplayLayer::enqueueSample):
2504         (WebCore::LocalSampleBufferDisplayLayer::enqueueSampleBuffer):
2505         (WebCore::LocalSampleBufferDisplayLayer::requestNotificationWhenReadyForVideoData):
2506         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2507         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2508         (WebCore::videoTransformationMatrix):
2509         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::processNewVideoSampleAvailable):
2510         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable):
2511         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive):
2512         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::flushRenderers):
2513         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
2514         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
2515         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateRenderingMode):
2516         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
2517         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext):
2518         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setBufferingPolicy):
2519         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rootLayerBoundsDidChange):
2520         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoTransformationMatrix): Deleted.
2521         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueCorrectedVideoSample): Deleted.
2522         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayLayer): Deleted.
2523
2524 2020-05-29  Carlos Garcia Campos  <cgarcia@igalia.com>
2525
2526         [GTK4] Implement script dialogs
2527         https://bugs.webkit.org/show_bug.cgi?id=212318
2528
2529         Reviewed by Adrian Perez de Castro.
2530
2531         Add more definitions to avoid ifdefs.
2532
2533         * platform/gtk/GtkVersioning.h:
2534         (gtk_entry_set_text):
2535         (gtk_entry_get_text):
2536         (gtk_label_set_line_wrap):
2537         (gtk_window_set_default):
2538         (gtk_widget_add_css_class):
2539
2540 2020-05-28  Andy Estes  <aestes@apple.com>
2541
2542         [Apple Pay] Buttons render with a corner radius of PKApplePayButtonDefaultCornerRadius even when explicitly specifying "border-radius: 0px"
2543         https://bugs.webkit.org/show_bug.cgi?id=212476
2544         <rdar://problem/63401433>
2545
2546         Reviewed by Antti Koivisto.
2547
2548         r256648 added support for customizing the corner radius of Apple Pay buttons using the
2549         border-radius CSS property. PassKit buttons have a default corner radius of 4, but
2550         border-radius has an initial value of 0, so to maintain web compatibility with existing
2551         buttons we only want to customize the corner radius when a border-radius value has been
2552         explicitly specified (otherwise, previously rounded buttons would all become squared off due
2553         to border-radius's initial value).
2554
2555         r256648 checked for a non-initial border-radius by calling RenderStyle::hasBorderRadius, but
2556         this check does not distinguish between an initial value and an explicit declaration of
2557         "border-radius: 0px". As a result, authors are unable to create Apple Pay buttons with
2558         square corners.
2559
2560         This patch adds a flag to RenderStyle::NonInheritedFlags that tracks whether any
2561         border-radius longhand has been explicitly set (or has explicitly inherited an explicitly set
2562         value), and uses that flag to adjust the computed border radius for Apple Pay buttons.
2563
2564         The addition of RenderStyle::NonInheritedFlags::hasExplicitlySetBorderRadius did not change
2565         the size of RenderStyle.
2566
2567         Tests: fast/css/appearance-apple-pay-button-border-radius.html
2568                fast/css/getComputedStyle/computed-style-apple-pay-button.html
2569
2570         * css/CSSProperties.json:
2571         * rendering/RenderThemeCocoa.mm:
2572         (WebCore::RenderThemeCocoa::adjustApplePayButtonStyle const):
2573         (WebCore::RenderThemeCocoa::paintApplePayButton):
2574         (WebCore::largestCornerRadius): Deleted.
2575         * rendering/style/RenderStyle.cpp:
2576         (WebCore::RenderStyle::RenderStyle):
2577         * rendering/style/RenderStyle.h:
2578         (WebCore::RenderStyle::hasExplicitlySetBorderRadius const):
2579         (WebCore::RenderStyle::setHasExplicitlySetBorderRadius):
2580         (WebCore::RenderStyle::NonInheritedFlags::operator== const):
2581         (WebCore::RenderStyle::NonInheritedFlags::copyNonInheritedFrom):
2582         * style/StyleBuilderCustom.h:
2583         (WebCore::Style::BuilderCustom::applyInheritBorderBottomLeftRadius):
2584         (WebCore::Style::BuilderCustom::applyValueBorderBottomLeftRadius):
2585         (WebCore::Style::BuilderCustom::applyInheritBorderBottomRightRadius):
2586         (WebCore::Style::BuilderCustom::applyValueBorderBottomRightRadius):
2587         (WebCore::Style::BuilderCustom::applyInheritBorderTopLeftRadius):
2588         (WebCore::Style::BuilderCustom::applyValueBorderTopLeftRadius):
2589         (WebCore::Style::BuilderCustom::applyInheritBorderTopRightRadius):
2590         (WebCore::Style::BuilderCustom::applyValueBorderTopRightRadius):
2591
2592 2020-05-28  Andy Estes  <aestes@apple.com>
2593
2594         Shrink StyleRareNonInheritedData by 8 bytes (on 64-bit platforms)
2595         https://bugs.webkit.org/show_bug.cgi?id=212484
2596
2597         Reviewed by Tim Horton.
2598
2599         There were 4 bytes of padding after shapeImageThreshold, enough to fit order and shrink the
2600         overall size of StyleRareNonInheritedData by 8 bytes on 64-bit platforms.
2601
2602         Before:
2603         Total byte size: 480
2604         Total pad bytes: 50
2605         Padding percentage: 10.42 %
2606
2607         After:
2608         Total byte size: 472
2609         Total pad bytes: 42
2610         Padding percentage: 8.90 %
2611
2612         * rendering/style/StyleRareNonInheritedData.cpp:
2613         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
2614         (WebCore::StyleRareNonInheritedData::operator== const):
2615         * rendering/style/StyleRareNonInheritedData.h:
2616
2617 2020-05-28  Megan Gardner  <megan_gardner@apple.com>
2618
2619         Responding to post commit review comments for https://bugs.webkit.org/show_bug.cgi?id=212060
2620
2621         * editing/InsertIntoTextNodeCommand.cpp:
2622         (WebCore::InsertIntoTextNodeCommand::doApply):
2623
2624 2020-05-28  Simon Fraser  <simon.fraser@apple.com>
2625
2626         Simplify EventDispatcher wheel event dispatch
2627         https://bugs.webkit.org/show_bug.cgi?id=212490
2628
2629         Reviewed by Tim Horton.
2630
2631         The various cross-thread bounces and completion lambdas in EventDispatcher::wheelEvent()
2632         and ScrollingTree code made the logic very hard to follow.
2633
2634         Moving the ScrollingThread::dispatch() into EventHandler code simplifies things a little,
2635         and allows for removal of the hokey "try to handle" ScrollingTree function, as well
2636         as the clunky completion function.
2637
2638         Now, EventHandler call shouldHandleWheelEventSynchronously(), then does the
2639         ScrollingThread::dispatch() which allows the lambda to easily call back into
2640         EventHandler for the main thread dispatch.
2641
2642         * page/scrolling/ScrollingTree.h:
2643         * page/scrolling/ThreadedScrollingTree.cpp:
2644         (WebCore::ThreadedScrollingTree::tryToHandleWheelEvent): Deleted.
2645         * page/scrolling/ThreadedScrollingTree.h:
2646
2647 2020-05-28  Oriol Brufau  <obrufau@igalia.com>
2648
2649         [css-grid] Fix referencing grid line names with auto repeat()
2650         https://bugs.webkit.org/show_bug.cgi?id=209572
2651
2652         Reviewed by Darin Adler.
2653
2654         This patch fixes multiple problems when referencing named grid lines with the presence of
2655         the auto repeat() syntax:
2656
2657           - If the 1st track was defined with auto repeat(), then the code used to assume that the
2658             referenced line appeared after the repeated tracks. But it may actually precede them.
2659
2660           - If the referenced line appeared both inside and outside the auto repeat(), then it
2661             could resolve to the outside raw index, without expanding the auto repeat().
2662
2663           - The logic for placing a placement property set to both an integer and an identifier
2664             was wrong with auto repeat().
2665             This patch fixes it by using the same proper logic that was already implemented in
2666             OrderedNamedLinesCollectorInGridLayout::collectLineNamesForIndex
2667
2668           - The indices of both implicit grid lines defined with grid-template-areas and explicit
2669             ones defined with grid-template-rows/columns used to be stored together in
2670             NamedGridColumnLines and NamedGridRowLines. This was problematic because the former
2671             indices already refer to the final explicit grid so they don't have to be increased when
2672             expanding an auto repeat(), but the latter ones should.
2673             Therefore, this patch stores the indices in separate fields and uses the correct logic
2674             for each one. This also fixes 'grid-template-areas: inherit'.
2675
2676         This patch is a port of these Chromium patches:
2677           - https://crrev.com/744426
2678           - https://crrev.com/745925
2679           - https://crrev.com/747631
2680           - https://crrev.com/747669
2681           - https://crrev.com/771984
2682
2683         Tests: imported/w3c/web-platform-tests/css/css-grid/placement/grid-placement-using-named-grid-lines-002.html
2684                imported/w3c/web-platform-tests/css/css-grid/placement/grid-placement-using-named-grid-lines-004.html
2685                imported/w3c/web-platform-tests/css/css-grid/placement/grid-placement-using-named-grid-lines-005.html
2686                imported/w3c/web-platform-tests/css/css-grid/placement/grid-placement-using-named-grid-lines-008.html
2687                imported/w3c/web-platform-tests/css/css-grid/placement/grid-placement-using-named-grid-lines-009.html
2688
2689         * rendering/style/GridPositionsResolver.cpp:
2690         (WebCore::NamedLineCollection::NamedLineCollection):
2691         (WebCore::NamedLineCollection::hasExplicitNamedLines const):
2692         (WebCore::NamedLineCollection::hasNamedLines const):
2693         (WebCore::NamedLineCollection::contains const):
2694         (WebCore::NamedLineCollection::firstExplicitPosition const):
2695         (WebCore::NamedLineCollection::firstPosition const):
2696         * rendering/style/GridPositionsResolver.h:
2697         * rendering/style/RenderStyle.h:
2698         (WebCore::RenderStyle::implicitNamedGridColumnLines const):
2699         (WebCore::RenderStyle::implicitNamedGridRowLines const):
2700         (WebCore::RenderStyle::setImplicitNamedGridColumnLines):
2701         (WebCore::RenderStyle::setImplicitNamedGridRowLines):
2702         * rendering/style/StyleGridData.cpp:
2703         (WebCore::StyleGridData::StyleGridData):
2704         * rendering/style/StyleGridData.h:
2705         (WebCore::StyleGridData::operator== const):
2706         * style/StyleBuilderCustom.h:
2707         (WebCore::Style::BuilderCustom::applyInitialGridTemplateAreas):
2708         (WebCore::Style::BuilderCustom::applyInheritGridTemplateAreas):
2709         (WebCore::Style::BuilderCustom::applyValueGridTemplateAreas):
2710
2711 2020-05-28  Andres Gonzalez  <andresg_22@apple.com>
2712
2713         [ macOS Debug ] accessibility/roles-exposed.html is a flaky timeout
2714         https://bugs.webkit.org/show_bug.cgi?id=212478
2715         <rdar://problem/63411656>
2716
2717         Reviewed by Chris Fleizach.
2718
2719         Logging the backingObject in every call to accessibilityAttributeValue
2720         seems to be causing this long test to take too long and timeout in slow
2721         systems.
2722
2723         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2724         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2725
2726 2020-05-27  Keith Miller  <keith_miller@apple.com>
2727
2728         for-of should check the iterable is a JSArray for FastArray in DFG iterator_open
2729         https://bugs.webkit.org/show_bug.cgi?id=212383
2730
2731         Reviewed by Saam Barati.
2732
2733         Update various InheritsTraits specializations to contain a typeRange member.
2734         Also, change the inherits function to use inheritsJSTypeImpl like the JSC
2735         variants.
2736
2737         * bindings/js/JSDocumentCustom.h:
2738         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSDocument>::inherits):
2739         * bindings/js/JSElementCustom.h:
2740         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSElement>::inherits):
2741         * bindings/js/JSEventCustom.h:
2742         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSEvent>::inherits):
2743         * bindings/js/JSNodeCustom.h:
2744         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSNode>::inherits):
2745         * bindings/scripts/CodeGeneratorJS.pm:
2746         (GenerateHeader):
2747
2748 2020-05-27  Darin Adler  <darin@apple.com>
2749
2750         [Cocoa] Pass all defines from Platform.h to various scripts, not just the ones from .xcconfig
2751         https://bugs.webkit.org/show_bug.cgi?id=212451
2752
2753         Reviewed by Sam Weinig.
2754
2755         * DerivedSources.make: Run the preprocessor on Platform.h and parse the output into
2756         FEATURE_AND_PLATFORM_DEFINES. Use that and FEATURE_AND_PLATFORM_DEFINE_DEPENDENCIES
2757         whenever we need a list of defines. Also took out some Windows-specific stuff since
2758         this is now only used on Mac platforms.
2759
2760 2020-05-27  Simon Fraser  <simon.fraser@apple.com>
2761
2762         ScrollingTreeMac::eventListenerRegionTypesForPoint() needs to convert the point to local coordinates
2763         https://bugs.webkit.org/show_bug.cgi?id=212440
2764
2765         Reviewed by Tim Horton.
2766
2767         ScrollingTreeMac::eventListenerRegionTypesForPoint() needs to convert the point to local coordinates
2768         before consulting the event region.
2769
2770         Also made EventListenerRegionType loggabale.
2771
2772         Will be tested by wheel event tests once we switch to using these kinds of regions.
2773
2774         * page/scrolling/mac/ScrollingTreeMac.mm:
2775         (collectDescendantLayersAtPoint):
2776         (ScrollingTreeMac::scrollingNodeForPoint):
2777         (ScrollingTreeMac::eventListenerRegionTypesForPoint const):
2778         * rendering/style/RenderStyleConstants.cpp:
2779         (WebCore::operator<<):
2780         * rendering/style/RenderStyleConstants.h:
2781
2782 2020-05-28  Youenn Fablet  <youenn@apple.com>
2783
2784         RealtimeIncomingVideoSourceCocoa::OnFrame should use video frame timestamp
2785         https://bugs.webkit.org/show_bug.cgi?id=212402
2786
2787         Reviewed by Eric Carlson.
2788
2789         Use timestamp provided from the libwebrtc backend instread of marking the frames as display immediately.
2790         Update LocalSampleBufferDisplayLayer to mark the frame as display immediately if their presentation time is in the past since we guarantee the frames are in order.
2791
2792         Remove the offset correction in MediaPlayerPrivateMediaStreamAVFObjC.
2793         This does not work well when the display layer is in GPU process and it is simpler to use the system clock which is what AVSampleBufferDisplayLayser is using if controlTimebase is not set.
2794
2795         Manually tested.
2796
2797         * platform/graphics/avfoundation/SampleBufferDisplayLayer.h:
2798         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
2799         (WebCore::LocalSampleBufferDisplayLayer::enqueueSample):
2800         (WebCore::LocalSampleBufferDisplayLayer::removeOldSamplesFromPendingQueue):
2801         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2802         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2803         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
2804         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable):
2805         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferDisplayLayerStatusDidChange):
2806         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive):
2807         * platform/mediastream/VideoTrackPrivateMediaStream.h:
2808         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
2809         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
2810
2811 2020-05-28  Antti Koivisto  <antti@apple.com>
2812
2813         Incorrect clipping of absolute and fixed elements inside stacking-context composited overflow:hidden
2814         https://bugs.webkit.org/show_bug.cgi?id=212419
2815         <rdar://problem/55856170>
2816
2817         Reviewed by Simon Fraser.
2818
2819         We incorrectly clip descendants that are not in containing block chain.
2820         There is already code to do the correct clipping, it just needs be enabled in this case.
2821
2822         Tests: compositing/overflow/non-contained-descendant-clipping-absolute.html
2823                compositing/overflow/non-contained-descendant-clipping-fixed.html
2824
2825         * rendering/RenderLayer.cpp:
2826         (WebCore::RenderLayer::RenderLayer):
2827         * rendering/RenderLayer.h:
2828
2829         Add hasCompositedNonContainedDescendants bit.
2830
2831         * rendering/RenderLayerCompositor.cpp:
2832         (WebCore::RenderLayerCompositor::CompositingState::stateForPaintOrderChildren const):
2833         (WebCore::RenderLayerCompositor::CompositingState::updateWithDescendantStateAndLayer):
2834
2835         Check if the parent layer is for a containing block of this layer.
2836
2837         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
2838
2839         Update the bit.
2840
2841         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
2842         (WebCore::RenderLayerCompositor::clipsCompositingDescendants):
2843
2844         Pick the clipping path where descendants are not clipped.
2845
2846 2020-05-27  Noam Rosenthal  <noam@webkit.org>
2847
2848         Implement AccessKeyLabel attribute.
2849         https://bugs.webkit.org/show_bug.cgi?id=72715
2850
2851         Spec: https://html.spec.whatwg.org/multipage/interaction.html#dom-accesskeylabel
2852
2853         As per spec, return the modifiers+accessKey when requesting the element accessKeyLabel.
2854
2855         Equivalent to the existing Firefox implementation and (pending) Chrome implementation.
2856
2857         Alt is the hardcoded modifier for any non-cocoa platform, so hardcode it also for the label.
2858         Use modifier text for Mac/iOS as it can change (e.g. for voice-over).
2859
2860         Reviewed by Darin Adler.
2861
2862         Test: fast/forms/access-key-label.html
2863
2864         * html/HTMLElement.cpp:
2865         (WebCore::HTMLElement::accessKeyLabel const):
2866         * html/HTMLElement.h:
2867         * html/HTMLElement.idl:
2868
2869 2020-05-27  Sam Weinig  <weinig@apple.com>
2870
2871         Extended Color: Refactor FloatComponents and ColorComponents into a single templatized ColorComponents class
2872         https://bugs.webkit.org/show_bug.cgi?id=212446
2873
2874         Reviewed by Simon Fraser.
2875
2876         Merge FloatComponents and ColorComponents into ColorComponents<T> and move them to their own
2877         header. This avoids duplicate code and paves the way for further generalization down the line.
2878         
2879         Also moves some utility functions to ColorUtilities.h from SimpleColor.h as they make more sense
2880         in the former.
2881
2882         * Headers.cmake:
2883         * WebCore.xcodeproj/project.pbxproj:
2884         Add ColorComponents.h
2885
2886         * platform/graphics/ColorComponents.h: Copied from Source/WebCore/platform/graphics/ColorUtilities.h.
2887         Moved ColorComponents to its own header and templatized it to allow it to serve the
2888         needs of both the old ColorComponents and old FloatComponents classes.
2889         
2890         * platform/graphics/ColorUtilities.cpp:
2891         * platform/graphics/ColorUtilities.h:
2892         Removed ColorComponents/FloatComponents and update existing usages to their new names.
2893         Also moved roundAndClampColorChannel, fastMultiplyBy255, fastDivideBy255 
2894         and colorFloatToSimpleColorByte here from SimpleColor to make it clear where
2895         general helper functions can go.
2896         
2897         * platform/graphics/Color.h:
2898         * platform/graphics/Color.cpp:
2899         (WebCore::Color::colorSpaceAndComponents const):
2900         (WebCore::Color::toSRGBAComponentsLossy const):
2901         * platform/graphics/ExtendedColor.h:
2902         (WebCore::ExtendedColor::channels const):
2903         Update for rename of FloatComponents to ColorComponents<float>.
2904
2905         * platform/graphics/SimpleColor.cpp:
2906         (WebCore::makeSimpleColorFromHSLA):
2907         Use structured bindings and simplify code. 
2908
2909         * platform/graphics/SimpleColor.h:
2910         (WebCore::roundAndClampColorChannel): Deleted.
2911         (WebCore::fastMultiplyBy255): Deleted.
2912         (WebCore::fastDivideBy255): Deleted.
2913         (WebCore::colorFloatToSimpleColorByte): Deleted.
2914         As noted above, moved roundAndClampColorChannel, fastMultiplyBy255, fastDivideBy255 
2915         and colorFloatToSimpleColorByte to ColorUtilities.h
2916
2917         * platform/graphics/filters/FEColorMatrix.cpp:
2918         Update for rename of FloatComponents to ColorComponents<float>.
2919
2920         * platform/graphics/filters/FEDisplacementMap.cpp:
2921         (WebCore::byteOffsetOfPixel):
2922         Moved byteOffsetOfPixel here from ColorUtilities. This file is the only user
2923         and it wasn't general in a way that was clear for other users.
2924
2925         * platform/graphics/filters/FELighting.cpp:
2926         (WebCore::FELighting::drawLighting):
2927         Update for rename of FloatComponents to ColorComponents<float>.
2928
2929         * platform/graphics/filters/FEMorphology.cpp:
2930         (WebCore::makeColorComponentsfromPixelValue):
2931         Added. Used to be ColorComponents::fromRGBA(), but was only used here
2932         and didn't seem generally useful.
2933
2934         (WebCore::makePixelValueFromColorComponents):
2935         Added. Used to be ColorComponents::toRGBA(), but was only used here
2936         and didn't seem generally useful.
2937         
2938         (WebCore::minOrMax):
2939         (WebCore::columnExtremum):
2940         (WebCore::kernelExtremum):
2941         (WebCore::FEMorphology::platformApplyGeneric):
2942         Update for rename of FloatComponents to ColorComponents<float> and ColorComponents
2943         to ColorComponents<uint8_t>.
2944
2945         * platform/graphics/filters/FETurbulence.cpp:
2946         (WebCore::FETurbulence::noise2D const):
2947         (WebCore::toIntBasedColorComponents):
2948         (WebCore::FETurbulence::calculateTurbulenceValueForPoint const):
2949         (WebCore::FETurbulence::fillRegion const):
2950         * platform/graphics/filters/FETurbulence.h:
2951         Update for rename of FloatComponents to ColorComponents<float> and ColorComponents
2952         to ColorComponents<uint8_t>. Also renames toColorComponents to toIntBasedColorComponents
2953         as the former was no longer specific enough. Updated to use std::clamp.
2954
2955         * platform/graphics/filters/FilterOperation.cpp:
2956         (WebCore::BasicColorMatrixFilterOperation::transformColor const):
2957         (WebCore::BasicComponentTransferFilterOperation::transformColor const):
2958         (WebCore::InvertLightnessFilterOperation::transformColor const):
2959         (WebCore::InvertLightnessFilterOperation::inverseTransformColor const):
2960         * platform/graphics/filters/FilterOperation.h:
2961         (WebCore::FilterOperation::transformColor const):
2962         (WebCore::FilterOperation::inverseTransformColor const):
2963         * platform/graphics/filters/FilterOperations.cpp:
2964         (WebCore::FilterOperations::transformColor const):
2965         (WebCore::FilterOperations::inverseTransformColor const):
2966         Update for rename of FloatComponents to ColorComponents<float>.
2967
2968 2020-05-27  David Kilzer  <ddkilzer@apple.com>
2969
2970         REGRESSION (r260023): ITP sparse plist decoding.
2971         <https://bugs.webkit.org/show_bug.cgi?id=212424>
2972         <rdar://problem/63683055>
2973
2974         Reviewed by John Wilander.
2975
2976         Reverted changeset:
2977
2978         "KeyedDecoder functions in ResourceLoadStatistics.{cpp,h} should return bool and use WARN_UNUSED_RETURN"
2979         https://bugs.webkit.org/show_bug.cgi?id=210414
2980         https://trac.webkit.org/changeset/260023
2981
2982         The revert did not compile due to changes in the KeyedDecoder
2983         class that require checking the return value of its methods, so
2984         additional changes were made below.
2985
2986         * loader/ResourceLoadStatistics.cpp:
2987         (WebCore::decodeHashCountedSet):
2988         (WebCore::decodeHashSet):
2989         - Use IGNORE_WARNINGS_BEGIN("unused-result")/IGNORE_WARNINGS_END
2990           to suppress warning about ignoring the return value from
2991           KeyeDecoder::decodeObjects() since decoding these objects is
2992           optional.
2993         (WebCore::decodeOptionSet):
2994         - Check return value of KeyedDecoder::decodeUInt64() before
2995           setting `optionSet` parameter.
2996
2997 2020-05-27  Andres Gonzalez  <andresg_22@apple.com>
2998
2999         Empty alt attribute does not ignore the image for accessibility clients in Safari.
3000         https://bugs.webkit.org/show_bug.cgi?id=212432
3001
3002         Reviewed by Chris Fleizach.
3003
3004         Test: accessibility/img-alt-attribute-unassigned-empty.html
3005
3006         - AccessibilityRenderObject::computeAccessibilityIsIgnored was handling
3007         the case of images too late, after checking for ariaRoleAttribute(). So
3008         if an image had a role attribute, it was exposed regardless whether its
3009         alt attribute was an empty string. This change moves the handling of
3010         images above the check for ariaroleAttribute and hence honors the empty
3011         alt attribute rule.
3012         - Also images that have an aria-label attribute are now exposed.
3013         - Added logging of AccessibilityObjectInclusion.
3014         - Changed signature of log(RefPtr<AXCoreObject>) as pointed out by Darin Adler in a separate review.
3015
3016         * accessibility/AXLogger.cpp:
3017         (WebCore::AXLogger::log):
3018         (WebCore::operator<<):
3019         * accessibility/AXLogger.h:
3020         * accessibility/AccessibilityNodeObject.cpp:
3021         (WebCore::AccessibilityNodeObject::determineAccessibilityRole):
3022         (WebCore::AccessibilityNodeObject::isImage const): Moved to base class.
3023         * accessibility/AccessibilityNodeObject.h:
3024         * accessibility/AccessibilityObject.h:
3025         * accessibility/AccessibilityObjectInterface.h:
3026         (WebCore::AXCoreObject::isImage const):
3027         * accessibility/AccessibilityRenderObject.cpp:
3028         (WebCore::objectInclusionFromAltText):
3029         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
3030         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
3031         (WebCore::AccessibilityRenderObject::updateRoleAfterChildrenCreation):
3032         * accessibility/isolatedtree/AXIsolatedObject.cpp:
3033         (WebCore::AXIsolatedObject::initializeAttributeData):
3034         * accessibility/isolatedtree/AXIsolatedObject.h:
3035
3036 2020-05-27  Chris Dumez  <cdumez@apple.com>
3037
3038         pageshow only fires the first time the back button is pressed
3039         https://bugs.webkit.org/show_bug.cgi?id=156356
3040         <rdar://problem/29256489>
3041
3042         Reviewed by Alexey Proskuryakov.
3043
3044         When FrameLoader::commitProvisionalLoad() would restore a page from the back/forward
3045         cache, it would only call FrameLoader::checkCompleted() in the main frame and fail
3046         to do so in subframes. Calling checkCompleted() is important, not only because it
3047         sets m_isComplete to true but also because it calls checkCallImplicitClose(), which
3048         resets m_didCallImplicitClose to true and m_wasUnloadEventEmitted to false.
3049
3050         Because checkCompleted() was not called, FrameLoader::dispatchUnloadEvents() would then
3051         fail to fire the pagehide event because the `m_didCallImplicitClose && !m_wasUnloadEventEmitted`
3052         was not met. Also, even though checkCompleted() was called for the main frame, if there
3053         are subframes, it would just return early because allChildrenAreComplete() returned false.
3054         Later on, when trying to fire the pageshow event, it would fail to because we have logic
3055         in DOMWindow::dispatchEvent() to avoid firing a pageshow event if we did not previously
3056         send a pagehide event.
3057
3058         To address the issue, I now call checkCompleted() in FrameLoader::open() for subframes, as
3059         this gets called for every frame during restoration from the back/forward cache. For the main
3060         frame, we keep calling checkCompleted(), after we've called sendRemainingDelegateMessages().
3061
3062         Test: fast/history/multiple-back-forward-navigations.html
3063
3064         * loader/FrameLoader.cpp:
3065         (WebCore::FrameLoader::open):
3066
3067 2020-05-27  Sam Weinig  <weinig@apple.com>
3068
3069         Extended Color: Move ColorMatrix to its own files
3070         https://bugs.webkit.org/show_bug.cgi?id=212431
3071
3072         Reviewed by Dean Jackson.
3073
3074         Move ColorMatrix to its own files from ColorUtilities.h/cpp
3075
3076         * Headers.cmake:
3077         * Sources.txt:
3078         * WebCore.xcodeproj/project.pbxproj:
3079         * platform/graphics/ColorMatrix.cpp: Copied from Source/WebCore/platform/graphics/ColorUtilities.cpp.
3080         * platform/graphics/ColorMatrix.h: Copied from Source/WebCore/platform/graphics/ColorUtilities.h.
3081         * platform/graphics/ColorUtilities.cpp:
3082         * platform/graphics/ColorUtilities.h:
3083         * platform/graphics/filters/FilterOperation.cpp:
3084
3085 2020-05-27  David Kilzer  <ddkilzer@apple.com>
3086
3087         Add OptionSetTraits<> and use with WebCore::DragDestinationAction
3088         <https://webkit.org/b/212397>
3089
3090         Reviewed by Alex Christensen.
3091
3092         * page/DragActions.h:
3093         (WTF::OptionSetTraits<WebCore::DragDestinationAction>):
3094         - Add for use with OptionSet<>.
3095
3096 2020-05-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3097
3098         [Clipboard API] Support reading "image/png" on ClipboardItem
3099         https://bugs.webkit.org/show_bug.cgi?id=212339
3100         <rdar://problem/63588957>
3101
3102         Reviewed by Tim Horton.
3103
3104         Adds support for reading "image/png" data via ClipboardItem.getType(). See below for more details.
3105
3106         Tests:  ClipboardTests.ConvertTIFFToPNGWhenPasting
3107                 editing/async-clipboard/clipboard-read-write-images.html
3108
3109         * Modules/async-clipboard/Clipboard.cpp:
3110         (WebCore::Clipboard::getType):
3111         (WebCore::Clipboard::updateSessionValidity):
3112
3113         Factor out logic for invalidating the `Clipboard`'s active `Pasteboard` object into a helper method. This is
3114         invoked after reading data from the clipboard, and verifies that the changeCount of the pasteboard is still the
3115         same as it was upon initially reading the contents of the clipboard. If the clipboard contents changed, we
3116         invalidate the session, and `Clipboard` is subsequently denied pasteboard access (until the next time the user
3117         explicitly grants programmatic pasteboard access).
3118
3119         Note that this step is here for correctness rather than security. While it is true that a compromised web
3120         process could fake the changeCount at any given moment, other fairly recent changes around WebPasteboardProxy in
3121         the UI process makes it impossible to take advantage of this fact to arbitrarily read content from the system
3122         pasteboard. Instead of simply reading the empty string, this invalidation ensures that we actually reject the
3123         promise returned by the async clipboard API.
3124
3125         * Modules/async-clipboard/Clipboard.h:
3126         * Modules/async-clipboard/ClipboardImageReader.cpp: Added.
3127
3128         Add a PasteboardFileReader subclass that is responsible for sanitizing image data from the pasteboard into
3129         data that may be exposed to the page via clipboard API. On both macOS and iOS, this ensures that potentially
3130         sensitive EXIF data is stripped via conversion to the platform image type and back. On macOS, this additionally
3131         allows us to handle transcoding TIFF data on the pasteboard to PNG (this is covered by the new API test).
3132
3133         (WebCore::ClipboardImageReader::readBuffer):
3134
3135         Add a stub implementation for non-Cocoa platforms for now, which don't implement this part of the API.
3136
3137         (WebCore::ClipboardImageReader::shouldReadBuffer const):
3138
3139         Add a new hook to skip over certain types when reading pasteboard data into Files. In particular,
3140         `ClipboardImageReader` skips over any MIME type that does not match the MIME type specified (for now, this is
3141         limited to "image/png", but may be extended to include more image types in the future after we implement more
3142         transcoding logic).
3143
3144         * Modules/async-clipboard/ClipboardImageReader.h: Added.
3145         (WebCore::ClipboardImageReader::ClipboardImageReader):
3146         (WebCore::ClipboardImageReader::takeResult):
3147         * Modules/async-clipboard/ios/ClipboardImageReaderIOS.mm: Added.
3148         (WebCore::ClipboardImageReader::readBuffer):
3149
3150         Add iOS-specific `(PNG) => PNG` transcoding logic.
3151
3152         * Modules/async-clipboard/mac/ClipboardImageReaderMac.mm: Added.
3153         (WebCore::ClipboardImageReader::readBuffer):
3154
3155         Add macOS-specific `(PNG, TIFF) => PNG` transcoding logic.
3156
3157         * Sources.txt:
3158         * SourcesCocoa.txt:
3159         * WebCore.xcodeproj/project.pbxproj:
3160         * platform/Pasteboard.h:
3161         (WebCore::PasteboardFileReader::shouldReadBuffer const):
3162         * platform/cocoa/PasteboardCocoa.mm:
3163         (WebCore::Pasteboard::read):
3164
3165         Add support for targeting a given pasteboard item index when reading files on Cocoa platforms.
3166
3167         * platform/gtk/PasteboardGtk.cpp:
3168         (WebCore::Pasteboard::read):
3169         * platform/ios/PlatformPasteboardIOS.mm:
3170         (WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
3171         (WebCore::webSafeTypes):
3172         (WebCore::PlatformPasteboard::informationForItemAtIndex):
3173
3174         Expose "image/png" as one of the readable pasteboard types on iOS when using the async clipboard API. For some
3175         reason, this adjustment was made on macOS, but wasn't done on iOS, which led to a missing "image/png" type when
3176         asking for `ClipboardItem.types`.
3177
3178         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
3179
3180         Add support for writing "image/png "data to the system pasteboard (note that this data has been sanitized
3181         already, as it has been processed through `ClipboardItemTypeLoader::sanitizeDataIfNeeded()`). We simply needed
3182         to use `forEachPlatformStringOrBuffer` instead of just `forEachPlatformString` when writing the custom
3183         pasteboard data.
3184
3185         (WebCore::createItemProviderRegistrationList):
3186         * platform/libwpe/PasteboardLibWPE.cpp:
3187         (WebCore::Pasteboard::read):
3188         * platform/win/PasteboardWin.cpp:
3189         (WebCore::Pasteboard::read):
3190
3191 2020-05-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
3192
3193         REGRESSION (r254541): Valid mime types can only be added to the HashSet of the supported types for encoding
3194         https://bugs.webkit.org/show_bug.cgi?id=212427
3195
3196         Reviewed by Darin Adler.
3197
3198         Add back a check for the mime type validity which was removed in r254541.
3199
3200         * platform/MIMETypeRegistry.cpp:
3201         (WebCore::MIMETypeRegistry::createMIMETypeRegistryThreadGlobalData):
3202
3203 2020-05-27  Devin Rousso  <drousso@apple.com>
3204
3205         Web Inspector: replace `featureGuard` and `availability` with a combined `condition` that accepts any macro
3206         https://bugs.webkit.org/show_bug.cgi?id=210014
3207
3208         Reviewed by Brian Burg.
3209
3210         Previously, the generated InspectorBackendCommands.js would include code for things that the
3211         backend doesn't actually support. By using actual macros and preprocessing that file, we can
3212         ensure that the frontend doesn't incorrectly think that something is supported by the page
3213         being inspected:
3214          - the `Canvas` commands and events related to shader programs/pipelines should only exist
3215            when the corresponding context type exists, namely `ENABLE(WEBGL)` and `ENABLE(WEBGPU)`.
3216          - iOS doesn't support showing rulers, so create a variant of `DOM.setInspectModeEnabled`
3217            that only exists for `PLATFORM(IOS_FAMILY)` that doesn't have the `showRulers` optional
3218            parameter, as well as removing `Page.setShowRulers` entirely.
3219          - setting the forced appearance should only be possible if dark mode is supported.
3220          - web archives only exist if CF is used.
3221
3222         * inspector/InspectorInstrumentation.h:
3223         * inspector/InspectorInstrumentation.cpp:
3224         * inspector/agents/InspectorCanvasAgent.h:
3225         * inspector/agents/InspectorCanvasAgent.cpp:
3226         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
3227         (WebCore::InspectorCanvasAgent::enable):
3228         (WebCore::InspectorCanvasAgent::startRecording):
3229         (WebCore::InspectorCanvasAgent::reset):
3230         (WebCore::InspectorCanvasAgent::unbindCanvas):
3231         * inspector/InspectorShaderProgram.h:
3232         * inspector/InspectorShaderProgram.cpp:
3233         (WebCore::InspectorShaderProgram::requestShaderSource):
3234         (WebCore::InspectorShaderProgram::updateShader):
3235         * inspector/agents/InspectorDOMAgent.h:
3236         * inspector/agents/InspectorDOMAgent.cpp:
3237         (WebCore::InspectorDOMAgent::setInspectModeEnabled):
3238         * inspector/agents/InspectorPageAgent.h:
3239         * inspector/agents/InspectorPageAgent.cpp:
3240         (WebCore::InspectorPageAgent::enable):
3241         (WebCore::InspectorPageAgent::disable):
3242         (WebCore::InspectorPageAgent::setForcedAppearance):
3243         (WebCore::InspectorPageAgent::archive):
3244
3245         * Configurations/FeatureDefines.xcconfig:
3246         Add `ENABLE_WEB_ARCHIVE` since it's always enabled in wtf/PlatformEnableCocoa.h.
3247
3248         * inspector/InspectorFrontendHost.idl:
3249         Drive-by: replace the `#if` with the IDL `[Conditional=]`.
3250
3251 2020-05-27  Miguel Gomez  <magomez@igalia.com>
3252
3253         [WPE] REGRESSION(r253675) Crash when using threaded rendering
3254         https://bugs.webkit.org/show_bug.cgi?id=212404
3255
3256         Reviewed by Carlos Garcia Campos.
3257
3258         Check whether the GraphicsContext has a PlatformGraphicsContext before trying to paint with
3259         it. If there's no PlatformGraphicsContext, paint using the GraphicsContext methods instead.
3260
3261         * platform/graphics/cairo/ImageBufferCairoBackend.cpp:
3262         (WebCore::ImageBufferCairoBackend::draw):
3263         (WebCore::ImageBufferCairoBackend::drawPattern):
3264
3265 2020-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
3266
3267         Unreviewed. Fix build warning with GTK4
3268
3269         * platform/gtk/GtkUtilities.cpp:
3270         (WebCore::widgetRootCoords):
3271
3272 2020-05-27  David Kilzer  <ddkilzer@apple.com>
3273
3274         Use OptionSet<DragDestinationAction> for mask values
3275         <https://webkit.org/b/212115>
3276         <rdar://problem/63423380>
3277
3278         Reviewed by Alex Christensen.
3279
3280         DragDestinationAction is used as both individual values and as a
3281         bit mask. This changes bit mask uses to OptionSet<> and renames
3282         variables to denote masks.
3283
3284         * page/DragActions.h:
3285         (WebCore::DragDestinationAction):
3286         - Convert to enum class and remove *None and *Any values.
3287         (WebCore::DragDestinationActionAny):
3288         - Add helper function to return OptionSet<DragDestinationAction>
3289           with all values set.
3290         * page/DragController.cpp:
3291         (WebCore::DragController::performDragOperation):
3292         (WebCore::DragController::dragEnteredOrUpdated):
3293         (WebCore::DragController::tryDocumentDrag):
3294         (WebCore::DragController::concludeEditDrag):
3295         * page/DragController.h:
3296         (WebCore::DragController::dragDestinationAction const): Rename.
3297         (WebCore::DragController::dragDestinationActionMask const):
3298         - Rename dragDestinationAction() to dragDestinationActionMask().
3299         * platform/DragData.cpp:
3300         (WebCore::DragData::DragData):
3301         * platform/DragData.h:
3302         (WebCore::DragData::DragData):
3303         - Use DragDestinationActionAny() in place of removed
3304           DragDestinationActionAny.
3305         (WebCore::DragData::dragDestinationAction const): Rename.
3306         (WebCore::DragData::dragDestinationActionMask const):
3307         - Rename dragDestinationAction() to dragDestinationActionMask().
3308         (WebCore::DragData::operator =):
3309         * platform/cocoa/DragDataCocoa.mm:
3310         (WebCore::DragData::DragData):
3311
3312 2020-05-27  Youenn Fablet  <youenn@apple.com>
3313
3314         Video freezes when attaching a local MediaStream to multiple elements
3315         https://bugs.webkit.org/show_bug.cgi?id=194802
3316         <rdar://problem/63613107>
3317
3318         Reviewed by Eric Carlson.
3319
3320         AVSampleBufferDisplayLayer sometimes does not update the rendering when the same local source is rendered several times.
3321         To workaround this, we set kCMSampleAttachmentKey_DisplayImmediately to true, which fixes the issue as per my testing.
3322         We clone the sample buffer before setting this property as it might not be thread safe to modify the attachments of a sample
3323         that might also be encoded.
3324         We implement this at LocalSampleBufferDisplayLayer level and enable this for local capture sources only.
3325
3326         Manually tested.
3327
3328         * platform/graphics/avfoundation/SampleBufferDisplayLayer.h:
3329         (WebCore::SampleBufferDisplayLayer::setRenderPolicy):
3330         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h:
3331         (WebCore::LocalSampleBufferDisplayLayer::setRenderPolicy):
3332         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
3333         (WebCore::LocalSampleBufferDisplayLayer::enqueueSample):
3334         (WebCore::LocalSampleBufferDisplayLayer::removeOldSamplesFromPendingQueue):
3335         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3336         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
3337         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
3338         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h:
3339         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
3340         (WebCore::setSampleBufferAsDisplayImmediately):
3341         (WebCore::MediaSampleAVFObjC::setAsDisplayImmediately):
3342         (WebCore::MediaSampleAVFObjC::cloneSampleBuffer):
3343
3344 2020-05-19  Sergio Villar Senin  <svillar@igalia.com>
3345
3346         [WebXR] Implement XRSession::requestAnimationFrame()
3347         https://bugs.webkit.org/show_bug.cgi?id=212099
3348
3349         Reviewed by Youenn Fablet.
3350
3351         The WebXR spec defines a requestAnimationFrame() mechanism to provide information about XR tracking devices
3352         using callbacks. It's pretty similar to the requestAnimationFrame() exposed by Window but only used
3353         to update WebXR content. We're adding a basic implementation of this mechanism as long as cancellation
3354         support. It requires some platform code that will be added in follow up patches. That platform code will
3355         provide information like devices' refresh rates, pose (position & orientation), display resolution, etc...
3356
3357         This patch also replaces the type of the callback id from int to unsigned int as per the following change
3358         in specs https://github.com/immersive-web/webxr/pull/1062.
3359
3360         Apart from that we're adding a missing adoptRef() in the testing code that was causing assertions in some
3361         of the tests that are being unskipped as part of this change.
3362
3363         * Modules/webxr/WebXRSession.cpp:
3364         (WebCore::WebXRSession::WebXRSession):
3365         (WebCore::WebXRSession::animationTimerFired): Added.
3366         (WebCore::WebXRSession::scheduleAnimation): Ditto.
3367         (WebCore::WebXRSession::requestAnimationFrame): Ditto.
3368         (WebCore::WebXRSession::cancelAnimationFrame):
3369         * Modules/webxr/WebXRSession.h:
3370         * Modules/webxr/XRFrameRequestCallback.h:
3371         (WebCore::XRFrameRequestCallback::callbackId):
3372         (WebCore::XRFrameRequestCallback::setCallbackId):
3373         (WebCore::XRFrameRequestCallback::cancel):
3374         (WebCore::XRFrameRequestCallback::isCancelled const):
3375         * testing/WebFakeXRDevice.cpp:
3376         (WebCore::WebFakeXRDevice::simulateInputSourceConnection):
3377         * testing/WebFakeXRDevice.h:
3378         * testing/WebFakeXRInputController.h:
3379
3380 2020-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
3381
3382         [GTK4] Make PointerLock work
3383         https://bugs.webkit.org/show_bug.cgi?id=212314
3384
3385         Reviewed by Adrian Perez de Castro.
3386
3387         * platform/gtk/GtkUtilities.cpp:
3388         (WebCore::widgetDevicePosition): Helper function to avoid #ifdefs due to GTK version differences.
3389         * platform/gtk/GtkUtilities.h:
3390
3391 2020-05-27  Peng Liu  <peng.liu6@apple.com>
3392
3393         VideoFullscreenInterfaceAVKit is leaking when a video element enters and exits fullscreen/picture-in-picture
3394         https://bugs.webkit.org/show_bug.cgi?id=212293
3395
3396         Reviewed by Youenn Fablet.
3397
3398         WebAVPlayerViewControllerDelegate is created and retained by VideoFullscreenInterfaceAVKit,
3399         but it has a RefPtr to VideoFullscreenInterfaceAVKit. This leads to a memory leak
3400         when a video element enters and exit fullscreen or Picture-in-Picture. This patch
3401         replaces the RefPtr with a WeakPtr to fix the leak.
3402
3403         With this patch, we config playerController in VideoFullscreenInterfaceAVKit::setupFullscreen()
3404         and VideoFullscreenInterfaceAVKit::cleanupFullscreen(), so that we can avoid relying on
3405         VideoFullscreenManagerProxy::setHasVideo() and VideoFullscreenManagerProxy::setVideoDimensions().
3406         Those two functions are driven by IPC messages from the Web process, which may come before
3407         VideoFullscreenInterfaceAVKit is constructed or after VideoFullscreenInterfaceAVKit
3408         is destroyed.
3409
3410         Manually tested.
3411
3412         * platform/ios/VideoFullscreenInterfaceAVKit.h:
3413         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
3414         (-[WebAVPlayerViewControllerDelegate setFullscreenInterface:]):
3415         (VideoFullscreenInterfaceAVKit::setupFullscreen):
3416         (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
3417
3418 2020-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
3419
3420         [GTK][WTR] EventSender: stop using GdkEvent API in preparation for GTK4
3421         https://bugs.webkit.org/show_bug.cgi?id=212298
3422
3423         Reviewed by Adrian Perez de Castro.
3424
3425         Add helpers to GtkUtilities to avoid #ifdefs due to GTK version differences.
3426
3427         * platform/gtk/GtkUtilities.cpp:
3428         (WebCore::widgetRootCoords):
3429         (WebCore::widgetKeyvalToKeycode):
3430         * platform/gtk/GtkUtilities.h:
3431
3432 2020-05-26  Said Abou-Hallawa  <sabouhallawa@apple.com>
3433
3434         SMILTimeContainer must protect its m_scheduledAnimations while it does updateAnimations()
3435         https://bugs.webkit.org/show_bug.cgi?id=212192
3436         <rdar://problem/56717734>
3437
3438         Reviewed by Youenn Fablet.
3439
3440         updateAnimations() needs to protect m_scheduledAnimations while processing
3441         the scheduled animations. m_scheduledAnimations may be changed from JavaScript
3442         callbacks. This will invalidate the HashMap iterators while the one used
3443         by the for-loop in updateAnimations() is still in use.
3444
3445         To allow copying m_scheduledAnimations, the value of the entry has to be
3446         of type AnimationVector instead of std::unique_ptr<AnimationVector>.        
3447
3448         Test: svg/animations/css-animation-reinsert-target.html
3449
3450         * svg/animation/SMILTimeContainer.cpp:
3451         (WebCore::SMILTimeContainer::schedule):
3452         (WebCore::SMILTimeContainer::unschedule):
3453         (WebCore::SMILTimeContainer::processScheduledAnimations):
3454         (WebCore::SMILTimeContainer::updateAnimations):
3455         * svg/animation/SMILTimeContainer.h:
3456
3457 2020-05-26  Alex Christensen  <achristensen@webkit.org>
3458
3459         MacApplication::isSafari should allow safari bundle id variants
3460         https://bugs.webkit.org/show_bug.cgi?id=212401
3461
3462         Reviewed by Timothy Hatcher.
3463
3464         There is a test environment with bundle ID com.apple.Safari.something.
3465         This change is blocking rdar://problem/63574451
3466
3467         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
3468         (WebCore::MacApplication::isSafari):
3469
3470 2020-05-26  Simon Fraser  <simon.fraser@apple.com>
3471
3472         Rendering artifacts when scrolling overlays
3473         https://bugs.webkit.org/show_bug.cgi?id=204120
3474         <rdar://problem/57121358>
3475
3476         Reviewed by Zalan Bujtas.
3477
3478         RenderLayerBacking::setContentsNeedDisplayInRect() needs to adjust repaint rects in the
3479         scrolled contents layer by the RenderLayer's scrollOffset, because that's what's used
3480         during repaint rect computation. We haven't yet pushed the new scroll offset onto the
3481         GraphicsLayer, so m_scrolledContentsLayer->scrollOffset() would be stale here.
3482
3483         I tested RTL to make sure that scrollOffset(), and not scrollPosition() is the correct
3484         function to tall.
3485
3486         Test: compositing/repaint/compositing-toggle-in-overflow-scroll-repaint.html
3487
3488         * rendering/RenderLayerBacking.cpp:
3489         (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
3490
3491 2020-05-26  Said Abou-Hallawa  <sabouhallawa@apple.com>
3492
3493         An SVG animated property animator can stop animation while other animators are still running
3494         https://bugs.webkit.org/show_bug.cgi?id=207417
3495         <rdar://problem/59278306>
3496
3497         Reviewed by Simon Fraser.
3498
3499         An SVG animated property can be animated by multiple animators. When one
3500         animator stops the animation, the animVal should not be deleted since it
3501         will be used by other animators.
3502
3503         SVGAnimatedProperty will maintain a WeakHashSet<SVGAttributeAnimator> in
3504         which the animator will be added when the animation starts and will be 
3505         removed when the the animation stops. When all the animators stops their
3506         animations, the animated property may delete the animVal or keep it if it
3507         can be referenced by JavaScript.
3508
3509         Tests: svg/animations/animated-enum-mutiple-animators.svg
3510                svg/animations/animated-length-mutiple-animators.svg
3511
3512         * svg/properties/SVGAnimatedDecoratedProperty.h:
3513         * svg/properties/SVGAnimatedPrimitiveProperty.h:
3514         * svg/properties/SVGAnimatedProperty.h:
3515         (WebCore::SVGAnimatedProperty::isAnimating const):
3516         (WebCore::SVGAnimatedProperty::startAnimation):
3517         (WebCore::SVGAnimatedProperty::stopAnimation):
3518         (WebCore::SVGAnimatedProperty::instanceStartAnimation):
3519         (WebCore::SVGAnimatedProperty::instanceStopAnimation):
3520         * svg/properties/SVGAnimatedPropertyAnimator.h:
3521         * svg/properties/SVGAnimatedPropertyList.h:
3522         * svg/properties/SVGAnimatedValueProperty.h:
3523         * svg/properties/SVGAttributeAnimator.h:
3524
3525 2020-05-26  Simon Fraser  <simon.fraser@apple.com>
3526
3527         REGRESSION (async oveflow): scrubber missing from inline video inside overflow scroll
3528         https://bugs.webkit.org/show_bug.cgi?id=212391
3529         <rdar://problem/63089859>
3530
3531         Reviewed by Zalan Bujtas.
3532
3533         backgroundClipRect() is in the coordinate space of the ClipRectContext's rootLayer, not the receiver,
3534         so when converting to absolute coordinates we must use the ClipRectContext's rootLayer.
3535
3536         Test: compositing/layer-creation/overlap-in-scroller.html
3537
3538         * rendering/RenderLayerCompositor.cpp:
3539         (WebCore::RenderLayerCompositor::addToOverlapMap const):
3540
3541 2020-05-26  Jer Noble  <jer.noble@apple.com>
3542
3543         Can't scrub video on https://www.judiciary.senate.gov
3544         https://bugs.webkit.org/show_bug.cgi?id=212270
3545         <rdar://problem/57922919>
3546
3547         Reviewed by Eric Carlson.
3548
3549         Test: media/video-duration-seekable.html
3550
3551         www.judiciary.senate.gov uses the Akamai Media Player, which doesn't query HTMLMediaElement.duration
3552         directly. Rather, when it receives a "durationchange" event, it calculates the duration by using the
3553         HTMLMediaElement.seekable ranges to determine the effective media duration. But no event is fired when
3554         the seekable ranges change, and when they first query HTMLMediaElement.seekable, AVFoundation hasn't
3555         yet updated seekable ranges, so we report an empty set of seekable ranges.
3556
3557         The HTML specification suggests that UAs "should adopt a very liberal and optimistic view of what is
3558         seekable." With that advice in mind, when we are asked by the page for our seekable ranges, and we do
3559         not yet have the official ranges from AVPlayerItem, lets just respond with [0, duration).
3560
3561         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3562         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformMaxTimeSeekable const):
3563
3564 2020-05-25  Darin Adler  <darin@apple.com>
3565
3566         Eliminate Color constructors that take strings, moving color parsing entirely into the CSS parser
3567         https://bugs.webkit.org/show_bug.cgi?id=212296
3568
3569         Reviewed by Sam Weinig.
3570
3571         * css/parser/CSSParser.cpp:
3572         (WebCore::CSSParser::parseColor): Moved more of the logic into
3573         CSSParserFastPaths::parseSimpleColor. Also added a FIXME about what
3574         seems to be a mistake about strict mode.
3575         (WebCore::CSSParser::parseColorWorkerSafe): Ditto.
3576         (WebCore::CSSParser::parseSystemColor): Removed unused context argument.
3577         (WebCore::CSSParser::parseNamedColor): Added.
3578         (WebCore::CSSParser::parseHexColor): Added.
3579         (WebCore::CSSParser::parseSingleValue): Use auto.
3580         (WebCore::CSSParser::parseValue): Ditto.
3581
3582         * css/parser/CSSParser.h: Exported parseColor. Removed unused value pool
3583         and strict arguments from parseColorWorkerSafe. Removed unused context
3584         argument from parseSystemColor. Added parseNamedColor and parseHexColor.
3585
3586         * css/parser/CSSParserFastPaths.cpp:
3587         (WebCore::parseSimpleLengthValue): Take a StringView.
3588         (WebCore::finishParsingHexColor): Added, logic moved from Color constructor.
3589         (WebCore::parseHexColorInternal): Ditto.
3590         (WebCore::parseNumericColor): Added, logic moved from fastParseColorInternal.
3591         (WebCore::parseColor): Turned into a non-member function since it's private
3592         to this file. Use auto a bit more, and removed unneeded value pool argument.
3593         (WebCore::finishParsingNamedColor): Added, logic moved from Color constructor.
3594         (WebCore::parseNamedColorInternal): Ditto.
3595         (WebCore::parseSimpleColorInternal): Ditto.
3596         (WebCore::CSSParserFastPaths::parseSimpleColor): Ditto.
3597         (WebCore::CSSParserFastPaths::parseHexColor): Ditto.
3598         (WebCore::CSSParserFastPaths::parseNamedColor): Ditto.
3599         (WebCore::isUniversalKeyword): Take a StringView.
3600         (WebCore::parseKeywordValue): Ditto.
3601         (WebCore::parseSimpleTransform): Ditto.
3602         (WebCore::parseCaretColor): Ditto. Also take a parser context rather than
3603         a parser mode.
3604         (WebCore::CSSParserFastPaths::maybeParseValue): Take a StringView.
3605
3606         * css/parser/CSSParserFastPaths.h: Cut down includes. Use StringView.
3607         Added parseSimpleColor, parseHexColor, and parseNamedColor.
3608
3609         * css/parser/CSSPropertyParserHelpers.cpp:
3610         (WebCore::CSSPropertyParserHelpers::parseHexColor): Return an
3611         Optional<SimpleColor> instead of a Color.
3612         (WebCore::CSSPropertyParserHelpers::consumeColor): Refactor a bit for clarity.
3613
3614         * html/HTMLElement.cpp:
3615         (WebCore::parseLegacyColorValue): Renamed from parseColorStringWithCrazyLegacyRules
3616         and refactored a bit. Made this match the HTML specification more closely.
3617         (WebCore::HTMLElement::addHTMLColorToStyle): Simplify now that more of the logic
3618         was moved into parseLegacyColorValue.
3619
3620         * html/canvas/CanvasStyle.cpp:
3621         (WebCore::parseColor): Removed unneeded arguments for parseColorWorkerSafe
3622         and for parseSystemColor.
3623
3624         * platform/graphics/Color.cpp:
3625         (WebCore::findNamedColor): Deleted.
3626         (WebCore::Color::Color): Deleted overloadds that take strings.
3627         * platform/graphics/Color.h: Updated for the above.
3628
3629         * platform/graphics/SimpleColor.cpp:
3630         (WebCore::parseHexColorInternal): Deleted.
3631         (WebCore::SimpleColor::parseHexColor): Deleted.
3632         * platform/graphics/SimpleColor.h: Removed parseHexColor functions.
3633
3634 2020-05-26  Antoine Quint  <graouts@apple.com>
3635
3636         Hardware fill-forwards animation and transitions don't interact correctly
3637         https://bugs.webkit.org/show_bug.cgi?id=187839
3638         <rdar://problem/42410412>
3639
3640         Reviewed by Simon Fraser.
3641
3642         Test: webanimations/updating-property-targeted-by-css-transition-during-css-animation.html
3643
3644         We didn't follow the CSS Transitions spec closely enough when it came to defining the correct before and after
3645         change styles during a style change event.
3646
3647         We now correctly set the before-change style as one of three possible values:
3648         
3649             1. if there are running CSS-originated animations, we ensure those are updated to the current time and
3650                resolve them to get the style,
3651             2. otherwise we use the RenderStyle recorded in Style::TreeResolver::createAnimatedElementUpdate() prior
3652                to applying animations during the last style change event,
3653             3. otherwise we use the previous computed style, which should not have any animated values.
3654         
3655         As for the after-change style, we also need to ensure any running CSS Animations are update to the current time
3656         and resolve them to get the style. Otherwise, we just use the current computed style prior to applying animations.
3657
3658         Finally, we can exit from AnimationTimeline::updateCSSTransitionsForElementAndProperty() early if we find that
3659         we have a JS-originated animation running for the given property on the given element since we know that that
3660         animation will yield an overriding value for both the before and after change styles since JS-originated animations
3661         have the hightest composite order.
3662
3663         This means we no longer need to track the unanimated style on KeyframeEffect.
3664
3665         * animation/AnimationTimeline.cpp:
3666         (WebCore::AnimationTimeline::updateCSSAnimationsForElement):
3667         (WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty):
3668         (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
3669         * animation/AnimationTimeline.h:
3670         * animation/ElementAnimationRareData.h:
3671         (WebCore::ElementAnimationRareData::lastStyleChangeEventStyle const):
3672         (WebCore::ElementAnimationRareData::setLastStyleChangeEventStyle):
3673         * animation/KeyframeEffect.cpp:
3674         (WebCore::KeyframeEffect::clearBlendingKeyframes):
3675         (WebCore::KeyframeEffect::apply):
3676         (WebCore::KeyframeEffect::applyPendingAcceleratedActions):
3677         * animation/KeyframeEffect.h:
3678         (WebCore::KeyframeEffect::unanimatedStyle const): Deleted.
3679         * dom/Element.cpp:
3680         (WebCore::Element::lastStyleChangeEventStyle const):
3681         (WebCore::Element::setLastStyleChangeEventStyle):
3682         * dom/Element.h:
3683         * style/StyleTreeResolver.cpp:
3684         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
3685
3686 2020-05-26  Sam Weinig  <weinig@apple.com>
3687
3688         Extended Color Cleanup: Remove red()/green()/blue() accessors from ExtendedColor in preperation for supporting non-RGB based ColorSpaces
3689         https://bugs.webkit.org/show_bug.cgi?id=212366
3690
3691         Reviewed by Simon Fraser.
3692
3693         * platform/graphics/Color.cpp:
3694         (WebCore::differenceSquared):
3695         Switch to using toSRGBASimpleColorLossy() rather than poking at the ExtendedColor
3696         components directly. The old code was already incorrect if the two colors had 
3697         differing color spaces so this at least now gives reasonable results.
3698
3699         (WebCore::Color::colorWithAlpha const):
3700         (WebCore::Color::colorWithAlphaUsingAlternativeRounding const):
3701         Delegate to ExtendedColor completely for colorWithAlpha() to allow for more
3702         control over how the components might be stored in the future.
3703         
3704         * platform/graphics/Color.h:
3705         (WebCore::Color::isBlackColor):
3706         (WebCore::Color::isWhiteColor):
3707         Delegate to ExtendedColor for isBlack()/isWhite() to allow per-color space
3708         interpretations of the predicate.
3709
3710         (WebCore::Color::encode const):
3711         (WebCore::Color::decode):
3712         Use c1, c2, c3 rather than red/green/blue. This should be acceptable for the
3713         forseeable future, as all expected colorspaces only have 3 channels, but at 
3714         some point, it may make sense to delegate coding to ExtendedColor completely.
3715
3716         * platform/graphics/ExtendedColor.cpp:
3717         * platform/graphics/ExtendedColor.h:
3718         (WebCore::ExtendedColor::channels const):
3719         (WebCore::ExtendedColor::red const): Deleted.
3720         (WebCore::ExtendedColor::green const): Deleted.
3721         (WebCore::ExtendedColor::blue const): Deleted.
3722         (WebCore::ExtendedColor::colorWithAlpha const): Added.
3723         (WebCore::ExtendedColor::isWhite const): Added.
3724         (WebCore::ExtendedColor::isBlack const): Added.
3725         Use channels() with structured bindings rather than the red()/green()/blue() accessors
3726         everywhere.
3727
3728 2020-05-26  Peng Liu  <peng.liu6@apple.com>
3729
3730         ASSERTION FAILED: m_clientCounts.contains(contextId) - WebKit::VideoFullscreenManagerProxy::removeClientForContext()
3731         https://bugs.webkit.org/show_bug.cgi?id=212308
3732
3733         Reviewed by Jer Noble.
3734
3735         Call m_videoFullscreenModel->didExitPictureInPicture() after the video player
3736         completes the process to exit Picture-in-Picture.
3737
3738         Covered by existing tests.
3739
3740         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
3741         (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
3742         (VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
3743
3744 2020-05-26  Zalan Bujtas  <zalan@apple.com>
3745
3746         [LFC][TFC] Use padding to space out sections
3747         https://bugs.webkit.org/show_bug.cgi?id=212377
3748
3749         Reviewed by Antti Koivisto.
3750
3751         Use fake padding before/after to space out sections.
3752
3753         Test: fast/layoutformattingcontext/table-simple-multiple-sections-with-border-spacing-and-collapse.html
3754
3755         * layout/tableformatting/TableFormattingContext.cpp:
3756         (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
3757
3758 2020-05-26  Keith Rollin  <krollin@apple.com>
3759
3760         Enable the use of XCBuild by default in Apple builds
3761         https://bugs.webkit.org/show_bug.cgi?id=209890
3762         <rdar://problem/44182078>
3763
3764         Reviewed by Darin Adler.
3765
3766         Switch from the "legacy" Xcode build system to the "new" build system
3767         (also known as "XCBuild"). Switching to the new system speeds up
3768         builds by a small percentage, better validates projects for
3769         build-related issues (such as dependency cycles), lets WebKit benefit
3770         from future improvements in XCBuild such as those coming from the
3771         underlying llbuild open source project, and prepares us for any other
3772         tools built for this new ecosystem.
3773
3774         Specific changes:
3775
3776         - Remove Xcode project and workspace settings that selected the Build
3777           system, allowing the default to take hold (which is currently the
3778           New build system).
3779         - Updated webkitdirs.pm with a terser check for Xcode version.
3780         - Update build-webkit and Makefile.shared to be explicit when using
3781           the old build system (no longer treat it as a default or fall-back
3782           configuration).
3783         - Update various xcconfig files similarly to treat the default as
3784           using the new build system.
3785         - Update various post-processing build steps to check for Xcode 11.4
3786           and to no longer treat the default as using the old build system.
3787
3788         No new tests -- no changed functionality.
3789
3790         * WebCore.xcodeproj/project.pbxproj:
3791
3792 2020-05-26  Zalan Bujtas  <zalan@apple.com>
3793
3794         [LFC][TFC] Add support for multiple sections
3795         https://bugs.webkit.org/show_bug.cgi?id=212354
3796
3797         Reviewed by Antti Koivisto.
3798
3799         Let's keep the grid about rows and columns and about distributing available space.
3800         Use the layout tree to find sections. 
3801
3802         Test: fast/layoutformattingcontext/table-simple-multiple-sections.html
3803
3804         * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
3805         (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox):
3806         * layout/tableformatting/TableFormattingContext.cpp:
3807         (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
3808         (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows):
3809         (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
3810         * layout/tableformatting/TableGrid.cpp:
3811         (WebCore::Layout::TableGrid::appendCell):
3812         (WebCore::Layout::TableGrid::Section::Section): Deleted.
3813         * layout/tableformatting/TableGrid.h:
3814         (WebCore::Layout::TableGrid::Section::box const): Deleted.
3815         (WebCore::Layout::TableGrid::sections const): Deleted.
3816         (WebCore::Layout::TableGrid::sections): Deleted.
3817
3818 2020-05-26  Carlos Garcia Campos  <cgarcia@igalia.com>
3819
3820         [GTK4] Use screen font options as default
3821         https://bugs.webkit.org/show_bug.cgi?id=212332
3822
3823         Reviewed by Adrian Perez de Castro.
3824
3825         There's no gdk_screen_get_font_options() in GTK4, so we need to get the individual properties from the settings
3826         and build a cairo_font_options_t. We can just do the same in GTK3 to avoid ifdefs. Add a helper
3827         SystemFontOptions singleton class to monitor and parse the font settings.
3828
3829         * platform/graphics/gtk/GdkCairoUtilities.cpp:
3830         (WebCore::SystemFontOptions::singleton):
3831         (WebCore::SystemFontOptions::SystemFontOptions):
3832         (WebCore::SystemFontOptions::fontOptions const):
3833         (WebCore::SystemFontOptions::updateFontOptions):
3834         (WebCore::getDefaultCairoFontOptions):
3835
3836 2020-05-25  Simon Fraser  <simon.fraser@apple.com>
3837
3838         Use an Optional<> for LayerFragment::boundingBox
3839         https://bugs.webkit.org/show_bug.cgi?id=212358
3840
3841         Reviewed by Zalan Bujtas.
3842
3843         Replace a bool + LayoutRect with Optional<LayoutRect>.
3844
3845         * rendering/LayerFragment.h:
3846         (WebCore::LayerFragment::setRects):
3847         (WebCore::LayerFragment::moveBy):
3848         (WebCore::LayerFragment::intersect):
3849         * rendering/RenderLayer.cpp:
3850         (WebCore::RenderLayer::collectFragments):
3851         (WebCore::RenderLayer::updatePaintingInfoForFragments):
3852         (WebCore::RenderLayer::calculateClipRects const):
3853         * rendering/RenderLayer.h:
3854
3855 2020-05-25  Simon Fraser  <simon.fraser@apple.com>
3856
3857         Make isTableRow() an inline function
3858         https://bugs.webkit.org/show_bug.cgi?id=212360
3859
3860         Reviewed by Darin Adler.
3861
3862         isTableCell() is a virtual function that's called in some hot code paths, like RenderLayer::localBoundingBox(),
3863         so make it inline by using a spare bit on RenderObject.
3864
3865         * rendering/RenderObject.h:
3866         (WebCore::RenderObject::isTableCaption const):
3867         (WebCore::RenderObject::isTableRow const):
3868         (WebCore::RenderObject::setIsTableRow):
3869         (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
3870         * rendering/RenderTableRow.cpp:
3871         (WebCore::RenderTableRow::RenderTableRow):
3872         * rendering/RenderTableRow.h:
3873
3874 2020-05-25  Alex Christensen  <achristensen@webkit.org>
3875
3876         Expose more network metrics to WebCoreNSURLSession
3877         https://bugs.webkit.org/show_bug.cgi?id=212359
3878         <rdar://problem/62909440>
3879
3880         Reviewed by Darin Adler.
3881
3882         * platform/network/NetworkLoadMetrics.h:
3883         (WebCore::NetworkLoadMetrics::isolatedCopy const):
3884         (WebCore::NetworkLoadMetrics::operator== const):
3885         (WebCore::NetworkLoadMetrics::encode const):
3886         (WebCore::NetworkLoadMetrics::decode):
3887         * platform/network/cocoa/WebCoreNSURLSession.mm:
3888         (-[WebCoreNSURLSessionTaskTransactionMetrics networkProtocolName]):
3889         (-[WebCoreNSURLSessionTaskTransactionMetrics isReusedConnection]):
3890         (-[WebCoreNSURLSessionTaskTransactionMetrics cellular]):
3891         (-[WebCoreNSURLSessionTaskTransactionMetrics expensive]):
3892         (-[WebCoreNSURLSessionTaskTransactionMetrics constrained]):
3893         (-[WebCoreNSURLSessionTaskTransactionMetrics multipath]):
3894
3895 2020-05-25  Oriol Brufau  <obrufau@igalia.com>
3896
3897         [css-grid] Prevent grid-template-rows from serializing adjacent <line-names>
3898         https://bugs.webkit.org/show_bug.cgi?id=212345
3899
3900         Reviewed by Manuel Rego Casasnovas.
3901
3902         The parser for the grid-template shorthand has this code:
3903
3904             // Persists between loop iterations so we can use the same value for
3905             // consecutive <line-names> values
3906             RefPtr<CSSGridLineNamesValue> lineNames;
3907
3908         However, this wasn't working because of a lineNames.releaseNonNull() at
3909         the end of the loop. So each iteration started with a null lineNames, and
3910         consecutive <line-names> values were not merged together.
3911
3912         Tests: fast/css-grid-layout/grid-template-shorthand-get-set.html
3913                imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand.html
3914                imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand-valid.html
3915                imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-shorthand.html
3916                imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-shorthand-valid.html
3917
3918         * css/parser/CSSPropertyParser.cpp:
3919         (WebCore::CSSPropertyParser::consumeGridTemplateRowsAndAreasAndColumns):
3920
3921 2020-05-25  Sam Weinig  <weinig@apple.com>
3922
3923         Extended Color Cleanup: Assert !isExtended() in Color::asSimpleColor()...finally
3924         https://bugs.webkit.org/show_bug.cgi?id=212357
3925
3926         Reviewed by Simon Fraser.
3927
3928         Reap the reward of the cleanup, and add the ASSERT(!isExtended()) to Color::asSimpleColor()
3929         as was the original goal of this effort. Only tree non-checked places remained and were 
3930         trivial to add isExtended() checks for.
3931
3932         * platform/graphics/Color.cpp:
3933         (WebCore::Color::nameForRenderTreeAsText const):
3934         Use ExtenedColor::cssText() for the RenderTree representation. It is stable 
3935         and as good as any, no need to re-invent the wheel here.
3936
3937         (WebCore::Color::light const):
3938         (WebCore::Color::dark const):
3939         Add isExtended() checks before doing white/black checks,
3940
3941         * platform/graphics/Color.h:
3942         (WebCore::Color::asSimpleColor const):
3943         Add ASSERT.
3944
3945 2020-05-24  Sam Weinig  <weinig@apple.com>
3946
3947         Extended Color Cleanup: Use the name SimpleColor consistently
3948         https://bugs.webkit.org/show_bug.cgi?id=212337
3949
3950         Reviewed by Anders Carlsson.
3951         
3952         - Removes RGBA32 type alias, updating all remaining users of it.
3953         - Renames functions that take/return SimpleColor to use the name
3954           SimpleColor rather than RGB (e.g. makeRGBA -> makeSimpleColor)
3955         - Moves hex color parsing from Color to SimpleColor, as that is
3956           the type it returns. Also took the opportunity to make it return
3957           an Optional<SimpleColor> instead of using a bool/out parameter.
3958         - Move Color::compositionFill to editing/CompositionHighlight.h
3959           It makes no real sense to keep it in Color.h
3960         - Replaces rgb() function in Color with asSimpleColor() for 
3961           symmetry with asExtended().
3962         - Replaced std::max(a, std::min(value, b)) with std::clamp(value, a, b)
3963           for clarity.
3964
3965         * css/parser/CSSParserFastPaths.cpp:
3966         (WebCore::fastParseColorInternal):
3967         (WebCore::CSSParserFastPaths::parseColor):
3968         * css/parser/CSSPropertyParserHelpers.cpp:
3969         (WebCore::CSSPropertyParserHelpers::parseRGBParameters):
3970         (WebCore::CSSPropertyParserHelpers::parseHSLParameters):
3971         (WebCore::CSSPropertyParserHelpers::parseHexColor):
3972         * editing/CompositionHighlight.h:</