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