Mangled WHLSL names don't need to allocate Strings
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-08-04  Sam Weinig  <weinig@apple.com>
2
3         Mangled WHLSL names don't need to allocate Strings
4         https://bugs.webkit.org/show_bug.cgi?id=200429
5
6         Reviewed by Saam Barati.
7
8         To avoid allocating strings for each mangled name used to transform WHLSL to Metal, which we'd
9         like to avoid since it is both unnecessarily expensive in time and space, we can instead just
10         store the unique integer identifier that was being used to construct the String. 
11         
12         Since the existing mangled names were all of the form "prefix" + unsigned integer value (where 
13         prefix could be "type", "enumerationMember", "structureElement", "variable" or "function") we
14         strongly type the integer by storing it in a struct (MangledVariableName, MangledTypeName, etc.)
15         When the full name is actually needed, StringTypeAdapter's specialized for the structs are
16         used to write directly into the preallocated buffers of StringBuilders or makeString().
17
18         * Modules/webgpu/WHLSL/Metal/WHLSLMangledNames.h: Added.
19         (WebCore::WHLSL::Metal::MangledVariableName):
20         (WebCore::WHLSL::Metal::MangledTypeName):
21         (WebCore::WHLSL::Metal::MangledStructureElementName):
22         (WebCore::WHLSL::Metal::MangledEnumerationMemberName):
23         (WebCore::WHLSL::Metal::MangledFunctionName):
24         Adds structs for each type of mangled name and StringTypeAdapter specializations for
25         each to allow their use in StringBuilder.flexibleAppend() or makeString(). 
26         
27         Additionally, a Variant, MangledOrNativeTypeName, of MangledTypeName and String is 
28         declared to allow for the few cases where a native type (e.g. float4) is needed. The
29         StringTypeAdapter for MangledOrNativeTypeName could be generalized for any Variant
30         in the future, but I left it non-general for now, as it is non-obvious if one would
31         want to store Variant<Types...>, and have each member function construct a temporary
32         StringTypeAdapter, or store a Variant<StringTypeAdapter<Types>...> and perform conversion
33         in the construction.
34
35         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
36         (WebCore::WHLSL::Metal::EntryPointScaffolding::EntryPointScaffolding):
37         (WebCore::WHLSL::Metal::internalTypeForSemantic):
38         (WebCore::WHLSL::Metal::EntryPointScaffolding::builtInsSignature):
39         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledInputPath):
40         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::VertexEntryPointScaffolding):
41         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::signature):
42         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::pack):
43         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::FragmentEntryPointScaffolding):
44         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::signature):
45         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::pack):
46         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::ComputeEntryPointScaffolding):
47         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::signature):
48         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::pack):
49         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h:
50         (WebCore::WHLSL::Metal::EntryPointScaffolding::parameterVariables):
51         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
52         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::FunctionDeclarationWriter):
53         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::visit):
54         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
55         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::generateNextVariableName):
56         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValueWithNullability):
57         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValue):
58         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendLeftValue):
59         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValue):
60         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValueAndNullability):
61         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastLeftValue):
62         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
63         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitLoop):
64         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::RenderFunctionDefinitionWriter):
65         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::createEntryPointScaffolding):
66         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::ComputeFunctionDefinitionWriter):
67         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::createEntryPointScaffolding):
68         (WebCore::WHLSL::Metal::sharedMetalFunctions):
69         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.h:
70         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h:
71         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
72         (WebCore::WHLSL::Metal::writeNativeFunction):
73         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h:
74         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
75         (WebCore::WHLSL::Metal::BaseTypeNameNode::BaseTypeNameNode):
76         (WebCore::WHLSL::Metal::BaseTypeNameNode::mangledName const):
77         (WebCore::WHLSL::Metal::ArrayTypeNameNode::ArrayTypeNameNode):
78         (WebCore::WHLSL::Metal::ArrayReferenceTypeNameNode::ArrayReferenceTypeNameNode):
79         (WebCore::WHLSL::Metal::PointerTypeNameNode::PointerTypeNameNode):
80         (WebCore::WHLSL::Metal::ReferenceTypeNameNode::ReferenceTypeNameNode):
81         (WebCore::WHLSL::Metal::MetalTypeDeclarationWriter::MetalTypeDeclarationWriter):
82         (WebCore::WHLSL::Metal::TypeNamer::metalTypeDeclarations):
83         (WebCore::WHLSL::Metal::TypeNamer::emitNamedTypeDefinition):
84         (WebCore::WHLSL::Metal::TypeNamer::mangledNameForType):
85         (WebCore::WHLSL::Metal::TypeNamer::mangledNameForEnumerationMember):
86         (WebCore::WHLSL::Metal::TypeNamer::mangledNameForStructureElement):
87         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.h:
88         (WebCore::WHLSL::Metal::TypeNamer::generateNextTypeName):
89         (WebCore::WHLSL::Metal::TypeNamer::generateNextStructureElementName):
90         (WebCore::WHLSL::Metal::TypeNamer::generateNextEnumerationMemberName):
91         * Modules/webgpu/WHLSL/WHLSLPrepare.h:
92         Replace uses of String with the appropriate mangled name type.
93
94         * WebCore.xcodeproj/project.pbxproj:
95         Add WHLSLMangledNames.h
96
97         * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
98         (WebCore::trySetFunctions):
99         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
100         (WebCore::trySetFunctions):
101         Convert the mangled names to Strings for passing to Metal API. NOTE: We could avoid having the
102         toString() member function on MangledFunctionName if we allowed makeString() to take a single
103         argument.
104
105 2019-08-04  Chris Dumez  <cdumez@apple.com>
106
107         Ping loads should not prevent page caching
108         https://bugs.webkit.org/show_bug.cgi?id=200418
109         <rdar://problem/53901632>
110
111         Reviewed by Darin Adler.
112
113         We normally prevent page caching if there were any pending subresource loads when navigating,
114         to avoid caching partial / broken content. However, this should not apply to Ping / Beacon
115         loads since those do not impact page rendering and can outlive the page.
116
117         Tests: http/tests/navigation/page-cache-pending-ping-load-cross-origin.html
118                http/tests/navigation/page-cache-pending-ping-load-same-origin.html
119
120         * history/PageCache.cpp:
121         (WebCore::PageCache::addIfCacheable):
122         After we've fired the 'pagehide' event in each frame, stop all the loads again. This is needed
123         since pages are allowed to start ping / beacon loads in their 'pagehide' handlers. If we do not
124         stop those loads, then the next call to canCachePage() would fail because the DocumentLoader is
125         still loading. Note that we're not actually preventing these ping loads from hitting the server
126         since we never cancel page loads and those can outlive their page.
127
128         * loader/DocumentLoader.cpp:
129         (WebCore::shouldPendingCachedResourceLoadPreventPageCache):
130         (WebCore::areAllLoadersPageCacheAcceptable):
131         Make sure that Ping / Beacon / Prefetches / Icon loads do not prevent page caching.
132
133         (WebCore::DocumentLoader::addSubresourceLoader):
134         Tweak assertion that was incorrect since we actually allow ping / beacon loads when the
135         document is about to enter PageCache (while firing pagehide event).
136
137 2019-08-04  Zalan Bujtas  <zalan@apple.com>
138
139         [LFC][TFC] Create formatting context/state.
140         https://bugs.webkit.org/show_bug.cgi?id=200428
141         <rdar://problem/53913625>
142
143         Reviewed by Antti Koivisto.
144
145         * layout/LayoutState.cpp:
146         (WebCore::Layout::LayoutState::createFormattingStateForFormattingRootIfNeeded):
147         (WebCore::Layout::LayoutState::createFormattingContext):
148
149 2019-08-04  Zalan Bujtas  <zalan@apple.com>
150
151         [LFC] Cleanup preferred width computation
152         https://bugs.webkit.org/show_bug.cgi?id=200426
153         <rdar://problem/53912607>
154
155         Reviewed by Antti Koivisto.
156
157         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
158         while the other is in the formatting context's state where the box lives.
159
160         <div style="position: absolute"><div style="float: left; border: 1px solid green">foobar</div></div>
161
162         The float box participates in the formatting context established by the absolutely position box, but it also establishes an inline formatting context.
163         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.
164         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
165         the box lives (which is different from the one it establishes).
166
167         This and the "remove the formatting context type classes from the tree" changes open up interesting optimization opportunities.
168         Here is a very simple case:
169         <div style="display: inline-block; width: auto;">
170           <div style="float: left">some text</div>
171           <div style="float: left">some super long .... text</div>
172           <div></div>
173         </div>
174         In order to lay out this content properly, we
175         1. Compute the min/max width of the first float (expensive text measuring)
176         2. Compute the min/max width of the second float (some more expensive text measuring)
177         3. Compute the min/max width of the inline-block (that is pretty much the 2 float's min/max)
178         4. Lay out the 2 floats, the empty div and the inline-block using these min/max width pairs.
179
180         Now if the inline-block box's display value is changed to "block" and the positioning is to absolute (style="display: box; position: absolute;")
181         we currently(on trunk) tear down the render tree, build a new one and run all the steps again from #1 to #4.
182
183         In LFC, we start with the following layout tree
184         <container> -> block formatting context
185           <container> -> inline formatting context
186             <anonymous inline box>
187           <container> -> inline formatting context
188             <anonymous inline box>
189           <container> -> inline formatting context
190         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
191         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).
192
193         Surprisingly the final layout produces the exact same "display boxes" as the original layout.
194
195         * layout/FormattingContext.h:
196         (WebCore::Layout::FormattingContext::IntrinsicWidthConstraints::expand):
197         * layout/FormattingContextGeometry.cpp:
198         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
199         * layout/FormattingState.h:
200         (WebCore::Layout::FormattingState::setIntrinsicWidthConstraints):
201         (WebCore::Layout::FormattingState::intrinsicWidthConstraints const):
202         (WebCore::Layout::FormattingState::setIntrinsicWidthConstraintsForBox):
203         (WebCore::Layout::FormattingState::clearIntrinsicWidthConstraints):
204         (WebCore::Layout::FormattingState::intrinsicWidthConstraintsForBox const):
205         * layout/blockformatting/BlockFormattingContext.cpp:
206         (WebCore::Layout::BlockFormattingContext::computedIntrinsicWidthConstraints const):
207         (WebCore::Layout::BlockFormattingContext::computeIntrinsicWidthConstraints const): Deleted.
208         * layout/blockformatting/BlockFormattingContext.h:
209         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
210         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
211         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraintsNeedChildrenWidth): Deleted.
212         * layout/displaytree/DisplayBox.h:
213         (WebCore::Display::Box::horizontalMarginBorderAndPadding const):
214         * layout/inlineformatting/InlineFormattingContext.cpp:
215         (WebCore::Layout::nextInPreOrder):
216         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints const):
217         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot const):
218         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const): Deleted.
219         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFloatBox const): Deleted.
220         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForInlineBlock const): Deleted.
221         * layout/inlineformatting/InlineFormattingContext.h:
222         * layout/tableformatting/TableFormattingContext.cpp:
223         (WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints const):
224         * layout/tableformatting/TableFormattingContext.h:
225
226 2019-08-03  Devin Rousso  <drousso@apple.com>
227
228         Web Inspector: DOM: add a special breakpoint for "All Events"
229         https://bugs.webkit.org/show_bug.cgi?id=200285
230
231         Reviewed by Joseph Pecoraro.
232
233         Similar to the existing "All Requests" breakpoint, there should be a way to set a breakpoint
234         that would pause for any DOM event, regardless of the event's name. This is useful for
235         situations where the event name isn't known, or where one simply want's to pause on the next
236         entry to the event loop.
237
238         Along these lines, make the "requestAnimationFrame", "setTimeout", and "setInterval"
239         event breakpoints into special breakpoints that can be added/removed via the create
240         breakpoint context menu. This simplifies the process for setting these breakpoints, and also
241         makes them more discoverable (most people wouldn't consider them to be "events").
242
243         Tests: inspector/dom/breakpoint-for-event-listener.html
244                inspector/dom-debugger/event-animation-frame-breakpoints.html
245                inspector/dom-debugger/event-breakpoint-with-navigation.html
246                inspector/dom-debugger/event-interval-breakpoints.html
247                inspector/dom-debugger/event-listener-breakpoints.html
248                inspector/dom-debugger/event-timeout-breakpoints.html
249
250         * inspector/agents/InspectorDOMDebuggerAgent.h:
251         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
252         (WebCore::InspectorDOMDebuggerAgent::disable):
253         (WebCore::InspectorDOMDebuggerAgent::frameDocumentUpdated):
254         (WebCore::InspectorDOMDebuggerAgent::setEventBreakpoint):
255         (WebCore::InspectorDOMDebuggerAgent::removeEventBreakpoint):
256         (WebCore::InspectorDOMDebuggerAgent::willHandleEvent):
257         (WebCore::InspectorDOMDebuggerAgent::willFireTimer):
258         (WebCore::InspectorDOMDebuggerAgent::willFireAnimationFrame):
259         (WebCore::InspectorDOMDebuggerAgent::discardBindings): Deleted.
260         Make `eventName` optional for `addEventBreakpoint`/`removeEventBreakpoint`. When omitted,
261         the corresponding breakpoint that is added/removed is treated as a global breakpoint that
262         applies to all events of that type (e.g. a global `listener` breakpoint would pause for any
263         event that is fired).
264
265 2019-08-03  Zalan Bujtas  <zalan@apple.com>
266
267         [LFC] Remove formatting context type leaf classes
268         https://bugs.webkit.org/show_bug.cgi?id=200224
269         <rdar://problem/53661907>
270
271         Reviewed by Antti Koivisto.
272
273         Let's keep the layout tree formatting context type independent.
274
275         * Sources.txt:
276         * WebCore.xcodeproj/project.pbxproj:
277         * layout/inlineformatting/InlineFormattingContext.cpp:
278         (WebCore::Layout::InlineFormattingContext::layout const):
279         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
280         (WebCore::Layout::InlineFormattingContext::initializeMarginBorderAndPaddingForGenericInlineBox const):
281         (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
282         * layout/inlineformatting/InlineFormattingContext.h:
283         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
284         (WebCore::Layout::inlineItemWidth):
285         (WebCore::Layout::LineLayout::placeInlineItem):
286         * layout/inlineformatting/InlineItem.h:
287         * layout/inlineformatting/InlineTextItem.cpp:
288         (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
289         (WebCore::Layout::InlineTextItem::InlineTextItem):
290         (WebCore::Layout::InlineTextItem::split const):
291         * layout/inlineformatting/InlineTextItem.h:
292         (WebCore::Layout::InlineTextItem::inlineBox const): Deleted.
293         * layout/inlineformatting/text/TextUtil.cpp:
294         (WebCore::Layout::TextUtil::width):
295         (WebCore::Layout::TextUtil::split):
296         * layout/inlineformatting/text/TextUtil.h:
297         * layout/layouttree/LayoutBox.cpp:
298         (WebCore::Layout::Box::Box):
299         (WebCore::Layout::Box::~Box):
300         (WebCore::Layout::Box::formattingContextRoot const):
301         (WebCore::Layout::Box::setTextContent):
302         (WebCore::Layout::Box::hasTextContent const):
303         (WebCore::Layout::Box::textContent const):
304         (WebCore::Layout::Box::replaced const):
305         (WebCore::Layout::Box::replaced):
306         (WebCore::Layout::Box::rareDataMap):
307         (WebCore::Layout::Box::rareData const):
308         (WebCore::Layout::Box::ensureRareData):
309         (WebCore::Layout::Box::removeRareData):
310         * layout/layouttree/LayoutBox.h:
311         (WebCore::Layout::Box::isLineBreakBox const):
312         (WebCore::Layout::Box::hasRareData const):
313         (WebCore::Layout::Box::setHasRareData):
314         (WebCore::Layout::Box::isInlineBox const): Deleted.
315         (WebCore::Layout::Box::replaced const): Deleted.
316         (WebCore::Layout::Box::replaced): Deleted.
317         * layout/layouttree/LayoutContainer.h:
318         (WebCore::Layout::Container::firstChild const): Deleted.
319         (WebCore::Layout::Container::lastChild const): Deleted.
320         (WebCore::Layout::Container::hasChild const): Deleted.
321         (WebCore::Layout::Container::hasInFlowChild const): Deleted.
322         (WebCore::Layout::Container::hasInFlowOrFloatingChild const): Deleted.
323         (WebCore::Layout::Container::outOfFlowDescendants const): Deleted.
324         * layout/layouttree/LayoutInlineBox.cpp: Removed.
325         * layout/layouttree/LayoutInlineBox.h: Removed.
326         * layout/layouttree/LayoutLineBreakBox.cpp: Removed.
327         * layout/layouttree/LayoutLineBreakBox.h: Removed.
328         * layout/layouttree/LayoutTreeBuilder.cpp:
329         (WebCore::Layout::TreeBuilder::createLayoutBox):
330         (WebCore::Layout::outputLayoutBox):
331
332 2019-08-03  Zalan Bujtas  <zalan@apple.com>
333
334         [LFC] Remove formatting context type container classes.
335         https://bugs.webkit.org/show_bug.cgi?id=200202
336
337         Reviewed by Antti Koivisto.
338
339         These are formatting context specific classes. Let's try to have a layout tree without such types.
340
341         * Sources.txt:
342         * WebCore.xcodeproj/project.pbxproj:
343         * layout/blockformatting/BlockFormattingContext.cpp:
344         (WebCore::Layout::BlockFormattingContext::computeIntrinsicWidthConstraints const):
345         * layout/inlineformatting/InlineFormattingContext.cpp:
346         (WebCore::Layout::InlineFormattingContext::layout const):
347         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPaddingForInlineContainer const):
348         * layout/inlineformatting/InlineFormattingContext.h:
349         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
350         (WebCore::Layout::InlineFormattingContext::InlineLayout::layout const):
351         * layout/inlineformatting/InlineLine.cpp:
352         (WebCore::Layout::Line::appendTextContent):
353         * layout/layouttree/LayoutBlockContainer.cpp: Removed.
354         * layout/layouttree/LayoutBlockContainer.h: Removed.
355         * layout/layouttree/LayoutBox.cpp:
356         (WebCore::Layout::Box::establishesInlineFormattingContext const):
357         (WebCore::Layout::Box::establishesInlineFormattingContextOnly const):
358         (WebCore::Layout::Box::formattingContextRoot const):
359         * layout/layouttree/LayoutBox.h:
360         (WebCore::Layout::Box::isBlockContainer const):
361         (WebCore::Layout::Box::isInlineContainer const):
362         (WebCore::Layout::Box::isInlineBox const):
363         (WebCore::Layout::Box::establishesInlineFormattingContext const): Deleted.
364         (WebCore::Layout::Box::establishesInlineFormattingContextOnly const): Deleted.
365         * layout/layouttree/LayoutInlineContainer.cpp: Removed.
366         * layout/layouttree/LayoutInlineContainer.h: Removed.
367         * layout/layouttree/LayoutIterator.h:
368         (WebCore::Layout::LayoutBoxTraversal::firstChild):
369         * layout/layouttree/LayoutTreeBuilder.cpp:
370         (WebCore::Layout::TreeBuilder::createLayoutTree):
371         (WebCore::Layout::TreeBuilder::createLayoutBox):
372         (WebCore::Layout::TreeBuilder::createTableStructure):
373         (WebCore::Layout::outputLayoutBox):
374         * layout/layouttree/LayoutTreeBuilder.h:
375         * page/FrameViewLayoutContext.cpp:
376         (WebCore::layoutUsingFormattingContext):
377
378 2019-08-02  Robin Morisset  <rmorisset@apple.com>
379
380         [WHLSL] Avoid visiting the full AST in computeDimensions
381         https://bugs.webkit.org/show_bug.cgi?id=200410
382
383         Reviewed by Myles C. Maxfield.
384
385         Avoid visiting the full AST in computeDimensions
386         This cuts the time spent in computeDimensions on compute_boids.html from about 2ms to about 0.002ms.
387
388         No new tests as there is no functional change intended.
389
390         * Modules/webgpu/WHLSL/WHLSLComputeDimensions.cpp:
391         (WebCore::WHLSL::computeDimensions):
392         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
393
394 2019-08-02  Ryosuke Niwa  <rniwa@webkit.org>
395
396         Ref Frame in DOMWindow::screen* functions
397         https://bugs.webkit.org/show_bug.cgi?id=200409
398
399         Reviewed by Simon Fraser.
400
401         Ref Frame in the following functions.
402
403         * page/DOMWindow.cpp:
404         (WebCore::DOMWindow::innerHeight const):
405         (WebCore::DOMWindow::innerWidth const):
406         (WebCore::DOMWindow::screenX const):
407         (WebCore::DOMWindow::screenY const):
408         (WebCore::DOMWindow::scrollX const):
409         (WebCore::DOMWindow::scrollY const):
410
411 2019-08-02  Mark Lam  <mark.lam@apple.com>
412
413         [ARM64E] Harden the diversity of the DOMJIT::Signature::unsafeFunction pointer.
414         https://bugs.webkit.org/show_bug.cgi?id=200292
415         <rdar://problem/53706881>
416
417         Reviewed by Geoffrey Garen.
418
419         * bindings/scripts/CodeGeneratorJS.pm:
420         (GenerateImplementation):
421         - Update to work with the new DOMJIT::Signature constructor.
422
423         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
424         - Re-base test results.
425
426 2019-08-02  Keith Rollin  <krollin@apple.com>
427
428         Consistently use Obj-C boolean literals
429         https://bugs.webkit.org/show_bug.cgi?id=200405
430         <rdar://problem/53880043>
431
432         Reviewed by Simon Fraser, Joseph Pecoraro.
433
434         There are places where we use equivalent but different expressions for
435         Obj-C boolean objects. For example, we use both [NSNumber
436         numberWithBool:YES] and @YES. There are places where both are used in
437         the same function, such as -[WebPreferences initialize]. The boolean
438         literal is in greater use and is more succinct, so standardize on
439         that. Also, change @(YES/NO) to @YES/NO.
440
441         No new tests -- no new or changed functionality.
442
443         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
444         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
445         * platform/graphics/cv/ImageTransferSessionVT.mm:
446         (WebCore::ImageTransferSessionVT::ImageTransferSessionVT):
447         (WebCore::ImageTransferSessionVT::setSize):
448         (WebCore::ImageTransferSessionVT::ioSurfacePixelBufferCreationOptions):
449         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
450         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferPool):
451         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
452         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
453         * platform/network/mac/ResourceHandleMac.mm:
454         (WebCore::ResourceHandle::applySniffingPoliciesIfNeeded):
455
456 2019-08-02  Andres Gonzalez  <andresg_22@apple.com>
457
458         Add accessibility object method to determine whether an element is inside a table cell. Needed for iOS accessibility client.
459         https://bugs.webkit.org/show_bug.cgi?id=200394
460         <rdar://problem/52914964>
461
462         Reviewed by Chris Fleizach.
463
464         Explicitly returning BOOL to avoid error in some compiler configurations.
465         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
466         (-[WebAccessibilityObjectWrapper _accessibilityIsInTableCell]):
467
468 2019-08-02  Devin Rousso  <drousso@apple.com>
469
470         Web Inspector: fix inverted check in InspectorDOMStorageAgent::enable
471         Followup to r248179.
472
473         Rubber-stamped by Joseph Pecoraro.
474
475         * inspector/agents/InspectorDOMStorageAgent.cpp:
476         (WebCore::InspectorDOMStorageAgent::enable):
477
478 2019-08-02  Fujii Hironori  <Hironori.Fujii@sony.com>
479
480         [Curl] Crash while destructing a URL in ~SocketStreamHandle due to data race
481         https://bugs.webkit.org/show_bug.cgi?id=200378
482
483         Reviewed by Ross Kirsling.
484
485         URL::isolatedCopy() is called in the worker thread. URL is using a
486         thread-unsafe ref-counter. It should be called in the main thread.
487
488         Covered by existing tests.
489
490         * platform/network/curl/SocketStreamHandleImpl.h:
491         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
492         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl): Call URL::isolatedCopy() in the main thread.
493         (WebCore::SocketStreamHandleImpl::threadEntryPoint): Added a URL argument.
494
495 2019-08-02  Sihui Liu  <sihui_liu@apple.com>
496
497         API tests using permanent credentials should clear credentials left by previous tests
498         https://bugs.webkit.org/show_bug.cgi?id=199729
499
500         Reviewed by Alex Christensen.
501
502         Update existing API tests.
503
504         * platform/network/CredentialStorage.cpp:
505         (WebCore::CredentialStorage::clearSessionCredentials):
506         (WebCore::CredentialStorage::clearPermanentCredentialsForProtectionSpace): Deleted.
507         * platform/network/CredentialStorage.h:
508         * platform/network/mac/CredentialStorageMac.mm:
509         (WebCore::CredentialStorage::clearPermanentCredentialsForProtectionSpace): Deleted.
510
511 2019-08-02  Devin Rousso  <drousso@apple.com>
512
513         Web Inspector: Storage: disable related agents when the tab is closed
514         https://bugs.webkit.org/show_bug.cgi?id=200117
515
516         Reviewed by Joseph Pecoraro.
517
518         Rework how `enable`/`disable` is used for storage-related agents so that events are not sent
519         and data isn't kept alive when the Storage tab isn't enabled.
520
521         Covered by existing tests.
522
523         * inspector/agents/InspectorApplicationCacheAgent.h:
524         * inspector/agents/InspectorApplicationCacheAgent.cpp:
525         (WebCore::InspectorApplicationCacheAgent::willDestroyFrontendAndBackend):
526         (WebCore::InspectorApplicationCacheAgent::enable):
527         (WebCore::InspectorApplicationCacheAgent::disable): Added.
528
529         * inspector/agents/InspectorDOMStorageAgent.cpp:
530         (WebCore::InspectorDOMStorageAgent::enable):
531         (WebCore::InspectorDOMStorageAgent::disable):
532
533         * inspector/agents/InspectorDatabaseAgent.cpp:
534         (WebCore::InspectorDatabaseAgent::enable):
535         (WebCore::InspectorDatabaseAgent::disable):
536
537 2019-08-02  Devin Rousso  <drousso@apple.com>
538
539         Web Inspector: Timelines: Develop > Start Timeline Recording doesn't work when focused on a detached inspector window
540         https://bugs.webkit.org/show_bug.cgi?id=200125
541         <rdar://problem/53543008>
542
543         Reviewed by Brian Burg.
544
545         Always show the Timelines tab in Web Inspector whenever timeline recording starts/stops.
546         Notify the UIProcess whenever the timeline recording state changes.
547
548         * inspector/InspectorClient.h:
549         (WebCore::InspectorClient::timelineRecordingChanged): Added.
550
551         * inspector/agents/InspectorTimelineAgent.h:
552         * inspector/agents/InspectorTimelineAgent.cpp:
553         (WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
554         (WebCore::InspectorTimelineAgent::internalStart):
555         (WebCore::InspectorTimelineAgent::internalStop):
556
557 2019-08-02  Yury Semikhatsky  <yurys@chromium.org>
558
559         Web Inspector: Crash when interacting with Template Content in Console
560         https://bugs.webkit.org/show_bug.cgi?id=196280
561
562         Reviewed by Joseph Pecoraro.
563
564         Test: inspector/dom/inspect-template-node.html
565
566         * bindings/js/JSDOMBindingSecurity.cpp:
567         (WebCore::canAccessDocument): if target element is from a
568         <template> use its host document to check the access. Elements
569         from the host document always have access to its template elements content.
570         * inspector/agents/InspectorDOMAgent.cpp:
571         (WebCore::InspectorDOMAgent::resolveNode): templates are created in
572         special template document which doesn't have a frame, in such case get
573         the frame from the host document.
574
575 2019-08-02  Ryosuke Niwa  <rniwa@webkit.org>
576
577         Harden NodeRareData::m_connectedFrameCount
578         https://bugs.webkit.org/show_bug.cgi?id=200300
579
580         Reviewed by Geoffrey Garen.
581
582         Use unsinged integer type in NodeRareData::m_connectedFrameCount since it's padded anyway.
583
584         * dom/Node.cpp:
585         (WebCore::Node::decrementConnectedSubframeCount): Check that hasRareNode() is true in release builds.
586         * dom/NodeRareData.h:
587
588 2019-08-02  Ryosuke Niwa  <rniwa@webkit.org>
589
590         Document::resume should delay resetting of form control elements.
591         https://bugs.webkit.org/show_bug.cgi?id=200376
592
593         Reviewed by Geoffrey Garen.
594
595         Delay the execution of form control element resets until the next task
596         to avoid synchronously mutating DOM during page cache restoration.
597
598         Test: fast/frames/restoring-page-cache-should-not-run-scripts.html
599
600         * html/HTMLFormElement.cpp:
601         (WebCore::HTMLFormElement::resumeFromDocumentSuspension):
602         * html/HTMLInputElement.cpp:
603         (WebCore::HTMLInputElement::resumeFromDocumentSuspension):
604
605 2019-08-02  Youenn Fablet  <youenn@apple.com>
606
607         [iOS] Directly use RealtimeMediaSourceCenter to compute the media capture  state
608         https://bugs.webkit.org/show_bug.cgi?id=200368
609         <rdar://problem/53191450>
610
611         Unreviewed.
612         Build fix by guarding with MEDIA_STREAM in addition to IOS.
613
614         * dom/Document.cpp:
615         (WebCore::Document::updateIsPlayingMedia):
616         (WebCore::Document::pageMutedStateDidChange):
617
618 2019-08-02  Andres Gonzalez  <andresg_22@apple.com>
619
620         Add accessibility object method to determine whether an element is inside a table cell. Needed for iOS accessibility client.
621         https://bugs.webkit.org/show_bug.cgi?id=200394
622         <rdar://problem/52914964>
623
624         Reviewed by Chris Fleizach.
625
626         Test: accessibility/ios-simulator/element-in-table-cell.html
627
628         Added _accessibilityIsInTableCell needed for iOS accessibility client.
629         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
630         (-[WebAccessibilityObjectWrapper _accessibilityIsInTableCell]):
631
632 2019-08-02  Eric Carlson  <eric.carlson@apple.com>
633
634         [macOS, iOS] webaudio/silent-audio-interrupted-in-background.html sometimes crashes
635         https://bugs.webkit.org/show_bug.cgi?id=200396
636         <rdar://problem/53819720>
637
638         Reviewed by Youenn Fablet.
639
640         No new test, this fixes an existing test.
641
642         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
643         (WebCore::AudioSourceProviderAVFObjC::~AudioSourceProviderAVFObjC): Drop the
644         lock before clearing m_tapStorage. 
645
646 2019-08-02  Youenn Fablet  <youenn@apple.com>
647
648         [iOS] Directly use RealtimeMediaSourceCenter to compute the media capture  state
649         https://bugs.webkit.org/show_bug.cgi?id=200368
650         <rdar://problem/53191450>
651
652         Reviewed by Eric Carlson.
653
654         Instead of registering a MediaStreamTrack as a media producer to compute capture state,
655         go directly to the sources from the RealtimeMediaSourceCenter.
656         Do the same when requested to mute capture tracks.
657
658         No observable change of behavior.
659         Covered by manual test on iOS and existing tests.
660
661         * Modules/mediastream/MediaStreamTrack.cpp:
662         (WebCore::MediaStreamTrack::MediaStreamTrack):
663         (WebCore::MediaStreamTrack::~MediaStreamTrack):
664         (WebCore::MediaStreamTrack::mediaState const):
665         (WebCore::sourceCaptureState):
666         (WebCore::MediaStreamTrack::captureState):
667         (WebCore::MediaStreamTrack::muteCapture):
668         * Modules/mediastream/MediaStreamTrack.h:
669         * dom/Document.cpp:
670         (WebCore::Document::updateIsPlayingMedia):
671         (WebCore::Document::pageMutedStateDidChange):
672
673 2019-08-02  Chris Dumez  <cdumez@apple.com>
674
675         DOMWindow properties may get GC'd before their Window object
676         https://bugs.webkit.org/show_bug.cgi?id=200359
677
678         Reviewed by Ryosuke Niwa.
679
680         DOMWindow properties may get GC'd before their Window object once their frame is detached. This
681         is unexpected behavior given that these properties persist on the Window after the frame is
682         detached. This patch thus updates their bindings so that they live as long as their window, not
683         their frame.
684
685         Note that this also fixes a thread-safety issue since DOMWindowProperty::frame() would get called
686         from GC threads, although its implementation looks like:
687         """
688           return m_window ? m_window->frame() : nullptr;
689         """
690
691         Because m_window is a WeakPtr<DOMWindow> and because windows get destroyed on the main thread,
692         we could in theory crash when dereferencing m_window->frame() from the GC thread.
693
694         Test: fast/dom/dom-window-property-gc-after-frame-detach.html
695
696         * bindings/js/JSDOMWindowCustom.cpp:
697         (WebCore::JSDOMWindow::visitAdditionalChildren):
698         * bindings/scripts/CodeGeneratorJS.pm:
699         (GenerateImplementation):
700         * bindings/scripts/IDLAttributes.json:
701         * css/StyleMedia.idl:
702         * loader/appcache/DOMApplicationCache.idl:
703         * page/BarProp.idl:
704         * page/DOMSelection.idl:
705         * page/History.idl:
706         * page/Location.idl:
707         * page/Navigator.idl:
708         * page/Screen.idl:
709         * page/VisualViewport.idl:
710         * plugins/DOMMimeTypeArray.idl:
711         * plugins/DOMPluginArray.idl:
712         * storage/Storage.idl:
713
714 2019-08-02  Konstantin Tokarev  <annulen@yandex.ru>
715
716         Remove constructors and operators of FontPlatformData defined only for Freetype
717         https://bugs.webkit.org/show_bug.cgi?id=200379
718
719         Reviewed by Carlos Garcia Campos.
720
721         These methods only make maintenance harder, as all data fields are
722         trivially copyable. Constructors generated by compiler should be used
723         instead.
724
725         * platform/graphics/FontPlatformData.h:
726         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
727
728 2019-08-02  Konstantin Tokarev  <annulen@yandex.ru>
729
730         Remove unused constructor declaration from FontPlatformData
731         https://bugs.webkit.org/show_bug.cgi?id=200371
732
733         Reviewed by Carlos Garcia Campos.
734
735         It is not implemented by any port.
736
737         * platform/graphics/FontPlatformData.h:
738
739 2019-08-01  Chris Dumez  <cdumez@apple.com>
740
741         Pages using MessagePorts should be PageCacheable
742         https://bugs.webkit.org/show_bug.cgi?id=200366
743         <rdar://problem/53837882>
744
745         Reviewed by Geoffrey Garen.
746
747         Allow a page to enter PageCache, even if it has MessagePorts (potentially with
748         pending messages). If there are pending messages on the MessagePorts when
749         entering PageCache, those will get dispatched upon restoring from PageCache.
750
751         Test: fast/history/page-cache-MessagePort-pending-message.html
752
753         * dom/MessagePort.cpp:
754         (WebCore::MessagePort::messageAvailable):
755         (WebCore::MessagePort::dispatchMessages):
756         Do not dispatch messages while in PageCache.
757
758         (WebCore::MessagePort::canSuspendForDocumentSuspension const):
759         Allow pages with MessagePort objects to enter PageCache.
760
761         * dom/ScriptExecutionContext.cpp:
762         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
763         Make sure pending messages on MessagePorts get dispatched asynchronously after restoring
764         from PageCache.
765
766         * loader/DocumentLoader.cpp:
767         (WebCore::areAllLoadersPageCacheAcceptable):
768         Make sure only CachedResources that are still loading upon load cancelation prevent
769         entering PageCache.
770
771 2019-08-01  Konstantin Tokarev  <annulen@yandex.ru>
772
773         Fix compilation of PageConsoleClient with !ENABLE(VIDEO)
774         https://bugs.webkit.org/show_bug.cgi?id=200380
775
776         Reviewed by Joseph Pecoraro.
777
778         * page/PageConsoleClient.cpp:
779         (WebCore::PageConsoleClient::screenshot):
780
781 2019-08-01  Mark Lam  <mark.lam@apple.com>
782
783         Add crash diagnostics for debugging unexpected zapped cells.
784         https://bugs.webkit.org/show_bug.cgi?id=200149
785         <rdar://problem/53570112>
786
787         Reviewed by Yusuke Suzuki.
788
789         No new tests because this is a feature for debugging crashes.  It has been tested
790         manually by modifying the code to force a crash at the point of interest.
791
792         Added some comments to document the hashes of known subspaces.
793
794         * bindings/js/WebCoreJSClientData.cpp:
795         (WebCore::JSVMClientData::JSVMClientData):
796
797 2019-08-01  Saam Barati  <sbarati@apple.com>
798
799         [WHLSL] Do simple nullptr check elimination using basic data flow analysis when generating metal code
800         https://bugs.webkit.org/show_bug.cgi?id=200352
801
802         Reviewed by Myles C. Maxfield.
803
804         When doing metal code generation, we frequently know whether something
805         is null or not. This patch does a basic propagation of this information
806         to avoid emitting excessive null checks in the generated Metal code.
807         This is a 6% speedup (with a p value of 0.0001) in Metal compile times
808         on compute_boids.
809
810         An example of a null check we now eliminate is:
811         ```
812         int x;
813         thread int* ptr = &x; // We know that the lvalue for "x" is non-null, so we produce a non-null rvalue here.
814         *ptr = 42; // We know that the "ptr" rvalue is non-null, so we omit the null check.
815         ```
816
817         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
818         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValueWithNullability):
819         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValue):
820         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendLeftValue):
821         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValueAndNullability):
822         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastLeftValue):
823         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
824
825 2019-08-01  Alex Christensen  <achristensen@webkit.org>
826
827         Move FormData zip file generation to NetworkProcess and enable it for all WebKit clients for uploading directories
828         https://bugs.webkit.org/show_bug.cgi?id=200102
829         <rdar://problem/53275114>
830
831         Reviewed by Darin Adler.
832
833         To enable directory uploading in WebKit2, we extended WebKit1's model of asking the application to generate a file for uploading.
834         This means the WebProcess needed access to everything necessary to zip a whole directory, and clients that have not implemented
835         the strange WKBundlePageUIClient callbacks won't be able to upload directories.  Safari's implementation had already been copied
836         to BlobDataFileReference::generateReplacementFile, so I reused that code to do the zipping.  Instead of a complicated model of
837         keeping track of a filename, possibly a generated filename, and whether we think we own the file or not and having nobody clean up,
838         we now do the generation, use, and cleaning up in the network process starting with a new function generateFilesForUpload.
839         This removes unimplemented SPI in WebUIDelegatePrivate in WebKitLegacy and stops calling the WKBundlePageUIClient related to upload
840         file generation and replaces them with automatic behavior equivalent to Safari's implementation of the WKBundlePageUIClient calls.
841         Since we no longer need to do these file operations in the WebProcess, I am also reverting r245322 and r246077 which tightens the sandbox.
842
843         Covered by an API test.
844
845         * Modules/fetch/FetchBody.cpp:
846         (WebCore::FetchBody::extract):
847         (WebCore::FetchBody::bodyAsFormData const):
848         * loader/FormSubmission.cpp:
849         (WebCore::FormSubmission::create):
850         * loader/FrameLoader.cpp:
851         (WebCore::FrameLoader::submitForm):
852         (WebCore::FrameLoader::loadDifferentDocumentItem):
853         * loader/ResourceLoader.cpp:
854         (WebCore::ResourceLoader::didReceiveResponse):
855         (WebCore::ResourceLoader::cleanupForError):
856         * page/Chrome.cpp:
857         (WebCore::ChromeClient::shouldReplaceWithGeneratedFileForUpload): Deleted.
858         (WebCore::ChromeClient::generateReplacementFile): Deleted.
859         * page/ChromeClient.h:
860         * platform/network/FormData.cpp:
861         (WebCore::FormData::FormData):
862         (WebCore::FormData::~FormData):
863         (WebCore::FormData::createMultiPart):
864         (WebCore::FormDataElement::lengthInBytes const):
865         (WebCore::FormData::appendFile):
866         (WebCore::FormData::appendFileRange):
867         (WebCore::FormData::appendMultiPartFileValue):
868         (WebCore::FormData::appendMultiPartKeyValuePairItems):
869         (WebCore::FormData::resolveBlobReferences):
870         (WebCore::generateFileForUpload):
871         (WebCore::FormData::generateFilesForUpload):
872         (WebCore::FormData::generateFiles): Deleted.
873         (WebCore::FormData::hasGeneratedFiles const): Deleted.
874         (WebCore::FormData::hasOwnedGeneratedFiles const): Deleted.
875         (WebCore::FormData::removeGeneratedFilesIfNeeded): Deleted.
876         * platform/network/FormData.h:
877         (WebCore::FormDataElement::FormDataElement):
878         (WebCore::FormDataElement::EncodedFileData::isolatedCopy const):
879         (WebCore::FormDataElement::EncodedFileData::operator== const):
880         (WebCore::FormDataElement::EncodedFileData::encode const):
881         (WebCore::FormDataElement::EncodedFileData::decode):
882         * platform/network/cf/FormDataStreamCFNet.cpp:
883         (WebCore::advanceCurrentStream):
884         (WebCore::formCreate):
885         (WebCore::formFinalize):
886         (WebCore::createHTTPBodyCFReadStream):
887         * platform/network/mac/BlobDataFileReferenceMac.mm:
888         (WebCore::generateFileForUpload):
889         (WebCore::BlobDataFileReference::generateReplacementFile):
890         * xml/XMLHttpRequest.cpp:
891         (WebCore::XMLHttpRequest::send):
892
893 2019-08-01  Wenson Hsieh  <wenson_hsieh@apple.com>
894
895         [Text autosizing] [iPadOS] Add targeted hacks to address some remaining text autosizing issues
896         https://bugs.webkit.org/show_bug.cgi?id=200271
897         <rdar://problem/51734741>
898
899         Reviewed by Zalan Bujtas.
900
901         Makes some targeted adjustments to the text autosizing heuristic, to ensure compatibility with several high-
902         profile websites. See changes below for more detail.
903
904         Tests:  fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidate-special-cases.html
905                 fast/text-autosizing/ios/idempotentmode/line-height-boosting.html
906
907         * css/StyleResolver.cpp:
908         (WebCore::StyleResolver::adjustRenderStyleForTextAutosizing):
909
910         Avoid clipped sidebar links on sohu.com by not performing line-height boosting in the case where the element
911         probably has a small, fixed number of lines. See below for more detail. Additionally, don't attempt to adjust
912         the line height using the boosted font size, in the case where the element is not a candidate for idempotent
913         text autosizing.
914
915         * rendering/style/RenderStyle.cpp:
916         (WebCore::RenderStyle::isIdempotentTextAutosizingCandidate const):
917
918         Make various targeted hacks to fix a few websites:
919
920         -   Add a special case for top navigation bar links on yandex.ru, where line height greatly exceeds the
921             specified font size.
922
923         -   Avoid boosting some related video links on v.youku.com by considering the line-clamp CSS property when
924             determining the maximum number of lines of text an element is expected to contain.
925
926         -   Avoid boosting some front page links on asahi.com, which have non-repeating background images.
927
928         -   Add several other adjustments to more aggressively boost pieces of text on Google search results, such as
929             taking the `word-break` CSS property into account.
930
931         The bottom few pixels of sidebar links on naver.com are also no longer clipped after these changes.
932
933         * rendering/style/TextSizeAdjustment.cpp:
934         (WebCore::AutosizeStatus::probablyContainsASmallFixedNumberOfLines):
935
936         Pulls out a piece of the heuristic added to fix sephora.com in r247467 out into a separate helper method. To
937         recap, this heuristic identifies elements with both a fixed height and fixed line height, for which the fixed
938         height is close to an integer multiple of the line height.
939
940         Also makes several small tweaks in the process: (1) change the max difference between fixed line height and
941         font size from 6 to 5 to ensure that some multiline caption text on Google search results is boosted, and (2)
942         replace usages of `lineHeight()` with `specifiedLineHeight()`, which current prevents this function from being
943         truly idempotent.
944
945         (WebCore::AutosizeStatus::updateStatus):
946         * rendering/style/TextSizeAdjustment.h:
947
948 2019-07-31  Mark Lam  <mark.lam@apple.com>
949
950         Rename DOMJIT safe/unsafeFunction to functionWithTypeChecks and functionWithoutTypeChecks.
951         https://bugs.webkit.org/show_bug.cgi?id=200323
952
953         Reviewed by Yusuke Suzuki.
954
955         No new tests.  This is just a refactoring exercise.
956
957         * bindings/scripts/CodeGeneratorJS.pm:
958         (GetArgumentTypeForFunctionWithoutTypeCheck):
959         (GenerateImplementation):
960         (GenerateOperationDefinition):
961         (ToNativeForFunctionWithoutTypeCheck):
962         (GetUnsafeArgumentType): Deleted.
963         (UnsafeToNative): Deleted.
964         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
965         (WebCore::jsTestDOMJITPrototypeFunctionGetAttributeWithoutTypeCheck):
966         (WebCore::jsTestDOMJITPrototypeFunctionItemWithoutTypeCheck):
967         (WebCore::jsTestDOMJITPrototypeFunctionHasAttributeWithoutTypeCheck):
968         (WebCore::jsTestDOMJITPrototypeFunctionGetElementByIdWithoutTypeCheck):
969         (WebCore::jsTestDOMJITPrototypeFunctionGetElementsByNameWithoutTypeCheck):
970         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetAttribute): Deleted.
971         (WebCore::unsafeJsTestDOMJITPrototypeFunctionItem): Deleted.
972         (WebCore::unsafeJsTestDOMJITPrototypeFunctionHasAttribute): Deleted.
973         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementById): Deleted.
974         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementsByName): Deleted.
975
976 2019-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
977
978         [SOUP] WebSockets: add support for extensions when using web sockets libsoup API
979         https://bugs.webkit.org/show_bug.cgi?id=199943
980
981         Reviewed by Alex Christensen.
982
983         Add SOUP_TYPE_WEBSOCKET_EXTENSION_MANAGER feature to the soup session to enable WebSocket extensions.
984
985         Tests: http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-comp-bit-onoff.html
986                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-invalid-parameter.html
987                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-parameter.html
988                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-set-bfinal.html
989                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-split-frames.html
990                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-unsolicited-negotiation-response.html
991                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-window-bits.html
992
993         * platform/network/soup/SoupNetworkSession.cpp:
994         (WebCore::SoupNetworkSession::SoupNetworkSession):
995
996 2019-08-01  Chris Dumez  <cdumez@apple.com>
997
998         [iOS][WK1] Unsafe unsafe of WeakPtr<Document> from UIThread under PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit()
999         https://bugs.webkit.org/show_bug.cgi?id=200324
1000
1001         Reviewed by Ryosuke Niwa.
1002
1003         The Document is a WebThread object, but a WeakPtr<Document> was dereferenced from the
1004         UIThread in HTMLMediaElement::supportsSeeking(), from the PlaybackSessionInterfaceAVKit
1005         constructor. To address the issue we now grab the WebThread lock before constructing
1006         the PlaybackSessionInterfaceAVKit.
1007
1008         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1009         (VideoFullscreenControllerContext::setUpFullscreen):
1010
1011 2019-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1012
1013         [SOUP] Switch to use libsoup WebSockets API
1014         https://bugs.webkit.org/show_bug.cgi?id=200162
1015
1016         Reviewed by Michael Catanzaro.
1017
1018         Use the libsoup WebSockets API unconditionally for libsoup based ports.
1019
1020         * Modules/websockets/ThreadableWebSocketChannel.cpp:
1021         (WebCore::ThreadableWebSocketChannel::create): Do not check the env var anymore.
1022         * platform/SourcesSoup.txt:
1023         * platform/network/SocketStreamHandleImpl.cpp:
1024         * platform/network/StorageSessionProvider.h:
1025         * platform/network/soup/SocketStreamHandleImpl.h:
1026         * platform/network/soup/SocketStreamHandleImplSoup.cpp: Removed.
1027
1028 2019-07-31  Devin Rousso  <drousso@apple.com>
1029
1030         Web Inspector: Debugger: support emulateUserGesture parameter in Debugger.evaluateOnCallFrame
1031         https://bugs.webkit.org/show_bug.cgi?id=200272
1032
1033         Reviewed by Joseph Pecoraro.
1034
1035         When paused, evaluating in the console should still respect the "Emulate User Gesture" checkbox.
1036
1037         Tests: inspector/debugger/evaluateOnCallFrame-emulateUserGesture.html
1038                inspector/debugger/evaluateOnCallFrame-emulateUserGesture-userIsInteracting.html
1039
1040         * inspector/agents/page/PageDebuggerAgent.h:
1041         * inspector/agents/page/PageDebuggerAgent.cpp:
1042         (WebCore::PageDebuggerAgent::evaluateOnCallFrame): Added.
1043
1044 2019-07-31  Saam Barati  <sbarati@apple.com>
1045
1046         [WHLSL] Replace memsetZero function with inline "= { }" code
1047         https://bugs.webkit.org/show_bug.cgi?id=200328
1048
1049         Reviewed by Robin Morisset.
1050
1051         This is a ~20ms metal compile time improvement on compute_boids.
1052
1053         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
1054         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
1055         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
1056         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
1057         (WebCore::WHLSL::Metal::writeNativeFunction):
1058         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h:
1059
1060 2019-07-31  Andy Estes  <aestes@apple.com>
1061
1062         REGRESSION (r240942): first visually non-empty layout milestone is not reached in media documents until after the video finishes loading
1063         https://bugs.webkit.org/show_bug.cgi?id=200293
1064         <rdar://problem/52937749>
1065
1066         Reviewed by Alex Christensen.
1067
1068         r240942 changed FrameView::qualifiesAsVisuallyNonEmpty() to consider only documents in the
1069         Interactive or Complete ready states as "finished parsing". Documents considered finished
1070         parsing can qualify as visually non-empty even without exceeding the visual character or
1071         pixel thresholds, but documents considered not finished must first exceed one of these
1072         thresholds in order to qualify as visually non-empty.
1073
1074         HTMLDocuments are placed in the Interactive ready state by their HTMLDocumentParsers.
1075         However, HTMLDocument subclasses like ImageDocument and MediaDocument use their own custom
1076         parsers that never set the Interactive ready state on their documents; these documents go
1077         from Loading directly to Complete.
1078
1079         In order for these HTMLDocument subclasses to be considered visually non-empty before they
1080         finish loading they must render something that exceeds the visual character or pixel
1081         thresholds. For image documents, rendering the image is usually enough to cross the
1082         threshold, but for media documents the visual pixel threshold was never crossed because
1083         videos did not contribute to the visually non-empty pixel count.
1084
1085         As a result, media documents are not considered visually non-empty until the main resource
1086         finishes loading. On iOS this means that the layer tree remains frozen until this point,
1087         even though the media might have started autoplaying with audio long before it finished
1088         loading.
1089
1090         Fix this by teaching RenderVideo to contribute the video player's size to FrameView's
1091         visually non-empty pixel count once the video player has loaded enough data to determine its
1092         intrinsic size. Videos that render more than 1024 pixels will qualify a media document as
1093         visually non-empty even when it is still loading its main resource.
1094
1095         Added a new API test.
1096
1097         * rendering/RenderImage.cpp:
1098         (WebCore::RenderImage::imageChanged):
1099         (WebCore::RenderImage::incrementVisuallyNonEmptyPixelCountIfNeeded):
1100         * rendering/RenderImage.h:
1101         * rendering/RenderVideo.cpp:
1102         (WebCore::RenderVideo::updateIntrinsicSize):
1103
1104 2019-07-31  Saam Barati  <sbarati@apple.com>
1105
1106         [WHLSL] Remove UnnamedType copy/move constructors and mark classes as final
1107         https://bugs.webkit.org/show_bug.cgi?id=200188
1108         <rdar://problem/53628171>
1109
1110         Unreviewed followup.
1111
1112         As Darin pointed out in the bugzilla comments, when defining a copy
1113         constructor in C++ (either deleted or an implementation), the move
1114         constructor is implicitly deleted. This match removes the excessive
1115         use of WTF_MAKE_NONMOVABLE when we're already using WTF_MAKE_NONCOPYABLE.
1116
1117         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
1118         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
1119         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
1120         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
1121         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
1122         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
1123
1124 2019-07-31  Zalan Bujtas  <zalan@apple.com>
1125
1126         [ContentChangeObserver] twitch.tv video controls do not always respond to taps in fullscreen
1127         https://bugs.webkit.org/show_bug.cgi?id=200309
1128         <rdar://problem/52964977>
1129
1130         Reviewed by Simon Fraser.
1131
1132         Do not consider an element visible if it is not a descendant of the active fullscreen element.
1133
1134         This patch fixes the cases when the user taps on a button in fullscreen mode while the non-fullscreen content is being mutated and
1135         the ContentChangeObserver mistakenly registers it as a valid, actionable change and as a result we don't fire the click event (stay at hover).
1136
1137         Test: fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode.html
1138
1139         * page/ios/ContentChangeObserver.cpp:
1140         (WebCore::fullscreenElement):
1141         (WebCore::ContentChangeObserver::isVisuallyHidden):
1142
1143 2019-07-31  Saam Barati  <sbarati@apple.com>
1144
1145         [WHLSL Remove char/short/half types
1146         https://bugs.webkit.org/show_bug.cgi?id=200312
1147
1148         Reviewed by Myles C. Maxfield.
1149
1150         This patch removes the char/short/half types from WHLSL. Since it's not
1151         supported by all HW, WebGPU is leaving these types out for now. This is
1152         also a huge speedup, since it halves the size of the standard library.
1153         
1154         In the compute_boids demo, WHLSL::prepare goes from running in ~140ms to
1155         running in ~60ms.
1156
1157         Test: webgpu/whlsl/smaller-than-32-bit-types.html
1158
1159         * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp:
1160         (WebCore::WHLSL::Metal::writeNativeType):
1161         * Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp:
1162         (WebCore::WHLSL::Intrinsics::addPrimitive):
1163         (WebCore::WHLSL::Intrinsics::addVector):
1164         (WebCore::WHLSL::Intrinsics::addMatrix):
1165         * Modules/webgpu/WHLSL/WHLSLIntrinsics.h:
1166         (WebCore::WHLSL::Intrinsics::WTF_ARRAY_LENGTH):
1167         (WebCore::WHLSL::Intrinsics::ucharType const): Deleted.
1168         (WebCore::WHLSL::Intrinsics::ushortType const): Deleted.
1169         (WebCore::WHLSL::Intrinsics::charType const): Deleted.
1170         (WebCore::WHLSL::Intrinsics::shortType const): Deleted.
1171         (WebCore::WHLSL::Intrinsics::uchar2Type const): Deleted.
1172         (WebCore::WHLSL::Intrinsics::uchar4Type const): Deleted.
1173         (WebCore::WHLSL::Intrinsics::ushort2Type const): Deleted.
1174         (WebCore::WHLSL::Intrinsics::ushort4Type const): Deleted.
1175         (WebCore::WHLSL::Intrinsics::char2Type const): Deleted.
1176         (WebCore::WHLSL::Intrinsics::char4Type const): Deleted.
1177         (WebCore::WHLSL::Intrinsics::short2Type const): Deleted.
1178         (WebCore::WHLSL::Intrinsics::short4Type const): Deleted.
1179         * Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h:
1180         * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp:
1181         (WebCore::WHLSL::isAcceptableFormat):
1182         * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt:
1183         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
1184         (WebCore::convertTextureFormat):
1185
1186 2019-07-31  Youenn Fablet  <youenn@apple.com>
1187
1188         Use CTFontCreateForCharactersWithLanguageAndOption if available instead of CTFontCreateForCharactersWithLanguage
1189         https://bugs.webkit.org/show_bug.cgi?id=200241
1190
1191         Reviewed by Myles C. Maxfield.
1192
1193         We can use CTFontCreateForCharactersWithLanguageAndOption instead of CTFontCreateForCharactersWithLanguage
1194         as it allows setting more easily the fallback option.
1195         This allows us to never fallback to user installed fonts.
1196         In such a case, we no longer need to wrap the fonts to change the fallback option.
1197         We also prewarm the fonts with the same SPI and use system fallback as the default value.
1198
1199         Covered by existing tests.
1200
1201         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1202         (WebCore::preparePlatformFont):
1203         (WebCore::lookupFallbackFont):
1204         (WebCore::FontCache::systemFallbackForCharacters):
1205         (WebCore::FontCache::prewarm):
1206         (WebCore::fontFamiliesForPrewarming):
1207
1208 2019-07-31  Devin Rousso  <drousso@apple.com>
1209
1210         Web Inspector: Overlay: add page width/height display
1211         https://bugs.webkit.org/show_bug.cgi?id=199369
1212
1213         Reviewed by Joseph Pecoraro.
1214
1215         Show `${width}px x ${height}px` in the corner where the horizontal and vertical rulers meet.
1216         This way, if the rulers shift due to the highlighted content, the page width/height does too.
1217
1218         * inspector/InspectorOverlay.h:
1219         * inspector/InspectorOverlay.cpp:
1220         (WebCore::truncateWithEllipsis):
1221         (WebCore::InspectorOverlay::drawNodeHighlight):
1222         (WebCore::InspectorOverlay::drawQuadHighlight):
1223         (WebCore::InspectorOverlay::drawRulers):
1224         (WebCore::InspectorOverlay::drawElementTitle):
1225
1226 2019-07-31  Youenn Fablet  <youenn@apple.com>
1227
1228         Owners of MultiChannelResampler should make sure that the output bus given to it has the same number of channels
1229         https://bugs.webkit.org/show_bug.cgi?id=200248
1230         <rdar://problem/53411051>
1231
1232         Reviewed by Eric Carlson.
1233
1234         When a track's number of channels changes, MediaStreamAudioSourceNode is expected
1235         to update its MultiChannelResampler and its output number of channels.
1236         MultiChannelResampler expects to have the same number of channels as the output
1237         but it is not always the case since the channel numbers are changed in different threads
1238         and locks do not help there.
1239
1240         Instead, whenever detecting that the number of channels do not match, render silence
1241         and wait for the next rendering where the number of channels should again match.
1242
1243         Add internals API to change the number of channels from 2 to 1 or 1 to 2
1244         to allow testing that code path (iOS only as MacOS audio capture is in UIProcess).
1245         Covered by updated test.
1246
1247         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
1248         (WebCore::MediaElementAudioSourceNode::process):
1249         * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
1250         (WebCore::MediaStreamAudioSourceNode::process):
1251         * platform/audio/MultiChannelResampler.cpp:
1252         (WebCore::MultiChannelResampler::process):
1253         * platform/mediastream/RealtimeMediaSource.h:
1254         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
1255         (WebCore::MockRealtimeAudioSourceMac::reconfigure):
1256         * platform/mock/MockRealtimeAudioSource.cpp:
1257         (WebCore::MockRealtimeAudioSource::setChannelCount):
1258         * platform/mock/MockRealtimeAudioSource.h:
1259         (isType):
1260         * platform/mock/MockRealtimeVideoSource.h:
1261         * testing/Internals.cpp:
1262         (WebCore::Internals::setMockAudioTrackChannelNumber):
1263         * testing/Internals.h:
1264         * testing/Internals.idl:
1265
1266 2019-07-31  Chris Dumez  <cdumez@apple.com>
1267
1268         Element.outerHTML is missing attribute prefixes in some cases in HTML documents
1269         https://bugs.webkit.org/show_bug.cgi?id=200283
1270
1271         Reviewed by Ryosuke Niwa.
1272
1273         When HTML serializing a prefixed element attribute, we should always serialize the
1274         prefix as per [1]. However, our code was only serializing the well-known ones (xml,
1275         xmlns & xlink).
1276
1277         [1] https://html.spec.whatwg.org/#attribute's-serialised-name
1278
1279         Test: fast/dom/Element/outerHTML-prefixed-attribute.html
1280
1281         * editing/MarkupAccumulator.cpp:
1282         (WebCore::htmlAttributeSerialization):
1283         (WebCore::MarkupAccumulator::xmlAttributeSerialization):
1284         (WebCore::MarkupAccumulator::appendAttribute):
1285         * editing/MarkupAccumulator.h:
1286
1287 2019-07-31  Loïc Yhuel  <loic.yhuel@softathome.com>
1288
1289         [GStreamer] Fix printf format warnings for 32-bit build in GST traces
1290         https://bugs.webkit.org/show_bug.cgi?id=200299
1291
1292         Reviewed by Xabier Rodriguez-Calvar.
1293
1294         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1295         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): %zu for size_t
1296         (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered): Ditto
1297         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1298         (webKitWebSrcCreate): G_GUINT64_FORMAT for uint64_t
1299         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp: G_GINT64_FORMAT for int64_t
1300         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp: Ditto
1301
1302 2019-07-31  Andres Gonzalez  <andresg_22@apple.com>
1303
1304         AX: Re-enable accessibility/set-selected-text-range-after-newline.html test.
1305         https://bugs.webkit.org/show_bug.cgi?id=199431
1306         <rdar://problem/52563340>
1307
1308         Reviewed by Chris Fleizach.
1309
1310         - Re-enabled LayoutTests/accessibility/set-selected-text-range-after-newline.html.
1311         - Put back workaround in visiblePositionForIndexUsingCharacterIterator
1312         that is needed for several accessibility issues.
1313         - This workaround was rolled back because it was thought the cause of:
1314         https://bugs.webkit.org/show_bug.cgi?id=199434
1315         It turned out that the actual cause of that hang was unrelated and was
1316         fixed in:
1317         https://bugs.webkit.org/show_bug.cgi?id=199845
1318
1319         * editing/Editing.cpp:
1320         (WebCore::visiblePositionForIndexUsingCharacterIterator):
1321
1322 2019-07-31  Devin Rousso  <drousso@apple.com>
1323
1324         Web Inspector: Second call to setAttributeNS creates non-prefixed attribute
1325         https://bugs.webkit.org/show_bug.cgi?id=200230
1326         <rdar://problem/53712672>
1327
1328         Reviewed by Joseph Pecoraro.
1329
1330         Original patch by Chris Dumez <cdumez@apple.com>.
1331
1332         Test: inspector/dom/attributeModified.html
1333
1334         * dom/Element.cpp:
1335         (WebCore::Element::didAddAttribute):
1336         (WebCore::Element::didModifyAttribute):
1337         (WebCore::Element::didRemoveAttribute):
1338         Use the fully qualified name, not just the local name, when notifying the inspector frontend
1339         about changes to attributes.
1340
1341 2019-07-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1342
1343         [GTK] Datalist element support for TextFieldInputType
1344         https://bugs.webkit.org/show_bug.cgi?id=98934
1345
1346         Reviewed by Michael Catanzaro.
1347
1348         Add support for rendering the arrow indicator of text fields having data list.
1349
1350         * rendering/RenderThemeGtk.cpp:
1351         (WebCore::RenderThemeGtk::paintTextField):
1352         (WebCore::RenderThemeGtk::adjustListButtonStyle const):
1353         (WebCore::RenderThemeGtk::paintListButtonForInput):
1354         (WebCore::RenderThemeGtk::adjustSearchFieldStyle const):
1355         * rendering/RenderThemeGtk.h:
1356
1357 2019-07-30  Tim Horton  <timothy_horton@apple.com>
1358
1359         ASSERTion failure under takeSnapshot after r247846
1360
1361         * page/TextIndicator.cpp:
1362         (WebCore::takeSnapshots):
1363         We now sometimes inflate the scale factor; allow this.
1364
1365 2019-07-30  Saam Barati  <sbarati@apple.com>
1366
1367         [WHLSL] Add a fast path for TypeNamer::insert where we've already seen the type
1368         https://bugs.webkit.org/show_bug.cgi?id=200284
1369
1370         Reviewed by Myles C. Maxfield.
1371
1372         This is a ~27% speedup in the WHLSL::prepare for the compute_boids test.
1373         This optimization makes sense since my previous patch to make UnnamedType
1374         ref counted was also a huge speedup. So the TypeNamer is seeing many
1375         UnnamedTypes which are the same pointer value. On compute_boids, this
1376         makes generateMetalCode ~40ms faster.
1377
1378         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
1379         (WebCore::WHLSL::Metal::TypeNamer::insert):
1380
1381 2019-07-29  Ryosuke Niwa  <rniwa@webkit.org>
1382
1383         WorkerGlobalScope::wrapCryptoKey/unwrapCryptoKey should use local heap objects for replies
1384         https://bugs.webkit.org/show_bug.cgi?id=200179
1385         <rdar://problem/52334658>
1386
1387         Reviewed by Brent Fulgham.
1388
1389         Based on the patch by Jiewen Tan.
1390
1391         WorkerGlobalScope::wrapCryptoKey and WorkerGlobalScope::unwrapCryptoKey had a bug that they could exit
1392         the function before the main thread had finished writing to the result vector passed in to these functions
1393         when the worker's runloop receives MessageQueueTerminated before the main thread finishes writing.
1394
1395         Fixed the bug by creating a new temporary Vector inside a ThreadSafeRefCounted object shared between
1396         the main thread and the worker thread, which extends the lifetime of the Vector until when the worker thread
1397         receives the result or when the main thread finishes writing to the Vector, whichever happens last.
1398
1399         Unfortunately no new tests since there is no reproducible test case, and this crash is highly racy.
1400
1401         * workers/WorkerGlobalScope.cpp:
1402         (WebCore::CryptoBufferContainer): Added.
1403         (WebCore::CryptoBufferContainer::create): Added.
1404         (WebCore::CryptoBufferContainer::buffer): Added.
1405         (WebCore::WorkerGlobalScope::wrapCryptoKey):
1406         (WebCore::WorkerGlobalScope::unwrapCryptoKey):
1407
1408 2019-07-30  Saam Barati  <sbarati@apple.com>
1409
1410         [WHLSL] Checker sets wrong type for property access instruction with an ander
1411         https://bugs.webkit.org/show_bug.cgi?id=200282
1412
1413         Reviewed by Myles C. Maxfield.
1414
1415         We were assigning resulting type based on the base value instead of the ander
1416         of the base value. For example, consider:
1417         ```
1418         struct Point { float x; float y; }
1419         compute main(device Point[] buffer) { buffer[0]; }
1420         ```
1421         
1422         The local variable "buffer" is in the "thread" address space. So we would end up
1423         trying to use the thread address space for "buffer[0]". This caused us to
1424         generate invalid Metal code because we would call a "thread" ander with a
1425         "device" pointer. The fix is to use the "device" address space, which is
1426         the type of the ander we were already setting on this property access instruction.
1427
1428         Test: webgpu/whlsl/device-proper-type-checker.html
1429
1430         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
1431         (WebCore::WHLSL::Checker::finishVisiting):
1432
1433 2019-07-30  Saam Barati  <sbarati@apple.com>
1434
1435         [WHLSL] Make ASTDumper dump types and address spaces
1436         https://bugs.webkit.org/show_bug.cgi?id=200281
1437
1438         Reviewed by Robin Morisset.
1439
1440         This makes it much easier to gain insight into what type resolution
1441         the checker does. I used this logging to debug https://bugs.webkit.org/show_bug.cgi?id=200282
1442
1443         * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h:
1444         (WebCore::WHLSL::AST::TypeAnnotation::isAbstractLeftValue const):
1445         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
1446         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
1447         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
1448         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
1449         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
1450         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
1451         (WebCore::WHLSL::ASTDumper::visit):
1452
1453 2019-07-30  Brent Fulgham  <bfulgham@apple.com>
1454
1455         [FTW] Refactor Direct2D code to follow Cairo's model to support modern WebKit
1456         https://bugs.webkit.org/show_bug.cgi?id=200270
1457
1458         Reviewed by Dean Jackson.
1459
1460         Refactor the Direct2D code in WebCore so that the core routines can be shared
1461         between GraphicsContext and GraphicsContextImpl. Implement PlatformContext,
1462         BackingStoreBackend, and GraphicsContextImpl for the Direct2D engine.
1463        
1464         This patch effectively just moves code around.
1465
1466         * PlatformFTW.cmake:
1467         * platform/graphics/GraphicsContext.h:
1468         * platform/graphics/GraphicsContextImpl.h:
1469         * platform/graphics/ImageSource.cpp:
1470         * platform/graphics/Pattern.h:
1471         * platform/graphics/displaylists/DisplayListRecorder.cpp:
1472         * platform/graphics/displaylists/DisplayListRecorder.h:
1473         * platform/graphics/win/BackingStoreBackendDirect2D.h: Added.
1474         * platform/graphics/win/BackingStoreBackendDirect2DImpl.cpp: Added.
1475         * platform/graphics/win/BackingStoreBackendDirect2DImpl.h: Added.
1476         * platform/graphics/win/Direct2DOperations.cpp: Added.
1477         * platform/graphics/win/Direct2DOperations.h: Added.
1478         * platform/graphics/win/Direct2DUtilities.cpp: Added.
1479         * platform/graphics/win/Direct2DUtilities.h: Added.
1480         * platform/graphics/win/FontCascadeDirect2D.cpp:
1481         * platform/graphics/win/GradientDirect2D.cpp:
1482         * platform/graphics/win/GraphicsContextDirect2D.cpp:
1483         * platform/graphics/win/GraphicsContextImplDirect2D.cpp: Added.
1484         * platform/graphics/win/GraphicsContextImplDirect2D.h: Added.
1485         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
1486         * platform/graphics/win/ImageBufferDataDirect2D.h:
1487         * platform/graphics/win/ImageBufferDirect2D.cpp:
1488         * platform/graphics/win/NativeImageDirect2D.cpp:
1489         * platform/graphics/win/PathDirect2D.cpp:
1490         * platform/graphics/win/PatternDirect2D.cpp:
1491         * platform/graphics/win/PlatformContextDirect2D.cpp: Added.
1492         * platform/graphics/win/PlatformContextDirect2D.h: Added.
1493         * platform/win/DragImageWin.cpp:
1494         * svg/graphics/SVGImage.cpp:
1495
1496 2019-07-30  Myles C. Maxfield  <mmaxfield@apple.com>
1497
1498         REGRESSION(r241288): Text on Yahoo Japan mobile looks too bold
1499         https://bugs.webkit.org/show_bug.cgi?id=200065
1500         <rdar://problem/50912757>
1501
1502         Reviewed by Simon Fraser.
1503
1504         Before r241288, we were mapping Japanese sans-serif to Hiragino Kaku Gothic ProN, which
1505         has a 300 weight and a 600 weight. However, we can't use that font because it's user-installed,
1506         so in r241288 we switched to using Hiragino Sans, which has a 300 weight, a 600 weight, and an
1507         800 weight. According to the CSS font selection algorithm, sites that request a weight of 700
1508         would get the 800 weight instead of the 600 weight, which caused the text to look too heavy.
1509         Therefore, the apparent visual change is from a weight change from 600 to 800.
1510
1511         In general, this is working as intended. However, text on Yahoo Japan looks too heavy in weight
1512         800. Instead, this patch adds a quirk specific to Yahoo Japan that overwrites any font requests
1513         to give them a weight of 600 instead of 700. This way, the lighter font will be used.
1514
1515         No new tests because quirks cannot be tested.
1516
1517         * css/CSSFontSelector.cpp:
1518         (WebCore::resolveGenericFamily):
1519         (WebCore::CSSFontSelector::fontRangesForFamily):
1520         * page/Quirks.cpp:
1521         (WebCore::Quirks::shouldLightenJapaneseBoldSansSerif const):
1522         * page/Quirks.h:
1523
1524 2019-07-31  Simon Fraser  <simon.fraser@apple.com>
1525
1526         [iPadOS] Enable simulated mouse events on iqiyi.com to fix the video controls
1527         https://bugs.webkit.org/show_bug.cgi?id=200322
1528         rdar://problem/53235709
1529
1530         Reviewed by Wenson Hsieh.
1531         
1532         iqiyi.com needs to get mouseMove events for dragging the video scrubber to work.
1533
1534         * page/Quirks.cpp:
1535         (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
1536
1537 2019-07-30  Michael Catanzaro  <mcatanzaro@igalia.com>
1538
1539         Unreviewed, fix GTK build after SoupNetworkSession ownership rework.
1540
1541         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
1542
1543 2019-07-30  Michael Catanzaro  <mcatanzaro@igalia.com>
1544
1545         [GTK] Compilation errors when GL is disabled
1546         https://bugs.webkit.org/show_bug.cgi?id=200223
1547
1548         Unreviewed, keep trying to fix build with -DENABLE_OPENGL=OFF.
1549
1550         The previous commit was sufficient for the 2.24 branch, but on trunk there are more
1551         problems. This doesn't solve all of them, but it gets us closer.
1552
1553         * SourcesGTK.txt:
1554         * platform/graphics/GLContext.h:
1555
1556 2019-07-24  Carlos Garcia Campos  <cgarcia@igalia.com>
1557
1558         [SOUP] Move SoupNetworkSession ownership from NetworkStorageSession to NetworkSession
1559         https://bugs.webkit.org/show_bug.cgi?id=200076
1560
1561         Reviewed by Michael Catanzaro.
1562
1563         Remove the SoupNetworkSession from NetworkStorageSession.
1564
1565         * platform/network/NetworkStorageSession.h:
1566         (WebCore::NetworkStorageSession::cookieStorage const): Return the cookie jar.
1567         * platform/network/StorageSessionProvider.h:
1568         (WebCore::StorageSessionProvider::soupSession const): Temporary add this virtual method that is required by
1569         SocketStreamHandleImplSoup. It will be removed once we switch to libsoup WebSockets API soon.
1570         * platform/network/soup/DNSResolveQueueSoup.cpp:
1571         (WebCore::globalDefaultSoupSessionAccessor): Rework the accessor to return the SoupSession directly since
1572         that's what we really want.
1573         (WebCore::DNSResolveQueueSoup::setGlobalDefaultSoupSessionAccessor):
1574         (WebCore::DNSResolveQueueSoup::updateIsUsingProxy):
1575         (WebCore::DNSResolveQueueSoup::platformResolve):
1576         (WebCore::DNSResolveQueueSoup::resolve):
1577         * platform/network/soup/DNSResolveQueueSoup.h:
1578         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1579         (WebCore::NetworkStorageSession::NetworkStorageSession): Create and setup the default cookie jar.
1580         (WebCore::NetworkStorageSession::~NetworkStorageSession): Only disconnect the cookie jar signals.
1581         (WebCore::NetworkStorageSession::setCookieStorage): Update the cookie jar, now we know it's always a new one.
1582         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
1583         (WebCore::SocketStreamHandleImpl::create): Use the new virtual method from StorageSessionProvider to get the SoupSession.
1584         * platform/network/soup/SoupNetworkSession.cpp:
1585         (WebCore::SoupNetworkSession::SoupNetworkSession): Remove the SoupCookieJar parameter.
1586         * platform/network/soup/SoupNetworkSession.h:
1587
1588 2019-07-30  Michael Catanzaro  <mcatanzaro@igalia.com>
1589
1590         [GTK] Compilation errors when GL is disabled
1591         https://bugs.webkit.org/show_bug.cgi?id=200223
1592
1593         Unreviewed, fix build with -DENABLE_OPENGL=OFF.
1594
1595         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1596         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
1597
1598 2019-07-29  Eric Carlson  <eric.carlson@apple.com>
1599
1600         MediaSource.isTypeSupported claims FLAC-in-MP4 support on iOS and macOS, but plays silence
1601         https://bugs.webkit.org/show_bug.cgi?id=198583
1602         <rdar://problem/51487853>
1603
1604         Reviewed by Maciej Stachowiak.
1605
1606         * platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.h:
1607         (WebCore::AVStreamDataParserMIMETypeCache::canDecodeType): Use anParseExtendedMIMEType:
1608         when it is available.
1609
1610 2019-07-29  Zalan Bujtas  <zalan@apple.com>
1611
1612         [LFC][TFC] <table> initiates a principal block container box called table wrapper box.
1613         https://bugs.webkit.org/show_bug.cgi?id=200198
1614         <rdar://problem/53623803>
1615
1616         Reviewed by Antti Koivisto.
1617
1618         The table wrapper box contains the table box itself and any caption boxes.
1619
1620         * layout/layouttree/LayoutBox.cpp:
1621         (WebCore::Layout::Box::isBlockContainerBox const):
1622         * layout/layouttree/LayoutBox.h:
1623         (WebCore::Layout::Box::isTableCaption const):
1624         (WebCore::Layout::Box::isTableRow const):
1625         (WebCore::Layout::Box::isTableCell const):
1626         * layout/layouttree/LayoutContainer.h:
1627         * layout/layouttree/LayoutTreeBuilder.cpp:
1628         (WebCore::Layout::appendChild):
1629         (WebCore::Layout::TreeBuilder::createLayoutBox):
1630         (WebCore::Layout::TreeBuilder::createTableStructure):
1631         (WebCore::Layout::TreeBuilder::createSubTree):
1632         (WebCore::Layout::outputLayoutBox):
1633         * layout/layouttree/LayoutTreeBuilder.h:
1634
1635 2019-07-29  Justin Fan  <justin_fan@apple.com>
1636
1637         [WebGPU] Replace Vectors with HashSets for tracking resources used by GPUCommandBuffer
1638         https://bugs.webkit.org/show_bug.cgi?id=200200
1639
1640         Reviewed by Myles C. Maxfield.
1641
1642         Resources bound to a command buffer or bind group only need be tracked once rather than once per sub-view. 
1643         This patch cuts GPUQueue.submit validation from 2-12 ms down to ~0 when drawing 12000 triangles in Animometer.
1644
1645         Covered by existing tests; no behavior change expected.
1646
1647         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp: Removed unused variable.
1648         * platform/graphics/gpu/GPUBindGroup.h:
1649         (WebCore::GPUBindGroup::boundBuffers const):
1650         (WebCore::GPUBindGroup::boundTextures const):
1651         * platform/graphics/gpu/GPUCommandBuffer.h:
1652         (WebCore::GPUCommandBuffer::usedBuffers const):
1653         (WebCore::GPUCommandBuffer::usedTextures const):
1654         (WebCore::GPUCommandBuffer::useBuffer):
1655         (WebCore::GPUCommandBuffer::useTexture):
1656         * platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm:
1657         (WebCore::GPUBindGroup::tryCreate):
1658         (WebCore::GPUBindGroup::GPUBindGroup):
1659
1660 2019-07-29  Zalan Bujtas  <zalan@apple.com>
1661
1662         [LFC][TFC] Introduce Box::establishesTableFormattingContext
1663         https://bugs.webkit.org/show_bug.cgi?id=200060
1664
1665         Reviewed by Antti Koivisto.
1666
1667         https://www.w3.org/TR/CSS22/tables.html
1668
1669         The table generates a principal block container box called the table wrapper box that contains the table box itself and any caption boxes.
1670         The table box is a block-level box that contains the table's internal table boxes.
1671         The table wrapper box is block-level for 'display: table', and inline-level; for 'display: inline-table'. The table wrapper box establishes a block
1672         formatting context, and the table box establishes a table formatting context."
1673
1674         * layout/layouttree/LayoutBox.cpp:
1675         (WebCore::Layout::Box::establishesFormattingContext const):
1676         (WebCore::Layout::Box::establishesTableFormattingContext const):
1677         (WebCore::Layout::Box::isBlockLevelBox const):
1678         (WebCore::Layout::Box::isInlineLevelBox const):
1679         (WebCore::Layout::Box::isBlockContainerBox const):
1680         * layout/layouttree/LayoutBox.h:
1681         (WebCore::Layout::Box::isTableWrapperBox const):
1682         (WebCore::Layout::Box::isTableBox const):
1683
1684 2019-07-29  Zalan Bujtas  <zalan@apple.com>
1685
1686         [ContentChangeObserver] didFinishContentChangeObserving should include the type of content change.
1687         https://bugs.webkit.org/show_bug.cgi?id=200247
1688         <rdar://problem/53681149>
1689
1690         Reviewed by Simon Fraser.
1691
1692         Now we don't have to query the content change observer for the type of the change in the callback.
1693
1694         * loader/EmptyClients.h:
1695         * page/ChromeClient.h:
1696         * page/ios/ContentChangeObserver.cpp:
1697         (WebCore::ContentChangeObserver::adjustObservedState):
1698         * page/ios/EventHandlerIOS.mm:
1699         (WebCore::EventHandler::mouseMoved):
1700
1701 2019-07-29  Sergei Glazunov  <glazunov@google.com>
1702
1703         The maximum subframe count check should not be skipped for empty URLs.
1704         https://bugs.webkit.org/show_bug.cgi?id=200032
1705
1706         Reviewed by Ryosuke Niwa.
1707
1708         Move the check closer to the actual frame creation code in `loadSubframe`.
1709
1710         Test: fast/dom/connected-subframe-counter-overflow.html
1711
1712         * dom/Document.cpp:
1713         (WebCore::Document::prepareForDestruction): Assert that all child frames have been detached.
1714         * html/HTMLFrameElementBase.cpp:
1715         (WebCore::HTMLFrameElementBase::canLoad const):
1716         (WebCore::HTMLFrameElementBase::canLoadURL const):
1717         * html/HTMLFrameOwnerElement.cpp:
1718         (WebCore::HTMLFrameOwnerElement::canAddSubframe const): Deleted.
1719         * html/HTMLFrameOwnerElement.h:
1720         * html/HTMLPlugInImageElement.cpp:
1721         (WebCore::HTMLPlugInImageElement::canLoadURL const):
1722         * loader/SubframeLoader.cpp:
1723         (WebCore::SubframeLoader::loadSubframe):
1724
1725 2019-07-29  Zalan Bujtas  <zalan@apple.com>
1726
1727         [ContentChangeObserver] ChromeClient::observedContentChange() name is misleading
1728         https://bugs.webkit.org/show_bug.cgi?id=200238
1729         <rdar://problem/53677038>
1730
1731         Reviewed by Simon Fraser.
1732
1733         This function indicates that we've finished observing content changes.
1734
1735         * loader/EmptyClients.h:
1736         * page/ChromeClient.h:
1737         * page/ios/ContentChangeObserver.cpp:
1738         (WebCore::ContentChangeObserver::adjustObservedState):
1739         * page/ios/EventHandlerIOS.mm:
1740         (WebCore::EventHandler::mouseMoved):
1741
1742 2019-07-29  Sam Weinig  <weinig@apple.com>
1743
1744         StringBuilder::append(makeString(...)) is inefficient
1745         https://bugs.webkit.org/show_bug.cgi?id=200034
1746
1747         Reviewed by Saam Barati.
1748
1749         Replace uses of StringBuilder::append(makeString(...)) with StringBuilder::flexiblAppend(...).
1750         Where possible, also merged consecutive calls to StringBuilder::append(...) into a single call
1751         to StringBuilder::flexiblAppend(...) to avoid unnecessary additional overflow checks and resizes.
1752         Also where possible, replaced StringBuilder with makeString() if no branching was used during
1753         construction.
1754         
1755         A lot more can be done to improve the efficiency of StringBuilder use in the WHLSL code including:
1756         - Using StringView more prevelently, especially when passing a substring to the StringBuilder.
1757         - Passing existing StringBuilders to functions for them to use rather than returning a String and 
1758           then appending that to another StringBuilder.
1759         - Using custom StringTypeAdapters for generated names, rather than storing them as Strings. 
1760
1761         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
1762         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceHelperTypes):
1763         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceSignature):
1764         (WebCore::WHLSL::Metal::EntryPointScaffolding::builtInsSignature):
1765         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledInputPath):
1766         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledOutputPath):
1767         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpackResourcesAndNamedBuiltIns):
1768         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::helperTypes):
1769         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::signature):
1770         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::unpack):
1771         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::pack):
1772         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::helperTypes):
1773         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::signature):
1774         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::unpack):
1775         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::pack):
1776         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::signature):
1777         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
1778         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::visit):
1779         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
1780         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
1781         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitLoop):
1782         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp:
1783         (WebCore::WHLSL::Metal::generateMetalCodeShared):
1784         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
1785         (WebCore::WHLSL::Metal::writeNativeFunction):
1786         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
1787         (WebCore::WHLSL::Metal::MetalTypeDeclarationWriter::visit):
1788         (WebCore::WHLSL::Metal::TypeNamer::emitUnnamedTypeDefinition):
1789         (WebCore::WHLSL::Metal::TypeNamer::emitNamedTypeDefinition):
1790         (WebCore::WHLSL::Metal::TypeNamer::metalTypes):
1791         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
1792         (WebCore::WHLSL::Types::appendNameTo):
1793         * rendering/RenderLayerCompositor.cpp:
1794         (WebCore::RenderLayerCompositor::logLayerInfo):
1795         * testing/Internals.cpp:
1796         (WebCore::Internals::ongoingLoadsDescriptions const):
1797
1798 2019-07-29  Megan Gardner  <megan_gardner@apple.com>
1799
1800         Force Reveal to always lookup from menu
1801         https://bugs.webkit.org/show_bug.cgi?id=200186
1802         <rdar://problem/52967940>
1803
1804         Reviewed by Tim Horton.
1805
1806         We currently only have the 'lookup' menu item, so we should always force the 'lookup' action from it.
1807
1808         Reveal is not currently testable.
1809
1810         * editing/cocoa/DictionaryLookup.mm:
1811         (WebCore::showPopupOrCreateAnimationController):
1812
1813 2019-07-29  Simon Fraser  <simon.fraser@apple.com>
1814
1815         REGRESSION (r246899): Subtitles show twice when controls show/hide on hulu.com
1816         https://bugs.webkit.org/show_bug.cgi?id=200187
1817         rdar://problem/53511121
1818
1819         Reviewed by Zalan Bujtas.
1820
1821         When a layer that painted into shared backing moved, we'd fail to repaint its old position
1822         because the RenderLayer's repaint rects are cleared via BackingSharingState::updateBeforeDescendantTraversal().
1823
1824         Recomputing repaint rects is expensive, so we only want to do it when necessary, which is for
1825         layers that start and stop sharing (going into and out of compositing already recomputes them).
1826         So add logic to RenderLayerBacking::setBackingSharingLayers() that recomputes repaint rects
1827         on layers that will no longer use shared backing, and those that are newly using shared
1828         backing.
1829
1830         Test: compositing/shared-backing/backing-sharing-repaint.html
1831
1832         * rendering/RenderLayer.cpp:
1833         (WebCore::RenderLayer::setBackingProviderLayer):
1834         * rendering/RenderLayerBacking.cpp:
1835         (WebCore::RenderLayerBacking::setBackingSharingLayers):
1836         * rendering/RenderLayerCompositor.cpp:
1837         (WebCore::RenderLayerCompositor::BackingSharingState::appendSharingLayer):
1838         (WebCore::RenderLayerCompositor::updateBacking):
1839
1840 2019-07-29  Simon Fraser  <simon.fraser@apple.com>
1841
1842         The touch-action property was ignored on replaced elements (canvas, img etc)
1843         https://bugs.webkit.org/show_bug.cgi?id=200205
1844         rdar://problem/53331224
1845
1846         Reviewed by Antti Koivisto.
1847
1848         The event region painting code didn't handle replaced elements correctly,
1849         causing touch-action to get ignored for <canvas>, <img> etc. Fix by handling
1850         region painting in RenderReplaced.
1851
1852         This still doesn't fix <iframe> but I'm not sure what the correct behavior is there
1853         (webkit.org/b/200204).
1854
1855         Test: pointerevents/ios/touch-action-region-replaced-elements.html
1856
1857         * rendering/RenderReplaced.cpp:
1858         (WebCore::RenderReplaced::paint):
1859         (WebCore::RenderReplaced::shouldPaint):
1860
1861 2019-07-29  Philippe Normand  <pnormand@igalia.com>
1862
1863         REGRESSION(r243058): [GStreamer] WebKitWebSrc's internal queue can exhaust the WebProcess memory
1864         https://bugs.webkit.org/show_bug.cgi?id=199998
1865
1866         Reviewed by Xabier Rodriguez-Calvar.
1867
1868         With the webkitwebsrc rewrite the element lost its ability to tell
1869         the resource loader when to pause and resume downloading because
1870         we don't use appsrc and its enough-data/need-data signals anymore.
1871         So new heuristics are introduced with this patch. Downloading of
1872         resources bigger than 2MiB might pause when the internal adapter
1873         has enough data (2% of the full resource) and resume when the
1874         adapter size goes below 20% of those 2%.
1875
1876         No new tests, the media element spec doesn't clearly mandate how
1877         the resource loading should behave when the element is paused or
1878         how aggressively the resource should be downloaded during
1879         playback.
1880
1881         This patch was functionally tested with a 1.3GiB resource loaded
1882         over the local network, the resource was downloaded in ~30MiB
1883         chunks, stopping and resuming every 20 seconds, approximately.
1884
1885         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1886         (webkit_web_src_class_init):
1887         (webKitWebSrcCreate):
1888         (CachedResourceStreamingClient::responseReceived):
1889         (CachedResourceStreamingClient::dataReceived):
1890
1891 2019-07-29  Carlos Garcia Campos  <cgarcia@igalia.com>
1892
1893         WebSockets: workers never use the platform WebSockets path
1894         https://bugs.webkit.org/show_bug.cgi?id=200161
1895
1896         Reviewed by Michael Catanzaro.
1897
1898         A WebCore::WebSocketChannel is created unconditionally in WorkerThreadableWebSocketChannel::Peer.
1899
1900         * Modules/websockets/ThreadableWebSocketChannel.cpp:
1901         (WebCore::ThreadableWebSocketChannel::create): New create method that receives a Document& and creates the
1902         WebSocket channel checking the runtime enabled features to decide.
1903         * Modules/websockets/ThreadableWebSocketChannel.h:
1904         * Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
1905         (WebCore::WorkerThreadableWebSocketChannel::Peer::Peer): Use ThreadableWebSocketChannel::create().
1906
1907 2019-07-29  Carlos Garcia Campos  <cgarcia@igalia.com>
1908
1909         Multiple context menu actions broken for YouTube videos
1910         https://bugs.webkit.org/show_bug.cgi?id=199999
1911
1912         Reviewed by Eric Carlson.
1913
1914         Do not include CopyMediaLinkItem and OpenMediaInNewWindowItem to the context menu when media URL is not
1915         downloadable or the request can't be handled.
1916
1917         * page/ContextMenuController.cpp:
1918         (WebCore::ContextMenuController::populate):
1919
1920 2019-07-28  Commit Queue  <commit-queue@webkit.org>
1921
1922         Unreviewed, rolling out r247886.
1923         https://bugs.webkit.org/show_bug.cgi?id=200214
1924
1925         "Causes PLT5 regression on some machines" (Requested by mlam|a
1926         on #webkit).
1927
1928         Reverted changeset:
1929
1930         "Add crash diagnostics for debugging unexpected zapped cells."
1931         https://bugs.webkit.org/show_bug.cgi?id=200149
1932         https://trac.webkit.org/changeset/247886
1933
1934 2019-07-28  Tim Horton  <timothy_horton@apple.com>
1935
1936         Fix the release build
1937
1938         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
1939         (WebCore::WHLSL::Metal::TypeNamer::insert):
1940
1941 2019-07-28  Simon Fraser  <simon.fraser@apple.com>
1942
1943         [iOS] Touch regions overlay needs to show touch-action:none
1944         https://bugs.webkit.org/show_bug.cgi?id=200203
1945
1946         Reviewed by Wenson Hsieh.
1947
1948         When I added touch-action overlay painting, I didn't realize that touch-action:none
1949         was an important value to display. But it is, so fix that.
1950
1951         * rendering/RenderLayerBacking.cpp:
1952         (WebCore::patternForTouchAction):
1953
1954 2019-07-27  Saam Barati  <sbarati@apple.com>
1955
1956         [WHLSL] Remove UnnamedType copy/move constructors and mark classes as final
1957         https://bugs.webkit.org/show_bug.cgi?id=200188
1958
1959         Reviewed by Myles C. Maxfield.
1960
1961         Since they are ref counted, you should make taking a ref to them
1962         instead of moving or copying them. This patch encodes that by deleting
1963         the relevant copy/move constructors and assignment operators.
1964
1965         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
1966         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
1967         (WebCore::WHLSL::AST::ArrayType::ArrayType): Deleted.
1968         (WebCore::WHLSL::AST::ArrayType::create): Deleted.
1969         (WebCore::WHLSL::AST::ArrayType::type const): Deleted.
1970         (WebCore::WHLSL::AST::ArrayType::type): Deleted.
1971         (WebCore::WHLSL::AST::ArrayType::numElements const): Deleted.
1972         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
1973         (WebCore::WHLSL::AST::PointerType::PointerType): Deleted.
1974         (WebCore::WHLSL::AST::PointerType::create): Deleted.
1975         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
1976         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
1977         (WebCore::WHLSL::AST::TypeReference::TypeReference): Deleted.
1978         (WebCore::WHLSL::AST::TypeReference::create): Deleted.
1979         (WebCore::WHLSL::AST::TypeReference::name): Deleted.
1980         (WebCore::WHLSL::AST::TypeReference::typeArguments): Deleted.
1981         (WebCore::WHLSL::AST::TypeReference::maybeResolvedType const): Deleted.
1982         (WebCore::WHLSL::AST::TypeReference::resolvedType const): Deleted.
1983         (WebCore::WHLSL::AST::TypeReference::setResolvedType): Deleted.
1984         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
1985
1986 2019-07-27  Justin Fan  <justin_fan@apple.com>
1987
1988         [WebGPU] Update GPUComputePipeline errors to match GPURenderPipeline implementation
1989         https://bugs.webkit.org/show_bug.cgi?id=200097
1990
1991         Reviewed by Myles C. Maxfield.
1992
1993         Remove passing around a functionName in GPUComputePipeline creation in favor of setting it on the GPUErrorScopes.
1994         Also, WebGPU objects no longer create new Ref<>s unless object creation succeeds.
1995
1996         No new tests. Covered by existing tests.
1997
1998         * Modules/webgpu/WebGPUDevice.cpp:
1999         (WebCore::WebGPUDevice::createBuffer const):
2000         (WebCore::WebGPUDevice::createBufferMapped const):
2001         (WebCore::WebGPUDevice::createComputePipeline const):
2002         * platform/graphics/gpu/GPUBuffer.h:
2003         * platform/graphics/gpu/GPUComputePipeline.h:
2004         * platform/graphics/gpu/GPUDevice.cpp:
2005         (WebCore::GPUDevice::tryCreateBuffer):
2006         (WebCore::GPUDevice::tryCreateComputePipeline const):
2007         * platform/graphics/gpu/GPUDevice.h:
2008         * platform/graphics/gpu/GPUErrorScopes.cpp:
2009         (WebCore::GPUErrorScopes::generatePrefixedError): Only validaton errors have messages right now.
2010         * platform/graphics/gpu/GPUErrorScopes.h:
2011         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
2012         (WebCore::GPUBuffer::validateBufferUsage):
2013         (WebCore::GPUBuffer::tryCreate):
2014         (WebCore::GPUBuffer::GPUBuffer):
2015         * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
2016         (WebCore::trySetMetalFunctions):
2017         (WebCore::trySetFunctions):
2018         (WebCore::convertComputePipelineDescriptor):
2019         (WebCore::tryCreateMTLComputePipelineState):
2020         (WebCore::GPUComputePipeline::tryCreate):
2021         (WebCore::GPUComputePipeline::GPUComputePipeline):
2022         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
2023         (WebCore::trySetMetalFunctions):
2024         (WebCore::trySetFunctions):
2025
2026         These classes were made RefCounted in a previous patch; remove their move ctors to fix build.
2027         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
2028         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
2029         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
2030         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
2031         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
2032         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
2033
2034 2019-07-27  Andres Gonzalez  <andresg_22@apple.com>
2035
2036         Expose the aria-label attribute for <video> elements.
2037         https://bugs.webkit.org/show_bug.cgi?id=200169
2038         <rdar://problem/51754558>
2039
2040         Reviewed by Chris Fleizach.
2041
2042         Tests: accessibility/ios-simulator/media-with-aria-label.html
2043                accessibility/media-with-aria-label.html
2044
2045         We now expose the <video> element to accessibility clients as long as auto-play is not enabled.
2046         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2047         (-[WebAccessibilityObjectWrapper accessibilityIsWebInteractiveVideo]):
2048
2049 2019-07-26  Saam Barati  <sbarati@apple.com>
2050
2051         Unreviewed. Remove invalid assertion after r247878.
2052         We were essentially asserting all UnnamedType* were
2053         unique. But my patch made this no longer the case by
2054         design to make things faster.
2055
2056         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
2057         (WebCore::WHLSL::Metal::TypeNamer::insert):
2058
2059 2019-07-26  Mark Lam  <mark.lam@apple.com>
2060
2061         Add crash diagnostics for debugging unexpected zapped cells.
2062         https://bugs.webkit.org/show_bug.cgi?id=200149
2063         <rdar://problem/53570112>
2064
2065         Reviewed by Yusuke Suzuki, Saam Barati, and Michael Saboff.
2066
2067         No new tests because this is a feature for debugging crashes.  It has been tested
2068         manually by modifying the code to force a crash at the point of interest.
2069
2070         Added some comments to document the hashes of known subspaces.
2071
2072         * bindings/js/WebCoreJSClientData.cpp:
2073         (WebCore::JSVMClientData::JSVMClientData):
2074
2075 2019-07-26  Ryosuke Niwa  <rniwa@webkit.org>
2076
2077         Moving right by word boundary right before an object element followed by a br element hangs
2078         https://bugs.webkit.org/show_bug.cgi?id=200144
2079
2080         Reviewed by Simon Fraser.
2081
2082         The bug was caused by an infinite loop inside wordBreakIteratorForMinOffsetBoundary when it's trying to
2083         find the previous word boundary at the beginning of a word after the object element and the br element.
2084         In this case, previousBox is at the br element after the object element in the preceding line, and
2085         logicallyPreviousBox ends up returning the same inline box (that of the br element), causing a hang.
2086
2087         Here's how. In logicallyPreviousBox, previousRootInlineBoxCandidatePosition returns a legacy position
2088         immediately after the object element. The root inline box for this position (previousRoot) is the one
2089         that contains the object element and the br element. However, when previousTextOrLineBreakBox is called
2090         on this root inline box, "box" argument of the function is set to nullptr, and as a result, the function
2091         finds and returns the same inline box of the br element that was passed to logicallyPreviousBox.
2092
2093         Fixed the bug by passing the starting inline box to previousRootInlineBoxCandidatePosition when its
2094         root inline box is the previous root inline box (previousRoot). Also applied the same fix to
2095         logicallyNextBox even though we don't have a reproduction for that case for now (RTL test case is
2096         unaffected by nextRootInlineBoxCandidatePosition).
2097
2098         Tests: editing/selection/move-by-word-visually-across-object-element-1.html
2099                editing/selection/move-by-word-visually-across-object-element-2.html
2100                editing/selection/move-by-word-visually-across-object-element-3.html
2101
2102         * editing/VisibleUnits.cpp:
2103         (WebCore::logicallyPreviousBox): Fixed the bug.
2104         (WebCore::logicallyNextBox): Ditto.
2105
2106 2019-07-26  Brady Eidson  <beidson@apple.com>
2107
2108         Do not fire readystatechange events at documents about to get replaced by javascript URLs.
2109         <rdar://problem/51665406> and https://bugs.webkit.org/show_bug.cgi?id=198786
2110
2111         Reviewed by Ryosuke Niwa.
2112
2113         Test: http/tests/dom/ready-state-on-javascript-replace.html
2114
2115         We were firing too many readystatechange events, more than other browsers.
2116         Our behavior on this test with this patch now matches Chrome.
2117
2118         (There was even an ancient FIXME alluding to this referencing a spec issue, and that issues has long been resolvedv)
2119
2120         * loader/FrameLoader.cpp:
2121         (WebCore::FrameLoader::stopLoading):
2122
2123 2019-07-26  Zalan Bujtas  <zalan@apple.com>
2124
2125         [iPadOS] wix.com cannot select a template to edit or view
2126         https://bugs.webkit.org/show_bug.cgi?id=200174
2127         <rdar://problem/53281296>
2128
2129         Reviewed by Simon Fraser.
2130
2131         Opt out of simulated mouse event sending for template selection on wix.com.
2132         When wix.com receives a simulated mouse event during the touch events, it calls preventDefault() which prevents us from running the hover heuristics -> no click.
2133
2134         * page/Quirks.cpp:
2135         (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
2136
2137 2019-07-26  Saam Barati  <sbarati@apple.com>
2138
2139         [WHLSL] UnnamedType should be reference counted
2140         https://bugs.webkit.org/show_bug.cgi?id=200098
2141
2142         Reviewed by Dean Jackson.
2143
2144         This patch makes UnnamedType reference counted. The motivation for doing this
2145         is I measured how many times we were cloning UnnamedTypes, and I found we were
2146         doing it ~433,000 times in some of Justin's demos. This is hugely wasteful,
2147         given that an UnnamedType is immutable in the sense that once the type is
2148         resolved, it will never change. So instead of repeatedly cloning the same
2149         type, and having Expression point to a UniqueRef of UnnamedType, we should
2150         instead make UnnamedType reference counted, and have expressions point to a
2151         potentially shared UnnamedType.
2152         
2153         Doing this is hugely beneficial to WHLSL compile times. On Justin's demos,
2154         these are the results I'm getting:
2155         
2156         hello-triangle: neutral
2157         hello-cube: 55% faster
2158         compute-blur: 35% faster
2159         textured-cube: 49% faster
2160
2161         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
2162         (WebCore::WHLSL::AST::ArrayReferenceType::ArrayReferenceType):
2163         (WebCore::WHLSL::AST::ArrayReferenceType::create):
2164         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
2165         (WebCore::WHLSL::AST::ArrayType::ArrayType):
2166         (WebCore::WHLSL::AST::ArrayType::create):
2167         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h:
2168         (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition):
2169         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
2170         (WebCore::WHLSL::AST::Expression::setType):
2171         (WebCore::WHLSL::AST::Expression::copyTypeTo const):
2172         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h:
2173         (WebCore::WHLSL::AST::FloatLiteral::clone const):
2174         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp:
2175         (WebCore::WHLSL::AST::FloatLiteralType::FloatLiteralType):
2176         (WebCore::WHLSL::AST::FloatLiteralType::clone const):
2177         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h:
2178         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
2179         (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration):
2180         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h:
2181         (WebCore::WHLSL::AST::IntegerLiteral::clone const):
2182         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp:
2183         (WebCore::WHLSL::AST::IntegerLiteralType::IntegerLiteralType):
2184         (WebCore::WHLSL::AST::IntegerLiteralType::clone const):
2185         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h:
2186         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h:
2187         (WebCore::WHLSL::AST::NullLiteral::clone const):
2188         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
2189         (WebCore::WHLSL::AST::PointerType::PointerType):
2190         (WebCore::WHLSL::AST::PointerType::create):
2191         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
2192         (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression):
2193         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
2194         (WebCore::WHLSL::AST::ReferenceType::ReferenceType):
2195         * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h:
2196         (WebCore::WHLSL::AST::ResolvableType::resolve):
2197         * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h:
2198         (WebCore::WHLSL::AST::StructureElement::StructureElement):
2199         * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp:
2200         (WebCore::WHLSL::AST::clone):
2201         * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h:
2202         * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h:
2203         (WebCore::WHLSL::AST::TypeDefinition::TypeDefinition):
2204         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp:
2205         (WebCore::WHLSL::AST::TypeReference::wrap):
2206         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
2207         (WebCore::WHLSL::AST::TypeReference::create):
2208         (WebCore::WHLSL::AST::TypeReference::cloneTypeReference const): Deleted.
2209         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
2210         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h:
2211         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const):
2212         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp:
2213         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::UnsignedIntegerLiteralType):
2214         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::clone const):
2215         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h:
2216         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
2217         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
2218         (WebCore::WHLSL::Metal::vectorInnerType):
2219         * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp:
2220         (WebCore::WHLSL::Metal::writeNativeType):
2221         * Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp:
2222         (WebCore::WHLSL::AutoInitialize::visit):
2223         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp:
2224         (WebCore::WHLSL::DuplicateFunctionKey::hash const):
2225         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
2226         (WebCore::WHLSL::resolveWithOperatorAnderIndexer):
2227         (WebCore::WHLSL::resolveWithOperatorLength):
2228         (WebCore::WHLSL::resolveWithReferenceComparator):
2229         (WebCore::WHLSL::resolveByInstantiation):
2230         (WebCore::WHLSL::checkOperatorOverload):
2231         (WebCore::WHLSL::Checker::assignTypes):
2232         (WebCore::WHLSL::matchAndCommit):
2233         (WebCore::WHLSL::commit):
2234         (WebCore::WHLSL::Checker::assignConcreteType):
2235         (WebCore::WHLSL::Checker::assignType):
2236         (WebCore::WHLSL::Checker::forwardType):
2237         (WebCore::WHLSL::Checker::visit):
2238         (WebCore::WHLSL::getUnnamedType):
2239         (WebCore::WHLSL::argumentTypeForAndOverload):
2240         (WebCore::WHLSL::Checker::finishVisiting):
2241         (WebCore::WHLSL::Checker::isBoolType):
2242         * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp:
2243         (WebCore::WHLSL::matchAndCommit):
2244         (WebCore::WHLSL::commit):
2245         (WebCore::WHLSL::inferTypesForTypeArguments):
2246         (WebCore::WHLSL::inferTypesForCallImpl):
2247         * Modules/webgpu/WHLSL/WHLSLInferTypes.h:
2248         * Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp:
2249         (WebCore::WHLSL::Intrinsics::addVector):
2250         (WebCore::WHLSL::Intrinsics::addMatrix):
2251         (WebCore::WHLSL::Intrinsics::addTexture):
2252         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
2253         (WebCore::WHLSL::Parser::parseTypeArgument):
2254         (WebCore::WHLSL::Parser::parseType):
2255         (WebCore::WHLSL::Parser::parseEnumerationDefinition):
2256         (WebCore::WHLSL::Parser::parseVariableDeclaration):
2257         (WebCore::WHLSL::Parser::parseVariableDeclarations):
2258         * Modules/webgpu/WHLSL/WHLSLParser.h:
2259         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
2260         (WebCore::WHLSL::PreserveLifetimes::PreserveLifetimes):
2261         (WebCore::WHLSL::PreserveLifetimes::makeStructVariableReference):
2262         (WebCore::WHLSL::PreserveLifetimes::assignVariableIntoStruct):
2263         (WebCore::WHLSL::preserveVariableLifetimes):
2264         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
2265         (WebCore::WHLSL::wrapAnderCallArgument):
2266         (WebCore::WHLSL::anderCallArgument):
2267         (WebCore::WHLSL::setterCall):
2268         (WebCore::WHLSL::getterCall):
2269         (WebCore::WHLSL::modify):
2270         (WebCore::WHLSL::PropertyResolver::visit):
2271         (WebCore::WHLSL::PropertyResolver::simplifyRightValue):
2272         (WebCore::WHLSL::LeftValueSimplifier::finishVisiting):
2273         * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp:
2274         (WebCore::WHLSL::conversionCost):
2275         * Modules/webgpu/WHLSL/WHLSLResolvingType.h:
2276         (WebCore::WHLSL::ResolvingType::ResolvingType):
2277         (WebCore::WHLSL::ResolvingType::getUnnamedType):
2278         (WebCore::WHLSL::ResolvingType::visit):
2279         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
2280         (WebCore::WHLSL::synthesizeArrayOperatorLength):
2281         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
2282         (WebCore::WHLSL::synthesizeConstructors):
2283         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
2284         (WebCore::WHLSL::synthesizeEnumerationFunctions):
2285         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
2286         (WebCore::WHLSL::synthesizeStructureAccessors):
2287         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
2288         (WebCore::WHLSL::Visitor::visit):
2289
2290 2019-07-26  Takashi Komori  <Takashi.Komori@sony.com>
2291
2292         [curl] Heap corruption in ~CurlResponse
2293         https://bugs.webkit.org/show_bug.cgi?id=198320
2294
2295         Reviewed by Fujii Hironori.
2296
2297         Stop sharing object which was reffered by two threads to fix crash bug.
2298
2299         No tests needed, no functionality changes.
2300
2301         * platform/network/curl/CurlRequest.cpp:
2302         (WebCore::CurlRequest::start):
2303         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
2304         * platform/network/curl/CurlRequest.h:
2305
2306 2019-07-26  Youenn Fablet  <youenn@apple.com>
2307
2308         slides.google.com: opening speaker notes while presenting causes a fatal error in the web app on iPad
2309         https://bugs.webkit.org/show_bug.cgi?id=199933
2310         <rdar://problem/53034345>
2311
2312         Reviewed by Darin Adler.
2313
2314         docs.google.com might sometimes try to window.open an about URL that not about:blank or about:srcdoc.
2315         In that case, WebKit is opening a window but is considering that the window is cross origin with its opener.
2316         This breaks docs.google.com as they want to access the website.
2317         Add a site-specific hack so as to treat all about URLs being opened through window.open as about:blank.
2318
2319         Manually tested on docs.google.com website.
2320
2321         * page/DOMWindow.cpp:
2322         (WebCore::DOMWindow::createWindow):
2323         (WebCore::DOMWindow::open):
2324         * page/Quirks.cpp:
2325         (WebCore::Quirks::needsYouTubeOverflowScrollQuirk const):
2326         (WebCore::Quirks::shouldOpenAsAboutBlank const):
2327         * page/Quirks.h:
2328
2329 2019-07-26  Alexander Mikhaylenko  <exalm7659@gmail.com>
2330
2331         REGRESSION(r246496): [GTK] Tapping the web view scrolls up a bit
2332         https://bugs.webkit.org/show_bug.cgi?id=200084
2333
2334         Reviewed by Carlos Garcia Campos.
2335
2336         gdk_event_get_scroll_direction() returns false, but also sets direction to GDK_SCROLL_UP if
2337         the direction was GDK_SCROLL_SMOOTH. Relying on zero deltas in this case is not correct, because
2338         they can also be zero with GDK_SCROLL_SMOOTH. In this case, set the direction manually to avoid
2339         that.
2340
2341         See https://gitlab.gnome.org/GNOME/gtk/issues/2048
2342
2343         * platform/gtk/PlatformWheelEventGtk.cpp:
2344         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
2345
2346 2019-07-26  Rob Buis  <rbuis@igalia.com>
2347
2348         Make storing cross-origin top-level prefetches in HTTP cache optional
2349         https://bugs.webkit.org/show_bug.cgi?id=199499
2350
2351         Reviewed by Youenn Fablet.
2352
2353         Add Internals API for adding an event listener to prefetch load.
2354
2355         Test: http/wpt/prefetch/link-prefetch-skip-disk-cache.html
2356
2357         * bindings/js/JSEventListener.h:
2358         * dom/EventTarget.h:
2359         (WebCore::EventTarget::addEventListener):
2360         * dom/Node.h:
2361         * html/HTMLLinkElement.h:
2362         * testing/Internals.cpp:
2363         (WebCore::Internals::addPrefetchLoadEventListener):
2364         * testing/Internals.h:
2365         * testing/Internals.idl:
2366
2367 2019-07-25  Tim Horton  <timothy_horton@apple.com>
2368
2369         Subpixel fringes around TextIndicator snapshots at non-integral scale factors
2370         https://bugs.webkit.org/show_bug.cgi?id=200145
2371
2372         Reviewed by Simon Fraser.
2373
2374         * page/FrameSnapshotting.cpp:
2375         (WebCore::snapshotFrameRectWithClip):
2376         * page/FrameSnapshotting.h:
2377         * page/TextIndicator.cpp:
2378         (WebCore::snapshotOptionsForTextIndicatorOptions):
2379         Round the scale factor up, and snappily enclose the clip rects.
2380
2381         TextIndicator doesn't require the use of the precise scale factor that
2382         the page is painted at, but we want it to be sharp, so we overshoot!
2383
2384 2019-07-25  Brent Fulgham  <bfulgham@apple.com>
2385
2386         Use IWICBitmap (rather than ID2D1Bitmap) for NativeImagePtr on FTW
2387         https://bugs.webkit.org/show_bug.cgi?id=200093
2388
2389         Reviewed by Dean Jackson.
2390
2391         When I wrote the original Direct2D code, I did not realize that the backing memory for the
2392         ID2D1Bitmap was inaccessible since it is effectively a representation of GPU memory. There
2393         is no API to access or modify the pixels.
2394
2395         Instead, MSDN documentation indicates that we should be using IWICBitmap objects, which are
2396         converted to ID2D1Bitmap objects when things are ready to be rendered.
2397
2398         This makes it possible to use the TextureMapper backend to do efficient compositing and tile
2399         drawing, since the data backing the bitmap can now be accessed and manipulated, allowing us
2400         to support filters and other effects.
2401
2402         * PlatformFTW.cmake:
2403         * platform/MIMETypeRegistry.cpp:
2404         (WebCore::supportedImageMIMETypesForEncoding):
2405         * platform/graphics/ANGLEWebKitBridge.h:
2406         * platform/graphics/GraphicsContext.h:
2407         * platform/graphics/ImageBuffer.h:
2408         * platform/graphics/NativeImage.h:
2409         * platform/graphics/OpenGLShims.h:
2410         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2411         (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
2412         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
2413         (WebCore::GraphicsContext3D::GraphicsContext3D):
2414         (WebCore::GraphicsContext3D::platformLayer const):
2415         * platform/graphics/texmap/BitmapTexture.cpp:
2416         (WebCore::BitmapTexture::updateContents):
2417         * platform/graphics/texmap/BitmapTextureGL.cpp:
2418         (WebCore::BitmapTextureGL::updateContents):
2419         * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp:
2420         (WebCore::GraphicsContext3D::~GraphicsContext3D):
2421         * platform/graphics/win/GraphicsContextDirect2D.cpp:
2422         (WebCore::GraphicsContext::GraphicsContext):
2423         (WebCore::GraphicsContext::platformInit):
2424         (WebCore::GraphicsContextPlatformPrivate::setAlpha):
2425         (WebCore::GraphicsContext::drawNativeImage):
2426         (WebCore::GraphicsContext::drawDeviceBitmap):
2427         (WebCore::GraphicsContext::releaseWindowsContext):
2428         (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
2429         (WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate):
2430         (WebCore::GraphicsContextPlatformPrivate::beginDraw):
2431         (WebCore::GraphicsContextPlatformPrivate::endDraw):
2432         (WebCore::GraphicsContext::drawPattern):
2433         (WebCore::GraphicsContext::clipPath):
2434         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
2435         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
2436         (WebCore::ImageBufferData::getData const):
2437         (WebCore::ImageBufferData::putData):
2438         * platform/graphics/win/ImageBufferDataDirect2D.h:
2439         (): Deleted.
2440         * platform/graphics/win/ImageBufferDirect2D.cpp:
2441         (WebCore::ImageBuffer::createCompatibleBuffer):
2442         (WebCore::ImageBuffer::ImageBuffer):
2443         (WebCore::createCroppedImageIfNecessary):
2444         (WebCore::createBitmapImageAfterScalingIfNeeded):
2445         (WebCore::ImageBuffer::copyImage const):
2446         (WebCore::ImageBuffer::sinkIntoNativeImage):
2447         (WebCore::ImageBuffer::copyNativeImage const):
2448         (WebCore::ImageBuffer::draw):
2449         * platform/graphics/win/ImageDecoderDirect2D.cpp:
2450         (WebCore::ImageDecoderDirect2D::createFrameImageAtIndex):
2451         * platform/graphics/win/ImageDirect2D.cpp:
2452         (WebCore::BitmapImage::drawFrameMatchingSourceSize):
2453         * platform/graphics/win/NativeImageDirect2D.cpp:
2454         (WebCore::imagingFactory):
2455         (WebCore::nativeImageSize):
2456         (WebCore::nativeImageHasAlpha):
2457         (WebCore::nativeImageSinglePixelSolidColor):
2458         (WebCore::drawNativeImage):
2459         (WebCore::clearNativeImageSubimages):
2460         * platform/graphics/win/PathDirect2D.cpp:
2461         (WebCore::Path::strokeContains const):
2462         * platform/graphics/win/PatternDirect2D.cpp:
2463         (WebCore::Pattern::createPlatformPattern const):
2464         * platform/win/PasteboardWin.cpp:
2465         (WebCore::Pasteboard::read):
2466         * rendering/RenderElement.cpp:
2467         (WebCore::RenderElement::shouldRespectImageOrientation const):
2468         * rendering/RenderLayerBacking.cpp:
2469         (WebCore::RenderLayerBacking::adjustTiledBackingCoverage):
2470         * svg/graphics/SVGImage.cpp:
2471         (WebCore::SVGImage::nativeImage):
2472
2473 2019-07-25  Ryosuke Niwa  <rniwa@webkit.org>
2474
2475         REGRESSION (r243637): Some web fonts fail to load on Google docs
2476         https://bugs.webkit.org/show_bug.cgi?id=200106
2477
2478         Reviewed by Geoffrey Garen.
2479
2480         Prior to r243637, WebKit threw an exception if the font family name didn't parse as a CSS identifier in the setter
2481         of `family` IDL attribute of FontFace interface because WebKit implemented the old spec faithfully unlike Chrome
2482         and Firefox which basically treated it as a string and didn't throw any exception. [1]
2483
2484         To account for this browser behavior difference, Google docs implemented a workaround for Safari which is to wrap
2485         some identifiers in font family names with quotation marks: `docs-Amatic SC` as `'docs-Amatic SC'` and
2486         `docs-Playfair Display` as `docs-'Playfair Display'`. Unfortunately, this in turn causes the latest Safari to
2487         not match these font face family with those that appear in stylesheet since we no longer parse it as a CSS identifier.
2488
2489         This patch adds a site specific quirk for Google docs to undo this workaround by stripping away single quotation marks.
2490
2491         [1] See https://github.com/w3c/csswg-drafts/issues/3776 for the context.
2492
2493         * css/FontFace.cpp:
2494         (WebCore::FontFace::create):
2495         (WebCore::FontFace::setFamily):
2496         * css/FontFace.h:
2497         * css/FontFace.idl:
2498         * page/Quirks.cpp:
2499         (WebCore::Quirks::shouldStripQuotationMarkInFontFaceSetFamily const):
2500         * page/Quirks.h:
2501
2502 2019-07-25  Dean Jackson  <dino@apple.com>
2503
2504         Add helper for ignoring deprecated implementation warnings
2505         https://bugs.webkit.org/show_bug.cgi?id=200135
2506
2507         Reviewed by Wenson Hsieh.
2508
2509         Add ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN/END macro which
2510         is IGNORE_WARNINGS_BEGIN("deprecated-implementations")
2511
2512         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2513         (-[WebAccessibilityObjectWrapper ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
2514         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2515         (-[WebAccessibilityObjectWrapper accessibilityIsAttributeSettable:]):
2516         (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]):
2517         (-[WebAccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
2518         (-[WebAccessibilityObjectWrapper accessibilityActionDescription:]):
2519         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
2520         (-[WebAccessibilityObjectWrapper IGNORE_WARNINGS_END]): Deleted.
2521         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2522         (-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]):
2523         (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]):
2524         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2525         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
2526         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
2527
2528 2019-07-25  Saam Barati  <sbarati@apple.com>
2529
2530         Unreviewed. Speculative build fix for tvOS of missing include.
2531
2532         * Modules/webgpu/WHLSL/WHLSLLexer.h:
2533
2534 2019-07-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2535
2536         Unreviewed, fix -Wunused-parameter warning
2537
2538         * testing/Internals.cpp:
2539         (WebCore::Internals::privatePlayerVolume):
2540
2541 2019-07-25  Saam Barati  <sbarati@apple.com>
2542
2543         [WHLSL] Add descriptive error messages
2544         https://bugs.webkit.org/show_bug.cgi?id=195682
2545         <rdar://problem/50746322>
2546
2547         Reviewed by Myles C. Maxfield.
2548
2549         This patch adds error messages to the WHLSL compiler. I'm taking a first pass
2550         at having decent error messages everywhere we set an error. However, we will
2551         probably refine these messages to be more accurate and descriptive over time.
2552         
2553         Passes that can fail no longer return a boolean. Instead, they return Expected<void, Error>.
2554         From Error, we can generate a descriptive error message. Visitor::setError now
2555         requires an Error as an argument. So anywhere in Visitor that might fail is
2556         now required to provide an error message.
2557         
2558         In a follow-up to this, we should actually make our checkFail tests test that
2559         they get the expected error message: https://bugs.webkit.org/show_bug.cgi?id=200049
2560
2561         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
2562         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
2563         * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h:
2564         * Modules/webgpu/WHLSL/AST/WHLSLBaseFunctionAttribute.h:
2565         * Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h:
2566         * Modules/webgpu/WHLSL/AST/WHLSLBlock.h:
2567         * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h:
2568         * Modules/webgpu/WHLSL/AST/WHLSLBreak.h:
2569         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h:
2570         * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
2571         * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h:
2572         * Modules/webgpu/WHLSL/AST/WHLSLContinue.h:
2573         * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h:
2574         * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h:
2575         * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h:
2576         * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h:
2577         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h:
2578         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h:
2579         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h:
2580         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
2581         * Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h:
2582         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h:
2583         * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h:
2584         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
2585         * Modules/webgpu/WHLSL/AST/WHLSLGlobalVariableReference.h:
2586         * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h:
2587         * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h:
2588         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h:
2589         * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h:
2590         * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h:
2591         * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h:
2592         * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h:
2593         * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h:
2594         * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h:
2595         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h:
2596         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
2597         * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h:
2598         * Modules/webgpu/WHLSL/AST/WHLSLQualifier.h:
2599         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
2600         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
2601         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h:
2602         * Modules/webgpu/WHLSL/AST/WHLSLReturn.h:
2603         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h:
2604         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h:
2605         * Modules/webgpu/WHLSL/AST/WHLSLStatement.h:
2606         * Modules/webgpu/WHLSL/AST/WHLSLStatementList.h:
2607         * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h:
2608         * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h:
2609         * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h:
2610         * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h:
2611         * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h:
2612         * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h:
2613         * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h:
2614         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
2615         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
2616         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h:
2617         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
2618         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h:
2619         * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h:
2620         * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h:
2621         * Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp:
2622         (WebCore::WHLSL::AutoInitialize::visit):
2623         (WebCore::WHLSL::autoInitializeVariables):
2624         * Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.h:
2625         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp:
2626         (WebCore::WHLSL::checkDuplicateFunctions):
2627         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.h:
2628         * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp:
2629         (WebCore::WHLSL::TextureReferencesChecker::visit):
2630         (WebCore::WHLSL::checkTextureReferences):
2631         * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.h:
2632         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
2633         (WebCore::WHLSL::resolveWithOperatorAnderIndexer):
2634         (WebCore::WHLSL::resolveWithOperatorLength):
2635         (WebCore::WHLSL::resolveWithReferenceComparator):
2636         (WebCore::WHLSL::resolveByInstantiation):
2637         (WebCore::WHLSL::resolveFunction):
2638         (WebCore::WHLSL::checkSemantics):
2639         (WebCore::WHLSL::Checker::assignTypes):
2640         (WebCore::WHLSL::Checker::visit):
2641         (WebCore::WHLSL::Checker::recurseAndGetInfo):
2642         (WebCore::WHLSL::Checker::getInfo):
2643         (WebCore::WHLSL::Checker::finishVisiting):
2644         (WebCore::WHLSL::Checker::recurseAndRequireBoolType):
2645         (WebCore::WHLSL::check):
2646         * Modules/webgpu/WHLSL/WHLSLChecker.h:
2647         * Modules/webgpu/WHLSL/WHLSLCodeLocation.h: Added.
2648         (WebCore::WHLSL::CodeLocation::CodeLocation):
2649         (WebCore::WHLSL::CodeLocation::startOffset const):
2650         (WebCore::WHLSL::CodeLocation::endOffset const):
2651         (WebCore::WHLSL::CodeLocation::operator== const):
2652         (WebCore::WHLSL::CodeLocation::operator!= const):
2653         (WebCore::WHLSL::CodeLocation::operator bool const):
2654         * Modules/webgpu/WHLSL/WHLSLComputeDimensions.cpp:
2655         (WebCore::WHLSL::computeDimensions):
2656         * Modules/webgpu/WHLSL/WHLSLError.h: Added.
2657         (WebCore::WHLSL::Error::Error):
2658         (WebCore::WHLSL::Error::codeLocation const):
2659         (WebCore::WHLSL::Error::message const):
2660         * Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.cpp:
2661         (WebCore::WHLSL::checkFunctionStages):
2662         * Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.h:
2663         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp:
2664         (WebCore::WHLSL::Gatherer::reset):
2665         (WebCore::WHLSL::Gatherer::visit):
2666         (WebCore::WHLSL::gatherEntryPointItems):
2667         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.h:
2668         * Modules/webgpu/WHLSL/WHLSLLexer.cpp:
2669         (WebCore::WHLSL::Lexer::lineAndColumnNumberFromOffset):
2670         (WebCore::WHLSL::Lexer::errorString):
2671         (WebCore::WHLSL::Lexer::lineNumberFromOffset): Deleted.
2672         * Modules/webgpu/WHLSL/WHLSLLexer.h:
2673         (WebCore::WHLSL::CodeLocation::CodeLocation):
2674         (WebCore::WHLSL::Lexer::errorString):
2675         (WebCore::WHLSL::AST::CodeLocation::CodeLocation): Deleted.
2676         (WebCore::WHLSL::AST::CodeLocation::startOffset const): Deleted.
2677         (WebCore::WHLSL::AST::CodeLocation::endOffset const): Deleted.
2678         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
2679         (WebCore::WHLSL::NameResolver::~NameResolver):
2680         (WebCore::WHLSL::NameResolver::visit):
2681         (WebCore::WHLSL::resolveNamesInTypes):
2682         (WebCore::WHLSL::resolveTypeNamesInFunctions):
2683         * Modules/webgpu/WHLSL/WHLSLNameResolver.h:
2684         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
2685         (WebCore::WHLSL::Parser::parse):
2686         (WebCore::WHLSL::intLiteralToInt):
2687         (WebCore::WHLSL::uintLiteralToUint):
2688         (WebCore::WHLSL::floatLiteralToFloat):
2689         (WebCore::WHLSL::recognizeSimpleUnsignedInteger):
2690         (WebCore::WHLSL::Parser::parseTypeArgument):
2691         (WebCore::WHLSL::Parser::parseType):
2692         (WebCore::WHLSL::Parser::parseForLoop):
2693         (WebCore::WHLSL::Parser::parseWhileLoop):
2694         (WebCore::WHLSL::Parser::parseEffectfulExpression):
2695         (WebCore::WHLSL::Parser::parseLimitedSuffixOperator):
2696         (WebCore::WHLSL::Parser::parseSuffixOperator):
2697         (WebCore::WHLSL::Parser::parseExpression):
2698         (WebCore::WHLSL::Parser::completeTernaryConditional):
2699         (WebCore::WHLSL::Parser::completeAssignment):
2700         (WebCore::WHLSL::Parser::completePossibleLogicalBinaryOperation):
2701         (WebCore::WHLSL::Parser::completePossibleRelationalBinaryOperation):
2702         (WebCore::WHLSL::Parser::completePossibleShift):
2703         (WebCore::WHLSL::Parser::completePossibleAdd):
2704         (WebCore::WHLSL::Parser::completePossibleMultiply):
2705         (WebCore::WHLSL::Parser::parsePossiblePrefix):
2706         (WebCore::WHLSL::Parser::parseCallExpression):
2707         * Modules/webgpu/WHLSL/WHLSLParser.h:
2708         (WebCore::WHLSL::Parser::Error::Error): Deleted.
2709         (WebCore::WHLSL::Parser::Error::dump const): Deleted.
2710         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
2711         (WebCore::WHLSL::prepareShared):
2712         (WebCore::WHLSL::prepare):
2713         * Modules/webgpu/WHLSL/WHLSLPrepare.h:
2714         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
2715         (WebCore::WHLSL::setterCall):
2716         (WebCore::WHLSL::getterCall):
2717         (WebCore::WHLSL::modify):
2718         (WebCore::WHLSL::PropertyResolver::visit):
2719         * Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp:
2720         (WebCore::WHLSL::checkRecursion):
2721         * Modules/webgpu/WHLSL/WHLSLRecursionChecker.h:
2722         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp:
2723         (WebCore::WHLSL::checkRecursiveTypes):
2724         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.h:
2725         * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp:
2726         (WebCore::WHLSL::includeStandardLibrary):
2727         * Modules/webgpu/WHLSL/WHLSLStatementBehaviorChecker.cpp:
2728         (WebCore::WHLSL::checkStatementBehavior):
2729         * Modules/webgpu/WHLSL/WHLSLStatementBehaviorChecker.h:
2730         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
2731         (WebCore::WHLSL::synthesizeArrayOperatorLength):
2732         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.h:
2733         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
2734         (WebCore::WHLSL::synthesizeConstructors):
2735         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.h:
2736         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
2737         (WebCore::WHLSL::synthesizeEnumerationFunctions):
2738         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.h:
2739         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
2740         (WebCore::WHLSL::synthesizeStructureAccessors):
2741         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.h:
2742         * Modules/webgpu/WHLSL/WHLSLVisitor.h:
2743         (WebCore::WHLSL::Visitor::hasError const):
2744         (WebCore::WHLSL::Visitor::expectedError):
2745         (WebCore::WHLSL::Visitor::checkErrorAndVisit):
2746         (WebCore::WHLSL::Visitor::setError):
2747         (WebCore::WHLSL::Visitor::error const): Deleted.
2748         (): Deleted.
2749         * WebCore.xcodeproj/project.pbxproj:
2750         * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
2751         (WebCore::trySetFunctions):
2752
2753 2019-07-25  Saam Barati  <sbarati@apple.com>
2754
2755         [WHLSL] Add optional logging for phase timings
2756         https://bugs.webkit.org/show_bug.cgi?id=200099
2757
2758         Reviewed by Dean Jackson.
2759
2760         As we're doing WHLSL compiler speedup work, it helps to be able to
2761         log phase times. I think a few of us have written such patches locally.
2762         In this patch, I'm adding a way to easily switch this logging on and
2763         off by flipping a "constexpr bool" and rebuilding.
2764
2765         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
2766         (WebCore::WHLSL::logPhaseTimes):
2767         (WebCore::WHLSL::PhaseTimer::PhaseTimer):
2768         (WebCore::WHLSL::PhaseTimer::~PhaseTimer):
2769         (WebCore::WHLSL::prepareShared):
2770         (WebCore::WHLSL::prepare):
2771
2772 2019-07-25  Chris Dumez  <cdumez@apple.com>
2773
2774         Avoid some unnecessary HashMap copies
2775         https://bugs.webkit.org/show_bug.cgi?id=200129
2776
2777         Reviewed by Youenn Fablet.
2778
2779         * workers/service/server/SWServer.cpp:
2780         (WebCore::SWServer::addRegistrationFromStore):
2781
2782 2019-07-25  Joshua Watt  <JPEW.hacker@gmail.com>
2783
2784         [WPE] Draw other button types
2785         https://bugs.webkit.org/show_bug.cgi?id=199377
2786
2787         Reviewed by Michael Catanzaro.
2788
2789         There are other button types that should be drawn with the default style
2790         besides just push buttons.
2791
2792         * platform/wpe/ThemeWPE.cpp:
2793         (WebCore::ThemeWPE::paint):
2794         (WebCore::ThemeWPE::paintButton):
2795         * platform/wpe/ThemeWPE.h:
2796
2797 2019-07-25  Said Abou-Hallawa  <sabouhallawa@apple.com>
2798
2799         REGRESSION (r244995): Assertion failure when addEventListener to an SVGElement which has an. instance in shadow tree
2800         https://bugs.webkit.org/show_bug.cgi?id=200083
2801
2802         Reviewed by Ryosuke Niwa.
2803
2804         When adding an event listener to an SVGElement, the same event listener
2805         has to be add to all the instances of SVGElement in the shadow tree. See
2806         SVGElement::addEventListener().
2807
2808         In r244995, an assertion was added to ensure if the event listener is
2809         attached to an event target, the new event target has be the same as the
2810         attached one. This assertion isn't correct for the event targets which 
2811         were copied from the targetElement sub tree of an SVGUseElement to the
2812         shadow tree.
2813
2814         Test: svg/custom/add-event-listener-shadow-tree-element.html
2815
2816         * bindings/js/JSLazyEventListener.cpp:
2817         (WebCore::isCloneInShadowTreeOfSVGUseElement):
2818         (WebCore::JSLazyEventListener::checkValidityForEventTarget):
2819
2820 2019-07-25  Truitt Savell  <tsavell@apple.com>
2821
2822         Unreviewed, rolling out r247821.
2823
2824         Caused two crashing Layout Tests
2825
2826         Reverted changeset:
2827
2828         "Make storing cross-origin top-level prefetches in HTTP cache
2829         optional"
2830         https://bugs.webkit.org/show_bug.cgi?id=199499
2831         https://trac.webkit.org/changeset/247821
2832
2833 2019-07-25  Chris Dumez  <cdumez@apple.com>
2834
2835         Avoid UI Process hangs when the WebContent process is showing JS prompts / alerts
2836         https://bugs.webkit.org/show_bug.cgi?id=200107
2837         <rdar://problem/53034592>
2838
2839         Reviewed by Geoffrey Garen.
2840
2841         Add testing infrastructure for SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply.
2842
2843         Test: fast/misc/testProcessIncomingSyncMessagesWhenWaitingForSyncReply.html
2844
2845         * page/ChromeClient.h:
2846         * testing/Internals.cpp:
2847         (WebCore::Internals::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
2848         * testing/Internals.h:
2849         * testing/Internals.idl:
2850
2851 2019-07-25  Rob Buis  <rbuis@igalia.com>
2852
2853         Make storing cross-origin top-level prefetches in HTTP cache optional
2854         https://bugs.webkit.org/show_bug.cgi?id=199499
2855
2856         Reviewed by Youenn Fablet.
2857
2858         Add Internals API for adding an event listener to prefetch load.
2859
2860         Test: http/wpt/prefetch/link-prefetch-skip-disk-cache.html
2861
2862         * bindings/js/JSEventListener.h:
2863         * dom/EventTarget.h:
2864         (WebCore::EventTarget::addEventListener):
2865         * dom/Node.h:
2866         * html/HTMLLinkElement.h:
2867         * testing/Internals.cpp:
2868         (WebCore::Internals::addPrefetchLoadEventListener):
2869         * testing/Internals.h:
2870         * testing/Internals.idl:
2871
2872 2019-07-24  Yusuke Suzuki  <ysuzuki@apple.com>
2873
2874         [bmalloc] Add IsoHeap test to ensure that IsoHeap pages are not allocating too large VA
2875         https://bugs.webkit.org/show_bug.cgi?id=200103
2876
2877         Reviewed by Mark Lam.
2878
2879         No behavior change in WebCore.
2880
2881         * page/MemoryRelease.cpp:
2882         * page/ResourceUsageThread.h:
2883         (WebCore::TagInfo::TagInfo): Deleted.
2884         * page/cocoa/ResourceUsageThreadCocoa.mm:
2885         (WebCore::vmPageSize): Deleted.
2886         (WebCore::logFootprintComparison): Deleted.
2887         (WebCore::displayNameForVMTag): Deleted.
2888         (WebCore::pagesPerVMTag): Deleted.
2889
2890 2019-07-24  Devin Rousso  <drousso@apple.com>
2891
2892         Web Inspector: support `console.screenshot` with detached Nodes that are graphical
2893         https://bugs.webkit.org/show_bug.cgi?id=199309
2894
2895         Reviewed by Joseph Pecoraro.
2896
2897         Test: inspector/console/console-screenshot.html
2898
2899         * page/PageConsoleClient.cpp:
2900         (WebCore::PageConsoleClient::screenshot):
2901
2902 2019-07-24  Saam Barati  <sbarati@apple.com>
2903
2904         [WHLSL] Use bmalloc instead of system malloc for WHLSL data structures
2905         https://bugs.webkit.org/show_bug.cgi?id=200063
2906
2907         Rubber-stamped by Sam Weinig.
2908
2909         This is a 25-30% WHLSL compile time speedup on Justin's textured-cube demo
2910         and a ~40% compile time speedup on the hello-cube demo.
2911         
2912         The phases that speed up from this are:
2913         checker
2914         includeStandardLibrary
2915         autoInitializeVariables
2916         resolveProperties
2917
2918         * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h:
2919         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
2920         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
2921         * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h:
2922         * Modules/webgpu/WHLSL/AST/WHLSLBaseFunctionAttribute.h:
2923         * Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h:
2924         * Modules/webgpu/WHLSL/AST/WHLSLBlock.h:
2925         * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h:
2926         * Modules/webgpu/WHLSL/AST/WHLSLBreak.h:
2927         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h:
2928         * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
2929         * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h:
2930         * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h:
2931         * Modules/webgpu/WHLSL/AST/WHLSLContinue.h:
2932         * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h:
2933         * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h:
2934         * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h:
2935         * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h:
2936         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h:
2937         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h:
2938         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h:
2939         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
2940         * Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h:
2941         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h:
2942         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h:
2943         * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h:
2944         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
2945         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h:
2946         * Modules/webgpu/WHLSL/AST/WHLSLGlobalVariableReference.h:
2947         * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h:
2948         * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h:
2949         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h:
2950         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h:
2951         * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h:
2952         * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h:
2953         * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h:
2954         * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h:
2955         * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h:
2956         * Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h:
2957         * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h:
2958         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h:
2959         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h:
2960         * Modules/webgpu/WHLSL/AST/WHLSLNumThreadsFunctionAttribute.h:
2961         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
2962         * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h:
2963         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
2964         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
2965         * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h:
2966         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h:
2967         * Modules/webgpu/WHLSL/AST/WHLSLReturn.h:
2968         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h:
2969         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h:
2970         * Modules/webgpu/WHLSL/AST/WHLSLStatement.h:
2971         * Modules/webgpu/WHLSL/AST/WHLSLStatementList.h:
2972         * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h:
2973         * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h:
2974         * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h:
2975         * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h:
2976         * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h:
2977         * Modules/webgpu/WHLSL/AST/WHLSLType.h:
2978         * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h:
2979         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
2980         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
2981         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h:
2982         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h:
2983         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
2984         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h:
2985         * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h:
2986         * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h:
2987         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
2988
2989 2019-07-24  Devin Rousso  <drousso@apple.com>
2990
2991         Web Inspector: support `console.screenshot` with ImageData and ImageBitmap
2992         https://bugs.webkit.org/show_bug.cgi?id=199304
2993
2994         Reviewed by Joseph Pecoraro.
2995
2996         Test: inspector/console/console-screenshot.html
2997
2998         * page/PageConsoleClient.cpp:
2999         (WebCore::PageConsoleClient::screenshot):
3000
3001 2019-07-24  Devin Rousso  <drousso@apple.com>
3002
3003         Web Inspector: REGRESSION: Overlay: highlighting a ::before/::after shows the node info of the parent instead
3004         https://bugs.webkit.org/show_bug.cgi?id=200051
3005
3006         Reviewed by Joseph Pecoraro.
3007
3008         When highlighting a pseudo-element, only use the parent node for selector information. All
3009         rendering data should still come from the pseudo-element itself.
3010
3011         * inspector/InspectorOverlay.cpp:
3012         (WebCore::drawShapeHighlight):
3013         (WebCore::InspectorOverlay::drawElementTitle):
3014
3015 2019-07-24  Devin Rousso  <drousso@apple.com>
3016
3017         Web Inspector: support `console.screenshot` with subclasses of CanvasRenderingContext
3018         https://bugs.webkit.org/show_bug.cgi?id=199305
3019
3020         Reviewed by Joseph Pecoraro.
3021
3022         Test: inspector/console/console-screenshot.html
3023
3024         * page/PageConsoleClient.cpp:
3025         (WebCore::canvasRenderingContext):
3026         (WebCore::PageConsoleClient::record):
3027         (WebCore::PageConsoleClient::recordEnd):
3028         (WebCore::PageConsoleClient::screenshot):
3029
3030 2019-07-24  Youenn Fablet  <youenn@apple.com>
3031
3032         Remove MediaPlayerPrivate::supportsMuting()
3033         https://bugs.webkit.org/show_bug.cgi?id=200005
3034
3035         Reviewed by Eric Carlson.
3036
3037         Remove no longer needed interface method.
3038         No change of behavior.
3039
3040         * WebCore.order:
3041         * platform/graphics/MediaPlayer.cpp:
3042         (WebCore::MediaPlayer::setVolume):
3043         (WebCore::MediaPlayer::setMuted):
3044         * platform/graphics/MediaPlayerPrivate.h:
3045         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3046         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3047         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3048         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3049         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
3050         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
3051
3052 2019-07-24  Tim Horton  <timothy_horton@apple.com>
3053
3054         Daring Fireball long press highlights are unnecessarily inflated due to false illegibility
3055         https://bugs.webkit.org/show_bug.cgi?id=200064
3056
3057         Reviewed by Geoff Garen.
3058
3059         If we consider text illegible on the given estimated background color,
3060         we bail from doing a tightly fitted selection-only TextIndicator and
3061         instead just paint the page without modification into the indicator,
3062         causing ugly overlap and an excessively inflated indicator.
3063
3064         Change the mechanism we use to determine illegibility to be based on
3065         a standard, instead of a constant chosen by hand 13 years ago.
3066
3067         Test: fast/text-indicator/text-indicator-with-low-contrast-text.html
3068
3069         * platform/graphics/ColorUtilities.cpp:
3070         (WebCore::luminance):
3071         Fix a typo.
3072
3073         (WebCore::contrastRatio):
3074         Add a function that computes the contrast ratio given two colors using
3075         the formula from WCAG.
3076
3077         * platform/graphics/ColorUtilities.h:
3078         * rendering/TextPaintStyle.cpp:
3079         (WebCore::textColorIsLegibleAgainstBackgroundColor):
3080         Make use of WCAG's minimum legible contrast ratio instead of an
3081         arbitrary color difference cutoff for determining whether we consider
3082         text legible. It seems sensible and also considers the text on DF readable
3083         (which it seems to be to me!).
3084
3085         * testing/Internals.cpp:
3086         (WebCore::Internals::TextIndicatorInfo::TextIndicatorInfo):
3087         * testing/Internals.h:
3088         * testing/Internals.idl:
3089         Expose all of the text rects to Internals, not just the bounding rect.
3090         Expose some more TextIndicator options to Internals so that we can
3091         turn on the legibility mechanism.
3092
3093 2019-07-24  Devin Rousso  <drousso@apple.com>
3094
3095         Web Inspector: print the target of `console.screenshot` last so the target is the closest item to the image
3096         https://bugs.webkit.org/show_bug.cgi?id=199308
3097
3098         Reviewed by Joseph Pecoraro.
3099
3100         Right now, evaluating `console.screenshot(document, "test", 1);` will log a message to the
3101         console with `#document`, `"test"`, and `1`, all on different lines (togglable by a
3102         disclosure triangle) since `#document` isn't stringifiable.
3103
3104         The ideal situation would be to have `"test"` and `1` logged on the same line, and then have
3105         `#document` be in a disclosure triangle. This way, you can "label" your images using
3106         additional arguments (e.g. `console.screenshot(document.images[1], "second image");`), as
3107         well as provide other data.
3108
3109         If the only argument was the target, it should print as if it was `console.log(target);`.
3110
3111         If there are no arguments, it should print the text "Viewport"` before the image.
3112
3113         Test: inspector/console/console-screenshot.html
3114
3115         * page/PageConsoleClient.cpp:
3116         (WebCore::PageConsoleClient::addMessage):
3117         (WebCore::PageConsoleClient::screenshot):
3118
3119 2019-07-24  Alicia Boya García  <aboya@igalia.com>
3120
3121         [MSE] Reenqueue after removeCodedFrames()
3122         https://bugs.webkit.org/show_bug.cgi?id=199749
3123
3124         Reviewed by Xabier Rodriguez-Calvar.
3125
3126         Before this patch, SourceBuffer::removeCodedFrames() did not trigger
3127         an immediate reenqueue, but rather just set the `needsReenqueuing`
3128         flag, deferring it for the next append... but there may not be another
3129         append! In that case, the removed frames would still wrongly play.
3130
3131         This is the case for instance in tests where a single long media
3132         append is done and then "cropped" with SourceBuffer.erase().
3133
3134         Test: media/media-source/media-source-erase-after-last-append.html
3135
3136         * Modules/mediasource/SourceBuffer.cpp:
3137         (WebCore::SourceBuffer::removeCodedFrames):
3138
3139 2019-07-24  Jer Noble  <jer.noble@apple.com>
3140
3141         Add per-document autoplay quirk for netflix.com.
3142         https://bugs.webkit.org/show_bug.cgi?id=200058
3143
3144         Reviewed by Eric Carlson.
3145
3146         Opt netflix.com into the desktop-style per-document autoplay quirk.
3147
3148         * page/Quirks.cpp:
3149         (WebCore::Quirks::needsPerDocumentAutoplayBehavior const):
3150
3151 2019-07-24  Alicia Boya García  <aboya@igalia.com>
3152
3153         [GStreamer] Don't crash with empty video src
3154         https://bugs.webkit.org/show_bug.cgi?id=200081
3155
3156         When a <video> element is set to load empty or about:blank, a player is still
3157         created, but no pipeline is loaded. This patch fixes some assertion errors that
3158         manifested in that case.
3159
3160         Reviewed by Philippe Normand.
3161
3162         Test: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video_crash_empty_src.html
3163
3164         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3165         (WebCore::MediaPlayerPrivateGStreamer::loadFull):
3166         (WebCore::MediaPlayerPrivateGStreamer::platformDuration const):
3167         (WebCore::MediaPlayerPrivateGStreamer::paused const):
3168
3169 2019-07-23  Justin Fan  <justin_fan@apple.com>
3170
3171         [WebGPU] Implement errors for GPURenderPipeline creation
3172         https://bugs.webkit.org/show_bug.cgi?id=200046
3173
3174         Reviewed by Myles C. Maxfield.
3175
3176         Replacing error logging in GPURenderPipeline creation with GPUError generation. 
3177         Update GPUErrorScopes to re-use an error message prefix for less boiler-plate.
3178
3179         Test: webgpu/render-pipeline-errors.html
3180
3181         * Modules/webgpu/WebGPUDevice.cpp:
3182         (WebCore::WebGPUDevice::createRenderPipeline const):
3183         * Modules/webgpu/WebGPURenderPipelineDescriptor.cpp:
3184         (WebCore::WebGPURenderPipelineDescriptor::tryCreateGPURenderPipelineDescriptor const):
3185         * Modules/webgpu/WebGPURenderPipelineDescriptor.h:
3186         * platform/graphics/gpu/GPUDevice.cpp:
3187         (WebCore::GPUDevice::tryCreateRenderPipeline const):
3188         * platform/graphics/gpu/GPUDevice.h:
3189         * platform/graphics/gpu/GPUErrorScopes.cpp:
3190         (WebCore::GPUErrorScopes::generatePrefixedError):
3191         * platform/graphics/gpu/GPUErrorScopes.h:
3192         (WebCore::GPUErrorScopes::setErrorPrefix):
3193         * platform/graphics/gpu/GPURenderPipeline.h:
3194         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
3195         (WebCore::tryCreateMtlDepthStencilState):
3196         (WebCore::trySetVertexInput):
3197         (WebCore::trySetColorStates):
3198         (WebCore::trySetMetalFunctions):
3199         (WebCore::trySetFunctions):
3200         (WebCore::convertRenderPipelineDescriptor):
3201         (WebCore::tryCreateMtlRenderPipelineState):
3202         (WebCore::GPURenderPipeline::tryCreate):
3203         (WebCore::GPURenderPipeline::GPURenderPipeline):
3204
3205 2019-07-23  Konstantin Tokarev  <annulen@yandex.ru>
3206
3207         ImageDecoderDirect2D::hotSpot() should return WTF::nullopt instead of default constructed value
3208         https://bugs.webkit.org/show_bug.cgi?id=200055
3209
3210         Reviewed by Brent Fulgham.
3211
3212         * platform/graphics/win/ImageDecoderDirect2D.cpp:
3213         (WebCore::ImageDecoderDirect2D::hotSpot const):
3214
3215 2019-07-23  Tim Horton  <timothy_horton@apple.com>
3216
3217         Long press hint has half blue shape in Feedly.com
3218         https://bugs.webkit.org/show_bug.cgi?id=200053
3219         <rdar://problem/53323369>
3220
3221         Reviewed by Simon Fraser.
3222
3223         No new tests, because TextIndicator snapshots are not yet testable.
3224
3225         * rendering/RenderLayer.cpp:
3226         (WebCore::RenderLayer::paintForegroundForFragments):
3227         Paint ChildBlockBackgrounds when painting selection AND backgrounds;
3228         only exclude it when doing a selection-only paint.
3229
3230 2019-07-23  Chris Fleizach  <cfleizach@apple.com>
3231
3232         AX: CrashTracer: com.apple.WebKit.WebContent at WebKit: WebKit::WebSpeechSynthesisClient::speak
3233         https://bugs.webkit.org/show_bug.cgi?id=199988
3234
3235         Reviewed by Per Arne Vollan.
3236
3237         Implement the reset state to cancel current speech jobs.
3238
3239         * Modules/speech/SpeechSynthesis.cpp:
3240         (WebCore::SpeechSynthesis::startSpeakingImmediately):
3241         (WebCore::SpeechSynthesis::cancel):
3242         * platform/PlatformSpeechSynthesizer.h:
3243         * platform/ios/PlatformSpeechSynthesizerIOS.mm:
3244         (WebCore::PlatformSpeechSynthesizer::resetState):
3245         * platform/mac/PlatformSpeechSynthesizerMac.mm:
3246         (WebCore::PlatformSpeechSynthesizer::resetState):
3247
3248 2019-07-23  Zalan Bujtas  <zalan@apple.com>
3249
3250         [iOS] Tapping the search field on a search results page on zillow.com shows and immediately dismisses the keyboard
3251         https://bugs.webkit.org/show_bug.cgi?id=200044
3252         <rdar://problem/53103732>
3253
3254         Reviewed by Wenson Hsieh.
3255
3256         1. The keyboard gets dismissed as the result of scroll event.
3257         2. The (horizontal)scroll event is initiated by WebKit as we try to re-center the content.
3258         3. The content gets off-centered as the result of the newly constructed drop-down menu which slightly sticks out of the document to the right (layout overflows).
3259
3260         It works with shipping version of iOS because _zoomToFocusRect operates on stale viewport information (see r244494 for the progression).
3261         This patch applies a site specific quirk to restore shipping behavior.
3262
3263         * page/Quirks.cpp:
3264         (WebCore::Quirks::shouldAvoidScrollingWhenFocusedContentIsVisible const):
3265         * page/Quirks.h:
3266
3267 2019-07-23  Said Abou-Hallawa  <sabouhallawa@apple.com>
3268
3269         CanvasRenderingContext2D.setTransfrom() reads only the aliases attributes of DOMMatrix2DInit
3270         https://bugs.webkit.org/show_bug.cgi?id=199850
3271
3272         Reviewed by Simon Fraser.
3273
3274         The validateAndFixup step of DOMMatrix2DInit sets the matrix attributes 
3275         (m** fields) from the aliases attributes (a, b, c, d, e, f) if the former
3276         ones do not exist and the later ones exist. See
3277         https://www.w3.org/TR/geometry-1/#dommatrixinit-dictionary and
3278         DOMMatrixReadOnly::validateAndFixup(DOMMatrix2DInit& init).
3279
3280         Since CanvasRenderingContext2DBase::setTransform() validates and fixes
3281         the input DOMMatrix2DInit, it should rely on matrix attributes.
3282
3283         Test: fast/canvas/setTransfrom-aliases-transform.html
3284
3285         * html/canvas/CanvasRenderingContext2DBase.cpp:
3286         (WebCore::CanvasRenderingContext2DBase::setTransform):
3287
3288 2019-07-24  Simon Fraser  <simon.fraser@apple.com>
3289
3290         [iOS WK2] A top fixed bar can flicker when scrolling with the keyboard up
3291         https://bugs.webkit.org/show_bug.cgi?id=200105
3292         rdar://problem/52871975
3293
3294         Reviewed by Wenson Hsieh.
3295
3296         ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition() computes a visual viewport
3297         from the current scroll position and scrollableAreaSize(). This doesn't know anything about
3298         the impact of keyboards on the visual viewport, so it computes a too-large visual viewport
3299         when the keyboard is up, triggering incorrect manipulations of the layout viewport. This
3300         leads to the top bar flashing to position 0 when it should be hidden off the top.
3301
3302         Fix by feeding into the scrolling tree the height of the visual viewport which takes
3303         FrameView::visualViewportOverrideRect() into account. This is stored on ScrollingStateFrameScrollingNode/
3304         ScrollingTreeFrameScrollingNode.
3305
3306         Test: scrollingcoordinator/ios/fixed-scrolling-with-keyboard.html
3307
3308         * page/FrameView.h:
3309         * page/scrolling/AsyncScrollingCoordinator.cpp:
3310         (WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):
3311         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
3312         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
3313         (WebCore::ScrollingStateFrameScrollingNode::setPropertyChangedBitsAfterReattach):
3314         (WebCore::ScrollingStateFrameScrollingNode::setOverrideVisualViewportSize):
3315         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
3316         * page/scrolling/ScrollingStateFrameScrollingNode.h:
3317         * page/scrolling/ScrollingTree.cpp:
3318         (WebCore::ScrollingTree::commitTreeState): LOG_WITH_STREAM() doesn't evaluate scrollingTreeAsText()
3319         every time.
3320         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
3321         (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
3322         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition const):
3323         (WebCore::ScrollingTreeFrameScrollingNode::dumpProperties const):
3324         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
3325
3326 2019-07-23  Tim Horton  <timothy_horton@apple.com>
3327
3328         Long press hint of AirPods buy buttons are tall and narrow during animation
3329         https://bugs.webkit.org/show_bug.cgi?id=200036
3330         <rdar://problem/53145697>
3331
3332         Reviewed by Wenson Hsieh.
3333
3334         New test: fast/text-indicator/text-indicator-with-tiny-child.html
3335
3336         * dom/Range.cpp:
3337         (WebCore::Range::borderAndTextRects const):
3338         * dom/Range.h:
3339         Add a BoundingRectBehavior that ignores 1x1 and smaller rects.
3340
3341         * page/TextIndicator.cpp:
3342         (WebCore::absoluteBoundingRectForRange):
3343         Enable IgnoreTinyRects.
3344
3345 2019-07-23  Wenson Hsieh  <wenson_hsieh@apple.com>
3346
3347         [macOS 10.15] Web process crashes when attempting to show the font panel via Font > Show Fonts
3348         https://bugs.webkit.org/show_bug.cgi?id=200021
3349         <rdar://problem/53301325>
3350
3351         Reviewed by Ryosuke Niwa.
3352
3353         In macOS 10.15, attempting to access ~/Library/FontCollections/ from the web process causes a Sandbox violation
3354         and a subsequent crash. This can be triggered by trying to show the font panel via Font > Show Fonts in the
3355         context menu after right clicking.
3356
3357         In the (near) future, we should fix this by moving logic to show the font panel, color panel and styles panel
3358         from the Editor in the web process to the UI process in WebKit2. However, for the time being, we can just work
3359         around this by adding a new EditorClient hook to determine whether to allow the font panel to show; this returns
3360         true in the legacy macOS WebKit port, and false everywhere else.
3361
3362         Test: editing/mac/style/do-not-crash-when-showing-font-panel.html
3363
3364         * editing/mac/EditorMac.mm:
3365         (WebCore::Editor::showFontPanel):
3366         * loader/EmptyClients.cpp:
3367         * page/EditorClient.h:
3368
3369 2019-07-23  Ryosuke Niwa  <rniwa@webkit.org>
3370
3371         WebKit should strip away system font names from the pasted content
3372         https://bugs.webkit.org/show_bug.cgi?id=199975
3373         <rdar://problem/53336353>
3374
3375         Reviewed by Darin Adler.
3376
3377         Cocoa HTML Writer sometimes generate system font names such as ".AppleSystemUIFont", ".SFUI-Regular", and ".SF UI Mono".
3378         We need to strip away these font names upon paste to avoid these font names falling back to Times New Roman.
3379
3380         Added the code to strip these font names away in EditingStyle::mergeStyleFromRulesForSerialization, which is used by
3381         StylizedMarkupAccumulator to generate HTML during copy. This works because WebContentReader::readWebArchive invokes
3382         sanitizeMarkupWithArchive which inserts the pasteboard content into a temporary document then re-serializes back to HTML
3383         using StylizedMarkupAccumulator before the actual pasting happens.
3384
3385         This approach has a few benefits over stripping away these font names in ReplaceSelectionCommand:
3386
3387         1. It would only affect clients that opts-in to copy & paste sanitization. e.g. it won't affect legacy WebKit clients
3388         and those that opt out of pasteboard content sanitization.
3389
3390         2. It preserves font names such as ".SF Blah" that a website may insert as some kind of house keeping purposes if ever.
3391         While we don't have any evidence that there is any such a website but it's a real risk nonetheless. The copy side fix would
3392         only affect cross-site and cross-app pasting, which is rare and less likely to affect real user scenarios.
3393
3394         3. It avoids exposing bogus .Apple* or .SF* font names to websites that directly use event.clipboardData.getData.
3395