Remove setDefersLoading infrastructure from WebKit2
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-02-12  Alex Christensen  <achristensen@webkit.org>
2
3         Remove setDefersLoading infrastructure from WebKit2
4         https://bugs.webkit.org/show_bug.cgi?id=194506
5
6         Reviewed by Brady Eidson.
7
8         setDefersLoading is inherently racy from WebCore to the NetworkProcess,
9         it adds unwanted complexity to the initialization and use of network objects,
10         and it has led to many unrecoverable hang bugs over the years.
11         We needed to force it into WebKit2 to transition some existing clients who relied on it,
12         but we have recently finished transitioning those clients to other solutions, mostly
13         completion handlers.
14
15         * inspector/PageScriptDebugServer.cpp:
16         (WebCore::PageScriptDebugServer::setJavaScriptPaused):
17
18 2019-02-12  Michael Catanzaro  <mcatanzaro@igalia.com>
19
20         Unreviewed, fix build warnings after content extensions enablement
21         https://bugs.webkit.org/show_bug.cgi?id=193622
22         <rdar://problem/47982850>
23
24         * contentextensions/DFABytecode.h:
25         (WebCore::ContentExtensions::instructionSizeWithArguments):
26         * contentextensions/DFABytecodeCompiler.h:
27         * contentextensions/URLFilterParser.cpp:
28         (WebCore::ContentExtensions::URLFilterParser::statusString):
29
30 2019-02-12  Justin Fan  <justin_fan@apple.com>
31
32         [Web GPU] DepthStencilAttachment implementation
33         https://bugs.webkit.org/show_bug.cgi?id=194458
34         <rdar://problem/47932446>
35
36         Reviewed by Dean Jackson.
37
38         Implement ability to provide a depth attachment to the render pass encoder. Also implement
39         GPULoad/StoreOp and update color attachments' implementation for full functionality.
40
41         Test: webgpu/depth-enabled-triangle-strip.html
42
43         Update project files for new symbols:
44         * CMakeLists.txt:
45         * DerivedSources-input.xcfilelist:
46         * DerivedSources-output.xcfilelist:
47         * DerivedSources.make:
48         * Sources.txt:
49         * WebCore.xcodeproj/project.pbxproj:
50
51         * Modules/webgpu/GPUColor.idl: Renamed from WebGPUColor.idl
52         * Modules/webgpu/GPULoadOp.idl: Added. Interface for attachment operation enum.
53         * Modules/webgpu/GPUStoreOp.idl: Ditto.
54         * Modules/webpug/WebGPUColor.h: Removed.
55         * Modules/webgpu/WebGPUCommandBuffer.cpp: Refactored descriptor validation logic out of this file.
56         (WebCore::WebGPUCommandBuffer::beginRenderPass):
57         * Modules/webgpu/WebGPURenderPassDescriptor.cpp: Added. Now owns code for validating descriptors.
58         (WebCore::WebGPURenderPassDescriptor::validateAndConvertToGPUVersion const):
59         * Modules/webgpu/WebGPURenderPassColorAttachmentDescriptor.h/idl: Removed. Code moved into WebGPURenderPassDescriptor.
60         * Modules/webgpu/WebGPURenderPassDescriptor.h: Move sub-descriptor definitions into this file.
61         * Modules/webgpu/WebGPURenderPassDescriptor.idl: Ditto.
62         * Modules/webgpu/WebGPURenderPipelineDescriptor.h: Make depthStencilState optional to match API update.
63         * Modules/webgpu/WebGPURenderPipelineDescriptor.idl: Ditto.
64         * Modules/webgpu/WebGPUTextureView.h:
65         * platform/graphics/gpu/GPULoadOp.h: Added.
66         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h: Removed (moved into GPURenderPassDescriptor).
67         * platform/graphics/gpu/GPURenderPassDescriptor.h: Mirror WebGPU* changes.
68         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Make depthStencilState optional.
69         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
70         * platform/graphics/gpu/GPUStoreOp.h: Added.
71         * platform/graphics/gpu/GPUTexture.h:
72         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
73         (WebCore::loadActionForGPULoadOp): Added.
74         (WebCore::storeActionForGPUStoreOp): Added.
75         (WebCore::populateMtlColorAttachmentsArray): Added. Create all expected color attachments, rather than just the first.
76         (WebCore::populateMtlDepthStencilAttachment): Added.
77         (WebCore::GPURenderPassEncoder::create):
78         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm: Make depthStencilState optional.
79         (WebCore::GPURenderPipeline::create):
80
81 2019-02-12  David Kilzer  <ddkilzer@apple.com>
82
83         REGRESSION (r238955, r240494): Soft-linking optional Lookup.framework triggers release assertion when missing
84         <https://webkit.org/b/194529>
85         <rdar://problem/47924449>
86
87         Reviewed by Eric Carlson.
88
89         * SourcesCocoa.txt:
90         - Do not include DataDetectorsCoreSoftLink.mm in unified
91           sources.
92         * WebCore.xcodeproj/project.pbxproj:
93         - Add DataDetectorsCoreSoftLink.mm to the WebCore target now
94           that it isn't part of the unifed sources.
95         * platform/cocoa/DataDetectorsCoreSoftLink.mm:
96         - Switch from using SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL() to
97           SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE() when linking
98           DataDetectorsCore.framework. None of the other macros assume
99           this framework is optional, and it was likely made optional
100           originally because the framework was new to iOS and thus
101           didn't exist on older versions.
102         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
103         - Change use of SOFT_LINK_CLASS_FOR_SOURCE() macros to
104           SOFT_LINK_CLASS() since the latter can only be used with
105           SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation).  This broke after
106           the fix for <wtf/SoftLinking.h> was applied.
107
108 2019-02-12  Youenn Fablet  <youenn@apple.com>
109
110         Make use of is<SubresourceLoader>
111         https://bugs.webkit.org/show_bug.cgi?id=194541
112
113         Reviewed by Alex Christensen.
114
115         No change of behavior.
116
117         * inspector/agents/InspectorNetworkAgent.cpp:
118         (WebCore::InspectorNetworkAgent::didReceiveResponse):
119         * loader/SubresourceLoader.h:
120         (isType):
121
122 2019-02-12  Mark Lam  <mark.lam@apple.com>
123
124         Add some null checks in JSNodeCustom.h's root() and generated isReachableFromOpaqueRoots() functions.
125         https://bugs.webkit.org/show_bug.cgi?id=194530
126         <rdar://problem/47973274>
127
128         Reviewed by Chris Dumez.
129
130         This is needed to fix a null pointer dereference that arises from the following scenario:
131         1. a Document detaches from its StyleSheetList.
132         2. the JSStyleSheetList that is associated with the detached StyleSheetList has yet
133            to be scanned and collected by the GC.
134         3. the GC eventually looks for the opaque root of the StyleSheetList's owner, and
135            discovers a null owner pointer.
136
137         This patch fixes this issue by applying the following null checks:
138
139         1. Add a null check in JSNodeCustom.h's root().
140
141            root() is called from a isReachableFromOpaqueRoots() generated by CodeGeneratorJS.pm.
142            isReachableFromOpaqueRoots() calls a ownerNode() method and passes its result
143            to root().  However, depending on which class the ownerNode() method belongs to,
144            it can either return a pointer or a reference.  The null check only makes sense
145            in the pointer case.
146
147            To accommodate the 2 forms, root() itself is has an overload that takes a
148            reference instead of a pointer.
149
150            Since CodeGeneratorJS.pm can't tell what the generated class' ownerNode()
151            returns, it can't discern when the result is a pointer and apply the null check.
152            Instead, we just add the null check to the version of root() that takes a
153            pointer.  If the node pointer is null, we'll return a null opaque root.
154
155         2. Fix CodeGeneratorJS.pm to null check the opaque root before using it.
156
157         * bindings/js/JSNodeCustom.h:
158         (WebCore::root):
159         * bindings/scripts/CodeGeneratorJS.pm:
160         (GenerateImplementation):
161         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
162         (WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots):
163
164 2019-02-12  Andy Estes  <aestes@apple.com>
165
166         [iOSMac] Enable Parental Controls Content Filtering
167         https://bugs.webkit.org/show_bug.cgi?id=194521
168         <rdar://39732376>
169
170         Reviewed by Tim Horton.
171
172         * Configurations/FeatureDefines.xcconfig:
173         * platform/ContentFilterUnblockHandler.h:
174         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
175         * platform/cocoa/ParentalControlsContentFilter.mm:
176
177 2019-02-11  Jer Noble  <jer.noble@apple.com>
178
179         Unreviewed build fix; add a HAVE_CELESTIAL guard around Celestial framework usage.
180
181         * platform/audio/ios/MediaSessionManagerIOS.h:
182         * platform/audio/ios/MediaSessionManagerIOS.mm:
183         (WebCore::MediaSessionManageriOS::providePresentingApplicationPIDIfNecessary):
184
185 2019-02-12  Antti Koivisto  <antti@apple.com>
186
187         Crash in WebCore::ScrollingTree::updateTreeFromStateNode
188         https://bugs.webkit.org/show_bug.cgi?id=194538
189         <rdar://problem/47841926>
190
191         Reviewed by Zalan Bujtas.
192
193         * page/scrolling/ScrollingTree.cpp:
194         (WebCore::ScrollingTree::updateTreeFromStateNode):
195
196         Make sure we don't leave node entry behind in m_nodeMap in case we failed to add it to the parent.
197
198 2019-02-12  Zalan Bujtas  <zalan@apple.com>
199
200         [LFC] Remove redundant InlineFormattingContext::computeBorderAndPadding
201         https://bugs.webkit.org/show_bug.cgi?id=194540
202
203         Reviewed by Antti Koivisto.
204
205         Use FormattingContext::computeBorderAndPadding instead.
206
207         * layout/FormattingContext.cpp:
208         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
209         * layout/FormattingContext.h:
210         * layout/inlineformatting/InlineFormattingContext.cpp:
211         (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const): Deleted.
212         * layout/inlineformatting/InlineFormattingContext.h:
213
214 2019-02-12  Zalan Bujtas  <zalan@apple.com>
215
216         [LFC][IFC] Add intrinsic width support for float boxes.
217         https://bugs.webkit.org/show_bug.cgi?id=194528
218
219         Reviewed by Antti Koivisto.
220
221         This patch implements a very simple float box support for intrinsic width.
222
223         * layout/inlineformatting/InlineFormattingContext.cpp:
224         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
225         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFloatBox const):
226         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForInlineBlock const):
227         (WebCore::Layout::InlineFormattingContext::computeMargin const):
228         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const): Deleted.
229         * layout/inlineformatting/InlineFormattingContext.h:
230
231 2019-02-12  Rob Buis  <rbuis@igalia.com>
232
233         Implement serializing in MIME type parser
234         https://bugs.webkit.org/show_bug.cgi?id=193909
235
236         Reviewed by Darin Adler.
237
238         Implement serializing in MIME type parser [1], to preserve the parameter
239         order the Vector m_parameterNames is introduced, since HashMaps do not
240         guarantee any order.
241
242         Test: ParsedContentType.Serialize
243
244         [1] https://mimesniff.spec.whatwg.org/#serializing-a-mime-type
245
246         * platform/network/ParsedContentType.cpp:
247         (WebCore::skipSpaces):
248         (WebCore::parseQuotedString):
249         (WebCore::ParsedContentType::parseContentType):
250         (WebCore::ParsedContentType::parameterValueForName const):
251         (WebCore::ParsedContentType::parameterCount const):
252         (WebCore::ParsedContentType::setContentType):
253         (WebCore::ParsedContentType::setContentTypeParameter):
254         (WebCore::ParsedContentType::serialize const):
255         * platform/network/ParsedContentType.h:
256
257 2019-02-08  Chris Fleizach  <cfleizach@apple.com>
258
259         AXObjectCache::childrenChanged shouldn't update layout or style during another style recalc
260         https://bugs.webkit.org/show_bug.cgi?id=182280
261         <rdar://problem/37018386>
262
263         Reviewed by Alan Bujtas.
264
265         Remove the possibility that changing children calls back into updating layout by
266         handling children changes in a deferred manner.
267
268         This follows the same architecture as many other deferred changes, but also requires us to check deferred changes
269         in updateBackingStore, because things like aria-hidden changes won't trigger a layout, but will require us to update children.
270
271         A few tests had to be modified to no longer change the tree and then check the children immediately. 
272
273         * accessibility/AXObjectCache.cpp:
274         (WebCore::AXObjectCache::remove):
275         (WebCore::AXObjectCache::childrenChanged):
276         (WebCore::AXObjectCache::prepareForDocumentDestruction):
277         (WebCore::AXObjectCache::performDeferredCacheUpdate):
278         * accessibility/AXObjectCache.h:
279         * accessibility/AccessibilityObject.cpp:
280         (WebCore::AccessibilityObject::updateBackingStore):
281         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
282         (convertToNSArray):
283         (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
284
285 2019-02-11  Myles C. Maxfield  <mmaxfield@apple.com>
286
287         [Cocoa] Ask platform for generic font family mappings
288         https://bugs.webkit.org/show_bug.cgi?id=187723
289         <rdar://problem/41892438>
290
291         Reviewed by Brent Fulgham.
292
293         WebKit API allows setting the generic font families for the USCRIPT_COMMON script.
294         When trying to style a character with a generic font family, we first look to see if
295         we have a mapping for the particular script the character is rendered with, and if we
296         don't find a match, we then check USCRIPT_COMMON.
297
298         In the Cocoa ports, the only way families get set for non-USCRIPT_COMMON scripts (aka
299         the only scripts which won't use the API families) is in
300         SettingsBase::initializeDefaultFontFamilies(). That function only sets the families
301         for the CJK scripts.
302
303         The mappings inside SettingsBase are incorrect and conflict with our policy regarding
304         user-installed fonts. Instead, we should be consulting with the platform for some of
305         these mappings, by calling CTFontDescriptorCreateForCSSFamily(). However, the WebKit
306         API still has to work to set the mappings for untagged content. Therefore, we use the
307         system mappings for language-tagged content, and the API mappings for non-language-tagged
308         content. This is a good balance that makes sure we always have a good mapping for every
309         language, but API clients can still set the mappings, too.
310
311         Test: fast/text/ja-sans-serif.html
312
313         * css/CSSComputedStyleDeclaration.cpp:
314         * css/CSSFontSelector.cpp:
315         (WebCore::resolveGenericFamily):
316         * css/parser/CSSPropertyParser.cpp:
317         (WebCore::consumeFontFamily):
318         * page/cocoa/SettingsBaseCocoa.mm:
319         (WebCore::SettingsBase::initializeDefaultFontFamilies):
320         (WebCore::osakaMonoIsInstalled): Deleted.
321         * platform/graphics/FontDescription.cpp:
322         (WebCore::FontDescription::platformResolveGenericFamily):
323         * platform/graphics/FontDescription.h:
324         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
325         (WebCore::computeSpecializedChineseLocale):
326         (WebCore::cachedSpecializedChineseLocale):
327         (WebCore::languageChanged):
328         (WebCore::FontDescription::platformResolveGenericFamily):
329         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
330         (WebCore::SystemFontDatabaseCoreText::clear):
331         (WebCore::genericFamily):
332         (WebCore::SystemFontDatabaseCoreText::serifFamily):
333         (WebCore::SystemFontDatabaseCoreText::sansSerifFamily):
334         (WebCore::SystemFontDatabaseCoreText::cursiveFamily):
335         (WebCore::SystemFontDatabaseCoreText::fantasyFamily):
336         (WebCore::SystemFontDatabaseCoreText::monospaceFamily):
337         * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
338
339 2019-02-11  Adrian Perez de Castro  <aperez@igalia.com>
340
341         [GTK][WPE] Add content extensions support in WKTR and unskip layout tests
342         https://bugs.webkit.org/show_bug.cgi?id=193622
343
344         Reviewed by Michael Catanzaro.
345
346         No new tests needed.
347
348         * SourcesCocoa.txt: Remove loader/ResourceLoadInfo.cpp, it's not Cocoa-specific anymore.
349         * Sources.txt: Add loader/ResourceLoadInfo.cpp, all ports use it now.
350
351 2019-02-11  Daniel Bates  <dabates@apple.com>
352
353         [iOS] Mouse/Touch/Pointer events are missing modifier keys
354         https://bugs.webkit.org/show_bug.cgi?id=191446
355         <rdar://problem/45929460>
356
357         Reviewed by Tim Horton.
358
359         Extract the modifier flags from the WebEvent. This code is only used by Legacy WebKit
360         on iOS and we will need to fix <rdar://problem/47929759> in order for modifier flags
361         to be passed to WebKit.
362
363         Tests: fast/events/touch/ios/mouse-events-with-modifiers.html
364                fast/events/touch/ios/pointer-events-with-modifiers.html
365                fast/events/touch/ios/touch-events-with-modifiers.html
366
367         * platform/ios/PlatformEventFactoryIOS.mm:
368         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
369         * platform/ios/WebEvent.h:
370         * platform/ios/WebEvent.mm:
371         (-[WebEvent initWithMouseEventType:timeStamp:location:]):
372         (-[WebEvent initWithMouseEventType:timeStamp:location:modifiers:]):
373
374 2019-02-11  Jer Noble  <jer.noble@apple.com>
375
376         [Cocoa] Notify AVSystemController of our presenting PID before registering as a Now Playing app.
377         https://bugs.webkit.org/show_bug.cgi?id=194504
378
379         Reviewed by Eric Carlson.
380
381         This allows the MediaRemote framework to associate the WebContent process with its host application.
382
383         * Modules/mediastream/UserMediaRequest.cpp:
384         (WebCore::UserMediaRequest::start):
385         * platform/audio/PlatformMediaSessionManager.h:
386         (WebCore::PlatformMediaSessionManager::prepareToSendUserMediaPermissionRequest):
387         * platform/audio/cocoa/MediaSessionManagerCocoa.h:
388         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
389         (MediaSessionManagerCocoa::prepareToSendUserMediaPermissionRequest):
390         (MediaSessionManagerCocoa::providePresentingApplicationPIDIfNecessary):
391         (MediaSessionManagerCocoa::updateNowPlayingInfo):
392
393 2019-02-11  Commit Queue  <commit-queue@webkit.org>
394
395         Unreviewed, rolling out r241272 and r241276.
396         https://bugs.webkit.org/show_bug.cgi?id=194514
397
398         Broke the Apple Internal build and the fix requires human
399         intervention :( (Requested by dydz on #webkit).
400
401         Reverted changesets:
402
403         "[iOS] Mouse/Touch/Pointer events are missing modifier keys"
404         https://bugs.webkit.org/show_bug.cgi?id=191446
405         https://trac.webkit.org/changeset/241272
406
407         "Fix internal iOS build after r241272"
408         https://bugs.webkit.org/show_bug.cgi?id=191446
409         https://trac.webkit.org/changeset/241276
410
411 2019-02-11  Alex Christensen  <achristensen@webkit.org>
412
413         Stop using setDefersLoading from WebCore
414         https://bugs.webkit.org/show_bug.cgi?id=194315
415
416         Reviewed by Jer Noble.
417
418         That is what CompletionHandlers are for.
419
420         * loader/MediaResourceLoader.cpp:
421         (WebCore::MediaResource::responseReceived):
422         (WebCore::MediaResource::setDefersLoading): Deleted.
423         * loader/MediaResourceLoader.h:
424         * platform/graphics/PlatformMediaResourceLoader.h:
425         (WebCore::PlatformMediaResourceClient::responseReceived):
426         (WebCore::PlatformMediaResource::stop):
427         (WebCore::PlatformMediaResource::setDefersLoading): Deleted.
428         * platform/network/cocoa/WebCoreNSURLSession.mm:
429         (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
430         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:completionHandler:]):
431         (-[WebCoreNSURLSessionDataTask _setDefersLoading:]): Deleted.
432         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): Deleted.
433
434 2019-02-11  Daniel Bates  <dabates@apple.com>
435
436         [iOS] Mouse/Touch/Pointer events are missing modifier keys
437         https://bugs.webkit.org/show_bug.cgi?id=191446
438         <rdar://problem/45929460>
439
440         Reviewed by Tim Horton.
441
442         Extract the modifier flags from the WebEvent. This code is only used by Legacy WebKit
443         on iOS and we will need to fix <rdar://problem/47929759> in order for modifier flags
444         to be passed to WebKit.
445
446         Tests: fast/events/touch/ios/mouse-events-with-modifiers.html
447                fast/events/touch/ios/pointer-events-with-modifiers.html
448                fast/events/touch/ios/touch-events-with-modifiers.html
449
450         * platform/ios/PlatformEventFactoryIOS.mm:
451         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
452         * platform/ios/WebEvent.h:
453         * platform/ios/WebEvent.mm:
454         (-[WebEvent initWithMouseEventType:timeStamp:location:]):
455         (-[WebEvent initWithMouseEventType:timeStamp:location:modifiers:]):
456
457 2019-02-11  Daniel Bates  <dabates@apple.com>
458
459         Separate out outline-style: auto user-agent appearance from Mac animated focus ring drawing
460         https://bugs.webkit.org/show_bug.cgi?id=193591
461
462         Reviewed by Simon Fraser.
463
464         Untangle the Mac-specific concept of animated focus ring drawing from the concepts of using
465         the fancy shrink-wrapped focus ring appearance and using the platform focus ring color when
466         outline-style: auto.
467
468         No functionality changed. So, no new tests.
469
470         * platform/graphics/GraphicsContext.h:
471         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
472         (WebCore::drawFocusRing):
473         (WebCore::drawFocusRingToContextAtTime):
474         Change some macro guards.
475
476         * rendering/RenderElement.cpp:
477         (WebCore::usePlatformFocusRingColorForOutlineStyleAuto): Added.
478         (WebCore::useShrinkWrappedFocusRingForOutlineStyleAuto): Added.
479         (WebCore::drawFocusRing): Added.
480         (WebCore::RenderElement::paintFocusRing): Write in terms of drawFocusRing().
481
482 2019-02-11  Truitt Savell  <tsavell@apple.com>
483
484         Unreviewed, rolling out r241229.
485
486         Revision broke internal builds for watchOS.
487
488         Reverted changeset:
489
490         "[Cocoa] Ask platform for generic font family mappings"
491         https://bugs.webkit.org/show_bug.cgi?id=187723
492         https://trac.webkit.org/changeset/241229
493
494 2019-02-11  Youenn Fablet  <youenn@apple.com>
495
496         Make Request constructor throw if FetchRequestInit.signal is not undefined, null or an AbortSignal object
497         https://bugs.webkit.org/show_bug.cgi?id=194404
498         <rdar://problem/47891915>
499
500         Reviewed by Geoffrey Garen.
501
502         Align with the spec, except for known problematic web sites.
503         Covered by updated test.
504
505         * Modules/fetch/FetchRequest.cpp:
506         (WebCore::needsSignalQuirk):
507         (WebCore::processInvalidSignal):
508         (WebCore::FetchRequest::initializeWith):
509
510 2019-02-11  Zalan Bujtas  <zalan@apple.com>
511
512         [LFC] FormattingContext::Geometry::floatingHeightAndMargin should take UsedHorizontalValues
513         https://bugs.webkit.org/show_bug.cgi?id=194490
514
515         Reviewed by Antti Koivisto.
516
517         This is in preparation for adding floating preferred width computation support. It requires height computaiton
518         which uses containing block width to resolve vertical margins.
519
520         * layout/FormattingContext.cpp:
521         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
522         * layout/FormattingContext.h:
523         * layout/FormattingContextGeometry.cpp:
524         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
525         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
526         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
527         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
528         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
529         (WebCore::Layout::FormattingContext::Geometry::computedVerticalMargin):
530         * layout/FormattingContextQuirks.cpp:
531         (WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight):
532         * layout/LayoutUnits.h:
533         (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
534         * layout/blockformatting/BlockFormattingContext.cpp:
535         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
536         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
537         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
538         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
539         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
540         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
541         * layout/blockformatting/BlockMarginCollapse.cpp:
542         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues):
543         (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
544         * layout/inlineformatting/InlineFormattingContext.cpp:
545         (WebCore::Layout::InlineFormattingContext::layout const):
546         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
547         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
548         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin):
549
550 2019-02-11  Zalan Bujtas  <zalan@apple.com>
551
552         [LFC] FormattingContext::intrinsicWidthConstraints should compute and save the intrinsic widths consistently.
553         https://bugs.webkit.org/show_bug.cgi?id=194483
554
555         Reviewed by Antti Koivisto.
556
557         Rename intrinsicWidthConstraints to computeIntrinsicWidthConstraints (it does not return the width values anymore).
558
559         * layout/FormattingContext.h:
560         * layout/FormattingContextGeometry.cpp:
561         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
562         * layout/blockformatting/BlockFormattingContext.cpp:
563         (WebCore::Layout::BlockFormattingContext::computeIntrinsicWidthConstraints const):
564         (WebCore::Layout::BlockFormattingContext::intrinsicWidthConstraints const): Deleted.
565         * layout/blockformatting/BlockFormattingContext.h:
566         * layout/inlineformatting/InlineFormattingContext.cpp:
567         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
568         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const):
569         (WebCore::Layout::InlineFormattingContext::intrinsicWidthConstraints const): Deleted.
570         * layout/inlineformatting/InlineFormattingContext.h:
571
572 2019-02-10  Zalan Bujtas  <zalan@apple.com>
573
574         [LFC] Fix spelling error.
575         https://bugs.webkit.org/show_bug.cgi?id=194489
576
577         Reviewed by Simon Fraser.
578
579         instrinsic -> intrinsic
580
581         * layout/FormattingContext.h:
582         * layout/FormattingContextGeometry.cpp:
583         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
584         * layout/FormattingState.h:
585         (WebCore::Layout::FormattingState::setIntrinsicWidthConstraints):
586         (WebCore::Layout::FormattingState::clearIntrinsicWidthConstraints):
587         (WebCore::Layout::FormattingState::intrinsicWidthConstraints const):
588         (WebCore::Layout::FormattingState::setInstrinsicWidthConstraints): Deleted.
589         (WebCore::Layout::FormattingState::clearInstrinsicWidthConstraints): Deleted.
590         (WebCore::Layout::FormattingState::instrinsicWidthConstraints const): Deleted.
591         * layout/blockformatting/BlockFormattingContext.cpp:
592         (WebCore::Layout::BlockFormattingContext::intrinsicWidthConstraints const):
593         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const): Deleted.
594         * layout/blockformatting/BlockFormattingContext.h:
595         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
596         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraintsNeedChildrenWidth):
597         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
598         (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraintsNeedChildrenWidth): Deleted.
599         (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraints): Deleted.
600         * layout/inlineformatting/InlineFormattingContext.cpp:
601         (WebCore::Layout::InlineFormattingContext::intrinsicWidthConstraints const):
602         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const):
603         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const): Deleted.
604         * layout/inlineformatting/InlineFormattingContext.h:
605
606 2019-02-10  Darin Adler  <darin@apple.com>
607
608         Switch uses of StringBuilder with String::format for hex numbers to use HexNumber.h instead
609         https://bugs.webkit.org/show_bug.cgi?id=194485
610
611         Reviewed by Daniel Bates.
612
613         * Modules/websockets/WebSocket.cpp:
614         (WebCore::encodeProtocolString): Use appendUnsignedAsHexFixedSize instead of String::format.
615
616         * css/parser/CSSParserToken.cpp:
617         (WebCore::CSSParserToken::serialize const): Fixed style of many return statements
618         that called a function returning void; doesn't match WebKit's prevailing style.
619         Also use break instead of return. Used appendLiteral instead of append in many
620         cases, and append character instead of single-character literal in others.
621         Use appendUnsignedAsHex instead of String::format.
622
623         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
624         (WebCore::generateHashedName): Use appendUnsignedAsHex instad of appendUnsigned64AsHex.
625         Should come back here and use makeString once we make HexNumber.h work with that.
626
627         * platform/mac/WebCoreNSURLExtras.mm: Removed unnecessary include of HexNumber.h.
628
629         * rendering/RenderTreeAsText.cpp:
630         (WebCore::quoteAndEscapeNonPrintables): Use appendLiteral instead of multiple calls
631         to character append. Touched because it was next to a call to appendUnsignedAsHex.
632
633 2019-02-10  Pablo Saavedra  <psaavedra@igalia.com>
634
635         libWPEWebKit-0.1.so: undefined reference to `JSC::JSValue::asCell() const
636         https://bugs.webkit.org/show_bug.cgi?id=194484
637
638         Reviewed by Darin Adler.
639
640         * bindings/js/JSUndoItemCustom.cpp:
641
642 2019-02-10  Philippe Normand  <pnormand@igalia.com>
643
644         Unreviewed, GTK Debug build fix after r241148.
645
646         * Modules/mediasource/SourceBuffer.cpp:
647         (WebCore::removeSamplesFromTrackBuffer):
648         SourceBuffer::logClassName and friends are declared for
649         !RELEASE_LOG_DISABLED builds so adapt calling sites accordingly.
650
651 2019-02-10  Zalan Bujtas  <zalan@apple.com>
652
653         [LFC][IFC] Add intrinsic width support for inline-block boxes
654         https://bugs.webkit.org/show_bug.cgi?id=194479
655
656         Reviewed by Antti Koivisto.
657
658         Compute the intrinsic width for the inline-block (formatting context root) and set it as the content box width while
659         laying out the content for the min/max width.
660
661         <div style="position: absolute">before<span id=inline-block style="display: inline-block">inline_block content<span>after</div>
662
663         The "inline-block" formatting root returns "inline_block" width for the minimum and "inline_block width" for
664         the maximum width. These min/max values are used to figure out the intrinsic width for the parent <div>.
665
666         * layout/inlineformatting/InlineFormattingContext.cpp:
667         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
668         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const):
669         (WebCore::Layout::InlineFormattingContext::computeMargin const):
670         * layout/inlineformatting/InlineFormattingContext.h:
671         * page/FrameViewLayoutContext.cpp:
672         (WebCore::layoutUsingFormattingContext):
673
674 2019-02-10  Zalan Bujtas  <zalan@apple.com>
675
676         [LFC][IFC] Add intrinsic width support for replaced boxes
677         https://bugs.webkit.org/show_bug.cgi?id=194478
678
679         Reviewed by Antti Koivisto.
680
681         * layout/inlineformatting/InlineFormattingContext.cpp:
682         (WebCore::Layout::InlineFormattingContext::layout const):
683         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
684         (WebCore::Layout::InlineFormattingContext::computeMargin const):
685         (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const):
686         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
687         (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForReplacedInlineBox const):
688         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const): Deleted.
689         * layout/inlineformatting/InlineFormattingContext.h:
690
691 2019-02-10  Alicia Boya García  <aboya@igalia.com>
692
693         [MSE][GStreamer] Add missing return type to lambda
694         https://bugs.webkit.org/show_bug.cgi?id=194414
695
696         Reviewed by Darin Adler.
697
698         Since g_signal_connect() is untyped, a compiler error was not
699         generated when a lambda with a missing GstFlowReturn return type was
700         provided for a signal that expects it.
701
702         This used to work before r240784 because a recent function call had
703         set GST_FLOW_OK in the return value register and it happened to
704         survive until the lambda function call ended. Starting on that commit
705         such return value was removed and it stopped working on debug.
706
707         Of course, the actual problem is in the signature of the lambda
708         function, and this patch fixes that.
709
710         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
711         (WebCore::AppendPipeline::AppendPipeline):
712
713 2019-02-09  Darin Adler  <darin@apple.com>
714
715         Eliminate unnecessary String temporaries by using StringConcatenateNumbers
716         https://bugs.webkit.org/show_bug.cgi?id=194021
717
718         Reviewed by Geoffrey Garen.
719
720         For floating point numbers, String::number gives a fixed precision result,
721         stripping trailing zeroes. When possible, I changed the code to instead use the
722         equivalent of String::numberToStringECMAScript, which is what makeString does by
723         default for floating point, gives the same results for many cases, and gives
724         better results in many others. However, for floats, we do not yet have a good
725         implementation, so instead I used FormattedNumber::fixedPrecision to match
726         the old behavior.
727
728         * Modules/indexeddb/shared/IDBTransactionInfo.cpp:
729         (WebCore::IDBTransactionInfo::loggingString const): Remove String::number and let
730         makeString do the conversion without allocating/destroying a String.
731         * Modules/websockets/ThreadableWebSocketChannel.cpp:
732         (WebCore::ThreadableWebSocketChannel::create): Ditto.
733         * Modules/websockets/WebSocket.cpp:
734         (WebCore::WebSocket::connect): Ditto. Added a cast to "unsigned" to sidestep the
735         ambiguity with 16-bit unsigned types that are sometimes used for numbers (uint16_t)
736         and sometimes used for UTF-16 code units (UChar) and can be the same type.
737
738         * Modules/websockets/WebSocketChannel.cpp:
739         (WebCore::WebSocketChannel::didFailSocketStream): Use ASCIILiteral when intializing
740         a string instead of just a normal C literal. Switched to makeString so we could
741         remove String::number and do the conversion without allocating/destroying a String.
742         (WebCore::WebSocketChannel::didFail): Ditto.
743         (WebCore::WebSocketChannel::processFrame): Ditto.
744         * Modules/websockets/WebSocketFrame.cpp:
745         (WebCore::WebSocketFrame::parseFrame): Ditto.
746         * Modules/websockets/WebSocketHandshake.cpp:
747         (WebCore::WebSocketHandshake::readServerHandshake): Ditto.
748         * accessibility/AccessibilityRenderObject.cpp:
749         (WebCore::AccessibilityRenderObject::positionalDescriptionForMSAA const): Ditto.
750         * bindings/js/JSDOMConvertNumbers.cpp:
751         (WebCore::rangeErrorString): Ditto.
752         * css/CSSAspectRatioValue.cpp:
753         (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. Used
754         FormattedNumber::fixedPrecision since these are floats.
755
756         * css/DOMMatrixReadOnly.cpp:
757         (WebCore::DOMMatrixReadOnly::toString const): Use
758         StringBuilder::builder.appendECMAScriptNumber instead of
759         String::numberToStringECMAScript so we can do it without allocating/destroying
760         a String.
761         * css/WebKitCSSMatrix.cpp:
762         (WebCore::WebKitCSSMatrix::toString const): Ditto.
763
764         * dom/MessagePortIdentifier.h:
765         (WebCore::MessagePortIdentifier::logString const): Remove String::number and let
766         makeString do the conversion without allocating/destroying a String.
767
768         * editing/cocoa/DataDetection.mm:
769         (WebCore::dataDetectorStringForPath): Remove unnecessary type casts on values
770         passed to String::number and to StringBuilder::appendNumber. These could do
771         harm if the values were out of range, and should not be necessary.
772
773         * history/BackForwardItemIdentifier.h:
774         (WebCore::BackForwardItemIdentifier::logString const): Remove String::number
775         and let makeString do the conversion without allocating/destroying a String.
776         * html/FTPDirectoryDocument.cpp:
777         (WebCore::processFileDateString): Ditto.
778         * html/canvas/WebGLRenderingContextBase.cpp:
779         (WebCore::WebGLRenderingContextBase::getUniformLocation): Ditto.
780         (WebCore::WebGLRenderingContextBase::checkTextureCompleteness): Ditto.
781         * inspector/agents/WebConsoleAgent.cpp:
782         (WebCore::WebConsoleAgent::didReceiveResponse): Ditto.
783         * loader/WorkerThreadableLoader.cpp:
784         (WebCore::WorkerThreadableLoader::loadResourceSynchronously): Ditto.
785         * loader/appcache/ApplicationCacheGroup.cpp:
786         (WebCore::ApplicationCacheGroup::didFailLoadingManifest): Ditto.
787         * page/PageSerializer.cpp:
788         (WebCore::PageSerializer::urlForBlankFrame): Ditto.
789         * page/PrintContext.cpp:
790         (WebCore::PrintContext::pageProperty): Ditto.
791         (WebCore::PrintContext::pageSizeAndMarginsInPixels): Ditto.
792
793         * page/WheelEventTestTrigger.cpp:
794         (WebCore::dumpState): Use StringBuilder::appendNumber instead of
795         String::number so we can do it without allocating/destroying a String.
796         Also use StringBuilder::appendLiteral on a literal.
797
798         * page/cocoa/ResourceUsageOverlayCocoa.mm:
799         (WebCore::ResourceUsageOverlay::platformDraw): Pass explicit
800         KeepTrailingZeros to FormattedNumber::fixedPrecision to preserve behavior,
801         since default is now to truncate trailing zeros.
802
803         * platform/graphics/Color.cpp:
804         (WebCore::Color::cssText): Use StringBuilder::appendNumber instead of
805         calling numberToFixedPrecisionString to do the same thing.
806         * platform/graphics/ExtendedColor.cpp:
807         (WebCore::ExtendedColor::cssText): Ditto.
808
809         * platform/graphics/ca/GraphicsLayerCA.cpp:
810         (WebCore::animationIdentifier): Remove String::number and let makeString
811         do the conversion without allocating/destroying a String. Had to add
812         a typecast to convert the enumeration into an integer.
813         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
814         (WebCore::PlatformCAFilters::setFiltersOnLayer): Ditto.
815         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
816         (WebCore::FontPlatformData::description const): Ditto.
817
818         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
819         (WebCore::MockMediaSample::MockMediaSample): Use AtomicString::number
820         instead of String::number to avoid unneccessarily allocating an additional
821         temporary String when an AtomicString already exists.
822
823         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
824         (WebCore::SocketStreamHandleImpl::reportErrorToClient): Remove String::number
825         and let makeString do the conversion without allocating/destroying a String.
826         * platform/sql/SQLiteDatabase.cpp:
827         (WebCore::SQLiteDatabase::setMaximumSize): Ditto.
828         (WebCore::SQLiteDatabase::setSynchronous): Ditto. Had to add a typecast to
829         convert the enumeration into an integer.
830         * svg/SVGAngleValue.cpp:
831         (WebCore::SVGAngleValue::valueAsString const): Ditto.
832         * svg/SVGLengthValue.cpp:
833         (WebCore::SVGLengthValue::valueAsString const): Ditto.
834         * testing/Internals.cpp:
835         (WebCore::Internals::configurationForViewport): Ditto. Used
836         FormattedNumber::fixedPrecision since these are floats.
837         (WebCore::Internals::getCurrentCursorInfo): Use StringBuilder::appendNumber
838         instead of calling numberToFixedPrecisionString to do the same thing.
839         (WebCore::Internals::queueMicroTask): Remove String::number and let makeString
840         do the conversion without allocating/destroying a String.
841         (WebCore::appendOffsets): Use StringBuilder::appendNumber instead of
842         String::number so we can do it without allocating/destroying a String.
843
844         * workers/service/ServiceWorkerClientIdentifier.h:
845         (WebCore::ServiceWorkerClientIdentifier::toString const): Remove String::number
846         and let makeString do the conversion without allocating/destroying a String.
847         * workers/service/server/RegistrationDatabase.cpp:
848         (WebCore::databaseFilenameFromVersion): Ditto.
849
850 2019-02-09  Zalan Bujtas  <zalan@apple.com>
851
852         [LFC][IFC] Add intrinsic width support for basic inline containers
853         https://bugs.webkit.org/show_bug.cgi?id=194473
854
855         Reviewed by Antti Koivisto.
856
857         Preferred width computation logic is very similar to normal layout.
858         One of the main difference is that the preferred width codepath does not provide valid containing block width.
859         This patch implement basic inline container support by passing nullopt containing block width in UsedHorizontalValues. 
860
861         * layout/inlineformatting/InlineFormattingContext.cpp:
862         (WebCore::Layout::InlineFormattingContext::layout const):
863         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
864         (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const):
865         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const):
866         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
867         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
868         (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForReplacedInlineBox const):
869         * layout/inlineformatting/InlineFormattingContext.h:
870
871 2019-02-08  Myles C. Maxfield  <mmaxfield@apple.com>
872
873         [Cocoa] CTLineGetGlyphRuns() might return nullptr
874         https://bugs.webkit.org/show_bug.cgi?id=194467
875         <rdar://problem/42423999>
876
877         Reviewed by Simon Fraser.
878
879         Be somewhat defensive to try to make sure this sort of thing doesn't happen in the future.
880
881         Covered by find/text/find-backwards.html
882
883         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
884         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
885
886 2019-02-08  Myles C. Maxfield  <mmaxfield@apple.com>
887
888         [Cocoa] Ask platform for generic font family mappings
889         https://bugs.webkit.org/show_bug.cgi?id=187723
890         <rdar://problem/41892438>
891
892         Reviewed by Brent Fulgham.
893
894         WebKit API allows setting the generic font families for the USCRIPT_COMMON script.
895         When trying to style a character with a generic font family, we first look to see if
896         we have a mapping for the particular script the character is rendered with, and if we
897         don't find a match, we then check USCRIPT_COMMON.
898
899         In the Cocoa ports, the only way families get set for non-USCRIPT_COMMON scripts (aka
900         the only scripts which won't use the API families) is in
901         SettingsBase::initializeDefaultFontFamilies(). That function only sets the families
902         for the CJK scripts.
903
904         The mappings inside SettingsBase are incorrect and conflict with our policy regarding
905         user-installed fonts. Instead, we should be consulting with the platform for some of
906         these mappings, by calling CTFontDescriptorCreateForCSSFamily(). However, the WebKit
907         API still has to work to set the mappings for untagged content. Therefore, we use the
908         system mappings for language-tagged content, and the API mappings for non-language-tagged
909         content. This is a good balance that makes sure we always have a good mapping for every
910         language, but API clients can still set the mappings, too.
911
912         Test: fast/text/ja-sans-serif.html
913
914         * css/CSSComputedStyleDeclaration.cpp:
915         * css/CSSFontSelector.cpp:
916         (WebCore::resolveGenericFamily):
917         * css/parser/CSSPropertyParser.cpp:
918         (WebCore::consumeFontFamily):
919         * page/cocoa/SettingsBaseCocoa.mm:
920         (WebCore::SettingsBase::initializeDefaultFontFamilies):
921         (WebCore::osakaMonoIsInstalled): Deleted.
922         * platform/graphics/FontDescription.cpp:
923         (WebCore::FontDescription::platformResolveGenericFamily):
924         * platform/graphics/FontDescription.h:
925         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
926         (WebCore::computeSpecializedChineseLocale):
927         (WebCore::cachedSpecializedChineseLocale):
928         (WebCore::languageChanged):
929         (WebCore::FontDescription::platformResolveGenericFamily):
930         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
931         (WebCore::SystemFontDatabaseCoreText::clear):
932         (WebCore::SystemFontDatabaseCoreText::serifFamily):
933         (WebCore::SystemFontDatabaseCoreText::sansSerifFamily):
934         (WebCore::SystemFontDatabaseCoreText::cursiveFamily):
935         (WebCore::SystemFontDatabaseCoreText::fantasyFamily):
936         (WebCore::SystemFontDatabaseCoreText::monospaceFamily):
937         * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
938
939 2019-02-08  Yusuke Suzuki  <ysuzuki@apple.com>
940
941         [JSC] Shrink sizeof(CodeBlock) more
942         https://bugs.webkit.org/show_bug.cgi?id=194419
943
944         Reviewed by Mark Lam.
945
946         * testing/Internals.cpp:
947         (WebCore::Internals::parserMetaData):
948
949 2019-02-08  Chris Dumez  <cdumez@apple.com>
950
951         [Cocoa] Optimize ResourceResponse::platformLazyInit()
952         https://bugs.webkit.org/show_bug.cgi?id=194438
953
954         Reviewed by Alex Christensen.
955
956         Optimize ResourceResponse::platformLazyInit(). Most of the CPU time currently goes into getting the
957         HTTP headers from CFNetwork:
958         """
959         Sample Count, Samples %, CPU %, Symbol
960         46, 0.0%, 0.0%, WebCore::initializeHTTPHeaders(WebCore::OnlyCommonHeaders, NSHTTPURLResponse*, WebCore::HTTPHeaderMap&) (in WebCore)
961         34, 0.0%, 0.0%,     HTTPHeaderDict::copyAsOrdinaryDict(__CFAllocator const*) const (in CFNetwork)
962         11, 0.0%, 0.0%,     CFDictionaryApplyFunction (in CoreFoundation)
963         """
964
965         We currently have 2 levels of initialization: CommonFieldsOnly & AllFields. With WebKit2, most ResourceResponses get sent over IPC
966         and thus end up getting initialized twice, once with CommonFieldsOnly and then with AllFields.
967         This would cause us to call the expensive HTTPHeaderDict::copyAsOrdinaryDict() twice instead of once, simply to initialize the common
968         HTTP headers first and then the uncommon ones later.
969
970         This patch updates ResourceResponse::platformLazyInit() to initialize all HTTP headers at once, as soon as CommonFieldsOnly
971         initialization is requested, so that we no longer copy all HTTP headers twice.
972
973         * platform/network/cocoa/ResourceResponseCocoa.mm:
974         (WebCore::initializeHTTPHeaders):
975         (WebCore::ResourceResponse::platformLazyInit):
976
977 2019-02-08  Justin Fan  <justin_fan@apple.com>
978
979         [Web GPU] Build fix for MTLStorageMode availability on different Cocoa platforms
980         https://bugs.webkit.org/show_bug.cgi?id=194443
981
982         Unreviewed build fix.
983
984         For MTLTextures, MTLStorageModeManaged is only available on macOS. Other platforms,
985         if not using MTLStorageModePrivate, must use MTLStorageModeShared.
986
987         Behavior unchanged.
988
989         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
990         (WebCore::storageModeForPixelFormatAndSampleCount):
991
992 2019-02-08  Per Arne Vollan  <pvollan@apple.com>
993
994         [WebVTT] Inline WebVTT styles should start with '::cue'
995         https://bugs.webkit.org/show_bug.cgi?id=194227
996         <rdar://problem/47791087>
997
998         Reviewed by Eric Carlson.
999
1000         Check that the CSS string starts with '::cue' and is successfully parsed before adding it
1001         to the CSS stylesheet list. Also, the caption preferences CSS string should start with
1002         '::cue', since it is added inside the video shadow root element.
1003
1004         Test: media/track/track-cue-css.html
1005
1006         * html/track/WebVTTParser.cpp:
1007         (WebCore::WebVTTParser::checkAndStoreStyleSheet):
1008         * page/CaptionUserPreferencesMediaAF.cpp:
1009         (WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride const):
1010
1011 2019-02-08  Youenn Fablet  <youenn@apple.com>
1012
1013         Running RTCRtpSender.getCapabilities("video") before initial offer breaks VP8
1014         https://bugs.webkit.org/show_bug.cgi?id=194380
1015         <rdar://problem/47916514>
1016
1017         Reviewed by Eric Carlson.
1018
1019         Set whether VP8 is supported at creation of the page.
1020         This ensures that any call creating a peer connection factory will end up supporting the runtime flag configuration.
1021
1022         Add internal API to enable resetting the factory to enable proper testing.
1023
1024         Covered by updated test.
1025
1026         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1027         (WebCore::createLibWebRTCPeerConnectionBackend):
1028         * page/Page.cpp:
1029         (WebCore::m_applicationManifest):
1030         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
1031         * testing/Internals.cpp:
1032         (WebCore::Internals::clearPeerConnectionFactory):
1033         * testing/Internals.h:
1034         * testing/Internals.idl:
1035
1036 2019-02-08  Andy Estes  <aestes@apple.com>
1037
1038         [WebIDL] Support serializing sequences and FrozenArrays of non-interfaces
1039         https://bugs.webkit.org/show_bug.cgi?id=190997
1040         <rdar://problem/35983035>
1041
1042         Reviewed by Brent Fulgham.
1043
1044         Support serializing sequences and FrozenArrays of types that aren't interfaces. This is
1045         needed to properly serialize PaymentAddress, which has a FrozenArray of DOMStrings.
1046
1047         We should support serializing sequences of interfaces too, but that's slightly more
1048         complicated since it involves iterating the sequence and serializing each of its items. I
1049         left that as a follow-up task, since I don't see any IDLs that currently need this.
1050
1051         We also don't support serializing sequences with the CachedAttribute or CustomGetter
1052         extended attributes, because WebIDL specifies that a new array should be created when
1053         converting an IDL sequence into an ECMAScript value.
1054
1055         Added bindings test cases to TestSerialization.idl and PaymentAddress test cases to
1056         http/tests/paymentrequest/payment-address-attributes-and-toJSON-method.https.html.
1057
1058         * bindings/scripts/CodeGenerator.pm:
1059         (GetInterfaceForType): Renamed from GetInterfaceForAttribute.
1060         (IsSerializableType): Modified to allow sequences and FrozenArrays of non-interface types.
1061         (hasCachedAttributeOrCustomGetterExtendedAttribute): Added a helper to determine if an
1062         attribute has the CachedAttribute or CustomGetter extended attributes.
1063         (IsSerializableAttribute): Checked for sequences with the CachedAttribute or CustomGetter
1064         extended attributes before calling IsSerializableType.
1065         (GetInterfaceForAttribute): Renamed to GetInterfaceForType.
1066         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1067         * bindings/scripts/test/TestSerialization.idl:
1068
1069 2019-02-08  Sihui Liu  <sihui_liu@apple.com>
1070
1071         IndexedDB tests leak documents
1072         https://bugs.webkit.org/show_bug.cgi?id=189435
1073         <rdar://problem/44240043>
1074
1075         Reviewed by Geoffrey Garen.
1076
1077         Remove use of JSC::Strong in IndexedDatabase.
1078
1079         * Modules/indexeddb/IDBCursor.cpp:
1080         (WebCore::IDBCursor::update):
1081         (WebCore::IDBCursor::continuePrimaryKey):
1082         (WebCore::IDBCursor::continueFunction):
1083         (WebCore::IDBCursor::deleteFunction):
1084         (WebCore::IDBCursor::setGetResult):
1085         * Modules/indexeddb/IDBCursor.h:
1086         (WebCore::IDBCursor::key):
1087         (WebCore::IDBCursor::primaryKey):
1088         (WebCore::IDBCursor::value):
1089         (WebCore::IDBCursor::keyWrapper):
1090         (WebCore::IDBCursor::primaryKeyWrapper):
1091         (WebCore::IDBCursor::valueWrapper):
1092         (WebCore::IDBCursor::key const): Deleted.
1093         (WebCore::IDBCursor::primaryKey const): Deleted.
1094         (WebCore::IDBCursor::value const): Deleted.
1095         * Modules/indexeddb/IDBCursor.idl:
1096         * Modules/indexeddb/IDBCursorWithValue.idl:
1097         * Modules/indexeddb/IDBObjectStore.cpp:
1098         (WebCore::IDBObjectStore::putForCursorUpdate):
1099         * Modules/indexeddb/IDBObjectStore.h:
1100         * Modules/indexeddb/IDBRequest.cpp:
1101         (WebCore::IDBRequest::IDBRequest):
1102         (WebCore::IDBRequest::~IDBRequest):
1103         (WebCore::IDBRequest::result const):
1104         (WebCore::IDBRequest::setResult):
1105         (WebCore::IDBRequest::setResultToStructuredClone):
1106         (WebCore::IDBRequest::setResultToUndefined):
1107         (WebCore::IDBRequest::resultCursor):
1108         (WebCore::IDBRequest::willIterateCursor):
1109         (WebCore::IDBRequest::didOpenOrIterateCursor):
1110         * Modules/indexeddb/IDBRequest.h:
1111         (WebCore::IDBRequest::resultWrapper):
1112         * Modules/indexeddb/IDBRequest.idl:
1113         * Sources.txt:
1114         * WebCore.xcodeproj/project.pbxproj:
1115         * bindings/js/JSIDBCursorCustom.cpp:
1116         (WebCore::JSIDBCursor::key const):
1117         (WebCore::JSIDBCursor::primaryKey const):
1118         (WebCore::JSIDBCursor::visitAdditionalChildren):
1119         * bindings/js/JSIDBCursorWithValueCustom.cpp:
1120         (WebCore::JSIDBCursorWithValue::value const):
1121         (WebCore::JSIDBCursorWithValue::visitAdditionalChildren):
1122         * bindings/js/JSIDBRequestCustom.cpp: Added.
1123         (WebCore::JSIDBRequest::result const):
1124         (WebCore::JSIDBRequest::visitAdditionalChildren):
1125         * inspector/agents/InspectorIndexedDBAgent.cpp:
1126
1127 2019-02-08  Zalan Bujtas  <zalan@apple.com>
1128
1129         [LFC] The used containing block width value is optional
1130         https://bugs.webkit.org/show_bug.cgi?id=194428
1131
1132         Reviewed by Antti Koivisto.
1133
1134         The preferred width codepath cannot provide a valid used containing block width value.
1135
1136         "The percentage is calculated with respect to the width of the generated box's containing block.
1137         If the containing block's width depends on this element's width, then the resulting layout is undefined in CSS 2.2."
1138
1139         Let's use 0 as used value for now.
1140
1141         * layout/FormattingContextGeometry.cpp:
1142         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
1143         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1144         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1145         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1146         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
1147         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1148         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
1149         (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin):
1150         * layout/LayoutUnits.h:
1151         (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
1152         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1153         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1154         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
1155         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
1156         * page/FrameViewLayoutContext.cpp:
1157
1158 2019-02-08  Zalan Bujtas  <zalan@apple.com>
1159
1160         [LFC] Horizontal geometry compute functions should take the containing block's width as a used value
1161         https://bugs.webkit.org/show_bug.cgi?id=194424
1162
1163         Reviewed by Antti Koivisto.
1164
1165         This is in preparation for passing optional containing block width for the preferred with codepath. 
1166
1167         * layout/FormattingContext.cpp:
1168         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
1169         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
1170         * layout/FormattingContext.h:
1171         * layout/FormattingContextGeometry.cpp:
1172         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
1173         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1174         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1175         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1176         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
1177         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1178         (WebCore::Layout::FormattingContext::Geometry::computedBorder):
1179         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
1180         (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin):
1181         * layout/LayoutUnits.h:
1182         (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
1183         * layout/blockformatting/BlockFormattingContext.cpp:
1184         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
1185         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1186         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1187         * layout/inlineformatting/InlineFormattingContext.cpp:
1188         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const):
1189         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
1190         * layout/inlineformatting/InlineFormattingContext.h:
1191         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
1192         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
1193
1194 2019-02-08  Benjamin Poulain  <benjamin@webkit.org>
1195
1196         clampTo(): do not convert the input to double when dealing with integers
1197         https://bugs.webkit.org/show_bug.cgi?id=194263
1198         <rdar://problem/47692312>
1199
1200         Reviewed by Darin Adler.
1201
1202         Make the calls to clampTo<float>() unambiguous.
1203
1204         * page/FrameView.cpp:
1205         (WebCore::FrameView::computeUpdatedLayoutViewportRect):
1206         * rendering/style/RenderStyle.h:
1207         (WebCore::RenderStyle::setOpacity):
1208         (WebCore::RenderStyle::setShapeImageThreshold):
1209
1210 2019-02-08  Eric Liang  <ericliang@apple.com>
1211
1212         When performing AXPress, check to see if the menu list is disabled.
1213         https://bugs.webkit.org/show_bug.cgi?id=193878
1214
1215         Reviewed by Chris Fleizach.
1216
1217         Test: accessibility/mac/press-not-work-for-disabled-menu-list.html
1218
1219         * accessibility/AXObjectCache.h:
1220         * accessibility/AccessibilityMenuList.cpp:
1221         (WebCore::AccessibilityMenuList::press):
1222         * accessibility/mac/AXObjectCacheMac.mm:
1223         (WebCore::AXObjectCache::postPlatformNotification):
1224
1225 2019-02-07  Devin Rousso  <drousso@apple.com>
1226
1227         PseudoElement created for any ::before/::after selector regardless of whether a content property exists
1228         https://bugs.webkit.org/show_bug.cgi?id=194423
1229         <rdar://problem/46787260>
1230
1231         Reviewed by Antti Koivisto.
1232
1233         Test: inspector/css/pseudo-creation.html
1234
1235         * style/StyleTreeResolver.cpp:
1236         (WebCore::Style::TreeResolver::resolvePseudoStyle):
1237         We should only be creating `PseudoElement`s if we actually have a `content` proprety in the
1238         `PseudoElement`'s style. Otherwise, we end up creating `PseudoElement`s for every CSS rule
1239         that has a `::before`/`::after`, only to immediately destroy them as there is nothing to show.
1240
1241 2019-02-07  Chris Dumez  <cdumez@apple.com>
1242
1243         Mark more heap-allocated classes as fast allocated
1244         https://bugs.webkit.org/show_bug.cgi?id=194422
1245
1246         Reviewed by Ryosuke Niwa.
1247
1248         * Modules/applepay/PaymentCoordinator.h:
1249         * Modules/beacon/NavigatorBeacon.h:
1250         * Modules/cache/DOMWindowCaches.h:
1251         * Modules/cache/WorkerGlobalScopeCaches.h:
1252         * Modules/credentialmanagement/NavigatorCredentials.h:
1253         * Modules/encryptedmedia/legacy/LegacyCDMPrivateClearKey.h:
1254         * Modules/gamepad/NavigatorGamepad.h:
1255         * Modules/indexeddb/IDBGetAllResult.h:
1256         * Modules/indexeddb/IDBGetResult.h:
1257         * Modules/indexeddb/IDBKeyData.h:
1258         * Modules/indexeddb/IDBValue.h:
1259         * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h:
1260         * Modules/indexeddb/server/IndexValueEntry.h:
1261         * Modules/indexeddb/server/IndexValueStore.h:
1262         * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
1263         * Modules/indexeddb/server/MemoryCursor.h:
1264         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
1265         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
1266         * Modules/indexeddb/server/SQLiteIDBCursor.h:
1267         * Modules/indexeddb/server/SQLiteIDBTransaction.h:
1268         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1269         * Modules/indexeddb/shared/IDBDatabaseInfo.h:
1270         * Modules/indexeddb/shared/IDBResourceIdentifier.h:
1271         * Modules/indexeddb/shared/IDBTransactionInfo.h:
1272         * Modules/mediacapabilities/NavigatorMediaCapabilities.h:
1273         * Modules/mediasession/WebMediaSessionManager.cpp:
1274         * Modules/mediastream/NavigatorMediaDevices.h:
1275         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
1276         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h:
1277         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
1278         * Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h:
1279         * Modules/navigatorcontentutils/NavigatorContentUtils.h:
1280         * Modules/quota/DOMWindowQuota.h:
1281         * Modules/quota/NavigatorStorageQuota.h:
1282         * Modules/quota/WorkerNavigatorStorageQuota.h:
1283         * Modules/speech/DOMWindowSpeechSynthesis.h:
1284         * Modules/webaudio/BiquadProcessor.h:
1285         * Modules/webaudio/DelayProcessor.h:
1286         * Modules/webauthn/fido/FidoHidPacket.h:
1287         * Modules/webdriver/NavigatorWebDriver.h:
1288         * Modules/webgpu/DOMWindowWebGPU.h:
1289         * Modules/websockets/WebSocketChannel.h:
1290         * Modules/webvr/NavigatorWebVR.h:
1291         * accessibility/AXObjectCache.h:
1292         * bindings/js/DOMGCOutputConstraint.h:
1293         * bindings/js/DOMPromiseProxy.h:
1294         * bridge/c/c_runtime.h:
1295         * contentextensions/CombinedURLFilters.cpp:
1296         * crypto/CryptoAlgorithmParameters.h:
1297         * css/CSSComputedStyleDeclaration.h:
1298         * css/CSSRegisteredCustomProperty.h:
1299         * css/DOMCSSPaintWorklet.h:
1300         * css/DOMCSSRegisterCustomProperty.h:
1301         * css/StyleRule.h:
1302         * dom/ConstantPropertyMap.h:
1303         * dom/CustomElementReactionQueue.h:
1304         * dom/Document.h:
1305         * dom/GenericEventQueue.h:
1306         * dom/RejectedPromiseTracker.h:
1307         * dom/UserGestureIndicator.h:
1308         * editing/ReplaceSelectionCommand.cpp:
1309         * editing/SelectionRectGatherer.h:
1310         * editing/TextIterator.h:
1311         * editing/cocoa/HTMLConverter.mm:
1312         * fileapi/AsyncFileStream.cpp:
1313         * fileapi/AsyncFileStream.h:
1314         * html/forms/FileIconLoader.h:
1315         * html/parser/HTMLTreeBuilder.h:
1316         * html/track/WebVTTParser.h:
1317         * inspector/DOMPatchSupport.cpp:
1318         * loader/FrameLoaderClient.h:
1319         * loader/WorkerThreadableLoader.cpp:
1320         * page/IntersectionObserver.h:
1321         * page/PerformanceMonitor.h:
1322         * page/PerformanceUserTiming.h:
1323         * page/PrintContext.h:
1324         * page/ValidationMessageClient.h:
1325         * platform/ColorChooser.h:
1326         * platform/ControlStates.h:
1327         * platform/DataListSuggestionPicker.h:
1328         * platform/FileStream.h:
1329         * platform/KeyedCoding.h:
1330         * platform/LowPowerModeNotifier.h:
1331         * platform/PlatformSpeechSynthesizer.h:
1332         * platform/WebGLStateTracker.h:
1333         * platform/audio/AudioArray.h:
1334         * platform/audio/AudioDestination.h:
1335         * platform/audio/DownSampler.h:
1336         * platform/audio/DynamicsCompressor.h:
1337         * platform/audio/FFTFrame.h:
1338         * platform/audio/HRTFDatabase.h:
1339         * platform/audio/MultiChannelResampler.h:
1340         * platform/audio/Panner.h:
1341         * platform/audio/Reverb.h:
1342         * platform/audio/ReverbConvolver.h:
1343         * platform/audio/ReverbConvolverStage.h:
1344         * platform/audio/UpSampler.h:
1345         * platform/audio/mac/AudioSessionMac.cpp:
1346         * platform/audio/mac/CAAudioStreamDescription.h:
1347         * platform/audio/mac/CARingBuffer.h:
1348         * platform/cocoa/ScrollSnapAnimatorState.h:
1349         * platform/gamepad/PlatformGamepad.h:
1350         * platform/graphics/GraphicsLayer.cpp:
1351         * platform/graphics/GraphicsLayerFactory.h:
1352         * platform/graphics/PlatformTimeRanges.h:
1353         * platform/graphics/TextTrackRepresentation.h:
1354         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h:
1355         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
1356         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
1357         * platform/graphics/displaylists/DisplayListRecorder.h:
1358         * platform/network/cocoa/WebCoreNSURLSession.mm:
1359         * platform/sql/SQLiteDatabase.h:
1360         * platform/text/TextCodecICU.h:
1361         * rendering/GridBaselineAlignment.h:
1362         * rendering/GridTrackSizingAlgorithm.h:
1363         * rendering/RenderObject.h:
1364         * rendering/style/GridArea.h:
1365         * workers/service/context/SWContextManager.h:
1366
1367 2019-02-07  Justin Fan  <justin_fan@apple.com>
1368
1369         [Web GPU] GPUDevice::createTexture implementation prototype
1370         https://bugs.webkit.org/show_bug.cgi?id=194409
1371         <rdar://problem/47894312>
1372
1373         Reviewed by Myles C. Maxfield.
1374
1375         Test: textures-textureviews.html updated to test new functionality.
1376
1377         Implement GPUDevice::createTexture():
1378         * Modules/webgpu/WebGPUDevice.cpp:
1379         (WebCore::WebGPUDevice::createTexture const):
1380         * Modules/webgpu/WebGPUDevice.h:
1381         * Modules/webgpu/WebGPUDevice.idl:
1382         * Modules/webgpu/WebGPUTexture.cpp:
1383         (WebCore::WebGPUTexture::create): Modified to return non-nullable to match direction of API.
1384         (WebCore::WebGPUTexture::WebGPUTexture):
1385         * Modules/webgpu/WebGPUTexture.h:
1386
1387         Metal backend MTLTextureDescriptor and MTLTexture creation:
1388         * platform/graphics/gpu/GPUDevice.cpp:
1389         (WebCore::GPUDevice::tryCreateTexture const):
1390         * platform/graphics/gpu/GPUDevice.h:
1391         * platform/graphics/gpu/GPUTexture.h:
1392         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
1393         (WebCore::mtlTextureTypeForGPUTextureDescriptor):
1394         (WebCore::mtlTextureUsageForGPUTextureUsageFlags):
1395         (WebCore::storageModeForPixelFormatAndSampleCount):
1396         (WebCore::tryCreateMtlTextureDescriptor):
1397         (WebCore::GPUTexture::tryCreate):
1398         (WebCore::GPUTexture::createDefaultTextureView): Add ObjC try/catch guards.
1399
1400         Add GPUUtils.h/cpp for shared utility functions:
1401         * SourcesCocoa.txt:
1402         * WebCore.xcodeproj/project.pbxproj:
1403         * platform/graphics/gpu/GPUUtils.h: Added. Moved platformTextureFormatForGPUTextureFormat here.
1404         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
1405         (WebCore::GPUSwapChain::setFormat):
1406         (WebCore::platformTextureFormatForGPUTextureFormat): Moved to GPUUtils.
1407         * platform/graphics/gpu/cocoa/GPUUtilsMetal.mm: Added.
1408         (WebCore::platformTextureFormatForGPUTextureFormat): Moved here to be referenced by multiple files.
1409
1410 2019-02-07  Sihui Liu  <sihui_liu@apple.com>
1411
1412         REGRESSION(r239887): Crash under IDBConnectionToClient::didDeleteDatabase(WebCore::IDBResultData const&)
1413         https://bugs.webkit.org/show_bug.cgi?id=194402
1414         <rdar://problem/47858241>
1415
1416         Reviewed by Geoffrey Garen.
1417
1418         r239887 removed a reference cycle of IDBConnectionToClient so that IDBConnectionToClient would no longer be
1419         around forever. Therefore, ServerOpenRequest should keep a reference to IDBConnectionToClient to make sure it
1420         is valid during access.
1421
1422         * Modules/indexeddb/server/ServerOpenDBRequest.cpp:
1423         (WebCore::IDBServer::ServerOpenDBRequest::maybeNotifyRequestBlocked):
1424         (WebCore::IDBServer::ServerOpenDBRequest::notifyDidDeleteDatabase):
1425         * Modules/indexeddb/server/ServerOpenDBRequest.h:
1426
1427 2019-02-07  Timothy Hatcher  <timothy@apple.com>
1428
1429         Overflow element scrollbar is light for dark mode content.
1430         https://bugs.webkit.org/show_bug.cgi?id=194407
1431         rdar://problem/45991585
1432
1433         Reviewed by Beth Dakin.
1434
1435         Tested by css-dark-mode/supported-color-schemes-scrollbar.html.
1436
1437         * page/ChromeClient.h:
1438         (WebCore::FrameView::preferredScrollbarOverlayStyle): Return WTF::nullopt by default to avoid
1439         short-circuiting auto detection in recalculateScrollbarOverlayStyle() for clients, like WK1,
1440         that do not implement preferredScrollbarOverlayStyle().
1441         * page/FrameView.cpp:
1442         (WebCore::FrameView::recalculateScrollbarOverlayStyle): Use WTF::nullopt in the false case
1443         to auto detect overlay style when page() is null.
1444         * rendering/RenderLayer.cpp:
1445         (WebCore::RenderLayer::useDarkAppearance const): Added.
1446         * rendering/RenderLayer.h:
1447         * testing/Internals.cpp:
1448         (WebCore::Internals::scrollbarOverlayStyle const): Added Node argument.
1449         (WebCore::Internals::scrollbarUsingDarkAppearance const): Added.
1450         * testing/Internals.h:
1451         * testing/Internals.idl:
1452
1453 2019-02-07  Eric Carlson  <eric.carlson@apple.com>
1454
1455         [MSE] Convert debug-only logging to runtime logging
1456         https://bugs.webkit.org/show_bug.cgi?id=194348
1457         <rdar://problem/47566449>
1458
1459         Reviewed by Jer Noble.
1460
1461         No new tests, this just changes existing logging.
1462
1463         * Modules/mediasource/MediaSource.cpp:
1464         (WebCore::convertEnumerationToString):
1465         (WebCore::MediaSource::MediaSource):
1466         (WebCore::MediaSource::~MediaSource):
1467         (WebCore::MediaSource::setPrivateAndOpen):
1468         (WebCore::MediaSource::addedToRegistry):
1469         (WebCore::MediaSource::removedFromRegistry):
1470         (WebCore::MediaSource::durationChanged):
1471         (WebCore::MediaSource::seekToTime):
1472         (WebCore::MediaSource::completeSeek):
1473         (WebCore::MediaSource::setLiveSeekableRange):
1474         (WebCore::MediaSource::clearLiveSeekableRange):
1475         (WebCore::MediaSource::setDuration):
1476         (WebCore::MediaSource::setDurationInternal):
1477         (WebCore::MediaSource::setReadyState):
1478         (WebCore::MediaSource::endOfStream):
1479         (WebCore::MediaSource::streamEndedWithError):
1480         (WebCore::MediaSource::addSourceBuffer):
1481         (WebCore::MediaSource::removeSourceBuffer):
1482         (WebCore::MediaSource::isTypeSupported):
1483         (WebCore::MediaSource::detachFromElement):
1484         (WebCore::MediaSource::attachToElement):
1485         (WebCore::MediaSource::openIfInEndedState):
1486         (WebCore::MediaSource::suspend):
1487         (WebCore::MediaSource::resume):
1488         (WebCore::MediaSource::stop):
1489         (WebCore::MediaSource::onReadyStateChange):
1490         (WebCore::MediaSource::scheduleEvent):
1491         (WebCore::MediaSource::logChannel const):
1492         (WebCore::MediaSourceInternal::toString): Deleted.
1493         * Modules/mediasource/MediaSource.h:
1494         (WTF::LogArgument<WebCore::MediaSource::EndOfStreamError>::toString):
1495         (WTF::LogArgument<WebCore::MediaSource::ReadyState>::toString):
1496         * Modules/mediasource/SourceBuffer.cpp:
1497         (WebCore::SourceBuffer::SourceBuffer):
1498         (WebCore::SourceBuffer::~SourceBuffer):
1499         (WebCore::SourceBuffer::remove):
1500         (WebCore::SourceBuffer::seekToTime):
1501         (WebCore::SourceBuffer::appendBufferInternal):
1502         (WebCore::SourceBuffer::sourceBufferPrivateAppendComplete):
1503         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError):
1504         (WebCore::removeSamplesFromTrackBuffer):
1505         (WebCore::SourceBuffer::removeCodedFrames):
1506         (WebCore::SourceBuffer::evictCodedFrames):
1507         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment):
1508         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
1509         (WebCore::SourceBuffer::sourceBufferPrivateReenqueSamples):
1510         (WebCore::SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples):
1511         (WebCore::SourceBuffer::provideMediaData):
1512         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
1513         (WebCore::SourceBuffer::monitorBufferingRate):
1514         (WebCore::SourceBuffer::logChannel const):
1515         * Modules/mediasource/SourceBuffer.h:
1516         * dom/Document.cpp:
1517         (WebCore::messageSourceForWTFLogChannel):
1518         (WebCore::Document::didLogMessage):
1519         * html/HTMLMediaElement.cpp:
1520         (WebCore::convertEnumerationToString):
1521         (WebCore::HTMLMediaElement::scheduleCheckPlaybackTargetCompatability):
1522         (WebCore::HTMLMediaElement::selectMediaResource):
1523         (WebCore::HTMLMediaElement::loadResource):
1524         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
1525         (WebCore::HTMLMediaElement::scheduleConfigureTextTracks):
1526         (WebCore::HTMLMediaElement::scheduleMediaEngineWasUpdated):
1527         (WebCore::HTMLMediaElement::scheduleUpdatePlayState):
1528         (WebCore::HTMLMediaElement::scheduleUpdateMediaState):
1529         * platform/ContentType.cpp:
1530         (WebCore::ContentType::toJSONString const):
1531         * platform/ContentType.h:
1532         (WTF::LogArgument<WebCore::ContentType>::toString):
1533         * platform/MediaSample.h:
1534         (WebCore::MediaSample::toJSONString const):
1535         (WTF::LogArgument<WebCore::MediaSample>::toString):
1536         * platform/graphics/FloatSize.cpp:
1537         (WebCore::FloatSize::toJSONObject const):
1538         (WebCore::FloatSize::toJSONString const):
1539         * platform/graphics/FloatSize.h:
1540         (WTF::LogArgument<WebCore::FloatSize>::toString):
1541         * platform/graphics/MediaSourcePrivate.h:
1542         (WebCore::MediaSourcePrivate::mediaSourceLogIdentifier):
1543         (WTF::LogArgument<WebCore::MediaSourcePrivate::AddStatus>::toString):
1544         (WTF::LogArgument<WebCore::MediaSourcePrivate::EndOfStreamStatus>::toString):
1545         * platform/graphics/SourceBufferPrivate.h:
1546         (WebCore::SourceBufferPrivate::sourceBufferLogger const):
1547         (WebCore::SourceBufferPrivate::sourceBufferLogIdentifier):
1548         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1549         (WebCore::MediaPlayerPrivateAVFoundationObjC::setMuted):
1550         (WebCore::MediaPlayerPrivateAVFoundationObjC::setClosedCaptionsVisible):
1551         (WebCore::MediaPlayerPrivateAVFoundationObjC::isCurrentPlaybackTargetWireless const):
1552         (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessVideoPlaybackDisabled const):
1553         (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessVideoPlaybackDisabled):
1554         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget):
1555         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldBufferData):
1556         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1557         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogIdentifier):
1558         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogger):
1559         (WTF::LogArgument<WebCore::MediaPlayerPrivateMediaSourceAVFObjC::SeekState>::toString):
1560         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1561         (WebCore::convertEnumerationToString):
1562         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
1563         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::~MediaPlayerPrivateMediaSourceAVFObjC):
1564         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load):
1565         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::play):
1566         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal):
1567         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pause):
1568         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pauseInternal):
1569         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVolume):
1570         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setMuted):
1571         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVisible):
1572         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance):
1573         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
1574         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted):
1575         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekCompleted):
1576         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPreservesPitch):
1577         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame):
1578         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateAllRenderersHaveAvailableSamples):
1579         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
1580         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setNaturalSize):
1581         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession):
1582         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
1583         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
1584         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceDetached):
1585         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::attemptToDecryptWithInstance):
1586         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitingForKeyChanged):
1587         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::initializationDataEncountered):
1588         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setReadyState):
1589         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setNetworkState):
1590         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setShouldPlayToPlaybackTarget):
1591         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isCurrentPlaybackTargetWireless const):
1592         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::logChannel const):
1593         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1594         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
1595         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h:
1596         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
1597         (WebCore::MediaSampleAVFObjC::toJSONString const):
1598         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
1599         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
1600         (WebCore::MediaSourcePrivateAVFObjC::MediaSourcePrivateAVFObjC):
1601         (WebCore::MediaSourcePrivateAVFObjC::~MediaSourcePrivateAVFObjC):
1602         (WebCore::MediaSourcePrivateAVFObjC::addSourceBuffer):
1603         (WebCore::MediaSourcePrivateAVFObjC::logChannel const):
1604         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1605         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1606         (WebCore::bufferWasConsumedCallback):
1607         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
1608         (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
1609         (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):
1610         (WebCore::SourceBufferPrivateAVFObjC::didFailToParseStreamDataWithError):
1611         (WebCore::SourceBufferPrivateAVFObjC::processCodedFrame):
1612         (WebCore::SourceBufferPrivateAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID):
1613         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
1614         (WebCore::SourceBufferPrivateAVFObjC::append):
1615         (WebCore::SourceBufferPrivateAVFObjC::abort):
1616         (WebCore::SourceBufferPrivateAVFObjC::resetParserState):
1617         (WebCore::SourceBufferPrivateAVFObjC::removedFromMediaSource):
1618         (WebCore::SourceBufferPrivateAVFObjC::setReadyState):
1619         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
1620         (WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
1621         (WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
1622         (WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError):
1623         (WebCore::SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
1624         (WebCore::SourceBufferPrivateAVFObjC::flush):
1625         (WebCore::SourceBufferPrivateAVFObjC::flushVideo):
1626         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
1627         (WebCore::SourceBufferPrivateAVFObjC::bufferWasConsumed):
1628         (WebCore::SourceBufferPrivateAVFObjC::setActive):
1629         (WebCore::SourceBufferPrivateAVFObjC::willSeek):
1630         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples):
1631         (WebCore::SourceBufferPrivateAVFObjC::canSwitchToType):
1632         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession):
1633         (WebCore::SourceBufferPrivateAVFObjC::logChannel const):
1634
1635 2019-02-07  Youenn Fablet  <youenn@apple.com>
1636
1637         Simplify applyConstraints callbacks
1638         https://bugs.webkit.org/show_bug.cgi?id=194297
1639
1640         Reviewed by Eric Carlson.
1641
1642         Make use of one callback for both success and failure cases.
1643         No changed of behavior.
1644
1645         * Modules/mediastream/MediaStreamTrack.cpp:
1646         (WebCore::MediaStreamTrack::applyConstraints):
1647         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1648         (WebCore::MediaStreamTrackPrivate::applyConstraints):
1649         * platform/mediastream/MediaStreamTrackPrivate.h:
1650         * platform/mediastream/RealtimeMediaSource.cpp:
1651         (WebCore::RealtimeMediaSource::applyConstraints):
1652         * platform/mediastream/RealtimeMediaSource.h:
1653         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1654         (WebCore::AVVideoCaptureSource::create):
1655         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1656         (WebCore::CoreAudioCaptureSource::create):
1657         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
1658         (WebCore::MockGStreamerAudioCaptureSource::applyConstraints):
1659         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h:
1660         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp:
1661         (WebCore::MockGStreamerVideoCaptureSource::applyConstraints):
1662         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h:
1663
1664 2019-02-07  Youenn Fablet  <youenn@apple.com>
1665
1666         Unable to sign in leetcode.
1667         https://bugs.webkit.org/show_bug.cgi?id=194366
1668         rdar://problem/47259025.
1669
1670         Reviewed by Chris Dumez.
1671
1672         In case a signal is passed as part of a FetchRequestInit,
1673         the IDL binding code is throwing an exception in case signal is not an AbortSignal object.
1674         This breaks an AbortSignal shim used in some web sites.
1675         Relaxed the IDL binding rule by marking signal as any and doing the conversion in FetchRequest.
1676
1677         Test: http/wpt/fetch/request-abort.html
1678         Also covered by manually signing in to leetcode.
1679
1680         * Modules/fetch/FetchRequest.cpp:
1681         (WebCore::FetchRequest::initializeWith):
1682         * Modules/fetch/FetchRequestInit.h:
1683         (WebCore::FetchRequestInit::hasMembers const):
1684         * Modules/fetch/FetchRequestInit.idl:
1685
1686 2019-02-07  Youenn Fablet  <youenn@apple.com>
1687
1688         Make to clear sources from UserMediaCaptureManagerProxy and UserMediaCaptureManager when no longer needed
1689         https://bugs.webkit.org/show_bug.cgi?id=194312
1690
1691         Reviewed by Eric Carlson.
1692
1693         Add a way for sources to know when they are ended, i.e. that they will never be started again.
1694         No observable change of behavior.
1695
1696         * platform/mediastream/RealtimeMediaSource.cpp:
1697         (WebCore::RealtimeMediaSource::requestStop):
1698         * platform/mediastream/RealtimeMediaSource.h:
1699
1700 2019-02-07  Jer Noble  <jer.noble@apple.com>
1701
1702         HTMLMediaElement registers wrong ScriptExecutionContext with its ActiveDOMObject parent class
1703         https://bugs.webkit.org/show_bug.cgi?id=194360
1704
1705         HTMLMediaElement registers the Document used to create it with ActiveDOMObject, when it should
1706         really use that Document's contextDocument(). Rather than just fix this in HTMLMediaElement,
1707         make sure that the correct document is used everywhere by adding a new ActiveDOMObject constructor
1708         taking a Document&, and making an explicitly deleted Document* constructor to catch any new cases.
1709
1710         Reviewed by Geoffrey Garen.
1711
1712         * Modules/applepay/ApplePaySession.cpp:
1713         (WebCore::ApplePaySession::ApplePaySession):
1714         * Modules/mediarecorder/MediaRecorder.cpp:
1715         (WebCore::MediaRecorder::MediaRecorder):
1716         * Modules/mediastream/MediaDevices.cpp:
1717         (WebCore::MediaDevices::MediaDevices):
1718         * Modules/mediastream/UserMediaRequest.cpp:
1719         (WebCore::UserMediaRequest::UserMediaRequest):
1720         * Modules/notifications/Notification.cpp:
1721         (WebCore::Notification::Notification):
1722         * Modules/paymentrequest/PaymentRequest.cpp:
1723         (WebCore::PaymentRequest::PaymentRequest):
1724         * Modules/webaudio/AudioContext.cpp:
1725         (WebCore::AudioContext::AudioContext):
1726         * animation/WebAnimation.cpp:
1727         (WebCore::WebAnimation::WebAnimation):
1728         * css/FontFaceSet.cpp:
1729         (WebCore::FontFaceSet::FontFaceSet):
1730         * dom/ActiveDOMObject.cpp:
1731         (WebCore::ActiveDOMObject::ActiveDOMObject):
1732         * dom/ActiveDOMObject.h:
1733         * dom/Document.h:
1734         (WebCore::ActiveDOMObject::ActiveDOMObject):
1735         * html/HTMLMarqueeElement.cpp:
1736         (WebCore::HTMLMarqueeElement::HTMLMarqueeElement):
1737         * html/HTMLMediaElement.cpp:
1738         (WebCore::HTMLMediaElement::HTMLMediaElement):
1739         * html/HTMLSourceElement.cpp:
1740         (WebCore::HTMLSourceElement::HTMLSourceElement):
1741         * page/IntersectionObserver.cpp:
1742         (WebCore::IntersectionObserver::IntersectionObserver):
1743
1744 2019-02-07  Zalan Bujtas  <zalan@apple.com>
1745
1746         [LFC][Out-of-flow] Use the containing block's padding width when computing min/max width.
1747         https://bugs.webkit.org/show_bug.cgi?id=194391
1748
1749         Reviewed by Antti Koivisto.
1750
1751         The spec is not clear about this but that's what matches the current behaviour.
1752
1753         Test: fast/block/block-only/absolute-positioned-min-max-percentage-with-parent-padding.html
1754
1755         * layout/FormattingContext.cpp:
1756         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
1757
1758 2019-02-07  Zalan Bujtas  <zalan@apple.com>
1759
1760         [LFC] Use dedicated data structures for optional used values (input to geometry functions)
1761         https://bugs.webkit.org/show_bug.cgi?id=194376
1762
1763         Reviewed by Antti Koivisto.
1764
1765         This is in preparation for being able to pass in the containing block's width as an optional used value.
1766         During layout we always have a valid width for the containing block, however it's not the case while computing the preferred width.
1767
1768         * layout/FormattingContext.cpp:
1769         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
1770         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
1771         * layout/FormattingContext.h:
1772         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry): Deleted.
1773         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry): Deleted.
1774         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin): Deleted.
1775         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin): Deleted.
1776         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin): Deleted.
1777         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): Deleted.
1778         (): Deleted.
1779         (WebCore::Layout::FormattingContext::Geometry::complicatedCases): Deleted.
1780         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): Deleted.
1781         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): Deleted.
1782         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): Deleted.
1783         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): Deleted.
1784         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin): Deleted.
1785         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): Deleted.
1786         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): Deleted.
1787         * layout/FormattingContextGeometry.cpp:
1788         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
1789         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1790         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1791         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1792         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
1793         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1794         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
1795         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
1796         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
1797         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
1798         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
1799         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
1800         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1801         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1802         * layout/LayoutUnits.h:
1803         * layout/blockformatting/BlockFormattingContext.cpp:
1804         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
1805         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
1806         * layout/blockformatting/BlockFormattingContext.h:
1807         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin): Deleted.
1808         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin): Deleted.
1809         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): Deleted.
1810         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): Deleted.
1811         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): Deleted.
1812         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1813         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1814         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1815         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
1816         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1817         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
1818         * layout/inlineformatting/InlineFormattingContext.cpp:
1819         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
1820         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
1821         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
1822         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
1823         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin):
1824         * page/FrameViewLayoutContext.cpp:
1825         (WebCore::layoutUsingFormattingContext):
1826
1827 2019-02-07  Antti Koivisto  <antti@apple.com>
1828
1829         Infinite recursion via CachedResource::~CachedResource
1830         https://bugs.webkit.org/show_bug.cgi?id=194378
1831         <rdar://problem/42023295>
1832
1833         Reviewed by Daniel Bates.
1834
1835         I don't know the exact steps to trigger this but the mechanism seems clear.
1836
1837         1) An existing resource is removed from or replaced in CachedResourceLoader::m_documentResources map.
1838         2) This decrements the handle count of resource and causes it be deleted.
1839         3) CachedResource::~CachedResource calls m_owningCachedResourceLoader->removeCachedResource(*this). This only happens with
1840            resources that are "owned" by CachedResourceLoader which is a rare special case (used by image document and if memory cache is disabled).
1841         4) CachedResourceLoader::removeCachedResource looks up the resource from the map which causes a temporary CachedResourceHandle to be created.
1842            This increments the handle count of the resource from 0 back to 1.
1843         5) When the temporary dies, CachedResource::~CachedResource is called again and we cycle back to 3).
1844
1845         The fix here is simply to remove CachedResourceLoader::removeCachedResource call from ~CachedResource.
1846         It is a leftover from when the map contained raw pointers instead of owning CachedResourceHandles.
1847
1848         Since m_documentResources map has a handle to the resource, the only way we are in the destructor is that the resource
1849         has been removed from the map already (or is in process of being removed like in this crash). Any call that does anything
1850         other than bail out is going to crash.
1851
1852         CachedResource::n_owningCachedResourceLoader member and CachedResourceLoader::removeCachedResource function only exist to
1853         support this erranous call so they are removed as well.
1854
1855         * loader/ImageLoader.cpp:
1856         (WebCore::ImageLoader::updateFromElement):
1857         * loader/cache/CachedResource.cpp:
1858         (WebCore::CachedResource::~CachedResource):
1859
1860         This is the substantive change. The rest just removes now-dead code.
1861
1862         * loader/cache/CachedResource.h:
1863         (WebCore::CachedResource::setOwningCachedResourceLoader): Deleted.
1864         * loader/cache/CachedResourceLoader.cpp:
1865         (WebCore::CachedResourceLoader::~CachedResourceLoader):
1866         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
1867         (WebCore::CachedResourceLoader::requestResource):
1868         (WebCore::CachedResourceLoader::loadResource):
1869         (WebCore::CachedResourceLoader::garbageCollectDocumentResources):
1870         (WebCore::CachedResourceLoader::removeCachedResource): Deleted.
1871         * loader/cache/CachedResourceLoader.h:
1872
1873 2019-02-07  Miguel Gomez  <magomez@igalia.com>
1874
1875         [WPE] Implement GStreamer based holepunch
1876         https://bugs.webkit.org/show_bug.cgi?id=193715
1877
1878         Reviewed by Xabier Rodriguez-Calvar.
1879
1880         Implement GStreamer based holepunch functionality. Instead of getting the video frames from the
1881         video sink and drawing then, the player just draws a transparent rectangle on the position where
1882         the video should be. MediaPlayerPrivateGStreamerBase will instantiate a platform dependant video
1883         sink which will be in charge of displaying the video frames in some way (usually on a plane below
1884         the browser), and will push empty frames to the compositor indicating that the rectangle to draw
1885         should overwrite the existent content. TextureMapperPlatformLayerBuffer::HolePunchClient is used
1886         to tell the video sink where to position the video so it's set below the browser transparent hole.
1887
1888         Added ManualTest wpe/video-player-holepunch.html to test the feature.
1889
1890         * platform/graphics/MediaPlayer.cpp:
1891         (WebCore::MediaPlayer::shouldIgnoreIntrinsicSize):
1892         * platform/graphics/MediaPlayer.h:
1893         * platform/graphics/MediaPlayerPrivate.h:
1894         (WebCore::MediaPlayerPrivateInterface::shouldIgnoreIntrinsicSize):
1895         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1896         (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const):
1897         (WebCore::MediaPlayerPrivateGStreamerBase::swapBuffersIfNeeded):
1898         (WebCore::setRectangleToVideoSink):
1899         (WebCore::GStreamerHolePunchClient::GStreamerHolePunchClient):
1900         (WebCore::MediaPlayerPrivateGStreamerBase::createHolePunchVideoSink):
1901         (WebCore::MediaPlayerPrivateGStreamerBase::pushNextHolePunchBuffer):
1902         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):
1903         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1904         * platform/graphics/texmap/TextureMapper.h:
1905         * platform/graphics/texmap/TextureMapperGL.cpp:
1906         (WebCore::TextureMapperGL::drawSolidColor):
1907         * platform/graphics/texmap/TextureMapperGL.h:
1908         * platform/graphics/texmap/TextureMapperLayer.cpp:
1909         (WebCore::TextureMapperLayer::paintSelf):
1910         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
1911         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
1912         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
1913         (WebCore::TextureMapperPlatformLayerBuffer::setHolePunchClient):
1914         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1915         (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer):
1916         * rendering/RenderVideo.cpp:
1917         (WebCore::RenderVideo::videoBox const):
1918
1919 2019-02-06  Benjamin Poulain  <benjamin@webkit.org>
1920
1921         Unreviewed, rolling out r240759 and r240944.
1922
1923         Some timer uses are done off the main thread, WebCore::Timer
1924         cannot be used
1925
1926         Reverted changesets:
1927
1928         "<rdar://problem/47570443> Responsiveness timers are too
1929         expensive for frequent events"
1930         https://bugs.webkit.org/show_bug.cgi?id=194003
1931         https://trac.webkit.org/changeset/240759
1932
1933         "Use deferrable timer to restart the Responsiveness Timer on
1934         each wheel event"
1935         https://bugs.webkit.org/show_bug.cgi?id=194135
1936         https://trac.webkit.org/changeset/240944
1937
1938 2019-02-06  Keith Rollin  <krollin@apple.com>
1939
1940         Update .xcfilelist files
1941
1942         Unreviewed build fix.
1943
1944         * DerivedSources-input.xcfilelist:
1945         * DerivedSources-output.xcfilelist:
1946
1947 2019-02-06  Devin Rousso  <drousso@apple.com>
1948
1949         Web Inspector: DOM: don't send the entire function string with each event listener
1950         https://bugs.webkit.org/show_bug.cgi?id=194293
1951         <rdar://problem/47822809>
1952
1953         Reviewed by Joseph Pecoraro.
1954
1955         Test: inspector/dom/getEventListenersForNode.html
1956
1957         * inspector/agents/InspectorDOMAgent.cpp:
1958         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
1959
1960 2019-02-06  Andy Estes  <aestes@apple.com>
1961
1962         [Payment Request] It should be possible to require a phonetic name for shipping contacts
1963         https://bugs.webkit.org/show_bug.cgi?id=194311
1964         <rdar://46733045>
1965
1966         Reviewed by Alex Christensen.
1967
1968         It should be possible to require that a shipping contact has a phonetic name in Payment Request.
1969         To accomplish this, move requiredShippingContactFields from ApplePayPaymentRequest to
1970         ApplePayRequestBase so that it can be used as part of an Apple Pay payment method data.
1971
1972         Since required shipping contact fields can now be specified both in
1973         requiredShippingContactFields and PaymentOptions, we merge the required fields from these
1974         two sources such that, e.g., email is required if it is specified in either place.
1975
1976         So that clients can detect this new feature, the API version number is bumped from 5 to 6.
1977
1978         Added test cases to ApplePayRequestShippingContact.https.html and ApplePayRequestShippingContactV3.https.html.
1979
1980         * DerivedSources.make:
1981         * Modules/applepay/ApplePayPaymentRequest.h:
1982         * Modules/applepay/ApplePayPaymentRequest.idl:
1983         * Modules/applepay/ApplePayRequestBase.cpp:
1984         (WebCore::convertAndValidate):
1985         * Modules/applepay/ApplePayRequestBase.h:
1986         * Modules/applepay/ApplePayRequestBase.idl:
1987         * Modules/applepay/ApplePaySession.cpp:
1988         (WebCore::convertAndValidate):
1989         * Modules/applepay/PaymentCoordinatorClient.cpp: Added.
1990         (WebCore::PaymentCoordinatorClient::supportsVersion):
1991         * Modules/applepay/PaymentCoordinatorClient.h:
1992         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1993         (WebCore::mergePaymentOptions):
1994         (WebCore::ApplePayPaymentHandler::show):
1995         * SourcesCocoa.txt:
1996         * WebCore.xcodeproj/project.pbxproj:
1997         * loader/EmptyClients.cpp:
1998         * testing/MockPaymentContactFields.h: Added.
1999         (WebCore::MockPaymentContactFields::MockPaymentContactFields):
2000         * testing/MockPaymentContactFields.idl: Added.
2001         * testing/MockPaymentCoordinator.cpp:
2002         (WebCore::MockPaymentCoordinator::showPaymentUI):
2003         (WebCore::MockPaymentCoordinator::supportsVersion): Deleted.
2004         * testing/MockPaymentCoordinator.h:
2005         * testing/MockPaymentCoordinator.idl:
2006
2007 2019-02-06  Yusuke Suzuki  <ysuzuki@apple.com>
2008
2009         [JSC] PrivateName to PublicName hash table is wasteful
2010         https://bugs.webkit.org/show_bug.cgi?id=194277
2011
2012         Reviewed by Michael Saboff.
2013
2014         Use WebCoreBuiltinNames instead of adding WebCore names to JSC CommonIdentifiers.
2015
2016         * bindings/js/JSDOMWindowCustom.cpp:
2017         (WebCore::addCrossOriginPropertyNames):
2018         * bindings/js/JSLocationCustom.cpp:
2019         (WebCore::getOwnPropertySlotCommon):
2020         (WebCore::putCommon):
2021         * bindings/js/WebCoreBuiltinNames.h:
2022
2023 2019-02-06  Keith Rollin  <krollin@apple.com>
2024
2025         Really enable the automatic checking and regenerations of .xcfilelists during builds
2026         https://bugs.webkit.org/show_bug.cgi?id=194357
2027         <rdar://problem/47861231>
2028
2029         Reviewed by Chris Dumez.
2030
2031         Bug 194124 was supposed to enable the automatic checking and
2032         regenerating of .xcfilelist files during the build. While related
2033         changes were included in that patch, the change to actually enable the
2034         operation somehow was omitted. This patch actually enables the
2035         operation. The check-xcfilelist.sh scripts now check
2036         WK_DISABLE_CHECK_XCFILELISTS, and if it's "1", opts-out the developer
2037         from the checking.
2038
2039         No new tests since there should be no observable behavior difference.
2040
2041         * Scripts/check-xcfilelists.sh:
2042
2043 2019-02-06  John Wilander  <wilander@apple.com>
2044
2045         Forward Ad Click Attribution data from HTMLAnchorElement::handleClick() to WebKit::NavigationActionData
2046         https://bugs.webkit.org/show_bug.cgi?id=194325
2047         <rdar://problem/47840283>
2048
2049         Reviewed by Chris Dumez.
2050
2051         No new tests. This is just data forwarding. Once the data is stored, I will create
2052         test infrastructure to query it.
2053
2054         * html/HTMLAnchorElement.cpp:
2055         (WebCore::HTMLAnchorElement::handleClick):
2056         * loader/AdClickAttribution.h:
2057         (WebCore::AdClickAttribution::encode const):
2058         (WebCore::AdClickAttribution::decode):
2059         (WebCore::AdClickAttribution::Conversion::encode const):
2060         (WebCore::AdClickAttribution::Conversion::decode):
2061             Infrastructure for IPC.
2062         * loader/FrameLoader.cpp:
2063         (WebCore::FrameLoader::urlSelected):
2064         (WebCore::FrameLoader::loadURLIntoChildFrame):
2065         (WebCore::FrameLoader::loadFrameRequest):
2066         (WebCore::FrameLoader::loadURL):
2067             These functions forward the optional WebCore::AdClickAttribution object
2068             FrameLoader::loadURL() creates the NavigationAction object and sets the
2069             WebCore::AdClickAttribution object on there.
2070         * loader/FrameLoader.h:
2071         (WebCore::FrameLoader::urlSelected):
2072         (WebCore::FrameLoader::loadURL):
2073         * loader/NavigationAction.h:
2074         (WebCore::NavigationAction::adClickAttribution):
2075         (WebCore::NavigationAction::setAdClickAttribution):
2076
2077 2019-02-06  Justin Fan  <justin_fan@apple.com>
2078
2079         [Web GPU] Implement supporting dictionaries for GPUTexture
2080         https://bugs.webkit.org/show_bug.cgi?id=194354
2081
2082         Reviewed by Dean Jackson.
2083
2084         Add dictionaries needed to create a GPUTextureDescriptor.
2085
2086         No new tests; no change in behavior. 
2087
2088         New interface and dictionaries added:
2089         * Modules/webgpu/GPUExtent3D.idl:
2090         * Modules/webgpu/GPUTextureDescriptor.idl:
2091         * Modules/webgpu/GPUTextureDimension.idl:
2092         * Modules/webgpu/GPUTextureUsage.idl:
2093         * platform/graphics/gpu/GPUExtent3D.h:
2094         * platform/graphics/gpu/GPUTextureDescriptor.h:
2095         * platform/graphics/gpu/GPUTextureDimension.h:
2096         * platform/graphics/gpu/GPUTextureUsage.h:
2097
2098         Update WebGPUTextureFormatEnum to GPUTextureFormat:
2099         * Modules/webgpu/WebGPUTextureFormatEnum.h: Removed.
2100         * Modules/webgpu/GPUTextureFormat.idl: Renamed from WebGPUTextureFormatEnum.idl and updated to hyphen-case.
2101         * platform/graphics/gpu/GPUTextureFormat.h: Renamed from GPUTextureFormatEnum and updated for hyphen-case IDL.
2102         * Modules/webgpu/WebGPUSwapChain.cpp:
2103         * Modules/webgpu/WebGPUSwapChain.h:
2104         * Modules/webgpu/WebGPUSwapChain.idl:
2105         * platform/graphics/gpu/GPUSwapChain.h:
2106         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
2107         (WebCore::platformTextureFormatForGPUTextureFormat):
2108         (WebCore::GPUSwapChain::setFormat):
2109
2110         Update project files with new symbols:
2111         * CMakeLists.txt:
2112         * DerivedSources.make:
2113         * Sources.txt:
2114         * WebCore.xcodeproj/project.pbxproj:
2115         * bindings/js/WebCoreBuiltinNames.h:
2116
2117 2019-02-06  Dean Jackson  <dino@apple.com>
2118
2119         Fix potential build error in GPUDevice
2120         https://bugs.webkit.org/show_bug.cgi?id=194359
2121
2122         Reviewed by Joseph Pecoraro.
2123
2124         Add an UNUSED_PARAM for non-macOS platforms.
2125
2126         * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
2127         (WebCore::GPUDevice::create):
2128
2129 2019-02-06  Daniel Bates  <dabates@apple.com>
2130
2131         Standardize on ControlKey instead of CtrlKey
2132         https://bugs.webkit.org/show_bug.cgi?id=194317
2133
2134         Reviewed by Tim Horton.
2135
2136         * dom/UIEventWithKeyState.cpp:
2137         (WebCore::UIEventWithKeyState::modifiersFromInitializer):
2138         (WebCore::UIEventWithKeyState::setModifierKeys):
2139         * dom/UIEventWithKeyState.h:
2140         (WebCore::UIEventWithKeyState::ctrlKey const):
2141         * page/ios/EventHandlerIOS.mm:
2142         (WebCore::EventHandler::accessKeyModifiers):
2143         * page/mac/EventHandlerMac.mm:
2144         (WebCore::EventHandler::accessKeyModifiers):
2145         * platform/PlatformEvent.h:
2146         (WebCore::PlatformEvent::controlKey const):
2147         (WebCore::PlatformEvent::PlatformEvent):
2148         (WebCore::PlatformEvent::ctrlKey const): Deleted.
2149         * platform/cocoa/KeyEventCocoa.mm:
2150         (WebCore::PlatformKeyboardEvent::getCurrentModifierState):
2151         * platform/gtk/PlatformKeyboardEventGtk.cpp:
2152         (WebCore::modifiersForGdkKeyEvent):
2153         * platform/gtk/PlatformMouseEventGtk.cpp:
2154         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
2155         * platform/gtk/PlatformWheelEventGtk.cpp:
2156         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
2157         * platform/ios/KeyEventIOS.mm:
2158         (WebCore::PlatformKeyboardEvent::currentStateOfModifierKeys):
2159         * platform/ios/PlatformEventFactoryIOS.mm:
2160         (WebCore::modifiersForEvent):
2161         * platform/mac/KeyEventMac.mm:
2162         (WebCore::PlatformKeyboardEvent::currentStateOfModifierKeys):
2163         * platform/mac/PlatformEventFactoryMac.mm:
2164         (WebCore::modifiersForEvent):
2165         * testing/Internals.cpp:
2166         (WebCore::Internals::accessKeyModifiers const):
2167
2168 2019-02-06  Alex Christensen  <achristensen@webkit.org>
2169
2170         Fix WatchOS build
2171         https://bugs.webkit.org/show_bug.cgi?id=194353
2172
2173         Rubber stamped by Tim Horton and Wenson Hsieh.
2174
2175         * rendering/RenderThemeIOS.mm:
2176         (WebCore::iconForAttachment):
2177
2178 2019-02-06  Olivier Blin  <olivier.blin@softathome.com>
2179
2180         [SVG] fix SVGURIReference build by including SVGElement
2181         https://bugs.webkit.org/show_bug.cgi?id=194292
2182
2183         Reviewed by Michael Catanzaro.
2184
2185         * svg/SVGURIReference.h:
2186         SVGURIReference is making use of SVGElement in its constructor, but
2187         it was not declared.
2188
2189         The issue was not seen in unified builds because it was grouped with
2190         other files including SVGElement.
2191
2192 2019-02-06  Zalan Bujtas  <zalan@apple.com>
2193
2194         [LFC][IFC] Move line layout code to a dedicated file
2195         https://bugs.webkit.org/show_bug.cgi?id=194328
2196
2197         Reviewed by Antti Koivisto.
2198
2199         * Sources.txt:
2200         * WebCore.xcodeproj/project.pbxproj:
2201         * layout/inlineformatting/InlineFormattingContext.cpp:
2202         (WebCore::Layout::InlineFormattingContext::layout const):
2203         (WebCore::Layout::isTrimmableContent): Deleted.
2204         (WebCore::Layout::InlineFormattingContext::initializeNewLine const): Deleted.
2205         (WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const): Deleted.
2206         (WebCore::Layout::InlineFormattingContext::createFinalRuns const): Deleted.
2207         (WebCore::Layout::InlineFormattingContext::postProcessInlineRuns const): Deleted.
2208         (WebCore::Layout::InlineFormattingContext::closeLine const): Deleted.
2209         (WebCore::Layout::InlineFormattingContext::appendContentToLine const): Deleted.
2210         (WebCore::Layout::InlineFormattingContext::layoutInlineContent const): Deleted.
2211         (WebCore::Layout::InlineFormattingContext::computeFloatPosition const): Deleted.
2212         (WebCore::Layout::InlineFormattingContext::placeInFlowPositionedChildren const): Deleted.
2213         * layout/inlineformatting/InlineFormattingContext.h:
2214         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::hasContent const):
2215         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::isClosed const):
2216         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::isFirstLine const):
2217         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::runs):
2218         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::contentLogicalLeft const):
2219         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::availableWidth const):
2220         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::lastRunType const):
2221         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::logicalTop const):
2222         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::logicalBottom const):
2223         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::logicalHeight const):
2224         (WebCore::Layout::InlineFormattingContext::Line::hasContent const): Deleted.
2225         (WebCore::Layout::InlineFormattingContext::Line::isClosed const): Deleted.
2226         (WebCore::Layout::InlineFormattingContext::Line::isFirstLine const): Deleted.
2227         (WebCore::Layout::InlineFormattingContext::Line::runs): Deleted.
2228         (WebCore::Layout::InlineFormattingContext::Line::contentLogicalLeft const): Deleted.
2229         (WebCore::Layout::InlineFormattingContext::Line::availableWidth const): Deleted.
2230         (WebCore::Layout::InlineFormattingContext::Line::lastRunType const): Deleted.
2231         (WebCore::Layout::InlineFormattingContext::Line::logicalTop const): Deleted.
2232         (WebCore::Layout::InlineFormattingContext::Line::logicalBottom const): Deleted.
2233         (WebCore::Layout::InlineFormattingContext::Line::logicalHeight const): Deleted.
2234         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
2235         (WebCore::Layout::adjustedLineLogicalLeft): Deleted.
2236         (WebCore::Layout::InlineFormattingContext::Geometry::justifyRuns): Deleted.
2237         (WebCore::Layout::InlineFormattingContext::Geometry::computeExpansionOpportunities): Deleted.
2238         (WebCore::Layout::InlineFormattingContext::Geometry::alignRuns): Deleted.
2239         (WebCore::Layout::InlineFormattingContext::Geometry::runWidth): Deleted.
2240         * layout/inlineformatting/Line.cpp:
2241         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::init):
2242         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::adjustLogicalLeft):
2243         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::adjustLogicalRight):
2244         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::contentLogicalRight const):
2245         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::appendContent):
2246         (WebCore::Layout::InlineFormattingContext::LineLayout::Line::close):
2247         (WebCore::Layout::InlineFormattingContext::Line::init): Deleted.
2248         (WebCore::Layout::InlineFormattingContext::Line::adjustLogicalLeft): Deleted.
2249         (WebCore::Layout::InlineFormattingContext::Line::adjustLogicalRight): Deleted.
2250         (WebCore::Layout::InlineFormattingContext::Line::contentLogicalRight const): Deleted.
2251         (WebCore::Layout::InlineFormattingContext::Line::appendContent): Deleted.
2252         (WebCore::Layout::InlineFormattingContext::Line::close): Deleted.
2253
2254 2019-02-06  Youenn Fablet  <youenn@apple.com>
2255
2256         CoreAudioCaptureSource should not configure its audio unit until it starts producing data
2257         https://bugs.webkit.org/show_bug.cgi?id=194310
2258
2259         Reviewed by Eric Carlson.
2260
2261         Delay the configuration of the audio unit until the source is instructed to start producing data.
2262         This allows the UIProcess to not start changing the audio unit when
2263         checking for constraints during getUserMedia call before the prompt.
2264         Covered by manual testing.
2265
2266         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2267         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
2268         (WebCore::CoreAudioCaptureSource::initializeToStartProducingData):
2269         (WebCore::CoreAudioCaptureSource::startProducingData):
2270         * platform/mediastream/mac/CoreAudioCaptureSource.h:
2271
2272 2019-02-06  Youenn Fablet  <youenn@apple.com>
2273
2274         Disable audio ducking at Audio Unit setup time
2275         https://bugs.webkit.org/show_bug.cgi?id=194303
2276
2277         Reviewed by Eric Carlson.
2278
2279         When creating a CoreAudioCaptureSource, the audio unit might be
2280         reconfigured if a past audio capture was done.
2281         This might trigger audio ducking which is undone in startInternal.
2282         In some cases, startInternal will never call start.
2283         In that case, the audio unit will continue ducking the other processing.
2284         To ensure ducking is disabled, unduck in setupAudioUnit as well as startInternal.
2285
2286         In addition to that, once a shared unit is created, it stays alive until the UIProcess exits.
2287         This might affect all applications.
2288         Instead, whenever the shared unit is stopped, clean it so as to restore the state as if no capture ever happened.
2289         This has noticeable effects in the quality of audio being played on bluetooth devices.
2290
2291         Covered by manual tests.
2292
2293         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2294         (WebCore::CoreAudioSharedUnit::setupAudioUnit):
2295         (WebCore::CoreAudioSharedUnit::unduck):
2296         (WebCore::CoreAudioSharedUnit::startInternal):
2297         (WebCore::CoreAudioSharedUnit::captureFailed):
2298         (WebCore::CoreAudioSharedUnit::stopProducingData):
2299
2300 2019-02-06  Antti Koivisto  <antti@apple.com>
2301
2302         RELEASE_ASSERT(!m_document.isResolvingTreeStyle()) in com.apple.WebKit.WebContent at WebCore: WebCore::StyleResolver::~StyleResolver
2303         https://bugs.webkit.org/show_bug.cgi?id=194333
2304         <rdar://problem/47822929>
2305
2306         Reviewed by Zalan Bujtas.
2307
2308         Content extensions may mutate the extension stylesheet in the middle of a style resolution as a result of
2309         the legacy animation code triggering a resource load.
2310
2311         Test: http/tests/contentextensions/css-display-none-keyframe.html
2312
2313         * style/StyleScope.cpp:
2314         (WebCore::Style::Scope::scheduleUpdate):
2315
2316         Avoid clearing the style resolver if we are in the middle of a style resolution.
2317         A better fix that avoid doing this in the first place is tracked by https://bugs.webkit.org/show_bug.cgi?id=194335.
2318
2319 2019-02-06  Pablo Saavedra  <psaavedra@igalia.com>
2320
2321         Build failure after r240315
2322         https://bugs.webkit.org/show_bug.cgi?id=194341
2323
2324         Reviewed by Wenson Hsieh.
2325
2326         * bindings/js/JSUndoItemCustom.cpp:
2327         (WebCore::JSUndoItemOwner::isReachableFromOpaqueRoots):
2328
2329 2019-02-05  Ryosuke Niwa  <rniwa@webkit.org>
2330
2331         REGRESSION (r240909): Release assert in FrameLoader::loadURL when navigating with a non-existent target name
2332         https://bugs.webkit.org/show_bug.cgi?id=194329
2333
2334         Reviewed by Geoffrey Garen.
2335
2336         The bug was caused by the code path for when navigating with a specific target frame name that does not exist
2337         never setting the load type of PolicyChecker. As a result, we would use whatever load type used in the previous
2338         navigation, resulting in this release assertion.
2339
2340         Updating the load type here should in theory fix the underlying bug r240909 was meant to catch & fix.
2341
2342         Test: fast/loader/navigate-with-new-target-after-back-forward-navigation.html
2343
2344         * loader/FrameLoader.cpp:
2345         (WebCore::FrameLoader::loadURL):
2346
2347 2019-02-05  Claudio Saavedra  <csaavedra@igalia.com>
2348
2349         [FreeType] Build fix for Debian stable
2350
2351         Unreviewed build fix.
2352
2353         Debian stable currently has a version of fontconfig that doesn't
2354         yet have FC_COLOR. #ifdef its use to fix the build.
2355
2356         * platform/graphics/freetype/FontCacheFreeType.cpp:
2357         (WebCore::FontCache::systemFallbackForCharacters):
2358
2359 2019-02-05  Alex Christensen  <achristensen@webkit.org>
2360
2361         Stop using blobRegistry in NetworkProcess
2362         https://bugs.webkit.org/show_bug.cgi?id=194027
2363
2364         Reviewed by Youenn Fablet.
2365
2366         Also stop using NetworkBlobRegistry::singleton.
2367         Instead, have the NetworkProcess own a NetworkBlobRegistry which owns a BlobRegistryImpl.
2368         We now have to resolve all blob file references while we still have a
2369         NetworkConnectionToWebProcess/NetworkProcess/NetworkBlobRegistry/BlobRegistryImpl instead of
2370         using the singleton after we have passed everything to the loading code, but it works the same
2371         as it did before.  We must consume the sandbox extension from the BlobRegistryImpl before using
2372         the resolved files, so I pass around a Vector<RefPtr<WebCore::BlobDataFileReference>> so we know
2373         which extensions to revoke.
2374
2375         * platform/network/BlobRegistryImpl.h:
2376         * platform/network/FormData.cpp:
2377         (WebCore::appendBlobResolved):
2378         (WebCore::FormData::resolveBlobReferences):
2379         * platform/network/FormData.h:
2380         * platform/network/cf/FormDataStreamCFNet.cpp:
2381         (WebCore::createHTTPBodyCFReadStream):
2382         * platform/network/curl/CurlFormDataStream.cpp:
2383         (WebCore::CurlFormDataStream::CurlFormDataStream):
2384
2385 2019-02-05  Truitt Savell  <tsavell@apple.com>
2386
2387         Unreviewed, rolling out r240984.
2388
2389         Revision casued two API timeouts
2390
2391         Reverted changeset:
2392
2393         "Stop using blobRegistry in NetworkProcess"
2394         https://bugs.webkit.org/show_bug.cgi?id=194027
2395         https://trac.webkit.org/changeset/240984
2396
2397 2019-02-05  Keith Rollin  <krollin@apple.com>
2398
2399         Enable the automatic checking and regenerations of .xcfilelists during builds
2400         https://bugs.webkit.org/show_bug.cgi?id=194124
2401         <rdar://problem/47721277>
2402
2403         Reviewed by Tim Horton.
2404
2405         Bug 193790 add a facility for checking -- during build time -- that
2406         any needed .xcfilelist files are up-to-date and for updating them if
2407         they are not. This facility was initially opt-in by setting
2408         WK_ENABLE_CHECK_XCFILELISTS until other pieces were in place and until
2409         the process seemed robust. Its now time to enable this facility and
2410         make it opt-out. If there is a need to disable this facility, set and
2411         export WK_DISABLE_CHECK_XCFILELISTS=1 in your environment before
2412         running `make` or `build-webkit`, or before running Xcode from the
2413         command line.
2414
2415         Additionally, remove the step that generates a list of source files
2416         going into the UnifiedSources build step. It's only necessarily to
2417         specify Sources.txt and SourcesCocoa.txt as inputs.
2418
2419         No new tests since there should be no observable behavior difference.
2420
2421         * UnifiedSources-input.xcfilelist: Removed.
2422         * WebCore.xcodeproj/project.pbxproj:
2423
2424 2019-02-05  Keith Rollin  <krollin@apple.com>
2425
2426         Update .xcfilelist files
2427         https://bugs.webkit.org/show_bug.cgi?id=194121
2428         <rdar://problem/47720863>
2429
2430         Reviewed by Tim Horton.
2431
2432         Preparatory to enabling the facility for automatically updating the
2433         .xcfilelist files, check in a freshly-updated set so that not everyone
2434         runs up against having to regenerate them themselves.
2435
2436         No new tests since there should be no observable behavior difference.
2437
2438         * DerivedSources-input.xcfilelist:
2439         * DerivedSources-output.xcfilelist:
2440
2441 2019-02-05  Alex Christensen  <achristensen@webkit.org>
2442
2443         Stop using blobRegistry in NetworkProcess
2444         https://bugs.webkit.org/show_bug.cgi?id=194027
2445
2446         Reviewed by Youenn Fablet.
2447
2448         Also stop using NetworkBlobRegistry::singleton.
2449         Instead, have the NetworkProcess own a NetworkBlobRegistry which owns a BlobRegistryImpl.
2450         We now have to resolve all blob file references while we still have a
2451         NetworkConnectionToWebProcess/NetworkProcess/NetworkBlobRegistry/BlobRegistryImpl instead of
2452         using the singleton after we have passed everything to the loading code, but it works the same
2453         as it did before.  We must consume the sandbox extension from the BlobRegistryImpl before using
2454         the resolved files, so I pass around a Vector<RefPtr<WebCore::BlobDataFileReference>> so we know
2455         which extensions to revoke.
2456
2457         * platform/network/BlobRegistryImpl.h:
2458         * platform/network/FormData.cpp:
2459         (WebCore::appendBlobResolved):
2460         (WebCore::FormData::resolveBlobReferences):
2461         * platform/network/FormData.h:
2462         * platform/network/cf/FormDataStreamCFNet.cpp:
2463         (WebCore::createHTTPBodyCFReadStream):
2464         * platform/network/curl/CurlFormDataStream.cpp:
2465         (WebCore::CurlFormDataStream::CurlFormDataStream):
2466
2467 2019-02-05  Ryan Haddad  <ryanhaddad@apple.com>
2468
2469         Unreviewed, rolling out r240742.
2470
2471         Causes crashes on iOS simulator.
2472
2473         Reverted changeset:
2474
2475         "[iOS] Keyups for non-modifier keys identified as "Dead" when
2476         not focused in a content-editable element"
2477         https://bugs.webkit.org/show_bug.cgi?id=192824
2478         https://trac.webkit.org/changeset/240742
2479
2480 2019-02-05  Zalan Bujtas  <zalan@apple.com>
2481
2482         [LFC][IFC] collectInlineContent should use pre-computed margins, paddings and borders
2483         https://bugs.webkit.org/show_bug.cgi?id=194269
2484
2485         Reviewed by Antti Koivisto.
2486
2487         In this patch we pre-compute the margins padding and borders for formatting context roots, replaced boxes and non-replaced containers.
2488         These property values are input to collectInlineContent's inline item detaching logic.
2489
2490         * layout/inlineformatting/InlineFormattingContext.cpp:
2491         (WebCore::Layout::nextInPreOrder):
2492         (WebCore::Layout::InlineFormattingContext::layout const):
2493         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const):
2494         (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
2495         * layout/inlineformatting/InlineFormattingContext.h:
2496         * layout/layouttree/LayoutBox.h: ran out bits. 
2497
2498 2019-02-05  Antoine Quint  <graouts@apple.com>
2499
2500         REGRESSION (r240579): com.apple.WebKit.WebContent at WebCore: WebCore::Document::absoluteEventRegionForNode
2501         https://bugs.webkit.org/show_bug.cgi?id=194284
2502         <rdar://problem/47774298>
2503
2504         Reviewed by Antti Koivisto.
2505
2506         The m_touchActionElements list needs to be HashSet<RefPtr<Element>> instead of HashSet<Element*>. It was initially storing raw pointers based on m_touchEventTargets
2507         which is an EventTargetSet (typedef’d to HashCountedSet<Node*>), but that's because these nodes have an event listener registered for them and as such are kept alive,
2508         whereas elements with a touch-action property aren’t. Elements are removed from this list from Document::nodeWillBeRemoved() and from Document::updateTouchActionElements(),
2509         the latter being called from Style::TreeResolver::resolveElement().
2510
2511         * dom/Document.cpp:
2512         (WebCore::Document::updateTouchActionElements):
2513         * dom/Document.h:
2514         (WebCore::Document::touchActionElements const):
2515
2516 2019-02-05  Benjamin Poulain  <benjamin@webkit.org>
2517
2518         Hit testing functions optimizations
2519         https://bugs.webkit.org/show_bug.cgi?id=194073
2520         <rdar://problem/47692312>
2521
2522         Reviewed by Zalan Bujtas.
2523
2524         This patch implements some easy optimizations that speed up
2525         hit testing without changing the algorithms.
2526
2527         * page/FrameViewLayoutContext.h:
2528         The code for:
2529             view().frameView().layoutContext().isPaintOffsetCacheEnabled()
2530         followed by:
2531             view().frameView().layoutContext().layoutState()
2532         was loading all the intermediate values twice and calling layoutState()
2533         twice.
2534
2535         By marking the function as pure, Clang can CSE the whole thing and
2536         remove the duplicated code.
2537
2538         * platform/graphics/LayoutRect.h:
2539         (WebCore::LayoutRect::isInfinite const):
2540         That one is pretty funny.
2541
2542         Since LayoutRect::isInfinite() was implemented before operator==() is
2543         declared, the compiler was falling back to the implicit convertion to FloatRect()
2544         before doing any comparison.
2545
2546         This explains a bunch of the convertions to float when using LayoutRect.
2547
2548         * rendering/RenderBox.cpp:
2549         (WebCore::RenderBox::mapLocalToContainer const):
2550         Just reoder to make the register nice and clean for the optimization described above.
2551
2552 2019-02-04  Yusuke Suzuki  <ysuzuki@apple.com>
2553
2554         [JSC] Shrink size of VM by lazily allocating IsoSubspaces for non-common types
2555         https://bugs.webkit.org/show_bug.cgi?id=193993
2556
2557         Reviewed by Keith Miller.
2558
2559         * bindings/scripts/CodeGeneratorJS.pm:
2560         (GenerateHeader):
2561         * bridge/runtime_method.h:
2562
2563 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
2564
2565         Move some macOS/iOS scrolling code into the scrolling/cocoa directory
2566         https://bugs.webkit.org/show_bug.cgi?id=194245
2567
2568         Reviewed by Zalan Bujtas.
2569
2570         ScrollingTreeFixedNode and ScrollingTreeStickyNode are used on iOS and macOS, so move them to the cocoa
2571         directory.
2572
2573         Standardize on the ordering of ENABLE(ASYNC_SCROLLING) && PLATFORM(MAC).
2574
2575         Stop building ScrollingThread for iOS (it's never used), and stub out some functions so things build.
2576
2577         * SourcesCocoa.txt:
2578         * WebCore.xcodeproj/project.pbxproj:
2579         * page/scrolling/ScrollingThread.cpp:
2580         (WebCore::ScrollingThread::initializeRunLoop):
2581         (WebCore::ScrollingThread::wakeUpRunLoop):
2582         (WebCore::ScrollingThread::threadRunLoopSourceCallback):
2583         * page/scrolling/cocoa/ScrollingTreeFixedNode.h: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.h.
2584         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm.
2585         * page/scrolling/cocoa/ScrollingTreeStickyNode.h: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.h.
2586         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm: Renamed from Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm.
2587         * page/scrolling/mac/ScrollingThreadMac.mm:
2588         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
2589         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
2590
2591 2019-02-04  Ms2ger  <Ms2ger@igalia.com>
2592
2593         [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI
2594         https://bugs.webkit.org/show_bug.cgi?id=174816
2595
2596         Reviewed by Michael Catanzaro.
2597
2598         Tests: enabled fast/url/user-visible/.
2599
2600         * testing/Internals.cpp:
2601         (WebCore::Internals::userVisibleString): Enable method on all platforms.
2602
2603 2019-02-04  Fujii Hironori  <Hironori.Fujii@sony.com>
2604
2605         [curl] ASSERTION FAILED: !m_didNotifyResponse || m_multipartHandle
2606         https://bugs.webkit.org/show_bug.cgi?id=190895
2607
2608         Reviewed by Ross Kirsling.
2609
2610         An assertion was failing in CurlRequest::invokeDidReceiveResponse
2611         because DidReceiveResponse was already dispatched. This condition
2612         was met if CurlRequestScheduler::completeTransfer is called while
2613         waiting for the reply for the first DidReceiveResponse.
2614
2615         No new tests, covered by existing tests.
2616
2617         * platform/network/curl/CurlRequest.h:
2618         (WebCore::CurlRequest::needToInvokeDidReceiveResponse const):
2619         Return true if m_didNotifyResponse is false disregard to
2620         m_didReturnFromNotify.
2621
2622 2019-02-04  Said Abou-Hallawa  <said@apple.com>
2623
2624         [CG] Enable setAdditionalSupportedImageTypes for WK1
2625         https://bugs.webkit.org/show_bug.cgi?id=194190
2626
2627         Reviewed by Tim Horton.
2628
2629         Move the function webCoreStringVectorFromNSStringArray from WebKit to
2630         WebCore so it can be used by both WebKit and WebKitLegacy.
2631
2632         * platform/mac/StringUtilities.h:
2633         * platform/mac/StringUtilities.mm:
2634         (WebCore::webCoreStringVectorFromNSStringArray):
2635
2636 2019-02-04  Justin Fan  <justin_fan@apple.com>
2637
2638         [Web GPU] Code clean-up for RenderPipeline backend
2639         https://bugs.webkit.org/show_bug.cgi?id=194238
2640
2641         Reviewed by Dean Jackson.
2642
2643         Replace dot syntax setters with calls to setter methods, and remove unnecessary setter calls for 
2644         the input state's descriptor arrays.
2645
2646         Covered by existing tests; no change in behavior.
2647
2648         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
2649         (WebCore::tryCreateMtlDepthStencilState): Refactor to use implicit setters rather than dot syntax.
2650         (WebCore::setInputStateForPipelineDescriptor): Ditto, and remove unnecessary setter calls on array objects.
2651
2652 2019-02-04  Benjamin Poulain  <benjamin@webkit.org>
2653
2654         Use deferrable timer to restart the Responsiveness Timer on each wheel event
2655         https://bugs.webkit.org/show_bug.cgi?id=194135
2656         <rdar://problem/47724099>
2657
2658         Reviewed by Simon Fraser.
2659
2660         The original DeferrableOneShotTimer was not really deferrable.
2661         What it allows is to restart the count down from scratch after
2662         firing.
2663
2664         For this optimization, I want to keep the correct timing but avoid
2665         starting a real timer every time.
2666
2667         I renamed DeferrableOneShotTimer to ResettableOneShotTimer and
2668         created a real DeferrableOneShotTimer that support deadlines.
2669
2670         * css/CSSImageGeneratorValue.cpp:
2671         * html/HTMLPlugInImageElement.h:
2672         * loader/cache/CachedResource.h:
2673         * platform/Timer.cpp:
2674         (WebCore::DeferrableOneShotTimer::startOneShot):
2675         (WebCore::DeferrableOneShotTimer::fired):
2676         * platform/Timer.h:
2677         (WebCore::TimerBase::nextFireTime const):
2678         (WebCore::ResettableOneShotTimer::ResettableOneShotTimer):
2679         (WebCore::DeferrableOneShotTimer::DeferrableOneShotTimer):
2680         (WebCore::DeferrableOneShotTimer::stop):
2681         (WebCore::DeferrableOneShotTimer::restart): Deleted.
2682         * platform/graphics/ca/TileController.h:
2683         * platform/graphics/cg/SubimageCacheWithTimer.h:
2684
2685 2019-02-04  Antoine Quint  <graouts@apple.com>
2686
2687         Use constants for pointer types
2688         https://bugs.webkit.org/show_bug.cgi?id=194232
2689
2690         Reviewed by Dean Jackson.
2691
2692         We cannot use an enum for the pointer type since a custom pointer type can be created by developers when creating a
2693         pointer event using JavaScript, but we can at least used string constants for the ones created internally.
2694
2695         * dom/PointerEvent.cpp:
2696         (WebCore::PointerEvent::mousePointerType):
2697         (WebCore::PointerEvent::penPointerType):
2698         (WebCore::PointerEvent::touchPointerType):
2699         * dom/PointerEvent.h:
2700         * dom/ios/PointerEventIOS.cpp:
2701
2702 2019-02-04  Zalan Bujtas  <zalan@apple.com>
2703
2704         [First paint] Adjust "finishedParsingMainDocument" flag by taking deferred and async scripts into account.
2705         https://bugs.webkit.org/show_bug.cgi?id=194168
2706
2707         Reviewed by Simon Fraser.
2708
2709         First paint should not be blocked by async or deferred scripts.
2710
2711         * page/FrameView.cpp:
2712         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const):
2713
2714 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
2715
2716         Async overflow scroll with border-radius renders incorrectly
2717         https://bugs.webkit.org/show_bug.cgi?id=194205
2718         <rdar://problem/47771668>
2719
2720         Reviewed by Zalan Bujtas.
2721
2722         When an element has composited overflow:scroll and border-radius, we need to make a layer
2723         to clip to the inside of the border radius if necessary.
2724
2725         Existing code simply turned off needsDescendantsClippingLayer for composited scrolling
2726         layers, but now we check to see if the inner border is rounded. If we have both a m_childContainmentLayer
2727         and scrolling layers, we need to adjust the location of the scrolling layers (which are parented
2728         in m_childContainmentLayer).
2729
2730         Also fix offsetFromRenderer for these layers; it's positive for layers inset from the top left
2731         of the border box.
2732
2733         Tests: compositing/clipping/border-radius-async-overflow-clipping-layer.html
2734                compositing/clipping/border-radius-async-overflow-non-stacking.html
2735                compositing/clipping/border-radius-async-overflow-stacking.html
2736
2737         * rendering/RenderLayerBacking.cpp:
2738         (WebCore::RenderLayerBacking::updateConfiguration):
2739         (WebCore::RenderLayerBacking::updateGeometry):
2740         (WebCore::RenderLayerBacking::updateChildClippingStrategy): Layout is always up-to-date now, so remove the comment.
2741
2742 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
2743
2744         PageOverlayController's layers should be created lazily
2745         https://bugs.webkit.org/show_bug.cgi?id=194199
2746
2747         Reviewed by Tim Horton.
2748
2749         Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays()
2750         and use them to only parent the overlay-hosting layers when necessary.
2751
2752         For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can
2753         simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(),
2754         which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer
2755         compositing updates that parents the layerWithDocumentOverlays().
2756
2757         View overlays are added to the layer tree via the DrawingArea. When we go between having
2758         none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer()
2759         on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a
2760         compositing flush (this has to be done manually because view overlay layers are outside the
2761         subtree managed by RenderLayerCompositor).
2762         
2763         Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer;
2764         there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view
2765         overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without
2766         having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer().
2767
2768         * loader/EmptyClients.h:
2769         * page/ChromeClient.h:
2770         * page/FrameView.cpp:
2771         (WebCore::FrameView::setNeedsCompositingConfigurationUpdate): These functions need to schedule a compositing flush
2772         because there may be nothing else that does.
2773         (WebCore::FrameView::setNeedsCompositingGeometryUpdate):
2774         * page/Page.cpp:
2775         (WebCore::Page::installedPageOverlaysChanged):
2776         * page/Page.h:
2777         * page/PageOverlayController.cpp:
2778         (WebCore::PageOverlayController::hasDocumentOverlays const):
2779         (WebCore::PageOverlayController::hasViewOverlays const):
2780         (WebCore::PageOverlayController::attachViewOverlayLayers): PageOverlayController has the Page so it
2781         might as well be the one to call through the ChromeClient.
2782         (WebCore::PageOverlayController::detachViewOverlayLayers):
2783         (WebCore::PageOverlayController::installPageOverlay):
2784         (WebCore::PageOverlayController::uninstallPageOverlay):
2785         * page/PageOverlayController.h:
2786         * rendering/RenderLayerCompositor.cpp:
2787         (WebCore::RenderLayerCompositor::updateCompositingLayers): isFullUpdate is always true; remove it.
2788         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
2789         (WebCore::RenderLayerCompositor::attachRootLayer):
2790         (WebCore::RenderLayerCompositor::detachRootLayer):
2791
2792 2019-02-04  Eric Liang  <ericliang@apple.com>
2793
2794         When performing Increment or Decrement on sliders, check to see if the slider is disabled.
2795         https://bugs.webkit.org/show_bug.cgi?id=173497
2796
2797         Reviewed by Chris Fleizach.
2798
2799         Test: accessibility/set-value-not-work-for-disabled-sliders.html
2800
2801         * accessibility/AccessibilityNodeObject.cpp:
2802         (WebCore::AccessibilityNodeObject::alterSliderValue):
2803
2804 2019-02-04  Sihui Liu  <sihui_liu@apple.com>
2805
2806         IndexedDB: leak WebIDBConnectionToServer in layout tests
2807         https://bugs.webkit.org/show_bug.cgi?id=193688
2808         <rdar://problem/47353263>
2809
2810         Reviewed by Geoffrey Garen.
2811
2812         Let IDBConnectionToServer keep a WeakPtr of IDBConnectionToServerDelegate.
2813
2814         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2815         (WebCore::IDBClient::IDBConnectionToServer::IDBConnectionToServer):
2816         * Modules/indexeddb/client/IDBConnectionToServer.h:
2817         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
2818
2819 2019-02-04  Youenn Fablet  <youenn@apple.com>
2820
2821         Make sure to remove the device observer in AVVideoCaptureSource
2822         https://bugs.webkit.org/show_bug.cgi?id=194181
2823         <rdar://problem/47739247>
2824
2825         Reviewed by Eric Carlson.
2826
2827         Make sure to remove the device observer when the observer is destroyed.
2828         To simplify things, add the observer in AVVideoCaptureSource constructor and remove it in the destructor.
2829
2830         Make also sure the session observer is also removed whenever the session is released by AVVideoCaptureSource.
2831
2832         Covered by manual test.
2833
2834        * platform/mediastream/mac/AVVideoCaptureSource.h:
2835         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2836         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
2837         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
2838         (WebCore::AVVideoCaptureSource::initializeSession):
2839         (WebCore::AVVideoCaptureSource::clearSession):
2840         (WebCore::AVVideoCaptureSource::stopProducingData):
2841         (WebCore::AVVideoCaptureSource::setupSession):
2842
2843 2019-02-04  Antoine Quint  <graouts@apple.com>
2844
2845         Use a dedicated type instead of int32_t for pointer identifiers
2846         https://bugs.webkit.org/show_bug.cgi?id=194217
2847
2848         Reviewed by Antti Koivisto.
2849
2850         * WebCore.xcodeproj/project.pbxproj:
2851         * dom/PointerEvent.h:
2852         * dom/PointerID.h: Added.
2853         * page/PointerCaptureController.cpp:
2854         (WebCore::PointerCaptureController::setPointerCapture):
2855         (WebCore::PointerCaptureController::releasePointerCapture):
2856         (WebCore::PointerCaptureController::hasPointerCapture):
2857         (WebCore::PointerCaptureController::touchEndedOrWasCancelledForIdentifier):
2858         (WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier):
2859         (WebCore::PointerCaptureController::cancelPointer):
2860         * page/PointerCaptureController.h:
2861
2862 2019-02-04  Wenson Hsieh  <wenson_hsieh@apple.com>
2863
2864         [iOS] Unable to make a selection in jsfiddle.net using arrow keys when requesting desktop site
2865         Followup to https://bugs.webkit.org/show_bug.cgi?id=193758
2866
2867         Reviewed by Daniel Bates.
2868
2869         Put the iOS-specific behavior behind an EditingBehavior check, rather than a compile-time guard. No change in
2870         behavior.
2871
2872         * editing/EditingBehavior.h:
2873         (WebCore::EditingBehavior::shouldMoveSelectionToEndWhenFocusingTextInput const):
2874         * html/HTMLInputElement.cpp:
2875         (WebCore::HTMLInputElement::setDefaultSelectionAfterFocus):
2876
2877 2019-02-04  Zalan Bujtas  <zalan@apple.com>
2878
2879         [LFC][IFC] Make InlineFormattingContext::collectInlineContent non-recursive.
2880         https://bugs.webkit.org/show_bug.cgi?id=194210
2881
2882         Reviewed by Antti Koivisto.
2883
2884         Use iterative algorithm to collect inline content (and add breaking rules).
2885         This is in preparation for fixing the inline preferred width computation.  
2886
2887         * layout/Verification.cpp:
2888         (WebCore::Layout::resolveForRelativePositionIfNeeded):
2889         * layout/inlineformatting/InlineFormattingContext.cpp:
2890         (WebCore::Layout::addDetachingRules):
2891         (WebCore::Layout::createAndAppendInlineItem):
2892         (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
2893         (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const): Deleted.
2894         * layout/inlineformatting/InlineFormattingContext.h:
2895
2896 2019-02-04  Michael Catanzaro  <mcatanzaro@igalia.com>
2897
2898         Unreviewed, fix unused variable warnings introduced in r240912
2899         https://bugs.webkit.org/show_bug.cgi?id=194198
2900         <rdar://problem/47776051>
2901
2902         * page/FrameView.cpp:
2903         (WebCore::FrameView::setNeedsCompositingConfigurationUpdate):
2904         (WebCore::FrameView::setNeedsCompositingGeometryUpdate):
2905
2906 2019-02-04  Frederic Wang  <fwang@igalia.com>
2907
2908         [css-scroll-snap] scroll-snap-align not honored on child with non-visible overflow
2909         https://bugs.webkit.org/show_bug.cgi?id=191816
2910
2911         Reviewed by Wenson Hsieh.
2912
2913         This patch fixes a bug that prevents children of a scroll container to create snap positions
2914         when they have non-visible overflow. This happens because for such a child, the function
2915         RenderBox::findEnclosingScrollableContainer() will return the child itself rather than the
2916         scroll container. To address that issue, we introduce a new
2917         RenderObject::enclosingScrollableContainerForSnapping() helper function that ensures that
2918         a real RenderBox ancestor is returned.
2919
2920         Test: css3/scroll-snap/scroll-snap-children-with-overflow.html
2921
2922         * page/scrolling/AxisScrollSnapOffsets.cpp:
2923         (WebCore::updateSnapOffsetsForScrollableArea): Use enclosingScrollableContainerForSnapping()
2924         so that we don't skip children with non-visible overflow.
2925         * rendering/RenderLayerModelObject.cpp:
2926         (WebCore::RenderLayerModelObject::styleDidChange): Ditto. The new function calls
2927         enclosingBox().
2928         * rendering/RenderObject.cpp:
2929         (WebCore::RenderObject::enclosingScrollableContainerForSnapping const): Return
2930         the scrollable container of the enclosing box. If it is actually the render object itself
2931         then start the search from the parent box instead.
2932         * rendering/RenderObject.h: Declare enclosingScrollableContainerForSnapping(). 
2933
2934 2019-02-04  Antti Koivisto  <antti@apple.com>
2935
2936         Rename GraphicsLayer and PlatformCALayer scrolling layer type enum values to be less ambiguous
2937         https://bugs.webkit.org/show_bug.cgi?id=194215
2938
2939         Reviewed by Frédéric Wang.
2940
2941         GraphicsLayer::Type::Scrolling -> GraphicsLayer::Type::ScrollContainer
2942         PlatformCALayer::LayerTypeScrollingLayer -> PlatformCALayer::LayerTypeScrollContainerLayer
2943
2944         * platform/graphics/GraphicsLayer.cpp:
2945         (WebCore::GraphicsLayer::supportsLayerType):
2946         * platform/graphics/GraphicsLayer.h:
2947         * platform/graphics/ca/GraphicsLayerCA.cpp:
2948         (WebCore::GraphicsLayer::supportsLayerType):
2949         (WebCore::GraphicsLayerCA::initialize):
2950         * platform/graphics/ca/PlatformCALayer.cpp:
2951         (WebCore::operator<<):
2952         * platform/graphics/ca/PlatformCALayer.h:
2953         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2954         (WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa):
2955         (WebCore::PlatformCALayerCocoa::commonInit):
2956         * rendering/RenderLayerBacking.cpp:
2957         (WebCore::RenderLayerBacking::updateScrollingLayers):
2958         * rendering/RenderLayerCompositor.cpp:
2959         (WebCore::RenderLayerCompositor::ensureRootLayer):
2960
2961 2019-02-03  Antti Koivisto  <antti@apple.com>
2962
2963         [iOS] Tiles not created in large scrollable iframes
2964         https://bugs.webkit.org/show_bug.cgi?id=193665
2965
2966         Reviewed by Simon Fraser.
2967
2968         We are not syncing scroll position back to the graphics layer tree correctly.
2969
2970         Test by Frédéric Wang.
2971
2972         * page/scrolling/AsyncScrollingCoordinator.cpp:
2973         (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
2974         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
2975         (WebCore::AsyncScrollingCoordinator::reconcileScrollPosition):
2976
2977         Factor setting and syncing scrolling layer positions into a function.
2978         Use bounds.origin scrolling mechanic when scrollContainerLayer is present.
2979
2980         (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
2981         (WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons):
2982         (WebCore::AsyncScrollingCoordinator::updateScrollLayerPosition): Deleted.
2983         * page/scrolling/AsyncScrollingCoordinator.h:
2984         * page/scrolling/ScrollingCoordinator.cpp:
2985         (WebCore::ScrollingCoordinator::scrollContainerLayerForFrameView):
2986         (WebCore::ScrollingCoordinator::scrolledContentsLayerForFrameView):
2987         (WebCore::ScrollingCoordinator::scrollLayerForFrameView): Deleted.
2988         * page/scrolling/ScrollingCoordinator.h:
2989         * rendering/RenderLayerCompositor.cpp:
2990
2991         Rename scrollLayer to scrolledContentsLayer according to out preferred naming scheme and use it in that role only.
2992         Add scrollContainerLayer as a separate layer. It is only constructed when using async scrolling on iOS.
2993
2994         (WebCore::RenderLayerCompositor::~RenderLayerCompositor):
2995         (WebCore::RenderLayerCompositor::customPositionForVisibleRectComputation const):
2996         (WebCore::RenderLayerCompositor::visibleRectForLayerFlushing const):
2997         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
2998         (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
2999         (WebCore::RenderLayerCompositor::updateScrollLayerPosition):
3000         (WebCore::RenderLayerCompositor::frameViewDidScroll):
3001         (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea):
3002         (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea):
3003         (WebCore::RenderLayerCompositor::updateLayerForHeader):
3004         (WebCore::RenderLayerCompositor::updateLayerForFooter):
3005         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
3006         (WebCore::RenderLayerCompositor::ensureRootLayer):
3007         (WebCore::RenderLayerCompositor::destroyRootLayer):
3008         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
3009         * rendering/RenderLayerCompositor.h:
3010
3011 2019-02-03  Simon Fraser  <simon.fraser@apple.com>
3012
3013         Make setNeedsLayout on the root more explicitly about triggering its side-effects
3014         https://bugs.webkit.org/show_bug.cgi?id=194198
3015
3016         Reviewed by Antti Koivisto.
3017
3018         Calling setNeedsLayout() on the FrameView or RenderView is an odd concept; the render tree
3019         generally manages its own dirty state.
3020
3021         Most callers of setNeedsLayout() on the root are really trying to trigger the side-effects
3022         of layout, like compositing updates, which are required when view configuration state, like
3023         headers, footers and transparency, change. These dependencies are currently implicit and
3024         poorly defined.
3025
3026         Renaming "setNeedsLayout" on FrameView is a step towards being more explicit about pure
3027         rendering updates, vs updates of downstream data strutures like compositing. It's now called
3028         setNeedsLayoutAfterViewConfigurationChange(). In addition, expose
3029         setNeedsCompositingConfigurationUpdate() and setNeedsCompositingGeometryUpdate() so callers
3030         can trigger the appropriate types of compositing updates on the root layer.
3031
3032         In addition, FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange() schedules a
3033         layout. Withtout this, some callers would dirty the RenderView's layout but rely on some
3034         other trigger to make the layout happen.
3035
3036         This cleanup was prompted by noticing that FrameView::setHeaderHeight() dirtied layout
3037         but never scheduled it, making banner insertion in MiniBrowser unreliable.
3038
3039         This patch also removes the aliasing of headerHeight/footerHeight between Page and
3040         FrameView. Banners are a property of Page, so FrameView fetches the banner heights
3041         from Page.
3042
3043         * page/FrameView.cpp:
3044         (WebCore::FrameView::headerHeight const):
3045         (WebCore::FrameView::footerHeight const):
3046         (WebCore::FrameView::availableContentSizeChanged):
3047         (WebCore::FrameView::setNeedsLayoutAfterViewConfigurationChange):
3048         (WebCore::FrameView::setNeedsCompositingConfigurationUpdate):
3049         (WebCore::FrameView::setNeedsCompositingGeometryUpdate):
3050         (WebCore::FrameView::scheduleSelectionUpdate):
3051         (WebCore::FrameView::setTransparent):
3052         (WebCore::FrameView::setBaseBackgroundColor):
3053         (WebCore::FrameView::setAutoSizeFixedMinimumHeight):
3054         (WebCore::FrameView::enableAutoSizeMode):
3055         (WebCore::FrameView::setHeaderHeight): Deleted.
3056         (WebCore::FrameView::setFooterHeight): Deleted.
3057         (WebCore::FrameView::setNeedsLayout): Deleted.
3058         * page/FrameView.h:
3059         * page/FrameViewLayoutContext.cpp:
3060         (WebCore::FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange):
3061         (WebCore::FrameViewLayoutContext::setNeedsLayout): Deleted.
3062         * page/FrameViewLayoutContext.h:
3063         * page/Page.cpp:
3064         (WebCore::Page::setPageScaleFactor):
3065         (WebCore::Page::setHeaderHeight):
3066         (WebCore::Page::setFooterHeight):
3067         (WebCore::Page::addHeaderWithHeight): Deleted.
3068         (WebCore::Page::addFooterWithHeight): Deleted.
3069         * page/Page.h:
3070         * rendering/RenderLayerCompositor.cpp:
3071         (WebCore::RenderLayerCompositor::updateBacking):
3072         * testing/Internals.cpp:
3073         (WebCore::Internals::resetToConsistentState):
3074         (WebCore::Internals::setHeaderHeight):
3075         (WebCore::Internals::setFooterHeight):
3076
3077 2019-02-03  John Wilander  <wilander@apple.com>
3078
3079         Parse and handle Ad Click Attribution attributes in HTMLAnchorElement::handleClick()
3080         https://bugs.webkit.org/show_bug.cgi?id=194104
3081         <rdar://problem/47649991>
3082
3083         Reviewed by Chris Dumez, Daniel Bates, and Darin Adler.
3084
3085         Test: http/tests/adClickAttribution/anchor-tag-attributes-validation.html
3086
3087         This patch adds parsing and validation of the two new Ad Click Attribution
3088         attributes in anchor elements: adcampaignid and addestination. The data is
3089         not yet forwarded into the loader.
3090
3091         * html/HTMLAnchorElement.cpp:
3092         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
3093         (WebCore::HTMLAnchorElement::handleClick):
3094             Now calls HTMLAnchorElement::parseAdClickAttribution().
3095         * html/HTMLAnchorElement.h:
3096         * loader/AdClickAttribution.h:
3097             Made WebCore::AdClickAttribution copyable since it's needed to have it be
3098             WTF::Optional. Also made AdClickAttribution::MaxEntropy public. Changed
3099             numeric types from unsigned short to uint32_t.
3100         (WebCore::AdClickAttribution::Campaign::isValid const):
3101         (WebCore::AdClickAttribution::Conversion::isValid const):
3102
3103 2019-02-03  Ryosuke Niwa  <rniwa@webkit.org>
3104
3105         Validate navigation policy decisions to avoid crashes in continueLoadAfterNavigationPolicy
3106         https://bugs.webkit.org/show_bug.cgi?id=194189
3107
3108         Reviewed by Geoffrey Garen.
3109
3110         Introduced PolicyCheckIdentifier to pair each navigation policy check request with a decision,
3111         and deployed it in PolicyChecker. The identifier is passed from WebContent process to UI process
3112         in WebKit2, and passed it back with the policy decision.
3113
3114         Because PolicyCheckIdentifier embeds the process identifier from which a navigation policy is checked,
3115         we would be able to detect when UI process had sent the decision to a wrong WebContent process.
3116
3117         This patch also adds release assertions to make sure history().provisionalItem() is set whenever
3118         we're requesting a navigation policy check.
3119
3120         These code changes should either:
3121         1. Fix crashes in FrameLoader::continueLoadAfterNavigationPolicy where isBackForwardLoadType would
3122            return true yet history().provisionalItem() is null.
3123         2. Detect a bug that UI process can send a navigation policy decision to a wrong WebContent process.
3124         3. Rule out the possibility that (2) exists.
3125
3126         * loader/DocumentLoader.cpp:
3127         (WebCore::DocumentLoader::willSendRequest):
3128         (WebCore::DocumentLoader::responseReceived):
3129         * loader/EmptyClients.cpp:
3130         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
3131         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3132         * loader/EmptyFrameLoaderClient.h:
3133         * loader/FrameLoader.cpp:
3134         (WebCore::FrameLoader::checkContentPolicy):
3135         (WebCore::FrameLoader::loadURL):
3136         (WebCore::FrameLoader::load):
3137         (WebCore::FrameLoader::loadWithDocumentLoader):
3138         (WebCore::FrameLoader::loadPostRequest):
3139         * loader/FrameLoader.h:
3140         * loader/FrameLoaderClient.h:
3141         * loader/FrameLoaderTypes.h:
3142         (WebCore::PolicyCheckIdentifier): Added.
3143         (WebCore::PolicyCheckIdentifier::operator== const): Added.
3144         (WebCore::PolicyCheckIdentifier::PolicyCheckIdentifier): Added.
3145         (WebCore::PolicyCheckIdentifier::encode const): Added.
3146         (WebCore::PolicyCheckIdentifier::decode): Added.
3147         * loader/PolicyChecker.cpp:
3148         (WebCore::PolicyCheckIdentifier::generate):
3149         (WebCore::PolicyCheckIdentifier::isValidFor): Returns true if the identifer matches. Also release asserts
3150         that the process ID is same, and that m_check is always not zero (meaning it's a generated value).
3151         The failure of these release assertions would indicate that there is a bug in UI process, which results in
3152         a policy decision response being sent to a wrong Web process.
3153         (WebCore::PolicyChecker::checkNavigationPolicy): Exit early if isValidFor fails.
3154         (WebCore::PolicyChecker::checkNewWindowPolicy):
3155
3156 2019-02-03  Antti Koivisto  <antti@apple.com>
3157
3158         Don't include ScrollCoordinator.h from Element.h
3159         https://bugs.webkit.org/show_bug.cgi?id=194206
3160
3161         Reviewed by Daniel Bates.
3162
3163         * dom/Element.h:
3164
3165 2019-02-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3166
3167         Unable to move selection into editable roots with 0 height
3168         https://bugs.webkit.org/show_bug.cgi?id=194143
3169         <rdar://problem/47767284>
3170
3171         Reviewed by Ryosuke Niwa.
3172
3173         Currently, positions inside editable elements of height 0 are not considered to be candidates when
3174         canonicalizing a position to its visible counterpart. This prevents us from moving the selection into these
3175         editable roots at all. To fix this, we relax this constraint by allowing positions anchored by root editable
3176         elements to be candidates.
3177
3178         Test: editing/selection/insert-text-in-empty-content-editable.html
3179
3180         * dom/Position.cpp:
3181         (WebCore::Position::isCandidate const):
3182
3183 2019-02-03  Simon Fraser  <simon.fraser@apple.com>
3184
3185         Tidyup of Pagination and FrameView m_mediaType initialization
3186         https://bugs.webkit.org/show_bug.cgi?id=194203
3187
3188         Reviewed by Darin Adler.
3189
3190         Fix post-commit feedback on lines around code changed in r240901.
3191
3192         * page/FrameView.cpp:
3193         (WebCore::FrameView::FrameView):
3194         * page/FrameView.h:
3195         * rendering/Pagination.h:
3196         (WebCore::Pagination::operator!= const):
3197
3198 2019-02-03  Megan Gardner  <megan_gardner@apple.com>
3199
3200         Turn on Smart Paste
3201         https://bugs.webkit.org/show_bug.cgi?id=193786
3202
3203         Reviewed by Ryosuke Niwa.
3204
3205         Turned on a modified tests:
3206         LayoutTests/editing/pasteboard/smart-paste-001.html
3207         LayoutTests/editing/pasteboard/smart-paste-002.html
3208         LayoutTests/editing/pasteboard/smart-paste-003.html
3209         LayoutTests/editing/pasteboard/smart-paste-004.html
3210         LayoutTests/editing/pasteboard/smart-paste-005.html
3211         LayoutTests/editing/pasteboard/smart-paste-006.html
3212         LayoutTests/editing/pasteboard/smart-paste-007.html
3213         LayoutTests/editing/pasteboard/smart-paste-008.html
3214
3215         * platform/ios/PasteboardIOS.mm:
3216         (WebCore::Pasteboard::canSmartReplace):
3217         Turn on smart replace.
3218
3219 2019-02-02  Simon Fraser  <simon.fraser@apple.com>
3220
3221         Tidy up data memebers of FrameView and related classes to shrink class sizes
3222         https://bugs.webkit.org/show_bug.cgi?id=194197
3223
3224         Reviewed by Zalan Bujtas.
3225
3226         Make various enums 8-bit. Re-order data members of FrameView, FrameViewLayoutContext, Widget
3227         and ScrollView to optimize padding.
3228
3229         Use more data member initializers.
3230
3231         This shrinks FrameView from 1168 (144 padding bytes) to 1096 (96 padding bytes).
3232
3233         * dom/Element.h:
3234         * page/FrameView.cpp:
3235         (WebCore::FrameView::FrameView):
3236         * page/FrameView.h:
3237         * page/FrameViewLayoutContext.h:
3238         * platform/ScrollTypes.h:
3239         * platform/ScrollView.h: Data members should come after member functions.
3240         * platform/Widget.h:
3241         * rendering/Pagination.h:
3242         (WebCore::Pagination::Pagination): Deleted.
3243
3244 2019-02-02  Simon Fraser  <simon.fraser@apple.com>
3245
3246         Rename "scrollingLayer" in RenderLayerBacking to "scrollContainerLayer" for clarity
3247         https://bugs.webkit.org/show_bug.cgi?id=194194
3248
3249         Rubber-stampted by Antti Koivisto.
3250
3251         Our desired terminology is "scrollContainerLayer" for the outer, clipping layer
3252         for scrolling, and "scrolledContentsLayer" for the contents that move when you scroll.
3253
3254         * rendering/RenderLayerBacking.cpp:
3255         (WebCore::RenderLayerBacking::updateDebugIndicators):
3256         (WebCore::RenderLayerBacking::destroyGraphicsLayers):
3257         (WebCore::RenderLayerBacking::updateGeometry):
3258         (WebCore::RenderLayerBacking::setLocationOfScrolledContents):
3259         (WebCore::RenderLayerBacking::updateAfterDescendants):
3260         (WebCore::RenderLayerBacking::updateInternalHierarchy):
3261         (WebCore::RenderLayerBacking::updateDrawsContent):
3262         (WebCore::RenderLayerBacking::updateScrollingLayers):
3263         * rendering/RenderLayerBacking.h:
3264         * rendering/RenderLayerCompositor.cpp:
3265         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
3266         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
3267         (WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers):
3268         (WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer):
3269         (WebCore::LegacyWebKitScrollingLayerCoordinator::unregisterAllScrollingLayers):
3270         (WebCore::LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer):
3271
3272 2019-02-02  Justin Fan  <justin_fan@apple.com>
3273
3274         [Web GPU] Fix GPURenderPassEncoder::setVertexBuffers and allow overlapping indices with GPUBindGroups
3275         https://bugs.webkit.org/show_bug.cgi?id=194125
3276
3277         Reviewed by Myles C. Maxfield.
3278
3279         GPURenderPassEncoder::setVertexBuffers is now actually written to set all buffers provided. In addition,
3280         shift vertex input buffer indices so that any resource bindings can bind vertex buffer resources to the same indices. 
3281
3282         Existing tests cover setVertexBuffers. Updated buffer-resource-triangles to assign bind groups and vertex buffers to the same index.
3283
3284         * Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.cpp: Added.
3285         (WebCore::WHLSL::Metal::calculateVertexBufferIndex): Simple shifting function for vertex input buffer indices.
3286         * Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.h: Added.
3287         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
3288         (WebCore::WebGPUProgrammablePassEncoder::setBindGroup const): Limit maximum bind group indices to 0 to 3.
3289         * Modules/webgpu/WebGPURenderPassEncoder.cpp: 
3290         (WebCore::WebGPURenderPassEncoder::setVertexBuffers): Limit vertex input indices to 0 to 15.
3291         * Modules/webgpu/WebGPURenderPassEncoder.h: Move IDL/bindings bug note to IDL file.
3292         * Modules/webgpu/WebGPURenderPassEncoder.idl: Ditto.
3293         * platform/graphics/gpu/GPULimits.h: Added. Home for Web GPU limits constants shared between files.
3294         * platform/graphics/gpu/GPURenderPassEncoder.h: Change IDL/bindings bug workaround to unsigned long long to prevent narrowing compared to spec.
3295         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
3296         (WebCore::GPURenderPassEncoder::setVertexBuffers): Now properly calls Metal's setVertexBuffers. 
3297         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
3298         (WebCore::setInputStateForPipelineDescriptor): Fix validation checks for vertex attribute numbers and vertex buffer indices. 
3299
3300         Add symbols to project:
3301         * Sources.txt:
3302         * WebCore.xcodeproj/project.pbxproj:
3303
3304 2019-02-01  Simon Fraser  <simon.fraser@apple.com>
3305
3306         Async overflow scroll is jumpy on macOS if the main thread is busy
3307         https://bugs.webkit.org/show_bug.cgi?id=194184
3308         <rdar://problem/47758655>
3309
3310         Reviewed by Antti Koivisto.
3311
3312         This change extends to macOS some existing overflow-scroll functionality for iOS.
3313         When an async scroll is in process in the scroll thread (or UI process), we periodically
3314         message back to the web process main thread with scroll position updates. These
3315         can trigger post-scroll compositing updates, but we need to ensure that this update
3316         doesn't clobber the scroll position of the native layers, which would trigger
3317         stutters.
3318
3319         To do this we have the notion of a scroll position "sync" (ScrollingLayerPositionAction::Sync) which
3320         pokes the new value into the GraphicsLayer (hence making visible rect computations work), but doesn't
3321         propagate it to the platform layer. This patch wires up syncs for macOS during async overflow scrolling,
3322         coming out of AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll().
3323
3324         In RenderLayerBacking, m_scrollingContentsLayer is renamed to m_scrolledContentsLayer, and I added
3325         updateScrollOffset() and setLocationOfScrolledContents() to handle the set vs. sync, and to keep
3326         the iOS vs macOS differences in one function. This allows for more code sharing in RenderLayerBacking::updateGeometry().
3327
3328         There's a confusing bit in the m_childClippingMaskLayer code (trac.webkit.org/178029) where the setOffsetFromRenderer()
3329         just looks wrong; it should match m_scrollingLayer. This code is never hit for Cocoa, which never has m_childClippingMaskLayer.
3330
3331         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
3332         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition): Logging
3333         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): Logging
3334         * rendering/RenderLayer.cpp:
3335         (WebCore::RenderLayer::RenderLayer):
3336         (WebCore::RenderLayer::scrollTo):
3337         * rendering/RenderLayer.h: Rename m_requiresScrollBoundsOriginUpdate to m_requiresScrollPositionReconciliation
3338         and make it available on all platforms. Just reorder m_adjustForIOSCaretWhenScrolling to reduce #ifdef nesting confusion.
3339         * rendering/RenderLayerBacking.cpp:
3340         (WebCore::RenderLayerBacking::updateDebugIndicators):
3341         (WebCore::RenderLayerBacking::destroyGraphicsLayers):
3342         (WebCore::RenderLayerBacking::updateGeometry):
3343         (WebCore::RenderLayerBacking::setLocationOfScrolledContents):
3344         (WebCore::RenderLayerBacking::updateScrollOffset):
3345         (WebCore::RenderLayerBacking::updateDrawsContent):
3346         (WebCore::RenderLayerBacking::updateScrollingLayers):
3347         (WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const):
3348         (WebCore::RenderLayerBacking::parentForSublayers const):
3349         (WebCore::RenderLayerBacking::setContentsNeedDisplay):
3350         (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
3351         (WebCore::RenderLayerBacking::paintContents):
3352         (WebCore::RenderLayerBacking::backingStoreMemoryEstimate const):
3353         * rendering/RenderLayerBacking.h:
3354
3355 2019-02-02  Zalan Bujtas  <zalan@apple.com>
3356
3357         [LFC] Initialize ICB's style with fixed width/height.
3358         https://bugs.webkit.org/show_bug.cgi?id=194188
3359
3360         Reviewed by Antti Koivisto.
3361
3362         Let's set ICB's logical width/height to Fixed so that it's available when we try to resolve a box's height
3363         in FormattingContext::Geometry::computedHeightValue() by using the containing block's height (ICB in this case).
3364
3365         * layout/LayoutState.cpp:
3366         (WebCore::Layout::LayoutState::LayoutState):
3367         * layout/LayoutState.h:
3368         * layout/layouttree/LayoutTreeBuilder.cpp:
3369         (WebCore::Layout::TreeBuilder::createLayoutTree):
3370
3371 2019-02-02  Zalan Bujtas  <zalan@apple.com>
3372
3373         [LFC] Add missing case to out-of-flow non-replaced horizontal used margin value computation
3374         https://bugs.webkit.org/show_bug.cgi?id=194185
3375
3376         Reviewed by Antti Koivisto.
3377
3378         If none of horizontal values (left, right, width, margin-left/right) are auto, then usedHorizontalMarginValues = computedHorizontalMarginValues.
3379
3380         Test: fast/block/block-only/absolute-position-left-right-margin.html
3381
3382         * layout/FormattingContextGeometry.cpp:
3383         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
3384
3385 2018-12-16  Darin Adler  <darin@apple.com>
3386
3387         Convert additional String::format clients to alternative approaches
3388         https://bugs.webkit.org/show_bug.cgi?id=192746
3389
3390         Reviewed by Alexey Proskuryakov.
3391
3392         This round of conversions covers less-trivial cases such as floating
3393         point numerals and hexadecimal. Not yet taking on pointer serialization
3394         ("%p") or padding with spaces of zero digits, so call sites using those
3395         have been left untouched.
3396
3397         In some cases these new idioms are a bit clumsy, and we could follow up
3398         with additional convenience functions to make them more elegant.
3399
3400         * Modules/indexeddb/IDBKeyData.cpp:
3401         (WebCore::IDBKeyData::loggingString const): Use more ASCIILiteral and
3402         more appendLiteral for efficiency. Use upperNibbleToLowercaseASCIIHexDigit,
3403         lowerNibbleToLowercaseASCIIHexDigit, and also makeString and FormattedNumber.
3404
3405         * css/MediaQueryEvaluator.cpp:
3406         (WebCore::aspectRatioValueAsString): Use makeString and FormattedNumber.
3407         Doing it this way makes it a little clearer that we have an unpleasant
3408         use of fixed 6-digit precision here.
3409
3410         * html/FTPDirectoryDocument.cpp:
3411         (WebCore::processFilesizeString): Use makeString and FormattedNumber.
3412         * html/track/VTTCue.cpp:
3413         (WebCore::VTTCueBox::applyCSSProperties): Ditto.
3414         * page/CaptionUserPreferencesMediaAF.cpp:
3415         (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const): Ditto.
3416         * page/History.cpp:
3417         (WebCore::History::stateObjectAdded): Ditto.
3418         * page/cocoa/ResourceUsageOverlayCocoa.mm:
3419         (WebCore::formatByteNumber): Ditto.
3420         (WebCore::gcTimerString): Use String::number.
3421         (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and FormattedNumber.
3422
3423         * page/scrolling/AxisScrollSnapOffsets.cpp:
3424         (WebCore::snapOffsetsToString): Removed some unnecessary copying in the for loop,
3425         use appendLiteral, and use appendFixedWidthNumber.
3426         (WebCore::snapOffsetRangesToString): Ditto.
3427         (WebCore::snapPortOrAreaToString): Use makeString and FormattedNumber.
3428
3429         * platform/animation/TimingFunction.cpp:
3430         (WebCore::TimingFunction::cssText const): Use makeString.
3431
3432         * platform/cocoa/KeyEventCocoa.mm:
3433         (WebCore::keyIdentifierForCharCode): Use makeString and the ASCIIHexDigit
3434         functions.
3435         * platform/graphics/Color.cpp:
3436         (WebCore::Color::nameForRenderTreeAsText const): Ditto.
3437
3438         * platform/mock/MockRealtimeVideoSource.cpp:
3439         (WebCore::MockRealtimeVideoSource::drawText): Use makeString and FormattedNumber.
3440
3441         * platform/text/PlatformLocale.cpp:
3442         (WebCore::DateTimeStringBuilder::visitField): Use String::numberToStringFixedWidth.
3443
3444 2019-02-01  Simon Fraser  <simon.fraser@apple.com>
3445
3446         Remove the unused layerForScrolling()
3447         https://bugs.webkit.org/show_bug.cgi?id=194180
3448
3449         Reviewed by Zalan Bujtas.
3450
3451         Remove ScrollableArea::layerForScrolling() and derivations. This was unused.
3452
3453         * page/FrameView.cpp:
3454         (WebCore::FrameView::layerForScrolling const): Deleted.
3455         * page/FrameView.h:
3456         * page/scrolling/ScrollingCoordinator.cpp:
3457         (WebCore::ScrollingCoordinator::scrollLayerForScrollableArea): Deleted.
3458         * page/scrolling/ScrollingCoordinator.h:
3459         * platform/ScrollableArea.h:
3460         (WebCore::ScrollableArea::layerForScrolling const): Deleted.
3461         * rendering/RenderLayer.cpp:
3462         (WebCore::RenderLayer::calculateClipRects const):
3463         * rendering/RenderLayer.h:
3464
3465 2019-02-01  Zalan Bujtas  <zalan@apple.com>
3466
3467         [LFC] Fix statically positioned replaced out-of-flow horizontal geometry
3468         https://bugs.webkit.org/show_bug.cgi?id=194163
3469
3470         Reviewed by Simon Fraser.
3471
3472         Fix a typo.
3473
3474         * layout/FormattingContextGeometry.cpp:
3475         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
3476
3477 2019-02-01  Chris Dumez  <cdumez@apple.com>
3478
3479         REGRESSION: Flaky ASSERTION FAILED: m_uncommittedState.state == State::Committed on http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
3480         https://bugs.webkit.org/show_bug.cgi?id=193740
3481         <rdar://problem/47527267>
3482
3483         Reviewed by Alex Christensen.
3484
3485         * loader/DocumentLoader.cpp:
3486         (WebCore::DocumentLoader::willSendRequest):
3487         (WebCore::DocumentLoader::continueAfterContentPolicy):
3488         * loader/FrameLoader.cpp:
3489         (WebCore::FrameLoader::loadURL):
3490         (WebCore::FrameLoader::loadWithDocumentLoader):
3491         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
3492         * loader/FrameLoader.h:
3493         * loader/FrameLoaderTypes.h:
3494         * loader/PolicyChecker.cpp:
3495         (WebCore::PolicyChecker::checkNavigationPolicy):
3496         (WebCore::PolicyChecker::checkNewWindowPolicy):
3497         * loader/PolicyChecker.h:
3498
3499 2019-02-01  Antoine Quint  <graouts@apple.com>
3500
3501         Dispatch pointercancel events when content is panned or zoomed on iOS
3502         https://bugs.webkit.org/show_bug.cgi?id=193962
3503         <rdar://problem/47629134>
3504
3505         Reviewed by Dean Jackson.
3506
3507         Expose two new methods on PointerCaptureController so that, given a pointer id, it can be established whether this pointer
3508         has been cancelled, which is important because a cancelled pointer should no longer dispatch any further pointer events, and
3509         to cancel a pointer.
3510
3511         Tests: pointerevents/ios/touch-action-pointercancel-pan-x.html
3512                pointerevents/ios/touch-action-pointercancel-pan-y.html
3513                pointerevents/ios/touch-action-pointercancel-pinch-zoom.html
3514
3515         * WebCore.xcodeproj/project.pbxproj: Make PointerCaptureController.h Private so that it can be imported from WebKit.
3516         * dom/PointerEvent.h: Remove an unnecessary #if ENABLE(POINTER_EVENTS) since the entire file is already contained in one.
3517         Then we add a new create() method that takes an event type, a pointer id and a pointer type (touch vs. pen) that we use
3518         to create pointercancel events in PointerCaptureController::cancelPointer().
3519         * page/Page.cpp:
3520         (WebCore::Page::Page): Pass the Page as a parameter when creating the PointerCaptureController.
3521         * page/PointerCaptureController.cpp:
3522         (WebCore::PointerCaptureController::PointerCaptureController): Add a Page reference to the constructor since we'll need
3523         the page to access its main frame's EventHandler to perform hit testing in case we do not have a capture target override
3524         in cancelPointer().
3525         (WebCore::PointerCaptureController::releasePointerCapture): Drive-by, remove the the implicit parameter since on iOS we
3526         don't need to differentiate. We'll bring this back for the macOS work.
3527         (WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier): New method we'll use when dispatching pointer
3528         events to identify whether a pointer id has already been cancelled which will allow for _not_ dispatching any further
3529         pointer events for this pointer id.
3530         (WebCore::PointerCaptureController::pointerEventWillBeDispatched): Keep track of the pointer type so we can preserve it
3531         when dispatching pointercancel events for a given pointer id.
3532         (WebCore::PointerCaptureController::cancelPointer): Dispatch a pointercancel for the provided pointer id, using the capture
3533         target override as the event's target, if there is one, and otherwise hit-testing at the provided location to figure out
3534         what the target should be.
3535         * page/PointerCaptureController.h: Switch the target overrides from Element* to RefPtr<Element> to ensure it may not be
3536         deleted while we still need them. Existing code already ensures these get set to nullptr.
3537
3538 2019-02-01  Jer Noble  <jer.noble@apple.com>
3539
3540         Make the WebKit default for media source based on the WebCore default.
3541         https://bugs.webkit.org/show_bug.cgi?id=194172
3542
3543         Reviewed by Eric Carlson.
3544
3545         * page/SettingsBase.h:
3546
3547 2019-02-01  Joseph Pecoraro  <pecoraro@apple.com>
3548
3549         Web Inspector: Memory timeline starts from zero when both CPU and Memory timeline are enabled
3550         https://bugs.webkit.org/show_bug.cgi?id=194111
3551         <rdar://problem/47714555>
3552
3553         Rubber-stamped by Devin Rousso.
3554
3555         * page/ResourceUsageThread.cpp:
3556         (WebCore::ResourceUsageThread::waitUntilObservers):
3557         (WebCore::ResourceUsageThread::threadBody):
3558         Wait a short period of time before the first listener registers
3559         and we start sampling. This will allow multiple listeners to
3560         register, each that wants different data.
3561
3562 2019-02-01  Antti Koivisto  <antti@apple.com>
3563
3564         Don't use base layer() as the scroll layer in scrolling tree.
3565         https://bugs.webkit.org/show_bug.cgi?id=194160
3566
3567         Reviewed by Simon Fraser.
3568
3569         Maintain scrollContainerLayer() and scrolledContentsLayer() separately in ScrollingTreeScrollingNode.
3570
3571         * page/scrolling/AsyncScrollingCoordinator.cpp:
3572         (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
3573         (WebCore::AsyncScrollingCoordinator::setNodeLayers):
3574         * page/scrolling/AsyncScrollingCoordinator.h:
3575         * page/scrolling/ScrollingCoordinator.h:
3576         (WebCore::ScrollingCoordinator::setNodeLayers):
3577
3578         Turn the long layer parameter list into a struct.
3579
3580         * page/scrolling/ScrollingStateNode.cpp:
3581         (WebCore::ScrollingStateNode::ScrollingStateNode):
3582         (WebCore::ScrollingStateNode::setAllPropertiesChanged):
3583         (WebCore::ScrollingStateNode::setLayer):
3584         * page/scrolling/ScrollingStateNode.h:
3585         * page/scrolling/ScrollingStateScrollingNode.cpp:
3586         (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
3587         (WebCore::ScrollingStateScrollingNode::setAllPropertiesChanged):
3588         (WebCore::ScrollingStateScrollingNode::setScrollContainerLayer):
3589         (WebCore::ScrollingStateScrollingNode::dumpProperties const):
3590         * page/scrolling/ScrollingStateScrollingNode.h:
3591         (WebCore::ScrollingStateScrollingNode::scrollContainerLayer const):
3592         * page/scrolling/ScrollingTree.cpp:
3593         (WebCore::ScrollingTree::commitTreeState):
3594         * page/scrolling/ScrollingTreeScrollingNode.cpp:
3595         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
3596         * page/scrolling/ScrollingTreeScrollingNode.h:
3597         (WebCore::ScrollingTreeScrollingNode::scrollContainerLayer const):
3598         (WebCore::ScrollingTreeScrollingNode::scrolledContentsLayer const):
3599         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
3600         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
3601         (WebCore::ScrollingTreeFrameScrollingNodeIOS::commitStateBeforeChildren):
3602         (WebCore::ScrollingTreeFrameScrollingNodeIOS::scrollPosition const):
3603         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollLayerPosition):
3604         (WebCore::ScrollingTreeFrameScrollingNodeIOS::scrollLayer const): Deleted.
3605         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
3606         (WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren):
3607         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
3608         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3609         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
3610         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
3611         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const):
3612         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
3613         (WebCore::ScrollingTreeFrameScrollingNodeMac::exposedUnfilledArea const):
3614         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
3615         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
3616         (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateBeforeChildren):
3617         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const):
3618         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition):
3619         * page/scrolling/mac/ScrollingTreeStickyNode.mm:
3620         (WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren):
3621         * rendering/RenderLayerCompositor.cpp:
3622         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
3623         (WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole):
3624         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
3625         (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole):
3626
3627 2019-02-01  Simon Fraser  <simon.fraser@apple.com>
3628
3629         REGRESSION (r240698): fast/scrolling/sticky-to-fixed.html can cause a crash
3630         https://bugs.webkit.org/show_bug.cgi?id=194134
3631         rdar://problem/47721210
3632
3633         Reviewed by Daniel Bates.
3634
3635         fast/scrolling/sticky-to-fixed.html changes the scrolling node type, which causes
3636         scrollingCoordinator->insertNode() to return a different ScrollingNodeID to the one
3637         passed in. We have to handle this, removing the node for the nodeID and unregistering
3638         the layer with the old nodeID.
3639
3640         * rendering/RenderLayerCompositor.cpp:
3641         (WebCore::RenderLayerCompositor::attachScrollingNode):
3642
3643 2019-02-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3644
3645         REGRESSION(r239915): css3/font-feature-font-face-local.html failing on WPE
3646         https://bugs.webkit.org/show_bug.cgi?id=194008
3647
3648         Reviewed by Žan Doberšek.
3649
3650         We need to replace control characters with zero width space too.
3651
3652         * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp:
3653         (WebCore::GlyphPage::fill):
3654         * platform/text/CharacterProperties.h:
3655         (WebCore::isControlCharacter):
3656
3657 2019-02-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3658
3659         ComplexText: Test fast/text/word-space-nbsp.html fails when using complex text path
3660         https://bugs.webkit.org/show_bug.cgi?id=193279
3661
3662         Reviewed by Michael Catanzaro.
3663
3664         The fix applied in r135884 to WidthIterator should also be applied to ComplexTextController.
3665
3666         * platform/graphics/ComplexTextController.cpp:
3667         (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
3668
3669 2019-02-01  Zalan Bujtas  <zalan@apple.com>
3670
3671         [LFC] Adjust replaced element's intrinsic ratio
3672         https://bugs.webkit.org/show_bug.cgi?id=194154
3673
3674         Reviewed by Antti Koivisto.
3675
3676         Decouple image and iframe replaced types and set intrinsic ratio accordingly.
3677
3678         * layout/layouttree/LayoutBox.cpp:
3679         (WebCore::Layout::Box::Box):
3680         * layout/layouttree/LayoutBox.h:
3681         (WebCore::Layout::Box::isReplaced const):
3682         (WebCore::Layout::Box::isIFrame const):
3683         (WebCore::Layout::Box::isImage const):
3684         * layout/layouttree/LayoutReplaced.cpp:
3685         (WebCore::Layout::Replaced::hasIntrinsicRatio const):
3686         (WebCore::Layout::Replaced::intrinsicRatio const):
3687         (WebCore::Layout::Replaced::hasAspectRatio const):
3688         * layout/layouttree/LayoutReplaced.h:
3689         * layout/layouttree/LayoutTreeBuilder.cpp:
3690         (WebCore::Layout::TreeBuilder::createSubTree):
3691
3692 2019-02-01  Zalan Bujtas  <zalan@apple.com>
3693
3694         [LFC] Set intrinsic size on Layout::Replaced
3695         https://bugs.webkit.org/show_bug.cgi?id=194139
3696
3697         Reviewed by Antti Koivisto.
3698
3699         Eventually Layout::Replaced will track intrinsic size internally until then let's query the RenderReplaced. 
3700
3701         * layout/layouttree/LayoutBox.h:
3702         (WebCore::Layout::Box::replaced):
3703         * layout/layouttree/LayoutReplaced.cpp:
3704         (WebCore::Layout::Replaced::hasIntrinsicWidth const):
3705         (WebCore::Layout::Replaced::hasIntrinsicHeight const):
3706         (WebCore::Layout::Replaced::intrinsicWidth const):
3707         (WebCore::Layout::Replaced::intrinsicHeight const):
3708         * layout/layouttree/LayoutReplaced.h:
3709         (WebCore::Layout::Replaced::setIntrinsicSize):
3710         (WebCore::Layout::Replaced::setIntrinsicRatio):
3711         * layout/layouttree/LayoutTreeBuilder.cpp:
3712         (WebCore::Layout::TreeBuilder::createSubTree):
3713         * rendering/RenderReplaced.h:
3714
3715 2019-02-01  Claudio Saavedra  <csaavedra@igalia.com>
3716
3717         Race-condition during scrolling thread creation
3718         https://bugs.webkit.org/show_bug.cgi?id=194016
3719
3720         Reviewed by Saam Barati.
3721
3722         There is a threading issue during the initialization
3723         of the scrolling thread caused by createThreadIfNeeded
3724         locking only on the creation of the thread but not on
3725         the initialization of the main loop, making it possible
3726         for a thread to try to spin the main loop before it's
3727         created.
3728
3729         Fix this by unconditionally waiting on the main loop
3730         being created. This makes it necessary to always hold
3731         the lock, even when the thread is already created.
3732
3733         * page/scrolling/ScrollingThread.cpp:
3734         (WebCore::ScrollingThread::createThreadIfNeeded):
3735
3736 2019-02-01  Simon Fraser  <simon.fraser@apple.com>
3737
3738         Use ScrollingNodeID in more places, and improve the name of a ScrollableArea function that returns a ScrollingNodeID
3739         https://bugs.webkit.org/show_bug.cgi?id=194126
3740
3741         Reviewed by Frédéric Wang.
3742         
3743         Change uint64_t ScrollableArea::scrollLayerID() to ScrollingNodeID ScrollableArea::scrollingNodeID()
3744         and fix callers.
3745
3746         * page/FrameView.cpp:
3747         (WebCore::FrameView::scrollingNodeID const):
3748         (WebCore::FrameView::scrollLayerID const): Deleted.
3749         * page/FrameView.h:
3750         * page/scrolling/AsyncScrollingCoordinator.cpp:
3751         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
3752         (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView):
3753         (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
3754         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
3755         (WebCore::AsyncScrollingCoordinator::frameViewForScrollingNode const):
3756         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
3757         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
3758         (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
3759         (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
3760         (WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons):
3761         (WebCore::AsyncScrollingCoordinator::setActiveScrollSnapIndices):
3762         (WebCore::AsyncScrollingCoordinator::updateScrollSnapPropertiesWithFrameView):
3763         * page/scrolling/ScrollingCoordinatorTypes.h:
3764         * platform/ScrollTypes.h:
3765         * platform/ScrollableArea.h:
3766         (WebCore::ScrollableArea::scrollingNodeID const):
3767         (WebCore::ScrollableArea::scrollLayerID const): Deleted.
3768         * rendering/RenderLayerCompositor.cpp:
3769         (WebCore::RenderLayerCompositor::parentFrameContentLayers):
3770         (WebCore::RenderLayerCompositor::detachRootLayer):
3771
3772 2019-01-31  Myles C. Maxfield  <mmaxfield@apple.com>
3773
3774         [WHLSL] Expressions can't be copyable
3775         https://bugs.webkit.org/show_bug.cgi?id=194116
3776
3777         Reviewed by Keith Rollin.
3778
3779         Expressions have UniqueRef members, which can't be copied. Describe this constraint explicitly rather than implicitly.
3780
3781         No new tests because there is no behavior change.
3782
3783         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h:
3784         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
3785
3786 2019-01-31  Takashi Komori  <Takashi.Komori@sony.com>
3787
3788         [Curl] Remove unnecessary member from NetworkStorageSession.
3789         https://bugs.webkit.org/show_bug.cgi?id=194137
3790
3791         Reviewed by Don Olmstead.
3792
3793         No new tests since there is no behavior change.
3794
3795         * platform/network/NetworkStorageSession.h:
3796         * platform/network/curl/NetworkStorageSessionCurl.cpp:
3797         (WebCore::NetworkStorageSession::NetworkStorageSession):
3798         (WebCore::NetworkStorageSession::context const): Deleted.
3799
3800 2019-01-31  Jer Noble  <jer.noble@apple.com>
3801
3802         NSInvalidArgumentException in [WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]
3803         https://bugs.webkit.org/show_bug.cgi?id=194123
3804         <rdar://problem/47721094>
3805
3806         Reviewed by Eric Carlson.
3807
3808         According to crash logs, AVSampleBufferDisplayLayer.error can go from an NSError* to nil; when such a change is KVO'd,
3809         the NSKeyValueChangeNewKey is a NSNull. Detect this state and bail out early.
3810
3811         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3812         (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):
3813
3814 2019-01-31  Jer Noble  <jer.noble@apple.com>
3815
3816         [Cocoa][EME] AirPlaying a FairPlay-protected HLS stream fails to decrypt
3817         https://bugs.webkit.org/show_bug.cgi?id=194114
3818
3819         Reviewed by Eric Carlson.
3820
3821         The AVAssetResourceLoaderDelegate must explicitly... delegate responsibility for FairPlay key
3822         requests to the AVContentKeySession.
3823
3824         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3825         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
3826
3827 2019-01-31  Megan Gardner  <megan_gardner@apple.com>
3828
3829         Don't insert spaces at the beginning of a newline when using smart-copy-paste
3830         https://bugs.webkit.org/show_bug.cgi?id=194070
3831
3832         Reviewed by Tim Horton.
3833
3834         If our inserted content end is at the beginning of a paragraph, do not insert a space.
3835         Also, if our inserted content beginning is at the end of a paragraph, do not insert a space.
3836
3837         Test: editing/pasteboard/mac/copy-smartpaste-first-line-in-textarea.html
3838
3839         * editing/ReplaceSelectionCommand.cpp:
3840         (WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace):
3841
3842 2019-01-31  Justin Fan  <justin_fan@apple.com>
3843
3844         [WebGPU] Build fix: disable MTLCopyAllDevices call on non-Mac platforms
3845         https://bugs.webkit.org/show_bug.cgi?id=194120
3846
3847         Unreviewed build fix. 
3848
3849         No new tests; no change in behavior.
3850
3851         * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
3852         (WebCore::GPUDevice::create): Wrap problem code in #if PLATFORM(MAC).
3853
3854 2019-01-31  Simon Fraser  <simon.fraser@apple.com>
3855
3856         Basic scrollability for async overflow scrolling on macOS
3857         https://bugs.webkit.org/show_bug.cgi?id=194093
3858
3859         Reviewed by Antti Koivisto.
3860
3861         Give a ScrollingTreeOverflowScrollingNodeMac a ScrollingTreeScrollingNodeDelegateMac and have it keep track
3862         of its layers so basic scrolling works for async overflow scroll.
3863
3864         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
3865         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
3866         (WebCore::ScrollingTreeOverflowScrollingNodeMac::create):
3867         (WebCore::ScrollingTreeOverflowScrollingNodeMac::ScrollingTreeOverflowScrollingNodeMac):
3868         (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateBeforeChildren):
3869         (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateAfterChildren):
3870         (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent):
3871         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const):
3872         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition):
3873         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
3874         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition):
3875         * rendering/RenderLayerBacking.cpp:
3876         (WebCore::RenderLayerBacking::updateScrollingLayers):
3877
3878 2019-01-31  Simon Fraser  <simon.fraser@apple.com>
3879
3880         Generalize ScrollingTreeScrollingNodeDelegate for use in macOS too, add a macOS subclass for frame/overflow scrolling
3881         https://bugs.webkit.org/show_bug.cgi?id=194080
3882
3883         Reviewed by Antti Koivisto.
3884
3885         To share code between ScrollingTreeFrameScrollingNodeMac and ScrollingTreeOverflowScrollingNodeMac, build ScrollingTreeScrollingNodeDelegate
3886         for macOS too, and add some helper functions to ScrollingTreeScrollingNodeDelegate.
3887
3888         Add a macOS subclass, ScrollingTreeScrollingNodeDelegateMac, which takes over the basic scrolling, rubber-banding
3889         and scroll snapping functionality from ScrollingTreeFrameScrollingNodeMac. The delegate owns the ScrollController and
3890         implements ScrollControllerClient.
3891
3892         ScrollingTreeFrameScrollingNodeMac now owns a ScrollingTreeScrollingNodeDelegateMac. A future patch
3893         will add one to ScrollingTreeOverflowScrollingNodeMac.
3894
3895         No behavior change.
3896
3897         * SourcesCocoa.txt:
3898         * WebCore.xcodeproj/project.pbxproj:
3899         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
3900         (WebCore::ScrollingTreeFrameScrollingNode::scrollBy): Deleted.
3901         (WebCore::ScrollingTreeFrameScrollingNode::scrollByWithoutContentEdgeConstraints): Deleted.
3902         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
3903         (WebCore::ScrollingTreeFrameScrollingNode::frameScaleFactor const):
3904         * page/scrolling/ScrollingTreeNode.cpp:
3905         (WebCore::ScrollingTreeNode::isRootNode const):
3906         * page/scrolling/ScrollingTreeNode.h:
3907         * page/scrolling/ScrollingTreeScrollingNode.cpp:
3908         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
3909         (WebCore::ScrollingTreeScrollingNode::scrollBy):
3910         (WebCore::ScrollingTreeScrollingNode::scrollByWithoutContentEdgeConstraints):
3911         * page/scrolling/ScrollingTreeScrollingNode.h:
3912         (WebCore::ScrollingTreeScrollingNode::expectsWheelEventTestTrigger const):
3913         * page/scrolling/ScrollingTreeScrollingNodeDelegate.cpp:
3914         * page/scrolling/ScrollingTreeScrollingNodeDelegate.h:
3915         (WebCore::ScrollingTreeScrollingNodeDelegate::scrollPosition const):
3916         (WebCore::ScrollingTreeScrollingNodeDelegate::minimumScrollPosition const):
3917         (WebCore::ScrollingTreeScrollingNodeDelegate::maximumScrollPosition const):
3918         (WebCore::ScrollingTreeScrollingNodeDelegate::scrollableAreaSize const):
3919         (WebCore::ScrollingTreeScrollingNodeDelegate::totalContentsSize const):
3920         (WebCore::ScrollingTreeScrollingNodeDelegate::hasEnabledHorizontalScrollbar const):
3921         (WebCore::ScrollingTreeScrollingNodeDelegate::hasEnabledVerticalScrollbar const):
3922         (WebCore::ScrollingTreeScrollingNodeDelegate::horizontalScrollElasticity const):
3923         (WebCore::ScrollingTreeScrollingNodeDelegate::verticalScrollElasticity const):
3924         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
3925         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3926         (WebCore::ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac):
3927         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
3928         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
3929         (WebCore::ScrollingTreeFrameScrollingNodeMac::minimumScrollPosition const):
3930         (WebCore::ScrollingTreeFrameScrollingNodeMac::maximumScrollPosition const):
3931         (WebCore::newGestureIsStarting): Deleted.
3932         (WebCore::ScrollingTreeFrameScrollingNodeMac::isAlreadyPinnedInDirectionOfGesture): Deleted.
3933         (WebCore::ScrollingTreeFrameScrollingNodeMac::allowsHorizontalStretching): Deleted.
3934         (WebCore::ScrollingTreeFrameScrollingNodeMac::allowsVerticalStretching): Deleted.
3935         (WebCore::ScrollingTreeFrameScrollingNodeMac::stretchAmount): Deleted.
3936         (WebCore::ScrollingTreeFrameScrollingNodeMac::pinnedInDirection): Deleted.
3937         (WebCore::ScrollingTreeFrameScrollingNodeMac::canScrollHorizontally): Deleted.
3938         (WebCore::ScrollingTreeFrameScrollingNodeMac::canScrollVertically): Deleted.
3939         (WebCore::ScrollingTreeFrameScrollingNodeMac::shouldRubberBandInDirection): Deleted.
3940         (WebCore::ScrollingTreeFrameScrollingNodeMac::immediateScrollBy): Deleted.