Unreviewed, address post-landing review comments for r248431.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-08-08  Chris Dumez  <cdumez@apple.com>
2
3         Unreviewed, address post-landing review comments for r248431.
4
5         * Modules/indexeddb/IDBRequest.h:
6
7 2019-08-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
8
9         [iOS] Position image information should respect the image orientation
10         https://bugs.webkit.org/show_bug.cgi?id=200487
11
12         Reviewed by Simon Fraser.
13
14         Re-factor CachedImage::imageSizeForRenderer() into another overriding
15         function which does not scale the imageSize. Therefore the new function
16         returns FloatSize while the original function returns LayoutSize.
17
18         * loader/cache/CachedImage.cpp:
19         (WebCore::CachedImage::imageSizeForRenderer const):
20         * loader/cache/CachedImage.h:
21         * rendering/RenderElement.h:
22
23 2019-08-08  Devin Rousso  <drousso@apple.com>
24
25         Web Inspector: rename `queryObjects` to `queryInstances` for clarity
26         https://bugs.webkit.org/show_bug.cgi?id=200520
27
28         Reviewed by Brian Burg.
29
30         Test: inspector/console/queryInstances.html
31
32         * inspector/CommandLineAPIModuleSource.js:
33         (CommandLineAPIImpl.prototype.queryInstances): Added.
34         (CommandLineAPIImpl.prototype.queryObjects):
35
36 2019-08-08  Chris Dumez  <cdumez@apple.com>
37
38         Fix thread safety bug in AudioSourceProviderAVFObjC::prepare()
39         https://bugs.webkit.org/show_bug.cgi?id=200542
40
41         Reviewed by Jer Noble.
42
43         Fix thread safety bug in AudioSourceProviderAVFObjC::prepare(). It calls callOnMainThread()
44         from a background thread and captures makeRef(*this) in the lambda, even though |this| is a
45         AudioSourceProviderAVFObjC, which subclasses RefCounted, not ThreadSafeRefCounted.
46
47         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
48
49 2019-08-08  Chris Dumez  <cdumez@apple.com>
50
51         Make IDBRequest ThreadSafeRefCounted
52         https://bugs.webkit.org/show_bug.cgi?id=200540
53
54         Reviewed by Alex Christensen.
55
56         Make IDBRequest ThreadSafeRefCounted, as it looks like it is being ref'd / deref'd
57         from several threads, in IDBConnectionProxy::notifyOpenDBRequestBlocked() for
58         example.
59
60         * Modules/indexeddb/IDBRequest.h:
61
62 2019-08-08  Brady Eidson  <beidson@apple.com>
63
64         Do not allow navigations of frames about to get replaced by the result of evaluating javascript: URLs
65         <rdar://problem/53788893> and https://bugs.webkit.org/show_bug.cgi?id=198786
66
67         Reviewed by Geoff Garen.
68
69         Covered by API Test
70
71         Add a "willReplaceWithResultOfExecutingJavascriptURL" flag which is respected inside FrameLoader::isNavigationAllowed
72
73         * bindings/js/ScriptController.cpp:
74         (WebCore::ScriptController::executeIfJavaScriptURL):
75         * bindings/js/ScriptController.h:
76         (WebCore::ScriptController::willReplaceWithResultOfExecutingJavascriptURL const):
77
78         * loader/FrameLoader.cpp:
79         (WebCore::FrameLoader::isNavigationAllowed const):
80
81 2019-08-08  Rob Buis  <rbuis@igalia.com>
82
83         Add runtime flag for lazy image loading
84         https://bugs.webkit.org/show_bug.cgi?id=199794
85
86         Reviewed by Darin Adler.
87
88         Add loading attribute and expose it on HTMLImageElement.
89
90         * html/HTMLAttributeNames.in:
91         * html/HTMLImageElement.idl:
92         * page/RuntimeEnabledFeatures.h:
93         (WebCore::RuntimeEnabledFeatures::setLazyImageLoadingEnabled):
94         (WebCore::RuntimeEnabledFeatures::lazyImageLoadingEnabled const):
95
96 2019-08-08  Miguel Gomez  <magomez@igalia.com>
97
98         [GTK][WPE] Remove the reference to WebCore::Animation from TextureMapperAnimation
99         https://bugs.webkit.org/show_bug.cgi?id=200533
100
101         Reviewed by Žan Doberšek.
102
103         Pass the relevant parameters to TextureMapperAnimation instead of creating a new WebCore::Animation
104         inside it.
105
106         * platform/graphics/texmap/TextureMapperAnimation.cpp:
107         (WebCore::timingFunctionForAnimationValue):
108         (WebCore::TextureMapperAnimation::TextureMapperAnimation):
109         (WebCore::TextureMapperAnimation::apply):
110         (WebCore::TextureMapperAnimation::isActive const):
111         * platform/graphics/texmap/TextureMapperAnimation.h:
112         (WebCore::TextureMapperAnimation::keyframes const):
113         (WebCore::TextureMapperAnimation::timingFunction const):
114         (WebCore::TextureMapperAnimation::animation const): Deleted.
115
116 2019-08-08  Charlie Turner  <cturner@igalia.com>
117
118         [GTK] WebKitWebProcess crashes when viewing an HTML with a <video> element referencing unknown file
119         https://bugs.webkit.org/show_bug.cgi?id=200530
120
121         Reviewed by Xabier Rodriguez-Calvar.
122
123         Not amenable to unit testing.
124
125         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
126         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired):
127
128 2019-08-07  Saam Barati  <sbarati@apple.com>
129
130         [WHLSL] Prune unreachable stdlib functions after the Checker runs
131         https://bugs.webkit.org/show_bug.cgi?id=200518
132
133         Reviewed by Robin Morisset.
134
135         We now prune unreachable stdlib functions after the checker runs. We must
136         do this after the checker runs because that's when we resolve all remaining
137         function calls. While we can't prune unreachable user code, because we must
138         still report errors in it, we can prune unreachable standard library code
139         because we know a priori that it has no errors. This is a 10ms end-to-end
140         speedup in compute_boids.
141
142         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
143         (WebCore::WHLSL::prepareShared):
144         * Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.cpp: Added.
145         (WebCore::WHLSL::pruneUnreachableStandardLibraryFunctions):
146         * Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.h: Added.
147         * Sources.txt:
148         * WebCore.xcodeproj/project.pbxproj:
149
150 2019-08-07  Kate Cheney  <katherine_cheney@apple.com>
151
152         Adopt non-deprecated CGColorSpace API
153         https://bugs.webkit.org/show_bug.cgi?id=184358
154
155         Reviewed by Darin Adler.
156
157         * platform/ScreenProperties.h:
158         (WebCore::ScreenData::decode):
159
160         We changed the deprecated CGColorSpaceCreateWithICCProfile function to 
161         CGColorSpaceCreateWithICCData. 
162  
163 2019-08-07  Sam Weinig  <weinig@apple.com>
164
165         [WHLSL] Metal code generation takes a long time uniquing UnnamedTypes
166         https://bugs.webkit.org/show_bug.cgi?id=200512
167
168         Reviewed by Saam Barati.
169
170         Instead of using a trie for unnamed type uniquing, use the same technique used
171         in SynthesizeConstructors and use a HashMap of UnnamedTypeKeys. To make this
172         profitable, we also need to devirtualize the hash and equality functions on
173         UnnamedType, instead using an enum + switch. While this change only devirtualizes
174         the UnnamedType subtree, we should probably do it for the entire AST in a future
175         change.
176
177         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
178         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
179         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
180         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
181         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
182         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.cpp: Added.
183         (WebCore::WHLSL::AST::UnnamedType::hash const):
184         (WebCore::WHLSL::AST::UnnamedType::operator== const):
185          * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
186         Devirtualize hash, operator== and type predicates.
187
188         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedTypeHash.h: Added.
189         (WebCore::WHLSL::UnnamedTypeKey::UnnamedTypeKey):
190         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
191         (WebCore::WHLSL::UnnamedTypeKey::UnnamedTypeKey): Deleted.
192         Moved UnnamedTypeKey into it's own header from WHLSLSynthesizeConstructors.cpp
193         
194         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
195         (WebCore::WHLSL::Metal::BaseTypeNameNode::BaseTypeNameNode):
196         (WebCore::WHLSL::Metal::BaseTypeNameNode::kind):
197         (WebCore::WHLSL::Metal::BaseTypeNameNode::isReferenceTypeNameNode const):
198         (WebCore::WHLSL::Metal::BaseTypeNameNode::isPointerTypeNameNode const):
199         (WebCore::WHLSL::Metal::BaseTypeNameNode::isArrayReferenceTypeNameNode const):
200         (WebCore::WHLSL::Metal::BaseTypeNameNode::isArrayTypeNameNode const):
201         Devirtualize BaseTypeNameNode as well. In a future change, we should consider removing
202         this class entirely and instead mapping directly to a parent/mangled name pair.
203  
204         (WebCore::WHLSL::Metal::TypeNamer::visit):
205         (WebCore::WHLSL::Metal::TypeNamer::find):
206         (WebCore::WHLSL::Metal::TypeNamer::createNameNode):
207         (WebCore::WHLSL::Metal::parent):
208         (WebCore::WHLSL::Metal::TypeNamer::insert):
209         (WebCore::WHLSL::Metal::TypeNamer::emitUnnamedTypeDefinition):
210         (WebCore::WHLSL::Metal::TypeNamer::emitMetalTypeDefinitions):
211         (WebCore::WHLSL::Metal::TypeNamer::mangledNameForType):
212         (WebCore::WHLSL::Metal::findInVector): Deleted.
213         (WebCore::WHLSL::Metal::find): Deleted.
214         (WebCore::WHLSL::Metal::TypeNamer::emitAllUnnamedTypeDefinitions): Deleted.
215         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.h:
216         Switch from a Vector based trie to a HashMap for UnnamedType uniquing. Also
217         use UnnamedType::Kind where possible with switch statements to clarify code.
218
219         * WebCore.xcodeproj/project.pbxproj:
220         Add new files.
221
222 2019-08-07  Devin Rousso  <drousso@apple.com>
223
224         Web Inspector: Uncaught Exception: TimelineAgent already enabled
225         https://bugs.webkit.org/show_bug.cgi?id=200513
226
227         Reviewed by Joseph Pecoraro.
228
229         Call `disable` when the last frontend disconnects, so that if Web Inspector is reopened the
230         `TimelineAgent` is back to being in a disabled state.
231
232         * inspector/agents/InspectorTimelineAgent.cpp:
233         (WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend):
234
235 2019-08-07  Jer Noble  <jer.noble@apple.com>
236
237         Muted <video> elements can block display from sleeping.
238         https://bugs.webkit.org/show_bug.cgi?id=200511
239
240         Reviewed by Eric Carlson.
241
242         Test: media/video-muted-holds-sleep-assertion.html
243
244         Modify the shouldDisableSleep() method to take muting into account.
245
246         * html/HTMLMediaElement.cpp:
247         (WebCore::HTMLMediaElement::shouldDisableSleep const):
248
249 2019-08-07  Robin Morisset  <rmorisset@apple.com>
250
251         [WHLSL] Simplify and eliminate redundant work in WHLSLFunctionWriter.cpp
252         https://bugs.webkit.org/show_bug.cgi?id=200460
253
254         Reviewed by Myles Maxfield.
255
256         2 trivial simplifications:
257         - Replace FunctionDeclarationWriter by a standalone function, there was no reason to make it a subclass of Visitor
258         - Avoid an exponential blow-up in the computation of reachable functions.
259
260         I have way too much noise on my system (swings back and forth between 7 and 12ms for this phase) to measure a performance win,
261         but since this patch simplifies things without adding complexity I think it is worth it.
262
263         No new test as there is no functional change intended.
264
265         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
266         (WebCore::WHLSL::Metal::declareFunction):
267         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
268         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::RenderFunctionDefinitionWriter):
269         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::ComputeFunctionDefinitionWriter):
270         (WebCore::WHLSL::Metal::sharedMetalFunctions):
271         (WebCore::WHLSL::Metal::metalFunctions):
272
273 2019-08-07  Saam Barati  <sbarati@apple.com>
274
275         [WHLSL] checkRecursion, checkTextureReferences, and EscapedVariableCollector should skip stdlib functions
276         https://bugs.webkit.org/show_bug.cgi?id=200510
277
278         Reviewed by Myles C. Maxfield.
279
280         We can skip walking the stdlib part of the AST in various semantic checking phases:
281         - checkRecursion: the stdlib does not have recursion
282         - checkTextureReferences: the stdlib does not have references to textures
283         - EscapedVariableCollector: this is used inside preserveVariableLifetimes, and
284           the stdlib never escapes any variables.
285         
286         This patch speeds up checkRecursion, checkTextureReferences, and preserveVariableLifetimes
287         by about 1ms each, leading to a 3ms compile time speedup in compute_boids.
288
289         * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp:
290         (WebCore::WHLSL::TextureReferencesChecker::visit):
291         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
292         (WebCore::WHLSL::preserveVariableLifetimes):
293         (WebCore::WHLSL::EscapedVariableCollector::escapeVariableUse): Deleted.
294         (WebCore::WHLSL::EscapedVariableCollector::takeEscapedVariables): Deleted.
295         * Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp:
296
297 2019-08-07  Saam Barati  <sbarati@apple.com>
298
299         [WHLSL] cache results of argumentTypeForAndOverload inside Checker
300         https://bugs.webkit.org/show_bug.cgi?id=200462
301
302         Reviewed by Robin Morisset.
303
304         When I profiled the time we spent in the checker, it turned out that 
305         argumentTypeForAndOverload is one of the most expensive functions. If
306         we just cache the results of that function, we can avoid 99% of the
307         duplicate allocations that function does in compute_boids. This patch
308         is a ~4ms speedup in the checker on compute_boids.
309
310         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp:
311         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
312         (WebCore::WHLSL::AndOverloadTypeKey::AndOverloadTypeKey):
313         (WebCore::WHLSL::AndOverloadTypeKey::isEmptyValue const):
314         (WebCore::WHLSL::AndOverloadTypeKey::isHashTableDeletedValue const):
315         (WebCore::WHLSL::AndOverloadTypeKey::hash const):
316         (WebCore::WHLSL::AndOverloadTypeKey::operator== const):
317         (WebCore::WHLSL::AndOverloadTypeKey::Hash::hash):
318         (WebCore::WHLSL::AndOverloadTypeKey::Hash::equal):
319         (WebCore::WHLSL::AndOverloadTypeKey::Traits::isEmptyValue):
320         (WebCore::WHLSL::Checker::argumentTypeForAndOverload):
321         (WebCore::WHLSL::Checker::finishVisiting):
322         (WebCore::WHLSL::argumentTypeForAndOverload): Deleted.
323
324 2019-08-07  Youenn Fablet  <youenn@apple.com>
325
326         Remove IDBDatabaseIdentifier::m_sessionID
327         https://bugs.webkit.org/show_bug.cgi?id=200489
328
329         Reviewed by Darin Adler.
330
331         IDBDatabaseIdentifier can be created without a valid session ID.
332         Its session ID is only used in NetworkProcess where it can be retrieved from the IDBServer.
333         In WebProcess, session ID is also known from the IDB connection.
334         Update SQLiteIDBBackingStore to store a session ID which is given from its IDBServer.
335         No observable change of behavior.
336
337         * Modules/indexeddb/IDBDatabaseIdentifier.cpp:
338         (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier):
339         (WebCore::IDBDatabaseIdentifier::isolatedCopy const):
340         * Modules/indexeddb/IDBDatabaseIdentifier.h:
341         (WebCore::IDBDatabaseIdentifier::hash const):
342         (WebCore::IDBDatabaseIdentifier::databaseName const):
343         (WebCore::IDBDatabaseIdentifier::encode const):
344         (WebCore::IDBDatabaseIdentifier::decode):
345         (WebCore::IDBDatabaseIdentifier::sessionID const): Deleted.
346         * Modules/indexeddb/IDBFactory.cpp:
347         (WebCore::IDBFactory::openInternal):
348         (WebCore::IDBFactory::deleteDatabase):
349         * Modules/indexeddb/server/IDBServer.cpp:
350         (WebCore::IDBServer::IDBServer::createBackingStore):
351         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
352         (WebCore::IDBServer::SQLiteIDBBackingStore::SQLiteIDBBackingStore):
353         (WebCore::IDBServer::SQLiteIDBBackingStore::getBlobRecordsForObjectStoreRecord):
354         (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord):
355         (WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords):
356         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey):
357         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
358         (WebCore::IDBServer::SQLiteIDBBackingStore::sessionID const):
359         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
360         (WebCore::IDBServer::SQLiteIDBCursor::internalFetchNextRecord):
361
362 2019-08-07  Chris Dumez  <cdumez@apple.com>
363
364         Fix thread safety issue under JSHistory::visitAdditionalChildren()
365         https://bugs.webkit.org/show_bug.cgi?id=200504
366
367         Reviewed by Darin Adler.
368
369         JSHistory::visitAdditionalChildren() is called from a GC thread and was calling
370         History::cachedState() whose implementation goes deep into WebCore
371         (FrameLoader / HistoryController). Among other things, it null checks m_window
372         which is a WeakPtr and then later dereferences it to get the Frame object, which
373         is not safe from the non-main thread.
374
375         To address the issue, introduce a simpler cachedStateForGC() getter which is
376         thread safe, and use it in JSHistory::visitAdditionalChildren().
377
378         * bindings/js/JSHistoryCustom.cpp:
379         (WebCore::JSHistory::visitAdditionalChildren):
380         * page/History.h:
381
382 2019-08-07  Priyanka Agarwal  <pagarwal999@apple.com>
383
384         Allow clients to toggle a text input field between being viewable and having characters hidden while maintaining 
385         a yellow auto-filled appearance
386         https://bugs.webkit.org/show_bug.cgi?id=200037
387         rdar://problem/51900961
388
389         Reviewed by Daniel Bates.
390
391         Tests: fast/forms/auto-fill-button/hide-auto-fill-strong-password-viewable-treatment-when-form-is-reset.html
392                fast/forms/auto-fill-button/input-strong-password-viewable.html
393
394         * css/CSSSelector.cpp:
395         (WebCore::CSSSelector::selectorText const):
396         Adding CSSSelector case for new pseudo class of AutofillStrongPasswordViewable.
397
398         * css/CSSSelector.h: Added PseudoClassAutofillStrongPasswordViewable
399
400         * css/SelectorChecker.cpp:
401         (WebCore::SelectorChecker::checkOne const): Added handling for SelectorChecker.cpp
402
403         * css/SelectorCheckerTestFunctions.h:
404         (WebCore::isAutofilledStrongPasswordViewable):
405         Checking if the element is an input element and considered to be
406         AutoFilled and Viewable. Returns a boolean accordingly.
407
408         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
409         Add -webkit-autofill-strong-password-viewable css class.
410
411         * css/html.css:
412         (input:-webkit-autofill, input:-webkit-autofill-strong-password, input:-webkit-autofill-strong-password-viewable):
413         (input:-webkit-autofill-strong-password-viewable):
414         (input:-webkit-autofill, input:-webkit-autofill-strong-password): Deleted. Updated to include viewable pseudo class.
415
416         * cssjit/SelectorCompiler.cpp:
417         (WebCore::SelectorCompiler::addPseudoClassType):
418         Add case handling for PseudoClassAutofillStrongPasswordViewable.
419
420         * html/HTMLInputElement.cpp:
421         (WebCore::HTMLInputElement::HTMLInputElement):
422         Add boolean m_isAutoFilledAndViewable for representing if the
423         input element is both AutoFilled and should be viewable.
424         Don't update the viewable treatment in setValueFromRenderer() because even if the user makes edits to the input field
425         the visual treatment should still be applied.
426
427         (WebCore::HTMLInputElement::resignStrongPasswordAppearance):
428         Updates boolean representing if input element is autofilled and viewable to false.
429
430         (WebCore::HTMLInputElement::reset):
431         Updates boolean representing if input element is autofilled and viewable to false.
432
433         (WebCore::HTMLInputElement::setAutoFilledAndViewable):
434         Setter function for the boolean of m_isAutoFilledAndViewable.
435
436         * html/HTMLInputElement.h:
437         (WebCore::HTMLInputElement::isAutoFilledAndViewable const):
438         Creating boolean value for m_isAutoFilledAndViewable.
439
440         * testing/Internals.cpp:
441         (WebCore::Internals::setAutoFilledAndViewable): Adding for testing purposes.
442         * testing/Internals.h: Adding for testing purposes.
443         * testing/Internals.idl:
444
445 2019-08-07  Wenson Hsieh  <wenson_hsieh@apple.com>
446
447         Declarations and implementations of findCaret(Min|Max)imumOffset have inconsistent signatures
448         https://bugs.webkit.org/show_bug.cgi?id=200503
449
450         Reviewed by Darin Adler.
451
452         No change in behavior.
453
454         * rendering/SimpleLineLayoutFunctions.h:
455
456         Update these function declarations to take "const RenderText&", which matches the signatures of their inline
457         implementations below.
458
459 2019-08-07  Wenson Hsieh  <wenson_hsieh@apple.com>
460
461         Extra space inserted at start of line when inserting a newline in Mail compose
462         https://bugs.webkit.org/show_bug.cgi?id=200490
463         <rdar://problem/53501354>
464
465         Reviewed by Antti Koivisto.
466
467         This started happening after r244494, which deferred editor state computation until the next layer tree flush
468         when changing selection. After inserting a paragraph, the act of computing an editor state ensured that the text
469         node containing the caret drops out of simple line layout, while grabbing the characters near the selection
470         (i.e., calling charactersAroundPosition). This meant that when we subsequently ask positionAfterSplit whether it
471         isRenderedCharacter() at the end of the command, we are guaranteed to have line boxes, so we get a meaningful
472         answer and avoid inserting an extra non-breaking space.
473
474         However, after r244494, we defer the editor state computation until the end of the edit command; this means that
475         we may not have line boxes for positionAfterSplit's text node renderer, due to remaining in simple line layout.
476         In turn, this means that we end up hitting the assertion in containsRenderedCharacterOffset in debug builds; on
477         release builds, we simply return false from containsRenderedCharacterOffset, which causes us to insert an extra
478         space.
479
480         To fix this, we educate RenderText::containsRenderedCharacterOffset about simple line layout.
481
482         Test: editing/inserting/insert-paragraph-in-designmode-document.html
483
484         * rendering/RenderText.cpp:
485         (WebCore::RenderText::containsRenderedCharacterOffset const):
486         (WebCore::RenderText::containsCaretOffset const):
487
488         Changed to use SimpleLineLayout::containsOffset.
489
490         * rendering/SimpleLineLayoutFunctions.h:
491         (WebCore::SimpleLineLayout::containsOffset):
492
493         I first contrasted the behavior of RenderTextLineBoxes::containsOffset in the cases where the OffsetType is
494         CaretOffset or CharacterOffset, and found that the only interesting differences were:
495
496         1. The caret offset type case has special handling for line breaks.
497         2. Both offset types have handling for reversed text.
498         3. The end offset of a line box contains a caret offset, but not a character offset.
499
500         For the purposes of OffsetType CharacterOffset, (1) is irrelevant; furthermore, (2) is already not handled by
501         logic in containsCaretOffset(). Thus, the only major difference in the CharacterOffset case should be (3), which
502         we handle by only allowing the case where the given offset is equal to the very end of a text run for caret
503         offsets, and not character offsets.
504
505         (WebCore::SimpleLineLayout::containsCaretOffset): Deleted.
506
507         Renamed to just containsOffset.
508
509 2019-08-07  Youenn Fablet  <youenn@apple.com>
510
511         ASSERT that a sessionID is valid when encoding it
512         https://bugs.webkit.org/show_bug.cgi?id=199302
513
514         Reviewed by Darin Adler.
515
516         For IDBValue, instead of encoding an invalid session ID, encode a boolean that tells there is no sessionID.
517         For IDBRequestData, keep track of whether there is an IDBDatabaseIdentifier
518         and encode/decode accordingly to not encode an invalid sessionID.
519         No observable change of behavior.
520
521         * Modules/indexeddb/IDBValue.h:
522         (WebCore::IDBValue::sessionID const):
523         (WebCore::IDBValue::encode const):
524         (WebCore::IDBValue::decode):
525         * Modules/indexeddb/shared/IDBRequestData.cpp:
526         (WebCore::IDBRequestData::isolatedCopy):
527         * Modules/indexeddb/shared/IDBRequestData.h:
528         (WebCore::IDBRequestData::databaseIdentifier const):
529         (WebCore::IDBRequestData::decode):
530
531 2019-08-07  Zalan Bujtas  <zalan@apple.com>
532
533         [LFC] Rename FormattingContext::layoutOutOfFlowDescendants to layoutOutOfFlowContent
534         https://bugs.webkit.org/show_bug.cgi?id=200502
535         <rdar://problem/54032534>
536
537         Reviewed by Antti Koivisto.
538
539         The layoutOutOfFlowDescendants name is not entirely accurate. In a formatting context we only
540         lay out the out-of-flow boxes that actually belong to the current formatting context.
541
542         <div style="float: left">
543           <div id=outer style="position: absolute">
544             <div id=inner style="position: absolute"></div>
545           </div>
546         </div>
547
548         The float's formatting context only lays out the outer absolutely positioned box. The inner box
549         (which is also an out-of-flow descendant of the float box) is taken care of by the outer box.
550
551         * layout/FormattingContext.cpp:
552         (WebCore::Layout::FormattingContext::layoutOutOfFlowContent const):
553         (WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const):
554         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): Deleted.
555         * layout/FormattingContext.h:
556         * layout/LayoutState.cpp:
557         (WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
558         * layout/blockformatting/BlockFormattingContext.cpp:
559         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
560         * layout/inlineformatting/InlineFormattingContext.cpp:
561         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
562
563 2019-08-07  Zalan Bujtas  <zalan@apple.com>
564
565         [LFC] Introduce Layout::Phase class
566         https://bugs.webkit.org/show_bug.cgi?id=200473
567         <rdar://problem/53996061>
568
569         Reviewed by Antti Koivisto.
570
571         It helps to check whether we could run certain actions like layout while constructing the tree.
572
573         * Sources.txt:
574         * WebCore.xcodeproj/project.pbxproj:
575         * layout/LayoutState.h:
576         * layout/floats/FloatingContext.cpp:
577         * layout/inlineformatting/InlineLine.cpp:
578         * layout/layouttree/LayoutBox.cpp:
579         (WebCore::Layout::Box::establishesFormattingContext const):
580         (WebCore::Layout::Box::containingBlock const):
581         (WebCore::Layout::Box::formattingContextRoot const):
582         * layout/layouttree/LayoutTreeBuilder.cpp:
583         (WebCore::Layout::TreeBuilder::createLayoutTree):
584
585 2019-08-07  Chris Lord  <clord@igalia.com>
586
587         context-attributes-alpha-depth-stencil-antialias fails on WPE WebKit
588         https://bugs.webkit.org/show_bug.cgi?id=200434
589
590         Reviewed by Žan Doberšek.
591
592         This patch fixes 16-bit surfaces being used for FBOs with no
593         alpha component when using the GLES implementation of GraphicsContext3D.
594
595         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
596         (WebCore::GraphicsContext3D::reshapeFBOs):
597         Use GL_UNSIGNED_BYTE instead of GL_UNSIGNED_SHORT_5_6_5 for surfaces with no alpha.
598
599 2019-08-06  Saam Barati  <sbarati@apple.com>
600
601         [WHLSL] Make resolveFunction in Checker faster
602         https://bugs.webkit.org/show_bug.cgi?id=200287
603
604         Reviewed by Robin Morisset.
605
606         This patch makes compute_boids faster by making function overload
607         resolution faster inside the Checker. It's a ~6ms speedup in the
608         checker. The main idea is to limit the number of overloads we need
609         to look for by using a hash table that describes a function's type
610         instead of just using a hash table keyed by a function's name.
611         
612         The interesting implementation detail here is we must construct entries
613         in the hash table such that they still allow constants to be resolved to
614         various types. This means that the key in the hash table must normalize
615         the vector of types it uses to express a function's identity. The normalization
616         rules are:
617         - int => float
618         - uint => float
619         - T* => float*
620         - T[] => float*
621         
622         The first two rules are because int constants can be matched against
623         the float and uint types. The latter two rules are because the null
624         literal can be matched against any pointer or any array reference
625         (we pick float* arbitrarily). Even though it seems like these
626         normalization rules would drastically broaden the efficacy of the hash
627         table, we still see a 100x reduction in the number of overloads we must
628         resolve inside compute_boids. We go from having to resolve 400,000
629         overloads to just resolving 4,000.
630
631         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
632         (WebCore::WHLSL::FunctionKey::FunctionKey):
633         (WebCore::WHLSL::FunctionKey::isEmptyValue const):
634         (WebCore::WHLSL::FunctionKey::isHashTableDeletedValue const):
635         (WebCore::WHLSL::FunctionKey::hash const):
636         (WebCore::WHLSL::FunctionKey::operator== const):
637         (WebCore::WHLSL::FunctionKey::Hash::hash):
638         (WebCore::WHLSL::FunctionKey::Hash::equal):
639         (WebCore::WHLSL::FunctionKey::Traits::isEmptyValue):
640         (WebCore::WHLSL::Checker::Checker):
641         (WebCore::WHLSL::Checker::wrappedFloatType):
642         (WebCore::WHLSL::Checker::genericPointerType):
643         (WebCore::WHLSL::Checker::normalizedTypeForFunctionKey):
644         (WebCore::WHLSL::Checker::resolveFunction):
645         (WebCore::WHLSL::Checker::finishVisiting):
646         (WebCore::WHLSL::Checker::visit):
647         (WebCore::WHLSL::resolveFunction): Deleted.
648
649 2019-08-06  Loïc Yhuel  <loic.yhuel@softathome.com>
650
651         Fix 32-bit Linux build after r248282
652         https://bugs.webkit.org/show_bug.cgi?id=200491
653
654         Reviewed by Youenn Fablet.
655
656         minInterToneGapMs must be a size_t like interToneGap for std::max call.
657         The other constants are updated for consistency, even if the compiler
658         was able to cast them automatically.
659
660         * Modules/mediastream/RTCDTMFSender.cpp:
661
662 2019-08-06  Commit Queue  <commit-queue@webkit.org>
663
664         Unreviewed, rolling out r248289.
665         https://bugs.webkit.org/show_bug.cgi?id=200488
666
667         Broke internal builds (Requested by drousso on #webkit).
668
669         Reverted changeset:
670
671         "Web Inspector: Styles: show @supports CSS groupings"
672         https://bugs.webkit.org/show_bug.cgi?id=200419
673         https://trac.webkit.org/changeset/248289
674
675 2019-08-06  Chris Dumez  <cdumez@apple.com>
676
677         Fix inefficiency in HTTPHeaderMap::set(CFStringRef, const String&)
678         https://bugs.webkit.org/show_bug.cgi?id=200475
679
680         Reviewed by Darin Adler.
681
682         In the case where CFStringGetCStringPtr() succeeds in returning us a pointer
683         to the CFStringRef underlying characters but it is not a common header, we
684         would fall back to calling HTTPHeaderMap::set(const String&, const String&)
685         which would unecessarily call findHTTPHeaderName() again to try and determine
686         if it is a common header. Avoid this by introducing a new setUncommonHeader()
687         private method and calling this one instead. Also got rid of some code
688         duplication at the same time.
689
690         * platform/network/HTTPHeaderMap.cpp:
691         (WebCore::HTTPHeaderMap::set):
692         (WebCore::HTTPHeaderMap::setUncommonHeader):
693         * platform/network/HTTPHeaderMap.h:
694         * platform/network/HTTPParsers.cpp:
695         (WebCore::parseHTTPHeader):
696         * testing/MockCDMFactory.cpp:
697         (WebCore::MockCDMInstance::setServerCertificate):
698
699 2019-08-06  Saam Barati  <sbarati@apple.com>
700
701         [WHLSL] Remove the auto initialize variables pass
702         https://bugs.webkit.org/show_bug.cgi?id=200472
703
704         Reviewed by Robin Morisset.
705
706         From a separation of concerns perspective, it's a bit nicer to make variables
707         without initializers call their default constructors as a transformation over the AST.
708         This removes the need for the lowering to need to worry about such things. However,
709         changing metal lowering to deal with this is trivial. It means we need to change one
710         line of code in Metal code generation, and we get to remove a ~50 LOC AST pass.
711         Also, in this case, it saves us from the compile time hit of having to run the
712         auto initialize variables phase, which takes ~1.2ms on compute_boids.
713
714         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
715         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
716         * Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp: Removed.
717         * Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.h: Removed.
718         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
719         (WebCore::WHLSL::prepareShared):
720         * Sources.txt:
721         * WebCore.xcodeproj/project.pbxproj:
722
723 2019-08-06  Sam Weinig  <weinig@apple.com>
724
725         WHLSL Metal code generation unnecessarily does string copies by passing partial results as Strings
726         https://bugs.webkit.org/show_bug.cgi?id=200471
727
728         Reviewed by Saam Barati.
729
730         Avoid string copies by passing a single StringBuilder all the way through Metal code
731         generation and only converting to a String when passing the constructed shader to Metal
732         API.
733         
734         Where possible, use StringView in lieu of String for temporary strings being passed to
735         the StringBuilder to avoid the allocation overhead of StringImpl. 
736
737         * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h:
738         (WebCore::WHLSL::AST::toString):
739         Switch to StringView.
740
741         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h:
742         (WebCore::WHLSL::AST::BuiltInSemantic::toString const):
743         Switch to StringView.
744
745         * Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h:
746         (WebCore::WHLSL::AST::toString):
747         Switch to StringView.
748
749         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
750         Remove unnecessary "private:".
751     
752         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h:
753         (WebCore::WHLSL::AST::ResourceSemantic::toString):
754         Switch to StringView.
755
756         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
757         (WebCore::WHLSL::Metal::EntryPointScaffolding::emitResourceHelperTypes):
758         (WebCore::WHLSL::Metal::EntryPointScaffolding::emitResourceSignature):
759         (WebCore::WHLSL::Metal::EntryPointScaffolding::emitBuiltInsSignature):
760         (WebCore::WHLSL::Metal::EntryPointScaffolding::emitMangledInputPath):
761         (WebCore::WHLSL::Metal::EntryPointScaffolding::emitMangledOutputPath):
762         (WebCore::WHLSL::Metal::EntryPointScaffolding::emitUnpackResourcesAndNamedBuiltIns):
763         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitHelperTypes):
764         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitSignature):
765         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitUnpack):
766         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitPack):
767         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitHelperTypes):
768         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitSignature):
769         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitUnpack):
770         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitPack):
771         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::emitHelperTypes):
772         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::emitSignature):
773         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::emitUnpack):
774         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::emitPack):
775         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceHelperTypes): Deleted.
776         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceSignature): Deleted.
777         (WebCore::WHLSL::Metal::EntryPointScaffolding::builtInsSignature): Deleted.
778         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledInputPath): Deleted.
779         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledOutputPath): Deleted.
780         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpackResourcesAndNamedBuiltIns): Deleted.
781         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::helperTypes): Deleted.
782         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::signature): Deleted.
783         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::unpack): Deleted.
784         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::pack): Deleted.
785         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::helperTypes): Deleted.
786         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::signature): Deleted.
787         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::unpack): Deleted.
788         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::pack): Deleted.
789         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::helperTypes): Deleted.
790         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::signature): Deleted.
791         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::unpack): Deleted.
792         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::pack): Deleted.
793         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h:
794         Rather than have scaffolding return strings, pass in StringBuilders everywhere. 
795
796         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
797         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
798         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
799         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitConstantExpressionString):
800         (WebCore::WHLSL::Metal::generateMetalFunctionsMapping):
801         (WebCore::WHLSL::Metal::emitSharedMetalFunctions):
802         (WebCore::WHLSL::Metal::emitMetalFunctions):
803         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::FunctionDeclarationWriter): Deleted.
804         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::toString): Deleted.
805         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::toString): Deleted.
806         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::constantExpressionString): Deleted.
807         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::RenderFunctionDefinitionWriter): Deleted.
808         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::ComputeFunctionDefinitionWriter): Deleted.
809         (WebCore::WHLSL::Metal::sharedMetalFunctions): Deleted.
810         (WebCore::WHLSL::Metal::metalFunctions): Deleted.
811         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.h:
812         Rather than returning Strings from function generation functions, pass in StringBuilders everywhere.
813
814         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp:
815         (WebCore::WHLSL::Metal::metalCodeProlog):
816         (WebCore::WHLSL::Metal::dumpMetalCodeIfNeeded):
817         (WebCore::WHLSL::Metal::generateMetalCode):
818         (WebCore::WHLSL::Metal::generateMetalCodeShared): Deleted.
819         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h:
820         Switch RenderMetalCode and ComputeMetalCode to contain StringBuilders to allow
821         delaying conversion to String to the latest point possible.
822         
823         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
824         (WebCore::WHLSL::Metal::TypeNamer::emitMetalTypeDeclarations):
825         (WebCore::WHLSL::Metal::TypeNamer::emitUnnamedTypeDefinition):
826         (WebCore::WHLSL::Metal::TypeNamer::emitNamedTypeDefinition):
827         (WebCore::WHLSL::Metal::TypeNamer::emitAllUnnamedTypeDefinitions):
828         (WebCore::WHLSL::Metal::TypeNamer::emitMetalTypeDefinitions):
829         (WebCore::WHLSL::Metal::TypeNamer::emitMetalTypes):
830         (WebCore::WHLSL::Metal::MetalTypeDeclarationWriter::MetalTypeDeclarationWriter): Deleted.
831         (WebCore::WHLSL::Metal::MetalTypeDeclarationWriter::toString): Deleted.
832         (WebCore::WHLSL::Metal::MetalTypeDeclarationWriter::visit): Deleted.
833         (WebCore::WHLSL::Metal::TypeNamer::metalTypeDeclarations): Deleted.
834         (WebCore::WHLSL::Metal::TypeNamer::metalTypeDefinitions): Deleted.
835         (WebCore::WHLSL::Metal::TypeNamer::metalTypes): Deleted.
836         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.h:
837         Rather than returning Strings from function generation functions, pass in StringBuilders everywhere.
838
839         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
840         (WebCore::WHLSL::Parser::parseResourceSemantic):
841         Remove use of _str, which allocates a String, and just use a StringView directly.
842
843         * Modules/webgpu/WHLSL/WHLSLPrepare.h:
844         Switch RenderPrepareResult and ComputePrepareResult to contain StringBuilders to allow
845         delaying conversion to String to the latest point possible.
846
847         * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
848         (WebCore::trySetFunctions):
849         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
850         (WebCore::trySetFunctions):
851         Convert StringBuilders to String at the last moment necessary. Adds a FIXME to improve
852         in the future by adding direct conversion from StringBuilder to NSString to avoid another
853         copy.
854
855 2019-08-06  Saam Barati  <sbarati@apple.com>
856
857         [WHLSL] Reduce the number of variables that make it into the global struct by skipping stdlib functions and internal uses of MakePointerExpression/MakeArrayReference
858         https://bugs.webkit.org/show_bug.cgi?id=200463
859
860         Reviewed by Myles C. Maxfield.
861
862         This patch makes it so that we put fewer variables in the global struct.
863         This decreases end-to-end running time in compute_boids by 30% (with p = 0.0001).
864         
865         We achieve this in two ways:
866         1. We track if each function is user code or "standard library" code. We also
867         count native functions as the standard library. We know a priori that the
868         standard library never escapes any variables. So the preserve variable
869         lifetimes phase skips analyzing all standard library functions and also
870         skips passing the global struct to any standard library functions.
871         
872         2. We internally emit MakePointerExpression/MakeArrayReferenceExpression nodes in
873         the compiler in various phases. We sometimes emit these nodes in such a way
874         that we know that this address-of expression does not cause the variable to
875         escape. We now mark each address-of expressions as either:
876         - Conservatively escaping. We conservatively do this for all user code.
877         - Not escaping. This means that this address-of operation definitely does
878         not escape the variable. If a variable never has an escaping use, we will
879         omit putting this variable in the struct.
880
881         * Modules/webgpu/WHLSL/AST/WHLSLAddressEscapeMode.h: Added.
882         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
883         (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration):
884         (WebCore::WHLSL::AST::FunctionDeclaration::parsingMode const):
885         * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h:
886         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression):
887         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::mightEscape const):
888         * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h:
889         (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression):
890         (WebCore::WHLSL::AST::MakePointerExpression::mightEscape const):
891         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
892         (WebCore::WHLSL::resolveWithOperatorAnderIndexer):
893         (WebCore::WHLSL::resolveWithOperatorLength):
894         (WebCore::WHLSL::resolveWithReferenceComparator):
895         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
896         (WebCore::WHLSL::Parser::parse):
897         (WebCore::WHLSL::Parser::parseComputeFunctionDeclaration):
898         (WebCore::WHLSL::Parser::parseVertexOrFragmentFunctionDeclaration):
899         (WebCore::WHLSL::Parser::parseRegularFunctionDeclaration):
900         (WebCore::WHLSL::Parser::parseOperatorFunctionDeclaration):
901         (WebCore::WHLSL::Parser::parsePossiblePrefix):
902         * Modules/webgpu/WHLSL/WHLSLParser.h:
903         * Modules/webgpu/WHLSL/WHLSLParsingMode.h: Added.
904         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
905         (WebCore::WHLSL::prepareShared):
906         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
907         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
908         (WebCore::WHLSL::wrapAnderCallArgument):
909         (WebCore::WHLSL::modify):
910         (WebCore::WHLSL::PropertyResolver::visit):
911         * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp:
912         (WebCore::WHLSL::includeStandardLibrary):
913         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
914         (WebCore::WHLSL::synthesizeArrayOperatorLength):
915         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
916         (WebCore::WHLSL::synthesizeConstructors):
917         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
918         (WebCore::WHLSL::synthesizeEnumerationFunctions):
919         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
920         (WebCore::WHLSL::synthesizeStructureAccessors):
921         * WebCore.xcodeproj/project.pbxproj:
922
923 2019-08-06  Jer Noble  <jer.noble@apple.com>
924
925         Adopt -expectMinimumUpcomingSampleBufferPresentationTime:
926         https://bugs.webkit.org/show_bug.cgi?id=200457
927         <rdar://problem/53961130>
928
929         Reviewed by Eric Carlson.
930
931         Test: media/media-source/media-source-minimumupcomingpresentationtime.html
932
933         Adopt a new API vended by AVSampleBufferDisplayLayer, piped from SourceBuffer down
934         through SourceBufferPrivate to SourceBufferPrivateAVFObjC. This value should be
935         reset and updated when new samples are appended.
936
937         * Modules/mediasource/SourceBuffer.cpp:
938         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
939         (WebCore::SourceBuffer::provideMediaData):
940         (WebCore::SourceBuffer::updateMinimumUpcomingPresentationTime):
941         (WebCore::SourceBuffer::resetMinimumUpcomingPresentationTime):
942         (WebCore::SourceBuffer::minimumUpcomingPresentationTimeForTrackID):
943         (WebCore::SourceBuffer::setMaximumQueueDepthForTrackID):
944         * Modules/mediasource/SourceBuffer.h:
945         * platform/graphics/SourceBufferPrivate.h:
946         (WebCore::SourceBufferPrivate::canSetMinimumUpcomingPresentationTime const):
947         (WebCore::SourceBufferPrivate::setMinimumUpcomingPresentationTime):
948         (WebCore::SourceBufferPrivate::clearMinimumUpcomingPresentationTime):
949         (WebCore::SourceBufferPrivate::enqueuedSamplesForTrackID):
950         (WebCore::SourceBufferPrivate::minimumUpcomingPresentationTimeForTrackID):
951         (WebCore::SourceBufferPrivate::setMaximumQueueDepthForTrackID):
952         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
953         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
954         (WebCore::SourceBufferPrivateAVFObjC::canSetMinimumUpcomingPresentationTime const):
955         (WebCore::SourceBufferPrivateAVFObjC::setMinimumUpcomingPresentationTime):
956         (WebCore::SourceBufferPrivateAVFObjC::clearMinimumUpcomingPresentationTime):
957         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
958         (WebCore::MockSourceBufferPrivate::minimumUpcomingPresentationTimeForTrackID):
959         (WebCore::MockSourceBufferPrivate::setMaximumQueueDepthForTrackID):
960         (WebCore::MockSourceBufferPrivate::canSetMinimumUpcomingPresentationTime const):
961         (WebCore::MockSourceBufferPrivate::setMinimumUpcomingPresentationTime):
962         (WebCore::MockSourceBufferPrivate::clearMinimumUpcomingPresentationTime):
963         * platform/mock/mediasource/MockSourceBufferPrivate.h:
964         * testing/Internals.cpp:
965         (WebCore::Internals::minimumUpcomingPresentationTimeForTrackID):
966         (WebCore::Internals::setMaximumQueueDepthForTrackID):
967         * testing/Internals.h:
968         * testing/Internals.idl:
969
970 2019-08-06  Antti Koivisto  <antti@apple.com>
971
972         Add release assert against InvalidationRuleSet mutation during invalidation
973         https://bugs.webkit.org/show_bug.cgi?id=200467
974
975         Reviewed by Chris Dumez.
976
977         Try to get a more informative stack for rdar://problem/53413013
978
979         * css/DocumentRuleSets.cpp:
980         (WebCore::DocumentRuleSets::~DocumentRuleSets):
981         (WebCore::DocumentRuleSets::collectFeatures const):
982         * css/DocumentRuleSets.h:
983         * style/AttributeChangeInvalidation.cpp:
984         (WebCore::Style::AttributeChangeInvalidation::invalidateStyleWithRuleSets):
985         * style/ClassChangeInvalidation.cpp:
986         (WebCore::Style::ClassChangeInvalidation::invalidateStyleWithRuleSets):
987
988 2019-08-06  Antti Koivisto  <antti@apple.com>
989
990         REGRESSION: Cannot tap on any buttons on m.naver.com home screen on iPad
991         https://bugs.webkit.org/show_bug.cgi?id=200466
992
993         Reviewed by Zalan Bujtas.
994
995         The page calls preventDefault() for a mouse event generated by a site specific quirk.
996
997         * page/Quirks.cpp:
998         (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
999
1000         Disable the quirk for the "m." subdomain. This is a mobile site that don't need or expect them.
1001
1002 2019-08-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1003
1004         [iPadOS] Unable to increase zoom level on Google using the Aa menu
1005         https://bugs.webkit.org/show_bug.cgi?id=200453
1006         <rdar://problem/52278579>
1007
1008         Reviewed by Tim Horton.
1009
1010         Makes a couple of minor adjustments to how layout size scale factor is handled in ViewportConfiguration, to
1011         address some scenarios in which adjusting WKWebView's _viewScale does not have any apparent effect on the page.
1012         See changes below for more detail.
1013
1014         Tests: fast/viewport/ios/non-responsive-viewport-after-changing-view-scale.html
1015                fast/viewport/ios/responsive-viewport-with-minimum-width-after-changing-view-scale.html
1016
1017         * page/ViewportConfiguration.cpp:
1018         (WebCore::ViewportConfiguration::initialScaleFromSize const):
1019
1020         When the page is either zoomed in or zoomed out using _viewScale, let the specified initial scale take
1021         precedence over the scale computed by fitting the content width to the view width, or the scale computed by
1022         fitting the content height to the view height.
1023
1024         This avoids a scenario in which nothing happens when increasing view scale in a responsively designed web page
1025         that has a fixed minimum width. Before this change, when computing the initial scale at a view scale that would
1026         not allow the entire content width of the page to fit within the viewport, the new initial scale would remain
1027         unchanged if the initial scale in the meta viewport is not also set to 1, because a new initial scale would be
1028         computed in ViewportConfiguration::initialScaleFromSize to accomodate for the entire content width.
1029
1030         Our new behavior allows us to zoom into the page, even if doing so would cause horizontal scrolling.
1031
1032         (WebCore::ViewportConfiguration::updateConfiguration):
1033
1034         When the page is either zoomed in or zoomed out using _viewScale and the default viewport configuration has a
1035         fixed width (e.g. on iPhone), then adjust the width of the default viewport configuration to account for the
1036         _viewScale. For example, the default width of a viewport-less web page is 980px on iPhone; at a view scale of 2,
1037         this would become 490px instead, and at 0.5 view scale, it would become 1960px.
1038
1039         This ensures that on iPhone, for web pages without a meta viewport, changing the view scale still changes the
1040         layout and initial scale of the web page.
1041
1042         * page/ViewportConfiguration.h:
1043         (WebCore::ViewportConfiguration::layoutSizeIsExplicitlyScaled const):
1044
1045 2019-08-05  Zalan Bujtas  <zalan@apple.com>
1046
1047         [LFC] Remove out-of-flow descendants from Container
1048         https://bugs.webkit.org/show_bug.cgi?id=200430
1049         <rdar://problem/53923980>
1050
1051         Reviewed by Antti Koivisto.
1052
1053         The out-of-flow descendant list is the last "formatting context type" bit in the layout tree.
1054         Let's cached them in the FormattingStates instead for now. 
1055
1056         * layout/FormattingContext.cpp:
1057         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1058         * layout/FormattingContext.h:
1059         * layout/FormattingState.h:
1060         (WebCore::Layout::FormattingState::addOutOfFlowBox):
1061         (WebCore::Layout::FormattingState::outOfFlowBoxes const):
1062         * layout/LayoutState.cpp:
1063         (WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
1064         (WebCore::Layout::LayoutState::createFormattingStateForFormattingRootIfNeeded):
1065         (WebCore::Layout::LayoutState::run):
1066         * layout/LayoutState.h:
1067         * layout/blockformatting/BlockFormattingContext.cpp:
1068         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
1069         * layout/inlineformatting/InlineFormattingContext.cpp:
1070         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
1071         * layout/layouttree/LayoutBox.h:
1072         * layout/layouttree/LayoutContainer.cpp:
1073         (WebCore::Layout::Container::addOutOfFlowDescendant): Deleted.
1074         * layout/layouttree/LayoutContainer.h:
1075         * layout/layouttree/LayoutTreeBuilder.cpp:
1076         (WebCore::Layout::TreeBuilder::createLayoutTree):
1077         * page/FrameViewLayoutContext.cpp:
1078         (WebCore::layoutUsingFormattingContext):
1079
1080 2019-08-05  Devin Rousso  <drousso@apple.com>
1081
1082         Web Inspector: Styles: show @supports CSS groupings
1083         https://bugs.webkit.org/show_bug.cgi?id=200419
1084
1085         Reviewed by Joseph Pecoraro.
1086
1087         Test: inspector/css/getMatchedStylesForNode.html
1088
1089         * inspector/InspectorStyleSheet.cpp:
1090         (WebCore::buildArrayForGroupings): Added.
1091         (WebCore::InspectorStyleSheet::buildObjectForRule):
1092         (WebCore::buildMediaObject): Deleted.
1093         (WebCore::fillMediaListChain): Deleted.
1094
1095         * css/MediaList.h:
1096         * css/MediaList.cpp:
1097         (WebCore::MediaQuerySet::MediaQuerySet):
1098         Remove the `lastLine` as it was never set by anyone and wasn't used by Web Inspector.
1099
1100 2019-08-05  Youenn Fablet  <youenn@apple.com>
1101
1102         Make Logger::log thread safe so that it can be used from background threads
1103         https://bugs.webkit.org/show_bug.cgi?id=200448
1104
1105         Reviewed by Eric Carlson.
1106
1107         No change of behavior.
1108
1109         * dom/Document.cpp:
1110         (WebCore::crossThreadCopy):
1111         (WebCore::Document::didLogMessage):
1112         Make sure to hop to the main thread if needed.
1113         * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:
1114         (WebCore::RealtimeIncomingAudioSourceCocoa::OnData):
1115         Remove hopping to the main thread.
1116         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
1117         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
1118         Remove hopping to the main thread.
1119
1120 2019-08-05  Devin Rousso  <drousso@apple.com>
1121
1122         Can't use $0, $1 etc when inspecting Google Docs pages because the content uses these for function names
1123         https://bugs.webkit.org/show_bug.cgi?id=195834
1124
1125         Reviewed by Joseph Pecoraro.
1126
1127         Allow the user to alias saved results by providing a different prefix (e.g. "$") from within
1128         Web Inspector. When changing the alias, all existing saved results will update to be
1129         reference-able from the new alias.
1130
1131         Test: inspector/runtime/setSavedResultAlias.html
1132
1133         * inspector/CommandLineAPIModuleSource.js:
1134         (CommandLineAPI):
1135
1136 2019-08-05  Devin Rousso  <drousso@apple.com>
1137
1138         Web Inspector: Timelines: disable related agents when the tab is closed
1139         https://bugs.webkit.org/show_bug.cgi?id=200118
1140
1141         Reviewed by Joseph Pecoraro.
1142
1143         Rework how `enable`/`disable` is used for timeline-related agents so that events are not sent
1144         and data isn't kept alive when the Timelines tab isn't enabled.
1145
1146         * inspector/agents/InspectorTimelineAgent.h:
1147         * inspector/agents/InspectorTimelineAgent.cpp:
1148         (WebCore::InspectorTimelineAgent::didCreateFrontendAndBackend):
1149         (WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend):
1150         (WebCore::InspectorTimelineAgent::enable):
1151         (WebCore::InspectorTimelineAgent::disable):
1152         (WebCore::InspectorTimelineAgent::start):
1153         (WebCore::InspectorTimelineAgent::stop):
1154         (WebCore::InspectorTimelineAgent::internalStart):
1155         (WebCore::InspectorTimelineAgent::internalStop):
1156         (WebCore::InspectorTimelineAgent::startFromConsole):
1157         (WebCore::InspectorTimelineAgent::stopFromConsole):
1158         (WebCore::InspectorTimelineAgent::mainFrameStartedLoading):
1159         (WebCore::InspectorTimelineAgent::startProgrammaticCapture):
1160         (WebCore::InspectorTimelineAgent::stopProgrammaticCapture):
1161         Rename `m_enabled*` to `m_tracking*` to match other timeline-related agents.
1162
1163         * inspector/agents/InspectorMemoryAgent.h:
1164         * inspector/agents/InspectorMemoryAgent.cpp:
1165         (WebCore::InspectorMemoryAgent::didCreateFrontendAndBackend):
1166         (WebCore::InspectorMemoryAgent::willDestroyFrontendAndBackend):
1167         (WebCore::InspectorMemoryAgent::enable):
1168         (WebCore::InspectorMemoryAgent::disable):
1169         (WebCore::InspectorMemoryAgent::didHandleMemoryPressure):
1170
1171         * inspector/InstrumentingAgents.h:
1172         (WebCore::InstrumentingAgents::trackingInspectorTimelineAgent): Added.
1173         (WebCore::InstrumentingAgents::setTrackingInspectorTimelineAgent): Added.
1174         (WebCore::InstrumentingAgents::persistentInspectorTimelineAgent): Added.
1175         (WebCore::InstrumentingAgents::setPersistentInspectorTimelineAgent): Added.
1176         * inspector/InstrumentingAgents.cpp:
1177         (WebCore::InstrumentingAgents::reset):
1178         * inspector/InspectorInstrumentation.h:
1179         * inspector/InspectorInstrumentation.cpp:
1180         (WebCore::InspectorInstrumentation::didInstallTimerImpl):
1181         (WebCore::InspectorInstrumentation::didRemoveTimerImpl):
1182         (WebCore::InspectorInstrumentation::willCallFunctionImpl):
1183         (WebCore::InspectorInstrumentation::willDispatchEventImpl):
1184         (WebCore::InspectorInstrumentation::willDispatchEventOnWindowImpl):
1185         (WebCore::InspectorInstrumentation::willEvaluateScriptImpl):
1186         (WebCore::InspectorInstrumentation::willFireTimerImpl):
1187         (WebCore::InspectorInstrumentation::didInvalidateLayoutImpl):
1188         (WebCore::InspectorInstrumentation::willLayoutImpl):
1189         (WebCore::InspectorInstrumentation::willCompositeImpl):
1190         (WebCore::InspectorInstrumentation::didCompositeImpl):
1191         (WebCore::InspectorInstrumentation::willPaintImpl):
1192         (WebCore::InspectorInstrumentation::didPaintImpl):
1193         (WebCore::InspectorInstrumentation::willRecalculateStyleImpl):
1194         (WebCore::InspectorInstrumentation::didScheduleStyleRecalculationImpl):
1195         (WebCore::InspectorInstrumentation::didCommitLoadImpl):
1196         (WebCore::InspectorInstrumentation::frameStartedLoadingImpl):
1197         (WebCore::InspectorInstrumentation::startConsoleTimingImpl):
1198         (WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
1199         (WebCore::InspectorInstrumentation::consoleTimeStampImpl):
1200         (WebCore::InspectorInstrumentation::startProfilingImpl):
1201         (WebCore::InspectorInstrumentation::stopProfilingImpl):
1202         (WebCore::InspectorInstrumentation::timelineAgentTracking): Added.
1203         (WebCore::InspectorInstrumentation::didRequestAnimationFrameImpl):
1204         (WebCore::InspectorInstrumentation::didCancelAnimationFrameImpl):
1205         (WebCore::InspectorInstrumentation::willFireAnimationFrameImpl):
1206         (WebCore::InspectorInstrumentation::willFireObserverCallbackImpl):
1207         (WebCore::InspectorInstrumentation::retrieveTimelineAgent):
1208         (WebCore::InspectorInstrumentation::timelineAgentEnabled): Deleted.
1209         * bindings/js/JSExecStateInstrumentation.h:
1210         (WebCore::JSExecState::instrumentFunctionInternal):
1211         Rename for clarity/correctness:
1212          - `inspectorTimelineAgent` => `trackingInspectorTimelineAgent`
1213          - `persistentInspectorTimelineAgent` => `inspectorTimelineAgent`
1214
1215 2019-08-05  Fujii Hironori  <Hironori.Fujii@sony.com>
1216
1217         [Win] Specifying huge font-size causes crashing
1218         https://bugs.webkit.org/show_bug.cgi?id=200340
1219
1220         Reviewed by Don Olmstead.
1221
1222         Covered by existing tests.
1223
1224         * platform/graphics/win/FontPlatformDataWin.cpp:
1225         (WebCore::FontPlatformData::FontPlatformData): Use GetTextFace to
1226         get font face names instead of GetOutlineTextMetrics which returns
1227         null for huge size fonts.
1228
1229 2019-08-05  Youenn Fablet  <youenn@apple.com>
1230
1231         Response constructor doesn't throw on disturbed ReadableStream
1232         https://bugs.webkit.org/show_bug.cgi?id=200130
1233         <rdar://problem/53550351>
1234
1235         Reviewed by Alex Christensen.
1236
1237         Make FetchBody::extract return an exception in error cases.
1238         Update call sites accordingly.
1239         Add the error case as per https://fetch.spec.whatwg.org/#concept-bodyinit-extract, ReadableStream handling.
1240
1241         Covered by updated and rebased tests.
1242
1243         * Modules/beacon/NavigatorBeacon.cpp:
1244         (WebCore::NavigatorBeacon::sendBeacon):
1245         * Modules/fetch/FetchBody.cpp:
1246         (WebCore::FetchBody::extract):
1247         * Modules/fetch/FetchBody.h:
1248         * Modules/fetch/FetchBodyOwner.cpp:
1249         (WebCore::FetchBodyOwner::extractBody):
1250         * Modules/fetch/FetchBodyOwner.h:
1251         * Modules/fetch/FetchRequest.cpp:
1252         (WebCore::FetchRequest::initializeWith):
1253         (WebCore::FetchRequest::setBody):
1254         * Modules/fetch/FetchResponse.cpp:
1255         (WebCore::FetchResponse::create):
1256         * Modules/streams/ReadableStreamInternals.js:
1257         (readableStreamPipeTo): fix a case where the promise would be unhandled and would show up in
1258         unhandledrejectionhandler.
1259
1260 2019-08-05  Youenn Fablet  <youenn@apple.com>
1261
1262         Support RTCRtpSender.dtmf
1263         https://bugs.webkit.org/show_bug.cgi?id=200431
1264
1265         Reviewed by Eric Carlson.
1266
1267         Add a new backend interface to RTCDTMFSender and implementation of it using libwebrtc.
1268         Update RTCDTMFSender to use that new backend and make RTCRtpSender return a RTCDTMFSender
1269         conditionally on a newly added runtime flag.
1270         Update RTCDTMFSender implementation based on https://w3c.github.io/webrtc-pc/#peer-to-peer-dtmf.
1271
1272         Covered by rebased tests.
1273
1274         * Modules/mediastream/PeerConnectionBackend.cpp:
1275         (WebCore::PeerConnectionBackend::context const):
1276         (WebCore::PeerConnectionBackend::transceiverFromSender):
1277         * Modules/mediastream/PeerConnectionBackend.h:
1278         * Modules/mediastream/RTCDTMFSender.cpp:
1279         (WebCore::RTCDTMFSender::RTCDTMFSender):
1280         (WebCore::RTCDTMFSender::canInsertDTMF const):
1281         (WebCore::RTCDTMFSender::toneBuffer const):
1282         (WebCore::isToneCharacterInvalid):
1283         (WebCore::RTCDTMFSender::insertDTMF):
1284         (WebCore::RTCDTMFSender::playNextTone):
1285         (WebCore::RTCDTMFSender::onTonePlayed):
1286         (WebCore::RTCDTMFSender::toneTimerFired):
1287         (WebCore::RTCDTMFSender::stop):
1288         (WebCore::RTCDTMFSender::activeDOMObjectName const):
1289         (WebCore::RTCDTMFSender::canSuspendForDocumentSuspension const):
1290         * Modules/mediastream/RTCDTMFSender.h:
1291         * Modules/mediastream/RTCDTMFSender.idl:
1292         * Modules/mediastream/RTCDTMFToneChangeEvent.cpp:
1293         * Modules/mediastream/RTCDTMFToneChangeEvent.h:
1294         * Modules/mediastream/RTCDTMFToneChangeEvent.idl:
1295         * Modules/mediastream/RTCRtpSender.cpp:
1296         (WebCore::RTCRtpSender::dtmf):
1297         (WebCore::RTCRtpSender::currentTransceiverDirection const):
1298         * Modules/mediastream/RTCRtpSender.h:
1299         * Modules/mediastream/RTCRtpSender.idl:
1300         * Modules/mediastream/RTCRtpSenderBackend.h:
1301         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
1302         (WebCore::LibWebRTCRtpSenderBackend::createDTMFBackend):
1303         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
1304         * Sources.txt:
1305         * WebCore.xcodeproj/project.pbxproj:
1306         * dom/EventNames.in:
1307         * dom/EventTargetFactory.in:
1308         * page/RuntimeEnabledFeatures.h:
1309         (WebCore::RuntimeEnabledFeatures::webRTCDTMFEnabled const):
1310         (WebCore::RuntimeEnabledFeatures::setWebRTCDTMFEnabled):
1311         * platform/mediastream/RTCDTMFSenderBackend.h: Added.
1312         * platform/mediastream/RTCDTMFSenderHandler.h: Removed.
1313         * platform/mediastream/RTCDTMFSenderHandlerClient.h: Removed.
1314         * platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.cpp: Added.
1315         (WebCore::toWTFString):
1316         (WebCore::LibWebRTCDTMFSenderBackend::LibWebRTCDTMFSenderBackend):
1317         (WebCore::LibWebRTCDTMFSenderBackend::~LibWebRTCDTMFSenderBackend):
1318         (WebCore::LibWebRTCDTMFSenderBackend::canInsertDTMF):
1319         (WebCore::LibWebRTCDTMFSenderBackend::playTone):
1320         (WebCore::LibWebRTCDTMFSenderBackend::tones const):
1321         (WebCore::LibWebRTCDTMFSenderBackend::duration const):
1322         (WebCore::LibWebRTCDTMFSenderBackend::interToneGap const):
1323         (WebCore::LibWebRTCDTMFSenderBackend::OnToneChange):
1324         (WebCore::LibWebRTCDTMFSenderBackend::onTonePlayed):
1325         * platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.h: Added.
1326
1327 2019-08-05  Saam Barati  <sbarati@apple.com>
1328
1329         [WHLSL] Inline all native function calls
1330         https://bugs.webkit.org/show_bug.cgi?id=200350
1331
1332         Reviewed by Robin Morisset.
1333
1334         Native functions calls tend to be really small. If we inline in the generated
1335         Metal code, we end up with faster Metal compile times. On compute_boids, this
1336         provides a ~10ms improvement.
1337
1338         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
1339         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
1340         (WebCore::WHLSL::Metal::sharedMetalFunctions):
1341         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
1342         (WebCore::WHLSL::Metal::inlineNativeFunction):
1343         (WebCore::WHLSL::Metal::writeNativeFunction): Deleted.
1344         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h:
1345
1346 2019-08-05  Youenn Fablet  <youenn@apple.com>
1347
1348         RealtimeOutgoingAudioSource::pullAudioData is no longer needed
1349         https://bugs.webkit.org/show_bug.cgi?id=200450
1350
1351         Reviewed by Geoffrey Garen.
1352
1353         No change of behavior, removing base class method declaration.
1354
1355         * platform/mediastream/RealtimeOutgoingAudioSource.h:
1356         (WebCore::RealtimeOutgoingAudioSource::pullAudioData): Deleted.
1357         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h:
1358         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h:
1359
1360 2019-08-05  Saam Barati  <sbarati@apple.com>
1361
1362         [WHLSL] Add compile time flag to dump metal compile times
1363         https://bugs.webkit.org/show_bug.cgi?id=200447
1364
1365         Reviewed by Myles C. Maxfield.
1366
1367         * Modules/webgpu/WHLSL/WHLSLPrepare.h:
1368         * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
1369         (WebCore::trySetFunctions):
1370         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
1371         (WebCore::trySetFunctions):
1372
1373 2019-08-05  Chris Dumez  <cdumez@apple.com>
1374
1375         navigator.geolocation wrapper should not become GC-collectable once its frame is detached
1376         https://bugs.webkit.org/show_bug.cgi?id=200436
1377
1378         Reviewed by Darin Adler.
1379
1380         navigator.geolocation wrapper should not become GC-collectable once its frame is detached, given
1381         that it can outlive the frame. Instead, tie the navigator.geolocation wrapper's lifetime to its
1382         Navigator's.
1383
1384         Test: fast/dom/navigator-property-gc-after-frame-detach.html
1385
1386         * Modules/geolocation/Geolocation.cpp:
1387         (WebCore::Geolocation::create):
1388         (WebCore::Geolocation::Geolocation):
1389         (WebCore::Geolocation::navigator):
1390         (WebCore::Geolocation::frame const):
1391         * Modules/geolocation/Geolocation.h:
1392         * Modules/geolocation/Geolocation.idl:
1393         * Modules/geolocation/NavigatorGeolocation.cpp:
1394         (WebCore::NavigatorGeolocation::NavigatorGeolocation):
1395         (WebCore::NavigatorGeolocation::from):
1396         (WebCore::NavigatorGeolocation::geolocation):
1397         (WebCore::NavigatorGeolocation::geolocation const):
1398         * Modules/geolocation/NavigatorGeolocation.h:
1399         * bindings/js/JSNavigatorCustom.cpp:
1400         (WebCore::JSNavigator::visitAdditionalChildren):
1401         * bindings/js/JSWorkerNavigatorCustom.cpp:
1402         (WebCore::JSWorkerNavigator::visitAdditionalChildren):
1403         * bindings/scripts/CodeGeneratorJS.pm:
1404         (GenerateImplementation):
1405         * bindings/scripts/IDLAttributes.json:
1406         * page/Navigator.cpp:
1407         (WebCore::Navigator::plugins):
1408         (WebCore::Navigator::mimeTypes):
1409         * page/NavigatorBase.h:
1410         * plugins/DOMMimeTypeArray.cpp:
1411         (WebCore::DOMMimeTypeArray::DOMMimeTypeArray):
1412         * plugins/DOMMimeTypeArray.h:
1413         * plugins/DOMMimeTypeArray.idl:
1414         * plugins/DOMPluginArray.cpp:
1415         (WebCore::DOMPluginArray::DOMPluginArray):
1416         * plugins/DOMPluginArray.h:
1417         * plugins/DOMPluginArray.idl:
1418         * workers/service/ServiceWorkerContainer.h:
1419         * workers/service/ServiceWorkerContainer.idl:
1420
1421 2019-08-05  Andy Estes  <aestes@apple.com>
1422
1423         [WebIDL] Support partial dictionaries and conditional dictionary members
1424         https://bugs.webkit.org/show_bug.cgi?id=200441
1425
1426         Reviewed by Alex Christensen.
1427
1428         Added new bindings tests.
1429
1430         * bindings/scripts/CodeGeneratorJS.pm:
1431         (GenerateDictionaryImplementationContent):
1432         * bindings/scripts/IDLParser.pm:
1433         (parsePartialDefinition):
1434         (parsePartialInterface): Deleted.
1435         (parsePartialDictionary): Deleted.
1436         * bindings/scripts/generate-bindings.pl:
1437         (generateBindings):
1438         * bindings/scripts/preprocess-idls.pl:
1439         (getPartialNamesFromIDL):
1440         (getPartialInterfaceNameFromIDL): Deleted.
1441         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1442         (WebCore::convertDictionary<TestEventConstructor::Init>):
1443         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
1444         (WebCore::convertDictionary<DictionaryImplName>):
1445         (WebCore::convertDictionaryToJS):
1446         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
1447         * bindings/scripts/test/TestStandaloneDictionary.idl:
1448         * bindings/scripts/test/TestSupplemental.idl:
1449
1450 2019-08-05  Devin Rousso  <drousso@apple.com>
1451
1452         Web Inspector: rename "Stylesheet" to "Style Sheet" to match spec text
1453         https://bugs.webkit.org/show_bug.cgi?id=200422
1454
1455         Reviewed by Joseph Pecoraro.
1456
1457         No observable change in functionality.
1458
1459         * inspector/agents/InspectorPageAgent.h:
1460         * inspector/agents/InspectorPageAgent.cpp:
1461         (WebCore::InspectorPageAgent::resourceTypeJSON):
1462         (WebCore::InspectorPageAgent::inspectorResourceType):
1463
1464 2019-08-05  Takashi Komori  <Takashi.Komori@sony.com>
1465
1466         [Curl] implement CertificateInfo::summaryInfo
1467         https://bugs.webkit.org/show_bug.cgi?id=191498
1468
1469         Reviewed by Alex Christensen.
1470
1471         Implement CertificaeInfo::SummaryInfo.
1472         This patch makes WebInspector show summary of certificates.
1473
1474         Tests: http/tests/inspector/network/resource-security-certificate.html
1475                http/tests/inspector/network/getSerializedCertificate.html
1476
1477         * platform/Curl.cmake:
1478         * platform/network/curl/CertificateInfo.h:
1479         (WTF::Persistence::Coder<WebCore::CertificateInfo>::encode):
1480         (WTF::Persistence::Coder<WebCore::CertificateInfo>::decode):
1481         (WebCore::CertificateInfo::summaryInfo const): Deleted.
1482         * platform/network/curl/CertificateInfoCurl.cpp:
1483         (WebCore::CertificateInfo::summaryInfo const):
1484         * platform/network/curl/CurlSSLVerifier.cpp:
1485         (WebCore::CurlSSLVerifier::collectInfo):
1486         (WebCore::CurlSSLVerifier::verifyCallback):
1487         (WebCore::StackOfX509::StackOfX509): Deleted.
1488         (WebCore::StackOfX509::~StackOfX509): Deleted.
1489         (WebCore::StackOfX509::count): Deleted.
1490         (WebCore::StackOfX509::item): Deleted.
1491         (): Deleted.
1492         (WebCore::BIOHolder::BIOHolder): Deleted.
1493         (WebCore::BIOHolder::~BIOHolder): Deleted.
1494         (WebCore::BIOHolder::write): Deleted.
1495         (WebCore::BIOHolder::asCertificate): Deleted.
1496         (WebCore::pemDataFromCtx): Deleted.
1497         * platform/network/curl/CurlSSLVerifier.h:
1498         * platform/network/curl/OpenSSLHelper.cpp: Added.
1499         (OpenSSL::deleter<X509>::operator()):
1500         (OpenSSL::StackOfGeneralName::StackOfGeneralName):
1501         (OpenSSL::StackOfGeneralName::~StackOfGeneralName):
1502         (OpenSSL::StackOfGeneralName::operator bool):
1503         (OpenSSL::StackOfGeneralName::count):
1504         (OpenSSL::StackOfGeneralName::item):
1505         (OpenSSL::StackOfX509::StackOfX509):
1506         (OpenSSL::StackOfX509::~StackOfX509):
1507         (OpenSSL::StackOfX509::count):
1508         (OpenSSL::StackOfX509::item):
1509         (OpenSSL::BIO::BIO):
1510         (OpenSSL::BIO::~BIO):
1511         (OpenSSL::BIO::getDataAsVector const):
1512         (OpenSSL::BIO::getDataAsString const):
1513         (OpenSSL::BIO::readX509):
1514         (OpenSSL::BIO::get):
1515         (OpenSSL::pemDataFromCtx):
1516         (OpenSSL::createCertificateInfo):
1517         (OpenSSL::toString):
1518         (OpenSSL::getCommonName):
1519         (OpenSSL::getSubjectName):
1520         (OpenSSL::convertASN1TimeToSeconds):
1521         (OpenSSL::getSubjectAltName):
1522         (OpenSSL::createSummaryInfo):
1523         * platform/network/curl/OpenSSLHelper.h: Copied from Source/WebCore/platform/network/curl/CertificateInfoCurl.cpp.
1524
1525 2019-08-04  Youenn Fablet  <youenn@apple.com>
1526
1527         WebRTC: got incorrect `this` in negotiationneeded event
1528         https://bugs.webkit.org/show_bug.cgi?id=200427
1529
1530         Reviewed by Darin Adler.
1531
1532         Make sure a dom object created through a JS built-in constructor is added to the wrapper cache.
1533
1534         Test: webrtc/onnegotiationneeded.html
1535
1536         * bindings/js/JSDOMBuiltinConstructor.h:
1537         (WebCore::createJSObjectFromWrapper):
1538         (WebCore::createJSObject):
1539
1540 2019-08-04  Sam Weinig  <weinig@apple.com>
1541
1542         Mangled WHLSL names don't need to allocate Strings
1543         https://bugs.webkit.org/show_bug.cgi?id=200429
1544
1545         Reviewed by Saam Barati.
1546
1547         To avoid allocating strings for each mangled name used to transform WHLSL to Metal, which we'd
1548         like to avoid since it is both unnecessarily expensive in time and space, we can instead just
1549         store the unique integer identifier that was being used to construct the String. 
1550         
1551         Since the existing mangled names were all of the form "prefix" + unsigned integer value (where 
1552         prefix could be "type", "enumerationMember", "structureElement", "variable" or "function") we
1553         strongly type the integer by storing it in a struct (MangledVariableName, MangledTypeName, etc.)
1554         When the full name is actually needed, StringTypeAdapter's specialized for the structs are
1555         used to write directly into the preallocated buffers of StringBuilders or makeString().
1556
1557         * Modules/webgpu/WHLSL/Metal/WHLSLMangledNames.h: Added.
1558         (WebCore::WHLSL::Metal::MangledVariableName):
1559         (WebCore::WHLSL::Metal::MangledTypeName):
1560         (WebCore::WHLSL::Metal::MangledStructureElementName):
1561         (WebCore::WHLSL::Metal::MangledEnumerationMemberName):
1562         (WebCore::WHLSL::Metal::MangledFunctionName):
1563         Adds structs for each type of mangled name and StringTypeAdapter specializations for
1564         each to allow their use in StringBuilder.flexibleAppend() or makeString(). 
1565         
1566         Additionally, a Variant, MangledOrNativeTypeName, of MangledTypeName and String is 
1567         declared to allow for the few cases where a native type (e.g. float4) is needed. The
1568         StringTypeAdapter for MangledOrNativeTypeName could be generalized for any Variant
1569         in the future, but I left it non-general for now, as it is non-obvious if one would
1570         want to store Variant<Types...>, and have each member function construct a temporary
1571         StringTypeAdapter, or store a Variant<StringTypeAdapter<Types>...> and perform conversion
1572         in the construction.
1573
1574         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
1575         (WebCore::WHLSL::Metal::EntryPointScaffolding::EntryPointScaffolding):
1576         (WebCore::WHLSL::Metal::internalTypeForSemantic):
1577         (WebCore::WHLSL::Metal::EntryPointScaffolding::builtInsSignature):
1578         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledInputPath):
1579         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::VertexEntryPointScaffolding):
1580         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::signature):
1581         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::pack):
1582         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::FragmentEntryPointScaffolding):
1583         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::signature):
1584         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::pack):
1585         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::ComputeEntryPointScaffolding):
1586         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::signature):
1587         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::pack):
1588         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h:
1589         (WebCore::WHLSL::Metal::EntryPointScaffolding::parameterVariables):
1590         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
1591         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::FunctionDeclarationWriter):
1592         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::visit):
1593         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
1594         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::generateNextVariableName):
1595         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValueWithNullability):
1596         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValue):
1597         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendLeftValue):
1598         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValue):
1599         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValueAndNullability):
1600         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastLeftValue):
1601         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
1602         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitLoop):
1603         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::RenderFunctionDefinitionWriter):
1604         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::createEntryPointScaffolding):
1605         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::ComputeFunctionDefinitionWriter):
1606         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::createEntryPointScaffolding):
1607         (WebCore::WHLSL::Metal::sharedMetalFunctions):
1608         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.h:
1609         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h:
1610         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
1611         (WebCore::WHLSL::Metal::writeNativeFunction):
1612         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h:
1613         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
1614         (WebCore::WHLSL::Metal::BaseTypeNameNode::BaseTypeNameNode):
1615         (WebCore::WHLSL::Metal::BaseTypeNameNode::mangledName const):
1616         (WebCore::WHLSL::Metal::ArrayTypeNameNode::ArrayTypeNameNode):
1617         (WebCore::WHLSL::Metal::ArrayReferenceTypeNameNode::ArrayReferenceTypeNameNode):
1618         (WebCore::WHLSL::Metal::PointerTypeNameNode::PointerTypeNameNode):
1619         (WebCore::WHLSL::Metal::ReferenceTypeNameNode::ReferenceTypeNameNode):
1620         (WebCore::WHLSL::Metal::MetalTypeDeclarationWriter::MetalTypeDeclarationWriter):
1621         (WebCore::WHLSL::Metal::TypeNamer::metalTypeDeclarations):
1622         (WebCore::WHLSL::Metal::TypeNamer::emitNamedTypeDefinition):
1623         (WebCore::WHLSL::Metal::TypeNamer::mangledNameForType):
1624         (WebCore::WHLSL::Metal::TypeNamer::mangledNameForEnumerationMember):
1625         (WebCore::WHLSL::Metal::TypeNamer::mangledNameForStructureElement):
1626         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.h:
1627         (WebCore::WHLSL::Metal::TypeNamer::generateNextTypeName):
1628         (WebCore::WHLSL::Metal::TypeNamer::generateNextStructureElementName):
1629         (WebCore::WHLSL::Metal::TypeNamer::generateNextEnumerationMemberName):
1630         * Modules/webgpu/WHLSL/WHLSLPrepare.h:
1631         Replace uses of String with the appropriate mangled name type.
1632
1633         * WebCore.xcodeproj/project.pbxproj:
1634         Add WHLSLMangledNames.h
1635
1636         * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
1637         (WebCore::trySetFunctions):
1638         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
1639         (WebCore::trySetFunctions):
1640         Convert the mangled names to Strings for passing to Metal API. NOTE: We could avoid having the
1641         toString() member function on MangledFunctionName if we allowed makeString() to take a single
1642         argument.
1643
1644 2019-08-04  Chris Dumez  <cdumez@apple.com>
1645
1646         Ping loads should not prevent page caching
1647         https://bugs.webkit.org/show_bug.cgi?id=200418
1648         <rdar://problem/53901632>
1649
1650         Reviewed by Darin Adler.
1651
1652         We normally prevent page caching if there were any pending subresource loads when navigating,
1653         to avoid caching partial / broken content. However, this should not apply to Ping / Beacon
1654         loads since those do not impact page rendering and can outlive the page.
1655
1656         Tests: http/tests/navigation/page-cache-pending-ping-load-cross-origin.html
1657                http/tests/navigation/page-cache-pending-ping-load-same-origin.html
1658
1659         * history/PageCache.cpp:
1660         (WebCore::PageCache::addIfCacheable):
1661         After we've fired the 'pagehide' event in each frame, stop all the loads again. This is needed
1662         since pages are allowed to start ping / beacon loads in their 'pagehide' handlers. If we do not
1663         stop those loads, then the next call to canCachePage() would fail because the DocumentLoader is
1664         still loading. Note that we're not actually preventing these ping loads from hitting the server
1665         since we never cancel page loads and those can outlive their page.
1666
1667         * loader/DocumentLoader.cpp:
1668         (WebCore::shouldPendingCachedResourceLoadPreventPageCache):
1669         (WebCore::areAllLoadersPageCacheAcceptable):
1670         Make sure that Ping / Beacon / Prefetches / Icon loads do not prevent page caching.
1671
1672         (WebCore::DocumentLoader::addSubresourceLoader):
1673         Tweak assertion that was incorrect since we actually allow ping / beacon loads when the
1674         document is about to enter PageCache (while firing pagehide event).
1675
1676 2019-08-04  Zalan Bujtas  <zalan@apple.com>
1677
1678         [LFC][TFC] Create formatting context/state.
1679         https://bugs.webkit.org/show_bug.cgi?id=200428
1680         <rdar://problem/53913625>
1681
1682         Reviewed by Antti Koivisto.
1683
1684         * layout/LayoutState.cpp:
1685         (WebCore::Layout::LayoutState::createFormattingStateForFormattingRootIfNeeded):
1686         (WebCore::Layout::LayoutState::createFormattingContext):
1687
1688 2019-08-04  Zalan Bujtas  <zalan@apple.com>
1689
1690         [LFC] Cleanup preferred width computation
1691         https://bugs.webkit.org/show_bug.cgi?id=200426
1692         <rdar://problem/53912607>
1693
1694         Reviewed by Antti Koivisto.
1695
1696         The intrinsic width for a formatting root box has 2 sets of values now. One set(min/max) is stored in the established formatting context's state
1697         while the other is in the formatting context's state where the box lives.
1698
1699         <div style="position: absolute"><div style="float: left; border: 1px solid green">foobar</div></div>
1700
1701         The float box participates in the formatting context established by the absolutely position box, but it also establishes an inline formatting context.
1702         The min/max width pair in the established context is the width of the "foobar" (same value for min/max). This set is stored in the inline formatting state.
1703         However the float box has horizontal border so the "final" min/max width pair is expanded by this border value and stored in the formatting state where
1704         the box lives (which is different from the one it establishes).
1705
1706         This and the "remove the formatting context type classes from the tree" changes open up interesting optimization opportunities.
1707         Here is a very simple case:
1708         <div style="display: inline-block; width: auto;">
1709           <div style="float: left">some text</div>
1710           <div style="float: left">some super long .... text</div>
1711           <div></div>
1712         </div>
1713         In order to lay out this content properly, we
1714         1. Compute the min/max width of the first float (expensive text measuring)
1715         2. Compute the min/max width of the second float (some more expensive text measuring)
1716         3. Compute the min/max width of the inline-block (that is pretty much the 2 float's min/max)
1717         4. Lay out the 2 floats, the empty div and the inline-block using these min/max width pairs.
1718
1719         Now if the inline-block box's display value is changed to "block" and the positioning is to absolute (style="display: box; position: absolute;")
1720         we currently(on trunk) tear down the render tree, build a new one and run all the steps again from #1 to #4.
1721
1722         In LFC, we start with the following layout tree
1723         <container> -> block formatting context
1724           <container> -> inline formatting context
1725             <anonymous inline box>
1726           <container> -> inline formatting context
1727             <anonymous inline box>
1728           <container> -> inline formatting context
1729         and when the style change happens, we don't need to tear down the tree at all. Not only that, but since every formatting contexts stay the same
1730         we can just reuse their states and actually skip all the steps (even the positioning since the absolutely positioned container has static top/bottom/left/right).
1731
1732         Surprisingly the final layout produces the exact same "display boxes" as the original layout.
1733
1734         * layout/FormattingContext.h:
1735         (WebCore::Layout::FormattingContext::IntrinsicWidthConstraints::expand):
1736         * layout/FormattingContextGeometry.cpp:
1737         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
1738         * layout/FormattingState.h:
1739         (WebCore::Layout::FormattingState::setIntrinsicWidthConstraints):
1740         (WebCore::Layout::FormattingState::intrinsicWidthConstraints const):
1741         (WebCore::Layout::FormattingState::setIntrinsicWidthConstraintsForBox):
1742         (WebCore::Layout::FormattingState::clearIntrinsicWidthConstraints):
1743         (WebCore::Layout::FormattingState::intrinsicWidthConstraintsForBox const):
1744         * layout/blockformatting/BlockFormattingContext.cpp:
1745         (WebCore::Layout::BlockFormattingContext::computedIntrinsicWidthConstraints const):
1746         (WebCore::Layout::BlockFormattingContext::computeIntrinsicWidthConstraints const): Deleted.
1747         * layout/blockformatting/BlockFormattingContext.h:
1748         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1749         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
1750         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraintsNeedChildrenWidth): Deleted.
1751         * layout/displaytree/DisplayBox.h:
1752         (WebCore::Display::Box::horizontalMarginBorderAndPadding const):
1753         * layout/inlineformatting/InlineFormattingContext.cpp:
1754         (WebCore::Layout::nextInPreOrder):
1755         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints const):
1756         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot const):
1757         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const): Deleted.
1758         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFloatBox const): Deleted.
1759         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForInlineBlock const): Deleted.
1760         * layout/inlineformatting/InlineFormattingContext.h:
1761         * layout/tableformatting/TableFormattingContext.cpp:
1762         (WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints const):
1763         * layout/tableformatting/TableFormattingContext.h:
1764
1765 2019-08-03  Devin Rousso  <drousso@apple.com>
1766
1767         Web Inspector: DOM: add a special breakpoint for "All Events"
1768         https://bugs.webkit.org/show_bug.cgi?id=200285
1769
1770         Reviewed by Joseph Pecoraro.
1771
1772         Similar to the existing "All Requests" breakpoint, there should be a way to set a breakpoint
1773         that would pause for any DOM event, regardless of the event's name. This is useful for
1774         situations where the event name isn't known, or where one simply want's to pause on the next
1775         entry to the event loop.
1776
1777         Along these lines, make the "requestAnimationFrame", "setTimeout", and "setInterval"
1778         event breakpoints into special breakpoints that can be added/removed via the create
1779         breakpoint context menu. This simplifies the process for setting these breakpoints, and also
1780         makes them more discoverable (most people wouldn't consider them to be "events").
1781
1782         Tests: inspector/dom/breakpoint-for-event-listener.html
1783                inspector/dom-debugger/event-animation-frame-breakpoints.html
1784                inspector/dom-debugger/event-breakpoint-with-navigation.html
1785                inspector/dom-debugger/event-interval-breakpoints.html
1786                inspector/dom-debugger/event-listener-breakpoints.html
1787                inspector/dom-debugger/event-timeout-breakpoints.html
1788
1789         * inspector/agents/InspectorDOMDebuggerAgent.h:
1790         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
1791         (WebCore::InspectorDOMDebuggerAgent::disable):
1792         (WebCore::InspectorDOMDebuggerAgent::frameDocumentUpdated):
1793         (WebCore::InspectorDOMDebuggerAgent::setEventBreakpoint):
1794         (WebCore::InspectorDOMDebuggerAgent::removeEventBreakpoint):
1795         (WebCore::InspectorDOMDebuggerAgent::willHandleEvent):
1796         (WebCore::InspectorDOMDebuggerAgent::willFireTimer):
1797         (WebCore::InspectorDOMDebuggerAgent::willFireAnimationFrame):
1798         (WebCore::InspectorDOMDebuggerAgent::discardBindings): Deleted.
1799         Make `eventName` optional for `addEventBreakpoint`/`removeEventBreakpoint`. When omitted,
1800         the corresponding breakpoint that is added/removed is treated as a global breakpoint that
1801         applies to all events of that type (e.g. a global `listener` breakpoint would pause for any
1802         event that is fired).
1803
1804 2019-08-03  Zalan Bujtas  <zalan@apple.com>
1805
1806         [LFC] Remove formatting context type leaf classes
1807         https://bugs.webkit.org/show_bug.cgi?id=200224
1808         <rdar://problem/53661907>
1809
1810         Reviewed by Antti Koivisto.
1811
1812         Let's keep the layout tree formatting context type independent.
1813
1814         * Sources.txt:
1815         * WebCore.xcodeproj/project.pbxproj:
1816         * layout/inlineformatting/InlineFormattingContext.cpp:
1817         (WebCore::Layout::InlineFormattingContext::layout const):
1818         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
1819         (WebCore::Layout::InlineFormattingContext::initializeMarginBorderAndPaddingForGenericInlineBox const):
1820         (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
1821         * layout/inlineformatting/InlineFormattingContext.h:
1822         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
1823         (WebCore::Layout::inlineItemWidth):
1824         (WebCore::Layout::LineLayout::placeInlineItem):
1825         * layout/inlineformatting/InlineItem.h:
1826         * layout/inlineformatting/InlineTextItem.cpp:
1827         (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
1828         (WebCore::Layout::InlineTextItem::InlineTextItem):
1829         (WebCore::Layout::InlineTextItem::split const):
1830         * layout/inlineformatting/InlineTextItem.h:
1831         (WebCore::Layout::InlineTextItem::inlineBox const): Deleted.
1832         * layout/inlineformatting/text/TextUtil.cpp:
1833         (WebCore::Layout::TextUtil::width):
1834         (WebCore::Layout::TextUtil::split):
1835         * layout/inlineformatting/text/TextUtil.h:
1836         * layout/layouttree/LayoutBox.cpp:
1837         (WebCore::Layout::Box::Box):
1838         (WebCore::Layout::Box::~Box):
1839         (WebCore::Layout::Box::formattingContextRoot const):
1840         (WebCore::Layout::Box::setTextContent):
1841         (WebCore::Layout::Box::hasTextContent const):
1842         (WebCore::Layout::Box::textContent const):
1843         (WebCore::Layout::Box::replaced const):
1844         (WebCore::Layout::Box::replaced):
1845         (WebCore::Layout::Box::rareDataMap):
1846         (WebCore::Layout::Box::rareData const):
1847         (WebCore::Layout::Box::ensureRareData):
1848         (WebCore::Layout::Box::removeRareData):
1849         * layout/layouttree/LayoutBox.h:
1850         (WebCore::Layout::Box::isLineBreakBox const):
1851         (WebCore::Layout::Box::hasRareData const):
1852         (WebCore::Layout::Box::setHasRareData):
1853         (WebCore::Layout::Box::isInlineBox const): Deleted.
1854         (WebCore::Layout::Box::replaced const): Deleted.
1855         (WebCore::Layout::Box::replaced): Deleted.
1856         * layout/layouttree/LayoutContainer.h:
1857         (WebCore::Layout::Container::firstChild const): Deleted.
1858         (WebCore::Layout::Container::lastChild const): Deleted.
1859         (WebCore::Layout::Container::hasChild const): Deleted.
1860         (WebCore::Layout::Container::hasInFlowChild const): Deleted.
1861         (WebCore::Layout::Container::hasInFlowOrFloatingChild const): Deleted.
1862         (WebCore::Layout::Container::outOfFlowDescendants const): Deleted.
1863         * layout/layouttree/LayoutInlineBox.cpp: Removed.
1864         * layout/layouttree/LayoutInlineBox.h: Removed.
1865         * layout/layouttree/LayoutLineBreakBox.cpp: Removed.
1866         * layout/layouttree/LayoutLineBreakBox.h: Removed.
1867         * layout/layouttree/LayoutTreeBuilder.cpp:
1868         (WebCore::Layout::TreeBuilder::createLayoutBox):
1869         (WebCore::Layout::outputLayoutBox):
1870
1871 2019-08-03  Zalan Bujtas  <zalan@apple.com>
1872
1873         [LFC] Remove formatting context type container classes.
1874         https://bugs.webkit.org/show_bug.cgi?id=200202
1875
1876         Reviewed by Antti Koivisto.
1877
1878         These are formatting context specific classes. Let's try to have a layout tree without such types.
1879
1880         * Sources.txt:
1881         * WebCore.xcodeproj/project.pbxproj:
1882         * layout/blockformatting/BlockFormattingContext.cpp:
1883         (WebCore::Layout::BlockFormattingContext::computeIntrinsicWidthConstraints const):
1884         * layout/inlineformatting/InlineFormattingContext.cpp:
1885         (WebCore::Layout::InlineFormattingContext::layout const):
1886         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPaddingForInlineContainer const):
1887         * layout/inlineformatting/InlineFormattingContext.h:
1888         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
1889         (WebCore::Layout::InlineFormattingContext::InlineLayout::layout const):
1890         * layout/inlineformatting/InlineLine.cpp:
1891         (WebCore::Layout::Line::appendTextContent):
1892         * layout/layouttree/LayoutBlockContainer.cpp: Removed.
1893         * layout/layouttree/LayoutBlockContainer.h: Removed.
1894         * layout/layouttree/LayoutBox.cpp:
1895         (WebCore::Layout::Box::establishesInlineFormattingContext const):
1896         (WebCore::Layout::Box::establishesInlineFormattingContextOnly const):
1897         (WebCore::Layout::Box::formattingContextRoot const):
1898         * layout/layouttree/LayoutBox.h:
1899         (WebCore::Layout::Box::isBlockContainer const):
1900         (WebCore::Layout::Box::isInlineContainer const):
1901         (WebCore::Layout::Box::isInlineBox const):
1902         (WebCore::Layout::Box::establishesInlineFormattingContext const): Deleted.
1903         (WebCore::Layout::Box::establishesInlineFormattingContextOnly const): Deleted.
1904         * layout/layouttree/LayoutInlineContainer.cpp: Removed.
1905         * layout/layouttree/LayoutInlineContainer.h: Removed.
1906         * layout/layouttree/LayoutIterator.h:
1907         (WebCore::Layout::LayoutBoxTraversal::firstChild):
1908         * layout/layouttree/LayoutTreeBuilder.cpp:
1909         (WebCore::Layout::TreeBuilder::createLayoutTree):
1910         (WebCore::Layout::TreeBuilder::createLayoutBox):
1911         (WebCore::Layout::TreeBuilder::createTableStructure):
1912         (WebCore::Layout::outputLayoutBox):
1913         * layout/layouttree/LayoutTreeBuilder.h:
1914         * page/FrameViewLayoutContext.cpp:
1915         (WebCore::layoutUsingFormattingContext):
1916
1917 2019-08-02  Robin Morisset  <rmorisset@apple.com>
1918
1919         [WHLSL] Avoid visiting the full AST in computeDimensions
1920         https://bugs.webkit.org/show_bug.cgi?id=200410
1921
1922         Reviewed by Myles C. Maxfield.
1923
1924         Avoid visiting the full AST in computeDimensions
1925         This cuts the time spent in computeDimensions on compute_boids.html from about 2ms to about 0.002ms.
1926
1927         No new tests as there is no functional change intended.
1928
1929         * Modules/webgpu/WHLSL/WHLSLComputeDimensions.cpp:
1930         (WebCore::WHLSL::computeDimensions):
1931         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
1932
1933 2019-08-02  Ryosuke Niwa  <rniwa@webkit.org>
1934
1935         Ref Frame in DOMWindow::screen* functions
1936         https://bugs.webkit.org/show_bug.cgi?id=200409
1937
1938         Reviewed by Simon Fraser.
1939
1940         Ref Frame in the following functions.
1941
1942         * page/DOMWindow.cpp:
1943         (WebCore::DOMWindow::innerHeight const):
1944         (WebCore::DOMWindow::innerWidth const):
1945         (WebCore::DOMWindow::screenX const):
1946         (WebCore::DOMWindow::screenY const):
1947         (WebCore::DOMWindow::scrollX const):
1948         (WebCore::DOMWindow::scrollY const):
1949
1950 2019-08-02  Mark Lam  <mark.lam@apple.com>
1951
1952         [ARM64E] Harden the diversity of the DOMJIT::Signature::unsafeFunction pointer.
1953         https://bugs.webkit.org/show_bug.cgi?id=200292
1954         <rdar://problem/53706881>
1955
1956         Reviewed by Geoffrey Garen.
1957
1958         * bindings/scripts/CodeGeneratorJS.pm:
1959         (GenerateImplementation):
1960         - Update to work with the new DOMJIT::Signature constructor.
1961
1962         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
1963         - Re-base test results.
1964
1965 2019-08-02  Keith Rollin  <krollin@apple.com>
1966
1967         Consistently use Obj-C boolean literals
1968         https://bugs.webkit.org/show_bug.cgi?id=200405
1969         <rdar://problem/53880043>
1970
1971         Reviewed by Simon Fraser, Joseph Pecoraro.
1972
1973         There are places where we use equivalent but different expressions for
1974         Obj-C boolean objects. For example, we use both [NSNumber
1975         numberWithBool:YES] and @YES. There are places where both are used in
1976         the same function, such as -[WebPreferences initialize]. The boolean
1977         literal is in greater use and is more succinct, so standardize on
1978         that. Also, change @(YES/NO) to @YES/NO.
1979
1980         No new tests -- no new or changed functionality.
1981
1982         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1983         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
1984         * platform/graphics/cv/ImageTransferSessionVT.mm:
1985         (WebCore::ImageTransferSessionVT::ImageTransferSessionVT):
1986         (WebCore::ImageTransferSessionVT::setSize):
1987         (WebCore::ImageTransferSessionVT::ioSurfacePixelBufferCreationOptions):
1988         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
1989         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferPool):
1990         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
1991         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
1992         * platform/network/mac/ResourceHandleMac.mm:
1993         (WebCore::ResourceHandle::applySniffingPoliciesIfNeeded):
1994
1995 2019-08-02  Andres Gonzalez  <andresg_22@apple.com>
1996
1997         Add accessibility object method to determine whether an element is inside a table cell. Needed for iOS accessibility client.
1998         https://bugs.webkit.org/show_bug.cgi?id=200394
1999         <rdar://problem/52914964>
2000
2001         Reviewed by Chris Fleizach.
2002
2003         Explicitly returning BOOL to avoid error in some compiler configurations.
2004         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2005         (-[WebAccessibilityObjectWrapper _accessibilityIsInTableCell]):
2006
2007 2019-08-02  Devin Rousso  <drousso@apple.com>
2008
2009         Web Inspector: fix inverted check in InspectorDOMStorageAgent::enable
2010         Followup to r248179.
2011
2012         Rubber-stamped by Joseph Pecoraro.
2013
2014         * inspector/agents/InspectorDOMStorageAgent.cpp:
2015         (WebCore::InspectorDOMStorageAgent::enable):
2016
2017 2019-08-02  Fujii Hironori  <Hironori.Fujii@sony.com>
2018
2019         [Curl] Crash while destructing a URL in ~SocketStreamHandle due to data race
2020         https://bugs.webkit.org/show_bug.cgi?id=200378
2021
2022         Reviewed by Ross Kirsling.
2023
2024         URL::isolatedCopy() is called in the worker thread. URL is using a
2025         thread-unsafe ref-counter. It should be called in the main thread.
2026
2027         Covered by existing tests.
2028
2029         * platform/network/curl/SocketStreamHandleImpl.h:
2030         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
2031         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl): Call URL::isolatedCopy() in the main thread.
2032         (WebCore::SocketStreamHandleImpl::threadEntryPoint): Added a URL argument.
2033
2034 2019-08-02  Sihui Liu  <sihui_liu@apple.com>
2035
2036         API tests using permanent credentials should clear credentials left by previous tests
2037         https://bugs.webkit.org/show_bug.cgi?id=199729
2038
2039         Reviewed by Alex Christensen.
2040
2041         Update existing API tests.
2042
2043         * platform/network/CredentialStorage.cpp:
2044         (WebCore::CredentialStorage::clearSessionCredentials):
2045         (WebCore::CredentialStorage::clearPermanentCredentialsForProtectionSpace): Deleted.
2046         * platform/network/CredentialStorage.h:
2047         * platform/network/mac/CredentialStorageMac.mm:
2048         (WebCore::CredentialStorage::clearPermanentCredentialsForProtectionSpace): Deleted.
2049
2050 2019-08-02  Devin Rousso  <drousso@apple.com>
2051
2052         Web Inspector: Storage: disable related agents when the tab is closed
2053         https://bugs.webkit.org/show_bug.cgi?id=200117
2054
2055         Reviewed by Joseph Pecoraro.
2056
2057         Rework how `enable`/`disable` is used for storage-related agents so that events are not sent
2058         and data isn't kept alive when the Storage tab isn't enabled.
2059
2060         Covered by existing tests.
2061
2062         * inspector/agents/InspectorApplicationCacheAgent.h:
2063         * inspector/agents/InspectorApplicationCacheAgent.cpp:
2064         (WebCore::InspectorApplicationCacheAgent::willDestroyFrontendAndBackend):
2065         (WebCore::InspectorApplicationCacheAgent::enable):
2066         (WebCore::InspectorApplicationCacheAgent::disable): Added.
2067
2068         * inspector/agents/InspectorDOMStorageAgent.cpp:
2069         (WebCore::InspectorDOMStorageAgent::enable):
2070         (WebCore::InspectorDOMStorageAgent::disable):
2071
2072         * inspector/agents/InspectorDatabaseAgent.cpp:
2073         (WebCore::InspectorDatabaseAgent::enable):
2074         (WebCore::InspectorDatabaseAgent::disable):
2075
2076 2019-08-02  Devin Rousso  <drousso@apple.com>
2077
2078         Web Inspector: Timelines: Develop > Start Timeline Recording doesn't work when focused on a detached inspector window
2079         https://bugs.webkit.org/show_bug.cgi?id=200125
2080         <rdar://problem/53543008>
2081
2082         Reviewed by Brian Burg.
2083
2084         Always show the Timelines tab in Web Inspector whenever timeline recording starts/stops.
2085         Notify the UIProcess whenever the timeline recording state changes.
2086
2087         * inspector/InspectorClient.h:
2088         (WebCore::InspectorClient::timelineRecordingChanged): Added.
2089
2090         * inspector/agents/InspectorTimelineAgent.h:
2091         * inspector/agents/InspectorTimelineAgent.cpp:
2092         (WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
2093         (WebCore::InspectorTimelineAgent::internalStart):
2094         (WebCore::InspectorTimelineAgent::internalStop):
2095
2096 2019-08-02  Yury Semikhatsky  <yurys@chromium.org>
2097
2098         Web Inspector: Crash when interacting with Template Content in Console
2099         https://bugs.webkit.org/show_bug.cgi?id=196280
2100
2101         Reviewed by Joseph Pecoraro.
2102
2103         Test: inspector/dom/inspect-template-node.html
2104
2105         * bindings/js/JSDOMBindingSecurity.cpp:
2106         (WebCore::canAccessDocument): if target element is from a
2107         <template> use its host document to check the access. Elements
2108         from the host document always have access to its template elements content.
2109         * inspector/agents/InspectorDOMAgent.cpp:
2110         (WebCore::InspectorDOMAgent::resolveNode): templates are created in
2111         special template document which doesn't have a frame, in such case get
2112         the frame from the host document.
2113
2114 2019-08-02  Ryosuke Niwa  <rniwa@webkit.org>
2115
2116         Harden NodeRareData::m_connectedFrameCount
2117         https://bugs.webkit.org/show_bug.cgi?id=200300
2118
2119         Reviewed by Geoffrey Garen.
2120
2121         Use unsinged integer type in NodeRareData::m_connectedFrameCount since it's padded anyway.
2122
2123         * dom/Node.cpp:
2124         (WebCore::Node::decrementConnectedSubframeCount): Check that hasRareNode() is true in release builds.
2125         * dom/NodeRareData.h:
2126
2127 2019-08-02  Ryosuke Niwa  <rniwa@webkit.org>
2128
2129         Document::resume should delay resetting of form control elements.
2130         https://bugs.webkit.org/show_bug.cgi?id=200376
2131
2132         Reviewed by Geoffrey Garen.
2133
2134         Delay the execution of form control element resets until the next task
2135         to avoid synchronously mutating DOM during page cache restoration.
2136
2137         Test: fast/frames/restoring-page-cache-should-not-run-scripts.html
2138
2139         * html/HTMLFormElement.cpp:
2140         (WebCore::HTMLFormElement::resumeFromDocumentSuspension):
2141         * html/HTMLInputElement.cpp:
2142         (WebCore::HTMLInputElement::resumeFromDocumentSuspension):
2143
2144 2019-08-02  Youenn Fablet  <youenn@apple.com>
2145
2146         [iOS] Directly use RealtimeMediaSourceCenter to compute the media capture  state
2147         https://bugs.webkit.org/show_bug.cgi?id=200368
2148         <rdar://problem/53191450>
2149
2150         Unreviewed.
2151         Build fix by guarding with MEDIA_STREAM in addition to IOS.
2152
2153         * dom/Document.cpp:
2154         (WebCore::Document::updateIsPlayingMedia):
2155         (WebCore::Document::pageMutedStateDidChange):
2156
2157 2019-08-02  Andres Gonzalez  <andresg_22@apple.com>
2158
2159         Add accessibility object method to determine whether an element is inside a table cell. Needed for iOS accessibility client.
2160         https://bugs.webkit.org/show_bug.cgi?id=200394
2161         <rdar://problem/52914964>
2162
2163         Reviewed by Chris Fleizach.
2164
2165         Test: accessibility/ios-simulator/element-in-table-cell.html
2166
2167         Added _accessibilityIsInTableCell needed for iOS accessibility client.
2168         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2169         (-[WebAccessibilityObjectWrapper _accessibilityIsInTableCell]):
2170
2171 2019-08-02  Eric Carlson  <eric.carlson@apple.com>
2172
2173         [macOS, iOS] webaudio/silent-audio-interrupted-in-background.html sometimes crashes
2174         https://bugs.webkit.org/show_bug.cgi?id=200396
2175         <rdar://problem/53819720>
2176
2177         Reviewed by Youenn Fablet.
2178
2179         No new test, this fixes an existing test.
2180
2181         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
2182         (WebCore::AudioSourceProviderAVFObjC::~AudioSourceProviderAVFObjC): Drop the
2183         lock before clearing m_tapStorage. 
2184
2185 2019-08-02  Youenn Fablet  <youenn@apple.com>
2186
2187         [iOS] Directly use RealtimeMediaSourceCenter to compute the media capture  state
2188         https://bugs.webkit.org/show_bug.cgi?id=200368
2189         <rdar://problem/53191450>
2190
2191         Reviewed by Eric Carlson.
2192
2193         Instead of registering a MediaStreamTrack as a media producer to compute capture state,
2194         go directly to the sources from the RealtimeMediaSourceCenter.
2195         Do the same when requested to mute capture tracks.
2196
2197         No observable change of behavior.
2198         Covered by manual test on iOS and existing tests.
2199
2200         * Modules/mediastream/MediaStreamTrack.cpp:
2201         (WebCore::MediaStreamTrack::MediaStreamTrack):
2202         (WebCore::MediaStreamTrack::~MediaStreamTrack):
2203         (WebCore::MediaStreamTrack::mediaState const):
2204         (WebCore::sourceCaptureState):
2205         (WebCore::MediaStreamTrack::captureState):
2206         (WebCore::MediaStreamTrack::muteCapture):
2207         * Modules/mediastream/MediaStreamTrack.h:
2208         * dom/Document.cpp:
2209         (WebCore::Document::updateIsPlayingMedia):
2210         (WebCore::Document::pageMutedStateDidChange):
2211
2212 2019-08-02  Chris Dumez  <cdumez@apple.com>
2213
2214         DOMWindow properties may get GC'd before their Window object
2215         https://bugs.webkit.org/show_bug.cgi?id=200359
2216
2217         Reviewed by Ryosuke Niwa.
2218
2219         DOMWindow properties may get GC'd before their Window object once their frame is detached. This
2220         is unexpected behavior given that these properties persist on the Window after the frame is
2221         detached. This patch thus updates their bindings so that they live as long as their window, not
2222         their frame.
2223
2224         Note that this also fixes a thread-safety issue since DOMWindowProperty::frame() would get called
2225         from GC threads, although its implementation looks like:
2226         """
2227           return m_window ? m_window->frame() : nullptr;
2228         """
2229
2230         Because m_window is a WeakPtr<DOMWindow> and because windows get destroyed on the main thread,
2231         we could in theory crash when dereferencing m_window->frame() from the GC thread.
2232
2233         Test: fast/dom/dom-window-property-gc-after-frame-detach.html
2234
2235         * bindings/js/JSDOMWindowCustom.cpp:
2236         (WebCore::JSDOMWindow::visitAdditionalChildren):
2237         * bindings/scripts/CodeGeneratorJS.pm:
2238         (GenerateImplementation):
2239         * bindings/scripts/IDLAttributes.json:
2240         * css/StyleMedia.idl:
2241         * loader/appcache/DOMApplicationCache.idl:
2242         * page/BarProp.idl:
2243         * page/DOMSelection.idl:
2244         * page/History.idl:
2245         * page/Location.idl:
2246         * page/Navigator.idl:
2247         * page/Screen.idl:
2248         * page/VisualViewport.idl:
2249         * plugins/DOMMimeTypeArray.idl:
2250         * plugins/DOMPluginArray.idl:
2251         * storage/Storage.idl:
2252
2253 2019-08-02  Konstantin Tokarev  <annulen@yandex.ru>
2254
2255         Remove constructors and operators of FontPlatformData defined only for Freetype
2256         https://bugs.webkit.org/show_bug.cgi?id=200379
2257
2258         Reviewed by Carlos Garcia Campos.
2259
2260         These methods only make maintenance harder, as all data fields are
2261         trivially copyable. Constructors generated by compiler should be used
2262         instead.
2263
2264         * platform/graphics/FontPlatformData.h:
2265         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
2266
2267 2019-08-02  Konstantin Tokarev  <annulen@yandex.ru>
2268
2269         Remove unused constructor declaration from FontPlatformData
2270         https://bugs.webkit.org/show_bug.cgi?id=200371
2271
2272         Reviewed by Carlos Garcia Campos.
2273
2274         It is not implemented by any port.
2275
2276         * platform/graphics/FontPlatformData.h:
2277
2278 2019-08-01  Chris Dumez  <cdumez@apple.com>
2279
2280         Pages using MessagePorts should be PageCacheable
2281         https://bugs.webkit.org/show_bug.cgi?id=200366
2282         <rdar://problem/53837882>
2283
2284         Reviewed by Geoffrey Garen.
2285
2286         Allow a page to enter PageCache, even if it has MessagePorts (potentially with
2287         pending messages). If there are pending messages on the MessagePorts when
2288         entering PageCache, those will get dispatched upon restoring from PageCache.
2289
2290         Test: fast/history/page-cache-MessagePort-pending-message.html
2291
2292         * dom/MessagePort.cpp:
2293         (WebCore::MessagePort::messageAvailable):
2294         (WebCore::MessagePort::dispatchMessages):
2295         Do not dispatch messages while in PageCache.
2296
2297         (WebCore::MessagePort::canSuspendForDocumentSuspension const):
2298         Allow pages with MessagePort objects to enter PageCache.
2299
2300         * dom/ScriptExecutionContext.cpp:
2301         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
2302         Make sure pending messages on MessagePorts get dispatched asynchronously after restoring
2303         from PageCache.
2304
2305         * loader/DocumentLoader.cpp:
2306         (WebCore::areAllLoadersPageCacheAcceptable):
2307         Make sure only CachedResources that are still loading upon load cancelation prevent
2308         entering PageCache.
2309
2310 2019-08-01  Konstantin Tokarev  <annulen@yandex.ru>
2311
2312         Fix compilation of PageConsoleClient with !ENABLE(VIDEO)
2313         https://bugs.webkit.org/show_bug.cgi?id=200380
2314
2315         Reviewed by Joseph Pecoraro.
2316
2317         * page/PageConsoleClient.cpp:
2318         (WebCore::PageConsoleClient::screenshot):
2319
2320 2019-08-01  Mark Lam  <mark.lam@apple.com>
2321
2322         Add crash diagnostics for debugging unexpected zapped cells.
2323         https://bugs.webkit.org/show_bug.cgi?id=200149
2324         <rdar://problem/53570112>
2325
2326         Reviewed by Yusuke Suzuki.
2327
2328         No new tests because this is a feature for debugging crashes.  It has been tested
2329         manually by modifying the code to force a crash at the point of interest.
2330
2331         Added some comments to document the hashes of known subspaces.
2332
2333         * bindings/js/WebCoreJSClientData.cpp:
2334         (WebCore::JSVMClientData::JSVMClientData):
2335
2336 2019-08-01  Saam Barati  <sbarati@apple.com>
2337
2338         [WHLSL] Do simple nullptr check elimination using basic data flow analysis when generating metal code
2339         https://bugs.webkit.org/show_bug.cgi?id=200352
2340
2341         Reviewed by Myles C. Maxfield.
2342
2343         When doing metal code generation, we frequently know whether something
2344         is null or not. This patch does a basic propagation of this information
2345         to avoid emitting excessive null checks in the generated Metal code.
2346         This is a 6% speedup (with a p value of 0.0001) in Metal compile times
2347         on compute_boids.
2348
2349         An example of a null check we now eliminate is:
2350         ```
2351         int x;
2352         thread int* ptr = &x; // We know that the lvalue for "x" is non-null, so we produce a non-null rvalue here.
2353         *ptr = 42; // We know that the "ptr" rvalue is non-null, so we omit the null check.
2354         ```
2355
2356         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
2357         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValueWithNullability):
2358         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValue):
2359         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendLeftValue):
2360         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValueAndNullability):
2361         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastLeftValue):
2362         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
2363
2364 2019-08-01  Alex Christensen  <achristensen@webkit.org>
2365
2366         Move FormData zip file generation to NetworkProcess and enable it for all WebKit clients for uploading directories
2367         https://bugs.webkit.org/show_bug.cgi?id=200102
2368         <rdar://problem/53275114>
2369
2370         Reviewed by Darin Adler.
2371
2372         To enable directory uploading in WebKit2, we extended WebKit1's model of asking the application to generate a file for uploading.
2373         This means the WebProcess needed access to everything necessary to zip a whole directory, and clients that have not implemented
2374         the strange WKBundlePageUIClient callbacks won't be able to upload directories.  Safari's implementation had already been copied
2375         to BlobDataFileReference::generateReplacementFile, so I reused that code to do the zipping.  Instead of a complicated model of
2376         keeping track of a filename, possibly a generated filename, and whether we think we own the file or not and having nobody clean up,
2377         we now do the generation, use, and cleaning up in the network process starting with a new function generateFilesForUpload.
2378         This removes unimplemented SPI in WebUIDelegatePrivate in WebKitLegacy and stops calling the WKBundlePageUIClient related to upload
2379         file generation and replaces them with automatic behavior equivalent to Safari's implementation of the WKBundlePageUIClient calls.
2380         Since we no longer need to do these file operations in the WebProcess, I am also reverting r245322 and r246077 which tightens the sandbox.
2381
2382         Covered by an API test.
2383
2384         * Modules/fetch/FetchBody.cpp:
2385         (WebCore::FetchBody::extract):
2386         (WebCore::FetchBody::bodyAsFormData const):
2387         * loader/FormSubmission.cpp:
2388         (WebCore::FormSubmission::create):
2389         * loader/FrameLoader.cpp:
2390         (WebCore::FrameLoader::submitForm):
2391         (WebCore::FrameLoader::loadDifferentDocumentItem):
2392         * loader/ResourceLoader.cpp:
2393         (WebCore::ResourceLoader::didReceiveResponse):
2394         (WebCore::ResourceLoader::cleanupForError):
2395         * page/Chrome.cpp:
2396         (WebCore::ChromeClient::shouldReplaceWithGeneratedFileForUpload): Deleted.
2397         (WebCore::ChromeClient::generateReplacementFile): Deleted.
2398         * page/ChromeClient.h:
2399         * platform/network/FormData.cpp:
2400         (WebCore::FormData::FormData):
2401         (WebCore::FormData::~FormData):
2402         (WebCore::FormData::createMultiPart):
2403         (WebCore::FormDataElement::lengthInBytes const):
2404         (WebCore::FormData::appendFile):
2405         (WebCore::FormData::appendFileRange):
2406         (WebCore::FormData::appendMultiPartFileValue):
2407         (WebCore::FormData::appendMultiPartKeyValuePairItems):
2408         (WebCore::FormData::resolveBlobReferences):
2409         (WebCore::generateFileForUpload):
2410         (WebCore::FormData::generateFilesForUpload):
2411         (WebCore::FormData::generateFiles): Deleted.
2412         (WebCore::FormData::hasGeneratedFiles const): Deleted.
2413         (WebCore::FormData::hasOwnedGeneratedFiles const): Deleted.
2414         (WebCore::FormData::removeGeneratedFilesIfNeeded): Deleted.
2415         * platform/network/FormData.h:
2416         (WebCore::FormDataElement::FormDataElement):
2417         (WebCore::FormDataElement::EncodedFileData::isolatedCopy const):
2418         (WebCore::FormDataElement::EncodedFileData::operator== const):
2419         (WebCore::FormDataElement::EncodedFileData::encode const):
2420         (WebCore::FormDataElement::EncodedFileData::decode):
2421         * platform/network/cf/FormDataStreamCFNet.cpp:
2422         (WebCore::advanceCurrentStream):
2423         (WebCore::formCreate):
2424         (WebCore::formFinalize):
2425         (WebCore::createHTTPBodyCFReadStream):
2426         * platform/network/mac/BlobDataFileReferenceMac.mm:
2427         (WebCore::generateFileForUpload):
2428         (WebCore::BlobDataFileReference::generateReplacementFile):
2429         * xml/XMLHttpRequest.cpp:
2430         (WebCore::XMLHttpRequest::send):
2431
2432 2019-08-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2433
2434         [Text autosizing] [iPadOS] Add targeted hacks to address some remaining text autosizing issues
2435         https://bugs.webkit.org/show_bug.cgi?id=200271
2436         <rdar://problem/51734741>
2437
2438         Reviewed by Zalan Bujtas.
2439
2440         Makes some targeted adjustments to the text autosizing heuristic, to ensure compatibility with several high-
2441         profile websites. See changes below for more detail.
2442
2443         Tests:  fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidate-special-cases.html
2444                 fast/text-autosizing/ios/idempotentmode/line-height-boosting.html
2445
2446         * css/StyleResolver.cpp:
2447         (WebCore::StyleResolver::adjustRenderStyleForTextAutosizing):
2448
2449         Avoid clipped sidebar links on sohu.com by not performing line-height boosting in the case where the element
2450         probably has a small, fixed number of lines. See below for more detail. Additionally, don't attempt to adjust
2451         the line height using the boosted font size, in the case where the element is not a candidate for idempotent
2452         text autosizing.
2453
2454         * rendering/style/RenderStyle.cpp:
2455         (WebCore::RenderStyle::isIdempotentTextAutosizingCandidate const):
2456
2457         Make various targeted hacks to fix a few websites:
2458
2459         -   Add a special case for top navigation bar links on yandex.ru, where line height greatly exceeds the
2460             specified font size.
2461
2462         -   Avoid boosting some related video links on v.youku.com by considering the line-clamp CSS property when
2463             determining the maximum number of lines of text an element is expected to contain.
2464
2465         -   Avoid boosting some front page links on asahi.com, which have non-repeating background images.
2466
2467         -   Add several other adjustments to more aggressively boost pieces of text on Google search results, such as
2468             taking the `word-break` CSS property into account.
2469
2470         The bottom few pixels of sidebar links on naver.com are also no longer clipped after these changes.
2471
2472         * rendering/style/TextSizeAdjustment.cpp:
2473         (WebCore::AutosizeStatus::probablyContainsASmallFixedNumberOfLines):
2474
2475         Pulls out a piece of the heuristic added to fix sephora.com in r247467 out into a separate helper method. To
2476         recap, this heuristic identifies elements with both a fixed height and fixed line height, for which the fixed
2477         height is close to an integer multiple of the line height.
2478
2479         Also makes several small tweaks in the process: (1) change the max difference between fixed line height and
2480         font size from 6 to 5 to ensure that some multiline caption text on Google search results is boosted, and (2)
2481         replace usages of `lineHeight()` with `specifiedLineHeight()`, which current prevents this function from being
2482         truly idempotent.
2483
2484         (WebCore::AutosizeStatus::updateStatus):
2485         * rendering/style/TextSizeAdjustment.h:
2486
2487 2019-07-31  Mark Lam  <mark.lam@apple.com>
2488
2489         Rename DOMJIT safe/unsafeFunction to functionWithTypeChecks and functionWithoutTypeChecks.
2490         https://bugs.webkit.org/show_bug.cgi?id=200323
2491
2492         Reviewed by Yusuke Suzuki.
2493
2494         No new tests.  This is just a refactoring exercise.
2495
2496         * bindings/scripts/CodeGeneratorJS.pm:
2497         (GetArgumentTypeForFunctionWithoutTypeCheck):
2498         (GenerateImplementation):
2499         (GenerateOperationDefinition):
2500         (ToNativeForFunctionWithoutTypeCheck):
2501         (GetUnsafeArgumentType): Deleted.
2502         (UnsafeToNative): Deleted.
2503         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2504         (WebCore::jsTestDOMJITPrototypeFunctionGetAttributeWithoutTypeCheck):
2505         (WebCore::jsTestDOMJITPrototypeFunctionItemWithoutTypeCheck):
2506         (WebCore::jsTestDOMJITPrototypeFunctionHasAttributeWithoutTypeCheck):
2507         (WebCore::jsTestDOMJITPrototypeFunctionGetElementByIdWithoutTypeCheck):
2508         (WebCore::jsTestDOMJITPrototypeFunctionGetElementsByNameWithoutTypeCheck):
2509         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetAttribute): Deleted.
2510         (WebCore::unsafeJsTestDOMJITPrototypeFunctionItem): Deleted.
2511         (WebCore::unsafeJsTestDOMJITPrototypeFunctionHasAttribute): Deleted.
2512         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementById): Deleted.
2513         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementsByName): Deleted.
2514
2515 2019-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
2516
2517         [SOUP] WebSockets: add support for extensions when using web sockets libsoup API
2518         https://bugs.webkit.org/show_bug.cgi?id=199943
2519
2520         Reviewed by Alex Christensen.
2521
2522         Add SOUP_TYPE_WEBSOCKET_EXTENSION_MANAGER feature to the soup session to enable WebSocket extensions.
2523
2524         Tests: http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-comp-bit-onoff.html
2525                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-invalid-parameter.html
2526                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-parameter.html
2527                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-set-bfinal.html
2528                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-split-frames.html
2529                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-unsolicited-negotiation-response.html
2530                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-window-bits.html
2531
2532         * platform/network/soup/SoupNetworkSession.cpp:
2533         (WebCore::SoupNetworkSession::SoupNetworkSession):
2534
2535 2019-08-01  Chris Dumez  <cdumez@apple.com>
2536
2537         [iOS][WK1] Unsafe unsafe of WeakPtr<Document> from UIThread under PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit()
2538         https://bugs.webkit.org/show_bug.cgi?id=200324
2539
2540         Reviewed by Ryosuke Niwa.
2541
2542         The Document is a WebThread object, but a WeakPtr<Document> was dereferenced from the
2543         UIThread in HTMLMediaElement::supportsSeeking(), from the PlaybackSessionInterfaceAVKit
2544         constructor. To address the issue we now grab the WebThread lock before constructing
2545         the PlaybackSessionInterfaceAVKit.
2546
2547         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2548         (VideoFullscreenControllerContext::setUpFullscreen):
2549
2550 2019-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
2551
2552         [SOUP] Switch to use libsoup WebSockets API
2553         https://bugs.webkit.org/show_bug.cgi?id=200162
2554
2555         Reviewed by Michael Catanzaro.
2556
2557         Use the libsoup WebSockets API unconditionally for libsoup based ports.
2558
2559         * Modules/websockets/ThreadableWebSocketChannel.cpp:
2560         (WebCore::ThreadableWebSocketChannel::create): Do not check the env var anymore.
2561         * platform/SourcesSoup.txt:
2562         * platform/network/SocketStreamHandleImpl.cpp:
2563         * platform/network/StorageSessionProvider.h:
2564         * platform/network/soup/SocketStreamHandleImpl.h:
2565         * platform/network/soup/SocketStreamHandleImplSoup.cpp: Removed.
2566
2567 2019-07-31  Devin Rousso  <drousso@apple.com>
2568
2569         Web Inspector: Debugger: support emulateUserGesture parameter in Debugger.evaluateOnCallFrame
2570         https://bugs.webkit.org/show_bug.cgi?id=200272
2571
2572         Reviewed by Joseph Pecoraro.
2573
2574         When paused, evaluating in the console should still respect the "Emulate User Gesture" checkbox.
2575
2576         Tests: inspector/debugger/evaluateOnCallFrame-emulateUserGesture.html
2577                inspector/debugger/evaluateOnCallFrame-emulateUserGesture-userIsInteracting.html
2578
2579         * inspector/agents/page/PageDebuggerAgent.h:
2580         * inspector/agents/page/PageDebuggerAgent.cpp:
2581         (WebCore::PageDebuggerAgent::evaluateOnCallFrame): Added.
2582
2583 2019-07-31  Saam Barati  <sbarati@apple.com>
2584
2585         [WHLSL] Replace memsetZero function with inline "= { }" code
2586         https://bugs.webkit.org/show_bug.cgi?id=200328
2587
2588         Reviewed by Robin Morisset.
2589
2590         This is a ~20ms metal compile time improvement on compute_boids.
2591
2592         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
2593         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
2594         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
2595         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
2596         (WebCore::WHLSL::Metal::writeNativeFunction):
2597         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h:
2598
2599 2019-07-31  Andy Estes  <aestes@apple.com>
2600
2601         REGRESSION (r240942): first visually non-empty layout milestone is not reached in media documents until after the video finishes loading
2602         https://bugs.webkit.org/show_bug.cgi?id=200293
2603         <rdar://problem/52937749>
2604
2605         Reviewed by Alex Christensen.
2606
2607         r240942 changed FrameView::qualifiesAsVisuallyNonEmpty() to consider only documents in the
2608         Interactive or Complete ready states as "finished parsing". Documents considered finished
2609         parsing can qualify as visually non-empty even without exceeding the visual character or
2610         pixel thresholds, but documents considered not finished must first exceed one of these
2611         thresholds in order to qualify as visually non-empty.
2612
2613         HTMLDocuments are placed in the Interactive ready state by their HTMLDocumentParsers.
2614         However, HTMLDocument subclasses like ImageDocument and MediaDocument use their own custom
2615         parsers that never set the Interactive ready state on their documents; these documents go
2616         from Loading directly to Complete.
2617
2618         In order for these HTMLDocument subclasses to be considered visually non-empty before they
2619         finish loading they must render something that exceeds the visual character or pixel
2620         thresholds. For image documents, rendering the image is usually enough to cross the
2621         threshold, but for media documents the visual pixel threshold was never crossed because
2622         videos did not contribute to the visually non-empty pixel count.
2623
2624         As a result, media documents are not considered visually non-empty until the main resource
2625         finishes loading. On iOS this means that the layer tree remains frozen until this point,
2626         even though the media might have started autoplaying with audio long before it finished
2627         loading.
2628
2629         Fix this by teaching RenderVideo to contribute the video player's size to FrameView's
2630         visually non-empty pixel count once the video player has loaded enough data to determine its
2631         intrinsic size. Videos that render more than 1024 pixels will qualify a media document as
2632         visually non-empty even when it is still loading its main resource.
2633
2634         Added a new API test.
2635
2636         * rendering/RenderImage.cpp:
2637         (WebCore::RenderImage::imageChanged):
2638         (WebCore::RenderImage::incrementVisuallyNonEmptyPixelCountIfNeeded):
2639         * rendering/RenderImage.h:
2640         * rendering/RenderVideo.cpp:
2641         (WebCore::RenderVideo::updateIntrinsicSize):
2642
2643 2019-07-31  Saam Barati  <sbarati@apple.com>
2644
2645         [WHLSL] Remove UnnamedType copy/move constructors and mark classes as final
2646         https://bugs.webkit.org/show_bug.cgi?id=200188
2647         <rdar://problem/53628171>
2648
2649         Unreviewed followup.
2650
2651         As Darin pointed out in the bugzilla comments, when defining a copy
2652         constructor in C++ (either deleted or an implementation), the move
2653         constructor is implicitly deleted. This match removes the excessive
2654         use of WTF_MAKE_NONMOVABLE when we're already using WTF_MAKE_NONCOPYABLE.
2655
2656         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
2657         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
2658         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
2659         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
2660         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
2661         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
2662
2663 2019-07-31  Zalan Bujtas  <zalan@apple.com>
2664
2665         [ContentChangeObserver] twitch.tv video controls do not always respond to taps in fullscreen
2666         https://bugs.webkit.org/show_bug.cgi?id=200309
2667         <rdar://problem/52964977>
2668
2669         Reviewed by Simon Fraser.
2670
2671         Do not consider an element visible if it is not a descendant of the active fullscreen element.
2672
2673         This patch fixes the cases when the user taps on a button in fullscreen mode while the non-fullscreen content is being mutated and
2674         the ContentChangeObserver mistakenly registers it as a valid, actionable change and as a result we don't fire the click event (stay at hover).
2675
2676         Test: fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode.html
2677
2678         * page/ios/ContentChangeObserver.cpp:
2679         (WebCore::fullscreenElement):
2680         (WebCore::ContentChangeObserver::isVisuallyHidden):
2681
2682 2019-07-31  Saam Barati  <sbarati@apple.com>
2683
2684         [WHLSL Remove char/short/half types
2685         https://bugs.webkit.org/show_bug.cgi?id=200312
2686
2687         Reviewed by Myles C. Maxfield.
2688
2689         This patch removes the char/short/half types from WHLSL. Since it's not
2690         supported by all HW, WebGPU is leaving these types out for now. This is
2691         also a huge speedup, since it halves the size of the standard library.
2692         
2693         In the compute_boids demo, WHLSL::prepare goes from running in ~140ms to
2694         running in ~60ms.
2695
2696         Test: webgpu/whlsl/smaller-than-32-bit-types.html
2697
2698         * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp:
2699         (WebCore::WHLSL::Metal::writeNativeType):
2700         * Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp:
2701         (WebCore::WHLSL::Intrinsics::addPrimitive):
2702         (WebCore::WHLSL::Intrinsics::addVector):
2703         (WebCore::WHLSL::Intrinsics::addMatrix):
2704         * Modules/webgpu/WHLSL/WHLSLIntrinsics.h:
2705         (WebCore::WHLSL::Intrinsics::WTF_ARRAY_LENGTH):
2706         (WebCore::WHLSL::Intrinsics::ucharType const): Deleted.
2707         (WebCore::WHLSL::Intrinsics::ushortType const): Deleted.
2708         (WebCore::WHLSL::Intrinsics::charType const): Deleted.
2709         (WebCore::WHLSL::Intrinsics::shortType const): Deleted.
2710         (WebCore::WHLSL::Intrinsics::uchar2Type const): Deleted.
2711         (WebCore::WHLSL::Intrinsics::uchar4Type const): Deleted.
2712         (WebCore::WHLSL::Intrinsics::ushort2Type const): Deleted.
2713         (WebCore::WHLSL::Intrinsics::ushort4Type const): Deleted.
2714         (WebCore::WHLSL::Intrinsics::char2Type const): Deleted.
2715         (WebCore::WHLSL::Intrinsics::char4Type const): Deleted.
2716         (WebCore::WHLSL::Intrinsics::short2Type const): Deleted.
2717         (WebCore::WHLSL::Intrinsics::short4Type const): Deleted.
2718         * Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h:
2719         * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp:
2720         (WebCore::WHLSL::isAcceptableFormat):
2721         * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt:
2722         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
2723         (WebCore::convertTextureFormat):
2724
2725 2019-07-31  Youenn Fablet  <youenn@apple.com>
2726
2727         Use CTFontCreateForCharactersWithLanguageAndOption if available instead of CTFontCreateForCharactersWithLanguage
2728         https://bugs.webkit.org/show_bug.cgi?id=200241
2729
2730         Reviewed by Myles C. Maxfield.
2731
2732         We can use CTFontCreateForCharactersWithLanguageAndOption instead of CTFontCreateForCharactersWithLanguage
2733         as it allows setting more easily the fallback option.
2734         This allows us to never fallback to user installed fonts.
2735         In such a case, we no longer need to wrap the fonts to change the fallback option.
2736         We also prewarm the fonts with the same SPI and use system fallback as the default value.
2737
2738         Covered by existing tests.
2739
2740         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2741         (WebCore::preparePlatformFont):
2742         (WebCore::lookupFallbackFont):
2743         (WebCore::FontCache::systemFallbackForCharacters):
2744         (WebCore::FontCache::prewarm):
2745         (WebCore::fontFamiliesForPrewarming):
2746
2747 2019-07-31  Devin Rousso  <drousso@apple.com>
2748
2749         Web Inspector: Overlay: add page width/height display
2750         https://bugs.webkit.org/show_bug.cgi?id=199369
2751
2752         Reviewed by Joseph Pecoraro.
2753
2754         Show `${width}px x ${height}px` in the corner where the horizontal and vertical rulers meet.
2755         This way, if the rulers shift due to the highlighted content, the page width/height does too.
2756
2757         * inspector/InspectorOverlay.h:
2758         * inspector/InspectorOverlay.cpp:
2759         (WebCore::truncateWithEllipsis):
2760         (WebCore::InspectorOverlay::drawNodeHighlight):
2761         (WebCore::InspectorOverlay::drawQuadHighlight):
2762         (WebCore::InspectorOverlay::drawRulers):
2763         (WebCore::InspectorOverlay::drawElementTitle):
2764
2765 2019-07-31  Youenn Fablet  <youenn@apple.com>
2766
2767         Owners of MultiChannelResampler should make sure that the output bus given to it has the same number of channels
2768         https://bugs.webkit.org/show_bug.cgi?id=200248
2769         <rdar://problem/53411051>
2770
2771         Reviewed by Eric Carlson.
2772
2773         When a track's number of channels changes, MediaStreamAudioSourceNode is expected
2774         to update its MultiChannelResampler and its output number of channels.
2775         MultiChannelResampler expects to have the same number of channels as the output
2776         but it is not always the case since the channel numbers are changed in different threads
2777         and locks do not help there.
2778
2779         Instead, whenever detecting that the number of channels do not match, render silence
2780         and wait for the next rendering where the number of channels should again match.
2781
2782         Add internals API to change the number of channels from 2 to 1 or 1 to 2
2783         to allow testing that code path (iOS only as MacOS audio capture is in UIProcess).
2784         Covered by updated test.
2785
2786         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
2787         (WebCore::MediaElementAudioSourceNode::process):
2788         * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
2789         (WebCore::MediaStreamAudioSourceNode::process):
2790         * platform/audio/MultiChannelResampler.cpp:
2791         (WebCore::MultiChannelResampler::process):
2792         * platform/mediastream/RealtimeMediaSource.h:
2793         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
2794         (WebCore::MockRealtimeAudioSourceMac::reconfigure):
2795         * platform/mock/MockRealtimeAudioSource.cpp:
2796         (WebCore::MockRealtimeAudioSource::setChannelCount):
2797         * platform/mock/MockRealtimeAudioSource.h:
2798         (isType):
2799         * platform/mock/MockRealtimeVideoSource.h:
2800         * testing/Internals.cpp:
2801         (WebCore::Internals::setMockAudioTrackChannelNumber):
2802         * testing/Internals.h:
2803         * testing/Internals.idl:
2804
2805 2019-07-31  Chris Dumez  <cdumez@apple.com>
2806
2807         Element.outerHTML is missing attribute prefixes in some cases in HTML documents
2808         https://bugs.webkit.org/show_bug.cgi?id=200283
2809
2810         Reviewed by Ryosuke Niwa.
2811
2812         When HTML serializing a prefixed element attribute, we should always serialize the
2813         prefix as per [1]. However, our code was only serializing the well-known ones (xml,
2814         xmlns & xlink).
2815
2816         [1] https://html.spec.whatwg.org/#attribute's-serialised-name
2817
2818         Test: fast/dom/Element/outerHTML-prefixed-attribute.html
2819
2820         * editing/MarkupAccumulator.cpp:
2821         (WebCore::htmlAttributeSerialization):
2822         (WebCore::MarkupAccumulator::xmlAttributeSerialization):
2823         (WebCore::MarkupAccumulator::appendAttribute):
2824         * editing/MarkupAccumulator.h:
2825
2826 2019-07-31  Loïc Yhuel  <loic.yhuel@softathome.com>
2827
2828         [GStreamer] Fix printf format warnings for 32-bit build in GST traces
2829         https://bugs.webkit.org/show_bug.cgi?id=200299
2830
2831         Reviewed by Xabier Rodriguez-Calvar.
2832
2833         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2834         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): %zu for size_t
2835         (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered): Ditto
2836         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2837         (webKitWebSrcCreate): G_GUINT64_FORMAT for uint64_t
2838         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp: G_GINT64_FORMAT for int64_t
2839         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp: Ditto
2840
2841 2019-07-31  Andres Gonzalez  <andresg_22@apple.com>
2842
2843         AX: Re-enable accessibility/set-selected-text-range-after-newline.html test.
2844         https://bugs.webkit.org/show_bug.cgi?id=199431
2845         <rdar://problem/52563340>
2846
2847         Reviewed by Chris Fleizach.
2848
2849         - Re-enabled LayoutTests/accessibility/set-selected-text-range-after-newline.html.
2850         - Put back workaround in visiblePositionForIndexUsingCharacterIterator
2851         that is needed for several accessibility issues.
2852         - This workaround was rolled back because it was thought the cause of:
2853         https://bugs.webkit.org/show_bug.cgi?id=199434
2854         It turned out that the actual cause of that hang was unrelated and was
2855         fixed in:
2856         https://bugs.webkit.org/show_bug.cgi?id=199845
2857
2858         * editing/Editing.cpp:
2859         (WebCore::visiblePositionForIndexUsingCharacterIterator):
2860
2861 2019-07-31  Devin Rousso  <drousso@apple.com>
2862
2863         Web Inspector: Second call to setAttributeNS creates non-prefixed attribute
2864         https://bugs.webkit.org/show_bug.cgi?id=200230
2865         <rdar://problem/53712672>
2866
2867         Reviewed by Joseph Pecoraro.
2868
2869         Original patch by Chris Dumez <cdumez@apple.com>.
2870
2871         Test: inspector/dom/attributeModified.html
2872
2873         * dom/Element.cpp:
2874         (WebCore::Element::didAddAttribute):
2875         (WebCore::Element::didModifyAttribute):
2876         (WebCore::Element::didRemoveAttribute):
2877         Use the fully qualified name, not just the local name, when notifying the inspector frontend
2878         about changes to attributes.
2879
2880 2019-07-31  Carlos Garcia Campos  <cgarcia@igalia.com>
2881
2882         [GTK] Datalist element support for TextFieldInputType
2883         https://bugs.webkit.org/show_bug.cgi?id=98934
2884
2885         Reviewed by Michael Catanzaro.
2886
2887         Add support for rendering the arrow indicator of text fields having data list.
2888
2889         * rendering/RenderThemeGtk.cpp:
2890         (WebCore::RenderThemeGtk::paintTextField):
2891         (WebCore::RenderThemeGtk::adjustListButtonStyle const):
2892         (WebCore::RenderThemeGtk::paintListButtonForInput):
2893         (WebCore::RenderThemeGtk::adjustSearchFieldStyle const):
2894         * rendering/RenderThemeGtk.h:
2895
2896 2019-07-30  Tim Horton  <timothy_horton@apple.com>
2897
2898         ASSERTion failure under takeSnapshot after r247846
2899
2900         * page/TextIndicator.cpp:
2901         (WebCore::takeSnapshots):
2902         We now sometimes inflate the scale factor; allow this.
2903
2904 2019-07-30  Saam Barati  <sbarati@apple.com>
2905
2906         [WHLSL] Add a fast path for TypeNamer::insert where we've already seen the type
2907         https://bugs.webkit.org/show_bug.cgi?id=200284
2908
2909         Reviewed by Myles C. Maxfield.
2910
2911         This is a ~27% speedup in the WHLSL::prepare for the compute_boids test.
2912         This optimization makes sense since my previous patch to make UnnamedType
2913         ref counted was also a huge speedup. So the TypeNamer is seeing many
2914         UnnamedTypes which are the same pointer value. On compute_boids, this
2915         makes generateMetalCode ~40ms faster.
2916
2917         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
2918         (WebCore::WHLSL::Metal::TypeNamer::insert):
2919
2920 2019-07-29  Ryosuke Niwa  <rniwa@webkit.org>
2921
2922         WorkerGlobalScope::wrapCryptoKey/unwrapCryptoKey should use local heap objects for replies
2923         https://bugs.webkit.org/show_bug.cgi?id=200179
2924         <rdar://problem/52334658>
2925
2926         Reviewed by Brent Fulgham.
2927
2928         Based on the patch by Jiewen Tan.
2929
2930         WorkerGlobalScope::wrapCryptoKey and WorkerGlobalScope::unwrapCryptoKey had a bug that they could exit
2931         the function before the main thread had finished writing to the result vector passed in to these functions
2932         when the worker's runloop receives MessageQueueTerminated before the main thread finishes writing.
2933
2934         Fixed the bug by creating a new temporary Vector inside a ThreadSafeRefCounted object shared between
2935         the main thread and the worker thread, which extends the lifetime of the Vector until when the worker thread
2936         receives the result or when the main thread finishes writing to the Vector, whichever happens last.
2937
2938         Unfortunately no new tests since there is no reproducible test case, and this crash is highly racy.
2939
2940         * workers/WorkerGlobalScope.cpp:
2941         (WebCore::CryptoBufferContainer): Added.
2942         (WebCore::CryptoBufferContainer::create): Added.
2943         (WebCore::CryptoBufferContainer::buffer): Added.
2944         (WebCore::WorkerGlobalScope::wrapCryptoKey):
2945         (WebCore::WorkerGlobalScope::unwrapCryptoKey):
2946
2947 2019-07-30  Saam Barati  <sbarati@apple.com>
2948
2949         [WHLSL] Checker sets wrong type for property access instruction with an ander
2950         https://bugs.webkit.org/show_bug.cgi?id=200282
2951
2952         Reviewed by Myles C. Maxfield.
2953
2954         We were assigning resulting type based on the base value instead of the ander
2955         of the base value. For example, consider:
2956         ```
2957         struct Point { float x; float y; }
2958         compute main(device Point[] buffer) { buffer[0]; }
2959         ```
2960         
2961         The local variable "buffer" is in the "thread" address space. So we would end up
2962         trying to use the thread address space for "buffer[0]". This caused us to
2963         generate invalid Metal code because we would call a "thread" ander with a
2964         "device" pointer. The fix is to use the "device" address space, which is
2965         the type of the ander we were already setting on this property access instruction.
2966
2967         Test: webgpu/whlsl/device-proper-type-checker.html
2968
2969         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
2970         (WebCore::WHLSL::Checker::finishVisiting):
2971
2972 2019-07-30  Saam Barati  <sbarati@apple.com>
2973
2974         [WHLSL] Make ASTDumper dump types and address spaces
2975         https://bugs.webkit.org/show_bug.cgi?id=200281
2976
2977         Reviewed by Robin Morisset.
2978
2979         This makes it much easier to gain insight into what type resolution
2980         the checker does. I used this logging to debug https://bugs.webkit.org/show_bug.cgi?id=200282
2981
2982         * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h:
2983         (WebCore::WHLSL::AST::TypeAnnotation::isAbstractLeftValue const):
2984         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
2985         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
2986         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
2987         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
2988         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
2989         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
2990         (WebCore::WHLSL::ASTDumper::visit):
2991
2992 2019-07-30  Brent Fulgham  <bfulgham@apple.com>
2993
2994         [FTW] Refactor Direct2D code to follow Cairo's model to support modern WebKit
2995         https://bugs.webkit.org/show_bug.cgi?id=200270
2996
2997         Reviewed by Dean Jackson.
2998
2999         Refactor the Direct2D code in WebCore so that the core routines can be shared
3000         between GraphicsContext and GraphicsContextImpl. Implement PlatformContext,
3001         BackingStoreBackend, and GraphicsContextImpl for the Direct2D engine.
3002        
3003         This patch effectively just moves code around.
3004
3005         * PlatformFTW.cmake:
3006         * platform/graphics/GraphicsContext.h:
3007         * platform/graphics/GraphicsContextImpl.h:
3008         * platform/graphics/ImageSource.cpp:
3009         * platform/graphics/Pattern.h:
3010         * platform/graphics/displaylists/DisplayListRecorder.cpp:
3011         * platform/graphics/displaylists/DisplayListRecorder.h:
3012         * platform/graphics/win/BackingStoreBackendDirect2D.h: Added.
3013         * platform/graphics/win/BackingStoreBackendDirect2DImpl.cpp: Added.
3014         * platform/graphics/win/BackingStoreBackendDirect2DImpl.h: Added.
3015         * platform/graphics/win/Direct2DOperations.cpp: Added.
3016         * platform/graphics/win/Direct2DOperations.h: Added.
3017         * platform/graphics/win/Direct2DUtilities.cpp: Added.
3018         * platform/graphics/win/Direct2DUtilities.h: Added.
3019         * platform/graphics/win/FontCascadeDirect2D.cpp:
3020         * platform/graphics/win/GradientDirect2D.cpp:
3021         * platform/graphics/win/GraphicsContextDirect2D.cpp:
3022         * platform/graphics/win/GraphicsContextImplDirect2D.cpp: Added.
3023         * platform/graphics/win/GraphicsContextImplDirect2D.h: Added.
3024         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
3025         * platform/graphics/win/ImageBufferDataDirect2D.h:
3026         * platform/graphics/win/ImageBufferDirect2D.cpp:
3027         * platform/graphics/win/NativeImageDirect2D.cpp:
3028         * platform/graphics/win/PathDirect2D.cpp:
3029         * platform/graphics/win/PatternDirect2D.cpp:
3030         * platform/graphics/win/PlatformContextDirect2D.cpp: Added.
3031         * platform/graphics/win/PlatformContextDirect2D.h: Added.
3032         * platform/win/DragImageWin.cpp:
3033         * svg/graphics/SVGImage.cpp:
3034
3035 2019-07-30  Myles C. Maxfield  <mmaxfield@apple.com>
3036
3037         REGRESSION(r241288): Text on Yahoo Japan mobile looks too bold
3038         https://bugs.webkit.org/show_bug.cgi?id=200065
3039         <rdar://problem/50912757>
3040
3041         Reviewed by Simon Fraser.
3042
3043         Before r241288, we were mapping Japanese sans-serif to Hiragino Kaku Gothic ProN, which
3044         has a 300 weight and a 600 weight. However, we can't use that font because it's user-installed,
3045         so in r241288 we switched to using Hiragino Sans, which has a 300 weight, a 600 weight, and an
3046         800 weight. According to the CSS font selection algorithm, sites that request a weight of 700
3047         would get the 800 weight instead of the 600 weight, which caused the text to look too heavy.
3048         Therefore, the apparent visual change is from a weight change from 600 to 800.
3049
3050         In general, this is working as intended. However, text on Yahoo Japan looks too heavy in weight
3051         800. Instead, this patch adds a quirk specific to Yahoo Japan that overwrites any font requests
3052         to give them a weight of 600 instead of 700. This way, the lighter font will be used.
3053
3054         No new tests because quirks cannot be tested.
3055
3056         * css/CSSFontSelector.cpp:
3057         (WebCore::resolveGenericFamily):
3058         (WebCore::CSSFontSelector::fontRangesForFamily):
3059         * page/Quirks.cpp:
3060         (WebCore::Quirks::shouldLightenJapaneseBoldSansSerif const):
3061         * page/Quirks.h:
3062
3063 2019-07-31  Simon Fraser  <simon.fraser@apple.com>
3064
3065         [iPadOS] Enable simulated mouse events on iqiyi.com to fix the video controls
3066         https://bugs.webkit.org/show_bug.cgi?id=200322
3067         rdar://problem/53235709
3068
3069         Reviewed by Wenson Hsieh.
3070         
3071         iqiyi.com needs to get mouseMove events for dragging the video scrubber to work.
3072
3073         * page/Quirks.cpp:
3074         (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
3075
3076 2019-07-30  Michael Catanzaro  <mcatanzaro@igalia.com>
3077
3078         Unreviewed, fix GTK build after SoupNetworkSession ownership rework.
3079
3080         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
3081
3082 2019-07-30  Michael Catanzaro  <mcatanzaro@igalia.com>
3083
3084         [GTK] Compilation errors when GL is disabled
3085         https://bugs.webkit.org/show_bug.cgi?id=200223
3086
3087         Unreviewed, keep trying to fix build with -DENABLE_OPENGL=OFF.
3088
3089         The previous commit was sufficient for the 2.24 branch, but on trunk there are more
3090         problems. This doesn't solve all of them, but it gets us closer.
3091
3092         * SourcesGTK.txt:
3093         * platform/graphics/GLContext.h:
3094
3095 2019-07-24  Carlos Garcia Campos  <cgarcia@igalia.com>
3096
3097         [SOUP] Move SoupNetworkSession ownership from NetworkStorageSession to NetworkSession
3098         https://bugs.webkit.org/show_bug.cgi?id=200076
3099
3100         Reviewed by Michael Catanzaro.
3101
3102         Remove the SoupNetworkSession from NetworkStorageSession.
3103
3104         * platform/network/NetworkStorageSession.h:
3105         (WebCore::NetworkStorageSession::cookieStorage const): Return the cookie jar.
3106         * platform/network/StorageSessionProvider.h:
3107         (WebCore::StorageSessionProvider::soupSession const): Temporary add this virtual method that is required by
3108         SocketStreamHandleImplSoup. It will be removed once we switch to libsoup WebSockets API soon.
3109         * platform/network/soup/DNSResolveQueueSoup.cpp:
3110         (WebCore::globalDefaultSoupSessionAccessor): Rework the accessor to return the SoupSession directly since
3111         that's what we really want.
3112         (WebCore::DNSResolveQueueSoup::setGlobalDefaultSoupSessionAccessor):
3113         (WebCore::DNSResolveQueueSoup::updateIsUsingProxy):
3114         (WebCore::DNSResolveQueueSoup::platformResolve):
3115         (WebCore::DNSResolveQueueSoup::resolve):
3116         * platform/network/soup/DNSResolveQueueSoup.h:
3117         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3118         (WebCore::NetworkStorageSession::NetworkStorageSession): Create and setup the default cookie jar.
3119         (WebCore::NetworkStorageSession::~NetworkStorageSession): Only disconnect the cookie jar signals.
3120         (WebCore::NetworkStorageSession::setCookieStorage): Update the cookie jar, now we know it's always a new one.
3121         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
3122         (WebCore::SocketStreamHandleImpl::create): Use the new virtual method from StorageSessionProvider to get the SoupSession.
3123         * platform/network/soup/SoupNetworkSession.cpp:
3124         (WebCore::SoupNetworkSession::SoupNetworkSession): Remove the SoupCookieJar parameter.
3125         * platform/network/soup/SoupNetworkSession.h:
3126
3127 2019-07-30  Michael Catanzaro  <mcatanzaro@igalia.com>
3128
3129         [GTK] Compilation errors when GL is disabled
3130         https://bugs.webkit.org/show_bug.cgi?id=200223
3131
3132         Unreviewed, fix build with -DENABLE_OPENGL=OFF.
3133
3134         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3135         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
3136
3137 2019-07-29  Eric Carlson  <eric.carlson@apple.com>
3138
3139         MediaSource.isTypeSupported claims FLAC-in-MP4 support on iOS and macOS, but plays silence
3140         https://bugs.webkit.org/show_bug.cgi?id=198583
3141         <rdar://problem/51487853>
3142
3143         Reviewed by Maciej Stachowiak.
3144
3145         * platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.h:
3146         (WebCore::AVStreamDataParserMIMETypeCache::canDecodeType): Use anParseExtendedMIMEType:
3147         when it is available.
3148
3149 2019-07-29  Zalan Bujtas  <zalan@apple.com>
3150
3151         [LFC][TFC] <table> initiates a principal block container box called table wrapper box.
3152         https://bugs.webkit.org/show_bug.cgi?id=200198
3153         <rdar://problem/53623803>
3154
3155         Reviewed by Antti Koivisto.
3156
3157         The table wrapper box contains the table box itself and any caption boxes.
3158
3159         * layout/layouttree/LayoutBox.cpp:
3160         (WebCore::Layout::Box::isBlockContainerBox const):
3161         * layout/layouttree/LayoutBox.h:
3162         (WebCore::Layout::Box::isTableCaption const):
3163         (WebCore::Layout::Box::isTableRow const):
3164         (WebCore::Layout::Box::isTableCell const):
3165         * layout/layouttree/LayoutContainer.h:
3166         * layout/layouttree/LayoutTreeBuilder.cpp:
3167         (WebCore::Layout::appendChild):
3168         (WebCore::Layout::TreeBuilder::createLayoutBox):
3169         (WebCore::Layout::TreeBuilder::createTableStructure):
3170         (WebCore::Layout::TreeBuilder::createSubTree):
3171         (WebCore::Layout::outputLayoutBox):
3172         * layout/layouttree/LayoutTreeBuilder.h:
3173
3174 2019-07-29  Justin Fan  <justin_fan@apple.com>
3175
3176         [WebGPU] Replace Vectors with HashSets for tracking resources used by GPUCommandBuffer
3177         https://bugs.webkit.org/show_bug.cgi?id=200200
3178
3179         Reviewed by Myles C. Maxfield.
3180
3181         Resources bound to a command buffer or bind group only need be tracked once rather than once per sub-view. 
3182         This patch cuts GPUQueue.submit validation from 2-12 ms down to ~0 when drawing 12000 triangles in Animometer.
3183
3184         Covered by existing tests; no behavior change expected.
3185
3186         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp: Removed unused variable.
3187         * platform/graphics/gpu/GPUBindGroup.h:
3188         (WebCore::GPUBindGroup::boundBuffers const):
3189         (WebCore::GPUBindGroup::boundTextures const):
3190         * platform/graphics/gpu/GPUCommandBuffer.h:
3191         (WebCore::GPUCommandBuffer::usedBuffers const):
3192         (WebCore::GPUCommandBuffer::usedTextures const):
3193         (WebCore::GPUCommandBuffer::useBuffer):
3194         (WebCore::GPUCommandBuffer::useTexture):
3195         * platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm:
3196         (WebCore::GPUBindGroup::tryCreate):
3197         (WebCore::GPUBindGroup::GPUBindGroup):
3198
3199 2019-07-29  Zalan Bujtas  <zalan@apple.com>
3200
3201         [LFC][TFC] Introduce Box::establishesTableFormattingContext
3202         https://bugs.webkit.org/show_bug.cgi?id=200060
3203
3204         Reviewed by Antti Koivisto.
3205
3206         https://www.w3.org/TR/CSS22/tables.html
3207
3208         The table generates a principal block container box called the table wrapper box that contains the table box itself and any caption boxes.
3209         The table box is a block-level box that contains the table's internal table boxes.
3210         The table wrapper box is block-level for 'display: table', and inline-level; for 'display: inline-table'. The table wrapper box establishes a block
3211         formatting context, and the table box establishes a table formatting context."
3212
3213         * layout/layouttree/LayoutBox.cpp:
3214         (WebCore::Layout::Box::establishesFormattingContext const):
3215         (WebCore::Layout::Box::establishesTableFormattingContext const):
3216         (WebCore::Layout::Box::isBlockLevelBox const):
3217         (WebCore::Layout::Box::isInlineLevelBox const):
3218         (WebCore::Layout::Box::isBlockContainerBox const):
3219         * layout/layouttree/LayoutBox.h:
3220         (WebCore::Layout::Box::isTableWrapperBox const):
3221         (WebCore::Layout::Box::isTableBox const):
3222
3223 2019-07-29  Zalan Bujtas  <zalan@apple.com>
3224
3225         [ContentChangeObserver] didFinishContentChangeObserving should include the type of content change.
3226         https://bugs.webkit.org/show_bug.cgi?id=200247
3227         <rdar://problem/53681149>
3228
3229         Reviewed by Simon Fraser.
3230
3231         Now we don't have to query the content change observer for the type of the change in the callback.
3232
3233         * loader/EmptyClients.h:
3234         * page/ChromeClient.h:
3235         * page/ios/ContentChangeObserver.cpp:
3236         (WebCore::ContentChangeObserver::adjustObservedState):
3237         * page/ios/EventHandlerIOS.mm:
3238         (WebCore::EventHandler::mouseMoved):
3239
3240 2019-07-29  Sergei Glazunov  <glazunov@google.com>
3241
3242         The maximum subframe count check should not be skipped for empty URLs.
3243         https://bugs.webkit.org/show_bug.cgi?id=200032
3244
3245         Reviewed by Ryosuke Niwa.
3246
3247         Move the check closer to the actual frame creation code in `loadSubframe`.
3248
3249         Test: fast/dom/connected-subframe-counter-overflow.html
3250
3251         * dom/Document.cpp:
3252         (WebCore::Document::prepareForDestruction): Assert that all child frames have been detached.
3253         * html/HTMLFrameElementBase.cpp:
3254         (WebCore::HTMLFrameElementBase::canLoad const):
3255         (WebCore::HTMLFrameElementBase::canLoadURL const):
3256         * html/HTMLFrameOwnerElement.cpp:
3257         (WebCore::HTMLFrameOwnerElement::canAddSubframe const): Deleted.
3258         * html/HTMLFrameOwnerElement.h:
3259         * html/HTMLPlugInImageElement.cpp:
3260         (WebCore::HTMLPlugInImageElement::canLoadURL const):
3261         * loader/SubframeLoader.cpp:
3262         (WebCore::SubframeLoader::loadSubframe):
3263
3264 2019-07-29  Zalan Bujtas  <zalan@apple.com>
3265
3266         [ContentChangeObserver] ChromeClient::observedContentChange() name is misleading
3267         https://bugs.webkit.org/show_bug.cgi?id=200238
3268         <rdar://problem/53677038>
3269
3270         Reviewed by Simon Fraser.
3271
3272         This function indicates that we've finished observing content changes.
3273
3274         * loader/EmptyClients.h:
3275         * page/ChromeClient.h:
3276         * page/ios/ContentChangeObserver.cpp:
3277         (WebCore::ContentChangeObserver::adjustObservedState):
3278         * page/ios/EventHandlerIOS.mm:
3279         (WebCore::EventHandler::mouseMoved):
3280
3281 2019-07-29  Sam Weinig  <weinig@apple.com>
3282
3283         StringBuilder::append(makeString(...)) is inefficient
3284         https://bugs.webkit.org/show_bug.cgi?id=200034
3285
3286         Reviewed by Saam Barati.
3287
3288         Replace uses of StringBuilder::append(makeString(...)) with StringBuilder::flexiblAppend(...).
3289         Where possible, also merged consecutive calls to StringBuilder::append(...) into a single call
3290         to StringBuilder::flexiblAppend(...) to avoid unnecessary additional overflow checks and resizes.
3291         Also where possible, replaced StringBuilder with makeString() if no branching was used during
3292         construction.
3293         
3294         A lot more can be done to improve the efficiency of StringBuilder use in the WHLSL code including:
3295         - Using StringView more prevelently, especially when passing a substring to the StringBuilder.
3296         - Passing existing StringBuilders to functions for them to use rather than returning a String and 
3297           then appending that to another StringBuilder.
3298         - Using custom StringTypeAdapters for generated names, rather than storing them as Strings. 
3299
3300         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
3301         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceHelperTypes):
3302         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceSignature):
3303         (WebCore::WHLSL::Metal::EntryPointScaffolding::builtInsSignature):
3304         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledInputPath):
3305         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledOutputPath):
3306         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpackResourcesAndNamedBuiltIns):
3307         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::helperTypes):
3308         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::signature):
3309         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::unpack):
3310         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::pack):
3311         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::helperTypes):
3312         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::signature):
3313         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::unpack):
3314         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::pack):
3315         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::signature):
3316         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
3317         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::visit):
3318         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
3319         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
3320         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitLoop):
3321         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp:
3322         (WebCore::WHLSL::Metal::generateMetalCodeShared):
3323         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
3324         (WebCore::WHLSL::Metal::writeNativeFunction):
3325         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
3326         (WebCore::WHLSL::Metal::MetalTypeDeclarationWriter::visit):
3327         (WebCore::WHLSL::Metal::TypeNamer::emitUnnamedTypeDefinition):
3328         (WebCore::WHLSL::Metal::TypeNamer::emitNamedTypeDefinition):
3329         (WebCore::WHLSL::Metal::TypeNamer::metalTypes):
3330         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
3331         (WebCore::WHLSL::Types::appendNameTo):
3332         * rendering/RenderLayerCompositor.cpp:
3333         (WebCore::RenderLayerCompositor::logLayerInfo):
3334         * testing/Internals.cpp:
3335         (WebCore::Internals::ongoingLoadsDescriptions const):
3336
3337 2019-07-29  Megan Gardner  <megan_gardner@apple.com>
3338
3339         Force Reveal to always lookup from menu
3340         https://bugs.webkit.org/show_bug.cgi?id=200186
3341         <rdar://problem/52967940>
3342
3343         Reviewed by Tim Horton.
3344
3345         We currently only have the 'lookup' menu item, so we should always force the 'lookup' action from it.
3346
3347         Reveal is not currently testable.
3348
3349         * editing/cocoa/DictionaryLookup.mm:
3350         (WebCore::showPopupOrCreateAnimationController):
3351
3352 2019-07-29  Simon Fraser  <simon.fraser@apple.com>
3353
3354         REGRESSION (r246899): Subtitles show twice when controls show/hide on hulu.com
3355         https://bugs.webkit.org/show_bug.cgi?id=200187
3356         rdar://problem/53511121
3357
3358         Reviewed by Zalan Bujtas.
3359
3360         When a layer that painted into shared backing moved, we'd fail to repaint its old position
3361         because the RenderLayer's repaint rects are cleared via BackingSharingState::updateBeforeDescendantTraversal().
3362
3363         Recomputing repaint rects is expensive, so we only want to do it when necessary, which is for
3364         layers that start and stop sharing (going into and out of compositing already recomputes them).
3365         So add logic to RenderLayerBacking::setBackingSharingLayers() that recomputes repaint rects
3366         on layers that will no longer use shared backing, and those that are newly using shared
3367         backing.
3368
3369         Test: compositing/shared-backing/backing-sharing-repaint.html
3370
3371         * rendering/RenderLayer.cpp:
3372         (WebCore::RenderLayer::setBackingProviderLayer):
3373         * rendering/RenderLayerBacking.cpp:
3374         (WebCore::RenderLayerBacking::setBackingSharingLayers):
3375         * rendering/RenderLayerCompositor.cpp:
3376         (WebCore::RenderLayerCompositor::BackingSharingState::appendSharingLayer):
3377         (WebCore::RenderLayerCompositor::updateBacking):
3378
3379 2019-07-29  Simon Fraser  <simon.fraser@apple.com>
3380
3381         The touch-action property was ignored on replaced elements (canvas, img etc)
3382         https://bugs.webkit.org/show_bug.cgi?id=200205
3383         rdar://problem/53331224
3384
3385         Reviewed by Antti Koivisto.
3386
3387         The event region painting code didn't handle replaced elements correctly,
3388         causing touch-action to get ignored for <canvas>, <img> etc. Fix by handling
3389         region painting in RenderReplaced.