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