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