Unreviewed WPE debug build fix after r239921.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-01-14  Zan Dobersek  <zdobersek@igalia.com>
2
3         Unreviewed WPE debug build fix after r239921.
4
5         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
6         (webKitMediaClearKeyDecryptorDecrypt): Fix the assert that checks the
7         size of the mapped buffer containing IV data.
8
9 2019-01-14  Charlie Turner  <cturner@igalia.com>
10
11         [GStreamer] Add sharedBuffer utility to GstMappedBuffer, and a testsuite
12         https://bugs.webkit.org/show_bug.cgi?id=192977
13
14         Reviewed by Carlos Garcia Campos.
15
16         Add a utility method on GstMappedBuffer to return a SharedBuffer
17         view over the mapped data with no copies.
18
19         This patch also introduces a new gstreamer port API test
20         directory, and includes some tests for GstMappedBuffer.
21
22         New tests in the API section.
23
24         * platform/SharedBuffer.cpp: Add a new overload for
25         GstMappedBuffer that allows sharing the mapped GStreamer buffers
26         with zero copies.
27         (WebCore::SharedBuffer::create):
28         (WebCore::SharedBuffer::SharedBuffer):
29         (WebCore::SharedBuffer::DataSegment::data const):
30         (WebCore::SharedBuffer::DataSegment::size const):
31         * platform/SharedBuffer.h:
32         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
33         (webKitWebAudioSrcAllocateBuffersAndRenderAudio): Update to new
34         API.
35         * platform/graphics/gstreamer/GStreamerCommon.cpp:
36         (WebCore::GstMappedBuffer::createSharedBuffer): Return a shared
37         buffer sharing this mapped buffer. The buffer must be shareable to
38         use this method.
39         * platform/graphics/gstreamer/GStreamerCommon.h:
40         (WebCore::GstMappedBuffer::create): Make GstMappedBuffer RefCounted
41         (WebCore::GstMappedBuffer::~GstMappedBuffer):
42         (WebCore::GstMappedBuffer::data):
43         (WebCore::GstMappedBuffer::data const):
44         (WebCore::GstMappedBuffer::size const):
45         (WebCore::GstMappedBuffer::isSharable const): New predicate to
46         check whether this buffer can be shared (i.e., is not writable)
47         (WebCore::GstMappedBuffer::GstMappedBuffer):
48         (WebCore::GstMappedBuffer::operator bool const): Deleted.
49         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
50         (WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfSample):
51         Update to use new API.
52         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
53         (WebCore::InitData::InitData): Ditto.
54         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
55         (webKitMediaClearKeyDecryptorFindAndSetKey): Ditto.
56         (webKitMediaClearKeyDecryptorDecrypt): Ditto.
57         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
58         (WebCore::WrappedMockRealtimeAudioSource::render): Ditto.
59         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
60         (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData): Ditto.
61         * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp:
62         (WebCore::RealtimeOutgoingVideoSourceLibWebRTC::createBlackFrame): Ditto.
63         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
64         (WebCore::GStreamerVideoEncoder::Fragmentize): Ditto.
65
66 2019-01-14  Karl Leplat  <karl.leplat_ext@softathome.com>
67
68         [GTK][WPE] Graphic issue with invalidations on composited layers with subpixel positions
69         https://bugs.webkit.org/show_bug.cgi?id=193239
70
71         Reviewed by Žan Doberšek.
72
73         Test: compositing/repaint/invalidations-on-composited-layers-with-subpixel-positions.html
74
75         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
76         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers): Use enclosed dirty rect values
77         when invalidating the CoordinatedBackingStore areas.
78
79 2019-01-13  Carlos Garcia Campos  <cgarcia@igalia.com>
80
81         [FreeType] Support emoji modifiers
82         https://bugs.webkit.org/show_bug.cgi?id=177040
83
84         Reviewed by Myles C. Maxfield.
85
86         The problem only happens with emojis having the zero with joiner (U+200D) in the sequence. The sequence is
87         broken because createAndFillGlyphPage() in Font.cpp overwrites zero with joiner with zero width space (U+200B),
88         but the emoji font actually supports zero with joiner. This patch moves the control characters override from
89         createAndFillGlyphPage() to GlyphPage::fill() only for FreeType based ports. This way we can do the override
90         only for the cases where the code point is not supported by the font.
91
92         * platform/graphics/Font.cpp:
93         (WebCore::overrideControlCharacters): Helper function to override the control characters.
94         (WebCore::createAndFillGlyphPage): Call overrideControlCharacters() only when not using FreeType.
95         * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp:
96         (WebCore::GlyphPage::fill): Use zero width space as fallback when the font doesn't support characters with
97         Default_Ignorable Unicode property.
98
99 2019-01-13  Dan Bernstein  <mitz@apple.com>
100
101         More build fixing.
102
103         * editing/cocoa/DictionaryLookup.mm:
104
105 2019-01-13  Simon Fraser  <simon.fraser@apple.com>
106
107         Minor optimization to RenderText::setRenderedText()
108         https://bugs.webkit.org/show_bug.cgi?id=193388
109
110         Reviewed by Ryosuke Niwa.
111
112         Avoid the call to applyTextTransform() if TextTransform is None, so that we don't
113         have to call previousCharacter() and reassign m_text.
114         
115         Similar optimization in RenderText::textWithoutConvertingBackslashToYenSymbol().
116
117         Speedometer profiles show a few samples here, but this isn't going to win any prizes.
118
119         * rendering/RenderText.cpp:
120         (WebCore::RenderText::setRenderedText):
121         (WebCore::RenderText::textWithoutConvertingBackslashToYenSymbol const):
122
123 2019-01-13  Dan Bernstein  <mitz@apple.com>
124
125         Tried to fix the build.
126
127         * editing/cocoa/DictionaryLookup.mm:
128
129 2019-01-13  Dan Bernstein  <mitz@apple.com>
130
131         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r239901.
132
133         Patch by Keith Rollin.
134
135         * accessibility/mac/AXObjectCacheMac.mm:
136
137 2019-01-13  Zalan Bujtas  <zalan@apple.com>
138
139         [LFC] Adjust assert for statically positioned fixed elements
140         https://bugs.webkit.org/show_bug.cgi?id=193385
141
142         Reviewed by Antti Koivisto.
143
144         While computing the static position and traversing the ancestor chain, we can surely hit a positioned container
145         (since we need to go all the way up to the initial containing block).
146
147         * layout/FormattingContextGeometry.cpp:
148         (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned):
149         (WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned):
150
151 2019-01-13  Antti Koivisto  <antti@apple.com>
152
153         Release assert with <img usemap> in shadow tree
154         https://bugs.webkit.org/show_bug.cgi?id=193378
155
156         Reviewed by Ryosuke Niwa.
157
158         When a shadow host that has <img usemap> in the shadow tree is removed from the document, we try
159         to remove the map from the scope of the host.
160
161         * html/HTMLImageElement.cpp:
162         (WebCore::HTMLImageElement::parseAttribute):
163         (WebCore::HTMLImageElement::insertedIntoAncestor):
164         (WebCore::HTMLImageElement::removedFromAncestor):
165
166         Tree scope changes are relevant, not the connection to the document.
167
168 2019-01-12  Timothy Hatcher  <timothy@apple.com>
169
170         Have prefers-color-scheme: light always match on macOS versions before Mojave.
171         https://bugs.webkit.org/show_bug.cgi?id=191655
172         rdar://problem/46074680
173
174         Reviewed by Megan Gardner.
175
176         Tests: css-dark-mode/older-systems/prefers-color-scheme.html
177                css-dark-mode/older-systems/supported-color-schemes-css.html
178                css-dark-mode/older-systems/supported-color-schemes.html
179
180         Use new HAVE(OS_DARK_MODE_SUPPORT) to make it easier to find code.
181         Added HAVE(OS_DARK_MODE_SUPPORT) around more bits to make it work on older systems.
182
183         * Configurations/FeatureDefines.xcconfig:
184         * dom/Document.cpp:
185         (WebCore::Document::useDarkAppearance const):
186         * inspector/agents/InspectorPageAgent.cpp:
187         (WebCore::InspectorPageAgent::enable):
188         * page/Page.cpp:
189         (WebCore::Page::setUseDarkAppearance):
190         (WebCore::Page::useDarkAppearance const):
191         (WebCore::Page::setUseDarkAppearanceOverride):
192         * platform/mac/LocalDefaultSystemAppearance.h:
193         (WebCore::LocalDefaultSystemAppearance::usingDarkAppearance const):
194         * platform/mac/LocalDefaultSystemAppearance.mm:
195         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
196         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
197         * platform/mac/ScrollAnimatorMac.mm:
198         * rendering/RenderThemeMac.mm:
199         (-[WebCoreTextFieldCell _adjustedCoreUIDrawOptionsForDrawingBordersOnly:]):
200         (-[WebListButtonCell drawWithFrame:inView:]):
201         (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
202         (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
203         (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
204         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
205         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const):
206         (WebCore::RenderThemeMac::systemColor const):
207
208 2019-01-12  Zalan Bujtas  <zalan@apple.com>
209
210         [LFC] Block/InlinFormattingContext should take Block/InlineFormattingState
211         https://bugs.webkit.org/show_bug.cgi?id=193383
212
213         Reviewed by Antti Koivisto.
214
215         This is just a downcast really.
216
217         * layout/FormattingContext.cpp:
218         (WebCore::Layout::FormattingContext::FormattingContext):
219         (WebCore::Layout::FormattingContext::formattingState const): Deleted.
220         * layout/FormattingContext.h:
221         * layout/LayoutState.cpp:
222         (WebCore::Layout::LayoutState::createFormattingContext):
223         * layout/blockformatting/BlockFormattingContext.cpp:
224         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
225         * layout/blockformatting/BlockFormattingContext.h:
226         (WebCore::Layout::BlockFormattingContext::formattingState const):
227         (WebCore::Layout::BlockFormattingContext::blockFormattingState const): Deleted.
228         * layout/inlineformatting/InlineFormattingContext.cpp:
229         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
230         (WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const):
231         (WebCore::Layout::InlineFormattingContext::createFinalRuns const):
232         (WebCore::Layout::InlineFormattingContext::postProcessInlineRuns const):
233         (WebCore::Layout::InlineFormattingContext::layoutInlineContent const):
234         (WebCore::Layout::InlineFormattingContext::placeInFlowPositionedChildren const):
235         (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
236         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
237         * layout/inlineformatting/InlineFormattingContext.h:
238         (WebCore::Layout::InlineFormattingContext::formattingState const):
239         (WebCore::Layout::InlineFormattingContext::inlineFormattingState const): Deleted.
240         * page/FrameViewLayoutContext.cpp:
241         (WebCore::layoutUsingFormattingContext):
242
243 2019-01-12  Myles C. Maxfield  <mmaxfield@apple.com>
244
245         [WHLSL] Add native function synthesis passes
246         https://bugs.webkit.org/show_bug.cgi?id=193360
247
248         Reviewed by Dean Jackson.
249
250         This patch includes all the passes in prepare() that are between the name resolver and the
251         type checker. It involves a few small pieces:
252
253         - CheckDuplicateFunctions which makes sure the same function isn't defined twice
254         - Intrinsics, which remembers all of the native types so they can be referred to by the
255           rest of the compiler
256         - RecursiveTypeChecker which makes sure types don't refer to themselves
257         - SynthesizeArrayOperatorLength which creates operator.length() functions for arrays
258         - SynthesizeConstructors which creates copy constructors and default constructors for all
259           types
260         - SynthesizeEnumerationFunctions which provides cast operators between enum types and their
261           base types
262         - SynthesizeStructureAccessors which provides getters, setters, and anders for each member
263           of a struct
264
265         No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
266         of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
267
268         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp:
269         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const):
270         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp:
271         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const):
272         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp: Added.
273         (WebCore::WHLSL::checkDuplicateFunctions):
274         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
275         * Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp: Added.
276         (WebCore::WHLSL::Intrinsics::Intrinsics):
277         (WebCore::WHLSL::Intrinsics::add):
278         (WebCore::WHLSL::Intrinsics::addPrimitive):
279         (WebCore::WHLSL::Intrinsics::addVector):
280         (WebCore::WHLSL::Intrinsics::addMatrix):
281         (WebCore::WHLSL::Intrinsics::addFullTexture):
282         (WebCore::WHLSL::Intrinsics::addDepthTexture):
283         (WebCore::WHLSL::Intrinsics::addTexture):
284         * Modules/webgpu/WHLSL/WHLSLIntrinsics.h: Added.
285         (WebCore::WHLSL::Intrinsics::voidType const):
286         (WebCore::WHLSL::Intrinsics::boolType const):
287         (WebCore::WHLSL::Intrinsics::intType const):
288         (WebCore::WHLSL::Intrinsics::uintType const):
289         (WebCore::WHLSL::Intrinsics::samplerType const):
290         (WebCore::WHLSL::Intrinsics::floatType const):
291         (WebCore::WHLSL::Intrinsics::float3Type const):
292         (WebCore::WHLSL::Intrinsics::float4Type const):
293         * Modules/webgpu/WHLSL/WHLSLProgram.h:
294         (WebCore::WHLSL::Program::append):
295         (WebCore::WHLSL::Program::intrinsics):
296         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp: Added.
297         (WebCore::WHLSL::checkRecursiveTypes):
298         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
299         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp: Added.
300         (WebCore::WHLSL::FindArrayTypes::takeArrayTypes):
301         (WebCore::WHLSL::synthesizeArrayOperatorLength):
302         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
303         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp: Added.
304         (WebCore::WHLSL::FindAllTypes::takeUnnamedTypes):
305         (WebCore::WHLSL::FindAllTypes::takeNamedTypes):
306         (WebCore::WHLSL::synthesizeConstructors):
307         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
308         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp: Added.
309         (WebCore::WHLSL::synthesizeEnumerationFunctions):
310         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
311         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp: Added.
312         (WebCore::WHLSL::synthesizeStructureAccessors):
313         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
314         * Sources.txt:
315         * WebCore.xcodeproj/project.pbxproj:
316
317 2019-01-12  Dan Bernstein  <mitz@apple.com>
318
319         [Cocoa] Avoid importing directly from subumbrella frameworks
320         https://bugs.webkit.org/show_bug.cgi?id=186016
321         <rdar://problem/40591038>
322
323         Reviewed by Sam Weinig.
324
325         * Configurations/WebCore.xcconfig: Removed -iframework options from OTHER_CFLAGS and
326           OTHER_CPLUSPLUSFLAGS.
327         * editing/mac/DictionaryLookupLegacy.mm: Import Quartz.h instead of a PDFKit header.
328         * platform/mac/PlatformEventFactoryMac.mm: Import Carbon.h instead of HIToolbox headers.
329         * platform/text/mac/TextEncodingRegistryMac.mm: Import Carbon.h instead of CarbonCore.h.
330
331 2019-01-12  Zalan Bujtas  <zalan@apple.com>
332
333         [LFC] Move formatting context creation from FormattingState to LayoutState
334         https://bugs.webkit.org/show_bug.cgi?id=193381
335
336         Reviewed by Antti Koivisto.
337
338         layoutState().createFormattingStateForFormattingRootIfNeeded(root).createFormattingContext(root) is not only mouthful
339         but also feels unintuitive. Use layoutState().createFormattingContext(root) instead.
340
341         * layout/FormattingContext.cpp:
342         (WebCore::Layout::FormattingContext::FormattingContext):
343         (WebCore::Layout::FormattingContext::~FormattingContext):
344         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
345         * layout/FormattingContextGeometry.cpp:
346         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
347         * layout/FormattingState.h:
348         * layout/LayoutState.cpp:
349         (WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
350         (WebCore::Layout::LayoutState::createFormattingContext):
351         * layout/LayoutState.h:
352         (WebCore::Layout::LayoutState::deregisterFormattingContext):
353         (WebCore::Layout::LayoutState::registerFormattingContext):
354         * layout/blockformatting/BlockFormattingContext.cpp:
355         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
356         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
357         * layout/blockformatting/BlockFormattingState.cpp:
358         (WebCore::Layout::BlockFormattingState::createFormattingContext): Deleted.
359         * layout/blockformatting/BlockFormattingState.h:
360         * layout/inlineformatting/InlineFormattingContext.cpp:
361         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
362         * layout/inlineformatting/InlineFormattingState.cpp:
363         (WebCore::Layout::InlineFormattingState::createFormattingContext): Deleted.
364         * layout/inlineformatting/InlineFormattingState.h:
365
366 2019-01-12  Zalan Bujtas  <zalan@apple.com>
367
368         [LFC][BFC][MarginCollapsing] Move estimatedMarginBefore flag from state/display box to BlockFormattingContext
369         https://bugs.webkit.org/show_bug.cgi?id=193375
370
371         Reviewed by Antti Koivisto.
372
373         The estimated marginBefore is a pre-computed, temporary value. We need to keep it around until the final vertical margin value is computed.
374         Neither BlockFormattingState nor Display should hold temporary values.
375
376         * layout/blockformatting/BlockFormattingContext.cpp:
377         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBefore const):
378         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBeforeForAncestors const):
379         (WebCore::Layout::BlockFormattingContext::hasPrecomputedMarginBefore const):
380         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
381         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
382         (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const):
383         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
384         (WebCore::Layout::BlockFormattingContext::setEstimatedMarginBefore const):
385         (WebCore::Layout::BlockFormattingContext::hasEstimatedMarginBefore const):
386         (WebCore::Layout::hasPrecomputedMarginBefore): Deleted.
387         * layout/blockformatting/BlockFormattingContext.h:
388         (WebCore::Layout::BlockFormattingContext::removeEstimatedMarginBefore const):
389         (WebCore::Layout::BlockFormattingContext::estimatedMarginBefore const):
390         * layout/blockformatting/BlockFormattingState.h:
391         (WebCore::Layout::BlockFormattingState::setHasEstimatedMarginBefore): Deleted.
392         (WebCore::Layout::BlockFormattingState::clearHasEstimatedMarginBefore): Deleted.
393         (WebCore::Layout::BlockFormattingState::hasEstimatedMarginBefore const): Deleted.
394         * layout/displaytree/DisplayBox.cpp:
395         (WebCore::Display::Box::Box):
396         * layout/displaytree/DisplayBox.h:
397         (WebCore::Display::Box::setHasEstimatedMarginBefore):
398         (WebCore::Display::Box::invalidateEstimatedMarginBefore):
399         (WebCore::Display::Box::top const):
400         (WebCore::Display::Box::topLeft const):
401         (WebCore::Display::Box::setEstimatedMarginBefore): Deleted.
402         (WebCore::Display::Box::estimatedMarginBefore const): Deleted.
403         * page/FrameViewLayoutContext.cpp:
404         (WebCore::layoutUsingFormattingContext):
405
406 2019-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
407
408         [WHLSL] Implement the NameResolver
409         https://bugs.webkit.org/show_bug.cgi?id=193007
410
411         Reviewed by Dean Jackson.
412
413         This is the base implementation for WHLSL's name resolver. The name resolver matches three kinds of things:
414         1. It matches VariableRefs to VariableDecls
415         2. It matches TypeRefs to NamedTypes
416         3. It matches CallExpressions to FunctionDeclarations
417
418         No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
419         of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
420
421         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: Now that InferTypes.h exists, we can implement these
422         functions.
423         (WebCore::WHLSL::AST::FloatLiteralType::canResolve const):
424         (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const):
425         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: Remove unnecessary function.
426         (WebCore::WHLSL::AST::FloatLiteralType::value const): Deleted.
427         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: Now that InferTypes.h exists, we can implement these
428         functions.
429         (WebCore::WHLSL::AST::IntegerLiteralType::canResolve const):
430         (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const):
431         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: Remove unnecessary function.
432         (WebCore::WHLSL::AST::IntegerLiteralType::value const): Deleted.
433         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: Modifying Sources.txt caused the sources
434         to get shuffled around, so the #includes need to be fixed.
435         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: Now that InferTypes.h exists, we can implement
436         these functions.
437         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::canResolve const):
438         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const):
439         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: Remove unnecessary function.
440         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::value const): Deleted.
441         * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: Added. This is the replacement for UnificationContext in the
442         reference compiler. It's much simpler (and we should remove UnificationContext in the reference compiler in
443         favor of this design). It has three sets of functions: Tell if two types are the same, tell if two types are
444         the same and commit the resolvable type, and run the above functions on type references or function arguments.
445         (WebCore::WHLSL::matches):
446         (WebCore::WHLSL::matchAndCommit):
447         (WebCore::WHLSL::commit):
448         (WebCore::WHLSL::inferTypesForTypeArguments):
449         (WebCore::WHLSL::inferTypesForCall):
450         * Modules/webgpu/WHLSL/WHLSLInferTypes.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp.
451         * Modules/webgpu/WHLSL/WHLSLNameContext.cpp: Added. This is the data structure that remembers NamedTypes,
452         FunctionDeclarations, and VariableDeclarations so NameResolver can work.
453         (WebCore::WHLSL::NameContext::NameContext):
454         (WebCore::WHLSL::NameContext::add):
455         (WebCore::WHLSL::NameContext::getTypes):
456         (WebCore::WHLSL::NameContext::getFunctions):
457         (WebCore::WHLSL::NameContext::getVariable):
458         (WebCore::WHLSL::NameContext::exists):
459         * Modules/webgpu/WHLSL/WHLSLNameContext.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h.
460         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp: Added. Use the NameContext to match up the three types of names.
461         (WebCore::WHLSL::NameResolver::NameResolver):
462         (WebCore::WHLSL::NameResolver::visit):
463         (WebCore::WHLSL::resolveNamesInTypes):
464         (WebCore::WHLSL::resolveNamesInFunctions):
465         * Modules/webgpu/WHLSL/WHLSLNameResolver.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h.
466         (WebCore::WHLSL::NameResolver::setCurrentFunctionDefinition):
467         * Modules/webgpu/WHLSL/WHLSLProgram.h:
468         (WebCore::WHLSL::Program::append): The parser needs to add all global declarations to the name context so the
469         name resolver is ready to go as soon as parsing is finished.
470         (WebCore::WHLSL::Program::nameContext):
471         * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp: Added. Pick the appropriate FunctionDeclaration or
472         NamedType for a particular CallExpression or TypeReference.
473         (WebCore::WHLSL::conversionCost):
474         (WebCore::WHLSL::resolveFunctionOverloadImpl):
475         (WebCore::WHLSL::resolveTypeOverloadImpl):
476         * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp.
477         * Modules/webgpu/WHLSL/WHLSLResolvingType.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp. This describes the two states that a type in the type resolver can be in: either an owned
478         UnnamedType, or a reference to a ResolvableType. This is because every expression needs to have a type
479         associated with it, but those types might be the type of a literal (aka a ResolvableType). Multiple
480         expressions might need to reference the same ResolvableType so when it gets resolved, all the expressions
481         get the result.
482         (WebCore::WHLSL::ResolvableTypeReference::ResolvableTypeReference):
483         (WebCore::WHLSL::ResolvableTypeReference::resolvableType):
484         * Sources.txt:
485         * WebCore.xcodeproj/project.pbxproj:
486
487 2019-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
488
489         [WHLSL] Add a Visitor class
490         https://bugs.webkit.org/show_bug.cgi?id=192826
491
492         Reviewed by Dean Jackson.
493
494         This patch exposes a bunch of the private members of WHLSL's AST nodes so that Visitor can recurse on constituent nodes.
495         It also writes the recursion in Visitor.h. This is a virtual base class that gets subclassed for compiler passes.
496
497         I've split this part into its own patch to aid reviewing of the compiler.
498
499         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp:
500         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp: Added.
501         (WebCore::WHLSL::Visitor::visit):
502         (WebCore::WHLSL::Visitor::checkErrorAndVisit):
503         * Modules/webgpu/WHLSL/WHLSLVisitor.h: Added.
504         (WebCore::WHLSL::Visitor::setError):
505         (WebCore::WHLSL::Visitor::error const):
506         * Sources.txt:
507         * WebCore.xcodeproj/project.pbxproj:
508
509 2019-01-11  Jer Noble  <jer.noble@apple.com>
510
511         REGRESSION(r239419): Crash in AudioSourceProviderAVFObjC::~AudioSourceProviderAVFObjC()
512         https://bugs.webkit.org/show_bug.cgi?id=193342
513         <rdar://problem/47119836>
514
515         Reviewed by Eric Carlson.
516
517         Make the TapStorage used by AudioSourceProviderAVFObjC thread-safe RefCounted.
518
519         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
520         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
521         (WebCore::AudioSourceProviderAVFObjC::initCallback):
522         (WebCore::AudioSourceProviderAVFObjC::finalizeCallback):
523
524 2019-01-11  John Wilander  <wilander@apple.com>
525
526         Compile out Web API Statistics Collection
527         https://bugs.webkit.org/show_bug.cgi?id=193370
528         <rdar://problem/45388584>
529
530         Reviewed by Brent Fulgham.
531
532         No new tests. This patch disables functionality. The associated tests
533         are skipped.
534
535         These functions are now no-ops unless web API statistics is enabled.
536
537         * Configurations/FeatureDefines.xcconfig:
538         * loader/ResourceLoadObserver.cpp:
539         (WebCore::ResourceLoadObserver::logFontLoad):
540         (WebCore::ResourceLoadObserver::logCanvasRead):
541         (WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
542         (WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
543         (WebCore::ResourceLoadObserver::logScreenAPIAccessed):
544         * loader/ResourceLoadStatistics.cpp:
545         (WebCore::ResourceLoadStatistics::encode const):
546         (WebCore::ResourceLoadStatistics::decode):
547         (WebCore::ResourceLoadStatistics::toString const):
548         (WebCore::ResourceLoadStatistics::merge):
549         * loader/ResourceLoadStatistics.h:
550             The associated struct members are skipped unless web API
551             statistics is enabled.
552
553 2019-01-11  Sihui Liu  <sihui_liu@apple.com>
554
555         IndexedDB: leak WebIDBConnectionToClient for retain cycle
556         https://bugs.webkit.org/show_bug.cgi?id=193097
557         <rdar://problem/46899601>
558
559         Reviewed by Brady Eidson.
560
561         Let IDBConnectionToClient hold a WeakPtr of IDBConnectionToClientDelegate.
562
563         * Modules/indexeddb/server/IDBConnectionToClient.cpp:
564         (WebCore::IDBServer::IDBConnectionToClient::IDBConnectionToClient):
565         (WebCore::IDBServer::IDBConnectionToClient::identifier const):
566         (WebCore::IDBServer::IDBConnectionToClient::didDeleteDatabase):
567         (WebCore::IDBServer::IDBConnectionToClient::didOpenDatabase):
568         (WebCore::IDBServer::IDBConnectionToClient::didAbortTransaction):
569         (WebCore::IDBServer::IDBConnectionToClient::didCreateObjectStore):
570         (WebCore::IDBServer::IDBConnectionToClient::didDeleteObjectStore):
571         (WebCore::IDBServer::IDBConnectionToClient::didRenameObjectStore):
572         (WebCore::IDBServer::IDBConnectionToClient::didClearObjectStore):
573         (WebCore::IDBServer::IDBConnectionToClient::didCreateIndex):
574         (WebCore::IDBServer::IDBConnectionToClient::didDeleteIndex):
575         (WebCore::IDBServer::IDBConnectionToClient::didRenameIndex):
576         (WebCore::IDBServer::IDBConnectionToClient::didPutOrAdd):
577         (WebCore::IDBServer::IDBConnectionToClient::didGetRecord):
578         (WebCore::IDBServer::IDBConnectionToClient::didGetAllRecords):
579         (WebCore::IDBServer::IDBConnectionToClient::didGetCount):
580         (WebCore::IDBServer::IDBConnectionToClient::didDeleteRecord):
581         (WebCore::IDBServer::IDBConnectionToClient::didOpenCursor):
582         (WebCore::IDBServer::IDBConnectionToClient::didIterateCursor):
583         (WebCore::IDBServer::IDBConnectionToClient::didCommitTransaction):
584         (WebCore::IDBServer::IDBConnectionToClient::fireVersionChangeEvent):
585         (WebCore::IDBServer::IDBConnectionToClient::didStartTransaction):
586         (WebCore::IDBServer::IDBConnectionToClient::didCloseFromServer):
587         (WebCore::IDBServer::IDBConnectionToClient::notifyOpenDBRequestBlocked):
588         (WebCore::IDBServer::IDBConnectionToClient::didGetAllDatabaseNames):
589         * Modules/indexeddb/server/IDBConnectionToClient.h:
590         * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
591
592 2019-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
593
594         Fix the build after r239844
595         https://bugs.webkit.org/show_bug.cgi?id=192991
596
597         Unreviewed.
598
599         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp:
600         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp:
601         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp:
602         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp:
603
604 2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
605
606         [iOS] Precision drop state thrashes when dragging near the top edge of an editable element
607         https://bugs.webkit.org/show_bug.cgi?id=193364
608         <rdar://problem/47214117>
609
610         Reviewed by Tim Horton.
611
612         Add a new helper method on DragCaretController to compute the bounds of the editable element around the drop
613         caret position. This is either the enclosing form control (in the case of text fields and text areas), or the
614         highest editable root. See WebKit ChangeLog for more details.
615
616         Test: DragAndDropTests.AvoidPreciseDropNearTopOfTextArea
617
618         * editing/FrameSelection.cpp:
619         (WebCore::DragCaretController::editableElementRectInRootViewCoordinates const):
620         * editing/FrameSelection.h:
621
622 2019-01-11  Tim Horton  <timothy_horton@apple.com>
623
624         REGRESSION (PSON): Firefox app lacks Open in New Tab in menu
625         https://bugs.webkit.org/show_bug.cgi?id=193366
626         <rdar://problem/46097212>
627
628         Reviewed by Simon Fraser.
629
630         * platform/RuntimeApplicationChecks.h:
631         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
632         (WebCore::IOSApplication::isFirefox):
633         Add a Firefox Mobile bundle check.
634
635 2019-01-11  Antti Koivisto  <antti@apple.com>
636
637         Release assert when removing element with a map element in the shadow tree
638         https://bugs.webkit.org/show_bug.cgi?id=193351
639         <rdar://problem/47208807>
640
641         Reviewed by Ryosuke Niwa.
642
643         When a shadow host that has a map element in the shadow tree is removed from the document, we try
644         to remove the map from the scope of the host.
645
646         Test: fast/shadow-dom/image-map-tree-scope.html
647
648         * html/HTMLMapElement.cpp:
649         (WebCore::HTMLMapElement::insertedIntoAncestor):
650         (WebCore::HTMLMapElement::removedFromAncestor):
651
652         Add and remove image maps when the scope changes, not when the document changes.
653         This matches how id/name/etc updates work in the HTMLElement.
654
655 2019-01-11  Sihui Liu  <sihui_liu@apple.com>
656
657         Fix an assertion in UniqueIDBDatabase
658         https://bugs.webkit.org/show_bug.cgi?id=193096
659
660         Reviewed by Brady Eidson.
661
662         m_objectStoreTransactionCounts.count(objectStore) == 1 in UniqueIDBDatabase::operationAndTransactionTimerFired()
663         is not necessarily true because m_objectStoreTransactionCounts may be cleared in immediateCloseForUserDelete.
664
665         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
666         (WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired):
667
668 2019-01-11  Miguel Gomez  <magomez@igalia.com>
669
670         [GTK] Garbled rendering on Youtube while scrolling under X11.
671         https://bugs.webkit.org/show_bug.cgi?id=192982
672
673         Reviewed by Carlos Garcia Campos.
674
675         When creating a GLX window context, try to get a GLXFBConfig that has depth and stencil buffers for
676         the default framebuffer.
677
678         * platform/graphics/glx/GLContextGLX.cpp:
679         (WebCore::compatibleVisuals):
680         (WebCore::GLContextGLX::createWindowContext):
681
682 2019-01-11  Sihui Liu  <sihui_liu@apple.com>
683
684         IndexedDB: leak IDBTransaction, TransactionOperation and IDBRequest in layout tests
685         https://bugs.webkit.org/show_bug.cgi?id=193167
686         <rdar://problem/46891688>
687
688         Reviewed by Geoffrey Garen.
689
690         Do some cleanup to break retain cycle when context is stopped. 
691
692         * Modules/indexeddb/IDBOpenDBRequest.cpp:
693         (WebCore::IDBOpenDBRequest::cancelForStop):
694         * Modules/indexeddb/IDBTransaction.cpp:
695         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
696         (WebCore::IDBTransaction::stop):
697         (WebCore::IDBTransaction::removeRequest):
698         * Modules/indexeddb/client/TransactionOperation.h:
699         (WebCore::IDBClient::TransactionOperation::doComplete):
700
701 2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
702
703         Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
704         https://bugs.webkit.org/show_bug.cgi?id=193109
705         <rdar://problem/44807048>
706
707         Reviewed by Ryosuke Niwa.
708
709         Adds new IDL files and stubs for UndoManager and UndoItem. This is an experimental DOM API that (in the near
710         future) is intended only for use in internal WebKit text editing clients. This API allows the page to
711         participate in the processes of undoing and redoing by defining custom undo and redo handlers, to be executed
712         when undo or redo is triggered.
713
714         Tests: editing/undo-manager/undo-manager-interfaces.html
715                editing/undo-manager/undo-manager-keeps-wrapper-alive.html
716
717         * CMakeLists.txt:
718         * DerivedSources-input.xcfilelist:
719         * DerivedSources-output.xcfilelist:
720         * DerivedSources.make:
721         * Sources.txt:
722         * UnifiedSources-input.xcfilelist:
723         * WebCore.xcodeproj/project.pbxproj:
724
725         Add new source files.
726
727         * bindings/js/WebCoreBuiltinNames.h:
728
729         Add "UndoManager" and "UndoItem" names.
730
731         * dom/Document.cpp:
732         (WebCore::m_undoManager):
733
734         Have the document own a UndoManager.
735
736         * dom/Document.h:
737         (WebCore::Document::undoManager const):
738         * dom/Document.idl:
739         * page/RuntimeEnabledFeatures.h:
740         (WebCore::RuntimeEnabledFeatures::setUndoManagerAPIEnabled):
741         (WebCore::RuntimeEnabledFeatures::undoManagerAPIEnabled const):
742
743         Guard the new bindings behind a runtime-enabled feature flag.
744
745         * page/UndoItem.h: Added.
746         (WebCore::UndoItem::create):
747         (WebCore::UndoItem::label const):
748         (WebCore::UndoItem::undoHandler const):
749         (WebCore::UndoItem::redoHandler const):
750         (WebCore::UndoItem::UndoItem):
751         * page/UndoItem.idl: Added.
752         * page/UndoManager.cpp: Added.
753         (WebCore::UndoManager::addItem):
754         * page/UndoManager.h: Added.
755         (WebCore::UndoManager::create):
756         (WebCore::UndoManager::document):
757         (WebCore::UndoManager::UndoManager):
758         * page/UndoManager.idl: Added.
759         * page/mac/WheelEventDeltaFilterMac.h:
760
761         Necessary (albeit unrelated) build fix to appease unified sources.
762
763 2019-01-11  Zalan Bujtas  <zalan@apple.com>
764
765         [LFC][BFC][MarginCollapsing] Adjust vertical position when box margin collapses through.
766         https://bugs.webkit.org/show_bug.cgi?id=193346
767
768         Reviewed by Antti Koivisto.
769
770         If the top and bottom margins of a box are adjoining, then it is possible for margins to collapse through it.
771         In this case, the position of the element depends on its relationship with the other elements whose margins are being collapsed.
772
773         1. If the element's margins are collapsed with its parent's top margin, the top border edge of the box is defined to be the same as the parent's.
774         2. Otherwise, either the element's parent is not taking part in the margin collapsing, or only the parent's bottom margin is involved.
775            The position of the element's top border edge is the same as it would have been if the element had a non-zero bottom border.
776
777         Test: fast/block/block-only/collapsed-through-with-parent.html
778
779         * layout/MarginTypes.h:
780         (WebCore::Layout::EstimatedMarginBefore::usedValue const):
781         * layout/blockformatting/BlockFormattingContext.cpp:
782         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBefore const):
783         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
784         (WebCore::Layout::BlockFormattingContext::adjustedVerticalPositionAfterMarginCollapsing const):
785         * layout/blockformatting/BlockFormattingContext.h:
786         * layout/blockformatting/BlockMarginCollapse.cpp:
787         (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
788         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeIgnoringCollapsingThrough):
789
790 2019-01-10  Myles C. Maxfield  <mmaxfield@apple.com>
791
792         [WHLSL] Include the standard library
793         https://bugs.webkit.org/show_bug.cgi?id=192994
794
795         Reviewed by Jon Lee.
796
797         A small section of the standard library is present in WHLSLStandardLibrary.txt. This gets turned into a header file containing
798         its raw data at build time by invoking our xxd.pl script (which WebCore already uses for other purposes). The standard
799         library is generated by running a JavaScript script, but currently there is no way to invoke JavaScript from our build
800         process, so this patch includes in the standard library's raw text instead. Once the parser is faster, we can include the
801         entire standard library.
802
803         No new tests because it isn't hooked up yet.
804
805         * DerivedSources.make:
806         * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt: Added.
807         * WebCore.xcodeproj/project.pbxproj:
808
809 2019-01-10  Jer Noble  <jer.noble@apple.com>
810
811         <video> elements do not enter 'paused' state when playing to end over AirPlay
812         https://bugs.webkit.org/show_bug.cgi?id=193295
813         <rdar://problem/46708670>
814
815         Reviewed by Eric Carlson.
816
817         Adopt the -[AVPlayer timeControlStatus] API, which reports whether the AVPlayer is paused, playing, or blocked waiting
818         for more data before playing. AirPlay devices report this state back from the remote device, and this allows the
819         MediaPlayerPrivateAVFoundationObjC to differentiate between user-generated pauses and simple stalling.
820
821         Adopting this API allows us to remove the heuristic from rateChanged() which inteprets a rate change when the
822         readyState > HAVE_ENOUGH as an intentional pause.
823
824         Drive-by fix: MediaPlayerPrivateAVFoundation had some code to delay calling platformPlay()
825         until the first frame became available. But this code was entirely undermined by the previous
826         behavior of setRate(). Fixing setRate()/setRateDouble() to only start playback if playback was
827         actually requested started making this code work for the first time, and broke some API tests.
828         Thus, we're removing this previously dead code.
829
830         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
831         (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
832         (WebCore::MediaPlayerPrivateAVFoundation::play):
833         (WebCore::MediaPlayerPrivateAVFoundation::pause):
834         (WebCore::MediaPlayerPrivateAVFoundation::rateChanged):
835         (WebCore::MediaPlayerPrivateAVFoundation::updateStates):
836         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
837         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
838         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
839         (WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad):
840         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
841         (WebCore::MediaPlayerPrivateAVFoundationObjC::didEnd):
842         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformPlay):
843         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformPause):
844         (WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):
845         (WebCore::MediaPlayerPrivateAVFoundationObjC::setRateDouble):
846         (WebCore::MediaPlayerPrivateAVFoundationObjC::setPlayerRate):
847         (WebCore::MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange):
848         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeControlStatus):
849         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
850
851 2019-01-10  Myles C. Maxfield  <mmaxfield@apple.com>
852
853         Fix the build after r239844
854         https://bugs.webkit.org/show_bug.cgi?id=192991
855
856         Unreviewed.
857
858         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp:
859         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const):
860         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const):
861         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp:
862         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const):
863         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection const):
864         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp:
865         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const):
866         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const):
867         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp:
868         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const):
869         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const):
870
871 2019-01-10  Justin Fan  <justin_fan@apple.com>
872
873         [WebGPU] WebGPUBindGroup and device::createBindGroup prototype
874         https://bugs.webkit.org/show_bug.cgi?id=193341
875
876         Reviewed by Myles C. Maxfield.
877
878         Add *GPUBindGroup class stubs and the ability to create WebGPUBindGroups via the API.
879
880         Test: bind-groups.html
881
882         * CMakeLists.txt:
883         * DerivedSources.make:
884         * Sources.txt:
885         * WebCore.xcodeproj/project.pbxproj:
886         * bindings/js/WebCoreBuiltinNames.h:
887
888         * Modules/webgpu/WebGPUBindGroup.cpp:
889         (WebCore::WebGPUBindGroup::create):
890         (WebCore::WebGPUBindGroup::WebGPUBindGroup):
891         * Modules/webgpu/WebGPUBindGroup.h:
892         * Modules/webgpu/WebGPUBindGroup.idl: Enable createBindGroup().
893         * Modules/webgpu/WebGPUDevice.cpp:
894         (WebCore::BindingResourceVisitor::operator() const): Added. Validate and convert WebGPUBindGroupDescriptor to GPU* version.
895         (WebCore::WebGPUDevice::createBindGroup const): Added.
896         * Modules/webgpu/WebGPUDevice.h:
897         * platform/graphics/gpu/GPUBindGroup.cpp:
898         (WebCore::GPUBindGroup::create):
899         (WebCore::GPUBindGroup::GPUBindGroup):
900         * platform/graphics/gpu/GPUBindGroup.h:
901         * platform/graphics/gpu/GPUBufferBinding.h:
902         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
903         (WebCore::appendArgumentToArray): Pass RetainPtr by reference to actually update descriptor.
904
905 2019-01-10  Simon Fraser  <simon.fraser@apple.com>
906
907         Fix rare crash under ScrollbarThemeMac::paintScrollCorner()
908         https://bugs.webkit.org/show_bug.cgi?id=193337
909         rdar://problem/47179993
910
911         Reviewed by Zalan Bujtas.
912         
913         Async image decoding can trigger a FrameView::traverseForPaintInvalidation() fake paint,
914         which creates a GraphicsContext with no platform context. However, we could hit ScrollView::paintScrollbars()
915         which tried to get at the platform context, and then crashed.
916         
917         So protect two functions in ScrollbarThemeMac with if (context.paintingDisabled()) checks. I verified
918         that other scrollbar-related painting code paths were already protected.
919
920         Hard to test because it depends on async image decoding timing.
921
922         * platform/mac/ScrollbarThemeMac.mm:
923         (WebCore::ScrollbarThemeMac::paint):
924         (WebCore::ScrollbarThemeMac::paintScrollCorner):
925
926 2019-01-10  Myles C. Maxfield  <mmaxfield@apple.com>
927
928         [WHLSL] Implement parser AST nodes
929         https://bugs.webkit.org/show_bug.cgi?id=192991
930
931         Reviewed by Alex Christensen.
932
933         This patch creates all the AST nodes which will be the result of running the parser.
934         This patch used to be a part of the "create a WHLSL parser" patch but I split them
935         out in order to aid reviewing.
936
937         The classes were mechanically created to match the result of the parser. There are
938         nodes for things like ForLoops, LogicalNotExpressions, DereferenceExpressions,
939         StructureDefinitions, and things like that. The classes don't actually have any logic
940         in them - they are currently just containers to hold the structure of the parsed
941         program. Some of these nodes (like constexprs) are just Variants of the various things
942         they can in the form of.
943
944         No new tests because the parser doesn't exist to create the new AST nodes yet.
945
946         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h: Added.
947         (WebCore::WHLSL::AST::ArrayReferenceType::ArrayReferenceType):
948         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: Added.
949         (WebCore::WHLSL::AST::ArrayType::ArrayType):
950         (WebCore::WHLSL::AST::ArrayType::type const):
951         (WebCore::WHLSL::AST::ArrayType::type):
952         (WebCore::WHLSL::AST::ArrayType::numElements const):
953         * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: Added.
954         (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression):
955         (WebCore::WHLSL::AST::AssignmentExpression::left):
956         (WebCore::WHLSL::AST::AssignmentExpression::right):
957         * Modules/webgpu/WHLSL/AST/WHLSLBaseFunctionAttribute.h: Added.
958         (WebCore::WHLSL::AST::BaseFunctionAttribute::BaseFunctionAttribute):
959         * Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h: Added.
960         (WebCore::WHLSL::AST::BaseSemantic::BaseSemantic):
961         * Modules/webgpu/WHLSL/AST/WHLSLBlock.h: Added.
962         (WebCore::WHLSL::AST::Block::Block):
963         (WebCore::WHLSL::AST::Block::statements):
964         * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h: Added.
965         (WebCore::WHLSL::AST::BooleanLiteral::BooleanLiteral):
966         (WebCore::WHLSL::AST::BooleanLiteral::value const):
967         (WebCore::WHLSL::AST::BooleanLiteral::clone const):
968         * Modules/webgpu/WHLSL/AST/WHLSLBreak.h: Added.
969         (WebCore::WHLSL::AST::Break::Break):
970         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp: Added.
971         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const):
972         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const):
973         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: Added.
974         (WebCore::WHLSL::AST::BuiltInSemantic::BuiltInSemantic):
975         (WebCore::WHLSL::AST::BuiltInSemantic::variable const):
976         (WebCore::WHLSL::AST::BuiltInSemantic::operator== const):
977         (WebCore::WHLSL::AST::BuiltInSemantic::operator!= const):
978         * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h: Added.
979         (WebCore::WHLSL::AST::CallExpression::CallExpression):
980         (WebCore::WHLSL::AST::CallExpression::arguments):
981         (WebCore::WHLSL::AST::CallExpression::name):
982         (WebCore::WHLSL::AST::CallExpression::setCastData):
983         (WebCore::WHLSL::AST::CallExpression::isCast):
984         (WebCore::WHLSL::AST::CallExpression::castReturnType):
985         (WebCore::WHLSL::AST::CallExpression::hasOverloads const):
986         (WebCore::WHLSL::AST::CallExpression::overloads):
987         (WebCore::WHLSL::AST::CallExpression::setOverloads):
988         (WebCore::WHLSL::AST::CallExpression::setFunction):
989         * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h: Added.
990         (WebCore::WHLSL::AST::CommaExpression::CommaExpression):
991         (WebCore::WHLSL::AST::CommaExpression::list):
992         * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: Added.
993         (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression):
994         (WebCore::WHLSL::AST::ConstantExpression::integerLiteral):
995         (WebCore::WHLSL::AST::ConstantExpression::visit):
996         (WebCore::WHLSL::AST::ConstantExpression::visit const):
997         (WebCore::WHLSL::AST::ConstantExpression::clone const):
998         (WebCore::WHLSL::AST::ConstantExpression::matches const):
999         * Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Added.
1000         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::ConstantExpressionEnumerationMemberReference):
1001         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::left const):
1002         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::right const):
1003         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::clone const):
1004         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition):
1005         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition const):
1006         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember):
1007         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember const):
1008         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::setEnumerationMember):
1009         * Modules/webgpu/WHLSL/AST/WHLSLContinue.h: Added.
1010         (WebCore::WHLSL::AST::Continue::Continue):
1011         * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: Added.
1012         (WebCore::WHLSL::AST::DereferenceExpression::DereferenceExpression):
1013         (WebCore::WHLSL::AST::DereferenceExpression::pointer):
1014         * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: Added.
1015         (WebCore::WHLSL::AST::DoWhileLoop::DoWhileLoop):
1016         (WebCore::WHLSL::AST::DoWhileLoop::body):
1017         (WebCore::WHLSL::AST::DoWhileLoop::conditional):
1018         * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: Added.
1019         (WebCore::WHLSL::AST::DotExpression::DotExpression):
1020         (WebCore::WHLSL::AST::DotExpression::fieldName):
1021         * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: Added.
1022         (WebCore::WHLSL::AST::EffectfulExpressionStatement::EffectfulExpressionStatement):
1023         (WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression):
1024         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: Added.
1025         (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition):
1026         (WebCore::WHLSL::AST::EnumerationDefinition::type):
1027         (WebCore::WHLSL::AST::EnumerationDefinition::add):
1028         (WebCore::WHLSL::AST::EnumerationDefinition::memberByName):
1029         (WebCore::WHLSL::AST::EnumerationDefinition::enumerationMembers):
1030         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h: Added.
1031         (WebCore::WHLSL::AST::EnumerationMember::EnumerationMember):
1032         (WebCore::WHLSL::AST::EnumerationMember::origin const):
1033         (WebCore::WHLSL::AST::EnumerationMember::name):
1034         (WebCore::WHLSL::AST::EnumerationMember::value):
1035         (WebCore::WHLSL::AST::EnumerationMember::setValue):
1036         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: Added.
1037         (WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral):
1038         (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember):
1039         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: Added.
1040         (WebCore::WHLSL::AST::Expression::Expression):
1041         (WebCore::WHLSL::AST::Expression::origin const):
1042         (WebCore::WHLSL::AST::Expression::isAssignmentExpression const):
1043         (WebCore::WHLSL::AST::Expression::isBooleanLiteral const):
1044         (WebCore::WHLSL::AST::Expression::isCallExpression const):
1045         (WebCore::WHLSL::AST::Expression::isCommaExpression const):
1046         (WebCore::WHLSL::AST::Expression::isDereferenceExpression const):
1047         (WebCore::WHLSL::AST::Expression::isDotExpression const):
1048         (WebCore::WHLSL::AST::Expression::isFloatLiteral const):
1049         (WebCore::WHLSL::AST::Expression::isIndexExpression const):
1050         (WebCore::WHLSL::AST::Expression::isIntegerLiteral const):
1051         (WebCore::WHLSL::AST::Expression::isLogicalExpression const):
1052         (WebCore::WHLSL::AST::Expression::isLogicalNotExpression const):
1053         (WebCore::WHLSL::AST::Expression::isMakeArrayReferenceExpression const):
1054         (WebCore::WHLSL::AST::Expression::isMakePointerExpression const):
1055         (WebCore::WHLSL::AST::Expression::isNullLiteral const):
1056         (WebCore::WHLSL::AST::Expression::isPropertyAccessExpression const):
1057         (WebCore::WHLSL::AST::Expression::isReadModifyWriteExpression const):
1058         (WebCore::WHLSL::AST::Expression::isTernaryExpression const):
1059         (WebCore::WHLSL::AST::Expression::isUnsignedIntegerLiteral const):
1060         (WebCore::WHLSL::AST::Expression::isVariableReference const):
1061         (WebCore::WHLSL::AST::Expression::isEnumerationMemberLiteral const):
1062         * Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h: Added.
1063         (WebCore::WHLSL::AST::Fallthrough::Fallthrough):
1064         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h: Added.
1065         (WebCore::WHLSL::AST::FloatLiteral::FloatLiteral):
1066         (WebCore::WHLSL::AST::FloatLiteral::type):
1067         (WebCore::WHLSL::AST::FloatLiteral::value const):
1068         (WebCore::WHLSL::AST::FloatLiteral::clone const):
1069         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: Added.
1070         (WebCore::WHLSL::AST::FloatLiteralType::FloatLiteralType):
1071         (WebCore::WHLSL::AST::FloatLiteralType::canResolve const):
1072         (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const):
1073         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: Added.
1074         (WebCore::WHLSL::AST::FloatLiteralType::preferredType):
1075         * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: Added.
1076         (WebCore::WHLSL::AST::ForLoop::ForLoop):
1077         (WebCore::WHLSL::AST::ForLoop::~ForLoop):
1078         (WebCore::WHLSL::AST::ForLoop::initialization):
1079         (WebCore::WHLSL::AST::ForLoop::condition):
1080         (WebCore::WHLSL::AST::ForLoop::increment):
1081         (WebCore::WHLSL::AST::ForLoop::body):
1082         * Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h: Added.
1083         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: Added.
1084         (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration):
1085         (WebCore::WHLSL::AST::FunctionDeclaration::isFunctionDefinition const):
1086         (WebCore::WHLSL::AST::FunctionDeclaration::isNativeFunctionDeclaration const):
1087         (WebCore::WHLSL::AST::FunctionDeclaration::attributeBlock):
1088         (WebCore::WHLSL::AST::FunctionDeclaration::entryPointType const):
1089         (WebCore::WHLSL::AST::FunctionDeclaration::type const):
1090         (WebCore::WHLSL::AST::FunctionDeclaration::type):
1091         (WebCore::WHLSL::AST::FunctionDeclaration::name const):
1092         (WebCore::WHLSL::AST::FunctionDeclaration::isCast const):
1093         (WebCore::WHLSL::AST::FunctionDeclaration::parameters const):
1094         (WebCore::WHLSL::AST::FunctionDeclaration::parameters):
1095         (WebCore::WHLSL::AST::FunctionDeclaration::semantic):
1096         (WebCore::WHLSL::AST::FunctionDeclaration::isOperator const):
1097         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h: Added.
1098         (WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition):
1099         (WebCore::WHLSL::AST::FunctionDefinition::block):
1100         (WebCore::WHLSL::AST::FunctionDefinition::restricted const):
1101         * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: Added.
1102         (WebCore::WHLSL::AST::IfStatement::IfStatement):
1103         (WebCore::WHLSL::AST::IfStatement::conditional):
1104         (WebCore::WHLSL::AST::IfStatement::body):
1105         (WebCore::WHLSL::AST::IfStatement::elseBody):
1106         * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: Added.
1107         (WebCore::WHLSL::AST::IndexExpression::IndexExpression):
1108         (WebCore::WHLSL::AST::IndexExpression::indexExpression):
1109         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp: Added.
1110         (WebCore::WHLSL::AST::IntegerLiteral::valueForSelectedType const):
1111         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h: Added.
1112         (WebCore::WHLSL::AST::IntegerLiteral::IntegerLiteral):
1113         (WebCore::WHLSL::AST::IntegerLiteral::type):
1114         (WebCore::WHLSL::AST::IntegerLiteral::value const):
1115         (WebCore::WHLSL::AST::IntegerLiteral::clone const):
1116         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: Added.
1117         (WebCore::WHLSL::AST::IntegerLiteralType::IntegerLiteralType):
1118         (WebCore::WHLSL::AST::IntegerLiteralType::canResolve const):
1119         (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const):
1120         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: Added.
1121         (WebCore::WHLSL::AST::IntegerLiteralType::preferredType):
1122         * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: Added.
1123         (WebCore::WHLSL::AST::LogicalExpression::LogicalExpression):
1124         (WebCore::WHLSL::AST::LogicalExpression::type const):
1125         (WebCore::WHLSL::AST::LogicalExpression::left):
1126         (WebCore::WHLSL::AST::LogicalExpression::right):
1127         * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: Added.
1128         (WebCore::WHLSL::AST::LogicalNotExpression::LogicalNotExpression):
1129         (WebCore::WHLSL::AST::LogicalNotExpression::operand):
1130         * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: Added.
1131         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression):
1132         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue):
1133         * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: Added.
1134         (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression):
1135         (WebCore::WHLSL::AST::MakePointerExpression::lValue):
1136         * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h: Added.
1137         (WebCore::WHLSL::AST::NamedType::NamedType):
1138         (WebCore::WHLSL::AST::NamedType::origin const):
1139         (WebCore::WHLSL::AST::NamedType::name):
1140         (WebCore::WHLSL::AST::NamedType::isTypeDefinition const):
1141         (WebCore::WHLSL::AST::NamedType::isStructureDefinition const):
1142         (WebCore::WHLSL::AST::NamedType::isEnumerationDefinition const):
1143         (WebCore::WHLSL::AST::NamedType::isNativeTypeDeclaration const):
1144         (WebCore::WHLSL::AST::NamedType::unifyNode const):
1145         (WebCore::WHLSL::AST::NamedType::unifyNode):
1146         * Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h: Added.
1147         (WebCore::WHLSL::AST::NativeFunctionDeclaration::NativeFunctionDeclaration):
1148         (WebCore::WHLSL::AST::NativeFunctionDeclaration::restricted const):
1149         * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h: Added.
1150         (WebCore::WHLSL::AST::NativeTypeDeclaration::NativeTypeDeclaration):
1151         (WebCore::WHLSL::AST::NativeTypeDeclaration::name const):
1152         (WebCore::WHLSL::AST::NativeTypeDeclaration::name):
1153         (WebCore::WHLSL::AST::NativeTypeDeclaration::typeArguments):
1154         (WebCore::WHLSL::AST::NativeTypeDeclaration::isInt const):
1155         (WebCore::WHLSL::AST::NativeTypeDeclaration::isNumber const):
1156         (WebCore::WHLSL::AST::NativeTypeDeclaration::isFloating const):
1157         (WebCore::WHLSL::AST::NativeTypeDeclaration::isVector const):
1158         (WebCore::WHLSL::AST::NativeTypeDeclaration::isMatrix const):
1159         (WebCore::WHLSL::AST::NativeTypeDeclaration::isTexture const):
1160         (WebCore::WHLSL::AST::NativeTypeDeclaration::isSigned const):
1161         (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<bool const):
1162         (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<int64_t const):
1163         (WebCore::WHLSL::AST::NativeTypeDeclaration::iterateAllValues):
1164         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsInt):
1165         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsNumber):
1166         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsFloating):
1167         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsVector):
1168         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsMatrix):
1169         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsTexture):
1170         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsSigned):
1171         (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentInteger):
1172         (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentUnsignedInteger):
1173         (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentFloat):
1174         (WebCore::WHLSL::AST::NativeTypeDeclaration::setSuccessor):
1175         (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromInteger):
1176         (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromUnsignedInteger):
1177         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIterateAllValues):
1178         * Modules/webgpu/WHLSL/AST/WHLSLNode.h: Added.
1179         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Added.
1180         (WebCore::WHLSL::AST::NullLiteral::NullLiteral):
1181         (WebCore::WHLSL::AST::NullLiteral::type):
1182         (WebCore::WHLSL::AST::NullLiteral::clone const):
1183         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Added.
1184         (WebCore::WHLSL::AST::NullLiteralType::canResolve const):
1185         (WebCore::WHLSL::AST::NullLiteralType::conversionCost const):
1186         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Added.
1187         * Modules/webgpu/WHLSL/AST/WHLSLNumThreadsFunctionAttribute.h: Added.
1188         (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::NumThreadsFunctionAttribute):
1189         (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::width const):
1190         (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::height const):
1191         (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::depth const):
1192         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h: Added.
1193         (WebCore::WHLSL::AST::PointerType::PointerType):
1194         * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: Added.
1195         (WebCore::WHLSL::AST::PropertyAccessExpression::PropertyAccessExpression):
1196         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetOverloads):
1197         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetOverloads):
1198         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAndOverloads):
1199         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetOverloads):
1200         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetOverloads):
1201         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAndOverloads):
1202         (WebCore::WHLSL::AST::PropertyAccessExpression::base):
1203         * Modules/webgpu/WHLSL/AST/WHLSLQualifier.h: Added.
1204         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: Added.
1205         (WebCore::WHLSL::AST::ReadModifyWriteExpression::create):
1206         (WebCore::WHLSL::AST::ReadModifyWriteExpression::setNewValueExpression):
1207         (WebCore::WHLSL::AST::ReadModifyWriteExpression::setResultExpression):
1208         (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference):
1209         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference):
1210         (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue):
1211         (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldValue):
1212         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValue):
1213         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression):
1214         (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression):
1215         (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression):
1216         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: Added.
1217         (WebCore::WHLSL::AST::ReferenceType::ReferenceType):
1218         (WebCore::WHLSL::AST::ReferenceType::addressSpace const):
1219         (WebCore::WHLSL::AST::ReferenceType::elementType const):
1220         (WebCore::WHLSL::AST::ReferenceType::elementType):
1221         * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h: Added.
1222         (WebCore::WHLSL::AST::ResolvableType::isFloatLiteralType const):
1223         (WebCore::WHLSL::AST::ResolvableType::isIntegerLiteralType const):
1224         (WebCore::WHLSL::AST::ResolvableType::isNullLiteralType const):
1225         (WebCore::WHLSL::AST::ResolvableType::isUnsignedIntegerLiteralType const):
1226         (WebCore::WHLSL::AST::ResolvableType::resolvedType const):
1227         (WebCore::WHLSL::AST::ResolvableType::resolvedType):
1228         (WebCore::WHLSL::AST::ResolvableType::resolve):
1229         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp: Added.
1230         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const):
1231         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection const):
1232         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h: Added.
1233         (WebCore::WHLSL::AST::ResourceSemantic::ResourceSemantic):
1234         (WebCore::WHLSL::AST::ResourceSemantic::mode const):
1235         (WebCore::WHLSL::AST::ResourceSemantic::index const):
1236         (WebCore::WHLSL::AST::ResourceSemantic::space const):
1237         (WebCore::WHLSL::AST::ResourceSemantic::operator== const):
1238         (WebCore::WHLSL::AST::ResourceSemantic::operator!= const):
1239         * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: Added.
1240         (WebCore::WHLSL::AST::Return::Return):
1241         (WebCore::WHLSL::AST::Return::value):
1242         (WebCore::WHLSL::AST::Return::function):
1243         (WebCore::WHLSL::AST::Return::setFunction):
1244         * Modules/webgpu/WHLSL/AST/WHLSLSemantic.h: Added.
1245         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: Added.
1246         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const):
1247         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const):
1248         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: Added.
1249         (WebCore::WHLSL::AST::SpecializationConstantSemantic::SpecializationConstantSemantic):
1250         (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator== const):
1251         (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator!= const):
1252         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp: Added.
1253         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const):
1254         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const):
1255         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: Added.
1256         (WebCore::WHLSL::AST::StageInOutSemantic::StageInOutSemantic):
1257         (WebCore::WHLSL::AST::StageInOutSemantic::index const):
1258         (WebCore::WHLSL::AST::StageInOutSemantic::operator== const):
1259         (WebCore::WHLSL::AST::StageInOutSemantic::operator!= const):
1260         * Modules/webgpu/WHLSL/AST/WHLSLStatement.h: Added.
1261         (WebCore::WHLSL::AST::Statement::Statement):
1262         (WebCore::WHLSL::AST::Statement::isBlock const):
1263         (WebCore::WHLSL::AST::Statement::isBreak const):
1264         (WebCore::WHLSL::AST::Statement::isContinue const):
1265         (WebCore::WHLSL::AST::Statement::isDoWhileLoop const):
1266         (WebCore::WHLSL::AST::Statement::isEffectfulExpressionStatement const):
1267         (WebCore::WHLSL::AST::Statement::isFallthrough const):
1268         (WebCore::WHLSL::AST::Statement::isForLoop const):
1269         (WebCore::WHLSL::AST::Statement::isIfStatement const):
1270         (WebCore::WHLSL::AST::Statement::isReturn const):
1271         (WebCore::WHLSL::AST::Statement::isSwitchCase const):
1272         (WebCore::WHLSL::AST::Statement::isSwitchStatement const):
1273         (WebCore::WHLSL::AST::Statement::isTrap const):
1274         (WebCore::WHLSL::AST::Statement::isVariableDeclarationsStatement const):
1275         (WebCore::WHLSL::AST::Statement::isWhileLoop const):
1276         * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h: Added.
1277         (WebCore::WHLSL::AST::StructureDefinition::StructureDefinition):
1278         (WebCore::WHLSL::AST::StructureDefinition::structureElements):
1279         * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: Added.
1280         (WebCore::WHLSL::AST::StructureElement::StructureElement):
1281         (WebCore::WHLSL::AST::StructureElement::origin const):
1282         (WebCore::WHLSL::AST::StructureElement::type):
1283         (WebCore::WHLSL::AST::StructureElement::name):
1284         (WebCore::WHLSL::AST::StructureElement::semantic):
1285         * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h: Added.
1286         (WebCore::WHLSL::AST::SwitchCase::SwitchCase):
1287         (WebCore::WHLSL::AST::SwitchCase::value):
1288         (WebCore::WHLSL::AST::SwitchCase::block):
1289         * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: Added.
1290         (WebCore::WHLSL::AST::SwitchStatement::SwitchStatement):
1291         (WebCore::WHLSL::AST::SwitchStatement::value):
1292         (WebCore::WHLSL::AST::SwitchStatement::switchCases):
1293         * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: Added.
1294         (WebCore::WHLSL::AST::TernaryExpression::TernaryExpression):
1295         (WebCore::WHLSL::AST::TernaryExpression::predicate):
1296         (WebCore::WHLSL::AST::TernaryExpression::bodyExpression):
1297         (WebCore::WHLSL::AST::TernaryExpression::elseExpression):
1298         * Modules/webgpu/WHLSL/AST/WHLSLTrap.h: Added.
1299         (WebCore::WHLSL::AST::Trap::Trap):
1300         * Modules/webgpu/WHLSL/AST/WHLSLType.h: Added.
1301         (WebCore::WHLSL::AST::Type::isNamedType const):
1302         (WebCore::WHLSL::AST::Type::isUnnamedType const):
1303         (WebCore::WHLSL::AST::Type::isResolvableType const):
1304         * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp: Added.
1305         (WebCore::WHLSL::AST::clone):
1306         * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h: Added.
1307         * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: Added.
1308         (WebCore::WHLSL::AST::TypeDefinition::TypeDefinition):
1309         (WebCore::WHLSL::AST::TypeDefinition::type):
1310         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp: Added.
1311         (WebCore::WHLSL::AST::TypeReference::wrap):
1312         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h: Added.
1313         (WebCore::WHLSL::AST::TypeReference::TypeReference):
1314         (WebCore::WHLSL::AST::TypeReference::name):
1315         (WebCore::WHLSL::AST::TypeReference::typeArguments):
1316         (WebCore::WHLSL::AST::TypeReference::resolvedType const):
1317         (WebCore::WHLSL::AST::TypeReference::setResolvedType):
1318         (WebCore::WHLSL::AST::TypeReference::cloneTypeReference const):
1319         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h: Added.
1320         (WebCore::WHLSL::AST::UnnamedType::UnnamedType):
1321         (WebCore::WHLSL::AST::UnnamedType::isTypeReference const):
1322         (WebCore::WHLSL::AST::UnnamedType::isPointerType const):
1323         (WebCore::WHLSL::AST::UnnamedType::isArrayReferenceType const):
1324         (WebCore::WHLSL::AST::UnnamedType::isArrayType const):
1325         (WebCore::WHLSL::AST::UnnamedType::isReferenceType const):
1326         (WebCore::WHLSL::AST::UnnamedType::unifyNode const):
1327         (WebCore::WHLSL::AST::UnnamedType::unifyNode):
1328         (WebCore::WHLSL::AST::UnnamedType::origin const):
1329         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp: Added.
1330         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::valueForSelectedType const):
1331         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h: Added.
1332         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::UnsignedIntegerLiteral):
1333         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::type):
1334         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::value const):
1335         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const):
1336         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: Added.
1337         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::UnsignedIntegerLiteralType):
1338         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::canResolve const):
1339         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const):
1340         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: Added.
1341         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType):
1342         * Modules/webgpu/WHLSL/AST/WHLSLValue.h: Added.
1343         (WebCore::WHLSL::AST::Value::Value):
1344         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h: Added.
1345         (WebCore::WHLSL::AST::VariableDeclaration::VariableDeclaration):
1346         (WebCore::WHLSL::AST::VariableDeclaration::origin const):
1347         (WebCore::WHLSL::AST::VariableDeclaration::name):
1348         (WebCore::WHLSL::AST::VariableDeclaration::type const):
1349         (WebCore::WHLSL::AST::VariableDeclaration::type):
1350         (WebCore::WHLSL::AST::VariableDeclaration::semantic):
1351         (WebCore::WHLSL::AST::VariableDeclaration::initializer):
1352         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h: Added.
1353         (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement):
1354         (WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations):
1355         * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h: Added.
1356         (WebCore::WHLSL::AST::VariableReference::VariableReference):
1357         (WebCore::WHLSL::AST::VariableReference::wrap):
1358         (WebCore::WHLSL::AST::VariableReference::name):
1359         (WebCore::WHLSL::AST::VariableReference::variable):
1360         (WebCore::WHLSL::AST::VariableReference::setVariable):
1361         * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: Added.
1362         (WebCore::WHLSL::AST::WhileLoop::WhileLoop):
1363         (WebCore::WHLSL::AST::WhileLoop::conditional):
1364         (WebCore::WHLSL::AST::WhileLoop::body):
1365         * Modules/webgpu/WHLSL/WHLSLLexer.cpp:
1366         * Modules/webgpu/WHLSL/WHLSLParser.cpp: Added.
1367         * Modules/webgpu/WHLSL/WHLSLParser.h: Added.
1368         * Modules/webgpu/WHLSL/WHLSLProgram.h: Added.
1369         (WebCore::WHLSL::Program::append):
1370         (WebCore::WHLSL::Program::nameContext):
1371         (WebCore::WHLSL::Program::intrinsics):
1372         (WebCore::WHLSL::Program::typeDefinitions):
1373         (WebCore::WHLSL::Program::structureDefinitions):
1374         (WebCore::WHLSL::Program::enumerationDefinitions):
1375         (WebCore::WHLSL::Program::functionDefinitions const):
1376         (WebCore::WHLSL::Program::functionDefinitions):
1377         (WebCore::WHLSL::Program::nativeFunctionDeclarations const):
1378         (WebCore::WHLSL::Program::nativeFunctionDeclarations):
1379         (WebCore::WHLSL::Program::nativeTypeDeclarations):
1380
1381 2019-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1382
1383         Bindings generator emits incorrect code when using VoidCallback as an IDL dictionary attribute
1384         https://bugs.webkit.org/show_bug.cgi?id=193328
1385
1386         Reviewed by Chris Dumez.
1387
1388         Currently, when generating the function body of `convertDictionary`, our bindings generator does not pass in an
1389         argument to use as the `$globalObjectReference` in `JSValueToNative`, when generating code to convert a wrapped
1390         attribute value to the native value. As a result, if the generated IDL type returns `true` from
1391         `JSValueToNativeDOMConvertNeedsGlobalObject` (i.e. for callback function types), we will end up using the empty
1392         string as the generated expression for the global object. This emits syntactically incorrect code:
1393
1394             `convert<IDLCallbackFunction<JSVoidCallback>>(state, someValue, );`
1395
1396         To fix this, we pass in a string to use as the global object, which uses the given ExecState to grab the global
1397         object. Tested by augmenting TestStandaloneDictionary.idl and its generated expectation.
1398
1399         * bindings/scripts/CodeGeneratorJS.pm:
1400         (GenerateDictionaryImplementationContent):
1401         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
1402         (WebCore::convertDictionary<DictionaryImplName>):
1403         * bindings/scripts/test/TestStandaloneDictionary.idl:
1404
1405 2019-01-10  Eric Carlson  <eric.carlson@apple.com>
1406
1407         Define page media state flags for display capture.
1408         https://bugs.webkit.org/show_bug.cgi?id=193230
1409         <rdar://problem/47095142>
1410
1411         Reviewed by Youenn Fablet.
1412
1413         Test: fast/mediastream/get-display-media-muted.html
1414
1415         * Modules/mediastream/MediaStreamTrack.cpp:
1416         (WebCore::MediaStreamTrack::mediaState const):
1417         * page/MediaProducer.h:
1418         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
1419         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
1420         * platform/mediastream/RealtimeMediaSource.h:
1421         * platform/mediastream/mac/AVVideoCaptureSource.h:
1422         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
1423         * platform/mediastream/mac/WindowDisplayCaptureSourceMac.h:
1424         * platform/mock/MockRealtimeAudioSource.h:
1425         * platform/mock/MockRealtimeVideoSource.h:
1426         * testing/Internals.cpp:
1427         (WebCore::Internals::pageMediaState):
1428
1429 2019-01-10  Justin Fan  <justin_fan@apple.com>
1430
1431         [WebGPU] Add BindGroupBinding, BindGroupDescriptor, and BufferBinding dictionaries from API
1432         https://bugs.webkit.org/show_bug.cgi?id=193298
1433
1434         Reviewed by Dean Jackson.
1435
1436         No new tests. No change in behavior.
1437
1438         * CMakeLists.txt:
1439         * DerivedSources.make:
1440         * Modules/webgpu/WebGPUBindGroupBinding.h: Added.
1441         * Modules/webgpu/WebGPUBindGroupBinding.idl: Added.
1442         * Modules/webgpu/WebGPUBindGroupDescriptor.h: Added.
1443         * Modules/webgpu/WebGPUBindGroupDescriptor.idl: Added.
1444         * Modules/webgpu/WebGPUBufferBinding.h: Added.
1445         * Modules/webgpu/WebGPUBufferBinding.idl: Added.
1446         * Sources.txt:
1447         * WebCore.xcodeproj/project.pbxproj:
1448         * platform/graphics/gpu/GPUBindGroupBinding.h: Added.
1449         * platform/graphics/gpu/GPUBindGroupDescriptor.h: Added.
1450         * platform/graphics/gpu/GPUBufferBinding.h: Added.
1451
1452 2019-01-09  Justin Fan  <justin_fan@apple.com>
1453
1454         [WebGPU] Fix vertex-buffer-triangle-strip test and small update to GPURenderPipeline
1455         https://bugs.webkit.org/show_bug.cgi?id=193289
1456
1457         Reviewed by Dean Jackson.
1458
1459         Fix broken test after pipeline layouts were added, and a small refactoring to GPURenderPipeline to avoid
1460         retaining its descriptor after creation.
1461
1462         * platform/graphics/gpu/GPURenderPipeline.h:
1463         (WebCore::GPURenderPipeline::primitiveTopology const):
1464         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
1465         (WebCore::GPURenderPipeline::GPURenderPipeline):
1466
1467 2019-01-09  Dean Jackson  <dino@apple.com>
1468
1469         Safari Crashing in Version 12.0.1 (14606.2.104.1.1) WebCore::GraphicsLayerCA::updateBackdropFilters
1470         https://bugs.webkit.org/show_bug.cgi?id=193309
1471         <rdar://problem/45279224>
1472
1473         Reviewed by Antoine Quint.
1474
1475         A speculative fix for a CheckedArithmetic crash triggered in updateBackdropFilters.
1476
1477         The crash log indicates we crash in a Checked<> class that is not recording
1478         overflow i.e. it is crashing due to an overflow. The only place in this function
1479         where that could happen is when we convert the FloatRect for the backdrop
1480         region into a Checked<unsigned> for width and height. This suggests that either
1481         the width or height are negative, or the float values are too large for integers,
1482         or the product of the two overflows.
1483
1484         Avoid this by using RecordOverflow, but also changing the code a little to
1485         bail if the rectangle is incorrect.
1486
1487         * platform/graphics/ca/GraphicsLayerCA.cpp:
1488         (WebCore::GraphicsLayerCA::updateBackdropFilters):
1489
1490 2019-01-10  Oriol Brufau  <obrufau@igalia.com>
1491
1492         [css-grid] Let abspos items reference implicit grid lines
1493         https://bugs.webkit.org/show_bug.cgi?id=193313
1494
1495         Reviewed by Manuel Rego Casasnovas.
1496
1497         While they can't create new implicit grid lines, abspos items
1498         can reference existing ones as clarified in
1499         https://github.com/w3c/csswg-drafts/commit/511bb63
1500
1501         This patch makes WebKit match Blink, Firefox and Edge.
1502
1503         Tests: web-platform-tests/css/css-grid/abspos/grid-positioned-items-padding-001.html
1504                web-platform-tests/css/css-grid/abspos/grid-positioned-items-unknown-named-grid-line-001.html
1505
1506         * rendering/RenderGrid.cpp:
1507         (WebCore::RenderGrid::populateExplicitGridAndOrderIterator const):
1508         Remove argument from spanSizeForAutoPlacedItem call.
1509         (WebCore::RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid const):
1510         Remove argument from spanSizeForAutoPlacedItem call.
1511         (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid const):
1512         Remove argument from spanSizeForAutoPlacedItem call.
1513         (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid const):
1514         Remove argument from spanSizeForAutoPlacedItem call.
1515         (WebCore::RenderGrid::gridAreaBreadthForOutOfFlowChild):
1516         Don't treat implicit grid lines as 'auto'.
1517         * rendering/RenderGrid.h:
1518         Remove unused gridPositionIsAutoForOutOfFlow.
1519         * rendering/style/GridPositionsResolver.cpp:
1520         (WebCore::adjustGridPositionsFromStyle):
1521         Don't treat implicit grid lines as 'auto'.
1522         Remove unused gridContainerStyle parameter.
1523         (WebCore::GridPositionsResolver::spanSizeForAutoPlacedItem):
1524         Remove argument from adjustGridPositionsFromStyle call.
1525         Remove unused gridContainerStyle parameter.
1526         (WebCore::resolveGridPositionFromStyle):
1527         Remove unnecessary assert that uses isValidNamedLineOrArea.
1528         (WebCore::GridPositionsResolver::resolveGridPositionsFromStyle):
1529         Remove argument from adjustGridPositionsFromStyle call.
1530         * rendering/style/GridPositionsResolver.h:
1531         Remove unused isValidNamedLineOrArea.
1532         Remove unused parameter from spanSizeForAutoPlacedItem.
1533
1534 2019-01-09  Matt Rajca  <mrajca@apple.com>
1535
1536         Put per-document autoplay behavior behind runtime website policies quirk instead of a compile time flag
1537         https://bugs.webkit.org/show_bug.cgi?id=193301
1538
1539         Reviewed by Jer Noble.
1540
1541         Instead of unconditionally enabling this with a compile-time flag, let clients
1542         enable the quirk on a per-load basis.
1543
1544         Tests: added API tests in favor of the current layout test as this behavior is no
1545                longer on by default unless a client opts in.
1546
1547         * html/MediaElementSession.cpp:
1548         (WebCore::needsPerDocumentAutoplayBehaviorQuirk):
1549         (WebCore::MediaElementSession::playbackPermitted const):
1550         * loader/DocumentLoader.h:
1551
1552 2019-01-10  Zalan Bujtas  <zalan@apple.com>
1553
1554         [LFC][BFC][MarginCollapsing] Take collapsed through siblings into account when computing vertical position
1555         https://bugs.webkit.org/show_bug.cgi?id=193310
1556
1557         Reviewed by Antti Koivisto.
1558
1559         If the block inflow element has previous siblings with collapsed through vertical margins,
1560         then this box's before margin could _indirectly_ collapse with the parent. Use the previous siblings
1561         to check for margin collapsing.
1562
1563         Test: fast/block/block-only/collapsed-through-siblings.html
1564
1565         * layout/blockformatting/BlockFormattingContext.cpp:
1566         (WebCore::Layout::BlockFormattingContext::adjustedVerticalPositionAfterMarginCollapsing const):
1567         * page/FrameViewLayoutContext.cpp:
1568         (WebCore::layoutUsingFormattingContext):
1569
1570 2019-01-10  Alicia Boya García  <aboya@igalia.com>
1571
1572         [MSE][GStreamer] Use GRefPtr in AppendPipeline::pushNewBuffer()
1573         https://bugs.webkit.org/show_bug.cgi?id=192934
1574
1575         Reviewed by Xabier Rodriguez-Calvar.
1576
1577         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1578         (WebCore::AppendPipeline::pushNewBuffer):
1579         * platform/graphics/gstreamer/mse/AppendPipeline.h:
1580         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
1581         (WebCore::MediaSourceClientGStreamerMSE::append):
1582
1583 2019-01-10  Carlos Garcia Campos  <cgarcia@igalia.com>
1584
1585         [FreeType] Color emoji not properly supported
1586         https://bugs.webkit.org/show_bug.cgi?id=191976
1587
1588         Reviewed by Michael Catanzaro.
1589
1590         Always try to fallback to a colored font for emojis.
1591
1592         Test: platform/gtk/fonts/font-emoji-system-fallback.html
1593
1594         * platform/graphics/ComplexTextController.cpp:
1595         (WebCore::advanceByCombiningCharacterSequence): Group regional indicators in pairs.
1596         * platform/graphics/Font.cpp:
1597         (WebCore::CharacterFallbackMapKey::CharacterFallbackMapKey):
1598         (WebCore::Font::systemFallbackFontForCharacter const): Pass PreferColoredFont::No to FontCache::systemFallbackForCharacters.
1599         * platform/graphics/Font.h: Add IsForPlatformFont enum to replace the bool parameter in systemFallbackFontForCharacter().
1600         * platform/graphics/FontCache.h:
1601         * platform/graphics/FontCascadeFonts.cpp:
1602         (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
1603         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
1604         (WebCore::characterSequenceIsEmoji): Check whether the character sequence is an emoji.
1605         (WebCore::FontCascade::fontForCombiningCharacterSequence const): In case of emojis try to fallback to a colored
1606         font even if base font can render the emoji in black and white.
1607         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1608         (WebCore::FontCache::systemFallbackForCharacters): Add PreferColoredFont parameter that is ignored.
1609         * platform/graphics/freetype/FontCacheFreeType.cpp:
1610         (WebCore::FontCache::systemFallbackForCharacters): Add PreferColoredFont parameter.
1611         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
1612         (WebCore::FontPlatformData::FontPlatformData): Initialize m_isColorBitmapFont.
1613         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
1614         (WebCore::Font::variantCapsSupportsCharacterForSynthesis const): Moved from cross-platform file.
1615         (WebCore::Font::platformSupportsCodePoint const): Add freetype implementation.
1616         * platform/graphics/win/FontCacheWin.cpp:
1617         (WebCore::FontCache::systemFallbackForCharacters): Add PreferColoredFont parameter that is ignored.
1618         * platform/text/CharacterProperties.h:
1619         (WebCore::isEmojiKeycapBase):
1620         (WebCore::isEmojiRegionalIndicator):
1621         (WebCore::isEmojiWithPresentationByDefault):
1622         (WebCore::isEmojiModifierBase):
1623
1624 2019-01-09  Antoine Quint  <graouts@apple.com>
1625
1626         [Web Animations] Audit Web Animations classes for memory reduction
1627         https://bugs.webkit.org/show_bug.cgi?id=193195
1628
1629         Reviewed by Simon Fraser and Yusuke Suzuki.
1630
1631         The classes, enums and structs added to support Web Animations were not as memory-efficient as they could be. We now order
1632         members in a way that reduces padding, use Markable<T, Traits> instead of Optional<T> where applicable, declare enums as uint8_t
1633         and removed unnecessary members.
1634
1635         As a result, classes and structs have shrunk as follows:
1636
1637         WebAnimation: 256 > 216
1638         DeclarativeAnimation: 392 > 344
1639         CSSAnimation: 416 > 368
1640         CSSTransition: 440 > 392
1641         AnimationEffect: 88 > 72
1642         KeyframeEffect: 208 > 184
1643         AnimationPlaybackEvent: 104 > 88
1644         EffectTiming: 72 > 64
1645         ComputedEffectTiming: 136 > 112
1646         AnimationTimeline: 264 > 248
1647         DocumentTimeline: 496 > 464
1648         OptionalEffectTiming: 112 > 80
1649         BaseKeyframe: 32 > 24
1650         ParsedKeyframe: 80 > 72
1651         BaseComputedKeyframe: 40 > 32
1652
1653         * animation/AnimationEffect.h: Order members in decreasing size, except for m_fill and m_direction, which we put at the top to
1654         save 8 bytes (2 bytes of padding instead of 4 before m_animation and saving 6 bytes of padding at the end).
1655         * animation/AnimationPlaybackEvent.cpp:
1656         (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent):
1657         * animation/AnimationPlaybackEvent.h:
1658         * animation/AnimationPlaybackEventInit.h:
1659         * animation/AnimationTimeline.cpp:
1660         (WebCore::AnimationTimeline::AnimationTimeline):
1661         (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
1662         * animation/AnimationTimeline.h: We remove the m_classType member and instead make isDocumentTimeline() virtual.
1663         (WebCore::AnimationTimeline::isDocumentTimeline const):
1664         (): Deleted.
1665         (WebCore::AnimationTimeline::classType const): Deleted.
1666         * animation/CompositeOperation.h:
1667         * animation/CompositeOperationOrAuto.h:
1668         * animation/ComputedEffectTiming.h:
1669         * animation/DeclarativeAnimation.cpp:
1670         (WebCore::DeclarativeAnimation::DeclarativeAnimation):
1671         (WebCore::DeclarativeAnimation::invalidateDOMEvents):
1672         * animation/DeclarativeAnimation.h: We keep m_wasPending and m_previousPhase at the top to save some padding at the end.
1673         * animation/DocumentTimeline.cpp:
1674         (WebCore::DocumentTimeline::DocumentTimeline):
1675         * animation/DocumentTimeline.h:
1676         * animation/EffectTiming.h:
1677         * animation/FillMode.h:
1678         * animation/IterationCompositeOperation.h:
1679         * animation/KeyframeEffect.cpp:
1680         (WebCore::computeMissingKeyframeOffsets):
1681         (WebCore::KeyframeEffect::create):
1682         (WebCore::KeyframeEffect::KeyframeEffect):
1683         * animation/KeyframeEffect.h:
1684         * animation/OptionalEffectTiming.h:
1685         * animation/PlaybackDirection.h:
1686         * animation/WebAnimation.h:
1687         * animation/WebAnimationUtilities.h:
1688         (WebCore::WebAnimationsMarkableDoubleTraits::isEmptyValue):
1689         (WebCore::WebAnimationsMarkableDoubleTraits::emptyValue):
1690
1691 2019-01-09  Ryosuke Niwa  <rniwa@webkit.org>
1692
1693         ThreadTimers should not store a raw pointer in its heap
1694         https://bugs.webkit.org/show_bug.cgi?id=192975
1695         <rdar://problem/46893946>
1696
1697         Reviewed by Geoffrey Garen.
1698
1699         Right now, ThreadTimers's heap data structure stores a raw pointer to TimerBase. In order to harden the timer code,
1700         this patch replaces it with ThreadTimerHeapItem, a newly introduced struct, which effectively acks like
1701         WeakReference<TimerBase*> as the timer heap and TimerBase both store RefPtr to it, and TimerBase's destructor clears
1702         the raw pointer back to TimerBase*.
1703
1704         This approach was taken instead of an out-right adoptation of WeakPtr since the heap data structure requires each node
1705         in the heap to have a fixed "priority" yet WeakPtr with no valid pointer back to TimerBase would effectively lose its
1706         "priority" thereby corrupting the heap data structure. That is, each item in the heap must remember its fire time and
1707         insertion order even when the underlying TimerBase had gone away (this should never happen but the whole point of this
1708         hardening is to make it work even in the precense of such a bug).
1709
1710         This patch also moves the heap index in TimerBase to ThreadTimerHeapItem, and replaces the pointer to the heap vector
1711         in TimerBase by a reference to ThreadTimers in ThreadTimerHeapItem. Note that ThreadTimers is a per-thread singleton.
1712
1713         The correctness of this hardening was tested by commenting out the call to stop() and !isInHeap() assertion in
1714         TimerBase::~TimerBase() as well as the !isInHeap() assertion in ThreadTimerHeapItem::clearTimer() and observing that
1715         layout tests run successfully without hitting any debug assertions.
1716
1717         No new tests since there should be no observable behavior difference.
1718
1719         * WebCore.xcodeproj/project.pbxproj: Export ThreadTimers.h as a private header since it's now included in Timer.h
1720         * platform/ThreadTimers.cpp:
1721         (WebCore::ThreadTimers::updateSharedTimer): Delete ThreadTimerHeapItem's with nullptr TimerBase* (TimerBase had
1722         already been deleted). This should only happen when TimerBase's destructor failed to remove itself from the timer heap,
1723         which should never happen.
1724         (WebCore::ThreadTimers::sharedTimerFiredInternal): Ditto. Also removed the redundant code which had removed the timer
1725         from the heap since setNextFireTime does the removal already.
1726         * platform/ThreadTimers.h: Outdented the whole file.
1727         (WebCore::ThreadTimers::timerHeap): We use Vector<RefPtr<ThreadTimerHeapItem>> instead of Vector<Ref<~>> since Ref<~>
1728         doesn't have a copy constructor which is used by std::push_heap.
1729         (WebCore::ThreadTimerHeapItem): Added.
1730         (WebCore::ThreadTimerHeapItem::hasTimer const): Added.
1731         (WebCore::ThreadTimerHeapItem::setNotInHeap): Added. ThreadTimerHeapItem uses unsigned -1 as the single value which
1732         signifies the item not being in the heap instead of all negative values as in the old code in TimerBase.
1733         (WebCore::ThreadTimerHeapItem::isInHeap const): Added.
1734         (WebCore::ThreadTimerHeapItem::isFirstInHeap const): Added.
1735         (WebCore::ThreadTimerHeapItem::timer): Added.
1736         (WebCore::ThreadTimerHeapItem::clearTimer): Added.
1737         (WebCore::ThreadTimerHeapItem::heapIndex const): Added.
1738         (WebCore::ThreadTimerHeapItem::setHeapIndex): Added.
1739         (WebCore::ThreadTimerHeapItem::timerHeap const): Added.
1740         * platform/Timer.cpp:
1741         (WebCore::threadGlobalTimerHeap): This function is now only used in assertions.
1742         (WebCore::ThreadTimerHeapItem::ThreadTimerHeapItem): Added.
1743         (WebCore::ThreadTimerHeapItem::create): Added.
1744         (WebCore::TimerHeapPointer::TimerHeapPointer):
1745         (WebCore::TimerHeapPointer::operator-> const):
1746         (WebCore::TimerHeapReference::TimerHeapReference): Added a copy constructor.
1747         (WebCore::TimerHeapReference::copyRef const): Added.
1748         (WebCore::TimerHeapReference::operator RefPtr<ThreadTimerHeapItem>& const):
1749         (WebCore::TimerHeapPointer::operator* const):
1750         (WebCore::TimerHeapReference::operator=): Use move assignment operator.
1751         (WebCore::TimerHeapReference::swapWith):
1752         (WebCore::TimerHeapReference::updateHeapIndex): Extracted to share code between two verions of operator=.
1753         (WebCore::swap):
1754         (WebCore::TimerHeapIterator::TimerHeapIterator):
1755         (WebCore::TimerHeapIterator::operator-> const):
1756         (WebCore::TimerHeapLessThanFunction::compare): Added variants which take RefPtr<ThreadTimerHeapItem>.
1757         (WebCore::TimerHeapLessThanFunction::operator() const):
1758         (WebCore::TimerBase::TimerBase):
1759         (WebCore::TimerBase::~TimerBase):Clear the raw pointer in ThreadTimerHeapItem.
1760         (WebCore::TimerBase::stop):
1761         (WebCore::TimerBase::nextFireInterval const):
1762         (WebCore::TimerBase::checkHeapIndex const): Added the consistency check for other items in the heap.
1763         (WebCore::TimerBase::checkConsistency const):
1764         (WebCore::TimerBase::heapDecreaseKey):
1765         (WebCore::TimerBase::heapDelete):
1766         (WebCore::TimerBase::heapDeleteMin):
1767         (WebCore::TimerBase::heapIncreaseKey):
1768         (WebCore::TimerBase::heapInsert):
1769         (WebCore::TimerBase::heapPop):
1770         (WebCore::TimerBase::heapPopMin):
1771         (WebCore::TimerBase::heapDeleteNullMin): Added. Used to delete ThreadTimerHeapItem which no longer has a valid TimerBase.
1772         (WebCore::parentHeapPropertyHolds):
1773         (WebCore::childHeapPropertyHolds):
1774         (WebCore::TimerBase::hasValidHeapPosition const):
1775         (WebCore::TimerBase::updateHeapIfNeeded): Tweaked the heap index assertion as heapIndex() itself would assert when called
1776         on an item with an invalid (-1) heap index.
1777         (WebCore::TimerBase::setNextFireTime): Create ThreadTimerHeapItem. Note m_heapItem is never cleared until this TimerBase
1778         is deleted.
1779         (WebCore::TimerHeapReference::operator TimerBase* const): Deleted.
1780         * platform/Timer.h:
1781         (WebCore::TimerBase): Replaced m_nextFireTime, m_heapIndex, m_heapInsertionOrder, and m_cachedThreadGlobalTimerHeap
1782         by m_heapItem, RefPtr to an ThreadTimerHeapItem.
1783         (WebCore::TimerBase::augmentFireInterval):
1784         (WebCore::TimerBase::inHeap const):
1785         (WebCore::TimerBase::nextFireTime const):
1786         (WebCore::TimerBase::isActive const):
1787         (WebCore::TimerBase:: const): Deleted.
1788
1789 2019-01-09  Alex Christensen  <achristensen@webkit.org>
1790
1791         REGRESSION(239737) iOS quicklook tests should not dereference null
1792         https://bugs.webkit.org/show_bug.cgi?id=193307
1793
1794         Reviewed by Brent Fulgham.
1795
1796         The quicklook tests rely on ResourceHandle on iOS for some reason.
1797         This is a problem we'll fix later, but for now keep them working by not crashing.
1798
1799         * platform/network/mac/ResourceHandleMac.mm:
1800         (WebCore::ResourceHandle::createNSURLConnection):
1801         (WebCore::ResourceHandle::start):
1802         (WebCore::ResourceHandle::willSendRequest):
1803         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
1804         (WebCore::ResourceHandle::receivedCredential):
1805
1806 2019-01-09  Zalan Bujtas  <zalan@apple.com>
1807
1808         [Datalist] Crash when input with datalist is dynamically added.
1809         https://bugs.webkit.org/show_bug.cgi?id=193012
1810         <rdar://problem/45923457>
1811
1812         Reviewed by Brent Fulgham.
1813
1814         In certain cases (cloning, setAttribute), it's too early to check for the list attribute in createShadowSubtree
1815         to see whether the input needs datalist related items. The list attribute is simply not set yet.
1816         This patch only addresses the obvious crash. m_dataListDropdownIndicator clearly lacks proper lifecycle management (see webkit.org/b/193032). 
1817
1818         Test: fast/forms/datalist/datalist-crash-when-dynamic.html
1819
1820         * html/TextFieldInputType.cpp:
1821         (WebCore::TextFieldInputType::createShadowSubtree):
1822         (WebCore::TextFieldInputType::attributeChanged):
1823         (WebCore::TextFieldInputType::createDataListDropdownIndicator):
1824         * html/TextFieldInputType.h:
1825
1826 2019-01-09  Justin Fan  <justin_fan@apple.com>
1827
1828         [WebGPU] Fix vertex-buffer-triangle-strip test and small update to GPURenderPipeline
1829         https://bugs.webkit.org/show_bug.cgi?id=193289
1830
1831         Reviewed by Dean Jackson.
1832
1833         Fix broken test after pipeline layouts were added, and a small refactoring to GPURenderPipeline to avoid
1834         retaining its descriptor after creation.
1835
1836         * platform/graphics/gpu/GPURenderPipeline.h:
1837         (WebCore::GPURenderPipeline::primitiveTopology const):
1838         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
1839         (WebCore::GPURenderPipeline::GPURenderPipeline):
1840
1841 2019-01-09  Devin Rousso  <drousso@apple.com>
1842
1843         Web Inspector: Protocol Logging: log messages as objects if inspector^2 is open
1844         https://bugs.webkit.org/show_bug.cgi?id=193284
1845
1846         Reviewed by Joseph Pecoraro.
1847
1848         No newe tests, as this is simply exposes a value.
1849
1850         * inspector/InspectorFrontendHost.idl:
1851         * inspector/InspectorFrontendHost.h:
1852         * inspector/InspectorFrontendHost.cpp:
1853         (WebCore::InspectorFrontendHost::isBeingInspected): Added.
1854
1855 2019-01-09  Zalan Bujtas  <zalan@apple.com>
1856
1857         [LFC][BFC][MarginCollapsing] Add support for peculiar cases.
1858         https://bugs.webkit.org/show_bug.cgi?id=192625
1859
1860         Reviewed by Antti Koivisto.
1861
1862         Implement some of the more peculiar cases like margin collpasing through multiple boxes etc.
1863         Add ~100 new passing cases.
1864
1865         * layout/FormattingContextGeometry.cpp:
1866         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1867         * layout/LayoutState.h:
1868         (WebCore::Layout::LayoutState::hasFormattingState const):
1869         * layout/MarginTypes.h:
1870         * layout/blockformatting/BlockFormattingContext.cpp:
1871         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBefore const):
1872         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBeforeForAncestors const):
1873         (WebCore::Layout::hasPrecomputedMarginBefore):
1874         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
1875         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
1876         (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const):
1877         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
1878         (WebCore::Layout::BlockFormattingContext::adjustedVerticalPositionAfterMarginCollapsing const):
1879         * layout/blockformatting/BlockFormattingContext.h:
1880         (WebCore::Layout::BlockFormattingContext::blockFormattingState const):
1881         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1882         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1883         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1884         (WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginBefore): Deleted.
1885         (WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginAfter): Deleted.
1886         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
1887         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
1888         (WebCore::Layout::BlockFormattingContext::Quirks::shouldIgnoreMarginAfter):
1889         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedHeight): Deleted.
1890         * layout/blockformatting/BlockFormattingState.h:
1891         (WebCore::Layout::BlockFormattingState::setPositiveAndNegativeVerticalMargin):
1892         (WebCore::Layout::BlockFormattingState::hasPositiveAndNegativeVerticalMargin const):
1893         (WebCore::Layout::BlockFormattingState::positiveAndNegativeVerticalMargin const):
1894         (WebCore::Layout::BlockFormattingState::setHasEstimatedMarginBefore):
1895         (WebCore::Layout::BlockFormattingState::clearHasEstimatedMarginBefore):
1896         (WebCore::Layout::BlockFormattingState::hasEstimatedMarginBefore const):
1897         * layout/blockformatting/BlockMarginCollapse.cpp:
1898         (WebCore::Layout::hasClearance):
1899         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter):
1900         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore):
1901         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSiblingMarginAfter):
1902         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithFirstInFlowChildMarginBefore):
1903         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance):
1904         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginBefore):
1905         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter):
1906         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSiblingMarginBefore):
1907         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
1908         (WebCore::Layout::computedPositiveAndNegativeMargin):
1909         (WebCore::Layout::marginValue):
1910         (WebCore::Layout::BlockFormattingContext::MarginCollapse::updateCollapsedMarginAfter):
1911         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues):
1912         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginBefore):
1913         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginAfter):
1914         (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
1915         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedVerticalValues):
1916         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBefore): Deleted.
1917         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginAfter): Deleted.
1918         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBefore): Deleted.
1919         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginAfter): Deleted.
1920         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBeforeFromFirstChild): Deleted.
1921         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginAfterFromLastChild): Deleted.
1922         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSibling): Deleted.
1923         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSibling): Deleted.
1924         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBefore): Deleted.
1925         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfter): Deleted.
1926         * layout/displaytree/DisplayBox.cpp:
1927         (WebCore::Display::Box::Box):
1928         * layout/displaytree/DisplayBox.h:
1929         (WebCore::Display::Box::hasClearance const):
1930         (WebCore::Display::Box::setEstimatedMarginBefore):
1931         (WebCore::Display::Box::estimatedMarginBefore const):
1932         (WebCore::Display::Box::setHasClearance):
1933         (WebCore::Display::Box::invalidateEstimatedMarginBefore):
1934         (WebCore::Display::Box::setVerticalMargin):
1935         (WebCore::Display::Box::rectWithMargin const):
1936         * layout/floats/FloatingContext.cpp:
1937         (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
1938         * layout/inlineformatting/InlineFormattingContext.cpp:
1939         (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
1940
1941 2019-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
1942
1943         REGRESSION(r239156): [FreeType] fixed width, and synthetic bold/italic not correctly applied since r239156
1944         https://bugs.webkit.org/show_bug.cgi?id=193276
1945
1946         Reviewed by Žan Doberšek.
1947
1948         FontCache::createFontPlatformData() is calling getFontPropertiesFromPattern() with the configure pattern instead
1949         of the result one after the match.
1950
1951         * platform/graphics/freetype/FontCacheFreeType.cpp:
1952         (WebCore::FontCache::createFontPlatformData):
1953
1954 2019-01-08  Dean Jackson  <dino@apple.com>
1955
1956         Blob references for System Previews don't get a correct file extension
1957         https://bugs.webkit.org/show_bug.cgi?id=193268
1958         <rdar://problem/47133037>
1959
1960         Reviewed by Tim Horton.
1961
1962         Apple platforms don't yet have a mapping from the USD MIME type to
1963         file extensions (and we support some non-standard MIME types), which
1964         means that downloads from Blob references don't get correctly named.
1965
1966         Fix this by adding an explicit mapping between System Preview types
1967         and ".usdz".
1968
1969         WebKit API test: _WKDownload.SystemPreviewUSDZBlobNaming
1970
1971         * platform/MIMETypeRegistry.cpp:
1972         (WebCore::MIMETypeRegistry::isSystemPreviewMIMEType): Remove USE(SYSTEM_PREVIEW) since
1973         this applies to macOS and iOS now.
1974         * platform/MIMETypeRegistry.h:
1975         * platform/cocoa/MIMETypeRegistryCocoa.mm:
1976         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): Add a mapping
1977         for USDZ.
1978
1979 2019-01-08  Tim Horton  <timothy_horton@apple.com>
1980
1981         Editable images sometimes don't become focused when tapped
1982         https://bugs.webkit.org/show_bug.cgi?id=193259
1983         <rdar://problem/47038424>
1984
1985         Reviewed by Wenson Hsieh.
1986
1987         Often when tapping an editable image inside an editable text area, the
1988         text area's selection will change instead of focusing the editable image.
1989
1990         No new tests; I have had no luck writing a test that reliably failed 
1991         beforehand (the "sometimes" is a problem).
1992
1993         * html/HTMLImageElement.cpp:
1994         (WebCore::HTMLImageElement::defaultEventHandler):
1995         * html/HTMLImageElement.h:
1996         Override mousedown on editable images, focus the image, and prevent
1997         the default behavior.
1998
1999 2019-01-08  Jiewen Tan  <jiewen_tan@apple.com>
2000
2001         [WebAuthN] Support U2F HID Authenticators on macOS
2002         https://bugs.webkit.org/show_bug.cgi?id=191535
2003         <rdar://problem/47102027>
2004
2005         Reviewed by Brent Fulgham.
2006
2007         This patch changes U2fCommandConstructor to produce register commands with
2008         enforcing test of user presence. Otherwise, authenticators would silently
2009         generate credentials. It also renames readFromU2fSignResponse to
2010         readU2fSignResponse.
2011
2012         Tests: http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html
2013                http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html
2014                http/wpt/webauthn/public-key-credential-create-success-u2f.https.html
2015                http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html
2016                http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html
2017                http/wpt/webauthn/public-key-credential-get-success-u2f.https.html
2018
2019         * Modules/webauthn/fido/U2fCommandConstructor.cpp:
2020         (fido::WebCore::constructU2fRegisterCommand):
2021         * Modules/webauthn/fido/U2fResponseConverter.cpp:
2022         (fido::readU2fSignResponse):
2023         (fido::readFromU2fSignResponse): Deleted.
2024         * Modules/webauthn/fido/U2fResponseConverter.h:
2025
2026 2019-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2027
2028         [iOS] Dispatch a synthetic mousedown event prior to starting drags
2029         https://bugs.webkit.org/show_bug.cgi?id=193229
2030         <rdar://problem/46717097>
2031
2032         Reviewed by Tim Horton.
2033
2034         Tweaks some drag initiation logic on iOS to actually send a "mousedown" event to the page prior to drag start.
2035         This improves drag and drop compatibility with web pages that expect a mousedown to always precede dragging.
2036         Additionally, ensure that preventing the "mousedown" event also prevents "dragstart", which matches macOS
2037         behavior.
2038
2039         Test: DragAndDropTests.PreventingMouseDownShouldPreventDragStart
2040
2041         * page/EventHandler.cpp:
2042
2043         Make the text drag delay 0 on iOS. This was introduced on iOS when originally bringing up drag and drop, and was
2044         made to simply match macOS. However, it doesn't make sense to respect the delay here, since the purpose of this
2045         delay is to disambiguate between making a text selection and starting a drag when pressing on text that is
2046         already selected; on iOS (including iOSMac), this gesture conflict is already resolved by platform gesture
2047         recognizers in the client layer, so there is always no delay between mouse down and drag here.
2048
2049         * page/ios/EventHandlerIOS.mm:
2050
2051         Dispatch a mousedown and inspect the value of `m_mouseDownMayStartDrag` when starting a drag on iOS. This brings
2052         our behavior closer in line with macOS.
2053
2054         (WebCore::EventHandler::tryToBeginDataInteractionAtPoint):
2055
2056 2019-01-08  Youenn Fablet  <youenn@apple.com>
2057
2058         service worker fetch handler results in bad referrer
2059         https://bugs.webkit.org/show_bug.cgi?id=188248
2060         <rdar://problem/47050478>
2061
2062         Reviewed by Alex Christensen.
2063
2064         Response sanitization was removing the ReferrerPolicy header from opaque redirect responses.
2065         Reduce sanitization of opaque redirect responses to opaque responses and allow Location header.
2066         Make sure referrer policy is updated for all load redirections, not only CORS loads.
2067
2068         Test: http/tests/security/referrer-policy-redirect-link-downgrade.html
2069
2070         * loader/SubresourceLoader.cpp:
2071         (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
2072         * platform/network/ResourceResponseBase.cpp:
2073         (WebCore::isSafeCrossOriginResponseHeader):
2074         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting):
2075
2076 2019-01-08  Youenn Fablet  <youenn@apple.com>
2077
2078         IDB storage of Crypto keys does not work in private browsing mode
2079         https://bugs.webkit.org/show_bug.cgi?id=193219
2080
2081         Reviewed by Brady Eidson.
2082
2083         https://trac.webkit.org/changeset/238677 moved from using a JSGlobalObject to a JSDOMGlobalObject for serialization/deserialization.
2084         This does not work for crypto keys as they require not only a JSDOMGlobalObject but either a window or worker global object.
2085
2086         To fix the issue, revert 238677, and fix it by checking whether the dumping of an ArrayBuffer happens for a JSDOMGlobalObject or a JSGlobalObject.
2087         If it is the latter, use JSC routines instead of toJS() which requires a JSDOMGlobalObject.
2088
2089         Covered by updated test.
2090
2091         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2092         (WebCore::IDBServer::UniqueIDBDatabase::databaseThreadVM):
2093         (WebCore::IDBServer::UniqueIDBDatabase::databaseThreadExecState):
2094         * bindings/js/JSDOMGlobalObject.cpp:
2095         * bindings/js/JSDOMGlobalObject.h:
2096         * bindings/js/JSDOMWrapper.cpp:
2097         (WebCore::JSDOMObject::JSDOMObject):
2098         * bindings/js/SerializedScriptValue.cpp:
2099         (WebCore::CloneSerializer::dumpArrayBufferView):
2100         (WebCore::CloneSerializer::toJSArrayBuffer):
2101
2102 2019-01-08  Justin Fan  <justin_fan@apple.com>
2103
2104         [WebGPU] Update createRenderPipeline for WebGPUPipelineLayout
2105         https://bugs.webkit.org/show_bug.cgi?id=193247
2106
2107         Reviewed by Dean Jackson.
2108
2109         Add WebGPUPipelineLayout to WebGPURenderPipeline via WebGPUPipelineDescriptorBase.
2110
2111         Test: Updated render-pipelines.html to test new functionality.
2112
2113         * Modules/webgpu/WebGPUDevice.cpp:
2114         (WebCore::WebGPUDevice::createRenderPipeline const): Convert WebGPUPipelineLayout to GPUPipelineLayout.
2115         * Modules/webgpu/WebGPUPipelineDescriptorBase.h:
2116         * Modules/webgpu/WebGPUPipelineDescriptorBase.idl: Add layout field.
2117         * Modules/webgpu/WebGPUPipelineLayout.h: 
2118         (WebCore::WebGPUPipelineLayout::pipelineLayout): Added. Getter.
2119         * platform/graphics/gpu/GPUPipelineDescriptorBase.h: Updated from out-of-date version.
2120         * platform/graphics/gpu/GPUPipelineLayout.cpp:
2121         (WebCore::GPUPipelineLayout::GPUPipelineLayout): Now retains bindGroupLayouts from descriptor.
2122         * platform/graphics/gpu/GPUPipelineLayout.h:
2123         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Now inherits from GPUPipelineDescriptorBase.
2124         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor): Custom constructor for non-aggregate struct.
2125
2126 2019-01-08  Chris Dumez  <cdumez@apple.com>
2127
2128         Prevent cross-site top-level navigations from third-party iframes
2129         https://bugs.webkit.org/show_bug.cgi?id=193076
2130         <rdar://problem/36074736>
2131
2132         Reviewed by Alex Christensen.
2133
2134         Prevent cross-site top-level navigations from third-party iframes if the following conditions are met:
2135         1. Its tries to navigate the top-level page cross-site (different eTDL+1)
2136         2. The user has never interacted with the third-party iframe or any of its subframes
2137
2138         This experiment's intent is to block suspicious main-frame navigations by third-party content. The feature
2139         is behind a runtime experimental feature flag, on by default.
2140
2141         Tests: http/tests/security/allow-top-level-navigations-by-third-party-iframes-to-same-origin.html
2142                http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-previous-user-activation.html
2143                http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-user-activation.html
2144                http/tests/security/block-top-level-navigations-by-third-party-iframes.html
2145
2146         * dom/Document.cpp:
2147         (WebCore::printNavigationErrorMessage):
2148         (WebCore::Document::canNavigate):
2149         (WebCore::Document::canNavigateInternal):
2150         (WebCore::Document::isNavigationBlockedByThirdPartyIFrameRedirectBlocking):
2151         * dom/Document.h:
2152         * dom/UserGestureIndicator.cpp:
2153         * page/DOMWindow.cpp:
2154         (WebCore::DOMWindow::setLocation):
2155         * page/DOMWindow.h:
2156         * page/Frame.h:
2157         * page/Location.cpp:
2158         (WebCore::Location::replace):
2159         (WebCore::Location::setLocation):
2160         * page/Settings.yaml:
2161
2162 2019-01-08  Alex Christensen  <achristensen@webkit.org>
2163
2164         Stop using NetworkStorageSession in WebProcess
2165         https://bugs.webkit.org/show_bug.cgi?id=193236
2166
2167         Reviewed by Don Olmstead.
2168
2169         No change in behavior.  Some code was only used for ResourceHandle, which isn't used in modern WebKit,
2170         and for cookies, which are handled in the NetworkProcess in modern WebKit.
2171
2172         * loader/CookieJar.cpp:
2173         (WebCore::storageSession):
2174         * loader/EmptyClients.cpp:
2175         * platform/network/NetworkingContext.h:
2176         * platform/network/mac/ResourceHandleMac.mm:
2177         (WebCore::ResourceHandle::createNSURLConnection):
2178         (WebCore::ResourceHandle::start):
2179         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2180         (WebCore::ResourceHandle::willSendRequest):
2181         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
2182         (WebCore::ResourceHandle::receivedCredential):
2183
2184 2019-01-08  Alex Christensen  <achristensen@webkit.org>
2185
2186         Unreviewed, rolling out r239727.
2187
2188         Broke API tests
2189
2190         Reverted changeset:
2191
2192         "Stop using NetworkStorageSession in WebProcess"
2193         https://bugs.webkit.org/show_bug.cgi?id=193236
2194         https://trac.webkit.org/changeset/239727
2195
2196 2019-01-08  Alex Christensen  <achristensen@webkit.org>
2197
2198         Stop using NetworkStorageSession in WebProcess
2199         https://bugs.webkit.org/show_bug.cgi?id=193236
2200
2201         Reviewed by Don Olmstead.
2202
2203         No change in behavior.  Some code was only used for ResourceHandle, which isn't used in modern WebKit,
2204         and for cookies, which are handled in the NetworkProcess in modern WebKit.
2205
2206         * loader/CookieJar.cpp:
2207         (WebCore::storageSession):
2208         * loader/EmptyClients.cpp:
2209         * platform/network/NetworkingContext.h:
2210         * platform/network/mac/ResourceHandleMac.mm:
2211         (WebCore::ResourceHandle::createNSURLConnection):
2212         (WebCore::ResourceHandle::start):
2213         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2214         (WebCore::ResourceHandle::willSendRequest):
2215         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
2216         (WebCore::ResourceHandle::receivedCredential):
2217
2218 2019-01-08  Chris Dumez  <cdumez@apple.com>
2219
2220         Regression(PSON-r239182): Blank view when navigating back and forth between google.com and stack overflow
2221         https://bugs.webkit.org/show_bug.cgi?id=193224
2222         <rdar://problem/47097726>
2223
2224         Reviewed by Alex Christensen.
2225
2226         Since r239182, pages get suspended in-place when we suspend the old process after a process-swap on navigation.
2227         When we return to a suspended page, we load the current history item again and it normally properly restores
2228         the page from PageCache, even though we load the same history item and the current one and even though the
2229         page is suspended in-place (i.e. we did not navigate away, which is the usual case for page cache).
2230
2231         The issue is that if the page URL contains a fragment, FrameLoader::shouldPerformFragmentNavigation() would
2232         return true because both the source and destination URLs (which are the same) contains a fragment. To address
2233         the issue, update FrameLoader::shouldPerformFragmentNavigation() to return false if the current page is
2234         suspended.
2235
2236         * loader/FrameLoader.cpp:
2237         (WebCore::FrameLoader::shouldPerformFragmentNavigation):
2238
2239 2019-01-08  Alex Christensen  <achristensen@webkit.org>
2240
2241         Move Windows-specific code from NetworkStorageSessionCFNet.cpp to its own file
2242         https://bugs.webkit.org/show_bug.cgi?id=192958
2243
2244         Reviewed by Yusuke Suzuki.
2245
2246         This makes it easier to reason about what code is used where.
2247
2248         * PlatformAppleWin.cmake:
2249         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2250         (WebCore::createPrivateStorageSession): Deleted.
2251         (WebCore::cookieDomain): Deleted.
2252         (WebCore::canonicalCookieTime): Deleted.
2253         (WebCore::cookieCreatedTime): Deleted.
2254         (WebCore::cookieExpirationTime): Deleted.
2255         (WebCore::cookieName): Deleted.
2256         (WebCore::cookiePath): Deleted.
2257         (WebCore::cookieValue): Deleted.
2258         (WebCore::filterCookies): Deleted.
2259         (WebCore::copyCookiesForURLWithFirstPartyURL): Deleted.
2260         (WebCore::createCookies): Deleted.
2261         (WebCore::NetworkStorageSession::setCookiesFromDOM const): Deleted.
2262         (WebCore::containsSecureCookies): Deleted.
2263         (WebCore::NetworkStorageSession::cookiesForDOM const): Deleted.
2264         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const): Deleted.
2265         (WebCore::NetworkStorageSession::cookiesEnabled const): Deleted.
2266         (WebCore::NetworkStorageSession::getRawCookies const): Deleted.
2267         (WebCore::NetworkStorageSession::deleteCookie const): Deleted.
2268         (WebCore::NetworkStorageSession::getHostnamesWithCookies): Deleted.
2269         (WebCore::NetworkStorageSession::deleteAllCookies): Deleted.
2270         (WebCore::NetworkStorageSession::deleteCookiesForHostnames): Deleted.
2271         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince): Deleted.
2272         * platform/network/cf/NetworkStorageSessionCFNetWin.cpp: Added.
2273         (WebCore::createPrivateStorageSession):
2274         (WebCore::NetworkStorageSession::setCookies):
2275         (WebCore::cookieDomain):
2276         (WebCore::canonicalCookieTime):
2277         (WebCore::cookieCreatedTime):
2278         (WebCore::cookieExpirationTime):
2279         (WebCore::cookieName):
2280         (WebCore::cookiePath):
2281         (WebCore::cookieValue):
2282         (WebCore::filterCookies):
2283         (WebCore::copyCookiesForURLWithFirstPartyURL):
2284         (WebCore::createCookies):
2285         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
2286         (WebCore::containsSecureCookies):
2287         (WebCore::NetworkStorageSession::cookiesForDOM const):
2288         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
2289         (WebCore::NetworkStorageSession::cookiesEnabled const):
2290         (WebCore::NetworkStorageSession::getRawCookies const):
2291         (WebCore::NetworkStorageSession::deleteCookie const):
2292         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
2293         (WebCore::NetworkStorageSession::deleteAllCookies):
2294         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
2295         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
2296
2297 2018-12-19  Antoine Quint  <graouts@apple.com>
2298
2299         [Web Animations] Compute animation effect timing properties in batch
2300         https://bugs.webkit.org/show_bug.cgi?id=192850
2301
2302         Reviewed by Dean Jackson.
2303
2304         We remove a host of functions from AnimationEffect that would allow the computation of various timing properties
2305         defined by the Web Animations specification: phase, progress, current iteration, etc. Indeed, a lot of these functions
2306         would call each other in a chain, and we would re-compute a lot of the earlier properties in those chains several times
2307         when doing something like querying the animation progress. Additionally, some functions, such as WebAnimation::computeRelevance()
2308         and WebAnimation::timeToNextTick() would yield the computation of several such properties numerous times. All of those
2309         functions are called during each animation frame and are ripe for optimizations.
2310
2311         We now compute all timing properties across two functions:
2312         
2313         1. the new AnimationEffect::getBasicTiming() which computes the local time, end time, active duration, active time and phase,
2314         2. the existing AnimationEffect::getComputedTiming() which now also exposes the phase and simple iteration progress.
2315
2316         To support this we introduce a new BasicEffectTiming struct to contain the values computed in AnimationEffect::getBasicTiming()
2317         and spun the AnimationEffect::Phase struct as AnimationEffectPhase so that it may be used across BasicEffectTiming and
2318         ComputedEffectTiming.
2319
2320         No new test since there is no user-observable change.
2321
2322         * WebCore.xcodeproj/project.pbxproj:
2323         * animation/AnimationEffect.cpp:
2324         (WebCore::AnimationEffect::getTiming const):
2325         (WebCore::AnimationEffect::getBasicTiming const):
2326         (WebCore::AnimationEffect::getComputedTiming const):
2327         (WebCore::AnimationEffect::localTime const): Deleted.
2328         (WebCore::AnimationEffect::phase const): Deleted.
2329         (WebCore::AnimationEffect::activeTime const): Deleted.
2330         (WebCore::AnimationEffect::overallProgress const): Deleted.
2331         (WebCore::AnimationEffect::simpleIterationProgress const): Deleted.
2332         (WebCore::AnimationEffect::currentIteration const): Deleted.
2333         (WebCore::AnimationEffect::currentDirection const): Deleted.
2334         (WebCore::AnimationEffect::directedProgress const): Deleted.
2335         (WebCore::AnimationEffect::transformedProgress const): Deleted.
2336         (WebCore::AnimationEffect::iterationProgress const): Deleted.
2337         (WebCore::AnimationEffect::getTiming): Deleted.
2338         (WebCore::AnimationEffect::getComputedTiming): Deleted.
2339         (WebCore::AnimationEffect::endTime const): Deleted.
2340         (WebCore::AnimationEffect::activeDuration const): Deleted.
2341         * animation/AnimationEffect.h:
2342         * animation/AnimationEffectPhase.h: Copied from Source/WebCore/animation/ComputedEffectTiming.h.
2343         * animation/AnimationTimeline.cpp:
2344         (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
2345         * animation/AnimationTimeline.h:
2346         * animation/BasicEffectTiming.h: Copied from Source/WebCore/animation/ComputedEffectTiming.h.
2347         * animation/ComputedEffectTiming.h:
2348         * animation/DeclarativeAnimation.cpp:
2349         (WebCore::DeclarativeAnimation::cancel):
2350         (WebCore::DeclarativeAnimation::phaseWithoutEffect const):
2351         (WebCore::DeclarativeAnimation::invalidateDOMEvents):
2352         * animation/DeclarativeAnimation.h:
2353         * animation/KeyframeEffect.cpp:
2354         (WebCore::KeyframeEffect::apply):
2355         (WebCore::KeyframeEffect::getAnimatedStyle):
2356         * animation/WebAnimation.cpp:
2357         (WebCore::WebAnimation::effectEndTime const):
2358         (WebCore::WebAnimation::computeRelevance):
2359         (WebCore::WebAnimation::timeToNextTick const):
2360
2361 2019-01-07  Youenn Fablet  <youenn@apple.com>
2362
2363         Crash in SWServer::Connection::resolveRegistrationReadyRequests
2364         https://bugs.webkit.org/show_bug.cgi?id=193217
2365
2366         Reviewed by Chris Dumez.
2367
2368         As can be seen from the traces, SWServer might clear its connections HashMap in its destructor.
2369         This might then trigger calling SWServer::resolveRegistrationReadyRequests.
2370         This method is iterating on the connections HashMap which is being cleared.
2371         To remove this problem, move the HashMap in a temporary variable and clear the temporary variable.
2372
2373         * workers/service/server/SWServer.cpp:
2374         (WebCore::SWServer::~SWServer):
2375
2376 2019-01-07  Jer Noble  <jer.noble@apple.com>
2377
2378         REGRESSION (r239519): ASSERTION FAILED: !m_adoptionIsRequired in com.apple.WebCore: void WTF::refIfNotNull<WebCore::CDMSessionMediaSourceAVFObjC> + 53
2379         https://bugs.webkit.org/show_bug.cgi?id=193211
2380         <rdar://problem/46937412>
2381
2382         Reviewed by Eric Carlson.
2383
2384         Make CDMSessionMediaSourceAVFObjC a CanMakeWeakPtr rather than RefCounted, as CDMSessions are stored in
2385         std::unique_ptrs, and not in Ref or RefPtr.
2386
2387         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
2388         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2389         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2390         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession):
2391
2392 2019-01-07  David Kilzer  <ddkilzer@apple.com>
2393
2394         Prefer RetainPtr<NSObject> to RetainPtr<NSObject *>
2395         <https://webkit.org/b/193056>
2396
2397         Reviewed by Alex Christensen.
2398
2399         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2400         (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:]):
2401         (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:withDiscontinuity:]):
2402         * platform/network/cf/AuthenticationChallenge.h:
2403         - Remove '*' from RetainPtr<> type.
2404
2405         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
2406         (WebCore::cookiesForURL):
2407         - Once retainPtr() was changed to return RetainPtr<NSArray>
2408           instead of RetainPtr<NSArray *> here, that forced the type of
2409           `cookiesPtr` to change as well since
2410           Optional<RetainPtr<NSArray>> is not assignable to
2411           Optional<RetainPtr<NSArray *>> without further template
2412           specialization, which didn't seem useful since
2413           Optional<RetainPtr<>> variable types are rarely used.
2414
2415 2019-01-07  Devin Rousso  <drousso@apple.com>
2416
2417         Web Inspector: extend XHR breakpoints to work with fetch
2418         https://bugs.webkit.org/show_bug.cgi?id=185843
2419         <rdar://problem/40431027>
2420
2421         Reviewed by Matt Baker.
2422
2423         Test: inspector/dom-debugger/url-breakpoints.html
2424
2425         * Modules/fetch/FetchResponse.cpp:
2426         (WebCore::FetchResponse::fetch):
2427
2428         * inspector/InspectorInstrumentation.h:
2429         (WebCore::InspectorInstrumentation::willFetch): Added.
2430         * inspector/InspectorInstrumentation.cpp:
2431         (WebCore::InspectorInstrumentation::willFetchImpl): Added.
2432
2433         * inspector/agents/InspectorDOMDebuggerAgent.h:
2434         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
2435         (WebCore::InspectorDOMDebuggerAgent::disable):
2436         (WebCore::InspectorDOMDebuggerAgent::discardBindings):
2437         (WebCore::InspectorDOMDebuggerAgent::setURLBreakpoint): Added.
2438         (WebCore::InspectorDOMDebuggerAgent::removeURLBreakpoint): Added.
2439         (WebCore::InspectorDOMDebuggerAgent::breakOnURLIfNeeded): Added.
2440         (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
2441         (WebCore::InspectorDOMDebuggerAgent::willFetch): Added.
2442         (WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint): Deleted.
2443         (WebCore::InspectorDOMDebuggerAgent::removeXHRBreakpoint): Deleted.
2444
2445 2019-01-07  Eric Carlson  <eric.carlson@apple.com>
2446
2447         Cleanup AudioTrackPrivateMediaStreamCocoa
2448         https://bugs.webkit.org/show_bug.cgi?id=193208
2449         <rdar://problem/42225870>
2450
2451         Reviewed by Youenn Fablet.
2452
2453         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
2454         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable): Clear input and
2455         output format descriptions after stopping the audio unit.
2456
2457 2019-01-07  Devin Rousso  <drousso@apple.com>
2458
2459         Web Inspector: Network: show secure connection details per-request
2460         https://bugs.webkit.org/show_bug.cgi?id=191539
2461         <rdar://problem/45979891>
2462
2463         Reviewed by Joseph Pecoraro.
2464
2465         Test: http/tests/inspector/network/resource-security-connection.html
2466
2467         * platform/network/NetworkLoadMetrics.h:
2468         (WebCore::NetworkLoadMetrics:isolatedCopy):
2469         (WebCore::NetworkLoadMetrics:clearNonTimingData):
2470         (WebCore::NetworkLoadMetrics:operator==):
2471         (WebCore::NetworkLoadMetrics:encode):
2472         (WebCore::NetworkLoadMetrics:decode):
2473
2474         * inspector/agents/InspectorNetworkAgent.cpp:
2475         (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
2476
2477 2019-01-07  Eric Carlson  <eric.carlson@apple.com>
2478
2479         Deactivate audio session whenever possible
2480         https://bugs.webkit.org/show_bug.cgi?id=193188
2481         <rdar://problem/42678977>
2482
2483         Reviewed by Jer Noble.
2484
2485         Test: media/deactivate-audio-session.html
2486
2487         * platform/audio/AudioSession.cpp:
2488         (WebCore::AudioSession::tryToSetActive):
2489         (WebCore::AudioSession::tryToSetActiveInternal):
2490         * platform/audio/AudioSession.h:
2491         (WebCore::AudioSession::isActive const):
2492
2493         * platform/audio/PlatformMediaSessionManager.cpp:
2494         (WebCore::PlatformMediaSessionManager::removeSession):
2495         (WebCore::deactivateAudioSession):
2496         (WebCore::PlatformMediaSessionManager::shouldDeactivateAudioSession):
2497         (WebCore::PlatformMediaSessionManager::setShouldDeactivateAudioSession):
2498         * platform/audio/PlatformMediaSessionManager.h:
2499
2500         * platform/audio/ios/AudioSessionIOS.mm:
2501         (WebCore::AudioSession::tryToSetActiveInternal):
2502         (WebCore::AudioSession::tryToSetActive): Deleted.
2503
2504         * platform/audio/mac/AudioSessionMac.cpp:
2505         (WebCore::AudioSession::tryToSetActiveInternal):
2506         (WebCore::AudioSession::tryToSetActive): Deleted.
2507
2508         * testing/Internals.cpp:
2509         (WebCore::Internals::audioSessionActive const):
2510         * testing/Internals.h:
2511         * testing/Internals.idl:
2512
2513 2019-01-07  David Kilzer  <ddkilzer@apple.com>
2514
2515         PlatformECKey should use a std::unique_ptr
2516         <https://webkit.org/b/193170>
2517
2518         Reviewed by Brent Fulgham.
2519
2520         Broadly:
2521         - Switch from using raw pointers to using std::unique_ptr<> to
2522           hold PlatformECKey.
2523         - Introduce PlatformECKeyContainer type to handle different
2524           std::unique_ptr<> types on each platform.
2525         - Get rid of custom CryptoKeyEC destructors since the
2526           std::unique_ptr<> handles that with a Deleter.
2527         - Initialize stack variables to nullptr.
2528
2529         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
2530         (WebCore::CryptoKeyEC::keySizeInBits const):
2531         (WebCore::CryptoKeyEC::platformGeneratePair):
2532         (WebCore::CryptoKeyEC::platformImportRaw):
2533         (WebCore::CryptoKeyEC::platformImportJWKPublic):
2534         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
2535         (WebCore::CryptoKeyEC::platformImportSpki):
2536         (WebCore::CryptoKeyEC::platformImportPkcs8):
2537         (WebCore::CryptoKeyEC::platformExportRaw const):
2538         (WebCore::CryptoKeyEC::platformAddFieldElements const):
2539         (WebCore::CryptoKeyEC::platformExportSpki const):
2540         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
2541         (WebCore::CryptoKeyEC::~CryptoKeyEC): Deleted.
2542         * crypto/keys/CryptoKeyEC.cpp:
2543         (WebCore::CryptoKeyEC::CryptoKeyEC):
2544         * crypto/keys/CryptoKeyEC.h:
2545         (WebCore::CCECCryptorRefDeleter::operator() const):
2546         * crypto/mac/CryptoKeyECMac.cpp:
2547         (WebCore::CryptoKeyEC::keySizeInBits const):
2548         (WebCore::CryptoKeyEC::platformGeneratePair):
2549         (WebCore::CryptoKeyEC::platformImportRaw):
2550         (WebCore::CryptoKeyEC::platformExportRaw const):
2551         (WebCore::CryptoKeyEC::platformImportJWKPublic):
2552         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
2553         (WebCore::CryptoKeyEC::platformAddFieldElements const):
2554         (WebCore::CryptoKeyEC::platformImportSpki):
2555         (WebCore::CryptoKeyEC::platformExportSpki const):
2556         (WebCore::CryptoKeyEC::platformImportPkcs8):
2557         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
2558         (WebCore::CryptoKeyEC::~CryptoKeyEC): Deleted.
2559
2560 2019-01-07  Antti Koivisto  <antti@apple.com>
2561
2562         UI process side scrollbars for UI side compositing on Mac
2563         https://bugs.webkit.org/show_bug.cgi?id=193106
2564
2565         Reviewed by Tim Horton.
2566
2567         * page/FrameView.cpp:
2568         (WebCore::FrameView::paintScrollCorner):
2569         * page/scrolling/AsyncScrollingCoordinator.cpp:
2570         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
2571
2572         Pass scrollbar host layers and the dark appearance bit to the scrolling tree.
2573
2574         * page/scrolling/ScrollingCoordinator.cpp:
2575         (WebCore::ScrollingCoordinator::verticalScrollbarLayerForFrameView):
2576         (WebCore::ScrollingCoordinator::horizontalScrollbarLayerForFrameView):
2577         * page/scrolling/ScrollingCoordinator.h:
2578         (WebCore::ScrollableAreaParameters::ScrollableAreaParameters):
2579         (WebCore::ScrollableAreaParameters::operator== const):
2580         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
2581         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
2582         (WebCore::ScrollingStateFrameScrollingNode::setScrollbarLayers):
2583         * page/scrolling/ScrollingStateFrameScrollingNode.h:
2584         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
2585         * page/scrolling/ScrollingTreeScrollingNode.h:
2586         (WebCore::ScrollingTreeScrollingNode::scrollableAreaSize const):
2587         (WebCore::ScrollingTreeScrollingNode::totalContentsSize const):
2588         (WebCore::ScrollingTreeScrollingNode::useDarkAppearanceForScrollbars const):
2589         (WebCore::ScrollingTreeScrollingNode::lastCommittedScrollPosition const):
2590         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
2591         * platform/ScrollableArea.cpp:
2592         (WebCore::ScrollableArea::useDarkAppearanceForScrollbars const):
2593
2594         Factor into a function as this is used in several places.
2595
2596         * platform/ScrollableArea.h:
2597         * platform/mac/NSScrollerImpDetails.h:
2598         * platform/mac/ScrollAnimatorMac.mm:
2599         (-[WebScrollerImpDelegate effectiveAppearanceForScrollerImp:]):
2600         * platform/mac/ScrollbarThemeMac.h:
2601
2602 2019-01-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2603
2604         Native caret shows up alongside the page's caret when requesting desktop site on jsfiddle.net
2605         https://bugs.webkit.org/show_bug.cgi?id=193180
2606         <rdar://problem/45971041>
2607
2608         Reviewed by Tim Horton.
2609
2610         Adjust a method on RenderObject to additionally detect when the RenderObject is inside of an `overflow: hidden`
2611         container that is also empty. See WebKit ChangeLog for more details.
2612
2613         Test:   editing/selection/ios/hide-selection-in-empty-overflow-hidden-container.html
2614                 editing/selection/ios/show-selection-in-empty-overflow-hidden-document.html
2615
2616         * rendering/RenderObject.cpp:
2617         (WebCore::RenderObject::isTransparentOrFullyClippedRespectingParentFrames const):
2618         (WebCore::RenderObject::isTransparentRespectingParentFrames const): Deleted.
2619         * rendering/RenderObject.h:
2620
2621 2019-01-07  Zalan Bujtas  <zalan@apple.com>
2622
2623         [LFC][BFC] Margin collapsing should not be limited to in-flow non-replaced boxes.
2624         https://bugs.webkit.org/show_bug.cgi?id=193183
2625
2626         Reviewed by Antti Koivisto.
2627
2628         * layout/FormattingContext.cpp:
2629         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
2630         * layout/FormattingContextGeometry.cpp:
2631         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
2632         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
2633         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
2634         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2635         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
2636         * layout/LayoutUnits.h:
2637         * layout/blockformatting/BlockFormattingContext.cpp:
2638         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
2639         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2640         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2641         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
2642         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
2643         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedHeight):
2644         * layout/inlineformatting/InlineFormattingContext.cpp:
2645         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
2646
2647 2019-01-07  Zalan Bujtas  <zalan@apple.com>
2648
2649         [LFC][BFC] Move MarginCollapse from BlockFormattingContext::Geometry to BlockFormattingContext
2650         https://bugs.webkit.org/show_bug.cgi?id=193181
2651
2652         Reviewed by Antti Koivisto.
2653
2654         This is in preparation to share margin collapsing across all boxes in block formatting context.
2655
2656         * layout/blockformatting/BlockFormattingContext.h:
2657         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2658         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
2659         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
2660         * layout/blockformatting/BlockMarginCollapse.cpp:
2661         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBefore):
2662         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginAfter):
2663         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBefore):
2664         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginAfter):
2665         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBeforeFromFirstChild):
2666         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginAfterFromLastChild):
2667         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter):
2668         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore):
2669         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance):
2670         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginBefore):
2671         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginAfter):
2672         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSibling):
2673         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSibling):
2674         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
2675         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBefore):
2676         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfter):
2677         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBefore): Deleted.
2678         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginAfter): Deleted.
2679         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBefore): Deleted.
2680         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginAfter): Deleted.
2681         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBeforeFromFirstChild): Deleted.
2682         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginAfterFromLastChild): Deleted.
2683         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter): Deleted.
2684         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore): Deleted.
2685         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance): Deleted.
2686         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginBefore): Deleted.
2687         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginAfter): Deleted.
2688         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithPreviousSibling): Deleted.
2689         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithNextSibling): Deleted.
2690         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginsCollapseThrough): Deleted.
2691         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBefore): Deleted.
2692         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfter): Deleted.
2693
2694 2019-01-07  Zan Dobersek  <zdobersek@igalia.com>
2695
2696         [WPE] Use Widget bounds for PlatformScreen rectangle information
2697         https://bugs.webkit.org/show_bug.cgi?id=193190
2698
2699         Reviewed by Philippe Normand.
2700
2701         Provide a better screen area estimate in screenRect() and
2702         screenAvailableRect() return values than the current 1240x640 value by
2703         using the Widget's bounds rectangle.
2704
2705         This approach is only factually correct when the Widget-associated view
2706         is displayed in fullscreen, but it provides a better estimate even when
2707         displayed in any other case as well. WPE doesn't provide specific API
2708         that could enable the embedding environment to provide this information.
2709
2710         * platform/wpe/PlatformScreenWPE.cpp:
2711         (WebCore::screenRect): Return bounds of the Widget object.
2712         (WebCore::screenAvailableRect): Relay the call to screenRect().
2713
2714 2019-01-07  Zan Dobersek  <zdobersek@igalia.com>
2715
2716         Make Gradient::gradientSpaceTransform(), Pattern::patternSpaceTransform() methods const
2717         https://bugs.webkit.org/show_bug.cgi?id=193189
2718
2719         Reviewed by Philippe Normand.
2720
2721         The transform getter methods on the Gradient and Pattern classes both
2722         return const references to the transform objects, and don't modify any
2723         internal state. They should be marked const accordingly, allowing
2724         invocations of these two methods through const references to Gradient
2725         and Pattern objects.
2726
2727         * platform/graphics/Gradient.h:
2728         (WebCore::Gradient::gradientSpaceTransform): Now const.
2729         * platform/graphics/Pattern.h:
2730         (WebCore::Pattern::patternSpaceTransform): Now const.
2731
2732 2019-01-07  Zan Dobersek  <zdobersek@igalia.com>
2733
2734         REGRESSION(r239636): ImageDecoder::setEncodedDataStatusChangeCallback() can be called on a null decoder
2735         https://bugs.webkit.org/show_bug.cgi?id=193187
2736
2737         Reviewed by Philippe Normand.
2738
2739         * platform/graphics/ImageSource.cpp:
2740         (WebCore::ImageSource::ensureDecoderAvailable): Bail before calling the
2741         setEncodedDataStatusChangeCallback() method when the returned
2742         ImageDecoder object is null.
2743
2744 2019-01-06  Zan Dobersek  <zdobersek@igalia.com>
2745
2746         [Nicosia] Take over CoordinatedGraphics-named implementation of async scrolling classes
2747         https://bugs.webkit.org/show_bug.cgi?id=193133
2748
2749         Reviewed by Michael Catanzaro.
2750
2751         Move the CoordinatedGraphics-specific files under
2752         page/scrolling/coordinatedgraphics/ to page/scrolling/nicosia/, along
2753         with renaming the files and classes accordingly. Implementation will
2754         only depend on the Nicosia-specific layer structure and is not specific
2755         to the CoordinatedGraphics system.
2756
2757         * PlatformPlayStation.cmake:
2758         * SourcesGTK.txt:
2759         * SourcesWPE.txt:
2760         * page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp.
2761         * page/scrolling/nicosia/ScrollingCoordinatorNicosia.h: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h.
2762         * page/scrolling/nicosia/ScrollingStateNodeNicosia.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp.
2763         * page/scrolling/nicosia/ScrollingTreeFixedNode.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.cpp.
2764         * page/scrolling/nicosia/ScrollingTreeFixedNode.h: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.h.
2765         * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.cpp.
2766         * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.h.
2767         * page/scrolling/nicosia/ScrollingTreeNicosia.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.cpp.
2768         * page/scrolling/nicosia/ScrollingTreeNicosia.h: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.h.
2769         * page/scrolling/nicosia/ScrollingTreeStickyNode.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.cpp.
2770         * page/scrolling/nicosia/ScrollingTreeStickyNode.h: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.h.
2771         * platform/TextureMapper.cmake:
2772
2773 2019-01-06  Jiewen Tan  <jiewen_tan@apple.com>
2774
2775         [WebAuthN] Import U2F command/response converters from Chromium
2776         https://bugs.webkit.org/show_bug.cgi?id=193150
2777         <rdar://problem/47054028>
2778
2779         Reviewed by Brent Fulgham.
2780
2781         This patch imports Chromium's U2F command/response converters:
2782         https://fidoalliance.org/specs/fido-v2.0-id-20180227/fido-client-to-authenticator-protocol-v2.0-id-20180227.html#u2f-interoperability
2783         1. It directly imports the following files and suit them to WebKit's coding style:
2784         https://cs.chromium.org/chromium/src/device/fido/u2f_command_constructor.cc?l=1&rcl=db624110317d01efa78cd32e7be1524190e1beb0
2785         https://cs.chromium.org/chromium/src/device/fido/u2f_command_constructor.h?rcl=db624110317d01efa78cd32e7be1524190e1beb0
2786         https://cs.chromium.org/chromium/src/device/fido/u2f_command_constructor_unittest.cc?rcl=db624110317d01efa78cd32e7be1524190e1beb0
2787         2. It gathers the following methods into U2fResponseConverter:
2788         AuthenticatorMakeCredentialResponse::CreateFromU2fRegisterResponse()
2789         AuthenticatorGetAssertionResponse::CreateFromU2fSignResponse()
2790         3. It also updates FidoConstants.h, FidoTestData.h and CtapResponseTest.cpp accordingly.
2791
2792         Besides importing stuff from Chroimum, it also gathers a bunch of constants and helper functions into WebAuthenticationConstants.h
2793         and WebAuthenticationUtils.h. It also fixes Bug 183534: 2) and 7).
2794
2795         Covered by API tests.
2796
2797         * Modules/webauthn/AuthenticatorCoordinator.cpp:
2798         (WebCore::AuthenticatorCoordinatorInternal::produceClientDataJsonHash):
2799         * Modules/webauthn/WebAuthenticationConstants.h: Copied from Source/WebCore/Modules/webauthn/COSEConstants.h.
2800         * Modules/webauthn/WebAuthenticationUtils.cpp: Added.
2801         (WebCore::convertBytesToVector):
2802         (WebCore::produceRpIdHash):
2803         (WebCore::encodeES256PublicKeyAsCBOR):
2804         (WebCore::buildAttestedCredentialData):
2805         (WebCore::buildAuthData):
2806         (WebCore::buildAttestationObject):
2807         * Modules/webauthn/WebAuthenticationUtils.h: Renamed from Source/WebCore/Modules/webauthn/COSEConstants.h.
2808         * Modules/webauthn/fido/DeviceResponseConverter.cpp:
2809         (fido::getCredentialId):
2810         (fido::readCTAPGetInfoResponse):
2811         * Modules/webauthn/fido/FidoConstants.h:
2812         * Modules/webauthn/fido/U2fCommandConstructor.cpp: Added.
2813         (fido::WebCore::constructU2fRegisterCommand):
2814         (fido::WebCore::constructU2fSignCommand):
2815         (fido::isConvertibleToU2fRegisterCommand):
2816         (fido::isConvertibleToU2fSignCommand):
2817         (fido::convertToU2fRegisterCommand):
2818         (fido::convertToU2fCheckOnlySignCommand):
2819         (fido::convertToU2fSignCommand):
2820         (fido::constructBogusU2fRegistrationCommand):
2821         * Modules/webauthn/fido/U2fCommandConstructor.h: Added.
2822         * Modules/webauthn/fido/U2fResponseConverter.cpp: Added.
2823         (fido::WebCore::extractECPublicKeyFromU2fRegistrationResponse):
2824         (fido::WebCore::extractCredentialIdFromU2fRegistrationResponse):
2825         (fido::WebCore::createAttestedCredentialDataFromU2fRegisterResponse):
2826         (fido::WebCore::parseX509Length):
2827         (fido::WebCore::createFidoAttestationStatementFromU2fRegisterResponse):
2828         (fido::readU2fRegisterResponse):
2829         (fido::readFromU2fSignResponse):
2830         * Modules/webauthn/fido/U2fResponseConverter.h: Added.
2831         * Modules/webgpu/WebGPUCommandBuffer.cpp:
2832         * Sources.txt:
2833         * WebCore.xcodeproj/project.pbxproj:
2834
2835 2019-01-06  David Kilzer  <ddkilzer@apple.com>
2836
2837         Leak of WTF::Function objects in WebCore::CryptoKeyRSA::generatePair() (64-80 bytes each) in com.apple.WebKit.WebContent running WebKit layout tests
2838         <https://webkit.org/b/193177>
2839         <rdar://problem/47072196>
2840
2841         Reviewed by Saam Barati.
2842
2843         * crypto/mac/CryptoKeyRSAMac.cpp:
2844         (WebCore::CryptoKeyRSA::generatePair): Fix the leak by changing
2845         raw pointers to heap-allocated __block variables to hold the
2846         WTF::Function objects until they are consumed within the block
2847         passed to dispatch_async().  The __block variables act like
2848         captured variables in a C++ lambda and have the same lifetime as
2849         the block that they are captured in.  Note that we would have to
2850         convert the source file from C++ to Objective-C++ to use a C++
2851         lambda functor with dispatch_async(), which creates its own
2852         issue because the comipiler requires a copy constructor to
2853         convert the C++ lambda to a block functor, but the copy
2854         constructor for the C++ lambda is implicitly deleted because the
2855         WTF::Function copy constructor is explicitly deleted.  Whew!
2856
2857 2019-01-06  Pablo Saavedra  <psaavedra@igalia.com>
2858
2859         [WPE][GTK] Building with ENABLE_VIDEO=OFF fails trying to use Document MediaPlayback functions.
2860         https://bugs.webkit.org/show_bug.cgi?id=193174
2861
2862         Reviewed by Michael Catanzaro.
2863
2864         * page/Page.cpp:
2865         (WebCore::Page::stopAllMediaPlayback):
2866         (WebCore::Page::suspendAllMediaPlayback):
2867         (WebCore::Page::resumeAllMediaPlayback):
2868
2869 2019-01-05  David Kilzer  <ddkilzer@apple.com>
2870
2871         Leak of two CCRSACryptorRef (4.0 Kbytes/1 page each) in com.apple.WebKit.WebContent running WebKit layout tests
2872         <https://webkit.org/b/193154>
2873         <rdar://problem/47052993>
2874
2875         Reviewed by Brent Fulgham.
2876
2877         Broadly:
2878         - Fix leaks by switching from using raw pointers to using
2879           std::unique_ptr<>.
2880         - Introduce PlatformRSAKeyContainer type to handle different
2881           std::unique_ptr<> on each platform.
2882         - Get rid of custom CryptoKeyRSA destructors since the
2883           std::unique_ptr<> handles that with a Deleter.
2884         - Initialize stack variables to nullptr.
2885
2886         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
2887         (WebCore::CryptoKeyRSA::create):
2888         (WebCore::CryptoKeyRSA::CryptoKeyRSA):
2889         (WebCore::CryptoKeyRSA::keySizeInBits const):
2890         (WebCore::CryptoKeyRSA::generatePair):
2891         (WebCore::CryptoKeyRSA::importSpki):
2892         (WebCore::CryptoKeyRSA::importPkcs8):
2893         (WebCore::CryptoKeyRSA::exportSpki const):
2894         (WebCore::CryptoKeyRSA::exportPkcs8 const):
2895         (WebCore::CryptoKeyRSA::algorithm const):
2896         (WebCore::CryptoKeyRSA::exportData const):
2897         (WebCore::CryptoKeyRSA::~CryptoKeyRSA): Deleted.
2898         * crypto/keys/CryptoKeyRSA.h:
2899         (WebCore::CCRSACryptorRefDeleter::operator() const):
2900         * crypto/mac/CryptoKeyRSAMac.cpp:
2901         (WebCore::getPublicKeyComponents):
2902         (WebCore::getPrivateKeyComponents):
2903         (WebCore::CryptoKeyRSA::CryptoKeyRSA):
2904         (WebCore::CryptoKeyRSA::create):
2905         (WebCore::CryptoKeyRSA::exportData const):
2906         (WebCore::CryptoKeyRSA::generatePair):
2907         (WebCore::CryptoKeyRSA::importSpki):
2908         (WebCore::CryptoKeyRSA::importPkcs8):
2909         (WebCore::CryptoKeyRSA::~CryptoKeyRSA): Deleted.
2910
2911 2019-01-05  Zalan Bujtas  <zalan@apple.com>
2912
2913         Incorrect clipping across compositing boundary.
2914         https://bugs.webkit.org/show_bug.cgi?id=193172
2915         <rdar://problem/44693008>
2916
2917         Reviewed by Simon Fraser.
2918
2919         Use temporary cliprect type when crossing compositing boundary to prevent cliprect caching.
2920
2921         The issue here is that RenderLayer::backgroundClipRect() could cross compositing boundary by calling parentClipRects() which triggers
2922         clip rect update using the wrong painting root. This happens when the layer hierarchy and the compositing context do not match.
2923         For clip rect computation, we need to climb up on the layer hierarchy (calling parent layer's cliprect functions)
2924         but we also need to make sure that the computed cliprects on any given layer are cached only when the painting root is correct.
2925         It ensures that when we paint a layer (with the painting root as entry point), the cached cliprects are always based on its onw painting root. 
2926
2927         Test: compositing/clipping/cached-cliprect-with-compositing-boundary.html
2928
2929         * rendering/RenderLayer.cpp:
2930         (WebCore::RenderLayer::calculateClipRects const):
2931
2932 2019-01-05  Youenn Fablet  <youenn@apple.com>
2933
2934         Service Worker fetch should obey its referrer policy
2935         https://bugs.webkit.org/show_bug.cgi?id=193152
2936
2937         Reviewed by Chris Dumez.
2938
2939         Pass referrer policy retrieved when fetching the service worker script to the SWServer.
2940         The SWServer then stores it persistently and sends it to the manager creating service workers.
2941         This manager will then set the referrer policy on the dummy Document of the corresponding service worker.
2942
2943         Covered by rebased test.
2944
2945         * workers/WorkerScriptLoader.cpp:
2946         (WebCore::WorkerScriptLoader::didReceiveResponse):
2947         * workers/WorkerScriptLoader.h:
2948         (WebCore::WorkerScriptLoader::referrerPolicy const):
2949         * workers/service/SWClientConnection.cpp:
2950         (WebCore::SWClientConnection::failedFetchingScript):
2951         * workers/service/ServiceWorkerContainer.cpp:
2952         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
2953         * workers/service/ServiceWorkerContainer.h:
2954         * workers/service/ServiceWorkerContextData.cpp:
2955         (WebCore::ServiceWorkerContextData::isolatedCopy const):
2956         * workers/service/ServiceWorkerContextData.h:
2957         (WebCore::ServiceWorkerContextData::encode const):
2958         (WebCore::ServiceWorkerContextData::decode):
2959         * workers/service/ServiceWorkerFetchResult.h:
2960         (WebCore::ServiceWorkerFetchResult::encode const):
2961         (WebCore::ServiceWorkerFetchResult::decode):
2962         * workers/service/ServiceWorkerJob.cpp:
2963         (WebCore::ServiceWorkerJob::notifyFinished):
2964         * workers/service/ServiceWorkerJobClient.h:
2965         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2966         (WebCore::createPageForServiceWorker):
2967         * workers/service/server/RegistrationDatabase.cpp:
2968         (WebCore::recordsTableSchema):
2969         (WebCore::RegistrationDatabase::doPushChanges):
2970         (WebCore::RegistrationDatabase::importRecords):
2971         * workers/service/server/SWServer.cpp:
2972         (WebCore::SWServer::addRegistrationFromStore):
2973         (WebCore::SWServer::updateWorker):
2974         (WebCore::SWServer::installContextData):
2975         * workers/service/server/SWServer.h:
2976         * workers/service/server/SWServerJobQueue.cpp:
2977         (WebCore::SWServerJobQueue::scriptFetchFinished):
2978         * workers/service/server/SWServerWorker.cpp:
2979         (WebCore::SWServerWorker::SWServerWorker):
2980         (WebCore::SWServerWorker::contextData const):
2981         * workers/service/server/SWServerWorker.h:
2982
2983 2019-01-04  Simon Fraser  <simon.fraser@apple.com>
2984
2985         Factor legacy WK1 code for fixed and scrolling layers into their own helper class
2986         https://bugs.webkit.org/show_bug.cgi?id=193165
2987
2988         Reviewed by Frédéric Wang.
2989
2990         RenderLayerCompositor has some code to handle registration of viewport-constrained
2991         and scrolling layers which is specific to iOS WK1. To reduce pollution, move this
2992         into its own helper class called LegacyWebKitScrollingLayerCoordinator, which is only
2993         allocated for iOS WK1.
2994         
2995         iOS WK1 never has a ScrollingCoordinator, so rather than the check for scrollingCoordinator(),
2996         we know that we only made a LegacyWebKitScrollingLayerCoordinator when there's a platform widget
2997         (i.e. WK1).
2998         
2999         * page/ChromeClient.h:
3000         * rendering/RenderLayerCompositor.cpp:
3001         (WebCore::RenderLayerCompositor::RenderLayerCompositor):
3002         (WebCore::RenderLayerCompositor::updateCustomLayersAfterFlush):
3003         (WebCore::RenderLayerCompositor::didFlushChangesForLayer):
3004         (WebCore::RenderLayerCompositor::setIsInWindow):
3005         (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking): No longer check the page cache state; now we
3006         destroy the render tree of pages in the page cache, so we should never hit this code path.
3007         (WebCore::RenderLayerCompositor::didAddScrollingLayer):
3008         (WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers):
3009         (WebCore::LegacyWebKitScrollingLayerCoordinator::unregisterAllViewportConstrainedLayers):
3010         (WebCore::scrollbarHasDisplayNone):
3011         (WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer):
3012         (WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllScrollingLayers):
3013         (WebCore::LegacyWebKitScrollingLayerCoordinator::registerScrollingLayersNeedingUpdate):
3014         (WebCore::LegacyWebKitScrollingLayerCoordinator::unregisterAllScrollingLayers):
3015         (WebCore::LegacyWebKitScrollingLayerCoordinator::addScrollingLayer):
3016         (WebCore::LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer):
3017         (WebCore::LegacyWebKitScrollingLayerCoordinator::didFlushChangesForLayer):
3018         (WebCore::updateScrollingLayerWithClient): Deleted.
3019         (WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers): Deleted.
3020         (WebCore::RenderLayerCompositor::unregisterAllViewportConstrainedLayers): Deleted.
3021         (WebCore::RenderLayerCompositor::registerAllScrollingLayers): Deleted.
3022         (WebCore::RenderLayerCompositor::unregisterAllScrollingLayers): Deleted.
3023         * rendering/RenderLayerCompositor.h:
3024         (WebCore::LegacyWebKitScrollingLayerCoordinator::LegacyWebKitScrollingLayerCoordinator):
3025         * workers/service/ServiceWorkerContainer.cpp:
3026         (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
3027
3028 2019-01-05  Zalan Bujtas  <zalan@apple.com>
3029
3030         [LFC] VerticalMargin should only have the used values.
3031         https://bugs.webkit.org/show_bug.cgi?id=193168
3032
3033         Reviewed by Antti Koivisto.
3034
3035         Split VerticalMargin into ComputedVerticalMargin and UsedVerticalMargin.
3036         ComputedVerticalMargin holds the computed (optional) values while UsedVerticalMargin holds both the
3037         collapsed (optional) and the non-collapsed values.
3038
3039         * layout/FormattingContext.cpp:
3040         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
3041         * layout/FormattingContext.h:
3042         * layout/FormattingContextGeometry.cpp:
3043         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
3044         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
3045         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
3046         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
3047         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
3048         (WebCore::Layout::FormattingContext::Geometry::computedVerticalMargin):
3049         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue): Deleted.
3050         * layout/FormattingContextQuirks.cpp:
3051         (WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight):
3052         * layout/LayoutUnits.h:
3053         * layout/MarginTypes.h:
3054         (WebCore::Layout::UsedVerticalMargin::before const):
3055         (WebCore::Layout::UsedVerticalMargin::after const):
3056         (WebCore::Layout::UsedVerticalMargin::nonCollapsedValues const):
3057         (WebCore::Layout::UsedVerticalMargin::collapsedValues const):
3058         (WebCore::Layout::UsedVerticalMargin::hasCollapsedValues const):
3059         (WebCore::Layout::UsedVerticalMargin::setCollapsedValues):
3060         (WebCore::Layout::UsedVerticalMargin::UsedVerticalMargin):
3061         (WebCore::Layout::VerticalMargin::nonCollapsedValues const): Deleted.
3062         (WebCore::Layout::VerticalMargin::collapsedValues const): Deleted.
3063         (WebCore::Layout::VerticalMargin::setCollapsedValues): Deleted.
3064         (WebCore::Layout::VerticalMargin::VerticalMargin): Deleted.
3065         (WebCore::Layout::VerticalMargin::usedValues const): Deleted.
3066         * layout/blockformatting/BlockFormattingContext.cpp:
3067         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
3068         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3069         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
3070         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
3071         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
3072         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedHeight):
3073         * layout/blockformatting/BlockMarginCollapse.cpp:
3074         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBefore):
3075         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginAfter):
3076         * layout/displaytree/DisplayBox.h:
3077         (WebCore::Display::Box::setVerticalMargin):
3078         (WebCore::Display::Box::verticalMargin const):
3079         (WebCore::Display::Box::marginBefore const):
3080         (WebCore::Display::Box::marginAfter const):
3081         * layout/floats/FloatingContext.cpp:
3082         (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
3083         * layout/inlineformatting/InlineFormattingContext.cpp:
3084         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
3085
3086 2019-01-04  Daniel Bates  <dabates@apple.com>
3087
3088         REGRESSION (r238522): Erratic scrolling on Google flights search result page and vrbo.com
3089         https://bugs.webkit.org/show_bug.cgi?id=192996
3090         <rdar://problem/46573552>
3091
3092         Reviewed by Simon Fraser.
3093
3094         Only scroll a text field if its inner text size changes and it is the currently active and
3095         focused element on the page.
3096
3097         Test: fast/scrolling/page-should-not-scroll-on-unfocused-text-field-layout.html
3098
3099         * rendering/RenderTextControlSingleLine.cpp:
3100         (WebCore::RenderTextControlSingleLine::layout):
3101
3102 2019-01-04  Alex Christensen  <achristensen@webkit.org>
3103
3104         Progress towards fixing Mac CMake build
3105         https://bugs.webkit.org/show_bug.cgi?id=193105
3106
3107         Reviewed by Don Olmstead.
3108
3109         * PlatformMac.cmake:
3110         * Sources.txt:
3111         * SourcesCocoa.txt:
3112         * WebCore.xcodeproj/project.pbxproj:
3113         * platform/graphics/gpu/GPURenderPassEncoder.h:
3114
3115 2019-01-04  Zalan Bujtas  <zalan@apple.com>
3116
3117         [iOS] ERROR: post-layout: dirty renderer(s) in WebCore::RenderTreeNeedsLayoutChecker::~RenderTreeNeedsLayoutChecker()
3118         https://bugs.webkit.org/show_bug.cgi?id=189608
3119         <rdar://problem/44473299>
3120
3121         Reviewed by Simon Fraser.
3122
3123         When a frameset/iframe is hidden and we skip layout, clear the dirty flag on its subtree as well.
3124
3125         Covered by fast/frames/invalid-frameset.html.
3126
3127         * rendering/RenderFrameSet.cpp:
3128         (WebCore::clearSiblingSubtrees):
3129         (WebCore::RenderFrameSet::positionFrames):
3130         (WebCore::RenderFrameSet::positionFramesWithFlattening):
3131
3132 2019-01-04  Youenn Fablet  <youenn@apple.com>
3133
3134         [Fetch API] Implement abortable fetch
3135         https://bugs.webkit.org/show_bug.cgi?id=174980
3136         <rdar://problem/46861402>
3137
3138         Reviewed by Chris Dumez.
3139
3140         Add an AbortSignal to FetchRequest.
3141
3142         Add support for AbortSignal algorithm.
3143         The fetch request signal is added an algorithm to abort the fetch.
3144         Update clone algorithm to let signal of the cloned request be following the origin request.
3145
3146         Update ReadableStream error handling to return an exception instead of a string.
3147         This allows passing an AbortError instead of a TypeError as previously done.
3148
3149         Update FetchBodyOwner to store a loading error either as an exception or as a resource error.
3150         The latter is used for passing the error from service worker back to the page.
3151         The former is used to pass it to ReadableStream or body accessors.
3152
3153         Covered by enabled tests.
3154
3155         * Modules/cache/DOMCache.cpp:
3156         (WebCore::DOMCache::put):
3157         * Modules/fetch/FetchBody.cpp:
3158         (WebCore::FetchBody::consumeAsStream):
3159         (WebCore::FetchBody::loadingFailed):
3160         * Modules/fetch/FetchBody.h:
3161         * Modules/fetch/FetchBodyConsumer.cpp:
3162         (WebCore::FetchBodyConsumer::loadingFailed):
3163         * Modules/fetch/FetchBodyConsumer.h:
3164         * Modules/fetch/FetchBodyOwner.cpp:
3165         (WebCore::FetchBodyOwner::arrayBuffer):
3166         (WebCore::FetchBodyOwner::blob):
3167         (WebCore::FetchBodyOwner::cloneBody):
3168         (WebCore::FetchBodyOwner::formData):
3169         (WebCore::FetchBodyOwner::json):
3170         (WebCore::FetchBodyOwner::text):
3171         (WebCore::FetchBodyOwner::loadBlob):
3172         (WebCore::FetchBodyOwner::blobLoadingFailed):
3173         (WebCore::FetchBodyOwner::consumeBodyAsStream):
3174         (WebCore::FetchBodyOwner::setLoadingError):
3175         * Modules/fetch/FetchBodyOwner.h:
3176         (WebCore::FetchBodyOwner::loadingError const):
3177         (WebCore::FetchBodyOwner::loadingException const):
3178         * Modules/fetch/FetchBodySource.cpp:
3179         (WebCore::FetchBodySource::error):
3180         * Modules/fetch/FetchBodySource.h:
3181         * Modules/fetch/FetchRequest.cpp:
3182         (WebCore::FetchRequest::initializeWith):
3183         (WebCore::FetchRequest::clone):
3184         * Modules/fetch/FetchRequest.h:
3185         (WebCore::FetchRequest::FetchRequest):
3186         * Modules/fetch/FetchRequest.idl:
3187         * Modules/fetch/FetchRequestInit.h:
3188         (WebCore::FetchRequestInit::hasMembers const):
3189         * Modules/fetch/FetchRequestInit.idl:
3190         * Modules/fetch/FetchResponse.cpp:
3191         (WebCore::FetchResponse::clone):
3192         (WebCore::FetchResponse::fetch):
3193         (WebCore::FetchResponse::BodyLoader::didFail):
3194         * Modules/fetch/FetchResponse.h:
3195         * bindings/js/ReadableStreamDefaultController.h:
3196         (WebCore::ReadableStreamDefaultController::error):
3197         * dom/AbortSignal.cpp:
3198         (WebCore::AbortSignal::abort):
3199         (WebCore::AbortSignal::follow):
3200         * dom/AbortSignal.h:
3201
3202 2019-01-04  Brent Fulgham  <bfulgham@apple.com>
3203
3204         Parsed protocol of javascript URLs with embedded newlines and carriage returns do not match parsed protocol in Chrome and Firefox
3205         https://bugs.webkit.org/show_bug.cgi?id=193155
3206         <rdar://problem/40230982>
3207
3208         Reviewed by Chris Dumez.
3209
3210         Test: fast/loader/comment-only-javascript-url.html
3211
3212         Make a special case for URLs beginning with 'javascript:'. We should always
3213         treat these as JS URLs, even if the content contained within the URL
3214         string might match other parts of the URL parsing spec.
3215
3216         * html/URLUtils.h:
3217         (WebCore::URLUtils<T>::protocol const):
3218
3219 2019-01-04  Jer Noble  <jer.noble@apple.com>
3220
3221         [WebKitLegacy] Media playback pauses on scroll
3222         https://bugs.webkit.org/show_bug.cgi?id=192829
3223
3224         Reviewed by Eric Carlson.
3225
3226         New API tests:
3227             WebKitLegacy.ScrollingDoesNotPauseMedia
3228             WKWebView.StopAllMediaPlayback
3229             WKWebView.SuspendResumeAllMediaPlayback
3230
3231         Do not use suspendActiveDOMObjects(ReasonForSuspension::PageWillBeSuspended) to pause
3232         video. Roll back the changes to HTMLMediaElement, and introduce a new set of Page calls
3233         suspendAllMediaPlayback() & resumeAllMediaPlayback() which replaces the removed bahavior.
3234
3235         * dom/Document.cpp:
3236         (WebCore::Document::~Document):
3237         (WebCore::Document::stopAllMediaPlayback):
3238         (WebCore::Document::suspendAllMediaPlayback):
3239         (WebCore::Document::resumeAllMediaPlayback):
3240         * dom/Document.h:
3241         * html/HTMLMediaElement.cpp:
3242         (WebCore::HTMLMediaElement::HTMLMediaElement):
3243         (WebCore::HTMLMediaElement::parseAttribute):
3244         (WebCore::HTMLMediaElement::didFinishInsertingNode):
3245         (WebCore::HTMLMediaElement::setSrcObject):
3246         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
3247         (WebCore::HTMLMediaElement::suspend):
3248         (WebCore::HTMLMediaElement::resume):
3249         (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const):
3250         * html/HTMLMediaElement.h:
3251         (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const): Deleted.
3252         * html/MediaElementSession.cpp:
3253         (WebCore::MediaElementSession::playbackPermitted const):
3254         * page/Page.cpp:
3255         (WebCore::Page::stopAllMediaPlayback):
3256         (WebCore::Page::suspendAllMediaPlayback):
3257         (WebCore::Page::resumeAllMediaPlayback):
3258         * page/Page.h:
3259         (WebCore::Page::mediaPlaybackIsSuspended):
3260         * platform/audio/PlatformMediaSession.h:
3261         * platform/audio/PlatformMediaSessionManager.cpp:
3262         (WebCore::PlatformMediaSessionManager::suspendAllMediaPlaybackForDocument):
3263         (WebCore::PlatformMediaSessionManager::resumeAllMediaPlaybackForDocument):
3264         * platform/audio/PlatformMediaSessionManager.h:
3265
3266 2019-01-04  Chris Dumez  <cdumez@apple.com>
3267
3268         Add support for toggling device orientation API support per site
3269         https://bugs.webkit.org/show_bug.cgi?id=193143
3270         <rdar://problem/46605724>
3271
3272         Reviewed by Alex Christensen.
3273
3274         Add support for toggling device orientation API support per site via _WKWebsitePolicies.
3275
3276         * dom/Document.cpp:
3277         (WebCore::Document::simulateDeviceOrientationChange):
3278         * dom/Document.h:
3279         * loader/DocumentLoader.h:
3280         (WebCore::DocumentLoader::deviceOrientationEventEnabled const):
3281         (WebCore::DocumentLoader::setDeviceOrientationEventEnabled):
3282         * page/DOMWindow.cpp:
3283         (WebCore::DOMWindow::addEventListener):
3284
3285 2019-01-04  Jer Noble  <jer.noble@apple.com>
3286
3287         Web Content process main thread blocked beneath ImageDecoderAVFObjC::readSamples for many seconds on imgur.com
3288         https://bugs.webkit.org/show_bug.cgi?id=191806
3289         <rdar://problem/46151477>
3290
3291         Reviewed by Dean Jackson.
3292
3293         Test: http/tests/images/mp4-partial-load.html
3294
3295         Rather than use an AVAssetReaderTrackOutput, which will load both sample metadata and sample data
3296         synchronously when a sample is requested, use AVAssetReaderSampleReferenceOutput, which only loads
3297         sample metadata, including the byte offset and byte length of the sample data. By waiting until the
3298         AVAsset signals that it's own metadata is loaded, we can safely parse all the sample metadata without
3299         blocking on network loads. Once enough data is loaded, we can replace the byte reference and offset
3300         attachements in the sample with actual data, and mark the sample as "complete".
3301
3302         Because the existing ImageSource assumes that image data parsing will occur synchronously, and that
3303         synchronous parsing could cause a hang if the metadata is not loaded, add a new callback method which
3304         allows the ImageSource to be notified when the encodedDataStatus changes. The ImageSource notifies the
3305         CacheImage, which notifies the RenderImage, and thus the asynchronous parsing will kick off the
3306         renderer's animation loop.
3307
3308         * loader/cache/CachedImage.cpp:
3309         (WebCore::CachedImage::CachedImageObserver::encodedDataStatusChanged):
3310         (WebCore::CachedImage::encodedDataStatusChanged):
3311         * loader/cache/CachedImage.h:
3312         * platform/graphics/ImageDecoder.h:
3313         (WebCore::ImageDecoder::setEncodedDataStatusChangeCallback):
3314         * platform/graphics/ImageObserver.h:
3315         (WebCore::ImageObserver::encodedDataStatusChanged):
3316         * platform/graphics/ImageSource.cpp:
3317         (WebCore::ImageSource::ensureDecoderAvailable):
3318         (WebCore::ImageSource::encodedDataStatusChanged):
3319         (WebCore::ImageSource::frameDecodingStatusAtIndex):
3320         * platform/graphics/ImageSource.h:
3321         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
3322         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
3323         (-[WebCoreSharedBufferResourceLoaderDelegate data]):
3324         (WebCore::ImageDecoderAVFObjCSample::byteRange const):
3325         (WebCore::ImageDecoderAVFObjC::readSamples):
3326         (WebCore::ImageDecoderAVFObjC::setEncodedDataStatusChangeCallback):
3327         (WebCore::ImageDecoderAVFObjC::encodedDataStatus const):
3328         (WebCore::ImageDecoderAVFObjC::frameIsCompleteAtIndex const):
3329         (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex):
3330         (WebCore::ImageDecoderAVFObjC::sampleIsComplete const):
3331
3332 2019-01-04  Youenn Fablet  <youenn@apple.com>
3333
3334         CSP violation reports should bypass CSP checks
3335         https://bugs.webkit.org/show_bug.cgi?id=192857
3336         <rdar://problem/46887236>
3337
3338         Reviewed by Chris Dumez.
3339
3340         For ping loads, pass the option to do CSP checks from PingLoader to LoaderStrategy.
3341         This new option is unused by WebKit Legacy.
3342         It is used by WebKit loader strategy to only send any CSP response header to network process
3343         in case CSP checks should be done.
3344
3345         This option is used to disable CSP checks for Ping Loads that report CSP violations.
3346
3347         Test: http/wpt/fetch/csp-reports-bypass-csp-checks.html
3348
3349         * loader/LoaderStrategy.h:
3350         * loader/PingLoader.cpp:
3351         (WebCore::PingLoader::loadImage):
3352         (WebCore::PingLoader::sendPing):
3353         (WebCore::PingLoader::sendViolationReport):
3354         (WebCore::PingLoader::startPingLoad):
3355         * loader/PingLoader.h:
3356         * loader/cache/CachedResource.cpp:
3357         (WebCore::CachedResource::load):
3358
3359 2019-01-04  Wenson Hsieh  <wenson_hsieh@apple.com>
3360
3361         [Cocoa] Merge WebEditCommandProxy::nameForEditAction and undoNameForEditAction into a single function
3362         https://bugs.webkit.org/show_bug.cgi?id=193129
3363
3364         Reviewed by Tim Horton.
3365
3366         Adds a new helper function that returns the undo/redo name for a given EditAction. No change in behavior.
3367
3368         * Sources.txt:
3369         * WebCore.xcodeproj/project.pbxproj:
3370         * editing/EditAction.cpp: Copied from Source/WebKit/UIProcess/WebEditCommandProxy.cpp.
3371         (WebCore::nameForUndoRedo):
3372         * editing/EditAction.h:
3373         * editing/Editor.cpp:
3374
3375 2019-01-03  Matt Rajca  <mrajca@apple.com>
3376
3377         Make DidPlayMediaPreventedFromPlaying autoplay event more generic.
3378         https://bugs.webkit.org/show_bug.cgi?id=193128
3379         rdar://34554231
3380
3381         Reviewed by Jer Noble.
3382
3383         Today, the "DidPlayMediaPreventedFromPlaying" autoplay event is only sent for
3384         media prevented from autoplaying. It could be generalized to a "DidPlayMediaWithUserGesture"
3385         event along with a flag that indicates whether or not autoplay was actually prevented.
3386         Moreover, we can include a flag that indicates whether the media element in question
3387         is main content. Clients will then know in more cases when media was played with a user
3388         gesture, whether or not it has audio, as well as its main content status. While the main
3389         content heuristics may not be perfect, they covered the top 20 video-centric websites that
3390         this was tested with and are meant to be used by clients for data evaluation purposes.
3391
3392         As part of this, the PlaybackWithoutUserGesture enum was renamed to AutoplayEventPlaybackState
3393         since it now also applies to cases where there is a user gesture. The
3394         `m_playbackWithoutUserGestureStartedTime` member variable was also removed in favor of
3395         `playbackStartedTime` which also covers all the cases we care about.
3396
3397         Tests: existing API tests were updated to reflect the new names. New API tests
3398         were added for the new case in which the "DidPlayMediaWithUserGesture" event is sent.
3399
3400         * html/HTMLMediaElement.cpp:
3401         (WebCore::convertEnumerationToString): Update to new enum cases.
3402         (WebCore::HTMLMediaElement::setReadyState): Ditto.
3403         (WebCore::HTMLMediaElement::play): Ditto.
3404         (WebCore::HTMLMediaElement::playInternal): Also cover the case where
3405          playback was not prevented but there was a user gesture.
3406         (WebCore::HTMLMediaElement::pauseInternal): Use new name.
3407         (WebCore::HTMLMediaElement::setVolume): Use new name.
3408         (WebCore::HTMLMediaElement::playbackProgressTimerFired): Dispatch the
3409          DidPlayMediaWithUserGesture event when playback was started with a user
3410          gesture as well.
3411         (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack): Use new name.
3412         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged): Ditto.
3413         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): Ditto.
3414         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto.
3415         (WebCore::HTMLMediaElement::handleAutoplayEvent): Pass along new media state.
3416         (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay): Use new name.
3417         (WebCore::HTMLMediaElement::setAutoplayEventPlaybackState): Stop setting
3418          m_playbackWithoutUserGestureStartedTime in favor of using playbackStartedTime.
3419         (WebCore::HTMLMediaElement::updateShouldPlay): Use new name.
3420         (WebCore::HTMLMediaElement::setPlaybackWithoutUserGesture): Renamed.
3421         * html/HTMLMediaElement.h:
3422         (WTF::LogArgument<WebCore::HTMLMediaElement::AutoplayEventPlaybackState>::toString): Renamed from...
3423         (WTF::LogArgument<WebCore::HTMLMediaElement::PlaybackWithoutUserGesture>::toString):
3424         * html/MediaElementSession.cpp:
3425         (WebCore::MediaElementSession::isMainContentForPurposesOfAutoplayEvents const): Don't
3426          do the hit testing check for the purposes of autoplay events. It seems to fail on the
3427          basic Vimeo player due to overlapping divs.
3428         (WebCore::isElementMainContentForPurposesOfAutoplay):
3429         (WebCore::MediaElementSession::updateIsMainContent const): Keep the existing behavior
3430          here of hit testing.
3431         (WebCore::isMainContentForPurposesOfAutoplay): Renamed.
3432         * html/MediaElementSession.h:
3433         * page/AutoplayEvent.h:
3434
3435 2019-01-04  Youenn Fablet  <youenn@apple.com>
3436
3437         Crash in WebCore::ServiceWorkerGlobalScope
3438         https://bugs.webkit.org/show_bug.cgi?id=192513
3439         <rdar://problem/46563880>
3440
3441         Reviewed by Alex Christensen.
3442
3443         Store the identifier in its own variable to make sure we do not use workerThread after being moved.
3444
3445         * workers/service/ServiceWorkerGlobalScope.cpp:
3446         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
3447
3448 2019-01-04  Chris Fleizach  <cfleizach@apple.com>
3449
3450         AX: String check: "Rule" does not reflect the meaning of the <hr> html tag
3451         https://bugs.webkit.org/show_bug.cgi?id=193041
3452         <rdar://problem/46954090>
3453
3454         Reviewed by Zalan Bujtas.
3455
3456         * en.lproj/Localizable.strings:
3457         * platform/cocoa/LocalizedStringsCocoa.mm:
3458         (WebCore::AXHorizontalRuleDescriptionText):
3459
3460 2019-01-04  Zalan Bujtas  <zalan@apple.com>
3461
3462         [LFC] ComputedHorizontalMargin should have optional members
3463         https://bugs.webkit.org/show_bug.cgi?id=193131
3464
3465         Reviewed by Antti Koivisto.
3466
3467         Split HorizontalMargin into UsedHorizontalMargin and ComputedHorizontalMargin. ComputedHorizontalMargin's members are optional.
3468         (see computed vs used values)
3469
3470         * layout/FormattingContext.h:
3471         * layout/FormattingContextGeometry.cpp:
3472         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
3473         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
3474         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
3475         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
3476         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
3477         (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin):
3478         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue): Deleted.
3479         * layout/LayoutUnits.h:
3480         * layout/MarginTypes.h:
3481         * layout/Verification.cpp:
3482         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
3483         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3484         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
3485         * layout/displaytree/DisplayBox.h:
3486         (WebCore::Display::Box::setHorizontalMargin):
3487         (WebCore::Display::Box::setHorizontalComputedMargin):
3488         (WebCore::Display::Box::computedMarginStart const):
3489         (WebCore::Display::Box::computedMarginEnd const):
3490         * layout/floats/FloatAvoider.h:
3491         (WebCore::Layout::FloatAvoider::marginStart const):
3492         (WebCore::Layout::FloatAvoider::marginEnd const):
3493         * layout/inlineformatting/InlineFormattingContext.cpp:
3494         (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
3495         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
3496         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
3497
3498 2019-01-04  Zalan Bujtas  <zalan@apple.com>
3499
3500         [LFC][BFC] Use computedValue and usedValue consistently
3501         https://bugs.webkit.org/show_bug.cgi?id=193059
3502
3503         Reviewed by Antti Koivisto.
3504
3505         https://www.w3.org/TR/CSS22/cascade.html#value-stages
3506
3507         6.1.2 Computed values
3508         Specified values are resolved to computed values during the cascade; for example URIs are made absolute and 'em' and 'ex' units
3509         are computed to pixel or absolute lengths. Computing a value never requires the user agent to render the document...
3510
3511         6.1.3 Used values
3512         Computed values are processed as far as possible without formatting the document. Some values, however, can only be determined when the document
3513         is being laid out. For example, if the width of an element is set to be a certain percentage of its containing block, the width cannot be determined
3514         until the width of the containing block has been determined. The used value is the result of taking the computed value and resolving any remaining
3515         dependencies into an absolute value.
3516
3517         * layout/FormattingContext.cpp:
3518         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
3519         * layout/FormattingContextGeometry.cpp:
3520         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
3521         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
3522         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
3523         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
3524         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
3525         * layout/LayoutState.cpp:
3526         (WebCore::Layout::LayoutState::LayoutState):
3527         * layout/LayoutUnits.h:
3528         * layout/Verification.cpp:
3529         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
3530         * layout/blockformatting/BlockFormattingContext.cpp:
3531         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
3532         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3533         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
3534         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
3535         * layout/displaytree/DisplayBox.cpp:
3536         (WebCore::Display::Box::Box):
3537         * layout/displaytree/DisplayBox.h:
3538         (WebCore::Display::Box::setHasValidHorizontalComputedMargin):
3539         (WebCore::Display::Box::setHorizontalComputedMargin):
3540         (WebCore::Display::Box::computedMarginStart const):
3541         (WebCore::Display::Box::computedMarginEnd const):
3542         (WebCore::Display::Box::setHasValidHorizontalNonComputedMargin): Deleted.
3543         (WebCore::Display::Box::setHorizontalNonComputedMargin): Deleted.
3544         (WebCore::Display::Box::nonComputedMarginStart const): Deleted.
3545         (WebCore::Display::Box::nonComputedMarginEnd const): Deleted.
3546         * layout/floats/FloatAvoider.h:
3547         (WebCore::Layout::FloatAvoider::marginStart const):
3548         (WebCore::Layout::FloatAvoider::marginEnd const):
3549         * layout/inlineformatting/InlineFormattingContext.cpp:
3550         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
3551
3552 2019-01-03  Zalan Bujtas  <zalan@apple.com>
3553
3554         REGRESSION: -webkit-appearance test case crashes
3555         https://bugs.webkit.org/show_bug.cgi?id=189302
3556         <rdar://problem/44143049>
3557
3558         Reviewed by Wenson Hsieh.
3559
3560         The painting and the layout positions of the cancel button need to match in order to be able to interact with it.
3561         This patch removes the previous position inlining attempts.
3562
3563         Test: fast/forms/webkit-appearance-searchfield-cancel-button-crash.html
3564
3565         * rendering/RenderThemeMac.mm:
3566         (WebCore::RenderThemeMac::paintSearchFieldCancelButton):
3567
3568 2019-01-03  David Kilzer  <ddkilzer@apple.com>
3569
3570         Leak of WebCore::LibWebRTCCertificateGenerator::RTCCertificateGeneratorCallback (48 bytes) in com.apple.WebKit.WebContent running WebKit layout tests
3571         <https://webkit.org/b/193122>
3572         <rdar://problem/47022987>
3573
3574         Reviewed by Youenn Fablet.
3575
3576         * Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp:
3577         (WebCore::LibWebRTCCertificateGenerator::RTCCertificateGeneratorCallback::AddRef const):
3578         (WebCore::LibWebRTCCertificateGenerator::RTCCertificateGeneratorCallback::Release const):
3579         - Remove `final` keyword so that
3580           `new rtc::RefCountedObject<RTCCertificateGeneratorCallback>()`
3581           can be called.
3582         (WebCore::LibWebRTCCertificateGenerator::generateCertificate):
3583         - To fix the leak call
3584           `new rtc::RefCountedObject<RTCCertificateGeneratorCallback>()`
3585           to create the object.
3586
3587 2019-01-03  Simon Fraser  <simon.fraser@apple.com>
3588
3589         REGRESSION (r238090): After showing the Find banner or tab bar, hit tests are vertically offset (or painting is not offset)
3590         https://bugs.webkit.org/show_bug.cgi?id=193124
3591         rdar://problem/46755409
3592
3593         Reviewed by Tim Horton.
3594
3595         Top content inset feeds into scrolling tree geometry, so when it changes we need to trigger
3596         an update of the root scrolling node, which happens via RenderLayerBacking::updateGeometry().
3597         So set a dirty bit on the root layer in frameViewDidChangeSize(), which is called from the code
3598         path that runs when top content inset changes.
3599
3600         Find banner behavior is not easily testable. platform/mac/fast/events/content-inset-hit-testing.html did not detect the regression.
3601
3602         * rendering/RenderLayerCompositor.cpp:
3603         (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
3604
3605 2019-01-03  Chris Dumez  <cdumez@apple.com>
3606
3607         Potential infinite recursion in isFrameFamiliarWith(Frame&, Frame&)
3608         https://bugs.webkit.org/show_bug.cgi?id=192997
3609         <rdar://problem/46217271>
3610
3611         Reviewed by Antti Koivisto.
3612
3613         isFrameFamiliarWith(Frame&, Frame&) was called recursively using the passed frames' openers.
3614         The issue is that a Frame can be its opener. There could also be a cycle in the opener chain.
3615
3616         To address the issue, simplify isFrameFamiliarWith() so that it is no longer recursive. We now
3617         only check if the frames belong to the same pages or if their openers do. We no longer check
3618         openers' opener and up.
3619
3620         Note that this function is used to check if a frame is allowed to target another. In practice,
3621         it is unlikely to be useful to navigate an opener's opener and an openee's openee.
3622
3623         Tests: fast/dom/Window/window-open-opener-cycle.html
3624                fast/dom/Window/window-open-self-as-opener.html
3625
3626         * page/FrameTree.cpp:
3627         (WebCore::isFrameFamiliarWith):
3628
3629 2019-01-02  Simon Fraser  <simon.fraser@apple.com>
3630
3631         REGRESSION (r239306): Don't disable font smoothing in transparent layers on macOS Mojave and later
3632         https://bugs.webkit.org/show_bug.cgi?id=193095
3633         <rdar://problem/47014944>
3634
3635         Reviewed by Zalan Bujtas.
3636         
3637         In r239306 we stopped making CALayers for font-smoothed text when not necessary on macOS Mojave
3638         and later. However, we still turned off smoothing for non-opaque layers (setShouldSmoothFonts(false)),
3639         which continues to affect the appearance of text.
3640         
3641         Fix by only calling setShouldSmoothFonts(false) when the OS supports font smoothing.
3642
3643         Test: compositing/contents-format/subpixel-antialiased-text.html
3644
3645         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
3646         (WebCore::PlatformCALayer::drawLayerContents):
3647
3648 2019-01-02  David Kilzer  <ddkilzer@apple.com>
3649
3650         Leak of CMSampleBuffer (752 bytes) in com.apple.WebKit.WebContent running WebKit layout tests
3651         <https://webkit.org/b/193016>
3652         <rdar://problem/46925703>
3653
3654         Reviewed by Simon Fraser.
3655
3656         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
3657         (WebCore::copySampleBufferWithCurrentTimeStamp):
3658         - Change to return RetainPtr<CMSampleBufferRef>.
3659         - Check return value of CMSampleBufferCreateCopyWithNewTiming().
3660         (WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer):
3661         - Check return value of copySampleBufferWithCurrentTimeStamp().
3662         - Fix leak by using RetainPtr<CMSampleBufferRef> returned from
3663           copySampleBufferWithCurrentTimeStamp() instead of leaking
3664           `bufferWithCurrentTime` by using retainPtr().
3665         (WebCore::createAudioFormatDescription):
3666         - Extract method from appendAudioSampleBuffer() to return
3667           RetainPtr<CMFormatDescriptionRef> after calling
3668           CMAudioFormatDescriptionCreate().
3669         - Check return value of CMAudioFormatDescriptionCreate().
3670         (WebCore::createAudioSampleBufferWithPacketDescriptions):
3671         - Extract method from appendAudioSampleBuffer() to return
3672           RetainPtr<CMSampleBufferRef> after calling
3673           CMAudioSampleBufferCreateWithPacketDescriptions().
3674         (WebCore::MediaRecorderPrivateWriter::appendAudioSampleBuffer):
3675         - Check return values of createAudioFormatDescription() and
3676           createAudioSampleBufferWithPacketDescriptions().
3677         - Fix leaks by extracting code into helper methods that return
3678           RetainPtr<> objects instead of leaking CMFormatDescriptionRef
3679           directly or leaking `sampleBuffer` by using retainPtr().
3680
3681 2019-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
3682
3683         Add support for using the current text selection as the find string on iOS
3684         https://bugs.webkit.org/show_bug.cgi?id=193034
3685         <rdar://problem/45138739>
3686
3687         Reviewed by Tim Horton.
3688
3689         Add support for "TakeFindStringFromSelection" on iOS. Unlike macOS, iOS does not have a notion of a "find
3690         pasteboard" like macOS; instead, we handle this editing command by sending the selection string to the UI
3691         process, where it is exposed via WebKit SPI so that clients that present find-in-page UI (i.e. MobileSafari) are
3692         able to trigger find-in-page with this string.
3693
3694         Test: WebKit.UseSelectionAsFindString
3695
3696         * editing/Editor.cpp:
3697         (WebCore::Editor::canCopyExcludingStandaloneImages const):
3698
3699         Make this helper function cross-platform.
3700
3701         * editing/Editor.h:
3702         * editing/EditorCommand.cpp:
3703         (WebCore::createCommandMap):
3704         * editing/cocoa/EditorCocoa.mm:
3705         (WebCore::Editor::takeFindStringFromSelection):
3706
3707         Move this from EditorMac to EditorCocoa, and implement it on iOS by calling into the editor client to update the
3708         find string (see WebKit/ChangeLog for more details).
3709
3710         * editing/mac/EditorMac.mm:
3711         (WebCore::Editor::canCopyExcludingStandaloneImages): Deleted.
3712         (WebCore::Editor::takeFindStringFromSelection): Deleted.
3713         * loader/EmptyClients.cpp:
3714         * page/EditorClient.h:
3715
3716         Add a new editor client method to send the string for find-in-page to the UI process.
3717
3718 2019-01-02  Devin Rousso  <webkit@devinrousso.com>
3719
3720         Web Inspector: Implement `queryObjects` Command Line API
3721         https://bugs.webkit.org/show_bug.cgi?id=176766
3722         <rdar://problem/34890689>
3723
3724         Reviewed by Joseph Pecoraro.
3725
3726         Test: inspector/console/queryObjects.html
3727
3728         * inspector/CommandLineAPIModuleSource.js:
3729         (CommandLineAPI):
3730         (CommandLineAPIImpl.prototype.queryObjects): Added.
3731
3732 2019-01-02  Charles Vazac  <cvazac@gmail.com>
3733
3734         Fix resourcetimingbufferfull bubbles attribute
3735         https://bugs.webkit.org/show_bug.cgi?id=193087
3736
3737         Reviewed by Chris Dumez.
3738
3739         This change is covered by web-platform-tests [1].
3740
3741         [1] https://github.com/web-platform-tests/wpt/blob/master/resource-timing/buffer-full-when-populate-entries.html#L20
3742
3743         * page/Performance.cpp:
3744         (WebCore::Performance::resourceTimingBufferFullTimerFired):
3745
3746 2019-01-02  Simon Fraser  <simon.fraser@apple.com>
3747
3748         Rename LayerScrollCoordinationRole to ScrollCoordinationRole and make an enum class
3749         https://bugs.webkit.org/show_bug.cgi?id=193010
3750
3751         Reviewed by Zalan Bujtas.
3752
3753         Move the enum LayerScrollCoordinationRole from RenderLayer.h to RenderLayerCompositor.h,
3754         and make it an enum class.
3755
3756         * page/FrameView.cpp:
3757         (WebCore::FrameView::scrollLayerID const):
3758         * rendering/RenderLayer.h:
3759         * rendering/RenderLayerBacking.cpp:
3760         (WebCore::RenderLayerBacking::~RenderLayerBacking):
3761         (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
3762         (WebCore::operator<<):
3763         * rendering/RenderLayerBacking.h:
3764         * rendering/RenderLayerCompositor.cpp:
3765         (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
3766         (WebCore::RenderLayerCompositor::removeFromScrollCoordinatedLayers):
3767         (WebCore::scrollCoordinationRoleForNodeType):
3768         (WebCore::RenderLayerCompositor::attachScrollingNode):
3769         (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer):
3770         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
3771         (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):
3772         * rendering/RenderLayerCompositor.h:
3773
3774 2019-01-02  Simon Fraser  <simon.fraser@apple.com>
3775
3776         Don't spin up a CalcParser if the current token is not a function token
3777         https://bugs.webkit.org/show_bug.cgi?id=193067
3778
3779         Reviewed by Zalan Bujtas.
3780
3781         Various functions in CSSPropertyParserHelpers fall back to trying to parse
3782         a calc expression if the normal parsing fails. Don't do this unless the
3783         current token is a function token, which should be slightly more efficient.
3784
3785         * css/parser/CSSPropertyParserHelpers.cpp:
3786         (WebCore::CSSPropertyParserHelpers::consumeInteger):
3787         (WebCore::CSSPropertyParserHelpers::consumePositiveIntegerRaw):
3788         (WebCore::CSSPropertyParserHelpers::consumeNumberRaw):
3789         (WebCore::CSSPropertyParserHelpers::consumeNumber):
3790         (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
3791         (WebCore::CSSPropertyParserHelpers::consumeLength):
3792         (WebCore::CSSPropertyParserHelpers::consumePercent):
3793         (WebCore::CSSPropertyParserHelpers::consumeLengthOrPercent):
3794         (WebCore::CSSPropertyParserHelpers::consumeAngle):
3795         (WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
3796         (WebCore::CSSPropertyParserHelpers::consumeTime):
3797
3798 2019-01-02  Simon Fraser  <simon.fraser@apple.com>
3799
3800         Support css-color-4 rgb functions
3801         https://bugs.webkit.org/show_bug.cgi?id=192321
3802
3803         Reviewed by Zalan Bujtas.
3804         
3805         Support the new rgb()/rgba() syntax described in https://drafts.csswg.org/css-color/#rgb-functions.
3806         The differences are:
3807         1. There is a new comma-free syntax, where the optional alpha is separated by a slash:
3808             rgb(128 34 56)
3809             rgb(128 34 56 / 50%)
3810         2. Floating point values are allowed, and rounded:
3811             rgb(128.5 34.2 56.5) becomes rgb(129 34 57)
3812         3. rgba() is a pure alias for rgb(), so these are equivalent:
3813             rgb(128 34 56 / 50%)
3814             rgba(128 34 56 / 50%)
3815             
3816         hsl()/hsla() parsing was already updated to this new syntax in r230861.
3817
3818         Tested by tests in imported/w3c/web-platform-tests/css/css-color/
3819
3820         * css/parser/CSSPropertyParserHelpers.cpp:
3821         (WebCore::CSSPropertyParserHelpers::clampRGBComponent):
3822         (WebCore::CSSPropertyParserHelpers::parseRGBParameters):
3823         (WebCore::CSSPropertyParserHelpers::parseColorFunction):
3824
3825 2019-01-02  Simon Fraser  <simon.fraser@apple.com>
3826
3827         Handle calc() expressions in gradient color stops
3828         https://bugs.webkit.org/show_bug.cgi?id=193066
3829         rdar://problem/46961985
3830
3831         Reviewed by Sam Weinig.
3832         
3833         Fix two issues that prevented calc() expressions from working in conic-gradient color stops,
3834         for the angle or percent value. First, consumeAngleOrPercent() needs to look for CalculationCategory::Percent
3835         calc values as well as angle ones.
3836
3837         Second, CSSPrimitiveValue::isAngle() needs to use primitiveType() (which takes calc into account),
3838         just as isPx() etc do.
3839
3840         Test: fast/gradients/conic-calc-stop-position.html
3841
3842         * css/CSSPrimitiveValue.h:
3843         (WebCore::CSSPrimitiveValue::isAngle const):
3844         * css/parser/CSSPropertyParserHelpers.cpp:
3845         (WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
3846         (WebCore::CSSPropertyParserHelpers::consumeGradientColorStops):
3847
3848 2018-12-31  Keith Miller  <keith_miller@apple.com>
3849
3850         SourceProviders should use an actual URL instead of a string
3851         https://bugs.webkit.org/show_bug.cgi?id=192734
3852
3853         Reviewed by Yusuke Suzuki.
3854
3855         Remove ScriptSourceCode's URL member and make the url() method
3856         reference the URL on the SourceProvider. Also, avoid some
3857         ref count churn.
3858
3859         Additionally, this patch fixes an existing bug in
3860         WorkletGlobalScope() that would use a ScriptSourceCode after
3861         WTFMoving it.
3862
3863         * bindings/js/CachedScriptSourceProvider.h:
3864         (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
3865         * bindings/js/ScheduledAction.cpp:
3866         (WebCore::ScheduledAction::execute):
3867         * bindings/js/ScriptController.cpp:
3868         (WebCore::ScriptController::executeScriptInWorld):