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