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